@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,51 +1,51 @@
1
- ---
2
- // Renders any writedocs.json `icon` string, whichever of the two forms it
3
- // takes (see resolveIcon() in lib/config.ts): an Iconify icon id (looked
4
- // up against whatever @iconify-json/* collections are installed - see
5
- // astro.config.mjs) rendered as a real <svg>, or literal text/emoji
6
- // rendered as-is. Centralizes the icon/text branch so BaseLayout.astro
7
- // and Card.astro (the two places writedocs.json icon strings get rendered)
8
- // don't each need their own copy of the resolveIcon() call + branch.
9
- import { Icon } from 'astro-icon/components';
10
- import { resolveIcon, iconExists } from '../lib/config';
11
- import { report } from '../lib/cli-report.js';
12
- import { siteHref } from '../lib/site-base';
13
-
14
- interface Props {
15
- icon?: string;
16
- class?: string;
17
- // Optional inline style passthrough - Icon.astro is the one real
18
- // consumer, needing this to apply its own per-instance `size`/`color`
19
- // props (arbitrary values, not a fixed set of classes like every
20
- // other AppIcon call site uses). Left off Props' required list and
21
- // undefined by default so every existing caller (BaseLayout, Card,
22
- // Badge) is unaffected.
23
- style?: string;
24
- }
25
- const { icon, class: className = 'wd-icon', style } = Astro.props as Props;
26
- // An icon name no installed collection has renders nothing, with a warning
27
- // (once per name - a sidebar icon renders on every page), instead of
28
- // failing the whole build the way astro-icon does on a missing name.
29
- // `writedocs validate` lists the same names ahead of time.
30
- let resolved = icon ? resolveIcon(icon) : null;
31
- if (icon && resolved?.kind === 'iconify' && !iconExists(icon)) {
32
- const warned: Set<string> = ((globalThis as any).__wdWarnedIcons ??= new Set());
33
- if (!warned.has(icon)) {
34
- warned.add(icon);
35
- report('warn', `Unknown icon "${icon}" - no installed icon set has it, so it's left out.`);
36
- }
37
- resolved = null;
38
- }
39
- ---
40
- {resolved && (
41
- resolved.kind === 'iconify' ? (
42
- <Icon name={resolved.name} class={className} style={style} />
43
- ) : resolved.kind === 'image' ? (
44
- // Wrapped in the same <span> text icons use, so each caller's own
45
- // span.<class> rule (font-size, spacing) sizes it; the image fills
46
- // 1em of that (img.wd-icon-img in layout/styles/base.css).
47
- <span class={className} style={style}><img src={siteHref(resolved.src)} alt="" class="wd-icon-img" /></span>
48
- ) : (
49
- <span class={className} style={style}>{resolved.value}</span>
50
- )
51
- )}
1
+ ---
2
+ // Renders any writedocs.json `icon` string, whichever of the two forms it
3
+ // takes (see resolveIcon() in lib/config.ts): an Iconify icon id (looked
4
+ // up against whatever @iconify-json/* collections are installed - see
5
+ // astro.config.mjs) rendered as a real <svg>, or literal text/emoji
6
+ // rendered as-is. Centralizes the icon/text branch so BaseLayout.astro
7
+ // and Card.astro (the two places writedocs.json icon strings get rendered)
8
+ // don't each need their own copy of the resolveIcon() call + branch.
9
+ import { Icon } from 'astro-icon/components';
10
+ import { resolveIcon, iconExists } from '../lib/config';
11
+ import { report } from '../lib/cli-report.js';
12
+ import { siteHref } from '../lib/site-base';
13
+
14
+ interface Props {
15
+ icon?: string;
16
+ class?: string;
17
+ // Optional inline style passthrough - Icon.astro is the one real
18
+ // consumer, needing this to apply its own per-instance `size`/`color`
19
+ // props (arbitrary values, not a fixed set of classes like every
20
+ // other AppIcon call site uses). Left off Props' required list and
21
+ // undefined by default so every existing caller (BaseLayout, Card,
22
+ // Badge) is unaffected.
23
+ style?: string;
24
+ }
25
+ const { icon, class: className = 'wd-icon', style } = Astro.props as Props;
26
+ // An icon name no installed collection has renders nothing, with a warning
27
+ // (once per name - a sidebar icon renders on every page), instead of
28
+ // failing the whole build the way astro-icon does on a missing name.
29
+ // `writedocs validate` lists the same names ahead of time.
30
+ let resolved = icon ? resolveIcon(icon) : null;
31
+ if (icon && resolved?.kind === 'iconify' && !iconExists(icon)) {
32
+ const warned: Set<string> = ((globalThis as any).__wdWarnedIcons ??= new Set());
33
+ if (!warned.has(icon)) {
34
+ warned.add(icon);
35
+ report('warn', `Unknown icon "${icon}" - no installed icon set has it, so it's left out.`);
36
+ }
37
+ resolved = null;
38
+ }
39
+ ---
40
+ {resolved && (
41
+ resolved.kind === 'iconify' ? (
42
+ <Icon name={resolved.name} class={className} style={style} />
43
+ ) : resolved.kind === 'image' ? (
44
+ // Wrapped in the same <span> text icons use, so each caller's own
45
+ // span.<class> rule (font-size, spacing) sizes it; the image fills
46
+ // 1em of that (img.wd-icon-img in layout/styles/base.css).
47
+ <span class={className} style={style}><img src={siteHref(resolved.src)} alt="" class="wd-icon-img" /></span>
48
+ ) : (
49
+ <span class={className} style={style}>{resolved.value}</span>
50
+ )
51
+ )}
@@ -1,193 +1,193 @@
1
- ---
2
- import { extraClasses } from './class-names';
3
- import AppIcon from './AppIcon.astro';
4
- import { siteHref } from '../lib/site-base';
5
-
6
- // Three visual variants, chosen by which optional prop is set - never more
7
- // than one of icon/img/method actually renders at once, but they're kept
8
- // as independent props (not a single `variant` union) since `icon` is
9
- // meant to keep working exactly as before for existing content, and `href`
10
- // applies identically to all three.
11
- interface Props {
12
- title: string;
13
- icon?: string;
14
- // Renders a full-width image above the title instead of AppIcon's small
15
- // icon - takes priority over `icon` if both are somehow set (see the
16
- // template below), since a real image is the more deliberate/specific
17
- // choice of the two.
18
- img?: string;
19
- // API-reference style: a solid, colored method badge next to the title,
20
- // top-right. Same 5 known methods + fallback-gray "other" as the
21
- // sidebar's own OpenAPI badges (NavTree.astro's wd-nav-method-*) and the
22
- // Try-it playground's header (ApiPlayground.astro's wd-api-method-*) -
23
- // this is a third, independent copy of that same get/post/put/patch/
24
- // delete color set rather than a shared import, consistent with how
25
- // those two already don't share one either (different visual treatment
26
- // each - tinted pill in the sidebar, solid pill in the playground, solid
27
- // pill here too but sized for a card heading, not worth forcing into one
28
- // generic component over a handful of literal hex values).
29
- method?: string;
30
- href?: string;
31
- // Mintlify's Card props: `color` tints the icon, `horizontal` puts the
32
- // icon beside the text instead of above it, `cta` adds a call-to-action
33
- // line at the bottom, and `arrow` marks a linked card with an arrow in
34
- // its corner.
35
- color?: string;
36
- horizontal?: boolean;
37
- cta?: string;
38
- arrow?: boolean;
39
- }
40
- const { title, icon, img, method, href, color, horizontal = false, cta, arrow = false } = Astro.props as Props;
41
- const iconStyle = color ? `color: ${color}` : undefined;
42
- // An icon written as markup (an inline <svg>), moved into the `wd-icon` slot
43
- // by lib/mdx-title-anchor-ids.js.
44
- const iconHtml = Astro.slots.has('wd-icon') ? (await Astro.slots.render('wd-icon')).trim() : '';
45
- const Tag = href ? 'a' : 'div';
46
- const KNOWN_METHODS = ['get', 'post', 'put', 'patch', 'delete'];
47
- const methodLower = method?.toLowerCase();
48
- const methodClass = methodLower && KNOWN_METHODS.includes(methodLower) ? methodLower : 'other';
49
- ---
50
- <Tag class:list={['wd-card', { 'wd-card-horizontal': horizontal, 'wd-card-has-arrow': arrow && href }, extraClasses(Astro.props)]} href={siteHref(href)}>
51
- {img && <img src={siteHref(img)} alt="" class="wd-card-image" />}
52
- {!img && (iconHtml ? <span class="wd-card-icon" style={iconStyle} set:html={iconHtml} /> : <AppIcon icon={icon} class="wd-card-icon" style={iconStyle} />)}
53
- <div class="wd-card-text">
54
- <div class="wd-card-title-row">
55
- <h3 class="wd-card-title">{title}</h3>
56
- {
57
- method && (
58
- <span class:list={['wd-card-method', `wd-card-method-${methodClass}`]}>
59
- {method.toUpperCase()}
60
- </span>
61
- )
62
- }
63
- </div>
64
- <div class="wd-card-body"><slot /></div>
65
- {cta && <span class="wd-card-cta">{cta} <span aria-hidden="true">&rarr;</span></span>}
66
- </div>
67
- {arrow && href && <span class="wd-card-arrow" aria-hidden="true">&#8599;</span>}
68
- </Tag>
69
- <style>
70
- .wd-card {
71
- display: block;
72
- border: 1px solid var(--wd-border);
73
- border-radius: 0.6rem;
74
- padding: 1.1rem 1.2rem;
75
- text-decoration: none;
76
- color: inherit;
77
- transition: border-color 0.15s ease;
78
- }
79
- a.wd-card:hover {
80
- border-color: var(--wd-primary);
81
- }
82
- /* :global() is load-bearing: AppIcon.astro renders this span/svg, not
83
- Card.astro, so it never carries Card's own scope attribute - without
84
- :global() these selectors compile to something that can never match. */
85
- :global(span.wd-card-icon) {
86
- display: block;
87
- font-size: 1.3rem;
88
- }
89
- :global(svg.wd-card-icon) {
90
- display: block;
91
- width: 1.3rem;
92
- height: 1.3rem;
93
- }
94
- .wd-card-image {
95
- display: block;
96
- width: 100%;
97
- height: 9rem;
98
- object-fit: cover;
99
- border-radius: 0.4rem;
100
- background: var(--wd-surface);
101
- }
102
- /* Same 0.4rem/0.3rem the title itself used to carry directly, moved up
103
- onto this wrapper so it stays correct whether the row holds just a
104
- title (icon/img/no-icon variants) or a title + method badge side by
105
- side - a flex row's own margin does the same job a block element's
106
- margin did, without changing how any existing (no-method) card looks. */
107
- .wd-card-title-row {
108
- display: flex;
109
- align-items: center;
110
- justify-content: space-between;
111
- gap: 0.5rem;
112
- margin: 0.4rem 0 0.3rem;
113
- }
114
- .wd-card-title {
115
- margin: 0;
116
- font-size: 1rem;
117
- color: var(--wd-heading);
118
- }
119
- .wd-card-method {
120
- flex-shrink: 0;
121
- display: inline-block;
122
- padding: 0.2rem 0.55rem;
123
- border-radius: 0.3rem;
124
- font-size: 0.72rem;
125
- font-weight: 700;
126
- letter-spacing: 0.02em;
127
- color: #fff;
128
- }
129
- .wd-card-method-get {
130
- background: #16a34a;
131
- }
132
- .wd-card-method-post {
133
- background: #2563eb;
134
- }
135
- .wd-card-method-put {
136
- background: #9333ea;
137
- }
138
- .wd-card-method-patch {
139
- background: #d97706;
140
- }
141
- .wd-card-method-delete {
142
- background: #dc2626;
143
- }
144
- .wd-card-method-other {
145
- background: var(--wd-text-muted);
146
- }
147
- .wd-card-body {
148
- font-size: 0.9rem;
149
- color: var(--wd-text);
150
- margin: 0;
151
- }
152
- .wd-card-body :global(p) {
153
- margin: 0;
154
- }
155
- /* Icon in its own column beside the title/body, both vertically
156
- centered - Mintlify's compact horizontal card. */
157
- .wd-card-horizontal {
158
- display: flex;
159
- align-items: center;
160
- gap: 0.9rem;
161
- }
162
- .wd-card-horizontal .wd-card-title-row {
163
- margin-top: 0;
164
- }
165
- .wd-card-text {
166
- min-width: 0;
167
- flex: 1;
168
- }
169
- .wd-card-cta {
170
- display: inline-block;
171
- margin-top: 0.7rem;
172
- font-size: 0.85rem;
173
- font-weight: 600;
174
- color: var(--wd-primary);
175
- }
176
- /* Only a card that shows the arrow becomes a positioning context -
177
- setting it on every card changed how existing cards' text was
178
- antialiased, for no layout reason. */
179
- .wd-card-has-arrow {
180
- position: relative;
181
- }
182
- .wd-card-arrow {
183
- position: absolute;
184
- top: 0.8rem;
185
- right: 0.9rem;
186
- color: var(--wd-text-muted);
187
- font-size: 0.95rem;
188
- line-height: 1;
189
- }
190
- a.wd-card:hover .wd-card-arrow {
191
- color: var(--wd-primary);
192
- }
193
- </style>
1
+ ---
2
+ import { extraClasses } from './class-names';
3
+ import AppIcon from './AppIcon.astro';
4
+ import { siteHref } from '../lib/site-base';
5
+
6
+ // Three visual variants, chosen by which optional prop is set - never more
7
+ // than one of icon/img/method actually renders at once, but they're kept
8
+ // as independent props (not a single `variant` union) since `icon` is
9
+ // meant to keep working exactly as before for existing content, and `href`
10
+ // applies identically to all three.
11
+ interface Props {
12
+ title: string;
13
+ icon?: string;
14
+ // Renders a full-width image above the title instead of AppIcon's small
15
+ // icon - takes priority over `icon` if both are somehow set (see the
16
+ // template below), since a real image is the more deliberate/specific
17
+ // choice of the two.
18
+ img?: string;
19
+ // API-reference style: a solid, colored method badge next to the title,
20
+ // top-right. Same 5 known methods + fallback-gray "other" as the
21
+ // sidebar's own OpenAPI badges (NavTree.astro's wd-nav-method-*) and the
22
+ // Try-it playground's header (ApiPlayground.astro's wd-api-method-*) -
23
+ // this is a third, independent copy of that same get/post/put/patch/
24
+ // delete color set rather than a shared import, consistent with how
25
+ // those two already don't share one either (different visual treatment
26
+ // each - tinted pill in the sidebar, solid pill in the playground, solid
27
+ // pill here too but sized for a card heading, not worth forcing into one
28
+ // generic component over a handful of literal hex values).
29
+ method?: string;
30
+ href?: string;
31
+ // Mintlify's Card props: `color` tints the icon, `horizontal` puts the
32
+ // icon beside the text instead of above it, `cta` adds a call-to-action
33
+ // line at the bottom, and `arrow` marks a linked card with an arrow in
34
+ // its corner.
35
+ color?: string;
36
+ horizontal?: boolean;
37
+ cta?: string;
38
+ arrow?: boolean;
39
+ }
40
+ const { title, icon, img, method, href, color, horizontal = false, cta, arrow = false } = Astro.props as Props;
41
+ const iconStyle = color ? `color: ${color}` : undefined;
42
+ // An icon written as markup (an inline <svg>), moved into the `wd-icon` slot
43
+ // by lib/mdx-title-anchor-ids.js.
44
+ const iconHtml = Astro.slots.has('wd-icon') ? (await Astro.slots.render('wd-icon')).trim() : '';
45
+ const Tag = href ? 'a' : 'div';
46
+ const KNOWN_METHODS = ['get', 'post', 'put', 'patch', 'delete'];
47
+ const methodLower = method?.toLowerCase();
48
+ const methodClass = methodLower && KNOWN_METHODS.includes(methodLower) ? methodLower : 'other';
49
+ ---
50
+ <Tag class:list={['wd-card', { 'wd-card-horizontal': horizontal, 'wd-card-has-arrow': arrow && href }, extraClasses(Astro.props)]} href={siteHref(href)}>
51
+ {img && <img src={siteHref(img)} alt="" class="wd-card-image" />}
52
+ {!img && (iconHtml ? <span class="wd-card-icon" style={iconStyle} set:html={iconHtml} /> : <AppIcon icon={icon} class="wd-card-icon" style={iconStyle} />)}
53
+ <div class="wd-card-text">
54
+ <div class="wd-card-title-row">
55
+ <h3 class="wd-card-title">{title}</h3>
56
+ {
57
+ method && (
58
+ <span class:list={['wd-card-method', `wd-card-method-${methodClass}`]}>
59
+ {method.toUpperCase()}
60
+ </span>
61
+ )
62
+ }
63
+ </div>
64
+ <div class="wd-card-body"><slot /></div>
65
+ {cta && <span class="wd-card-cta">{cta} <span aria-hidden="true">&rarr;</span></span>}
66
+ </div>
67
+ {arrow && href && <span class="wd-card-arrow" aria-hidden="true">&#8599;</span>}
68
+ </Tag>
69
+ <style>
70
+ .wd-card {
71
+ display: block;
72
+ border: 1px solid var(--wd-border);
73
+ border-radius: 0.6rem;
74
+ padding: 1.1rem 1.2rem;
75
+ text-decoration: none;
76
+ color: inherit;
77
+ transition: border-color 0.15s ease;
78
+ }
79
+ a.wd-card:hover {
80
+ border-color: var(--wd-primary);
81
+ }
82
+ /* :global() is load-bearing: AppIcon.astro renders this span/svg, not
83
+ Card.astro, so it never carries Card's own scope attribute - without
84
+ :global() these selectors compile to something that can never match. */
85
+ :global(span.wd-card-icon) {
86
+ display: block;
87
+ font-size: 1.3rem;
88
+ }
89
+ :global(svg.wd-card-icon) {
90
+ display: block;
91
+ width: 1.3rem;
92
+ height: 1.3rem;
93
+ }
94
+ .wd-card-image {
95
+ display: block;
96
+ width: 100%;
97
+ height: 9rem;
98
+ object-fit: cover;
99
+ border-radius: 0.4rem;
100
+ background: var(--wd-surface);
101
+ }
102
+ /* Same 0.4rem/0.3rem the title itself used to carry directly, moved up
103
+ onto this wrapper so it stays correct whether the row holds just a
104
+ title (icon/img/no-icon variants) or a title + method badge side by
105
+ side - a flex row's own margin does the same job a block element's
106
+ margin did, without changing how any existing (no-method) card looks. */
107
+ .wd-card-title-row {
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: space-between;
111
+ gap: 0.5rem;
112
+ margin: 0.4rem 0 0.3rem;
113
+ }
114
+ .wd-card-title {
115
+ margin: 0;
116
+ font-size: 1rem;
117
+ color: var(--wd-heading);
118
+ }
119
+ .wd-card-method {
120
+ flex-shrink: 0;
121
+ display: inline-block;
122
+ padding: 0.2rem 0.55rem;
123
+ border-radius: 0.3rem;
124
+ font-size: 0.72rem;
125
+ font-weight: 700;
126
+ letter-spacing: 0.02em;
127
+ color: #fff;
128
+ }
129
+ .wd-card-method-get {
130
+ background: #16a34a;
131
+ }
132
+ .wd-card-method-post {
133
+ background: #2563eb;
134
+ }
135
+ .wd-card-method-put {
136
+ background: #9333ea;
137
+ }
138
+ .wd-card-method-patch {
139
+ background: #d97706;
140
+ }
141
+ .wd-card-method-delete {
142
+ background: #dc2626;
143
+ }
144
+ .wd-card-method-other {
145
+ background: var(--wd-text-muted);
146
+ }
147
+ .wd-card-body {
148
+ font-size: 0.9rem;
149
+ color: var(--wd-text);
150
+ margin: 0;
151
+ }
152
+ .wd-card-body :global(p) {
153
+ margin: 0;
154
+ }
155
+ /* Icon in its own column beside the title/body, both vertically
156
+ centered - Mintlify's compact horizontal card. */
157
+ .wd-card-horizontal {
158
+ display: flex;
159
+ align-items: center;
160
+ gap: 0.9rem;
161
+ }
162
+ .wd-card-horizontal .wd-card-title-row {
163
+ margin-top: 0;
164
+ }
165
+ .wd-card-text {
166
+ min-width: 0;
167
+ flex: 1;
168
+ }
169
+ .wd-card-cta {
170
+ display: inline-block;
171
+ margin-top: 0.7rem;
172
+ font-size: 0.85rem;
173
+ font-weight: 600;
174
+ color: var(--wd-primary);
175
+ }
176
+ /* Only a card that shows the arrow becomes a positioning context -
177
+ setting it on every card changed how existing cards' text was
178
+ antialiased, for no layout reason. */
179
+ .wd-card-has-arrow {
180
+ position: relative;
181
+ }
182
+ .wd-card-arrow {
183
+ position: absolute;
184
+ top: 0.8rem;
185
+ right: 0.9rem;
186
+ color: var(--wd-text-muted);
187
+ font-size: 0.95rem;
188
+ line-height: 1;
189
+ }
190
+ a.wd-card:hover .wd-card-arrow {
191
+ color: var(--wd-primary);
192
+ }
193
+ </style>
@@ -99,87 +99,111 @@ const { dropdown = false } = Astro.props as Props;
99
99
  document.addEventListener('astro:page-load', () => initCodeGroups(document));
100
100
  </script>
101
101
  <style is:global>
102
- /* The single rounded border the docs promise ("a tabbed interface,
103
- switching between snippets the same way Tabs does" - see
104
- site/docs/content/components.mdx and kitchen-sink's own copy)
105
- lives here now, on the group itself, not on each block -
106
- overflow: hidden is load-bearing: every .wd-code-block inside loses
107
- its own border-radius below, so it's this container's own radius
108
- clipping the first/last block's corners (and, once tabbed, the
109
- tab strip's own top corners) into that outer radius, not each
110
- piece rounding itself. */
102
+ /* The group is one frame, like a single block's (see .wd-code-block in
103
+ [...slug].astro): border, surface background and a 0.125rem inset,
104
+ with the tab strip (or dropdown) on the frame and the code panel
105
+ inside. The blocks inside lose their own frame below, so it isn't
106
+ drawn twice. */
111
107
  .wd-codegroup {
112
- margin: 1.25rem 0;
108
+ position: relative;
109
+ margin: 1.25rem 0 2rem;
110
+ padding: 0.125rem;
113
111
  border: 1px solid var(--wd-border);
114
- border-radius: 0.55rem;
115
- overflow: hidden;
112
+ border-radius: 1rem;
113
+ background: var(--wd-surface);
116
114
  }
117
115
  /* Each fenced code block inside a <CodeGroup> is wrapped in a
118
116
  .wd-code-block div by codeBlockTransformer (see astro.config.mjs /
119
- src/lib/shiki-code-block.js) rather than being a bare <pre> - and
120
- .wd-code-block itself now owns the card chrome (border/radius),
121
- not the <pre> inside it (see [...slug].astro's base rule). Zeroes
122
- out that per-block chrome entirely - margin (so blocks stack flush
123
- with no visible gap between them, unlike a standalone block),
124
- border and radius (both now the group's own job, above). */
117
+ src/lib/shiki-code-block.js) rather than being a bare <pre> - this
118
+ drops that wrapper's own frame (margin, inset, border, radius,
119
+ background), leaving its title bar and code panel on the group's. */
125
120
  .wd-codegroup > .wd-code-block {
126
121
  margin: 0;
122
+ padding: 0;
127
123
  border: none;
128
124
  border-radius: 0;
125
+ background: none;
129
126
  }
