feat(signage): look rows that wrap, one colour field with opacity, badges' text, several widgets per stack part, pages up to 2200 px (owner review 4)
- Menu text look: each field names its part ("Headings size"), rows wrap in aligned columns on
alternating bands; names align left / right; line and letter spacing as lists (Auto default);
each field changes only itself (followers frozen before the other changes); badge colour +
badge text colour (auto: readableOn); "Reset the look" with a question.
- ColourField everywhere in signage: a Popover panel (new @xenia/ui Popover, portal, kept in the
window) with 12 presets, picker, opacity (#rrggbbaa) and typed code; HEX accepts 8 digits.
- Stacks: Cell.widgets (a stored `widget` still reads), several widgets per part laid across the
stack's direction; extras by path stack.part.place; Add a widget adds, each removable / ordered.
- Page rule: --x-page-max is 2200px (no longer follows the window height).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -321,7 +321,8 @@ const DOTS = { dotted: 'dotted', dashed: 'dashed', solid: 'solid' }
|
||||
* board's text size): headings, names and prices each their own size, colour, font, bold / italic /
|
||||
* underline and alignment (empty: the board's text size and font, the text colour for names and the
|
||||
* accent colour for headings and prices); the dots between name and price; line and letter spacing
|
||||
* (auto: 1.25 and normal; set on the list, never inherited from the page); photos' size and shape.
|
||||
* (auto: 1.25 and normal; set on the list, never inherited from the page); photos' size and shape;
|
||||
* the badges' colours (2026-11-21: their text the venue's, or white / black to read on them).
|
||||
*/
|
||||
export function menuLook(c = {}) {
|
||||
const base = c.text_size || 100
|
||||
@@ -345,6 +346,9 @@ export function menuLook(c = {}) {
|
||||
dots: d.style === 'none'
|
||||
? { borderBottom: 'none' }
|
||||
: { borderBottom: `${+(0.08 * (d.size || 100) / 100).toFixed(3)}em ${DOTS[d.style] || 'dotted'} ${d.colour || 'currentColor'}`, opacity: d.colour ? 1 : 0.35 },
|
||||
// badges: the accent (also the page dots), their text the venue's or one that reads on it
|
||||
badge: { background: accent, color: c.badge_text_colour || readableOn(accent) },
|
||||
title: c.heading_style?.colour || accent,
|
||||
lineHeight: c.line_height || 1.25,
|
||||
letterSpacing: c.letter_spacing != null ? `${c.letter_spacing}em` : 'normal',
|
||||
photo: { size: `${+(2.2 * (c.photo_size || 100) / 100).toFixed(3)}em`, radius: RADIUS[c.photo_shape] || RADIUS.rounded },
|
||||
@@ -354,6 +358,28 @@ export function menuLook(c = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
/** A stack part's widgets (a part stored before owner review 4 has one `widget`). */
|
||||
export function cellWidgets(c) {
|
||||
return c?.widgets?.length ? c.widgets : c?.widget ? [c.widget] : []
|
||||
}
|
||||
|
||||
/**
|
||||
* A text colour that reads on `hex` (#rgb, #rrggbb or #rrggbbaa; the alpha is ignored): white on a
|
||||
* dark colour, near-black on a light one (a badge's text when the venue chose none, 2026-11-21).
|
||||
*/
|
||||
export function readableOn(hex) {
|
||||
let h = String(hex || '').replace('#', '')
|
||||
if (h.length === 3 || h.length === 4) h = h.slice(0, 3).split('').map(x => x + x).join('')
|
||||
if (!/^[0-9a-f]{6}/i.test(h)) return '#111111'
|
||||
const [r, g, b] = [0, 2, 4].map(i => {
|
||||
const v = parseInt(h.slice(i, i + 2), 16) / 255
|
||||
return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4
|
||||
})
|
||||
const lum = 0.2126 * r + 0.7152 * g + 0.0722 * b
|
||||
// the text with the better contrast (WCAG): white beats near-black below ~0.18
|
||||
return lum < 0.18 ? '#ffffff' : '#111111'
|
||||
}
|
||||
|
||||
/** A page's widest price, in characters: the price column's width, so names and dots line up. */
|
||||
export function priceChars(groups, format) {
|
||||
let n = 0
|
||||
|
||||
Reference in New Issue
Block a user