@n-uf/placement 26.11.37 → 26.11.38

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/dist/desk.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { P as PanelsOptions, a as PanelDef, b as PanelsState, c as PanelTargetInput, d as PanelTarget, p as panelDrop, e as PanelDrop, l as layoutPanels, f as PanelsLayout } from './targets-DnVNZVQW.js';
1
+ import { P as PanelsOptions, a as PanelDef, b as PanelsState, c as PanelTargetInput, d as PanelTarget, p as panelDrop, e as PanelDrop, l as layoutPanels, f as PanelsLayout } from './targets-CYs16P4K.js';
2
2
  import './geometry-Bf37LbCT.js';
3
- import './target-fhD5UVlt.js';
3
+ import './target-Db9z1bWt.js';
4
4
 
5
5
  /**
6
6
  * @n-uf/placement/desk: desk presets as data on `@n-uf/placement/panels`. A preset is options for the panels engine
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { P as Point, R as Rect, S as Size } from './geometry-Bf37LbCT.js';
2
2
  export { C as COLUMN_REACH, E as EPS, a as PLANE, b as RAIL_EDGE, c as area, d as centre, e as clamp, f as clampInto, g as contains, o as overlap, h as overlaps, r as rect, s as subtract } from './geometry-Bf37LbCT.js';
3
- export { T as Target } from './target-fhD5UVlt.js';
3
+ export { R as REFUSAL_RANK, T as Target, p as pickRank } from './target-Db9z1bWt.js';
4
4
 
5
5
  /**
6
6
  * Placing a popup (a drop label, a menu, a tooltip) the way Wayland's xdg-positioner does: an anchor point on the
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ REFUSAL_RANK,
3
+ pickRank
4
+ } from "./chunk-2IZ6JZV5.js";
1
5
  import {
2
6
  COLUMN_REACH,
3
7
  EPS,
@@ -73,6 +77,7 @@ export {
73
77
  EPS,
74
78
  PLANE,
75
79
  RAIL_EDGE,
80
+ REFUSAL_RANK,
76
81
  area,
77
82
  centre,
78
83
  clamp,
@@ -80,6 +85,7 @@ export {
80
85
  contains,
81
86
  overlap,
82
87
  overlaps,
88
+ pickRank,
83
89
  positionPopup,
84
90
  rect,
85
91
  subtract
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/positioner.ts"],"sourcesContent":["/**\n * Placing a popup (a drop label, a menu, a tooltip) the way Wayland's xdg-positioner does: an anchor point on the\n * anchor rect, a gravity, an offset, then the constraint adjustments in order per axis: flip, slide, resize.\n */\nimport type { Point, Rect, Size } from \"./geometry\";\n\n/** -1: the start edge (left or top), 0: the center, 1: the end edge. */\nexport type Align = -1 | 0 | 1;\n\n/**\n * A rule: the popup's anchor point on the anchor rect, the direction it extends from there (gravity), an offset,\n * and which adjustments are allowed: flip (mirror anchor, gravity and offset; kept only if that fits), then slide\n * (move inside, the start edge winning), then resize (cut to the bounds).\n */\nexport interface PositionerRule {\n readonly anchor: { readonly x: Align; readonly y: Align };\n readonly gravity: { readonly x: Align; readonly y: Align };\n readonly offset: Point;\n readonly flip: boolean;\n readonly slide: boolean;\n readonly resize: boolean;\n}\n\nexport interface Positioned {\n readonly rect: Rect;\n readonly flipped: { readonly x: boolean; readonly y: boolean };\n readonly slid: { readonly x: boolean; readonly y: boolean };\n readonly resized: boolean;\n}\n\nfunction placeAxis(a0: number, alen: number, anchor: Align, gravity: Align, offset: number, size: number): number {\n const point = a0 + ((anchor + 1) / 2) * alen + offset;\n return gravity === 1 ? point : gravity === -1 ? point - size : point - size / 2;\n}\n\n/** Where a popup of `size` goes for `anchorRect` by `rule`, kept inside `bounds` as far as the rule allows. */\nexport function positionPopup(anchorRect: Rect, size: Size, bounds: Rect, rule: PositionerRule): Positioned {\n const axes = [\n { a0: anchorRect.x, alen: anchorRect.width, anchor: rule.anchor.x, gravity: rule.gravity.x, offset: rule.offset.x, size: size.width, b0: bounds.x, blen: bounds.width },\n { a0: anchorRect.y, alen: anchorRect.height, anchor: rule.anchor.y, gravity: rule.gravity.y, offset: rule.offset.y, size: size.height, b0: bounds.y, blen: bounds.height },\n ];\n const out = axes.map((ax) => {\n const fits = (start: number, len: number): boolean => start >= ax.b0 - 0.01 && start + len <= ax.b0 + ax.blen + 0.01;\n let start = placeAxis(ax.a0, ax.alen, ax.anchor, ax.gravity, ax.offset, ax.size);\n let len = ax.size;\n let flipped = false;\n let slid = false;\n let resized = false;\n if (!fits(start, len) && rule.flip && (ax.anchor !== 0 || ax.gravity !== 0)) {\n const mirrored = placeAxis(ax.a0, ax.alen, -ax.anchor as Align, -ax.gravity as Align, -ax.offset, ax.size);\n if (fits(mirrored, len)) {\n start = mirrored;\n flipped = true;\n }\n }\n if (!fits(start, len) && rule.slide) {\n if (start + len > ax.b0 + ax.blen) start = ax.b0 + ax.blen - len;\n if (start < ax.b0) start = ax.b0;\n slid = true;\n }\n if (!fits(start, len) && rule.resize) {\n const end = Math.min(start + len, ax.b0 + ax.blen);\n start = Math.max(start, ax.b0);\n len = Math.max(0, end - start);\n resized = true;\n }\n return { start, len, flipped, slid, resized };\n });\n const [x, y] = out as [(typeof out)[0], (typeof out)[0]];\n return {\n rect: { x: x.start, y: y.start, width: x.len, height: y.len },\n flipped: { x: x.flipped, y: y.flipped },\n slid: { x: x.slid, y: y.slid },\n resized: x.resized || y.resized,\n };\n}\n\n/** Below the anchor's bottom-left corner, extending right and down, 6 px apart; flips, slides and resizes. */\nexport const BELOW_LEFT: PositionerRule = {\n anchor: { x: -1, y: 1 },\n gravity: { x: 1, y: 1 },\n offset: { x: 0, y: 6 },\n flip: true,\n slide: true,\n resize: true,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,SAAS,UAAU,IAAY,MAAc,QAAe,SAAgB,QAAgB,MAAsB;AAChH,QAAM,QAAQ,MAAO,SAAS,KAAK,IAAK,OAAO;AAC/C,SAAO,YAAY,IAAI,QAAQ,YAAY,KAAK,QAAQ,OAAO,QAAQ,OAAO;AAChF;AAGO,SAAS,cAAc,YAAkB,MAAY,QAAc,MAAkC;AAC1G,QAAM,OAAO;AAAA,IACX,EAAE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AAQ;AACpC,YAAM,MAAM,KAAK,IAAI,QAAQ,KAAK,GAAG,KAAK,GAAG,IAAI;AACjD,cAAQ,KAAK,IAAI,OAAO,GAAG,EAAE;AAC7B,YAAM,KAAK,IAAI,GAAG,MAAM,KAAK;AAC7B,gBAAU;AAAA,IACZ;AACA,WAAO,EAAE,OAAO,KAAK,SAAS,MAAM,QAAQ;AAAA,EAC9C,CAAC;AACD,QAAM,CAAC,GAAG,CAAC,IAAI;AACf,SAAO;AAAA,IACL,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,EAAE,OAAO,OAAO,EAAE,KAAK,QAAQ,EAAE,IAAI;AAAA,IAC5D,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE,QAAQ;AAAA,IACtC,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,KAAK;AAAA,IAC7B,SAAS,EAAE,WAAW,EAAE;AAAA,EAC1B;AACF;AAGO,IAAM,aAA6B;AAAA,EACxC,QAAQ,EAAE,GAAG,IAAI,GAAG,EAAE;AAAA,EACtB,SAAS,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACtB,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACrB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;","names":["start","len"]}
1
+ {"version":3,"sources":["../src/positioner.ts"],"sourcesContent":["/**\n * Placing a popup (a drop label, a menu, a tooltip) the way Wayland's xdg-positioner does: an anchor point on the\n * anchor rect, a gravity, an offset, then the constraint adjustments in order per axis: flip, slide, resize.\n */\nimport type { Point, Rect, Size } from \"./geometry\";\n\n/** -1: the start edge (left or top), 0: the center, 1: the end edge. */\nexport type Align = -1 | 0 | 1;\n\n/**\n * A rule: the popup's anchor point on the anchor rect, the direction it extends from there (gravity), an offset,\n * and which adjustments are allowed: flip (mirror anchor, gravity and offset; kept only if that fits), then slide\n * (move inside, the start edge winning), then resize (cut to the bounds).\n */\nexport interface PositionerRule {\n readonly anchor: { readonly x: Align; readonly y: Align };\n readonly gravity: { readonly x: Align; readonly y: Align };\n readonly offset: Point;\n readonly flip: boolean;\n readonly slide: boolean;\n readonly resize: boolean;\n}\n\nexport interface Positioned {\n readonly rect: Rect;\n readonly flipped: { readonly x: boolean; readonly y: boolean };\n readonly slid: { readonly x: boolean; readonly y: boolean };\n readonly resized: boolean;\n}\n\nfunction placeAxis(a0: number, alen: number, anchor: Align, gravity: Align, offset: number, size: number): number {\n const point = a0 + ((anchor + 1) / 2) * alen + offset;\n return gravity === 1 ? point : gravity === -1 ? point - size : point - size / 2;\n}\n\n/** Where a popup of `size` goes for `anchorRect` by `rule`, kept inside `bounds` as far as the rule allows. */\nexport function positionPopup(anchorRect: Rect, size: Size, bounds: Rect, rule: PositionerRule): Positioned {\n const axes = [\n { a0: anchorRect.x, alen: anchorRect.width, anchor: rule.anchor.x, gravity: rule.gravity.x, offset: rule.offset.x, size: size.width, b0: bounds.x, blen: bounds.width },\n { a0: anchorRect.y, alen: anchorRect.height, anchor: rule.anchor.y, gravity: rule.gravity.y, offset: rule.offset.y, size: size.height, b0: bounds.y, blen: bounds.height },\n ];\n const out = axes.map((ax) => {\n const fits = (start: number, len: number): boolean => start >= ax.b0 - 0.01 && start + len <= ax.b0 + ax.blen + 0.01;\n let start = placeAxis(ax.a0, ax.alen, ax.anchor, ax.gravity, ax.offset, ax.size);\n let len = ax.size;\n let flipped = false;\n let slid = false;\n let resized = false;\n if (!fits(start, len) && rule.flip && (ax.anchor !== 0 || ax.gravity !== 0)) {\n const mirrored = placeAxis(ax.a0, ax.alen, -ax.anchor as Align, -ax.gravity as Align, -ax.offset, ax.size);\n if (fits(mirrored, len)) {\n start = mirrored;\n flipped = true;\n }\n }\n if (!fits(start, len) && rule.slide) {\n if (start + len > ax.b0 + ax.blen) start = ax.b0 + ax.blen - len;\n if (start < ax.b0) start = ax.b0;\n slid = true;\n }\n if (!fits(start, len) && rule.resize) {\n const end = Math.min(start + len, ax.b0 + ax.blen);\n start = Math.max(start, ax.b0);\n len = Math.max(0, end - start);\n resized = true;\n }\n return { start, len, flipped, slid, resized };\n });\n const [x, y] = out as [(typeof out)[0], (typeof out)[0]];\n return {\n rect: { x: x.start, y: y.start, width: x.len, height: y.len },\n flipped: { x: x.flipped, y: y.flipped },\n slid: { x: x.slid, y: y.slid },\n resized: x.resized || y.resized,\n };\n}\n\n/** Below the anchor's bottom-left corner, extending right and down, 6 px apart; flips, slides and resizes. */\nexport const BELOW_LEFT: PositionerRule = {\n anchor: { x: -1, y: 1 },\n gravity: { x: 1, y: 1 },\n offset: { x: 0, y: 6 },\n flip: true,\n slide: true,\n resize: true,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,UAAU,IAAY,MAAc,QAAe,SAAgB,QAAgB,MAAsB;AAChH,QAAM,QAAQ,MAAO,SAAS,KAAK,IAAK,OAAO;AAC/C,SAAO,YAAY,IAAI,QAAQ,YAAY,KAAK,QAAQ,OAAO,QAAQ,OAAO;AAChF;AAGO,SAAS,cAAc,YAAkB,MAAY,QAAc,MAAkC;AAC1G,QAAM,OAAO;AAAA,IACX,EAAE,IAAI,WAAW,GAAG,MAAM,WAAW,OAAO,QAAQ,KAAK,OAAO,GAAG,SAAS,KAAK,QAAQ,GAAG,QAAQ,KAAK,OAAO,GAAG,MAAM,KAAK,OAAO,IAAI,OAAO,GAAG,MAAM,OAAO,MAAM;AAAA,IACtK,EAAE,IAAI,WAAW,GAAG,MAAM,WAAW,QAAQ,QAAQ,KAAK,OAAO,GAAG,SAAS,KAAK,QAAQ,GAAG,QAAQ,KAAK,OAAO,GAAG,MAAM,KAAK,QAAQ,IAAI,OAAO,GAAG,MAAM,OAAO,OAAO;AAAA,EAC3K;AACA,QAAM,MAAM,KAAK,IAAI,CAAC,OAAO;AAC3B,UAAM,OAAO,CAACA,QAAeC,SAAyBD,UAAS,GAAG,KAAK,QAAQA,SAAQC,QAAO,GAAG,KAAK,GAAG,OAAO;AAChH,QAAI,QAAQ,UAAU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S,EAAE,WAAW,EAAE;AAAA,EAC1B;AACF;AAGO,IAAM,aAA6B;AAAA,EACxC,QAAQ,EAAE,GAAG,IAAI,GAAG,EAAE;AAAA,EACtB,SAAS,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACtB,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACrB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;","names":["start","len"]}
@@ -1,5 +1,5 @@
1
1
  import { R as Rect, S as Size, P as Point } from './geometry-Bf37LbCT.js';
2
- import { T as Target } from './target-fhD5UVlt.js';
2
+ import { T as Target } from './target-Db9z1bWt.js';
3
3
  import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-X7eUaKlA.js';
4
4
 
5
5
  /**
@@ -214,9 +214,21 @@ interface Edge {
214
214
  * its items have none either (dragging one gives nothing); `moveTo` into it is refused as into an edge that doesn't
215
215
  * take the kind. Its items stay in it, and `storeScene` / `readScene` keep them. A column a drop makes never takes a
216
216
  * hidden edge's id; where a drop makes or removes a column on its side, the side is numbered again with the hidden
217
- * edge back at its own place. Side columns, rails and bars alike.
217
+ * edge back at its own place. Side columns, rails and bars alike. With `showIn`, its items show elsewhere instead.
218
218
  */
219
219
  readonly hidden?: boolean;
220
+ /**
221
+ * Where a hidden edge's items show while it is hidden: the id of another static edge, shown. Its items are laid out, targeted
222
+ * and stopped as if they sat in that edge after its own items (`solve` reports them there), each that edge takes the
223
+ * kind of, in its own zone where that edge takes it there, else in the first that does; a fixed item, or one whose
224
+ * kind that edge takes nowhere, is left out as without `showIn`. They stay in the hidden edge in the scene: a drop that
225
+ * commits a move of one takes it out, to the drop's place; its home, and any drop of another item, leaves them where
226
+ * they are. A moved item keeps its stored zone, unless the drop names one (a gap). `canFold`, `fold` and the hand
227
+ * fold read a lent item along the edge it is drawn in. View state like `hidden`: the store never writes it. Naming the
228
+ * edge itself, no edge, another hidden edge or a dynamic column (`column: true`: drops make and delete those) is
229
+ * ignored (`show-in-ignored`). No effect on an edge that isn't hidden.
230
+ */
231
+ readonly showIn?: string;
220
232
  }
