@tachui/core 0.8.23 → 0.8.24
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-B05hE6kc.js +644 -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 +121 -120
- package/dist/modifiers/builder.js +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
package/dist/presets-B9x94uRn.js
DELETED
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import { LayoutModifier as p, AppearanceModifier as y, AnimationModifier as a, LifecycleModifier as u, InteractionModifier as s } from "./modifiers/base.js";
|
|
2
|
-
import { ModifierPriority as d } from "@tachui/types/modifiers";
|
|
3
|
-
import { globalModifierRegistry as b } from "@tachui/registry";
|
|
4
|
-
d.LAYOUT;
|
|
5
|
-
const w = (r) => new p({ alignment: r });
|
|
6
|
-
function M(r) {
|
|
7
|
-
return w(r);
|
|
8
|
-
}
|
|
9
|
-
d.LAYOUT;
|
|
10
|
-
const A = (r) => new p({ layoutPriority: r });
|
|
11
|
-
function k(r) {
|
|
12
|
-
return A(r);
|
|
13
|
-
}
|
|
14
|
-
d.APPEARANCE;
|
|
15
|
-
const C = (r) => new y({ opacity: r });
|
|
16
|
-
function F(r) {
|
|
17
|
-
return C(r);
|
|
18
|
-
}
|
|
19
|
-
d.APPEARANCE;
|
|
20
|
-
const R = (r) => new y({ cornerRadius: r });
|
|
21
|
-
function h(r) {
|
|
22
|
-
return R(r);
|
|
23
|
-
}
|
|
24
|
-
function t(r, ...e) {
|
|
25
|
-
const o = b.get(r);
|
|
26
|
-
if (!o)
|
|
27
|
-
throw new Error(
|
|
28
|
-
`Modifier '${r}' not found in registry. Import '@tachui/modifiers' or the relevant segmented bundle before using preset helpers.`
|
|
29
|
-
);
|
|
30
|
-
return o(...e);
|
|
31
|
-
}
|
|
32
|
-
const f = {
|
|
33
|
-
/**
|
|
34
|
-
* Set foreground (text) color
|
|
35
|
-
*/
|
|
36
|
-
foregroundColor(r) {
|
|
37
|
-
return t("foregroundColor", r);
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* Set frame dimensions with support for infinity
|
|
41
|
-
*/
|
|
42
|
-
frame(r, e, o) {
|
|
43
|
-
let i = o || {};
|
|
44
|
-
return (r !== void 0 || e !== void 0) && (i = {
|
|
45
|
-
...i,
|
|
46
|
-
...r !== void 0 ? { width: r } : {},
|
|
47
|
-
...e !== void 0 ? { height: e } : {}
|
|
48
|
-
}), new p({ frame: i });
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* Set padding on all sides
|
|
52
|
-
*/
|
|
53
|
-
padding(r) {
|
|
54
|
-
return t("padding", r);
|
|
55
|
-
},
|
|
56
|
-
/**
|
|
57
|
-
* Set margin on all sides
|
|
58
|
-
*/
|
|
59
|
-
margin(r) {
|
|
60
|
-
return t("margin", r);
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* Set content alignment
|
|
64
|
-
*/
|
|
65
|
-
alignment(r) {
|
|
66
|
-
return M(r);
|
|
67
|
-
},
|
|
68
|
-
/**
|
|
69
|
-
* Set layout priority for ZStack container sizing and flexible layout
|
|
70
|
-
* Higher priority views determine container size in ZStack
|
|
71
|
-
*/
|
|
72
|
-
layoutPriority(r) {
|
|
73
|
-
return k(r);
|
|
74
|
-
}
|
|
75
|
-
}, n = {
|
|
76
|
-
/**
|
|
77
|
-
* Set foreground (text) color
|
|
78
|
-
*/
|
|
79
|
-
foregroundColor(r) {
|
|
80
|
-
return t("foregroundColor", r);
|
|
81
|
-
},
|
|
82
|
-
/**
|
|
83
|
-
* Set background color
|
|
84
|
-
*/
|
|
85
|
-
backgroundColor(r) {
|
|
86
|
-
return t("backgroundColor", r);
|
|
87
|
-
},
|
|
88
|
-
/**
|
|
89
|
-
* Set background (supports gradients)
|
|
90
|
-
*/
|
|
91
|
-
background(r) {
|
|
92
|
-
return t("background", r);
|
|
93
|
-
},
|
|
94
|
-
/**
|
|
95
|
-
* Set font properties
|
|
96
|
-
*/
|
|
97
|
-
font(r) {
|
|
98
|
-
return t("font", r);
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* Set font size
|
|
102
|
-
*/
|
|
103
|
-
fontSize(r) {
|
|
104
|
-
return t("fontSize", r);
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* Set font weight
|
|
108
|
-
*/
|
|
109
|
-
fontWeight(r) {
|
|
110
|
-
return t("fontWeight", r);
|
|
111
|
-
},
|
|
112
|
-
/**
|
|
113
|
-
* Set font family
|
|
114
|
-
*/
|
|
115
|
-
fontFamily(r) {
|
|
116
|
-
return t("fontFamily", r);
|
|
117
|
-
},
|
|
118
|
-
/**
|
|
119
|
-
* Set opacity
|
|
120
|
-
*/
|
|
121
|
-
opacity(r) {
|
|
122
|
-
return F(r);
|
|
123
|
-
},
|
|
124
|
-
/**
|
|
125
|
-
* Set corner radius (enhanced)
|
|
126
|
-
*/
|
|
127
|
-
cornerRadius(r) {
|
|
128
|
-
return h(r);
|
|
129
|
-
},
|
|
130
|
-
/**
|
|
131
|
-
* Set border
|
|
132
|
-
*/
|
|
133
|
-
border(r, e = "#000000", o = "solid") {
|
|
134
|
-
return t("border", r, e, o);
|
|
135
|
-
},
|
|
136
|
-
/**
|
|
137
|
-
* Set detailed border properties
|
|
138
|
-
*/
|
|
139
|
-
borderDetailed(r) {
|
|
140
|
-
return t("border", r);
|
|
141
|
-
}
|
|
142
|
-
// Shadow functionality moved to @tachui/modifiers/effects entry point
|
|
143
|
-
}, c = {
|
|
144
|
-
/**
|
|
145
|
-
* Add tap handler
|
|
146
|
-
*/
|
|
147
|
-
onTap(r) {
|
|
148
|
-
return new s({ onTap: r });
|
|
149
|
-
},
|
|
150
|
-
/**
|
|
151
|
-
* Add hover handler
|
|
152
|
-
*/
|
|
153
|
-
onHover(r) {
|
|
154
|
-
return new s({ onHover: r });
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* Add focus handler
|
|
158
|
-
*/
|
|
159
|
-
onFocus(r) {
|
|
160
|
-
return new s({ onFocus: r });
|
|
161
|
-
},
|
|
162
|
-
/**
|
|
163
|
-
* Set disabled state
|
|
164
|
-
*/
|
|
165
|
-
disabled(r = !0) {
|
|
166
|
-
return new s({ disabled: r });
|
|
167
|
-
},
|
|
168
|
-
/**
|
|
169
|
-
* Set accessibility label
|
|
170
|
-
*/
|
|
171
|
-
accessibilityLabel(r) {
|
|
172
|
-
return new s({ accessibilityLabel: r });
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* Set accessibility hint
|
|
176
|
-
*/
|
|
177
|
-
accessibilityHint(r) {
|
|
178
|
-
return new s({ accessibilityHint: r });
|
|
179
|
-
}
|
|
180
|
-
}, l = {
|
|
181
|
-
/**
|
|
182
|
-
* Add transition
|
|
183
|
-
*/
|
|
184
|
-
transition(r = "all", e = 300, o = "ease", i = 0) {
|
|
185
|
-
return new a({
|
|
186
|
-
transition: { property: r, duration: e, easing: o, delay: i }
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
/**
|
|
190
|
-
* Add detailed transition
|
|
191
|
-
*/
|
|
192
|
-
transitionDetailed(r) {
|
|
193
|
-
return new a({ transition: r });
|
|
194
|
-
},
|
|
195
|
-
/**
|
|
196
|
-
* Add animation
|
|
197
|
-
*/
|
|
198
|
-
animation(r) {
|
|
199
|
-
return new a({ animation: r });
|
|
200
|
-
},
|
|
201
|
-
/**
|
|
202
|
-
* Add fade in animation
|
|
203
|
-
*/
|
|
204
|
-
fadeIn(r = 300) {
|
|
205
|
-
return new a({
|
|
206
|
-
animation: {
|
|
207
|
-
keyframes: {
|
|
208
|
-
"0%": { opacity: "0" },
|
|
209
|
-
"100%": { opacity: "1" }
|
|
210
|
-
},
|
|
211
|
-
duration: r,
|
|
212
|
-
easing: "ease-out"
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
},
|
|
216
|
-
/**
|
|
217
|
-
* Add fade out animation
|
|
218
|
-
*/
|
|
219
|
-
fadeOut(r = 300) {
|
|
220
|
-
return new a({
|
|
221
|
-
animation: {
|
|
222
|
-
keyframes: {
|
|
223
|
-
"0%": { opacity: "1" },
|
|
224
|
-
"100%": { opacity: "0" }
|
|
225
|
-
},
|
|
226
|
-
duration: r,
|
|
227
|
-
easing: "ease-in"
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
/**
|
|
232
|
-
* Add slide in animation
|
|
233
|
-
*/
|
|
234
|
-
slideIn(r = "up", e = 300, o = 20) {
|
|
235
|
-
const i = {
|
|
236
|
-
up: [`translateY(${o}px)`, "translateY(0)"],
|
|
237
|
-
down: [`translateY(-${o}px)`, "translateY(0)"],
|
|
238
|
-
left: [`translateX(${o}px)`, "translateX(0)"],
|
|
239
|
-
right: [`translateX(-${o}px)`, "translateX(0)"]
|
|
240
|
-
}, [g, m] = i[r];
|
|
241
|
-
return new a({
|
|
242
|
-
animation: {
|
|
243
|
-
keyframes: {
|
|
244
|
-
"0%": { transform: g, opacity: "0" },
|
|
245
|
-
"100%": { transform: m, opacity: "1" }
|
|
246
|
-
},
|
|
247
|
-
duration: e,
|
|
248
|
-
easing: "ease-out"
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
},
|
|
252
|
-
/**
|
|
253
|
-
* Add scale animation
|
|
254
|
-
*/
|
|
255
|
-
scaleAnimation(r = 0.8, e = 1, o = 300) {
|
|
256
|
-
return new a({
|
|
257
|
-
animation: {
|
|
258
|
-
keyframes: {
|
|
259
|
-
"0%": { transform: `scale(${r})`, opacity: "0" },
|
|
260
|
-
"100%": { transform: `scale(${e})`, opacity: "1" }
|
|
261
|
-
},
|
|
262
|
-
duration: o,
|
|
263
|
-
easing: "ease-out"
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}, v = {
|
|
268
|
-
/**
|
|
269
|
-
* Execute handler when component appears in viewport
|
|
270
|
-
*/
|
|
271
|
-
onAppear(r) {
|
|
272
|
-
return new u({ onAppear: r });
|
|
273
|
-
},
|
|
274
|
-
/**
|
|
275
|
-
* Execute handler when component disappears from viewport
|
|
276
|
-
*/
|
|
277
|
-
onDisappear(r) {
|
|
278
|
-
return new u({ onDisappear: r });
|
|
279
|
-
},
|
|
280
|
-
/**
|
|
281
|
-
* Execute async task with automatic cancellation on component unmount
|
|
282
|
-
*/
|
|
283
|
-
task(r, e) {
|
|
284
|
-
return new u({
|
|
285
|
-
task: {
|
|
286
|
-
operation: r,
|
|
287
|
-
id: e?.id,
|
|
288
|
-
priority: e?.priority || "default"
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
},
|
|
292
|
-
/**
|
|
293
|
-
* Add pull-to-refresh functionality
|
|
294
|
-
*/
|
|
295
|
-
refreshable(r, e) {
|
|
296
|
-
return new u({
|
|
297
|
-
refreshable: {
|
|
298
|
-
onRefresh: r,
|
|
299
|
-
isRefreshing: e
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}, P = {
|
|
304
|
-
/**
|
|
305
|
-
* Card-like appearance
|
|
306
|
-
*/
|
|
307
|
-
card(r = 16) {
|
|
308
|
-
return [
|
|
309
|
-
n.backgroundColor("#ffffff"),
|
|
310
|
-
n.cornerRadius(8),
|
|
311
|
-
// shadow moved to @tachui/modifiers/effects entry point
|
|
312
|
-
f.padding(r)
|
|
313
|
-
];
|
|
314
|
-
},
|
|
315
|
-
/**
|
|
316
|
-
* Button-like appearance
|
|
317
|
-
*/
|
|
318
|
-
button(r = "#007AFF", e = "#ffffff") {
|
|
319
|
-
return [
|
|
320
|
-
n.backgroundColor(r),
|
|
321
|
-
n.foregroundColor(e),
|
|
322
|
-
n.cornerRadius(6),
|
|
323
|
-
f.padding(12),
|
|
324
|
-
// Simplified to single value for now
|
|
325
|
-
c.onHover((o) => {
|
|
326
|
-
}),
|
|
327
|
-
l.transition("all", 150)
|
|
328
|
-
];
|
|
329
|
-
},
|
|
330
|
-
/**
|
|
331
|
-
* Input field appearance
|
|
332
|
-
*/
|
|
333
|
-
input() {
|
|
334
|
-
return [
|
|
335
|
-
n.border(1, "#d1d5db"),
|
|
336
|
-
n.cornerRadius(4),
|
|
337
|
-
f.padding(8),
|
|
338
|
-
l.transition("border-color", 150),
|
|
339
|
-
c.onFocus((r) => {
|
|
340
|
-
})
|
|
341
|
-
];
|
|
342
|
-
},
|
|
343
|
-
/**
|
|
344
|
-
* Typography presets
|
|
345
|
-
*/
|
|
346
|
-
typography: {
|
|
347
|
-
title: () => [
|
|
348
|
-
n.fontSize(24),
|
|
349
|
-
n.fontWeight("bold")
|
|
350
|
-
],
|
|
351
|
-
heading: () => [
|
|
352
|
-
n.fontSize(20),
|
|
353
|
-
n.fontWeight("600")
|
|
354
|
-
],
|
|
355
|
-
body: () => [
|
|
356
|
-
n.fontSize(16),
|
|
357
|
-
n.fontWeight("normal")
|
|
358
|
-
],
|
|
359
|
-
caption: () => [
|
|
360
|
-
n.fontSize(12),
|
|
361
|
-
n.fontWeight("normal"),
|
|
362
|
-
n.opacity(0.7)
|
|
363
|
-
]
|
|
364
|
-
}
|
|
365
|
-
}, S = {
|
|
366
|
-
...f,
|
|
367
|
-
...n,
|
|
368
|
-
...c,
|
|
369
|
-
...l,
|
|
370
|
-
...v,
|
|
371
|
-
presets: P
|
|
372
|
-
};
|
|
373
|
-
export {
|
|
374
|
-
l as a,
|
|
375
|
-
n as b,
|
|
376
|
-
S as c,
|
|
377
|
-
v as d,
|
|
378
|
-
c as i,
|
|
379
|
-
f as l,
|
|
380
|
-
P as p
|
|
381
|
-
};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { l as a } from "./theme-CRLPHryV.js";
|
|
2
|
-
function o(e) {
|
|
3
|
-
const s = a();
|
|
4
|
-
s && !s.disposed ? s.cleanups.push(e) : __DEV__ && console.warn("onCleanup called outside of reactive context");
|
|
5
|
-
}
|
|
6
|
-
function S(e) {
|
|
7
|
-
"dispose" in e && typeof e.dispose == "function" && e.dispose();
|
|
8
|
-
}
|
|
9
|
-
function m(e) {
|
|
10
|
-
const [s, t] = e();
|
|
11
|
-
return o(t), s;
|
|
12
|
-
}
|
|
13
|
-
function q() {
|
|
14
|
-
const e = [];
|
|
15
|
-
let s = !1;
|
|
16
|
-
return {
|
|
17
|
-
add(t) {
|
|
18
|
-
if (s) {
|
|
19
|
-
__DEV__ && console.warn("Adding cleanup to disposed group");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
e.push(t);
|
|
23
|
-
},
|
|
24
|
-
dispose() {
|
|
25
|
-
if (!s) {
|
|
26
|
-
s = !0;
|
|
27
|
-
for (const t of e)
|
|
28
|
-
try {
|
|
29
|
-
t();
|
|
30
|
-
} catch (u) {
|
|
31
|
-
console.error("Error in cleanup function:", u);
|
|
32
|
-
}
|
|
33
|
-
e.length = 0;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
get disposed() {
|
|
37
|
-
return s;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function v(e, s) {
|
|
42
|
-
const t = setTimeout(e, s);
|
|
43
|
-
return o(() => clearTimeout(t)), t;
|
|
44
|
-
}
|
|
45
|
-
function E(e, s) {
|
|
46
|
-
const t = setInterval(e, s);
|
|
47
|
-
return o(() => clearInterval(t)), t;
|
|
48
|
-
}
|
|
49
|
-
function b(e, s, t, u) {
|
|
50
|
-
e.addEventListener(s, t, u), o(() => e.removeEventListener(s, t, u));
|
|
51
|
-
}
|
|
52
|
-
typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
|
|
53
|
-
var h = Object.defineProperty, f = (e, s, t) => s in e ? h(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t, i = (e, s, t) => f(e, typeof s != "symbol" ? s + "" : s, t);
|
|
54
|
-
class l {
|
|
55
|
-
constructor() {
|
|
56
|
-
i(this, "pending", /* @__PURE__ */ new Set()), i(this, "isFlushScheduled", !1);
|
|
57
|
-
}
|
|
58
|
-
schedule(s) {
|
|
59
|
-
this.pending.add(s), this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
|
|
60
|
-
}
|
|
61
|
-
flush() {
|
|
62
|
-
if (this.pending.size === 0) {
|
|
63
|
-
this.isFlushScheduled = !1;
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const s = Array.from(this.pending);
|
|
67
|
-
this.pending.clear(), this.isFlushScheduled = !1;
|
|
68
|
-
for (const t of s)
|
|
69
|
-
try {
|
|
70
|
-
t();
|
|
71
|
-
} catch (u) {
|
|
72
|
-
console.error("Error in scheduled task:", u);
|
|
73
|
-
}
|
|
74
|
-
this.pending.size > 0 && (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
class p {
|
|
78
|
-
schedule(s) {
|
|
79
|
-
try {
|
|
80
|
-
s();
|
|
81
|
-
} catch (t) {
|
|
82
|
-
console.error("Error in sync scheduled task:", t);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
flush() {
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
var d = /* @__PURE__ */ ((e) => (e[e.Immediate = 0] = "Immediate", e[e.High = 1] = "High", e[e.Normal = 2] = "Normal", e[e.Low = 3] = "Low", e[e.Idle = 4] = "Idle", e))(d || {});
|
|
89
|
-
class _ {
|
|
90
|
-
constructor() {
|
|
91
|
-
i(this, "queues", /* @__PURE__ */ new Map()), i(this, "taskIdCounter", 0), i(this, "isFlushScheduled", !1);
|
|
92
|
-
for (const s of Object.values(d))
|
|
93
|
-
typeof s == "number" && this.queues.set(s, /* @__PURE__ */ new Set());
|
|
94
|
-
}
|
|
95
|
-
schedule(s, t = 2) {
|
|
96
|
-
const u = {
|
|
97
|
-
fn: s,
|
|
98
|
-
priority: t,
|
|
99
|
-
id: ++this.taskIdCounter
|
|
100
|
-
}, n = this.queues.get(t);
|
|
101
|
-
n && n.add(u), this.isFlushScheduled || (this.isFlushScheduled = !0, t === 0 ? this.flush() : queueMicrotask(() => this.flush()));
|
|
102
|
-
}
|
|
103
|
-
flush() {
|
|
104
|
-
this.isFlushScheduled = !1;
|
|
105
|
-
for (const s of [
|
|
106
|
-
0,
|
|
107
|
-
1,
|
|
108
|
-
2,
|
|
109
|
-
3,
|
|
110
|
-
4
|
|
111
|
-
/* Idle */
|
|
112
|
-
]) {
|
|
113
|
-
const t = this.queues.get(s);
|
|
114
|
-
if (!t || t.size === 0) continue;
|
|
115
|
-
const u = Array.from(t).sort((n, c) => n.id - c.id);
|
|
116
|
-
t.clear();
|
|
117
|
-
for (const n of u)
|
|
118
|
-
try {
|
|
119
|
-
n.fn();
|
|
120
|
-
} catch (c) {
|
|
121
|
-
console.error(`Error in priority ${s} task:`, c);
|
|
122
|
-
}
|
|
123
|
-
if (t.size === 0 && this.hasMoreTasks()) {
|
|
124
|
-
queueMicrotask(() => this.flush());
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
hasMoreTasks() {
|
|
130
|
-
for (const s of this.queues.values())
|
|
131
|
-
if (s.size > 0) return !0;
|
|
132
|
-
return !1;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
let r = new l();
|
|
136
|
-
function I() {
|
|
137
|
-
return r;
|
|
138
|
-
}
|
|
139
|
-
function w(e) {
|
|
140
|
-
r = e;
|
|
141
|
-
}
|
|
142
|
-
function F(e = !0) {
|
|
143
|
-
e ? r = new l() : r = new p();
|
|
144
|
-
}
|
|
145
|
-
function C(e) {
|
|
146
|
-
r.schedule(e);
|
|
147
|
-
}
|
|
148
|
-
function M(e, s) {
|
|
149
|
-
r instanceof _ ? r.schedule(e, s) : r.schedule(e);
|
|
150
|
-
}
|
|
151
|
-
function k(e) {
|
|
152
|
-
typeof requestIdleCallback < "u" ? requestIdleCallback(e) : setTimeout(e, 0);
|
|
153
|
-
}
|
|
154
|
-
export {
|
|
155
|
-
d as T,
|
|
156
|
-
b as a,
|
|
157
|
-
E as b,
|
|
158
|
-
q as c,
|
|
159
|
-
S as d,
|
|
160
|
-
m as e,
|
|
161
|
-
v as f,
|
|
162
|
-
F as g,
|
|
163
|
-
I as h,
|
|
164
|
-
C as i,
|
|
165
|
-
M as j,
|
|
166
|
-
w as k,
|
|
167
|
-
o,
|
|
168
|
-
k as s
|
|
169
|
-
};
|