feat(signage): Slides library, widgets placed on the preview, blank slides, slide editor rework

- Slides library (Alembic 0044, /api/signage/library): slides kept with a name and a
  description, added to playlists as copies ("Add a slide" → Your slides, "Keep in Slides"),
  or shown alone as a screen's default (device config `slide`, played as "slide:<id>",
  also as a schedule's fallback). Signage → Slides: gallery + a two-pane editor.
- Widgets moved and sized by hand on the preview (WidgetCanvas: handles, snapping, arrow
  keys): position/size "custom" with a box the TV draws the same; alignment per widget.
- Blank slides (background + widgets); menu boards narrower and placed left/centre/right.
- Slide editor reworked: name | show, transition effect | seconds; sections; text look on
  one row with ready colours; one card per widget, settings on one row.
- Questions inside the page (@xenia/ui ConfirmDialog/useConfirm), Switch boxed, Segmented
  fill; the timeline's drop line; schedule lines run on weekdays or smart days, not both;
  the playlist editor stays within 1080p with a long timeline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 07:53:27 +02:00
co-authored by Claude Opus 5.5
parent 60e6a16217
commit 83551714f7
46 changed files with 1934 additions and 431 deletions
+32
View File
@@ -248,3 +248,35 @@ export function boardPages(slide, rotation, w, h) {
const per = c.page_size || rows * (c.columns || 2)
return menuPages(slide.menu?.groups || [], per, c.category_titles !== false)
}
// ── widgets placed by hand (owner 2026-11-21) ─────────────────────────────────
/** The slide kinds that carry widgets. */
export const WIDGET_HOSTS = ['text', 'menu', 'blank']
/** How a widget lines up inside its place: its own choice, else by its corner / its box's side. */
export function widgetAlign(w) {
if (w?.align && w.align !== 'auto') return w.align
if (w?.position === 'custom' && w.box) {
const mid = w.box.x + w.box.w / 2
return mid < 100 / 3 ? 'left' : mid > 200 / 3 ? 'right' : 'center'
}
const p = w?.position || ''
return p.endsWith('left') ? 'left' : p.endsWith('right') ? 'right' : p.endsWith('center') ? 'center' : 'left'
}
/**
* A size unit for a widget that fills its own box: `n` units of its usual size (cqmin at "medium")
* scaled so the whole widget, `height` × `width` usual units, fits the box (inside an element with
* `container-type: size`). → n → CSS length.
*/
export function fitUnit(height, width) {
const byH = 100 / Math.max(0.1, height)
const byW = 100 / Math.max(0.1, width)
return n => `calc(${+n.toFixed(3)} * min(${+byH.toFixed(4)}cqh, ${+byW.toFixed(4)}cqw))`
}
/** A line of `chars` characters at `size` usual units: about how wide it is (bold sans). */
export function textWidth(chars, size) {
return Math.max(1, chars) * size * 0.6
}