@n-uf/placement 26.11.18 → 26.11.20
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 +66 -0
- package/README.md +74 -2
- package/dist/{chunk-HQE2DOWA.js → chunk-GCSVZGVX.js} +183 -49
- package/dist/chunk-GCSVZGVX.js.map +1 -0
- package/dist/{model-irGEua8T.d.ts → model-DU7MovDa.d.ts} +1 -1
- package/dist/scene-cases.d.ts +35 -3
- package/dist/scene-cases.js +89 -40
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +3 -3
- package/dist/scene.js +3 -1
- package/dist/stack.d.ts +2 -2
- package/dist/{targets-CZOYu8mG.d.ts → targets-CYJN0Hba.d.ts} +62 -7
- package/package.json +1 -1
- package/dist/chunk-HQE2DOWA.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,72 @@
|
|
|
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.20
|
|
7
|
+
|
|
8
|
+
- `@n-uf/placement/scene/cases`, an async runner (additive): **`runCaseAsync(row, host)`** and
|
|
9
|
+
**`runCasesAsync(rows, makeHost, { onResult? })`** play the rows on an **`AsyncCaseHost`** (a `CaseHost` whose `load`,
|
|
10
|
+
`perform`, `layout`, `root`, `stored` and `stops` may return promises; `itemSelector` stays plain), so a kit's page can
|
|
11
|
+
be driven from a browser runner with real pointer events and timers. They await each host call in the order `runCase`
|
|
12
|
+
makes them, with the same checks (both play one list of steps). A failing `load`, `perform`, `layout` or `stored` is a
|
|
13
|
+
failed result, as a thrown one is; a failing `root` or `stops` rejects `runCaseAsync` (and throws from `runCase`). A
|
|
14
|
+
sync `CaseHost` works with both. `runCase`, `runCases` and `CaseHost` are unchanged.
|
|
15
|
+
- `@n-uf/placement/scene`, **`layout.columnRoom`** (**Changed**): with `contentMin` and a column, whether one column at
|
|
16
|
+
its minimum fits beside the content's minimum. Anchors and rails don't count any more (26.11.19 counted the anchors'
|
|
17
|
+
room): every column, an anchor included, can fold into its rail. A docked column counts whether or not its side has a
|
|
18
|
+
rail. Before any column holds an item, the answer comes from the `Scene.columns` template: the larger of its
|
|
19
|
+
`cross.min` and the least width the items it takes need, so docking a panel doesn't flip the answer. A host's narrow
|
|
20
|
+
fallback (the sheet) reads it.
|
|
21
|
+
- `@n-uf/placement/scene`, `setSide` ticks no use clock, like every change: a host that moves an edge by hand calls
|
|
22
|
+
`use()` on its items afterwards, as a drop does (documented, with a test).
|
|
23
|
+
|
|
24
|
+
## 26.11.19
|
|
25
|
+
|
|
26
|
+
- `@n-uf/placement/scene`, parity with the panels hosts draw today (Revisions 7 and 7b):
|
|
27
|
+
- **`layout.columnRoom`** and the note **`no-column-room`** (`width`, `need`): with `contentMin` and dynamic columns,
|
|
28
|
+
whether one column at its minimum fits beside the content's minimum and the anchors' room (an open anchor's width
|
|
29
|
+
and gutter, a folded one's rail and gutter). A host's narrow fallback reads it.
|
|
30
|
+
- **`Edge.outsideInset`**: an anchor edge (a side edge that takes nothing, a thumbnail strip) lies outside the inset
|
|
31
|
+
and the gutter: at the window's side, the inset after it; inside the side's rail when one shows. It runs into the
|
|
32
|
+
inset above and below only where no reserved bar lies on that side.
|
|
33
|
+
- **`Edge.giveWay`**: a static side edge shrinks toward its minimum, then folds into its side's rail, in give-way
|
|
34
|
+
order with the columns (by its items' ages). It is never deleted.
|
|
35
|
+
- **`setSide(scene, edgeId, side)`**: moves an edge to the other side of its axis as its side's outermost edge (ring
|
|
36
|
+
0); `readScene` moves a static edge stored on the other side.
|
|
37
|
+
- **`Scene.insetWhen`** (`"always"`, the default, or `"docked"`): with `"docked"` the inset applies only while
|
|
38
|
+
an open column or a rail is beside the content (an anchor alone doesn't count).
|
|
39
|
+
- **Changed:** `handFold: "ride"` rides every column folded by hand, not only a one-panel one: each member a bar over
|
|
40
|
+
the side's first open panel column (never over an anchor), stacked in zone order.
|
|
41
|
+
- **Changed:** the side's rail is its outermost edge (it was placed just outside the first dynamic column).
|
|
42
|
+
- **Changed:** floats are clamped into [pad, W − pad] × full height (the stage less the inset's left and right), and a
|
|
43
|
+
float larger than that region is shrunk to fit it (they were clamped into the whole stage, never resized).
|
|
44
|
+
- **`SceneItem.floatMin`** (`Size`): a float of the item is laid out at `max(floatMin, min(its size, the region))`
|
|
45
|
+
each way. Without it a shrink stops at its form's own minimums (`cross.min` across, `main.min` along). A float
|
|
46
|
+
wider than the region at that floor keeps it and lies at the region's left edge, one taller than the stage keeps it
|
|
47
|
+
at the stage's top and runs past its bottom; a folded float (its header form) keeps its height.
|
|
48
|
+
- Typing: `SceneNote` gains `no-column-room`; an exhaustive `switch` over `SceneNote["code"]` needs it.
|
|
49
|
+
- Affected: scenes with an inset and floats near its sides, scenes riding a hand-folded column of two or more panels
|
|
50
|
+
(they went to the rail), and scenes with a static edge outside a dynamic column on a side whose rail shows.
|
|
51
|
+
- `@n-uf/placement/scene`, **fixed:** an item moved into a new column (`moveTo` with a column or rail place) kept
|
|
52
|
+
only the start zone since 26.11.18; it keeps its own zone (`align` end or center) again where the new column takes
|
|
53
|
+
its kind there, else the first zone that does.
|
|
54
|
+
- `@n-uf/placement/scene`, **fixed:** `homeFor` (and `dockHome`) took a new column that reused a pruned column's id
|
|
55
|
+
for the item's home. A start column is home only while the column under its id holds one of its items; otherwise
|
|
56
|
+
home is a new column at its ring. Static edges still match by id. Conformance row `P14b-dock-after-a-column-id-is-reused`.
|
|
57
|
+
- `@n-uf/placement/scene`, bar alignment zones (**Changed**):
|
|
58
|
+
- A horizontal bar's targets are picked by thirds: the left third is the leading (start) zone's, the middle the
|
|
59
|
+
center zone's, the right the trailing (end) zone's, the nearest of the zone's gaps within. An empty bar's strip is
|
|
60
|
+
three targets, `strip:<bar>:start`, `strip:<bar>:center` and `strip:<bar>:end` (was one `strip:<bar>`).
|
|
61
|
+
- A title bar (a bar with a fixed item that grows) is a constrained host: a toolbar there must land in its first
|
|
62
|
+
form, nothing in the bar may change form for it, and the title keeps its natural width (26.11.18 let it shrink to
|
|
63
|
+
its `min`); otherwise that zone has no target and no slot.
|
|
64
|
+
- In a title bar the zones are laid with the title at its natural width: a leading toolbar sits right after the
|
|
65
|
+
title's natural rect, trailing ones right before the end items, and a center one at the bar's true centre when that
|
|
66
|
+
is clear of both, else centred in the free span between them. The title takes the spare room only when nothing
|
|
67
|
+
follows it in its zone.
|
|
68
|
+
- Affected: bars' hits (a pointer in a bar's middle third now always offers the center zone, unless the toolbar
|
|
69
|
+
doesn't fit there in a title bar), empty bars' strip ids, and the layout of title bars with a toolbar after the
|
|
70
|
+
title (the title no longer grows between them).
|
|
71
|
+
|
|
6
72
|
## 26.11.18
|
|
7
73
|
|
|
8
74
|
- `@n-uf/placement/stack`: **`StackForm.wrap`** (`{ widths, row, gap?, lead? }`, a form of the new group kind `wrap`):
|
package/README.md
CHANGED
|
@@ -786,6 +786,25 @@ least and `cross.max` at most; `resize` sets it.
|
|
|
786
786
|
zones (it sums the minimum sizes); when room is spare, start items pack from the start, end items from the end (before
|
|
787
787
|
the » entry) and center items sit on the edge's middle, moved only as far as they must to stay between the other two.
|
|
788
788
|
|
|
789
|
+
**Bar alignment zones.** A horizontal bar picks the zone of a drop by thirds of its length: a pointer in the left third
|
|
790
|
+
is over the leading zone (`start`), in the middle third over the center zone, in the right third over the trailing zone
|
|
791
|
+
(`end`), and within the zone the nearest of its gaps wins, each zone's gaps splitting only that zone's third. A zone whose
|
|
792
|
+
toolbars run past its third spreads its gap lines inside the third, so its last gap keeps a slice of it. An empty bar's
|
|
793
|
+
strip is three targets, `strip:<bar>:start`, `strip:<bar>:center` and `strip:<bar>:end` (it was one `strip:<bar>`), one
|
|
794
|
+
per third. Columns keep their one `strip:<column>`.
|
|
795
|
+
|
|
796
|
+
A **title bar**, a bar with a fixed item that grows (the window title), is a constrained host: a toolbar dropped there
|
|
797
|
+
must land in its first form, nothing else in the bar may change form for it, and the title keeps its natural width (it may
|
|
798
|
+
no longer shrink to its `min` to make room). A zone where that can't hold has no target and no slot, so a bar too full
|
|
799
|
+
takes no drop in that zone. The zones are then laid with the title at its natural width, not at the width it grew to:
|
|
800
|
+
|
|
801
|
+
- a leading toolbar sits right after the title's natural rect;
|
|
802
|
+
- the trailing toolbars sit right before the end items (the window controls);
|
|
803
|
+
- a center toolbar sits at the bar's true centre when that is clear of both, else it is centred in the free span between
|
|
804
|
+
the leading and the trailing ones;
|
|
805
|
+
- the title takes the spare room only when nothing follows it in its zone, so a toolbar after the title is no longer
|
|
806
|
+
separated from it by a stretch of title.
|
|
807
|
+
|
|
789
808
|
**Fixed items** (a title, window controls, a page readout) never change form, are never reordered, never dragged, and
|
|
790
809
|
no hit covers them. Their length shrinks toward `main.min` and grows with spare room when the form `grows`; window
|
|
791
810
|
controls have `min` equal to `natural`. A stage too short for them overflows instead of folding them. A `kept` item with
|
|
@@ -833,12 +852,41 @@ first column. A column folds:
|
|
|
833
852
|
A member folded by hand in a column with others is a bar in place (its header form). The open members share the height
|
|
834
853
|
through `grows`. Anchors (a thumbnails column, a fixed drawer) are ring-0 edges with `accepts: []` and fixed items.
|
|
835
854
|
|
|
855
|
+
**Side parity options.** For a host with panel columns, anchors and a narrow fallback. All are opt-in; a scene that sets
|
|
856
|
+
none lays out as before.
|
|
857
|
+
|
|
858
|
+
- **`Edge.outsideInset`**: an anchor edge (a left or right edge that takes nothing, such as a thumbnail strip) lies
|
|
859
|
+
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.
|
|
861
|
+
- **`Edge.giveWay`**: a static left or right edge that gives way like a dynamic column. It shrinks toward its minimum,
|
|
862
|
+
then folds whole into its side's rail, in give-way order with the columns (by its items' ages). It is never deleted.
|
|
863
|
+
- **`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.
|
|
866
|
+
- **`layout.columnRoom`** and the note **`no-column-room`** (`{ width, need }`): with `contentMin` and a dynamic column,
|
|
867
|
+
whether one column at its minimum fits beside the content's minimum. Anchors and rails don't count: every column, an
|
|
868
|
+
anchor included, can fold into its rail. A docked column counts whether or not its side has a rail. Before any column
|
|
869
|
+
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
|
|
871
|
+
note, where `width` is the room the stage leaves and `need` the content's minimum plus that column and its gutter. A
|
|
872
|
+
host shows its narrow fallback (one panel over the content) while it is `false`. An exhaustive `switch` over
|
|
873
|
+
`SceneNote["code"]` needs the new code.
|
|
874
|
+
- **`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.
|
|
876
|
+
|
|
836
877
|
**Floats** lie above the content in stage px, last on top. Each is moved inside the stage and clear of every docked
|
|
837
878
|
item, every bar and every `chrome` rect (`fitFloat`), with `float-clamped`, `float-moved` or `float-covers` notes. With
|
|
838
879
|
`anchor` (such as `"content-top-right"`) it sits flush with that side or corner of the content and follows it until a
|
|
839
880
|
drop gives it a real rect. `orient` picks the forms it uses (default `"column"`); folded by hand (`from` over 0) it is its
|
|
840
881
|
bar: that form's natural length along its orient, its other size kept.
|
|
841
882
|
|
|
883
|
+
The **float region** is [pad, W − pad] × the full height: the stage less `Scene.inset`'s left and right (its top and
|
|
884
|
+
bottom don't cut it). A float is clamped into it, and one larger than it is shrunk to fit. **`SceneItem.floatMin`**
|
|
885
|
+
(`Size`) is the floor of that shrink: a float of the item is laid out at `max(floatMin, min(its size, the region))` each
|
|
886
|
+
way. Without it a shrink stops at the form's own minimums (`cross.min` across, `main.min` along), and a float asked for
|
|
887
|
+
smaller than those keeps its size. A float wider than the region even at the floor keeps the floor and lies at the
|
|
888
|
+
region's left edge; a folded float keeps its height.
|
|
889
|
+
|
|
842
890
|
**`previous`.** `solve(scene, { previous })` hands each edge's fits (`edges[id].free` and `.stack`) to `fitStack`, so a
|
|
843
891
|
change of ages alone (a press, `use`) or `raise` changes no rect (C23), a form that was only re-measured keeps its place,
|
|
844
892
|
and one whose kind changed starts over. Whenever `content` isn't the rect `previous.content` was, the layout has a
|
|
@@ -874,7 +922,8 @@ edges without `previous`.
|
|
|
874
922
|
by is spare room: the drop shrinks it toward its natural size (to its `min` if the room needs it), so a group moved
|
|
875
923
|
out of a title bar can always go back while the room allows. No slot lies over a fixed item's reserved rect. `slot`
|
|
876
924
|
is the item's rect after the drop and `marker` the insertion line across the edge.
|
|
877
|
-
- `strip:<edge>` (2
|
|
925
|
+
- `strip:<edge>` (2; for an empty horizontal bar three, `strip:<bar>:start`, `:center` and `:end`, one per third, see
|
|
926
|
+
Bar alignment zones): an empty accepting edge, a strip `Edge.strip` px deep (default 24) along its side, inside the
|
|
878
927
|
content and clear of the other edges (overlay ones included), so never over a docked edge or a panel's body: a
|
|
879
928
|
full-width empty bar's strip covers only the content between the columns. A compact rail's strip alone stays at the
|
|
880
929
|
window edge, its own place. A gap hit that spans it across trims its start or end (a bar's strip along the top never
|
|
@@ -909,7 +958,13 @@ Each target's `after(point, grab)` is `{ scene, layout }`: the scene to commit (
|
|
|
909
958
|
|
|
910
959
|
**Changes** are pure and return the scene given when nothing applies: `moveTo(scene, id, { edge, zone?, at })`,
|
|
911
960
|
`floatAt(scene, id, rect?, orient?)` (with no rect: its last `floatSize`, anchored to the content's top-right), `fold`,
|
|
912
|
-
`use`, `keep`, `raise` (a float on top: no use, no reshape), `open`, `close`, `orient
|
|
961
|
+
`use`, `keep`, `raise` (a float on top: no use, no reshape), `open`, `close`, `orient`, `resize` and
|
|
962
|
+
`setSide(scene, edgeId, side)`. `setSide` moves an edge to the other side of its axis (left ⇄ right, top ⇄ bottom) as
|
|
963
|
+
its side's outermost edge: ring 0, before that side's other edges, whose rings close up behind it (the side it left
|
|
964
|
+
closes up too). Its items, size and options go with it; the scene is given back unchanged for an unknown edge, the side
|
|
965
|
+
it is already on, or a side across its axis. Like every change it ticks no use clock: a host that moves an edge by hand
|
|
966
|
+
calls `use()` on its items afterwards, as a drop does. The stored form keeps the side, and `readScene` moves a static edge stored
|
|
967
|
+
on the other side of `base`'s with `setSide`. `moveTo` and
|
|
913
968
|
`floatAt` refuse fixed items and kinds the edge or `floatKinds` doesn't list. `moveTo` also takes `{ kind: "column",
|
|
914
969
|
side, ring }` (`ring: Infinity` is the side's inner end: "Move to › Dock left"), `{ kind: "rail", side, ring }` (docked
|
|
915
970
|
folded) and `{ kind: "float", rect?, anchor? }`. `homeFor(scene, id, start)` is the place a start scene gives the item
|
|
@@ -989,6 +1044,23 @@ played in order:
|
|
|
989
1044
|
| `resize` | With `edge`, the user's size across that edge (`size` px); with `item`, that item's measured length changed by `size` px; with neither, the window is now `point.x` by `point.y`. |
|
|
990
1045
|
| `scroll` | The pages scroll by `size` px. Nothing in a scene scrolls: only a host with a page can show it, with a DOM `rect` check. |
|
|
991
1046
|
|
|
1047
|
+
**Driving the rows from a browser runner.** A kit's page is driven from outside (Playwright, say) with real pointer
|
|
1048
|
+
events and timers, so its host's calls are async. `runCaseAsync(row, host)` takes an `AsyncCaseHost`, the same members
|
|
1049
|
+
as a `CaseHost` but each of `load`, `perform`, `layout`, `root`, `stored` and `stops` may return a promise
|
|
1050
|
+
(`itemSelector` stays a plain function). It awaits every call, in the same order as `runCase` makes them, and checks the
|
|
1051
|
+
same way: both play one list of steps. A rejected `load` or `perform` is a failed result with the error's message, as a
|
|
1052
|
+
thrown one is in `runCase`. `runCasesAsync(rows, makeHost, { onResult })` runs the rows one after another (a page has one
|
|
1053
|
+
pointer), each on a fresh host (`makeHost` may be async), and reports each result as it is known. A sync `CaseHost` works
|
|
1054
|
+
with both.
|
|
1055
|
+
|
|
1056
|
+
```ts
|
|
1057
|
+
import { CASES, runCasesAsync, type AsyncCaseHost } from "@n-uf/placement/scene/cases";
|
|
1058
|
+
|
|
1059
|
+
// A host over a Playwright page: each call goes to the page and resolves when the page has done it.
|
|
1060
|
+
declare function pageHost(): Promise<AsyncCaseHost>;
|
|
1061
|
+
const results = await runCasesAsync(CASES, pageHost, { onResult: (id, r) => console.log(id, r.ok) });
|
|
1062
|
+
```
|
|
1063
|
+
|
|
992
1064
|
## Pane zones
|
|
993
1065
|
|
|
994
1066
|
`paneZone(rect, point, previous, options?)` says which of a pane's five zones a point is in: the centre rectangle
|