@tenphi/cookbook 0.15.0 → 0.17.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.
Files changed (46) hide show
  1. package/README.md +25 -0
  2. package/dist/config.d.ts +2 -2
  3. package/dist/index.d.ts +2 -2
  4. package/docs/ai-agents.md +61 -0
  5. package/docs/architecture.md +91 -0
  6. package/docs/authoring.mdx +86 -0
  7. package/docs/cli.md +88 -0
  8. package/docs/configuration.md +587 -0
  9. package/docs/content-sources.md +178 -0
  10. package/docs/customization-rules.md +154 -0
  11. package/docs/deployment.md +95 -0
  12. package/docs/examples.md +101 -0
  13. package/docs/getting-started.md +134 -0
  14. package/docs/index.md +74 -0
  15. package/docs/migration.md +36 -0
  16. package/docs/starlight-comparison.md +124 -0
  17. package/docs/theme-and-components.md +745 -0
  18. package/docs/upstream/glaze/LICENSE +21 -0
  19. package/docs/upstream/glaze/README.md +156 -0
  20. package/docs/upstream/glaze/docs/api.md +2021 -0
  21. package/docs/upstream/glaze/docs/methodology.md +686 -0
  22. package/docs/upstream/glaze/docs/migration.md +351 -0
  23. package/docs/upstream/glaze/docs/okhst.md +207 -0
  24. package/docs/upstream/manifest.json +18 -0
  25. package/docs/upstream/tasty/LICENSE +21 -0
  26. package/docs/upstream/tasty/README.md +685 -0
  27. package/docs/upstream/tasty/docs/README.md +39 -0
  28. package/docs/upstream/tasty/docs/adoption.md +323 -0
  29. package/docs/upstream/tasty/docs/ai-agents.md +229 -0
  30. package/docs/upstream/tasty/docs/comparison.md +448 -0
  31. package/docs/upstream/tasty/docs/configuration.md +823 -0
  32. package/docs/upstream/tasty/docs/debug.md +335 -0
  33. package/docs/upstream/tasty/docs/design-system.md +455 -0
  34. package/docs/upstream/tasty/docs/dsl.md +1021 -0
  35. package/docs/upstream/tasty/docs/getting-started.md +238 -0
  36. package/docs/upstream/tasty/docs/injector.md +634 -0
  37. package/docs/upstream/tasty/docs/methodology.md +648 -0
  38. package/docs/upstream/tasty/docs/migration-v3.md +285 -0
  39. package/docs/upstream/tasty/docs/pipeline.md +749 -0
  40. package/docs/upstream/tasty/docs/plugins.md +353 -0
  41. package/docs/upstream/tasty/docs/react-api.md +681 -0
  42. package/docs/upstream/tasty/docs/runtime-benchmarks.md +351 -0
  43. package/docs/upstream/tasty/docs/ssr.md +610 -0
  44. package/docs/upstream/tasty/docs/styles.md +677 -0
  45. package/docs/upstream/tasty/docs/tasty-static.md +582 -0
  46. package/package.json +12 -7
