@n-uf/docking 26.12.11 → 26.12.12

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.
@@ -504,12 +504,23 @@ interface DockState {
504
504
  */
505
505
  readonly foldedColumnDrop?: "end";
506
506
  /**
507
- * `"one"`: a side has at most one column (`isSideColumn`). A drag offers a new-column line only on a side with no
508
- * column holding an item once the item is lifted; where the side has one, an item goes into it (by its gaps) or
509
- * nowhere on that side. A stored layout with two columns on a side is merged by `mergeSideColumns`, which a host calls
510
- * as it reads one. Absent: as before. A declaration, like `foldedColumnDrop`: never stored.
507
+ * The cap: the most columns (`isSideColumn`) a side may hold, as `sideColumnCap` reads it (every reader goes through
508
+ * it). A side never gains a column past its cap. The count is the columns the side would hold if the dragged item were
509
+ * dropped on another side: a folded column counts, a declared column edge counts, empty or not, and a column the lift
510
+ * empties does not, unless it is declared. A drag offers a new-column line on a side exactly when that count is below
511
+ * the cap; on a full side an item goes into one of its columns (by its gaps) or nowhere on that side, and a rail stop
512
+ * there is offered only where it puts the item into a column that exists. No change function makes a column past the
513
+ * cap from a state within it. The layout draws what the state holds: lowering the cap merges nothing, and a host that
514
+ * lowers it calls `mergeSideColumns`, as it does when it reads a stored layout. A host declares no more column edges on
515
+ * a side than its cap.
516
+ *
517
+ * Absent or `Infinity`: no cap, as before. A whole number of 1 or more: itself. Any other number: rounded down, never
518
+ * below 1 (a cap computed from a width: 0 reads as 1, 2.5 as 2). Not a number: 1. Nothing throws.
519
+ *
520
+ * `"one"`: 1. **Deprecated:** declare `1`; `"one"` is removed in the first breaking release after hosts declare a
521
+ * number. A declaration, like `foldedColumnDrop`: never stored.
511
522
  */
512
- readonly sideColumns?: "one";
523
+ readonly sideColumns?: number | "one";
513
524
  /**
514
525
  * `"nearest"`: a bar's zones (start, center, end) meet halfway between the landing rects either side of each boundary,
515
526
  * so the pointer picks the zone whose landing is nearest it. Absent: at thirds of the bar's length (each boundary moved
@@ -893,7 +904,8 @@ declare function fitResize(state: DockState, id: string, rect: Rect, moving: Res
893
904
  * shows in the rail (on a side with no declared rail, `DockState.rails`, its rail is its outermost column that takes the
894
905
  * kind, "the column drawn as a rail": the item docks at the end of its start zone as a collapsed header, folded by
895
906
  * hand, a rail tile once nothing there sets the width); `{ kind: "float", rect?, anchor? }` floats it. A dynamic column an item leaves empty is deleted
896
- * and its side's rings are closed up.
907
+ * and its side's rings are closed up. A column or rail place on a side that holds its cap of columns with the item
908
+ * lifted (`DockState.sideColumns`) changes nothing: no change makes a column past the cap.
897
909
  * - `homeFor(state, id, start)`: the place a start state gives the item, for `moveTo`.
898
910
  * - `floatAt(state, id, rect?, orient?)`: floats it on top at `rect` (its size becomes its `floatSizes` for the orient
899
911
  * it floats in); with no rect, at its `floatSizeOf` size anchored to the content's top-right corner: its `floatSizes`
@@ -950,12 +962,21 @@ interface FloatPlace {
950
962
  }
951
963
  type Place = DockPlace | ColumnPlace | RailPlace | FloatPlace;
952
964
  /**
953
- * Each side's columns (`isSideColumn`) merged into one, for `DockState.sideColumns: "one"`: the outermost column (by ring)
954
- * keeps its id and takes every other column's items after its own, in ring order; the others are deleted and the side's
955
- * rings closed up. A side with one column or none is unchanged; the same state comes back when nothing merges. A host
956
- * calls it as it reads a stored layout, so what it stores is what it shows and what a drag reads.
965
+ * Each side's columns (`isSideColumn`) past `max` merged into its `max`-th column (by ring), for the cap
966
+ * (`DockState.sideColumns`): the `max − 1` outermost stay as they are; the `max`-th keeps its id and its options (its
967
+ * `size` among them) and takes the inner columns' items after its own, by ring, each column's order kept; the others are
968
+ * deleted and the side's rings closed up. It goes by position only, never by use, so it gives the same result each time.
969
+ * Items move whole: no item's `used` or `kept` changes. A side with `max` columns or fewer is unchanged; the same state
970
+ * comes back when nothing merges.
971
+ *
972
+ * `max` is read as the cap is (`sideColumnCap`); left out, it is the cap the state declares, or 1 with none declared.
973
+ * With `max` 1 it merges each side into its outermost column. A host calls it as it reads a stored layout, so what it
974
+ * stores is what it shows and what a drag reads, and again when it lowers the cap: lowering it merges nothing by itself.
975
+ *
976
+ * The merged column is drawn as any column is: at its `size` where the user set one, else as wide as its widest open
977
+ * item asks (its stack's width), so with no `size` it can draw wider than it did before the merge.
957
978
  */
958
- declare function mergeSideColumns(state: DockState): DockState;
979
+ declare function mergeSideColumns(state: DockState, max?: number): DockState;
959
980
  /**
960
981
  * The state with the item out of every edge and every float (a dynamic column it leaves empty is deleted). The room it
961
982
  * held goes back to its stretch: the first placed item past it, away from its zone's own end (`DockItem.space`), takes
@@ -1001,7 +1022,8 @@ declare function setRailMode(state: DockState, side: "left" | "right", mode: Rai
1001
1022
  /**
1002
1023
  * The edge moved to the other side of its axis (left ⇄ right, top ⇄ bottom), as its side's outermost edge: ring 0, before
1003
1024
  * that side's other edges (whose rings close up behind it; the side it left closes up too). Its items, size and options
1004
- * go with it. Unchanged for an unknown edge, the side it is on, or a side across its axis. Like every change it does not
1025
+ * go with it. Unchanged for an unknown edge, the side it is on, or a side across its axis, and for an edge that would be
1026
+ * a column there (`isSideColumn`) on a side that holds its cap of columns already (`DockState.sideColumns`). Like every change it does not
1005
1027
  * tick the use clock: a host that moves an edge by hand calls `markUsed()` on its items afterwards, as a drop does.
1006
1028
  */
1007
1029
  declare function setSide(state: DockState, edgeId: string, side: Side): DockState;
@@ -1010,7 +1032,8 @@ declare function setSide(state: DockState, edgeId: string, side: Side): DockStat
1010
1032
  * position: its zone and place in the same edge (before the first item that followed it there and is still there), a
1011
1033
  * new column at its ring when its column is gone (a column under the same id that holds none of the start column's
1012
1034
  * items is another column), or its float rect (and anchor). Null when `start` places it nowhere
1013
- * or in an edge `state` no longer has that isn't a column. `moveTo(state, id, place)` puts it there.
1035
+ * or in an edge `state` no longer has that isn't a column. `moveTo(state, id, place)` puts it there; a new column on a
1036
+ * side at its cap (`DockState.sideColumns`) it refuses, so Dock then leaves the item where it is.
1014
1037
  */
1015
1038
  declare function homeFor(state: DockState, id: string, start: DockState): Place | null;
1016
1039
  /**
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-ITlooERH.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-ITlooERH.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-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';
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';
@@ -74,6 +74,12 @@ declare function isOutsideSideBar(state: DockState, e: DockEdge): boolean;
74
74
  declare function isSideBar(state: DockState, e: DockEdge): boolean;
75
75
  /** A left or right column: a side edge that takes something, not a compact rail and not a toolbar bar (`isSideBar`). */
76
76
  declare const isSideColumn: (state: DockState, e: DockEdge) => boolean;
77
+ /**
78
+ * The most columns a side may hold (`DockState.sideColumns`), the one reading every reader goes through: the target
79
+ * rule, `mergeSideColumns`'s default and a host. `Infinity` for no cap (absent or `Infinity`); `"one"`: 1; a whole number
80
+ * of 1 or more: itself; any other number rounded down, never below 1; not a number: 1. Never throws.
81
+ */
82
+ declare function sideColumnCap(state: Pick<DockState, "sideColumns">): number;
77
83
  /**
78
84
  * The orient a float of `item` takes when it names none: its `floatOrient`, else the axis of its first form (the first
79
85
  * of `forms.row` / `forms.column` it declares with any form), else column.
@@ -371,4 +377,4 @@ declare function stops(state: DockState, dragged: string, options?: DockDropOpti
371
377
  /** 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). */
372
378
  declare const SPOT_PITCH = 40;
373
379
 
374
- export { AnchoredKeepClear, type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRailLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, KeepClear, Kind, Orient, RailMode, SPOT_PITCH, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, dividers, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isAnchoredKeepClear, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railDrawn, railModeOf, refusalTargets, refusals, reservedRect, resetBetween, resetLengths, resizeBetween, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
380
+ export { AnchoredKeepClear, type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRailLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, KeepClear, Kind, Orient, RailMode, SPOT_PITCH, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, dividers, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isAnchoredKeepClear, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railDrawn, railModeOf, refusalTargets, refusals, reservedRect, resetBetween, resetLengths, resizeBetween, sideColumnCap, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ import {
57
57
  resizeFloat,
58
58
  setRailMode,
59
59
  setSide,
60
+ sideColumnCap,
60
61
  solve,
61
62
  stops,
62
63
  storeDockState,
@@ -66,7 +67,7 @@ import {
66
67
  zoneIn,
67
68
  zoneTakes,
68
69
  zonesTaking
69
- } from "./chunk-367B5WJT.js";
70
+ } from "./chunk-NYMM2UDJ.js";
70
71
  export {
71
72
  DEFAULT_FLOAT_SIZE,
72
73
  DEFAULT_HIT_BAND,
@@ -126,6 +127,7 @@ export {
126
127
  resizeFloat,
127
128
  setRailMode,
128
129
  setSide,
130
+ sideColumnCap,
129
131
  solve,
130
132
  stops,
131
133
  storeDockState,
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-ITlooERH.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-CH_6THw0.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-367B5WJT.js";
21
+ } from "./chunk-NYMM2UDJ.js";
22
22
 
23
23
  // src/testing/rows-docking.ts
24
24
  import { rect as r } from "@n-uf/placement";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n-uf/docking",
3
- "version": "26.12.11",
3
+ "version": "26.12.12",
4
4
  "description": "Where panels and toolbars dock: a window's bars, rails, columns, items and floats solved into a layout, with the drop places, refusals and lanes of every drag. Pure state in, rects out. No DOM, no framework, no motion.",
5
5
  "keywords": [
6
6
  "docking",
@@ -47,10 +47,10 @@
47
47
  "LICENSE"
48
48
  ],
49
49
  "dependencies": {
50
- "@n-uf/placement": "26.12.11"
50
+ "@n-uf/placement": "26.12.12"
51
51
  },
52
52
  "peerDependencies": {
53
- "@n-uf/motion": "^26.12.11"
53
+ "@n-uf/motion": "^26.12.12"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@n-uf/motion": {
@@ -62,7 +62,7 @@
62
62
  "tsup": "^8.5.1",
63
63
  "typescript": "^6.0.3",
64
64
  "vitest": "^4.1.12",
65
- "@n-uf/motion": "26.12.11"
65
+ "@n-uf/motion": "26.12.12"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsup && node ./scripts/check-dist.mjs",