130
127
  /* No-JS / too-small-to-tab fallback only - once initCodeGroups() above
131
128
  hides every block but the active one, there's never two adjacent
132
- *visible* blocks left for this to draw a line between, so it's
133
- inert in the normal tabbed case. Without JS, every block stays
134
- visible and stacked, and this is what still separates them. */
129
+ *visible* blocks left for this to space apart, so it's inert in the
130
+ normal tabbed case. Without JS, every block stays visible and
131
+ stacked, each with its own title bar. */
135
132
  .wd-codegroup > .wd-code-block + .wd-code-block {
136
- border-top: 1px solid var(--wd-border);
133
+ margin-top: 0.5rem;
137
134
  }
135
+ /* 2rem tall, like a block's title bar, with room on the right for the
136
+ shown block's copy button (moved into this row below). */
138
137
  .wd-codegroup-nav {
139
138
  display: flex;
140
- gap: 0.25rem;
141
- padding: 0 0.5rem;
139
+ gap: 1rem;
140
+ padding: 0 2.75rem 0 0.875rem;
142
141
  overflow-x: auto;
143
- background: var(--wd-surface);
144
- border-bottom: 1px solid var(--wd-border);
142
+ scrollbar-width: none;
145
143
  }
146
144
  .wd-codegroup-tab {
147
145
  flex-shrink: 0;
148
- padding: 0.55rem 0.7rem;
146
+ padding: 0.25rem 0.125rem calc(0.25rem - 2px);
149
147
  border: none;
150
148
  border-bottom: 2px solid transparent;
151
149
  background: none;
152
- font-family: monospace;
153
- font-size: 0.78rem;
150
+ font-family: inherit;
151
+ font-size: 0.75rem;
154
152
  font-weight: 500;
155
- color: var(--wd-text);
153
+ line-height: 1.5rem;
154
+ color: var(--wd-text-muted);
156
155
  white-space: nowrap;
157
156
  cursor: pointer;
158
157
  }
