@n-uf/placement 26.11.43 → 26.11.44

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,22 @@
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.44
7
+
8
+ - `./scene`, **the content gives way to chrome** (additive). `contentMin.chromeWidth` is a lower content floor for
9
+ chrome: compact rails and side toolbar bars may narrow the content down to it while the panel columns keep their
10
+ width and move aside; below it a column shrinks, then folds, as before. A compact rail or a side toolbar bar is
11
+ chrome only on a side with a column template or a declared rail (`isSideBar`), so on a side with neither it gets no
12
+ floor benefit. A floor of 0 or less lets chrome take all the content. The columns alone still leave
13
+ `contentMin.width`. Chrome within that allowance is quiet: content it narrows between the two floors carries no
14
+ `content-narrow`, and `columnRoom` stays true (no `no-column-room`), so a toolbar rail never flips a host to its
15
+ narrow layout. `content-narrow` fires when the columns' own need takes the content under `contentMin.width`, or once
16
+ it is under the floor; its `min` is `contentMin.width` less what chrome takes within the allowance (a host that says
17
+ "needs at least …" reads `contentMin.width`, not the note's `min`). Width only: top
18
+ and bottom bars keep giving way by `contentMin.height`. A floor above
19
+ `contentMin.width`, or one that isn't a number, changes nothing. Scenes without it lay out and target exactly as
20
+ before.
21
+
6
22
  ## 26.11.43
7
23
 
8
24
  - `./scene`, **`Target.roomHit`** (additive): a target that opens its room and changes an edge's thickness around the
package/README.md CHANGED
@@ -1004,6 +1004,17 @@ first column. A column folds:
1004
1004
  is oldest first, the outer first, the left first (`column-shrunk`, `column-folded`, `kept-folded`). Under `previous`,
1005
1005
  what gave way stays so while the content still fits, room that comes back unfolds in the reverse order, and ages alone
1006
1006
  change nothing. Still too narrow: `content-narrow`; under `contentMin.height` (overlay bars counted): `content-short`.
1007
+ With `contentMin.chromeWidth`, a lower floor for chrome, the content gives way first: compact rails and side toolbar
1008
+ bars may take it down to that floor while the columns keep their width and move aside, and only below it does a
1009
+ column shrink, then fold. A compact rail or a side toolbar bar is chrome only where its side has a column template or
1010
+ a declared rail to tell it from a panel column (`isSideBar`), so on a side with neither it gets no floor benefit. A
1011
+ floor of 0 or less lets chrome take all the content. The columns alone still leave `contentMin.width`, so a toolbar
1012
+ rail added at a window's edge narrows the content and leaves the panel column as it was. Chrome within that allowance is quiet: no `content-narrow`,
1013
+ and `columnRoom` stays true, so a toolbar rail never flips a host to its narrow layout. `content-narrow` fires when
1014
+ the columns' own need takes the content under `contentMin.width`, or once it is under the floor; its `min` is
1015
+ `contentMin.width` less what chrome takes within the allowance, so a host that says "needs at least …" reads
1016
+ `contentMin.width`, not the note's `min`. Bars keep giving way by `contentMin.height` (the
1017
+ floor is width only).
1007
1018
  - by hand: when every member is folded by hand (`from` over 0) it goes to the rail; with `handFold: "ride"` a one-member
1008
1019
  column instead rides as a title bar over the side's first open column, at that column's width, taking no width
1009
1020
  (`rides`), while the side has an open column.
