@n-uf/placement 26.11.19 → 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 +18 -0
- package/README.md +27 -6
- package/dist/{chunk-NCHRKLT3.js → chunk-GCSVZGVX.js} +14 -14
- 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 +74 -35
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +3 -3
- package/dist/scene.js +1 -1
- package/dist/stack.d.ts +2 -2
- package/dist/{targets-50bCVu3K.d.ts → targets-CYJN0Hba.d.ts} +7 -5
- package/package.json +1 -1
- package/dist/chunk-NCHRKLT3.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
|
|
6
24
|
## 26.11.19
|
|
7
25
|
|
|
8
26
|
- `@n-uf/placement/scene`, parity with the panels hosts draw today (Revisions 7 and 7b):
|
package/README.md
CHANGED
|
@@ -863,11 +863,14 @@ none lays out as before.
|
|
|
863
863
|
- **`Scene.insetWhen`** (`"always"`, the default, or `"docked"`): with `"docked"` the inset applies only while something is
|
|
864
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
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 dynamic
|
|
867
|
-
whether one column at its minimum fits beside the content's minimum and
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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.
|
|
871
874
|
- **`handFold: "ride"`** rides every column folded by hand, not only a one-panel one: each member is a bar over the
|
|
872
875
|
side's first open panel column (never over an anchor), stacked in zone order. A side's rail is its outermost edge.
|
|
873
876
|
|
|
@@ -959,7 +962,8 @@ Each target's `after(point, grab)` is `{ scene, layout }`: the scene to commit (
|
|
|
959
962
|
`setSide(scene, edgeId, side)`. `setSide` moves an edge to the other side of its axis (left ⇄ right, top ⇄ bottom) as
|
|
960
963
|
its side's outermost edge: ring 0, before that side's other edges, whose rings close up behind it (the side it left
|
|
961
964
|
closes up too). Its items, size and options go with it; the scene is given back unchanged for an unknown edge, the side
|
|
962
|
-
it is already on, or a side across its axis.
|
|
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
|
|
963
967
|
on the other side of `base`'s with `setSide`. `moveTo` and
|
|
964
968
|
`floatAt` refuse fixed items and kinds the edge or `floatKinds` doesn't list. `moveTo` also takes `{ kind: "column",
|
|
965
969
|
side, ring }` (`ring: Infinity` is the side's inner end: "Move to › Dock left"), `{ kind: "rail", side, ring }` (docked
|
|
@@ -1040,6 +1044,23 @@ played in order:
|
|
|
1040
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`. |
|
|
1041
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. |
|
|
1042
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
|
+
|
|
1043
1064
|
## Pane zones
|
|
1044
1065
|
|
|
1045
1066
|
`paneZone(rect, point, previous, options?)` says which of a pane's five zones a point is in: the centre rectangle
|
|
@@ -422,20 +422,20 @@ function solve(given, options = {}) {
|
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
const g = evaluate(auto);
|
|
425
|
-
const
|
|
425
|
+
const open2 = cols.filter((c) => c.edge.column === true && c.visible.length > 0).map((c) => c.min);
|
|
426
|
+
const templates = ["left", "right"].flatMap((s) => {
|
|
427
|
+
const t = scene.columns?.[s];
|
|
428
|
+
if (!t) return [];
|
|
429
|
+
const needs = Object.values(scene.items).filter((it) => !it.fixed && !it.closed && t.accepts.includes(it.kind)).map((it) => {
|
|
430
|
+
const forms = formsOf(it, "column");
|
|
431
|
+
const f = forms[Math.min(Math.max(0, Math.floor(finite(it.from, 0))), Math.max(0, forms.length - 1))];
|
|
432
|
+
return f && formSetsCross(f) ? formCrossMin(f) : 0;
|
|
433
|
+
});
|
|
434
|
+
return [Math.max(px(t.cross.min), ...needs)];
|
|
435
|
+
});
|
|
436
|
+
const colMins = open2.length > 0 ? open2 : templates;
|
|
426
437
|
if (cmin !== void 0 && colMins.length > 0) {
|
|
427
|
-
|
|
428
|
-
const railedSides = /* @__PURE__ */ new Set();
|
|
429
|
-
for (const c of cols) {
|
|
430
|
-
if (c.edge.column === true || c.visible.length === 0) continue;
|
|
431
|
-
if (g.railed(c)) railedSides.add(c.side);
|
|
432
|
-
else if (!g.riding(c)) {
|
|
433
|
-
const w = g.widths.get(c) ?? c.width;
|
|
434
|
-
if (w > 0) fixedRoom += w + (c.edge.outsideInset === true ? 0 : gutter);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
for (const s of railedSides) fixedRoom += railW(s) + gutter;
|
|
438
|
-
const need = cmin + Math.min(...colMins) + gutter + fixedRoom;
|
|
438
|
+
const need = cmin + Math.min(...colMins) + gutter;
|
|
439
439
|
columnRoom = area3.width >= need - EPS;
|
|
440
440
|
if (!columnRoom) notes.push({ code: "no-column-room", width: area3.width, need });
|
|
441
441
|
}
|
|
@@ -1484,4 +1484,4 @@ export {
|
|
|
1484
1484
|
reservedRect,
|
|
1485
1485
|
stops
|
|
1486
1486
|
};
|
|
1487
|
-
//# sourceMappingURL=chunk-
|
|
1487
|
+
//# sourceMappingURL=chunk-GCSVZGVX.js.map
|