@n-uf/placement 26.11.49 → 26.11.50

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.
@@ -762,8 +762,9 @@ declare function fitResize(scene: Scene, id: string, rect: Rect, moving: ResizeE
762
762
 
763
763
  /**
764
764
  * Where a docked item goes: before the `at`-th item of `zone` (default the item's own zone) in `edge`, keeping `space`
765
- * px free on its zone's open side (`SceneItem.space`; 0: none). Absent, it takes the space its new neighbor kept on
766
- * that side, if any (the space stays where it lies, the item lands where the neighbor was), and else keeps none.
765
+ * px free on its zone's open side (`SceneItem.space`; absent or 0: none). Docked into the room a placed neighbor keeps,
766
+ * it consumes that room: the neighbor keeps what is left and moves only by what the room lacks. (While the edge has
767
+ * spare length to give every room; a squeezed edge shares its spare out, and its items may shift by a few px.)
767
768
  */
768
769
  interface DockPlace {
769
770
  readonly kind?: "gap";
@@ -799,7 +800,12 @@ type Place = DockPlace | ColumnPlace | RailPlace | FloatPlace;
799
800
  * calls it as it reads a stored layout, so what it stores is what it shows and what a drag reads.
800
801
  */
801
802
  declare function mergeSideColumns(scene: Scene): Scene;
802
- /** The scene with the item out of every edge and every float (a dynamic column it leaves empty is deleted). */
803
+ /**
804
+ * The scene with the item out of every edge and every float (a dynamic column it leaves empty is deleted). The room it
805
+ * held goes back to its stretch: the first placed item past it, away from its zone's own end (`SceneItem.space`), takes
806
+ * it back, so it stays where it was drawn; the flush items between close up toward the zone's own end. (While the edge
807
+ * has spare length to give every room; a squeezed edge, or items stepping up to wider forms, may shift it by a few px.)
808
+ */
803
809
  declare function lift(scene: Scene, id: string): Scene;
804
810
  declare function moveTo(scene: Scene, id: string, place: Place): Scene;
805
811
  declare function floatAt(scene: Scene, id: string, at?: Rect, orient?: Orient): Scene;
@@ -1037,8 +1043,9 @@ interface SceneRefusal {
1037
1043
  *
1038
1044
  * A lane is one edge that takes the held item (a bar, a rail, a column) or a virtual one (a new column's line, a
1039
1045
  * declared rail). Its spots are the places a drop there lands, in order along it: before, between and after its items,
1040
- * and, on a bar or a toolbar rail, spots at a fixed pitch over the free stretches between items (`SPOT_PITCH`), so a
1041
- * toolbar lands close to the hand. Each spot keys where its drop draws the other items (a change between two spots
1046
+ * and, on a bar or a toolbar rail, one sliding spot per free stretch between items, which lands exactly where the hand
1047
+ * holds it (`LaneSpot.slide`; `stretchPositions: "free"`, the default); with `stretchPositions: "pitched"`, spots at a
1048
+ * fixed pitch over those stretches instead (`SPOT_PITCH`), so a toolbar lands close to the hand. Each spot keys where its drop draws the other items (a change between two spots
1042
1049
  * with the same key moves only the held item), and each lane carries its place guides' marks in the layout as drawn.
1043
1050
  * Each spot has a stretch of the lane that picks it. In a panel column, between two spots that share a neighbor (the
1044
1051
  * 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
@@ -1056,11 +1063,35 @@ interface SceneRefusal {
1056
1063
 
1057
1064
  /** The pitch of the spots over a bar's free stretches, px: a quarter of a typical toolbar's length (158 px in the lab). */
1058
1065
  declare const SPOT_PITCH = 40;
1066
+ /**
1067
+ * A sliding spot's range (`LaneOptions.stretchPositions: "free"`): where the landing's start may lie along the lane,
1068
+ * from flush against the neighbor before the stretch to flush against the one after it, and the starts it snaps to.
1069
+ */
1070
+ interface LaneSlide {
1071
+ readonly from: number;
1072
+ readonly to: number;
1073
+ /**
1074
+ * Its two ends, the item's own place where it lies here, and every other dock that lands inside, in order. Each is a
1075
+ * start that commits what lies there (a taken-over dock as it is), so none is dropped for lying near another, except
1076
+ * within twice the snap distance of the item's own place, where home wins.
1077
+ */
1078
+ readonly snaps: readonly number[];
1079
+ /** How near a snap point the landing's start snaps to it, px (`LaneOptions.snapDistance`). */
1080
+ readonly snapDistance: number;
1081
+ /**
1082
+ * The grain of a start that snaps to nothing, px: a multiple of `step` (whole px, 1) within `[from, to]`. The one rule
1083
+ * `target.after`, a landing model's frame and its release all read, so the frame shows what the drop commits:
1084
+ * with `c = clamp(raw, from, to)`, the start is the nearest snap point within `snapDistance` of `c`, else
1085
+ * `clamp(round(c / step) * step, from, to)`.
1086
+ */
1087
+ readonly step: number;
1088
+ }
1059
1089
  /** One place a drop in a lane lands. */
1060
1090
  interface LaneSpot {
1061
1091
  /**
1062
1092
  * Stable across solves: `<lane>/<zone>/<item before or ^>|<item after or $>`; an empty edge's `<lane>/<zone>`; a
1063
- * pitched spot `…@<pitches from its neighbor>`; a virtual lane's `<lane>/line` or `<lane>/end`.
1093
+ * pitched spot `…@<pitches from its neighbor>`; a sliding spot `<lane>/<zone>/<before>|<after>@slide`, named by the
1094
+ * stretch; a virtual lane's `<lane>/line` or `<lane>/end`.
1064
1095
  */
1065
1096
  readonly id: string;
1066
1097
  /** Its stretch of the lane, along the lane's axis, inside the lane's range. */
@@ -1069,10 +1100,21 @@ interface LaneSpot {
1069
1100
  readonly landing: Rect;
1070
1101
  /** The drop: its place and `after()` (the layout after it, the room). */
1071
1102
  readonly target: SceneTarget;
1072
- /** The item's own place (a release there changes nothing). */
1103
+ /**
1104
+ * The item's own place (a release there changes nothing). A spot's `target.place` is the dock at the spot's listed
1105
+ * landing (on the item's own sliding spot its own zone, index and `space`); a sliding spot commits through
1106
+ * `target.after(point, grab)`, and the landing release's `home` and `at` say where, never the place kind.
1107
+ */
1073
1108
  readonly home?: true;
1074
1109
  /** A spot at a pitch over a free stretch (`SceneItem.space`). */
1075
1110
  readonly pitched?: true;
1111
+ /**
1112
+ * A free stretch as one sliding spot (`stretchPositions: "free"`): its drop lands where the pointer holds it, the
1113
+ * landing's start at the pointer less the grab, clamped to `[from, to]` and snapped within `snapDistance`, and
1114
+ * `target.after(point, grab)` commits that (a dock keeping the `space` that puts it there). Its `landing` is the one at
1115
+ * the stretch's point nearest the item's own place (that place where it lies here), else at its start.
1116
+ */
1117
+ readonly slide?: LaneSlide;
1076
1118
  /**
1077
1119
  * Where its drop draws every item other than the held one, as a key: a change between two spots with the same key
1078
1120
  * moves only the held item; between two with different keys it reflows the window.
@@ -1149,8 +1191,21 @@ interface Regions {
1149
1191
  readonly refusals: readonly SceneRefusal[];
1150
1192
  }
1151
1193
  interface LaneOptions extends SceneTargetOptions {
1152
- /** The pitch of a bar's free-stretch spots, px (default `SPOT_PITCH`; 0 or less: none). */
1194
+ /**
1195
+ * The pitch of a bar's free-stretch spots, px (default `SPOT_PITCH`). 0 or less turns pitched spots off. Under `"free"` it only sets the sampling step that checks a
1196
+ * stretch's range (every `pitch` px; `SPOT_PITCH` when 0 or less), never a spot of its own.
1197
+ */
1153
1198
  readonly pitch?: number;
1199
+ /**
1200
+ * How a free stretch on a bar or a toolbar rail offers its range of landings, from flush against the neighbor before
1201
+ * it to flush against the one after it: `"free"` (the default), one sliding spot (`LaneSpot.slide`) that lands where
1202
+ * the pointer holds the item, snapped to its ends and the item's own place within `snapDistance`; `"pitched"`, a
1203
+ * spot every `pitch` px, its ends included. Either way a step comes only where the order changes (passing a
1204
+ * neighbor), cut as between any two spots.
1205
+ */
1206
+ readonly stretchPositions?: "free" | "pitched";
1207
+ /** Under `"free"`, how near a snap point a landing snaps to it, px (default 8). */
1208
+ readonly snapDistance?: number;
1154
1209
  /** The spot held now: its lane's stretches are drawn in its own layout (the room open). Default: the layout as seen. */
1155
1210
  readonly spot?: string;
1156
1211
  /**
@@ -1193,4 +1248,4 @@ declare const HATCH_END = 8;
1193
1248
  */
1194
1249
  declare const HATCH_EDGE = 8;
1195
1250
 
1196
- export { type SceneEdgeLayout as $, type LaneRefusal as A, type LaneSpot as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchorAt as F, RAIL_MODES as G, HATCH_EDGE as H, RAIL_STRIP_MIN as I, RAIL_VISIBILITIES as J, type Kind as K, type Lane as L, type RailDropPolicy as M, type RailPlace as N, type Orient as O, type Place as P, type RailSpec as Q, type Regions as R, type Scene as S, type RailVisibility as T, type ResizeEdges as U, type ResizeLimit as V, SIDES as W, SPOT_PITCH as X, type SceneAfter as Y, type Zone as Z, type SceneChrome as _, type ScenePlace as a, type SceneFloat as a0, type SceneItemLayout as a1, type SceneNote as a2, type SceneRailLayout as a3, type SceneRead as a4, type StoredSceneEdge as a5, type StoredSceneFloat as a6, type StoredSceneItem as a7, ZONES as a8, canFold as a9, close as aa, dockHome as ab, fitResize as ac, floatAt as ad, fold as ae, homeFor as af, keep as ag, lanes as ah, lift as ai, mergeSideColumns as aj, moveTo as ak, open as al, orient as am, raise as an, readScene as ao, resize as ap, setRailMode as aq, setSide as ar, storeScene as as, use as at, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SceneRefusal as g, type FloatAnchor as h, type ZoneAccepts as i, type SceneItem as j, type RailMode as k, type SolveOptions as l, type SceneTargetOptions as m, type ColumnTemplate as n, DEFAULT_HIT_BAND as o, DEFAULT_RAIL_MAGNET as p, DEFAULT_STRIP as q, type DockPlace as r, EDGE_ROOM_HOLD as s, FLOAT_ANCHORS as t, type FloatAnchorOffset as u, type FloatPlace as v, type FloatResize as w, HATCH_END as x, type LaneMark as y, type LaneOptions as z };
1251
+ export { type SceneChrome as $, type LaneRefusal as A, type LaneSlide as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchorAt as F, type LaneSpot as G, HATCH_EDGE as H, RAIL_MODES as I, RAIL_STRIP_MIN as J, type Kind as K, type LaneOptions as L, RAIL_VISIBILITIES as M, type RailDropPolicy as N, type Orient as O, type Place as P, type RailPlace as Q, type Regions as R, type Scene as S, type RailSpec as T, type RailVisibility as U, type ResizeEdges as V, type ResizeLimit as W, SIDES as X, SPOT_PITCH as Y, type Zone as Z, type SceneAfter as _, type ScenePlace as a, type SceneEdgeLayout as a0, type SceneFloat as a1, type SceneItemLayout as a2, type SceneNote as a3, type SceneRailLayout as a4, type SceneRead as a5, type StoredSceneEdge as a6, type StoredSceneFloat as a7, type StoredSceneItem as a8, ZONES as a9, canFold as aa, close as ab, dockHome as ac, fitResize as ad, floatAt as ae, fold as af, homeFor as ag, keep as ah, lanes as ai, lift as aj, mergeSideColumns as ak, moveTo as al, open as am, orient as an, raise as ao, readScene as ap, resize as aq, setRailMode as ar, setSide as as, storeScene as at, use as au, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SceneRefusal as g, type FloatAnchor as h, type ZoneAccepts as i, type SceneItem as j, type RailMode as k, type SolveOptions as l, type SceneTargetOptions as m, type ColumnTemplate as n, DEFAULT_HIT_BAND as o, DEFAULT_RAIL_MAGNET as p, DEFAULT_STRIP as q, type DockPlace as r, EDGE_ROOM_HOLD as s, FLOAT_ANCHORS as t, type FloatAnchorOffset as u, type FloatPlace as v, type FloatResize as w, HATCH_END as x, type Lane as y, type LaneMark as z };
@@ -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-D8K4UI3s.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, L as LaneOptions } from './lanes-CkFz9E5l.js';
4
4
  import './target-BBOCeez2.js';
5
5
 
6
6
  /**
@@ -614,6 +614,11 @@ declare const GRAB_SINCE = "26.11.46";
614
614
  * apart at the grab too, so a toolbar held by its grip hopped a neighbor early): the grip rows need it.
615
615
  */
616
616
  declare const GRIP_SINCE = "26.11.48";
617
+ /**
618
+ * The first library version where a dock consumes the room it lands in and an item over a neighbor takes its place (the
619
+ * neighbor giving way): the rows passing a neighbor that keeps room need it.
620
+ */
621
+ declare const ROOM_SINCE = "26.11.50";
617
622
  /** The last published version without `lanes()`. */
618
623
  declare const LAST_WITHOUT_LANES = "26.11.44";
619
624
  /** From this date every landing row runs on every host (or at the breaking release, if that comes first). */
@@ -650,6 +655,11 @@ type LandingRule = (options: {
650
655
  readonly lane: string;
651
656
  readonly spot: string;
652
657
  };
658
+ /** Where the press holds the item (a landing model's `grab`): a sliding spot's landing follows the pointer less it. */
659
+ readonly grab?: {
660
+ readonly x: number;
661
+ readonly y: number;
662
+ };
653
663
  readonly placeGuides?: "off" | "near" | "all";
654
664
  }) => LandingModelLike;
655
665
  /** A place guide a frame shows: its lane, line, box or hatch, and where. */
@@ -781,6 +791,7 @@ declare function lanesRatchet(r: {
781
791
  declare function createLandingHost(o: {
782
792
  readonly landing: LandingRule;
783
793
  readonly version?: string;
794
+ readonly stretchPositions?: LaneOptions["stretchPositions"];
784
795
  }): LandingCaseHost;
785
796
  declare const LANDING_CASES: readonly LandingCase[];
786
797
 
@@ -797,4 +808,4 @@ declare const CASE_GROUPS: readonly {
797
808
  /** The row with this id, or undefined. */
798
809
  declare const caseById: (id: string) => CaseRow | undefined;
799
810
 
800
- 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, GRIP_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 };
811
+ 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, GRIP_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, ROOM_SINCE, 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 };
@@ -20,7 +20,7 @@ import {
20
20
  storeScene,
21
21
  targets,
22
22
  use
23
- } from "./chunk-FJ5R6PMB.js";
23
+ } from "./chunk-NM4ADJC2.js";
24
24
  import "./chunk-AE3BWTAE.js";
25
25
  import {
26
26
  centre,
@@ -2348,6 +2348,7 @@ async function runCasesAsync(rows, makeHost, options = {}) {
2348
2348
  var LANES_SINCE = "26.11.45";
2349
2349
  var GRAB_SINCE = "26.11.46";
2350
2350
  var GRIP_SINCE = "26.11.48";
2351
+ var ROOM_SINCE = "26.11.50";
2351
2352
  var LAST_WITHOUT_LANES = "26.11.44";
2352
2353
  var LANES_DEADLINE = "2026-12-31";
2353
2354
  var versionBefore = (a, b) => {
@@ -2447,10 +2448,11 @@ function createLandingHost(o) {
2447
2448
  if (!own) throw new Error(`no item ${row2.item}`);
2448
2449
  const press = row2.path[0];
2449
2450
  const grab = { x: press.x - own.rect.x, y: press.y - own.rect.y };
2450
- const regions = lanes(s, row2.item, { previous, grab });
2451
- const regionsFor = (spot2) => lanes(s, row2.item, { previous, grab, spot: spot2 });
2451
+ const laneOptions = { previous, grab, ...o.stretchPositions ? { stretchPositions: o.stretchPositions } : {} };
2452
+ const regions = lanes(s, row2.item, laneOptions);
2453
+ const regionsFor = (spot2) => lanes(s, row2.item, { ...laneOptions, spot: spot2 });
2452
2454
  const home = regions.lanes.flatMap((l) => l.spots.filter((x) => x.home).map((x) => ({ lane: l.id, spot: x.id })))[0];
2453
- const model = o.landing({ regions, regionsFor, floatLanding: (p) => regions.float?.after(p, grab).layout.items[row2.item]?.rect ?? null, ...home ? { home } : {}, placeGuides: "near" });
2455
+ const model = o.landing({ regions, regionsFor, grab, floatLanding: (p) => regions.float?.after(p, grab).layout.items[row2.item]?.rect ?? null, ...home ? { home } : {}, placeGuides: "near" });
2454
2456
  const frames = [];
2455
2457
  const play = (p, t2, moving) => {
2456
2458
  const f2 = model.update(p, t2);
@@ -2467,7 +2469,7 @@ function createLandingHost(o) {
2467
2469
  for (let r = SAMPLE; r <= (row2.rest ?? 0); r += SAMPLE) play(at2, t += SAMPLE, false);
2468
2470
  const out = model.release();
2469
2471
  const spot = out?.kind === "spot" ? [...regions.lanes, ...regionsFor(out.spot).lanes].flatMap((l) => l.spots).find((x) => x.id === out.spot) : void 0;
2470
- const target = out?.kind === "float" ? regions.float : spot && !spot.home ? spot.target : null;
2472
+ const target = out?.kind === "float" ? regions.float : spot && out?.kind === "spot" && !out.home ? spot.target : null;
2471
2473
  const next = target ? target.after(at2, grab).scene : s;
2472
2474
  return { frames, layout: solve(next, { previous }), before: previous };
2473
2475
  }
@@ -2727,6 +2729,28 @@ var LANDING_CASES = [
2727
2729
  moving: { lane: "rail-left", trail: 48, trailBeforeHop: 56 },
2728
2730
  requires: { lanes: { since: GRIP_SINCE } }
2729
2731
  },
2732
+ ...[0.15, 0.6].map(
2733
+ (speed) => ({
2734
+ id: `landing-room-up-past-placed-${speed === 0.15 ? "slow" : "fast"}`,
2735
+ title: `A rail toolbar held by its grip and pulled up past a long neighbor that keeps room stays at the hand (${speed} px/ms)`,
2736
+ expect: `Tools (158 px) keeps 100 px of room above it at the rail's head, and Zoom keeps 80 px below Tools. Zoom pressed by its grip and pulled straight up past Tools to the rail's head at ${speed} px/ms: every frame holds the rail, and the landing lies within 48 px of the pointer, 56 on the frame before a hop. Over the free room a drop consumes it; over Tools, Zoom takes Tools' place and Tools gives way, so the landings either side of Tools are never a whole Tools apart.`,
2737
+ scene: (() => {
2738
+ const s = landingWindow();
2739
+ const tools = group2("tools", 1);
2740
+ const zoom = group2("zoom", 2);
2741
+ return { ...s, items: { ...s.items, tools: { ...tools, space: 100, forms: { ...tools.forms, column: [form("icons", 158, 158, 28), form("menu", 0, 0, 0)] } }, zoom: { ...zoom, space: 80 } } };
2742
+ })(),
2743
+ item: "zoom",
2744
+ path: [
2745
+ { x: 15, y: 380 },
2746
+ { x: 15, y: 40 }
2747
+ ],
2748
+ speed,
2749
+ rest: 40,
2750
+ moving: { lane: "rail-left", trail: 48, trailBeforeHop: 56 },
2751
+ requires: { lanes: { since: ROOM_SINCE } }
2752
+ })
2753
+ ),
2730
2754
  {
2731
2755
  id: "landing-across-items",
2732
2756
  title: "A fast hand across docked items trails no further than it must",
@@ -2772,6 +2796,7 @@ export {
2772
2796
  LANES_SINCE,
2773
2797
  LAST_WITHOUT_LANES,
2774
2798
  LIFT_THRESHOLD,
2799
+ ROOM_SINCE,
2775
2800
  WINDOW_A,
2776
2801
  WINDOW_B,
2777
2802
  WINDOW_BARE,