@n-uf/placement 26.11.45 → 26.11.47
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 +39 -0
- package/README.md +25 -6
- package/dist/{chunk-6IHRZ3NP.js → chunk-VNOEEI4L.js} +11 -5
- package/dist/chunk-VNOEEI4L.js.map +1 -0
- package/dist/{lanes-CRAFabRE.d.ts → lanes-0L2Cy12X.d.ts} +23 -3
- package/dist/scene-cases.d.ts +27 -11
- package/dist/scene-cases.js +61 -7
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +2 -2
- package/dist/scene.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-6IHRZ3NP.js.map +0 -1
|
@@ -407,7 +407,11 @@ interface Scene {
|
|
|
407
407
|
/**
|
|
408
408
|
* `"nearest"`: a bar's zones (start, center, end) meet halfway between the landing rects either side of each boundary,
|
|
409
409
|
* so the pointer picks the zone whose landing is nearest it. Absent: at thirds of the bar's length (each boundary moved
|
|
410
|
-
* past the cards seen beside it, as now). A declaration, like `foldedColumnDrop`: never stored.
|
|
410
|
+
* past the cards seen beside it, as now). A declaration, like `foldedColumnDrop`: never stored. It moves each zone's
|
|
411
|
+
* extent, so it changes which zone a pointer picks among `targets()` (the hit areas a drag intent reads), and, since a
|
|
412
|
+
* zone left with no room gets no drop, which of a bar's drops exist and where its refused stretches lie. Under a
|
|
413
|
+
* landing model `lanes()` cuts between spots by their landings, not by zones: there it changes which spots and
|
|
414
|
+
* refused stretches a bar has, never the rule that cuts between spots (the cuts follow whichever spots exist).
|
|
411
415
|
*/
|
|
412
416
|
readonly barZones?: "nearest";
|
|
413
417
|
/**
|
|
@@ -1040,8 +1044,10 @@ interface SceneRefusal {
|
|
|
1040
1044
|
* item `Y` in `X|Y` and `Y|Z`), the boundary is that item's middle as drawn (in the held spot's own layout with
|
|
1041
1045
|
* `options.spot`, so a column takes a panel by halves of what is seen). On a bar or a toolbar rail, and between any two
|
|
1042
1046
|
* other spots, it is halfway across the gap between their landings, each in its own layout, so the pointer is at the
|
|
1043
|
-
* landing it picks and a toolbar moved along an occupied lane stays at the hand.
|
|
1044
|
-
*
|
|
1047
|
+
* landing it picks and a toolbar moved along an occupied lane stays at the hand. On a bar or a toolbar rail that gap is
|
|
1048
|
+
* measured where the item is held (`options.grab`): halfway between the points the pointer would hold in each landing,
|
|
1049
|
+
* so a pointer back at its press point picks the item's own place however far from its middle it was pressed. Cuts are
|
|
1050
|
+
* kept inside the lane and in order. The spots come from the same generation and filter as `targets()`, so a spot's
|
|
1045
1051
|
* landing is exactly what its drop commits. Spot ids are keyed by the lane, zone and neighboring items, so they survive
|
|
1046
1052
|
* the window resizing and most items opening or moving; virtual lanes are keyed by the column they lie beside, not
|
|
1047
1053
|
* their ring. Remembered per scene and options; a call with `spot` reworks only the held lane's stretches.
|
|
@@ -1127,6 +1133,20 @@ interface LaneOptions extends SceneTargetOptions {
|
|
|
1127
1133
|
readonly pitch?: number;
|
|
1128
1134
|
/** The spot held now: its lane's stretches are drawn in its own layout (the room open). Default: the layout as seen. */
|
|
1129
1135
|
readonly spot?: string;
|
|
1136
|
+
/**
|
|
1137
|
+
* Where the pointer holds the item, from its top left corner as it is now, px (what a target's `after(point, grab)`
|
|
1138
|
+
* takes): the press's, constant for the drag (each grab is remembered as its own options), and the same in the call
|
|
1139
|
+
* with `spot`. It counts along the item's own length only (its longer side as it is now): on a bar or a toolbar rail
|
|
1140
|
+
* along that axis the cut between two spots lies halfway between the points the pointer would hold in each landing
|
|
1141
|
+
* (with landings of one length; at the same share of each), so a pointer back at its press point picks the item's own
|
|
1142
|
+
* place. Across the item, and in a lane across its length (a rail toolbar over a bar), it is the item's middle, as
|
|
1143
|
+
* without a grab. Panel columns take a panel by halves of what is drawn either way. Where another lane's band
|
|
1144
|
+
* overlaps the press point (an empty bar's band over a rail's end) that lane can still take the pointer first.
|
|
1145
|
+
*/
|
|
1146
|
+
readonly grab?: {
|
|
1147
|
+
readonly x: number;
|
|
1148
|
+
readonly y: number;
|
|
1149
|
+
};
|
|
1130
1150
|
}
|
|
1131
1151
|
/**
|
|
1132
1152
|
* The lanes and regions of a drag of `dragged`: every lane that takes it with its spots and stretches, the refused
|
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, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget, g as SceneRefusal, R as Regions } from './lanes-
|
|
3
|
+
import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget, g as SceneRefusal, R as Regions } from './lanes-0L2Cy12X.js';
|
|
4
4
|
import './target-BBOCeez2.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -604,6 +604,11 @@ declare function winScene(spec: WinSpec, o?: WinOptions): Scene;
|
|
|
604
604
|
* version once that is past 26.11.44).
|
|
605
605
|
*/
|
|
606
606
|
declare const LANES_SINCE = "26.11.45";
|
|
607
|
+
/**
|
|
608
|
+
* The first library version whose `lanes()` takes the grab (`LaneOptions.grab`): the rows that bring an item back to
|
|
609
|
+
* its press point need it, and a host must pass the grab to `lanes()` for them to pass.
|
|
610
|
+
*/
|
|
611
|
+
declare const GRAB_SINCE = "26.11.46";
|
|
607
612
|
/** The last published version without `lanes()`. */
|
|
608
613
|
declare const LAST_WITHOUT_LANES = "26.11.44";
|
|
609
614
|
/** From this date every landing row runs on every host (or at the breaking release, if that comes first). */
|
|
@@ -704,23 +709,31 @@ interface LandingCase {
|
|
|
704
709
|
};
|
|
705
710
|
/** The layout after the release. */
|
|
706
711
|
readonly layout?: LayoutExpect;
|
|
712
|
+
/**
|
|
713
|
+
* After the release the item lies where it lay at the press, in the host's own layout: on the same edge, among the
|
|
714
|
+
* same items in the same order, at the same rect (within 0.5 px). Checked against the play's `before` (the host's
|
|
715
|
+
* layout at the press), else the row's scene as solved: a host whose geometry differs from the row's (its own gaps)
|
|
716
|
+
* passes `before`, and no pixel value of the row's window is asserted.
|
|
717
|
+
*/
|
|
718
|
+
readonly home?: true;
|
|
707
719
|
readonly requires: CaseRequires & {
|
|
708
720
|
readonly lanes: {
|
|
709
721
|
readonly since: string;
|
|
710
722
|
};
|
|
711
723
|
};
|
|
712
724
|
}
|
|
725
|
+
/** What a host reports for one row: its frames, the layout after the release and, optionally, the layout at the press. */
|
|
726
|
+
interface LandingPlay {
|
|
727
|
+
readonly frames: readonly LandingCaseFrame[];
|
|
728
|
+
readonly layout: SceneLayout;
|
|
729
|
+
/** The host's layout at the press (what a row's `home` compares with). Absent: the row's scene as solved. */
|
|
730
|
+
readonly before?: SceneLayout;
|
|
731
|
+
}
|
|
713
732
|
/** What a host gives the landing runner: one call plays a row's drag and reports its frames and the layout after. */
|
|
714
733
|
interface LandingCaseHost {
|
|
715
734
|
/** The library version the host runs (`YY.M.R`); a row needing a later one is skipped. Absent: the latest. */
|
|
716
735
|
readonly version?: string;
|
|
717
|
-
play(row: LandingCase):
|
|
718
|
-
readonly frames: readonly LandingCaseFrame[];
|
|
719
|
-
readonly layout: SceneLayout;
|
|
720
|
-
} | Promise<{
|
|
721
|
-
readonly frames: readonly LandingCaseFrame[];
|
|
722
|
-
readonly layout: SceneLayout;
|
|
723
|
-
}>;
|
|
736
|
+
play(row: LandingCase): LandingPlay | Promise<LandingPlay>;
|
|
724
737
|
}
|
|
725
738
|
interface LandingCaseResult {
|
|
726
739
|
readonly id: string;
|
|
@@ -729,8 +742,11 @@ interface LandingCaseResult {
|
|
|
729
742
|
/** Why the row didn't run, or null. */
|
|
730
743
|
readonly skipped: string | null;
|
|
731
744
|
}
|
|
732
|
-
/**
|
|
733
|
-
|
|
745
|
+
/**
|
|
746
|
+
* What differs between a row and what its host played. `before` is the host's layout at the press (a row's `home`
|
|
747
|
+
* compares with it); absent, the row's scene as solved.
|
|
748
|
+
*/
|
|
749
|
+
declare function landingIssues(row: LandingCase, frames: readonly LandingCaseFrame[], layout: SceneLayout, before?: SceneLayout): string[];
|
|
734
750
|
/**
|
|
735
751
|
* Plays every row on `host` and says what differs. A row whose `requires.lanes.since` is after the host's `version` is
|
|
736
752
|
* skipped (and listed as such); a row that throws fails.
|
|
@@ -771,4 +787,4 @@ declare const CASE_GROUPS: readonly {
|
|
|
771
787
|
/** The row with this id, or undefined. */
|
|
772
788
|
declare const caseById: (id: string) => CaseRow | undefined;
|
|
773
789
|
|
|
774
|
-
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, LANDING_CASES, LANES_DEADLINE, LANES_SINCE, LAST_WITHOUT_LANES, LIFT_THRESHOLD, type LandingCase, type LandingCaseFrame, type LandingCaseGuide, type LandingCaseHost, type LandingCaseResult, type LandingModelLike, type LandingRegionName, type LandingRule, type LayoutExpect, type PickCandidate, type PickRule, type Rename, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createLandingHost, createSceneHost, defaultItemSelector, g, idRenames, landingIssues, lanesRatchet, layoutIssues, mapGesture, mapLayout, mapPlace, mapScene, mapStored, pickTarget, resizeStep, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, runLandingCases, winScene, withRefusals };
|
|
790
|
+
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, GRAB_SINCE, type Gesture, type GestureType, type IdMap, type ItemExpect, LANDING_CASES, LANES_DEADLINE, LANES_SINCE, LAST_WITHOUT_LANES, LIFT_THRESHOLD, type LandingCase, type LandingCaseFrame, type LandingCaseGuide, type LandingCaseHost, type LandingCaseResult, type LandingModelLike, type LandingPlay, type LandingRegionName, type LandingRule, type LayoutExpect, type PickCandidate, type PickRule, type Rename, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createLandingHost, createSceneHost, defaultItemSelector, g, idRenames, landingIssues, lanesRatchet, layoutIssues, mapGesture, mapLayout, mapPlace, mapScene, mapStored, pickTarget, resizeStep, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, runLandingCases, winScene, withRefusals };
|
package/dist/scene-cases.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
storeScene,
|
|
21
21
|
targets,
|
|
22
22
|
use
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VNOEEI4L.js";
|
|
24
24
|
import "./chunk-AE3BWTAE.js";
|
|
25
25
|
import {
|
|
26
26
|
centre,
|
|
@@ -2346,6 +2346,7 @@ async function runCasesAsync(rows, makeHost, options = {}) {
|
|
|
2346
2346
|
|
|
2347
2347
|
// src/scene/cases/landing.ts
|
|
2348
2348
|
var LANES_SINCE = "26.11.45";
|
|
2349
|
+
var GRAB_SINCE = "26.11.46";
|
|
2349
2350
|
var LAST_WITHOUT_LANES = "26.11.44";
|
|
2350
2351
|
var LANES_DEADLINE = "2026-12-31";
|
|
2351
2352
|
var versionBefore = (a, b) => {
|
|
@@ -2357,7 +2358,23 @@ var versionBefore = (a, b) => {
|
|
|
2357
2358
|
var gapTo = (r, p) => Math.hypot(Math.max(r.x - p.x, 0, p.x - (r.x + r.width)), Math.max(r.y - p.y, 0, p.y - (r.y + r.height)));
|
|
2358
2359
|
var touches = (a, b) => a.x <= b.x + b.width && b.x <= a.x + a.width && a.y <= b.y + b.height && b.y <= a.y + a.height;
|
|
2359
2360
|
var worstTrail = (frames) => Math.max(0, ...frames.filter((f2) => f2.moving && f2.region === "lane" && f2.landing).map((f2) => gapTo(f2.landing, f2.point)));
|
|
2360
|
-
function
|
|
2361
|
+
function homeIssues(item, before, after) {
|
|
2362
|
+
const a = before.items[item];
|
|
2363
|
+
const b = after.items[item];
|
|
2364
|
+
if (!a) return [`${item} is not in the layout at the press`];
|
|
2365
|
+
if (!b) return [`${item} is not in the layout after the release`];
|
|
2366
|
+
const out = [];
|
|
2367
|
+
const where = (it) => it.floating ? "floating" : it.inMenu ? `in ${it.edge ?? "no"} menu` : it.edge ?? "nowhere";
|
|
2368
|
+
if (where(a) !== where(b)) out.push(`${item} ends ${where(b)}, not where it was (${where(a)})`);
|
|
2369
|
+
else if (a.edge && dockedIn(before, a.edge).join(",") !== dockedIn(after, a.edge).join(","))
|
|
2370
|
+
out.push(`${a.edge} holds ${dockedIn(after, a.edge).join(", ")}, not ${dockedIn(before, a.edge).join(", ")} as at the press`);
|
|
2371
|
+
const r0 = a.rect;
|
|
2372
|
+
const r1 = b.rect;
|
|
2373
|
+
if (Math.max(Math.abs(r0.x - r1.x), Math.abs(r0.y - r1.y), Math.abs(r0.width - r1.width), Math.abs(r0.height - r1.height)) > 0.5)
|
|
2374
|
+
out.push(`${item} is at ${Math.round(r1.x)},${Math.round(r1.y)} ${Math.round(r1.width)}x${Math.round(r1.height)}, not where it was (${Math.round(r0.x)},${Math.round(r0.y)} ${Math.round(r0.width)}x${Math.round(r0.height)})`);
|
|
2375
|
+
return out;
|
|
2376
|
+
}
|
|
2377
|
+
function landingIssues(row2, frames, layout, before) {
|
|
2361
2378
|
const out = [];
|
|
2362
2379
|
const m = row2.moving;
|
|
2363
2380
|
if (frames.length === 0) return ["no frames"];
|
|
@@ -2378,6 +2395,7 @@ function landingIssues(row2, frames, layout) {
|
|
|
2378
2395
|
if (row2.end.spot !== void 0 && last.spot !== row2.end.spot) out.push(`the last frame's spot is ${last.spot ?? "none"}, not ${row2.end.spot}`);
|
|
2379
2396
|
}
|
|
2380
2397
|
if (row2.layout) out.push(...layoutIssues(row2.layout, layout));
|
|
2398
|
+
if (row2.home) out.push(...homeIssues(row2.item, before ?? solve(row2.scene), layout));
|
|
2381
2399
|
return out;
|
|
2382
2400
|
}
|
|
2383
2401
|
async function runLandingCases(rows, host) {
|
|
@@ -2388,8 +2406,8 @@ async function runLandingCases(rows, host) {
|
|
|
2388
2406
|
continue;
|
|
2389
2407
|
}
|
|
2390
2408
|
try {
|
|
2391
|
-
const { frames, layout } = await host.play(row2);
|
|
2392
|
-
const issues = landingIssues(row2, frames, layout);
|
|
2409
|
+
const { frames, layout, before } = await host.play(row2);
|
|
2410
|
+
const issues = landingIssues(row2, frames, layout, before);
|
|
2393
2411
|
const over = row2.moving?.trailOverSlow;
|
|
2394
2412
|
if (over) {
|
|
2395
2413
|
const slow = await host.play({ ...row2, speed: over.slow });
|
|
@@ -2424,8 +2442,8 @@ function createLandingHost(o) {
|
|
|
2424
2442
|
if (!own) throw new Error(`no item ${row2.item}`);
|
|
2425
2443
|
const press = row2.path[0];
|
|
2426
2444
|
const grab = { x: press.x - own.rect.x, y: press.y - own.rect.y };
|
|
2427
|
-
const regions = lanes(s, row2.item, { previous });
|
|
2428
|
-
const regionsFor = (spot2) => lanes(s, row2.item, { previous, spot: spot2 });
|
|
2445
|
+
const regions = lanes(s, row2.item, { previous, grab });
|
|
2446
|
+
const regionsFor = (spot2) => lanes(s, row2.item, { previous, grab, spot: spot2 });
|
|
2429
2447
|
const home = regions.lanes.flatMap((l) => l.spots.filter((x) => x.home).map((x) => ({ lane: l.id, spot: x.id })))[0];
|
|
2430
2448
|
const model = o.landing({ regions, regionsFor, floatLanding: (p) => regions.float?.after(p, grab).layout.items[row2.item]?.rect ?? null, ...home ? { home } : {}, placeGuides: "near" });
|
|
2431
2449
|
const frames = [];
|
|
@@ -2446,7 +2464,7 @@ function createLandingHost(o) {
|
|
|
2446
2464
|
const spot = out?.kind === "spot" ? [...regions.lanes, ...regionsFor(out.spot).lanes].flatMap((l) => l.spots).find((x) => x.id === out.spot) : void 0;
|
|
2447
2465
|
const target = out?.kind === "float" ? regions.float : spot && !spot.home ? spot.target : null;
|
|
2448
2466
|
const next = target ? target.after(at2, grab).scene : s;
|
|
2449
|
-
return { frames, layout: solve(next, { previous }) };
|
|
2467
|
+
return { frames, layout: solve(next, { previous }), before: previous };
|
|
2450
2468
|
}
|
|
2451
2469
|
};
|
|
2452
2470
|
}
|
|
@@ -2468,6 +2486,7 @@ function landingWindow(top = ["a"], bottom = []) {
|
|
|
2468
2486
|
};
|
|
2469
2487
|
}
|
|
2470
2488
|
var LANES = { lanes: { since: LANES_SINCE } };
|
|
2489
|
+
var GRAB = { lanes: { since: GRAB_SINCE } };
|
|
2471
2490
|
var LANDING_CASES = [
|
|
2472
2491
|
{
|
|
2473
2492
|
id: "landing-rail-repro",
|
|
@@ -2620,6 +2639,40 @@ var LANDING_CASES = [
|
|
|
2620
2639
|
moving: { lane: "top", trail: 40 },
|
|
2621
2640
|
requires: LANES
|
|
2622
2641
|
},
|
|
2642
|
+
{
|
|
2643
|
+
id: "landing-back-home-bar",
|
|
2644
|
+
title: "A toolbar taken away by its end and brought back lands home",
|
|
2645
|
+
expect: "A toolbar pressed 12 px from its right end in its bar (the free stretch's spots lie that way), moved into the document and back to the press point at 0.6 px/ms, resting there 80 ms: it ends on its own place, not on a free-stretch spot beside it.",
|
|
2646
|
+
scene: landingWindow(),
|
|
2647
|
+
item: "a",
|
|
2648
|
+
path: [
|
|
2649
|
+
{ x: 196, y: 18 },
|
|
2650
|
+
{ x: 500, y: 300 },
|
|
2651
|
+
{ x: 196, y: 18 }
|
|
2652
|
+
],
|
|
2653
|
+
speed: 0.6,
|
|
2654
|
+
rest: 80,
|
|
2655
|
+
end: { region: "lane", lane: "top" },
|
|
2656
|
+
home: true,
|
|
2657
|
+
requires: GRAB
|
|
2658
|
+
},
|
|
2659
|
+
{
|
|
2660
|
+
id: "landing-back-home-rail",
|
|
2661
|
+
title: "A rail toolbar taken away by its bottom and brought back lands home",
|
|
2662
|
+
expect: "Zoom pressed 6 px above its bottom in its rail (the free stretch's spots lie below it), moved into the document and back to the press point at 0.6 px/ms, resting there 80 ms: it ends where it was, below Tools.",
|
|
2663
|
+
scene: landingWindow(),
|
|
2664
|
+
item: "zoom",
|
|
2665
|
+
path: [
|
|
2666
|
+
{ x: 15, y: 198 },
|
|
2667
|
+
{ x: 500, y: 300 },
|
|
2668
|
+
{ x: 15, y: 198 }
|
|
2669
|
+
],
|
|
2670
|
+
speed: 0.6,
|
|
2671
|
+
rest: 80,
|
|
2672
|
+
end: { region: "lane", lane: "rail-left" },
|
|
2673
|
+
home: true,
|
|
2674
|
+
requires: GRAB
|
|
2675
|
+
},
|
|
2623
2676
|
{
|
|
2624
2677
|
id: "landing-across-items",
|
|
2625
2678
|
title: "A fast hand across docked items trails no further than it must",
|
|
@@ -2658,6 +2711,7 @@ export {
|
|
|
2658
2711
|
CASES,
|
|
2659
2712
|
CASE_GROUPS,
|
|
2660
2713
|
END_REACH,
|
|
2714
|
+
GRAB_SINCE,
|
|
2661
2715
|
LANDING_CASES,
|
|
2662
2716
|
LANES_DEADLINE,
|
|
2663
2717
|
LANES_SINCE,
|