Comparing version 2.0.1 to 2.0.2
@@ -1,1 +0,1 @@ | ||
"use strict";var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},b=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of g(t))!p.call(e,o)&&o!==n&&i(e,o,{get:()=>t[o],enumerable:!(r=l(t,o))||r.enumerable});return e};var v=e=>b(i({},"__esModule",{value:!0}),e);var d={};f(d,{useRGS:()=>x});module.exports=v(d);var c=require("react");var a=globalThis;a.rgs||(a.rgs={});var s=a.rgs;var T=e=>t=>{let n=s[e];return n.l.push(t),()=>{n.l=n.l.filter(r=>r!==t)}},u=e=>t=>{let n=s[e];n.v=typeof t=="function"?t(n.v):t,n.l.forEach(r=>r())},S=e=>{let t=s[e],n=()=>t.v;return[(0,c.useSyncExternalStore)(t.u,n,n),t.s]};var x=(e,t)=>(s[e]||(s[e]={v:typeof t=="function"?t():t,l:[],s:u(e),u:T(e)}),S(e));0&&(module.exports={useRGS}); | ||
"use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of g(t))!p.call(e,o)&&o!==n&&i(e,o,{get:()=>t[o],enumerable:!(r=u(t,o))||r.enumerable});return e};var x=e=>v(i({},"__esModule",{value:!0}),e);var d={};f(d,{useRGS:()=>A});module.exports=x(d);var T=require("react");var a=globalThis;a.rgs||(a.rgs={});var s=a.rgs;var c=e=>t=>{let n=s[e];n.v=typeof t=="function"?t(n.v):t,n.l.forEach(r=>r())},S=e=>{let t=s[e],n=()=>t.v;return[(0,T.useSyncExternalStore)(o=>(t.l.push(o),()=>{t.l=t.l.filter(l=>l!==o)}),n,n),t.s]};var A=(e,t)=>(s[e]||(s[e]={v:typeof t=="function"?t():t,l:[],s:c(e)}),S(e));0&&(module.exports={useRGS}); |
type Listener = () => void; | ||
type Subscriber = (l: Listener) => () => void; | ||
export type SetterArgType<T> = T | ((prevState: T) => T); | ||
@@ -13,3 +12,2 @@ export type SetStateAction<T> = (value: SetterArgType<T>) => void; | ||
s: SetStateAction<unknown> | null; | ||
u: Subscriber; | ||
}; | ||
@@ -20,4 +18,2 @@ declare global { | ||
export declare const globalRGS: Record<string, RGS | undefined>; | ||
/** craete subscriber function to subscribe to the store. */ | ||
export declare const createSubcriber: (key: string) => Subscriber; | ||
/** setter function to set the state. */ | ||
@@ -24,0 +20,0 @@ export declare const createSetter: <T>(key: string) => SetStateAction<unknown>; |
@@ -1,1 +0,1 @@ | ||
"use strict";var S=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of R(t))!G.call(e,s)&&s!==n&&S(e,s,{get:()=>t[s],enumerable:!(r=x(t,s))||r.enumerable});return e};var P=e=>y(S({},"__esModule",{value:!0}),e);var f=(e,t,n)=>new Promise((r,s)=>{var o=i=>{try{c(n.next(i))}catch(T){s(T)}},u=i=>{try{c(n.throw(i))}catch(T){s(T)}},c=i=>i.done?r(i.value):Promise.resolve(i.value).then(o,u);c((n=n.apply(e,t)).next())});var m={};A(m,{createHook:()=>b,createSetter:()=>L,createSubcriber:()=>l,globalRGS:()=>a,initWithPlugins:()=>h,useRGSWithPlugins:()=>E});module.exports=P(m);var p=require("react");var g=globalThis;g.rgs||(g.rgs={});var a=g.rgs,v=e=>e.l.forEach(t=>t()),l=e=>t=>{let n=a[e];return n.l.push(t),()=>{n.l=n.l.filter(r=>r!==t)}},L=e=>t=>{let n=a[e];n.v=typeof t=="function"?t(n.v):t,n.l.forEach(r=>r())},b=e=>{let t=a[e],n=()=>t.v;return[(0,p.useSyncExternalStore)(t.u,n,n),t.s]},d=!1,w=(e,t)=>f(void 0,null,function*(){var s;let n=a[e],r=o=>{n.v=o,v(n)};for(let o of t)yield(s=o.init)==null?void 0:s.call(o,e,n.v,r);d=!0}),h=(e,t,n=[],r=!1)=>{if(t=t instanceof Function?t():t,r){a[e]={v:t,l:[],s:null,u:l(e)};return}let s=u=>{if(!d)return;let c=a[e];c.v=u instanceof Function?u(c.v):u,v(c),n.forEach(i=>{var T;return(T=i.onChange)==null?void 0:T.call(i,e,c.v)})},o=a[e];o?(o.v=t,o.s=s):a[e]={v:t,l:[],s,u:l(e)},w(e,n)},E=(e,t,n,r=!1)=>{var s;return(s=a[e])!=null&&s.s||h(e,t,n,r),b(e)};0&&(module.exports={createHook,createSetter,createSubcriber,globalRGS,initWithPlugins,useRGSWithPlugins}); | ||
"use strict";var g=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},G=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of R(t))!y.call(e,s)&&s!==n&&g(e,s,{get:()=>t[s],enumerable:!(o=x(t,s))||o.enumerable});return e};var P=e=>G(g({},"__esModule",{value:!0}),e);var u=(e,t,n)=>new Promise((o,s)=>{var r=i=>{try{T(n.next(i))}catch(c){s(c)}},l=i=>{try{T(n.throw(i))}catch(c){s(c)}},T=i=>i.done?o(i.value):Promise.resolve(i.value).then(r,l);T((n=n.apply(e,t)).next())});var m={};A(m,{createHook:()=>v,createSetter:()=>w,globalRGS:()=>a,initWithPlugins:()=>h,useRGSWithPlugins:()=>b});module.exports=P(m);var f=require("react");var S=globalThis;S.rgs||(S.rgs={});var a=S.rgs,p=e=>e.l.forEach(t=>t()),w=e=>t=>{let n=a[e];n.v=typeof t=="function"?t(n.v):t,n.l.forEach(o=>o())},v=e=>{let t=a[e],n=()=>t.v;return[(0,f.useSyncExternalStore)(s=>(t.l.push(s),()=>{t.l=t.l.filter(r=>r!==s)}),n,n),t.s]},d=!1,E=(e,t)=>u(void 0,null,function*(){var s;let n=a[e],o=r=>{n.v=r,p(n)};for(let r of t)yield(s=r.init)==null?void 0:s.call(r,e,n.v,o);d=!0}),h=(e,t,n=[],o=!1)=>{if(t=t instanceof Function?t():t,o){a[e]={v:t,l:[],s:null};return}let s=l=>{if(!d)return;let T=a[e];T.v=l instanceof Function?l(T.v):l,p(T),n.forEach(i=>{var c;return(c=i.onChange)==null?void 0:c.call(i,e,T.v)})},r=a[e];r?(r.v=t,r.s=s):a[e]={v:t,l:[],s},E(e,n)},b=(e,t,n,o=!1)=>{var s;return(s=a[e])!=null&&s.s||h(e,t,n,o),v(e)};0&&(module.exports={createHook,createSetter,globalRGS,initWithPlugins,useRGSWithPlugins}); |
@@ -1,1 +0,1 @@ | ||
"use strict";var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},R=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of x(e))!d.call(t,s)&&s!==n&&l(t,s,{get:()=>e[s],enumerable:!(r=b(e,s))||r.enumerable});return t};var G=t=>R(l({},"__esModule",{value:!0}),t);var p=(t,e,n)=>new Promise((r,s)=>{var o=i=>{try{a(n.next(i))}catch(T){s(T)}},u=i=>{try{a(n.throw(i))}catch(T){s(T)}},a=i=>i.done?r(i.value):Promise.resolve(i.value).then(o,u);a((n=n.apply(t,e)).next())});var W={};A(W,{create:()=>w,useRGSWithPlugins:()=>S,withPlugins:()=>L});module.exports=G(W);var h=require("react");var g=globalThis;g.rgs||(g.rgs={});var c=g.rgs,v=t=>t.l.forEach(e=>e()),f=t=>e=>{let n=c[t];return n.l.push(e),()=>{n.l=n.l.filter(r=>r!==e)}};var y=t=>{let e=c[t],n=()=>e.v;return[(0,h.useSyncExternalStore)(e.u,n,n),e.s]},P=!1,U=(t,e)=>p(void 0,null,function*(){var s;let n=c[t],r=o=>{n.v=o,v(n)};for(let o of e)yield(s=o.init)==null?void 0:s.call(o,t,n.v,r);P=!0}),m=(t,e,n=[],r=!1)=>{if(e=e instanceof Function?e():e,r){c[t]={v:e,l:[],s:null,u:f(t)};return}let s=u=>{if(!P)return;let a=c[t];a.v=u instanceof Function?u(a.v):u,v(a),n.forEach(i=>{var T;return(T=i.onChange)==null?void 0:T.call(i,t,a.v)})},o=c[t];o?(o.v=e,o.s=s):c[t]={v:e,l:[],s,u:f(t)},U(t,n)},S=(t,e,n,r=!1)=>{var s;return(s=c[t])!=null&&s.s||m(t,e,n,r),y(t)};var w=(t,e,n)=>()=>S(t,e,n),L=t=>(n,r,s=!1)=>S(n,r,t,s);0&&(module.exports={create,useRGSWithPlugins,withPlugins}); | ||
"use strict";var g=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var A=(n,t)=>{for(var e in t)g(n,e,{get:t[e],enumerable:!0})},y=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of x(t))!d.call(n,o)&&o!==e&&g(n,o,{get:()=>t[o],enumerable:!(s=P(t,o))||s.enumerable});return n};var R=n=>y(g({},"__esModule",{value:!0}),n);var p=(n,t,e)=>new Promise((s,o)=>{var i=r=>{try{a(e.next(r))}catch(c){o(c)}},l=r=>{try{a(e.throw(r))}catch(c){o(c)}},a=r=>r.done?s(r.value):Promise.resolve(r.value).then(i,l);a((e=e.apply(n,t)).next())});var b={};A(b,{create:()=>w,useRGSWithPlugins:()=>u,withPlugins:()=>W});module.exports=R(b);var f=require("react");var S=globalThis;S.rgs||(S.rgs={});var T=S.rgs,h=n=>n.l.forEach(t=>t());var G=n=>{let t=T[n],e=()=>t.v;return[(0,f.useSyncExternalStore)(o=>(t.l.push(o),()=>{t.l=t.l.filter(i=>i!==o)}),e,e),t.s]},v=!1,U=(n,t)=>p(void 0,null,function*(){var o;let e=T[n],s=i=>{e.v=i,h(e)};for(let i of t)yield(o=i.init)==null?void 0:o.call(i,n,e.v,s);v=!0}),m=(n,t,e=[],s=!1)=>{if(t=t instanceof Function?t():t,s){T[n]={v:t,l:[],s:null};return}let o=l=>{if(!v)return;let a=T[n];a.v=l instanceof Function?l(a.v):l,h(a),e.forEach(r=>{var c;return(c=r.onChange)==null?void 0:c.call(r,n,a.v)})},i=T[n];i?(i.v=t,i.s=o):T[n]={v:t,l:[],s:o},U(n,e)},u=(n,t,e,s=!1)=>{var o;return(o=T[n])!=null&&o.s||m(n,t,e,s),G(n)};var w=(n,t,e)=>()=>u(n,t,e),W=n=>(e,s,o=!1)=>u(e,s,n,o);0&&(module.exports={create,useRGSWithPlugins,withPlugins}); |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A simple yet elegant, light weight, react18 global store to replace Zustand for better tree shaking.", | ||
@@ -8,0 +8,0 @@ "license": "MPL-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21020
150