@writedocs/generator 0.13.4 → 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 (86) hide show
  1. package/README.md +28 -28
  2. package/astro.config.mjs +645 -645
  3. package/bin/writedocs.js +356 -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 +203 -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 +268 -268
  11. package/src/cli/exit-when-flushed.js +42 -42
  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.ts +2509 -2509
  48. package/src/lib/config.ts +1316 -1316
  49. package/src/lib/consent.js +108 -108
  50. package/src/lib/content-store-reload-integration.js +101 -101
  51. package/src/lib/icon-data-dev.js +53 -53
  52. package/src/lib/image-size.js +152 -152
  53. package/src/lib/json-schema-descriptions.js +228 -228
  54. package/src/lib/link-check.js +544 -544
  55. package/src/lib/llms-index.ts +90 -90
  56. package/src/lib/mcp-dev-integration.js +65 -65
  57. package/src/lib/mcp-index.ts +102 -102
  58. package/src/lib/mintlify-convert.js +605 -605
  59. package/src/lib/moved-api-pages.js +49 -49
  60. package/src/lib/og-cards.js +33 -33
  61. package/src/lib/og-image.js +235 -235
  62. package/src/lib/openapi-dev-status.js +80 -80
  63. package/src/lib/openapi-reload-integration.js +193 -193
  64. package/src/lib/pages.js +312 -312
  65. package/src/lib/project-files-integration.js +116 -116
  66. package/src/lib/project-files.js +137 -137
  67. package/src/lib/rehype-base-path.js +62 -62
  68. package/src/lib/rehype-image-loading.js +71 -71
  69. package/src/lib/robots-txt.js +21 -21
  70. package/src/lib/search-scope.js +44 -44
  71. package/src/lib/selector-placement.js +50 -50
  72. package/src/lib/seo-tags.js +155 -155
  73. package/src/lib/shiki-code-block.js +7 -1
  74. package/src/lib/site-base.ts +27 -27
  75. package/src/lib/styles-asset-integration.js +291 -291
  76. package/src/lib/wdignore-cases.json +195 -195
  77. package/src/lib/wdignore.js +177 -177
  78. package/src/pages/404.astro +63 -63
  79. package/src/pages/[...slug].astro +1762 -1608
  80. package/src/pages/[...slug].md.ts +93 -93
  81. package/src/pages/llms-full.txt.ts +88 -88
  82. package/src/pages/og/[...slug].png.ts +63 -63
  83. package/src/scripts/mobile-menu.ts +80 -80
  84. package/src/scripts/search.ts +245 -245
  85. package/src/scripts/sidebar-scroll.ts +61 -61
  86. package/src/styles/global.css +40 -40
