@n-uf/placement 26.11.20 → 26.11.22

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,92 @@
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.22
7
+
8
+ - `@n-uf/placement/scene`, **fixed:** `isOutsideSideBar` counts an edge as a side bar only when its side has a column
9
+ template or a rail and the edge takes none of their kinds. On a side with neither, no edge is a bar, so a static
10
+ panel edge there keeps its ring order instead of being laid outermost.
11
+
12
+ - `@n-uf/placement/scene`, **fixed:** with no rail shown, the `rail:` strip lies where the rail lands: flush after
13
+ the side's outside toolbar bars, else at the window's side less the inset. It used to lie at the side's outermost
14
+ edge, so with an anchor at the window edge and an inset it sat in the inset gap, off the rail it makes.
15
+
16
+ - `@n-uf/placement/scene`, **fixed:** home covers the dragged item's whole own rect, and no strip is a sliver. An
17
+ empty bar's strip (or an empty edge's) keeps only what lies outside the item's own rect: the strip of the item's own
18
+ edge, which the item alone fills, means home there anyway, and what is left of a strip under 1 px has no target (the
19
+ item alone in a bar, lifted, could leave the bar's center third 0.67 px wide). The `rail:` strip (while no rail
20
+ shows) is cut clear of the item's own rect too. Across an item's own rect no point picks a target that moves it.
21
+ Affected: the outermost panel, when no rail shows, can no longer be dragged into its own side's rail (the strip lay
22
+ over its own place); folding it there stays a menu action, or use `fold`.
23
+
24
+ - `@n-uf/placement/scene`, **fixed:** the order of a side's outer edges. From the window's side inward: the side's
25
+ toolbar bars with `outsideInset`, the side's rail, its static column edges with `outsideInset` (anchors), the inset,
26
+ the columns. A side bar used to land after the rail when the side folded into it; now it stays at the window edge and
27
+ the rail lies inside it (the rail is the outermost *panel* edge). The kinds tell them apart, with no new option: a
28
+ side bar takes something and nothing the side's columns take (`Scene.columns[side].accepts`), an anchor takes
29
+ nothing (**`isOutsideSideBar`**). With no rail shown, the `rail:` strip lies past the side's bars too. On a side with
30
+ no side bar the rail stays inside the inset, as before.
31
+
32
+ - `@n-uf/placement/scene`, **floated group orient and size** (additive, one default changed): a new
33
+ **`SceneItem.floatOrient`** (`"row" | "column"`) picks the forms a float of it uses when the float names no `orient`;
34
+ its default, **`floatOrientOf(item)`**, is the axis of the first form the item declares, so a toolbar group declared
35
+ row first floats as a row (it used to float as a column). **`SceneTargetOptions.floatOrient`** overrides it for the
36
+ drag's float target. With no `floatSize`, a float takes its first form's natural size along that orient
37
+ (**`floatSizeOf`**), not 280 × 360; a form that grows (a panel's card) keeps `DEFAULT_FLOAT_SIZE`, so panels float as
38
+ before. **Changed:** a float with no `orient` of an item whose first declared forms are its row forms is drawn as a
39
+ row; give it `orient: "column"` (or `floatOrient: "column"`) to keep it vertical.
40
+
41
+ - `@n-uf/placement/scene`, **fixed:** `insetWhen: "docked"` counts only panel placements as docked: an open panel
42
+ column or a rail showing panels (an item whose first column form is `open`, `header` or `rail`). A toolbar group in a
43
+ side bar no longer brings the inset back, so with every panel closed the content keeps the whole stage.
44
+
45
+ - `@n-uf/placement/scene`, **`Edge.outsideInset` on top and bottom bars** (additive): a full bar with it lies at the
46
+ window's edge, full width, with the inset after it; the side edges run between such bars, an anchor through the inset
47
+ beside them. Without it nothing changes.
48
+
49
+ - `@n-uf/placement/scene`, **fixed:** static edges keep their place. A new column (a `column:` or `rail:` target,
50
+ `moveTo` with a column or rail place, `dockHome`) goes no further out than just inside the static edges outer to the
51
+ side's dynamic columns, so a bar or an anchor at the window edge is never pushed inward. Column and rail places count
52
+ rings as the side's edges lie (by ring, then by order, no ties), and `homeFor` gives a start column's ring that way.
53
+
54
+ ## 26.11.21
55
+
56
+ - `@n-uf/placement/stack` (and so every Scene edge), **Changed:** growing back under `previous` is exactly the reverse
57
+ of giving way, the » menu included. A fit now carries its give-way history, **`StackFit.steps`** (`StackStep { id,
58
+ from, to, batch? }`, in the order taken; new type `StackStep`), and the next fit carries it on: room coming back undoes
59
+ it from the last step (a batch into the menu comes out together, an item goes to the nearest earlier form that fits),
60
+ and the first step that can't be undone stops all growth. At every length the way back holds what the way down held,
61
+ ties broken by use included, whatever presses changed the ages since; an item made `kept` after its step no longer
62
+ jumps ahead when growing, it comes back in step order. A `previous` without `steps` (built by hand, or
63
+ by an older version) grows the old way. Affected: growing back under `previous`; about 700 of 3,000 seeded length
64
+ chains now hold items further down at some step than 26.11.20 did (it let menu items out early, took a fresh fit that
65
+ was a pure gain, and grew the newest used at growth time). Fits without `previous` are unchanged.
66
+
67
+ - `@n-uf/placement/scene`, **fixed:** `columnRoom` is answered as if the one column were open: under
68
+ `insetWhen: "docked"` with nothing docked it counts the inset that column would bring, and a column folded whole by
69
+ hand (and a template's floating items) counts at its open minimum, not as a rail. Layouts don't change; only
70
+ `columnRoom` and its `no-column-room` note do.
71
+
72
+ - `@n-uf/placement/scene`, give-way priority (additive): **`SceneItem.priority`** and **`Edge.priority`** (its items'
73
+ default). When an edge runs short its items step down their forms (row, wrap in a column, icons, then the edge's »
74
+ menu) lowest priority first, ties to the one used longest ago; it adds to every one of the item's forms' `rank`
75
+ (`./stack`), which is the mechanism. A kit reads each item's `form`, `formKind` and `inMenu`, and each edge's
76
+ `menu.items` in order: it draws, never decides. Without priorities nothing changes.
77
+
78
+ - `@n-uf/placement/scene`, local targets (**Changed**): a target wins only where its own hit is. Home is offered only
79
+ over the item's own place: its hit is the item's rect and half a band (`DEFAULT_HIT_BAND / 2`) each way along its
80
+ edge, across the edge's full hit thickness, kept clear of empty-edge strips. Home never removes a gap: every other gap
81
+ hit it would cover keeps at least 16 px of its slice (or all of it, when shorter), at home's end, or for one inside
82
+ the item's own stretch at its own line beside the item's centre, which home always keeps. The rest of its gaps'
83
+ slices goes only to the gap beside it in the same zone; with none there, that stretch has no target (the
84
+ pointer shows nothing, a release goes home), never a "back to its place" preview far away and never a gap of another
85
+ zone. Affected: drags of an item in a bar whose zone held only its own gap (that zone's whole third used to preview
86
+ home), and items whose own rect lay outside their gap's slice (home now always covers them).
87
+ - `@n-uf/placement/scene`, **`refusals(scene, dragged, options?)`** (additive): `{ id: "refuse:<edge>:<zone>", edge,
88
+ zone, hit, reason: "no-room" | "not-accepted" }[]`, the bar zones (by thirds) with no target and the side edges that
89
+ don't take the kind, each hit cut clear of every target's hit. A host shows "no room here" at the pointer over one,
90
+ with no slot anywhere; a release there commits nothing (the item goes home). New type `SceneRefusal`.
91
+
6
92
  ## 26.11.20
7
93
 
8
94
  - `@n-uf/placement/scene/cases`, an async runner (additive): **`runCaseAsync(row, host)`** and
package/README.md CHANGED
@@ -473,15 +473,20 @@ places them; it is not tied to `./panels` columns, and nothing in it is a word.
473
473
  item was added, or a panel opened: its `from` went down, so it starts over). Growing never re-ranks. When the stack got
474
474
  wider across (a group's stacked form returns to its row, a header folded to a rail icon by its `cross.min` to its
475
475
  header) the largest forms are tried again, as without `previous`. When the fit's `need` (the length its forms need) left
476
- more spare length than before (the length grew, a gap or size shrank), the fresh fit is taken only if it is a pure gain
477
- over the kept forms (no item further down, one further up); otherwise room comes back in the reverse of give-way order,
478
- and growth stops at the first item that can't grow. The item that gave way most recently goes first (highest rank,
479
- then `kept`, then the newest used, then the earlier in the stack): it goes back to the nearest larger form the stack
480
- fits with, even if that makes it shorter (the last item out of the menu takes the » entry along), and so on. When it
481
- fits no larger form nothing behind it grows, so a leading group never opens while a trailing one that gave way after
482
- it stays folded. Items in the menu still come out, alone or together when only their leaving together fits, but only
483
- when that keeps the order: an item leaves only with every menu item ahead of it, and only for a form no fewer steps
484
- down (from its `from`) than every item ahead of it that isn't in the menu. One px of room, or a badge losing a digit after a press, moves
476
+ more spare length than before (the length grew, a gap or size shrank), room comes back by undoing the give-way history
477
+ exactly in reverse. A fit carries that history as `StackFit.steps`, each step a `StackStep` (`{ id, from, to, batch? }`:
478
+ item `id` went from form `from` to form `to`), in the order taken, and the next fit with that `previous` carries it on.
479
+ Room coming back undoes the steps from the last one: an item goes back to the nearest earlier form the stack fits with
480
+ (the last item out of the menu takes the » entry along), a batch that went into the menu together (steps sharing a
481
+ `batch`) comes out together, and the first step that can't be undone stops all growth, so a leading group never opens
482
+ while a trailing one that gave way after it stays folded. At every length the way back holds what the way down held,
483
+ whatever presses changed the ages since, the menu included: under a priority (see Scenes), a higher-priority toolbar is
484
+ back at its form before a lower one leaves the menu. A `previous` without `steps` (built by hand, or by an older
485
+ version) grows the old way: a fresh fit that is a pure gain over the kept forms, else the item that gave way most
486
+ recently (highest rank, then `kept`, then the newest used, then the earlier in the stack) first, one at a time, menu
487
+ items out only while that keeps the order. A scene's `storeScene` doesn't store the steps, so the first growth after a
488
+ reload uses the old order; the steps are carried again from then on. One px of room, or a badge losing a digit after a
489
+ press, moves
485
490
  nothing. Results under `previous` depend on history: a shrink then a grow can end at another arrangement than a fresh
486
491
  solve, and more room never undoes a growth along successive solves. Growing back is meant for stacks of up to about
487
492
  50 items (60 small menu items take about 9 ms). An item whose form at the kept index is of another kind starts over;
@@ -810,6 +815,16 @@ no hit covers them. Their length shrinks toward `main.min` and grows with spare
810
815
  controls have `min` equal to `natural`. A stage too short for them overflows instead of folding them. A `kept` item with
811
816
  no smaller form never folds either: it reports `overflow` or `too-wide`.
812
817
 
818
+ **Give-way priority.** `SceneItem.priority` (number, default the edge's `Edge.priority`, else 0) says who steps down
819
+ first when an edge runs short. Items step down their forms in a fixed ladder, row, then wrap (in a column), then icons,
820
+ then the edge's » menu; the lowest priority steps first, and among equals the one used longest ago. Priority adds to every
821
+ one of the item's forms' `rank` (`./stack`), which is the mechanism, so a host may still rank single forms. Give the
822
+ controls that must stay out of the menu the highest priority, and a title bar's `Edge.priority` a lower one than the items
823
+ moved into it from other bars, so its own toolbars step down first. Room coming back brings items up in exactly the
824
+ reverse order, each to its remembered form, the » menu included. A host reads, and never decides: each item's layout has
825
+ `form` (the index into the forms of its axis), `formKind` and `inMenu`, and `edges[id].menu.items` lists the ids in the
826
+ » menu in order. Without priorities nothing changes.
827
+
813
828
  **Closed items** keep their place in their edge (or their float rect) but take no room and have no targets.
814
829
 
815
830
  **Toolbar shapes.** A group in a column draws its words in rows that wrap to the column: give it the column forms
@@ -857,29 +872,51 @@ none lays out as before.
857
872
 
858
873
  - **`Edge.outsideInset`**: an anchor edge (a left or right edge that takes nothing, such as a thumbnail strip) lies
859
874
  outside `Scene.inset` and the gutter: at the window's side, with the inset after it toward the content, and inside its
860
- side's rail when one shows. It runs into the inset above and below only where no reserved bar lies on that side.
875
+ side's rail when one shows. It runs into the inset above and below only where no reserved bar lies on that side. On a
876
+ full top or bottom bar it lies at the window's edge, full width, with the inset after it; the side edges then run
877
+ between such bars, and an anchor runs through the inset beside them. Without it nothing changes.
861
878
  - **`Edge.giveWay`**: a static left or right edge that gives way like a dynamic column. It shrinks toward its minimum,
862
879
  then folds whole into its side's rail, in give-way order with the columns (by its items' ages). It is never deleted.
