@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/index.cjs CHANGED
@@ -1,298 +1,36 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __typeError = (msg) => {
7
- throw TypeError(msg);
8
- };
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
23
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
24
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
25
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
26
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
27
16
 
28
- // src/index.ts
29
- var index_exports = {};
30
- __export(index_exports, {
31
- AndamentoLayoutElement: () => AndamentoLayoutElement,
32
- MORPH_POINTS: () => MORPH_POINTS,
33
- NOTHING_IN_VIEW: () => NOTHING_IN_VIEW,
34
- backdropStyle: () => backdropStyle,
35
- backgroundStyle: () => backgroundStyle,
36
- cellFromPointer: () => cellFromPointer,
37
- containerStyle: () => containerStyle,
38
- coverStyle: () => coverStyle,
39
- defaultPalette: () => import_svg2.defaultPalette,
40
- defineTileLayoutElement: () => defineTileLayoutElement,
41
- focusStyle: () => focusStyle,
42
- frameBuilder: () => frameBuilder,
43
- keyAction: () => keyAction,
44
- layoutResolver: () => layoutResolver,
45
- mountTileLayout: () => mountTileLayout,
46
- neutralPalette: () => import_svg2.neutralPalette,
47
- overlayStyle: () => overlayStyle,
48
- resolvePerCell: () => resolvePerCell,
49
- ringStrokes: () => ringStrokes,
50
- safeBoxStyle: () => safeBoxStyle,
51
- sameRect: () => sameRect,
52
- shadowShape: () => shadowShape,
53
- tileSheet: () => tileSheet,
54
- tileStyle: () => tileStyle,
55
- tileViewBox: () => tileViewBox,
56
- viewRect: () => viewRect,
57
- watchView: () => watchView
58
- });
59
- module.exports = __toCommonJS(index_exports);
60
17
 
