29 lines
1.6 KiB
JavaScript
29 lines
1.6 KiB
JavaScript
const CORE_MODULES = {
|
|
brandHero: { key: "brand-hero", variants: ["architectural", "portrait", "editorial"] },
|
|
founderCard: { key: "founder-card", variants: ["compact", "contact"] },
|
|
trustProof: { key: "trust-proof", variants: ["stats", "manifesto", "timeline"] },
|
|
offeringList: { key: "offering-list", variants: ["image-first", "editorial", "square-card"] },
|
|
offeringDetail: { key: "offering-detail", variants: ["project-case", "product-spec", "service-process"] },
|
|
inquiry: { key: "inquiry", variants: ["standard", "project-brief", "booking"] },
|
|
records: { key: "records", variants: ["timeline", "list"] },
|
|
profile: { key: "profile", variants: ["contact", "editorial"] },
|
|
};
|
|
|
|
const FALLBACK_THEME = {
|
|
colors: { background: "#F7F5F1", surface: "#FFFFFF", foreground: "#252525", muted: "#77736B", accent: "#8A6846", dark: "#202221", border: "#E6DED5" },
|
|
radius: { card: "16rpx", control: "8rpx" },
|
|
spacing: { page: "32rpx", section: "28rpx" },
|
|
};
|
|
|
|
function resolveModule(module) {
|
|
const known = Object.values(CORE_MODULES).find((entry) => entry.key === module.type);
|
|
return { ...module, variant: module.variant || (known ? known.variants[0] : "default"), supported: Boolean(known || module.type === "custom") };
|
|
}
|
|
|
|
function resolveRuntime(workspace) {
|
|
const modules = Array.isArray(workspace && workspace.modules) ? workspace.modules : [];
|
|
return { theme: workspace && workspace.theme ? workspace.theme : FALLBACK_THEME, modules: modules.map(resolveModule), capabilities: workspace && Array.isArray(workspace.capabilities) ? workspace.capabilities : [] };
|
|
}
|
|
|
|
module.exports = { CORE_MODULES, FALLBACK_THEME, resolveRuntime };
|