@mrpelz/uikit-ish 7.13.1 → 7.26.2
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/components/accordion/style.css +1 -1
- package/dist/components/action-sheet/main.d.ts.map +1 -1
- package/dist/components/action-sheet/main.js +9 -6
- package/dist/components/action-sheet/main.js.map +1 -1
- package/dist/components/action-sheet/props.d.ts +2 -1
- package/dist/components/action-sheet/props.d.ts.map +1 -1
- package/dist/components/alert/main.d.ts.map +1 -1
- package/dist/components/alert/main.js +12 -4
- package/dist/components/alert/main.js.map +1 -1
- package/dist/components/alert/props.d.ts +2 -1
- package/dist/components/alert/props.d.ts.map +1 -1
- package/dist/components/alert/style.css +27 -5
- package/dist/components/button/main.js +1 -1
- package/dist/components/button/main.js.map +1 -1
- package/dist/components/button/props.d.ts +3 -2
- package/dist/components/button/props.d.ts.map +1 -1
- package/dist/components/button/style.css +6 -17
- package/dist/components/card/main.d.ts +53 -0
- package/dist/components/card/main.d.ts.map +1 -0
- package/dist/components/card/main.js +286 -0
- package/dist/components/card/main.js.map +1 -0
- package/dist/components/card/props.d.ts +83 -0
- package/dist/components/card/props.d.ts.map +1 -0
- package/dist/components/card/props.js +2 -0
- package/dist/components/card/props.js.map +1 -0
- package/dist/components/card/style.css +900 -0
- package/dist/components/collapsible/style.css +1 -1
- package/dist/components/color-picker/main.d.ts.map +1 -1
- package/dist/components/color-picker/main.js +20 -33
- package/dist/components/color-picker/main.js.map +1 -1
- package/dist/components/color-picker/style.css +4 -23
- package/dist/components/contextual-menu/main.d.ts +6 -2
- package/dist/components/contextual-menu/main.d.ts.map +1 -1
- package/dist/components/contextual-menu/main.js +67 -43
- package/dist/components/contextual-menu/main.js.map +1 -1
- package/dist/components/contextual-menu/props.d.ts +2 -1
- package/dist/components/contextual-menu/props.d.ts.map +1 -1
- package/dist/components/contextual-menu/style.css +64 -2
- package/dist/components/control-cards/main.d.ts +49 -0
- package/dist/components/control-cards/main.d.ts.map +1 -0
- package/dist/components/control-cards/main.js +835 -0
- package/dist/components/control-cards/main.js.map +1 -0
- package/dist/components/control-cards/props.d.ts +409 -0
- package/dist/components/control-cards/props.d.ts.map +1 -0
- package/dist/components/control-cards/props.js +2 -0
- package/dist/components/control-cards/props.js.map +1 -0
- package/dist/components/control-cards/style.css +492 -0
- package/dist/components/date-picker/main.d.ts.map +1 -1
- package/dist/components/date-picker/main.js +3 -2
- package/dist/components/date-picker/main.js.map +1 -1
- package/dist/components/date-picker/style.css +1 -1
- package/dist/components/drawer/style.css +6 -0
- package/dist/components/edit-menu/main.d.ts +2 -1
- package/dist/components/edit-menu/main.d.ts.map +1 -1
- package/dist/components/edit-menu/main.js +8 -4
- package/dist/components/edit-menu/main.js.map +1 -1
- package/dist/components/glass/backdrop.d.ts +75 -0
- package/dist/components/glass/backdrop.d.ts.map +1 -0
- package/dist/components/glass/backdrop.js +608 -0
- package/dist/components/glass/backdrop.js.map +1 -0
- package/dist/components/glass/gradient.d.ts +17 -0
- package/dist/components/glass/gradient.d.ts.map +1 -0
- package/dist/components/glass/gradient.js +233 -0
- package/dist/components/glass/gradient.js.map +1 -0
- package/dist/components/glass/main.d.ts +60 -6
- package/dist/components/glass/main.d.ts.map +1 -1
- package/dist/components/glass/main.js +100 -122
- package/dist/components/glass/main.js.map +1 -1
- package/dist/components/glass/marker.d.ts +66 -0
- package/dist/components/glass/marker.d.ts.map +1 -0
- package/dist/components/glass/marker.js +268 -0
- package/dist/components/glass/marker.js.map +1 -0
- package/dist/components/glass/props.d.ts +33 -7
- package/dist/components/glass/props.d.ts.map +1 -1
- package/dist/components/glass/style.css +139 -75
- package/dist/components/grid/dashes.d.ts +15 -0
- package/dist/components/grid/dashes.d.ts.map +1 -0
- package/dist/components/grid/dashes.js +37 -0
- package/dist/components/grid/dashes.js.map +1 -0
- package/dist/components/grid/edit.d.ts +11 -0
- package/dist/components/grid/edit.d.ts.map +1 -0
- package/dist/components/grid/edit.js +1066 -0
- package/dist/components/grid/edit.js.map +1 -0
- package/dist/components/grid/handle.d.ts +123 -0
- package/dist/components/grid/handle.d.ts.map +1 -0
- package/dist/components/grid/handle.js +194 -0
- package/dist/components/grid/handle.js.map +1 -0
- package/dist/components/grid/icons.d.ts +40 -0
- package/dist/components/grid/icons.d.ts.map +1 -0
- package/dist/components/grid/icons.js +140 -0
- package/dist/components/grid/icons.js.map +1 -0
- package/dist/components/grid/layout.d.ts +111 -0
- package/dist/components/grid/layout.d.ts.map +1 -0
- package/dist/components/grid/layout.js +1257 -0
- package/dist/components/grid/layout.js.map +1 -0
- package/dist/components/grid/main.d.ts +63 -0
- package/dist/components/grid/main.d.ts.map +1 -0
- package/dist/components/grid/main.js +1894 -0
- package/dist/components/grid/main.js.map +1 -0
- package/dist/components/grid/overlay.d.ts +24 -0
- package/dist/components/grid/overlay.d.ts.map +1 -0
- package/dist/components/grid/overlay.js +312 -0
- package/dist/components/grid/overlay.js.map +1 -0
- package/dist/components/grid/plan.d.ts +78 -0
- package/dist/components/grid/plan.d.ts.map +1 -0
- package/dist/components/grid/plan.js +249 -0
- package/dist/components/grid/plan.js.map +1 -0
- package/dist/components/grid/props.d.ts +509 -0
- package/dist/components/grid/props.d.ts.map +1 -0
- package/dist/components/grid/props.js +2 -0
- package/dist/components/grid/props.js.map +1 -0
- package/dist/components/grid/reshape.d.ts +60 -0
- package/dist/components/grid/reshape.d.ts.map +1 -0
- package/dist/components/grid/reshape.js +214 -0
- package/dist/components/grid/reshape.js.map +1 -0
- package/dist/components/grid/style.css +1293 -0
- package/dist/components/header/main.d.ts.map +1 -1
- package/dist/components/header/main.js +97 -10
- package/dist/components/header/main.js.map +1 -1
- package/dist/components/header/props.d.ts +2 -2
- package/dist/components/header/props.d.ts.map +1 -1
- package/dist/components/header/style.css +28 -43
- package/dist/components/index.d.ts +10 -6
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/island/main.d.ts +2 -2
- package/dist/components/island/main.d.ts.map +1 -1
- package/dist/components/island/main.js +193 -41
- package/dist/components/island/main.js.map +1 -1
- package/dist/components/island/props.d.ts +4 -2
- package/dist/components/island/props.d.ts.map +1 -1
- package/dist/components/island/style.css +50 -3
- package/dist/components/layout/main.d.ts +3 -6
- package/dist/components/layout/main.d.ts.map +1 -1
- package/dist/components/layout/main.js +225 -56
- package/dist/components/layout/main.js.map +1 -1
- package/dist/components/layout/props.d.ts +43 -2
- package/dist/components/layout/props.d.ts.map +1 -1
- package/dist/components/layout/style.css +84 -23
- package/dist/components/list/main.d.ts +3 -3
- package/dist/components/list/main.d.ts.map +1 -1
- package/dist/components/list/main.js +90 -19
- package/dist/components/list/main.js.map +1 -1
- package/dist/components/list/props.d.ts +20 -0
- package/dist/components/list/props.d.ts.map +1 -1
- package/dist/components/list/reorder.d.ts +16 -2
- package/dist/components/list/reorder.d.ts.map +1 -1
- package/dist/components/list/reorder.js.map +1 -1
- package/dist/components/list/style.css +60 -3
- package/dist/components/menu/main.d.ts +9 -5
- package/dist/components/menu/main.d.ts.map +1 -1
- package/dist/components/menu/main.js +87 -9
- package/dist/components/menu/main.js.map +1 -1
- package/dist/components/menu/props.d.ts +14 -0
- package/dist/components/menu/props.d.ts.map +1 -1
- package/dist/components/menu/style.css +3 -1
- package/dist/components/page/main.d.ts.map +1 -1
- package/dist/components/page/main.js +6 -3
- package/dist/components/page/main.js.map +1 -1
- package/dist/components/page/props.d.ts +3 -2
- package/dist/components/page/props.d.ts.map +1 -1
- package/dist/components/page/style.css +8 -4
- package/dist/components/page-control/props.d.ts +3 -3
- package/dist/components/popover/main.d.ts +10 -4
- package/dist/components/popover/main.d.ts.map +1 -1
- package/dist/components/popover/main.js +30 -19
- package/dist/components/popover/main.js.map +1 -1
- package/dist/components/popover/props.d.ts +2 -0
- package/dist/components/popover/props.d.ts.map +1 -1
- package/dist/components/popover/style.css +6 -2
- package/dist/components/progress/style.css +2 -2
- package/dist/components/roll/main.d.ts.map +1 -1
- package/dist/components/roll/main.js +5 -3
- package/dist/components/roll/main.js.map +1 -1
- package/dist/components/segmented/main.d.ts.map +1 -1
- package/dist/components/segmented/main.js +4 -4
- package/dist/components/segmented/main.js.map +1 -1
- package/dist/components/segmented/props.d.ts +5 -2
- package/dist/components/segmented/props.d.ts.map +1 -1
- package/dist/components/segmented/style.css +1 -1
- package/dist/components/settings/main.d.ts +13 -0
- package/dist/components/settings/main.d.ts.map +1 -1
- package/dist/components/settings/main.js +16 -0
- package/dist/components/settings/main.js.map +1 -1
- package/dist/components/settings/props.d.ts +1 -0
- package/dist/components/settings/props.d.ts.map +1 -1
- package/dist/components/sheet/main.d.ts.map +1 -1
- package/dist/components/sheet/main.js +156 -45
- package/dist/components/sheet/main.js.map +1 -1
- package/dist/components/sheet/props.d.ts +4 -2
- package/dist/components/sheet/props.d.ts.map +1 -1
- package/dist/components/sheet/snap.d.ts +54 -0
- package/dist/components/sheet/snap.d.ts.map +1 -1
- package/dist/components/sheet/snap.js +253 -23
- package/dist/components/sheet/snap.js.map +1 -1
- package/dist/components/sheet/style.css +126 -20
- package/dist/components/sidebar/main.d.ts +2 -1
- package/dist/components/sidebar/main.d.ts.map +1 -1
- package/dist/components/sidebar/main.js +18 -6
- package/dist/components/sidebar/main.js.map +1 -1
- package/dist/components/sidebar/props.d.ts +2 -1
- package/dist/components/sidebar/props.d.ts.map +1 -1
- package/dist/components/sidebar/style.css +78 -0
- package/dist/components/slider/main.d.ts.map +1 -1
- package/dist/components/slider/main.js +51 -9
- package/dist/components/slider/main.js.map +1 -1
- package/dist/components/slider/props.d.ts +1 -0
- package/dist/components/slider/props.d.ts.map +1 -1
- package/dist/components/slider/style.css +9 -0
- package/dist/components/switch/main.d.ts.map +1 -1
- package/dist/components/switch/main.js +4 -2
- package/dist/components/switch/main.js.map +1 -1
- package/dist/components/symbol/main.d.ts.map +1 -1
- package/dist/components/symbol/main.js +5 -1
- package/dist/components/symbol/main.js.map +1 -1
- package/dist/components/symbol/props.d.ts +10 -0
- package/dist/components/symbol/props.d.ts.map +1 -1
- package/dist/components/symbol/style.css +21 -3
- package/dist/components/tab-bar/main.d.ts.map +1 -1
- package/dist/components/tab-bar/main.js +8 -5
- package/dist/components/tab-bar/main.js.map +1 -1
- package/dist/components/tab-bar/props.d.ts +16 -12
- package/dist/components/tab-bar/props.d.ts.map +1 -1
- package/dist/components/tab-bar/style.css +3 -9
- package/dist/components/text-field/main.d.ts.map +1 -1
- package/dist/components/text-field/main.js +6 -3
- package/dist/components/text-field/main.js.map +1 -1
- package/dist/components/text-field/style.css +1 -1
- package/dist/components/toolbar/main.js +1 -1
- package/dist/components/toolbar/main.js.map +1 -1
- package/dist/components/toolbar/props.d.ts +3 -3
- package/dist/components/toolbar/style.css +1 -1
- package/dist/components/tooltip/main.d.ts +6 -1
- package/dist/components/tooltip/main.d.ts.map +1 -1
- package/dist/components/tooltip/main.js +13 -7
- package/dist/components/tooltip/main.js.map +1 -1
- package/dist/components/utils/main.d.ts +31 -2
- package/dist/components/utils/main.d.ts.map +1 -1
- package/dist/components/utils/main.js +60 -3
- package/dist/components/utils/main.js.map +1 -1
- package/dist/components/viewport/current.d.ts +15 -0
- package/dist/components/viewport/current.d.ts.map +1 -0
- package/dist/components/viewport/current.js +74 -0
- package/dist/components/viewport/current.js.map +1 -0
- package/dist/components/viewport/edge-effect.d.ts.map +1 -1
- package/dist/components/viewport/edge-effect.js +52 -24
- package/dist/components/viewport/edge-effect.js.map +1 -1
- package/dist/components/viewport/edge.d.ts +7 -4
- package/dist/components/viewport/edge.d.ts.map +1 -1
- package/dist/components/viewport/edge.js +21 -7
- package/dist/components/viewport/edge.js.map +1 -1
- package/dist/components/viewport/focus-scroll.d.ts +21 -0
- package/dist/components/viewport/focus-scroll.d.ts.map +1 -0
- package/dist/components/viewport/focus-scroll.js +272 -0
- package/dist/components/viewport/focus-scroll.js.map +1 -0
- package/dist/components/viewport/input.d.ts +39 -1
- package/dist/components/viewport/input.d.ts.map +1 -1
- package/dist/components/viewport/input.js +122 -13
- package/dist/components/viewport/input.js.map +1 -1
- package/dist/components/viewport/main.d.ts +16 -1
- package/dist/components/viewport/main.d.ts.map +1 -1
- package/dist/components/viewport/main.js +243 -49
- package/dist/components/viewport/main.js.map +1 -1
- package/dist/components/viewport/padding.d.ts +1 -1
- package/dist/components/viewport/padding.d.ts.map +1 -1
- package/dist/components/viewport/padding.js +2 -2
- package/dist/components/viewport/props.d.ts +12 -2
- package/dist/components/viewport/props.d.ts.map +1 -1
- package/dist/components/viewport/status-bar.d.ts +9 -0
- package/dist/components/viewport/status-bar.d.ts.map +1 -0
- package/dist/components/viewport/status-bar.js +131 -0
- package/dist/components/viewport/status-bar.js.map +1 -0
- package/dist/components/viewport/style.css +62 -5
- package/dist/styles.css +123 -198
- package/package.json +5 -4
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import type { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import type { SymbolIcon } from '../symbol/main.js';
|
|
4
|
+
import type { GridReorderHandle } from './handle.js';
|
|
5
|
+
/**
|
|
6
|
+
* A span: columns by rows (e.g. `'2x1'`: wide, one row); `*` for columns:
|
|
7
|
+
* as wide as the grid, however many columns it has (e.g. `'*x2'`: a full
|
|
8
|
+
* width, two rows). Any numbers: the grid holds them to its own (wider
|
|
9
|
+
* than its columns: the widest supported that fits; taller than its
|
|
10
|
+
* `maxTileRows`: not offered).
|
|
11
|
+
*/
|
|
12
|
+
export type GridSize = `${number}x${number}` | `*x${number}`;
|
|
13
|
+
/**
|
|
14
|
+
* Where a tile sits in its area (see `GridItemProps.area`): in its middle
|
|
15
|
+
* (truly, off the unit lines if need be), or a corner of it on the area's.
|
|
16
|
+
*/
|
|
17
|
+
export type GridPlacement = 'bottom-leading' | 'bottom-trailing' | 'center' | 'top-leading' | 'top-trailing';
|
|
18
|
+
/** Where cells drop (see `GridReorderTarget`). */
|
|
19
|
+
export type GridReorderPart = 'DropGroup' | 'Root' | 'Section';
|
|
20
|
+
/** A moved cell: its `dropName`, its index among the handle's cells. */
|
|
21
|
+
export type GridReorderItem = {
|
|
22
|
+
/** Among the handle's cells, in document order (before moving). */
|
|
23
|
+
index: number;
|
|
24
|
+
name?: string;
|
|
25
|
+
};
|
|
26
|
+
/** Where a cell is dropped: a gap in a range of cells (as List's). */
|
|
27
|
+
export type GridReorderTarget = {
|
|
28
|
+
/**
|
|
29
|
+
* Cells to add right after the moved one (see `GridReorderInsert`), so
|
|
30
|
+
* what follows stays where it was (e.g. a break keeping the rest of a
|
|
31
|
+
* shortened break's rows empty).
|
|
32
|
+
*/
|
|
33
|
+
addAfter?: readonly GridReorderInsert[];
|
|
34
|
+
/**
|
|
35
|
+
* Cells to add right before the moved one (see `GridReorderInsert`), so
|
|
36
|
+
* it lands where it was dropped (e.g. a break, so it starts a row; spacers
|
|
37
|
+
* left of it).
|
|
38
|
+
*/
|
|
39
|
+
addBefore?: readonly GridReorderInsert[];
|
|
40
|
+
/** The `dropName` of the cell before the gap (not the moved one). */
|
|
41
|
+
after?: string;
|
|
42
|
+
/** The `dropName` of the cell after the gap (not the moved one). */
|
|
43
|
+
before?: string;
|
|
44
|
+
/** Among the handle's gaps, in document order. */
|
|
45
|
+
flat: number;
|
|
46
|
+
/** The gap within its `Section`, `Root` or `DropGroup`. */
|
|
47
|
+
index: number;
|
|
48
|
+
/** Its `Section`'s, `Root`'s or `DropGroup`'s `dropName`. */
|
|
49
|
+
name?: string;
|
|
50
|
+
part: GridReorderPart;
|
|
51
|
+
/**
|
|
52
|
+
* A break before the gap to have fewer (or more) rows, by its
|
|
53
|
+
* `dropName`: dropped in the rows it keeps empty, ending above them.
|
|
54
|
+
*/
|
|
55
|
+
resize?: {
|
|
56
|
+
name: string;
|
|
57
|
+
rows: GridBreakRows;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* A cell to add with a move (its handle's `breaks`, `spacers`): a break of
|
|
62
|
+
* some rows, or a spacer of a size (see `Grid.reorder`).
|
|
63
|
+
*/
|
|
64
|
+
export type GridReorderInsert = {
|
|
65
|
+
kind: 'break';
|
|
66
|
+
rows: GridBreakRows;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'spacer';
|
|
69
|
+
size: GridSize;
|
|
70
|
+
};
|
|
71
|
+
/** A cell moved to a target (see `GridReorderHandle`), as List's rows. */
|
|
72
|
+
export type GridReorderChange = {
|
|
73
|
+
/** The cell moved (one: the shape List's several share). */
|
|
74
|
+
items: readonly GridReorderItem[];
|
|
75
|
+
target: GridReorderTarget;
|
|
76
|
+
};
|
|
77
|
+
/** How a cell was moved: dragged, or by keyboard. */
|
|
78
|
+
export type GridReorderReason = 'drag' | 'keyboard';
|
|
79
|
+
export type GridReorderEventDetails = {
|
|
80
|
+
event: Event;
|
|
81
|
+
reason: GridReorderReason;
|
|
82
|
+
};
|
|
83
|
+
export type GridReorderHandleOptions = {
|
|
84
|
+
/**
|
|
85
|
+
* Breaks can be added and changed: a cell dropped where only a break gets
|
|
86
|
+
* it to (the start of a row the rows before would take it back from; in
|
|
87
|
+
* the rows a break keeps empty) asks for one (`target.addBefore`, `addAfter`)
|
|
88
|
+
* or a break's rows changed (`target.resize`). The app does it (e.g. by
|
|
89
|
+
* `Grid.reorder`).
|
|
90
|
+
*/
|
|
91
|
+
breaks?: boolean;
|
|
92
|
+
/** Called as a cell is dropped elsewhere: the app moves it in its data. */
|
|
93
|
+
onReorder?: (change: GridReorderChange, eventDetails: GridReorderEventDetails) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Spacers can be added: a cell dropped on an empty unit with free ones
|
|
96
|
+
* left of it (or, in a break's rows, right of it up to what's in the way)
|
|
97
|
+
* asks for spacers there (`target.addBefore`, `addAfter`), so it lands there and
|
|
98
|
+
* the rest stays.
|
|
99
|
+
*/
|
|
100
|
+
spacers?: boolean;
|
|
101
|
+
};
|
|
102
|
+
/** A cell's reordering: its handles (by priority), its name. */
|
|
103
|
+
type GridDraggableProps = {
|
|
104
|
+
/** Its name in reordering (see `GridReorderItem`, `GridReorderTarget`). */
|
|
105
|
+
dropName?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Handles moving it (see `Grid.createReorderHandle`): editing, dragged
|
|
108
|
+
* (or moved by keyboard) to where any of them is a target. None: it
|
|
109
|
+
* stays.
|
|
110
|
+
*/
|
|
111
|
+
reorderHandle?: GridReorderHandle | readonly GridReorderHandle[];
|
|
112
|
+
};
|
|
113
|
+
/** A range of cells' reordering: what's dropped among them, its name. */
|
|
114
|
+
type GridDropProps = {
|
|
115
|
+
/** Its name, the target's (see `GridReorderTarget`). */
|
|
116
|
+
dropName?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Handles whose cells can be dropped before, between and after its
|
|
119
|
+
* cells.
|
|
120
|
+
*/
|
|
121
|
+
reorderHandle?: GridReorderHandle | readonly GridReorderHandle[];
|
|
122
|
+
};
|
|
123
|
+
export type GridRootProps = ComponentProps<'div'> & GridDropProps & {
|
|
124
|
+
/**
|
|
125
|
+
* Later items fill earlier holes (CSS grid's `dense` placement), instead
|
|
126
|
+
* of each item after the one before it. Not while editing.
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
dense?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Edit mode: cells (items, spacers, breaks) with a `reorderHandle`
|
|
132
|
+
* moved by dragging them (or by keyboard: Alt and an arrow key), resized
|
|
133
|
+
* by their `ResizeHandle`s; what's in them not acted on otherwise.
|
|
134
|
+
* Spacers and breaks outlined.
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
editing?: boolean;
|
|
138
|
+
/** The gap between items (px). @default 12 */
|
|
139
|
+
gap?: number;
|
|
140
|
+
/**
|
|
141
|
+
* The most rows a tile has (sizes taller not shown, not offered), and
|
|
142
|
+
* a break keeps empty. Every item must support a size within
|
|
143
|
+
* `minColumns` and this.
|
|
144
|
+
* @default 3
|
|
145
|
+
*/
|
|
146
|
+
maxTileRows?: number;
|
|
147
|
+
/**
|
|
148
|
+
* The fewest columns it lays out, however narrow it is (its units
|
|
149
|
+
* shrinking below `unitMin` then). Every item must support a size this
|
|
150
|
+
* narrow or narrower, so a layout never breaks: wider sizes give way to
|
|
151
|
+
* the widest that fits.
|
|
152
|
+
* @default 3
|
|
153
|
+
*/
|
|
154
|
+
minColumns?: number;
|
|
155
|
+
/** The largest a unit stretches to (px). @default 130 */
|
|
156
|
+
unitMax?: number;
|
|
157
|
+
/** The smallest a unit shrinks to (px). @default 100 */
|
|
158
|
+
unitMin?: number;
|
|
159
|
+
/**
|
|
160
|
+
* A unit's size (px) to aim for: the columns as many as fit, each unit
|
|
161
|
+
* stretched (between `unitMin` and `unitMax`) to fill the width.
|
|
162
|
+
* @default 110
|
|
163
|
+
*/
|
|
164
|
+
unitSize?: number;
|
|
165
|
+
};
|
|
166
|
+
export type GridSectionProps = ComponentProps<'section'> & GridDropProps & {
|
|
167
|
+
/**
|
|
168
|
+
* Later items fill earlier holes (see the root's `dense`), for this
|
|
169
|
+
* section. Not while editing.
|
|
170
|
+
* @default the root's
|
|
171
|
+
*/
|
|
172
|
+
dense?: boolean;
|
|
173
|
+
};
|
|
174
|
+
export type GridHeaderProps = ComponentProps<'div'>;
|
|
175
|
+
/** A part of a section (no element): what's dropped among its cells. */
|
|
176
|
+
export type GridDropGroupProps = GridDropProps & {
|
|
177
|
+
children?: ReactNode;
|
|
178
|
+
};
|
|
179
|
+
/** How a size changed (see `onSizeChange`, `onRowsChange`). */
|
|
180
|
+
export type GridSizeChangeDetails = {
|
|
181
|
+
/**
|
|
182
|
+
* What it took in (their `dropName`s), growing over them: an item or a
|
|
183
|
+
* spacer, the spacers it reached; a break, the breaks right before and
|
|
184
|
+
* after it; either, the breaks (a break: also the spacers) wholly
|
|
185
|
+
* inside its new size. Only those named (their `dropName`) and
|
|
186
|
+
* removable (a `Grid.RemoveButton` in them; the others reflow, as
|
|
187
|
+
* items do), marked while it's resized. The app removes them.
|
|
188
|
+
*/
|
|
189
|
+
merged: readonly string[];
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Why an item opened above the page closed (see `GridItemProps.open`): a
|
|
193
|
+
* press on the backdrop, Escape, its grid starting edit mode, or the app
|
|
194
|
+
* (`setOpen`, e.g. a close button).
|
|
195
|
+
*/
|
|
196
|
+
export type GridOpenChangeReason = 'edit' | 'escape-key' | 'none' | 'outside-press';
|
|
197
|
+
/** What an item's open change was (see `GridItemProps.onOpenChange`). */
|
|
198
|
+
export type GridOpenChangeDetails = {
|
|
199
|
+
reason: GridOpenChangeReason;
|
|
200
|
+
};
|
|
201
|
+
export type GridItemProps = ComponentProps<'div'> & GridDraggableProps & {
|
|
202
|
+
/**
|
|
203
|
+
* What it shows, filling its tile (e.g. a card), its tile's controls
|
|
204
|
+
* (a `ResizeHandle`, a `RemoveButton`, an `AreaButton`); a `Grid.Area`
|
|
205
|
+
* for room around its tile, its own controls in it.
|
|
206
|
+
*/
|
|
207
|
+
children?: ReactNode;
|
|
208
|
+
/** Whether it's open initially (uncontrolled, see `open`). @default false */
|
|
209
|
+
defaultOpen?: boolean;
|
|
210
|
+
/** Its initial size (uncontrolled). @default '1x1' */
|
|
211
|
+
defaultSize?: GridSize;
|
|
212
|
+
/**
|
|
213
|
+
* Called as it's opened or closed (see `open`): by the app (e.g. its
|
|
214
|
+
* card's corner button, through `useGridItem`'s `setOpen`), or closed
|
|
215
|
+
* by a press on the backdrop, Escape, or edit mode starting.
|
|
216
|
+
*/
|
|
217
|
+
onOpenChange?: (open: boolean, details: GridOpenChangeDetails) => void;
|
|
218
|
+
/**
|
|
219
|
+
* Called as its size is changed (e.g. by its card's resize corner),
|
|
220
|
+
* with what it took in (see `GridSizeChangeDetails`).
|
|
221
|
+
*/
|
|
222
|
+
onSizeChange?: (size: GridSize, details: GridSizeChangeDetails) => void;
|
|
223
|
+
/**
|
|
224
|
+
* Whether it's open above the page (controlled): its tile lifted out
|
|
225
|
+
* of the grid (a stand-in keeping its place, nothing reflowing), in
|
|
226
|
+
* the middle of the screen at `openSize`, over a dimmed backdrop; a
|
|
227
|
+
* modal dialog (`openLabel`) until it's closed. Never while editing.
|
|
228
|
+
*/
|
|
229
|
+
open?: boolean;
|
|
230
|
+
/** Its name while it's open (a dialog's), e.g. its card's title. */
|
|
231
|
+
openLabel?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Its size open (see `open`): in the grid's units, fitted to the
|
|
234
|
+
* screen.
|
|
235
|
+
* @default '4x3'
|
|
236
|
+
*/
|
|
237
|
+
openSize?: GridSize;
|
|
238
|
+
/** Its size (controlled): as the user chose it, stored by the app. */
|
|
239
|
+
size?: GridSize;
|
|
240
|
+
/**
|
|
241
|
+
* The sizes it can be (its content's, declared as a constant: e.g. a
|
|
242
|
+
* card component's `sizes`). Its size snaps to them (the same shape
|
|
243
|
+
* first, then the closest area). If that's wider than the columns, the
|
|
244
|
+
* widest that fits is shown instead (the nearest rows first). One of
|
|
245
|
+
* them must fit the grid's `minColumns`.
|
|
246
|
+
* @default every size
|
|
247
|
+
*/
|
|
248
|
+
supportedSizes?: readonly GridSize[];
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Room around an item's (or add tile's) tile (see `Grid.Area`): its size,
|
|
252
|
+
* where its tile sits in it, whether the tile moves in it.
|
|
253
|
+
*/
|
|
254
|
+
export type GridAreaProps = {
|
|
255
|
+
/** Its controls (a `ResizeHandle`, a `RemoveButton`), in its corners. */
|
|
256
|
+
children?: ReactNode;
|
|
257
|
+
/** Its initial placement (uncontrolled, see `placement`). @default 'center' */
|
|
258
|
+
defaultPlacement?: GridPlacement;
|
|
259
|
+
/** Its initial size (uncontrolled, see `size`). */
|
|
260
|
+
defaultSize?: GridSize;
|
|
261
|
+
/**
|
|
262
|
+
* Its tile can be moved within it while editing (crosshairs in the tile's
|
|
263
|
+
* top trailing corner): held and dragged (the hatched room around it
|
|
264
|
+
* moves the whole item), or by the arrow keys while it has focus.
|
|
265
|
+
* @default false
|
|
266
|
+
*/
|
|
267
|
+
movable?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Called as its placement is changed (its tile dragged in it, or moved
|
|
270
|
+
* by the arrow keys; see `movable`).
|
|
271
|
+
*/
|
|
272
|
+
onPlacementChange?: (placement: GridPlacement) => void;
|
|
273
|
+
/**
|
|
274
|
+
* Called as its size is changed (by a `ResizeHandle` in it), with what
|
|
275
|
+
* it took in (see `GridSizeChangeDetails`).
|
|
276
|
+
*/
|
|
277
|
+
onSizeChange?: (size: GridSize, details: GridSizeChangeDetails) => void;
|
|
278
|
+
/**
|
|
279
|
+
* Where its tile sits in it (controlled): in its middle (truly, off the
|
|
280
|
+
* unit lines if need be; its size still in units), or a corner of it on
|
|
281
|
+
* the area's.
|
|
282
|
+
*/
|
|
283
|
+
placement?: GridPlacement;
|
|
284
|
+
/**
|
|
285
|
+
* Its size (controlled): the room its item takes in the layout, at
|
|
286
|
+
* least its tile's size, the rest hatched while editing.
|
|
287
|
+
*/
|
|
288
|
+
size?: GridSize;
|
|
289
|
+
/**
|
|
290
|
+
* The sizes it can be (see `GridItemProps.supportedSizes`): its size
|
|
291
|
+
* snaps to them, then fits the columns; its tile's then fits it (the
|
|
292
|
+
* widest supported that does).
|
|
293
|
+
* @default every size
|
|
294
|
+
*/
|
|
295
|
+
supportedSizes?: readonly GridSize[];
|
|
296
|
+
};
|
|
297
|
+
export type GridSpacerProps = ComponentProps<'div'> & GridDraggableProps & {
|
|
298
|
+
/** Its initial size (uncontrolled). @default '1x1' */
|
|
299
|
+
defaultSize?: GridSize;
|
|
300
|
+
/**
|
|
301
|
+
* Called as its size is changed (e.g. by a `ResizeHandle` in it),
|
|
302
|
+
* with what it took in (see `GridSizeChangeDetails`).
|
|
303
|
+
*/
|
|
304
|
+
onSizeChange?: (size: GridSize, details: GridSizeChangeDetails) => void;
|
|
305
|
+
/** Its size (controlled): a hole that big, fitted to the columns. */
|
|
306
|
+
size?: GridSize;
|
|
307
|
+
};
|
|
308
|
+
export type GridSpawnProps = useRender.ComponentProps<'button'> & GridDraggableProps & {
|
|
309
|
+
/**
|
|
310
|
+
* Its controls (e.g. a `ResizeHandle`), beside its button, not in it;
|
|
311
|
+
* a `Grid.Area` for room around its tile.
|
|
312
|
+
*/
|
|
313
|
+
children?: ReactNode;
|
|
314
|
+
/** Its initial size (uncontrolled). @default '1x1' */
|
|
315
|
+
defaultSize?: GridSize;
|
|
316
|
+
/**
|
|
317
|
+
* Called as its size is changed (e.g. by a `ResizeHandle` in it), with
|
|
318
|
+
* what it took in (see `GridSizeChangeDetails`).
|
|
319
|
+
*/
|
|
320
|
+
onSizeChange?: (size: GridSize, details: GridSizeChangeDetails) => void;
|
|
321
|
+
/** Its size (controlled), fitted to the columns. */
|
|
322
|
+
size?: GridSize;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Resizing its item (see `Grid.ResizeHandle`): an arc by default; `render`,
|
|
326
|
+
* e.g. a card's corner. In a `Grid.Area`, the area.
|
|
327
|
+
*/
|
|
328
|
+
/** A cell's corner (see `Grid.CornerButton`), as a placement's. */
|
|
329
|
+
export type GridCorner = 'bottom-leading' | 'bottom-trailing' | 'top-leading' | 'top-trailing';
|
|
330
|
+
export type GridCornerButtonProps = useRender.ComponentProps<'button'> & {
|
|
331
|
+
/**
|
|
332
|
+
* The corner it's in: a 44px target there, its icon 16.5px in from both
|
|
333
|
+
* of the corner's edges.
|
|
334
|
+
* @default 'bottom-trailing'
|
|
335
|
+
*/
|
|
336
|
+
corner?: GridCorner;
|
|
337
|
+
/**
|
|
338
|
+
* Its icon: one of `gridIcons`, or the app's own (e.g. an
|
|
339
|
+
* SF Symbol), centered at the same place, at the same size.
|
|
340
|
+
*/
|
|
341
|
+
icon: SymbolIcon;
|
|
342
|
+
/**
|
|
343
|
+
* Whether it's flipped in a right-to-left layout: for an icon that
|
|
344
|
+
* points somewhere (e.g. `gridIcons.expand`), not for one that reads as
|
|
345
|
+
* it is.
|
|
346
|
+
* @default false
|
|
347
|
+
*/
|
|
348
|
+
mirrored?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Whether it's shown: hidden, it fades out (by its color) and can't be
|
|
351
|
+
* pressed or focused. The grid's own show while it's editing; a card's
|
|
352
|
+
* while it isn't (see `Card.CornerButton`).
|
|
353
|
+
* @default true
|
|
354
|
+
*/
|
|
355
|
+
visible?: boolean;
|
|
356
|
+
};
|
|
357
|
+
export type GridResizeHandleProps = useRender.ComponentProps<'button'>;
|
|
358
|
+
export type GridRemoveButtonProps = useRender.ComponentProps<'button'>;
|
|
359
|
+
export type GridAreaButtonProps = useRender.ComponentProps<'button'> & {
|
|
360
|
+
/**
|
|
361
|
+
* Called with the area to add (see `Grid.AreaButton`): the app renders a
|
|
362
|
+
* `Grid.Area` of that size in the item.
|
|
363
|
+
*/
|
|
364
|
+
onAdd?: (size: GridSize) => void;
|
|
365
|
+
/**
|
|
366
|
+
* The sizes the area could be, to suggest one of (its `Grid.Area`'s
|
|
367
|
+
* `supportedSizes`, to be).
|
|
368
|
+
* @default every size
|
|
369
|
+
*/
|
|
370
|
+
supportedSizes?: readonly GridSize[];
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* A break's height: the rows it keeps the rest of empty (1 up to the
|
|
374
|
+
* grid's `maxTileRows`).
|
|
375
|
+
*/
|
|
376
|
+
export type GridBreakRows = number;
|
|
377
|
+
export type GridBreakProps = ComponentProps<'div'> & GridDraggableProps & {
|
|
378
|
+
/** Its initial rows (uncontrolled). @default 1 */
|
|
379
|
+
defaultRows?: GridBreakRows;
|
|
380
|
+
/**
|
|
381
|
+
* Called as its rows are changed (e.g. by a `ResizeHandle` in it),
|
|
382
|
+
* with what it took in (see `GridSizeChangeDetails`).
|
|
383
|
+
*/
|
|
384
|
+
onRowsChange?: (rows: GridBreakRows, details: GridSizeChangeDetails) => void;
|
|
385
|
+
/**
|
|
386
|
+
* Its rows (controlled): the rest of its row and the rows below it
|
|
387
|
+
* kept empty, as many in all; what follows starts below them.
|
|
388
|
+
*/
|
|
389
|
+
rows?: GridBreakRows;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* A size as it would be (see `GridItemState.sizeOf`): effective, and
|
|
393
|
+
* whether it's narrower than snapped, to fit the columns (or its area).
|
|
394
|
+
*/
|
|
395
|
+
export type GridSizeFit = {
|
|
396
|
+
/** Whether it's narrower than snapped, to fit. */
|
|
397
|
+
isFitted: boolean;
|
|
398
|
+
/** Its effective size. */
|
|
399
|
+
size: GridSize;
|
|
400
|
+
};
|
|
401
|
+
/** An item's sizes and state (see `useGridItem`). */
|
|
402
|
+
export type GridItemState = {
|
|
403
|
+
/** Whether its grid is editing. */
|
|
404
|
+
editing: boolean;
|
|
405
|
+
/** Whether it's narrower than snapped, to fit the columns. */
|
|
406
|
+
isFitted: boolean;
|
|
407
|
+
/** Whether it's open above the page (see `GridItemProps.open`). */
|
|
408
|
+
open: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Its size open above the page (its `openSize`; smaller there if the
|
|
411
|
+
* screen is).
|
|
412
|
+
*/
|
|
413
|
+
openSize: GridSize;
|
|
414
|
+
/**
|
|
415
|
+
* Asks for another size (its `onSizeChange`, or its own), with what it
|
|
416
|
+
* takes in (none by default).
|
|
417
|
+
*/
|
|
418
|
+
requestSize: (size: GridSize, details?: GridSizeChangeDetails) => void;
|
|
419
|
+
/** Its size as the user chose it. */
|
|
420
|
+
requested: GridSize;
|
|
421
|
+
/** Opens or closes it above the page (its `onOpenChange`, reason none). */
|
|
422
|
+
setOpen: (open: boolean) => void;
|
|
423
|
+
/**
|
|
424
|
+
* Its effective size: requested, snapped to supported, then the widest
|
|
425
|
+
* supported that fits if that's too wide (or than its area).
|
|
426
|
+
*/
|
|
427
|
+
size: GridSize;
|
|
428
|
+
/**
|
|
429
|
+
* What it would be, a size asked for now (e.g. expanded): as its own
|
|
430
|
+
* is (snapped, fitted to the columns and its area), as it is now; its
|
|
431
|
+
* effective size, the same as another's, a change to it that changes
|
|
432
|
+
* nothing (e.g. a button for it hidden).
|
|
433
|
+
*/
|
|
434
|
+
sizeOf: (size: GridSize) => GridSizeFit;
|
|
435
|
+
/** The sizes it can be, in order (smallest area first). */
|
|
436
|
+
supportedSizes: readonly GridSize[];
|
|
437
|
+
};
|
|
438
|
+
/** An item's area and its state (see `useGridArea`). */
|
|
439
|
+
export type GridAreaState = {
|
|
440
|
+
/** Whether its tile can be moved within it. */
|
|
441
|
+
movable: boolean;
|
|
442
|
+
/** Where its tile sits in it. */
|
|
443
|
+
placement: GridPlacement;
|
|
444
|
+
/** Asks for another placement (its `onPlacementChange`, or its own). */
|
|
445
|
+
requestPlacement: (placement: GridPlacement) => void;
|
|
446
|
+
/** Asks for another size (its `onSizeChange`, or its own). */
|
|
447
|
+
requestSize: (size: GridSize, details?: GridSizeChangeDetails) => void;
|
|
448
|
+
/** Its size as the user chose it. */
|
|
449
|
+
requested: GridSize;
|
|
450
|
+
/**
|
|
451
|
+
* Its effective size: the room its item takes in the layout (snapped,
|
|
452
|
+
* fitted to the columns; at least its tile's).
|
|
453
|
+
*/
|
|
454
|
+
size: GridSize;
|
|
455
|
+
/**
|
|
456
|
+
* What it would be, a size asked for now: as its own is (snapped,
|
|
457
|
+
* fitted to the columns; at least its tile's), its tile as it is now
|
|
458
|
+
* (see `GridItemState.sizeOf`).
|
|
459
|
+
*/
|
|
460
|
+
sizeOf: (size: GridSize) => GridSizeFit;
|
|
461
|
+
/** The sizes it can be, in order (smallest area first). */
|
|
462
|
+
supportedSizes: readonly GridSize[];
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* An item's tile changing its box (see `useGridItemLayout`): its size, its
|
|
466
|
+
* place in its area, opened above the page or closed.
|
|
467
|
+
*/
|
|
468
|
+
export type GridItemLayoutChange = {
|
|
469
|
+
/** How long its tile takes to get there, in milliseconds. */
|
|
470
|
+
duration: number;
|
|
471
|
+
/** Its tile's easing (a CSS easing function). */
|
|
472
|
+
easing: string;
|
|
473
|
+
/**
|
|
474
|
+
* How far its tile has got, in milliseconds (0 until its first frame is
|
|
475
|
+
* drawn, and before the change; `duration` once it's there): what moves
|
|
476
|
+
* with it can follow it, frame by frame, however long a frame takes.
|
|
477
|
+
*/
|
|
478
|
+
elapsed: () => number;
|
|
479
|
+
/** Its tile's box on screen before the change. */
|
|
480
|
+
from: DOMRectReadOnly;
|
|
481
|
+
/** Whether it's open above the page, after the change. */
|
|
482
|
+
open: boolean;
|
|
483
|
+
/** Whether it was open above the page, before the change. */
|
|
484
|
+
previousOpen: boolean;
|
|
485
|
+
/** Its effective size before the change. */
|
|
486
|
+
previousSize: GridSize;
|
|
487
|
+
/** Its effective size, after the change. */
|
|
488
|
+
size: GridSize;
|
|
489
|
+
/** Its tile's box on screen once it's there. */
|
|
490
|
+
to: DOMRectReadOnly;
|
|
491
|
+
};
|
|
492
|
+
/** What to call as an item's tile changes its box (see `useGridItemLayout`). */
|
|
493
|
+
export type GridItemLayoutHandlers = {
|
|
494
|
+
/**
|
|
495
|
+
* Called after the change is in the DOM: what's in the tile laid out at
|
|
496
|
+
* its new size already, the tile still drawn at its old box (`from`),
|
|
497
|
+
* about to move and resize to its new one (`to`) over `duration`. E.g.
|
|
498
|
+
* where an animation library moves what's in it from where it was.
|
|
499
|
+
*/
|
|
500
|
+
onAfterChange?: (change: GridItemLayoutChange) => void;
|
|
501
|
+
/**
|
|
502
|
+
* Called before the change reaches the DOM: what's in the tile still laid
|
|
503
|
+
* out as it was (`to` is `from` then). E.g. where an animation library
|
|
504
|
+
* records where things are.
|
|
505
|
+
*/
|
|
506
|
+
onBeforeChange?: (change: GridItemLayoutChange) => void;
|
|
507
|
+
};
|
|
508
|
+
export {};
|
|
509
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/grid/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAA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C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/components/grid/props.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Component, type ReactNode, type RefObject } from 'react';
|
|
2
|
+
import type { GridItemLayoutHandlers, GridSize } from './props.js';
|
|
3
|
+
/** What an item's tile is drawn by (see the top). */
|
|
4
|
+
type Shape = {
|
|
5
|
+
area: string;
|
|
6
|
+
editing: boolean;
|
|
7
|
+
open: boolean;
|
|
8
|
+
placement: string;
|
|
9
|
+
size: GridSize;
|
|
10
|
+
};
|
|
11
|
+
/** The handlers what's in an item registered (see `useGridItemLayout`). */
|
|
12
|
+
type Registry = Set<RefObject<GridItemLayoutHandlers>>;
|
|
13
|
+
export declare const GridItemLayoutProvider: import("preact").Provider<Registry | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Calls the handlers as its item's tile changes its box (see the top):
|
|
16
|
+
* `onBeforeChange` before the change reaches the DOM, `onAfterChange`
|
|
17
|
+
* once it's there, its tile still drawn at its old box. Neither while its
|
|
18
|
+
* grid's editing nor with reduced motion (nothing moves then). Inside a
|
|
19
|
+
* `Grid.Item` only; the latest handlers are called (no need to keep them
|
|
20
|
+
* stable).
|
|
21
|
+
*/
|
|
22
|
+
export declare const useGridItemLayout: (handlers: GridItemLayoutHandlers) => void;
|
|
23
|
+
type SnapshotProps = {
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/** Called before a change of its shape reaches the DOM. */
|
|
26
|
+
onChange: (previous: Shape, next: Shape) => void;
|
|
27
|
+
shape: Shape;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Its item's shape before a change reaches the DOM (`onChange`): a class's
|
|
31
|
+
* snapshot, before any of its DOM changes (React's for all of a commit;
|
|
32
|
+
* Preact's before its children's, so it's what its item renders first).
|
|
33
|
+
*/
|
|
34
|
+
export declare class ShapeSnapshot extends Component<SnapshotProps> {
|
|
35
|
+
componentDidUpdate(): void;
|
|
36
|
+
getSnapshotBeforeUpdate(previous: Readonly<SnapshotProps>): null;
|
|
37
|
+
render(): ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Animations started a frame after the next (held at their start until
|
|
41
|
+
* then): from where they're first drawn, however long the change's own
|
|
42
|
+
* task took (what's in the tile laying itself out, an app's measuring).
|
|
43
|
+
* Not with the next: after a long task, its time is the one it was
|
|
44
|
+
* scheduled for (in Chrome), far along already. Not those given up
|
|
45
|
+
* meanwhile.
|
|
46
|
+
*/
|
|
47
|
+
export declare const startWithFrame: (...animations: readonly Animation[]) => void;
|
|
48
|
+
/**
|
|
49
|
+
* An item's tile reshaped (see the top): its snapshot's `onChange` and its
|
|
50
|
+
* registry (for its `GridItemLayoutProvider`); `onSettled` called once
|
|
51
|
+
* it's there (at once when it isn't drawn getting there). Call after what
|
|
52
|
+
* places its tile (e.g. its overlay's), in the same component.
|
|
53
|
+
*/
|
|
54
|
+
export declare const useReshape: ({ body, cell, onSettled, }: {
|
|
55
|
+
body: RefObject<HTMLElement | null>;
|
|
56
|
+
cell: RefObject<HTMLElement | null>;
|
|
57
|
+
onSettled: () => void;
|
|
58
|
+
}) => readonly [onChange: (previous: Shape, next: Shape) => void, registry: Registry];
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=reshape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reshape.d.ts","sourceRoot":"","sources":["../../../src/components/grid/reshape.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,SAAS,EACd,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAEV,sBAAsB,EACtB,QAAQ,EACT,MAAM,YAAY,CAAC;AAkBpB,qDAAqD;AACrD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAA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