@writedocs/generator 0.13.4 → 0.14.0

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 (89) hide show
  1. package/README.md +28 -28
  2. package/astro.config.mjs +645 -645
  3. package/bin/writedocs.js +359 -356
  4. package/package.json +99 -99
  5. package/src/cli/base-path-layout.js +44 -44
  6. package/src/cli/build-auth.js +135 -135
  7. package/src/cli/build.js +223 -203
  8. package/src/cli/check-built-styles.js +41 -41
  9. package/src/cli/convert.js +124 -124
  10. package/src/cli/dev.js +269 -268
  11. package/src/cli/exit-when-flushed.js +42 -42
  12. package/src/cli/generate-api-pages.js +509 -507
  13. package/src/cli/og-image-worker.js +20 -20
  14. package/src/cli/og-images.js +70 -70
  15. package/src/cli/page-list-watch.js +71 -69
  16. package/src/cli/run-astro.js +97 -97
  17. package/src/cli/run-pagefind.js +154 -154
  18. package/src/cli/write-mcp-files.js +103 -103
  19. package/src/cli/write-redirects-file.js +158 -158
  20. package/src/components/ApiReferencePanel.astro +1792 -1792
  21. package/src/components/AppIcon.astro +51 -51
  22. package/src/components/Card.astro +193 -193
  23. package/src/components/CodeGroup.astro +63 -39
  24. package/src/components/CopyPageMenu.astro +374 -374
  25. package/src/components/Hint.astro +188 -188
  26. package/src/components/Icon.astro +72 -72
  27. package/src/components/Image.astro +165 -165
  28. package/src/components/Tile.astro +67 -67
  29. package/src/components/Video.astro +137 -137
  30. package/src/content.config.ts +219 -203
  31. package/src/layout/BaseLayout.astro +908 -908
  32. package/src/layout/components/AnalyticsScripts.astro +49 -49
  33. package/src/layout/components/Breadcrumbs.astro +98 -98
  34. package/src/layout/components/ConsentBanner.astro +119 -119
  35. package/src/layout/components/MobileMenu.astro +225 -225
  36. package/src/layout/components/NavTree.astro +422 -408
  37. package/src/layout/components/Sidebar.astro +232 -232
  38. package/src/layout/components/SiteFooter.astro +87 -87
  39. package/src/layout/components/TopBar.astro +386 -386
  40. package/src/layout/styles/base.css +332 -326
  41. package/src/layout/styles/mobile-menu.css +285 -285
  42. package/src/lib/agent-markdown.js +164 -164
  43. package/src/lib/asset-dimensions.js +89 -89
  44. package/src/lib/base-path.js +90 -90
  45. package/src/lib/cli-report.js +22 -22
  46. package/src/lib/code-line-numbers.js +13 -0
  47. package/src/lib/config-schema.js +12 -1
  48. package/src/lib/config-schema.ts +2523 -2509
  49. package/src/lib/config.ts +1331 -1316
  50. package/src/lib/consent.js +108 -108
  51. package/src/lib/content-check.js +4 -1
  52. package/src/lib/content-store-reload-integration.js +101 -101
  53. package/src/lib/drafts.js +186 -0
  54. package/src/lib/icon-data-dev.js +53 -53
  55. package/src/lib/image-size.js +152 -152
  56. package/src/lib/json-schema-descriptions.js +228 -228
  57. package/src/lib/link-check.js +553 -544
  58. package/src/lib/llms-index.ts +90 -90
  59. package/src/lib/mcp-dev-integration.js +65 -65
  60. package/src/lib/mcp-index.ts +102 -102
  61. package/src/lib/mintlify-convert.js +605 -605
  62. package/src/lib/moved-api-pages.js +49 -49
  63. package/src/lib/og-cards.js +33 -33
  64. package/src/lib/og-image.js +235 -235
  65. package/src/lib/openapi-dev-status.js +80 -80
  66. package/src/lib/openapi-reload-integration.js +193 -193
  67. package/src/lib/pages.js +346 -312
  68. package/src/lib/project-files-integration.js +116 -116
  69. package/src/lib/project-files.js +137 -137
  70. package/src/lib/rehype-base-path.js +62 -62
  71. package/src/lib/rehype-image-loading.js +71 -71
  72. package/src/lib/robots-txt.js +21 -21
  73. package/src/lib/search-scope.js +44 -44
  74. package/src/lib/selector-placement.js +50 -50
  75. package/src/lib/seo-tags.js +157 -155
  76. package/src/lib/shiki-code-block.js +7 -1
  77. package/src/lib/site-base.ts +27 -27
  78. package/src/lib/styles-asset-integration.js +291 -291
  79. package/src/lib/wdignore-cases.json +195 -195
  80. package/src/lib/wdignore.js +177 -177
  81. package/src/pages/404.astro +63 -63
  82. package/src/pages/[...slug].astro +1773 -1608
  83. package/src/pages/[...slug].md.ts +93 -93
  84. package/src/pages/llms-full.txt.ts +88 -88
  85. package/src/pages/og/[...slug].png.ts +63 -63
  86. package/src/scripts/mobile-menu.ts +80 -80
  87. package/src/scripts/search.ts +245 -245
  88. package/src/scripts/sidebar-scroll.ts +61 -61
  89. package/src/styles/global.css +40 -40
