@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.
- package/dist/assets/index.js +41 -40
- package/dist/{binding-DCV5PKkK.js → binding-DCr-JHsC.js} +9 -9
- package/dist/build-tools/typegen-runner.d.ts +4 -0
- package/dist/build-tools/typegen-runner.d.ts.map +1 -1
- package/dist/cleanup-BR8UpYPX.js +61 -0
- package/dist/common.js +272 -277
- package/dist/{component-D-O9yq0P.js → component-BzvSm8rM.js} +19 -19
- package/dist/{component-base-C41K3NTe.js → component-base-Do2EdQkr.js} +32 -33
- package/dist/{component-context-B9HI2nZH.js → component-context-C7Y6Xu6h.js} +1 -1
- package/dist/components/index.js +1 -1
- package/dist/computed-CA4Cgtoe.js +407 -0
- package/dist/{concatenated-component-2Gzy5e2c.js → concatenated-component-CA54ng_j.js} +43 -44
- package/dist/css-classes/index.js +2 -2
- package/dist/{effect-BsW3fy1q.js → effect-DgNm6jk9.js} +3 -3
- package/dist/{enhanced-renderer-t9Ni2EEG.js → enhanced-renderer-D05CCloF.js} +26 -28
- package/dist/essential.js +276 -281
- package/dist/factories-Bz6LZlk6.js +653 -0
- package/dist/{factory-gqfMcmOy.js → factory-B1YXfgU1.js} +23 -29
- package/dist/full.d.ts +12 -0
- package/dist/full.d.ts.map +1 -0
- package/dist/full.js +436 -0
- package/dist/gradients/index.js +53 -53
- package/dist/hooks-w_FYPLjI.js +158 -0
- package/dist/{index-DL9Cys3t.js → index-CmQmIgPK.js} +220 -233
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +295 -300
- package/dist/minimal-prod.js +106 -108
- package/dist/minimal.js +97 -98
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +188 -181
- package/dist/modifiers/builder.js +1 -1
- package/dist/modifiers/factories.d.ts.map +1 -1
- package/dist/modifiers/index.js +22 -23
- package/dist/modifiers/registry.js +1 -1
- package/dist/{observed-object-p1CLdrFm.js → observed-object-DCoyucmV.js} +3 -3
- package/dist/optimization-D9t53vNJ.js +308 -0
- package/dist/{proxy-Cp0QUXME.js → proxy-B7ZIqGd0.js} +3 -3
- package/dist/reactive/index.js +87 -85
- package/dist/runtime/dom-bridge.js +15 -17
- package/dist/runtime/index.js +71 -71
- package/dist/runtime/renderer.js +10 -11
- package/dist/signal-BRoiFOO7.js +262 -0
- package/dist/{signal-list-07gNXGiW.js → signal-list-_Eid-N7_.js} +285 -176
- package/dist/state/index.js +43 -44
- package/dist/theme-D5-09a8N.js +26 -0
- package/dist/validation/index.js +24 -26
- package/dist/version.js +1 -1
- package/package.json +16 -3
- package/dist/factories-B3-rmvkB.js +0 -268
- package/dist/hooks-WGmpzYgD.js +0 -446
- package/dist/optimization-CbKNA9w4.js +0 -21
- package/dist/presets-B9x94uRn.js +0 -381
- package/dist/scheduler-DppMK9mR.js +0 -169
- package/dist/theme-CRLPHryV.js +0 -687
- package/dist/{index-JQ1sW1SK.js → index-7vhCZc7g.js} +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { U as v, m as g, s as $, j as H, h as M, c as V } from "./computed-CA4Cgtoe.js";
|
|
2
|
+
import { j as O, h as x, d as y, g as C, r as j, c as W } from "./signal-BRoiFOO7.js";
|
|
3
|
+
import { ComputationState as E } from "@tachui/types/reactive";
|
|
4
|
+
var B = Object.defineProperty, K = (t, e, r) => e in t ? B(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);
|
|
5
|
+
let G = 0;
|
|
6
|
+
class J {
|
|
6
7
|
constructor(e, r = {}) {
|
|
7
|
-
this.effectFn = e,
|
|
8
|
+
this.effectFn = e, f(this, "id", ++G), f(this, "type", "effect"), f(this, "priority"), f(this, "sources", /* @__PURE__ */ new Set()), f(this, "observers", /* @__PURE__ */ new Set()), f(this, "isDisposed", !1), f(this, "cleanupFn"), f(this, "options"), f(this, "owner"), this.priority = r.priority ?? v.Normal, this.options = r, this.owner = O(), r.fireImmediately !== !1 && this.execute();
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Notify method called by unified scheduler
|
|
@@ -28,7 +29,7 @@ class W {
|
|
|
28
29
|
for (const s of this.sources)
|
|
29
30
|
"removeObserver" in s && typeof s.removeObserver == "function" ? s.removeObserver(this) : "observers" in s && s.observers instanceof Set && s.observers.delete(this);
|
|
30
31
|
this.sources.clear();
|
|
31
|
-
const e =
|
|
32
|
+
const e = x(), r = this.setCurrentComputation || (() => {
|
|
32
33
|
});
|
|
33
34
|
r(this);
|
|
34
35
|
try {
|
|
@@ -38,8 +39,8 @@ class W {
|
|
|
38
39
|
if (this.options.onError)
|
|
39
40
|
try {
|
|
40
41
|
this.options.onError(s);
|
|
41
|
-
} catch (
|
|
42
|
-
throw console.error("Effect error handler threw error:",
|
|
42
|
+
} catch (o) {
|
|
43
|
+
throw console.error("Effect error handler threw error:", o), s;
|
|
43
44
|
}
|
|
44
45
|
else
|
|
45
46
|
throw console.error(`Effect ${this.options.debugName || this.id} threw error:`, s), s;
|
|
@@ -85,7 +86,7 @@ class W {
|
|
|
85
86
|
return {
|
|
86
87
|
id: this.id,
|
|
87
88
|
type: this.type,
|
|
88
|
-
priority:
|
|
89
|
+
priority: v[this.priority],
|
|
89
90
|
debugName: this.options.debugName,
|
|
90
91
|
disposed: this.isDisposed,
|
|
91
92
|
sourceCount: this.sources.size,
|
|
@@ -96,61 +97,61 @@ class W {
|
|
|
96
97
|
return `Effect(${this.options.debugName || this.id})`;
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
-
const r = new
|
|
100
|
+
function b(t, e) {
|
|
101
|
+
const r = new J(t, e), s = O();
|
|
101
102
|
return s && s.cleanups.push(() => r.cleanup()), () => r.cleanup();
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
104
|
+
function ge(t, e) {
|
|
105
|
+
return b(t, { ...e, priority: v.High });
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
-
return
|
|
107
|
+
function me(t, e) {
|
|
108
|
+
return b(t, { ...e, priority: v.Low });
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
-
return
|
|
110
|
+
function ve(t, e) {
|
|
111
|
+
return b(t, { ...e, fireImmediately: !1 });
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
-
let
|
|
114
|
-
const
|
|
113
|
+
function be(t, e, r = 3, s) {
|
|
114
|
+
let o = 0;
|
|
115
|
+
const u = () => {
|
|
115
116
|
try {
|
|
116
117
|
return t();
|
|
117
118
|
} catch (h) {
|
|
118
|
-
if (
|
|
119
|
-
setTimeout(() =>
|
|
119
|
+
if (o++, e && o <= r && e(h, o)) {
|
|
120
|
+
setTimeout(() => u(), o * 100);
|
|
120
121
|
return;
|
|
121
122
|
} else
|
|
122
123
|
throw h;
|
|
123
124
|
}
|
|
124
125
|
};
|
|
125
|
-
return
|
|
126
|
+
return b(u, {
|
|
126
127
|
...s,
|
|
127
128
|
debugName: `${s?.debugName || "effect"}(resilient)`
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
-
const e = t.map(({ fn: r, options: s }) =>
|
|
131
|
+
function Se(t) {
|
|
132
|
+
const e = t.map(({ fn: r, options: s }) => b(r, s));
|
|
132
133
|
return () => {
|
|
133
134
|
e.forEach((r) => r());
|
|
134
135
|
};
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
137
|
+
function ye() {
|
|
138
|
+
return g.getInstance().getPerformanceMetrics();
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
140
|
+
function we() {
|
|
141
|
+
g.getInstance().flushSync();
|
|
141
142
|
}
|
|
142
|
-
var
|
|
143
|
-
let
|
|
144
|
-
class
|
|
143
|
+
var Q = Object.defineProperty, X = (t, e, r) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d = (t, e, r) => X(t, typeof e != "symbol" ? e + "" : e, r);
|
|
144
|
+
let Y = 0;
|
|
145
|
+
class Z {
|
|
145
146
|
constructor(e, r = {}) {
|
|
146
|
-
|
|
147
|
+
d(this, "id", ++Y), d(this, "type", "signal"), d(this, "priority"), d(this, "observers", /* @__PURE__ */ new Set()), d(this, "_value"), d(this, "scheduler", g.getInstance()), d(this, "equalsFn"), d(this, "debugName"), d(this, "options"), this._value = e, this.options = r, this.priority = r.priority ?? v.Normal, this.equalsFn = r.equals ?? H, this.debugName = r.debugName;
|
|
147
148
|
}
|
|
148
149
|
/**
|
|
149
150
|
* Get the current value and track dependency
|
|
150
151
|
*/
|
|
151
152
|
getValue() {
|
|
152
|
-
const e =
|
|
153
|
-
return e && e.state !==
|
|
153
|
+
const e = x();
|
|
154
|
+
return e && e.state !== E.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
|
|
154
155
|
}
|
|
155
156
|
/**
|
|
156
157
|
* Get the current value without tracking dependency
|
|
@@ -174,7 +175,7 @@ class K {
|
|
|
174
175
|
*/
|
|
175
176
|
notify() {
|
|
176
177
|
for (const e of this.observers)
|
|
177
|
-
e.state !==
|
|
178
|
+
e.state !== E.Disposed && (e.state = E.Dirty, "type" in e && "priority" in e && this.scheduler.schedule(e));
|
|
178
179
|
}
|
|
179
180
|
/**
|
|
180
181
|
* Remove an observer (cleanup)
|
|
@@ -199,7 +200,7 @@ class K {
|
|
|
199
200
|
type: this.type,
|
|
200
201
|
value: this._value,
|
|
201
202
|
observerCount: this.observers.size,
|
|
202
|
-
priority:
|
|
203
|
+
priority: v[this.priority],
|
|
203
204
|
debugName: this.debugName,
|
|
204
205
|
equalsFn: this.equalsFn.name || "anonymous"
|
|
205
206
|
};
|
|
@@ -208,59 +209,59 @@ class K {
|
|
|
208
209
|
return `Signal(${this.options.debugName || this.id}): ${this._value}`;
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
|
-
function
|
|
212
|
-
const r = new
|
|
212
|
+
function q(t, e) {
|
|
213
|
+
const r = new Z(t, e), s = r.getValue.bind(r);
|
|
213
214
|
s.peek = r.peek.bind(r);
|
|
214
|
-
const
|
|
215
|
+
const o = r.setValue.bind(r);
|
|
215
216
|
return Object.defineProperty(s, Symbol.for("tachui.signal"), {
|
|
216
217
|
value: r,
|
|
217
218
|
enumerable: !1
|
|
218
|
-
}), [s,
|
|
219
|
+
}), [s, o];
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
-
return
|
|
221
|
+
function Ee(t, e) {
|
|
222
|
+
return q(t, {
|
|
222
223
|
...e,
|
|
223
|
-
equals:
|
|
224
|
+
equals: M
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
|
-
function
|
|
227
|
-
return
|
|
227
|
+
function Ce(t, e) {
|
|
228
|
+
return q(t, {
|
|
228
229
|
...e,
|
|
229
|
-
equals:
|
|
230
|
+
equals: $
|
|
230
231
|
});
|
|
231
232
|
}
|
|
232
|
-
function
|
|
233
|
+
function qe(t) {
|
|
233
234
|
return t[Symbol.for("tachui.signal")] || null;
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
+
function Fe(t) {
|
|
236
237
|
return typeof t == "function" && Symbol.for("tachui.signal") in t;
|
|
237
238
|
}
|
|
238
|
-
function
|
|
239
|
-
|
|
239
|
+
function Ie() {
|
|
240
|
+
g.getInstance().flushSync();
|
|
240
241
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
242
|
+
function _e() {
|
|
243
|
+
return g.getInstance().getPerformanceMetrics();
|
|
243
244
|
}
|
|
244
|
-
let
|
|
245
|
+
let R = !0, c = {
|
|
245
246
|
signalsConverted: 0,
|
|
246
247
|
computedsConverted: 0,
|
|
247
248
|
effectsConverted: 0,
|
|
248
249
|
errorsFixed: 0
|
|
249
250
|
};
|
|
250
|
-
function
|
|
251
|
-
return
|
|
251
|
+
function Ne(t) {
|
|
252
|
+
return R && console.warn(
|
|
252
253
|
"createLegacySignal is deprecated. Use createSignal() or createEnhancedSignal() instead. See: https://docs.tachui.dev/migration/reactive-system"
|
|
253
254
|
), c.signalsConverted++, y(t);
|
|
254
255
|
}
|
|
255
|
-
function
|
|
256
|
+
function T(t, e) {
|
|
256
257
|
const r = t[0]();
|
|
257
258
|
let s;
|
|
258
259
|
switch (e?.equals) {
|
|
259
260
|
case "deep":
|
|
260
|
-
s =
|
|
261
|
+
s = M;
|
|
261
262
|
break;
|
|
262
263
|
case "shallow":
|
|
263
|
-
s =
|
|
264
|
+
s = $;
|
|
264
265
|
break;
|
|
265
266
|
case "custom":
|
|
266
267
|
s = e.customEquals;
|
|
@@ -268,18 +269,18 @@ function J(t, e) {
|
|
|
268
269
|
default:
|
|
269
270
|
s = void 0;
|
|
270
271
|
}
|
|
271
|
-
return c.signalsConverted++,
|
|
272
|
+
return c.signalsConverted++, q(r, {
|
|
272
273
|
equals: s,
|
|
273
274
|
priority: e?.priority,
|
|
274
275
|
debugName: e?.debugName
|
|
275
276
|
});
|
|
276
277
|
}
|
|
277
|
-
function
|
|
278
|
+
function $e(t) {
|
|
278
279
|
const e = t(), r = [];
|
|
279
280
|
let s = "enhanced";
|
|
280
281
|
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
|
}
|
|
282
|
-
function
|
|
283
|
+
function Me(t) {
|
|
283
284
|
const e = {
|
|
284
285
|
signals: [],
|
|
285
286
|
computeds: [],
|
|
@@ -288,18 +289,18 @@ function Ee(t) {
|
|
|
288
289
|
}
|
|
289
290
|
};
|
|
290
291
|
t.signals && (e.signals = t.signals.map(
|
|
291
|
-
({ original: s, options:
|
|
292
|
-
)), t.computeds && (e.computeds = t.computeds.map(({ original: s, options:
|
|
292
|
+
({ original: s, options: o }) => T(s, o)
|
|
293
|
+
)), t.computeds && (e.computeds = t.computeds.map(({ original: s, options: o }) => (c.computedsConverted++, V(s, o))));
|
|
293
294
|
const r = [];
|
|
294
|
-
return t.effects && t.effects.forEach(({ original: s, options:
|
|
295
|
+
return t.effects && t.effects.forEach(({ original: s, options: o }) => {
|
|
295
296
|
c.effectsConverted++;
|
|
296
|
-
const
|
|
297
|
-
r.push(
|
|
297
|
+
const u = b(s, o);
|
|
298
|
+
r.push(u);
|
|
298
299
|
}), e.cleanup = () => {
|
|
299
300
|
r.forEach((s) => s());
|
|
300
301
|
}, e;
|
|
301
302
|
}
|
|
302
|
-
function
|
|
303
|
+
function Oe(t) {
|
|
303
304
|
const e = [];
|
|
304
305
|
let r = t;
|
|
305
306
|
return [
|
|
@@ -318,12 +319,12 @@ function Ce(t) {
|
|
|
318
319
|
to: "createEnhancedEffect($1, { debugName: 'effect' })",
|
|
319
320
|
description: "Upgraded createEffect to createEnhancedEffect with debug name"
|
|
320
321
|
}
|
|
321
|
-
].forEach((
|
|
322
|
-
r.match(
|
|
322
|
+
].forEach((o) => {
|
|
323
|
+
r.match(o.from) && (r = r.replace(o.from, o.to), e.push(o.description));
|
|
323
324
|
}), { newCode: r, transformations: e };
|
|
324
325
|
}
|
|
325
|
-
function
|
|
326
|
-
const t =
|
|
326
|
+
function ee() {
|
|
327
|
+
const t = g.getInstance(), e = t.getPerformanceMetrics(), r = [];
|
|
327
328
|
let s = 100;
|
|
328
329
|
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
330
|
scheduler: t.getDebugInfo(),
|
|
@@ -343,18 +344,18 @@ function Q() {
|
|
|
343
344
|
recommendations: r
|
|
344
345
|
};
|
|
345
346
|
}
|
|
346
|
-
function
|
|
347
|
-
const e =
|
|
348
|
-
console.error("🔥 Reactive System Error:",
|
|
347
|
+
function xe(t = { verbose: !1 }) {
|
|
348
|
+
const e = g.getInstance(), r = (o) => {
|
|
349
|
+
console.error("🔥 Reactive System Error:", o), c.errorsFixed++;
|
|
349
350
|
}, s = e.onError(r);
|
|
350
351
|
return t.verbose && (console.log("🔍 Reactive debugging enabled"), console.log("📊 Migration stats:", c)), () => {
|
|
351
352
|
s(), t.verbose && console.log("🔍 Reactive debugging disabled");
|
|
352
353
|
};
|
|
353
354
|
}
|
|
354
|
-
function
|
|
355
|
+
function Re() {
|
|
355
356
|
return { ...c };
|
|
356
357
|
}
|
|
357
|
-
function
|
|
358
|
+
function De() {
|
|
358
359
|
c = {
|
|
359
360
|
signalsConverted: 0,
|
|
360
361
|
computedsConverted: 0,
|
|
@@ -362,11 +363,11 @@ function _e() {
|
|
|
362
363
|
errorsFixed: 0
|
|
363
364
|
};
|
|
364
365
|
}
|
|
365
|
-
function
|
|
366
|
-
|
|
366
|
+
function Ue(t) {
|
|
367
|
+
R = t;
|
|
367
368
|
}
|
|
368
|
-
function
|
|
369
|
-
const t =
|
|
369
|
+
function ze() {
|
|
370
|
+
const t = ee();
|
|
370
371
|
return `
|
|
371
372
|
# TachUI Reactive System Migration Report
|
|
372
373
|
|
|
@@ -385,141 +386,249 @@ ${t.recommendations.map((e) => `- ${e}`).join(`
|
|
|
385
386
|
## Generated: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
386
387
|
`;
|
|
387
388
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
389
|
+
function Pe() {
|
|
390
|
+
return C() !== null;
|
|
390
391
|
}
|
|
391
|
-
function
|
|
392
|
-
return
|
|
392
|
+
function te(t) {
|
|
393
|
+
return j(null, t);
|
|
393
394
|
}
|
|
394
|
-
function
|
|
395
|
-
return
|
|
395
|
+
function Ae(t) {
|
|
396
|
+
return te(() => W(t));
|
|
396
397
|
}
|
|
397
|
-
function
|
|
398
|
-
let t =
|
|
398
|
+
function Le() {
|
|
399
|
+
let t = C();
|
|
399
400
|
if (!t) return null;
|
|
400
401
|
for (; t.parent; )
|
|
401
402
|
t = t.parent;
|
|
402
403
|
return t;
|
|
403
404
|
}
|
|
404
|
-
function
|
|
405
|
+
function ke() {
|
|
405
406
|
const t = [];
|
|
406
|
-
let e =
|
|
407
|
+
let e = C();
|
|
407
408
|
for (; e; )
|
|
408
409
|
t.push(e), e = e.parent;
|
|
409
410
|
return t;
|
|
410
411
|
}
|
|
411
|
-
|
|
412
|
-
|
|
412
|
+
var re = Object.defineProperty, se = (t, e, r) => e in t ? re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, w = (t, e, r) => se(t, typeof e != "symbol" ? e + "" : e, r);
|
|
413
|
+
class D {
|
|
414
|
+
constructor() {
|
|
415
|
+
w(this, "pending", /* @__PURE__ */ new Set()), w(this, "isFlushScheduled", !1);
|
|
416
|
+
}
|
|
417
|
+
schedule(e) {
|
|
418
|
+
this.pending.add(e), this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
|
|
419
|
+
}
|
|
420
|
+
flush() {
|
|
421
|
+
if (this.pending.size === 0) {
|
|
422
|
+
this.isFlushScheduled = !1;
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const e = Array.from(this.pending);
|
|
426
|
+
this.pending.clear(), this.isFlushScheduled = !1;
|
|
427
|
+
for (const r of e)
|
|
428
|
+
try {
|
|
429
|
+
r();
|
|
430
|
+
} catch (s) {
|
|
431
|
+
console.error("Error in scheduled task:", s);
|
|
432
|
+
}
|
|
433
|
+
this.pending.size > 0 && (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
class ne {
|
|
437
|
+
schedule(e) {
|
|
438
|
+
try {
|
|
439
|
+
e();
|
|
440
|
+
} catch (r) {
|
|
441
|
+
console.error("Error in sync scheduled task:", r);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
flush() {
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
var U = /* @__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))(U || {});
|
|
448
|
+
class ie {
|
|
449
|
+
constructor() {
|
|
450
|
+
w(this, "queues", /* @__PURE__ */ new Map()), w(this, "taskIdCounter", 0), w(this, "isFlushScheduled", !1);
|
|
451
|
+
for (const e of Object.values(U))
|
|
452
|
+
typeof e == "number" && this.queues.set(e, /* @__PURE__ */ new Set());
|
|
453
|
+
}
|
|
454
|
+
schedule(e, r = 2) {
|
|
455
|
+
const s = {
|
|
456
|
+
fn: e,
|
|
457
|
+
priority: r,
|
|
458
|
+
id: ++this.taskIdCounter
|
|
459
|
+
}, o = this.queues.get(r);
|
|
460
|
+
o && o.add(s), this.isFlushScheduled || (this.isFlushScheduled = !0, r === 0 ? this.flush() : queueMicrotask(() => this.flush()));
|
|
461
|
+
}
|
|
462
|
+
flush() {
|
|
463
|
+
this.isFlushScheduled = !1;
|
|
464
|
+
for (const e of [
|
|
465
|
+
0,
|
|
466
|
+
1,
|
|
467
|
+
2,
|
|
468
|
+
3,
|
|
469
|
+
4
|
|
470
|
+
/* Idle */
|
|
471
|
+
]) {
|
|
472
|
+
const r = this.queues.get(e);
|
|
473
|
+
if (!r || r.size === 0) continue;
|
|
474
|
+
const s = Array.from(r).sort((o, u) => o.id - u.id);
|
|
475
|
+
r.clear();
|
|
476
|
+
for (const o of s)
|
|
477
|
+
try {
|
|
478
|
+
o.fn();
|
|
479
|
+
} catch (u) {
|
|
480
|
+
console.error(`Error in priority ${e} task:`, u);
|
|
481
|
+
}
|
|
482
|
+
if (r.size === 0 && this.hasMoreTasks()) {
|
|
483
|
+
queueMicrotask(() => this.flush());
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
hasMoreTasks() {
|
|
489
|
+
for (const e of this.queues.values())
|
|
490
|
+
if (e.size > 0) return !0;
|
|
491
|
+
return !1;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
let p = new D();
|
|
495
|
+
function He() {
|
|
496
|
+
return p;
|
|
497
|
+
}
|
|
498
|
+
function Ve(t) {
|
|
499
|
+
p = t;
|
|
500
|
+
}
|
|
501
|
+
function je(t = !0) {
|
|
502
|
+
t ? p = new D() : p = new ne();
|
|
503
|
+
}
|
|
504
|
+
function We(t) {
|
|
505
|
+
p.schedule(t);
|
|
506
|
+
}
|
|
507
|
+
function Be(t, e) {
|
|
508
|
+
p instanceof ie ? p.schedule(t, e) : p.schedule(t);
|
|
509
|
+
}
|
|
510
|
+
function Ke(t) {
|
|
511
|
+
typeof requestIdleCallback < "u" ? requestIdleCallback(t) : setTimeout(t, 0);
|
|
512
|
+
}
|
|
513
|
+
function oe(t, e) {
|
|
514
|
+
const r = /* @__PURE__ */ new Map(), [s, o] = y(t.map(e)), u = s, h = () => s.peek(), S = (i) => {
|
|
413
515
|
const n = h();
|
|
414
|
-
|
|
415
|
-
},
|
|
416
|
-
if (
|
|
417
|
-
for (let a = 0; a <
|
|
418
|
-
if (
|
|
516
|
+
z(n, i) || o(i);
|
|
517
|
+
}, z = (i, n) => {
|
|
518
|
+
if (i.length !== n.length) return !1;
|
|
519
|
+
for (let a = 0; a < i.length; a++)
|
|
520
|
+
if (i[a] !== n[a]) return !1;
|
|
419
521
|
return !0;
|
|
420
522
|
};
|
|
421
|
-
t.forEach((
|
|
422
|
-
const n = e(
|
|
423
|
-
r.set(n, y(
|
|
523
|
+
t.forEach((i) => {
|
|
524
|
+
const n = e(i);
|
|
525
|
+
r.set(n, y(i));
|
|
424
526
|
});
|
|
425
|
-
const
|
|
426
|
-
const n = r.get(
|
|
527
|
+
const P = (i) => {
|
|
528
|
+
const n = r.get(i);
|
|
427
529
|
if (!n)
|
|
428
|
-
throw new Error(`SignalList: Item with key "${String(
|
|
530
|
+
throw new Error(`SignalList: Item with key "${String(i)}" not found`);
|
|
429
531
|
return n[0];
|
|
430
|
-
},
|
|
431
|
-
const a = r.get(
|
|
532
|
+
}, A = (i, n) => {
|
|
533
|
+
const a = r.get(i);
|
|
432
534
|
if (a)
|
|
433
535
|
a[1](n);
|
|
434
536
|
else {
|
|
435
|
-
r.set(
|
|
436
|
-
const
|
|
437
|
-
|
|
537
|
+
r.set(i, y(n));
|
|
538
|
+
const l = h();
|
|
539
|
+
S([...l, i]);
|
|
438
540
|
}
|
|
439
|
-
},
|
|
440
|
-
if (
|
|
541
|
+
}, L = (i, n) => {
|
|
542
|
+
if (i.length !== n.length)
|
|
441
543
|
return !0;
|
|
442
|
-
const a = new Set(
|
|
443
|
-
if (a.size !==
|
|
544
|
+
const a = new Set(i), l = new Set(n);
|
|
545
|
+
if (a.size !== l.size)
|
|
444
546
|
return !0;
|
|
445
|
-
for (const
|
|
446
|
-
if (!a.has(
|
|
547
|
+
for (const I of n)
|
|
548
|
+
if (!a.has(I))
|
|
447
549
|
return !0;
|
|
448
550
|
return !1;
|
|
449
|
-
},
|
|
450
|
-
const n =
|
|
451
|
-
|
|
452
|
-
const _ = e(
|
|
453
|
-
|
|
454
|
-
}),
|
|
455
|
-
a.has(
|
|
456
|
-
}),
|
|
457
|
-
},
|
|
458
|
-
const a = r.get(
|
|
551
|
+
}, k = (i) => {
|
|
552
|
+
const n = i.map(e), a = new Set(n), l = h();
|
|
553
|
+
i.forEach((m) => {
|
|
554
|
+
const _ = e(m), N = r.get(_);
|
|
555
|
+
N ? N[1](m) : r.set(_, y(m));
|
|
556
|
+
}), l.forEach((m) => {
|
|
557
|
+
a.has(m) || r.delete(m);
|
|
558
|
+
}), L(l, n) && S(n);
|
|
559
|
+
}, F = (i, n) => {
|
|
560
|
+
const a = r.get(i);
|
|
459
561
|
if (!a) return null;
|
|
460
|
-
const
|
|
461
|
-
return
|
|
562
|
+
const l = a[0];
|
|
563
|
+
return l ? n ? l() : typeof l.peek == "function" ? l.peek() : l() : null;
|
|
462
564
|
};
|
|
463
565
|
return [
|
|
464
|
-
() =>
|
|
566
|
+
() => u().map((n) => F(n, !0)).filter((n) => n !== null),
|
|
465
567
|
{
|
|
466
|
-
ids:
|
|
467
|
-
get:
|
|
468
|
-
update:
|
|
469
|
-
set:
|
|
568
|
+
ids: u,
|
|
569
|
+
get: P,
|
|
570
|
+
update: A,
|
|
571
|
+
set: k,
|
|
470
572
|
clear: () => {
|
|
471
|
-
r.clear(),
|
|
573
|
+
r.clear(), S([]);
|
|
472
574
|
},
|
|
473
|
-
remove: (
|
|
474
|
-
r.delete(
|
|
575
|
+
remove: (i) => {
|
|
576
|
+
r.delete(i);
|
|
475
577
|
const n = h();
|
|
476
|
-
|
|
578
|
+
S(n.filter((a) => a !== i));
|
|
477
579
|
},
|
|
478
|
-
reorder: (
|
|
479
|
-
if (!
|
|
580
|
+
reorder: (i) => {
|
|
581
|
+
if (!i.every((a) => r.has(a)))
|
|
480
582
|
throw new Error("[SignalList.reorder] Cannot reorder with unknown ids");
|
|
481
|
-
|
|
583
|
+
S([...i]);
|
|
482
584
|
},
|
|
483
|
-
getAll: () => h().map((n) =>
|
|
585
|
+
getAll: () => h().map((n) => F(n, !1)).filter((n) => n !== null)
|
|
484
586
|
}
|
|
485
587
|
];
|
|
486
588
|
}
|
|
487
|
-
function
|
|
488
|
-
const [, r] =
|
|
589
|
+
function Ge(t, e) {
|
|
590
|
+
const [, r] = oe(t, e);
|
|
489
591
|
return r;
|
|
490
592
|
}
|
|
491
593
|
export {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
594
|
+
Ae as A,
|
|
595
|
+
ke as B,
|
|
596
|
+
Le as C,
|
|
597
|
+
Pe as D,
|
|
598
|
+
te as E,
|
|
599
|
+
je as F,
|
|
600
|
+
He as G,
|
|
601
|
+
Ke as H,
|
|
602
|
+
We as I,
|
|
603
|
+
Be as J,
|
|
604
|
+
Ve as K,
|
|
605
|
+
oe as L,
|
|
606
|
+
Ge as M,
|
|
607
|
+
U as T,
|
|
608
|
+
b as a,
|
|
609
|
+
ge as b,
|
|
610
|
+
Se as c,
|
|
611
|
+
me as d,
|
|
612
|
+
be as e,
|
|
613
|
+
ve as f,
|
|
614
|
+
we as g,
|
|
615
|
+
ye as h,
|
|
616
|
+
Ee as i,
|
|
617
|
+
q as j,
|
|
618
|
+
Ce as k,
|
|
619
|
+
Ie as l,
|
|
620
|
+
qe as m,
|
|
621
|
+
_e as n,
|
|
622
|
+
Fe as o,
|
|
623
|
+
ee as p,
|
|
624
|
+
$e as q,
|
|
625
|
+
Ne as r,
|
|
626
|
+
ze as s,
|
|
627
|
+
xe as t,
|
|
628
|
+
Re as u,
|
|
629
|
+
Me as v,
|
|
630
|
+
Oe as w,
|
|
631
|
+
T as x,
|
|
632
|
+
De as y,
|
|
633
|
+
Ue as z
|
|
525
634
|
};
|