@n-uf/placement 26.11.31 → 26.11.33
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 +34 -0
- package/README.md +19 -2
- package/dist/{chunk-COK4YNMF.js → chunk-IOTKOYKW.js} +23 -3
- package/dist/chunk-IOTKOYKW.js.map +1 -0
- package/dist/{model-DMB2ZFJ2.d.ts → model-BSIKmANw.d.ts} +1 -1
- package/dist/scene-cases.d.ts +26 -3
- package/dist/scene-cases.js +166 -54
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +2 -2
- package/dist/scene.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-COK4YNMF.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
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.33
|
|
7
|
+
|
|
8
|
+
- `./scene`, fixed: **a float stored taller than the clear stage was drawn over the bars.** `solve` sized a float to the
|
|
9
|
+
floats' region (the stage less its left and right inset), so one stored at the body's height lay over the top and
|
|
10
|
+
bottom bars by their height. Its size is now clamped to the room that region leaves clear of the bars and chrome
|
|
11
|
+
across it, along each axis, never under its floor (`floatMin`, else its form's minimums); only a floor larger than
|
|
12
|
+
that room keeps the floor and covers (`float-covers`). It is the one clamp `fitResize` lays floats with, so a resize
|
|
13
|
+
still previews its commit. A stored oversize float is drawn clear on the next `solve`; `readScene` is unchanged.
|
|
14
|
+
|
|
15
|
+
## 26.11.32
|
|
16
|
+
- `./scene/cases`, **`requires.intent`** (additive) and **row R4b-leaving-the-band**: a row that checks what a drag
|
|
17
|
+
intent adds to the pick at a point names `requires: { intent: true }`, and a host without one (the in-memory host)
|
|
18
|
+
skips it. R4b leaves a shown gap from inside its hit: just past the hit the intent's band holds it, past the band
|
|
19
|
+
nothing shows. R4-band-at-a-boundary keeps its id, retitled to what it checks: the hit area's boundary alone.
|
|
20
|
+
- `./scene/cases`, **refusals win, on every host.** The reference host (`createSceneHost`) now honours `refusals()`:
|
|
21
|
+
over a refused tile, where nothing more precise than the float is under the pointer, nothing is picked, and a release
|
|
22
|
+
there puts the item back ("No room here"), as a page does. The rule is `withRefusals(pick, refusals(scene, dragged))`
|
|
23
|
+
(additive), which a page's host also aims `resolvePlace` with. The host contract gains `[data-drag-refusal]` (the
|
|
24
|
+
refusal shown at the pointer, by id). Rows changed with it: **C25** and **P13-kinds** (a panel over a group-only bar
|
|
25
|
+
is refused, the release is home, the refusal shows); **C27** and **P11-a-float-never-covers-chrome** let go just under
|
|
26
|
+
the bar, where nothing refuses, and keep their check that the float lands clear of it. **R4-band-at-a-boundary**
|
|
27
|
+
reaches its "out" point from the content, where nothing is shown, so it reads the geometry alone: holding a shown gap
|
|
28
|
+
a band's width past its hit is the drag intent's rule, covered by `@n-uf/motion/drag`'s tests.
|
|
29
|
+
- `./scene/cases`, **three rows on a bar's zones** (R6, additive): a toolbar dropped in a bar's start zone lands
|
|
30
|
+
leading after the toolbars there, in the center zone at the bar's true center, in the end zone trailing before the
|
|
31
|
+
toolbars there.
|
|
32
|
+
- `./scene/cases`, **four rows on the window's edges** (P16, additive): in a flush window, a panel rested over the float
|
|
33
|
+
and then at the window's first or last px lands in a new outer column (the float never holds the window's edge); one
|
|
34
|
+
let go 9 px in, with hand folds riding, lands in a new outer column too; one alone in its column, rested over its own
|
|
35
|
+
column, goes home.
|
|
36
|
+
- `./scene/cases`, **`resizeStep`** (additive): a `resize` gesture as a pure step (`resizeStep(scene, start, layout,
|
|
37
|
+
gesture)` gives the scene and the loaded scene after it: an edge's size, an item measured again, the window's size), so
|
|
38
|
+
a page's case host plays it as the reference host does. The reference host uses it.
|
|
39
|
+
|
|
6
40
|
## 26.11.31
|
|
7
41
|
|
|
8
42
|
- `./scene`, fixed: **a float that already covered a bar grew over it when resized.** `fitResize` stopped a growing edge
|
package/README.md
CHANGED
|
@@ -1286,7 +1286,8 @@ at, what a user does (`press`, `move`, `release`, `key`, `click`, `resize`, `scr
|
|
|
1286
1286
|
by its `place` instead of pixels), and what must be true after: a partial layout (per item: `rect`, `formKind`, `edge`,
|
|
1287
1287
|
`floating`, `inMenu`, `rail`…, within a tolerance, 0.5 px by default) and, for a host with a page, DOM checks on the
|
|
1288
1288
|
session's marks (`data-drag-session` on the root during a drag only, `[data-drag-slot][data-drag-target]` for the slot
|
|
1289
|
-
(the attribute holds the target's id), `[data-drag-marker]` for the insertion line, `[data-drag-held]` for the held item
|
|
1289
|
+
(the attribute holds the target's id), `[data-drag-marker]` for the insertion line, `[data-drag-held]` for the held item, `[data-drag-refusal]` for a refusal
|
|
1290
|
+
shown at the pointer, "No room here", the attribute holding the refusal's id).
|
|
1290
1291
|
A drawn item's element is `[data-dock-item="<id>"]` by default, and a DOM check names it with `item` (not a literal
|
|
1291
1292
|
selector), optionally pinning its `rect` in stage px; a host that marks items another way gives `itemSelector(id)`. A row
|
|
1292
1293
|
may also carry `checkpoints`: the layout after an earlier gesture, for what the preview shows while the
|
|
@@ -1334,7 +1335,23 @@ draws the preview from its `after.layout` and commits `after.scene` on release,
|
|
|
1334
1335
|
it as `previous`. An integrating app's host does the same with its own pointer; `resolvePlace(targets, place, item, { stage, content
|
|
1335
1336
|
}, pick)` turns a `place` into a point that reaches the target. Every row
|
|
1336
1337
|
passes on the in-memory host except its DOM checks, which it skips, and the rows with `lacks`, which fail on it until the
|
|
1337
|
-
library rule lands. `
|
|
1338
|
+
library rule lands. A row with `requires: { intent: true }` checks what a drag intent adds to the pick at a point (a
|
|
1339
|
+
shown gap held a band's width past its hit): a host without one, the in-memory host among them, skips it. `CASE_GROUPS`
|
|
1340
|
+
lists the groups.
|
|
1341
|
+
|
|
1342
|
+
The rows run on any host, a page's included: the reference host and a page's host play one list of steps and agree on every
|
|
1343
|
+
row, the rows that were disputed between them now being host-independent. Two pure helpers keep a page's host equal to the
|
|
1344
|
+
reference one:
|
|
1345
|
+
|
|
1346
|
+
- **`withRefusals(pick, refusals(scene, dragged))`** is the pick rule with the scene's refusals: where nothing more precise
|
|
1347
|
+
than the float is under the pointer and a refusal's hit holds it, nothing is picked, so a release there commits
|
|
1348
|
+
nothing and the item goes home ("No room here"; a page marks the refusal at the pointer with `[data-drag-refusal]`).
|
|
1349
|
+
The reference host aims and drops with it, and a page's host aims `resolvePlace` with it.
|
|
1350
|
+
- **`resizeStep(scene, start, layout, gesture)`** plays a `resize` gesture as a pure step, for any host: it gives the scene
|
|
1351
|
+
after it and the loaded scene (`start`, what `"dock"` puts items back to) after it. With `edge`, the user's size across
|
|
1352
|
+
that edge; with `item`, that item's largest form along its axis grown by `size` px (in both scenes: it was measured
|
|
1353
|
+
again); with neither, the window is now `point.x` by `point.y`. It throws when the gesture names nothing that exists.
|
|
1354
|
+
The reference host uses it.
|
|
1338
1355
|
|
|
1339
1356
|
**The pick rule** (which target the pointer is over: the lowest priority number, then the smallest zone, every piece of
|
|
1340
1357
|
`hits` counted, a rect holding its edges exactly) is `@n-uf/motion/drag`'s `targetAt`, the rule the drag intent runs.
|
|
@@ -529,6 +529,25 @@ function floatFloor(item, form, orient2, size) {
|
|
|
529
529
|
height: item.floatMin ? px(item.floatMin.height) : Math.min(size.height, px(row ? form?.cross.min : form?.main.min))
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
|
+
function clearSize(region, avoid) {
|
|
533
|
+
const span = (axis) => {
|
|
534
|
+
const lo = axis === "y" ? region.y : region.x;
|
|
535
|
+
const hi = lo + (axis === "y" ? region.height : region.width);
|
|
536
|
+
const mid = (lo + hi) / 2;
|
|
537
|
+
let a = lo;
|
|
538
|
+
let b = hi;
|
|
539
|
+
for (const r of avoid) {
|
|
540
|
+
const whole = axis === "y" ? r.x <= region.x + EPS && r.x + r.width >= region.x + region.width - EPS : r.y <= region.y + EPS && r.y + r.height >= region.y + region.height - EPS;
|
|
541
|
+
const s = axis === "y" ? r.y : r.x;
|
|
542
|
+
const e = s + (axis === "y" ? r.height : r.width);
|
|
543
|
+
if (!whole || e <= lo || s >= hi) continue;
|
|
544
|
+
if (s + e <= 2 * mid) a = Math.max(a, e);
|
|
545
|
+
else b = Math.min(b, s);
|
|
546
|
+
}
|
|
547
|
+
return Math.max(0, b - a);
|
|
548
|
+
};
|
|
549
|
+
return { width: span("x"), height: span("y") };
|
|
550
|
+
}
|
|
532
551
|
function placeFloat(item, f, region, avoid, content, stage) {
|
|
533
552
|
const shape = floatShape(item, f);
|
|
534
553
|
const from = shape.form;
|
|
@@ -536,9 +555,10 @@ function placeFloat(item, f, region, avoid, content, stage) {
|
|
|
536
555
|
const form = formsOf(item, fo)[from];
|
|
537
556
|
const floor = floatFloor(item, form, fo, shape);
|
|
538
557
|
const cap = { width: Number.isFinite(item.floatMax?.width) ? item.floatMax.width : Infinity, height: Number.isFinite(item.floatMax?.height) ? item.floatMax.height : Infinity };
|
|
539
|
-
const
|
|
558
|
+
const clear = clearSize(region, avoid);
|
|
559
|
+
const w = Math.max(floor.width, Math.min(shape.width, clear.width, cap.width));
|
|
540
560
|
const folded = form?.kind === "header";
|
|
541
|
-
const h = folded ? shape.height : Math.max(floor.height, Math.min(shape.height,
|
|
561
|
+
const h = folded ? shape.height : Math.max(floor.height, Math.min(shape.height, clear.height, cap.height));
|
|
542
562
|
const want = f.anchor ? anchored(content, w, h, f.anchor) : rect(finite(f.rect.x, stage.x), finite(f.rect.y, stage.y), w, h);
|
|
543
563
|
const fit0 = fitFloat(want, region, avoid);
|
|
544
564
|
const fit = w > region.width + EPS ? { ...fit0, rect: rect(region.x, fit0.rect.y, w, fit0.rect.height) } : fit0;
|
|
@@ -2634,4 +2654,4 @@ export {
|
|
|
2634
2654
|
refusals,
|
|
2635
2655
|
stops
|
|
2636
2656
|
};
|
|
2637
|
-
//# sourceMappingURL=chunk-
|
|
2657
|
+
//# sourceMappingURL=chunk-IOTKOYKW.js.map
|