@n-uf/docking 26.12.12 → 26.12.13

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.
@@ -47,7 +47,8 @@ interface DockItem {
47
47
  };
48
48
  /** How recently it was used: the smaller, the longer ago, the sooner it gives way. */
49
49
  readonly used: number;
50
- /** Kept: gives way after every item that isn't. */
50
+ /** Kept: in each step of give-way it goes after every item that isn't: it shrinks after them and folds after
51
+ * them. It still shrinks before any column folds. */
51
52
  readonly kept?: boolean;
52
53
  /**
53
54
  * Folded by hand when 1 or more (`foldItem` sets it to 1; default unset): it starts at its first folded form (a panel's
@@ -521,6 +522,18 @@ interface DockState {
521
522
  * number. A declaration, like `foldedColumnDrop`: never stored.
522
523
  */
523
524
  readonly sideColumns?: number | "one";
525
+ /**
526
+ * The panels that give way last, by id. A column holding one neither shrinks nor folds while a column holding
527
+ * none can still give way; within each group the give-way order is unchanged. Ids not in the state are ignored.
528
+ * Absent or empty: as before. A declaration: never stored.
529
+ *
530
+ * A column holds a declared panel as it holds a kept item: one of the items it shows is one (a column with a
531
+ * declared panel and an undeclared one is in the last group). The columns that can't give way (an anchor, a side
532
+ * toolbar bar or compact rail, a static edge without `giveWay`, a column folded whole by hand, and a column that
533
+ * shows no item) never hold the last group open.
534
+ * Both sides are one group. Width only: bars give way by height as before.
535
+ */
536
+ readonly givesWayLast?: readonly string[];
524
537
  /**
525
538
  * `"nearest"`: a bar's zones (start, center, end) meet halfway between the landing rects either side of each boundary,
526
539
  * so the pointer picks the zone whose landing is nearest it. Absent: at thirds of the bar's length (each boundary moved
@@ -532,9 +545,10 @@ interface DockState {
532
545
  */
533
546
  readonly barZones?: "nearest";
