@tachui/core 0.8.1-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 +41 -3
- package/dist/assets/AssetCollection.d.ts.map +1 -1
- package/dist/assets/ColorAsset.d.ts.map +1 -1
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +486 -0
- package/dist/assets/types.d.ts +8 -68
- package/dist/assets/types.d.ts.map +1 -1
- package/dist/binding-DCV5PKkK.js +308 -0
- package/dist/build-plugins/index.d.ts +3 -0
- package/dist/build-plugins/index.d.ts.map +1 -0
- package/dist/build-plugins/modifier-types.d.ts +12 -0
- package/dist/build-plugins/modifier-types.d.ts.map +1 -0
- package/dist/build-tools/typegen-runner.d.ts +29 -0
- package/dist/build-tools/typegen-runner.d.ts.map +1 -0
- package/dist/bundles/minimal.d.ts +2 -0
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +427 -394
- package/dist/{component-XAzF1xqs.js → component-D-O9yq0P.js} +80 -68
- package/dist/{component-base-x2XmHFjy.js → component-base-C41K3NTe.js} +9 -7
- package/dist/component-context-B9HI2nZH.js +176 -0
- package/dist/components/factory.d.ts +24 -0
- package/dist/components/factory.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -6
- package/dist/components/wrapper.d.ts +70 -30
- package/dist/components/wrapper.d.ts.map +1 -1
- package/dist/concatenated-component-CP81AwgI.js +2288 -0
- package/dist/concatenation/concatenated-component.d.ts +16 -2
- package/dist/concatenation/concatenated-component.d.ts.map +1 -1
- package/dist/concatenation/text-optimizer.d.ts.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants/layout.d.ts +2 -9
- package/dist/constants/layout.d.ts.map +1 -1
- package/dist/css-classes/index.js +15 -173
- package/dist/{effect-B9Knft0b.js → effect-BsW3fy1q.js} +3 -3
- package/dist/enhanced-renderer-BXwg8n7F.js +172 -0
- package/dist/essential.js +427 -394
- package/dist/{index-DIvMCJQO.js → factories-B3-rmvkB.js} +13 -13
- package/dist/factory-BgnjJRGE.js +485 -0
- package/dist/gradients/css-generator.js +99 -0
- package/dist/gradients/index.js +56 -0
- package/dist/gradients/reactive.d.ts.map +1 -1
- package/dist/gradients/types.d.ts +3 -91
- package/dist/gradients/types.d.ts.map +1 -1
- package/dist/hooks-WGmpzYgD.js +446 -0
- package/dist/index-JQ1sW1SK.js +2049 -0
- package/dist/index-ykdS-3xs.js +618 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +427 -394
- package/dist/minimal-prod.js +100 -98
- package/dist/minimal.js +116 -109
- package/dist/modifiers/alignment.d.ts +5 -0
- package/dist/modifiers/alignment.d.ts.map +1 -0
- package/dist/modifiers/base.d.ts +7 -7
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +220 -92
- package/dist/modifiers/builder.d.ts +28 -165
- package/dist/modifiers/builder.d.ts.map +1 -1
- package/dist/modifiers/builder.js +7 -7
- package/dist/modifiers/core.d.ts +0 -1
- package/dist/modifiers/core.d.ts.map +1 -1
- package/dist/modifiers/corner-radius.d.ts +8 -0
- package/dist/modifiers/corner-radius.d.ts.map +1 -0
- package/dist/modifiers/index.d.ts +9 -6
- package/dist/modifiers/index.d.ts.map +1 -1
- package/dist/modifiers/index.js +36 -30
- package/dist/modifiers/layout-priority.d.ts +8 -0
- package/dist/modifiers/layout-priority.d.ts.map +1 -0
- package/dist/modifiers/opacity.d.ts +8 -0
- package/dist/modifiers/opacity.d.ts.map +1 -0
- package/dist/modifiers/presets.d.ts.map +1 -1
- package/dist/modifiers/proxy.d.ts +4 -0
- package/dist/modifiers/proxy.d.ts.map +1 -0
- package/dist/modifiers/reactive-style-bindings.d.ts +22 -0
- package/dist/modifiers/reactive-style-bindings.d.ts.map +1 -0
- package/dist/modifiers/registration-utils.d.ts +7 -0
- package/dist/modifiers/registration-utils.d.ts.map +1 -0
- package/dist/modifiers/registry.d.ts +18 -9
- package/dist/modifiers/registry.d.ts.map +1 -1
- package/dist/modifiers/registry.js +2 -2
- package/dist/modifiers/type-generator.d.ts +82 -0
- package/dist/modifiers/type-generator.d.ts.map +1 -0
- package/dist/modifiers/types.d.ts +2 -479
- package/dist/modifiers/types.d.ts.map +1 -1
- package/dist/modifiers/types.js +1 -4
- package/dist/{observed-object-Cos-FtjP.js → observed-object-p1CLdrFm.js} +3 -3
- package/dist/optimization-CbKNA9w4.js +21 -0
- package/dist/plugins/index.js +28 -8
- package/dist/plugins/simplified-lazy-loader.d.ts.map +1 -1
- package/dist/presets-B9x94uRn.js +381 -0
- package/dist/proxy-522Jjabr.js +188 -0
- package/dist/reactive/cleanup.d.ts.map +1 -1
- package/dist/reactive/computed.d.ts +4 -1
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive/context.d.ts +4 -3
- package/dist/reactive/context.d.ts.map +1 -1
- package/dist/reactive/index.d.ts +1 -0
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/index.js +84 -490
- package/dist/reactive/signal-list.d.ts +100 -0
- package/dist/reactive/signal-list.d.ts.map +1 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive/types.d.ts +2 -89
- package/dist/reactive/types.d.ts.map +1 -1
- package/dist/reactive/types.js +1 -4
- package/dist/registration-utils-CNsN4eoU.js +27 -0
- package/dist/runtime/component.d.ts.map +1 -1
- package/dist/runtime/concatenation-aria.d.ts.map +1 -1
- package/dist/runtime/concatenation-aria.js +18 -13
- package/dist/runtime/concatenation-full.d.ts.map +1 -1
- package/dist/runtime/concatenation-full.js +42 -34
- package/dist/runtime/concatenation-minimal.d.ts.map +1 -1
- package/dist/runtime/concatenation-minimal.js +13 -8
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.d.ts +1 -1
- package/dist/runtime/dom-bridge.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.js +239 -12
- package/dist/runtime/event-delegation.d.ts +59 -0
- package/dist/runtime/event-delegation.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +96 -0
- package/dist/runtime/layout-scheduler.d.ts +89 -0
- package/dist/runtime/layout-scheduler.d.ts.map +1 -0
- package/dist/runtime/props.d.ts.map +1 -1
- package/dist/runtime/renderer.d.ts +54 -2
- package/dist/runtime/renderer.d.ts.map +1 -1
- package/dist/runtime/renderer.js +11 -7
- package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +2 -226
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js +1 -1
- package/dist/scheduler-DppMK9mR.js +169 -0
- package/dist/signal-list-07gNXGiW.js +525 -0
- package/dist/state/index.js +319 -0
- package/dist/theme-CRLPHryV.js +687 -0
- package/dist/utils/clone-helpers.d.ts +11 -0
- package/dist/utils/clone-helpers.d.ts.map +1 -0
- package/dist/validation/index.js +28 -26
- package/dist/version.d.ts +19 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/package.json +52 -11
- package/dist/concatenated-component-ByPl3_FF.js +0 -2933
- package/dist/dom-bridge-CAa1N2zX.js +0 -406
- package/dist/index-DEBd8cq7.js +0 -1144
- package/dist/index-vdsiw6gQ.js +0 -777
- package/dist/modifiers/as-html-validator.d.ts +0 -20
- package/dist/modifiers/as-html-validator.d.ts.map +0 -1
- package/dist/modifiers/as-html.d.ts +0 -65
- package/dist/modifiers/as-html.d.ts.map +0 -1
- package/dist/modifiers/background.d.ts +0 -51
- package/dist/modifiers/background.d.ts.map +0 -1
- package/dist/modifiers/basic-sanitizer.d.ts +0 -54
- package/dist/modifiers/basic-sanitizer.d.ts.map +0 -1
- package/dist/modifiers/css.d.ts +0 -86
- package/dist/modifiers/css.d.ts.map +0 -1
- package/dist/production-minimal-BY_gMc-l.js +0 -2532
- package/dist/scheduler-BKeqwrYE.js +0 -814
package/dist/reactive/index.js
CHANGED
|
@@ -1,493 +1,87 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { R as
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
var N = Object.defineProperty, _ = (t, e, r) => e in t ? N(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, o = (t, e, r) => _(t, typeof e != "symbol" ? e + "" : e, r);
|
|
6
|
-
let O = 0;
|
|
7
|
-
class R {
|
|
8
|
-
constructor(e, r = {}) {
|
|
9
|
-
this.effectFn = e, o(this, "id", ++O), o(this, "type", "effect"), o(this, "priority"), o(this, "sources", /* @__PURE__ */ new Set()), o(this, "observers", /* @__PURE__ */ new Set()), o(this, "isDisposed", !1), o(this, "cleanupFn"), o(this, "options"), o(this, "owner"), this.priority = r.priority ?? u.Normal, this.options = r, this.owner = g(), r.fireImmediately !== !1 && this.execute();
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Notify method called by unified scheduler
|
|
13
|
-
*/
|
|
14
|
-
notify() {
|
|
15
|
-
this.isDisposed || this.execute();
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Execute the effect with proper error handling
|
|
19
|
-
*/
|
|
20
|
-
execute() {
|
|
21
|
-
if (this.isDisposed) return;
|
|
22
|
-
if (this.cleanupFn) {
|
|
23
|
-
try {
|
|
24
|
-
this.cleanupFn();
|
|
25
|
-
} catch (s) {
|
|
26
|
-
console.error("Effect cleanup error:", s);
|
|
27
|
-
}
|
|
28
|
-
this.cleanupFn = void 0;
|
|
29
|
-
}
|
|
30
|
-
for (const s of this.sources)
|
|
31
|
-
"removeObserver" in s && typeof s.removeObserver == "function" ? s.removeObserver(this) : "observers" in s && s.observers instanceof Set && s.observers.delete(this);
|
|
32
|
-
this.sources.clear();
|
|
33
|
-
const e = v(), r = this.setCurrentComputation || (() => {
|
|
34
|
-
});
|
|
35
|
-
r(this);
|
|
36
|
-
try {
|
|
37
|
-
const s = this.effectFn();
|
|
38
|
-
typeof s == "function" && (this.cleanupFn = s);
|
|
39
|
-
} catch (s) {
|
|
40
|
-
if (this.options.onError)
|
|
41
|
-
try {
|
|
42
|
-
this.options.onError(s);
|
|
43
|
-
} catch (n) {
|
|
44
|
-
throw console.error("Effect error handler threw error:", n), s;
|
|
45
|
-
}
|
|
46
|
-
else
|
|
47
|
-
throw console.error(`Effect ${this.options.debugName || this.id} threw error:`, s), s;
|
|
48
|
-
} finally {
|
|
49
|
-
r(e);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Complete cleanup for memory management
|
|
54
|
-
*/
|
|
55
|
-
cleanup() {
|
|
56
|
-
if (this.isDisposed = !0, this.cleanupFn) {
|
|
57
|
-
try {
|
|
58
|
-
this.cleanupFn();
|
|
59
|
-
} catch (e) {
|
|
60
|
-
console.error("Effect cleanup error:", e);
|
|
61
|
-
}
|
|
62
|
-
this.cleanupFn = void 0;
|
|
63
|
-
}
|
|
64
|
-
for (const e of this.sources)
|
|
65
|
-
"removeObserver" in e && typeof e.removeObserver == "function" ? e.removeObserver(this) : "observers" in e && e.observers instanceof Set && e.observers.delete(this);
|
|
66
|
-
if (this.sources.clear(), this.owner?.cleanups) {
|
|
67
|
-
const e = this.owner.cleanups.indexOf(this.cleanup.bind(this));
|
|
68
|
-
e >= 0 && this.owner.cleanups.splice(e, 1);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Dispose the effect (alias for cleanup)
|
|
73
|
-
*/
|
|
74
|
-
dispose() {
|
|
75
|
-
this.cleanup();
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Check if effect is disposed
|
|
79
|
-
*/
|
|
80
|
-
get disposed() {
|
|
81
|
-
return this.isDisposed;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Debug information
|
|
85
|
-
*/
|
|
86
|
-
[Symbol.for("tachui.debug")]() {
|
|
87
|
-
return {
|
|
88
|
-
id: this.id,
|
|
89
|
-
type: this.type,
|
|
90
|
-
priority: u[this.priority],
|
|
91
|
-
debugName: this.options.debugName,
|
|
92
|
-
disposed: this.isDisposed,
|
|
93
|
-
sourceCount: this.sources.size,
|
|
94
|
-
hasCleanup: !!this.cleanupFn
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
toString() {
|
|
98
|
-
return `Effect(${this.options.debugName || this.id})`;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function l(t, e) {
|
|
102
|
-
const r = new R(t, e), s = g();
|
|
103
|
-
return s && s.cleanups.push(() => r.cleanup()), () => r.cleanup();
|
|
104
|
-
}
|
|
105
|
-
function A(t, e) {
|
|
106
|
-
return l(t, { ...e, priority: u.High });
|
|
107
|
-
}
|
|
108
|
-
function L(t, e) {
|
|
109
|
-
return l(t, { ...e, priority: u.Low });
|
|
110
|
-
}
|
|
111
|
-
function V(t, e) {
|
|
112
|
-
return l(t, { ...e, fireImmediately: !1 });
|
|
113
|
-
}
|
|
114
|
-
function W(t, e, r = 3, s) {
|
|
115
|
-
let n = 0;
|
|
116
|
-
const f = () => {
|
|
117
|
-
try {
|
|
118
|
-
return t();
|
|
119
|
-
} catch (m) {
|
|
120
|
-
if (n++, e && n <= r && e(m, n)) {
|
|
121
|
-
setTimeout(() => f(), n * 100);
|
|
122
|
-
return;
|
|
123
|
-
} else
|
|
124
|
-
throw m;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
return l(f, {
|
|
128
|
-
...s,
|
|
129
|
-
debugName: `${s?.debugName || "effect"}(resilient)`
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function j(t) {
|
|
133
|
-
const e = t.map(({ fn: r, options: s }) => l(r, s));
|
|
134
|
-
return () => {
|
|
135
|
-
e.forEach((r) => r());
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function H() {
|
|
139
|
-
return c.getInstance().getPerformanceMetrics();
|
|
140
|
-
}
|
|
141
|
-
function B() {
|
|
142
|
-
c.getInstance().flushSync();
|
|
143
|
-
}
|
|
144
|
-
var $ = Object.defineProperty, I = (t, e, r) => e in t ? $(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, a = (t, e, r) => I(t, typeof e != "symbol" ? e + "" : e, r);
|
|
145
|
-
let x = 0;
|
|
146
|
-
class P {
|
|
147
|
-
constructor(e, r = {}) {
|
|
148
|
-
a(this, "id", ++x), a(this, "type", "signal"), a(this, "priority"), a(this, "observers", /* @__PURE__ */ new Set()), a(this, "_value"), a(this, "scheduler", c.getInstance()), a(this, "equalsFn"), a(this, "debugName"), a(this, "options"), this._value = e, this.options = r, this.priority = r.priority ?? u.Normal, this.equalsFn = r.equals ?? E, this.debugName = r.debugName;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Get the current value and track dependency
|
|
152
|
-
*/
|
|
153
|
-
getValue() {
|
|
154
|
-
const e = v();
|
|
155
|
-
return e && e.state !== d.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Get the current value without tracking dependency
|
|
159
|
-
*/
|
|
160
|
-
peek() {
|
|
161
|
-
return this._value;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Set a new value using custom equality function
|
|
165
|
-
*/
|
|
166
|
-
setValue(e) {
|
|
167
|
-
const r = typeof e == "function" ? e(this._value) : e;
|
|
168
|
-
if (!this.equalsFn(r, this._value)) {
|
|
169
|
-
const s = this._value;
|
|
170
|
-
this._value = r, process.env.NODE_ENV === "development" && this.debugName && console.debug(`[Signal:${this.debugName}] ${s} -> ${r}`), this.scheduler.schedule(this);
|
|
171
|
-
}
|
|
172
|
-
return r;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Notify all observers (called by scheduler)
|
|
176
|
-
*/
|
|
177
|
-
notify() {
|
|
178
|
-
for (const e of this.observers)
|
|
179
|
-
e.state !== d.Disposed && (e.state = d.Dirty, "type" in e && "priority" in e && this.scheduler.schedule(e));
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Remove an observer (cleanup)
|
|
183
|
-
*/
|
|
184
|
-
removeObserver(e) {
|
|
185
|
-
this.observers.delete(e);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Complete cleanup for memory management
|
|
189
|
-
*/
|
|
190
|
-
cleanup() {
|
|
191
|
-
for (const e of this.observers)
|
|
192
|
-
e.sources.delete(this);
|
|
193
|
-
this.observers.clear();
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Get debug information about this signal
|
|
197
|
-
*/
|
|
198
|
-
[Symbol.for("tachui.debug")]() {
|
|
199
|
-
return {
|
|
200
|
-
id: this.id,
|
|
201
|
-
type: this.type,
|
|
202
|
-
value: this._value,
|
|
203
|
-
observerCount: this.observers.size,
|
|
204
|
-
priority: u[this.priority],
|
|
205
|
-
debugName: this.debugName,
|
|
206
|
-
equalsFn: this.equalsFn.name || "anonymous"
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
toString() {
|
|
210
|
-
return `Signal(${this.options.debugName || this.id}): ${this._value}`;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
function p(t, e) {
|
|
214
|
-
const r = new P(t, e), s = r.getValue.bind(r);
|
|
215
|
-
s.peek = r.peek.bind(r);
|
|
216
|
-
const n = r.setValue.bind(r);
|
|
217
|
-
return Object.defineProperty(s, Symbol.for("tachui.signal"), {
|
|
218
|
-
value: r,
|
|
219
|
-
enumerable: !1
|
|
220
|
-
}), [s, n];
|
|
221
|
-
}
|
|
222
|
-
function G(t, e) {
|
|
223
|
-
return p(t, {
|
|
224
|
-
...e,
|
|
225
|
-
equals: y
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
function k(t, e) {
|
|
229
|
-
return p(t, {
|
|
230
|
-
...e,
|
|
231
|
-
equals: b
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
function J(t) {
|
|
235
|
-
return t[Symbol.for("tachui.signal")] || null;
|
|
236
|
-
}
|
|
237
|
-
function K(t) {
|
|
238
|
-
return typeof t == "function" && Symbol.for("tachui.signal") in t;
|
|
239
|
-
}
|
|
240
|
-
function Q() {
|
|
241
|
-
c.getInstance().flushSync();
|
|
242
|
-
}
|
|
243
|
-
function X() {
|
|
244
|
-
return c.getInstance().getPerformanceMetrics();
|
|
245
|
-
}
|
|
246
|
-
let S = !0, i = {
|
|
247
|
-
signalsConverted: 0,
|
|
248
|
-
computedsConverted: 0,
|
|
249
|
-
effectsConverted: 0,
|
|
250
|
-
errorsFixed: 0
|
|
251
|
-
};
|
|
252
|
-
function Y(t) {
|
|
253
|
-
return S && console.warn(
|
|
254
|
-
"createLegacySignal is deprecated. Use createSignal() or createEnhancedSignal() instead. See: https://docs.tachui.dev/migration/reactive-system"
|
|
255
|
-
), i.signalsConverted++, C(t);
|
|
256
|
-
}
|
|
257
|
-
function D(t, e) {
|
|
258
|
-
const r = t[0]();
|
|
259
|
-
let s;
|
|
260
|
-
switch (e?.equals) {
|
|
261
|
-
case "deep":
|
|
262
|
-
s = y;
|
|
263
|
-
break;
|
|
264
|
-
case "shallow":
|
|
265
|
-
s = b;
|
|
266
|
-
break;
|
|
267
|
-
case "custom":
|
|
268
|
-
s = e.customEquals;
|
|
269
|
-
break;
|
|
270
|
-
default:
|
|
271
|
-
s = void 0;
|
|
272
|
-
}
|
|
273
|
-
return i.signalsConverted++, p(r, {
|
|
274
|
-
equals: s,
|
|
275
|
-
priority: e?.priority,
|
|
276
|
-
debugName: e?.debugName
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
function Z(t) {
|
|
280
|
-
const e = t(), r = [];
|
|
281
|
-
let s = "enhanced";
|
|
282
|
-
return typeof e == "object" && e !== null && (Array.isArray(e) ? (r.push("Consider using deepEquals for array values to detect mutations"), r.push("Use createDeepSignal() for automatic deep comparison"), s = "deep") : (r.push("Consider using shallowEquals for object values with simple properties"), r.push("Use createShallowSignal() for automatic shallow comparison"), s = "shallow")), r.length === 0 && r.push("Signal looks good for reference equality"), { recommendations: r, suggestedMigration: s };
|
|
283
|
-
}
|
|
284
|
-
function ee(t) {
|
|
285
|
-
const e = {
|
|
286
|
-
signals: [],
|
|
287
|
-
computeds: [],
|
|
288
|
-
effects: [],
|
|
289
|
-
cleanup: () => {
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
t.signals && (e.signals = t.signals.map(
|
|
293
|
-
({ original: s, options: n }) => D(s, n)
|
|
294
|
-
)), t.computeds && (e.computeds = t.computeds.map(({ original: s, options: n }) => (i.computedsConverted++, w(s, n))));
|
|
295
|
-
const r = [];
|
|
296
|
-
return t.effects && t.effects.forEach(({ original: s, options: n }) => {
|
|
297
|
-
i.effectsConverted++;
|
|
298
|
-
const f = l(s, n);
|
|
299
|
-
r.push(f);
|
|
300
|
-
}), e.cleanup = () => {
|
|
301
|
-
r.forEach((s) => s());
|
|
302
|
-
}, e;
|
|
303
|
-
}
|
|
304
|
-
function te(t) {
|
|
305
|
-
const e = [];
|
|
306
|
-
let r = t;
|
|
307
|
-
return [
|
|
308
|
-
{
|
|
309
|
-
from: /createSignal\(/g,
|
|
310
|
-
to: "createEnhancedSignal(",
|
|
311
|
-
description: "Upgraded createSignal to createEnhancedSignal"
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
from: /createComputed\(([^,]+)\)/g,
|
|
315
|
-
to: "createComputed($1, { debugName: 'computed' })",
|
|
316
|
-
description: "Added debug name to createComputed"
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
from: /createEffect\(([^,]+)\)/g,
|
|
320
|
-
to: "createEnhancedEffect($1, { debugName: 'effect' })",
|
|
321
|
-
description: "Upgraded createEffect to createEnhancedEffect with debug name"
|
|
322
|
-
}
|
|
323
|
-
].forEach((n) => {
|
|
324
|
-
r.match(n.from) && (r = r.replace(n.from, n.to), e.push(n.description));
|
|
325
|
-
}), { newCode: r, transformations: e };
|
|
326
|
-
}
|
|
327
|
-
function U() {
|
|
328
|
-
const t = c.getInstance(), e = t.getPerformanceMetrics(), r = [];
|
|
329
|
-
let s = 100;
|
|
330
|
-
return e.errorCount > 0 && (r.push(`Fix ${e.errorCount} reactive errors for better stability`), s -= e.errorCount * 5), e.averageUpdateTime > 16 && (r.push("Update times exceed 16ms - consider optimizing computations"), s -= 20), e.totalNodes > 1e3 && (r.push("High number of reactive nodes - consider batching updates"), s -= 10), {
|
|
331
|
-
scheduler: t.getDebugInfo(),
|
|
332
|
-
signals: {
|
|
333
|
-
total: i.signalsConverted,
|
|
334
|
-
recommendations: ["Use appropriate equality functions for your data types"]
|
|
335
|
-
},
|
|
336
|
-
computeds: {
|
|
337
|
-
total: i.computedsConverted,
|
|
338
|
-
recommendations: ["Add error recovery for critical computations"]
|
|
339
|
-
},
|
|
340
|
-
effects: {
|
|
341
|
-
total: i.effectsConverted,
|
|
342
|
-
recommendations: ["Use appropriate priorities for different effect types"]
|
|
343
|
-
},
|
|
344
|
-
overallScore: Math.max(0, s),
|
|
345
|
-
recommendations: r
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
function re(t = { verbose: !1 }) {
|
|
349
|
-
const e = c.getInstance(), r = (n) => {
|
|
350
|
-
console.error("🔥 Reactive System Error:", n), i.errorsFixed++;
|
|
351
|
-
}, s = e.onError(r);
|
|
352
|
-
return t.verbose && (console.log("🔍 Reactive debugging enabled"), console.log("📊 Migration stats:", i)), () => {
|
|
353
|
-
s(), t.verbose && console.log("🔍 Reactive debugging disabled");
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
function se() {
|
|
357
|
-
return { ...i };
|
|
358
|
-
}
|
|
359
|
-
function ne() {
|
|
360
|
-
i = {
|
|
361
|
-
signalsConverted: 0,
|
|
362
|
-
computedsConverted: 0,
|
|
363
|
-
effectsConverted: 0,
|
|
364
|
-
errorsFixed: 0
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
function ie(t) {
|
|
368
|
-
S = t;
|
|
369
|
-
}
|
|
370
|
-
function oe() {
|
|
371
|
-
const t = U();
|
|
372
|
-
return `
|
|
373
|
-
# TachUI Reactive System Migration Report
|
|
374
|
-
|
|
375
|
-
## Statistics
|
|
376
|
-
- Signals converted: ${i.signalsConverted}
|
|
377
|
-
- Computeds converted: ${i.computedsConverted}
|
|
378
|
-
- Effects converted: ${i.effectsConverted}
|
|
379
|
-
- Errors fixed: ${i.errorsFixed}
|
|
380
|
-
|
|
381
|
-
## Performance Score: ${t.overallScore}/100
|
|
382
|
-
|
|
383
|
-
## Recommendations
|
|
384
|
-
${t.recommendations.map((e) => `- ${e}`).join(`
|
|
385
|
-
`)}
|
|
386
|
-
|
|
387
|
-
## Generated: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
388
|
-
`;
|
|
389
|
-
}
|
|
390
|
-
function ae() {
|
|
391
|
-
return h() !== null;
|
|
392
|
-
}
|
|
393
|
-
function M(t) {
|
|
394
|
-
return q(null, t);
|
|
395
|
-
}
|
|
396
|
-
function ce(t) {
|
|
397
|
-
return M(() => F(t));
|
|
398
|
-
}
|
|
399
|
-
function ue() {
|
|
400
|
-
let t = h();
|
|
401
|
-
if (!t) return null;
|
|
402
|
-
for (; t.parent; )
|
|
403
|
-
t = t.parent;
|
|
404
|
-
return t;
|
|
405
|
-
}
|
|
406
|
-
function le() {
|
|
407
|
-
const t = [];
|
|
408
|
-
let e = h();
|
|
409
|
-
for (; e; )
|
|
410
|
-
t.push(e), e = e.parent;
|
|
411
|
-
return t;
|
|
412
|
-
}
|
|
1
|
+
import { T as t, c as s, a as r, b as c, e as i, f as n, d as l, g as o, h as g, o as u, s as f, i as d, j as h, k as E } from "../scheduler-DppMK9mR.js";
|
|
2
|
+
import { R as m, M as p, U as R, q as y, w as q, x as v, a as C, b, y as w, n as x, z as M, c as P, A as T, B as O, E as L, I as U, f as I, J as j, p as k, v as z, g as B, K as D, d as W, i as A, F as G, o as F, L as H, G as J, H as K, u as N } from "../theme-CRLPHryV.js";
|
|
3
|
+
import { c as V, b as X, a as Y, d as Z } from "../effect-BsW3fy1q.js";
|
|
4
|
+
import { p as $, q as ee, i as ae, A as te, c as se, a as re, j as ce, b as ie, r as ne, d as le, s as oe, e as ge, k as ue, F as fe, G as de, f as he, t as Ee, g as Se, l as me, h as pe, m as Re, u as ye, B as qe, C as ve, n as Ce, o as be, D as we, v as xe, w as Me, x as Pe, y as Te, E as Oe, z as Le } from "../signal-list-07gNXGiW.js";
|
|
413
5
|
export {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
6
|
+
m as ReactiveError,
|
|
7
|
+
p as ReactiveScheduler,
|
|
8
|
+
t as TaskPriority,
|
|
9
|
+
R as UpdatePriority,
|
|
10
|
+
$ as analyzeReactivePerformance,
|
|
11
|
+
ee as analyzeSignalUsage,
|
|
12
|
+
y as batch,
|
|
13
|
+
q as combineEquals,
|
|
14
|
+
v as createArrayEquals,
|
|
15
|
+
s as createCleanupGroup,
|
|
16
|
+
C as createComputed,
|
|
17
|
+
ae as createDeepSignal,
|
|
18
|
+
te as createDetachedRoot,
|
|
19
|
+
V as createEffect,
|
|
20
|
+
se as createEffectBatch,
|
|
21
|
+
re as createEnhancedEffect,
|
|
22
|
+
ce as createEnhancedSignal,
|
|
23
|
+
r as createEventListener,
|
|
24
|
+
ie as createHighPriorityEffect,
|
|
25
|
+
c as createInterval,
|
|
26
|
+
ne as createLegacySignal,
|
|
27
|
+
le as createLowPriorityEffect,
|
|
28
|
+
b as createMemo,
|
|
437
29
|
oe as createMigrationReport,
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
30
|
+
w as createObjectEquals,
|
|
31
|
+
X as createOnceEffect,
|
|
32
|
+
Y as createRenderEffect,
|
|
33
|
+
ge as createResilientEffect,
|
|
34
|
+
i as createResource,
|
|
35
|
+
x as createRoot,
|
|
36
|
+
M as createSelectorEquals,
|
|
37
|
+
ue as createShallowSignal,
|
|
38
|
+
P as createSignal,
|
|
39
|
+
fe as createSignalList,
|
|
40
|
+
de as createSignalListControls,
|
|
41
|
+
Z as createSyncEffect,
|
|
42
|
+
n as createTimeout,
|
|
43
|
+
he as createWatchEffect,
|
|
44
|
+
T as debugEquals,
|
|
45
|
+
O as deepEquals,
|
|
46
|
+
L as defaultEquals,
|
|
47
|
+
U as detectSystemTheme,
|
|
48
|
+
l as dispose,
|
|
49
|
+
Ee as enableReactiveDebugging,
|
|
50
|
+
o as enableScheduling,
|
|
51
|
+
Se as flushEffectUpdates,
|
|
52
|
+
me as flushSignalUpdates,
|
|
53
|
+
I as flushSync,
|
|
54
|
+
j as getCurrentTheme,
|
|
55
|
+
pe as getEffectPerformanceMetrics,
|
|
56
|
+
Re as getEnhancedSignalImpl,
|
|
57
|
+
ye as getMigrationStats,
|
|
58
|
+
k as getOwner,
|
|
59
|
+
qe as getOwnerChain,
|
|
60
|
+
z as getReactiveContext,
|
|
61
|
+
ve as getRootOwner,
|
|
62
|
+
g as getScheduler,
|
|
63
|
+
B as getSignalImpl,
|
|
64
|
+
Ce as getSignalPerformanceMetrics,
|
|
65
|
+
D as getThemeSignal,
|
|
66
|
+
W as isComputed,
|
|
67
|
+
be as isEnhancedSignal,
|
|
68
|
+
we as isReactiveContext,
|
|
69
|
+
A as isSignal,
|
|
70
|
+
G as jsonEquals,
|
|
71
|
+
xe as migrateBatch,
|
|
72
|
+
Me as migrateReactiveCode,
|
|
73
|
+
Pe as migrateToEnhancedSignal,
|
|
74
|
+
u as onCleanup,
|
|
75
|
+
Te as resetMigrationStats,
|
|
76
|
+
Oe as runOutsideReactiveContext,
|
|
77
|
+
F as runWithOwner,
|
|
78
|
+
f as scheduleIdle,
|
|
79
|
+
d as scheduleUpdate,
|
|
80
|
+
h as scheduleWithPriority,
|
|
81
|
+
Le as setMigrationWarnings,
|
|
82
|
+
E as setScheduler,
|
|
83
|
+
H as setTheme,
|
|
84
|
+
J as shallowEquals,
|
|
85
|
+
K as structuralEquals,
|
|
86
|
+
N as untrack
|
|
493
87
|
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fine-Grained Reactive Lists
|
|
3
|
+
*
|
|
4
|
+
* Provides high-performance list management by separating array structure
|
|
5
|
+
* from item data. Each item gets its own signal, enabling surgical updates
|
|
6
|
+
* without triggering full reconciliation.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Create a signal list with a key function
|
|
11
|
+
* const [items, list] = createSignalList(
|
|
12
|
+
* [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }],
|
|
13
|
+
* item => item.id
|
|
14
|
+
* )
|
|
15
|
+
*
|
|
16
|
+
* // In your component, track only the IDs (array structure)
|
|
17
|
+
* const ids = list.ids()
|
|
18
|
+
*
|
|
19
|
+
* // Render each row with its own reactive data
|
|
20
|
+
* ids.map(id => {
|
|
21
|
+
* const getData = list.get(id)
|
|
22
|
+
* return h('div', null, () => getData().name) // Reactive text
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* // Update individual item - only that item re-renders
|
|
26
|
+
* list.update(1, { id: 1, name: 'Alice Updated' })
|
|
27
|
+
*
|
|
28
|
+
* // Replace all items - still surgical updates
|
|
29
|
+
* list.set([{ id: 1, name: 'Alice New' }, { id: 3, name: 'Charlie' }])
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export type SignalListKeyFn<T, K extends PropertyKey = PropertyKey> = (item: T) => K;
|
|
33
|
+
export interface SignalListControls<T, K extends PropertyKey = PropertyKey> {
|
|
34
|
+
/**
|
|
35
|
+
* Get array of item keys/IDs. Track this in components to know which items exist.
|
|
36
|
+
* When this changes, component re-renders with new list structure.
|
|
37
|
+
*/
|
|
38
|
+
ids: () => K[];
|
|
39
|
+
/**
|
|
40
|
+
* Get reactive getter for a specific item by key.
|
|
41
|
+
* Returns a function that reactively returns the current item data.
|
|
42
|
+
*/
|
|
43
|
+
get: (key: K) => () => T;
|
|
44
|
+
/**
|
|
45
|
+
* Update a single item by key. Only triggers reactive updates for that item.
|
|
46
|
+
*/
|
|
47
|
+
update: (key: K, item: T) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Replace entire list. Updates existing items surgically, adds new ones, removes old ones.
|
|
50
|
+
*/
|
|
51
|
+
set: (items: T[]) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all items.
|
|
54
|
+
*/
|
|
55
|
+
clear: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* Remove a specific item by key.
|
|
58
|
+
*/
|
|
59
|
+
remove: (key: K) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Reorder the list using an array of existing keys without touching item data.
|
|
62
|
+
*/
|
|
63
|
+
reorder: (ids: K[]) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Get all current items as a plain array (non-reactive).
|
|
66
|
+
*/
|
|
67
|
+
getAll: () => T[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a fine-grained reactive list where each item has its own signal.
|
|
71
|
+
*
|
|
72
|
+
* This enables surgical updates to individual items without triggering
|
|
73
|
+
* full component re-renders or reconciliation. The component tracks only
|
|
74
|
+
* the array of IDs (structure), while each item's data is tracked independently.
|
|
75
|
+
*
|
|
76
|
+
* **Performance Benefits**:
|
|
77
|
+
* - Updating 1 item in 1,000: 175x faster (no reconciliation)
|
|
78
|
+
* - Replacing all 1,000 items: 242x faster (surgical signal updates)
|
|
79
|
+
*
|
|
80
|
+
* **When to use**:
|
|
81
|
+
* - Large lists (100+ items) with frequent updates
|
|
82
|
+
* - Updates to individual items (e.g., editing one row)
|
|
83
|
+
* - Batch updates to item properties (e.g., marking all as read)
|
|
84
|
+
*
|
|
85
|
+
* **When NOT to use**:
|
|
86
|
+
* - Small lists (<20 items) - overhead not worth it
|
|
87
|
+
* - Lists that are fully replaced frequently - use regular createSignal
|
|
88
|
+
* - Lists where you never update individual items
|
|
89
|
+
*
|
|
90
|
+
* @param initialItems - Initial array of items
|
|
91
|
+
* @param keyFn - Function to extract unique key from each item (e.g., item => item.id)
|
|
92
|
+
* @returns Tuple of [ids signal, list controls]
|
|
93
|
+
*/
|
|
94
|
+
export declare function createSignalList<T, K extends PropertyKey = PropertyKey>(initialItems: T[], keyFn: SignalListKeyFn<T, K>): [() => T[], SignalListControls<T, K>];
|
|
95
|
+
/**
|
|
96
|
+
* Helper to create list controls without the reactive getter.
|
|
97
|
+
* Useful when you always want to track structure, never all items.
|
|
98
|
+
*/
|
|
99
|
+
export declare function createSignalListControls<T, K extends PropertyKey = PropertyKey>(initialItems: T[], keyFn: SignalListKeyFn<T, K>): SignalListControls<T, K>;
|
|
100
|
+
//# sourceMappingURL=signal-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-list.d.ts","sourceRoot":"","sources":["../../src/reactive/signal-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,CACpE,IAAI,EAAE,CAAC,KACJ,CAAC,CAAA;AAEN,MAAM,WAAW,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW;IACxE;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC,EAAE,CAAA;IAEd;;;OAGG;IACH,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,CAAA;IAExB;;OAEG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;IAEjC;;OAEG;IACH,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAA;IAEzB;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAA;IAEjB;;OAEG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAA;IAExB;;OAEG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,IAAI,CAAA;IAE3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EACrE,YAAY,EAAE,CAAC,EAAE,EACjB,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3B,CAAC,MAAM,CAAC,EAAE,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CA+LvC;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAC7E,YAAY,EAAE,CAAC,EAAE,EACjB,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3B,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAG1B"}
|