@n-uf/placement 26.11.23 → 26.11.25

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +72 -31
  3. package/dist/{chunk-LPMZ2FFR.js → chunk-3P6VOXA6.js} +2 -2
  4. package/dist/chunk-3P6VOXA6.js.map +1 -0
  5. package/dist/{chunk-CJA6LRHN.js → chunk-7ASCUAGV.js} +5 -7
  6. package/dist/chunk-7ASCUAGV.js.map +1 -0
  7. package/dist/{chunk-RL3QB5SM.js → chunk-KGZCYLQN.js} +10 -10
  8. package/dist/chunk-KGZCYLQN.js.map +1 -0
  9. package/dist/{chunk-2H3CSPEH.js → chunk-OYGOJWAX.js} +2 -2
  10. package/dist/{chunk-6WFVXHA3.js → chunk-SZKU7CRX.js} +582 -501
  11. package/dist/chunk-SZKU7CRX.js.map +1 -0
  12. package/dist/chunk-WM5FJ3IS.js +47 -0
  13. package/dist/chunk-WM5FJ3IS.js.map +1 -0
  14. package/dist/{constructions-VDK_mwmz.d.ts → constructions-DSEjvWMP.d.ts} +1 -1
  15. package/dist/desk.d.ts +3 -3
  16. package/dist/desk.js +3 -3
  17. package/dist/dock.d.ts +3 -3
  18. package/dist/dock.js +2 -2
  19. package/dist/geometry-CkZ6Fcfb.d.ts +48 -0
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.js +21 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/{model-DPTu2EtG.d.ts → model-mm16NrSX.d.ts} +1 -1
  24. package/dist/panels.d.ts +5 -4
  25. package/dist/panels.js +6 -5
  26. package/dist/scene-cases.d.ts +4 -4
  27. package/dist/scene-cases.js +15 -16
  28. package/dist/scene-cases.js.map +1 -1
  29. package/dist/scene.d.ts +5 -39
  30. package/dist/scene.js +5 -3
  31. package/dist/stack.d.ts +4 -4
  32. package/dist/stack.js +2 -2
  33. package/dist/stack.js.map +1 -1
  34. package/dist/{target-D3PiLg44.d.ts → target-C-HJjPcz.d.ts} +1 -1
  35. package/dist/{targets-B6eLC-52.d.ts → targets-CBpO_LEy.d.ts} +4 -6
  36. package/dist/{targets-DgmHP5PY.d.ts → targets-CDR5Towj.d.ts} +83 -65
  37. package/dist/targets.d.ts +4 -4
  38. package/dist/targets.js +6 -7
  39. package/dist/targets.js.map +1 -1
  40. package/dist/toolbar.d.ts +1 -1
  41. package/package.json +1 -1
  42. package/dist/chunk-6WFVXHA3.js.map +0 -1
  43. package/dist/chunk-CJA6LRHN.js.map +0 -1
  44. package/dist/chunk-LPMZ2FFR.js.map +0 -1
  45. package/dist/chunk-QMTNB2C3.js +0 -17
  46. package/dist/chunk-QMTNB2C3.js.map +0 -1
  47. package/dist/chunk-RL3QB5SM.js.map +0 -1
  48. package/dist/geometry-mL-GTRti.d.ts +0 -28
  49. /package/dist/{chunk-2H3CSPEH.js.map → chunk-OYGOJWAX.js.map} +0 -0
package/dist/scene.d.ts CHANGED
@@ -1,42 +1,8 @@
1
- import { S as Scene, g as SolveOptions, b as SceneLayout } from './targets-DgmHP5PY.js';
2
- export { C as ColumnPlace, h as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, i as DEFAULT_HIT_BAND, j as DEFAULT_STRIP, k as DockPlace, E as Edge, F as FloatAnchor, l as FloatPlace, K as Kind, O as Orient, P as Place, R as RailPlace, m as RailSpec, n as SIDES, o as SceneAfter, p as SceneEdgeLayout, q as SceneFloat, r as SceneItem, s as SceneItemLayout, t as SceneNote, e as SceneNoteCode, a as ScenePlace, u as SceneRailLayout, v as SceneRead, w as SceneRefusal, f as SceneTarget, x as SceneTargetOptions, d as Side, c as StoredScene, y as StoredSceneEdge, z as StoredSceneFloat, A as StoredSceneItem, B as ZONES, Z as Zone, G as ZoneAccepts, H as close, I as dockHome, J as floatAt, L as floatOrientOf, M as floatSizeOf, N as fold, Q as homeFor, T as isOutsideSideBar, U as keep, V as lift, W as moveTo, X as open, Y as orient, _ as raise, $ as readScene, a0 as refusals, a1 as reservedRect, a2 as resize, a3 as setSide, a4 as stops, a5 as storeScene, a6 as targets, a7 as use, a8 as zoneTakes, a9 as zonesTaking } from './targets-DgmHP5PY.js';
3
- import './geometry-mL-GTRti.js';
4
- import './target-D3PiLg44.js';
5
- import './model-DPTu2EtG.js';
6
-
7
- /**
8
- * `solve(scene, { previous })`: the whole window's layout from one scene.
9
- *
10
- * 1. **The cut.** Reserved edges cut the stage from the outside in: first the full-span bars (top, then bottom, each
11
- * by ring), across the stage's whole width; then the columns (left, then right, by ring), down the height the full
12
- * bars left; then the `between` bars, across the width the columns left. What remains is `content`. Overlay edges
13
- * are cut the same way from a copy of the content, so they lie over it without shortening it.
14
- * 2. **Each edge is a stack** (`fitStack`): a column along the height it gets, a bar along the width, with each item's
15
- * `forms.column` or `forms.row`. Items are taken in zone order (start, center, end); `fixed` items keep their form;
16
- * closed items take no room. In a column, group forms take their own width (`ownCross`). The edge's thickness is
17
- * the stack's cross size; an edge with nothing in it takes none.
18
- * 3. **Rail and size.** A column in which nothing sets the width is a rail: its items with a `rail` form are re-solved
19
- * in it and listed as `tabs` (closed ones too with `railShowsClosed`). Otherwise, with `Edge.size`, the column is
20
- * re-solved at the user's size, clamped to `[max(cross.min, the widest open setter's cross.min), cross.max]`.
21
- * 4. **Zones.** When the items leave spare length (nothing grows), start items pack from the start, end items from the
22
- * end (before the » entry) and center items sit centred on the edge's middle, moved only as far as they must to
23
- * stay between the other two zones.
24
- * 5. **Floats** are fitted inside the stage, clear of every docked item (fixed ones and » entries included), every bar
25
- * and the chrome rects (`fitFloat`). An anchored float sits flush with that side or corner of `content` first. A
26
- * float with `from` over 0 is its bar: its form's natural length along its `orient`, its other size kept.
27
- *
28
- * 6. **Dynamic columns** (`Edge.column`, on a side with `Scene.rails[side]`): while the content is narrower than
29
- * `contentMin.width` (after `inset` and a `gutter` after each side edge and rail), they shrink toward their minimum
30
- * (the edge's `cross.min` and the widest open setter's), then fold whole into their side's one rail, unkept before
31
- * kept, the oldest newest use first, the outer first, the left first. A column whose members are all folded by hand
32
- * goes to the rail too, or with `handFold: "ride"` and one member it rides as a title bar over the side's first open
33
- * column, at its width, taking none. The rail lies just outside the side's first column, its segments (each member's
34
- * `rail` form) in ring order.
35
- *
36
- * `previous` (the layout before) gives each edge's fits to `fitStack` as `previous`, so a change of ages alone (a press)
37
- * changes no rect; columns folded or shrunk by give-way stay so while the content still fits, and room coming back
38
- * unfolds them in the reverse of give-way order. Pure: the same scene always lays out the same.
39
- */
1
+ import { S as Scene, g as SolveOptions, b as SceneLayout } from './targets-CDR5Towj.js';
2
+ export { C as ColumnPlace, h as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, i as DEFAULT_HIT_BAND, j as DEFAULT_STRIP, k as DockPlace, E as Edge, F as FloatAnchor, l as FloatPlace, K as Kind, O as Orient, P as Place, R as RailPlace, m as RailSpec, n as SIDES, o as SceneAfter, p as SceneEdgeLayout, q as SceneFloat, r as SceneItem, s as SceneItemLayout, t as SceneNote, e as SceneNoteCode, a as ScenePlace, u as SceneRailLayout, v as SceneRead, w as SceneRefusal, f as SceneTarget, x as SceneTargetOptions, d as Side, c as StoredScene, y as StoredSceneEdge, z as StoredSceneFloat, A as StoredSceneItem, B as ZONES, Z as Zone, G as ZoneAccepts, H as close, I as dockHome, J as floatAt, L as floatOrientOf, M as floatSizeOf, N as fold, Q as homeFor, T as isOutsideSideBar, U as isSideBar, V as keep, W as lift, X as moveTo, Y as open, _ as orient, $ as raise, a0 as readScene, a1 as refusals, a2 as reservedRect, a3 as resize, a4 as setSide, a5 as stops, a6 as storeScene, a7 as targets, a8 as use, a9 as zoneTakes, aa as zonesTaking } from './targets-CDR5Towj.js';
3
+ import './geometry-CkZ6Fcfb.js';
4
+ import './target-C-HJjPcz.js';
5
+ import './model-mm16NrSX.js';
40
6
 
