@intechstudio/grid-uikit 1.20260901.1149 → 1.20260912.801
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/MoltenTooltip.svelte +36 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { fade
|
|
2
|
+
import { fade } from "svelte/transition";
|
|
3
3
|
import Popover from "svelte-easy-popover";
|
|
4
4
|
import { onDestroy, onMount } from "svelte";
|
|
5
5
|
import MoltenPushButton from "./MoltenPushButton.svelte";
|
|
@@ -21,8 +21,41 @@
|
|
|
21
21
|
let showbuttons = $state(false);
|
|
22
22
|
let showTooltip = $state(false);
|
|
23
23
|
let tooltipKey = $state(0);
|
|
24
|
+
let popperInstance: any = $state();
|
|
25
|
+
|
|
26
|
+
// Popper computes its position/flip-away-from-edge decision once, when
|
|
27
|
+
// the popover mounts, and never re-checks it if the popover's own content
|
|
28
|
+
// later changes size (e.g. the buttons block appearing) — it only reacts
|
|
29
|
+
// to window scroll/resize. The buttons row now uses a fade (opacity only,
|
|
30
|
+
// no layout size change), so this isn't currently reachable, but it's
|
|
31
|
+
// kept as a safety net against any future content or transition that
|
|
32
|
+
// does resize the popover after it's already positioned.
|
|
33
|
+
const SHOWBUTTONS_TRANSITION_DURATION = 100;
|
|
34
|
+
$effect(() => {
|
|
35
|
+
if (showbuttons && popperInstance) {
|
|
36
|
+
const t = setTimeout(
|
|
37
|
+
() => popperInstance?.update(),
|
|
38
|
+
instant ? 0 : SHOWBUTTONS_TRANSITION_DURATION,
|
|
39
|
+
);
|
|
40
|
+
return () => clearTimeout(t);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
24
43
|
|
|
25
44
|
let tooltipElement: HTMLDivElement | undefined = $state();
|
|
45
|
+
|
|
46
|
+
// Same safety net as above, but continuous: watches the popover's actual
|
|
47
|
+
// rendered size and recomputes on every change, rather than once after a
|
|
48
|
+
// fixed delay. Currently a no-op in practice since nothing resizes the
|
|
49
|
+
// popover post-mount, but keeps position correct if that changes later.
|
|
50
|
+
$effect(() => {
|
|
51
|
+
if (!tooltipElement || !popperInstance) return;
|
|
52
|
+
const ro = new ResizeObserver(() => {
|
|
53
|
+
popperInstance?.update();
|
|
54
|
+
});
|
|
55
|
+
ro.observe(tooltipElement);
|
|
56
|
+
return () => ro.disconnect();
|
|
57
|
+
});
|
|
58
|
+
|
|
26
59
|
let previousFocusedElement: HTMLElement | null = null;
|
|
27
60
|
let closeTimeout: any;
|
|
28
61
|
let openTimeout: any;
|
|
@@ -243,6 +276,7 @@
|
|
|
243
276
|
triggerEvents={["manual"]}
|
|
244
277
|
{referenceElement}
|
|
245
278
|
bind:placement
|
|
279
|
+
bind:popperInstance
|
|
246
280
|
spaceAway={10}
|
|
247
281
|
>
|
|
248
282
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
@@ -280,7 +314,7 @@
|
|
|
280
314
|
|
|
281
315
|
{#if showbuttons}
|
|
282
316
|
<div
|
|
283
|
-
transition:
|
|
317
|
+
transition:fade|global={{ duration: instant ? 0 : 100 }}
|
|
284
318
|
class="tooltip-container-buttons"
|
|
285
319
|
>
|
|
286
320
|
{#each buttons as button}
|