Behebe Farbe heller und dunkler Palettenwidgets in verschachtelten Flächen
CI Feature / test (push) Failing after 7m49s
CI Feature / test (push) Failing after 7m49s
Die Gegenprüfung zeigte drei Fehler beim Verschachteln: Ein helles Palettenwidget in einem dunklen Abschnitt erbte aufgehellte Textfarben, Karten ohne eigene Fläche (kompakte Liste, Trennstrich) blieben mit Palettenfarbe unlesbar, und Symbole auf dunklen Palettenkarten verschwanden. - Die Hülle trägt immer scope-dark oder scope-light; Gegenregeln stellen die Werte der hellen Fläche wieder her. - paletteTarget() erhält die Hülle; Karten ohne eigene Fläche färben das ganze Widget. - Dunkle Palettenkarten erhalten die runde weiße Symbolscheibe. Tests für Farbziel und scope-light, Screenshots und Abnahme ergänzt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2b00905f00
commit
4817fe9455
24 files changed
+88
-36
No files matched your search
@@ -63,10 +63,11 @@ public static function options(WidgetType $type): array
|
||||
/**
|
||||
* Klassen an der Hülle des Widgets, mit führendem Leerzeichen; leer, wenn nichts gesetzt ist.
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
* @param array<string, mixed> $widget Hülle der Instanz (variant, settings)
|
||||
*/
|
||||
public static function classes(WidgetType $type, array $settings): string
|
||||
public static function classes(WidgetType $type, array $widget): string
|
||||
{
|
||||
$settings = is_array($widget['settings'] ?? null) ? $widget['settings'] : [];
|
||||
$classes = [];
|
||||
|
||||
$heading = self::valid($settings, 'heading_size', self::HEADING, 'heading', $type);
|
||||
@@ -79,13 +80,13 @@ public static function classes(WidgetType $type, array $settings): string
|
||||
$classes[] = 'widget-ts widget-ts-'.$text;
|
||||
}
|
||||
|
||||
$slot = self::slot($type, $settings);
|
||||
$slot = self::slot($type, $widget);
|
||||
if ($slot !== null) {
|
||||
$classes[] = 'widget-palette widget-palette--'.$type->paletteTarget();
|
||||
$classes[] = 'widget-palette widget-palette--'.$type->paletteTarget($widget);
|
||||
|
||||
if (ColorContrast::isDarkSurface($slot['fg'], $slot['bg'])) {
|
||||
$classes[] = 'scope-dark';
|
||||
}
|
||||
// Dunkel oder hell steht immer ausdrücklich an der Hülle: Ein helles Widget in einem dunklen Abschnitt darf die
|
||||
// Regeln der dunklen Fläche nicht erben (scope-light ist dafür die Gegenmarke, siehe widgets.css).
|
||||
$classes[] = ColorContrast::isDarkSurface($slot['fg'], $slot['bg']) ? 'scope-dark' : 'scope-light';
|
||||
}
|
||||
|
||||
return $classes === [] ? '' : ' '.implode(' ', $classes);
|
||||
@@ -94,11 +95,11 @@ public static function classes(WidgetType $type, array $settings): string
|
||||
/**
|
||||
* Eigenschaften der Farbe als style-Attribut mit führendem Leerzeichen; leer ohne Farbe.
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
* @param array<string, mixed> $widget Hülle der Instanz (variant, settings)
|
||||
*/
|
||||
public static function style(WidgetType $type, array $settings): string
|
||||
public static function style(WidgetType $type, array $widget): string
|
||||
{
|
||||
$slot = self::slot($type, $settings);
|
||||
$slot = self::slot($type, $widget);
|
||||
|
||||
if ($slot === null) {
|
||||
return '';
|
||||
@@ -115,14 +116,14 @@ public static function style(WidgetType $type, array $settings): string
|
||||
/**
|
||||
* Die gewählte Farbe, wenn die Art sie anbietet und sie in der Palette noch vorhanden ist.
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
* @param array<string, mixed> $widget Hülle der Instanz (variant, settings)
|
||||
* @return array{id: string, name: string, bg: string, fg: string}|null
|
||||
*/
|
||||
public static function slot(WidgetType $type, array $settings): ?array
|
||||
public static function slot(WidgetType $type, array $widget): ?array
|
||||
{
|
||||
$id = $settings['palette'] ?? null;
|
||||
$id = is_array($widget['settings'] ?? null) ? ($widget['settings']['palette'] ?? null) : null;
|
||||
|
||||
if ($type->paletteTarget() === null || ! is_string($id)) {
|
||||
if ($type->paletteTarget($widget) === null || ! is_string($id)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user