41
7
  declare function solve(given: Scene, options?: SolveOptions): SceneLayout;
42
8
 
package/dist/scene.js CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  fold,
13
13
  homeFor,
14
14
  isOutsideSideBar,
15
+ isSideBar,
15
16
  keep,
16
17
  lift,
17
18
  moveTo,
@@ -30,9 +31,9 @@ import {
30
31
  use,
31
32
  zoneTakes,
32
33
  zonesTaking
33
- } from "./chunk-6WFVXHA3.js";
34
- import "./chunk-RL3QB5SM.js";
35
- import "./chunk-QMTNB2C3.js";
34
+ } from "./chunk-SZKU7CRX.js";
35
+ import "./chunk-KGZCYLQN.js";
36
+ import "./chunk-WM5FJ3IS.js";
36
37
  export {
37
38
  DEFAULT_FLOAT_SIZE,
38
39
  DEFAULT_HIT_BAND,
@@ -47,6 +48,7 @@ export {
47
48
  fold,
48
49
  homeFor,
49
50
  isOutsideSideBar,
51
+ isSideBar,
50
52
  keep,
51
53
  lift,
52
54
  moveTo,
package/dist/stack.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { d as StackInput, F as FitOptions, b as StackFit, e as StackItem } from './model-DPTu2EtG.js';
2
- export { C as CrossLimits, D as DEFAULT_MENU, f as DEFAULT_RAIL, G as GroupFormKind, M as MainSize, P as PanelFormKind, g as PlacedStackItem, h as StackAxis, a as StackForm, S as StackFormKind, i as StackMenu, c as StackNote, j as StackNoteCode, k as StackStep, W as WrapSpec, l as formCrossMin, m as formFitsCross, n as formMain, o as formSetsCross, w as withItem, p as wrapCross, q as wrapLines, r as wrapRows } from './model-DPTu2EtG.js';
3
- import { R as Rect, P as Point, S as Size } from './geometry-mL-GTRti.js';
4
- import { T as Target } from './target-D3PiLg44.js';
1
+ import { d as StackInput, F as FitOptions, b as StackFit, e as StackItem } from './model-mm16NrSX.js';
2
+ export { C as CrossLimits, D as DEFAULT_MENU, f as DEFAULT_RAIL, G as GroupFormKind, M as MainSize, P as PanelFormKind, g as PlacedStackItem, h as StackAxis, a as StackForm, S as StackFormKind, i as StackMenu, c as StackNote, j as StackNoteCode, k as StackStep, W as WrapSpec, l as formCrossMin, m as formFitsCross, n as formMain, o as formSetsCross, w as withItem, p as wrapCross, q as wrapLines, r as wrapRows } from './model-mm16NrSX.js';
3
+ import { R as Rect, P as Point, S as Size } from './geometry-CkZ6Fcfb.js';
4
+ import { T as Target } from './target-C-HJjPcz.js';
5
5
 
6
6
  /**
7
7
  * `fitStack(input, options?)`. With `options.previous` (the fit the stack had before) the forms it chose are kept while
package/dist/stack.js CHANGED
@@ -17,10 +17,10 @@ import {
17
17
  wrapCross,
18
18
  wrapLines,
19
19
  wrapRows
20
- } from "./chunk-RL3QB5SM.js";
20
+ } from "./chunk-KGZCYLQN.js";
21
21
  import {
22
22
  rect
23
- } from "./chunk-QMTNB2C3.js";
23
+ } from "./chunk-WM5FJ3IS.js";
24
24
 
25
25
  // src/stack/targets.ts
26
26
  function bounds(input, fit, reach) {
package/dist/stack.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/stack/targets.ts"],"sourcesContent":["/**\n * The drop targets for dragging an item into a stack, in the shape @n-uf/motion/drag takes. `stackTargets(input,\n * dragged)` gives one target for every gap of the stack without the dragged item (an item of the input with its id\n * is lifted out first, so a reorder within a stack works): before each item and after the last, so an empty stack has\n * one. An item with no forms has no place of its own, but its gaps count.\n *\n * - `id` `gap:<k>`, priority 2, `place` `{ kind: \"gap\", at: k }` (k counts the input's items, the dragged one lifted\n * out, including any with no forms; it is not an index into `fit.items`, which leaves those out: look the dragged\n * item up there by its id, as `slot` already does).\n * - `hit`: the gap's zone along the axis, the stack split at its items' middles, so it covers the gap and the padding\n * between its neighbours; the first and the last reach `options.endReach` px past the stack's ends (an item in the menu has no place of\n * its own: the gaps next to it split the stretch where the stack's drawn items end; with every item in the menu only\n * the last gap, \"at the end\", has any length, and the others are a point at the start). Across, it is the larger of\n * the stack's current size and the size the drop gives it, so the pointer over the preview is over the target.\n * - `fit`: the full `fitStack` of the stack with the dragged item inserted at k, and `input` the stack that was\n * solved. The preview is `slot`, the dragged item's rect in `fit`: exactly the rect it gets after the drop, because\n * the drop is that same solve. `marker` is the line where its leading edge lands: a rect with no thickness across\n * the stack's cross size (the app draws it with one).\n *\n * The dragged item counts as just used: it is newer than every item in the stack, so the others give way before it.\n * A group lands in the form that fits; a panel that would set a wider column makes room by that solve too. A dragged\n * item with no forms has no targets, nor has a `fixed` one (it is never dragged). A fixed item in the stack has no slot\n * inside it: the gaps before and after it stay, but the hit of a gap ends where the fixed item starts and the next one\n * begins where it ends, so no hit overlaps it. Nor has one the stack doesn't accept (`input.accepts`); `options.allows` leaves out\n * single gaps.\n */\nimport { rect, type Rect } from \"../geometry\";\nimport type { Target } from \"../targets/target\";\nimport { fitStack } from \"./layout\";\nimport { formMain, withItem, type FitOptions, type PlacedStackItem, type StackFit, type StackInput, type StackItem } from \"./model\";\n\nexport interface StackTargetOptions {\n /**\n * How far the first gap's hit reaches before the stack's start and the last gap's past its end, px (default 0), so a\n * pointer just outside the bar still drops at an end. The marker and the preview don't move.\n */\n readonly endReach?: number;\n /**\n * The stack's fit before the drag, as `fitStack`'s `previous`: the preview of every gap keeps the other items' forms while\n * they still fit, so it is the fit the drop makes when the app solves with the same `previous`.\n */\n readonly previous?: StackFit;\n /**\n * Whether a gap takes the dragged item (default: every gap does). Called with the dragged item and the gap's `at`\n * (`place.at`: the gap before the k-th item of the input with the dragged one lifted out). A gap it refuses has no\n * target; the others keep their ids, places and hits. The stack's own `accepts` is asked first, for the whole stack.\n */\n readonly allows?: (dragged: StackItem, at: number) => boolean;\n /**\n * Offer a gap only where the dragged item fits beside the others (default false: every gap is offered, the dragged item\n * landing in the » menu or the stack overflowing if need be). With it a gap has no target when its fit puts the dragged\n * item into the menu, has an `overflow` note, has a `too-wide` note that the stack without the dragged item didn't have,\n * or squeezes a `fixed` item: it is in another form, shorter along the stack than its form's `main.min`, or narrower\n * across than before the drop. A fixed item may shrink down to its `main.min` to make room, so the room for the others\n * is the length less the fixed items' minimum sizes. The gaps left keep their ids, hits and fits. With no room anywhere\n * the result is `[]`.\n */\n readonly onlyFits?: boolean;\n}\n\nexport type StackPlace = { readonly kind: \"gap\"; readonly at: number };\n\nexport interface StackTarget extends Target {\n readonly priority: 2;\n /** The item dragged. */\n readonly item: string;\n readonly place: StackPlace;\n /** The line where the dragged item's leading edge lands. */\n readonly marker: Rect;\n /** The stack with the dragged item inserted: what a drop here makes. */\n readonly input: StackInput;\n /** Its fit: the preview and the drop are both its rect for the dragged item. */\n readonly fit: StackFit;\n}\n\n/**\n * Where each gap's zone runs along the axis: gap k from `from[k]` to `to[k]`. The stack is split at its items' middles,\n * so gap k reaches from the middle of item k - 1 to the middle of item k; `from[0]` is `reach` before the start, `to[n]`\n * `reach` past the length. A fixed item has no middle to split at: the gap before it ends where it starts and the gap\n * after it begins where it ends, so its own area is in no gap's zone.\n */\nfunction bounds(input: StackInput, fit: StackFit, reach: number): { from: number[]; to: number[] } {\n const column = input.axis === \"column\";\n const start = (r: Rect): number => (column ? r.y : r.x);\n const size = (r: Rect): number => (column ? r.height : r.width);\n const placed = new Map(fit.items.map((p) => [p.id, p]));\n // from[0], to[0], from[1], to[1], …, from[n], to[n], in the order along the stack.\n const c = [0];\n // Where the drawn items have ended so far: an item in the menu (or with no forms) sits there.\n let end = 0;\n let cap = fit.length;\n for (const it of input.items) {\n const p = placed.get(it.id);\n if (!p || p.kind === \"menu\") {\n c.push(end, end);\n continue;\n }\n const s = start(p.rect);\n const mid = s + size(p.rect) / 2;\n c.push(it.fixed ? s : mid, it.fixed ? s + size(p.rect) : mid);\n end = s + size(p.rect);\n // A fixed item that runs past the stack (an overflowing one) keeps its own area out of the zones.\n if (it.fixed) cap = Math.max(cap, end);\n }\n c.push(fit.length);\n // Monotone, whatever the sizes did (a stack that overflows).\n for (let i = 1; i < c.length; i++) c[i] = Math.min(Math.max(c[i]!, c[i - 1]!), cap);\n // The first and last gaps reach past the stack's ends (the last never starts before a fixed item ends).\n c[0] = 0 - reach;\n c[c.length - 1] = Math.max(fit.length + reach, c[c.length - 2]!);\n const from: number[] = [];\n const to: number[] = [];\n for (let k = 0; k <= input.items.length; k++) {\n from.push(c[2 * k]!);\n to.push(c[2 * k + 1]!);\n }\n return { from, to };\n}\n\n/**\n * Whether a drop's fit leaves room for the dragged item: it isn't in the » menu, the stack doesn't `overflow`, no item\n * is `too-wide` that wasn't before (the dragged one, or one the drop made too wide), and no fixed item is squeezed: it\n * keeps its form, is drawn at least as long along the stack as its form's `main.min` and at least as wide across as before\n * the drop. A fixed item may shrink down to its `main.min` to make room (a title that grows gives back what it took).\n */\nfunction fitsBeside(\n base: StackFit,\n fit: StackFit,\n dragged: PlacedStackItem,\n fixed: ReadonlyMap<string, StackItem>,\n axis: StackInput[\"axis\"],\n tooWideBefore: ReadonlySet<string>,\n): boolean {\n if (dragged.kind === \"menu\") return false;\n for (const n of fit.notes) {\n if (n.code === \"overflow\") return false;\n if (n.code === \"too-wide\" && !tooWideBefore.has(n.id)) return false;\n }\n const main = (r: Rect): number => (axis === \"column\" ? r.height : r.width);\n const across = (r: Rect): number => (axis === \"column\" ? r.width : r.height);\n const was = new Map(base.items.map((p) => [p.id, p]));\n for (const p of fit.items) {\n const item = fixed.get(p.id);\n const q = was.get(p.id);\n if (!item || !q || p.kind === \"menu\" || q.kind === \"menu\") continue;\n if (p.form !== q.form) return false;\n // Its least length: `main.min`, or a wrap form's rows at the stack's cross size.\n if (main(p.rect) < formMain(item.forms[p.form]!, \"min\", fit.cross) - 1e-6) return false;\n if (across(p.rect) < across(q.rect) - 1e-6) return false;\n }\n return true;\n}\n\nexport function stackTargets(input: StackInput, dragged: StackItem, options: StackTargetOptions = {}): StackTarget[] {\n if (dragged.forms.length === 0) return [];\n if (dragged.fixed) return [];\n if (input.accepts && !input.accepts(dragged)) return [];\n const rest: StackInput = { ...input, items: input.items.filter((it) => it.id !== dragged.id) };\n const fitOptions: FitOptions = options.previous ? { previous: options.previous } : {};\n const base = fitStack(rest, fitOptions);\n const reach = Math.max(0, Number.isFinite(options.endReach) ? options.endReach! : 0);\n const b = bounds(rest, base, reach);\n const column = rest.axis === \"column\";\n const fixedItems = new Map(rest.items.filter((it) => it.fixed).map((it) => [it.id, it]));\n const tooWideBefore = new Set(base.notes.flatMap((n) => (n.code === \"too-wide\" ? [n.id] : [])));\n const newest = rest.items.reduce((m, it) => Math.max(m, it.used), dragged.used) + 1;\n const item: StackItem = { ...dragged, used: newest };\n const out: StackTarget[] = [];\n for (let k = 0; k <= rest.items.length; k++) {\n if (options.allows && !options.allows(dragged, k)) continue;\n const solved = withItem(rest, item, k);\n const fit = fitStack(solved, fitOptions);\n const placed = fit.items.find((p) => p.id === dragged.id)!;\n const slot = placed.rect;\n if (options.onlyFits && !fitsBeside(base, fit, placed, fixedItems, rest.axis, tooWideBefore)) continue;\n const from = b.from[k]!;\n const to = b.to[k]!;\n const across = Math.max(base.cross, fit.cross);\n out.push({\n id: `gap:${k}`,\n priority: 2,\n item: dragged.id,\n place: { kind: \"gap\", at: k },\n hit: column ? rect(0, from, across, to - from) : rect(from, 0, to - from, across),\n slot,\n // The line spans the stack's cross size (the drop's fit: the bar's height, the column's width).\n marker: column ? rect(0, slot.y, fit.cross, 0) : rect(slot.x, 0, 0, fit.cross),\n input: solved,\n fit,\n });\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,SAAS,OAAO,OAAmB,KAAe,OAAiD;AACjG,QAAM,SAAS,MAAM,SAAS;AAC9B,QAAM,QAAQ,CAAC,MAAqB,SAAS,EAAE,IAAI,EAAE;AACrD,QAAM,OAAO,CAAC,MAAqB,SAAS,EAAE,SAAS,EAAE;AACzD,QAAM,SAAS,IAAI,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAEtD,QAAM,IAAI,CAAC,CAAC;AAEZ,MAAI,MAAM;AACV,MAAI,MAAM,IAAI;AACd,aAAW,MAAM,MAAM,OAAO;AAC5B,UAAM,IAAI,OAAO,IAAI,GAAG,EAAE;AAC1B,QAAI,CAAC,KAAK,EAAE,SAAS,QAAQ;AAC3B,QAAE,KAAK,KAAK,GAAG;AACf;AAAA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ACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/stack/targets.ts"],"sourcesContent":["/**\n * The drop targets for dragging an item into a stack, in the shape @n-uf/motion/drag takes. `stackTargets(input,\n * dragged)` gives one target for every gap of the stack without the dragged item (an item of the input with its id\n * is lifted out first, so a reorder within a stack works): before each item and after the last, so an empty stack has\n * one. An item with no forms has no place of its own, but its gaps count.\n *\n * - `id` `gap:<k>`, priority 2, `place` `{ kind: \"gap\", at: k }` (k counts the input's items, the dragged one lifted\n * out, including any with no forms; it is not an index into `fit.items`, which leaves those out: look the dragged\n * item up there by its id, as `slot` already does).\n * - `hit`: the gap's zone along the axis, the stack split at its items' middles, so it covers the gap and the padding\n * between its neighbours; the first and the last reach `options.endReach` px past the stack's ends (an item in the menu has no place of\n * its own: the gaps next to it split the stretch where the stack's drawn items end; with every item in the menu only\n * the last gap, \"at the end\", has any length, and the others are a point at the start). Across, it is the larger of\n * the stack's current size and the size the drop gives it, so the pointer over the preview is over the target.\n * - `fit`: the full `fitStack` of the stack with the dragged item inserted at k, and `input` the stack that was\n * solved. The preview is `slot`, the dragged item's rect in `fit`: exactly the rect it gets after the drop, because\n * the drop is that same solve. `marker` is the line where its leading edge lands: a rect with no thickness across\n * the stack's cross size (the app draws it with one).\n *\n * The dragged item counts as just used: it is newer than every item in the stack, so the others give way before it.\n * A group lands in the form that fits; a panel that would set a wider column makes room by that solve too. A dragged\n * item with no forms has no targets, nor has a `fixed` one (it is never dragged). A fixed item in the stack has no slot\n * inside it: the gaps before and after it stay, but the hit of a gap ends where the fixed item starts and the next one\n * begins where it ends, so no hit overlaps it. Nor has one the stack doesn't accept (`input.accepts`); `options.allows` leaves out\n * single gaps.\n */\nimport { rect, type Rect } from \"../geometry\";\nimport type { Target } from \"../target\";\nimport { fitStack } from \"./layout\";\nimport { formMain, withItem, type FitOptions, type PlacedStackItem, type StackFit, type StackInput, type StackItem } from \"./model\";\n\nexport interface StackTargetOptions {\n /**\n * How far the first gap's hit reaches before the stack's start and the last gap's past its end, px (default 0), so a\n * pointer just outside the bar still drops at an end. The marker and the preview don't move.\n */\n readonly endReach?: number;\n /**\n * The stack's fit before the drag, as `fitStack`'s `previous`: the preview of every gap keeps the other items' forms while\n * they still fit, so it is the fit the drop makes when the app solves with the same `previous`.\n */\n readonly previous?: StackFit;\n /**\n * Whether a gap takes the dragged item (default: every gap does). Called with the dragged item and the gap's `at`\n * (`place.at`: the gap before the k-th item of the input with the dragged one lifted out). A gap it refuses has no\n * target; the others keep their ids, places and hits. The stack's own `accepts` is asked first, for the whole stack.\n */\n readonly allows?: (dragged: StackItem, at: number) => boolean;\n /**\n * Offer a gap only where the dragged item fits beside the others (default false: every gap is offered, the dragged item\n * landing in the » menu or the stack overflowing if need be). With it a gap has no target when its fit puts the dragged\n * item into the menu, has an `overflow` note, has a `too-wide` note that the stack without the dragged item didn't have,\n * or squeezes a `fixed` item: it is in another form, shorter along the stack than its form's `main.min`, or narrower\n * across than before the drop. A fixed item may shrink down to its `main.min` to make room, so the room for the others\n * is the length less the fixed items' minimum sizes. The gaps left keep their ids, hits and fits. With no room anywhere\n * the result is `[]`.\n */\n readonly onlyFits?: boolean;\n}\n\nexport type StackPlace = { readonly kind: \"gap\"; readonly at: number };\n\nexport interface StackTarget extends Target {\n readonly priority: 2;\n /** The item dragged. */\n readonly item: string;\n readonly place: StackPlace;\n /** The line where the dragged item's leading edge lands. */\n readonly marker: Rect;\n /** The stack with the dragged item inserted: what a drop here makes. */\n readonly input: StackInput;\n /** Its fit: the preview and the drop are both its rect for the dragged item. */\n readonly fit: StackFit;\n}\n\n/**\n * Where each gap's zone runs along the axis: gap k from `from[k]` to `to[k]`. The stack is split at its items' middles,\n * so gap k reaches from the middle of item k - 1 to the middle of item k; `from[0]` is `reach` before the start, `to[n]`\n * `reach` past the length. A fixed item has no middle to split at: the gap before it ends where it starts and the gap\n * after it begins where it ends, so its own area is in no gap's zone.\n */\nfunction bounds(input: StackInput, fit: StackFit, reach: number): { from: number[]; to: number[] } {\n const column = input.axis === \"column\";\n const start = (r: Rect): number => (column ? r.y : r.x);\n const size = (r: Rect): number => (column ? r.height : r.width);\n const placed = new Map(fit.items.map((p) => [p.id, p]));\n // from[0], to[0], from[1], to[1], …, from[n], to[n], in the order along the stack.\n const c = [0];\n // Where the drawn items have ended so far: an item in the menu (or with no forms) sits there.\n let end = 0;\n let cap = fit.length;\n for (const it of input.items) {\n const p = placed.get(it.id);\n if (!p || p.kind === \"menu\") {\n c.push(end, end);\n continue;\n }\n const s = start(p.rect);\n const mid = s + size(p.rect) / 2;\n c.push(it.fixed ? s : mid, it.fixed ? s + size(p.rect) : mid);\n end = s + size(p.rect);\n // A fixed item that runs past the stack (an overflowing one) keeps its own area out of the zones.\n if (it.fixed) cap = Math.max(cap, end);\n }\n c.push(fit.length);\n // Monotone, whatever the sizes did (a stack that overflows).\n for (let i = 1; i < c.length; i++) c[i] = Math.min(Math.max(c[i]!, c[i - 1]!), cap);\n // The first and last gaps reach past the stack's ends (the last never starts before a fixed item ends).\n c[0] = 0 - reach;\n c[c.length - 1] = Math.max(fit.length + reach, c[c.length - 2]!);\n const from: number[] = [];\n const to: number[] = [];\n for (let k = 0; k <= input.items.length; k++) {\n from.push(c[2 * k]!);\n to.push(c[2 * k + 1]!);\n }\n return { from, to };\n}\n\n/**\n * Whether a drop's fit leaves room for the dragged item: it isn't in the » menu, the stack doesn't `overflow`, no item\n * is `too-wide` that wasn't before (the dragged one, or one the drop made too wide), and no fixed item is squeezed: it\n * keeps its form, is drawn at least as long along the stack as its form's `main.min` and at least as wide across as before\n * the drop. A fixed item may shrink down to its `main.min` to make room (a title that grows gives back what it took).\n */\nfunction fitsBeside(\n base: StackFit,\n fit: StackFit,\n dragged: PlacedStackItem,\n fixed: ReadonlyMap<string, StackItem>,\n axis: StackInput[\"axis\"],\n tooWideBefore: ReadonlySet<string>,\n): boolean {\n if (dragged.kind === \"menu\") return false;\n for (const n of fit.notes) {\n if (n.code === \"overflow\") return false;\n if (n.code === \"too-wide\" && !tooWideBefore.has(n.id)) return false;\n }\n const main = (r: Rect): number => (axis === \"column\" ? r.height : r.width);\n const across = (r: Rect): number => (axis === \"column\" ? r.width : r.height);\n const was = new Map(base.items.map((p) => [p.id, p]));\n for (const p of fit.items) {\n const item = fixed.get(p.id);\n const q = was.get(p.id);\n if (!item || !q || p.kind === \"menu\" || q.kind === \"menu\") continue;\n if (p.form !== q.form) return false;\n // Its least length: `main.min`, or a wrap form's rows at the stack's cross size.\n if (main(p.rect) < formMain(item.forms[p.form]!, \"min\", fit.cross) - 1e-6) return false;\n if (across(p.rect) < across(q.rect) - 1e-6) return false;\n }\n return true;\n}\n\nexport function stackTargets(input: StackInput, dragged: StackItem, options: StackTargetOptions = {}): StackTarget[] {\n if (dragged.forms.length === 0) return [];\n if (dragged.fixed) return [];\n if (input.accepts && !input.accepts(dragged)) return [];\n const rest: StackInput = { ...input, items: input.items.filter((it) => it.id !== dragged.id) };\n const fitOptions: FitOptions = options.previous ? { previous: options.previous } : {};\n const base = fitStack(rest, fitOptions);\n const reach = Math.max(0, Number.isFinite(options.endReach) ? options.endReach! : 0);\n const b = bounds(rest, base, reach);\n const column = rest.axis === \"column\";\n const fixedItems = new Map(rest.items.filter((it) => it.fixed).map((it) => [it.id, it]));\n const tooWideBefore = new Set(base.notes.flatMap((n) => (n.code === \"too-wide\" ? [n.id] : [])));\n const newest = rest.items.reduce((m, it) => Math.max(m, it.used), dragged.used) + 1;\n const item: StackItem = { ...dragged, used: newest };\n const out: StackTarget[] = [];\n for (let k = 0; k <= rest.items.length; k++) {\n if (options.allows && !options.allows(dragged, k)) continue;\n const solved = withItem(rest, item, k);\n const fit = fitStack(solved, fitOptions);\n const placed = fit.items.find((p) => p.id === dragged.id)!;\n const slot = placed.rect;\n if (options.onlyFits && !fitsBeside(base, fit, placed, fixedItems, rest.axis, tooWideBefore)) continue;\n const from = b.from[k]!;\n const to = b.to[k]!;\n const across = Math.max(base.cross, fit.cross);\n out.push({\n id: `gap:${k}`,\n priority: 2,\n item: dragged.id,\n place: { kind: \"gap\", at: k },\n hit: column ? rect(0, from, across, to - from) : rect(from, 0, to - from, across),\n slot,\n // The line spans the stack's cross size (the drop's fit: the bar's height, the column's width).\n marker: column ? rect(0, slot.y, fit.cross, 0) : rect(slot.x, 0, 0, fit.cross),\n input: solved,\n fit,\n });\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,SAAS,OAAO,OAAmB,KAAe,OAAiD;AACjG,QAAM,SAAS,MAAM,SAAS;AAC9B,QAAM,QAAQ,CAAC,MAAqB,SAAS,EAAE,IAAI,EAAE;AACrD,QAAM,OAAO,CAAC,MAAqB,SAAS,EAAE,SAAS,EAAE;AACzD,QAAM,SAAS,IAAI,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAEtD,QAAM,IAAI,CAAC,CAAC;AAEZ,MAAI,MAAM;AACV,MAAI,MAAM,IAAI;AACd,aAAW,MAAM,MAAM,OAAO;AAC5B,UAAM,IAAI,OAAO,IAAI,GAAG,EAAE;AAC1B,QAAI,CAAC,KAAK,EAAE,SAAS,QAAQ;AAC3B,QAAE,KAAK,KAAK,GAAG;AACf;AAAA,IACF;AACA,UAAM,IAAI,MAAM,EAAE,IAAI;AACtB,UAAM,MAAM,IAAI,KAAK,EAAE,IAAI,IAAI;AAC/B,MAAE,KAAK,GAAG,QAAQ,IAAI,KAAK,GAAG,QAAQ,IAAI,KAAK,EAAE,IAAI,IAAI,GAAG;AAC5D,UAAM,IAAI,KAAK,EAAE,IAAI;AAErB,QAAI,GAAG,MAAO,OAAM,KAAK,IAAI,KAAK,GAAG;AAAA,EACvC;AACA,IAAE,KAAK,IAAI,MAAM;AAEjB,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,IAAK,GAAE,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,GAAI,EAAE,IAAI,CAAC,CAAE,GAAG,GAA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,MAAM,SAAS,QAAQ,UAAU;AACvC,UAAM,SAAS,IAAI,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,QAAQ,EAAE;AACxD,UAAM,OAAO,OAAO;AACpB,QAAI,QAAQ,YAAY,CAAC,WAAW,MAAM,KAAK,QAAQ,YAAY,KAAK,MAAM,aAAa,EAAG;AAC9F,UAAM,OAAO,EAAE,KAAK,CAAC;AACrB,UAAM,KAAK,EAAE,GAAG,CAAC;AACjB,UAAM,SAAS,KAAK,IAAI,KAAK,OAAO,IAAI,KAAK;AAC7C,QAAI,KAAK;AAAA,MACP,IAAI,OAAO,CAAC;AAAA,MACZ,UAAU;AAAA,MACV,MAAM,QAAQ;AAAA,MACd,OAAO,EAAE,MAAM,OAAO,IAAI,EAAE;AAAA,MAC5B,KAAK,SAAS,KAAK,GAAG,MAAM,QAAQ,KAAK,IAAI,IAAI,KAAK,MAAM,GAAG,KAAK,MAAM,MAAM;AAAA,MAChF;AAAA;AAAA,MAEA,QAAQ,SAAS,KAAK,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,GAAG,GAAG,GAAG,IAAI,KAAK;AAAA,MAC7E,OAAO;AAAA,MACP;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO;AACT;","names":[]}
@@ -1,4 +1,4 @@
1
- import { R as Rect } from './geometry-mL-GTRti.js';
1
+ import { R as Rect } from './geometry-CkZ6Fcfb.js';
2
2
 
3
3
  /**
4
4
  * A drop target in the shape @n-uf/motion/drag takes: an id, a priority (1 most precise: a rail or a tab strip;
@@ -1,5 +1,5 @@
1
- import { S as Size, R as Rect, P as Point } from './geometry-mL-GTRti.js';
2
- import { T as Target } from './target-D3PiLg44.js';
1
+ import { S as Size, R as Rect, P as Point } from './geometry-CkZ6Fcfb.js';
2
+ import { T as Target } from './target-C-HJjPcz.js';
3
3
 
4
4
  /**
5
5
  * The panels model: plain data and the pure changes on it.
@@ -563,9 +563,7 @@ interface PanelTargetInput {
563
563
  /** Drops into a stacked column may go before any of its members (`into` targets with `at`); default: the bottom only. */
564
564
  readonly stackSlots?: boolean;
565
565
  }
566
- /** How far a column band reaches on each side of its line, px; how wide a side's edge takes a rail drop when it has no rail. */
567
- declare const COLUMN_REACH = 22;
568
- declare const RAIL_EDGE = 10;
566
+
569
567
  /**
570
568
  * A place's rank in reading order: the left side outer to inner, the right side inner to outer, then the top band and
571
569
  * the bottom band left to right, floating last.
@@ -620,4 +618,4 @@ interface PanelStopsOptions {
620
618
  /** The panel's places in reading order, for the arrow keys and a "Move to" menu (`keyboardStops` calls this). */
621
619
  declare function panelStops(targets: readonly PanelTarget[], options?: PanelStopsOptions): PanelStop[];
622
620
 
623
- export { floatSize as $, type PlacedPanel as A, BAND_SIZE as B, type Clock as C, DEFAULT_PANELS_OPTIONS as D, type Edge as E, FLOAT_HEIGHT as F, type GiveWay as G, type PlacedRail as H, IDENTITY_VIEW as I, type Reserve as J, type ReserveEdge as K, SIDES as L, activate as M, bandHeight as N, bandSize as O, type PanelsOptions as P, close as Q, RAIL_EDGE as R, type Side as S, columnWidth as T, createPanels as U, type View as V, type Where as W, defOf as X, dock as Y, dockBand as Z, float as _, type PanelDef as a, focus as a0, giveWayOrder as a1, homePlace as a2, keep as a3, liftPanel as a4, open as a5, ownWidth as a6, panelStops as a7, panelTargets as a8, pin as a9, placeRank as aa, resizeBand as ab, resizeColumn as ac, resizeFloat as ad, samePlaces as ae, showTabs as af, tick as ag, toPage as ah, toView as ai, toggleFold as aj, whereIs as ak, type PanelsState as b, type PanelTargetInput as c, type PanelTarget as d, type PanelDrop as e, type PanelsLayout as f, type Band as g, type BandOption as h, COLUMN_REACH as i, type Column as j, type DockOptions as k, layoutPanels as l, EDGES as m, FLOAT_MIN as n, type FloatAt as o, panelDrop as p, type PanelKind as q, type PanelPlace as r, type PanelStop as s, type PanelStopsOptions as t, type PanelsNote as u, type PanelsNoteCode as v, type PanelsStart as w, type Place as x, type PlacedBand as y, type PlacedColumn as z };
621
+ export { giveWayOrder as $, type PlacedRail as A, BAND_SIZE as B, type Clock as C, DEFAULT_PANELS_OPTIONS as D, type Edge as E, FLOAT_HEIGHT as F, type GiveWay as G, type ReserveEdge as H, IDENTITY_VIEW as I, SIDES as J, activate as K, bandHeight as L, bandSize as M, close as N, columnWidth as O, type PanelsOptions as P, createPanels as Q, type Reserve as R, type Side as S, defOf as T, dock as U, type View as V, type Where as W, dockBand as X, float as Y, floatSize as Z, focus as _, type PanelDef as a, homePlace as a0, keep as a1, liftPanel as a2, open as a3, ownWidth as a4, panelStops as a5, panelTargets as a6, pin as a7, placeRank as a8, resizeBand as a9, resizeColumn as aa, resizeFloat as ab, samePlaces as ac, showTabs as ad, tick as ae, toPage as af, toView as ag, toggleFold as ah, whereIs as ai, type PanelsState as b, type PanelTargetInput as c, type PanelTarget as d, type PanelDrop as e, type PanelsLayout as f, type Band as g, type BandOption as h, type Column as i, type DockOptions as j, EDGES as k, layoutPanels as l, FLOAT_MIN as m, type FloatAt as n, type PanelKind as o, panelDrop as p, type PanelPlace as q, type PanelStop as r, type PanelStopsOptions as s, type PanelsNote as t, type PanelsNoteCode as u, type PanelsStart as v, type Place as w, type PlacedBand as x, type PlacedColumn as y, type PlacedPanel as z };
@@ -1,6 +1,6 @@
1
- import { R as Rect, S as Size, P as Point } from './geometry-mL-GTRti.js';
2
- import { T as Target } from './target-D3PiLg44.js';
3
- import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-DPTu2EtG.js';
1
+ import { R as Rect, S as Size, P as Point } from './geometry-CkZ6Fcfb.js';
2
+ import { T as Target } from './target-C-HJjPcz.js';
3
+ import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-mm16NrSX.js';
4
4
 
