@n-uf/placement 26.11.30 → 26.11.32
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 +53 -0
- package/README.md +38 -4
- package/dist/{chunk-5CSWQSH7.js → chunk-COK4YNMF.js} +58 -14
- package/dist/chunk-COK4YNMF.js.map +1 -0
- package/dist/{model-BxFXr9UY.d.ts → model-BSIKmANw.d.ts} +21 -2
- package/dist/scene-cases.d.ts +26 -3
- package/dist/scene-cases.js +167 -54
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +7 -2
- package/dist/scene.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-5CSWQSH7.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,59 @@
|
|
|
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.32
|
|
7
|
+
|
|
8
|
+
- `./scene/cases`, **`requires.intent`** (additive) and **row R4b-leaving-the-band**: a row that checks what a drag
|
|
9
|
+
intent adds to the pick at a point names `requires: { intent: true }`, and a host without one (the in-memory host)
|
|
10
|
+
skips it. R4b leaves a shown gap from inside its hit: just past the hit the intent's band holds it, past the band
|
|
11
|
+
nothing shows. R4-band-at-a-boundary keeps its id, retitled to what it checks: the hit area's boundary alone.
|
|
12
|
+
- `./scene/cases`, **refusals win, on every host.** The reference host (`createSceneHost`) now honours `refusals()`:
|
|
13
|
+
over a refused tile, where nothing more precise than the float is under the pointer, nothing is picked, and a release
|
|
14
|
+
there puts the item back ("No room here"), as a page does. The rule is `withRefusals(pick, refusals(scene, dragged))`
|
|
15
|
+
(additive), which a page's host also aims `resolvePlace` with. The host contract gains `[data-drag-refusal]` (the
|
|
16
|
+
refusal shown at the pointer, by id). Rows changed with it: **C25** and **P13-kinds** (a panel over a group-only bar
|
|
17
|
+
is refused, the release is home, the refusal shows); **C27** and **P11-a-float-never-covers-chrome** let go just under
|
|
18
|
+
the bar, where nothing refuses, and keep their check that the float lands clear of it. **R4-band-at-a-boundary**
|
|
19
|
+
reaches its "out" point from the content, where nothing is shown, so it reads the geometry alone: holding a shown gap
|
|
20
|
+
a band's width past its hit is the drag intent's rule, covered by `@n-uf/motion/drag`'s tests.
|
|
21
|
+
- `./scene/cases`, **three rows on a bar's zones** (R6, additive): a toolbar dropped in a bar's start zone lands
|
|
22
|
+
leading after the toolbars there, in the center zone at the bar's true center, in the end zone trailing before the
|
|
23
|
+
toolbars there.
|
|
24
|
+
- `./scene/cases`, **four rows on the window's edges** (P16, additive): in a flush window, a panel rested over the float
|
|
25
|
+
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
|
|
26
|
+
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
|
|
27
|
+
column, goes home.
|
|
28
|
+
- `./scene/cases`, **`resizeStep`** (additive): a `resize` gesture as a pure step (`resizeStep(scene, start, layout,
|
|
29
|
+
gesture)` gives the scene and the loaded scene after it: an edge's size, an item measured again, the window's size), so
|
|
30
|
+
a page's case host plays it as the reference host does. The reference host uses it.
|
|
31
|
+
|
|
32
|
+
## 26.11.31
|
|
33
|
+
|
|
34
|
+
- `./scene`, fixed: **a float that already covered a bar grew over it when resized.** `fitResize` stopped a growing edge
|
|
35
|
+
at the nearest obstacle beyond it, and skipped one the float already overlapped, so a float with no clear place at its
|
|
36
|
+
size (a short window, a tall `floatMin`) that lay 8 px over a toolbar went on over the bar, the chrome or a docked item
|
|
37
|
+
when its top, or any edge, was dragged outward. An edge that lies inside an obstacle now stays where it is drawn
|
|
38
|
+
(`"docked"`): a resize never covers more than the float did, and a float clear of everything stops at the obstacle, as
|
|
39
|
+
before. The property test covers both (no float overlaps a bar, chrome or docked item after `resize`; a covering one
|
|
40
|
+
covers no more).
|
|
41
|
+
- `./scene`, **an edge's items in order** (additive): `SceneEdgeLayout.items`, the ids the layout draws for the edge in its
|
|
42
|
+
stack order: the zones in order (start, center, end), then the order within each zone. An item in the » menu keeps its
|
|
43
|
+
place (`menu.items` names those), a rail tab is listed, a closed item is left out; a column folded into its rail or
|
|
44
|
+
riding lists its members in zone order. Nothing like it existed (`stack.items` is the solver's, in stack-local px and
|
|
45
|
+
not meant for hosts), so a host sorted rects; it no longer needs to. `mapLayout` in `./scene/cases` maps it with the
|
|
46
|
+
host's ids.
|
|
47
|
+
- `./scene`, **`stops()` is remembered per scene** (no API change): a scene is an immutable value, so the stops of an item
|
|
48
|
+
of one scene object with the same options are solved once; asking again (a menu redrawn, a kit asking on every render)
|
|
49
|
+
costs a lookup. A `WeakMap` keyed by the scene, then by item and options (by value, `previous` by identity). Each call
|
|
50
|
+
still returns a new array, over the same targets. A first call costs what it did (the solves are one per slot, and an
|
|
51
|
+
item's slots are its own, so a `stopsForAll` could share only the scene's own solve).
|
|
52
|
+
- `./scene`, **why an item is folded** (additive): `SceneItemLayout.foldedBy`, `"hand" | "auto"`, set from the scene's own
|
|
53
|
+
state, never inferred from rects. `"hand"`: the item's `from` is over 0 (`fold` sets it), whatever else gave way after;
|
|
54
|
+
`"auto"`: it gave way, a form below the one it started in, by length or width (a header, an icons form, a » menu entry, a
|
|
55
|
+
rail segment of a column folded by give-way; `"auto"` is the word `folded` already uses for give-way). Absent for an item
|
|
56
|
+
in its first form, a closed one, and the form an icons-only edge gives its items. A float is only ever `"hand"`. A host
|
|
57
|
+
shows "Expand" for `"hand"` only. `folded` still names the item's column.
|
|
58
|
+
|
|
6
59
|
## 26.11.30
|
|
7
60
|
|
|
8
61
|
- `./scene`, fixed: **an occupied rail offered the same move twice.** With a side's tiles width-folded and an item dragged,
|
package/README.md
CHANGED
|
@@ -803,6 +803,17 @@ wider than the room the cut leaves. Group forms in a column take their own width
|
|
|
803
803
|
span it. Spare room goes to the forms that grow, so a column's open panels share its height through `grows` and equal
|
|
804
804
|
naturals. A column where nothing sets the width is a rail: its items that have a `rail` form take it and are listed in
|
|
805
805
|
`edges[id].tabs` (with `railShowsClosed`, closed items too, marked `closed`); the host draws tabs only from the layout.
|
|
806
|
+
`edges[id].items` lists the ids the layout draws for the edge in its stack order: the zones in order (start, center,
|
|
807
|
+
end), then the order within each zone. An item in the » menu keeps its place (`menu.items` names those), a rail tab is
|
|
808
|
+
listed, a closed item is left out, and a column folded into its rail or riding lists its members in zone order. A host
|
|
809
|
+
that needs the order reads it here instead of sorting rects (`stack.items` is the solver's own, in stack-local px).
|
|
810
|
+
|
|
811
|
+
**Why an item is folded.** `SceneItemLayout.foldedBy` says whether the user folded an item or it gave way, from the scene's
|
|
812
|
+
own state and never from rects: `"hand"` when the item's `from` is over 0 (`fold` sets it), whatever else gave way after;
|
|
813
|
+
`"auto"` when it gave way, a form below the one it started in, by length or width (a header, an icons form, a » menu
|
|
814
|
+
entry, a rail segment of a column folded by give-way). It is absent for an item in its first form, a closed one, and
|
|
815
|
+
the form an icons-only edge gives its items; a float is only ever `"hand"`. A host shows "Expand" for `"hand"` only, since
|
|
816
|
+
unfolding an item that gave way is not the user's to do. `folded` still names the item's column.
|
|
806
817
|
|
|
807
818
|
**Rail titles.** A panel may declare two rail forms: its title (`{ kind: "rail", title: true }`, its `main` the length
|
|
808
819
|
of its name and count turned along the rail, measured by the host) and then its tile (a plain `rail` form). In a rail
|
|
@@ -1008,7 +1019,9 @@ shrink below the size drawn now, as `solve` lays it) and `floatMax`, the float i
|
|
|
1008
1019
|
growing edge at what floats are kept clear of (a bar, a docked item, the chrome; such a stop beats the minimum). It
|
|
1009
1020
|
then lays the rect through the one clamp `solve` lays floats with, so `solve` lays the result exactly there. A float
|
|
1010
1021
|
that already covers something (no clear place at its size) may move to a clear place once a resize opens one; the
|
|
1011
|
-
preview is still the commit.
|
|
1022
|
+
preview is still the commit. Such a float never grows over what it covers: a dragged edge that lies inside an obstacle
|
|
1023
|
+
stays where it is drawn (`"docked"`), so a resize never covers more than the float did, and a float clear of everything
|
|
1024
|
+
stops at the obstacle as before. It gives `{ rect, limits }`, `limits` naming what bound it:
|
|
1012
1025
|
`"min"`, `"max"`, `"region"`, `"docked"`. It gives null for anything but a float drawn at a first form that grows (a
|
|
1013
1026
|
panel's card): a toolbar group's size and a folded float's bar come from their forms. On commit (each move, or the
|
|
1014
1027
|
release) `resize(scene, id, rect, moving)` stores that same rect as the float's rect and the item's `floatSize`, so the
|
|
@@ -1220,7 +1233,11 @@ overflows (or holds an item already too wide), a drop that adds no new note is a
|
|
|
1220
1233
|
item that was already squeezed.
|
|
1221
1234
|
|
|
1222
1235
|
`stops(scene, id)` gives the same targets, home and none left out, in reading order (the left side outer to inner, the
|
|
1223
|
-
top bars, the bottom bars, the right side inner to outer, floating last) for "Move to ›" and the arrow keys.
|
|
1236
|
+
top bars, the bottom bars, the right side inner to outer, floating last) for "Move to ›" and the arrow keys. A scene is
|
|
1237
|
+
an immutable value, so `stops` remembers its answer per scene object: the stops of an item of one scene object with the
|
|
1238
|
+
same options (`previous` by identity) are solved once, and asking again (a menu redrawn, a host asking on every render)
|
|
1239
|
+
costs a lookup. Each call still returns a new array over the same targets. Pass a changed scene (a new object) to get
|
|
1240
|
+
fresh stops; mutating a scene in place is not supported.
|
|
1224
1241
|
|
|
1225
1242
|
Each target's `after(point, grab)` is `{ scene, layout }`: the scene to commit (the item moved and just used) and
|
|
1226
1243
|
`solve(scene, { previous })`. The host draws every item from `after.layout` during the preview and commits
|
|
@@ -1269,7 +1286,8 @@ at, what a user does (`press`, `move`, `release`, `key`, `click`, `resize`, `scr
|
|
|
1269
1286
|
by its `place` instead of pixels), and what must be true after: a partial layout (per item: `rect`, `formKind`, `edge`,
|
|
1270
1287
|
`floating`, `inMenu`, `rail`…, within a tolerance, 0.5 px by default) and, for a host with a page, DOM checks on the
|
|
1271
1288
|
session's marks (`data-drag-session` on the root during a drag only, `[data-drag-slot][data-drag-target]` for the slot
|
|
1272
|
-
(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).
|
|
1273
1291
|
A drawn item's element is `[data-dock-item="<id>"]` by default, and a DOM check names it with `item` (not a literal
|
|
1274
1292
|
selector), optionally pinning its `rect` in stage px; a host that marks items another way gives `itemSelector(id)`. A row
|
|
1275
1293
|
may also carry `checkpoints`: the layout after an earlier gesture, for what the preview shows while the
|
|
@@ -1317,7 +1335,23 @@ draws the preview from its `after.layout` and commits `after.scene` on release,
|
|
|
1317
1335
|
it as `previous`. An integrating app's host does the same with its own pointer; `resolvePlace(targets, place, item, { stage, content
|
|
1318
1336
|
}, pick)` turns a `place` into a point that reaches the target. Every row
|
|
1319
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
|
|
1320
|
-
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.
|
|
1321
1355
|
|
|
1322
1356
|
**The pick rule** (which target the pointer is over: the lowest priority number, then the smallest zone, every piece of
|
|
1323
1357
|
`hits` counted, a rect holding its edges exactly) is `@n-uf/motion/drag`'s `targetAt`, the rule the drag intent runs.
|
|
@@ -96,6 +96,12 @@ function floatSizeOf(item, orient2 = floatOrientOf(item)) {
|
|
|
96
96
|
if (main <= 0 || cross <= 0) return DEFAULT_FLOAT_SIZE;
|
|
97
97
|
return orient2 === "row" ? { width: main, height: cross } : { width: cross, height: main };
|
|
98
98
|
}
|
|
99
|
+
function foldedByOf(item, form, start) {
|
|
100
|
+
if (item.closed || form < 1) return void 0;
|
|
101
|
+
if (foldedByHand(item)) return "hand";
|
|
102
|
+
return start !== void 0 && form > start ? "auto" : void 0;
|
|
103
|
+
}
|
|
104
|
+
var foldedByHand = (item) => Number.isFinite(item.from) && Math.floor(item.from) >= 1;
|
|
99
105
|
function pastWrap(forms, from) {
|
|
100
106
|
for (let j = Math.max(0, Math.floor(from)); j < forms.length; j++) if (forms[j].kind !== "wrap" && !forms[j].wrap) return j;
|
|
101
107
|
return void 0;
|
|
@@ -329,6 +335,7 @@ function emit(d, edge, r, solved, extra = {}) {
|
|
|
329
335
|
const drawnRect = toStage(p.rect, inMenu ? void 0 : p.id);
|
|
330
336
|
const f = formsOf(it, column ? "column" : "row")[p.form];
|
|
331
337
|
const shape = inMenu ? {} : shapeOf(f, drawnRect, column ? "column" : "row", stack.cross);
|
|
338
|
+
const foldedBy = foldedByOf(it, p.form, solved.starts.get(p.id));
|
|
332
339
|
items[p.id] = {
|
|
333
340
|
...shape,
|
|
334
341
|
hidden: inMenu ? [] : f?.hides ?? [],
|
|
@@ -342,6 +349,7 @@ function emit(d, edge, r, solved, extra = {}) {
|
|
|
342
349
|
...tabs.has(p.id) ? { tab: true } : {},
|
|
343
350
|
...tabs.has(p.id) && f?.title === true && (edge.side === "left" || edge.side === "right") ? { railTitle: edge.side } : {},
|
|
344
351
|
...solved.closedTabs.has(p.id) ? { closed: true } : {},
|
|
352
|
+
...foldedBy ? { foldedBy } : {},
|
|
345
353
|
...it.fixed ? { fixed: true } : {}
|
|
346
354
|
};
|
|
347
355
|
}
|
|
@@ -352,6 +360,8 @@ function emit(d, edge, r, solved, extra = {}) {
|
|
|
352
360
|
rect: r,
|
|
353
361
|
cross: thick,
|
|
354
362
|
menu: stack.menu ? { rect: toStage(stack.menu.rect), items: stack.menu.items } : null,
|
|
363
|
+
// The stack's items are in zone order, the order `emit` drew them in.
|
|
364
|
+
items: stack.items.map((p) => p.id),
|
|
355
365
|
tabs: solved.tabs,
|
|
356
366
|
stack,
|
|
357
367
|
free: solved.free,
|
|
@@ -372,6 +382,7 @@ function hasSetter(fit, forms) {
|
|
|
372
382
|
return fit.items.some((p) => p.kind !== "menu" && formSetsCross(forms(p.id)[p.form]));
|
|
373
383
|
}
|
|
374
384
|
var TRAY_RANK = 100;
|
|
385
|
+
var startsOf = (input) => new Map(input.items.map((i) => [i.id, i.from ?? 0]));
|
|
375
386
|
function compactEdge(f) {
|
|
376
387
|
const { scene, formsById } = f;
|
|
377
388
|
const iconsAt = (id) => {
|
|
@@ -383,9 +394,9 @@ function compactEdge(f) {
|
|
|
383
394
|
const leftOutIcons = f.ordered.filter((id) => !scene.items[id].closed && iconsAt(id) < 0);
|
|
384
395
|
const compactInput = { ...f.base, ownCross: false, items: shown.map((id) => stackItemOf(scene.items[id], formsById(id), iconsAt(id))) };
|
|
385
396
|
const stack = fitStack(compactInput, f.previous ? { previous: f.previous.free } : {});
|
|
386
|
-
return { stack, free: stack, tabs: [], closedTabs: /* @__PURE__ */ new Set(), input: compactInput, leftOutIcons };
|
|
397
|
+
return { stack, free: stack, tabs: [], closedTabs: /* @__PURE__ */ new Set(), input: compactInput, starts: startsOf(compactInput), leftOutIcons };
|
|
387
398
|
}
|
|
388
|
-
function railEdge(f, free, asStackItem) {
|
|
399
|
+
function railEdge(f, free, asStackItem, starts) {
|
|
389
400
|
const { scene, edge, formsById } = f;
|
|
390
401
|
const railIndex = (item, forms) => {
|
|
391
402
|
if (item.fixed) return -1;
|
|
@@ -415,7 +426,7 @@ function railEdge(f, free, asStackItem) {
|
|
|
415
426
|
const stack = fitStack(railInput, f.previous ? { previous: f.previous.stack } : {});
|
|
416
427
|
const tabs = stack.items.filter((p) => p.kind === "rail").map((p) => p.id);
|
|
417
428
|
const closedTabs = new Set(shown.filter((id) => scene.items[id].closed));
|
|
418
|
-
return { stack, free, tabs, closedTabs, input: railInput, leftOut };
|
|
429
|
+
return { stack, free, tabs, closedTabs, input: railInput, starts, leftOut };
|
|
419
430
|
}
|
|
420
431
|
function solveEdge(scene, edge, ids, length, room, previous) {
|
|
421
432
|
const axis = axisOf(edge.side);
|
|
@@ -458,8 +469,9 @@ function solveEdge(scene, edge, ids, length, room, previous) {
|
|
|
458
469
|
const input = { ...base, items: open2.map(asStackItem) };
|
|
459
470
|
const free = fitStack(input, previous ? { previous: previous.free } : {});
|
|
460
471
|
const none = /* @__PURE__ */ new Set();
|
|
472
|
+
const starts = startsOf(input);
|
|
461
473
|
if (column && !hasSetter(free, formsById)) {
|
|
462
|
-
const rail = railEdge(frame, free, asStackItem);
|
|
474
|
+
const rail = railEdge(frame, free, asStackItem, starts);
|
|
463
475
|
if (rail) return rail;
|
|
464
476
|
}
|
|
465
477
|
const size = edge.size;
|
|
@@ -470,10 +482,10 @@ function solveEdge(scene, edge, ids, length, room, previous) {
|
|
|
470
482
|
if (Math.abs(s - free.cross) > EPS) {
|
|
471
483
|
const sized = { ...input, cross: { ...cross, min: s, max: s } };
|
|
472
484
|
const stack = fitStack(sized, previous ? { previous: previous.stack } : {});
|
|
473
|
-
return { stack, free, tabs: [], closedTabs: none, input: sized };
|
|
485
|
+
return { stack, free, tabs: [], closedTabs: none, input: sized, starts };
|
|
474
486
|
}
|
|
475
487
|
}
|
|
476
|
-
return { stack: free, free, tabs: [], closedTabs: none, input };
|
|
488
|
+
return { stack: free, free, tabs: [], closedTabs: none, input, starts };
|
|
477
489
|
}
|
|
478
490
|
|
|
479
491
|
// src/scene/solve/bars.ts
|
|
@@ -556,7 +568,8 @@ function layFloats(d, stage, content, inset) {
|
|
|
556
568
|
if (fit.clamped) notes.push({ code: "float-clamped", id: f.id });
|
|
557
569
|
if (fit.snapped) notes.push({ code: "float-moved", id: f.id });
|
|
558
570
|
if (fit.covers.length > 0) notes.push({ code: "float-covers", id: f.id });
|
|
559
|
-
|
|
571
|
+
const foldedBy = foldedByOf(it, from);
|
|
572
|
+
items[f.id] = { ...shapeOf(form, fit.rect, fo, fit.rect.width), hidden: form?.hides ?? [], rect: fit.rect, kind: it.kind, form: from, formKind: form?.kind ?? "open", floating: true, ...foldedBy ? { foldedBy } : {} };
|
|
560
573
|
floats.push(f.id);
|
|
561
574
|
}
|
|
562
575
|
return floats;
|
|
@@ -749,10 +762,10 @@ function layRiders(d, host, riders, top) {
|
|
|
749
762
|
for (const b of bars) {
|
|
750
763
|
const at = rect(hr.x, y, hr.width, b.h);
|
|
751
764
|
const it = scene.items[b.id];
|
|
752
|
-
items[b.id] = { rect: at, hidden: b.f?.hides ?? [], kind: it.kind, form: b.form, formKind: b.f?.kind ?? "header", edge: c.edge.id, zone: zoneOf(it), rides: host.edge.id, folded: "hand" };
|
|
765
|
+
items[b.id] = { rect: at, hidden: b.f?.hides ?? [], kind: it.kind, form: b.form, formKind: b.f?.kind ?? "header", edge: c.edge.id, zone: zoneOf(it), rides: host.edge.id, folded: "hand", foldedBy: "hand" };
|
|
753
766
|
y += b.h;
|
|
754
767
|
}
|
|
755
|
-
edges[c.edge.id] = { side: c.edge.side, ring: finite(c.edge.ring, 0), rect: rect(hr.x, y0, hr.width, y - y0), cross: 0, menu: null, tabs: [], stack: c.solved.stack, free: c.solved.free, rides: host.edge.id, folded: "hand" };
|
|
768
|
+
edges[c.edge.id] = { side: c.edge.side, ring: finite(c.edge.ring, 0), rect: rect(hr.x, y0, hr.width, y - y0), cross: 0, menu: null, items: bars.map((b) => b.id), tabs: [], stack: c.solved.stack, free: c.solved.free, rides: host.edge.id, folded: "hand" };
|
|
756
769
|
}
|
|
757
770
|
}
|
|
758
771
|
function layRail(d, side, railRect, railed, g) {
|
|
@@ -794,7 +807,7 @@ function layRail(d, side, railRect, railed, g) {
|
|
|
794
807
|
const form = p ? p.form : ri >= 0 ? ri : Math.min(Math.max(0, Math.floor(finite(it.from, 0))), Math.max(0, forms.length - 1));
|
|
795
808
|
const at = p ? rect(railRect.x, railRect.y + p.rect.y, railRect.width, p.rect.height) : rect(railRect.x, y, railRect.width, ri >= 0 ? px(forms[ri].main.natural) : railRect.width);
|
|
796
809
|
const title = forms[form]?.title === true;
|
|
797
|
-
items[id] = { rect: at, hidden: forms[form]?.hides ?? [], kind: it.kind, form, formKind: "rail", edge: c.edge.id, zone: zoneOf(it), rail: side, ...title ? { railTitle: side } : {}, folded: g.auto.has(c) ? "auto" : "hand" };
|
|
810
|
+
items[id] = { rect: at, hidden: forms[form]?.hides ?? [], kind: it.kind, form, formKind: "rail", edge: c.edge.id, zone: zoneOf(it), rail: side, ...title ? { railTitle: side } : {}, folded: g.auto.has(c) ? "auto" : "hand", foldedBy: foldedByHand(it) ? "hand" : "auto" };
|
|
798
811
|
segments.push({ id, edge: c.edge.id, rect: at });
|
|
799
812
|
y += at.height;
|
|
800
813
|
}
|
|
@@ -851,7 +864,7 @@ function laySide(d, side, cols, g, area2, f, walk, upInset, tall) {
|
|
|
851
864
|
}
|
|
852
865
|
}
|
|
853
866
|
if (outsideSideBar(c)) barLaid = true;
|
|
854
|
-
const base = { side: c.edge.side, ring: finite(c.edge.ring, 0), cross: 0, menu: null, tabs: [], stack: c.solved.stack, free: c.solved.free };
|
|
867
|
+
const base = { side: c.edge.side, ring: finite(c.edge.ring, 0), cross: 0, menu: null, items: zoneSorted(scene, c.visible), tabs: [], stack: c.solved.stack, free: c.solved.free };
|
|
855
868
|
if (g.railed(c)) {
|
|
856
869
|
edges[c.edge.id] = { ...base, rect: rect(railRect.x, area2.y, 0, H), folded: g.auto.has(c) ? "auto" : "hand" };
|
|
857
870
|
continue;
|
|
@@ -946,8 +959,16 @@ function obstacleStop(drawn, obstacles, axis, drag, span) {
|
|
|
946
959
|
for (const o of obstacles) {
|
|
947
960
|
const [c0, c1] = across2(o);
|
|
948
961
|
if (c0 >= span[1] - TOUCH || c1 <= span[0] + TOUCH) continue;
|
|
949
|
-
|
|
950
|
-
|
|
962
|
+
const begin = lo(o);
|
|
963
|
+
const finish = begin + len(o);
|
|
964
|
+
const edge = drag === "start" ? lo(drawn) : lo(drawn) + len(drawn);
|
|
965
|
+
if (drag === "start") {
|
|
966
|
+
if (finish <= edge + EPS2) at = Math.max(at, finish);
|
|
967
|
+
else if (begin < edge - TOUCH) at = edge;
|
|
968
|
+
} else {
|
|
969
|
+
if (begin >= edge - EPS2) at = Math.min(at, begin);
|
|
970
|
+
else if (finish > edge + TOUCH) at = edge;
|
|
971
|
+
}
|
|
951
972
|
}
|
|
952
973
|
return drag === "start" ? Math.min(at, lo(drawn)) : Math.max(at, lo(drawn) + len(drawn));
|
|
953
974
|
}
|
|
@@ -2526,6 +2547,29 @@ function refusals(scene, dragged, options = {}) {
|
|
|
2526
2547
|
}
|
|
2527
2548
|
var SIDE_RANK = { left: 0, top: 1, bottom: 2, right: 3 };
|
|
2528
2549
|
function stops(scene, dragged, options = {}) {
|
|
2550
|
+
const key = stopsKey(dragged, options);
|
|
2551
|
+
let memo = stopsMemo.get(scene);
|
|
2552
|
+
if (!memo) stopsMemo.set(scene, memo = /* @__PURE__ */ new Map());
|
|
2553
|
+
let list = memo.get(key);
|
|
2554
|
+
if (!list) {
|
|
2555
|
+
if (memo.size >= STOPS_PER_SCENE) memo.clear();
|
|
2556
|
+
memo.set(key, list = orderedStops(scene, dragged, options));
|
|
2557
|
+
}
|
|
2558
|
+
return [...list];
|
|
2559
|
+
}
|
|
2560
|
+
var stopsMemo = /* @__PURE__ */ new WeakMap();
|
|
2561
|
+
var STOPS_PER_SCENE = 512;
|
|
2562
|
+
var layoutIds = /* @__PURE__ */ new WeakMap();
|
|
2563
|
+
var nextLayoutId = 0;
|
|
2564
|
+
function stopsKey(dragged, o) {
|
|
2565
|
+
let prev = null;
|
|
2566
|
+
if (o.previous) {
|
|
2567
|
+
prev = layoutIds.get(o.previous) ?? nextLayoutId++;
|
|
2568
|
+
layoutIds.set(o.previous, prev);
|
|
2569
|
+
}
|
|
2570
|
+
return JSON.stringify([dragged, prev, o.endReach ?? null, o.floatOrient ?? null, o.floatSize ? [o.floatSize.width, o.floatSize.height] : null, o.fresh ?? null]);
|
|
2571
|
+
}
|
|
2572
|
+
function orderedStops(scene, dragged, options) {
|
|
2529
2573
|
const list = targets(scene, dragged, options).filter((t) => t.place.kind !== "home" && t.place.kind !== "none");
|
|
2530
2574
|
const sideOf = (t) => {
|
|
2531
2575
|
const p = t.place;
|
|
@@ -2590,4 +2634,4 @@ export {
|
|
|
2590
2634
|
refusals,
|
|
2591
2635
|
stops
|
|
2592
2636
|
};
|
|
2593
|
-
//# sourceMappingURL=chunk-
|
|
2637
|
+
//# sourceMappingURL=chunk-COK4YNMF.js.map
|