@writedocs/generator 0.7.0 → 0.7.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@writedocs/generator",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Static site generator for docs — a writedocs.json + MDX folder in, a static site out.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -220,19 +220,9 @@ const darkNavbarFgMuted = darkNavbarConfigured
220
220
  // design choice, unlike text color above), falling back to the sitewide
221
221
  // --wd-primary (today's exact behavior) when unset - a site that sets a
222
222
  // navbar background but no accent keeps its ordinary brand-colored
223
- // active-tab fill exactly as before.
223
+ // active-tab underline.
224
224
  const lightNavbarAccent = navLight.accent ?? lightPrimary;
225
225
  const darkNavbarAccent = navDark.accent ?? darkPrimary;
226
- // --wd-navbar-accent-text: the active tab's own text color, painted on top
227
- // of --wd-navbar-accent above. Hardcoded to white before this feature
228
- // existed, which only ever looked right because every accent color in
229
- // practice (always --wd-primary until now) happened to be dark/saturated
230
- // enough for white text - contrastTextColor() (lib/config.ts) picks
231
- // black or white by actual luminance instead, so a light `accent` (e.g.
232
- // a pale one against a dark navbar) still gets legible active-tab text
233
- // rather than assuming white always works.
234
- const lightNavbarAccentText = contrastTextColor(lightNavbarAccent);
235
- const darkNavbarAccentText = contrastTextColor(darkNavbarAccent);
236
226
  // --wd-navbar-border: the switcher pills' (version/language/product) own
237
227
  // border. Never the flat --wd-border (a fixed neutral gray/slate tuned for
238
228
  // sitting on the page background) once navbar is configured - that reads
@@ -249,6 +239,14 @@ const lightNavbarBorder = lightNavbarConfigured
249
239
  const darkNavbarBorder = darkNavbarConfigured
250
240
  ? `color-mix(in srgb, ${darkNavbarFg} 25%, transparent)`
251
241
  : 'var(--wd-border)';
242
+ // --wd-navbar-hover: a topbar tab's background on hover. On a navbar with
243
+ // the page's own background, the sidebar's hover tint (NavTree.astro) -
244
+ // the same 6% of --wd-primary. A configured navbar can *be* the primary
245
+ // color, where that tint would vanish, so there it's a light tint of the
246
+ // navbar's own contrast-correct text color instead, like --wd-navbar-border.
247
+ const sidebarHover = 'color-mix(in srgb, var(--wd-primary) 6%, transparent)';
248
+ const lightNavbarHover = lightNavbarConfigured ? `color-mix(in srgb, ${lightNavbarFg} 12%, transparent)` : sidebarHover;
249
+ const darkNavbarHover = darkNavbarConfigured ? `color-mix(in srgb, ${darkNavbarFg} 12%, transparent)` : sidebarHover;
252
250
  // The <body> canvas's own paint - same color as --wd-background above
253
251
  // (there's only one background color to configure now), plus an optional
254
252
  // image layered on top. `images.light`/`.dark` are plain public/-relative
@@ -517,8 +515,8 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
517
515
  wdNavbarFgLight: lightNavbarFg,
518
516
  wdNavbarFgMutedLight: lightNavbarFgMuted,
519
517
  wdNavbarAccentLight: lightNavbarAccent,
520
- wdNavbarAccentTextLight: lightNavbarAccentText,
521
518
  wdNavbarBorderLight: lightNavbarBorder,
519
+ wdNavbarHoverLight: lightNavbarHover,
522
520
  wdPageBgColorLight: lightPageBgColor,
523
521
  wdPageBgImageLight: lightPageBgImage,
524
522
  wdFontFamily,
@@ -531,8 +529,8 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
531
529
  wdNavbarFgDark: darkNavbarFg,
532
530
  wdNavbarFgMutedDark: darkNavbarFgMuted,
533
531
  wdNavbarAccentDark: darkNavbarAccent,
534
- wdNavbarAccentTextDark: darkNavbarAccentText,
535
532
  wdNavbarBorderDark: darkNavbarBorder,
533
+ wdNavbarHoverDark: darkNavbarHover,
536
534
  wdPageBgColorDark: darkPageBgColor,
537
535
  wdPageBgImageDark: darkPageBgImage,
538
536
  }}
@@ -545,8 +543,8 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
545
543
  --wd-navbar-foreground: var(--wdNavbarFgLight);
546
544
  --wd-navbar-foreground-muted: var(--wdNavbarFgMutedLight);
547
545
  --wd-navbar-accent: var(--wdNavbarAccentLight);
548
- --wd-navbar-accent-text: var(--wdNavbarAccentTextLight);
549
546
  --wd-navbar-border: var(--wdNavbarBorderLight);
547
+ --wd-navbar-hover: var(--wdNavbarHoverLight);
550
548
  --wd-page-bg-color: var(--wdPageBgColorLight);
