@yakocloud/state-vocab 2.1.3 → 2.2.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/README.md +2 -0
- package/dist/state-vocab.cjs.js +4 -4
- package/dist/state-vocab.es.js +277 -275
- package/dist/types/state.d.ts +4 -1
- package/dist/types/state.utils.d.ts +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -331,6 +331,7 @@ createRoot(document.getElementById('root')!).render(
|
|
|
331
331
|
| `storage` | `Storage \| (() => Storage) \| undefined` | `undefined` (in-memory) |
|
|
332
332
|
| `defaultValue` | `T \| undefined` | `undefined` |
|
|
333
333
|
| `bidirectional` | `true \| undefined` | `undefined` |
|
|
334
|
+
| `autoSet` | `true \| undefined` | `undefined` |
|
|
334
335
|
| `serialize` | `(v: T) => string` | `JSON.stringify` |
|
|
335
336
|
| `deserialize` | `(v: string) => T` | `JSON.parse` |
|
|
336
337
|
|
|
@@ -350,5 +351,6 @@ React context provider. Must be an ancestor of any component using `.useState()`
|
|
|
350
351
|
| `options.delayedSet` | `number \| undefined` | Debounce delay for `onSet` in ms |
|
|
351
352
|
| `options.onSet` | `(next: D, prev: D) => void \| undefined` | Callback after state change |
|
|
352
353
|
| `options.bidirectional` | `true \| undefined` | bidirectional state update to sync tabs |
|
|
354
|
+
| `options.autoSet` | `true \| undefined` | set the passed default value |
|
|
353
355
|
|
|
354
356
|
Returns `[value, setValue, resetValue]`.
|
package/dist/state-vocab.cjs.js
CHANGED
|
@@ -1,8 +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 S=require("react"),te=Symbol("state-def"),C=Symbol("state-path"),z=Symbol("state-ssr-support");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 S.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,_,d]=c;o.push(`${u}%c"${l}"%c${_}%c${d}`),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 V={exports:{}},O={};var B;function ve(){if(B)return O;B=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 O.Fragment=s,O.jsx=o,O.jsxs=o,O}var A={};var H;function Ee(){return H||(H=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 E:return"Fragment";case P:return"Profiler";case g:return"StrictMode";case x: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 k:return"Portal";case h:return e.displayName||"Context";case v:return(e._context.displayName||"Context")+".Consumer";case I: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 M: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 i=n.error,m=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.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===E)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===M)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function r(){var e=Y.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function u(e){if(W.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 i(){J||(J=!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))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function _(){var e=t(this.type);return U[e]||(U[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 d(e,n,i,m,j,F){var b=i.ref;return e={$$typeof:T,type:e,key:n,props:i,_owner:m},(b!==void 0?b:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:_}):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:j}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:F}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function f(e,n,i,m,j,F){var b=n.children;if(b!==void 0)if(m)if(ue(b)){for(m=0;m<b.length;m++)p(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 p(b);if(W.call(n,"key")){b=t(e);var w=Object.keys(n).filter(function(le){return le!=="key"});m=0<w.length?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}",X[b+m]||(w=0<w.length?"{"+w.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} />`,
|
|
8
|
+
<%s key={someKey} {...props} />`,m,b,w,b),X[b+m]=!0)}if(b=null,i!==void 0&&(o(i),b=""+i),u(n)&&(o(n.key),b=""+n.key),"key"in n){i={};for(var L in n)L!=="key"&&(i[L]=n[L])}else i=n;return b&&l(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),d(e,b,i,r(),j,F)}function p(e){R(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===M&&(e._payload.status==="fulfilled"?R(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function R(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}var y=S,T=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),h=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),Y=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,ue=Array.isArray,D=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(e){return e()}};var J,U={},q=y.react_stack_bottom_frame.bind(y,c)(),G=D(a(c)),X={};A.Fragment=E,A.jsx=function(e,n,i){var m=1e4>Y.recentlyCreatedOwnerStacks++;return f(e,n,i,!1,m?Error("react-stack-top-frame"):q,m?D(a(e)):G)},A.jsxs=function(e,n,i){var m=1e4>Y.recentlyCreatedOwnerStacks++;return f(e,n,i,!0,m?Error("react-stack-top-frame"):q,m?D(a(e)):G)}})()),A}var Z;function Se(){return Z||(Z=1,process.env.NODE_ENV==="production"?V.exports=ve():V.exports=Ee()),V.exports}var pe=Se();const re=S.createContext({stateVocab:{},setStateVocab:()=>{}});function _e(){return S.useContext(re)}const Re=t=>{const{children:s,verbose:o}=t,[a,r]=S.useState({});return o&&be(a),pe.jsx(re.Provider,{value:{stateVocab:a,setStateVocab:r},children:s})},N=(t,s)=>o=>{const a={...o};return fe(a,t,s),a},Q=t=>{const{serialized:s,defaultValue:o,superDefaultValue:a,deserialize:r}=t;if(s===null){const c=$(o)??a;return typeof c>"u"?void 0:c}return r(s)},Te=t=>typeof t=="function",ye=t=>typeof t=="function",$=t=>ye(t)?t():t,ge=typeof window>"u";function he(t={}){const{serialize:s=JSON.stringify,deserialize:o=JSON.parse}=t,a=t.defaultValue,r=t.bidirectional,c=t.autoSet,u=ge?void 0:$(t.storage);return{[te]:!0,[z]:!1,[C]:"",useState(l){l??={};const _=me(l.onSet??(()=>{}),l.delayedSet,[]),d=_e(),f=this[C],p=this[z],[R,y]=S.useState(!p);S.useEffect(()=>y(!0),[]);const T=S.useMemo(()=>{if(!R||!u)return;const v=u.getItem(f);return Q({defaultValue:l.defaultValue,serialized:v,superDefaultValue:a,deserialize:o})},[f,R]),k=S.useMemo(()=>ie(d.stateVocab,f,T??$(l.defaultValue)??a),[d.stateVocab,T,f]);S.useEffect(()=>{!u||typeof T>"u"||d.setStateVocab(N(f,T))},[T]),S.useEffect(()=>{if(!l.bidirectional&&!r)return;const v=h=>{if(h.key!==f)return;const I=h.newValue,x=Q({defaultValue:l.defaultValue,superDefaultValue:a,serialized:I,deserialize:o});d.setStateVocab(N(f,x)),_(x,E.current),E.current=x};return window.addEventListener("storage",v),()=>window.removeEventListener("storage",v)},[f,l.bidirectional,r]);const E=S.useRef(k),g=v=>{const h=Te(v)?v(E.current):v;d.setStateVocab(N(f,h)),_(h,E.current),u&&u.setItem(f,s(h)),E.current=h},P=()=>{const v=$(l.defaultValue)??a;if(typeof v>"u"){u?.removeItem(f);return}d.setStateVocab(N(f,v)),_(v,E.current),E.current=v,u&&u.setItem(f,s(v))};return S.useEffect(()=>{(l.autoSet||c)&&g(k)},[]),[k,g,P]},toString(){return this[C]}}}const K=new WeakMap,ee=new WeakMap;function ne(t,s){s??={};const{path:o="",ssr:a}=s;let r=K.get(t);r||(r=new Map,K.set(t,r));const c=r.get(o);if(c)return c;const u=new Proxy(t,{get(l,_){const d=l[_],f=o?`${o}.${String(_)}`:String(_);if(d&&typeof d=="object"&&te in d){const p=d;let R=ee.get(p);R||(R=new Map,ee.set(p,R));const y=R.get(f);if(y)return y;const T=Reflect.ownKeys(p).filter(g=>typeof p[g]=="function"),k=Object.fromEntries(T.map(g=>[g,(...P)=>p[g].call({...p,[C]:f,[z]:a},...P)])),E={...p,...k};return R.set(f,E),E}return d&&typeof d=="object"?ne(d,{path:f,ssr:a}):d}});return r.set(o,u),u}function ke(t,s){return ne(t,s)}exports.StorageProvider=Re;exports.defineState=he;exports.setupStorage=ke;
|
package/dist/state-vocab.es.js
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
function Ee(t,
|
|
4
|
-
if (!
|
|
1
|
+
import de, { useMemo as z, createContext as me, useState as re, useContext as be, useEffect as V, useRef as ve } from "react";
|
|
2
|
+
const ne = Symbol("state-def"), C = Symbol("state-path"), W = Symbol("state-ssr-support");
|
|
3
|
+
function Ee(t, s, o) {
|
|
4
|
+
if (!s)
|
|
5
5
|
return t;
|
|
6
|
-
const
|
|
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
|
-
return
|
|
13
|
-
return r === void 0 ?
|
|
12
|
+
return o;
|
|
13
|
+
return r === void 0 ? o : r;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
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
|
-
return r[
|
|
22
|
+
return r[a[a.length - 1]] = o, t;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
return function(...
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
24
|
+
function _e(t, s = 0) {
|
|
25
|
+
let o;
|
|
26
|
+
return function(...a) {
|
|
27
|
+
o !== void 0 && clearTimeout(o), o = setTimeout(() => {
|
|
28
|
+
o = void 0, t.apply(this, a);
|
|
29
|
+
}, s);
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
34
|
-
() =>
|
|
32
|
+
function Se(t, s, o = []) {
|
|
33
|
+
return z(
|
|
34
|
+
() => _e(t, s),
|
|
35
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
-
|
|
36
|
+
o
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
`),
|
|
42
|
-
for (const r of
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const [,
|
|
46
|
-
|
|
39
|
+
function Re(t) {
|
|
40
|
+
const s = JSON.stringify(t, null, 2).split(`
|
|
41
|
+
`), o = [], a = [];
|
|
42
|
+
for (const r of s) {
|
|
43
|
+
const c = r.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);
|
|
44
|
+
if (c) {
|
|
45
|
+
const [, u, l, _, d] = c;
|
|
46
|
+
o.push(`${u}%c"${l}"%c${_}%c${d}`), a.push(
|
|
47
47
|
"color: #9cdcfe; font-weight: bold",
|
|
48
48
|
"color: #cccccc",
|
|
49
49
|
"color: #ce9178"
|
|
50
50
|
);
|
|
51
51
|
} else
|
|
52
|
-
|
|
52
|
+
o.push(`%c${r}`), a.push("color: #cccccc");
|
|
53
53
|
}
|
|
54
|
-
console.log(
|
|
55
|
-
`), ...
|
|
54
|
+
console.log(o.join(`
|
|
55
|
+
`), ...a, t);
|
|
56
56
|
}
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
var t = Symbol.for("react.transitional.element"),
|
|
63
|
-
function a
|
|
64
|
-
var
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
for (var
|
|
68
|
-
|
|
69
|
-
} else
|
|
70
|
-
return r =
|
|
57
|
+
var j = { exports: {} }, x = {};
|
|
58
|
+
var H;
|
|
59
|
+
function Te() {
|
|
60
|
+
if (H) return x;
|
|
61
|
+
H = 1;
|
|
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
|
-
type:
|
|
73
|
-
key:
|
|
72
|
+
type: a,
|
|
73
|
+
key: u,
|
|
74
74
|
ref: r !== void 0 ? r : null,
|
|
75
|
-
props:
|
|
75
|
+
props: c
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
return
|
|
78
|
+
return x.Fragment = s, x.jsx = o, x.jsxs = o, x;
|
|
79
79
|
}
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
function
|
|
83
|
-
return
|
|
80
|
+
var A = {};
|
|
81
|
+
var Z;
|
|
82
|
+
function ye() {
|
|
83
|
+
return Z || (Z = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
84
84
|
function t(e) {
|
|
85
85
|
if (e == null) return null;
|
|
86
86
|
if (typeof e == "function")
|
|
87
|
-
return e.$$typeof ===
|
|
87
|
+
return e.$$typeof === le ? null : e.displayName || e.name || null;
|
|
88
88
|
if (typeof e == "string") return e;
|
|
89
89
|
switch (e) {
|
|
90
|
-
case
|
|
90
|
+
case E:
|
|
91
91
|
return "Fragment";
|
|
92
|
-
case
|
|
92
|
+
case w:
|
|
93
93
|
return "Profiler";
|
|
94
|
-
case
|
|
94
|
+
case y:
|
|
95
95
|
return "StrictMode";
|
|
96
|
-
case
|
|
96
|
+
case P:
|
|
97
97
|
return "Suspense";
|
|
98
|
-
case
|
|
98
|
+
case se:
|
|
99
99
|
return "SuspenseList";
|
|
100
|
-
case
|
|
100
|
+
case ue:
|
|
101
101
|
return "Activity";
|
|
102
102
|
}
|
|
103
103
|
if (typeof e == "object")
|
|
104
104
|
switch (typeof e.tag == "number" && console.error(
|
|
105
105
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
106
106
|
), e.$$typeof) {
|
|
107
|
-
case
|
|
107
|
+
case g:
|
|
108
108
|
return "Portal";
|
|
109
|
-
case
|
|
109
|
+
case h:
|
|
110
110
|
return e.displayName || "Context";
|
|
111
|
-
case
|
|
111
|
+
case v:
|
|
112
112
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
113
|
-
case
|
|
113
|
+
case I:
|
|
114
114
|
var n = e.render;
|
|
115
115
|
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
116
|
-
case
|
|
116
|
+
case ce:
|
|
117
117
|
return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
|
|
118
|
-
case
|
|
118
|
+
case Y:
|
|
119
119
|
n = e._payload, e = e._init;
|
|
120
120
|
try {
|
|
121
121
|
return t(e(n));
|
|
@@ -124,29 +124,29 @@ function ge() {
|
|
|
124
124
|
}
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function s(e) {
|
|
128
128
|
return "" + e;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
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 i = n.error, m = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
140
|
+
return i.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
|
-
|
|
144
|
-
),
|
|
143
|
+
m
|
|
144
|
+
), s(e);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
if (e ===
|
|
149
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
147
|
+
function a(e) {
|
|
148
|
+
if (e === E) return "<>";
|
|
149
|
+
if (typeof e == "object" && e !== null && e.$$typeof === Y)
|
|
150
150
|
return "<...>";
|
|
151
151
|
try {
|
|
152
152
|
var n = t(e);
|
|
@@ -156,48 +156,48 @@ function ge() {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
function r() {
|
|
159
|
-
var e =
|
|
159
|
+
var e = D.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
|
|
166
|
-
if (
|
|
165
|
+
function u(e) {
|
|
166
|
+
if (J.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
|
|
174
|
-
|
|
172
|
+
function l(e, n) {
|
|
173
|
+
function i() {
|
|
174
|
+
U || (U = !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
|
+
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
180
|
+
get: i,
|
|
181
181
|
configurable: !0
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function _() {
|
|
185
185
|
var e = t(this.type);
|
|
186
|
-
return
|
|
186
|
+
return q[e] || (q[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
|
|
191
|
-
var
|
|
190
|
+
function d(e, n, i, m, O, M) {
|
|
191
|
+
var b = i.ref;
|
|
192
192
|
return e = {
|
|
193
|
-
$$typeof:
|
|
193
|
+
$$typeof: R,
|
|
194
194
|
type: e,
|
|
195
195
|
key: n,
|
|
196
|
-
props:
|
|
197
|
-
_owner:
|
|
198
|
-
}, (
|
|
196
|
+
props: i,
|
|
197
|
+
_owner: m
|
|
198
|
+
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(e, "ref", {
|
|
199
199
|
enumerable: !1,
|
|
200
|
-
get:
|
|
200
|
+
get: _
|
|
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,274 +217,276 @@ function ge() {
|
|
|
217
217
|
configurable: !1,
|
|
218
218
|
enumerable: !1,
|
|
219
219
|
writable: !0,
|
|
220
|
-
value:
|
|
220
|
+
value: M
|
|
221
221
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
var
|
|
225
|
-
if (
|
|
226
|
-
if (
|
|
227
|
-
if (
|
|
228
|
-
for (
|
|
229
|
-
|
|
230
|
-
Object.freeze && Object.freeze(
|
|
223
|
+
function f(e, n, i, m, O, M) {
|
|
224
|
+
var b = n.children;
|
|
225
|
+
if (b !== void 0)
|
|
226
|
+
if (m)
|
|
227
|
+
if (ie(b)) {
|
|
228
|
+
for (m = 0; m < b.length; m++)
|
|
229
|
+
p(b[m]);
|
|
230
|
+
Object.freeze && Object.freeze(b);
|
|
231
231
|
} else
|
|
232
232
|
console.error(
|
|
233
233
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
234
234
|
);
|
|
235
|
-
else
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
var k = Object.keys(n).filter(function(
|
|
239
|
-
return
|
|
235
|
+
else p(b);
|
|
236
|
+
if (J.call(n, "key")) {
|
|
237
|
+
b = t(e);
|
|
238
|
+
var k = Object.keys(n).filter(function(fe) {
|
|
239
|
+
return fe !== "key";
|
|
240
240
|
});
|
|
241
|
-
|
|
241
|
+
m = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", B[b + m] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
242
242
|
`A props object containing a "key" prop is being spread into JSX:
|
|
243
243
|
let props = %s;
|
|
244
244
|
<%s {...props} />
|
|
245
245
|
React keys must be passed directly to JSX without using spread:
|
|
246
246
|
let props = %s;
|
|
247
247
|
<%s key={someKey} {...props} />`,
|
|
248
|
-
d,
|
|
249
248
|
m,
|
|
249
|
+
b,
|
|
250
250
|
k,
|
|
251
|
-
|
|
252
|
-
),
|
|
251
|
+
b
|
|
252
|
+
), B[b + m] = !0);
|
|
253
253
|
}
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
for (var
|
|
257
|
-
|
|
258
|
-
} else
|
|
259
|
-
return
|
|
260
|
-
|
|
254
|
+
if (b = null, i !== void 0 && (o(i), b = "" + i), u(n) && (o(n.key), b = "" + n.key), "key" in n) {
|
|
255
|
+
i = {};
|
|
256
|
+
for (var L in n)
|
|
257
|
+
L !== "key" && (i[L] = n[L]);
|
|
258
|
+
} else i = n;
|
|
259
|
+
return b && l(
|
|
260
|
+
i,
|
|
261
261
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
262
|
-
),
|
|
262
|
+
), d(
|
|
263
263
|
e,
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
b,
|
|
265
|
+
i,
|
|
266
266
|
r(),
|
|
267
267
|
O,
|
|
268
|
-
|
|
268
|
+
M
|
|
269
269
|
);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
|
|
271
|
+
function p(e) {
|
|
272
|
+
S(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === Y && (e._payload.status === "fulfilled" ? S(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
274
|
+
function S(e) {
|
|
275
|
+
return typeof e == "object" && e !== null && e.$$typeof === R;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
277
|
+
var T = de, R = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), h = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), se = Symbol.for("react.suspense_list"), ce = Symbol.for("react.memo"), Y = Symbol.for("react.lazy"), ue = Symbol.for("react.activity"), le = Symbol.for("react.client.reference"), D = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ie = Array.isArray, F = console.createTask ? console.createTask : function() {
|
|
278
278
|
return null;
|
|
279
279
|
};
|
|
280
|
-
|
|
280
|
+
T = {
|
|
281
281
|
react_stack_bottom_frame: function(e) {
|
|
282
282
|
return e();
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
var
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
)(),
|
|
289
|
-
|
|
290
|
-
var
|
|
291
|
-
return
|
|
285
|
+
var U, q = {}, G = T.react_stack_bottom_frame.bind(
|
|
286
|
+
T,
|
|
287
|
+
c
|
|
288
|
+
)(), X = F(a(c)), B = {};
|
|
289
|
+
A.Fragment = E, A.jsx = function(e, n, i) {
|
|
290
|
+
var m = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
291
|
+
return f(
|
|
292
292
|
e,
|
|
293
293
|
n,
|
|
294
|
-
|
|
294
|
+
i,
|
|
295
295
|
!1,
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
m ? Error("react-stack-top-frame") : G,
|
|
297
|
+
m ? F(a(e)) : X
|
|
298
298
|
);
|
|
299
|
-
},
|
|
300
|
-
var
|
|
301
|
-
return
|
|
299
|
+
}, A.jsxs = function(e, n, i) {
|
|
300
|
+
var m = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
301
|
+
return f(
|
|
302
302
|
e,
|
|
303
303
|
n,
|
|
304
|
-
|
|
304
|
+
i,
|
|
305
305
|
!0,
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
m ? Error("react-stack-top-frame") : G,
|
|
307
|
+
m ? F(a(e)) : X
|
|
308
308
|
);
|
|
309
309
|
};
|
|
310
|
-
})()),
|
|
310
|
+
})()), A;
|
|
311
311
|
}
|
|
312
|
-
var
|
|
312
|
+
var Q;
|
|
313
313
|
function he() {
|
|
314
|
-
return
|
|
314
|
+
return Q || (Q = 1, process.env.NODE_ENV === "production" ? j.exports = Te() : j.exports = ye()), j.exports;
|
|
315
315
|
}
|
|
316
|
-
var
|
|
317
|
-
const
|
|
316
|
+
var ge = he();
|
|
317
|
+
const oe = me({
|
|
318
318
|
stateVocab: {},
|
|
319
319
|
setStateVocab: () => {
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
|
-
function
|
|
323
|
-
return
|
|
322
|
+
function ke() {
|
|
323
|
+
return be(oe);
|
|
324
324
|
}
|
|
325
|
-
const
|
|
326
|
-
const { children:
|
|
327
|
-
return
|
|
328
|
-
},
|
|
329
|
-
const
|
|
330
|
-
return
|
|
331
|
-
},
|
|
332
|
-
const { serialized:
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
335
|
-
return typeof
|
|
325
|
+
const Oe = (t) => {
|
|
326
|
+
const { children: s, verbose: o } = t, [a, r] = re({});
|
|
327
|
+
return o && Re(a), /* @__PURE__ */ ge.jsx(oe.Provider, { value: { stateVocab: a, setStateVocab: r }, children: s });
|
|
328
|
+
}, N = (t, s) => (o) => {
|
|
329
|
+
const a = { ...o };
|
|
330
|
+
return pe(a, t, s), a;
|
|
331
|
+
}, K = (t) => {
|
|
332
|
+
const { serialized: s, defaultValue: o, superDefaultValue: a, deserialize: r } = t;
|
|
333
|
+
if (s === null) {
|
|
334
|
+
const c = $(o) ?? a;
|
|
335
|
+
return typeof c > "u" ? void 0 : c;
|
|
336
336
|
}
|
|
337
|
-
return r(
|
|
338
|
-
},
|
|
339
|
-
function
|
|
337
|
+
return r(s);
|
|
338
|
+
}, we = (t) => typeof t == "function", Pe = (t) => typeof t == "function", $ = (t) => Pe(t) ? t() : t, xe = typeof window > "u";
|
|
339
|
+
function Ve(t = {}) {
|
|
340
340
|
const {
|
|
341
|
-
serialize:
|
|
342
|
-
deserialize:
|
|
343
|
-
} = t,
|
|
341
|
+
serialize: s = JSON.stringify,
|
|
342
|
+
deserialize: o = JSON.parse
|
|
343
|
+
} = t, a = t.defaultValue, r = t.bidirectional, c = t.autoSet, u = xe ? void 0 : $(t.storage);
|
|
344
344
|
return {
|
|
345
|
-
[
|
|
345
|
+
[ne]: !0,
|
|
346
346
|
// marks this object as a leaf in the router tree
|
|
347
|
-
[
|
|
347
|
+
[W]: !1,
|
|
348
348
|
// placeholder; injected at runtime by injectPaths()
|
|
349
|
-
[
|
|
349
|
+
[C]: "",
|
|
350
350
|
// placeholder; injected at runtime by injectPaths()
|
|
351
|
-
useState(
|
|
352
|
-
|
|
353
|
-
const
|
|
354
|
-
|
|
351
|
+
useState(l) {
|
|
352
|
+
l ??= {};
|
|
353
|
+
const _ = Se(
|
|
354
|
+
l.onSet ?? (() => {
|
|
355
355
|
}),
|
|
356
|
-
|
|
356
|
+
l.delayedSet,
|
|
357
357
|
[]
|
|
358
|
-
),
|
|
359
|
-
|
|
360
|
-
const
|
|
358
|
+
), d = ke(), f = this[C], p = this[W], [S, T] = re(!p);
|
|
359
|
+
V(() => T(!0), []);
|
|
360
|
+
const R = z(
|
|
361
361
|
() => {
|
|
362
|
-
if (!
|
|
362
|
+
if (!S || !u)
|
|
363
363
|
return;
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
superDefaultValue:
|
|
369
|
-
deserialize:
|
|
364
|
+
const v = u.getItem(f);
|
|
365
|
+
return K({
|
|
366
|
+
defaultValue: l.defaultValue,
|
|
367
|
+
serialized: v,
|
|
368
|
+
superDefaultValue: a,
|
|
369
|
+
deserialize: o
|
|
370
370
|
});
|
|
371
371
|
},
|
|
372
372
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
373
|
-
[
|
|
374
|
-
),
|
|
373
|
+
[f, S]
|
|
374
|
+
), g = z(
|
|
375
375
|
() => Ee(
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
d.stateVocab,
|
|
377
|
+
f,
|
|
378
|
+
R ?? $(l.defaultValue) ?? a
|
|
379
379
|
),
|
|
380
380
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
381
381
|
[
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
d.stateVocab,
|
|
383
|
+
R,
|
|
384
|
+
f
|
|
385
385
|
]
|
|
386
386
|
);
|
|
387
|
-
|
|
387
|
+
V(
|
|
388
388
|
() => {
|
|
389
|
-
!
|
|
389
|
+
!u || typeof R > "u" || d.setStateVocab(N(f, R));
|
|
390
390
|
},
|
|
391
391
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
392
|
-
[
|
|
393
|
-
),
|
|
394
|
-
if (!
|
|
392
|
+
[R]
|
|
393
|
+
), V(() => {
|
|
394
|
+
if (!l.bidirectional && !r)
|
|
395
395
|
return;
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
396
|
+
const v = (h) => {
|
|
397
|
+
if (h.key !== f)
|
|
398
398
|
return;
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
deserialize:
|
|
399
|
+
const I = h.newValue, P = K({
|
|
400
|
+
defaultValue: l.defaultValue,
|
|
401
|
+
superDefaultValue: a,
|
|
402
|
+
serialized: I,
|
|
403
|
+
deserialize: o
|
|
404
404
|
});
|
|
405
|
-
|
|
405
|
+
d.setStateVocab(N(f, P)), _(P, E.current), E.current = P;
|
|
406
406
|
};
|
|
407
|
-
return window.addEventListener("storage",
|
|
407
|
+
return window.addEventListener("storage", v), () => window.removeEventListener("storage", v);
|
|
408
408
|
}, [
|
|
409
|
-
|
|
410
|
-
|
|
409
|
+
f,
|
|
410
|
+
l.bidirectional,
|
|
411
411
|
r
|
|
412
412
|
]);
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
h,
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
const v = L(i, s);
|
|
422
|
-
if (typeof v > "u") {
|
|
423
|
-
o?.removeItem(l);
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
f.setStateVocab(j(l, v)), S(v, p.current), p.current = v, o && o.setItem(l, c(v));
|
|
413
|
+
const E = ve(g), y = (v) => {
|
|
414
|
+
const h = we(v) ? v(E.current) : v;
|
|
415
|
+
d.setStateVocab(N(f, h)), _(h, E.current), u && u.setItem(f, s(h)), E.current = h;
|
|
416
|
+
}, w = () => {
|
|
417
|
+
const v = $(l.defaultValue) ?? a;
|
|
418
|
+
if (typeof v > "u") {
|
|
419
|
+
u?.removeItem(f);
|
|
420
|
+
return;
|
|
427
421
|
}
|
|
422
|
+
d.setStateVocab(N(f, v)), _(v, E.current), E.current = v, u && u.setItem(f, s(v));
|
|
423
|
+
};
|
|
424
|
+
return V(() => {
|
|
425
|
+
(l.autoSet || c) && y(g);
|
|
426
|
+
}, []), [
|
|
427
|
+
g,
|
|
428
|
+
y,
|
|
429
|
+
w
|
|
428
430
|
];
|
|
429
431
|
},
|
|
430
432
|
/** Returns the fully qualified job name (dot-separated path). */
|
|
431
433
|
toString() {
|
|
432
|
-
return this[
|
|
434
|
+
return this[C];
|
|
433
435
|
}
|
|
434
436
|
};
|
|
435
437
|
}
|
|
436
|
-
const
|
|
437
|
-
function
|
|
438
|
-
|
|
438
|
+
const ee = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap();
|
|
439
|
+
function ae(t, s) {
|
|
440
|
+
s ??= {};
|
|
439
441
|
const {
|
|
440
|
-
path:
|
|
441
|
-
ssr:
|
|
442
|
-
} =
|
|
443
|
-
let r =
|
|
444
|
-
r || (r = /* @__PURE__ */ new Map(),
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
return
|
|
448
|
-
const
|
|
449
|
-
get(
|
|
450
|
-
const
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
return
|
|
458
|
-
const
|
|
459
|
-
(
|
|
460
|
-
),
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
(...
|
|
442
|
+
path: o = "",
|
|
443
|
+
ssr: a
|
|
444
|
+
} = s;
|
|
445
|
+
let r = ee.get(t);
|
|
446
|
+
r || (r = /* @__PURE__ */ new Map(), ee.set(t, r));
|
|
447
|
+
const c = r.get(o);
|
|
448
|
+
if (c)
|
|
449
|
+
return c;
|
|
450
|
+
const u = new Proxy(t, {
|
|
451
|
+
get(l, _) {
|
|
452
|
+
const d = l[_], f = o ? `${o}.${String(_)}` : String(_);
|
|
453
|
+
if (d && typeof d == "object" && ne in d) {
|
|
454
|
+
const p = d;
|
|
455
|
+
let S = te.get(p);
|
|
456
|
+
S || (S = /* @__PURE__ */ new Map(), te.set(p, S));
|
|
457
|
+
const T = S.get(f);
|
|
458
|
+
if (T)
|
|
459
|
+
return T;
|
|
460
|
+
const R = Reflect.ownKeys(p).filter(
|
|
461
|
+
(y) => typeof p[y] == "function"
|
|
462
|
+
), g = Object.fromEntries(
|
|
463
|
+
R.map((y) => [
|
|
464
|
+
y,
|
|
465
|
+
(...w) => p[y].call(
|
|
464
466
|
{
|
|
465
|
-
...
|
|
466
|
-
[
|
|
467
|
-
[
|
|
467
|
+
...p,
|
|
468
|
+
[C]: f,
|
|
469
|
+
[W]: a
|
|
468
470
|
},
|
|
469
|
-
...
|
|
471
|
+
...w
|
|
470
472
|
)
|
|
471
473
|
])
|
|
472
|
-
),
|
|
473
|
-
return
|
|
474
|
+
), E = { ...p, ...g };
|
|
475
|
+
return S.set(f, E), E;
|
|
474
476
|
}
|
|
475
|
-
return
|
|
476
|
-
path:
|
|
477
|
-
ssr:
|
|
478
|
-
}) :
|
|
477
|
+
return d && typeof d == "object" ? ae(d, {
|
|
478
|
+
path: f,
|
|
479
|
+
ssr: a
|
|
480
|
+
}) : d;
|
|
479
481
|
}
|
|
480
482
|
});
|
|
481
|
-
return r.set(
|
|
483
|
+
return r.set(o, u), u;
|
|
482
484
|
}
|
|
483
|
-
function
|
|
484
|
-
return
|
|
485
|
+
function je(t, s) {
|
|
486
|
+
return ae(t, s);
|
|
485
487
|
}
|
|
486
488
|
export {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
489
|
+
Oe as StorageProvider,
|
|
490
|
+
Ve as defineState,
|
|
491
|
+
je as setupStorage
|
|
490
492
|
};
|
package/dist/types/state.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function defineState<T>(definitionOptions?: {
|
|
|
4
4
|
storage?: ValueOrFactory<Storage>;
|
|
5
5
|
defaultValue?: T;
|
|
6
6
|
bidirectional?: true;
|
|
7
|
+
autoSet?: true;
|
|
7
8
|
serialize?: (v: T) => string;
|
|
8
9
|
deserialize?: (v: string) => T;
|
|
9
10
|
}): {
|
|
@@ -13,9 +14,11 @@ export declare function defineState<T>(definitionOptions?: {
|
|
|
13
14
|
useState<D = T>(this: {
|
|
14
15
|
[STATE_PATH]: string;
|
|
15
16
|
[STATE_SSR_SUPPORT]: boolean;
|
|
16
|
-
},
|
|
17
|
+
}, options?: {
|
|
18
|
+
defaultValue?: ValueOrFactory<D>;
|
|
17
19
|
delayedSet?: number;
|
|
18
20
|
bidirectional?: true;
|
|
21
|
+
autoSet?: true;
|
|
19
22
|
onSet?(nextValue: NoInfer<D>, prevValue: NoInfer<D>): void;
|
|
20
23
|
}): readonly [D, (nextValue: ValueOrTransformer<D>) => void, () => void];
|
|
21
24
|
/** Returns the fully qualified job name (dot-separated path). */
|
|
@@ -3,7 +3,6 @@ import type { ValueOrTransformer, Transformer, ValueOrFactory } from "./types";
|
|
|
3
3
|
export declare const embed: <D>(statePath: string, value: D) => (vocab: Vocab<D>) => {
|
|
4
4
|
[x: string]: D;
|
|
5
5
|
};
|
|
6
|
-
export declare const genDefaultValue: <V>(defaultValue: ValueOrFactory<V>, superDefaltValue: unknown) => V;
|
|
7
6
|
export declare const genStoredValue: <V>(options: {
|
|
8
7
|
serialized: string | null;
|
|
9
8
|
defaultValue: ValueOrFactory<V>;
|