61
- // src/mount.ts
62
- var import_core2 = require("@andamento/core");
63
-
64
- // src/model.ts
65
- var import_core = require("@andamento/core");
66
- var import_svg = require("@andamento/svg");
67
- var resolvePerCell = (v, cell, state) => typeof v === "function" ? v(cell, state) : v;
68
- var MORPH_POINTS = 72;
69
- var PLACEHOLDER = { region: { x: 0, y: 0, width: 1, height: 1 }, tiling: { type: "grid", width: 1 } };
70
- function layoutResolver(component) {
71
- let lastKey, lastCells, last;
72
- return (options, layout, fit) => {
73
- if (layout) return layout;
74
- if (!options) throw new Error(`${component} needs either \`options\` or \`layout\``);
75
- const fitting = !!fit?.fit && fit.count >= 1 && Number.isFinite(fit.count);
76
- const mode = fit?.fit === "nearest" ? "nearest" : "atLeast";
77
- const count = fit && Number.isFinite(fit.count) ? fit.count : 0;
78
- const weights = fit?.weights?.some((w) => w > 1) && count > 0 ? Array.from({ length: count }, (_, i) => fit.weights[i] ?? 1) : void 0;
79
- const cells = fitting || weights ? fit.cells : void 0;
80
- const key = JSON.stringify([options, fitting && fit.count, mode, weights, weights && fit.placement]);
81
- if (last && key === lastKey && cells === lastCells) return last;
82
- last = weights ? (0, import_core.weightedLayout)(options, weights, { fit: fitting && mode, cells, placement: fit.placement }).layout : fitting ? (0, import_core.fitCount)(options, fit.count, { cells, mode }).layout : (0, import_core.createLayout)(options ?? PLACEHOLDER);
83
- lastKey = key;
84
- lastCells = cells;
85
- return last;
86
- };
87
- }
88
- function frameBuilder() {
89
- let slotKey = "", slotLayout, slotCells, slots = [];
90
- let fillLayout, fillSource, fills = [];
91
- let bevelKey = "", bevelLayout, bevels = /* @__PURE__ */ new Map();
92
- return (layout, o) => {
93
- const key = JSON.stringify([o.count === Infinity ? -1 : o.count, o.aspects, o.placement, o.choose, typeof o.contentCells === "function" ? 0 : o.contentCells]);
94
- if (layout !== slotLayout || key !== slotKey || o.contentCells !== slotCells) {
95
- slots = o.aspects && o.count !== Infinity ? (0, import_core.matchSlots)(layout, Array.from({ length: o.count }, (_, i) => o.aspects[i] ?? 1), { cells: o.contentCells, placement: o.placement, choose: o.choose }) : (0, import_core.contentSlots)(layout, o.count, { cells: o.contentCells, placement: o.placement });
96
- slotLayout = layout;
97
- slotKey = key;
98
- slotCells = o.contentCells;
99
- }
100
- const fill = o.fill ?? import_svg.neutralPalette;
101
- if (layout !== fillLayout || fill !== fillSource) {
102
- fills = (0, import_svg.resolveFills)(layout, fill);
103
- fillLayout = layout;
104
- fillSource = fill;
105
- }
106
- const relief = o.relief === true ? {} : o.relief || void 0;
107
- const rk = relief ? JSON.stringify(relief) : "";
108
- if (layout !== bevelLayout || rk !== bevelKey) {
109
- bevels = /* @__PURE__ */ new Map();
110
- bevelLayout = layout;
111
- bevelKey = rk;
112
- }
113
- const width = relief ? relief.bevel ?? (0, import_svg.defaultBevel)(layout) : 0;
114
- const cache = bevels;
115
- const anim = o.animate ? {
116
- duration: (typeof o.animate === "object" ? o.animate.duration : void 0) ?? 400,
117
- easing: (typeof o.animate === "object" ? o.animate.easing : void 0) ?? "cubic-bezier(0.2, 0.8, 0.2, 1)"
118
- } : void 0;
119
- const timing = anim ? `${anim.duration}ms ${anim.easing}` : "";
120
- const boxTransition = anim ? ["left", "top", "width", "height"].map((p) => `${p} ${timing}`).join(", ") : void 0;
121
- return {
122
- layout,
123
- slots,
124
- fills,
125
- bevel(i) {
126
- if (!relief || width <= 0) return void 0;
127
- let b = cache.get(i);
128
- if (!b) cache.set(i, b = (0, import_svg.reliefPaths)(layout, layout.cells[i], relief, width));
129
- return b;
130
- },
131
- shadow: relief ? (0, import_svg.shadowOffset)(relief) : void 0,
132
- anim,
133
- boxTransition,
134
- tileTransition: anim ? `${boxTransition}, clip-path ${timing}, background-color ${timing}` : void 0
135
- };
136
- };
137
- }
138
- var containerStyle = (layout) => ({
139
- position: "relative",
140
- width: "100%",
141
- aspectRatio: `${layout.bounds.width} / ${layout.bounds.height}`
142
- });
143
- var backgroundStyle = (frame, background) => ({
144
- position: "absolute",
145
- inset: "0",
146
- background,
147
- clipPath: (0, import_core.regionCss)(frame.layout),
148
- transition: frame.anim ? `clip-path ${frame.anim.duration}ms ${frame.anim.easing}` : void 0
149
- });
150
- function tileStyle(frame, cell, o) {
151
- return {
152
- ...o.focus && !o.empty ? focusStyle(frame, cell, o.focus, o.aspect) : {},
153
- position: "absolute",
154
- boxSizing: "border-box",
155
- overflow: "hidden",
156
- ...(0, import_core.cellCss)(cell, frame.layout, 4, frame.anim ? { points: MORPH_POINTS } : {}),
157
- transition: frame.tileTransition,
158
- background: (o.empty || o.safeArea) && !o.backdrop ? frame.fills[cell.index] : void 0,
159
- cursor: o.clickable ? "pointer" : void 0
160
- };
161
- }
162
- function focusStyle(frame, cell, focus, aspect) {
163
- const shape = aspect ?? focus.aspect;
164
- const pos = shape && shape > 0 ? (0, import_core.objectPosition)(cell, frame.layout, { aspect: shape, focus }) : `${focus.x * 100}% ${focus.y * 100}%`;
165
- return { "--andamento-object-position": pos };
166
- }
167
- var backdropStyle = (frame, cell) => ({
168
- position: "absolute",
169
- zIndex: -1,
170
- pointerEvents: "none",
171
- ...(0, import_core.backdropCss)(cell, frame.layout),
172
- transition: frame.boxTransition
173
- });
174
- var safeBoxStyle = (frame, cell, aspect, safe) => ({
175
- position: "absolute",
176
- boxSizing: "border-box",
177
- ...(0, import_core.safeAreaCss)(cell, frame.layout, { aspect, within: safe === "visible" ? "visible" : "tile" }),
178
- transition: frame.boxTransition
179
- });
180
- var overlayStyle = { position: "absolute", inset: "0", width: "100%", height: "100%", pointerEvents: "none" };
181
- var tileViewBox = (cell) => {
182
- const b = (0, import_core.cellShape)(cell).bbox;
183
- return `${b.x} ${b.y} ${b.width} ${b.height}`;
184
- };
185
- var ringStrokes = (frame, cell, color) => {
186
- const d = (0, import_svg.cellPath)(frame.layout, cell);
187
- return [
188
- { d, stroke: "#fff", width: 8 },
189
- { d, stroke: color, width: 4 }
190
- ];
191
- };
192
- function shadowShape(frame, cells) {
193
- const s = frame.shadow;
194
- if (!s) return void 0;
195
- const { bounds } = frame.layout;
196
- return {
197
- viewBox: `${bounds.x} ${bounds.y} ${bounds.width} ${bounds.height}`,
198
- style: { ...overlayStyle, clipPath: (0, import_core.viewCss)(frame.layout) },
199
- blur: s.blur,
200
- d: cells.map((c) => (0, import_svg.cellPath)(frame.layout, c)).join(""),
201
- transform: `translate(${s.dx} ${s.dy})`,
202
- opacity: s.opacity
203
- };
204
- }
205
- function keyAction(layout, from, key, accept, canActivate) {
206
- const dirs = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right" };
207
- let to;
208
- if (dirs[key]) to = (0, import_core.cellInDirection)(layout, from, dirs[key], accept);
209
- else if (key === "Home") to = layout.cells.find(accept);
210
- else if (key === "End") to = [...layout.cells].reverse().find(accept);
211
- else if ((key === "Enter" || key === " ") && canActivate) return { activate: true };
212
- if (to) return { move: to };
213
- return key.startsWith("Arrow") ? { prevent: true } : void 0;
214
- }
215
- function tileSheet(o) {
216
- let css = "";
217
- if (o.focusRing)
218
- css += "[data-andamento]>[data-cell-id]:focus{outline:none}[data-andamento]>[data-cell-id]>[data-focus-ring]{display:none}[data-andamento]>[data-cell-id]:focus-visible>[data-focus-ring]{display:block}";
219
- if (o.anim) {
220
- const { duration, easing } = o.anim;
221
- css += `@keyframes andamento-enter{from{opacity:0;transform:scale(.85)}}@keyframes andamento-exit{to{opacity:0;transform:scale(.85)}}@keyframes andamento-late{0%,70%{opacity:0}to{opacity:1}}[data-andamento]>[data-entering]{animation:andamento-enter ${duration}ms ${easing} backwards}[data-andamento]>[data-exiting]{animation:andamento-exit ${duration}ms ${easing} forwards;pointer-events:none}[data-andamento]>[data-cell-id]>[data-late]{animation:andamento-late ${duration}ms linear backwards}@media (prefers-reduced-motion:reduce){[data-andamento]>[data-cell-id],[data-andamento]>[data-cell-id] *{transition:none!important;animation:none!important}[data-andamento]>[data-exiting]{display:none}}`;
222
- }
223
- return css;
224
- }
225
- var NOTHING_IN_VIEW = { x: 0, y: 0, width: -1, height: -1 };
226
- function viewRect(el, layout, overscan) {
227
- const box = el.getBoundingClientRect();
228
- const seen = visibleClientRect(el, box);
229
- const { bounds } = layout;
230
- const scale = Math.min(box.width / (bounds.width || 1), box.height / (bounds.height || 1));
231
- if (!seen || !(scale > 0)) return NOTHING_IN_VIEW;
232
- const a = (0, import_core.screenToLayout)(layout, box, seen.left - overscan, seen.top - overscan);
233
- const b = (0, import_core.screenToLayout)(layout, box, seen.right + overscan, seen.bottom + overscan);
234
- const q = Math.max(overscan / 2, 50) / scale;
235
- const x0 = Math.floor(a.x / q) * q, y0 = Math.floor(a.y / q) * q;
236
- return { x: x0, y: y0, width: Math.ceil(b.x / q) * q - x0, height: Math.ceil(b.y / q) * q - y0 };
237
- }
238
- var sameRect = (a, b) => !!a && !!b && a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
239
- function watchView(el, measure) {
240
- const raf = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (f) => setTimeout(f, 16);
241
- const cancel = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : (h) => clearTimeout(h);
242
- let frame = 0;
243
- const run = () => {
244
- frame = 0;
245
- measure();
246
- };
247
- const schedule = () => {
248
- if (!frame) frame = raf(run);
249
- };
250
- measure();
251
- window.addEventListener("scroll", schedule, { capture: true, passive: true });
252
- window.addEventListener("resize", schedule);
253
- const observer = typeof ResizeObserver === "function" ? new ResizeObserver(schedule) : void 0;
254
- observer?.observe(el);
255
- return () => {
256
- if (frame) cancel(frame);
257
- window.removeEventListener("scroll", schedule, { capture: true });
258
- window.removeEventListener("resize", schedule);
259
- observer?.disconnect();
260
- };
261
- }
262
- function visibleClientRect(el, box) {
263
- let left = Math.max(box.left, 0);
264
- let top = Math.max(box.top, 0);
265
- let right = Math.min(box.right, window.innerWidth || document.documentElement.clientWidth);
266
- let bottom = Math.min(box.bottom, window.innerHeight || document.documentElement.clientHeight);
267
- const parent = (n) => n.parentElement ?? (n.parentNode?.host ?? null);
268
- for (let p = parent(el); p && p !== document.body && p !== document.documentElement; p = parent(p)) {
269
- const s = getComputedStyle(p);
270
- if (/(auto|scroll|hidden|clip)/.test(`${s.overflow} ${s.overflowX} ${s.overflowY}`)) {
271
- const r = p.getBoundingClientRect();
272
- left = Math.max(left, r.left);
273
- top = Math.max(top, r.top);
274
- right = Math.min(right, r.right);
275
- bottom = Math.min(bottom, r.bottom);
276
- }
277
- }
278
- return right > left && bottom > top ? { left, top, right, bottom } : void 0;
279
- }
280
- var coverStyle = {
281
- display: "block",
282
- width: "100%",
283
- height: "100%",
284
- objectFit: "cover",
285
- // Set by the tile from the item's focal point (see `focalPoints`); centerd otherwise.
286
- objectPosition: "var(--andamento-object-position, 50% 50%)"
287
- };
18
+
19
+
20
+
21
+
22
+
23
+
24
+ var _chunk276TFSAGcjs = require('./chunk-276TFSAG.cjs');
288
25
 