551
549
  --wd-page-bg-image: var(--wdPageBgImageLight);
552
550
  --wd-text-muted: #64748b;
@@ -572,8 +570,8 @@ const fontExtraCss = [fontFaceCss, fontWeightCss].filter(Boolean).join('\n');
572
570
  --wd-navbar-foreground: var(--wdNavbarFgDark);
573
571
  --wd-navbar-foreground-muted: var(--wdNavbarFgMutedDark);
574
572
  --wd-navbar-accent: var(--wdNavbarAccentDark);
575
- --wd-navbar-accent-text: var(--wdNavbarAccentTextDark);
576
573
  --wd-navbar-border: var(--wdNavbarBorderDark);
574
+ --wd-navbar-hover: var(--wdNavbarHoverDark);
577
575
  --wd-page-bg-color: var(--wdPageBgColorDark);
578
576
  --wd-page-bg-image: var(--wdPageBgImageDark);
579
577
  --wd-text-muted: #94a3b8;
@@ -37,9 +37,8 @@
37
37
  (below) sits flush against this row's bottom edge (the outer
38
38
  .wd-topbar's own border-bottom, since this is the last row) rather
39
39
  than floating partway up inside a padded gap. That's what lets a
40
- plain border-bottom color change read as a real underline on hover,
41
- and what makes the active tab's own fill look like it's actually
42
- attached to the row's bottom edge instead of a floating pill. */
40
+ plain border-bottom color change read as a real underline under the
41
+ active tab. */
43
42
  padding-bottom: 0;
44
43
  }
45
44
  .wd-topbar-brand {
@@ -139,47 +138,31 @@
139
138
  /* Rounded top corners, square bottom - reads as an actual "tab"
140
139
  attached to the row's bottom edge (see .wd-topbar-row-tabs
141
140
  .wd-topbar-inner's own comment) rather than a floating pill. Same
142
- radius for every tab, active or not, so nothing needs to change
143
- shape on top when a tab becomes active - only the fill/border-bottom
144
- below do. */
141
+ radius for every tab, active or not - it also shapes the hover
142
+ background (below). */
145
143
  border-radius: 0.5rem 0.5rem 0 0;
146
- /* Transparent by default - this is what a hover (below) or the active
147
- state colors in, rather than a separate underline element. Sized to
148
- land exactly on the row's own bottom edge now that this row's inner
149
- wrapper has no bottom padding of its own. */
144
+ /* Transparent by default - the active state (below) colors it in,
145
+ rather than a separate underline element. Sized to land exactly on the
146
+ row's own bottom edge now that this row's inner wrapper has no bottom
147
+ padding of its own. */
150
148
  border-bottom: 2px solid transparent;
151
149
  text-decoration: none;
152
150
  color: var(--wd-navbar-foreground);
153
151
  font-size: 0.92rem;
154
152
  font-weight: 600;
155
153
  }
156
- /* The selected tab: a solid fill, not just a tinted background -
157
- AppIcon's <svg> render mode already uses fill="currentColor" (astro-
158
- icon's default), so its icon recolors along with the text; the
159
- emoji/text <span> fallback inherits `color` the same way.
160
- border-bottom-color matches the fill (rather than being reset to
161
- transparent) so there's no 2px seam of the row's own background
162
- showing between the fill and the row's bottom edge/border.
163
- --wd-navbar-accent (falls back to --wd-primary - see BaseLayout.astro),
164
- not a bare --wd-primary reference: without this, a site whose navbar
165
- background *is* --wd-primary (a plausible "brand-colored navbar" choice
166
- - the exact case that motivated this variable) would have its active
167
- tab's own fill disappear into the row's background entirely. Text color
168
- is --wd-navbar-accent-text (also BaseLayout.astro) rather than a
169
- hardcoded #fff for the matching reason - a light accent color needs
170
- dark text, not white, to stay legible on top of it. */
154
+ /* The selected tab: just its border-bottom, in --wd-navbar-accent (falls
155
+ back to --wd-primary - see BaseLayout.astro), landing on the row's
156
+ bottom edge as an underline. No fill - the text keeps the navbar's own
157
+ color. */
171
158
  .wd-tab-link.active {
172
- color: var(--wd-navbar-accent-text);
173
- background: var(--wd-navbar-accent);
174
159
  border-bottom-color: var(--wd-navbar-accent);
175
160
  }
