File size: 800 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 { createBitAttrs, getOptionUpdater, removeUndefined } from "../../internal/index.js";
import { createPinInput } from "@melt-ui/svelte";
import { getContext, setContext } from "svelte";
export function getPinInputData() {
    const NAME = "pin-input";
    const PARTS = ["root", "input", "hidden-input"];
    return {
        NAME,
        PARTS,
    };
}
export function setCtx(props) {
    const { NAME, PARTS } = getPinInputData();
    const getAttrs = createBitAttrs(NAME, PARTS);
    const pinInput = { ...createPinInput(removeUndefined(props)), getAttrs };
    setContext(NAME, pinInput);
    return {
        ...pinInput,
        updateOption: getOptionUpdater(pinInput.options),
    };
}
export function getCtx() {
    const { NAME } = getPinInputData();
    return getContext(NAME);
}