@graphql-markdown/nuxt-theme 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +196 -2
  2. package/app/app-config.d.ts +15 -0
  3. package/app/app.config.ts +22 -0
  4. package/app/assets/css/main.css +85 -0
  5. package/app/components/ApiCodeColumn.vue +53 -0
  6. package/app/components/ApiDocumentContent.vue +45 -0
  7. package/app/components/ApiNamespaceLanding.vue +29 -0
  8. package/app/components/ApiOverviewGrid.vue +38 -0
  9. package/app/components/ApiSinglePageEntry.vue +75 -0
  10. package/app/components/ApiSinglePageSection.vue +32 -0
  11. package/app/components/SchemaCodeCard.vue +68 -0
  12. package/app/components/SiteFooter.vue +13 -0
  13. package/app/components/SiteHeader.vue +31 -0
  14. package/app/composables/useApiCodeCards.ts +96 -0
  15. package/app/composables/useApiDocument.ts +69 -0
  16. package/app/composables/useApiNavigation.ts +212 -0
  17. package/app/composables/useApiReferencePage.ts +164 -0
  18. package/app/composables/useApiSinglePage.ts +320 -0
  19. package/app/composables/useClipboardCopy.ts +56 -0
  20. package/app/composables/useHierarchyMode.ts +48 -0
  21. package/app/layouts/reference.vue +128 -0
  22. package/app/pages/api-reference/[...slug].vue +233 -0
  23. package/app/utils/api-document.ts +329 -0
  24. package/app/utils/mdc.ts +60 -0
  25. package/app/utils/navigation-tree.ts +28 -0
  26. package/bin/swizzle.mjs +256 -0
  27. package/content.config.ts +13 -0
  28. package/formatter.ts +77 -0
  29. package/generate.ts +91 -0
  30. package/modules/generate.ts +72 -0
  31. package/modules/prerender.ts +104 -0
  32. package/nuxt.config.ts +16 -0
  33. package/package.json +81 -4
  34. package/swizzle.manifest.mjs +84 -0
  35. package/swizzle.manifest.ts +11 -0
