From 9feea651a020f223849bbdf50aea4179c67fcaf9 Mon Sep 17 00:00:00 2001 From: que01 Date: Tue, 22 Sep 2026 23:14:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BB=BA=E7=AB=8B=E8=A1=8C=E4=B8=9A?= =?UTF-8?q?=E4=B8=8E=E8=A7=86=E8=A7=89=E6=A8=A1=E6=9D=BF=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/template-registry.md | 26 +++++++++++++++++++++ docs/template-runtime-progress.md | 1 + packages/config/src/index.ts | 39 +++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 docs/template-registry.md diff --git a/docs/template-registry.md b/docs/template-registry.md new file mode 100644 index 0000000..e7bbf2f --- /dev/null +++ b/docs/template-registry.md @@ -0,0 +1,26 @@ +# 模板注册表 + +模板采用“行业模板 + 视觉模板”组合,不再为每个行业复制一套小程序代码。 + +## 当前注册 + +### 行业模板 + +- `personal@1.0.0`:个人品牌基线。 +- `food@1.0.0`:餐饮业务表达示例。 + +### 视觉模板 + +- `linjing-editorial@1.0.0`:林境建筑画册,适合高端定制和项目型业务。 +- `minimal-neutral@1.0.0`:极简留白,适合咨询、设计和专业服务。 + +## 组合规则 + +行业模板决定字段、Offering schema、表单用途和能力依赖;视觉模板决定模块变体、主题 token 和页面表达。安装结果必须保存行业模板和视觉模板的版本快照,后续升级只能显式执行并提供差异预览。 + +## 后续 + +1. Prisma 增加视觉模板安装快照字段; +2. Admin 模板中心展示行业 / 视觉模板组合预览; +3. Runtime Workspace 合并两类模板的模块和主题; +4. 为每个组合生成 fixture 和视觉回归基线。 diff --git a/docs/template-runtime-progress.md b/docs/template-runtime-progress.md index 2742749..8b6454a 100644 --- a/docs/template-runtime-progress.md +++ b/docs/template-runtime-progress.md @@ -41,6 +41,7 @@ - [x] 建立林境门作模板 fixture 和标准模块 / 页面完整性检查。 - [x] 建立固定页面状态、视口和视觉锚点清单,可供后续截图回归执行。 - [ ] Phase 3:模板中心、安装快照、升级和回滚。 +- [x] 建立行业模板与视觉模板注册表,并注册林境建筑画册与极简留白视觉模板。 - [ ] Phase 4:Capability Plugin。 - [ ] Phase 5:林境门作与第二行业双模板验证。 - [ ] Phase 6:Stitch 到 Manifest 的转换流水线。 diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index 7da3622..0fe91a2 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -1,6 +1,7 @@ export const configPackageName = "personal-brand-config"; export type BrandTemplateKey = "personal" | "food"; +export type VisualTemplateKey = "linjing-editorial" | "minimal-neutral"; export type CapabilityKey = "offerings" | "inquiry" | "booking"; export interface WorkflowDefinition { @@ -65,6 +66,44 @@ export interface BrandTemplateDefinition { capabilities: CapabilityKey[]; } +export interface VisualTemplateDefinition { + key: VisualTemplateKey; + version: string; + name: string; + description: string; + variants: Record; + theme: { colors: Record; radius: Record }; +} + +export const visualTemplates: Record = { + "linjing-editorial": { + key: "linjing-editorial", + version: "1.0.0", + name: "林境建筑画册", + description: "适合高端定制、建筑作品和项目型个人品牌。", + variants: { hero: "architectural", offeringList: "editorial", detail: "project-case" }, + theme: { + colors: { background: "#F7F5F1", foreground: "#252525", accent: "#8A6846", dark: "#202221" }, + radius: { card: "16rpx" }, + }, + }, + "minimal-neutral": { + key: "minimal-neutral", + version: "1.0.0", + name: "极简留白", + description: "适合咨询、设计和专业服务型个人品牌。", + variants: { hero: "minimal", offeringList: "square-card", detail: "service-process" }, + theme: { + colors: { background: "#FAFAF8", foreground: "#202221", accent: "#4B5563", dark: "#202221" }, + radius: { card: "8rpx" }, + }, + }, +}; + +export function getVisualTemplate(key: string): VisualTemplateDefinition | undefined { + return visualTemplates[key as VisualTemplateKey]; +} + export function canTransitionWorkflow(workflowKey: string, from: string, to: string): boolean { const workflow = workflowRegistry[workflowKey as keyof typeof workflowRegistry] as WorkflowDefinition | undefined;