@tenphi/cookbook 0.28.0 → 0.30.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.
Files changed (54) hide show
  1. package/README.md +13 -11
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.js +2 -2
  4. package/docs/ai-agents.md +5 -3
  5. package/docs/architecture.md +10 -7
  6. package/docs/authoring.mdx +94 -36
  7. package/docs/cli.md +92 -33
  8. package/docs/component-styles.md +286 -282
  9. package/docs/configuration.md +232 -153
  10. package/docs/content-sources.md +39 -21
  11. package/docs/custom-components.md +117 -169
  12. package/docs/customization-rules.md +23 -14
  13. package/docs/deployment.md +101 -53
  14. package/docs/es/getting-started.md +7 -5
  15. package/docs/es/index.md +1 -1
  16. package/docs/examples.md +65 -28
  17. package/docs/fonts-and-typography.md +32 -27
  18. package/docs/getting-started.md +17 -10
  19. package/docs/ja/getting-started.md +7 -5
  20. package/docs/ja/index.md +1 -1
  21. package/docs/migration.md +188 -65
  22. package/docs/plugins.md +28 -16
  23. package/docs/publishing.md +3 -2
  24. package/docs/quality-checks.md +18 -42
  25. package/docs/recipes.md +38 -54
  26. package/docs/ru/getting-started.md +7 -5
  27. package/docs/ru/index.md +1 -1
  28. package/docs/site-navigation.md +47 -47
  29. package/docs/theme-and-components.md +126 -59
  30. package/docs/troubleshooting.md +4 -3
  31. package/docs/upstream/manifest.json +2 -2
  32. package/docs/upstream/tasty/README.md +404 -381
  33. package/docs/upstream/tasty/docs/README.md +4 -1
  34. package/docs/upstream/tasty/docs/adoption.md +25 -17
  35. package/docs/upstream/tasty/docs/ai-agents.md +42 -34
  36. package/docs/upstream/tasty/docs/comparison.md +9 -8
  37. package/docs/upstream/tasty/docs/configuration.md +187 -69
  38. package/docs/upstream/tasty/docs/debug.md +3 -2
  39. package/docs/upstream/tasty/docs/design-system.md +117 -15
  40. package/docs/upstream/tasty/docs/dsl.md +211 -117
  41. package/docs/upstream/tasty/docs/getting-started.md +81 -24
  42. package/docs/upstream/tasty/docs/injector.md +41 -40
  43. package/docs/upstream/tasty/docs/methodology.md +46 -21
  44. package/docs/upstream/tasty/docs/migration-v3.md +3 -3
  45. package/docs/upstream/tasty/docs/pipeline.md +111 -116
  46. package/docs/upstream/tasty/docs/plugins.md +21 -41
  47. package/docs/upstream/tasty/docs/react-api.md +73 -10
  48. package/docs/upstream/tasty/docs/runtime-benchmarks.md +46 -46
  49. package/docs/upstream/tasty/docs/ssr.md +92 -66
  50. package/docs/upstream/tasty/docs/styles.md +37 -17
  51. package/docs/upstream/tasty/docs/tasty-static.md +175 -57
  52. package/docs/zh/getting-started.md +7 -5
  53. package/docs/zh/index.md +1 -1
  54. package/package.json +3 -3
@@ -7,17 +7,17 @@ sidebar:
7
7
  Cookbook resolves Glaze colors and Tasty styles during the build, then ships
8
8
  static CSS. Start with a brand color; add semantic palette roles, typography,
9
9
  and component overrides only where the default needs to change. The
10
- [configuration recipes](./recipes.md) show complete, build-checked starting
10
+ [theme recipes](./recipes.md) show complete, build-checked starting
11
11
  points. Read the [customization rules](./customization-rules.md) before writing
12
12
  new styles.
13
13
 
14
- | To change | Start here |
15
- | ------------------------------------- | ------------------------------------------------- |
16
- | Brand, color roles, and design tokens | This page |
17
- | Font files, families, and typography | [Fonts and typography](./fonts-and-typography.md) |
18
- | Built-in UI surfaces and named parts | [Component styles](./component-styles.md) |
19
- | Your own Astro or MDX components | [Custom components](./custom-components.md) |
20
- | Complete configuration fields | [Configuration reference](./configuration.md) |
14
+ | To change | Start here |
15
+ | -------------------------------------------- | ------------------------------------------------- |
16
+ | Brand, color roles, design tokens, and logo | This page |
17
+ | Font files, families, and typography | [Fonts and typography](./fonts-and-typography.md) |
18
+ | Built-in UI surfaces and named parts | [Component styles](./component-styles.md) |
19
+ | Your own Astro or MDX components and linting | [Custom components](./custom-components.md) |
20
+ | Complete configuration fields | [Configuration reference](./configuration.md) |
21
21
 
