@yakocloud/state-vocab 2.1.3 → 2.3.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 +261 -276
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/state.d.ts +8 -7
- package/dist/types/{types.d.ts → state.types.d.ts} +2 -0
- package/dist/types/state.utils.d.ts +2 -4
- package/package.json +4 -3
- package/dist/types/main.d.ts +0 -1
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"),L=Symbol("state-ssr");function fe(t,a,s){if(!a)return t;const n=a.split(".");let r=t;for(const c of n)if(r!==null&&typeof r=="object"&&c in r)r=r[c];else return s;return r===void 0?s:r}function de(t,a,s){const n=a.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(let c=0;c<n.length-1;c++){const i=n[c],b=n[c+1];(r[i]===void 0||r[i]===null)&&(r[i]=/^\d+$/.test(b)?[]:{}),r=r[i]}return r[n[n.length-1]]=s,t}function me(t,a=0){let s;return function(...n){s!==void 0&&clearTimeout(s),s=setTimeout(()=>{s=void 0,t.apply(this,n)},a)}}function be(t,a,s=[]){return S.useMemo(()=>me(t,a),s)}function ve(t){const a=JSON.stringify(t,null,2).split(`
|
|
2
|
+
`),s=[],n=[];for(const r of a){const c=r.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);if(c){const[,i,b,v,u]=c;s.push(`${i}%c"${b}"%c${v}%c${u}`),n.push("color: #9cdcfe; font-weight: bold","color: #cccccc","color: #ce9178")}else s.push(`%c${r}`),n.push("color: #cccccc")}console.log(s.join(`
|
|
3
|
+
`),...n,t)}var V={exports:{}},x={};var B;function Ee(){if(B)return x;B=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function s(n,r,c){var i=null;if(c!==void 0&&(i=""+c),r.key!==void 0&&(i=""+r.key),"key"in r){c={};for(var b in r)b!=="key"&&(c[b]=r[b])}else c=r;return r=c.ref,{$$typeof:t,type:n,key:i,ref:r!==void 0?r:null,props:c}}return x.Fragment=a,x.jsx=s,x.jsxs=s,x}var O={};var H;function Se(){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===ue?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case m:return"Profiler";case k:return"StrictMode";case oe:return"Suspense";case ae:return"SuspenseList";case ce: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 $:return e.displayName||"Context";case g:return(e._context.displayName||"Context")+".Consumer";case w:var o=e.render;return e=e.displayName,e||(e=o.displayName||o.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return o=e.displayName||null,o!==null?o:t(e.type)||"Memo";case I:o=e._payload,e=e._init;try{return t(e(o))}catch{}}return null}function a(e){return""+e}function s(e){try{a(e);var o=!1}catch{o=!0}if(o){o=console;var l=o.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),a(e)}}function n(e){if(e===h)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===I)return"<...>";try{var o=t(e);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function r(){var e=M.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function i(e){if(W.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function b(e,o){function l(){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)",o))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function v(){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 u(e,o,l,f,j,D){var d=l.ref;return e={$$typeof:T,type:e,key:o,props:l,_owner:f},(d!==void 0?d:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:v}):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:D}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function y(e,o,l,f,j,D){var d=o.children;if(d!==void 0)if(f)if(le(d)){for(f=0;f<d.length;f++)E(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 E(d);if(W.call(o,"key")){d=t(e);var P=Object.keys(o).filter(function(ie){return ie!=="key"});f=0<P.length?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}",X[d+f]||(P=0<P.length?"{"+P.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} />`,d,
|
|
8
|
+
<%s key={someKey} {...props} />`,f,d,P,d),X[d+f]=!0)}if(d=null,l!==void 0&&(s(l),d=""+l),i(o)&&(s(o.key),d=""+o.key),"key"in o){l={};for(var F in o)F!=="key"&&(l[F]=o[F])}else l=o;return d&&b(l,typeof e=="function"?e.displayName||e.name||"Unknown":e),u(e,d,l,r(),j,D)}function E(e){p(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===I&&(e._payload.status==="fulfilled"?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}var R=S,T=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),$=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),oe=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),M=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,le=Array.isArray,Y=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(e){return e()}};var J,U={},q=R.react_stack_bottom_frame.bind(R,c)(),G=Y(n(c)),X={};O.Fragment=h,O.jsx=function(e,o,l){var f=1e4>M.recentlyCreatedOwnerStacks++;return y(e,o,l,!1,f?Error("react-stack-top-frame"):q,f?Y(n(e)):G)},O.jsxs=function(e,o,l){var f=1e4>M.recentlyCreatedOwnerStacks++;return y(e,o,l,!0,f?Error("react-stack-top-frame"):q,f?Y(n(e)):G)}})()),O}var Z;function _e(){return Z||(Z=1,process.env.NODE_ENV==="production"?V.exports=Ee():V.exports=Se()),V.exports}var pe=_e();const re=S.createContext({stateVocab:{},setStateVocab:()=>{}});function Re(){return S.useContext(re)}const Te=t=>{const{children:a,verbose:s}=t,[n,r]=S.useState({});return s&&ve(n),pe.jsx(re.Provider,{value:{stateVocab:n,setStateVocab:r},children:a})},N=(t,a)=>s=>{const n={...s};return de(n,t,a),n},Q=t=>{const{serialized:a,deserialize:s}=t;return a===null?null:s(a)},ye=t=>typeof t=="function",ge=t=>typeof t=="function",z=t=>typeof t<"u",A=t=>ge(t)?t():t,he=typeof window>"u";function ke(t={}){const a=he?void 0:A(t.storage),s=t.bidirectional;return{[te]:!0,[L]:!1,[C]:"",useState(n){const r=t.serialize??JSON.stringify,c=t.deserialize??JSON.parse,i=t.defaultValue;n??={};const b=be(n.onSet??(()=>{}),n.delayedSet,[]),v=Re(),u=this[C],y=this[L],[E,p]=S.useState(!y);S.useEffect(()=>p(!0),[]);const R=S.useMemo(()=>{if(!E||!a)return;const m=a.getItem(u);return Q({deserialize:c,serialized:m})??A(n.defaultValue)??i},[E]),T=S.useMemo(()=>fe(v.stateVocab,u,R??A(n.defaultValue)??i),[v.stateVocab,R,u]);S.useEffect(()=>{z(T)&&v.setStateVocab(N(u,T))},[T]),S.useEffect(()=>{if(!n.bidirectional&&!s)return;const m=g=>{if(g.key!==u)return;const $=g.newValue,w=Q({serialized:$,deserialize:c})??A(n.defaultValue)??i;z(w)&&(v.setStateVocab(N(u,w)),b(w,_.current),_.current=w)};return window.addEventListener("storage",m),()=>window.removeEventListener("storage",m)},[u,n.bidirectional,s]);const _=S.useRef(T);return[T,m=>{const g=ye(m)?m(_.current):m;v.setStateVocab(N(u,g)),b(g,_.current),a&&a.setItem(u,r(g)),_.current=g},()=>{const m=A(n.defaultValue)??i;if(!z(m)){a?.removeItem(u);return}v.setStateVocab(N(u,m)),b(m,_.current),_.current=m,a&&a.setItem(u,r(m))}]},toString(){return this[C]}}}const K=new WeakMap,ee=new WeakMap;function ne(t,a){a??={};const{path:s="",ssr:n}=a;let r=K.get(t);r||(r=new Map,K.set(t,r));const c=r.get(s);if(c)return c;const i=new Proxy(t,{get(b,v){const u=b[v],y=s?`${s}.${String(v)}`:String(v);if(u&&typeof u=="object"&&te in u){const E=u;let p=ee.get(E);p||(p=new Map,ee.set(E,p));const R=p.get(y);if(R)return R;const T=Reflect.ownKeys(E).filter(k=>typeof E[k]=="function"),_=Object.fromEntries(T.map(k=>[k,(...m)=>E[k].call({...E,[C]:y,[L]:n},...m)])),h={...E,..._};return p.set(y,h),h}return u&&typeof u=="object"?ne(u,{path:y,ssr:n}):u}});return r.set(s,i),i}function we(t,a){return ne(t,a)}exports.StorageProvider=Te;exports.defineState=ke;exports.setupStorage=we;
|
package/dist/state-vocab.es.js
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import me, { useMemo as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
if (!
|
|
1
|
+
import me, { useMemo as L, createContext as be, useState as re, useContext as ve, useEffect as M, useRef as Ee } from "react";
|
|
2
|
+
const ne = Symbol("state-def"), N = Symbol("state-path"), W = Symbol("state-ssr");
|
|
3
|
+
function _e(t, a, s) {
|
|
4
|
+
if (!a)
|
|
5
5
|
return t;
|
|
6
|
-
const
|
|
6
|
+
const n = a.split(".");
|
|
7
7
|
let r = t;
|
|
8
|
-
for (const
|
|
9
|
-
if (r !== null && typeof r == "object" &&
|
|
10
|
-
r = r[
|
|
8
|
+
for (const c of n)
|
|
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 s;
|
|
13
|
+
return r === void 0 ? s : r;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
15
|
+
function pe(t, a, s) {
|
|
16
|
+
const n = a.replace(/\[(\d+)\]/g, ".$1").split(".");
|
|
17
17
|
let r = t;
|
|
18
|
-
for (let
|
|
19
|
-
const i =
|
|
18
|
+
for (let c = 0; c < n.length - 1; c++) {
|
|
19
|
+
const i = n[c], b = n[c + 1];
|
|
20
20
|
(r[i] === void 0 || r[i] === null) && (r[i] = /^\d+$/.test(b) ? [] : {}), r = r[i];
|
|
21
21
|
}
|
|
22
|
-
return r[
|
|
22
|
+
return r[n[n.length - 1]] = s, t;
|
|
23
23
|
}
|
|
24
|
-
function Se(t,
|
|
25
|
-
let
|
|
26
|
-
return function(...
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
24
|
+
function Se(t, a = 0) {
|
|
25
|
+
let s;
|
|
26
|
+
return function(...n) {
|
|
27
|
+
s !== void 0 && clearTimeout(s), s = setTimeout(() => {
|
|
28
|
+
s = void 0, t.apply(this, n);
|
|
29
|
+
}, a);
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function Re(t,
|
|
33
|
-
return
|
|
34
|
-
() => Se(t,
|
|
32
|
+
function Re(t, a, s = []) {
|
|
33
|
+
return L(
|
|
34
|
+
() => Se(t, a),
|
|
35
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
-
|
|
36
|
+
s
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
function Te(t) {
|
|
40
|
-
const
|
|
41
|
-
`),
|
|
42
|
-
for (const r of
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const [, i, b,
|
|
46
|
-
|
|
40
|
+
const a = JSON.stringify(t, null, 2).split(`
|
|
41
|
+
`), s = [], n = [];
|
|
42
|
+
for (const r of a) {
|
|
43
|
+
const c = r.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);
|
|
44
|
+
if (c) {
|
|
45
|
+
const [, i, b, v, u] = c;
|
|
46
|
+
s.push(`${i}%c"${b}"%c${v}%c${u}`), n.push(
|
|
47
47
|
"color: #9cdcfe; font-weight: bold",
|
|
48
48
|
"color: #cccccc",
|
|
49
49
|
"color: #ce9178"
|
|
50
50
|
);
|
|
51
51
|
} else
|
|
52
|
-
|
|
52
|
+
s.push(`%c${r}`), n.push("color: #cccccc");
|
|
53
53
|
}
|
|
54
|
-
console.log(
|
|
55
|
-
`), ...
|
|
54
|
+
console.log(s.join(`
|
|
55
|
+
`), ...n, t);
|
|
56
56
|
}
|
|
57
|
-
var
|
|
58
|
-
var
|
|
57
|
+
var j = { exports: {} }, P = {};
|
|
58
|
+
var H;
|
|
59
59
|
function ye() {
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
var t = Symbol.for("react.transitional.element"),
|
|
63
|
-
function
|
|
60
|
+
if (H) return P;
|
|
61
|
+
H = 1;
|
|
62
|
+
var t = Symbol.for("react.transitional.element"), a = Symbol.for("react.fragment");
|
|
63
|
+
function s(n, r, c) {
|
|
64
64
|
var i = null;
|
|
65
|
-
if (
|
|
66
|
-
|
|
65
|
+
if (c !== void 0 && (i = "" + c), r.key !== void 0 && (i = "" + r.key), "key" in r) {
|
|
66
|
+
c = {};
|
|
67
67
|
for (var b in r)
|
|
68
|
-
b !== "key" && (
|
|
69
|
-
} else
|
|
70
|
-
return r =
|
|
68
|
+
b !== "key" && (c[b] = r[b]);
|
|
69
|
+
} else c = r;
|
|
70
|
+
return r = c.ref, {
|
|
71
71
|
$$typeof: t,
|
|
72
|
-
type:
|
|
72
|
+
type: n,
|
|
73
73
|
key: i,
|
|
74
74
|
ref: r !== void 0 ? r : null,
|
|
75
|
-
props:
|
|
75
|
+
props: c
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
return P.Fragment =
|
|
78
|
+
return P.Fragment = a, P.jsx = s, P.jsxs = s, P;
|
|
79
79
|
}
|
|
80
80
|
var x = {};
|
|
81
|
-
var
|
|
82
|
-
function
|
|
83
|
-
return
|
|
81
|
+
var Z;
|
|
82
|
+
function he() {
|
|
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
87
|
return e.$$typeof === ie ? null : e.displayName || e.name || null;
|
|
88
88
|
if (typeof e == "string") return e;
|
|
89
89
|
switch (e) {
|
|
90
|
-
case
|
|
90
|
+
case h:
|
|
91
91
|
return "Fragment";
|
|
92
|
-
case
|
|
92
|
+
case m:
|
|
93
93
|
return "Profiler";
|
|
94
|
-
case
|
|
94
|
+
case g:
|
|
95
95
|
return "StrictMode";
|
|
96
96
|
case se:
|
|
97
97
|
return "Suspense";
|
|
@@ -104,100 +104,100 @@ function ge() {
|
|
|
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 _:
|
|
108
108
|
return "Portal";
|
|
109
|
-
case
|
|
109
|
+
case C:
|
|
110
110
|
return e.displayName || "Context";
|
|
111
|
-
case
|
|
111
|
+
case y:
|
|
112
112
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
113
|
-
case
|
|
114
|
-
var
|
|
115
|
-
return e = e.displayName, e || (e =
|
|
113
|
+
case k:
|
|
114
|
+
var o = e.render;
|
|
115
|
+
return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
116
116
|
case ue:
|
|
117
|
-
return
|
|
118
|
-
case
|
|
119
|
-
|
|
117
|
+
return o = e.displayName || null, o !== null ? o : t(e.type) || "Memo";
|
|
118
|
+
case $:
|
|
119
|
+
o = e._payload, e = e._init;
|
|
120
120
|
try {
|
|
121
|
-
return t(e(
|
|
121
|
+
return t(e(o));
|
|
122
122
|
} catch {
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function a(e) {
|
|
128
128
|
return "" + e;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function s(e) {
|
|
131
131
|
try {
|
|
132
|
-
|
|
133
|
-
var
|
|
132
|
+
a(e);
|
|
133
|
+
var o = !1;
|
|
134
134
|
} catch {
|
|
135
|
-
|
|
135
|
+
o = !0;
|
|
136
136
|
}
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
var
|
|
140
|
-
return
|
|
141
|
-
|
|
137
|
+
if (o) {
|
|
138
|
+
o = console;
|
|
139
|
+
var l = o.error, f = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
140
|
+
return l.call(
|
|
141
|
+
o,
|
|
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
|
+
f
|
|
144
|
+
), a(e);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
if (e ===
|
|
149
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
147
|
+
function n(e) {
|
|
148
|
+
if (e === h) return "<>";
|
|
149
|
+
if (typeof e == "object" && e !== null && e.$$typeof === $)
|
|
150
150
|
return "<...>";
|
|
151
151
|
try {
|
|
152
|
-
var
|
|
153
|
-
return
|
|
152
|
+
var o = t(e);
|
|
153
|
+
return o ? "<" + o + ">" : "<...>";
|
|
154
154
|
} catch {
|
|
155
155
|
return "<...>";
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
function r() {
|
|
159
|
-
var e =
|
|
159
|
+
var e = I.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
165
|
function i(e) {
|
|
166
|
-
if (
|
|
167
|
-
var
|
|
168
|
-
if (
|
|
166
|
+
if (J.call(e, "key")) {
|
|
167
|
+
var o = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
168
|
+
if (o && o.isReactWarning) return !1;
|
|
169
169
|
}
|
|
170
170
|
return e.key !== void 0;
|
|
171
171
|
}
|
|
172
|
-
function b(e,
|
|
173
|
-
function
|
|
174
|
-
|
|
172
|
+
function b(e, o) {
|
|
173
|
+
function l() {
|
|
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
|
+
o
|
|
177
177
|
));
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
get:
|
|
179
|
+
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
180
|
+
get: l,
|
|
181
181
|
configurable: !0
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function v() {
|
|
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 u(e, o, l, f, O, D) {
|
|
191
|
+
var d = l.ref;
|
|
192
192
|
return e = {
|
|
193
|
-
$$typeof:
|
|
193
|
+
$$typeof: R,
|
|
194
194
|
type: e,
|
|
195
|
-
key:
|
|
196
|
-
props:
|
|
197
|
-
_owner:
|
|
198
|
-
}, (
|
|
195
|
+
key: o,
|
|
196
|
+
props: l,
|
|
197
|
+
_owner: f
|
|
198
|
+
}, (d !== void 0 ? d : null) !== null ? Object.defineProperty(e, "ref", {
|
|
199
199
|
enumerable: !1,
|
|
200
|
-
get:
|
|
200
|
+
get: v
|
|
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,213 +217,198 @@ function ge() {
|
|
|
217
217
|
configurable: !1,
|
|
218
218
|
enumerable: !1,
|
|
219
219
|
writable: !0,
|
|
220
|
-
value:
|
|
220
|
+
value: D
|
|
221
221
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
var
|
|
225
|
-
if (
|
|
226
|
-
if (
|
|
227
|
-
if (fe(
|
|
228
|
-
for (
|
|
229
|
-
|
|
230
|
-
Object.freeze && Object.freeze(
|
|
223
|
+
function T(e, o, l, f, O, D) {
|
|
224
|
+
var d = o.children;
|
|
225
|
+
if (d !== void 0)
|
|
226
|
+
if (f)
|
|
227
|
+
if (fe(d)) {
|
|
228
|
+
for (f = 0; f < d.length; f++)
|
|
229
|
+
E(d[f]);
|
|
230
|
+
Object.freeze && Object.freeze(d);
|
|
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
|
|
235
|
+
else E(d);
|
|
236
|
+
if (J.call(o, "key")) {
|
|
237
|
+
d = t(e);
|
|
238
|
+
var w = Object.keys(o).filter(function(de) {
|
|
239
239
|
return de !== "key";
|
|
240
240
|
});
|
|
241
|
-
|
|
241
|
+
f = 0 < w.length ? "{key: someKey, " + w.join(": ..., ") + ": ...}" : "{key: someKey}", B[d + f] || (w = 0 < w.length ? "{" + w.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
|
+
f,
|
|
248
249
|
d,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
), G[m + d] = !0);
|
|
250
|
+
w,
|
|
251
|
+
d
|
|
252
|
+
), B[d + f] = !0);
|
|
253
253
|
}
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
for (var
|
|
257
|
-
|
|
258
|
-
} else
|
|
259
|
-
return
|
|
260
|
-
|
|
254
|
+
if (d = null, l !== void 0 && (s(l), d = "" + l), i(o) && (s(o.key), d = "" + o.key), "key" in o) {
|
|
255
|
+
l = {};
|
|
256
|
+
for (var F in o)
|
|
257
|
+
F !== "key" && (l[F] = o[F]);
|
|
258
|
+
} else l = o;
|
|
259
|
+
return d && b(
|
|
260
|
+
l,
|
|
261
261
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
262
|
-
),
|
|
262
|
+
), u(
|
|
263
263
|
e,
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
d,
|
|
265
|
+
l,
|
|
266
266
|
r(),
|
|
267
267
|
O,
|
|
268
|
-
|
|
268
|
+
D
|
|
269
269
|
);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
|
|
271
|
+
function E(e) {
|
|
272
|
+
p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === $ && (e._payload.status === "fulfilled" ? p(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 p(e) {
|
|
275
|
+
return typeof e == "object" && e !== null && e.$$typeof === R;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
277
|
+
var S = me, R = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), y = Symbol.for("react.consumer"), C = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), se = Symbol.for("react.suspense"), ce = Symbol.for("react.suspense_list"), ue = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), le = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), I = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, fe = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
278
278
|
return null;
|
|
279
279
|
};
|
|
280
|
-
|
|
280
|
+
S = {
|
|
281
281
|
react_stack_bottom_frame: function(e) {
|
|
282
282
|
return e();
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
var
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
)(),
|
|
289
|
-
x.Fragment =
|
|
290
|
-
var
|
|
291
|
-
return
|
|
285
|
+
var U, q = {}, G = S.react_stack_bottom_frame.bind(
|
|
286
|
+
S,
|
|
287
|
+
c
|
|
288
|
+
)(), X = Y(n(c)), B = {};
|
|
289
|
+
x.Fragment = h, x.jsx = function(e, o, l) {
|
|
290
|
+
var f = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
291
|
+
return T(
|
|
292
292
|
e,
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
o,
|
|
294
|
+
l,
|
|
295
295
|
!1,
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
f ? Error("react-stack-top-frame") : G,
|
|
297
|
+
f ? Y(n(e)) : X
|
|
298
298
|
);
|
|
299
|
-
}, x.jsxs = function(e,
|
|
300
|
-
var
|
|
301
|
-
return
|
|
299
|
+
}, x.jsxs = function(e, o, l) {
|
|
300
|
+
var f = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
301
|
+
return T(
|
|
302
302
|
e,
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
o,
|
|
304
|
+
l,
|
|
305
305
|
!0,
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
f ? Error("react-stack-top-frame") : G,
|
|
307
|
+
f ? Y(n(e)) : X
|
|
308
308
|
);
|
|
309
309
|
};
|
|
310
310
|
})()), x;
|
|
311
311
|
}
|
|
312
|
-
var
|
|
313
|
-
function
|
|
314
|
-
return
|
|
312
|
+
var Q;
|
|
313
|
+
function ge() {
|
|
314
|
+
return Q || (Q = 1, process.env.NODE_ENV === "production" ? j.exports = ye() : j.exports = he()), j.exports;
|
|
315
315
|
}
|
|
316
|
-
var ke =
|
|
317
|
-
const
|
|
316
|
+
var ke = ge();
|
|
317
|
+
const oe = be({
|
|
318
318
|
stateVocab: {},
|
|
319
319
|
setStateVocab: () => {
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
322
|
function we() {
|
|
323
|
-
return ve(
|
|
323
|
+
return ve(oe);
|
|
324
324
|
}
|
|
325
325
|
const je = (t) => {
|
|
326
|
-
const { children:
|
|
327
|
-
return
|
|
328
|
-
},
|
|
329
|
-
const
|
|
330
|
-
return
|
|
331
|
-
},
|
|
332
|
-
const { serialized:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return r(c);
|
|
338
|
-
}, Pe = (t) => typeof t == "function", xe = (t) => typeof t == "function", ne = (t) => xe(t) ? t() : t, Oe = typeof window > "u";
|
|
339
|
-
function Ne(t = {}) {
|
|
340
|
-
const {
|
|
341
|
-
serialize: c = JSON.stringify,
|
|
342
|
-
deserialize: a = JSON.parse
|
|
343
|
-
} = t, s = t.defaultValue, r = t.bidirectional, o = Oe ? void 0 : ne(t.storage);
|
|
326
|
+
const { children: a, verbose: s } = t, [n, r] = re({});
|
|
327
|
+
return s && Te(n), /* @__PURE__ */ ke.jsx(oe.Provider, { value: { stateVocab: n, setStateVocab: r }, children: a });
|
|
328
|
+
}, V = (t, a) => (s) => {
|
|
329
|
+
const n = { ...s };
|
|
330
|
+
return pe(n, t, a), n;
|
|
331
|
+
}, K = (t) => {
|
|
332
|
+
const { serialized: a, deserialize: s } = t;
|
|
333
|
+
return a === null ? null : s(a);
|
|
334
|
+
}, Pe = (t) => typeof t == "function", xe = (t) => typeof t == "function", z = (t) => typeof t < "u", A = (t) => xe(t) ? t() : t, Ae = typeof window > "u";
|
|
335
|
+
function Ve(t = {}) {
|
|
336
|
+
const a = Ae ? void 0 : A(t.storage), s = t.bidirectional;
|
|
344
337
|
return {
|
|
345
|
-
[
|
|
338
|
+
[ne]: !0,
|
|
346
339
|
// marks this object as a leaf in the router tree
|
|
347
|
-
[
|
|
340
|
+
[W]: !1,
|
|
348
341
|
// placeholder; injected at runtime by injectPaths()
|
|
349
342
|
[N]: "",
|
|
350
343
|
// placeholder; injected at runtime by injectPaths()
|
|
351
|
-
useState(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
344
|
+
useState(n) {
|
|
345
|
+
const r = t.serialize ?? JSON.stringify, c = t.deserialize ?? JSON.parse, i = t.defaultValue;
|
|
346
|
+
n ??= {};
|
|
347
|
+
const b = Re(
|
|
348
|
+
n.onSet ?? (() => {
|
|
355
349
|
}),
|
|
356
|
-
|
|
350
|
+
n.delayedSet,
|
|
357
351
|
[]
|
|
358
|
-
),
|
|
359
|
-
|
|
360
|
-
const
|
|
352
|
+
), v = we(), u = this[N], T = this[W], [E, p] = re(!T);
|
|
353
|
+
M(() => p(!0), []);
|
|
354
|
+
const S = L(
|
|
361
355
|
() => {
|
|
362
|
-
if (!
|
|
356
|
+
if (!E || !a)
|
|
363
357
|
return;
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
-
serialized: E,
|
|
367
|
-
defaultValue: i,
|
|
368
|
-
superDefaultValue: s,
|
|
369
|
-
deserialize: a
|
|
370
|
-
});
|
|
358
|
+
const m = a.getItem(u);
|
|
359
|
+
return K({ deserialize: c, serialized: m }) ?? A(n.defaultValue) ?? i;
|
|
371
360
|
},
|
|
372
361
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
373
|
-
[
|
|
374
|
-
),
|
|
375
|
-
() =>
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
362
|
+
[E]
|
|
363
|
+
), R = L(
|
|
364
|
+
() => _e(
|
|
365
|
+
v.stateVocab,
|
|
366
|
+
u,
|
|
367
|
+
// 3rd argument in order to avoid waiting for useEffect execution
|
|
368
|
+
S ?? A(n.defaultValue) ?? i
|
|
379
369
|
),
|
|
380
370
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
381
371
|
[
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
372
|
+
v.stateVocab,
|
|
373
|
+
S,
|
|
374
|
+
u
|
|
385
375
|
]
|
|
386
376
|
);
|
|
387
|
-
|
|
377
|
+
M(
|
|
388
378
|
() => {
|
|
389
|
-
|
|
379
|
+
z(R) && v.setStateVocab(V(u, R));
|
|
390
380
|
},
|
|
391
381
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
392
|
-
[
|
|
393
|
-
),
|
|
394
|
-
if (!
|
|
382
|
+
[R]
|
|
383
|
+
), M(() => {
|
|
384
|
+
if (!n.bidirectional && !s)
|
|
395
385
|
return;
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
386
|
+
const m = (y) => {
|
|
387
|
+
if (y.key !== u)
|
|
398
388
|
return;
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
defaultValue: i,
|
|
402
|
-
superDefaultValue: s,
|
|
403
|
-
deserialize: a
|
|
404
|
-
});
|
|
405
|
-
f.setStateVocab(j(l, w)), S(w, p.current), p.current = w;
|
|
389
|
+
const C = y.newValue, k = K({ serialized: C, deserialize: c }) ?? A(n.defaultValue) ?? i;
|
|
390
|
+
z(k) && (v.setStateVocab(V(u, k)), b(k, _.current), _.current = k);
|
|
406
391
|
};
|
|
407
|
-
return window.addEventListener("storage",
|
|
392
|
+
return window.addEventListener("storage", m), () => window.removeEventListener("storage", m);
|
|
408
393
|
}, [
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
394
|
+
u,
|
|
395
|
+
n.bidirectional,
|
|
396
|
+
s
|
|
412
397
|
]);
|
|
413
|
-
const
|
|
398
|
+
const _ = Ee(R);
|
|
414
399
|
return [
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
|
|
400
|
+
R,
|
|
401
|
+
(m) => {
|
|
402
|
+
const y = Pe(m) ? m(_.current) : m;
|
|
403
|
+
v.setStateVocab(V(u, y)), b(y, _.current), a && a.setItem(u, r(y)), _.current = y;
|
|
419
404
|
},
|
|
420
|
-
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
423
|
-
|
|
405
|
+
() => {
|
|
406
|
+
const m = A(n.defaultValue) ?? i;
|
|
407
|
+
if (!z(m)) {
|
|
408
|
+
a?.removeItem(u);
|
|
424
409
|
return;
|
|
425
410
|
}
|
|
426
|
-
|
|
411
|
+
v.setStateVocab(V(u, m)), b(m, _.current), _.current = m, a && a.setItem(u, r(m));
|
|
427
412
|
}
|
|
428
413
|
];
|
|
429
414
|
},
|
|
@@ -433,58 +418,58 @@ function Ne(t = {}) {
|
|
|
433
418
|
}
|
|
434
419
|
};
|
|
435
420
|
}
|
|
436
|
-
const
|
|
437
|
-
function
|
|
438
|
-
|
|
421
|
+
const ee = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap();
|
|
422
|
+
function ae(t, a) {
|
|
423
|
+
a ??= {};
|
|
439
424
|
const {
|
|
440
|
-
path:
|
|
441
|
-
ssr:
|
|
442
|
-
} =
|
|
443
|
-
let r =
|
|
444
|
-
r || (r = /* @__PURE__ */ new Map(),
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
return
|
|
425
|
+
path: s = "",
|
|
426
|
+
ssr: n
|
|
427
|
+
} = a;
|
|
428
|
+
let r = ee.get(t);
|
|
429
|
+
r || (r = /* @__PURE__ */ new Map(), ee.set(t, r));
|
|
430
|
+
const c = r.get(s);
|
|
431
|
+
if (c)
|
|
432
|
+
return c;
|
|
448
433
|
const i = new Proxy(t, {
|
|
449
|
-
get(b,
|
|
450
|
-
const
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
return
|
|
458
|
-
const
|
|
459
|
-
(
|
|
460
|
-
),
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
(...
|
|
434
|
+
get(b, v) {
|
|
435
|
+
const u = b[v], T = s ? `${s}.${String(v)}` : String(v);
|
|
436
|
+
if (u && typeof u == "object" && ne in u) {
|
|
437
|
+
const E = u;
|
|
438
|
+
let p = te.get(E);
|
|
439
|
+
p || (p = /* @__PURE__ */ new Map(), te.set(E, p));
|
|
440
|
+
const S = p.get(T);
|
|
441
|
+
if (S)
|
|
442
|
+
return S;
|
|
443
|
+
const R = Reflect.ownKeys(E).filter(
|
|
444
|
+
(g) => typeof E[g] == "function"
|
|
445
|
+
), _ = Object.fromEntries(
|
|
446
|
+
R.map((g) => [
|
|
447
|
+
g,
|
|
448
|
+
(...m) => E[g].call(
|
|
464
449
|
{
|
|
465
|
-
...
|
|
466
|
-
[N]:
|
|
467
|
-
[
|
|
450
|
+
...E,
|
|
451
|
+
[N]: T,
|
|
452
|
+
[W]: n
|
|
468
453
|
},
|
|
469
|
-
...
|
|
454
|
+
...m
|
|
470
455
|
)
|
|
471
456
|
])
|
|
472
|
-
),
|
|
473
|
-
return
|
|
457
|
+
), h = { ...E, ..._ };
|
|
458
|
+
return p.set(T, h), h;
|
|
474
459
|
}
|
|
475
|
-
return
|
|
476
|
-
path:
|
|
477
|
-
ssr:
|
|
478
|
-
}) :
|
|
460
|
+
return u && typeof u == "object" ? ae(u, {
|
|
461
|
+
path: T,
|
|
462
|
+
ssr: n
|
|
463
|
+
}) : u;
|
|
479
464
|
}
|
|
480
465
|
});
|
|
481
|
-
return r.set(
|
|
466
|
+
return r.set(s, i), i;
|
|
482
467
|
}
|
|
483
|
-
function
|
|
484
|
-
return
|
|
468
|
+
function Ne(t, a) {
|
|
469
|
+
return ae(t, a);
|
|
485
470
|
}
|
|
486
471
|
export {
|
|
487
472
|
je as StorageProvider,
|
|
488
|
-
|
|
489
|
-
|
|
473
|
+
Ve as defineState,
|
|
474
|
+
Ne as setupStorage
|
|
490
475
|
};
|
package/dist/types/state.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { STATE_DEFINITION, STATE_PATH,
|
|
2
|
-
import type { ValueOrFactory, ValueOrTransformer } from "./types";
|
|
1
|
+
import { STATE_DEFINITION, STATE_PATH, STATE_SSR } from "./constants";
|
|
2
|
+
import type { Deserialize, Serialize, ValueOrFactory, ValueOrTransformer } from "./state.types";
|
|
3
3
|
export declare function defineState<T>(definitionOptions?: {
|
|
4
4
|
storage?: ValueOrFactory<Storage>;
|
|
5
5
|
defaultValue?: T;
|
|
6
6
|
bidirectional?: true;
|
|
7
|
-
serialize?:
|
|
8
|
-
deserialize?:
|
|
7
|
+
serialize?: Serialize<T>;
|
|
8
|
+
deserialize?: Deserialize<T>;
|
|
9
9
|
}): {
|
|
10
10
|
[STATE_DEFINITION]: boolean;
|
|
11
|
-
[
|
|
11
|
+
[STATE_SSR]: boolean;
|
|
12
12
|
[STATE_PATH]: string;
|
|
13
13
|
useState<D = T>(this: {
|
|
14
14
|
[STATE_PATH]: string;
|
|
15
|
-
[
|
|
16
|
-
},
|
|
15
|
+
[STATE_SSR]: boolean;
|
|
16
|
+
}, options?: {
|
|
17
|
+
defaultValue?: ValueOrFactory<D>;
|
|
17
18
|
delayedSet?: number;
|
|
18
19
|
bidirectional?: true;
|
|
19
20
|
onSet?(nextValue: NoInfer<D>, prevValue: NoInfer<D>): void;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Vocab } from "./context";
|
|
2
|
-
import type { ValueOrTransformer, Transformer, ValueOrFactory } from "./types";
|
|
2
|
+
import type { ValueOrTransformer, Transformer, ValueOrFactory } from "./state.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
|
-
defaultValue: ValueOrFactory<V>;
|
|
10
|
-
superDefaultValue: unknown;
|
|
11
8
|
deserialize: (v: string) => V;
|
|
12
9
|
}) => V;
|
|
13
10
|
export declare const isTransformer: <V>(v: ValueOrTransformer<V>) => v is Transformer<V>;
|
|
11
|
+
export declare const isValueDefined: <V>(v: V | undefined) => v is V;
|
|
14
12
|
export declare const valueOrFactory: <V>(input: ValueOrFactory<V>) => V;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yakocloud/state-vocab",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "vite",
|
|
21
|
-
"build": "tsc
|
|
21
|
+
"build": "tsc --project tsconfig.build.json && vite build ; tsc",
|
|
22
22
|
"lint": "eslint .",
|
|
23
|
-
"type-check": "tsc
|
|
23
|
+
"type-check": "tsc",
|
|
24
24
|
"test": "vitest run",
|
|
25
25
|
"test:watch": "vitest",
|
|
26
26
|
"test:report": "npx vitest run --reporter=verbose"
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@eslint/js": "^9.39.1",
|
|
34
34
|
"@testing-library/jest-dom": "^6.9.1",
|
|
35
35
|
"@testing-library/react": "^16.3.2",
|
|
36
|
+
"@types/jest": "^30.0.0",
|
|
36
37
|
"@types/node": "^24.10.1",
|
|
37
38
|
"@types/react": "^19.2.5",
|
|
38
39
|
"@types/react-dom": "^19.2.3",
|
package/dist/types/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|