@writedocs/generator 0.13.3 → 0.13.5

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 (87) hide show
  1. package/README.md +28 -28
  2. package/astro.config.mjs +645 -645
  3. package/bin/writedocs.js +43 -12
  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 +203 -203
  8. package/src/cli/check-built-styles.js +41 -41
  9. package/src/cli/convert.js +1 -1
  10. package/src/cli/dev.js +268 -268
  11. package/src/cli/exit-when-flushed.js +4 -0
  12. package/src/cli/generate-api-pages.js +507 -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 +69 -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 +203 -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 +408 -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 +414 -75
  48. package/src/lib/config-schema.ts +2509 -1905
  49. package/src/lib/config.ts +1316 -1314
  50. package/src/lib/consent.js +108 -108
  51. package/src/lib/content-store-reload-integration.js +101 -101
  52. package/src/lib/icon-data-dev.js +53 -53
  53. package/src/lib/image-size.js +152 -152
  54. package/src/lib/json-schema-descriptions.js +228 -228
  55. package/src/lib/link-check.js +544 -544
  56. package/src/lib/llms-index.ts +90 -90
  57. package/src/lib/mcp-dev-integration.js +65 -65
  58. package/src/lib/mcp-index.ts +102 -102
  59. package/src/lib/mintlify-convert.js +605 -605
  60. package/src/lib/moved-api-pages.js +49 -49
  61. package/src/lib/og-cards.js +33 -33
  62. package/src/lib/og-image.js +235 -235
  63. package/src/lib/openapi-dev-status.js +80 -80
  64. package/src/lib/openapi-reload-integration.js +193 -193
  65. package/src/lib/pages.js +312 -312
  66. package/src/lib/project-files-integration.js +116 -116
  67. package/src/lib/project-files.js +137 -137
  68. package/src/lib/rehype-base-path.js +62 -62
  69. package/src/lib/rehype-image-loading.js +71 -71
  70. package/src/lib/robots-txt.js +21 -21
  71. package/src/lib/search-scope.js +44 -44
  72. package/src/lib/selector-placement.js +50 -50
  73. package/src/lib/seo-tags.js +155 -155
  74. package/src/lib/shiki-code-block.js +7 -1
  75. package/src/lib/site-base.ts +27 -27
  76. package/src/lib/styles-asset-integration.js +291 -291
  77. package/src/lib/wdignore-cases.json +195 -195
  78. package/src/lib/wdignore.js +177 -177
  79. package/src/pages/404.astro +63 -63
  80. package/src/pages/[...slug].astro +1762 -1608
  81. package/src/pages/[...slug].md.ts +93 -93
  82. package/src/pages/llms-full.txt.ts +88 -88
  83. package/src/pages/og/[...slug].png.ts +63 -63
  84. package/src/scripts/mobile-menu.ts +80 -80
  85. package/src/scripts/search.ts +245 -245
  86. package/src/scripts/sidebar-scroll.ts +61 -61
  87. package/src/styles/global.css +40 -40
