@choksheak/react-utils 0.4.1 → 0.4.2

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 (95) hide show
  1. package/NoSSR.cjs +1 -1
  2. package/NoSSR.d.ts +7 -3
  3. package/NoSSR.min.cjs +1 -1
  4. package/NoSSR.min.mjs +1 -1
  5. package/NoSSR.mjs +1 -1
  6. package/{chunk-33UMQLKY.mjs → chunk-4235I4VO.mjs} +1 -10
  7. package/{chunk-GPV6JIQK.mjs → chunk-4J7TN5JN.mjs} +1 -1
  8. package/chunk-BBCGQMWI.min.cjs +2 -0
  9. package/chunk-BBCGQMWI.min.cjs.map +1 -0
  10. package/{chunk-5DO7KC3L.cjs → chunk-CYTO5EZE.cjs} +2 -11
  11. package/chunk-GKNOICX3.cjs +561 -0
  12. package/chunk-HRE7YPUJ.min.mjs +2 -0
  13. package/chunk-IS3BZTWE.cjs +35 -0
  14. package/chunk-JOHZV3FD.min.cjs +2 -0
  15. package/{chunk-F5L32IUC.min.cjs.map → chunk-JOHZV3FD.min.cjs.map} +1 -1
  16. package/chunk-KGN4HQPP.min.cjs +2 -0
  17. package/chunk-KGN4HQPP.min.cjs.map +1 -0
  18. package/chunk-NL4FU2MJ.min.mjs +2 -0
  19. package/chunk-NL4FU2MJ.min.mjs.map +1 -0
  20. package/chunk-R7POPVJR.mjs +35 -0
  21. package/chunk-TI3FMEYP.min.mjs +2 -0
  22. package/{chunk-RM4ZGGZ2.min.mjs.map → chunk-TI3FMEYP.min.mjs.map} +1 -1
  23. package/chunk-U7RD7B3N.min.mjs +2 -0
  24. package/chunk-U7RD7B3N.min.mjs.map +1 -0
  25. package/{chunk-WVLPJPWG.cjs → chunk-WXLUEDBO.cjs} +3 -3
  26. package/chunk-X6EKF4N7.mjs +561 -0
  27. package/chunk-ZCDXPV3A.min.cjs +2 -0
  28. package/chunk-ZCDXPV3A.min.cjs.map +1 -0
  29. package/dist-O6NNX4Y3.min.mjs +2 -0
  30. package/dist-O6NNX4Y3.min.mjs.map +1 -0
  31. package/dist-SEGTJ72R.min.cjs +2 -0
  32. package/dist-SEGTJ72R.min.cjs.map +1 -0
  33. package/dist-UKP7SPWZ.cjs +545 -0
  34. package/dist-YXYQDOH5.mjs +545 -0
  35. package/index.cjs +43 -0
  36. package/index.d.cts +8 -0
  37. package/index.d.ts +8 -0
  38. package/index.min.cjs +2 -0
  39. package/index.min.cjs.map +1 -0
  40. package/index.min.mjs +2 -0
  41. package/index.min.mjs.map +1 -0
  42. package/index.mjs +43 -0
  43. package/magic-string.es-5QZEPJXJ.min.mjs +14 -0
  44. package/magic-string.es-5QZEPJXJ.min.mjs.map +1 -0
  45. package/magic-string.es-EREYSDLL.mjs +1308 -0
  46. package/magic-string.es-FXUUD55Y.min.cjs +14 -0
  47. package/magic-string.es-FXUUD55Y.min.cjs.map +1 -0
  48. package/magic-string.es-HC5PDAU3.cjs +1308 -0
  49. package/package.json +71 -168
  50. package/sharedQuery.cjs +8 -555
  51. package/{sharedQuery.d.mts → sharedQuery.d.cts} +2 -2
  52. package/sharedQuery.d.ts +23 -17
  53. package/sharedQuery.min.cjs +1 -1
  54. package/sharedQuery.min.cjs.map +1 -1
  55. package/sharedQuery.min.mjs +1 -1
  56. package/sharedQuery.min.mjs.map +1 -1
  57. package/sharedQuery.mjs +9 -556
  58. package/sharedState.cjs +1 -1
  59. package/{sharedState.d.mts → sharedState.d.cts} +1 -1
  60. package/sharedState.d.ts +17 -11
  61. package/sharedState.min.cjs +1 -1
  62. package/sharedState.min.mjs +1 -1
  63. package/sharedState.mjs +1 -1
  64. package/storage.cjs +1 -1
  65. package/storage.d.ts +13 -9
  66. package/storage.min.cjs +1 -1
  67. package/storage.min.mjs +1 -1
  68. package/storage.mjs +1 -1
  69. package/stringify.cjs +3 -5
  70. package/stringify.d.ts +3 -1
  71. package/stringify.min.cjs +1 -1
  72. package/stringify.min.cjs.map +1 -1
  73. package/stringify.min.mjs +1 -1
  74. package/stringify.mjs +2 -4
  75. package/useDeepMemo.cjs +3 -3
  76. package/useDeepMemo.d.ts +3 -1
  77. package/useDeepMemo.min.cjs +1 -1
  78. package/useDeepMemo.min.mjs +1 -1
  79. package/useDeepMemo.mjs +2 -2
  80. package/chunk-74BS2FAO.cjs +0 -12
  81. package/chunk-F5L32IUC.min.cjs +0 -2
  82. package/chunk-KE3RXVMS.min.cjs +0 -2
  83. package/chunk-KE3RXVMS.min.cjs.map +0 -1
  84. package/chunk-MWDH7YON.min.mjs +0 -2
  85. package/chunk-RM4ZGGZ2.min.mjs +0 -2
  86. package/chunk-TEZPF6BG.min.cjs +0 -2
  87. package/chunk-TEZPF6BG.min.cjs.map +0 -1
  88. package/chunk-V7L3UICC.min.mjs +0 -2
  89. package/chunk-V7L3UICC.min.mjs.map +0 -1
  90. package/chunk-X6BYQHVC.mjs +0 -12
  91. /package/{NoSSR.d.mts → NoSSR.d.cts} +0 -0
  92. /package/{chunk-MWDH7YON.min.mjs.map → chunk-HRE7YPUJ.min.mjs.map} +0 -0
  93. /package/{storage.d.mts → storage.d.cts} +0 -0
  94. /package/{stringify.d.mts → stringify.d.cts} +0 -0
  95. /package/{useDeepMemo.d.mts → useDeepMemo.d.cts} +0 -0
