@yakocloud/state-vocab 3.0.5 → 3.0.7

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.
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),L=Symbol("state-def"),I=Symbol("state-path"),x=Symbol("state-verbose"),A=Symbol("state-verbose-path"),M=Symbol("state-ssr");function $(t,n,e){if(!n)return t;const i=n.split(".");let o=t;for(const c of i)if(o!==null&&typeof o=="object"&&c in o)o=o[c];else return e;return o===void 0?e:o}function F(t,n,e){const i=n.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(let c=0;c<i.length-1;c++){const l=i[c],s=i[c+1];(o[l]===void 0||o[l]===null)&&(o[l]=/^\d+$/.test(s)?[]:{}),o=o[l]}return o[i[i.length-1]]=e,t}function J(t,n=0){let e;return function(...i){e!==void 0&&clearTimeout(e),e=setTimeout(()=>{e=void 0,t.apply(this,i)},n)}}function H(t,n,e=[]){return d.useMemo(()=>J(t,n),e)}function _(t){const n=JSON.stringify(t,null,2).split(`
2
- `),e=[],i=[];for(const o of n){const c=o.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);if(c){const[,l,s,p,b]=c;e.push(`${l}%c"${s}"%c${p}%c${b}`),i.push("color: #9cdcfe; font-weight: bold","color: #cccccc","color: #ce9178")}else e.push(`%c${o}`),i.push("color: #cccccc")}console.log(e.join(`
3
- `),...i,t)}const N=t=>typeof t=="function",K=t=>typeof t=="function",T=t=>typeof t<"u",C=t=>K(t)?t():t;class W{#e;#t;constructor(){this.#e={},this.#t=new Set}subscribe(n){return this.#t.add(n),()=>this.#t.delete(n)}getClientSnapshot(){return this.#e}getServerSnapshot(){return this.#e}get(n){return $(this.#e,n)}set(n,e){const i=$(this.#e,n),o=N(e)?e(i):e,c={...this.#e};F(c,n,o),this.#e=c,this.#t.forEach(l=>l())}}const O=()=>new W,q=d.cache(O);let R=null;const G=()=>(R||(R=O()),R),Q=()=>typeof window>"u"?q():G(),j=typeof window>"u",U=j?d.useEffect:d.useLayoutEffect;function X(t={}){return{[L]:!0,[I]:"",[x]:!1,[A]:"",[M]:!1,useState(n){const e=j?void 0:C(t.storage),i=C(t.defaultValue),o=t.bidirectional;n??={};const c=C(n.defaultValue)??i,l=n.bidirectional??o,s=this[I],p=this[x],b=this[A],V=this[M],a=Q(),u=t.serialize??JSON.stringify,g=t.deserialize??JSON.parse,h=(r,S,P)=>{const E=S.getItem(r);E===null?T(P)&&S.setItem(r,u(P)):a.set(r,g(E))},f=H(n.onSet??(()=>{}),n.delayedSet,[]),y=d.useRef(void 0),k=d.useRef(!1);if(!k.current){k.current=!0;let r=a.get(s);T(r)||(r=c,T(r)&&a.set(s,r)),!V&&e&&h(s,e,r)}const w=d.useSyncExternalStore(a.subscribe.bind(a),a.getClientSnapshot.bind(a),a.getServerSnapshot.bind(a));if(p)if(b){const r=$(w,b);r&&_(r)}else _(w);const m=$(w,s,c);y.current=m,U(()=>{!V||!e||h(s,e,m)},[]);const v=d.useEffectEvent(r=>{if(r.key!==s)return;const S=r.newValue,E=(S===null?null:g(S))??c;T(E)&&(a.set(s,E),f(E,y.current))});d.useEffect(()=>{if(l)return window.addEventListener("storage",v),()=>window.removeEventListener("storage",v)},[l]);const z=d.useCallback(r=>{const S=N(r)?r(y.current):r;a.set(s,S),f(S,y.current),e&&e.setItem(s,u(S))},[s,e,f]),B=d.useCallback(()=>{const r=c;if(!T(r)){e?.removeItem(s);return}a.set(s,r),f(r,y.current),e&&e.setItem(s,u(r))},[s,c,e,f]);return[m,z,B]},toString(){return this[I]}}}function D(t,n){const{path:e="",verbose:i,verbosePath:o,ssr:c,cache:l}=n;let s=l.proxy.get(t);s||(s=new Map,l.proxy.set(t,s));const p=s.get(e);if(p)return p;const b=new Proxy(t,{get(V,a){const u=V[a],g=e?`${e}.${String(a)}`:String(a);if(u&&typeof u=="object"&&L in u){const h=u;let f=l.leaf.get(h);f||(f=new Map,l.leaf.set(h,f));const y=f.get(g);if(y)return y;const k=Reflect.ownKeys(h).filter(v=>typeof h[v]=="function"),w=Object.fromEntries(k.map(v=>[v,(...z)=>h[v].call({...h,[I]:g,[x]:i,[A]:o,[M]:c},...z)])),m={...h,...w};return f.set(g,m),m}return u&&typeof u=="object"?D(u,{...n,path:g}):u}});return s.set(e,b),b}function Y(t,n){return D(t,{...n,verbosePath:n?.verbosePath??"",cache:{proxy:new WeakMap,leaf:new WeakMap}})}exports.defineState=X;exports.setupStorage=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react");function z(e,n,t){if(!n)return e;const i=n.split(".");let o=e;for(const c of i)if(o!==null&&typeof o=="object"&&c in o)o=o[c];else return t;return o===void 0?t:o}function B(e,n,t){const i=n.replace(/\[(\d+)\]/g,".$1").split(".");let o=e;for(let c=0;c<i.length-1;c++){const u=i[c],s=i[c+1];(o[u]===void 0||o[u]===null)&&(o[u]=/^\d+$/.test(s)?[]:{}),o=o[u]}return o[i[i.length-1]]=t,e}function F(e,n=0){let t;return function(...i){t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,e.apply(this,i)},n)}}function J(e,n,t=[]){return S.useMemo(()=>F(e,n),t)}function N(e){const n=JSON.stringify(e,null,2).split(`
2
+ `),t=[],i=[];for(const o of n){const c=o.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);if(c){const[,u,s,p,b]=c;t.push(`${u}%c"${s}"%c${p}%c${b}`),i.push("color: #9cdcfe; font-weight: bold","color: #cccccc","color: #ce9178")}else t.push(`%c${o}`),i.push("color: #cccccc")}console.log(t.join(`
3
+ `),...i,e)}const O=e=>typeof e=="function",H=e=>typeof e=="function",V=e=>typeof e<"u",A=e=>H(e)?e():e;class M{#e;#t;constructor(){this.#e={},this.#t=new Set}subscribe(n){return this.#t.add(n),()=>this.#t.delete(n)}getClientSnapshot(){return this.#e}getServerSnapshot(){return this.#e}get(n){return z(this.#e,n)}set(n,t){const i=z(this.#e,n),o=O(t)?t(i):t,c={...this.#e};B(c,n,o),this.#e=c,this.#t.forEach(u=>u())}}let _;typeof window>"u"&&(_=new AsyncLocalStorage);const K=()=>{const e=_.getStore();if(!e)throw new Error(`${M.name} must be initialized for this request`);return e};let C=null;const G=()=>(C||(C=new M),C);function Q(e){return _.run(new M,e)}const U=()=>typeof window>"u"?K():G(),j=Symbol("state-def"),k=Symbol("state-path"),R=Symbol("state-verbose"),x=Symbol("state-verbose-path"),L=Symbol("state-ssr"),D=typeof window>"u",X=D?S.useEffect:S.useLayoutEffect;function Y(e={}){return{[j]:!0,[k]:"",[R]:!1,[x]:"",[L]:!1,useState(n){const t=D?void 0:A(e.storage),i=A(e.defaultValue),o=e.bidirectional;n??={};const c=A(n.defaultValue)??i,u=n.bidirectional??o,s=this[k],p=this[R],b=this[x],T=this[L],a=U(),l=e.serialize??JSON.stringify,g=e.deserialize??JSON.parse,d=(r,h,P)=>{const w=h.getItem(r);w===null?V(P)&&h.setItem(r,l(P)):a.set(r,g(w))},f=J(n.onSet??(()=>{}),n.delayedSet,[]),y=S.useRef(void 0),$=S.useRef(!1);if(!$.current){$.current=!0;let r=a.get(s);V(r)||(r=c,V(r)&&a.set(s,r)),!T&&t&&d(s,t,r)}const E=S.useSyncExternalStore(a.subscribe.bind(a),a.getClientSnapshot.bind(a),a.getServerSnapshot.bind(a));if(p)if(b){const r=z(E,b);r&&N(r)}else N(E);const m=z(E,s,c);y.current=m,X(()=>{!T||!t||d(s,t,m)},[]);const v=S.useEffectEvent(r=>{if(r.key!==s)return;const h=r.newValue,w=(h===null?null:g(h))??c;V(w)&&(a.set(s,w),f(w,y.current))});S.useEffect(()=>{if(u)return window.addEventListener("storage",v),()=>window.removeEventListener("storage",v)},[u]);const I=S.useCallback(r=>{const h=O(r)?r(y.current):r;a.set(s,h),f(h,y.current),t&&t.setItem(s,l(h))},[s,t,f]),q=S.useCallback(()=>{const r=c;if(!V(r)){t?.removeItem(s);return}a.set(s,r),f(r,y.current),t&&t.setItem(s,l(r))},[s,c,t,f]);return[m,I,q]},toString(){return this[k]}}}function W(e,n){const{path:t="",verbose:i,verbosePath:o,ssr:c,cache:u}=n;let s=u.proxy.get(e);s||(s=new Map,u.proxy.set(e,s));const p=s.get(t);if(p)return p;const b=new Proxy(e,{get(T,a){const l=T[a],g=t?`${t}.${String(a)}`:String(a);if(l&&typeof l=="object"&&j in l){const d=l;let f=u.leaf.get(d);f||(f=new Map,u.leaf.set(d,f));const y=f.get(g);if(y)return y;const $=Reflect.ownKeys(d).filter(v=>typeof d[v]=="function"),E=Object.fromEntries($.map(v=>[v,(...I)=>d[v].call({...d,[k]:g,[R]:i,[x]:o,[L]:c},...I)])),m={...d,...E};return f.set(g,m),m}return l&&typeof l=="object"?W(l,{...n,path:g}):l}});return s.set(t,b),b}function Z(e,n){return W(e,{...n,verbosePath:n?.verbosePath??"",cache:{proxy:new WeakMap,leaf:new WeakMap}})}exports.defineState=Y;exports.runWithStateVocab=Q;exports.setupStorage=Z;
@@ -1,61 +1,60 @@
1
- import { useMemo as H, cache as K, useRef as _, useSyncExternalStore as W, useEffect as N, useLayoutEffect as q, useEffectEvent as G, useCallback as L } from "react";
2
- const D = Symbol("state-def"), I = Symbol("state-path"), A = Symbol("state-verbose"), C = Symbol("state-verbose-path"), R = Symbol("state-ssr");
3
- function $(t, n, e) {
1
+ import { useMemo as q, useRef as M, useSyncExternalStore as H, useEffect as O, useLayoutEffect as K, useEffectEvent as G, useCallback as N } from "react";
2
+ function z(e, n, t) {
4
3
  if (!n)
5
- return t;
4
+ return e;
6
5
  const i = n.split(".");
7
- let o = t;
6
+ let o = e;
8
7
  for (const c of i)
9
8
  if (o !== null && typeof o == "object" && c in o)
10
9
  o = o[c];
11
10
  else
12
- return e;
13
- return o === void 0 ? e : o;
11
+ return t;
12
+ return o === void 0 ? t : o;
14
13
  }
15
- function Q(t, n, e) {
14
+ function Q(e, n, t) {
16
15
  const i = n.replace(/\[(\d+)\]/g, ".$1").split(".");
17
- let o = t;
16
+ let o = e;
18
17
  for (let c = 0; c < i.length - 1; c++) {
19
- const l = i[c], s = i[c + 1];
20
- (o[l] === void 0 || o[l] === null) && (o[l] = /^\d+$/.test(s) ? [] : {}), o = o[l];
18
+ const u = i[c], s = i[c + 1];
19
+ (o[u] === void 0 || o[u] === null) && (o[u] = /^\d+$/.test(s) ? [] : {}), o = o[u];
21
20
  }
22
- return o[i[i.length - 1]] = e, t;
21
+ return o[i[i.length - 1]] = t, e;
23
22
  }
24
- function U(t, n = 0) {
25
- let e;
23
+ function U(e, n = 0) {
24
+ let t;
26
25
  return function(...i) {
27
- e !== void 0 && clearTimeout(e), e = setTimeout(() => {
28
- e = void 0, t.apply(this, i);
26
+ t !== void 0 && clearTimeout(t), t = setTimeout(() => {
27
+ t = void 0, e.apply(this, i);
29
28
  }, n);
30
29
  };
31
30
  }
32
- function X(t, n, e = []) {
33
- return H(
34
- () => U(t, n),
31
+ function X(e, n, t = []) {
32
+ return q(
33
+ () => U(e, n),
35
34
  // eslint-disable-next-line react-hooks/exhaustive-deps
36
- e
35
+ t
37
36
  );
38
37
  }
39
- function M(t) {
40
- const n = JSON.stringify(t, null, 2).split(`
41
- `), e = [], i = [];
38
+ function D(e) {
39
+ const n = JSON.stringify(e, null, 2).split(`
40
+ `), t = [], i = [];
42
41
  for (const o of n) {
43
42
  const c = o.match(/^(\s*)"([^"]+)"(\s*:\s*)(.+)$/);
44
43
  if (c) {
45
- const [, l, s, v, y] = c;
46
- e.push(`${l}%c"${s}"%c${v}%c${y}`), i.push(
44
+ const [, u, s, v, y] = c;
45
+ t.push(`${u}%c"${s}"%c${v}%c${y}`), i.push(
47
46
  "color: #9cdcfe; font-weight: bold",
48
47
  "color: #cccccc",
49
48
  "color: #ce9178"
50
49
  );
51
50
  } else
52
- e.push(`%c${o}`), i.push("color: #cccccc");
51
+ t.push(`%c${o}`), i.push("color: #cccccc");
53
52
  }
54
- console.log(e.join(`
55
- `), ...i, t);
53
+ console.log(t.join(`
54
+ `), ...i, e);
56
55
  }
57
- const O = (t) => typeof t == "function", Y = (t) => typeof t == "function", w = (t) => typeof t < "u", x = (t) => Y(t) ? t() : t;
58
- class Z {
56
+ const j = (e) => typeof e == "function", Y = (e) => typeof e == "function", E = (e) => typeof e < "u", x = (e) => Y(e) ? e() : e;
57
+ class L {
59
58
  #e;
60
59
  #t;
61
60
  constructor() {
@@ -71,145 +70,156 @@ class Z {
71
70
  return this.#e;
72
71
  }
73
72
  get(n) {
74
- return $(this.#e, n);
73
+ return z(this.#e, n);
75
74
  }
76
- set(n, e) {
77
- const i = $(this.#e, n), o = O(e) ? e(i) : e, c = { ...this.#e };
78
- Q(c, n, o), this.#e = c, this.#t.forEach((l) => l());
75
+ set(n, t) {
76
+ const i = z(this.#e, n), o = j(t) ? t(i) : t, c = { ...this.#e };
77
+ Q(c, n, o), this.#e = c, this.#t.forEach((u) => u());
79
78
  }
80
79
  }
81
- const j = () => new Z(), ee = K(j);
82
- let P = null;
83
- const te = () => (P || (P = j()), P), ne = () => typeof window > "u" ? ee() : te(), B = typeof window > "u", se = B ? N : q;
84
- function oe(t = {}) {
80
+ let _;
81
+ typeof window > "u" && (_ = new AsyncLocalStorage());
82
+ const Z = () => {
83
+ const e = _.getStore();
84
+ if (!e)
85
+ throw new Error(`${L.name} must be initialized for this request`);
86
+ return e;
87
+ };
88
+ let A = null;
89
+ const ee = () => (A || (A = new L()), A);
90
+ function re(e) {
91
+ return _.run(new L(), e);
92
+ }
93
+ const te = () => typeof window > "u" ? Z() : ee(), B = Symbol("state-def"), $ = Symbol("state-path"), P = Symbol("state-verbose"), C = Symbol("state-verbose-path"), R = Symbol("state-ssr"), F = typeof window > "u", ne = F ? O : K;
94
+ function oe(e = {}) {
85
95
  return {
86
- [D]: !0,
96
+ [B]: !0,
87
97
  // marks this object as a leaf in the router tree
88
- [I]: "",
98
+ [$]: "",
89
99
  // placeholder; injected at runtime by injectPaths()
90
- [A]: !1,
100
+ [P]: !1,
91
101
  // placeholder
92
102
  [C]: "",
93
103
  // placeholder
94
104
  [R]: !1,
95
105
  // placeholder
96
106
  useState(n) {
97
- const e = B ? void 0 : x(t.storage), i = x(t.defaultValue), o = t.bidirectional;
107
+ const t = F ? void 0 : x(e.storage), i = x(e.defaultValue), o = e.bidirectional;
98
108
  n ??= {};
99
- const c = x(n.defaultValue) ?? i, l = n.bidirectional ?? o, s = this[I], v = this[A], y = this[C], V = this[R], a = ne(), u = t.serialize ?? JSON.stringify, b = t.deserialize ?? JSON.parse, d = (r, h, z) => {
109
+ const c = x(n.defaultValue) ?? i, u = n.bidirectional ?? o, s = this[$], v = this[P], y = this[C], V = this[R], l = te(), a = e.serialize ?? JSON.stringify, g = e.deserialize ?? JSON.parse, d = (r, h, k) => {
100
110
  const m = h.getItem(r);
101
- m === null ? w(z) && h.setItem(r, u(z)) : a.set(r, b(m));
111
+ m === null ? E(k) && h.setItem(r, a(k)) : l.set(r, g(m));
102
112
  }, f = X(
103
113
  n.onSet ?? (() => {
104
114
  }),
105
115
  n.delayedSet,
106
116
  []
107
- ), S = _(void 0), T = _(!1);
117
+ ), S = M(void 0), T = M(!1);
108
118
  if (!T.current) {
109
119
  T.current = !0;
110
- let r = a.get(s);
111
- w(r) || (r = c, w(r) && a.set(s, r)), !V && e && d(s, e, r);
120
+ let r = l.get(s);
121
+ E(r) || (r = c, E(r) && l.set(s, r)), !V && t && d(s, t, r);
112
122
  }
113
- const E = W(
114
- a.subscribe.bind(a),
115
- a.getClientSnapshot.bind(a),
116
- a.getServerSnapshot.bind(a)
123
+ const w = H(
124
+ l.subscribe.bind(l),
125
+ l.getClientSnapshot.bind(l),
126
+ l.getServerSnapshot.bind(l)
117
127
  );
118
128
  if (v)
119
129
  if (y) {
120
- const r = $(E, y);
121
- r && M(r);
130
+ const r = z(w, y);
131
+ r && D(r);
122
132
  } else
123
- M(E);
124
- const p = $(E, s, c);
125
- S.current = p, se(() => {
126
- !V || !e || d(s, e, p);
133
+ D(w);
134
+ const p = z(w, s, c);
135
+ S.current = p, ne(() => {
136
+ !V || !t || d(s, t, p);
127
137
  }, []);
128
- const g = G((r) => {
138
+ const b = G((r) => {
129
139
  if (r.key !== s)
130
140
  return;
131
- const h = r.newValue, m = (h === null ? null : b(h)) ?? c;
132
- w(m) && (a.set(s, m), f(m, S.current));
141
+ const h = r.newValue, m = (h === null ? null : g(h)) ?? c;
142
+ E(m) && (l.set(s, m), f(m, S.current));
133
143
  });
134
- N(() => {
135
- if (l)
136
- return window.addEventListener("storage", g), () => window.removeEventListener("storage", g);
137
- }, [l]);
138
- const k = L((r) => {
139
- const h = O(r) ? r(S.current) : r;
140
- a.set(s, h), f(h, S.current), e && e.setItem(s, u(h));
141
- }, [s, e, f]), J = L(() => {
144
+ O(() => {
145
+ if (u)
146
+ return window.addEventListener("storage", b), () => window.removeEventListener("storage", b);
147
+ }, [u]);
148
+ const I = N((r) => {
149
+ const h = j(r) ? r(S.current) : r;
150
+ l.set(s, h), f(h, S.current), t && t.setItem(s, a(h));
151
+ }, [s, t, f]), W = N(() => {
142
152
  const r = c;
143
- if (!w(r)) {
144
- e?.removeItem(s);
153
+ if (!E(r)) {
154
+ t?.removeItem(s);
145
155
  return;
146
156
  }
147
- a.set(s, r), f(r, S.current), e && e.setItem(s, u(r));
148
- }, [s, c, e, f]);
157
+ l.set(s, r), f(r, S.current), t && t.setItem(s, a(r));
158
+ }, [s, c, t, f]);
149
159
  return [
150
160
  p,
151
- k,
152
- J
161
+ I,
162
+ W
153
163
  ];
154
164
  },
155
165
  /** Returns the fully qualified job name (dot-separated path). */
156
166
  toString() {
157
- return this[I];
167
+ return this[$];
158
168
  }
159
169
  };
160
170
  }
161
- function F(t, n) {
171
+ function J(e, n) {
162
172
  const {
163
- path: e = "",
173
+ path: t = "",
164
174
  verbose: i,
165
175
  verbosePath: o,
166
176
  ssr: c,
167
- cache: l
177
+ cache: u
168
178
  } = n;
169
- let s = l.proxy.get(t);
170
- s || (s = /* @__PURE__ */ new Map(), l.proxy.set(t, s));
171
- const v = s.get(e);
179
+ let s = u.proxy.get(e);
180
+ s || (s = /* @__PURE__ */ new Map(), u.proxy.set(e, s));
181
+ const v = s.get(t);
172
182
  if (v)
173
183
  return v;
174
- const y = new Proxy(t, {
175
- get(V, a) {
176
- const u = V[a], b = e ? `${e}.${String(a)}` : String(a);
177
- if (u && typeof u == "object" && D in u) {
178
- const d = u;
179
- let f = l.leaf.get(d);
180
- f || (f = /* @__PURE__ */ new Map(), l.leaf.set(d, f));
181
- const S = f.get(b);
184
+ const y = new Proxy(e, {
185
+ get(V, l) {
186
+ const a = V[l], g = t ? `${t}.${String(l)}` : String(l);
187
+ if (a && typeof a == "object" && B in a) {
188
+ const d = a;
189
+ let f = u.leaf.get(d);
190
+ f || (f = /* @__PURE__ */ new Map(), u.leaf.set(d, f));
191
+ const S = f.get(g);
182
192
  if (S)
183
193
  return S;
184
194
  const T = Reflect.ownKeys(d).filter(
185
- (g) => typeof d[g] == "function"
186
- ), E = Object.fromEntries(
187
- T.map((g) => [
188
- g,
189
- (...k) => d[g].call(
195
+ (b) => typeof d[b] == "function"
196
+ ), w = Object.fromEntries(
197
+ T.map((b) => [
198
+ b,
199
+ (...I) => d[b].call(
190
200
  {
191
201
  ...d,
192
- [I]: b,
193
- [A]: i,
202
+ [$]: g,
203
+ [P]: i,
194
204
  [C]: o,
195
205
  [R]: c
196
206
  },
197
- ...k
207
+ ...I
198
208
  )
199
209
  ])
200
- ), p = { ...d, ...E };
201
- return f.set(b, p), p;
210
+ ), p = { ...d, ...w };
211
+ return f.set(g, p), p;
202
212
  }
203
- return u && typeof u == "object" ? F(u, {
213
+ return a && typeof a == "object" ? J(a, {
204
214
  ...n,
205
- path: b
206
- }) : u;
215
+ path: g
216
+ }) : a;
207
217
  }
208
218
  });
209
- return s.set(e, y), y;
219
+ return s.set(t, y), y;
210
220
  }
211
- function ce(t, n) {
212
- return F(t, {
221
+ function ce(e, n) {
222
+ return J(e, {
213
223
  ...n,
214
224
  verbosePath: n?.verbosePath ?? "",
215
225
  cache: {
@@ -220,5 +230,6 @@ function ce(t, n) {
220
230
  }
221
231
  export {
222
232
  oe as defineState,
233
+ re as runWithStateVocab,
223
234
  ce as setupStorage
224
235
  };
@@ -1,2 +1,3 @@
1
+ export { runWithStateVocab } from "./store";
1
2
  export { defineState } from "./state";
2
3
  export { setupStorage } from "./setup";
@@ -12,5 +12,6 @@ declare class VocabStore {
12
12
  get<V>(statePath: string): V | undefined;
13
13
  set<V>(statePath: string, value: ValueOrTransformer<V>): void;
14
14
  }
15
+ export declare function runWithStateVocab<T>(fn: () => T): T;
15
16
  export declare const getVocabStore: () => VocabStore;
16
17
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yakocloud/state-vocab",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "main": "dist/state-vocab.cjs.js",
5
5
  "module": "dist/state-vocab.es.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -50,7 +50,6 @@
50
50
  "@testing-library/jest-dom": "^6.9.1",
51
51
  "@testing-library/react": "^16.3.2",
52
52
  "@types/jest": "^30.0.0",
53
- "@types/node": "^24.10.1",
54
53
  "@types/react": "^19.2.5",
55
54
  "@types/react-dom": "^19.2.3",
56
55
  "@vitejs/plugin-react": "^5.2.0",