pinia-plugin-subscription 0.0.0-beta.9 → 0.0.2
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/README.md +73 -102
- package/dist/pinia-plugin-subscription.js +676 -638
- package/dist/pinia-plugin-subscription.umd.cjs +5 -5
- package/dist/types/comparison.d.ts +3 -0
- package/dist/types/index.d.ts +41 -18
- package/dist/types/list.d.ts +8 -0
- package/dist/types/plugin.d.ts +7 -5
- package/dist/types/resourceId.d.ts +4 -0
- package/dist/types/store.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(_,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],T):(_=typeof globalThis<"u"?globalThis:_||self,T(_["pinia-plugin-subscription"]={},_.Pinia))})(this,(function(_,T){"use strict";class fe{_console;_createInstance;_name;_pluginOptions;_storeInstance;_resetStoreCallback;_storeOnActionSubscription;_storeMutationSubscription;_subscriptions;pluginCreated;get console(){return this._console??console}get name(){return this._name}get pluginOptions(){return this._pluginOptions??{}}set pluginOptions(e){this._pluginOptions=e}get resetStoreCallback(){return this._resetStoreCallback}get storeOnActionSubscription(){return this._storeOnActionSubscription}get storeMutationSubscription(){return this._storeMutationSubscription}get subscriptions(){return this._subscriptions}set subscriptions(e){this._subscriptions=e}constructor(e,n,s){this._name=e,this._createInstance=n,s&&(this._console=s)}invoke({store:e,options:n},s){this._storeInstance=this._createInstance(e,{...n,...this.pluginOptions},s,this.console),this._storeInstance&&(this._subscriptions=this._storeInstance.getSubscriptions(),this._storeMutationSubscription=this._storeInstance.storeSubscribe,this._storeOnActionSubscription=this._storeInstance.onAction,this.pluginCreated&&this.pluginCreated(e))}}class vt{_console;_debug=!1;get console(){return this._console??console}set console(e){this._console=e}get debug(){return this._debug}set debug(e){this._debug=e}constructor(e,n){this._debug=e,n&&(this._console=n)}debugLog(...e){this._debug&&(Array.isArray(e)&&(e[0]=`${this._className} - ${e[0]}`),this.console.log(...e))}logError(...e){this.console.error(...e)}}const Rt="pinia-plugin-subscription",pe=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function he(t,e){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e.shift(),...e)}class Ct{_bgColor="#ffec73";_color="green";_icon="🍍⚡";_errorBgColor="#d24545";_errorColor="white";_errorIcon="🍍⚠️";_styles={error:{bgColor:this._errorBgColor,color:this._errorColor,icon:this._errorIcon},info:{bgColor:this._bgColor,color:this._color,icon:this._icon}};formatMessage(e,n){return` [${n} ${Rt}] - ${e} `}generateStyle(e){return pe(e.bgColor,e.color)}getStyleDefinition(e){return this._styles[e??"info"]}log(...e){this.useLog(this.getStyleDefinition(),e)}error(...e){this.useLog(this.getStyleDefinition("error"),e)}rebuildArgs(e,n){if(typeof e=="string")return[this.formatMessage(e,n)];if(Array.isArray(e))return[this.formatMessage(e.shift(),n),...e??[]]}useLog(e,n){he(this.generateStyle(e),this.rebuildArgs(n,e.icon))}}class de extends Ct{_pluginName=Rt}const _e=new de;function ge(t,e,n){const s=n?{storeOptions:n}:{};return typeof e=="function"?be(t,e,s):me(t,e,s)}function be(t,e,n){return T.defineStore(t,e,n)}function me(t,e,n){return n&&(e={...e,...n??{}}),T.defineStore(t,e)}const ye=new Set(["_","$"]);function It(t){return ye.has(t[0])}function rt(t){return t?Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:typeof t=="string"?t.trim()==="":!1:!(typeof t=="boolean"||typeof t=="number")}class Vt extends vt{_className="PluginSubscription";_resetStoreCallback=[];_subscribers=[];_subscriptions=[];set subscribers(e){this._subscribers=e}get subscriptions(){if(!rt(this._subscriptions))return this._subscriptions}constructor(e,n){super(n,_e),this._subscribers=e}addResetStoreCallback(e){this._resetStoreCallback.push(e)}executeResetStoreCallbacks(e){this._resetStoreCallback.forEach(n=>n(e))}plugin({store:e,options:n}){if(this._subscribers.length){this.debugLog(`plugin() - store: ${e.$id}`,["subscriber:",this._subscribers,"store:",e,"options:",n]);try{this._subscribers.forEach(s=>{s.invoke({store:e,options:n},this.debug),s.subscriptions&&this.subscriptionDelivery({store:e,options:n},s.subscriptions),s.storeMutationSubscription&&this.storeMutationSubscription(s.storeMutationSubscription),s.storeOnActionSubscription&&this.storeOnActionSubscription(s.storeOnActionSubscription),s.resetStoreCallback&&this.addResetStoreCallback(s.resetStoreCallback)}),this.rewriteResetStore({store:e},Object.assign({},e.$state),Object.assign({},e))}catch(s){this.logError(s,e,n)}}}rewriteResetStore({store:e},n,s){e.$reset=()=>{this.executeResetStoreCallbacks(e),Object.keys(s).forEach(r=>{It(r)||(e[r]=n[r]??s[r])}),e.$patch(JSON.parse(JSON.stringify(n)))}}storeOnActionSubscription(e){const{store:n,callback:s}=e();n.$onAction(({after:r,args:o,name:i})=>{this.debugLog(`storeOnActionSubscription ${n.$id}`,[r,o,i,n]),s({after:r,args:o,name:i})})}storeMutationSubscription(e){const{store:n,callback:s}=e();n.$subscribe(r=>{this.debugLog(`$subscribe ${n.$id}`,[r,n]),s(r)})}subscriptionDelivery({store:e,options:n},s){Object.entries(s).forEach(([r,o])=>{try{const{subscription:i,subscriptionOptions:c}=o;this.debugLog(`subscriptionDelivery() - store: ${e.$id}`,["pluginName:",r,"subscription:",i,"options:",c]),i.invoke({store:e,options:{...n,...c}},this.debug)}catch(i){this.logError(`subscriptionDelivery() - ${r}`,i,e,n)}})}}function Se(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const st=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const At=()=>{},Ee=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),x=Object.assign,Oe=Object.prototype.hasOwnProperty,ot=(t,e)=>Oe.call(t,e),d=Array.isArray,K=t=>$t(t)==="[object Map]",C=t=>typeof t=="function",w=t=>typeof t=="string",H=t=>typeof t=="symbol",g=t=>t!==null&&typeof t=="object",we=Object.prototype.toString,$t=t=>we.call(t),Tt=t=>$t(t).slice(8,-1),J=t=>w(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Ne=(t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),it=(t,e)=>!Object.is(t,e);let xt;const B=()=>xt||(xt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ct(t){if(d(t)){const e={};for(let n=0;n<t.length;n++){const s=t[n],r=w(s)?Ie(s):ct(s);if(r)for(const o in r)e[o]=r[o]}return e}else if(w(t)||g(t))return t}const ve=/;(?![^(]*\))/g,Re=/:([^]+)/,Ce=/\/\*[^]*?\*\//g;function Ie(t){const e={};return t.replace(Ce,"").split(ve).forEach(n=>{if(n){const s=n.split(Re);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function lt(t){let e="";if(w(t))e=t;else if(d(t))for(let n=0;n<t.length;n++){const s=lt(t[n]);s&&(e+=s+" ")}else if(g(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function D(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let Dt=0,at;function ut(){Dt++}function ft(){if(--Dt>0)return;let t;for(;at;){let e=at;for(at=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(s){t||(t=s)}e=n}}if(t)throw t}class Ve{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){}trigger(e){this.version++,this.notify(e)}notify(e){ut();try{if(process.env.NODE_ENV!=="production")for(let n=this.subsHead;n;n=n.nextSub)n.sub.onTrigger&&!(n.sub.flags&8)&&n.sub.onTrigger(x({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ft()}}}const Pt=new WeakMap,pt=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Mt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Ft=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function kn(t,e,n){}function I(t,e,n,s,r,o){const i=Pt.get(t);if(!i)return;const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:t,type:e,key:n,newValue:s,oldValue:r,oldTarget:o}):a.trigger())};if(ut(),e==="clear")i.forEach(c);else{const a=d(t),f=a&&J(n);if(a&&n==="length"){const h=Number(s);i.forEach((l,p)=>{(p==="length"||p===Ft||!H(p)&&p>=h)&&c(l)})}else switch((n!==void 0||i.has(void 0))&&c(i.get(n)),f&&c(i.get(Ft)),e){case"add":a?f&&c(i.get("length")):(c(i.get(pt)),K(t)&&c(i.get(Mt)));break;case"delete":a||(c(i.get(pt)),K(t)&&c(i.get(Mt)));break;case"set":K(t)&&c(i.get(pt));break}}ft()}function Ae(t,e){const n=Pt.get(t);return n&&n.get(e)}function P(t){const e=u(t);return e===t||m(t)?e:e.map(v)}function ht(t){return t=u(t),t}function V(t,e){return E(t)?mt(t)?W(v(e)):W(e):v(e)}const $e={__proto__:null,[Symbol.iterator](){return dt(this,Symbol.iterator,t=>V(this,t))},concat(...t){return P(this).concat(...t.map(e=>d(e)?P(e):e))},entries(){return dt(this,"entries",t=>(t[1]=V(this,t[1]),t))},every(t,e){return N(this,"every",t,e,void 0,arguments)},filter(t,e){return N(this,"filter",t,e,n=>n.map(s=>V(this,s)),arguments)},find(t,e){return N(this,"find",t,e,n=>V(this,n),arguments)},findIndex(t,e){return N(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return N(this,"findLast",t,e,n=>V(this,n),arguments)},findLastIndex(t,e){return N(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return N(this,"forEach",t,e,void 0,arguments)},includes(...t){return _t(this,"includes",t)},indexOf(...t){return _t(this,"indexOf",t)},join(t){return P(this).join(t)},lastIndexOf(...t){return _t(this,"lastIndexOf",t)},map(t,e){return N(this,"map",t,e,void 0,arguments)},pop(){return L(this,"pop")},push(...t){return L(this,"push",t)},reduce(t,...e){return jt(this,"reduce",t,e)},reduceRight(t,...e){return jt(this,"reduceRight",t,e)},shift(){return L(this,"shift")},some(t,e){return N(this,"some",t,e,void 0,arguments)},splice(...t){return L(this,"splice",t)},toReversed(){return P(this).toReversed()},toSorted(t){return P(this).toSorted(t)},toSpliced(...t){return P(this).toSpliced(...t)},unshift(...t){return L(this,"unshift",t)},values(){return dt(this,"values",t=>V(this,t))}};function dt(t,e,n){const s=ht(t),r=s[e]();return s!==t&&!m(t)&&(r._next=r.next,r.next=()=>{const o=r._next();return o.done||(o.value=n(o.value)),o}),r}const Te=Array.prototype;function N(t,e,n,s,r,o){const i=ht(t),c=i!==t&&!m(t),a=i[e];if(a!==Te[e]){const l=a.apply(t,o);return c?v(l):l}let f=n;i!==t&&(c?f=function(l,p){return n.call(this,V(t,l),p,t)}:n.length>2&&(f=function(l,p){return n.call(this,l,p,t)}));const h=a.call(i,f,s);return c&&r?r(h):h}function jt(t,e,n,s){const r=ht(t);let o=n;return r!==t&&(m(t)?n.length>3&&(o=function(i,c,a){return n.call(this,i,c,a,t)}):o=function(i,c,a){return n.call(this,i,V(t,c),a,t)}),r[e](o,...s)}function _t(t,e,n){const s=u(t),r=s[e](...n);return(r===-1||r===!1)&&z(n[0])?(n[0]=u(n[0]),s[e](...n)):r}function L(t,e,n=[]){ut();const s=u(t)[e].apply(t,n);return ft(),s}const xe=Se("__proto__,__v_isRef,__isVue"),kt=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(H));function De(t){return H(t)||(t=String(t)),u(this).hasOwnProperty(t)}class Kt{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,s){if(n==="__v_skip")return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return o;if(n==="__v_raw")return s===(r?o?We:Wt:o?ze:zt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const i=d(e);if(!r){let a;if(i&&(a=$e[n]))return a;if(n==="hasOwnProperty")return De}const c=Reflect.get(e,n,b(e)?e:s);if((H(n)?kt.has(n):xe(n))||o)return c;if(b(c)){const a=i&&J(n)?c:c.value;return r&&g(a)?bt(a):a}return g(c)?r?bt(c):Ut(c):c}}class Pe extends Kt{constructor(e=!1){super(!1,e)}set(e,n,s,r){let o=e[n];const i=d(e)&&J(n);if(!this._isShallow){const f=E(o);if(!m(s)&&!E(s)&&(o=u(o),s=u(s)),!i&&b(o)&&!b(s))return f?(process.env.NODE_ENV!=="production"&&D(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(o.value=s,!0)}const c=i?Number(n)<e.length:ot(e,n),a=Reflect.set(e,n,s,b(e)?e:r);return e===u(r)&&(c?it(s,o)&&I(e,"set",n,s,o):I(e,"add",n,s)),a}deleteProperty(e,n){const s=ot(e,n),r=e[n],o=Reflect.deleteProperty(e,n);return o&&s&&I(e,"delete",n,void 0,r),o}has(e,n){const s=Reflect.has(e,n);return!H(n)||kt.has(n),s}ownKeys(e){return Reflect.ownKeys(e)}}class Me extends Kt{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&D(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&D(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const Fe=new Pe,je=new Me,gt=t=>t,Y=t=>Reflect.getPrototypeOf(t);function ke(t,e,n){return function(...s){const r=this.__v_raw,o=u(r),i=K(o),c=t==="entries"||t===Symbol.iterator&&i,a=r[t](...s),f=n?gt:e?W:v;return{next(){const{value:h,done:l}=a.next();return l?{value:h,done:l}:{value:c?[f(h[0]),f(h[1])]:f(h),done:l}},[Symbol.iterator](){return this}}}}function G(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";D(`${Ne(t)} operation ${n}failed: target is readonly.`,u(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function Ke(t,e){const n={get(r){const o=this.__v_raw,i=u(o),c=u(r),{has:a}=Y(i),f=e?gt:t?W:v;if(a.call(i,r))return f(o.get(r));if(a.call(i,c))return f(o.get(c));o!==i&&o.get(r)},get size(){const r=this.__v_raw;return!t&&(u(r),void 0),r.size},has(r){const o=this.__v_raw;u(o);const i=u(r);return r===i?o.has(r):o.has(r)||o.has(i)},forEach(r,o){const i=this,c=i.__v_raw;u(c);const a=e?gt:t?W:v;return c.forEach((f,h)=>r.call(o,a(f),a(h),i))}};return x(n,t?{add:G("add"),set:G("set"),delete:G("delete"),clear:G("clear")}:{add(r){!e&&!m(r)&&!E(r)&&(r=u(r));const o=u(this);return Y(o).has.call(o,r)||(o.add(r),I(o,"add",r,r)),this},set(r,o){!e&&!m(o)&&!E(o)&&(o=u(o));const i=u(this),{has:c,get:a}=Y(i);let f=c.call(i,r);f?process.env.NODE_ENV!=="production"&&Lt(i,c,r):(r=u(r),f=c.call(i,r));const h=a.call(i,r);return i.set(r,o),f?it(o,h)&&I(i,"set",r,o,h):I(i,"add",r,o),this},delete(r){const o=u(this),{has:i,get:c}=Y(o);let a=i.call(o,r);a?process.env.NODE_ENV!=="production"&&Lt(o,i,r):(r=u(r),a=i.call(o,r));const f=c?c.call(o,r):void 0,h=o.delete(r);return a&&I(o,"delete",r,void 0,f),h},clear(){const r=u(this),o=r.size!==0,i=process.env.NODE_ENV!=="production"?K(r)?new Map(r):new Set(r):void 0,c=r.clear();return o&&I(r,"clear",void 0,void 0,i),c}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=ke(r,t,e)}),n}function Ht(t,e){const n=Ke(t,e);return(s,r,o)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?s:Reflect.get(ot(n,r)&&r in s?n:s,r,o)}const He={get:Ht(!1,!1)},Le={get:Ht(!0,!1)};function Lt(t,e,n){const s=u(n);if(s!==n&&e.call(t,s)){const r=Tt(t);D(`Reactive ${r} contains both the raw and reactive versions of the same object${r==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const zt=new WeakMap,ze=new WeakMap,Wt=new WeakMap,We=new WeakMap;function Ue(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function qe(t){return t.__v_skip||!Object.isExtensible(t)?0:Ue(Tt(t))}function Ut(t){return E(t)?t:qt(t,!1,Fe,He,zt)}function bt(t){return qt(t,!0,je,Le,Wt)}function qt(t,e,n,s,r){if(!g(t))return process.env.NODE_ENV!=="production"&&D(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=qe(t);if(o===0)return t;const i=r.get(t);if(i)return i;const c=new Proxy(t,o===2?s:n);return r.set(t,c),c}function mt(t){return E(t)?mt(t.__v_raw):!!(t&&t.__v_isReactive)}function E(t){return!!(t&&t.__v_isReadonly)}function m(t){return!!(t&&t.__v_isShallow)}function z(t){return t?!!t.__v_raw:!1}function u(t){const e=t&&t.__v_raw;return e?u(e):t}const v=t=>g(t)?Ut(t):t,W=t=>g(t)?bt(t):t;function b(t){return t?t.__v_isRef===!0:!1}function Jt(t){return Je(t,!1)}function Je(t,e){return b(t)?t:new Be(t,e)}class Be{constructor(e,n){this.dep=new Ve,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:u(e),this._value=n?e:v(e),this.__v_isShallow=n}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const n=this._rawValue,s=this.__v_isShallow||m(e)||E(e);e=s?e:u(e),it(e,n)&&(this._rawValue=e,this._value=s?e:v(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:n}):this.dep.trigger())}}function Ye(t){return b(t)?t.value:t}class Ge{constructor(e,n,s){this._object=e,this._key=n,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._raw=u(e);let r=!0,o=e;if(!d(e)||!J(String(n)))do r=!z(o)||m(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=Ye(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&b(this._raw[this._key])){const n=this._object[this._key];if(b(n)){n.value=e;return}}this._object[this._key]=e}get dep(){return Ae(this._raw,this._key)}}class Qe{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function Xe(t,e,n){return b(t)?t:C(t)?new Qe(t):g(t)&&arguments.length>1?Ze(t,e,n):Jt(t)}function Ze(t,e,n){return new Ge(t,e,n)}const $=[];function tn(t){$.push(t)}function en(){$.pop()}let yt=!1;function M(t,...e){if(yt)return;yt=!0;const n=$.length?$[$.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=nn();if(s)St(s,n,11,[t+e.map(o=>{var i,c;return(c=(i=o.toString)==null?void 0:i.call(o))!=null?c:JSON.stringify(o)}).join(""),n&&n.proxy,r.map(({vnode:o})=>`at <${ae(n,o.type)}>`).join(`
|
|
2
|
-
`),
|
|
3
|
-
`,...
|
|
4
|
-
`],...
|
|
5
|
-
Component that was made reactive: `,t)),
|
|
1
|
+
(function(_,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],x):(_=typeof globalThis<"u"?globalThis:_||self,x(_["pinia-plugin-subscription"]={},_.Pinia))})(this,(function(_,x){"use strict";class ue{_console;_createInstance;_name;_pluginOptions;_storeInstance;_resetStoreCallback;_storeOnActionSubscription;_storeMutationSubscription;_subscriptions;pluginCreated;get console(){return this._console??console}get name(){return this._name}get pluginOptions(){return this._pluginOptions??{}}set pluginOptions(e){this._pluginOptions=e}get resetStoreCallback(){return this._resetStoreCallback}get storeOnActionSubscription(){return this._storeOnActionSubscription}get storeMutationSubscription(){return this._storeMutationSubscription}get subscriptions(){return this._subscriptions}set subscriptions(e){this._subscriptions=e}constructor(e,n,r){this._name=e,this._createInstance=n,r&&(this._console=r)}invoke({store:e,options:n},r){return this._storeInstance=this._createInstance(e,{...n,...this.pluginOptions},r,this.console),this._storeInstance?(this._subscriptions=this._storeInstance.getSubscriptions(),this._storeMutationSubscription=this._storeInstance.storeSubscribe,this._storeOnActionSubscription=this._storeInstance.onAction,this.pluginCreated&&this.pluginCreated(e),!0):!1}}class Rt{_className;_console;_debug=!1;get console(){return this._console??console}set console(e){this._console=e}get debug(){return this._debug}set debug(e){this._debug=e}constructor(e,n){this._debug=e,this._className=this.constructor.name,n&&(this._console=n)}debugLog(...e){this._debug&&(Array.isArray(e)&&(e[0]=`${this._className} - ${e[0]}`),this.console.log(...e))}logError(...e){this.console.error(...e)}}const it="pinia-plugin-subscription",fe=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function he(t,e){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e.shift(),...e)}class Ct{_bgColor="#ffec73";_color="green";_icon="🍍⚡";_errorBgColor="#d24545";_errorColor="white";_errorIcon="🍍⚠️";_styles={error:{bgColor:this._errorBgColor,color:this._errorColor,icon:this._errorIcon},info:{bgColor:this._bgColor,color:this._color,icon:this._icon}};formatMessage(e,n){return` [${n} ${it}] - ${e} `}generateStyle(e){return fe(e.bgColor,e.color)}getStyleDefinition(e){return this._styles[e??"info"]}log(...e){this.useLog(this.getStyleDefinition(),e)}error(...e){this.useLog(this.getStyleDefinition("error"),e)}rebuildArgs(e,n){if(typeof e=="string")return[this.formatMessage(e,n)];if(Array.isArray(e))return[this.formatMessage(e.shift(),n),...e??[]]}useLog(e,n){he(this.generateStyle(e),this.rebuildArgs(n,e.icon))}}class pe extends Ct{_pluginName=it}const de=new pe;function B(t){return t?Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:typeof t=="string"?t.trim()==="":!1:!(typeof t=="boolean"||typeof t=="number")}const _e="PluginSubscription";class At extends Rt{_pluginDebug;_resetStoreCallback=[];_subscribers=[];_subscribersDelivered=new Set;_subscriptions=[];_subscriptionsDelivered=new Set;set subscribers(e){this._subscribers=e}get subscriptions(){if(!B(this._subscriptions))return this._subscriptions}constructor(e,n){super(Array.isArray(n)&&!!n?.includes(_e),de),this._pluginDebug=Array.isArray(n)?n:void 0,this._subscribers=e}addResetStoreCallback(e){this._resetStoreCallback.push(e)}definePluginDebug(e){return!!this._pluginDebug?.includes(e.name)}executeResetStoreCallbacks(e){this._resetStoreCallback.forEach(n=>n(e))}plugin({store:e,options:n}){if(this._subscribers.length){this.debugLog(`plugin() - ${e.$id}`,["subscriber:",this._subscribers,"store:",e,"options:",n]);try{this._subscribers.forEach(r=>{this._subscribersDelivered.has(`${r.name}-${e.$id}`)||r.invoke({store:e,options:n},this.definePluginDebug(r))&&(this._subscribersDelivered.add(`${r.name}-${e.$id}`),r.subscriptions&&this.subscriptionDelivery({store:e,options:n},r.subscriptions),r.storeMutationSubscription&&this.storeMutationSubscription(r.storeMutationSubscription),r.storeOnActionSubscription&&this.storeOnActionSubscription(r.storeOnActionSubscription),r.resetStoreCallback&&this.addResetStoreCallback(r.resetStoreCallback))}),this.rewriteResetStore({store:e},JSON.stringify(e.$state),Object.assign({},e))}catch(r){this.logError(r,e,n)}}}rewriteResetStore({store:e},n,r){e.$reset=()=>{this.debugLog("rewriteResetStore()",{initState:n,store:e,customStore:r}),this.executeResetStoreCallbacks(e),e.$patch(JSON.parse(n))}}storeOnActionSubscription(e){const{store:n,callback:r}=e();n.$onAction(({after:s,args:i,name:o})=>{this.debugLog(`storeOnActionSubscription ${n.$id}`,{after:s,args:i,name:o,store:n}),r({after:s,args:i,name:o})})}storeMutationSubscription(e){const{store:n,callback:r}=e();n.$subscribe(s=>{this.debugLog(`$subscribe ${n.$id}`,{mutation:s,store:n}),r(s)})}subscriptionDelivery({store:e,options:n},r){Object.entries(r).forEach(([s,i])=>{try{if(this._subscriptionsDelivered.has(`${s}-${e.$id}`))return;const{subscription:o,subscriptionOptions:c,stores:a}=i;this.debugLog(`subscriptionDelivery() - store: ${e.$id}`,["pluginName:",s,"subscription:",o,"options:",i,"stores:",a]);const u={storeOptions:{...n?.storeOptions??{},...c}};o.invoke({store:e,options:{...n,...u}},this.debug),this._subscriptionsDelivered.add(`${s}-${e.$id}`),B(a)||a?.forEach(h=>o.invoke({store:h,options:{...n,...u,...h?.storeOptions??{}}},this.debug))}catch(o){this.logError("subscriptionDelivery()",o,e,n)}})}}function ge(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const ot=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const It=()=>{},be=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),me=t=>t.startsWith("onUpdate:"),V=Object.assign,ye=Object.prototype.hasOwnProperty,ct=(t,e)=>ye.call(t,e),d=Array.isArray,H=t=>$t(t)==="[object Map]",A=t=>typeof t=="function",N=t=>typeof t=="string",D=t=>typeof t=="symbol",g=t=>t!==null&&typeof t=="object",Se=Object.prototype.toString,$t=t=>Se.call(t),Vt=t=>$t(t).slice(8,-1),Y=t=>N(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Oe=(t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),L=(t,e)=>!Object.is(t,e);let Dt;const G=()=>Dt||(Dt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function lt(t){if(d(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],s=N(r)?ve(r):lt(r);if(s)for(const i in s)e[i]=s[i]}return e}else if(N(t)||g(t))return t}const Ee=/;(?![^(]*\))/g,we=/:([^]+)/,Ne=/\/\*[^]*?\*\//g;function ve(t){const e={};return t.replace(Ne,"").split(Ee).forEach(n=>{if(n){const r=n.split(we);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function at(t){let e="";if(N(t))e=t;else if(d(t))for(let n=0;n<t.length;n++){const r=at(t[n]);r&&(e+=r+" ")}else if(g(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function P(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let Tt=0,ut;function ft(){Tt++}function ht(){if(--Tt>0)return;let t;for(;ut;){let e=ut;for(ut=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}class Re{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){}trigger(e){this.version++,this.notify(e)}notify(e){ft();try{if(process.env.NODE_ENV!=="production")for(let n=this.subsHead;n;n=n.nextSub)n.sub.onTrigger&&!(n.sub.flags&8)&&n.sub.onTrigger(V({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ht()}}}const xt=new WeakMap,pt=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Pt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Mt=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function Hn(t,e,n){}function I(t,e,n,r,s,i){const o=xt.get(t);if(!o)return;const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:t,type:e,key:n,newValue:r,oldValue:s,oldTarget:i}):a.trigger())};if(ft(),e==="clear")o.forEach(c);else{const a=d(t),u=a&&Y(n);if(a&&n==="length"){const h=Number(r);o.forEach((l,p)=>{(p==="length"||p===Mt||!D(p)&&p>=h)&&c(l)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),u&&c(o.get(Mt)),e){case"add":a?u&&c(o.get("length")):(c(o.get(pt)),H(t)&&c(o.get(Pt)));break;case"delete":a||(c(o.get(pt)),H(t)&&c(o.get(Pt)));break;case"set":H(t)&&c(o.get(pt));break}}ht()}function Ce(t,e){const n=xt.get(t);return n&&n.get(e)}function M(t){const e=f(t);return e===t||m(t)?e:e.map(R)}function dt(t){return t=f(t),t}function O(t,e){return E(t)?U(yt(t)?R(e):e):R(e)}const Ae={__proto__:null,[Symbol.iterator](){return _t(this,Symbol.iterator,t=>O(this,t))},concat(...t){return M(this).concat(...t.map(e=>d(e)?M(e):e))},entries(){return _t(this,"entries",t=>(t[1]=O(this,t[1]),t))},every(t,e){return v(this,"every",t,e,void 0,arguments)},filter(t,e){return v(this,"filter",t,e,n=>n.map(r=>O(this,r)),arguments)},find(t,e){return v(this,"find",t,e,n=>O(this,n),arguments)},findIndex(t,e){return v(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return v(this,"findLast",t,e,n=>O(this,n),arguments)},findLastIndex(t,e){return v(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return v(this,"forEach",t,e,void 0,arguments)},includes(...t){return gt(this,"includes",t)},indexOf(...t){return gt(this,"indexOf",t)},join(t){return M(this).join(t)},lastIndexOf(...t){return gt(this,"lastIndexOf",t)},map(t,e){return v(this,"map",t,e,void 0,arguments)},pop(){return W(this,"pop")},push(...t){return W(this,"push",t)},reduce(t,...e){return Ft(this,"reduce",t,e)},reduceRight(t,...e){return Ft(this,"reduceRight",t,e)},shift(){return W(this,"shift")},some(t,e){return v(this,"some",t,e,void 0,arguments)},splice(...t){return W(this,"splice",t)},toReversed(){return M(this).toReversed()},toSorted(t){return M(this).toSorted(t)},toSpliced(...t){return M(this).toSpliced(...t)},unshift(...t){return W(this,"unshift",t)},values(){return _t(this,"values",t=>O(this,t))}};function _t(t,e,n){const r=dt(t),s=r[e]();return r!==t&&!m(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const Ie=Array.prototype;function v(t,e,n,r,s,i){const o=dt(t),c=o!==t&&!m(t),a=o[e];if(a!==Ie[e]){const l=a.apply(t,i);return c?R(l):l}let u=n;o!==t&&(c?u=function(l,p){return n.call(this,O(t,l),p,t)}:n.length>2&&(u=function(l,p){return n.call(this,l,p,t)}));const h=a.call(o,u,r);return c&&s?s(h):h}function Ft(t,e,n,r){const s=dt(t),i=s!==t&&!m(t);let o=n,c=!1;s!==t&&(i?(c=r.length===0,o=function(u,h,l){return c&&(c=!1,u=O(t,u)),n.call(this,u,O(t,h),l,t)}):n.length>3&&(o=function(u,h,l){return n.call(this,u,h,l,t)}));const a=s[e](o,...r);return c?O(t,a):a}function gt(t,e,n){const r=f(t),s=r[e](...n);return(s===-1||s===!1)&&z(n[0])?(n[0]=f(n[0]),r[e](...n)):s}function W(t,e,n=[]){ft();const r=f(t)[e].apply(t,n);return ht(),r}const $e=ge("__proto__,__v_isRef,__isVue"),kt=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(D));function Ve(t){return D(t)||(t=String(t)),f(this).hasOwnProperty(t)}class jt{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?He:Wt:i?Ke:Lt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=d(e);if(!s){let a;if(o&&(a=Ae[n]))return a;if(n==="hasOwnProperty")return Ve}const c=Reflect.get(e,n,b(e)?e:r);if((D(n)?kt.has(n):$e(n))||i)return c;if(b(c)){const a=o&&Y(n)?c:c.value;return s&&g(a)?mt(a):a}return g(c)?s?mt(c):zt(c):c}}class De extends jt{constructor(e=!1){super(!1,e)}set(e,n,r,s){let i=e[n];const o=d(e)&&Y(n);if(!this._isShallow){const u=E(i);if(!m(r)&&!E(r)&&(i=f(i),r=f(r)),!o&&b(i)&&!b(r))return u?(process.env.NODE_ENV!=="production"&&P(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(i.value=r,!0)}const c=o?Number(n)<e.length:ct(e,n),a=Reflect.set(e,n,r,b(e)?e:s);return e===f(s)&&(c?L(r,i)&&I(e,"set",n,r,i):I(e,"add",n,r)),a}deleteProperty(e,n){const r=ct(e,n),s=e[n],i=Reflect.deleteProperty(e,n);return i&&r&&I(e,"delete",n,void 0,s),i}has(e,n){const r=Reflect.has(e,n);return!D(n)||kt.has(n),r}ownKeys(e){return Reflect.ownKeys(e)}}class Te extends jt{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&P(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&P(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const xe=new De,Pe=new Te,bt=t=>t,Q=t=>Reflect.getPrototypeOf(t);function Me(t,e,n){return function(...r){const s=this.__v_raw,o=H(f(s)),c=t==="entries"||t===Symbol.iterator&&o,a=s[t](...r),u=n?bt:e?U:R;return V(Object.create(a),{next(){const{value:h,done:l}=a.next();return l?{value:h,done:l}:{value:c?[u(h[0]),u(h[1])]:u(h),done:l}}})}}function X(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";P(`${Oe(t)} operation ${n}failed: target is readonly.`,f(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function Fe(t,e){const n={get(s){const i=this.__v_raw,o=f(i),c=f(s),{has:a}=Q(o),u=e?bt:t?U:R;if(a.call(o,s))return u(i.get(s));if(a.call(o,c))return u(i.get(c));i!==o&&i.get(s)},get size(){return this.__v_raw.size},has(s){const i=this.__v_raw,o=f(s);return s===o?i.has(s):i.has(s)||i.has(o)},forEach(s,i){const o=this,c=o.__v_raw,a=e?bt:t?U:R;return c.forEach((u,h)=>s.call(i,a(u),a(h),o))}};return V(n,t?{add:X("add"),set:X("set"),delete:X("delete"),clear:X("clear")}:{add(s){const i=f(this),o=Q(i),c=f(s),a=!e&&!m(s)&&!E(s)?c:s;return o.has.call(i,a)||L(s,a)&&o.has.call(i,s)||L(c,a)&&o.has.call(i,c)||(i.add(a),I(i,"add",a,a)),this},set(s,i){!e&&!m(i)&&!E(i)&&(i=f(i));const o=f(this),{has:c,get:a}=Q(o);let u=c.call(o,s);u?process.env.NODE_ENV!=="production"&&Ht(o,c,s):(s=f(s),u=c.call(o,s));const h=a.call(o,s);return o.set(s,i),u?L(i,h)&&I(o,"set",s,i,h):I(o,"add",s,i),this},delete(s){const i=f(this),{has:o,get:c}=Q(i);let a=o.call(i,s);a?process.env.NODE_ENV!=="production"&&Ht(i,o,s):(s=f(s),a=o.call(i,s));const u=c?c.call(i,s):void 0,h=i.delete(s);return a&&I(i,"delete",s,void 0,u),h},clear(){const s=f(this),i=s.size!==0,o=process.env.NODE_ENV!=="production"?H(s)?new Map(s):new Set(s):void 0,c=s.clear();return i&&I(s,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Me(s,t,e)}),n}function Kt(t,e){const n=Fe(t,e);return(r,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?r:Reflect.get(ct(n,s)&&s in r?n:r,s,i)}const ke={get:Kt(!1,!1)},je={get:Kt(!0,!1)};function Ht(t,e,n){const r=f(n);if(r!==n&&e.call(t,r)){const s=Vt(t);P(`Reactive ${s} contains both the raw and reactive versions of the same object${s==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Lt=new WeakMap,Ke=new WeakMap,Wt=new WeakMap,He=new WeakMap;function Le(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function We(t){return t.__v_skip||!Object.isExtensible(t)?0:Le(Vt(t))}function zt(t){return E(t)?t:Ut(t,!1,xe,ke,Lt)}function mt(t){return Ut(t,!0,Pe,je,Wt)}function Ut(t,e,n,r,s){if(!g(t))return process.env.NODE_ENV!=="production"&&P(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=We(t);if(i===0)return t;const o=s.get(t);if(o)return o;const c=new Proxy(t,i===2?r:n);return s.set(t,c),c}function yt(t){return E(t)?yt(t.__v_raw):!!(t&&t.__v_isReactive)}function E(t){return!!(t&&t.__v_isReadonly)}function m(t){return!!(t&&t.__v_isShallow)}function z(t){return t?!!t.__v_raw:!1}function f(t){const e=t&&t.__v_raw;return e?f(e):t}const R=t=>g(t)?zt(t):t,U=t=>g(t)?mt(t):t;function b(t){return t?t.__v_isRef===!0:!1}function qt(t){return ze(t,!1)}function ze(t,e){return b(t)?t:new Ue(t,e)}class Ue{constructor(e,n){this.dep=new Re,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:f(e),this._value=n?e:R(e),this.__v_isShallow=n}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||m(e)||E(e);e=r?e:f(e),L(e,n)&&(this._rawValue=e,this._value=r?e:R(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:n}):this.dep.trigger())}}function qe(t){return b(t)?t.value:t}class Je{constructor(e,n,r){this._object=e,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=D(n)?n:String(n),this._raw=f(e);let s=!0,i=e;if(!d(e)||D(this._key)||!Y(this._key))do s=!z(i)||m(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=qe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&b(this._raw[this._key])){const n=this._object[this._key];if(b(n)){n.value=e;return}}this._object[this._key]=e}get dep(){return Ce(this._raw,this._key)}}class Be{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function Ye(t,e,n){return b(t)?t:A(t)?new Be(t):g(t)&&arguments.length>1?Ge(t,e,n):qt(t)}function Ge(t,e,n){return new Je(t,e,n)}const T=[];function Qe(t){T.push(t)}function Xe(){T.pop()}let St=!1;function F(t,...e){if(St)return;St=!0;const n=T.length?T[T.length-1].component:null,r=n&&n.appContext.config.warnHandler,s=Ze();if(r)Ot(r,n,11,[t+e.map(i=>{var o,c;return(c=(o=i.toString)==null?void 0:o.call(i))!=null?c:JSON.stringify(i)}).join(""),n&&n.proxy,s.map(({vnode:i})=>`at <${le(n,i.type)}>`).join(`
|
|
2
|
+
`),s]);else{const i=[`[Vue warn]: ${t}`,...e];s.length&&i.push(`
|
|
3
|
+
`,...tn(s)),console.warn(...i)}St=!1}function Ze(){let t=T[T.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function tn(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
|
|
4
|
+
`],...en(n))}),e}function en({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,s=` at <${le(t.component,t.type,r)}`,i=">"+n;return t.props?[s,...nn(t.props),i]:[s+i]}function nn(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...Jt(r,t[r]))}),n.length>3&&e.push(" ..."),e}function Jt(t,e,n){return N(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:b(e)?(e=Jt(t,f(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):A(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=f(e),n?e:[`${t}=`,e])}const Bt={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Ot(t,e,n,r){try{return r?t(...r):t()}catch(s){Yt(s,e,n)}}function Yt(t,e,n,r=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ot;if(e){let c=e.parent;const a=e.proxy,u=process.env.NODE_ENV!=="production"?Bt[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const h=c.ec;if(h){for(let l=0;l<h.length;l++)if(h[l](t,a,u)===!1)return}c=c.parent}if(i){Ot(i,null,10,[t,a,u]);return}}sn(t,n,s,r,o)}function sn(t,e,n,r=!0,s=!1){if(process.env.NODE_ENV!=="production"){const i=Bt[e];if(n&&Qe(n),F(`Unhandled error${i?` during execution of ${i}`:""}`),n&&Xe(),r)throw t;console.error(t)}else{if(s)throw t;console.error(t)}}const y=[];let C=-1;const k=[];let $=null,j=0;const rn=Promise.resolve();let Et=null;const on=100;function cn(t){let e=C+1,n=y.length;for(;e<n;){const r=e+n>>>1,s=y[r],i=q(s);i<t||i===t&&s.flags&2?e=r+1:n=r}return e}function ln(t){if(!(t.flags&1)){const e=q(t),n=y[y.length-1];!n||!(t.flags&2)&&e>=q(n)?y.push(t):y.splice(cn(e),0,t),t.flags|=1,Gt()}}function Gt(){Et||(Et=rn.then(Qt))}function an(t){d(t)?k.push(...t):$&&t.id===-1?$.splice(j+1,0,t):t.flags&1||(k.push(t),t.flags|=1),Gt()}function un(t){if(k.length){const e=[...new Set(k)].sort((n,r)=>q(n)-q(r));if(k.length=0,$){$.push(...e);return}for($=e,process.env.NODE_ENV!=="production"&&(t=t||new Map),j=0;j<$.length;j++){const n=$[j];process.env.NODE_ENV!=="production"&&Xt(t,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}$=null,j=0}}const q=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Qt(t){process.env.NODE_ENV!=="production"&&(t=t||new Map);const e=process.env.NODE_ENV!=="production"?n=>Xt(t,n):It;try{for(C=0;C<y.length;C++){const n=y[C];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&e(n))continue;n.flags&4&&(n.flags&=-2),Ot(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;C<y.length;C++){const n=y[C];n&&(n.flags&=-2)}C=-1,y.length=0,un(t),Et=null,(y.length||k.length)&&Qt(t)}}function Xt(t,e){const n=t.get(e)||0;if(n>on){const r=e.i,s=r&&ce(r.type);return Yt(`Maximum recursive updates exceeded${s?` in component <${s}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return t.set(e,n+1),!1}const wt=new Map;process.env.NODE_ENV!=="production"&&(G().__VUE_HMR_RUNTIME__={createRecord:Nt(fn),rerender:Nt(hn),reload:Nt(pn)});const Z=new Map;function fn(t,e){return Z.has(t)?!1:(Z.set(t,{initialDef:tt(e),instances:new Set}),!0)}function tt(t){return ae(t)?t.__vccOpts:t}function hn(t,e){const n=Z.get(t);n&&(n.initialDef.render=e,[...n.instances].forEach(r=>{e&&(r.render=e,tt(r.type).render=e),r.renderCache=[],r.job.flags&8||r.update()}))}function pn(t,e){const n=Z.get(t);if(!n)return;e=tt(e),Zt(n.initialDef,e);const r=[...n.instances];for(let s=0;s<r.length;s++){const i=r[s],o=tt(i.type);let c=wt.get(o);c||(o!==n.initialDef&&Zt(o,e),wt.set(o,c=new Set)),c.add(i),i.appContext.propsCache.delete(i.type),i.appContext.emitsCache.delete(i.type),i.appContext.optionsCache.delete(i.type),i.ceReload?(c.add(i),i.ceReload(e.styles),c.delete(i)):i.parent?ln(()=>{i.job.flags&8||(i.parent.update(),c.delete(i))}):i.appContext.reload?i.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),i.root.ce&&i!==i.root&&i.root.ce._removeChildStyle(o)}an(()=>{wt.clear()})}function Zt(t,e){V(t,e);for(const n in t)n!=="__file"&&!(n in e)&&delete t[n]}function Nt(t){return(e,n)=>{try{return t(e,n)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let K,et=[];function te(t,e){var n,r;K=t,K?(K.enabled=!0,et.forEach(({event:s,args:i})=>K.emit(s,...i)),et=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{te(i,e)}),setTimeout(()=>{K||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,et=[])},3e3)):et=[]}let nt=null,dn=null;const _n=t=>t.__isTeleport;function ee(t,e){t.shapeFlag&6&&t.component?(t.transition=e,ee(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}G().requestIdleCallback,G().cancelIdleCallback;const gn=Symbol.for("v-ndc"),bn={};process.env.NODE_ENV!=="production"&&(bn.ownKeys=t=>(F("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(t)));const mn={},ne=t=>Object.getPrototypeOf(t)===mn,yn=t=>t.__isSuspense,se=Symbol.for("v-fgt"),Sn=Symbol.for("v-txt"),On=Symbol.for("v-cmt");function En(t){return t?t.__v_isVNode===!0:!1}const wn=(...t)=>ie(...t),re=({key:t})=>t??null,st=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?N(t)||b(t)||A(t)?{i:nt,r:t,k:e,f:!!n}:t:null);function Nn(t,e=null,n=null,r=0,s=null,i=t===se?0:1,o=!1,c=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&re(e),ref:e&&st(e),scopeId:dn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:nt};return c?(vt(a,n),i&128&&t.normalize(a)):n&&(a.shapeFlag|=N(n)?8:16),process.env.NODE_ENV!=="production"&&a.key!==a.key&&F("VNode created with invalid key (NaN). VNode type:",a.type),a}const vn=process.env.NODE_ENV!=="production"?wn:ie;function ie(t,e=null,n=null,r=0,s=null,i=!1){if((!t||t===gn)&&(process.env.NODE_ENV!=="production"&&!t&&F(`Invalid vnode type when creating vnode: ${t}.`),t=On),En(t)){const c=rt(t,e,!0);return n&&vt(c,n),c.patchFlag=-2,c}if(ae(t)&&(t=t.__vccOpts),e){e=Rn(e);let{class:c,style:a}=e;c&&!N(c)&&(e.class=at(c)),g(a)&&(z(a)&&!d(a)&&(a=V({},a)),e.style=lt(a))}const o=N(t)?1:yn(t)?128:_n(t)?64:g(t)?4:A(t)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&z(t)&&(t=f(t),F("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
|
|
5
|
+
Component that was made reactive: `,t)),Nn(t,e,n,r,s,o,i,!0)}function Rn(t){return t?z(t)||ne(t)?V({},t):t:null}function rt(t,e,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:c,transition:a}=t,u=e?An(s||{},e):s,h={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&re(u),ref:e&&e.ref?n&&i?d(i)?i.concat(st(e)):[i,st(e)]:st(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&d(c)?c.map(oe):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==se?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&rt(t.ssContent),ssFallback:t.ssFallback&&rt(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&r&&ee(h,a.clone(h)),h}function oe(t){const e=rt(t);return d(t.children)&&(e.children=t.children.map(oe)),e}function Cn(t=" ",e=0){return vn(Sn,null,t,e)}function vt(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(d(e))n=16;else if(typeof e=="object")if(r&65){const s=e.default;s&&(s._c&&(s._d=!1),vt(t,s()),s._c&&(s._d=!0));return}else n=32,!e._&&!ne(e)&&(e._ctx=nt);else A(e)?(e={default:e,_ctx:nt},n=32):(e=String(e),r&64?(n=16,e=[Cn(e)]):n=8);t.children=e,t.shapeFlag|=n}function An(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const s in r)if(s==="class")e.class!==r.class&&(e.class=at([e.class,r.class]));else if(s==="style")e.style=lt([e.style,r.style]);else if(be(s)){const i=e[s],o=r[s];o&&i!==o&&!(d(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!me(s)&&(e[s]=o)}else s!==""&&(e[s]=r[s])}return e}{const t=G(),e=(n,r)=>{let s;return(s=t[n])||(s=t[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};e("__VUE_INSTANCE_SETTERS__",n=>n),e("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const In=/(?:^|[-_])\w/g,$n=t=>t.replace(In,e=>e.toUpperCase()).replace(/[-_]/g,"");function ce(t,e=!0){return A(t)?t.displayName||t.name:t.name||e&&t.__name}function le(t,e,n=!1){let r=ce(e);if(!r&&e.__file){const s=e.__file.match(/([^/\\]+)\.\w+$/);s&&(r=s[1])}if(!r&&t){const s=i=>{for(const o in i)if(i[o]===e)return o};r=s(t.components)||t.parent&&s(t.parent.type.components)||s(t.appContext.components)}return r?$n(r):n?"App":"Anonymous"}function ae(t){return A(t)&&"__vccOpts"in t}function Vn(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},s={__vue_custom_formatter:!0,header(l){if(!g(l))return null;if(l.__isVue)return["div",t,"VueInstance"];if(b(l)){const p=l.value;return["div",{},["span",t,h(l)],"<",c(p),">"]}else{if(yt(l))return["div",{},["span",t,m(l)?"ShallowReactive":"Reactive"],"<",c(l),`>${E(l)?" (readonly)":""}`];if(E(l))return["div",{},["span",t,m(l)?"ShallowReadonly":"Readonly"],"<",c(l),">"]}return null},hasBody(l){return l&&l.__isVue},body(l){if(l&&l.__isVue)return["div",{},...i(l.$)]}};function i(l){const p=[];l.type.props&&l.props&&p.push(o("props",f(l.props))),l.setupState!==ot&&p.push(o("setup",l.setupState)),l.data!==ot&&p.push(o("data",f(l.data)));const S=a(l,"computed");S&&p.push(o("computed",S));const w=a(l,"inject");return w&&p.push(o("injected",w)),p.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:l}]]),p}function o(l,p){return p=V({},p),Object.keys(p).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},l],["div",{style:"padding-left:1.25em"},...Object.keys(p).map(S=>["div",{},["span",r,S+": "],c(p[S],!1)])]]:["span",{}]}function c(l,p=!0){return typeof l=="number"?["span",e,l]:typeof l=="string"?["span",n,JSON.stringify(l)]:typeof l=="boolean"?["span",r,l]:g(l)?["object",{object:p?f(l):l}]:["span",n,String(l)]}function a(l,p){const S=l.type;if(A(S))return;const w={};for(const J in l.ctx)u(S,J,p)&&(w[J]=l.ctx[J]);return w}function u(l,p,S){const w=l[S];if(d(w)&&w.includes(p)||g(w)&&p in w||l.extends&&u(l.extends,p,S)||l.mixins&&l.mixins.some(J=>u(J,p,S)))return!0}function h(l){return m(l)?"ShallowRef":l.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(s):window.devtoolsFormatters=[s]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Dn(){Vn()}process.env.NODE_ENV!=="production"&&Dn();function Tn(t,e,n){const r=n?{storeOptions:n}:{};return typeof e=="function"?xn(t,e,r):Pn(t,e,r)}function xn(t,e,n){return x.defineStore(t,e,n)}function Pn(t,e,n){return n&&(e={...e,...n??{}}),x.defineStore(t,e)}const Mn=new Set(["_","$"]);function Fn(t){return Mn.has(t[0])}class kn extends Rt{_onAction;_options;_store;_subscriptions={};_storeSubscribe;static _requiredKeys;get onAction(){if(this._onAction)return()=>({store:this.store,callback:this._onAction})}set onAction(e){this._onAction=e}get options(){return this._options}get state(){return this._store.$state}set state(e){this._store.$state=e}get store(){return this._store}get storeSubscribe(){if(this._storeSubscribe)return()=>({store:this.store,callback:this._storeSubscribe})}set storeSubscribe(e){this._storeSubscribe=e}constructor(e,n,r=!1,s){super(r,s),this._options=n.storeOptions,this._store=e}addToState(e,n){this.isOptionApi()||n?.value||(n=qt(n)),this.state[e]=n,this.store[e]=Ye(this.state,e)}addSubscription(e,n,r){this._subscriptions[e]={subscription:n,...r??{}}}static customizeStore(e,n,r=!1,s){if(n.storeOptions&&this.hasRequiredKeys(n.storeOptions))return new this(e,n,r,s)}hasDeniedFirstChar(e){return Fn(e[0])}static hasRequiredKeys(e){return this._requiredKeys!==void 0&&this._requiredKeys?.every(n=>!!e[n])}getOption(e){return this.options&&this.options[e]}getStatePropertyValue(e){return this.getValue(this.state[e])}getSubscriptions(){if(!B(this._subscriptions))return this._subscriptions}getValue(e){return e?.__v_isRef?e.value:e}isOptionApi(){return this.store._isOptionsAPI}stateHas(e){return this.state.hasOwnProperty(e)}storeHas(e){return this.store.hasOwnProperty(e)}}function jn(t,e){const n=new At(t,e);return n.plugin.bind(n)}_.CustomConsole=Ct,_.PLUGIN_NAME=it,_.PluginSubscriber=ue,_.PluginSubscription=At,_.Store=kn,_.createPlugin=jn,_.defineAStore=Tn,_.isEmpty=B,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import type { PiniaPlugin, PiniaPluginContext, Store as PiniaStore, StateTree } from "pinia"
|
|
1
|
+
import type { PiniaPlugin, PiniaPluginContext, Store as PiniaStore, StateTree, StoreDefinition } from "pinia"
|
|
2
2
|
import type { Console } from "./log"
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type {
|
|
4
|
+
PluginSubscriber as PluginSubscriberInterface,
|
|
5
|
+
PluginSubscriptions,
|
|
6
|
+
StoreOnActionSubscription,
|
|
7
|
+
StoreOnActionSubscriptionCallback,
|
|
8
|
+
StoreMutationSubscription,
|
|
9
|
+
StoreMutationSubscriptionCallback
|
|
10
|
+
} from "./plugin"
|
|
11
|
+
import type { StatePropertyValue, StoreOptions, StoreOptionsPropertyValue } from "./store"
|
|
5
12
|
|
|
6
13
|
|
|
7
14
|
declare module 'pinia-plugin-subscription' {
|
|
8
|
-
export
|
|
15
|
+
export const PLUGIN_NAME: string;
|
|
9
16
|
|
|
10
|
-
export function
|
|
17
|
+
export function createPlugin(subscribers: PluginSubscriberInterface[], debug?: string[]): PiniaPlugin;
|
|
18
|
+
|
|
19
|
+
export function defineAStore<TStore, TState>(id: string, storeDefinition: () => AnyObject, storeOptions?: StoreOptions): StoreDefinition & TState & TStore
|
|
11
20
|
|
|
12
21
|
export function isEmpty(value: any): boolean
|
|
13
22
|
|
|
14
23
|
export default abstract class Debug {
|
|
15
|
-
protected abstract _className: string
|
|
16
24
|
public console: Console
|
|
17
25
|
public debug: boolean
|
|
18
26
|
|
|
@@ -34,43 +42,48 @@ declare module 'pinia-plugin-subscription' {
|
|
|
34
42
|
protected abstract _pluginName: string
|
|
35
43
|
|
|
36
44
|
log(...args: any): void
|
|
37
|
-
|
|
45
|
+
error(...args: any): void
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
export abstract class PluginSubscriber<Instance extends Store> implements PluginSubscriberInterface {
|
|
41
|
-
public console:
|
|
49
|
+
public console: Console
|
|
42
50
|
public name: string
|
|
43
51
|
public pluginOptions: AnyObject
|
|
44
52
|
public resetStoreCallback: ((store?: PiniaStore) => void) | undefined
|
|
45
53
|
public storeOnActionSubscription: StoreOnActionSubscription | undefined
|
|
46
54
|
public storeMutationSubscription: StoreMutationSubscription | undefined
|
|
47
|
-
protected pluginCreated?: (store: PiniaStore) => void
|
|
48
55
|
public subscriptions: PluginSubscriptions | undefined
|
|
56
|
+
protected pluginCreated?: (store: PiniaStore) => void
|
|
57
|
+
protected _resetStoreCallback?: (store?: PiniaStore) => void
|
|
49
58
|
|
|
50
59
|
constructor(
|
|
51
60
|
pluginName: string,
|
|
52
|
-
createInstanceFunction: (store: PiniaStore, options: AnyObject, debug?:
|
|
61
|
+
createInstanceFunction: (store: PiniaStore, options: AnyObject, debug: boolean, pluginConsole?: Console) => Instance | undefined,
|
|
53
62
|
pluginConsole?: CustomConsole
|
|
54
63
|
)
|
|
55
64
|
|
|
56
|
-
public invoke(context: PiniaPluginContext, debug
|
|
65
|
+
public invoke(context: PiniaPluginContext, debug: boolean): boolean
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
export class Store extends Debug {
|
|
60
|
-
constructor(store: PiniaStore, options: AnyObject, debug: boolean)
|
|
69
|
+
constructor(store: PiniaStore, options: AnyObject, debug: boolean, customConsole?: Console)
|
|
61
70
|
|
|
62
|
-
protected _className: string
|
|
63
71
|
protected static _requiredKeys?: string[]
|
|
64
72
|
public debug: boolean
|
|
65
|
-
public onAction: StoreOnActionSubscription | undefined
|
|
73
|
+
public onAction: StoreOnActionSubscription | StoreOnActionSubscriptionCallback | undefined
|
|
66
74
|
public readonly options: StoreOptions
|
|
75
|
+
public resetCallback: (() => void) | undefined
|
|
67
76
|
public state: StateTree
|
|
68
|
-
public storeSubscribe:
|
|
77
|
+
public storeSubscribe: StoreMutationSubscriptionCallback | undefined
|
|
69
78
|
public readonly store: AnyObject
|
|
70
79
|
|
|
71
80
|
addPropertiesToState(properties: string[], values?: AnyObject): void
|
|
72
81
|
|
|
73
|
-
addSubscription(
|
|
82
|
+
addSubscription(
|
|
83
|
+
pluginName: string,
|
|
84
|
+
subscription: PluginSubscriberInterface,
|
|
85
|
+
options?: { subscriptionOptions?: StoreOptions, stores?: PiniaStore[] }
|
|
86
|
+
): void
|
|
74
87
|
|
|
75
88
|
addToState(name: string, value?: StatePropertyValue): void
|
|
76
89
|
|
|
@@ -93,6 +106,8 @@ declare module 'pinia-plugin-subscription' {
|
|
|
93
106
|
|
|
94
107
|
getValue(value: any): any
|
|
95
108
|
|
|
109
|
+
protected static hasRequiredKeys(options: AnyObject): boolean
|
|
110
|
+
|
|
96
111
|
isOptionApi(): boolean
|
|
97
112
|
|
|
98
113
|
stateHas(property: string): boolean
|
|
@@ -101,6 +116,14 @@ declare module 'pinia-plugin-subscription' {
|
|
|
101
116
|
}
|
|
102
117
|
}
|
|
103
118
|
|
|
119
|
+
|
|
120
|
+
declare module 'pinia' {
|
|
121
|
+
export interface DefineStoreOptionsBase<S, Store> {
|
|
122
|
+
storeOptions?: StoreOptions
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
104
127
|
export interface AnyObject {
|
|
105
128
|
[key: number | string | symbol]: any;
|
|
106
129
|
}
|
|
@@ -108,5 +131,5 @@ export interface SearchCollectionCriteria {
|
|
|
108
131
|
[key: number | string | symbol]: boolean | number | string;
|
|
109
132
|
}
|
|
110
133
|
export { Console, LogType, StyleDefinition as ConsoleStyleDefinition, StyleDefinitionKeys as ConsoleStyleDefinitionKeys, StyleDefinitions as ConsoleStyleDefinitions } from './log';
|
|
111
|
-
export type { CustomStore,
|
|
112
|
-
export type { PluginSubscriber as PluginSubscriberInterface } from "./plugin";
|
|
134
|
+
export type { CustomStore, PluginStoreOptions, StatePropertyValue, StoreOptions, StoreOptionsPropertyValue } from "./store";
|
|
135
|
+
export type { PluginSubscriber as PluginSubscriberInterface, StoreMutationSubscriptionCallback, StoreOnActionCallbackParameters } from "./plugin";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { List } from "../models/liste";
|
|
2
|
+
export type PartialList = Omit<List, '@id' | 'id' | 'name' | 'type'> & {
|
|
3
|
+
id?: number;
|
|
4
|
+
name?: string;
|
|
5
|
+
type?: ListTypes;
|
|
6
|
+
};
|
|
7
|
+
export type ListTypes = "0" | "1" | "2" | "3" | "4" | "5";
|
|
8
|
+
export type ListTypesMap = Record<ListTypes, string>;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import type { PiniaPluginContext, StateTree, Store, SubscriptionCallbackMutation } from "pinia";
|
|
2
2
|
import { StoreOptions } from "./store";
|
|
3
|
-
import { PluginSubscriberInterface } from ".";
|
|
3
|
+
import { Console, PluginSubscriberInterface } from ".";
|
|
4
4
|
export interface PluginSubscriber {
|
|
5
|
-
|
|
5
|
+
console?: Console;
|
|
6
|
+
invoke: (context: PiniaPluginContext, debug: boolean) => boolean;
|
|
6
7
|
name: string;
|
|
7
8
|
resetStoreCallback?: (store?: Store) => void;
|
|
8
9
|
storeOnActionSubscription?: StoreOnActionSubscription;
|
|
9
10
|
storeMutationSubscription?: StoreMutationSubscription;
|
|
10
|
-
subscriptions
|
|
11
|
+
subscriptions?: PluginSubscriptions;
|
|
11
12
|
}
|
|
12
13
|
export interface NativePiniaSubscriptionReturn<Callback> {
|
|
13
14
|
store: Store;
|
|
14
15
|
callback: Callback;
|
|
15
16
|
}
|
|
16
|
-
export interface
|
|
17
|
+
export interface StoreOnActionCallbackParameters {
|
|
17
18
|
after: Function;
|
|
18
19
|
args: any[] | object;
|
|
19
20
|
name: string;
|
|
20
21
|
}
|
|
21
22
|
export interface PluginSubscription {
|
|
23
|
+
stores?: Store[];
|
|
22
24
|
subscription: PluginSubscriberInterface;
|
|
23
25
|
subscriptionOptions?: StoreOptions;
|
|
24
26
|
}
|
|
25
27
|
export type PluginSubscriptions = Record<string, PluginSubscription>;
|
|
26
28
|
export type NativePiniaSubscription<Callback> = () => NativePiniaSubscriptionReturn<Callback>;
|
|
27
|
-
export type StoreOnActionSubscriptionCallback = (params:
|
|
29
|
+
export type StoreOnActionSubscriptionCallback = (params: StoreOnActionCallbackParameters) => void;
|
|
28
30
|
export type StoreOnActionSubscriptionReturn = NativePiniaSubscriptionReturn<StoreOnActionSubscriptionCallback>;
|
|
29
31
|
export type StoreOnActionSubscription = NativePiniaSubscription<StoreOnActionSubscriptionCallback>;
|
|
30
32
|
export type StoreMutationSubscriptionCallback = (mutation: SubscriptionCallbackMutation<StateTree>) => void;
|
package/dist/types/store.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnyObject } from ".";
|
|
2
2
|
import type { PiniaCustomProperties, Store, StoreDefinition } from "pinia";
|
|
3
3
|
import type { Ref } from "vue";
|
|
4
|
-
export type CustomStore<TStore, TState> = Store &
|
|
4
|
+
export type CustomStore<TStore, TState> = Store & TStore & TState & PiniaCustomProperties & StoreDefinition;
|
|
5
5
|
export type DefineAugmentedStore<TStore, TState> = (args?: any) => CustomStore<TStore, TState>;
|
|
6
6
|
export type ObjectBaseProperty = Record<string, OptionBaseProperty | OptionBaseProperty[]>;
|
|
7
7
|
export type OptionBaseProperty = string | number | boolean | null | undefined | object | Function;
|