289
26
  // src/mount.ts
27
+ var _core = require('@andamento/core');
290
28
  var SVG = "http://www.w3.org/2000/svg";
291
29
  var kebab = (k) => k.startsWith("--") ? k : k.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
292
30
  var isEmpty = (c) => c == null || c === "";
293
31
  var styleMemo = /* @__PURE__ */ new WeakMap();
294
32
  function applyStyle(el, next) {
295
- const prev = styleMemo.get(el) ?? {};
33
+ const prev = _nullishCoalesce(styleMemo.get(el), () => ( {}));
296
34
  for (const k of Object.keys(prev)) if (next[k] === void 0 && prev[k] !== void 0) el.style.removeProperty(kebab(k));
297
35
  for (const [k, v] of Object.entries(next)) if (v !== void 0 && prev[k] !== v) el.style.setProperty(kebab(k), String(v));
298
36
  styleMemo.set(el, next);
@@ -334,8 +72,8 @@ var uidCount = 0;
334
72
  function mountTileLayout(target, initial) {
335
73
  let config = { ...initial };
336
74
  const uid = `andamento-dom${++uidCount}`;
337
- const resolveLayout = layoutResolver("mountTileLayout");
338
- const buildFrame = frameBuilder();
75
+ const resolveLayout = _chunk276TFSAGcjs.layoutResolver.call(void 0, "mountTileLayout");
76
+ const buildFrame = _chunk276TFSAGcjs.frameBuilder.call(void 0, );
339
77
  const container = document.createElement("div");
340
78
  container.setAttribute("data-andamento", "");
341
79
  target.appendChild(container);
@@ -365,7 +103,7 @@ function mountTileLayout(target, initial) {
365
103
  function render() {
366
104
  if (destroyed) return;
367
105
  const c = config;
368
- const items = c.renderCell ? [] : c.items ?? [];
106
+ const items = c.renderCell ? [] : _nullishCoalesce(c.items, () => ( []));
369
107
  layout = resolveLayout(c.options, c.layout, {
370
108
  fit: !c.renderCell && c.fit,
371
109
  count: items.length,
@@ -385,7 +123,7 @@ function mountTileLayout(target, initial) {
385
123
  });
386
124
  const { slots } = frame;
387
125
  const focusRing = c.focusRing === void 0 ? "#1a56db" : c.focusRing;
388
- const list = (c.role ?? "list") === "list";
126
+ const list = (_nullishCoalesce(c.role, () => ( "list"))) === "list";
389
127
  const virtual = !!c.virtualize;
390
128
  const keyOf = (i) => {
391
129
  const slot = slots[i];
@@ -397,12 +135,12 @@ function mountTileLayout(target, initial) {
397
135
  };
398
136
  const hasContent = (i) => c.renderCell ? slots[i] >= 0 : slots[i] >= 0 && !isEmpty(items[slots[i]]);
399
137
  focusable = new Set(c.navigable ? layout.cells.filter((cell) => hasContent(cell.index)).map((cell) => cell.id) : []);
400
- const firstFocusable = layout.cells.find((cell) => focusable.has(cell.id))?.id;
138
+ const firstFocusable = _optionalChain([layout, 'access', _2 => _2.cells, 'access', _3 => _3.find, 'call', _4 => _4((cell) => focusable.has(cell.id)), 'optionalAccess', _5 => _5.id]);
401
139
  const active = activeId !== void 0 && focusable.has(activeId) ? activeId : firstFocusable;
402
140
  let shown;
403
141
  if (!virtual) shown = layout.cells.map((_, i) => i);
404
142
  else {
405
- const s = new Set(view && view.width >= 0 ? (0, import_core2.cellsInRect)(layout, view).map((cell) => cell.index) : []);
143
+ const s = new Set(view && view.width >= 0 ? _core.cellsInRect.call(void 0, layout, view).map((cell) => cell.index) : []);
406
144
  const a = active !== void 0 ? layout.cells.find((cell) => cell.id === active) : void 0;
407
145
  if (a) s.add(a.index);
408
146
  shown = [...s].sort((x, y) => x - y);
@@ -421,7 +159,7 @@ function mountTileLayout(target, initial) {
421
159
  let content = c.renderCell ? c.renderCell(cell, { slot }) : slot >= 0 ? items[slot] : void 0;
422
160
  const empty = isEmpty(content);
423
161
  const state = { empty, slot: empty && !c.renderCell ? -1 : slot };
424
- if (empty) content = resolvePerCell(c.fallback, cell, state);
162
+ if (empty) content = _chunk276TFSAGcjs.resolvePerCell.call(void 0, c.fallback, cell, state);
425
163
  const silent = empty && isEmpty(content);
426
164
  let tile = tiles.get(key);
427
165
  if (!tile || tile.leaving) {
@@ -437,26 +175,29 @@ function mountTileLayout(target, initial) {
437
175
  const canFocus = focusable.has(cell.id);
438
176
  attr(el, "role", silent ? void 0 : list ? "listitem" : void 0);
439
177
  attr(el, "aria-hidden", silent ? "true" : void 0);
440
- attr(el, "aria-label", silent ? void 0 : resolvePerCell(c.cellLabel, cell, state));
178
+ attr(el, "aria-label", silent ? void 0 : _chunk276TFSAGcjs.resolvePerCell.call(void 0, c.cellLabel, cell, state));
441
179
  attr(el, "aria-setsize", positions && list && !silent ? positions.size : void 0);
442
180
  attr(el, "aria-posinset", positions && list && !silent ? positions.get(i) : void 0);
443
181
  attr(el, "tabindex", canFocus ? cell.id === active ? 0 : -1 : void 0);
444
- attr(el, "class", resolvePerCell(c.cellClass, cell, state) || void 0);
182
+ attr(el, "class", _chunk276TFSAGcjs.resolvePerCell.call(void 0, c.cellClass, cell, state) || void 0);
445
183
  attr(el, "data-cell-id", cell.id);
446
184
  attr(el, "data-index", cell.index);
447
185
  attr(el, "data-empty", empty);
448
186
  attr(el, "data-boundary", !!cell.boundary);
449
- for (const [k, v] of Object.entries(resolvePerCell(c.cellAttributes, cell, state) ?? {})) attr(el, k, v);
187
+ const extra = _nullishCoalesce(_chunk276TFSAGcjs.resolvePerCell.call(void 0, c.cellAttributes, cell, state), () => ( {}));
188
+ for (const k of _nullishCoalesce(tile.extra, () => ( []))) if (!(k in extra)) attr(el, k, void 0);
189
+ for (const [k, v] of Object.entries(extra)) attr(el, k, v);
190
+ tile.extra = Object.keys(extra);
450
191
  applyStyle(el, {
451
- ...tileStyle(frame, cell, {
192
+ ..._chunk276TFSAGcjs.tileStyle.call(void 0, frame, cell, {
452
193
  empty,
453
194
  safeArea: c.safeArea,
454
195
  backdrop: c.backdrop != null,
455
196
  clickable: !!c.onCellActivate && !empty,
456
- focus: slot >= 0 ? c.focalPoints?.[slot] : void 0,
457
- aspect: slot >= 0 ? c.aspects?.[slot] : void 0
197
+ focus: slot >= 0 ? _optionalChain([c, 'access', _6 => _6.focalPoints, 'optionalAccess', _7 => _7[slot]]) : void 0,
198
+ aspect: slot >= 0 ? _optionalChain([c, 'access', _8 => _8.aspects, 'optionalAccess', _9 => _9[slot]]) : void 0
458
199
  }),
459
- ...resolvePerCell(c.cellStyle, cell, state)
200
+ ..._chunk276TFSAGcjs.resolvePerCell.call(void 0, c.cellStyle, cell, state)
460
201
  });
461
202
  const kids = [];
462
203
  if (c.backdrop != null) {
@@ -467,7 +208,7 @@ function mountTileLayout(target, initial) {
467
208
  wrap.appendChild(node2);
468
209
  tile.backdrop = { source: c.backdrop, node: wrap };
469
210
  }
470
- applyStyle(tile.backdrop.node, backdropStyle(frame, cell));
211
+ applyStyle(tile.backdrop.node, _chunk276TFSAGcjs.backdropStyle.call(void 0, frame, cell));
471
212
  kids.push(tile.backdrop.node);
472
213
  } else tile.backdrop = void 0;
473
214
  let node;
@@ -481,60 +222,60 @@ function mountTileLayout(target, initial) {
481
222
  tile.safe = document.createElement("div");
482
223
  tile.safe.setAttribute("data-safe-area", "");
483
224
  }
484
- const aspect = !c.renderCell && !empty && c.aspects ? c.aspects[slot] ?? 1 : void 0;
485
- applyStyle(tile.safe, safeBoxStyle(frame, cell, aspect, c.safeArea));
225
+ const aspect = !c.renderCell && !empty && c.aspects ? _nullishCoalesce(c.aspects[slot], () => ( 1)) : void 0;
226
+ applyStyle(tile.safe, _chunk276TFSAGcjs.safeBoxStyle.call(void 0, frame, cell, aspect, c.safeArea));
486
227
  setChildren(tile.safe, [node]);
487
228
  kids.push(tile.safe);
488
229
  } else if (node) kids.push(node);
489
230
  const bevel = frame.bevel(i);
490
231
  if (bevel && bevel.length) {
491
232
  const clip = frame.anim ? String(el.style.getPropertyValue("clip-path")) : "";
492
- const bk = tileViewBox(cell) + clip + bevel.map((p) => p.d + p.fill + p.opacity).join();
493
- if (tile.bevel?.key !== bk) {
233
+ const bk = _chunk276TFSAGcjs.tileViewBox.call(void 0, cell) + clip + bevel.map((p) => p.d + p.fill + p.opacity).join();
234
+ if (_optionalChain([tile, 'access', _10 => _10.bevel, 'optionalAccess', _11 => _11.key]) !== bk) {
494
235
  const s = svg(
495
236
  "svg",
496
- { "aria-hidden": "true", "data-bevel": "", "data-late": frame.anim ? "" : void 0, viewBox: tileViewBox(cell), preserveAspectRatio: "none" },
237
+ { "aria-hidden": "true", "data-bevel": "", "data-late": frame.anim ? "" : void 0, viewBox: _chunk276TFSAGcjs.tileViewBox.call(void 0, cell), preserveAspectRatio: "none" },
497
238
  bevel.map((p) => svg("path", { d: p.d, fill: p.fill, "fill-opacity": p.opacity }))
498
239
  );
499
- applyStyle(s, overlayStyle);
240
+ applyStyle(s, _chunk276TFSAGcjs.overlayStyle);
500
241
  tile.bevel = { key: bk, node: s };
501
242
  }
502
243
  kids.push(tile.bevel.node);
503
244
  } else tile.bevel = void 0;
504
245
  if (canFocus && focusRing !== false) {
505
- const strokes = ringStrokes(frame, cell, focusRing);
506
- const rk = tileViewBox(cell) + strokes[0].d + focusRing;
507
- if (tile.ring?.key !== rk) {
246
+ const strokes = _chunk276TFSAGcjs.ringStrokes.call(void 0, frame, cell, focusRing);
247
+ const rk = _chunk276TFSAGcjs.tileViewBox.call(void 0, cell) + strokes[0].d + focusRing;
248
+ if (_optionalChain([tile, 'access', _12 => _12.ring, 'optionalAccess', _13 => _13.key]) !== rk) {
508
249
  const s = svg(
509
250
  "svg",
510
- { "aria-hidden": "true", "data-focus-ring": "", viewBox: tileViewBox(cell), preserveAspectRatio: "none" },
251
+ { "aria-hidden": "true", "data-focus-ring": "", viewBox: _chunk276TFSAGcjs.tileViewBox.call(void 0, cell), preserveAspectRatio: "none" },
511
252
  strokes.map((p) => svg("path", { d: p.d, fill: "none", stroke: p.stroke, "stroke-width": p.width, "vector-effect": "non-scaling-stroke" }))
512
253
  );
513
- applyStyle(s, overlayStyle);
254
+ applyStyle(s, _chunk276TFSAGcjs.overlayStyle);
514
255
  tile.ring = { key: rk, node: s };
515
256
  }
516
257
  kids.push(tile.ring.node);
517
258
  } else tile.ring = void 0;
518
259
  setChildren(el, kids);
519
260
  }
520
- const present = allKeys ?? new Set(next.keys());
261
+ const present = _nullishCoalesce(allKeys, () => ( new Set(next.keys())));
521
262
  for (const tile of tiles.values()) {
522
263
  if (frame.anim && mounted && !present.has(tile.key)) startLeaving(tile, frame.anim.duration);
523
264
  }
524
265
  tiles = next;
525
- attr(container, "role", c.role ?? "list");
266
+ attr(container, "role", _nullishCoalesce(c.role, () => ( "list")));
526
267
  attr(container, "aria-label", c.label);
527
268
  attr(container, "class", c.className);
528
- applyStyle(container, containerStyle(layout));
529
- const css = tileSheet({ focusRing: !!c.navigable && focusRing !== false, anim: frame.anim });
269
+ applyStyle(container, _chunk276TFSAGcjs.containerStyle.call(void 0, layout));
270
+ const css = _chunk276TFSAGcjs.tileSheet.call(void 0, { focusRing: !!c.navigable && focusRing !== false, anim: frame.anim });
530
271
  if (sheet.textContent !== css) sheet.textContent = css;
531
272
  const top = [];
532
273
  if (css) top.push(sheet);
533
274
  if (c.background) {
534
- applyStyle(backgroundEl, backgroundStyle(frame, c.background));
275
+ applyStyle(backgroundEl, _chunk276TFSAGcjs.backgroundStyle.call(void 0, frame, c.background));
535
276
  top.push(backgroundEl);
536
277
  }
537
- const shadow = shadowShape(frame, shown.map((i) => layout.cells[i]));
278
+ const shadow = _chunk276TFSAGcjs.shadowShape.call(void 0, frame, shown.map((i) => layout.cells[i]));
538
279
  if (shadow) {
539
280
  attr(shadowEl, "viewBox", shadow.viewBox);
540
281
  applyStyle(shadowEl, shadow.style);
@@ -554,8 +295,11 @@ function mountTileLayout(target, initial) {
554
295
  t.el.focus();
555
296
  }
556
297
  }
557
- if (virtual && !stopWatching) stopWatching = watchView(container, measure);
558
- else if (!virtual && stopWatching) {
298
+ if (virtual && !stopWatching) {
299
+ let stop;
300
+ stopWatching = () => _optionalChain([stop, 'optionalCall', _14 => _14()]);
301
+ stop = _chunk276TFSAGcjs.watchView.call(void 0, container, measure);
302
+ } else if (!virtual && stopWatching) {
559
303
  stopWatching();
560
304
  stopWatching = void 0;
561
305
  view = void 0;
@@ -564,9 +308,9 @@ function mountTileLayout(target, initial) {
564
308
  }
565
309
  function measure() {
566
310
  if (destroyed || !config.virtualize) return;
567
- const overscan = Math.max(0, (typeof config.virtualize === "object" ? config.virtualize.overscan : void 0) ?? 300);
568
- const next = viewRect(container, layout, overscan);
569
- if (!sameRect(next, view)) {
311
+ const overscan = Math.max(0, _nullishCoalesce((typeof config.virtualize === "object" ? config.virtualize.overscan : void 0), () => ( 300)));
312
+ const next = _chunk276TFSAGcjs.viewRect.call(void 0, container, layout, overscan);
313
+ if (!_chunk276TFSAGcjs.sameRect.call(void 0, next, view)) {
570
314
  view = next;
571
315
  render();
572
316
  }
@@ -612,7 +356,7 @@ function mountTileLayout(target, initial) {
612
356
  if (e.defaultPrevented || !config.navigable || e.altKey || e.ctrlKey || e.metaKey) return;
613
357
  const t = tileOf(e);
614
358
  if (!t || e.target !== t.el || !focusable.has(t.cell.id)) return;
615
- const action = keyAction(layout, t.cell, e.key, (cell) => focusable.has(cell.id), !!config.onCellActivate);
359
+ const action = _chunk276TFSAGcjs.keyAction.call(void 0, layout, t.cell, e.key, (cell) => focusable.has(cell.id), !!config.onCellActivate);
616
360
  if (!action) return;
617
361
  e.preventDefault();
618
362
  if ("activate" in action) config.onCellActivate(t.cell, t.state);
@@ -647,7 +391,7 @@ function mountTileLayout(target, initial) {
647
391
  },
648
392
  destroy() {
649
393
  destroyed = true;
650
- stopWatching?.();
394
+ _optionalChain([stopWatching, 'optionalCall', _15 => _15()]);
651
395
  timers.forEach(clearTimeout);
652
396
  container.removeEventListener("click", onClick);
653
397
  container.removeEventListener("focusin", onFocusIn);
@@ -669,7 +413,7 @@ var ATTRIBUTES = [...BOOLEAN, "options", "fit", "placement", "content-cells", "c
669
413
  var json = (v) => {
670
414
  try {
671
415
  return JSON.parse(v);
672
- } catch {
416
+ } catch (e2) {
673
417
  throw new SyntaxError(`<andamento-layout>: not valid JSON: ${v}`);
674
418
  }
675
419
  };
@@ -678,15 +422,15 @@ var _config, _props, _handle, _observer, _queued, _slots, _items, _backdrop, _An
678
422
  var AndamentoLayoutElement = class extends Base {
679
423
  constructor() {
680
424
  super();
681
- __privateAdd(this, _AndamentoLayoutElement_instances);
682
- __privateAdd(this, _config, {});
683
- __privateAdd(this, _props, {});
684
- __privateAdd(this, _handle);
685
- __privateAdd(this, _observer);
686
- __privateAdd(this, _queued, false);
687
- __privateAdd(this, _slots, /* @__PURE__ */ new WeakMap());
688
- __privateAdd(this, _items, []);
689
- __privateAdd(this, _backdrop);
425
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _AndamentoLayoutElement_instances);
426
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _config, {});
427
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _props, {});
428
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _handle);
429
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _observer);
430
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _queued, false);
431
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _slots, /* @__PURE__ */ new WeakMap());
432
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _items, []);
433
+ _chunk276TFSAGcjs.__privateAdd.call(void 0, this, _backdrop);
690
434
  const root = this.attachShadow({ mode: "open" });
691
435
  const style = document.createElement("style");
692
436
  style.textContent = ":host{display:block}:host([hidden]){display:none}";
@@ -694,157 +438,157 @@ var AndamentoLayoutElement = class extends Base {
694
438
  }
695
439
  /** Layout options (also the `options` attribute, as JSON). */
696
440
  get options() {
697
- return __privateGet(this, _props).options;
441
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).options;
698
442
  }
699
443
  set options(v) {
700
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { options: v });
444
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { options: v });
701
445
  }
702
446
  /** A precomputed layout, instead of `options`. */
703
447
  get layout() {
704
- return __privateGet(this, _handle)?.layout ?? __privateGet(this, _props).layout;
448
+ return _nullishCoalesce(_optionalChain([_chunk276TFSAGcjs.__privateGet.call(void 0, this, _handle), 'optionalAccess', _16 => _16.layout]), () => ( _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).layout));
705
449
  }
706
450
  set layout(v) {
707
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { layout: v });
451
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { layout: v });
708
452
  }
709
453
  /** Color of empty tiles: a color, a palette or a function per cell. */
710
454
  get fill() {
711
- return __privateGet(this, _props).fill;
455
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).fill;
712
456
  }
713
457
  set fill(v) {
714
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { fill: v });
458
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { fill: v });
715
459
  }
716
460
  get relief() {
717
- return __privateGet(this, _props).relief;
461
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).relief;
718
462
  }
719
463
  set relief(v) {
720
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { relief: v });
464
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { relief: v });
721
465
  }
722
466
  /** Animate changes (the `animate` attribute; `animate` itself is the Web Animations method). */
723
467
  get animated() {
724
- return __privateGet(this, _props).animate;
468
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).animate;
725
469
  }
