@hortiview/modulebase 0.0.16348 → 0.0.20436

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.
Files changed (47) hide show
  1. package/dist/ModuleCore-DpwHP0IU.js +14973 -0
  2. package/dist/{QueryClientProvider-VtJdNkDw.js → QueryClientProvider-Beog9TR7.js} +25 -23
  3. package/dist/{_baseGet-B7FwMMGI.js → _baseGet-C6jMXSsQ.js} +447 -447
  4. package/dist/api-CogBuK0n.js +473 -0
  5. package/dist/components/ModuleBase.js +1 -1
  6. package/dist/components/ModuleCore.js +9 -14698
  7. package/dist/constants.js +1 -1
  8. package/dist/enum/ActionStorage.js +4 -0
  9. package/dist/hooks/useCustom.js +15 -18
  10. package/dist/hooks/useCustomMutation.js +12 -11
  11. package/dist/hooks/useEntity.js +48 -60
  12. package/dist/hooks/useOffline.js +57 -0
  13. package/dist/hooks/useOption.js +20 -20
  14. package/dist/hooks/useServiceBus.js +1 -1
  15. package/dist/hooks/useStores.js +1 -1
  16. package/dist/{query-CFoO2uy7.js → isRestoring-CLuxJVSA.js} +21 -17
  17. package/dist/lib/constants.d.ts +1 -1
  18. package/dist/lib/enum/ActionStorage.d.ts +7 -0
  19. package/dist/lib/hooks/useCustom.d.ts +3 -2
  20. package/dist/lib/hooks/useCustomMutation.d.ts +2 -1
  21. package/dist/lib/hooks/useEntity.d.ts +9 -23
  22. package/dist/lib/hooks/useOffline.d.ts +15 -0
  23. package/dist/lib/hooks/useStores.d.ts +10 -2
  24. package/dist/lib/main.d.ts +4 -0
  25. package/dist/lib/types/ActionStorage.d.ts +8 -0
  26. package/dist/lib/types/BaseProps.d.ts +10 -1
  27. package/dist/lib/types/Deprecated.d.ts +4 -0
  28. package/dist/lib/types/Entities.d.ts +22 -0
  29. package/dist/lib/utils/IndexedDbService.d.ts +33 -0
  30. package/dist/lib/utils/api.d.ts +1 -1
  31. package/dist/lib/utils/baseFetches.d.ts +2 -2
  32. package/dist/lib/utils/fetches.d.ts +2 -2
  33. package/dist/lib/utils/helper.d.ts +1 -0
  34. package/dist/main.js +218 -144
  35. package/dist/{mutation-CnKIetRs.js → mutation-DSKlaYzY.js} +1 -1
  36. package/dist/{omit-B7MWDtHq.js → omit-C9Qe80rl.js} +1 -1
  37. package/dist/types/ActionStorage.js +1 -0
  38. package/dist/types/Entities.js +25 -0
  39. package/dist/{useMutation-Num57Ulc.js → useMutation-zu8uxBak.js} +16 -16
  40. package/dist/{useQuery-XBGd5Kep.js → useQuery-Bj9k9zik.js} +39 -39
  41. package/dist/utils/IndexedDbService.js +43 -0
  42. package/dist/utils/api.js +1 -1
  43. package/dist/utils/baseFetches.js +15 -15
  44. package/dist/utils/fetches.js +10 -10
  45. package/dist/utils/helper.js +25 -20
  46. package/package.json +7 -3
  47. package/dist/api-D9Lmqe6S.js +0 -458
@@ -1,6 +1,6 @@
1
1
  import * as F from "react";
2
2
  import { jsx as R } from "react/jsx-runtime";
3
- var C = class {
3
+ var L = class {
4
4
  constructor() {
5
5
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
6
  }
@@ -16,7 +16,7 @@ var C = class {
16
16
  }
17
17
  onUnsubscribe() {
18
18
  }
19
- }, d = typeof window > "u" || "Deno" in globalThis;
19
+ }, y = typeof window > "u" || "Deno" in globalThis;
20
20
  function J() {
21
21
  }
