File size: 1,376 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script>import { derived } from "svelte/store";
import { setCtx } from "../ctx.js";
export let preventScroll = void 0;
export let closeOnEscape = void 0;
export let closeOnOutsideClick = void 0;
export let portal = void 0;
export let open = void 0;
export let onOpenChange = void 0;
export let openFocus = void 0;
export let closeFocus = void 0;
export let onOutsideClick = void 0;
const {
  states: { open: localOpen },
  updateOption,
  ids
} = setCtx({
  closeOnEscape,
  preventScroll,
  closeOnOutsideClick,
  portal,
  forceVisible: true,
  defaultOpen: open,
  openFocus,
  closeFocus,
  onOutsideClick,
  onOpenChange: ({ next }) => {
    if (open !== next) {
      onOpenChange?.(next);
      open = next;
    }
    return next;
  }
});
const idValues = derived(
  [ids.content, ids.description, ids.title],
  ([$contentId, $descriptionId, $titleId]) => ({
    content: $contentId,
    description: $descriptionId,
    title: $titleId
  })
);
$:
  open !== void 0 && localOpen.set(open);
$:
  updateOption("preventScroll", preventScroll);
$:
  updateOption("closeOnEscape", closeOnEscape);
$:
  updateOption("closeOnOutsideClick", closeOnOutsideClick);
$:
  updateOption("portal", portal);
$:
  updateOption("openFocus", openFocus);
$:
  updateOption("closeFocus", closeFocus);
$:
  updateOption("onOutsideClick", onOutsideClick);
</script>

<slot ids={$idValues} />