Comparing version 1.2.1 to 1.2.2
@@ -69,3 +69,3 @@ // Generated by dts-bundle-generator v6.4.0 | ||
}, ACTIONS extends LStateActions> { | ||
default: LCollectionOf<T>; | ||
items: LCollectionOf<T>; | ||
actions: (dml: { | ||
@@ -72,0 +72,0 @@ setter: LStateSetter<LCollectionOf<T>>; |
@@ -1,1 +0,1 @@ | ||
import{useEffect as v,useState as C}from"react";function T(e,n,s){if(e===n)return 0;let l=e===null?"null":typeof e,u=n===null?"null":typeof n,o;if(e instanceof Date)return n instanceof Date?e.getTime()-n.getTime():u==="string"?e.getTime()-new Date(n).getTime():-1;if(n instanceof Date)return l==="string"?new Date(e).getTime()-n.getTime():1;if(l!==u)return l==="undefined"?-1:u==="undefined"?1:l<u?-1:1;if(Array.isArray(e))return o=e.length-n.length,o||e.some((d,i)=>(o=T(d,n[i],s),!!o)),o;if(l==="object"){let d=Object.getOwnPropertyNames(e);return d.sort(),o=0,d.some(i=>(o=T(e[i],n[i],s),!!o)),o===0&&s&&(o=d.length-Object.getOwnPropertyNames(n).length),o}else return l==="function"?0:e<n?-1:1}function D(e){let n=e.compare||((t,r)=>t===r),s=e.initial||e.default,l=e.dependencies,u=e.compute,o=new Set,d;l&&O();let i={$:{get:S,subscribe(t){return o.add(t),()=>o&&o.delete(t)},destroy(){i&&(d&&(d.forEach(t=>setTimeout(t,1)),d=void 0),Object.keys(i.$).forEach(t=>{delete i.$[t]}),Object.keys(i).forEach(t=>{delete i[t]}),s=null,o.clear(),o=null,i=null,n=null)}}};return e.compute||(i.$.setter=c,e.actions&&(i={...i,...e.actions(e.default?{setter:c,upsert:f,remove:p}:c)})),e.default&&(i.$.load=t=>{c(()=>b(t))},i.$.subscribeList=t=>i.$.subscribe(r=>t(m(r))),i.$.subscribeQuery=(t,r,a)=>i.$.subscribe(y=>a(m(y).reduce(r,t))),i.$.subscribeItem=(t,r)=>i.$.subscribe(a=>r(a[t])),i.$.upsert=f,i.$.remove=p),i;function S(){return s}function c(t){let r=t(s);n(s,r)||(s=r,x())}function x(){o.forEach(t=>{setTimeout(()=>t(s),1)})}function O(){d=[];let t;d=l.map(a=>a.$.subscribe(r)),r();function r(){t&&clearTimeout(t),t=setTimeout(()=>{d&&u(c,...l.map(a=>a.$.get()))},100)}}function f(t,r){c(a=>{let y=a[t],L=r(y);return T(y,L,!0)===0?a:{...a,[t]:L}})}function p(t){c(r=>{let a={...r};return a[t]?(delete a[t],a):r})}}function $(e){let[n,s]=C(()=>e.$.get());return v(()=>e.$.subscribe(s),[]),n}function b(e){let n={};return e.forEach(s=>{let{id:l,...u}=s;n[l]=u}),n}function m(e){return Object.keys(e).map(n=>({id:n,...e[n]}))}export{b as collectionListToCollectionOf,m as collectionOfToCollectionList,D as createLState,$ as useLState}; | ||
import{useEffect as v,useState as C}from"react";function T(e,n,a){if(e===n)return 0;let l=e===null?"null":typeof e,u=n===null?"null":typeof n,o;if(e instanceof Date)return n instanceof Date?e.getTime()-n.getTime():u==="string"?e.getTime()-new Date(n).getTime():-1;if(n instanceof Date)return l==="string"?new Date(e).getTime()-n.getTime():1;if(l!==u)return l==="undefined"?-1:u==="undefined"?1:l<u?-1:1;if(Array.isArray(e))return o=e.length-n.length,o||e.some((d,i)=>(o=T(d,n[i],a),!!o)),o;if(l==="object"){let d=Object.getOwnPropertyNames(e);return d.sort(),o=0,d.some(i=>(o=T(e[i],n[i],a),!!o)),o===0&&a&&(o=d.length-Object.getOwnPropertyNames(n).length),o}else return l==="function"?0:e<n?-1:1}function D(e){let n=e.compare||((t,r)=>t===r),a=e.initial||e.items||e.default,l=e.dependencies,u=e.compute,o=new Set,d;l&&O();let i={$:{get:S,subscribe(t){return o.add(t),()=>o&&o.delete(t)},destroy(){i&&(d&&(d.forEach(t=>setTimeout(t,1)),d=void 0),Object.keys(i.$).forEach(t=>{delete i.$[t]}),Object.keys(i).forEach(t=>{delete i[t]}),a=null,o.clear(),o=null,i=null,n=null)}}};return e.compute||(i.$.setter=c,e.actions&&(i={...i,...e.actions(e.items?{setter:c,upsert:f,remove:p}:c)})),e.items&&(i.$.load=t=>{c(()=>b(t))},i.$.subscribeList=t=>i.$.subscribe(r=>t(m(r))),i.$.subscribeQuery=(t,r,s)=>i.$.subscribe(y=>s(m(y).reduce(r,t))),i.$.subscribeItem=(t,r)=>i.$.subscribe(s=>r(s[t])),i.$.upsert=f,i.$.remove=p),i;function S(){return a}function c(t){let r=t(a);n(a,r)||(a=r,x())}function x(){o.forEach(t=>{setTimeout(()=>t(a),1)})}function O(){d=[];let t;d=l.map(s=>s.$.subscribe(r)),r();function r(){t&&clearTimeout(t),t=setTimeout(()=>{d&&u(c,...l.map(s=>s.$.get()))},100)}}function f(t,r){c(s=>{let y=s[t],L=r(y);return T(y,L,!0)===0?s:{...s,[t]:L}})}function p(t){c(r=>{let s={...r};return s[t]?(delete s[t],s):r})}}function $(e){let[n,a]=C(()=>e.$.get());return v(()=>e.$.subscribe(a),[]),n}function b(e){let n={};return e.forEach(a=>{let{id:l,...u}=a;n[l]=u}),n}function m(e){return Object.keys(e).map(n=>({id:n,...e[n]}))}export{b as collectionListToCollectionOf,m as collectionOfToCollectionList,D as createLState,$ as useLState}; |
{ | ||
"name": "lstate", | ||
"description": "A simple, super-efficient and small (just 2.1kb) global state for React/Typescript applications", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43866