@yakocloud/state-vocab 2.1.0 → 2.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 +4 -4
- package/dist/state-vocab.es.js +134 -134
- package/package.json +3 -2
package/dist/state-vocab.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),B=Symbol("state-def"),A=Symbol("state-path");function ie(t,
|
|
2
|
-
`),o=[],a=[];for(const r of
|
|
3
|
-
`),...a,t)}var x={exports:{}},k={};var W;function ve(){if(W)return k;W=1;var t=Symbol.for("react.transitional.element"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),B=Symbol("state-def"),A=Symbol("state-path");function ie(t,s,o){if(!s)return t;const a=s.split(".");let r=t;for(const c of a)if(r!==null&&typeof r=="object"&&c in r)r=r[c];else return o;return r===void 0?o:r}function fe(t,s,o){const a=s.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(let c=0;c<a.length-1;c++){const u=a[c],l=a[c+1];(r[u]===void 0||r[u]===null)&&(r[u]=/^\d+$/.test(l)?[]:{}),r=r[u]}return r[a[a.length-1]]=o,t}function de(t,s=0){let o;return function(...a){o!==void 0&&clearTimeout(o),o=setTimeout(()=>{o=void 0,t.apply(this,a)},s)}}function me(t,s,o=[]){return y.useMemo(()=>de(t,s),o)}function be(t){const s=JSON.stringify(t,null,2).split(`
|
|
2
|
+
`),o=[],a=[];for(const r of s){const c=r.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);if(c){const[,u,l,E,v]=c;o.push(`${u}%c"${l}"%c${E}%c${v}`),a.push("color: #9cdcfe; font-weight: bold","color: #cccccc","color: #ce9178")}else o.push(`%c${r}`),a.push("color: #cccccc")}console.log(o.join(`
|
|
3
|
+
`),...a,t)}var x={exports:{}},k={};var W;function ve(){if(W)return k;W=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(a,r,c){var u=null;if(c!==void 0&&(u=""+c),r.key!==void 0&&(u=""+r.key),"key"in r){c={};for(var l in r)l!=="key"&&(c[l]=r[l])}else c=r;return r=c.ref,{$$typeof:t,type:a,key:u,ref:r!==void 0?r:null,props:c}}return k.Fragment=s,k.jsx=o,k.jsxs=o,k}var w={};var J;function Ee(){return J||(J=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case K:return"Profiler";case h:return"StrictMode";case ne:return"Suspense";case oe:return"SuspenseList";case se: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 d:return"Portal";case te:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case re:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return n=e.displayName||null,n!==null?n:t(e.type)||"Memo";case j:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function s(e){return""+e}function o(e){try{s(e);var n=!1}catch{n=!0}if(n){n=console;var f=n.error,m=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",m),s(e)}}function a(e){if(e===S)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function r(){var e=N.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function u(e){if(M.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function l(e,n){function f(){Y||(Y=!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)",n))}f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}function E(){var e=t(this.type);return D[e]||(D[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 v(e,n,f,m,P,V){var b=f.ref;return e={$$typeof:_,type:e,key:n,props:f,_owner:m},(b!==void 0?b:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:E}):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:P}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function i(e,n,f,m,P,V){var b=n.children;if(b!==void 0)if(m)if(ue(b)){for(m=0;m<b.length;m++)R(b[m]);Object.freeze&&Object.freeze(b)}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 R(b);if(M.call(n,"key")){b=t(e);var g=Object.keys(n).filter(function(le){return le!=="key"});m=0<g.length?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}",z[b+m]||(g=0<g.length?"{"+g.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
4
4
|
let props = %s;
|
|
5
5
|
<%s {...props} />
|
|
6
6
|
React keys must be passed directly to JSX without using spread:
|
|
7
7
|
let props = %s;
|
|
8
|
-
<%s key={someKey} {...props} />`,m,b,g,b),z[b+m]=!0)}if(b=null,
|
|
8
|
+
<%s key={someKey} {...props} />`,m,b,g,b),z[b+m]=!0)}if(b=null,f!==void 0&&(o(f),b=""+f),u(n)&&(o(n.key),b=""+n.key),"key"in n){f={};for(var $ in n)$!=="key"&&(f[$]=n[$])}else f=n;return b&&l(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),v(e,b,f,r(),P,V)}function R(e){T(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===j&&(e._payload.status==="fulfilled"?T(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function T(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}var p=y,_=Symbol.for("react.transitional.element"),d=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),te=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),N=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,ue=Array.isArray,C=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(e){return e()}};var Y,D={},F=p.react_stack_bottom_frame.bind(p,c)(),L=C(a(c)),z={};w.Fragment=S,w.jsx=function(e,n,f){var m=1e4>N.recentlyCreatedOwnerStacks++;return i(e,n,f,!1,m?Error("react-stack-top-frame"):F,m?C(a(e)):L)},w.jsxs=function(e,n,f){var m=1e4>N.recentlyCreatedOwnerStacks++;return i(e,n,f,!0,m?Error("react-stack-top-frame"):F,m?C(a(e)):L)}})()),w}var U;function pe(){return U||(U=1,process.env.NODE_ENV==="production"?x.exports=ve():x.exports=Ee()),x.exports}var _e=pe();const H=y.createContext({stateVocab:{},setStateVocab:()=>{}});function Se(){return y.useContext(H)}const Re=t=>{const{children:s,verbose:o}=t,[a,r]=y.useState({});return o&&be(a),_e.jsx(H.Provider,{value:{stateVocab:a,setStateVocab:r},children:s})},O=(t,s)=>o=>{const a={...o};return fe(a,t,s),a},I=(t,s)=>Z(t)??s,q=t=>{const{serialized:s,defaultValue:o,superDefaultValue:a,deserialize:r}=t;if(s===null){const c=I(o,a);return typeof c>"u"?void 0:c}return r(s)},ye=t=>typeof t=="function",Te=t=>typeof t=="function",Z=t=>Te(t)?t():t;function ge(t={}){const{serialize:s=JSON.stringify,deserialize:o=JSON.parse}=t,a=t.defaultValue,r=t.bidirectional;return{[B]:!0,[A]:"",useState(c,u){u??={};const l=me(u.onSet??(()=>{}),u.delayedSet,[]),E=y.useMemo(()=>Z(t.storage),[]),v=Se(),i=this[A],R=y.useMemo(()=>{if(!E)return;const _=E.getItem(i);return q({serialized:_,defaultValue:c,superDefaultValue:a,deserialize:o})},[i]),T=y.useMemo(()=>ie(v.stateVocab,i,R??I(c,a)),[v.stateVocab,R,i]);y.useEffect(()=>{!E||typeof R>"u"||v.setStateVocab(O(i,R))},[R]),y.useEffect(()=>{if(!u.bidirectional&&!r)return;const _=d=>{if(d.key!==i)return;const S=d.newValue,h=q({serialized:S,defaultValue:c,superDefaultValue:a,deserialize:o});v.setStateVocab(O(i,h)),l(h,p.current),p.current=h};return window.addEventListener("storage",_),()=>window.removeEventListener("storage",_)},[i,u.bidirectional,r]);const p=y.useRef(T);return[T,function(d){const S=ye(d)?d(p.current):d;v.setStateVocab(O(i,S)),l(S,p.current),E&&E.setItem(i,s(S)),p.current=S},function(){const d=I(c,a);if(typeof d>"u"){E?.removeItem(i);return}v.setStateVocab(O(i,d)),l(d,p.current),p.current=d,E&&E.setItem(i,s(d))}]},toString(){return this[A]}}}const G=new WeakMap,X=new WeakMap;function Q(t,s=""){let o=G.get(t);o||(o=new Map,G.set(t,o));const a=o.get(s);if(a)return a;const r=new Proxy(t,{get(c,u){const l=c[u],E=s?`${s}.${String(u)}`:String(u);if(l&&typeof l=="object"&&B in l){const v=l;let i=X.get(v);i||(i=new Map,X.set(v,i));const R=i.get(E);if(R)return R;const T=Reflect.ownKeys(v).filter(d=>typeof v[d]=="function"),p=Object.fromEntries(T.map(d=>[d,(...S)=>v[d].call({...v,[A]:E},...S)])),_={...v,...p};return i.set(E,_),_}return l&&typeof l=="object"?Q(l,E):l}});return o.set(s,r),r}function he(t){return Q(t)}exports.StorageProvider=Re;exports.defineState=ge;exports.setupStorage=he;
|
package/dist/state-vocab.es.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import fe, { useMemo as
|
|
2
|
-
const H = Symbol("state-def"),
|
|
3
|
-
function Ee(t,
|
|
4
|
-
if (!
|
|
1
|
+
import fe, { useMemo as O, createContext as de, useState as me, useContext as be, useEffect as W, useRef as ve } from "react";
|
|
2
|
+
const H = Symbol("state-def"), A = Symbol("state-path");
|
|
3
|
+
function Ee(t, s, o) {
|
|
4
|
+
if (!s)
|
|
5
5
|
return t;
|
|
6
|
-
const a =
|
|
6
|
+
const a = s.split(".");
|
|
7
7
|
let r = t;
|
|
8
|
-
for (const
|
|
9
|
-
if (r !== null && typeof r == "object" &&
|
|
10
|
-
r = r[
|
|
8
|
+
for (const c of a)
|
|
9
|
+
if (r !== null && typeof r == "object" && c in r)
|
|
10
|
+
r = r[c];
|
|
11
11
|
else
|
|
12
12
|
return o;
|
|
13
13
|
return r === void 0 ? o : r;
|
|
14
14
|
}
|
|
15
|
-
function pe(t,
|
|
16
|
-
const a =
|
|
15
|
+
function pe(t, s, o) {
|
|
16
|
+
const a = s.replace(/\[(\d+)\]/g, ".$1").split(".");
|
|
17
17
|
let r = t;
|
|
18
|
-
for (let
|
|
19
|
-
const
|
|
20
|
-
(r[
|
|
18
|
+
for (let c = 0; c < a.length - 1; c++) {
|
|
19
|
+
const u = a[c], l = a[c + 1];
|
|
20
|
+
(r[u] === void 0 || r[u] === null) && (r[u] = /^\d+$/.test(l) ? [] : {}), r = r[u];
|
|
21
21
|
}
|
|
22
22
|
return r[a[a.length - 1]] = o, t;
|
|
23
23
|
}
|
|
24
|
-
function _e(t,
|
|
24
|
+
function _e(t, s = 0) {
|
|
25
25
|
let o;
|
|
26
26
|
return function(...a) {
|
|
27
27
|
o !== void 0 && clearTimeout(o), o = setTimeout(() => {
|
|
28
28
|
o = void 0, t.apply(this, a);
|
|
29
|
-
},
|
|
29
|
+
}, s);
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function Se(t,
|
|
33
|
-
return
|
|
34
|
-
() => _e(t,
|
|
32
|
+
function Se(t, s, o = []) {
|
|
33
|
+
return O(
|
|
34
|
+
() => _e(t, s),
|
|
35
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
36
|
o
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
function Re(t) {
|
|
40
|
-
const
|
|
40
|
+
const s = JSON.stringify(t, null, 2).split(`
|
|
41
41
|
`), o = [], a = [];
|
|
42
|
-
for (const r of
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const [,
|
|
46
|
-
o.push(`${
|
|
42
|
+
for (const r of s) {
|
|
43
|
+
const c = r.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);
|
|
44
|
+
if (c) {
|
|
45
|
+
const [, u, l, E, v] = c;
|
|
46
|
+
o.push(`${u}%c"${l}"%c${E}%c${v}`), a.push(
|
|
47
47
|
"color: #9cdcfe; font-weight: bold",
|
|
48
48
|
"color: #cccccc",
|
|
49
49
|
"color: #ce9178"
|
|
@@ -59,23 +59,23 @@ var J;
|
|
|
59
59
|
function Te() {
|
|
60
60
|
if (J) return h;
|
|
61
61
|
J = 1;
|
|
62
|
-
var t = Symbol.for("react.transitional.element"),
|
|
63
|
-
function o(a, r,
|
|
64
|
-
var
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
for (var
|
|
68
|
-
|
|
69
|
-
} else
|
|
70
|
-
return r =
|
|
62
|
+
var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
63
|
+
function o(a, r, c) {
|
|
64
|
+
var u = null;
|
|
65
|
+
if (c !== void 0 && (u = "" + c), r.key !== void 0 && (u = "" + r.key), "key" in r) {
|
|
66
|
+
c = {};
|
|
67
|
+
for (var l in r)
|
|
68
|
+
l !== "key" && (c[l] = r[l]);
|
|
69
|
+
} else c = r;
|
|
70
|
+
return r = c.ref, {
|
|
71
71
|
$$typeof: t,
|
|
72
72
|
type: a,
|
|
73
|
-
key:
|
|
73
|
+
key: u,
|
|
74
74
|
ref: r !== void 0 ? r : null,
|
|
75
|
-
props:
|
|
75
|
+
props: c
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
return h.Fragment =
|
|
78
|
+
return h.Fragment = s, h.jsx = o, h.jsxs = o, h;
|
|
79
79
|
}
|
|
80
80
|
var k = {};
|
|
81
81
|
var U;
|
|
@@ -115,7 +115,7 @@ function ye() {
|
|
|
115
115
|
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
116
116
|
case se:
|
|
117
117
|
return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
|
|
118
|
-
case
|
|
118
|
+
case j:
|
|
119
119
|
n = e._payload, e = e._init;
|
|
120
120
|
try {
|
|
121
121
|
return t(e(n));
|
|
@@ -124,29 +124,29 @@ function ye() {
|
|
|
124
124
|
}
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function s(e) {
|
|
128
128
|
return "" + e;
|
|
129
129
|
}
|
|
130
130
|
function o(e) {
|
|
131
131
|
try {
|
|
132
|
-
|
|
132
|
+
s(e);
|
|
133
133
|
var n = !1;
|
|
134
134
|
} catch {
|
|
135
135
|
n = !0;
|
|
136
136
|
}
|
|
137
137
|
if (n) {
|
|
138
138
|
n = console;
|
|
139
|
-
var
|
|
140
|
-
return
|
|
139
|
+
var f = n.error, m = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
140
|
+
return f.call(
|
|
141
141
|
n,
|
|
142
142
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
143
143
|
m
|
|
144
|
-
),
|
|
144
|
+
), s(e);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
function a(e) {
|
|
148
148
|
if (e === S) return "<>";
|
|
149
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
149
|
+
if (typeof e == "object" && e !== null && e.$$typeof === j)
|
|
150
150
|
return "<...>";
|
|
151
151
|
try {
|
|
152
152
|
var n = t(e);
|
|
@@ -156,48 +156,48 @@ function ye() {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
function r() {
|
|
159
|
-
var e =
|
|
159
|
+
var e = N.A;
|
|
160
160
|
return e === null ? null : e.getOwner();
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function c() {
|
|
163
163
|
return Error("react-stack-top-frame");
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function u(e) {
|
|
166
166
|
if (Y.call(e, "key")) {
|
|
167
167
|
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
168
168
|
if (n && n.isReactWarning) return !1;
|
|
169
169
|
}
|
|
170
170
|
return e.key !== void 0;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
function
|
|
172
|
+
function l(e, n) {
|
|
173
|
+
function f() {
|
|
174
174
|
D || (D = !0, console.error(
|
|
175
175
|
"%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)",
|
|
176
176
|
n
|
|
177
177
|
));
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
get:
|
|
179
|
+
f.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
180
|
+
get: f,
|
|
181
181
|
configurable: !0
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function E() {
|
|
185
185
|
var e = t(this.type);
|
|
186
186
|
return F[e] || (F[e] = !0, console.error(
|
|
187
187
|
"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."
|
|
188
188
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
189
189
|
}
|
|
190
|
-
function v(e, n,
|
|
191
|
-
var b =
|
|
190
|
+
function v(e, n, f, m, w, V) {
|
|
191
|
+
var b = f.ref;
|
|
192
192
|
return e = {
|
|
193
193
|
$$typeof: _,
|
|
194
194
|
type: e,
|
|
195
195
|
key: n,
|
|
196
|
-
props:
|
|
196
|
+
props: f,
|
|
197
197
|
_owner: m
|
|
198
198
|
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(e, "ref", {
|
|
199
199
|
enumerable: !1,
|
|
200
|
-
get:
|
|
200
|
+
get: E
|
|
201
201
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
202
202
|
configurable: !1,
|
|
203
203
|
enumerable: !1,
|
|
@@ -217,10 +217,10 @@ function ye() {
|
|
|
217
217
|
configurable: !1,
|
|
218
218
|
enumerable: !1,
|
|
219
219
|
writable: !0,
|
|
220
|
-
value:
|
|
220
|
+
value: V
|
|
221
221
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function i(e, n, f, m, w, V) {
|
|
224
224
|
var b = n.children;
|
|
225
225
|
if (b !== void 0)
|
|
226
226
|
if (m)
|
|
@@ -251,60 +251,60 @@ React keys must be passed directly to JSX without using spread:
|
|
|
251
251
|
b
|
|
252
252
|
), z[b + m] = !0);
|
|
253
253
|
}
|
|
254
|
-
if (b = null,
|
|
255
|
-
|
|
256
|
-
for (var
|
|
257
|
-
|
|
258
|
-
} else
|
|
259
|
-
return b &&
|
|
260
|
-
|
|
254
|
+
if (b = null, f !== void 0 && (o(f), b = "" + f), u(n) && (o(n.key), b = "" + n.key), "key" in n) {
|
|
255
|
+
f = {};
|
|
256
|
+
for (var $ in n)
|
|
257
|
+
$ !== "key" && (f[$] = n[$]);
|
|
258
|
+
} else f = n;
|
|
259
|
+
return b && l(
|
|
260
|
+
f,
|
|
261
261
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
262
262
|
), v(
|
|
263
263
|
e,
|
|
264
264
|
b,
|
|
265
|
-
|
|
265
|
+
f,
|
|
266
266
|
r(),
|
|
267
267
|
w,
|
|
268
|
-
|
|
268
|
+
V
|
|
269
269
|
);
|
|
270
270
|
}
|
|
271
271
|
function R(e) {
|
|
272
|
-
T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof ===
|
|
272
|
+
T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === j && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
273
273
|
}
|
|
274
274
|
function T(e) {
|
|
275
275
|
return typeof e == "object" && e !== null && e.$$typeof === _;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
277
|
+
var p = fe, _ = Symbol.for("react.transitional.element"), d = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), ee = Symbol.for("react.profiler"), te = Symbol.for("react.consumer"), re = Symbol.for("react.context"), ne = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), ue = Symbol.for("react.client.reference"), N = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, le = Array.isArray, C = console.createTask ? console.createTask : function() {
|
|
278
278
|
return null;
|
|
279
279
|
};
|
|
280
|
-
|
|
280
|
+
p = {
|
|
281
281
|
react_stack_bottom_frame: function(e) {
|
|
282
282
|
return e();
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
var D, F = {}, M =
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
)(), L =
|
|
289
|
-
k.Fragment = S, k.jsx = function(e, n,
|
|
290
|
-
var m = 1e4 >
|
|
291
|
-
return
|
|
285
|
+
var D, F = {}, M = p.react_stack_bottom_frame.bind(
|
|
286
|
+
p,
|
|
287
|
+
c
|
|
288
|
+
)(), L = C(a(c)), z = {};
|
|
289
|
+
k.Fragment = S, k.jsx = function(e, n, f) {
|
|
290
|
+
var m = 1e4 > N.recentlyCreatedOwnerStacks++;
|
|
291
|
+
return i(
|
|
292
292
|
e,
|
|
293
293
|
n,
|
|
294
|
-
|
|
294
|
+
f,
|
|
295
295
|
!1,
|
|
296
296
|
m ? Error("react-stack-top-frame") : M,
|
|
297
|
-
m ?
|
|
297
|
+
m ? C(a(e)) : L
|
|
298
298
|
);
|
|
299
|
-
}, k.jsxs = function(e, n,
|
|
300
|
-
var m = 1e4 >
|
|
301
|
-
return
|
|
299
|
+
}, k.jsxs = function(e, n, f) {
|
|
300
|
+
var m = 1e4 > N.recentlyCreatedOwnerStacks++;
|
|
301
|
+
return i(
|
|
302
302
|
e,
|
|
303
303
|
n,
|
|
304
|
-
|
|
304
|
+
f,
|
|
305
305
|
!0,
|
|
306
306
|
m ? Error("react-stack-top-frame") : M,
|
|
307
|
-
m ?
|
|
307
|
+
m ? C(a(e)) : L
|
|
308
308
|
);
|
|
309
309
|
};
|
|
310
310
|
})()), k;
|
|
@@ -323,66 +323,66 @@ function ke() {
|
|
|
323
323
|
return be(Z);
|
|
324
324
|
}
|
|
325
325
|
const Oe = (t) => {
|
|
326
|
-
const { children:
|
|
327
|
-
return o && Re(a), /* @__PURE__ */ he.jsx(Z.Provider, { value: { stateVocab: a, setStateVocab: r }, children:
|
|
328
|
-
}, P = (t,
|
|
326
|
+
const { children: s, verbose: o } = t, [a, r] = me({});
|
|
327
|
+
return o && Re(a), /* @__PURE__ */ he.jsx(Z.Provider, { value: { stateVocab: a, setStateVocab: r }, children: s });
|
|
328
|
+
}, P = (t, s) => (o) => {
|
|
329
329
|
const a = { ...o };
|
|
330
|
-
return pe(a, t,
|
|
331
|
-
}, I = (t,
|
|
332
|
-
const { serialized:
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
335
|
-
return typeof
|
|
330
|
+
return pe(a, t, s), a;
|
|
331
|
+
}, I = (t, s) => Q(t) ?? s, G = (t) => {
|
|
332
|
+
const { serialized: s, defaultValue: o, superDefaultValue: a, deserialize: r } = t;
|
|
333
|
+
if (s === null) {
|
|
334
|
+
const c = I(o, a);
|
|
335
|
+
return typeof c > "u" ? void 0 : c;
|
|
336
336
|
}
|
|
337
|
-
return r(
|
|
337
|
+
return r(s);
|
|
338
338
|
}, we = (t) => typeof t == "function", xe = (t) => typeof t == "function", Q = (t) => xe(t) ? t() : t;
|
|
339
339
|
function Ae(t = {}) {
|
|
340
340
|
const {
|
|
341
|
-
serialize:
|
|
341
|
+
serialize: s = JSON.stringify,
|
|
342
342
|
deserialize: o = JSON.parse
|
|
343
|
-
} = t, a = t.defaultValue, r = t.bidirectional
|
|
343
|
+
} = t, a = t.defaultValue, r = t.bidirectional;
|
|
344
344
|
return {
|
|
345
345
|
[H]: !0,
|
|
346
346
|
// marks this object as a leaf in the router tree
|
|
347
|
-
[
|
|
347
|
+
[A]: "",
|
|
348
348
|
// placeholder; injected at runtime by injectPaths()
|
|
349
|
-
useState(
|
|
349
|
+
useState(c, u) {
|
|
350
350
|
u ??= {};
|
|
351
|
-
const
|
|
351
|
+
const l = Se(
|
|
352
352
|
u.onSet ?? (() => {
|
|
353
353
|
}),
|
|
354
354
|
u.delayedSet,
|
|
355
355
|
[]
|
|
356
|
-
), v = ke(),
|
|
356
|
+
), E = O(() => Q(t.storage), []), v = ke(), i = this[A], R = O(
|
|
357
357
|
() => {
|
|
358
|
-
if (!
|
|
358
|
+
if (!E)
|
|
359
359
|
return;
|
|
360
|
-
const _ =
|
|
360
|
+
const _ = E.getItem(i);
|
|
361
361
|
return G({
|
|
362
362
|
serialized: _,
|
|
363
|
-
defaultValue:
|
|
363
|
+
defaultValue: c,
|
|
364
364
|
superDefaultValue: a,
|
|
365
365
|
deserialize: o
|
|
366
366
|
});
|
|
367
367
|
},
|
|
368
368
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
369
|
-
[
|
|
370
|
-
), T =
|
|
369
|
+
[i]
|
|
370
|
+
), T = O(
|
|
371
371
|
() => Ee(
|
|
372
372
|
v.stateVocab,
|
|
373
|
-
|
|
374
|
-
R ?? I(
|
|
373
|
+
i,
|
|
374
|
+
R ?? I(c, a)
|
|
375
375
|
),
|
|
376
376
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
377
377
|
[
|
|
378
378
|
v.stateVocab,
|
|
379
379
|
R,
|
|
380
|
-
|
|
380
|
+
i
|
|
381
381
|
]
|
|
382
382
|
);
|
|
383
383
|
W(
|
|
384
384
|
() => {
|
|
385
|
-
!
|
|
385
|
+
!E || typeof R > "u" || v.setStateVocab(P(i, R));
|
|
386
386
|
},
|
|
387
387
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
388
388
|
[R]
|
|
@@ -390,79 +390,79 @@ function Ae(t = {}) {
|
|
|
390
390
|
if (!u.bidirectional && !r)
|
|
391
391
|
return;
|
|
392
392
|
const _ = (d) => {
|
|
393
|
-
if (d.key !==
|
|
393
|
+
if (d.key !== i)
|
|
394
394
|
return;
|
|
395
395
|
const S = d.newValue, g = G({
|
|
396
396
|
serialized: S,
|
|
397
|
-
defaultValue:
|
|
397
|
+
defaultValue: c,
|
|
398
398
|
superDefaultValue: a,
|
|
399
399
|
deserialize: o
|
|
400
400
|
});
|
|
401
|
-
v.setStateVocab(P(
|
|
401
|
+
v.setStateVocab(P(i, g)), l(g, p.current), p.current = g;
|
|
402
402
|
};
|
|
403
403
|
return window.addEventListener("storage", _), () => window.removeEventListener("storage", _);
|
|
404
404
|
}, [
|
|
405
|
-
|
|
405
|
+
i,
|
|
406
406
|
u.bidirectional,
|
|
407
407
|
r
|
|
408
408
|
]);
|
|
409
|
-
const
|
|
409
|
+
const p = ve(T);
|
|
410
410
|
return [
|
|
411
411
|
T,
|
|
412
412
|
function(d) {
|
|
413
|
-
const S = we(d) ? d(
|
|
414
|
-
v.setStateVocab(P(
|
|
413
|
+
const S = we(d) ? d(p.current) : d;
|
|
414
|
+
v.setStateVocab(P(i, S)), l(S, p.current), E && E.setItem(i, s(S)), p.current = S;
|
|
415
415
|
},
|
|
416
416
|
function() {
|
|
417
|
-
const d = I(
|
|
417
|
+
const d = I(c, a);
|
|
418
418
|
if (typeof d > "u") {
|
|
419
|
-
|
|
419
|
+
E?.removeItem(i);
|
|
420
420
|
return;
|
|
421
421
|
}
|
|
422
|
-
v.setStateVocab(P(
|
|
422
|
+
v.setStateVocab(P(i, d)), l(d, p.current), p.current = d, E && E.setItem(i, s(d));
|
|
423
423
|
}
|
|
424
424
|
];
|
|
425
425
|
},
|
|
426
426
|
/** Returns the fully qualified job name (dot-separated path). */
|
|
427
427
|
toString() {
|
|
428
|
-
return this[
|
|
428
|
+
return this[A];
|
|
429
429
|
}
|
|
430
430
|
};
|
|
431
431
|
}
|
|
432
432
|
const X = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap();
|
|
433
|
-
function K(t,
|
|
433
|
+
function K(t, s = "") {
|
|
434
434
|
let o = X.get(t);
|
|
435
435
|
o || (o = /* @__PURE__ */ new Map(), X.set(t, o));
|
|
436
|
-
const a = o.get(
|
|
436
|
+
const a = o.get(s);
|
|
437
437
|
if (a)
|
|
438
438
|
return a;
|
|
439
439
|
const r = new Proxy(t, {
|
|
440
|
-
get(
|
|
441
|
-
const
|
|
442
|
-
if (
|
|
443
|
-
const v =
|
|
444
|
-
let
|
|
445
|
-
|
|
446
|
-
const R =
|
|
440
|
+
get(c, u) {
|
|
441
|
+
const l = c[u], E = s ? `${s}.${String(u)}` : String(u);
|
|
442
|
+
if (l && typeof l == "object" && H in l) {
|
|
443
|
+
const v = l;
|
|
444
|
+
let i = B.get(v);
|
|
445
|
+
i || (i = /* @__PURE__ */ new Map(), B.set(v, i));
|
|
446
|
+
const R = i.get(E);
|
|
447
447
|
if (R)
|
|
448
448
|
return R;
|
|
449
449
|
const T = Reflect.ownKeys(v).filter(
|
|
450
450
|
(d) => typeof v[d] == "function"
|
|
451
|
-
),
|
|
451
|
+
), p = Object.fromEntries(
|
|
452
452
|
T.map((d) => [
|
|
453
453
|
d,
|
|
454
454
|
(...S) => v[d].call(
|
|
455
|
-
{ ...v, [
|
|
455
|
+
{ ...v, [A]: E },
|
|
456
456
|
...S
|
|
457
457
|
)
|
|
458
458
|
])
|
|
459
|
-
), _ = { ...v, ...
|
|
460
|
-
return
|
|
459
|
+
), _ = { ...v, ...p };
|
|
460
|
+
return i.set(E, _), _;
|
|
461
461
|
}
|
|
462
|
-
return
|
|
462
|
+
return l && typeof l == "object" ? K(l, E) : l;
|
|
463
463
|
}
|
|
464
464
|
});
|
|
465
|
-
return o.set(
|
|
465
|
+
return o.set(s, r), r;
|
|
466
466
|
}
|
|
467
467
|
function je(t) {
|
|
468
468
|
return K(t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yakocloud/state-vocab",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "dist/state-vocab.cjs.js",
|
|
5
5
|
"module": "dist/state-vocab.es.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"lint": "eslint .",
|
|
23
23
|
"type-check": "tsc --project tsconfig.types.json",
|
|
24
24
|
"test": "vitest run",
|
|
25
|
-
"test:watch": "vitest"
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"test:report": "npx vitest run --reporter=verbose"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
28
29
|
"react": "^19.2.1",
|