@andamento/vue 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +28 -2
- package/dist/index.cjs +468 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +282 -0
- package/dist/index.d.ts +282 -0
- package/dist/index.js +465 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, VNode, MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
3
|
+
import { LayoutOptions, Layout, ContentCells, ContentPlacement, Focus, Cell, FitOptions } from '@andamento/core';
|
|
4
|
+
export { Cell, ContentCells, ContentPlacement, HitOptions, Layout, LayoutOptions } from '@andamento/core';
|
|
5
|
+
import { SafeAreaProp, FitProp, PerCell, StyleMap, CellState } from '@andamento/dom';
|
|
6
|
+
export { CellState, FillSource, FitProp, PerCell, PointerLike, ReliefOptions, StyleMap, cellFromPointer, coverStyle, defaultPalette, neutralPalette } from '@andamento/dom';
|
|
7
|
+
import { FillSource, ReliefOptions, ImageSource } from '@andamento/svg';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A tiling as HTML: one absolutely positioned, `clip-path`-ed element per tile, holding
|
|
11
|
+
* whatever you put in it. Each top-level child of the default slot fills one tile, in
|
|
12
|
+
* reading order (`v-for` children count one each). Or use the `cell` slot, given
|
|
13
|
+
* `{ cell, slot }`, to fill every tile. Sized in percentages, so it scales with its width.
|
|
14
|
+
*
|
|
15
|
+
* Slots: default (the items), `cell` (instead of items), `fallback` (empty tiles, given
|
|
16
|
+
* `{ cell, state }`) and `backdrop` (one picture across all the tiles). Emits
|
|
17
|
+
* `cell-activate` with `(cell, state)`. Props match the React `<TileLayout>`.
|
|
18
|
+
*/
|
|
19
|
+
declare const TileLayout: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
20
|
+
/** Layout options; or pass a precomputed `layout` instead. */
|
|
21
|
+
options: PropType<LayoutOptions>;
|
|
22
|
+
layout: PropType<Layout>;
|
|
23
|
+
/** Which tiles may hold items: "all" (default), "whole" or a test per cell. */
|
|
24
|
+
contentCells: PropType<ContentCells>;
|
|
25
|
+
/** Where items go when there are fewer than tiles: "reading" (default), "center" or "spread". */
|
|
26
|
+
placement: PropType<ContentPlacement>;
|
|
27
|
+
/** Width / height of each item, to put items in tiles of similar shape. */
|
|
28
|
+
aspects: PropType<readonly number[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Focal point of each child (fractions of its width and height; see `estimateFocus`): what
|
|
31
|
+
* a photo keeps in view as its tile crops it. Each tile sets `--andamento-object-position`,
|
|
32
|
+
* which `coverStyle` uses as `object-position`; exact when the photo's shape is known (`aspects`, or the focus's `aspect`).
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* How many tiles each item spans (1 for an ordinary item): heavier items get featured
|
|
36
|
+
* tiles where they fall in reading order (see `weightedLayout`). Needs `options`.
|
|
37
|
+
*/
|
|
38
|
+
weights: PropType<readonly number[]>;
|
|
39
|
+
focalPoints: PropType<readonly (Focus | undefined)[]>;
|
|
40
|
+
/** With `aspects`: "shape" also picks which tiles hold items by their shape. */
|
|
41
|
+
choose: PropType<"placement" | "shape">;
|
|
42
|
+
/**
|
|
43
|
+
* Put each tile's content in the tile's safe area (see `safeArea`). For tiles an
|
|
44
|
+
* `edges: "window"` layout cuts, `true` or "tile" fits the whole tile, "visible" the part that shows.
|
|
45
|
+
*/
|
|
46
|
+
safeArea: {
|
|
47
|
+
type: PropType<SafeAreaProp>;
|
|
48
|
+
default: boolean;
|
|
49
|
+
};
|
|
50
|
+
/** Color of empty tiles: a color, a palette or a function per cell. Defaults to `neutralPalette`. */
|
|
51
|
+
fill: PropType<FillSource>;
|
|
52
|
+
/** Size the tiles to the items: `true`/"atLeast" or "nearest". */
|
|
53
|
+
fit: {
|
|
54
|
+
type: PropType<FitProp>;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
/** Raised tiles: a lit bevel and optional shadow. `true` for the defaults. */
|
|
58
|
+
relief: {
|
|
59
|
+
type: PropType<boolean | ReliefOptions>;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
/** Arrow-key navigation over the tiles with content, as one tab stop. */
|
|
63
|
+
navigable: BooleanConstructor;
|
|
64
|
+
/** Accessible name for each tile. */
|
|
65
|
+
cellLabel: PropType<PerCell<string | undefined>>;
|
|
66
|
+
/** Focus ring color, or `false` for none. */
|
|
67
|
+
focusRing: {
|
|
68
|
+
type: PropType<string | false>;
|
|
69
|
+
default: string;
|
|
70
|
+
};
|
|
71
|
+
/** Animate layout and content changes. `true` for 400 ms, or `{ duration, easing }`. */
|
|
72
|
+
animate: {
|
|
73
|
+
type: PropType<boolean | {
|
|
74
|
+
duration?: number;
|
|
75
|
+
easing?: string;
|
|
76
|
+
}>;
|
|
77
|
+
default: boolean;
|
|
78
|
+
};
|
|
79
|
+
/** Only mount the tiles in view (plus `overscan` pixels, default 300). */
|
|
80
|
+
virtualize: {
|
|
81
|
+
type: PropType<boolean | {
|
|
82
|
+
overscan?: number;
|
|
83
|
+
}>;
|
|
84
|
+
default: boolean;
|
|
85
|
+
};
|
|
86
|
+
/** Class for each tile element. */
|
|
87
|
+
cellClass: PropType<PerCell<unknown>>;
|
|
88
|
+
/** Extra style for each tile element. */
|
|
89
|
+
cellStyle: PropType<PerCell<StyleMap | undefined>>;
|
|
90
|
+
/** Color painted across the whole region, visible through the gaps. */
|
|
91
|
+
background: StringConstructor;
|
|
92
|
+
role: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: string;
|
|
95
|
+
};
|
|
96
|
+
/** Called when a tile with content is clicked, or Enter / Space pressed on it. Bind with `@cell-activate`. */
|
|
97
|
+
onCellActivate: PropType<(cell: Cell, state: CellState) => void>;
|
|
98
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
99
|
+
[key: string]: any;
|
|
100
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
101
|
+
/** Layout options; or pass a precomputed `layout` instead. */
|
|
102
|
+
options: PropType<LayoutOptions>;
|
|
103
|
+
layout: PropType<Layout>;
|
|
104
|
+
/** Which tiles may hold items: "all" (default), "whole" or a test per cell. */
|
|
105
|
+
contentCells: PropType<ContentCells>;
|
|
106
|
+
/** Where items go when there are fewer than tiles: "reading" (default), "center" or "spread". */
|
|
107
|
+
placement: PropType<ContentPlacement>;
|
|
108
|
+
/** Width / height of each item, to put items in tiles of similar shape. */
|
|
109
|
+
aspects: PropType<readonly number[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Focal point of each child (fractions of its width and height; see `estimateFocus`): what
|
|
112
|
+
* a photo keeps in view as its tile crops it. Each tile sets `--andamento-object-position`,
|
|
113
|
+
* which `coverStyle` uses as `object-position`; exact when the photo's shape is known (`aspects`, or the focus's `aspect`).
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* How many tiles each item spans (1 for an ordinary item): heavier items get featured
|
|
117
|
+
* tiles where they fall in reading order (see `weightedLayout`). Needs `options`.
|
|
118
|
+
*/
|
|
119
|
+
weights: PropType<readonly number[]>;
|
|
120
|
+
focalPoints: PropType<readonly (Focus | undefined)[]>;
|
|
121
|
+
/** With `aspects`: "shape" also picks which tiles hold items by their shape. */
|
|
122
|
+
choose: PropType<"placement" | "shape">;
|
|
123
|
+
/**
|
|
124
|
+
* Put each tile's content in the tile's safe area (see `safeArea`). For tiles an
|
|
125
|
+
* `edges: "window"` layout cuts, `true` or "tile" fits the whole tile, "visible" the part that shows.
|
|
126
|
+
*/
|
|
127
|
+
safeArea: {
|
|
128
|
+
type: PropType<SafeAreaProp>;
|
|
129
|
+
default: boolean;
|
|
130
|
+
};
|
|
131
|
+
/** Color of empty tiles: a color, a palette or a function per cell. Defaults to `neutralPalette`. */
|
|
132
|
+
fill: PropType<FillSource>;
|
|
133
|
+
/** Size the tiles to the items: `true`/"atLeast" or "nearest". */
|
|
134
|
+
fit: {
|
|
135
|
+
type: PropType<FitProp>;
|
|
136
|
+
default: boolean;
|
|
137
|
+
};
|
|
138
|
+
/** Raised tiles: a lit bevel and optional shadow. `true` for the defaults. */
|
|
139
|
+
relief: {
|
|
140
|
+
type: PropType<boolean | ReliefOptions>;
|
|
141
|
+
default: boolean;
|
|
142
|
+
};
|
|
143
|
+
/** Arrow-key navigation over the tiles with content, as one tab stop. */
|
|
144
|
+
navigable: BooleanConstructor;
|
|
145
|
+
/** Accessible name for each tile. */
|
|
146
|
+
cellLabel: PropType<PerCell<string | undefined>>;
|
|
147
|
+
/** Focus ring color, or `false` for none. */
|
|
148
|
+
focusRing: {
|
|
149
|
+
type: PropType<string | false>;
|
|
150
|
+
default: string;
|
|
151
|
+
};
|
|
152
|
+
/** Animate layout and content changes. `true` for 400 ms, or `{ duration, easing }`. */
|
|
153
|
+
animate: {
|
|
154
|
+
type: PropType<boolean | {
|
|
155
|
+
duration?: number;
|
|
156
|
+
easing?: string;
|
|
157
|
+
}>;
|
|
158
|
+
default: boolean;
|
|
159
|
+
};
|
|
160
|
+
/** Only mount the tiles in view (plus `overscan` pixels, default 300). */
|
|
161
|
+
virtualize: {
|
|
162
|
+
type: PropType<boolean | {
|
|
163
|
+
overscan?: number;
|
|
164
|
+
}>;
|
|
165
|
+
default: boolean;
|
|
166
|
+
};
|
|
167
|
+
/** Class for each tile element. */
|
|
168
|
+
cellClass: PropType<PerCell<unknown>>;
|
|
169
|
+
/** Extra style for each tile element. */
|
|
170
|
+
cellStyle: PropType<PerCell<StyleMap | undefined>>;
|
|
171
|
+
/** Color painted across the whole region, visible through the gaps. */
|
|
172
|
+
background: StringConstructor;
|
|
173
|
+
role: {
|
|
174
|
+
type: StringConstructor;
|
|
175
|
+
default: string;
|
|
176
|
+
};
|
|
177
|
+
/** Called when a tile with content is clicked, or Enter / Space pressed on it. Bind with `@cell-activate`. */
|
|
178
|
+
onCellActivate: PropType<(cell: Cell, state: CellState) => void>;
|
|
179
|
+
}>> & Readonly<{}>, {
|
|
180
|
+
navigable: boolean;
|
|
181
|
+
safeArea: SafeAreaProp;
|
|
182
|
+
fit: FitProp;
|
|
183
|
+
relief: boolean | ReliefOptions;
|
|
184
|
+
focusRing: string | false;
|
|
185
|
+
animate: boolean | {
|
|
186
|
+
duration?: number;
|
|
187
|
+
easing?: string;
|
|
188
|
+
};
|
|
189
|
+
virtualize: boolean | {
|
|
190
|
+
overscan?: number;
|
|
191
|
+
};
|
|
192
|
+
role: string;
|
|
193
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A tiling as a single <svg>: colored cells, optionally with images clipped to each cell.
|
|
197
|
+
* Use it for pure SVG (export, print, embedding in other SVG); use `<TileLayout>` for
|
|
198
|
+
* arbitrary content. Takes the options of `renderToString` from @andamento/svg as props.
|
|
199
|
+
*/
|
|
200
|
+
declare const SvgTileLayout: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
201
|
+
options: PropType<LayoutOptions>;
|
|
202
|
+
layout: PropType<Layout>;
|
|
203
|
+
images: PropType<ImageSource>;
|
|
204
|
+
repeatImages: BooleanConstructor;
|
|
205
|
+
contentCells: PropType<ContentCells>;
|
|
206
|
+
placement: PropType<ContentPlacement>;
|
|
207
|
+
imageAspects: PropType<readonly number[]>;
|
|
208
|
+
choose: PropType<"placement" | "shape">;
|
|
209
|
+
imageFit: PropType<"cover" | "contain">;
|
|
210
|
+
containWithin: PropType<"tile" | "visible">;
|
|
211
|
+
imageWeights: PropType<readonly number[]>;
|
|
212
|
+
imageFocus: PropType<readonly ({
|
|
213
|
+
x: number;
|
|
214
|
+
y: number;
|
|
215
|
+
} | undefined)[]>;
|
|
216
|
+
/** Size the tiles to the `images` array: `true`/"atLeast" or "nearest". */
|
|
217
|
+
fit: {
|
|
218
|
+
type: PropType<FitProp>;
|
|
219
|
+
default: boolean;
|
|
220
|
+
};
|
|
221
|
+
fill: PropType<FillSource>;
|
|
222
|
+
stroke: StringConstructor;
|
|
223
|
+
strokeWidth: NumberConstructor;
|
|
224
|
+
background: StringConstructor;
|
|
225
|
+
backdrop: StringConstructor;
|
|
226
|
+
relief: {
|
|
227
|
+
type: PropType<boolean | ReliefOptions>;
|
|
228
|
+
default: boolean;
|
|
229
|
+
};
|
|
230
|
+
title: StringConstructor;
|
|
231
|
+
imageAlts: PropType<readonly string[]>;
|
|
232
|
+
precision: NumberConstructor;
|
|
233
|
+
}>, () => string | VNode<vue.RendererNode, vue.RendererElement, {
|
|
234
|
+
[key: string]: any;
|
|
235
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
236
|
+
options: PropType<LayoutOptions>;
|
|
237
|
+
layout: PropType<Layout>;
|
|
238
|
+
images: PropType<ImageSource>;
|
|
239
|
+
repeatImages: BooleanConstructor;
|
|
240
|
+
contentCells: PropType<ContentCells>;
|
|
241
|
+
placement: PropType<ContentPlacement>;
|
|
242
|
+
imageAspects: PropType<readonly number[]>;
|
|
243
|
+
choose: PropType<"placement" | "shape">;
|
|
244
|
+
imageFit: PropType<"cover" | "contain">;
|
|
245
|
+
containWithin: PropType<"tile" | "visible">;
|
|
246
|
+
imageWeights: PropType<readonly number[]>;
|
|
247
|
+
imageFocus: PropType<readonly ({
|
|
248
|
+
x: number;
|
|
249
|
+
y: number;
|
|
250
|
+
} | undefined)[]>;
|
|
251
|
+
/** Size the tiles to the `images` array: `true`/"atLeast" or "nearest". */
|
|
252
|
+
fit: {
|
|
253
|
+
type: PropType<FitProp>;
|
|
254
|
+
default: boolean;
|
|
255
|
+
};
|
|
256
|
+
fill: PropType<FillSource>;
|
|
257
|
+
stroke: StringConstructor;
|
|
258
|
+
strokeWidth: NumberConstructor;
|
|
259
|
+
background: StringConstructor;
|
|
260
|
+
backdrop: StringConstructor;
|
|
261
|
+
relief: {
|
|
262
|
+
type: PropType<boolean | ReliefOptions>;
|
|
263
|
+
default: boolean;
|
|
264
|
+
};
|
|
265
|
+
title: StringConstructor;
|
|
266
|
+
imageAlts: PropType<readonly string[]>;
|
|
267
|
+
precision: NumberConstructor;
|
|
268
|
+
}>> & Readonly<{}>, {
|
|
269
|
+
fit: FitProp;
|
|
270
|
+
relief: boolean | ReliefOptions;
|
|
271
|
+
repeatImages: boolean;
|
|
272
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* A layout from options (a ref, a getter or a plain object), worked out again only when
|
|
276
|
+
* they change by value.
|
|
277
|
+
*/
|
|
278
|
+
declare function useTileLayout(options: MaybeRefOrGetter<LayoutOptions>): ComputedRef<Layout>;
|
|
279
|
+
/** A layout whose tiles are sized to give about `count` usable cells (see `fitCount`). */
|
|
280
|
+
declare function useFitCount(options: MaybeRefOrGetter<LayoutOptions>, count: MaybeRefOrGetter<number>, fit?: FitOptions): ComputedRef<Layout>;
|
|
281
|
+
|
|
282
|
+
export { SvgTileLayout, TileLayout, useFitCount, useTileLayout };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, VNode, MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
3
|
+
import { LayoutOptions, Layout, ContentCells, ContentPlacement, Focus, Cell, FitOptions } from '@andamento/core';
|
|
4
|
+
export { Cell, ContentCells, ContentPlacement, HitOptions, Layout, LayoutOptions } from '@andamento/core';
|
|
5
|
+
import { SafeAreaProp, FitProp, PerCell, StyleMap, CellState } from '@andamento/dom';
|
|
6
|
+
export { CellState, FillSource, FitProp, PerCell, PointerLike, ReliefOptions, StyleMap, cellFromPointer, coverStyle, defaultPalette, neutralPalette } from '@andamento/dom';
|
|
7
|
+
import { FillSource, ReliefOptions, ImageSource } from '@andamento/svg';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A tiling as HTML: one absolutely positioned, `clip-path`-ed element per tile, holding
|
|
11
|
+
* whatever you put in it. Each top-level child of the default slot fills one tile, in
|
|
12
|
+
* reading order (`v-for` children count one each). Or use the `cell` slot, given
|
|
13
|
+
* `{ cell, slot }`, to fill every tile. Sized in percentages, so it scales with its width.
|
|
14
|
+
*
|
|
15
|
+
* Slots: default (the items), `cell` (instead of items), `fallback` (empty tiles, given
|
|
16
|
+
* `{ cell, state }`) and `backdrop` (one picture across all the tiles). Emits
|
|
17
|
+
* `cell-activate` with `(cell, state)`. Props match the React `<TileLayout>`.
|
|
18
|
+
*/
|
|
19
|
+
declare const TileLayout: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
20
|
+
/** Layout options; or pass a precomputed `layout` instead. */
|
|
21
|
+
options: PropType<LayoutOptions>;
|
|
22
|
+
layout: PropType<Layout>;
|
|
23
|
+
/** Which tiles may hold items: "all" (default), "whole" or a test per cell. */
|
|
24
|
+
contentCells: PropType<ContentCells>;
|
|
25
|
+
/** Where items go when there are fewer than tiles: "reading" (default), "center" or "spread". */
|
|
26
|
+
placement: PropType<ContentPlacement>;
|
|
27
|
+
/** Width / height of each item, to put items in tiles of similar shape. */
|
|
28
|
+
aspects: PropType<readonly number[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Focal point of each child (fractions of its width and height; see `estimateFocus`): what
|
|
31
|
+
* a photo keeps in view as its tile crops it. Each tile sets `--andamento-object-position`,
|
|
32
|
+
* which `coverStyle` uses as `object-position`; exact when the photo's shape is known (`aspects`, or the focus's `aspect`).
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* How many tiles each item spans (1 for an ordinary item): heavier items get featured
|
|
36
|
+
* tiles where they fall in reading order (see `weightedLayout`). Needs `options`.
|
|
37
|
+
*/
|
|
38
|
+
weights: PropType<readonly number[]>;
|
|
39
|
+
focalPoints: PropType<readonly (Focus | undefined)[]>;
|
|
40
|
+
/** With `aspects`: "shape" also picks which tiles hold items by their shape. */
|
|
41
|
+
choose: PropType<"placement" | "shape">;
|
|
42
|
+
/**
|
|
43
|
+
* Put each tile's content in the tile's safe area (see `safeArea`). For tiles an
|
|
44
|
+
* `edges: "window"` layout cuts, `true` or "tile" fits the whole tile, "visible" the part that shows.
|
|
45
|
+
*/
|
|
46
|
+
safeArea: {
|
|
47
|
+
type: PropType<SafeAreaProp>;
|
|
48
|
+
default: boolean;
|
|
49
|
+
};
|
|
50
|
+
/** Color of empty tiles: a color, a palette or a function per cell. Defaults to `neutralPalette`. */
|
|
51
|
+
fill: PropType<FillSource>;
|
|
52
|
+
/** Size the tiles to the items: `true`/"atLeast" or "nearest". */
|
|
53
|
+
fit: {
|
|
54
|
+
type: PropType<FitProp>;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
/** Raised tiles: a lit bevel and optional shadow. `true` for the defaults. */
|
|
58
|
+
relief: {
|
|
59
|
+
type: PropType<boolean | ReliefOptions>;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
/** Arrow-key navigation over the tiles with content, as one tab stop. */
|
|
63
|
+
navigable: BooleanConstructor;
|
|
64
|
+
/** Accessible name for each tile. */
|
|
65
|
+
cellLabel: PropType<PerCell<string | undefined>>;
|
|
66
|
+
/** Focus ring color, or `false` for none. */
|
|
67
|
+
focusRing: {
|
|
68
|
+
type: PropType<string | false>;
|
|
69
|
+
default: string;
|
|
70
|
+
};
|
|
71
|
+
/** Animate layout and content changes. `true` for 400 ms, or `{ duration, easing }`. */
|
|
72
|
+
animate: {
|
|
73
|
+
type: PropType<boolean | {
|
|
74
|
+
duration?: number;
|
|
75
|
+
easing?: string;
|
|
76
|
+
}>;
|
|
77
|
+
default: boolean;
|
|
78
|
+
};
|
|
79
|
+
/** Only mount the tiles in view (plus `overscan` pixels, default 300). */
|
|
80
|
+
virtualize: {
|
|
81
|
+
type: PropType<boolean | {
|
|
82
|
+
overscan?: number;
|
|
83
|
+
}>;
|
|
84
|
+
default: boolean;
|
|
85
|
+
};
|
|
86
|
+
/** Class for each tile element. */
|
|
87
|
+
cellClass: PropType<PerCell<unknown>>;
|
|
88
|
+
/** Extra style for each tile element. */
|
|
89
|
+
cellStyle: PropType<PerCell<StyleMap | undefined>>;
|
|
90
|
+
/** Color painted across the whole region, visible through the gaps. */
|
|
91
|
+
background: StringConstructor;
|
|
92
|
+
role: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: string;
|
|
95
|
+
};
|
|
96
|
+
/** Called when a tile with content is clicked, or Enter / Space pressed on it. Bind with `@cell-activate`. */
|
|
97
|
+
onCellActivate: PropType<(cell: Cell, state: CellState) => void>;
|
|
98
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
99
|
+
[key: string]: any;
|
|
100
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
101
|
+
/** Layout options; or pass a precomputed `layout` instead. */
|
|
102
|
+
options: PropType<LayoutOptions>;
|
|
103
|
+
layout: PropType<Layout>;
|
|
104
|
+
/** Which tiles may hold items: "all" (default), "whole" or a test per cell. */
|
|
105
|
+
contentCells: PropType<ContentCells>;
|
|
106
|
+
/** Where items go when there are fewer than tiles: "reading" (default), "center" or "spread". */
|
|
107
|
+
placement: PropType<ContentPlacement>;
|
|
108
|
+
/** Width / height of each item, to put items in tiles of similar shape. */
|
|
109
|
+
aspects: PropType<readonly number[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Focal point of each child (fractions of its width and height; see `estimateFocus`): what
|
|
112
|
+
* a photo keeps in view as its tile crops it. Each tile sets `--andamento-object-position`,
|
|
113
|
+
* which `coverStyle` uses as `object-position`; exact when the photo's shape is known (`aspects`, or the focus's `aspect`).
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* How many tiles each item spans (1 for an ordinary item): heavier items get featured
|
|
117
|
+
* tiles where they fall in reading order (see `weightedLayout`). Needs `options`.
|
|
118
|
+
*/
|
|
119
|
+
weights: PropType<readonly number[]>;
|
|
120
|
+
focalPoints: PropType<readonly (Focus | undefined)[]>;
|
|
121
|
+
/** With `aspects`: "shape" also picks which tiles hold items by their shape. */
|
|
122
|
+
choose: PropType<"placement" | "shape">;
|
|
123
|
+
/**
|
|
124
|
+
* Put each tile's content in the tile's safe area (see `safeArea`). For tiles an
|
|
125
|
+
* `edges: "window"` layout cuts, `true` or "tile" fits the whole tile, "visible" the part that shows.
|
|
126
|
+
*/
|
|
127
|
+
safeArea: {
|
|
128
|
+
type: PropType<SafeAreaProp>;
|
|
129
|
+
default: boolean;
|
|
130
|
+
};
|
|
131
|
+
/** Color of empty tiles: a color, a palette or a function per cell. Defaults to `neutralPalette`. */
|
|
132
|
+
fill: PropType<FillSource>;
|
|
133
|
+
/** Size the tiles to the items: `true`/"atLeast" or "nearest". */
|
|
134
|
+
fit: {
|
|
135
|
+
type: PropType<FitProp>;
|
|
136
|
+
default: boolean;
|
|
137
|
+
};
|
|
138
|
+
/** Raised tiles: a lit bevel and optional shadow. `true` for the defaults. */
|
|
139
|
+
relief: {
|
|
140
|
+
type: PropType<boolean | ReliefOptions>;
|
|
141
|
+
default: boolean;
|
|
142
|
+
};
|
|
143
|
+
/** Arrow-key navigation over the tiles with content, as one tab stop. */
|
|
144
|
+
navigable: BooleanConstructor;
|
|
145
|
+
/** Accessible name for each tile. */
|
|
146
|
+
cellLabel: PropType<PerCell<string | undefined>>;
|
|
147
|
+
/** Focus ring color, or `false` for none. */
|
|
148
|
+
focusRing: {
|
|
149
|
+
type: PropType<string | false>;
|
|
150
|
+
default: string;
|
|
151
|
+
};
|
|
152
|
+
/** Animate layout and content changes. `true` for 400 ms, or `{ duration, easing }`. */
|
|
153
|
+
animate: {
|
|
154
|
+
type: PropType<boolean | {
|
|
155
|
+
duration?: number;
|
|
156
|
+
easing?: string;
|
|
157
|
+
}>;
|
|
158
|
+
default: boolean;
|
|
159
|
+
};
|
|
160
|
+
/** Only mount the tiles in view (plus `overscan` pixels, default 300). */
|
|
161
|
+
virtualize: {
|
|
162
|
+
type: PropType<boolean | {
|
|
163
|
+
overscan?: number;
|
|
164
|
+
}>;
|
|
165
|
+
default: boolean;
|
|
166
|
+
};
|
|
167
|
+
/** Class for each tile element. */
|
|
168
|
+
cellClass: PropType<PerCell<unknown>>;
|
|
169
|
+
/** Extra style for each tile element. */
|
|
170
|
+
cellStyle: PropType<PerCell<StyleMap | undefined>>;
|
|
171
|
+
/** Color painted across the whole region, visible through the gaps. */
|
|
172
|
+
background: StringConstructor;
|
|
173
|
+
role: {
|
|
174
|
+
type: StringConstructor;
|
|
175
|
+
default: string;
|
|
176
|
+
};
|
|
177
|
+
/** Called when a tile with content is clicked, or Enter / Space pressed on it. Bind with `@cell-activate`. */
|
|
178
|
+
onCellActivate: PropType<(cell: Cell, state: CellState) => void>;
|
|
179
|
+
}>> & Readonly<{}>, {
|
|
180
|
+
navigable: boolean;
|
|
181
|
+
safeArea: SafeAreaProp;
|
|
182
|
+
fit: FitProp;
|
|
183
|
+
relief: boolean | ReliefOptions;
|
|
184
|
+
focusRing: string | false;
|
|
185
|
+
animate: boolean | {
|
|
186
|
+
duration?: number;
|
|
187
|
+
easing?: string;
|
|
188
|
+
};
|
|
189
|
+
virtualize: boolean | {
|
|
190
|
+
overscan?: number;
|
|
191
|
+
};
|
|
192
|
+
role: string;
|
|
193
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A tiling as a single <svg>: colored cells, optionally with images clipped to each cell.
|
|
197
|
+
* Use it for pure SVG (export, print, embedding in other SVG); use `<TileLayout>` for
|
|
198
|
+
* arbitrary content. Takes the options of `renderToString` from @andamento/svg as props.
|
|
199
|
+
*/
|
|
200
|
+
declare const SvgTileLayout: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
201
|
+
options: PropType<LayoutOptions>;
|
|
202
|
+
layout: PropType<Layout>;
|
|
203
|
+
images: PropType<ImageSource>;
|
|
204
|
+
repeatImages: BooleanConstructor;
|
|
205
|
+
contentCells: PropType<ContentCells>;
|
|
206
|
+
placement: PropType<ContentPlacement>;
|
|
207
|
+
imageAspects: PropType<readonly number[]>;
|
|
208
|
+
choose: PropType<"placement" | "shape">;
|
|
209
|
+
imageFit: PropType<"cover" | "contain">;
|
|
210
|
+
containWithin: PropType<"tile" | "visible">;
|
|
211
|
+
imageWeights: PropType<readonly number[]>;
|
|
212
|
+
imageFocus: PropType<readonly ({
|
|
213
|
+
x: number;
|
|
214
|
+
y: number;
|
|
215
|
+
} | undefined)[]>;
|
|
216
|
+
/** Size the tiles to the `images` array: `true`/"atLeast" or "nearest". */
|
|
217
|
+
fit: {
|
|
218
|
+
type: PropType<FitProp>;
|
|
219
|
+
default: boolean;
|
|
220
|
+
};
|
|
221
|
+
fill: PropType<FillSource>;
|
|
222
|
+
stroke: StringConstructor;
|
|
223
|
+
strokeWidth: NumberConstructor;
|
|
224
|
+
background: StringConstructor;
|
|
225
|
+
backdrop: StringConstructor;
|
|
226
|
+
relief: {
|
|
227
|
+
type: PropType<boolean | ReliefOptions>;
|
|
228
|
+
default: boolean;
|
|
229
|
+
};
|
|
230
|
+
title: StringConstructor;
|
|
231
|
+
imageAlts: PropType<readonly string[]>;
|
|
232
|
+
precision: NumberConstructor;
|
|
233
|
+
}>, () => string | VNode<vue.RendererNode, vue.RendererElement, {
|
|
234
|
+
[key: string]: any;
|
|
235
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
236
|
+
options: PropType<LayoutOptions>;
|
|
237
|
+
layout: PropType<Layout>;
|
|
238
|
+
images: PropType<ImageSource>;
|
|
239
|
+
repeatImages: BooleanConstructor;
|
|
240
|
+
contentCells: PropType<ContentCells>;
|
|
241
|
+
placement: PropType<ContentPlacement>;
|
|
242
|
+
imageAspects: PropType<readonly number[]>;
|
|
243
|
+
choose: PropType<"placement" | "shape">;
|
|
244
|
+
imageFit: PropType<"cover" | "contain">;
|
|
245
|
+
containWithin: PropType<"tile" | "visible">;
|
|
246
|
+
imageWeights: PropType<readonly number[]>;
|
|
247
|
+
imageFocus: PropType<readonly ({
|
|
248
|
+
x: number;
|
|
249
|
+
y: number;
|
|
250
|
+
} | undefined)[]>;
|
|
251
|
+
/** Size the tiles to the `images` array: `true`/"atLeast" or "nearest". */
|
|
252
|
+
fit: {
|
|
253
|
+
type: PropType<FitProp>;
|
|
254
|
+
default: boolean;
|
|
255
|
+
};
|
|
256
|
+
fill: PropType<FillSource>;
|
|
257
|
+
stroke: StringConstructor;
|
|
258
|
+
strokeWidth: NumberConstructor;
|
|
259
|
+
background: StringConstructor;
|
|
260
|
+
backdrop: StringConstructor;
|
|
261
|
+
relief: {
|
|
262
|
+
type: PropType<boolean | ReliefOptions>;
|
|
263
|
+
default: boolean;
|
|
264
|
+
};
|
|
265
|
+
title: StringConstructor;
|
|
266
|
+
imageAlts: PropType<readonly string[]>;
|
|
267
|
+
precision: NumberConstructor;
|
|
268
|
+
}>> & Readonly<{}>, {
|
|
269
|
+
fit: FitProp;
|
|
270
|
+
relief: boolean | ReliefOptions;
|
|
271
|
+
repeatImages: boolean;
|
|
272
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* A layout from options (a ref, a getter or a plain object), worked out again only when
|
|
276
|
+
* they change by value.
|
|
277
|
+
*/
|
|
278
|
+
declare function useTileLayout(options: MaybeRefOrGetter<LayoutOptions>): ComputedRef<Layout>;
|
|
279
|
+
/** A layout whose tiles are sized to give about `count` usable cells (see `fitCount`). */
|
|
280
|
+
declare function useFitCount(options: MaybeRefOrGetter<LayoutOptions>, count: MaybeRefOrGetter<number>, fit?: FitOptions): ComputedRef<Layout>;
|
|
281
|
+
|
|
282
|
+
export { SvgTileLayout, TileLayout, useFitCount, useTileLayout };
|