158
+ .wd-codegroup-tab:hover {
159
+ color: var(--wd-text);
160
+ }
159
161
  .wd-codegroup-tab.active {
160
162
  color: var(--wd-primary);
161
163
  border-bottom-color: var(--wd-primary);
162
164
  }
163
- /* dropdown="true" case - same background/border-bottom as the tab
164
- strip it replaces, so a RequestExample/ResponseExample's dropdown
165
- mode still reads as the same "code block chrome" family. */
165
+ /* dropdown="true" case - the same 2rem row on the frame as the tab
166
+ strip it replaces. */
166
167
  .wd-codegroup-select {
167
168
  display: block;
168
- width: 100%;
169
- padding: 0.5rem 0.7rem;
169
+ max-width: calc(100% - 3.375rem);
170
+ margin-left: 0.625rem;
171
+ padding: 0.25rem;
170
172
  border: none;
171
- border-bottom: 1px solid var(--wd-border);
172
- background: var(--wd-surface);
173
+ background: transparent;
173
174
  color: var(--wd-text);
174
- font-family: monospace;
175
- font-size: 0.78rem;
175
+ font-family: inherit;
176
+ font-size: 0.75rem;
176
177
  font-weight: 500;
178
+ line-height: 1.5rem;
177
179
  cursor: pointer;
178
180
  }
181
+ .wd-codegroup-select option {
182
+ background: var(--wd-background);
183
+ color: var(--wd-text);
184
+ }
179
185
  /* The tab/option label already shows this same text - see labelFor()
180
186
  above - so the per-block title bar underneath would just repeat
181
187
  it. */
182
188
  .wd-codegroup-tabbed .wd-code-title {
183
189
  display: none;
184
190
  }
191
+ /* Once tabbed, the shown block's copy button sits at the right end of
192
+ the tab row, as it would in its own title bar: the block stops being
193
+ its positioning box, so the button is placed against the group. */
194
+ .wd-codegroup-tabbed > .wd-code-block {
195
+ position: static;
196
+ }
197
+ .wd-codegroup-tabbed > .wd-code-block > .wd-code-copy-btn {
198
+ top: 0.375rem;
199
+ right: 0.5rem;
200
+ width: 1.5rem;
201
+ height: 1.5rem;
202
+ border-color: transparent;
203
+ background: transparent;
204
+ opacity: 1;
205
+ }
206
+ .wd-codegroup-tabbed > .wd-code-block > .wd-code-copy-btn:hover {
207
+ background: color-mix(in srgb, var(--wd-text) 8%, transparent);
208
+ }
185
209
  </style>