@n-uf/placement 26.11.53 → 26.11.54

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 (62) hide show
  1. package/CHANGELOG.md +75 -1
  2. package/README.md +27 -58
  3. package/dist/{chunk-VLTYJHUA.js → chunk-2UVUFEBP.js} +4 -8
  4. package/dist/{chunk-VLTYJHUA.js.map → chunk-2UVUFEBP.js.map} +1 -1
  5. package/dist/{geometry-Bf37LbCT.d.ts → geometry-L5gCoiZV.d.ts} +2 -8
  6. package/dist/index.d.ts +64 -42
  7. package/dist/index.js +6 -66
  8. package/dist/index.js.map +1 -1
  9. package/dist/popup.d.ts +49 -0
  10. package/dist/popup.js +58 -0
  11. package/dist/popup.js.map +1 -0
  12. package/dist/stack.d.ts +529 -228
  13. package/dist/stack.js +701 -28
  14. package/dist/stack.js.map +1 -1
  15. package/dist/tiling.d.ts +48 -5
  16. package/dist/tiling.js +198 -19
  17. package/dist/tiling.js.map +1 -1
  18. package/package.json +9 -36
  19. package/dist/chunk-2GGJ4GVR.js +0 -9
  20. package/dist/chunk-2GGJ4GVR.js.map +0 -1
  21. package/dist/chunk-3ZICYLWL.js +0 -791
  22. package/dist/chunk-3ZICYLWL.js.map +0 -1
  23. package/dist/chunk-AE3BWTAE.js +0 -838
  24. package/dist/chunk-AE3BWTAE.js.map +0 -1
  25. package/dist/chunk-JVAR67OL.js +0 -172
  26. package/dist/chunk-JVAR67OL.js.map +0 -1
  27. package/dist/chunk-NF7RYK3U.js +0 -429
  28. package/dist/chunk-NF7RYK3U.js.map +0 -1
  29. package/dist/chunk-R3AAANRY.js +0 -220
  30. package/dist/chunk-R3AAANRY.js.map +0 -1
  31. package/dist/chunk-TWI644JK.js +0 -221
  32. package/dist/chunk-TWI644JK.js.map +0 -1
  33. package/dist/chunk-ZTH5FCUO.js +0 -4190
  34. package/dist/chunk-ZTH5FCUO.js.map +0 -1
  35. package/dist/constructions-Cbz7uEAZ.d.ts +0 -251
  36. package/dist/desk.d.ts +0 -51
  37. package/dist/desk.js +0 -111
  38. package/dist/desk.js.map +0 -1
  39. package/dist/dock.d.ts +0 -25
  40. package/dist/dock.js +0 -397
  41. package/dist/dock.js.map +0 -1
  42. package/dist/float-fit-DCYxRMru.d.ts +0 -37
  43. package/dist/lanes-DIwUqchd.d.ts +0 -1321
  44. package/dist/model-X7eUaKlA.d.ts +0 -337
  45. package/dist/panels.d.ts +0 -60
  46. package/dist/panels.js +0 -99
  47. package/dist/panels.js.map +0 -1
  48. package/dist/regions-Db_RyT4P.d.ts +0 -48
  49. package/dist/scene-cases.d.ts +0 -888
  50. package/dist/scene-cases.js +0 -3149
  51. package/dist/scene-cases.js.map +0 -1
  52. package/dist/scene.d.ts +0 -290
  53. package/dist/scene.js +0 -128
  54. package/dist/scene.js.map +0 -1
  55. package/dist/target-BBOCeez2.d.ts +0 -69
  56. package/dist/targets-C9ZVhmCl.d.ts +0 -621
  57. package/dist/targets.d.ts +0 -212
  58. package/dist/targets.js +0 -447
  59. package/dist/targets.js.map +0 -1
  60. package/dist/toolbar.d.ts +0 -167
  61. package/dist/toolbar.js +0 -55
  62. package/dist/toolbar.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/targets/desk.ts","../src/targets/toolbar.ts","../src/targets/stops.ts","../src/targets/zones.ts"],"sourcesContent":["/**\n * Each desk construction's drop targets, as pure functions: from the state with the dragged item lifted out, a list\n * of zones with a priority, each able to make the state with the item dropped there.\n *\n * - Edge docks (`docks`, `docksFull`, `dockTear`): a rail (priority 1) takes the panel at the end of its dock (a\n * folded dock keeps it in the rail); a slot between sections (2) and the bottom dock (2) take it at that place;\n * with tear-off, the documents area (3) tears it off to float there.\n * - Tiling tree (`tree`): each slot an insertion produces (2), a side column's row or a dwindle region of the\n * center; an empty side column's edge (2).\n * - Strip (`strip`): between two columns (2) makes a new column; a gap inside a column (2) puts it there.\n * - Navigator, drawers (`navigator`, `drawers`): a tab strip (1) at the tab under the pointer, a folded side's rail\n * (1), a side's panel (3); the panel becomes the side's showing one.\n * - Palettes (`floatOver`, `floatAround`): a corner stack's column (2) at the place under the pointer; anywhere\n * else in the area (3), snapped to the area's edges (over the documents, also to other palettes' edges).\n */\nimport { centre, clamp, overlap, rect, type Point, type Rect, type Size } from \"../geometry\";\nimport type { Construction } from \"../dock/constructions\";\nimport { BAR, G, RAIL, TITLE, idOf, isDocKey, isPanelKey, panelKey, touch, type DeskState, type Layout, type Options, type Side } from \"../dock/model\";\nimport {\n DOCK,\n OVER_MARGIN,\n PALETTE_NARROW,\n TORN_W,\n TREE_COLUMN,\n dockGeometry,\n paletteArea,\n paletteWidth,\n stripColumns,\n stripGeometry,\n treeArea,\n treeFloats,\n treeRails,\n treeShown,\n treeTiles,\n} from \"../dock/parts\";\nimport type { Target } from \"../target\";\n\n/** A target's drop for a pointer: the state with the item there, a label, and a key (same key, same place). */\nexport interface Made {\n readonly state: DeskState;\n readonly label: string;\n readonly key: string;\n}\n\nexport interface DeskTarget extends Target {\n /** The drop with the pointer at `p`, holding the item at `grab` from its top-left corner. */\n readonly make: (p: Point, grab: Point) => Made;\n /** Where the keyboard stops in this target, in order (default: its zone's center). */\n readonly stops?: readonly Point[];\n}\n\n/** A made drop, laid out. */\nexport interface DeskDrop extends Made {\n readonly target: string;\n readonly layout: Layout;\n /** Where the item lands. */\n readonly slot: Rect;\n /** It lands hidden (folded into a rail). */\n readonly hidden: boolean;\n /** It floats where it is dropped: no room is made for it. */\n readonly free: boolean;\n}\n\nexport interface DeskTargetInput {\n readonly c: Construction;\n /** The state with the dragged item lifted out (`liftOut`). */\n readonly s0: DeskState;\n readonly key: string;\n readonly size: Size;\n readonly opt: Options;\n}\n\n/** How close (stage px) a free drop has to come to an edge to snap to it. */\nexport const SNAP = 18;\n\nconst insert = <T>(list: readonly T[], i: number, x: T): T[] => [...list.slice(0, i), x, ...list.slice(i)];\nconst Cap = (s: Side): string => (s === \"left\" ? \"Left\" : \"Right\");\nconst fixed = (state: DeskState, label: string) => (): Made => ({ state, label, key: label });\n\n/** Zones `count + 1` slots split between items at `mids` (their centers), from `lo` to `hi`: slot i's span. */\nconst slotSpan = (mids: readonly number[], lo: number, hi: number, i: number): [number, number] => [i === 0 ? lo : mids[i - 1]!, i === mids.length ? hi : mids[i]!];\n\n// --- edge docks ----------------------------------------------------------------------------------------------------\n\nfunction dockTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const mode = c.id === \"docksFull\" ? \"full\" : \"between\";\n const d = dockGeometry(cat, s0, size, opt, mode);\n const l0 = c.layout(s0, size, opt);\n const W = size.width;\n const H = size.height;\n for (const side of [\"left\", \"right\"] as const) {\n const railed = l0.items.get(`rail:${side}`);\n if (!railed) continue;\n const label = `${Cap(side)} rail: into the ${side} dock`;\n out.push({ id: `rail:${side}`, priority: 1, hit: railed.rect, make: fixed(touch({ ...s0, [side]: [...s0[side], id] }, id), label) });\n if (side === \"left\" ? !d.lOpen : !d.rOpen) continue;\n // The dock's slots: each section's halves belong to the slots above and below it.\n const shown = side === \"left\" ? s0.left : d.right;\n const mids = shown.map((p) => centre(l0.items.get(panelKey(p))!.rect).y);\n const x = side === \"left\" ? RAIL : W - RAIL - DOCK;\n for (let i = 0; i <= shown.length; i++) {\n const [y0, y1] = slotSpan(mids, 0, d.h, i);\n // Past the side list (the bottom dock is off and its panels show here): into the bottom list.\n const state = i <= s0[side].length ? { ...s0, [side]: insert(s0[side], i, id) } : { ...s0, bottom: insert(s0.bottom, i - s0[side].length, id) };\n out.push({ id: `dock:${side}:${i}`, priority: 2, hit: rect(x, y0, DOCK, y1 - y0), make: fixed(touch(state, id), `${Cap(side)} dock · slot ${i + 1}`) });\n }\n }\n if (opt.bottom !== \"off\") {\n const b = d.bottomRect ?? rect(d.x0, H - 40 - G, d.x1 - d.x0, 40);\n const mids = s0.bottom.map((p) => centre(l0.items.get(panelKey(p))!.rect).x);\n for (let i = 0; i <= s0.bottom.length; i++) {\n const [x0, x1] = slotSpan(mids, b.x, b.x + b.width, i);\n out.push({ id: `bottom:${i}`, priority: 2, hit: rect(x0, b.y - 24, x1 - x0, H - b.y + 24), make: fixed(touch({ ...s0, bottom: insert(s0.bottom, i, id) }, id), `Bottom dock · slot ${i + 1}`) });\n }\n }\n if (c.id === \"dockTear\") {\n // Torn off, floating where it is dropped; snapped to the documents' edges, kept on the stage.\n out.push({\n id: \"float\",\n priority: 3,\n free: true,\n hit: rect(d.x0, 0, d.x1 - d.x0, H),\n make: (p, grab) => {\n let x = p.x - grab.x;\n let y = p.y - grab.y;\n if (Math.abs(x - d.x0) < SNAP) x = d.x0;\n if (Math.abs(x + TORN_W - d.x1) < SNAP) x = d.x1 - TORN_W;\n if (Math.abs(y - G) < SNAP) y = G;\n x = clamp(x, 0, W - TORN_W);\n y = clamp(y, 0, H - Math.min(cat.natural(id), H));\n return { state: touch({ ...s0, torn: [...s0.torn, { id, at: { x, y } }] }, id), label: \"Float here\", key: `float:${Math.round(x)},${Math.round(y)}` };\n },\n });\n }\n return out;\n}\n\n// --- tiling tree ---------------------------------------------------------------------------------------------------\n\n/**\n * The tree's targets are the slots an insertion produces: inserting at place i of a side column gives row i of its\n * n + 1 rows, inserting at place i of the center gives dwindle's region i of n + 1. Those regions tile the column and\n * the center, so a zone is where the item lands (unless that makes the newest tile float, which reshapes the rest);\n * the label says where it lands in the tree as laid out, and what floats.\n */\nfunction treeTargets({ c, s0, key, size }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const area = treeArea(size, s0);\n // The tree as tiled: a column folded to its rail offers its rail instead of its rows.\n const t = treeShown(s0);\n const rails = treeRails(s0);\n // A side column is narrower than a document's minimum: a document dropped into one would only float.\n const sides = !isDocKey(key);\n for (const [side, group] of [[\"left\", \"L\"], [\"right\", \"R\"]] as const) {\n if (!sides || !rails[side]) continue;\n const hit = rect(side === \"left\" ? 0 : size.width - RAIL, BAR, RAIL, size.height - BAR);\n out.push({ id: `rail:${side}`, priority: 1, hit, make: fixed({ ...s0, tree: { ...s0.tree, [group]: [...s0.tree[group], key] } }, `${Cap(side)} rail: into the ${side} column`) });\n }\n if (sides && s0.tree.L.length === 0) out.push({ id: \"edge:L\", priority: 2, hit: rect(area.x, area.y, 30, area.height), make: fixed({ ...s0, tree: { ...s0.tree, L: [key] } }, \"New left column\") });\n if (sides && s0.tree.R.length === 0) out.push({ id: \"edge:R\", priority: 2, hit: rect(area.x + area.width - 30, area.y, 30, area.height), make: fixed({ ...s0, tree: { ...s0.tree, R: [key] } }, \"New right column\") });\n const x0 = area.x + (t.L.length ? TREE_COLUMN + G : 0);\n const x1 = area.x + area.width - (t.R.length ? TREE_COLUMN + G : 0);\n const middle = rect(x0, area.y, x1 - x0, area.height);\n const NAME = { L: \"Left column\", R: \"Right column\", C: \"Centre\" } as const;\n const seen: { label: string; hit: Rect }[] = [];\n const sameZone = (a: Rect, b: Rect): boolean => Math.max(Math.abs(a.x - b.x), Math.abs(a.y - b.y), Math.abs(a.width - b.width), Math.abs(a.height - b.height)) < 0.5;\n for (const group of [\"L\", \"R\", \"C\"] as const) {\n const list = t[group];\n if (group !== \"C\" && list.length === 0) continue;\n if (group !== \"C\" && !sides) continue;\n for (let i = 0; i <= list.length; i++) {\n const state = { ...s0, tree: { ...s0.tree, [group]: insert(list, i, key) } };\n const shown = treeShown(state);\n // The slot as laid out once the tiles that break a minimum have floated (as laid out without them if it floats).\n const tiled = treeFloats(cat, shown, area);\n const zone = treeTiles(cat, tiled.floats.includes(key) ? shown : tiled.tree, area).get(key)!;\n const label = `${NAME[group]}, ${landing(c, shown, area, key, group, middle)}`;\n // Places that come out the same (around a floating tile) are one target: the keyboard stops there once.\n if (seen.some((o) => o.label === label && sameZone(o.hit, zone))) continue;\n seen.push({ label, hit: zone });\n out.push({ id: `tile:${group}:${i}`, priority: 2, hit: zone, make: fixed(state, label) });\n }\n }\n return out;\n}\n\n/**\n * Where `key` lands in the tree as laid out (after the newest tiles that break a minimum float): its row of its\n * column, or its region of the center; or that it floats, or what floats because of it.\n */\nfunction landing(c: Construction, tree: DeskState[\"tree\"], area: Rect, key: string, group: \"L\" | \"R\" | \"C\", middle: Rect): string {\n const cat = c.desk.catalog;\n const { tree: tiled, floats } = treeFloats(cat, tree, area);\n if (floats.includes(key)) return \"it floats there (too small)\";\n const others = floats.length ? `; ${floats.map(cat.title).join(\", \")} ${floats.length > 1 ? \"float\" : \"floats\"}` : \"\";\n if (group !== \"C\") return `row ${tiled[group].indexOf(key) + 1} of ${tiled[group].length}${others}`;\n const x0 = tiled.L.length ? middle.x : area.x;\n const x1 = tiled.R.length ? middle.x + middle.width : area.x + area.width;\n return `${regionName(treeTiles(cat, tiled, area).get(key)!, rect(x0, area.y, x1 - x0, area.height))}${others}`;\n}\n\n/** Where a region lies in `whole`, in words: \"all of it\", \"left half\", \"top right\"… */\nfunction regionName(r: Rect, whole: Rect): string {\n const near = (a: number, b: number): boolean => Math.abs(a - b) < 1;\n const h = near(r.width, whole.width) ? \"\" : near(r.x, whole.x) ? \"left\" : near(r.x + r.width, whole.x + whole.width) ? \"right\" : \"middle\";\n const v = near(r.height, whole.height) ? \"\" : near(r.y, whole.y) ? \"top\" : near(r.y + r.height, whole.y + whole.height) ? \"bottom\" : \"middle\";\n if (!h && !v) return \"all of it\";\n if (!v) return `${h} part`;\n if (!h) return `${v} part`;\n return `${v} ${h}`;\n}\n\n// --- scrolling strip -----------------------------------------------------------------------------------------------\n\nfunction stripTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const g = stripGeometry(cat, s0, size);\n const l0 = c.layout(s0, size, opt);\n // The laid-out columns, each with the state column it comes from and where in it it starts.\n const parts: { owner: number; start: number; keys: string[] }[] = [];\n s0.cols.forEach((col, owner) => {\n let start = 0;\n for (const keys of stripColumns(cat, [col], g.h)) {\n parts.push({ owner, start, keys });\n start += keys.length;\n }\n });\n const newColumn = (at: number, label: string): Made => ({ state: { ...s0, cols: insert(s0.cols, at, [key]) }, label, key: label });\n if (parts.length === 0) return [{ id: \"strip\", priority: 3, hit: rect(0, g.y, size.width, g.h), make: () => newColumn(0, \"The strip\") }];\n // Between columns: a band across each boundary where a state column starts or ends.\n for (let k = 0; k <= parts.length; k++) {\n if (k < parts.length && parts[k]!.start !== 0) continue;\n const x = k < parts.length ? g.xs[k]! - G / 2 : g.xs[parts.length - 1]! + g.widths[parts.length - 1]! + G / 2;\n const at = k < parts.length ? parts[k]!.owner : s0.cols.length;\n const label = k === 0 ? \"New column at the start\" : k === parts.length ? \"New column at the end\" : `New column before ${cat.title(parts[k]!.keys[0]!)}`;\n out.push({ id: `between:${at}`, priority: 2, hit: rect(x - 28, g.y, 56, g.h), make: () => newColumn(at, label) });\n }\n // Inside a column: each item's halves belong to the gaps above and below it.\n parts.forEach((part, k) => {\n const mids = part.keys.map((pk) => centre(l0.items.get(pk)!.rect).y);\n for (let j = 0; j <= part.keys.length; j++) {\n const [y0, y1] = slotSpan(mids, g.y, g.y + g.h, j);\n const at = part.start + j;\n const cols = s0.cols.map((col, ci) => (ci === part.owner ? insert(col, at, key) : col));\n const label = `Into the column with ${cat.title(s0.cols[part.owner]![0]!)} · ${at + 1}`;\n out.push({ id: `into:${part.owner}:${at}`, priority: 2, hit: rect(g.xs[k]!, y0, g.widths[k]!, y1 - y0), make: fixed({ ...s0, cols }, label) });\n }\n });\n return out;\n}\n\n// --- navigator and drawers -----------------------------------------------------------------------------------------\n\nfunction tabTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const l0 = c.layout(s0, size, opt);\n const onSide = (side: Side, i: number): DeskState => touch({ ...s0, [side]: insert(s0[side], i, id), active: { ...s0.active, [side]: id } }, id);\n for (const side of [\"left\", \"right\"] as const) {\n const list = s0[side];\n const tabs = l0.items.get(`tabs:${side}`);\n const railed = l0.items.get(`rail:${side}`);\n if (tabs && !tabs.hidden) {\n const r = tabs.rect;\n const tw = r.width / (list.length + 1);\n out.push({\n id: `tabs:${side}`,\n priority: 1,\n hit: rect(r.x, r.y - 4, r.width, r.height + 8),\n make: (p) => {\n const i = clamp(Math.floor((p.x - r.x) / tw), 0, list.length);\n const label = `${Cap(side)} tab strip · tab ${i + 1}`;\n return { state: onSide(side, i), label, key: label };\n },\n stops: Array.from({ length: list.length + 1 }, (_, i) => ({ x: r.x + tw * (i + 0.5), y: r.y + r.height / 2 })),\n });\n const panel = list.map((p) => l0.items.get(panelKey(p))).find((pl) => pl && !pl.hidden);\n if (panel) out.push({ id: `side:${side}`, priority: 3, hit: panel.rect, make: fixed(onSide(side, list.length), `${Cap(side)} side`) });\n }\n if (railed && !railed.hidden) out.push({ id: `rail:${side}`, priority: 1, hit: railed.rect, make: fixed(onSide(side, list.length), `${Cap(side)} rail`) });\n if (list.length === 0 && (!railed || railed.hidden)) {\n const hit = side === \"left\" ? rect(0, 0, 40, size.height) : rect(size.width - 40, 0, 40, size.height);\n out.push({ id: `edge:${side}`, priority: 2, hit, make: fixed(onSide(side, 0), `${Cap(side)} side`) });\n }\n }\n return out;\n}\n\n// --- palettes ------------------------------------------------------------------------------------------------------\n\nfunction paletteTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const { area } = paletteArea(size, opt);\n const m = c.id === \"floatOver\" ? OVER_MARGIN : 0;\n const pw = paletteWidth(size.width);\n const ph = s0.folded.includes(id) ? TITLE : cat.natural(id);\n const narrow = size.width < PALETTE_NARROW;\n const anchor = { left: area.x + m, right: area.x + area.width - m - pw };\n const l0 = c.layout(s0, size, opt);\n const rectOf = (pid: number): Rect => l0.items.get(panelKey(pid))!.rect;\n const tb = l0.items.get(\"toolbar\");\n const pillRect = tb?.look === \"pill\" ? tb.rect : null;\n // A corner stack's column, down to just under its last palette: it joins the stack at the place under the pointer.\n for (const side of narrow ? ([\"right\"] as const) : ([\"left\", \"right\"] as const)) {\n const ids = narrow ? [...s0.stacks.left, ...s0.stacks.right] : [...s0.stacks[side]];\n const bottom = ids.length ? Math.max(...ids.map((pid) => rectOf(pid).y + rectOf(pid).height)) : area.y + m;\n const at = (y: number): number => ids.filter((pid) => centre(rectOf(pid)).y < y).length;\n const join = (i: number): Made => {\n let stacks = s0.stacks;\n if (!narrow) stacks = { ...stacks, [side]: insert(stacks[side], i, id) };\n else if (i <= s0.stacks.left.length) stacks = { ...stacks, left: insert(stacks.left, i, id) };\n else stacks = { ...stacks, right: insert(stacks.right, i - s0.stacks.left.length, id) };\n const label = `${narrow ? \"The\" : Cap(side)} corner stack · ${i + 1}`;\n return { state: touch({ ...s0, stacks }, id), label, key: label };\n };\n out.push({\n id: `stack:${side}`,\n priority: 2,\n hit: rect(anchor[side], area.y, pw, bottom + 30 - area.y),\n make: (p) => join(at(p.y)),\n stops: [area.y + m, ...ids.map((pid) => rectOf(pid).y + rectOf(pid).height + G / 2)].map((y) => ({ x: anchor[side] + pw / 2, y })),\n });\n }\n // Anywhere: snapped to the area's edges (over the documents also to other palettes' edges), kept inside the area.\n out.push({\n id: \"free\",\n priority: 3,\n free: true,\n hit: area,\n make: (p, grab) => {\n let x = p.x - grab.x;\n let y = p.y - grab.y;\n const snaps: string[] = [];\n if (Math.abs(x - anchor.left) < SNAP) [x, snaps[0]] = [anchor.left, \"left edge\"];\n else if (Math.abs(x - anchor.right) < SNAP) [x, snaps[0]] = [anchor.right, \"right edge\"];\n if (Math.abs(y - (area.y + m)) < SNAP) [y, snaps[1]] = [area.y + m, \"top\"];\n else if (Math.abs(y + ph - (area.y + area.height - m)) < SNAP) [y, snaps[1]] = [area.y + area.height - m - ph, \"bottom\"];\n if (c.id === \"floatOver\") {\n for (const [k, pl] of l0.items) {\n if (!isPanelKey(k) || pl.hidden) continue;\n const o = pl.rect;\n if (snaps[0] === undefined && Math.abs(x - o.x) < SNAP) [x, snaps[0]] = [o.x, `${cat.title(k)}'s edge`];\n if (snaps[1] === undefined && Math.abs(y - (o.y + o.height + G)) < SNAP && x < o.x + o.width && x + pw > o.x) [y, snaps[1]] = [o.y + o.height + G, `under ${cat.title(k)}`];\n }\n }\n x = clamp(x, area.x, area.x + area.width - pw);\n y = clamp(y, area.y, area.y + area.height - ph);\n // Never under a floating pill: it moves clear, below a pill at the top, above one at the bottom.\n if (pillRect && overlap(rect(x, y, pw, ph), pillRect) > 0) {\n y = pillRect.y < size.height / 2 ? pillRect.y + pillRect.height + G : pillRect.y - G - ph;\n y = clamp(y, 0, size.height - ph);\n snaps[1] = \"clear of the toolbar\";\n }\n const how = snaps.filter(Boolean).join(\", \");\n return { state: touch({ ...s0, free: [...s0.free, { id, at: { x, y } }] }, id), label: how ? `Here · snapped to the ${how}` : \"Here\", key: `free:${Math.round(x)},${Math.round(y)}` };\n },\n });\n return out;\n}\n\n/** The drop targets for dragging `key` in construction `c`, in a fixed order (the keyboard's). */\nexport function deskTargets(input: DeskTargetInput): DeskTarget[] {\n switch (input.c.id) {\n case \"docks\":\n case \"docksFull\":\n case \"dockTear\":\n return dockTargets(input);\n case \"tree\":\n return treeTargets(input);\n case \"strip\":\n return stripTargets(input);\n case \"navigator\":\n case \"drawers\":\n return tabTargets(input);\n case \"floatOver\":\n case \"floatAround\":\n return paletteTargets(input);\n }\n}\n\n/** A target's drop for a pointer at `p` holding the item at `grab`, laid out: where the item lands. */\nexport function deskDrop(input: DeskTargetInput, target: DeskTarget, p: Point, grab: Point): DeskDrop {\n const made = target.make(p, grab);\n const layout = input.c.layout(made.state, input.size, input.opt);\n const placed = layout.items.get(input.key)!;\n return { ...made, key: `${target.id}|${made.key}`, target: target.id, layout, slot: placed.rect, hidden: !!placed.hidden, free: !!target.free };\n}\n","/**\n * Toolbar group targets: a host's insertion points (lines between groups, priority 2) and empty zones (priority 1),\n * and floating over the content (priority 3). A group's own place is home, never a target: its stretch comes back\n * in `own`, for the consumer to join to the drag's home. A place `allows` forbids is no host target either.\n */\nimport { rect, type Point, type Rect } from \"../geometry\";\nimport { ZONES, floatGroup, insertGroup, insertions, isOwnPlace, layoutHost, vertical, withoutGroup, type Arrangement, type GroupSize, type HostId, type HostSpec, type Place } from \"../toolbar\";\nimport type { Target } from \"../target\";\n\n/** How far a line's hit reaches beyond the host's thickness on each side; an empty zone's. */\nexport const LINE_REACH = 12;\nexport const ZONE_REACH = 4;\n\nexport interface ToolbarTarget<G extends string = string> extends Target {\n readonly label: string;\n readonly kind: \"line\" | \"zone\";\n readonly place: Place;\n /** It lands in a side edge's column. */\n readonly vertical: boolean;\n /** The insertion line (3 px, inset 4 px from the host's sides) in stage coordinates; for an empty zone, at its middle. */\n readonly line: Rect;\n /** Where the group lands, in stage coordinates: its rect in the host once the drop is made. */\n readonly slot: Rect;\n /** The arrangement a drop here makes. */\n readonly arrangement: Arrangement<G>;\n}\n\n/**\n * Where a group may go: a host's place, or floating. `hostTargets` leaves out a place it refuses; for floating, the\n * consumer adds `floatTarget` only when `allows(group, \"float\")`, so one rule covers both. `place.index` counts the\n * groups in that zone without the dragged one (as `insertGroup` does): 0 is before all of the others.\n */\nexport type Allows<G extends string> = (group: G, place: Place | \"float\") => boolean;\n\nexport interface HostTargetsInput<G extends string> {\n readonly group: G;\n /** The arrangement as it is, the group still in its place. */\n readonly arrangement: Arrangement<G>;\n readonly host: HostId;\n /** The host's top-left corner in stage coordinates. */\n readonly origin: Point;\n readonly spec: HostSpec<G>;\n readonly size: GroupSize<G>;\n /** A group's name in the labels (default: its id). */\n readonly label?: (g: G) => string;\n /** Where the group may go (default: anywhere). A place it may not go is left out. */\n readonly allows?: Allows<G>;\n /**\n * Where this host is, and how long, once a drop has made `arrangement` (a host may grow or appear when it gets a\n * group); default: where it is now. The targets' `slot`s are laid out there.\n */\n readonly hostAfter?: (arrangement: Arrangement<G>) => { readonly origin: Point; readonly spec: HostSpec<G> };\n}\n\n/** The targets a host offers a dragged group, zone by zone in order, and the stretches that are its own place. */\nexport function hostTargets<G extends string>(input: HostTargetsInput<G>): { targets: ToolbarTarget<G>[]; own: Rect[] } {\n const { group, arrangement: a, host: h, origin: o, spec } = input;\n const slotIn = (after: Arrangement<G>): Rect => {\n const at = input.hostAfter?.(after) ?? { origin: o, spec };\n const r = layoutHost(after[h], h, at.spec, input.size, after.collapsed).slots.get(group)!;\n return rect(at.origin.x + r.x, at.origin.y + r.y, r.width, r.height);\n };\n const a0 = withoutGroup(a, group);\n const l = layoutHost(a0[h], h, spec, input.size, a0.collapsed);\n const v = vertical(h);\n const T = spec.thickness;\n const across = (s0: number, s1: number, reach: number): Rect => (v ? rect(o.x - reach, o.y + s0, T + 2 * reach, s1 - s0) : rect(o.x + s0, o.y - reach, s1 - s0, T + 2 * reach));\n const targets: ToolbarTarget<G>[] = [];\n const own: Rect[] = [];\n const pts = insertions(a0[h], h, spec, l, input.label).sort((p, q) => ZONES.indexOf(p.zone) - ZONES.indexOf(q.zone) || p.index - q.index);\n for (const p of pts) {\n const [s0, s1] = p.span;\n const place: Place = { host: h, zone: p.zone, index: p.index };\n if (isOwnPlace(a, group, place)) {\n own.push(across(s0, s1, LINE_REACH));\n continue;\n }\n if (input.allows && !input.allows(group, place)) continue;\n const after = insertGroup(a, group, h, p.zone, p.index);\n targets.push({\n id: `g:${h}:${p.zone}:${p.index}`,\n priority: p.empty ? 1 : 2,\n hit: p.empty ? across(s0, s1, ZONE_REACH) : across(s0, s1, LINE_REACH),\n label: p.label,\n kind: p.empty ? \"zone\" : \"line\",\n place,\n vertical: v,\n line: v ? rect(o.x + 4, o.y + p.at - 1.5, T - 8, 3) : rect(o.x + p.at - 1.5, o.y + 4, 3, T - 8),\n slot: slotIn(after),\n arrangement: after,\n });\n }\n return { targets, own };\n}\n\nexport interface ToolbarFloatTarget<G extends string = string> extends Target {\n readonly label: string;\n readonly kind: \"float\";\n /** The group's top-left corner relative to the stage, and the arrangement, for a drop with the pointer at `p`. */\n readonly make: (p: Point, grab: Point) => Arrangement<G>;\n}\n\nexport interface FloatTargetInput<G extends string> {\n readonly group: G;\n readonly arrangement: Arrangement<G>;\n /** The content the group floats over, in stage coordinates. */\n readonly stage: Rect;\n /** The group's size as it floats. */\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Floating over the content (`stage`, in stage coordinates): the group's top-left corner kept on the stage. A\n * group that may not float simply gets no float target: add it only when your rule allows it, with the same\n * `allows` you give `hostTargets`: `...(allows(group, \"float\") ? [floatTarget(input)] : [])`.\n */\nexport function floatTarget<G extends string>(input: FloatTargetInput<G>): ToolbarFloatTarget<G> {\n const { group, arrangement, stage } = input;\n return {\n id: \"g:float\",\n priority: 3,\n free: true,\n hit: stage,\n label: \"Float here\",\n kind: \"float\",\n // Kept on the stage; a group larger than the stage keeps its top-left corner on the stage's.\n make: (p, grab) => {\n const x = Math.max(0, Math.min(p.x - grab.x - stage.x, stage.width - input.width));\n const y = Math.max(0, Math.min(p.y - grab.y - stage.y, stage.height - input.height));\n return floatGroup(arrangement, group, x, y);\n },\n };\n}\n","/**\n * Keyboard stops: every place a toolbar group can go, in one list in reading order, for the arrow keys and a\n * \"Move to\" menu alike. A consumer steps through the list; it never parses target ids.\n */\nimport { centre, type Point } from \"../geometry\";\nimport { panelStops, type PanelStop, type PanelStopsOptions, type PanelTarget } from \"../panels/targets\";\nimport { HOST_LABEL, ZONES, zoneLabel, type Arrangement, type HostId, type Place } from \"../toolbar\";\nimport type { ToolbarFloatTarget, ToolbarTarget } from \"./toolbar\";\n\n/** The hosts in reading order: the title bar, the top bar, the left edge, the right edge, the bottom bar. */\nexport const HOST_READING_ORDER: readonly HostId[] = [\"title\", \"top\", \"left\", \"right\", \"bottom\"];\n\nexport interface KeyboardStop<G extends string = string> {\n /** The target's id (\"home\" for the group's own place). */\n readonly id: string;\n readonly label: string;\n /** Where in a host it is; null for floating. */\n readonly place: Place | null;\n /** The arrangement a move here makes (the current one for home). */\n readonly arrangement: Arrangement<G>;\n /** The group's own place: where the keyboard starts, and a move there changes nothing. */\n readonly home: boolean;\n}\n\nexport interface KeyboardStopsOptions<G extends string> {\n /** The group's own place, as a stop of its own in its reading-order position (the targets leave it out). */\n readonly home?: { readonly place: Place; readonly arrangement: Arrangement<G>; readonly label?: string };\n /**\n * Floating targets as stops at the end (default: left out). `at` is where the pointer would drop it and `grab`\n * where it holds the group (default: the float target's middle, the group's top-left corner).\n */\n readonly floats?: boolean | { readonly at: Point; readonly grab?: Point };\n}\n\nconst isFloat = <G extends string>(t: ToolbarTarget<G> | ToolbarFloatTarget<G>): t is ToolbarFloatTarget<G> => t.kind === \"float\";\n\n/** Reading order of a place: host, then zone, then index. */\nconst rank = (p: Place): number => HOST_READING_ORDER.indexOf(p.host) * 3000 + ZONES.indexOf(p.zone) * 1000 + p.index;\n\nconst isPanelTargets = (targets: readonly object[], options: { readonly home?: object }): boolean => targets.some((t) => \"panel\" in t) || (targets.length === 0 && !!options.home && \"state\" in options.home);\n\n/**\n * The places a group can go, in reading order: toolbar areas title → top → left → right → bottom, zones start → center →\n * end, then each insertion point in order; the group's own place among them when `home` is given; floating targets\n * at the end only when `floats` asks for them. One list serves the arrow keys and a \"Move to\" menu.\n *\n * Given panel targets (`@n-uf/placement/panels`' `panelTargets`), the same for a panel: left to right across the\n * stage (the left rail, the left side's lines and columns outer to inner, the right side's inner to outer, the right\n * rail), floating last when asked; each stop carries the state a move there makes (`panelStops`).\n */\nexport function keyboardStops(targets: readonly PanelTarget[], options?: PanelStopsOptions): PanelStop[];\nexport function keyboardStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options?: KeyboardStopsOptions<G>): KeyboardStop<G>[];\nexport function keyboardStops<G extends string>(\n targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[] | readonly PanelTarget[],\n options: KeyboardStopsOptions<G> | PanelStopsOptions = {},\n): KeyboardStop<G>[] | PanelStop[] {\n if (isPanelTargets(targets, options)) return panelStops(targets as readonly PanelTarget[], options as PanelStopsOptions);\n return toolbarStops(targets as readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options as KeyboardStopsOptions<G>);\n}\n\nfunction toolbarStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options: KeyboardStopsOptions<G>): KeyboardStop<G>[] {\n const placed: KeyboardStop<G>[] = [];\n const floating: KeyboardStop<G>[] = [];\n for (const t of targets) {\n if (!isFloat(t)) {\n placed.push({ id: t.id, label: t.label, place: t.place, arrangement: t.arrangement, home: false });\n continue;\n }\n if (!options.floats) continue;\n const at = options.floats === true ? centre(t.hit) : options.floats.at;\n const grab = options.floats === true ? { x: 0, y: 0 } : (options.floats.grab ?? { x: 0, y: 0 });\n floating.push({ id: t.id, label: t.label, place: null, arrangement: t.make(at, grab), home: false });\n }\n const h = options.home;\n if (h) placed.push({ id: \"home\", label: h.label ?? `${HOST_LABEL[h.place.host]} · ${zoneLabel(h.place.host, h.place.zone)} · current place`, place: h.place, arrangement: h.arrangement, home: true });\n placed.sort((a, b) => rank(a.place!) - rank(b.place!));\n return [...placed, ...floating];\n}\n","/**\n * A pane's drop zones, the old names of `@n-uf/placement/tiling`'s pane drop regions. Each wraps the tiling function\n * and maps the old option names; all are deprecated and go when this entry does.\n */\nimport type { Point, Rect, Size } from \"../geometry\";\nimport { PANE_REGION_DEFAULTS, PANE_SIDES, paneCenter, paneRegion, type PaneCenter, type PaneRegion, type PaneRegionOptions, type PaneSide } from \"../tiling\";\n\n/** @deprecated Use `PaneRegion` from `@n-uf/placement/tiling`. */\nexport type PaneZone = PaneRegion;\n\n/** @deprecated Use `PANE_SIDES` from `@n-uf/placement/tiling`. */\nexport const PANE_EDGES: readonly PaneSide[] = PANE_SIDES;\n\n/** @deprecated Use `PaneRegionOptions` from `@n-uf/placement/tiling` (`center`, `centerX`, `centerY`, `centerMin`). */\nexport interface PaneZoneOptions {\n readonly centre?: number;\n readonly centreX?: number;\n readonly centreY?: number;\n readonly centreMin?: number;\n readonly hysteresis?: number;\n readonly pixelRatio?: number;\n}\n\nconst R = PANE_REGION_DEFAULTS;\n/** @deprecated Use `PANE_REGION_DEFAULTS` from `@n-uf/placement/tiling`. */\nexport const PANE_ZONE_DEFAULTS: Required<Omit<PaneZoneOptions, \"centreX\" | \"centreY\">> = { centre: R.center, centreMin: R.centerMin, hysteresis: R.hysteresis, pixelRatio: R.pixelRatio };\n\n/** @deprecated Use `PaneCenter` from `@n-uf/placement/tiling`. */\nexport type PaneCentre = PaneCenter;\n\n/** The old option names as the new ones. */\nconst regionOptions = (o: PaneZoneOptions): PaneRegionOptions => ({\n ...(o.centre === undefined ? {} : { center: o.centre }),\n ...(o.centreX === undefined ? {} : { centerX: o.centreX }),\n ...(o.centreY === undefined ? {} : { centerY: o.centreY }),\n ...(o.centreMin === undefined ? {} : { centerMin: o.centreMin }),\n ...(o.hysteresis === undefined ? {} : { hysteresis: o.hysteresis }),\n ...(o.pixelRatio === undefined ? {} : { pixelRatio: o.pixelRatio }),\n});\n\n/** @deprecated Use `paneCenter` from `@n-uf/placement/tiling`. */\nexport const paneCentre = (size: Size, options: PaneZoneOptions = {}): PaneCenter => paneCenter(size, regionOptions(options));\n\n/** @deprecated Use `paneRegion` from `@n-uf/placement/tiling`. */\nexport const paneZone = (rect: Rect, point: Point, previous: PaneZone | null = null, options: PaneZoneOptions = {}): PaneZone => paneRegion(rect, point, previous, regionOptions(options));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,IAAM,OAAO;AAEpB,IAAM,SAAS,CAAI,MAAoB,GAAW,MAAc,CAAC,GAAG,KAAK,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,KAAK,MAAM,CAAC,CAAC;AACzG,IAAM,MAAM,CAAC,MAAqB,MAAM,SAAS,SAAS;AAC1D,IAAM,QAAQ,CAAC,OAAkB,UAAkB,OAAa,EAAE,OAAO,OAAO,KAAK,MAAM;AAG3F,IAAM,WAAW,CAAC,MAAyB,IAAY,IAAY,MAAgC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AAMzL,IAAM,gBAAgB,CAAC,OAA2C;AAAA,EAChE,GAAI,EAAE,WAAW,SAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO;AAAA,EACrD,GAAI,EAAE,YAAY,SAAY,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ;AAAA,EACxD,GAAI,EAAE,YAAY,SAAY,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ;AAAA,EACxD,GAAI,EAAE,cAAc,SAAY,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU;AAAA,EAC9D,GAAI,EAAE,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW;AAAA,EACjE,GAAI,EAAE,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW;AACnE;AAGO,IAAM,aAAa,CAAC,MAAY,UAA2B,CAAC,MAAkB,WAAW,MAAM,cAAc,OAAO,CAAC;AAGrH,IAAM,WAAW,CAACA,OAAY,OAAc,WAA4B,MAAM,UAA2B,CAAC,MAAgB,WAAWA,OAAM,OAAO,UAAU,cAAc,OAAO,CAAC;","names":["rect"]}