package/README.md CHANGED
@@ -1,3 +1,197 @@
1
- # Temporary Holding Version
1
+ # @graphql-markdown/nuxt-theme
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Nuxt layer that turns a GraphQL schema into a browsable API reference site — built on [GraphQL-Markdown](https://graphql-markdown.dev/), [Nuxt Content](https://content.nuxt.com/), and [Nuxt UI](https://ui.nuxt.com/). Extend it from your own Nuxt project and you get the two-column reference layout (prose on the left, schema definitions and examples on the right), navigation, search, and generation wired up — no theme code of your own required to start.
4
+
5
+ For the CLI that scaffolds a project around this layer in one command, see [`create-graphql-markdown-docs`](../create-graphql-markdown-docs).
6
+
7
+ ## Quick start
8
+
9
+ ```bash
10
+ npm install @graphql-markdown/nuxt-theme
11
+ ```
12
+
13
+ ```ts
14
+ // nuxt.config.ts
15
+ export default defineNuxtConfig({
16
+ extends: ["@graphql-markdown/nuxt-theme"],
17
+ });
18
+ ```
19
+
20
+ Two more files are required in your own project (not provided by the layer — see "Fixed contract" below):
21
+
22
+ ```ts
23
+ // content.config.ts
24
+ import { defineContentConfig, defineCollection } from "@nuxt/content";
25
+
26
+ export default defineContentConfig({
27
+ collections: {
28
+ content: defineCollection({ type: "page", source: "api-reference/**/*.md" }),
29
+ },
30
+ });
31
+ ```
32
+
33
+ ```ts
34
+ // generate-docs.ts
35
+ import { createGenerateDocs } from "@graphql-markdown/nuxt-theme/generate";
36
+
37
+ export const generate = createGenerateDocs({
38
+ schema: "./schema/your-schema.graphql",
39
+ });
40
+ ```
41
+
42
+ `npm run dev` / `npm run generate` / `npm run build` — the layer's own `gqlmd-generate` module calls `generate()` at the right point in Nuxt's startup, before Nuxt Content indexes the directory, so this works correctly from a fresh clone with nothing generated yet.
43
+
44
+ ## Customize without swizzling
45
+
46
+ Everything here is config- or CSS-driven — no file copying, and every value keeps working across layer upgrades.
47
+
48
+ ### `app.config.ts`
49
+
50
+ ```ts
51
+ export default defineAppConfig({
52
+ gqlmd: {
53
+ siteTitle: "GraphQL API", // SiteHeader's link label
54
+ githubUrl: undefined, // set to show a GitHub button in the header; omitted, the button doesn't render
55
+ shikiTheme: "github-dark", // Shiki theme for the code column
56
+ baseURL: "api-reference", // must match content.config.ts's glob prefix and every createGenerateDocs call's baseURL
57
+ },
58
+ });
59
+ ```
60
+
61
+ | Key | Default | Description |
62
+ | --- | --- | --- |
63
+ | `gqlmd.siteTitle` | `'GraphQL API'` | Text shown in the header's home link. |
64
+ | `gqlmd.githubUrl` | `undefined` | Repository URL for the header's GitHub button. Unset, the button is omitted entirely rather than rendered disabled. |
65
+ | `gqlmd.shikiTheme` | `'github-dark'` | [Shiki](https://shiki.style/) theme name used to highlight the schema/example code column. |
66
+ | `gqlmd.baseURL` | `'api-reference'` | The shared route prefix navigation, search, and the landing page all resolve against. See "Multi-schema setups" below — this must agree with `content.config.ts`'s glob and every `createGenerateDocs` call's own `baseURL`. |
67
+
68
+ Your own `app.config.ts` deep-merges over these — Nuxt's built-in behavior across `extends` layers, nothing this package does itself. You can also set `ui.colors.primary`/`ui.colors.neutral` (Nuxt UI's own keys) the same way.
69
+
70
+ ### CSS custom properties
71
+
72
+ Defined in the layer's `main.css`, overridable from your own project's stylesheet (imported after the layer's, or targeting `:root` directly):
73
+
74
+ | Property | Default | Controls |
75
+ | --- | --- | --- |
76
+ | `--gqlmd-sidebar-width` | `20rem` | Reference page sidebar width. |
77
+ | `--gqlmd-badge-bg` / `--gqlmd-badge-text` | neutral-tinted | Default schema badge (`scalar`, `object`, `non-null`, …) colors. |
78
+ | `--gqlmd-badge-deprecated-bg` / `--gqlmd-badge-deprecated-text` | warning-tinted | The `deprecated` badge specifically. |
79
+ | `--gqlmd-callout-deprecated-bg` / `--gqlmd-callout-deprecated-border` | error-tinted | The deprecation notice callout. |
80
+ | `--gqlmd-code-text` | `#e4e4e7` | The code column's text color (its background comes from Nuxt UI's own `bg-accented`, not a `--gqlmd-*` token). |
81
+
82
+ These style the classes the default formatter emits (`gqlmd-mdx-badge-*`, `api-deprecation-callout`) directly in the generated markdown — they don't reach every page, though: `app/utils/api-document.ts` promotes badges and the deprecation callout into `UBadge`/`UAlert` Nuxt UI components before render on the reference page itself, so those two properties style the *generated markdown* as parsed content, while the reference page's own badges/callouts follow Nuxt UI's own `color`/`variant` styling instead. Both code paths exist because the raw classes still matter for anything that renders the markdown directly (search results, raw content queries).
83
+
84
+ ### `printTypeOptions`
85
+
86
+ `createGenerateDocs`'s `printTypeOptions` is a generic passthrough to [`@graphql-markdown/core`](https://graphql-markdown.dev/docs/settings#printtypeoptions) — every documented option (`deprecated`, `exampleSection`, `hierarchy`, `parentTypePrefix`, `typeBadges`) works here exactly as described there. This layer only sets its own defaults for two of them (`parentTypePrefix: false`, `typeBadges: true`), which your own `printTypeOptions` can override like any other key.
87
+
88
+ `hierarchy` (`"api"` default, `"entity"`, `"flat"`) controls the generated folder structure — and this layer's navigation and landing-page grid adapt to it automatically. Under `"flat"`, where there's no folder to group by at all, every generated page's frontmatter carries a `kind` field (the GraphQL entity kind — `objects`, `scalars`, `queries`, `directives`, …), and the sidebar/landing grid group by that instead, so the site stays organized whichever `hierarchy` value you choose.
89
+
90
+ ### Single-page reference
91
+
92
+ Set `printTypeOptions.hierarchy: "flat"` in your `generate-docs.ts` (a `@graphql-markdown/core` option — see the `hierarchy` paragraph above) and this layer automatically shows the entire API as one continuous page at the base route (`<baseURL>`, e.g. `/api-reference`) instead of the per-type catalog: every query, mutation, and type grouped into Queries / Mutations / Subscriptions / Types (only non-empty groups shown), with a sidebar of in-page anchor links — modeled on references like [Anvil's GraphQL API docs](https://www.useanvil.com/docs/api/graphql/reference/). There's no separate flag or route for this: it's detected automatically from the generated content (every page having no folder nesting), and it replaces the multi-page catalog entirely rather than adding an alternative to it. Any direct link to an old per-type page (e.g. `<baseURL>/user`) still resolves — it redirects to that entry's anchor on the single page (`<baseURL>#<kind>-<slug>`) instead of 404ing.
93
+
94
+ Under `"api"`/`"entity"` hierarchy, nothing changes — you still get the per-type catalog with its own landing grid, exactly as before.
95
+
96
+ This view isn't meant to scale indefinitely: every entry's definition and examples are Shiki-highlighted up front, and every entry hydrates its own copy-button state, so a schema with hundreds of types renders as hundreds of small interactive islands on one page. For a very large schema, prefer `"api"` or `"entity"` hierarchy instead of `"flat"`.
97
+
98
+ ## Customize by swizzling
99
+
100
+ For changes config and CSS can't reach — different markup, different components entirely — eject a file into your own project with:
101
+
102
+ ```bash
103
+ npx gqlmd-swizzle # interactive picker
104
+ npx gqlmd-swizzle --list # list swizzlable components as JSON
105
+ npx gqlmd-swizzle --component SiteHeader # non-interactive
106
+ npx gqlmd-swizzle --component SiteHeader --force # overwrite without prompting
107
+ npx gqlmd-swizzle --check # warn about swizzled files older than the installed layer version
108
+ ```
109
+
110
+ | id | Description |
111
+ | --- | --- |
112
+ | `SiteHeader` | Top navigation bar. |
113
+ | `SiteFooter` | Bottom attribution bar. |
114
+ | `SchemaCodeCard` | Highlighted code panel (schema definitions and examples). |
115
+ | `ApiOverviewGrid` | Card grid for displaying API reference overview and namespace sections. |
116
+ | `ApiNamespaceLanding` | Header and grid for API reference landing pages and namespace chooser. |
117
+ | `ApiDocumentContent` | Document content with collapsible sections for API reference pages. |
118
+ | `ApiCodeColumn` | Code column sidebar with highlighted schema definitions and examples. |
119
+ | `ReferenceLayout` | Sidebar + header chrome around the reference page. |
120
+ | `ReferencePage` | The two-column reference page itself. |
121
+
122
+ A swizzled file is copied into your project at the same relative path (Nuxt's own layer file-resolution then picks it up automatically — no config needed) and stamped with a comment recording the layer version it came from:
123
+
124
+ ```vue
125
+ <!-- swizzled from @graphql-markdown/nuxt-theme@0.1.0 -->
126
+ ```
127
+
128
+ **A swizzled file stops receiving layer updates.** It's a full copy, not an override hook — if the layer changes that file in a later release, your copy doesn't change with it. Run `npx gqlmd-swizzle --check` after upgrading the layer to see which of your swizzled files have drifted from a newer upstream version, so you know what to review.
129
+
130
+ ## Multi-schema setups
131
+
132
+ Two or more schemas can share one site as distinct, fully isolated sections —
133
+ call `createGenerateDocs` once per schema, each with its own `baseURL`
134
+ nested under the same shared prefix:
135
+
136
+ ```ts
137
+ // generate-docs.ts
138
+ import { createGenerateDocs } from "@graphql-markdown/nuxt-theme/generate";
139
+
140
+ const generateBilling = createGenerateDocs({
141
+ schema: "./schema/billing.graphql",
142
+ baseURL: "api-reference/billing",
143
+ });
144
+ const generateInventory = createGenerateDocs({
145
+ schema: "./schema/inventory.graphql",
146
+ baseURL: "api-reference/inventory",
147
+ });
148
+
149
+ export const generate = async () => {
150
+ await generateBilling();
151
+ await generateInventory();
152
+ };
153
+ ```
154
+
155
+ `content.config.ts` needs no changes — its glob (`api-reference/**/*.md`)
156
+ already matches any nesting depth, so one collection covers every schema.
157
+ Navigation, search, and the landing page all derive their structure from
158
+ however deep each generated page's path actually is under `gqlmd.baseURL`,
159
+ so `billing` and `inventory` render as separate top-level sections with their
160
+ own section/group levels underneath, not merged or collapsed.
161
+
162
+ Each schema gets its own landing page automatically (at `/api-reference/billing`,
163
+ `/api-reference/inventory`) — there's no extra config for this, every
164
+ `createGenerateDocs` call already produces one. The bare shared prefix
165
+ (`/api-reference` itself, when nothing is generated directly there) falls
166
+ back to a "choose a namespace" page listing every top-level section.
167
+
168
+ **These three settings are independent by design, not auto-synced — keep
169
+ them in agreement yourself:**
170
+
171
+ | Setting | Where | Purpose |
172
+ | --- | --- | --- |
173
+ | `createGenerateDocs({ baseURL })` | `generate-docs.ts`, once per schema | Where that schema's files get written. |
174
+ | `gqlmd.baseURL` | `app.config.ts` | The shared prefix the UI resolves navigation/search/landing against. |
175
+ | `source` glob prefix | `content.config.ts` | What Nuxt Content actually indexes. |
176
+
177
+ They can't be synced automatically: `content.config.ts`'s glob is evaluated
178
+ statically by Nuxt Content, in a context neither the build-time generator nor
179
+ the runtime Vue UI can reach. In practice this only matters if you change
180
+ `gqlmd.baseURL` away from the default `"api-reference"` — every
181
+ `createGenerateDocs` call's `baseURL` still needs to start with whatever you
182
+ set it to, and `content.config.ts`'s glob prefix needs to match.
183
+
184
+ ## Fixed contract (not configurable in this version)
185
+
186
+ Two things remain load-bearing assumptions rather than options, by design for now:
187
+
188
+ - **`content.config.ts` must exist in your own project**, not just the layer — Nuxt Content scopes each layer's own `content.config.ts` to that layer's directory, so a collection declared only in the layer would never see files your project generates. Copy the snippet under "Quick start" above.
189
+ - **The reference page's code-column parsing (`app/utils/api-document.ts`) assumes graphql-markdown's default section/heading structure.** Custom `decorators`/`customSections` with unusual `position` values can render into the wrong column or go missing from it.
190
+
191
+ ## Design notes
192
+
193
+ `modules/generate.ts` calls `generate()` directly inside its own Nuxt module `setup()`, relying on declared module order (listed before `@nuxt/content` in this layer's own `nuxt.config.ts`) rather than a lifecycle hook — verified against `@nuxt/kit`'s actual module-installation code (`installModules` runs modules sequentially, awaiting each; `resolveModules` processes an extended layer's modules before the consuming app's own). `modules/prerender.ts` walks the generated content directory directly for Nitro's `prerender:routes` hook, because Nitro's crawler-based prerenderer misses pages behind collapsed navigation sections — both are adapted from equivalent fixes already shipping in the `graphql-markdown/docs` repository.
194
+
195
+ ## License
196
+
197
+ MIT.
@@ -0,0 +1,15 @@
1
+ // Augments Nuxt's AppConfig type with this layer's own `gqlmd` key, so
2
+ // `useAppConfig().gqlmd` resolves to a real type instead of `unknown`
3
+ // wherever a consuming project's own app.config.ts doesn't redeclare it.
4
+ declare module "@nuxt/schema" {
5
+ interface AppConfig {
6
+ gqlmd: {
7
+ siteTitle: string;
8
+ githubUrl?: string;
9
+ shikiTheme: string;
10
+ baseURL: string;
11
+ };
12
+ }
13
+ }
14
+
15
+ export {};
@@ -0,0 +1,22 @@
1
+ import { DEFAULT_BASE_URL } from "../constants";
2
+
3
+ export default defineAppConfig({
4
+ ui: {
5
+ colors: {
6
+ primary: "violet",
7
+ neutral: "zinc",
8
+ },
9
+ // Generated headings already contain their own `#anchor` link, so the prose
10
+ // heading components must not wrap them in a second one — nested <a>
11
+ // elements get reparented by the HTML parser and break hydration.
12
+ // `ProseH1`–`ProseH4`'s own `anchor` prop already defaults to `false`
13
+ // (verified against the installed @nuxt/ui version's own type
14
+ // declarations), so no override is needed here.
15
+ },
16
+ gqlmd: {
17
+ siteTitle: "GraphQL API",
18
+ githubUrl: undefined as string | undefined,
19
+ shikiTheme: "github-dark",
20
+ baseURL: DEFAULT_BASE_URL,
21
+ },
22
+ });
@@ -0,0 +1,85 @@
1
+ @import "tailwindcss";
2
+ @import "@nuxt/ui";
3
+
4
+ :root {
5
+ --gqlmd-sidebar-width: 20rem;
6
+ --gqlmd-badge-bg: color-mix(
7
+ in oklch,
8
+ var(--ui-color-neutral-500) 15%,
9
+ transparent
10
+ );
11
+ --gqlmd-badge-text: var(--ui-text-muted);
12
+ --gqlmd-badge-deprecated-bg: color-mix(
13
+ in oklch,
14
+ var(--ui-color-warning-500) 20%,
15
+ transparent
16
+ );
17
+ --gqlmd-badge-deprecated-text: var(--ui-color-warning-700);
18
+ --gqlmd-callout-deprecated-bg: color-mix(
19
+ in oklch,
20
+ var(--ui-color-error-500) 10%,
21
+ transparent
22
+ );
23
+ --gqlmd-callout-deprecated-border: var(--ui-color-error-500);
24
+ --gqlmd-code-text: #e4e4e7;
25
+ }
26
+
27
+ /*
28
+ * Nuxt UI resolves `primary`/`neutral` from app.config.ts. The reference keeps
29
+ * its own near-black chrome and violet accent, so the semantic tokens are
30
+ * retuned here once and every component consumes them via `bg-default`,
31
+ * `text-muted`, `border-default`, `text-primary`, etc.
32
+ */
33
+ @theme static {
34
+ --font-sans: ui-sans-serif, system-ui, sans-serif;
35
+ --font-serif: Georgia, "Times New Roman", serif;
36
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
37
+ }
38
+
39
+ @layer theme {
40
+ .light,
41
+ :root {
42
+ --ui-primary: var(--ui-color-primary-700);
43
+ --ui-bg: #fafafa;
44
+ --ui-bg-muted: #ffffff;
45
+ --ui-bg-elevated: #ffffff;
46
+ --ui-bg-accented: #f4f4f5;
47
+ --ui-border: #d4d4d8;
48
+ --ui-border-muted: #e4e4e7;
49
+ --ui-border-accented: #d4d4d8;
50
+ --ui-text: #3f3f46;
51
+ --ui-text-muted: #52525b;
52
+ --ui-text-dimmed: #52525b;
53
+ --ui-text-highlighted: #18181b;
54
+ }
55
+
56
+ .dark {
57
+ --ui-primary: #b9a4ff;
58
+ --ui-bg: #0d0d0d;
59
+ --ui-bg-muted: #0b0b0b;
60
+ --ui-bg-elevated: #1b1b1b;
61
+ --ui-bg-accented: #242424;
62
+ --ui-border: #292929;
63
+ --ui-border-muted: #262626;
64
+ --ui-border-accented: #363636;
65
+ --ui-text: #b3b3b9;
66
+ --ui-text-muted: #a1a1aa;
67
+ --ui-text-dimmed: #71717a;
68
+ --ui-text-highlighted: #fafafa;
69
+ }
70
+
71
+ .gqlmd-mdx-badge {
72
+ background-color: var(--gqlmd-badge-bg);
73
+ color: var(--gqlmd-badge-text);
74
+ }
75
+
76
+ .gqlmd-mdx-badge-deprecated {
77
+ background-color: var(--gqlmd-badge-deprecated-bg);
78
+ color: var(--gqlmd-badge-deprecated-text);
79
+ }
80
+
81
+ .api-deprecation-callout {
82
+ background-color: var(--gqlmd-callout-deprecated-bg);
83
+ border-color: var(--gqlmd-callout-deprecated-border);
84
+ }
85
+ }
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <section
3
+ class="space-y-6 bg-default p-8 lg:px-12 lg:py-16"
4
+ :class="
5
+ sticky
6
+ ? 'lg:sticky lg:top-(--ui-header-height) lg:h-[calc(100vh-var(--ui-header-height))] lg:overflow-y-auto'
7
+ : ''
8
+ "
9
+ >
10
+ <ProseCodeGroup v-if="cards.length > 1">
11
+ <SchemaCodeCard v-for="card in cards" :key="card.label" v-bind="card" />
12
+ </ProseCodeGroup>
13
+ <template v-else-if="cards.length === 1">
14
+ <SchemaCodeCard v-bind="singleCard!" />
15
+ </template>
16
+ </section>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { computed } from "vue";
21
+
22
+ interface CodeCard {
23
+ label: string;
24
+ kind: string;
25
+ code: string;
26
+ html: string;
27
+ }
28
+
29
+ const props = withDefaults(
30
+ defineProps<{
31
+ definitionCard: CodeCard | undefined;
32
+ exampleCards: CodeCard[];
33
+ /** Pins the column to the viewport as its page scrolls — right for
34
+ * `[...slug].vue`'s one-definition-per-page view, wrong when this column
35
+ * repeats once per entry down a long single-page view (every instance
36
+ * would compete for the same sticky viewport slot). Off there. */
37
+ sticky?: boolean;
38
+ }>(),
39
+ { sticky: true },
40
+ );
41
+
42
+ const cards = computed<CodeCard[]>(() => {
43
+ const allCards: (CodeCard | undefined)[] = [
44
+ props.definitionCard,
45
+ ...props.exampleCards,
46
+ ];
47
+ return allCards.filter((card): card is CodeCard => Boolean(card));
48
+ });
49
+
50
+ const singleCard = computed<CodeCard | undefined>(() => {
51
+ return cards.value.length === 1 ? cards.value[0] : undefined;
52
+ });
53
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <ContentRenderer
3
+ v-if="document.lead"
4
+ :value="document.lead"
5
+ class="markdown-text-body markdown-lead"
6
+ />
7
+
8
+ <UCollapsible
9
+ v-for="section in document.sections"
10
+ :key="section.id"
11
+ default-open
12
+ >
13
+ <UButton
14
+ :id="section.id"
15
+ :label="section.title"
16
+ :trailing-icon="'i-lucide-chevron-down'"
17
+ color="neutral"
18
+ variant="ghost"
19
+ block
20
+ class="group section-trigger"
21
+ :ui="{
22
+ label: 'font-serif text-2xl font-semibold text-highlighted',
23
+ trailingIcon:
24
+ 'size-5 text-dimmed transition-transform duration-200 group-data-[state=open]:rotate-180',
25
+ }"
26
+ />
27
+
28
+ <template #content>
29
+ <ContentRenderer :value="section.document" class="markdown-text-body" />
30
+ </template>
31
+ </UCollapsible>
32
+ </template>
33
+
34
+ <script setup lang="ts">
35
+ defineProps<{
36
+ document: {
37
+ lead?: Record<string, any>;
38
+ sections: Array<{
39
+ id: string;
40
+ title: string;
41
+ document: Record<string, any>;
42
+ }>;
43
+ };
44
+ }>();
45
+ </script>
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div>
3
+ <UPageHeader
4
+ headline="GRAPHQL SCHEMA REFERENCE"
5
+ :title="title"
6
+ :description="description"
7
+ :ui="{
8
+ root: 'border-0 pt-0 pb-0',
9
+ headline: 'font-mono font-normal',
10
+ title: 'font-serif text-5xl sm:text-5xl font-semibold',
11
+ description: 'max-w-2xl leading-8',
12
+ }"
13
+ />
14
+
15
+ <ApiOverviewGrid :items="items" />
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import type { ApiNavigationNode } from "~/composables/useApiNavigation";
21
+
22
+ defineProps<{
23
+ title: string;
24
+ description: string;
25
+ items: Array<
26
+ ApiNavigationNode | (ApiNavigationNode & { sectionTitle: string })
27
+ >;
28
+ }>();
29
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <UPageGrid class="mt-6 gap-2 xl:grid-cols-3">
3
+ <UPageCard
4
+ v-for="item in items"
5
+ :key="itemKey(item)"
6
+ :to="getFirstLeafPath(item)"
7
+ :title="item.title"
8
+ :description="`${countLeaves(item)} ${countLeaves(item) === 1 ? 'entry' : 'entries'}`"
9
+ variant="subtle"
10
+ :ui="{
11
+ container: 'p-3 sm:p-3 gap-y-0',
12
+ title: 'font-serif text-lg',
13
+ description: 'text-xs leading-tight text-muted',
14
+ }"
15
+ >
16
+ <template v-if="'sectionTitle' in item" #leading>
17
+ <p class="font-mono text-[0.6875rem] text-primary">
18
+ {{ item.sectionTitle }}
19
+ </p>
20
+ </template>
21
+ </UPageCard>
22
+ </UPageGrid>
23
+ </template>
24
+
25
+ <script setup lang="ts">
26
+ import type { ApiNavigationNode } from "~/composables/useApiNavigation";
27
+ import {
28
+ countLeaves,
29
+ getFirstLeafPath,
30
+ itemKey,
31
+ } from "~/utils/navigation-tree";
32
+
33
+ defineProps<{
34
+ items: Array<
35
+ ApiNavigationNode | (ApiNavigationNode & { sectionTitle: string })
36
+ >;
37
+ }>();
38
+ </script>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <article class="api-single-page-entry grid grid-cols-1 lg:grid-cols-2">
3
+ <section class="border-r-0 pr-0 lg:border-r lg:border-default lg:pr-8">
4
+ <h2 :id="entry.anchorId" class="flex items-center gap-3">
5
+ {{ entry.title }}
6
+ <UBadge color="primary" variant="subtle" size="sm" class="font-mono">{{
7
+ entry.kindLabel
8
+ }}</UBadge>
9
+ </h2>
10
+
11
+ <UAlert
12
+ v-if="entry.isDeprecated"
13
+ color="error"
14
+ variant="subtle"
15
+ icon="i-lucide-triangle-alert"
16
+ :description="entry.deprecationReason"
17
+ class="mb-8"
18
+ />
19
+
20
+ <ContentRenderer
21
+ v-if="entry.lead"
22
+ :value="entry.lead"
23
+ class="markdown-text-body markdown-lead"
24
+ />
25
+
26
+ <template v-for="section in entry.sections" :key="section.id">
27
+ <h3>{{ section.title }}</h3>
28
+ <ContentRenderer :value="section.document" class="markdown-text-body" />
29
+ </template>
30
+ </section>
31
+
32
+ <ApiCodeColumn
33
+ :sticky="false"
34
+ :definition-card="entry.definitionCard"
35
+ :example-cards="entry.exampleCards"
36
+ />
37
+ </article>
38
+ </template>
39
+
40
+ <script setup lang="ts">
41
+ import type { ApiSinglePageEntry } from "~/composables/useApiSinglePage";
42
+
43
+ defineProps<{ entry: ApiSinglePageEntry }>();
44
+ </script>
45
+
46
+ <style scoped>
47
+ .api-single-page-entry {
48
+ padding-top: 3rem;
49
+ margin-top: 3rem;
50
+ border-top: 1px solid var(--ui-border-muted);
51
+ }
52
+
53
+ .api-single-page-entry:first-child {
54
+ padding-top: 0;
55
+ margin-top: 0;
56
+ border-top: 0;
57
+ }
58
+
59
+ .api-single-page-entry h2 {
60
+ font-family: var(--font-serif);
61
+ font-size: 1.75rem;
62
+ font-weight: 600;
63
+ color: var(--ui-text-highlighted);
64
+ margin-bottom: 1.5rem;
65
+ }
66
+
67
+ .api-single-page-entry h3 {
68
+ font-family: var(--font-mono);
69
+ color: var(--ui-primary);
70
+ font-size: 1rem;
71
+ margin-top: 2rem;
72
+ padding-top: 1rem;
73
+ border-top: 1px solid var(--ui-border-muted);
74
+ }
75
+ </style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <section class="api-single-page-section">
3
+ <h1 :id="bucket.id">{{ bucket.title }}</h1>
4
+
5
+ <ApiSinglePageEntry
6
+ v-for="entry in bucket.entries"
7
+ :key="entry.anchorId"
8
+ :entry="entry"
9
+ />
10
+ </section>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import type { ApiSinglePageBucket } from "~/composables/useApiSinglePage";
15
+
16
+ defineProps<{ bucket: ApiSinglePageBucket }>();
17
+ </script>
18
+
19
+ <style scoped>
20
+ .api-single-page-section + .api-single-page-section {
21
+ margin-top: 4rem;
22
+ }
23
+
24
+ .api-single-page-section > h1 {
25
+ font-family: var(--font-serif);
26
+ font-size: 2.25rem;
27
+ font-weight: 700;
28
+ color: var(--ui-text-highlighted);
29
+ padding-bottom: 1.25rem;
30
+ border-bottom: 1px solid var(--ui-border-accented);
31
+ }
32
+ </style>
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div
3
+ class="dark overflow-hidden border border-accented bg-accented text-default"
4
+ :class="hideHeader ? 'rounded-b-[10px]' : 'rounded-[10px]'"
5
+ >
6
+ <div
7
+ v-if="!hideHeader"
8
+ class="flex items-center justify-between border-b border-accented px-5 py-4"
9
+ >
10
+ <span class="font-mono text-sm tracking-normal text-muted">{{
11
+ label
12
+ }}</span>
13
+
14
+ <div class="flex items-center gap-2">
15
+ <UBadge color="primary" variant="subtle" size="sm">{{ kind }}</UBadge>
16
+
17
+ <UButton v-bind="copyButtonProps" @click="copy(code)" />
18
+ </div>
19
+ </div>
20
+
21
+ <div class="relative overflow-x-auto p-5 font-mono text-sm">
22
+ <!-- Inside a code group the tab bar carries the label, so the card drops
23
+ its header and the copy button floats over the snippet instead. -->
24
+ <UButton
25
+ v-if="hideHeader"
26
+ v-bind="copyButtonProps"
27
+ class="absolute top-3 right-3 z-10"
28
+ @click="copy(code)"
29
+ />
30
+
31
+ <div class="blueprint-code" v-html="html" />
32
+ </div>
33
+ </div>
34
+ </template>
35
+
36
+ <script setup lang="ts">
37
+ const props = defineProps<{
38
+ /** Caption shown on the left of the card header, and the code-group tab label. */
39
+ label: string;
40
+ /** Schema kind rendered as a badge, e.g. `QUERY` or `ENUM`. */
41
+ kind: string;
42
+ /** Snippet already highlighted by Shiki. */
43
+ html: string;
44
+ /** Plain-text source behind `html`, used for copy-to-clipboard. */
45
+ code: string;
46
+ /** Set by `ProseCodeGroup` on its children; drops the card's own header. */
47
+ hideHeader?: boolean;
48
+ }>();
49
+
50
+ const { copy, copyButtonProps } = useClipboardCopy(() => props.label);
51
+ </script>
52
+
53
+ <style>
54
+ /* Shiki emits its own background and spacing; the card supplies both. The
55
+ selectors reach into `v-html` output, so they cannot be scoped. */
56
+ /* fallow-ignore-next-line css-selector-complexity -- overrides Shiki inline styles */
57
+ .blueprint-code pre {
58
+ background: transparent !important;
59
+ color: var(--gqlmd-code-text) !important;
60
+ line-height: normal;
61
+ margin: 0;
62
+ padding: 0;
63
+ }
64
+
65
+ .blueprint-code code {
66
+ line-height: 0.4rem;
67
+ }
68
+ </style>