@marianmeres/stuic 2.52.0 → 2.53.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.
|
@@ -20,15 +20,10 @@
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<script lang="ts">
|
|
23
|
-
import {
|
|
24
|
-
BodyScroll,
|
|
25
|
-
focusTrap as focusTrapAction,
|
|
26
|
-
twMerge,
|
|
27
|
-
waitForNextRepaint,
|
|
28
|
-
} from "../../index.js";
|
|
23
|
+
import { BodyScroll, focusTrap as focusTrapAction, twMerge } from "../../index.js";
|
|
29
24
|
import { createClog } from "@marianmeres/clog";
|
|
30
|
-
import {
|
|
31
|
-
import { onDestroy
|
|
25
|
+
import { watch } from "runed";
|
|
26
|
+
import { onDestroy } from "svelte";
|
|
32
27
|
import { fade } from "svelte/transition";
|
|
33
28
|
|
|
34
29
|
const clog = createClog("Backdrop").debug;
|
|
@@ -136,6 +131,16 @@
|
|
|
136
131
|
window.removeEventListener("keydown", onkeydown);
|
|
137
132
|
};
|
|
138
133
|
});
|
|
134
|
+
|
|
135
|
+
let focusTrapOptions: FocusTrapOptions = $derived.by(() => {
|
|
136
|
+
let opts = { enabled: true };
|
|
137
|
+
if (typeof focusTrap === "boolean") {
|
|
138
|
+
opts.enabled = focusTrap;
|
|
139
|
+
} else if (typeof focusTrap === "object") {
|
|
140
|
+
opts = { ...opts, ...focusTrap };
|
|
141
|
+
}
|
|
142
|
+
return opts;
|
|
143
|
+
});
|
|
139
144
|
</script>
|
|
140
145
|
|
|
141
146
|
{#if visible}
|
|
@@ -146,10 +151,7 @@
|
|
|
146
151
|
class={twMerge("fixed inset-0 flex z-10 h-dvh", classProp)}
|
|
147
152
|
in:fade={{ duration: fadeInDuration }}
|
|
148
153
|
out:fade={{ duration: fadeOutDuration }}
|
|
149
|
-
use:focusTrapAction={
|
|
150
|
-
...(typeof focusTrap === "object" ? focusTrap : {}),
|
|
151
|
-
enabled: typeof focusTrap === "boolean" ? focusTrap : !!focusTrap.enabled,
|
|
152
|
-
}}
|
|
154
|
+
use:focusTrapAction={focusTrapOptions}
|
|
153
155
|
{...rest}
|
|
154
156
|
>
|
|
155
157
|
{@render children?.()}
|