hd-garden 0.8.0 → 0.8.2

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 (187) hide show
  1. package/.agents/skills/garden-ui/SKILL.md +2 -2
  2. package/.env.en.example +67 -0
  3. package/README.en.md +2 -2
  4. package/README.md +2 -2
  5. package/app/a2/[slug]/page.tsx +4 -3
  6. package/app/a2/page.tsx +4 -3
  7. package/app/about/page.tsx +8 -9
  8. package/app/admin/page.tsx +7 -6
  9. package/app/admin/preview/[...path]/page.tsx +2 -1
  10. package/app/admin/ui/blocks/page.tsx +2 -1
  11. package/app/admin/ui/catalog/page.tsx +2 -1
  12. package/app/admin/ui/evals/page.tsx +2 -1
  13. package/app/admin/ui/page.tsx +2 -1
  14. package/app/blog/[...path]/page.tsx +7 -6
  15. package/app/blog/page.tsx +4 -2
  16. package/app/columns/[column]/[...path]/page.tsx +8 -7
  17. package/app/columns/page.tsx +12 -8
  18. package/app/components/AdminUiShell.tsx +4 -3
  19. package/app/components/ArticleMeasure.tsx +6 -3
  20. package/app/components/ArticleReferences.tsx +4 -1
  21. package/app/components/ArticleTags.tsx +3 -2
  22. package/app/components/BlogArchive.tsx +20 -16
  23. package/app/components/Comments.tsx +16 -10
  24. package/app/components/ContentEmptyState.tsx +29 -28
  25. package/app/components/ExternalEmbed.tsx +15 -14
  26. package/app/components/GardenContentGuide.tsx +10 -2
  27. package/app/components/GardenDocsNav.tsx +4 -2
  28. package/app/components/GiscusComments.tsx +2 -1
  29. package/app/components/GithubLiveOverview.tsx +10 -8
  30. package/app/components/GithubProfile.tsx +31 -21
  31. package/app/components/HandbookLangSwitch.tsx +8 -4
  32. package/app/components/HandbookView.tsx +92 -9
  33. package/app/components/MarkdownArticle.tsx +31 -7
  34. package/app/components/MermaidDiagram.tsx +4 -3
  35. package/app/components/SiteChrome.tsx +3 -3
  36. package/app/components/SiteFooter.tsx +1 -1
  37. package/app/components/SiteHeader.tsx +13 -4
  38. package/app/components/ThoughtCard.tsx +16 -14
  39. package/app/components/UiBlock.tsx +3 -2
  40. package/app/components/Webmentions.tsx +11 -11
  41. package/app/components/WidgetChart.tsx +8 -6
  42. package/app/components/garden/FilePreview.tsx +2 -2
  43. package/app/components/garden/GardenBlock.tsx +7 -0
  44. package/app/components/garden/GardenFile.tsx +2 -2
  45. package/app/components/garden/RefDemo.tsx +62 -0
  46. package/app/components/garden/blocks.tsx +56 -8
  47. package/app/components/garden/patterns.tsx +497 -0
  48. package/app/garden/[...slug]/page.tsx +3 -2
  49. package/app/garden/en/page.tsx +7 -7
  50. package/app/garden/page.tsx +3 -2
  51. package/app/globals.css +49 -1
  52. package/app/lib/a2-meta.ts +26 -3
  53. package/app/lib/content.ts +2 -2
  54. package/app/lib/garden-docs-meta.ts +24 -0
  55. package/app/lib/github-id.mjs +8 -0
  56. package/app/lib/handbook-switch.mjs +12 -0
  57. package/app/lib/i18n.ts +401 -2
  58. package/app/lib/rehype-field-tables.mjs +47 -0
  59. package/app/lib/remark-a2.mjs +18 -8
  60. package/app/lib/remark-link-card.mjs +22 -0
  61. package/app/lib/remark-ref-demos.mjs +42 -0
  62. package/app/lib/tag-filter.ts +9 -2
  63. package/app/not-found.tsx +32 -4
  64. package/app/page.tsx +17 -14
  65. package/app/rss.xml/route.ts +2 -1
  66. package/app/styles/a2.css +338 -0
  67. package/app/styles/shell.css +15 -2
  68. package/app/tags/page.tsx +7 -5
  69. package/app/thoughts/[slug]/page.tsx +2 -1
  70. package/app/thoughts/page/[n]/page.tsx +1 -1
  71. package/app/thoughts/page.tsx +2 -1
  72. package/app/ui-parity/page.tsx +38 -22
  73. package/bin/garden.mjs +129 -19
  74. package/docs/handbook/ai-writing.md +2 -2
  75. package/docs/handbook/assets/reading-layout-en.svg +26 -0
  76. package/docs/handbook/components/card.md +43 -22
  77. package/docs/handbook/components/chart.md +10 -26
  78. package/docs/handbook/components/choice.md +42 -0
  79. package/docs/handbook/components/compare.md +32 -17
  80. package/docs/handbook/components/figure.md +33 -46
  81. package/docs/handbook/components/file.md +10 -15
  82. package/docs/handbook/components/html.md +10 -30
  83. package/docs/handbook/components/interactive.md +9 -35
  84. package/docs/handbook/components/list.md +65 -0
  85. package/docs/handbook/components/relations.md +95 -0
  86. package/docs/handbook/components/stat.md +10 -28
  87. package/docs/handbook/components/timeline.md +13 -28
  88. package/docs/handbook/components.md +210 -19
  89. package/docs/handbook/config.md +5 -3
  90. package/docs/handbook/deploy.md +1 -1
  91. package/docs/handbook/design.md +20 -12
  92. package/docs/handbook/en/ai-writing.md +2 -2
  93. package/docs/handbook/en/components/card.md +42 -21
  94. package/docs/handbook/en/components/chart.md +10 -26
  95. package/docs/handbook/en/components/choice.md +42 -0
  96. package/docs/handbook/en/components/compare.md +30 -15
  97. package/docs/handbook/en/components/figure.md +29 -42
  98. package/docs/handbook/en/components/file.md +9 -14
  99. package/docs/handbook/en/components/html.md +9 -29
  100. package/docs/handbook/en/components/interactive.md +8 -34
  101. package/docs/handbook/en/components/list.md +65 -0
  102. package/docs/handbook/en/components/relations.md +95 -0
  103. package/docs/handbook/en/components/stat.md +9 -27
  104. package/docs/handbook/en/components/timeline.md +9 -24
  105. package/docs/handbook/en/components.md +211 -19
  106. package/docs/handbook/en/config.md +32 -30
  107. package/docs/handbook/en/deploy.md +12 -12
  108. package/docs/handbook/en/design.md +19 -12
  109. package/docs/handbook/en/index.md +2 -2
  110. package/docs/handbook/en/reference/card.md +85 -0
  111. package/docs/handbook/en/reference/chart.md +68 -0
  112. package/docs/handbook/en/reference/choice.md +69 -0
  113. package/docs/handbook/en/reference/compare.md +59 -0
  114. package/docs/handbook/en/reference/figure.md +84 -0
  115. package/docs/handbook/en/reference/file/checklist.md +17 -0
  116. package/docs/handbook/en/reference/file.md +50 -0
  117. package/docs/handbook/en/reference/html.md +62 -0
  118. package/docs/handbook/en/reference/interactive.md +71 -0
  119. package/docs/handbook/en/reference/list.md +72 -0
  120. package/docs/handbook/en/reference/relations.md +113 -0
  121. package/docs/handbook/en/reference/stat.md +60 -0
  122. package/docs/handbook/en/reference/timeline.md +56 -0
  123. package/docs/handbook/en/reference.md +26 -0
  124. package/docs/handbook/en/start.md +2 -2
  125. package/docs/handbook/en/workflow.md +6 -5
  126. package/docs/handbook/en/writing.md +3 -2
  127. package/docs/handbook/index.md +1 -1
  128. package/docs/handbook/reference/card.md +85 -0
  129. package/docs/handbook/reference/chart.md +68 -0
  130. package/docs/handbook/reference/choice.md +69 -0
  131. package/docs/handbook/reference/compare.md +59 -0
  132. package/docs/handbook/reference/figure.md +84 -0
  133. package/docs/handbook/reference/file/checklist.md +17 -0
  134. package/docs/handbook/reference/file.md +50 -0
  135. package/docs/handbook/reference/html.md +62 -0
  136. package/docs/handbook/reference/interactive.md +71 -0
  137. package/docs/handbook/reference/list.md +72 -0
  138. package/docs/handbook/reference/relations.md +113 -0
  139. package/docs/handbook/reference/stat.md +60 -0
  140. package/docs/handbook/reference/timeline.md +56 -0
  141. package/docs/handbook/reference.md +26 -0
  142. package/docs/handbook/start.md +1 -1
  143. package/docs/handbook/workflow.md +6 -5
  144. package/docs/handbook/writing.md +3 -2
  145. package/next.config.ts +6 -0
  146. package/package.json +2 -1
  147. package/public/images/garden/ref-card-book.svg +1 -0
  148. package/public/images/garden/ref-card-lamp.svg +1 -0
  149. package/scripts/build-content.mjs +37 -16
  150. package/scripts/favicon-ico.mjs +9 -6
  151. package/scripts/file-preview.mjs +10 -7
  152. package/scripts/handbook-allowlist.mjs +18 -0
  153. package/scripts/handbook-facts.mjs +305 -11
  154. package/scripts/link-assets.mjs +7 -0
  155. package/scripts/new-post.mjs +18 -9
  156. package/scripts/prepare-pages-output.mjs +30 -18
  157. package/scripts/redirects.mjs +17 -6
  158. package/templates/garden-blocks.md +67 -0
  159. package/templates/garden-snippets.plist +61 -0
  160. package/templates/site/Makefile.en +45 -0
  161. package/templates/site/README.en.md +15 -0
  162. package/templates/site/site.config.en.yaml +55 -0
  163. package/templates/skills-en/garden-interactive-chart/SKILL.md +84 -0
  164. package/templates/skills-en/garden-interactive-chart/references/shell.html +49 -0
  165. package/templates/skills-en/garden-interactive-chart/references/style.md +61 -0
  166. package/templates/skills-en/garden-post-review/SKILL.md +63 -0
  167. package/templates/skills-en/garden-ui/SKILL.md +118 -0
  168. package/templates/workflows/pages.en.yml +195 -0
  169. package/templates/workflows/pages.yml +195 -0
  170. package/ui/garden/catalog.mjs +205 -4
  171. package/ui/garden/check.mjs +6 -0
  172. package/ui/garden/file-block.mjs +8 -7
  173. package/ui/garden/html-lang.mjs +73 -1
  174. package/ui/garden/markdown-links.mjs +7 -4
  175. package/ui/garden/parse.mjs +45 -0
  176. package/ui/garden/relations.mjs +252 -0
  177. package/ui/garden/search-index.mjs +6 -4
  178. package/ui/garden/source-icon.mjs +54 -0
  179. package/ui/parity-fixtures.mjs +77 -0
  180. package/ui/preview/dist/garden-ui.esm.js +41 -4
  181. package/ui/preview/dist/garden-ui.iife.js +41 -4
  182. package/ui/prompt/rules.md +28 -1
  183. package/ui/react/components/chart.tsx +1 -1
  184. package/ui/react/components/display.tsx +1 -1
  185. package/ui/react/lang.tsx +4 -0
  186. package/ui/react/parity.tsx +8 -6
  187. package/worker/index.ts +8 -2
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: Component reference · choice
3
+ navTitle: choice
4
+ description: Present two or three option cards with an icon, headline value, and preference label, plus an optional fallback button and selection reply.
5
+ section: reference
6
+ order: 12
7
+ badge: choice
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: choice](/garden/en/components/choice)
11
+
12
+ ## Examples
13
+
14
+ ```garden choice
15
+ title: Where should we meet next month?
16
+ items:
17
+ - icon: idea
18
+ value: $6 each
19
+ text: Corner café, one drink included
20
+ label: Prefer the atmosphere
21
+ reply: Café it is. We will book the long table by the window.
22
+ - icon: book
23
+ value: Free
24
+ text: Library meeting room, booking needed
25
+ label: Prefer the quiet
26
+ reply: Library it is. We will book the room at the start of the month.
27
+ none:
28
+ label: Neither / not sure
29
+ reply: No problem. We will share a few more venues in the group chat.
30
+ caption: Illustrative only. Venues and prices are made up.
31
+ ```
32
+
33
+ ## Syntax
34
+
35
+ ````markdown
36
+ ```garden choice
37
+ title: # optional, question
38
+ items: # required, 2–3 suggested
39
+ - icon: # optional, one of 23 icons
40
+ value: # recommended, big value
41
+ text: # recommended, short note
42
+ label: # optional, preference tag
43
+ reply: # optional, reply
44
+ none: # optional, fallback button
45
+ label: # button text
46
+ reply: # optional, reply
47
+ caption: # optional, caption
48
+ ```
49
+ ````
50
+
51
+ ## Fields
52
+
53
+ Fence header: ` ```garden choice ` (snippet trigger `;gchoice`). Renders as an accessible `role="radiogroup"` with arrow-key navigation; cards sit side by side on desktop and stack vertically in a single column on narrow screens. Invalid YAML or unknown top-level keys report `garden-yaml` on the block.
54
+
55
+ | Field | Required | Default | Allowed Values & Limits | Description |
56
+ | :--- | :--- | :--- | :--- | :--- |
57
+ | `title` | Optional | `""` | string | Question or heading above the option cards |
58
+ | `items` | Required | `[]` | object[] (`2` to `3` items recommended, not checked) | Option cards |
59
+ | `items[].icon` | Optional | none (draws no icon) | one of the 23 built-in icon names | Line icon at the top of the card (shares the same 23 icon names as `garden list`) |
60
+ | `items[].value` | Recommended | none | string or number | Prominent price, figure, or short headline on the card |
61
+ | `items[].text` | Recommended | none | string | One-sentence description of the option |
62
+ | `items[].label` | Optional | none | string | Preference tag with a dot indicator at the bottom of the card |
63
+ | `items[].reply` | Optional | `""` | string | Response shown below the group when this card is selected |
64
+ | `none` | Optional | none | `{ label: string, reply?: string }` | Full-width single-line fallback button underneath the cards (such as `"Neither / not sure"`) and its selection reply |
65
+ | `caption` | Optional | none | string | Caption below the component |
66
+
67
+ ## Limits & errors
68
+
69
+ - Apart from the shared `garden-yaml`, this component has no error codes of its own; values marked "not checked" in the table never report an error.
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: Component reference · compare
3
+ navTitle: compare
4
+ description: Place two or three options side by side to contrast tradeoffs, or stack good and bad practices.
5
+ section: reference
6
+ order: 3
7
+ badge: compare
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: compare](/garden/en/components/compare)
11
+
12
+ ## Examples
13
+
14
+ ```garden compare
15
+ items:
16
+ - title: Describe the change in one sentence
17
+ text: Idea block under full code; garden-ui writes the diff.
18
+ - title: Write the diff by hand
19
+ text: Place a diff below full code; alone it raises diff-orphan.
20
+ ```
21
+
22
+ ```garden compare
23
+ items:
24
+ - title: A poor question
25
+ verdict: bad
26
+ text: "“Have you read this author's other books? Could you share a review?”"
27
+ - title: A better question
28
+ verdict: good
29
+ text: "“When do you usually read? Would you like to sit in once first?”"
30
+ ```
31
+
32
+ ## Syntax
33
+
34
+ ````markdown
35
+ ```garden compare
36
+ items: # required, 2–3 items
37
+ - title: # option name
38
+ text: # description
39
+ verdict: # optional, good | bad
40
+ <key>: # optional, as a tag
41
+ ```
42
+ ````
43
+
44
+ ## Fields
45
+
46
+ Fence header: ` ```garden compare ` (snippet trigger `;gcompare`). Invalid YAML or unknown top-level keys report `garden-yaml` on the block.
47
+
48
+ | Field | Required | Default | Allowed Values & Limits | Description |
49
+ | :--- | :--- | :--- | :--- | :--- |
50
+ | `items` | Required | `[]` | array (at least `2` items and `2` to `3` in side-by-side mode recommended, not checked) | Options to compare; each entry can be an object or a single `"Title: description"` string |
51
+ | `items[].title` | Recommended | `""` (text before `:` in single-line string form) | string | Item heading |
52
+ | `items[].text` | Recommended | `[]` | string or string[]; in side-by-side mode, combined `text` and extra string fields per cell must be at most `60` characters (exceeding this reports `compare-long`) | Item description; in single-line `"Title: description"` form only the text after `:` counts toward the `60`-character limit |
53
+ | `items[].verdict` | Optional | none (side-by-side layout) | `"good"` \| `"bad"` | Marks the item as a recommended practice (green check) or anti-pattern (red cross); when any item has `verdict`, items stack vertically and the `60`-character `compare-long` limit does not apply |
54
+ | `items[].<customKey>` | Optional | none | string or number (in side-by-side mode, string values count toward the `60`-character cell limit and report `compare-long` if exceeded) | In side-by-side mode, extra key-value pairs render as attribute tags at the bottom of the card |
55
+
56
+ ## Limits & errors
57
+
58
+ - `compare-long`: in side-by-side mode, one cell's `text` plus its other string fields runs past 60 characters. Move that cell back into a list or paragraph.
59
+ - When any item has `verdict: good | bad`, the group stacks vertically and the 60-character check is skipped.
@@ -0,0 +1,84 @@
1
+ ---
2
+ title: Component reference · figure
3
+ navTitle: figure
4
+ description: Pair an SVG diagram with step buttons that highlight each region and show its explanation.
5
+ section: reference
6
+ order: 6
7
+ badge: figure
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: figure](/garden/en/components/figure)
11
+
12
+ ## Examples
13
+
14
+ ```garden figure
15
+ caption: Click the buttons above to highlight each stage
16
+ svg: |
17
+ <svg viewBox="0 0 560 194" xmlns="http://www.w3.org/2000/svg" font-family="var(--sans)" style="max-width: 380px; margin-inline: auto">
18
+ <rect data-p="sync" x="2" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
19
+ <text data-p="sync" x="92" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">1. garden</text>
20
+ <text data-p="sync" x="92" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">sync</text>
21
+ <text data-p="sync" x="92" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">Parse</text>
22
+ <text data-p="sync" x="92" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">Markdown &amp;</text>
23
+ <text data-p="sync" x="92" y="166" text-anchor="middle" font-size="24" fill="var(--muted)">image sizes</text>
24
+ <path d="M183.5 97 H188.5" stroke="var(--muted)" stroke-width="2.5"/>
25
+ <rect data-p="build" x="190" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
26
+ <text data-p="build" x="280" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">2. garden</text>
27
+ <text data-p="build" x="280" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">build</text>
28
+ <text data-p="build" x="280" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">Build static</text>
29
+ <text data-p="build" x="280" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">pages &amp; index</text>
30
+ <path d="M371.5 97 H376.5" stroke="var(--muted)" stroke-width="2.5"/>
31
+ <rect data-p="validate" x="378" y="4" width="180" height="186" rx="16" fill="var(--card)" stroke="var(--rule-strong)" stroke-width="2.5"/>
32
+ <text data-p="validate" x="468" y="42" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">3. pages:</text>
33
+ <text data-p="validate" x="468" y="72" text-anchor="middle" font-size="24" font-weight="600" fill="var(--ink)">validate</text>
34
+ <text data-p="validate" x="468" y="108" text-anchor="middle" font-size="24" fill="var(--muted)">Check</text>
35
+ <text data-p="validate" x="468" y="137" text-anchor="middle" font-size="24" fill="var(--muted)">index.html &amp;</text>
36
+ <text data-p="validate" x="468" y="166" text-anchor="middle" font-size="24" fill="var(--muted)">files</text>
37
+ </svg>
38
+ parts:
39
+ - id: sync
40
+ label: 1. Sync Content
41
+ text: Scans `content/` and `docs/handbook/`, copies sidecar assets, and generates `.garden/generated-content.ts`.
42
+ - id: build
43
+ label: 2. Build Pages
44
+ text: Prerenders all routes with `STATIC_EXPORT=1` and outputs RSS, sitemap, and full-text search indexes.
45
+ - id: validate
46
+ label: 3. Validate Export
47
+ text: Runs pages:validate to confirm `index.html` exists and no `.env`, source directories, `.map` or `.md` files, or symlinks are present.
48
+ ```
49
+
50
+ ## Syntax
51
+
52
+ ````markdown
53
+ ```garden figure
54
+ svg: | # one of three, inline SVG
55
+ image: # one of three, image path
56
+ mermaid: | # one of three, Mermaid
57
+ alt: # optional, alt text
58
+ parts: # optional, buttons
59
+ - id: # matches data-p
60
+ label: # required, button (or name)
61
+ text: # required, description
62
+ caption: # optional, caption
63
+ ```
64
+ ````
65
+
66
+ ## Fields
67
+
68
+ Fence header: ` ```garden figure ` (snippet trigger `;gfigure`). Invalid YAML or unknown top-level keys report `garden-yaml` on the block.
69
+
70
+ | Field | Required | Default | Allowed Values & Limits | Description |
71
+ | :--- | :--- | :--- | :--- | :--- |
72
+ | `svg` | One of `svg`, `image`, or `mermaid` | `<svg>` body below `---` or `""` | multiline `<svg>` string | Inline SVG markup; tag elements to highlight with `data-p="<id>"` (use CSS variables such as `var(--card)`, `var(--ink)`, and `var(--muted)` so dark mode works) |
73
+ | `image` | One of `image`, `svg`, or `mermaid` | none | path string | Path to a static diagram image |
74
+ | `alt` | Optional | `caption` (then `""`) | string | Alt text for `image` |
75
+ | `mermaid` | One of `mermaid`, `svg`, or `image` | none | multiline string | Mermaid diagram source |
76
+ | `parts` | Optional | `[]` (initial selection defaults to `parts[0].id` or `"all"`) | object[] | Interactive buttons above the diagram and matching explanations below |
77
+ | `parts[].id` | Recommended | `parts[].name` or `parts[].label` | string | Matches `data-p` on SVG elements (an id of `"all"` highlights every region) |
78
+ | `parts[].label` | Required (or `name`) | `"Part N"` (1-based) | string | Button label |
79
+ | `parts[].text` | Required | `""` | string | Explanation shown below the diagram when the button is active |
80
+ | `caption` | Optional | none | string | Caption below the frame |
81
+
82
+ ## Limits & errors
83
+
84
+ - Apart from the shared `garden-yaml`, this component has no error codes of its own; values marked "not checked" in the table never report an error.
@@ -0,0 +1,17 @@
1
+ # Site Pre-publish Checklist
2
+
3
+ Before running `make update` to push changes, verify the following items:
4
+
5
+ ## 1. Post Front Matter and Paths
6
+
7
+ - [x] `title`, `date`, and `description` are filled in, and the filename uses only lowercase letters, digits, and hyphens
8
+ - [x] Local images and attachments live in the post's sidecar folder and use `./<slug>/file.ext` relative paths
9
+ - [x] `draft: true` has been removed from posts ready to publish
10
+
11
+ ## 2. Local Validation Commands
12
+
13
+ | Command | What It Checks |
14
+ | :--- | :--- |
15
+ | `npx garden check content/posts/<slug>.md` | Checks a single post's component fields, code diffs, and local asset paths |
16
+ | `make check` | Runs `npx garden sync && npx garden build` to validate the full site build |
17
+ | `CONTENT_INCLUDE_DRAFTS=1 make dev` | Previews drafts and scheduled posts locally |
@@ -0,0 +1,50 @@
1
+ ---
2
+ title: Component reference · file
3
+ navTitle: file
4
+ description: Attach one or more files with automatic format and size badges, download links, and inline preview.
5
+ section: reference
6
+ order: 9
7
+ badge: file
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: file](/garden/en/components/file)
11
+
12
+ ## Examples
13
+
14
+ ```garden file
15
+ src: ./file/checklist.md
16
+ title: Pre-publish Checklist
17
+ note: Sample Markdown attachment; click Preview to read inline or Download to save the file
18
+ ```
19
+
20
+ ## Syntax
21
+
22
+ ````markdown
23
+ ```garden file
24
+ src: # required for one file
25
+ title: # optional, title
26
+ note: # optional, short note
27
+ files: # required for a group
28
+ - src: # required, path
29
+ title: # optional, file name
30
+ note: # optional, note
31
+ ```
32
+ ````
33
+
34
+ ## Fields
35
+
36
+ Fence header: ` ```garden file ` (snippet trigger `;gfile`). Use top-level `src` for a single file, or `files` for multiple attachments; invalid YAML or unknown top-level keys report `garden-yaml` on the block.
37
+
38
+ | Field | Required | Default | Allowed Values & Limits | Description |
39
+ | :--- | :--- | :--- | :--- | :--- |
40
+ | `src` | Required for single file | none | relative path, `/public` path, or `https://` URL; missing `src` or combining `src` with `files` reports `garden-file`, local paths outside `content/` report `file-outside`, missing local files report `missing-asset`, and a local file over `5 MB` reports a `file-large` warning | Attachment path |
41
+ | `title` | Optional | decoded filename from `src` (single file) or `""` (multi-file) | string | Display title for a single file, or group heading when using `files` |
42
+ | `note` | Optional | `""` | string (combining top-level `note` with `files` reports `garden-file`) | Short note shown below the filename in single-file mode |
43
+ | `files` | Required for multi-file | none | `{ src, title?, note? }[]` (at least `1` item; empty array, non-array, combining with top-level `src`/`note`, item missing `src`, unknown item keys, or hand-writing `resolved` reports `garden-file`) | List of attachments, each requiring `src` with optional `title` (defaults to filename) and `note` (defaults to `""`) |
44
+
45
+ ## Limits & errors
46
+
47
+ - `garden-file`: neither `src` nor `files`; `files` empty or not a list; `files` together with a top-level `src` / `note`; an entry without `src` or with unknown keys; a hand-written `resolved`.
48
+ - `file-outside`: a local path leaves the `content/` folder.
49
+ - `missing-asset`: the local file does not exist.
50
+ - `file-large` (warning): a single file is over 5 MB.
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: Component reference · html
3
+ navTitle: html
4
+ description: Run a self-contained HTML, CSS, and JavaScript demo inside a sandboxed iframe.
5
+ section: reference
6
+ order: 7
7
+ badge: html
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: html](/garden/en/components/html)
11
+
12
+ ## Examples
13
+
14
+ ```garden html
15
+ title: Character Count Widget
16
+ code: |
17
+ <!doctype html>
18
+ <html lang="en">
19
+ <head>
20
+ <meta charset="utf-8" />
21
+ <style>
22
+ body { margin: 0; padding: 16px 18px; font: 14px/1.6 system-ui, sans-serif; color: #1b1a18; background: #faf9f5; }
23
+ input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d5d1c8; border-radius: 6px; font: inherit; background: #fff; color: #1b1a18; }
24
+ .meta { margin-top: 10px; color: #6e6b64; font-variant-numeric: tabular-nums; }
25
+ strong { color: #1b1a18; }
26
+ </style>
27
+ </head>
28
+ <body>
29
+ <input id="txt" value="Keep your posts in a Git repository and push to deploy." aria-label="Sample text input" />
30
+ <div class="meta">Characters: <strong id="count">55</strong></div>
31
+ <script>
32
+ const input = document.getElementById("txt");
33
+ const count = document.getElementById("count");
34
+ input.addEventListener("input", () => { count.textContent = String(input.value.length); });
35
+ </script>
36
+ </body>
37
+ </html>
38
+ ```
39
+
40
+ ## Syntax
41
+
42
+ ````markdown
43
+ ```garden html
44
+ src: # either this or code, path
45
+ code: | # either this or src, HTML
46
+ title: # recommended, frame title
47
+ ```
48
+ ````
49
+
50
+ ## Fields
51
+
52
+ Fence header: ` ```garden html ` (snippet trigger `;ghtml`). Invalid YAML or unknown top-level keys report `garden-yaml` on the block.
53
+
54
+ | Field | Required | Default | Allowed Values & Limits | Description |
55
+ | :--- | :--- | :--- | :--- | :--- |
56
+ | `src` | Either `src` or `code` | none | relative path (e.g. `./demo.html`) | Path to a standalone `.html` file inside the post's sidecar directory |
57
+ | `code` | Either `code` or `src` | HTML body below `---` or `""` | multiline HTML string | Inline HTML markup (runs inside a sandboxed `iframe` and resizes to fit its content when `<script>` is present; HTML can also be placed below a `---` separator) |
58
+ | `title` | Recommended | `"HTML"` | string | Frame header title and accessible `iframe` title |
59
+
60
+ ## Limits & errors
61
+
62
+ - Apart from the shared `garden-yaml`, this component has no error codes of its own; values marked "not checked" in the table never report an error.
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: Component reference · interactive
3
+ navTitle: interactive
4
+ description: Let readers drag sliders or switches to recalculate formulas and charts in real time.
5
+ section: reference
6
+ order: 8
7
+ badge: interactive
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: interactive](/garden/en/components/interactive)
11
+
12
+ ## Examples
13
+
14
+ ```garden interactive #reading-time
15
+ caption: "Example: estimate reading time from word count, reading speed, and image count. Numbers are illustrative only."
16
+ ---
17
+ <State words={6000} speed={400} images={8} />
18
+ <Let textMinutes={round(words / speed)} />
19
+ <Let imageMinutes={round(images * 12 / 60)} />
20
+ <Let parts={[{ part: "Prose", minutes: textMinutes }, { part: "Images", minutes: imageMinutes }]} />
21
+
22
+ <Slider bind="words" label="Word count" min={1000} max={20000} step={500} unit="words" />
23
+ <Slider bind="speed" label="Reading speed" min={200} max={800} step={50} unit="wpm" />
24
+ <Slider bind="images" label="Image count" min={0} max={30} step={1} unit="images" />
25
+
26
+ <Stat label="Example: estimated reading time" value={textMinutes + imageMinutes} unit="min" hint="Counting 12 seconds per image" />
27
+ <Chart data={parts} x={part} yLabel="min">
28
+ <Bar y={minutes} label="Example" />
29
+ </Chart>
30
+ ```
31
+
32
+ ## Syntax
33
+
34
+ ````markdown
35
+ ```garden interactive #<id>
36
+ caption: # required, default reading
37
+ intent: | # optional, original idea
38
+ expect: # optional, assertions
39
+ --- # tags go below
40
+ <State ... /> # required, state
41
+ <Let ... /> # optional, derived values
42
+ <Slider bind="..." /> # input control
43
+ <Stat ... /> # output
44
+ ```
45
+ ````
46
+
47
+ ## Fields
48
+
49
+ Fence header: ` ```garden interactive #<id> ` (snippet trigger `;ginteractive`). YAML metadata goes above `---` and declarative UI tags go below `---` (run `npx garden ui catalog` to inspect all internal tags in `.garden/ui-catalog.html`); invalid YAML or unknown top-level keys report `garden-yaml` on the block.
50
+
51
+ | Field or Tag | Required | Default | Allowed Values & Limits | Description |
52
+ | :--- | :--- | :--- | :--- | :--- |
53
+ | `#<id>` / `id` | Required | none | lowercase letters, digits, hyphens `^[a-z0-9]+(?:-[a-z0-9]+)*$`, unique per post; missing or invalid reports `ui-id` | Written on the fence line (such as `#reading-time`) or in the YAML header |
54
+ | `caption` | Required | none | non-empty one-sentence takeaway string; missing or empty reports `ui-caption` | States the conclusion visible in the default state |
55
+ | `intent` | Optional | none | string (non-string reports `ui-header`; modified `intent` without recompiling reports a `ui-stale` warning) | Original natural-language prompt this block was compiled from |
56
+ | `expect` | Optional | none | `{ given: {...}, <name>: <expected> }[]` (non-array reports `ui-header`; malformed or failing assertion reports `ui-expect`) | Numeric assertions verified by `npx garden ui check` (use `{ value, tol }` for approximate values) |
57
+ | `<State />` | Required | none | lowercase-initial prop names with number, string, or boolean literal defaults (invalid name, duplicate name, or non-literal reports `ui-prop`) | Declares mutable state variables and default values, e.g. `<State words={6000} />` |
58
+ | `<Let />` | Optional | none | expression props (unknown identifier or disallowed syntax reports `ui-expr`, cyclic dependency reports `ui-cycle`, evaluation failure reports `ui-eval`, single-multiplication-only block reports `interactive-trivial`) | Computes derived numbers, arrays, or objects from state |
59
+ | `<Data />` | Optional | none | `name` (valid identifier) and `src` (`.csv` or `.json` inside the post's sidecar directory; out-of-bounds, missing, or invalid file reports `ui-data`) | Loads a sidecar data file |
60
+ | `<Slider />` / `<Stepper />` / `<Toggle />` | At least one input control | `Slider`: `scale="linear"`, `snap="none"` (`"pow2"` when `scale="log"` and bounds are powers of 2); `Stepper`: `step={1}` | `bind` must reference a declared state variable of matching type (otherwise `ui-bind`); `max <= min`, `scale="log"` with `min <= 0`, or default outside `min..max` reports `ui-prop` | Input controls bound to numeric or boolean state |
61
+ | `<Choice />` / `<Checklist />` / `<Button />` | Optional input controls | `Button`: `tone="plain"` | `<Choice>` `options` must have `2` to `8` items (outside `2`–`8` reports `ui-limit`, default not in `options` reports `ui-prop`); `<Checklist>` `items` must have `1` to `30` items (outside `1`–`30` reports `ui-limit`); `<Button>` requires exactly one of `set` or `reset` (otherwise `ui-prop`) | Segmented/dropdown selector, interactive checklist, and state button |
62
+ | `<Stack />` / `<Columns />` / `<Tabs />` / `<Steps />` | Optional layout containers | `Stack`: `gap={3}`, `direction="col"`; `Columns`: `gap={3}`, `min={220}`; `Steps`: `autoplay={false}` | `gap` `0`–`4` integer, `Columns.min` `160`–`400`, `Steps.autoplay` `false` or `>= 800` (violation reports `ui-prop`); `<Columns>` max `4` children, `<Tabs>` `2`–`6` `<Tab>` children, `<Steps>` `2`–`24` `<Step>` children (outside limits reports `ui-limit`, wrong child tag reports `ui-children`, prose-only steps with no state changes report `steps-prose`) | Layout containers (for `<Each>` over `200` items, only the first `200` are shown with no `ui-limit`; total expanded elements across the block max `200`, exceeding reports `ui-limit`) |
63
+ | `<Stat />` / `<Meter />` / `<Chart />` / `<Pie />` | At least one output view | `Stat`: `tone="plain"`, `size="md"`; `Meter`: `tone="accent"`; `Chart`: `samples={64}`, `yScale="linear"`, `height={200}` | `<Meter>` `parts` max `5` segments, `<Pie>` `1`–`8` `<Slice>` children, `<Chart>` `1`–`4` series children and `data` max `2000` rows (exceeding reports `ui-limit`); `<Chart>` `samples` `2`–`200` and `height` `120`–`480` (outside range reports `ui-prop`) | Displays computed metrics, progress meters, donut charts, and function/data charts |
64
+ | `<Table />` / `<Grid />` / `<Image />` / `<Code />` / `<Diagram />` / `<Sandbox />` | Optional display views | none | `<Table>` max `50` rows, `<Grid>` `cols` max `16` columns and `1`–`16` `<Row>` children, `<Image>` max `12` `<Hotspot>` children, `<Code>` max `60` lines, `<Sandbox>` `html` max `12000` chars and `css`/`js` max `8000` chars each (exceeding reports `ui-limit`; unknown tag reports `ui-component`; headings, code fences, HTML, or Markdown images in the body report `ui-markdown`; JSX syntax or spread props report `ui-syntax`) | Tables, inspection grids, hotspot images, code walkthroughs, Mermaid state diagrams, and self-contained sandboxes |
65
+
66
+ ## Limits & errors
67
+
68
+ - Header: `ui-id` (missing or malformed id), `ui-caption` (missing caption), `ui-header` (`intent` not a string or `expect` not a list), `ui-expect` (malformed or failing assertion), `ui-stale` (warning: the idea changed but was not recompiled).
69
+ - Tags: `ui-prop`, `ui-expr`, `ui-cycle`, `ui-eval`, `ui-data`, `ui-bind`, `ui-limit`, `ui-children`, `ui-component`, `ui-markdown`, `ui-syntax`; see the table above for what triggers each.
70
+ - Whole block: `interactive-trivial` (a single simple multiplication), `steps-prose` (steps that are only prose, with no state change).
71
+ - Run `npx garden ui check` to get a fix prompt.
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: Component reference · list
3
+ navTitle: list
4
+ description: Pair line icons with short observations in a compact card, or add headings and multi-paragraph notes for divided steps.
5
+ section: reference
6
+ order: 11
7
+ badge: list
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: list](/garden/en/components/list)
11
+
12
+ ## Examples
13
+
14
+ ```garden list
15
+ items:
16
+ - icon: search
17
+ text: Searches for this month's title
18
+ - icon: eye
19
+ text: Reads 3 reviews
20
+ - icon: heart
21
+ text: Saves the event page
22
+ - icon: chat
23
+ text: Asks in the group chat whether listening only is fine
24
+ ```
25
+
26
+ ```garden list
27
+ items:
28
+ - icon: flask
29
+ title: "Experiment 1: is one book a month too much?"
30
+ text:
31
+ - Pick a novella and a long novel for the first two meetings, and record how many people finish.
32
+ - If the share drops clearly, read only the first half next time.
33
+ - icon: chat
34
+ title: "Experiment 2: how do we get first-timers talking?"
35
+ text:
36
+ - Open half of the meetings with one sentence from each person, and the other half with free discussion.
37
+ - Compare how often first-timers speak.
38
+ - icon: bell
39
+ title: "Experiment 3: how early should the reminder go out?"
40
+ text:
41
+ - Send the reminder three days before one meeting and one day before another, and compare turnout.
42
+ ```
43
+
44
+ ## Syntax
45
+
46
+ ````markdown
47
+ ```garden list
48
+ title: # optional, heading
49
+ items: # required, items
50
+ - icon: # optional, one of 23 icons
51
+ title: # optional, switches layout
52
+ text: # recommended, description
53
+ caption: # optional, caption
54
+ ```
55
+ ````
56
+
57
+ ## Fields
58
+
59
+ Fence header: ` ```garden list ` (snippet trigger `;glist`). Invalid YAML or unknown top-level keys report `garden-yaml` on the block.
60
+
61
+ | Field | Required | Default | Allowed Values & Limits | Description |
62
+ | :--- | :--- | :--- | :--- | :--- |
63
+ | `title` | Optional | none | string | Heading above the list |
64
+ | `items` | Required | `[]` | object or string array | List entries; renders as a compact icon card when no item has `title`, or a divided step list when any item has `title` |
65
+ | `items[].icon` | Optional | none (draws no icon) | one of the 23 built-in icon names: `search`, `eye`, `heart`, `chat`, `shield`, `wallet`, `bell`, `check`, `x`, `star`, `flag`, `clock`, `idea`, `book`, `link`, `user`, `chart`, `gear`, `file`, `pin`, `flask`, `target`, `question` | Line icon name (unknown names render nothing) |
66
+ | `items[].title` | Optional | none (compact row layout) | string | Item heading; switches the block to the divided step layout |
67
+ | `items[].text` | Recommended | `[]` | string or string[] | Item body text; each array element renders as its own paragraph |
68
+ | `caption` | Optional | none | string | Caption below the list |
69
+
70
+ ## Limits & errors
71
+
72
+ - Apart from the shared `garden-yaml`, this component has no error codes of its own; values marked "not checked" in the table never report an error.
@@ -0,0 +1,113 @@
1
+ ---
2
+ title: Component reference · relations
3
+ navTitle: relations
4
+ description: Place 3 to 6 elements on an ellipse or around a center node and connect them with solid or dashed, one-way or two-way labeled links.
5
+ section: reference
6
+ order: 10
7
+ badge: relations
8
+ ---
9
+
10
+ [← Component reference](/garden/en/reference) · [Usage: relations](/garden/en/components/relations)
11
+
12
+ ## Examples
13
+
14
+ ```garden relations
15
+ items:
16
+ - title: Pick
17
+ text: Choose this month's book
18
+ - title: Read
19
+ text: Finish the agreed chapters each week
20
+ - title: Talk
21
+ text: Meet and share views
22
+ - title: Review
23
+ text: Note what to change next time
24
+ links:
25
+ - from: 1
26
+ to: 2
27
+ - from: 2
28
+ to: 3
29
+ - from: 3
30
+ to: 4
31
+ - from: 4
32
+ to: 1
33
+ - from: 3
34
+ to: 1
35
+ style: dashed
36
+ label: shapes the pick
37
+ - from: 2
38
+ to: 4
39
+ style: dashed
40
+ caption: The four steps feed each other instead of running once in a fixed order.
41
+ ```
42
+
43
+ ```garden relations
44
+ items:
45
+ - title: Organiser
46
+ text: Sends one notice a month
47
+ - title: Members
48
+ text: Eight to ten neighbours
49
+ - title: Venue
50
+ text: Café or library
51
+ - title: Reading list
52
+ text: Members take turns to nominate
53
+ center: Organiser
54
+ links:
55
+ - from: 1
56
+ to: 2
57
+ label: invites
58
+ - from: 1
59
+ to: 3
60
+ label: books
61
+ - from: 1
62
+ to: 4
63
+ label: collects
64
+ - from: 2
65
+ to: 4
66
+ style: dashed
67
+ direction: both
68
+ label: nominate
69
+ caption: The organiser sits in the center and links to the other three; members and the list shape each other.
70
+ ```
71
+
72
+ ## Syntax
73
+
74
+ ````markdown
75
+ ```garden relations
76
+ title: # optional, aria only
77
+ items: # required, 3–6
78
+ - title: # required, name
79
+ text: # optional, short note
80
+ center: # optional, # or title
81
+ links: # optional, list
82
+ - from: # required, # or title
83
+ to: # required, not from
84
+ style: # solid | dashed
85
+ direction: # one | both
86
+ label: # optional, short label
87
+ caption: # optional, caption
88
+ ```
89
+ ````
90
+
91
+ ## Fields
92
+
93
+ Fence header: ` ```garden relations ` (snippet trigger `;grel`). Nodes have no emphasis or accent option—every element carries equal visual weight; ` ```mermaid ` fences are supported for any other diagram, and `garden list` covers one-pass steps. Invalid YAML or unknown top-level keys report `garden-yaml` on the block.
94
+
95
+ | Field | Required | Default | Allowed Values & Limits | Description |
96
+ | :--- | :--- | :--- | :--- | :--- |
97
+ | `title` | Optional | `"Relationship diagram"` for `aria-label` (no visible heading) | string | Heading above the diagram |
98
+ | `items` | Required | none | object[], strictly `3` to `6` items (fewer than `3` or more than `6` items reports `garden-relations`) | Elements in the diagram; when `center` is omitted, all items are spaced evenly on an ellipse starting at the top (12 o'clock), clockwise |
99
+ | `items[].title` | Required | `""` | string | Node heading (`links` and `center` reference items by 1-based number or exact `title`) |
100
+ | `items[].text` | Optional | `""` | string | Short note below the node heading |
101
+ | `center` | Optional | none (all items on the outer ellipse) | `1..N` (1-based number) or exact item `title` (an unknown index or title reports `garden-relations`) | Placed between `items` and `links`: puts that element in the middle and spaces the remaining elements evenly on the outer ring starting at the top, clockwise; no auto-detection |
102
+ | `links` | Optional | `[]` | object[] (non-array or entry with unknown keys reports `garden-relations`) | Directed or bidirectional links between elements; neighbour outer-ring links bow outward while others run straight through the middle; write a repeating loop by listing each step (`1->2`, `2->3`, `3->4`, `4->1`) |
103
+ | `links[].from` | Required | none | `1..N` (1-based number) or exact item `title`, cannot equal `to` (missing, unknown target, or `from === to` reports `garden-relations`) | Source element |
104
+ | `links[].to` | Required | none | `1..N` (1-based number) or exact item `title`, cannot equal `from` (missing, unknown target, or `from === to` reports `garden-relations`) | Target element |
105
+ | `links[].style` | Optional | `"solid"` | `"solid"` \| `"dashed"` (any other value reports `garden-relations`) | Solid line (`→` / `↔`) or dashed line (`⇢` / `⇠⇢`) |
106
+ | `links[].direction` | Optional | `"one"` | `"one"` \| `"both"` (any other value reports `garden-relations`) | One-way arrow toward `to` or arrowheads on both ends |
107
+ | `links[].label` | Optional | `""` | short string (non-string value reports `garden-relations`) | Short label along the line (dodges line crossings; when it does not fit on its line it becomes a circled number listed under the graph, e.g. `① limits: Budget → Venue`) |
108
+ | `caption` | Optional | none | string | Caption below the diagram |
109
+
110
+ ## Limits & errors
111
+
112
+ - `garden-relations`: fewer than 3 or more than 6 `items`; `center` matches no item; `links` is not a list or an entry has unknown keys; `from` / `to` missing, unknown or equal; a wrong `style` or `direction`; a `label` that is not a string.
113
+ - For more elements or branches, use a ```` ```mermaid ```` flowchart; for one-pass steps, use `garden list`.