@@ -1,408 +1,422 @@
1
- ---
2
- import { navTreeContainsSlug, isExternalHref, type NavTreeNode } from "../../lib/config";
3
- import AppIcon from "../../components/AppIcon.astro";
4
- import { methodClass } from "../../lib/openapi-render";
5
- import { siteHref } from '../../lib/site-base';
6
-
7
- interface Props {
8
- nodes: NavTreeNode[];
9
- hrefForSlug: (slug: string) => string;
10
- currentSlug: string;
11
- depth?: number;
12
- }
13
-
14
- const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
15
-
16
- // The <style> below is global, not scoped: a scoped one puts a
17
- // data-astro-cid-* attribute on every <li>, <a> and <span> here - four per
18
- // item, 24 bytes each - and the tree is on every page, in full. With a long
19
- // OpenAPI section that was 30% of each page's HTML. Every selector in it
20
- // starts from a wd-nav-* class, which nothing else on a page uses.
21
- //
22
- // Without the scope, a selector is (0,1,0) less specific per part, so two
23
- // rules with a different number of parts can trade places. One pair did:
24
- // `.wd-nav-list a.active` came to outweigh `.wd-nav-group
25
- // .wd-nav-section-title a` - hence the font-weight there. A new rule has to be
26
- // weighed against the others with nothing but its own selectors to count.
27
- ---
28
-
29
- <ul class={`wd-nav-list wd-nav-depth-${depth}`}>
30
- {
31
- nodes.map((node) => {
32
- if (node.kind === "page") {
33
- return (
34
- <li>
35
- <a href={siteHref(hrefForSlug(node.slug))} class={node.slug === currentSlug ? "active" : ""}>
36
- {node.method && (
37
- <span class={`wd-nav-method wd-nav-method-${methodClass(node.method)}`}>{node.method}</span>
38
- )}
39
- {node.icon && <AppIcon icon={node.icon} class="wd-nav-page-icon" />}
40
- <span class="wd-nav-title">{node.title}</span>
41
- {node.deprecated && <span class="wd-nav-tag wd-nav-tag-deprecated">Deprecated</span>}
42
- {node.tag && <span class="wd-nav-tag">{node.tag}</span>}
43
- </a>
44
- </li>
45
- );
46
- }
47
-
48
- if (node.kind === "link") {
49
- // A bare external link sitting directly in the page tree (see
50
- // NavItem's `{ label, href }` leaf in lib/config.ts) - styled like
51
- // a page row, but never "active" (it's not a content page) and
52
- // always opens in a new tab since it's meant to point off-site.
53
- const external = isExternalHref(node.href);
54
- return (
55
- <li>
56
- <a
57
- href={siteHref(node.href)}
58
- class="wd-nav-link-leaf"
59
- target={external ? "_blank" : undefined}
60
- rel={external ? "noopener noreferrer" : undefined}
61
- >
62
- <span>{node.label}</span>
63
- {external && (
64
- <svg class="wd-nav-external-icon" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true">
65
- <path
66
- d="M3 1.5H8.5V7M8.5 1.5L1.5 8.5"
67
- stroke="currentColor"
68
- stroke-width="1.2"
69
- fill="none"
70
- stroke-linecap="round"
71
- stroke-linejoin="round"
72
- />
73
- </svg>
74
- )}
75
- </a>
76
- </li>
77
- );
78
- }
79
-
80
- if (depth === 0) {
81
- // Top-level group = a static sidebar section title, never a
82
- // disclosure control - matches the reference design where the first
83
- // group level is just a bold label above its pages.
84
- return (
85
- <li class="wd-nav-group">
86
- <div class="wd-nav-section-title">
87
- {node.pageSlug ? (
88
- <a href={siteHref(hrefForSlug(node.pageSlug))} class={node.pageSlug === currentSlug ? "active" : ""}>
89
- {node.label}
90
- </a>
91
- ) : (
92
- node.label
93
- )}
94
- </div>
95
- <Astro.self nodes={node.children} hrefForSlug={hrefForSlug} currentSlug={currentSlug} depth={depth + 1} />
96
- </li>
97
- );
98
- }
99
-
100
- // Depth >= 1: a nested group renders as a collapsible row, styled and
101
- // inset exactly like a sibling page link, with a chevron on the
102
- // right. Defaults open whenever the active page lives anywhere inside
103
- // it (itself or a descendant), so landing on a child page never
104
- // leaves its own parent collapsed.
105
- const isActive = node.pageSlug === currentSlug;
106
- const open = isActive || navTreeContainsSlug(node.children, currentSlug);
107
- return (
108
- <li class="wd-nav-collapsible">
109
- <details open={open}>
110
- <summary class={isActive ? "active" : ""}>
111
- {node.pageSlug ? (
112
- <a href={siteHref(hrefForSlug(node.pageSlug))} class={isActive ? "active" : ""}>
113
- {node.label}
114
- </a>
115
- ) : (
116
- <span class="wd-nav-group-label">{node.label}</span>
117
- )}
118
- <svg class="wd-nav-chevron" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true">
119
- <path
120
- d="M3.5 2L6.5 5L3.5 8"
121
- stroke="currentColor"
122
- stroke-width="1.4"
123
- fill="none"
124
- stroke-linecap="round"
125
- stroke-linejoin="round"
126
- />
127
- </svg>
128
- </summary>
129
- <Astro.self nodes={node.children} hrefForSlug={hrefForSlug} currentSlug={currentSlug} depth={depth + 1} />
130
- </details>
131
- </li>
132
- );
133
- })
134
- }
135
- </ul>
136
-
137
- <style is:global>
138
- .wd-nav-list {
139
- list-style: none;
140
- margin: 0;
141
- padding: 0;
142
- }
143
-
144
- .wd-nav-list li a,
145
- .wd-nav-list li summary {
146
- border-left: 1px solid transparent;
147
- }
148
-
149
- .wd-nav-list li a:not(summary a):hover,
150
- .wd-nav-list li summary:hover {
151
- border-left: 1px solid var(--wd-primary);
152
- }
153
-
154
- .wd-nav-list li a.active:not(summary a),
155
- .wd-nav-list li summary.active {
156
- border-left: 1px solid var(--wd-primary);
157
- }
158
-
159
- .wd-nav-depth-0 {
160
- margin-bottom: 1.25rem;
161
- }
162
- /* Space between a top-level group and whatever sits next to it - another
163
- group, or a page outside any group - so each group reads as its own
164
- block. */
165
- .wd-nav-depth-0 > .wd-nav-group + li,
166
- .wd-nav-depth-0 > li + .wd-nav-group {
167
- margin-top: 2rem;
168
- }
169
- .wd-nav-section-title {
170
- padding: 0;
171
- margin-bottom: 0.4rem;
172
- color: var(--wd-nav-title);
173
- font-size: 0.75rem;
174
- font-weight: 600;
175
- text-transform: uppercase;
176
- letter-spacing: 0.04em;
177
- }
178
- /* Overrides `.wd-nav-list a`'s own block/padding/font-size/pill-when-
179
- active styling further below - without this, a group-with-a-page's
180
- title (e.g. "Concepts" linking to its own overview page) inherits
181
- the same big rounded background pill a regular page row gets when
182
- active, which looks completely out of place sitting next to a
183
- plain-text sibling title like "Getting Started". A linked section
184
- title should still read as a section title - same size/weight/
185
- case/color as an unlinked one - just tinted primary on hover/active
186
- instead. The extra `.wd-nav-group` ancestor qualifier (2 classes)
187
- is load-bearing, not decoration: `.wd-nav-section-title a` alone
188
- has the exact same specificity as `.wd-nav-list a` (1 class + 1
189
- type each), so whichever rule happens to sit later in the
190
- stylesheet would silently win regardless of intent - this avoids
191
- that tie entirely. Mirrors the same "override to neutral, re-apply
192
- only color" pattern already used for .wd-nav-collapsible summary a
193
- below (which sidesteps the same tie via a `summary` type selector
194
- instead). */
195
- .wd-nav-group .wd-nav-section-title a {
196
- display: inline;
197
- padding: 0;
198
- border-radius: 0;
199
- background: none;
200
- color: inherit;
201
- font-size: inherit;
202
- font-weight: inherit;
203
- text-decoration: none;
204
- }
205
- .wd-nav-group .wd-nav-section-title a.active,
206
- .wd-nav-group .wd-nav-section-title a:hover {
207
- background: none;
208
- color: var(--wd-primary);
209
- /* The title's own weight, not `.wd-nav-list a.active`'s 500 - which
210
- ties with the rule above on specificity, and comes later. */
211
- font-weight: inherit;
212
- }
213
- .wd-nav-depth-1,
214
- .wd-nav-depth-2,
215
- .wd-nav-depth-3 {
216
- margin-bottom: 0.5rem;
217
- border-left: 1px solid var(--wd-border);
218
- }
219
-
220
- .wd-nav-depth-2,
221
- .wd-nav-depth-3 {
222
- margin-bottom: 0.5rem;
223
- margin-left: 0.75rem;
224
- border-left: 1px solid var(--wd-border);
225
- }
226
- .wd-nav-list a {
227
- display: flex;
228
- align-items: center;
229
- gap: 0.45rem;
230
- padding: 0.2rem 0.75rem;
231
- margin: 0.1rem 0;
232
- border-radius: 0 0.4rem 0.4rem 0;
233
- text-decoration: none;
234
- color: var(--wd-nav-text);
235
- font-size: 0.9rem;
236
- }
237
- /* Primary-tinted rather than a neutral surface gray - a faint preview
238
- of the active pill's own color (12% alpha), at half its strength, so
239
- hover reads as "this could become active" instead of a generic
240
- hover state shared with every other clickable thing on the page. */
241
- .wd-nav-list a:hover {
242
- background: color-mix(in srgb, var(--wd-primary) 6%, transparent);
243
- color: var(--wd-nav-title);
244
- }
245
- .wd-nav-list a.active {
246
- background: color-mix(in srgb, var(--wd-primary) 12%, transparent);
247
- color: var(--wd-primary);
248
- font-weight: 500;
249
- }
250
- .wd-nav-title {
251
- flex: 1;
252
- min-width: 0;
253
- overflow: hidden;
254
- /* text-overflow: ellipsis;
255
- white-space: nowrap; */
256
- }
257
- /* A page's own frontmatter `icon` (Mintlify's), which AppIcon.astro
258
- renders as an svg or a span. */
259
- svg.wd-nav-page-icon,
260
- span.wd-nav-page-icon {
261
- flex-shrink: 0;
262
- width: 1em;
263
- height: 1em;
264
- }
265
- span.wd-nav-page-icon {
266
- display: flex;
267
- align-items: center;
268
- justify-content: center;
269
- }
270
- /* Frontmatter `tag` / `deprecated` - a small pill after the title, same
271
- shape as the method badge. */
272
- .wd-nav-tag {
273
- flex-shrink: 0;
274
- padding: 0.05rem 0.4rem;
275
- border-radius: 999px;
276
- font-size: 0.62rem;
277
- font-weight: 700;
278
- line-height: 1.5;
279
- letter-spacing: 0.02em;
280
- color: var(--wd-primary);
281
- background: color-mix(in srgb, var(--wd-primary) 12%, transparent);
282
- }
283
- .wd-nav-tag-deprecated {
284
- color: #d97706;
285
- background: color-mix(in srgb, #d97706 15%, transparent);
286
- }
287
- .wd-nav-method {
288
- flex-shrink: 0;
289
- display: inline-block;
290
- padding: 0.05rem 0.4rem;
291
- border-radius: 0.3rem;
292
- font-size: 0.62rem;
293
- font-weight: 700;
294
- letter-spacing: 0.02em;
295
- line-height: 1.5;
296
- }
297
- .wd-nav-method-get {
298
- background: color-mix(in srgb, #16a34a 15%, transparent);
299
- color: #16a34a;
300
- }
301
- .wd-nav-method-post {
302
- background: color-mix(in srgb, #2563eb 15%, transparent);
303
- color: #2563eb;
304
- }
305
- .wd-nav-method-put {
306
- background: color-mix(in srgb, #9333ea 15%, transparent);
307
- color: #9333ea;
308
- }
309
- .wd-nav-method-patch {
310
- background: color-mix(in srgb, #d97706 15%, transparent);
311
- color: #d97706;
312
- }
313
- .wd-nav-method-delete {
314
- background: color-mix(in srgb, #dc2626 15%, transparent);
315
- color: #dc2626;
316
- }
317
- .wd-nav-method-other {
318
- background: var(--wd-surface);
319
- color: var(--wd-text-muted);
320
- }
321
- .wd-nav-link-leaf {
322
- display: flex !important;
323
- align-items: center;
324
- justify-content: space-between;
325
- gap: 0.5rem;
326
- }
327
- .wd-nav-external-icon {
328
- flex-shrink: 0;
329
- color: var(--wd-text-muted);
330
- }
331
-
332
- /* Depth >= 1 group: a collapsible row that looks like a page link. */
333
- .wd-nav-collapsible details {
334
- margin: 0;
335
- }
336
- .wd-nav-collapsible summary {
337
- display: flex;
338
- align-items: center;
339
- justify-content: space-between;
340
- gap: 0.5rem;
341
- padding: 0.2rem 0.75rem;
342
- margin: 0.1rem 0;
343
- border-radius: 0 0.4rem 0.4rem 0;
344
- cursor: pointer;
345
- color: var(--wd-nav-text);
346
- font-size: 0.9rem;
347
- list-style: none;
348
- }
349
- .wd-nav-collapsible summary::-webkit-details-marker {
350
- display: none;
351
- }
352
- .wd-nav-collapsible summary::marker {
353
- content: "";
354
- }
355
- /* Same primary-tinted hover as a plain page link above. */
356
- .wd-nav-collapsible summary:hover {
357
- background: color-mix(in srgb, var(--wd-primary) 6%, transparent);
358
- color: var(--wd-nav-title);
359
- }
360
- /* When the group's own attached page is the current page, the pill
361
- background lives on <summary> itself (not the inner <a> below,
362
- which is deliberately stripped of its own background/padding so the
363
- chevron can share the row) - otherwise only the label text would be
364
- highlighted, leaving the chevron sitting outside the pill. This is
365
- the same background/radius a plain `.wd-nav-list a.active` pill
366
- uses, so an active group header looks identical to an active leaf
367
- page row instead of falling back to text-only bold+color. */
368
- .wd-nav-collapsible summary.active {
369
- background: color-mix(in srgb, var(--wd-primary) 12%, transparent);
370
- border-left: 1px solid var(--wd-primary);
371
- }
372
-
373
- .wd-nav-collapsible summary.active > a {
374
- border-left: none;
375
- }
376
- /* Overrides `.wd-nav-list a`'s own block/padding - the row's padding is
377
- owned by <summary> now, the label inside is just flex content. Wins
378
- on specificity (class + 2 tags vs class + 1 tag) regardless of
379
- source order. */
380
- .wd-nav-collapsible summary a,
381
- .wd-nav-collapsible summary .wd-nav-group-label {
382
- display: block;
383
- padding: 0;
384
- border-radius: 0;
385
- background: none;
386
- color: inherit;
387
- font-weight: inherit;
388
- flex: 1;
389
- min-width: 0;
390
- }
391
- .wd-nav-collapsible summary a:hover {
392
- background: none;
393
- color: var(--wd-nav-title);
394
- }
395
- .wd-nav-collapsible summary a.active {
396
- background: none;
397
- color: var(--wd-primary);
398
- font-weight: 500;
399
- }
400
- .wd-nav-chevron {
401
- flex-shrink: 0;
402
- color: var(--wd-text-muted);
403
- transition: transform 0.15s ease;
404
- }
405
- .wd-nav-collapsible details[open] > summary .wd-nav-chevron {
406
- transform: rotate(90deg);
407
- }
408
- </style>
1
+ ---
2
+ import { navTreeContainsSlug, isExternalHref, type NavTreeNode } from "../../lib/config";
3
+ import AppIcon from "../../components/AppIcon.astro";
4
+ import { methodClass } from "../../lib/openapi-render";
5
+ import { siteHref } from '../../lib/site-base';
6
+
7
+ interface Props {
8
+ nodes: NavTreeNode[];
9
+ hrefForSlug: (slug: string) => string;
10
+ currentSlug: string;
11
+ depth?: number;
12
+ }
13
+
14
+ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
15
+
16
+ // The <style> below is global, not scoped: a scoped one puts a
17
+ // data-astro-cid-* attribute on every <li>, <a> and <span> here - four per
18
+ // item, 24 bytes each - and the tree is on every page, in full. With a long
19
+ // OpenAPI section that was 30% of each page's HTML. Every selector in it
20
+ // starts from a wd-nav-* class, which nothing else on a page uses.
21
+ //
22
+ // Without the scope, a selector is (0,1,0) less specific per part, so two
23
+ // rules with a different number of parts can trade places. One pair did:
24
+ // `.wd-nav-list a.active` came to outweigh `.wd-nav-group
25
+ // .wd-nav-section-title a` - hence the font-weight there. A new rule has to be
26
+ // weighed against the others with nothing but its own selectors to count.
27
+ ---
28
+
29
+ <ul class={`wd-nav-list wd-nav-depth-${depth}`}>
30
+ {
31
+ nodes.map((node) => {
32
+ if (node.kind === "page") {
33
+ return (
34
+ <li>
35
+ <a href={siteHref(hrefForSlug(node.slug))} class={node.slug === currentSlug ? "active" : ""}>
36
+ {node.method && (
37
+ <span class={`wd-nav-method wd-nav-method-${methodClass(node.method)}`}>{node.method}</span>
38
+ )}
39
+ {node.icon && <AppIcon icon={node.icon} class="wd-nav-page-icon" />}
40
+ <span class="wd-nav-title">{node.title}</span>
41
+ {
42
+ // A draft page (`draft: true` - lib/drafts.js), in `writedocs
43
+ // dev` and `build --drafts`. Its colors inline, not in the
44
+ // <style> below: that stylesheet is on every site, and a
45
+ // site with no drafts builds byte for byte as before.
46
+ node.draft && (
47
+ <span
48
+ class="wd-nav-tag"
49
+ style="color: var(--wd-text); background: color-mix(in srgb, var(--wd-text-muted) 16%, transparent)"
50
+ >
51
+ Draft
52
+ </span>
53
+ )
54
+ }
55
+ {node.deprecated && <span class="wd-nav-tag wd-nav-tag-deprecated">Deprecated</span>}
56
+ {node.tag && <span class="wd-nav-tag">{node.tag}</span>}
57
+ </a>
58
+ </li>
59
+ );
60
+ }
61
+
62
+ if (node.kind === "link") {
63
+ // A bare external link sitting directly in the page tree (see
64
+ // NavItem's `{ label, href }` leaf in lib/config.ts) - styled like
65
+ // a page row, but never "active" (it's not a content page) and
66
+ // always opens in a new tab since it's meant to point off-site.
67
+ const external = isExternalHref(node.href);
68
+ return (
69
+ <li>
70
+ <a
71
+ href={siteHref(node.href)}
72
+ class="wd-nav-link-leaf"
73
+ target={external ? "_blank" : undefined}
74
+ rel={external ? "noopener noreferrer" : undefined}
75
+ >
76
+ <span>{node.label}</span>
77
+ {external && (
78
+ <svg class="wd-nav-external-icon" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true">
79
+ <path
80
+ d="M3 1.5H8.5V7M8.5 1.5L1.5 8.5"
81
+ stroke="currentColor"
82
+ stroke-width="1.2"
83
+ fill="none"
84
+ stroke-linecap="round"
85
+ stroke-linejoin="round"
86
+ />
87
+ </svg>
88
+ )}
89
+ </a>
90
+ </li>
91
+ );
92
+ }
93
+
94
+ if (depth === 0) {
95
+ // Top-level group = a static sidebar section title, never a
96
+ // disclosure control - matches the reference design where the first
97
+ // group level is just a bold label above its pages.
98
+ return (
99
+ <li class="wd-nav-group">
100
+ <div class="wd-nav-section-title">
101
+ {node.pageSlug ? (
102
+ <a href={siteHref(hrefForSlug(node.pageSlug))} class={node.pageSlug === currentSlug ? "active" : ""}>
103
+ {node.label}
104
+ </a>
105
+ ) : (
106
+ node.label
107
+ )}
108
+ </div>
109
+ <Astro.self nodes={node.children} hrefForSlug={hrefForSlug} currentSlug={currentSlug} depth={depth + 1} />
110
+ </li>
111
+ );
112
+ }
113
+
114
+ // Depth >= 1: a nested group renders as a collapsible row, styled and
115
+ // inset exactly like a sibling page link, with a chevron on the
116
+ // right. Defaults open whenever the active page lives anywhere inside
117
+ // it (itself or a descendant), so landing on a child page never
118
+ // leaves its own parent collapsed.
119
+ const isActive = node.pageSlug === currentSlug;
120
+ const open = isActive || navTreeContainsSlug(node.children, currentSlug);
121
+ return (
122
+ <li class="wd-nav-collapsible">
123
+ <details open={open}>
124
+ <summary class={isActive ? "active" : ""}>
125
+ {node.pageSlug ? (
126
+ <a href={siteHref(hrefForSlug(node.pageSlug))} class={isActive ? "active" : ""}>
127
+ {node.label}
128
+ </a>
129
+ ) : (
130
+ <span class="wd-nav-group-label">{node.label}</span>
131
+ )}
132
+ <svg class="wd-nav-chevron" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true">
133
+ <path
134
+ d="M3.5 2L6.5 5L3.5 8"
135
+ stroke="currentColor"
136
+ stroke-width="1.4"
137
+ fill="none"
138
+ stroke-linecap="round"
139
+ stroke-linejoin="round"
140
+ />
141
+ </svg>
142
+ </summary>
143
+ <Astro.self nodes={node.children} hrefForSlug={hrefForSlug} currentSlug={currentSlug} depth={depth + 1} />
144
+ </details>
145
+ </li>
146
+ );
147
+ })
148
+ }
149
+ </ul>
150
+
151
+ <style is:global>
152
+ .wd-nav-list {
153
+ list-style: none;
154
+ margin: 0;
155
+ padding: 0;
156
+ }
157
+
158
+ .wd-nav-list li a,
159
+ .wd-nav-list li summary {
160
+ border-left: 1px solid transparent;
161
+ }
162
+
163
+ .wd-nav-list li a:not(summary a):hover,
164
+ .wd-nav-list li summary:hover {
165
+ border-left: 1px solid var(--wd-primary);
166
+ }
167
+
168
+ .wd-nav-list li a.active:not(summary a),
169
+ .wd-nav-list li summary.active {
170
+ border-left: 1px solid var(--wd-primary);
171
+ }
172
+
173
+ .wd-nav-depth-0 {
174
+ margin-bottom: 1.25rem;
175
+ }
176
+ /* Space between a top-level group and whatever sits next to it - another
177
+ group, or a page outside any group - so each group reads as its own
178
+ block. */
179
+ .wd-nav-depth-0 > .wd-nav-group + li,
180
+ .wd-nav-depth-0 > li + .wd-nav-group {
181
+ margin-top: 2rem;
182
+ }
183
+ .wd-nav-section-title {
184
+ padding: 0;
185
+ margin-bottom: 0.4rem;
186
+ color: var(--wd-nav-title);
187
+ font-size: 0.75rem;
188
+ font-weight: 600;
189
+ text-transform: uppercase;
190
+ letter-spacing: 0.04em;
191
+ }
192
+ /* Overrides `.wd-nav-list a`'s own block/padding/font-size/pill-when-
193
+ active styling further below - without this, a group-with-a-page's
194
+ title (e.g. "Concepts" linking to its own overview page) inherits
195
+ the same big rounded background pill a regular page row gets when
196
+ active, which looks completely out of place sitting next to a
197
+ plain-text sibling title like "Getting Started". A linked section
198
+ title should still read as a section title - same size/weight/
199
+ case/color as an unlinked one - just tinted primary on hover/active
200
+ instead. The extra `.wd-nav-group` ancestor qualifier (2 classes)
201
+ is load-bearing, not decoration: `.wd-nav-section-title a` alone
202
+ has the exact same specificity as `.wd-nav-list a` (1 class + 1
203
+ type each), so whichever rule happens to sit later in the
204
+ stylesheet would silently win regardless of intent - this avoids
205
+ that tie entirely. Mirrors the same "override to neutral, re-apply
206
+ only color" pattern already used for .wd-nav-collapsible summary a
207
+ below (which sidesteps the same tie via a `summary` type selector
208
+ instead). */
209
+ .wd-nav-group .wd-nav-section-title a {
210
+ display: inline;
211
+ padding: 0;
212
+ border-radius: 0;
213
+ background: none;
214
+ color: inherit;
215
+ font-size: inherit;
216
+ font-weight: inherit;
217
+ text-decoration: none;
218
+ }
219
+ .wd-nav-group .wd-nav-section-title a.active,
220
+ .wd-nav-group .wd-nav-section-title a:hover {
221
+ background: none;
222
+ color: var(--wd-primary);
223
+ /* The title's own weight, not `.wd-nav-list a.active`'s 500 - which
224
+ ties with the rule above on specificity, and comes later. */
225
+ font-weight: inherit;
226
+ }
227
+ .wd-nav-depth-1,
228
+ .wd-nav-depth-2,
229
+ .wd-nav-depth-3 {
230
+ margin-bottom: 0.5rem;
231
+ border-left: 1px solid var(--wd-border);
232
+ }
233
+
234
+ .wd-nav-depth-2,
235
+ .wd-nav-depth-3 {
236
+ margin-bottom: 0.5rem;
237
+ margin-left: 0.75rem;
238
+ border-left: 1px solid var(--wd-border);
239
+ }
240
+ .wd-nav-list a {
241
+ display: flex;
242
+ align-items: center;
243
+ gap: 0.45rem;
244
+ padding: 0.2rem 0.75rem;
245
+ margin: 0.1rem 0;
246
+ border-radius: 0 0.4rem 0.4rem 0;
247
+ text-decoration: none;
248
+ color: var(--wd-nav-text);
249
+ font-size: 0.9rem;
250
+ }
251
+ /* Primary-tinted rather than a neutral surface gray - a faint preview
252
+ of the active pill's own color (12% alpha), at half its strength, so
253
+ hover reads as "this could become active" instead of a generic
254
+ hover state shared with every other clickable thing on the page. */
255
+ .wd-nav-list a:hover {
256
+ background: color-mix(in srgb, var(--wd-primary) 6%, transparent);
257
+ color: var(--wd-nav-title);
258
+ }
259
+ .wd-nav-list a.active {
260
+ background: color-mix(in srgb, var(--wd-primary) 12%, transparent);
261
+ color: var(--wd-primary);
262
+ font-weight: 500;
263
+ }
264
+ .wd-nav-title {
265
+ flex: 1;
266
+ min-width: 0;
267
+ overflow: hidden;
268
+ /* text-overflow: ellipsis;
269
+ white-space: nowrap; */
270
+ }
271
+ /* A page's own frontmatter `icon` (Mintlify's), which AppIcon.astro
272
+ renders as an svg or a span. */
273
+ svg.wd-nav-page-icon,
274
+ span.wd-nav-page-icon {
275
+ flex-shrink: 0;
276
+ width: 1em;
277
+ height: 1em;
278
+ }
279
+ span.wd-nav-page-icon {
280
+ display: flex;
281
+ align-items: center;
282
+ justify-content: center;
283
+ }
284
+ /* Frontmatter `tag` / `deprecated` - a small pill after the title, same
285
+ shape as the method badge. */
286
+ .wd-nav-tag {
287
+ flex-shrink: 0;
288
+ padding: 0.05rem 0.4rem;
289
+ border-radius: 999px;
290
+ font-size: 0.62rem;
291
+ font-weight: 700;
292
+ line-height: 1.5;
293
+ letter-spacing: 0.02em;
294
+ color: var(--wd-primary);
295
+ background: color-mix(in srgb, var(--wd-primary) 12%, transparent);
296
+ }
297
+ .wd-nav-tag-deprecated {
298
+ color: #d97706;
299
+ background: color-mix(in srgb, #d97706 15%, transparent);
300
+ }
301
+ .wd-nav-method {
302
+ flex-shrink: 0;
303
+ display: inline-block;
304
+ padding: 0.05rem 0.4rem;
305
+ border-radius: 0.3rem;
306
+ font-size: 0.62rem;
307
+ font-weight: 700;
308
+ letter-spacing: 0.02em;
309
+ line-height: 1.5;
310
+ }
311
+ .wd-nav-method-get {
312
+ background: color-mix(in srgb, #16a34a 15%, transparent);
313
+ color: #16a34a;
314
+ }
315
+ .wd-nav-method-post {
316
+ background: color-mix(in srgb, #2563eb 15%, transparent);
317
+ color: #2563eb;
318
+ }
319
+ .wd-nav-method-put {
320
+ background: color-mix(in srgb, #9333ea 15%, transparent);
321
+ color: #9333ea;
322
+ }
323
+ .wd-nav-method-patch {
324
+ background: color-mix(in srgb, #d97706 15%, transparent);
325
+ color: #d97706;
326
+ }
327
+ .wd-nav-method-delete {
328
+ background: color-mix(in srgb, #dc2626 15%, transparent);
329
+ color: #dc2626;
330
+ }
331
+ .wd-nav-method-other {
332
+ background: var(--wd-surface);
333
+ color: var(--wd-text-muted);
334
+ }
335
+ .wd-nav-link-leaf {
336
+ display: flex !important;
337
+ align-items: center;
338
+ justify-content: space-between;
339
+ gap: 0.5rem;
340
+ }
341
+ .wd-nav-external-icon {
342
+ flex-shrink: 0;
343
+ color: var(--wd-text-muted);
344
+ }
345
+
346
+ /* Depth >= 1 group: a collapsible row that looks like a page link. */
347
+ .wd-nav-collapsible details {
348
+ margin: 0;
349
+ }
350
+ .wd-nav-collapsible summary {
351
+ display: flex;
352
+ align-items: center;
353
+ justify-content: space-between;
354
+ gap: 0.5rem;
355
+ padding: 0.2rem 0.75rem;
356
+ margin: 0.1rem 0;
357
+ border-radius: 0 0.4rem 0.4rem 0;
358
+ cursor: pointer;
359
+ color: var(--wd-nav-text);
360
+ font-size: 0.9rem;
361
+ list-style: none;
362
+ }
363
+ .wd-nav-collapsible summary::-webkit-details-marker {
364
+ display: none;
365
+ }
366
+ .wd-nav-collapsible summary::marker {
367
+ content: "";
368
+ }
369
+ /* Same primary-tinted hover as a plain page link above. */
370
+ .wd-nav-collapsible summary:hover {
371
+ background: color-mix(in srgb, var(--wd-primary) 6%, transparent);
372
+ color: var(--wd-nav-title);
373
+ }
374
+ /* When the group's own attached page is the current page, the pill
375
+ background lives on <summary> itself (not the inner <a> below,
376
+ which is deliberately stripped of its own background/padding so the
377
+ chevron can share the row) - otherwise only the label text would be
378
+ highlighted, leaving the chevron sitting outside the pill. This is
379
+ the same background/radius a plain `.wd-nav-list a.active` pill
380
+ uses, so an active group header looks identical to an active leaf
381
+ page row instead of falling back to text-only bold+color. */
382
+ .wd-nav-collapsible summary.active {
383
+ background: color-mix(in srgb, var(--wd-primary) 12%, transparent);
384
+ border-left: 1px solid var(--wd-primary);
385
+ }
386
+
387
+ .wd-nav-collapsible summary.active > a {
388
+ border-left: none;
389
+ }
390
+ /* Overrides `.wd-nav-list a`'s own block/padding - the row's padding is
391
+ owned by <summary> now, the label inside is just flex content. Wins
392
+ on specificity (class + 2 tags vs class + 1 tag) regardless of
393
+ source order. */
394
+ .wd-nav-collapsible summary a,
395
+ .wd-nav-collapsible summary .wd-nav-group-label {
396
+ display: block;
397
+ padding: 0;
398
+ border-radius: 0;
399
+ background: none;
400
+ color: inherit;
401
+ font-weight: inherit;
402
+ flex: 1;
403
+ min-width: 0;
404
+ }
405
+ .wd-nav-collapsible summary a:hover {
406
+ background: none;
407
+ color: var(--wd-nav-title);
408
+ }
409
+ .wd-nav-collapsible summary a.active {
410
+ background: none;
411
+ color: var(--wd-primary);
412
+ font-weight: 500;
413
+ }
414
+ .wd-nav-chevron {
415
+ flex-shrink: 0;
416
+ color: var(--wd-text-muted);
417
+ transition: transform 0.15s ease;
418
+ }
419
+ .wd-nav-collapsible details[open] > summary .wd-nav-chevron {
420
+ transform: rotate(90deg);
421
+ }
422
+ </style>