@@ -854,7 +854,7 @@ function insetReach(area2, f) {
854
854
  function contentNotes(d, content) {
855
855
  const { scene, notes, previous } = d;
856
856
  if (scene.contentMin) {
857
- const minW = px(scene.contentMin.width);
857
+ const minW = px(scene.contentMin.width) - (d.chromeAllowance ?? 0);
858
858
  const minH = px(scene.contentMin.height);
859
859
  if (content.width < minW - EPS) notes.push({ code: "content-narrow", width: content.width, min: minW });
860
860
  const bars = d.order.filter((e) => e.mode === "overlay" && !isSide(e)).reduce((s, e) => s + (d.edges[e.id]?.cross ?? 0), 0);
@@ -868,6 +868,7 @@ function contentNotes(d, content) {
868
868
  }
869
869
 
870
870
  // src/scene/solve/columns.ts
871
+ var isChrome = (scene, c) => !c.dyn && isSideBar(scene, c.edge);
871
872
  function columnsOf(d, sideEdges, area2, tall) {
872
873
  const { scene } = d;
873
874
  return sideEdges.map((edge) => {
@@ -897,6 +898,10 @@ function giveWay(d, cols, area2, gutter) {
897
898
  const { scene, previous, fresh, opened } = d;
898
899
  const ride = scene.handFold === "ride";
899
900
  const cmin = scene.contentMin ? px(scene.contentMin.width) : void 0;
901
+ const chromeWidth = scene.contentMin?.chromeWidth;
902
+ const floor = cmin !== void 0 && typeof chromeWidth === "number" && Number.isFinite(chromeWidth) ? Math.min(cmin, px(chromeWidth)) : void 0;
903
+ const chrome = floor === void 0 ? 0 : cols.filter((c) => isChrome(scene, c) && c.width > 0).reduce((s, c) => s + c.width + (c.edge.outsideInset === true ? 0 : gutter), 0);
904
+ if (floor !== void 0) d.chromeAllowance = Math.min(chrome, cmin - floor);
900
905
  const foldOrder = cols.filter((c) => c.dyn && !c.hand && c.width > 0).sort((a, b) => giveWayOrder(a, b) || (a.side === b.side ? 0 : a.side === "left" ? -1 : 1));
901
906
  const shrunkBefore = (previous?.notes ?? []).flatMap((n) => n.code === "column-shrunk" ? [n.edge] : []);
902
907
  const rankOf = (c) => shrunkBefore.includes(c.edge.id) ? shrunkBefore.indexOf(c.edge.id) : Infinity;
@@ -911,7 +916,7 @@ function giveWay(d, cols, area2, gutter) {
911
916
  let used = 0;
912
917
  for (const [c, w] of widths) used += w > 0 ? w + (c.edge.outsideInset === true ? 0 : gutter) : 0;
913
918
  for (const s of railSides) used += railW(s) + gutter;
914
- let excess = cmin === void 0 ? -Infinity : used + cmin - area2.width;
919
+ let excess = cmin === void 0 ? -Infinity : floor === void 0 ? used + cmin - area2.width : Math.max(used - chrome + cmin, used + floor) - area2.width;
915
920
  for (const c of shrinkOrder) {
916
921
  if (excess <= EPS) break;
917
922
  const w = widths.get(c);
@@ -970,7 +975,8 @@ function columnRoom(d, cols, area2, f) {
970
975
  });
971
976
  const colMins = open2.length > 0 ? open2 : templates;
972
977
  if (cmin === void 0 || colMins.length === 0) return;
973
- 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 : f.gutter), 0);
978
+ const allBars = cols.filter((c) => c.width > 0 && isChrome(scene, c)).reduce((s, c) => s + c.width + (c.edge.outsideInset === true ? 0 : f.gutter), 0);
979
+ const bars = d.chromeAllowance === void 0 ? allBars : allBars - Math.min(allBars, d.chromeAllowance);
974
980
  const width = area2.width - bars - (scene.insetWhen === "docked" && !f.docked ? px(scene.inset?.left) + px(scene.inset?.right) : 0);
975
981
  const need = cmin + Math.min(...colMins) + f.gutter;
976
982
  d.columnRoom = width >= need - EPS;
@@ -3251,4 +3257,4 @@ export {
3251
3257
  refusalTargets,
3252
3258
  stops
3253
3259
  };
3254
- //# sourceMappingURL=chunk-PO3ILUMO.js.map
3260
+ //# sourceMappingURL=chunk-32BGJAJA.js.map