@tachui/core 0.8.1-alpha → 0.8.5-alpha
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 +40 -2
- 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-CYpEQquE.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-CECyfUOE.js} +80 -68
- package/dist/{component-base-x2XmHFjy.js → component-base-CJ__jTlr.js} +9 -7
- package/dist/component-context-B6qX_Qsg.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-_tF1eMvy.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-DGmdACI2.js} +3 -3
- package/dist/enhanced-renderer-Bwqsh8Ku.js +172 -0
- package/dist/essential.js +427 -394
- package/dist/{index-DIvMCJQO.js → factories-Co2Lv2kJ.js} +13 -13
- package/dist/factory-D7jAY5Kn.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-DeLasj54.js +446 -0
- package/dist/index-JQ1sW1SK.js +2049 -0
- package/dist/index-X8MVY78C.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 +94 -93
- package/dist/minimal.js +114 -108
- package/dist/modifiers/alignment.d.ts +5 -0
- package/dist/modifiers/alignment.d.ts.map +1 -0
- package/dist/modifiers/base.d.ts +6 -7
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +24 -16
- 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/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-DepiqSgg.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-Cqmbiyx0.js +175 -0
- package/dist/reactive/cleanup.d.ts.map +1 -1
- package/dist/reactive/computed.d.ts +1 -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-DI_8ykMk.js +169 -0
- package/dist/signal-list-BdpxSodS.js +525 -0
- package/dist/state/index.js +319 -0
- package/dist/theme-BFaKUcjZ.js +677 -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 +51 -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
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { l as I, U as m, L as p, k as $, F as q, B as A, A as x, c as y, a as L, o as E, r as z, n as V } from "./theme-BFaKUcjZ.js";
|
|
2
|
+
import { ComputationState as S } from "@tachui/types/reactive";
|
|
3
|
+
var B = Object.defineProperty, H = (t, e, r) => e in t ? B(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, l = (t, e, r) => H(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
let T = 0;
|
|
5
|
+
class W {
|
|
6
|
+
constructor(e, r = {}) {
|
|
7
|
+
this.effectFn = e, l(this, "id", ++T), l(this, "type", "effect"), l(this, "priority"), l(this, "sources", /* @__PURE__ */ new Set()), l(this, "observers", /* @__PURE__ */ new Set()), l(this, "isDisposed", !1), l(this, "cleanupFn"), l(this, "options"), l(this, "owner"), this.priority = r.priority ?? m.Normal, this.options = r, this.owner = I(), r.fireImmediately !== !1 && this.execute();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Notify method called by unified scheduler
|
|
11
|
+
*/
|
|
12
|
+
notify() {
|
|
13
|
+
this.isDisposed || this.execute();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Execute the effect with proper error handling
|
|
17
|
+
*/
|
|
18
|
+
execute() {
|
|
19
|
+
if (this.isDisposed) return;
|
|
20
|
+
if (this.cleanupFn) {
|
|
21
|
+
try {
|
|
22
|
+
this.cleanupFn();
|
|
23
|
+
} catch (s) {
|
|
24
|
+
console.error("Effect cleanup error:", s);
|
|
25
|
+
}
|
|
26
|
+
this.cleanupFn = void 0;
|
|
27
|
+
}
|
|
28
|
+
for (const s of this.sources)
|
|
29
|
+
"removeObserver" in s && typeof s.removeObserver == "function" ? s.removeObserver(this) : "observers" in s && s.observers instanceof Set && s.observers.delete(this);
|
|
30
|
+
this.sources.clear();
|
|
31
|
+
const e = $(), r = this.setCurrentComputation || (() => {
|
|
32
|
+
});
|
|
33
|
+
r(this);
|
|
34
|
+
try {
|
|
35
|
+
const s = this.effectFn();
|
|
36
|
+
typeof s == "function" && (this.cleanupFn = s);
|
|
37
|
+
} catch (s) {
|
|
38
|
+
if (this.options.onError)
|
|
39
|
+
try {
|
|
40
|
+
this.options.onError(s);
|
|
41
|
+
} catch (i) {
|
|
42
|
+
throw console.error("Effect error handler threw error:", i), s;
|
|
43
|
+
}
|
|
44
|
+
else
|
|
45
|
+
throw console.error(`Effect ${this.options.debugName || this.id} threw error:`, s), s;
|
|
46
|
+
} finally {
|
|
47
|
+
r(e);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Complete cleanup for memory management
|
|
52
|
+
*/
|
|
53
|
+
cleanup() {
|
|
54
|
+
if (this.isDisposed = !0, this.cleanupFn) {
|
|
55
|
+
try {
|
|
56
|
+
this.cleanupFn();
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.error("Effect cleanup error:", e);
|
|
59
|
+
}
|
|
60
|
+
this.cleanupFn = void 0;
|
|
61
|
+
}
|
|
62
|
+
for (const e of this.sources)
|
|
63
|
+
"removeObserver" in e && typeof e.removeObserver == "function" ? e.removeObserver(this) : "observers" in e && e.observers instanceof Set && e.observers.delete(this);
|
|
64
|
+
if (this.sources.clear(), this.owner?.cleanups) {
|
|
65
|
+
const e = this.owner.cleanups.indexOf(this.cleanup.bind(this));
|
|
66
|
+
e >= 0 && this.owner.cleanups.splice(e, 1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Dispose the effect (alias for cleanup)
|
|
71
|
+
*/
|
|
72
|
+
dispose() {
|
|
73
|
+
this.cleanup();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if effect is disposed
|
|
77
|
+
*/
|
|
78
|
+
get disposed() {
|
|
79
|
+
return this.isDisposed;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Debug information
|
|
83
|
+
*/
|
|
84
|
+
[Symbol.for("tachui.debug")]() {
|
|
85
|
+
return {
|
|
86
|
+
id: this.id,
|
|
87
|
+
type: this.type,
|
|
88
|
+
priority: m[this.priority],
|
|
89
|
+
debugName: this.options.debugName,
|
|
90
|
+
disposed: this.isDisposed,
|
|
91
|
+
sourceCount: this.sources.size,
|
|
92
|
+
hasCleanup: !!this.cleanupFn
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
toString() {
|
|
96
|
+
return `Effect(${this.options.debugName || this.id})`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function v(t, e) {
|
|
100
|
+
const r = new W(t, e), s = I();
|
|
101
|
+
return s && s.cleanups.push(() => r.cleanup()), () => r.cleanup();
|
|
102
|
+
}
|
|
103
|
+
function ie(t, e) {
|
|
104
|
+
return v(t, { ...e, priority: m.High });
|
|
105
|
+
}
|
|
106
|
+
function ae(t, e) {
|
|
107
|
+
return v(t, { ...e, priority: m.Low });
|
|
108
|
+
}
|
|
109
|
+
function ce(t, e) {
|
|
110
|
+
return v(t, { ...e, fireImmediately: !1 });
|
|
111
|
+
}
|
|
112
|
+
function ue(t, e, r = 3, s) {
|
|
113
|
+
let i = 0;
|
|
114
|
+
const d = () => {
|
|
115
|
+
try {
|
|
116
|
+
return t();
|
|
117
|
+
} catch (h) {
|
|
118
|
+
if (i++, e && i <= r && e(h, i)) {
|
|
119
|
+
setTimeout(() => d(), i * 100);
|
|
120
|
+
return;
|
|
121
|
+
} else
|
|
122
|
+
throw h;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return v(d, {
|
|
126
|
+
...s,
|
|
127
|
+
debugName: `${s?.debugName || "effect"}(resilient)`
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function le(t) {
|
|
131
|
+
const e = t.map(({ fn: r, options: s }) => v(r, s));
|
|
132
|
+
return () => {
|
|
133
|
+
e.forEach((r) => r());
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function fe() {
|
|
137
|
+
return p.getInstance().getPerformanceMetrics();
|
|
138
|
+
}
|
|
139
|
+
function de() {
|
|
140
|
+
p.getInstance().flushSync();
|
|
141
|
+
}
|
|
142
|
+
var j = Object.defineProperty, k = (t, e, r) => e in t ? j(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, f = (t, e, r) => k(t, typeof e != "symbol" ? e + "" : e, r);
|
|
143
|
+
let G = 0;
|
|
144
|
+
class K {
|
|
145
|
+
constructor(e, r = {}) {
|
|
146
|
+
f(this, "id", ++G), f(this, "type", "signal"), f(this, "priority"), f(this, "observers", /* @__PURE__ */ new Set()), f(this, "_value"), f(this, "scheduler", p.getInstance()), f(this, "equalsFn"), f(this, "debugName"), f(this, "options"), this._value = e, this.options = r, this.priority = r.priority ?? m.Normal, this.equalsFn = r.equals ?? A, this.debugName = r.debugName;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get the current value and track dependency
|
|
150
|
+
*/
|
|
151
|
+
getValue() {
|
|
152
|
+
const e = $();
|
|
153
|
+
return e && e.state !== S.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get the current value without tracking dependency
|
|
157
|
+
*/
|
|
158
|
+
peek() {
|
|
159
|
+
return this._value;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Set a new value using custom equality function
|
|
163
|
+
*/
|
|
164
|
+
setValue(e) {
|
|
165
|
+
const r = typeof e == "function" ? e(this._value) : e;
|
|
166
|
+
if (!this.equalsFn(r, this._value)) {
|
|
167
|
+
const s = this._value;
|
|
168
|
+
this._value = r, process.env.NODE_ENV === "development" && this.debugName && console.debug(`[Signal:${this.debugName}] ${s} -> ${r}`), this.scheduler.schedule(this);
|
|
169
|
+
}
|
|
170
|
+
return r;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Notify all observers (called by scheduler)
|
|
174
|
+
*/
|
|
175
|
+
notify() {
|
|
176
|
+
for (const e of this.observers)
|
|
177
|
+
e.state !== S.Disposed && (e.state = S.Dirty, "type" in e && "priority" in e && this.scheduler.schedule(e));
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Remove an observer (cleanup)
|
|
181
|
+
*/
|
|
182
|
+
removeObserver(e) {
|
|
183
|
+
this.observers.delete(e);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Complete cleanup for memory management
|
|
187
|
+
*/
|
|
188
|
+
cleanup() {
|
|
189
|
+
for (const e of this.observers)
|
|
190
|
+
e.sources.delete(this);
|
|
191
|
+
this.observers.clear();
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get debug information about this signal
|
|
195
|
+
*/
|
|
196
|
+
[Symbol.for("tachui.debug")]() {
|
|
197
|
+
return {
|
|
198
|
+
id: this.id,
|
|
199
|
+
type: this.type,
|
|
200
|
+
value: this._value,
|
|
201
|
+
observerCount: this.observers.size,
|
|
202
|
+
priority: m[this.priority],
|
|
203
|
+
debugName: this.debugName,
|
|
204
|
+
equalsFn: this.equalsFn.name || "anonymous"
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
toString() {
|
|
208
|
+
return `Signal(${this.options.debugName || this.id}): ${this._value}`;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function C(t, e) {
|
|
212
|
+
const r = new K(t, e), s = r.getValue.bind(r);
|
|
213
|
+
s.peek = r.peek.bind(r);
|
|
214
|
+
const i = r.setValue.bind(r);
|
|
215
|
+
return Object.defineProperty(s, Symbol.for("tachui.signal"), {
|
|
216
|
+
value: r,
|
|
217
|
+
enumerable: !1
|
|
218
|
+
}), [s, i];
|
|
219
|
+
}
|
|
220
|
+
function he(t, e) {
|
|
221
|
+
return C(t, {
|
|
222
|
+
...e,
|
|
223
|
+
equals: x
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function pe(t, e) {
|
|
227
|
+
return C(t, {
|
|
228
|
+
...e,
|
|
229
|
+
equals: q
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function ge(t) {
|
|
233
|
+
return t[Symbol.for("tachui.signal")] || null;
|
|
234
|
+
}
|
|
235
|
+
function me(t) {
|
|
236
|
+
return typeof t == "function" && Symbol.for("tachui.signal") in t;
|
|
237
|
+
}
|
|
238
|
+
function ve() {
|
|
239
|
+
p.getInstance().flushSync();
|
|
240
|
+
}
|
|
241
|
+
function be() {
|
|
242
|
+
return p.getInstance().getPerformanceMetrics();
|
|
243
|
+
}
|
|
244
|
+
let O = !0, c = {
|
|
245
|
+
signalsConverted: 0,
|
|
246
|
+
computedsConverted: 0,
|
|
247
|
+
effectsConverted: 0,
|
|
248
|
+
errorsFixed: 0
|
|
249
|
+
};
|
|
250
|
+
function ye(t) {
|
|
251
|
+
return O && console.warn(
|
|
252
|
+
"createLegacySignal is deprecated. Use createSignal() or createEnhancedSignal() instead. See: https://docs.tachui.dev/migration/reactive-system"
|
|
253
|
+
), c.signalsConverted++, y(t);
|
|
254
|
+
}
|
|
255
|
+
function J(t, e) {
|
|
256
|
+
const r = t[0]();
|
|
257
|
+
let s;
|
|
258
|
+
switch (e?.equals) {
|
|
259
|
+
case "deep":
|
|
260
|
+
s = x;
|
|
261
|
+
break;
|
|
262
|
+
case "shallow":
|
|
263
|
+
s = q;
|
|
264
|
+
break;
|
|
265
|
+
case "custom":
|
|
266
|
+
s = e.customEquals;
|
|
267
|
+
break;
|
|
268
|
+
default:
|
|
269
|
+
s = void 0;
|
|
270
|
+
}
|
|
271
|
+
return c.signalsConverted++, C(r, {
|
|
272
|
+
equals: s,
|
|
273
|
+
priority: e?.priority,
|
|
274
|
+
debugName: e?.debugName
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function Se(t) {
|
|
278
|
+
const e = t(), r = [];
|
|
279
|
+
let s = "enhanced";
|
|
280
|
+
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 };
|
|
281
|
+
}
|
|
282
|
+
function Ee(t) {
|
|
283
|
+
const e = {
|
|
284
|
+
signals: [],
|
|
285
|
+
computeds: [],
|
|
286
|
+
effects: [],
|
|
287
|
+
cleanup: () => {
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
t.signals && (e.signals = t.signals.map(
|
|
291
|
+
({ original: s, options: i }) => J(s, i)
|
|
292
|
+
)), t.computeds && (e.computeds = t.computeds.map(({ original: s, options: i }) => (c.computedsConverted++, L(s, i))));
|
|
293
|
+
const r = [];
|
|
294
|
+
return t.effects && t.effects.forEach(({ original: s, options: i }) => {
|
|
295
|
+
c.effectsConverted++;
|
|
296
|
+
const d = v(s, i);
|
|
297
|
+
r.push(d);
|
|
298
|
+
}), e.cleanup = () => {
|
|
299
|
+
r.forEach((s) => s());
|
|
300
|
+
}, e;
|
|
301
|
+
}
|
|
302
|
+
function Ce(t) {
|
|
303
|
+
const e = [];
|
|
304
|
+
let r = t;
|
|
305
|
+
return [
|
|
306
|
+
{
|
|
307
|
+
from: /createSignal\(/g,
|
|
308
|
+
to: "createEnhancedSignal(",
|
|
309
|
+
description: "Upgraded createSignal to createEnhancedSignal"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
from: /createComputed\(([^,]+)\)/g,
|
|
313
|
+
to: "createComputed($1, { debugName: 'computed' })",
|
|
314
|
+
description: "Added debug name to createComputed"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
from: /createEffect\(([^,]+)\)/g,
|
|
318
|
+
to: "createEnhancedEffect($1, { debugName: 'effect' })",
|
|
319
|
+
description: "Upgraded createEffect to createEnhancedEffect with debug name"
|
|
320
|
+
}
|
|
321
|
+
].forEach((i) => {
|
|
322
|
+
r.match(i.from) && (r = r.replace(i.from, i.to), e.push(i.description));
|
|
323
|
+
}), { newCode: r, transformations: e };
|
|
324
|
+
}
|
|
325
|
+
function Q() {
|
|
326
|
+
const t = p.getInstance(), e = t.getPerformanceMetrics(), r = [];
|
|
327
|
+
let s = 100;
|
|
328
|
+
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), {
|
|
329
|
+
scheduler: t.getDebugInfo(),
|
|
330
|
+
signals: {
|
|
331
|
+
total: c.signalsConverted,
|
|
332
|
+
recommendations: ["Use appropriate equality functions for your data types"]
|
|
333
|
+
},
|
|
334
|
+
computeds: {
|
|
335
|
+
total: c.computedsConverted,
|
|
336
|
+
recommendations: ["Add error recovery for critical computations"]
|
|
337
|
+
},
|
|
338
|
+
effects: {
|
|
339
|
+
total: c.effectsConverted,
|
|
340
|
+
recommendations: ["Use appropriate priorities for different effect types"]
|
|
341
|
+
},
|
|
342
|
+
overallScore: Math.max(0, s),
|
|
343
|
+
recommendations: r
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function we(t = { verbose: !1 }) {
|
|
347
|
+
const e = p.getInstance(), r = (i) => {
|
|
348
|
+
console.error("🔥 Reactive System Error:", i), c.errorsFixed++;
|
|
349
|
+
}, s = e.onError(r);
|
|
350
|
+
return t.verbose && (console.log("🔍 Reactive debugging enabled"), console.log("📊 Migration stats:", c)), () => {
|
|
351
|
+
s(), t.verbose && console.log("🔍 Reactive debugging disabled");
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function Ne() {
|
|
355
|
+
return { ...c };
|
|
356
|
+
}
|
|
357
|
+
function _e() {
|
|
358
|
+
c = {
|
|
359
|
+
signalsConverted: 0,
|
|
360
|
+
computedsConverted: 0,
|
|
361
|
+
effectsConverted: 0,
|
|
362
|
+
errorsFixed: 0
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function Fe(t) {
|
|
366
|
+
O = t;
|
|
367
|
+
}
|
|
368
|
+
function Ie() {
|
|
369
|
+
const t = Q();
|
|
370
|
+
return `
|
|
371
|
+
# TachUI Reactive System Migration Report
|
|
372
|
+
|
|
373
|
+
## Statistics
|
|
374
|
+
- Signals converted: ${c.signalsConverted}
|
|
375
|
+
- Computeds converted: ${c.computedsConverted}
|
|
376
|
+
- Effects converted: ${c.effectsConverted}
|
|
377
|
+
- Errors fixed: ${c.errorsFixed}
|
|
378
|
+
|
|
379
|
+
## Performance Score: ${t.overallScore}/100
|
|
380
|
+
|
|
381
|
+
## Recommendations
|
|
382
|
+
${t.recommendations.map((e) => `- ${e}`).join(`
|
|
383
|
+
`)}
|
|
384
|
+
|
|
385
|
+
## Generated: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
386
|
+
`;
|
|
387
|
+
}
|
|
388
|
+
function $e() {
|
|
389
|
+
return E() !== null;
|
|
390
|
+
}
|
|
391
|
+
function X(t) {
|
|
392
|
+
return z(null, t);
|
|
393
|
+
}
|
|
394
|
+
function qe(t) {
|
|
395
|
+
return X(() => V(t));
|
|
396
|
+
}
|
|
397
|
+
function xe() {
|
|
398
|
+
let t = E();
|
|
399
|
+
if (!t) return null;
|
|
400
|
+
for (; t.parent; )
|
|
401
|
+
t = t.parent;
|
|
402
|
+
return t;
|
|
403
|
+
}
|
|
404
|
+
function Oe() {
|
|
405
|
+
const t = [];
|
|
406
|
+
let e = E();
|
|
407
|
+
for (; e; )
|
|
408
|
+
t.push(e), e = e.parent;
|
|
409
|
+
return t;
|
|
410
|
+
}
|
|
411
|
+
function Y(t, e) {
|
|
412
|
+
const r = /* @__PURE__ */ new Map(), [s, i] = y(t.map(e)), d = s, h = () => s.peek(), b = (o) => {
|
|
413
|
+
const n = h();
|
|
414
|
+
R(n, o) || i(o);
|
|
415
|
+
}, R = (o, n) => {
|
|
416
|
+
if (o.length !== n.length) return !1;
|
|
417
|
+
for (let a = 0; a < o.length; a++)
|
|
418
|
+
if (o[a] !== n[a]) return !1;
|
|
419
|
+
return !0;
|
|
420
|
+
};
|
|
421
|
+
t.forEach((o) => {
|
|
422
|
+
const n = e(o);
|
|
423
|
+
r.set(n, y(o));
|
|
424
|
+
});
|
|
425
|
+
const D = (o) => {
|
|
426
|
+
const n = r.get(o);
|
|
427
|
+
if (!n)
|
|
428
|
+
throw new Error(`SignalList: Item with key "${String(o)}" not found`);
|
|
429
|
+
return n[0];
|
|
430
|
+
}, P = (o, n) => {
|
|
431
|
+
const a = r.get(o);
|
|
432
|
+
if (a)
|
|
433
|
+
a[1](n);
|
|
434
|
+
else {
|
|
435
|
+
r.set(o, y(n));
|
|
436
|
+
const u = h();
|
|
437
|
+
b([...u, o]);
|
|
438
|
+
}
|
|
439
|
+
}, U = (o, n) => {
|
|
440
|
+
if (o.length !== n.length)
|
|
441
|
+
return !0;
|
|
442
|
+
const a = new Set(o), u = new Set(n);
|
|
443
|
+
if (a.size !== u.size)
|
|
444
|
+
return !0;
|
|
445
|
+
for (const N of n)
|
|
446
|
+
if (!a.has(N))
|
|
447
|
+
return !0;
|
|
448
|
+
return !1;
|
|
449
|
+
}, M = (o) => {
|
|
450
|
+
const n = o.map(e), a = new Set(n), u = h();
|
|
451
|
+
o.forEach((g) => {
|
|
452
|
+
const _ = e(g), F = r.get(_);
|
|
453
|
+
F ? F[1](g) : r.set(_, y(g));
|
|
454
|
+
}), u.forEach((g) => {
|
|
455
|
+
a.has(g) || r.delete(g);
|
|
456
|
+
}), U(u, n) && b(n);
|
|
457
|
+
}, w = (o, n) => {
|
|
458
|
+
const a = r.get(o);
|
|
459
|
+
if (!a) return null;
|
|
460
|
+
const u = a[0];
|
|
461
|
+
return u ? n ? u() : typeof u.peek == "function" ? u.peek() : u() : null;
|
|
462
|
+
};
|
|
463
|
+
return [
|
|
464
|
+
() => d().map((n) => w(n, !0)).filter((n) => n !== null),
|
|
465
|
+
{
|
|
466
|
+
ids: d,
|
|
467
|
+
get: D,
|
|
468
|
+
update: P,
|
|
469
|
+
set: M,
|
|
470
|
+
clear: () => {
|
|
471
|
+
r.clear(), b([]);
|
|
472
|
+
},
|
|
473
|
+
remove: (o) => {
|
|
474
|
+
r.delete(o);
|
|
475
|
+
const n = h();
|
|
476
|
+
b(n.filter((a) => a !== o));
|
|
477
|
+
},
|
|
478
|
+
reorder: (o) => {
|
|
479
|
+
if (!o.every((a) => r.has(a)))
|
|
480
|
+
throw new Error("[SignalList.reorder] Cannot reorder with unknown ids");
|
|
481
|
+
b([...o]);
|
|
482
|
+
},
|
|
483
|
+
getAll: () => h().map((n) => w(n, !1)).filter((n) => n !== null)
|
|
484
|
+
}
|
|
485
|
+
];
|
|
486
|
+
}
|
|
487
|
+
function Re(t, e) {
|
|
488
|
+
const [, r] = Y(t, e);
|
|
489
|
+
return r;
|
|
490
|
+
}
|
|
491
|
+
export {
|
|
492
|
+
qe as A,
|
|
493
|
+
Oe as B,
|
|
494
|
+
xe as C,
|
|
495
|
+
$e as D,
|
|
496
|
+
X as E,
|
|
497
|
+
Y as F,
|
|
498
|
+
Re as G,
|
|
499
|
+
v as a,
|
|
500
|
+
ie as b,
|
|
501
|
+
le as c,
|
|
502
|
+
ae as d,
|
|
503
|
+
ue as e,
|
|
504
|
+
ce as f,
|
|
505
|
+
de as g,
|
|
506
|
+
fe as h,
|
|
507
|
+
he as i,
|
|
508
|
+
C as j,
|
|
509
|
+
pe as k,
|
|
510
|
+
ve as l,
|
|
511
|
+
ge as m,
|
|
512
|
+
be as n,
|
|
513
|
+
me as o,
|
|
514
|
+
Q as p,
|
|
515
|
+
Se as q,
|
|
516
|
+
ye as r,
|
|
517
|
+
Ie as s,
|
|
518
|
+
we as t,
|
|
519
|
+
Ne as u,
|
|
520
|
+
Ee as v,
|
|
521
|
+
Ce as w,
|
|
522
|
+
J as x,
|
|
523
|
+
_e as y,
|
|
524
|
+
Fe as z
|
|
525
|
+
};
|