Comparing version 0.0.1 to 0.0.2
# r18gs | ||
## 0.0.2 | ||
### Patch Changes | ||
- Export SetStateAction and SetterArgTypes for better documentation and ease of use for other TS projects. | ||
## 0.0.1 | ||
@@ -4,0 +10,0 @@ |
@@ -1,1 +0,1 @@ | ||
import{a as e}from"./chunk-WZILE3X3.js";var r=e;export{r as default}; | ||
import{a as e}from"./chunk-3GC5MGOO.js";var r=e;export{r as default}; |
@@ -1,1 +0,1 @@ | ||
import{a}from"./chunk-WZILE3X3.js";export{a as default}; | ||
import{a}from"./chunk-3GC5MGOO.js";export{a as default}; |
@@ -1,1 +0,1 @@ | ||
"use strict";var g=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of u(e))!S.call(t,l)&&l!==o&&g(t,l,{get:()=>e[l],enumerable:!(n=c(e,l))||n.enumerable});return t};var f=t=>p(g({},"__esModule",{value:!0}),t);var v={};b(v,{default:()=>h});module.exports=f(v);var a=require("react");globalThis.rgs={};function T(t,e){let o=(0,a.useCallback)(r=>{let s=globalThis.rgs[t];s.value=r instanceof Function?r(s.value):r;for(let i of s.listeners)i()},[t]),n=(0,a.useCallback)(r=>{globalThis.rgs[t]||(globalThis.rgs[t]={listeners:[],value:e});let s=globalThis.rgs[t];return s.listeners.push(r),()=>{s.listeners=s.listeners.filter(i=>i!==r)}},[t,e]);return[(0,a.useSyncExternalStore)(n,()=>{var r,s;return(s=(r=globalThis.rgs[t])==null?void 0:r.value)!=null?s:e}),o]}var h=T; | ||
"use strict";var g=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},b=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of S(e))!p.call(t,l)&&l!==o&&g(t,l,{get:()=>e[l],enumerable:!(n=c(e,l))||n.enumerable});return t};var f=t=>b(g({},"__esModule",{value:!0}),t);var h={};u(h,{default:()=>v});module.exports=f(h);var a=require("react");globalThis.rgs={};function T(t,e){let o=(0,a.useCallback)(s=>{let r=globalThis.rgs[t];r.value=s instanceof Function?s(r.value):s;for(let i of r.listeners)i()},[t]),n=(0,a.useCallback)(s=>{globalThis.rgs[t]||(globalThis.rgs[t]={listeners:[],value:e});let r=globalThis.rgs[t];return r.listeners.push(s),()=>{r.listeners=r.listeners.filter(i=>i!==s)}},[t,e]);return[(0,a.useSyncExternalStore)(n,()=>{var s,r;return(r=(s=globalThis.rgs[t])==null?void 0:s.value)!=null?r:e}),o]}var v=T; |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A simple yet elegant, light weight, react18 global store to replace Zustand for better tree shaking.", | ||
@@ -8,0 +8,0 @@ "main": "index.js", |
@@ -5,3 +5,4 @@ interface React18GlobalStore { | ||
} | ||
type SetterArgType<T> = T | ((prevState: T) => T); | ||
export type SetterArgType<T> = T | ((prevState: T) => T); | ||
export type SetStateAction<T> = (val: SetterArgType<T>) => void; | ||
declare global { | ||
@@ -8,0 +9,0 @@ var rgs: Record<string, React18GlobalStore>; |
@@ -1,1 +0,1 @@ | ||
"use strict";var g=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var u=(t,s)=>{for(var o in s)g(t,o,{get:s[o],enumerable:!0})},p=(t,s,o,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let l of b(s))!S.call(t,l)&&l!==o&&g(t,l,{get:()=>s[l],enumerable:!(n=c(s,l))||n.enumerable});return t};var f=t=>p(g({},"__esModule",{value:!0}),t);var h={};u(h,{default:()=>T});module.exports=f(h);var a=require("react");globalThis.rgs={};function T(t,s){let o=(0,a.useCallback)(r=>{let e=globalThis.rgs[t];e.value=r instanceof Function?r(e.value):r;for(let i of e.listeners)i()},[t]),n=(0,a.useCallback)(r=>{globalThis.rgs[t]||(globalThis.rgs[t]={listeners:[],value:s});let e=globalThis.rgs[t];return e.listeners.push(r),()=>{e.listeners=e.listeners.filter(i=>i!==r)}},[t,s]);return[(0,a.useSyncExternalStore)(n,()=>{var r,e;return(e=(r=globalThis.rgs[t])==null?void 0:r.value)!=null?e:s}),o]} | ||
"use strict";var g=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},u=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of S(e))!b.call(t,l)&&l!==o&&g(t,l,{get:()=>e[l],enumerable:!(n=c(e,l))||n.enumerable});return t};var v=t=>u(g({},"__esModule",{value:!0}),t);var f={};p(f,{default:()=>T});module.exports=v(f);var a=require("react");globalThis.rgs={};function T(t,e){let o=(0,a.useCallback)(r=>{let s=globalThis.rgs[t];s.value=r instanceof Function?r(s.value):r;for(let i of s.listeners)i()},[t]),n=(0,a.useCallback)(r=>{globalThis.rgs[t]||(globalThis.rgs[t]={listeners:[],value:e});let s=globalThis.rgs[t];return s.listeners.push(r),()=>{s.listeners=s.listeners.filter(i=>i!==r)}},[t,e]);return[(0,a.useSyncExternalStore)(n,()=>{var r,s;return(s=(r=globalThis.rgs[t])==null?void 0:r.value)!=null?s:e}),o]} |
Sorry, the diff of this file is not supported yet
9197
36