@tachui/core 0.8.23 → 0.8.25

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 (56) hide show
  1. package/dist/assets/index.js +41 -40
  2. package/dist/{binding-DCV5PKkK.js → binding-DCr-JHsC.js} +9 -9
  3. package/dist/build-tools/typegen-runner.d.ts +4 -0
  4. package/dist/build-tools/typegen-runner.d.ts.map +1 -1
  5. package/dist/cleanup-BR8UpYPX.js +61 -0
  6. package/dist/common.js +272 -277
  7. package/dist/{component-D-O9yq0P.js → component-BzvSm8rM.js} +19 -19
  8. package/dist/{component-base-C41K3NTe.js → component-base-Do2EdQkr.js} +32 -33
  9. package/dist/{component-context-B9HI2nZH.js → component-context-C7Y6Xu6h.js} +1 -1
  10. package/dist/components/index.js +1 -1
  11. package/dist/computed-CA4Cgtoe.js +407 -0
  12. package/dist/{concatenated-component-2Gzy5e2c.js → concatenated-component-CA54ng_j.js} +43 -44
  13. package/dist/css-classes/index.js +2 -2
  14. package/dist/{effect-BsW3fy1q.js → effect-DgNm6jk9.js} +3 -3
  15. package/dist/{enhanced-renderer-t9Ni2EEG.js → enhanced-renderer-D05CCloF.js} +26 -28
  16. package/dist/essential.js +276 -281
  17. package/dist/factories-Bz6LZlk6.js +653 -0
  18. package/dist/{factory-gqfMcmOy.js → factory-B1YXfgU1.js} +23 -29
  19. package/dist/full.d.ts +12 -0
  20. package/dist/full.d.ts.map +1 -0
  21. package/dist/full.js +436 -0
  22. package/dist/gradients/index.js +53 -53
  23. package/dist/hooks-w_FYPLjI.js +158 -0
  24. package/dist/{index-DL9Cys3t.js → index-CmQmIgPK.js} +220 -233
  25. package/dist/index.d.ts +0 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +295 -300
  28. package/dist/minimal-prod.js +106 -108
  29. package/dist/minimal.js +97 -98
  30. package/dist/modifiers/base.d.ts.map +1 -1
  31. package/dist/modifiers/base.js +188 -181
  32. package/dist/modifiers/builder.js +1 -1
  33. package/dist/modifiers/factories.d.ts.map +1 -1
  34. package/dist/modifiers/index.js +22 -23
  35. package/dist/modifiers/registry.js +1 -1
  36. package/dist/{observed-object-p1CLdrFm.js → observed-object-DCoyucmV.js} +3 -3
  37. package/dist/optimization-D9t53vNJ.js +308 -0
  38. package/dist/{proxy-Cp0QUXME.js → proxy-B7ZIqGd0.js} +3 -3
  39. package/dist/reactive/index.js +87 -85
  40. package/dist/runtime/dom-bridge.js +15 -17
  41. package/dist/runtime/index.js +71 -71
  42. package/dist/runtime/renderer.js +10 -11
  43. package/dist/signal-BRoiFOO7.js +262 -0
  44. package/dist/{signal-list-07gNXGiW.js → signal-list-_Eid-N7_.js} +285 -176
  45. package/dist/state/index.js +43 -44
  46. package/dist/theme-D5-09a8N.js +26 -0
  47. package/dist/validation/index.js +24 -26
  48. package/dist/version.js +1 -1
  49. package/package.json +16 -3
  50. package/dist/factories-B3-rmvkB.js +0 -268
  51. package/dist/hooks-WGmpzYgD.js +0 -446
  52. package/dist/optimization-CbKNA9w4.js +0 -21
  53. package/dist/presets-B9x94uRn.js +0 -381
  54. package/dist/scheduler-DppMK9mR.js +0 -169
  55. package/dist/theme-CRLPHryV.js +0 -687
  56. package/dist/{index-JQ1sW1SK.js → index-7vhCZc7g.js} +1 -1