726
470
  set animated(v) {
727
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { animate: v });
471
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { animate: v });
728
472
  }
729
473
  get virtualize() {
730
- return __privateGet(this, _props).virtualize;
474
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).virtualize;
731
475
  }
732
476
  set virtualize(v) {
733
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { virtualize: v });
477
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { virtualize: v });
734
478
  }
735
479
  get navigable() {
736
- return __privateGet(this, _props).navigable;
480
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).navigable;
737
481
  }
738
482
  set navigable(v) {
739
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { navigable: v });
483
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { navigable: v });
740
484
  }
741
485
  get safeArea() {
742
- return __privateGet(this, _props).safeArea;
486
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).safeArea;
743
487
  }
744
488
  set safeArea(v) {
745
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { safeArea: v });
489
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { safeArea: v });
746
490
  }
747
491
  get fit() {
748
- return __privateGet(this, _props).fit;
492
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).fit;
749
493
  }
750
494
  set fit(v) {
751
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { fit: v });
495
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { fit: v });
752
496
  }
753
497
  get placement() {
754
- return __privateGet(this, _props).placement;
498
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).placement;
755
499
  }
756
500
  set placement(v) {
757
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { placement: v });
501
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { placement: v });
758
502
  }
759
503
  get contentCells() {
760
- return __privateGet(this, _props).contentCells;
504
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).contentCells;
761
505
  }
