@storix-js/vuex 0.1.2 → 0.1.3

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var pt=Symbol.for("preact-signals");function H(){if(E>1)E--;else{for(var t,e=!1;J!==void 0;){var r=J;for(J=void 0,G++;r!==void 0;){var s=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ct(r))try{r.c()}catch(h){e||(t=h,e=!0)}r=s}}if(G=0,E--,e)throw t}}function Y(t){if(E>0)return t();E++;try{return t()}finally{H()}}var l=void 0;function at(t){var e=l;l=void 0;try{return t()}finally{l=e}}var J=void 0,E=0,G=0,Z=0;function ut(t){if(l!==void 0){var e=t.n;if(e===void 0||e.t!==l)return e={i:0,S:t,p:l.s,n:void 0,t:l,e:void 0,x:void 0,r:e},l.s!==void 0&&(l.s.n=e),l.s=e,t.n=e,32&l.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=l.s,e.n=void 0,l.s.n=e,l.s=e),e}}function S(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}S.prototype.brand=pt;S.prototype.h=function(){return!0};S.prototype.S=function(t){var e=this,r=this.t;r!==t&&t.e===void 0&&(t.x=r,this.t=t,r!==void 0?r.e=t:at(function(){var s;(s=e.W)==null||s.call(e)}))};S.prototype.U=function(t){var e=this;if(this.t!==void 0){var r=t.e,s=t.x;r!==void 0&&(r.x=s,t.e=void 0),s!==void 0&&(s.e=r,t.x=void 0),t===this.t&&(this.t=s,s===void 0&&at(function(){var h;(h=e.Z)==null||h.call(e)}))}};S.prototype.subscribe=function(t){var e=this;return bt(function(){var r=e.value,s=l;l=void 0;try{t(r)}finally{l=s}},{name:"sub"})};S.prototype.valueOf=function(){return this.value};S.prototype.toString=function(){return this.value+""};S.prototype.toJSON=function(){return this.value};S.prototype.peek=function(){var t=l;l=void 0;try{return this.value}finally{l=t}};Object.defineProperty(S.prototype,"value",{get:function(){var t=ut(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(G>100)throw new Error("Cycle detected");this.v=t,this.i++,Z++,E++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{H()}}}});function yt(t,e){return new S(t,e)}function ct(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function ft(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function lt(t){for(var e=t.s,r=void 0;e!==void 0;){var s=e.p;e.i===-1?(e.S.U(e),s!==void 0&&(s.n=e.n),e.n!==void 0&&(e.n.p=s)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=s}t.s=r}function B(t,e){S.call(this,void 0),this.x=t,this.s=void 0,this.g=Z-1,this.f=4,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}B.prototype=new S;B.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Z))return!0;if(this.g=Z,this.f|=1,this.i>0&&!ct(this))return this.f&=-2,!0;var t=l;try{ft(this),l=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return l=t,lt(this),this.f&=-2,!0};B.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}S.prototype.S.call(this,t)};B.prototype.U=function(t){if(this.t!==void 0&&(S.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};B.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(B.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=ut(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function rt(t,e){return new B(t,e)}function ht(t){var e=t.u;if(t.u=void 0,typeof e=="function"){E++;var r=l;l=void 0;try{e()}catch(s){throw t.f&=-2,t.f|=8,X(t),s}finally{l=r,H()}}}function X(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ht(t)}function gt(t){if(l!==this)throw new Error("Out-of-order effect");lt(this),l=t,this.f&=-2,8&this.f&&X(this),H()}function D(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e==null?void 0:e.name}D.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};D.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ht(this),ft(this),E++;var t=l;return l=this,gt.bind(this,t)};D.prototype.N=function(){2&this.f||(this.f|=2,this.o=J,J=this)};D.prototype.d=function(){this.f|=8,1&this.f||X(this)};D.prototype.dispose=function(){this.d()};function bt(t,e){var r=new D(t,e);try{r.c()}catch(h){throw r.d(),h}var s=r.d.bind(r);return s[Symbol.dispose]=s,s}const nt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function Q(t,e){if(Object.is(t,e))return!0;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r+=1)if(!Q(t[r],e[r]))return!1;return!0}if(nt(t)&&nt(e)){const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const h of r)if(!(h in e)||!Q(t[h],e[h]))return!1;return!0}return!1}function dt(t){if(typeof structuredClone=="function")return structuredClone(t);try{return JSON.parse(JSON.stringify(t))}catch{return t}}function it(t,e,r=Object.is,s=dt){const h={};for(const[y,w]of Object.entries(e)){const T=t[y];r(T,w,y)||(h[y]=s(w))}return h}function xt(t={}){const e=(t.namespace??"default").trim()||"default",r=t.plugins??[],s=new Map;function h(y,w){return function(){var T;const C=`${e}:${y}`,_=s.get(y);if(_)return _;const A=w.state(),j=w.modules??{},U={...A};for(const[i,n]of Object.entries(j))U[i]=n.state();const g=yt(U),m=new Map,F=new Map,q=new Map,$=new Map,P=new Map,z=new Set,N=new Set(Object.keys(A)),L=new Set(Object.keys(w.getters??{})),W=new Set(Object.keys(w.actions??{})),o=i=>g.value[i]??{},d=(i,n)=>{g.value={...g.value,[i]:n}},p=new Proxy({},{get(i,n){var u,c;if(m.has(n))return(u=m.get(n))==null?void 0:u.value;if(P.has(n))return(c=P.get(n))==null?void 0:c.value;if(N.has(n))return g.value[n];const v=$.get(n);return v?o(v.moduleName)[v.key]:g.value[n]}});for(const[i,n]of Object.entries(w.getters??{}))m.set(i,rt(()=>n(g.value,p)));const b=(i,n)=>{var u;for(const c of z)c(i);for(const c of r)(u=c.onMutation)==null||u.call(c,n,i)},O=(i,n,u,c)=>{const v=g.value[i];Object.is(v,n)||(g.value={...g.value,[i]:n},b({namespace:e,scopeId:C,storeId:y,key:i,oldValue:v,newValue:n,origin:u},c))},M=(i,n,u,c,v)=>{const x=o(i),a=x[n];Object.is(a,u)||(d(i,{...x,[n]:u}),b({namespace:e,scopeId:C,storeId:y,key:`${i}.${n}`,oldValue:a,newValue:u,origin:c},v))},V={$id:y,$namespace:e,$scopeId:C,$subscribe(i){return z.add(i),()=>z.delete(i)},$dispose(){var i;z.clear();for(const n of r)(i=n.onDispose)==null||i.call(n,k);s.delete(y)},$patch(i,n="local"){Y(()=>{for(const[u,c]of Object.entries(i)){const v=$.get(u);if(v){M(v.moduleName,v.key,c,n,k);continue}if(u.includes(".")){const[x,a]=u.split(".",2);if(j[x]){M(x,a,c,n,k);continue}}if(j[u]&&c&&typeof c=="object"&&!Array.isArray(c)){for(const[x,a]of Object.entries(c))M(u,x,a,n,k);continue}O(u,c,n,k)}})},$snapshot(){return{...g.value}}};for(const[i,n]of Object.entries(j)){const u=new Map,c=new Map,v=new Proxy({},{get(a,f){var R,I,tt;if(u.has(f))return(R=u.get(f))==null?void 0:R.value;if(m.has(f))return(I=m.get(f))==null?void 0:I.value;if(P.has(f))return(tt=P.get(f))==null?void 0:tt.value;const et=o(i);if(f in et)return et[f];if(N.has(f))return g.value[f]}});for(const[a,f]of Object.entries(n.getters??{}))u.set(a,rt(()=>f(o(i),g.value,v)));let x;for(const[a,f]of Object.entries(n.actions??{}))c.set(a,(...R)=>Y(()=>f.apply(x,R)));x=new Proxy({},{get(a,f){var R;if(c.has(f))return c.get(f);if(u.has(f))return(R=u.get(f))==null?void 0:R.value;const I=o(i);return f in I?I[f]:k[f]},set(a,f,R){if(c.has(f)||u.has(f))return!1;const I=o(i);return f in I?M(i,f,R,"local",k):k[f]=R,!0}}),q.set(i,x),F.set(i,u);for(const a of Object.keys(o(i)))!(N.has(a)||L.has(a)||W.has(a)||Reflect.has(V,a)||j[a]!==void 0)&&!$.has(a)&&$.set(a,{moduleName:i,key:a});for(const[a,f]of u.entries())!(N.has(a)||L.has(a)||W.has(a)||Reflect.has(V,a)||j[a]!==void 0)&&!P.has(a)&&P.set(a,f);for(const[a,f]of c.entries())!(N.has(a)||L.has(a)||W.has(a)||Reflect.has(V,a)||j[a]!==void 0)&&!Reflect.has(V,a)&&(V[a]=f)}const k=new Proxy(V,{get(i,n,u){var c,v;if(Reflect.has(i,n))return Reflect.get(i,n,u);if(q.has(n))return q.get(n);if(m.has(n))return(c=m.get(n))==null?void 0:c.value;if(P.has(n))return(v=P.get(n))==null?void 0:v.value;if(N.has(n))return g.value[n];const x=$.get(n);return x?o(x.moduleName)[x.key]:g.value[n]},set(i,n,u,c){if(Reflect.has(i,n))return Reflect.set(i,n,u,c);const v=$.get(n);return v?(M(v.moduleName,v.key,u,"local",c),!0):(O(n,u,"local",c),!0)}});for(const[i,n]of Object.entries(w.actions??{}))V[i]=(...u)=>Y(()=>n.apply(k,u));for(const i of r)(T=i.onInit)==null||T.call(i,k);return s.set(y,k),k}}return{defineStore:h,use(y){r.push(y)}}}xt();const K=t=>t!==null&&typeof t=="object";function vt(t){if(!K(t))return t;const e=new WeakSet,r=s=>{if(!K(s))return;const h=s;if(e.has(h))return;e.add(h);const y=Reflect.ownKeys(h);for(const w of y){const T=Reflect.get(h,w);r(T)}Object.freeze(h)};return r(t),t}function St(t,e){for(const[r,s]of Object.entries(e))t[r]=s}const ot=t=>Object.keys(t).length>0,st=t=>t?Array.isArray(t)?t:[t]:[],wt=t=>{const e=[t];if(t.includes(".")){const r=t.split(".",1)[0];r&&r!==t&&e.push(r)}return e},mt=(t,e)=>{if(!e||!K(t))return t;try{Object.defineProperty(t,e,{value:!0,enumerable:!1,configurable:!0})}catch{return t}return t};function jt(t){const e=t.mutationType??"storix/APPLY_PATCH",r=t.immutable??!0,s=t.clone??dt,h=t.equals??Q,y=t.projectVuexToStorix??(o=>o),w=t.projectStorixToVuex??(o=>o),T=t.suppressBridgeEcho??!1,C=t.bridgeOriginKey??"__storixBridge",_=t.outboundDefault??{mode:"patch",type:e},A=o=>{const d=s(o);return r?vt(d):d};let j=!1,U=!1,g=!1;const m=new Map,F=o=>{if(T)for(const d of o){const p=m.get(d)??0;m.set(d,p+1)}},q=o=>{if(!T||!K(o))return!1;const d=Reflect.get(o,"payload");if(C&&K(d)&&Reflect.get(d,C))return!0;const p=Reflect.get(o,"type");if(typeof p!="string")return!1;const b=m.get(p)??0;return b<=0?!1:(b===1?m.delete(p):m.set(p,b-1),!0)},$=()=>{if(j||g)return;const o=A(y(t.vuex.state)),d=t.store.$snapshot(),p=it(d,o,h,A);if(ot(p)){U=!0;try{t.store.$patch(p,t.externalMutationOrigin??"local")}finally{U=!1}}},P=o=>{const p=wt(o.storixMutation.key).flatMap(b=>{var O;return st((O=t.outboundRoutes)==null?void 0:O[b])});return p.push(...st(_)),p.find(b=>b.when?b.when(o):!0)},z=(o,d)=>{var M;if(o.mode==="custom"){(M=o.handler)==null||M.call(o,d),F(o.suppressMutationTypes??[]);return}const p=(o.mode==="patch",d.projectedPatch),b=mt(A(o.mapPayload?o.mapPayload(d):p),C);if(o.mode==="dispatch"){if(typeof t.vuex.dispatch!="function")throw new Error('Vuex bridge route mode "dispatch" requires vuex.dispatch to be available.');if(!o.type)throw new Error('Vuex bridge dispatch route requires a "type".');t.vuex.dispatch(o.type,b),F(o.suppressMutationTypes??[]);return}const O=o.type??e;t.vuex.commit(O,b),F(o.suppressMutationTypes??[O])},N=o=>{if(j||U)return;const d=t.store.$snapshot(),p=A(w(d)),b=A(y(t.vuex.state)),O=it(b,p,h,A);if(!ot(O))return;const M={storixMutation:o??{namespace:t.store.$namespace,scopeId:t.store.$scopeId,storeId:t.store.$id,key:Object.keys(O)[0]??"*",oldValue:void 0,newValue:void 0,origin:"local"},storixSnapshot:d,vuexState:t.vuex.state,projectedPatch:O,projectedVuexState:p,origin:"storix"},V=P(M);if(V){g=!0;try{z(V,M)}finally{g=!1}}},L=t.vuex.subscribe(o=>{q(o)||$()}),W=t.store.$subscribe(o=>{N(o)});return $(),{dispose(){j||(j=!0,L(),W())},syncFromExternal:$,syncFromStore(){N()}}}exports.applyVuexPatchMutation=St;exports.createVuexBridge=jt;exports.deepFreeze=vt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var pt=Symbol.for("preact-signals");function H(){if(E>1)E--;else{for(var t,e=!1;J!==void 0;){var r=J;for(J=void 0,G++;r!==void 0;){var s=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ct(r))try{r.c()}catch(h){e||(t=h,e=!0)}r=s}}if(G=0,E--,e)throw t}}function Y(t){if(E>0)return t();E++;try{return t()}finally{H()}}var l=void 0;function at(t){var e=l;l=void 0;try{return t()}finally{l=e}}var J=void 0,E=0,G=0,Z=0;function ut(t){if(l!==void 0){var e=t.n;if(e===void 0||e.t!==l)return e={i:0,S:t,p:l.s,n:void 0,t:l,e:void 0,x:void 0,r:e},l.s!==void 0&&(l.s.n=e),l.s=e,t.n=e,32&l.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=l.s,e.n=void 0,l.s.n=e,l.s=e),e}}function S(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}S.prototype.brand=pt;S.prototype.h=function(){return!0};S.prototype.S=function(t){var e=this,r=this.t;r!==t&&t.e===void 0&&(t.x=r,this.t=t,r!==void 0?r.e=t:at(function(){var s;(s=e.W)==null||s.call(e)}))};S.prototype.U=function(t){var e=this;if(this.t!==void 0){var r=t.e,s=t.x;r!==void 0&&(r.x=s,t.e=void 0),s!==void 0&&(s.e=r,t.x=void 0),t===this.t&&(this.t=s,s===void 0&&at(function(){var h;(h=e.Z)==null||h.call(e)}))}};S.prototype.subscribe=function(t){var e=this;return bt(function(){var r=e.value,s=l;l=void 0;try{t(r)}finally{l=s}},{name:"sub"})};S.prototype.valueOf=function(){return this.value};S.prototype.toString=function(){return this.value+""};S.prototype.toJSON=function(){return this.value};S.prototype.peek=function(){var t=l;l=void 0;try{return this.value}finally{l=t}};Object.defineProperty(S.prototype,"value",{get:function(){var t=ut(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(G>100)throw new Error("Cycle detected");this.v=t,this.i++,Z++,E++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{H()}}}});function yt(t,e){return new S(t,e)}function ct(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function ft(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function lt(t){for(var e=t.s,r=void 0;e!==void 0;){var s=e.p;e.i===-1?(e.S.U(e),s!==void 0&&(s.n=e.n),e.n!==void 0&&(e.n.p=s)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=s}t.s=r}function B(t,e){S.call(this,void 0),this.x=t,this.s=void 0,this.g=Z-1,this.f=4,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}B.prototype=new S;B.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Z))return!0;if(this.g=Z,this.f|=1,this.i>0&&!ct(this))return this.f&=-2,!0;var t=l;try{ft(this),l=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return l=t,lt(this),this.f&=-2,!0};B.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}S.prototype.S.call(this,t)};B.prototype.U=function(t){if(this.t!==void 0&&(S.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};B.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(B.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=ut(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function rt(t,e){return new B(t,e)}function ht(t){var e=t.u;if(t.u=void 0,typeof e=="function"){E++;var r=l;l=void 0;try{e()}catch(s){throw t.f&=-2,t.f|=8,X(t),s}finally{l=r,H()}}}function X(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ht(t)}function gt(t){if(l!==this)throw new Error("Out-of-order effect");lt(this),l=t,this.f&=-2,8&this.f&&X(this),H()}function D(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e==null?void 0:e.name}D.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};D.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ht(this),ft(this),E++;var t=l;return l=this,gt.bind(this,t)};D.prototype.N=function(){2&this.f||(this.f|=2,this.o=J,J=this)};D.prototype.d=function(){this.f|=8,1&this.f||X(this)};D.prototype.dispose=function(){this.d()};function bt(t,e){var r=new D(t,e);try{r.c()}catch(h){throw r.d(),h}var s=r.d.bind(r);return s[Symbol.dispose]=s,s}const nt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function Q(t,e){if(Object.is(t,e))return!0;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r+=1)if(!Q(t[r],e[r]))return!1;return!0}if(nt(t)&&nt(e)){const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const h of r)if(!(h in e)||!Q(t[h],e[h]))return!1;return!0}return!1}function dt(t){if(typeof structuredClone=="function")return structuredClone(t);try{return JSON.parse(JSON.stringify(t))}catch{return t}}function it(t,e,r=Object.is,s=dt){const h={};for(const[y,w]of Object.entries(e)){const T=t[y];r(T,w,y)||(h[y]=s(w))}return h}function xt(t={}){const e=(t.namespace??"default").trim()||"default",r=t.plugins??[],s=new Map;function h(y,w){return function(){var T;const C=`${e}:${y}`,_=s.get(y);if(_)return _;const A=w.state(),j=w.modules??{},U={...A};for(const[i,n]of Object.entries(j))U[i]=n.state();const g=yt(U),m=new Map,F=new Map,q=new Map,$=new Map,V=new Map,z=new Set,N=new Set(Object.keys(A)),L=new Set(Object.keys(w.getters??{})),W=new Set(Object.keys(w.actions??{})),o=i=>g.value[i]??{},v=(i,n)=>{g.value={...g.value,[i]:n}},p=new Proxy({},{get(i,n){var u,c;if(m.has(n))return(u=m.get(n))==null?void 0:u.value;if(V.has(n))return(c=V.get(n))==null?void 0:c.value;if(N.has(n))return g.value[n];const d=$.get(n);return d?o(d.moduleName)[d.key]:g.value[n]}});for(const[i,n]of Object.entries(w.getters??{}))m.set(i,rt(()=>n(g.value,p)));const b=(i,n)=>{var u;for(const c of z)c(i);for(const c of r)(u=c.onMutation)==null||u.call(c,n,i)},O=(i,n,u,c)=>{const d=g.value[i];Object.is(d,n)||(g.value={...g.value,[i]:n},b({namespace:e,scopeId:C,storeId:y,key:i,oldValue:d,newValue:n,origin:u},c))},M=(i,n,u,c,d)=>{const x=o(i),a=x[n];Object.is(a,u)||(v(i,{...x,[n]:u}),b({namespace:e,scopeId:C,storeId:y,key:`${i}.${n}`,oldValue:a,newValue:u,origin:c},d))},P={$id:y,$namespace:e,$scopeId:C,$subscribe(i){return z.add(i),()=>z.delete(i)},$dispose(){var i;z.clear();for(const n of r)(i=n.onDispose)==null||i.call(n,k);s.delete(y)},$patch(i,n="local"){Y(()=>{for(const[u,c]of Object.entries(i)){const d=$.get(u);if(d){M(d.moduleName,d.key,c,n,k);continue}if(u.includes(".")){const[x,a]=u.split(".",2);if(j[x]){M(x,a,c,n,k);continue}}if(j[u]&&c&&typeof c=="object"&&!Array.isArray(c)){for(const[x,a]of Object.entries(c))M(u,x,a,n,k);continue}O(u,c,n,k)}})},$snapshot(){return{...g.value}}};for(const[i,n]of Object.entries(j)){const u=new Map,c=new Map,d=new Proxy({},{get(a,f){var R,I,tt;if(u.has(f))return(R=u.get(f))==null?void 0:R.value;if(m.has(f))return(I=m.get(f))==null?void 0:I.value;if(V.has(f))return(tt=V.get(f))==null?void 0:tt.value;const et=o(i);if(f in et)return et[f];if(N.has(f))return g.value[f]}});for(const[a,f]of Object.entries(n.getters??{}))u.set(a,rt(()=>f(o(i),g.value,d)));let x;for(const[a,f]of Object.entries(n.actions??{}))c.set(a,(...R)=>Y(()=>f.apply(x,R)));x=new Proxy({},{get(a,f){var R;if(c.has(f))return c.get(f);if(u.has(f))return(R=u.get(f))==null?void 0:R.value;const I=o(i);return f in I?I[f]:k[f]},set(a,f,R){if(c.has(f)||u.has(f))return!1;const I=o(i);return f in I?M(i,f,R,"local",k):k[f]=R,!0}}),q.set(i,x),F.set(i,u);for(const a of Object.keys(o(i)))!(N.has(a)||L.has(a)||W.has(a)||Reflect.has(P,a)||j[a]!==void 0)&&!$.has(a)&&$.set(a,{moduleName:i,key:a});for(const[a,f]of u.entries())!(N.has(a)||L.has(a)||W.has(a)||Reflect.has(P,a)||j[a]!==void 0)&&!V.has(a)&&V.set(a,f);for(const[a,f]of c.entries())!(N.has(a)||L.has(a)||W.has(a)||Reflect.has(P,a)||j[a]!==void 0)&&!Reflect.has(P,a)&&(P[a]=f)}const k=new Proxy(P,{get(i,n,u){var c,d;if(Reflect.has(i,n))return Reflect.get(i,n,u);if(q.has(n))return q.get(n);if(m.has(n))return(c=m.get(n))==null?void 0:c.value;if(V.has(n))return(d=V.get(n))==null?void 0:d.value;if(N.has(n))return g.value[n];const x=$.get(n);return x?o(x.moduleName)[x.key]:g.value[n]},set(i,n,u,c){if(Reflect.has(i,n))return Reflect.set(i,n,u,c);const d=$.get(n);return d?(M(d.moduleName,d.key,u,"local",c),!0):(O(n,u,"local",c),!0)}});for(const[i,n]of Object.entries(w.actions??{}))P[i]=(...u)=>Y(()=>n.apply(k,u));for(const i of r)(T=i.onInit)==null||T.call(i,k);return s.set(y,k),k}}return{defineStore:h,use(y){r.push(y)}}}xt();const K=t=>t!==null&&typeof t=="object";function vt(t){if(!K(t))return t;const e=new WeakSet,r=s=>{if(!K(s))return;const h=s;if(e.has(h))return;e.add(h);const y=Reflect.ownKeys(h);for(const w of y){const T=Reflect.get(h,w);r(T)}Object.freeze(h)};return r(t),t}function St(t,e){for(const[r,s]of Object.entries(e))t[r]=s}const ot=t=>Object.keys(t).length>0,st=t=>t?Array.isArray(t)?t:[t]:[],wt=t=>{const e=[t];if(t.includes(".")){const r=t.split(".",1)[0];r&&r!==t&&e.push(r)}return e},mt=(t,e)=>{if(!e||!K(t))return t;try{Object.defineProperty(t,e,{value:!0,enumerable:!1,configurable:!0})}catch{return t}return t};function jt(t){const e=t.mutationType??"storix/APPLY_PATCH",r=t.immutable??!0,s=t.clone??dt,h=t.equals??Q,y=t.projectVuexToStorix??(o=>o),w=t.projectStorixToVuex??(o=>o),T=t.suppressBridgeEcho??!1,C=t.bridgeOriginKey??"__storixBridge",_=t.outboundDefault??{mode:"patch",type:e},A=o=>{const v=s(o);return r?vt(v):v};let j=!1,U=!1,g=!1;const m=new Map,F=o=>{if(T)for(const v of o){const p=m.get(v)??0;m.set(v,p+1)}},q=o=>{if(!T||!K(o))return!1;const v=Reflect.get(o,"payload");if(C&&K(v)&&Reflect.get(v,C))return!0;const p=Reflect.get(o,"type");if(typeof p!="string")return!1;const b=m.get(p)??0;return b<=0?!1:(b===1?m.delete(p):m.set(p,b-1),!0)},$=()=>{if(j||g)return;const o=A(y(t.vuex.state)),v=t.store.$snapshot(),p=it(v,o,h,A);if(ot(p)){U=!0;try{t.store.$patch(p,t.externalMutationOrigin??"local")}finally{U=!1}}},V=o=>{const p=wt(o.storixMutation.key).flatMap(b=>{var O;return st((O=t.outboundRoutes)==null?void 0:O[b])});return p.push(...st(_)),p.find(b=>b.when?b.when(o):!0)},z=(o,v)=>{var M;if(o.mode==="custom"){(M=o.handler)==null||M.call(o,v),F(o.suppressMutationTypes??[]);return}const p=v.projectedPatch,b=mt(A(o.mapPayload?o.mapPayload(v):p),C);if(o.mode==="dispatch"){if(typeof t.vuex.dispatch!="function")throw new Error('Vuex bridge route mode "dispatch" requires vuex.dispatch to be available.');if(!o.type)throw new Error('Vuex bridge dispatch route requires a "type".');t.vuex.dispatch(o.type,b),F(o.suppressMutationTypes??[]);return}const O=o.type??e;t.vuex.commit(O,b),F(o.suppressMutationTypes??[O])},N=o=>{if(j||U)return;const v=t.store.$snapshot(),p=A(w(v)),b=A(y(t.vuex.state)),O=it(b,p,h,A);if(!ot(O))return;const M={storixMutation:o??{namespace:t.store.$namespace,scopeId:t.store.$scopeId,storeId:t.store.$id,key:Object.keys(O)[0]??"*",oldValue:void 0,newValue:void 0,origin:"local"},storixSnapshot:v,vuexState:t.vuex.state,projectedPatch:O,projectedVuexState:p,origin:"storix"},P=V(M);if(P){g=!0;try{z(P,M)}finally{g=!1}}},L=t.vuex.subscribe(o=>{q(o)||$()}),W=t.store.$subscribe(o=>{N(o)});return $(),{dispose(){j||(j=!0,L(),W())},syncFromExternal:$,syncFromStore(){N()}}}exports.applyVuexPatchMutation=St;exports.createVuexBridge=jt;exports.deepFreeze=vt;
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ function H() {
7
7
  var n = J;
8
8
  for (J = void 0, G++; n !== void 0; ) {
9
9
  var s = n.o;
10
- if (n.o = void 0, n.f &= -3, !(8 & n.f) && ut(n)) try {
10
+ if (n.o = void 0, n.f &= -3, !(8 & n.f) && ct(n)) try {
11
11
  n.c();
12
12
  } catch (h) {
13
13
  e || (t = h, e = !0);
@@ -38,7 +38,7 @@ function at(t) {
38
38
  }
39
39
  }
40
40
  var J = void 0, E = 0, G = 0, Z = 0;
41
- function ct(t) {
41
+ function ut(t) {
42
42
  if (l !== void 0) {
43
43
  var e = t.n;
44
44
  if (e === void 0 || e.t !== l)
@@ -102,7 +102,7 @@ w.prototype.peek = function() {
102
102
  }
103
103
  };
104
104
  Object.defineProperty(w.prototype, "value", { get: function() {
105
- var t = ct(this);
105
+ var t = ut(this);
106
106
  return t !== void 0 && (t.i = this.i), this.v;
107
107
  }, set: function(t) {
108
108
  if (t !== this.v) {
@@ -118,7 +118,7 @@ Object.defineProperty(w.prototype, "value", { get: function() {
118
118
  function pt(t, e) {
119
119
  return new w(t, e);
120
120
  }
121
- function ut(t) {
121
+ function ct(t) {
122
122
  for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
123
123
  return !1;
124
124
  }
@@ -145,7 +145,7 @@ B.prototype = new w();
145
145
  B.prototype.h = function() {
146
146
  if (this.f &= -3, 1 & this.f) return !1;
147
147
  if ((36 & this.f) == 32 || (this.f &= -5, this.g === Z)) return !0;
148
- if (this.g = Z, this.f |= 1, this.i > 0 && !ut(this))
148
+ if (this.g = Z, this.f |= 1, this.i > 0 && !ct(this))
149
149
  return this.f &= -2, !0;
150
150
  var t = l;
151
151
  try {
@@ -178,7 +178,7 @@ B.prototype.N = function() {
178
178
  };
179
179
  Object.defineProperty(B.prototype, "value", { get: function() {
180
180
  if (1 & this.f) throw new Error("Cycle detected");
181
- var t = ct(this);
181
+ var t = ut(this);
182
182
  if (this.h(), t !== void 0 && (t.i = this.i), 16 & this.f) throw this.v;
183
183
  return this.v;
184
184
  } });
@@ -293,7 +293,7 @@ function bt(t = {}) {
293
293
  const A = S.state(), j = S.modules ?? {}, U = { ...A };
294
294
  for (const [i, r] of Object.entries(j))
295
295
  U[i] = r.state();
296
- const g = pt(U), m = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set(), N = new Set(Object.keys(A)), L = new Set(Object.keys(S.getters ?? {})), W = new Set(Object.keys(S.actions ?? {})), o = (i) => g.value[i] ?? {}, d = (i, r) => {
296
+ const g = pt(U), m = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set(), N = new Set(Object.keys(A)), L = new Set(Object.keys(S.getters ?? {})), W = new Set(Object.keys(S.actions ?? {})), o = (i) => g.value[i] ?? {}, v = (i, r) => {
297
297
  g.value = {
298
298
  ...g.value,
299
299
  [i]: r
@@ -302,12 +302,12 @@ function bt(t = {}) {
302
302
  {},
303
303
  {
304
304
  get(i, r) {
305
- var c, u;
306
- if (m.has(r)) return (c = m.get(r)) == null ? void 0 : c.value;
307
- if (R.has(r)) return (u = R.get(r)) == null ? void 0 : u.value;
305
+ var u, c;
306
+ if (m.has(r)) return (u = m.get(r)) == null ? void 0 : u.value;
307
+ if (R.has(r)) return (c = R.get(r)) == null ? void 0 : c.value;
308
308
  if (N.has(r)) return g.value[r];
309
- const v = M.get(r);
310
- return v ? o(v.moduleName)[v.key] : g.value[r];
309
+ const d = M.get(r);
310
+ return d ? o(d.moduleName)[d.key] : g.value[r];
311
311
  }
312
312
  }
313
313
  );
@@ -317,13 +317,13 @@ function bt(t = {}) {
317
317
  nt(() => r(g.value, p))
318
318
  );
319
319
  const b = (i, r) => {
320
- var c;
321
- for (const u of D) u(i);
322
- for (const u of n)
323
- (c = u.onMutation) == null || c.call(u, r, i);
324
- }, O = (i, r, c, u) => {
325
- const v = g.value[i];
326
- Object.is(v, r) || (g.value = {
320
+ var u;
321
+ for (const c of D) c(i);
322
+ for (const c of n)
323
+ (u = c.onMutation) == null || u.call(c, r, i);
324
+ }, O = (i, r, u, c) => {
325
+ const d = g.value[i];
326
+ Object.is(d, r) || (g.value = {
327
327
  ...g.value,
328
328
  [i]: r
329
329
  }, b(
@@ -332,17 +332,17 @@ function bt(t = {}) {
332
332
  scopeId: C,
333
333
  storeId: y,
334
334
  key: i,
335
- oldValue: v,
335
+ oldValue: d,
336
336
  newValue: r,
337
- origin: c
337
+ origin: u
338
338
  },
339
- u
339
+ c
340
340
  ));
341
- }, $ = (i, r, c, u, v) => {
341
+ }, $ = (i, r, u, c, d) => {
342
342
  const x = o(i), a = x[r];
343
- Object.is(a, c) || (d(i, {
343
+ Object.is(a, u) || (v(i, {
344
344
  ...x,
345
- [r]: c
345
+ [r]: u
346
346
  }), b(
347
347
  {
348
348
  namespace: e,
@@ -350,12 +350,12 @@ function bt(t = {}) {
350
350
  storeId: y,
351
351
  key: `${i}.${r}`,
352
352
  oldValue: a,
353
- newValue: c,
354
- origin: u
353
+ newValue: u,
354
+ origin: c
355
355
  },
356
- v
356
+ d
357
357
  ));
358
- }, P = {
358
+ }, V = {
359
359
  $id: y,
360
360
  $namespace: e,
361
361
  $scopeId: C,
@@ -371,25 +371,25 @@ function bt(t = {}) {
371
371
  },
372
372
  $patch(i, r = "local") {
373
373
  Y(() => {
374
- for (const [c, u] of Object.entries(i)) {
375
- const v = M.get(c);
376
- if (v) {
377
- $(v.moduleName, v.key, u, r, k);
374
+ for (const [u, c] of Object.entries(i)) {
375
+ const d = M.get(u);
376
+ if (d) {
377
+ $(d.moduleName, d.key, c, r, k);
378
378
  continue;
379
379
  }
380
- if (c.includes(".")) {
381
- const [x, a] = c.split(".", 2);
380
+ if (u.includes(".")) {
381
+ const [x, a] = u.split(".", 2);
382
382
  if (j[x]) {
383
- $(x, a, u, r, k);
383
+ $(x, a, c, r, k);
384
384
  continue;
385
385
  }
386
386
  }
387
- if (j[c] && u && typeof u == "object" && !Array.isArray(u)) {
388
- for (const [x, a] of Object.entries(u))
389
- $(c, x, a, r, k);
387
+ if (j[u] && c && typeof c == "object" && !Array.isArray(c)) {
388
+ for (const [x, a] of Object.entries(c))
389
+ $(u, x, a, r, k);
390
390
  continue;
391
391
  }
392
- O(c, u, r, k);
392
+ O(u, c, r, k);
393
393
  }
394
394
  });
395
395
  },
@@ -398,12 +398,12 @@ function bt(t = {}) {
398
398
  }
399
399
  };
400
400
  for (const [i, r] of Object.entries(j)) {
401
- const c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), v = new Proxy(
401
+ const u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), d = new Proxy(
402
402
  {},
403
403
  {
404
404
  get(a, f) {
405
- var V, I, tt;
406
- if (c.has(f)) return (V = c.get(f)) == null ? void 0 : V.value;
405
+ var P, I, tt;
406
+ if (u.has(f)) return (P = u.get(f)) == null ? void 0 : P.value;
407
407
  if (m.has(f)) return (I = m.get(f)) == null ? void 0 : I.value;
408
408
  if (R.has(f)) return (tt = R.get(f)) == null ? void 0 : tt.value;
409
409
  const et = o(i);
@@ -413,57 +413,57 @@ function bt(t = {}) {
413
413
  }
414
414
  );
415
415
  for (const [a, f] of Object.entries(r.getters ?? {}))
416
- c.set(
416
+ u.set(
417
417
  a,
418
- nt(() => f(o(i), g.value, v))
418
+ nt(() => f(o(i), g.value, d))
419
419
  );
420
420
  let x;
421
421
  for (const [a, f] of Object.entries(r.actions ?? {}))
422
- u.set(a, (...V) => Y(() => f.apply(x, V)));
422
+ c.set(a, (...P) => Y(() => f.apply(x, P)));
423
423
  x = new Proxy(
424
424
  {},
425
425
  {
426
426
  get(a, f) {
427
- var V;
428
- if (u.has(f)) return u.get(f);
429
- if (c.has(f)) return (V = c.get(f)) == null ? void 0 : V.value;
427
+ var P;
428
+ if (c.has(f)) return c.get(f);
429
+ if (u.has(f)) return (P = u.get(f)) == null ? void 0 : P.value;
430
430
  const I = o(i);
431
431
  return f in I ? I[f] : k[f];
432
432
  },
433
- set(a, f, V) {
434
- if (u.has(f) || c.has(f)) return !1;
433
+ set(a, f, P) {
434
+ if (c.has(f) || u.has(f)) return !1;
435
435
  const I = o(i);
436
- return f in I ? $(i, f, V, "local", k) : k[f] = V, !0;
436
+ return f in I ? $(i, f, P, "local", k) : k[f] = P, !0;
437
437
  }
438
438
  }
439
- ), F.set(i, x), z.set(i, c);
439
+ ), F.set(i, x), z.set(i, u);
440
440
  for (const a of Object.keys(o(i)))
441
- !(N.has(a) || L.has(a) || W.has(a) || Reflect.has(P, a) || j[a] !== void 0) && !M.has(a) && M.set(a, { moduleName: i, key: a });
442
- for (const [a, f] of c.entries())
443
- !(N.has(a) || L.has(a) || W.has(a) || Reflect.has(P, a) || j[a] !== void 0) && !R.has(a) && R.set(a, f);
441
+ !(N.has(a) || L.has(a) || W.has(a) || Reflect.has(V, a) || j[a] !== void 0) && !M.has(a) && M.set(a, { moduleName: i, key: a });
444
442
  for (const [a, f] of u.entries())
445
- !(N.has(a) || L.has(a) || W.has(a) || Reflect.has(P, a) || j[a] !== void 0) && !Reflect.has(P, a) && (P[a] = f);
443
+ !(N.has(a) || L.has(a) || W.has(a) || Reflect.has(V, a) || j[a] !== void 0) && !R.has(a) && R.set(a, f);
444
+ for (const [a, f] of c.entries())
445
+ !(N.has(a) || L.has(a) || W.has(a) || Reflect.has(V, a) || j[a] !== void 0) && !Reflect.has(V, a) && (V[a] = f);
446
446
  }
447
- const k = new Proxy(P, {
448
- get(i, r, c) {
449
- var u, v;
450
- if (Reflect.has(i, r)) return Reflect.get(i, r, c);
447
+ const k = new Proxy(V, {
448
+ get(i, r, u) {
449
+ var c, d;
450
+ if (Reflect.has(i, r)) return Reflect.get(i, r, u);
451
451
  if (F.has(r)) return F.get(r);
452
- if (m.has(r)) return (u = m.get(r)) == null ? void 0 : u.value;
453
- if (R.has(r)) return (v = R.get(r)) == null ? void 0 : v.value;
452
+ if (m.has(r)) return (c = m.get(r)) == null ? void 0 : c.value;
453
+ if (R.has(r)) return (d = R.get(r)) == null ? void 0 : d.value;
454
454
  if (N.has(r)) return g.value[r];
455
455
  const x = M.get(r);
456
456
  return x ? o(x.moduleName)[x.key] : g.value[r];
457
457
  },
458
- set(i, r, c, u) {
458
+ set(i, r, u, c) {
459
459
  if (Reflect.has(i, r))
460
- return Reflect.set(i, r, c, u);
461
- const v = M.get(r);
462
- return v ? ($(v.moduleName, v.key, c, "local", u), !0) : (O(r, c, "local", u), !0);
460
+ return Reflect.set(i, r, u, c);
461
+ const d = M.get(r);
462
+ return d ? ($(d.moduleName, d.key, u, "local", c), !0) : (O(r, u, "local", c), !0);
463
463
  }
464
464
  });
465
465
  for (const [i, r] of Object.entries(S.actions ?? {}))
466
- P[i] = (...c) => Y(() => r.apply(k, c));
466
+ V[i] = (...u) => Y(() => r.apply(k, u));
467
467
  for (const i of n)
468
468
  (T = i.onInit) == null || T.call(i, k);
469
469
  return s.set(y, k), k;
@@ -523,20 +523,20 @@ function jt(t) {
523
523
  mode: "patch",
524
524
  type: e
525
525
  }, A = (o) => {
526
- const d = s(o);
527
- return n ? xt(d) : d;
526
+ const v = s(o);
527
+ return n ? xt(v) : v;
528
528
  };
529
529
  let j = !1, U = !1, g = !1;
530
530
  const m = /* @__PURE__ */ new Map(), z = (o) => {
531
531
  if (T)
532
- for (const d of o) {
533
- const p = m.get(d) ?? 0;
534
- m.set(d, p + 1);
532
+ for (const v of o) {
533
+ const p = m.get(v) ?? 0;
534
+ m.set(v, p + 1);
535
535
  }
536
536
  }, F = (o) => {
537
537
  if (!T || !K(o)) return !1;
538
- const d = Reflect.get(o, "payload");
539
- if (C && K(d) && Reflect.get(d, C))
538
+ const v = Reflect.get(o, "payload");
539
+ if (C && K(v) && Reflect.get(v, C))
540
540
  return !0;
541
541
  const p = Reflect.get(o, "type");
542
542
  if (typeof p != "string") return !1;
@@ -544,7 +544,7 @@ function jt(t) {
544
544
  return b <= 0 ? !1 : (b === 1 ? m.delete(p) : m.set(p, b - 1), !0);
545
545
  }, M = () => {
546
546
  if (j || g) return;
547
- const o = A(y(t.vuex.state)), d = t.store.$snapshot(), p = it(d, o, h, A);
547
+ const o = A(y(t.vuex.state)), v = t.store.$snapshot(), p = it(v, o, h, A);
548
548
  if (ot(p)) {
549
549
  U = !0;
550
550
  try {
@@ -559,13 +559,13 @@ function jt(t) {
559
559
  return st((O = t.outboundRoutes) == null ? void 0 : O[b]);
560
560
  });
561
561
  return p.push(...st(_)), p.find((b) => b.when ? b.when(o) : !0);
562
- }, D = (o, d) => {
562
+ }, D = (o, v) => {
563
563
  var $;
564
564
  if (o.mode === "custom") {
565
- ($ = o.handler) == null || $.call(o, d), z(o.suppressMutationTypes ?? []);
565
+ ($ = o.handler) == null || $.call(o, v), z(o.suppressMutationTypes ?? []);
566
566
  return;
567
567
  }
568
- const p = (o.mode === "patch", d.projectedPatch), b = St(A(o.mapPayload ? o.mapPayload(d) : p), C);
568
+ const p = v.projectedPatch, b = St(A(o.mapPayload ? o.mapPayload(v) : p), C);
569
569
  if (o.mode === "dispatch") {
570
570
  if (typeof t.vuex.dispatch != "function")
571
571
  throw new Error('Vuex bridge route mode "dispatch" requires vuex.dispatch to be available.');
@@ -578,7 +578,7 @@ function jt(t) {
578
578
  t.vuex.commit(O, b), z(o.suppressMutationTypes ?? [O]);
579
579
  }, N = (o) => {
580
580
  if (j || U) return;
581
- const d = t.store.$snapshot(), p = A(S(d)), b = A(y(t.vuex.state)), O = it(b, p, h, A);
581
+ const v = t.store.$snapshot(), p = A(S(v)), b = A(y(t.vuex.state)), O = it(b, p, h, A);
582
582
  if (!ot(O)) return;
583
583
  const $ = {
584
584
  storixMutation: o ?? {
@@ -590,16 +590,16 @@ function jt(t) {
590
590
  newValue: void 0,
591
591
  origin: "local"
592
592
  },
593
- storixSnapshot: d,
593
+ storixSnapshot: v,
594
594
  vuexState: t.vuex.state,
595
595
  projectedPatch: O,
596
596
  projectedVuexState: p,
597
597
  origin: "storix"
598
- }, P = R($);
599
- if (P) {
598
+ }, V = R($);
599
+ if (V) {
600
600
  g = !0;
601
601
  try {
602
- D(P, $);
602
+ D(V, $);
603
603
  } finally {
604
604
  g = !1;
605
605
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storix-js/vuex",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "vite build && tsc -p tsconfig.build.json --emitDeclarationOnly",
24
24
  "dev": "vite build --watch",
25
- "test": "vitest run",
25
+ "test": "vitest run --passWithNoTests",
26
26
  "typecheck": "tsc -p tsconfig.json --noEmit"
27
27
  },
28
28
  "dependencies": {