@yoltra/react 0.4.0 → 0.6.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/README.md +20 -20
- package/dist/index.cjs +3 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +29 -47
- package/dist/index.mjs.map +1 -1
- package/dist/types/createYoltra.d.ts +1 -1
- package/dist/types/hooks/createHooks.d.ts +3 -3
- package/dist/types/hooks/hooks.d.ts +3 -3
- package/dist/types/hooks/suspense.d.ts +22 -3
- package/dist/types/index.d.ts +13 -12
- package/package.json +13 -12
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @yoltra/react v0.
|
|
2
|
+
* @yoltra/react v0.6.0
|
|
3
3
|
* (c) 2026 Manu Ramirez <@pixerael>
|
|
4
4
|
* License: MIT
|
|
5
5
|
* Homepage: https://yoltra.dev
|
|
@@ -7,27 +7,18 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree
|
|
9
9
|
*/
|
|
10
|
-
var
|
|
11
|
-
var _e = (t, e, n) => e in t ?
|
|
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
12
|
var ue = (t, e, n) => _e(t, typeof e != "symbol" ? e + "" : e, n);
|
|
13
|
-
import we, { createContext as me, useRef as
|
|
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
14
|
import { createStore as Te } from "@yoltra/core";
|
|
15
15
|
const be = me(null);
|
|
16
16
|
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
17
|
var ae;
|
|
27
18
|
function ke() {
|
|
28
19
|
if (ae) return z;
|
|
29
20
|
ae = 1;
|
|
30
|
-
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
21
|
+
var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
31
22
|
function n(o, s, c) {
|
|
32
23
|
var u = null;
|
|
33
24
|
if (c !== void 0 && (u = "" + c), s.key !== void 0 && (u = "" + s.key), "key" in s) {
|
|
@@ -46,15 +37,6 @@ function ke() {
|
|
|
46
37
|
return z.Fragment = e, z.jsx = n, z.jsxs = n, z;
|
|
47
38
|
}
|
|
48
39
|
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
40
|
var ie;
|
|
59
41
|
function xe() {
|
|
60
42
|
return ie || (ie = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
@@ -83,7 +65,7 @@ function xe() {
|
|
|
83
65
|
), r.$$typeof) {
|
|
84
66
|
case y:
|
|
85
67
|
return "Portal";
|
|
86
|
-
case
|
|
68
|
+
case g:
|
|
87
69
|
return (r.displayName || "Context") + ".Provider";
|
|
88
70
|
case w:
|
|
89
71
|
return (r._context.displayName || "Context") + ".Consumer";
|
|
@@ -211,8 +193,8 @@ function xe() {
|
|
|
211
193
|
else i(E);
|
|
212
194
|
if (X.call(a, "key")) {
|
|
213
195
|
E = t(r);
|
|
214
|
-
var M = Object.keys(a).filter(function(
|
|
215
|
-
return
|
|
196
|
+
var M = Object.keys(a).filter(function(ge) {
|
|
197
|
+
return ge !== "key";
|
|
216
198
|
});
|
|
217
199
|
S = 0 < M.length ? "{key: someKey, " + M.join(": ..., ") + ": ...}" : "{key: someKey}", ce[E + S] || (M = 0 < M.length ? "{" + M.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
218
200
|
`A props object containing a "key" prop is being spread into JSX:
|
|
@@ -249,7 +231,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
249
231
|
function i(r) {
|
|
250
232
|
typeof r == "object" && r !== null && r.$$typeof === l && r._store && (r._store.validated = 1);
|
|
251
233
|
}
|
|
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"),
|
|
234
|
+
var d = we, l = /* @__PURE__ */ Symbol.for("react.transitional.element"), y = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), b = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), w = /* @__PURE__ */ Symbol.for("react.consumer"), g = /* @__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"), R = /* @__PURE__ */ Symbol.for("react.lazy"), N = /* @__PURE__ */ Symbol.for("react.activity"), B = /* @__PURE__ */ 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() {
|
|
253
235
|
return null;
|
|
254
236
|
};
|
|
255
237
|
d = {
|
|
@@ -313,7 +295,7 @@ function Ce(t) {
|
|
|
313
295
|
return e(n.reducer) + e(String(o.length)) + o.map(e).join("");
|
|
314
296
|
}).join("");
|
|
315
297
|
}
|
|
316
|
-
const Ee = Symbol("yoltra.pathSegments");
|
|
298
|
+
const Ee = /* @__PURE__ */ Symbol("yoltra.pathSegments");
|
|
317
299
|
function Ae(t) {
|
|
318
300
|
const e = () => {
|
|
319
301
|
};
|
|
@@ -334,7 +316,7 @@ function $e(t) {
|
|
|
334
316
|
const e = t(Ae([])), n = e != null ? e[Ee] : void 0, s = (Array.isArray(n) ? n : []).join(".");
|
|
335
317
|
return s === "" && Oe(
|
|
336
318
|
"yoltra.toDottedPath.empty",
|
|
337
|
-
"[yoltra] A typed path accessor recorded no property access, so it
|
|
319
|
+
"[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
320
|
), s;
|
|
339
321
|
}
|
|
340
322
|
function U(t, e) {
|
|
@@ -347,9 +329,9 @@ function U(t, e) {
|
|
|
347
329
|
return n;
|
|
348
330
|
}
|
|
349
331
|
function V(t, e, n) {
|
|
350
|
-
const o =
|
|
332
|
+
const o = P(t);
|
|
351
333
|
o.current = t;
|
|
352
|
-
const s =
|
|
334
|
+
const s = P(e);
|
|
353
335
|
s.current = e;
|
|
354
336
|
const c = A(
|
|
355
337
|
() => ({ has: !1, value: void 0 }),
|
|
@@ -410,7 +392,7 @@ function ee(t, e, n = Object.is) {
|
|
|
410
392
|
return Ye(t, e, n);
|
|
411
393
|
}
|
|
412
394
|
function Ke(t, e, n, o = "committed") {
|
|
413
|
-
const s = J(), c =
|
|
395
|
+
const s = J(), c = P(n);
|
|
414
396
|
c.current = n, ve(() => s.onEvent(
|
|
415
397
|
t,
|
|
416
398
|
e,
|
|
@@ -537,7 +519,7 @@ function te(t, e, n) {
|
|
|
537
519
|
function Ge(t, e, n) {
|
|
538
520
|
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 }, () => {
|
|
539
521
|
Y.invalidate(u), i();
|
|
540
|
-
}), [o, s, c, u]), v =
|
|
522
|
+
}), [o, s, c, u]), v = P(n);
|
|
541
523
|
v.current = n;
|
|
542
524
|
const _ = A(() => {
|
|
543
525
|
const i = L(c);
|
|
@@ -575,7 +557,7 @@ function Le(t, e, n) {
|
|
|
575
557
|
return () => {
|
|
576
558
|
for (const l of d) l();
|
|
577
559
|
};
|
|
578
|
-
}, [o, s, c]), m =
|
|
560
|
+
}, [o, s, c]), m = P(n);
|
|
579
561
|
m.current = n;
|
|
580
562
|
const v = A(() => () => {
|
|
581
563
|
var d;
|
|
@@ -619,25 +601,25 @@ function Ve(t) {
|
|
|
619
601
|
return I(y, h, h);
|
|
620
602
|
}
|
|
621
603
|
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,
|
|
604
|
+
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(
|
|
623
605
|
() => ($) => y.connect(
|
|
624
|
-
{ reducer:
|
|
606
|
+
{ reducer: g.reducer, property: g.property },
|
|
625
607
|
() => $()
|
|
626
608
|
),
|
|
627
|
-
[y,
|
|
628
|
-
), D = L(
|
|
609
|
+
[y, g]
|
|
610
|
+
), D = L(g.property), F = V(
|
|
629
611
|
() => {
|
|
630
|
-
const R = y.getState()[
|
|
612
|
+
const R = y.getState()[g.reducer], N = D ? R : U(R, g.property);
|
|
631
613
|
return w ? w(N) : N;
|
|
632
614
|
},
|
|
633
615
|
l != null ? l : Object.is,
|
|
634
|
-
[y,
|
|
616
|
+
[y, g]
|
|
635
617
|
);
|
|
636
618
|
return I(O, F, F);
|
|
637
619
|
}, m = (i, d, l = Object.is) => {
|
|
638
|
-
const y = e(), h =
|
|
639
|
-
|
|
640
|
-
const O =
|
|
620
|
+
const y = e(), h = P(0), b = P(void 0), j = P(-1), w = P(!1), g = P(d);
|
|
621
|
+
g.current = d;
|
|
622
|
+
const O = P(l);
|
|
641
623
|
O.current = l;
|
|
642
624
|
const D = A(() => i.map((R) => ({
|
|
643
625
|
reducer: R.reducer,
|
|
@@ -654,22 +636,22 @@ function Ve(t) {
|
|
|
654
636
|
[y, D]
|
|
655
637
|
), $ = he(() => {
|
|
656
638
|
if (j.current !== h.current || !w.current) {
|
|
657
|
-
const R =
|
|
639
|
+
const R = g.current(y.getState());
|
|
658
640
|
(!w.current || !O.current(b.current, R)) && (b.current = R, w.current = !0), j.current = h.current;
|
|
659
641
|
}
|
|
660
642
|
return b.current;
|
|
661
643
|
}, [y]);
|
|
662
644
|
return I(F, $, $);
|
|
663
645
|
}, v = (i, d, l, y = "committed") => {
|
|
664
|
-
const h = e(), b =
|
|
646
|
+
const h = e(), b = P(l);
|
|
665
647
|
b.current = l, ve(() => h.onEvent(
|
|
666
648
|
i,
|
|
667
649
|
d,
|
|
668
|
-
(j, w,
|
|
650
|
+
(j, w, g, O) => {
|
|
669
651
|
b.current(
|
|
670
652
|
j,
|
|
671
653
|
w,
|
|
672
|
-
|
|
654
|
+
g,
|
|
673
655
|
O
|
|
674
656
|
);
|
|
675
657
|
},
|