5
5
  /**
6
6
  * The scene's shapes: one model of a whole window. A scene is a stage (the window's inner rect), the edges along its
@@ -122,8 +122,9 @@ interface Edge {
122
122
  * The kinds each zone takes, narrowing `accepts`: with it, a zone not listed takes nothing. A panel column with
123
123
  * `{ start: ["panel"], end: ["group"] }` has its panels at the top and a tray of toolbars at its foot (the end zone, one
124
124
  * toolbar per row): a toolbar in the tray takes only its `wrap` or `icons` form (never the menu), and the panels give
125
- * way first. A group never opens such a column on its own: an empty edge offers its strip only to the kinds its start
126
- * zone takes.
125
+ * way first. An empty edge offers each third of its strip only to the kinds that third's zone takes (the others are
126
+ * refusals). A group never opens such a column on its own: an empty side column offers its strip only to the kinds
127
+ * its start zone takes (a panel gets its top third; a group none, the rail's instead).
127
128
  */
128
129
  readonly zoneAccepts?: ZoneAccepts;
129
130
  /** The drop strip's depth while the edge is empty, px (default {@link DEFAULT_STRIP}). */
@@ -392,8 +393,13 @@ interface SceneLayout {
392
393
  readonly content: Rect;
393
394
  /** The floats drawn, in stacking order (the last on top). */
394
395
  readonly floats: readonly string[];
395
- /** The rails shown (a side with a folded column). */
396
+ /** The rails shown (a side with a folded column). Hosts draw these. */
396
397
  readonly rails: Readonly<Partial<Record<"left" | "right", SceneRailLayout>>>;
398
+ /**
399
+ * Where each side's rail lies, or would lie were one shown, for every side that has a rail (`Scene.rails`), drawn or
400
+ * not: the place a drop into the rail lands (`targets` reads it). Hosts draw `rails`, never `railPlaces`.
401
+ */
402
+ readonly railPlaces: Readonly<Partial<Record<"left" | "right", Rect>>>;
397
403
  /**
398
404
  * With `contentMin` and a dynamic column (or, before any exists, a `columns` template): whether one column at its
399
405
  * minimum fits beside the content's minimum (`false` with a `no-column-room` note). Anchors and rails don't count:
@@ -419,12 +425,16 @@ declare const DEFAULT_HIT_BAND = 24;
419
425
  /** A float's size when neither the item nor the call gives one, px. */
420
426
  declare const DEFAULT_FLOAT_SIZE: Size;
421
427
  /**
422
- * A left or right toolbar bar outside the inset: told from a column edge by its kinds, it takes something and nothing
423
- * the side's columns or its rail take (`Scene.columns[side].accepts`, `Scene.rails[side].accepts`); an anchor takes
424
- * nothing. A side with neither a column template nor a rail has nothing to tell them apart by, so no edge there is a
425
- * bar. It lies outermost on its side, before the side's rail.
428
+ * A left or right toolbar bar outside the inset (`isSideBar` with `outsideInset`). It lies outermost on its side,
429
+ * before the side's rail.
426
430
  */
427
431
  declare function isOutsideSideBar(scene: Scene, e: Edge): boolean;
432
+ /**
433
+ * A left or right toolbar bar: told from a column edge by its kinds, it takes something and nothing the side's columns
434
+ * or its rail take (`Scene.columns[side].accepts`, `Scene.rails[side].accepts`); an anchor takes nothing. A side with
435
+ * neither a column template nor a rail has nothing to tell them apart by, so no edge there is a bar.
436
+ */
437
+ declare function isSideBar(scene: Scene, e: Edge): boolean;
428
438
  /**
429
439
  * The orient a float of `item` takes when it names none: its `floatOrient`, else the axis of its first form (the first
430
440
  * of `forms.row` / `forms.column` it declares with any form), else column.
@@ -599,46 +609,49 @@ declare function readScene(data: unknown, base: Scene): SceneRead;
599
609
  * a release there commits and its layout, `solve(after.scene, { previous })`: the host draws every item from that layout
600
610
  * during the preview (C22), so the preview is the result by construction.
601
611
  *
602
- * - `gap:<edge>:<zone>:<at>` (priority 2): for every edge whose `accepts` lists the dragged item's kind (deny by
603
- * default, C25), a target before the `at`-th item of each zone (start, center, end) and at each zone's end, so an
604
- * empty center or end zone can be opened. Only where the item fits (C29): after the drop it isn't in the » menu, the
605
- * edge doesn't overflow, nothing in the edge is newly `too-wide`, every fixed item of the edge keeps its form and its
606
- * place (a growing one may give up its spare length), and its slot covers no chrome. The hit is the edge's stretch
607
- * between the neighbouring gaps (split halfway between their insertion lines; over an open item's body only a
608
- * `hitBand` around the line), across the larger of the edge's thickness before and after the drop (a compact edge's
609
- * reaching `RAIL_REACH` further inward), the first and last reaching `endReach` px past the edge's ends. Other edges'
610
- * rects, as they are now and with the item lifted, trim it: one across from the edge at its end along the edge, one
611
- * beside it at its side. It is cut clear of every fixed item that doesn't grow and of the chrome rects (a gap whose
612
- * line lies inside one has no target); a growing fixed item (a title) is not cut out, so a pointer over it picks the
613
- * nearest gap. `marker` is the insertion line after the drop, across the edge; `slot` the item's rect after the drop.
614
- * A horizontal bar (top or bottom, not compact) has a hit per zone by thirds: its left third is the leading (start)
615
- * zone's, the middle the center zone's, the right the trailing (end) zone's, each split among its own gaps (their
616
- * lines taken inside the third). A title bar (a bar with a fixed item that grows) is a constrained host: a gap there
617
- * is a target only when the item lands in its first form, nothing in the bar changes form for it, and the title keeps
618
- * its natural width.
619
- * - `strip:<bar>:<zone>` (2): an empty horizontal bar that accepts the kind: its strip along the content in thirds, one
620
- * target per zone that takes the kind.
621
- * - `strip:<edge>` (2): an empty edge that accepts the kind (its start zone takes it): a strip `Edge.strip` px (default
622
- * 24) deep along its side, inside the content and clear of overlay edges, so never over a docked edge or a panel's
623
- * body (a compact rail's strip alone stays at the window edge, its own place); a gap hit that spans it trims its ends,
624
- * and under 1 px left it has no target. Home covers all of the dragged item's own rect: a strip (a `rail:` strip
625
- * too) keeps only what lies outside it. `after` shows the edge holding the item.
626
- * - `float:<id>` (3, free): when `floatKinds` lists the kind. The hit covers the whole plane; the landing is the float
627
- * with the pointer holding it at `grab` (default its middle), in the stage and clear of the docked items, the bars
628
- * and the chrome. Its orient: `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size:
629
- * `options.floatSize`, else its float's size, else `floatSizeOf` (the item's `floatSize`, else its form's natural
630
- * size along that orient, else the default).
631
- * - `column:<side>:<ring>` (2): a new column on each column line of a side whose `scene.columns[side]` takes the kind
612
+ * One model makes every docked target and refusal: **edge → zones → slots → tiles**, then one ordered
613
+ * filter.
614
+ *
615
+ * - **Edges.** Every edge, empty or occupied, and two virtual edges per side: the column lines and the rail.
616
+ * - **Zones.** Each edge's start, center and end zones have an extent along it. Where items keep their length and the
617
+ * zones only align them (bars, compact rails, side toolbar bars) the extents are the edge's thirds; where items fill
618
+ * the edge (panel columns) a zone's extent is the span the solver gives it: a plain column is one zone, a tray column
619
+ * its panels' span and its tray's (`EDGE_KINDS`, the only data keyed on the kind of edge). The outer extents reach
620
+ * `endReach` past the edge's ends.
621
+ * - **Slots.** A zone's insertion lines, from the layout with the item lifted (`gap:<edge>:<zone>:<at>`; on an edge with
622
+ * no members at all a zone has one, `strip:<edge>:<zone>`). The item's own place is an interval, its own rect along the edge: home.
623
+ * - **Tiles.** A zone's extent split halfway between its slots' lines (lines that lie past the extent are spread into
624
+ * it); the own interval keeps exactly its length, its neighbours meeting it, and a stretch of a zone with no other
625
+ * slot is home's. Across: the edge's thickness (the larger of now and after the drop), an empty edge's strip depth
626
+ * (`Edge.strip`, default 24, inward), a compact rail's `RAIL_REACH` further inward.
627
+ * - **Filter**, in order: (i) the edge and zone take the kind (`accepts`, `zoneAccepts`), and an empty side column opens
628
+ * only through its start zone; (ii) the drop fits (C29: no » entry, no new overflow or `too-wide`, every fixed item
629
+ * keeps its form, place and least length, a title bar's title its natural width with the toolbar in its first form;
630
+ * the slot covers no chrome or reserved rect). A slot (i) or (ii) removes is a refusal over its own tile, with that
631
+ * reason (`refusals()`). (iii) Space ownership and clipping (`EDGE_KINDS`): owned > virtual > overreach. A zone's
632
+ * room loses its panel bodies, its reserved rects and what edges ranked before it own (in `solve`'s laying order); a
633
+ * zone with no room, or a slot with none in reach, isn't offered. Each tile's owned part is cut clear of the tiles
634
+ * before it, of what outranks its edge, of every fixed item that doesn't grow and of the chrome, keeping the part
635
+ * that holds its slot's line (its other parts refused); then the virtual edges take what no edge owns; then each
636
+ * overreach takes what is left and joins its owned part where it meets it whole. Slots that are the same move are
637
+ * one. (iv) `blocked` rects are `none:<i>`.
638
+ *
639
+ * Ids: `gap:<edge>:<zone>:<at>` (priority 2), `strip:<edge>:<zone>` (2), `column:<side>:<ring>` (2), `rail:<side>:<ring>`
640
+ * (1), `none:<i>` (1), `float:<id>` (3, free). A slot that would put the item back where it is keeps its id with place
641
+ * `home` (no slot, nothing committed); `home:<id>` (1) is emitted too, over the same tile (its own rect when no slot is
642
+ * its home), for hosts that read it. A floating item has no home: a move inside its own rect is a float move.
643
+ *
644
+ * - `column:<side>:<ring>`: a new column on each column line of a side whose `scene.columns[side]` takes the kind
632
645
  * (outside the outermost open column, between two, inside the innermost; on a side with none, at the content's
633
- * edge), `COLUMN_REACH` px each way, only where the new column shows open.
634
- * - `rail:<side>:<ring>` (1): docking folded into a side's rail (its rail and its template take the kind), before each
635
- * folded column's segments and after the last, or a strip `RAIL_EDGE` px deep where the rail lands (flush after its
636
- * outside toolbar bars, `isOutsideSideBar`, else at the window's side less the inset) when no rail shows.
637
- * - `none:<i>` (1): over each `scene.blocked` rect. It takes the pointer, and a release there commits nothing.
638
- * - `home:<id>` (1): over a docked item's own rect (or its » entry); a floating item has none, so a move inside its own
639
- * rect is a float move. A release there commits nothing. A gap, column line or rail drop that
640
- * would put the item back where it is (the gap beside it, its own column's line, its own side's rail) keeps its id but
641
- * is a home too: place `home`, no slot, nothing committed.
646
+ * edge), up to `COLUMN_REACH` px each way (two lines nearer than that meet halfway), only where the new column shows
647
+ * open (elsewhere refused).
648
+ * - `rail:<side>:<ring>`: docking folded into a side's rail (its rail and its template take the kind), before each
649
+ * folded column's segments and after the last, or, with no rail shown, `RAIL_EDGE` px deep where the rail lands
650
+ * (`SceneLayout.railPlaces`).
651
+ * - `float:<id>`: when `floatKinds` lists the kind, the whole plane: the landing is the float with the pointer holding
652
+ * it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome. Its orient:
653
+ * `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
654
+ * float's size, else `floatSizeOf`.
642
655
  *
643
656
  * `stops(scene, id)` orders the same targets (no home, no none) for "Move to ›" and the arrow keys.
644
657
  *
@@ -682,30 +695,35 @@ interface SceneTargetOptions {
682
695
  /** As `solve`'s: edge or item ids solved without `previous`, in every `after` too. */
683
696
  readonly fresh?: readonly string[];
684
697
  }
