lilact 0.27.2 → 0.28.0
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/lilact.development.js +214 -203
- package/dist/lilact.development.js.map +4 -4
- package/dist/lilact.development.min.js +33 -33
- package/dist/lilact.development.min.js.map +4 -4
- package/dist/lilact.production.min.js +33 -33
- package/docs/classes/accessories.ErrorBoundary.html +8 -8
- package/docs/classes/accessories.Suspense.html +7 -7
- package/docs/classes/components.Component.html +11 -11
- package/docs/classes/components.HTMLComponent.html +11 -11
- package/docs/classes/components.RootComponent.html +11 -11
- package/docs/functions/components.cloneComponent.html +1 -1
- package/docs/functions/components.createComponent.html +1 -1
- package/docs/functions/components.createPortal.html +1 -1
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.memo.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/timers.animationFramePromise.html +1 -1
- package/docs/functions/timers.clearInterval.html +1 -1
- package/docs/functions/timers.grabTimers.html +1 -1
- package/docs/functions/timers.releaseTimers.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +4 -4
- package/docs/static/lilact.development.js +214 -203
- package/docs/static/lilact.development.js.map +4 -4
- package/docs/static/lilact.development.min.js +33 -33
- package/docs/static/lilact.development.min.js.map +4 -4
- package/docs/static/lilact.production.min.js +33 -33
- package/docs/variables/components.cloneElement.html +1 -1
- package/examples/lilact.development.js +214 -203
- package/examples/lilact.development.js.map +4 -4
- package/examples/lilact.development.min.js +33 -33
- package/examples/lilact.development.min.js.map +4 -4
- package/examples/lilact.production.min.js +33 -33
- package/package.json +1 -1
- package/src/accessories.jsx +1 -1
- package/src/components.jsx +22 -17
- package/src/expscan.js +2 -2
- package/src/hooks.jsx +6 -6
- package/src/lilact.jsx +7 -1
- package/src/run.jsx +1 -1
- package/src/timers.jsx +2 -0
- package/src/transition.jsx +1 -1
|
@@ -2619,7 +2619,7 @@ var ComponentCore = class {
|
|
|
2619
2619
|
}
|
|
2620
2620
|
}
|
|
2621
2621
|
updateElementProps(patch, force = false) {
|
|
2622
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
2622
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2623
2623
|
if (this.entity === "input") {
|
|
2624
2624
|
if (!(patch == null ? void 0 : patch.type)) patch.type = "text";
|
|
2625
2625
|
if (patch.type !== this.element.type) {
|
|
@@ -2634,8 +2634,15 @@ var ComponentCore = class {
|
|
|
2634
2634
|
this.element.value = String(patch.value).slice(0, patch == null ? void 0 : patch.maxLength);
|
|
2635
2635
|
}
|
|
2636
2636
|
} else if (this.entity === "select") {
|
|
2637
|
-
|
|
2638
|
-
|
|
2637
|
+
const s = String(patch.value);
|
|
2638
|
+
if (s !== this.element.value) {
|
|
2639
|
+
this.element.value = s;
|
|
2640
|
+
}
|
|
2641
|
+
} else if (this.entity === "option") {
|
|
2642
|
+
if (((_d = (_c = (_b = (_a = this.container) == null ? void 0 : _a.props) == null ? void 0 : _b.value) == null ? void 0 : _c.constructor) == null ? void 0 : _d.name) === "Array") {
|
|
2643
|
+
patch.selected = this.container.props.value.indexOf(patch.value) !== -1;
|
|
2644
|
+
} else if (typeof ((_f = (_e = this.container) == null ? void 0 : _e.props) == null ? void 0 : _f.value) === "string") {
|
|
2645
|
+
patch.selected = this.container.props.value === patch.value;
|
|
2639
2646
|
}
|
|
2640
2647
|
}
|
|
2641
2648
|
for (let a in this.props) {
|
|
@@ -2653,19 +2660,19 @@ var ComponentCore = class {
|
|
|
2653
2660
|
if (special_attributes.has(al)) continue;
|
|
2654
2661
|
if (patch === this.props || !lilact_default.defaultIsEqual(patch[a], this.props[a]) || force) {
|
|
2655
2662
|
if (events_set.has(al)) {
|
|
2656
|
-
(
|
|
2657
|
-
(
|
|
2663
|
+
(_g = this.event_detachers) != null ? _g : this.event_detachers = {};
|
|
2664
|
+
(_i = (_h = this.event_detachers)[al]) == null ? void 0 : _i.call(_h);
|
|
2658
2665
|
this.event_detachers[al] = lilact_default.addWrappedEventListener(this.element, al.substring(2), patch[a]);
|
|
2659
2666
|
} else if (capture_events_set.hasOwnProperty(al)) {
|
|
2660
2667
|
const alc = capture_events_set[al];
|
|
2661
|
-
(
|
|
2662
|
-
(
|
|
2668
|
+
(_j = this.event_detachers) != null ? _j : this.event_detachers = {};
|
|
2669
|
+
(_l = (_k = this.event_detachers)[al]) == null ? void 0 : _l.call(_k);
|
|
2663
2670
|
this.event_detachers[al] = lilact_default.addWrappedEventListener(this.element, alc.substring(2), patch[a], { capture: true });
|
|
2664
2671
|
} else if (a === "style") {
|
|
2665
2672
|
if (typeof patch.style === "string") {
|
|
2666
2673
|
this.element.style = patch.style;
|
|
2667
2674
|
} else {
|
|
2668
|
-
if ((
|
|
2675
|
+
if ((_m = this.props) == null ? void 0 : _m.style) {
|
|
2669
2676
|
if (typeof this.props.style === "string") {
|
|
2670
2677
|
this.element.style = "";
|
|
2671
2678
|
} else {
|
|
@@ -2686,16 +2693,16 @@ var ComponentCore = class {
|
|
|
2686
2693
|
Object.assign(this.element.style, patch.style);
|
|
2687
2694
|
}
|
|
2688
2695
|
} else if (boolean_html_attributes_set.has(a)) {
|
|
2689
|
-
|
|
2690
|
-
if (
|
|
2696
|
+
const v = toBool(patch[a]);
|
|
2697
|
+
if (v !== this.element[a]) {
|
|
2698
|
+
this.element[a] = v;
|
|
2699
|
+
}
|
|
2691
2700
|
} else if (a === "autoFocus") {
|
|
2692
2701
|
this.element["autofocus"] = toBool(patch[a]);
|
|
2693
2702
|
} else if (a === "htmlFor") {
|
|
2694
2703
|
this.element.setAttribute("for", patch[a]);
|
|
2695
|
-
} else {
|
|
2696
|
-
|
|
2697
|
-
this.element.setAttribute(al, patch[a]);
|
|
2698
|
-
}
|
|
2704
|
+
} else if (al !== "value" || ["input", "textarea", "select"].indexOf(this.entity) === -1) {
|
|
2705
|
+
this.element.setAttribute(al, patch[a]);
|
|
2699
2706
|
}
|
|
2700
2707
|
}
|
|
2701
2708
|
}
|
|
@@ -2704,8 +2711,6 @@ var ComponentCore = class {
|
|
|
2704
2711
|
} else {
|
|
2705
2712
|
this.element.onsubmit = void 0;
|
|
2706
2713
|
}
|
|
2707
|
-
if (true) {
|
|
2708
|
-
}
|
|
2709
2714
|
this.updateElementClass(patch);
|
|
2710
2715
|
}
|
|
2711
2716
|
updateElementClass(patch = this.props) {
|
|
@@ -3027,10 +3032,10 @@ var Component = class {
|
|
|
3027
3032
|
* @returns {void}
|
|
3028
3033
|
*/
|
|
3029
3034
|
forceUpdate(callback) {
|
|
3030
|
-
lilact_default.
|
|
3035
|
+
lilact_default._clearTimeout(lilact_default.update_timeout);
|
|
3031
3036
|
lilact_default.update_set.add(this[CORE].container || this[CORE]);
|
|
3032
3037
|
if (callback) lilact_default.update_cbs.add(callback.bind(this));
|
|
3033
|
-
lilact_default.update_timeout = lilact_default.
|
|
3038
|
+
lilact_default.update_timeout = lilact_default._setTimeout(doUpdates, lilact_default.update_interval_margin);
|
|
3034
3039
|
}
|
|
3035
3040
|
/**
|
|
3036
3041
|
* Update component state.
|
|
@@ -3319,6 +3324,7 @@ var boolean_html_attributes_set = /* @__PURE__ */ new Set([
|
|
|
3319
3324
|
"required",
|
|
3320
3325
|
"checked",
|
|
3321
3326
|
"multiple",
|
|
3327
|
+
"selected",
|
|
3322
3328
|
"hidden",
|
|
3323
3329
|
"open",
|
|
3324
3330
|
"loop",
|
|
@@ -3480,8 +3486,8 @@ async function useLayoutEffect(effect, deps = void 0) {
|
|
|
3480
3486
|
lilact_default.layout_effects.add(async () => {
|
|
3481
3487
|
hk.cleanup = await effect();
|
|
3482
3488
|
});
|
|
3483
|
-
lilact_default.
|
|
3484
|
-
lilact_default.
|
|
3489
|
+
lilact_default._clearTimeout(lilact_default.effect_timeout);
|
|
3490
|
+
lilact_default._setTimeout(lilact_default.processEffects, 0);
|
|
3485
3491
|
}
|
|
3486
3492
|
async function useEffect(effect, deps = void 0) {
|
|
3487
3493
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
@@ -3499,8 +3505,8 @@ async function useEffect(effect, deps = void 0) {
|
|
|
3499
3505
|
lilact_default.passive_effects.add(async () => {
|
|
3500
3506
|
hk.cleanup = await effect();
|
|
3501
3507
|
});
|
|
3502
|
-
lilact_default.
|
|
3503
|
-
lilact_default.
|
|
3508
|
+
lilact_default._clearTimeout(lilact_default.effect_timeout);
|
|
3509
|
+
lilact_default._setTimeout(lilact_default.processEffects, 0);
|
|
3504
3510
|
}
|
|
3505
3511
|
async function useInsertionEffect(effect, deps = void 0) {
|
|
3506
3512
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
@@ -3518,8 +3524,8 @@ async function useInsertionEffect(effect, deps = void 0) {
|
|
|
3518
3524
|
lilact_default.insertion_effects.add(async () => {
|
|
3519
3525
|
hk.cleanup = await effect();
|
|
3520
3526
|
});
|
|
3521
|
-
lilact_default.
|
|
3522
|
-
lilact_default.
|
|
3527
|
+
lilact_default._clearTimeout(lilact_default.effect_timeout);
|
|
3528
|
+
lilact_default._setTimeout(lilact_default.processEffects, 0);
|
|
3523
3529
|
}
|
|
3524
3530
|
function useMemo(factory, deps = void 0) {
|
|
3525
3531
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
@@ -3832,7 +3838,7 @@ function require2(path2) {
|
|
|
3832
3838
|
isInline: false,
|
|
3833
3839
|
isModule: true
|
|
3834
3840
|
});
|
|
3835
|
-
if (module2.loaded && !options.forceUpdate
|
|
3841
|
+
if (module2.loaded && !options.forceUpdate) {
|
|
3836
3842
|
return module2.exports;
|
|
3837
3843
|
}
|
|
3838
3844
|
if (path2.startsWith("#")) {
|
|
@@ -3953,167 +3959,6 @@ __export(transition_exports, {
|
|
|
3953
3959
|
Transition: () => Transition,
|
|
3954
3960
|
TransitionGroup: () => TransitionGroup
|
|
3955
3961
|
});
|
|
3956
|
-
|
|
3957
|
-
// .tmp/src/timers.jsx
|
|
3958
|
-
var timers_exports = {};
|
|
3959
|
-
__export(timers_exports, {
|
|
3960
|
-
animationFramePromise: () => animationFramePromise,
|
|
3961
|
-
clearInterval: () => clearInterval,
|
|
3962
|
-
clearTimeout: () => clearTimeout2,
|
|
3963
|
-
grabTimers: () => grabTimers,
|
|
3964
|
-
pauseTimers: () => pauseTimers,
|
|
3965
|
-
releaseTimers: () => releaseTimers,
|
|
3966
|
-
resetTimers: () => resetTimers,
|
|
3967
|
-
resumeTimers: () => resumeTimers,
|
|
3968
|
-
setInterval: () => setInterval,
|
|
3969
|
-
setTimeout: () => setTimeout2,
|
|
3970
|
-
timeoutPromise: () => timeoutPromise
|
|
3971
|
-
});
|
|
3972
|
-
var timer_pause_time = void 0;
|
|
3973
|
-
var current_timer_idx = -1;
|
|
3974
|
-
var timer_list = [];
|
|
3975
|
-
var timer_timeout = -1;
|
|
3976
|
-
var all_timers = {};
|
|
3977
|
-
var _setTimeout = window.setTimeout;
|
|
3978
|
-
var _setInterval = window.setInterval;
|
|
3979
|
-
var _clearTimeout = window.clearTimeout;
|
|
3980
|
-
var _clearInterval = window.clearInterval;
|
|
3981
|
-
function get_bucket(target) {
|
|
3982
|
-
let left = 0;
|
|
3983
|
-
let right = timer_list.length - 1;
|
|
3984
|
-
while (left <= right) {
|
|
3985
|
-
const mid = Math.floor((left + right) / 2);
|
|
3986
|
-
const mid_val = timer_list[mid][DUE];
|
|
3987
|
-
if (mid_val === target) {
|
|
3988
|
-
return [mid, timer_list[mid]];
|
|
3989
|
-
} else if (mid_val < target) {
|
|
3990
|
-
left = mid + 1;
|
|
3991
|
-
} else {
|
|
3992
|
-
right = mid - 1;
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3995
|
-
const bucket = [];
|
|
3996
|
-
bucket[DUE] = target;
|
|
3997
|
-
timer_list.splice(left, 0, bucket);
|
|
3998
|
-
return [left, bucket];
|
|
3999
|
-
}
|
|
4000
|
-
function add_timer(t, is_repeat = false) {
|
|
4001
|
-
const [i2, bucket] = get_bucket(t[DUE]);
|
|
4002
|
-
if (!is_repeat) {
|
|
4003
|
-
current_timer_idx++;
|
|
4004
|
-
all_timers[current_timer_idx] = t;
|
|
4005
|
-
t[IDX] = current_timer_idx;
|
|
4006
|
-
}
|
|
4007
|
-
bucket.push(t);
|
|
4008
|
-
if (timer_list[0][0] === t) {
|
|
4009
|
-
_clearTimeout(timer_timeout);
|
|
4010
|
-
timer_timeout = _setTimeout(run_timer, t[INTERVAL]);
|
|
4011
|
-
}
|
|
4012
|
-
return current_timer_idx;
|
|
4013
|
-
}
|
|
4014
|
-
function run_timer() {
|
|
4015
|
-
const now = Date.now();
|
|
4016
|
-
let i2 = 0;
|
|
4017
|
-
let buck = timer_list[i2];
|
|
4018
|
-
while (buck && buck[DUE] - now <= 0) {
|
|
4019
|
-
for (const t of buck) {
|
|
4020
|
-
if (!t[CLEARED]) {
|
|
4021
|
-
t[CALLBACK](...t[ARGS]);
|
|
4022
|
-
if (t[REPEAT]) {
|
|
4023
|
-
t[DUE] = Date.now() + t[INTERVAL];
|
|
4024
|
-
add_timer(t, true);
|
|
4025
|
-
} else {
|
|
4026
|
-
delete all_timers[t[IDX]];
|
|
4027
|
-
}
|
|
4028
|
-
} else {
|
|
4029
|
-
delete all_timers[t[IDX]];
|
|
4030
|
-
}
|
|
4031
|
-
}
|
|
4032
|
-
i2++;
|
|
4033
|
-
buck = timer_list[i2];
|
|
4034
|
-
}
|
|
4035
|
-
timer_list.splice(0, i2);
|
|
4036
|
-
if (timer_list.length > 0) {
|
|
4037
|
-
_clearTimeout(timer_timeout);
|
|
4038
|
-
timer_timeout = _setTimeout(run_timer, timer_list[0][DUE] - now);
|
|
4039
|
-
}
|
|
4040
|
-
}
|
|
4041
|
-
function resetTimers() {
|
|
4042
|
-
_clearTimeout(timer_timeout);
|
|
4043
|
-
timer_pause_time = void 0;
|
|
4044
|
-
current_timer_idx = -1;
|
|
4045
|
-
timer_list = [];
|
|
4046
|
-
timer_timeout = -1;
|
|
4047
|
-
all_timers = {};
|
|
4048
|
-
}
|
|
4049
|
-
function pauseTimers() {
|
|
4050
|
-
_clearTimeout(timer_timeout);
|
|
4051
|
-
timer_pause_time = Date.now();
|
|
4052
|
-
}
|
|
4053
|
-
function resumeTimers() {
|
|
4054
|
-
if (!timer_pause_time) return;
|
|
4055
|
-
if (timer_list.length > 0) {
|
|
4056
|
-
const now = Date.now();
|
|
4057
|
-
timer_pause_time -= now;
|
|
4058
|
-
for (const t of timer_list) {
|
|
4059
|
-
t[DUE] -= timer_pause_time;
|
|
4060
|
-
}
|
|
4061
|
-
timer_timeout = _setTimeout(run_timer, timer_list[0][DUE] - now);
|
|
4062
|
-
}
|
|
4063
|
-
timer_pause_time = void 0;
|
|
4064
|
-
}
|
|
4065
|
-
function setTimeout2(callback, delay, ...args) {
|
|
4066
|
-
return add_timer({ [CALLBACK]: callback, [INTERVAL]: delay, [DUE]: Date.now() + delay, [REPEAT]: false, [ARGS]: args });
|
|
4067
|
-
}
|
|
4068
|
-
function setInterval(callback, interval, ...args) {
|
|
4069
|
-
return add_timer({ [CALLBACK]: callback, [INTERVAL]: interval, [DUE]: Date.now() + interval, [REPEAT]: true, [ARGS]: args });
|
|
4070
|
-
}
|
|
4071
|
-
function clearTimeout2(id) {
|
|
4072
|
-
if (all_timers[id]) all_timers[id][CLEARED] = true;
|
|
4073
|
-
}
|
|
4074
|
-
function clearInterval(id) {
|
|
4075
|
-
if (all_timers[id]) all_timers[id][CLEARED] = true;
|
|
4076
|
-
}
|
|
4077
|
-
function grabTimers() {
|
|
4078
|
-
globalThis.setTimeout = Lilact.setTimeout;
|
|
4079
|
-
globalThis.setInterval = Lilact.setInterval;
|
|
4080
|
-
globalThis.clearTimeout = Lilact.clearTimeout;
|
|
4081
|
-
globalThis.clearInterval = Lilact.clearInterval;
|
|
4082
|
-
}
|
|
4083
|
-
function releaseTimers() {
|
|
4084
|
-
globalThis.setTimeout = _setTimeout;
|
|
4085
|
-
globalThis.setInterval = _setInterval;
|
|
4086
|
-
globalThis.clearTimeout = _clearTimeout;
|
|
4087
|
-
globalThis.clearInterval = _clearInterval;
|
|
4088
|
-
}
|
|
4089
|
-
function timeoutPromise(duration = 0, timerSource = Lilact) {
|
|
4090
|
-
let id, resolve, reject;
|
|
4091
|
-
const promise = new Promise((res, rej) => {
|
|
4092
|
-
resolve = res;
|
|
4093
|
-
reject = rej;
|
|
4094
|
-
id = timerSource.setTimeout(() => {
|
|
4095
|
-
resolve();
|
|
4096
|
-
}, duration);
|
|
4097
|
-
});
|
|
4098
|
-
promise.proceed = () => {
|
|
4099
|
-
timerSource.clearTimeout(id);
|
|
4100
|
-
resolve();
|
|
4101
|
-
};
|
|
4102
|
-
promise.cancel = () => {
|
|
4103
|
-
timerSource.clearTimeout(id);
|
|
4104
|
-
reject();
|
|
4105
|
-
};
|
|
4106
|
-
return promise;
|
|
4107
|
-
}
|
|
4108
|
-
function animationFramePromise() {
|
|
4109
|
-
return new Promise((resolve) => {
|
|
4110
|
-
requestAnimationFrame(() => {
|
|
4111
|
-
resolve();
|
|
4112
|
-
});
|
|
4113
|
-
});
|
|
4114
|
-
}
|
|
4115
|
-
|
|
4116
|
-
// .tmp/src/transition.jsx
|
|
4117
3962
|
var UNMOUNTED = "unmounted";
|
|
4118
3963
|
var EXITED = "exited";
|
|
4119
3964
|
var ENTERING = "entering";
|
|
@@ -4151,15 +3996,15 @@ function Transition({
|
|
|
4151
3996
|
} else this[CORE].mount_state = EXITED;
|
|
4152
3997
|
}
|
|
4153
3998
|
useEffect(() => {
|
|
4154
|
-
return () =>
|
|
3999
|
+
return () => clearTimeout(this[CORE].timer);
|
|
4155
4000
|
}, []);
|
|
4156
4001
|
useEffect(() => {
|
|
4157
4002
|
if (!this[CORE].is_appeared && appear && this[CORE].mount_state === ENTERING && inProp) {
|
|
4158
4003
|
onEnter == null ? void 0 : onEnter();
|
|
4159
4004
|
requestAnimationFrame(() => {
|
|
4160
4005
|
onEntering == null ? void 0 : onEntering(!this[CORE].is_appeared);
|
|
4161
|
-
|
|
4162
|
-
this[CORE].timer =
|
|
4006
|
+
clearTimeout(this[CORE].timer);
|
|
4007
|
+
this[CORE].timer = setTimeout(() => {
|
|
4163
4008
|
this[CORE].mount_state = ENTERED;
|
|
4164
4009
|
this.forceUpdate();
|
|
4165
4010
|
this[CORE].is_appeared = true;
|
|
@@ -4176,8 +4021,8 @@ function Transition({
|
|
|
4176
4021
|
this[CORE].mount_state = ENTERING;
|
|
4177
4022
|
this.forceUpdate(() => {
|
|
4178
4023
|
onEntering == null ? void 0 : onEntering(!this[CORE].is_appeared);
|
|
4179
|
-
|
|
4180
|
-
this[CORE].timer =
|
|
4024
|
+
clearTimeout(this[CORE].timer);
|
|
4025
|
+
this[CORE].timer = setTimeout(() => {
|
|
4181
4026
|
this[CORE].mount_state = ENTERED;
|
|
4182
4027
|
this.forceUpdate();
|
|
4183
4028
|
this[CORE].is_appeared = true;
|
|
@@ -4190,8 +4035,8 @@ function Transition({
|
|
|
4190
4035
|
this[CORE].mount_state = EXITING;
|
|
4191
4036
|
this.forceUpdate(() => {
|
|
4192
4037
|
onExiting == null ? void 0 : onExiting();
|
|
4193
|
-
|
|
4194
|
-
this[CORE].timer =
|
|
4038
|
+
clearTimeout(this[CORE].timer);
|
|
4039
|
+
this[CORE].timer = setTimeout(() => {
|
|
4195
4040
|
this[CORE].mount_state = EXITED;
|
|
4196
4041
|
this.forceUpdate();
|
|
4197
4042
|
onExited == null ? void 0 : onExited();
|
|
@@ -4607,6 +4452,167 @@ function combineReducers2(reducers) {
|
|
|
4607
4452
|
};
|
|
4608
4453
|
}
|
|
4609
4454
|
|
|
4455
|
+
// .tmp/src/timers.jsx
|
|
4456
|
+
var timers_exports = {};
|
|
4457
|
+
__export(timers_exports, {
|
|
4458
|
+
animationFramePromise: () => animationFramePromise,
|
|
4459
|
+
clearInterval: () => clearInterval,
|
|
4460
|
+
clearTimeout: () => clearTimeout2,
|
|
4461
|
+
grabTimers: () => grabTimers,
|
|
4462
|
+
pauseTimers: () => pauseTimers,
|
|
4463
|
+
releaseTimers: () => releaseTimers,
|
|
4464
|
+
resetTimers: () => resetTimers,
|
|
4465
|
+
resumeTimers: () => resumeTimers,
|
|
4466
|
+
setInterval: () => setInterval,
|
|
4467
|
+
setTimeout: () => setTimeout2,
|
|
4468
|
+
timeoutPromise: () => timeoutPromise
|
|
4469
|
+
});
|
|
4470
|
+
var timer_pause_time = void 0;
|
|
4471
|
+
var current_timer_idx = -1;
|
|
4472
|
+
var timer_list = [];
|
|
4473
|
+
var timer_timeout = -1;
|
|
4474
|
+
var all_timers = {};
|
|
4475
|
+
var _setTimeout = window.setTimeout;
|
|
4476
|
+
var _setInterval = window.setInterval;
|
|
4477
|
+
var _clearTimeout = window.clearTimeout;
|
|
4478
|
+
var _clearInterval = window.clearInterval;
|
|
4479
|
+
function get_bucket(target) {
|
|
4480
|
+
let left = 0;
|
|
4481
|
+
let right = timer_list.length - 1;
|
|
4482
|
+
while (left <= right) {
|
|
4483
|
+
const mid = Math.floor((left + right) / 2);
|
|
4484
|
+
const mid_val = timer_list[mid][DUE];
|
|
4485
|
+
if (mid_val === target) {
|
|
4486
|
+
return [mid, timer_list[mid]];
|
|
4487
|
+
} else if (mid_val < target) {
|
|
4488
|
+
left = mid + 1;
|
|
4489
|
+
} else {
|
|
4490
|
+
right = mid - 1;
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
const bucket = [];
|
|
4494
|
+
bucket[DUE] = target;
|
|
4495
|
+
timer_list.splice(left, 0, bucket);
|
|
4496
|
+
return [left, bucket];
|
|
4497
|
+
}
|
|
4498
|
+
function add_timer(t, is_repeat = false) {
|
|
4499
|
+
const [i2, bucket] = get_bucket(t[DUE]);
|
|
4500
|
+
if (!is_repeat) {
|
|
4501
|
+
current_timer_idx++;
|
|
4502
|
+
all_timers[current_timer_idx] = t;
|
|
4503
|
+
t[IDX] = current_timer_idx;
|
|
4504
|
+
}
|
|
4505
|
+
bucket.push(t);
|
|
4506
|
+
if (timer_list[0][0] === t) {
|
|
4507
|
+
_clearTimeout(timer_timeout);
|
|
4508
|
+
timer_timeout = _setTimeout(run_timer, t[INTERVAL]);
|
|
4509
|
+
}
|
|
4510
|
+
return current_timer_idx;
|
|
4511
|
+
}
|
|
4512
|
+
function run_timer() {
|
|
4513
|
+
const now = Date.now();
|
|
4514
|
+
let i2 = 0;
|
|
4515
|
+
let buck = timer_list[i2];
|
|
4516
|
+
while (buck && buck[DUE] - now <= 0) {
|
|
4517
|
+
for (const t of buck) {
|
|
4518
|
+
if (!t[CLEARED]) {
|
|
4519
|
+
t[CALLBACK](...t[ARGS]);
|
|
4520
|
+
if (t[REPEAT]) {
|
|
4521
|
+
t[DUE] = Date.now() + t[INTERVAL];
|
|
4522
|
+
add_timer(t, true);
|
|
4523
|
+
} else {
|
|
4524
|
+
delete all_timers[t[IDX]];
|
|
4525
|
+
}
|
|
4526
|
+
} else {
|
|
4527
|
+
delete all_timers[t[IDX]];
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4530
|
+
i2++;
|
|
4531
|
+
buck = timer_list[i2];
|
|
4532
|
+
}
|
|
4533
|
+
timer_list.splice(0, i2);
|
|
4534
|
+
if (timer_list.length > 0) {
|
|
4535
|
+
_clearTimeout(timer_timeout);
|
|
4536
|
+
timer_timeout = _setTimeout(run_timer, timer_list[0][DUE] - now);
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4539
|
+
function resetTimers() {
|
|
4540
|
+
_clearTimeout(timer_timeout);
|
|
4541
|
+
timer_pause_time = void 0;
|
|
4542
|
+
current_timer_idx = -1;
|
|
4543
|
+
timer_list = [];
|
|
4544
|
+
timer_timeout = -1;
|
|
4545
|
+
all_timers = {};
|
|
4546
|
+
}
|
|
4547
|
+
function pauseTimers() {
|
|
4548
|
+
_clearTimeout(timer_timeout);
|
|
4549
|
+
timer_pause_time = Date.now();
|
|
4550
|
+
}
|
|
4551
|
+
function resumeTimers() {
|
|
4552
|
+
if (!timer_pause_time) return;
|
|
4553
|
+
if (timer_list.length > 0) {
|
|
4554
|
+
const now = Date.now();
|
|
4555
|
+
timer_pause_time -= now;
|
|
4556
|
+
for (const t of timer_list) {
|
|
4557
|
+
t[DUE] -= timer_pause_time;
|
|
4558
|
+
}
|
|
4559
|
+
timer_timeout = _setTimeout(run_timer, timer_list[0][DUE] - now);
|
|
4560
|
+
}
|
|
4561
|
+
timer_pause_time = void 0;
|
|
4562
|
+
}
|
|
4563
|
+
function setTimeout2(callback, delay, ...args) {
|
|
4564
|
+
return add_timer({ [CALLBACK]: callback, [INTERVAL]: delay, [DUE]: Date.now() + delay, [REPEAT]: false, [ARGS]: args });
|
|
4565
|
+
}
|
|
4566
|
+
function setInterval(callback, interval, ...args) {
|
|
4567
|
+
return add_timer({ [CALLBACK]: callback, [INTERVAL]: interval, [DUE]: Date.now() + interval, [REPEAT]: true, [ARGS]: args });
|
|
4568
|
+
}
|
|
4569
|
+
function clearTimeout2(id) {
|
|
4570
|
+
if (all_timers[id]) all_timers[id][CLEARED] = true;
|
|
4571
|
+
else _clearTimeout(id);
|
|
4572
|
+
}
|
|
4573
|
+
function clearInterval(id) {
|
|
4574
|
+
if (all_timers[id]) all_timers[id][CLEARED] = true;
|
|
4575
|
+
else _clearInterval(id);
|
|
4576
|
+
}
|
|
4577
|
+
function grabTimers() {
|
|
4578
|
+
globalThis.setTimeout = Lilact.setTimeout;
|
|
4579
|
+
globalThis.setInterval = Lilact.setInterval;
|
|
4580
|
+
globalThis.clearTimeout = Lilact.clearTimeout;
|
|
4581
|
+
globalThis.clearInterval = Lilact.clearInterval;
|
|
4582
|
+
}
|
|
4583
|
+
function releaseTimers() {
|
|
4584
|
+
globalThis.setTimeout = _setTimeout;
|
|
4585
|
+
globalThis.setInterval = _setInterval;
|
|
4586
|
+
globalThis.clearTimeout = _clearTimeout;
|
|
4587
|
+
globalThis.clearInterval = _clearInterval;
|
|
4588
|
+
}
|
|
4589
|
+
function timeoutPromise(duration = 0, timerSource = Lilact) {
|
|
4590
|
+
let id, resolve, reject;
|
|
4591
|
+
const promise = new Promise((res, rej) => {
|
|
4592
|
+
resolve = res;
|
|
4593
|
+
reject = rej;
|
|
4594
|
+
id = timerSource.setTimeout(() => {
|
|
4595
|
+
resolve();
|
|
4596
|
+
}, duration);
|
|
4597
|
+
});
|
|
4598
|
+
promise.proceed = () => {
|
|
4599
|
+
timerSource.clearTimeout(id);
|
|
4600
|
+
resolve();
|
|
4601
|
+
};
|
|
4602
|
+
promise.cancel = () => {
|
|
4603
|
+
timerSource.clearTimeout(id);
|
|
4604
|
+
reject();
|
|
4605
|
+
};
|
|
4606
|
+
return promise;
|
|
4607
|
+
}
|
|
4608
|
+
function animationFramePromise() {
|
|
4609
|
+
return new Promise((resolve) => {
|
|
4610
|
+
requestAnimationFrame(() => {
|
|
4611
|
+
resolve();
|
|
4612
|
+
});
|
|
4613
|
+
});
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4610
4616
|
// .tmp/src/errors.jsx
|
|
4611
4617
|
var errors_exports = {};
|
|
4612
4618
|
__export(errors_exports, {
|
|
@@ -5115,11 +5121,11 @@ var Suspense = class extends Component {
|
|
|
5115
5121
|
/** @ignore */
|
|
5116
5122
|
_clearTimers() {
|
|
5117
5123
|
if (this._delayTimer) {
|
|
5118
|
-
|
|
5124
|
+
clearTimeout(this._delayTimer);
|
|
5119
5125
|
this._delayTimer = null;
|
|
5120
5126
|
}
|
|
5121
5127
|
if (this._minShowTimer) {
|
|
5122
|
-
|
|
5128
|
+
clearTimeout(this._minShowTimer);
|
|
5123
5129
|
this._minShowTimer = null;
|
|
5124
5130
|
}
|
|
5125
5131
|
}
|
|
@@ -5130,10 +5136,10 @@ var Suspense = class extends Component {
|
|
|
5130
5136
|
if (this._pending.size === 1) {
|
|
5131
5137
|
const delay = Math.max(0, this.props.minDelay);
|
|
5132
5138
|
if (this._delayTimer) {
|
|
5133
|
-
|
|
5139
|
+
clearTimeout(this._delayTimer);
|
|
5134
5140
|
this._delayTimer = null;
|
|
5135
5141
|
}
|
|
5136
|
-
this._delayTimer =
|
|
5142
|
+
this._delayTimer = setTimeout(() => {
|
|
5137
5143
|
this._delayTimer = null;
|
|
5138
5144
|
this._fallbackShownAt = Date.now();
|
|
5139
5145
|
this.setState({ showingFallback: true });
|
|
@@ -5145,7 +5151,7 @@ var Suspense = class extends Component {
|
|
|
5145
5151
|
}
|
|
5146
5152
|
if (this._pending.size === 0) {
|
|
5147
5153
|
if (this._delayTimer) {
|
|
5148
|
-
|
|
5154
|
+
clearTimeout(this._delayTimer);
|
|
5149
5155
|
this._delayTimer = null;
|
|
5150
5156
|
this.setState({ showingFallback: false });
|
|
5151
5157
|
return;
|
|
@@ -5156,10 +5162,10 @@ var Suspense = class extends Component {
|
|
|
5156
5162
|
this.setState({ showingFallback: false });
|
|
5157
5163
|
} else {
|
|
5158
5164
|
if (this._minShowTimer) {
|
|
5159
|
-
|
|
5165
|
+
clearTimeout(this._minShowTimer);
|
|
5160
5166
|
this._minShowTimer = null;
|
|
5161
5167
|
}
|
|
5162
|
-
this._minShowTimer =
|
|
5168
|
+
this._minShowTimer = setTimeout(() => {
|
|
5163
5169
|
this._minShowTimer = null;
|
|
5164
5170
|
this.setState({ showingFallback: false });
|
|
5165
5171
|
}, remaining);
|
|
@@ -5839,11 +5845,11 @@ function processImportExports(node3, jsx2) {
|
|
|
5839
5845
|
node3.out[i2] = null;
|
|
5840
5846
|
}
|
|
5841
5847
|
let cjs = "";
|
|
5842
|
-
for (const s2 of
|
|
5848
|
+
for (const s2 of star_imports) {
|
|
5843
5849
|
cjs += `const ${s2} = require(${src},{requirer:module});
|
|
5844
5850
|
`;
|
|
5845
5851
|
}
|
|
5846
|
-
for (const s2 of
|
|
5852
|
+
for (const s2 of import_alls) {
|
|
5847
5853
|
cjs += `const ${s2} = require(${src},{requirer:module, checkExport: ['default']}).default;
|
|
5848
5854
|
`;
|
|
5849
5855
|
}
|
|
@@ -6891,7 +6897,11 @@ var Lilact2 = {
|
|
|
6891
6897
|
// Dependencies
|
|
6892
6898
|
PropTypes,
|
|
6893
6899
|
redux: redux_exports,
|
|
6894
|
-
emotion: emotion_css_esm_exports
|
|
6900
|
+
emotion: emotion_css_esm_exports,
|
|
6901
|
+
_setTimeout: window.setTimeout.bind(window),
|
|
6902
|
+
_setInterval: window.setInterval.bind(window),
|
|
6903
|
+
_clearTimeout: window.clearTimeout.bind(window),
|
|
6904
|
+
_clearInterval: window.clearInterval.bind(window)
|
|
6895
6905
|
};
|
|
6896
6906
|
Lilact2.default = Lilact2;
|
|
6897
6907
|
var lilact_default = Lilact2;
|
|
@@ -6905,6 +6915,7 @@ globalThis.createComponent = Lilact2.createComponent;
|
|
|
6905
6915
|
globalThis.Fragment = Lilact2.Fragment;
|
|
6906
6916
|
globalThis.require = Lilact2.require;
|
|
6907
6917
|
document.addEventListener("DOMContentLoaded", () => {
|
|
6918
|
+
Lilact2.grabTimers();
|
|
6908
6919
|
Lilact2.runScripts().catch((error2) => {
|
|
6909
6920
|
var _a;
|
|
6910
6921
|
(_a = Lilact2.globalErrorHandler) == null ? void 0 : _a.call(Lilact2, error2);
|