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