From 8a59f92d031963e23ecc84b75feecf43eb4dd146 Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Fri, 24 Apr 2026 11:33:25 -0700 Subject: Initial commit: @eol/graphiql v0.3 Svelte 5 GraphiQL alternative for JSR. Covers: - HTTP fetcher with injectable fetch; SSE/WS stubs - Session store with tabs, auto-titling, persistence, rename - Operation detection via graphql parse(); Toolbar picker - CodeMirror 6 editor via cm6-graphql with theme prop - Light theme preset (hand-rolled EditorView.theme) - Doc explorer with breadcrumb nav and type guards - History panel with 100-entry cap, favorite pinning - Deno tests for operations, storage, and history eviction --- source/library/components/DocExplorer.svelte | 226 +++++++++++++++++++++ .../components/DocExplorer/FieldView.svelte | 87 ++++++++ .../library/components/DocExplorer/TypeLink.svelte | 42 ++++ .../library/components/DocExplorer/TypeView.svelte | 199 ++++++++++++++++++ source/library/components/Editor.svelte | 136 +++++++++++++ source/library/components/HeadersEditor.svelte | 34 ++++ source/library/components/HistoryPanel.svelte | 187 +++++++++++++++++ source/library/components/ResultViewer.svelte | 35 ++++ source/library/components/TabBar.svelte | 161 +++++++++++++++ source/library/components/Toolbar.svelte | 150 ++++++++++++++ 10 files changed, 1257 insertions(+) create mode 100644 source/library/components/DocExplorer.svelte create mode 100644 source/library/components/DocExplorer/FieldView.svelte create mode 100644 source/library/components/DocExplorer/TypeLink.svelte create mode 100644 source/library/components/DocExplorer/TypeView.svelte create mode 100644 source/library/components/Editor.svelte create mode 100644 source/library/components/HeadersEditor.svelte create mode 100644 source/library/components/HistoryPanel.svelte create mode 100644 source/library/components/ResultViewer.svelte create mode 100644 source/library/components/TabBar.svelte create mode 100644 source/library/components/Toolbar.svelte (limited to 'source/library/components') diff --git a/source/library/components/DocExplorer.svelte b/source/library/components/DocExplorer.svelte new file mode 100644 index 0000000..536cb2a --- /dev/null +++ b/source/library/components/DocExplorer.svelte @@ -0,0 +1,226 @@ + + + + +
+ +
+ {#if stack.length === 0} +
+ +
+ {#each rootTypes as entry} + + {/each} +
+
+ {:else if currentField} + + {:else if currentType} + + {:else} +
Type not found in schema.
+ {/if} +
+
diff --git a/source/library/components/DocExplorer/FieldView.svelte b/source/library/components/DocExplorer/FieldView.svelte new file mode 100644 index 0000000..71d215c --- /dev/null +++ b/source/library/components/DocExplorer/FieldView.svelte @@ -0,0 +1,87 @@ + + + + +
+
{field.name}
+ {#if field.description} +
{field.description}
+ {/if} +
+ + +
+ {#if args.length > 0} +
+ +
+ {#each args as arg} +
+ {arg.name}: + + {#if arg.description} +
{arg.description}
+ {/if} +
+ {/each} +
+
+ {/if} +
diff --git a/source/library/components/DocExplorer/TypeLink.svelte b/source/library/components/DocExplorer/TypeLink.svelte new file mode 100644 index 0000000..253d16e --- /dev/null +++ b/source/library/components/DocExplorer/TypeLink.svelte @@ -0,0 +1,42 @@ + + + + + diff --git a/source/library/components/DocExplorer/TypeView.svelte b/source/library/components/DocExplorer/TypeView.svelte new file mode 100644 index 0000000..31a1ca3 --- /dev/null +++ b/source/library/components/DocExplorer/TypeView.svelte @@ -0,0 +1,199 @@ + + + + +
+
+ {#if kindLabel}{kindLabel}{/if}{type.name} +
+ {#if type.description} +
{type.description}
+ {/if} + {#if interfaces.length > 0} +
+ +
+ {#each interfaces as iface} +
+ +
+ {/each} +
+
+ {/if} + {#if fields.length > 0} +
+ +
+ {#each fields as field} +
+ : + + {#if field.description} +
{field.description}
+ {/if} +
+ {/each} +
+
+ {/if} + {#if unionMembers.length > 0} +
+ +
+ {#each unionMembers as member} +
+ +
+ {/each} +
+
+ {/if} + {#if enumValues.length > 0} +
+ +
+ {#each enumValues as value} +
+ {value.name} + {#if value.description} +
{value.description}
+ {/if} +
+ {/each} +
+
+ {/if} +
diff --git a/source/library/components/Editor.svelte b/source/library/components/Editor.svelte new file mode 100644 index 0000000..f2bf82d --- /dev/null +++ b/source/library/components/Editor.svelte @@ -0,0 +1,136 @@ + + + + +
diff --git a/source/library/components/HeadersEditor.svelte b/source/library/components/HeadersEditor.svelte new file mode 100644 index 0000000..fc3a193 --- /dev/null +++ b/source/library/components/HeadersEditor.svelte @@ -0,0 +1,34 @@ + + + + +
+
Headers
+ +
diff --git a/source/library/components/HistoryPanel.svelte b/source/library/components/HistoryPanel.svelte new file mode 100644 index 0000000..b7f5c4c --- /dev/null +++ b/source/library/components/HistoryPanel.svelte @@ -0,0 +1,187 @@ + + + + +
+
+ History + {#if entries.length > 0} + + {/if} +
+
+ {#if sorted.length === 0} +
No history yet.
+ {:else} + {#each sorted as entry (entry.id)} +
onEntryClick(e, entry.id)} + onkeydown={(e) => onEntryKey(e, entry.id)} + role="button" + tabindex="0"> + +
+
{entry.title}
+
{formatTimestamp(entry.timestamp)}
+
+ +
+ {/each} + {/if} +
+
diff --git a/source/library/components/ResultViewer.svelte b/source/library/components/ResultViewer.svelte new file mode 100644 index 0000000..e2c74fe --- /dev/null +++ b/source/library/components/ResultViewer.svelte @@ -0,0 +1,35 @@ + + + + +
+
Response
+ +
diff --git a/source/library/components/TabBar.svelte b/source/library/components/TabBar.svelte new file mode 100644 index 0000000..d87449d --- /dev/null +++ b/source/library/components/TabBar.svelte @@ -0,0 +1,161 @@ + + + + +
+ {#each tabs as tab (tab.id)} + + + {/each} + +
diff --git a/source/library/components/Toolbar.svelte b/source/library/components/Toolbar.svelte new file mode 100644 index 0000000..a17191c --- /dev/null +++ b/source/library/components/Toolbar.svelte @@ -0,0 +1,150 @@ + + + + +
+ + {#if namedOperations.length > 1} + + {/if} + ⌘/Ctrl + Enter + {#if schemaLoading} + Loading schema… + {/if} + + {#if onToggleHistory} + + {/if} + {#if onToggleDocs} + + {/if} +
-- cgit v1.2.3