221
233
  /** What a side's new columns are made from. */
222
234
  interface ColumnTemplate {
@@ -498,6 +510,8 @@ interface SceneRailLayout {
498
510
  * its zoom only on this note.
499
511
  * - `no-vertical-form`: an item left out of a vertical place (a rail, a vertical float) because only `wrap` forms are
500
512
  * left to it (vertical means icons: give a word group an `icons` form).
513
+ * - `show-in-ignored`: a hidden edge's `showIn` names the edge itself, no edge, another hidden edge or a dynamic
514
+ * column; its items are left out as if it named none.
501
515
  */
502
516
  type SceneNote = ({
503
517
  readonly edge: string;
@@ -550,6 +564,9 @@ type SceneNote = ({
550
564
  readonly code: "no-icons-form";
551
565
  readonly id: string;
552
566
  readonly edge: string;
567
+ } | {
568
+ readonly code: "show-in-ignored";
569
+ readonly edge: string;
553
570
  };
554
571
  type SceneNoteCode = SceneNote["code"];
555
572
  interface SceneLayout {
@@ -770,7 +787,9 @@ declare function dockHome(scene: Scene, id: string, start: Scene): Scene;
770
787
  * columns left empty are deleted, the rings closed up. `Edge.hidden` is view state, not stored: the host decides it
771
788
  * each time it builds the scene (from the window's width, say). A hidden edge's items are stored like any edge's;
772
789
  * `hidden` itself is not written, and read back it comes from `base` only (a stored `hidden` is ignored and listed as
773
- * `edge:<id>:hidden`). No float has a pinned field: one an old store has is listed and ignored.
790
+ * `edge:<id>:hidden`). `Edge.showIn` is the same: never written, from `base` only, a stored one listed as
791
+ * `edge:<id>:showIn`; the items a hidden edge lends are stored in it, as they are. No float has a pinned field: one
792
+ * an old store has is listed and ignored.
774
793
  *
775
794
  * Reading is lenient: anything but an object of version 1 gives `base` back with the reason in `error`. Inside one,
776
795
  * whatever can't be used is dropped and listed in `dropped` (an unknown edge `edge:<id>`, an unknown or repeated item,
@@ -907,6 +926,11 @@ interface SceneRefusal {
907
926
  * own (a release there puts it back). `not-accepted`: the edge or zone doesn't take the kind.
908
927
  */
909
928
  readonly reason: "no-room" | "own-place" | "not-accepted";
929
+ /**
930
+ * The stage: the refusal holds only points strictly inside it (`Target.bounds`), so a pointer a host clamps exactly
931
+ * onto the window's edge is never in it. Set by `refusals()`; `refusalTargets` passes it on.
932
+ */
933
+ readonly bounds?: Rect;
910
934
  }
911
935
 
912
936
  export { canFold as $, type RailSpec as A, type RailVisibility as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchorAt as F, type ResizeEdges as G, type ResizeLimit as H, SIDES as I, type SceneAfter as J, type Kind as K, type SceneChrome as L, type SceneEdgeLayout as M, type SceneFloat as N, type Orient as O, type Place as P, type SceneItemLayout as Q, type RailMode as R, type Scene as S, type SceneNote as T, type SceneRailLayout as U, type SceneRead as V, type StoredSceneEdge as W, type StoredSceneFloat as X, type StoredSceneItem as Y, type Zone as Z, ZONES as _, type ScenePlace as a, close as a0, dockHome as a1, fitResize as a2, floatAt as a3, fold as a4, homeFor as a5, keep as a6, lift as a7, moveTo as a8, open as a9, orient as aa, raise as ab, readScene as ac, resize as ad, setRailMode as ae, setSide as af, storeScene as ag, use as ah, 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 SolveOptions as k, type SceneTargetOptions as l, type ColumnTemplate as m, DEFAULT_HIT_BAND as n, DEFAULT_RAIL_MAGNET as o, DEFAULT_STRIP as p, type DockPlace as q, FLOAT_ANCHORS as r, type FloatAnchorOffset as s, type FloatPlace as t, type FloatResize as u, RAIL_MODES as v, RAIL_STRIP_MIN as w, RAIL_VISIBILITIES as x, type RailDropPolicy as y, type RailPlace as z };
package/dist/panels.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-DnVNZVQW.js';
2
- export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-DnVNZVQW.js';
1
+ import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-CYs16P4K.js';
2
+ export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-CYs16P4K.js';
3
3
  import { R as Rect } from './geometry-Bf37LbCT.js';
4
4
  export { C as COLUMN_REACH, b as RAIL_EDGE } from './geometry-Bf37LbCT.js';
5
- import './target-fhD5UVlt.js';
5
+ import './target-Db9z1bWt.js';
6
6
 
7
7
  /**
8
8
  * The panels' stored form: `storePanels(state)` gives plain JSON-safe data (`{ v: 1, … }`); `readPanels(data, defs?)`
@@ -1,7 +1,7 @@
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 } from './model-CuE-ML-f.js';
4
- import './target-fhD5UVlt.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 } from './model-bUSbHw8v.js';
4
+ import './target-Db9z1bWt.js';
5
5
 
6
6
  /**
7
7
  * The conformance rows' shapes. A row is plain data: a scene, the settings it runs at, the gestures a user makes, and
@@ -273,20 +273,25 @@ interface CaseHost {
273
273
  }
274
274
  /**
275
275
  * The pick rule: which of `list` the pointer at `point` is over, or null. There is one, `@n-uf/motion/drag`'s
276
- * `targetAt` (the lowest priority number, then the smallest zone; a rect holds its edges exactly; `hits` all count), and
277
- * every host passes it: placement doesn't import motion, so the host takes the rule as an input. A `move` lands the
278
- * pointer over the target this rule picks, and `resolvePlace` aims with it.
276
+ * `targetAt` (the lowest rank, `pickRank`: the priority, a refusal's `REFUSAL_RANK`; then the smallest zone; a rect
277
+ * holds its edges exactly, except toward the outside of `bounds`; `hits` all count), and every host passes it:
278
+ * placement doesn't import motion, so the host takes the rule as an input. A `move` lands the pointer over the target
279
+ * this rule picks, and `resolvePlace` aims with it.
279
280
  *
280
- * It reads only a candidate's `id`, `priority`, `hit` and `hits`, and gives back one of the candidates it was given, so
281
- * one rule picks among targets, refusal targets (`refusalTargets`) or both.
281
+ * It reads only a candidate's `id`, `priority`, `refuse`, `hit`, `hits` and `bounds`, and gives back one of the
282
+ * candidates it was given, so one rule picks among targets, refusal targets (`refusalTargets`) or both.
282
283
  */
283
284
  type PickRule = <T extends PickCandidate>(list: readonly T[], point: Point) => T | null;
284
285
  /** What the pick rule reads of a candidate. */
285
286
  interface PickCandidate {
286
287
  readonly id: string;
287
288
  readonly priority: 1 | 2 | 3;
289
+ /** A refusal: it ranks after every target of priority 1 and 2 (`REFUSAL_RANK`). */
290
+ readonly refuse?: true;
288
291
  readonly hit: Rect;
289
292
  readonly hits?: readonly Rect[];
293
+ /** The window's stage, for a refusal and the float: the zone holds only points strictly inside it. */
294
+ readonly bounds?: Rect;
290
295
  }
291
296
  /**
292
297
  * A `CaseHost` whose calls may be async (a page a browser runner drives with real pointer events and timers): each of
@@ -335,8 +340,9 @@ declare const LIFT_THRESHOLD = 4;
335
340
  /** How far past an edge's ends its first and last gaps reach (px); toolbars use 24. */
336
341
  declare const END_REACH = 24;
337
342
  /**
338
- * The most precise target under `point`: the lowest priority number, then the smallest zone; null when none is. A
339
- * target with `hits` is under the point in any of them, and its zone's size is theirs together.
343
+ * The most precise target under `point`: the lowest rank (`pickRank`: the priority, a refusal's `REFUSAL_RANK`), then
344
+ * the smallest zone; null when none is. A target with `hits` is under the point in any of them, and its zone's size is
345
+ * theirs together.
340
346
  *
341
347
  * @deprecated The pick rule is `@n-uf/motion/drag`'s `targetAt`: pass it as `createSceneHost({ pick: targetAt })` and
342
348
  * to `resolvePlace`. This is only the reference host's default when none is given (placement doesn't import motion),
@@ -348,6 +354,8 @@ declare function pickTarget<T extends {
348
354
  readonly priority: number;
349
355
  readonly hit: Rect;
350
356
  readonly hits?: readonly Rect[];
357
+ readonly refuse?: true;
358
+ readonly bounds?: Rect;
351
359
  }>(list: readonly T[], point: Point): T | null;
352
360
  /**
353
361
  * The pick rule with the scene's refusals (`refusals(scene, dragged)`), the drag intent's way: the refusals take part in
@@ -1,3 +1,6 @@
1
+ import {
2
+ pickRank
3
+ } from "./chunk-2IZ6JZV5.js";
1
4
  import {
2
5
  close,
3
6
  dockHome,
@@ -16,7 +19,7 @@ import {
16
19
  storeScene,
17
20
  targets,
18
21
  use
19
- } from "./chunk-2PWDUBPG.js";
22
+ } from "./chunk-GWZ5BPIN.js";
20
23
  import "./chunk-AE3BWTAE.js";
21
24
  import {
22
25
  centre,
@@ -570,12 +573,12 @@ var DOCKING_ROWS = [
570
573
  {
571
574
  id: "C17",
572
575
  title: "A drop past the stage's edge",
573
- expect: "A float dropped with the pointer past the stage's edge: the pointer is clamped into the stage first (the host contract; the runner clamps every `move` to a point), and the clamped point picks what is there. Nothing is docked at this stage's right edge, so it picks the float, which lands clamped into the stage; the preview shows it clamped, and the drop never cancels. A window with a docked edge there picks that edge's last gap instead.",
576
+ expect: "A float dropped with the pointer past the stage's edge: the pointer is clamped into the stage first (the host contract; the runner clamps every `move` to a point), and the clamped point, on the window's edge, picks only a target drawn against that edge. Outside the window is no drawn space: the float and every refusal hold only points strictly inside it. Nothing is docked at this stage's right edge, so nothing is picked: the preview leaves the held float's place empty and the drop commits nothing, the float back where it was. A window with a docked edge there picks that edge's last gap instead.",
574
577
  group: "floats",
575
578
  scene: bench(),
576
579
  gestures: [g.press("findings", { x: 40, y: 10 }), g.at(920, 240), g.hold(), g.release()],
577
- checkpoints: [{ at: 2, layout: { items: { findings: { floating: true, rect: rect(620, 230, 220, 190) } } }, note: "the preview, clamped into the stage" }],
578
- expectLayout: { items: { findings: { floating: true, rect: rect(620, 230, 220, 190) } } }
580
+ checkpoints: [{ at: 2, layout: { items: { findings: null } }, note: "no target past the edge: the held float out of the layout" }],
581
+ expectLayout: { items: { findings: { floating: true, rect: rect(440, 130, 220, 190) } } }
579
582
  }
580
583
  ];
581
584
 
@@ -1152,6 +1155,13 @@ function withTitle(s) {
1152
1155
  items: { ...s.items, "window-title": { id: "window-title", kind: "title", used: 0, fixed: true, forms: { row: [form("row", 80, 160, 28, { grows: true })] } } }
1153
1156
  };
1154
1157
  }
1158
+ function withStatusBar(s) {
1159
+ return {
1160
+ ...s,
1161
+ edges: [...s.edges, { id: "statusbar", side: "bottom", ring: 0, span: "full", accepts: ["group"], items: ["status"], cross: { min: 8, max: 8, rail: 8 } }],
1162
+ items: { ...s.items, status: { id: "status", kind: "title", used: 0, fixed: true, forms: { row: [form("row", 80, 160, 8, { grows: true })] } } }
1163
+ };
1164
+ }
1155
1165
  var RIGHT_EDGE = 1108;
1156
1166
  var LINE_OUT = 1;
1157
1167
  var GESTURE_ROWS = [
@@ -1290,6 +1300,28 @@ var GESTURE_ROWS = [
1290
1300
  gestures: [g.press("pages"), g.at(958, 814), g.hold(), g.release()],
1291
1301
  expectLayout: { items: { annotations: { rect: rect(12, 0, 300, 800) }, findings: { rect: rect(808, 0, 300, 394) }, pages: { edge: "right-0", rect: rect(808, 406, 300, 394) } }, columns: { left: [["annotations"]], right: [["findings", "pages"]] } }
1292
1302
  },
1303
+ {
1304
+ id: "P7-target-meets-a-refusal",
1305
+ title: "Where a target meets a refusal, the target wins",
1306
+ expect: "With an 8 px status line across the bottom (it takes no panels), Pages let go on the line where the right column's outer new-column line ends on the status line goes to a new outer right column: the refusal never takes a point a target holds, however small it is.",
1307
+ group: "gestures",
1308
+ scene: withStatusBar(win()),
1309
+ gestures: [g.press("pages"), g.at(1098, 792), g.hold(), g.release()],
1310
+ expectLayout: { columns: { left: [["annotations"]], right: [["pages"], ["findings"]] } }
1311
+ },
1312
+ {
1313
+ id: "P7-past-a-refused-bar",
1314
+ title: "Past the window's edge beyond a refused bar, nothing is picked",
1315
+ expect: "With an 8 px status line across the bottom (it takes no panels), Findings held over the status line is refused there; moved on past the window's bottom edge (clamped onto it) it is over no drawn space: neither the refusal nor the float holds the window's edge, so nothing is picked and the drop commits nothing.",
1316
+ group: "gestures",
1317
+ scene: withStatusBar(win()),
1318
+ gestures: [g.press("findings"), g.at(700, 796), g.hold(), g.at(700, 840), g.hold(), g.release()],
1319
+ checkpoints: [
1320
+ { at: 2, layout: { items: { findings: null } }, note: "over the status line: refused, the held panel out of the layout" },
1321
+ { at: 4, layout: { items: { findings: null } }, note: "past the window's edge: nothing picked" }
1322
+ ],
1323
+ expectLayout: { columns: { left: [["pages", "annotations"]], right: [["findings"]] } }
1324
+ },
1293
1325
  {
1294
1326
  id: "P8-folded-bar-drags-like-a-card",
1295
1327
  title: "A folded bar drags like a card",
@@ -1669,12 +1701,13 @@ var LIFT_THRESHOLD = 4;
1669
1701
  var END_REACH = 24;
1670
1702
  function pickTarget(list, point) {
1671
1703
  const holds = (r) => point.x >= r.x && point.x <= r.x + r.width && point.y >= r.y && point.y <= r.y + r.height;
1672
- const under = (t) => t.hits ? t.hits.some(holds) : holds(t.hit);
1704
+ const within = (o) => !o || point.x > o.x && point.x < o.x + o.width && point.y > o.y && point.y < o.y + o.height;
1705
+ const under = (t) => within(t.bounds) && (t.hits ? t.hits.some(holds) : holds(t.hit));
1673
1706
  const size = (t) => t.hits ? t.hits.reduce((s, r) => s + r.width * r.height, 0) : t.hit.width * t.hit.height;
1674
1707
  let best = null;
1675
1708
  for (const t of list) {
1676
1709
  if (!under(t)) continue;
1677
- if (!best || t.priority < best.priority || t.priority === best.priority && size(t) < size(best)) best = t;
1710
+ if (!best || pickRank(t) < pickRank(best) || pickRank(t) === pickRank(best) && size(t) < size(best)) best = t;
1678
1711
  }
1679
1712
  return best;
1680
1713
  }