feat(element-style): visibility, alignment and scale per element

Completes the customization vocabulary: hide an element, align it, and
resize a logo, alongside the font/size/colour/offset that already existed.
All three per mode.

They resolve to "change nothing" until the user asks for something -- True,
None and 1.0 -- rather than to whatever the schema declares. That is the
same invariant the font fields keep: a caller that honours them still
renders an untouched config exactly as it did before they existed. A
schema default therefore does not count as a choice, which matters because
the save flow writes that default into config either way.

scale sits in the layout block with the offsets rather than in the element
block, because it is geometry: a logo has a scale and no font. The widget's
columns come from the schema, so a logo row shows visibility, offsets and
scale and no empty font cell.

Two bugs found by the tests rather than by reading:

- A nullable enum needs null in its enum list, not just in its type. The
  mode copy of `align` defaulted to null and then failed its own schema, so
  a plugin declaring any enum field with modes could not save at all. Six
  tests failed on this before any of them reached what they were testing.
- defaults_from_schema only ever extracted font/font_size/text_color, so
  the schema defaults for the new fields were invisible to the resolver and
  a declared default read as a user choice.

Widget: the table scrolls horizontally and pins the element-name column.
Nine columns do not fit the config panel, and clipping them hid the offsets
entirely while scrolling them made every row anonymous.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-09-10 17:54:23 -04:00
co-authored by Claude Opus 5
parent 90d6d91c27
commit 521f81272f
5 changed files with 799 additions and 101 deletions
+29 -1
View File
@@ -1416,8 +1416,36 @@ button.bg-white {
/* ---- Style editor widget -------------------------------------------- */
/* One row per display element: label, font, size, colour, X, Y. The grid
is declared once here so the header and the rows cannot drift apart. */
/* The plugin config panel is narrower than nine columns of controls, and a
clipped table hides the offsets entirely -- scroll the table rather than
crushing the controls or dropping columns. */
.style-editor {
overflow-x: auto;
}
.style-editor-table {
min-width: max-content;
}
/* Scrolled right, the element names would otherwise scroll away and the
row you are editing becomes anonymous. */
.style-editor-label,
.style-editor-head > :first-child {
position: sticky;
left: 0;
z-index: 1;
background-color: #ffffff;
}
.style-editor-head > :first-child {
background-color: #f9fafb;
}
.style-editor-row {
grid-template-columns: minmax(7rem, 1.4fr) minmax(8rem, 2fr) 5.5rem 4.5rem 4rem 4rem;
/* Set by the widget: the column count depends on what the plugin
declares, so the track list cannot be fixed here. */
grid-template-columns: var(--style-editor-columns,
minmax(7rem, 1.4fr) minmax(8rem, 2fr) 5rem 4.5rem 5rem 5rem);
}
.style-editor-check {
width: 1rem;
height: 1rem;
}
.style-editor-row .form-control {
padding: 0.2rem 0.4rem;