@yoltra/react 0.5.0 → 0.7.0

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/index.mjs CHANGED
@@ -1,42 +1,25 @@
1
1
  /*!
2
- * @yoltra/react v0.5.0
2
+ * @yoltra/react v0.7.0
3
3
  * (c) 2026 Manu Ramirez <@pixerael>
4
- * License: MIT
5
- * Homepage: https://yoltra.dev
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree
9
- */
10
- var Pe = Object.defineProperty;
11
- var _e = (t, e, n) => e in t ? Pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
12
- var ue = (t, e, n) => _e(t, typeof e != "symbol" ? e + "" : e, n);
13
- import we, { createContext as me, useRef as P, useMemo as A, useCallback as he, useEffect as ve, useSyncExternalStore as I, useContext as ye } from "react";
14
- import { createStore as Te } from "@yoltra/core";
15
- const be = me(null);
4
+ * License: MIT */
5
+ import ge, { createContext as de, useRef as P, useMemo as E, useCallback as me, useEffect as he, useSyncExternalStore as I, useContext as ve } from "react";
6
+ import { createStore as Pe } from "@yoltra/core";
7
+ const ye = de(null);
16
8
  var G = { exports: {} }, z = {};
17
- /**
18
- * @license React
19
- * react-jsx-runtime.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */
26
- var ae;
27
- function ke() {
28
- if (ae) return z;
29
- ae = 1;
30
- var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
9
+ var ue;
10
+ function _e() {
11
+ if (ue) return z;
12
+ ue = 1;
13
+ var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
31
14
  function n(o, s, c) {
32
15
  var u = null;
33
16
  if (c !== void 0 && (u = "" + c), s.key !== void 0 && (u = "" + s.key), "key" in s) {
34
17
  c = {};
35
- for (var m in s)
36
- m !== "key" && (c[m] = s[m]);
18
+ for (var d in s)
19
+ d !== "key" && (c[d] = s[d]);
37
20
  } else c = s;
38
21
  return s = c.ref, {
39
- $$typeof: t,
22
+ $$typeof: r,
40
23
  type: o,
41
24
  key: u,
42
25
  ref: s !== void 0 ? s : null,
@@ -46,29 +29,20 @@ function ke() {
46
29
  return z.Fragment = e, z.jsx = n, z.jsxs = n, z;
47
30
  }
48
31
  var W = {};
49
- /**
50
- * @license React
51
- * react-jsx-runtime.development.js
52
- *
53
- * Copyright (c) Meta Platforms, Inc. and affiliates.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE file in the root directory of this source tree.
57
- */
58
- var ie;
59
- function xe() {
60
- return ie || (ie = 1, process.env.NODE_ENV !== "production" && (function() {
61
- function t(r) {
62
- if (r == null) return null;
63
- if (typeof r == "function")
64
- return r.$$typeof === B ? null : r.displayName || r.name || null;
65
- if (typeof r == "string") return r;
66
- switch (r) {
67
- case h:
32
+ var ae;
33
+ function we() {
34
+ return ae || (ae = 1, process.env.NODE_ENV !== "production" && (function() {
35
+ function r(t) {
36
+ if (t == null) return null;
37
+ if (typeof t == "function")
38
+ return t.$$typeof === J ? null : t.displayName || t.name || null;
39
+ if (typeof t == "string") return t;
40
+ switch (t) {
41
+ case m:
68
42
  return "Fragment";
69
43
  case j:
70
44
  return "Profiler";
71
- case b:
45
+ case g:
72
46
  return "StrictMode";
73
47
  case D:
74
48
  return "Suspense";
@@ -77,167 +51,167 @@ function xe() {
77
51
  case N:
78
52
  return "Activity";
79
53
  }
80
- if (typeof r == "object")
81
- switch (typeof r.tag == "number" && console.error(
54
+ if (typeof t == "object")
55
+ switch (typeof t.tag == "number" && console.error(
82
56
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
83
- ), r.$$typeof) {
57
+ ), t.$$typeof) {
84
58
  case y:
85
59
  return "Portal";
86
- case g:
87
- return (r.displayName || "Context") + ".Provider";
60
+ case R:
61
+ return (t.displayName || "Context") + ".Provider";
88
62
  case w:
89
- return (r._context.displayName || "Context") + ".Consumer";
63
+ return (t._context.displayName || "Context") + ".Consumer";
90
64
  case O:
91
- var a = r.render;
92
- return r = r.displayName, r || (r = a.displayName || a.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
65
+ var a = t.render;
66
+ return t = t.displayName, t || (t = a.displayName || a.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
93
67
  case $:
94
- return a = r.displayName || null, a !== null ? a : t(r.type) || "Memo";
95
- case R:
96
- a = r._payload, r = r._init;
68
+ return a = t.displayName || null, a !== null ? a : r(t.type) || "Memo";
69
+ case A:
70
+ a = t._payload, t = t._init;
97
71
  try {
98
- return t(r(a));
72
+ return r(t(a));
99
73
  } catch {
100
74
  }
101
75
  }
102
76
  return null;
103
77
  }
104
- function e(r) {
105
- return "" + r;
78
+ function e(t) {
79
+ return "" + t;
106
80
  }
107
- function n(r) {
81
+ function n(t) {
108
82
  try {
109
- e(r);
83
+ e(t);
110
84
  var a = !1;
111
85
  } catch {
112
86
  a = !0;
113
87
  }
114
88
  if (a) {
115
89
  a = console;
116
- var f = a.error, S = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
90
+ var f = a.error, b = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
117
91
  return f.call(
118
92
  a,
119
93
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
120
- S
121
- ), e(r);
94
+ b
95
+ ), e(t);
122
96
  }
123
97
  }
124
- function o(r) {
125
- if (r === h) return "<>";
126
- if (typeof r == "object" && r !== null && r.$$typeof === R)
98
+ function o(t) {
99
+ if (t === m) return "<>";
100
+ if (typeof t == "object" && t !== null && t.$$typeof === A)
127
101
  return "<...>";
128
102
  try {
129
- var a = t(r);
103
+ var a = r(t);
130
104
  return a ? "<" + a + ">" : "<...>";
131
105
  } catch {
132
106
  return "<...>";
133
107
  }
134
108
  }
135
109
  function s() {
136
- var r = T.A;
137
- return r === null ? null : r.getOwner();
110
+ var t = T.A;
111
+ return t === null ? null : t.getOwner();
138
112
  }
139
113
  function c() {
140
114
  return Error("react-stack-top-frame");
141
115
  }
142
- function u(r) {
143
- if (X.call(r, "key")) {
144
- var a = Object.getOwnPropertyDescriptor(r, "key").get;
116
+ function u(t) {
117
+ if (B.call(t, "key")) {
118
+ var a = Object.getOwnPropertyDescriptor(t, "key").get;
145
119
  if (a && a.isReactWarning) return !1;
146
120
  }
147
- return r.key !== void 0;
121
+ return t.key !== void 0;
148
122
  }
149
- function m(r, a) {
123
+ function d(t, a) {
150
124
  function f() {
151
- re || (re = !0, console.error(
125
+ te || (te = !0, console.error(
152
126
  "%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)",
153
127
  a
154
128
  ));
155
129
  }
156
- f.isReactWarning = !0, Object.defineProperty(r, "key", {
130
+ f.isReactWarning = !0, Object.defineProperty(t, "key", {
157
131
  get: f,
158
132
  configurable: !0
159
133
  });
160
134
  }
161
- function v() {
162
- var r = t(this.type);
163
- return ne[r] || (ne[r] = !0, console.error(
135
+ function h() {
136
+ var t = r(this.type);
137
+ return ne[t] || (ne[t] = !0, console.error(
164
138
  "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."
165
- )), r = this.props.ref, r !== void 0 ? r : null;
139
+ )), t = this.props.ref, t !== void 0 ? t : null;
166
140
  }
167
- function _(r, a, f, S, C, k, Z, K) {
168
- return f = k.ref, r = {
141
+ function _(t, a, f, b, C, k, Z, K) {
142
+ return f = k.ref, t = {
169
143
  $$typeof: l,
170
- type: r,
144
+ type: t,
171
145
  key: a,
172
146
  props: k,
173
147
  _owner: C
174
- }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(r, "ref", {
148
+ }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(t, "ref", {
175
149
  enumerable: !1,
176
- get: v
177
- }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
150
+ get: h
151
+ }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
178
152
  configurable: !1,
179
153
  enumerable: !1,
180
154
  writable: !0,
181
155
  value: 0
182
- }), Object.defineProperty(r, "_debugInfo", {
156
+ }), Object.defineProperty(t, "_debugInfo", {
183
157
  configurable: !1,
184
158
  enumerable: !1,
185
159
  writable: !0,
186
160
  value: null
187
- }), Object.defineProperty(r, "_debugStack", {
161
+ }), Object.defineProperty(t, "_debugStack", {
188
162
  configurable: !1,
189
163
  enumerable: !1,
190
164
  writable: !0,
191
165
  value: Z
192
- }), Object.defineProperty(r, "_debugTask", {
166
+ }), Object.defineProperty(t, "_debugTask", {
193
167
  configurable: !1,
194
168
  enumerable: !1,
195
169
  writable: !0,
196
170
  value: K
197
- }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
171
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
198
172
  }
199
- function p(r, a, f, S, C, k, Z, K) {
200
- var E = a.children;
201
- if (E !== void 0)
202
- if (S)
203
- if (q(E)) {
204
- for (S = 0; S < E.length; S++)
205
- i(E[S]);
206
- Object.freeze && Object.freeze(E);
173
+ function p(t, a, f, b, C, k, Z, K) {
174
+ var S = a.children;
175
+ if (S !== void 0)
176
+ if (b)
177
+ if (X(S)) {
178
+ for (b = 0; b < S.length; b++)
179
+ i(S[b]);
180
+ Object.freeze && Object.freeze(S);
207
181
  } else
208
182
  console.error(
209
183
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
210
184
  );
211
- else i(E);
212
- if (X.call(a, "key")) {
213
- E = t(r);
214
- var M = Object.keys(a).filter(function(ge) {
215
- return ge !== "key";
185
+ else i(S);
186
+ if (B.call(a, "key")) {
187
+ S = r(t);
188
+ var M = Object.keys(a).filter(function(Re) {
189
+ return Re !== "key";
216
190
  });
217
- S = 0 < M.length ? "{key: someKey, " + M.join(": ..., ") + ": ...}" : "{key: someKey}", ce[E + S] || (M = 0 < M.length ? "{" + M.join(": ..., ") + ": ...}" : "{}", console.error(
191
+ b = 0 < M.length ? "{key: someKey, " + M.join(": ..., ") + ": ...}" : "{key: someKey}", ce[S + b] || (M = 0 < M.length ? "{" + M.join(": ..., ") + ": ...}" : "{}", console.error(
218
192
  `A props object containing a "key" prop is being spread into JSX:
219
193
  let props = %s;
220
194
  <%s {...props} />
221
195
  React keys must be passed directly to JSX without using spread:
222
196
  let props = %s;
223
197
  <%s key={someKey} {...props} />`,
198
+ b,
224
199
  S,
225
- E,
226
200
  M,
227
- E
228
- ), ce[E + S] = !0);
201
+ S
202
+ ), ce[S + b] = !0);
229
203
  }
230
- if (E = null, f !== void 0 && (n(f), E = "" + f), u(a) && (n(a.key), E = "" + a.key), "key" in a) {
204
+ if (S = null, f !== void 0 && (n(f), S = "" + f), u(a) && (n(a.key), S = "" + a.key), "key" in a) {
231
205
  f = {};
232
206
  for (var Q in a)
233
207
  Q !== "key" && (f[Q] = a[Q]);
234
208
  } else f = a;
235
- return E && m(
209
+ return S && d(
236
210
  f,
237
- typeof r == "function" ? r.displayName || r.name || "Unknown" : r
211
+ typeof t == "function" ? t.displayName || t.name || "Unknown" : t
238
212
  ), _(
239
- r,
240
- E,
213
+ t,
214
+ S,
241
215
  k,
242
216
  C,
243
217
  s(),
@@ -246,157 +220,157 @@ React keys must be passed directly to JSX without using spread:
246
220
  K
247
221
  );
248
222
  }
249
- function i(r) {
250
- typeof r == "object" && r !== null && r.$$typeof === l && r._store && (r._store.validated = 1);
223
+ function i(t) {
224
+ typeof t == "object" && t !== null && t.$$typeof === l && t._store && (t._store.validated = 1);
251
225
  }
252
- var d = we, l = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), g = Symbol.for("react.context"), O = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), N = Symbol.for("react.activity"), B = Symbol.for("react.client.reference"), T = d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, q = Array.isArray, H = console.createTask ? console.createTask : function() {
226
+ var v = ge, l = /* @__PURE__ */ Symbol.for("react.transitional.element"), y = /* @__PURE__ */ Symbol.for("react.portal"), m = /* @__PURE__ */ Symbol.for("react.fragment"), g = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), w = /* @__PURE__ */ Symbol.for("react.consumer"), R = /* @__PURE__ */ Symbol.for("react.context"), O = /* @__PURE__ */ Symbol.for("react.forward_ref"), D = /* @__PURE__ */ Symbol.for("react.suspense"), F = /* @__PURE__ */ Symbol.for("react.suspense_list"), $ = /* @__PURE__ */ Symbol.for("react.memo"), A = /* @__PURE__ */ Symbol.for("react.lazy"), N = /* @__PURE__ */ Symbol.for("react.activity"), J = /* @__PURE__ */ Symbol.for("react.client.reference"), T = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, X = Array.isArray, H = console.createTask ? console.createTask : function() {
253
227
  return null;
254
228
  };
255
- d = {
256
- react_stack_bottom_frame: function(r) {
257
- return r();
229
+ v = {
230
+ react_stack_bottom_frame: function(t) {
231
+ return t();
258
232
  }
259
233
  };
260
- var re, ne = {}, oe = d.react_stack_bottom_frame.bind(
261
- d,
234
+ var te, ne = {}, oe = v.react_stack_bottom_frame.bind(
235
+ v,
262
236
  c
263
237
  )(), se = H(o(c)), ce = {};
264
- W.Fragment = h, W.jsx = function(r, a, f, S, C) {
238
+ W.Fragment = m, W.jsx = function(t, a, f, b, C) {
265
239
  var k = 1e4 > T.recentlyCreatedOwnerStacks++;
266
240
  return p(
267
- r,
241
+ t,
268
242
  a,
269
243
  f,
270
244
  !1,
271
- S,
245
+ b,
272
246
  C,
273
247
  k ? Error("react-stack-top-frame") : oe,
274
- k ? H(o(r)) : se
248
+ k ? H(o(t)) : se
275
249
  );
276
- }, W.jsxs = function(r, a, f, S, C) {
250
+ }, W.jsxs = function(t, a, f, b, C) {
277
251
  var k = 1e4 > T.recentlyCreatedOwnerStacks++;
278
252
  return p(
279
- r,
253
+ t,
280
254
  a,
281
255
  f,
282
256
  !0,
283
- S,
257
+ b,
284
258
  C,
285
259
  k ? Error("react-stack-top-frame") : oe,
286
- k ? H(o(r)) : se
260
+ k ? H(o(t)) : se
287
261
  );
288
262
  };
289
263
  })()), W;
290
264
  }
291
- var le;
292
- function je() {
293
- return le || (le = 1, process.env.NODE_ENV === "production" ? G.exports = ke() : G.exports = xe()), G.exports;
265
+ var ie;
266
+ function Te() {
267
+ return ie || (ie = 1, process.env.NODE_ENV === "production" ? G.exports = _e() : G.exports = we()), G.exports;
294
268
  }
295
- var Se = je();
296
- const qe = ({ store: t, children: e }) => /* @__PURE__ */ Se.jsx(be.Provider, { value: t, children: e }), fe = /* @__PURE__ */ new Set();
297
- function Oe(t, e) {
298
- process.env.NODE_ENV !== "production" && (fe.has(t) || (fe.add(t), console.warn(e)));
269
+ var be = Te();
270
+ const Ve = ({ store: r, children: e }) => /* @__PURE__ */ be.jsx(ye.Provider, { value: r, children: e }), le = /* @__PURE__ */ new Set();
271
+ function ke(r, e) {
272
+ process.env.NODE_ENV !== "production" && (le.has(r) || (le.add(r), console.warn(e)));
299
273
  }
300
- function L(t) {
301
- return t.includes("*");
274
+ function L(r) {
275
+ return r.includes("*");
302
276
  }
303
- function x(t) {
304
- return t.replace(/^\./, "");
277
+ function x(r) {
278
+ return r.replace(/^\./, "");
305
279
  }
306
- function Ne(t) {
307
- return x(t).split(".").filter(Boolean);
280
+ function xe(r) {
281
+ return x(r).split(".").filter(Boolean);
308
282
  }
309
- function Ce(t) {
283
+ function je(r) {
310
284
  const e = (n) => `${n.length}:${n}`;
311
- return t.map((n) => {
285
+ return r.map((n) => {
312
286
  const o = Array.isArray(n.property) ? n.property : [n.property];
313
287
  return e(n.reducer) + e(String(o.length)) + o.map(e).join("");
314
288
  }).join("");
315
289
  }
316
- const Ee = Symbol("yoltra.pathSegments");
317
- function Ae(t) {
290
+ const Se = /* @__PURE__ */ Symbol("yoltra.pathSegments");
291
+ function Ee(r) {
318
292
  const e = () => {
319
293
  };
320
294
  return new Proxy(e, {
321
295
  get(n, o) {
322
- if (o === Ee) return t;
296
+ if (o === Se) return r;
323
297
  if (typeof o != "symbol")
324
- return Ae([...t, String(o)]);
298
+ return Ee([...r, String(o)]);
325
299
  },
326
300
  apply() {
327
301
  throw new Error(
328
- `[yoltra] A typed path accessor called a method (near "${t.join(".")}"). The accessor must be a plain member chain like \`p => p.items[0].title\` — it cannot call functions such as \`.map()\` or \`.toString()\`. Compute derived values in the component or a selector, or use the \`{ reducer, property }\` string form.`
302
+ `[yoltra] A typed path accessor called a method (near "${r.join(".")}"). The accessor must be a plain member chain like \`p => p.items[0].title\` — it cannot call functions such as \`.map()\` or \`.toString()\`. Compute derived values in the component or a selector, or use the \`{ reducer, property }\` string form.`
329
303
  );
330
304
  }
331
305
  });
332
306
  }
333
- function $e(t) {
334
- const e = t(Ae([])), n = e != null ? e[Ee] : void 0, s = (Array.isArray(n) ? n : []).join(".");
335
- return s === "" && Oe(
307
+ function Oe(r) {
308
+ const e = r(Ee([])), n = e?.[Se], s = (Array.isArray(n) ? n : []).join(".");
309
+ return s === "" && ke(
336
310
  "yoltra.toDottedPath.empty",
337
311
  "[yoltra] A typed path accessor recorded no property access, so it subscribed to the slice root. That fires only when the slice's whole value is replaced — which for a slice holding an object means never, since its changes are reported at their leaves. The accessor must be a plain member chain like `p => p.items[0].title` and cannot return a computed value or a default. For a dynamic subscription, or for a slice whose state is a single value, use the `{ reducer, property }` string form instead."
338
312
  ), s;
339
313
  }
340
- function U(t, e) {
341
- if (!e) return t;
342
- let n = t;
343
- for (const o of Ne(e)) {
314
+ function U(r, e) {
315
+ if (!e) return r;
316
+ let n = r;
317
+ for (const o of xe(e)) {
344
318
  if (n == null) return;
345
319
  n = n[o];
346
320
  }
347
321
  return n;
348
322
  }
349
- function V(t, e, n) {
350
- const o = P(t);
351
- o.current = t;
323
+ function V(r, e, n) {
324
+ const o = P(r);
325
+ o.current = r;
352
326
  const s = P(e);
353
327
  s.current = e;
354
- const c = A(
328
+ const c = E(
355
329
  () => ({ has: !1, value: void 0 }),
356
330
  // eslint-disable-next-line react-hooks/exhaustive-deps
357
331
  n
358
332
  );
359
- return he(() => {
333
+ return me(() => {
360
334
  const u = o.current();
361
335
  return (!c.has || !s.current(c.value, u)) && (c.has = !0, c.value = u), c.value;
362
336
  }, [c]);
363
337
  }
364
- function Ie(t, e) {
365
- if (Object.is(t, e)) return !0;
366
- if (!t || !e) return !1;
367
- const n = Object.keys(t), o = Object.keys(e);
338
+ function Ne(r, e) {
339
+ if (Object.is(r, e)) return !0;
340
+ if (!r || !e) return !1;
341
+ const n = Object.keys(r), o = Object.keys(e);
368
342
  if (n.length !== o.length) return !1;
369
343
  for (const s of n)
370
- if (!Object.is(t[s], e[s])) return !1;
344
+ if (!Object.is(r[s], e[s])) return !1;
371
345
  return !0;
372
346
  }
373
- function J() {
374
- const t = ye(be);
375
- if (!t) throw new Error("useStore must be used inside <StoreProvider>");
376
- return t;
347
+ function q() {
348
+ const r = ve(ye);
349
+ if (!r) throw new Error("useStore must be used inside <StoreProvider>");
350
+ return r;
377
351
  }
378
- function He() {
379
- return J().emit;
352
+ function qe() {
353
+ return q().emit;
380
354
  }
381
- function Ze(t, e = Object.is) {
382
- const n = J(), o = A(() => (c) => n.subscribe(c), [n]), s = V(
383
- () => t(n.getState()),
355
+ function Je(r, e = Object.is) {
356
+ const n = q(), o = E(() => (c) => n.subscribe(c), [n]), s = V(
357
+ () => r(n.getState()),
384
358
  e,
385
359
  [n]
386
360
  );
387
361
  return I(o, s, s);
388
362
  }
389
- function Ye(t, e, n = Object.is) {
390
- const o = J(), s = A(() => {
391
- const v = x(t.property);
392
- return { reducer: t.reducer, property: v };
393
- }, [t.reducer, t.property]), c = A(
394
- () => (v) => o.connect(
363
+ function Ce(r, e, n = Object.is) {
364
+ const o = q(), s = E(() => {
365
+ const h = x(r.property);
366
+ return { reducer: r.reducer, property: h };
367
+ }, [r.reducer, r.property]), c = E(
368
+ () => (h) => o.connect(
395
369
  { reducer: s.reducer, property: s.property },
396
- () => v()
370
+ () => h()
397
371
  ),
398
372
  [o, s]
399
- ), u = L(s.property), m = V(
373
+ ), u = L(s.property), d = V(
400
374
  () => {
401
375
  const _ = o.getState()[s.reducer];
402
376
  return u ? _ : U(_, s.property);
@@ -404,33 +378,31 @@ function Ye(t, e, n = Object.is) {
404
378
  n,
405
379
  [o, s]
406
380
  );
407
- return I(c, m, m);
381
+ return I(c, d, d);
408
382
  }
409
- function ee(t, e, n = Object.is) {
410
- return Ye(t, e, n);
383
+ function ee(r, e, n = Object.is) {
384
+ return Ce(r, e, n);
411
385
  }
412
- function Ke(t, e, n, o = "committed") {
413
- const s = J(), c = P(n);
414
- c.current = n, ve(() => s.onEvent(
415
- t,
386
+ function Be(r, e, n, o = "committed") {
387
+ const s = q(), c = P(n);
388
+ c.current = n, he(() => s.onEvent(
389
+ r,
416
390
  e,
417
- (u, m, v, _) => {
418
- c.current(u, m, v, _);
391
+ (u, d, h, _) => {
392
+ c.current(u, d, h, _);
419
393
  },
420
394
  o
421
- ), [s, t, e, o]);
395
+ ), [s, r, e, o]);
422
396
  }
423
- function De(t) {
424
- return t == null || t <= 0 ? null : Date.now() + t;
397
+ function $e(r) {
398
+ return r == null || r <= 0 ? null : Date.now() + r;
425
399
  }
426
- function Fe(t) {
427
- return t === null ? null : t === void 0 || t <= 0 ? 0 : Date.now() + t;
400
+ function Ie(r) {
401
+ return r === null ? null : r === void 0 || r <= 0 ? 0 : Date.now() + r;
428
402
  }
429
- const Me = 2e3;
430
- class ze {
431
- constructor() {
432
- ue(this, "store", /* @__PURE__ */ new Map());
433
- }
403
+ const Ye = 2e3;
404
+ class De {
405
+ store = /* @__PURE__ */ new Map();
434
406
  /**
435
407
  * Marks a key as most recently used, and evicts the coldest entries past the cap.
436
408
  *
@@ -446,11 +418,11 @@ class ze {
446
418
  }
447
419
  /** @internal */
448
420
  evict() {
449
- for (; this.store.size > Me; ) {
421
+ for (; this.store.size > Ye; ) {
450
422
  const e = this.store.keys().next();
451
423
  if (e.done === !0) return;
452
424
  const n = this.store.get(e.value);
453
- if ((n == null ? void 0 : n.status) === "pending") {
425
+ if (n?.status === "pending") {
454
426
  this.store.delete(e.value), this.store.set(e.value, n);
455
427
  continue;
456
428
  }
@@ -473,16 +445,16 @@ class ze {
473
445
  if (u.expiresAt === null || u.expiresAt > c) throw u.error;
474
446
  this.store.delete(e);
475
447
  }
476
- const m = Promise.resolve().then(n).then((v) => {
477
- this.store.set(e, { status: "ready", value: v, expiresAt: De(o) });
478
- }).catch((v) => {
448
+ const d = Promise.resolve().then(n).then((h) => {
449
+ this.store.set(e, { status: "ready", value: h, expiresAt: $e(o) });
450
+ }).catch((h) => {
479
451
  this.store.set(e, {
480
452
  status: "error",
481
- error: v,
482
- expiresAt: Fe(s)
453
+ error: h,
454
+ expiresAt: Ie(s)
483
455
  });
484
456
  });
485
- throw this.store.set(e, { status: "pending", promise: m, expiresAt: null }), this.evict(), m;
457
+ throw this.store.set(e, { status: "pending", promise: d, expiresAt: null }), this.evict(), d;
486
458
  }
487
459
  invalidate(e) {
488
460
  this.store.delete(e);
@@ -500,7 +472,7 @@ class ze {
500
472
  */
501
473
  invalidatePathKey(e) {
502
474
  for (const n of this.store.keys())
503
- de(n) === e && this.store.delete(n);
475
+ pe(n) === e && this.store.delete(n);
504
476
  }
505
477
  /**
506
478
  * Drops every entry that reads from `reducer`, in any store.
@@ -515,48 +487,47 @@ class ze {
515
487
  invalidateReducer(e) {
516
488
  const n = `${e}::`;
517
489
  for (const o of this.store.keys())
518
- de(o).split("||").some((s) => s.startsWith(n)) && this.store.delete(o);
490
+ pe(o).split("||").some((s) => s.startsWith(n)) && this.store.delete(o);
519
491
  }
520
492
  clear() {
521
493
  this.store.clear();
522
494
  }
523
495
  }
524
- const Y = new ze(), pe = /* @__PURE__ */ new WeakMap();
525
- let We = 0;
526
- function Re(t) {
527
- let e = pe.get(t);
528
- return e === void 0 && (e = `s${++We}`, pe.set(t, e)), e;
496
+ const Y = new De(), fe = /* @__PURE__ */ new WeakMap();
497
+ let Fe = 0;
498
+ function Ae(r) {
499
+ let e = fe.get(r);
500
+ return e === void 0 && (e = `s${++Fe}`, fe.set(r, e)), e;
529
501
  }
530
- function de(t) {
531
- return t.slice(t.indexOf("::") + 2);
502
+ function pe(r) {
503
+ return r.slice(r.indexOf("::") + 2);
532
504
  }
533
- function te(t, e, n) {
505
+ function re(r, e, n) {
534
506
  const o = Array.isArray(e) ? e.map(x).sort().join("|") : x(e);
535
- return n ? `${t}::${o}::${n}` : `${t}::${o}`;
507
+ return n ? `${r}::${o}::${n}` : `${r}::${o}`;
536
508
  }
537
- function Ge(t, e, n) {
538
- const o = t(), s = e.reducer, c = x(e.property), u = `${Re(o)}::${te(s, c, n.key)}`, m = A(() => (i) => o.connect({ reducer: s, property: c }, () => {
509
+ function Me(r, e, n) {
510
+ const o = r(), s = e.reducer, c = x(e.property), u = `${Ae(o)}::${re(s, c, n.key)}`, d = E(() => (i) => o.connect({ reducer: s, property: c }, () => {
539
511
  Y.invalidate(u), i();
540
- }), [o, s, c, u]), v = P(n);
541
- v.current = n;
542
- const _ = A(() => {
512
+ }), [o, s, c, u]), h = P(n);
513
+ h.current = n;
514
+ const _ = E(() => {
543
515
  const i = L(c);
544
516
  return () => {
545
- var b;
546
- const l = o.getState()[s], y = i ? l : U(l, c), h = v.current;
547
- return Y.read(u, () => h.load(y, l), (b = h.staleTime) != null ? b : 0, h.errorTtlMs);
517
+ const l = o.getState()[s], y = i ? l : U(l, c), m = h.current;
518
+ return Y.read(u, () => m.load(y, l), m.staleTime ?? 0, m.errorTtlMs);
548
519
  };
549
- }, [o, s, c, u]), p = A(() => {
520
+ }, [o, s, c, u]), p = E(() => {
550
521
  const i = L(c);
551
522
  return () => {
552
523
  const l = o.getState()[s];
553
524
  return i ? l : U(l, c);
554
525
  };
555
526
  }, [o, s, c]);
556
- return I(m, _, p);
527
+ return I(d, _, p);
557
528
  }
558
- function Le(t, e, n) {
559
- const o = t(), s = A(
529
+ function ze(r, e, n) {
530
+ const o = r(), s = E(
560
531
  () => e.map((p) => ({
561
532
  reducer: p.reducer,
562
533
  property: Array.isArray(p.property) ? p.property.map((i) => x(i)) : x(p.property)
@@ -565,46 +536,45 @@ function Le(t, e, n) {
565
536
  // signature is intentional and already covers `specs`.
566
537
  // eslint-disable-next-line react-hooks/exhaustive-deps
567
538
  [JSON.stringify(e)]
568
- ), c = A(() => {
569
- const p = s.map((i) => te(i.reducer, i.property)).sort().join("||");
570
- return `${Re(o)}::${n.key ? `${p}::${n.key}` : p}`;
571
- }, [o, s, n.key]), u = A(() => (p) => {
539
+ ), c = E(() => {
540
+ const p = s.map((i) => re(i.reducer, i.property)).sort().join("||");
541
+ return `${Ae(o)}::${n.key ? `${p}::${n.key}` : p}`;
542
+ }, [o, s, n.key]), u = E(() => (p) => {
572
543
  const i = () => {
573
544
  Y.invalidate(c), p();
574
- }, d = s.map((l) => o.connect(l, i));
545
+ }, v = s.map((l) => o.connect(l, i));
575
546
  return () => {
576
- for (const l of d) l();
547
+ for (const l of v) l();
577
548
  };
578
- }, [o, s, c]), m = P(n);
579
- m.current = n;
580
- const v = A(() => () => {
581
- var d;
582
- const p = o.getState(), i = m.current;
583
- return Y.read(c, () => i.load(p), (d = i.staleTime) != null ? d : 0, i.errorTtlMs);
549
+ }, [o, s, c]), d = P(n);
550
+ d.current = n;
551
+ const h = E(() => () => {
552
+ const p = o.getState(), i = d.current;
553
+ return Y.read(c, () => i.load(p), i.staleTime ?? 0, i.errorTtlMs);
584
554
  }, [o, c]);
585
- return I(u, v, () => {
586
- const p = m.current.load(o.getState());
555
+ return I(u, h, () => {
556
+ const p = d.current.load(o.getState());
587
557
  return p instanceof Promise ? void 0 : p;
588
558
  });
589
559
  }
590
- function Qe(t, e, n) {
591
- Y.invalidatePathKey(te(t, e, n));
560
+ function Xe(r, e, n) {
561
+ Y.invalidatePathKey(re(r, e, n));
592
562
  }
593
- function et(t) {
594
- Y.invalidateReducer(t);
563
+ function He(r) {
564
+ Y.invalidateReducer(r);
595
565
  }
596
- function tt() {
566
+ function Ze() {
597
567
  Y.clear();
598
568
  }
599
- function Ue(t) {
569
+ function We(r) {
600
570
  return {
601
- useSuspenseAtomicProp: (o, s) => Ge(t, o, s),
602
- useSuspenseAtomicProps: (o, s) => Le(t, o, s)
571
+ useSuspenseAtomicProp: (o, s) => Me(r, o, s),
572
+ useSuspenseAtomicProps: (o, s) => ze(r, o, s)
603
573
  };
604
574
  }
605
- function Ve(t) {
575
+ function Ge(r) {
606
576
  function e() {
607
- const i = ye(t);
577
+ const i = ve(r);
608
578
  if (!i)
609
579
  throw new Error(
610
580
  "[yoltra] No store in context. Wrap your tree in <StoreProvider store={...}>, or use the hooks returned by createYoltra (which default to their own store)."
@@ -614,121 +584,121 @@ function Ve(t) {
614
584
  function n() {
615
585
  return e().emit;
616
586
  }
617
- function o(i, d = Object.is) {
618
- const l = e(), y = A(() => (b) => l.subscribe(b), [l]), h = V(() => i(l.getState()), d, [l]);
619
- return I(y, h, h);
587
+ function o(i, v = Object.is) {
588
+ const l = e(), y = E(() => (g) => l.subscribe(g), [l]), m = V(() => i(l.getState()), v, [l]);
589
+ return I(y, m, m);
620
590
  }
621
- const c = (i, d, l) => {
622
- const y = e(), h = typeof i == "string", b = h ? i : i.reducer, j = h ? $e(d) : i.property, w = h ? void 0 : d, g = A(() => ({ reducer: b, property: x(j) }), [b, j]), O = A(
591
+ const c = (i, v, l) => {
592
+ const y = e(), m = typeof i == "string", g = m ? i : i.reducer, j = m ? Oe(v) : i.property, w = m ? void 0 : v, R = E(() => ({ reducer: g, property: x(j) }), [g, j]), O = E(
623
593
  () => ($) => y.connect(
624
- { reducer: g.reducer, property: g.property },
594
+ { reducer: R.reducer, property: R.property },
625
595
  () => $()
626
596
  ),
627
- [y, g]
628
- ), D = L(g.property), F = V(
597
+ [y, R]
598
+ ), D = L(R.property), F = V(
629
599
  () => {
630
- const R = y.getState()[g.reducer], N = D ? R : U(R, g.property);
600
+ const A = y.getState()[R.reducer], N = D ? A : U(A, R.property);
631
601
  return w ? w(N) : N;
632
602
  },
633
- l != null ? l : Object.is,
634
- [y, g]
603
+ l ?? Object.is,
604
+ [y, R]
635
605
  );
636
606
  return I(O, F, F);
637
- }, m = (i, d, l = Object.is) => {
638
- const y = e(), h = P(0), b = P(void 0), j = P(-1), w = P(!1), g = P(d);
639
- g.current = d;
607
+ }, d = (i, v, l = Object.is) => {
608
+ const y = e(), m = P(0), g = P(void 0), j = P(-1), w = P(!1), R = P(v);
609
+ R.current = v;
640
610
  const O = P(l);
641
611
  O.current = l;
642
- const D = A(() => i.map((R) => ({
643
- reducer: R.reducer,
644
- property: Array.isArray(R.property) ? R.property.map((N) => x(N)) : x(R.property)
645
- })), [Ce(i)]), F = A(
646
- () => (R) => {
612
+ const D = E(() => i.map((A) => ({
613
+ reducer: A.reducer,
614
+ property: Array.isArray(A.property) ? A.property.map((N) => x(N)) : x(A.property)
615
+ })), [je(i)]), F = E(
616
+ () => (A) => {
647
617
  const N = () => {
648
- h.current++, R();
649
- }, B = D.flatMap((T) => (Array.isArray(T.property) ? T.property : [T.property]).map((q) => y.connect({ reducer: T.reducer, property: q }, N)));
618
+ m.current++, A();
619
+ }, J = D.flatMap((T) => (Array.isArray(T.property) ? T.property : [T.property]).map((X) => y.connect({ reducer: T.reducer, property: X }, N)));
650
620
  return () => {
651
- for (const T of B) T();
621
+ for (const T of J) T();
652
622
  };
653
623
  },
654
624
  [y, D]
655
- ), $ = he(() => {
656
- if (j.current !== h.current || !w.current) {
657
- const R = g.current(y.getState());
658
- (!w.current || !O.current(b.current, R)) && (b.current = R, w.current = !0), j.current = h.current;
625
+ ), $ = me(() => {
626
+ if (j.current !== m.current || !w.current) {
627
+ const A = R.current(y.getState());
628
+ (!w.current || !O.current(g.current, A)) && (g.current = A, w.current = !0), j.current = m.current;
659
629
  }
660
- return b.current;
630
+ return g.current;
661
631
  }, [y]);
662
632
  return I(F, $, $);
663
- }, v = (i, d, l, y = "committed") => {
664
- const h = e(), b = P(l);
665
- b.current = l, ve(() => h.onEvent(
633
+ }, h = (i, v, l, y = "committed") => {
634
+ const m = e(), g = P(l);
635
+ g.current = l, he(() => m.onEvent(
666
636
  i,
667
- d,
668
- (j, w, g, O) => {
669
- b.current(
637
+ v,
638
+ (j, w, R, O) => {
639
+ g.current(
670
640
  j,
671
641
  w,
672
- g,
642
+ R,
673
643
  O
674
644
  );
675
645
  },
676
646
  y
677
- ), [h, i, d, y]);
678
- }, { useSuspenseAtomicProp: _, useSuspenseAtomicProps: p } = Ue(e);
647
+ ), [m, i, v, y]);
648
+ }, { useSuspenseAtomicProp: _, useSuspenseAtomicProps: p } = We(e);
679
649
  return {
680
650
  useStore: e,
681
651
  useEmit: n,
682
652
  useSelector: o,
683
653
  useAtomicProp: c,
684
- useAtomicProps: m,
685
- useEvent: v,
654
+ useAtomicProps: d,
655
+ useEvent: h,
686
656
  useSuspenseAtomicProp: _,
687
657
  useSuspenseAtomicProps: p,
688
- shallowEqual: Ie
658
+ shallowEqual: Ne
689
659
  };
690
660
  }
691
- function rt(t) {
692
- const e = Te(t), n = me(e), o = Ve(n);
661
+ function Ke(r) {
662
+ const e = Pe(r), n = de(e), o = Ge(n);
693
663
  return { store: e, StoreContext: n, StoreProvider: ({
694
664
  store: c,
695
665
  children: u
696
- }) => /* @__PURE__ */ Se.jsx(n.Provider, { value: c != null ? c : e, children: u }), ...o };
666
+ }) => /* @__PURE__ */ be.jsx(n.Provider, { value: c ?? e, children: u }), ...o };
697
667
  }
698
- function nt(t, e) {
668
+ function Qe(r, e) {
699
669
  return ee({
700
- reducer: t,
670
+ reducer: r,
701
671
  property: e.idsPath
702
672
  });
703
673
  }
704
- function ot(t, e, n) {
674
+ function er(r, e, n) {
705
675
  return ee({
706
- reducer: t,
676
+ reducer: r,
707
677
  property: e.pathTo(n)
708
678
  });
709
679
  }
710
- function st(t, e, n, o) {
680
+ function rr(r, e, n, o) {
711
681
  return ee({
712
- reducer: t,
682
+ reducer: r,
713
683
  property: e.pathTo(n, o)
714
684
  });
715
685
  }
716
686
  export {
717
- be as StoreContext,
718
- qe as StoreProvider,
719
- tt as clearSuspenseCache,
720
- Ve as createHooks,
721
- rt as createYoltra,
722
- Qe as invalidateAtomicProp,
723
- et as invalidateAtomicPropsByReducer,
724
- Ie as shallowEqual,
687
+ ye as StoreContext,
688
+ Ve as StoreProvider,
689
+ Ze as clearSuspenseCache,
690
+ Ge as createHooks,
691
+ Ke as createYoltra,
692
+ Xe as invalidateAtomicProp,
693
+ He as invalidateAtomicPropsByReducer,
694
+ Ne as shallowEqual,
725
695
  Y as suspenseCache,
726
- He as useEmit,
727
- ot as useEntity,
728
- st as useEntityField,
729
- nt as useEntityIds,
730
- Ke as useEvent,
731
- Ze as useSelector,
732
- J as useStore
696
+ qe as useEmit,
697
+ er as useEntity,
698
+ rr as useEntityField,
699
+ Qe as useEntityIds,
700
+ Be as useEvent,
701
+ Je as useSelector,
702
+ q as useStore
733
703
  };
734
704
  //# sourceMappingURL=index.mjs.map