hd-garden 0.13.2 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/garden-compose/SKILL.md +24 -0
- package/.agents/skills/garden-compose/references/colors.md +11 -0
- package/.agents/skills/garden-compose/references/composition-patterns.md +162 -0
- package/.agents/skills/garden-compose/references/examples.md +55 -0
- package/.agents/skills/garden-compose/references/frames.md +7 -0
- package/.agents/skills/garden-compose/references/layout-recipes.md +84 -0
- package/.agents/skills/garden-compose/references/rendering-model.md +120 -0
- package/.agents/skills/garden-compose/references/static-play.md +19 -0
- package/.agents/skills/garden-compose/references/visual-selection.md +38 -0
- package/.agents/skills/garden-compose/references/workflow.md +27 -0
- package/.agents/skills/garden-compose/scripts/_cli.mjs +12 -0
- package/.agents/skills/garden-compose/scripts/apply.mjs +2 -0
- package/.agents/skills/garden-compose/scripts/check.mjs +2 -0
- package/.agents/skills/garden-compose/scripts/prompt.mjs +2 -0
- package/.agents/skills/garden-compose/scripts/scan.mjs +2 -0
- package/.agents/skills/garden-post-review/SKILL.md +5 -16
- package/Makefile +12 -3
- package/README.en.md +10 -5
- package/README.md +10 -5
- package/app/admin/preview/[...path]/page.tsx +3 -15
- package/app/api/admin/ui/blocks/route.ts +1 -1
- package/app/components/AdminUiPanels.tsx +6 -3
- package/app/components/GardenContentGuide.tsx +7 -8
- package/app/components/MarkdownArticle.tsx +6 -47
- package/app/components/TableOfContents.tsx +0 -1
- package/app/components/UiStudio.tsx +29 -32
- package/app/components/garden/AuthorRich.tsx +5 -0
- package/app/components/garden/ComposePreview.tsx +9 -0
- package/app/components/garden/GardenBlock.tsx +12 -10
- package/app/components/garden/GardenFile.tsx +1 -1
- package/app/components/garden/blocks.tsx +9 -197
- package/app/components/garden/file-icons.tsx +1 -1
- package/app/components/garden/patterns.tsx +7 -65
- package/app/lib/content.ts +5 -22
- package/app/lib/heading-number.ts +2 -7
- package/app/lib/rehype-garden-blocks.mjs +30 -0
- package/app/lib/remark-garden.mjs +0 -4
- package/app/lib/ui-model.ts +8 -9
- package/app/styles/a2.css +17 -1
- package/bin/garden.mjs +43 -36
- package/docs/handbook/ai-writing.md +19 -22
- package/docs/handbook/components/compose.md +16 -7
- package/docs/handbook/components/image.md +1 -1
- package/docs/handbook/components/link-card.md +2 -2
- package/docs/handbook/components.md +5 -213
- package/docs/handbook/deploy.md +11 -0
- package/docs/handbook/en/ai-writing.md +17 -20
- package/docs/handbook/en/components/compose.md +15 -6
- package/docs/handbook/en/components/image.md +1 -1
- package/docs/handbook/en/components/link-card.md +2 -2
- package/docs/handbook/en/components.md +7 -215
- package/docs/handbook/en/deploy.md +11 -0
- package/docs/handbook/en/index.md +29 -53
- package/docs/handbook/en/reference/compose.md +77 -148
- package/docs/handbook/en/reference.md +6 -22
- package/docs/handbook/en/start.md +1 -1
- package/docs/handbook/en/workflow.md +20 -16
- package/docs/handbook/en/writing.md +2 -2
- package/docs/handbook/index.md +26 -47
- package/docs/handbook/reference/compose.md +79 -148
- package/docs/handbook/reference.md +6 -22
- package/docs/handbook/start.md +1 -1
- package/docs/handbook/workflow.md +20 -16
- package/docs/handbook/writing.md +2 -2
- package/editors/dist/typora/main.js +324 -330
- package/editors/dist/typora/style.css +4299 -11
- package/editors/dist/vscode/garden-ui-0.1.1.vsix +0 -0
- package/eslint.config.mjs +3 -0
- package/package.json +3 -2
- package/public/images/compose-resources/resource-015b41eb0f32.svg +1 -0
- package/public/images/compose-resources/resource-ecee6b47f015.svg +1 -0
- package/public/images/compose-resources/resource-fd51121b5e8c.svg +1 -0
- package/scripts/build-content.mjs +59 -141
- package/scripts/build-ui-preview.mjs +7 -5
- package/scripts/check-post.mjs +8 -104
- package/scripts/check-site.mjs +80 -0
- package/scripts/compose-style-reference.mjs +22 -0
- package/scripts/dev-server.mjs +114 -0
- package/scripts/editor-preview-css.mjs +14 -0
- package/scripts/file-preview.mjs +1 -1
- package/scripts/file-sizes.mjs +7 -7
- package/scripts/generated-cache.mjs +36 -0
- package/scripts/handbook-facts.mjs +10 -3
- package/scripts/image-sizes.mjs +6 -12
- package/scripts/link-assets.mjs +35 -10
- package/scripts/managed-skills.mjs +56 -0
- package/scripts/prepare-pages-output.mjs +1 -1
- package/scripts/site-guide.mjs +19 -0
- package/scripts/ui-cli.mjs +26 -33
- package/templates/garden-blocks.md +4 -180
- package/templates/garden-snippets.plist +2 -183
- package/templates/site/AGENTS.en.md +89 -0
- package/templates/site/AGENTS.md +72 -0
- package/templates/site/Makefile +12 -3
- package/templates/site/Makefile.en +12 -3
- package/templates/site/README.en.md +8 -1
- package/templates/site/README.md +8 -1
- package/templates/skills-en/garden-compose/SKILL.md +24 -0
- package/templates/skills-en/garden-post-review/SKILL.md +5 -16
- package/templates/workflows/pages.en.yml +11 -0
- package/templates/workflows/pages.yml +11 -0
- package/ui/compose/compose.css +54 -14
- package/ui/compose/contracts.mjs +16 -0
- package/ui/compose/dil.mjs +109 -48
- package/ui/compose/distribution.mjs +7 -0
- package/ui/compose/features.mjs +90 -0
- package/ui/compose/icons.mjs +8 -0
- package/ui/compose/index.mjs +2 -0
- package/ui/compose/inspect.mjs +11 -0
- package/ui/compose/markup.mjs +80 -23
- package/ui/compose/preview.mjs +13 -0
- package/ui/compose/prompt-catalog.mjs +15 -3
- package/ui/compose/render.mjs +46 -11
- package/ui/compose/scenes.mjs +10 -0
- package/ui/core/apply.mjs +12 -45
- package/ui/core/catalog.mjs +22 -32
- package/ui/core/cli-locale.mjs +8 -18
- package/ui/core/color.mjs +34 -0
- package/ui/core/compile.mjs +1 -8
- package/ui/core/demos.mjs +138 -108
- package/ui/core/fence.mjs +14 -70
- package/ui/core/fix-prompt.mjs +1 -3
- package/ui/core/garden-fence.mjs +3 -63
- package/ui/core/index.mjs +3 -5
- package/ui/core/parse.mjs +22 -8
- package/ui/core/scan.mjs +31 -43
- package/ui/core/starters.mjs +3 -3
- package/ui/core/static.mjs +36 -6
- package/ui/core/transform.mjs +64 -149
- package/ui/core/validate.mjs +20 -9
- package/ui/garden/article-content.mjs +98 -0
- package/ui/garden/catalog.mjs +21 -427
- package/ui/garden/check.mjs +18 -60
- package/ui/garden/file-block.mjs +1 -1
- package/ui/garden/file-paths.mjs +8 -6
- package/ui/garden/markdown-syntax.mjs +1 -1
- package/ui/garden/parse.mjs +19 -182
- package/ui/garden/relations.mjs +1 -1
- package/ui/garden/snippets.mjs +12 -153
- package/ui/garden/source-icon.mjs +17 -9
- package/ui/garden/word-count.mjs +16 -85
- package/ui/index.mjs +1 -5
- package/ui/preview/dist/garden-ui.css +4300 -11
- package/ui/preview/dist/garden-ui.esm.js +446 -418
- package/ui/preview/dist/garden-ui.iife.js +446 -418
- package/ui/preview/index.tsx +31 -98
- package/ui/preview/site-config.ts +4 -0
- package/ui/prompt/build.mjs +1 -4
- package/ui/prompt/recipes/code-walkthrough.md +17 -12
- package/ui/prompt/recipes/compare.md +14 -10
- package/ui/prompt/recipes/compose.md +3 -3
- package/ui/prompt/recipes/converter.md +17 -14
- package/ui/prompt/recipes/data-chart.md +9 -8
- package/ui/prompt/recipes/inspect-grid.md +9 -8
- package/ui/prompt/recipes/param-bench.md +17 -12
- package/ui/prompt/recipes/plan.md +4 -3
- package/ui/prompt/recipes/stepper.md +18 -16
- package/ui/prompt/recipes/trace.md +20 -18
- package/ui/prompt/rules.md +26 -133
- package/ui/prompt/studio.md +3 -18
- package/ui/react/CatalogPage.tsx +19 -21
- package/ui/react/recipes.ts +3 -3
- package/ui/react/runtime.tsx +23 -2
- package/ui/react/ui.css +17 -11
- package/vite.config.ts +46 -8
- package/.agents/skills/garden-interactive-chart/SKILL.md +0 -84
- package/.agents/skills/garden-interactive-chart/references/shell.html +0 -49
- package/.agents/skills/garden-interactive-chart/references/style.md +0 -61
- package/.agents/skills/garden-ui/SKILL.md +0 -125
- package/app/components/UiBlock.tsx +0 -23
- package/app/components/WidgetChart.tsx +0 -224
- package/app/lib/generated-content.ts +0 -385
- package/docs/handbook/components/card.md +0 -67
- package/docs/handbook/components/chart.md +0 -38
- package/docs/handbook/components/choice.md +0 -42
- package/docs/handbook/components/compare.md +0 -53
- package/docs/handbook/components/file.md +0 -29
- package/docs/handbook/components/html.md +0 -49
- package/docs/handbook/components/interactive.md +0 -48
- package/docs/handbook/components/list.md +0 -65
- package/docs/handbook/components/relations.md +0 -95
- package/docs/handbook/components/stat.md +0 -39
- package/docs/handbook/components/timeline.md +0 -37
- package/docs/handbook/en/components/card.md +0 -67
- package/docs/handbook/en/components/chart.md +0 -38
- package/docs/handbook/en/components/choice.md +0 -42
- package/docs/handbook/en/components/compare.md +0 -53
- package/docs/handbook/en/components/file.md +0 -29
- package/docs/handbook/en/components/html.md +0 -49
- package/docs/handbook/en/components/interactive.md +0 -44
- package/docs/handbook/en/components/list.md +0 -65
- package/docs/handbook/en/components/relations.md +0 -95
- package/docs/handbook/en/components/stat.md +0 -39
- package/docs/handbook/en/components/timeline.md +0 -37
- package/docs/handbook/en/reference/card.md +0 -85
- package/docs/handbook/en/reference/chart.md +0 -68
- package/docs/handbook/en/reference/choice.md +0 -69
- package/docs/handbook/en/reference/compare.md +0 -59
- package/docs/handbook/en/reference/file.md +0 -50
- package/docs/handbook/en/reference/html.md +0 -62
- package/docs/handbook/en/reference/interactive.md +0 -71
- package/docs/handbook/en/reference/list.md +0 -72
- package/docs/handbook/en/reference/relations.md +0 -113
- package/docs/handbook/en/reference/stat.md +0 -60
- package/docs/handbook/en/reference/timeline.md +0 -56
- package/docs/handbook/reference/card.md +0 -85
- package/docs/handbook/reference/chart.md +0 -68
- package/docs/handbook/reference/choice.md +0 -69
- package/docs/handbook/reference/compare.md +0 -59
- package/docs/handbook/reference/file.md +0 -50
- package/docs/handbook/reference/html.md +0 -62
- package/docs/handbook/reference/interactive.md +0 -71
- package/docs/handbook/reference/list.md +0 -72
- package/docs/handbook/reference/relations.md +0 -113
- package/docs/handbook/reference/stat.md +0 -60
- package/docs/handbook/reference/timeline.md +0 -56
- package/templates/skills-en/garden-interactive-chart/SKILL.md +0 -84
- package/templates/skills-en/garden-interactive-chart/references/shell.html +0 -49
- package/templates/skills-en/garden-interactive-chart/references/style.md +0 -61
- package/templates/skills-en/garden-ui/SKILL.md +0 -125
package/bin/garden.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { startDev } from "../scripts/dev-server.mjs";
|
|
5
|
+
import { installSiteGuide } from "../scripts/site-guide.mjs";
|
|
6
|
+
import { installManagedSkills } from "../scripts/managed-skills.mjs";
|
|
4
7
|
import fs from "node:fs";
|
|
5
8
|
import path from "node:path";
|
|
6
9
|
import { createRequire } from "node:module";
|
|
@@ -201,6 +204,7 @@ async function ensureSiteKit(destinationRoot = siteRoot) {
|
|
|
201
204
|
const lang = siteCliLang(destinationRoot);
|
|
202
205
|
if (!samePath(destinationRoot, gardenPackageRoot)) {
|
|
203
206
|
const added = [];
|
|
207
|
+
if (installSiteGuide({ engineRoot: gardenPackageRoot, siteRoot: destinationRoot, lang })) added.push("AGENTS.md");
|
|
204
208
|
if (
|
|
205
209
|
copyIfMissing(
|
|
206
210
|
path.join(gardenPackageRoot, "templates", "site", lang === "en" ? "Makefile.en" : "Makefile"),
|
|
@@ -282,11 +286,17 @@ async function prepare() {
|
|
|
282
286
|
await ensureSiteKit();
|
|
283
287
|
}
|
|
284
288
|
|
|
285
|
-
async function sync() {
|
|
289
|
+
async function sync({ refreshLinks = false } = {}) {
|
|
286
290
|
if (!fs.existsSync(path.join(siteRoot, "site.config.yaml"))) {
|
|
287
291
|
fail(`当前目录不是 Garden 站点(缺少 site.config.yaml):${siteRoot}`);
|
|
288
292
|
}
|
|
289
293
|
await prepare();
|
|
294
|
+
// Same path as `garden links` / formal build: collect Markdown URLs (incl. drafts),
|
|
295
|
+
// refresh link-assets.json + public assets, then regenerate. Failures keep usable cache.
|
|
296
|
+
if (refreshLinks && process.env.GARDEN_OFFLINE !== "1") {
|
|
297
|
+
const links = spawnSync(process.execPath, [path.join(gardenPackageRoot, "scripts/link-assets.mjs"), "--dev"], { cwd: siteRoot, env: siteEnv(), stdio: "inherit" });
|
|
298
|
+
if (links.status !== 0) console.warn("链接资源:刷新失败,沿用可用缓存");
|
|
299
|
+
}
|
|
290
300
|
runNode("scripts/build-content.mjs");
|
|
291
301
|
}
|
|
292
302
|
|
|
@@ -312,12 +322,19 @@ function ensureDevGitHubLogin() {
|
|
|
312
322
|
if (!/^GITHUB_SESSION_SECRET=\S+/m.test(text)) {
|
|
313
323
|
text = upsertEnv(text, "GITHUB_SESSION_SECRET", randomBytes(32).toString("base64url"));
|
|
314
324
|
}
|
|
315
|
-
|
|
325
|
+
const next = text.endsWith("\n") ? text : `${text}\n`;
|
|
326
|
+
if (!fs.existsSync(local) || fs.readFileSync(local, "utf8") !== next) fs.writeFileSync(local, next);
|
|
316
327
|
}
|
|
317
328
|
|
|
318
329
|
async function runVinext(vinextArgs, { copyDist = false } = {}) {
|
|
319
|
-
await sync();
|
|
320
330
|
const cwd = vinextRoot();
|
|
331
|
+
if (vinextArgs[0] === "dev") {
|
|
332
|
+
const { finished } = await startDev({ cwd, executable: resolveVinext(), args: vinextArgs.slice(1), env: siteEnv(), prepare: () => sync({ refreshLinks: true }) });
|
|
333
|
+
const result = await finished;
|
|
334
|
+
if (result.status !== 0) process.exit(result.status || 1);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
await sync();
|
|
321
338
|
const result = spawnSync(process.execPath, [resolveVinext(), ...vinextArgs], {
|
|
322
339
|
cwd,
|
|
323
340
|
env: siteEnv(),
|
|
@@ -333,7 +350,7 @@ const EN_TEMPLATE_VARIANTS = new Set(["site.config.en.yaml", "Makefile.en", "REA
|
|
|
333
350
|
function copyTemplate(from, to) {
|
|
334
351
|
fs.mkdirSync(to, { recursive: true });
|
|
335
352
|
for (const entry of fs.readdirSync(from, { withFileTypes: true })) {
|
|
336
|
-
if (entry.name === ".git" || EN_TEMPLATE_VARIANTS.has(entry.name)) continue;
|
|
353
|
+
if (entry.name === ".git" || entry.name === "AGENTS.md" || entry.name === "AGENTS.en.md" || EN_TEMPLATE_VARIANTS.has(entry.name)) continue;
|
|
337
354
|
const source = path.join(from, entry.name);
|
|
338
355
|
const destination = path.join(to, entry.name);
|
|
339
356
|
if (entry.isDirectory()) copyTemplate(source, destination);
|
|
@@ -406,6 +423,7 @@ async function initSite() {
|
|
|
406
423
|
fs.copyFileSync(enWorkflow, workflowDest);
|
|
407
424
|
}
|
|
408
425
|
}
|
|
426
|
+
installSiteGuide({ engineRoot: gardenPackageRoot, siteRoot: destination, lang });
|
|
409
427
|
writeEngineDependency(destination);
|
|
410
428
|
process.stdout.write(lang === "en" ? `Created site: ${destination}\n` : `已创建站点:${destination}\n`);
|
|
411
429
|
installSkill(destination, { lang });
|
|
@@ -458,34 +476,10 @@ async function editorsCommand(argv) {
|
|
|
458
476
|
if (status) process.exit(status);
|
|
459
477
|
}
|
|
460
478
|
|
|
461
|
-
function
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
.filter((entry) => entry.isDirectory() && fs.existsSync(path.join(root, entry.name, "SKILL.md")))
|
|
466
|
-
.map((entry) => entry.name);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
function installSkill(destinationRoot = siteRoot, { onlyMissing = false, lang = siteCliLang(destinationRoot) } = {}) {
|
|
470
|
-
const names = packagedSkills();
|
|
471
|
-
if (!names.length) fail("Garden 包里没有 skill。");
|
|
472
|
-
const installed = [];
|
|
473
|
-
for (const name of names) {
|
|
474
|
-
const to = path.join(destinationRoot, ".agents", "skills", name);
|
|
475
|
-
if (onlyMissing && fs.existsSync(path.join(to, "SKILL.md"))) continue;
|
|
476
|
-
fs.cpSync(path.join(gardenPackageRoot, ".agents", "skills", name), to, { recursive: true });
|
|
477
|
-
// English sites get the English skill text; files without a translation keep the packaged copy.
|
|
478
|
-
const english = path.join(gardenPackageRoot, "templates", "skills-en", name);
|
|
479
|
-
if (lang === "en" && fs.existsSync(english)) fs.cpSync(english, to, { recursive: true, force: true });
|
|
480
|
-
installed.push(name);
|
|
481
|
-
}
|
|
482
|
-
if (installed.length) {
|
|
483
|
-
process.stdout.write(
|
|
484
|
-
lang === "en"
|
|
485
|
-
? `Installed skills: ${installed.join(", ")}\n`
|
|
486
|
-
: `已安装 skill:${installed.join("、")}\n`,
|
|
487
|
-
);
|
|
488
|
-
}
|
|
479
|
+
function installSkill(destinationRoot = siteRoot, { lang = siteCliLang(destinationRoot) } = {}) {
|
|
480
|
+
// Managed kits update recursively even on automatic sync; local edits are backed up.
|
|
481
|
+
const installed = installManagedSkills({ engineRoot: gardenPackageRoot, siteRoot: destinationRoot, lang });
|
|
482
|
+
process.stdout.write(lang === "en" ? `Installed skills: ${installed.join(", ")}\n` : `已安装 skill:${installed.join("、")}\n`);
|
|
489
483
|
}
|
|
490
484
|
|
|
491
485
|
function help() {
|
|
@@ -496,14 +490,16 @@ function help() {
|
|
|
496
490
|
garden sync 只从 Markdown 生成索引
|
|
497
491
|
garden new 创建文章草稿
|
|
498
492
|
garden embed 拉取外链摘要
|
|
499
|
-
garden links
|
|
500
|
-
garden images 读取新的远程图片尺寸,写入 image-sizes.json(build 时会自动做)
|
|
501
|
-
garden files 读取
|
|
493
|
+
garden links 重新拉取外链图标与卡片元数据(dev / build 时也会自动做)
|
|
494
|
+
garden images 读取新的远程图片尺寸,写入 .garden/image-sizes.json(build 时会自动做)
|
|
495
|
+
garden files 读取 Compose <file> 里远程文件的大小,写入 file-sizes.json(build 时会自动做)
|
|
502
496
|
garden init [目录] 创建只含稿和配置的新站点
|
|
503
497
|
garden check <文章.md> 检查一篇博文的硬性结构
|
|
498
|
+
garden verify [文章.md|--diff] 全量/单篇/改动文档严格预检(包含草稿;make check 使用)
|
|
504
499
|
garden ui <子命令> Intelligent UI:scan、check、apply、prompt、schema、catalog
|
|
505
500
|
garden hooks 安装提交前检查(检查暂存稿件里的 ui 块)
|
|
506
501
|
garden editors install 安装 Intelligent UI 插件到 VS Code / Cursor 与 Typora(--vscode、--typora、--yes)
|
|
502
|
+
garden agents 仅在缺失时安装站点 AGENTS.md,保留已有指南
|
|
507
503
|
garden skill 把引擎自带的 skill 装进当前站点
|
|
508
504
|
garden pages:validate 检查 dist/client
|
|
509
505
|
garden pages:prepare 写入公开产物仓库
|
|
@@ -534,7 +530,7 @@ async function main() {
|
|
|
534
530
|
if (process.env.GARDEN_OFFLINE !== "1") runNode("scripts/link-assets.mjs");
|
|
535
531
|
// Remote image sizes: only new images are probed; the rest come from image-sizes.json.
|
|
536
532
|
if (process.env.GARDEN_OFFLINE !== "1") runNode("scripts/image-sizes.mjs");
|
|
537
|
-
// Sizes of remote files in
|
|
533
|
+
// Sizes of remote files in Compose file components; failures fall back to file-sizes.json.
|
|
538
534
|
if (process.env.GARDEN_OFFLINE !== "1") runNode("scripts/file-sizes.mjs");
|
|
539
535
|
await runVinext(["build", ...rest], { copyDist: true });
|
|
540
536
|
// /favicon.ico from the site's own icon (brand.favicon).
|
|
@@ -568,6 +564,9 @@ async function main() {
|
|
|
568
564
|
case "embed":
|
|
569
565
|
runNode("scripts/fetch-embed.mjs", rest);
|
|
570
566
|
break;
|
|
567
|
+
case "verify":
|
|
568
|
+
runNode("scripts/check-site.mjs", rest);
|
|
569
|
+
break;
|
|
571
570
|
case "check":
|
|
572
571
|
runNode("scripts/check-post.mjs", rest);
|
|
573
572
|
break;
|
|
@@ -583,6 +582,14 @@ async function main() {
|
|
|
583
582
|
case "init":
|
|
584
583
|
await initSite();
|
|
585
584
|
break;
|
|
585
|
+
case "agents": {
|
|
586
|
+
if (samePath(siteRoot, gardenPackageRoot)) fail("This command is for a Garden site, not the engine repository.");
|
|
587
|
+
if (!fs.existsSync(path.join(siteRoot, "site.config.yaml"))) fail("Not a Garden site: missing site.config.yaml");
|
|
588
|
+
const lang = siteCliLang(siteRoot);
|
|
589
|
+
const created = installSiteGuide({ engineRoot: gardenPackageRoot, siteRoot, lang });
|
|
590
|
+
process.stdout.write(lang === "en" ? (created ? "Created AGENTS.md\n" : "Kept existing AGENTS.md\n") : (created ? "已创建 AGENTS.md\n" : "保留已有 AGENTS.md\n"));
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
586
593
|
case "skill":
|
|
587
594
|
case "skills":
|
|
588
595
|
installSkill();
|
|
@@ -9,28 +9,27 @@ order: 2
|
|
|
9
9
|
在 Garden 里写图表、指标或交互组件不用记标签语法。你在正文写一句自然语言想法,Agent 按站点里的 skill 把它编译成组件,提交时再由同一套命令检查。
|
|
10
10
|
|
|
11
11
|
> [!IMPORTANT] 人和 Agent 用同一套工具
|
|
12
|
-
> Agent 找块用 `npx garden ui scan`,写回用 `npx garden ui apply`,自查用 `npx garden ui check`;作者提交时 pre-commit 钩子运行的也是 `npx garden ui check
|
|
12
|
+
> Agent 找块用 `npx garden ui scan`,写回用 `npx garden ui apply`,自查用 `npx garden ui check`;作者提交时 pre-commit 钩子运行的也是 `npx garden ui check`。检查失败时给出的技能调用短指令,就是发给 Agent 的下一步。
|
|
13
13
|
|
|
14
14
|
## 1. 写一句想法
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
在想放组件的位置写一个 `garden compose` 围栏,只写想让读者做什么、看到什么,不用写组件名:
|
|
17
17
|
|
|
18
18
|
````markdown
|
|
19
|
-
```garden
|
|
19
|
+
```garden compose
|
|
20
20
|
让读者拖动每天写的字数和每周写几天,看写完一篇 8000 字的长文要几周。
|
|
21
21
|
```
|
|
22
22
|
````
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
未编译的想法使用同一个 `garden compose` 入口。`npx garden ui check` 和 `npx garden check` 对草稿与已发布稿件都检查并报告 `compose-uncompiled`。Agent 在 Compose 内组合正文、资源、图形和交互;如果一段普通文字更清楚,也可以直接写回段落。
|
|
25
25
|
|
|
26
|
-
## 2.
|
|
26
|
+
## 2. 随包安装的两个 skill
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
两个 skill 存放在站点根目录的 `.agents/skills/` 下。`npx hd-garden init` 建站时会自动安装,首次运行 `npx garden sync` 或 `npx garden dev` 时会递归更新引擎管理的 skill(本地修改先备份到 `.garden/skill-backups/`),运行 `npx garden skill` 可手动重装。
|
|
29
29
|
|
|
30
30
|
| Skill 名称 | 触发话术示例 | 执行操作 |
|
|
31
31
|
| :--- | :--- | :--- |
|
|
32
|
-
| `garden-
|
|
33
|
-
| `garden-interactive-chart` | 组件目录表达不了的画布动画或模拟 | 在文章同名目录下编写独立 `.html` 文件,正文中只用 `garden html` 围栏嵌入 |
|
|
32
|
+
| `garden-compose` | 「编译这篇:content/posts/writing-pace.md」「重编译 writing-pace」或直接粘贴修复提示词 | 扫描 `uncompiled`、`error` 状态的块,按规则生成组件并用 `npx garden ui apply` 写回;说「这篇哪里适合交互」则进入只读建议模式,最多挑出 5 处可直接粘贴的想法草稿 |
|
|
34
33
|
| `garden-post-review` | 「审稿:content/posts/writing-pace.md」 | 先修 `npx garden check` 报出的结构错误,再按图表规范修交互块,最后通读全文只给修改建议而不改稿 |
|
|
35
34
|
|
|
36
35
|
## 3. `garden ui` 子命令与整篇检查
|
|
@@ -49,19 +48,17 @@ order: 2
|
|
|
49
48
|
|
|
50
49
|
## 4. 提交前检查与修复提示词
|
|
51
50
|
|
|
52
|
-
首次运行 `npx garden sync` 或 `npx garden dev` 时,Garden 会在 `.git/hooks/pre-commit` 写入 `exec npx --no-install garden ui check --staged --quiet`(若已有其他钩子则不覆盖,只提示需添加的命令)。`--staged` 直接通过 `git show :<路径>`
|
|
51
|
+
首次运行 `npx garden sync` 或 `npx garden dev` 时,Garden 会在 `.git/hooks/pre-commit` 写入 `exec npx --no-install garden ui check --staged --quiet`(若已有其他钩子则不覆盖,只提示需添加的命令)。`--staged` 直接通过 `git show :<路径>` 读取暂存区内容,失败时输出文件行号、诊断码和调用项目技能的短指令:
|
|
53
52
|
|
|
54
53
|
```console
|
|
55
|
-
content/posts/writing-pace.md:9 -
|
|
54
|
+
content/posts/writing-pace.md:9 - compose-uncompiled 还有没编译的 compose 想法
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
请处理下面 Garden 博文里列出的块:没编译的想法要编译,有错误的交互块要修好。
|
|
59
|
-
……
|
|
56
|
+
请调用 garden-compose skill(.agents/skills/garden-compose/SKILL.md),修复以上错误块后重新校验。
|
|
60
57
|
```
|
|
61
58
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
- 交互块里写错标签名(如把 `<Slider>` 写成 `<Slidr>`)也会报 `ui-component`
|
|
59
|
+
- 默认只给出文件、行号、错误码和调用项目 `garden-compose` skill 的短指令。不写提示词文件、不复制剪贴板、不调用模型;已有提示词文件保持不变。
|
|
60
|
+
- 只有确需独立导出时,显式运行 `npx garden ui check <稿件.md> --out .garden/export.md --standalone`。`--standalone` 仅为导出文件附加完整规则,单独使用不会创建文件。
|
|
61
|
+
- 交互块里写错标签名(如把 `<Slider>` 写成 `<Slidr>`)也会报 `ui-component` 并指到具体行号。
|
|
65
62
|
- 需要重装钩子时运行 `npx garden hooks`(加 `--force` 覆盖已有钩子);不想自动安装钩子时设置 `GARDEN_SKIP_HOOKS=1`。
|
|
66
63
|
|
|
67
64
|
## 5. 用一句话生成代码对比
|
|
@@ -75,12 +72,12 @@ pages:
|
|
|
75
72
|
title: "用 Markdown 写丨推送之后网站自己更新"
|
|
76
73
|
```
|
|
77
74
|
|
|
78
|
-
```garden
|
|
75
|
+
```garden compose
|
|
79
76
|
和上一版比:标题原来用句号和换行分两行,现在改成用「丨」分行。
|
|
80
77
|
```
|
|
81
78
|
````
|
|
82
79
|
|
|
83
|
-
Agent 按 `garden-
|
|
80
|
+
Agent 按 `garden-compose` skill 会把这个想法块替换成一段紧挨着完整代码的 `diff` 围栏。页面渲染时会把完整代码和 `diff` 合成一个带「代码 / 对比上一版」切换按钮的代码框,手写 `diff` 的规则见 [写文章与随想](/garden/writing)。
|
|
84
81
|
|
|
85
82
|
## 6. 在编辑器里插入、预览,再交给 skill 编译
|
|
86
83
|
|
|
@@ -95,16 +92,16 @@ npx garden editors install --typora
|
|
|
95
92
|
|
|
96
93
|
装好之后,一篇组件通常是这四步:
|
|
97
94
|
|
|
98
|
-
1. **插入想法。** 在要放组件的位置运行「插入 Garden 块」(VS Code / Cursor 的快捷键是 macOS `Cmd+Alt+I`,Windows / Linux `Ctrl+Alt+I`)。Typora 里输入 `/` 后选 `/garden`,下一层列表每一项有一张小预览图;命令的快捷键在 Windows / Linux 是 `Ctrl+Alt+I`,macOS 需要在「设置 → 快捷键」里自己录。插入的是给 `garden-
|
|
95
|
+
1. **插入想法。** 在要放组件的位置运行「插入 Garden 块」(VS Code / Cursor 的快捷键是 macOS `Cmd+Alt+I`,Windows / Linux `Ctrl+Alt+I`)。Typora 里输入 `/` 后选 `/garden`,下一层列表每一项有一张小预览图;命令的快捷键在 Windows / Linux 是 `Ctrl+Alt+I`,macOS 需要在「设置 → 快捷键」里自己录。插入的是给 `garden-compose` skill 编译的想法围栏,例如选「资源卡」得到:
|
|
99
96
|
|
|
100
97
|
````markdown
|
|
101
|
-
```garden
|
|
98
|
+
```garden compose
|
|
102
99
|
做成资源卡。一篇论文、一个仓库或一本书,读者需要标题、链接和一句说明。请写上链接、标题、一句说明。
|
|
103
100
|
```
|
|
104
101
|
````
|
|
105
102
|
2. **预览。** 打开 Markdown 预览,或在 Typora 里把光标移出围栏。`intent` 显示成想法卡片;skill 写回 `ui` 之后,预览画成和博客一样的组件。错误会标在源码上(VS Code / Cursor 的「问题」面板和 CodeLens)。
|
|
106
103
|
3. **看清单。** 命令「查看组件清单」,或在终端运行 `npx garden ui catalog` 打开 `.garden/ui-catalog.html`。清单里的「用它开始」把配方插进当前稿件,适合已经知道要用哪一种组件的时候。
|
|
107
|
-
4. **编译。** 「复制编译提示词」。中文站点得到 `编译这篇:<相对路径>`,英文站点得到 `Compile this post: <相对路径>`。把这句话发给 `garden-
|
|
104
|
+
4. **编译。** 「复制编译提示词」。中文站点得到 `编译这篇:<相对路径>`,英文站点得到 `Compile this post: <相对路径>`。把这句话发给 `garden-compose` skill。Agent 用 `npx garden ui scan` 定位,用 `npx garden ui prompt` 读规则,用 `npx garden ui apply` 写回。插件不调用模型。
|
|
108
105
|
|
|
109
106
|
**Typora 的前提。** 先安装 [typora-community-plugin](https://github.com/typora-community-plugin/typora-community-plugin/blob/main/docs/en-us/user-guide/1a-installation.md)。`npx garden editors install --typora` 把插件复制到 `~/.typora/community-plugins/plugins/hedon954.garden-intelligent-ui/`(macOS 同时写到 `~/Library/Application Support/abnerworks.Typora/plugins/plugins/hedon954.garden-intelligent-ui/`),然后在「设置 → 已安装插件」里勾选 Garden Intelligent UI。升级 Typora 会覆盖社区框架,需要重装框架后再勾选。没找到 `code` 或 `cursor` 时,用扩展视图的 Install from VSIX 选择 `.garden/editors/vscode/` 里的文件。安装细节见 [语法检查与快捷输入](/garden/workflow)。
|
|
110
107
|
|
|
@@ -113,7 +110,7 @@ npx garden editors install --typora
|
|
|
113
110
|
不借助 AI 手写组件时,可以直接使用包内自带的模板与代码片段:
|
|
114
111
|
|
|
115
112
|
- `make new` 创建的草稿底部自带一段 `<!-- 组件速查 ... -->` 注释,包含想法块和各个组件的示例,写完可直接删掉。
|
|
116
|
-
- `templates/garden-blocks.md`
|
|
113
|
+
- `templates/garden-blocks.md` 提供统一 Compose 入口的示例;macOS 与 Typora / Alfred 用户可导入 `templates/garden-snippets.plist`,输入 `;gcompose` 展开带一句白话的 Compose 围栏。
|
|
117
114
|
- 编辑器插件的用法见上一节。`npx garden ui catalog` 在本地生成 `.garden/ui-catalog.html` 离线组件画廊。
|
|
118
115
|
|
|
119
116
|
## 8. 可选的独立管理后台
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
navTitle:
|
|
4
|
-
description:
|
|
2
|
+
title: 内容、布局与交互(compose)
|
|
3
|
+
navTitle: Compose
|
|
4
|
+
description: 在同一个作者入口组合文章内容、布局、资源与交互。
|
|
5
5
|
section: components
|
|
6
6
|
order: 36
|
|
7
7
|
badge: compose
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
`garden compose` 是唯一的 Garden 作者入口。在围栏内组合 Markdown、安全 HTML 内容岛、布局、资源、文件、关系图、选择卡与 Play 交互。具体能力、内容边界和默认样式见[组件参考](/garden/reference/compose),完整可用属性以 `npx garden ui schema` 为准。
|
|
11
|
+
|
|
12
|
+
需要 AI 生成结构图时,输入 `/garden` 选「compose(想法)」。文章里会插入一个 `garden compose` 围栏。你在里面用白话写清结构,再对 AI 说「编译这篇」,AI 就会把这句话留在 `<intent>` 里,并用 Markdown 叶子和组件标签拼出静态说明图。
|
|
11
13
|
|
|
12
14
|
## 怎么写
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
先说明读者应当看见的关系和层级,再选择布局与必要样式。也可以直接写组件;不要把通用 HTML/CSS 当成所有组件的属性契约。
|
|
15
17
|
|
|
16
18
|
把四件事写清楚:
|
|
17
19
|
|
|
@@ -20,7 +22,7 @@ badge: compose
|
|
|
20
22
|
- **谁连谁**:谁先到谁、从一处散开,还是几处收到一起。没有先后顺序,就直接写「这几块没有先后」。
|
|
21
23
|
- **哪块是重点**:直接点名,比如「中间那列是重点」「下面一行才是重点」。
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
先说明视觉关系与重点,再使用受支持的属性表达必要样式。默认样式不保证复刻参考图,必须检查真实排版。
|
|
24
26
|
|
|
25
27
|
**完整标签与属性**见 [组件参考 · compose](/garden/reference/compose);**全部图标名**见 [compose 图标](/garden/reference/compose-icons)。
|
|
26
28
|
|
|
@@ -120,7 +122,7 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
120
122
|
- `{#if …}{:else}{/if}`、`{#each … as item, i}{/each}` 控制流
|
|
121
123
|
- 小写控件:`<slider>`、`<choice>`、`<button>`、`<pie>` / `<chart>`、`<stat>`
|
|
122
124
|
|
|
123
|
-
|
|
125
|
+
作者标签使用小写目录;`@body` 声明状态,不写内部组件 IR。完整语法见仓库 `docs/compose-dil.md`。
|
|
124
126
|
|
|
125
127
|
```garden compose #compose-play-demo
|
|
126
128
|
caption: 拧一下席位,看月费。
|
|
@@ -202,3 +204,10 @@ intent: |
|
|
|
202
204
|
<stat label="预测最佳时间" value={best} />
|
|
203
205
|
```
|
|
204
206
|
|
|
207
|
+
|
|
208
|
+
## 自定义文字与背景颜色
|
|
209
|
+
|
|
210
|
+
`color` 设置文字颜色(子内容继承,可在子级覆盖);`backgroundColor` 设置当前容器背景(不继承)。支持 CSS 命名色、`transparent`、`currentColor`、#RGB/#RGBA/#RRGGBB/#RRGGBBAA、rgb()/rgba()/hsl()/hsla()(含 alpha);不接受 url()、var()、calc()、任意 CSS 声明或 style。未指定时保留原 tone / 主题配色。背景可用透明度,不改变字体家族。
|
|
211
|
+
|
|
212
|
+
静态:box/card、row/stack/columns/grid/grid-item、pill/band、group/field/header/footer/figure、title/text/caption/label/prose/badge、kpi/stat、list、table/tr/th/td/thead/tbody。Play:stack/columns/card/caption/badge/stat/table;两项颜色必须写字面量。静态的 `background` 仍是已有语义 token。图表的 palette/tone API 不变,不能把 color 当系列颜色。显式颜色不会自动切换深色主题,作者需检查对比度。
|
|
213
|
+
|
|
@@ -9,7 +9,7 @@ order: 45
|
|
|
9
9
|
图片单独成段时会包进图框,并在下方显示图注。
|
|
10
10
|
|
|
11
11
|
- **什么时候用**:这张图属于文章,读者需要看到图下说明。
|
|
12
|
-
- **什么时候不用**:只是装饰时,把 `alt` 写成以 `image`、`截图` 或 `img` 开头的占位词,这样不会出现图注。要按部分点开说明时用[说明图](/garden/components/compose);要提供下载时用[文件下载与预览](/garden/components/
|
|
12
|
+
- **什么时候不用**:只是装饰时,把 `alt` 写成以 `image`、`截图` 或 `img` 开头的占位词,这样不会出现图注。要按部分点开说明时用[说明图](/garden/components/compose);要提供下载时用[文件下载与预览](/garden/components/compose)。
|
|
13
13
|
|
|
14
14
|
长文 `content/posts/my-post.md` 的配图放在同名目录 `content/posts/my-post/`。正文用 Markdown 图片语法引用,地址写成 `./my-post/diagram.svg`,方括号里的 `alt` 写成图注。
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ order: 43
|
|
|
9
9
|
单独占一段的网址,或链接末尾紧跟 `{card}`,会渲染成链接卡片(同站与外站同一套逻辑)。正文里带标题的普通链接不会变成卡片,例如 [Typora](https://typora.io/):外站只在文字前加站点 Favicon,右上角标 `↗`,图标与第一个字留在同一行;同站标题链接仍在站内跳转。
|
|
10
10
|
|
|
11
11
|
- **什么时候用**:希望读者点开之前先看到网站名、标题和简介。
|
|
12
|
-
- **什么时候不用**:句子里只要标出出处时用[来源胶囊](/garden/components/source);要自己写几条要点时用[知识卡片](/garden/components/
|
|
12
|
+
- **什么时候不用**:句子里只要标出出处时用[来源胶囊](/garden/components/source);要自己写几条要点时用[知识卡片](/garden/components/compose)。
|
|
13
13
|
|
|
14
14
|
## 单独一行的网址
|
|
15
15
|
|
|
@@ -43,7 +43,7 @@ https://spec.commonmark.org/
|
|
|
43
43
|
|
|
44
44
|
`{card}` 写在代码里会原样显示,例如 `[文字](https://example.com){card}`。标记和 `)` 之间有空格时也不会变成卡片。同站与外站的跳链共用同一套卡片路径。
|
|
45
45
|
|
|
46
|
-
构建时读取正文里的 `{card}` 链接,以及单独成段的网址,把对方页面的标题、简介和封面记入
|
|
46
|
+
构建时读取正文里的 `{card}` 链接,以及单独成段的网址,把对方页面的标题、简介和封面记入 `.garden/link-assets.json`(同站与外站同一套抓取;HTML meta refresh 会跟着跳到目标页再读 OG)。抓取失败就沿用上次的结果,构建不会因此中断。只刷新这些信息时运行 `npx garden links`。离线构建时把 `GARDEN_OFFLINE` 设为 `1` 会跳过拉取。
|
|
47
47
|
|
|
48
48
|
随想 Front Matter 里的 `type: link` 用你写的 `title`、`description` 和 `image`,字段见[写文章与随想](/garden/writing)。
|
|
49
49
|
|
|
@@ -1,221 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 组件总览
|
|
3
3
|
navTitle: 组件总览
|
|
4
|
-
description:
|
|
4
|
+
description: 组件总览
|
|
5
5
|
section: components
|
|
6
6
|
order: 30
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
文章布局、富文本、语义场景与交互说明统一使用一个 `garden compose` 围栏。在入口内部选择并组合组件;普通 Markdown 已能表达清楚时不用增加组件。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
meta: 文档说明 · sqlite.org
|
|
15
|
-
description: 把修改先顺序追加到预写日志,读操作继续访问原数据库页,减少读写互斥等待。
|
|
16
|
-
points:
|
|
17
|
-
- 写入只追加到 `-wal` 文件末尾,不需要在事务提交时原地覆盖数据页。
|
|
18
|
-
- 读事务记录当前末尾偏移量即可看到一致快照,不会阻塞并发写入。
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## [数字指标 · stat](/garden/components/stat)
|
|
22
|
-
|
|
23
|
-
```garden stat
|
|
24
|
-
items:
|
|
25
|
-
- label: 正文列宽
|
|
26
|
-
value: "740"
|
|
27
|
-
unit: px
|
|
28
|
-
caption: 默认阅读列宽度
|
|
29
|
-
- label: 宽图上限
|
|
30
|
-
value: "1040"
|
|
31
|
-
unit: px
|
|
32
|
-
caption: 左右各最多外扩 150px
|
|
33
|
-
- label: 宽表上限
|
|
34
|
-
value: "1340"
|
|
35
|
-
unit: px
|
|
36
|
-
caption: 左右各最多外扩 300px
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## [并排对比 · compare](/garden/components/compare)
|
|
40
|
-
|
|
41
|
-
```garden compare
|
|
42
|
-
items:
|
|
43
|
-
- title: 写一句话说明改了什么
|
|
44
|
-
text: 想法块紧跟在完整代码下面,AI 把它换成 diff,页面合成「代码 / 对比上一版」。
|
|
45
|
-
- title: 手写 diff
|
|
46
|
-
text: 完整代码下面紧跟一段 diff。
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## [时间线 · timeline](/garden/components/timeline)
|
|
50
|
-
|
|
51
|
-
```garden timeline
|
|
52
|
-
items:
|
|
53
|
-
- date: 步骤 1
|
|
54
|
-
title: 同步内容与静态资源
|
|
55
|
-
text: 校验 Front Matter、复制图片附件并生成搜索索引与 RSS。
|
|
56
|
-
- date: 步骤 2
|
|
57
|
-
title: 构建静态站点产物
|
|
58
|
-
text: 把全部路由预渲染到静态目录。
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## [条形图表 · chart](/garden/components/chart)
|
|
62
|
-
|
|
63
|
-
```garden chart
|
|
64
|
-
title: 三种版面区域的宽度上限
|
|
65
|
-
xLabel: 版面区域
|
|
66
|
-
yLabel: 最大宽度
|
|
67
|
-
unit: px
|
|
68
|
-
data:
|
|
69
|
-
- x: 普通正文列
|
|
70
|
-
y: 740
|
|
71
|
-
- x: 宽幅配图区
|
|
72
|
-
y: 1040
|
|
73
|
-
- x: 多列宽表格
|
|
74
|
-
y: 1340
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## [说明图 · compose](/garden/components/compose)
|
|
78
|
-
|
|
79
|
-
```garden compose
|
|
80
|
-
<intent>
|
|
81
|
-
上面一行是交付顺序:理解需求、设计方案、开发上线。下面一行才是要强调的决策循环:提出假设、低成本验证、迭代或放弃。上面是背景,下面是重点。
|
|
82
|
-
</intent>
|
|
83
|
-
<row align="center">
|
|
84
|
-
<title align="center">理解需求</title>
|
|
85
|
-
<arrow dir="right"/>
|
|
86
|
-
<title align="center">设计方案</title>
|
|
87
|
-
<arrow dir="right"/>
|
|
88
|
-
<title align="center">开发上线</title>
|
|
89
|
-
</row>
|
|
90
|
-
<divider/>
|
|
91
|
-
<row align="center">
|
|
92
|
-
<pill tone="muted">提出假设</pill>
|
|
93
|
-
<arrow dir="right"/>
|
|
94
|
-
<pill tone="muted">低成本验证</pill>
|
|
95
|
-
<arrow dir="right"/>
|
|
96
|
-
<pill tone="muted">迭代或放弃</pill>
|
|
97
|
-
</row>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## [嵌入网页片段 · html](/garden/components/html)
|
|
101
|
-
|
|
102
|
-
```garden html
|
|
103
|
-
title: 字符长度小工具
|
|
104
|
-
code: |
|
|
105
|
-
<!doctype html>
|
|
106
|
-
<html lang="zh-CN">
|
|
107
|
-
<head>
|
|
108
|
-
<meta charset="utf-8" />
|
|
109
|
-
<style>
|
|
110
|
-
body { margin: 0; padding: 16px 18px; font: 14px/1.6 system-ui, sans-serif; color: #1b1a18; background: #faf9f5; }
|
|
111
|
-
input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d5d1c8; border-radius: 6px; font: inherit; background: #fff; color: #1b1a18; }
|
|
112
|
-
.meta { margin-top: 10px; color: #6e6b64; font-variant-numeric: tabular-nums; }
|
|
113
|
-
strong { color: #1b1a18; }
|
|
114
|
-
</style>
|
|
115
|
-
</head>
|
|
116
|
-
<body>
|
|
117
|
-
<input id="txt" value="把文章放在自己的 Git 仓库里,推送后自动构建。" aria-label="输入示例文本" />
|
|
118
|
-
<div class="meta">当前字符数:<strong id="count">23</strong> 字</div>
|
|
119
|
-
<script>
|
|
120
|
-
const input = document.getElementById("txt");
|
|
121
|
-
const count = document.getElementById("count");
|
|
122
|
-
input.addEventListener("input", () => { count.textContent = String(input.value.length); });
|
|
123
|
-
</script>
|
|
124
|
-
</body>
|
|
125
|
-
</html>
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## [可调公式与参数 · interactive](/garden/components/interactive)
|
|
129
|
-
|
|
130
|
-
```garden compose #overview-reading
|
|
131
|
-
caption: 示例:按字数和阅读速度估算阅读时间。
|
|
132
|
-
---
|
|
133
|
-
<State words={6000} speed={400} />
|
|
134
|
-
<Let minutes={round(words / speed)} />
|
|
135
|
-
|
|
136
|
-
<Slider bind="words" label="正文字数" min={1000} max={20000} step={500} unit="字" />
|
|
137
|
-
<Slider bind="speed" label="阅读速度" min={200} max={800} step={50} unit="字/分钟" />
|
|
138
|
-
|
|
139
|
-
<Stat label="预计阅读时间" value={minutes} unit="分钟" />
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## [文件下载与预览 · file](/garden/components/file)
|
|
143
|
-
|
|
144
|
-
```garden file
|
|
145
|
-
src: ./components/file/checklist.md
|
|
146
|
-
title: 发布前检查清单
|
|
147
|
-
note: 可点击「预览」在当前页展开阅读,或直接下载原文件
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## [关系图 · relations](/garden/components/relations)
|
|
151
|
-
|
|
152
|
-
```garden relations
|
|
153
|
-
items:
|
|
154
|
-
- title: 选书
|
|
155
|
-
text: 定下这个月读什么
|
|
156
|
-
- title: 共读
|
|
157
|
-
text: 每周读完约定的章节
|
|
158
|
-
- title: 讨论
|
|
159
|
-
text: 见面聊各自的看法
|
|
160
|
-
- title: 复盘
|
|
161
|
-
text: 记下下次要改的地方
|
|
162
|
-
links:
|
|
163
|
-
- from: 1
|
|
164
|
-
to: 2
|
|
165
|
-
- from: 2
|
|
166
|
-
to: 3
|
|
167
|
-
- from: 3
|
|
168
|
-
to: 4
|
|
169
|
-
- from: 4
|
|
170
|
-
to: 1
|
|
171
|
-
- from: 3
|
|
172
|
-
to: 1
|
|
173
|
-
style: dashed
|
|
174
|
-
label: 影响选书
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## [图标列表 · list](/garden/components/list)
|
|
178
|
-
|
|
179
|
-
```garden list
|
|
180
|
-
items:
|
|
181
|
-
- icon: search
|
|
182
|
-
text: 搜索这个月的书名
|
|
183
|
-
- icon: eye
|
|
184
|
-
text: 看了 3 篇书评
|
|
185
|
-
- icon: heart
|
|
186
|
-
text: 收藏了活动页面
|
|
187
|
-
- icon: chat
|
|
188
|
-
text: 在群里问能不能只听不说
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## [选择卡 · choice](/garden/components/choice)
|
|
192
|
-
|
|
193
|
-
```garden choice
|
|
194
|
-
title: 下个月在哪里见面?
|
|
195
|
-
items:
|
|
196
|
-
- icon: idea
|
|
197
|
-
value: ¥40 / 人
|
|
198
|
-
text: 街角咖啡馆,含一杯饮料
|
|
199
|
-
label: 更看重氛围
|
|
200
|
-
reply: 选了咖啡馆。我们会提前订好靠窗的长桌。
|
|
201
|
-
- icon: book
|
|
202
|
-
value: 免费
|
|
203
|
-
text: 社区图书馆活动室,需提前预约
|
|
204
|
-
label: 更看重安静
|
|
205
|
-
reply: 选了图书馆。我们会在月初提交预约。
|
|
206
|
-
none:
|
|
207
|
-
label: 都不合适 / 说不清
|
|
208
|
-
reply: 没关系,我们会在群里再列几个场地。
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## [链接卡片 · {card}](/garden/components/link-card)
|
|
212
|
-
|
|
213
|
-
[KaTeX 支持的函数](https://katex.org/docs/supported.html){card}
|
|
214
|
-
|
|
215
|
-
## [来源胶囊 · {source}](/garden/components/source)
|
|
216
|
-
|
|
217
|
-
引自维基百科 [wikipedia.org](https://en.wikipedia.org/wiki/Book_discussion_club){source}
|
|
218
|
-
|
|
219
|
-
## [本地图片](/garden/components/image)
|
|
220
|
-
|
|
221
|
-

|
|
11
|
+
- [Compose](/garden/components/compose)
|
|
12
|
+
- [Compose reference](/garden/reference/compose)
|
|
13
|
+
- [Icons](/garden/reference/compose-icons)
|
package/docs/handbook/deploy.md
CHANGED
|
@@ -38,6 +38,17 @@ jobs:
|
|
|
38
38
|
steps:
|
|
39
39
|
- uses: actions/checkout@v7
|
|
40
40
|
|
|
41
|
+
- name: Restore generated Garden caches
|
|
42
|
+
uses: actions/cache@v4
|
|
43
|
+
with:
|
|
44
|
+
path: |
|
|
45
|
+
.garden/image-sizes.json
|
|
46
|
+
.garden/link-assets.json
|
|
47
|
+
public/link-assets
|
|
48
|
+
key: ${{ runner.os }}-garden-generated-v1-${{ github.ref_name }}-${{ github.run_id }}
|
|
49
|
+
restore-keys: |
|
|
50
|
+
${{ runner.os }}-garden-generated-v1-${{ github.ref_name }}-
|
|
51
|
+
|
|
41
52
|
- uses: actions/setup-node@v7
|
|
42
53
|
with:
|
|
43
54
|
node-version: 22
|