atomaric 0.0.82 → 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.
@@ -1 +1 @@
1
- (function(d,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(d=typeof globalThis<"u"?globalThis:d||self,$(d.atomaric={}))})(this,function(d){"use strict";let $=()=>{throw"call configureAtomaric() before all!"};const z={},St=e=>{z.useSyncExternalStore=$=e.useSyncExternalStore,z.keyPathSeparator=e.keyPathSeparator,z.securifyKeyLevel=e.securifyKeyLevel,z.securifyValueLevel=e.securifyValueLevel},Le=e=>$(e.subscribe,e.get),Ve=e=>e.set,At=e=>e.setDeferred,Pt=e=>e.get,bt=e=>e.do,Dt=e=>[Le(e),Ve(e)],It=(e,t)=>new dt(e,t);class T{constructor(t){if(t)return new Proxy(this,{get:(r,n)=>n in this?r[n]:t[n]})}}var je=Symbol.for("immer-nothing"),Oe=Symbol.for("immer-draftable"),y=Symbol.for("immer-state"),Mt=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function g(e,...t){if(process.env.NODE_ENV!=="production"){const r=Mt[e],n=E(r)?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var w=Object,R=w.getPrototypeOf,Y="constructor",Q="prototype",me="configurable",X="enumerable",Z="writable",G="value",v=e=>!!e&&!!e[y];function I(e){var t;return e?Be(e)||re(e)||!!e[Oe]||!!((t=e[Y])!=null&&t[Oe])||ne(e)||se(e):!1}var Ct=w[Q][Y].toString(),Ue=new WeakMap;function Be(e){if(!e||!ge(e))return!1;const t=R(e);if(t===null||t===w[Q])return!0;const r=w.hasOwnProperty.call(t,Y)&&t[Y];if(r===Object)return!0;if(!E(r))return!1;let n=Ue.get(r);return n===void 0&&(n=Function.toString.call(r),Ue.set(r,n)),n===Ct}function ee(e,t,r=!0){q(e)===0?(r?Reflect.ownKeys(e):w.keys(e)).forEach(s=>{t(s,e[s],e)}):e.forEach((n,s)=>t(s,n,e))}function q(e){const t=e[y];return t?t.type_:re(e)?1:ne(e)?2:se(e)?3:0}var We=(e,t,r=q(e))=>r===2?e.has(t):w[Q].hasOwnProperty.call(e,t),pe=(e,t,r=q(e))=>r===2?e.get(t):e[t],te=(e,t,r,n=q(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function zt(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var re=Array.isArray,ne=e=>e instanceof Map,se=e=>e instanceof Set,ge=e=>typeof e=="object",E=e=>typeof e=="function",we=e=>typeof e=="boolean";function vt(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var M=e=>e.copy_||e.base_,Se=e=>e.modified_?e.copy_:e.base_;function Ae(e,t){if(ne(e))return new Map(e);if(se(e))return new Set(e);if(re(e))return Array[Q].slice.call(e);const r=Be(e);if(t===!0||t==="class_only"&&!r){const n=w.getOwnPropertyDescriptors(e);delete n[y];let s=Reflect.ownKeys(n);for(let i=0;i<s.length;i++){const c=s[i],u=n[c];u[Z]===!1&&(u[Z]=!0,u[me]=!0),(u.get||u.set)&&(n[c]={[me]:!0,[Z]:!0,[X]:u[X],[G]:e[c]})}return w.create(R(e),n)}else{const n=R(e);if(n!==null&&r)return{...e};const s=w.create(n);return w.assign(s,e)}}function Pe(e,t=!1){return oe(e)||v(e)||!I(e)||(q(e)>1&&w.defineProperties(e,{set:ie,add:ie,clear:ie,delete:ie}),w.freeze(e),t&&ee(e,(r,n)=>{Pe(n,!0)},!1)),e}function Tt(){g(2)}var ie={[G]:Tt};function oe(e){return e===null||!ge(e)?!0:w.isFrozen(e)}var ce="MapSet",be="Patches",Ge="ArrayMethods",qe={};function F(e){const t=qe[e];return t||g(0,e),t}var He=e=>!!qe[e],H,Je=()=>H,Et=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:He(ce)?F(ce):void 0,arrayMethodsPlugin_:He(Ge)?F(Ge):void 0});function Ke(e,t){t&&(e.patchPlugin_=F(be),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function De(e){Ie(e),e.drafts_.forEach(Ft),e.drafts_=null}function Ie(e){e===H&&(H=e.parent_)}var Ye=e=>H=Et(H,e);function Ft(e){const t=e[y];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Qe(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[y].modified_&&(De(t),g(4)),I(e)&&(e=Xe(t,e));const{patchPlugin_:s}=t;s&&s.generateReplacementPatches_(r[y].base_,e,t)}else e=Xe(t,r);return xt(t,e,!0),De(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==je?e:void 0}function Xe(e,t){if(oe(t))return t;const r=t[y];if(!r)return ue(t,e.handledSet_,e);if(!ae(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);tt(r,e)}return r.copy_}function xt(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Pe(t,r)}function Ze(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ae=(e,t)=>e.scope_===t,Nt=[];function et(e,t,r,n){const s=M(e),i=e.type_;if(n!==void 0&&pe(s,n,i)===t){te(s,n,r,i);return}if(!e.draftLocations_){const u=e.draftLocations_=new Map;ee(s,(_,h)=>{if(v(h)){const m=u.get(h)||[];m.push(_),u.set(h,m)}})}const c=e.draftLocations_.get(t)??Nt;for(const u of c)te(s,u,r,i)}function $t(e,t,r){e.callbacks_.push(function(s){var u;const i=t;if(!i||!ae(i,s))return;(u=s.mapSetPlugin_)==null||u.fixSetContents(i);const c=Se(i);et(e,i.draft_??i,c,r),tt(i,s)})}function tt(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:s}=t;if(s){const i=s.getPath(e);i&&s.generatePatches_(e,i,t)}Ze(e)}}function Rt(e,t,r){const{scope_:n}=e;if(v(r)){const s=r[y];ae(s,n)&&s.callbacks_.push(function(){le(e);const c=Se(s);et(e,r,c,t)})}else I(r)&&e.callbacks_.push(function(){const i=M(e);e.type_===3?i.has(r)&&ue(r,n.handledSet_,n):pe(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ue(pe(e.copy_,t,e.type_),n.handledSet_,n)})}function ue(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||v(e)||t.has(e)||!I(e)||oe(e)||(t.add(e),ee(e,(n,s)=>{if(v(s)){const i=s[y];if(ae(i,r)){const c=Se(i);te(e,n,c,e.type_),Ze(i)}}else I(s)&&ue(s,t,r)})),e}function kt(e,t){const r=re(e),n={type_:r?1:0,scope_:t?t.scope_:Je(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let s=n,i=fe;r&&(s=[n],i=J);const{revoke:c,proxy:u}=Proxy.revocable(s,i);return n.draft_=u,n.revoke_=c,[u,n]}var fe={get(e,t){if(t===y)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const s=M(e);if(!We(s,t,e.type_))return Lt(e,s,t);const i=s[t];if(e.finalized_||!I(i)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&vt(t))return i;if(i===Me(e.base_,t)){le(e);const c=e.type_===1?+t:t,u=ze(e.scope_,i,e,c);return e.copy_[c]=u}return i},has(e,t){return t in M(e)},ownKeys(e){return Reflect.ownKeys(M(e))},set(e,t,r){const n=rt(M(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const s=Me(M(e),t),i=s==null?void 0:s[y];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(zt(r,s)&&(r!==void 0||We(e.base_,t,e.type_)))return!0;le(e),Ce(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Rt(e,t,r)),!0},deleteProperty(e,t){return le(e),Me(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ce(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=M(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Z]:!0,[me]:e.type_!==1||t!=="length",[X]:n[X],[G]:r[t]}},defineProperty(){g(11)},getPrototypeOf(e){return R(e.base_)},setPrototypeOf(){g(12)}},J={};for(let e in fe){let t=fe[e];J[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}J.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&g(13),J.set.call(this,e,t,void 0)},J.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&g(14),fe.set.call(this,e[0],t,r,e[0])};function Me(e,t){const r=e[y];return(r?M(r):e)[t]}function Lt(e,t,r){var s;const n=rt(t,r);return n?G in n?n[G]:(s=n.get)==null?void 0:s.call(e.draft_):void 0}function rt(e,t){if(!(t in e))return;let r=R(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=R(r)}}function Ce(e){e.modified_||(e.modified_=!0,e.parent_&&Ce(e.parent_))}function le(e){e.copy_||(e.assigned_=new Map,e.copy_=Ae(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Vt=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(E(t)&&!E(r)){const i=r;r=t;const c=this;return function(_=i,...h){return c.produce(_,m=>r.call(this,m,...h))}}E(r)||g(6),n!==void 0&&!E(n)&&g(7);let s;if(I(t)){const i=Ye(this),c=ze(i,t,void 0);let u=!0;try{s=r(c),u=!1}finally{u?De(i):Ie(i)}return Ke(i,n),Qe(s,i)}else if(!t||!ge(t)){if(s=r(t),s===void 0&&(s=t),s===je&&(s=void 0),this.autoFreeze_&&Pe(s,!0),n){const i=[],c=[];F(be).generateReplacementPatches_(t,s,{patches_:i,inversePatches_:c}),n(i,c)}return s}else g(1,t)},this.produceWithPatches=(t,r)=>{if(E(t))return(c,...u)=>this.produceWithPatches(c,_=>t(_,...u));let n,s;return[this.produce(t,r,(c,u)=>{n=c,s=u}),n,s]},we(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),we(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),we(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){I(e)||g(8),v(e)&&(e=jt(e));const t=Ye(this),r=ze(t,e,void 0);return r[y].isManual_=!0,Ie(t),r}finishDraft(e,t){const r=e&&e[y];(!r||!r.isManual_)&&g(9);const{scope_:n}=r;return Ke(n,t),Qe(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const s=t[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(t=t.slice(r+1));const n=F(be).applyPatches_;return v(e)?n(e,t):this.produce(e,s=>n(s,t))}};function ze(e,t,r,n){const[s,i]=ne(t)?F(ce).proxyMap_(t,r):se(t)?F(ce).proxySet_(t,r):kt(t,r);return((r==null?void 0:r.scope_)??Je()).drafts_.push(s),i.callbacks_=(r==null?void 0:r.callbacks_)??[],i.key_=n,r&&n!==void 0?$t(r,i,n):i.callbacks_.push(function(_){var m;(m=_.mapSetPlugin_)==null||m.fixSetContents(i);const{patchPlugin_:h}=_;i.modified_&&h&&h.generatePatches_(i,[],_)}),s}function jt(e){return v(e)||g(10,e),nt(e)}function nt(e){if(!I(e)||oe(e))return e;const t=e[y];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ae(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ae(e,!0);return ee(r,(s,i)=>{te(r,s,nt(i))},n),t&&(t.finalized_=!1),r}var Ot=new Vt,st=Ot.produce;class it extends T{constructor(t,r){super(r),this.a=t,this.push=(...n)=>{n.length!==0&&this.a.set(this.a.get().concat(n))},this.unshift=(...n)=>{n.length!==0&&this.a.set(n.concat(this.a.get()))},this.update=n=>{const s=this.a.get(),i=st(s,c=>void n(c));i!==s&&this.a.set(i)},this.filter=n=>{const s=this.a.get().filter(n??Ut);s.length!==this.a.get().length&&this.a.set(s)},this.add=n=>{this.a.get().includes(n)||this.a.set(this.a.get().concat([n]))},this.removeFirst=n=>{const s=this.a.get().indexOf(n);if(s<0)return;const i=this.a.get().slice(0);i.splice(s,1),this.a.set(i)},this.toggle=(n,s)=>{const i=this.a.get().slice(),c=i.indexOf(n);c<0?s?i.unshift(n):i.push(n):i.splice(c,1),this.a.set(i)}}}const Ut=e=>e;class ot extends T{constructor(t,r){super(r),this.a=t,this.toggle=()=>{this.a.set(!this.a.get())}}}class ct extends T{constructor(t,r){super(r),this.a=t,this.setValue=(n,s)=>{if(this.a.get().get(n)===s)return;const i=new Map(this.a.get());i.set(n,s),this.a.set(i)},this.setIfNo=(n,s)=>{if(this.a.get().has(n))return;const i=new Map(this.a.get());i.set(n,s),this.a.set(i)},this.delete=n=>{if(!this.a.get().has(n))return;const s=new Map(this.a.get());s.delete(n),this.a.set(s)},this.toggle=(n,s)=>{const i=new Map(this.a.get());i.has(n)?i.delete(n):i.set(n,s),this.a.set(i)},this.clear=()=>{this.a.set(new Map)},this.a=t}}class at extends T{constructor(t,r){super(r),this.a=t,this.increment=n=>{this.a.set(+this.a.get()+(n??1))}}}class ut extends T{constructor(t,r){super(r),this.a=t,this.setPartial=n=>this.a.set(s=>({...s,...typeof n=="function"?n(this.a.get()):n})),this.update=n=>{const s=this.a.get(),i=st(s,c=>void n(c));i!==s&&this.a.set(i)},this.setDeepPartial=(n,s,i,c=z.keyPathSeparator||".")=>{if(!c)return;if(n.includes(c)){let h=n.split(c);const m=h[h.length-1];h=h.slice(0,-1);const x={...this.a.get()};let A=x,p=i;for(const j of h){p=p==null?void 0:p[Array.isArray(p)?"0":j];const S=A[ft(A,j)]??(Array.isArray(p)?[]:{});if(S==null||typeof S!="object"){if(i==null)throw"Incorrect path for setDeepPartial";const ye=typeof s=="function"?s(void 0):s;this.a.get()[n]!==ye&&this.setPartial({[n]:ye});return}A=A[ft(A,j)]=Array.isArray(S)?[...S]:{...S}}const D=A[m];A[m]=typeof s=="function"?s(A[m]):s,D!==A[m]&&this.a.set(x);return}const u=this.a.get()[n],_=typeof s=="function"?s(u):s;_!==u&&this.setPartial({[n]:_})}}}const ft=(e,t)=>Array.isArray(e)?`${+t}`:t;class lt extends T{constructor(t,r){super(r),this.a=t,this.add=n=>{this.a.get().has(n)||this.a.set(new Set(this.a.get()).add(n))},this.delete=n=>{if(!this.a.get().has(n))return;const s=new Set(this.a.get());s.delete(n),this.a.set(s)},this.toggle=n=>{const s=new Set(this.a.get());s.has(n)?s.delete(n):s.add(n),this.a.set(s)},this.clear=()=>{this.a.set(new Set)},this.a=t}}const Bt=(e,t,r)=>{const n=typeof r=="object"&&r!=null&&"do"in r?r.do((i,c)=>t.set(i,c),()=>t.get(),t,(i,c,u)=>t.setDeferred(i,c,u)):null,s={};return n&&Object.keys(n).forEach(i=>Object.defineProperty(s,i,{get:()=>n[i]})),typeof e=="number"?new at(t,n):typeof e=="boolean"?new ot(t,n):Array.isArray(e)?new it(t,n):e instanceof Set?new lt(t,n):e instanceof Map?new ct(t,n):e instanceof Object?new ut(t,n):new T(n)};class dt{constructor(t,r){t=typeof t=="function"?t():t;const n=o=>m=o,s=()=>m,i=new Set,c=o=>o(p());let u=!0,_=!1,h=o=>o,m=t,x,A=()=>{},p=()=>s(),D=null,j=()=>{const o=Bt(t,S,r);return j=()=>o,o};const S=new Proxy(this,{get:(o,l)=>l==="do"?j():o[l],set:Wt}),ye=()=>{u=!0,_!==!0&&A(p()),_=!1;try{ve.postMessage({key:f,value:s()})}catch{}},O=(o,l)=>{let b=typeof o=="function"?o(p()):o;b=h(b,p()),b!==p()&&(n(b),_=l,u&&(u=!1,i.forEach(c),queueMicrotask(ye)))};this.set=(o,l)=>O(o,l),this.get=()=>p(),this.initialValue=t,this.isInitialValue=()=>t===s(),this.subscribe=o=>(i.add(o),()=>{i.delete(o)}),this.reset=()=>{O(t,!0)};const Jt=(o,l)=>{O(o,l),x=void 0};if(this.setDeferred=(o,l=500,b,C=!0)=>{C&&x===void 0&&O(o,b),clearTimeout(x),x=setTimeout(Jt,l,o,b)},r==null)return S;let P=null,K=null,xe=!0,Ne=!0,$e=!1,N=0,U=0,mt=-1,B=t instanceof Set?o=>new Set(o):t instanceof Map?o=>new Map(o):o=>o,W=t instanceof Set?o=>{if(o instanceof Set)return Array.from(o);throw console.error(o),"The value is not Set instance"}:t instanceof Map?o=>{if(o instanceof Map){const l=[];return o.forEach((b,C)=>l.push([C,b])),l}throw console.error(o),"The value is not Set instance"}:o=>o;if(typeof r=="string")P=r;else if(h=r.map??h,"storageKey"in r)xe=r.warnOnDuplicateStorageKey??xe,Ne=r.listenStorageChanges??Ne,P=r.storageKey,B=r.unzipValue??B,W=r.zipValue??W,$e=r.unchangable??$e,N=r.securifyKeyLevel??z.securifyKeyLevel??N,U=r.securifyValueLevel??z.securifyValueLevel??U,K=r.exp??K;else return S;const Re=N?V(P,N):P,f=`${U?Te:L}${Re}`;if(N){const o=`${L}${P}`;o in a&&(a[f]=a[o],delete a[o])}else{const o=`${L}${V(P,N)}`;o in a&&(a[f]=a[o],delete a[o])}const ke=K===null||!(K(S,f in a)instanceof Date)?o=>V([W(o)],0):o=>(D??(D={}),D.exp=K(S,f in a).getTime(),D.exp-Date.now()<24*60*60*1e3&&(clearTimeout(mt),clearTimeout(ht[f]),mt=setTimeout(()=>this.reset(),D.exp-Date.now())),D.exp=Math.trunc(D.exp/1e3),V([W(o),D],0));if(U){const o=`${L}${Re}`,l=W,b=B;if(W=C=>{try{return V([l(C)],U)}catch{return delete a[f],""}},o in a){const C=`${L}${V(P,N)}`;try{a[C]=ke(B(_e(a[o],0)[0])),delete a[o]}catch{}}B=C=>{try{return b(_e(C,U)[0])}catch{return delete a[f],""}}}else delete a[`${Te}${Re}`];const pt=o=>{const l=_e(o,0);return D=l[1],B(l[0])};let gt=!0;if(Ee[f]=S,a[`atom/${P}`]&&(a[f]||(a[f]=`[${a[`atom/${P}`]}]`),delete a[`atom/${P}`]),p=()=>{if(p=s,gt){gt=!1;try{n(f in a?pt(a[f]):t)}catch{console.warn("Invalid json value",a[f])}}return s()},A=o=>{if(o===t){this.reset();return}a[f]=ke(o)},this.reset=()=>{delete a[f],O(t,!0)},xe&&k[f]!==void 0&&console.warn("Duplicate Atom key",P),Ne)if($e){let o=!1,l;de[f]=this,k[f]=()=>{clearTimeout(l),l=setTimeout(()=>o=!1,10),!o&&(o=!0,a[f]=ke(s()))}}else k[f]=o=>{if(o.newValue===null){this.reset();return}try{O(pt(o.newValue))}catch{console.warn("Invalid json value",o.newValue)}};return S}}let ve;try{ve=new BroadcastChannel("updateHere"),ve.addEventListener("message",e=>{var t;(t=de[e.data.key])==null||t.set(e.data.value,!0)})}catch{}const a=localStorage,k={},de={},Wt=(e,t)=>{throw`${t} is readonly property`};window.addEventListener("storage",e=>{var t;e.key===null||e.newValue===e.oldValue||(t=k[e.key])==null||t.call(k,e)});const Gt=a.setItem.bind(a),qt=a.removeItem.bind(a);a.setItem=(e,t)=>{de[e]===void 0&&Gt.call(a,e,t)},a.removeItem=e=>{de[e]===void 0&&qt.call(a,e)};const Ht=/"exp":\s*(\d+)/,L="atom\\",Te="atom`s\\",Ee={},ht={},_t=/[a-z]/gi,he=5,Fe={};for(let e=54;e<80;e++){if(e===68||e===72||e===55)continue;const t=String.fromCharCode(e+43).toUpperCase(),r=String.fromCharCode(e+43).toLowerCase();Fe[t]=r,Fe[r]=t}const yt=e=>Fe[e]??e,V=(()=>{const e=[t=>JSON.stringify(t),t=>btoa(encodeURI(e[0](t))),t=>{const r=e[1](t);return`${r.slice(0,he)}${r.slice(he).replace(_t,yt)}`},t=>btoa(e[2](t))];return(t,r)=>{try{return e[r](t)}catch(n){if(r===0)throw n;return e[0](t)}}})(),_e=(()=>{const e=[t=>JSON.parse(t),t=>e[0](decodeURI(atob(t))),t=>e[1](`${t.slice(0,he)}${t.slice(he).replace(_t,yt)}`),t=>e[2](atob(t))];return(t,r)=>{try{return e[r](t)}catch(n){if(r===0)throw n;return e[0](t)}}})();setTimeout(()=>{Object.keys(a).forEach(e=>{var n;if(typeof a[e]!="string"||!e.startsWith(L)&&!e.startsWith(Te))return;const t=(n=a[e].match(Ht))==null?void 0:n[1];if(!t||+t*1e3-Date.now()>24*60*60*1e3)return;const r=_e(a[e],0);!Array.isArray(r)||r[1]==null||!("exp"in r[1])||r[1].exp!==t||(ht[e]=setTimeout(()=>{Ee[e]?Ee[e].reset():delete a[e]},+t*1e3-Date.now()))})},1e3),d.Atom=dt,d.AtomArrayDoActions=it,d.AtomBooleanDoActions=ot,d.AtomMapDoActions=ct,d.AtomNumberDoActions=at,d.AtomObjectDoActions=ut,d.AtomSetDoActions=lt,d.atom=It,d.configureAtomaric=St,d.configuredOptions=z,d.useAtom=Dt,d.useAtomDo=bt,d.useAtomGet=Pt,d.useAtomSet=Ve,d.useAtomSetDeferred=At,d.useAtomValue=Le,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(l=typeof globalThis<"u"?globalThis:l||self,_(l.atomaric={}))})(this,function(l){"use strict";let _=()=>{throw"call configureAtomaric() before all!"},W=()=>{throw"call configureAtomaric() before all!"};const m={},Ae=s=>{m.useSyncExternalStore=_=s.useSyncExternalStore,m.produce=W=s.produce,m.keyPathSeparator=s.keyPathSeparator,m.securifyKeyLevel=s.securifyKeyLevel,m.securifyValueLevel=s.securifyValueLevel,m.storage=s.storage,he(s.storage)},J=s=>_(s.subscribe,s.get),Q=s=>s.set,Se=s=>s.setDeferred,be=s=>s.get,Ve=s=>s.do,De=s=>[J(s),Q(s)],Ie=(s,t)=>new re(s,t);class I{constructor(t){if(t)return new Proxy(this,{get:(o,e)=>e in this?o[e]:t[e]})}}class X extends I{constructor(t,o){super(o),this.a=t,this.push=(...e)=>{e.length!==0&&this.a.set(this.a.get().concat(e))},this.unshift=(...e)=>{e.length!==0&&this.a.set(e.concat(this.a.get()))},this.update=e=>{const r=this.a.get(),n=W(r,h=>void e(h));n!==r&&this.a.set(n)},this.filter=e=>{const r=this.a.get().filter(e??Me);r.length!==this.a.get().length&&this.a.set(r)},this.add=e=>{this.a.get().includes(e)||this.a.set(this.a.get().concat([e]))},this.removeFirst=e=>{const r=this.a.get().indexOf(e);if(r<0)return;const n=this.a.get().slice(0);n.splice(r,1),this.a.set(n)},this.toggle=(e,r)=>{const n=this.a.get().slice(),h=n.indexOf(e);h<0?r?n.unshift(e):n.push(e):n.splice(h,1),this.a.set(n)}}}const Me=s=>s;class Y extends I{constructor(t,o){super(o),this.a=t,this.toggle=()=>{this.a.set(!this.a.get())}}}class Z extends I{constructor(t,o){super(o),this.a=t,this.setValue=(e,r)=>{if(this.a.get().get(e)===r)return;const n=new Map(this.a.get());n.set(e,r),this.a.set(n)},this.setIfNo=(e,r)=>{if(this.a.get().has(e))return;const n=new Map(this.a.get());n.set(e,r),this.a.set(n)},this.delete=e=>{if(!this.a.get().has(e))return;const r=new Map(this.a.get());r.delete(e),this.a.set(r)},this.toggle=(e,r)=>{const n=new Map(this.a.get());n.has(e)?n.delete(e):n.set(e,r),this.a.set(n)},this.clear=()=>{this.a.set(new Map)},this.a=t}}class ee extends I{constructor(t,o){super(o),this.a=t,this.increment=e=>{this.a.set(+this.a.get()+(e??1))}}}class te extends I{constructor(t,o){super(o),this.a=t,this.setPartial=e=>this.a.set(r=>({...r,...typeof e=="function"?e(this.a.get()):e})),this.update=e=>{const r=this.a.get(),n=W(r,h=>void e(h));n!==r&&this.a.set(n)},this.setDeepPartial=(e,r,n,h=m.keyPathSeparator||".")=>{if(!h)return;if(e.includes(h)){let D=e.split(h);const y=D[D.length-1];D=D.slice(0,-1);const C={...this.a.get()};let f=C,g=n;for(const c of D){g=g==null?void 0:g[Array.isArray(g)?"0":c];const M=f[se(f,c)]??(Array.isArray(g)?[]:{});if(M==null||typeof M!="object"){if(n==null)throw"Incorrect path for setDeepPartial";const A=typeof r=="function"?r(void 0):r;this.a.get()[e]!==A&&this.setPartial({[e]:A});return}f=f[se(f,c)]=Array.isArray(M)?[...M]:{...M}}const z=f[y];f[y]=typeof r=="function"?r(f[y]):r,z!==f[y]&&this.a.set(C);return}const b=this.a.get()[e],V=typeof r=="function"?r(b):r;V!==b&&this.setPartial({[e]:V})}}}const se=(s,t)=>Array.isArray(s)?`${+t}`:t;class ie extends I{constructor(t,o){super(o),this.a=t,this.add=e=>{this.a.get().has(e)||this.a.set(new Set(this.a.get()).add(e))},this.delete=e=>{if(!this.a.get().has(e))return;const r=new Set(this.a.get());r.delete(e),this.a.set(r)},this.toggle=e=>{const r=new Set(this.a.get());r.has(e)?r.delete(e):r.add(e),this.a.set(r)},this.clear=()=>{this.a.set(new Set)},this.a=t}}const Le=(s,t,o)=>{const e=typeof o=="object"&&o!=null&&"do"in o?o.do((n,h)=>t.set(n,h),()=>t.get(),t,(n,h,b,V)=>t.setDeferred(n,h,b,V)):null,r={};return e&&Object.keys(e).forEach(n=>Object.defineProperty(r,n,{get:()=>e[n]})),typeof s=="number"?new ee(t,e):typeof s=="boolean"?new Y(t,e):Array.isArray(s)?new X(t,e):s instanceof Set?new ie(t,e):s instanceof Map?new Z(t,e):s instanceof Object?new te(t,e):new I(e)};class re{constructor(t,o){this.isInited=!1,this.rawInitialValue=t,this.rawOptions=o}get initialValue(){return this.init(),this.initialValue}get get(){return this.init(),this.get}get set(){return this.init(),this.set}get setDeferred(){return this.init(),this.setDeferred}get reset(){return this.init(),this.reset}get subscribe(){return this.init(),this.subscribe}get isInitialValue(){return this.init(),this.isInitialValue}get do(){return this.init(),this.doActions??(this.doActions=Le(this.initialValue,this,this.rawOptions))}init(){var we;if(this.isInited)return;this.isInited=!0;const t=typeof this.rawInitialValue=="function"?this.rawInitialValue():this.rawInitialValue,o=i=>D=i,e=()=>D,r=new Set,n=i=>i(f());let h=!0,b=!1,V=i=>i,D=t,y,C=()=>{},f=()=>e(),g=null,z=()=>{A(t,!0)},c="";const M=()=>{if(h=!0,b!==!0&&C(f()),b=!1,!!c)try{N.postMessage({key:c,value:e()})}catch{}},A=(i,u)=>{let p=typeof i=="function"?i(f()):i;p=V(p,f()),p!==f()&&(o(p),b=u,h&&(h=!1,r.forEach(n),queueMicrotask(M)))},L=(i,u)=>Object.defineProperty(this,i,{value:u,writable:!1,configurable:!0,enumerable:!0});L("initialValue",t),L("get",()=>f()),L("set",(i,u)=>A(i,u)),L("isInitialValue",()=>t===e()),L("subscribe",i=>(r.add(i),()=>{r.delete(i)})),L("reset",()=>z());const Oe=(i,u)=>{A(i,u),y=void 0};L("setDeferred",(i,u=500,p,S=!0)=>{S&&y===void 0&&A(i,p),clearTimeout(y),y=setTimeout(Oe,u,i,p)});const d=this.rawOptions;if(d==null)return;let w=null,K=null,F=!0,T=0,x=0,ge=-1,O=t instanceof Set?i=>new Set(i):t instanceof Map?i=>new Map(i):i=>i,j=t instanceof Set?i=>{if(i instanceof Set)return Array.from(i);throw console.error(i),"The value is not Set instance"}:t instanceof Map?i=>{if(i instanceof Map){const u=[];return i.forEach((p,S)=>u.push([S,p])),u}throw console.error(i),"The value is not Set instance"}:i=>i;if(typeof d=="string")w=d;else{if(V=d.map??V,!("storageKey"in d))return;F=d.warnOnDuplicateStorageKey??F,w=d.storageKey,O=d.unzipValue??O,j=d.zipValue??j,T=d.securifyKeyLevel??m.securifyKeyLevel??T,x=d.securifyValueLevel??m.securifyValueLevel??x,K=d.exp??K}const a=m.storage;if(!a)throw"call configureAtomaric({storage: new AtomaricLocalStorage()}) before all!";const G=T?P(w,T):w;if(c=`${x?U:$}${G}`,T){const i=`${$}${w}`;a.has(i)&&(a.set(c,a.get(i)),a.rem(i))}else{const i=`${$}${P(w,T)}`;a.has(i)&&(a.set(c,a.get(i)),a.rem(i))}const H=K===null||!(K(this,a.has(c))instanceof Date)?i=>P([j(i)],0):i=>(g??(g={}),g.exp=K(this,a.has(c)).getTime(),g.exp-Date.now()<24*60*60*1e3&&(clearTimeout(ge),clearTimeout(ae[c]),ge=setTimeout(()=>this.reset(),g.exp-Date.now())),g.exp=Math.trunc(g.exp/1e3),P([j(i),g],0));if(x){const i=`${$}${G}`,u=j,p=O;if(j=S=>{try{return P([u(S)],x)}catch{return a.rem(c),""}},a.has(i)){const S=`${$}${P(w,T)}`;try{a.set(S,H(O(R(a.get(i),0)[0]))),a.rem(i)}catch{}}O=S=>{try{return p(R(S,x)[0])}catch{return a.rem(c),""}}}else a.rem(`${U}${G}`);const de=i=>{const u=R(i,0);return g=u[1],O(u[0])};let me=!0;q[c]=this;const pe=a.get(`atom/${w}`);if(pe!==void 0&&(a.get(c)||a.set(c,`[${pe}]`),a.rem(`atom/${w}`)),f=()=>{if(f=e,me){me=!1;try{const i=a.get(c);o(i!==void 0?de(i):t)}catch{console.warn("Invalid json value",a.get(c))}}return e()},C=i=>{if(i===t){this.reset();return}a.set(c,H(i))},z=()=>{a.rem(c),A(t,!0)},F&&ne.has(c)&&console.warn("Duplicate Atom key",w),ne.add(c),a.unchangable??!1){(we=a.protect)==null||we.call(a,c);let i=!1,u;oe[c]=this,a.listen(c,()=>{clearTimeout(u),u=setTimeout(()=>i=!1,10),!i&&(i=!0,a.set(c,H(e())))})}else a.listen(c,i=>{if(i.newValue===null){this.reset();return}try{A(de(i.newValue))}catch{console.warn("Invalid json value",i.newValue)}})}}let N;try{N=new BroadcastChannel("updateHere"),N.addEventListener("message",s=>{var t;(t=oe[s.data.key])==null||t.set(s.data.value,!0)})}catch{}const ne=new Set,oe={},Te=/"exp":\s*(\d+)/,$="atom\\",U="atom`s\\",q={},ae={},ce=/[a-z]/gi,E=5,v={};for(let s=54;s<80;s++){if(s===68||s===72||s===55)continue;const t=String.fromCharCode(s+43).toUpperCase(),o=String.fromCharCode(s+43).toLowerCase();v[t]=o,v[o]=t}const le=s=>v[s]??s,P=(()=>{const s=[t=>JSON.stringify(t),t=>btoa(encodeURI(s[0](t))),t=>{const o=s[1](t);return`${o.slice(0,E)}${o.slice(E).replace(ce,le)}`},t=>btoa(s[2](t))];return(t,o)=>{try{return s[o](t)}catch(e){if(o===0)throw e;return s[0](t)}}})(),R=(()=>{const s=[t=>JSON.parse(t),t=>s[0](decodeURI(atob(t))),t=>s[1](`${t.slice(0,E)}${t.slice(E).replace(ce,le)}`),t=>s[2](atob(t))];return(t,o)=>{try{return s[o](t)}catch(e){if(o===0)throw e;return s[0](t)}}})();let ue=!1;const he=s=>{ue||(ue=!0,setTimeout(()=>{s.keys().forEach(t=>{var r,n;if(!t.startsWith($)&&!t.startsWith(U))return;const o=(n=(r=s.get(t))==null?void 0:r.match(Te))==null?void 0:n[1];if(!o||+o*1e3-Date.now()>24*60*60*1e3)return;const e=R(s.get(t),0);!Array.isArray(e)||e[1]==null||!("exp"in e[1])||e[1].exp!==o||(ae[t]=setTimeout(()=>{q[t]?q[t].reset():s.rem(t)},+o*1e3-Date.now()))})},1e3))},_e=localStorage.setItem.bind(localStorage),$e=localStorage.removeItem.bind(localStorage),B=new Map,k=new Set;let fe=!1;function Pe(){if(fe)return;fe=!0;const s=Object.getPrototypeOf(localStorage),t=s.setItem,o=s.removeItem;s.setItem=function(e,r){k.has(e)||t.call(this,e,r)},s.removeItem=function(e){k.has(e)||o.call(this,e)},window.addEventListener("storage",e=>{var r;e.key===null||e.newValue===e.oldValue||(r=B.get(e.key))==null||r.forEach(n=>n({newValue:e.newValue}))})}class xe{constructor({listenStorageChanges:t=!0,unchangable:o=!1}={}){this.set=(e,r)=>_e(e,r),this.get=e=>localStorage.getItem(e)??void 0,this.rem=e=>$e(e),this.has=e=>localStorage.getItem(e)!==null,this.keys=()=>Array.from({length:localStorage.length},(e,r)=>localStorage.key(r)).filter(e=>e!==null),this.listen=(e,r)=>{if(!this.listenStorageChanges)return()=>{};let n=B.get(e);return n||B.set(e,n=new Set),n.add(r),()=>n.delete(r)},this.protect=e=>{this.listenStorageChanges&&k.add(e)},this.listenStorageChanges=t,this.unchangable=o,t&&Pe()}}l.Atom=re,l.AtomArrayDoActions=X,l.AtomBooleanDoActions=Y,l.AtomMapDoActions=Z,l.AtomNumberDoActions=ee,l.AtomObjectDoActions=te,l.AtomSetDoActions=ie,l.AtomaricLocalStorage=xe,l.atom=Ie,l.configureAtomaric=Ae,l.configuredOptions=m,l.initExpWatcher=he,l.useAtom=De,l.useAtomDo=Ve,l.useAtomGet=be,l.useAtomSet=Q,l.useAtomSetDeferred=Se,l.useAtomValue=J,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "atomaric",
3
3
  "description": "Manage your project state",
4
- "version": "0.0.82",
4
+ "version": "0.1.1",
5
5
  "type": "module",
6
6
  "main": "./build/atomaric.umd.cjs",
7
7
  "module": "./build/atomaric.js",
@@ -39,6 +39,7 @@
39
39
  "@types/react": "^19.1.2",
40
40
  "@types/react-dom": "^19.1.8",
41
41
  "@vitejs/plugin-react": "^4.7.0",
42
+ "immer": "^11.1.4",
42
43
  "jest": "^30.2.0",
43
44
  "jest-environment-jsdom": "^30.2.0",
44
45
  "react": "^19.1.0",
@@ -49,7 +50,9 @@
49
50
  "vite-plugin-eslint": "^1.8.1"
50
51
  },
51
52
  "dependencies": {
52
- "immer": "^11.1.4",
53
53
  "typescript": "~5.7.2"
54
+ },
55
+ "peerDependencies": {
56
+ "immer": "^11"
54
57
  }
55
58
  }
@@ -7,6 +7,7 @@ export interface IAtomObjectDoActions<Value extends object> {
7
7
  /** transform current taken value */
8
8
  update: (updater: (value: Value) => void) => void;
9
9
 
10
- /** pass partial value to update some deep values by flat path */
10
+ /** pass partial value to update some deep values by flat path
11
+ * @deprecated use `update` (immer) or `setPartial` instead */
11
12
  setDeepPartial: ObjectActionsSetDeepPartialDoAction<Value>;
12
13
  }
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { useSyncExternalStore } from 'react';
3
+ import { produce } from 'immer';
3
4
  import { IAtomArrayDoActions } from './do.classes.model/IArray';
4
5
  import { IAtomBooleanDoActions } from './do.classes.model/IBoolean';
5
6
  import { IAtomMapDoActions } from './do.classes.model/IMap';
@@ -23,21 +24,78 @@ type Sunscriber<Value> = (value: Value) => void;
23
24
 
24
25
  export type AtomStorageKey = `${string}${string}:${string}${string}`;
25
26
 
26
- export type AtomOptions<Value, Actions extends Record<string, AnyFunc> = Record<string, AnyFunc>> = {
27
- /** **default: true** */
28
- warnOnDuplicateStorageKey?: boolean;
29
- /** will update value if localStorage value is changed
27
+ /** storage change event delivered to AtomaricStorage listen listeners */
28
+ export type AtomaricStorageEvent = {
29
+ /** new stored value, null when the key was removed */
30
+ newValue: string | null;
31
+ };
32
+
33
+ /** implement this contract to keep atom values in your own storage instead of localStorage */
34
+ export type AtomaricStorage = {
35
+ /** save value by key, must overwrite an already existing value */
36
+ set: (key: string, value: string) => void;
37
+ /** read value by key, must return undefined when the key is absent */
38
+ get: (key: string) => string | undefined;
39
+ /** remove key, must do nothing when the key is absent */
40
+ rem: (key: string) => void;
41
+ /** check is the key present in storage */
42
+ has: (key: string) => boolean;
43
+ /** list every key currently present in storage */
44
+ keys: () => string[];
45
+ /** are all atom values of this storage unchangable from outside:
46
+ * atoms restore their current value on external changes instead of applying them,
47
+ * and atomaric calls protect for every used key
48
+ */
49
+ unchangable?: boolean;
50
+ /**
51
+ * subscribe on key changes made from outside of this storage instance
52
+ * (other tabs/windows or scripts bypassing the storage methods);
53
+ * listener must NOT be invoked for changes made via this storage own set/rem;
54
+ * returns unsubscribe function
55
+ */
56
+ listen: (key: string, listener: (event: AtomaricStorageEvent) => void) => () => void;
57
+ /**
58
+ * forbid external modifications of the key (used when the storage `unchangable` is true):
59
+ * same-tab set/rem attempts that bypass the storage methods must be silently ignored;
60
+ * omit this member when your storage cannot block direct writes — unchangable atoms will still revert
61
+ * external changes via listen, but bypassing writes will not be blocked
62
+ */
63
+ protect?: (key: string) => void;
64
+ };
65
+
66
+ export type AtomaricLocalStorageOptions = {
67
+ /** listen localStorage changes between tabs/windows and protect unchangable values
30
68
  * **default: true**
31
69
  */
32
70
  listenStorageChanges?: boolean;
71
+ /** make all atom values of this storage unchangable from outside: atoms restore their current value on external changes instead of applying them, and their keys are protected from external modifications
72
+ * **default: false**
73
+ */
74
+ unchangable?: boolean;
75
+ };
76
+
77
+ /** default AtomaricStorage implementation on top of window.localStorage */
78
+ export declare class AtomaricLocalStorage implements AtomaricStorage {
79
+ constructor(options?: AtomaricLocalStorageOptions);
80
+ readonly unchangable: boolean;
81
+ set(key: string, value: string): void;
82
+ get(key: string): string | undefined;
83
+ rem(key: string): void;
84
+ has(key: string): boolean;
85
+ keys(): string[];
86
+ listen(key: string, listener: (event: AtomaricStorageEvent) => void): () => void;
87
+ protect(key: string): void;
88
+ }
89
+
90
+ export type AtomOptions<Value, Actions extends Record<string, AnyFunc> = Record<string, AnyFunc>> = {
91
+ /** **default: true** */
92
+ warnOnDuplicateStorageKey?: boolean;
33
93
 
34
94
  /** zip Value to stringifiable value */
35
95
  zipValue?: (value: Value) => any;
36
96
  /** unzip stringifiable value to Value */
37
97
  unzipValue?: (packedValue: any) => Value;
38
98
 
39
- /** make your localStorage value unchangable */
40
- unchangable?: true;
41
99
  /** return value expire Date */
42
100
  exp?: (self: Atom<Value>, isValueWasStoraged: boolean) => Date;
43
101
 
@@ -71,6 +129,8 @@ export type AtomSetDeferredMethod<Value> = (
71
129
 
72
130
  export type AtomSubscribeMethod<Value> = (subscriber: Sunscriber<Value>) => () => void;
73
131
 
132
+ /** typed action setting a deep value by flat path
133
+ * @deprecated use `update` (immer) or `setPartial` instead */
74
134
  export type ObjectActionsSetDeepPartialDoAction<Value> = <
75
135
  ValuePath extends Path<Value, Sep>,
76
136
  Val extends PathValue<Value, Sep, ValuePath>,
@@ -147,7 +207,10 @@ export function atom<Value, Actions extends Record<string, AnyFunc> = Record<str
147
207
  /** invoke this function before all atom usages */
148
208
  export function configureAtomaric(options: {
149
209
  useSyncExternalStore: typeof useSyncExternalStore;
210
+ produce: typeof produce;
150
211
  keyPathSeparator: ObjectActionsSetDeepPartialSeparator;
151
212
  securifyKeyLevel?: AtomSecureLevel;
152
213
  securifyValueLevel?: AtomSecureLevel;
214
+ /** storage to keep atom values in, pass `new AtomaricLocalStorage()` or your own AtomaricStorage implementation */
215
+ storage: AtomaricStorage;
153
216
  }): void;