package/dist/toolbar.d.ts DELETED
@@ -1,167 +0,0 @@
1
- import { R as Rect } from './geometry-Bf37LbCT.js';
2
-
3
- /**
4
- * @n-uf/placement/toolbar: toolbar groups as a pure model. Commands come in groups, each sitting in one of five
5
- * toolbar areas (the title bar, the top toolbar, a bottom toolbar, a left and a right side toolbar), in one of three
6
- * zones (start, center, end; top, middle, bottom on a side), in order; or floating. A toolbar is a slot: it never moves
7
- * itself, its groups do. Group sizes come in as numbers; group ids are the consumer's strings.
8
- *
9
- * - A toolbar area lays its zones out along its length: start from the lead, end up to the tail, the center centered on
10
- * the whole area; when the center would hit the start or end zone it centers in the space between them.
11
- * - Toolbars never wrap: when room runs out, groups collapse to their grip and » from the trailing end. A group
12
- * collapsed by hand stays collapsed.
13
- * - A group drop lands in a zone before all, after all, or between two groups. An empty zone is a target of its
14
- * own. A group's home is its own place: a drop there changes nothing.
15
- *
16
- * A legacy entry. See docs/placement.md, Entry: toolbar.
17
- */
18
-
19
- type HostId = "title" | "top" | "bottom" | "left" | "right";
20
- type ZoneId = "start" | "center" | "end";
21
- type Zones<G extends string = string> = Readonly<Record<ZoneId, readonly G[]>>;
22
- /** Where a group is docked: a host, a zone, and its index there. */
23
- interface Place {
24
- readonly host: HostId;
25
- readonly zone: ZoneId;
26
- readonly index: number;
27
- }
28
- /** A group floating over the content: its top-left corner, and where it was docked. */
29
- interface Floating<G extends string = string> {
30
- readonly id: G;
31
- readonly x: number;
32
- readonly y: number;
33
- readonly from: Place | null;
34
- }
35
- type Arrangement<G extends string = string> = Readonly<Record<HostId, Zones<G>>> & {
36
- /** Groups collapsed to their handle and » by hand. */
37
- readonly collapsed: readonly G[];
38
- readonly floating: readonly Floating<G>[];
39
- };
40
- declare const HOSTS: readonly HostId[];
41
- declare const ZONES: readonly ZoneId[];
42
- declare const HOST_LABEL: Readonly<Record<HostId, string>>;
43
- declare const zoneLabel: (h: HostId, z: ZoneId) => string;
44
- /** The side edges hold their groups in a column. */
45
- declare const vertical: (h: HostId) => boolean;
46
- /** Between two groups (the handle of the second is the separator). */
47
- declare const GAP = 12;
48
- /** Between zones. */
49
- declare const ZONE_GAP = 16;
50
- /** An arrangement from the zones each host has (the rest empty), nothing collapsed or floating. */
51
- declare function arrangement<G extends string>(p: Partial<Record<HostId, Partial<Record<ZoneId, readonly G[]>>>>): Arrangement<G>;
52
- /** Where `g` is docked (null: floating or absent). */
53
- declare function hostOf<G extends string>(a: Arrangement<G>, g: G): Place | null;
54
- /** The arrangement with group `g` lifted out (of its host, or from floating). */
55
- declare const withoutGroup: <G extends string>(a: Arrangement<G>, g: G) => Arrangement<G>;
56
- /** The arrangement with `g` docked at place `i` of zone `zone` of host `h` (`i` counts the others). */
57
- declare function insertGroup<G extends string>(a: Arrangement<G>, g: G, h: HostId, zone: ZoneId, i: number): Arrangement<G>;
58
- /** `g` floating with its top-left corner at (x, y); it remembers where it was docked. */
59
- declare function floatGroup<G extends string>(a: Arrangement<G>, g: G, x: number, y: number): Arrangement<G>;
60
- /** `g` docked again where it floated from, else where `home` (the default arrangement) has it. */
61
- declare function dockGroup<G extends string>(a: Arrangement<G>, g: G, home: Arrangement<G>): Arrangement<G>;
62
- /** `g` back where `home` (the default arrangement) has it, expanded. */
63
- declare function resetGroup<G extends string>(a: Arrangement<G>, g: G, home: Arrangement<G>): Arrangement<G>;
64
- /** `g` moved to host `h`: after its last group (in its last zone that has any), or into its start zone. */
65
- declare function moveToHost<G extends string>(a: Arrangement<G>, g: G, h: HostId): Arrangement<G>;
66
- /** Every group of host `from` moved to host `to`, zone by zone, after the groups there. */
67
- declare function moveBar<G extends string>(a: Arrangement<G>, from: HostId, to: HostId): Arrangement<G>;
68
- declare const toggleCollapsed: <G extends string>(a: Arrangement<G>, g: G) => Arrangement<G>;
69
- declare const isEmptyHost: <G extends string>(a: Arrangement<G>, h: HostId) => boolean;
70
- /**
71
- * The same arrangement: the same groups in the same order in every zone of every host, the same groups collapsed,
72
- * and the same groups floating at the same corner with the same home (in any order: neither list's order means
73
- * anything). Compared field by field, so how the arrangement was written down (its keys' order) doesn't matter.
74
- */
75
- declare function sameArrangement<G extends string>(a: Arrangement<G>, b: Arrangement<G>): boolean;
76
- /** Dropping `g` at `place` changes nothing: it is the group's home, never a target. */
77
- declare const isOwnPlace: <G extends string>(a: Arrangement<G>, g: G, place: Place) => boolean;
78
- /** An arrangement as stored: version 1. */
79
- interface StoredArrangement<G extends string = string> {
80
- readonly v: 1;
81
- readonly hosts: Readonly<Record<HostId, Readonly<Record<ZoneId, readonly G[]>>>>;
82
- readonly collapsed: readonly G[];
83
- readonly floating: readonly {
84
- readonly id: G;
85
- readonly x: number;
86
- readonly y: number;
87
- readonly from: Place | null;
88
- }[];
89
- }
90
- /** What reading a stored arrangement gives: the arrangement, or why it couldn't be read. Never a throw. */
91
- type ArrangementRead<G extends string = string> = {
92
- readonly ok: true;
93
- readonly arrangement: Arrangement<G>;
94
- } | {
95
- readonly ok: false;
96
- readonly error: string;
97
- };
98
- /** The arrangement as plain data with its version, ready for `JSON.stringify`. */
99
- declare function storeArrangement<G extends string>(a: Arrangement<G>): StoredArrangement<G>;
100
- /**
101
- * A stored arrangement read back from parsed data (`JSON.parse`'s result, not the string). Anything else gives
102
- * `{ ok: false, error }`, never a throw: an unknown version, a missing host or zone, a value of the wrong kind, a
103
- * group in two places, or (with `groups`) a group the consumer doesn't have. A group the consumer has but the stored
104
- * arrangement lacks is no error: the consumer places it (`resetGroup` with its default arrangement, say).
105
- */
106
- declare function readArrangement<G extends string = string>(data: unknown, groups?: readonly G[]): ArrangementRead<G>;
107
- /** A host's room: its length and thickness, and what its ends keep for themselves (window controls, a margin). */
108
- interface HostSpec<G extends string = string> {
109
- readonly length: number;
110
- readonly thickness: number;
111
- readonly lead: number;
112
- readonly tail: number;
113
- /**
114
- * The center zone's minimum length and its margin on each side, counted in the need whether it holds groups or
115
- * not (an empty center keeps its drop size). Unset: the center counts only its groups.
116
- */
117
- readonly center?: {
118
- readonly min: number;
119
- readonly margin: number;
120
- };
121
- /**
122
- * How long each group keeps its full form when room runs out (default 0): groups with a lower keep collapse
123
- * first, and among equal keeps the trailing end goes first. A primary group at the end keeps open with a keep of 1.
124
- */
125
- readonly keep?: Readonly<Partial<Record<G, number>>>;
126
- }
127
- /** A group's size in a host, expanded or collapsed: along it (`along`) and across it (`across`). */
128
- type GroupSize<G extends string = string> = (id: G, vertical: boolean, collapsed: boolean) => {
129
- along: number;
130
- across: number;
131
- };
132
- interface HostLayout<G extends string = string> {
133
- /** Each group's rect in the host (x along, y across for a horizontal host; transposed on a side). */
134
- readonly slots: ReadonlyMap<G, Rect>;
135
- /** Groups shown collapsed (by hand, or because the room ran out). */
136
- readonly collapsed: readonly G[];
137
- /** Of those, the ones the room collapsed (from the trailing end). */
138
- readonly overflow: readonly G[];
139
- /** The length the groups and the ends take. */
140
- readonly need: number;
141
- }
142
- /** How long the host's groups need it to be, collapsing only those in `collapsed`. */
143
- declare function hostNeed<G extends string>(zones: Zones<G>, collapsed: readonly G[], spec: Pick<HostSpec, "lead" | "tail" | "center">, size: GroupSize<G>, v: boolean): number;
144
- /**
145
- * Lay a host out: zones along its length; when they don't fit, groups collapse, the lowest keep first and, among
146
- * equal keeps, from the trailing end.
147
- */
148
- declare function layoutHost<G extends string>(zones: Zones<G>, h: HostId, spec: HostSpec<G>, size: GroupSize<G>, byHand?: readonly G[]): HostLayout<G>;
149
- /** A place a dragged group can go: a zone of a host and the index among the others there, and where it is. */
150
- interface Insertion extends Place {
151
- /** Along the host: the insertion line (between groups); for an empty zone, the zone's middle. */
152
- readonly at: number;
153
- /** The stretch of the host it owns (host coordinates). */
154
- readonly span: readonly [number, number];
155
- /** An empty zone: it owns all of its stretch, whatever is nearer (it wins while the pointer is inside it). */
156
- readonly empty: boolean;
157
- readonly label: string;
158
- }
159
- /**
160
- * The insertion points of a host laid out without the dragged group: in each zone before all, between two, after
161
- * all; each owns the stretch of the host nearest to it. An empty zone owns its own stretch: the host's first third
162
- * (start), middle third (center) or last third (end), less what its neighbors' groups take. `label` names a group
163
- * in the "between" labels (default: its id).
164
- */
165
- declare function insertions<G extends string>(zones: Zones<G>, h: HostId, spec: HostSpec<G>, l: HostLayout<G>, label?: (g: G) => string): Insertion[];
166
-
167
- export { type Arrangement, type ArrangementRead, type Floating, GAP, type GroupSize, HOSTS, HOST_LABEL, type HostId, type HostLayout, type HostSpec, type Insertion, type Place, type StoredArrangement, ZONES, ZONE_GAP, type ZoneId, type Zones, arrangement, dockGroup, floatGroup, hostNeed, hostOf, insertGroup, insertions, isEmptyHost, isOwnPlace, layoutHost, moveBar, moveToHost, readArrangement, resetGroup, sameArrangement, storeArrangement, toggleCollapsed, vertical, withoutGroup, zoneLabel };
package/dist/toolbar.js DELETED
@@ -1,55 +0,0 @@
1
- import {
2
- GAP,
3
- HOSTS,
4
- HOST_LABEL,
5
- ZONES,
6
- ZONE_GAP,
7
- arrangement,
8
- dockGroup,
9
- floatGroup,
10
- hostNeed,
11
- hostOf,
12
- insertGroup,
13
- insertions,
14
- isEmptyHost,
15
- isOwnPlace,
16
- layoutHost,
17
- moveBar,
18
- moveToHost,
19
- readArrangement,
20
- resetGroup,
21
- sameArrangement,
22
- storeArrangement,
23
- toggleCollapsed,
24
- vertical,
25
- withoutGroup,
26
- zoneLabel
27
- } from "./chunk-TWI644JK.js";
28
- export {
29
- GAP,
30
- HOSTS,
31
- HOST_LABEL,
32
- ZONES,
33
- ZONE_GAP,
34
- arrangement,
35
- dockGroup,
36
- floatGroup,
37
- hostNeed,
38
- hostOf,
39
- insertGroup,
40
- insertions,
41
- isEmptyHost,
42
- isOwnPlace,
43
- layoutHost,
44
- moveBar,
45
- moveToHost,
46
- readArrangement,
47
- resetGroup,
48
- sameArrangement,
49
- storeArrangement,
50
- toggleCollapsed,
51
- vertical,
52
- withoutGroup,
53
- zoneLabel
54
- };
55
- //# sourceMappingURL=toolbar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}