@@ -1,687 +0,0 @@
1
- import { ComputationState as i } from "@tachui/types/reactive";
2
- var A = Object.defineProperty, M = (t, e, r) => e in t ? A(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, u = (t, e, r) => M(t, typeof e != "symbol" ? e + "" : e, r);
3
- let q = 0, D = 0;
4
- const E = Math.random().toString(36).substr(2, 6);
5
- let O = null, _ = null, S = !1;
6
- const F = /* @__PURE__ */ new Set();
7
- F.add(E);
8
- const n = {
9
- get currentComputation() {
10
- return O;
11
- },
12
- set currentComputation(t) {
13
- O = t;
14
- },
15
- get currentOwner() {
16
- return _;
17
- },
18
- set currentOwner(t) {
19
- _ = t;
20
- },
21
- get isBatching() {
22
- return S;
23
- },
24
- set isBatching(t) {
25
- S = t;
26
- }
27
- };
28
- function I() {
29
- return n.currentComputation;
30
- }
31
- function j() {
32
- return n.currentOwner;
33
- }
34
- function k() {
35
- return n.isBatching;
36
- }
37
- class T {
38
- constructor(e = null) {
39
- u(this, "id"), u(this, "parent"), u(this, "context", /* @__PURE__ */ new Map()), u(this, "cleanups", []), u(this, "sources", /* @__PURE__ */ new Set()), u(this, "disposed", !1), this.id = ++D, this.parent = e;
40
- }
41
- dispose() {
42
- if (!this.disposed) {
43
- this.disposed = !0;
44
- for (const e of this.sources)
45
- e.dispose();
46
- this.sources.clear();
47
- for (const e of this.cleanups)
48
- try {
49
- e();
50
- } catch (r) {
51
- console.error("Error in cleanup function:", r);
52
- }
53
- this.cleanups.length = 0, this.parent && !this.parent.disposed && this.parent.sources.delete(this);
54
- }
55
- }
56
- }
57
- class N {
58
- constructor(e, r = null) {
59
- u(this, "id"), u(this, "owner"), u(this, "fn"), u(this, "sources", /* @__PURE__ */ new Set()), u(this, "observers", /* @__PURE__ */ new Set()), u(this, "state", i.Dirty), u(this, "value"), this.id = ++q, this.fn = e, this.owner = r, r && !r.disposed && r.sources.add(this);
60
- }
61
- execute() {
62
- if (this.state === i.Disposed)
63
- return this.value;
64
- for (const r of this.sources)
65
- r && typeof r == "object" && "removeObserver" in r && r.removeObserver(this);
66
- this.sources.clear();
67
- const e = n.currentComputation;
68
- n.currentComputation = this;
69
- try {
70
- return this.state = i.Clean, this.value = this.fn(), this.value;
71
- } catch (r) {
72
- throw this.state = i.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", r), r;
73
- } finally {
74
- n.currentComputation = e;
75
- }
76
- }
77
- dispose() {
78
- if (this.state !== i.Disposed) {
79
- this.state = i.Disposed;
80
- for (const e of this.sources)
81
- e && typeof e == "object" && "removeObserver" in e && e.removeObserver(this);
82
- this.sources.clear();
83
- for (const e of this.observers)
84
- e.sources.delete(this);
85
- this.observers.clear(), this.owner && !this.owner.disposed && this.owner.sources.delete(this);
86
- }
87
- }
88
- }
89
- function ie(t) {
90
- const e = new T(n.currentOwner), r = n.currentOwner;
91
- n.currentOwner = e;
92
- try {
93
- return t(() => e.dispose());
94
- } finally {
95
- n.currentOwner = r;
96
- }
97
- }
98
- function oe(t, e) {
99
- const r = n.currentOwner;
100
- n.currentOwner = t;
101
- try {
102
- return e();
103
- } finally {
104
- n.currentOwner = r;
105
- }
106
- }
107
- function ue() {
108
- return n.currentOwner;
109
- }
110
- let b = null;
111
- function $(t) {
112
- b = t;
113
- }
114
- function ae(t) {
115
- if (n.isBatching)
116
- return t();
117
- const e = n.isBatching;
118
- n.isBatching = !0;
119
- try {
120
- const r = t();
121
- return !e && b && b(), r;
122
- } finally {
123
- n.isBatching = e;
124
- }
125
- }
126
- function ce(t) {
127
- const e = n.currentComputation;
128
- n.currentComputation = null;
129
- try {
130
- return t();
131
- } finally {
132
- n.currentComputation = e;
133
- }
134
- }
135
- function le(t, e) {
136
- const r = new N(
137
- t,
138
- e || n.currentOwner
139
- );
140
- return r.execute(), r;
141
- }
142
- function he() {
143
- return {
144
- computation: n.currentComputation,
145
- batch: n.isBatching
146
- };
147
- }
148
- const fe = {
149
- getCurrentComputation: () => n.currentComputation,
150
- getCurrentOwner: () => n.currentOwner,
151
- getComputationCount: () => q,
152
- getOwnerCount: () => D,
153
- isBatching: () => n.isBatching,
154
- getModuleInstances: () => Array.from(F),
155
- getModuleId: () => E
156
- };
157
- var Q = Object.defineProperty, H = (t, e, r) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, g = (t, e, r) => H(t, typeof e != "symbol" ? e + "" : e, r);
158
- let U = 0;
159
- class W {
160
- constructor(e) {
161
- g(this, "id"), g(this, "observers", /* @__PURE__ */ new Set()), g(this, "_value"), this.id = ++U, this._value = e;
162
- }
163
- /**
164
- * Get the current value and track dependency
165
- */
166
- getValue() {
167
- const e = I();
168
- return e && e.state !== i.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
169
- }
170
- /**
171
- * Get the current value without tracking dependency
172
- */
173
- peek() {
174
- return this._value;
175
- }
176
- /**
177
- * Set a new value and notify observers
178
- */
179
- set(e) {
180
- const r = typeof e == "function" ? e(this._value) : e;
181
- return r !== this._value && (this._value = r, this.notify()), r;
182
- }
183
- /**
184
- * Notify all observers that this signal has changed
185
- */
186
- notify() {
187
- for (const e of this.observers)
188
- e.state !== i.Disposed && (e.state = i.Dirty, J(e));
189
- }
190
- /**
191
- * Remove an observer (cleanup)
192
- */
193
- removeObserver(e) {
194
- this.observers.delete(e);
195
- }
196
- /**
197
- * Get debug information about this signal
198
- */
199
- [Symbol.for("tachui.debug")]() {
200
- return {
201
- id: this.id,
202
- value: this._value,
203
- observerCount: this.observers.size,
204
- type: "Signal"
205
- };
206
- }
207
- }
208
- const m = /* @__PURE__ */ new Set();
209
- let y = !1;
210
- function J(t) {
211
- m.add(t), !y && !k() && queueMicrotask(x);
212
- }
213
- function x() {
214
- if (!y) {
215
- y = !0;
216
- try {
217
- for (; m.size > 0; ) {
218
- const t = Array.from(m).sort((e, r) => e.id - r.id);
219
- m.clear();
220
- for (const e of t)
221
- e.state === i.Dirty && e.execute();
222
- }
223
- } finally {
224
- y = !1;
225
- }
226
- }
227
- }
228
- function L(t) {
229
- const e = new W(t), r = e.getValue.bind(e);
230
- r.peek = e.peek.bind(e);
231
- const s = e.set.bind(e);
232
- return Object.defineProperty(r, Symbol.for("tachui.signal"), {
233
- value: e,
234
- enumerable: !1
235
- }), [r, s];
236
- }
237
- function de(t) {
238
- return typeof t == "function" && Symbol.for("tachui.signal") in t;
239
- }
240
- function pe(t) {
241
- return t[Symbol.for("tachui.signal")] || null;
242
- }
243
- $(x);
244
- const v = (t, e) => t === e, w = (t, e) => {
245
- if (t === e) return !0;
246
- if (t == null || e == null || typeof t != typeof e) return !1;
247
- if (typeof t == "object") {
248
- if (Array.isArray(t) !== Array.isArray(e)) return !1;
249
- if (Array.isArray(t)) {
250
- const c = t, C = e;
251
- return c.length !== C.length ? !1 : c.every((P, z) => w(P, C[z]));
252
- }
253
- const r = t, s = e, o = Object.keys(r), a = Object.keys(s);
254
- return o.length !== a.length ? !1 : o.every((c) => w(r[c], s[c]));
255
- }
256
- return !1;
257
- }, me = (t, e) => {
258
- if (t === e) return !0;
259
- if (typeof t != "object" || typeof e != "object" || t == null || e == null) return !1;
260
- const r = t, s = e, o = Object.keys(r), a = Object.keys(s);
261
- return o.length !== a.length ? !1 : o.every((c) => r[c] === s[c]);
262
- }, ye = (t, e) => {
263
- if (t === e) return !0;
264
- if (t instanceof Date && e instanceof Date)
265
- return t.getTime() === e.getTime();
266
- if (t instanceof RegExp && e instanceof RegExp)
267
- return t.toString() === e.toString();
268
- if (t instanceof Set && e instanceof Set) {
269
- if (t.size !== e.size) return !1;
270
- for (const r of t)
271
- if (!e.has(r)) return !1;
272
- return !0;
273
- }
274
- if (t instanceof Map && e instanceof Map) {
275
- if (t.size !== e.size) return !1;
276
- for (const [r, s] of t)
277
- if (!e.has(r) || e.get(r) !== s) return !1;
278
- return !0;
279
- }
280
- return w(t, e);
281
- }, ve = (t, e) => {
282
- if (t === e) return !0;
283
- try {
284
- return JSON.stringify(t) === JSON.stringify(e);
285
- } catch {
286
- return t === e;
287
- }
288
- }, ge = (t, e = v) => (r, s) => e(t(r), t(s)), be = (t = v) => (e, r) => e === r ? !0 : e.length !== r.length ? !1 : e.every((s, o) => t(s, r[o])), we = (t = v) => (e, r) => {
289
- if (e === r) return !0;
290
- if (e == null || r == null) return !1;
291
- const s = Object.keys(e), o = Object.keys(r);
292
- return s.length !== o.length ? !1 : s.every((a) => t(e[a], r[a]));
293
- }, Ce = (...t) => (e, r) => t.every((s) => s(e, r)), Oe = (t, e) => (r, s) => {
294
- const o = t(r, s);
295
- return process.env.NODE_ENV === "development" && console.log(`[${e || "equals"}]`, { a: r, b: s, equal: o }), o;
296
- };
297
- var G = Object.defineProperty, K = (t, e, r) => e in t ? G(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, l = (t, e, r) => K(t, typeof e != "symbol" ? e + "" : e, r), d = /* @__PURE__ */ ((t) => (t[t.Immediate = 0] = "Immediate", t[t.High = 1] = "High", t[t.Normal = 2] = "Normal", t[t.Low = 3] = "Low", t[t.Idle = 4] = "Idle", t))(d || {});
298
- class X extends Error {
299
- constructor(e, r, s) {
300
- super(e), this.cause = r, this.node = s, this.name = "ReactiveError";
301
- }
302
- }
303
- const R = class f {
304
- constructor() {
305
- l(this, "updateQueues", /* @__PURE__ */ new Map()), l(this, "isFlushPending", !1), l(this, "isDestroyed", !1), l(this, "errorHandlers", /* @__PURE__ */ new Set()), l(this, "maxRetries", 3), l(this, "totalUpdateCycles", 0), l(this, "totalUpdateTime", 0), l(this, "errorCount", 0), l(this, "nodeRegistry", /* @__PURE__ */ new WeakSet());
306
- for (const e of Object.values(d))
307
- typeof e == "number" && this.updateQueues.set(e, /* @__PURE__ */ new Set());
308
- }
309
- static getInstance() {
310
- return f.instance || (f.instance = new f()), f.instance;
311
- }
312
- /**
313
- * Schedule reactive node for update
314
- */
315
- schedule(e) {
316
- if (this.isDestroyed) return;
317
- this.nodeRegistry.add(e), this.getQueue(e.priority).add(e), this.isFlushPending || (this.isFlushPending = !0, this.scheduleFlush(e.priority));
318
- }
319
- /**
320
- * Process all queued updates by priority
321
- */
322
- async flush() {
323
- if (this.isDestroyed) return;
324
- this.isFlushPending = !1;
325
- const e = performance.now();
326
- try {
327
- for (const r of [
328
- 0,
329
- 1,
330
- 2,
331
- 3,
332
- 4
333
- /* Idle */
334
- ]) {
335
- const s = this.updateQueues.get(r);
336
- if (!s || s.size === 0) continue;
337
- const o = Array.from(s);
338
- s.clear();
339
- for (const a of o)
340
- try {
341
- await this.updateNodeWithRetry(a);
342
- } catch (c) {
343
- this.handleReactiveError(
344
- new X(`Failed to update ${a.type} node ${a.id}`, c, a)
345
- );
346
- }
347
- if (this.hasHigherPriorityWork(r))
348
- return this.flush();
349
- }
350
- this.totalUpdateCycles++;
351
- } finally {
352
- const r = performance.now();
353
- this.totalUpdateTime += r - e;
354
- }
355
- }
356
- /**
357
- * Update node with retry logic
358
- */
359
- async updateNodeWithRetry(e, r = 1) {
360
- try {
361
- e.notify();
362
- } catch (s) {
363
- if (r < this.maxRetries)
364
- return console.warn(`Reactive update failed, retrying (${r}/${this.maxRetries})`), await new Promise((o) => setTimeout(o, r * 10)), this.updateNodeWithRetry(e, r + 1);
365
- throw s;
366
- }
367
- }
368
- /**
369
- * Schedule flush based on priority
370
- */
371
- scheduleFlush(e) {
372
- switch (e) {
373
- case 0:
374
- this.flush();
375
- break;
376
- case 1:
377
- queueMicrotask(() => this.flush());
378
- break;
379
- case 2:
380
- typeof requestAnimationFrame < "u" ? requestAnimationFrame(() => this.flush()) : queueMicrotask(() => this.flush());
381
- break;
382
- case 3:
383
- case 4:
384
- typeof requestIdleCallback < "u" ? requestIdleCallback(() => this.flush(), { timeout: 1e3 }) : setTimeout(() => this.flush(), 50);
385
- break;
386
- }
387
- }
388
- /**
389
- * Check if there's higher priority work waiting
390
- */
391
- hasHigherPriorityWork(e) {
392
- for (let r = 0; r < e; r++) {
393
- const s = this.updateQueues.get(r);
394
- if (s && s.size > 0)
395
- return !0;
396
- }
397
- return !1;
398
- }
399
- /**
400
- * Get queue for priority level
401
- */
402
- getQueue(e) {
403
- const r = this.updateQueues.get(e);
404
- if (!r)
405
- throw new Error(`Invalid priority level: ${e}`);
406
- return r;
407
- }
408
- /**
409
- * Register error handler
410
- */
411
- onError(e) {
412
- return this.errorHandlers.add(e), () => this.errorHandlers.delete(e);
413
- }
414
- /**
415
- * Handle reactive errors with recovery
416
- */
417
- handleReactiveError(e) {
418
- this.errorCount++;
419
- let r = !1;
420
- for (const s of this.errorHandlers)
421
- try {
422
- s(e), r = !0;
423
- } catch (o) {
424
- console.error("Error handler threw error:", o);
425
- }
426
- if (!r && (console.error("Unhandled reactive error:", e), process.env.NODE_ENV === "development"))
427
- throw e;
428
- }
429
- /**
430
- * Get performance metrics
431
- */
432
- getPerformanceMetrics() {
433
- let e = 0;
434
- for (const r of this.updateQueues.values())
435
- e += r.size;
436
- return {
437
- totalNodes: e,
438
- updateCycles: this.totalUpdateCycles,
439
- averageUpdateTime: this.totalUpdateCycles > 0 ? this.totalUpdateTime / this.totalUpdateCycles : 0,
440
- memoryUsage: this.estimateMemoryUsage(),
441
- errorCount: this.errorCount
442
- };
443
- }
444
- /**
445
- * Estimate memory usage (rough approximation)
446
- */
447
- estimateMemoryUsage() {
448
- let e = 0;
449
- for (const r of this.updateQueues.values())
450
- e += r.size * 50;
451
- return e += this.errorHandlers.size * 100, e;
452
- }
453
- /**
454
- * Check if node is scheduled
455
- */
456
- hasNode(e) {
457
- for (const r of this.updateQueues.values())
458
- if (r.has(e))
459
- return !0;
460
- return !1;
461
- }
462
- /**
463
- * Flush all pending updates synchronously
464
- */
465
- flushSync() {
466
- this.isFlushPending && (this.isFlushPending = !1, this.flush());
467
- }
468
- /**
469
- * Clear all pending updates
470
- */
471
- clearPending() {
472
- for (const e of this.updateQueues.values())
473
- e.clear();
474
- this.isFlushPending = !1;
475
- }
476
- /**
477
- * Cleanup all reactive nodes and destroy scheduler
478
- */
479
- destroy() {
480
- this.isDestroyed = !0;
481
- for (const e of this.updateQueues.values()) {
482
- for (const r of e)
483
- try {
484
- r.cleanup();
485
- } catch (s) {
486
- console.error("Error cleaning up reactive node:", s);
487
- }
488
- e.clear();
489
- }
490
- this.updateQueues.clear(), this.errorHandlers.clear(), f.instance = null;
491
- }
492
- /**
493
- * Get debug information
494
- */
495
- getDebugInfo() {
496
- const e = {};
497
- for (const [r, s] of this.updateQueues)
498
- e[d[r]] = s.size;
499
- return {
500
- isFlushPending: this.isFlushPending,
501
- isDestroyed: this.isDestroyed,
502
- queueSizes: e,
503
- errorHandlerCount: this.errorHandlers.size,
504
- performance: this.getPerformanceMetrics()
505
- };
506
- }
507
- };
508
- l(R, "instance", null);
509
- let _e = R;
510
- var Y = Object.defineProperty, Z = (t, e, r) => e in t ? Y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, h = (t, e, r) => Z(t, typeof e != "symbol" ? e + "" : e, r);
511
- class ee extends N {
512
- constructor(e, r = {}, s = j()) {
513
- super(e, s), h(this, "type", "computed"), h(this, "priority"), h(this, "_hasValue", !1), h(this, "_error", null), h(this, "equalsFn"), h(this, "options"), this.priority = r.priority ?? d.Normal, this.equalsFn = r.equals ?? v, this.options = r;
514
- }
515
- /**
516
- * Get the computed value, tracking dependency and lazily computing
517
- */
518
- getValue() {
519
- const e = I();
520
- return e && e.state !== i.Disposed && (this.observers.add(e), e.sources.add(this)), (this.state === i.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
521
- }
522
- /**
523
- * Get the current value without tracking dependency
524
- */
525
- peek() {
526
- return (this.state === i.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
527
- }
528
- /**
529
- * Remove an observer (cleanup)
530
- */
531
- removeObserver(e) {
532
- this.observers.delete(e), this.options.releaseOnNoObservers === !0 && this.observers.size === 0 && e.state === i.Disposed && this.releaseSources();
533
- }
534
- releaseSources() {
535
- for (const e of this.sources)
536
- "removeObserver" in e && e.removeObserver(this);
537
- this.sources.clear(), this._hasValue = !1, this.state = i.Dirty;
538
- }
539
- /**
540
- * Execute the computation and notify observers
541
- */
542
- execute() {
543
- const e = this._hasValue ? this.value : void 0, r = super.execute();
544
- if (!this._hasValue || !this.equalsFn(e, r))
545
- for (const s of this.observers)
546
- s.state !== i.Disposed && (s.state = i.Dirty, "execute" in s && typeof s.execute == "function" && queueMicrotask(() => {
547
- s.state === i.Dirty && s.execute();
548
- }));
549
- return r;
550
- }
551
- /**
552
- * Notify method for ReactiveNode compatibility
553
- */
554
- notify() {
555
- this.execute();
556
- }
557
- /**
558
- * Complete cleanup for memory management
559
- */
560
- cleanup() {
561
- for (const e of this.sources)
562
- "removeObserver" in e && e.removeObserver(this);
563
- this.sources.clear();
564
- for (const e of this.observers)
565
- e.sources.delete(this);
566
- this.observers.clear(), this._hasValue = !1, this._error = null, this.state = i.Disposed;
567
- }
568
- /**
569
- * Dispose the computed value
570
- */
571
- dispose() {
572
- this.cleanup(), super.dispose();
573
- }
574
- /**
575
- * Debug information
576
- */
577
- [Symbol.for("tachui.debug")]() {
578
- return {
579
- id: this.id,
580
- type: this.type,
581
- value: this._hasValue ? this.value : void 0,
582
- hasValue: this._hasValue,
583
- error: this._error?.message,
584
- state: this.state,
585
- sourceCount: this.sources.size,
586
- observerCount: this.observers.size,
587
- priority: d[this.priority],
588
- debugName: this.options.debugName,
589
- equalsFn: this.equalsFn.name || "anonymous"
590
- };
591
- }
592
- toString() {
593
- return `Computed(${this.options.debugName || this.id}): ${this._hasValue ? this.value : "no value"}`;
594
- }
595
- }
596
- function p(t, e) {
597
- const r = new ee(t, e), s = r.getValue.bind(r);
598
- return s.peek = r.peek.bind(r), Object.defineProperty(s, Symbol.for("tachui.computed"), {
599
- value: r,
600
- enumerable: !1
601
- }), s;
602
- }
603
- function Se(t, e) {
604
- return p(t, e);
605
- }
606
- function qe(t) {
607
- return typeof t == "function" && Symbol.for("tachui.computed") in t;
608
- }
609
- function te(t) {
610
- return t[Symbol.for("tachui.computed")] || null;
611
- }
612
- function De(t) {
613
- const e = te(t);
614
- !e || e.observers.size !== 0 || e.releaseSources();
615
- }
616
- function Ee(t, e) {
617
- return p(e ? () => {
618
- for (const s of e)
619
- s();
620
- return t();
621
- } : t);
622
- }
623
- function Fe(t, e) {
624
- let r, s = !1;
625
- return p(() => (e() && (r = t(), s = !0), s || (r = t(), s = !0), r));
626
- }
627
- const [B, re] = L("light");
628
- function Ie() {
629
- const t = B();
630
- return t === "system" ? V() : t;
631
- }
632
- function Ne(t) {
633
- re(t);
634
- }
635
- const se = p(() => {
636
- const t = B();
637
- return t === "system" ? V() : t;
638
- });
639
- function xe() {
640
- return se;
641
- }
642
- function V() {
643
- return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
644
- }
645
- export {
646
- Oe as A,
647
- w as B,
648
- N as C,
649
- fe as D,
650
- v as E,
651
- ve as F,
652
- me as G,
653
- ye as H,
654
- V as I,
655
- Ie as J,
656
- xe as K,
657
- Ne as L,
658
- _e as M,
659
- X as R,
660
- d as U,
661
- p as a,
662
- Se as b,
663
- L as c,
664
- qe as d,
665
- te as e,
666
- x as f,
667
- pe as g,
668
- Ee as h,
669
- de as i,
670
- Fe as j,
671
- I as k,
672
- j as l,
673
- k as m,
674
- ie as n,
675
- oe as o,
676
- ue as p,
677
- ae as q,
678
- De as r,
679
- $ as s,
680
- le as t,
681
- ce as u,
682
- he as v,
683
- Ce as w,
684
- be as x,
685
- we as y,
686
- ge as z
687
- };
@@ -1,5 +1,5 @@
1
- import "@tachui/types/gradients";
2
1
  import { gradientToCSS as v } from "./gradients/css-generator.js";
2
+ import "@tachui/types/gradients";
3
3
  class D {
4
4
  constructor(t) {
5
5
  this.name = t;