@n-uf/placement 26.11.17 → 26.11.19
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/CHANGELOG.md +106 -0
- package/README.md +184 -25
- package/dist/chunk-NCHRKLT3.js +1487 -0
- package/dist/chunk-NCHRKLT3.js.map +1 -0
- package/dist/{chunk-RYFQKQPQ.js → chunk-RUITEOZ7.js} +100 -9
- package/dist/chunk-RUITEOZ7.js.map +1 -0
- package/dist/{model-CMH_27_g.d.ts → model-irGEua8T.d.ts} +73 -4
- package/dist/scene-cases.d.ts +409 -0
- package/dist/scene-cases.js +2014 -0
- package/dist/scene-cases.js.map +1 -0
- package/dist/scene.d.ts +6 -541
- package/dist/scene.js +35 -1142
- package/dist/scene.js.map +1 -1
- package/dist/stack.d.ts +2 -2
- package/dist/stack.js +16 -4
- package/dist/stack.js.map +1 -1
- package/dist/targets-50bCVu3K.d.ts +648 -0
- package/package.json +5 -1
- package/dist/chunk-RYFQKQPQ.js.map +0 -1
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { P as Point, R as Rect } from './geometry-mL-GTRti.js';
|
|
2
|
+
import { S as StackFormKind } from './model-irGEua8T.js';
|
|
3
|
+
import { S as Scene, a as ScenePlace, Z as Zone, b as Side, c as SceneNoteCode, d as SceneLayout, e as StoredScene, f as SceneTarget } from './targets-50bCVu3K.js';
|
|
4
|
+
import './target-D3PiLg44.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The conformance rows' shapes. A row is plain data: a scene, the settings it runs at, the gestures a user makes, and
|
|
8
|
+
* what the layout (and, in a host with a page, the DOM) must be after them. `runCase(row, host)` (./run) plays a row on
|
|
9
|
+
* a `CaseHost`; the in-memory host (./host) is the reference, and a UI kit's host is one more. Nothing here names a DOM
|
|
10
|
+
* type: a page's root only has to answer `getAttribute` and `querySelectorAll`, which every DOM element does.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** How a row is grouped (the lab's case browser and the kits' report list rows by it). */
|
|
14
|
+
type CaseGroup = "panels" | "groups" | "drag" | "floats" | "bars" | "previous" | "kinds" | "bands" | "gestures" | "window-a" | "window-b";
|
|
15
|
+
/** The settings a row runs at. `stage` replaces the scene's stage with `{ x: 0, y: 0, width: w, height: h }`. */
|
|
16
|
+
interface CaseSettings {
|
|
17
|
+
readonly stage?: {
|
|
18
|
+
readonly w: number;
|
|
19
|
+
readonly h: number;
|
|
20
|
+
};
|
|
21
|
+
/** Frozen: nothing lifts, unless Alt is held (`key: "Alt"`). */
|
|
22
|
+
readonly frozen?: boolean;
|
|
23
|
+
}
|
|
24
|
+
type GestureType = "press" | "move" | "release" | "key" | "click" | "resize" | "scroll" | "hold";
|
|
25
|
+
/**
|
|
26
|
+
* One thing a user does, in the order they do it. Every field but `type` is optional; which ones count depends on the
|
|
27
|
+
* type:
|
|
28
|
+
*
|
|
29
|
+
* - `press`: pointer down on `item`'s handle (its grip, or its header). `point` is where, relative to the item's
|
|
30
|
+
* top-left corner: the GRAB. It is the row's, not the host's: a float lands at the pointer minus the grab, so every
|
|
31
|
+
* press that ends in a float gives one (a host's own default may differ, and no row may depend on it). Nothing lifts yet.
|
|
32
|
+
* - `move`: the pointer moves, to `point` (stage px) or to the target at `place` (a host aims at the target's hit by its
|
|
33
|
+
* place, with `resolvePlace`). With an item pressed, the first move past the lift threshold lifts it (a `place` always
|
|
34
|
+
* lifts), and the pointer is then over whichever target `pickTarget` finds. Without a press it only moves. With no
|
|
35
|
+
* target under the pointer the page draws the committed layout with the held item's place left empty, and nothing else
|
|
36
|
+
* moves (a release there commits nothing). A host reaches the end gaps `END_REACH` (24) px past an edge's ends: that is
|
|
37
|
+
* required of it, since the rows aim there.
|
|
38
|
+
* A checkpoint or DOM check is never read right after a `move`: a `hold` comes first, so a host with a drag intent can
|
|
39
|
+
* settle on its target (hysteresis) before the page is read.
|
|
40
|
+
* - `release`: pointer up. After a lift it drops on the target under the pointer (a `home` or `none` target, or no
|
|
41
|
+
* target, drops nothing); without one it was a press and nothing changes.
|
|
42
|
+
* - `key`: `"Escape"` cancels the drag, `"Alt"` holds Alt down and `"Alt:up"` lets it go (frozen windows move while it is
|
|
43
|
+
* down), `"Reload"` stores the scene, throws the in-memory one away and reads it back, as a page reload does.
|
|
44
|
+
* - `click`: the item's controls, not a drag. With neither `key` nor `place` it activates the item: a closed item opens,
|
|
45
|
+
* one folded by hand (a rail tab, a header's caret) unfolds, a float rises; the first two count as a use. With `key`,
|
|
46
|
+
* the named control: `"use"` (a use and nothing else: the item is now the newest), `"open"`, `"close"`, `"fold"`,
|
|
47
|
+
* `"unfold"`, `"float"` (the menu's Float: its last size, anchored to the content), `"dock"` (Dock, Put back, Reset
|
|
48
|
+
* position: where the loaded scene had it). With `place`, the "Move to ›" row for that place (one of `stops`; for the
|
|
49
|
+
* float place it is the menu's Float, as with `"float"`). A frozen window refuses `"float"`, `"dock"` and "Move to ›"
|
|
50
|
+
* unless Alt is down.
|
|
51
|
+
* - `resize`: with `edge`, the user's size across that edge (`size` px; `resize` in `./scene`). With `item`, that item's
|
|
52
|
+
* measured length grew by `size` px (a count gained digits; a negative `size` shrinks it): its largest form along the
|
|
53
|
+
* axis it lies along. With neither, the window is now `point.x` by `point.y`.
|
|
54
|
+
* - `scroll`: the pages scroll by `size` px. Nothing in a scene scrolls, so nothing moves; only a host with a page can
|
|
55
|
+
* show that (a DOM `rect` check), the in-memory host has nothing to scroll.
|
|
56
|
+
* - `hold`: the pointer rests for `ms`. Hosts with a clock let the drag intent settle; the in-memory host has none.
|
|
57
|
+
*/
|
|
58
|
+
interface Gesture {
|
|
59
|
+
readonly type: GestureType;
|
|
60
|
+
readonly item?: string;
|
|
61
|
+
readonly place?: ScenePlace;
|
|
62
|
+
readonly point?: Point;
|
|
63
|
+
readonly key?: string;
|
|
64
|
+
readonly edge?: string;
|
|
65
|
+
readonly size?: number;
|
|
66
|
+
readonly ms?: number;
|
|
67
|
+
}
|
|
68
|
+
/** What one item's layout must be. Every field is optional: a row pins only what its case is about. */
|
|
69
|
+
interface ItemExpect {
|
|
70
|
+
/** Any of x, y, width, height, within the tolerance. */
|
|
71
|
+
readonly rect?: Partial<Rect>;
|
|
72
|
+
readonly formKind?: StackFormKind;
|
|
73
|
+
/** The index of the form it took. */
|
|
74
|
+
readonly form?: number;
|
|
75
|
+
/** The edge it is docked in; `null`: docked nowhere (a float, or in the » menu of no edge). */
|
|
76
|
+
readonly edge?: string | null;
|
|
77
|
+
readonly zone?: Zone;
|
|
78
|
+
readonly floating?: boolean;
|
|
79
|
+
readonly inMenu?: boolean;
|
|
80
|
+
/** The side whose rail draws it as a segment; `null`: in no rail. */
|
|
81
|
+
readonly rail?: Side | null;
|
|
82
|
+
readonly folded?: "hand" | "auto" | null;
|
|
83
|
+
/** The column it rides on (`handFold: "ride"`). */
|
|
84
|
+
readonly rides?: string | null;
|
|
85
|
+
readonly tab?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/** What an edge must be. */
|
|
88
|
+
interface EdgeExpect {
|
|
89
|
+
readonly rect?: Partial<Rect>;
|
|
90
|
+
/** Its size across. */
|
|
91
|
+
readonly cross?: number;
|
|
92
|
+
/** The ids drawn as rail tabs, in order. */
|
|
93
|
+
readonly tabs?: readonly string[];
|
|
94
|
+
/** The ids in its » menu, in order; `null`: it has none. */
|
|
95
|
+
readonly menu?: readonly string[] | null;
|
|
96
|
+
}
|
|
97
|
+
/** What a layout must be (partial: only what is named is compared). */
|
|
98
|
+
interface LayoutExpect {
|
|
99
|
+
/** Per item id. `null`: the item is not in the layout at all (a lifted one, a closed one). */
|
|
100
|
+
readonly items?: Readonly<Record<string, ItemExpect | null>>;
|
|
101
|
+
readonly edges?: Readonly<Record<string, EdgeExpect | null>>;
|
|
102
|
+
/** What is left for the pages. */
|
|
103
|
+
readonly content?: Partial<Rect>;
|
|
104
|
+
/** The least the content may be (`contentMin`'s thresholds: "at least 320 px wide"). */
|
|
105
|
+
readonly contentAtLeast?: {
|
|
106
|
+
readonly width?: number;
|
|
107
|
+
readonly height?: number;
|
|
108
|
+
};
|
|
109
|
+
/** Per edge id: the ids docked in it (not in its » menu), in order along it. */
|
|
110
|
+
readonly order?: Readonly<Record<string, readonly string[]>>;
|
|
111
|
+
/** Per side: the members of each open dynamic column, outer column first, each in order down it. */
|
|
112
|
+
readonly columns?: Readonly<Partial<Record<"left" | "right", readonly (readonly string[])[]>>>;
|
|
113
|
+
/** Per side: the ids drawn as segments of its rail, in order. */
|
|
114
|
+
readonly rails?: Readonly<Partial<Record<"left" | "right", readonly string[]>>>;
|
|
115
|
+
/** The floats drawn, in stacking order (the last on top). */
|
|
116
|
+
readonly floats?: readonly string[];
|
|
117
|
+
/** Notes by code: all of `has` present, none of `hasNot`, and with `none` no notes at all. */
|
|
118
|
+
readonly notes?: {
|
|
119
|
+
readonly has?: readonly SceneNoteCode[];
|
|
120
|
+
readonly hasNot?: readonly SceneNoteCode[];
|
|
121
|
+
readonly none?: boolean;
|
|
122
|
+
};
|
|
123
|
+
/** px; default 0.5. */
|
|
124
|
+
readonly tolerance?: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* What a page's DOM must be. The elements are the session's: `data-drag-session="<kind>"` on the root during a drag
|
|
128
|
+
* only, `[data-drag-slot][data-drag-target]` for the slot (the attribute holds the target's id), `[data-drag-marker]`
|
|
129
|
+
* for the insertion line, `[data-drag-held]` for the held item. A drawn item's element is found by `item`: the host's
|
|
130
|
+
* `itemSelector(id)`, by default `[data-dock-item="<id>"]` (a rect check reads it).
|
|
131
|
+
*/
|
|
132
|
+
interface DomCheck {
|
|
133
|
+
/** After which gesture (its index) it is checked; default: after the last one. */
|
|
134
|
+
readonly at?: number;
|
|
135
|
+
/** A selector under the root; omitted (and no `item`): the root itself. */
|
|
136
|
+
readonly select?: string;
|
|
137
|
+
/** The element of this item, found with the host's `itemSelector` (never together with `select`). */
|
|
138
|
+
readonly item?: string;
|
|
139
|
+
/** How many elements match: a number, or a range. Default: at least one when `select` is given. */
|
|
140
|
+
readonly count?: number | {
|
|
141
|
+
readonly min?: number;
|
|
142
|
+
readonly max?: number;
|
|
143
|
+
};
|
|
144
|
+
/** Attribute values on every match; `null` means the attribute is absent. */
|
|
145
|
+
readonly attr?: Readonly<Record<string, string | null>>;
|
|
146
|
+
/**
|
|
147
|
+
* The matched element's rect in stage px (relative to the root's top-left corner), any of x, y, width, height, within
|
|
148
|
+
* `tolerance` (default 0.5 px): what a float that never scrolls with the pages, or a slot, really measures on screen.
|
|
149
|
+
*/
|
|
150
|
+
readonly rect?: Partial<Rect>;
|
|
151
|
+
readonly tolerance?: number;
|
|
152
|
+
/** What the check is about, for the failure line. */
|
|
153
|
+
readonly note?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The layout after one gesture (by index), before the later ones are played. After a `move` it is read only once a `hold`
|
|
157
|
+
* has followed (so a checkpoint's `at` is never a `move`).
|
|
158
|
+
*/
|
|
159
|
+
interface Checkpoint {
|
|
160
|
+
readonly at: number;
|
|
161
|
+
readonly layout?: LayoutExpect;
|
|
162
|
+
readonly note?: string;
|
|
163
|
+
}
|
|
164
|
+
interface CaseRow {
|
|
165
|
+
/** Generic and stable: the kits' suites name rows by it. */
|
|
166
|
+
readonly id: string;
|
|
167
|
+
readonly title: string;
|
|
168
|
+
/** One sentence: what must be true. */
|
|
169
|
+
readonly expect: string;
|
|
170
|
+
readonly group: CaseGroup;
|
|
171
|
+
readonly scene: Scene;
|
|
172
|
+
readonly settings?: CaseSettings;
|
|
173
|
+
readonly gestures: readonly Gesture[];
|
|
174
|
+
/** The layout after every gesture. */
|
|
175
|
+
readonly expectLayout: LayoutExpect;
|
|
176
|
+
readonly expectDom?: readonly DomCheck[];
|
|
177
|
+
/** The layout after earlier gestures, for rows about the preview (a drop's slot while the pointer is still down). */
|
|
178
|
+
readonly checkpoints?: readonly Checkpoint[];
|
|
179
|
+
/** What the stored form must hold after the last gesture (a host's `stored()`): ages, folds, no `pinned` flag. */
|
|
180
|
+
readonly expectStored?: StoredExpect;
|
|
181
|
+
/** The places "Move to ›" and the arrow keys offer for an item, in order (a host's `stops(item)`), after gesture `at` (default the last). */
|
|
182
|
+
readonly expectStops?: {
|
|
183
|
+
readonly item: string;
|
|
184
|
+
readonly at?: number;
|
|
185
|
+
readonly places: readonly ScenePlace[];
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* The library rule this row needs and the Scene doesn't have yet. Such a row is expected to fail on the in-memory host
|
|
189
|
+
* until the rule lands (then its suite says to remove this), and a kit's suite may skip it.
|
|
190
|
+
*/
|
|
191
|
+
readonly lacks?: string;
|
|
192
|
+
}
|
|
193
|
+
/** What a stored form must hold: per item the named fields exactly (`null`: absent), and strings its JSON never contains. */
|
|
194
|
+
interface StoredExpect {
|
|
195
|
+
readonly items?: Readonly<Record<string, Readonly<Record<string, string | number | boolean | null>>>>;
|
|
196
|
+
readonly absent?: readonly string[];
|
|
197
|
+
}
|
|
198
|
+
/** A page's root, as much of it as the checks read. A DOM element is one. */
|
|
199
|
+
interface DomRoot {
|
|
200
|
+
getAttribute(name: string): string | null;
|
|
201
|
+
querySelectorAll(selector: string): ArrayLike<DomRoot>;
|
|
202
|
+
/** Needed only by rect checks; a DOM element's own is one. */
|
|
203
|
+
getBoundingClientRect?(): {
|
|
204
|
+
readonly left: number;
|
|
205
|
+
readonly top: number;
|
|
206
|
+
readonly width: number;
|
|
207
|
+
readonly height: number;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** What a host gives the runner. */
|
|
211
|
+
interface CaseHost {
|
|
212
|
+
/** Start over with `scene` (the loaded scene is also what `click` `"dock"` puts items back to). */
|
|
213
|
+
load(scene: Scene, settings?: CaseSettings): void;
|
|
214
|
+
/** Do one gesture. Throws when it can't be done (no such target, no such item): the runner reports it as a failure. */
|
|
215
|
+
perform(gesture: Gesture): void;
|
|
216
|
+
/** The layout the page draws now: during a drag, the target's `after.layout` (the preview). */
|
|
217
|
+
layout(): SceneLayout;
|
|
218
|
+
/** The page's root; absent in a host without a page, and then the DOM checks are skipped. */
|
|
219
|
+
root?(): DomRoot | null;
|
|
220
|
+
/** The selector, under the root, of the element that draws item `id`; default `[data-dock-item="<id>"]`. A DOM check's `item` is aimed with it. */
|
|
221
|
+
itemSelector?(id: string): string;
|
|
222
|
+
/** The stored form as a reload would read it back; absent: the stored checks are skipped. */
|
|
223
|
+
stored?(): StoredScene;
|
|
224
|
+
/** The places "Move to ›" offers for an item, in order (the library's `stops` places); absent: the stops check is skipped. */
|
|
225
|
+
stops?(item: string): readonly ScenePlace[];
|
|
226
|
+
}
|
|
227
|
+
interface CaseResult {
|
|
228
|
+
readonly ok: boolean;
|
|
229
|
+
readonly failures: string[];
|
|
230
|
+
/** The checks not run because the host can't (no root, no stored form, no stops): each one's note, or its selector. */
|
|
231
|
+
readonly skipped: string[];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The in-memory reference host: a `CaseHost` with no page, no pointer and no clock, only the scene. It plays gestures
|
|
236
|
+
* the way a page's drag session does: a press on a handle, the first move past the lift threshold lifting the item and
|
|
237
|
+
* asking `targets` for every drop target, a pointer over the most precise of them (`pickTarget`), the preview drawn from
|
|
238
|
+
* that target's `after.layout`, and a release committing `after.scene`. Every solve carries the layout before it as
|
|
239
|
+
* `previous`. The kits' hosts do the same with their own pointer and DOM; the rows are the contract between them.
|
|
240
|
+
*
|
|
241
|
+
* Also exported: `pickTarget` (which target a point is over) and `resolvePlace` (a point that reaches the target at a
|
|
242
|
+
* place), the two pure steps a host needs to turn a gesture's `place` into a pointer.
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
/** The lift threshold: the pointer moves this far (px) from the press before the item lifts. */
|
|
246
|
+
declare const LIFT_THRESHOLD = 4;
|
|
247
|
+
/** How far past an edge's ends its first and last gaps reach (px); the kits' toolbars use 24. */
|
|
248
|
+
declare const END_REACH = 24;
|
|
249
|
+
/** The most precise target under `point`: the lowest priority number, then the smallest hit; null when none is. */
|
|
250
|
+
declare function pickTarget<T extends {
|
|
251
|
+
readonly priority: number;
|
|
252
|
+
readonly hit: Rect;
|
|
253
|
+
}>(list: readonly T[], point: Point): T | null;
|
|
254
|
+
/** What `resolvePlace` may aim at when a target covers the whole plane (a float): the stage and the content. */
|
|
255
|
+
interface AimArea {
|
|
256
|
+
readonly stage: Rect;
|
|
257
|
+
readonly content?: Rect;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A pointer position that reaches the target at `place`: inside its hit and not covered by a more precise target
|
|
261
|
+
* (`pickTarget` finds it there). It tries the hit's centre, then a grid across the hit; a target over the whole plane
|
|
262
|
+
* (the float) is aimed at the content's centre, then the stage's, then a grid across the stage. Null when no point
|
|
263
|
+
* reaches it (a gap that a home or a blocked spot covers entirely).
|
|
264
|
+
*/
|
|
265
|
+
declare function resolvePlace(list: readonly SceneTarget[], place: ScenePlace, item: string, area_: AimArea): Point | null;
|
|
266
|
+
/** What the in-memory host knows about a drag in progress. */
|
|
267
|
+
interface HostDrag {
|
|
268
|
+
readonly item: string;
|
|
269
|
+
/** False between the press and the lift. */
|
|
270
|
+
readonly lifted: boolean;
|
|
271
|
+
/** The id of the target the pointer is over, or null. */
|
|
272
|
+
readonly target: string | null;
|
|
273
|
+
readonly point: Point;
|
|
274
|
+
/** Where the pointer holds the item, relative to its top-left corner. */
|
|
275
|
+
readonly grab: Point;
|
|
276
|
+
}
|
|
277
|
+
interface SceneHost extends CaseHost {
|
|
278
|
+
/** The committed scene (not the preview). */
|
|
279
|
+
scene(): Scene;
|
|
280
|
+
/** The scene as the host stores it, as a page reload would read it back. */
|
|
281
|
+
stored(): StoredScene;
|
|
282
|
+
/** The drag in progress, or null. */
|
|
283
|
+
drag(): HostDrag | null;
|
|
284
|
+
}
|
|
285
|
+
interface SceneHostOptions {
|
|
286
|
+
/** How far past an edge's ends its end gaps reach, px (default {@link END_REACH}). */
|
|
287
|
+
readonly endReach?: number;
|
|
288
|
+
/** Px from the press before an item lifts (default {@link LIFT_THRESHOLD}). */
|
|
289
|
+
readonly lift?: number;
|
|
290
|
+
/** Where a press with no `point` holds the item, px from its top-left corner (default 8, 8). A test varies it to prove no row depends on it. */
|
|
291
|
+
readonly grab?: Point;
|
|
292
|
+
}
|
|
293
|
+
declare function createSceneHost(options?: SceneHostOptions): SceneHost;
|
|
294
|
+
|
|
295
|
+
/** The selector of an item's element when the host has no `itemSelector`: `[data-dock-item="<id>"]`. */
|
|
296
|
+
declare const defaultItemSelector: (id: string) => string;
|
|
297
|
+
/** The ways `layout` differs from `want`, as lines. Empty: it matches. */
|
|
298
|
+
declare function layoutIssues(want: LayoutExpect, layout: SceneLayout): string[];
|
|
299
|
+
/**
|
|
300
|
+
* Plays `row` on `host`: loads its scene at its settings, performs its gestures in order, and checks. A gesture the host
|
|
301
|
+
* can't do is a failure and ends the run (what follows would be about another state), and so is a layout the host can't
|
|
302
|
+
* give or a check pointing at a gesture the row doesn't have. With no `host.root` the DOM checks are skipped, with no
|
|
303
|
+
* `host.stored` the stored checks and with no `host.stops` the stops check; each is listed in `skipped`.
|
|
304
|
+
*/
|
|
305
|
+
declare function runCase(row: CaseRow, host: CaseHost): CaseResult;
|
|
306
|
+
/** Runs every row on a fresh host each (`makeHost`), and returns each row's result by id. */
|
|
307
|
+
declare function runCases(rows: readonly CaseRow[], makeHost: () => CaseHost): {
|
|
308
|
+
id: string;
|
|
309
|
+
result: CaseResult;
|
|
310
|
+
}[];
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Short constructors for gestures, so a row reads as what a user does: `g.press("pages")`, `g.to(place)`,
|
|
314
|
+
* `g.release()`. Each returns a plain `Gesture`; nothing here is needed to read or play a row.
|
|
315
|
+
*/
|
|
316
|
+
|
|
317
|
+
declare const g: {
|
|
318
|
+
/** Pointer down on the item's handle; `point` is relative to its top-left corner. */
|
|
319
|
+
press: (item: string, point?: Point) => Gesture;
|
|
320
|
+
/** The pointer moves to the target at `place`. */
|
|
321
|
+
to: (place: ScenePlace) => Gesture;
|
|
322
|
+
/** The pointer moves to `point` (stage px). */
|
|
323
|
+
at: (x: number, y: number) => Gesture;
|
|
324
|
+
hold: (ms?: number) => Gesture;
|
|
325
|
+
release: () => Gesture;
|
|
326
|
+
escape: () => Gesture;
|
|
327
|
+
key: (key: string) => Gesture;
|
|
328
|
+
/** The item's control (`key`), or with none, a click that opens or unfolds it. */
|
|
329
|
+
click: (item: string, key?: string) => Gesture;
|
|
330
|
+
/** The "Move to ›" row for `place`. */
|
|
331
|
+
moveTo: (item: string, place: ScenePlace) => Gesture;
|
|
332
|
+
/** The user's size across an edge. */
|
|
333
|
+
resizeEdge: (edge: string, size: number) => Gesture;
|
|
334
|
+
/** The item's measured length changed by `size` px. */
|
|
335
|
+
resizeItem: (item: string, size: number) => Gesture;
|
|
336
|
+
/** The stage is now `width` x `height`. */
|
|
337
|
+
resizeWindow: (width: number, height: number) => Gesture;
|
|
338
|
+
scroll: (dy: number) => Gesture;
|
|
339
|
+
/** A place: before the `at`-th item of an edge's zone. */
|
|
340
|
+
gap: (edge: string, at: number, zone?: "start" | "center" | "end") => ScenePlace;
|
|
341
|
+
column: (side: "left" | "right", ring: number) => ScenePlace;
|
|
342
|
+
rail: (side: "left" | "right", ring?: number) => ScenePlace;
|
|
343
|
+
float: ScenePlace;
|
|
344
|
+
home: ScenePlace;
|
|
345
|
+
/** Press, aim at `place`, rest, let go. */
|
|
346
|
+
drag: (item: string, place: ScenePlace, grab?: Point) => Gesture[];
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
interface WinSpec {
|
|
350
|
+
readonly card: {
|
|
351
|
+
readonly min: number;
|
|
352
|
+
readonly max: number;
|
|
353
|
+
};
|
|
354
|
+
/** Space after each side edge and rail, toward the content. */
|
|
355
|
+
readonly gap: number;
|
|
356
|
+
/** Space kept clear at the stage's left and right edges. */
|
|
357
|
+
readonly pad: number;
|
|
358
|
+
readonly rail: number;
|
|
359
|
+
readonly contentMin: {
|
|
360
|
+
readonly width: number;
|
|
361
|
+
readonly height: number;
|
|
362
|
+
};
|
|
363
|
+
/** The folded bar's length. */
|
|
364
|
+
readonly barMain: number;
|
|
365
|
+
}
|
|
366
|
+
declare const WINDOW_A: WinSpec;
|
|
367
|
+
declare const WINDOW_B: WinSpec;
|
|
368
|
+
declare const WINDOW_BARE: WinSpec;
|
|
369
|
+
interface WinOptions {
|
|
370
|
+
/** The stage's width (default 1120) and height (default 800). */
|
|
371
|
+
readonly width?: number;
|
|
372
|
+
readonly height?: number;
|
|
373
|
+
/** The panels' ids per column, outer column first: `{ left: [["pages", "annotations"]], right: [["findings"]] }` (the default). */
|
|
374
|
+
readonly columns?: {
|
|
375
|
+
readonly left?: readonly (readonly string[])[];
|
|
376
|
+
readonly right?: readonly (readonly string[])[];
|
|
377
|
+
};
|
|
378
|
+
/** Ages (default pages 1, annotations 2, findings 3); a panel left out of every column isn't in the scene. */
|
|
379
|
+
readonly used?: Readonly<Record<string, number>>;
|
|
380
|
+
/** First forms allowed: 1 folds a panel by hand. */
|
|
381
|
+
readonly from?: Readonly<Record<string, number>>;
|
|
382
|
+
readonly handFold?: "bar" | "ride";
|
|
383
|
+
/** The user's column width, for every column (stored sizes). */
|
|
384
|
+
readonly size?: number;
|
|
385
|
+
/** Panels that float, with their rects. */
|
|
386
|
+
readonly floats?: readonly {
|
|
387
|
+
readonly id: string;
|
|
388
|
+
readonly rect: {
|
|
389
|
+
x: number;
|
|
390
|
+
y: number;
|
|
391
|
+
width: number;
|
|
392
|
+
height: number;
|
|
393
|
+
};
|
|
394
|
+
}[];
|
|
395
|
+
}
|
|
396
|
+
/** A window: dynamic columns on both sides, a rail on each, `contentMin`, padding and gap. */
|
|
397
|
+
declare function winScene(spec: WinSpec, o?: WinOptions): Scene;
|
|
398
|
+
|
|
399
|
+
/** Every row, in order: the docking cases, the bar cases, the built-in rules, the kits' gestures, the two windows. */
|
|
400
|
+
declare const CASES: readonly CaseRow[];
|
|
401
|
+
/** The groups rows are listed under, in order, with their titles. */
|
|
402
|
+
declare const CASE_GROUPS: readonly {
|
|
403
|
+
readonly id: CaseGroup;
|
|
404
|
+
readonly title: string;
|
|
405
|
+
}[];
|
|
406
|
+
/** The row with this id, or undefined. */
|
|
407
|
+
declare const caseById: (id: string) => CaseRow | undefined;
|
|
408
|
+
|
|
409
|
+
export { type AimArea, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, type Gesture, type GestureType, type ItemExpect, LIFT_THRESHOLD, type LayoutExpect, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createSceneHost, defaultItemSelector, g, layoutIssues, pickTarget, resolvePlace, runCase, runCases, winScene };
|