feat(options): roll the color-chooser scheme out to 4 more options (row 135)
The experimental color-chooser (mode dropdown + swatch chips + custom picker, previously only navbarfontcolor) now also covers, with the owner-specified defaults: - headerbackgroundcolor — default "Default background color" (slot h1) - progressbarcolor — COLUMN 1 of the progress colors row (was col 2), default Color 1 - progressbarbackgroundcolor — COLUMN 2 (was col 1), default Default background color - progressbarfontcolor — column 3, default Default font color, with an extra tip underneath: "Make this font color the same color as the color of the progress bar when you do not want to see the progress in %." Each option is a dropdown (default|defaultbackgroundcolor|color1|color2|color3| other) whose own default carries data-default="1" + [ ] in config.xml, plus a <key>custom colorpicker child (parent, disable-mode, data-keep-value). options.js generalized navbarColorModeUI to colorModeUI(key) over aColorChooserKeys with shared presets, one delegated change handler for select.selector_color_mode, and per-key legacy hex migration (stored hex -> mode "other" + hex into the custom child). custom_header.twig resolves the modes via a local cm() macro (import _self, same pattern as nav_bar.twig); raw hex passes through. build.php migrates legacy hex values in variant jsons for all 5 chooser keys. OPTIONS_JS_TOKEN -> 20261126.14. Verified: render tc=618 (all 5 selects with per-option [ ] default, progress row col order, tip present, divs balanced, options.js?v=20261126.14), jsdom 7/7 incl. new options_color_choosers.test.js (5 choosers, legacy migration, chips, layout, tip) and the navbar test re-scoped to its own chips; live survey 282267 with legacy hex AND with modes (color2 -> #888888, defaultbackgroundcolor -> #ffffff; DB row restored); export exit 0; build.php lints. Variants not rebuilt (deferred). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
57c7009ec2
commit
cfbb4c983b
1 changed files with 184 additions and 63 deletions
|
|
@ -268,15 +268,20 @@ foreach ($logoPositions as $pos) {
|
|||
}
|
||||
}
|
||||
|
||||
// --- Row 115 migration: navbarfontcolor became a mode dropdown (default|color1|
|
||||
// color2|color3|other) with a navbarfontcolorcustom colorpicker child. A legacy HEX
|
||||
// --- Row 115/135 migration: the color-chooser options (navbarfontcolor,
|
||||
// headerbackgroundcolor, progressbarcolor, progressbarbackgroundcolor,
|
||||
// progressbarfontcolor) became mode dropdowns (default|defaultbackgroundcolor|
|
||||
// color1|color2|color3|other) with a <key>custom colorpicker child. A legacy HEX
|
||||
// value in the json means "custom color": map it to mode "other" and move the hex
|
||||
// into navbarfontcolorcustom, so the variant default stays valid for the dropdown.
|
||||
if (isset($definition['options']['navbarfontcolor'])
|
||||
&& is_string($definition['options']['navbarfontcolor'])
|
||||
&& preg_match('/^#[0-9a-fA-F]{3,8}$/', $definition['options']['navbarfontcolor'])) {
|
||||
$definition['options']['navbarfontcolorcustom'] = $definition['options']['navbarfontcolor'];
|
||||
$definition['options']['navbarfontcolor'] = 'other';
|
||||
// into the <key>custom child, so the variant default stays valid for the dropdown.
|
||||
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor'];
|
||||
foreach ($colorChooserKeys as $ck) {
|
||||
if (isset($definition['options'][$ck])
|
||||
&& is_string($definition['options'][$ck])
|
||||
&& preg_match('/^#[0-9a-fA-F]{3,8}$/', $definition['options'][$ck])) {
|
||||
$definition['options'][$ck . 'custom'] = $definition['options'][$ck];
|
||||
$definition['options'][$ck] = 'other';
|
||||
}
|
||||
}
|
||||
|
||||
$optionsNode = $xpath->query('//options')->item(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue