@n-uf/placement 26.11.39 → 26.11.40

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,18 @@
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.40
7
+
8
+ - `./scene`, **a drop names a zone only where the edge offers a choice** (behavior change). A gap drop, a strip, or
9
+ `moveTo` with `zone` sets the item's `align` only when more than one zone of that edge takes its kind (`namesZone`,
10
+ new). On a one-zone edge, such as a rail that takes groups at its start only, the item docks in that zone and keeps
11
+ its own `align`. So a group from a bar's end zone, dropped on such a rail while it is drawn and lent back to the bar
12
+ through `showIn` once the rail is hidden, lies in the bar's end zone again, not its start. A rail whose zones all
13
+ take the kind (no `zoneAccepts`) still offers the choice, and a drop on it sets the zone; a host that wants its rail
14
+ to keep the groups' own zones declares `zoneAccepts: { start: [kind] }` on it. That declaration also changes the
15
+ rail's targets: its center and end gaps for that kind go, and those thirds give `not-accepted` refusals instead.
16
+ Layouts, targets and refusals are otherwise as before; only stored `align` after a drop into a one-zone edge changes.
17
+
6
18
  ## 26.11.39
7
19
 
8
20
  - `./scene/cases`, **conformance row C17 requires the scene's own rail drop.** C17 now carries
package/README.md CHANGED
@@ -876,7 +876,13 @@ least and `cross.max` at most; `resize` sets it.
876
876
  edge it lies in. It lies in that zone where its edge takes its kind there (`Edge.zoneAccepts`), else in the first zone
877
877
  that does (`zoneIn`, one rule for every edge and for the items a hidden edge lends through `showIn`); its stored
878
878
  `align` stays as it was, so it is back in its own zone on an edge that takes it there. A move sets `align` only when the
879
- drop names a zone: a gap in a zone, a zone's slot, `moveTo` with `zone`. A move whose zone is implied keeps it: a rail,
879
+ drop names a zone: a gap in a zone, a zone's slot, `moveTo` with `zone`, on an edge that offers a choice (`namesZone`:
880
+ more than one of its zones takes the kind). On a one-zone edge, such as a rail that takes groups at its start only, the
881
+ zone a drop gives is no choice: the item docks there and keeps its own, so a group from a bar's end zone moved onto
882
+ that rail goes back to the bar's end zone when the rail is hidden and lends it back (`showIn`), or when it is moved
883
+ there with no zone. An edge with no `zoneAccepts` takes every kind in every zone, so it offers the choice; declaring
884
+ `zoneAccepts: { start: [kind] }` makes it a one-zone edge for that kind, which also removes its center and end gaps for
885
+ the kind and refuses those thirds (`not-accepted`). A move whose zone is implied keeps it: a rail,
880
886
  a new column, home and `dockHome` (which takes the start scene's `align` back), `moveTo` with no `zone`. Give-way is as
881
887
  without zones (it sums the minimum sizes); when room is spare, start items pack from the start, end items from the end
882
888
  (before the » entry) and center items sit on the edge's middle, moved only as far as they must to stay between the
@@ -64,6 +64,7 @@ function zoneIn(edge, item) {
64
64
  if (item.fixed || zoneTakes(edge, own, item.kind)) return own;
65
65
  return zonesTaking(edge, item.kind)[0] ?? own;
66
66
  }
67
+ var namesZone = (edge, kind) => zonesTaking(edge, kind).length > 1;
67
68
  var showInOf = (scene, e) => {
68
69
  if (e.hidden !== true || e.showIn === void 0) return void 0;
69
70
  const to = scene.edges.find((x) => x.id === e.showIn);
@@ -1413,7 +1414,7 @@ function moveAmong(scene, id, place, others) {
1413
1414
  const zone = place.zone ?? zoneIn(edge, item);
1414
1415
  if (!zoneTakes(edge, zone, item.kind)) return scene;
1415
1416
  const { align: _drop, ...rest } = item;
1416
- const moved = place.zone === void 0 ? item : zone === "start" ? rest : { ...rest, align: zone };
1417
+ const moved = place.zone === void 0 || !namesZone(edge, item.kind) ? item : zone === "start" ? rest : { ...rest, align: zone };
1417
1418
  const lifted = withItem(lift(scene, id), moved);
1418
1419
  const target = lifted.edges.find((e) => e.id === place.edge);
1419
1420
  if (!target) return scene;
@@ -3000,7 +3001,9 @@ function generate(scene, dragged, options) {
3000
3001
  after: (point, grab) => {
3001
3002
  const a = t.after(point, grab);
3002
3003
  if (a.scene === shown) return { scene, layout: showsIn ? solve(scene, prev) : a.layout };
3003
- const back = withHiddenOf(scene, a.scene, lent, dragged, t.place.kind === "gap", rezoned);
3004
+ const on = t.place.kind === "gap" ? shown.edges.find((e) => t.place.kind === "gap" && e.id === t.place.edge) : void 0;
3005
+ const named = !!on && namesZone(on, scene.items[dragged].kind);
3006
+ const back = withHiddenOf(scene, a.scene, lent, dragged, named, rezoned);
3004
3007
  const restored = showsIn ? prune(back) : back;
3005
3008
  const ringOf = new Map(a.scene.edges.map((e) => [e.id, e.ring]));
3006
3009
  const renumbered = restored.edges.some((e) => e.hidden !== true && ringOf.get(e.id) !== e.ring);
@@ -3146,6 +3149,7 @@ export {
3146
3149
  edgeTakes,
3147
3150
  railModeOf,
3148
3151
  zoneIn,
3152
+ namesZone,
3149
3153
  isOutsideSideBar,
3150
3154
  isSideBar,
3151
3155
  floatOrientOf,
@@ -3180,4 +3184,4 @@ export {
3180
3184
  refusalTargets,
3181
3185
  stops
3182
3186
  };
3183
- //# sourceMappingURL=chunk-US2TGS3W.js.map
3187
+ //# sourceMappingURL=chunk-PADZWK3H.js.map