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