@@ -1,225 +1,225 @@
1
- ---
2
- // The <= 860px overlay drawer that TopBar.astro's own hamburger button
3
- // opens - everything that's a side-by-side control on desktop (the
4
- // brand-row switchers, the tabs bar, the always-visible global dropdowns)
5
- // plus the sidebar itself collapses into this one panel below 860px.
6
- // Reuses the exact same `selectors`/`globalDropdowns` props TopBar.astro
7
- // renders its own desktop switchers/tabs from (see its own
8
- // switcherSelectors/tabSelectors) rather than a filtered subset - unlike
9
- // TopBar's switcherSelectors (which deliberately *drops* a dropdown
10
- // selector nested directly under a tab, since desktop folds it into that
11
- // tab's own dropdown-trigger button), this renders every entry of
12
- // `selectors` in root-to-leaf order as its own accordion row. That's what
13
- // makes "a tab with its own dropdowns gets a second selector right below
14
- // it" fall out for free: when the active page is under such a tab,
15
- // `selectors` already contains that nested dropdown as its own array
16
- // entry immediately following the tab's entry (see buildSelectors() in
17
- // lib/config.ts, which walks the active PathSegment[] in that exact
18
- // order) - no tab-specific branching needed here at all.
19
- //
20
- // The sidebar itself isn't rendered here: `.wd-mobile-menu-sidebar` starts
21
- // empty, and opening the menu moves the page's one sidebar - the children
22
- // of BaseLayout's `.wd-sidebar-col`, hidden at this width - into it
23
- // (src/scripts/mobile-menu.ts); widening the window past 860px moves it
24
- // back. It used to be a second copy of the `sidebar` slot, and on a site
25
- // with a long navigation (an OpenAPI section with hundreds of operations)
26
- // that copy was half of every page's HTML.
27
- //
28
- // Split out of BaseLayout.astro, which had grown to ~2200 lines covering
29
- // several unrelated concerns in one file - see that component's own
30
- // comment for the fuller rationale.
31
- import { isExternalHref, type DocsConfig, type Selector, type GlobalDropdownView } from '../../lib/config';
32
- import AppIcon from '../../components/AppIcon.astro';
33
- import { logoWidth } from '../../lib/image-size.js';
34
- import { hasMobileMenu, currentOption } from '../../lib/selector-placement.js';
35
- import '../styles/dropdown.css';
36
- import '../styles/topbar.css';
37
- import '../styles/mobile-menu.css';
38
- import { siteHref } from '../../lib/site-base';
39
-
40
- interface Props {
41
- config: DocsConfig;
42
- selectors: Selector[];
43
- globalDropdowns: GlobalDropdownView[];
44
- // Whether this page would show a sidebar at all (mode === 'default' or
45
- // 'wide') - this whole component renders nothing otherwise, same
46
- // condition TopBar.astro gates its own hamburger toggle on.
47
- showSidebarCol: boolean;
48
- logoLight?: string;
49
- logoDark?: string;
50
- brandLabel?: string;
51
- }
52
- const { config, selectors, globalDropdowns, showSidebarCol, logoLight, logoDark, brandLabel } = Astro.props as Props;
53
- // A page without a sidebar (`mode: custom`) still gets the menu when it has
54
- // tabs, switchers or global dropdowns to reach - just without the sidebar part.
55
- const showMenu = hasMobileMenu({ sidebar: showSidebarCol, selectors, globalDropdowns });
56
- ---
57
- {showMenu && (
58
- <div class="wd-mobile-menu" id="wd-mobile-menu" inert>
59
- <div class="wd-mobile-menu-backdrop" data-mobile-menu-backdrop></div>
60
- <div class="wd-mobile-menu-panel" role="dialog" aria-modal="true" aria-label="Navigation">
61
- {/* The panel reaches all the way to the top of the viewport (see
62
- mobile-menu.css) rather than stopping below the real topbar -
63
- the real topbar's own height varies (one row, or two once
64
- tabs/global dropdowns/a wrapped search box are involved), which
65
- made lining this panel up under it a fragile approximation.
66
- Instead this header replicates the topbar's own brand/close/
67
- theme row *inside* the panel, at a fixed height the panel fully
68
- controls, so it reads as "the same navbar" occupying the same
69
- spot rather than a separate floating piece underneath one of
70
- variable size. The real topbar is still there underneath, just
71
- no longer relied on for anything while the menu is open - it's
72
- covered by this panel's own opaque background (or dimmed by the
73
- backdrop, past the panel's own width). */}
74
- <div class="wd-mobile-menu-header">
75
- <button
76
- type="button"
77
- class="wd-mobile-menu-close"
78
- aria-label="Close menu"
79
- data-mobile-menu-close
80
- >
81
- <svg width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
82
- <path d="M4 4L14 14M14 4L4 14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
83
- </svg>
84
- </button>
85
- <a class="wd-topbar-brand" href={siteHref("/")}>
86
- {logoLight && <img src={siteHref(logoLight)} alt={config.name} height="24" width={logoWidth(logoLight)} class="wd-logo-light" />}
87
- {logoDark && <img src={siteHref(logoDark)} alt={config.name} height="24" width={logoWidth(logoDark)} class="wd-logo-dark" />}
88
- {brandLabel && <span>{brandLabel}</span>}
89
- </a>
90
- {/* Same class as the real topbar's own theme button -
91
- initThemeToggle() (src/scripts/theme-toggle.ts, wired below)
92
- wires up every `.wd-theme-toggle` it finds (not just the
93
- first), and both stay in sync for free since [data-theme] on
94
- <html> - not per-button JS state - is what actually drives
95
- which icon shows. */}
96
- <button type="button" class="wd-theme-toggle" aria-label="Toggle color theme">
97
- <AppIcon icon="sun" class="wd-theme-icon wd-theme-icon-sun" />
98
- <AppIcon icon="moon" class="wd-theme-icon wd-theme-icon-moon" />
99
- </button>
100
- </div>
101
- <div class="wd-mobile-menu-scroll">
102
- {(selectors.some((sel) => !sel.hidden) || globalDropdowns.length > 0) && (
103
- <div class="wd-mobile-menu-selectors">
104
- {selectors.filter((sel) => !sel.hidden).map((sel) => {
105
- // The level under an item whose own page this is, with nothing
106
- // chosen yet (landingSelectors() in lib/config.ts): its options
107
- // as an open list - a closed one would repeat the item's name,
108
- // already on the level above.
109
- if (sel.placeholder && !sel.options.some((opt) => opt.active)) {
110
- return (
111
- <nav class="wd-mobile-menu-choices" aria-label={sel.placeholder.label}>
112
- {sel.options.map((opt) => (
113
- <a
114
- href={siteHref(opt.href)}
115
- target={isExternalHref(opt.href) ? '_blank' : undefined}
116
- rel={isExternalHref(opt.href) ? 'noopener noreferrer' : undefined}
117
- >
118
- <AppIcon icon={opt.icon} class="wd-tab-icon" />
119
- <span class="wd-mobile-accordion-option-label">{opt.label}</span>
120
- {opt.tag && <span class="wd-selector-tag">{opt.tag}</span>}
121
- </a>
122
- ))}
123
- </nav>
124
- );
125
- }
126
- const current = currentOption(sel);
127
- return (
128
- <details class="wd-mobile-accordion" name="wd-mobile-accordion">
129
- <summary class="wd-mobile-accordion-trigger">
130
- <AppIcon icon={current.icon} class="wd-tab-icon" />
131
- <span class="wd-mobile-accordion-label">{current.label}</span>
132
- {current.tag && <span class="wd-selector-tag">{current.tag}</span>}
133
- <svg class="wd-mobile-accordion-caret" width="12" height="12" viewBox="0 0 10 10" aria-hidden="true">
134
- <path d="M2 3.5L5 6.5L8 3.5" stroke="currentColor" stroke-width="1.4" fill="none" stroke-linecap="round" stroke-linejoin="round" />
135
- </svg>
136
- </summary>
137
- <div class="wd-mobile-accordion-options">
138
- <div class="wd-mobile-accordion-options-panel">
139
- {sel.options.map((opt) => (
140
- <a
141
- href={siteHref(opt.href)}
142
- class={opt.active ? 'active' : ''}
143
- target={isExternalHref(opt.href) ? '_blank' : undefined}
144
- rel={isExternalHref(opt.href) ? 'noopener noreferrer' : undefined}
145
- >
146
- <AppIcon icon={opt.icon} class="wd-tab-icon" />
147
- <span class="wd-mobile-accordion-option-label">{opt.label}</span>
148
- {opt.tag && <span class="wd-selector-tag">{opt.tag}</span>}
149
- {opt.active && (
150
- <svg class="wd-mobile-accordion-check" width="14" height="14" viewBox="0 0 14 14" aria-hidden="true">
151
- <path d="M3 7.5L6 10.5L11 4.5" stroke="currentColor" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round" />
152
- </svg>
153
- )}
154
- </a>
155
- ))}
156
- </div>
157
- </div>
158
- </details>
159
- );
160
- })}
161
- {globalDropdowns.map((d) =>
162
- d.href !== null ? (
163
- <a
164
- href={siteHref(d.href)}
165
- class="wd-mobile-menu-link"
166
- target={isExternalHref(d.href) ? '_blank' : undefined}
167
- rel={isExternalHref(d.href) ? 'noopener noreferrer' : undefined}
168
- >
169
- <AppIcon icon={d.icon} class="wd-tab-icon" />
170
- <span class="wd-mobile-accordion-option-label">{d.label}</span>
171
- </a>
172
- ) : (
173
- <details class="wd-mobile-accordion" name="wd-mobile-accordion">
174
- <summary class="wd-mobile-accordion-trigger">
175
- <AppIcon icon={d.icon} class="wd-tab-icon" />
176
- <span class="wd-mobile-accordion-label">{d.label}</span>
177
- <svg class="wd-mobile-accordion-caret" width="12" height="12" viewBox="0 0 10 10" aria-hidden="true">
178
- <path d="M2 3.5L5 6.5L8 3.5" stroke="currentColor" stroke-width="1.4" fill="none" stroke-linecap="round" stroke-linejoin="round" />
179
- </svg>
180
- </summary>
181
- <div class="wd-mobile-accordion-options">
182
- <div class="wd-mobile-accordion-options-panel">
183
- {d.items.map((item) => (
184
- <a href={siteHref(item.href)} class={item.active ? 'active' : ''}>
185
- <span class="wd-mobile-accordion-option-label">{item.label}</span>
186
- {item.active && (
187
- <svg class="wd-mobile-accordion-check" width="14" height="14" viewBox="0 0 14 14" aria-hidden="true">
188
- <path d="M3 7.5L6 10.5L11 4.5" stroke="currentColor" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round" />
189
- </svg>
190
- )}
191
- </a>
192
- ))}
193
- </div>
194
- </div>
195
- </details>
196
- )
197
- )}
198
- </div>
199
- )}
200
- {/* Filled by initMobileMenu() when the menu opens - see this file's top comment. */}
201
- {showSidebarCol && <div class="wd-mobile-menu-sidebar"></div>}
202
- </div>
203
- </div>
204
- </div>
205
- )}
206
- <script>
207
- import { initMobileMenu } from '../../scripts/mobile-menu';
208
- import { initThemeToggle } from '../../scripts/theme-toggle';
209
- // Not required by any markup this component currently renders (its own
210
- // accordion rows are plain <details>, not .wd-dropdown), but imported
211
- // and called anyway so both this file and TopBar.astro consistently own
212
- // wiring up whatever interactive primitives their own markup might use
213
- // - safe/idempotent regardless of how many components call it, see
214
- // src/scripts/dropdowns.ts's own comment.
215
- import { initDropdowns } from '../../scripts/dropdowns';
216
-
217
- initMobileMenu(document);
218
- initThemeToggle(document);
219
- initDropdowns(document);
220
- document.addEventListener('astro:page-load', () => {
221
- initMobileMenu(document);
222
- initThemeToggle(document);
223
- initDropdowns(document);
224
- });
225
- </script>
1
+ ---
2
+ // The <= 860px overlay drawer that TopBar.astro's own hamburger button
3
+ // opens - everything that's a side-by-side control on desktop (the
4
+ // brand-row switchers, the tabs bar, the always-visible global dropdowns)
5
+ // plus the sidebar itself collapses into this one panel below 860px.
6
+ // Reuses the exact same `selectors`/`globalDropdowns` props TopBar.astro
7
+ // renders its own desktop switchers/tabs from (see its own
8
+ // switcherSelectors/tabSelectors) rather than a filtered subset - unlike
9
+ // TopBar's switcherSelectors (which deliberately *drops* a dropdown
10
+ // selector nested directly under a tab, since desktop folds it into that
11
+ // tab's own dropdown-trigger button), this renders every entry of
12
+ // `selectors` in root-to-leaf order as its own accordion row. That's what
13
+ // makes "a tab with its own dropdowns gets a second selector right below
14
+ // it" fall out for free: when the active page is under such a tab,
15
+ // `selectors` already contains that nested dropdown as its own array
16
+ // entry immediately following the tab's entry (see buildSelectors() in
17
+ // lib/config.ts, which walks the active PathSegment[] in that exact
18
+ // order) - no tab-specific branching needed here at all.
19
+ //
20
+ // The sidebar itself isn't rendered here: `.wd-mobile-menu-sidebar` starts
21
+ // empty, and opening the menu moves the page's one sidebar - the children
22
+ // of BaseLayout's `.wd-sidebar-col`, hidden at this width - into it
23
+ // (src/scripts/mobile-menu.ts); widening the window past 860px moves it
24
+ // back. It used to be a second copy of the `sidebar` slot, and on a site
25
+ // with a long navigation (an OpenAPI section with hundreds of operations)
26
+ // that copy was half of every page's HTML.
27
+ //
28
+ // Split out of BaseLayout.astro, which had grown to ~2200 lines covering
29
+ // several unrelated concerns in one file - see that component's own
30
+ // comment for the fuller rationale.
31
+ import { isExternalHref, type DocsConfig, type Selector, type GlobalDropdownView } from '../../lib/config';
32
+ import AppIcon from '../../components/AppIcon.astro';
33
+ import { logoWidth } from '../../lib/image-size.js';
34
+ import { hasMobileMenu, currentOption } from '../../lib/selector-placement.js';
35
+ import '../styles/dropdown.css';
36
+ import '../styles/topbar.css';
37
+ import '../styles/mobile-menu.css';
38
+ import { siteHref } from '../../lib/site-base';
39
+
40
+ interface Props {
41
+ config: DocsConfig;
42
+ selectors: Selector[];
43
+ globalDropdowns: GlobalDropdownView[];
44
+ // Whether this page would show a sidebar at all (mode === 'default' or
45
+ // 'wide') - this whole component renders nothing otherwise, same
46
+ // condition TopBar.astro gates its own hamburger toggle on.
47
+ showSidebarCol: boolean;
48
+ logoLight?: string;
49
+ logoDark?: string;
50
+ brandLabel?: string;
51
+ }
52
+ const { config, selectors, globalDropdowns, showSidebarCol, logoLight, logoDark, brandLabel } = Astro.props as Props;
53
+ // A page without a sidebar (`mode: custom`) still gets the menu when it has
54
+ // tabs, switchers or global dropdowns to reach - just without the sidebar part.
55
+ const showMenu = hasMobileMenu({ sidebar: showSidebarCol, selectors, globalDropdowns });
56
+ ---
57
+ {showMenu && (
58
+ <div class="wd-mobile-menu" id="wd-mobile-menu" inert>
59
+ <div class="wd-mobile-menu-backdrop" data-mobile-menu-backdrop></div>
60
+ <div class="wd-mobile-menu-panel" role="dialog" aria-modal="true" aria-label="Navigation">
61
+ {/* The panel reaches all the way to the top of the viewport (see
62
+ mobile-menu.css) rather than stopping below the real topbar -
63
+ the real topbar's own height varies (one row, or two once
64
+ tabs/global dropdowns/a wrapped search box are involved), which
65
+ made lining this panel up under it a fragile approximation.
66
+ Instead this header replicates the topbar's own brand/close/
67
+ theme row *inside* the panel, at a fixed height the panel fully
68
+ controls, so it reads as "the same navbar" occupying the same
69
+ spot rather than a separate floating piece underneath one of
70
+ variable size. The real topbar is still there underneath, just
71
+ no longer relied on for anything while the menu is open - it's
72
+ covered by this panel's own opaque background (or dimmed by the
73
+ backdrop, past the panel's own width). */}
74
+ <div class="wd-mobile-menu-header">
75
+ <button
76
+ type="button"
77
+ class="wd-mobile-menu-close"
78
+ aria-label="Close menu"
79
+ data-mobile-menu-close
80
+ >
81
+ <svg width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
82
+ <path d="M4 4L14 14M14 4L4 14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
83
+ </svg>
84
+ </button>
85
+ <a class="wd-topbar-brand" href={siteHref("/")}>
86
+ {logoLight && <img src={siteHref(logoLight)} alt={config.name} height="24" width={logoWidth(logoLight)} class="wd-logo-light" />}
87
+ {logoDark && <img src={siteHref(logoDark)} alt={config.name} height="24" width={logoWidth(logoDark)} class="wd-logo-dark" />}
88
+ {brandLabel && <span>{brandLabel}</span>}
89
+ </a>
90
+ {/* Same class as the real topbar's own theme button -
91
+ initThemeToggle() (src/scripts/theme-toggle.ts, wired below)
92
+ wires up every `.wd-theme-toggle` it finds (not just the
93
+ first), and both stay in sync for free since [data-theme] on
94
+ <html> - not per-button JS state - is what actually drives
95
+ which icon shows. */}
96
+ <button type="button" class="wd-theme-toggle" aria-label="Toggle color theme">
97
+ <AppIcon icon="sun" class="wd-theme-icon wd-theme-icon-sun" />
98
+ <AppIcon icon="moon" class="wd-theme-icon wd-theme-icon-moon" />
99
+ </button>
100
+ </div>
101
+ <div class="wd-mobile-menu-scroll">
102
+ {(selectors.some((sel) => !sel.hidden) || globalDropdowns.length > 0) && (
103
+ <div class="wd-mobile-menu-selectors">
104
+ {selectors.filter((sel) => !sel.hidden).map((sel) => {
105
+ // The level under an item whose own page this is, with nothing
106
+ // chosen yet (landingSelectors() in lib/config.ts): its options
107
+ // as an open list - a closed one would repeat the item's name,
108
+ // already on the level above.
109
+ if (sel.placeholder && !sel.options.some((opt) => opt.active)) {
110
+ return (
111
+ <nav class="wd-mobile-menu-choices" aria-label={sel.placeholder.label}>
112
+ {sel.options.map((opt) => (
113
+ <a
114
+ href={siteHref(opt.href)}
115
+ target={isExternalHref(opt.href) ? '_blank' : undefined}
116
+ rel={isExternalHref(opt.href) ? 'noopener noreferrer' : undefined}
117
+ >
118
+ <AppIcon icon={opt.icon} class="wd-tab-icon" />
119
+ <span class="wd-mobile-accordion-option-label">{opt.label}</span>
120
+ {opt.tag && <span class="wd-selector-tag">{opt.tag}</span>}
121
+ </a>
122
+ ))}
123
+ </nav>
124
+ );
125
+ }
126
+ const current = currentOption(sel);
127
+ return (
128
+ <details class="wd-mobile-accordion" name="wd-mobile-accordion">
129
+ <summary class="wd-mobile-accordion-trigger">
130
+ <AppIcon icon={current.icon} class="wd-tab-icon" />
131
+ <span class="wd-mobile-accordion-label">{current.label}</span>
132
+ {current.tag && <span class="wd-selector-tag">{current.tag}</span>}
133
+ <svg class="wd-mobile-accordion-caret" width="12" height="12" viewBox="0 0 10 10" aria-hidden="true">
134
+ <path d="M2 3.5L5 6.5L8 3.5" stroke="currentColor" stroke-width="1.4" fill="none" stroke-linecap="round" stroke-linejoin="round" />
135
+ </svg>
136
+ </summary>
137
+ <div class="wd-mobile-accordion-options">
138
+ <div class="wd-mobile-accordion-options-panel">
139
+ {sel.options.map((opt) => (
140
+ <a
141
+ href={siteHref(opt.href)}
142
+ class={opt.active ? 'active' : ''}
143
+ target={isExternalHref(opt.href) ? '_blank' : undefined}
144
+ rel={isExternalHref(opt.href) ? 'noopener noreferrer' : undefined}
145
+ >
146
+ <AppIcon icon={opt.icon} class="wd-tab-icon" />
147
+ <span class="wd-mobile-accordion-option-label">{opt.label}</span>
148
+ {opt.tag && <span class="wd-selector-tag">{opt.tag}</span>}
149
+ {opt.active && (
150
+ <svg class="wd-mobile-accordion-check" width="14" height="14" viewBox="0 0 14 14" aria-hidden="true">
151
+ <path d="M3 7.5L6 10.5L11 4.5" stroke="currentColor" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round" />
152
+ </svg>
153
+ )}
154
+ </a>
155
+ ))}
156
+ </div>
157
+ </div>
158
+ </details>
159
+ );
160
+ })}
161
+ {globalDropdowns.map((d) =>
162
+ d.href !== null ? (
163
+ <a
164
+ href={siteHref(d.href)}
165
+ class="wd-mobile-menu-link"
166
+ target={isExternalHref(d.href) ? '_blank' : undefined}
167
+ rel={isExternalHref(d.href) ? 'noopener noreferrer' : undefined}
168
+ >
169
+ <AppIcon icon={d.icon} class="wd-tab-icon" />
170
+ <span class="wd-mobile-accordion-option-label">{d.label}</span>
171
+ </a>
172
+ ) : (
173
+ <details class="wd-mobile-accordion" name="wd-mobile-accordion">
174
+ <summary class="wd-mobile-accordion-trigger">
175
+ <AppIcon icon={d.icon} class="wd-tab-icon" />
176
+ <span class="wd-mobile-accordion-label">{d.label}</span>
177
+ <svg class="wd-mobile-accordion-caret" width="12" height="12" viewBox="0 0 10 10" aria-hidden="true">
178
+ <path d="M2 3.5L5 6.5L8 3.5" stroke="currentColor" stroke-width="1.4" fill="none" stroke-linecap="round" stroke-linejoin="round" />
179
+ </svg>
180
+ </summary>
181
+ <div class="wd-mobile-accordion-options">
182
+ <div class="wd-mobile-accordion-options-panel">
183
+ {d.items.map((item) => (
184
+ <a href={siteHref(item.href)} class={item.active ? 'active' : ''}>
185
+ <span class="wd-mobile-accordion-option-label">{item.label}</span>
186
+ {item.active && (
187
+ <svg class="wd-mobile-accordion-check" width="14" height="14" viewBox="0 0 14 14" aria-hidden="true">
188
+ <path d="M3 7.5L6 10.5L11 4.5" stroke="currentColor" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round" />
189
+ </svg>
190
+ )}
191
+ </a>
192
+ ))}
193
+ </div>
194
+ </div>
195
+ </details>
196
+ )
197
+ )}
198
+ </div>
199
+ )}
200
+ {/* Filled by initMobileMenu() when the menu opens - see this file's top comment. */}
201
+ {showSidebarCol && <div class="wd-mobile-menu-sidebar"></div>}
202
+ </div>
203
+ </div>
204
+ </div>
205
+ )}
206
+ <script>
207
+ import { initMobileMenu } from '../../scripts/mobile-menu';
208
+ import { initThemeToggle } from '../../scripts/theme-toggle';
209
+ // Not required by any markup this component currently renders (its own
210
+ // accordion rows are plain <details>, not .wd-dropdown), but imported
211
+ // and called anyway so both this file and TopBar.astro consistently own
212
+ // wiring up whatever interactive primitives their own markup might use
213
+ // - safe/idempotent regardless of how many components call it, see
214
+ // src/scripts/dropdowns.ts's own comment.
215
+ import { initDropdowns } from '../../scripts/dropdowns';
216
+
217
+ initMobileMenu(document);
218
+ initThemeToggle(document);
219
+ initDropdowns(document);
220
+ document.addEventListener('astro:page-load', () => {
221
+ initMobileMenu(document);
222
+ initThemeToggle(document);
223
+ initDropdowns(document);
224
+ });
225
+ </script>