762
506
  set contentCells(v) {
763
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { contentCells: v });
507
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { contentCells: v });
764
508
  }
765
509
  get choose() {
766
- return __privateGet(this, _props).choose;
510
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).choose;
767
511
  }
768
512
  set choose(v) {
769
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { choose: v });
513
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { choose: v });
770
514
  }
771
515
  /** Width / height of each child; otherwise read from children's `data-aspect`. */
772
516
  get aspects() {
773
- return __privateGet(this, _props).aspects;
517
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).aspects;
774
518
  }
775
519
  set aspects(v) {
776
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { aspects: v });
520
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { aspects: v });
777
521
  }
778
522
  /** Tiles each child spans; otherwise read from children's `data-weight`. */
779
523
  get weights() {
780
- return __privateGet(this, _props).weights;
524
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).weights;
781
525
  }
782
526
  set weights(v) {
783
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { weights: v });
527
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { weights: v });
784
528
  }
785
529
  /** Focal point of each child; otherwise read from children's `data-focus`. */
786
530
  get focalPoints() {
787
- return __privateGet(this, _props).focalPoints;
531
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).focalPoints;
788
532
  }
789
533
  set focalPoints(v) {
790
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { focalPoints: v });
534
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { focalPoints: v });
791
535
  }