package/docs/index.md ADDED
@@ -0,0 +1,74 @@
1
+ ---
2
+ title: Cookbook
3
+ description: Build a polished static documentation site from the Markdown your project already owns.
4
+ template: splash
5
+ hero:
6
+ title: Documentation that stays with the code.
7
+ tagline: Turn repository Markdown or a locked npm package into a polished, searchable Astro site—without creating a second source of truth.
8
+ image:
9
+ html: '<svg xmlns="http://www.w3.org/2000/svg" width="240" height="240" 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>'
10
+ actions:
11
+ - text: Get started
12
+ link: /getting-started/
13
+ variant: primary
14
+ - text: See how it compares
15
+ link: /starlight-comparison/
16
+ variant: secondary
17
+ sidebar:
18
+ order: 1
19
+ ---
20
+ ## Keep documentation close to its source
21
+
22
+ Cookbook combines [Astro](https://astro.build) and
23
+ [Starlight](https://starlight.astro.build) with repository-aware content,
24
+ strict validation, local Pagefind search, and a theme powered by
25
+ [Tasty](./upstream/tasty/README.md) and [Glaze](./upstream/glaze/README.md).
26
+
27
+ ### Repository-native
28
+
29
+ Keep `README.md`, `docs/`, and local assets where they already live. Cookbook
30
+ transforms sources in memory and never rewrites them.
31
+
32
+ ### Package-first
33
+
34
+ Build a reproducible site from the files actually published to npm—without
35
+ cloning the package repository or running its lifecycle scripts.
36
+
37
+ ### Strict and static
38
+
39
+ Broken links, missing assets, duplicate routes, invalid navigation, and unsafe
40
+ paths fail with source locations. The result is prerendered HTML and CSS ready
41
+ for GitHub Pages or any static host.
42
+
43
+ ## Choose a path
44
+
45
+ Create a documentation project from a published npm package:
46
+
47
+ ```sh
48
+ npm create @tenphi/cookbook@latest my-package-docs -- --package your-package
49
+ ```
50
+
51
+ Or add the complete integration to an Astro project:
52
+
53
+ ```sh
54
+ npx astro add @tenphi/cookbook
55
+ ```
56
+
57
+ Continue with [Getting started](./getting-started.md), then learn how
58
+ [content sources](./content-sources.md) become routes.
59
+
60
+ ## See the product, not a mock-up
61
+
62
+ The pages you are reading live in this repository's root `docs/` directory.
63
+ The small Astro app under `apps/reference` points the integration at the
64
+ repository root, validates this content through the same graph-backed route
65
+ pipeline used by consumer sites, builds the site, and publishes the result to
66
+ GitHub Pages. There is no copied documentation tree.
67
+
68
+ This homepage also uses Cookbook's public `template: splash` and `hero`
69
+ frontmatter. The heading permalinks, code-copy controls, edit links, and Git
70
+ timestamps throughout the guide are the same capabilities available to every
71
+ Cookbook site.
72
+
73
+ See [Architecture](./architecture.md) for the package boundaries behind the
74
+ site.
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: Prerelease migration
3
+ description: Upgrade to the shared configuration, source identity, and typed customization APIs.
4
+ sidebar:
5
+ order: 9
6
+ ---
7
+
8
+ This prerelease intentionally tightens several contracts.
9
+
10
+ - Move generated inline documentation configuration to `docs.config.ts` and use
11
+ `cookbook()` in Astro. Existing explicit `cookbook({ config })` remains valid,
12
+ but CLI commands read the shared configuration file.
13
+ - For nested Astro apps, put `root: "../.."` in `docs.config.ts`; paths resolve
14
+ relative to that file. Individual sources may now specify `root` and `id`.
15
+ - Run `cookbook update` after changing a requested npm specifier. A lock for
16
+ another range or tag is no longer accepted by package name alone.
17
+ - `rawHtml: "sanitize"` preserves safe HTML and removes executable markup and
18
+ presentational attributes. Use `"strip"` for the former removal behavior;
19
+ removal now emits a diagnostic. `"reject"` still fails validation.
20
+ - Unrecognized page frontmatter is kept in graph entry `metadata`. Use
21
+ `content.frontmatter: "reject"` for the former strict behavior. Cookbook's
22
+ recognized fields retain their validation.
23
+ - `slug` is now relative to the source mount, including when it starts with `/`.
24
+ Use a separate source mount for an unrelated public route.
25
+ - Repeated files in separate source declarations create separate entries.
26
+ Give mounts stable IDs and use `source:<id>/<source-path>` for explicit links.
27
+ `entryBySource(path)` returns `undefined` for an ambiguous path; pass a source
28
+ ID as its second argument. Graph entry IDs include the source ID.
29
+ - Unknown names in `theme.styles` are errors. Register user-authored component
30
+ styles in `theme.customStyles`. Built-in component names and sub-elements
31
+ provide strict editor checking; style objects still contain only overrides.
32
+ - `Tabs` now expects `Tab` children with accessible labels. It provides keyboard
33
+ navigation and panels; use an ordinary custom component for a grouping layout.
34
+
35
+ See [authoring](./authoring.mdx) for the new components and [working
36
+ examples](./examples.md) for complete configuration patterns.
@@ -0,0 +1,124 @@
1
+ ---
2
+ title: Cookbook and Starlight
3
+ description: Understand which Starlight authoring conventions Cookbook preserves and where its repository and theme model differs.
4
+ sidebar:
5
+ order: 5
6
+ ---
7
+ Cookbook uses [Astro Starlight](https://starlight.astro.build/) as its
8
+ documentation shell. It keeps familiar page-authoring conventions while adding
9
+ repository and npm content sources, stricter validation, and a Tasty/Glaze
10
+ theme model.
11
+
12
+ ## Cookbook or Starlight?
13
+
14
+ Start with the place where the documentation must live. Starlight is a strong
15
+ choice when an Astro site owns its content. Cookbook is designed for projects
16
+ where the repository Markdown—or the documentation actually published in an
17
+ npm package—must remain the source of truth.
18
+
19
+ | Concern | Starlight | Cookbook |
20
+ | ----------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21
+ | Starting point | Add Starlight to an Astro project and author its documentation content collection. | Add one integration to an Astro project, or generate a complete site directly from a published npm package. |
22
+ | Content ownership | The documentation site conventionally owns its Markdown under `src/content/docs/`. | Reads `README.md`, repository `docs/` trees, files outside the Astro app, and selected files from npm artifacts without copying or rewriting them. |
23
+ | Reproducible releases | Follows the dependencies and content committed with the site. | Can lock an npm package to its exact resolved version and integrity, then rebuild from the files users actually receive. |
24
+ | Build guarantees | Provides Starlight's content schema and Astro build pipeline. | Adds strict checks for duplicate routes, broken links, missing assets, unsafe paths, and invalid navigation with source-aware diagnostics. |
25
+ | Design system | Supports CSS variables, custom CSS, and component overrides. | Exposes the full [Tasty styling DSL](./upstream/tasty/docs/dsl.md) through configuration, with Glaze-generated semantic colors and named style trees for Cookbook and shell surfaces. |
26
+ | Familiar authoring | Defines the Starlight page, navigation, i18n, and frontmatter conventions. | Preserves those conventions—including splash pages, locales, edit links, and last-updated metadata—while resolving them against each original source. |
27
+ | Structural escape hatch | Replaces Starlight components when markup or behavior must change. | Supports Astro component overrides for structural changes; visual changes normally stay in typed `theme` configuration. |
28
+
29
+ Choose Starlight when the documentation site is the natural home for the
30
+ content and its CSS-oriented customization model fits the project. Choose
31
+ Cookbook when documentation must stay beside the code, match a published
32
+ package, fail strictly when references drift, or expose a reusable design
33
+ system entirely through configuration.
34
+
35
+ ## Customize with Tasty's DSL
36
+
37
+ Cookbook customization is not limited to replacing token values. Every entry
38
+ under `theme.styles` is a partial Tasty style object that Cookbook merges into
39
+ the component's base style tree. That gives configuration access to the same
40
+ responsive values, state maps, calculations, semantic tokens, typography
41
+ presets, and named sub-elements used by Cookbook itself:
42
+
43
+ ```ts
44
+ export default defineDocsConfig({
45
+ theme: {
46
+ states: {
47
+ "@touch": "@media(pointer: coarse)",
48
+ },
49
+ styles: {
50
+ MarkdownCodeBlock: {
51
+ Pre: {
52
+ padding: {
53
+ "": "2x 4x",
54
+ "@mobile": "1.5x 3x",
55
+ },
56
+ radius: "$card-radius",
57
+ },
58
+ CopyButton: {
59
+ inlineSize: {
60
+ "": "2rem",
61
+ "@touch": "2.5rem",
62
+ },
63
+ scale: {
64
+ "": "1",
65
+ ":active": "0.94",
66
+ },
67
+ },
68
+ },
69
+ },
70
+ },
71
+ });
72
+ ```
73
+
74
+ The user supplies only overrides; the merge happens inside Cookbook. See
75
+ [Theme and components](./theme-and-components.md#style-customization) for the
76
+ complete component and sub-element inventory, and the
77
+ [Tasty documentation](./upstream/tasty/docs/README.md) for the DSL's properties and
78
+ conditional syntax. Structural Astro overrides remain available when a change
79
+ requires different markup or behavior rather than styling.
80
+
81
+ ## Configure the shared capabilities
82
+
83
+ ```ts
84
+ export default defineDocsConfig({
85
+ editLink: {
86
+ baseUrl: "https://github.com/example/project/edit/main/",
87
+ },
88
+ lastUpdated: true,
89
+ locales: {
90
+ root: { label: "English", lang: "en" },
91
+ fr: { label: "Français", lang: "fr" },
92
+ },
93
+ defaultLocale: "root",
94
+ });
95
+ ```
96
+
97
+ The keys deliberately match Starlight so an existing Starlight author does not
98
+ need to relearn page metadata or i18n. Cookbook resolves edit and Git metadata
99
+ before handing each page to Starlight because its source may live in a root
100
+ `docs/` directory, outside the Astro app, or inside a locked npm artifact.
101
+
102
+ ## Create a splash page
103
+
104
+ ```yaml
105
+ ---
106
+ title: Example
107
+ template: splash
108
+ hero:
109
+ title: Build something clear.
110
+ tagline: A short explanation of the value your project provides.
111
+ actions:
112
+ - text: Get started
113
+ link: /getting-started/
114
+ variant: primary
115
+ - text: View API
116
+ link: /reference/
117
+ variant: secondary
118
+ ---
119
+ ```
120
+
121
+ Use `template: doc` (the default) for conventional reference pages. See
122
+ Starlight's [page guide](https://starlight.astro.build/guides/pages/) for the
123
+ authoring model Cookbook builds on, then use [Theme and
124
+ components](./theme-and-components.md) for Cookbook-specific styling.