@writedocs/generator 0.10.6 → 0.10.8
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.
- package/package.json +1 -1
- package/src/components/Accordion.astro +3 -3
- package/src/components/ApiPlayground.astro +4 -4
- package/src/components/ApiReferencePanel.astro +1 -1
- package/src/components/Card.astro +2 -1
- package/src/components/CodeGroup.astro +1 -1
- package/src/components/Frame.astro +2 -2
- package/src/components/GitHubRepo.astro +2 -2
- package/src/components/Image.astro +1 -1
- package/src/components/Parameter.astro +1 -1
- package/src/components/Prompt.astro +1 -1
- package/src/components/Tabs.astro +1 -1
- package/src/components/Tile.astro +2 -2
- package/src/components/Update.astro +1 -1
- package/src/components/Video.astro +1 -1
- package/src/layout/BaseLayout.astro +217 -165
- package/src/layout/components/NavTree.astro +6 -6
- package/src/layout/components/TableOfContents.astro +3 -3
- package/src/layout/styles/base.css +7 -0
- package/src/layout/styles/topbar.css +1 -1
- package/src/lib/a11y-check.js +1 -1
- package/src/lib/json-schema-descriptions.js +2 -2
- package/src/pages/[...slug].astro +1 -1
- package/writedocs.schema.json +4 -4
package/package.json
CHANGED
|
@@ -144,11 +144,11 @@ const titleId = _titleId ?? slugify(title);
|
|
|
144
144
|
}
|
|
145
145
|
.wd-accordion-description {
|
|
146
146
|
font-size: 0.85rem;
|
|
147
|
-
color: var(--wd-text
|
|
147
|
+
color: var(--wd-text);
|
|
148
148
|
}
|
|
149
149
|
.wd-accordion-title {
|
|
150
150
|
font-weight: 700;
|
|
151
|
-
color: var(--wd-
|
|
151
|
+
color: var(--wd-heading);
|
|
152
152
|
scroll-margin-top: calc(var(--wd-topbar-offset, 5rem) + 1rem);
|
|
153
153
|
}
|
|
154
154
|
/* .wd-heading-anchor's base look (color, opacity: 0, transition) comes
|
|
@@ -171,7 +171,7 @@ const titleId = _titleId ?? slugify(title);
|
|
|
171
171
|
}
|
|
172
172
|
.wd-accordion-body {
|
|
173
173
|
padding: 1.1rem 1rem;
|
|
174
|
-
color: var(--wd-text
|
|
174
|
+
color: var(--wd-text);
|
|
175
175
|
}
|
|
176
176
|
.wd-accordion-body :global(p:first-child) {
|
|
177
177
|
margin-top: 0;
|
|
@@ -207,7 +207,7 @@ const responseHtml = new Map(await Promise.all(responseEntries.map(async ([statu
|
|
|
207
207
|
font-weight: 600;
|
|
208
208
|
}
|
|
209
209
|
.wd-api-description {
|
|
210
|
-
color: var(--wd-text
|
|
210
|
+
color: var(--wd-text);
|
|
211
211
|
margin: 0.9rem 0 0;
|
|
212
212
|
}
|
|
213
213
|
.wd-api-section {
|
|
@@ -216,7 +216,7 @@ const responseHtml = new Map(await Promise.all(responseEntries.map(async ([statu
|
|
|
216
216
|
.wd-api-section h4 {
|
|
217
217
|
font-size: 1rem;
|
|
218
218
|
font-weight: 600;
|
|
219
|
-
color: var(--wd-
|
|
219
|
+
color: var(--wd-heading);
|
|
220
220
|
margin: 0 0 0.9rem;
|
|
221
221
|
}
|
|
222
222
|
.wd-api-content-type {
|
|
@@ -272,11 +272,11 @@ const responseHtml = new Map(await Promise.all(responseEntries.map(async ([statu
|
|
|
272
272
|
}
|
|
273
273
|
.wd-api-param-desc {
|
|
274
274
|
margin: 0.4rem 0 0;
|
|
275
|
-
color: var(--wd-text
|
|
275
|
+
color: var(--wd-text);
|
|
276
276
|
font-size: 0.88rem;
|
|
277
277
|
}
|
|
278
278
|
.wd-api-param-desc-inline {
|
|
279
|
-
color: var(--wd-text
|
|
279
|
+
color: var(--wd-text);
|
|
280
280
|
font-size: 0.85rem;
|
|
281
281
|
}
|
|
282
282
|
/* Sits above a response tab's own schema field list (when there's a
|
|
@@ -906,7 +906,7 @@ const securityJson = JSON.stringify(op?.security ?? []);
|
|
|
906
906
|
}
|
|
907
907
|
.wd-api-modal-title-text {
|
|
908
908
|
font-weight: 600;
|
|
909
|
-
color: var(--wd-
|
|
909
|
+
color: var(--wd-heading);
|
|
910
910
|
}
|
|
911
911
|
/* Only rendered when the operation's request body actually carries a
|
|
912
912
|
named `examples` map (see requestExampleEntries above) - sits
|
|
@@ -110,6 +110,7 @@ const methodClass = methodLower && KNOWN_METHODS.includes(methodLower) ? methodL
|
|
|
110
110
|
.wd-card-title {
|
|
111
111
|
margin: 0;
|
|
112
112
|
font-size: 1rem;
|
|
113
|
+
color: var(--wd-heading);
|
|
113
114
|
}
|
|
114
115
|
.wd-card-method {
|
|
115
116
|
flex-shrink: 0;
|
|
@@ -141,7 +142,7 @@ const methodClass = methodLower && KNOWN_METHODS.includes(methodLower) ? methodL
|
|
|
141
142
|
}
|
|
142
143
|
.wd-card-body {
|
|
143
144
|
font-size: 0.9rem;
|
|
144
|
-
color: var(--wd-text
|
|
145
|
+
color: var(--wd-text);
|
|
145
146
|
margin: 0;
|
|
146
147
|
}
|
|
147
148
|
.wd-card-body :global(p) {
|
|
@@ -100,13 +100,13 @@ const { caption, hint } = Astro.props as Props;
|
|
|
100
100
|
}
|
|
101
101
|
.wd-frame-hint {
|
|
102
102
|
margin: 0.1rem 0.25rem 0.5rem;
|
|
103
|
-
color: var(--wd-text
|
|
103
|
+
color: var(--wd-text);
|
|
104
104
|
font-size: 0.8rem;
|
|
105
105
|
}
|
|
106
106
|
.wd-frame-caption {
|
|
107
107
|
margin: 0.6rem 0 0;
|
|
108
108
|
text-align: center;
|
|
109
|
-
color: var(--wd-text
|
|
109
|
+
color: var(--wd-text);
|
|
110
110
|
font-size: 0.75rem;
|
|
111
111
|
}
|
|
112
112
|
</style>
|
|
@@ -131,7 +131,7 @@ const valid = /^[\w.-]+\/[\w.-]+$/.test(slug);
|
|
|
131
131
|
align-items: center;
|
|
132
132
|
gap: 0.5rem;
|
|
133
133
|
font-weight: 600;
|
|
134
|
-
color: var(--wd-
|
|
134
|
+
color: var(--wd-heading);
|
|
135
135
|
}
|
|
136
136
|
:global(svg.wd-github-repo-icon) {
|
|
137
137
|
width: 1.1rem;
|
|
@@ -141,7 +141,7 @@ const valid = /^[\w.-]+\/[\w.-]+$/.test(slug);
|
|
|
141
141
|
.wd-github-repo-description {
|
|
142
142
|
margin: 0.4rem 0 0;
|
|
143
143
|
font-size: 0.875rem;
|
|
144
|
-
color: var(--wd-text
|
|
144
|
+
color: var(--wd-text);
|
|
145
145
|
}
|
|
146
146
|
.wd-github-repo-stats {
|
|
147
147
|
display: flex;
|
|
@@ -139,7 +139,7 @@ const hasDefault = defaultValue !== undefined && defaultValue !== null && defaul
|
|
|
139
139
|
color: var(--wd-text-muted);
|
|
140
140
|
}
|
|
141
141
|
.wd-parameter-body {
|
|
142
|
-
color: var(--wd-text
|
|
142
|
+
color: var(--wd-text);
|
|
143
143
|
}
|
|
144
144
|
.wd-parameter-body :global(p:first-child) {
|
|
145
145
|
margin-top: 0;
|
|
@@ -127,7 +127,7 @@ const showCursor = actions.includes('cursor') && cursorHref !== null && cursorHr
|
|
|
127
127
|
.wd-prompt-body {
|
|
128
128
|
padding: 0 1.1rem 0.9rem;
|
|
129
129
|
font-size: 0.9rem;
|
|
130
|
-
color: var(--wd-text
|
|
130
|
+
color: var(--wd-text);
|
|
131
131
|
}
|
|
132
132
|
.wd-prompt-body :global(p:first-child) {
|
|
133
133
|
margin-top: 0;
|
|
@@ -56,11 +56,11 @@ const Tag = href ? 'a' : 'div';
|
|
|
56
56
|
.wd-tile-title {
|
|
57
57
|
margin-top: 0.6rem;
|
|
58
58
|
font-weight: 600;
|
|
59
|
-
color: var(--wd-
|
|
59
|
+
color: var(--wd-heading);
|
|
60
60
|
}
|
|
61
61
|
.wd-tile-description {
|
|
62
62
|
margin-top: 0.15rem;
|
|
63
63
|
font-size: 0.875rem;
|
|
64
|
-
color: var(--wd-text
|
|
64
|
+
color: var(--wd-text);
|
|
65
65
|
}
|
|
66
66
|
</style>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// component below imports for itself) lives in src/layout/styles/ - this
|
|
18
18
|
// file is the layout's single entry point/orchestrator, everything else
|
|
19
19
|
// is a piece it composes.
|
|
20
|
-
import fs from
|
|
20
|
+
import fs from "node:fs";
|
|
21
21
|
// Named `nodePath`, not the more natural `path` - this component already
|
|
22
22
|
// destructures a prop called `path` (the current page's own URL path,
|
|
23
23
|
// see Props below) from Astro.props, which would otherwise shadow a
|
|
@@ -26,7 +26,7 @@ import fs from 'node:fs';
|
|
|
26
26
|
// ("path.join is not a function") rather than a compile-time error, since
|
|
27
27
|
// both are just plain identifiers to the bundler. Hit and fixed while
|
|
28
28
|
// wiring up findRootAssets() below - real bug, not a hypothetical.
|
|
29
|
-
import nodePath from
|
|
29
|
+
import nodePath from "node:path";
|
|
30
30
|
import {
|
|
31
31
|
resolveSiteUrl,
|
|
32
32
|
resolveAbsoluteUrl,
|
|
@@ -40,8 +40,8 @@ import {
|
|
|
40
40
|
type Selector,
|
|
41
41
|
type GlobalDropdownView,
|
|
42
42
|
type SeoFields,
|
|
43
|
-
} from
|
|
44
|
-
import
|
|
43
|
+
} from "../lib/config";
|
|
44
|
+
import "../styles/global.css";
|
|
45
45
|
// rehypeKatex (astro.config.mjs) renders every $inline$/$$block$$ math
|
|
46
46
|
// span into real KaTeX markup at build time - this is the one runtime
|
|
47
47
|
// dependency that output needs: layout/glyph CSS for the .katex class
|
|
@@ -53,9 +53,9 @@ import '../styles/global.css';
|
|
|
53
53
|
// output deliberately sets no explicit text color, inheriting `color`
|
|
54
54
|
// from whatever wraps it - so it already follows this site's light/dark
|
|
55
55
|
// theme with no extra CSS needed here.
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
56
|
+
import "katex/dist/katex.min.css";
|
|
57
|
+
import "./styles/base.css";
|
|
58
|
+
import "./styles/banner.css";
|
|
59
59
|
// Astro's client-side router - swaps <body> content between same-origin
|
|
60
60
|
// navigations via the native View Transition API instead of a hard
|
|
61
61
|
// browser reload, so the topbar/sidebar/footer don't visibly flash/
|
|
@@ -68,14 +68,14 @@ import './styles/banner.css';
|
|
|
68
68
|
// pair) - that event only ever fires when this router is active, so this
|
|
69
69
|
// was already the intended architecture, just missing this one piece
|
|
70
70
|
// that actually turns it on.
|
|
71
|
-
import { ClientRouter } from
|
|
72
|
-
import TopBar from
|
|
73
|
-
import MobileMenu from
|
|
74
|
-
import SearchModal from
|
|
75
|
-
import ImageZoom from
|
|
76
|
-
import SiteFooter from
|
|
77
|
-
import AnalyticsScripts from
|
|
78
|
-
import AskAiWidget from
|
|
71
|
+
import { ClientRouter } from "astro:transitions";
|
|
72
|
+
import TopBar from "./components/TopBar.astro";
|
|
73
|
+
import MobileMenu from "./components/MobileMenu.astro";
|
|
74
|
+
import SearchModal from "./components/SearchModal.astro";
|
|
75
|
+
import ImageZoom from "./components/ImageZoom.astro";
|
|
76
|
+
import SiteFooter from "./components/SiteFooter.astro";
|
|
77
|
+
import AnalyticsScripts from "./components/AnalyticsScripts.astro";
|
|
78
|
+
import AskAiWidget from "./components/AskAiWidget.astro";
|
|
79
79
|
|
|
80
80
|
interface Props {
|
|
81
81
|
config: DocsConfig;
|
|
@@ -115,7 +115,7 @@ interface Props {
|
|
|
115
115
|
// own to conditionally omit - an unfilled named slot in Astro already
|
|
116
116
|
// renders nothing, so this component only needs to know whether to
|
|
117
117
|
// render the *column wrapper divs* at all).
|
|
118
|
-
mode?:
|
|
118
|
+
mode?: "default" | "wide" | "frame" | "custom" | "blank";
|
|
119
119
|
// The page's language, for <html lang> - the `language` of the
|
|
120
120
|
// navigation level it belongs to (see [...slug].astro), or 'en'.
|
|
121
121
|
lang?: string;
|
|
@@ -128,23 +128,23 @@ const {
|
|
|
128
128
|
seo = {},
|
|
129
129
|
selectors = [],
|
|
130
130
|
globalDropdowns = [],
|
|
131
|
-
mode =
|
|
132
|
-
lang =
|
|
131
|
+
mode = "default",
|
|
132
|
+
lang = "en",
|
|
133
133
|
} = Astro.props as Props;
|
|
134
|
-
const showSidebarCol = mode ===
|
|
135
|
-
const showTocCol = mode ===
|
|
134
|
+
const showSidebarCol = mode === "default" || mode === "wide";
|
|
135
|
+
const showTocCol = mode === "default";
|
|
136
136
|
// Meta tag resolution - all derived once here rather than inline in the
|
|
137
137
|
// template below, so the JSX stays a straight list of conditional <meta>
|
|
138
138
|
// tags instead of repeating this logic at each call site.
|
|
139
139
|
const siteUrl = resolveSiteUrl(config);
|
|
140
140
|
const effectiveDescription = description ?? config.description;
|
|
141
141
|
const canonicalUrl = siteUrl ? `${siteUrl}${path}` : null;
|
|
142
|
-
const ogType = seo.ogType ??
|
|
142
|
+
const ogType = seo.ogType ?? "website";
|
|
143
143
|
const absoluteOgImage = seo.ogImage ? resolveAbsoluteUrl(siteUrl, seo.ogImage) : undefined;
|
|
144
144
|
// summary_large_image needs a real image to make sense as a card size;
|
|
145
145
|
// falls back to the smaller "summary" card when no image is set, rather
|
|
146
146
|
// than always defaulting to the large-image card regardless.
|
|
147
|
-
const twitterCard = seo.twitterCard ?? (absoluteOgImage ?
|
|
147
|
+
const twitterCard = seo.twitterCard ?? (absoluteOgImage ? "summary_large_image" : "summary");
|
|
148
148
|
// Light-mode values come straight from styles.colors/styles.background
|
|
149
149
|
// (with defaults); dark-mode values fall back to their light counterpart
|
|
150
150
|
// when the site's own dark override doesn't set them, so a site only has
|
|
@@ -159,9 +159,11 @@ const twitterCard = seo.twitterCard ?? (absoluteOgImage ? 'summary_large_image'
|
|
|
159
159
|
// into custom-property assignments at all, and that directive only works
|
|
160
160
|
// on a <style> tag physically inside an .astro file's own template.
|
|
161
161
|
const lightPrimary = config.styles.colors.primary;
|
|
162
|
-
const lightText = config.styles.colors.text ??
|
|
162
|
+
const lightText = config.styles.colors.text ?? "#404045";
|
|
163
163
|
const darkPrimary = config.styles.colors.dark?.primary ?? lightPrimary;
|
|
164
|
-
|
|
164
|
+
// Body text - also the sidebar's and table of contents' links. Headings,
|
|
165
|
+
// bold text and group titles use the stronger --wd-heading (below).
|
|
166
|
+
const darkText = config.styles.colors.dark?.text ?? "#a0a0a5";
|
|
165
167
|
// Text drawn on the primary color (step numbers, the info banner, the API
|
|
166
168
|
// playground's buttons) - white, or black on a clearly light primary
|
|
167
169
|
// (contrastTextColor(), lib/config.ts). It used to be white everywhere,
|
|
@@ -177,8 +179,8 @@ const darkOnPrimary = contrastTextColor(darkPrimary);
|
|
|
177
179
|
// just the --wd-background half, independent of this - see config.ts's
|
|
178
180
|
// own comment on why that split was removed; `lightBackground`/
|
|
179
181
|
// `darkBackground` here is what used to read that other field.
|
|
180
|
-
const lightBackground = config.styles.background?.colors?.light ??
|
|
181
|
-
const darkBackground = config.styles.background?.colors?.dark ??
|
|
182
|
+
const lightBackground = config.styles.background?.colors?.light ?? "#ffffff";
|
|
183
|
+
const darkBackground = config.styles.background?.colors?.dark ?? "#0b1120";
|
|
182
184
|
// The topbar/mobile-menu-panel background - falls back to the page's own
|
|
183
185
|
// background (above) when a site doesn't set it, so an unconfigured navbar
|
|
184
186
|
// keeps blending into the page exactly as it always has; only sites that
|
|
@@ -218,14 +220,14 @@ const darkNavbarConfigured = config.styles.navbar?.dark !== undefined;
|
|
|
218
220
|
// would drag it back toward the background's own hue and undo the
|
|
219
221
|
// contrast fix) - a plain opacity reduction, so it stays legible
|
|
220
222
|
// regardless of what hue the navbar itself happens to be.
|
|
221
|
-
const lightNavbarFg = lightNavbarConfigured ? contrastTextColor(lightNavbarBg) :
|
|
222
|
-
const darkNavbarFg = darkNavbarConfigured ? contrastTextColor(darkNavbarBg) :
|
|
223
|
+
const lightNavbarFg = lightNavbarConfigured ? contrastTextColor(lightNavbarBg) : "var(--wd-text)";
|
|
224
|
+
const darkNavbarFg = darkNavbarConfigured ? contrastTextColor(darkNavbarBg) : "var(--wd-text)";
|
|
223
225
|
const lightNavbarFgMuted = lightNavbarConfigured
|
|
224
226
|
? `color-mix(in srgb, ${lightNavbarFg} 70%, transparent)`
|
|
225
|
-
:
|
|
227
|
+
: "var(--wd-text-muted)";
|
|
226
228
|
const darkNavbarFgMuted = darkNavbarConfigured
|
|
227
229
|
? `color-mix(in srgb, ${darkNavbarFg} 70%, transparent)`
|
|
228
|
-
:
|
|
230
|
+
: "var(--wd-text-muted)";
|
|
229
231
|
// --wd-navbar-accent: the tab-hover-underline/active-tab-fill color inside
|
|
230
232
|
// the topbar specifically - `accent` on the object form (a real, legitimate
|
|
231
233
|
// design choice, unlike text color above), falling back to the sitewide
|
|
@@ -246,16 +248,16 @@ const darkNavbarAccent = navDark.accent ?? darkPrimary;
|
|
|
246
248
|
// pixel-identical to before this existed.
|
|
247
249
|
const lightNavbarBorder = lightNavbarConfigured
|
|
248
250
|
? `color-mix(in srgb, ${lightNavbarFg} 25%, transparent)`
|
|
249
|
-
:
|
|
251
|
+
: "var(--wd-border)";
|
|
250
252
|
const darkNavbarBorder = darkNavbarConfigured
|
|
251
253
|
? `color-mix(in srgb, ${darkNavbarFg} 25%, transparent)`
|
|
252
|
-
:
|
|
254
|
+
: "var(--wd-border)";
|
|
253
255
|
// --wd-navbar-hover: a topbar tab's background on hover. On a navbar with
|
|
254
256
|
// the page's own background, the sidebar's hover tint (NavTree.astro) -
|
|
255
257
|
// the same 6% of --wd-primary. A configured navbar can *be* the primary
|
|
256
258
|
// color, where that tint would vanish, so there it's a light tint of the
|
|
257
259
|
// navbar's own contrast-correct text color instead, like --wd-navbar-border.
|
|
258
|
-
const sidebarHover =
|
|
260
|
+
const sidebarHover = "color-mix(in srgb, var(--wd-primary) 6%, transparent)";
|
|
259
261
|
const lightNavbarHover = lightNavbarConfigured ? `color-mix(in srgb, ${lightNavbarFg} 12%, transparent)` : sidebarHover;
|
|
260
262
|
const darkNavbarHover = darkNavbarConfigured ? `color-mix(in srgb, ${darkNavbarFg} 12%, transparent)` : sidebarHover;
|
|
261
263
|
// The <body> canvas's own paint - same color as --wd-background above
|
|
@@ -270,10 +272,10 @@ const lightPageBgColor = lightBackground;
|
|
|
270
272
|
const darkPageBgColor = darkBackground;
|
|
271
273
|
const lightPageBgImage = config.styles.background?.images?.light
|
|
272
274
|
? `url('${config.styles.background.images.light}')`
|
|
273
|
-
:
|
|
275
|
+
: "none";
|
|
274
276
|
const darkPageBgImage = config.styles.background?.images?.dark
|
|
275
277
|
? `url('${config.styles.background.images.dark}')`
|
|
276
|
-
:
|
|
278
|
+
: "none";
|
|
277
279
|
// A logo is either one path used for both modes, or a {light, dark,
|
|
278
280
|
// label} object - normalized to a single light/dark pair here (the one
|
|
279
281
|
// place that needs to know which form writedocs.json used) so TopBar.astro,
|
|
@@ -289,9 +291,9 @@ const darkPageBgImage = config.styles.background?.images?.dark
|
|
|
289
291
|
// image nor a label falls back to plain config.name text, so the brand
|
|
290
292
|
// link is never left empty.
|
|
291
293
|
const logo = config.styles.logo;
|
|
292
|
-
const logoLight = typeof logo ===
|
|
293
|
-
const logoDark = typeof logo ===
|
|
294
|
-
const logoLabel = typeof logo ===
|
|
294
|
+
const logoLight = typeof logo === "string" ? logo : logo?.light;
|
|
295
|
+
const logoDark = typeof logo === "string" ? logo : logo?.dark;
|
|
296
|
+
const logoLabel = typeof logo === "string" ? undefined : logo?.label;
|
|
295
297
|
const hasLogoImage = Boolean(logoLight || logoDark);
|
|
296
298
|
const brandLabel = logoLabel ?? (hasLogoImage ? undefined : config.name);
|
|
297
299
|
|
|
@@ -307,12 +309,12 @@ const brandLabel = logoLabel ?? (hasLogoImage ? undefined : config.name);
|
|
|
307
309
|
// one alongside or underneath it.
|
|
308
310
|
const footerLogoConfig = config.footer.logo;
|
|
309
311
|
const footerLogoLight = footerLogoConfig
|
|
310
|
-
? typeof footerLogoConfig ===
|
|
312
|
+
? typeof footerLogoConfig === "string"
|
|
311
313
|
? footerLogoConfig
|
|
312
314
|
: footerLogoConfig.light
|
|
313
315
|
: logoLight;
|
|
314
316
|
const footerLogoDark = footerLogoConfig
|
|
315
|
-
? typeof footerLogoConfig ===
|
|
317
|
+
? typeof footerLogoConfig === "string"
|
|
316
318
|
? footerLogoConfig
|
|
317
319
|
: footerLogoConfig.dark
|
|
318
320
|
: logoDark;
|
|
@@ -337,8 +339,12 @@ const rootAssets = findRootAssets(contentDir);
|
|
|
337
339
|
// "docs/theme.css") - split and rejoin with nodePath.join rather than
|
|
338
340
|
// handing the raw string straight to it, so a nested asset resolves
|
|
339
341
|
// correctly on every OS this might run on, not just POSIX ones.
|
|
340
|
-
const rootCssContents = rootAssets.css.map((name) =>
|
|
341
|
-
|
|
342
|
+
const rootCssContents = rootAssets.css.map((name) =>
|
|
343
|
+
fs.readFileSync(nodePath.join(contentDir, ...name.split("/")), "utf-8"),
|
|
344
|
+
);
|
|
345
|
+
const rootJsContents = rootAssets.js.map((name) =>
|
|
346
|
+
fs.readFileSync(nodePath.join(contentDir, ...name.split("/")), "utf-8"),
|
|
347
|
+
);
|
|
342
348
|
// public/*.css and public/*.js auto-load too, but as <link>/<script src>
|
|
343
349
|
// pointing at their already-public URL (see findRootAssets()'s own
|
|
344
350
|
// comment for why - no point inlining a file that's also independently
|
|
@@ -385,9 +391,13 @@ const wdFontFamilyBody = resolvedFonts.body ? fontStack(resolvedFonts.body.famil
|
|
|
385
391
|
// descriptor, or the Google Fonts URL's `:wght@` axis inside
|
|
386
392
|
// googleFontsHref() above), not the actual rendered boldness of any
|
|
387
393
|
// element - see wdFontWeightCss right below for that other half.
|
|
388
|
-
const fontFaceCss = [
|
|
394
|
+
const fontFaceCss = [
|
|
395
|
+
fontFaceRule(resolvedFonts.base),
|
|
396
|
+
fontFaceRule(resolvedFonts.heading),
|
|
397
|
+
fontFaceRule(resolvedFonts.body),
|
|
398
|
+
]
|
|
389
399
|
.filter(Boolean)
|
|
390
|
-
.join(
|
|
400
|
+
.join("\n");
|
|
391
401
|
// Without this, a configured `weight` only ever changed which font *file*
|
|
392
402
|
// loaded - h1-h6 still rendered at the browser's own default `font-weight:
|
|
393
403
|
// bold` (a user-agent-stylesheet rule, present regardless of which file
|
|
@@ -403,13 +413,14 @@ const fontFaceCss = [fontFaceRule(resolvedFonts.base), fontFaceRule(resolvedFont
|
|
|
403
413
|
const wdFontWeightHeading = resolvedFonts.heading?.weight ?? resolvedFonts.base.weight;
|
|
404
414
|
const wdFontWeightBody = resolvedFonts.body?.weight ?? resolvedFonts.base.weight;
|
|
405
415
|
const fontWeightCss = [
|
|
406
|
-
wdFontWeightHeading !== undefined ? `h1, h2, h3, h4, h5, h6 { font-weight: ${wdFontWeightHeading}; }` :
|
|
407
|
-
wdFontWeightBody !== undefined ? `body { font-weight: ${wdFontWeightBody}; }` :
|
|
416
|
+
wdFontWeightHeading !== undefined ? `h1, h2, h3, h4, h5, h6 { font-weight: ${wdFontWeightHeading}; }` : "",
|
|
417
|
+
wdFontWeightBody !== undefined ? `body { font-weight: ${wdFontWeightBody}; }` : "",
|
|
408
418
|
]
|
|
409
419
|
.filter(Boolean)
|
|
410
|
-
.join(
|
|
411
|
-
const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join(
|
|
420
|
+
.join("\n");
|
|
421
|
+
const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join("\n");
|
|
412
422
|
---
|
|
423
|
+
|
|
413
424
|
<!doctype html>
|
|
414
425
|
<html lang={lang}>
|
|
415
426
|
<head>
|
|
@@ -420,11 +431,12 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
420
431
|
<title>{title} · {config.name}</title>
|
|
421
432
|
<ClientRouter />
|
|
422
433
|
{effectiveDescription && <meta name="description" content={effectiveDescription} />}
|
|
423
|
-
{seo.keywords && seo.keywords.length > 0 && <meta name="keywords" content={seo.keywords.join(
|
|
434
|
+
{seo.keywords && seo.keywords.length > 0 && <meta name="keywords" content={seo.keywords.join(", ")} />}
|
|
424
435
|
{seo.noindex && <meta name="robots" content="noindex, nofollow" />}
|
|
425
436
|
{canonicalUrl && <link rel="canonical" href={canonicalUrl} />}
|
|
426
437
|
{config.styles.favicon && <link rel="icon" href={config.styles.favicon} />}
|
|
427
|
-
{
|
|
438
|
+
{
|
|
439
|
+
/* styles.fonts - see resolveFonts()/googleFontsHref() in lib/config.ts.
|
|
428
440
|
Present (non-null) whenever at least one configured font (or the
|
|
429
441
|
Inter default, when styles.fonts is unset entirely) has no `source`
|
|
430
442
|
- i.e. is a Google Font, auto-loaded by family name. The two
|
|
@@ -435,14 +447,17 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
435
447
|
their fonts. Rendered this early in <head> (right after favicon,
|
|
436
448
|
before Open Graph/Twitter meta) so the font starts loading as soon
|
|
437
449
|
as possible rather than competing with less render-critical tags
|
|
438
|
-
for bandwidth/priority. */
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
450
|
+
for bandwidth/priority. */
|
|
451
|
+
}
|
|
452
|
+
{
|
|
453
|
+
fontsGoogleHref && (
|
|
454
|
+
<>
|
|
455
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
456
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
457
|
+
<link rel="stylesheet" href={fontsGoogleHref} />
|
|
458
|
+
</>
|
|
459
|
+
)
|
|
460
|
+
}
|
|
446
461
|
<!-- Open Graph -->
|
|
447
462
|
<meta property="og:title" content={title} />
|
|
448
463
|
{effectiveDescription && <meta property="og:description" content={effectiveDescription} />}
|
|
@@ -455,12 +470,14 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
455
470
|
<meta name="twitter:title" content={title} />
|
|
456
471
|
{effectiveDescription && <meta name="twitter:description" content={effectiveDescription} />}
|
|
457
472
|
{absoluteOgImage && <meta name="twitter:image" content={absoluteOgImage} />}
|
|
458
|
-
{
|
|
473
|
+
{
|
|
474
|
+
/* writedocs.json's `integrations` (the six analytics providers) - see
|
|
459
475
|
AnalyticsScripts.astro. Rendered as early in <head> as reasonably
|
|
460
476
|
possible (right after the meta tags, before even the theme-
|
|
461
477
|
detection script below) - the usual placement every one of these
|
|
462
478
|
providers' own install instructions ask for, so pageview timing is
|
|
463
|
-
captured as close to actual page load as it can be. */
|
|
479
|
+
captured as close to actual page load as it can be. */
|
|
480
|
+
}
|
|
464
481
|
<AnalyticsScripts config={config} />
|
|
465
482
|
<script is:inline>
|
|
466
483
|
// Sets [data-theme] and [data-banner-dismissed] on <html> before
|
|
@@ -487,22 +504,26 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
487
504
|
// prevents any visible flash on client-side navigations too.
|
|
488
505
|
function wdApplyStoredPreferences() {
|
|
489
506
|
try {
|
|
490
|
-
var stored = localStorage.getItem(
|
|
491
|
-
var theme =
|
|
492
|
-
|
|
493
|
-
|
|
507
|
+
var stored = localStorage.getItem("wd-theme");
|
|
508
|
+
var theme =
|
|
509
|
+
stored === "light" || stored === "dark"
|
|
510
|
+
? stored
|
|
511
|
+
: window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
512
|
+
? "dark"
|
|
513
|
+
: "light";
|
|
494
514
|
document.documentElement.dataset.theme = theme;
|
|
495
515
|
} catch (e) {
|
|
496
|
-
document.documentElement.dataset.theme =
|
|
516
|
+
document.documentElement.dataset.theme = "light";
|
|
497
517
|
}
|
|
498
518
|
try {
|
|
499
|
-
document.documentElement.dataset.bannerDismissed =
|
|
519
|
+
document.documentElement.dataset.bannerDismissed =
|
|
520
|
+
localStorage.getItem("wd-banner-dismissed") === "true" ? "true" : "false";
|
|
500
521
|
} catch (e) {
|
|
501
|
-
document.documentElement.dataset.bannerDismissed =
|
|
522
|
+
document.documentElement.dataset.bannerDismissed = "false";
|
|
502
523
|
}
|
|
503
524
|
}
|
|
504
525
|
wdApplyStoredPreferences();
|
|
505
|
-
document.addEventListener(
|
|
526
|
+
document.addEventListener("astro:after-swap", wdApplyStoredPreferences);
|
|
506
527
|
</script>
|
|
507
528
|
<script>
|
|
508
529
|
// Preserves the sidebar's own scroll position across a ClientRouter
|
|
@@ -514,10 +535,10 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
514
535
|
// same reason: after-swap fires before the next paint, so there's no
|
|
515
536
|
// visible flash of the sidebar sitting at the top before jumping
|
|
516
537
|
// back to where the reader had it scrolled.
|
|
517
|
-
import { saveSidebarScroll, restoreSidebarScroll } from
|
|
538
|
+
import { saveSidebarScroll, restoreSidebarScroll } from "../scripts/sidebar-scroll";
|
|
518
539
|
|
|
519
|
-
document.addEventListener(
|
|
520
|
-
document.addEventListener(
|
|
540
|
+
document.addEventListener("astro:before-swap", saveSidebarScroll);
|
|
541
|
+
document.addEventListener("astro:after-swap", restoreSidebarScroll);
|
|
521
542
|
</script>
|
|
522
543
|
<style
|
|
523
544
|
define:vars={{
|
|
@@ -564,6 +585,12 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
564
585
|
--wd-page-bg-color: var(--wdPageBgColorLight);
|
|
565
586
|
--wd-page-bg-image: var(--wdPageBgImageLight);
|
|
566
587
|
--wd-text-muted: #64748b;
|
|
588
|
+
/* Headings, bold text, card titles, and the sidebar's group titles -
|
|
589
|
+
a stronger color than body text (--wd-text), which the sidebar's
|
|
590
|
+
and table of contents' links use (--wd-nav-text). */
|
|
591
|
+
--wd-heading: #18191d;
|
|
592
|
+
--wd-nav-title: var(--wd-heading);
|
|
593
|
+
--wd-nav-text: var(--wd-text);
|
|
567
594
|
--wd-border: #e2e8f0;
|
|
568
595
|
--wd-surface: #f8fafc;
|
|
569
596
|
/* The browser's own controls - the page's scrollbar, a code block's -
|
|
@@ -582,7 +609,7 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
582
609
|
regardless of source order once data-theme is set to "dark" by
|
|
583
610
|
the inline script above or the toggle button's click handler
|
|
584
611
|
(src/scripts/theme-toggle.ts). */
|
|
585
|
-
:root[data-theme=
|
|
612
|
+
:root[data-theme="dark"] {
|
|
586
613
|
--wd-primary: var(--wdPrimaryDark);
|
|
587
614
|
--wd-on-primary: var(--wdOnPrimaryDark);
|
|
588
615
|
--wd-background: var(--wdBackgroundDark);
|
|
@@ -596,12 +623,14 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
596
623
|
--wd-page-bg-color: var(--wdPageBgColorDark);
|
|
597
624
|
--wd-page-bg-image: var(--wdPageBgImageDark);
|
|
598
625
|
--wd-text-muted: #94a3b8;
|
|
626
|
+
--wd-heading: #e0e0e5;
|
|
599
627
|
--wd-border: #1e293b;
|
|
600
628
|
--wd-surface: #131a2b;
|
|
601
629
|
color-scheme: dark;
|
|
602
630
|
}
|
|
603
631
|
</style>
|
|
604
|
-
{
|
|
632
|
+
{
|
|
633
|
+
/* styles.fonts: local/externally-hosted font(s) (fontFaceRule() in
|
|
605
634
|
lib/config.ts - a local `source` path resolves the same way
|
|
606
635
|
styles.favicon/styles.logo/styles.background.images already do, see
|
|
607
636
|
collectConfiguredAssetPaths() + styles-asset-integration.js, no
|
|
@@ -615,17 +644,23 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
615
644
|
bare `h1, h2, ...` selector list assembled as a runtime string -
|
|
616
645
|
empty string renders nothing when neither piece has anything to
|
|
617
646
|
contribute (every configured font is a Google Font, and no
|
|
618
|
-
`weight` was set anywhere in `styles.fonts`). */
|
|
647
|
+
`weight` was set anywhere in `styles.fonts`). */
|
|
648
|
+
}
|
|
619
649
|
{fontExtraCss && <style set:html={fontExtraCss} />}
|
|
620
|
-
{
|
|
650
|
+
{
|
|
651
|
+
/* writedocs.json's `scripts.head` - see scriptEntrySchema in lib/config.ts.
|
|
621
652
|
Each entry is exactly one of an external/local `src` or inline
|
|
622
653
|
`content` (enforced by the schema's own .refine()), rendered right
|
|
623
654
|
before </head> so it runs before body content paints - the usual
|
|
624
|
-
spot a third-party script's own install instructions ask for. */
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
655
|
+
spot a third-party script's own install instructions ask for. */
|
|
656
|
+
}
|
|
657
|
+
{
|
|
658
|
+
config.scripts.head.map((s) =>
|
|
659
|
+
s.src ? <script is:inline src={s.src} /> : <script is:inline set:html={s.content} />,
|
|
660
|
+
)
|
|
661
|
+
}
|
|
662
|
+
{
|
|
663
|
+
/* Zero-config custom CSS - see findRootAssets() in lib/pages.js and
|
|
629
664
|
rootCssContents above. Rendered last in <head>, so a project-owned
|
|
630
665
|
file - anywhere in the project, not just the root - wins over
|
|
631
666
|
everything else writedocs generates itself. Inlined as raw <style>
|
|
@@ -634,107 +669,123 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
634
669
|
independently fetchable as a URL; inlining sidesteps needing one.
|
|
635
670
|
One <style> tag per file (not concatenated) so each is independently
|
|
636
671
|
visible/attributable
|
|
637
|
-
in devtools. */
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
672
|
+
in devtools. */
|
|
673
|
+
}
|
|
674
|
+
{rootCssContents.map((content) => <style is:inline set:html={content} />)}
|
|
675
|
+
{
|
|
676
|
+
/* Zero-config custom CSS living in public/ - see findRootAssets()'s
|
|
642
677
|
own comment in lib/pages.js for why these render as <link> tags
|
|
643
678
|
pointing at their already-public URL instead of joining
|
|
644
|
-
rootCssContents above as inlined content. */
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
))}
|
|
679
|
+
rootCssContents above as inlined content. */
|
|
680
|
+
}
|
|
681
|
+
{publicCssHrefs.map((href) => <link rel="stylesheet" href={href} />)}
|
|
648
682
|
</head>
|
|
649
683
|
<body>
|
|
650
|
-
{
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
684
|
+
{
|
|
685
|
+
mode === "blank" ? (
|
|
686
|
+
// No site chrome at all - no topbar, no sidebar/toc columns, not
|
|
687
|
+
// even the .wd-shell wrapper's own max-width - the page's own
|
|
688
|
+
// MDX/components control 100% of the layout, including whether
|
|
689
|
+
// there's any nav/branding at all. SearchModal.astro's own overlay
|
|
690
|
+
// markup and its ⌘K listener still work even with no visible
|
|
691
|
+
// trigger button to click (it's rendered unconditionally below,
|
|
692
|
+
// outside this mode === 'blank' branch), so that's left in rather
|
|
693
|
+
// than also gated on mode.
|
|
694
|
+
<slot />
|
|
695
|
+
) : (
|
|
696
|
+
<Fragment>
|
|
697
|
+
{/* Everything above the footer, in one wrapper - see .wd-page/body in
|
|
663
698
|
base.css: body is a flex column, this is its flex: 1 0 auto item,
|
|
664
699
|
and the footer (a plain sibling below, not inside this wrapper) is
|
|
665
700
|
what that pushes down to the viewport's bottom edge on a page
|
|
666
701
|
short enough not to need scrolling - the "sticky footer" pattern,
|
|
667
702
|
not position: sticky/fixed (either of which would cover page
|
|
668
703
|
content instead of just trailing it once actually reached). */}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
704
|
+
<div class="wd-page">
|
|
705
|
+
{config.banner && (
|
|
706
|
+
<div class={`wd-banner wd-banner-${config.banner.type}`} id="wd-banner">
|
|
707
|
+
<div class="wd-banner-inner">
|
|
708
|
+
<span class="wd-banner-content">{config.banner.content}</span>
|
|
709
|
+
{config.banner.dismissible && (
|
|
710
|
+
<button type="button" class="wd-banner-dismiss" aria-label="Dismiss banner" data-banner-dismiss>
|
|
711
|
+
×
|
|
712
|
+
</button>
|
|
713
|
+
)}
|
|
714
|
+
</div>
|
|
715
|
+
</div>
|
|
716
|
+
)}
|
|
717
|
+
<TopBar
|
|
718
|
+
config={config}
|
|
719
|
+
selectors={selectors}
|
|
720
|
+
globalDropdowns={globalDropdowns}
|
|
721
|
+
showSidebarCol={showSidebarCol}
|
|
722
|
+
logoLight={logoLight}
|
|
723
|
+
logoDark={logoDark}
|
|
724
|
+
brandLabel={brandLabel}
|
|
725
|
+
/>
|
|
726
|
+
<MobileMenu
|
|
727
|
+
config={config}
|
|
728
|
+
selectors={selectors}
|
|
729
|
+
globalDropdowns={globalDropdowns}
|
|
730
|
+
showSidebarCol={showSidebarCol}
|
|
731
|
+
logoLight={logoLight}
|
|
732
|
+
logoDark={logoDark}
|
|
733
|
+
brandLabel={brandLabel}
|
|
734
|
+
>
|
|
735
|
+
<slot name="sidebar" slot="sidebar" />
|
|
736
|
+
</MobileMenu>
|
|
737
|
+
<div class="wd-shell">
|
|
738
|
+
{showSidebarCol && (
|
|
739
|
+
<div class="wd-sidebar-col">
|
|
740
|
+
<slot name="sidebar" />
|
|
741
|
+
</div>
|
|
742
|
+
)}
|
|
743
|
+
<div class="wd-main-col">
|
|
744
|
+
<slot />
|
|
745
|
+
</div>
|
|
746
|
+
{showTocCol && (
|
|
747
|
+
<div class="wd-toc-col">
|
|
748
|
+
<slot name="toc" />
|
|
749
|
+
</div>
|
|
750
|
+
)}
|
|
751
|
+
</div>
|
|
752
|
+
</div>
|
|
753
|
+
<SiteFooter config={config} logoLight={footerLogoLight} logoDark={footerLogoDark} />
|
|
754
|
+
</Fragment>
|
|
755
|
+
)
|
|
756
|
+
}
|
|
711
757
|
|
|
712
758
|
<SearchModal />
|
|
713
759
|
<ImageZoom />
|
|
714
760
|
|
|
715
761
|
<script>
|
|
716
|
-
import { initBanner } from
|
|
717
|
-
import { initTopbarOffset } from
|
|
762
|
+
import { initBanner } from "../scripts/banner";
|
|
763
|
+
import { initTopbarOffset } from "../scripts/topbar-offset";
|
|
718
764
|
|
|
719
765
|
initBanner(document);
|
|
720
|
-
document.addEventListener(
|
|
766
|
+
document.addEventListener("astro:page-load", () => initBanner(document));
|
|
721
767
|
|
|
722
768
|
// No ordering dependency on initBanner above - see topbar-offset.ts
|
|
723
769
|
// for why it measures only the topbar itself (not the banner) and
|
|
724
770
|
// why that's live-measured rather than a fixed CSS value.
|
|
725
771
|
initTopbarOffset();
|
|
726
|
-
document.addEventListener(
|
|
772
|
+
document.addEventListener("astro:page-load", () => initTopbarOffset());
|
|
727
773
|
</script>
|
|
728
|
-
{
|
|
774
|
+
{
|
|
775
|
+
/* writedocs.json's `scripts.body` - see scriptEntrySchema in lib/config.ts.
|
|
729
776
|
Rendered after everything above (including every component's own
|
|
730
777
|
<script> tags, which Astro/Vite already bundles to run in document
|
|
731
778
|
order) so it runs after every other script on the page has already
|
|
732
779
|
loaded/hydrated - matching where a third-party script's own install
|
|
733
|
-
instructions usually ask for a "body end" placement. */
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
780
|
+
instructions usually ask for a "body end" placement. */
|
|
781
|
+
}
|
|
782
|
+
{
|
|
783
|
+
config.scripts.body.map((s) =>
|
|
784
|
+
s.src ? <script is:inline src={s.src} /> : <script is:inline set:html={s.content} />,
|
|
785
|
+
)
|
|
786
|
+
}
|
|
787
|
+
{
|
|
788
|
+
/* Zero-config custom JS - see findRootAssets() in lib/pages.js and
|
|
738
789
|
rootJsContents above. Rendered last, after writedocs.json's own
|
|
739
790
|
`scripts.body`, same "most locally-owned override runs last"
|
|
740
791
|
reasoning as the root CSS above. `is:inline` here isn't optional -
|
|
@@ -742,11 +793,11 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
742
793
|
the build fails outright ("Cannot find the built path for ...
|
|
743
794
|
type=script&index=N") the same way a dynamic-`src` script did
|
|
744
795
|
while this file's own writedocs.json `scripts` support was first being
|
|
745
|
-
built - see that feature's own commit for the full story. */
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
796
|
+
built - see that feature's own commit for the full story. */
|
|
797
|
+
}
|
|
798
|
+
{rootJsContents.map((content) => <script is:inline set:html={content} />)}
|
|
799
|
+
{
|
|
800
|
+
/* Zero-config custom JS living in public/ - see this file's own CSS
|
|
750
801
|
equivalent above and findRootAssets()'s comment in lib/pages.js.
|
|
751
802
|
`<script src>`, not `is:inline set:html` - the file's already a
|
|
752
803
|
fetchable URL, no reason to inline its content. Filtered against
|
|
@@ -757,14 +808,15 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
|
|
|
757
808
|
as a second tag; `scripts.head` vs `scripts.body` placement is a
|
|
758
809
|
deliberate choice this can't second-guess, but `head` is by far
|
|
759
810
|
the more common spot for a plain local script and this hasn't come
|
|
760
|
-
up in practice). */
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
811
|
+
up in practice). */
|
|
812
|
+
}
|
|
813
|
+
{publicJsHrefs.map((href) => <script is:inline src={href} />)}
|
|
814
|
+
{
|
|
815
|
+
/* writedocs.json's `integrations.askAi` - see AskAiWidget.astro. Rendered
|
|
765
816
|
last of all - it's a floating chat widget, not something anything
|
|
766
817
|
else on the page depends on running before, so there's no reason
|
|
767
|
-
to load it any earlier than absolutely last. */
|
|
818
|
+
to load it any earlier than absolutely last. */
|
|
819
|
+
}
|
|
768
820
|
<AskAiWidget config={config} />
|
|
769
821
|
</body>
|
|
770
822
|
</html>
|
|
@@ -156,7 +156,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
156
156
|
.wd-nav-section-title {
|
|
157
157
|
padding: 0;
|
|
158
158
|
margin-bottom: 0.4rem;
|
|
159
|
-
color: var(--wd-
|
|
159
|
+
color: var(--wd-nav-title);
|
|
160
160
|
font-size: 0.75rem;
|
|
161
161
|
font-weight: 600;
|
|
162
162
|
text-transform: uppercase;
|
|
@@ -215,7 +215,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
215
215
|
margin: 0.1rem 0;
|
|
216
216
|
border-radius: 0 0.4rem 0.4rem 0;
|
|
217
217
|
text-decoration: none;
|
|
218
|
-
color: var(--wd-text);
|
|
218
|
+
color: var(--wd-nav-text);
|
|
219
219
|
font-size: 0.9rem;
|
|
220
220
|
}
|
|
221
221
|
/* Primary-tinted rather than a neutral surface gray - a faint preview
|
|
@@ -224,7 +224,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
224
224
|
hover state shared with every other clickable thing on the page. */
|
|
225
225
|
.wd-nav-list a:hover {
|
|
226
226
|
background: color-mix(in srgb, var(--wd-primary) 6%, transparent);
|
|
227
|
-
color: var(--wd-
|
|
227
|
+
color: var(--wd-nav-title);
|
|
228
228
|
}
|
|
229
229
|
.wd-nav-list a.active {
|
|
230
230
|
background: color-mix(in srgb, var(--wd-primary) 12%, transparent);
|
|
@@ -326,7 +326,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
326
326
|
margin: 0.1rem 0;
|
|
327
327
|
border-radius: 0 0.4rem 0.4rem 0;
|
|
328
328
|
cursor: pointer;
|
|
329
|
-
color: var(--wd-text);
|
|
329
|
+
color: var(--wd-nav-text);
|
|
330
330
|
font-size: 0.9rem;
|
|
331
331
|
list-style: none;
|
|
332
332
|
}
|
|
@@ -339,7 +339,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
339
339
|
/* Same primary-tinted hover as a plain page link above. */
|
|
340
340
|
.wd-nav-collapsible summary:hover {
|
|
341
341
|
background: color-mix(in srgb, var(--wd-primary) 6%, transparent);
|
|
342
|
-
color: var(--wd-
|
|
342
|
+
color: var(--wd-nav-title);
|
|
343
343
|
}
|
|
344
344
|
/* When the group's own attached page is the current page, the pill
|
|
345
345
|
background lives on <summary> itself (not the inner <a> below,
|
|
@@ -374,7 +374,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
374
374
|
}
|
|
375
375
|
.wd-nav-collapsible summary a:hover {
|
|
376
376
|
background: none;
|
|
377
|
-
color: var(--wd-
|
|
377
|
+
color: var(--wd-nav-title);
|
|
378
378
|
}
|
|
379
379
|
.wd-nav-collapsible summary a.active {
|
|
380
380
|
background: none;
|
|
@@ -84,7 +84,7 @@ const { headings } = Astro.props as Props;
|
|
|
84
84
|
font-weight: 600;
|
|
85
85
|
text-transform: uppercase;
|
|
86
86
|
letter-spacing: 0.04em;
|
|
87
|
-
color: var(--wd-
|
|
87
|
+
color: var(--wd-nav-title);
|
|
88
88
|
margin-bottom: 0.6rem;
|
|
89
89
|
}
|
|
90
90
|
.wd-toc ul {
|
|
@@ -99,7 +99,7 @@ const { headings } = Astro.props as Props;
|
|
|
99
99
|
margin-left: -1px;
|
|
100
100
|
border-left: 2px solid transparent;
|
|
101
101
|
text-decoration: none;
|
|
102
|
-
color: var(--wd-text
|
|
102
|
+
color: var(--wd-nav-text);
|
|
103
103
|
line-height: 1.4;
|
|
104
104
|
}
|
|
105
105
|
.wd-toc-level-3 a {
|
|
@@ -107,7 +107,7 @@ const { headings } = Astro.props as Props;
|
|
|
107
107
|
font-size: 0.82rem;
|
|
108
108
|
}
|
|
109
109
|
.wd-toc-item a:hover {
|
|
110
|
-
color: var(--wd-
|
|
110
|
+
color: var(--wd-nav-title);
|
|
111
111
|
}
|
|
112
112
|
.wd-toc-item a.active {
|
|
113
113
|
color: var(--wd-primary);
|
|
@@ -83,6 +83,13 @@ h5,
|
|
|
83
83
|
h6 {
|
|
84
84
|
font-family: var(--wd-font-family-heading, inherit);
|
|
85
85
|
}
|
|
86
|
+
/* A page's headings and bold text stand out over its body text (--wd-text).
|
|
87
|
+
:where() keeps this at no specificity, so a component's own title color,
|
|
88
|
+
or a page's own styles, still win - and it's scoped to the page's article,
|
|
89
|
+
so hand-built `mode: custom` pages keep inheriting their own colors. */
|
|
90
|
+
:where(.wd-article, .wd-article-header) :where(h1, h2, h3, h4, h5, h6, strong, b) {
|
|
91
|
+
color: var(--wd-heading);
|
|
92
|
+
}
|
|
86
93
|
code {
|
|
87
94
|
background: var(--wd-surface);
|
|
88
95
|
border: 1px solid var(--wd-border);
|
package/src/lib/a11y-check.js
CHANGED
|
@@ -42,7 +42,7 @@ async function parse(text, format) {
|
|
|
42
42
|
|
|
43
43
|
// The theme's own fallbacks (src/layout/BaseLayout.astro).
|
|
44
44
|
const DEFAULT_BACKGROUND = { light: '#ffffff', dark: '#0b1120' };
|
|
45
|
-
const DEFAULT_TEXT = { light: '#
|
|
45
|
+
const DEFAULT_TEXT = { light: '#404045', dark: '#a0a0a5' };
|
|
46
46
|
const MIN_TEXT_CONTRAST = 4.5;
|
|
47
47
|
|
|
48
48
|
// contrastRatio() is re-exported: it was defined here, and tests import it
|
|
@@ -99,10 +99,10 @@ export const DESCRIPTIONS = {
|
|
|
99
99
|
styles: 'Colors, logo, favicon, fonts, code block themes, navbar and background.',
|
|
100
100
|
'styles.colors': 'The site\'s colors.',
|
|
101
101
|
'styles.colors.primary': 'Main color: links, buttons, the active page in the sidebar. Default "#6366f1".',
|
|
102
|
-
'styles.colors.text': 'Body text color in light mode. Default "#
|
|
102
|
+
'styles.colors.text': 'Body text color in light mode, and the sidebar pages. Default "#404045".',
|
|
103
103
|
'styles.colors.dark': 'Dark-mode colors. Anything left out uses the light-mode value.',
|
|
104
104
|
'styles.colors.dark.primary': 'Main color in dark mode. Pick a lighter one if `primary` is dark - links use it on a dark background.',
|
|
105
|
-
'styles.colors.dark.text': 'Body text color in dark mode. Default "#
|
|
105
|
+
'styles.colors.dark.text': 'Body text color in dark mode, and the sidebar pages. Default "#a0a0a5".',
|
|
106
106
|
...logo('styles.logo'),
|
|
107
107
|
'styles.favicon': 'Favicon image path.',
|
|
108
108
|
'styles.fonts': 'Fonts. Default: Inter. `heading` and `body` override just that part; anything they leave out comes from the top-level fields.',
|
package/writedocs.schema.json
CHANGED
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"text": {
|
|
43
43
|
"type": "string",
|
|
44
|
-
"description": "Body text color in light mode. Default \"#
|
|
45
|
-
"markdownDescription": "Body text color in light mode. Default \"#
|
|
44
|
+
"description": "Body text color in light mode, and the sidebar pages. Default \"#404045\".",
|
|
45
|
+
"markdownDescription": "Body text color in light mode, and the sidebar pages. Default \"#404045\"."
|
|
46
46
|
},
|
|
47
47
|
"dark": {
|
|
48
48
|
"type": "object",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"text": {
|
|
56
56
|
"type": "string",
|
|
57
|
-
"description": "Body text color in dark mode. Default \"#
|
|
58
|
-
"markdownDescription": "Body text color in dark mode. Default \"#
|
|
57
|
+
"description": "Body text color in dark mode, and the sidebar pages. Default \"#a0a0a5\".",
|
|
58
|
+
"markdownDescription": "Body text color in dark mode, and the sidebar pages. Default \"#a0a0a5\"."
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"description": "Dark-mode colors. Anything left out uses the light-mode value.",
|