lilact 0.31.4 → 0.31.5
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 +25 -24
- package/dist/lilact.development.js.map +2 -2
- package/dist/lilact.development.min.js +19 -19
- package/dist/lilact.development.min.js.map +2 -2
- package/dist/lilact.production.min.js +20 -20
- package/docs/functions/timers.animationFramePromise.html +1 -1
- package/docs/functions/timers.clearInterval.html +1 -1
- package/docs/functions/timers.clearTimeout.html +1 -1
- package/docs/functions/timers.grabTimers.html +1 -1
- package/docs/functions/timers.pauseTimers.html +1 -1
- package/docs/functions/timers.releaseTimers.html +1 -1
- package/docs/functions/timers.resetTimers.html +1 -1
- package/docs/functions/timers.resumeTimers.html +1 -1
- package/docs/functions/timers.setInterval.html +1 -1
- package/docs/functions/timers.setTimeout.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +1 -1
- package/docs/static/lilact.development.js +25 -24
- package/docs/static/lilact.development.js.map +2 -2
- package/docs/static/lilact.development.min.js +19 -19
- package/docs/static/lilact.development.min.js.map +2 -2
- package/docs/static/lilact.production.min.js +20 -20
- package/examples/lilact.development.js +25 -24
- package/examples/lilact.development.js.map +2 -2
- package/examples/lilact.development.min.js +19 -19
- package/examples/lilact.development.min.js.map +2 -2
- package/examples/lilact.production.min.js +20 -20
- package/package.json +1 -1
- package/src/components.jsx +2 -2
- package/src/hooks.jsx +6 -6
- package/src/lilact.jsx +0 -6
- package/src/timers.jsx +29 -19
|
@@ -3160,10 +3160,10 @@ var Component = class {
|
|
|
3160
3160
|
* @returns {void}
|
|
3161
3161
|
*/
|
|
3162
3162
|
forceUpdate(callback) {
|
|
3163
|
-
|
|
3163
|
+
NATIVE_TIMERS.clearTimeout(lilact_default.update_timeout);
|
|
3164
3164
|
lilact_default.update_set.add(this[CORE].container || this[CORE]);
|
|
3165
3165
|
if (callback) lilact_default.update_cbs.add(callback.bind(this));
|
|
3166
|
-
lilact_default.update_timeout =
|
|
3166
|
+
lilact_default.update_timeout = NATIVE_TIMERS.setTimeout(doUpdates, lilact_default.update_interval_margin);
|
|
3167
3167
|
}
|
|
3168
3168
|
/**
|
|
3169
3169
|
* Update component state.
|
|
@@ -3617,8 +3617,8 @@ async function useLayoutEffect(effect, deps = void 0) {
|
|
|
3617
3617
|
lilact_default.layout_effects.add(async () => {
|
|
3618
3618
|
hk.cleanup = await effect();
|
|
3619
3619
|
});
|
|
3620
|
-
|
|
3621
|
-
lilact_default.
|
|
3620
|
+
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3621
|
+
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3622
3622
|
}
|
|
3623
3623
|
async function useEffect(effect, deps = void 0) {
|
|
3624
3624
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
@@ -3636,8 +3636,8 @@ async function useEffect(effect, deps = void 0) {
|
|
|
3636
3636
|
lilact_default.passive_effects.add(async () => {
|
|
3637
3637
|
hk.cleanup = await effect();
|
|
3638
3638
|
});
|
|
3639
|
-
|
|
3640
|
-
lilact_default.
|
|
3639
|
+
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3640
|
+
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3641
3641
|
}
|
|
3642
3642
|
async function useInsertionEffect(effect, deps = void 0) {
|
|
3643
3643
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
@@ -3655,8 +3655,8 @@ async function useInsertionEffect(effect, deps = void 0) {
|
|
|
3655
3655
|
lilact_default.insertion_effects.add(async () => {
|
|
3656
3656
|
hk.cleanup = await effect();
|
|
3657
3657
|
});
|
|
3658
|
-
|
|
3659
|
-
lilact_default.
|
|
3658
|
+
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3659
|
+
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3660
3660
|
}
|
|
3661
3661
|
function useMemo(factory, deps = void 0) {
|
|
3662
3662
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
@@ -4641,6 +4641,11 @@ var timer_pause_time;
|
|
|
4641
4641
|
var current_timer_idx = 0;
|
|
4642
4642
|
var timer_list = [];
|
|
4643
4643
|
var timer_timeout = 0;
|
|
4644
|
+
globalThis.NATIVE_TIMERS ?? (globalThis.NATIVE_TIMERS = {});
|
|
4645
|
+
NATIVE_TIMERS.setTimeout ?? (NATIVE_TIMERS.setTimeout = globalThis.setTimeout.bind(globalThis));
|
|
4646
|
+
NATIVE_TIMERS.setInterval ?? (NATIVE_TIMERS.setInterval = globalThis.setInterval.bind(globalThis));
|
|
4647
|
+
NATIVE_TIMERS.clearTimeout ?? (NATIVE_TIMERS.clearTimeout = globalThis.clearTimeout.bind(globalThis));
|
|
4648
|
+
NATIVE_TIMERS.clearInterval ?? (NATIVE_TIMERS.clearInterval = globalThis.clearInterval.bind(globalThis));
|
|
4644
4649
|
var all_timers = /* @__PURE__ */ new Map();
|
|
4645
4650
|
function get_bucket(target) {
|
|
4646
4651
|
let left = 0;
|
|
@@ -4666,12 +4671,12 @@ function schedule_next_timer() {
|
|
|
4666
4671
|
if (timer_pause_time !== void 0 || timer_list.length === 0) {
|
|
4667
4672
|
return;
|
|
4668
4673
|
}
|
|
4669
|
-
|
|
4674
|
+
NATIVE_TIMERS.clearTimeout(timer_timeout);
|
|
4670
4675
|
const delay = Math.max(
|
|
4671
4676
|
0,
|
|
4672
4677
|
timer_list[0][DUE] - Date.now()
|
|
4673
4678
|
);
|
|
4674
|
-
timer_timeout =
|
|
4679
|
+
timer_timeout = NATIVE_TIMERS.setTimeout(run_timer, delay);
|
|
4675
4680
|
}
|
|
4676
4681
|
function add_timer(timer, is_repeat = false) {
|
|
4677
4682
|
const [bucket_index, bucket] = get_bucket(timer[DUE]);
|
|
@@ -4726,13 +4731,13 @@ function run_timer() {
|
|
|
4726
4731
|
}
|
|
4727
4732
|
schedule_next_timer();
|
|
4728
4733
|
if (first_error !== void 0) {
|
|
4729
|
-
|
|
4734
|
+
NATIVE_TIMERS.setTimeout(() => {
|
|
4730
4735
|
throw first_error;
|
|
4731
4736
|
}, 0);
|
|
4732
4737
|
}
|
|
4733
4738
|
}
|
|
4734
4739
|
function resetTimers() {
|
|
4735
|
-
|
|
4740
|
+
NATIVE_TIMERS.clearTimeout(timer_timeout);
|
|
4736
4741
|
for (const timer of all_timers.values()) {
|
|
4737
4742
|
timer[CLEARED] = true;
|
|
4738
4743
|
}
|
|
@@ -4746,7 +4751,7 @@ function pauseTimers() {
|
|
|
4746
4751
|
if (timer_pause_time !== void 0) {
|
|
4747
4752
|
return;
|
|
4748
4753
|
}
|
|
4749
|
-
|
|
4754
|
+
NATIVE_TIMERS.clearTimeout(timer_timeout);
|
|
4750
4755
|
timer_timeout = -1;
|
|
4751
4756
|
timer_pause_time = Date.now();
|
|
4752
4757
|
}
|
|
@@ -4788,7 +4793,7 @@ function clearTimeout2(id) {
|
|
|
4788
4793
|
if (timer !== void 0) {
|
|
4789
4794
|
timer[CLEARED] = true;
|
|
4790
4795
|
} else {
|
|
4791
|
-
|
|
4796
|
+
NATIVE_TIMERS.clearTimeout(id);
|
|
4792
4797
|
}
|
|
4793
4798
|
}
|
|
4794
4799
|
function clearInterval(id) {
|
|
@@ -4796,7 +4801,7 @@ function clearInterval(id) {
|
|
|
4796
4801
|
if (timer !== void 0) {
|
|
4797
4802
|
timer[CLEARED] = true;
|
|
4798
4803
|
} else {
|
|
4799
|
-
|
|
4804
|
+
_clearInterval(id);
|
|
4800
4805
|
}
|
|
4801
4806
|
}
|
|
4802
4807
|
function grabTimers() {
|
|
@@ -4806,10 +4811,10 @@ function grabTimers() {
|
|
|
4806
4811
|
globalThis.clearInterval = Lilact.clearInterval;
|
|
4807
4812
|
}
|
|
4808
4813
|
function releaseTimers() {
|
|
4809
|
-
globalThis.setTimeout =
|
|
4810
|
-
globalThis.setInterval =
|
|
4811
|
-
globalThis.clearTimeout =
|
|
4812
|
-
globalThis.clearInterval =
|
|
4814
|
+
globalThis.setTimeout = NATIVE_TIMERS.setTimeout;
|
|
4815
|
+
globalThis.setInterval = NATIVE_TIMERS.setInterval;
|
|
4816
|
+
globalThis.clearTimeout = NATIVE_TIMERS.clearTimeout;
|
|
4817
|
+
globalThis.clearInterval = NATIVE_TIMERS.clearInterval;
|
|
4813
4818
|
}
|
|
4814
4819
|
function timeoutPromise(duration = 0, timerSource = Lilact) {
|
|
4815
4820
|
let id;
|
|
@@ -7147,11 +7152,7 @@ var Lilact2 = {
|
|
|
7147
7152
|
// Dependencies
|
|
7148
7153
|
PropTypes,
|
|
7149
7154
|
redux: redux_exports,
|
|
7150
|
-
emotion: emotion_css_esm_exports
|
|
7151
|
-
_setTimeout: globalThis.setTimeout.bind(globalThis),
|
|
7152
|
-
_setInterval: globalThis.setInterval.bind(globalThis),
|
|
7153
|
-
_clearTimeout: globalThis.clearTimeout.bind(globalThis),
|
|
7154
|
-
_clearInterval: globalThis.clearInterval.bind(globalThis)
|
|
7155
|
+
emotion: emotion_css_esm_exports
|
|
7155
7156
|
};
|
|
7156
7157
|
Lilact2.default = Lilact2;
|
|
7157
7158
|
var lilact_default = Lilact2;
|