refactor: 拆分模板配置契约与注册逻辑
This commit is contained in:
1 parent
7e1dd543fb
commit
d0902d6568
12 files changed
+1025
-945
No files matched your search
@@ -0,0 +1,124 @@
|
||||
import type { BrandTemplateKey } from "./template-keys.js";
|
||||
import type { CapabilityKey } from "./template-keys.js";
|
||||
import type { VisualTemplateKey } from "./template-keys.js";
|
||||
|
||||
export type BrandTemplateModuleType = "identity" | "trust" | "offering" | "inquiry" | "contact";
|
||||
|
||||
export interface BrandTemplateModuleDefinition {
|
||||
key: string;
|
||||
type: BrandTemplateModuleType;
|
||||
title: string;
|
||||
required: boolean;
|
||||
}
|
||||
export interface BrandTemplateFieldDefinition {
|
||||
scope: string;
|
||||
key: string;
|
||||
label: string;
|
||||
type: string;
|
||||
required: boolean;
|
||||
}
|
||||
|
||||
export interface BrandTemplateDefinition {
|
||||
key: BrandTemplateKey;
|
||||
version: string;
|
||||
name: string;
|
||||
description: string;
|
||||
serviceCategories: string[];
|
||||
trustContentTypes: string[];
|
||||
modules: BrandTemplateModuleDefinition[];
|
||||
fields: BrandTemplateFieldDefinition[];
|
||||
capabilities: CapabilityKey[];
|
||||
}
|
||||
|
||||
export interface VisualTemplateDefinition {
|
||||
key: VisualTemplateKey;
|
||||
version: string;
|
||||
name: string;
|
||||
description: string;
|
||||
supportedIndustryTemplates: readonly BrandTemplateKey[];
|
||||
variants: Record<string, string>;
|
||||
theme: { colors: Record<string, string>; radius: Record<string, string> };
|
||||
layout?: { home: string[]; offerings: string[]; detail: string[]; profile: string[] };
|
||||
}
|
||||
|
||||
export type VisualPageKey =
|
||||
"home" | "offerings" | "detail" | "inquiry" | "success" | "records" | "profile";
|
||||
|
||||
export type VisualModuleType =
|
||||
| "brand-identity"
|
||||
| "hero"
|
||||
| "trust"
|
||||
| "offering-list"
|
||||
| "offering-detail"
|
||||
| "inquiry-form"
|
||||
| "success-summary"
|
||||
| "records-list"
|
||||
| "contact";
|
||||
|
||||
export interface VisualTokenSet {
|
||||
colors: Record<string, string>;
|
||||
spacing: Record<string, string>;
|
||||
typography: Record<string, string>;
|
||||
radius: Record<string, string>;
|
||||
shadows?: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface VisualAssetSlot {
|
||||
key: string;
|
||||
label: string;
|
||||
required: boolean;
|
||||
kind: "image" | "icon" | "logo" | "texture";
|
||||
aspectRatio?: string;
|
||||
fallback?: string;
|
||||
}
|
||||
|
||||
export interface VisualDataSlot {
|
||||
key: string;
|
||||
source: "brand" | "trust" | "offering" | "inquiry" | "records" | "profile";
|
||||
required: boolean;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface VisualModuleDefinition {
|
||||
key: string;
|
||||
type: VisualModuleType;
|
||||
variant: string;
|
||||
required: boolean;
|
||||
dataSlots?: string[];
|
||||
assetSlots?: string[];
|
||||
capability?: CapabilityKey;
|
||||
}
|
||||
|
||||
export interface VisualPageDefinition {
|
||||
key: VisualPageKey;
|
||||
title: string;
|
||||
renderer?: string;
|
||||
modules: VisualModuleDefinition[];
|
||||
}
|
||||
|
||||
export interface VisualTemplateManifest {
|
||||
schemaVersion: "1.0";
|
||||
key: VisualTemplateKey;
|
||||
version: string;
|
||||
name: string;
|
||||
description: string;
|
||||
supportedIndustryTemplates: BrandTemplateKey[];
|
||||
brandFirst: true;
|
||||
tokens: VisualTokenSet;
|
||||
pages: VisualPageDefinition[];
|
||||
assets: VisualAssetSlot[];
|
||||
dataSlots: VisualDataSlot[];
|
||||
capabilities: CapabilityKey[];
|
||||
}
|
||||
|
||||
export interface TemplatePackage {
|
||||
manifest: VisualTemplateManifest;
|
||||
industryTemplateKey: BrandTemplateKey;
|
||||
content: Record<string, unknown>;
|
||||
forms: Record<string, unknown>[];
|
||||
capabilityConfig: Record<string, unknown>;
|
||||
fixtures: {
|
||||
runtime: Record<string, unknown>;
|
||||
visual: Record<string, unknown>;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user