feat: 将视觉模板合并到运行时工作空间

This commit is contained in:
que01 committed 2026-09-22 23:18:03 +08:00
1 parent 9feea651a0
commit 65f0e0c92a
3 files changed
+29 -2

No files matched your search

+22 -2
View File
@@ -39,7 +39,7 @@ import type { TransformFnParams } from "class-transformer";
import { IsBoolean, IsEnum, IsOptional, IsString } from "class-validator";
import { readIdentity, signIdentity } from "./auth.js";
import { ApiExceptionFilter, RequestIdMiddleware } from "./http.js";
import { getBrandTemplate, resolveCapabilities } from "@personal-brand/config";
import { getBrandTemplate, getVisualTemplate, resolveCapabilities } from "@personal-brand/config";
import { AdminWorkspaceController } from "./admin-workspace.controller.js";
import { TemplateWorkspaceService } from "./template-workspace.service.js";
import type {
@@ -138,6 +138,16 @@ export class PublicWorkspaceController {
]);
const templateKey = installation?.templateKey ?? brand?.templateKey ?? "personal";
const template = getBrandTemplate(templateKey);
const brandConfig =
brand?.config && typeof brand.config === "object" && !Array.isArray(brand.config)
? (brand.config as Record<string, unknown>)
: {};
const visualTemplateKey =
typeof brandConfig.visualTemplateKey === "string"
? brandConfig.visualTemplateKey
: "linjing-editorial";
const visualTemplate =
getVisualTemplate(visualTemplateKey) ?? getVisualTemplate("linjing-editorial");
const runtimeModules: RuntimeModule[] = modules.map((module) => ({
key: module.type,
type: this.moduleType(module.type),
@@ -222,7 +232,9 @@ export class PublicWorkspaceController {
status: "enabled" as const,
}),
),
theme: { colors: { background: "#F7F5F1", foreground: "#252525", accent: "#8A6846" } },
theme: visualTemplate?.theme ?? {
colors: { background: "#F7F5F1", foreground: "#252525", accent: "#8A6846" },
},
};
return {
...runtimeWorkspace,
@@ -235,6 +247,14 @@ export class PublicWorkspaceController {
name: template.name,
}
: null,
visualTemplate: visualTemplate
? {
key: visualTemplate.key,
version: visualTemplate.version,
name: visualTemplate.name,
variants: visualTemplate.variants,
}
: null,
capabilities: template?.capabilities ?? [],
runtimeCapabilities: template ? resolveCapabilities(template.capabilities) : [],
modules,
+1
View File
@@ -42,6 +42,7 @@
- [x] 建立固定页面状态、视口和视觉锚点清单,可供后续截图回归执行。
- [ ] Phase 3:模板中心、安装快照、升级和回滚。
- [x] 建立行业模板与视觉模板注册表,并注册林境建筑画册与极简留白视觉模板。
- [x] Runtime Workspace 合并品牌配置中的视觉模板主题、版本和模块变体。
- [ ] Phase 4:Capability Plugin。
- [ ] Phase 5:林境门作与第二行业双模板验证。
- [ ] Phase 6:Stitch 到 Manifest 的转换流水线。
+6
View File
@@ -202,6 +202,12 @@ export interface PublicWorkspace {
contractVersion: string;
brand: BrandProfile | null;
template: { key: BrandTemplateKey; version: string; name: string } | null;
visualTemplate?: {
key: string;
version: string;
name: string;
variants: Record<string, string>;
} | null;
capabilities: string[];
modules: BrandModule[];
runtimeModules: Array<{