863
880
  - **`Scene.insetWhen`** (`"always"`, the default, or `"docked"`): with `"docked"` the inset applies only while something is
864
- docked beside the content, that is an open column or a rail (an edge that takes something and holds an item that isn't
865
- closed). An anchor alone doesn't count; with nothing docked, the content is the whole stage.
881
+ docked beside the content, that is an open panel column or a rail showing panels (an item whose first column form is
882
+ `open`, `header` or `rail`, not closed). Only panels count: an anchor alone doesn't, and neither does a toolbar group
883
+ in a side bar. With nothing docked, the content is the whole stage.
866
884
  - **`layout.columnRoom`** and the note **`no-column-room`** (`{ width, need }`): with `contentMin` and a dynamic column,
867
885
  whether one column at its minimum fits beside the content's minimum. Anchors and rails don't count: every column, an
868
886
  anchor included, can fold into its rail. A docked column counts whether or not its side has a rail. Before any column
869
887
  holds an item, the `Scene.columns` template answers, with the larger of its `cross.min` and the least width the items
870
- it takes need, so docking a panel doesn't flip the answer. `false` comes with the
888
+ it takes need, so docking a panel doesn't flip the answer. It answers as if the one column were open: under
889
+ `insetWhen: "docked"` with nothing docked it counts the inset that column would bring, and a column folded whole by hand
890
+ (and a template's floating items) counts at its open minimum, not as a rail. `false` comes with the
871
891
  note, where `width` is the room the stage leaves and `need` the content's minimum plus that column and its gutter. A
872
892
  host shows its narrow fallback (one panel over the content) while it is `false`. An exhaustive `switch` over
873
893
  `SceneNote["code"]` needs the new code.
874
894
  - **`handFold: "ride"`** rides every column folded by hand, not only a one-panel one: each member is a bar over the
875
- side's first open panel column (never over an anchor), stacked in zone order. A side's rail is its outermost edge.
895
+ side's first open panel column (never over an anchor), stacked in zone order.
896
+ - **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
+ edge inward a side lies: its toolbar bars with `outsideInset`, the rail, its static column edges with `outsideInset`
898
+ (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
+ bar the rail stays inside the inset, as before. With no rail shown, the `rail:` strip lies past the side's bars too.
902
+ - **Static edges keep their place.** A new column (a `column:` or `rail:` target, `moveTo` with a column or rail place,
903
+ `dockHome`) goes no further out than just inside the static edges that lie outer to the side's dynamic columns, so a
904
+ bar or an anchor at the window's edge is never pushed inward. Column and rail places count rings as the side's edges
905
+ lie (by ring, then by order, no ties), and `homeFor` gives a start column's ring that way.
876
906
 
877
907
  **Floats** lie above the content in stage px, last on top. Each is moved inside the stage and clear of every docked
878
908
  item, every bar and every `chrome` rect (`fitFloat`), with `float-clamped`, `float-moved` or `float-covers` notes. With
879
909
  `anchor` (such as `"content-top-right"`) it sits flush with that side or corner of the content and follows it until a
880
- drop gives it a real rect. `orient` picks the forms it uses (default `"column"`); folded by hand (`from` over 0) it is its
910
+ drop gives it a real rect. `orient` picks the forms it uses; folded by hand (`from` over 0) it is its
881
911
  bar: that form's natural length along its orient, its other size kept.
882
912
 
913
+ A float that names no `orient` takes its item's: **`SceneItem.floatOrient`** (`"row"` or `"column"`), else
914
+ **`floatOrientOf(item)`**, the axis of the first form the item declares, so a toolbar group declared row first floats as
915
+ a row. **`SceneTargetOptions.floatOrient`** overrides that for the drag's float target. With no `floatSize`, a float takes
916
+ its first form's natural size along that orient (**`floatSizeOf(item, orient?)`**), not 280 × 360; a form that grows (a
917
+ panel's card) keeps `DEFAULT_FLOAT_SIZE` (280 × 360), so panels float as before. Give a float `orient: "column"` (or the
918
+ item `floatOrient: "column"`) to keep a row-first group vertical.
919
+
883
920
  The **float region** is [pad, W − pad] × the full height: the stage less `Scene.inset`'s left and right (its top and
884
921
  bottom don't cut it). A float is clamped into it, and one larger than it is shrunk to fit. **`SceneItem.floatMin`**
885
922
  (`Size`) is the floor of that shrink: a float of the item is laid out at `max(floatMin, min(its size, the region))` each
@@ -899,7 +936,7 @@ state still follows `previous` (only a column folded by give-way that holds the
899
936
  reweigh a column fully, pass `fresh: [columnId]`. `fresh` (edge or item ids, on `solve` and `targets`) solves those
900
937
  edges without `previous`.
901
938
 
902
- **Targets.** `targets(scene, id, { previous, endReach, floatSize })` gives, in the `@n-uf/motion/drag` shape:
939
+ **Targets.** `targets(scene, id, { previous, endReach, floatSize, floatOrient })` gives, in the `@n-uf/motion/drag` shape:
903
940
 
904
941
  - `gap:<edge>:<zone>:<at>` (priority 2) for every edge whose `accepts` lists the item's kind (deny by default), before
905
942
  each item of each zone and at each zone's end, so an empty center or end zone can be opened; only where the item
@@ -936,13 +973,32 @@ edges without `previous`.
936
973
  - `column:<side>:<ring>` (2): a new column on each column line of a side whose template's start zone takes the kind (outside the
937
974
  outermost open column, between two, inside the innermost, or at the content's edge), 22 px each way.
938
975
  - `rail:<side>:<ring>` (1): docking folded into the side's rail, before each folded column's segments and after the
939
- last, or a 10 px strip at the side's outer edge while no rail shows.
976
+ last, or a 10 px strip where the rail lands (after the side's outside toolbar bars) while no rail shows.
940
977
  - `none:<i>` (1) over each `scene.blocked` rect, and `home:<id>` (1) over a docked item's own rect: a release there
941
978
  commits nothing. A floating item has no home, so a move inside its own rect is a float move. A gap, column line or rail
942
979
  drop that would put the item back where it is (the gap beside it, its own column's line) keeps its id but is a home
943
980
  too: no slot, nothing committed. Every rail target on the side whose rail already holds the item is a home: a segment
944
981
  dropped on its own rail, even below the last segment, never splits or reorders it (P9).
945
982
 
983
+ **Local targets.** A target wins only where its own hit is. Home's hit is the item's own rect and half a band
984
+ (`DEFAULT_HIT_BAND / 2`, 12 px) each way along its edge, across the edge's full hit thickness, cut out of every other gap
985
+ hit there, so home is offered only over the item's own place, and it always covers the item's whole own rect: across
986
+ it no point picks a target that moves the item. An empty bar's or edge's strip (and the `rail:` strip while no rail
987
+ shows) keeps only what lies outside the item's own rect; the strip of the item's own edge, which the item alone fills,
988
+ means home there, and what is left of a strip under 1 px has no target. The rest of its gaps' slices goes
989
+ only to the gap beside it in the same zone; with none there, that stretch has no target (the pointer shows nothing, and a
990
+ release goes home), never a "back to its place" preview far away and never a gap of another zone. Affected: the drag of
991
+ an item in a bar whose zone held only its own gap (that zone's whole third used to preview home), and items whose own
992
+ rect lay outside their gap's slice (home now always covers them).
993
+
994
+ **Refusals.** `refusals(scene, dragged, options?)` gives the places a drop is refused, as `{ id: "refuse:<edge>:<zone>",
995
+ edge, zone, hit, reason }[]` (type `SceneRefusal`): the bar zones, by thirds, that have no target (`reason: "no-room"`
996
+ when the zone takes the kind but no gap of it fits, a title bar at the title's natural width say; `"not-accepted"` when
997
+ the zone or the bar doesn't take the kind), and the side edges that don't take the kind (as a whole, zone `start`). Each
998
+ hit is cut clear of every target's hit, so a pointer over one has no target there but the float. A host shows "no room
999
+ here" at the pointer over one, with no slot anywhere; a release there commits nothing, the item goes home. It takes the
1000
+ same `previous` and `fresh` as `targets`.
1001
+
946
1002
  A gap, column or rail target exists only where the drop keeps the whole scene sound (C29): it adds no `overflow` or
947
1003
  `too-wide` note to any edge, changes no fixed item's form, squeezes none under its `main.min` anywhere (a between bar
948
1004
  under a new column included), and lands its slot on no chrome. The rule compares notes: in an edge that already