792
536
  get background() {
793
- return __privateGet(this, _props).background;
537
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).background;
794
538
  }
795
539
  set background(v) {
796
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { background: v });
540
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { background: v });
797
541
  }
798
542
  get focusRing() {
799
- return __privateGet(this, _props).focusRing;
543
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).focusRing;
800
544
  }
801
545
  set focusRing(v) {
802
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { focusRing: v });
546
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { focusRing: v });
803
547
  }
804
548
  /** Accessible name of each tile. */
805
549
  get cellLabel() {
806
- return __privateGet(this, _props).cellLabel;
550
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).cellLabel;
807
551
  }
808
552
  set cellLabel(v) {
809
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { cellLabel: v });
553
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { cellLabel: v });
810
554
  }
811
555
  /** Extra style for each tile. */
812
556
  get cellStyle() {
813
- return __privateGet(this, _props).cellStyle;
557
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).cellStyle;
814
558
  }
815
559
  set cellStyle(v) {
816
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { cellStyle: v });
560
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { cellStyle: v });
817
561
  }
818
562
  /** Content for empty tiles (rendered in the shadow root). */
819
563
  get fallback() {
820
- return __privateGet(this, _props).fallback;
564
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _props).fallback;
821
565
  }
822
566
  set fallback(v) {
823
- __privateMethod(this, _AndamentoLayoutElement_instances, set_fn).call(this, { fallback: v });
567
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, set_fn).call(this, { fallback: v });
824
568
  }
