@hortiview/modulebase 0.0.13101-beta → 0.0.13102-beta
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/{isRestoring-LSIsLTaI.js → IsRestoringProvider-B1U_sG8s.js} +86 -78
- package/dist/{ModuleCore-BWvRhZyP.js → ModuleCore-DcwaLp89.js} +4360 -4318
- package/dist/{QueryClientProvider-BSM1ol7r.js → QueryClientProvider-C7EHlqBQ.js} +102 -98
- package/dist/chunk-QMGIS6GS-C4bgXQXY.js +9203 -0
- package/dist/components/ModuleBase.js +2 -2
- package/dist/components/ModuleCore.js +1 -1
- package/dist/hooks/useCustom.js +1 -1
- package/dist/hooks/useCustomMutation.js +2 -2
- package/dist/hooks/useEntity.js +1 -1
- package/dist/hooks/useOffline.js +1 -1
- package/dist/hooks/useOption.js +1 -1
- package/dist/hooks/useServiceBus.js +1 -1
- package/dist/lib/hooks/useCustom.d.ts +1 -1
- package/dist/lib/hooks/useStores.d.ts +2 -1
- package/dist/lib/types/ActionStorage.d.ts +1 -0
- package/dist/lib/types/BaseProps.d.ts +1 -0
- package/dist/main.js +126 -118
- package/dist/module-router.js +101 -93
- package/dist/{mutation-EhVtpjb0.js → mutation-CJplExaP.js} +17 -14
- package/dist/types/ActionStorage.js +2 -2
- package/dist/{useMutation-BYO7aks8.js → useMutation-BEK2_IOo.js} +16 -17
- package/dist/{useQuery-Jx956wwH.js → useQuery-B23OSvXW.js} +124 -136
- package/dist/utils/helper.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-IR6S3I6Y-BmDdD3SP.js +0 -8162
- package/dist/utils-DxRR_XLb.js +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as F from "react";
|
|
2
2
|
import { jsx as R } from "react/jsx-runtime";
|
|
3
|
-
var
|
|
3
|
+
var k = class {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
6
6
|
}
|
|
@@ -16,7 +16,7 @@ var L = class {
|
|
|
16
16
|
}
|
|
17
17
|
onUnsubscribe() {
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, b = typeof window > "u" || "Deno" in globalThis;
|
|
20
20
|
function _() {
|
|
21
21
|
}
|
|
22
22
|
function B(e, t) {
|
|
@@ -40,14 +40,14 @@ function Z(e, t) {
|
|
|
40
40
|
exact: r,
|
|
41
41
|
fetchStatus: s,
|
|
42
42
|
predicate: o,
|
|
43
|
-
queryKey:
|
|
43
|
+
queryKey: f,
|
|
44
44
|
stale: i
|
|
45
45
|
} = e;
|
|
46
|
-
if (
|
|
46
|
+
if (f) {
|
|
47
47
|
if (r) {
|
|
48
|
-
if (t.queryHash !== K(
|
|
48
|
+
if (t.queryHash !== K(f, t.options))
|
|
49
49
|
return !1;
|
|
50
|
-
} else if (!
|
|
50
|
+
} else if (!j(t.queryKey, f))
|
|
51
51
|
return !1;
|
|
52
52
|
}
|
|
53
53
|
if (n !== "all") {
|
|
@@ -63,37 +63,37 @@ function ee(e, t) {
|
|
|
63
63
|
if (!t.options.mutationKey)
|
|
64
64
|
return !1;
|
|
65
65
|
if (n) {
|
|
66
|
-
if (
|
|
66
|
+
if (S(t.options.mutationKey) !== S(o))
|
|
67
67
|
return !1;
|
|
68
|
-
} else if (!
|
|
68
|
+
} else if (!j(t.options.mutationKey, o))
|
|
69
69
|
return !1;
|
|
70
70
|
}
|
|
71
71
|
return !(r && t.state.status !== r || s && !s(t));
|
|
72
72
|
}
|
|
73
73
|
function K(e, t) {
|
|
74
|
-
return (t?.queryKeyHashFn ||
|
|
74
|
+
return (t?.queryKeyHashFn || S)(e);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function S(e) {
|
|
77
77
|
return JSON.stringify(
|
|
78
78
|
e,
|
|
79
|
-
(t, n) =>
|
|
79
|
+
(t, n) => E(n) ? Object.keys(n).sort().reduce((r, s) => (r[s] = n[s], r), {}) : n
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ?
|
|
82
|
+
function j(e, t) {
|
|
83
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((n) => j(e[n], t[n])) : !1;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function g(e, t) {
|
|
86
86
|
if (e === t)
|
|
87
87
|
return e;
|
|
88
|
-
const n =
|
|
89
|
-
if (n ||
|
|
90
|
-
const r = n ? e : Object.keys(e), s = r.length, o = n ? t : Object.keys(t),
|
|
91
|
-
let
|
|
92
|
-
for (let
|
|
93
|
-
const
|
|
94
|
-
(!n &&
|
|
88
|
+
const n = T(e) && T(t);
|
|
89
|
+
if (n || E(e) && E(t)) {
|
|
90
|
+
const r = n ? e : Object.keys(e), s = r.length, o = n ? t : Object.keys(t), f = o.length, i = n ? [] : {}, u = new Set(r);
|
|
91
|
+
let d = 0;
|
|
92
|
+
for (let l = 0; l < f; l++) {
|
|
93
|
+
const a = n ? l : o[l];
|
|
94
|
+
(!n && u.has(a) || n) && e[a] === void 0 && t[a] === void 0 ? (i[a] = void 0, d++) : (i[a] = g(e[a], t[a]), i[a] === e[a] && e[a] !== void 0 && d++);
|
|
95
95
|
}
|
|
96
|
-
return s ===
|
|
96
|
+
return s === f && d === s ? e : i;
|
|
97
97
|
}
|
|
98
98
|
return t;
|
|
99
99
|
}
|
|
@@ -105,22 +105,22 @@ function te(e, t) {
|
|
|
105
105
|
return !1;
|
|
106
106
|
return !0;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function T(e) {
|
|
109
109
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (!
|
|
111
|
+
function E(e) {
|
|
112
|
+
if (!P(e))
|
|
113
113
|
return !1;
|
|
114
114
|
const t = e.constructor;
|
|
115
115
|
if (t === void 0)
|
|
116
116
|
return !0;
|
|
117
117
|
const n = t.prototype;
|
|
118
|
-
return !(!
|
|
118
|
+
return !(!P(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function P(e) {
|
|
121
121
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function I(e) {
|
|
124
124
|
return new Promise((t) => {
|
|
125
125
|
setTimeout(t, e);
|
|
126
126
|
});
|
|
@@ -131,13 +131,13 @@ function ne(e, t, n) {
|
|
|
131
131
|
if (n.structuralSharing !== !1) {
|
|
132
132
|
if (process.env.NODE_ENV !== "production")
|
|
133
133
|
try {
|
|
134
|
-
return
|
|
134
|
+
return g(e, t);
|
|
135
135
|
} catch (r) {
|
|
136
136
|
throw console.error(
|
|
137
137
|
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`
|
|
138
138
|
), r;
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return g(e, t);
|
|
141
141
|
}
|
|
142
142
|
return t;
|
|
143
143
|
}
|
|
@@ -149,19 +149,22 @@ function se(e, t, n = 0) {
|
|
|
149
149
|
const r = [t, ...e];
|
|
150
150
|
return n && r.length > n ? r.slice(0, -1) : r;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var L = Symbol();
|
|
153
153
|
function ie(e, t) {
|
|
154
|
-
return process.env.NODE_ENV !== "production" && e.queryFn ===
|
|
154
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === L && console.error(
|
|
155
155
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
156
|
-
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn ===
|
|
156
|
+
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === L ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
function oe(e, t) {
|
|
159
|
+
return typeof e == "function" ? e(...t) : !!e;
|
|
160
|
+
}
|
|
161
|
+
var z = class extends k {
|
|
159
162
|
#e;
|
|
160
163
|
#t;
|
|
161
164
|
#n;
|
|
162
165
|
constructor() {
|
|
163
166
|
super(), this.#n = (e) => {
|
|
164
|
-
if (!
|
|
167
|
+
if (!b && window.addEventListener) {
|
|
165
168
|
const t = () => e();
|
|
166
169
|
return window.addEventListener("visibilitychange", t, !1), () => {
|
|
167
170
|
window.removeEventListener("visibilitychange", t);
|
|
@@ -192,13 +195,13 @@ var D = class extends L {
|
|
|
192
195
|
isFocused() {
|
|
193
196
|
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
194
197
|
}
|
|
195
|
-
},
|
|
198
|
+
}, A = new z(), D = class extends k {
|
|
196
199
|
#e = !0;
|
|
197
200
|
#t;
|
|
198
201
|
#n;
|
|
199
202
|
constructor() {
|
|
200
203
|
super(), this.#n = (e) => {
|
|
201
|
-
if (!
|
|
204
|
+
if (!b && window.addEventListener) {
|
|
202
205
|
const t = () => e(!0), n = () => e(!1);
|
|
203
206
|
return window.addEventListener("online", t, !1), window.addEventListener("offline", n, !1), () => {
|
|
204
207
|
window.removeEventListener("online", t), window.removeEventListener("offline", n);
|
|
@@ -223,7 +226,7 @@ var D = class extends L {
|
|
|
223
226
|
isOnline() {
|
|
224
227
|
return this.#e;
|
|
225
228
|
}
|
|
226
|
-
},
|
|
229
|
+
}, C = new D();
|
|
227
230
|
function U() {
|
|
228
231
|
let e, t;
|
|
229
232
|
const n = new Promise((s, o) => {
|
|
@@ -250,65 +253,65 @@ function G(e) {
|
|
|
250
253
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
251
254
|
}
|
|
252
255
|
function H(e) {
|
|
253
|
-
return (e ?? "online") === "online" ?
|
|
256
|
+
return (e ?? "online") === "online" ? C.isOnline() : !0;
|
|
254
257
|
}
|
|
255
|
-
var
|
|
258
|
+
var q = class extends Error {
|
|
256
259
|
constructor(e) {
|
|
257
260
|
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
258
261
|
}
|
|
259
262
|
};
|
|
260
|
-
function oe(e) {
|
|
261
|
-
return e instanceof C;
|
|
262
|
-
}
|
|
263
263
|
function ue(e) {
|
|
264
|
+
return e instanceof q;
|
|
265
|
+
}
|
|
266
|
+
function ce(e) {
|
|
264
267
|
let t = !1, n = 0, r = !1, s;
|
|
265
|
-
const o = U(),
|
|
266
|
-
r || (
|
|
268
|
+
const o = U(), f = (c) => {
|
|
269
|
+
r || (m(new q(c)), e.abort?.());
|
|
267
270
|
}, i = () => {
|
|
268
271
|
t = !0;
|
|
269
272
|
}, u = () => {
|
|
270
273
|
t = !1;
|
|
271
|
-
},
|
|
272
|
-
r || (r = !0, e.onSuccess?.(
|
|
273
|
-
},
|
|
274
|
-
r || (r = !0, e.onError?.(
|
|
275
|
-
}, O = () => new Promise((
|
|
276
|
-
s = (
|
|
277
|
-
(r ||
|
|
274
|
+
}, d = () => A.isFocused() && (e.networkMode === "always" || C.isOnline()) && e.canRun(), l = () => H(e.networkMode) && e.canRun(), a = (c) => {
|
|
275
|
+
r || (r = !0, e.onSuccess?.(c), s?.(), o.resolve(c));
|
|
276
|
+
}, m = (c) => {
|
|
277
|
+
r || (r = !0, e.onError?.(c), s?.(), o.reject(c));
|
|
278
|
+
}, O = () => new Promise((c) => {
|
|
279
|
+
s = (v) => {
|
|
280
|
+
(r || d()) && c(v);
|
|
278
281
|
}, e.onPause?.();
|
|
279
282
|
}).then(() => {
|
|
280
283
|
s = void 0, r || e.onContinue?.();
|
|
281
|
-
}),
|
|
284
|
+
}), p = () => {
|
|
282
285
|
if (r)
|
|
283
286
|
return;
|
|
284
|
-
let
|
|
285
|
-
const
|
|
287
|
+
let c;
|
|
288
|
+
const v = n === 0 ? e.initialPromise : void 0;
|
|
286
289
|
try {
|
|
287
|
-
|
|
290
|
+
c = v ?? e.fn();
|
|
288
291
|
} catch (h) {
|
|
289
|
-
|
|
292
|
+
c = Promise.reject(h);
|
|
290
293
|
}
|
|
291
|
-
Promise.resolve(
|
|
294
|
+
Promise.resolve(c).then(a).catch((h) => {
|
|
292
295
|
if (r)
|
|
293
296
|
return;
|
|
294
|
-
const
|
|
297
|
+
const y = e.retry ?? (b ? 0 : 3), w = e.retryDelay ?? G, x = typeof w == "function" ? w(n, h) : w, N = y === !0 || typeof y == "number" && n < y || typeof y == "function" && y(n, h);
|
|
295
298
|
if (t || !N) {
|
|
296
|
-
|
|
299
|
+
m(h);
|
|
297
300
|
return;
|
|
298
301
|
}
|
|
299
|
-
n++, e.onFail?.(n, h),
|
|
300
|
-
t ?
|
|
302
|
+
n++, e.onFail?.(n, h), I(x).then(() => d() ? void 0 : O()).then(() => {
|
|
303
|
+
t ? m(h) : p();
|
|
301
304
|
});
|
|
302
305
|
});
|
|
303
306
|
};
|
|
304
307
|
return {
|
|
305
308
|
promise: o,
|
|
306
|
-
cancel:
|
|
309
|
+
cancel: f,
|
|
307
310
|
continue: () => (s?.(), o),
|
|
308
311
|
cancelRetry: i,
|
|
309
312
|
continueRetry: u,
|
|
310
|
-
canStart:
|
|
311
|
-
start: () => (
|
|
313
|
+
canStart: l,
|
|
314
|
+
start: () => (l() ? p() : O().then(p), o)
|
|
312
315
|
};
|
|
313
316
|
}
|
|
314
317
|
var V = (e) => setTimeout(e, 0);
|
|
@@ -322,7 +325,7 @@ function $() {
|
|
|
322
325
|
t ? e.push(i) : s(() => {
|
|
323
326
|
n(i);
|
|
324
327
|
});
|
|
325
|
-
},
|
|
328
|
+
}, f = () => {
|
|
326
329
|
const i = e;
|
|
327
330
|
e = [], i.length && s(() => {
|
|
328
331
|
r(() => {
|
|
@@ -339,7 +342,7 @@ function $() {
|
|
|
339
342
|
try {
|
|
340
343
|
u = i();
|
|
341
344
|
} finally {
|
|
342
|
-
t--, t ||
|
|
345
|
+
t--, t || f();
|
|
343
346
|
}
|
|
344
347
|
return u;
|
|
345
348
|
},
|
|
@@ -371,7 +374,7 @@ function $() {
|
|
|
371
374
|
}
|
|
372
375
|
};
|
|
373
376
|
}
|
|
374
|
-
var
|
|
377
|
+
var ae = $(), fe = class {
|
|
375
378
|
#e;
|
|
376
379
|
destroy() {
|
|
377
380
|
this.clearGcTimeout();
|
|
@@ -384,55 +387,56 @@ var ce = $(), ae = class {
|
|
|
384
387
|
updateGcTime(e) {
|
|
385
388
|
this.gcTime = Math.max(
|
|
386
389
|
this.gcTime || 0,
|
|
387
|
-
e ?? (
|
|
390
|
+
e ?? (b ? 1 / 0 : 5 * 60 * 1e3)
|
|
388
391
|
);
|
|
389
392
|
}
|
|
390
393
|
clearGcTimeout() {
|
|
391
394
|
this.#e && (clearTimeout(this.#e), this.#e = void 0);
|
|
392
395
|
}
|
|
393
|
-
},
|
|
396
|
+
}, M = F.createContext(
|
|
394
397
|
void 0
|
|
395
398
|
), le = (e) => {
|
|
396
|
-
const t =
|
|
399
|
+
const t = F.useContext(M);
|
|
397
400
|
if (e)
|
|
398
401
|
return e;
|
|
399
402
|
if (!t)
|
|
400
403
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
401
404
|
return t;
|
|
402
|
-
},
|
|
405
|
+
}, he = ({
|
|
403
406
|
client: e,
|
|
404
407
|
children: t
|
|
405
|
-
}) => (
|
|
408
|
+
}) => (F.useEffect(() => (e.mount(), () => {
|
|
406
409
|
e.unmount();
|
|
407
|
-
}), [e]), /* @__PURE__ */ R(
|
|
410
|
+
}), [e]), /* @__PURE__ */ R(M.Provider, { value: e, children: t }));
|
|
408
411
|
export {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
+
j as A,
|
|
413
|
+
he as Q,
|
|
414
|
+
fe as R,
|
|
415
|
+
k as S,
|
|
412
416
|
_ as a,
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
417
|
+
oe as b,
|
|
418
|
+
ce as c,
|
|
419
|
+
Y as d,
|
|
420
|
+
L as e,
|
|
421
|
+
X as f,
|
|
422
|
+
H as g,
|
|
423
|
+
S as h,
|
|
424
|
+
ue as i,
|
|
425
|
+
ie as j,
|
|
426
|
+
b as k,
|
|
427
|
+
Q as l,
|
|
428
|
+
A as m,
|
|
429
|
+
ae as n,
|
|
430
|
+
K as o,
|
|
427
431
|
U as p,
|
|
428
|
-
|
|
432
|
+
Z as q,
|
|
429
433
|
ne as r,
|
|
430
434
|
te as s,
|
|
431
435
|
W as t,
|
|
432
436
|
le as u,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
437
|
+
ee as v,
|
|
438
|
+
se as w,
|
|
439
|
+
re as x,
|
|
440
|
+
C as y,
|
|
441
|
+
B as z
|
|
438
442
|
};
|