You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
860 B
32 lines
860 B
<script lang="ts" context="module">
|
|
import type { DeviceEditOp } from "$lib/models/device";
|
|
import type Script from "$lib/models/script";
|
|
import type { ScriptLine } from "$lib/models/script";
|
|
import { getContext, setContext } from "svelte";
|
|
import { writable, type Writable } from "svelte/store";
|
|
|
|
const ctxKey = {ctx: "ModalContext"};
|
|
|
|
export type ModalSelection =
|
|
| { kind: "closed" }
|
|
| { kind: "device.edit", op: DeviceEditOp }
|
|
| { kind: "script.edit" }
|
|
| { kind: "trigger.edit" }
|
|
| { kind: "device.quickassign" }
|
|
|
|
export interface ModalContextState {
|
|
modal: Writable<ModalSelection>
|
|
}
|
|
|
|
export function getModalContext(): ModalContextState {
|
|
return getContext(ctxKey)
|
|
}
|
|
</script>
|
|
|
|
<script lang="ts">
|
|
setContext<ModalContextState>(ctxKey, {
|
|
modal: writable({kind: "closed"}),
|
|
});
|
|
</script>
|
|
|
|
<slot></slot>
|