Standardize context naming

Fixes #7
This commit is contained in:
Ryan Gossiaux
2021-12-18 23:18:45 -08:00
parent 03399fc954
commit 70910c05b0
16 changed files with 20 additions and 18 deletions

View File

@@ -3,6 +3,8 @@
Add,
Remove,
}
const STACK_CONTEXT_NAME = "headlessui-stack-context";
</script>
<script lang="ts">
@@ -14,9 +16,9 @@
export let element: HTMLElement | null;
let parentUpdateStore: Writable<OnUpdate> | undefined =
getContext("StackContext");
getContext(STACK_CONTEXT_NAME);
let notifyStore: Writable<OnUpdate> = writable(() => {});
setContext("StackContext", notifyStore);
setContext(STACK_CONTEXT_NAME, notifyStore);
$: notifyStore.set((...args: Parameters<OnUpdate>) => {
// Notify our layer

View File

@@ -6,7 +6,7 @@ export enum State {
Closed,
}
const OPEN_CLOSED_CONTEXT_NAME = "OpenClosed";
const OPEN_CLOSED_CONTEXT_NAME = "headlessui-open-closed-context";
export function hasOpenClosed() {
return useOpenClosed() !== undefined;
}