Führe einen gemeinsamen Layoutvertrag ein und integriere die Premium-Widgets.
Layoutvertrag (ADR-38) in der bestehenden Registry: Jede Widget-Art erklärt zulässige Rasterbreiten (supportedUnits), Höhen aus einem gemeinsamen Vokabular (heights, gespeichert als settings.height), Darstellungsmodi und Verhalten bei wenig Platz. Unzulässige Breiten werden beim Speichern verständlich abgewiesen; Höhe „fill“ streckt den Handlungsaufruf auf die Abschnittszeile. Premium-Widgets nach Brand-UI-Kit v1.6: - hero Version 2: photo_split/editorial_solid, Höhen compact/normal/ large, Label, Überschriftenebene, Akzent, Bildfokus in Prozent, zwei Schaltflächen; nur 3 oder 4 Einheiten. Upgrade aus Version 1. - image_text Version 3: Fläche cream/clear/navy, Höhen compact/normal/ spacious, Label, zwei Schaltflächen, Bildfokus; 1 bis 4 Einheiten. Upgrade aus Version 2 (format entfällt, Fokus in Prozent). - Kit-CSS ersetzt das bisherige Hero- und Bild-und-Text-CSS; der Randlos-Mechanismus der Designiteration 1 entfällt. Editor: Reiter Inhalt/Medien/Darstellung aus der Registry, Auswahl- knöpfe mit Symbolen, Schieberegler für den Bildfokus und eine Live- Vorschau im Dialog mit demselben Renderer in wählbarer Platzbreite. Tests bewusst angepasst: Einstieg braucht jetzt 3 oder 4 Einheiten (vorher Mindestbreite 2), image_text ist Version 3, Klassen der neuen Ansichten; die Hero-/Bild-Tests der Designiteration 1 sind durch CmsPremiumWidgetsTest ersetzt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3cdb36e7a3
commit
0bfb53463a
38 files changed
+1755
-856
No files matched your search
@@ -264,11 +264,11 @@ private function normalizeSection(array $section, int $index, array &$errors, ar
|
||||
}
|
||||
|
||||
$type = $this->widgets->get($widget['type']);
|
||||
if ($slotUnits < $type->minUnits()) {
|
||||
if (! $type->supportsUnits($slotUnits)) {
|
||||
$errors["$prefix.slots.$position.units"] = [sprintf(
|
||||
'„%s“ braucht mindestens %d Rastereinheiten; dieser Platz hat %d. Wählen Sie ein breiteres Raster oder einen breiteren Platz.',
|
||||
'„%s“ ist für Plätze mit %s Rastereinheiten vorgesehen; dieser Platz hat %d. Wählen Sie ein passendes Raster oder einen passenden Platz.',
|
||||
$type->label(),
|
||||
$type->minUnits(),
|
||||
$type->unitsLabel(),
|
||||
$slotUnits,
|
||||
)];
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
* - Ein Abschnitt ohne darstellbares Widget entfällt samt Hintergrund und Trenner.
|
||||
* - Das erste dargestellte Widget der Seite ist der Seiteneinstieg (Überschrift erster Ordnung).
|
||||
* - Trenner stehen zwischen Abschnitten, nie nach dem letzten.
|
||||
* - Steht ein randloses Widget (WidgetType::bleeds) allein im Abschnitt, entfallen Innenabstand und Breitenbegrenzung.
|
||||
*/
|
||||
class SectionRenderer
|
||||
{
|
||||
@@ -44,7 +43,7 @@ public function renderAll(array $sections, RenderContext $context): HtmlString
|
||||
|
||||
if ($html !== '') {
|
||||
$first = false;
|
||||
$cells[] = ['units' => $slotUnits, 'html' => $html, 'bleeds' => $this->widgets->bleeds($widget)];
|
||||
$cells[] = ['units' => $slotUnits, 'html' => $html];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ public function renderAll(array $sections, RenderContext $context): HtmlString
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $section
|
||||
* @param list<array{units: int, html: string, bleeds: bool}> $cells
|
||||
* @param list<array{units: int, html: string}> $cells
|
||||
*/
|
||||
private function renderSection(array $section, array $cells, int $index): string
|
||||
{
|
||||
@@ -106,10 +105,6 @@ private function renderSection(array $section, array $cells, int $index): string
|
||||
$classes[] = 'section-divider-space';
|
||||
}
|
||||
|
||||
if (count($cells) === 1 && $cells[0]['bleeds']) {
|
||||
$classes[] = 'section-bleed';
|
||||
}
|
||||
|
||||
$id = is_string($section['id'] ?? null) ? ' id="bereich-'.e($section['id']).'"' : '';
|
||||
$html = '<div class="'.e(implode(' ', $classes)).'"'.$id.'>';
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Support;
|
||||
|
||||
use App\Domain\Cms\Sections\SectionStyle;
|
||||
|
||||
/**
|
||||
* Bildausschnitt für Widget-Bilder: dieselben Fokuspunkte wie beim Abschnittshintergrund (SectionStyle::FOCUS).
|
||||
* Der Fokus bestimmt den Zuschnitt, wenn ein Bild in ein festes Seitenverhältnis gesetzt wird.
|
||||
*/
|
||||
final class ImageFocus
|
||||
{
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function options(): array
|
||||
{
|
||||
return SectionStyle::FOCUS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public static function position(array $settings, string $key = 'focus'): string
|
||||
{
|
||||
$focus = $settings[$key] ?? 'center';
|
||||
|
||||
return SectionStyle::FOCUS_POSITIONS[is_string($focus) && isset(SectionStyle::FOCUS_POSITIONS[$focus]) ? $focus : 'center'];
|
||||
}
|
||||
}
|
||||
@@ -16,18 +16,21 @@
|
||||
final class ImageRefFields
|
||||
{
|
||||
/**
|
||||
* @param bool $live Änderungen sofort an die Vorschau im Bearbeitungsdialog geben.
|
||||
* @return list<Field>
|
||||
*/
|
||||
public static function fields(string $label = 'Bild'): array
|
||||
public static function fields(string $label = 'Bild', bool $live = false): array
|
||||
{
|
||||
return [
|
||||
Select::make('image')
|
||||
->live($live)
|
||||
->label($label.': vorhandenes Bild')
|
||||
->options(fn (): array => PublicMedia::imageOptions())
|
||||
->searchable()
|
||||
->placeholder('Kein Bild')
|
||||
->helperText('Auswahl aus den Bildern, die bereits für die Website hochgeladen wurden.'),
|
||||
FileUpload::make('_upload')
|
||||
->live($live)
|
||||
->label($label.': neu hochladen')
|
||||
->disk('cms_incoming')
|
||||
->directory('cms')
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Support;
|
||||
|
||||
use App\Domain\Cms\Sections\SectionStyle;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use Filament\Forms\Components\Slider;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
|
||||
/**
|
||||
* Gemeinsame Bausteine der Premium-Widgets (Einstieg, Bild und Text; Brand-UI-Kit v1.6): Label, Überschriftenebene,
|
||||
* Bildfokus in Prozent und zwei Schaltflächen. Alle Werte bleiben in data bzw. settings der bestehenden Hülle.
|
||||
*
|
||||
* Abweichungen vom Kit (bewusst, dokumentiert in cms-widget-registry.md):
|
||||
* - Bildfokus als data.focus_x / data.focus_y (ganze Zahlen 0–100), weil settings nur Aufzählungswerte trägt.
|
||||
* - Überschriftenebene „Automatisch“ statt freier H1: Die Seite hat genau eine H1 (erstes Widget der Seite).
|
||||
* - Linkziele über SafeUrl des Repositorys (Seitenpfad, #Anker, http und https), nicht nur https.
|
||||
*/
|
||||
final class PremiumFields
|
||||
{
|
||||
public const HEADING_LEVELS = [
|
||||
'auto' => 'Automatisch (Seiteneinstieg H1, sonst H2)',
|
||||
'h2' => 'H2',
|
||||
'h3' => 'H3',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function rules(): array
|
||||
{
|
||||
return [
|
||||
'eyebrow' => ['nullable', 'string', 'max:80'],
|
||||
'cta_label' => ['nullable', 'string', 'max:80', 'required_with:data.cta_url'],
|
||||
'cta_url' => ['nullable', 'string', 'max:500', 'required_with:data.cta_label'],
|
||||
'cta2_label' => ['nullable', 'string', 'max:80', 'required_with:data.cta2_url'],
|
||||
'cta2_url' => ['nullable', 'string', 'max:500', 'required_with:data.cta2_label'],
|
||||
'alt' => ['nullable', 'string', 'max:300'],
|
||||
'focus_x' => ['nullable', 'numeric', 'between:0,100'],
|
||||
'focus_y' => ['nullable', 'numeric', 'between:0,100'],
|
||||
];
|
||||
}
|
||||
|
||||
public static function eyebrowField(): TextInput
|
||||
{
|
||||
return TextInput::make('eyebrow')
|
||||
->label('Label über der Überschrift (optional)')
|
||||
->maxLength(80)
|
||||
->live(onBlur: true)
|
||||
->helperText('Kurzer Hinweis, zum Beispiel ein Themenbereich. Kein Pflichtfeld.');
|
||||
}
|
||||
|
||||
public static function ctaFields(): Grid
|
||||
{
|
||||
$url = fn (string $name, string $label, string $pair) => TextInput::make($name)
|
||||
->label($label)
|
||||
->maxLength(500)
|
||||
->rule(SafeUrl::rule())
|
||||
->requiredWith($pair)
|
||||
->live(onBlur: true)
|
||||
->placeholder('/programme');
|
||||
|
||||
return Grid::make(['default' => 1, 'md' => 2])->schema([
|
||||
TextInput::make('cta_label')->label('Hauptschaltfläche: Beschriftung')->maxLength(80)->live(onBlur: true),
|
||||
$url('cta_url', 'Hauptschaltfläche: Linkziel', 'cta_label'),
|
||||
TextInput::make('cta2_label')->label('Zweite Schaltfläche: Beschriftung')->maxLength(80)->live(onBlur: true),
|
||||
$url('cta2_url', 'Zweite Schaltfläche: Linkziel', 'cta2_label'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<Slider>
|
||||
*/
|
||||
public static function focusFields(int $defaultX = 50, int $defaultY = 50): array
|
||||
{
|
||||
// Ohne gespeicherten Wert zeigt der Regler die Vorgabe der Widget-Art, die auch die Darstellung verwendet.
|
||||
$slider = fn (string $name, string $label, int $default) => Slider::make($name)
|
||||
->label($label)
|
||||
->range(0, 100)
|
||||
->step(1)
|
||||
->required(false)
|
||||
->tooltips()
|
||||
->default($default)
|
||||
->afterStateHydrated(function (Slider $component, mixed $state) use ($default): void {
|
||||
if (! is_numeric($state)) {
|
||||
$component->state($default);
|
||||
}
|
||||
})
|
||||
->live();
|
||||
|
||||
return [
|
||||
$slider('focus_x', 'Bildausschnitt waagerecht (0 = links, 100 = rechts)', $defaultX),
|
||||
$slider('focus_y', 'Bildausschnitt senkrecht (0 = oben, 100 = unten)', $defaultY),
|
||||
];
|
||||
}
|
||||
|
||||
public static function altField(): TextInput
|
||||
{
|
||||
return TextInput::make('alt')
|
||||
->label('Alternativtext des Bildes')
|
||||
->maxLength(300)
|
||||
->live(onBlur: true)
|
||||
->helperText('Beschreibt, was auf dem Bild zu sehen ist. Pflicht, sobald ein Bild gewählt ist.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Bereinigt Label, Schaltflächen, Alternativtext und Fokus; meldet unsichere Linkziele.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function clean(array $data, WidgetErrors $errors, bool $hasImage): array
|
||||
{
|
||||
foreach (['eyebrow', 'cta_label', 'cta_url', 'cta2_label', 'cta2_url', 'alt'] as $key) {
|
||||
$data[$key] = filled($data[$key] ?? null) ? trim((string) $data[$key]) : null;
|
||||
}
|
||||
|
||||
foreach (['cta_url', 'cta2_url'] as $key) {
|
||||
if ($data[$key] !== null && ! SafeUrl::isSafe($data[$key])) {
|
||||
$errors->add("data.$key", SafeUrl::message());
|
||||
}
|
||||
}
|
||||
|
||||
foreach (['focus_x', 'focus_y'] as $key) {
|
||||
$value = $data[$key] ?? null;
|
||||
$data[$key] = is_numeric($value) ? (int) round(max(0, min(100, (float) $value))) : null;
|
||||
}
|
||||
|
||||
if ($hasImage && $data['alt'] === null) {
|
||||
$errors->add('data.alt', 'Bitte einen Alternativtext für das Bild angeben.');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schaltflächen mit sicherem Linkziel in Anzeigereihenfolge.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return list<array{label: string, url: string}>
|
||||
*/
|
||||
public static function actions(array $data): array
|
||||
{
|
||||
$actions = [];
|
||||
|
||||
foreach ([['cta_label', 'cta_url'], ['cta2_label', 'cta2_url']] as [$label, $url]) {
|
||||
if (filled($data[$label] ?? null) && SafeUrl::isSafe($data[$url] ?? null)) {
|
||||
$actions[] = ['label' => (string) $data[$label], 'url' => (string) $data[$url]];
|
||||
}
|
||||
}
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bildfokus in Prozent; ohne Angabe die Vorgabe der Widget-Art.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return array{x: int, y: int}
|
||||
*/
|
||||
public static function focus(array $data, int $defaultX = 50, int $defaultY = 50): array
|
||||
{
|
||||
$clamp = fn (mixed $value, int $default): int => is_numeric($value) ? (int) round(max(0, min(100, (float) $value))) : $default;
|
||||
|
||||
return ['x' => $clamp($data['focus_x'] ?? null, $defaultX), 'y' => $clamp($data['focus_y'] ?? null, $defaultY)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Übersetzt den früheren Fokuspunkt (Aufzählung wie beim Abschnittshintergrund) in Prozentwerte.
|
||||
*
|
||||
* @return array{focus_x: int|null, focus_y: int|null}
|
||||
*/
|
||||
public static function focusFromEnum(mixed $focus): array
|
||||
{
|
||||
if (! is_string($focus) || ! isset(SectionStyle::FOCUS_POSITIONS[$focus])) {
|
||||
return ['focus_x' => null, 'focus_y' => null];
|
||||
}
|
||||
|
||||
[$x, $y] = array_map(fn (string $part): int => (int) rtrim($part, '%'), explode(' ', SectionStyle::FOCUS_POSITIONS[$focus]));
|
||||
|
||||
return ['focus_x' => $x, 'focus_y' => $y];
|
||||
}
|
||||
|
||||
/**
|
||||
* Überschriftenebene: „auto“ ergibt H1 für das erste Widget der Seite, sonst H2. Eine weitere H1 gibt es nicht.
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public static function headingTag(array $settings, bool $first): string
|
||||
{
|
||||
$level = $settings['heading_level'] ?? 'auto';
|
||||
|
||||
return match (true) {
|
||||
$first => 'h1',
|
||||
$level === 'h3' => 'h3',
|
||||
default => 'h2',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,22 @@ public function description(): string
|
||||
return 'Hervorgehobene Fläche mit Überschrift, Text und einer Schaltfläche.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return 1;
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Unter 20 rem Slotbreite steht die Schaltfläche in voller Breite; Überschrift, Text und Beschriftung brechen um.';
|
||||
}
|
||||
|
||||
public function heights(): array
|
||||
{
|
||||
return [
|
||||
'auto' => 'Automatisch (nach Inhalt)',
|
||||
'fill' => 'Abschnittshöhe füllen (gleich hoch wie Nachbarplätze)',
|
||||
];
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
|
||||
@@ -35,9 +35,14 @@ public function description(): string
|
||||
return 'Mehrere Karten mit Titel, Text, Linkziel und optionalem Bild. Als Raster, kompakte Liste oder mit hervorgehobener erster Karte.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return 1;
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Karten stehen untereinander, sobald keine zwei 15 rem breiten Karten nebeneinander passen; die hervorgehobene Karte stapelt Bild und Text.';
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
|
||||
@@ -37,9 +37,14 @@ public function description(): string
|
||||
return 'Ausgewählte Programme und Module; Titel und Beschreibung kommen automatisch aus den Fachdaten.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return 1;
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Karten stehen untereinander, die Markentafel über dem Text; lange Titel brechen um.';
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
|
||||
@@ -24,9 +24,14 @@ public function description(): string
|
||||
return 'Häufige Fragen mit Antworten.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return 2;
|
||||
return [2, 3, 4];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Fragen und Antworten untereinander; Antworten höchstens in Lesebreite.';
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
|
||||
@@ -23,9 +23,14 @@ public function description(): string
|
||||
return 'Abschnittsüberschrift mit kurzem Einleitungstext.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return 1;
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Überschriftengröße folgt der Platzbreite; lange Wörter werden getrennt.';
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
|
||||
@@ -3,17 +3,23 @@
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\ImageFocus;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\SafeUrl;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Components\Group;
|
||||
|
||||
/**
|
||||
* Premium-Einstieg nach Brand-UI-Kit v1.6 (12_premium_widgets_adaptiv_v1.6, Komponente lf-hero).
|
||||
*
|
||||
* Version 2: Varianten photo_split und editorial_solid, Höhen compact/normal/large (Mindesthöhen ab 860 px
|
||||
* Containerbreite), Label, Überschriftenebene, Bildfokus in Prozent, Akzent, zwei Schaltflächen.
|
||||
* Die data-Schlüssel der Version 1 (heading, text, cta_*, alt) bleiben unverändert, damit ältere Revisionen und ein
|
||||
* Code-Rollback darstellbar bleiben.
|
||||
*/
|
||||
class HeroWidget extends WidgetType
|
||||
{
|
||||
public function key(): string
|
||||
@@ -28,27 +34,46 @@ public function label(): string
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Großer Seiteneinstieg mit Überschrift, Beschreibung, optionalem Bild und bis zu zwei Schaltflächen. Als Markenbühne randlos über die volle Breite.';
|
||||
return 'Markenprägender Seiteneinstieg: großes Foto mit Textfläche oder dunkle Markenfläche, Überschrift, Beschreibung und bis zu zwei Schaltflächen.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function version(): int
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return 4;
|
||||
return [3, 4];
|
||||
}
|
||||
|
||||
public function stages(): array
|
||||
{
|
||||
return [
|
||||
'narrow' => 'unter 48rem Slotbreite: Bild über beziehungsweise unter dem Text',
|
||||
'wide' => 'ab 48rem: Bild neben dem Text, größere Überschrift; Markenbühne ab 56rem mit Text auf dem Bild',
|
||||
'wide' => 'ab 860 px Containerbreite: Foto über die ganze Fläche, Text links auf heller Fläche; Mindesthöhe nach Höheneinstellung',
|
||||
'safety' => 'unter 860 px nur technischer Sicherheitsumbruch: Foto 16:9 über dem Text, Schaltflächen ab 440 px untereinander',
|
||||
];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Für breite Plätze (3 oder 4 Einheiten). Unter 860 px Containerbreite steht das Foto über dem Text; die Höhe richtet sich dann nach dem Inhalt.';
|
||||
}
|
||||
|
||||
public function heights(): array
|
||||
{
|
||||
return [
|
||||
'compact' => 'Kompakt (mind. 400 px)',
|
||||
'normal' => 'Normal (mind. 512 px)',
|
||||
'large' => 'Groß (mind. 640 px)',
|
||||
];
|
||||
}
|
||||
|
||||
public function defaultHeight(): ?string
|
||||
{
|
||||
return 'normal';
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
{
|
||||
return 'heroicon-o-sparkles';
|
||||
@@ -56,38 +81,64 @@ public function icon(): string
|
||||
|
||||
public function schematic(): array
|
||||
{
|
||||
return [[2, 3, 56, 30, 'line'], [6, 8, 26, 6, 'ink'], [6, 17, 24, 3, 'line'], [6, 24, 12, 5, 'accent'], [36, 7, 18, 22, 'image']];
|
||||
return [[2, 3, 56, 30, 'image'], [6, 8, 24, 6, 'ink'], [6, 16, 10, 2, 'accent'], [6, 21, 22, 3, 'line'], [6, 27, 12, 4, 'accent']];
|
||||
}
|
||||
|
||||
public function variants(): array
|
||||
{
|
||||
return [
|
||||
'standard' => 'Standard (Bild neben dem Text)',
|
||||
'highlight' => 'Hervorgehoben (Markenfläche)',
|
||||
'stage' => 'Markenbühne (großes Bild, randlos)',
|
||||
'editorial' => 'Editorial (textbetont)',
|
||||
'photo_split' => 'Foto mit Textfläche',
|
||||
'editorial_solid' => 'Markenfläche (ohne Foto)',
|
||||
];
|
||||
}
|
||||
|
||||
public function optionIcons(): array
|
||||
{
|
||||
return [
|
||||
'variant' => ['photo_split' => 'heroicon-o-photo', 'editorial_solid' => 'heroicon-o-swatch'],
|
||||
'height' => ['compact' => 'heroicon-o-bars-2', 'normal' => 'heroicon-o-bars-3', 'large' => 'heroicon-o-bars-4'],
|
||||
];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return [
|
||||
'focus' => ImageFocus::options(),
|
||||
'text_side' => ['left' => 'Links', 'right' => 'Rechts'],
|
||||
'heading_level' => PremiumFields::HEADING_LEVELS,
|
||||
'accent' => ['underline' => 'Gelbe Unterstreichung', 'rays' => 'Unterstreichung und Signalstrahlen', 'none' => 'Ohne Akzent'],
|
||||
];
|
||||
}
|
||||
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'focus' => ['Bildausschnitt', 'Welcher Bildteil bei engen Zuschnitten sichtbar bleibt.'],
|
||||
'text_side' => ['Textseite (Markenbühne)', 'Auf welcher Seite der Text über dem Bild steht. Vorgabe: rechts.'],
|
||||
'heading_level' => ['Überschriftenebene', 'Der erste Einstieg einer Seite ist immer die Hauptüberschrift (H1).'],
|
||||
'accent' => ['Markenakzent', 'Freigegebene Akzente aus dem Brand-UI-Kit. Vorgabe: gelbe Unterstreichung.'],
|
||||
];
|
||||
}
|
||||
|
||||
public function bleeds(array $widget): bool
|
||||
/**
|
||||
* Version 1 (bis Designiteration 1) → 2: Varianten abbilden, früheren Fokuspunkt in Prozent umrechnen,
|
||||
* nicht mehr vorhandene Einstellungen (focus, text_side) entfernen. Inhalte bleiben unverändert.
|
||||
*/
|
||||
public function upgrade(array $widget, int $from): array
|
||||
{
|
||||
return ($widget['variant'] ?? null) === 'stage' && PublicMedia::isPublicPath($widget['refs']['image'] ?? null);
|
||||
if ($from !== 1) {
|
||||
return parent::upgrade($widget, $from);
|
||||
}
|
||||
|
||||
$widget['variant'] = in_array($widget['variant'] ?? null, ['highlight', 'editorial'], true) ? 'editorial_solid' : 'photo_split';
|
||||
$settings = is_array($widget['settings'] ?? null) ? $widget['settings'] : [];
|
||||
$data = is_array($widget['data'] ?? null) ? $widget['data'] : [];
|
||||
|
||||
if (! isset($data['focus_x'], $data['focus_y'])) {
|
||||
$data = PremiumFields::focusFromEnum($settings['focus'] ?? null) + $data;
|
||||
}
|
||||
|
||||
unset($settings['focus'], $settings['text_side']);
|
||||
$widget['settings'] = $settings;
|
||||
$widget['data'] = $data;
|
||||
|
||||
return $widget;
|
||||
}
|
||||
|
||||
public function dataRules(): array
|
||||
@@ -95,12 +146,7 @@ public function dataRules(): array
|
||||
return [
|
||||
'heading' => ['required', 'string', 'max:200'],
|
||||
'text' => ['nullable', 'string', 'max:600'],
|
||||
'cta_label' => ['nullable', 'string', 'max:80', 'required_with:data.cta_url'],
|
||||
'cta_url' => ['nullable', 'string', 'max:500', 'required_with:data.cta_label'],
|
||||
'cta2_label' => ['nullable', 'string', 'max:80', 'required_with:data.cta2_url'],
|
||||
'cta2_url' => ['nullable', 'string', 'max:500', 'required_with:data.cta2_label'],
|
||||
'alt' => ['nullable', 'string', 'max:300'],
|
||||
];
|
||||
] + PremiumFields::rules();
|
||||
}
|
||||
|
||||
public function refRules(): array
|
||||
@@ -111,85 +157,57 @@ public function refRules(): array
|
||||
public function dataFields(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('heading')->label('Überschrift')->required()->maxLength(200),
|
||||
Textarea::make('text')->label('Beschreibung')->rows(3)->maxLength(600),
|
||||
Grid::make(2)->schema([
|
||||
TextInput::make('cta_label')->label('Schaltfläche: Beschriftung (optional)')->maxLength(80),
|
||||
TextInput::make('cta_url')
|
||||
->label('Schaltfläche: Linkziel')
|
||||
->maxLength(500)
|
||||
->rule(SafeUrl::rule())
|
||||
->requiredWith('cta_label'),
|
||||
]),
|
||||
Grid::make(2)->schema([
|
||||
TextInput::make('cta2_label')->label('Zweite Schaltfläche: Beschriftung (optional)')->maxLength(80),
|
||||
TextInput::make('cta2_url')
|
||||
->label('Zweite Schaltfläche: Linkziel')
|
||||
->maxLength(500)
|
||||
->rule(SafeUrl::rule())
|
||||
->requiredWith('cta2_label'),
|
||||
]),
|
||||
TextInput::make('alt')
|
||||
->label('Alternativtext des Bildes')
|
||||
->maxLength(300)
|
||||
->helperText('Pflicht, sobald ein Bild gewählt ist.'),
|
||||
PremiumFields::eyebrowField(),
|
||||
TextInput::make('heading')->label('Überschrift')->required()->maxLength(200)->live(onBlur: true),
|
||||
Textarea::make('text')->label('Beschreibung')->rows(3)->maxLength(600)->live(onBlur: true),
|
||||
PremiumFields::ctaFields(),
|
||||
PremiumFields::altField(),
|
||||
...PremiumFields::focusFields(68, 50),
|
||||
];
|
||||
}
|
||||
|
||||
public function refFields(): array
|
||||
{
|
||||
return ImageRefFields::fields();
|
||||
return ImageRefFields::fields(live: true);
|
||||
}
|
||||
|
||||
public function editorSchema(): array
|
||||
{
|
||||
[$heading, $text, $cta, $cta2, $alt] = $this->dataFields();
|
||||
[$eyebrow, $heading, $text, $ctas] = $this->dataFields();
|
||||
|
||||
return [Group::make([$eyebrow, $heading, $text, $ctas])->statePath('data')];
|
||||
}
|
||||
|
||||
public function mediaSchema(): array
|
||||
{
|
||||
[, , , , $alt, $focusX, $focusY] = $this->dataFields();
|
||||
|
||||
return [
|
||||
Group::make([$heading, $text, $cta, $cta2])->statePath('data'),
|
||||
Group::make($this->refFields())->statePath('refs'),
|
||||
Group::make([$alt])->statePath('data'),
|
||||
Group::make([$alt, $focusX, $focusY])->statePath('data'),
|
||||
];
|
||||
}
|
||||
|
||||
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
{
|
||||
$refs = ImageRefFields::clean($refs, $errors);
|
||||
|
||||
foreach (['text', 'cta_label', 'cta_url', 'cta2_label', 'cta2_url', 'alt'] as $key) {
|
||||
$data[$key] = filled($data[$key] ?? null) ? trim($data[$key]) : null;
|
||||
}
|
||||
|
||||
foreach (['cta_url', 'cta2_url'] as $key) {
|
||||
if ($data[$key] !== null && ! SafeUrl::isSafe($data[$key])) {
|
||||
$errors->add("data.$key", SafeUrl::message());
|
||||
}
|
||||
}
|
||||
|
||||
if ($refs['image'] !== null && $data['alt'] === null) {
|
||||
$errors->add('data.alt', 'Bitte einen Alternativtext für das Bild angeben.');
|
||||
}
|
||||
$data['heading'] = trim((string) ($data['heading'] ?? ''));
|
||||
$data['text'] = filled($data['text'] ?? null) ? trim((string) $data['text']) : null;
|
||||
$data = PremiumFields::clean($data, $errors, $refs['image'] !== null);
|
||||
|
||||
return [$data, $refs];
|
||||
}
|
||||
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$data = $widget['data'];
|
||||
$actions = [];
|
||||
|
||||
foreach ([['cta_label', 'cta_url'], ['cta2_label', 'cta2_url']] as [$label, $url]) {
|
||||
if (filled($data[$label] ?? null) && SafeUrl::isSafe($data[$url] ?? null)) {
|
||||
$actions[] = ['label' => $data[$label], 'url' => $data[$url]];
|
||||
}
|
||||
}
|
||||
$actions = PremiumFields::actions($widget['data']);
|
||||
|
||||
return [
|
||||
'imageUrl' => PublicMedia::imageUrl($widget['refs']),
|
||||
'action' => $actions[0] ?? null,
|
||||
'actions' => $actions,
|
||||
'focus' => ImageFocus::position($widget['settings'] ?? []),
|
||||
'textSide' => ($widget['settings']['text_side'] ?? null) === 'left' ? 'left' : 'right',
|
||||
'action' => $actions[0] ?? null,
|
||||
'focus' => PremiumFields::focus($widget['data'], 68, 50),
|
||||
'accent' => in_array($widget['settings']['accent'] ?? null, ['underline', 'rays', 'none'], true) ? $widget['settings']['accent'] : 'underline',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\ImageFocus;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\RichText;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
@@ -14,10 +14,13 @@
|
||||
use Filament\Schemas\Components\Group;
|
||||
|
||||
/**
|
||||
* Bild und Text.
|
||||
* Bild und Text, Premium-Fassung nach Brand-UI-Kit v1.6 (Komponente lf-bild-text).
|
||||
*
|
||||
* Version 1 (Bestand): data {image, alt, body} mit Klartext.
|
||||
* Version 2: data {title, body (formatierter Text), alt}, refs {image}, Varianten Bild links/rechts.
|
||||
* Version 3: zusätzlich Label, zwei Schaltflächen, Bildfokus in Prozent; Einstellungen Oberfläche, Höhe und
|
||||
* Überschriftenebene. Die Bildseite bleibt die Variante (keine doppelte Einstellung). Die Einstellung
|
||||
* format der Designiteration 1 entfällt; die Bildproportion folgt jetzt der Höhe.
|
||||
*/
|
||||
class ImageTextWidget extends WidgetType
|
||||
{
|
||||
@@ -33,12 +36,17 @@ public function label(): string
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Bild neben formatiertem Text; Bild links oder rechts, auf dem Smartphone untereinander.';
|
||||
return 'Redaktionelle Bild-Text-Komposition mit Label, formatiertem Text und bis zu zwei Schaltflächen; passt sich der Platzbreite an.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function version(): int
|
||||
{
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
@@ -49,14 +57,29 @@ public function preferredUnits(): int
|
||||
public function stages(): array
|
||||
{
|
||||
return [
|
||||
'narrow' => 'unter 36rem Slotbreite: Bild über dem Text',
|
||||
'wide' => 'ab 36rem: Bild links oder rechts neben dem Text, gleich breit; ab 56rem Bild betont (7:5)',
|
||||
'stacked' => 'unter 540 px Containerbreite: Bild über dem Text, Schaltflächen untereinander in voller Breite',
|
||||
'band' => '540 bis 899 px: flacher Bildstreifen über dem vollständigen Text (typisch zwei Einheiten)',
|
||||
'wide' => 'ab 900 px: Bild und Text nebeneinander, Bild links oder rechts nach Variante',
|
||||
];
|
||||
}
|
||||
|
||||
public function version(): int
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 2;
|
||||
return 'Unter 900 px Containerbreite steht das Bild über dem Text, unabhängig von „Bild links/rechts“; die gespeicherte Seite bleibt erhalten. Text und Schaltflächen werden nie gekürzt.';
|
||||
}
|
||||
|
||||
public function heights(): array
|
||||
{
|
||||
return [
|
||||
'compact' => 'Kompakt (flacheres Bild, engere Abstände)',
|
||||
'normal' => 'Normal',
|
||||
'spacious' => 'Großzügig (höheres Bild, mehr Abstand)',
|
||||
];
|
||||
}
|
||||
|
||||
public function defaultHeight(): ?string
|
||||
{
|
||||
return 'normal';
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
@@ -66,7 +89,7 @@ public function icon(): string
|
||||
|
||||
public function schematic(): array
|
||||
{
|
||||
return [[4, 6, 22, 24, 'image'], [30, 7, 24, 4, 'ink'], [30, 15, 26, 3, 'line'], [30, 21, 22, 3, 'line']];
|
||||
return [[4, 6, 22, 24, 'image'], [30, 7, 10, 2, 'accent'], [30, 11, 24, 4, 'ink'], [30, 18, 26, 3, 'line'], [30, 24, 14, 4, 'accent']];
|
||||
}
|
||||
|
||||
public function variants(): array
|
||||
@@ -77,40 +100,64 @@ public function variants(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function optionIcons(): array
|
||||
{
|
||||
return [
|
||||
'variant' => ['image_left' => 'heroicon-o-arrow-left', 'image_right' => 'heroicon-o-arrow-right'],
|
||||
'height' => ['compact' => 'heroicon-o-bars-2', 'normal' => 'heroicon-o-bars-3', 'spacious' => 'heroicon-o-bars-4'],
|
||||
];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return [
|
||||
'format' => ['landscape' => 'Querformat (4:3)', 'portrait' => 'Hochformat (4:5)', 'square' => 'Quadrat', 'original' => 'Originalformat'],
|
||||
'focus' => ImageFocus::options(),
|
||||
'surface' => ['cream' => 'Creme (Markenfläche)', 'clear' => 'Ohne eigene Fläche', 'navy' => 'Navy (dunkel)'],
|
||||
'heading_level' => PremiumFields::HEADING_LEVELS,
|
||||
];
|
||||
}
|
||||
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'format' => ['Bildformat', 'Zuschnitt des Bildes. Vorgabe: Querformat.'],
|
||||
'focus' => ['Bildausschnitt', 'Welcher Bildteil beim Zuschnitt sichtbar bleibt.'],
|
||||
'surface' => ['Hintergrund des Widgets', 'Unabhängig vom Abschnittshintergrund. „Ohne eigene Fläche“ übernimmt den Abschnitt.'],
|
||||
'heading_level' => ['Überschriftenebene', 'Steht das Widget als erstes auf der Seite, ist die Überschrift immer H1.'],
|
||||
];
|
||||
}
|
||||
|
||||
public function upgrade(array $widget, int $from): array
|
||||
{
|
||||
if ($from !== 1) {
|
||||
return parent::upgrade($widget, $from);
|
||||
if ($from === 1) {
|
||||
$data = $widget['data'];
|
||||
|
||||
$widget['data'] = [
|
||||
'title' => null,
|
||||
'body' => RichText::fromPlainText(is_string($data['body'] ?? null) ? $data['body'] : ''),
|
||||
'alt' => $data['alt'] ?? null,
|
||||
];
|
||||
$widget['refs'] = [
|
||||
'image' => PublicMedia::fromUploadState($data['image'] ?? null),
|
||||
];
|
||||
|
||||
return $widget;
|
||||
}
|
||||
|
||||
$data = $widget['data'];
|
||||
if ($from === 2) {
|
||||
// Designiteration 1 → Premium: Fokus in Prozent, Bildformat entfällt (Proportion folgt der Höhe).
|
||||
$settings = is_array($widget['settings'] ?? null) ? $widget['settings'] : [];
|
||||
$data = is_array($widget['data'] ?? null) ? $widget['data'] : [];
|
||||
|
||||
$widget['data'] = [
|
||||
'title' => null,
|
||||
'body' => RichText::fromPlainText(is_string($data['body'] ?? null) ? $data['body'] : ''),
|
||||
'alt' => $data['alt'] ?? null,
|
||||
];
|
||||
$widget['refs'] = [
|
||||
'image' => PublicMedia::fromUploadState($data['image'] ?? null),
|
||||
];
|
||||
if (! isset($data['focus_x'], $data['focus_y'])) {
|
||||
$data = PremiumFields::focusFromEnum($settings['focus'] ?? null) + $data;
|
||||
}
|
||||
|
||||
return $widget;
|
||||
unset($settings['focus'], $settings['format']);
|
||||
$widget['settings'] = $settings;
|
||||
$widget['data'] = $data;
|
||||
|
||||
return $widget;
|
||||
}
|
||||
|
||||
return parent::upgrade($widget, $from);
|
||||
}
|
||||
|
||||
public function dataRules(): array
|
||||
@@ -118,8 +165,7 @@ public function dataRules(): array
|
||||
return [
|
||||
'title' => ['nullable', 'string', 'max:160'],
|
||||
'body' => ['required', 'string', 'max:40000'],
|
||||
'alt' => ['nullable', 'string', 'max:300'],
|
||||
];
|
||||
] + PremiumFields::rules();
|
||||
}
|
||||
|
||||
public function refRules(): array
|
||||
@@ -130,31 +176,38 @@ public function refRules(): array
|
||||
public function dataFields(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('title')->label('Titel (optional)')->maxLength(160),
|
||||
PremiumFields::eyebrowField(),
|
||||
TextInput::make('title')->label('Überschrift')->maxLength(160)->live(onBlur: true),
|
||||
RichEditor::make('body')
|
||||
->label('Text')
|
||||
->required()
|
||||
->live(onBlur: true)
|
||||
->toolbarButtons(RichText::TOOLBAR),
|
||||
TextInput::make('alt')
|
||||
->label('Alternativtext des Bildes')
|
||||
->maxLength(300)
|
||||
->helperText('Beschreibt, was auf dem Bild zu sehen ist. Pflicht, sobald ein Bild gewählt ist.'),
|
||||
PremiumFields::ctaFields(),
|
||||
PremiumFields::altField(),
|
||||
...PremiumFields::focusFields(64, 43),
|
||||
];
|
||||
}
|
||||
|
||||
public function refFields(): array
|
||||
{
|
||||
return ImageRefFields::fields();
|
||||
return ImageRefFields::fields(live: true);
|
||||
}
|
||||
|
||||
public function editorSchema(): array
|
||||
{
|
||||
[$title, $body, $alt] = $this->dataFields();
|
||||
[$eyebrow, $title, $body, $ctas] = $this->dataFields();
|
||||
|
||||
return [Group::make([$eyebrow, $title, $body, $ctas])->statePath('data')];
|
||||
}
|
||||
|
||||
public function mediaSchema(): array
|
||||
{
|
||||
[, , , , $alt, $focusX, $focusY] = $this->dataFields();
|
||||
|
||||
return [
|
||||
Group::make([$title, $body])->statePath('data'),
|
||||
Group::make($this->refFields())->statePath('refs'),
|
||||
Group::make([$alt])->statePath('data'),
|
||||
Group::make([$alt, $focusX, $focusY])->statePath('data'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -162,29 +215,26 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
{
|
||||
$refs = ImageRefFields::clean($refs, $errors);
|
||||
$data['body'] = RichText::sanitize($data['body'] ?? '');
|
||||
$data['title'] = filled($data['title'] ?? null) ? trim($data['title']) : null;
|
||||
$data['alt'] = filled($data['alt'] ?? null) ? trim($data['alt']) : null;
|
||||
$data['title'] = filled($data['title'] ?? null) ? trim((string) $data['title']) : null;
|
||||
$data = PremiumFields::clean($data, $errors, $refs['image'] !== null);
|
||||
|
||||
if (RichText::isBlank($data['body'])) {
|
||||
$errors->add('data.body', 'Bitte einen Text eingeben.');
|
||||
}
|
||||
|
||||
if ($refs['image'] !== null && $data['alt'] === null) {
|
||||
$errors->add('data.alt', 'Bitte einen Alternativtext für das Bild angeben.');
|
||||
}
|
||||
|
||||
return [$data, $refs];
|
||||
}
|
||||
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$format = $widget['settings']['format'] ?? 'landscape';
|
||||
$surface = $widget['settings']['surface'] ?? 'cream';
|
||||
|
||||
return [
|
||||
'imageUrl' => PublicMedia::imageUrl($widget['refs']),
|
||||
'body' => RichText::sanitize(is_string($widget['data']['body'] ?? null) ? $widget['data']['body'] : ''),
|
||||
'format' => in_array($format, ['landscape', 'portrait', 'square', 'original'], true) ? $format : 'landscape',
|
||||
'focus' => ImageFocus::position($widget['settings'] ?? []),
|
||||
'actions' => PremiumFields::actions($widget['data']),
|
||||
'focus' => PremiumFields::focus($widget['data'], 64, 43),
|
||||
'surface' => in_array($surface, ['cream', 'clear', 'navy'], true) ? $surface : 'cream',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,14 @@ public function description(): string
|
||||
return 'Längerer Text in Absätzen. Eine Leerzeile beginnt einen neuen Absatz.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return 1;
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Fließtext bricht um; Zeilen höchstens etwa 70 Zeichen.';
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
|
||||
@@ -45,8 +45,18 @@ public function register(WidgetType $type): void
|
||||
throw new InvalidArgumentException("Widget „{$key}“ braucht eine Schemaversion ab 1.");
|
||||
}
|
||||
|
||||
if ($type->minUnits() < 1 || $type->minUnits() > 4 || $type->preferredUnits() < $type->minUnits() || $type->preferredUnits() > 4) {
|
||||
throw new InvalidArgumentException("Widget „{$key}“ braucht eine Mindest- und Vorzugsbreite zwischen 1 und 4 Rastereinheiten.");
|
||||
// Gemeinsamer Layoutvertrag (ADR-38): Breiten, Vorzugsbreite und Höhen aus festen Wertebereichen.
|
||||
$units = $type->supportedUnits();
|
||||
if ($units === [] || array_diff($units, [1, 2, 3, 4]) !== [] || $units !== array_values(array_unique($units)) || ! $type->supportsUnits($type->preferredUnits())) {
|
||||
throw new InvalidArgumentException("Widget „{$key}“ braucht unterstützte Breiten zwischen 1 und 4 Rastereinheiten und eine darin enthaltene Vorzugsbreite.");
|
||||
}
|
||||
|
||||
if (array_diff(array_keys($type->heights()), array_keys(WidgetType::HEIGHTS)) !== []) {
|
||||
throw new InvalidArgumentException("Widget „{$key}“ verwendet eine Höhe außerhalb des gemeinsamen Vokabulars.");
|
||||
}
|
||||
|
||||
if (array_key_exists('height', $type->settings())) {
|
||||
throw new InvalidArgumentException("Widget „{$key}“ deklariert die Höhe über heights(), nicht über settings().");
|
||||
}
|
||||
|
||||
if ($type->variants() === []) {
|
||||
@@ -266,7 +276,7 @@ private function validateOne(WidgetType $type, array $widget, string $errorPrefi
|
||||
}
|
||||
|
||||
$settings = [];
|
||||
$allowedSettings = $type->settings();
|
||||
$allowedSettings = $type->settingOptions();
|
||||
foreach ($widget['settings'] as $key => $value) {
|
||||
if ($value === null || $value === '') {
|
||||
continue;
|
||||
|
||||
@@ -46,16 +46,6 @@ public function renderAll(?array $blocks, RenderContext $context): HtmlString
|
||||
return new HtmlString($html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob die Instanz randlos dargestellt werden darf (siehe WidgetType::bleeds).
|
||||
*
|
||||
* @param array<string, mixed> $widget aktuelle Hülle
|
||||
*/
|
||||
public function bleeds(array $widget): bool
|
||||
{
|
||||
return $this->registry->has((string) ($widget['type'] ?? '')) && $this->registry->get($widget['type'])->bleeds($widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendert eine Instanz samt Abschnittshülle. Liefert '' wenn das Widget nichts darzustellen hat.
|
||||
*
|
||||
@@ -71,6 +61,7 @@ public function renderWidget(array $widget, RenderContext $context, bool $first
|
||||
'refs' => $widget['refs'],
|
||||
'variant' => $widget['variant'],
|
||||
'settings' => $widget['settings'],
|
||||
'height' => $type->height($widget),
|
||||
'first' => $first,
|
||||
'context' => $context,
|
||||
] + $type->resolve($widget, $context))->render());
|
||||
@@ -81,7 +72,11 @@ public function renderWidget(array $widget, RenderContext $context, bool $first
|
||||
|
||||
$id = is_string($widget['id'] ?? null) ? ' id="abschnitt-'.e($widget['id']).'"' : '';
|
||||
|
||||
return '<section class="block widget widget-'.e(str_replace('_', '-', $widget['type'])).' widget-variant-'.e(str_replace('_', '-', $widget['variant'])).'"'.$id.'>'
|
||||
// Gemeinsamer Layoutvertrag (ADR-38): Höhe als Klasse an der Hülle, nur wenn die Art Höhen anbietet.
|
||||
$height = $type->height($widget);
|
||||
$heightClass = $height !== null ? ' widget-height-'.e($height) : '';
|
||||
|
||||
return '<section class="block widget widget-'.e(str_replace('_', '-', $widget['type'])).' widget-variant-'.e(str_replace('_', '-', $widget['variant'])).$heightClass.'"'.$id.'>'
|
||||
.$inner
|
||||
.'</section>';
|
||||
}
|
||||
|
||||
@@ -35,12 +35,57 @@ public function version(): int
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleinste Slotbreite in logischen Rastereinheiten (1 bis 4), in der das Widget auf dem Desktop lesbar bleibt.
|
||||
* Ein schmalerer Slot wird beim Speichern abgewiesen. Auf Tablet und Smartphone stapeln die Slots ohnehin.
|
||||
* Gemeinsames Höhenvokabular aller Widget-Arten (ADR-38). Eine Art bietet davon nur die sinnvollen Werte an
|
||||
* (heights()). Die Höhe ist ein Gestaltungsparameter, nie eine Begrenzung: Inhalte erhalten immer den nötigen Platz.
|
||||
*/
|
||||
public const HEIGHTS = [
|
||||
'auto' => 'Automatisch',
|
||||
'compact' => 'Kompakt',
|
||||
'normal' => 'Normal',
|
||||
'large' => 'Groß',
|
||||
'spacious' => 'Großzügig',
|
||||
'fill' => 'Abschnittshöhe füllen',
|
||||
];
|
||||
|
||||
/**
|
||||
* Gemeinsamer Layoutvertrag (ADR-38), Teil 1: zulässige Platzbreiten in logischen Rastereinheiten (1 bis 4).
|
||||
* Ein Platz mit nicht unterstützter Breite wird beim Speichern abgewiesen. Auf Tablet und Smartphone stapeln die
|
||||
* Plätze; dort bestimmt die tatsächliche Containerbreite die Darstellung (Container-Abfragen), nicht die Einheitenzahl.
|
||||
*
|
||||
* @return list<int>
|
||||
*/
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function supportsUnits(int $units): bool
|
||||
{
|
||||
return in_array($units, $this->supportedUnits(), true);
|
||||
}
|
||||
|
||||
/** Kleinste zulässige Platzbreite; abgeleitet aus supportedUnits(). */
|
||||
public function minUnits(): int
|
||||
{
|
||||
return 1;
|
||||
return min($this->supportedUnits());
|
||||
}
|
||||
|
||||
/** Lesbare Angabe der zulässigen Platzbreiten, zum Beispiel „1 bis 4“ oder „3 oder 4“. */
|
||||
public function unitsLabel(): string
|
||||
{
|
||||
$units = $this->supportedUnits();
|
||||
|
||||
if (count($units) === 1) {
|
||||
return (string) $units[0];
|
||||
}
|
||||
|
||||
if ($units === range(min($units), max($units)) && count($units) > 2) {
|
||||
return min($units).' bis '.max($units);
|
||||
}
|
||||
|
||||
$last = array_pop($units);
|
||||
|
||||
return implode(', ', $units).' oder '.$last;
|
||||
}
|
||||
|
||||
/** Empfohlene Slotbreite in Rastereinheiten; Hinweis in der Widget-Auswahl. */
|
||||
@@ -60,6 +105,42 @@ public function stages(): array
|
||||
return ['fluid' => 'passt sich fließend an jede Slotbreite an'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gemeinsamer Layoutvertrag, Teil 2: angebotene Höhen (Schlüssel aus HEIGHTS => Bezeichnung im Editor).
|
||||
* Leer: keine Höhenwahl, die Höhe folgt dem Inhalt. Der erste Eintrag ist die Vorgabe.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function heights(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function defaultHeight(): ?string
|
||||
{
|
||||
$key = array_key_first($this->heights());
|
||||
|
||||
return $key === null ? null : (string) $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wirksame Höhe einer Instanz (gespeicherte Einstellung oder Vorgabe).
|
||||
*
|
||||
* @param array<string, mixed> $widget
|
||||
*/
|
||||
public function height(array $widget): ?string
|
||||
{
|
||||
$height = $widget['settings']['height'] ?? null;
|
||||
|
||||
return is_string($height) && array_key_exists($height, $this->heights()) ? $height : $this->defaultHeight();
|
||||
}
|
||||
|
||||
/** Gemeinsamer Layoutvertrag, Teil 3: Verhalten bei reduziertem Platzangebot (Hinweis im Editor und in der Dokumentation). */
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Text bricht um, nichts wird abgeschnitten.';
|
||||
}
|
||||
|
||||
/** Heroicon-Name für Auswahl und Liste im Editor. */
|
||||
public function icon(): string
|
||||
{
|
||||
@@ -114,14 +195,30 @@ public function settingLabels(): array
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob die Instanz randlos über die volle Fensterbreite dargestellt wird, wenn sie allein in einem Abschnitt
|
||||
* mit Raster „4“ steht (zum Beispiel die Markenbühne). Der Abschnitt verzichtet dann auf Innenabstand und Begrenzung.
|
||||
* Alle zulässigen Einstellungen einschließlich der gemeinsamen Höhe. Registry-Prüfung, Editor und Darstellung
|
||||
* verwenden ausschließlich diese Zusammenführung.
|
||||
*
|
||||
* @param array<string, mixed> $widget
|
||||
* @return array<string, array<string, string>>
|
||||
*/
|
||||
public function bleeds(array $widget): bool
|
||||
final public function settingOptions(): array
|
||||
{
|
||||
return false;
|
||||
$options = $this->settings();
|
||||
|
||||
if ($this->heights() !== []) {
|
||||
$options['height'] = $this->heights();
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Symbole für die visuelle Auswahl im Editor: 'variant' oder Einstellungsschlüssel => [Wert => Heroicon].
|
||||
*
|
||||
* @return array<string, array<string, string>>
|
||||
*/
|
||||
public function optionIcons(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,6 +261,17 @@ public function refFields(): array
|
||||
*
|
||||
* @return list<Component>
|
||||
*/
|
||||
/**
|
||||
* Felder der Gruppe „Medien“ im Bearbeitungsdialog (Bild, Bildausschnitt, Alternativtext). Leer: keine eigene Gruppe;
|
||||
* Verweise stehen dann mit im Inhalt (editorSchema()).
|
||||
*
|
||||
* @return list<Component>
|
||||
*/
|
||||
public function mediaSchema(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function editorSchema(): array
|
||||
{
|
||||
$schema = [];
|
||||
|
||||
@@ -524,8 +524,8 @@ private static function slotLabel(array $state, ?int $index, mixed $layout): str
|
||||
$type = $items !== [] ? (array_values($items)[0]['type'] ?? null) : null;
|
||||
$registry = app(WidgetRegistry::class);
|
||||
|
||||
if ($registry->has($type) && $registry->get($type)->minUnits() > $slotUnits) {
|
||||
$label .= ' · zu schmal: „'.$registry->get($type)->label().'“ braucht '.$registry->get($type)->minUnits();
|
||||
if ($registry->has($type) && ! $registry->get($type)->supportsUnits($slotUnits)) {
|
||||
$label .= ' · passt nicht: „'.$registry->get($type)->label().'“ ist für '.$registry->get($type)->unitsLabel().' Einheiten vorgesehen';
|
||||
}
|
||||
|
||||
return $label;
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Components\Text;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\View;
|
||||
use Illuminate\Foundation\Vite;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -83,34 +89,69 @@ public static function slotBuilder(string $name = 'widget'): Builder
|
||||
|
||||
public static function block(WidgetType $type): Block
|
||||
{
|
||||
$variants = $type->variants();
|
||||
$icons = $type->optionIcons();
|
||||
$display = [];
|
||||
|
||||
$schema = [Hidden::make('id')];
|
||||
|
||||
$schema[] = count($variants) > 1
|
||||
? ToggleButtons::make('variant')
|
||||
if (count($type->variants()) > 1) {
|
||||
$display[] = ToggleButtons::make('variant')
|
||||
->label('Darstellung')
|
||||
->options($variants)
|
||||
->options($type->variants())
|
||||
->icons($icons['variant'] ?? [])
|
||||
->default($type->defaultVariant())
|
||||
->inline()
|
||||
->required()
|
||||
: Hidden::make('variant')->default($type->defaultVariant());
|
||||
->live();
|
||||
}
|
||||
|
||||
if ($type->settings() !== []) {
|
||||
$settings = [];
|
||||
$labels = $type->settingLabels();
|
||||
foreach ($type->settings() as $key => $options) {
|
||||
$settings[] = Select::make($key)
|
||||
$settings = [];
|
||||
$labels = $type->settingLabels();
|
||||
foreach ($type->settingOptions() as $key => $options) {
|
||||
// Gemeinsame Höhe (ADR-38): immer als sichtbare Auswahl mit Vorgabe, nie als freie Eingabe.
|
||||
$settings[] = $key === 'height'
|
||||
? ToggleButtons::make('height')
|
||||
->label('Höhe')
|
||||
->helperText('Gestaltungsparameter, keine Begrenzung: Längere Inhalte erhalten immer den nötigen Platz.')
|
||||
->options($options)
|
||||
->icons($icons['height'] ?? [])
|
||||
->default($type->defaultHeight())
|
||||
->inline()
|
||||
->live()
|
||||
: Select::make($key)
|
||||
->label($labels[$key][0] ?? Str::headline($key))
|
||||
->helperText($labels[$key][1] ?? null)
|
||||
->placeholder('Vorgabe der Darstellung')
|
||||
->options($options);
|
||||
}
|
||||
$schema[] = Grid::make(['default' => 1, 'md' => min(3, count($settings))])->schema($settings)->statePath('settings');
|
||||
->options($options)
|
||||
->live();
|
||||
}
|
||||
|
||||
foreach ($type->editorSchema() as $component) {
|
||||
$schema[] = $component;
|
||||
if ($settings !== []) {
|
||||
$display[] = Grid::make(['default' => 1, 'md' => 2])->schema($settings)->statePath('settings');
|
||||
}
|
||||
|
||||
$variantField = count($type->variants()) > 1 ? [] : [Hidden::make('variant')->default($type->defaultVariant())];
|
||||
$content = $type->editorSchema();
|
||||
$media = $type->mediaSchema();
|
||||
|
||||
if ($display === [] && $media === []) {
|
||||
$schema = [Hidden::make('id'), ...$variantField, ...$content];
|
||||
} else {
|
||||
$tabs = [Tab::make('Inhalt')->icon('heroicon-o-pencil-square')->schema($content)];
|
||||
if ($media !== []) {
|
||||
$tabs[] = Tab::make('Medien')->icon('heroicon-o-photo')->schema($media);
|
||||
}
|
||||
if ($display !== []) {
|
||||
$tabs[] = Tab::make('Darstellung')->icon('heroicon-o-adjustments-horizontal')->schema([
|
||||
...$display,
|
||||
Text::make('Platzbreiten: '.$type->unitsLabel().' Rastereinheiten. '.$type->narrowBehavior()),
|
||||
]);
|
||||
}
|
||||
|
||||
$schema = [
|
||||
Hidden::make('id'),
|
||||
...$variantField,
|
||||
Tabs::make('Widget')->tabs($tabs)->contained(false),
|
||||
self::livePreview($type),
|
||||
];
|
||||
}
|
||||
|
||||
return WidgetBlock::make($type->key())
|
||||
@@ -238,6 +279,50 @@ public static function notifyErrors(array $errors, array $blocks): void
|
||||
->send();
|
||||
}
|
||||
|
||||
/** Logische Vorschaubreiten in px: tatsächliche Platzbreiten im Standardabschnitt bei 1440 px Fensterbreite. */
|
||||
public const PREVIEW_UNIT_WIDTHS = [1 => 310, 2 => 640, 3 => 960, 4 => 1300];
|
||||
|
||||
public const PREVIEW_PHONE_WIDTH = 390;
|
||||
|
||||
/**
|
||||
* Live-Vorschau im Bearbeitungsdialog: rendert den ungespeicherten Zustand mit derselben Ansicht wie die Website
|
||||
* in einer wählbaren Platzbreite. Die Breitenwahl (_preview_width) wird nicht gespeichert.
|
||||
*/
|
||||
private static function livePreview(WidgetType $type): Section
|
||||
{
|
||||
$default = (string) self::PREVIEW_UNIT_WIDTHS[$type->preferredUnits()];
|
||||
$widths = [(string) self::PREVIEW_PHONE_WIDTH => 'Smartphone'];
|
||||
foreach ($type->supportedUnits() as $units) {
|
||||
$widths[(string) self::PREVIEW_UNIT_WIDTHS[$units]] = $units.' '.($units === 1 ? 'Einheit' : 'Einheiten');
|
||||
}
|
||||
|
||||
return Section::make('Vorschau')
|
||||
->description('Änderungen erscheinen sofort. Unter 860 px zeigt der Einstieg den Sicherheitsumbruch, Bild und Text ab 900 px zwei Spalten.')
|
||||
->collapsible()
|
||||
->compact()
|
||||
->schema([
|
||||
ToggleButtons::make('_preview_width')
|
||||
->hiddenLabel()
|
||||
->options($widths)
|
||||
->default($default)
|
||||
->inline()
|
||||
->live()
|
||||
->dehydrated(false)
|
||||
->extraAttributes(['class' => 'luf-preview-width']),
|
||||
View::make('filament.cms.widget-live-preview')
|
||||
->viewData(fn (Get $get): array => [
|
||||
'html' => self::renderPreview($type->key(), [
|
||||
'variant' => $get('variant'),
|
||||
'settings' => $get('settings'),
|
||||
'data' => $get('data'),
|
||||
'refs' => $get('refs'),
|
||||
]),
|
||||
'stylesheets' => self::previewStylesheets(),
|
||||
'width' => (int) ($get('_preview_width') ?: $default),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blockvorschau: dieselbe Widget-Ansicht wie öffentlich, aus dem ungespeicherten Zustand.
|
||||
*
|
||||
@@ -292,9 +377,9 @@ private static function pickerLabel(WidgetType $type): HtmlString
|
||||
|
||||
private static function unitsHint(WidgetType $type): string
|
||||
{
|
||||
return $type->minUnits() === 1
|
||||
? 'Passt in jeden Platz'
|
||||
: 'Braucht einen Platz ab '.$type->minUnits().' Rastereinheiten';
|
||||
return $type->supportedUnits() === [1, 2, 3, 4]
|
||||
? 'Passt in jeden Platz (1 bis 4 Einheiten)'
|
||||
: 'Für Plätze mit '.$type->unitsLabel().' Rastereinheiten';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,6 +58,7 @@ ## Übersicht der Architekturentscheidungen
|
||||
| ADR-35 | Messung | Entwurf / Rechtsprüfung offen | Reichweitenmessung ohne Cookies als Vorschlag; Prüfung offen |
|
||||
| ADR-36 | Designsystem | Designprinzip fest; Tokens offen | Gemeinsame Design-Tokens für Website und Mitgliederbereich |
|
||||
| ADR-37 | n8n-Anbindung | Option / nicht beschlossen | n8n allenfalls für externe Kanäle, ohne direkten Datenbankzugang |
|
||||
| ADR-38 | Layoutvertrag der Widgets | Umgesetzt auf Test (18.11.2026); UX-Abnahme offen | Zulässige Rasterbreiten, Höhen und Verhalten bei wenig Platz je Widget-Art in der bestehenden Registry; Darstellung nach realer Containerbreite |
|
||||
|
||||
---
|
||||
|
||||
@@ -485,3 +486,16 @@ ## ADR-37 – Optionale externe Workflow-Anbindung
|
||||
**Alternativen.** Keine externe Workflow-Engine; n8n als allgemeine Produktsteuerung.
|
||||
**Folgen und offene Prüfung.** Umsetzung erst bei konkret nachgewiesenem Kanalbedarf.
|
||||
**Quelle.** Website-Zielkonzept §12; Website-CMS-Zielarchitektur §9, ADR-37-Tabelle.
|
||||
|
||||
## ADR-38 – Gemeinsamer Layoutvertrag für Widget-Arten
|
||||
|
||||
**Status am 18.11.2026:** Umgesetzt auf `develop`/Testinstanz (Branch `feature/adaptive-widgets`); **UX-Abnahme durch den Betreiber offen**. Ergänzt ADR-30, ersetzt es nicht.
|
||||
**Kontext.** Das Abschnittsraster (vier logische Einheiten, ein Widget je Platz) verteilte Widgets bisher nur mit einer Mindestbreite. Das Brand-UI-Kit v1.6 (`12_premium_widgets_adaptiv_v1.6`) verlangt für die Premium-Widgets bestimmte Rasterbreiten (Einstieg 3–4, Bild und Text 1–4), Höhenvarianten und eine Darstellung nach realer Containerbreite.
|
||||
**Entscheidung.** Jede Widget-Art erklärt in der bestehenden Registry (`WidgetType`) einen gemeinsamen Layoutvertrag:
|
||||
- `supportedUnits()`: zulässige Platzbreiten aus 1–4; ein Platz mit anderer Breite wird beim Speichern mit verständlicher Meldung abgewiesen; `minUnits()` ist daraus abgeleitet.
|
||||
- `heights()`: angebotene Höhen aus einem gemeinsamen Vokabular (`auto`, `compact`, `normal`, `large`, `spacious`, `fill`), gespeichert als `settings.height`, geprüft wie jede Einstellung; Höhen sind Mindestwerte oder Proportionen, nie Begrenzungen.
|
||||
- `stages()` und `narrowBehavior()`: Darstellungsmodi und Verhalten bei reduziertem Platz, im Editor angezeigt.
|
||||
Die Widget-Ansichten entscheiden über Container-Abfragen nach der tatsächlichen Breite, nicht nach der Einheitenzahl. Keine zweite Registry, kein zweites Abschnittsmodell, keine freien CSS-Werte.
|
||||
**Alternativen.** Je Widget eigene Breitenlogik im Editor; feste Pixelhöhen; Höhe als Abschnittseinstellung (verworfen: doppelte, widersprüchliche Einstellmöglichkeit neben Abstand und Raster).
|
||||
**Folgen und offene Prüfung.** Premium-Einstieg (`hero` Version 2) und Bild und Text (`image_text` Version 3) heben ältere Instanzen beim Lesen an; gespeicherte Revisionen bleiben unverändert. Ein Einstieg in einem Platz mit 2 Einheiten ist nicht mehr zulässig (vorher Mindestbreite 2; auf der Testinstanz kein Bestand betroffen). Bewusste Abweichungen vom Kit: Bildfokus als `data.focus_x/focus_y` (Einstellungen tragen nur Aufzählungswerte), Überschriftenebene „Automatisch/H2/H3“ statt freier H1 (genau eine H1 je Seite), Linkziele über die bestehende `SafeUrl`-Regel. Praktische Redaktionsabnahme (Bedienung, Bildzuschnitte mit freigegebenen Motiven) steht aus.
|
||||
**Quelle.** Brand-UI-Kit v1.6 (`docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6`, `docs/layout-profiles.json`); `docs/architektur/cms-widget-registry.md` §§2, 4, 12; ADR-30, ADR-36.
|
||||
@@ -46,7 +46,7 @@ ## 2. Widget-Vertrag
|
||||
| `type` | Typkennung aus dem Register; ändert sich nie |
|
||||
| `v` | Schemaversion der Art |
|
||||
| `variant` | eine der für die Art registrierten Varianten |
|
||||
| `settings` | nur registrierte Aufzählungswerte; freie Werte werden abgewiesen. Seit Designiteration 1: `hero` (`focus`, `text_side`), `image_text` (`format`, `focus`). Fehlt ein Wert, gilt die Vorgabe der Darstellung |
|
||||
| `settings` | nur registrierte Aufzählungswerte (`WidgetType::settingOptions()`, einschließlich der gemeinsamen Höhe `height`); freie Werte werden abgewiesen. Fehlt ein Wert, gilt die Vorgabe der Darstellung |
|
||||
| `data` | redaktionelle Inhalte |
|
||||
| `refs` | Verweise auf Fachobjekte oder Medien, nur Kennungen bzw. Pfade im öffentlichen Bereich `cms/` |
|
||||
|
||||
@@ -62,39 +62,52 @@ ## 3. Versionierung und Altbestand
|
||||
- Unbekannte Widget-Arten werden ausgelassen; unbekannte Raster- oder Gestaltungswerte fallen beim Lesen auf Vorgaben zurück. Eine Hülle mit höherer Version als im Code wird bestmöglich dargestellt, aber nicht gespeichert.
|
||||
- Regel: Optionale neue Felder brauchen keine neue Version. Umbenennen, Umdeuten oder Verschieben von Feldern braucht eine neue Version mit `upgrade()` und einen Test. Gleiches gilt für die Abschnittshülle (`PageSections::VERSION`).
|
||||
|
||||
Beispiel: `image_text` Version 1 `{image, alt, body (Klartext)}` → Version 2 `data {title, body (bereinigtes HTML), alt}`, `refs {image}`, Variante `image_left`.
|
||||
Beispiele:
|
||||
- `image_text` Version 1 `{image, alt, body (Klartext)}` → Version 2 `data {title, body (bereinigtes HTML), alt}`, `refs {image}`, Variante `image_left` → Version 3 (Kit v1.6): `settings.format` entfällt, `settings.focus` wird zu `data.focus_x/focus_y` (Prozent).
|
||||
- `hero` Version 1 → Version 2 (Kit v1.6): Varianten `standard`/`stage` → `photo_split`, `highlight`/`editorial` → `editorial_solid`; `settings.focus` wird zu `data.focus_x/focus_y`, `settings.text_side` entfällt. Die data-Schlüssel (`heading`, `text`, `cta_*`, `alt`) bleiben, damit ein Code-Rollback darstellbar bleibt.
|
||||
|
||||
## 4. Registrierte Widget-Arten
|
||||
|
||||
| Kennung | Name | Version | Varianten | Verweise | Mindestbreite |
|
||||
|---|---|---|---|---|---|
|
||||
| `hero` | Einstieg (Hero) | 1 | `standard` (Bild neben dem Text), `highlight` (Markenfläche), `stage` (Markenbühne, randlos), `editorial` (textbetont) | `refs.image` | 2 |
|
||||
| `heading` | Überschrift und Einleitung | 1 | `standard` | – | 1 |
|
||||
| `prose` | Fließtext | 1 | `standard` | – | 1 |
|
||||
| `image_text` | Bild und Text | 2 | `image_left`, `image_right` | `refs.image` | 2 |
|
||||
| `cards` | Redaktionelle Karten | 1 | `standard` (Raster), `compact` (kompakte Liste), `featured` (erste Karte hervorgehoben) | Bild je Karte in `data.items[].image` | 1 |
|
||||
| `catalog_cards` | Programm- und Modulkarten | 1 | `standard` (Karten mit Kurzbeschreibung), `compact` (Liste) | `refs.items[] = {type: composition, id}` | 1 |
|
||||
| `call_to_action` | Handlungsaufruf | 1 | `standard` | – | 1 |
|
||||
| `faq` | FAQ | 1 | `standard` | – | 2 |
|
||||
| Kennung | Name | Version | Varianten | Breiten (Einheiten) | Höhen | Verweise |
|
||||
|---|---|---|---|---|---|---|
|
||||
| `hero` | Einstieg (Hero), Premium nach Kit v1.6 | 2 | `photo_split` (Foto mit Textfläche), `editorial_solid` (Navy-Markenfläche) | 3, 4 | `compact` (mind. 400 px), `normal` (512 px, Vorgabe), `large` (640 px) | `refs.image` |
|
||||
| `heading` | Überschrift und Einleitung | 1 | `standard` | 1–4 | – | – |
|
||||
| `prose` | Fließtext | 1 | `standard` | 1–4 | – | – |
|
||||
| `image_text` | Bild und Text, Premium nach Kit v1.6 | 3 | `image_left`, `image_right` (Bildseite) | 1–4 | `compact`, `normal` (Vorgabe), `spacious` | `refs.image` |
|
||||
| `cards` | Redaktionelle Karten | 1 | `standard` (Raster), `compact` (Liste), `featured` (erste Karte hervorgehoben) | 1–4 | – | Bild je Karte in `data.items[].image` |
|
||||
| `catalog_cards` | Programm- und Modulkarten | 1 | `standard`, `compact` | 1–4 | – | `refs.items[] = {type: composition, id}` |
|
||||
| `call_to_action` | Handlungsaufruf | 1 | `standard` | 1–4 | `auto` (Vorgabe), `fill` (Abschnittshöhe füllen) | – |
|
||||
| `faq` | FAQ | 1 | `standard` | 2–4 | – | – |
|
||||
|
||||
Darstellungsklassen: `widget widget-<typ> widget-variant-<variante>` an der Widget-Hülle; je Ansicht eigene Klassen (`hero-highlight`, `hero-stage`, `image-text-right`, `image-format-portrait`, `cards-compact`, `cards-featured`, `catalog-cards-compact`). Die visuelle Veredelung verändert nur `resources/views/widgets/*` und `resources/css/widgets.css`, nicht Daten, Register oder Editor.
|
||||
Darstellungsklassen an der Widget-Hülle: `widget widget-<typ> widget-variant-<variante>` und, wenn die Art Höhen anbietet, `widget-height-<höhe>`. Premium-Ansichten: `lf-hero lf-hero--{photo-split|editorial-solid} lf-hero--height-<höhe> lf-hero--accent-<akzent>` und `lf-bt lf-bt--{cream|clear|navy} lf-bt--image-{left|right} lf-bt--height-<höhe>`.
|
||||
|
||||
**Designiteration 1 (additiv, keine neue Version):**
|
||||
**Premium-Widgets (Kit v1.6).** Ansichten `resources/views/widgets/hero.blade.php` und `image_text.blade.php`, Stylesheets `resources/css/components/lf-hero.css` und `lf-bild-text.css` (aus `12_premium_widgets_adaptiv_v1.6/components/*.v1.6.css` übernommen und angepasst; sie ersetzen das frühere Hero- und Bild-und-Text-CSS und werden nicht parallel geladen). Gemeinsame Felder in `App\Domain\Cms\Widgets\Support\PremiumFields`:
|
||||
|
||||
| Art | Neu | Gespeichert als |
|
||||
| Feld | Gespeichert als | Hinweis |
|
||||
|---|---|---|
|
||||
| `hero` | Varianten `stage`, `editorial`; zweite Schaltfläche; Bildausschnitt; Textseite der Markenbühne | `variant`; `data.cta2_label`, `data.cta2_url` (sicheres Linkziel wie `cta_url`); `settings.focus` (Werte wie Abschnittsfokus), `settings.text_side` (`left`, `right`) |
|
||||
| `image_text` | Bildformat und Bildausschnitt | `settings.format` (`landscape`, `portrait`, `square`, `original`), `settings.focus` |
|
||||
| `cards` | Variante `featured`; ganze Karte über den Titellink klickbar | `variant` |
|
||||
| `catalog_cards` | Markentafel statt Bild, eine Karte breit mit Tafel daneben | keine Datenänderung |
|
||||
| Label | `data.eyebrow` | höchstens 80 Zeichen |
|
||||
| Überschrift | `data.heading` (Einstieg), `data.title` (Bild und Text) | |
|
||||
| Beschreibung | `data.text` (Klartext, Einstieg), `data.body` (bereinigter formatierter Text, Bild und Text) | |
|
||||
| Schaltflächen | `data.cta_label/cta_url`, `data.cta2_label/cta2_url` | Linkziele über `SafeUrl` |
|
||||
| Bild, Alternativtext | `refs.image`, `data.alt` | öffentlicher Bereich `cms/`; Alternativtext Pflicht bei Bild |
|
||||
| Bildfokus | `data.focus_x`, `data.focus_y` | ganze Zahlen 0–100; Vorgabe Einstieg 68/50, Bild und Text 64/43 |
|
||||
| Überschriftenebene | `settings.heading_level` | `auto` (Vorgabe), `h2`, `h3`; das erste Widget der Seite ist immer H1 |
|
||||
| Akzent (Einstieg) | `settings.accent` | `underline` (Vorgabe), `rays`, `none` |
|
||||
| Fläche (Bild und Text) | `settings.surface` | `cream` (Vorgabe), `clear` (übernimmt den Abschnitt), `navy` |
|
||||
| Höhe | `settings.height` | gemeinsamer Layoutvertrag (§12) |
|
||||
|
||||
Ältere Instanzen enthalten die neuen Schlüssel nicht und werden mit den Vorgaben dargestellt (Test `CmsDesignIterationTest`). Die erste Schaltfläche des Einstiegs ist jetzt die gelbe Markenschaltfläche (`button button-brand`).
|
||||
|
||||
**Randlos (`WidgetType::bleeds`).** Eine Markenbühne mit Bild, die allein in ihrem Abschnitt steht, setzt am Abschnitt `section-bleed`: kein Innenabstand, keine Breitenbegrenzung, das Bild reicht über die ganze Fensterbreite; die Texttafel richtet sich am Standardraster aus. In mehrspaltigen Abschnitten erscheint dieselbe Bühne als Bild mit runden Ecken und überlappender Tafel.
|
||||
**Abweichungen vom Kit (bewusst):**
|
||||
- Kennungen bleiben `hero` und `image_text`, nicht `lf-brand-hero`/`lf-editorial-bild-text`; Varianten `photo_split`/`editorial_solid` mit Unterstrich, weil Variantenkennungen `^[a-z][a-z0-9_]*$` folgen.
|
||||
- Bildseite von Bild und Text bleibt die Variante (`image_left/right`), nicht zusätzlich `settings.image_side`, damit es keine doppelte Einstellung gibt.
|
||||
- Bildfokus in `data` statt `settings.image_focus`, weil Einstellungen nur Aufzählungswerte tragen.
|
||||
- Überschriftenebene ohne frei wählbare H1 (Regel: genau eine H1 je Seite, erstes Widget).
|
||||
- Linkziele: Seitenpfad, `#Anker`, `http` und `https` (bestehende `SafeUrl`-Regel); das Kit erlaubt nur `https`.
|
||||
- Das Kit lädt das Einstiegsbild immer sofort; hier nur beim ersten Widget der Seite, alle anderen verzögert.
|
||||
- Kit-CSS ergänzt: Überschriften erben Farbe (globale h1–h3-Regeln), Unterstreichung als Block, Fläche `clear` übernimmt die Farben dunkler Abschnitte, Strahlen-Akzent aus `components/brand/rays.blade.php`, Fokusfarbe aus den Tokens.
|
||||
|
||||
## 5. Neues Widget hinzufügen
|
||||
|
||||
1. Klasse unter `app/Domain/Cms/Widgets/Types/` anlegen, von `WidgetType` ableiten. Pflicht: `key()`, `label()`, `description()`, `dataRules()`, `dataFields()`. Je nach Bedarf: `variants()`, `minUnits()`/`preferredUnits()`/`stages()` (Abschnitt 12), `refRules()`, `refFields()`, `clean()` (Links mit `SafeUrl`, Text mit `RichText::sanitize`, Bilder mit `ImageRefFields::clean`), `resolve()`, `mediaPaths()`, `summary()`, `schematic()`, `icon()`.
|
||||
1. Klasse unter `app/Domain/Cms/Widgets/Types/` anlegen, von `WidgetType` ableiten. Pflicht: `key()`, `label()`, `description()`, `dataRules()`, `dataFields()`. Je nach Bedarf: `variants()`, Layoutvertrag `supportedUnits()`/`preferredUnits()`/`heights()`/`stages()`/`narrowBehavior()` (Abschnitt 12), `settings()`/`settingLabels()`/`optionIcons()`, `mediaSchema()` für den Reiter „Medien“, `refRules()`, `refFields()`, `clean()` (Links mit `SafeUrl`, Text mit `RichText::sanitize`, Bilder mit `ImageRefFields::clean`), `resolve()`, `mediaPaths()`, `summary()`, `schematic()`, `icon()`.
|
||||
2. Ansicht `resources/views/widgets/<kennung>.blade.php` anlegen. Verfügbar: `$data`, `$refs`, `$variant`, `$settings`, `$first`, `$context` (Vorschau ja/nein) und die Rückgabe von `resolve()`. Kein `{!! !!}` außer für mit `RichText::sanitize` bereinigten Text. Breitenabhängige Regeln als Container-Abfrage `@container slot (…)`, nicht als Fenster-Medienabfrage; Farben nur über Bedeutungs-Tokens.
|
||||
3. Klasse in `config/cms.php` unter `widgets` eintragen.
|
||||
4. Tests ergänzen (Registrierung und Prüfregeln in `tests/Unit/WidgetRegistryTest.php`, Darstellung in `tests/Feature/CmsWidgetRenderingTest.php` bzw. `CmsSectionRenderingTest.php`).
|
||||
@@ -130,7 +143,9 @@ ## 8. Editor und Vorschau
|
||||
- **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, 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-Vorschau**: dieselbe Ansicht wie öffentlich, im isolierten `iframe` mit dem Website-Stylesheet, in der tatsächlichen Platzbreite (Container-Abfragen greifen). Keine eigene Bildlaufleiste; über 22 rem wird gekürzt mit Hinweis „vollständig in der Seitenvorschau“. Die Abschnittsfläche zeigt erst die Seitenvorschau.
|
||||
- **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.
|
||||
- **Widget-Vorschau im Platz**: dieselbe Ansicht im isolierten `iframe` in der Breite des Platzes im Editor; über 28 rem gekürzt mit Hinweis „vollständig in der Seitenvorschau“.
|
||||
- „Entwurf speichern“ erzeugt eine Revision (bei unverändertem Stand keine weitere). „Veröffentlichen“ speichert zuerst den aktuellen Stand im Editor und veröffentlicht genau diesen; enthält er Fehler, wird nichts veröffentlicht. Vorher veröffentlichte „Veröffentlichen“ nur die zuletzt gespeicherte Revision, sodass übernommene, aber ungespeicherte Änderungen (etwa ein gewähltes Bild) verloren gingen.
|
||||
- Verlassen oder Neuladen mit ungespeicherten Änderungen löst eine Warnung des Browsers aus.
|
||||
- Ganzseitige Vorschau: `/redaktion/vorschau/{revision}/geraete` mit Umschaltern 390/768/1440 px; zeigt Kopfzeile, Navigation, Abschnitte, Flächen, Trenner und Fußbereich mit demselben Renderer wie die öffentliche Seite; `noindex`.
|
||||
@@ -172,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.
|
||||
|
||||
**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.
|
||||
|
||||
## 10. Navigation
|
||||
@@ -214,19 +231,26 @@ ## 11. Abschnitte und Plätze
|
||||
- **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.
|
||||
|
||||
## 12. Responsive Widget-Regeln
|
||||
## 12. Responsive Widget-Regeln und gemeinsamer Layoutvertrag (ADR-38)
|
||||
|
||||
Jede Widget-Art meldet `minUnits()` (kleinste zulässige Platzbreite auf dem Desktop), `preferredUnits()` (Hinweis) und `stages()` (Darstellungsstufen). Jeder Platz ist ein Container (`slot`); die Widget-Ansichten verwenden Container-Abfragen statt Fensterbreiten.
|
||||
Jede Widget-Art erklärt in `WidgetType`:
|
||||
- `supportedUnits()`: zulässige Platzbreiten (1–4); `minUnits()` ist daraus abgeleitet. Ein Platz mit anderer Breite wird beim Speichern abgewiesen („… ist für Plätze mit 3 oder 4 Rastereinheiten vorgesehen“); der Platzkopf im Editor warnt vorher („passt nicht“), die Widget-Auswahl nennt die zulässigen Breiten.
|
||||
- `heights()`: angebotene Höhen aus `WidgetType::HEIGHTS` (`auto`, `compact`, `normal`, `large`, `spacious`, `fill`), gespeichert als `settings.height`; `defaultHeight()` gilt ohne Angabe. Höhen sind Mindesthöhen oder Proportionen, nie Begrenzungen. `fill` streckt das Widget auf die Höhe der Abschnittszeile, wenn Plätze nebeneinander stehen.
|
||||
- `stages()` und `narrowBehavior()`: Darstellungsmodi nach Containerbreite und Verhalten bei wenig Platz.
|
||||
|
||||
| Widget | Mindestbreite | Vorzug | Stufen |
|
||||
Jeder Platz ist ein Container (`slot`); die Premium-Widgets haben zusätzlich eigene Container (`lf-hero`, `lf-bt`). Entscheidend ist die tatsächliche Breite, nicht die Einheitenzahl.
|
||||
|
||||
| Widget | Breiten | Höhen | Darstellung nach Containerbreite |
|
||||
|---|---|---|---|
|
||||
| Einstieg (Hero) | 2 | 4 | unter 48 rem Bild unter dem Text; ab 48 rem nebeneinander; Überschrift wächst mit der Platzbreite. Markenbühne: unter 56 rem Bild 4:3 mit überlappender Tafel, ab 56 rem Bild über die ganze Bühne (30–46 rem hoch) mit Tafel links oder rechts. Editorial: ab 56 rem Beschreibung und Schaltflächen nebeneinander, Bild 21:9 |
|
||||
| Überschrift | 1 | 4 | Größe folgt der Platzbreite |
|
||||
| Fließtext | 1 | 2 | Zeilenlänge höchstens etwa 70 Zeichen |
|
||||
| Bild und Text | 2 | 4 | unter 36 rem gestapelt; ab 36 rem Bild und Text gleich breit; ab 56 rem Bild betont (7:5); festes Bildformat nach Einstellung |
|
||||
| Redaktionelle Karten | 1 | 4 | so viele Karten nebeneinander, wie bei 15 rem Kartenbreite passen; hervorgehobene erste Karte ab 44 rem mit Bild neben dem Text; kompakte Liste mit kleinem Bild rechts |
|
||||
| Programm- und Modulkarten | 1 | 4 | ab 17 rem Kartenbreite mehrspaltig; eine einzelne Karte ab 40 rem mit Tafel neben dem Text; kompakte Liste für schmale Plätze |
|
||||
| Handlungsaufruf | 1 | 2 | unter 20 rem Schaltfläche in voller Breite |
|
||||
| FAQ | 2 | 4 | Fragen untereinander, Antworten auf Lesebreite |
|
||||
| Einstieg (Hero) | 3, 4 | compact/normal/large | ab 860 px Foto über die Fläche, Text links, Mindesthöhe 400/512/640 px; darunter Sicherheitsumbruch: Foto 16:9 über dem Text, Höhe nach Inhalt; unter 440 px Schaltflächen untereinander |
|
||||
| Bild und Text | 1–4 | compact/normal/spacious | unter 540 px gestapelt, Schaltflächen in voller Breite; 540–899 px flacher Bildstreifen (2,5 : 1 / 2,15 : 1 / 1,8 : 1) über dem Text; ab 900 px zweispaltig, Bild links oder rechts |
|
||||
| Überschrift | 1–4 | – | Größe folgt der Platzbreite, lange Wörter werden getrennt |
|
||||
| Fließtext | 1–4 | – | Zeilenlänge höchstens etwa 70 Zeichen, lange Adressen brechen um |
|
||||
| Redaktionelle Karten | 1–4 | – | so viele Karten nebeneinander, wie bei 15 rem Kartenbreite passen; hervorgehobene Karte ab 44 rem mit Bild neben dem Text |
|
||||
| Programm- und Modulkarten | 1–4 | – | ab 17 rem Kartenbreite mehrspaltig; eine einzelne Karte ab 40 rem mit Tafel neben dem Text |
|
||||
| Handlungsaufruf | 1–4 | auto/fill | unter 20 rem Schaltfläche in voller Breite; Beschriftungen brechen um |
|
||||
| FAQ | 2–4 | – | Fragen untereinander, Antworten auf Lesebreite |
|
||||
|
||||
Ableitung: Ein Platz mit einer Einheit ist bei Standardbreite auf dem Desktop etwa 17 rem (rund 276 px) breit. Bild-neben-Text und Einstieg sind darin nicht sinnvoll lesbar (zwei Spalten unter je 140 px); Karten, Fließtext und Aufrufe bleiben es. Ein zu schmaler Platz wird beim Speichern mit Abschnitt und Platz gemeldet; der Platzkopf im Editor zeigt „zu schmal“ bereits vorher. Auf Tablet und Smartphone stapeln die Plätze, dort gilt die Mindestbreite nicht.
|
||||
Gemessene Platzbreiten im Standardabschnitt (82 rem) bei 1440 px Fensterbreite: 1 Einheit etwa 301–319 px, 2 Einheiten 638 px, 3 Einheiten 957 px, 4 Einheiten 1312 px. Bei 1200 px Fensterbreite hat ein Platz mit 3 Einheiten 807 px; der Einstieg zeigt dort den Sicherheitsumbruch.
|
||||
|
||||
Ableitung: Bild und Text funktioniert dank gestapelter Darstellung auch in einer Einheit; der Einstieg braucht für seine Komposition mindestens etwa 860 px und ist deshalb nur für 3 oder 4 Einheiten freigegeben. Auf Tablet und Smartphone stapeln die Plätze; dort gelten die Breitenregeln nicht, die Widgets reagieren auf ihre Containerbreite.
|
||||
@@ -146,6 +146,19 @@ ## 12. Breitenmodell (Designiteration 1)
|
||||
| Standard | `--width-standard` | 82 rem | `standard` | Grundraster; Kopfzeile, Fußbereich und Inhalt fluchten hier |
|
||||
| Breit | `--width-wide` | 96 rem | `wide` | bildstarke Kompositionen |
|
||||
| Vollbreite | – | 100 % abzüglich Randabstand | `full` | Inhalt bis an den Rand |
|
||||
| Randlos | – | 100 % | automatisch (`section-bleed`) | Markenbühne allein im Abschnitt |
|
||||
|
||||
Hintergründe reichen immer über die ganze Fensterbreite. `--frame-inset` = `max(Randabstand, (100 % − Standard) / 2)` richtet Inhalte in randlosen Flächen (Tafel der Markenbühne) am Standardraster aus, ohne `100vw` (kein Scrollbalkenfehler). Die Schlüssel der Abschnittsbreiten sind gespeicherte Daten und bleiben unverändert; nur die Werte wurden angepasst (vorher 45/75/90 rem).
|
||||
Hintergründe reichen immer über die ganze Fensterbreite. `--frame-inset` = `max(Randabstand, (100 % − Standard) / 2)` steht für Inhalte in fensterbreiten Flächen bereit, ohne `100vw` (kein Scrollbalkenfehler). Die randlose Markenbühne der Designiteration 1 ist mit Kit v1.6 entfallen; der Premium-Einstieg ist eine Karte im Abschnitt. Die Schlüssel der Abschnittsbreiten sind gespeicherte Daten und bleiben unverändert; nur die Werte wurden angepasst (vorher 45/75/90 rem).
|
||||
|
||||
## 13. Premium-Widgets (Brand-UI-Kit v1.6, ADR-38)
|
||||
|
||||
Einstieg und Bild und Text verwenden die Komponenten aus `docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6`, übernommen nach `resources/css/components/lf-hero.css` und `lf-bild-text.css` (über `app.css` geladen; das frühere Hero- und Bild-und-Text-CSS ist entfernt). Die Kit-Variablen `--lf-font-display`, `--lf-font-ui` und `--lf-muted` zeigen in `tokens.css` auf die gemeinsamen Werte. Nunito wird zusätzlich in Stärke 900 lokal ausgeliefert (Überschrift des Einstiegs).
|
||||
|
||||
| Paar | Kontrast |
|
||||
|---|---|
|
||||
| Label `#17370b` auf `#dff0c0` (Einstieg) | 10,9 : 1 |
|
||||
| Weiß auf Grün dunkel (Schaltflächen) | 5,22 : 1 |
|
||||
| Navy auf Creme / Weiß auf Navy (Flächen) | 14,0 / 15,1 : 1 |
|
||||
| Fließtext `#46556b` auf Creme (Bild und Text) | 7,0 : 1 |
|
||||
| Label `#295b08` auf Creme; `#fff2b0` auf Navy | 7,5 / 13,4 : 1 |
|
||||
|
||||
Bildmotive des Kits (`09_hero_widget/assets`, `10_bild_text_widget/assets`) sind für die öffentliche Verwendung nicht freigegeben; sie wurden nur lokal für die Sichtprüfung verwendet.
|
||||
@@ -10,6 +10,9 @@
|
||||
@import './site.css';
|
||||
@import './sections.css';
|
||||
@import './widgets.css';
|
||||
/* Premium-Widgets nach Brand-UI-Kit v1.6; ersetzen das frühere Hero- und Bild-und-Text-CSS. */
|
||||
@import './components/lf-hero.css';
|
||||
@import './components/lf-bild-text.css';
|
||||
|
||||
/*
|
||||
* Mitgliederbereich: eigene Anwendungsoberfläche mit eigener Navigation. Er verwendet die gemeinsamen
|
||||
|
||||
@@ -29,6 +29,9 @@ .ui-button {
|
||||
font: inherit;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
overflow-wrap: anywhere;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, border-color 0.15s ease;
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Premium-Bild-und-Text – übernommen aus docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-bild-text.v1.6.css.
|
||||
* Ersetzt das bisherige Bild-und-Text-CSS (nicht parallel laden). Die Darstellung folgt der tatsächlichen
|
||||
* Containerbreite, nicht der Einheitenzahl.
|
||||
*
|
||||
* Anpassungen an das Repository:
|
||||
* - Oberfläche „clear“ übernimmt die Bedeutungswerte des Abschnitts (auch auf dunklen Abschnitten lesbar).
|
||||
* - Überschrift erbt Farbe und Schrift (globale h1–h3-Regeln setzen sonst Navy).
|
||||
* - Fokusfarbe aus den Tokens; Schriften über --lf-font-display und --lf-font-ui.
|
||||
*/
|
||||
.lf-bt-host { container: lf-bt / inline-size; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; }
|
||||
.lf-bt-host, .lf-bt-host * { box-sizing: border-box; }
|
||||
|
||||
.lf-bt {
|
||||
--bt-navy: var(--lf-navy, #032551);
|
||||
--bt-green: var(--lf-green-deep, #3b7b09);
|
||||
--bt-yellow: var(--lf-yellow, #fcd10a);
|
||||
--bt-cream: var(--lf-cream, #f7f6f2);
|
||||
--bt-muted: var(--lf-muted, #46556b);
|
||||
--bt-eyebrow: #295b08;
|
||||
--bt-focus-x: 64%;
|
||||
--bt-focus-y: 43%;
|
||||
--color-focus: var(--lf-focus);
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: start;
|
||||
gap: clamp(0.9rem, 2.65cqi, 2rem);
|
||||
padding: clamp(1rem, 2.8cqi, 3.25rem);
|
||||
border-radius: clamp(1rem, 1.8cqi, 1.65rem);
|
||||
min-inline-size: 0;
|
||||
max-inline-size: 100%;
|
||||
background: var(--bt-cream);
|
||||
color: var(--bt-navy);
|
||||
font: 400 1rem/1.6 var(--lf-font-ui);
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.lf-bt--navy {
|
||||
--bt-muted: #f0f4f9;
|
||||
--bt-eyebrow: #fff2b0;
|
||||
--color-focus: var(--lf-yellow);
|
||||
background: var(--bt-navy);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Ohne eigene Fläche: Farben des Abschnitts (hell, dunkel, Markenakzent). */
|
||||
.lf-bt--clear {
|
||||
--bt-muted: var(--color-text-muted);
|
||||
--bt-eyebrow: var(--color-heading);
|
||||
--color-focus: inherit;
|
||||
background: transparent;
|
||||
color: var(--color-heading);
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
.lf-bt__copy { min-inline-size: 0; max-inline-size: 49rem; align-self: center; }
|
||||
|
||||
.lf-bt__eyebrow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
margin: 0 0 0.8rem;
|
||||
color: var(--bt-eyebrow);
|
||||
font-size: 0.73rem;
|
||||
line-height: 1.45;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.065em;
|
||||
text-transform: uppercase;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.lf-bt__eyebrow::before {
|
||||
content: '';
|
||||
flex: 0 0 auto;
|
||||
inline-size: 1.35rem;
|
||||
block-size: 0.25rem;
|
||||
background: var(--bt-yellow);
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.lf-bt__headline {
|
||||
margin: 0;
|
||||
color: inherit;
|
||||
font-family: var(--lf-font-display);
|
||||
font-size: clamp(1.55rem, 4.5cqi, 3.35rem);
|
||||
line-height: 1.14;
|
||||
letter-spacing: -0.03em;
|
||||
font-weight: 850;
|
||||
overflow-wrap: anywhere;
|
||||
hyphens: manual;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.lf-bt__accent {
|
||||
display: block;
|
||||
inline-size: clamp(4.6rem, 12cqi, 7rem);
|
||||
block-size: 0.36rem;
|
||||
margin: clamp(0.55rem, 1.7cqi, 1rem) 0 clamp(0.8rem, 2.3cqi, 1.25rem) 0.12rem;
|
||||
background: var(--bt-yellow);
|
||||
border-radius: 90% 35% 75% 40%;
|
||||
transform: rotate(-1deg);
|
||||
}
|
||||
|
||||
.lf-bt__body { color: var(--bt-muted); font-size: clamp(0.97rem, 1.45cqi, 1.12rem); line-height: 1.62; overflow-wrap: anywhere; }
|
||||
.lf-bt__body > :first-child { margin-block-start: 0; }
|
||||
.lf-bt__body > :last-child { margin-block-end: 0; }
|
||||
.lf-bt__body p { margin: 0 0 0.9em; }
|
||||
.lf-bt__body ul,
|
||||
.lf-bt__body ol { padding-inline-start: 1.35em; margin: 0.6em 0; }
|
||||
.lf-bt__body a { color: inherit; text-decoration: underline; text-underline-offset: 0.15em; }
|
||||
|
||||
.lf-bt__actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.65rem; margin-block-start: clamp(1rem, 2cqi, 1.5rem); min-inline-size: 0; }
|
||||
|
||||
.lf-bt__button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
max-inline-size: 100%;
|
||||
min-inline-size: 0;
|
||||
min-block-size: 2.95rem;
|
||||
padding: 0.7rem 1rem;
|
||||
background: var(--bt-green);
|
||||
border: 2px solid var(--bt-green);
|
||||
color: #fff;
|
||||
border-radius: 999px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
font-size: 0.89rem;
|
||||
font-weight: 800;
|
||||
line-height: 1.33;
|
||||
overflow-wrap: anywhere;
|
||||
white-space: normal;
|
||||
transition: background-color 0.14s ease, transform 0.14s ease;
|
||||
}
|
||||
|
||||
.lf-bt__button:visited { color: #fff; }
|
||||
.lf-bt__button:hover { background: #285a06; color: #fff; transform: translateY(-1px); }
|
||||
.lf-bt__button--secondary,
|
||||
.lf-bt__button--secondary:visited { background: transparent; border-color: currentColor; color: inherit; }
|
||||
.lf-bt__button--secondary:hover { background: rgb(3 37 81 / 6%); color: inherit; }
|
||||
.lf-bt--navy .lf-bt__button--secondary:hover,
|
||||
.scope-dark .lf-bt--clear .lf-bt__button--secondary:hover,
|
||||
.scope-accent .lf-bt--clear .lf-bt__button--secondary:hover { background: rgb(255 255 255 / 12%); }
|
||||
.lf-bt__button:focus-visible,
|
||||
.lf-bt__body a:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
|
||||
|
||||
.lf-bt__media { position: relative; display: block; order: -1; min-inline-size: 0; isolation: isolate; }
|
||||
|
||||
.lf-bt__media::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: auto -0.42rem -0.45rem 1rem;
|
||||
z-index: -1;
|
||||
block-size: 53%;
|
||||
border-radius: 1.1rem;
|
||||
background: #8ab848;
|
||||
transform: rotate(1.5deg);
|
||||
}
|
||||
|
||||
.lf-bt--navy .lf-bt__media::before { background: var(--bt-yellow); }
|
||||
|
||||
.lf-bt__image {
|
||||
display: block;
|
||||
inline-size: 100%;
|
||||
max-inline-size: none;
|
||||
block-size: auto;
|
||||
aspect-ratio: 16 / 10;
|
||||
object-fit: cover;
|
||||
object-position: var(--bt-focus-x) var(--bt-focus-y);
|
||||
border-radius: clamp(0.78rem, 1.8cqi, 1.3rem);
|
||||
box-shadow: 0 10px 28px rgb(3 37 81 / 11%);
|
||||
}
|
||||
|
||||
.lf-bt--height-compact .lf-bt__image { aspect-ratio: 16 / 9; }
|
||||
.lf-bt--height-spacious .lf-bt__image { aspect-ratio: 4 / 3; }
|
||||
.lf-bt--height-compact { gap: clamp(0.75rem, 2cqi, 1.45rem); }
|
||||
.lf-bt--height-spacious { gap: clamp(1.15rem, 3.4cqi, 2.7rem); }
|
||||
.lf-bt--without-image { grid-template-columns: minmax(0, 1fr); }
|
||||
|
||||
/* Schmale Plätze: vollständiger Text und Links, keine erzwungene Höhe. */
|
||||
@container lf-bt (max-width: 539.99px) {
|
||||
.lf-bt__actions { display: grid; grid-template-columns: minmax(0, 1fr); }
|
||||
.lf-bt__button { inline-size: 100%; }
|
||||
.lf-bt__headline { font-size: clamp(1.42rem, 6.8cqi, 2.2rem); }
|
||||
.lf-bt__eyebrow { letter-spacing: 0.03em; }
|
||||
}
|
||||
|
||||
/* Mittlere Containerbreite (meist zwei Einheiten): flacher Bildstreifen statt gequetschter Zweispaltigkeit. */
|
||||
@container lf-bt (min-width: 540px) and (max-width: 899.99px) {
|
||||
.lf-bt { gap: clamp(0.8rem, 1.6cqi, 1.2rem); padding: clamp(1.1rem, 2.4cqi, 1.65rem); }
|
||||
.lf-bt--clear { padding-inline: 0; }
|
||||
.lf-bt__media { inline-size: 100%; }
|
||||
.lf-bt__image { aspect-ratio: 2.15 / 1; }
|
||||
.lf-bt--height-compact .lf-bt__image { aspect-ratio: 2.5 / 1; }
|
||||
.lf-bt--height-spacious .lf-bt__image { aspect-ratio: 1.8 / 1; }
|
||||
.lf-bt__headline { font-size: clamp(1.65rem, 3.6cqi, 2.28rem); }
|
||||
.lf-bt__body { font-size: 1.01rem; line-height: 1.59; }
|
||||
.lf-bt__actions { margin-block-start: 0.95rem; }
|
||||
.lf-bt__button { flex: 1 1 13rem; }
|
||||
}
|
||||
|
||||
/* Breiter Container: zweispaltige Komposition, Bild links oder rechts. */
|
||||
@container lf-bt (min-width: 900px) {
|
||||
.lf-bt {
|
||||
grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
|
||||
align-items: center;
|
||||
gap: clamp(1.8rem, 4cqi, 4.5rem);
|
||||
padding: clamp(1.8rem, 4cqi, 4.5rem);
|
||||
}
|
||||
|
||||
.lf-bt--clear { padding-inline: 0; }
|
||||
.lf-bt__media { order: 0; align-self: stretch; }
|
||||
.lf-bt--image-left .lf-bt__media { order: -1; }
|
||||
.lf-bt__image { block-size: 100%; min-block-size: 18rem; aspect-ratio: 4 / 3; }
|
||||
.lf-bt--height-compact .lf-bt__image { min-block-size: 14rem; aspect-ratio: 3 / 2; }
|
||||
.lf-bt--height-spacious .lf-bt__image { min-block-size: 24rem; aspect-ratio: 1 / 1; }
|
||||
.lf-bt--height-compact { padding-block: clamp(1.25rem, 2.8cqi, 2.6rem); }
|
||||
.lf-bt--height-spacious { padding-block: clamp(2.15rem, 4.5cqi, 4.75rem); }
|
||||
.lf-bt--without-image { grid-template-columns: minmax(0, 1fr); }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.lf-bt__button { transition: none; }
|
||||
.lf-bt__button:hover { transform: none; }
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Premium-Einstieg – übernommen aus docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-hero.v1.6.css.
|
||||
* Ersetzt das bisherige Hero-CSS (nicht parallel laden).
|
||||
*
|
||||
* Anpassungen an das Repository (dokumentiert in docs/architektur/cms-widget-registry.md):
|
||||
* - Überschrift und Akzent erben Farbe und erhalten Blockdarstellung (die globalen h1–h3-Regeln setzen sonst Navy).
|
||||
* - Akzentwahl underline/rays/none; Strahlen aus resources/views/components/brand/rays.blade.php.
|
||||
* - Fokusfarbe und Schriften über die gemeinsamen Tokens (--lf-font-display, --lf-font-ui, --color-focus).
|
||||
* Die Höhen sind Mindesthöhen ab 860 px Containerbreite; Inhalte vergrößern jede Variante.
|
||||
*/
|
||||
.lf-hero-host { container: lf-hero / inline-size; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; }
|
||||
.lf-hero-host, .lf-hero-host * { box-sizing: border-box; }
|
||||
|
||||
.lf-hero {
|
||||
--lf-hero-navy: var(--lf-navy, #032551);
|
||||
--lf-hero-green: var(--lf-green-deep, #3b7b09);
|
||||
--lf-hero-yellow: var(--lf-yellow, #fcd10a);
|
||||
--lf-hero-cream: var(--lf-cream, #f7f6f2);
|
||||
--lf-hero-focus-x: 68%;
|
||||
--lf-hero-focus-y: 50%;
|
||||
--color-focus: var(--lf-focus);
|
||||
isolation: isolate;
|
||||
position: relative;
|
||||
display: grid;
|
||||
align-items: center;
|
||||
min-inline-size: 0;
|
||||
min-block-size: 32rem;
|
||||
max-inline-size: 100%;
|
||||
border-radius: clamp(1rem, 1.9cqi, 1.75rem);
|
||||
background: var(--lf-hero-cream);
|
||||
color: var(--lf-hero-navy);
|
||||
font-family: var(--lf-font-display);
|
||||
}
|
||||
|
||||
.lf-hero--height-compact { min-block-size: 25rem; }
|
||||
.lf-hero--height-normal { min-block-size: 32rem; }
|
||||
.lf-hero--height-large { min-block-size: 40rem; }
|
||||
|
||||
.lf-hero__photo {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: -2;
|
||||
inline-size: 100%;
|
||||
block-size: 100%;
|
||||
max-inline-size: none;
|
||||
object-fit: cover;
|
||||
object-position: var(--lf-hero-focus-x) var(--lf-hero-focus-y);
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
.lf-hero--photo-split::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: -1;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(90deg, rgb(250 249 243 / 99%) 0%, rgb(250 249 243 / 98%) 28%, rgb(250 249 243 / 85%) 41%, rgb(250 249 243 / 12%) 69%, transparent 80%);
|
||||
}
|
||||
|
||||
.lf-hero--editorial-solid {
|
||||
--color-focus: var(--lf-yellow);
|
||||
background: var(--lf-hero-navy);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.lf-hero--editorial-solid::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: auto -7% -50% auto;
|
||||
z-index: -1;
|
||||
inline-size: 40%;
|
||||
aspect-ratio: 1;
|
||||
background: var(--lf-hero-green);
|
||||
border-radius: 50%;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.lf-hero--editorial-solid { overflow: hidden; }
|
||||
|
||||
.lf-hero__inner {
|
||||
inline-size: 100%;
|
||||
max-inline-size: 1440px;
|
||||
min-inline-size: 0;
|
||||
margin-inline: auto;
|
||||
padding: clamp(1.8rem, 4.3cqi, 5rem);
|
||||
padding-block: clamp(2.1rem, 5cqi, 5rem);
|
||||
}
|
||||
|
||||
.lf-hero__copy { position: relative; max-inline-size: min(660px, 58%); min-inline-size: 0; }
|
||||
.lf-hero--editorial-solid .lf-hero__copy { max-inline-size: 760px; }
|
||||
|
||||
.lf-hero__eyebrow {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 0.35em 0.75em;
|
||||
border-radius: 999px;
|
||||
background: #dff0c0;
|
||||
color: #17370b;
|
||||
font-weight: 800;
|
||||
font-size: clamp(0.78rem, 1.25cqi, 0.95rem);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.lf-hero__title {
|
||||
margin: 0.25em 0;
|
||||
color: inherit;
|
||||
font-family: inherit;
|
||||
font-size: clamp(2.1rem, 5.4cqi, 4.9rem);
|
||||
line-height: 1.06;
|
||||
letter-spacing: -0.035em;
|
||||
font-weight: 900;
|
||||
text-wrap: balance;
|
||||
overflow-wrap: anywhere;
|
||||
hyphens: manual;
|
||||
}
|
||||
|
||||
.lf-hero__title-accent {
|
||||
display: block;
|
||||
inline-size: clamp(6rem, 15cqi, 15rem);
|
||||
block-size: 0.42rem;
|
||||
margin: 0 0 clamp(1.1rem, 2cqi, 1.5rem);
|
||||
background: var(--lf-hero-yellow);
|
||||
border-radius: 90% 30% 45% 25%;
|
||||
transform: rotate(-1deg);
|
||||
}
|
||||
|
||||
.lf-hero__rays {
|
||||
position: absolute;
|
||||
inset-block-start: -2.4rem;
|
||||
inset-inline-start: -2.2rem;
|
||||
inline-size: clamp(2.6rem, 4.5cqi, 3.6rem);
|
||||
color: var(--lf-hero-yellow);
|
||||
transform: rotate(-24deg);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.lf-hero__description {
|
||||
max-inline-size: 56ch;
|
||||
margin: 0 0 clamp(1.25rem, 2.1cqi, 2rem);
|
||||
font-family: var(--lf-font-ui);
|
||||
font-size: clamp(1.05rem, 1.7cqi, 1.3rem);
|
||||
line-height: 1.5;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.lf-hero__actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.75rem; min-inline-size: 0; }
|
||||
|
||||
.lf-hero__button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-inline-size: 0;
|
||||
max-inline-size: 100%;
|
||||
min-block-size: 3rem;
|
||||
padding: 0.77rem 1.2rem;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 999px;
|
||||
font: 800 0.96rem/1.28 var(--lf-font-ui);
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
transition: transform 0.15s ease, background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.lf-hero__button:hover { transform: translateY(-1px); }
|
||||
.lf-hero__button:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
|
||||
.lf-hero__button--primary,
|
||||
.lf-hero__button--primary:visited { background: var(--lf-hero-green); color: #fff; }
|
||||
.lf-hero__button--primary:hover { background: #285a06; color: #fff; }
|
||||
.lf-hero__button--secondary,
|
||||
.lf-hero__button--secondary:visited { background: rgb(255 255 255 / 95%); color: var(--lf-hero-navy); border-color: var(--lf-hero-navy); }
|
||||
.lf-hero__button--secondary:hover { color: var(--lf-hero-navy); }
|
||||
|
||||
.lf-hero__bottom {
|
||||
position: absolute;
|
||||
inset: auto 0 0;
|
||||
block-size: 15px;
|
||||
border-radius: 0 0 1.5rem 1.5rem;
|
||||
background: linear-gradient(105deg, var(--lf-hero-yellow) 0%, var(--lf-hero-yellow) 22%, var(--lf-hero-green) 72%);
|
||||
clip-path: polygon(0 45%, 30% 90%, 65% 75%, 100% 0, 100% 100%, 0 100%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Sicherheitsumbruch, wenn der Container physisch zu schmal ist; keine eigene redaktionelle Variante. */
|
||||
@container lf-hero (max-width: 859.99px) {
|
||||
.lf-hero { display: block; min-block-size: 0; }
|
||||
.lf-hero--height-compact,
|
||||
.lf-hero--height-normal,
|
||||
.lf-hero--height-large { min-block-size: 0; }
|
||||
.lf-hero__photo { position: relative; display: block; block-size: auto; aspect-ratio: 16 / 9; }
|
||||
.lf-hero--photo-split::before { display: none; }
|
||||
.lf-hero__inner { padding: clamp(1.2rem, 3.5cqi, 2rem); padding-block-end: 2.4rem; }
|
||||
.lf-hero__copy { max-inline-size: 100%; }
|
||||
.lf-hero__title { font-size: clamp(2rem, 5.5cqi, 3.1rem); }
|
||||
.lf-hero__description { font-size: 1.07rem; }
|
||||
.lf-hero--editorial-solid .lf-hero__copy { max-inline-size: 100%; }
|
||||
.lf-hero__rays { inset-block-start: -1.6rem; inset-inline-start: auto; inset-inline-end: 0; transform: rotate(10deg); }
|
||||
}
|
||||
|
||||
@container lf-hero (max-width: 440px) {
|
||||
.lf-hero__actions { display: grid; grid-template-columns: minmax(0, 1fr); }
|
||||
.lf-hero__button { inline-size: 100%; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.lf-hero__button { transition: none; }
|
||||
.lf-hero__button:hover { transform: none; }
|
||||
}
|
||||
@@ -71,6 +71,11 @@ :root {
|
||||
--color-theme-4: var(--color-surface-subtle);
|
||||
--color-theme-5: var(--color-surface-subtle);
|
||||
|
||||
/* Schriftvariablen der Kit-Komponenten (Brand-UI-Kit v1.6) zeigen auf die gemeinsamen Schriften. */
|
||||
--lf-font-display: var(--font-display);
|
||||
--lf-font-ui: var(--font-reading);
|
||||
--lf-muted: #46556b;
|
||||
|
||||
/* Typografie (Website-Zielkonzept 7.2: Fließtext 17 → 18 px, H1 34 → 52 px) */
|
||||
--font-reading: var(--font-sans);
|
||||
--text-small: 0.9375rem;
|
||||
|
||||
+27
-396
@@ -1,11 +1,37 @@
|
||||
/*
|
||||
* Widget-Ansichten (Designiteration 1). Jede Regel verwendet Bedeutungswerte und richtet sich nach der Slotbreite
|
||||
* Widget-Ansichten der Bestandswidgets. Jede Regel verwendet Bedeutungswerte und richtet sich nach der Slotbreite
|
||||
* (Container „slot“), nicht nach dem Fenster. Markenakzente (Unterstreichung, Strahlen) stammen aus
|
||||
* resources/views/components/brand und sind dekorativ.
|
||||
*/
|
||||
|
||||
.widget {
|
||||
min-width: 0;
|
||||
color: var(--color-text);
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gemeinsamer Layoutvertrag (ADR-38): Höhe „fill“ streckt das Widget auf die Höhe der Abschnittszeile, wenn Plätze
|
||||
* nebeneinander stehen. Gestapelt (schmaler Abschnitt) entspricht das der Inhaltshöhe. Inhalte werden nie begrenzt.
|
||||
*/
|
||||
.section-slot:has(> .widget-height-fill) {
|
||||
align-self: stretch;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.section-slot > .widget-height-fill {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.widget-height-fill > .cta {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.widget > :last-child,
|
||||
@@ -19,406 +45,11 @@ .widget-heading h2 {
|
||||
max-width: 22ch;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Einstieg (Hero)
|
||||
* Varianten: standard (Text | Bild), highlight (Markenfläche), stage (Markenbühne), editorial (textbetont).
|
||||
* ---------------------------------------------------------------------------------------------- */
|
||||
.hero {
|
||||
--hero-focus: 50% 50%;
|
||||
position: relative;
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.hero-copy > :is(h1, h2) {
|
||||
font-size: clamp(2.125rem, 1.2rem + 4.4cqi, 4rem);
|
||||
line-height: 1.05;
|
||||
letter-spacing: -0.025em;
|
||||
max-width: 15ch;
|
||||
margin: 0;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
/* Markenstrich unter der Überschrift: kurze gelbe Unterstreichung, kein Hervorheben einzelner Wörter. */
|
||||
.hero-mark {
|
||||
width: clamp(5.5rem, 4rem + 6cqi, 9rem);
|
||||
height: 0.9rem;
|
||||
margin: var(--space-3) 0 var(--space-5);
|
||||
}
|
||||
|
||||
.hero .lede {
|
||||
max-width: 48ch;
|
||||
margin: 0;
|
||||
font-size: clamp(1.125rem, 1rem + 0.6cqi, 1.3125rem);
|
||||
}
|
||||
|
||||
.hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3);
|
||||
margin-top: var(--space-6);
|
||||
}
|
||||
|
||||
.hero-copy {
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.hero-figure {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.hero-image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: var(--hero-focus);
|
||||
}
|
||||
|
||||
.hero-figure .hero-image {
|
||||
aspect-ratio: 4 / 3;
|
||||
border-radius: var(--radius-panel);
|
||||
}
|
||||
|
||||
.hero-rays {
|
||||
position: absolute;
|
||||
width: clamp(2.75rem, 2rem + 3cqi, 4.5rem);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Standard: Bild mit grüner Fläche als Versatz und Signalstrahlen an der Ecke. */
|
||||
.hero-standard .hero-figure::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 1.25rem -1.25rem -1.25rem 1.25rem;
|
||||
z-index: -1;
|
||||
border-radius: var(--radius-panel);
|
||||
background: var(--lf-green-tint);
|
||||
}
|
||||
|
||||
.hero-standard .hero-rays {
|
||||
top: -2.25rem;
|
||||
left: -1.75rem;
|
||||
transform: rotate(-18deg);
|
||||
}
|
||||
|
||||
@container slot (min-width: 48rem) {
|
||||
.hero-standard.hero-with-image {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
|
||||
gap: clamp(2.5rem, 6cqi, 5rem);
|
||||
}
|
||||
}
|
||||
|
||||
/* Hervorgehoben: dunkle Markenfläche mit gelben Akzenten. */
|
||||
.hero-highlight {
|
||||
padding: clamp(1.75rem, 6cqi, 4rem);
|
||||
border-radius: var(--radius-panel);
|
||||
background: var(--lf-navy);
|
||||
--color-text: #f4f6f8;
|
||||
--color-heading: var(--lf-white);
|
||||
--color-link: var(--lf-white);
|
||||
--color-link-hover: var(--lf-yellow);
|
||||
--color-focus: var(--lf-yellow);
|
||||
--color-border-strong: rgb(255 255 255 / 60%);
|
||||
--color-action-secondary-text: var(--lf-white);
|
||||
color: var(--color-text);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hero-highlight .hero-rays {
|
||||
top: clamp(1rem, 3cqi, 2rem);
|
||||
right: clamp(1rem, 4cqi, 2.5rem);
|
||||
}
|
||||
|
||||
.hero-highlight .hero-figure .hero-image {
|
||||
aspect-ratio: 16 / 10;
|
||||
}
|
||||
|
||||
@container slot (min-width: 48rem) {
|
||||
.hero-highlight.hero-with-image {
|
||||
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
|
||||
gap: clamp(2rem, 5cqi, 4rem);
|
||||
}
|
||||
}
|
||||
|
||||
/* Editorial: großer Text, Beschreibung und Schaltflächen nebeneinander, Bild als breites Band darunter. */
|
||||
.hero-editorial {
|
||||
gap: var(--space-7);
|
||||
}
|
||||
|
||||
.hero-editorial .hero-copy > :is(h1, h2) {
|
||||
font-size: clamp(2.375rem, 1.2rem + 5.6cqi, 5rem);
|
||||
max-width: 18ch;
|
||||
}
|
||||
|
||||
.hero-editorial .hero-figure .hero-image {
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
|
||||
/* Abgesetzter Markenstrich: liest sich als Abschluss der Überschrift, nicht als Hervorhebung eines Wortes. */
|
||||
.hero-editorial .hero-mark {
|
||||
width: clamp(9rem, 32cqi, 20rem);
|
||||
margin-top: var(--space-5);
|
||||
}
|
||||
|
||||
@container slot (min-width: 56rem) {
|
||||
.hero-editorial .hero-copy {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
|
||||
column-gap: clamp(2rem, 6cqi, 5rem);
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
.hero-editorial .hero-copy > :is(h1, h2),
|
||||
.hero-editorial .hero-mark {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.hero-editorial .hero-actions {
|
||||
margin-top: 0;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.hero-editorial .hero-figure .hero-image {
|
||||
aspect-ratio: 21 / 9;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Markenbühne: Bild über die volle Breite, Text auf einer hellen Tafel (Kontrast unabhängig vom Motiv).
|
||||
* Schmal: Bild oben im festen Format, Tafel überlappt den unteren Bildrand. Breit (ab 56rem): Bild füllt die Bühne,
|
||||
* die Tafel steht im Grundraster links oder rechts. Feste Formate verhindern Layoutverschiebungen beim Laden.
|
||||
*/
|
||||
.hero-stage {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hero-stage .hero-media {
|
||||
position: relative;
|
||||
aspect-ratio: 4 / 3;
|
||||
overflow: hidden;
|
||||
background: var(--lf-green-tint);
|
||||
}
|
||||
|
||||
.hero-stage .hero-frame {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding-inline: var(--gutter);
|
||||
}
|
||||
|
||||
.hero-stage.hero-with-image .hero-frame {
|
||||
margin-top: -3.5rem;
|
||||
}
|
||||
|
||||
.hero-stage .hero-copy {
|
||||
--color-text: var(--lf-ink);
|
||||
--color-heading: var(--lf-navy);
|
||||
--color-link: var(--lf-navy);
|
||||
--color-focus: var(--lf-focus);
|
||||
--color-border-strong: var(--lf-navy);
|
||||
--color-action-secondary-text: var(--lf-navy);
|
||||
color: var(--color-text);
|
||||
background: var(--lf-cream);
|
||||
border-radius: var(--radius-panel);
|
||||
padding: clamp(1.5rem, 1rem + 3cqi, 3rem);
|
||||
box-shadow: 0 18px 40px rgb(3 37 81 / 12%);
|
||||
}
|
||||
|
||||
.hero-stage .hero-rays {
|
||||
top: -1.6rem;
|
||||
right: 1.5rem;
|
||||
}
|
||||
|
||||
/* Ohne Bild: Markenbühne als ruhige Fläche. */
|
||||
.hero-stage:not(.hero-with-image) .hero-copy {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
@container slot (min-width: 56rem) {
|
||||
.hero-stage.hero-with-image {
|
||||
display: grid;
|
||||
min-height: clamp(30rem, 72svh, 46rem);
|
||||
}
|
||||
|
||||
.hero-stage .hero-media {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
aspect-ratio: auto;
|
||||
}
|
||||
|
||||
.hero-stage.hero-with-image .hero-frame {
|
||||
display: grid;
|
||||
align-items: center;
|
||||
justify-items: end;
|
||||
margin-top: 0;
|
||||
padding-block: clamp(3rem, 6cqi, 5.5rem);
|
||||
padding-inline: var(--frame-inset);
|
||||
}
|
||||
|
||||
.hero-stage.hero-text-left .hero-frame {
|
||||
justify-items: start;
|
||||
}
|
||||
|
||||
.hero-stage .hero-copy {
|
||||
width: min(36rem, 46%);
|
||||
}
|
||||
|
||||
.hero-stage .hero-rays {
|
||||
top: -2.25rem;
|
||||
right: auto;
|
||||
left: -2rem;
|
||||
transform: rotate(-18deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Randlos (SectionRenderer: section-bleed): keine Begrenzung, Abstand nach unten bleibt für die Tafel. */
|
||||
.section-bleed {
|
||||
padding-block: 0;
|
||||
}
|
||||
|
||||
.section-bleed .page-section-inner {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Schmal: Abstand unter der Tafel bis zum nächsten Abschnitt. */
|
||||
@container slot (max-width: 55.99rem) {
|
||||
.section-bleed .hero-stage .hero-frame {
|
||||
padding-bottom: clamp(2rem, 8cqi, 3.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
/* Nicht randlos (Markenbühne in schmaleren Abschnitten oder Rastern): Bild mit runden Ecken. */
|
||||
.page-section:not(.section-bleed) .hero-stage .hero-media {
|
||||
border-radius: var(--radius-panel);
|
||||
}
|
||||
|
||||
.page-section:not(.section-bleed) .hero-stage .hero-frame {
|
||||
padding-inline: clamp(0.75rem, 4cqi, 2.5rem);
|
||||
}
|
||||
|
||||
/* Fließtext */
|
||||
.widget-prose .prose p {
|
||||
margin: 0 0 var(--space-4);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bild und Text. Varianten: image_left, image_right. Stufen: schmal (gestapelt), ab 36rem nebeneinander,
|
||||
* ab 56rem Bild betont. Formate über Einstellung: Quer-, Hochformat, Quadrat, Original.
|
||||
* ---------------------------------------------------------------------------------------------- */
|
||||
.image-text {
|
||||
--image-focus: 50% 50%;
|
||||
--image-ratio: 4 / 3;
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
}
|
||||
|
||||
.image-format-portrait {
|
||||
--image-ratio: 4 / 5;
|
||||
}
|
||||
|
||||
.image-format-square {
|
||||
--image-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
.image-text-figure {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Versetzte Markenfläche hinter dem Bild, auf der Außenseite des Textes. */
|
||||
.image-text-figure::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0.6rem -0.6rem -0.6rem 0.6rem;
|
||||
z-index: -1;
|
||||
border-radius: var(--radius-panel);
|
||||
background: var(--lf-yellow-tint);
|
||||
}
|
||||
|
||||
@container slot (min-width: 36rem) {
|
||||
.image-text-figure::before {
|
||||
inset: 1rem 1rem -1rem -1rem;
|
||||
}
|
||||
|
||||
.image-text-right .image-text-figure::before {
|
||||
inset: 1rem -1rem -1rem 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.scope-dark .image-text-figure::before,
|
||||
.scope-accent .image-text-figure::before {
|
||||
background: rgb(255 255 255 / 12%);
|
||||
}
|
||||
|
||||
.image-text-figure img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
aspect-ratio: var(--image-ratio);
|
||||
object-fit: cover;
|
||||
object-position: var(--image-focus);
|
||||
border-radius: var(--radius-panel);
|
||||
}
|
||||
|
||||
.image-format-original .image-text-figure img {
|
||||
aspect-ratio: auto;
|
||||
}
|
||||
|
||||
.image-text-copy > :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.image-text-copy h1,
|
||||
.image-text-copy h2 {
|
||||
font-size: clamp(1.75rem, 1.2rem + 2.4cqi, 2.75rem);
|
||||
line-height: 1.1;
|
||||
max-width: 20ch;
|
||||
margin: 0;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.image-text-mark {
|
||||
width: 5rem;
|
||||
height: 0.75rem;
|
||||
margin: var(--space-3) 0 var(--space-5);
|
||||
}
|
||||
|
||||
.image-text-copy .prose {
|
||||
font-size: clamp(1.0625rem, 1rem + 0.25cqi, 1.1875rem);
|
||||
}
|
||||
|
||||
@container slot (min-width: 36rem) {
|
||||
.image-text {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: clamp(2rem, 5cqi, 4rem);
|
||||
}
|
||||
|
||||
.image-text-right > .image-text-figure {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.image-text-no-image {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@container slot (min-width: 56rem) {
|
||||
.image-text-left {
|
||||
grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
|
||||
}
|
||||
|
||||
.image-text-right {
|
||||
grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
|
||||
}
|
||||
|
||||
.image-text-no-image {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Redaktionelle Karten. Varianten: Raster (cards-grid), kompakte Liste (cards-compact),
|
||||
* erste Karte hervorgehoben (cards-featured). Die ganze Karte ist über den Titellink klickbar.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
/* Widget-Vorschau: kompakt, ohne eigene Bildlaufleiste; lange Inhalte werden gekürzt angezeigt. */
|
||||
.luf-widget-preview { position: relative; }
|
||||
.luf-widget-preview-frame { display: block; width: 100%; min-height: 3rem; max-height: 22rem; border: 0; overflow: hidden; pointer-events: none; background: #fff; }
|
||||
.luf-widget-preview-frame { display: block; width: 100%; min-height: 3rem; max-height: 28rem; border: 0; overflow: hidden; pointer-events: none; background: #fff; }
|
||||
.luf-widget-preview.is-clipped::after {
|
||||
content: 'Vorschau gekürzt – vollständig in der Seitenvorschau';
|
||||
position: absolute; inset: auto 0 0 0; padding: 2.5rem .75rem .5rem;
|
||||
@@ -18,6 +18,13 @@
|
||||
}
|
||||
.luf-widget-preview-empty { margin: 0; padding: 1rem; font-size: .875rem; opacity: .75; }
|
||||
|
||||
/* Live-Vorschau im Bearbeitungsdialog: feste logische Breite, auf die Dialogbreite verkleinert. */
|
||||
.luf-live-preview { border: 1px solid rgb(0 0 0 / 10%); border-radius: .75rem; padding: .75rem; background: rgb(247 246 242 / 60%); }
|
||||
.luf-live-preview-caption { margin: 0 0 .5rem; font-size: .75rem; opacity: .75; }
|
||||
.luf-live-preview-stage { position: relative; overflow: hidden; background: #fff; border-radius: .5rem; }
|
||||
.luf-live-preview-frame { display: block; border: 0; pointer-events: none; background: #fff; transform-origin: 0 0; }
|
||||
.luf-preview-width .fi-btn-group { flex-wrap: wrap; }
|
||||
|
||||
/* Abschnitte: breite Arbeitsfläche, deutlich abgesetzte Abschnitte */
|
||||
.luf-sections > .fi-fo-repeater-items { gap: 1.25rem; }
|
||||
.luf-sections > .fi-fo-repeater-items > .fi-fo-repeater-item { border-left: 4px solid rgb(3 37 81 / 70%); }
|
||||
@@ -50,8 +57,34 @@
|
||||
</style>
|
||||
<script>
|
||||
// Vorschau-Iframes an ihren Inhalt anpassen (nach Bildern und Schriften erneut), Höhe begrenzen.
|
||||
// Live-Vorschau im Dialog: Inhalt in logischer Breite rendern, dann auf die verfügbare Breite skalieren.
|
||||
window.lufLivePreview = window.lufLivePreview || function (frame) {
|
||||
const stage = frame.parentElement;
|
||||
const width = Number(frame.dataset.width) || 1200;
|
||||
const fit = () => {
|
||||
const doc = frame.contentDocument;
|
||||
if (!doc || !doc.documentElement || !stage) return;
|
||||
const scale = Math.min(1, stage.clientWidth / width);
|
||||
frame.style.width = width + 'px';
|
||||
const height = doc.documentElement.scrollHeight;
|
||||
frame.style.height = height + 'px';
|
||||
frame.style.transform = 'scale(' + scale + ')';
|
||||
stage.style.height = Math.ceil(height * scale) + 'px';
|
||||
};
|
||||
fit();
|
||||
try {
|
||||
const doc = frame.contentDocument;
|
||||
doc.fonts?.ready.then(fit);
|
||||
doc.querySelectorAll('img').forEach((img) => img.complete || img.addEventListener('load', fit, { once: true }));
|
||||
if (window.ResizeObserver) {
|
||||
new ResizeObserver(fit).observe(doc.body);
|
||||
new ResizeObserver(fit).observe(stage);
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
window.lufFitPreview = window.lufFitPreview || function (frame) {
|
||||
const max = 352;
|
||||
const max = 448;
|
||||
const fit = () => {
|
||||
const doc = frame.contentDocument;
|
||||
if (!doc || !doc.documentElement) return;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{{--
|
||||
Live-Vorschau im Bearbeitungsdialog eines Widgets. Gerendert wird mit derselben Widget-Ansicht wie auf der
|
||||
öffentlichen Seite (WidgetEditor::renderPreview), in einer festen logischen Breite und auf die Dialogbreite
|
||||
verkleinert. So greifen die Container-Abfragen der Widgets wie auf der Website.
|
||||
--}}
|
||||
@php
|
||||
$document = '<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><base target="_blank">'
|
||||
.$stylesheets
|
||||
.'<style>html,body{background:#fff;overflow:hidden}html{scrollbar-gutter:auto}body{margin:0;padding:0;min-height:0}main{display:block}</style>'
|
||||
.'</head><body><main class="sheet-preview"><div class="section-slot">'.$html.'</div></main></body></html>';
|
||||
@endphp
|
||||
<div class="luf-live-preview">
|
||||
<p class="luf-live-preview-caption">Vorschau bei {{ $width }} px Platzbreite, verkleinert. Gleiche Darstellung wie auf der Website.</p>
|
||||
@if (trim($html) === '')
|
||||
<p class="luf-widget-preview-empty">Dieses Widget zeigt mit den aktuellen Angaben öffentlich nichts an.</p>
|
||||
@else
|
||||
<div class="luf-live-preview-stage" wire:key="live-preview-{{ md5($document) }}-{{ $width }}">
|
||||
<iframe
|
||||
class="luf-live-preview-frame"
|
||||
title="Live-Vorschau des Widgets"
|
||||
tabindex="-1"
|
||||
scrolling="no"
|
||||
data-width="{{ $width }}"
|
||||
srcdoc="{{ $document }}"
|
||||
onload="window.lufLivePreview && window.lufLivePreview(this)"
|
||||
></iframe>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@@ -1,52 +1,45 @@
|
||||
{{--
|
||||
Einstieg (Hero). Varianten:
|
||||
- standard: Text neben dem Bild (ältere Instanzen unverändert gültig)
|
||||
- highlight: dunkle Markenfläche
|
||||
- stage: Markenbühne, Bild über die volle Breite, Text auf heller Tafel (randlos, wenn allein im Abschnitt)
|
||||
- editorial: textbetonter Einstieg, Bild optional als breites Band darunter
|
||||
Das Bild des ersten Widgets wird sofort geladen (größtes Element), alle anderen verzögert.
|
||||
Premium-Einstieg (Brand-UI-Kit v1.6, Komponente lf-hero), angepasst an die Widget-Hülle der Registry.
|
||||
Varianten: photo_split (Foto mit heller Textfläche), editorial_solid (Navy-Markenfläche ohne Foto).
|
||||
Höhen compact/normal/large sind Mindesthöhen ab 860 px Containerbreite; darunter Sicherheitsumbruch.
|
||||
Das Bild des ersten Widgets der Seite wird sofort geladen, alle anderen verzögert.
|
||||
--}}
|
||||
@php
|
||||
$variant = in_array($variant, ['standard', 'highlight', 'stage', 'editorial'], true) ? $variant : 'standard';
|
||||
$headingTag = ! empty($first) ? 'h1' : 'h2';
|
||||
$layout = $variant === 'editorial_solid' ? 'editorial-solid' : 'photo-split';
|
||||
$heightClass = in_array($height, ['compact', 'normal', 'large'], true) ? $height : 'normal';
|
||||
$tag = \App\Domain\Cms\Widgets\Support\PremiumFields::headingTag($settings, ! empty($first));
|
||||
$loading = ! empty($first) ? 'loading="eager" fetchpriority="high"' : 'loading="lazy"';
|
||||
@endphp
|
||||
<div @class([
|
||||
'hero',
|
||||
'hero-'.$variant,
|
||||
'hero-with-image' => $imageUrl,
|
||||
'hero-text-left' => $variant === 'stage' && $textSide === 'left',
|
||||
]) style="--hero-focus: {{ $focus }}">
|
||||
@if ($imageUrl && $variant === 'stage')
|
||||
<div class="hero-media">
|
||||
<img class="hero-image" src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" {!! $loading !!} decoding="async">
|
||||
</div>
|
||||
@endif
|
||||
<div class="hero-frame">
|
||||
<div class="hero-copy">
|
||||
@if ($variant === 'stage' || $variant === 'highlight')
|
||||
<x-brand.rays class="hero-rays" />
|
||||
@endif
|
||||
<{{ $headingTag }}>{{ $data['heading'] ?? '' }}</{{ $headingTag }}>
|
||||
<x-brand.underline class="hero-mark" />
|
||||
@if (filled($data['text'] ?? null))
|
||||
<p class="lede">{{ $data['text'] }}</p>
|
||||
@endif
|
||||
@if ($actions !== [])
|
||||
<div class="hero-actions">
|
||||
@foreach ($actions as $index => $item)
|
||||
<a @class(['button', 'button-brand' => $index === 0, 'button-secondary' => $index > 0]) href="{{ $item['url'] }}">{{ $item['label'] }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<div class="lf-hero-host">
|
||||
<div class="lf-hero lf-hero--{{ $layout }} lf-hero--height-{{ $heightClass }} lf-hero--accent-{{ $accent }}"
|
||||
style="--lf-hero-focus-x: {{ $focus['x'] }}%; --lf-hero-focus-y: {{ $focus['y'] }}%">
|
||||
@if ($layout === 'photo-split' && $imageUrl)
|
||||
<img class="lf-hero__photo" src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" {!! $loading !!} decoding="async">
|
||||
@endif
|
||||
<div class="lf-hero__inner">
|
||||
<div class="lf-hero__copy">
|
||||
@if ($accent === 'rays')
|
||||
<x-brand.rays class="lf-hero__rays" />
|
||||
@endif
|
||||
@if (filled($data['eyebrow'] ?? null))
|
||||
<p class="lf-hero__eyebrow">{{ $data['eyebrow'] }}</p>
|
||||
@endif
|
||||
<{{ $tag }} class="lf-hero__title">{{ $data['heading'] ?? '' }}</{{ $tag }}>
|
||||
@if ($accent !== 'none')
|
||||
<span class="lf-hero__title-accent" aria-hidden="true"></span>
|
||||
@endif
|
||||
@if (filled($data['text'] ?? null))
|
||||
<p class="lf-hero__description">{{ $data['text'] }}</p>
|
||||
@endif
|
||||
@if ($actions !== [])
|
||||
<div class="lf-hero__actions">
|
||||
@foreach ($actions as $index => $item)
|
||||
<a @class(['lf-hero__button', 'lf-hero__button--primary' => $index === 0, 'lf-hero__button--secondary' => $index > 0]) href="{{ $item['url'] }}">{{ $item['label'] }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<span class="lf-hero__bottom" aria-hidden="true"></span>
|
||||
</div>
|
||||
@if ($imageUrl && $variant !== 'stage')
|
||||
<figure class="hero-figure">
|
||||
<img class="hero-image" src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" {!! $loading !!} decoding="async">
|
||||
@if ($variant === 'standard')
|
||||
<x-brand.rays class="hero-rays" />
|
||||
@endif
|
||||
</figure>
|
||||
@endif
|
||||
</div>
|
||||
@@ -1,19 +1,47 @@
|
||||
{{-- Bild und Text. Varianten: image_left, image_right. Einstellungen: Bildformat und Bildausschnitt. --}}
|
||||
<div class="image-text image-text-{{ $variant === 'image_right' ? 'right' : 'left' }} @unless ($imageUrl) image-text-no-image @endunless image-format-{{ $format }}" style="--image-focus: {{ $focus }}">
|
||||
@if ($imageUrl)
|
||||
<figure class="image-text-figure">
|
||||
<img src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
|
||||
</figure>
|
||||
@endif
|
||||
<div class="image-text-copy">
|
||||
@if (filled($data['title'] ?? null))
|
||||
@if (! empty($first))
|
||||
<h1>{{ $data['title'] }}</h1>
|
||||
@else
|
||||
<h2>{{ $data['title'] }}</h2>
|
||||
{{--
|
||||
Premium-Bild-und-Text (Brand-UI-Kit v1.6, Komponente lf-bild-text), angepasst an die Widget-Hülle der Registry.
|
||||
Darstellung nach tatsächlicher Containerbreite: unter 540 px gestapelt, 540–899 px flacher Bildstreifen,
|
||||
ab 900 px zweispaltig mit Bild links oder rechts (Variante). Die Höhe ändert Bildproportion und Abstände,
|
||||
nie die zulässige Textmenge. Der Text ist bereits bereinigter formatierter Text (RichText::sanitize).
|
||||
--}}
|
||||
@php
|
||||
$side = $variant === 'image_left' ? 'left' : 'right';
|
||||
$heightClass = in_array($height, ['compact', 'normal', 'spacious'], true) ? $height : 'normal';
|
||||
$tag = \App\Domain\Cms\Widgets\Support\PremiumFields::headingTag($settings, ! empty($first));
|
||||
@endphp
|
||||
<div class="lf-bt-host">
|
||||
<div @class([
|
||||
'lf-bt',
|
||||
'lf-bt--'.$surface,
|
||||
'lf-bt--image-'.$side,
|
||||
'lf-bt--height-'.$heightClass,
|
||||
'lf-bt--without-image' => ! $imageUrl,
|
||||
]) style="--bt-focus-x: {{ $focus['x'] }}%; --bt-focus-y: {{ $focus['y'] }}%">
|
||||
<div class="lf-bt__copy">
|
||||
@if (filled($data['eyebrow'] ?? null))
|
||||
<p class="lf-bt__eyebrow">{{ $data['eyebrow'] }}</p>
|
||||
@endif
|
||||
<x-brand.underline class="image-text-mark" />
|
||||
@if (filled($data['title'] ?? null))
|
||||
<{{ $tag }} class="lf-bt__headline">{{ $data['title'] }}</{{ $tag }}>
|
||||
<span class="lf-bt__accent" aria-hidden="true"></span>
|
||||
@endif
|
||||
<div class="lf-bt__body">{!! $body !!}</div>
|
||||
@if ($actions !== [])
|
||||
<div class="lf-bt__actions">
|
||||
@foreach ($actions as $index => $item)
|
||||
@if ($index === 0)
|
||||
<a class="lf-bt__button" href="{{ $item['url'] }}">{{ $item['label'] }} <span aria-hidden="true">→</span></a>
|
||||
@else
|
||||
<a class="lf-bt__button lf-bt__button--secondary" href="{{ $item['url'] }}">{{ $item['label'] }}</a>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($imageUrl)
|
||||
<div class="lf-bt__media">
|
||||
<img class="lf-bt__image" src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
|
||||
</div>
|
||||
@endif
|
||||
<div class="prose">{!! $body !!}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -7,12 +7,11 @@
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Designiteration 1: stabiler Website-Rahmen, Markenakzente und neue Widget-Varianten.
|
||||
* Alle Erweiterungen sind additiv: gespeicherte Widgets bleiben gültig und werden wie bisher dargestellt.
|
||||
* Designiteration 1: stabiler Website-Rahmen, Markenakzente und Karten-Varianten.
|
||||
* Einstieg und Bild und Text sind seit Kit v1.6 Premium-Widgets (Tests in CmsPremiumWidgetsTest).
|
||||
*/
|
||||
class CmsDesignIterationTest extends TestCase
|
||||
{
|
||||
@@ -65,91 +64,6 @@ public function test_footer_shows_legal_links_in_the_base_row_and_a_decorative_a
|
||||
$this->assertMatchesRegularExpression('#<svg class="brand-arc site-footer-arc"[^>]*aria-hidden="true"#', $html);
|
||||
}
|
||||
|
||||
public function test_hero_stored_before_this_iteration_renders_unchanged_content(): void
|
||||
{
|
||||
$html = $this->publish('/alt', [[
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'standard',
|
||||
'data' => ['heading' => 'Stark im Alltag', 'text' => 'Einstieg', 'cta_label' => 'Mehr', 'cta_url' => '/praevention', 'alt' => 'Bild'],
|
||||
'refs' => ['image' => 'cms/alt.jpg'],
|
||||
]]);
|
||||
|
||||
$this->assertStringContainsString('class="hero hero-standard hero-with-image"', $html);
|
||||
$this->assertStringContainsString('<h1>Stark im Alltag</h1>', $html);
|
||||
$this->assertStringContainsString('<p class="lede">Einstieg</p>', $html);
|
||||
$this->assertSame(1, substr_count($html, 'class="button button-brand"'));
|
||||
$this->assertStringNotContainsString('button-secondary', $html);
|
||||
$this->assertStringContainsString('alt="Bild" loading="eager" fetchpriority="high" decoding="async"', $html);
|
||||
$this->assertStringNotContainsString('section-bleed', $html);
|
||||
}
|
||||
|
||||
public function test_brand_stage_bleeds_only_when_it_is_alone_in_its_section_and_has_an_image(): void
|
||||
{
|
||||
$stage = fn (?string $image) => [
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'stage',
|
||||
'settings' => ['focus' => 'left', 'text_side' => 'left'],
|
||||
'data' => ['heading' => 'Bühne', 'alt' => $image ? 'Motiv' : null],
|
||||
'refs' => ['image' => $image],
|
||||
];
|
||||
|
||||
$html = $this->publish('/buehne', [
|
||||
$this->section('u4', [$stage('cms/buehne.jpg')], ['width' => 'full']),
|
||||
$this->section('u2_2', [$stage('cms/buehne.jpg'), ['type' => 'prose', 'v' => 1, 'data' => ['body' => '<p>Text</p>']]]),
|
||||
$this->section('u4', [$stage(null)]),
|
||||
]);
|
||||
|
||||
$this->assertSame(1, substr_count($html, 'section-bleed'));
|
||||
$this->assertMatchesRegularExpression('#class="page-section [^"]*section-bleed"#', $html);
|
||||
$this->assertStringContainsString('class="hero hero-stage hero-with-image hero-text-left" style="--hero-focus: 0% 50%"', $html);
|
||||
$this->assertStringContainsString('<div class="hero-media">', $html);
|
||||
// Nur das erste Bild der Seite wird sofort geladen.
|
||||
$this->assertSame(1, substr_count($html, 'fetchpriority="high"'));
|
||||
}
|
||||
|
||||
public function test_hero_renders_a_second_action_and_rejects_unsafe_targets(): void
|
||||
{
|
||||
$html = $this->publish('/zwei', [[
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'editorial',
|
||||
'data' => ['heading' => 'Konzept', 'cta_label' => 'Programme', 'cta_url' => '/programme', 'cta2_label' => 'Mitgliederbereich', 'cta2_url' => '/bereich'],
|
||||
]]);
|
||||
|
||||
$this->assertStringContainsString('class="hero hero-editorial"', $html);
|
||||
$this->assertStringContainsString('<a class="button button-brand" href="/programme">Programme</a>', $html);
|
||||
$this->assertStringContainsString('<a class="button button-secondary" href="/bereich">Mitgliederbereich</a>', $html);
|
||||
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize([[
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'stage',
|
||||
'data' => ['heading' => 'X', 'cta2_label' => 'Böse', 'cta2_url' => 'javascript:alert(1)'],
|
||||
]]);
|
||||
$this->fail('Unsicheres zweites Linkziel wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.data.cta2_url', $exception->errors());
|
||||
}
|
||||
}
|
||||
|
||||
public function test_image_settings_are_enumerations_only(): void
|
||||
{
|
||||
$html = $this->publish('/format', [[
|
||||
'type' => 'image_text', 'v' => 2, 'variant' => 'image_left',
|
||||
'settings' => ['format' => 'portrait', 'focus' => 'top_right'],
|
||||
'data' => ['title' => 'Hochformat', 'body' => '<p>Text</p>', 'alt' => 'Motiv'],
|
||||
'refs' => ['image' => 'cms/hoch.jpg'],
|
||||
]]);
|
||||
|
||||
$this->assertStringContainsString('class="image-text image-text-left image-format-portrait" style="--image-focus: 100% 0%"', $html);
|
||||
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize([[
|
||||
'type' => 'image_text', 'v' => 2, 'variant' => 'image_left',
|
||||
'settings' => ['format' => 'panorama; color: red'],
|
||||
'data' => ['body' => '<p>Text</p>'],
|
||||
]]);
|
||||
$this->fail('Freier Einstellungswert wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.settings.format', $exception->errors());
|
||||
}
|
||||
}
|
||||
|
||||
public function test_featured_cards_lead_with_the_first_card_and_link_the_whole_card(): void
|
||||
{
|
||||
$html = $this->publish('/karten', [[
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Testing\TestAction;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\Slider;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -49,7 +51,7 @@ public function test_editor_creates_a_page_with_sections_and_registered_widgets_
|
||||
'seo_title' => 'Themenseite',
|
||||
'sections' => [
|
||||
$this->sectionState('u4', [
|
||||
['type' => 'hero', 'data' => ['variant' => 'highlight', 'data' => ['heading' => 'Stark im Alltag', 'text' => 'Einstieg']]],
|
||||
['type' => 'hero', 'data' => ['variant' => 'editorial_solid', 'data' => ['heading' => 'Stark im Alltag', 'text' => 'Einstieg']]],
|
||||
], ['background' => 'dark', 'divider' => 'accent']),
|
||||
$this->sectionState('u1_3', [
|
||||
['type' => 'cards', 'data' => ['variant' => 'compact', 'data' => ['items' => $this->keyed([['title' => 'Prävention', 'url' => '/praevention']])]]],
|
||||
@@ -76,8 +78,8 @@ public function test_editor_creates_a_page_with_sections_and_registered_widgets_
|
||||
$this->assertSame('wide', $sections[1]['style']['width']);
|
||||
$this->assertNull($sections[2]['slots'][1], 'Ein leerer Platz bleibt als Platz erhalten.');
|
||||
$this->assertSame(['hero', 'cards', 'image_text', 'catalog_cards'], array_column($blocks, 'type'), 'Die Rollback-Spalte enthält alle Widgets in Lesereihenfolge.');
|
||||
$this->assertSame(['highlight', 'compact', 'image_right', 'standard'], array_column($blocks, 'variant'));
|
||||
$this->assertSame(2, $blocks[2]['v']);
|
||||
$this->assertSame(['editorial_solid', 'compact', 'image_right', 'standard'], array_column($blocks, 'variant'));
|
||||
$this->assertSame(3, $blocks[2]['v']);
|
||||
$this->assertStringContainsString('<strong>Betonung</strong>', $blocks[2]['data']['body']);
|
||||
$this->assertSame([['title' => 'Prävention', 'text' => null, 'url' => '/praevention', 'image' => null]], $blocks[1]['data']['items']);
|
||||
$this->assertSame([['type' => 'composition', 'id' => $program->composition_id]], $blocks[3]['refs']['items']);
|
||||
@@ -164,7 +166,7 @@ public function test_publishing_with_an_invalid_draft_publishes_nothing(): void
|
||||
$component->set("data.sections.$sectionKey.layout", 'u1_3');
|
||||
$slotKeys = array_keys($component->get("data.sections.$sectionKey.slots"));
|
||||
$component->set("data.sections.$sectionKey.slots.{$slotKeys[0]}.widget", [
|
||||
(string) Str::uuid() => ['type' => 'hero', 'data' => ['variant' => 'standard', 'data' => ['heading' => 'Zu schmal']]],
|
||||
(string) Str::uuid() => ['type' => 'hero', 'data' => ['variant' => 'photo_split', 'data' => ['heading' => 'Zu schmal']]],
|
||||
]);
|
||||
|
||||
$component->callAction('publish')->assertNotified('Nicht gespeichert');
|
||||
@@ -231,7 +233,7 @@ public function test_widget_too_wide_for_its_slot_is_reported_at_the_section():
|
||||
'path' => '/raster-pruefung',
|
||||
'sections' => [
|
||||
$this->sectionState('u1_3', [
|
||||
['type' => 'hero', 'data' => ['variant' => 'standard', 'data' => ['heading' => 'Zu schmal']]],
|
||||
['type' => 'hero', 'data' => ['variant' => 'photo_split', 'data' => ['heading' => 'Zu schmal']]],
|
||||
null,
|
||||
], ['background' => 'accent', 'spacing' => 'large', 'divider' => 'line']),
|
||||
],
|
||||
@@ -275,7 +277,7 @@ public function test_errors_found_only_by_the_registry_are_announced_with_the_se
|
||||
$component = Livewire::actingAs($this->editor(), 'staff')->test(EditPage::class, ['record' => $page->id]);
|
||||
$state = $component->get('data.sections');
|
||||
$state[(string) Str::uuid()] = $this->sectionState('u4', [
|
||||
['type' => 'hero', 'data' => ['variant' => 'standard', 'data' => ['heading' => 'Mit Bild'], 'refs' => ['image' => 'cms/bild.jpg']]],
|
||||
['type' => 'hero', 'data' => ['variant' => 'photo_split', 'data' => ['heading' => 'Mit Bild'], 'refs' => ['image' => 'cms/bild.jpg']]],
|
||||
]);
|
||||
|
||||
$component->set('data.sections', $state)
|
||||
@@ -392,8 +394,8 @@ public function test_block_preview_uses_the_public_widget_view_with_unsaved_stat
|
||||
'refs' => ['image' => null, '_upload' => []],
|
||||
]);
|
||||
|
||||
$this->assertStringContainsString('image-text image-text-right', $html);
|
||||
$this->assertStringContainsString('<h2>Ungespeichert</h2>', $html);
|
||||
$this->assertStringContainsString('lf-bt lf-bt--cream lf-bt--image-right', $html);
|
||||
$this->assertStringContainsString('<h2 class="lf-bt__headline">Ungespeichert</h2>', $html);
|
||||
$this->assertStringContainsString('Vorschautext', $html);
|
||||
|
||||
$cards = WidgetEditor::renderPreview('cards', [
|
||||
@@ -415,7 +417,7 @@ public function test_editor_offers_every_registered_widget_layouts_and_section_d
|
||||
->assertSee('Einstieg (Hero)')
|
||||
->assertSee('Programm- und Modulkarten')
|
||||
->assertSee('Titel und Beschreibung kommen automatisch aus den Fachdaten')
|
||||
->assertSee('Braucht einen Platz ab 2 Rastereinheiten')
|
||||
->assertSee('Für Plätze mit 3 oder 4 Rastereinheiten')
|
||||
->assertSee('Gestaltung des Abschnitts')
|
||||
->assertSee('1 + 2 + 1')
|
||||
->assertSee('Widget einsetzen')
|
||||
@@ -487,42 +489,89 @@ public function test_navigation_rejects_script_addresses(): void
|
||||
$this->get('/praevention')->assertDontSee('javascript:alert(1)', false);
|
||||
}
|
||||
|
||||
public function test_editor_saves_brand_stage_with_settings_and_second_action(): void
|
||||
/**
|
||||
* Premium-Einstieg (Kit v1.6) über den Editor: Variante, Höhe, Überschriftenebene, Akzent, Label, Fokus und zwei
|
||||
* Schaltflächen werden gespeichert und öffentlich mit derselben Ansicht dargestellt.
|
||||
*/
|
||||
public function test_editor_saves_premium_hero_with_layout_settings(): void
|
||||
{
|
||||
Storage::fake('media_public');
|
||||
Storage::fake('cms_incoming');
|
||||
Storage::disk('media_public')->put('cms/buehne.jpg', 'bild');
|
||||
Storage::disk('media_public')->put('cms/park.jpg', 'bild');
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(CreatePage::class)
|
||||
->fillForm([
|
||||
'path' => '/markenbuehne',
|
||||
'path' => '/premium-einstieg',
|
||||
'sections' => [
|
||||
$this->sectionState('u4', [
|
||||
$this->sectionState('u3_1', [
|
||||
['type' => 'hero', 'data' => [
|
||||
'variant' => 'stage',
|
||||
'settings' => ['focus' => 'left', 'text_side' => 'left'],
|
||||
'data' => ['heading' => 'Bühne', 'cta_label' => 'Programme', 'cta_url' => '/programme', 'cta2_label' => 'Mitgliederbereich', 'cta2_url' => '/bereich', 'alt' => 'Motiv'],
|
||||
'refs' => ['image' => 'cms/buehne.jpg'],
|
||||
'variant' => 'photo_split',
|
||||
'settings' => ['height' => 'large', 'heading_level' => 'h3', 'accent' => 'rays'],
|
||||
'data' => ['eyebrow' => 'Stark im Alltag', 'heading' => 'Kinder stark im Alltag', 'text' => 'Beschreibung', 'cta_label' => 'Programme', 'cta_url' => '/programme', 'cta2_label' => 'Mitgliederbereich', 'cta2_url' => '/bereich', 'alt' => 'Lara und Felix', 'focus_x' => 72, 'focus_y' => 40],
|
||||
'refs' => ['image' => 'cms/park.jpg'],
|
||||
]],
|
||||
], ['width' => 'full']),
|
||||
['type' => 'call_to_action', 'data' => ['settings' => ['height' => 'fill'], 'data' => ['heading' => 'Daneben', 'label' => 'Los', 'url' => '/bereich']]],
|
||||
], ['width' => 'wide']),
|
||||
],
|
||||
])
|
||||
->call('create')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$page = Page::query()->where('path', '/markenbuehne')->firstOrFail();
|
||||
$widget = $page->latestRevision->sections[0]['slots'][0];
|
||||
$this->assertSame('stage', $widget['variant']);
|
||||
$this->assertSame(['focus' => 'left', 'text_side' => 'left'], $widget['settings']);
|
||||
$this->assertSame('/bereich', $widget['data']['cta2_url']);
|
||||
$page = Page::query()->where('path', '/premium-einstieg')->firstOrFail();
|
||||
$hero = $page->latestRevision->sections[0]['slots'][0];
|
||||
$this->assertSame(2, $hero['v']);
|
||||
$this->assertSame('photo_split', $hero['variant']);
|
||||
$this->assertSame(['height' => 'large', 'heading_level' => 'h3', 'accent' => 'rays'], $hero['settings']);
|
||||
$this->assertSame([72, 40], [$hero['data']['focus_x'], $hero['data']['focus_y']]);
|
||||
$this->assertSame('fill', $page->latestRevision->sections[0]['slots'][1]['settings']['height']);
|
||||
|
||||
app(PageService::class)->publish($page, $page->latestRevision);
|
||||
$this->get('/markenbuehne')
|
||||
$this->get('/premium-einstieg')
|
||||
->assertOk()
|
||||
->assertSee('section-bleed', false)
|
||||
->assertSee('hero hero-stage hero-with-image hero-text-left', false)
|
||||
->assertSee('<a class="button button-secondary" href="/bereich">Mitgliederbereich</a>', false);
|
||||
->assertSee('lf-hero lf-hero--photo-split lf-hero--height-large lf-hero--accent-rays', false)
|
||||
->assertSee('--lf-hero-focus-x: 72%; --lf-hero-focus-y: 40%', false)
|
||||
->assertSee('<h1 class="lf-hero__title">Kinder stark im Alltag</h1>', false)
|
||||
->assertSee('<p class="lf-hero__eyebrow">Stark im Alltag</p>', false)
|
||||
->assertSee('<a class="lf-hero__button lf-hero__button--secondary" href="/bereich">Mitgliederbereich</a>', false)
|
||||
->assertSee('widget-call-to-action widget-variant-standard widget-height-fill', false);
|
||||
}
|
||||
|
||||
public function test_widget_dialog_groups_content_media_and_display_with_live_preview(): void
|
||||
{
|
||||
$page = Page::query()->where('path', '/')->firstOrFail();
|
||||
$component = Livewire::actingAs($this->editor(), 'staff')->test(EditPage::class, ['record' => $page->id]);
|
||||
$state = $component->get('data.sections');
|
||||
$state[(string) Str::uuid()] = $this->sectionState('u4', [
|
||||
['type' => 'image_text', 'data' => ['variant' => 'image_left', 'settings' => ['height' => 'spacious', 'surface' => 'navy'], 'data' => ['title' => 'Vorschau im Dialog', 'body' => '<p>Text</p>'], 'refs' => []]],
|
||||
]);
|
||||
$component->set('data.sections', $state);
|
||||
|
||||
$sectionKey = array_key_last($component->get('data.sections'));
|
||||
$slotKey = array_key_first($component->get("data.sections.$sectionKey.slots"));
|
||||
$itemKey = array_key_first($component->get("data.sections.$sectionKey.slots.$slotKey.widget"));
|
||||
|
||||
// Modalinhalte rendert Livewire im Test nicht als HTML; geprüft werden die Felder des geöffneten Dialogs.
|
||||
$component->mountAction(TestAction::make('edit')->schemaComponent("sections.$sectionKey.slots.$slotKey.widget")->arguments(['item' => $itemKey]))
|
||||
->assertFormFieldExists('variant', fn ($field) => $field instanceof ToggleButtons && array_keys($field->getOptions()) === ['image_left', 'image_right'])
|
||||
->assertFormFieldExists('settings.height', fn ($field) => $field instanceof ToggleButtons && array_keys($field->getOptions()) === ['compact', 'normal', 'spacious'])
|
||||
->assertFormFieldExists('settings.surface')
|
||||
->assertFormFieldExists('settings.heading_level')
|
||||
->assertFormFieldExists('data.eyebrow')
|
||||
->assertFormFieldExists('data.cta2_url')
|
||||
->assertFormFieldExists('refs.image')
|
||||
->assertFormFieldExists('data.focus_x', fn ($field) => $field instanceof Slider)
|
||||
->assertFormFieldExists('data.focus_y', fn ($field) => $field instanceof Slider)
|
||||
->assertFormFieldExists('_preview_width', fn ($field) => array_keys($field->getOptions()) === [390, 310, 640, 960, 1300]);
|
||||
|
||||
// Die Live-Vorschau des Dialogs rendert den ungespeicherten Zustand mit der öffentlichen Ansicht.
|
||||
$html = view('filament.cms.widget-live-preview', [
|
||||
'html' => WidgetEditor::renderPreview('image_text', $component->get("data.sections.$sectionKey.slots.$slotKey.widget.$itemKey.data")),
|
||||
'stylesheets' => '',
|
||||
'width' => 1300,
|
||||
])->render();
|
||||
$this->assertStringContainsString('Vorschau bei 1300 px Platzbreite', $html);
|
||||
$this->assertStringContainsString('lf-bt lf-bt--navy lf-bt--image-left lf-bt--height-spacious', htmlspecialchars_decode($html));
|
||||
}
|
||||
|
||||
private function editor(): User
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Domain\Cms\Sections\SectionLayouts;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Premium-Widgets nach Brand-UI-Kit v1.6 und gemeinsamer Layoutvertrag (ADR-38).
|
||||
* Gespeicherte Daten früherer Versionen bleiben lesbar und speicherbar.
|
||||
*/
|
||||
class CmsPremiumWidgetsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $content
|
||||
*/
|
||||
private function publish(string $path, array $content): string
|
||||
{
|
||||
$page = Page::query()->create(['path' => $path]);
|
||||
$service = app(PageService::class);
|
||||
$service->publish($page, $service->saveRevision($page, $content, null, null, null));
|
||||
|
||||
return $this->get($path)->assertOk()->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>|null> $slots
|
||||
* @param array<string, string> $style
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function section(string $layout, array $slots, array $style = []): array
|
||||
{
|
||||
return ['layout' => $layout, 'style' => $style, 'slots' => $slots];
|
||||
}
|
||||
|
||||
public function test_hero_from_design_iteration_one_is_upgraded_and_stays_savable(): void
|
||||
{
|
||||
$registry = app(WidgetRegistry::class);
|
||||
|
||||
$standard = $registry->upcast(['type' => 'hero', 'v' => 1, 'variant' => 'stage', 'settings' => ['focus' => 'top_right', 'text_side' => 'left'], 'data' => ['heading' => 'Alt', 'cta2_label' => 'Zwei', 'cta2_url' => '/b']]);
|
||||
$this->assertSame(2, $standard['v']);
|
||||
$this->assertSame('photo_split', $standard['variant']);
|
||||
$this->assertSame([], $standard['settings'], 'Nicht mehr vorhandene Einstellungen werden entfernt.');
|
||||
$this->assertSame([100, 0], [$standard['data']['focus_x'], $standard['data']['focus_y']]);
|
||||
$this->assertSame('/b', $standard['data']['cta2_url']);
|
||||
|
||||
$highlight = $registry->upcast(['type' => 'hero', 'v' => 1, 'variant' => 'highlight', 'data' => ['heading' => 'Alt']]);
|
||||
$this->assertSame('editorial_solid', $highlight['variant']);
|
||||
$this->assertSame('editorial_solid', $registry->upcast(['type' => 'hero', 'v' => 1, 'variant' => 'editorial', 'data' => ['heading' => 'Alt']])['variant']);
|
||||
|
||||
// Szenario „bestehende Seite unverändert speichern“: gespeicherte v1-Hülle geht ohne Fehler durch die Prüfung.
|
||||
$saved = $registry->normalize([['type' => 'hero', 'v' => 1, 'variant' => 'stage', 'settings' => ['focus' => 'left', 'text_side' => 'right'], 'data' => ['heading' => 'Alt', 'alt' => 'Bild'], 'refs' => ['image' => 'cms/alt.jpg']]]);
|
||||
$this->assertSame(['photo_split', 2, [0, 50]], [$saved[0]['variant'], $saved[0]['v'], [$saved[0]['data']['focus_x'], $saved[0]['data']['focus_y']]]);
|
||||
}
|
||||
|
||||
public function test_image_text_from_design_iteration_one_is_upgraded_and_stays_savable(): void
|
||||
{
|
||||
$saved = app(WidgetRegistry::class)->normalize([[
|
||||
'type' => 'image_text', 'v' => 2, 'variant' => 'image_left',
|
||||
'settings' => ['format' => 'portrait', 'focus' => 'bottom'],
|
||||
'data' => ['title' => 'Alt', 'body' => '<p>Text</p>', 'alt' => 'Bild'], 'refs' => ['image' => 'cms/alt.jpg'],
|
||||
]])[0];
|
||||
|
||||
$this->assertSame(3, $saved['v']);
|
||||
$this->assertSame([], $saved['settings']);
|
||||
$this->assertSame([50, 100], [$saved['data']['focus_x'], $saved['data']['focus_y']]);
|
||||
$this->assertSame('image_left', $saved['variant']);
|
||||
}
|
||||
|
||||
public function test_premium_hero_renders_variants_heights_and_accents(): void
|
||||
{
|
||||
$html = $this->publish('/einstiege', [
|
||||
$this->section('u4', [[
|
||||
'type' => 'hero', 'v' => 2, 'variant' => 'photo_split', 'settings' => ['height' => 'compact', 'accent' => 'none'],
|
||||
'data' => ['eyebrow' => '<script>alert(1)</script>', 'heading' => 'Erster Einstieg', 'alt' => 'Lara und Felix', 'focus_x' => 30, 'focus_y' => 70],
|
||||
'refs' => ['image' => 'cms/park.jpg'],
|
||||
]]),
|
||||
$this->section('u3_1', [[
|
||||
'type' => 'hero', 'v' => 2, 'variant' => 'editorial_solid', 'settings' => ['height' => 'large', 'heading_level' => 'h3', 'accent' => 'rays'],
|
||||
'data' => ['heading' => 'Zweiter Einstieg', 'cta_label' => 'Konzept', 'cta_url' => '/konzept'],
|
||||
], null]),
|
||||
]);
|
||||
|
||||
$this->assertStringContainsString('class="lf-hero lf-hero--photo-split lf-hero--height-compact lf-hero--accent-none"', $html);
|
||||
$this->assertStringContainsString('style="--lf-hero-focus-x: 30%; --lf-hero-focus-y: 70%"', $html);
|
||||
$this->assertStringContainsString('alt="Lara und Felix" loading="eager" fetchpriority="high" decoding="async"', $html);
|
||||
$this->assertStringContainsString('<script>alert(1)</script>', $html);
|
||||
$this->assertStringNotContainsString('<script>alert(1)</script>', $html);
|
||||
$this->assertSame(1, substr_count($html, '<h1'), 'Genau eine Hauptüberschrift je Seite.');
|
||||
$this->assertStringContainsString('<h1 class="lf-hero__title">Erster Einstieg</h1>', $html);
|
||||
$this->assertStringContainsString('<h3 class="lf-hero__title">Zweiter Einstieg</h3>', $html);
|
||||
$this->assertStringContainsString('lf-hero--editorial-solid lf-hero--height-large lf-hero--accent-rays', $html);
|
||||
$this->assertStringContainsString('brand-rays lf-hero__rays', $html);
|
||||
$this->assertSame(1, substr_count($html, 'lf-hero__title-accent'), 'Ohne Akzent keine Unterstreichung.');
|
||||
$this->assertStringContainsString('widget-hero widget-variant-photo-split widget-height-compact', $html);
|
||||
}
|
||||
|
||||
public function test_hero_rejects_unsafe_links_and_out_of_range_focus(): void
|
||||
{
|
||||
$cases = [
|
||||
'blocks.0.data.cta2_url' => ['heading' => 'X', 'cta2_label' => 'Böse', 'cta2_url' => 'javascript:alert(1)'],
|
||||
'blocks.0.data.focus_x' => ['heading' => 'X', 'focus_x' => 150],
|
||||
];
|
||||
|
||||
foreach ($cases as $key => $data) {
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize([['type' => 'hero', 'v' => 2, 'data' => $data]]);
|
||||
$this->fail("$key wurde angenommen.");
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey($key, $exception->errors());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function test_premium_image_text_renders_surface_height_side_and_sanitized_body(): void
|
||||
{
|
||||
$html = $this->publish('/bild-text', [
|
||||
['type' => 'heading', 'v' => 1, 'data' => ['heading' => 'Seite']],
|
||||
$this->section('u4', [[
|
||||
'type' => 'image_text', 'v' => 3, 'variant' => 'image_left',
|
||||
'settings' => ['surface' => 'navy', 'height' => 'spacious', 'heading_level' => 'h3'],
|
||||
'data' => ['eyebrow' => 'Unser Ansatz', 'title' => 'Geschichten', 'body' => '<p>Text</p><script>alert(1)</script>', 'alt' => 'Park', 'cta_label' => 'Mehr', 'cta_url' => '/konzept', 'cta2_label' => 'Themen', 'cta2_url' => 'https://example.org/themen', 'focus_x' => 10, 'focus_y' => 90],
|
||||
'refs' => ['image' => 'cms/park.jpg'],
|
||||
]]),
|
||||
$this->section('u4', [['type' => 'image_text', 'v' => 3, 'data' => ['body' => '<p>Ohne Bild</p>']]]),
|
||||
]);
|
||||
|
||||
$this->assertStringContainsString('class="lf-bt lf-bt--navy lf-bt--image-left lf-bt--height-spacious"', $html);
|
||||
$this->assertStringContainsString('style="--bt-focus-x: 10%; --bt-focus-y: 90%"', $html);
|
||||
$this->assertStringContainsString('<h3 class="lf-bt__headline">Geschichten</h3>', $html);
|
||||
$this->assertStringContainsString('<p class="lf-bt__eyebrow">Unser Ansatz</p>', $html);
|
||||
$this->assertStringNotContainsString('<script>alert(1)</script>', $html);
|
||||
$this->assertStringContainsString('<a class="lf-bt__button" href="/konzept">Mehr <span aria-hidden="true">→</span></a>', $html);
|
||||
$this->assertStringContainsString('<a class="lf-bt__button lf-bt__button--secondary" href="https://example.org/themen">Themen</a>', $html);
|
||||
$this->assertStringContainsString('lf-bt lf-bt--cream lf-bt--image-left lf-bt--height-normal lf-bt--without-image', $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gemeinsamer Layoutvertrag für alle Bestandswidgets: In jeder zulässigen Platzbreite wird gerendert; nicht
|
||||
* zulässige Breiten werden beim Speichern mit verständlicher Meldung abgewiesen.
|
||||
*/
|
||||
public function test_every_widget_renders_in_each_supported_width_and_rejects_the_others(): void
|
||||
{
|
||||
$samples = [
|
||||
'heading' => ['heading' => 'Überschrift mit einem sehr langen Wort Gewaltpräventionsfortbildungsmaßnahme'],
|
||||
'prose' => ['body' => 'Fließtext mit einer langen Adresse https://example.org/'.str_repeat('a', 80)],
|
||||
'cards' => ['items' => [['title' => 'Karte mit langem Titel für schmale Plätze', 'text' => 'Beschreibung', 'url' => '/a']]],
|
||||
'call_to_action' => ['heading' => 'Aufruf', 'text' => 'Text', 'label' => 'Eine ausgesprochen lange Schaltflächenbeschriftung zum Prüfen', 'url' => '/a'],
|
||||
'faq' => ['items' => [['question' => 'Frage?', 'answer' => 'Antwort.']]],
|
||||
'hero' => ['heading' => 'Einstieg mit einer langen Überschrift, die umbrechen muss'],
|
||||
'image_text' => ['title' => 'Bild und Text', 'body' => '<p>Text</p>'],
|
||||
];
|
||||
$registry = app(WidgetRegistry::class);
|
||||
$layouts = ['u4' => [4], 'u3_1' => [3, 1], 'u2_2' => [2, 2], 'u1_1_1_1' => [1, 1, 1, 1]];
|
||||
$path = 0;
|
||||
|
||||
foreach ($samples as $type => $data) {
|
||||
$widgetType = $registry->get($type);
|
||||
$widget = ['type' => $type, 'v' => $widgetType->version(), 'data' => $data];
|
||||
|
||||
foreach ($layouts as $layout => $units) {
|
||||
$slots = array_fill(0, count($units), null);
|
||||
$slots[0] = $widget;
|
||||
|
||||
if ($widgetType->supportsUnits($units[0])) {
|
||||
$html = $this->publish('/raster-'.(++$path), [$this->section($layout, $slots)]);
|
||||
$this->assertStringContainsString('widget-'.str_replace('_', '-', $type), $html, "$type in $layout");
|
||||
$this->assertStringContainsString('data-units="'.$units[0].'"', $html, "$type in $layout");
|
||||
} else {
|
||||
try {
|
||||
app(PageService::class)->saveRevision(Page::query()->create(['path' => '/abgewiesen-'.(++$path)]), [$this->section($layout, $slots)], null, null, null);
|
||||
$this->fail("$type in $layout ({$units[0]} Einheiten) wurde angenommen.");
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertStringContainsString($widgetType->unitsLabel().' Rastereinheiten', $exception->errors()['sections.0.slots.0.units'][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSame(['u4', 'u2_2', 'u1_3', 'u3_1', 'u1_2_1', 'u1_1_1_1'], array_keys(SectionLayouts::UNITS));
|
||||
}
|
||||
|
||||
public function test_fill_height_marks_the_widget_and_defaults_to_content_height(): void
|
||||
{
|
||||
$html = $this->publish('/fuellen', [
|
||||
$this->section('u2_2', [
|
||||
['type' => 'call_to_action', 'v' => 1, 'settings' => ['height' => 'fill'], 'data' => ['heading' => 'Gleich hoch', 'label' => 'Los', 'url' => '/a']],
|
||||
['type' => 'call_to_action', 'v' => 1, 'data' => ['heading' => 'Nach Inhalt', 'label' => 'Los', 'url' => '/b']],
|
||||
]),
|
||||
]);
|
||||
|
||||
$this->assertStringContainsString('widget-call-to-action widget-variant-standard widget-height-fill', $html);
|
||||
$this->assertStringContainsString('widget-call-to-action widget-variant-standard widget-height-auto', $html);
|
||||
$this->assertStringNotContainsString('widget-prose widget-variant-standard widget-height', $html);
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,8 @@ public function test_new_revisions_are_stored_as_widget_envelopes(): void
|
||||
$this->assertSame(['id', 'type', 'v', 'variant', 'settings', 'data', 'refs'], array_keys($revision->blocks[0]));
|
||||
$this->assertSame('prose', $revision->blocks[0]['type']);
|
||||
$this->assertSame(['body' => 'Altes Eingabeformat'], $revision->blocks[0]['data']);
|
||||
$this->assertSame('highlight', $revision->blocks[1]['variant']);
|
||||
// Gespeichert wird immer die aktuelle Version: hero v1 „highlight“ wird zu v2 „editorial_solid“.
|
||||
$this->assertSame([2, 'editorial_solid'], [$revision->blocks[1]['v'], $revision->blocks[1]['variant']]);
|
||||
$this->assertNull($page->fresh()->published_revision_id, 'Speichern veröffentlicht nicht.');
|
||||
}
|
||||
|
||||
@@ -156,11 +157,11 @@ public function test_reference_widgets_render_their_variants(): void
|
||||
|
||||
$this->get('/varianten')
|
||||
->assertOk()
|
||||
->assertSee('hero hero-highlight', false)
|
||||
->assertSee('<h1>Stark im Alltag</h1>', false)
|
||||
->assertSee('class="button button-brand" href="/praevention"', false)
|
||||
->assertSee('image-text image-text-right', false)
|
||||
->assertSee('<h2>Bild rechts</h2>', false)
|
||||
->assertSee('lf-hero lf-hero--editorial-solid lf-hero--height-normal', false)
|
||||
->assertSee('<h1 class="lf-hero__title">Stark im Alltag</h1>', false)
|
||||
->assertSee('class="lf-hero__button lf-hero__button--primary" href="/praevention"', false)
|
||||
->assertSee('lf-bt lf-bt--cream lf-bt--image-right lf-bt--height-normal', false)
|
||||
->assertSee('<h2 class="lf-bt__headline">Bild rechts</h2>', false)
|
||||
->assertSee('<em>betont</em>', false)
|
||||
->assertSee(route('media.public', ['path' => 'cms/beispiel.jpg']), false)
|
||||
->assertSee('cards cards-compact', false);
|
||||
|
||||
@@ -108,20 +108,31 @@ public function test_surplus_empty_slots_are_compacted_without_losing_widgets():
|
||||
$this->assertSame(['A', 'C'], array_map(fn ($slot) => $slot['data']['heading'], $stored[0]['slots']));
|
||||
}
|
||||
|
||||
public function test_widget_minimum_width_is_enforced_per_slot(): void
|
||||
/**
|
||||
* Layoutvertrag (ADR-38): Ein Platz muss eine der unterstützten Breiten haben. Der Premium-Einstieg ist seit
|
||||
* Kit v1.6 nur für 3 oder 4 Einheiten vorgesehen (vorher Mindestbreite 2).
|
||||
*/
|
||||
public function test_widget_supported_widths_are_enforced_per_slot(): void
|
||||
{
|
||||
$hero = ['type' => 'hero', 'v' => 1, 'data' => ['heading' => 'Einstieg']];
|
||||
$hero = ['type' => 'hero', 'v' => 2, 'data' => ['heading' => 'Einstieg']];
|
||||
|
||||
try {
|
||||
$this->sections()->normalize([$this->section('u1_3', [$hero, null])]);
|
||||
$this->fail('Einstieg im schmalen Platz wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('sections.0.slots.0.units', $exception->errors());
|
||||
foreach ([['u1_3', [$hero, null]], ['u2_2', [$hero, null]]] as [$layout, $slots]) {
|
||||
try {
|
||||
$this->sections()->normalize([$this->section($layout, $slots)]);
|
||||
$this->fail("Einstieg im zu schmalen Platz ($layout) wurde angenommen.");
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('sections.0.slots.0.units', $exception->errors());
|
||||
$this->assertStringContainsString('3 oder 4 Rastereinheiten', $exception->errors()['sections.0.slots.0.units'][0]);
|
||||
}
|
||||
}
|
||||
|
||||
$stored = $this->sections()->normalize([$this->section('u1_3', [null, $hero])]);
|
||||
$this->assertSame('hero', $stored[0]['slots'][1]['type']);
|
||||
$this->assertSame(2, app(WidgetRegistry::class)->get('hero')->minUnits());
|
||||
$this->assertSame([3, 4], app(WidgetRegistry::class)->get('hero')->supportedUnits());
|
||||
|
||||
$imageText = ['type' => 'image_text', 'v' => 3, 'data' => ['body' => '<p>Schmal</p>']];
|
||||
$stored = $this->sections()->normalize([$this->section('u1_1_1_1', [$imageText, null, null, null])]);
|
||||
$this->assertSame('image_text', $stored[0]['slots'][0]['type'], 'Bild und Text ist für 1 bis 4 Einheiten freigegeben.');
|
||||
}
|
||||
|
||||
public function test_free_style_values_and_unknown_layouts_are_rejected(): void
|
||||
|
||||
@@ -66,18 +66,56 @@ public function test_registration_rejects_keys_that_are_not_stable_identifiers()
|
||||
new WidgetRegistry([$this->customWidget('Teaser Box')]);
|
||||
}
|
||||
|
||||
public function test_every_widget_declares_a_minimum_width_within_four_units(): void
|
||||
/** Gemeinsamer Layoutvertrag (ADR-38) für jede registrierte Art. */
|
||||
public function test_every_widget_declares_the_shared_layout_contract(): void
|
||||
{
|
||||
foreach ($this->registry()->all() as $key => $type) {
|
||||
$this->assertGreaterThanOrEqual(1, $type->minUnits(), $key);
|
||||
$this->assertLessThanOrEqual($type->preferredUnits(), $type->minUnits(), $key);
|
||||
$this->assertLessThanOrEqual(4, $type->preferredUnits(), $key);
|
||||
$units = $type->supportedUnits();
|
||||
$this->assertNotEmpty($units, $key);
|
||||
$this->assertSame([], array_diff($units, [1, 2, 3, 4]), $key);
|
||||
$this->assertSame(min($units), $type->minUnits(), $key);
|
||||
$this->assertTrue($type->supportsUnits($type->preferredUnits()), $key);
|
||||
$this->assertNotEmpty($type->stages(), $key);
|
||||
$this->assertNotSame('', $type->narrowBehavior(), $key);
|
||||
$this->assertSame([], array_diff(array_keys($type->heights()), array_keys(WidgetType::HEIGHTS)), $key);
|
||||
|
||||
if ($type->heights() !== []) {
|
||||
$this->assertArrayHasKey($type->defaultHeight(), $type->heights(), $key);
|
||||
$this->assertSame($type->heights(), $type->settingOptions()['height'], $key);
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSame(2, $this->registry()->get('hero')->minUnits());
|
||||
$this->assertSame(2, $this->registry()->get('image_text')->minUnits());
|
||||
$this->assertSame(1, $this->registry()->get('catalog_cards')->minUnits());
|
||||
$this->assertSame([3, 4], $this->registry()->get('hero')->supportedUnits());
|
||||
$this->assertSame(['compact', 'normal', 'large'], array_keys($this->registry()->get('hero')->heights()));
|
||||
$this->assertSame([1, 2, 3, 4], $this->registry()->get('image_text')->supportedUnits());
|
||||
$this->assertSame(['compact', 'normal', 'spacious'], array_keys($this->registry()->get('image_text')->heights()));
|
||||
$this->assertSame(['auto', 'fill'], array_keys($this->registry()->get('call_to_action')->heights()));
|
||||
$this->assertSame([2, 3, 4], $this->registry()->get('faq')->supportedUnits());
|
||||
$this->assertSame('3 oder 4', $this->registry()->get('hero')->unitsLabel());
|
||||
$this->assertSame('1 bis 4', $this->registry()->get('cards')->unitsLabel());
|
||||
}
|
||||
|
||||
public function test_height_is_an_enumerated_setting_with_a_default(): void
|
||||
{
|
||||
$widget = $this->registry()->normalize([
|
||||
['type' => 'hero', 'v' => 2, 'settings' => ['height' => 'large'], 'data' => ['heading' => 'X']],
|
||||
])[0];
|
||||
$this->assertSame('large', $widget['settings']['height']);
|
||||
$this->assertSame('normal', $this->registry()->get('hero')->height(['settings' => []]));
|
||||
|
||||
try {
|
||||
$this->registry()->normalize([['type' => 'hero', 'v' => 2, 'settings' => ['height' => '900px'], 'data' => ['heading' => 'X']]]);
|
||||
$this->fail('Freie Höhe wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.settings.height', $exception->errors());
|
||||
}
|
||||
|
||||
try {
|
||||
$this->registry()->normalize([['type' => 'prose', 'v' => 1, 'settings' => ['height' => 'compact'], 'data' => ['body' => 'Text']]]);
|
||||
$this->fail('Höhe für eine Art ohne Höhenwahl wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.settings.height', $exception->errors());
|
||||
}
|
||||
}
|
||||
|
||||
public function test_a_new_widget_type_works_through_the_contract_alone(): void
|
||||
@@ -112,7 +150,7 @@ public function test_unknown_type_and_unregistered_variant_are_rejected(): void
|
||||
}
|
||||
|
||||
try {
|
||||
$this->registry()->normalize([['type' => 'hero', 'v' => 1, 'variant' => 'gross-und-bunt', 'data' => ['heading' => 'X']]]);
|
||||
$this->registry()->normalize([['type' => 'hero', 'v' => 2, 'variant' => 'gross-und-bunt', 'data' => ['heading' => 'X']]]);
|
||||
$this->fail('Unbekannte Variante wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.variant', $exception->errors());
|
||||
@@ -204,13 +242,13 @@ public function test_legacy_blocks_are_read_as_version_one_envelopes(): void
|
||||
], $widget);
|
||||
}
|
||||
|
||||
public function test_legacy_image_text_is_upgraded_to_version_two_on_read(): void
|
||||
public function test_legacy_image_text_is_upgraded_to_the_current_version_on_read(): void
|
||||
{
|
||||
$legacy = ['type' => 'image_text', 'image' => 'cms/alt.jpg', 'alt' => 'Kinder im Kreis', 'body' => "Erster Absatz & mehr.\n\nZweiter <Absatz>."];
|
||||
|
||||
$widget = $this->registry()->upcast($legacy);
|
||||
|
||||
$this->assertSame(2, $widget['v']);
|
||||
$this->assertSame(3, $widget['v']);
|
||||
$this->assertSame('image_left', $widget['variant']);
|
||||
$this->assertSame(['image' => 'cms/alt.jpg'], $widget['refs']);
|
||||
$this->assertSame('Kinder im Kreis', $widget['data']['alt']);
|
||||
@@ -225,7 +263,7 @@ public function test_stored_version_one_envelope_is_upgraded_as_well(): void
|
||||
'data' => ['image' => null, 'alt' => 'x', 'body' => 'Nur Text'], 'refs' => [],
|
||||
]);
|
||||
|
||||
$this->assertSame(2, $widget['v']);
|
||||
$this->assertSame(3, $widget['v']);
|
||||
$this->assertSame('abc', $widget['id']);
|
||||
$this->assertSame('image_left', $widget['variant']);
|
||||
$this->assertSame('<p>Nur Text</p>', $widget['data']['body']);
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ export default defineConfig({
|
||||
fonts: [
|
||||
// Vorläufige Markenschriften (Website-Zielkonzept 7.2, nicht freigegeben); beim Build lokal abgelegt.
|
||||
bunny('Nunito', {
|
||||
weights: [700, 800],
|
||||
weights: [700, 800, 900],
|
||||
optimizedFallbacks: false,
|
||||
}),
|
||||
bunny('Source Sans 3', {
|
||||
|
||||
Reference in new issue
Block a user