@tenphi/cookbook 0.20.4 → 0.21.0

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.
@@ -0,0 +1,61 @@
1
+ ---
2
+ title: Cookbook
3
+ description: Crea un sitio de documentación estático con Astro a partir de tu repositorio o de un paquete npm publicado, con un tema adaptado a tu producto.
4
+ template: splash
5
+ seo:
6
+ title: Cookbook — documentación junto al código y adaptada a tu producto
7
+ hero:
8
+ title: Documentación que permanece junto al código.
9
+ tagline: Cookbook es un kit de herramientas de documentación para Astro. Convierte el Markdown de tu repositorio o un paquete npm publicado en un sitio estático con búsqueda, y adapta los colores, la tipografía y los componentes a tu producto.
10
+ image:
11
+ html: '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="14" fill="currentColor"/><path fill="#fff" d="M14.8 16c6.7.2 12.3 2 16.7 5.4v28.4c-4.4-3.1-10-4.7-16.6-4.9a3 3 0 0 1-2.9-3V19a3 3 0 0 1 2.8-3Z"/><path fill="#fff" d="M49.2 16c-6.7.2-12.3 2-16.7 5.4v28.4c4.4-3.1 10-4.7 16.6-4.9a3 3 0 0 0 2.9-3V19a3 3 0 0 0-2.8-3Z"/></svg>'
12
+ actions:
13
+ - text: Empezar
14
+ link: /es/getting-started/
15
+ variant: primary
16
+ - text: Comparar herramientas (en inglés)
17
+ link: /comparison/
18
+ variant: secondary
19
+ sidebar:
20
+ label: Introducción
21
+ order: 1
22
+ ---
23
+ ## Qué incluye
24
+
25
+ * **Usa la documentación que ya tienes.** Lee Markdown, MDX y recursos locales directamente desde tu repositorio, o genera el sitio a partir de un paquete npm fijado por versión e integridad. [Fuentes de contenido](../content-sources.md).
26
+ * **Genera una referencia de API.** Convierte una especificación OpenAPI local en un resumen con búsqueda y una página por operación, con parámetros, cuerpos de petición, respuestas y ejemplos. [Referencias OpenAPI](../content-sources.md#openapi-references).
27
+ * **Búsqueda integrada.** Pagefind indexa las páginas y los encabezados localmente, con un atajo de teclado y recursos de búsqueda que se cargan cuando hacen falta. [Búsqueda](../site-navigation.md#search).
28
+ * **Navegación para documentación que crece.** Organiza secciones con pestañas y barras laterales agrupadas, añade índices de página y enlaces anterior/siguiente, y ofrece un menú de navegación móvil. [Búsqueda y navegación](../site-navigation.md).
29
+ * **Componentes para documentación técnica.** Usa pestañas, avisos, tarjetas, pasos, grupos de código, código resaltado con controles de copia y ejemplos interactivos aislados en MDX. [Componentes de contenido](../authoring.mdx).
30
+ * **Un tema adaptado a tu producto.** Configura colores de marca, paletas semánticas, fuentes, tipografía y partes de componentes con [Tasty](../upstream/tasty/README.md) y [Glaze](../upstream/glaze/README.md). Los modos claro, oscuro y de alto contraste reciben CSS estático generado durante la compilación. [Tema y componentes](../theme-and-components.md).
31
+ * **Idiomas y versiones.** Ofrece páginas traducidas y documentación versionada, con selectores que llevan a la página equivalente cuando existe. [Idiomas y versiones](../site-navigation.md#contents-languages-and-versions).
32
+ * **Comprobaciones antes de publicar.** Detecta enlaces rotos, recursos ausentes, rutas duplicadas y navegación inválida con errores que señalan el archivo de origen. Publica HTML prerenderizado en cualquier alojamiento estático. [Comprobaciones de calidad](../quality-checks.md).
33
+ * **Páginas listas para compartir y leer.** Publica URL canónicas, vistas previas para redes sociales, mapas del sitio, Markdown descargable y un índice `llms.txt` para agentes de programación. [Metadatos de publicación](../publishing.md).
34
+
35
+ ## Empieza con tu repositorio
36
+
37
+ Ejecuta estos comandos en un proyecto que ya tenga un archivo `README.md` o un directorio `docs/`:
38
+
39
+ ```sh
40
+ npm create @tenphi/cookbook@latest docs-site -- --source . --yes
41
+ cd docs-site
42
+ npm run dev
43
+ ```
44
+
45
+ Cookbook lee los archivos donde ya están. También puedes [crear un sitio nuevo](./getting-started.md), [documentar exactamente los archivos publicados en npm](./getting-started.md) o [añadir Cookbook a un proyecto Astro](./getting-started.md).
46
+
47
+ ## Este sitio es el ejemplo
48
+
49
+ Esta página procede de [docs/es/index.md](https://github.com/tenphi/cookbook/blob/main/docs/es/index.md). Una pequeña [aplicación Astro](https://github.com/tenphi/cookbook/tree/main/apps/reference) genera el sitio directamente desde el directorio `docs/` del repositorio. La navegación, la búsqueda, los controles de código, los enlaces de edición y las fechas de Git están disponibles para cualquier sitio Cookbook.
50
+
51
+ ## Explora la guía
52
+
53
+ * [Primeros pasos](./getting-started.md) explica cómo empezar con repositorios, paquetes npm y proyectos Astro existentes.
54
+ * [Comparación de herramientas](../comparison.md) describe el modelo de contenido y personalización de Cookbook.
55
+ * [Ejemplos](../examples.md) muestran configuraciones para repositorios, monorepos, paquetes y temas compartidos.
56
+ * [Búsqueda y navegación](../site-navigation.md) explica cómo encuentran los lectores las páginas.
57
+ * [Redacción](../authoring.mdx) cubre páginas, componentes y ejemplos interactivos.
58
+ * [Tema y componentes](../theme-and-components.md) introduce la marca y los tokens y enlaza con fuentes, estilos y componentes propios.
59
+ * [Despliegue](../deployment.md) cubre la validación y el alojamiento estático.
60
+
61
+ El resto de la documentación aún está disponible en inglés. Consulta también el [flujo para agentes de IA](../ai-agents.md), la [referencia de configuración](../configuration.md), las [opciones de publicación](../publishing.md) y la [referencia de la CLI](../cli.md).
@@ -0,0 +1,157 @@
1
+ ---
2
+ title: Fonts and typography
3
+ description: Load local or Google fonts and tune semantic Tasty typography presets.
4
+ ---
5
+ Start with the [theme overview](./theme-and-components.md) for brand colors and
6
+ design tokens. Cookbook configures font loading at build time and applies
7
+ named presets to the rendered site.
8
+
9
+ ## Typography presets
10
+
11
+ The built-in [typography presets](./upstream/tasty/docs/styles.md#preset) are
12
+ `body`, `heading`, `h1` through `h6`, `navigation`, `small`, and `code`. Onest
13
+ is self-hosted and used for body and heading text by default; JetBrains Mono is
14
+ self-hosted for code.
15
+
16
+ ### Change font families
17
+
18
+ Set `theme.fonts` to load fonts and apply them to the matching presets. A Google
19
+ Fonts family needs only its name:
20
+
21
+ ```ts
22
+ theme: {
23
+ fonts: {
24
+ body: "Inter",
25
+ heading: "Newsreader"
26
+ }
27
+ }
28
+ ```
29
+
30
+ The short form follows the regular and strong weights in your configured
31
+ presets, including heading and custom preset references. It requests normal and
32
+ italic styles, prefers a variable range, and falls back to real static weights
33
+ when ranges are unavailable. A font without italics produces a build warning;
34
+ choose another family or select only its supported styles. To control the
35
+ request exactly, list weights or ascending variable ranges and styles. Google
36
+ Fonts must support them; see the
37
+ [Google Fonts CSS API](https://developers.google.com/fonts/docs/css2) for its
38
+ available styles and weight syntax.
39
+
40
+ ```ts
41
+ theme: {
42
+ fonts: {
43
+ body: { google: "Inter", weights: ["400 750"], styles: ["normal", "italic"] }
44
+ }
45
+ }
46
+ ```
47
+
48
+ For a font you own, put its files in `public/fonts/` and give Cookbook their
49
+ public paths. Cookbook checks that each file exists during the build and adjusts
50
+ its URL for the Astro `base` path. A variable font can cover a weight range;
51
+ use separate entries for regular and italic files when needed:
52
+
53
+ ```ts
54
+ theme: {
55
+ fonts: {
56
+ body: {
57
+ family: "Acme Sans",
58
+ files: [
59
+ { src: "/fonts/acme-sans.woff2", weight: "100 900" },
60
+ { src: "/fonts/acme-sans-italic.woff2", weight: "100 900", style: "italic" }
61
+ ]
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ The `body` role also feeds navigation and small text. `heading` feeds `h1`
68
+ through `h6`, while `code` covers code text. Each role has a system fallback.
69
+ Cookbook emits font faces through Tasty with `font-display: swap`. Google CSS
70
+ and font files are downloaded at build time and cached in
71
+ `<Astro cacheDir>/cookbook-fonts`. Files are served from your own site's
72
+ `_cookbook/fonts/` path by default, including the deployment base. Visitors make
73
+ no Google Fonts requests. Existing local-file definitions keep working.
74
+
75
+ ```ts
76
+ theme: {
77
+ fonts: { body: "Inter" },
78
+ fontLoading: {
79
+ google: "self-hosted", // or "remote" to keep Google's font CDN URLs
80
+ cache: "reuse", // "refresh" to fetch again; "offline" to forbid network
81
+ display: "swap" // also auto, block, fallback, optional
82
+ }
83
+ }
84
+ ```
85
+
86
+ The first build requires network access. Preserve the Astro cache between CI
87
+ runs; `offline` fails with an actionable message when an entry is missing or
88
+ corrupt. Cache entries are content-verified and keyed by the exact request.
89
+ `refresh` deliberately updates them. For a fully checked-in font source, copy
90
+ licensed files into `public/fonts/` and use the local form. Only `wght` and
91
+ `ital` axes are requested; use local variable files and Tasty typography styles
92
+ for other axes. Styles and weights that do not exist are rejected for explicit
93
+ requests. For static fonts, browsers select their nearest real weight;
94
+ intermediate weights require a variable font.
95
+
96
+ Migration: name-only Google font configuration now downloads the required
97
+ weights and italics and serves them locally. This increases the initial build's
98
+ font downloads and removes visitors' external font dependency. Set
99
+ `fontLoading.google: "remote"` to retain CDN delivery. Existing CSS-variable
100
+ weights that cannot be resolved from presets require explicit `weights`.
101
+
102
+ ### Adjust presets
103
+
104
+ Presets merge property-by-property, so changing size, weight, or line height
105
+ does not require copying the rest of the preset. `theme.presets` takes precedence
106
+ over `theme.fonts` for an explicitly set `fontFamily`:
107
+
108
+ ```ts
109
+ theme: {
110
+ presets: {
111
+ body: {
112
+ boldFontWeight: 680
113
+ },
114
+ heading: {
115
+ fontWeight: 650,
116
+ boldFontWeight: 740
117
+ },
118
+ h1: {
119
+ fontSize: "3rem",
120
+ letterSpacing: "-0.02em"
121
+ },
122
+ code: { fontSize: "0.9rem" }
123
+ }
124
+ }
125
+ ```
126
+
127
+ For a system or already loaded font, set its CSS family directly with
128
+ `theme.presets.<role>.fontFamily`. This does not load a font file. Additional
129
+ named presets are available to custom MDX components.
130
+
131
+ Heading presets reference the `heading` family and weights; body, navigation,
132
+ and controls reference `body`. Semantic `strong` and `b` elements use Tasty's
133
+ `strong` modifier, so their weight comes from the active preset's
134
+ `boldFontWeight` instead of a separate element-specific value. `strong` is a
135
+ reserved modifier keyword, not a named preset; the modifier-only form is
136
+ equivalent to `inherit / strong`. Body text uses a regular `400` weight and
137
+ neutral tracking, while
138
+ headings use a medium `610` weight and progressively gentle negative tracking.
139
+ The separate `720` heading bold weight keeps emphasized heading text distinct.
140
+ Navigation uses a lighter `450` weight with `580` for the current sidebar page,
141
+ while smaller group labels establish hierarchy without oversized bold text.
142
+ Inactive sidebar links use `sidebar-text`, a slightly softer blend of `text-soft`
143
+ and the surface. In high-contrast mode it matches `text-soft`. Set
144
+ `theme.palette['sidebar-text']` to adjust that color without changing other
145
+ secondary text, or `theme.styles.Sidebar.Control` to customize the control.
146
+ See [Search and navigation](./site-navigation.md#sections-and-page-order)
147
+ for sidebar group and disclosure behavior. Inline code scales to `0.875em`
148
+ of its surrounding text, including smaller table text; code blocks keep the
149
+ `code` preset size. Customize inline code through
150
+ `theme.styles.MarkdownInlineCode`.
151
+
152
+ Cookbook applies each semantic typography role through its complete Tasty
153
+ `preset`, so configured fields such as `fontStyle` and `textTransform` are not
154
+ silently omitted.
155
+
156
+ The exported `DEFAULT_THEME_TOKENS` and `DEFAULT_TYPOGRAPHY_PRESETS` constants
157
+ are useful when building a theme editor or presenting a reset action.
@@ -98,11 +98,12 @@ export default defineDocsConfig({
98
98
  });
99
99
  ```
100
100
 
101
- Change `theme.fonts` to use [Google Fonts by name or your own font files](./theme-and-components.md#change-font-families).
101
+ Change `theme.fonts` to use [Google Fonts by name or your own font files](./fonts-and-typography.md#change-font-families).
102
102
  Use `theme.presets` for typography details, `theme.styles` for built-in elements,
103
103
  and `defineComponent()` with `theme.customStyles` to add a new element. The
104
- [theme guide](./theme-and-components.md) includes examples and the complete
105
- list of customizable sub-elements.
104
+ [theme guide](./theme-and-components.md) gives the starting path; the
105
+ [component styles reference](./component-styles.md) lists every customizable
106
+ sub-element.
106
107
 
107
108
  The integration and CLI load the same configuration. Supported filenames are
108
109
  `docs.config.ts`, `.mts`, `.js`, and `.mjs`, in that order. An explicit integration
package/docs/index.md CHANGED
@@ -6,7 +6,7 @@ seo:
6
6
  title: Cookbook — docs that stay with the code and fit your product
7
7
  hero:
8
8
  title: Documentation that stays with the code.
9
- tagline: Build a static Astro docs site from repository Markdown or a locked npm package, then shape its colors, typography, and components to fit your product.
9
+ tagline: Cookbook is an Astro documentation toolkit. Turn your repository Markdown or a published npm package into a searchable static site, with colors, typography, and components that fit your product.
10
10
  image:
11
11
  html: '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="14" fill="currentColor"/><path fill="#fff" d="M14.8 16c6.7.2 12.3 2 16.7 5.4v28.4c-4.4-3.1-10-4.7-16.6-4.9a3 3 0 0 1-2.9-3V19a3 3 0 0 1 2.8-3Z"/><path fill="#fff" d="M49.2 16c-6.7.2-12.3 2-16.7 5.4v28.4c4.4-3.1 10-4.7 16.6-4.9a3 3 0 0 0 2.9-3V19a3 3 0 0 0-2.8-3Z"/></svg>'
12
12
  actions:
@@ -20,6 +20,37 @@ sidebar:
20
20
  label: Overview
21
21
  order: 1
22
22
  ---
23
+ ## What you get
24
+
25
+ * **Use the docs you already have.** Read Markdown, MDX, and local assets
26
+ directly from your repository, or build from an npm package locked to an exact
27
+ version and integrity. [Content sources](./content-sources.md).
28
+ * **Generate an API reference.** Turn a local OpenAPI spec into a searchable
29
+ overview and a page for each operation, with parameters, request bodies,
30
+ responses, and examples. [OpenAPI references](./content-sources.md#openapi-references).
31
+ * **Search built in.** Pagefind indexes your pages and headings locally, with a
32
+ keyboard shortcut and search assets that load when needed.
33
+ [Search](./site-navigation.md#search).
34
+ * **Navigation for growing docs.** Organize sections with tabs and grouped
35
+ sidebars, add page contents and previous/next links, and give mobile readers a
36
+ navigation drawer. [Search and navigation](./site-navigation.md).
37
+ * **Components for technical writing.** Use tabs, callouts, cards, steps, code
38
+ groups, highlighted code with copy controls, and sandboxed interactive
39
+ previews in MDX. [Authoring components](./authoring.mdx).
40
+ * **A theme that fits your product.** Configure brand colors, semantic palettes,
41
+ fonts, typography, and individual component parts through [Tasty](./upstream/tasty/README.md) and [Glaze](./upstream/glaze/README.md).
42
+ Light, dark, and high-contrast appearances receive static CSS generated at
43
+ build time. [Theme and components](./theme-and-components.md).
44
+ * **Languages and versions.** Offer translated pages and versioned docs, with
45
+ selectors that take readers to the equivalent page when available.
46
+ [Languages and versions](./site-navigation.md#contents-languages-and-versions).
47
+ * **Checks before you ship.** Catch broken links, missing assets, duplicate
48
+ routes, and invalid navigation with errors that point to the source. Publish
49
+ prerendered HTML to any static host. [Quality checks](./quality-checks.md).
50
+ * **Pages ready to share and read.** Publish canonical URLs, social previews,
51
+ sitemaps, downloadable Markdown, and an `llms.txt` index for coding agents.
52
+ [Publishing metadata](./publishing.md).
53
+
23
54
  ## Start with your repository
24
55
 
25
56
  Run this from a project that already has a `README.md` or `docs/` directory:
@@ -42,29 +73,9 @@ The page you're reading comes from this repository's
42
73
  A small [Astro app](https://github.com/tenphi/cookbook/tree/main/apps/reference)
43
74
  builds directly from the root `docs/` directory. Its navigation, search, code
44
75
  controls, edit links, and Git timestamps are available to every Cookbook site.
45
-
46
- ## Content and design on your terms
47
-
48
- ### Keep the source where it belongs
49
-
50
- Use a repository's Markdown and local assets without copying them into an Astro
51
- content tree. Cookbook can also read OpenAPI specs or the documentation inside an
52
- npm artifact pinned to its exact version and integrity.
53
- [Explore content sources](./content-sources.md).
54
-
55
- ### Shape the site through configuration
56
-
57
- Start with a brand color, then configure semantic palettes, fonts, typography,
58
- and named component parts through [Tasty](./upstream/tasty/README.md) and
59
- [Glaze](./upstream/glaze/README.md). Partial `theme.styles` overrides merge with
60
- Cookbook's defaults before CSS extraction, so the browser receives static CSS.
61
- [Explore the theme](./theme-and-components.md).
62
-
63
- ### Catch drift before publishing
64
-
65
- Broken links, missing assets, duplicate routes, and invalid navigation fail with
66
- source-aware errors. The result is prerendered HTML with local search, ready for
67
- any static host. [See the validation workflow](./quality-checks.md).
76
+ Use the language selector in the header to read this page and the getting-started
77
+ guide in Spanish, Russian, Japanese, or Simplified Chinese. Other guides remain
78
+ in English for now.
68
79
 
69
80
  ## Explore the guide
70
81
 
@@ -74,7 +85,10 @@ any static host. [See the validation workflow](./quality-checks.md).
74
85
  customization model alongside other options.
75
86
  * [Working examples](./examples.md) show repository, monorepo, package, and
76
87
  shared-theme configurations.
88
+ * [Search and navigation](./site-navigation.md) explains how readers find pages.
77
89
  * [Authoring](./authoring.mdx) covers pages, components, and interactive examples.
90
+ * [Theme and components](./theme-and-components.md) starts with brand and tokens,
91
+ then points to fonts, built-in styles, and custom components.
78
92
  * [Deployment](./deployment.md) covers validation and static hosting.
79
93
 
80
94
  For agent-assisted setup, see the [AI agent workflow](./ai-agents.md). The
@@ -0,0 +1,109 @@
1
+ ---
2
+ title: はじめに
3
+ description: ドキュメントサイトの作成、既存リポジトリの文書化、公開済み npm パッケージの利用方法を説明します。
4
+ sidebar:
5
+ order: 2
6
+ ---
7
+
8
+ Cookbook には Node.js 22.19 以降が必要です。
9
+
10
+ ## 最初のサイトを作る
11
+
12
+ ```sh
13
+ npm create @tenphi/cookbook@latest my-docs -- --yes
14
+ cd my-docs
15
+ npm run dev
16
+ ```
17
+
18
+ 作成ツールは README、Astro の設定、`docs.config.ts` を書き込み、依存パッケージをインストールします。コーディングエージェント向けの指示を記した `AGENTS.md` も作成します。ホームページを変えるには `README.md` を編集してください。`docs/guide.md` を追加すると `/guide` が作られます。新規・変更したページは、開発サーバーを再起動せずに反映されます。
19
+
20
+ ## 既存のリポジトリを文書化する
21
+
22
+ リポジトリのルートで実行します。
23
+
24
+ ```sh
25
+ npm create @tenphi/cookbook@latest docs-site -- --source . --yes
26
+ cd docs-site
27
+ npm run dev
28
+ ```
29
+
30
+ 生成された `docs.config.ts` は元のリポジトリを参照します。ルートの README がホームページになり、`docs/**/*.{md,mdx}` がほかのページになります。Cookbook はファイルをコピー・書き換えず、そのまま読み込みます。
31
+
32
+ 依存パッケージをインストールする前にファイルだけ作るには、`--no-install` を指定します。対話なしのモードでは、空でない保存先の上書きを拒否します。
33
+
34
+ ## 公開済みの npm パッケージを文書化する
35
+
36
+ ```sh
37
+ npm create @tenphi/cookbook@latest my-package-docs -- \
38
+ --package @scope/package@latest --yes
39
+ cd my-package-docs
40
+ npm run dev
41
+ ```
42
+
43
+ 作成ツールは実際に公開されたパッケージからドキュメントを見つけ、正確なバージョンと整合性情報を `cookbook.lock.json` に記録します。このファイルをコミットしてください。対象パッケージはインストールされず、ライフサイクルスクリプトも実行されません。指定したタグやバージョン範囲を再解決したい場合は、`npm run update` を実行します。
44
+
45
+ ## 既存の Astro プロジェクトに追加する
46
+
47
+ Cookbook では Astro の `output: "static"` が必要です。プロジェクトで `output: "server"` を使っている場合は、ドキュメント用に別の静的 Astro プロジェクトを作成してください。
48
+
49
+ ```sh
50
+ npx astro add @tenphi/cookbook
51
+ ```
52
+
53
+ Astro の設定に必要な統合は一つだけです。
54
+
55
+ ```ts
56
+ import { defineConfig } from "astro/config";
57
+ import cookbook from "@tenphi/cookbook";
58
+
59
+ export default defineConfig({ integrations: [cookbook()] });
60
+ ```
61
+
62
+ Cookbook には Astro 用レンダラーが含まれ、`docs.config.ts` を自動検出します。ドキュメント設定がない場合は、README と `docs/` の規約を使用します。
63
+
64
+ ## サイトを設定する
65
+
66
+ まずは[ブランド、ロゴ、フォントのレシピ](../recipes.md)をご覧ください。より細かなスタイル変更や新しいコンポーネントには、[カスタマイズのルール](../customization-rules.md)を参照してください。これらのルールと参照先は、インストールされる Cookbook パッケージにも含まれます。
67
+
68
+ `astro.config.ts` と同じ場所に `docs.config.ts` を作成します。
69
+
70
+ ```ts
71
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
72
+
73
+ export default defineDocsConfig({
74
+ site: {
75
+ title: "Example Project",
76
+ description: "Documentation for Example Project",
77
+ repository: "https://github.com/example/project",
78
+ },
79
+ theme: {
80
+ brand: { from: "#2f5bff" },
81
+ fonts: { body: "Inter", heading: "Newsreader" },
82
+ },
83
+ });
84
+ ```
85
+
86
+ `theme.fonts` を変更すると、[名前で指定する Google Fonts や独自のフォントファイル](../fonts-and-typography.md)を使えます。タイポグラフィの詳細には `theme.presets`、組み込み要素には `theme.styles`、新しい要素には `defineComponent()` と `theme.customStyles` を使用します。[テーマガイド](../theme-and-components.md)が出発点となり、[コンポーネントスタイルのリファレンス](../component-styles.md)にはカスタマイズ可能なすべてのパーツが載っています。
87
+
88
+ 統合と CLI は同じ設定を読み込みます。対応するファイル名は優先順に `docs.config.ts`、`.mts`、`.js`、`.mjs` です。統合に明示した `config` オブジェクトが優先され、`configFile: false` で自動検出を無効にできます。標準以外の場所では `cookbook({ configFile: "./config/manual.ts" })` と `cookbook doctor --config ./config/manual.ts` を使用してください。
89
+
90
+ ## モノレポのルート
91
+
92
+ `apps/docs/` 内のアプリから、リポジトリ全体のコンテンツを利用できます。
93
+
94
+ ```ts
95
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
96
+
97
+ export default defineDocsConfig({ root: "../.." });
98
+ ```
99
+
100
+ `root` はドキュメント設定ファイルからの相対パスです。コンテンツ、ローカルアセット、`cookbook.lock.json` の場所を決めます。アプリのディレクトリで `npm run doctor` を実行すると、統合と同じリポジトリのルートが解決されます。複数パッケージを扱うサイトでは、ソースごとにルートを指定することもできます。
101
+
102
+ ## 検証して公開する
103
+
104
+ ```sh
105
+ npm run validate
106
+ npm run preview
107
+ ```
108
+
109
+ ほかのガイドは現在英語で公開されています。[使用例](../examples.md)、[執筆用コンポーネント](../authoring.mdx)、[AI エージェントの作業手順](../ai-agents.md)、[デプロイ](../deployment.md)、[バージョン別のアップグレードガイド](../migration.md)を参照してください。設定例には[レシピ](../recipes.md)、検証に失敗した場合には[トラブルシューティング](../troubleshooting.md)が役立ちます。
@@ -0,0 +1,61 @@
1
+ ---
2
+ title: Cookbook
3
+ description: リポジトリや公開済み npm パッケージから、製品に合ったテーマの静的な Astro ドキュメントサイトを作成します。
4
+ template: splash
5
+ seo:
6
+ title: Cookbook — コードとともに保ち、製品に合わせて整えるドキュメント
7
+ hero:
8
+ title: コードと同じ場所にあるドキュメント。
9
+ tagline: Cookbook は Astro 向けのドキュメントツールキットです。リポジトリの Markdown や公開済み npm パッケージを、検索できる静的サイトに変換し、色、タイポグラフィ、コンポーネントを製品に合わせて調整できます。
10
+ image:
11
+ html: '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="14" fill="currentColor"/><path fill="#fff" d="M14.8 16c6.7.2 12.3 2 16.7 5.4v28.4c-4.4-3.1-10-4.7-16.6-4.9a3 3 0 0 1-2.9-3V19a3 3 0 0 1 2.8-3Z"/><path fill="#fff" d="M49.2 16c-6.7.2-12.3 2-16.7 5.4v28.4c4.4-3.1 10-4.7 16.6-4.9a3 3 0 0 0 2.9-3V19a3 3 0 0 0-2.8-3Z"/></svg>'
12
+ actions:
13
+ - text: 使い始める
14
+ link: /ja/getting-started/
15
+ variant: primary
16
+ - text: ツールを比較(英語)
17
+ link: /comparison/
18
+ variant: secondary
19
+ sidebar:
20
+ label: 概要
21
+ order: 1
22
+ ---
23
+ ## 主な機能
24
+
25
+ * **既存のドキュメントをそのまま利用。** Markdown、MDX、ローカルアセットをリポジトリから直接読み込むか、バージョンと整合性を固定した npm パッケージからサイトを構築できます。[コンテンツソース](../content-sources.md)。
26
+ * **API リファレンスを生成。** ローカルの OpenAPI 仕様から、検索可能な概要と操作ごとのページを作成します。パラメータ、リクエストボディ、レスポンス、例を掲載できます。[OpenAPI リファレンス](../content-sources.md#openapi-references)。
27
+ * **検索を標準搭載。** Pagefind がページと見出しをローカルで索引化します。キーボードショートカットで検索を開き、検索用アセットは必要なときに読み込まれます。[検索](../site-navigation.md#search)。
28
+ * **ドキュメントの成長に対応するナビゲーション。** タブやグループ化したサイドバーでセクションを整理し、ページ内目次、前後のページへのリンク、モバイル用のナビゲーションドロワーを提供できます。[検索とナビゲーション](../site-navigation.md)。
29
+ * **技術文書用のコンポーネント。** MDX でタブ、注意書き、カード、手順、コードグループ、コピー操作付きのコードハイライト、隔離された対話的プレビューを使えます。[執筆用コンポーネント](../authoring.mdx)。
30
+ * **製品に合ったテーマ。** [Tasty](../upstream/tasty/README.md) と [Glaze](../upstream/glaze/README.md) でブランドカラー、セマンティックなパレット、フォント、タイポグラフィ、コンポーネントの各パーツを設定できます。ライト、ダーク、高コントラストの各表示には、ビルド時に生成した静的 CSS が配信されます。[テーマとコンポーネント](../theme-and-components.md)。
31
+ * **言語とバージョン。** 翻訳ページやバージョン別のドキュメントを提供できます。切り替え先に対応するページがあれば、そのページへ移動します。[言語とバージョン](../site-navigation.md#contents-languages-and-versions)。
32
+ * **公開前の検証。** リンク切れ、アセットの欠落、重複したルート、無効なナビゲーションを、ソースの場所を示すエラーで検出します。事前生成した HTML は任意の静的ホストに公開できます。[品質チェック](../quality-checks.md)。
33
+ * **共有しやすく、読み取りやすいページ。** 正規 URL、ソーシャルプレビュー、サイトマップ、ダウンロード用 Markdown、コーディングエージェント向けの `llms.txt` 索引を公開できます。[公開メタデータ](../publishing.md)。
34
+
35
+ ## リポジトリから始める
36
+
37
+ `README.md` または `docs/` ディレクトリがあるプロジェクトで、次を実行します。
38
+
39
+ ```sh
40
+ npm create @tenphi/cookbook@latest docs-site -- --source . --yes
41
+ cd docs-site
42
+ npm run dev
43
+ ```
44
+
45
+ Cookbook はファイルを現在の場所から読み込みます。[新しいサイトを作る](./getting-started.md)、[npm に公開されたファイルをそのまま文書化する](./getting-started.md)、[既存の Astro プロジェクトに追加する](./getting-started.md)方法もあります。
46
+
47
+ ## このサイト自体が使用例
48
+
49
+ このページの原稿は [docs/ja/index.md](https://github.com/tenphi/cookbook/blob/main/docs/ja/index.md) にあります。小さな [Astro アプリ](https://github.com/tenphi/cookbook/tree/main/apps/reference) が、リポジトリの `docs/` ディレクトリを直接読み込んでサイトを構築します。ナビゲーション、検索、コード操作、編集リンク、Git の更新日時は、どの Cookbook サイトでも利用できます。
50
+
51
+ ## ガイドを探す
52
+
53
+ * [はじめに](./getting-started.md):リポジトリ、npm パッケージ、既存の Astro プロジェクト。
54
+ * [ドキュメントツールの比較](../comparison.md):Cookbook のコンテンツとカスタマイズの考え方。
55
+ * [使用例](../examples.md):リポジトリ、モノレポ、パッケージ、共有テーマ。
56
+ * [検索とナビゲーション](../site-navigation.md):読者がページを見つける仕組み。
57
+ * [執筆](../authoring.mdx):ページ、コンポーネント、対話的な例。
58
+ * [テーマとコンポーネント](../theme-and-components.md):ブランド、トークン、フォント、組み込みスタイル、独自コンポーネント。
59
+ * [デプロイ](../deployment.md):検証と静的ホスティング。
60
+
61
+ これ以外のドキュメントは現在英語で公開されています。[AI エージェント向けの手順](../ai-agents.md)、[設定リファレンス](../configuration.md)、[公開設定](../publishing.md)、[CLI リファレンス](../cli.md)も参照してください。
package/docs/migration.md CHANGED
@@ -38,6 +38,42 @@ upgrade the site's Cookbook runtime or package-manager dependencies. Commit the
38
38
  documentation lock separately when intentionally updating imported content.
39
39
  Local Markdown needs no lock update.
40
40
 
41
+ ## Upcoming theme API cleanup
42
+
43
+ Use canonical Glaze palette names throughout configuration and color
44
+ references. Replace `theme.palette.textSoft` with `theme.palette["text-soft"]`
45
+ and update any `base`, `target`, `bg`, or `fg` references to `"text-soft"`.
46
+ Camel-case palette names now fail validation.
47
+
48
+ The `colors` returned by `resolveColorTheme()` and `resolveDocsTheme()` also
49
+ use canonical names: `surface-2`, `surface-3`, `text-soft`, `accent-text`,
50
+ `accent-surface`, and `accent-surface-text`. Update property access to bracket
51
+ notation, for example `theme.colors["accent-text"]`.
52
+
53
+ Configure `theme.tokens` with `$name` keys, such as `$radius`. The old `--name`
54
+ configuration keys now fail validation; the emitted CSS custom properties
55
+ still use `--name`.
56
+
57
+ Custom styles no longer target `data-tasty-anatomy` attributes automatically.
58
+ For a custom component, use `defineComponent(name, options)`. For custom global
59
+ rules, pass `resolveComponentStyles(name, baseStyles)` to `useGlobalStyles()`.
60
+ Both merge `theme.customStyles[name]` into the complete base styles during
61
+ server rendering. See [custom components](./custom-components.md).
62
+
63
+ ## 0.19.x to 0.20
64
+
65
+ Cookbook 0.20 generates a themed social preview image when a site has no
66
+ `site.seo.image`. If your host or sharing workflow expects a particular image,
67
+ set that field explicitly; use `false` to publish without a site-wide image.
68
+ Review [social preview configuration](./publishing.md#titles-and-social-previews)
69
+ after upgrading.
70
+
71
+ Cookbook requires a static Astro output. Adding it to an Astro project with
72
+ `output: "server"` now reports that requirement directly; create a separate
73
+ static documentation app for that case. Search and navigation received visual
74
+ and interaction updates without a configuration migration. Review any custom
75
+ `Search`, `SearchResults`, or header styles in a production preview.
76
+
41
77
  ## 0.18.x to 0.19
42
78
 
43
79
  Cookbook now renders documentation with its own Astro components. The public
@@ -54,7 +90,7 @@ and `Steps` components remain available.
54
90
 
55
91
  Renderer class names now use Cookbook-owned names. Update any custom CSS or
56
92
  scripts that target generated markup, and prefer the named `theme.styles`
57
- surfaces in the [theme reference](./theme-and-components.md).
93
+ surfaces in [Component styles](./component-styles.md).
58
94
 
59
95
  The `plugins` integration option no longer forwards Starlight hooks. Move
60
96
  content transforms to Astro's `markdown` configuration and use
@@ -77,7 +113,7 @@ These changes were introduced in 0.18:
77
113
  self-hosts the files. The initial build requires network access. Preserve the
78
114
  Astro font cache for offline rebuilds, use local files for checked-in assets,
79
115
  or select `theme.fontLoading.google: "remote"` for CDN delivery. See
80
- [fonts](./theme-and-components.md#change-font-families).
116
+ [fonts](./fonts-and-typography.md#change-font-families).
81
117
  - **Colors:** body tone 0 and heading tone 4 remain the reading defaults.
82
118
  The default logo uses fixed Glaze colors (`logo-surface` and `logo-mark`), so
83
119
  its book stays light in dark mode. Customize these independently of accents.
@@ -100,8 +136,8 @@ These changes were introduced in 0.18:
100
136
  browser scripts and `client:*` islands cannot import Cookbook styling, Tasty,
101
137
  or Glaze. Attach interaction scripts to the static markup. Isolated,
102
138
  sandboxed `Preview` content is the
103
- documented exception. The new surface inventory is in the
104
- [theme reference](./theme-and-components.md).
139
+ documented exception. The new surface inventory is in
140
+ [Component styles](./component-styles.md).
105
141
  - **Page text:** the footer offers copy/download Markdown by default. Set
106
142
  `site.seo.copyPage: false` to disable the controls and generated page files.
107
143
  Configure static host headers if raw Markdown must be excluded from indexing;
package/docs/plugins.md CHANGED
@@ -91,8 +91,8 @@ available at `@tenphi/renderer/content` for renderer-only projects.
91
91
 
92
92
  Component overrides receive page data from `Astro.locals.cookbookRoute`,
93
93
  including the current entry, locale, navigation, table of contents, and head
94
- tags. See [theme and components](./theme-and-components.md) for Tasty styling
95
- and [configuration](./configuration.md) for structural overrides.
94
+ tags. See [Custom components](./custom-components.md) for Tasty styling and
95
+ [configuration](./configuration.md#components) for structural overrides.
96
96
 
97
97
  Use Astro's Markdown plugin APIs for content transforms, and Cookbook's graph
98
98
  and built-output checks for link validation. Extensions tied to another
@@ -27,7 +27,7 @@ Repository contributors can run these checks after `pnpm build`:
27
27
  | `pnpm check:theming` | Consumer components, colors, units, recipes, presets, overrides, and logos |
28
28
  | `pnpm check:fonts` | Real Google variable/italic fonts, local fonts, and offline cache rebuild |
29
29
  | `pnpm check:plugins` | Tested plugin contracts and actionable incompatibility failures |
30
- | `pnpm check:recipes` | Extract, type-check, build, and validate documented configurations verbatim |
30
+ | `pnpm check:recipes` | Public anatomy inventory and build-checked examples |
31
31
  | `pnpm check:authoring` | Custom highlighting, code groups, mobile contents, hero images, and OpenAPI |
32
32
  | `pnpm check:browser` | Chromium keyboard/focus, search, copy actions, appearance, mobile navigation, and axe checks |
33
33
  | `pnpm check:install` | Clean installation and build from packed artifacts, including lint/type exports |
package/docs/recipes.md CHANGED
@@ -7,8 +7,8 @@ These are complete `docs.config.ts` files. Start with a generated Cookbook
7
7
  project, keep its `astro.config` integration, and replace the documentation
8
8
  configuration with one recipe. Add the files listed above each example.
9
9
  [Working examples](./examples.md) covers repository and npm source layouts;
10
- [configuration](./configuration.md) and the [theme reference](./theme-and-components.md)
11
- cover every option.
10
+ [configuration](./configuration.md) lists the available fields, while the
11
+ [theme guide](./theme-and-components.md) explains the customization path.
12
12
 
13
13
  The repository's `pnpm check:recipes` extracts the marked examples below and in
14
14
  Working examples verbatim, type-checks them, builds actual consumer sites, and
@@ -38,7 +38,33 @@ export default defineDocsConfig({
38
38
 
39
39
  The header token also covers the mobile sidebar close control. Copy buttons and
40
40
  page navigation keep the base radius. Built-in element overrides merge into the
41
- complete defaults. See the [named style anatomy](./theme-and-components.md).
41
+ complete defaults. See the [named style anatomy](./component-styles.md).
42
+
43
+ ## Built-in component styles
44
+
45
+ Supply only the properties you want to change. Cookbook merges these partial
46
+ objects into the base style trees before extracting CSS. The example uses the
47
+ current named parts of the Appearance panel and search input:
48
+
49
+ ```ts cookbook-verify=component-styles
50
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
51
+
52
+ export default defineDocsConfig({
53
+ site: { title: "Acme docs" },
54
+ theme: {
55
+ brand: { from: "#315efb" },
56
+ styles: {
57
+ ThemeSelect: {
58
+ Trigger: { border: "#border-strong" },
59
+ Panel: { shadow: "0 1rem 3rem #shadow" },
60
+ },
61
+ SearchResults: { Input: { radius: "12px" } },
62
+ },
63
+ },
64
+ });
65
+ ```
66
+
67
+ Find all supported names in [Component styles](./component-styles.md).
42
68
 
43
69
  ## Local variable font
44
70
 
@@ -65,7 +91,7 @@ export default defineDocsConfig({
65
91
 
66
92
  For Google Fonts use `fonts: { body: "Inter", heading: "Newsreader" }` instead.
67
93
  Cookbook downloads and self-hosts the required weights and italics at build time.
68
- See [fonts](./theme-and-components.md#change-font-families) for caching,
94
+ See [fonts](./fonts-and-typography.md#change-font-families) for caching,
69
95
  explicit ranges, styles, and remote delivery.
70
96
 
71
97
  ## English and French