File size: 949 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
import { createDialog } from "@melt-ui/svelte";
import { getContext, setContext } from "svelte";
import { createBitAttrs, getOptionUpdater, removeUndefined } from "../../internal/index.js";
export function getDialogData() {
    const NAME = "dialog";
    const PARTS = [
        "close",
        "content",
        "description",
        "overlay",
        "portal",
        "title",
        "trigger",
    ];
    return {
        NAME,
        PARTS,
    };
}
export function setCtx(props) {
    const { NAME, PARTS } = getDialogData();
    const getAttrs = createBitAttrs(NAME, PARTS);
    const dialog = {
        ...createDialog({ ...removeUndefined(props), role: "dialog", forceVisible: true }),
        getAttrs,
    };
    setContext(NAME, dialog);
    return {
        ...dialog,
        updateOption: getOptionUpdater(dialog.options),
    };
}
export function getCtx() {
    const { NAME } = getDialogData();
    return getContext(NAME);
}