22
22
  Glaze derives light, dark, and high-contrast values from the brand and palette
23
23
  inputs. Tasty applies those values through semantic tokens. See the
@@ -38,22 +38,24 @@ export default defineDocsConfig({
38
38
  });
39
39
  ```
40
40
 
41
- Add a contrast target when the brand appears as text:
41
+ Add a higher contrast target when brand-colored text needs more contrast:
42
42
 
43
43
  ```ts
44
44
  theme: {
45
45
  brand: {
46
46
  from: "#2f5bff",
47
- contrast: { apca: [45, 60] }
47
+ contrast: { apca: [80, 95] }
48
48
  }
49
49
  }
50
50
  ```
51
51
 
52
+ The default brand target is APCA 45 (60 in high contrast).
53
+
52
54
  The brand supplies the hue and saturation seed. Cookbook derives separate text,
53
- filled-control, and focus roles from it. Small accent text and filled controls
54
- use stronger default APCA floors (75 normally, 90 in high contrast), and diagnostics
55
- also enforce WCAG 4.5:1 / 7:1 on their actual backgrounds. Higher authored brand
56
- targets are retained. Glaze adjusts tones only as far as these floors require;
55
+ filled-control, and focus roles from it. Small accent text keeps APCA floors of
56
+ 75 (90 in high contrast), and filled-control labels keep 80 (95 in high
57
+ contrast); diagnostics also enforce WCAG 4.5:1 / 7:1 on their actual
58
+ backgrounds. Only authored brand targets above these floors raise them. Glaze adjusts tones only as far as these floors require;
57
59
  dark and high-contrast schemes resolve independently.
58
60
 
59
61
  Cookbook rejects a normal APCA target below 45 unless
@@ -114,7 +116,9 @@ an absolute tone or a tone relative to `base`. Use `from` on a palette role
114
116
  when it needs its own color seed; otherwise relative declarations keep its
115
117
  relationship to the brand and surrounding surface as the scheme or contrast
116
118
  changes. `info`, `success`, `warning`, and `danger` also accept Glaze
117
- declarations and expose border, `-text`, and `-surface` semantic tokens.
119
+ declarations and expose border, `-text`, and `-surface` semantic tokens. For
120
+ `orange`, `green`, `blue`, `purple`, and `red`, an override changes that role
121
+ and its `-surface` tint only; set the matching `-text` role as well.
118
122
  Cookbook keeps literal surface seeds desaturated in the dark scheme so a nearly
119
123
  white tint does not become vivid dark chrome when its tone is inverted.
120
124
 
@@ -124,7 +128,7 @@ Components consume semantic colors consistently: `surface`, `header`, `surface-2
124
128
  Tasty components can use these as `#surface`, `#text`, `#border`, and so on; the Astro shell consumes the
125
129
  same resolved values. Glaze also generates hover and pressed states, subtle
126
130
  accent fills, overlays, shadows, and the orange, green, blue, purple, and red
127
- roles used by Cookbook content components. No browser color mixes or
131
+ roles available to content components. No browser color mixes or
128
132
  upstream fallback palette values participate in the rendered theme. Surface
129
133
  elevation uses Glaze's contrast-uniform tone axis: `surface-2` advances two tone
130
134
  steps and `surface-3` advances four from the base surface, with proportionally
@@ -133,7 +137,7 @@ wider steps in high-contrast mode. Their saturation also steps down to 75% and
133
137
  move farther from the base tone.
134
138
 
135
139
  Borders stay intentionally quiet: Glaze derives their hue from `brand` but
136
- uses only one quarter of the brand saturation. Normal and high-contrast modes
140
+ uses only about one fifth (a `0.205` factor) of the brand saturation. Normal and high-contrast modes
137
141
  change border tone, not that restrained saturation relationship.
138
142
 
139
143
  ### Add palette colors and reference other roles
@@ -183,7 +187,8 @@ a shadow to be a mix target. Override the surface separately when needed.
183
187
 
184
188
  `theme.glaze` accepts `lightTone`, `darkTone`, `darkDesaturation`, `autoFlip`,
185
189
  `pastel`, `inferRole`, and `shadowTuning`. Tone windows accept `[lo, hi]`, `false`