@@ -1,80 +1,80 @@
1
- // The <= 860px hamburger menu (MobileMenu.astro's own toggle button +
2
- // overlay panel). The accordion rows inside the panel need no JS of their
3
- // own - they're plain <details name="wd-mobile-accordion"> elements, which
4
- // get native click/keyboard toggling and (in browsers supporting the
5
- // `name` attribute's exclusive-accordion behavior) mutual exclusion for
6
- // free, same as NavTree.astro's own collapsible groups already rely on
7
- // <details> for. This function only owns the panel itself: open/close, the
8
- // backdrop, Escape, and body scroll locking while it's open - same pattern
9
- // initSearch() uses for its own modal.
10
- //
11
- // And the sidebar inside it: the page has one, in BaseLayout's
12
- // `.wd-sidebar-col` (hidden at this width). Opening the menu moves it into
13
- // the panel's `.wd-mobile-menu-sidebar`, where it stays while the menu
14
- // closes (the panel slides out with it) and opens again; widening the window
15
- // past 860px moves it back. Moved rather than drawn there by CSS: the panel
16
- // scrolls its switchers and the sidebar as one list, under its own header,
17
- // and a second box laid over it couldn't. Moving is also what keeps the
18
- // styles exactly those of the copy the panel used to get (MobileMenu.astro):
19
- // the same nodes under the same containers. Without JavaScript the menu
20
- // doesn't open, so nothing is lost there. ClientRouter replaces the whole
21
- // <body> on every navigation, so each page starts with the sidebar in its
22
- // column again.
23
- export function initMobileMenu(root: ParentNode) {
24
- const trigger = root.querySelector<HTMLButtonElement>('[data-mobile-menu-trigger]');
25
- const menu = root.querySelector<HTMLElement>('#wd-mobile-menu');
26
- const backdrop = menu?.querySelector<HTMLElement>('[data-mobile-menu-backdrop]');
27
- // The panel's own close button (.wd-mobile-menu-header, next to its
28
- // replica of the topbar brand) - the real hamburger-turned-X trigger up
29
- // in the topbar is covered by the panel itself once open, so this is the
30
- // only reachable way to close via click besides the backdrop.
31
- const closeBtn = menu?.querySelector<HTMLButtonElement>('[data-mobile-menu-close]');
32
- if (!trigger || !menu || !backdrop || trigger.dataset.wdInit) return;
33
- trigger.dataset.wdInit = 'true';
34
- const column = root.querySelector<HTMLElement>('.wd-sidebar-col');
35
- const drawerSidebar = menu.querySelector<HTMLElement>('.wd-mobile-menu-sidebar');
36
- const narrow = window.matchMedia('(max-width: 860px)');
37
- // Every child, not just .wd-sidebar: whatever the page put in the sidebar slot.
38
- const moveSidebar = (from: HTMLElement | null, to: HTMLElement | null) => {
39
- if (from && to) to.append(...from.childNodes);
40
- };
41
-
42
- function open() {
43
- // Only at the width where the column is hidden.
44
- if (narrow.matches) moveSidebar(column, drawerSidebar);
45
- menu!.classList.add('open');
46
- // `inert` (not just visibility/pointer-events, which only affect
47
- // vision/mouse) is what keeps the closed panel's links out of Tab
48
- // order and off a screen reader's radar - removed while open so its
49
- // content becomes reachable again.
50
- menu!.removeAttribute('inert');
51
- trigger!.classList.add('open');
52
- trigger!.setAttribute('aria-expanded', 'true');
53
- document.body.style.overflow = 'hidden';
54
- }
55
- function close() {
56
- menu!.classList.remove('open');
57
- menu!.setAttribute('inert', '');
58
- trigger!.classList.remove('open');
59
- trigger!.setAttribute('aria-expanded', 'false');
60
- document.body.style.overflow = '';
61
- }
62
-
63
- trigger.addEventListener('click', () => (menu.classList.contains('open') ? close() : open()));
64
- backdrop.addEventListener('click', close);
65
- closeBtn?.addEventListener('click', close);
66
- document.addEventListener('keydown', (e) => {
67
- if (e.key === 'Escape' && menu.classList.contains('open')) close();
68
- });
69
- // Resizing past the breakpoint while open (rotating a tablet, or
70
- // widening a desktop browser window) - the panel/backdrop are already
71
- // hard-hidden above 860px via CSS regardless, but without this the body
72
- // scroll lock and the trigger's own "open" state would stick around with
73
- // no visible panel left to close them.
74
- // Wide again, the sidebar goes back to its column whether or not the menu
75
- // was still open.
76
- window.matchMedia('(min-width: 861px)').addEventListener('change', (e) => {
77
- if (e.matches && menu.classList.contains('open')) close();
78
- if (e.matches) moveSidebar(drawerSidebar, column);
79
- });
80
- }
1
+ // The <= 860px hamburger menu (MobileMenu.astro's own toggle button +
2
+ // overlay panel). The accordion rows inside the panel need no JS of their
3
+ // own - they're plain <details name="wd-mobile-accordion"> elements, which
4
+ // get native click/keyboard toggling and (in browsers supporting the
5
+ // `name` attribute's exclusive-accordion behavior) mutual exclusion for
6
+ // free, same as NavTree.astro's own collapsible groups already rely on
7
+ // <details> for. This function only owns the panel itself: open/close, the
8
+ // backdrop, Escape, and body scroll locking while it's open - same pattern
9
+ // initSearch() uses for its own modal.
10
+ //
11
+ // And the sidebar inside it: the page has one, in BaseLayout's
12
+ // `.wd-sidebar-col` (hidden at this width). Opening the menu moves it into
13
+ // the panel's `.wd-mobile-menu-sidebar`, where it stays while the menu
14
+ // closes (the panel slides out with it) and opens again; widening the window
15
+ // past 860px moves it back. Moved rather than drawn there by CSS: the panel
16
+ // scrolls its switchers and the sidebar as one list, under its own header,
17
+ // and a second box laid over it couldn't. Moving is also what keeps the
18
+ // styles exactly those of the copy the panel used to get (MobileMenu.astro):
19
+ // the same nodes under the same containers. Without JavaScript the menu
20
+ // doesn't open, so nothing is lost there. ClientRouter replaces the whole
21
+ // <body> on every navigation, so each page starts with the sidebar in its
22
+ // column again.
23
+ export function initMobileMenu(root: ParentNode) {
24
+ const trigger = root.querySelector<HTMLButtonElement>('[data-mobile-menu-trigger]');
25
+ const menu = root.querySelector<HTMLElement>('#wd-mobile-menu');
26
+ const backdrop = menu?.querySelector<HTMLElement>('[data-mobile-menu-backdrop]');
27
+ // The panel's own close button (.wd-mobile-menu-header, next to its
28
+ // replica of the topbar brand) - the real hamburger-turned-X trigger up
29
+ // in the topbar is covered by the panel itself once open, so this is the
30
+ // only reachable way to close via click besides the backdrop.
31
+ const closeBtn = menu?.querySelector<HTMLButtonElement>('[data-mobile-menu-close]');
32
+ if (!trigger || !menu || !backdrop || trigger.dataset.wdInit) return;
33
+ trigger.dataset.wdInit = 'true';
34
+ const column = root.querySelector<HTMLElement>('.wd-sidebar-col');
35
+ const drawerSidebar = menu.querySelector<HTMLElement>('.wd-mobile-menu-sidebar');
36
+ const narrow = window.matchMedia('(max-width: 860px)');
37
+ // Every child, not just .wd-sidebar: whatever the page put in the sidebar slot.
38
+ const moveSidebar = (from: HTMLElement | null, to: HTMLElement | null) => {
39
+ if (from && to) to.append(...from.childNodes);
40
+ };
41
+
42
+ function open() {
43
+ // Only at the width where the column is hidden.
44
+ if (narrow.matches) moveSidebar(column, drawerSidebar);
45
+ menu!.classList.add('open');
46
+ // `inert` (not just visibility/pointer-events, which only affect
47
+ // vision/mouse) is what keeps the closed panel's links out of Tab
48
+ // order and off a screen reader's radar - removed while open so its
49
+ // content becomes reachable again.
50
+ menu!.removeAttribute('inert');
51
+ trigger!.classList.add('open');
52
+ trigger!.setAttribute('aria-expanded', 'true');
53
+ document.body.style.overflow = 'hidden';
54
+ }
55
+ function close() {
56
+ menu!.classList.remove('open');
57
+ menu!.setAttribute('inert', '');
58
+ trigger!.classList.remove('open');
59
+ trigger!.setAttribute('aria-expanded', 'false');
60
+ document.body.style.overflow = '';
61
+ }
62
+
63
+ trigger.addEventListener('click', () => (menu.classList.contains('open') ? close() : open()));
64
+ backdrop.addEventListener('click', close);
65
+ closeBtn?.addEventListener('click', close);
66
+ document.addEventListener('keydown', (e) => {
67
+ if (e.key === 'Escape' && menu.classList.contains('open')) close();
68
+ });
69
+ // Resizing past the breakpoint while open (rotating a tablet, or
70
+ // widening a desktop browser window) - the panel/backdrop are already
71
+ // hard-hidden above 860px via CSS regardless, but without this the body
72
+ // scroll lock and the trigger's own "open" state would stick around with
73
+ // no visible panel left to close them.
74
+ // Wide again, the sidebar goes back to its column whether or not the menu
75
+ // was still open.
76
+ window.matchMedia('(min-width: 861px)').addEventListener('change', (e) => {
77
+ if (e.matches && menu.classList.contains('open')) close();
78
+ if (e.matches) moveSidebar(drawerSidebar, column);
79
+ });
80
+ }