825
569
  /** The tile element (in the shadow root) showing a cell, if it's rendered. */
826
570
  tileElement(cellId) {
827
- return __privateGet(this, _handle)?.tileElement(cellId);
571
+ return _optionalChain([_chunk276TFSAGcjs.__privateGet.call(void 0, this, _handle), 'optionalAccess', _17 => _17.tileElement, 'call', _18 => _18(cellId)]);
828
572
  }
829
573
  connectedCallback() {
830
- __privateSet(this, _observer, new MutationObserver((records) => {
831
- if (records.some((r) => r.target === this || r.target.parentNode === this)) __privateMethod(this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
574
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _observer, new MutationObserver((records) => {
575
+ if (records.some((r) => r.target === this || r.target.parentNode === this)) _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
832
576
  }));
833
- __privateGet(this, _observer).observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-aspect", "data-focus", "data-weight", "slot"] });
834
- __privateMethod(this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
577
+ _chunk276TFSAGcjs.__privateGet.call(void 0, this, _observer).observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-aspect", "data-focus", "data-weight", "slot"] });
578
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
835
579
  }
836
580
  disconnectedCallback() {
837
- __privateGet(this, _observer)?.disconnect();
838
- __privateSet(this, _observer, void 0);
839
- __privateGet(this, _handle)?.destroy();
840
- __privateSet(this, _handle, void 0);
581
+ _optionalChain([_chunk276TFSAGcjs.__privateGet.call(void 0, this, _observer), 'optionalAccess', _19 => _19.disconnect, 'call', _20 => _20()]);
582
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _observer, void 0);
583
+ _optionalChain([_chunk276TFSAGcjs.__privateGet.call(void 0, this, _handle), 'optionalAccess', _21 => _21.destroy, 'call', _22 => _22()]);
584
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _handle, void 0);
841
585
  }
842
586
  attributeChangedCallback() {
843
- __privateMethod(this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
587
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
844
588
  }
845
589
  /** Render now rather than at the end of the current task (e.g. before measuring). */
846
590
  render() {
847
- __privateMethod(this, _AndamentoLayoutElement_instances, render_fn).call(this);
591
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, render_fn).call(this);
848
592
  }
849
593
  };
850
594
  _config = new WeakMap();
@@ -858,30 +602,30 @@ _backdrop = new WeakMap();
858
602
  _AndamentoLayoutElement_instances = new WeakSet();
859
603
  /** The same function for the same backdrop child, so tiles keep their copies. */
860
604
  backdropFor_fn = function(el) {
861
- if (__privateGet(this, _backdrop)?.el !== el) __privateSet(this, _backdrop, { el, make: () => copyBackdrop(el) });
862
- return __privateGet(this, _backdrop).make;
605
+ if (_optionalChain([_chunk276TFSAGcjs.__privateGet.call(void 0, this, _backdrop), 'optionalAccess', _23 => _23.el]) !== el) _chunk276TFSAGcjs.__privateSet.call(void 0, this, _backdrop, { el, make: () => copyBackdrop(el) });
606
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _backdrop).make;
863
607
  };
864
608
  set_fn = function(changes) {
865
- __privateSet(this, _props, { ...__privateGet(this, _props), ...changes });
866
- __privateMethod(this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
609
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _props, { ..._chunk276TFSAGcjs.__privateGet.call(void 0, this, _props), ...changes });
610
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, schedule_fn).call(this);
867
611
  };
868
612
  /** Several changes in one go render once. */
869
613
  schedule_fn = function() {
870
- if (__privateGet(this, _queued)) return;
871
- __privateSet(this, _queued, true);
614
+ if (_chunk276TFSAGcjs.__privateGet.call(void 0, this, _queued)) return;
615
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _queued, true);
872
616
  queueMicrotask(() => {
873
- __privateSet(this, _queued, false);
874
- __privateMethod(this, _AndamentoLayoutElement_instances, render_fn).call(this);
617
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _queued, false);
618
+ _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, render_fn).call(this);
875
619
  });
876
620
  };
877
621
  render_fn = function() {
878
622
  if (!this.isConnected) return;
879
- const config = __privateMethod(this, _AndamentoLayoutElement_instances, configure_fn).call(this);
623
+ const config = _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, configure_fn).call(this);
880
624
  if (!config.options && !config.layout) return;
881
- if (__privateGet(this, _handle)) __privateGet(this, _handle).update(config);
625
+ if (_chunk276TFSAGcjs.__privateGet.call(void 0, this, _handle)) _chunk276TFSAGcjs.__privateGet.call(void 0, this, _handle).update(config);
882
626
  else {
883
- __privateSet(this, _handle, mountTileLayout(this.shadowRoot, config));
884
- __privateGet(this, _handle).element.setAttribute("part", "layout");
627
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _handle, mountTileLayout(this.shadowRoot, config));
628
+ _chunk276TFSAGcjs.__privateGet.call(void 0, this, _handle).element.setAttribute("part", "layout");
885
629
  }
886
630
  };
