immu-js 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/immu-js.cjs +1 -1
- package/dist/immu-js.js +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/immu-js.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=new WeakMap;function v(n){let r=S.get(n);return r||(r={subscribers:[],version:0,dirtyProps:new Set},S.set(n,r)),r}let d=new Set,g=!1;function P(n,r){const t=v(n);t.version++,t.dirtyProps.add(r),d.add(n),g||(g=!0,queueMicrotask(k))}function k(){const n=d;d=new Set,g=!1;for(const r of n){const t=v(r),s=t.dirtyProps;t.dirtyProps=new Set;const f=s.has("*"),l=t.subscribers.filter(c=>f||c.prop===void 0||s.has(c.prop));for(const c of l)c.callback()}}const p=[];function b(){p.push(new Set)}function y(){return p.pop()??new Set}function w(n){p.length>0&&p[p.length-1].add(n)}function h(n){const r=new Set,t=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];let s=n;for(;s&&!t.includes(s);){for(const f of Reflect.ownKeys(s))f!=="constructor"&&r.add(f);s=Object.getPrototypeOf(s)}return Array.from(r)}function M(n){const r=new n,t=r,s=new Map,f=[],l=new Map,c=v(t),u=h(r);for(const e of u){if(typeof e=="symbol")continue;const o=e,i=r[o];typeof i!="function"&&(s.set(o,i),f.push(o))}for(const e of f)delete r[e],Object.defineProperty(t,e,{get(){return w(t),s.get(e)},set(o){s.set(e,o),P(t,e)},enumerable:!0,configurable:!0});return Object.defineProperty(t,"_version",{get(){return c.version},enumerable:!1,configurable:!1}),Object.defineProperty(t,"_subscribe",{value:(e,o)=>{const i={callback:e,prop:o};return c.subscribers.push(i),()=>{c.subscribers=c.subscribers.filter(a=>a!==i)}},enumerable:!1,configurable:!1,writable:!1}),Object.defineProperty(t,"_reset",{value:()=>{const e=new n,o=h(e);for(const i of o){if(typeof i=="symbol")continue;const a=i,m=e[a];typeof m!="function"&&(t[a]=m)}},enumerable:!1,configurable:!1,writable:!1}),Object.defineProperty(t,"_saveVersion",{value:(e="default")=>{const o=[];for(const[i,a]of s)o.push([i,structuredClone(a)]);l.set(e,o)},enumerable:!1,configurable:!1,writable:!1}),Object.defineProperty(t,"_loadVersion",{value:(e="default")=>{const o=l.get(e);if(!o)throw new Error(`No saved version found for label "${e}"`);for(const[i,a]of o)t[i]=structuredClone(a)},enumerable:!1,configurable:!1,writable:!1}),t}function _(n){let r,t=new Map,s,f=!1;function l(u){for(const[e,o]of u)if(e._version!==o)return!1;return!0}function c(u){for(const[e]of u)w(e)}return(...u)=>{const e=JSON.stringify(u);if(f&&e===r&&l(t))return c(t),s;b();const o=n(...u),i=y();t=new Map;for(const a of i)t.set(a,a._version);return r=e,s=o,f=!0,c(t),o}}function O(n){let r=new Map,t,s=!1;function f(c){for(const[u,e]of c)if(u._version!==e)return!1;return!0}function l(c){for(const[u]of c)w(u)}return{get value(){if(s&&f(r))return l(r),t;b();const c=n(),u=y();r=new Map;for(const e of u)r.set(e,e._version);return t=c,s=!0,l(r),c}}}function j(n,r){let t=!0,s=[],f=[],l;function c(){if(!t)return;if(r){const e=r();if(l&&A(l,e))return;l=e}for(const e of f)e();f=[],b(),n();const u=y();s=Array.from(u);for(const e of s){const o=e._subscribe(()=>{c()});f.push(o)}if(r){b(),r();const e=y();for(const o of Array.from(e))if(!s.includes(o)){const i=o._subscribe(()=>{c()});f.push(i)}}}return c(),()=>{t=!1;for(const u of f)u();f=[]}}function A(n,r){if(n.length!==r.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==r[t])return!1;return!0}exports._flush=k;exports.computed=O;exports.create=M;exports.getAllProps=h;exports.memo=_;exports.run=j;
|
package/dist/immu-js.js
CHANGED
package/dist/index.d.ts
CHANGED