Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

slides: a Layers list — the slide's elements in stacking order, click to select, drag or ⌘↑/⌘↓ to reorder (#371) (#481)

nyblnetce9675a45fa8
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 008dd6a5..169ea200 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1353,6 +1353,12 @@ jobs:
# routes the argument. Bare {{date}} stays viewer-locale (#381).
run: node scripts/test-slides-fields.ts
+ - name: Layers panel rig
+ # editor/layerrows.ts, DOM-free: rows top-first, labels per type,
+ # group indent, moveInPaintOrder == the Order buttons (front/back/±1,
+ # a group moves as one, a no-op returns the same array), highlight
+ # follows the selection; render/present never see the list (#371).
+ run: node scripts/test-slides-layers.ts
- name: Export slides as images rig
# exportimages.ts decisions (DOM-free): the page set is the print set
# (hidden/state out, deck order), names pad NN and use the kernel's
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eed9313d..cdd73215 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,15 @@ pre-1.0.
## [Unreleased]
+- **A Layers list.** The Slide panel now opens with *Layers*: every element
+ on the slide, top of the stack first, with a glyph and a short label (the
+ text's first words, or the kind). Click a row to select, shift-click to add,
+ drag a row to move it up or down the stack, or use ⌘↑ and ⌘↓ with the list
+ focused. With an element selected the same list closes its panel, so the
+ highlighted row is never far. Nothing new in the file: the list is a view
+ onto the order the four Order buttons (front, forward, backward, back) have
+ moved elements through since 1.0, and a row dropped somewhere lands exactly
+ where those buttons would put it. Asked for by Li Wei in discussion #371.
- **Slides export as images.** Save ▾ *Export slides as images…* writes
this slide, or every slide in the show, as PNG or JPEG at 1× or 2× — one
file per page, named after the deck (`My_Deck-page-01.png`), hidden slides
diff --git a/scripts/test-slides-layers.ts b/scripts/test-slides-layers.ts
new file mode 100644
index 00000000..23512875
--- /dev/null
+++ b/scripts/test-slides-layers.ts
@@ -0,0 +1,112 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// Layers panel rig (discussion #371): the list is a VIEW onto slide.elements'
+// paint order, and moving a row lands exactly where the Order buttons would.
+//
+// node scripts/test-slides-layers.ts (layerrows.ts is DOM-free and
+// node-importable; layers.ts is the DOM half)
+//
+// WHAT THIS PROVES. Rows come top-first (paint order reversed); every element
+// type has a label, text is excerpted with markup stripped and truncated;
+// grouped elements are indented; moveInPaintOrder to the end/start/±1 equals
+// the panel's reorder('front'|'back')/step(±1) semantics (copied here as the
+// reference — the same splice the Arrange kit does), a grouped element moves
+// with its group, a no-op returns the same array; highlight follows the
+// selection and lights a whole group; and the list never reaches render.ts.
+
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, join } from 'node:path'
+import { excerpt, labelFor, layerRows, moveInPaintOrder, highlighted } from '../slides/src/editor/layerrows.ts'
+
+let failures = 0
+let checks = 0
+function ok(cond: boolean, msg: string) {
+ checks++
+ if (!cond) { failures++; console.log(` FAIL ${msg}`) }
+ else console.log(` ok ${msg}`)
+}
+const root = join(dirname(fileURLToPath(import.meta.url)), '..')
+const read = (f: string) => readFileSync(join(root, f), 'utf8')
+type E = { id: string; type: string; groupId?: string; [k: string]: unknown }
+const el = (id: string, type = 'shape', extra: Record<string, unknown> = {}): E => ({ id, type, shape: 'rect', ...extra })
+const ids = (a: { id: string }[]) => a.map((e) => e.id).join(' ')
+
+// --- the reference: panels.ts Order-button semantics, verbatim in spirit ---
+function refReorder<T extends { id: string }>(arr: T[], sel: string[], where: 'front' | 'back'): T[] {
+ const s = new Set(sel); const picked = arr.filter((e) => s.has(e.id)); const rest = arr.filter((e) => !s.has(e.id))
+ return where === 'front' ? [...rest, ...picked] : [...picked, ...rest]
+}
+function refStep<T extends { id: string }>(arr: T[], sel: string[], dir: 1 | -1): T[] {
+ const a = [...arr]; const s = new Set(sel)
+ const idxs = a.map((e, i) => (s.has(e.id) ? i : -1)).filter((i) => i >= 0)
+ for (const i of dir > 0 ? [...idxs].reverse() : idxs) { const j = i + dir; if (j < 0 || j >= a.length || s.has(a[j].id)) continue; [a[i], a[j]] = [a[j], a[i]] }
+ return a
+}
+
+console.log('rows\n')
+const slide = { elements: [el('bg'), el('t', 'text', { html: '<p>Hello <b>world</b>&nbsp;&amp; friends, this is long text</p>' }), el('img', 'image'), el('c', 'chart')] as never[] }
+const rows = layerRows(slide)
+ok(ids(rows) === 'c img t bg', 'top of the stack first (paint order reversed)')
+ok(rows.every((r, i) => r.index === slide.elements.length - 1 - i), 'each row remembers its paint index')
+ok(rows[2].label === 'Hello world & friends,…' && rows[2].label.length <= 24, `text label is an excerpt, markup and entities out, cut to 24 with …: "${rows[2].label}"`)
+ok(excerpt('<p>short</p>') === 'short', 'short text is not truncated')
+ok(excerpt('a<br>b</p><p>c') === 'a b c', 'block breaks become spaces')
+ok(excerpt('<p></p>') === '', 'empty html → empty (labelFor falls back to "Text")')
+ok(labelFor({ type: 'text', html: '' } as never) === 'Text', 'an empty text box is labelled Text')
+const kinds: Array<[E, string]> = [
+ [el('a', 'shape', { shape: 'ellipse' }), 'Ellipse'], [el('a', 'shape', { shape: 'line' }), 'Line'], [el('a', 'shape', { shape: 'path' }), 'Curve'],
+ [el('a', 'image'), 'Image'], [el('a', 'svg'), 'Diagram'], [el('a', 'chart'), 'Chart'], [el('a', 'table'), 'Table'], [el('a', 'code'), 'Code'],
+ [el('a', 'media', { kind: 'video' }), 'Video'], [el('a', 'media', { kind: 'audio' }), 'Audio'], [el('a', 'embed'), 'Embed'],
+]
+ok(kinds.every(([e, want]) => labelFor(e as never) === want), 'every non-text type has its kind as label')
+ok(labelFor(el('a', 'shape', { shape: 'rect' }) as never, (s) => `[${s}]`) === '[Rectangle]', 'kind labels go through the translator')
+ok(labelFor(el('a', 'text', { html: 'hi' }) as never, (s) => `[${s}]`) === 'hi', 'text excerpts do not (user content)')
+
+console.log('\ngroups\n')
+const grouped = { elements: [el('a'), el('g1', 'shape', { groupId: 'G' }), el('g2', 'text', { html: 'x', groupId: 'G' }), el('z')] as never[] }
+const grows = layerRows(grouped)
+ok(grows.filter((r) => r.grouped).map((r) => r.id).join() === 'g2,g1', 'group members are marked (indented)')
+ok(!grows[0].grouped && !grows[3].grouped, 'others are not')
+
+console.log('\nmove = the Order buttons\n')
+const base = [el('a'), el('b'), el('c'), el('d'), el('e')]
+ok(ids(moveInPaintOrder(base, 'b', 4)) === ids(refReorder(base, ['b'], 'front')), 'to the end = Bring to front')
+ok(ids(moveInPaintOrder(base, 'd', 0)) === ids(refReorder(base, ['d'], 'back')), 'to 0 = Send to back')
+ok(ids(moveInPaintOrder(base, 'b', 2)) === ids(refStep(base, ['b'], 1)), '+1 = Bring forward one step')
+ok(ids(moveInPaintOrder(base, 'd', 2)) === ids(refStep(base, ['d'], -1)), '−1 = Send backward one step')
+ok(ids(moveInPaintOrder(base, 'a', 3)) === 'b c d a e', 'an arbitrary target index lands exactly there')
+ok(moveInPaintOrder(base, 'c', 2) === base, 'moving to where it is returns the SAME array (no undo step)')
+ok(moveInPaintOrder(base, 'nope', 0) === base, 'unknown id → same array')
+ok(ids(moveInPaintOrder(base, 'a', 99)) === 'b c d e a' && ids(moveInPaintOrder(base, 'e', -5)) === 'e a b c d', 'targets are clamped')
+const gbase = [el('a'), el('g1', 'shape', { groupId: 'G' }), el('g2', 'shape', { groupId: 'G' }), el('z')]
+ok(ids(moveInPaintOrder(gbase, 'g1', 3)) === 'a z g1 g2', 'a grouped element moves with its whole group, order inside kept')
+ok(ids(moveInPaintOrder(gbase, 'g2', 0)) === 'g1 g2 a z', '…to the back too')
+ok(ids(moveInPaintOrder(gbase, 'g1', 3)) === ids(refReorder(gbase, ['g1', 'g2'], 'front')), 'which is what Bring to front does with the group selected')
+// every single-step move agrees with refStep for every element
+let agree = true
+for (const e of base) for (const d of [1, -1] as const) {
+ const i = base.indexOf(e); const to = i + d
+ if (to < 0 || to >= base.length) continue
+ if (ids(moveInPaintOrder(base, e.id, to)) !== ids(refStep(base, [e.id], d))) agree = false
+}
+ok(agree, 'every ±1 move on every element equals the panel step')
+
+console.log('\nhighlight\n')
+ok([...highlighted(grows, ['a'])].join() === 'a', 'a selected element lights its row')
+ok([...highlighted(grows, ['g1'])].sort().join() === 'g1,g2', 'selecting one member lights the whole group (the canvas selects groups)')
+ok(highlighted(grows, []).size === 0, 'nothing selected, nothing lit')
+
+console.log('\neditor-only\n')
+ok(!/ed-layer|layers\.ts|LayersUI/.test(read('slides/src/render.ts')) && !/ed-layer|LayersUI/.test(read('slides/src/present.ts')), 'render.ts and present.ts know nothing of the list — thumbnails, the show, print and preview cannot carry it')
+const panels = read('slides/src/editor/panels.ts')
+ok(/this\.layers\.mount\(this\.host\); this\.buildSlidePanel\(\)/.test(panels), 'Slide panel: the list comes FIRST')
+ok(/this\.buildElementPanel\(els\[0\]\); this\.layers\.mount\(this\.host\)/.test(panels), 'element panel: the list comes LAST')
+ok(/setOrder: \(elements\) => this\.store\.commit\(/.test(panels), 'a move is one store.commit — one undo step, no new field')
+ok(/'Layers'\]\)/.test(panels.slice(panels.indexOf('CLOSED_BY_DEFAULT ='), panels.indexOf('CLOSED_BY_DEFAULT =') + 200)), 'closed by default (opened state persists per title like the other sections)')
+const layers = read('slides/src/editor/layers.ts') + read('slides/src/editor/layerrows.ts')
+ok(!/zIndex|z-index/.test(layers.replace(/^\s*(\/\/|\*).*$/gm, '')), 'no z-index in the code (comments aside) — the order IS the array')
+
+console.log(`\n${checks - failures}/${checks} checks passed`)
+process.exit(failures ? 1 : 0)
diff --git a/slides/src/editor/layerrows.ts b/slides/src/editor/layerrows.ts
new file mode 100644
index 00000000..955e2196
--- /dev/null
+++ b/slides/src/editor/layerrows.ts
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+/**
+ * Layers — a list of the current slide's elements in stacking order
+ * (discussion #371). Not a new concept in the model: `slide.elements` IS the
+ * paint order (last = topmost), and the four Order buttons in the Arrange kit
+ * have moved elements through it since 1.0. This is the view onto that order:
+ * one row per element, top of the stack first, click to select, drag or
+ * ⌘↑/⌘↓ to move. No z-index, no numbers, no new field — a row dropped
+ * somewhere ends up exactly where the Order buttons would have put it
+ * (moveInPaintOrder below is the same splice as repeated steps).
+ *
+ * WHERE IT LIVES (measured, Chrome 1565 px wide, starter deck, panel
+ * viewport 740 px): the Slide panel with nothing selected is 1192 px of
+ * content; a selected text element's panel is 2219 px. So the list sits at
+ * the TOP of the Slide panel — nothing selected is when a reader asks "what
+ * is on this slide?" — and closes the element panel as its LAST section,
+ * where it is one End-key from anywhere rather than lost between Typography
+ * and Presenting; closed by default, open state shared under one title. The
+ * list caps itself at ~12 rows and scrolls inside (the showcase title slide
+ * has 39 elements: uncapped it pushed the Slide controls ~975 px down).
+ *
+ * This file is the DOM-free half (rows, labels, the move), imported plain by
+ * scripts/test-slides-layers.ts; layers.ts is the DOM.
+ */
+
+import type { Slide, SlideElement } from '../model.ts'
+
+export type LayerRow = {
+ id: string
+ /** paint index in slide.elements (0 = bottom) */
+ index: number
+ type: SlideElement['type']
+ /** short, display-ready label (already translated where it is a kind name) */
+ label: string
+ /** the element belongs to a group (indented one level) */
+ grouped: boolean
+ groupId?: string
+}
+
+const LABEL_MAX = 24
+
+/** Text with the markup taken out, entities decoded enough to read, collapsed. */
+export function excerpt(html: string, max = LABEL_MAX): string {
+ const text = html
+ .replace(/<br\s*\/?>|<\/(p|div|li|h\d)>/gi, ' ')
+ .replace(/<[^>]*>/g, '')
+ .replace(/&nbsp;/g, ' ')
+ .replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'")
+ .replace(/[​]/g, '')
+ .replace(/\s+/g, ' ')
+ .trim()
+ return text.length > max ? text.slice(0, max - 1).trimEnd() + '…' : text
+}
+
+/** What a row says about its element. Kind names go through t() at build
+ * time (never at module level). */
+export function labelFor(el: SlideElement, tr: (s: string) => string = (s) => s): string {
+ switch (el.type) {
+ case 'text': return excerpt(el.html) || tr('Text')
+ case 'shape': return tr({ rect: 'Rectangle', ellipse: 'Ellipse', triangle: 'Triangle', arrow: 'Arrow', line: 'Line', path: 'Curve' }[el.shape] ?? 'Shape')
+ case 'image': return tr('Image')
+ case 'svg': return tr('Diagram')
+ case 'chart': return tr('Chart')
+ case 'table': return tr('Table')
+ case 'code': return tr('Code')
+ case 'media': return tr(el.kind === 'audio' ? 'Audio' : 'Video')
+ case 'embed': return tr('Embed')
+ default: return tr('Element')
+ }
+}
+
+/** Rows top-first. */
+export function layerRows(slide: Pick<Slide, 'elements'>, tr?: (s: string) => string): LayerRow[] {
+ const rows: LayerRow[] = slide.elements.map((el, index) => ({
+ id: el.id, index, type: el.type, label: labelFor(el, tr), grouped: !!el.groupId, groupId: el.groupId,
+ }))
+ return rows.reverse()
+}
+
+/**
+ * The paint order after moving `id` to paint index `to` — the same result as
+ * pressing the Order buttons: `to` = length-1 is Bring to front, 0 is Send to
+ * back, ±1 from where it is is one step. A grouped element moves with its
+ * whole group (the canvas moves groups as one; a layer list that could split
+ * one would be the only place in the editor that can). `to` is clamped;
+ * moving to where it already is returns the SAME array (no undo step).
+ */
+export function moveInPaintOrder<E extends { id: string; groupId?: string }>(elements: readonly E[], id: string, to: number): E[] {
+ const el = elements.find((e) => e.id === id)
+ if (!el) return elements as E[]
+ const unit = el.groupId ? elements.filter((e) => e.groupId === el.groupId) : [el]
+ const unitIds = new Set(unit.map((e) => e.id))
+ const rest = elements.filter((e) => !unitIds.has(e.id))
+ const first = elements.findIndex((e) => unitIds.has(e.id))
+ const target = Math.max(0, Math.min(rest.length, to - (to > first ? unit.length - 1 : 0)))
+ const next = [...rest.slice(0, target), ...unit, ...rest.slice(target)]
+ return next.every((e, i) => e === elements[i]) ? (elements as E[]) : next
+}
+
+/** Which rows read as selected — a grouped element's row lights when any
+ * member is selected, the way the canvas selects the group. */
+export function highlighted(rows: readonly LayerRow[], selection: readonly string[]): Set<string> {
+ const sel = new Set(selection)
+ const groups = new Set(rows.filter((r) => sel.has(r.id) && r.groupId).map((r) => r.groupId))
+ return new Set(rows.filter((r) => sel.has(r.id) || (r.groupId && groups.has(r.groupId))).map((r) => r.id))
+}
+
diff --git a/slides/src/editor/layers.ts b/slides/src/editor/layers.ts
new file mode 100644
index 00000000..f05cc1b6
--- /dev/null
+++ b/slides/src/editor/layers.ts
@@ -0,0 +1,171 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+/** Layers panel — the DOM half. The decisions (rows, labels, the move as the
+ * Order buttons make it, the highlight) live in layerrows.ts; read its
+ * header for what this is and where it sits. */
+
+import type { Slide, SlideElement } from '../model'
+import { ICONS } from '../icons'
+import { t } from '../i18n'
+import { layerRows, moveInPaintOrder, highlighted, type LayerRow } from './layerrows'
+export { excerpt, labelFor, layerRows, moveInPaintOrder, highlighted, type LayerRow } from './layerrows'
+
+/** The store surface the list needs — narrow so the rig never needs one. */
+export interface LayersHost {
+ slide: () => Pick<Slide, 'elements'>
+ selection: () => readonly string[]
+ select: (ids: string[]) => void
+ /** commit a new paint order as one undo step */
+ setOrder: (elements: SlideElement[]) => void
+}
+
+const GLYPH: Partial<Record<SlideElement['type'], string>> = {
+ text: ICONS.text, shape: ICONS.shapes, image: ICONS.image, chart: ICONS.chart, table: ICONS.table,
+ code: ICONS.code, media: ICONS.media, svg: ICONS.freeform, embed: ICONS.window,
+}
+
+export class LayersUI {
+ private list: HTMLElement
+ private dragId: string | null = null
+
+ constructor(private host: LayersHost) {
+ this.list = document.createElement('div')
+ this.list.className = 'ed-layers'
+ this.list.tabIndex = 0
+ this.list.setAttribute('role', 'listbox')
+ this.list.addEventListener('keydown', (ev) => this.onKey(ev))
+ }
+
+ /** Append the section (header + list) to a panel host. */
+ mount(into: HTMLElement) {
+ const h = document.createElement('h3')
+ h.className = 'ed-section'
+ h.textContent = t('Layers')
+ into.appendChild(h)
+ into.appendChild(this.list)
+ this.refresh()
+ }
+
+ refresh() {
+ this.list.innerHTML = ''
+ const rows = layerRows(this.host.slide(), t)
+ const lit = highlighted(rows, this.host.selection())
+ if (!rows.length) {
+ const empty = document.createElement('p')
+ empty.className = 'ed-hint'
+ empty.textContent = t('Nothing on this slide yet.')
+ this.list.appendChild(empty)
+ return
+ }
+ for (const r of rows) {
+ const row = document.createElement('div')
+ row.className = 'ed-layer' + (lit.has(r.id) ? ' sel' : '') + (r.grouped ? ' grouped' : '')
+ row.dataset.id = r.id
+ row.draggable = true
+ row.setAttribute('role', 'option')
+ row.setAttribute('aria-selected', lit.has(r.id) ? 'true' : 'false')
+ const glyph = document.createElement('span')
+ glyph.className = 'ed-layer-glyph'
+ glyph.innerHTML = GLYPH[r.type] ?? ''
+ if (!GLYPH[r.type]) glyph.textContent = r.type.charAt(0).toUpperCase()
+ const label = document.createElement('span')
+ label.className = 'ed-layer-label'
+ label.textContent = r.label
+ row.append(glyph, label)
+ row.title = r.label
+ row.addEventListener('click', (ev) => this.onClick(ev, r))
+ row.addEventListener('dragstart', (ev) => {
+ this.dragId = r.id
+ ev.dataTransfer?.setData('text/plain', r.id)
+ if (ev.dataTransfer) ev.dataTransfer.effectAllowed = 'move'
+ row.classList.add('dragging')
+ })
+ row.addEventListener('dragend', () => { this.dragId = null; this.clearDropMarks() })
+ row.addEventListener('dragover', (ev) => {
+ if (!this.dragId || this.dragId === r.id) return
+ ev.preventDefault()
+ if (ev.dataTransfer) ev.dataTransfer.dropEffect = 'move'
+ this.clearDropMarks()
+ row.classList.add(this.dropAbove(ev, row) ? 'drop-above' : 'drop-below')
+ })
+ row.addEventListener('drop', (ev) => {
+ ev.preventDefault()
+ const id = this.dragId ?? ev.dataTransfer?.getData('text/plain')
+ this.clearDropMarks()
+ if (!id || id === r.id) return
+ this.dropOn(id, r, this.dropAbove(ev, row))
+ })
+ this.list.appendChild(row)
+ }
+ }
+
+ private dropAbove(ev: DragEvent, row: HTMLElement): boolean {
+ const b = row.getBoundingClientRect()
+ return ev.clientY < b.top + b.height / 2
+ }
+
+ private clearDropMarks() {
+ for (const n of this.list.querySelectorAll('.drop-above, .drop-below, .dragging')) n.classList.remove('drop-above', 'drop-below', 'dragging')
+ }
+
+ /** Drop `id` above or below row `r` (rows are top-first, paint index runs
+ * the other way): above the top row = front; below the bottom row = back. */
+ private dropOn(id: string, r: LayerRow, above: boolean) {
+ const elements = this.host.slide().elements as SlideElement[]
+ const moving = elements.find((e) => e.id === id)
+ if (!moving) return
+ const from = elements.indexOf(moving)
+ // target paint index: above row r means "just after r in paint order"
+ let to = above ? r.index + 1 : r.index
+ if (from < to) to -= 1
+ this.move(id, to)
+ }
+
+ private move(id: string, to: number) {
+ const elements = this.host.slide().elements as SlideElement[]
+ const next = moveInPaintOrder(elements, id, to)
+ if (next === elements) return
+ // the commit rebuilds the panel (the list is re-mounted); keep the keys
+ // working by handing focus back to the re-attached node
+ const had = document.activeElement === this.list
+ this.host.setOrder(next)
+ this.refresh()
+ if (had) this.list.focus({ preventScroll: true })
+ }
+
+ private onClick(ev: MouseEvent, r: LayerRow) {
+ const elements = this.host.slide().elements
+ // the canvas selects a whole group on click and reaches a member with Alt
+ const unit = r.groupId && !ev.altKey ? elements.filter((e) => e.groupId === r.groupId).map((e) => e.id) : [r.id]
+ const cur = [...this.host.selection()]
+ if (ev.shiftKey || ev.metaKey || ev.ctrlKey) {
+ const has = unit.every((id) => cur.includes(id))
+ this.host.select(has ? cur.filter((id) => !unit.includes(id)) : [...cur.filter((id) => !unit.includes(id)), ...unit])
+ } else this.host.select(unit)
+ this.list.focus({ preventScroll: true })
+ }
+
+ private onKey(ev: KeyboardEvent) {
+ if (ev.key !== 'ArrowUp' && ev.key !== 'ArrowDown') return
+ const rows = layerRows(this.host.slide())
+ if (!rows.length) return
+ const sel = this.host.selection()
+ const dir = ev.key === 'ArrowUp' ? -1 : 1
+ ev.preventDefault()
+ ev.stopPropagation()
+ if (ev.metaKey || ev.ctrlKey) {
+ // ⌘↑ = up the stack = toward the front = paint index + 1
+ const id = sel[0]
+ if (!id) return
+ const el = rows.find((r) => r.id === id)
+ if (el) this.move(id, el.index - dir)
+ return
+ }
+ const at = rows.findIndex((r) => r.id === sel[0])
+ const next = rows[Math.max(0, Math.min(rows.length - 1, (at < 0 ? (dir > 0 ? -1 : rows.length) : at) + dir))]
+ if (next) {
+ const unit = next.groupId ? this.host.slide().elements.filter((e) => e.groupId === next.groupId).map((e) => e.id) : [next.id]
+ this.host.select(unit)
+ }
+ }
+}
diff --git a/slides/src/editor/panels.ts b/slides/src/editor/panels.ts
index fcd45817..bd44bf5f 100644
--- a/slides/src/editor/panels.ts
+++ b/slides/src/editor/panels.ts
@@ -21,6 +21,7 @@ import { shrinkImageFile, shrinkNote, fmtBytes } from './shrink'
import { revealInOrder, revealTogether, removeReveal, type StepPatch } from './reveal'
import { stepOf } from '../steps'
import { ICONS } from '../icons'
+import { LayersUI } from './layers'
import { t } from '../i18n'
import { lsJson, lsSet } from '../../../kernel/src/storage.ts'
@@ -202,15 +203,26 @@ export class PropsPanel {
const scrollTop = force ? 0 : this.host.scrollTop
this.host.innerHTML = ''
const els = this.store.selectedElements
- if (els.length === 0) this.buildSlidePanel()
- else if (els.length === 1) this.buildElementPanel(els[0])
- else this.buildMultiPanel(els)
+ // Layers (editor/layers.ts): first thing on the Slide panel, last thing on
+ // an element's — see that file's header for the measurement behind it.
+ if (els.length === 0) { this.layers.mount(this.host); this.buildSlidePanel() }
+ else if (els.length === 1) { this.buildElementPanel(els[0]); this.layers.mount(this.host) }
+ else { this.buildMultiPanel(els); this.layers.mount(this.host) }
this.applyAccordion()
this.host.scrollTop = scrollTop
}
/** Collapsed by default until the user opens them (persisted per title). */
- private static CLOSED_BY_DEFAULT = new Set(['Slideshow', 'Presenting', 'Interactivity', 'Layout', 'Advanced (JSON)'])
+ private static CLOSED_BY_DEFAULT = new Set(['Slideshow', 'Presenting', 'Interactivity', 'Layout', 'Advanced (JSON)', 'Layers'])
+
+ /** The layer list, one instance re-mounted on every rebuild (rows are
+ * cheap; the node keeps focus and drag state across a doc edit). */
+ private layers = new LayersUI({
+ slide: () => this.store.slide,
+ selection: () => this.store.selection,
+ select: (ids) => this.store.select(ids),
+ setOrder: (elements) => this.store.commit(() => { this.store.slide.elements = elements }),
+ })
/**
* Retrofit the flat panel into an accordion: every .ed-section header
diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.ts
index f9ee10c9..0e8e36af 100644
--- a/slides/src/i18n/de.ts
+++ b/slides/src/i18n/de.ts
@@ -892,6 +892,10 @@ export const de: Catalog = {
"Replace file (original size)…": "Datei ersetzen (Originalgröße)…",
"Keep aspect ratio": "Seitenverhältnis beibehalten",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "An: Größenänderung behält die Proportionen des Bildes (Umschalt gibt sie für einen Zug frei). Aus: Breite und Höhe ändern sich unabhängig und das Bild wird gestreckt",
+ "Layers": "Ebenen",
+ "Curve": "Kurve",
+ "Element": "Element",
+ "Nothing on this slide yet.": "Noch nichts auf dieser Folie.",
"Export slides as images…": "Folien als Bilder exportieren…",
"Export slides as images": "Folien als Bilder exportieren",
"This slide": "Diese Folie",
diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.ts
index 6919d7de..182be23c 100644
--- a/slides/src/i18n/es.ts
+++ b/slides/src/i18n/es.ts
@@ -892,6 +892,10 @@ export const es: Catalog = {
"Replace file (original size)…": "Reemplazar archivo (tamaño original)…",
"Keep aspect ratio": "Mantener la proporción",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Activado: al redimensionar se conservan las proporciones de la imagen (Mayús las libera durante un arrastre). Desactivado: ancho y alto cambian por separado y la imagen se estira",
+ "Layers": "Capas",
+ "Curve": "Curva",
+ "Element": "Elemento",
+ "Nothing on this slide yet.": "Aún no hay nada en esta diapositiva.",
"Export slides as images…": "Exportar diapositivas como imágenes…",
"Export slides as images": "Exportar diapositivas como imágenes",
"This slide": "Esta diapositiva",
diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.ts
index 793e1aaf..4de18144 100644
--- a/slides/src/i18n/fr.ts
+++ b/slides/src/i18n/fr.ts
@@ -892,6 +892,10 @@ export const fr: Catalog = {
"Replace file (original size)…": "Remplacer le fichier (taille d’origine)…",
"Keep aspect ratio": "Conserver les proportions",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Activé : le redimensionnement conserve les proportions de l’image (Maj les libère le temps d’un glissement). Désactivé : largeur et hauteur changent séparément et l’image s’étire",
+ "Layers": "Calques",
+ "Curve": "Courbe",
+ "Element": "Élément",
+ "Nothing on this slide yet.": "Rien sur cette diapositive pour l’instant.",
"Export slides as images…": "Exporter les diapositives en images…",
"Export slides as images": "Exporter les diapositives en images",
"This slide": "Cette diapositive",
diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.ts
index 55bafee0..78bc0db9 100644
--- a/slides/src/i18n/it.ts
+++ b/slides/src/i18n/it.ts
@@ -892,6 +892,10 @@ export const it: Catalog = {
"Replace file (original size)…": "Sostituisci file (dimensione originale)…",
"Keep aspect ratio": "Mantieni le proporzioni",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Attivo: il ridimensionamento conserva le proporzioni dell’immagine (Maiusc le libera per un trascinamento). Disattivo: larghezza e altezza cambiano separatamente e l’immagine si deforma",
+ "Layers": "Livelli",
+ "Curve": "Curva",
+ "Element": "Elemento",
+ "Nothing on this slide yet.": "Ancora niente su questa diapositiva.",
"Export slides as images…": "Esporta le diapositive come immagini…",
"Export slides as images": "Esporta le diapositive come immagini",
"This slide": "Questa diapositiva",
diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.ts
index 842fb02c..73bcdf75 100644
--- a/slides/src/i18n/ja.ts
+++ b/slides/src/i18n/ja.ts
@@ -892,6 +892,10 @@ export const ja: Catalog = {
"Replace file (original size)…": "ファイルを置き換え(元のサイズ)…",
"Keep aspect ratio": "縦横比を保つ",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "オン: サイズ変更で画像の比率を保ちます(Shift で一回のドラッグだけ解除)。オフ: 幅と高さを別々に変えられ、画像は引き伸ばされます",
+ "Layers": "レイヤー",
+ "Curve": "曲線",
+ "Element": "要素",
+ "Nothing on this slide yet.": "このスライドにはまだ何もありません。",
"Export slides as images…": "スライドを画像として書き出す…",
"Export slides as images": "スライドを画像として書き出す",
"This slide": "このスライド",
diff --git a/slides/src/i18n/packed.ts b/slides/src/i18n/packed.ts
index 3732d816..a7e3b457 100644
--- a/slides/src/i18n/packed.ts
+++ b/slides/src/i18n/packed.ts
@@ -898,6 +898,10 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Replace file (original size)…": ["ファイルを置き換え(元のサイズ)…","替换文件(原始尺寸)…","取代檔案(原始尺寸)…","Reemplazar archivo (tamaño original)…","Remplacer le fichier (taille d’origine)…","Datei ersetzen (Originalgröße)…","Sostituisci file (dimensione originale)…","Substituir ficheiro (tamanho original)…"],
"Keep aspect ratio": ["縦横比を保つ","保持宽高比","保持長寬比","Mantener la proporción","Conserver les proportions","Seitenverhältnis beibehalten","Mantieni le proporzioni","Manter proporções"],
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": ["オン: サイズ変更で画像の比率を保ちます(Shift で一回のドラッグだけ解除)。オフ: 幅と高さを別々に変えられ、画像は引き伸ばされます","开:调整大小时保持图片比例(按住 Shift 可临时解除一次拖动)。关:宽和高各自变化,图片会被拉伸","開:調整大小時保持圖片比例(按住 Shift 可暫時解除一次拖曳)。關:寬和高各自變化,圖片會被拉伸","Activado: al redimensionar se conservan las proporciones de la imagen (Mayús las libera durante un arrastre). Desactivado: ancho y alto cambian por separado y la imagen se estira","Activé : le redimensionnement conserve les proportions de l’image (Maj les libère le temps d’un glissement). Désactivé : largeur et hauteur changent séparément et l’image s’étire","An: Größenänderung behält die Proportionen des Bildes (Umschalt gibt sie für einen Zug frei). Aus: Breite und Höhe ändern sich unabhängig und das Bild wird gestreckt","Attivo: il ridimensionamento conserva le proporzioni dell’immagine (Maiusc le libera per un trascinamento). Disattivo: larghezza e altezza cambiano separatamente e l’immagine si deforma","Ligado: redimensionar mantém as proporções da imagem (Shift liberta-as durante um arrasto). Desligado: largura e altura mudam separadamente e a imagem estica"],
+ "Layers": ["レイヤー","图层","圖層","Capas","Calques","Ebenen","Livelli","Camadas"],
+ "Curve": ["曲線","曲线","曲線","Curva","Courbe","Kurve","Curva","Curva"],
+ "Element": ["要素","元素","元素","Elemento","Élément","Element","Elemento","Elemento"],
+ "Nothing on this slide yet.": ["このスライドにはまだ何もありません。","这张幻灯片上还没有内容。","這張投影片上還沒有內容。","Aún no hay nada en esta diapositiva.","Rien sur cette diapositive pour l’instant.","Noch nichts auf dieser Folie.","Ancora niente su questa diapositiva.","Ainda não há nada neste diapositivo."],
"Export slides as images…": ["スライドを画像として書き出す…","将幻灯片导出为图片…","將投影片匯出為圖片…","Exportar diapositivas como imágenes…","Exporter les diapositives en images…","Folien als Bilder exportieren…","Esporta le diapositive come immagini…","Exportar diapositivos como imagens…"],
"Export slides as images": ["スライドを画像として書き出す","将幻灯片导出为图片","將投影片匯出為圖片","Exportar diapositivas como imágenes","Exporter les diapositives en images","Folien als Bilder exportieren","Esporta le diapositive come immagini","Exportar diapositivos como imagens"],
"This slide": ["このスライド","当前幻灯片","目前投影片","Esta diapositiva","Cette diapositive","Diese Folie","Questa diapositiva","Este diapositivo"],
diff --git a/slides/src/i18n/packs/ar.ts b/slides/src/i18n/packs/ar.ts
index 0b6a8755..d316a3ab 100644
--- a/slides/src/i18n/packs/ar.ts
+++ b/slides/src/i18n/packs/ar.ts
@@ -912,6 +912,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "استبدال الملف (الحجم الأصلي)…",
"Keep aspect ratio": "الحفاظ على نسبة الأبعاد",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "مفعّل: يحافظ تغيير الحجم على نسب الصورة (Shift يحرّرها لسحبة واحدة). معطّل: يتغير العرض والارتفاع باستقلال وتتمدد الصورة",
+ "Layers": "الطبقات",
+ "Curve": "منحنى",
+ "Element": "عنصر",
+ "Nothing on this slide yet.": "لا شيء على هذه الشريحة بعد.",
"Export slides as images…": "تصدير الشرائح كصور…",
"Export slides as images": "تصدير الشرائح كصور",
"This slide": "هذه الشريحة",
diff --git a/slides/src/i18n/packs/bn.ts b/slides/src/i18n/packs/bn.ts
index a7150e81..b8793530 100644
--- a/slides/src/i18n/packs/bn.ts
+++ b/slides/src/i18n/packs/bn.ts
@@ -915,6 +915,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "ফাইল বদলান (মূল আকার)…",
"Keep aspect ratio": "অনুপাত বজায় রাখুন",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "চালু: আকার বদলালে ছবির অনুপাত বজায় থাকে (Shift এক টানের জন্য মুক্ত করে)। বন্ধ: প্রস্থ ও উচ্চতা আলাদাভাবে বদলায় এবং ছবি টেনে বড় হয়",
+ "Layers": "লেয়ার",
+ "Curve": "বক্ররেখা",
+ "Element": "উপাদান",
+ "Nothing on this slide yet.": "এই স্লাইডে এখনও কিছু নেই।",
"Export slides as images…": "স্লাইডগুলো ছবি হিসেবে রপ্তানি করুন…",
"Export slides as images": "স্লাইডগুলো ছবি হিসেবে রপ্তানি",
"This slide": "এই স্লাইড",
diff --git a/slides/src/i18n/packs/da.ts b/slides/src/i18n/packs/da.ts
index cd89915a..aa822d5a 100644
--- a/slides/src/i18n/packs/da.ts
+++ b/slides/src/i18n/packs/da.ts
@@ -904,6 +904,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Erstat fil (original størrelse)…",
"Keep aspect ratio": "Bevar størrelsesforhold",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Til: ændring af størrelse bevarer billedets proportioner (Skift frigiver dem for ét træk). Fra: bredde og højde ændres uafhængigt, og billedet strækkes",
+ "Layers": "Lag",
+ "Curve": "Kurve",
+ "Element": "Element",
+ "Nothing on this slide yet.": "Intet på dette dias endnu.",
"Export slides as images…": "Eksportér dias som billeder…",
"Export slides as images": "Eksportér dias som billeder",
"This slide": "Dette dias",
diff --git a/slides/src/i18n/packs/fa.ts b/slides/src/i18n/packs/fa.ts
index 4dba3998..5c384f99 100644
--- a/slides/src/i18n/packs/fa.ts
+++ b/slides/src/i18n/packs/fa.ts
@@ -908,6 +908,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "جایگزینی پرونده (اندازهٔ اصلی)…",
"Keep aspect ratio": "حفظ نسبت ابعاد",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "روشن: تغییر اندازه نسبت تصویر را حفظ می‌کند (Shift آن را برای یک کشیدن آزاد می‌کند). خاموش: عرض و ارتفاع مستقل تغییر می‌کنند و تصویر کشیده می‌شود",
+ "Layers": "لایه‌ها",
+ "Curve": "منحنی",
+ "Element": "عنصر",
+ "Nothing on this slide yet.": "هنوز چیزی روی این اسلاید نیست.",
"Export slides as images…": "صدور اسلایدها به‌صورت تصویر…",
"Export slides as images": "صدور اسلایدها به‌صورت تصویر",
"This slide": "این اسلاید",
diff --git a/slides/src/i18n/packs/fi.ts b/slides/src/i18n/packs/fi.ts
index b0a0fed2..b0ee9a79 100644
--- a/slides/src/i18n/packs/fi.ts
+++ b/slides/src/i18n/packs/fi.ts
@@ -909,6 +909,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Korvaa tiedosto (alkuperäinen koko)…",
"Keep aspect ratio": "Säilytä kuvasuhde",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Päällä: koon muutos säilyttää kuvan mittasuhteet (Vaihto vapauttaa ne yhden vedon ajaksi). Pois: leveys ja korkeus muuttuvat erikseen ja kuva venyy",
+ "Layers": "Tasot",
+ "Curve": "Käyrä",
+ "Element": "Elementti",
+ "Nothing on this slide yet.": "Tällä dialla ei ole vielä mitään.",
"Export slides as images…": "Vie diat kuvina…",
"Export slides as images": "Vie diat kuvina",
"This slide": "Tämä dia",
diff --git a/slides/src/i18n/packs/fil.ts b/slides/src/i18n/packs/fil.ts
index 7b91224f..a4c58619 100644
--- a/slides/src/i18n/packs/fil.ts
+++ b/slides/src/i18n/packs/fil.ts
@@ -921,6 +921,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Palitan ang file (orihinal na laki)…",
"Keep aspect ratio": "Panatilihin ang aspect ratio",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Naka-on: pinapanatili ng pag-resize ang proporsyon ng larawan (pinapalaya ito ng Shift sa isang drag). Naka-off: hiwalay na nagbabago ang lapad at taas at nababanat ang larawan",
+ "Layers": "Mga layer",
+ "Curve": "Kurba",
+ "Element": "Elemento",
+ "Nothing on this slide yet.": "Wala pang laman ang slide na ito.",
"Export slides as images…": "I-export ang mga slide bilang mga larawan…",
"Export slides as images": "I-export ang mga slide bilang mga larawan",
"This slide": "Ang slide na ito",
diff --git a/slides/src/i18n/packs/he.ts b/slides/src/i18n/packs/he.ts
index 04d277bd..6401e648 100644
--- a/slides/src/i18n/packs/he.ts
+++ b/slides/src/i18n/packs/he.ts
@@ -905,6 +905,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "החלפת קובץ (גודל מקורי)…",
"Keep aspect ratio": "שמירה על יחס גובה-רוחב",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "פעיל: שינוי גודל שומר על הפרופורציות של התמונה (Shift משחרר אותן לגרירה אחת). כבוי: רוחב וגובה משתנים בנפרד והתמונה נמתחת",
+ "Layers": "שכבות",
+ "Curve": "עקומה",
+ "Element": "רכיב",
+ "Nothing on this slide yet.": "אין עדיין כלום בשקופית הזו.",
"Export slides as images…": "ייצוא שקופיות כתמונות…",
"Export slides as images": "ייצוא שקופיות כתמונות",
"This slide": "השקופית הזו",
diff --git a/slides/src/i18n/packs/hi.ts b/slides/src/i18n/packs/hi.ts
index b38670f5..fa13d6a5 100644
--- a/slides/src/i18n/packs/hi.ts
+++ b/slides/src/i18n/packs/hi.ts
@@ -912,6 +912,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "फ़ाइल बदलें (मूल आकार)…",
"Keep aspect ratio": "अनुपात बनाए रखें",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "चालू: आकार बदलने पर छवि का अनुपात बना रहता है (Shift एक खिंचाव के लिए मुक्त करता है)। बंद: चौड़ाई और ऊँचाई अलग-अलग बदलती हैं और छवि खिंचती है",
+ "Layers": "परतें",
+ "Curve": "वक्र",
+ "Element": "तत्व",
+ "Nothing on this slide yet.": "इस स्लाइड पर अभी कुछ नहीं है।",
"Export slides as images…": "स्लाइडों को छवियों के रूप में निर्यात करें…",
"Export slides as images": "स्लाइडों को छवियों के रूप में निर्यात",
"This slide": "यह स्लाइड",
diff --git a/slides/src/i18n/packs/id.ts b/slides/src/i18n/packs/id.ts
index 04116062..edff9396 100644
--- a/slides/src/i18n/packs/id.ts
+++ b/slides/src/i18n/packs/id.ts
@@ -902,6 +902,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Ganti file (ukuran asli)…",
"Keep aspect ratio": "Pertahankan rasio aspek",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Aktif: mengubah ukuran mempertahankan proporsi gambar (Shift membebaskannya untuk satu seretan). Nonaktif: lebar dan tinggi berubah terpisah dan gambar meregang",
+ "Layers": "Lapisan",
+ "Curve": "Kurva",
+ "Element": "Elemen",
+ "Nothing on this slide yet.": "Belum ada apa-apa di slide ini.",
"Export slides as images…": "Ekspor slide sebagai gambar…",
"Export slides as images": "Ekspor slide sebagai gambar",
"This slide": "Slide ini",
diff --git a/slides/src/i18n/packs/ko.ts b/slides/src/i18n/packs/ko.ts
index 8ae03c51..d41547a1 100644
--- a/slides/src/i18n/packs/ko.ts
+++ b/slides/src/i18n/packs/ko.ts
@@ -896,6 +896,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "파일 바꾸기 (원본 크기)…",
"Keep aspect ratio": "가로세로 비율 유지",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "켜짐: 크기를 조절해도 이미지 비율이 유지됩니다 (Shift로 한 번의 드래그만 해제). 꺼짐: 너비와 높이가 따로 바뀌고 이미지가 늘어납니다",
+ "Layers": "레이어",
+ "Curve": "곡선",
+ "Element": "요소",
+ "Nothing on this slide yet.": "이 슬라이드에는 아직 아무것도 없습니다.",
"Export slides as images…": "슬라이드를 이미지로 내보내기…",
"Export slides as images": "슬라이드를 이미지로 내보내기",
"This slide": "이 슬라이드",
diff --git a/slides/src/i18n/packs/ms.ts b/slides/src/i18n/packs/ms.ts
index e9d89c42..8757e883 100644
--- a/slides/src/i18n/packs/ms.ts
+++ b/slides/src/i18n/packs/ms.ts
@@ -905,6 +905,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Gantikan fail (saiz asal)…",
"Keep aspect ratio": "Kekalkan nisbah aspek",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Hidup: mengubah saiz mengekalkan kadaran imej (Shift membebaskannya untuk satu seretan). Mati: lebar dan tinggi berubah secara berasingan dan imej meregang",
+ "Layers": "Lapisan",
+ "Curve": "Lengkung",
+ "Element": "Elemen",
+ "Nothing on this slide yet.": "Belum ada apa-apa pada slaid ini.",
"Export slides as images…": "Eksport slaid sebagai imej…",
"Export slides as images": "Eksport slaid sebagai imej",
"This slide": "Slaid ini",
diff --git a/slides/src/i18n/packs/nb.ts b/slides/src/i18n/packs/nb.ts
index 87622f0e..afc5e340 100644
--- a/slides/src/i18n/packs/nb.ts
+++ b/slides/src/i18n/packs/nb.ts
@@ -906,6 +906,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Erstatt fil (original størrelse)…",
"Keep aspect ratio": "Behold størrelsesforhold",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "På: endring av størrelse beholder bildets proporsjoner (Skift frigjør dem for ett drag). Av: bredde og høyde endres uavhengig, og bildet strekkes",
+ "Layers": "Lag",
+ "Curve": "Kurve",
+ "Element": "Element",
+ "Nothing on this slide yet.": "Ingenting på dette lysbildet ennå.",
"Export slides as images…": "Eksporter lysbilder som bilder…",
"Export slides as images": "Eksporter lysbilder som bilder",
"This slide": "Dette lysbildet",
diff --git a/slides/src/i18n/packs/nl.ts b/slides/src/i18n/packs/nl.ts
index b8269972..066ca329 100644
--- a/slides/src/i18n/packs/nl.ts
+++ b/slides/src/i18n/packs/nl.ts
@@ -900,6 +900,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Bestand vervangen (originele grootte)…",
"Keep aspect ratio": "Verhouding behouden",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Aan: bij het schalen blijven de verhoudingen van de afbeelding behouden (Shift geeft ze vrij voor één sleep). Uit: breedte en hoogte veranderen los van elkaar en de afbeelding rekt uit",
+ "Layers": "Lagen",
+ "Curve": "Kromme",
+ "Element": "Element",
+ "Nothing on this slide yet.": "Nog niets op deze dia.",
"Export slides as images…": "Dia's exporteren als afbeeldingen…",
"Export slides as images": "Dia's exporteren als afbeeldingen",
"This slide": "Deze dia",
diff --git a/slides/src/i18n/packs/pl.ts b/slides/src/i18n/packs/pl.ts
index 78b56998..6398e766 100644
--- a/slides/src/i18n/packs/pl.ts
+++ b/slides/src/i18n/packs/pl.ts
@@ -903,6 +903,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Zastąp plik (oryginalny rozmiar)…",
"Keep aspect ratio": "Zachowaj proporcje",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Włączone: zmiana rozmiaru zachowuje proporcje obrazu (Shift zwalnia je na jedno przeciągnięcie). Wyłączone: szerokość i wysokość zmieniają się niezależnie, a obraz się rozciąga",
+ "Layers": "Warstwy",
+ "Curve": "Krzywa",
+ "Element": "Element",
+ "Nothing on this slide yet.": "Na tym slajdzie nie ma jeszcze nic.",
"Export slides as images…": "Eksportuj slajdy jako obrazy…",
"Export slides as images": "Eksportuj slajdy jako obrazy",
"This slide": "Ten slajd",
diff --git a/slides/src/i18n/packs/ru.ts b/slides/src/i18n/packs/ru.ts
index c66f11aa..8e9eaa9d 100644
--- a/slides/src/i18n/packs/ru.ts
+++ b/slides/src/i18n/packs/ru.ts
@@ -904,6 +904,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Заменить файл (исходный размер)…",
"Keep aspect ratio": "Сохранять пропорции",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Вкл.: изменение размера сохраняет пропорции изображения (Shift освобождает их на одно перетаскивание). Выкл.: ширина и высота меняются независимо, изображение растягивается",
+ "Layers": "Слои",
+ "Curve": "Кривая",
+ "Element": "Элемент",
+ "Nothing on this slide yet.": "На этом слайде пока ничего нет.",
"Export slides as images…": "Экспортировать слайды как изображения…",
"Export slides as images": "Экспортировать слайды как изображения",
"This slide": "Этот слайд",
diff --git a/slides/src/i18n/packs/sv.ts b/slides/src/i18n/packs/sv.ts
index a2ace515..18cbbf69 100644
--- a/slides/src/i18n/packs/sv.ts
+++ b/slides/src/i18n/packs/sv.ts
@@ -901,6 +901,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Ersätt fil (originalstorlek)…",
"Keep aspect ratio": "Behåll proportioner",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "På: storleksändring behåller bildens proportioner (Skift frigör dem för ett drag). Av: bredd och höjd ändras oberoende och bilden töjs",
+ "Layers": "Lager",
+ "Curve": "Kurva",
+ "Element": "Element",
+ "Nothing on this slide yet.": "Inget på den här bilden ännu.",
"Export slides as images…": "Exportera bilder som bildfiler…",
"Export slides as images": "Exportera bilder som bildfiler",
"This slide": "Den här bilden",
diff --git a/slides/src/i18n/packs/th.ts b/slides/src/i18n/packs/th.ts
index 648098b2..b36c691e 100644
--- a/slides/src/i18n/packs/th.ts
+++ b/slides/src/i18n/packs/th.ts
@@ -906,6 +906,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "แทนที่ไฟล์ (ขนาดเดิม)…",
"Keep aspect ratio": "คงอัตราส่วนภาพ",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "เปิด: การปรับขนาดคงสัดส่วนของภาพ (กด Shift เพื่อปลดชั่วคราวหนึ่งครั้ง) ปิด: ความกว้างและความสูงเปลี่ยนแยกกัน ภาพจะถูกยืด",
+ "Layers": "เลเยอร์",
+ "Curve": "เส้นโค้ง",
+ "Element": "องค์ประกอบ",
+ "Nothing on this slide yet.": "ยังไม่มีอะไรบนสไลด์นี้",
"Export slides as images…": "ส่งออกสไลด์เป็นรูปภาพ…",
"Export slides as images": "ส่งออกสไลด์เป็นรูปภาพ",
"This slide": "สไลด์นี้",
diff --git a/slides/src/i18n/packs/tk.ts b/slides/src/i18n/packs/tk.ts
index b6b48568..20ef96ed 100644
--- a/slides/src/i18n/packs/tk.ts
+++ b/slides/src/i18n/packs/tk.ts
@@ -929,6 +929,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Faýly çalyş (asyl ölçegi)…",
"Keep aspect ratio": "Taraplaryň gatnaşygyny sakla",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Açyk: ölçeg üýtgedilende suratyň gatnaşygy saklanýar (Shift bir süýremek üçin boşadýar). Ýapyk: ini we beýikligi aýratyn üýtgeýär we surat çekilýär",
+ "Layers": "Gatlaklar",
+ "Curve": "Egri",
+ "Element": "Element",
+ "Nothing on this slide yet.": "Bu slaýdda entek hiç zat ýok.",
"Export slides as images…": "Slaýdlary surat hökmünde eksport et…",
"Export slides as images": "Slaýdlary surat hökmünde eksport etmek",
"This slide": "Şu slaýd",
diff --git a/slides/src/i18n/packs/tr.ts b/slides/src/i18n/packs/tr.ts
index 02e8ac9c..5964b91b 100644
--- a/slides/src/i18n/packs/tr.ts
+++ b/slides/src/i18n/packs/tr.ts
@@ -903,6 +903,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Dosyayı değiştir (özgün boyut)…",
"Keep aspect ratio": "En-boy oranını koru",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Açık: yeniden boyutlandırma görselin oranını korur (Shift bir sürükleme için serbest bırakır). Kapalı: genişlik ve yükseklik bağımsız değişir ve görsel esner",
+ "Layers": "Katmanlar",
+ "Curve": "Eğri",
+ "Element": "Öğe",
+ "Nothing on this slide yet.": "Bu slaytta henüz bir şey yok.",
"Export slides as images…": "Slaytları görüntü olarak dışa aktar…",
"Export slides as images": "Slaytları görüntü olarak dışa aktar",
"This slide": "Bu slayt",
diff --git a/slides/src/i18n/packs/uk.ts b/slides/src/i18n/packs/uk.ts
index bd7b51b6..6bb0f411 100644
--- a/slides/src/i18n/packs/uk.ts
+++ b/slides/src/i18n/packs/uk.ts
@@ -912,6 +912,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Замінити файл (початковий розмір)…",
"Keep aspect ratio": "Зберігати пропорції",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Увімк.: зміна розміру зберігає пропорції зображення (Shift звільняє їх на одне перетягування). Вимк.: ширина й висота змінюються незалежно, зображення розтягується",
+ "Layers": "Шари",
+ "Curve": "Крива",
+ "Element": "Елемент",
+ "Nothing on this slide yet.": "На цьому слайді поки нічого немає.",
"Export slides as images…": "Експортувати слайди як зображення…",
"Export slides as images": "Експортувати слайди як зображення",
"This slide": "Цей слайд",
diff --git a/slides/src/i18n/packs/ur.ts b/slides/src/i18n/packs/ur.ts
index 3c086ab3..99818191 100644
--- a/slides/src/i18n/packs/ur.ts
+++ b/slides/src/i18n/packs/ur.ts
@@ -922,6 +922,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "فائل بدلیں (اصل سائز)…",
"Keep aspect ratio": "پہلو تناسب برقرار رکھیں",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "آن: سائز بدلنے پر تصویر کا تناسب برقرار رہتا ہے (Shift ایک ڈریگ کے لیے آزاد کرتا ہے)۔ آف: چوڑائی اور اونچائی الگ الگ بدلتی ہیں اور تصویر کھنچ جاتی ہے",
+ "Layers": "پرتیں",
+ "Curve": "منحنی",
+ "Element": "عنصر",
+ "Nothing on this slide yet.": "اس سلائیڈ پر ابھی کچھ نہیں ہے۔",
"Export slides as images…": "سلائیڈز کو تصاویر کے طور پر برآمد کریں…",
"Export slides as images": "سلائیڈز کو تصاویر کے طور پر برآمد کریں",
"This slide": "یہ سلائیڈ",
diff --git a/slides/src/i18n/packs/vi.ts b/slides/src/i18n/packs/vi.ts
index bfd4ab1e..7db407aa 100644
--- a/slides/src/i18n/packs/vi.ts
+++ b/slides/src/i18n/packs/vi.ts
@@ -902,6 +902,10 @@ export const strings: Catalog = {
"Replace file (original size)…": "Thay tệp (kích thước gốc)…",
"Keep aspect ratio": "Giữ tỷ lệ khung hình",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Bật: đổi kích thước giữ nguyên tỷ lệ ảnh (Shift bỏ giữ trong một lần kéo). Tắt: chiều rộng và chiều cao đổi độc lập và ảnh bị kéo giãn",
+ "Layers": "Lớp",
+ "Curve": "Đường cong",
+ "Element": "Phần tử",
+ "Nothing on this slide yet.": "Trang chiếu này chưa có gì.",
"Export slides as images…": "Xuất trang chiếu thành hình ảnh…",
"Export slides as images": "Xuất trang chiếu thành hình ảnh",
"This slide": "Trang chiếu này",
diff --git a/slides/src/i18n/pt.ts b/slides/src/i18n/pt.ts
index 65781db6..7f811951 100644
--- a/slides/src/i18n/pt.ts
+++ b/slides/src/i18n/pt.ts
@@ -890,6 +890,10 @@ export const pt: Catalog = {
"Replace file (original size)…": "Substituir ficheiro (tamanho original)…",
"Keep aspect ratio": "Manter proporções",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "Ligado: redimensionar mantém as proporções da imagem (Shift liberta-as durante um arrasto). Desligado: largura e altura mudam separadamente e a imagem estica",
+ "Layers": "Camadas",
+ "Curve": "Curva",
+ "Element": "Elemento",
+ "Nothing on this slide yet.": "Ainda não há nada neste diapositivo.",
"Export slides as images…": "Exportar diapositivos como imagens…",
"Export slides as images": "Exportar diapositivos como imagens",
"This slide": "Este diapositivo",
diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.ts
index c1cbc90f..f962c6c7 100644
--- a/slides/src/i18n/zh-Hans.ts
+++ b/slides/src/i18n/zh-Hans.ts
@@ -892,6 +892,10 @@ export const zhHans: Catalog = {
"Replace file (original size)…": "替换文件(原始尺寸)…",
"Keep aspect ratio": "保持宽高比",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "开:调整大小时保持图片比例(按住 Shift 可临时解除一次拖动)。关:宽和高各自变化,图片会被拉伸",
+ "Layers": "图层",
+ "Curve": "曲线",
+ "Element": "元素",
+ "Nothing on this slide yet.": "这张幻灯片上还没有内容。",
"Export slides as images…": "将幻灯片导出为图片…",
"Export slides as images": "将幻灯片导出为图片",
"This slide": "当前幻灯片",
diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.ts
index 93c4e1e3..9ac3f876 100644
--- a/slides/src/i18n/zh-Hant.ts
+++ b/slides/src/i18n/zh-Hant.ts
@@ -892,6 +892,10 @@ export const zhHant: Catalog = {
"Replace file (original size)…": "取代檔案(原始尺寸)…",
"Keep aspect ratio": "保持長寬比",
"On: a resize keeps the image’s proportions (Shift frees it for one drag). Off: width and height move independently and the image stretches": "開:調整大小時保持圖片比例(按住 Shift 可暫時解除一次拖曳)。關:寬和高各自變化,圖片會被拉伸",
+ "Layers": "圖層",
+ "Curve": "曲線",
+ "Element": "元素",
+ "Nothing on this slide yet.": "這張投影片上還沒有內容。",
"Export slides as images…": "將投影片匯出為圖片…",
"Export slides as images": "將投影片匯出為圖片",
"This slide": "目前投影片",
diff --git a/slides/src/styles.css b/slides/src/styles.css
index d2315e3e..f8254dc1 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -565,6 +565,29 @@ a.ed-btn { text-decoration: none; } /* the update block's "What's new" link is
}
.ed-section:first-child { margin-top: 2px; }
+/* layers list (editor/layers.ts): one compact row per element, top first */
+.ed-layers {
+ display: flex; flex-direction: column; gap: 1px; outline: none; margin-bottom: 6px;
+ /* a busy slide (the showcase title has 39 elements) must not push the Slide
+ controls a screen down: the list scrolls inside itself past ~12 rows */
+ max-height: 300px; overflow-y: auto;
+}
+.ed-layers:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 6px; }
+.ed-layer {
+ display: flex; align-items: center; gap: 7px;
+ padding: 3px 6px; border-radius: 6px; font-size: 12px; line-height: 18px;
+ cursor: default; user-select: none; border: 1px solid transparent;
+}
+.ed-layer:hover { background: rgb(94 118 153 / 0.10); }
+.ed-layer.sel { background: rgb(94 118 153 / 0.18); border-color: rgb(94 118 153 / 0.35); }
+.ed-layer.grouped { padding-left: 20px; }
+.ed-layer.dragging { opacity: 0.4; }
+.ed-layer.drop-above { box-shadow: 0 -2px 0 0 var(--accent); }
+.ed-layer.drop-below { box-shadow: 0 2px 0 0 var(--accent); }
+.ed-layer-glyph { flex: none; width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 10px; font-weight: 700; }
+.ed-layer-glyph svg { width: 14px; height: 14px; }
+.ed-layer-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+
.ed-row {
display: flex;
align-items: center;