887
631
  configure_fn = function() {
@@ -901,43 +645,43 @@ configure_fn = function() {
901
645
  if (a("label")) fromAttrs.label = a("label");
902
646
  const children = [...this.children];
903
647
  const backdrop = children.find((c) => c.getAttribute("slot") === "backdrop");
904
- __privateSet(this, _items, children.filter((c) => c !== backdrop && c.localName !== "template"));
905
- const items = __privateGet(this, _items).map((child) => {
906
- let slot = __privateGet(this, _slots).get(child);
648
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _items, children.filter((c) => c !== backdrop && c.localName !== "template"));
649
+ const items = _chunk276TFSAGcjs.__privateGet.call(void 0, this, _items).map((child) => {
650
+ let slot = _chunk276TFSAGcjs.__privateGet.call(void 0, this, _slots).get(child);
907
651
  if (!slot) {
908
652
  slot = document.createElement("slot");
909
653
  slot.name = `andamento-${++slotCount}`;
910
- __privateGet(this, _slots).set(child, slot);
654
+ _chunk276TFSAGcjs.__privateGet.call(void 0, this, _slots).set(child, slot);
911
655
  }
912
656
  if (child.getAttribute("slot") !== slot.name) child.setAttribute("slot", slot.name);
913
657
  return slot;
914
658
  });
915
- const aspectAttrs = __privateGet(this, _items).map((c) => Number(c.getAttribute("data-aspect")));
659
+ const aspectAttrs = _chunk276TFSAGcjs.__privateGet.call(void 0, this, _items).map((c) => Number(c.getAttribute("data-aspect")));
916
660
  const aspects = aspectAttrs.some((v) => v > 0) ? aspectAttrs.map((v) => v > 0 ? v : 1) : void 0;
917
- const focusAttrs = __privateGet(this, _items).map((c) => {
918
- const [x, y] = (c.getAttribute("data-focus") ?? "").trim().split(/[\s,]+/).map(Number);
661
+ const focusAttrs = _chunk276TFSAGcjs.__privateGet.call(void 0, this, _items).map((c) => {
662
+ const [x, y] = (_nullishCoalesce(c.getAttribute("data-focus"), () => ( ""))).trim().split(/[\s,]+/).map(Number);
919
663
  return Number.isFinite(x) && Number.isFinite(y) && c.hasAttribute("data-focus") ? { x, y } : void 0;
920
664
  });
921
665
  const focalPoints = focusAttrs.some(Boolean) ? focusAttrs : void 0;
922
- const weightAttrs = __privateGet(this, _items).map((c) => Number(c.getAttribute("data-weight")));
666
+ const weightAttrs = _chunk276TFSAGcjs.__privateGet.call(void 0, this, _items).map((c) => Number(c.getAttribute("data-weight")));
923
667
  const weights = weightAttrs.some((v) => v > 1) ? weightAttrs.map((v) => v > 0 ? v : 1) : void 0;
924
- __privateSet(this, _config, {
668
+ _chunk276TFSAGcjs.__privateSet.call(void 0, this, _config, {
925
669
  ...fromAttrs,
926
670
  aspects,
927
671
  focalPoints,
928
672
  weights,
929
- ...overrides(__privateGet(this, _props)),
673
+ ...overrides(_chunk276TFSAGcjs.__privateGet.call(void 0, this, _props)),
930
674
  items,
931
- backdrop: backdrop ? __privateMethod(this, _AndamentoLayoutElement_instances, backdropFor_fn).call(this, backdrop) : void 0,
675
+ backdrop: backdrop ? _chunk276TFSAGcjs.__privateMethod.call(void 0, this, _AndamentoLayoutElement_instances, backdropFor_fn).call(this, backdrop) : void 0,
932
676
  cellAttributes: (cell, state) => ({
933
677
  part: ["tile", state.empty && "empty", cell.boundary && "boundary"].filter(Boolean).join(" ")
934
678
  }),
935
679
  onCellActivate: (cell, state) => {
936
- const detail = { cell, slot: state.slot, item: __privateGet(this, _items)[state.slot] };
680
+ const detail = { cell, slot: state.slot, item: _chunk276TFSAGcjs.__privateGet.call(void 0, this, _items)[state.slot] };
937
681
  this.dispatchEvent(new CustomEvent("cellactivate", { detail, bubbles: true, composed: true }));
938
682
  }
939
683
  });
940
- return __privateGet(this, _config);
684
+ return _chunk276TFSAGcjs.__privateGet.call(void 0, this, _config);
941
685
  };
942
686
  AndamentoLayoutElement.observedAttributes = ATTRIBUTES;
943
687
  var overrides = (props) => Object.fromEntries(Object.entries(props).filter(([k, v]) => v !== void 0 || !ATTRIBUTE_KEYS.has(k)));
@@ -946,7 +690,7 @@ function copyBackdrop(el) {
946
690
  const copy = el.cloneNode(true);
947
691
  copy.removeAttribute("slot");
948
692
  if (/^(img|video|picture|canvas)$/.test(copy.localName)) {
949
- for (const [k, v] of Object.entries(coverStyle)) copy.style.setProperty(k.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()), String(v));
693
+ for (const [k, v] of Object.entries(_chunk276TFSAGcjs.coverStyle)) copy.style.setProperty(k.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()), String(v));
950
694
  }
951
695
  return copy;
952
696
  }
@@ -961,44 +705,23 @@ function defineTileLayoutElement(tagName = "andamento-layout") {
961
705
  }
962
706
 
963
707
  // src/pointer.ts
964
- var import_core3 = require("@andamento/core");
708
+
965
709
  function cellFromPointer(layout, event, options = {}) {
966
- const el = options.element ?? event.currentTarget;
710
+ const el = _nullishCoalesce(options.element, () => ( event.currentTarget));
967
711
  if (!el || typeof el.getBoundingClientRect !== "function") return void 0;
968
- const point = (0, import_core3.screenToLayout)(layout, el.getBoundingClientRect(), event.clientX, event.clientY);
969
- return (0, import_core3.cellAt)(layout, point, options);
712
+ const point = _core.screenToLayout.call(void 0, layout, el.getBoundingClientRect(), event.clientX, event.clientY);
713
+ return _core.cellAt.call(void 0, layout, point, options);
970
714
  }
971
715
 
972
716
  // src/index.ts
973
- var import_svg2 = require("@andamento/svg");
974
- // Annotate the CommonJS export names for ESM import in node:
975
- 0 && (module.exports = {
976
- AndamentoLayoutElement,
977
- MORPH_POINTS,
978
- NOTHING_IN_VIEW,
979
- backdropStyle,
980
- backgroundStyle,
981
- cellFromPointer,
982
- containerStyle,
983
- coverStyle,
984
- defaultPalette,
985
- defineTileLayoutElement,
986
- focusStyle,
987
- frameBuilder,
988
- keyAction,
989
- layoutResolver,
990
- mountTileLayout,
991
- neutralPalette,
992
- overlayStyle,
993
- resolvePerCell,
994
- ringStrokes,
995
- safeBoxStyle,
996
- sameRect,
997
- shadowShape,
998
- tileSheet,
999
- tileStyle,
1000
- tileViewBox,
1001
- viewRect,
1002
- watchView
1003
- });
717
+ var _svg = require('@andamento/svg');
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+ exports.AndamentoLayoutElement = AndamentoLayoutElement; exports.cellFromPointer = cellFromPointer; exports.coverStyle = _chunk276TFSAGcjs.coverStyle; exports.defaultPalette = _svg.defaultPalette; exports.defineTileLayoutElement = defineTileLayoutElement; exports.mountTileLayout = mountTileLayout; exports.neutralPalette = _svg.neutralPalette;
1004
727
  //# sourceMappingURL=index.cjs.map