bits-ui 2.11.1 → 2.11.3
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.
|
@@ -25,7 +25,7 @@ export class TooltipProviderState {
|
|
|
25
25
|
this.opts = opts;
|
|
26
26
|
this.#timerFn = new TimeoutFn(() => {
|
|
27
27
|
this.isOpenDelayed = true;
|
|
28
|
-
}, this.opts.skipDelayDuration.current
|
|
28
|
+
}, this.opts.skipDelayDuration.current);
|
|
29
29
|
}
|
|
30
30
|
#startTimer = () => {
|
|
31
31
|
const skipDuration = this.opts.skipDelayDuration.current;
|
|
@@ -86,7 +86,7 @@ export class TooltipRootState {
|
|
|
86
86
|
this.#timerFn = new TimeoutFn(() => {
|
|
87
87
|
this.#wasOpenDelayed = true;
|
|
88
88
|
this.opts.open.current = true;
|
|
89
|
-
}, this.delayDuration ?? 0
|
|
89
|
+
}, this.delayDuration ?? 0);
|
|
90
90
|
new OpenChangeComplete({
|
|
91
91
|
open: this.opts.open,
|
|
92
92
|
ref: boxWith(() => this.contentNode),
|
|
@@ -100,7 +100,7 @@ export class TooltipRootState {
|
|
|
100
100
|
this.#timerFn = new TimeoutFn(() => {
|
|
101
101
|
this.#wasOpenDelayed = true;
|
|
102
102
|
this.opts.open.current = true;
|
|
103
|
-
}, this.delayDuration
|
|
103
|
+
}, this.delayDuration);
|
|
104
104
|
});
|
|
105
105
|
watch(() => this.opts.open.current, (isOpen) => {
|
|
106
106
|
if (isOpen) {
|
|
@@ -109,7 +109,7 @@ export class TooltipRootState {
|
|
|
109
109
|
else {
|
|
110
110
|
this.provider.onClose(this);
|
|
111
111
|
}
|
|
112
|
-
});
|
|
112
|
+
}, { lazy: true });
|
|
113
113
|
}
|
|
114
114
|
handleOpen = () => {
|
|
115
115
|
this.#timerFn.stop();
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import type { AnyFn } from "./types.js";
|
|
2
|
-
type TimeoutFnOptions = {
|
|
3
|
-
/**
|
|
4
|
-
* Start the timer immediate after calling this function
|
|
5
|
-
*
|
|
6
|
-
* @default true
|
|
7
|
-
*/
|
|
8
|
-
immediate?: boolean;
|
|
9
|
-
};
|
|
10
2
|
export declare class TimeoutFn<T extends AnyFn> {
|
|
11
3
|
#private;
|
|
12
|
-
constructor(cb: T, interval: number
|
|
4
|
+
constructor(cb: T, interval: number);
|
|
13
5
|
stop(): void;
|
|
14
6
|
start(...args: Parameters<T> | []): void;
|
|
15
7
|
}
|
|
16
|
-
export {};
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { onDestroyEffect } from "svelte-toolbelt";
|
|
2
|
-
import { BROWSER } from "esm-env";
|
|
3
|
-
const defaultOpts = {
|
|
4
|
-
immediate: true,
|
|
5
|
-
};
|
|
6
2
|
export class TimeoutFn {
|
|
7
|
-
#opts;
|
|
8
3
|
#interval;
|
|
9
4
|
#cb;
|
|
10
5
|
#timer = null;
|
|
11
|
-
constructor(cb, interval
|
|
6
|
+
constructor(cb, interval) {
|
|
12
7
|
this.#cb = cb;
|
|
13
8
|
this.#interval = interval;
|
|
14
|
-
this.#opts = { ...defaultOpts, ...opts };
|
|
15
9
|
this.stop = this.stop.bind(this);
|
|
16
10
|
this.start = this.start.bind(this);
|
|
17
|
-
if (this.#opts.immediate && BROWSER) {
|
|
18
|
-
this.start();
|
|
19
|
-
}
|
|
20
11
|
onDestroyEffect(this.stop);
|
|
21
12
|
}
|
|
22
13
|
#clear() {
|