186
- for the full range, or the advanced `{ lo, hi, eps }` form. Continue to use
190
+ for the full range, or the advanced `{ lo, hi, eps }` form. The example below
191
+ uses Glaze's default windows. Continue to use
187
192
  `theme.contrastLevel` for manual contrast interpolation. Cookbook always emits
188
193
  all four appearance variants.
189
194
 
@@ -213,29 +218,31 @@ and `bgHueBlend`; a role's own `tuning` takes precedence.
213
218
 
214
219
  Every generated role below can be overridden in `theme.palette`. Names map
215
220
  directly to Tasty `#name` tokens. `COOKBOOK_PALETTE_NAMES`, exported from
216
- `@tenphi/docs`, lists the same roles for tooling.
221
+ `@tenphi/cookbook`, lists the same roles for tooling.
217
222
 
218
223
  | Area | Roles |
219
224
  | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
220
225
  | Surfaces | `surface`, `header`, `overlay`, `surface-2`, `surface-3`, `surface-2-hover`, `surface-2-pressed`, `surface-3-hover`, `surface-3-pressed` |
221
226
  | Reading | `text`, `heading`, `text-soft`, `text-muted`, `sidebar-text` |
222
227
  | Brand and focus | `accent-text`, `accent-surface`, `accent-surface-text`, `accent-surface-subtle`, `accent-surface-2-subtle`, `logo-surface`, `logo-mark`, `focus` |
223
- | Borders and effects | `border`, `border-strong`, `shadow`, `clear` |
228
+ | Borders and effects | `border`, `border-strong`, `shadow` |
224
229
  | Status | `info`, `success`, `warning`, `danger`, each with `-text` and `-surface` variants |
225
230
  | Additional hues | `orange`, `green`, `blue`, `purple`, `red`, each with `-text` and `-surface` variants |
226
231
  | Syntax | `syntax-bg`, `syntax-text`, `syntax-comment`, `syntax-punctuation`, `syntax-keyword`, `syntax-string`, `syntax-token`, `syntax-property`, `syntax-number`, `syntax-function`, `syntax-value`, `syntax-operator` |
227
232
 
228
233
  ### Contrast checks and troubleshooting
229
234
 
230
- Cookbook checks text, headings, muted reading text, brand links, filled-control
231
- labels, status text on its tinted surface, focus rings on each elevated
232
- surface, and every palette declaration with a contrast floor. The same Glaze
235
+ Cookbook checks text, headings, secondary `text-soft` text, brand links,
236
+ filled-control labels, the logo mark on its surface, status text on its tinted
237
+ surface, focus rings on each elevated surface, and every palette declaration
238
+ with a contrast floor. The same Glaze
233
239
  resolution powers rendering and `cookbook doctor`, in light, dark, and both
234
240
  high-contrast modes. Manual `theme.contrastLevel` targets interpolate with
235
241
  Glaze's contrast level.
236
242
 
237
- `resolveDocsTheme(theme).contrastChecks` lists each foreground/background pair,
238
- mode, metric, target, measured value, and pass result. APCA uses display-channel
243
+ `resolveDocsTheme(theme).contrastChecks`, exported from `@tenphi/cookbook`,
244
+ lists each foreground/background pair with its mode, metric, target,
245
+ `measured` value, and `passed` result. APCA uses display-channel
239
246
  luminance; WCAG ratios use the sRGB transfer function. Transparent foregrounds
240
247
  are composited onto their background before measuring. These checks cover
241
248
  Cookbook's semantic pairs; test actual pages after changing component styles,
@@ -259,12 +266,14 @@ check does not replace keyboard, screen-reader, and rendered-page testing.
259
266
  Token names follow Tasty's
