@n-uf/placement 26.11.22 → 26.11.24

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 CHANGED
@@ -3,6 +3,21 @@
3
3
  Versions are calendar versions, `YY.M.R` (year, month of the release, counter within the month), shared with
4
4
  `@n-uf/motion`: both packages carry the same version, and a release bumps both.
5
5
 
6
+ ## 26.11.24
7
+
8
+ - `@n-uf/placement/scene`, **fixed:** `columnRoom` counts a side toolbar bar. A left or right bar that lays out an item
9
+ never folds (unless it gives way), so its width (and the gutter after it, when it lies inside the inset) comes off the room before the
10
+ column's minimum is tested, and the `no-column-room` note's `width` is the room left after it. Anchors and rails
11
+ still don't count (they fold into the rail), nor do empty or all-closed bars. Layouts don't change. New
12
+ **`isSideBar(scene, edge)`** (a side toolbar bar, by its kinds; `isOutsideSideBar` is it with `outsideInset`).
13
+
14
+ ## 26.11.23
15
+
16
+ - `@n-uf/placement/scene`, **fixed:** a side bar outside the inset counts for the side's order only while it lays out
17
+ an item. An empty or all-closed side bar draws as nothing, so the layout is the one without it: the rail stays at
18
+ the window's side inside the inset (it used to land flush at the window edge, as if the bar were there). An empty
19
+ top or bottom bar outside the inset keeps nothing from the inset either.
20
+
6
21
  ## 26.11.22
7
22
 
8
23
  - `@n-uf/placement/scene`, **fixed:** `isOutsideSideBar` counts an edge as a side bar only when its side has a column
package/README.md CHANGED
@@ -883,7 +883,9 @@ none lays out as before.
883
883
  in a side bar. With nothing docked, the content is the whole stage.
884
884
  - **`layout.columnRoom`** and the note **`no-column-room`** (`{ width, need }`): with `contentMin` and a dynamic column,
885
885
  whether one column at its minimum fits beside the content's minimum. Anchors and rails don't count: every column, an
886
- anchor included, can fold into its rail. A docked column counts whether or not its side has a rail. Before any column
886
+ anchor included, can fold into its rail. A side toolbar bar that lays out an item does count: it never folds (unless it gives way), so its
887
+ width (and the gutter after it, when it lies inside the inset) comes off the room before the column's minimum is
888
+ tested, and the note's `width` is the room left after it; an empty or all-closed bar counts for nothing. A docked column counts whether or not its side has a rail. Before any column
887
889
  holds an item, the `Scene.columns` template answers, with the larger of its `cross.min` and the least width the items
888
890
  it takes need, so docking a panel doesn't flip the answer. It answers as if the one column were open: under
889
891
  `insetWhen: "docked"` with nothing docked it counts the inset that column would bring, and a column folded whole by hand
@@ -896,8 +898,9 @@ none lays out as before.
896
898
  - **The order of a side's outer edges.** A side's rail is its outermost *panel* edge. With a side bar, from the window's
897
899
  edge inward a side lies: its toolbar bars with `outsideInset`, the rail, its static column edges with `outsideInset`
898
900
  (anchors), then the inset, then the columns. The kinds tell them apart, with no new option: a side bar takes something
899
- and nothing the side's columns take (`Scene.columns[side].accepts`), an anchor takes nothing; `isOutsideSideBar(scene,
900
- edge)` says whether an edge is a side bar (only on a side that has a column template or a rail). On a side with no side
901
+ and nothing the side's columns or rail take (`Scene.columns[side].accepts`, `Scene.rails[side].accepts`), an anchor takes nothing; `isSideBar(scene, edge)`
902
+ says whether an edge is a side toolbar bar (only on a side that has a column template or a rail), and
903
+ `isOutsideSideBar(scene, edge)` whether it is one with `outsideInset`. On a side with no side
901
904
  bar the rail stays inside the inset, as before. With no rail shown, the `rail:` strip lies past the side's bars too.
902
905
  - **Static edges keep their place.** A new column (a `column:` or `rail:` target, `moveTo` with a column or rail place,
903
906
  `dockHome`) goes no further out than just inside the static edges that lie outer to the side's dynamic columns, so a
@@ -23,7 +23,10 @@ var axisOf = (side) => side === "left" || side === "right" ? "column" : "row";
23
23
  var zoneOf = (item) => item?.align === "center" || item?.align === "end" ? item.align : "start";
24
24
  var formsOf = (item, axis) => item.forms[axis] ?? [];
25
25
  function isOutsideSideBar(scene, e) {
26
- if (e.side !== "left" && e.side !== "right" || e.outsideInset !== true || e.column === true || e.accepts.length === 0) return false;
26
+ return e.outsideInset === true && isSideBar(scene, e);
27
+ }
28
+ function isSideBar(scene, e) {
29
+ if (e.side !== "left" && e.side !== "right" || e.column === true || e.accepts.length === 0) return false;
27
30
  const template = scene.columns?.[e.side];
28
31
  const rail = scene.rails?.[e.side];
29
32
  if (!template && !rail) return false;
@@ -471,7 +474,8 @@ function solve(given, options = {}) {
471
474
  });
472
475
  const colMins = open2.length > 0 ? open2 : templates;
473
476
  if (cmin !== void 0 && colMins.length > 0) {
474
- const width = area3.width - (scene.insetWhen === "docked" && !docked ? px(scene.inset?.left) + px(scene.inset?.right) : 0);
477
+ const bars = cols.filter((c) => c.width > 0 && !c.dyn && isSideBar(scene, c.edge)).reduce((s, c) => s + c.width + (c.edge.outsideInset === true ? 0 : gutter), 0);
478
+ const width = area3.width - bars - (scene.insetWhen === "docked" && !docked ? px(scene.inset?.left) + px(scene.inset?.right) : 0);
475
479
  const need = cmin + Math.min(...colMins) + gutter;
476
480
  columnRoom = width >= need - EPS;
477
481
  if (!columnRoom) notes.push({ code: "no-column-room", width, need });
@@ -484,7 +488,7 @@ function solve(given, options = {}) {
484
488
  let x0 = area3.x;
485
489
  let x1 = area3.x + area3.width;
486
490
  for (const side of ["left", "right"]) {
487
- const outsideSideBar = (c) => isOutsideSideBar(scene, c.edge) && !g.railed(c) && !g.riding(c);
491
+ const outsideSideBar = (c) => c.width > 0 && isOutsideSideBar(scene, c.edge) && !g.railed(c) && !g.riding(c);
488
492
  const all = cols.filter((c) => c.side === side);
489
493
  const mine = [...all.filter(outsideSideBar), ...all.filter((c) => !outsideSideBar(c))];
490
494
  const railed = mine.filter((c) => g.railed(c));
@@ -1637,6 +1641,7 @@ export {
1637
1641
  DEFAULT_HIT_BAND,
1638
1642
  DEFAULT_FLOAT_SIZE,
1639
1643
  isOutsideSideBar,
1644
+ isSideBar,
1640
1645
  floatOrientOf,
1641
1646
  floatSizeOf,
1642
1647
  solve,
@@ -1661,4 +1666,4 @@ export {
1661
1666
  refusals,
1662
1667
  stops
1663
1668
  };
1664
- //# sourceMappingURL=chunk-4DEXHBXT.js.map
1669
+ //# sourceMappingURL=chunk-XUC5BU4N.js.map