feat(options): Groups tab with intro and two columns; group colors become color choosers; font options Normal|Bold|Italic|Bold italic

Row 157. Groups pane gets a full-width h2 'Groups' + explanatory text and a
two-column slot layout: col 1 = group title options (font, color, custom,
size, font options), col 2 = same for the group description (singular wording).
grouptitletextcolor/groupdescriptiontextcolor switch from the old 4-way
dropdown to the row-135 color chooser (6 modes, default 'Default font color',
swatch chips, grayed-out custom picker unless 'other'); legacy stored modes
primary/secondary and raw hex migrate client-side (options.js) and in the views.
The old *fontweight keys (400|700) become *fontoptions (normal|bold|italic|
bolditalic), mapped to font-weight/font-style in custom_header.twig with a
legacy 400/700 fallback until theme reset. build.php migrates variant jsons
(chooser hex/modes + fontweight keys). OPTIONS_JS_TOKEN 20261127.1.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-27 02:50:06 +01:00
commit 956324775b

View file

@ -25,9 +25,14 @@ var ThemeOptions = function () {
// updateFieldSettings) can clobber optionObject, so the migration in colorModeUI
// must use this snapshot.
var legacyColorValues = {};
// row 157: legacy non-hex MODE values of the chooser options (e.g. "primary"/
// "secondary" stored by the old 4-way grouptitle/groupdescription textcolor
// dropdowns) — mapped to color1/color2 in colorModeUI
var legacyModeValues = {};
// row 135: all options that use the color-chooser scheme (mode dropdown with
// class selector_color_mode + swatch chips + a <key>custom colorpicker child)
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor'];
// class selector_color_mode + swatch chips + a <key>custom colorpicker child);
// row 157: the group title/description text colors joined the scheme
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor'];
// the 5 presets, in the SAME order as the dropdown options in config.xml
// (object key order = swatch chip order) — row 125: "Default background color"
// is the SECOND choice, right after "Default font color".
@ -847,6 +852,7 @@ var ThemeOptions = function () {
colorModeRefreshers.push(refreshAll);
// legacy migration: stored hex (pre-dropdown value) -> mode "other" + hex into the custom field
var stored = legacyColorValues[key];
var storedMode = legacyModeValues[key];
if (typeof stored === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(stored)) {
sel.val('other');
if (customInput.length && !/^#[0-9a-fA-F]{3,8}$/.test(String(customInput.val() || ''))) {
@ -855,6 +861,18 @@ var ThemeOptions = function () {
// re-evaluate the child's disabled state for the migrated mode
updateAllChildren();
updateVisibilityByParent();
} else if (typeof storedMode === 'string' && storedMode !== '' && !sel.find('option[value="' + storedMode + '"]').length) {
// row 157: legacy mode of the old 4-way <el>textcolor dropdowns
// (primary|secondary) has no option in the 6-mode chooser -> map it
// (primary -> color1, secondary -> color2); "default"/"other" still
// exist as options and need no mapping
var legacyModeMap = { 'primary': 'color1', 'secondary': 'color2' };
var mapped = legacyModeMap[storedMode];
if (mapped && sel.find('option[value="' + mapped + '"]').length) {
sel.val(mapped);
updateAllChildren();
updateVisibilityByParent();
}
} else if (!sel.val()) {
// no (matching) stored value: fall back to the option's configured
// default (row 125: every color-chooser option can pick its own default
@ -946,6 +964,8 @@ var ThemeOptions = function () {
var v = optionObject[k];
if (typeof v === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(v)) {
legacyColorValues[k] = v;
} else if (typeof v === 'string' && v !== '' && v !== 'inherit') {
legacyModeValues[k] = v;
}
});
});