From 07d39a1a3a09739bbc3d27a31829063f1e0a5e24 Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Sun, 26 Apr 2026 20:51:04 -0700 Subject: adds standalone version for CDN ease --- source/standalone/index.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 source/standalone/index.ts (limited to 'source/standalone/index.ts') diff --git a/source/standalone/index.ts b/source/standalone/index.ts new file mode 100644 index 0000000..f6defca --- /dev/null +++ b/source/standalone/index.ts @@ -0,0 +1,41 @@ + + + +/*** IMPORT ------------------------------------------- ***/ + +import { + mount as svelteMount, + unmount as svelteUnmount, + type ComponentProps +} from "svelte"; + +/*** UTILITY ------------------------------------------ ***/ + +import GraphiQL from "../library/GraphiQL.svelte"; + +import { createApqFetcher } from "../library/fetcher/apq.ts"; +import { createHttpFetcher } from "../library/fetcher/http.ts"; +import { createSseFetcher } from "../library/fetcher/sse.ts"; +import { createWsFetcher } from "../library/fetcher/websocket.ts"; +import { lightTheme } from "../library/themes/light.ts"; + +type Props = ComponentProps; +type Instance = Record; + +/*** EXPORT ------------------------------------------- ***/ + +export function mount(target: HTMLElement, props: Props): Instance { + return svelteMount(GraphiQL, { props, target }); +} + +export function unmount(instance: Instance): void { + svelteUnmount(instance); +} + +export { + createApqFetcher, + createHttpFetcher, + createSseFetcher, + createWsFetcher, + lightTheme +}; -- cgit v1.2.3