@n-uf/placement 26.11.40 → 26.11.41
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 +17 -0
- package/README.md +20 -2
- package/dist/{chunk-PADZWK3H.js → chunk-NRARI4Q2.js} +28 -5
- package/dist/chunk-NRARI4Q2.js.map +1 -0
- package/dist/{model-YDXCs2N_.d.ts → model-C-Z5PDBp.d.ts} +19 -0
- package/dist/scene-cases.d.ts +1 -1
- package/dist/scene-cases.js +1 -1
- package/dist/scene.d.ts +17 -20
- package/dist/scene.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-PADZWK3H.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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.41
|
|
7
|
+
|
|
8
|
+
- `./scene`, **`use` is idempotent** (behavior change). `use(scene, id)` on an item whose `used` is already strictly
|
|
9
|
+
greater than every other item's gives back the same scene object, so a press on the newest item stores nothing new;
|
|
10
|
+
any other item, or one tied with another, is bumped to the newest age plus one as before. A drop's result is `use`d
|
|
11
|
+
the same way, so moving the item that was already the newest keeps its `used` (layouts are unchanged: only the
|
|
12
|
+
stored age differs). `raise` already gave back the scene for the top float; `floatAt` and `moveTo` don't bump ages.
|
|
13
|
+
|
|
14
|
+
- `./scene`, **`Edge.zones`** (additive): the zones an edge has, default all three. `zones: ["start"]` makes a side
|
|
15
|
+
rail one stack along its whole length: its whole length offers the start zone's gaps by position, with no center or
|
|
16
|
+
end gaps, ids or refusals for a kind it takes; a drop on it names no zone, so the item keeps its own `align`, and an
|
|
17
|
+
item lent back to a bar through `showIn` lies in its own zone there. A fixed item whose `align` names a zone the
|
|
18
|
+
edge lacks (`align: "end"` on a `zones: ["start"]` edge) lies in the edge's first zone, with its span, its stored
|
|
19
|
+
`align` unchanged. `zoneTakes`, `zonesTaking`, `edgeTakes`,
|
|
20
|
+
`zoneIn` and `namesZone` read it (with `zoneAccepts` too, a zone takes a kind only where both say so). Two zones
|
|
21
|
+
split the length in halves. Never stored; `readScene` takes it from `base`. Scenes without it are unchanged.
|
|
22
|
+
|
|
6
23
|
## 26.11.40
|
|
7
24
|
|
|
8
25
|
- `./scene`, **a drop names a zone only where the edge offers a choice** (behavior change). A gap drop, a strip, or
|
package/README.md
CHANGED
|
@@ -227,7 +227,9 @@ clamped so that its screen rect at pan 0 fits the view, so it still scrolls with
|
|
|
227
227
|
time and the state keeps the stored rect, so a larger view brings a float back where it was. `"free"` never moves a
|
|
228
228
|
float. A float folded by hand (`toggleFold`) lays out as a title bar: `kind` `"bar"`, `folded` `"hand"`, at its own x,
|
|
229
229
|
y and width and `options.bar` tall, clamped as a bar. It is still a float (`floating: true`) to its targets and drags,
|
|
230
|
-
pinned or not, and unfolding brings its full rect back: the stored rect never changes.
|
|
230
|
+
pinned or not, and unfolding brings its full rect back: the stored rect never changes. That `floating` is a layout
|
|
231
|
+
item's flag; `@n-uf/motion/drag`'s `createDragIntent({ floating })` is an option a host sets from it at lift
|
|
232
|
+
(`floating: layout.items[id]?.floating === true`), so the item's own box loses to a refusal as the float does.
|
|
231
233
|
|
|
232
234
|
**Folded columns** (`options.fold`, default `"rail"`): a column folded by hand goes to its side's rail. With `"ride"`,
|
|
233
235
|
it rides instead while its side still has an open column: its panels become title bars (`kind` `"bar"`, `rides`: the
|
|
@@ -966,6 +968,20 @@ const zoom: SceneItem = {
|
|
|
966
968
|
their `icons` form (and the » menu after it), stacked, each item's grip the divider. An item with no `icons` form is left
|
|
967
969
|
out of it with a `no-icons-form` note.
|
|
968
970
|
|
|
971
|
+
**Edges with fewer zones.** `Edge.zones` lists the zones an edge has (default all three). `zones: ["start"]` makes it
|
|
972
|
+
one stack along its whole length, as a side rail drawn in order: the whole length offers the start zone's gaps, ordered
|
|
973
|
+
by position along it, so a drop anywhere inserts at the pointer's place; there are no center or end gaps, ids or
|
|
974
|
+
refusals, and nothing along it refuses a kind it takes. A drop on it names no zone (`namesZone` counts the zones it
|
|
975
|
+
has), so the item keeps its own `align`; an item whose `align` names a zone the edge lacks lies in its zone (`zoneIn`;
|
|
976
|
+
a fixed item, which the edge takes in no zone, in the edge's first zone), its stored `align` unchanged, and is back in its own zone when the edge is hidden and lends it to a bar (`showIn`).
|
|
977
|
+
Two zones (`["start", "end"]`) split the length between them, the boundary at the middle moved past the cards seen on
|
|
978
|
+
either side, as three split it in thirds; a drop there names its half's zone. Setting `zones`, even to all three,
|
|
979
|
+
always splits the length evenly among its zones (each boundary moved past the cards seen on either side); leaving it
|
|
980
|
+
out keeps the edge kind's own spans, on a column the spans the solver lays out. Entries that aren't zones and repeats are
|
|
981
|
+
ignored, and a list with no zone counts as all three. With `zoneAccepts` as well, a zone takes a kind only where both
|
|
982
|
+
say so (`zoneAccepts: { start: [...] }` alone keeps three zones and refuses the other two thirds). Like `zoneAccepts`,
|
|
983
|
+
`zones` is a declaration: `storeScene` never writes it and `readScene` takes it from `base`.
|
|
984
|
+
|
|
969
985
|
**Column footers.** `Edge.zoneAccepts` (and `ColumnTemplate.zoneAccepts`, for the columns a drop makes) narrows `accepts` per zone:
|
|
970
986
|
the kinds each zone takes, and a zone not listed takes nothing. A panel column with `{ start: ["panel"], end: ["group"] }`
|
|
971
987
|
has its panels at the top and a footer of toolbar groups at its foot (the end zone, one group per row): a group in the footer
|
|
@@ -1361,7 +1377,9 @@ Each target's `after(point, grab)` is `{ scene, layout }`: the scene to commit (
|
|
|
1361
1377
|
|
|
1362
1378
|
**Changes** are pure and return the scene given when nothing applies: `moveTo(scene, id, { edge, zone?, at })`,
|
|
1363
1379
|
`floatAt(scene, id, rect?, orient?)` (with no rect: its last `floatSize`, anchored to the content's top-right), `fold`,
|
|
1364
|
-
`use
|
|
1380
|
+
`use` (idempotent: on an item whose `used` is already strictly greater than every other item's it gives back the same
|
|
1381
|
+
scene object, so a press on the newest item stores nothing new; any other item, or one tied with another, is bumped to
|
|
1382
|
+
the newest age plus one), `keep`, `raise` (a float on top: no use, no reshape), `open`, `close`, `orient`, `resize` and
|
|
1365
1383
|
`setSide(scene, edgeId, side)`. `resize(scene, edgeId, size)` sets the user's size across an edge;
|
|
1366
1384
|
`resize(scene, floatId, rect, moving?)` resizes a float by hand at `fitResize`'s rect (see "Resizing a float by hand";
|
|
1367
1385
|
the scene given back where `fitResize` gives null). `setSide` moves an edge to the other side of its axis (left ⇄ right, top ⇄ bottom) as
|
|
@@ -34,7 +34,12 @@ var DEFAULT_FLOAT_SIZE = { width: 280, height: 360 };
|
|
|
34
34
|
// src/scene/helpers.ts
|
|
35
35
|
var anchorName = (anchor) => typeof anchor === "string" ? anchor : anchor.at;
|
|
36
36
|
var isSince = (x) => typeof x === "number" && x >= 0 && x <= Number.MAX_SAFE_INTEGER;
|
|
37
|
-
var
|
|
37
|
+
var zonesOf = (edge) => {
|
|
38
|
+
if (edge.zones === void 0) return ZONES;
|
|
39
|
+
const has = ZONES.filter((z) => edge.zones.includes(z));
|
|
40
|
+
return has.length > 0 ? has : ZONES;
|
|
41
|
+
};
|
|
42
|
+
var zoneTakes = (edge, zone, kind) => edge.accepts.includes(kind) && (edge.zones === void 0 || zonesOf(edge).includes(zone)) && (edge.zoneAccepts === void 0 || !!edge.zoneAccepts[zone]?.includes(kind));
|
|
38
43
|
var zonesTaking = (edge, kind) => ZONES.filter((z) => zoneTakes(edge, z, kind));
|
|
39
44
|
var edgeTakes = (edge, kind) => zonesTaking(edge, kind).length > 0;
|
|
40
45
|
var hitBandOf = (scene, edge) => edge.hitBand ?? (edge.column === true && (edge.side === "left" || edge.side === "right") ? scene.columns?.[edge.side]?.hitBand : void 0) ?? DEFAULT_HIT_BAND;
|
|
@@ -61,7 +66,11 @@ function railColumnOf(scene, side, kind) {
|
|
|
61
66
|
}
|
|
62
67
|
function zoneIn(edge, item) {
|
|
63
68
|
const own = zoneOf(item);
|
|
64
|
-
if (item.fixed
|
|
69
|
+
if (item.fixed) {
|
|
70
|
+
const has = zonesOf(edge);
|
|
71
|
+
return has.includes(own) ? own : has[0] ?? own;
|
|
72
|
+
}
|
|
73
|
+
if (zoneTakes(edge, own, item.kind)) return own;
|
|
65
74
|
return zonesTaking(edge, item.kind)[0] ?? own;
|
|
66
75
|
}
|
|
67
76
|
var namesZone = (edge, kind) => zonesTaking(edge, kind).length > 1;
|
|
@@ -1456,6 +1465,8 @@ var nextAge = (scene) => Object.values(scene.items).reduce((m, it) => Math.max(m
|
|
|
1456
1465
|
function use(scene, id) {
|
|
1457
1466
|
const item = itemOf(scene, id);
|
|
1458
1467
|
if (!item) return scene;
|
|
1468
|
+
const age = (it) => Number.isFinite(it.used) ? it.used : 0;
|
|
1469
|
+
if (Number.isFinite(item.used) && Object.values(scene.items).every((it) => it.id === id || age(it) < item.used)) return scene;
|
|
1459
1470
|
return withItem(scene, { ...item, used: nextAge(scene) });
|
|
1460
1471
|
}
|
|
1461
1472
|
function keep(scene, id, on) {
|
|
@@ -1880,9 +1891,21 @@ function zoneSpans(scene, seen, edge, reach, probe) {
|
|
|
1880
1891
|
placed.set(z, was ? [Math.min(was[0], a), Math.max(was[1], b)] : [a, b]);
|
|
1881
1892
|
declared.add(z);
|
|
1882
1893
|
}
|
|
1894
|
+
const lo = (z) => placed.get(z)?.[0] ?? Infinity;
|
|
1895
|
+
const hi = (z) => placed.get(z)?.[1] ?? -Infinity;
|
|
1896
|
+
if (edge.zones !== void 0) {
|
|
1897
|
+
const has = zonesOf(edge);
|
|
1898
|
+
let prev = main0 - reach;
|
|
1899
|
+
return has.map((zone, i) => {
|
|
1900
|
+
const last = i === has.length - 1;
|
|
1901
|
+
const mark = main0 + length * (i + 1) / has.length;
|
|
1902
|
+
const b = last ? main0 + length + reach : Math.max(prev, Math.min(Math.max(mark, ...has.slice(0, i + 1).map(hi)), ...has.slice(i + 1).map(lo)));
|
|
1903
|
+
const span = { zone, a: prev, b };
|
|
1904
|
+
prev = b;
|
|
1905
|
+
return span;
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1883
1908
|
if (thirds) {
|
|
1884
|
-
const lo = (z) => placed.get(z)?.[0] ?? Infinity;
|
|
1885
|
-
const hi = (z) => placed.get(z)?.[1] ?? -Infinity;
|
|
1886
1909
|
const b1 = Math.min(Math.max(main0 + length / 3, hi("start")), lo("center"), lo("end"));
|
|
1887
1910
|
const b2 = Math.max(Math.min(main0 + 2 * length / 3, lo("end")), hi("center"), hi("start"), b1);
|
|
1888
1911
|
return [
|
|
@@ -3184,4 +3207,4 @@ export {
|
|
|
3184
3207
|
refusalTargets,
|
|
3185
3208
|
stops
|
|
3186
3209
|
};
|
|
3187
|
-
//# sourceMappingURL=chunk-
|
|
3210
|
+
//# sourceMappingURL=chunk-NRARI4Q2.js.map
|