@hortiview/modulebase 0.0.13100-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-CLuxJVSA.js → IsRestoringProvider-B1U_sG8s.js} +86 -78
- package/dist/{ModuleCore-YCIFN_02.js → ModuleCore-DcwaLp89.js} +4367 -4318
- package/dist/{QueryClientProvider-Beog9TR7.js → QueryClientProvider-C7EHlqBQ.js} +122 -117
- 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 +3 -1
- package/dist/lib/types/ActionStorage.d.ts +1 -0
- package/dist/lib/types/BaseProps.d.ts +2 -0
- package/dist/main.js +130 -125
- package/dist/module-router.js +101 -93
- package/dist/{mutation-DSKlaYzY.js → mutation-CJplExaP.js} +17 -14
- package/dist/types/ActionStorage.js +2 -2
- package/dist/{useMutation-zu8uxBak.js → useMutation-BEK2_IOo.js} +16 -17
- package/dist/{useQuery-Bj9k9zik.js → useQuery-B23OSvXW.js} +142 -154
- 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
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,38 +16,38 @@ var L = class {
|
|
|
16
16
|
}
|
|
17
17
|
onUnsubscribe() {
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
function
|
|
19
|
+
}, b = typeof window > "u" || "Deno" in globalThis;
|
|
20
|
+
function _() {
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function B(e, t) {
|
|
23
23
|
return typeof e == "function" ? e(t) : e;
|
|
24
24
|
}
|
|
25
25
|
function Q(e) {
|
|
26
26
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
27
27
|
}
|
|
28
|
-
function B(e, t) {
|
|
29
|
-
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
30
|
-
}
|
|
31
28
|
function W(e, t) {
|
|
32
|
-
return
|
|
29
|
+
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
33
30
|
}
|
|
34
31
|
function X(e, t) {
|
|
35
32
|
return typeof e == "function" ? e(t) : e;
|
|
36
33
|
}
|
|
37
34
|
function Y(e, t) {
|
|
35
|
+
return typeof e == "function" ? e(t) : e;
|
|
36
|
+
}
|
|
37
|
+
function Z(e, t) {
|
|
38
38
|
const {
|
|
39
39
|
type: n = "all",
|
|
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") {
|
|
@@ -57,47 +57,47 @@ function Y(e, t) {
|
|
|
57
57
|
}
|
|
58
58
|
return !(typeof i == "boolean" && t.isStale() !== i || s && s !== t.state.fetchStatus || o && !o(t));
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function ee(e, t) {
|
|
61
61
|
const { exact: n, status: r, predicate: s, mutationKey: o } = e;
|
|
62
62
|
if (o) {
|
|
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
|
}
|
|
100
|
-
function
|
|
100
|
+
function te(e, t) {
|
|
101
101
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
102
102
|
return !1;
|
|
103
103
|
for (const n in e)
|
|
@@ -105,63 +105,66 @@ function ee(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
|
});
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function ne(e, t, n) {
|
|
129
129
|
if (typeof n.structuralSharing == "function")
|
|
130
130
|
return n.structuralSharing(e, t);
|
|
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
|
-
console.error(
|
|
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
|
}
|
|
144
|
-
function
|
|
144
|
+
function re(e, t, n = 0) {
|
|
145
145
|
const r = [...e, t];
|
|
146
146
|
return n && r.length > n ? r.slice(1) : r;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
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
|
|
153
|
-
function
|
|
154
|
-
return process.env.NODE_ENV !== "production" && e.queryFn ===
|
|
152
|
+
var L = Symbol();
|
|
153
|
+
function ie(e, t) {
|
|
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
|
+
}
|
|
158
|
+
function oe(e, t) {
|
|
159
|
+
return typeof e == "function" ? e(...t) : !!e;
|
|
157
160
|
}
|
|
158
|
-
var
|
|
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,78 +253,79 @@ 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
|
|
261
|
-
return e instanceof
|
|
263
|
+
function ue(e) {
|
|
264
|
+
return e instanceof q;
|
|
262
265
|
}
|
|
263
|
-
function
|
|
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);
|
|
318
|
+
function $() {
|
|
315
319
|
let e = [], t = 0, n = (i) => {
|
|
316
320
|
i();
|
|
317
321
|
}, r = (i) => {
|
|
318
322
|
i();
|
|
319
|
-
}, s =
|
|
323
|
+
}, s = V;
|
|
320
324
|
const o = (i) => {
|
|
321
325
|
t ? e.push(i) : s(() => {
|
|
322
326
|
n(i);
|
|
323
327
|
});
|
|
324
|
-
},
|
|
328
|
+
}, f = () => {
|
|
325
329
|
const i = e;
|
|
326
330
|
e = [], i.length && s(() => {
|
|
327
331
|
r(() => {
|
|
@@ -338,7 +342,7 @@ function V() {
|
|
|
338
342
|
try {
|
|
339
343
|
u = i();
|
|
340
344
|
} finally {
|
|
341
|
-
t--, t ||
|
|
345
|
+
t--, t || f();
|
|
342
346
|
}
|
|
343
347
|
return u;
|
|
344
348
|
},
|
|
@@ -370,7 +374,7 @@ function V() {
|
|
|
370
374
|
}
|
|
371
375
|
};
|
|
372
376
|
}
|
|
373
|
-
var
|
|
377
|
+
var ae = $(), fe = class {
|
|
374
378
|
#e;
|
|
375
379
|
destroy() {
|
|
376
380
|
this.clearGcTimeout();
|
|
@@ -383,55 +387,56 @@ var ue = V(), ce = class {
|
|
|
383
387
|
updateGcTime(e) {
|
|
384
388
|
this.gcTime = Math.max(
|
|
385
389
|
this.gcTime || 0,
|
|
386
|
-
e ?? (
|
|
390
|
+
e ?? (b ? 1 / 0 : 5 * 60 * 1e3)
|
|
387
391
|
);
|
|
388
392
|
}
|
|
389
393
|
clearGcTimeout() {
|
|
390
394
|
this.#e && (clearTimeout(this.#e), this.#e = void 0);
|
|
391
395
|
}
|
|
392
|
-
},
|
|
396
|
+
}, M = F.createContext(
|
|
393
397
|
void 0
|
|
394
|
-
),
|
|
395
|
-
const t = F.useContext(
|
|
398
|
+
), le = (e) => {
|
|
399
|
+
const t = F.useContext(M);
|
|
396
400
|
if (e)
|
|
397
401
|
return e;
|
|
398
402
|
if (!t)
|
|
399
403
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
400
404
|
return t;
|
|
401
|
-
},
|
|
405
|
+
}, he = ({
|
|
402
406
|
client: e,
|
|
403
407
|
children: t
|
|
404
408
|
}) => (F.useEffect(() => (e.mount(), () => {
|
|
405
409
|
e.unmount();
|
|
406
|
-
}), [e]), /* @__PURE__ */ R(
|
|
410
|
+
}), [e]), /* @__PURE__ */ R(M.Provider, { value: e, children: t }));
|
|
407
411
|
export {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
oe as
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
412
|
+
j as A,
|
|
413
|
+
he as Q,
|
|
414
|
+
fe as R,
|
|
415
|
+
k as S,
|
|
416
|
+
_ as a,
|
|
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,
|
|
426
431
|
U as p,
|
|
427
432
|
Z as q,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
433
|
+
ne as r,
|
|
434
|
+
te as s,
|
|
435
|
+
W as t,
|
|
436
|
+
le as u,
|
|
437
|
+
ee as v,
|
|
438
|
+
se as w,
|
|
439
|
+
re as x,
|
|
440
|
+
C as y,
|
|
441
|
+
B as z
|
|
437
442
|
};
|