since3-portal/modules/templates/catalog/blocks/builder.ts
2026-10-11 18:22:32 +02:00

18 lines
871 B
TypeScript

import { defineTemplate, describeSections } from "../../lib/content"
import type { BlockSeed, TemplateDefinition } from "../../lib/types"
import { blockLibrary } from "./definitions"
import type { BrandData } from "./types"
type BuilderOptions = Omit<TemplateDefinition, "sections" | "defaults" | "builder"> & { brand: BrandData; seed: BlockSeed[] }
// Vorlage aus Bausteinen: „Marke & Kontakt“ ist die einzige feste Sektion, alles andere sind Bausteine,
// die im Editor frei hinzugefügt, sortiert und entfernt werden. `seed` ist die Startaufstellung.
export function defineBuilder({ brand, seed, ...template }: BuilderOptions) {
const defaults = { brand }
return defineTemplate({
...template,
sections: describeSections(defaults, { brand: "Marke & Kontakt" }),
defaults,
builder: { library: blockLibrary, seed },
})
}