176
- /* Inactive tabs just get their border-bottom colored in on hover -
177
- simpler than a separate underline element, and lines up naturally
178
- with the active tab's own border-bottom above since both are the same
179
- property. Text/icon color deliberately stays as-is on hover (only the
180
- border appears), matching the reference this was built against. */
181
- .wd-tab-link:hover:not(.active) {
182
- border-bottom-color: var(--wd-navbar-accent);
161
+ /* Any tab on hover: a light background tint, the same as a sidebar item's
162
+ hover (see --wd-navbar-hover in BaseLayout.astro). The rounded top
163
+ corners above shape it. */
164
+ .wd-tab-link:hover {
165
+ background: var(--wd-navbar-hover);
183
166
  }
184
167
  .wd-topbar-links {
185
168
  display: flex;
@@ -158,7 +158,7 @@ const stylesSchema = z.object({
158
158
  // Each side (`light`/`dark`) is either a bare string - just the
159
159
  // background color, exactly the original shape, kept for backwards
160
160
  // compatibility - or `{ background, accent? }`, for when a site also
161
- // wants the navbar's own active-tab-fill/hover-underline color to
161
+ // wants the navbar's own active-tab underline color to
162
162
  // differ from the sitewide `styles.colors.primary` (`accent`'s only
163
163
  // job - see BaseLayout.astro's lightNavbarAccent). Deliberately no
164
164
  // text/icon color field here at all: BaseLayout.astro always resolves
@@ -263,7 +263,7 @@ const logoSchema = z.union([
263
263
  // field's comment for what it now covers.
264
264
  // One side of `styles.navbar` (light or dark) - either a bare background
265
265
  // color (the original shape) or `{ background, accent? }` once a site
266
- // wants its own accent color (the active-tab fill / hover underline)
266
+ // wants its own accent color (the active tab's underline)
267
267
  // inside the navbar specifically, independent of the sitewide
268
268
  // `styles.colors.primary`. Deliberately does NOT carry a text/icon color
269
269
  // field at all - see `navbar`'s own comment below (stylesSchema) for why
@@ -400,7 +400,7 @@ const stylesSchema = z
400
400
  // Each side (`light`/`dark`) is either a bare string - just the
401
401
  // background color, exactly the original shape, kept for backwards
402
402
  // compatibility - or `{ background, accent? }`, for when a site also
403
- // wants the navbar's own active-tab-fill/hover-underline color to
403
+ // wants the navbar's own active-tab underline color to
404
404
  // differ from the sitewide `styles.colors.primary` (`accent`'s only
405
405
  // job - see BaseLayout.astro's lightNavbarAccent). Deliberately no
406
406
  // text/icon color field here at all: BaseLayout.astro always resolves
@@ -111,10 +111,10 @@ export const DESCRIPTIONS = {
111
111
  'styles.navbar': 'The topbar\'s own background. Without it, the topbar matches the page background. Its text turns black or white automatically.',
112
112
  'styles.navbar.light': 'Topbar in light mode: a background color, or `{ background, accent }`.',
113
113
  'styles.navbar.light.background': 'Topbar background color in light mode.',
114
- 'styles.navbar.light.accent': 'Color of the active tab and hover states in the topbar, in place of `styles.colors.primary`.',
114
+ 'styles.navbar.light.accent': 'Color of the underline under the active tab in the topbar, in place of `styles.colors.primary`.',
115
115
  'styles.navbar.dark': 'Topbar in dark mode: a background color, or `{ background, accent }`.',
116
116
  'styles.navbar.dark.background': 'Topbar background color in dark mode.',
117
- 'styles.navbar.dark.accent': 'Color of the active tab and hover states in the topbar, in dark mode.',
117
+ 'styles.navbar.dark.accent': 'Color of the underline under the active tab in the topbar, in dark mode.',
118
118
  'styles.background': 'Background color of the site, and an optional background image.',
119
119
  'styles.background.colors': 'Background colors.',
120
120
  'styles.background.colors.light': 'Background color in light mode. Default "#ffffff".',
@@ -252,8 +252,8 @@
252
252
  },
253
253
  "accent": {
254
254
  "type": "string",
255
- "description": "Color of the active tab and hover states in the topbar, in place of `styles.colors.primary`.",
256
- "markdownDescription": "Color of the active tab and hover states in the topbar, in place of `styles.colors.primary`."
255
+ "description": "Color of the underline under the active tab in the topbar, in place of `styles.colors.primary`.",
256
+ "markdownDescription": "Color of the underline under the active tab in the topbar, in place of `styles.colors.primary`."
257
257
  }
258
258
  },
259
259
  "required": [
@@ -280,8 +280,8 @@
280
280
  },
281
281
  "accent": {
282
282
  "type": "string",
283
- "description": "Color of the active tab and hover states in the topbar, in dark mode.",
284
- "markdownDescription": "Color of the active tab and hover states in the topbar, in dark mode."
283
+ "description": "Color of the underline under the active tab in the topbar, in dark mode.",
284
+ "markdownDescription": "Color of the underline under the active tab in the topbar, in dark mode."
285
285
  }
286
286
  },
287
287
  "required": [