22
22
  function _(e, t) {
@@ -155,13 +155,13 @@ function se(e, t) {
155
155
  `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
156
156
  ), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === P ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
157
157
  }
158
- var D = class extends C {
158
+ var D = class extends L {
159
159
  #e;
160
160
  #t;
161
161
  #n;
162
162
  constructor() {
163
163
  super(), this.#n = (e) => {
164
- if (!d && window.addEventListener) {
164
+ if (!y && window.addEventListener) {
165
165
  const t = () => e();
166
166
  return window.addEventListener("visibilitychange", t, !1), () => {
167
167
  window.removeEventListener("visibilitychange", t);
@@ -192,13 +192,13 @@ var D = class extends C {
192
192
  isFocused() {
193
193
  return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
194
194
  }
195
- }, I = new D(), A = class extends C {
195
+ }, I = new D(), A = class extends L {
196
196
  #e = !0;
197
197
  #t;
198
198
  #n;
199
199
  constructor() {
200
200
  super(), this.#n = (e) => {
201
- if (!d && window.addEventListener) {
201
+ if (!y && window.addEventListener) {
202
202
  const t = () => e(!0), n = () => e(!1);
203
203
  return window.addEventListener("online", t, !1), window.addEventListener("offline", n, !1), () => {
204
204
  window.removeEventListener("online", t), window.removeEventListener("offline", n);
@@ -223,7 +223,7 @@ var D = class extends C {
223
223
  isOnline() {
224
224
  return this.#e;
225
225
  }
226
- }, L = new A();
226
+ }, k = new A();
227
227
  function U() {
228
228
  let e, t;
229
229
  const n = new Promise((s, o) => {
@@ -250,25 +250,25 @@ function G(e) {
250
250
  return Math.min(1e3 * 2 ** e, 3e4);
251
251
  }
252
252
  function H(e) {
253
- return (e ?? "online") === "online" ? L.isOnline() : !0;
253
+ return (e ?? "online") === "online" ? k.isOnline() : !0;
254
254
  }
255
- var q = class extends Error {
255
+ var C = class extends Error {
256
256
  constructor(e) {
257
257
  super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
258
258
  }
259
259
  };
260
260
  function ie(e) {
261
- return e instanceof q;
261
+ return e instanceof C;
262
262
  }
263
263
  function oe(e) {
264
264
  let t = !1, n = 0, r = !1, s;
265
265
  const o = U(), l = (a) => {
266
- r || (b(new q(a)), e.abort?.());
266
+ r || (b(new C(a)), e.abort?.());
267
267
  }, i = () => {
268
268
  t = !0;
269
269
  }, u = () => {
270
270
  t = !1;
271
- }, f = () => I.isFocused() && (e.networkMode === "always" || L.isOnline()) && e.canRun(), c = () => H(e.networkMode) && e.canRun(), M = (a) => {
271
+ }, f = () => I.isFocused() && (e.networkMode === "always" || k.isOnline()) && e.canRun(), c = () => H(e.networkMode) && e.canRun(), M = (a) => {
272
272
  r || (r = !0, e.onSuccess?.(a), s?.(), o.resolve(a));
273
273
  }, b = (a) => {
274
274
  r || (r = !0, e.onError?.(a), s?.(), o.reject(a));
@@ -291,7 +291,7 @@ function oe(e) {
291
291
  Promise.resolve(a).then(M).catch((h) => {
292
292
  if (r)
293
293
  return;
294
- const y = e.retry ?? (d ? 0 : 3), v = e.retryDelay ?? G, x = typeof v == "function" ? v(n, h) : v, N = y === !0 || typeof y == "number" && n < y || typeof y == "function" && y(n, h);
294
+ const d = e.retry ?? (y ? 0 : 3), v = e.retryDelay ?? G, x = typeof v == "function" ? v(n, h) : v, N = d === !0 || typeof d == "number" && n < d || typeof d == "function" && d(n, h);
295
295
  if (t || !N) {
296
296
  b(h);
297
297
  return;
@@ -383,16 +383,18 @@ var ue = V(), ce = class {
383
383
  updateGcTime(e) {
384
384
  this.gcTime = Math.max(
385
385
  this.gcTime || 0,
386
- e ?? (d ? 1 / 0 : 5 * 60 * 1e3)
386
+ e ?? (y ? 1 / 0 : 5 * 60 * 1e3)
387
387
  );
388
388
  }
389
389
  clearGcTimeout() {
390
390
  this.#e && (clearTimeout(this.#e), this.#e = void 0);
391
391
  }
392
- }, k = F.createContext(
392
+ }, q = F.createContext(
393
393
  void 0
394
394
  ), ae = (e) => {
395
- const t = F.useContext(k);
395
+ const t = F.useContext(q);
396
+ if (e)
397
+ return e;
396
398
  if (!t)
397
399
  throw new Error("No QueryClient set, use QueryClientProvider to set one");
398
400
  return t;
@@ -401,21 +403,21 @@ var ue = V(), ce = class {
401
403
  children: t
402
404
  }) => (F.useEffect(() => (e.mount(), () => {
403
405
  e.unmount();
404
- }), [e]), /* @__PURE__ */ R(k.Provider, { value: e, children: t }));
406
+ }), [e]), /* @__PURE__ */ R(q.Provider, { value: e, children: t }));
405
407
  export {
406
408
  le as Q,
407
409
  ce as R,
408
- C as S,
410
+ L as S,
409
411
  J as a,
410
412
  X as b,
411
413
  oe as c,
412
- H as d,
414
+ P as d,
413
415
  se as e,
414
- ee as f,
416
+ H as f,
415
417
  W as g,
416
418
  w as h,
417
419
  ie as i,
418
- d as j,
420
+ y as j,
419
421
  Q as k,
420
422
  I as l,
421
423
  K as m,
@@ -424,12 +426,12 @@ export {
424
426
  U as p,
425
427
  Z as q,
426
428
  te as r,
427
- P as s,
429
+ ee as s,
428
430
  B as t,
429
431
  ae as u,
430
432
  re as v,
431
433
  ne as w,
432
- L as x,
434
+ k as x,
433
435
  _ as y,
434
436
  S as z
435
437
  };