@andamento/dom 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-276TFSAG.cjs +299 -0
- package/dist/chunk-276TFSAG.cjs.map +1 -0
- package/dist/chunk-RCXEXYRF.js +299 -0
- package/dist/chunk-RCXEXYRF.js.map +1 -0
- package/dist/index.cjs +170 -447
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -163
- package/dist/index.d.ts +5 -163
- package/dist/index.js +37 -277
- package/dist/index.js.map +1 -1
- package/dist/internal-NveCwJWd.d.cts +169 -0
- package/dist/internal-NveCwJWd.d.ts +169 -0
- package/dist/internal.cjs +47 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +3 -0
- package/dist/internal.d.ts +3 -0
- package/dist/internal.js +47 -0
- package/dist/internal.js.map +1 -0
- package/package.json +13 -3
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/mount.ts","../src/model.ts","../src/element.ts","../src/pointer.ts"],"sourcesContent":["/**\n * No framework: `mountTileLayout()` and the `<andamento-layout>` web component, plus the pieces the framework bindings share.\n *\n * @module @andamento/dom\n */\nexport { mountTileLayout } from \"./mount\";\nexport type { TileContent, TileLayoutConfig, TileLayoutHandle } from \"./mount\";\nexport { AndamentoLayoutElement, defineTileLayoutElement } from \"./element\";\nexport type { CellActivateDetail } from \"./element\";\nexport {\n backdropStyle,\n backgroundStyle,\n containerStyle,\n coverStyle,\n focusStyle,\n frameBuilder,\n keyAction,\n layoutResolver,\n MORPH_POINTS,\n NOTHING_IN_VIEW,\n overlayStyle,\n resolvePerCell,\n ringStrokes,\n safeBoxStyle,\n sameRect,\n shadowShape,\n tileSheet,\n tileStyle,\n tileViewBox,\n viewRect,\n watchView,\n} from \"./model\";\nexport type { CellState, FitProp, Frame, FrameOptions, LayoutNeeds, PerCell, SafeAreaProp, StyleMap } from \"./model\";\nexport { cellFromPointer } from \"./pointer\";\nexport type { PointerLike } from \"./pointer\";\nexport { defaultPalette, neutralPalette } from \"@andamento/svg\";\nexport type { FillSource, ReliefOptions } from \"@andamento/svg\";\n","import { cellsInRect, type Cell, type ContentCells, type ContentPlacement, type Focus, type Layout, type LayoutOptions, type Rect } from \"@andamento/core\";\nimport type { FillSource, ReliefOptions } from \"@andamento/svg\";\nimport {\n backdropStyle,\n backgroundStyle,\n containerStyle,\n frameBuilder,\n keyAction,\n layoutResolver,\n overlayStyle,\n resolvePerCell,\n ringStrokes,\n safeBoxStyle,\n sameRect,\n shadowShape,\n tileSheet,\n tileStyle,\n tileViewBox,\n viewRect,\n watchView,\n type CellState,\n type FitProp,\n type PerCell,\n type SafeAreaProp,\n type StyleMap,\n} from \"./model\";\n\n/** What can go in a tile: a DOM node, text, or nothing. */\nexport type TileContent = Node | string | null | undefined;\n\nexport interface TileLayoutConfig {\n /** Layout options; or pass a precomputed `layout` instead. */\n options?: LayoutOptions;\n layout?: Layout;\n /**\n * The content: each item fills one tile, in reading order, clipped to the tile's shape.\n * Nodes are moved into their tiles (and kept there as the layout changes), so pass the\n * same node again to keep its state.\n */\n items?: readonly TileContent[];\n /**\n * Alternative to `items`: each tile's content from its cell, worked out on every render.\n * Return the same node again to keep it. `slot` numbers the cells allowed by `contentCells`.\n */\n renderCell?: (cell: Cell, state: { slot: number }) => TileContent;\n /** Which tiles may hold content: \"all\" (default), \"whole\" (not cut by the outline) or a test. */\n contentCells?: ContentCells;\n /** Where items go when there are fewer than tiles: \"reading\" (default), \"center\" or \"spread\". */\n placement?: ContentPlacement;\n /** Width / height of each item, to put items in tiles of similar shape (see `matchSlots`). */\n aspects?: readonly number[];\n /** With `aspects`: \"shape\" also picks which tiles hold items by their shape. */\n choose?: \"placement\" | \"shape\";\n /**\n * Focal point of each item (fractions of its width and height; see `estimateFocus`): what\n * a photo keeps in view as its tile crops it. Each tile sets `--andamento-object-position`,\n * which `coverStyle` uses; exact when the photo's shape is known (`aspects`, or the focus's `aspect`).\n */\n focalPoints?: readonly (Focus | undefined)[];\n /**\n * How many tiles each item spans (1 for an ordinary item; rounded): heavier items get a\n * featured tile of that many merged tiles, where they fall in reading order (see\n * `weightedLayout`). With `fit`, the tiles are sized to fit everything. Needs `options`.\n */\n weights?: readonly number[];\n /**\n * Put each tile's content in the tile's safe area, not its bounding box (see `safeArea`).\n * For tiles an `edges: \"window\"` layout cuts, `true` or \"tile\" fits the whole tile and\n * \"visible\" the part that shows.\n */\n safeArea?: SafeAreaProp;\n /** Color of empty tiles: a color, a palette or a function per cell. Defaults to `neutralPalette`. */\n fill?: FillSource;\n /** Size the tiles to the items: `true`/\"atLeast\" or \"nearest\". Ignored with `layout` or `renderCell`. */\n fit?: FitProp;\n /**\n * One picture across all the tiles: a node copied into every tile (or a function making\n * a fresh one per tile), sized to the whole layout so each tile shows its piece.\n */\n backdrop?: Node | (() => Node);\n /** Raised tiles: a lit bevel and optional shadow. `true` for the defaults. */\n relief?: boolean | ReliefOptions;\n /** Arrow-key navigation over the tiles with content, as one tab stop. */\n navigable?: boolean;\n /** Called when a tile with content is clicked, or Enter / Space pressed on it (with `navigable`). */\n onCellActivate?: (cell: Cell, state: CellState) => void;\n /** Accessible name for each tile. */\n cellLabel?: PerCell<string | undefined>;\n /** Focus ring color, or `false` for none. Defaults to \"#1a56db\". */\n focusRing?: string | false;\n /** Animate layout and content changes. `true` for 400 ms, or `{ duration, easing }`. */\n animate?: boolean | { duration?: number; easing?: string };\n /** Only put tiles in view (plus `overscan` pixels, default 300) in the DOM. */\n virtualize?: boolean | { overscan?: number };\n /** Content for empty tiles. */\n fallback?: PerCell<TileContent>;\n /** Class for each tile element. */\n cellClass?: PerCell<string | undefined>;\n /** Extra style for each tile element: camelCase or custom (`--x`) properties. */\n cellStyle?: PerCell<StyleMap | undefined>;\n /** Extra attributes for each tile element (`part`, `title`, …). */\n cellAttributes?: PerCell<Record<string, string | undefined> | undefined>;\n /** Color painted across the whole region, visible through the gaps. */\n background?: string;\n /** Role of the layout element: \"list\" (default; tiles with content are list items) or another. */\n role?: string;\n /** Accessible name of the layout (its `aria-label`). */\n label?: string;\n /** Class for the layout element. */\n className?: string;\n}\n\nexport interface TileLayoutHandle {\n /** The layout element (with `data-andamento`), inside the element mounted into. */\n readonly element: HTMLDivElement;\n /** The layout being shown. */\n readonly layout: Layout;\n /** Change some options (others stay as they are; pass `undefined` to clear one) and re-render. */\n update(changes: Partial<TileLayoutConfig>): void;\n /** Render again, e.g. after changing what `renderCell` returns. */\n refresh(): void;\n /** The element of the tile showing a cell, if it's in the DOM. */\n tileElement(cellId: string): HTMLElement | undefined;\n /** Remove the layout (items are taken out of their tiles) and stop listening. */\n destroy(): void;\n}\n\nconst SVG = \"http://www.w3.org/2000/svg\";\nconst kebab = (k: string) => (k.startsWith(\"--\") ? k : k.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase()));\nconst isEmpty = (c: TileContent) => c == null || c === \"\";\n\nconst styleMemo = new WeakMap<Element, StyleMap>();\n/** Set style properties, removing those set last time and not now. */\nfunction applyStyle(el: HTMLElement | SVGElement, next: StyleMap) {\n const prev = styleMemo.get(el) ?? {};\n for (const k of Object.keys(prev)) if (next[k] === undefined && prev[k] !== undefined) el.style.removeProperty(kebab(k));\n for (const [k, v] of Object.entries(next)) if (v !== undefined && prev[k] !== v) el.style.setProperty(kebab(k), String(v));\n styleMemo.set(el, next);\n}\n\nfunction attr(el: Element, name: string, value: string | number | boolean | undefined | null) {\n if (value === undefined || value === null || value === false) {\n if (el.hasAttribute(name)) el.removeAttribute(name);\n } else {\n const v = value === true ? \"\" : String(value);\n if (el.getAttribute(name) !== v) el.setAttribute(name, v);\n }\n}\n\n/** Make `parent`'s children exactly `nodes`, in order, moving as few as possible. */\nfunction setChildren(parent: Node, nodes: readonly Node[]) {\n let at: ChildNode | null = parent.firstChild;\n for (const n of nodes) {\n if (n === at) at = at.nextSibling;\n else parent.insertBefore(n, at);\n }\n while (at) {\n const next: ChildNode | null = at.nextSibling;\n parent.removeChild(at);\n at = next;\n }\n}\n\nfunction svg(tag: string, attrs: Record<string, string | number | undefined>, children: Element[] = []) {\n const el = document.createElementNS(SVG, tag);\n for (const [k, v] of Object.entries(attrs)) if (v !== undefined) el.setAttribute(k, String(v));\n for (const c of children) el.appendChild(c);\n return el;\n}\n\ninterface Tile {\n key: string;\n el: HTMLDivElement;\n cell: Cell;\n state: CellState;\n empty: boolean;\n text?: Text;\n backdrop?: { source: TileConfigBackdrop; node: Node };\n safe?: HTMLDivElement;\n bevel?: { key: string; node: SVGSVGElement };\n ring?: { key: string; node: SVGSVGElement };\n /** Fading out (animated removal). */\n leaving?: boolean;\n}\ntype TileConfigBackdrop = NonNullable<TileLayoutConfig[\"backdrop\"]>;\n\nconst nodeIds = new WeakMap<Node, number>();\nlet nextNodeId = 1;\nconst nodeId = (n: Node) => {\n let id = nodeIds.get(n);\n if (!id) nodeIds.set(n, (id = nextNodeId++));\n return id;\n};\n\nlet uidCount = 0;\n\n/**\n * Render a tiling into `target` (an element or a shadow root), without a framework: one\n * absolutely positioned, clipped element per tile, holding the items you give it. Sized in\n * percentages, so it scales with `target`'s width. Returns a handle to update or remove it.\n *\n * Tiles have `data-cell-id`, `data-index`, `data-empty` and `data-boundary`, as with the\n * React and Vue components.\n */\nexport function mountTileLayout(target: Element | ShadowRoot, initial: TileLayoutConfig): TileLayoutHandle {\n let config: TileLayoutConfig = { ...initial };\n const uid = `andamento-dom${++uidCount}`;\n const resolveLayout = layoutResolver(\"mountTileLayout\");\n const buildFrame = frameBuilder();\n const container = document.createElement(\"div\");\n container.setAttribute(\"data-andamento\", \"\");\n target.appendChild(container);\n\n const sheet = document.createElement(\"style\");\n const backgroundEl = document.createElement(\"div\");\n backgroundEl.setAttribute(\"aria-hidden\", \"true\");\n const blur = svg(\"feGaussianBlur\", {});\n const shadowPath = svg(\"path\", { \"fill-rule\": \"evenodd\", fill: \"#000\", filter: `url(#${uid}-shadow)` });\n const shadowEl = svg(\"svg\", { \"aria-hidden\": \"true\", \"data-andamento-shadow\": \"\", preserveAspectRatio: \"none\" }, [\n svg(\"filter\", { id: `${uid}-shadow`, x: \"-10%\", y: \"-10%\", width: \"120%\", height: \"120%\" }, [blur]),\n shadowPath,\n ]) as SVGSVGElement;\n\n let layout!: Layout;\n let tiles = new Map<string, Tile>();\n const leaving = new Set<Tile>();\n const byElement = new WeakMap<Element, Tile>();\n let lastKeys = new Set<string>();\n let mounted = false;\n let activeId: string | undefined;\n let pendingFocus: string | undefined;\n let focusable = new Set<string>();\n let view: Rect | undefined;\n let stopWatching: (() => void) | undefined;\n let watchedLayout: Layout | undefined;\n const timers = new Set<ReturnType<typeof setTimeout>>();\n let destroyed = false;\n\n function render() {\n if (destroyed) return;\n const c = config;\n const items = c.renderCell ? [] : (c.items ?? []);\n layout = resolveLayout(c.options, c.layout, {\n fit: !c.renderCell && c.fit,\n count: items.length,\n cells: c.contentCells,\n weights: c.renderCell ? undefined : c.weights,\n placement: c.placement,\n });\n const frame = buildFrame(layout, {\n count: c.renderCell ? Infinity : items.length,\n aspects: c.renderCell ? undefined : c.aspects,\n contentCells: c.contentCells,\n placement: c.placement,\n choose: c.choose,\n fill: c.fill,\n relief: c.relief,\n animate: c.animate,\n });\n const { slots } = frame;\n const focusRing = c.focusRing === undefined ? \"#1a56db\" : c.focusRing;\n const list = (c.role ?? \"list\") === \"list\";\n const virtual = !!c.virtualize;\n\n // A tile keeps its element while it shows the same item, so items keep their state.\n const keyOf = (i: number) => {\n const slot = slots[i]!;\n if (!c.renderCell && slot >= 0) {\n const item = items[slot];\n return item && typeof item === \"object\" ? `n${nodeId(item)}` : `i${slot}`;\n }\n return `c${layout.cells[i]!.id}`;\n };\n const hasContent = (i: number) => (c.renderCell ? slots[i]! >= 0 : slots[i]! >= 0 && !isEmpty(items[slots[i]!]));\n\n focusable = new Set(c.navigable ? layout.cells.filter((cell) => hasContent(cell.index)).map((cell) => cell.id) : []);\n const firstFocusable = layout.cells.find((cell) => focusable.has(cell.id))?.id;\n const active = activeId !== undefined && focusable.has(activeId) ? activeId : firstFocusable;\n\n // The tiles to show: all, or those in view plus the tab stop.\n let shown: number[];\n if (!virtual) shown = layout.cells.map((_, i) => i);\n else {\n const s = new Set(view && view.width >= 0 ? cellsInRect(layout, view).map((cell) => cell.index) : []);\n const a = active !== undefined ? layout.cells.find((cell) => cell.id === active) : undefined;\n if (a) s.add(a.index);\n shown = [...s].sort((x, y) => x - y);\n }\n let positions: Map<number, number> | undefined;\n if (virtual) {\n positions = new Map();\n for (const cell of layout.cells) if (hasContent(cell.index)) positions.set(cell.index, positions.size + 1);\n }\n const allKeys = frame.anim || virtual ? new Set(layout.cells.map((_, i) => keyOf(i))) : undefined;\n\n const next = new Map<string, Tile>();\n for (const i of shown) {\n const cell = layout.cells[i]!;\n const slot = slots[i]!;\n const key = keyOf(i);\n let content: TileContent = c.renderCell ? c.renderCell(cell, { slot }) : slot >= 0 ? items[slot] : undefined;\n const empty = isEmpty(content);\n const state: CellState = { empty, slot: empty && !c.renderCell ? -1 : slot };\n if (empty) content = resolvePerCell(c.fallback, cell, state);\n const silent = empty && isEmpty(content);\n\n let tile = tiles.get(key);\n if (!tile || tile.leaving) {\n const el = document.createElement(\"div\");\n tile = { key, el, cell, state, empty };\n if (frame.anim && mounted && !lastKeys.has(key)) el.setAttribute(\"data-entering\", \"\");\n }\n tiles.delete(key);\n next.set(key, tile);\n Object.assign(tile, { cell, state, empty });\n const el = tile.el;\n byElement.set(el, tile);\n\n const canFocus = focusable.has(cell.id);\n attr(el, \"role\", silent ? undefined : list ? \"listitem\" : undefined);\n attr(el, \"aria-hidden\", silent ? \"true\" : undefined);\n attr(el, \"aria-label\", silent ? undefined : resolvePerCell(c.cellLabel, cell, state));\n attr(el, \"aria-setsize\", positions && list && !silent ? positions.size : undefined);\n attr(el, \"aria-posinset\", positions && list && !silent ? positions.get(i) : undefined);\n attr(el, \"tabindex\", canFocus ? (cell.id === active ? 0 : -1) : undefined);\n attr(el, \"class\", resolvePerCell(c.cellClass, cell, state) || undefined);\n attr(el, \"data-cell-id\", cell.id);\n attr(el, \"data-index\", cell.index);\n attr(el, \"data-empty\", empty);\n attr(el, \"data-boundary\", !!cell.boundary);\n for (const [k, v] of Object.entries(resolvePerCell(c.cellAttributes, cell, state) ?? {})) attr(el, k, v);\n applyStyle(el, {\n ...tileStyle(frame, cell, {\n empty,\n safeArea: c.safeArea,\n backdrop: c.backdrop != null,\n clickable: !!c.onCellActivate && !empty,\n focus: slot >= 0 ? c.focalPoints?.[slot] : undefined,\n aspect: slot >= 0 ? c.aspects?.[slot] : undefined,\n }),\n ...resolvePerCell(c.cellStyle, cell, state),\n });\n\n // Children: backdrop, content (in its safe area box), bevel, focus ring.\n const kids: Node[] = [];\n if (c.backdrop != null) {\n if (!tile.backdrop || tile.backdrop.source !== c.backdrop) {\n const node = typeof c.backdrop === \"function\" ? c.backdrop() : c.backdrop.cloneNode(true);\n const wrap = document.createElement(\"div\");\n wrap.setAttribute(\"aria-hidden\", \"true\");\n wrap.appendChild(node);\n tile.backdrop = { source: c.backdrop, node: wrap };\n }\n applyStyle(tile.backdrop.node as HTMLElement, backdropStyle(frame, cell));\n kids.push(tile.backdrop.node);\n } else tile.backdrop = undefined;\n let node: Node | undefined;\n if (typeof content === \"string\") {\n if (!tile.text) tile.text = document.createTextNode(content);\n else if (tile.text.data !== content) tile.text.data = content;\n node = tile.text;\n } else if (content) node = content;\n if (node && c.safeArea) {\n if (!tile.safe) {\n tile.safe = document.createElement(\"div\");\n tile.safe.setAttribute(\"data-safe-area\", \"\");\n }\n const aspect = !c.renderCell && !empty && c.aspects ? (c.aspects[slot] ?? 1) : undefined;\n applyStyle(tile.safe, safeBoxStyle(frame, cell, aspect, c.safeArea));\n setChildren(tile.safe, [node]);\n kids.push(tile.safe);\n } else if (node) kids.push(node);\n const bevel = frame.bevel(i);\n if (bevel && bevel.length) {\n const clip = frame.anim ? String(el.style.getPropertyValue(\"clip-path\")) : \"\";\n const bk = tileViewBox(cell) + clip + bevel.map((p) => p.d + p.fill + p.opacity).join();\n if (tile.bevel?.key !== bk) {\n const s = svg(\n \"svg\",\n { \"aria-hidden\": \"true\", \"data-bevel\": \"\", \"data-late\": frame.anim ? \"\" : undefined, viewBox: tileViewBox(cell), preserveAspectRatio: \"none\" },\n bevel.map((p) => svg(\"path\", { d: p.d, fill: p.fill, \"fill-opacity\": p.opacity })),\n ) as SVGSVGElement;\n applyStyle(s, overlayStyle);\n tile.bevel = { key: bk, node: s };\n }\n kids.push(tile.bevel.node);\n } else tile.bevel = undefined;\n if (canFocus && focusRing !== false) {\n const strokes = ringStrokes(frame, cell, focusRing);\n const rk = tileViewBox(cell) + strokes[0]!.d + focusRing;\n if (tile.ring?.key !== rk) {\n const s = svg(\n \"svg\",\n { \"aria-hidden\": \"true\", \"data-focus-ring\": \"\", viewBox: tileViewBox(cell), preserveAspectRatio: \"none\" },\n strokes.map((p) => svg(\"path\", { d: p.d, fill: \"none\", stroke: p.stroke, \"stroke-width\": p.width, \"vector-effect\": \"non-scaling-stroke\" })),\n ) as SVGSVGElement;\n applyStyle(s, overlayStyle);\n tile.ring = { key: rk, node: s };\n }\n kids.push(tile.ring.node);\n } else tile.ring = undefined;\n setChildren(el, kids);\n }\n\n // Tiles no longer shown: gone for good (fade out when animating), or just out of view.\n const present = allKeys ?? new Set(next.keys());\n for (const tile of tiles.values()) {\n if (frame.anim && mounted && !present.has(tile.key)) startLeaving(tile, frame.anim.duration);\n }\n tiles = next;\n\n // The layout element and its children.\n attr(container, \"role\", c.role ?? \"list\");\n attr(container, \"aria-label\", c.label);\n attr(container, \"class\", c.className);\n applyStyle(container, containerStyle(layout));\n const css = tileSheet({ focusRing: !!c.navigable && focusRing !== false, anim: frame.anim });\n if (sheet.textContent !== css) sheet.textContent = css;\n const top: Node[] = [];\n if (css) top.push(sheet);\n if (c.background) {\n applyStyle(backgroundEl, backgroundStyle(frame, c.background));\n top.push(backgroundEl);\n }\n const shadow = shadowShape(frame, shown.map((i) => layout.cells[i]!));\n if (shadow) {\n attr(shadowEl, \"viewBox\", shadow.viewBox);\n applyStyle(shadowEl, shadow.style);\n attr(blur, \"stdDeviation\", shadow.blur);\n attr(shadowPath, \"d\", shadow.d);\n attr(shadowPath, \"transform\", shadow.transform);\n attr(shadowPath, \"fill-opacity\", shadow.opacity);\n top.push(shadowEl);\n }\n setChildren(container, [...top, ...[...tiles.values()].map((t) => t.el), ...[...leaving].map((t) => t.el)]);\n\n lastKeys = present;\n mounted = true;\n if (pendingFocus) {\n const t = [...tiles.values()].find((x) => x.cell.id === pendingFocus);\n if (t) {\n pendingFocus = undefined;\n t.el.focus();\n }\n }\n\n // Virtualization: measure what's in view, and again whenever it may change.\n if (virtual && !stopWatching) stopWatching = watchView(container, measure);\n else if (!virtual && stopWatching) {\n stopWatching();\n stopWatching = undefined;\n view = undefined;\n } else if (virtual && watchedLayout !== layout) queueMicrotask(measure);\n watchedLayout = layout;\n }\n\n function measure() {\n if (destroyed || !config.virtualize) return;\n const overscan = Math.max(0, (typeof config.virtualize === \"object\" ? config.virtualize.overscan : undefined) ?? 300);\n const next = viewRect(container, layout, overscan);\n if (!sameRect(next, view)) {\n view = next;\n render();\n }\n }\n\n function startLeaving(tile: Tile, duration: number) {\n tile.leaving = true;\n const el = tile.el;\n for (const a of [\"role\", \"tabindex\", \"aria-label\", \"aria-setsize\", \"aria-posinset\", \"data-entering\"]) el.removeAttribute(a);\n el.setAttribute(\"aria-hidden\", \"true\");\n el.setAttribute(\"data-exiting\", \"\");\n leaving.add(tile);\n const timer = setTimeout(() => {\n timers.delete(timer);\n leaving.delete(tile);\n el.remove();\n }, duration);\n timers.add(timer);\n }\n\n // Events, on the layout element: which tile they're for (across shadow roots too).\n const tileOf = (e: Event): Tile | undefined => {\n for (const n of e.composedPath()) {\n if (n === container) return undefined;\n if (n instanceof Element && n.parentNode === container) {\n const t = byElement.get(n);\n return t && !t.leaving ? t : undefined;\n }\n }\n return undefined;\n };\n const setActive = (id: string) => {\n if (id === activeId) return;\n activeId = id;\n for (const t of tiles.values()) if (focusable.has(t.cell.id)) attr(t.el, \"tabindex\", t.cell.id === id ? 0 : -1);\n };\n const onClick = (e: MouseEvent) => {\n const t = tileOf(e);\n if (t && !t.empty && config.onCellActivate) config.onCellActivate(t.cell, t.state);\n };\n const onFocusIn = (e: FocusEvent) => {\n const t = tileOf(e);\n if (t && e.target === t.el && focusable.has(t.cell.id)) setActive(t.cell.id);\n };\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.defaultPrevented || !config.navigable || e.altKey || e.ctrlKey || e.metaKey) return;\n const t = tileOf(e);\n // Only when a tile itself has focus, not an input or button inside it.\n if (!t || e.target !== t.el || !focusable.has(t.cell.id)) return;\n const action = keyAction(layout, t.cell, e.key, (cell) => focusable.has(cell.id), !!config.onCellActivate);\n if (!action) return;\n e.preventDefault();\n if (\"activate\" in action) config.onCellActivate!(t.cell, t.state);\n else if (\"move\" in action) {\n const to = action.move;\n setActive(to.id);\n const shownTile = [...tiles.values()].find((x) => x.cell.id === to.id);\n if (shownTile) shownTile.el.focus();\n else {\n // Out of view (virtualized): render it, then focus it.\n pendingFocus = to.id;\n render();\n }\n }\n };\n container.addEventListener(\"click\", onClick);\n container.addEventListener(\"focusin\", onFocusIn);\n container.addEventListener(\"keydown\", onKeyDown);\n\n render();\n\n return {\n element: container,\n get layout() {\n return layout;\n },\n update(changes) {\n config = { ...config, ...changes };\n render();\n },\n refresh: render,\n tileElement(cellId) {\n for (const t of tiles.values()) if (t.cell.id === cellId) return t.el;\n return undefined;\n },\n destroy() {\n destroyed = true;\n stopWatching?.();\n timers.forEach(clearTimeout);\n container.removeEventListener(\"click\", onClick);\n container.removeEventListener(\"focusin\", onFocusIn);\n container.removeEventListener(\"keydown\", onKeyDown);\n // Take items out of their tiles, so they can be used elsewhere.\n for (const t of [...tiles.values(), ...leaving]) {\n if (t.safe) setChildren(t.safe, []);\n setChildren(t.el, []);\n }\n container.remove();\n },\n };\n}\n\n","import {\n backdropCss,\n cellCss,\n cellShape,\n cellInDirection,\n contentSlots,\n createLayout,\n objectPosition,\n fitCount,\n matchSlots,\n regionCss,\n safeAreaCss,\n screenToLayout,\n viewCss,\n type Cell,\n type ContentCells,\n type ContentPlacement,\n type Focus,\n type Layout,\n type LayoutOptions,\n type Rect,\n weightedLayout,\n} from \"@andamento/core\";\nimport { cellPath, defaultBevel, neutralPalette, reliefPaths, resolveFills, shadowOffset, type FillSource, type ReliefOptions, type ReliefPath } from \"@andamento/svg\";\n\n/**\n * The parts of an HTML tile layout that don't depend on a framework: what each tile's\n * element looks like, what keys do, what's in view. `mountTileLayout`, the\n * `<andamento-layout>` element and the Vue components all render from these.\n */\n\n/** How a layout's `fit` option sizes its tiles. */\nexport type FitProp = boolean | \"atLeast\" | \"nearest\";\n\n/** What a per-cell option function is told about the cell besides its geometry. */\nexport interface CellState {\n /** The cell has no content. */\n empty: boolean;\n /** Position among the cells that hold content, in reading order (the item index), or -1. */\n slot: number;\n}\n\n/**\n * Put each tile's content in its safe area: `true` or \"tile\" fits the whole tile (for a tile\n * an `edges: \"window\"` layout cuts, content near the edge is then partly hidden like the\n * tile), \"visible\" fits the part that shows. See `SafeAreaOptions.within`.\n */\nexport type SafeAreaProp = boolean | \"tile\" | \"visible\";\n\n/** A value, or a function giving it per cell. */\nexport type PerCell<T> = T | ((cell: Cell, state: CellState) => T);\n\nexport const resolvePerCell = <T>(v: PerCell<T> | undefined, cell: Cell, state: CellState): T | undefined =>\n typeof v === \"function\" ? (v as (c: Cell, s: CellState) => T)(cell, state) : v;\n\n/** Style as property → value, camelCase (`clipPath`) or custom (`--x`). */\nexport type StyleMap = Record<string, string | number | undefined>;\n\n/** Clip paths get this many points when animating, so any two tile shapes can morph. */\nexport const MORPH_POINTS = 72;\n\nconst PLACEHOLDER: LayoutOptions = { region: { x: 0, y: 0, width: 1, height: 1 }, tiling: { type: \"grid\", width: 1 } };\n\n/** What a layout's items need from it: how many there are, and how they're sized and placed. */\nexport interface LayoutNeeds {\n fit?: FitProp;\n count: number;\n cells?: ContentCells;\n /** Tiles each item spans (see `weightedLayout`); heavier items get featured tiles. */\n weights?: readonly number[];\n placement?: ContentPlacement;\n}\n\n/**\n * A layout from options, worked out again only when they change (compared by value; a\n * `cells` function by identity). Returns `layout` itself when given.\n */\nexport function layoutResolver(component: string) {\n let lastKey: string | undefined, lastCells: ContentCells | undefined, last: Layout | undefined;\n return (options: LayoutOptions | undefined, layout: Layout | undefined, fit?: LayoutNeeds): Layout => {\n if (layout) return layout;\n if (!options) throw new Error(`${component} needs either \\`options\\` or \\`layout\\``);\n const fitting = !!fit?.fit && fit.count >= 1 && Number.isFinite(fit.count);\n const mode = fit?.fit === \"nearest\" ? \"nearest\" : \"atLeast\";\n // One weight per item, 1 for any not given; only items that are there count.\n const count = fit && Number.isFinite(fit.count) ? fit.count : 0;\n const weights = fit?.weights?.some((w) => w > 1) && count > 0 ? Array.from({ length: count }, (_, i) => fit.weights![i] ?? 1) : undefined;\n const cells = fitting || weights ? fit!.cells : undefined;\n const key = JSON.stringify([options, fitting && fit!.count, mode, weights, weights && fit!.placement]);\n if (last && key === lastKey && cells === lastCells) return last;\n last = weights\n ? weightedLayout(options, weights, { fit: fitting && mode, cells, placement: fit!.placement }).layout\n : fitting\n ? fitCount(options, fit!.count, { cells, mode }).layout\n : createLayout(options ?? PLACEHOLDER);\n lastKey = key;\n lastCells = cells;\n return last;\n };\n}\n\nexport interface FrameOptions {\n /** How many items there are to place (Infinity when every allowed cell gets content). */\n count: number;\n aspects?: readonly number[];\n contentCells?: ContentCells;\n placement?: ContentPlacement;\n choose?: \"placement\" | \"shape\";\n fill?: FillSource;\n relief?: boolean | ReliefOptions;\n animate?: boolean | { duration?: number; easing?: string };\n}\n\n/** Everything about a layout's tiles shared between them. */\nexport interface Frame {\n layout: Layout;\n /** Item index per cell, or -1. */\n slots: number[];\n /** Empty-tile color per cell. */\n fills: string[];\n /** Bevel paths for a cell (worked out on first use), or undefined without relief. */\n bevel(index: number): ReliefPath[] | undefined;\n shadow?: { dx: number; dy: number; blur: number; opacity: number };\n anim?: { duration: number; easing: string };\n /** `left, top, width, height` transitions, when animating. */\n boxTransition?: string;\n tileTransition?: string;\n}\n\n/** Builds frames, reusing the slots, fills and bevels of the last one where nothing they depend on changed. */\nexport function frameBuilder() {\n let slotKey = \"\", slotLayout: Layout | undefined, slotCells: ContentCells | undefined, slots: number[] = [];\n let fillLayout: Layout | undefined, fillSource: FillSource | undefined, fills: string[] = [];\n let bevelKey = \"\", bevelLayout: Layout | undefined, bevels = new Map<number, ReliefPath[]>();\n return (layout: Layout, o: FrameOptions): Frame => {\n const key = JSON.stringify([o.count === Infinity ? -1 : o.count, o.aspects, o.placement, o.choose, typeof o.contentCells === \"function\" ? 0 : o.contentCells]);\n if (layout !== slotLayout || key !== slotKey || o.contentCells !== slotCells) {\n slots = o.aspects && o.count !== Infinity\n ? matchSlots(layout, Array.from({ length: o.count }, (_, i) => o.aspects![i] ?? 1), { cells: o.contentCells, placement: o.placement, choose: o.choose })\n : contentSlots(layout, o.count, { cells: o.contentCells, placement: o.placement });\n slotLayout = layout;\n slotKey = key;\n slotCells = o.contentCells;\n }\n const fill = o.fill ?? neutralPalette;\n if (layout !== fillLayout || fill !== fillSource) {\n fills = resolveFills(layout, fill);\n fillLayout = layout;\n fillSource = fill;\n }\n const relief = o.relief === true ? {} : o.relief || undefined;\n const rk = relief ? JSON.stringify(relief) : \"\";\n if (layout !== bevelLayout || rk !== bevelKey) {\n bevels = new Map();\n bevelLayout = layout;\n bevelKey = rk;\n }\n const width = relief ? (relief.bevel ?? defaultBevel(layout)) : 0;\n const cache = bevels;\n const anim = o.animate\n ? {\n duration: (typeof o.animate === \"object\" ? o.animate.duration : undefined) ?? 400,\n easing: (typeof o.animate === \"object\" ? o.animate.easing : undefined) ?? \"cubic-bezier(0.2, 0.8, 0.2, 1)\",\n }\n : undefined;\n const timing = anim ? `${anim.duration}ms ${anim.easing}` : \"\";\n const boxTransition = anim ? [\"left\", \"top\", \"width\", \"height\"].map((p) => `${p} ${timing}`).join(\", \") : undefined;\n return {\n layout,\n slots,\n fills,\n bevel(i) {\n if (!relief || width <= 0) return undefined;\n let b = cache.get(i);\n if (!b) cache.set(i, (b = reliefPaths(layout, layout.cells[i]!, relief, width)));\n return b;\n },\n shadow: relief ? shadowOffset(relief) : undefined,\n anim,\n boxTransition,\n tileTransition: anim ? `${boxTransition}, clip-path ${timing}, background-color ${timing}` : undefined,\n };\n };\n}\n\n/** Style of the element holding the layout. */\nexport const containerStyle = (layout: Layout): StyleMap => ({\n position: \"relative\",\n width: \"100%\",\n aspectRatio: `${layout.bounds.width} / ${layout.bounds.height}`,\n});\n\n/** Style of the element painting `background` across the region (seen through the gaps). */\nexport const backgroundStyle = (frame: Frame, background: string): StyleMap => ({\n position: \"absolute\",\n inset: \"0\",\n background,\n clipPath: regionCss(frame.layout),\n transition: frame.anim ? `clip-path ${frame.anim.duration}ms ${frame.anim.easing}` : undefined,\n});\n\n/**\n * A tile's element: placed over its cell's bounding box and clipped to its shape. Empty\n * tiles (and every tile with `safeArea`) show their fill unless there's a backdrop.\n */\nexport function tileStyle(\n frame: Frame,\n cell: Cell,\n o: { empty: boolean; safeArea?: SafeAreaProp; backdrop?: boolean; clickable?: boolean; focus?: Focus; aspect?: number },\n): StyleMap {\n return {\n ...(o.focus && !o.empty ? focusStyle(frame, cell, o.focus, o.aspect) : {}),\n position: \"absolute\",\n boxSizing: \"border-box\",\n overflow: \"hidden\",\n ...cellCss(cell, frame.layout, 4, frame.anim ? { points: MORPH_POINTS } : {}),\n transition: frame.tileTransition,\n background: (o.empty || o.safeArea) && !o.backdrop ? frame.fills[cell.index] : undefined,\n cursor: o.clickable ? \"pointer\" : undefined,\n };\n}\n\n/**\n * The `--andamento-object-position` a tile sets for its content's focal point, which\n * `coverStyle` uses as its `object-position`. Exact with the image's `aspect` (given, or the focus's own; see\n * `objectPosition`); without, the focus as a percentage, which CSS keeps at the same place\n * in the tile's box rather than in the middle of what shows.\n */\nexport function focusStyle(frame: Frame, cell: Cell, focus: Focus, aspect?: number): StyleMap {\n const shape = aspect ?? focus.aspect;\n const pos = shape && shape > 0 ? objectPosition(cell, frame.layout, { aspect: shape, focus }) : `${focus.x * 100}% ${focus.y * 100}%`;\n return { \"--andamento-object-position\": pos };\n}\n\n/** A backdrop copy inside a tile: behind its content, covering the whole layout. */\nexport const backdropStyle = (frame: Frame, cell: Cell): StyleMap => ({\n position: \"absolute\",\n zIndex: -1,\n pointerEvents: \"none\",\n ...backdropCss(cell, frame.layout),\n transition: frame.boxTransition,\n});\n\n/** The box holding a tile's content with `safeArea`. */\nexport const safeBoxStyle = (frame: Frame, cell: Cell, aspect?: number, safe?: SafeAreaProp): StyleMap => ({\n position: \"absolute\",\n boxSizing: \"border-box\",\n ...safeAreaCss(cell, frame.layout, { aspect, within: safe === \"visible\" ? \"visible\" : \"tile\" }),\n transition: frame.boxTransition,\n});\n\n/** Style of an <svg> drawn over a tile (bevel, focus ring), with `viewBox` set to `tileViewBox`. */\nexport const overlayStyle: StyleMap = { position: \"absolute\", inset: \"0\", width: \"100%\", height: \"100%\", pointerEvents: \"none\" };\n\nexport const tileViewBox = (cell: Cell) => {\n const b = cellShape(cell).bbox;\n return `${b.x} ${b.y} ${b.width} ${b.height}`;\n};\n\n/** The focus ring's two strokes: white under the color, so it shows on any content. */\nexport const ringStrokes = (frame: Frame, cell: Cell, color: string) => {\n const d = cellPath(frame.layout, cell);\n return [\n { d, stroke: \"#fff\", width: 8 },\n { d, stroke: color, width: 4 },\n ];\n};\n\n/** The shadow tiles cast into the grout (with relief's `shadow`), for an <svg> over the region. */\nexport function shadowShape(frame: Frame, cells: readonly Cell[]) {\n const s = frame.shadow;\n if (!s) return undefined;\n const { bounds } = frame.layout;\n return {\n viewBox: `${bounds.x} ${bounds.y} ${bounds.width} ${bounds.height}`,\n style: { ...overlayStyle, clipPath: viewCss(frame.layout) } as StyleMap,\n blur: s.blur,\n d: cells.map((c) => cellPath(frame.layout, c)).join(\"\"),\n transform: `translate(${s.dx} ${s.dy})`,\n opacity: s.opacity,\n };\n}\n\n/**\n * What a key does on a focused tile: move focus to another tile, activate it, or just stop\n * the page scrolling (arrows at the edge). Undefined for keys that aren't ours.\n */\nexport function keyAction(\n layout: Layout,\n from: Cell,\n key: string,\n accept: (cell: Cell) => boolean,\n canActivate: boolean,\n): { move: Cell } | { activate: true } | { prevent: true } | undefined {\n const dirs: Record<string, \"up\" | \"down\" | \"left\" | \"right\"> = { ArrowUp: \"up\", ArrowDown: \"down\", ArrowLeft: \"left\", ArrowRight: \"right\" };\n let to: Cell | undefined;\n if (dirs[key]) to = cellInDirection(layout, from, dirs[key]!, accept);\n else if (key === \"Home\") to = layout.cells.find(accept);\n else if (key === \"End\") to = [...layout.cells].reverse().find(accept);\n else if ((key === \"Enter\" || key === \" \") && canActivate) return { activate: true };\n if (to) return { move: to };\n return key.startsWith(\"Arrow\") ? { prevent: true } : undefined;\n}\n\n/** Style sheet text for focus rings and animation (empty when neither is on). */\nexport function tileSheet(o: { focusRing: boolean; anim?: { duration: number; easing: string } }): string {\n let css = \"\";\n // The ring shows only on keyboard focus; a CSS outline would be clipped away anyway.\n if (o.focusRing)\n css +=\n \"[data-andamento]>[data-cell-id]:focus{outline:none}\" +\n \"[data-andamento]>[data-cell-id]>[data-focus-ring]{display:none}\" +\n \"[data-andamento]>[data-cell-id]:focus-visible>[data-focus-ring]{display:block}\";\n if (o.anim) {\n const { duration, easing } = o.anim;\n css +=\n \"@keyframes andamento-enter{from{opacity:0;transform:scale(.85)}}\" +\n \"@keyframes andamento-exit{to{opacity:0;transform:scale(.85)}}\" +\n \"@keyframes andamento-late{0%,70%{opacity:0}to{opacity:1}}\" +\n `[data-andamento]>[data-entering]{animation:andamento-enter ${duration}ms ${easing} backwards}` +\n `[data-andamento]>[data-exiting]{animation:andamento-exit ${duration}ms ${easing} forwards;pointer-events:none}` +\n `[data-andamento]>[data-cell-id]>[data-late]{animation:andamento-late ${duration}ms linear backwards}` +\n \"@media (prefers-reduced-motion:reduce){[data-andamento]>[data-cell-id],[data-andamento]>[data-cell-id] *{transition:none!important;animation:none!important}\" +\n \"[data-andamento]>[data-exiting]{display:none}}\";\n }\n return css;\n}\n\n/** \"Nothing in view\": `view` before the layout has been measured, or when it's off screen. */\nexport const NOTHING_IN_VIEW: Rect = { x: 0, y: 0, width: -1, height: -1 };\n\n/**\n * The part of the layout in view (in layout units), widened by `overscan` pixels and\n * snapped outwards to a coarse grid so small scrolls give the same rectangle.\n */\nexport function viewRect(el: Element, layout: Layout, overscan: number): Rect {\n const box = el.getBoundingClientRect();\n const seen = visibleClientRect(el, box);\n const { bounds } = layout;\n const scale = Math.min(box.width / (bounds.width || 1), box.height / (bounds.height || 1));\n if (!seen || !(scale > 0)) return NOTHING_IN_VIEW;\n const a = screenToLayout(layout, box, seen.left - overscan, seen.top - overscan);\n const b = screenToLayout(layout, box, seen.right + overscan, seen.bottom + overscan);\n const q = Math.max(overscan / 2, 50) / scale;\n const x0 = Math.floor(a.x / q) * q, y0 = Math.floor(a.y / q) * q;\n return { x: x0, y: y0, width: Math.ceil(b.x / q) * q - x0, height: Math.ceil(b.y / q) * q - y0 };\n}\n\nexport const sameRect = (a: Rect | undefined, b: Rect | undefined) =>\n !!a && !!b && a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n\n/**\n * Call `measure` now and again (at most once a frame) whenever the page or any scrolling\n * container scrolls, the window resizes or `el` does. Returns a function that stops it.\n */\nexport function watchView(el: Element, measure: () => void): () => void {\n const raf = typeof requestAnimationFrame === \"function\" ? requestAnimationFrame : (f: () => void) => setTimeout(f, 16) as unknown as number;\n const cancel = typeof cancelAnimationFrame === \"function\" ? cancelAnimationFrame : (h: number) => clearTimeout(h);\n let frame = 0;\n const run = () => {\n frame = 0;\n measure();\n };\n const schedule = () => {\n if (!frame) frame = raf(run);\n };\n measure();\n window.addEventListener(\"scroll\", schedule, { capture: true, passive: true });\n window.addEventListener(\"resize\", schedule);\n const observer = typeof ResizeObserver === \"function\" ? new ResizeObserver(schedule) : undefined;\n observer?.observe(el);\n return () => {\n if (frame) cancel(frame);\n window.removeEventListener(\"scroll\", schedule, { capture: true });\n window.removeEventListener(\"resize\", schedule);\n observer?.disconnect();\n };\n}\n\n/**\n * The part of `el` (whose box is `box`) visible on screen: within the window and every\n * ancestor that clips its overflow (across shadow roots too). Undefined when none of it is.\n */\nfunction visibleClientRect(el: Element, box: DOMRect) {\n let left = Math.max(box.left, 0);\n let top = Math.max(box.top, 0);\n let right = Math.min(box.right, window.innerWidth || document.documentElement.clientWidth);\n let bottom = Math.min(box.bottom, window.innerHeight || document.documentElement.clientHeight);\n const parent = (n: Element): Element | null => n.parentElement ?? ((n.parentNode as ShadowRoot | null)?.host ?? null);\n for (let p = parent(el); p && p !== document.body && p !== document.documentElement; p = parent(p)) {\n const s = getComputedStyle(p);\n if (/(auto|scroll|hidden|clip)/.test(`${s.overflow} ${s.overflowX} ${s.overflowY}`)) {\n const r = p.getBoundingClientRect();\n left = Math.max(left, r.left);\n top = Math.max(top, r.top);\n right = Math.min(right, r.right);\n bottom = Math.min(bottom, r.bottom);\n }\n }\n return right > left && bottom > top ? { left, top, right, bottom } : undefined;\n}\n\n/** Style that makes an <img> or <video> cover its tile, like `object-fit: cover`. */\nexport const coverStyle: StyleMap = {\n display: \"block\",\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n // Set by the tile from the item's focal point (see `focalPoints`); centerd otherwise.\n objectPosition: \"var(--andamento-object-position, 50% 50%)\",\n};\n","import type { Cell, ContentCells, ContentPlacement, Focus, Layout, LayoutOptions } from \"@andamento/core\";\nimport type { FillSource, ReliefOptions } from \"@andamento/svg\";\nimport { coverStyle, type CellState, type FitProp, type PerCell, type SafeAreaProp, type StyleMap } from \"./model\";\nimport { mountTileLayout, type TileContent, type TileLayoutConfig, type TileLayoutHandle } from \"./mount\";\n\n/** Detail of the `cellactivate` event. */\nexport interface CellActivateDetail {\n cell: Cell;\n /** Item index, as in `CellState`. */\n slot: number;\n /** The child element in the tile. */\n item: Element | undefined;\n}\n\n// Lets the module load where there's no DOM (server rendering); the element can't be used there.\nconst Base = (typeof HTMLElement === \"undefined\" ? class {} : HTMLElement) as typeof HTMLElement;\n\nconst BOOLEAN = [\"navigable\", \"animate\", \"relief\", \"safe-area\", \"virtualize\"] as const;\nconst ATTRIBUTES = [...BOOLEAN, \"options\", \"fit\", \"placement\", \"content-cells\", \"choose\", \"background\", \"fill\", \"focus-ring\", \"label\"];\n\nconst json = (v: string) => {\n try {\n return JSON.parse(v);\n } catch {\n throw new SyntaxError(`<andamento-layout>: not valid JSON: ${v}`);\n }\n};\n\nlet slotCount = 0;\n\n/**\n * `<andamento-layout>`: a tiling as a web component, for any framework or none (Angular,\n * Svelte, Solid, Lit, plain HTML). Each child element fills one tile, in reading order,\n * clipped to the tile's shape; children stay where you put them (they're shown in the\n * tiles through slots), so frameworks keep managing them.\n *\n * Set `options` (a `LayoutOptions` object, or JSON in the attribute) or `layout`. Simple\n * settings are attributes too: `navigable`, `animate`, `relief`, `safe-area`, `virtualize`,\n * `fit`, `placement`, `content-cells`, `choose`, `background`, `fill`, `focus-ring`, `label`.\n * Give children `data-aspect` (width / height) to put them in tiles of their shape, and\n * `data-focus` (\"x y\", fractions of the width and height) to keep that point of a photo in\n * view as its tile crops it (style the photo with `coverStyle`, or\n * `object-position: var(--andamento-object-position)`), and `data-weight` (how many tiles\n * it spans) to give important children featured tiles. A child\n * with `slot=\"backdrop\"` is copied into every tile as one picture across them all.\n *\n * Tiles are in the element's shadow root: style them with `::part(tile)` (also `empty`\n * and `boundary`, e.g. `andamento-layout::part(empty)`). Activating a tile fires\n * `cellactivate`, with `CellActivateDetail`.\n */\nexport class AndamentoLayoutElement extends Base {\n static observedAttributes = ATTRIBUTES;\n\n #config: TileLayoutConfig & { options?: LayoutOptions } = {};\n #props: Partial<TileLayoutConfig> = {};\n #handle?: TileLayoutHandle;\n #observer?: MutationObserver;\n #queued = false;\n #slots = new WeakMap<Element, HTMLSlotElement>();\n #items: Element[] = [];\n #backdrop?: { el: Element; make: () => Node };\n\n /** The same function for the same backdrop child, so tiles keep their copies. */\n #backdropFor(el: Element) {\n if (this.#backdrop?.el !== el) this.#backdrop = { el, make: () => copyBackdrop(el) };\n return this.#backdrop.make;\n }\n\n constructor() {\n super();\n const root = this.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = \":host{display:block}:host([hidden]){display:none}\";\n root.appendChild(style);\n }\n\n /** Layout options (also the `options` attribute, as JSON). */\n get options(): LayoutOptions | undefined {\n return this.#props.options;\n }\n set options(v: LayoutOptions | undefined) {\n this.#set({ options: v });\n }\n /** A precomputed layout, instead of `options`. */\n get layout(): Layout | undefined {\n return this.#handle?.layout ?? this.#props.layout;\n }\n set layout(v: Layout | undefined) {\n this.#set({ layout: v });\n }\n /** Color of empty tiles: a color, a palette or a function per cell. */\n get fill() {\n return this.#props.fill;\n }\n set fill(v: FillSource | undefined) {\n this.#set({ fill: v });\n }\n get relief() {\n return this.#props.relief;\n }\n set relief(v: boolean | ReliefOptions | undefined) {\n this.#set({ relief: v });\n }\n /** Animate changes (the `animate` attribute; `animate` itself is the Web Animations method). */\n get animated() {\n return this.#props.animate;\n }\n set animated(v: TileLayoutConfig[\"animate\"]) {\n this.#set({ animate: v });\n }\n get virtualize() {\n return this.#props.virtualize;\n }\n set virtualize(v: TileLayoutConfig[\"virtualize\"]) {\n this.#set({ virtualize: v });\n }\n get navigable() {\n return this.#props.navigable;\n }\n set navigable(v: boolean | undefined) {\n this.#set({ navigable: v });\n }\n get safeArea() {\n return this.#props.safeArea;\n }\n set safeArea(v: SafeAreaProp | undefined) {\n this.#set({ safeArea: v });\n }\n get fit() {\n return this.#props.fit;\n }\n set fit(v: FitProp | undefined) {\n this.#set({ fit: v });\n }\n get placement() {\n return this.#props.placement;\n }\n set placement(v: ContentPlacement | undefined) {\n this.#set({ placement: v });\n }\n get contentCells() {\n return this.#props.contentCells;\n }\n set contentCells(v: ContentCells | undefined) {\n this.#set({ contentCells: v });\n }\n get choose() {\n return this.#props.choose;\n }\n set choose(v: \"placement\" | \"shape\" | undefined) {\n this.#set({ choose: v });\n }\n /** Width / height of each child; otherwise read from children's `data-aspect`. */\n get aspects() {\n return this.#props.aspects;\n }\n set aspects(v: readonly number[] | undefined) {\n this.#set({ aspects: v });\n }\n /** Tiles each child spans; otherwise read from children's `data-weight`. */\n get weights() {\n return this.#props.weights;\n }\n set weights(v: readonly number[] | undefined) {\n this.#set({ weights: v });\n }\n /** Focal point of each child; otherwise read from children's `data-focus`. */\n get focalPoints() {\n return this.#props.focalPoints;\n }\n set focalPoints(v: readonly (Focus | undefined)[] | undefined) {\n this.#set({ focalPoints: v });\n }\n get background() {\n return this.#props.background;\n }\n set background(v: string | undefined) {\n this.#set({ background: v });\n }\n get focusRing() {\n return this.#props.focusRing;\n }\n set focusRing(v: string | false | undefined) {\n this.#set({ focusRing: v });\n }\n /** Accessible name of each tile. */\n get cellLabel() {\n return this.#props.cellLabel;\n }\n set cellLabel(v: PerCell<string | undefined> | undefined) {\n this.#set({ cellLabel: v });\n }\n /** Extra style for each tile. */\n get cellStyle() {\n return this.#props.cellStyle;\n }\n set cellStyle(v: PerCell<StyleMap | undefined> | undefined) {\n this.#set({ cellStyle: v });\n }\n /** Content for empty tiles (rendered in the shadow root). */\n get fallback() {\n return this.#props.fallback;\n }\n set fallback(v: PerCell<TileContent> | undefined) {\n this.#set({ fallback: v });\n }\n\n /** The tile element (in the shadow root) showing a cell, if it's rendered. */\n tileElement(cellId: string): HTMLElement | undefined {\n return this.#handle?.tileElement(cellId);\n }\n\n connectedCallback() {\n // Children added, removed or moved, or a child's data-aspect changing; not changes\n // deeper inside children.\n this.#observer = new MutationObserver((records) => {\n if (records.some((r) => r.target === this || r.target.parentNode === this)) this.#schedule();\n });\n this.#observer.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: [\"data-aspect\", \"data-focus\", \"data-weight\", \"slot\"] });\n this.#schedule();\n }\n\n disconnectedCallback() {\n this.#observer?.disconnect();\n this.#observer = undefined;\n this.#handle?.destroy();\n this.#handle = undefined;\n }\n\n attributeChangedCallback() {\n this.#schedule();\n }\n\n #set(changes: Partial<TileLayoutConfig>) {\n this.#props = { ...this.#props, ...changes };\n this.#schedule();\n }\n\n /** Several changes in one go render once. */\n #schedule() {\n if (this.#queued) return;\n this.#queued = true;\n queueMicrotask(() => {\n this.#queued = false;\n this.#render();\n });\n }\n\n /** Render now rather than at the end of the current task (e.g. before measuring). */\n render() {\n this.#render();\n }\n\n #render() {\n if (!this.isConnected) return;\n const config = this.#configure();\n if (!config.options && !config.layout) return;\n if (this.#handle) this.#handle.update(config);\n else {\n this.#handle = mountTileLayout(this.shadowRoot!, config);\n this.#handle.element.setAttribute(\"part\", \"layout\");\n }\n }\n\n #configure(): TileLayoutConfig {\n const a = (n: string) => this.getAttribute(n);\n const flag = (n: string) => this.hasAttribute(n) && a(n) !== \"false\";\n // Every setting named, so one that's been removed is cleared (updates merge).\n const fromAttrs: Partial<TileLayoutConfig> = Object.fromEntries([...ATTRIBUTE_KEYS].map((k) => [k, undefined]));\n if (a(\"options\")) fromAttrs.options = json(a(\"options\")!);\n for (const n of BOOLEAN) if (flag(n)) (fromAttrs as Record<string, unknown>)[n === \"safe-area\" ? \"safeArea\" : n] = true;\n if (a(\"safe-area\") === \"tile\" || a(\"safe-area\") === \"visible\") fromAttrs.safeArea = a(\"safe-area\") as \"tile\" | \"visible\";\n if (a(\"fit\")) fromAttrs.fit = a(\"fit\") === \"nearest\" ? \"nearest\" : a(\"fit\") === \"false\" ? false : true;\n if (a(\"placement\")) fromAttrs.placement = a(\"placement\") as ContentPlacement;\n if (a(\"content-cells\")) fromAttrs.contentCells = a(\"content-cells\") as ContentCells;\n if (a(\"choose\")) fromAttrs.choose = a(\"choose\") as \"placement\" | \"shape\";\n if (a(\"background\")) fromAttrs.background = a(\"background\")!;\n if (a(\"fill\")) fromAttrs.fill = a(\"fill\")!.trim().startsWith(\"[\") ? json(a(\"fill\")!) : a(\"fill\")!;\n if (a(\"focus-ring\")) fromAttrs.focusRing = a(\"focus-ring\") === \"false\" ? false : a(\"focus-ring\")!;\n if (a(\"label\")) fromAttrs.label = a(\"label\")!;\n\n // Children: each element fills a tile, through a slot of its own.\n const children = [...this.children];\n const backdrop = children.find((c) => c.getAttribute(\"slot\") === \"backdrop\");\n this.#items = children.filter((c) => c !== backdrop && c.localName !== \"template\");\n const items = this.#items.map((child) => {\n let slot = this.#slots.get(child);\n if (!slot) {\n slot = document.createElement(\"slot\");\n slot.name = `andamento-${++slotCount}`;\n this.#slots.set(child, slot);\n }\n if (child.getAttribute(\"slot\") !== slot.name) child.setAttribute(\"slot\", slot.name);\n return slot;\n });\n const aspectAttrs = this.#items.map((c) => Number(c.getAttribute(\"data-aspect\")));\n const aspects = aspectAttrs.some((v) => v > 0) ? aspectAttrs.map((v) => (v > 0 ? v : 1)) : undefined;\n\n const focusAttrs = this.#items.map((c): Focus | undefined => {\n const [x, y] = (c.getAttribute(\"data-focus\") ?? \"\").trim().split(/[\\s,]+/).map(Number);\n return Number.isFinite(x) && Number.isFinite(y) && c.hasAttribute(\"data-focus\") ? { x: x!, y: y! } : undefined;\n });\n const focalPoints = focusAttrs.some(Boolean) ? focusAttrs : undefined;\n const weightAttrs = this.#items.map((c) => Number(c.getAttribute(\"data-weight\")));\n const weights = weightAttrs.some((v) => v > 1) ? weightAttrs.map((v) => (v > 0 ? v : 1)) : undefined;\n\n this.#config = {\n ...fromAttrs,\n aspects,\n focalPoints,\n weights,\n ...overrides(this.#props),\n items,\n backdrop: backdrop ? this.#backdropFor(backdrop) : undefined,\n cellAttributes: (cell: Cell, state: CellState) => ({\n part: [\"tile\", state.empty && \"empty\", cell.boundary && \"boundary\"].filter(Boolean).join(\" \"),\n }),\n onCellActivate: (cell: Cell, state: CellState) => {\n const detail: CellActivateDetail = { cell, slot: state.slot, item: this.#items[state.slot] };\n this.dispatchEvent(new CustomEvent(\"cellactivate\", { detail, bubbles: true, composed: true }));\n },\n };\n // Children with no tile (more than there are tiles) are simply not shown.\n return this.#config;\n }\n}\n\n/**\n * Properties that override attributes. One set back to undefined stays in as undefined only\n * if no attribute gives it (so it's cleared, as updates merge).\n */\nconst overrides = (props: Partial<TileLayoutConfig>): Partial<TileLayoutConfig> =>\n Object.fromEntries(Object.entries(props).filter(([k, v]) => v !== undefined || !ATTRIBUTE_KEYS.has(k)));\nconst ATTRIBUTE_KEYS = new Set([\"options\", \"navigable\", \"animate\", \"relief\", \"safeArea\", \"virtualize\", \"fit\", \"placement\", \"contentCells\", \"choose\", \"background\", \"fill\", \"focusRing\", \"label\", \"aspects\", \"focalPoints\", \"weights\"]);\n\n/** A copy of the backdrop child for one tile; pictures are made to cover it. */\nfunction copyBackdrop(el: Element): Node {\n const copy = el.cloneNode(true) as HTMLElement;\n copy.removeAttribute(\"slot\");\n if (/^(img|video|picture|canvas)$/.test(copy.localName)) {\n for (const [k, v] of Object.entries(coverStyle)) copy.style.setProperty(k.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase()), String(v));\n }\n return copy;\n}\n\n/**\n * Register `<andamento-layout>` (or another tag name). Safe to call more than once.\n * Returns the element class.\n */\nexport function defineTileLayoutElement(tagName = \"andamento-layout\"): typeof AndamentoLayoutElement {\n if (typeof customElements === \"undefined\") return AndamentoLayoutElement;\n const existing = customElements.get(tagName);\n if (existing) return existing as unknown as typeof AndamentoLayoutElement;\n // A subclass per tag name: one class can't be registered twice.\n const cls = class extends AndamentoLayoutElement {};\n customElements.define(tagName, cls as unknown as CustomElementConstructor);\n return cls;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"andamento-layout\": AndamentoLayoutElement;\n }\n interface HTMLElementEventMap {\n cellactivate: CustomEvent<CellActivateDetail>;\n }\n}\n","import { cellAt, screenToLayout, type Cell, type HitOptions, type Layout } from \"@andamento/core\";\n\n/** The parts of a pointer or mouse event `cellFromPointer` uses. */\nexport interface PointerLike {\n clientX: number;\n clientY: number;\n currentTarget: EventTarget | null;\n}\n\n/**\n * The cell under a pointer event, for handlers on the element showing the layout (a\n * `<TileLayout>`, an `<svg>` or a canvas). Unlike handlers on each tile, it can see the\n * gaps: with `tolerance`, a pointer in the grout picks the nearest tile. Pass `element`\n * when the handler is on some other element.\n */\nexport function cellFromPointer(layout: Layout, event: PointerLike, options: HitOptions & { element?: Element } = {}): Cell | undefined {\n const el = options.element ?? (event.currentTarget as Element | null);\n if (!el || typeof (el as Element).getBoundingClientRect !== \"function\") return undefined;\n const point = screenToLayout(layout, el.getBoundingClientRect(), event.clientX, event.clientY);\n return cellAt(layout, point, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAAyI;;;ACAzI,kBAsBO;AACP,iBAAsJ;AA6B/I,IAAM,iBAAiB,CAAI,GAA2B,MAAY,UACvE,OAAO,MAAM,aAAc,EAAmC,MAAM,KAAK,IAAI;AAMxE,IAAM,eAAe;AAE5B,IAAM,cAA6B,EAAE,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE,GAAG,QAAQ,EAAE,MAAM,QAAQ,OAAO,EAAE,EAAE;AAgB9G,SAAS,eAAe,WAAmB;AAChD,MAAI,SAA6B,WAAqC;AACtE,SAAO,CAAC,SAAoC,QAA4B,QAA8B;AACpG,QAAI,OAAQ,QAAO;AACnB,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,GAAG,SAAS,yCAAyC;AACnF,UAAM,UAAU,CAAC,CAAC,KAAK,OAAO,IAAI,SAAS,KAAK,OAAO,SAAS,IAAI,KAAK;AACzE,UA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,GAAe,0BAA0B,WAAY,QAAO;AAC/E,QAAM,YAAQ,6BAAe,QAAQ,GAAG,sBAAsB,GAAG,MAAM,SAAS,MAAM,OAAO;AAC7F,aAAO,qBAAO,QAAQ,OAAO,OAAO;AACtC;;;AJeA,IAAAC,cAA+C;","names":["import_core","el","node","import_core","import_svg"]}
|
|
1
|
+
{"version":3,"sources":["/Users/matthewputnam/code/andamento/packages/dom/dist/index.cjs","../src/mount.ts","../src/element.ts","../src/pointer.ts","../src/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACzBA,uCAAyI;AA+HzI,IAAM,IAAA,EAAM,4BAAA;AACZ,IAAM,MAAA,EAAQ,CAAC,CAAA,EAAA,GAAe,CAAA,CAAE,UAAA,CAAW,IAAI,EAAA,EAAI,EAAA,EAAI,CAAA,CAAE,OAAA,CAAQ,QAAA,EAAU,CAAC,CAAA,EAAA,GAAM,IAAA,EAAM,CAAA,CAAE,WAAA,CAAY,CAAC,CAAA;AACvG,IAAM,QAAA,EAAU,CAAC,CAAA,EAAA,GAAmB,EAAA,GAAK,KAAA,GAAQ,EAAA,IAAM,EAAA;AAEvD,IAAM,UAAA,kBAAY,IAAI,OAAA,CAA2B,CAAA;AAEjD,SAAS,UAAA,CAAW,EAAA,EAA8B,IAAA,EAAgB;AAChE,EAAA,MAAM,KAAA,mBAAO,SAAA,CAAU,GAAA,CAAI,EAAE,CAAA,UAAK,CAAC,GAAA;AACnC,EAAA,IAAA,CAAA,MAAW,EAAA,GAAK,MAAA,CAAO,IAAA,CAAK,IAAI,CAAA,EAAG,GAAA,CAAI,IAAA,CAAK,CAAC,EAAA,IAAM,KAAA,EAAA,GAAa,IAAA,CAAK,CAAC,EAAA,IAAM,KAAA,CAAA,EAAW,EAAA,CAAG,KAAA,CAAM,cAAA,CAA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AAA;AACM,IAAA;AACvB,EAAA;AACF;AAE+B;AACe,EAAA;AACG,EAAA;AAEkB,EAAA;AAC3B,EAAA;AACC,EAAA;AACJ,EAAA;AACE,EAAA;AACP,EAAA;AACI,EAAA;AACI,EAAA;AACP,EAAA;AACG,EAAA;AACH,EAAA;AACK,EAAA;AAGF,EAAA;AACI,EAAA;AACf,EAAA;AACJ,EAAA;AACD,IAAA;AACL,IAAA;AACqB,MAAA;AACH,MAAA;AACX,MAAA;AAClB,IAAA;AACmC,IAAA;AAC5B,IAAA;AACR,EAAA;AACwB,EAAA;AACS,EAAA;AAEV,EAAA;AACS,IAAA;AACK,IAAA;AACrC,EAAA;AACmC,EAAA;AACX,EAAA;AACS,EAAA;AAEnB,EAAA;AACV,IAAA;AACH,IAAA;AACA,IAAA;AACA,IAAA;AACkB,IAAA;AAClB,IAAA;AACqB,IAAA;AAC8B,IAAA;AACnB,MAAA;AAChC,IAAA;AACkD,IAAA;AACO,MAAA;AACpB,MAAA;AACrC,IAAA;AACF,EAAA;AAEY,EAAA;AACd;AAjRO;AAyRA;AACkB;AAGc;AACT,EAAA;AACH,EAAA;AACQ,EAAA;AACG,IAAA;AACtC,EAAA;AACO,EAAA;AACT;AAMwC;AACR,EAAA;AACM,EAAA;AACf,EAAA;AAEK,EAAA;AAAwB,EAAA;AACuB,EAAA;AAClE,EAAA;AACT;AF4VyC;AACA;AGlsBuC;AAeZ;AAC7B,EAAA;AACH,EAAA;AACG,EAAA;AACD,EAAA;AACtC;AHsrByC;AACA;AI9rBhB;AJgsBgB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/matthewputnam/code/andamento/packages/dom/dist/index.cjs","sourcesContent":[null,"import { cellsInRect, type Cell, type ContentCells, type ContentPlacement, type Focus, type Layout, type LayoutOptions, type Rect } from \"@andamento/core\";\nimport type { FillSource, ReliefOptions } from \"@andamento/svg\";\nimport {\n backdropStyle,\n backgroundStyle,\n containerStyle,\n frameBuilder,\n keyAction,\n layoutResolver,\n overlayStyle,\n resolvePerCell,\n ringStrokes,\n safeBoxStyle,\n sameRect,\n shadowShape,\n tileSheet,\n tileStyle,\n tileViewBox,\n viewRect,\n watchView,\n type CellState,\n type FitProp,\n type PerCell,\n type SafeAreaProp,\n type StyleMap,\n} from \"./model\";\n\n/** What can go in a tile: a DOM node, text, or nothing. */\nexport type TileContent = Node | string | null | undefined;\n\nexport interface TileLayoutConfig {\n /** Layout options; or pass a precomputed `layout` instead. */\n options?: LayoutOptions;\n layout?: Layout;\n /**\n * The content: each item fills one tile, in reading order, clipped to the tile's shape.\n * Nodes are moved into their tiles (and kept there as the layout changes), so pass the\n * same node again to keep its state.\n */\n items?: readonly TileContent[];\n /**\n * Alternative to `items`: each tile's content from its cell, worked out on every render.\n * Return the same node again to keep it. `slot` numbers the cells allowed by `contentCells`.\n */\n renderCell?: (cell: Cell, state: { slot: number }) => TileContent;\n /** Which tiles may hold content: \"all\" (default), \"whole\" (not cut by the outline) or a test. */\n contentCells?: ContentCells;\n /** Where items go when there are fewer than tiles: \"reading\" (default), \"center\" or \"spread\". */\n placement?: ContentPlacement;\n /** Width / height of each item, to put items in tiles of similar shape (see `matchSlots`). */\n aspects?: readonly number[];\n /** With `aspects`: \"shape\" also picks which tiles hold items by their shape. */\n choose?: \"placement\" | \"shape\";\n /**\n * Focal point of each item (fractions of its width and height; see `estimateFocus`): what\n * a photo keeps in view as its tile crops it. Each tile sets `--andamento-object-position`,\n * which `coverStyle` uses; exact when the photo's shape is known (`aspects`, or the focus's `aspect`).\n */\n focalPoints?: readonly (Focus | undefined)[];\n /**\n * How many tiles each item spans (1 for an ordinary item; rounded): heavier items get a\n * featured tile of that many merged tiles, where they fall in reading order (see\n * `weightedLayout`). With `fit`, the tiles are sized to fit everything. Needs `options`.\n */\n weights?: readonly number[];\n /**\n * Put each tile's content in the tile's safe area, not its bounding box (see `safeArea`).\n * For tiles an `edges: \"window\"` layout cuts, `true` or \"tile\" fits the whole tile and\n * \"visible\" the part that shows.\n */\n safeArea?: SafeAreaProp;\n /** Color of empty tiles: a color, a palette or a function per cell. Defaults to `neutralPalette`. */\n fill?: FillSource;\n /** Size the tiles to the items: `true`/\"atLeast\" or \"nearest\". Ignored with `layout` or `renderCell`. */\n fit?: FitProp;\n /**\n * One picture across all the tiles: a node copied into every tile (or a function making\n * a fresh one per tile), sized to the whole layout so each tile shows its piece.\n */\n backdrop?: Node | (() => Node);\n /** Raised tiles: a lit bevel and optional shadow. `true` for the defaults. */\n relief?: boolean | ReliefOptions;\n /** Arrow-key navigation over the tiles with content, as one tab stop. */\n navigable?: boolean;\n /** Called when a tile with content is clicked, or Enter / Space pressed on it (with `navigable`). */\n onCellActivate?: (cell: Cell, state: CellState) => void;\n /** Accessible name for each tile. */\n cellLabel?: PerCell<string | undefined>;\n /** Focus ring color, or `false` for none. Defaults to \"#1a56db\". */\n focusRing?: string | false;\n /** Animate layout and content changes. `true` for 400 ms, or `{ duration, easing }`. */\n animate?: boolean | { duration?: number; easing?: string };\n /** Only put tiles in view (plus `overscan` pixels, default 300) in the DOM. */\n virtualize?: boolean | { overscan?: number };\n /** Content for empty tiles. */\n fallback?: PerCell<TileContent>;\n /** Class for each tile element. */\n cellClass?: PerCell<string | undefined>;\n /** Extra style for each tile element: camelCase or custom (`--x`) properties. */\n cellStyle?: PerCell<StyleMap | undefined>;\n /** Extra attributes for each tile element (`part`, `title`, …). */\n cellAttributes?: PerCell<Record<string, string | undefined> | undefined>;\n /** Color painted across the whole region, visible through the gaps. */\n background?: string;\n /** Role of the layout element: \"list\" (default; tiles with content are list items) or another. */\n role?: string;\n /** Accessible name of the layout (its `aria-label`). */\n label?: string;\n /** Class for the layout element. */\n className?: string;\n}\n\nexport interface TileLayoutHandle {\n /** The layout element (with `data-andamento`), inside the element mounted into. */\n readonly element: HTMLDivElement;\n /** The layout being shown. */\n readonly layout: Layout;\n /** Change some options (others stay as they are; pass `undefined` to clear one) and re-render. */\n update(changes: Partial<TileLayoutConfig>): void;\n /** Render again, e.g. after changing what `renderCell` returns. */\n refresh(): void;\n /** The element of the tile showing a cell, if it's in the DOM. */\n tileElement(cellId: string): HTMLElement | undefined;\n /** Remove the layout (items are taken out of their tiles) and stop listening. */\n destroy(): void;\n}\n\nconst SVG = \"http://www.w3.org/2000/svg\";\nconst kebab = (k: string) => (k.startsWith(\"--\") ? k : k.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase()));\nconst isEmpty = (c: TileContent) => c == null || c === \"\";\n\nconst styleMemo = new WeakMap<Element, StyleMap>();\n/** Set style properties, removing those set last time and not now. */\nfunction applyStyle(el: HTMLElement | SVGElement, next: StyleMap) {\n const prev = styleMemo.get(el) ?? {};\n for (const k of Object.keys(prev)) if (next[k] === undefined && prev[k] !== undefined) el.style.removeProperty(kebab(k));\n for (const [k, v] of Object.entries(next)) if (v !== undefined && prev[k] !== v) el.style.setProperty(kebab(k), String(v));\n styleMemo.set(el, next);\n}\n\nfunction attr(el: Element, name: string, value: string | number | boolean | undefined | null) {\n if (value === undefined || value === null || value === false) {\n if (el.hasAttribute(name)) el.removeAttribute(name);\n } else {\n const v = value === true ? \"\" : String(value);\n if (el.getAttribute(name) !== v) el.setAttribute(name, v);\n }\n}\n\n/** Make `parent`'s children exactly `nodes`, in order, moving as few as possible. */\nfunction setChildren(parent: Node, nodes: readonly Node[]) {\n let at: ChildNode | null = parent.firstChild;\n for (const n of nodes) {\n if (n === at) at = at.nextSibling;\n else parent.insertBefore(n, at);\n }\n while (at) {\n const next: ChildNode | null = at.nextSibling;\n parent.removeChild(at);\n at = next;\n }\n}\n\nfunction svg(tag: string, attrs: Record<string, string | number | undefined>, children: Element[] = []) {\n const el = document.createElementNS(SVG, tag);\n for (const [k, v] of Object.entries(attrs)) if (v !== undefined) el.setAttribute(k, String(v));\n for (const c of children) el.appendChild(c);\n return el;\n}\n\ninterface Tile {\n key: string;\n el: HTMLDivElement;\n cell: Cell;\n state: CellState;\n empty: boolean;\n text?: Text;\n backdrop?: { source: TileConfigBackdrop; node: Node };\n safe?: HTMLDivElement;\n bevel?: { key: string; node: SVGSVGElement };\n ring?: { key: string; node: SVGSVGElement };\n /** Names of the attributes `cellAttributes` set last time. */\n extra?: string[];\n /** Fading out (animated removal). */\n leaving?: boolean;\n}\ntype TileConfigBackdrop = NonNullable<TileLayoutConfig[\"backdrop\"]>;\n\nconst nodeIds = new WeakMap<Node, number>();\nlet nextNodeId = 1;\nconst nodeId = (n: Node) => {\n let id = nodeIds.get(n);\n if (!id) nodeIds.set(n, (id = nextNodeId++));\n return id;\n};\n\nlet uidCount = 0;\n\n/**\n * Render a tiling into `target` (an element or a shadow root), without a framework: one\n * absolutely positioned, clipped element per tile, holding the items you give it. Sized in\n * percentages, so it scales with `target`'s width. Returns a handle to update or remove it.\n *\n * Tiles have `data-cell-id`, `data-index`, `data-empty` and `data-boundary`, as with the\n * React and Vue components.\n */\nexport function mountTileLayout(target: Element | ShadowRoot, initial: TileLayoutConfig): TileLayoutHandle {\n let config: TileLayoutConfig = { ...initial };\n const uid = `andamento-dom${++uidCount}`;\n const resolveLayout = layoutResolver(\"mountTileLayout\");\n const buildFrame = frameBuilder();\n const container = document.createElement(\"div\");\n container.setAttribute(\"data-andamento\", \"\");\n target.appendChild(container);\n\n const sheet = document.createElement(\"style\");\n const backgroundEl = document.createElement(\"div\");\n backgroundEl.setAttribute(\"aria-hidden\", \"true\");\n const blur = svg(\"feGaussianBlur\", {});\n const shadowPath = svg(\"path\", { \"fill-rule\": \"evenodd\", fill: \"#000\", filter: `url(#${uid}-shadow)` });\n const shadowEl = svg(\"svg\", { \"aria-hidden\": \"true\", \"data-andamento-shadow\": \"\", preserveAspectRatio: \"none\" }, [\n svg(\"filter\", { id: `${uid}-shadow`, x: \"-10%\", y: \"-10%\", width: \"120%\", height: \"120%\" }, [blur]),\n shadowPath,\n ]) as SVGSVGElement;\n\n let layout!: Layout;\n let tiles = new Map<string, Tile>();\n const leaving = new Set<Tile>();\n const byElement = new WeakMap<Element, Tile>();\n let lastKeys = new Set<string>();\n let mounted = false;\n let activeId: string | undefined;\n let pendingFocus: string | undefined;\n let focusable = new Set<string>();\n let view: Rect | undefined;\n let stopWatching: (() => void) | undefined;\n let watchedLayout: Layout | undefined;\n const timers = new Set<ReturnType<typeof setTimeout>>();\n let destroyed = false;\n\n function render() {\n if (destroyed) return;\n const c = config;\n const items = c.renderCell ? [] : (c.items ?? []);\n layout = resolveLayout(c.options, c.layout, {\n fit: !c.renderCell && c.fit,\n count: items.length,\n cells: c.contentCells,\n weights: c.renderCell ? undefined : c.weights,\n placement: c.placement,\n });\n const frame = buildFrame(layout, {\n count: c.renderCell ? Infinity : items.length,\n aspects: c.renderCell ? undefined : c.aspects,\n contentCells: c.contentCells,\n placement: c.placement,\n choose: c.choose,\n fill: c.fill,\n relief: c.relief,\n animate: c.animate,\n });\n const { slots } = frame;\n const focusRing = c.focusRing === undefined ? \"#1a56db\" : c.focusRing;\n const list = (c.role ?? \"list\") === \"list\";\n const virtual = !!c.virtualize;\n\n // A tile keeps its element while it shows the same item, so items keep their state.\n const keyOf = (i: number) => {\n const slot = slots[i]!;\n if (!c.renderCell && slot >= 0) {\n const item = items[slot];\n return item && typeof item === \"object\" ? `n${nodeId(item)}` : `i${slot}`;\n }\n return `c${layout.cells[i]!.id}`;\n };\n const hasContent = (i: number) => (c.renderCell ? slots[i]! >= 0 : slots[i]! >= 0 && !isEmpty(items[slots[i]!]));\n\n focusable = new Set(c.navigable ? layout.cells.filter((cell) => hasContent(cell.index)).map((cell) => cell.id) : []);\n const firstFocusable = layout.cells.find((cell) => focusable.has(cell.id))?.id;\n const active = activeId !== undefined && focusable.has(activeId) ? activeId : firstFocusable;\n\n // The tiles to show: all, or those in view plus the tab stop.\n let shown: number[];\n if (!virtual) shown = layout.cells.map((_, i) => i);\n else {\n const s = new Set(view && view.width >= 0 ? cellsInRect(layout, view).map((cell) => cell.index) : []);\n const a = active !== undefined ? layout.cells.find((cell) => cell.id === active) : undefined;\n if (a) s.add(a.index);\n shown = [...s].sort((x, y) => x - y);\n }\n let positions: Map<number, number> | undefined;\n if (virtual) {\n positions = new Map();\n for (const cell of layout.cells) if (hasContent(cell.index)) positions.set(cell.index, positions.size + 1);\n }\n const allKeys = frame.anim || virtual ? new Set(layout.cells.map((_, i) => keyOf(i))) : undefined;\n\n const next = new Map<string, Tile>();\n for (const i of shown) {\n const cell = layout.cells[i]!;\n const slot = slots[i]!;\n const key = keyOf(i);\n let content: TileContent = c.renderCell ? c.renderCell(cell, { slot }) : slot >= 0 ? items[slot] : undefined;\n const empty = isEmpty(content);\n const state: CellState = { empty, slot: empty && !c.renderCell ? -1 : slot };\n if (empty) content = resolvePerCell(c.fallback, cell, state);\n const silent = empty && isEmpty(content);\n\n let tile = tiles.get(key);\n if (!tile || tile.leaving) {\n const el = document.createElement(\"div\");\n tile = { key, el, cell, state, empty };\n if (frame.anim && mounted && !lastKeys.has(key)) el.setAttribute(\"data-entering\", \"\");\n }\n tiles.delete(key);\n next.set(key, tile);\n Object.assign(tile, { cell, state, empty });\n const el = tile.el;\n byElement.set(el, tile);\n\n const canFocus = focusable.has(cell.id);\n attr(el, \"role\", silent ? undefined : list ? \"listitem\" : undefined);\n attr(el, \"aria-hidden\", silent ? \"true\" : undefined);\n attr(el, \"aria-label\", silent ? undefined : resolvePerCell(c.cellLabel, cell, state));\n attr(el, \"aria-setsize\", positions && list && !silent ? positions.size : undefined);\n attr(el, \"aria-posinset\", positions && list && !silent ? positions.get(i) : undefined);\n attr(el, \"tabindex\", canFocus ? (cell.id === active ? 0 : -1) : undefined);\n attr(el, \"class\", resolvePerCell(c.cellClass, cell, state) || undefined);\n attr(el, \"data-cell-id\", cell.id);\n attr(el, \"data-index\", cell.index);\n attr(el, \"data-empty\", empty);\n attr(el, \"data-boundary\", !!cell.boundary);\n // Extra attributes; those given last time and not now are removed.\n const extra = resolvePerCell(c.cellAttributes, cell, state) ?? {};\n for (const k of tile.extra ?? []) if (!(k in extra)) attr(el, k, undefined);\n for (const [k, v] of Object.entries(extra)) attr(el, k, v);\n tile.extra = Object.keys(extra);\n applyStyle(el, {\n ...tileStyle(frame, cell, {\n empty,\n safeArea: c.safeArea,\n backdrop: c.backdrop != null,\n clickable: !!c.onCellActivate && !empty,\n focus: slot >= 0 ? c.focalPoints?.[slot] : undefined,\n aspect: slot >= 0 ? c.aspects?.[slot] : undefined,\n }),\n ...resolvePerCell(c.cellStyle, cell, state),\n });\n\n // Children: backdrop, content (in its safe area box), bevel, focus ring.\n const kids: Node[] = [];\n if (c.backdrop != null) {\n if (!tile.backdrop || tile.backdrop.source !== c.backdrop) {\n const node = typeof c.backdrop === \"function\" ? c.backdrop() : c.backdrop.cloneNode(true);\n const wrap = document.createElement(\"div\");\n wrap.setAttribute(\"aria-hidden\", \"true\");\n wrap.appendChild(node);\n tile.backdrop = { source: c.backdrop, node: wrap };\n }\n applyStyle(tile.backdrop.node as HTMLElement, backdropStyle(frame, cell));\n kids.push(tile.backdrop.node);\n } else tile.backdrop = undefined;\n let node: Node | undefined;\n if (typeof content === \"string\") {\n if (!tile.text) tile.text = document.createTextNode(content);\n else if (tile.text.data !== content) tile.text.data = content;\n node = tile.text;\n } else if (content) node = content;\n if (node && c.safeArea) {\n if (!tile.safe) {\n tile.safe = document.createElement(\"div\");\n tile.safe.setAttribute(\"data-safe-area\", \"\");\n }\n const aspect = !c.renderCell && !empty && c.aspects ? (c.aspects[slot] ?? 1) : undefined;\n applyStyle(tile.safe, safeBoxStyle(frame, cell, aspect, c.safeArea));\n setChildren(tile.safe, [node]);\n kids.push(tile.safe);\n } else if (node) kids.push(node);\n const bevel = frame.bevel(i);\n if (bevel && bevel.length) {\n const clip = frame.anim ? String(el.style.getPropertyValue(\"clip-path\")) : \"\";\n const bk = tileViewBox(cell) + clip + bevel.map((p) => p.d + p.fill + p.opacity).join();\n if (tile.bevel?.key !== bk) {\n const s = svg(\n \"svg\",\n { \"aria-hidden\": \"true\", \"data-bevel\": \"\", \"data-late\": frame.anim ? \"\" : undefined, viewBox: tileViewBox(cell), preserveAspectRatio: \"none\" },\n bevel.map((p) => svg(\"path\", { d: p.d, fill: p.fill, \"fill-opacity\": p.opacity })),\n ) as SVGSVGElement;\n applyStyle(s, overlayStyle);\n tile.bevel = { key: bk, node: s };\n }\n kids.push(tile.bevel.node);\n } else tile.bevel = undefined;\n if (canFocus && focusRing !== false) {\n const strokes = ringStrokes(frame, cell, focusRing);\n const rk = tileViewBox(cell) + strokes[0]!.d + focusRing;\n if (tile.ring?.key !== rk) {\n const s = svg(\n \"svg\",\n { \"aria-hidden\": \"true\", \"data-focus-ring\": \"\", viewBox: tileViewBox(cell), preserveAspectRatio: \"none\" },\n strokes.map((p) => svg(\"path\", { d: p.d, fill: \"none\", stroke: p.stroke, \"stroke-width\": p.width, \"vector-effect\": \"non-scaling-stroke\" })),\n ) as SVGSVGElement;\n applyStyle(s, overlayStyle);\n tile.ring = { key: rk, node: s };\n }\n kids.push(tile.ring.node);\n } else tile.ring = undefined;\n setChildren(el, kids);\n }\n\n // Tiles no longer shown: gone for good (fade out when animating), or just out of view.\n const present = allKeys ?? new Set(next.keys());\n for (const tile of tiles.values()) {\n if (frame.anim && mounted && !present.has(tile.key)) startLeaving(tile, frame.anim.duration);\n }\n tiles = next;\n\n // The layout element and its children.\n attr(container, \"role\", c.role ?? \"list\");\n attr(container, \"aria-label\", c.label);\n attr(container, \"class\", c.className);\n applyStyle(container, containerStyle(layout));\n const css = tileSheet({ focusRing: !!c.navigable && focusRing !== false, anim: frame.anim });\n if (sheet.textContent !== css) sheet.textContent = css;\n const top: Node[] = [];\n if (css) top.push(sheet);\n if (c.background) {\n applyStyle(backgroundEl, backgroundStyle(frame, c.background));\n top.push(backgroundEl);\n }\n const shadow = shadowShape(frame, shown.map((i) => layout.cells[i]!));\n if (shadow) {\n attr(shadowEl, \"viewBox\", shadow.viewBox);\n applyStyle(shadowEl, shadow.style);\n attr(blur, \"stdDeviation\", shadow.blur);\n attr(shadowPath, \"d\", shadow.d);\n attr(shadowPath, \"transform\", shadow.transform);\n attr(shadowPath, \"fill-opacity\", shadow.opacity);\n top.push(shadowEl);\n }\n setChildren(container, [...top, ...[...tiles.values()].map((t) => t.el), ...[...leaving].map((t) => t.el)]);\n\n lastKeys = present;\n mounted = true;\n if (pendingFocus) {\n const t = [...tiles.values()].find((x) => x.cell.id === pendingFocus);\n if (t) {\n pendingFocus = undefined;\n t.el.focus();\n }\n }\n\n // Virtualization: measure what's in view, and again whenever it may change.\n if (virtual && !stopWatching) {\n // watchView measures straight away, which can render again: mark it started first,\n // so that render doesn't start a second watcher.\n let stop: (() => void) | undefined;\n stopWatching = () => stop?.();\n stop = watchView(container, measure);\n }\n else if (!virtual && stopWatching) {\n stopWatching();\n stopWatching = undefined;\n view = undefined;\n } else if (virtual && watchedLayout !== layout) queueMicrotask(measure);\n watchedLayout = layout;\n }\n\n function measure() {\n if (destroyed || !config.virtualize) return;\n const overscan = Math.max(0, (typeof config.virtualize === \"object\" ? config.virtualize.overscan : undefined) ?? 300);\n const next = viewRect(container, layout, overscan);\n if (!sameRect(next, view)) {\n view = next;\n render();\n }\n }\n\n function startLeaving(tile: Tile, duration: number) {\n tile.leaving = true;\n const el = tile.el;\n for (const a of [\"role\", \"tabindex\", \"aria-label\", \"aria-setsize\", \"aria-posinset\", \"data-entering\"]) el.removeAttribute(a);\n el.setAttribute(\"aria-hidden\", \"true\");\n el.setAttribute(\"data-exiting\", \"\");\n leaving.add(tile);\n const timer = setTimeout(() => {\n timers.delete(timer);\n leaving.delete(tile);\n el.remove();\n }, duration);\n timers.add(timer);\n }\n\n // Events, on the layout element: which tile they're for (across shadow roots too).\n const tileOf = (e: Event): Tile | undefined => {\n for (const n of e.composedPath()) {\n if (n === container) return undefined;\n if (n instanceof Element && n.parentNode === container) {\n const t = byElement.get(n);\n return t && !t.leaving ? t : undefined;\n }\n }\n return undefined;\n };\n const setActive = (id: string) => {\n if (id === activeId) return;\n activeId = id;\n for (const t of tiles.values()) if (focusable.has(t.cell.id)) attr(t.el, \"tabindex\", t.cell.id === id ? 0 : -1);\n };\n const onClick = (e: MouseEvent) => {\n const t = tileOf(e);\n if (t && !t.empty && config.onCellActivate) config.onCellActivate(t.cell, t.state);\n };\n const onFocusIn = (e: FocusEvent) => {\n const t = tileOf(e);\n if (t && e.target === t.el && focusable.has(t.cell.id)) setActive(t.cell.id);\n };\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.defaultPrevented || !config.navigable || e.altKey || e.ctrlKey || e.metaKey) return;\n const t = tileOf(e);\n // Only when a tile itself has focus, not an input or button inside it.\n if (!t || e.target !== t.el || !focusable.has(t.cell.id)) return;\n const action = keyAction(layout, t.cell, e.key, (cell) => focusable.has(cell.id), !!config.onCellActivate);\n if (!action) return;\n e.preventDefault();\n if (\"activate\" in action) config.onCellActivate!(t.cell, t.state);\n else if (\"move\" in action) {\n const to = action.move;\n setActive(to.id);\n const shownTile = [...tiles.values()].find((x) => x.cell.id === to.id);\n if (shownTile) shownTile.el.focus();\n else {\n // Out of view (virtualized): render it, then focus it.\n pendingFocus = to.id;\n render();\n }\n }\n };\n container.addEventListener(\"click\", onClick);\n container.addEventListener(\"focusin\", onFocusIn);\n container.addEventListener(\"keydown\", onKeyDown);\n\n render();\n\n return {\n element: container,\n get layout() {\n return layout;\n },\n update(changes) {\n config = { ...config, ...changes };\n render();\n },\n refresh: render,\n tileElement(cellId) {\n for (const t of tiles.values()) if (t.cell.id === cellId) return t.el;\n return undefined;\n },\n destroy() {\n destroyed = true;\n stopWatching?.();\n timers.forEach(clearTimeout);\n container.removeEventListener(\"click\", onClick);\n container.removeEventListener(\"focusin\", onFocusIn);\n container.removeEventListener(\"keydown\", onKeyDown);\n // Take items out of their tiles, so they can be used elsewhere.\n for (const t of [...tiles.values(), ...leaving]) {\n if (t.safe) setChildren(t.safe, []);\n setChildren(t.el, []);\n }\n container.remove();\n },\n };\n}\n\n","import type { Cell, ContentCells, ContentPlacement, Focus, Layout, LayoutOptions } from \"@andamento/core\";\nimport type { FillSource, ReliefOptions } from \"@andamento/svg\";\nimport { coverStyle, type CellState, type FitProp, type PerCell, type SafeAreaProp, type StyleMap } from \"./model\";\nimport { mountTileLayout, type TileContent, type TileLayoutConfig, type TileLayoutHandle } from \"./mount\";\n\n/** Detail of the `cellactivate` event. */\nexport interface CellActivateDetail {\n cell: Cell;\n /** Item index, as in `CellState`. */\n slot: number;\n /** The child element in the tile. */\n item: Element | undefined;\n}\n\n// Lets the module load where there's no DOM (server rendering); the element can't be used there.\nconst Base = (typeof HTMLElement === \"undefined\" ? class {} : HTMLElement) as typeof HTMLElement;\n\nconst BOOLEAN = [\"navigable\", \"animate\", \"relief\", \"safe-area\", \"virtualize\"] as const;\nconst ATTRIBUTES = [...BOOLEAN, \"options\", \"fit\", \"placement\", \"content-cells\", \"choose\", \"background\", \"fill\", \"focus-ring\", \"label\"];\n\nconst json = (v: string) => {\n try {\n return JSON.parse(v);\n } catch {\n throw new SyntaxError(`<andamento-layout>: not valid JSON: ${v}`);\n }\n};\n\nlet slotCount = 0;\n\n/**\n * `<andamento-layout>`: a tiling as a web component, for any framework or none (Angular,\n * Svelte, Solid, Lit, plain HTML). Each child element fills one tile, in reading order,\n * clipped to the tile's shape; children stay where you put them (they're shown in the\n * tiles through slots), so frameworks keep managing them.\n *\n * Set `options` (a `LayoutOptions` object, or JSON in the attribute) or `layout`. Simple\n * settings are attributes too: `navigable`, `animate`, `relief`, `safe-area`, `virtualize`,\n * `fit`, `placement`, `content-cells`, `choose`, `background`, `fill`, `focus-ring`, `label`.\n * Give children `data-aspect` (width / height) to put them in tiles of their shape, and\n * `data-focus` (\"x y\", fractions of the width and height) to keep that point of a photo in\n * view as its tile crops it (style the photo with `coverStyle`, or\n * `object-position: var(--andamento-object-position)`), and `data-weight` (how many tiles\n * it spans) to give important children featured tiles. A child\n * with `slot=\"backdrop\"` is copied into every tile as one picture across them all.\n *\n * Tiles are in the element's shadow root: style them with `::part(tile)` (also `empty`\n * and `boundary`, e.g. `andamento-layout::part(empty)`). Activating a tile fires\n * `cellactivate`, with `CellActivateDetail`.\n */\nexport class AndamentoLayoutElement extends Base {\n static observedAttributes = ATTRIBUTES;\n\n #config: TileLayoutConfig & { options?: LayoutOptions } = {};\n #props: Partial<TileLayoutConfig> = {};\n #handle?: TileLayoutHandle;\n #observer?: MutationObserver;\n #queued = false;\n #slots = new WeakMap<Element, HTMLSlotElement>();\n #items: Element[] = [];\n #backdrop?: { el: Element; make: () => Node };\n\n /** The same function for the same backdrop child, so tiles keep their copies. */\n #backdropFor(el: Element) {\n if (this.#backdrop?.el !== el) this.#backdrop = { el, make: () => copyBackdrop(el) };\n return this.#backdrop.make;\n }\n\n constructor() {\n super();\n const root = this.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = \":host{display:block}:host([hidden]){display:none}\";\n root.appendChild(style);\n }\n\n /** Layout options (also the `options` attribute, as JSON). */\n get options(): LayoutOptions | undefined {\n return this.#props.options;\n }\n set options(v: LayoutOptions | undefined) {\n this.#set({ options: v });\n }\n /** A precomputed layout, instead of `options`. */\n get layout(): Layout | undefined {\n return this.#handle?.layout ?? this.#props.layout;\n }\n set layout(v: Layout | undefined) {\n this.#set({ layout: v });\n }\n /** Color of empty tiles: a color, a palette or a function per cell. */\n get fill() {\n return this.#props.fill;\n }\n set fill(v: FillSource | undefined) {\n this.#set({ fill: v });\n }\n get relief() {\n return this.#props.relief;\n }\n set relief(v: boolean | ReliefOptions | undefined) {\n this.#set({ relief: v });\n }\n /** Animate changes (the `animate` attribute; `animate` itself is the Web Animations method). */\n get animated() {\n return this.#props.animate;\n }\n set animated(v: TileLayoutConfig[\"animate\"]) {\n this.#set({ animate: v });\n }\n get virtualize() {\n return this.#props.virtualize;\n }\n set virtualize(v: TileLayoutConfig[\"virtualize\"]) {\n this.#set({ virtualize: v });\n }\n get navigable() {\n return this.#props.navigable;\n }\n set navigable(v: boolean | undefined) {\n this.#set({ navigable: v });\n }\n get safeArea() {\n return this.#props.safeArea;\n }\n set safeArea(v: SafeAreaProp | undefined) {\n this.#set({ safeArea: v });\n }\n get fit() {\n return this.#props.fit;\n }\n set fit(v: FitProp | undefined) {\n this.#set({ fit: v });\n }\n get placement() {\n return this.#props.placement;\n }\n set placement(v: ContentPlacement | undefined) {\n this.#set({ placement: v });\n }\n get contentCells() {\n return this.#props.contentCells;\n }\n set contentCells(v: ContentCells | undefined) {\n this.#set({ contentCells: v });\n }\n get choose() {\n return this.#props.choose;\n }\n set choose(v: \"placement\" | \"shape\" | undefined) {\n this.#set({ choose: v });\n }\n /** Width / height of each child; otherwise read from children's `data-aspect`. */\n get aspects() {\n return this.#props.aspects;\n }\n set aspects(v: readonly number[] | undefined) {\n this.#set({ aspects: v });\n }\n /** Tiles each child spans; otherwise read from children's `data-weight`. */\n get weights() {\n return this.#props.weights;\n }\n set weights(v: readonly number[] | undefined) {\n this.#set({ weights: v });\n }\n /** Focal point of each child; otherwise read from children's `data-focus`. */\n get focalPoints() {\n return this.#props.focalPoints;\n }\n set focalPoints(v: readonly (Focus | undefined)[] | undefined) {\n this.#set({ focalPoints: v });\n }\n get background() {\n return this.#props.background;\n }\n set background(v: string | undefined) {\n this.#set({ background: v });\n }\n get focusRing() {\n return this.#props.focusRing;\n }\n set focusRing(v: string | false | undefined) {\n this.#set({ focusRing: v });\n }\n /** Accessible name of each tile. */\n get cellLabel() {\n return this.#props.cellLabel;\n }\n set cellLabel(v: PerCell<string | undefined> | undefined) {\n this.#set({ cellLabel: v });\n }\n /** Extra style for each tile. */\n get cellStyle() {\n return this.#props.cellStyle;\n }\n set cellStyle(v: PerCell<StyleMap | undefined> | undefined) {\n this.#set({ cellStyle: v });\n }\n /** Content for empty tiles (rendered in the shadow root). */\n get fallback() {\n return this.#props.fallback;\n }\n set fallback(v: PerCell<TileContent> | undefined) {\n this.#set({ fallback: v });\n }\n\n /** The tile element (in the shadow root) showing a cell, if it's rendered. */\n tileElement(cellId: string): HTMLElement | undefined {\n return this.#handle?.tileElement(cellId);\n }\n\n connectedCallback() {\n // Children added, removed or moved, or a child's data-aspect changing; not changes\n // deeper inside children.\n this.#observer = new MutationObserver((records) => {\n if (records.some((r) => r.target === this || r.target.parentNode === this)) this.#schedule();\n });\n this.#observer.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: [\"data-aspect\", \"data-focus\", \"data-weight\", \"slot\"] });\n this.#schedule();\n }\n\n disconnectedCallback() {\n this.#observer?.disconnect();\n this.#observer = undefined;\n this.#handle?.destroy();\n this.#handle = undefined;\n }\n\n attributeChangedCallback() {\n this.#schedule();\n }\n\n #set(changes: Partial<TileLayoutConfig>) {\n this.#props = { ...this.#props, ...changes };\n this.#schedule();\n }\n\n /** Several changes in one go render once. */\n #schedule() {\n if (this.#queued) return;\n this.#queued = true;\n queueMicrotask(() => {\n this.#queued = false;\n this.#render();\n });\n }\n\n /** Render now rather than at the end of the current task (e.g. before measuring). */\n render() {\n this.#render();\n }\n\n #render() {\n if (!this.isConnected) return;\n const config = this.#configure();\n if (!config.options && !config.layout) return;\n if (this.#handle) this.#handle.update(config);\n else {\n this.#handle = mountTileLayout(this.shadowRoot!, config);\n this.#handle.element.setAttribute(\"part\", \"layout\");\n }\n }\n\n #configure(): TileLayoutConfig {\n const a = (n: string) => this.getAttribute(n);\n const flag = (n: string) => this.hasAttribute(n) && a(n) !== \"false\";\n // Every setting named, so one that's been removed is cleared (updates merge).\n const fromAttrs: Partial<TileLayoutConfig> = Object.fromEntries([...ATTRIBUTE_KEYS].map((k) => [k, undefined]));\n if (a(\"options\")) fromAttrs.options = json(a(\"options\")!);\n for (const n of BOOLEAN) if (flag(n)) (fromAttrs as Record<string, unknown>)[n === \"safe-area\" ? \"safeArea\" : n] = true;\n if (a(\"safe-area\") === \"tile\" || a(\"safe-area\") === \"visible\") fromAttrs.safeArea = a(\"safe-area\") as \"tile\" | \"visible\";\n if (a(\"fit\")) fromAttrs.fit = a(\"fit\") === \"nearest\" ? \"nearest\" : a(\"fit\") === \"false\" ? false : true;\n if (a(\"placement\")) fromAttrs.placement = a(\"placement\") as ContentPlacement;\n if (a(\"content-cells\")) fromAttrs.contentCells = a(\"content-cells\") as ContentCells;\n if (a(\"choose\")) fromAttrs.choose = a(\"choose\") as \"placement\" | \"shape\";\n if (a(\"background\")) fromAttrs.background = a(\"background\")!;\n if (a(\"fill\")) fromAttrs.fill = a(\"fill\")!.trim().startsWith(\"[\") ? json(a(\"fill\")!) : a(\"fill\")!;\n if (a(\"focus-ring\")) fromAttrs.focusRing = a(\"focus-ring\") === \"false\" ? false : a(\"focus-ring\")!;\n if (a(\"label\")) fromAttrs.label = a(\"label\")!;\n\n // Children: each element fills a tile, through a slot of its own.\n const children = [...this.children];\n const backdrop = children.find((c) => c.getAttribute(\"slot\") === \"backdrop\");\n this.#items = children.filter((c) => c !== backdrop && c.localName !== \"template\");\n const items = this.#items.map((child) => {\n let slot = this.#slots.get(child);\n if (!slot) {\n slot = document.createElement(\"slot\");\n slot.name = `andamento-${++slotCount}`;\n this.#slots.set(child, slot);\n }\n if (child.getAttribute(\"slot\") !== slot.name) child.setAttribute(\"slot\", slot.name);\n return slot;\n });\n const aspectAttrs = this.#items.map((c) => Number(c.getAttribute(\"data-aspect\")));\n const aspects = aspectAttrs.some((v) => v > 0) ? aspectAttrs.map((v) => (v > 0 ? v : 1)) : undefined;\n\n const focusAttrs = this.#items.map((c): Focus | undefined => {\n const [x, y] = (c.getAttribute(\"data-focus\") ?? \"\").trim().split(/[\\s,]+/).map(Number);\n return Number.isFinite(x) && Number.isFinite(y) && c.hasAttribute(\"data-focus\") ? { x: x!, y: y! } : undefined;\n });\n const focalPoints = focusAttrs.some(Boolean) ? focusAttrs : undefined;\n const weightAttrs = this.#items.map((c) => Number(c.getAttribute(\"data-weight\")));\n const weights = weightAttrs.some((v) => v > 1) ? weightAttrs.map((v) => (v > 0 ? v : 1)) : undefined;\n\n this.#config = {\n ...fromAttrs,\n aspects,\n focalPoints,\n weights,\n ...overrides(this.#props),\n items,\n backdrop: backdrop ? this.#backdropFor(backdrop) : undefined,\n cellAttributes: (cell: Cell, state: CellState) => ({\n part: [\"tile\", state.empty && \"empty\", cell.boundary && \"boundary\"].filter(Boolean).join(\" \"),\n }),\n onCellActivate: (cell: Cell, state: CellState) => {\n const detail: CellActivateDetail = { cell, slot: state.slot, item: this.#items[state.slot] };\n this.dispatchEvent(new CustomEvent(\"cellactivate\", { detail, bubbles: true, composed: true }));\n },\n };\n // Children with no tile (more than there are tiles) are simply not shown.\n return this.#config;\n }\n}\n\n/**\n * Properties that override attributes. One set back to undefined stays in as undefined only\n * if no attribute gives it (so it's cleared, as updates merge).\n */\nconst overrides = (props: Partial<TileLayoutConfig>): Partial<TileLayoutConfig> =>\n Object.fromEntries(Object.entries(props).filter(([k, v]) => v !== undefined || !ATTRIBUTE_KEYS.has(k)));\nconst ATTRIBUTE_KEYS = new Set([\"options\", \"navigable\", \"animate\", \"relief\", \"safeArea\", \"virtualize\", \"fit\", \"placement\", \"contentCells\", \"choose\", \"background\", \"fill\", \"focusRing\", \"label\", \"aspects\", \"focalPoints\", \"weights\"]);\n\n/** A copy of the backdrop child for one tile; pictures are made to cover it. */\nfunction copyBackdrop(el: Element): Node {\n const copy = el.cloneNode(true) as HTMLElement;\n copy.removeAttribute(\"slot\");\n if (/^(img|video|picture|canvas)$/.test(copy.localName)) {\n for (const [k, v] of Object.entries(coverStyle)) copy.style.setProperty(k.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase()), String(v));\n }\n return copy;\n}\n\n/**\n * Register `<andamento-layout>` (or another tag name). Safe to call more than once.\n * Returns the element class.\n */\nexport function defineTileLayoutElement(tagName = \"andamento-layout\"): typeof AndamentoLayoutElement {\n if (typeof customElements === \"undefined\") return AndamentoLayoutElement;\n const existing = customElements.get(tagName);\n if (existing) return existing as unknown as typeof AndamentoLayoutElement;\n // A subclass per tag name: one class can't be registered twice.\n const cls = class extends AndamentoLayoutElement {};\n customElements.define(tagName, cls as unknown as CustomElementConstructor);\n return cls;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"andamento-layout\": AndamentoLayoutElement;\n }\n interface HTMLElementEventMap {\n cellactivate: CustomEvent<CellActivateDetail>;\n }\n}\n","import { cellAt, screenToLayout, type Cell, type HitOptions, type Layout } from \"@andamento/core\";\n\n/** The parts of a pointer or mouse event `cellFromPointer` uses. */\nexport interface PointerLike {\n clientX: number;\n clientY: number;\n currentTarget: EventTarget | null;\n}\n\n/**\n * The cell under a pointer event, for handlers on the element showing the layout (a\n * `<TileLayout>`, an `<svg>` or a canvas). Unlike handlers on each tile, it can see the\n * gaps: with `tolerance`, a pointer in the grout picks the nearest tile. Pass `element`\n * when the handler is on some other element.\n */\nexport function cellFromPointer(layout: Layout, event: PointerLike, options: HitOptions & { element?: Element } = {}): Cell | undefined {\n const el = options.element ?? (event.currentTarget as Element | null);\n if (!el || typeof (el as Element).getBoundingClientRect !== \"function\") return undefined;\n const point = screenToLayout(layout, el.getBoundingClientRect(), event.clientX, event.clientY);\n return cellAt(layout, point, options);\n}\n","/**\n * No framework: `mountTileLayout()` and the `<andamento-layout>` web component.\n *\n * @module @andamento/dom\n */\nexport { mountTileLayout } from \"./mount\";\nexport type { TileContent, TileLayoutConfig, TileLayoutHandle } from \"./mount\";\nexport { AndamentoLayoutElement, defineTileLayoutElement } from \"./element\";\nexport type { CellActivateDetail } from \"./element\";\nexport { coverStyle } from \"./model\";\nexport type { CellState, FitProp, PerCell, SafeAreaProp, StyleMap } from \"./model\";\nexport { cellFromPointer } from \"./pointer\";\nexport type { PointerLike } from \"./pointer\";\nexport { defaultPalette, neutralPalette } from \"@andamento/svg\";\nexport type { FillSource, ReliefOptions } from \"@andamento/svg\";\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,166 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LayoutOptions, Layout, Cell, ContentCells, ContentPlacement, Focus, HitOptions } from '@andamento/core';
|
|
2
|
+
import { FillSource, ReliefOptions } from '@andamento/svg';
|
|
3
3
|
export { FillSource, ReliefOptions, defaultPalette, neutralPalette } from '@andamento/svg';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* The parts of an HTML tile layout that don't depend on a framework: what each tile's
|
|
7
|
-
* element looks like, what keys do, what's in view. `mountTileLayout`, the
|
|
8
|
-
* `<andamento-layout>` element and the Vue components all render from these.
|
|
9
|
-
*/
|
|
10
|
-
/** How a layout's `fit` option sizes its tiles. */
|
|
11
|
-
type FitProp = boolean | "atLeast" | "nearest";
|
|
12
|
-
/** What a per-cell option function is told about the cell besides its geometry. */
|
|
13
|
-
interface CellState {
|
|
14
|
-
/** The cell has no content. */
|
|
15
|
-
empty: boolean;
|
|
16
|
-
/** Position among the cells that hold content, in reading order (the item index), or -1. */
|
|
17
|
-
slot: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Put each tile's content in its safe area: `true` or "tile" fits the whole tile (for a tile
|
|
21
|
-
* an `edges: "window"` layout cuts, content near the edge is then partly hidden like the
|
|
22
|
-
* tile), "visible" fits the part that shows. See `SafeAreaOptions.within`.
|
|
23
|
-
*/
|
|
24
|
-
type SafeAreaProp = boolean | "tile" | "visible";
|
|
25
|
-
/** A value, or a function giving it per cell. */
|
|
26
|
-
type PerCell<T> = T | ((cell: Cell, state: CellState) => T);
|
|
27
|
-
declare const resolvePerCell: <T>(v: PerCell<T> | undefined, cell: Cell, state: CellState) => T | undefined;
|
|
28
|
-
/** Style as property → value, camelCase (`clipPath`) or custom (`--x`). */
|
|
29
|
-
type StyleMap = Record<string, string | number | undefined>;
|
|
30
|
-
/** Clip paths get this many points when animating, so any two tile shapes can morph. */
|
|
31
|
-
declare const MORPH_POINTS = 72;
|
|
32
|
-
/** What a layout's items need from it: how many there are, and how they're sized and placed. */
|
|
33
|
-
interface LayoutNeeds {
|
|
34
|
-
fit?: FitProp;
|
|
35
|
-
count: number;
|
|
36
|
-
cells?: ContentCells;
|
|
37
|
-
/** Tiles each item spans (see `weightedLayout`); heavier items get featured tiles. */
|
|
38
|
-
weights?: readonly number[];
|
|
39
|
-
placement?: ContentPlacement;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A layout from options, worked out again only when they change (compared by value; a
|
|
43
|
-
* `cells` function by identity). Returns `layout` itself when given.
|
|
44
|
-
*/
|
|
45
|
-
declare function layoutResolver(component: string): (options: LayoutOptions | undefined, layout: Layout | undefined, fit?: LayoutNeeds) => Layout;
|
|
46
|
-
interface FrameOptions {
|
|
47
|
-
/** How many items there are to place (Infinity when every allowed cell gets content). */
|
|
48
|
-
count: number;
|
|
49
|
-
aspects?: readonly number[];
|
|
50
|
-
contentCells?: ContentCells;
|
|
51
|
-
placement?: ContentPlacement;
|
|
52
|
-
choose?: "placement" | "shape";
|
|
53
|
-
fill?: FillSource;
|
|
54
|
-
relief?: boolean | ReliefOptions;
|
|
55
|
-
animate?: boolean | {
|
|
56
|
-
duration?: number;
|
|
57
|
-
easing?: string;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/** Everything about a layout's tiles shared between them. */
|
|
61
|
-
interface Frame {
|
|
62
|
-
layout: Layout;
|
|
63
|
-
/** Item index per cell, or -1. */
|
|
64
|
-
slots: number[];
|
|
65
|
-
/** Empty-tile color per cell. */
|
|
66
|
-
fills: string[];
|
|
67
|
-
/** Bevel paths for a cell (worked out on first use), or undefined without relief. */
|
|
68
|
-
bevel(index: number): ReliefPath[] | undefined;
|
|
69
|
-
shadow?: {
|
|
70
|
-
dx: number;
|
|
71
|
-
dy: number;
|
|
72
|
-
blur: number;
|
|
73
|
-
opacity: number;
|
|
74
|
-
};
|
|
75
|
-
anim?: {
|
|
76
|
-
duration: number;
|
|
77
|
-
easing: string;
|
|
78
|
-
};
|
|
79
|
-
/** `left, top, width, height` transitions, when animating. */
|
|
80
|
-
boxTransition?: string;
|
|
81
|
-
tileTransition?: string;
|
|
82
|
-
}
|
|
83
|
-
/** Builds frames, reusing the slots, fills and bevels of the last one where nothing they depend on changed. */
|
|
84
|
-
declare function frameBuilder(): (layout: Layout, o: FrameOptions) => Frame;
|
|
85
|
-
/** Style of the element holding the layout. */
|
|
86
|
-
declare const containerStyle: (layout: Layout) => StyleMap;
|
|
87
|
-
/** Style of the element painting `background` across the region (seen through the gaps). */
|
|
88
|
-
declare const backgroundStyle: (frame: Frame, background: string) => StyleMap;
|
|
89
|
-
/**
|
|
90
|
-
* A tile's element: placed over its cell's bounding box and clipped to its shape. Empty
|
|
91
|
-
* tiles (and every tile with `safeArea`) show their fill unless there's a backdrop.
|
|
92
|
-
*/
|
|
93
|
-
declare function tileStyle(frame: Frame, cell: Cell, o: {
|
|
94
|
-
empty: boolean;
|
|
95
|
-
safeArea?: SafeAreaProp;
|
|
96
|
-
backdrop?: boolean;
|
|
97
|
-
clickable?: boolean;
|
|
98
|
-
focus?: Focus;
|
|
99
|
-
aspect?: number;
|
|
100
|
-
}): StyleMap;
|
|
101
|
-
/**
|
|
102
|
-
* The `--andamento-object-position` a tile sets for its content's focal point, which
|
|
103
|
-
* `coverStyle` uses as its `object-position`. Exact with the image's `aspect` (given, or the focus's own; see
|
|
104
|
-
* `objectPosition`); without, the focus as a percentage, which CSS keeps at the same place
|
|
105
|
-
* in the tile's box rather than in the middle of what shows.
|
|
106
|
-
*/
|
|
107
|
-
declare function focusStyle(frame: Frame, cell: Cell, focus: Focus, aspect?: number): StyleMap;
|
|
108
|
-
/** A backdrop copy inside a tile: behind its content, covering the whole layout. */
|
|
109
|
-
declare const backdropStyle: (frame: Frame, cell: Cell) => StyleMap;
|
|
110
|
-
/** The box holding a tile's content with `safeArea`. */
|
|
111
|
-
declare const safeBoxStyle: (frame: Frame, cell: Cell, aspect?: number, safe?: SafeAreaProp) => StyleMap;
|
|
112
|
-
/** Style of an <svg> drawn over a tile (bevel, focus ring), with `viewBox` set to `tileViewBox`. */
|
|
113
|
-
declare const overlayStyle: StyleMap;
|
|
114
|
-
declare const tileViewBox: (cell: Cell) => string;
|
|
115
|
-
/** The focus ring's two strokes: white under the color, so it shows on any content. */
|
|
116
|
-
declare const ringStrokes: (frame: Frame, cell: Cell, color: string) => {
|
|
117
|
-
d: string;
|
|
118
|
-
stroke: string;
|
|
119
|
-
width: number;
|
|
120
|
-
}[];
|
|
121
|
-
/** The shadow tiles cast into the grout (with relief's `shadow`), for an <svg> over the region. */
|
|
122
|
-
declare function shadowShape(frame: Frame, cells: readonly Cell[]): {
|
|
123
|
-
viewBox: string;
|
|
124
|
-
style: StyleMap;
|
|
125
|
-
blur: number;
|
|
126
|
-
d: string;
|
|
127
|
-
transform: string;
|
|
128
|
-
opacity: number;
|
|
129
|
-
} | undefined;
|
|
130
|
-
/**
|
|
131
|
-
* What a key does on a focused tile: move focus to another tile, activate it, or just stop
|
|
132
|
-
* the page scrolling (arrows at the edge). Undefined for keys that aren't ours.
|
|
133
|
-
*/
|
|
134
|
-
declare function keyAction(layout: Layout, from: Cell, key: string, accept: (cell: Cell) => boolean, canActivate: boolean): {
|
|
135
|
-
move: Cell;
|
|
136
|
-
} | {
|
|
137
|
-
activate: true;
|
|
138
|
-
} | {
|
|
139
|
-
prevent: true;
|
|
140
|
-
} | undefined;
|
|
141
|
-
/** Style sheet text for focus rings and animation (empty when neither is on). */
|
|
142
|
-
declare function tileSheet(o: {
|
|
143
|
-
focusRing: boolean;
|
|
144
|
-
anim?: {
|
|
145
|
-
duration: number;
|
|
146
|
-
easing: string;
|
|
147
|
-
};
|
|
148
|
-
}): string;
|
|
149
|
-
/** "Nothing in view": `view` before the layout has been measured, or when it's off screen. */
|
|
150
|
-
declare const NOTHING_IN_VIEW: Rect;
|
|
151
|
-
/**
|
|
152
|
-
* The part of the layout in view (in layout units), widened by `overscan` pixels and
|
|
153
|
-
* snapped outwards to a coarse grid so small scrolls give the same rectangle.
|
|
154
|
-
*/
|
|
155
|
-
declare function viewRect(el: Element, layout: Layout, overscan: number): Rect;
|
|
156
|
-
declare const sameRect: (a: Rect | undefined, b: Rect | undefined) => boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Call `measure` now and again (at most once a frame) whenever the page or any scrolling
|
|
159
|
-
* container scrolls, the window resizes or `el` does. Returns a function that stops it.
|
|
160
|
-
*/
|
|
161
|
-
declare function watchView(el: Element, measure: () => void): () => void;
|
|
162
|
-
/** Style that makes an <img> or <video> cover its tile, like `object-fit: cover`. */
|
|
163
|
-
declare const coverStyle: StyleMap;
|
|
4
|
+
import { S as SafeAreaProp, F as FitProp, C as CellState, P as PerCell, a as StyleMap } from './internal-NveCwJWd.cjs';
|
|
5
|
+
export { c as coverStyle } from './internal-NveCwJWd.cjs';
|
|
164
6
|
|
|
165
7
|
/** What can go in a tile: a DOM node, text, or nothing. */
|
|
166
8
|
type TileContent = Node | string | null | undefined;
|
|
@@ -397,4 +239,4 @@ declare function cellFromPointer(layout: Layout, event: PointerLike, options?: H
|
|
|
397
239
|
element?: Element;
|
|
398
240
|
}): Cell | undefined;
|
|
399
241
|
|
|
400
|
-
export { AndamentoLayoutElement, type CellActivateDetail,
|
|
242
|
+
export { AndamentoLayoutElement, type CellActivateDetail, CellState, FitProp, PerCell, type PointerLike, SafeAreaProp, StyleMap, type TileContent, type TileLayoutConfig, type TileLayoutHandle, cellFromPointer, defineTileLayoutElement, mountTileLayout };
|