Rebuild DEEG as a fifth installation, add stepped forms and a plugin system, and clear the review backlog

Forms gained steps, conditions, image choices, number fields with units and a
summary step; the DEEG price finder uses all of it. Plugins are manifest plus
Twig: blocks, settings, containers, routes, presets and theme packs, switched
per installation. The review backlog is done: archive pages render through the
normal page pipeline, forms and post lists work inside areas and sections,
repeated sections get their own ids, breakpoints and colours come from the
palette, backup and update work on MySQL and lock each other out.

The task worker no longer shortens a process that has no time limit:
set_time_limit() sets the limit instead of extending it, which turned an
unlimited CLI run into eighty seconds and killed the full test suite far away
from the scheduler.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
kantarciandClaude Opus 5 committed 2026-09-16 07:32:35 +02:00
1 parent 66ff68abf8
commit c8a8fa7460
74 files changed
+5352 -243

No files matched your search

+55 -3
View File
@@ -30,10 +30,35 @@ export function whyNot(type) {
}
export const PLUGIN_TYPE = /^[a-z][a-z0-9]{1,30}\.[a-z][a-z0-9-]{1,40}$/;
/**
* Die Bausteine der aktiven Plugins, vom Server mit dem Dokument geliefert. Sie bekommen
* Beschriftung, Symbol, Vorgaben und eine eigene Gruppe im Werkzeugkasten; was das Dokument
* enthält, aber hier nicht steht, bleibt ein Baustein einer fehlenden Erweiterung.
*/
export const PLUGIN_BLOCKS = {};
/** Die Seitenvorlagen der aktiven Plugins: id => {label, blocks}. */
export const PLUGIN_PRESETS = {};
export function registerPlugins(list, presets = []) {
for (const key of Object.keys(PLUGIN_BLOCKS)) { delete PLUGIN_BLOCKS[key]; delete labels[key]; delete icons[key]; }
for (const key of Object.keys(PLUGIN_PRESETS)) delete PLUGIN_PRESETS[key];
for (const preset of presets || []) if (typeof preset?.id === 'string' && Array.isArray(preset.blocks)) PLUGIN_PRESETS[preset.id] = preset;
const types = [];
for (const definition of list || []) {
if (!PLUGIN_TYPE.test(definition?.type || '')) continue;
PLUGIN_BLOCKS[definition.type] = definition;
labels[definition.type] = definition.label;
icons[definition.type] = definition.icon || '⬡';
types.push(definition.type);
}
const group = CATEGORIES.find(category => category.name === 'Erweiterungen');
if (group) group.types = types;
else if (types.length) CATEGORIES.push({ name: 'Erweiterungen', hint: 'Bausteine der eingeschalteten Plugins.', types });
}
export const pluginDefinition = block => PLUGIN_BLOCKS[block?.type] ?? null;
export const isPluginBlock = block => typeof block?.type === 'string' && PLUGIN_TYPE.test(block.type);
export const blockLabel = block => labels[block?.type] ?? (isPluginBlock(block) ? `Baustein ${block.type}` : 'Unbekannt');
export const blockIcon = block => icons[block?.type] ?? '❔';
export const isContainer = block => ['section', 'row', 'column', 'gallery', 'logos', 'accordion', 'accordionitem', 'tabs', 'tabitem', 'slider'].includes(block?.type);
export const isContainer = block => ['section', 'row', 'column', 'gallery', 'logos', 'accordion', 'accordionitem', 'tabs', 'tabitem', 'slider'].includes(block?.type) || PLUGIN_BLOCKS[block?.type]?.container === true;
// Nothing may be dropped into a plugin block: the core does not know its layout contract.
// Containers that accept only one kind of child, mirrored by the server side validator.
// ---------------------------------------------------------------------------------------------
@@ -68,8 +93,10 @@ export const REQUIRE = { column: ['row', 'section'], accordionitem: ['accordion'
*/
export const ROOT_NEEDS_CONTAINER = ['row'];
export const canContain = (parent, block) => isContainer(parent) && !isPluginBlock(parent)
&& (ALLOW[parent.type] === undefined || ALLOW[parent.type].includes(block?.type))
// Ein Plugin-Container nimmt auf, was sein Manifest erlaubt; ein Plugin ohne Definition nichts.
const allowedIn = parent => PLUGIN_BLOCKS[parent?.type] ? (PLUGIN_BLOCKS[parent.type].children ?? undefined) : ALLOW[parent?.type];
export const canContain = (parent, block) => isContainer(parent) && (!isPluginBlock(parent) || PLUGIN_BLOCKS[parent.type]?.container === true)
&& (allowedIn(parent) === undefined || allowedIn(parent).includes(block?.type))
&& (block?.type === undefined || REQUIRE[block.type] === undefined || REQUIRE[block.type].includes(parent.type));
export const clone = value => structuredClone(value);
@@ -86,6 +113,11 @@ export function locate(blocks, id, parent = null) {
export function createBlock(type) {
if (!Object.hasOwn(labels, type)) throw new Error('Unbekannter Block.');
const block = { id: `b_${crypto.randomUUID().replaceAll('-', '')}`, type };
if (PLUGIN_BLOCKS[type]) {
block.props = Object.fromEntries(Object.entries(PLUGIN_BLOCKS[type].props || {}).map(([key, schema]) => [key, schema.default ?? '']));
if (PLUGIN_BLOCKS[type].container) block.children = [];
return block;
}
if (isContainer(block)) block.children = [];
if (type === 'accordion') block.children = [createBlock('accordionitem')];
// A single tab is not a tab group, and the script needs at least two to enhance anything.
@@ -121,6 +153,7 @@ export function createBlock(type) {
/** Raises the document schema to the version that knows this block type. */
export function upgradeForType(document, type) {
if (type === 'gallery') upgradeDocument(document, 3);
if (PLUGIN_BLOCKS[type]) upgradeDocument(document, 4);
// Die Fassung, die der Server fuer die Eigenschaften verlangt, mit denen createBlock den
// Baustein anlegt - nicht die, in der der Typ zuerst auftauchte. Sonst steht ein neuer
// Baustein sofort mit 422 in der Vorschau und laesst sich nicht speichern.
@@ -436,8 +469,19 @@ export function insertRow(document, columns, selected) {
return place(document, buildRow(columns), target.parentId, target.index);
}
/** Frische Kennungen für eine Vorlage aus einem Plugin - jedes Einfügen ist ein eigener Baustein. */
const freshIds = blocks => blocks.map(block => ({ ...structuredClone(block), id: `b_${crypto.randomUUID().replaceAll('-', '')}`, ...(Array.isArray(block.children) ? { children: freshIds(block.children) } : {}) }));
export function insertPreset(document, name, selected) {
if (name === 'hero') return insertHero(document, selected);
if (PLUGIN_PRESETS[name]) {
const blocks = freshIds(PLUGIN_PRESETS[name].blocks);
const top = blockPath(document.blocks, selected)[0];
const index = top ? document.blocks.findIndex(block => block.id === top.id) + 1 : document.blocks.length;
document.blocks.splice(index, 0, ...blocks);
upgradeDocument(document, SCHEMA_VERSION);
return blocks[0].id;
}
if (!['intro', 'columns', 'cta'].includes(name)) throw new Error('Unbekannte Vorlage.');
const section = createBlock('section');
const heading = text => { const block = createBlock('heading'); block.props.text = text; return block; };
@@ -471,6 +515,14 @@ export class EditorHistory {
this.mergeKey = null;
this.saved = JSON.stringify(document);
}
/** Uebernimmt die vom Server bereinigte Fassung als aktuellen Stand, der Verlauf bleibt. */
adopt(document) {
this.past.push(this.document);
if (this.past.length > 100) this.past.shift();
this.document = clone(document);
this.future = [];
this.mergeKey = null;
}
change(mutator, mergeKey = null) {
const next = clone(this.document);
const result = mutator(next);