@n-uf/placement 26.11.46 → 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 +18 -0
- package/README.md +10 -3
- package/dist/{chunk-A4DQQX7W.js → chunk-VNOEEI4L.js} +1 -1
- package/dist/chunk-VNOEEI4L.js.map +1 -0
- package/dist/{lanes-BFqBNGvs.d.ts → lanes-0L2Cy12X.d.ts} +5 -1
- package/dist/scene-cases.d.ts +22 -11
- package/dist/scene-cases.js +24 -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-A4DQQX7W.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
|
/**
|
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
|
/**
|
|
@@ -709,23 +709,31 @@ interface LandingCase {
|
|
|
709
709
|
};
|
|
710
710
|
/** The layout after the release. */
|
|
711
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;
|
|
712
719
|
readonly requires: CaseRequires & {
|
|
713
720
|
readonly lanes: {
|
|
714
721
|
readonly since: string;
|
|
715
722
|
};
|
|
716
723
|
};
|
|
717
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
|
+
}
|
|
718
732
|
/** What a host gives the landing runner: one call plays a row's drag and reports its frames and the layout after. */
|
|
719
733
|
interface LandingCaseHost {
|
|
720
734
|
/** The library version the host runs (`YY.M.R`); a row needing a later one is skipped. Absent: the latest. */
|
|
721
735
|
readonly version?: string;
|
|
722
|
-
play(row: LandingCase):
|
|
723
|
-
readonly frames: readonly LandingCaseFrame[];
|
|
724
|
-
readonly layout: SceneLayout;
|
|
725
|
-
} | Promise<{
|
|
726
|
-
readonly frames: readonly LandingCaseFrame[];
|
|
727
|
-
readonly layout: SceneLayout;
|
|
728
|
-
}>;
|
|
736
|
+
play(row: LandingCase): LandingPlay | Promise<LandingPlay>;
|
|
729
737
|
}
|
|
730
738
|
interface LandingCaseResult {
|
|
731
739
|
readonly id: string;
|
|
@@ -734,8 +742,11 @@ interface LandingCaseResult {
|
|
|
734
742
|
/** Why the row didn't run, or null. */
|
|
735
743
|
readonly skipped: string | null;
|
|
736
744
|
}
|
|
737
|
-
/**
|
|
738
|
-
|
|
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[];
|
|
739
750
|
/**
|
|
740
751
|
* Plays every row on `host` and says what differs. A row whose `requires.lanes.since` is after the host's `version` is
|
|
741
752
|
* skipped (and listed as such); a row that throws fails.
|
|
@@ -776,4 +787,4 @@ declare const CASE_GROUPS: readonly {
|
|
|
776
787
|
/** The row with this id, or undefined. */
|
|
777
788
|
declare const caseById: (id: string) => CaseRow | undefined;
|
|
778
789
|
|
|
779
|
-
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 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,
|
|
@@ -2358,7 +2358,23 @@ var versionBefore = (a, b) => {
|
|
|
2358
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)));
|
|
2359
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;
|
|
2360
2360
|
var worstTrail = (frames) => Math.max(0, ...frames.filter((f2) => f2.moving && f2.region === "lane" && f2.landing).map((f2) => gapTo(f2.landing, f2.point)));
|
|
2361
|
-
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) {
|
|
2362
2378
|
const out = [];
|
|
2363
2379
|
const m = row2.moving;
|
|
2364
2380
|
if (frames.length === 0) return ["no frames"];
|
|
@@ -2379,6 +2395,7 @@ function landingIssues(row2, frames, layout) {
|
|
|
2379
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}`);
|
|
2380
2396
|
}
|
|
2381
2397
|
if (row2.layout) out.push(...layoutIssues(row2.layout, layout));
|
|
2398
|
+
if (row2.home) out.push(...homeIssues(row2.item, before ?? solve(row2.scene), layout));
|
|
2382
2399
|
return out;
|
|
2383
2400
|
}
|
|
2384
2401
|
async function runLandingCases(rows, host) {
|
|
@@ -2389,8 +2406,8 @@ async function runLandingCases(rows, host) {
|
|
|
2389
2406
|
continue;
|
|
2390
2407
|
}
|
|
2391
2408
|
try {
|
|
2392
|
-
const { frames, layout } = await host.play(row2);
|
|
2393
|
-
const issues = landingIssues(row2, frames, layout);
|
|
2409
|
+
const { frames, layout, before } = await host.play(row2);
|
|
2410
|
+
const issues = landingIssues(row2, frames, layout, before);
|
|
2394
2411
|
const over = row2.moving?.trailOverSlow;
|
|
2395
2412
|
if (over) {
|
|
2396
2413
|
const slow = await host.play({ ...row2, speed: over.slow });
|
|
@@ -2447,7 +2464,7 @@ function createLandingHost(o) {
|
|
|
2447
2464
|
const spot = out?.kind === "spot" ? [...regions.lanes, ...regionsFor(out.spot).lanes].flatMap((l) => l.spots).find((x) => x.id === out.spot) : void 0;
|
|
2448
2465
|
const target = out?.kind === "float" ? regions.float : spot && !spot.home ? spot.target : null;
|
|
2449
2466
|
const next = target ? target.after(at2, grab).scene : s;
|
|
2450
|
-
return { frames, layout: solve(next, { previous }) };
|
|
2467
|
+
return { frames, layout: solve(next, { previous }), before: previous };
|
|
2451
2468
|
}
|
|
2452
2469
|
};
|
|
2453
2470
|
}
|
|
@@ -2636,7 +2653,7 @@ var LANDING_CASES = [
|
|
|
2636
2653
|
speed: 0.6,
|
|
2637
2654
|
rest: 80,
|
|
2638
2655
|
end: { region: "lane", lane: "top" },
|
|
2639
|
-
|
|
2656
|
+
home: true,
|
|
2640
2657
|
requires: GRAB
|
|
2641
2658
|
},
|
|
2642
2659
|
{
|
|
@@ -2653,7 +2670,7 @@ var LANDING_CASES = [
|
|
|
2653
2670
|
speed: 0.6,
|
|
2654
2671
|
rest: 80,
|
|
2655
2672
|
end: { region: "lane", lane: "rail-left" },
|
|
2656
|
-
|
|
2673
|
+
home: true,
|
|
2657
2674
|
requires: GRAB
|
|
2658
2675
|
},
|
|
2659
2676
|
{
|