Clean up store types & initial values

Treating these as Readable for better safety from consuming code

Fixes #10
This commit is contained in:
Ryan Gossiaux
2021-12-19 01:08:50 -08:00
parent 8e890b2e80
commit f105042545
15 changed files with 43 additions and 43 deletions

View File

@@ -1,18 +1,15 @@
<script lang="ts">
import { useSwitchContext } from "./SwitchGroup.svelte";
import type { LabelContext } from "$lib/components/label/LabelProvider.svelte";
import { useLabelContext } from "$lib/components/label/LabelProvider.svelte";
import { useDescriptionContext } from "$lib/components/description/DescriptionProvider.svelte";
import { useId } from "$lib/hooks/use-id";
import { Keys } from "$lib/utils/keyboard";
import { getContext, createEventDispatcher } from "svelte";
import type { Writable } from "svelte/store";
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
export let checked = false;
let api = useSwitchContext();
let labelContext: Writable<LabelContext> | undefined = getContext(
"headlessui-label-context"
);
let labelContext = useLabelContext();
let descriptionContext = useDescriptionContext();
let id = `headlessui-switch-${useId()}`;
$: switchStore = $api?.switchStore;