534
547
  /**
535
- * The least the content may be. While the content is narrower than `width`, dynamic columns shrink toward their
536
- * minimum, then fold whole into their side's rail: unkept before kept, the one whose newest use is oldest first, the
537
- * outer first, the left first. Under `height`, a `content-short` note.
548
+ * The least the content may be. While the content is narrower than `width`, columns give way a tier at a time: first
549
+ * the columns holding no panel the host declared last (`givesWayLast`), then the ones that do. Within a tier the
550
+ * columns shrink toward their minimum, then fold whole into their side's rail: unkept before kept, the one whose
551
+ * newest use is oldest first, the outer first, the left first. Under `height`, a `content-short` note.
538
552
  *
539
553
  * `chromeWidth` (optional, px, at most `width`): a lower floor for chrome. The side edges that hold toolbars, not
540
554
  * panels (compact rails and side toolbar bars, `isSideBar`), may take the content down to it while the columns keep
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as KeepClear, A as AnchoredKeepClear, e as DockEdge, f as DockRailLayout, R as RailMode, S as SolveOptions, g as DockLayout, h as DockRefusal, i as DockDropOptions, j as DockDrop } from './drag-CH_6THw0.js';
2
- export { C as ColumnPlace, k as ColumnTemplate, l as DEFAULT_FLOAT_SIZE, m as DEFAULT_HIT_BAND, n as DEFAULT_RAIL_MAGNET, o as DEFAULT_STRIP, p as DockAfter, q as DockDrag, r as DockEdgeLayout, s as DockFloat, t as DockGrab, u as DockGrabForm, v as DockGrabNote, w as DockGrabPlace, x as DockGuideFrame, y as DockGuideRef, z as DockHeld, B as DockItemLayout, E as DockKeepClearLayout, G as DockLane, H as DockLaneMark, I as DockLaneOptions, J as DockMark, L as DockNote, M as DockNoteCode, N as DockPlace, P as DockRegions, Q as DockSpot, T as DockStateRead, U as DropPlace, V as DropResult, W as EDGE_ROOM_HOLD, X as EmptyLanes, Y as FLOAT_ANCHORS, _ as FloatAnchorOffset, $ as FloatPlace, a0 as FloatResize, a1 as HATCH_EDGE, a2 as HATCH_END, a3 as KeepClearRegion, a4 as LaneRefusal, a5 as LaneSlide, a6 as Place, a7 as RAIL_MODES, a8 as RAIL_STRIP_MIN, a9 as RAIL_VISIBILITIES, aa as RailDropPolicy, ab as RailPlace, ac as RailSpec, ad as RailVisibility, ae as ResizeEdges, af as ResizeLimit, ag as SIDES, ah as StoredDockState, ai as StoredDockStateEdge, aj as StoredDockStateFloat, ak as StoredDockStateItem, al as ZONES, am as canFold, an as closeItem, ao as dockDrag, ap as dockHome, aq as fitResize, ar as floatAt, as as foldItem, at as homeFor, au as keepItem, av as lanes, aw as liftItem, ax as markUsed, ay as mergeSideColumns, az as moveTo, aA as openItem, aB as orientFloat, aC as raiseFloat, aD as readDockState, aE as resizeEdge, aF as resizeFloat, aG as setRailMode, aH as setSide, aI as storeDockState } from './drag-CH_6THw0.js';
1
+ import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as KeepClear, A as AnchoredKeepClear, e as DockEdge, f as DockRailLayout, R as RailMode, S as SolveOptions, g as DockLayout, h as DockRefusal, i as DockDropOptions, j as DockDrop } from './drag-DzPpzGfq.js';
2
+ export { C as ColumnPlace, k as ColumnTemplate, l as DEFAULT_FLOAT_SIZE, m as DEFAULT_HIT_BAND, n as DEFAULT_RAIL_MAGNET, o as DEFAULT_STRIP, p as DockAfter, q as DockDrag, r as DockEdgeLayout, s as DockFloat, t as DockGrab, u as DockGrabForm, v as DockGrabNote, w as DockGrabPlace, x as DockGuideFrame, y as DockGuideRef, z as DockHeld, B as DockItemLayout, E as DockKeepClearLayout, G as DockLane, H as DockLaneMark, I as DockLaneOptions, J as DockMark, L as DockNote, M as DockNoteCode, N as DockPlace, P as DockRegions, Q as DockSpot, T as DockStateRead, U as DropPlace, V as DropResult, W as EDGE_ROOM_HOLD, X as EmptyLanes, Y as FLOAT_ANCHORS, _ as FloatAnchorOffset, $ as FloatPlace, a0 as FloatResize, a1 as HATCH_EDGE, a2 as HATCH_END, a3 as KeepClearRegion, a4 as LaneRefusal, a5 as LaneSlide, a6 as Place, a7 as RAIL_MODES, a8 as RAIL_STRIP_MIN, a9 as RAIL_VISIBILITIES, aa as RailDropPolicy, ab as RailPlace, ac as RailSpec, ad as RailVisibility, ae as ResizeEdges, af as ResizeLimit, ag as SIDES, ah as StoredDockState, ai as StoredDockStateEdge, aj as StoredDockStateFloat, ak as StoredDockStateItem, al as ZONES, am as canFold, an as closeItem, ao as dockDrag, ap as dockHome, aq as fitResize, ar as floatAt, as as foldItem, at as homeFor, au as keepItem, av as lanes, aw as liftItem, ax as markUsed, ay as mergeSideColumns, az as moveTo, aA as openItem, aB as orientFloat, aC as raiseFloat, aD as readDockState, aE as resizeEdge, aF as resizeFloat, aG as setRailMode, aH as setSide, aI as storeDockState } from './drag-DzPpzGfq.js';
3
3
  import { Size, Point, Rect, Side, Target } from '@n-uf/placement';
4
4
  export { Axis, Side } from '@n-uf/placement';
5
5
  import '@n-uf/placement/stack';
package/dist/index.js CHANGED
@@ -67,7 +67,7 @@ import {
67
67
  zoneIn,
68
68
  zoneTakes,
69
69
  zonesTaking
70
- } from "./chunk-NYMM2UDJ.js";
70
+ } from "./chunk-NPBJJJWS.js";
71
71
  export {
72
72
  DEFAULT_FLOAT_SIZE,
73
73
  DEFAULT_HIT_BAND,
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Point, Rect, Side } from '@n-uf/placement';
2
2
  import { StackFormKind } from '@n-uf/placement/stack';
3
- import { c as DockState, U as DropPlace, g as DockLayout, ah as StoredDockState, b as Zone, M as DockNoteCode, j as DockDrop, h as DockRefusal, I as DockLaneOptions, z as DockHeld, y as DockGuideRef, P as DockRegions, Q as DockSpot } from './drag-CH_6THw0.js';
3
+ import { c as DockState, U as DropPlace, g as DockLayout, ah as StoredDockState, b as Zone, M as DockNoteCode, j as DockDrop, h as DockRefusal, I as DockLaneOptions, z as DockHeld, y as DockGuideRef, P as DockRegions, Q as DockSpot } from './drag-DzPpzGfq.js';
4
4
  import { LandingGeometry, LandingRegions } from '@n-uf/motion/drag';
5
5
 
6
6
  /**
package/dist/testing.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  stops,
19
19
  storeDockState,
20
20
  targets
21
- } from "./chunk-NYMM2UDJ.js";
21
+ } from "./chunk-NPBJJJWS.js";
22
22
 
23
23
  // src/testing/rows-docking.ts
24
24
  import { rect as r } from "@n-uf/placement";
@@ -1639,6 +1639,8 @@ function at(id, title2, group3, spec, o, width, columns, rails, atLeast, walk) {
1639
1639
  }
1640
1640
  var ALL_THREE = { left: ["pages", "annotations"], right: ["findings"] };
1641
1641
  var PAIR = { columns: { left: [["annotations"]], right: [["findings"]] } };
1642
+ var NATURALS_A = { pages: { natural: 300, min: 110 }, annotations: { natural: 320, min: 220 }, findings: { natural: 320, min: 220 } };
1643
+ var NATURALS_B = { pages: { natural: 280, min: 118 }, annotations: { natural: 320, min: 200 }, findings: { natural: 320, min: 200 } };
1642
1644
  function windowRows() {
1643
1645
  const rows = [];
1644
1646
  const A = (name, o, w, c, r5, min, walk) => {
@@ -1683,6 +1685,26 @@ function windowRows() {
1683
1685
  B("pair", PAIR, 590, { right: [["findings"]] }, { left: ["annotations"] });
1684
1686
  B("pair", PAIR, 552, { right: [["findings"]] }, { left: ["annotations"] });
1685
1687
  B("pair", PAIR, 551, {}, { left: ["annotations"], right: ["findings"] });
1688
+ const declared = (spec, naturals, name, o, width, c, min, r5 = {}) => {
1689
+ const w = spec === WINDOW_A ? "a" : "b";
1690
+ const row2 = at(`window-${w}-${name}-declared-${width}`, `Window ${w.toUpperCase()}, ${name}, natural widths, Findings declared last, ${width} px`, `window-${w}`, spec, o, width, c, r5, min);
1691
+ const items = Object.fromEntries(
1692
+ Object.entries(row2.state.items).map(([id, it]) => {
1693
+ const cross = naturals[id];
1694
+ const forms = it.forms.column ?? [];
1695
+ return [id, cross && forms[0] ? { ...it, forms: { ...it.forms, column: [{ ...forms[0], cross }, ...forms.slice(1)] } } : it];
1696
+ })
1697
+ );
1698
+ rows.push({ ...row2, expect: `${row2.expect} Every card at its natural width, Findings declared last.`, state: { ...row2.state, items, givesWayLast: ["findings"] } });
1699
+ };
1700
+ declared(WINDOW_A, NATURALS_A, "three", {}, 908, open3, 320);
1701
+ declared(WINDOW_A, NATURALS_A, "pair", PAIR, 908, { left: [["annotations"]], right: [["findings"]] });
1702
+ declared(WINDOW_B, NATURALS_B, "three", {}, 840, open3, 320);
1703
+ declared(WINDOW_B, NATURALS_B, "pair", PAIR, 840, { left: [["annotations"]], right: [["findings"]] });
1704
+ declared(WINDOW_A, NATURALS_A, "three", {}, 907, leftFolded3, void 0, railsLeft3);
1705
+ declared(WINDOW_A, NATURALS_A, "pair", PAIR, 907, { right: [["findings"]] }, void 0, { left: ["annotations"] });
1706
+ declared(WINDOW_B, NATURALS_B, "three", {}, 839, leftFolded3, void 0, railsLeft3);
1707
+ declared(WINDOW_B, NATURALS_B, "pair", PAIR, 839, { right: [["findings"]] }, void 0, { left: ["annotations"] });
1686
1708
  return rows;
1687
1709
  }
1688
1710
  var HAND = [
@@ -2037,7 +2059,10 @@ function mapState(s, f2) {
2037
2059
  ...s,
2038
2060
  edges: s.edges.map((e) => ({ ...e, id: f2(e.id), items: e.items.map(f2) })),
2039
2061
  items: rekey(s.items, f2, (it) => ({ ...it, id: f2(it.id) })),
2040
- floats: s.floats.map((x) => ({ ...x, id: f2(x.id) }))
2062
+ floats: s.floats.map((x) => ({ ...x, id: f2(x.id) })),
2063
+ // The declaration names items too; a value that isn't a list passes as it is (the solver reads it leniently), and an
2064
+ // entry the map doesn't name passes through.
2065
+ ...Array.isArray(s.givesWayLast) ? { givesWayLast: s.givesWayLast.map(f2) } : {}
2041
2066
  };
2042
2067
  }
2043
2068
  function mapPlace(p, f2) {