Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cca069be48 | ||
|
|
f511ad10de |
No files matched your search
@@ -11,14 +11,17 @@
|
||||
* Abschnitts- und Slotmodell einer Seite: Seite → Abschnitte → Slots → Widget-Instanzen.
|
||||
*
|
||||
* Gespeicherte Hülle eines Abschnitts (Version 1):
|
||||
* {id, v, layout, style: {background, image, focus, overlay, width, spacing, spacing_top, divider}, slots: [Widget-Hülle|null, …]}
|
||||
* {id, v, layout, style: {background, image, focus, overlay, width, spacing_top, spacing_bottom, gap, divider}, slots: [Widget-Hülle|null, …]}
|
||||
*
|
||||
* Version 2 (Abstände): oben, unten und Widget-Abstand sind drei unabhängige Werte. Hüllen der Version 1 werden beim
|
||||
* Lesen übersetzt (SectionStyle::migrateSpacing), ohne die Darstellung zu ändern; gespeicherte Revisionen bleiben.
|
||||
*
|
||||
* Jeder Slot enthält höchstens ein Widget aus dem zentralen Widget-Register. Abschnitte sind nicht verschachtelbar.
|
||||
* Revisionen ohne Abschnitte (Bestand vor dieser Fassung) werden beim Lesen als einspaltige Abschnitte gelesen.
|
||||
*/
|
||||
class PageSections
|
||||
{
|
||||
public const VERSION = 1;
|
||||
public const VERSION = 2;
|
||||
|
||||
public const MAX_SECTIONS = 30;
|
||||
|
||||
@@ -41,10 +44,8 @@ public function read(?array $sections, ?array $blocks = null): array
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach (array_values($sections) as $section) {
|
||||
if (is_array($section)) {
|
||||
$result[] = $this->upcastSection($section);
|
||||
}
|
||||
foreach (SectionStyle::migrateSpacing(array_values(array_filter($sections, 'is_array')), byVersion: true) as $section) {
|
||||
$result[] = $this->upcastSection($section);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -74,6 +75,12 @@ public function normalize(array $content): array
|
||||
$seenWidgetIds = [];
|
||||
$widgetCount = 0;
|
||||
|
||||
// Eingaben mit Abständen der Version 1 (zum Beispiel ältere Aufrufer) werden wie beim Lesen übersetzt.
|
||||
$migrated = SectionStyle::migrateSpacing(array_map(
|
||||
fn ($item) => is_array($item) && array_key_exists('slots', $item) ? $item : ['style' => [], 'slots' => [$item]],
|
||||
$items,
|
||||
));
|
||||
|
||||
foreach ($items as $index => $item) {
|
||||
if (! is_array($item)) {
|
||||
$errors["sections.$index"] = ['Ein Abschnitt ist unvollständig.'];
|
||||
@@ -83,6 +90,8 @@ public function normalize(array $content): array
|
||||
|
||||
if (! array_key_exists('slots', $item)) {
|
||||
$item = ['id' => null, 'layout' => SectionLayouts::DEFAULT, 'style' => [], 'slots' => [$item]];
|
||||
} else {
|
||||
$item['style'] = $migrated[$index]['style'] ?? ($item['style'] ?? []);
|
||||
}
|
||||
|
||||
$sections[] = $this->normalizeSection($item, $index, $errors, $seenSectionIds, $seenWidgetIds, $widgetCount);
|
||||
@@ -164,13 +173,14 @@ private function wrapWidgets(array $blocks): array
|
||||
{
|
||||
$sections = [];
|
||||
|
||||
foreach ($this->widgets->read($blocks) as $widget) {
|
||||
foreach ($this->widgets->read($blocks) as $position => $widget) {
|
||||
$sections[] = [
|
||||
'id' => null,
|
||||
'v' => self::VERSION,
|
||||
'layout' => SectionLayouts::DEFAULT,
|
||||
// Bestand vor dem Raster stand in einem durchgehenden Blatt: kompakte Abstände kommen dem am nächsten.
|
||||
'style' => ['spacing' => 'compact'] + SectionStyle::DEFAULTS,
|
||||
// Bestand vor dem Raster stand in einem durchgehenden Blatt: kompakte Abstände, zwischen den Widgets
|
||||
// nur einmal (oben kein Abstand ab dem zweiten), wie bisher.
|
||||
'style' => ['spacing_top' => $position === 0 ? 'compact' : 'none', 'spacing_bottom' => 'compact', 'gap' => 'normal'] + SectionStyle::DEFAULTS,
|
||||
'slots' => [$widget],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -81,8 +81,9 @@ private function renderSection(array $section, array $cells, int $index): string
|
||||
'page-section',
|
||||
'section-bg-'.($hasImage ? 'image' : ($style['background'] === 'image' ? 'default' : $style['background'])),
|
||||
'section-width-'.$style['width'],
|
||||
'section-space-'.$style['spacing'],
|
||||
...($style['spacing_top'] !== 'same' ? ['section-space-top-'.$style['spacing_top']] : []),
|
||||
'section-space-top-'.$style['spacing_top'],
|
||||
'section-space-bottom-'.$style['spacing_bottom'],
|
||||
'section-gap-'.$style['gap'],
|
||||
'section-layout-'.str_replace('_', '-', $section['layout']),
|
||||
];
|
||||
|
||||
@@ -102,10 +103,6 @@ private function renderSection(array $section, array $cells, int $index): string
|
||||
$classes[] = $scope;
|
||||
}
|
||||
|
||||
if ($style['divider'] === 'space') {
|
||||
$classes[] = 'section-divider-space';
|
||||
}
|
||||
|
||||
$id = is_string($section['id'] ?? null) ? ' id="bereich-'.e($section['id']).'"' : '';
|
||||
$html = '<div class="'.e(implode(' ', $classes)).'"'.$id.'>';
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Domain\Cms\Sections;
|
||||
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
|
||||
/**
|
||||
* Semantische Abschnittsgestaltung. Jeder Wert ist eine Aufzählung, die auf zentrale Design-Tokens
|
||||
* abgebildet wird (resources/css/app.css, Abschnitt „Abschnitte“). Keine freie CSS- oder Farbangabe.
|
||||
@@ -25,29 +27,27 @@ final class SectionStyle
|
||||
'full' => 'Vollbreite',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
/**
|
||||
* Gemeinsame Stufen der drei Abstände eines Abschnitts (Hülle Version 2):
|
||||
* - spacing_top: Abstand vor dem Inhalt (oben),
|
||||
* - spacing_bottom: Abstand nach dem Inhalt (unten),
|
||||
* - gap: Abstand zwischen den Plätzen im Abschnittsraster, nebeneinander und gestapelt.
|
||||
* Zwischen zwei Abschnitten addieren sich „unten“ des ersten und „oben“ des zweiten; es gibt keine weitere
|
||||
* versteckte Vorgabe. Liegt eine eigene Fläche (Hintergrund) vor, liegen oben und unten innerhalb dieser Fläche.
|
||||
* Werte: resources/css/tokens.css (--section-space-*, --section-gap-*).
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public const SPACINGS = [
|
||||
'none' => 'Kein Abstand',
|
||||
'compact' => 'Kompakt',
|
||||
'normal' => 'Normal',
|
||||
'large' => 'Großzügig',
|
||||
];
|
||||
|
||||
/**
|
||||
* Abweichender Abstand oben, zum Beispiel damit ein Einstieg direkt unter der Kopfzeile beginnt.
|
||||
* Ergänzt „Abstand oben und unten“, ersetzt ihn nicht; der Abstand unten bleibt unverändert.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public const SPACINGS_TOP = [
|
||||
'same' => 'Wie „Abstand oben und unten“',
|
||||
'small' => 'Gering',
|
||||
'none' => 'Kein Abstand',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
public const DIVIDERS = [
|
||||
'none' => 'Kein Trenner',
|
||||
'space' => 'Zusätzlicher Abstand',
|
||||
'line' => 'Dezente Linie',
|
||||
'accent' => 'Markenakzent',
|
||||
];
|
||||
@@ -91,8 +91,9 @@ final class SectionStyle
|
||||
'focus' => 'center',
|
||||
'overlay' => 'light',
|
||||
'width' => 'standard',
|
||||
'spacing' => 'normal',
|
||||
'spacing_top' => 'same',
|
||||
'spacing_top' => 'compact',
|
||||
'spacing_bottom' => 'compact',
|
||||
'gap' => 'normal',
|
||||
'divider' => 'none',
|
||||
];
|
||||
|
||||
@@ -108,8 +109,9 @@ public static function enums(): array
|
||||
'focus' => self::FOCUS,
|
||||
'overlay' => self::OVERLAYS,
|
||||
'width' => self::WIDTHS,
|
||||
'spacing' => self::SPACINGS,
|
||||
'spacing_top' => self::SPACINGS_TOP,
|
||||
'spacing_top' => self::SPACINGS,
|
||||
'spacing_bottom' => self::SPACINGS,
|
||||
'gap' => self::SPACINGS,
|
||||
'divider' => self::DIVIDERS,
|
||||
];
|
||||
}
|
||||
@@ -118,7 +120,7 @@ public static function enums(): array
|
||||
* Lesepfad: gespeicherte Werte; Unbekanntes fällt auf die Vorgabe zurück, damit alte oder fremde Daten
|
||||
* nie eine Seite brechen.
|
||||
*
|
||||
* @return array{background: string, image: ?string, focus: string, overlay: string, width: string, spacing: string, spacing_top: string, divider: string}
|
||||
* @return array{background: string, image: ?string, focus: string, overlay: string, width: string, spacing_top: string, spacing_bottom: string, gap: string, divider: string}
|
||||
*/
|
||||
public static function fromStored(mixed $style): array
|
||||
{
|
||||
@@ -151,12 +153,13 @@ public static function summary(array $style): string
|
||||
$parts[] = self::WIDTHS[$style['width']];
|
||||
}
|
||||
|
||||
if ($style['spacing'] !== 'normal') {
|
||||
$parts[] = 'Abstand '.mb_strtolower(self::SPACINGS[$style['spacing']]);
|
||||
if ($style['spacing_top'] !== self::DEFAULTS['spacing_top'] || $style['spacing_bottom'] !== self::DEFAULTS['spacing_bottom']) {
|
||||
$parts[] = 'Abstand oben '.mb_strtolower(self::SPACINGS[$style['spacing_top']])
|
||||
.', unten '.mb_strtolower(self::SPACINGS[$style['spacing_bottom']]);
|
||||
}
|
||||
|
||||
if ($style['spacing_top'] !== 'same') {
|
||||
$parts[] = 'oben '.mb_strtolower(self::SPACINGS_TOP[$style['spacing_top']]);
|
||||
if ($style['gap'] !== 'normal') {
|
||||
$parts[] = 'Widget-Abstand '.mb_strtolower(self::SPACINGS[$style['gap']]);
|
||||
}
|
||||
|
||||
if ($style['divider'] !== 'none') {
|
||||
@@ -165,4 +168,77 @@ public static function summary(array $style): string
|
||||
|
||||
return implode(' · ', $parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob eine gespeicherte Gestaltung noch die Abstände der Hülle Version 1 trägt
|
||||
* („Abstand oben und unten“ spacing, Abweichung „Abstand oben“ same/small/none).
|
||||
*
|
||||
* @param array<string, mixed> $style
|
||||
*/
|
||||
public static function hasLegacySpacing(array $style): bool
|
||||
{
|
||||
return array_key_exists('spacing', $style)
|
||||
|| in_array($style['spacing_top'] ?? null, ['same', 'small'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Übersetzt die Abstände der Hülle Version 1 in die drei Werte der Version 2, ohne die Darstellung zu ändern.
|
||||
*
|
||||
* Version 1 rechnete so: jeder Abschnitt oben und unten „spacing“ (Vorgabe normal); die Abweichung
|
||||
* „Abstand oben“ ersetzte nur oben (small/none); und eine versteckte Regel setzte oben auf null, wenn ein Abschnitt
|
||||
* ohne eigene Fläche direkt auf einen Abschnitt ohne eigene Fläche folgte (ohne Linien- oder Akzenttrenner dazwischen).
|
||||
* Diese Regel wird hier als „oben: kein Abstand“ ausgeschrieben. „Gering“ hat keine eigene Stufe mehr und wird
|
||||
* „Kompakt“ (dokumentierte Abweichung). Der Widget-Abstand entspricht dem bisherigen festen Rasterabstand („normal“).
|
||||
*
|
||||
* @param list<array<string, mixed>> $sections Abschnitte in Lesereihenfolge (mit style und slots)
|
||||
* @param bool $byVersion true: jede Hülle mit v < 2 gilt als Version 1 (Lesepfad gespeicherter Revisionen);
|
||||
* false: nur Gestaltungen mit alten Schlüsseln (Eingaben ohne Versionsangabe)
|
||||
* @return list<array<string, mixed>> dieselben Abschnitte mit übersetzter Gestaltung
|
||||
*/
|
||||
public static function migrateSpacing(array $sections, bool $byVersion = false): array
|
||||
{
|
||||
$previous = null;
|
||||
|
||||
foreach ($sections as $index => $section) {
|
||||
$style = is_array($section['style'] ?? null) ? $section['style'] : [];
|
||||
$rendered = is_array($section['slots'] ?? null) && array_filter($section['slots'], 'is_array') !== [];
|
||||
|
||||
$background = is_string($style['background'] ?? null) && isset(self::BACKGROUNDS[$style['background']]) ? $style['background'] : 'default';
|
||||
if ($background === 'image' && ! PublicMedia::isPublicPath($style['image'] ?? null)) {
|
||||
$background = 'default';
|
||||
}
|
||||
$divider = in_array($style['divider'] ?? null, ['line', 'accent'], true) ? $style['divider'] : 'none';
|
||||
|
||||
$legacy = $byVersion ? (int) ($section['v'] ?? 1) < 2 : self::hasLegacySpacing($style);
|
||||
|
||||
if ($legacy) {
|
||||
$level = in_array($style['spacing'] ?? null, ['compact', 'normal', 'large'], true) ? $style['spacing'] : 'normal';
|
||||
$override = $style['spacing_top'] ?? 'same';
|
||||
$collapsed = $background === 'default' && $previous !== null && $previous['background'] === 'default' && ! in_array($previous['divider'], ['line', 'accent'], true);
|
||||
|
||||
$style['spacing_top'] = match (true) {
|
||||
$override === 'none' => 'none',
|
||||
$override === 'small' => 'compact',
|
||||
$collapsed => 'none',
|
||||
default => $level,
|
||||
};
|
||||
$style['spacing_bottom'] = $level;
|
||||
$style['gap'] = 'normal';
|
||||
|
||||
// Trenner „Zusätzlicher Abstand“ (Version 1) fügte unten noch einmal den Abschnittsabstand an.
|
||||
if (($style['divider'] ?? null) === 'space') {
|
||||
$style['spacing_bottom'] = ['compact' => 'normal', 'normal' => 'large', 'large' => 'large'][$level];
|
||||
$style['divider'] = 'none';
|
||||
}
|
||||
unset($style['spacing']);
|
||||
$sections[$index]['style'] = $style;
|
||||
}
|
||||
|
||||
if ($rendered) {
|
||||
$previous = ['background' => $background, 'divider' => $divider];
|
||||
}
|
||||
}
|
||||
|
||||
return $sections;
|
||||
}
|
||||
}
|
||||
@@ -143,17 +143,24 @@ private static function styleFields(): array
|
||||
->default('standard')
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Ein Hintergrund reicht immer über die ganze Bildschirmbreite.'),
|
||||
Select::make('spacing')
|
||||
->label('Abstand oben und unten')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default('normal')
|
||||
->selectablePlaceholder(false),
|
||||
Select::make('spacing_top')
|
||||
->label('Abstand oben')
|
||||
->options(SectionStyle::SPACINGS_TOP)
|
||||
->default('same')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default(SectionStyle::DEFAULTS['spacing_top'])
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Zum Beispiel „Kein Abstand“, damit ein Einstieg direkt unter der Kopfzeile beginnt. Der Abstand unten bleibt.'),
|
||||
->helperText('Vor dem Inhalt. Zwischen zwei Abschnitten addieren sich „unten“ und „oben“; „Kein Abstand“ lässt einen Einstieg direkt unter der Kopfzeile beginnen.'),
|
||||
Select::make('spacing_bottom')
|
||||
->label('Abstand unten')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default(SectionStyle::DEFAULTS['spacing_bottom'])
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Nach dem Inhalt. Bei eigener Fläche liegen beide Abstände innerhalb der Fläche.'),
|
||||
Select::make('gap')
|
||||
->label('Widget-Abstand')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default(SectionStyle::DEFAULTS['gap'])
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Zwischen den Plätzen dieses Abschnitts, nebeneinander und gestapelt. Abstände innerhalb eines Widgets bleiben Sache des Widgets.'),
|
||||
Select::make('divider')
|
||||
->label('Trenner zum nächsten Abschnitt')
|
||||
->options(SectionStyle::DIVIDERS)
|
||||
|
||||
@@ -259,3 +259,57 @@ ### Wortmarke in Kopfzeile und Fußbereich
|
||||
**Offen:**
|
||||
- Eine Vektorfassung der Wortmarke fehlt; die Rasterfassung ist für die gezeigten Größen scharf (2x-Ableitung).
|
||||
- Bitte die Wortmarke in Kopf- und Fußbereich visuell abnehmen.
|
||||
|
||||
## 9. Korrektur: Abschnittsabstände vereinfacht (18.11.2026)
|
||||
|
||||
Branch `feature/abschnittsabstaende`, Commit `f511ad1`; CI 4842, Deploy 4843 auf `develop`, gearbeitet in einem separaten Worktree. Kein Merge nach `main`.
|
||||
|
||||
**Ersetzt** wurden:
|
||||
- „Abstand oben und unten“,
|
||||
- die Abweichung „Abstand oben“,
|
||||
- die versteckte Regel, die oben zwischen zwei Abschnitten ohne Fläche auf null setzte,
|
||||
- der Trenner „Zusätzlicher Abstand“.
|
||||
|
||||
**Neu** sind genau drei unabhängige Einstellungen: **Abstand oben**, **Abstand unten** und **Widget-Abstand**, jeweils mit den Stufen Kein Abstand, Kompakt, Normal und Großzügig. Gespeichert werden sie in der Abschnittshülle Version 2; Einzelheiten stehen in `cms-widget-registry.md` §11.
|
||||
|
||||
**Bestehende Seiten:** Hüllen der Version 1 werden beim Lesen übersetzt.
|
||||
|
||||
| Seite | Breiten | Ergebnis vor und nach dem Deploy |
|
||||
|---|---|---|
|
||||
| `/`, `/praevention`, `/designreferenz`, `/referenz-abschnitte`, `/premium-referenz`, `/t1-landingpage` | 1440 und 390 px | pixelgleich: Seitenhöhe, Lage jedes Abschnitts und Rasters, Innenabstände, Rasterabstände, Platzpositionen |
|
||||
| `/praevention-im-alltag` | 1440 und 390 px | erster Abschnitt oben +24,5 px bzw. +12 px, weil „Gering“ jetzt „Kompakt“ ist (gewollte Folge der vier Stufen) |
|
||||
|
||||
**Prüfung über den regulären Seitenkonfigurator:**
|
||||
- Angelegt wurde `/abstand-pruefung` (Seite 18) mit aufeinanderfolgenden Abschnitten:
|
||||
|
||||
| Abschnitt | Raster | oben / unten / Widget-Abstand |
|
||||
|---|---|---|
|
||||
| 1 | 4/4 | 0 / 0 / 0 |
|
||||
| 2 | 3:1 | 0 / 0 / 0 |
|
||||
| 3 | 4/4 | Kompakt / Normal / Normal |
|
||||
| 4 | 3:1 | Großzügig / 0 / Großzügig |
|
||||
| 5 | 3:1 | 0 / Kompakt / Kompakt |
|
||||
|
||||
- Die Gestaltung zeigt genau die drei Felder, „Abstand oben und unten“ gibt es nicht mehr.
|
||||
- Berechnete CSS-Werte (26 von 26 Prüfungen):
|
||||
|
||||
| Prüfung | 1440 px | 390 px |
|
||||
|---|---|---|
|
||||
| Stufen oben/unten (Kompakt / Normal / Großzügig) | 44,8 / 89,6 / 120 px | 24 / 48 / 72 px |
|
||||
| Stufen Widget-Abstand (Kompakt / Normal / Großzügig) | 18 / 36 / 56 px | 12 / 20 / 32 px |
|
||||
| Innenabstände und Rasterabstand je Abschnitt | wie eingestellt, Außenabstand jeweils 0 | wie eingestellt, Außenabstand jeweils 0 |
|
||||
| Inhalt 1 → 2 (0 + 0) | 0,0 px | 0,0 px |
|
||||
| Inhalt 2 → 3 (0 + Kompakt) | 44,8 px | 24 px |
|
||||
| Inhalt 3 → 4 (Normal + Großzügig) | 209,6 px | 120 px |
|
||||
| Inhalt 4 → 5 (0 + 0) | 0,0 px | 0,0 px |
|
||||
| Widget-Abstand 3:1 | nebeneinander 0 / 56 / 18 px | gestapelt 0 / 32 / 12 px |
|
||||
|
||||
**Tests:** 204 grün.
|
||||
- Neu:
|
||||
- Addition und Vorgaben,
|
||||
- Übersetzung aller Fälle der Version 1 (Abweichung, versteckte Regel, eigene Fläche, Linientrenner, leerer Abschnitt, Zusatzabstand),
|
||||
- Abweisung freier Werte für alle drei Felder.
|
||||
- Bewusst angepasst: Hüllenversion 2, neue Klassen, Prüfung freier Werte über die neuen Schlüssel.
|
||||
|
||||
**Vorgabe für neue Abschnitte:** oben und unten Kompakt, Widget-Abstand Normal. Damit bleibt der Abstand zwischen zwei neuen Abschnitten so groß wie bisher, und ein neuer erster Abschnitt beginnt näher an der Kopfzeile als vorher.
|
||||
|
||||
@@ -141,7 +141,7 @@ ## 8. Editor und Vorschau
|
||||
- Arbeitsfläche in voller Breite (`maxContentWidth = Full`); „Seite und Suchmaschinen“ ist beim Bearbeiten eingeklappt.
|
||||
- **Abschnitte** (Repeater): Kopfzeile „Abschnitt N · Raster 1 + 3 · Fläche · Widgets“; Aktionen Ziehen, nach oben/unten, Duplizieren, Löschen (mit Rückfrage), Einklappen, jeweils mit Tooltip.
|
||||
- **Raster**: grafische Auswahl mit sechs Kacheln. Raster mit weniger Plätzen als eingesetzten Widgets sind gesperrt. Beim Wechsel entfallen zuerst leere Plätze; Widgets behalten ihre Reihenfolge (`SectionEditor::arrangeSlots`). Kein Wechsel entfernt ein Widget.
|
||||
- **Gestaltung des Abschnitts** (eingeklappt, Zusammenfassung im Kopf): Hintergrund, Breite, Abstand oben und unten, **Abstand oben** (Abweichung: wie Abstand / gering / kein, zum Beispiel für einen Einstieg direkt unter der Kopfzeile; gespeichert als `style.spacing_top`, Vorgabe `same`), Trenner; bei Hintergrundbild zusätzlich Bild (Auswahl oder Upload), Fokuspunkt und Überlagerung. Abschnitts- und Widget-Einstellungen sind getrennt.
|
||||
- **Gestaltung des Abschnitts** (eingeklappt, Zusammenfassung im Kopf): Hintergrund, Breite, **Abstand oben**, **Abstand unten**, **Widget-Abstand** (je Kein Abstand / Kompakt / Normal / Großzügig, siehe §11), Trenner; bei Hintergrundbild zusätzlich Bild (Auswahl oder Upload), Fokuspunkt und Überlagerung. Abschnitts- und Widget-Einstellungen sind getrennt.
|
||||
- **Plätze** stehen im Verhältnis des Desktop-Rasters nebeneinander; Widgets lassen sich per Ziehen zwischen Plätzen tauschen. Der Platzkopf nennt Breite und warnt, wenn das Widget breiter sein müsste. Ein freier Platz bietet „Widget einsetzen“ (Auswahl mit Name, Beschreibung, Symbolbild, Mindestbreite), danach öffnet der Widget-Dialog. Ein Klick auf die Vorschau öffnet denselben Dialog: eine Dialogebene.
|
||||
- **Widget-Dialog**: Arten mit Darstellungsoptionen oder Medien gliedern den Dialog in die Reiter **Inhalt**, **Medien** und **Darstellung** (generisch aus der Registry: `editorSchema()`, `mediaSchema()`, Varianten und `settingOptions()`); andere Arten zeigen ihre Felder direkt. Varianten und Höhen sind sichtbare Auswahlknöpfe mit Symbol, Bildfokus zwei Schieberegler (0–100). „Darstellung“ nennt die zulässigen Platzbreiten und das Verhalten bei wenig Platz.
|
||||
- **Live-Vorschau im Dialog**: rendert den ungespeicherten Zustand mit derselben Ansicht wie die Website (`WidgetEditor::renderPreview`) in einer wählbaren logischen Platzbreite (Smartphone 390 px und die zulässigen Einheiten: 310/640/960/1300 px, entsprechend dem Standardabschnitt bei 1440 px Fensterbreite) und verkleinert sie auf die Dialogbreite. Die Breitenwahl wird nicht gespeichert.
|
||||
@@ -187,6 +187,8 @@ ## 9. Rollback und Datenformat (wichtig vor dem Merge nach `main`)
|
||||
|
||||
Die Migrationen (`sections`, `parent_id`) sind ergänzend und müssen beim Rollback nicht zurückgenommen werden; älterer Code ignoriert beide Spalten.
|
||||
|
||||
**Abschnittshülle Version 2 (Abstände)** bringt keine Migration der Datenbank; ältere Hüllen werden beim Lesen übersetzt. Ein Code-Rollback auf eine Fassung vor Version 2 zeigt neue Hüllen mit den alten Vorgaben (Abstand normal), weil sie `spacing_bottom` und `gap` nicht kennt; Speichern im alten Editor weist diese Schlüssel ab. Der Wiederherstellungsweg oben gilt.
|
||||
|
||||
**Adaptive Widgets (ADR-38)** bringen keine Migration. Gespeichert werden ab jetzt `hero` Version 2 und `image_text` Version 3. Ein Code-Rollback auf Designiteration 1 stellt diese Hüllen „bestmöglich“ dar (höhere Version als im Code): unbekannte Varianten fallen auf die Vorgabe zurück, die data-Schlüssel sind unverändert; Höhe, Fläche, Label und Fokus werden nicht dargestellt, aber nicht gelöscht. Speichern im alten Editor ist für diese Hüllen nicht möglich, bis der neue Code wieder läuft.
|
||||
|
||||
**Designiteration 1** bringt keine Migration. Bei einem Code-Rollback auf Iteration 2 fallen die neuen Varianten beim Lesen auf die Vorgabe zurück (`stage`/`editorial` → `standard`, `featured` → `standard`); die neuen Einstellungen und `cta2_*` werden nicht dargestellt, aber nicht gelöscht. Seiten bleiben darstellbar; der Wiederherstellungsweg oben ist dafür nicht nötig. Ein reiner Code-Rollback ist nach redaktionellen Änderungen im neuen Editor **nicht** als sicher anzusehen; der Weg oben ist Teil jedes Rollbacks.
|
||||
@@ -202,12 +204,12 @@ ## 10. Navigation
|
||||
|
||||
## 11. Abschnitte und Plätze
|
||||
|
||||
Gespeicherte Hülle eines Abschnitts (`sections[]`, Version 1):
|
||||
Gespeicherte Hülle eines Abschnitts (`sections[]`, Version 2):
|
||||
|
||||
```json
|
||||
{"id": "uuid", "v": 1, "layout": "u1_3",
|
||||
"style": {"background": "dark", "image": null, "focus": "center", "overlay": "light",
|
||||
"width": "standard", "spacing": "normal", "divider": "line"},
|
||||
{"id": "uuid", "v": 2, "layout": "u1_3",
|
||||
"style": {"background": "dark", "image": null, "focus": "center", "overlay": "light", "width": "standard",
|
||||
"spacing_top": "compact", "spacing_bottom": "compact", "gap": "normal", "divider": "line"},
|
||||
"slots": [{"id": "…", "type": "cards", "v": 1, "…": "…"}, null]}
|
||||
```
|
||||
|
||||
@@ -225,9 +227,28 @@ ## 11. Abschnitte und Plätze
|
||||
- **Gestaltung**: nur Aufzählungswerte (`SectionStyle`), abgebildet auf Tokens. Freie Werte (Farbcodes, CSS, unbekannte Schlüssel) werden abgewiesen.
|
||||
- Hintergrund: Standard, helle Markenfläche, dunkle Markenfläche, Markenakzent, Hintergrundbild. Jede Fläche setzt die Bedeutungs-Tokens neu (`scope-dark`, `scope-accent`, `scope-light`).
|
||||
- Breite: schmal (45 rem), Standard (75 rem), breit (90 rem), volle Breite. Der Hintergrund reicht immer über die ganze Bildschirmbreite.
|
||||
- Abstand: kompakt, normal (48 → 96 px), großzügig.
|
||||
- **Abstände (Version 2): genau drei unabhängige Werte**, je Kein Abstand / Kompakt / Normal / Großzügig:
|
||||
|
||||
| Wert | Bedeutung | Stufen (390 px → 1440 px) |
|
||||
|---|---|---|
|
||||
| `spacing_top` | Abstand oben (vor dem Inhalt) | 0 / 24 → 45 / 48 → 90 / 72 → 120 px (`--section-space-*`) |
|
||||
| `spacing_bottom` | Abstand unten (nach dem Inhalt) | wie oben |
|
||||
| `gap` | Widget-Abstand zwischen den Plätzen des Rasters, nebeneinander und gestapelt | 0 / 12 → 18 / 20 → 36 / 32 → 56 px (`--section-gap-*`) |
|
||||
|
||||
- Zwischen zwei Abschnitten addieren sich „unten“ des ersten und „oben“ des zweiten; 0 + 0 = 0. Es gibt keine weitere Vorgabe aus Seiten- oder Rasterhüllen (geprüft: kein Außenabstand der Abschnitte, `main` ohne Innenabstand).
|
||||
- Oben und unten sind der Innenabstand des Abschnitts. Bei eigener Fläche (dunkel, Akzent, Bild) liegen sie innerhalb der Fläche, damit Hintergründe nahtlos anschließen.
|
||||
- Vorgabe neuer Abschnitte: oben und unten Kompakt, Widget-Abstand Normal. Damit entspricht der Abstand zwischen zwei neuen Abschnitten dem bisherigen Normalabstand.
|
||||
- Abstände innerhalb eines Widgets (zum Beispiel zwischen Karten, `--grid-gap`) bleiben Sache des Widgets.
|
||||
- Trenner „Linie“ und „Markenakzent“ sind sichtbare Elemente zwischen zwei Abschnitten und bringen ihren eigenen kleinen Rand um die Linie mit (24 bzw. 8 px oben und unten).
|
||||
- **Version 1 → 2** (`SectionStyle::migrateSpacing`, beim Lesen; gespeicherte Revisionen bleiben):
|
||||
- „Abstand oben und unten“ wird zu oben und unten mit demselben Wert.
|
||||
- Die Abweichung „Abstand oben“ ersetzt nur oben: „kein“ → Kein Abstand, „gering“ → Kompakt. Die Stufe „gering“ gibt es nicht mehr; das ist die einzige sichtbare Änderung, auf der Testinstanz nur bei `/praevention-im-alltag`, +24 px.
|
||||
- Die frühere versteckte Regel „Abschnitt ohne Fläche direkt nach Abschnitt ohne Fläche: oben 0“ (ohne Linien- oder Akzenttrenner dazwischen, leere Abschnitte zählen nicht) wird als „oben: Kein Abstand“ ausgeschrieben.
|
||||
- Der Trenner „Zusätzlicher Abstand“ entfällt; er wird zu „Abstand unten“ eine Stufe höher.
|
||||
- Der Widget-Abstand wird Normal (der bisher feste Rasterabstand).
|
||||
- Messung auf der Testinstanz: sieben Seiten bei 1440 und 390 px vor und nach dem Deploy pixelgleich, außer der genannten Stelle.
|
||||
- Hintergrundbild: nur aus `cms/`, Fokuspunkt als `object-position` (neun Positionen), Überlagerung hell (84 % Weiß) oder dunkel (78 % Navy) oder keine. Das Bild des ersten Abschnitts lädt sofort, alle übrigen verzögert.
|
||||
- **Trenner** stehen zwischen Abschnitten, nie nach dem letzten: zusätzlicher Abstand, dezente Linie, Markenakzent (kurzer gelber Balken).
|
||||
- **Trenner** stehen zwischen Abschnitten, nie nach dem letzten: dezente Linie, Markenakzent (kurzer gelber Balken).
|
||||
- **Erstes Widget** der Seite ist der Seiteneinstieg (Überschrift erster Ordnung); seitenweit genau eine.
|
||||
- **Grenzen**: höchstens 30 Abschnitte und 60 Widgets je Seite; keine Verschachtelung.
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ ## 5. Typografie, Abstände, Maße
|
||||
| Abstände | Grundmaß 4 px: 4, 8, 12, 16, 24, 32, 48, 64, 96 px |
|
||||
| Rundungen | 8 (klein), 14 (Karte), 22 (Fläche), Pille |
|
||||
| Breiten | Lesebereich 44 rem, Standard 82 rem, Breit 96 rem, Vollbreite; Randabstand 16–40 px (siehe Abschnitt 12) |
|
||||
| Abschnittsabstände | `--section-space-{none,compact,normal,large}` (oben/unten) und `--section-gap-{none,compact,normal,large}` (Widget-Abstand); Bedeutung in `cms-widget-registry.md` §11 |
|
||||
| Trefferfläche | mindestens 44 × 44 px |
|
||||
| Fokus | 3 px Rahmen in `--color-focus`, 3 px Abstand, auf jeder Fläche sichtbar |
|
||||
|
||||
|
||||
+25
-28
@@ -13,40 +13,37 @@ .page-sections {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Abstände (Hülle Version 2): genau drei Werte je Abschnitt, keine weitere Vorgabe aus Seiten- oder Rasterhüllen.
|
||||
* - oben/unten: Innenabstand des Abschnitts; zwischen zwei Abschnitten addieren sich „unten“ und „oben“ (0 + 0 = 0).
|
||||
* Bei eigener Fläche liegen beide innerhalb der Fläche, damit Hintergründe nahtlos anschließen.
|
||||
* - Widget-Abstand: Abstand zwischen den Plätzen des Rasters, nebeneinander und gestapelt.
|
||||
* Abstände innerhalb eines Widgets (zum Beispiel zwischen Karten) bleiben im Widget (--grid-gap).
|
||||
*/
|
||||
.page-section {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text);
|
||||
padding-block: var(--section-space);
|
||||
--section-space: clamp(3rem, 2rem + 4vw, 6rem);
|
||||
padding-top: var(--section-space-top);
|
||||
padding-bottom: var(--section-space-bottom);
|
||||
--section-space-top: var(--section-space-compact);
|
||||
--section-space-bottom: var(--section-space-compact);
|
||||
--section-gap: var(--section-gap-normal);
|
||||
}
|
||||
|
||||
.section-space-compact {
|
||||
--section-space: clamp(1.5rem, 1rem + 2vw, 3rem);
|
||||
}
|
||||
|
||||
.section-space-large {
|
||||
--section-space: clamp(4.5rem, 3rem + 5vw, 8rem);
|
||||
}
|
||||
|
||||
/* Abweichender Abstand oben (Abschnittsgestaltung „Abstand oben“); der Abstand unten folgt weiter --section-space. */
|
||||
.page-section.section-space-top-small {
|
||||
padding-top: clamp(0.75rem, 0.5rem + 1vw, 1.25rem);
|
||||
}
|
||||
|
||||
.page-section.section-space-top-none {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
/* Aufeinanderfolgende Abschnitte ohne eigene Fläche teilen sich den Abstand, statt ihn zu verdoppeln. */
|
||||
.section-bg-default + .section-bg-default {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.section-divider-space {
|
||||
margin-bottom: var(--section-space);
|
||||
}
|
||||
.section-space-top-none { --section-space-top: var(--section-space-none); }
|
||||
.section-space-top-compact { --section-space-top: var(--section-space-compact); }
|
||||
.section-space-top-normal { --section-space-top: var(--section-space-normal); }
|
||||
.section-space-top-large { --section-space-top: var(--section-space-large); }
|
||||
.section-space-bottom-none { --section-space-bottom: var(--section-space-none); }
|
||||
.section-space-bottom-compact { --section-space-bottom: var(--section-space-compact); }
|
||||
.section-space-bottom-normal { --section-space-bottom: var(--section-space-normal); }
|
||||
.section-space-bottom-large { --section-space-bottom: var(--section-space-large); }
|
||||
.section-gap-none { --section-gap: var(--section-gap-none); }
|
||||
.section-gap-compact { --section-gap: var(--section-gap-compact); }
|
||||
.section-gap-normal { --section-gap: var(--section-gap-normal); }
|
||||
.section-gap-large { --section-gap: var(--section-gap-large); }
|
||||
|
||||
.page-section-inner {
|
||||
position: relative;
|
||||
@@ -72,7 +69,7 @@ .section-width-full .page-section-inner {
|
||||
|
||||
.section-grid {
|
||||
display: grid;
|
||||
gap: var(--grid-gap);
|
||||
gap: var(--section-gap);
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
@@ -117,6 +117,16 @@ :root {
|
||||
*/
|
||||
--gutter: clamp(1rem, 4vw, 2.5rem);
|
||||
--grid-gap: clamp(1.25rem, 2.5vw, 2.25rem);
|
||||
|
||||
/* Stufen der Abschnittsabstände (oben, unten) und des Widget-Abstands im Abschnittsraster (SectionStyle::SPACINGS). */
|
||||
--section-space-none: 0px;
|
||||
--section-space-compact: clamp(1.5rem, 1rem + 2vw, 3rem);
|
||||
--section-space-normal: clamp(3rem, 2rem + 4vw, 6rem);
|
||||
--section-space-large: clamp(4.5rem, 3rem + 5vw, 8rem);
|
||||
--section-gap-none: 0px;
|
||||
--section-gap-compact: clamp(0.75rem, 1.25vw, 1.25rem);
|
||||
--section-gap-normal: clamp(1.25rem, 2.5vw, 2.25rem);
|
||||
--section-gap-large: clamp(2rem, 4vw, 3.5rem);
|
||||
--width-reading: 44rem;
|
||||
--width-standard: 82rem;
|
||||
--width-wide: 96rem;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{-- Seitenvorlage „standard“: Abschnitte untereinander; jeder Abschnitt bestimmt Raster, Fläche und Breite selbst. --}}
|
||||
{{ $content }}
|
||||
@if ($page->path === '/' && $themes->isNotEmpty())
|
||||
<div class="page-section section-bg-default section-width-standard section-space-normal">
|
||||
<div class="page-section section-bg-default section-width-standard section-space-top-none section-space-bottom-normal section-gap-normal">
|
||||
<div class="page-section-inner">
|
||||
<section class="block">
|
||||
<h2>Themenbereiche</h2>
|
||||
|
||||
@@ -65,32 +65,75 @@ public function test_publishing_also_counts_as_an_edit(): void
|
||||
$this->assertSame('2026-11-18 11:00:00', $page->fresh()->updated_at->toDateTimeString());
|
||||
}
|
||||
|
||||
public function test_first_section_can_start_directly_below_the_header_without_changing_other_spacing(): void
|
||||
/**
|
||||
* Drei unabhängige Abstände je Abschnitt; zwischen zwei Abschnitten addieren sich „unten“ und „oben“ (0 + 0 = 0).
|
||||
*/
|
||||
public function test_sections_render_three_independent_spacings(): void
|
||||
{
|
||||
$page = Page::query()->create(['path' => '/abstand']);
|
||||
$service = app(PageService::class);
|
||||
$hero = ['type' => 'hero', 'v' => 2, 'data' => ['heading' => 'Einstieg']];
|
||||
$prose = fn (string $text) => ['type' => 'prose', 'v' => 1, 'data' => ['body' => $text]];
|
||||
$revision = $service->saveRevision($page, [
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'none', 'spacing' => 'large'], 'slots' => [$hero]],
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'small'], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]],
|
||||
['layout' => 'u4', 'style' => [], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Weiter']]]],
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'none', 'spacing_bottom' => 'none', 'gap' => 'none'], 'slots' => [['type' => 'hero', 'v' => 2, 'data' => ['heading' => 'Einstieg']]]],
|
||||
['layout' => 'u3_1', 'style' => ['spacing_top' => 'none', 'spacing_bottom' => 'large', 'gap' => 'compact'], 'slots' => [$prose('Drei'), $prose('Eins')]],
|
||||
['layout' => 'u4', 'style' => [], 'slots' => [$prose('Vorgabe')]],
|
||||
], null, null, null);
|
||||
$service->publish($page, $revision);
|
||||
|
||||
$html = $this->get('/abstand')->assertOk()->getContent();
|
||||
$this->assertMatchesRegularExpression('#class="page-section section-bg-default section-width-standard section-space-large section-space-top-none section-layout-u4"#', $html);
|
||||
$this->assertStringContainsString('section-space-normal section-space-top-small section-layout-u4', $html);
|
||||
$this->assertSame(2, substr_count($html, 'section-space-top-'), 'Ohne Angabe gilt der normale Abstand; keine zusätzliche Klasse.');
|
||||
$this->assertSame('same', $revision->sections[2]['style']['spacing_top']);
|
||||
$this->assertStringContainsString('oben kein abstand', SectionStyle::summary($revision->sections[0]['style']));
|
||||
$this->assertStringContainsString('section-space-top-none section-space-bottom-none section-gap-none section-layout-u4', $html);
|
||||
$this->assertStringContainsString('section-space-top-none section-space-bottom-large section-gap-compact section-layout-u3-1', $html);
|
||||
$this->assertStringContainsString('section-space-top-compact section-space-bottom-compact section-gap-normal section-layout-u4', $html, 'Vorgabe neuer Abschnitte: oben und unten kompakt, Widget-Abstand normal.');
|
||||
$style = $revision->sections[0]['style'];
|
||||
$this->assertSame(['none', 'none', 'none'], [$style['spacing_top'], $style['spacing_bottom'], $style['gap']]);
|
||||
$this->assertStringContainsString('Abstand oben kein abstand, unten großzügig · Widget-Abstand kompakt', SectionStyle::summary($revision->sections[1]['style']));
|
||||
}
|
||||
|
||||
public function test_top_spacing_accepts_only_its_enumerated_values(): void
|
||||
/**
|
||||
* Hüllen der Version 1 werden beim Lesen so übersetzt, dass die Darstellung gleich bleibt (gespeicherte Revision unverändert).
|
||||
*/
|
||||
public function test_version_one_spacing_is_translated_without_changing_the_layout(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$prose = ['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']];
|
||||
$v1 = fn (array $style, ?array $slots = null) => ['id' => null, 'v' => 1, 'layout' => 'u4', 'style' => $style + ['divider' => 'none'], 'slots' => $slots ?? [$prose]];
|
||||
|
||||
app(PageSections::class)->normalize([
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => '0px'], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]],
|
||||
$sections = app(PageSections::class)->read([
|
||||
$v1(['background' => 'default', 'spacing' => 'normal', 'spacing_top' => 'none']),
|
||||
$v1(['background' => 'default', 'spacing' => 'normal']),
|
||||
$v1(['background' => 'dark', 'spacing' => 'large']),
|
||||
$v1(['background' => 'default', 'spacing' => 'compact', 'divider' => 'line']),
|
||||
$v1(['background' => 'default', 'spacing' => 'normal', 'spacing_top' => 'small']),
|
||||
$v1(['background' => 'default', 'spacing' => 'compact', 'divider' => 'space']),
|
||||
$v1(['background' => 'default', 'spacing' => 'normal'], [null]),
|
||||
$v1(['background' => 'default', 'spacing' => 'large']),
|
||||
]);
|
||||
|
||||
$spacing = array_map(fn ($s) => [$s['style']['spacing_top'], $s['style']['spacing_bottom'], $s['style']['gap'], $s['style']['divider']], $sections);
|
||||
$this->assertSame([
|
||||
['none', 'normal', 'normal', 'none'], // Abweichung „kein Abstand“
|
||||
['none', 'normal', 'normal', 'none'], // folgt Abschnitt ohne Fläche: bisher oben 0
|
||||
['large', 'large', 'normal', 'none'], // eigene Fläche: oben wie Abstand
|
||||
['compact', 'compact', 'normal', 'line'], // folgt dunkler Fläche: oben wie Abstand
|
||||
['compact', 'normal', 'normal', 'none'], // nach Linientrenner keine Zusammenlegung; „Gering“ wird „Kompakt“
|
||||
['none', 'normal', 'normal', 'none'], // folgt ohne Fläche: oben 0; „Zusätzlicher Abstand“ wird unten eine Stufe mehr
|
||||
['none', 'normal', 'normal', 'none'], // leer, wird nicht dargestellt
|
||||
['none', 'large', 'normal', 'none'], // folgt Abschnitt 5 (leerer Abschnitt dazwischen zählt nicht)
|
||||
], $spacing);
|
||||
$this->assertSame([2, 2], [$sections[0]['v'], $sections[7]['v']]);
|
||||
$this->assertArrayNotHasKey('spacing', $sections[0]['style']);
|
||||
}
|
||||
|
||||
public function test_spacings_accept_only_their_enumerated_values(): void
|
||||
{
|
||||
foreach (['spacing_top' => 'medium', 'spacing_bottom' => '0px', 'gap' => '2rem'] as $key => $value) {
|
||||
try {
|
||||
app(PageSections::class)->normalize([
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'none', 'spacing_bottom' => 'none', 'gap' => 'none', $key => $value], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]],
|
||||
]);
|
||||
$this->fail("$key: $value wurde angenommen.");
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey("sections.0.style.$key", $exception->errors());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,11 +61,12 @@ public function test_sections_render_grid_ratios_backgrounds_and_dividers(): voi
|
||||
|
||||
$html = $this->get('/raster')->assertOk()->getContent();
|
||||
|
||||
$this->assertStringContainsString('page-section section-bg-dark section-width-standard section-space-normal section-layout-u4 scope-dark', $html);
|
||||
$this->assertStringContainsString('page-section section-bg-dark section-width-standard section-space-top-compact section-space-bottom-compact section-gap-normal section-layout-u4 scope-dark', $html);
|
||||
$this->assertStringContainsString('section-bg-light section-width-wide', $html);
|
||||
$this->assertStringContainsString('--section-cols-lg: minmax(0, 1fr) minmax(0, 3fr); --section-cols-md: minmax(0, 1fr)', $html);
|
||||
$this->assertStringContainsString('--section-cols-md: repeat(2, minmax(0, 1fr))', $html, 'Vier gleiche Plätze stehen auf dem Tablet als 2 × 2.');
|
||||
$this->assertStringContainsString('section-bg-accent section-width-standard section-space-large section-layout-u1-1-1-1 scope-accent', $html);
|
||||
// Eingabe im Format der Version 1 („spacing“): oben und unten großzügig, Widget-Abstand wie bisher normal.
|
||||
$this->assertStringContainsString('section-bg-accent section-width-standard section-space-top-large section-space-bottom-large section-gap-normal section-layout-u1-1-1-1 scope-accent', $html);
|
||||
$this->assertStringContainsString('section-divider section-divider-accent', $html);
|
||||
$this->assertSame(1, substr_count($html, 'section-divider section-divider-line'), 'Nach dem letzten Abschnitt steht kein Trenner.');
|
||||
$this->assertSame(1, substr_count($html, '<h1>'), 'Nur das erste Widget der Seite ist Überschrift erster Ordnung.');
|
||||
|
||||
@@ -65,7 +65,7 @@ public function test_sections_are_normalized_with_slots_matching_the_layout(): v
|
||||
|
||||
$this->assertCount(2, $stored);
|
||||
$this->assertSame('u1_3', $stored[0]['layout']);
|
||||
$this->assertSame(1, $stored[0]['v']);
|
||||
$this->assertSame(2, $stored[0]['v'], 'Hülle Version 2: drei unabhängige Abstände.');
|
||||
$this->assertSame('dark', $stored[0]['style']['background']);
|
||||
$this->assertSame('line', $stored[0]['style']['divider']);
|
||||
$this->assertSame('standard', $stored[0]['style']['width']);
|
||||
@@ -141,7 +141,9 @@ public function test_free_style_values_and_unknown_layouts_are_rejected(): void
|
||||
[['layout' => 'u5', 'slots' => []], 'sections.0.layout'],
|
||||
[$this->section('u4', [], ['background' => '#ff00ff']), 'sections.0.style.background'],
|
||||
[$this->section('u4', [], ['css' => 'color: red']), 'sections.0.style.css'],
|
||||
[$this->section('u4', [], ['spacing' => 'riesig']), 'sections.0.style.spacing'],
|
||||
[$this->section('u4', [], ['spacing_top' => 'riesig']), 'sections.0.style.spacing_top'],
|
||||
[$this->section('u4', [], ['spacing_bottom' => '0px']), 'sections.0.style.spacing_bottom'],
|
||||
[$this->section('u4', [], ['gap' => '3rem']), 'sections.0.style.gap'],
|
||||
] as [$section, $key]) {
|
||||
try {
|
||||
$this->sections()->normalize([$section]);
|
||||
@@ -218,7 +220,8 @@ public function test_reading_without_sections_wraps_legacy_blocks_in_single_colu
|
||||
|
||||
$this->assertCount(2, $sections);
|
||||
$this->assertSame('u4', $sections[0]['layout']);
|
||||
$this->assertSame('compact', $sections[0]['style']['spacing']);
|
||||
$this->assertSame(['compact', 'compact', 'normal'], [$sections[0]['style']['spacing_top'], $sections[0]['style']['spacing_bottom'], $sections[0]['style']['gap']]);
|
||||
$this->assertSame('none', $sections[1]['style']['spacing_top'], 'Wie bisher steht zwischen zwei Altbausteinen nur einmal der kompakte Abstand.');
|
||||
$this->assertSame('Alt', $sections[0]['slots'][0]['data']['heading']);
|
||||
$this->assertSame('prose', $sections[1]['slots'][0]['type']);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user