@@ -0,0 +1,545 @@
1
+ import "./chunk-R7POPVJR.mjs";
2
+
3
+ // node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js
4
+ var $ = Object.defineProperty;
5
+ var C = (s) => {
6
+ throw TypeError(s);
7
+ };
8
+ var D = (s, n, t) => n in s ? $(s, n, { enumerable: true, configurable: true, writable: true, value: t }) : s[n] = t;
9
+ var O = (s, n, t) => D(s, typeof n != "symbol" ? n + "" : n, t);
10
+ var q = (s, n, t) => n.has(s) || C("Cannot " + t);
11
+ var d = (s, n, t) => (q(s, n, "read from private field"), t ? t.call(s) : n.get(s));
12
+ var k = (s, n, t) => n.has(s) ? C("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(s) : n.set(s, t);
13
+ var f = (s, n, t, e) => (q(s, n, "write to private field"), e ? e.call(s, t) : n.set(s, t), t);
14
+ var F = (s, n, t, e) => ({
15
+ set _(r) {
16
+ f(s, n, r, t);
17
+ },
18
+ get _() {
19
+ return d(s, n, e);
20
+ }
21
+ });
22
+ var M = class {
23
+ constructor(n) {
24
+ O(this, "value");
25
+ O(this, "next");
26
+ this.value = n;
27
+ }
28
+ };
29
+ var m;
30
+ var w;
31
+ var E;
32
+ var g = class {
33
+ constructor() {
34
+ k(this, m);
35
+ k(this, w);
36
+ k(this, E);
37
+ this.clear();
38
+ }
39
+ enqueue(n) {
40
+ let t = new M(n);
41
+ d(this, m) ? (d(this, w).next = t, f(this, w, t)) : (f(this, m, t), f(this, w, t)), F(this, E)._++;
42
+ }
43
+ dequeue() {
44
+ let n = d(this, m);
45
+ if (n)
46
+ return f(this, m, d(this, m).next), F(this, E)._--, n.value;
47
+ }
48
+ clear() {
49
+ f(this, m, void 0), f(this, w, void 0), f(this, E, 0);
50
+ }
51
+ get size() {
52
+ return d(this, E);
53
+ }
54
+ *[Symbol.iterator]() {
55
+ let n = d(this, m);
56
+ for (; n; )
57
+ yield n.value, n = n.next;
58
+ }
59
+ };
60
+ m = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap();
61
+ function y(s) {
62
+ if (!((Number.isInteger(s) || s === Number.POSITIVE_INFINITY) && s > 0))
63
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
64
+ let n = new g(), t = 0, e = () => {
65
+ t--, n.size > 0 && n.dequeue()();
66
+ }, r = async (h, p, a) => {
67
+ t++;
68
+ let l = (async () => h(...a))();
69
+ p(l);
70
+ try {
71
+ await l;
72
+ } catch (T) {
73
+ }
74
+ e();
75
+ }, i = (h, p, a) => {
76
+ n.enqueue(r.bind(void 0, h, p, a)), (async () => (await Promise.resolve(), t < s && n.size > 0 && n.dequeue()()))();
77
+ }, c = (h, ...p) => new Promise((a) => {
78
+ i(h, a, p);
79
+ });
80
+ return Object.defineProperties(c, {
81
+ activeCount: {
82
+ get: () => t
83
+ },
84
+ pendingCount: {
85
+ get: () => n.size
86
+ },
87
+ clearQueue: {
88
+ value: () => {
89
+ n.clear();
90
+ }
91
+ }
92
+ }), c;
93
+ }
94
+ function o(s, n = null) {
95
+ let t = new Event(s);
96
+ return n && Object.defineProperty(t, "task", {
97
+ value: n,
98
+ enumerable: true,
99
+ writable: false,
100
+ configurable: false
101
+ }), t;
102
+ }
103
+ var G = {
104
+ 1: 12.71,
105
+ 2: 4.303,
106
+ 3: 3.182,
107
+ 4: 2.776,
108
+ 5: 2.571,
109
+ 6: 2.447,
110
+ 7: 2.365,
111
+ 8: 2.306,
112
+ 9: 2.262,
113
+ 10: 2.228,
114
+ 11: 2.201,
115
+ 12: 2.179,
116
+ 13: 2.16,
117
+ 14: 2.145,
118
+ 15: 2.131,
119
+ 16: 2.12,
120
+ 17: 2.11,
121
+ 18: 2.101,
122
+ 19: 2.093,
123
+ 20: 2.086,
124
+ 21: 2.08,
125
+ 22: 2.074,
126
+ 23: 2.069,
127
+ 24: 2.064,
128
+ 25: 2.06,
129
+ 26: 2.056,
130
+ 27: 2.052,
131
+ 28: 2.048,
132
+ 29: 2.045,
133
+ 30: 2.042,
134
+ 31: 2.0399,
135
+ 32: 2.0378,
136
+ 33: 2.0357,
137
+ 34: 2.0336,
138
+ 35: 2.0315,
139
+ 36: 2.0294,
140
+ 37: 2.0273,
141
+ 38: 2.0252,
142
+ 39: 2.0231,
143
+ 40: 2.021,
144
+ 41: 2.0198,
145
+ 42: 2.0186,
146
+ 43: 2.0174,
147
+ 44: 2.0162,
148
+ 45: 2.015,
149
+ 46: 2.0138,
150
+ 47: 2.0126,
151
+ 48: 2.0114,
152
+ 49: 2.0102,
153
+ 50: 2.009,
154
+ 51: 2.0081,
155
+ 52: 2.0072,
156
+ 53: 2.0063,
157
+ 54: 2.0054,
158
+ 55: 2.0045,
159
+ 56: 2.0036,
160
+ 57: 2.0027,
161
+ 58: 2.0018,
162
+ 59: 2.0009,
163
+ 60: 2,
164
+ 61: 1.9995,
165
+ 62: 1.999,
166
+ 63: 1.9985,
167
+ 64: 1.998,
168
+ 65: 1.9975,
169
+ 66: 1.997,
170
+ 67: 1.9965,
171
+ 68: 1.996,
172
+ 69: 1.9955,
173
+ 70: 1.995,
174
+ 71: 1.9945,
175
+ 72: 1.994,
176
+ 73: 1.9935,
177
+ 74: 1.993,
178
+ 75: 1.9925,
179
+ 76: 1.992,
180
+ 77: 1.9915,
181
+ 78: 1.991,
182
+ 79: 1.9905,
183
+ 80: 1.99,
184
+ 81: 1.9897,
185
+ 82: 1.9894,
186
+ 83: 1.9891,
187
+ 84: 1.9888,
188
+ 85: 1.9885,
189
+ 86: 1.9882,
190
+ 87: 1.9879,
191
+ 88: 1.9876,
192
+ 89: 1.9873,
193
+ 90: 1.987,
194
+ 91: 1.9867,
195
+ 92: 1.9864,
196
+ 93: 1.9861,
197
+ 94: 1.9858,
198
+ 95: 1.9855,
199
+ 96: 1.9852,
200
+ 97: 1.9849,
201
+ 98: 1.9846,
202
+ 99: 1.9843,
203
+ 100: 1.984,
204
+ 101: 1.9838,
205
+ 102: 1.9836,
206
+ 103: 1.9834,
207
+ 104: 1.9832,
208
+ 105: 1.983,
209
+ 106: 1.9828,
210
+ 107: 1.9826,
211
+ 108: 1.9824,
212
+ 109: 1.9822,
213
+ 110: 1.982,
214
+ 111: 1.9818,
215
+ 112: 1.9816,
216
+ 113: 1.9814,
217
+ 114: 1.9812,
218
+ 115: 1.9819,
219
+ 116: 1.9808,
220
+ 117: 1.9806,
221
+ 118: 1.9804,
222
+ 119: 1.9802,
223
+ 120: 1.98,
224
+ infinity: 1.96
225
+ };
226
+ var N = G;
227
+ var J = (s) => s / 1e6;
228
+ var U = () => J(Number(process.hrtime.bigint()));
229
+ var B = () => performance.now();
230
+ function W(s) {
231
+ return s !== null && typeof s == "object" && typeof s.then == "function";
232
+ }
233
+ var S = (s, n) => s.reduce((e, r) => e + (r - n) ** 2, 0) / (s.length - 1) || 0;
234
+ var X = (async () => {
235
+ }).constructor;
236
+ var Z = (s) => s.constructor === X;
237
+ var z = async (s) => {
238
+ if (Z(s.fn))
239
+ return true;
240
+ try {
241
+ if (s.opts.beforeEach != null)
242
+ try {
243
+ await s.opts.beforeEach.call(s);
244
+ } catch (e) {
245
+ }
246
+ let n = s.fn(), t = W(n);
247
+ if (t)
248
+ try {
249
+ await n;
250
+ } catch (e) {
251
+ }
252
+ if (s.opts.afterEach != null)
253
+ try {
254
+ await s.opts.afterEach.call(s);
255
+ } catch (e) {
256
+ }
257
+ return t;
258
+ } catch (n) {
259
+ return false;
260
+ }
261
+ };
262
+ var b = class extends EventTarget {
263
+ constructor(t, e, r, i = {}) {
264
+ super();
265
+ this.runs = 0;
266
+ this.bench = t, this.name = e, this.fn = r, this.opts = i;
267
+ }
268
+ async loop(t, e) {
269
+ var T;
270
+ let r = this.bench.concurrency === "task", { threshold: i } = this.bench, c = 0, h = [];
271
+ if (this.opts.beforeAll != null)
272
+ try {
273
+ await this.opts.beforeAll.call(this);
274
+ } catch (u) {
275
+ return { error: u };
276
+ }
277
+ let p = await z(this), a = async () => {
278
+ this.opts.beforeEach != null && await this.opts.beforeEach.call(this);
279
+ let u = 0;
280
+ if (p) {
281
+ let v = this.bench.now();
282
+ await this.fn.call(this), u = this.bench.now() - v;
283
+ } else {
284
+ let v = this.bench.now();
285
+ this.fn.call(this), u = this.bench.now() - v;
286
+ }
287
+ h.push(u), c += u, this.opts.afterEach != null && await this.opts.afterEach.call(this);
288
+ }, l = y(i);
289
+ try {
290
+ let u = [];
291
+ for (; (c < t || h.length + l.activeCount + l.pendingCount < e) && !((T = this.bench.signal) != null && T.aborted); )
292
+ r ? u.push(l(a)) : await a();
293
+ u.length && await Promise.all(u);
294
+ } catch (u) {
295
+ return { error: u };
296
+ }
297
+ if (this.opts.afterAll != null)
298
+ try {
299
+ await this.opts.afterAll.call(this);
300
+ } catch (u) {
301
+ return { error: u };
302
+ }
303
+ return { samples: h };
304
+ }
305
+ /**
306
+ * run the current task and write the results in `Task.result` object
307
+ */
308
+ async run() {
309
+ var r, i;
310
+ if ((r = this.result) != null && r.error)
311
+ return this;
312
+ this.dispatchEvent(o("start", this)), await this.bench.setup(this, "run");
313
+ let { samples: t, error: e } = await this.loop(this.bench.time, this.bench.iterations);
314
+ if (this.bench.teardown(this, "run"), t) {
315
+ let c = t.reduce((L, A) => L + A, 0);
316
+ this.runs = t.length, t.sort((L, A) => L - A);
317
+ let h = c / this.runs, p = 1e3 / h, a = t.length, l = a - 1, T = t[0], u = t[l], v = c / t.length || 0, P = S(t, v), R = Math.sqrt(P), I = R / Math.sqrt(a), _ = N[String(Math.round(l) || 1)] || N.infinity, K = I * _, j = K / v * 100, H = t[Math.ceil(a * 0.75) - 1], V = t[Math.ceil(a * 0.99) - 1], Q = t[Math.ceil(a * 0.995) - 1], Y = t[Math.ceil(a * 0.999) - 1];
318
+ if ((i = this.bench.signal) != null && i.aborted)
319
+ return this;
320
+ this.setResult({
321
+ totalTime: c,
322
+ min: T,
323
+ max: u,
324
+ hz: p,
325
+ period: h,
326
+ samples: t,
327
+ mean: v,
328
+ variance: P,
329
+ sd: R,
330
+ sem: I,
331
+ df: l,
332
+ critical: _,
333
+ moe: K,
334
+ rme: j,
335
+ p75: H,
336
+ p99: V,
337
+ p995: Q,
338
+ p999: Y
339
+ });
340
+ }
341
+ if (e) {
342
+ if (this.setResult({ error: e }), this.bench.throws)
343
+ throw e;
344
+ this.dispatchEvent(o("error", this)), this.bench.dispatchEvent(o("error", this));
345
+ }
346
+ return this.dispatchEvent(o("cycle", this)), this.bench.dispatchEvent(o("cycle", this)), this.dispatchEvent(o("complete", this)), this;
347
+ }
348
+ /**
349
+ * warmup the current task
350
+ */
351
+ async warmup() {
352
+ var e;
353
+ if ((e = this.result) != null && e.error)
354
+ return;
355
+ this.dispatchEvent(o("warmup", this)), await this.bench.setup(this, "warmup");
356
+ let { error: t } = await this.loop(this.bench.warmupTime, this.bench.warmupIterations);
357
+ if (this.bench.teardown(this, "warmup"), t && (this.setResult({ error: t }), this.bench.throws))
358
+ throw t;
359
+ }
360
+ addEventListener(t, e, r) {
361
+ super.addEventListener(t, e, r);
362
+ }
363
+ removeEventListener(t, e, r) {
364
+ super.removeEventListener(t, e, r);
365
+ }
366
+ /**
367
+ * change the result object values
368
+ */
369
+ setResult(t) {
370
+ this.result = { ...this.result, ...t }, Object.freeze(this.result);
371
+ }
372
+ /**
373
+ * reset the task to make the `Task.runs` a zero-value and remove the `Task.result`
374
+ * object
375
+ */
376
+ reset() {
377
+ this.dispatchEvent(o("reset", this)), this.runs = 0, this.result = void 0;
378
+ }
379
+ };
380
+ var x = class extends EventTarget {
381
+ constructor(t = {}) {
382
+ var e, r, i, c, h, p, a, l;
383
+ super();
384
+ this._tasks = /* @__PURE__ */ new Map();
385
+ this._todos = /* @__PURE__ */ new Map();
386
+ this.concurrency = null;
387
+ this.threshold = 1 / 0;
388
+ this.warmupTime = 100;
389
+ this.warmupIterations = 5;
390
+ this.time = 500;
391
+ this.iterations = 10;
392
+ this.now = B;
393
+ this.now = (e = t.now) != null ? e : this.now, this.warmupTime = (r = t.warmupTime) != null ? r : this.warmupTime, this.warmupIterations = (i = t.warmupIterations) != null ? i : this.warmupIterations, this.time = (c = t.time) != null ? c : this.time, this.iterations = (h = t.iterations) != null ? h : this.iterations, this.signal = t.signal, this.throws = (p = t.throws) != null ? p : false, this.setup = (a = t.setup) != null ? a : () => {
394
+ }, this.teardown = (l = t.teardown) != null ? l : () => {
395
+ }, this.signal && this.signal.addEventListener(
396
+ "abort",
397
+ () => {
398
+ this.dispatchEvent(o("abort"));
399
+ },
400
+ { once: true }
401
+ );
402
+ }
403
+ runTask(t) {
404
+ var e;
405
+ return (e = this.signal) != null && e.aborted ? t : t.run();
406
+ }
407
+ /**
408
+ * run the added tasks that were registered using the
409
+ * {@link add} method.
410
+ * Note: This method does not do any warmup. Call {@link warmup} for that.
411
+ */
412
+ async run() {
413
+ if (this.concurrency === "bench")
414
+ return this.runConcurrently(this.threshold, this.concurrency);
415
+ this.dispatchEvent(o("start"));
416
+ let t = [];
417
+ for (let e of [...this._tasks.values()])
418
+ t.push(await this.runTask(e));
419
+ return this.dispatchEvent(o("complete")), t;
420
+ }
421
+ /**
422
+ * See Bench.{@link concurrency}
423
+ */
424
+ async runConcurrently(t = 1 / 0, e = "bench") {
425
+ if (this.threshold = t, this.concurrency = e, e === "task")
426
+ return this.run();
427
+ this.dispatchEvent(o("start"));
428
+ let r = y(t), i = [];
429
+ for (let h of [...this._tasks.values()])
430
+ i.push(r(() => this.runTask(h)));
431
+ let c = await Promise.all(i);
432
+ return this.dispatchEvent(o("complete")), c;
433
+ }
434
+ /**
435
+ * warmup the benchmark tasks.
436
+ * This is not run by default by the {@link run} method.
437
+ */
438
+ async warmup() {
439
+ if (this.concurrency === "bench") {
440
+ await this.warmupConcurrently(this.threshold, this.concurrency);
441
+ return;
442
+ }
443
+ this.dispatchEvent(o("warmup"));
444
+ for (let [, t] of this._tasks)
445
+ await t.warmup();
446
+ }
447
+ /**
448
+ * warmup the benchmark tasks concurrently.
449
+ * This is not run by default by the {@link runConcurrently} method.
450
+ */
451
+ async warmupConcurrently(t = 1 / 0, e = "bench") {
452
+ if (this.threshold = t, this.concurrency = e, e === "task") {
453
+ await this.warmup();
454
+ return;
455
+ }
456
+ this.dispatchEvent(o("warmup"));
457
+ let r = y(t), i = [];
458
+ for (let [, c] of this._tasks)
459
+ i.push(r(() => c.warmup()));
460
+ await Promise.all(i);
461
+ }
462
+ /**
463
+ * reset each task and remove its result
464
+ */
465
+ reset() {
466
+ this.dispatchEvent(o("reset")), this._tasks.forEach((t) => {
467
+ t.reset();
468
+ });
469
+ }
470
+ /**
471
+ * add a benchmark task to the task map
472
+ */
473
+ add(t, e, r = {}) {
474
+ let i = new b(this, t, e, r);
475
+ return this._tasks.set(t, i), this.dispatchEvent(o("add", i)), this;
476
+ }
477
+ /**
478
+ * add a benchmark todo to the todo map
479
+ */
480
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
481
+ todo(t, e = () => {
482
+ }, r = {}) {
483
+ let i = new b(this, t, e, r);
484
+ return this._todos.set(t, i), this.dispatchEvent(o("todo", i)), this;
485
+ }
486
+ /**
487
+ * remove a benchmark task from the task map
488
+ */
489
+ remove(t) {
490
+ let e = this.getTask(t);
491
+ return e && (this.dispatchEvent(o("remove", e)), this._tasks.delete(t)), this;
492
+ }
493
+ addEventListener(t, e, r) {
494
+ super.addEventListener(t, e, r);
495
+ }
496
+ removeEventListener(t, e, r) {
497
+ super.removeEventListener(t, e, r);
498
+ }
499
+ /**
500
+ * table of the tasks results
501
+ */
502
+ table(t) {
503
+ return this.tasks.map((e) => {
504
+ if (e.result) {
505
+ if (e.result.error)
506
+ throw e.result.error;
507
+ return (t == null ? void 0 : t(e)) || {
508
+ "Task Name": e.name,
509
+ "ops/sec": e.result.error ? "NaN" : parseInt(e.result.hz.toString(), 10).toLocaleString(),
510
+ "Average Time (ns)": e.result.error ? "NaN" : e.result.mean * 1e3 * 1e3,
511
+ Margin: e.result.error ? "NaN" : `\xB1${e.result.rme.toFixed(2)}%`,
512
+ Samples: e.result.error ? "NaN" : e.result.samples.length
513
+ };
514
+ }
515
+ return null;
516
+ });
517
+ }
518
+ /**
519
+ * (getter) tasks results as an array
520
+ */
521
+ get results() {
522
+ return [...this._tasks.values()].map((t) => t.result);
523
+ }
524
+ /**
525
+ * (getter) tasks as an array
526
+ */
527
+ get tasks() {
528
+ return [...this._tasks.values()];
529
+ }
530
+ get todos() {
531
+ return [...this._todos.values()];
532
+ }
533
+ /**
534
+ * get a task based on the task name
535
+ */
536
+ getTask(t) {
537
+ return this._tasks.get(t);
538
+ }
539
+ };
540
+ export {
541
+ x as Bench,
542
+ b as Task,
543
+ U as hrtimeNow,
544
+ B as now
545
+ };
package/index.cjs ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkGKNOICX3cjs = require('./chunk-GKNOICX3.cjs');
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ var _chunk3X25NN6Xcjs = require('./chunk-3X25NN6X.cjs');
15
+
16
+
17
+
18
+
19
+ var _chunk5PDGU37Ecjs = require('./chunk-5PDGU37E.cjs');
20
+
21
+
22
+ var _chunkCYTO5EZEcjs = require('./chunk-CYTO5EZE.cjs');
23
+
24
+
25
+ var _chunkWXLUEDBOcjs = require('./chunk-WXLUEDBO.cjs');
26
+ require('./chunk-IS3BZTWE.cjs');
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ exports.SharedQueryConfig = _chunkGKNOICX3cjs.SharedQueryConfig; exports.SharedStateConfig = _chunk3X25NN6Xcjs.SharedStateConfig; exports.configureSharedQuery = _chunkGKNOICX3cjs.configureSharedQuery; exports.configureSharedState = _chunk3X25NN6Xcjs.configureSharedState; exports.getStorageAdapter = _chunk5PDGU37Ecjs.getStorageAdapter; exports.kvStoreAdapter = _chunk5PDGU37Ecjs.kvStoreAdapter; exports.localStoreAdapter = _chunk5PDGU37Ecjs.localStoreAdapter; exports.sharedQuery = _chunkGKNOICX3cjs.sharedQuery; exports.sharedState = _chunk3X25NN6Xcjs.sharedState; exports.stringifyDeterministicForKeys = _chunkCYTO5EZEcjs.stringifyDeterministicForKeys; exports.useDeepMemo = _chunkWXLUEDBOcjs.useDeepMemo; exports.useSharedQuery = _chunkGKNOICX3cjs.useSharedQuery; exports.useSharedState = _chunk3X25NN6Xcjs.useSharedState; exports.useSharedStateSetter = _chunk3X25NN6Xcjs.useSharedStateSetter; exports.useSharedStateValue = _chunk3X25NN6Xcjs.useSharedStateValue;
package/index.d.cts ADDED
@@ -0,0 +1,8 @@
1
+ export { QueryFn, QueryStateValue, QueryTarget, QueryTargetWithFn, QueryTargetWithUrl, SharedQuery, SharedQueryConfig, SharedQueryOptions, SharedQueryState, UseQueryResult, configureSharedQuery, sharedQuery, useSharedQuery } from './sharedQuery.cjs';
2
+ export { useDeepMemo } from './useDeepMemo.cjs';
3
+ export { SharedState, SharedStateConfig, SharedStateOptions, configureSharedState, sharedState, useSharedState, useSharedStateSetter, useSharedStateValue } from './sharedState.cjs';
4
+ export { stringifyDeterministicForKeys } from './stringify.cjs';
5
+ export { PersistTo, StorageOptions, StoreConstructorArgs, StoreOptions, getStorageAdapter, kvStoreAdapter, localStoreAdapter } from './storage.cjs';
6
+ import 'react';
7
+ import '@choksheak/ts-utils/duration';
8
+ import '@choksheak/ts-utils/storageAdapter';
package/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export { QueryFn, QueryStateValue, QueryTarget, QueryTargetWithFn, QueryTargetWithUrl, SharedQuery, SharedQueryConfig, SharedQueryOptions, SharedQueryState, UseQueryResult, configureSharedQuery, sharedQuery, useSharedQuery } from './sharedQuery.js';
2
+ export { useDeepMemo } from './useDeepMemo.js';
3
+ export { SharedState, SharedStateConfig, SharedStateOptions, configureSharedState, sharedState, useSharedState, useSharedStateSetter, useSharedStateValue } from './sharedState.js';
4
+ export { stringifyDeterministicForKeys } from './stringify.js';
5
+ export { PersistTo, StorageOptions, StoreConstructorArgs, StoreOptions, getStorageAdapter, kvStoreAdapter, localStoreAdapter } from './storage.js';
6
+ import 'react';
7
+ import '@choksheak/ts-utils/duration';
8
+ import '@choksheak/ts-utils/storageAdapter';
package/index.min.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBBCGQMWImincjs = require('./chunk-BBCGQMWI.min.cjs');var _chunkNTFFK7ZHmincjs = require('./chunk-NTFFK7ZH.min.cjs');var _chunkUFJQLQFImincjs = require('./chunk-UFJQLQFI.min.cjs');var _chunkKGN4HQPPmincjs = require('./chunk-KGN4HQPP.min.cjs');var _chunkJOHZV3FDmincjs = require('./chunk-JOHZV3FD.min.cjs');require('./chunk-ZCDXPV3A.min.cjs');exports.SharedQueryConfig = _chunkBBCGQMWImincjs.a; exports.SharedStateConfig = _chunkNTFFK7ZHmincjs.a; exports.configureSharedQuery = _chunkBBCGQMWImincjs.b; exports.configureSharedState = _chunkNTFFK7ZHmincjs.b; exports.getStorageAdapter = _chunkUFJQLQFImincjs.a; exports.kvStoreAdapter = _chunkUFJQLQFImincjs.c; exports.localStoreAdapter = _chunkUFJQLQFImincjs.b; exports.sharedQuery = _chunkBBCGQMWImincjs.c; exports.sharedState = _chunkNTFFK7ZHmincjs.c; exports.stringifyDeterministicForKeys = _chunkKGN4HQPPmincjs.a; exports.useDeepMemo = _chunkJOHZV3FDmincjs.a; exports.useSharedQuery = _chunkBBCGQMWImincjs.d; exports.useSharedState = _chunkNTFFK7ZHmincjs.d; exports.useSharedStateSetter = _chunkNTFFK7ZHmincjs.f; exports.useSharedStateValue = _chunkNTFFK7ZHmincjs.e;
2
+ //# sourceMappingURL=index.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/choksheaklau/src/react-utils/dist/index.min.cjs"],"names":[],"mappings":"AAAA,wIAAiE,+DAAgF,+DAA2D,+DAA6C,+DAA6C,oCAAiC,uwBAA6V","file":"/Users/choksheaklau/src/react-utils/dist/index.min.cjs"}
package/index.min.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{a as d,b as g,c as h,d as i}from"./chunk-U7RD7B3N.min.mjs";import{a as f,b as m,c as p,d as t,e as x,f as a}from"./chunk-KILGR7YA.min.mjs";import{a as o,b as r,c as e}from"./chunk-VHMO75EY.min.mjs";import{a as b}from"./chunk-TI3FMEYP.min.mjs";import{a as c}from"./chunk-NL4FU2MJ.min.mjs";import"./chunk-HRE7YPUJ.min.mjs";export{d as SharedQueryConfig,f as SharedStateConfig,g as configureSharedQuery,m as configureSharedState,o as getStorageAdapter,e as kvStoreAdapter,r as localStoreAdapter,h as sharedQuery,p as sharedState,b as stringifyDeterministicForKeys,c as useDeepMemo,i as useSharedQuery,t as useSharedState,a as useSharedStateSetter,x as useSharedStateValue};
2
+ //# sourceMappingURL=index.min.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/index.mjs ADDED
@@ -0,0 +1,43 @@
1
+ import {
2
+ SharedQueryConfig,
3
+ configureSharedQuery,
4
+ sharedQuery,
5
+ useSharedQuery
6
+ } from "./chunk-X6EKF4N7.mjs";
7
+ import {
8
+ SharedStateConfig,
9
+ configureSharedState,
10
+ sharedState,
11
+ useSharedState,
12
+ useSharedStateSetter,
13
+ useSharedStateValue
14
+ } from "./chunk-KRXENFK3.mjs";
15
+ import {
16
+ getStorageAdapter,
17
+ kvStoreAdapter,
18
+ localStoreAdapter
19
+ } from "./chunk-PHLY3LR4.mjs";
20
+ import {
21
+ stringifyDeterministicForKeys
22
+ } from "./chunk-4235I4VO.mjs";
23
+ import {
24
+ useDeepMemo
25
+ } from "./chunk-4J7TN5JN.mjs";
26
+ import "./chunk-R7POPVJR.mjs";
27
+ export {
28
+ SharedQueryConfig,
29
+ SharedStateConfig,
30
+ configureSharedQuery,
31
+ configureSharedState,
32
+ getStorageAdapter,
33
+ kvStoreAdapter,
34
+ localStoreAdapter,
35
+ sharedQuery,
36
+ sharedState,
37
+ stringifyDeterministicForKeys,
38
+ useDeepMemo,
39
+ useSharedQuery,
40
+ useSharedState,
41
+ useSharedStateSetter,
42
+ useSharedStateValue
43
+ };