@andamento/dom 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/index.cjs +1004 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +400 -0
- package/dist/index.d.ts +400 -0
- package/dist/index.js +967 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { Cell, Layout, ContentCells, ContentPlacement, Rect, Focus, LayoutOptions, HitOptions } from '@andamento/core';
|
|
2
|
+
import { ReliefPath, FillSource, ReliefOptions } from '@andamento/svg';
|
|
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;
|
|
164
|
+
|
|
165
|
+
/** What can go in a tile: a DOM node, text, or nothing. */
|
|
166
|
+
type TileContent = Node | string | null | undefined;
|
|
167
|
+
interface TileLayoutConfig {
|
|
168
|
+
/** Layout options; or pass a precomputed `layout` instead. */
|
|
169
|
+
options?: LayoutOptions;
|
|
170
|
+
layout?: Layout;
|
|
171
|
+
/**
|
|
172
|
+
* The content: each item fills one tile, in reading order, clipped to the tile's shape.
|
|
173
|
+
* Nodes are moved into their tiles (and kept there as the layout changes), so pass the
|
|
174
|
+
* same node again to keep its state.
|
|
175
|
+
*/
|
|
176
|
+
items?: readonly TileContent[];
|
|
177
|
+
/**
|
|
178
|
+
* Alternative to `items`: each tile's content from its cell, worked out on every render.
|
|
179
|
+
* Return the same node again to keep it. `slot` numbers the cells allowed by `contentCells`.
|
|
180
|
+
*/
|
|
181
|
+
renderCell?: (cell: Cell, state: {
|
|
182
|
+
slot: number;
|
|
183
|
+
}) => TileContent;
|
|
184
|
+
/** Which tiles may hold content: "all" (default), "whole" (not cut by the outline) or a test. */
|
|
185
|
+
contentCells?: ContentCells;
|
|
186
|
+
/** Where items go when there are fewer than tiles: "reading" (default), "center" or "spread". */
|
|
187
|
+
placement?: ContentPlacement;
|
|
188
|
+
/** Width / height of each item, to put items in tiles of similar shape (see `matchSlots`). */
|
|
189
|
+
aspects?: readonly number[];
|
|
190
|
+
/** With `aspects`: "shape" also picks which tiles hold items by their shape. */
|
|
191
|
+
choose?: "placement" | "shape";
|
|
192
|
+
/**
|
|
193
|
+
* Focal point of each item (fractions of its width and height; see `estimateFocus`): what
|
|
194
|
+
* a photo keeps in view as its tile crops it. Each tile sets `--andamento-object-position`,
|
|
195
|
+
* which `coverStyle` uses; exact when the photo's shape is known (`aspects`, or the focus's `aspect`).
|
|
196
|
+
*/
|
|
197
|
+
focalPoints?: readonly (Focus | undefined)[];
|
|
198
|
+
/**
|
|
199
|
+
* How many tiles each item spans (1 for an ordinary item; rounded): heavier items get a
|
|
200
|
+
* featured tile of that many merged tiles, where they fall in reading order (see
|
|
201
|
+
* `weightedLayout`). With `fit`, the tiles are sized to fit everything. Needs `options`.
|
|
202
|
+
*/
|
|
203
|
+
weights?: readonly number[];
|
|
204
|
+
/**
|
|
205
|
+
* Put each tile's content in the tile's safe area, not its bounding box (see `safeArea`).
|
|
206
|
+
* For tiles an `edges: "window"` layout cuts, `true` or "tile" fits the whole tile and
|
|
207
|
+
* "visible" the part that shows.
|
|
208
|
+
*/
|
|
209
|
+
safeArea?: SafeAreaProp;
|
|
210
|
+
/** Color of empty tiles: a color, a palette or a function per cell. Defaults to `neutralPalette`. */
|
|
211
|
+
fill?: FillSource;
|
|
212
|
+
/** Size the tiles to the items: `true`/"atLeast" or "nearest". Ignored with `layout` or `renderCell`. */
|
|
213
|
+
fit?: FitProp;
|
|
214
|
+
/**
|
|
215
|
+
* One picture across all the tiles: a node copied into every tile (or a function making
|
|
216
|
+
* a fresh one per tile), sized to the whole layout so each tile shows its piece.
|
|
217
|
+
*/
|
|
218
|
+
backdrop?: Node | (() => Node);
|
|
219
|
+
/** Raised tiles: a lit bevel and optional shadow. `true` for the defaults. */
|
|
220
|
+
relief?: boolean | ReliefOptions;
|
|
221
|
+
/** Arrow-key navigation over the tiles with content, as one tab stop. */
|
|
222
|
+
navigable?: boolean;
|
|
223
|
+
/** Called when a tile with content is clicked, or Enter / Space pressed on it (with `navigable`). */
|
|
224
|
+
onCellActivate?: (cell: Cell, state: CellState) => void;
|
|
225
|
+
/** Accessible name for each tile. */
|
|
226
|
+
cellLabel?: PerCell<string | undefined>;
|
|
227
|
+
/** Focus ring color, or `false` for none. Defaults to "#1a56db". */
|
|
228
|
+
focusRing?: string | false;
|
|
229
|
+
/** Animate layout and content changes. `true` for 400 ms, or `{ duration, easing }`. */
|
|
230
|
+
animate?: boolean | {
|
|
231
|
+
duration?: number;
|
|
232
|
+
easing?: string;
|
|
233
|
+
};
|
|
234
|
+
/** Only put tiles in view (plus `overscan` pixels, default 300) in the DOM. */
|
|
235
|
+
virtualize?: boolean | {
|
|
236
|
+
overscan?: number;
|
|
237
|
+
};
|
|
238
|
+
/** Content for empty tiles. */
|
|
239
|
+
fallback?: PerCell<TileContent>;
|
|
240
|
+
/** Class for each tile element. */
|
|
241
|
+
cellClass?: PerCell<string | undefined>;
|
|
242
|
+
/** Extra style for each tile element: camelCase or custom (`--x`) properties. */
|
|
243
|
+
cellStyle?: PerCell<StyleMap | undefined>;
|
|
244
|
+
/** Extra attributes for each tile element (`part`, `title`, …). */
|
|
245
|
+
cellAttributes?: PerCell<Record<string, string | undefined> | undefined>;
|
|
246
|
+
/** Color painted across the whole region, visible through the gaps. */
|
|
247
|
+
background?: string;
|
|
248
|
+
/** Role of the layout element: "list" (default; tiles with content are list items) or another. */
|
|
249
|
+
role?: string;
|
|
250
|
+
/** Accessible name of the layout (its `aria-label`). */
|
|
251
|
+
label?: string;
|
|
252
|
+
/** Class for the layout element. */
|
|
253
|
+
className?: string;
|
|
254
|
+
}
|
|
255
|
+
interface TileLayoutHandle {
|
|
256
|
+
/** The layout element (with `data-andamento`), inside the element mounted into. */
|
|
257
|
+
readonly element: HTMLDivElement;
|
|
258
|
+
/** The layout being shown. */
|
|
259
|
+
readonly layout: Layout;
|
|
260
|
+
/** Change some options (others stay as they are; pass `undefined` to clear one) and re-render. */
|
|
261
|
+
update(changes: Partial<TileLayoutConfig>): void;
|
|
262
|
+
/** Render again, e.g. after changing what `renderCell` returns. */
|
|
263
|
+
refresh(): void;
|
|
264
|
+
/** The element of the tile showing a cell, if it's in the DOM. */
|
|
265
|
+
tileElement(cellId: string): HTMLElement | undefined;
|
|
266
|
+
/** Remove the layout (items are taken out of their tiles) and stop listening. */
|
|
267
|
+
destroy(): void;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Render a tiling into `target` (an element or a shadow root), without a framework: one
|
|
271
|
+
* absolutely positioned, clipped element per tile, holding the items you give it. Sized in
|
|
272
|
+
* percentages, so it scales with `target`'s width. Returns a handle to update or remove it.
|
|
273
|
+
*
|
|
274
|
+
* Tiles have `data-cell-id`, `data-index`, `data-empty` and `data-boundary`, as with the
|
|
275
|
+
* React and Vue components.
|
|
276
|
+
*/
|
|
277
|
+
declare function mountTileLayout(target: Element | ShadowRoot, initial: TileLayoutConfig): TileLayoutHandle;
|
|
278
|
+
|
|
279
|
+
/** Detail of the `cellactivate` event. */
|
|
280
|
+
interface CellActivateDetail {
|
|
281
|
+
cell: Cell;
|
|
282
|
+
/** Item index, as in `CellState`. */
|
|
283
|
+
slot: number;
|
|
284
|
+
/** The child element in the tile. */
|
|
285
|
+
item: Element | undefined;
|
|
286
|
+
}
|
|
287
|
+
declare const Base: typeof HTMLElement;
|
|
288
|
+
/**
|
|
289
|
+
* `<andamento-layout>`: a tiling as a web component, for any framework or none (Angular,
|
|
290
|
+
* Svelte, Solid, Lit, plain HTML). Each child element fills one tile, in reading order,
|
|
291
|
+
* clipped to the tile's shape; children stay where you put them (they're shown in the
|
|
292
|
+
* tiles through slots), so frameworks keep managing them.
|
|
293
|
+
*
|
|
294
|
+
* Set `options` (a `LayoutOptions` object, or JSON in the attribute) or `layout`. Simple
|
|
295
|
+
* settings are attributes too: `navigable`, `animate`, `relief`, `safe-area`, `virtualize`,
|
|
296
|
+
* `fit`, `placement`, `content-cells`, `choose`, `background`, `fill`, `focus-ring`, `label`.
|
|
297
|
+
* Give children `data-aspect` (width / height) to put them in tiles of their shape, and
|
|
298
|
+
* `data-focus` ("x y", fractions of the width and height) to keep that point of a photo in
|
|
299
|
+
* view as its tile crops it (style the photo with `coverStyle`, or
|
|
300
|
+
* `object-position: var(--andamento-object-position)`), and `data-weight` (how many tiles
|
|
301
|
+
* it spans) to give important children featured tiles. A child
|
|
302
|
+
* with `slot="backdrop"` is copied into every tile as one picture across them all.
|
|
303
|
+
*
|
|
304
|
+
* Tiles are in the element's shadow root: style them with `::part(tile)` (also `empty`
|
|
305
|
+
* and `boundary`, e.g. `andamento-layout::part(empty)`). Activating a tile fires
|
|
306
|
+
* `cellactivate`, with `CellActivateDetail`.
|
|
307
|
+
*/
|
|
308
|
+
declare class AndamentoLayoutElement extends Base {
|
|
309
|
+
#private;
|
|
310
|
+
static observedAttributes: string[];
|
|
311
|
+
constructor();
|
|
312
|
+
/** Layout options (also the `options` attribute, as JSON). */
|
|
313
|
+
get options(): LayoutOptions | undefined;
|
|
314
|
+
set options(v: LayoutOptions | undefined);
|
|
315
|
+
/** A precomputed layout, instead of `options`. */
|
|
316
|
+
get layout(): Layout | undefined;
|
|
317
|
+
set layout(v: Layout | undefined);
|
|
318
|
+
/** Color of empty tiles: a color, a palette or a function per cell. */
|
|
319
|
+
get fill(): FillSource | undefined;
|
|
320
|
+
set fill(v: FillSource | undefined);
|
|
321
|
+
get relief(): boolean | ReliefOptions | undefined;
|
|
322
|
+
set relief(v: boolean | ReliefOptions | undefined);
|
|
323
|
+
/** Animate changes (the `animate` attribute; `animate` itself is the Web Animations method). */
|
|
324
|
+
get animated(): TileLayoutConfig["animate"];
|
|
325
|
+
set animated(v: TileLayoutConfig["animate"]);
|
|
326
|
+
get virtualize(): TileLayoutConfig["virtualize"];
|
|
327
|
+
set virtualize(v: TileLayoutConfig["virtualize"]);
|
|
328
|
+
get navigable(): boolean | undefined;
|
|
329
|
+
set navigable(v: boolean | undefined);
|
|
330
|
+
get safeArea(): SafeAreaProp | undefined;
|
|
331
|
+
set safeArea(v: SafeAreaProp | undefined);
|
|
332
|
+
get fit(): FitProp | undefined;
|
|
333
|
+
set fit(v: FitProp | undefined);
|
|
334
|
+
get placement(): ContentPlacement | undefined;
|
|
335
|
+
set placement(v: ContentPlacement | undefined);
|
|
336
|
+
get contentCells(): ContentCells | undefined;
|
|
337
|
+
set contentCells(v: ContentCells | undefined);
|
|
338
|
+
get choose(): "placement" | "shape" | undefined;
|
|
339
|
+
set choose(v: "placement" | "shape" | undefined);
|
|
340
|
+
/** Width / height of each child; otherwise read from children's `data-aspect`. */
|
|
341
|
+
get aspects(): readonly number[] | undefined;
|
|
342
|
+
set aspects(v: readonly number[] | undefined);
|
|
343
|
+
/** Tiles each child spans; otherwise read from children's `data-weight`. */
|
|
344
|
+
get weights(): readonly number[] | undefined;
|
|
345
|
+
set weights(v: readonly number[] | undefined);
|
|
346
|
+
/** Focal point of each child; otherwise read from children's `data-focus`. */
|
|
347
|
+
get focalPoints(): readonly (Focus | undefined)[] | undefined;
|
|
348
|
+
set focalPoints(v: readonly (Focus | undefined)[] | undefined);
|
|
349
|
+
get background(): string | undefined;
|
|
350
|
+
set background(v: string | undefined);
|
|
351
|
+
get focusRing(): string | false | undefined;
|
|
352
|
+
set focusRing(v: string | false | undefined);
|
|
353
|
+
/** Accessible name of each tile. */
|
|
354
|
+
get cellLabel(): PerCell<string | undefined> | undefined;
|
|
355
|
+
set cellLabel(v: PerCell<string | undefined> | undefined);
|
|
356
|
+
/** Extra style for each tile. */
|
|
357
|
+
get cellStyle(): PerCell<StyleMap | undefined> | undefined;
|
|
358
|
+
set cellStyle(v: PerCell<StyleMap | undefined> | undefined);
|
|
359
|
+
/** Content for empty tiles (rendered in the shadow root). */
|
|
360
|
+
get fallback(): PerCell<TileContent> | undefined;
|
|
361
|
+
set fallback(v: PerCell<TileContent> | undefined);
|
|
362
|
+
/** The tile element (in the shadow root) showing a cell, if it's rendered. */
|
|
363
|
+
tileElement(cellId: string): HTMLElement | undefined;
|
|
364
|
+
connectedCallback(): void;
|
|
365
|
+
disconnectedCallback(): void;
|
|
366
|
+
attributeChangedCallback(): void;
|
|
367
|
+
/** Render now rather than at the end of the current task (e.g. before measuring). */
|
|
368
|
+
render(): void;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Register `<andamento-layout>` (or another tag name). Safe to call more than once.
|
|
372
|
+
* Returns the element class.
|
|
373
|
+
*/
|
|
374
|
+
declare function defineTileLayoutElement(tagName?: string): typeof AndamentoLayoutElement;
|
|
375
|
+
declare global {
|
|
376
|
+
interface HTMLElementTagNameMap {
|
|
377
|
+
"andamento-layout": AndamentoLayoutElement;
|
|
378
|
+
}
|
|
379
|
+
interface HTMLElementEventMap {
|
|
380
|
+
cellactivate: CustomEvent<CellActivateDetail>;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** The parts of a pointer or mouse event `cellFromPointer` uses. */
|
|
385
|
+
interface PointerLike {
|
|
386
|
+
clientX: number;
|
|
387
|
+
clientY: number;
|
|
388
|
+
currentTarget: EventTarget | null;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* The cell under a pointer event, for handlers on the element showing the layout (a
|
|
392
|
+
* `<TileLayout>`, an `<svg>` or a canvas). Unlike handlers on each tile, it can see the
|
|
393
|
+
* gaps: with `tolerance`, a pointer in the grout picks the nearest tile. Pass `element`
|
|
394
|
+
* when the handler is on some other element.
|
|
395
|
+
*/
|
|
396
|
+
declare function cellFromPointer(layout: Layout, event: PointerLike, options?: HitOptions & {
|
|
397
|
+
element?: Element;
|
|
398
|
+
}): Cell | undefined;
|
|
399
|
+
|
|
400
|
+
export { AndamentoLayoutElement, type CellActivateDetail, type CellState, type FitProp, type Frame, type FrameOptions, type LayoutNeeds, MORPH_POINTS, NOTHING_IN_VIEW, type PerCell, type PointerLike, type SafeAreaProp, type StyleMap, type TileContent, type TileLayoutConfig, type TileLayoutHandle, backdropStyle, backgroundStyle, cellFromPointer, containerStyle, coverStyle, defineTileLayoutElement, focusStyle, frameBuilder, keyAction, layoutResolver, mountTileLayout, overlayStyle, resolvePerCell, ringStrokes, safeBoxStyle, sameRect, shadowShape, tileSheet, tileStyle, tileViewBox, viewRect, watchView };
|