260
267
  [token and unit syntax](./upstream/tasty/docs/dsl.md#built-in-units): `$name`
261
268
  becomes the CSS custom property `--name`. Configure tokens with `$name` keys.
269
+ These are the defaults:
262
270
 
263
271
  ```ts
264
272
  theme: {
265
273
  tokens: {
266
274
  "$gap": "0.5rem",
267
275
  "$radius": "8px",
276
+ "$header-control-radius": "999px",
268
277
  "$card-radius": "16px",
269
278
  "$border-width": "1px",
270
279
  "$outline-width": "2px",
@@ -283,7 +292,8 @@ as the viewport narrows: horizontal padding shrinks to 1.5rem before the column
283
292
  itself shrinks. Mobile layouts use 1rem padding. `radius` is the control
284
293
  and navigation radius; `card-radius` is the larger surface radius. Keeping
285
294
  those roles separate makes a sharp control theme or a soft card theme possible
286
- without one-off component overrides.
295
+ without one-off component overrides. `header-control-radius` shapes the header
296
+ buttons; see [header control shape](./component-styles.md#header-control-shape).
287
297
 
288
298
  ### Register units and recipes
289
299
 
@@ -334,53 +344,110 @@ compose recipes with `recipe: "base elevated"` rather than referencing a recipe
334
344
  inside another recipe. `none` is a reserved recipe name. Cookbook's built-in
335
345
  units are `x`, `r`, `cr`, and `bw`; overriding one changes its meaning globally.
336
346
 
337
- Keep editor and linter validation synchronized with your configuration:
347
+ To keep editor and linter validation synchronized with these names, build the
348
+ lint configuration from your theme; see
349
+ [custom theme names](./custom-components.md#custom-theme-names).
350
+
351
+ ## Logo and favicon
352
+
353
+ Set `site.logo` once to use your artwork in the header and mobile drawer:
338
354
 
339
355
  ```ts
340
- // tasty.config.ts
341
- import { createValidationConfig } from "@tenphi/cookbook/eslint-plugin";
342
- import docs from "./docs.config";
343
- export default createValidationConfig(docs.theme);
356
+ site: {
357
+ title: "Acme",
358
+ logo: "./assets/acme.svg"
359
+ }
344
360
  ```
345
361
 
346
- ## Typography presets
362
+ Paths are local files relative to the resolved project root, just like
363
+ `site.favicon`. Cookbook reads the intrinsic dimensions and copies the image to
364
+ a content-hashed URL under the deployment base. SVG, PNG, JPEG, WebP, AVIF, and
365
+ GIF are supported. Missing or invalid files fail during setup.
347
366
 
348
- Cookbook supplies semantic `body`, `heading`, `h1`–`h6`, `navigation`, `small`,
349
- and `code` presets. Change their families, sizes, and weights through
350
- `theme.fonts` and `theme.presets`. See [Fonts and typography](./fonts-and-typography.md)
351
- for local and Google font examples, cache behavior, and preset details.
367
+ ```ts
368
+ site: {
369
+ title: "Acme",
370
+ logo: {
371
+ light: "./assets/acme-light.svg",
372
+ dark: "./assets/acme-dark.svg",
373
+ href: "/",
374
+ decorative: true
375
+ },
376
+ favicon: "./assets/acme-icon.svg"
377
+ }
378
+ ```
379
+
380
+ Use `src` for one image, or both `light` and `dark`. Variants follow the
381
+ appearance control and the system preference in Auto mode. They must share an
382
+ aspect ratio to prevent layout shifts. Optional `width` and `height` describe
383
+ intrinsic dimensions; Tasty controls display size. Customize
384
+ `theme.styles.SiteLogo` and its complete anatomy: `Image`, `Light`, and `Dark`.
385
+ Wide wordmarks retain their proportions within the header.
386
+
387
+ The logo is decorative by default because the neighboring title labels the
388
+ site. Set `decorative: false` and `alt` when the image itself carries meaningful
389
+ text. The header logo link still has a name when the image is decorative.
390
+ `href` defaults to the localized documentation home; it accepts a root-relative
391
+ documentation route or HTTP(S) destination. The header title and drawer use the
392
+ same destination. `site.logo: false` removes the mark from both locations.
393
+
394
+ A logo does not change the favicon or touch icons. Configure
395
+ [`site.favicon`](./configuration.md#site-icons) separately for square artwork;
396
+ the default Cookbook icon set remains in place until changed. The
397
+ [`Logo` component](./authoring.mdx#cookbook-logo) remains available as the
398
+ standalone Cookbook book mark.
399
+
400
+ The built-in mark uses `theme.palette["logo-surface"]` and `theme.palette["logo-mark"]`.
401
+ The default homepage hero artwork also uses `logo-surface` for its brand fill.
402
+ Both default to Glaze `mode: "fixed"`: the brand background and light book keep
403
+ their polarity in dark mode while respecting Glaze's tone boundaries and
404
+ high-contrast settings. The mark-to-background contrast floor is 3:1 normally
405
+ and 4.5:1 in high contrast. These colors are separate from interactive accents.
406
+ For example, to customize the logo background while retaining brand hue:
407
+
408
+ ```ts
409
+ theme: {
410
+ brand: { from: "#315efb" },
411
+ palette: {
412
+ "logo-surface": {
413
+ base: "logo-mark",
414
+ tone: 40,
415
+ saturation: 0.8,
416
+ mode: "fixed",
417
+ contrast: { wcag: [3, 4.5] },
418
+ },
419
+ "logo-mark": { tone: 100, saturation: 0, mode: "fixed" },
420
+ },
421
+ }
422
+ ```
352
423
 
353
- ### Change font families
424
+ Custom image assets keep their authored colors; use `light`/`dark` files when
425
+ you want distinct artwork. Header and drawer home links center logos with the
426
+ site title regardless of their aspect ratio. Use `theme.styles.SiteLogo` for
427
+ image size and `theme.styles.Header.SiteTitle` / `Sidebar.HomeLink`
428
+ for typography; they do not need baseline offsets for a different preset.
429
+ To combine your own logo and title in one custom link, see
430
+ [Replace built-in markup](./custom-components.md#replace-built-in-markup).
354
431
 
355
- Use `theme.fonts` to load Google families by name or local font files. The
356
- [font guide](./fonts-and-typography.md#change-font-families) explains both
357
- paths and how to select weights and styles.
432
+ ## Typography
358
433
 
359
- ## Style customization
434
+ Cookbook supplies semantic `body`, `heading`, `h1`–`h6`, `navigation`, `small`,
435
+ and `code` presets. Use `theme.fonts` to load Google families by name or local
436
+ font files, and `theme.presets` to change sizes, weights, and other typography
437
+ fields. See [Fonts and typography](./fonts-and-typography.md) for both paths,
438
+ cache behavior, and preset details.
439
+
440
+ ## Component styles and custom components
360
441
 
361
442
  Use a partial Tasty style object at `theme.styles.<ComponentName>` to change a
362
443
  built-in surface. Cookbook merges it with the complete base style object before
363
444
  CSS extraction. The [component styles reference](./component-styles.md) gives
364
445
  examples and the complete list of named sub-elements for every surface.
365
446
 
366
- ## Authoring custom components
367
-
368
- Use `defineComponent()` for a configurable component root and
369
- `resolveComponentStyles()` for an owned global style tree. Keep styling on the
370
- server so the browser receives extracted CSS. The
371
- [custom component guide](./custom-components.md) covers both patterns.
372
-
373
- ### A shared site logo
374
-
375
- For ordinary branding, set `site.logo` once for the header and mobile drawer.
376
- Use the [logo guide](./custom-components.md#a-shared-site-logo) for image
377
- variants, accessibility, and advanced title markup.
378
-
379
- ## Linting custom styles
380
-
381
- Adopt Cookbook's Tasty validation preset and register your additional names.
382
- See [Linting custom styles](./custom-components.md#linting-custom-styles) for
383
- ESLint and oxlint examples.
447
+ For your own components, use `defineComponent()` for a configurable component
448
+ root and `resolveComponentStyles()` for an owned global style tree, then adopt
449
+ Cookbook's Tasty lint preset. The [custom component guide](./custom-components.md)
450
+ covers both patterns and [linting](./custom-components.md#linting-custom-styles).
384
451
 
385
452
  ## Reader appearance
386
453
 
@@ -37,9 +37,10 @@ contrast. Browser checks complement the numeric diagnostics.
37
37
  - **Google request fails:** check the exact family name and supported weights and
38
38
  styles. Explicit requests reject missing styles; shorthand warns if italics
39
39
  are unavailable. See [font configuration](./fonts-and-typography.md#change-font-families).
40
- - **Offline cache miss:** warm the cache with `cache: "reuse"` while online, and
41
- retain `<Astro cacheDir>/cookbook-fonts`. The key includes the requested family,
42
- weights, and styles. `cache: "refresh"` intentionally needs the network.
40
+ - **Offline cache miss:** warm the cache with `theme.fontLoading.cache: "reuse"`
41
+ while online, and retain `<Astro cacheDir>/cookbook-fonts`. The key includes
42
+ the requested family, weights, and styles. `cache: "refresh"` intentionally
43
+ needs the network.
43
44
  - **Wrong weight:** a static file cannot supply every intermediate weight. Use
44
45
  matching files or a variable range. Check `theme.presets`: an explicit
45
46
  `fontFamily` there takes precedence over the semantic font role.
@@ -1,10 +1,10 @@
1
1
  [
2
2
  {
3
3
  "name": "@tenphi/tasty",
4
- "version": "3.9.10",
4
+ "version": "3.14.0",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/tenphi/tasty",
7
- "ref": "v3.9.10",
7
+ "ref": "v3.14.0",
8
8
  "directory": "upstream/tasty"
9
9
  },
10
10
  {