685
- declare function targets(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
686
- /**
687
- * What a fixed item reserves in `l`: its drawn rect, or for a form that grows only its natural length, placed by its
688
- * zone (from its start, from its end in the end zone, centred in the centre zone). No hit or slot ever lies there, so a
689
- * host that draws "no drop" areas reads them from here.
690
- */
691
- declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
692
698
  /** Where a drop of the dragged item is refused: a host shows "no room here" at the pointer, with no slot anywhere. */
693
699
  interface SceneRefusal {
694
- /** `refuse:<edge>:<zone>`. */
700
+ /**
701
+ * `refuse:<edge>:<zone>`, with `:<n>` after it for a zone's second refused tile and on, numbered by where they lie
702
+ * along the edge (then across it), so an id is stable from one frame to the next.
703
+ */
695
704
  readonly id: string;
696
705
  readonly edge: string;
697
706
  readonly zone: Zone;
698
- /** Where the pointer means it; never over a target's hit. */
707
+ /** Where the pointer means it: the refused slot's tile, never over a target's hit. */
699
708
  readonly hit: Rect;
700
- /** `no-room`: the zone takes the kind, but no gap of it fits (a title bar at the title's natural width, say). `not-accepted`: the edge or zone doesn't take the kind. */
701
- readonly reason: "no-room" | "not-accepted";
709
+ /**
710
+ * `no-room`: the zone takes the kind, but the drop there doesn't fit (a title bar at the title's natural width, say).
711
+ * `own-place`: the stretch beside an item alone in its zone: there is room, but the zone's only place is the item's
712
+ * own (a release there puts it back). `not-accepted`: the edge or zone doesn't take the kind.
713
+ */
714
+ readonly reason: "no-room" | "own-place" | "not-accepted";
702
715
  }
716
+ /**
717
+ * What a fixed item reserves in `l`: its drawn rect, or for a form that grows only its natural length, placed by its
718
+ * zone (from its start, from its end in the end zone, centred in the centre zone). No hit or slot ever lies there, so a
719
+ * host that draws "no drop" areas reads them from here.
720
+ */
721
+ declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
722
+ declare function targets(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
703
723
  /**
704
724
  * `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
705
- * (a tint and "No room here") instead of showing a slot elsewhere. A bar's zone (its third, as `targets` picks zones)
706
- * that has no target is refused: `no-room` when the zone takes the kind, `not-accepted` when it or the bar doesn't; a
707
- * left or right edge that doesn't take the kind is refused as a whole (zone `start`). Each hit is cut clear of every
708
- * target's hit (the float target aside), so a pointer over one has no target there but the float. A release over a
725
+ * (a tint and "No room here") instead of showing a slot elsewhere: each slot the filter removed, over its own tile,
726
+ * `not-accepted` where the edge or zone doesn't take the kind, `no-room` where the drop wouldn't fit. A release over a
709
727
  * refusal commits nothing: the item goes home.
710
728
  */
711
729
  declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneRefusal[];
@@ -716,4 +734,4 @@ declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOp
716
734
  */
717
735
  declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
718
736
 
719
- export { readScene as $, type StoredSceneItem as A, ZONES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type ZoneAccepts as G, close as H, dockHome as I, floatAt as J, type Kind as K, floatOrientOf as L, floatSizeOf as M, fold as N, type Orient as O, type Place as P, homeFor as Q, type RailPlace as R, type Scene as S, isOutsideSideBar as T, keep as U, lift as V, moveTo as W, open as X, orient as Y, type Zone as Z, raise as _, type ScenePlace as a, refusals as a0, reservedRect as a1, resize as a2, setSide as a3, stops as a4, storeScene as a5, targets as a6, use as a7, zoneTakes as a8, zonesTaking as a9, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SolveOptions as g, type ColumnTemplate as h, DEFAULT_HIT_BAND as i, DEFAULT_STRIP as j, type DockPlace as k, type FloatPlace as l, type RailSpec as m, SIDES as n, type SceneAfter as o, type SceneEdgeLayout as p, type SceneFloat as q, type SceneItem as r, type SceneItemLayout as s, type SceneNote as t, type SceneRailLayout as u, type SceneRead as v, type SceneRefusal as w, type SceneTargetOptions as x, type StoredSceneEdge as y, type StoredSceneFloat as z };
737
+ export { raise as $, type StoredSceneItem as A, ZONES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type ZoneAccepts as G, close as H, dockHome as I, floatAt as J, type Kind as K, floatOrientOf as L, floatSizeOf as M, fold as N, type Orient as O, type Place as P, homeFor as Q, type RailPlace as R, type Scene as S, isOutsideSideBar as T, isSideBar as U, keep as V, lift as W, moveTo as X, open as Y, type Zone as Z, orient as _, type ScenePlace as a, readScene as a0, refusals as a1, reservedRect as a2, resize as a3, setSide as a4, stops as a5, storeScene as a6, targets as a7, use as a8, zoneTakes as a9, zonesTaking as aa, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SolveOptions as g, type ColumnTemplate as h, DEFAULT_HIT_BAND as i, DEFAULT_STRIP as j, type DockPlace as k, type FloatPlace as l, type RailSpec as m, SIDES as n, type SceneAfter as o, type SceneEdgeLayout as p, type SceneFloat as q, type SceneItem as r, type SceneItemLayout as s, type SceneNote as t, type SceneRailLayout as u, type SceneRead as v, type SceneRefusal as w, type SceneTargetOptions as x, type StoredSceneEdge as y, type StoredSceneFloat as z };
package/dist/targets.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { T as Target } from './target-D3PiLg44.js';
2
- import { R as Rect, P as Point, S as Size } from './geometry-mL-GTRti.js';
3
- import { D as DeskState, g as Layout, a as Construction, O as Options } from './constructions-VDK_mwmz.js';
1
+ import { T as Target } from './target-C-HJjPcz.js';
2
+ import { R as Rect, P as Point, S as Size } from './geometry-CkZ6Fcfb.js';
3
+ import { D as DeskState, g as Layout, a as Construction, O as Options } from './constructions-DSEjvWMP.js';
4
4
  import { Place, Arrangement, HostId, HostSpec, GroupSize } from './toolbar.js';
5
- import { d as PanelTarget, t as PanelStopsOptions, s as PanelStop } from './targets-B6eLC-52.js';
5
+ import { d as PanelTarget, s as PanelStopsOptions, r as PanelStop } from './targets-CBpO_LEy.js';
6
6
 
7
7
  /**
8
8
  * Each desk construction's drop targets, as pure functions: from the state with the dragged item lifted out, a list
package/dist/targets.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  treeRails,
24
24
  treeShown,
25
25
  treeTiles
26
- } from "./chunk-LPMZ2FFR.js";
26
+ } from "./chunk-3P6VOXA6.js";
27
27
  import {
28
28
  HOST_LABEL,
29
29
  ZONES,
@@ -38,17 +38,17 @@ import {
38
38
  } from "./chunk-WLMJ6JGO.js";
39
39
  import {
40
40
  panelStops
41
- } from "./chunk-CJA6LRHN.js";
41
+ } from "./chunk-7ASCUAGV.js";
42
42
  import {
43
43
  centre,
44
+ clamp,
44
45
  overlap,
45
46
  rect
46
- } from "./chunk-QMTNB2C3.js";
47
+ } from "./chunk-WM5FJ3IS.js";
47
48
 
48
49
  // src/targets/desk.ts
49
50
  var SNAP = 18;
50
51
  var insert = (list, i, x) => [...list.slice(0, i), x, ...list.slice(i)];
51
- var clamp = (v, lo, hi) => Math.min(Math.max(v, lo), Math.max(lo, hi));
52
52
  var Cap = (s) => s === "left" ? "Left" : "Right";
53
53
  var fixed = (state, label) => () => ({ state, label, key: label });
54
54
  var slotSpan = (mids, lo, hi, i) => [i === 0 ? lo : mids[i - 1], i === mids.length ? hi : mids[i]];
@@ -412,15 +412,14 @@ function toolbarStops(targets, options) {
412
412
  // src/targets/zones.ts
413
413
  var PANE_EDGES = ["top", "right", "bottom", "left"];
414
414
  var PANE_ZONE_DEFAULTS = { centre: 0.34, centreMin: 24, hysteresis: 6, pixelRatio: 1 };
415
- var clamp2 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
416
415
  var snap = (v, ratio) => Math.round(v * ratio) / ratio;
417
416
  function paneCentre(size, options = {}) {
418
417
  const o = { ...PANE_ZONE_DEFAULTS, ...options };
419
418
  const width = Math.max(0, size.width);
420
419
  const height = Math.max(0, size.height);
421
420
  const ratio = o.pixelRatio > 0 ? o.pixelRatio : 1;
422
- const rx = clamp2(o.centreX ?? o.centre, 0.05, 0.95);
423
- const ry = clamp2(o.centreY ?? o.centre, 0.05, 0.95);
421
+ const rx = clamp(o.centreX ?? o.centre, 0.05, 0.95);
422
+ const ry = clamp(o.centreY ?? o.centre, 0.05, 0.95);
424
423
  const cw = Math.min(width, Math.max(width * rx, Math.min(o.centreMin, width)));
425
424
  const ch = Math.min(height, Math.max(height * ry, Math.min(o.centreMin, height)));
426
425
  return { width, height, left: snap((width - cw) / 2, ratio), top: snap((height - ch) / 2, ratio), right: snap((width + cw) / 2, ratio), bottom: snap((height + ch) / 2, ratio) };