@yakocloud/state-vocab 3.0.9 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/state-vocab.cjs.js +8 -3
- package/dist/state-vocab.es.js +394 -175
- package/dist/types/context.d.ts +4 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/store.d.ts +2 -3
- package/package.json +1 -1
package/dist/state-vocab.cjs.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`),
|
|
3
|
-
`),...
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),se=Symbol("state-def"),D=Symbol("state-path"),U=Symbol("state-verbose"),q=Symbol("state-verbose-path"),G=Symbol("state-ssr");function ee(t,c,n){if(!c)return t;const m=c.split(".");let s=t;for(const u of m)if(s!==null&&typeof s=="object"&&u in s)s=s[u];else return n;return s===void 0?n:s}function fe(t,c=0){let n;return function(...m){n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,t.apply(this,m)},c)}}function de(t,c,n=[]){return p.useMemo(()=>fe(t,c),n)}function te(t){const c=JSON.stringify(t,null,2).split(`
|
|
2
|
+
`),n=[],m=[];for(const s of c){const u=s.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);if(u){const[,b,o,g,y]=u;n.push(`${b}%c"${o}"%c${g}%c${y}`),m.push("color: #9cdcfe; font-weight: bold","color: #cccccc","color: #ce9178")}else n.push(`%c${s}`),m.push("color: #cccccc")}console.log(n.join(`
|
|
3
|
+
`),...m,t)}const me=t=>typeof t=="function",be=t=>typeof t=="function",C=t=>typeof t<"u",J=t=>be(t)?t():t;var Y={exports:{}},I={};var re;function Ee(){if(re)return I;re=1;var t=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function n(m,s,u){var b=null;if(u!==void 0&&(b=""+u),s.key!==void 0&&(b=""+s.key),"key"in s){u={};for(var o in s)o!=="key"&&(u[o]=s[o])}else u=s;return s=u.ref,{$$typeof:t,type:m,key:b,ref:s!==void 0?s:null,props:u}}return I.Fragment=c,I.jsx=n,I.jsxs=n,I}var $={};var ne;function ve(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case A:return"Profiler";case x:return"StrictMode";case F:return"Suspense";case a:return"SuspenseList";case w:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case _:return"Portal";case h:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case N:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function c(e){return""+e}function n(e){try{c(e);var r=!1}catch{r=!0}if(r){r=console;var l=r.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),c(e)}}function m(e){if(e===T)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function s(){var e=M.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function b(e){if(B.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function o(e,r){function l(){X||(X=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function g(){var e=t(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function y(e,r,l,f,V,L){var d=l.ref;return e={$$typeof:v,type:e,key:r,props:l,_owner:f},(d!==void 0?d:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:g}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:L}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function P(e,r,l,f,V,L){var d=r.children;if(d!==void 0)if(f)if(le(d)){for(f=0;f<d.length;f++)i(d[f]);Object.freeze&&Object.freeze(d)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else i(d);if(B.call(r,"key")){d=t(e);var j=Object.keys(r).filter(function(ie){return ie!=="key"});f=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",K[d+f]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
4
|
+
let props = %s;
|
|
5
|
+
<%s {...props} />
|
|
6
|
+
React keys must be passed directly to JSX without using spread:
|
|
7
|
+
let props = %s;
|
|
8
|
+
<%s key={someKey} {...props} />`,f,d,j,d),K[d+f]=!0)}if(d=null,l!==void 0&&(n(l),d=""+l),b(r)&&(n(r.key),d=""+r.key),"key"in r){l={};for(var W in r)W!=="key"&&(l[W]=r[W])}else l=r;return d&&o(l,typeof e=="function"?e.displayName||e.name||"Unknown":e),y(e,d,l,s(),V,L)}function i(e){E(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?E(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function E(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}var S=p,v=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),h=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),a=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),M=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,le=Array.isArray,z=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(e){return e()}};var X,H={},Z=S.react_stack_bottom_frame.bind(S,u)(),Q=z(m(u)),K={};$.Fragment=T,$.jsx=function(e,r,l){var f=1e4>M.recentlyCreatedOwnerStacks++;return P(e,r,l,!1,f?Error("react-stack-top-frame"):Z,f?z(m(e)):Q)},$.jsxs=function(e,r,l){var f=1e4>M.recentlyCreatedOwnerStacks++;return P(e,r,l,!0,f?Error("react-stack-top-frame"):Z,f?z(m(e)):Q)}})()),$}var oe;function _e(){return oe||(oe=1,process.env.NODE_ENV==="production"?Y.exports=Ee():Y.exports=ve()),Y.exports}_e();const pe=p.createContext({});function Se(){return p.useContext(pe)}const ae=typeof window>"u",Te=ae?p.useEffect:p.useLayoutEffect;function Re(t={}){return{[se]:!0,[D]:"",[U]:!1,[q]:"",[G]:!1,useState(c){const n=ae?void 0:J(t.storage),m=J(t.defaultValue),s=t.bidirectional;c??={};const u=J(c.defaultValue)??m,b=c.bidirectional??s,o=this[D],g=this[U],y=this[q],P=this[G],i=Se(),E=t.serialize??JSON.stringify,S=t.deserialize??JSON.parse,v=(a,R,O)=>{const w=R.getItem(a);w===null?C(O)&&R.setItem(a,E(O)):i.set(a,S(w))},_=de(c.onSet??(()=>{}),c.delayedSet,[]),T=p.useRef(void 0),x=p.useRef(!1);if(!x.current){x.current=!0;let a=i.get(o);C(a)||(a=u,C(a)&&i.set(o,a)),!P&&n&&v(o,n,a)}const A=p.useSyncExternalStore(i.subscribe.bind(i),i.getClientSnapshot.bind(i),i.getServerSnapshot.bind(i));if(g)if(y){const a=ee(A,y);a&&te(a)}else te(A);const k=ee(A,o,u);T.current=k,Te(()=>{!P||!n||v(o,n,k)},[]);const h=p.useEffectEvent(a=>{if(a.key!==o)return;const R=a.newValue,w=(R===null?null:S(R))??u;C(w)&&(i.set(o,w),_(w,T.current))});p.useEffect(()=>{if(b)return window.addEventListener("storage",h),()=>window.removeEventListener("storage",h)},[b]);const N=p.useCallback(a=>{const R=me(a)?a(T.current):a;i.set(o,R),_(R,T.current),n&&n.setItem(o,E(R))},[o,n,_]),F=p.useCallback(()=>{const a=u;if(!C(a)){n?.removeItem(o);return}i.set(o,a),_(a,T.current),n&&n.setItem(o,E(a))},[o,u,n,_]);return[k,N,F]},toString(){return this[D]}}}function ce(t,c){const{path:n="",verbose:m,verbosePath:s,ssr:u,cache:b}=c;let o=b.proxy.get(t);o||(o=new Map,b.proxy.set(t,o));const g=o.get(n);if(g)return g;const y=new Proxy(t,{get(P,i){const E=P[i],S=n?`${n}.${String(i)}`:String(i);if(E&&typeof E=="object"&&se in E){const v=E;let _=b.leaf.get(v);_||(_=new Map,b.leaf.set(v,_));const T=_.get(S);if(T)return T;const x=Reflect.ownKeys(v).filter(h=>typeof v[h]=="function"),A=Object.fromEntries(x.map(h=>[h,(...N)=>v[h].call({...v,[D]:S,[U]:m,[q]:s,[G]:u},...N)])),k={...v,...A};return _.set(S,k),k}return E&&typeof E=="object"?ce(E,{...c,path:S}):E}});return o.set(n,y),y}function ye(t,c){return ce(t,{...c,verbosePath:c?.verbosePath??"",cache:{proxy:new WeakMap,leaf:new WeakMap}})}exports.defineState=Re;exports.setupStorage=ye;
|
package/dist/state-vocab.es.js
CHANGED
|
@@ -1,227 +1,447 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import me, { useMemo as Ee, createContext as be, useContext as ve, useRef as K, useSyncExternalStore as _e, useEffect as se, useLayoutEffect as pe, useEffectEvent as Se, useCallback as ee } from "react";
|
|
2
|
+
const ce = Symbol("state-def"), Y = Symbol("state-path"), J = Symbol("state-verbose"), U = Symbol("state-verbose-path"), q = Symbol("state-ssr");
|
|
3
|
+
function te(t, c, n) {
|
|
4
|
+
if (!c)
|
|
5
|
+
return t;
|
|
6
|
+
const m = c.split(".");
|
|
7
|
+
let a = t;
|
|
8
|
+
for (const l of m)
|
|
9
|
+
if (a !== null && typeof a == "object" && l in a)
|
|
10
|
+
a = a[l];
|
|
10
11
|
else
|
|
11
|
-
return
|
|
12
|
-
return
|
|
12
|
+
return n;
|
|
13
|
+
return a === void 0 ? n : a;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return o[i[i.length - 1]] = t, e;
|
|
22
|
-
}
|
|
23
|
-
function X(e, n = 0) {
|
|
24
|
-
let t;
|
|
25
|
-
return function(...i) {
|
|
26
|
-
t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
27
|
-
t = void 0, e.apply(this, i);
|
|
28
|
-
}, n);
|
|
15
|
+
function Te(t, c = 0) {
|
|
16
|
+
let n;
|
|
17
|
+
return function(...m) {
|
|
18
|
+
n !== void 0 && clearTimeout(n), n = setTimeout(() => {
|
|
19
|
+
n = void 0, t.apply(this, m);
|
|
20
|
+
}, c);
|
|
29
21
|
};
|
|
30
22
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
33
|
-
() =>
|
|
23
|
+
function Re(t, c, n = []) {
|
|
24
|
+
return Ee(
|
|
25
|
+
() => Te(t, c),
|
|
34
26
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
|
|
27
|
+
n
|
|
36
28
|
);
|
|
37
29
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
`),
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const [,
|
|
45
|
-
|
|
30
|
+
function re(t) {
|
|
31
|
+
const c = JSON.stringify(t, null, 2).split(`
|
|
32
|
+
`), n = [], m = [];
|
|
33
|
+
for (const a of c) {
|
|
34
|
+
const l = a.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);
|
|
35
|
+
if (l) {
|
|
36
|
+
const [, E, o, h, R] = l;
|
|
37
|
+
n.push(`${E}%c"${o}"%c${h}%c${R}`), m.push(
|
|
46
38
|
"color: #9cdcfe; font-weight: bold",
|
|
47
39
|
"color: #cccccc",
|
|
48
40
|
"color: #ce9178"
|
|
49
41
|
);
|
|
50
42
|
} else
|
|
51
|
-
|
|
43
|
+
n.push(`%c${a}`), m.push("color: #cccccc");
|
|
52
44
|
}
|
|
53
|
-
console.log(
|
|
54
|
-
`), ...
|
|
45
|
+
console.log(n.join(`
|
|
46
|
+
`), ...m, t);
|
|
55
47
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
U(c, n, o), this.#e = c, this.#t.forEach((a) => a());
|
|
48
|
+
const ye = (t) => typeof t == "function", he = (t) => typeof t == "function", N = (t) => typeof t < "u", W = (t) => he(t) ? t() : t;
|
|
49
|
+
var V = { exports: {} }, C = {};
|
|
50
|
+
var ne;
|
|
51
|
+
function ge() {
|
|
52
|
+
if (ne) return C;
|
|
53
|
+
ne = 1;
|
|
54
|
+
var t = Symbol.for("react.transitional.element"), c = Symbol.for("react.fragment");
|
|
55
|
+
function n(m, a, l) {
|
|
56
|
+
var E = null;
|
|
57
|
+
if (l !== void 0 && (E = "" + l), a.key !== void 0 && (E = "" + a.key), "key" in a) {
|
|
58
|
+
l = {};
|
|
59
|
+
for (var o in a)
|
|
60
|
+
o !== "key" && (l[o] = a[o]);
|
|
61
|
+
} else l = a;
|
|
62
|
+
return a = l.ref, {
|
|
63
|
+
$$typeof: t,
|
|
64
|
+
type: m,
|
|
65
|
+
key: E,
|
|
66
|
+
ref: a !== void 0 ? a : null,
|
|
67
|
+
props: l
|
|
68
|
+
};
|
|
78
69
|
}
|
|
70
|
+
return C.Fragment = c, C.jsx = n, C.jsxs = n, C;
|
|
79
71
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
72
|
+
var I = {};
|
|
73
|
+
var oe;
|
|
74
|
+
function ke() {
|
|
75
|
+
return oe || (oe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
76
|
+
function t(e) {
|
|
77
|
+
if (e == null) return null;
|
|
78
|
+
if (typeof e == "function")
|
|
79
|
+
return e.$$typeof === ie ? null : e.displayName || e.name || null;
|
|
80
|
+
if (typeof e == "string") return e;
|
|
81
|
+
switch (e) {
|
|
82
|
+
case S:
|
|
83
|
+
return "Fragment";
|
|
84
|
+
case A:
|
|
85
|
+
return "Profiler";
|
|
86
|
+
case O:
|
|
87
|
+
return "StrictMode";
|
|
88
|
+
case D:
|
|
89
|
+
return "Suspense";
|
|
90
|
+
case s:
|
|
91
|
+
return "SuspenseList";
|
|
92
|
+
case k:
|
|
93
|
+
return "Activity";
|
|
94
|
+
}
|
|
95
|
+
if (typeof e == "object")
|
|
96
|
+
switch (typeof e.tag == "number" && console.error(
|
|
97
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
98
|
+
), e.$$typeof) {
|
|
99
|
+
case _:
|
|
100
|
+
return "Portal";
|
|
101
|
+
case y:
|
|
102
|
+
return e.displayName || "Context";
|
|
103
|
+
case g:
|
|
104
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
105
|
+
case j:
|
|
106
|
+
var r = e.render;
|
|
107
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
108
|
+
case T:
|
|
109
|
+
return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
|
|
110
|
+
case P:
|
|
111
|
+
r = e._payload, e = e._init;
|
|
112
|
+
try {
|
|
113
|
+
return t(e(r));
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function c(e) {
|
|
120
|
+
return "" + e;
|
|
121
|
+
}
|
|
122
|
+
function n(e) {
|
|
123
|
+
try {
|
|
124
|
+
c(e);
|
|
125
|
+
var r = !1;
|
|
126
|
+
} catch {
|
|
127
|
+
r = !0;
|
|
128
|
+
}
|
|
129
|
+
if (r) {
|
|
130
|
+
r = console;
|
|
131
|
+
var u = r.error, f = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
132
|
+
return u.call(
|
|
133
|
+
r,
|
|
134
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
135
|
+
f
|
|
136
|
+
), c(e);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function m(e) {
|
|
140
|
+
if (e === S) return "<>";
|
|
141
|
+
if (typeof e == "object" && e !== null && e.$$typeof === P)
|
|
142
|
+
return "<...>";
|
|
143
|
+
try {
|
|
144
|
+
var r = t(e);
|
|
145
|
+
return r ? "<" + r + ">" : "<...>";
|
|
146
|
+
} catch {
|
|
147
|
+
return "<...>";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function a() {
|
|
151
|
+
var e = F.A;
|
|
152
|
+
return e === null ? null : e.getOwner();
|
|
153
|
+
}
|
|
154
|
+
function l() {
|
|
155
|
+
return Error("react-stack-top-frame");
|
|
156
|
+
}
|
|
157
|
+
function E(e) {
|
|
158
|
+
if (G.call(e, "key")) {
|
|
159
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
160
|
+
if (r && r.isReactWarning) return !1;
|
|
161
|
+
}
|
|
162
|
+
return e.key !== void 0;
|
|
163
|
+
}
|
|
164
|
+
function o(e, r) {
|
|
165
|
+
function u() {
|
|
166
|
+
B || (B = !0, console.error(
|
|
167
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
168
|
+
r
|
|
169
|
+
));
|
|
170
|
+
}
|
|
171
|
+
u.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
172
|
+
get: u,
|
|
173
|
+
configurable: !0
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function h() {
|
|
177
|
+
var e = t(this.type);
|
|
178
|
+
return X[e] || (X[e] = !0, console.error(
|
|
179
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
180
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
181
|
+
}
|
|
182
|
+
function R(e, r, u, f, $, L) {
|
|
183
|
+
var d = u.ref;
|
|
184
|
+
return e = {
|
|
185
|
+
$$typeof: v,
|
|
186
|
+
type: e,
|
|
187
|
+
key: r,
|
|
188
|
+
props: u,
|
|
189
|
+
_owner: f
|
|
190
|
+
}, (d !== void 0 ? d : null) !== null ? Object.defineProperty(e, "ref", {
|
|
191
|
+
enumerable: !1,
|
|
192
|
+
get: h
|
|
193
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
194
|
+
configurable: !1,
|
|
195
|
+
enumerable: !1,
|
|
196
|
+
writable: !0,
|
|
197
|
+
value: 0
|
|
198
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
199
|
+
configurable: !1,
|
|
200
|
+
enumerable: !1,
|
|
201
|
+
writable: !0,
|
|
202
|
+
value: null
|
|
203
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
204
|
+
configurable: !1,
|
|
205
|
+
enumerable: !1,
|
|
206
|
+
writable: !0,
|
|
207
|
+
value: $
|
|
208
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
209
|
+
configurable: !1,
|
|
210
|
+
enumerable: !1,
|
|
211
|
+
writable: !0,
|
|
212
|
+
value: L
|
|
213
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
214
|
+
}
|
|
215
|
+
function w(e, r, u, f, $, L) {
|
|
216
|
+
var d = r.children;
|
|
217
|
+
if (d !== void 0)
|
|
218
|
+
if (f)
|
|
219
|
+
if (fe(d)) {
|
|
220
|
+
for (f = 0; f < d.length; f++)
|
|
221
|
+
i(d[f]);
|
|
222
|
+
Object.freeze && Object.freeze(d);
|
|
223
|
+
} else
|
|
224
|
+
console.error(
|
|
225
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
226
|
+
);
|
|
227
|
+
else i(d);
|
|
228
|
+
if (G.call(r, "key")) {
|
|
229
|
+
d = t(e);
|
|
230
|
+
var x = Object.keys(r).filter(function(de) {
|
|
231
|
+
return de !== "key";
|
|
232
|
+
});
|
|
233
|
+
f = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", Q[d + f] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
234
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
235
|
+
let props = %s;
|
|
236
|
+
<%s {...props} />
|
|
237
|
+
React keys must be passed directly to JSX without using spread:
|
|
238
|
+
let props = %s;
|
|
239
|
+
<%s key={someKey} {...props} />`,
|
|
240
|
+
f,
|
|
241
|
+
d,
|
|
242
|
+
x,
|
|
243
|
+
d
|
|
244
|
+
), Q[d + f] = !0);
|
|
245
|
+
}
|
|
246
|
+
if (d = null, u !== void 0 && (n(u), d = "" + u), E(r) && (n(r.key), d = "" + r.key), "key" in r) {
|
|
247
|
+
u = {};
|
|
248
|
+
for (var M in r)
|
|
249
|
+
M !== "key" && (u[M] = r[M]);
|
|
250
|
+
} else u = r;
|
|
251
|
+
return d && o(
|
|
252
|
+
u,
|
|
253
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
254
|
+
), R(
|
|
255
|
+
e,
|
|
256
|
+
d,
|
|
257
|
+
u,
|
|
258
|
+
a(),
|
|
259
|
+
$,
|
|
260
|
+
L
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
function i(e) {
|
|
264
|
+
b(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === P && (e._payload.status === "fulfilled" ? b(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
265
|
+
}
|
|
266
|
+
function b(e) {
|
|
267
|
+
return typeof e == "object" && e !== null && e.$$typeof === v;
|
|
268
|
+
}
|
|
269
|
+
var p = me, v = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), g = Symbol.for("react.consumer"), y = Symbol.for("react.context"), j = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), s = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), k = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), F = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, fe = Array.isArray, z = console.createTask ? console.createTask : function() {
|
|
270
|
+
return null;
|
|
271
|
+
};
|
|
272
|
+
p = {
|
|
273
|
+
react_stack_bottom_frame: function(e) {
|
|
274
|
+
return e();
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
var B, X = {}, H = p.react_stack_bottom_frame.bind(
|
|
278
|
+
p,
|
|
279
|
+
l
|
|
280
|
+
)(), Z = z(m(l)), Q = {};
|
|
281
|
+
I.Fragment = S, I.jsx = function(e, r, u) {
|
|
282
|
+
var f = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
283
|
+
return w(
|
|
284
|
+
e,
|
|
285
|
+
r,
|
|
286
|
+
u,
|
|
287
|
+
!1,
|
|
288
|
+
f ? Error("react-stack-top-frame") : H,
|
|
289
|
+
f ? z(m(e)) : Z
|
|
290
|
+
);
|
|
291
|
+
}, I.jsxs = function(e, r, u) {
|
|
292
|
+
var f = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
293
|
+
return w(
|
|
294
|
+
e,
|
|
295
|
+
r,
|
|
296
|
+
u,
|
|
297
|
+
!0,
|
|
298
|
+
f ? Error("react-stack-top-frame") : H,
|
|
299
|
+
f ? z(m(e)) : Z
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
})()), I;
|
|
303
|
+
}
|
|
304
|
+
var ae;
|
|
305
|
+
function we() {
|
|
306
|
+
return ae || (ae = 1, process.env.NODE_ENV === "production" ? V.exports = ge() : V.exports = ke()), V.exports;
|
|
307
|
+
}
|
|
308
|
+
we();
|
|
309
|
+
const Ae = be({});
|
|
310
|
+
function Pe() {
|
|
311
|
+
return ve(Ae);
|
|
92
312
|
}
|
|
93
|
-
const
|
|
94
|
-
function
|
|
313
|
+
const le = typeof window > "u", Oe = le ? se : pe;
|
|
314
|
+
function je(t = {}) {
|
|
95
315
|
return {
|
|
96
|
-
[
|
|
316
|
+
[ce]: !0,
|
|
97
317
|
// marks this object as a leaf in the router tree
|
|
98
|
-
[
|
|
318
|
+
[Y]: "",
|
|
99
319
|
// placeholder; injected at runtime by injectPaths()
|
|
100
|
-
[
|
|
320
|
+
[J]: !1,
|
|
101
321
|
// placeholder
|
|
102
|
-
[
|
|
322
|
+
[U]: "",
|
|
103
323
|
// placeholder
|
|
104
|
-
[
|
|
324
|
+
[q]: !1,
|
|
105
325
|
// placeholder
|
|
106
|
-
useState(
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
|
|
326
|
+
useState(c) {
|
|
327
|
+
const n = le ? void 0 : W(t.storage), m = W(t.defaultValue), a = t.bidirectional;
|
|
328
|
+
c ??= {};
|
|
329
|
+
const l = W(c.defaultValue) ?? m, E = c.bidirectional ?? a, o = this[Y], h = this[J], R = this[U], w = this[q], i = Pe(), b = t.serialize ?? JSON.stringify, p = t.deserialize ?? JSON.parse, v = (s, T, P) => {
|
|
330
|
+
const k = T.getItem(s);
|
|
331
|
+
k === null ? N(P) && T.setItem(s, b(P)) : i.set(s, p(k));
|
|
332
|
+
}, _ = Re(
|
|
333
|
+
c.onSet ?? (() => {
|
|
114
334
|
}),
|
|
115
|
-
|
|
335
|
+
c.delayedSet,
|
|
116
336
|
[]
|
|
117
|
-
), S =
|
|
118
|
-
if (!
|
|
119
|
-
|
|
120
|
-
let
|
|
121
|
-
|
|
337
|
+
), S = K(void 0), O = K(!1);
|
|
338
|
+
if (!O.current) {
|
|
339
|
+
O.current = !0;
|
|
340
|
+
let s = i.get(o);
|
|
341
|
+
N(s) || (s = l, N(s) && i.set(o, s)), !w && n && v(o, n, s);
|
|
122
342
|
}
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
343
|
+
const A = _e(
|
|
344
|
+
i.subscribe.bind(i),
|
|
345
|
+
i.getClientSnapshot.bind(i),
|
|
346
|
+
i.getServerSnapshot.bind(i)
|
|
127
347
|
);
|
|
128
|
-
if (
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
348
|
+
if (h)
|
|
349
|
+
if (R) {
|
|
350
|
+
const s = te(A, R);
|
|
351
|
+
s && re(s);
|
|
132
352
|
} else
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
S.current =
|
|
136
|
-
!
|
|
353
|
+
re(A);
|
|
354
|
+
const g = te(A, o, l);
|
|
355
|
+
S.current = g, Oe(() => {
|
|
356
|
+
!w || !n || v(o, n, g);
|
|
137
357
|
}, []);
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
358
|
+
const y = Se((s) => {
|
|
359
|
+
if (s.key !== o)
|
|
140
360
|
return;
|
|
141
|
-
const
|
|
142
|
-
|
|
361
|
+
const T = s.newValue, k = (T === null ? null : p(T)) ?? l;
|
|
362
|
+
N(k) && (i.set(o, k), _(k, S.current));
|
|
143
363
|
});
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
return window.addEventListener("storage",
|
|
147
|
-
}, [
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
}, [
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
154
|
-
|
|
364
|
+
se(() => {
|
|
365
|
+
if (E)
|
|
366
|
+
return window.addEventListener("storage", y), () => window.removeEventListener("storage", y);
|
|
367
|
+
}, [E]);
|
|
368
|
+
const j = ee((s) => {
|
|
369
|
+
const T = ye(s) ? s(S.current) : s;
|
|
370
|
+
i.set(o, T), _(T, S.current), n && n.setItem(o, b(T));
|
|
371
|
+
}, [o, n, _]), D = ee(() => {
|
|
372
|
+
const s = l;
|
|
373
|
+
if (!N(s)) {
|
|
374
|
+
n?.removeItem(o);
|
|
155
375
|
return;
|
|
156
376
|
}
|
|
157
|
-
|
|
158
|
-
}, [
|
|
377
|
+
i.set(o, s), _(s, S.current), n && n.setItem(o, b(s));
|
|
378
|
+
}, [o, l, n, _]);
|
|
159
379
|
return [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
380
|
+
g,
|
|
381
|
+
j,
|
|
382
|
+
D
|
|
163
383
|
];
|
|
164
384
|
},
|
|
165
385
|
/** Returns the fully qualified job name (dot-separated path). */
|
|
166
386
|
toString() {
|
|
167
|
-
return this[
|
|
387
|
+
return this[Y];
|
|
168
388
|
}
|
|
169
389
|
};
|
|
170
390
|
}
|
|
171
|
-
function
|
|
391
|
+
function ue(t, c) {
|
|
172
392
|
const {
|
|
173
|
-
path:
|
|
174
|
-
verbose:
|
|
175
|
-
verbosePath:
|
|
176
|
-
ssr:
|
|
177
|
-
cache:
|
|
178
|
-
} =
|
|
179
|
-
let
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
return
|
|
184
|
-
const
|
|
185
|
-
get(
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
const
|
|
189
|
-
let
|
|
190
|
-
|
|
191
|
-
const S =
|
|
393
|
+
path: n = "",
|
|
394
|
+
verbose: m,
|
|
395
|
+
verbosePath: a,
|
|
396
|
+
ssr: l,
|
|
397
|
+
cache: E
|
|
398
|
+
} = c;
|
|
399
|
+
let o = E.proxy.get(t);
|
|
400
|
+
o || (o = /* @__PURE__ */ new Map(), E.proxy.set(t, o));
|
|
401
|
+
const h = o.get(n);
|
|
402
|
+
if (h)
|
|
403
|
+
return h;
|
|
404
|
+
const R = new Proxy(t, {
|
|
405
|
+
get(w, i) {
|
|
406
|
+
const b = w[i], p = n ? `${n}.${String(i)}` : String(i);
|
|
407
|
+
if (b && typeof b == "object" && ce in b) {
|
|
408
|
+
const v = b;
|
|
409
|
+
let _ = E.leaf.get(v);
|
|
410
|
+
_ || (_ = /* @__PURE__ */ new Map(), E.leaf.set(v, _));
|
|
411
|
+
const S = _.get(p);
|
|
192
412
|
if (S)
|
|
193
413
|
return S;
|
|
194
|
-
const
|
|
195
|
-
(
|
|
196
|
-
),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
(...
|
|
414
|
+
const O = Reflect.ownKeys(v).filter(
|
|
415
|
+
(y) => typeof v[y] == "function"
|
|
416
|
+
), A = Object.fromEntries(
|
|
417
|
+
O.map((y) => [
|
|
418
|
+
y,
|
|
419
|
+
(...j) => v[y].call(
|
|
200
420
|
{
|
|
201
|
-
...
|
|
202
|
-
[
|
|
203
|
-
[
|
|
204
|
-
[
|
|
205
|
-
[
|
|
421
|
+
...v,
|
|
422
|
+
[Y]: p,
|
|
423
|
+
[J]: m,
|
|
424
|
+
[U]: a,
|
|
425
|
+
[q]: l
|
|
206
426
|
},
|
|
207
|
-
...
|
|
427
|
+
...j
|
|
208
428
|
)
|
|
209
429
|
])
|
|
210
|
-
),
|
|
211
|
-
return
|
|
430
|
+
), g = { ...v, ...A };
|
|
431
|
+
return _.set(p, g), g;
|
|
212
432
|
}
|
|
213
|
-
return
|
|
214
|
-
...
|
|
215
|
-
path:
|
|
216
|
-
}) :
|
|
433
|
+
return b && typeof b == "object" ? ue(b, {
|
|
434
|
+
...c,
|
|
435
|
+
path: p
|
|
436
|
+
}) : b;
|
|
217
437
|
}
|
|
218
438
|
});
|
|
219
|
-
return
|
|
439
|
+
return o.set(n, R), R;
|
|
220
440
|
}
|
|
221
|
-
function
|
|
222
|
-
return
|
|
223
|
-
...
|
|
224
|
-
verbosePath:
|
|
441
|
+
function Ne(t, c) {
|
|
442
|
+
return ue(t, {
|
|
443
|
+
...c,
|
|
444
|
+
verbosePath: c?.verbosePath ?? "",
|
|
225
445
|
cache: {
|
|
226
446
|
proxy: /* @__PURE__ */ new WeakMap(),
|
|
227
447
|
leaf: /* @__PURE__ */ new WeakMap()
|
|
@@ -229,7 +449,6 @@ function ie(e, n) {
|
|
|
229
449
|
});
|
|
230
450
|
}
|
|
231
451
|
export {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
ie as setupStorage
|
|
452
|
+
je as defineState,
|
|
453
|
+
Ne as setupStorage
|
|
235
454
|
};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/store.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ type Listener = () => void;
|
|
|
3
3
|
/***
|
|
4
4
|
* https://react.dev/reference/react/useSyncExternalStore
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
export default class VocabStore {
|
|
7
7
|
#private;
|
|
8
|
+
uid: string;
|
|
8
9
|
constructor();
|
|
9
10
|
subscribe(listener: Listener): () => boolean;
|
|
10
11
|
getClientSnapshot<V>(): Vocab<V>;
|
|
@@ -12,6 +13,4 @@ declare class VocabStore {
|
|
|
12
13
|
get<V>(statePath: string): V | undefined;
|
|
13
14
|
set<V>(statePath: string, value: ValueOrTransformer<V>): void;
|
|
14
15
|
}
|
|
15
|
-
export declare function runWithStateVocab<T>(fn: () => T): T | undefined;
|
|
16
|
-
export declare const getVocabStore: () => VocabStore;
|
|
17
16
|
export {};
|