@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.
@@ -1,6 +1,6 @@
1
1
  import * as F from "react";
2
2
  import { jsx as R } from "react/jsx-runtime";
3
- var L = class {
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
- }, y = typeof window > "u" || "Deno" in globalThis;
20
- function J() {
19
+ }, b = typeof window > "u" || "Deno" in globalThis;
20
+ function _() {
21
21
  }
22
- function _(e, t) {
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 typeof e == "function" ? e(t) : e;
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: l,
43
+ queryKey: f,
44
44
  stale: i
45
45
  } = e;
46
- if (l) {
46
+ if (f) {
47
47
  if (r) {
48
- if (t.queryHash !== K(l, t.options))
48
+ if (t.queryHash !== K(f, t.options))
49
49
  return !1;
50
- } else if (!S(t.queryKey, l))
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 Z(e, t) {
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 (w(t.options.mutationKey) !== w(o))
66
+ if (S(t.options.mutationKey) !== S(o))
67
67
  return !1;
68
- } else if (!S(t.options.mutationKey, o))
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 || w)(e);
74
+ return (t?.queryKeyHashFn || S)(e);
75
75
  }
76
- function w(e) {
76
+ function S(e) {
77
77
  return JSON.stringify(
78
78
  e,
79
- (t, n) => g(n) ? Object.keys(n).sort().reduce((r, s) => (r[s] = n[s], r), {}) : 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 S(e, t) {
83
- return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((n) => !S(e[n], t[n])) : !1;
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 E(e, t) {
85
+ function g(e, t) {
86
86
  if (e === t)
87
87
  return e;
88
- const n = j(e) && j(t);
89
- if (n || g(e) && g(t)) {
90
- const r = n ? e : Object.keys(e), s = r.length, o = n ? t : Object.keys(t), l = o.length, i = n ? [] : {};
91
- let u = 0;
92
- for (let f = 0; f < l; f++) {
93
- const c = n ? f : o[f];
94
- (!n && r.includes(c) || n) && e[c] === void 0 && t[c] === void 0 ? (i[c] = void 0, u++) : (i[c] = E(e[c], t[c]), i[c] === e[c] && e[c] !== void 0 && u++);
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 === l && u === s ? e : i;
96
+ return s === f && d === s ? e : i;
97
97
  }
98
98
  return t;
99
99
  }
100
- function ee(e, t) {
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 j(e) {
108
+ function T(e) {
109
109
  return Array.isArray(e) && e.length === Object.keys(e).length;
110
110
  }
111
- function g(e) {
112
- if (!T(e))
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 !(!T(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
118
+ return !(!P(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
119
119
  }
120
- function T(e) {
120
+ function P(e) {
121
121
  return Object.prototype.toString.call(e) === "[object Object]";
122
122
  }
123
- function z(e) {
123
+ function I(e) {
124
124
  return new Promise((t) => {
125
125
  setTimeout(t, e);
126
126
  });
127
127
  }
128
- function te(e, t, n) {
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 E(e, t);
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 E(e, t);
140
+ return g(e, t);
141
141
  }
142
142
  return t;
143
143
  }
144
- function ne(e, t, n = 0) {
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 re(e, t, n = 0) {
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 P = Symbol();
153
- function se(e, t) {
154
- return process.env.NODE_ENV !== "production" && e.queryFn === P && console.error(
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 === P ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : 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 D = class extends L {
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 (!y && window.addEventListener) {
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
- }, I = new D(), A = class extends L {
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 (!y && window.addEventListener) {
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
- }, k = new A();
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" ? k.isOnline() : !0;
256
+ return (e ?? "online") === "online" ? C.isOnline() : !0;
254
257
  }
255
- var C = class extends Error {
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 ie(e) {
261
- return e instanceof C;
263
+ function ue(e) {
264
+ return e instanceof q;
262
265
  }
263
- function oe(e) {
266
+ function ce(e) {
264
267
  let t = !1, n = 0, r = !1, s;
265
- const o = U(), l = (a) => {
266
- r || (b(new C(a)), e.abort?.());
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
- }, f = () => I.isFocused() && (e.networkMode === "always" || k.isOnline()) && e.canRun(), c = () => H(e.networkMode) && e.canRun(), M = (a) => {
272
- r || (r = !0, e.onSuccess?.(a), s?.(), o.resolve(a));
273
- }, b = (a) => {
274
- r || (r = !0, e.onError?.(a), s?.(), o.reject(a));
275
- }, O = () => new Promise((a) => {
276
- s = (p) => {
277
- (r || f()) && a(p);
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
- }), m = () => {
284
+ }), p = () => {
282
285
  if (r)
283
286
  return;
284
- let a;
285
- const p = n === 0 ? e.initialPromise : void 0;
287
+ let c;
288
+ const v = n === 0 ? e.initialPromise : void 0;
286
289
  try {
287
- a = p ?? e.fn();
290
+ c = v ?? e.fn();
288
291
  } catch (h) {
289
- a = Promise.reject(h);
292
+ c = Promise.reject(h);
290
293
  }
291
- Promise.resolve(a).then(M).catch((h) => {
294
+ Promise.resolve(c).then(a).catch((h) => {
292
295
  if (r)
293
296
  return;
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);
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
- b(h);
299
+ m(h);
297
300
  return;
298
301
  }
299
- n++, e.onFail?.(n, h), z(x).then(() => f() ? void 0 : O()).then(() => {
300
- t ? b(h) : m();
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: l,
309
+ cancel: f,
307
310
  continue: () => (s?.(), o),
308
311
  cancelRetry: i,
309
312
  continueRetry: u,
310
- canStart: c,
311
- start: () => (c() ? m() : O().then(m), o)
313
+ canStart: l,
314
+ start: () => (l() ? p() : O().then(p), o)
312
315
  };
313
316
  }
314
- function V() {
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 = (i) => setTimeout(i, 0);
323
+ }, s = V;
320
324
  const o = (i) => {
321
325
  t ? e.push(i) : s(() => {
322
326
  n(i);
323
327
  });
324
- }, l = () => {
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 || l();
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 ue = V(), ce = class {
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 ?? (y ? 1 / 0 : 5 * 60 * 1e3)
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
- }, q = F.createContext(
396
+ }, M = F.createContext(
393
397
  void 0
394
- ), ae = (e) => {
395
- const t = F.useContext(q);
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
- }, le = ({
405
+ }, he = ({
402
406
  client: e,
403
407
  children: t
404
408
  }) => (F.useEffect(() => (e.mount(), () => {
405
409
  e.unmount();
406
- }), [e]), /* @__PURE__ */ R(q.Provider, { value: e, children: t }));
410
+ }), [e]), /* @__PURE__ */ R(M.Provider, { value: e, children: t }));
407
411
  export {
408
- le as Q,
409
- ce as R,
410
- L as S,
411
- J as a,
412
- X as b,
413
- oe as c,
414
- P as d,
415
- se as e,
416
- H as f,
417
- W as g,
418
- w as h,
419
- ie as i,
420
- y as j,
421
- Q as k,
422
- I as l,
423
- K as m,
424
- ue as n,
425
- Y as o,
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
- te as r,
429
- ee as s,
430
- B as t,
431
- ae as u,
432
- re as v,
433
- ne as w,
434
- k as x,
435
- _ as y,
436
- S as z
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
  };