File size: 757 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
import { createTabs } from "@melt-ui/svelte";
import { createBitAttrs, getOptionUpdater, removeUndefined } from "../../internal/index.js";
import { getContext, setContext } from "svelte";
function getTabsData() {
    const NAME = "tabs";
    const PARTS = ["root", "content", "list", "trigger"];
    return {
        NAME,
        PARTS,
    };
}
export function setCtx(props) {
    const { NAME, PARTS } = getTabsData();
    const getAttrs = createBitAttrs(NAME, PARTS);
    const tabs = { ...createTabs(removeUndefined(props)), getAttrs };
    setContext(NAME, tabs);
    return {
        ...tabs,
        updateOption: getOptionUpdater(tabs.options),
    };
}
export function getCtx() {
    const { NAME } = getTabsData();
    return getContext(NAME);
}