@n-uf/placement 26.11.30 → 26.11.32
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 +53 -0
- package/README.md +38 -4
- package/dist/{chunk-5CSWQSH7.js → chunk-COK4YNMF.js} +58 -14
- package/dist/chunk-COK4YNMF.js.map +1 -0
- package/dist/{model-BxFXr9UY.d.ts → model-BSIKmANw.d.ts} +21 -2
- package/dist/scene-cases.d.ts +26 -3
- package/dist/scene-cases.js +167 -54
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +7 -2
- package/dist/scene.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-5CSWQSH7.js.map +0 -1
|
@@ -355,6 +355,16 @@ interface SceneItemLayout {
|
|
|
355
355
|
readonly rides?: string;
|
|
356
356
|
/** Its column folded: by hand (every member folded) or by give-way. */
|
|
357
357
|
readonly folded?: "hand" | "auto";
|
|
358
|
+
/**
|
|
359
|
+
* Why this item is drawn smaller than its first form, read from the scene's own state, never inferred from the rects:
|
|
360
|
+
* `"hand"` when it is folded by hand (`SceneItem.from` over 0, which `fold` sets), `"auto"` when it gave way (a form
|
|
361
|
+
* below the one it started in, by length or width, a » menu entry included: the same word `folded` uses for a column
|
|
362
|
+
* folded by give-way). Absent when the item shows its first form, is closed, or lies in an icons-only edge in the form
|
|
363
|
+
* that edge gives it. By hand wins: a hand-folded item that gave way further is `"hand"`, since expanding it
|
|
364
|
+
* (`fold(scene, id, false)`) is the user's to do, so a host shows "Expand" for `"hand"` only. A float is only ever
|
|
365
|
+
* folded by hand. `folded` is about the item's column; this one is about the item.
|
|
366
|
+
*/
|
|
367
|
+
readonly foldedBy?: "hand" | "auto";
|
|
358
368
|
/** A `wrap` form: the word indexes per row (the words wrap beside the grip, a hanging indent). */
|
|
359
369
|
readonly rows?: readonly (readonly number[])[];
|
|
360
370
|
/** Its grip: a `wrap` form's lead cell at the start of row one, or a form's `grip` strip (an icons strip's, on top). */
|
|
@@ -378,6 +388,14 @@ interface SceneEdgeLayout {
|
|
|
378
388
|
readonly rect: Rect;
|
|
379
389
|
readonly items: readonly string[];
|
|
380
390
|
} | null;
|
|
391
|
+
/**
|
|
392
|
+
* Its items in the edge's order: the zones in order (start, center, end), then the order within each zone, the order
|
|
393
|
+
* `solve` lays them in. Exactly the ids `SceneLayout.items` draws for this edge (`SceneItemLayout.edge`): an item in the
|
|
394
|
+
* » menu keeps its place (`menu.items` names those, so a host wanting the docked ones filters them out), a rail tab is
|
|
395
|
+
* listed, and a closed item is left out (unless it shows as a rail tab). A column folded into its rail or riding lists
|
|
396
|
+
* its members in zone order. Never sort rects to learn it.
|
|
397
|
+
*/
|
|
398
|
+
readonly items: readonly string[];
|
|
381
399
|
/** The ids drawn as rail tabs, in order (empty unless the column is a rail). */
|
|
382
400
|
readonly tabs: readonly string[];
|
|
383
401
|
/**
|
|
@@ -549,7 +567,8 @@ interface FloatResize {
|
|
|
549
567
|
* then along, over its new width), and such a stop beats the minimum. The rect is then laid by the one clamp `solve`
|
|
550
568
|
* lays floats with, so `solve(resize(...))` draws exactly this rect. A float that already covers something (no clear
|
|
551
569
|
* place at its size) may move to a clear place once a resize opens one; the preview is still the commit, and
|
|
552
|
-
* `"docked"` says so.
|
|
570
|
+
* `"docked"` says so. Such a float never grows over what it covers: a dragged edge that lies inside an obstacle stays
|
|
571
|
+
* where it is drawn (`"docked"`), so a resize never covers more than the float did. `limits` says which of these bound it.
|
|
553
572
|
*
|
|
554
573
|
* Null for anything but a float drawn at its first form when that form grows (a panel's card): a toolbar group's size
|
|
555
574
|
* comes from its forms, and so does a folded float's bar. Pure: it solves the scene once, for what is drawn now.
|
|
@@ -798,4 +817,4 @@ interface SceneRefusal {
|
|
|
798
817
|
readonly reason: "no-room" | "own-place" | "not-accepted";
|
|
799
818
|
}
|
|
800
819
|
|
|
801
|
-
export { fold as $, type ResizeLimit as A, SIDES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type SceneAfter as G, type SceneEdgeLayout as H, type SceneFloat as I, type SceneItemLayout as J, type Kind as K, type SceneNote as L, type SceneRailLayout as M, type SceneRead as N, type Orient as O, type Place as P, type StoredSceneEdge as Q, type RailMode as R, type Scene as S, type StoredSceneFloat as T, type StoredSceneItem as U, ZONES as V, close as W, dockHome as X, fitResize as Y, type Zone as Z, floatAt as _, type ScenePlace as a, homeFor as a0, keep as a1, lift as a2, moveTo as a3, open as a4, orient as a5, raise as a6, readScene as a7, resize as a8, setRailMode as a9, setSide as aa, storeScene as ab, use as ac, type SceneLayout as b, type StoredScene as c, type SceneTarget as d, type Side as e, type SceneNoteCode as f, type
|
|
820
|
+
export { fold as $, type ResizeLimit as A, SIDES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type SceneAfter as G, type SceneEdgeLayout as H, type SceneFloat as I, type SceneItemLayout as J, type Kind as K, type SceneNote as L, type SceneRailLayout as M, type SceneRead as N, type Orient as O, type Place as P, type StoredSceneEdge as Q, type RailMode as R, type Scene as S, type StoredSceneFloat as T, type StoredSceneItem as U, ZONES as V, close as W, dockHome as X, fitResize as Y, type Zone as Z, floatAt as _, type ScenePlace as a, homeFor as a0, keep as a1, lift as a2, moveTo as a3, open as a4, orient as a5, raise as a6, readScene as a7, resize as a8, setRailMode as a9, setSide as aa, storeScene as ab, use as ac, type SceneLayout as b, type StoredScene as c, type SceneTarget as d, type Side as e, type SceneNoteCode as f, type SceneRefusal as g, type SceneItem as h, type ZoneAccepts as i, type SolveOptions as j, type SceneTargetOptions as k, type ColumnTemplate as l, DEFAULT_HIT_BAND as m, DEFAULT_RAIL_MAGNET as n, DEFAULT_STRIP as o, type DockPlace as p, type FloatPlace as q, type FloatResize as r, RAIL_MODES as s, RAIL_STRIP_MIN as t, RAIL_VISIBILITIES as u, type RailDropPolicy as v, type RailPlace as w, type RailSpec as x, type RailVisibility as y, type ResizeEdges as z };
|
package/dist/scene-cases.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as Point, R as Rect } from './geometry-Bf37LbCT.js';
|
|
2
2
|
import { S as StackFormKind } from './model-X7eUaKlA.js';
|
|
3
|
-
import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, d as SceneTarget, Z as Zone, e as Side, f as SceneNoteCode } from './model-
|
|
3
|
+
import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, d as SceneTarget, Z as Zone, e as Side, f as SceneNoteCode, g as SceneRefusal } from './model-BSIKmANw.js';
|
|
4
4
|
import './target-2RYYKkd1.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -126,7 +126,8 @@ interface LayoutExpect {
|
|
|
126
126
|
/**
|
|
127
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
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
|
|
129
|
+
* for the insertion line, `[data-drag-held]` for the held item, `[data-drag-refusal]` for a refusal shown at the pointer
|
|
130
|
+
* ("No room here"; the attribute holds the refusal's id). A drawn item's element is found by `item`: the host's
|
|
130
131
|
* `itemSelector(id)`, by default `[data-dock-item="<id>"]` (a rect check reads it).
|
|
131
132
|
*/
|
|
132
133
|
interface DomCheck {
|
|
@@ -170,6 +171,12 @@ interface CaseRequires {
|
|
|
170
171
|
readonly hitBand?: "default";
|
|
171
172
|
/** The sides whose rail the scene declares (`Scene.rails`) and shows at the start (a folded column puts panels in it), so a host needs a rail to aim at there. */
|
|
172
173
|
readonly rails?: readonly ("left" | "right")[];
|
|
174
|
+
/**
|
|
175
|
+
* The host drags with a drag intent (`@n-uf/motion/drag`'s `createDragIntent`, or one with its timing): the row checks
|
|
176
|
+
* what the intent adds to the pick at a point (a shown target held a band's width past its hit while the pointer
|
|
177
|
+
* rests there). A host that picks at the point alone, the in-memory reference host among them, skips the row.
|
|
178
|
+
*/
|
|
179
|
+
readonly intent?: true;
|
|
173
180
|
}
|
|
174
181
|
interface CaseRow {
|
|
175
182
|
/** Generic and stable: an integrating app's suite names rows by it. */
|
|
@@ -308,6 +315,12 @@ declare function pickTarget<T extends {
|
|
|
308
315
|
readonly hit: Rect;
|
|
309
316
|
readonly hits?: readonly Rect[];
|
|
310
317
|
}>(list: readonly T[], point: Point): T | null;
|
|
318
|
+
/**
|
|
319
|
+
* The pick rule with the scene's refusals (`refusals(scene, dragged)`): where nothing more precise than the float is
|
|
320
|
+
* under the point and a refusal's hit holds it, nothing is picked, so a release there commits nothing and the item goes
|
|
321
|
+
* home ("No room here"). Every host aims and drops with it: the reference host, and a page's host for `resolvePlace`.
|
|
322
|
+
*/
|
|
323
|
+
declare function withRefusals(pick: PickRule, refused: readonly SceneRefusal[]): PickRule;
|
|
311
324
|
/** What `resolvePlace` may aim at when a target covers the whole plane (a float): the stage and the content. */
|
|
312
325
|
interface AimArea {
|
|
313
326
|
readonly stage: Rect;
|
|
@@ -321,6 +334,16 @@ interface AimArea {
|
|
|
321
334
|
* a blocked spot covers entirely).
|
|
322
335
|
*/
|
|
323
336
|
declare function resolvePlace(list: readonly SceneTarget[], place: ScenePlace, item: string, area_: AimArea, pick?: PickRule): Point | null;
|
|
337
|
+
/**
|
|
338
|
+
* A `resize` gesture as a pure step, for any host: the scene after it, and the loaded scene (`start`, what `"dock"` puts
|
|
339
|
+
* items back to) after it too. With `edge`, the user's size across that edge; with `item`, that item's largest form along
|
|
340
|
+
* the axis it lies along in `layout` grew by `size` px (in both scenes: it was measured again); with neither, the window
|
|
341
|
+
* is now `point.x` by `point.y`. Throws when the gesture names nothing that exists.
|
|
342
|
+
*/
|
|
343
|
+
declare function resizeStep(scene: Scene, start: Scene, layout: SceneLayout, g: Gesture): {
|
|
344
|
+
readonly scene: Scene;
|
|
345
|
+
readonly start: Scene;
|
|
346
|
+
};
|
|
324
347
|
/** What the in-memory host knows about a drag in progress. */
|
|
325
348
|
interface HostDrag {
|
|
326
349
|
readonly item: string;
|
|
@@ -512,4 +535,4 @@ declare const CASE_GROUPS: readonly {
|
|
|
512
535
|
/** The row with this id, or undefined. */
|
|
513
536
|
declare const caseById: (id: string) => CaseRow | undefined;
|
|
514
537
|
|
|
515
|
-
export { type AimArea, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseRequires, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, type Gesture, type GestureType, type IdMap, type ItemExpect, LIFT_THRESHOLD, type LayoutExpect, type PickRule, type Rename, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createSceneHost, defaultItemSelector, g, idRenames, layoutIssues, mapGesture, mapLayout, mapPlace, mapScene, mapStored, pickTarget, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, winScene };
|
|
538
|
+
export { type AimArea, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseRequires, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, type Gesture, type GestureType, type IdMap, type ItemExpect, LIFT_THRESHOLD, type LayoutExpect, type PickRule, type Rename, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createSceneHost, defaultItemSelector, g, idRenames, layoutIssues, mapGesture, mapLayout, mapPlace, mapScene, mapStored, pickTarget, resizeStep, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, winScene, withRefusals };
|
package/dist/scene-cases.js
CHANGED
|
@@ -8,13 +8,14 @@ import {
|
|
|
8
8
|
placeTargetId,
|
|
9
9
|
raise,
|
|
10
10
|
readScene,
|
|
11
|
+
refusals,
|
|
11
12
|
resize,
|
|
12
13
|
solve,
|
|
13
14
|
stops,
|
|
14
15
|
storeScene,
|
|
15
16
|
targets,
|
|
16
17
|
use
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-COK4YNMF.js";
|
|
18
19
|
import "./chunk-AE3BWTAE.js";
|
|
19
20
|
import {
|
|
20
21
|
centre,
|
|
@@ -713,6 +714,10 @@ var BAR_ROWS = [
|
|
|
713
714
|
// src/scene/cases/rows-rules.ts
|
|
714
715
|
var panelsOnly = () => tweakEdge({ ...doc(), floatKinds: ["panel"] }, "left", { accepts: ["panel"] });
|
|
715
716
|
var trayColumn = () => tweakEdge({ ...doc(), floatKinds: ["panel"] }, "left", { zoneAccepts: { start: ["panel"], end: ["group"] } });
|
|
717
|
+
function barZones() {
|
|
718
|
+
const s = tweakEdge(doc(), "toolbar", { items: ["views", "zoom"] });
|
|
719
|
+
return { ...s, floats: [...s.floats, { id: "tools", rect: rect(500, 300, 200, 28) }] };
|
|
720
|
+
}
|
|
716
721
|
var RULE_ROWS = [
|
|
717
722
|
{
|
|
718
723
|
id: "C24",
|
|
@@ -733,12 +738,17 @@ var RULE_ROWS = [
|
|
|
733
738
|
{
|
|
734
739
|
id: "C25",
|
|
735
740
|
title: "Targets by kind: a panel in a toolbar",
|
|
736
|
-
expect:
|
|
741
|
+
expect: 'An edge takes only the kinds it lists: a panel held over the toolbar is offered no gap there and no float either: the toolbar refuses it ("No room here"), and a release there puts it back, the toolbar as it was.',
|
|
737
742
|
group: "kinds",
|
|
738
743
|
scene: doc(),
|
|
739
744
|
// (600, 50) is a real gap for a group (the toolbar's center gap): the control row below lets a group go there.
|
|
740
|
-
gestures: [g.press("pages", { x: 20, y: 10 }), g.at(600, 50), g.hold()],
|
|
741
|
-
|
|
745
|
+
gestures: [g.press("pages", { x: 20, y: 10 }), g.at(600, 50), g.hold(), g.release()],
|
|
746
|
+
checkpoints: [{ at: 2, layout: { items: { pages: null, views: { rect: rect(8, 32, 200, 36) }, tools: { rect: rect(212, 32, 200, 36) }, zoom: { rect: rect(992, 32, 200, 36) } }, order: { toolbar: ["views", "tools", "zoom"] } }, note: "refused: no target, the held item out of the layout" }],
|
|
747
|
+
expectLayout: { items: { pages: { edge: "left", floating: false }, views: { rect: rect(8, 32, 200, 36) }, tools: { rect: rect(212, 32, 200, 36) }, zoom: { rect: rect(992, 32, 200, 36) } }, order: { toolbar: ["views", "tools", "zoom"], left: ["pages"] } },
|
|
748
|
+
expectDom: [
|
|
749
|
+
{ at: 2, select: "[data-drag-refusal]", count: 1, attr: { "data-drag-refusal": "refuse:toolbar:center" }, note: "the refusal shows where the pointer is" },
|
|
750
|
+
{ at: 2, select: "[data-drag-slot]", count: 0, note: "no slot anywhere" }
|
|
751
|
+
]
|
|
742
752
|
},
|
|
743
753
|
{
|
|
744
754
|
id: "C25-control-bar",
|
|
@@ -796,10 +806,11 @@ var RULE_ROWS = [
|
|
|
796
806
|
{
|
|
797
807
|
id: "C27",
|
|
798
808
|
title: "Floats never cover the bars",
|
|
799
|
-
expect: "A float let go over the
|
|
809
|
+
expect: "A float let go just under the toolbar, where its grab would put its top over the bar, lands clear of every bar, not on them.",
|
|
800
810
|
group: "kinds",
|
|
801
811
|
scene: doc(),
|
|
802
|
-
|
|
812
|
+
// (600, 72): the content, 4 px under the toolbar; the grab (10 px down) would put the float's top at 62, over the bar.
|
|
813
|
+
gestures: [g.press("notes", { x: 20, y: 10 }), g.at(600, 72), g.hold(), g.release()],
|
|
803
814
|
checkpoints: [{ at: 2, layout: { items: { notes: { floating: true, rect: rect(580, 68, 280, 320) }, title: { rect: rect(0, 0, 1116, 32) }, controls: { rect: rect(1116, 0, 84, 32) } } }, note: "the preview" }],
|
|
804
815
|
expectLayout: { items: { notes: { floating: true, rect: rect(580, 68, 280, 320) }, title: { rect: rect(0, 0, 1116, 32) }, controls: { rect: rect(1116, 0, 84, 32) } } }
|
|
805
816
|
},
|
|
@@ -846,22 +857,45 @@ var RULE_ROWS = [
|
|
|
846
857
|
// --- gaps as bands, content changes, the float slot ---------------------------------------------------------------------
|
|
847
858
|
{
|
|
848
859
|
id: "R4-band-at-a-boundary",
|
|
849
|
-
title: "
|
|
850
|
-
expect: "
|
|
860
|
+
title: "The hit area's boundary: 2 px past a gap's hit picks nothing (approached from the content)",
|
|
861
|
+
expect: "The geometry alone: beside a panel's body a gap's hit is a band around the boundary between the Findings panel and the Marks toolbar below it, so 11 px above the boundary is the gap and 13 px above, over the panel's body, reached from the content (where nothing is shown), picks nothing. Below the boundary the toolbar is a short item, not a body: its whole length belongs to the nearest gap, so 11 and 13 px below are both that gap. Leaving the gap from inside is R4b.",
|
|
851
862
|
group: "bands",
|
|
852
863
|
scene: panelsOnly(),
|
|
853
|
-
// The boundary is at y 704. In: 693, 715 and 717 (over the toolbar). Out: 691 (over the body)
|
|
854
|
-
|
|
864
|
+
// The boundary is at y 704. In: 693, 715 and 717 (over the toolbar). Out: 691 (over the body), reached from the
|
|
865
|
+
// content (600, 400), where a group has no target: the geometry alone, with no target carried over (a host's intent
|
|
866
|
+
// keeps a shown gap a band's width past its hit; that is the intent's rule, checked in @n-uf/motion/drag).
|
|
867
|
+
gestures: [g.press("tools"), g.at(1070, 693), g.hold(), g.at(1070, 715), g.hold(), g.at(600, 400), g.hold(), g.at(1070, 691), g.hold(), g.at(1070, 717), g.hold()],
|
|
855
868
|
checkpoints: [
|
|
856
869
|
{ at: 2, layout: { items: { findings: { rect: rect(940, 68, 260, 540) }, tools: { edge: "right", rect: rect(940, 608, 84, 96) }, marks: { rect: rect(940, 704, 84, 96) } }, order: { right: ["findings", "tools", "marks"] } }, note: "11 px above the boundary: in the band" },
|
|
857
870
|
{ at: 4, layout: { items: { findings: { rect: rect(940, 68, 260, 540) }, tools: { edge: "right", rect: rect(940, 608, 84, 96) } }, order: { right: ["findings", "tools", "marks"] } }, note: "11 px below: over the toolbar" },
|
|
858
|
-
{ at: 6, layout: { items: { tools: null
|
|
871
|
+
{ at: 6, layout: { items: { tools: null } }, note: "over the content: no target for a group" },
|
|
872
|
+
{ at: 8, layout: { items: { tools: null, findings: { rect: rect(940, 68, 260, 636) }, marks: { rect: rect(940, 704, 84, 96) } } }, note: "13 px above, over the body: out" }
|
|
859
873
|
],
|
|
860
874
|
expectLayout: { items: { findings: { rect: rect(940, 68, 260, 540) }, tools: { edge: "right", rect: rect(940, 608, 84, 96) }, marks: { rect: rect(940, 704, 84, 96) } }, order: { right: ["findings", "tools", "marks"] } },
|
|
861
875
|
expectDom: [
|
|
862
876
|
{ at: 2, select: "[data-drag-slot][data-drag-target]", count: 1, attr: { "data-drag-target": "gap:right:start:1" }, note: "the slot on the boundary's gap" },
|
|
863
|
-
{ at:
|
|
864
|
-
{ at:
|
|
877
|
+
{ at: 8, select: "[data-drag-slot]", count: 0, note: "no slot 13 px off, over the body" },
|
|
878
|
+
{ at: 10, select: "[data-drag-slot][data-drag-target]", count: 1, attr: { "data-drag-target": "gap:right:start:1" }, note: "13 px below, over the toolbar: the same gap" }
|
|
879
|
+
]
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
id: "R4b-leaving-the-band",
|
|
883
|
+
title: "Leaving a gap: the drag intent holds it a band's width past its hit",
|
|
884
|
+
expect: "A host with a drag intent: Tools shown on the gap 11 px below the boundary, then moved 13 px above it (over the panel's body, just past the gap's hit) and rested, still shows that gap (the intent's band holds a shown target); moved on past the band and rested, it shows nothing.",
|
|
885
|
+
group: "bands",
|
|
886
|
+
scene: panelsOnly(),
|
|
887
|
+
// The gap's hit reaches 12 px above the boundary (y 692); the intent's band 10 px more (682). 691: past the hit, inside
|
|
888
|
+
// the band. 678: past the band.
|
|
889
|
+
gestures: [g.press("tools"), g.at(1070, 715), g.hold(), g.at(1070, 691), g.hold(), g.at(1070, 678), g.hold()],
|
|
890
|
+
requires: { intent: true },
|
|
891
|
+
checkpoints: [
|
|
892
|
+
{ at: 2, layout: { items: { tools: { edge: "right", rect: rect(940, 608, 84, 96) } }, order: { right: ["findings", "tools", "marks"] } }, note: "on the gap" },
|
|
893
|
+
{ at: 4, layout: { items: { tools: { edge: "right", rect: rect(940, 608, 84, 96) } }, order: { right: ["findings", "tools", "marks"] } }, note: "past the hit, inside the band: the gap holds" }
|
|
894
|
+
],
|
|
895
|
+
expectLayout: { items: { tools: null, findings: { rect: rect(940, 68, 260, 636) }, marks: { rect: rect(940, 704, 84, 96) } } },
|
|
896
|
+
expectDom: [
|
|
897
|
+
{ at: 4, select: "[data-drag-slot][data-drag-target]", count: 1, attr: { "data-drag-target": "gap:right:start:1" }, note: "the band holds the gap's slot" },
|
|
898
|
+
{ at: 6, select: "[data-drag-slot]", count: 0, note: "past the band: no slot" }
|
|
865
899
|
]
|
|
866
900
|
},
|
|
867
901
|
{
|
|
@@ -978,7 +1012,25 @@ var RULE_ROWS = [
|
|
|
978
1012
|
scene: tweakEdge(trayColumn(), "left", { items: [] }),
|
|
979
1013
|
gestures: [g.press("findings"), g.at(10, 150), g.hold(), g.release()],
|
|
980
1014
|
expectLayout: { items: { findings: { formKind: "open", edge: "left", rect: rect(0, 68, 260, 732) } }, order: { left: ["findings"] } }
|
|
981
|
-
}
|
|
1015
|
+
},
|
|
1016
|
+
...["start", "center", "end"].map(
|
|
1017
|
+
(zone) => ({
|
|
1018
|
+
id: `R6-bar-${zone}-zone`,
|
|
1019
|
+
title: `A toolbar dropped in a bar's ${zone} zone`,
|
|
1020
|
+
expect: {
|
|
1021
|
+
start: "Tools, floating, dropped after Views in the toolbar's start zone lands leading, right after Views.",
|
|
1022
|
+
center: "Tools dropped in the toolbar's center zone lands at the bar's true center, clear of Views at the start and Zoom at the end.",
|
|
1023
|
+
end: "Tools dropped in the toolbar's end zone lands trailing, right before Zoom."
|
|
1024
|
+
}[zone],
|
|
1025
|
+
group: "groups",
|
|
1026
|
+
scene: barZones(),
|
|
1027
|
+
gestures: g.drag("tools", g.gap("toolbar", zone === "start" ? 1 : 0, zone)),
|
|
1028
|
+
expectLayout: {
|
|
1029
|
+
items: { tools: { edge: "toolbar", zone, formKind: "row", rect: rect({ start: 212, center: 500, end: 788 }[zone], 32, 200, 36) }, views: { rect: rect(8, 32, 200, 36) }, zoom: { rect: rect(992, 32, 200, 36) } },
|
|
1030
|
+
order: { toolbar: ["views", "tools", "zoom"] }
|
|
1031
|
+
}
|
|
1032
|
+
})
|
|
1033
|
+
)
|
|
982
1034
|
];
|
|
983
1035
|
|
|
984
1036
|
// src/scene/cases/windows.ts
|
|
@@ -1023,6 +1075,8 @@ function winScene(spec, o = {}) {
|
|
|
1023
1075
|
|
|
1024
1076
|
// src/scene/cases/rows-gestures.ts
|
|
1025
1077
|
var win = (o = {}) => winScene(WINDOW_A, { size: 300, ...o });
|
|
1078
|
+
var FLUSH_W = 1440;
|
|
1079
|
+
var flush = () => winScene(WINDOW_B, { width: FLUSH_W, height: 900, handFold: "ride" });
|
|
1026
1080
|
function withTitle(s) {
|
|
1027
1081
|
return {
|
|
1028
1082
|
...s,
|
|
@@ -1223,10 +1277,11 @@ var GESTURE_ROWS = [
|
|
|
1223
1277
|
{
|
|
1224
1278
|
id: "P11-a-float-never-covers-chrome",
|
|
1225
1279
|
title: "A float never covers chrome",
|
|
1226
|
-
expect: "Annotations let go
|
|
1280
|
+
expect: "Annotations let go just under the title bar, where its grab would put its top over the bar, lands below it, clear of every bar, and the slot never covers the title.",
|
|
1227
1281
|
group: "gestures",
|
|
1228
1282
|
scene: withTitle(win()),
|
|
1229
|
-
|
|
1283
|
+
// (600, 32): 4 px under the title bar; the grab (10 px down) would put the float's top at 22, over the bar.
|
|
1284
|
+
gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(600, 32), g.hold(), g.release()],
|
|
1230
1285
|
checkpoints: [{ at: 2, layout: { items: { annotations: { floating: true, rect: rect(528, 28, 280, 360) }, "window-title": { rect: rect(12, 0, 1096, 28) }, pages: { rect: rect(12, 28, 300, 772) } } }, note: "the preview, below the title bar" }],
|
|
1231
1286
|
expectLayout: { items: { annotations: { floating: true, rect: rect(528, 28, 280, 360) }, "window-title": { rect: rect(12, 0, 1096, 28) }, pages: { rect: rect(12, 28, 300, 772) } } }
|
|
1232
1287
|
},
|
|
@@ -1262,16 +1317,20 @@ var GESTURE_ROWS = [
|
|
|
1262
1317
|
{
|
|
1263
1318
|
id: "P13-kinds",
|
|
1264
1319
|
title: "Targets by kind: a panel",
|
|
1265
|
-
expect:
|
|
1320
|
+
expect: `Lifting a panel offers panel columns, rails, new-column lines and the float target, never a toolbar's gaps: over the tools bar it is refused ("No room here"), and a release there puts it back.`,
|
|
1266
1321
|
group: "gestures",
|
|
1267
1322
|
scene: {
|
|
1268
1323
|
...win(),
|
|
1269
1324
|
edges: [...win().edges, { id: "tools-bar", side: "bottom", ring: 0, span: "full", accepts: ["group"], items: ["tools"], cross: { min: 28, max: 60 } }],
|
|
1270
1325
|
items: { ...win().items, tools: { id: "tools", kind: "group", used: 0, forms: { row: [form("stacked", 60, 120, 28), form("icons", 40, 40, 28), form("menu", 0, 0, 0)] } } }
|
|
1271
1326
|
},
|
|
1272
|
-
gestures: [g.press("pages", { x: 20, y: 10 }), g.at(560, 780), g.hold()],
|
|
1273
|
-
|
|
1274
|
-
|
|
1327
|
+
gestures: [g.press("pages", { x: 20, y: 10 }), g.at(560, 780), g.hold(), g.release()],
|
|
1328
|
+
checkpoints: [{ at: 2, layout: { items: { pages: null, tools: { edge: "tools-bar", rect: rect(12, 770, 120, 30) } }, order: { "tools-bar": ["tools"] } }, note: "refused: no target, the held item out of the layout" }],
|
|
1329
|
+
expectLayout: { items: { pages: { edge: "left-0", floating: false }, tools: { edge: "tools-bar", rect: rect(12, 770, 120, 30) } }, order: { "tools-bar": ["tools"] }, columns: { left: [["pages", "annotations"]] } },
|
|
1330
|
+
expectDom: [
|
|
1331
|
+
{ at: 2, select: "[data-drag-refusal]", count: 1, attr: { "data-drag-refusal": "refuse:tools-bar:center" }, note: "the refusal shows where the pointer is" },
|
|
1332
|
+
{ at: 2, select: "[data-drag-slot]", count: 0, note: "no slot anywhere" }
|
|
1333
|
+
]
|
|
1275
1334
|
},
|
|
1276
1335
|
{
|
|
1277
1336
|
id: "P13-a-group-never-gets-panel-targets",
|
|
@@ -1358,6 +1417,43 @@ var GESTURE_ROWS = [
|
|
|
1358
1417
|
checkpoints: [{ at: 1, layout: { items: { pages: { rect: rect(12, 0, 300, 394) }, annotations: { formKind: "open", edge: "left-0", rect: rect(12, 406, 300, 394) } } }, note: "docked back, open" }],
|
|
1359
1418
|
expectLayout: { items: { pages: { rect: rect(12, 0, 300, 394) }, annotations: { formKind: "open", edge: "left-0", rect: rect(12, 406, 300, 394) }, findings: { rect: rect(808, 0, 300, 800) } }, columns: { left: [["pages", "annotations"]], right: [["findings"]] } },
|
|
1360
1419
|
expectStored: { items: { annotations: { from: null } } }
|
|
1420
|
+
},
|
|
1421
|
+
{
|
|
1422
|
+
id: "P16-first-px-left",
|
|
1423
|
+
title: "The window's first px is the new-column line",
|
|
1424
|
+
expect: "In a flush window with a column open on each side, Annotations held over the float mid-window, then moved to the window's first px on the left and rested there, lands in a new outer left column: the float never holds the window's edge.",
|
|
1425
|
+
group: "gestures",
|
|
1426
|
+
scene: flush(),
|
|
1427
|
+
gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(FLUSH_W / 2, 400), g.hold(), g.at(0, 400), g.hold(), g.release()],
|
|
1428
|
+
expectLayout: { items: { annotations: { edge: "left-1", rect: rect(0, 0, 200, 900) }, pages: { rect: rect(200, 0, 200, 900) } }, columns: { left: [["annotations"], ["pages"]], right: [["findings"]] }, floats: [] }
|
|
1429
|
+
},
|
|
1430
|
+
{
|
|
1431
|
+
id: "P16-first-px-right",
|
|
1432
|
+
title: "The window's last px is the new-column line",
|
|
1433
|
+
expect: "The same on the right: Annotations rested over the float, then at the window's last px, lands in a new outer right column.",
|
|
1434
|
+
group: "gestures",
|
|
1435
|
+
scene: flush(),
|
|
1436
|
+
gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(FLUSH_W / 2, 400), g.hold(), g.at(FLUSH_W - 1, 400), g.hold(), g.release()],
|
|
1437
|
+
expectLayout: { items: { annotations: { edge: "right-1", rect: rect(FLUSH_W - 200, 0, 200, 900) }, findings: { rect: rect(FLUSH_W - 400, 0, 200, 900) } }, columns: { left: [["pages"]], right: [["annotations"], ["findings"]] }, floats: [] }
|
|
1438
|
+
},
|
|
1439
|
+
{
|
|
1440
|
+
id: "P16-outer-reach-is-the-column-line",
|
|
1441
|
+
title: "The window's outer 10 px are the new-column line",
|
|
1442
|
+
expect: "With hand folds riding, the left rail can't take the drop while the left column stays open, so it owns none of the window's edge: Annotations let go 9 px in from the left lands in a new outer column, neither floating nor refused.",
|
|
1443
|
+
group: "gestures",
|
|
1444
|
+
scene: flush(),
|
|
1445
|
+
gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(9, 400), g.hold(), g.release()],
|
|
1446
|
+
expectLayout: { items: { annotations: { edge: "left-1", rect: rect(0, 0, 200, 900) } }, columns: { left: [["annotations"], ["pages"]], right: [["findings"]] }, floats: [] }
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
id: "P16-own-column-line-is-home",
|
|
1450
|
+
title: "A new column where the item's own column is, is home",
|
|
1451
|
+
expect: "Findings alone in the right column, rested over the float and then over its own column: a new column holding it alone there is the same move as home, so the release changes nothing.",
|
|
1452
|
+
group: "gestures",
|
|
1453
|
+
scene: flush(),
|
|
1454
|
+
gestures: [g.press("findings", { x: 20, y: 10 }), g.at(FLUSH_W / 2, 400), g.hold(), g.at(1300, 400), g.hold(), g.release()],
|
|
1455
|
+
checkpoints: [{ at: 4, layout: { items: { findings: { edge: "right-0", rect: rect(FLUSH_W - 200, 0, 200, 900) } } }, note: "over its own column: back in its place" }],
|
|
1456
|
+
expectLayout: { items: { findings: { edge: "right-0", rect: rect(FLUSH_W - 200, 0, 200, 900) }, annotations: { edge: "left-0" } }, columns: { left: [["pages", "annotations"]], right: [["findings"]] }, floats: [] }
|
|
1361
1457
|
}
|
|
1362
1458
|
];
|
|
1363
1459
|
|
|
@@ -1484,6 +1580,14 @@ function pickTarget(list, point) {
|
|
|
1484
1580
|
}
|
|
1485
1581
|
return best;
|
|
1486
1582
|
}
|
|
1583
|
+
function withRefusals(pick, refused) {
|
|
1584
|
+
if (refused.length === 0) return pick;
|
|
1585
|
+
return (list, point) => {
|
|
1586
|
+
const t = pick(list, point);
|
|
1587
|
+
if (t && t.place.kind !== "float") return t;
|
|
1588
|
+
return refused.some((r) => contains(r.hit, point, 0)) ? null : t;
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1487
1591
|
function targetAt(list, place, item) {
|
|
1488
1592
|
const id = placeTargetId(place, item);
|
|
1489
1593
|
return (id ? list.find((t) => t.id === id) : void 0) ?? list.find((t) => t.place.kind === place.kind && (place.kind === "none" || id === null)) ?? null;
|
|
@@ -1505,6 +1609,36 @@ function resolvePlace(list, place, item, area_, pick = pickTarget) {
|
|
|
1505
1609
|
}
|
|
1506
1610
|
return candidates.find((p) => contains(t.hit, p) && pick(list, p) === t) ?? null;
|
|
1507
1611
|
}
|
|
1612
|
+
function resizeStep(scene, start, layout, g2) {
|
|
1613
|
+
if (g2.edge !== void 0) {
|
|
1614
|
+
if (g2.size === void 0) throw new Error("a resize of an edge needs a size");
|
|
1615
|
+
if (!scene.edges.some((e) => e.id === g2.edge)) throw new Error(`no edge ${g2.edge}`);
|
|
1616
|
+
return { scene: resize(scene, g2.edge, g2.size), start };
|
|
1617
|
+
}
|
|
1618
|
+
if (g2.item !== void 0) {
|
|
1619
|
+
if (g2.size === void 0) throw new Error("a resize of an item needs a size");
|
|
1620
|
+
const id = g2.item;
|
|
1621
|
+
const d = g2.size;
|
|
1622
|
+
if (!Object.hasOwn(scene.items, id)) throw new Error(`no item ${id}`);
|
|
1623
|
+
const edge = layout.items[id]?.edge;
|
|
1624
|
+
const side = edge ? layout.edges[edge]?.side : void 0;
|
|
1625
|
+
const axis = side === "top" || side === "bottom" ? "row" : "column";
|
|
1626
|
+
const grown = (s) => {
|
|
1627
|
+
const it = Object.hasOwn(s.items, id) ? s.items[id] : void 0;
|
|
1628
|
+
const forms = it?.forms[axis];
|
|
1629
|
+
if (!it || !forms || forms.length === 0) return s;
|
|
1630
|
+
const f0 = forms[0];
|
|
1631
|
+
const f2 = { ...f0, main: { ...f0.main, min: Math.max(0, f0.main.min + d), natural: Math.max(0, f0.main.natural + d) } };
|
|
1632
|
+
return { ...s, items: { ...s.items, [id]: { ...it, forms: { ...it.forms, [axis]: [f2, ...forms.slice(1)] } } } };
|
|
1633
|
+
};
|
|
1634
|
+
return { scene: grown(scene), start: grown(start) };
|
|
1635
|
+
}
|
|
1636
|
+
if (g2.point) {
|
|
1637
|
+
const stage = stageRect(g2.point.x, g2.point.y);
|
|
1638
|
+
return { scene: { ...scene, stage }, start: { ...start, stage } };
|
|
1639
|
+
}
|
|
1640
|
+
throw new Error("a resize needs an edge, an item or a point (the window's size)");
|
|
1641
|
+
}
|
|
1508
1642
|
var stageRect = (w, h) => ({ x: 0, y: 0, width: w, height: h });
|
|
1509
1643
|
function createSceneHost(options = {}) {
|
|
1510
1644
|
const endReach = options.endReach ?? END_REACH;
|
|
@@ -1541,23 +1675,24 @@ function createSceneHost(options = {}) {
|
|
|
1541
1675
|
function liftNow(s) {
|
|
1542
1676
|
s.lifted = true;
|
|
1543
1677
|
s.list = targets(now(), s.item, { previous: prev(), endReach });
|
|
1544
|
-
s.
|
|
1678
|
+
s.pickAt = withRefusals(pick, refusals(now(), s.item, { previous: prev(), endReach }));
|
|
1679
|
+
s.target = s.pickAt(s.list, s.point);
|
|
1545
1680
|
}
|
|
1546
1681
|
function move(g2) {
|
|
1547
1682
|
const s = session;
|
|
1548
1683
|
if (!s) return;
|
|
1549
1684
|
if (g2.place) {
|
|
1550
1685
|
if (!s.lifted) liftNow(s);
|
|
1551
|
-
const p = resolvePlace(s.list, g2.place, s.item, aim(),
|
|
1686
|
+
const p = resolvePlace(s.list, g2.place, s.item, aim(), s.pickAt);
|
|
1552
1687
|
if (!p) throw new Error(`no point reaches the target at ${JSON.stringify(g2.place)} (targets: ${s.list.map((t) => t.id).join(", ") || "none"})`);
|
|
1553
1688
|
s.point = p;
|
|
1554
|
-
s.target =
|
|
1689
|
+
s.target = s.pickAt(s.list, p);
|
|
1555
1690
|
return;
|
|
1556
1691
|
}
|
|
1557
1692
|
if (!g2.point) throw new Error("a move needs a point or a place");
|
|
1558
1693
|
s.point = { x: g2.point.x, y: g2.point.y };
|
|
1559
1694
|
if (!s.lifted && Math.hypot(s.point.x - s.down.x, s.point.y - s.down.y) > lifted0) liftNow(s);
|
|
1560
|
-
else if (s.lifted) s.target =
|
|
1695
|
+
else if (s.lifted) s.target = s.pickAt(s.list, s.point);
|
|
1561
1696
|
}
|
|
1562
1697
|
function press(g2) {
|
|
1563
1698
|
session = null;
|
|
@@ -1571,7 +1706,7 @@ function createSceneHost(options = {}) {
|
|
|
1571
1706
|
const grab = g2.point ? { x: g2.point.x, y: g2.point.y } : { x: Math.min(defaultGrab.x, l.rect.width / 2), y: Math.min(defaultGrab.y, l.rect.height / 2) };
|
|
1572
1707
|
const down = { x: l.rect.x + grab.x, y: l.rect.y + grab.y };
|
|
1573
1708
|
if (l.floating) settle(raise(s, id));
|
|
1574
|
-
session = { item: id, grab, down, point: down, lifted: false, list: [], target: null };
|
|
1709
|
+
session = { item: id, grab, down, point: down, lifted: false, list: [], pickAt: pick, target: null };
|
|
1575
1710
|
}
|
|
1576
1711
|
function release() {
|
|
1577
1712
|
const s = session;
|
|
@@ -1636,35 +1771,10 @@ function createSceneHost(options = {}) {
|
|
|
1636
1771
|
throw new Error(`no control ${g2.key}`);
|
|
1637
1772
|
}
|
|
1638
1773
|
}
|
|
1639
|
-
function measure(id, d) {
|
|
1640
|
-
const edge = prev().items[id]?.edge;
|
|
1641
|
-
const side = edge ? prev().edges[edge]?.side : void 0;
|
|
1642
|
-
const axis = side === "top" || side === "bottom" ? "row" : "column";
|
|
1643
|
-
const grown = (s) => {
|
|
1644
|
-
const it = Object.hasOwn(s.items, id) ? s.items[id] : void 0;
|
|
1645
|
-
const forms = it?.forms[axis];
|
|
1646
|
-
if (!it || !forms || forms.length === 0) return s;
|
|
1647
|
-
const f0 = forms[0];
|
|
1648
|
-
const f2 = { ...f0, main: { ...f0.main, min: Math.max(0, f0.main.min + d), natural: Math.max(0, f0.main.natural + d) } };
|
|
1649
|
-
return { ...s, items: { ...s.items, [id]: { ...it, forms: { ...it.forms, [axis]: [f2, ...forms.slice(1)] } } } };
|
|
1650
|
-
};
|
|
1651
|
-
if (!Object.hasOwn(now().items, id)) throw new Error(`no item ${id}`);
|
|
1652
|
-
start = grown(start);
|
|
1653
|
-
settle(grown(now()));
|
|
1654
|
-
}
|
|
1655
1774
|
function resizeNow(g2) {
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
settle(resize(now(), g2.edge, g2.size));
|
|
1660
|
-
} else if (g2.item !== void 0) {
|
|
1661
|
-
if (g2.size === void 0) throw new Error("a resize of an item needs a size");
|
|
1662
|
-
measure(g2.item, g2.size);
|
|
1663
|
-
} else if (g2.point) {
|
|
1664
|
-
const stage = stageRect(g2.point.x, g2.point.y);
|
|
1665
|
-
start = { ...start, stage };
|
|
1666
|
-
settle({ ...now(), stage });
|
|
1667
|
-
} else throw new Error("a resize needs an edge, an item or a point (the window's size)");
|
|
1775
|
+
const next = resizeStep(now(), start, prev(), g2);
|
|
1776
|
+
start = next.start;
|
|
1777
|
+
settle(next.scene);
|
|
1668
1778
|
}
|
|
1669
1779
|
function reload() {
|
|
1670
1780
|
session = null;
|
|
@@ -1769,6 +1879,7 @@ function mapLayout(l, f2) {
|
|
|
1769
1879
|
stack: mapFit(e.stack, f2),
|
|
1770
1880
|
free: mapFit(e.free, f2),
|
|
1771
1881
|
menu: e.menu ? { ...e.menu, items: e.menu.items.map(f2) } : null,
|
|
1882
|
+
items: (e.items ?? []).map(f2),
|
|
1772
1883
|
tabs: e.tabs.map(f2),
|
|
1773
1884
|
...e.rides !== void 0 ? { rides: f2(e.rides) } : {}
|
|
1774
1885
|
});
|
|
@@ -2124,11 +2235,13 @@ export {
|
|
|
2124
2235
|
mapScene,
|
|
2125
2236
|
mapStored,
|
|
2126
2237
|
pickTarget,
|
|
2238
|
+
resizeStep,
|
|
2127
2239
|
resolvePlace,
|
|
2128
2240
|
runCase,
|
|
2129
2241
|
runCaseAsync,
|
|
2130
2242
|
runCases,
|
|
2131
2243
|
runCasesAsync,
|
|
2132
|
-
winScene
|
|
2244
|
+
winScene,
|
|
2245
|
+
withRefusals
|
|
2133
2246
|
};
|
|
2134
2247
|
//# sourceMappingURL=scene-cases.js.map
|