@n-uf/placement 26.11.32 → 26.11.34

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,8 +3,45 @@
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.32
6
+ ## 26.11.34
7
+
8
+ - `./scene`, **over an unarmed strip** (docs and a property test, no behavior change). A kit reported that at 700 px
9
+ with a flush 200 px card window, x 0–4 showed the rail's `no-room` refusal and x 5–10 showed nothing. The library
10
+ doesn't reproduce it: with those numbers (Annotations lifted, the left column folded into its rail), x 0–9 is the
11
+ refusal and x 10 on the new-column line, and across widths 560–1400, both hit bands, both window shapes and every
12
+ item, no refusal lies under an armable strip and no edge point is a hole. Nothing shown over a strip that hasn't armed
13
+ is the pre-arm state: the README's host contract now says a host draws the strip's highlight from the intent frame's
14
+ `arming`, and that a refusal never lies under an armable strip (the new property test). The README's paragraph on the
15
+ new outermost column's line inside a strip now matches its band rule.
16
+ - `./scene/cases`, **`resolvePlace` aims outside the dragged item's own rect** whenever a point there reaches the
17
+ target, as a person aims; a drag intent's home gate then never holds the aim. `AimArea.own` (additive) is that rect
18
+ (a held float's too); without it, the list's `home` target's hit. The reference host passes it.
19
+ - `./scene/cases`, **P9-to-the-other-rail shows both rails in either window.** At 600 px window B's left column (200 px
20
+ card, flush, 32 px rail, `contentMin` 320: 552 px) still fits, so Pages stayed open. The row's width is now derived
21
+ from the windows (the least width at which A's or B's left column no longer fits, less a step: 540 px), so both rails
22
+ show on a host at either window's numbers; a test plays it at both.
23
+ - `./scene`, fixed: **with card halves (`hitBand: "middle"`) and a rail drop strip, the new outermost column was
24
+ missing.** Moved inside the strip, the line for `column:<side>:0` was cut again by every other target, and a column's
25
+ card halves cover its whole width, so nothing was left: neither `targets()` nor `stops()` offered it. The line now keeps
26
+ the band it owns, as without a strip (it beats the inner column it would push, card halves included); only home, a
27
+ blocked rect and the other column lines take from it, and the inner columns' gaps and refusals on its side stop short
28
+ of it. With default bands, the gap between two panels at the side's edge now also gives the line its band.
29
+ - `./scene/cases`, **rows that mean a new outermost column aim by place.** P6-new-outer-column-from-outside (now
30
+ reached from the content, resting on the float first) and P6-left-outer-edge aim at `column:<side>:0` with
31
+ `resolvePlace` instead of 11 px from the window's edge, so they hold with a rail drop strip (a UI kit's panel
32
+ `railDrop`) as without. The 11 px pixel check is its own row, **P6-outer-line-at-11-px**, with its precondition:
33
+ `requires: { railDrop: "scene" }` (new, additive), so a host that lays its own strips skips it.
34
+
35
+ ## 26.11.33
36
+
37
+ - `./scene`, fixed: **a float stored taller than the clear stage was drawn over the bars.** `solve` sized a float to the
38
+ floats' region (the stage less its left and right inset), so one stored at the body's height lay over the top and
39
+ bottom bars by their height. Its size is now clamped to the room that region leaves clear of the bars and chrome
40
+ across it, along each axis, never under its floor (`floatMin`, else its form's minimums); only a floor larger than
41
+ that room keeps the floor and covers (`float-covers`). It is the one clamp `fitResize` lays floats with, so a resize
42
+ still previews its commit. A stored oversize float is drawn clear on the next `solve`; `readScene` is unchanged.
7
43
 
44
+ ## 26.11.32
8
45
  - `./scene/cases`, **`requires.intent`** (additive) and **row R4b-leaving-the-band**: a row that checks what a drag
9
46
  intent adds to the pick at a point names `requires: { intent: true }`, and a host without one (the in-memory host)
10
47
  skips it. R4b leaves a shown gap from inside its hit: just past the hit the intent's band holds it, past the band
package/README.md CHANGED
@@ -1210,9 +1210,10 @@ side's outermost column's start zone as a collapsed header ("the column drawn as
1210
1210
  in that column sets its width. The slot is that landing, so the preview is the drop. The strip
1211
1211
  owns its rect: every other target and refusal of the drag gives it up, home's included (an item alone in its column
1212
1212
  reaches its side's rail from its home), and an empty column's own drop strip moves just inside it, as does the line for a
1213
- new outermost column on an occupied side (flush, the strip owns the window's edge): it is laid after the strip, so it
1214
- owns what the strip and the other targets and refusals leave, the column's own gaps and inner lines keeping theirs; it
1215
- is one of `stops`, so a host's "Move to ›" reaches it. Before the
1213
+ new outermost column on an occupied side (flush, the strip owns the window's edge): it keeps the band it owns, as with
1214
+ no strip (it beats the inner column it would push, card halves included), giving way only to home, a blocked rect and
1215
+ the other column lines, and the inner columns' gaps and refusals on its side stop short of it; it is one of `stops`,
1216
+ so a host's "Move to ›" reaches it. Before the
1216
1217
  strip arms, a drop there is the float's. A kind with no policy keeps its targets exactly as before; tuning one kind
1217
1218
  never changes another. The policy's fields, each default with its reason:
1218
1219
 
@@ -1226,6 +1227,11 @@ never changes another. The policy's fields, each default with its reason:
1226
1227
  The time and the keys are the drag intent's (`@n-uf/motion/drag`): `railArmDwellMs` (200 ms) arms a target marked
1227
1228
  `arm: "dwell"` (spring-loading), and `modifiers` let Shift float anywhere and ⌘/Ctrl collapse into the nearest rail (Alt stays free: it unfreezes a frozen layout).
1228
1229
 
1230
+ **Over an unarmed strip.** While the pointer is in a strip that hasn't armed yet, the intent shows no target there (a
1231
+ drop is the float's), and its frame's `arming` names the strip being dwelt on. The host draws the strip's pre-arm
1232
+ highlight from `arming` (and the armed growth from the shown target), so that stretch never looks dead. A refusal never
1233
+ lies under an armable strip: the strip owns its rect, and every refusal gives it up (a property test holds it).
1234
+
1229
1235
  A gap, column or rail target exists only where the drop keeps the whole scene sound: it adds no `overflow` or
1230
1236
  `too-wide` note to any edge, changes no fixed item's form, squeezes none under its `main.min` anywhere (a between bar
1231
1237
  under a new column included), and lands its slot on no chrome. The rule compares notes: in an edge that already
@@ -1333,11 +1339,15 @@ a gesture the row doesn't have fails the row. `createSceneHost()` is the referen
1333
1339
  session that lifts past 4 px, asks `targets` for every target, takes the one under the pointer by its pick rule,
1334
1340
  draws the preview from its `after.layout` and commits `after.scene` on release, every solve carrying the layout before
1335
1341
  it as `previous`. An integrating app's host does the same with its own pointer; `resolvePlace(targets, place, item, { stage, content
1336
- }, pick)` turns a `place` into a point that reaches the target. Every row
1342
+ }, pick)` turns a `place` into a point that reaches the target. It aims outside the dragged item's own rect whenever a
1343
+ point there reaches the target, as a person aims, so a drag intent's home gate never holds the aim: `AimArea.own` is that
1344
+ rect (a held float's too), and without it the list's `home` target's hit is used; the reference host passes it. Every row
1337
1345
  passes on the in-memory host except its DOM checks, which it skips, and the rows with `lacks`, which fail on it until the
1338
1346
  library rule lands. A row with `requires: { intent: true }` checks what a drag intent adds to the pick at a point (a
1339
- shown gap held a band's width past its hit): a host without one, the in-memory host among them, skips it. `CASE_GROUPS`
1340
- lists the groups.
1347
+ shown gap held a band's width past its hit): a host without one, the in-memory host among them, skips it. A row with
1348
+ `requires: { railDrop: "scene" }` aims at a pixel whose meaning depends on the scene's own rail drop strips: a host that
1349
+ lays its own skips it. A row that only means a place aims by place (`resolvePlace`), so it holds either way.
1350
+ `CASE_GROUPS` lists the groups.
1341
1351
 
1342
1352
  The rows run on any host, a page's included: the reference host and a page's host play one list of steps and agree on every
1343
1353
  row, the rows that were disputed between them now being host-independent. Two pure helpers keep a page's host equal to the
@@ -529,6 +529,25 @@ function floatFloor(item, form, orient2, size) {
529
529
  height: item.floatMin ? px(item.floatMin.height) : Math.min(size.height, px(row ? form?.cross.min : form?.main.min))
530
530
  };
531
531
  }
532
+ function clearSize(region, avoid) {
533
+ const span = (axis) => {
534
+ const lo = axis === "y" ? region.y : region.x;
535
+ const hi = lo + (axis === "y" ? region.height : region.width);
536
+ const mid = (lo + hi) / 2;
537
+ let a = lo;
538
+ let b = hi;
539
+ for (const r of avoid) {
540
+ const whole = axis === "y" ? r.x <= region.x + EPS && r.x + r.width >= region.x + region.width - EPS : r.y <= region.y + EPS && r.y + r.height >= region.y + region.height - EPS;
541
+ const s = axis === "y" ? r.y : r.x;
542
+ const e = s + (axis === "y" ? r.height : r.width);
543
+ if (!whole || e <= lo || s >= hi) continue;
544
+ if (s + e <= 2 * mid) a = Math.max(a, e);
545
+ else b = Math.min(b, s);
546
+ }
547
+ return Math.max(0, b - a);
548
+ };
549
+ return { width: span("x"), height: span("y") };
550
+ }
532
551
  function placeFloat(item, f, region, avoid, content, stage) {
533
552
  const shape = floatShape(item, f);
534
553
  const from = shape.form;
@@ -536,9 +555,10 @@ function placeFloat(item, f, region, avoid, content, stage) {
536
555
  const form = formsOf(item, fo)[from];
537
556
  const floor = floatFloor(item, form, fo, shape);
538
557
  const cap = { width: Number.isFinite(item.floatMax?.width) ? item.floatMax.width : Infinity, height: Number.isFinite(item.floatMax?.height) ? item.floatMax.height : Infinity };
539
- const w = Math.max(floor.width, Math.min(shape.width, region.width, cap.width));
558
+ const clear = clearSize(region, avoid);
559
+ const w = Math.max(floor.width, Math.min(shape.width, clear.width, cap.width));
540
560
  const folded = form?.kind === "header";
541
- const h = folded ? shape.height : Math.max(floor.height, Math.min(shape.height, region.height, cap.height));
561
+ const h = folded ? shape.height : Math.max(floor.height, Math.min(shape.height, clear.height, cap.height));
542
562
  const want = f.anchor ? anchored(content, w, h, f.anchor) : rect(finite(f.rect.x, stage.x), finite(f.rect.y, stage.y), w, h);
543
563
  const fit0 = fitFloat(want, region, avoid);
544
564
  const fit = w > region.width + EPS ? { ...fit0, rect: rect(region.x, fit0.rect.y, w, fit0.rect.height) } : fit0;
@@ -2319,6 +2339,7 @@ function withRailStrips(c, targets2, refusals2) {
2319
2339
  const sides = new Set(strips.map((s) => s.side));
2320
2340
  const rects = strips.map((s) => s.rect);
2321
2341
  const out = [];
2342
+ const lines = [];
2322
2343
  for (const t of targets2) {
2323
2344
  if (t.place.kind === "rail" && sides.has(t.place.side)) continue;
2324
2345
  if (t.free || t.place.kind === "none") {
@@ -2331,9 +2352,10 @@ function withRailStrips(c, targets2, refusals2) {
2331
2352
  let moved = t.id.startsWith("strip:") || t.place.kind === "column" ? insideStrips(t.hit, strips) : null;
2332
2353
  let movedPieces = moved ? [moved] : [];
2333
2354
  if (moved && t.place.kind === "column") {
2334
- const others = [...targets2.filter((x) => x !== t && !x.free && x.place.kind !== "none" && !(x.place.kind === "rail" && sides.has(x.place.side))).flatMap((x) => x.hits ?? [x.hit]), ...refusals2.map((x) => x.hit)];
2355
+ const others = targets2.filter((x) => x !== t && (x.place.kind === "home" || x.place.kind === "column" || x.place.kind === "none" && !x.free)).flatMap((x) => x.hits ?? [x.hit]);
2335
2356
  movedPieces = outside([moved], others);
2336
2357
  moved = movedPieces.length ? largest2(movedPieces) : null;
2358
+ if (moved) lines.push({ side: t.place.side, pieces: movedPieces });
2337
2359
  }
2338
2360
  if (moved) out.push({ ...withoutHits(t), hit: moved, ...movedPieces.length > 1 ? { hits: movedPieces } : {} });
2339
2361
  continue;
@@ -2344,11 +2366,27 @@ function withRailStrips(c, targets2, refusals2) {
2344
2366
  }
2345
2367
  out.push({ ...withoutHits(t), hit: largest2(pieces), ...pieces.length > 1 ? { hits: pieces } : {} });
2346
2368
  }
2369
+ const columnSide = (edge) => {
2370
+ const e = c.scene.edges.find((x) => x.id === edge);
2371
+ return e?.column && (e.side === "left" || e.side === "right") ? e.side : null;
2372
+ };
2373
+ const lineCut = (edge) => lines.filter((l) => l.side === columnSide(edge)).flatMap((l) => l.pieces);
2374
+ for (let i = 0; i < out.length; i++) {
2375
+ const t = out[i];
2376
+ if (t.place.kind !== "gap") continue;
2377
+ const cut = lineCut(t.place.edge);
2378
+ if (!cut.length) continue;
2379
+ const was = t.hits ?? [t.hit];
2380
+ const pieces = outside(was, cut);
2381
+ if (sameRects(pieces, was)) continue;
2382
+ if (pieces.length === 0) out.splice(i--, 1);
2383
+ else out[i] = { ...withoutHits(t), hit: largest2(pieces), ...pieces.length > 1 ? { hits: pieces } : {} };
2384
+ }
2347
2385
  const refused = [];
2348
2386
  const railEdges = new Set([...sides].map((side) => virtualEdgeId("rail", side)));
2349
2387
  for (const r of refusals2) {
2350
2388
  if (railEdges.has(r.edge)) continue;
2351
- const pieces = outside([r.hit], rects);
2389
+ const pieces = outside([r.hit], [...rects, ...lineCut(r.edge)]);
2352
2390
  if (pieces.length) refused.push(pieces.length === 1 && sameRects(pieces, [r.hit]) ? r : { ...r, hit: largest2(pieces) });
2353
2391
  }
2354
2392
  const vertical = (r) => {
@@ -2634,4 +2672,4 @@ export {
2634
2672
  refusals,
2635
2673
  stops
2636
2674
  };
2637
- //# sourceMappingURL=chunk-COK4YNMF.js.map
2675
+ //# sourceMappingURL=chunk-VKB3UWKX.js.map