@tachui/core 0.8.5-alpha → 0.8.8
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/README.md +3 -3
- package/dist/assets/index.js +10 -10
- package/dist/{binding-CYpEQquE.js → binding-DCV5PKkK.js} +3 -3
- package/dist/common.js +36 -36
- package/dist/{component-CECyfUOE.js → component-D-O9yq0P.js} +4 -4
- package/dist/{component-base-CJ__jTlr.js → component-base-C41K3NTe.js} +2 -2
- package/dist/{component-context-B6qX_Qsg.js → component-context-B9HI2nZH.js} +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{concatenated-component-_tF1eMvy.js → concatenated-component-CP81AwgI.js} +3 -3
- package/dist/css-classes/index.js +2 -2
- package/dist/{effect-DGmdACI2.js → effect-BsW3fy1q.js} +1 -1
- package/dist/{enhanced-renderer-Bwqsh8Ku.js → enhanced-renderer-BXwg8n7F.js} +4 -4
- package/dist/essential.js +43 -43
- package/dist/{factories-Co2Lv2kJ.js → factories-B3-rmvkB.js} +3 -3
- package/dist/{factory-D7jAY5Kn.js → factory-BgnjJRGE.js} +7 -7
- package/dist/{hooks-DeLasj54.js → hooks-WGmpzYgD.js} +3 -3
- package/dist/{index-X8MVY78C.js → index-ykdS-3xs.js} +7 -7
- package/dist/index.js +36 -36
- package/dist/minimal-prod.js +89 -88
- package/dist/minimal.js +97 -96
- package/dist/modifiers/base.d.ts +1 -0
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +213 -93
- package/dist/modifiers/builder.js +1 -1
- package/dist/modifiers/index.js +3 -3
- package/dist/modifiers/proxy.d.ts.map +1 -1
- package/dist/modifiers/reactive-style-bindings.d.ts +22 -0
- package/dist/modifiers/reactive-style-bindings.d.ts.map +1 -0
- package/dist/modifiers/registry.js +1 -1
- package/dist/{observed-object-DepiqSgg.js → observed-object-p1CLdrFm.js} +3 -3
- package/dist/proxy-522Jjabr.js +188 -0
- package/dist/reactive/computed.d.ts +3 -0
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive/index.js +18 -18
- package/dist/runtime/dom-bridge.js +4 -4
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/renderer.js +4 -4
- package/dist/{scheduler-DI_8ykMk.js → scheduler-DppMK9mR.js} +1 -1
- package/dist/{signal-list-BdpxSodS.js → signal-list-07gNXGiW.js} +18 -18
- package/dist/state/index.js +8 -8
- package/dist/{theme-BFaKUcjZ.js → theme-CRLPHryV.js} +128 -118
- package/dist/validation/index.js +2 -2
- package/dist/version.js +1 -1
- package/package.json +4 -3
- package/dist/proxy-Cqmbiyx0.js +0 -175
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ComputationState as
|
|
2
|
-
var
|
|
3
|
-
let
|
|
4
|
-
const
|
|
5
|
-
let O = null, _ = null,
|
|
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
6
|
const F = /* @__PURE__ */ new Set();
|
|
7
|
-
F.add(
|
|
7
|
+
F.add(E);
|
|
8
8
|
const n = {
|
|
9
9
|
get currentComputation() {
|
|
10
10
|
return O;
|
|
@@ -19,24 +19,24 @@ const n = {
|
|
|
19
19
|
_ = t;
|
|
20
20
|
},
|
|
21
21
|
get isBatching() {
|
|
22
|
-
return
|
|
22
|
+
return S;
|
|
23
23
|
},
|
|
24
24
|
set isBatching(t) {
|
|
25
|
-
|
|
25
|
+
S = t;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
function I() {
|
|
29
29
|
return n.currentComputation;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function j() {
|
|
32
32
|
return n.currentOwner;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function k() {
|
|
35
35
|
return n.isBatching;
|
|
36
36
|
}
|
|
37
37
|
class T {
|
|
38
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 = ++
|
|
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
40
|
}
|
|
41
41
|
dispose() {
|
|
42
42
|
if (!this.disposed) {
|
|
@@ -54,12 +54,12 @@ class T {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
class
|
|
57
|
+
class N {
|
|
58
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",
|
|
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
60
|
}
|
|
61
61
|
execute() {
|
|
62
|
-
if (this.state ===
|
|
62
|
+
if (this.state === i.Disposed)
|
|
63
63
|
return this.value;
|
|
64
64
|
for (const r of this.sources)
|
|
65
65
|
r && typeof r == "object" && "removeObserver" in r && r.removeObserver(this);
|
|
@@ -67,16 +67,16 @@ class x {
|
|
|
67
67
|
const e = n.currentComputation;
|
|
68
68
|
n.currentComputation = this;
|
|
69
69
|
try {
|
|
70
|
-
return this.state =
|
|
70
|
+
return this.state = i.Clean, this.value = this.fn(), this.value;
|
|
71
71
|
} catch (r) {
|
|
72
|
-
throw this.state =
|
|
72
|
+
throw this.state = i.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", r), r;
|
|
73
73
|
} finally {
|
|
74
74
|
n.currentComputation = e;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
dispose() {
|
|
78
|
-
if (this.state !==
|
|
79
|
-
this.state =
|
|
78
|
+
if (this.state !== i.Disposed) {
|
|
79
|
+
this.state = i.Disposed;
|
|
80
80
|
for (const e of this.sources)
|
|
81
81
|
e && typeof e == "object" && "removeObserver" in e && e.removeObserver(this);
|
|
82
82
|
this.sources.clear();
|
|
@@ -86,7 +86,7 @@ class x {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function ie(t) {
|
|
90
90
|
const e = new T(n.currentOwner), r = n.currentOwner;
|
|
91
91
|
n.currentOwner = e;
|
|
92
92
|
try {
|
|
@@ -95,7 +95,7 @@ function ne(t) {
|
|
|
95
95
|
n.currentOwner = r;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function oe(t, e) {
|
|
99
99
|
const r = n.currentOwner;
|
|
100
100
|
n.currentOwner = t;
|
|
101
101
|
try {
|
|
@@ -104,26 +104,26 @@ function ie(t, e) {
|
|
|
104
104
|
n.currentOwner = r;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function ue() {
|
|
108
108
|
return n.currentOwner;
|
|
109
109
|
}
|
|
110
|
-
let
|
|
110
|
+
let b = null;
|
|
111
111
|
function $(t) {
|
|
112
|
-
|
|
112
|
+
b = t;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function ae(t) {
|
|
115
115
|
if (n.isBatching)
|
|
116
116
|
return t();
|
|
117
117
|
const e = n.isBatching;
|
|
118
118
|
n.isBatching = !0;
|
|
119
119
|
try {
|
|
120
120
|
const r = t();
|
|
121
|
-
return !e &&
|
|
121
|
+
return !e && b && b(), r;
|
|
122
122
|
} finally {
|
|
123
123
|
n.isBatching = e;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function ce(t) {
|
|
127
127
|
const e = n.currentComputation;
|
|
128
128
|
n.currentComputation = null;
|
|
129
129
|
try {
|
|
@@ -132,40 +132,40 @@ function ae(t) {
|
|
|
132
132
|
n.currentComputation = e;
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
const r = new
|
|
135
|
+
function le(t, e) {
|
|
136
|
+
const r = new N(
|
|
137
137
|
t,
|
|
138
138
|
e || n.currentOwner
|
|
139
139
|
);
|
|
140
140
|
return r.execute(), r;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function he() {
|
|
143
143
|
return {
|
|
144
144
|
computation: n.currentComputation,
|
|
145
145
|
batch: n.isBatching
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const fe = {
|
|
149
149
|
getCurrentComputation: () => n.currentComputation,
|
|
150
150
|
getCurrentOwner: () => n.currentOwner,
|
|
151
|
-
getComputationCount: () =>
|
|
152
|
-
getOwnerCount: () =>
|
|
151
|
+
getComputationCount: () => q,
|
|
152
|
+
getOwnerCount: () => D,
|
|
153
153
|
isBatching: () => n.isBatching,
|
|
154
154
|
getModuleInstances: () => Array.from(F),
|
|
155
|
-
getModuleId: () =>
|
|
155
|
+
getModuleId: () => E
|
|
156
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,
|
|
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
158
|
let U = 0;
|
|
159
159
|
class W {
|
|
160
160
|
constructor(e) {
|
|
161
|
-
|
|
161
|
+
g(this, "id"), g(this, "observers", /* @__PURE__ */ new Set()), g(this, "_value"), this.id = ++U, this._value = e;
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Get the current value and track dependency
|
|
165
165
|
*/
|
|
166
166
|
getValue() {
|
|
167
167
|
const e = I();
|
|
168
|
-
return e && e.state !==
|
|
168
|
+
return e && e.state !== i.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* Get the current value without tracking dependency
|
|
@@ -185,7 +185,7 @@ class W {
|
|
|
185
185
|
*/
|
|
186
186
|
notify() {
|
|
187
187
|
for (const e of this.observers)
|
|
188
|
-
e.state !==
|
|
188
|
+
e.state !== i.Disposed && (e.state = i.Dirty, J(e));
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* Remove an observer (cleanup)
|
|
@@ -208,9 +208,9 @@ class W {
|
|
|
208
208
|
const m = /* @__PURE__ */ new Set();
|
|
209
209
|
let y = !1;
|
|
210
210
|
function J(t) {
|
|
211
|
-
m.add(t), !y && !
|
|
211
|
+
m.add(t), !y && !k() && queueMicrotask(x);
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function x() {
|
|
214
214
|
if (!y) {
|
|
215
215
|
y = !0;
|
|
216
216
|
try {
|
|
@@ -218,7 +218,7 @@ function N() {
|
|
|
218
218
|
const t = Array.from(m).sort((e, r) => e.id - r.id);
|
|
219
219
|
m.clear();
|
|
220
220
|
for (const e of t)
|
|
221
|
-
e.state ===
|
|
221
|
+
e.state === i.Dirty && e.execute();
|
|
222
222
|
}
|
|
223
223
|
} finally {
|
|
224
224
|
y = !1;
|
|
@@ -234,32 +234,32 @@ function L(t) {
|
|
|
234
234
|
enumerable: !1
|
|
235
235
|
}), [r, s];
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function de(t) {
|
|
238
238
|
return typeof t == "function" && Symbol.for("tachui.signal") in t;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function pe(t) {
|
|
241
241
|
return t[Symbol.for("tachui.signal")] || null;
|
|
242
242
|
}
|
|
243
|
-
$(
|
|
244
|
-
const
|
|
243
|
+
$(x);
|
|
244
|
+
const v = (t, e) => t === e, w = (t, e) => {
|
|
245
245
|
if (t === e) return !0;
|
|
246
246
|
if (t == null || e == null || typeof t != typeof e) return !1;
|
|
247
247
|
if (typeof t == "object") {
|
|
248
248
|
if (Array.isArray(t) !== Array.isArray(e)) return !1;
|
|
249
249
|
if (Array.isArray(t)) {
|
|
250
250
|
const c = t, C = e;
|
|
251
|
-
return c.length !== C.length ? !1 : c.every((
|
|
251
|
+
return c.length !== C.length ? !1 : c.every((P, z) => w(P, C[z]));
|
|
252
252
|
}
|
|
253
|
-
const r = t, s = e,
|
|
254
|
-
return
|
|
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
255
|
}
|
|
256
256
|
return !1;
|
|
257
|
-
},
|
|
257
|
+
}, me = (t, e) => {
|
|
258
258
|
if (t === e) return !0;
|
|
259
259
|
if (typeof t != "object" || typeof e != "object" || t == null || e == null) return !1;
|
|
260
|
-
const r = t, s = e,
|
|
261
|
-
return
|
|
262
|
-
},
|
|
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
263
|
if (t === e) return !0;
|
|
264
264
|
if (t instanceof Date && e instanceof Date)
|
|
265
265
|
return t.getTime() === e.getTime();
|
|
@@ -277,22 +277,22 @@ const g = (t, e) => t === e, b = (t, e) => {
|
|
|
277
277
|
if (!e.has(r) || e.get(r) !== s) return !1;
|
|
278
278
|
return !0;
|
|
279
279
|
}
|
|
280
|
-
return
|
|
281
|
-
},
|
|
280
|
+
return w(t, e);
|
|
281
|
+
}, ve = (t, e) => {
|
|
282
282
|
if (t === e) return !0;
|
|
283
283
|
try {
|
|
284
284
|
return JSON.stringify(t) === JSON.stringify(e);
|
|
285
285
|
} catch {
|
|
286
286
|
return t === e;
|
|
287
287
|
}
|
|
288
|
-
}, ge = (t, e =
|
|
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
289
|
if (e === r) return !0;
|
|
290
290
|
if (e == null || r == null) return !1;
|
|
291
|
-
const s = Object.keys(e),
|
|
292
|
-
return s.length !==
|
|
293
|
-
},
|
|
294
|
-
const
|
|
295
|
-
return process.env.NODE_ENV === "development" && console.log(`[${e || "equals"}]`, { a: r, b: s, equal:
|
|
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
296
|
};
|
|
297
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
298
|
class X extends Error {
|
|
@@ -300,7 +300,7 @@ class X extends Error {
|
|
|
300
300
|
super(e), this.cause = r, this.node = s, this.name = "ReactiveError";
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
const
|
|
303
|
+
const R = class f {
|
|
304
304
|
constructor() {
|
|
305
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
306
|
for (const e of Object.values(d))
|
|
@@ -334,9 +334,9 @@ const B = class f {
|
|
|
334
334
|
]) {
|
|
335
335
|
const s = this.updateQueues.get(r);
|
|
336
336
|
if (!s || s.size === 0) continue;
|
|
337
|
-
const
|
|
337
|
+
const o = Array.from(s);
|
|
338
338
|
s.clear();
|
|
339
|
-
for (const a of
|
|
339
|
+
for (const a of o)
|
|
340
340
|
try {
|
|
341
341
|
await this.updateNodeWithRetry(a);
|
|
342
342
|
} catch (c) {
|
|
@@ -361,7 +361,7 @@ const B = class f {
|
|
|
361
361
|
e.notify();
|
|
362
362
|
} catch (s) {
|
|
363
363
|
if (r < this.maxRetries)
|
|
364
|
-
return console.warn(`Reactive update failed, retrying (${r}/${this.maxRetries})`), await new Promise((
|
|
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
365
|
throw s;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
@@ -420,8 +420,8 @@ const B = class f {
|
|
|
420
420
|
for (const s of this.errorHandlers)
|
|
421
421
|
try {
|
|
422
422
|
s(e), r = !0;
|
|
423
|
-
} catch (
|
|
424
|
-
console.error("Error handler threw error:",
|
|
423
|
+
} catch (o) {
|
|
424
|
+
console.error("Error handler threw error:", o);
|
|
425
425
|
}
|
|
426
426
|
if (!r && (console.error("Unhandled reactive error:", e), process.env.NODE_ENV === "development"))
|
|
427
427
|
throw e;
|
|
@@ -505,31 +505,36 @@ const B = class f {
|
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
|
-
l(
|
|
509
|
-
let
|
|
508
|
+
l(R, "instance", null);
|
|
509
|
+
let _e = R;
|
|
510
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
|
|
512
|
-
constructor(e, r = {}, s =
|
|
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 ??
|
|
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
514
|
}
|
|
515
515
|
/**
|
|
516
516
|
* Get the computed value, tracking dependency and lazily computing
|
|
517
517
|
*/
|
|
518
518
|
getValue() {
|
|
519
519
|
const e = I();
|
|
520
|
-
return e && e.state !==
|
|
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
521
|
}
|
|
522
522
|
/**
|
|
523
523
|
* Get the current value without tracking dependency
|
|
524
524
|
*/
|
|
525
525
|
peek() {
|
|
526
|
-
return (this.state ===
|
|
526
|
+
return (this.state === i.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
|
|
527
527
|
}
|
|
528
528
|
/**
|
|
529
529
|
* Remove an observer (cleanup)
|
|
530
530
|
*/
|
|
531
531
|
removeObserver(e) {
|
|
532
|
-
this.observers.delete(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;
|
|
533
538
|
}
|
|
534
539
|
/**
|
|
535
540
|
* Execute the computation and notify observers
|
|
@@ -538,8 +543,8 @@ class ee extends x {
|
|
|
538
543
|
const e = this._hasValue ? this.value : void 0, r = super.execute();
|
|
539
544
|
if (!this._hasValue || !this.equalsFn(e, r))
|
|
540
545
|
for (const s of this.observers)
|
|
541
|
-
s.state !==
|
|
542
|
-
s.state ===
|
|
546
|
+
s.state !== i.Disposed && (s.state = i.Dirty, "execute" in s && typeof s.execute == "function" && queueMicrotask(() => {
|
|
547
|
+
s.state === i.Dirty && s.execute();
|
|
543
548
|
}));
|
|
544
549
|
return r;
|
|
545
550
|
}
|
|
@@ -558,7 +563,7 @@ class ee extends x {
|
|
|
558
563
|
this.sources.clear();
|
|
559
564
|
for (const e of this.observers)
|
|
560
565
|
e.sources.delete(this);
|
|
561
|
-
this.observers.clear(), this._hasValue = !1, this._error = null, this.state =
|
|
566
|
+
this.observers.clear(), this._hasValue = !1, this._error = null, this.state = i.Disposed;
|
|
562
567
|
}
|
|
563
568
|
/**
|
|
564
569
|
* Dispose the computed value
|
|
@@ -595,15 +600,19 @@ function p(t, e) {
|
|
|
595
600
|
enumerable: !1
|
|
596
601
|
}), s;
|
|
597
602
|
}
|
|
598
|
-
function
|
|
603
|
+
function Se(t, e) {
|
|
599
604
|
return p(t, e);
|
|
600
605
|
}
|
|
601
606
|
function qe(t) {
|
|
602
607
|
return typeof t == "function" && Symbol.for("tachui.computed") in t;
|
|
603
608
|
}
|
|
604
|
-
function
|
|
609
|
+
function te(t) {
|
|
605
610
|
return t[Symbol.for("tachui.computed")] || null;
|
|
606
611
|
}
|
|
612
|
+
function De(t) {
|
|
613
|
+
const e = te(t);
|
|
614
|
+
!e || e.observers.size !== 0 || e.releaseSources();
|
|
615
|
+
}
|
|
607
616
|
function Ee(t, e) {
|
|
608
617
|
return p(e ? () => {
|
|
609
618
|
for (const s of e)
|
|
@@ -611,67 +620,68 @@ function Ee(t, e) {
|
|
|
611
620
|
return t();
|
|
612
621
|
} : t);
|
|
613
622
|
}
|
|
614
|
-
function
|
|
623
|
+
function Fe(t, e) {
|
|
615
624
|
let r, s = !1;
|
|
616
625
|
return p(() => (e() && (r = t(), s = !0), s || (r = t(), s = !0), r));
|
|
617
626
|
}
|
|
618
|
-
const [
|
|
619
|
-
function
|
|
620
|
-
const t =
|
|
621
|
-
return t === "system" ?
|
|
627
|
+
const [B, re] = L("light");
|
|
628
|
+
function Ie() {
|
|
629
|
+
const t = B();
|
|
630
|
+
return t === "system" ? V() : t;
|
|
622
631
|
}
|
|
623
|
-
function
|
|
624
|
-
|
|
632
|
+
function Ne(t) {
|
|
633
|
+
re(t);
|
|
625
634
|
}
|
|
626
|
-
const
|
|
627
|
-
const t =
|
|
628
|
-
return t === "system" ?
|
|
635
|
+
const se = p(() => {
|
|
636
|
+
const t = B();
|
|
637
|
+
return t === "system" ? V() : t;
|
|
629
638
|
});
|
|
630
639
|
function xe() {
|
|
631
|
-
return
|
|
640
|
+
return se;
|
|
632
641
|
}
|
|
633
|
-
function
|
|
642
|
+
function V() {
|
|
634
643
|
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
635
644
|
}
|
|
636
645
|
export {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
646
|
+
Oe as A,
|
|
647
|
+
w as B,
|
|
648
|
+
N as C,
|
|
649
|
+
fe as D,
|
|
650
|
+
v as E,
|
|
651
|
+
ve as F,
|
|
643
652
|
me as G,
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
653
|
+
ye as H,
|
|
654
|
+
V as I,
|
|
655
|
+
Ie as J,
|
|
656
|
+
xe as K,
|
|
657
|
+
Ne as L,
|
|
658
|
+
_e as M,
|
|
649
659
|
X as R,
|
|
650
660
|
d as U,
|
|
651
661
|
p as a,
|
|
652
|
-
|
|
662
|
+
Se as b,
|
|
653
663
|
L as c,
|
|
654
664
|
qe as d,
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
665
|
+
te as e,
|
|
666
|
+
x as f,
|
|
667
|
+
pe as g,
|
|
658
668
|
Ee as h,
|
|
659
|
-
|
|
660
|
-
|
|
669
|
+
de as i,
|
|
670
|
+
Fe as j,
|
|
661
671
|
I as k,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
672
|
+
j as l,
|
|
673
|
+
k as m,
|
|
674
|
+
ie as n,
|
|
665
675
|
oe as o,
|
|
666
676
|
ue as p,
|
|
667
|
-
|
|
668
|
-
|
|
677
|
+
ae as q,
|
|
678
|
+
De as r,
|
|
669
679
|
$ as s,
|
|
670
680
|
le as t,
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
681
|
+
ce as u,
|
|
682
|
+
he as v,
|
|
683
|
+
Ce as w,
|
|
684
|
+
be as x,
|
|
685
|
+
we as y,
|
|
686
|
+
ge as z
|
|
677
687
|
};
|
package/dist/validation/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../scheduler-
|
|
2
|
-
import { i as E } from "../theme-
|
|
1
|
+
import "../scheduler-DppMK9mR.js";
|
|
2
|
+
import { i as E } from "../theme-CRLPHryV.js";
|
|
3
3
|
import "@tachui/types/reactive";
|
|
4
4
|
const f = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
5
5
|
function $(o) {
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachui/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "tachUI core framework with reactive system and compiler",
|
|
5
5
|
"homepage": "https://tachui.dev/",
|
|
6
6
|
"type": "module",
|
|
@@ -141,8 +141,8 @@
|
|
|
141
141
|
"dist"
|
|
142
142
|
],
|
|
143
143
|
"dependencies": {
|
|
144
|
-
"@tachui/types": "0.8.
|
|
145
|
-
"@tachui/registry": "0.8.
|
|
144
|
+
"@tachui/types": "0.8.8",
|
|
145
|
+
"@tachui/registry": "0.8.8"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|
|
148
148
|
"@types/jsdom": "^21.1.6",
|
|
@@ -191,6 +191,7 @@
|
|
|
191
191
|
"test:coverage": "vitest run --coverage",
|
|
192
192
|
"test:watch": "vitest",
|
|
193
193
|
"test:ci": "vitest run",
|
|
194
|
+
"test:stress": "sh -lc 'cd ../.. && pnpm vitest run --config vitest.stress.config.ts packages/core/__tests__/modifiers/reactive-stress.test.ts --maxWorkers 1'",
|
|
194
195
|
"test:all": "vitest run --config vitest.all.config.ts",
|
|
195
196
|
"bench": "vitest bench",
|
|
196
197
|
"benchmark": "vitest run --config vitest.benchmark.config.ts benchmarks/full.bench.ts",
|