@n-uf/placement 26.11.47 → 26.11.49

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.
@@ -218,4 +218,4 @@ export {
218
218
  layoutHost,
219
219
  insertions
220
220
  };
221
- //# sourceMappingURL=chunk-GIBUM6TB.js.map
221
+ //# sourceMappingURL=chunk-TWI644JK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/toolbar/index.ts"],"sourcesContent":["/**\n * @n-uf/placement/toolbar: toolbar groups as a pure model. Commands come in groups, each sitting in one of five\n * toolbar areas (the title bar, the top toolbar, a bottom toolbar, a left and a right side toolbar), in one of three\n * zones (start, center, end; top, middle, bottom on a side), in order; or floating. A toolbar is a slot: it never moves\n * itself, its groups do. Group sizes come in as numbers; group ids are the consumer's strings.\n *\n * - A toolbar area lays its zones out along its length: start from the lead, end up to the tail, the center centered on\n * the whole area; when the center would hit the start or end zone it centers in the space between them.\n * - Toolbars never wrap: when room runs out, groups collapse to their grip and » from the trailing end. A group\n * collapsed by hand stays collapsed.\n * - A group drop lands in a zone before all, after all, or between two groups. An empty zone is a target of its\n * own. A group's home is its own place: a drop there changes nothing.\n *\n * A legacy entry. See docs/placement.md, Entry: toolbar.\n */\nimport type { Rect } from \"../geometry\";\n\nexport type HostId = \"title\" | \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type ZoneId = \"start\" | \"center\" | \"end\";\nexport type Zones<G extends string = string> = Readonly<Record<ZoneId, readonly G[]>>;\n\n/** Where a group is docked: a host, a zone, and its index there. */\nexport interface Place {\n readonly host: HostId;\n readonly zone: ZoneId;\n readonly index: number;\n}\n\n/** A group floating over the content: its top-left corner, and where it was docked. */\nexport interface Floating<G extends string = string> {\n readonly id: G;\n readonly x: number;\n readonly y: number;\n readonly from: Place | null;\n}\n\nexport type Arrangement<G extends string = string> = Readonly<Record<HostId, Zones<G>>> & {\n /** Groups collapsed to their handle and » by hand. */\n readonly collapsed: readonly G[];\n readonly floating: readonly Floating<G>[];\n};\n\nexport const HOSTS: readonly HostId[] = [\"title\", \"top\", \"bottom\", \"left\", \"right\"];\nexport const ZONES: readonly ZoneId[] = [\"start\", \"center\", \"end\"];\n\nexport const HOST_LABEL: Readonly<Record<HostId, string>> = { title: \"Title bar\", top: \"Top bar\", bottom: \"Bottom bar\", left: \"Left edge\", right: \"Right edge\" };\nexport const zoneLabel = (h: HostId, z: ZoneId): string => (vertical(h) ? { start: \"top\", center: \"middle\", end: \"bottom\" } : { start: \"left\", center: \"centre\", end: \"right\" })[z];\n\n/** The side edges hold their groups in a column. */\nexport const vertical = (h: HostId): boolean => h === \"left\" || h === \"right\";\n\n/** Between two groups (the handle of the second is the separator). */\nexport const GAP = 12;\n/** Between zones. */\nexport const ZONE_GAP = 16;\n\n/** An arrangement from the zones each host has (the rest empty), nothing collapsed or floating. */\nexport function arrangement<G extends string>(p: Partial<Record<HostId, Partial<Record<ZoneId, readonly G[]>>>>): Arrangement<G> {\n const z = (q: Partial<Record<ZoneId, readonly G[]>> = {}): Zones<G> => ({ start: [], center: [], end: [], ...q });\n return { title: z(p.title), top: z(p.top), bottom: z(p.bottom), left: z(p.left), right: z(p.right), collapsed: [], floating: [] };\n}\n\n// --- changes -------------------------------------------------------------------------------------------------------\n\nconst mapHosts = <G extends string>(a: Arrangement<G>, f: (h: HostId, zone: ZoneId, list: readonly G[]) => readonly G[]): Arrangement<G> => ({\n ...a,\n ...(Object.fromEntries(HOSTS.map((h) => [h, Object.fromEntries(ZONES.map((zn) => [zn, f(h, zn, a[h][zn])]))])) as Record<HostId, Zones<G>>),\n});\n\n/** Where `g` is docked (null: floating or absent). */\nexport function hostOf<G extends string>(a: Arrangement<G>, g: G): Place | null {\n for (const h of HOSTS) for (const zn of ZONES) if (a[h][zn].includes(g)) return { host: h, zone: zn, index: a[h][zn].indexOf(g) };\n return null;\n}\n\n/** The arrangement with group `g` lifted out (of its host, or from floating). */\nexport const withoutGroup = <G extends string>(a: Arrangement<G>, g: G): Arrangement<G> => ({ ...mapHosts(a, (_h, _z, l) => l.filter((x) => x !== g)), floating: a.floating.filter((f) => f.id !== g) });\n\n/** The arrangement with `g` docked at place `i` of zone `zone` of host `h` (`i` counts the others). */\nexport function insertGroup<G extends string>(a: Arrangement<G>, g: G, h: HostId, zone: ZoneId, i: number): Arrangement<G> {\n return mapHosts(withoutGroup(a, g), (hh, zz, l) => (hh === h && zz === zone ? [...l.slice(0, i), g, ...l.slice(i)] : l));\n}\n\n/** `g` floating with its top-left corner at (x, y); it remembers where it was docked. */\nexport function floatGroup<G extends string>(a: Arrangement<G>, g: G, x: number, y: number): Arrangement<G> {\n const from = hostOf(a, g) ?? a.floating.find((f) => f.id === g)?.from ?? null;\n const out = withoutGroup(a, g);\n return { ...out, floating: [...out.floating, { id: g, x, y, from }] };\n}\n\n/** `g` at `place`, its index kept within the zone. */\nconst dockAt = <G extends string>(a: Arrangement<G>, g: G, place: Place): Arrangement<G> =>\n insertGroup(a, g, place.host, place.zone, Math.min(place.index, a[place.host][place.zone].filter((x) => x !== g).length));\n\n/** `g` docked again where it floated from, else where `home` (the default arrangement) has it. */\nexport function dockGroup<G extends string>(a: Arrangement<G>, g: G, home: Arrangement<G>): Arrangement<G> {\n const from = a.floating.find((f) => f.id === g)?.from ?? hostOf(home, g);\n return from ? dockAt(a, g, from) : a;\n}\n\n/** `g` back where `home` (the default arrangement) has it, expanded. */\nexport function resetGroup<G extends string>(a: Arrangement<G>, g: G, home: Arrangement<G>): Arrangement<G> {\n const place = hostOf(home, g);\n const out = place ? dockAt(a, g, place) : a;\n return { ...out, collapsed: out.collapsed.filter((x) => x !== g) };\n}\n\n/** `g` moved to host `h`: after its last group (in its last zone that has any), or into its start zone. */\nexport function moveToHost<G extends string>(a: Arrangement<G>, g: G, h: HostId): Arrangement<G> {\n const rest = withoutGroup(a, g);\n const zone = [...ZONES].reverse().find((zn) => rest[h][zn].length > 0) ?? \"start\";\n return insertGroup(a, g, h, zone, rest[h][zone].length);\n}\n\n/** Every group of host `from` moved to host `to`, zone by zone, after the groups there. */\nexport function moveBar<G extends string>(a: Arrangement<G>, from: HostId, to: HostId): Arrangement<G> {\n if (from === to) return a;\n return mapHosts(a, (h, zn, l) => (h === from ? [] : h === to ? [...l, ...a[from][zn]] : l));\n}\n\nexport const toggleCollapsed = <G extends string>(a: Arrangement<G>, g: G): Arrangement<G> => ({ ...a, collapsed: a.collapsed.includes(g) ? a.collapsed.filter((x) => x !== g) : [...a.collapsed, g] });\n\nexport const isEmptyHost = <G extends string>(a: Arrangement<G>, h: HostId): boolean => ZONES.every((zn) => a[h][zn].length === 0);\n\nconst samePlace = (a: Place | null, b: Place | null): boolean => (a === null || b === null ? a === b : a.host === b.host && a.zone === b.zone && a.index === b.index);\n\n/**\n * The same arrangement: the same groups in the same order in every zone of every host, the same groups collapsed,\n * and the same groups floating at the same corner with the same home (in any order: neither list's order means\n * anything). Compared field by field, so how the arrangement was written down (its keys' order) doesn't matter.\n */\nexport function sameArrangement<G extends string>(a: Arrangement<G>, b: Arrangement<G>): boolean {\n const sameList = (x: readonly G[], y: readonly G[]): boolean => x.length === y.length && x.every((g, i) => g === y[i]);\n // Both ways, so a repeated id on one side can't stand in for a missing one ([\"a\", \"a\"] is not [\"a\", \"b\"]).\n const sameSet = (x: readonly G[], y: readonly G[]): boolean => x.length === y.length && x.every((g) => y.includes(g)) && y.every((g) => x.includes(g));\n if (!HOSTS.every((h) => ZONES.every((zn) => sameList(a[h][zn], b[h][zn])))) return false;\n if (!sameSet(a.collapsed, b.collapsed)) return false;\n if (!sameSet(a.floating.map((f) => f.id), b.floating.map((f) => f.id))) return false;\n return a.floating.every((f) => {\n const o = b.floating.find((x) => x.id === f.id);\n return !!o && o.x === f.x && o.y === f.y && samePlace(o.from, f.from);\n });\n}\n\n/** Dropping `g` at `place` changes nothing: it is the group's home, never a target. */\nexport const isOwnPlace = <G extends string>(a: Arrangement<G>, g: G, place: Place): boolean => sameArrangement(insertGroup(a, g, place.host, place.zone, place.index), a);\n\n// --- stored arrangements -------------------------------------------------------------------------------------------\n\n/** An arrangement as stored: version 1. */\nexport interface StoredArrangement<G extends string = string> {\n readonly v: 1;\n readonly hosts: Readonly<Record<HostId, Readonly<Record<ZoneId, readonly G[]>>>>;\n readonly collapsed: readonly G[];\n readonly floating: readonly { readonly id: G; readonly x: number; readonly y: number; readonly from: Place | null }[];\n}\n\n/** What reading a stored arrangement gives: the arrangement, or why it couldn't be read. Never a throw. */\nexport type ArrangementRead<G extends string = string> = { readonly ok: true; readonly arrangement: Arrangement<G> } | { readonly ok: false; readonly error: string };\n\n/** The arrangement as plain data with its version, ready for `JSON.stringify`. */\nexport function storeArrangement<G extends string>(a: Arrangement<G>): StoredArrangement<G> {\n const hosts = Object.fromEntries(HOSTS.map((h) => [h, Object.fromEntries(ZONES.map((zn) => [zn, [...a[h][zn]]]))])) as unknown as Record<HostId, Record<ZoneId, G[]>>;\n return { v: 1, hosts, collapsed: [...a.collapsed], floating: a.floating.map((f) => ({ id: f.id, x: f.x, y: f.y, from: f.from ? { ...f.from } : null })) };\n}\n\n/**\n * A stored arrangement read back from parsed data (`JSON.parse`'s result, not the string). Anything else gives\n * `{ ok: false, error }`, never a throw: an unknown version, a missing host or zone, a value of the wrong kind, a\n * group in two places, or (with `groups`) a group the consumer doesn't have. A group the consumer has but the stored\n * arrangement lacks is no error: the consumer places it (`resetGroup` with its default arrangement, say).\n */\nexport function readArrangement<G extends string = string>(data: unknown, groups?: readonly G[]): ArrangementRead<G> {\n const fail = (error: string): ArrangementRead<G> => ({ ok: false, error });\n const isObject = (x: unknown): x is Record<string, unknown> => typeof x === \"object\" && x !== null && !Array.isArray(x);\n if (!isObject(data)) return fail(\"not an object\");\n // Named without serialising it: a BigInt or a circular value must not throw.\n if (data.v !== 1) return fail(`unknown version ${typeof data.v === \"number\" || typeof data.v === \"string\" ? String(data.v) : typeof data.v} (this reads version 1)`);\n const seen = new Set<string>();\n const ids = (x: unknown, where: string, placed: boolean): G[] | string => {\n if (!Array.isArray(x) || !x.every((g) => typeof g === \"string\")) return `${where} is not a list of group ids`;\n for (const g of x as string[]) {\n if (groups && !(groups as readonly string[]).includes(g)) return `${where} has an unknown group \"${g}\"`;\n if (placed && seen.has(g)) return `group \"${g}\" is in two places`;\n if (placed) seen.add(g);\n }\n return x as G[];\n };\n if (!isObject(data.hosts)) return fail(\"hosts is missing\");\n const hosts = {} as Record<HostId, Zones<G>>;\n for (const h of HOSTS) {\n const zones = data.hosts[h];\n if (!isObject(zones)) return fail(`host ${h} is missing`);\n const out = {} as Record<ZoneId, readonly G[]>;\n for (const zn of ZONES) {\n const list = ids(zones[zn], `${h}.${zn}`, true);\n if (typeof list === \"string\") return fail(list);\n out[zn] = list;\n }\n hosts[h] = out;\n }\n const collapsed = ids(data.collapsed, \"collapsed\", false);\n if (typeof collapsed === \"string\") return fail(collapsed);\n if (!Array.isArray(data.floating)) return fail(\"floating is not a list\");\n const floating: Floating<G>[] = [];\n for (const f of data.floating as unknown[]) {\n if (!isObject(f) || typeof f.id !== \"string\" || typeof f.x !== \"number\" || typeof f.y !== \"number\" || !Number.isFinite(f.x) || !Number.isFinite(f.y)) return fail(\"a floating group is not { id, x, y, from }\");\n const id = ids([f.id], \"floating\", true);\n if (typeof id === \"string\") return fail(id);\n const from = f.from;\n const place = from === null || from === undefined ? null : isObject(from) && HOSTS.includes(from.host as HostId) && ZONES.includes(from.zone as ZoneId) && Number.isInteger(from.index) && (from.index as number) >= 0 ? { host: from.host as HostId, zone: from.zone as ZoneId, index: from.index as number } : undefined;\n if (place === undefined) return fail(`floating group \"${f.id}\" has a bad home`);\n floating.push({ id: id[0]!, x: f.x, y: f.y, from: place });\n }\n return { ok: true, arrangement: { ...hosts, collapsed, floating } };\n}\n\n// --- a host's layout -----------------------------------------------------------------------------------------------\n\n/** A host's room: its length and thickness, and what its ends keep for themselves (window controls, a margin). */\nexport interface HostSpec<G extends string = string> {\n readonly length: number;\n readonly thickness: number;\n readonly lead: number;\n readonly tail: number;\n /**\n * The center zone's minimum length and its margin on each side, counted in the need whether it holds groups or\n * not (an empty center keeps its drop size). Unset: the center counts only its groups.\n */\n readonly center?: { readonly min: number; readonly margin: number };\n /**\n * How long each group keeps its full form when room runs out (default 0): groups with a lower keep collapse\n * first, and among equal keeps the trailing end goes first. A primary group at the end keeps open with a keep of 1.\n */\n readonly keep?: Readonly<Partial<Record<G, number>>>;\n}\n\n/** A group's size in a host, expanded or collapsed: along it (`along`) and across it (`across`). */\nexport type GroupSize<G extends string = string> = (id: G, vertical: boolean, collapsed: boolean) => { along: number; across: number };\n\nexport interface HostLayout<G extends string = string> {\n /** Each group's rect in the host (x along, y across for a horizontal host; transposed on a side). */\n readonly slots: ReadonlyMap<G, Rect>;\n /** Groups shown collapsed (by hand, or because the room ran out). */\n readonly collapsed: readonly G[];\n /** Of those, the ones the room collapsed (from the trailing end). */\n readonly overflow: readonly G[];\n /** The length the groups and the ends take. */\n readonly need: number;\n}\n\n/** How long the host's groups need it to be, collapsing only those in `collapsed`. */\nexport function hostNeed<G extends string>(zones: Zones<G>, collapsed: readonly G[], spec: Pick<HostSpec, \"lead\" | \"tail\" | \"center\">, size: GroupSize<G>, v: boolean): number {\n const lens = ZONES.map((zn) => zones[zn].reduce((s, g) => s + size(g, v, collapsed.includes(g)).along, 0) + GAP * Math.max(0, zones[zn].length - 1));\n const used = ZONES.filter((zn) => zones[zn].length > 0).length;\n const c = spec.center;\n if (!c) return spec.lead + spec.tail + lens.reduce((s, x) => s + x, 0) + ZONE_GAP * Math.max(0, used - 1);\n // The center always counts, at its minimum at least, and its margins keep it apart from the start and end zones.\n return spec.lead + spec.tail + lens[0]! + lens[2]! + Math.max(lens[1]!, c.min) + 2 * c.margin;\n}\n\n/**\n * Lay a host out: zones along its length; when they don't fit, groups collapse, the lowest keep first and, among\n * equal keeps, from the trailing end.\n */\nexport function layoutHost<G extends string>(zones: Zones<G>, h: HostId, spec: HostSpec<G>, size: GroupSize<G>, byHand: readonly G[] = []): HostLayout<G> {\n const v = vertical(h);\n const collapsed = new Set<G>(ZONES.flatMap((zn) => zones[zn]).filter((g) => byHand.includes(g)));\n const overflow: G[] = [];\n const len = (g: G): number => size(g, v, collapsed.has(g)).along;\n const zoneLen = (l: readonly G[]): number => l.reduce((s, g) => s + len(g), 0) + GAP * Math.max(0, l.length - 1);\n const needNow = (): number => hostNeed(zones, [...collapsed], spec, size, v);\n // The lowest keep first; among equal keeps the trailing end first: the end zone's last group, back to the start\n // zone's first (the sort is stable).\n // Own keys only (a group named \"toString\" mustn't read the prototype), and finite numbers only (NaN breaks the sort).\n const keep = (g: G): number => {\n const k = spec.keep && Object.hasOwn(spec.keep, g) ? spec.keep[g] : 0;\n return typeof k === \"number\" && Number.isFinite(k) ? k : 0;\n };\n const order = [...ZONES].reverse().flatMap((zn) => [...zones[zn]].reverse());\n for (const g of order.sort((x, y) => keep(x) - keep(y))) {\n if (needNow() <= spec.length) break;\n if (collapsed.has(g)) continue;\n collapsed.add(g);\n overflow.push(g);\n }\n const a0 = spec.lead;\n const b0 = spec.length - spec.tail;\n const S = zoneLen(zones.start);\n const C = zoneLen(zones.center);\n const E = zoneLen(zones.end);\n const lo = a0 + S + (S > 0 ? ZONE_GAP : 0);\n const hi = b0 - E - (E > 0 ? ZONE_GAP : 0);\n let c0 = spec.length / 2 - C / 2;\n if (c0 < lo || c0 + C > hi) c0 = (lo + hi) / 2 - C / 2;\n const slots = new Map<G, Rect>();\n const place = (l: readonly G[], from: number): void => {\n let at = from;\n for (const g of l) {\n const s = size(g, v, collapsed.has(g));\n const across = (spec.thickness - s.across) / 2;\n slots.set(g, v ? { x: across, y: at, width: s.across, height: s.along } : { x: at, y: across, width: s.along, height: s.across });\n at += s.along + GAP;\n }\n };\n place(zones.start, a0);\n place(zones.center, c0);\n place(zones.end, b0 - E);\n return { slots, collapsed: [...collapsed], overflow, need: needNow() };\n}\n\n// --- insertion points ----------------------------------------------------------------------------------------------\n\n/** A place a dragged group can go: a zone of a host and the index among the others there, and where it is. */\nexport interface Insertion extends Place {\n /** Along the host: the insertion line (between groups); for an empty zone, the zone's middle. */\n readonly at: number;\n /** The stretch of the host it owns (host coordinates). */\n readonly span: readonly [number, number];\n /** An empty zone: it owns all of its stretch, whatever is nearer (it wins while the pointer is inside it). */\n readonly empty: boolean;\n readonly label: string;\n}\n\n/**\n * The insertion points of a host laid out without the dragged group: in each zone before all, between two, after\n * all; each owns the stretch of the host nearest to it. An empty zone owns its own stretch: the host's first third\n * (start), middle third (center) or last third (end), less what its neighbors' groups take. `label` names a group\n * in the \"between\" labels (default: its id).\n */\nexport function insertions<G extends string>(zones: Zones<G>, h: HostId, spec: HostSpec<G>, l: HostLayout<G>, label: (g: G) => string = (g) => g): Insertion[] {\n const v = vertical(h);\n const lo = (r: Rect): number => (v ? r.y : r.x);\n const hi = (r: Rect): number => (v ? r.y + r.height : r.x + r.width);\n const L = spec.length;\n const all = ZONES.flatMap((zn) => zones[zn].map((g) => l.slots.get(g)).filter((r): r is Rect => !!r));\n const first = all.length ? Math.min(...all.map(lo)) : L;\n const last = all.length ? Math.max(...all.map(hi)) : 0;\n const zoneEdge = (zn: ZoneId, end: \"lo\" | \"hi\"): number | null => {\n const rs = zones[zn].map((g) => l.slots.get(g)).filter((r): r is Rect => !!r);\n if (!rs.length) return null;\n return end === \"lo\" ? Math.min(...rs.map(lo)) : Math.max(...rs.map(hi));\n };\n const near: Omit<Insertion, \"span\">[] = [];\n const empties: Insertion[] = [];\n for (const zn of ZONES) {\n const name = `${HOST_LABEL[h]} · ${zoneLabel(h, zn)}`;\n const vis = zones[zn].map((g, i) => ({ g, i, r: l.slots.get(g)! }));\n if (!vis.length) {\n const sEnd = zoneEdge(\"start\", \"hi\");\n const eStart = zoneEdge(\"end\", \"lo\");\n const span: [number, number] =\n zn === \"start\" ? [0, Math.min(L / 3, first - GAP / 2)] : zn === \"end\" ? [Math.max((2 * L) / 3, last + GAP / 2), L] : [Math.max(L / 3, (sEnd ?? 0) + GAP / 2), Math.min((2 * L) / 3, (eStart ?? L) - GAP / 2)];\n if (span[1] - span[0] >= 8) empties.push({ host: h, zone: zn, index: 0, at: (span[0] + span[1]) / 2, span, empty: true, label: name });\n continue;\n }\n near.push({ host: h, zone: zn, index: vis[0]!.i, at: lo(vis[0]!.r) - GAP / 2, empty: false, label: `${name} · before all` });\n for (let k = 1; k < vis.length; k++) near.push({ host: h, zone: zn, index: vis[k]!.i, at: (hi(vis[k - 1]!.r) + lo(vis[k]!.r)) / 2, empty: false, label: `${name} · between ${label(vis[k - 1]!.g)} and ${label(vis[k]!.g)}` });\n near.push({ host: h, zone: zn, index: zones[zn].length, at: hi(vis.at(-1)!.r) + GAP / 2, empty: false, label: `${name} · after all` });\n }\n near.sort((a, b) => a.at - b.at);\n const lines = near.map((p, k) => ({ ...p, span: [k === 0 ? 0 : (near[k - 1]!.at + p.at) / 2, k === near.length - 1 ? L : (p.at + near[k + 1]!.at) / 2] as const }));\n return [...lines, ...empties];\n}\n"],"mappings":";AA0CO,IAAM,QAA2B,CAAC,SAAS,OAAO,UAAU,QAAQ,OAAO;AAC3E,IAAM,QAA2B,CAAC,SAAS,UAAU,KAAK;AAE1D,IAAM,aAA+C,EAAE,OAAO,aAAa,KAAK,WAAW,QAAQ,cAAc,MAAM,aAAa,OAAO,aAAa;AACxJ,IAAM,YAAY,CAAC,GAAW,OAAuB,SAAS,CAAC,IAAI,EAAE,OAAO,OAAO,QAAQ,UAAU,KAAK,SAAS,IAAI,EAAE,OAAO,QAAQ,QAAQ,UAAU,KAAK,QAAQ,GAAG,CAAC;AAG3K,IAAM,WAAW,CAAC,MAAuB,MAAM,UAAU,MAAM;AAG/D,IAAM,MAAM;AAEZ,IAAM,WAAW;AAGjB,SAAS,YAA8B,GAAmF;AAC/H,QAAM,IAAI,CAAC,IAA2C,CAAC,OAAiB,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,EAAE;AAC/G,SAAO,EAAE,OAAO,EAAE,EAAE,KAAK,G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G,MAAM,KAAK,SAAS,IAAI,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,EAAG,MAAM,CAAC,EAAW,EAAE;AAClK,SAAO,CAAC,GAAG,OAAO,GAAG,OAAO;AAC9B;","names":[]}
package/dist/desk.d.ts CHANGED
@@ -16,6 +16,8 @@ import './target-BBOCeez2.js';
16
16
  *
17
17
  * The bottom band starts with the hint's `bottom` panels, else the last def whose `sides` names "bottom" (a def
18
18
  * without `sides` may be dropped there, but doesn't start there).
19
+ *
20
+ * A legacy entry. See docs/placement.md, Entry: desk.
19
21
  */
20
22
 
21
23
  type PresetId = "docks" | "docksFull" | "dockTear" | "navigator";
package/dist/desk.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/desk/index.ts"],"sourcesContent":["/**\n * @n-uf/placement/desk: desk presets as data on `@n-uf/placement/panels`. A preset is options for the panels engine\n * and a start state; it carries no titles, no words and no toolbar wiring (the app names presets and wires its\n * toolbar). It imports only the panels entry's public index, so an app that imports only `./panels` loads none of it.\n *\n * - `docks`: one stack column per side and a bottom band between them (reserved: it shortens the pages); sections at\n * their natural heights when the defs give `height`; short of width a column folds to its side's rail, short of\n * height the band folds to a bar. No floats.\n * - `docksFull`: as docks, with the bottom band full width (the columns stand on it).\n * - `dockTear`: as docks, and panels may float (tear-off and dock-back); one panel floats in the start state.\n * - `navigator`: a tabbed column on the left, a stack column on the right. No band, no floats.\n *\n * The bottom band starts with the hint's `bottom` panels, else the last def whose `sides` names \"bottom\" (a def\n * without `sides` may be dropped there, but doesn't start there).\n */\nimport {\n createPanels,\n floatSize,\n layoutPanels,\n panelDrop,\n panelTargets,\n showTabs,\n type PanelDef,\n type PanelDrop,\n type PanelPlace,\n type PanelTarget,\n type PanelTargetInput,\n type PanelsLayout,\n type PanelsOptions,\n type PanelsState,\n} from \"../panels\";\n\nexport type PresetId = \"docks\" | \"docksFull\" | \"dockTear\" | \"navigator\";\n\n/** Which panels start on which side (ids in order), and in the bottom band (a preset with one); the others are placed by the preset. */\nexport interface DeskHint {\n readonly left?: readonly string[];\n readonly right?: readonly string[];\n readonly bottom?: readonly string[];\n}\n\nexport interface DeskPreset {\n readonly id: PresetId;\n /** The panels options the preset lays out with (the caller's own options go over them). */\n readonly options: Partial<PanelsOptions>;\n /** Whether its panels may float: when not, `presetTargets` offers no float target. */\n readonly floats: boolean;\n /** Its start state for these panels. */\n start(defs: readonly PanelDef[], hint?: DeskHint): PanelsState;\n}\n\ntype Stage = Parameters<typeof layoutPanels>[2];\ntype Point = Parameters<typeof panelDrop>[2];\n\n/**\n * Split the panels between the sides: the hint's first, then the rest in order, each to a side it may dock on, the\n * left side taking the first half of them.\n */\nfunction split(defs: readonly PanelDef[], hint: DeskHint = {}): { left: string[]; right: string[] } {\n const known = new Set(defs.map((d) => d.id));\n const left = (hint.left ?? []).filter((id) => known.has(id));\n const right = (hint.right ?? []).filter((id) => known.has(id) && !left.includes(id));\n const rest = defs.filter((d) => !left.includes(d.id) && !right.includes(d.id));\n const half = Math.ceil(defs.length / 2);\n for (const d of rest) {\n const mayL = !d.sides || d.sides.includes(\"left\");\n const mayR = !d.sides || d.sides.includes(\"right\");\n if (mayL && (left.length < half || !mayR)) left.push(d.id);\n else if (mayR) right.push(d.id);\n else left.push(d.id);\n }\n return { left, right };\n}\n\nconst columns = (ids: readonly string[]): string[][] => (ids.length ? [[...ids]] : []);\n\n/** The bottom band's start: the hint's, else the last def whose `sides` names \"bottom\". */\nfunction bottomOf(defs: readonly PanelDef[], hint: DeskHint = {}): string[] {\n const known = new Set(defs.map((d) => d.id));\n if (hint.bottom) return hint.bottom.filter((id) => known.has(id));\n const last = [...defs].reverse().find((d) => d.sides?.includes(\"bottom\"));\n return last ? [last.id] : [];\n}\n\n/** The defs and hint with the band's panels taken out, so the sides split the rest. */\nconst sidesOnly = (defs: readonly PanelDef[], hint: DeskHint | undefined, band: readonly string[]): [PanelDef[], DeskHint | undefined] => [\n defs.filter((d) => !band.includes(d.id)),\n hint && { ...hint, left: hint.left?.filter((id) => !band.includes(id)), right: hint.right?.filter((id) => !band.includes(id)) },\n];\n\nconst banded = (start: (defs: readonly PanelDef[], hint?: DeskHint) => PanelsState) => (defs: readonly PanelDef[], hint?: DeskHint): PanelsState => {\n const bottom = bottomOf(defs, hint);\n const [rest, h] = sidesOnly(defs, hint, bottom);\n const s = start(rest, h);\n return bottom.length ? createPanels(defs, { ...startOf(s), bottom }) : s;\n};\n\n/** A plain start back from a state (columns, floats and lists; the clock is rebuilt in listing order). */\nfunction startOf(s: PanelsState): Parameters<typeof createPanels>[1] {\n return {\n left: s.sides.left.map((c) => c.panels),\n right: s.sides.right.map((c) => c.panels),\n floats: s.floats.map((f) => ({ id: f.id, x: f.rect.x, y: f.rect.y, width: f.rect.width, height: f.rect.height, ...(f.pinned ? { pinned: true } : {}) })),\n folded: s.folded,\n kept: s.kept,\n closed: s.closed,\n };\n}\n\nconst docksStart = (defs: readonly PanelDef[], hint?: DeskHint): PanelsState => {\n const { left, right } = split(defs, hint);\n return createPanels(defs, { left: columns(left), right: columns(right) });\n};\n\nconst BOTTOM = { mode: \"reserved\", span: \"between\" } as const;\n\nconst docks: DeskPreset = { id: \"docks\", options: { fold: \"rail\", bands: { bottom: BOTTOM } }, floats: false, start: banded(docksStart) };\n\nconst docksFull: DeskPreset = { id: \"docksFull\", options: { fold: \"rail\", bands: { bottom: { ...BOTTOM, span: \"full\" } } }, floats: false, start: banded(docksStart) };\n\nconst dockTear: DeskPreset = {\n id: \"dockTear\",\n options: { fold: \"rail\", floats: \"clamp\", bands: { bottom: BOTTOM } },\n floats: true,\n // As docks, with the right side's last panel that may float torn off, next to the left column.\n start: banded((defs, hint) => {\n const { left, right } = split(defs, hint);\n const can = (id: string): boolean => defs.find((d) => d.id === id)?.floats !== false;\n const torn = [...right].reverse().find(can) ?? [...left].reverse().find(can);\n const keep = (ids: readonly string[]): string[] => ids.filter((id) => id !== torn);\n const leftW = Math.max(0, ...keep(left).map((id) => defs.find((d) => d.id === id)!.width.natural));\n const size = floatSize(defs.find((d) => d.id === torn));\n return createPanels(defs, {\n left: columns(keep(left)),\n right: columns(keep(right)),\n ...(torn ? { floats: [{ id: torn, x: leftW + 24, y: 24, width: size.natural.width, height: size.natural.height }] } : {}),\n });\n }),\n};\n\nconst navigator: DeskPreset = {\n id: \"navigator\",\n options: { fold: \"rail\" },\n floats: false,\n start(defs, hint) {\n const s = docksStart(defs, hint);\n return s.sides.left.length ? showTabs(s, \"left\", 0, true) : s;\n },\n};\n\nexport const PRESETS: Readonly<Record<PresetId, DeskPreset>> = { docks, docksFull, dockTear, navigator };\n\n/** `layoutPanels` with the preset's options under the caller's. */\nexport function presetLayout(preset: DeskPreset, defs: readonly PanelDef[], state: PanelsState, stage: Stage, options: Partial<PanelsOptions> = {}): PanelsLayout {\n return layoutPanels(defs, state, stage, { ...preset.options, ...options });\n}\n\n/** The target input with the preset's options under the caller's, and only the places the preset allows. */\nexport function presetInput(preset: DeskPreset, input: PanelTargetInput): PanelTargetInput {\n const allows = (id: string, place: PanelPlace): boolean => (place.kind !== \"float\" || preset.floats) && (input.allows?.(id, place) ?? true);\n return { ...input, options: { ...preset.options, ...input.options }, allows };\n}\n\n/** `panelTargets` with the preset's options under the caller's, and only the places the preset allows. */\nexport function presetTargets(preset: DeskPreset, input: PanelTargetInput): PanelTarget[] {\n return panelTargets(presetInput(preset, input));\n}\n\n/** `panelDrop` laid out with the preset's options (so the slot is where the preset lays the panel). */\nexport function presetDrop(preset: DeskPreset, input: PanelTargetInput, target: PanelTarget, point: Point, grab: Point): PanelDrop {\n return panelDrop(presetInput(preset, input), target, point, grab);\n}\n"],"mappings":";;;;;;;;;;;;AA0DA,SAAS,MAAM,MAA2B,OAAiB,CAAC,GAAwC;AAClG,QAAM,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AAC3C,QAAM,QAAQ,KAAK,QAAQ,CAAC,GAAG,OAAO,CAAC,OAAO,MAAM,IAAI,EAAE,CAAC;A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E,IAAI,CAAC;AAAA,IACzH,CAAC;AAAA,EACH,CAAC;AACH;AAEA,IAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,SAAS,EAAE,MAAM,OAAO;AAAA,EACxB,QAAQ;AAAA,EACR,MAAM,MAAM,MAAM;AAChB,UAAM,IAAI,WAAW,MAAM,IAAI;AAC/B,WAAO,EAAE,MAAM,KAAK,SAAS,SAAS,GAAG,QAAQ,GAAG,IAAI,IAAI;AAAA,EAC9D;AACF;AAEO,IAAM,UAAkD,EAAE,OAAO,WAAW,UAAU,UAAU;AAGhG,SAAS,aAAa,QAAoB,MAA2B,OAAoB,OAAc,UAAkC,CAAC,GAAiB;AAChK,SAAO,aAAa,MAAM,OAAO,OAAO,EAAE,GAAG,OAAO,SAAS,GAAG,QAAQ,CAAC;AAC3E;AAGO,SAAS,YAAY,QAAoB,OAA2C;AACzF,QAAM,SAAS,CAAC,IAAY,WAAgC,MAAM,SAAS,WAAW,OAAO,YAAY,MAAM,SAAS,IAAI,KAAK,KAAK;AACtI,SAAO,EAAE,GAAG,OAAO,SAAS,EAAE,GAAG,OAAO,SAAS,GAAG,MAAM,QAAQ,GAAG,OAAO;AAC9E;AAGO,SAAS,cAAc,QAAoB,OAAwC;AACxF,SAAO,aAAa,YAAY,QAAQ,KAAK,CAAC;AAChD;AAGO,SAAS,WAAW,QAAoB,OAAyB,QAAqB,OAAc,MAAwB;AACjI,SAAO,UAAU,YAAY,QAAQ,KAAK,GAAG,QAAQ,OAAO,IAAI;AAClE;","names":[]}
1
+ {"version":3,"sources":["../src/desk/index.ts"],"sourcesContent":["/**\n * @n-uf/placement/desk: desk presets as data on `@n-uf/placement/panels`. A preset is options for the panels engine\n * and a start state; it carries no titles, no words and no toolbar wiring (the app names presets and wires its\n * toolbar). It imports only the panels entry's public index, so an app that imports only `./panels` loads none of it.\n *\n * - `docks`: one stack column per side and a bottom band between them (reserved: it shortens the pages); sections at\n * their natural heights when the defs give `height`; short of width a column folds to its side's rail, short of\n * height the band folds to a bar. No floats.\n * - `docksFull`: as docks, with the bottom band full width (the columns stand on it).\n * - `dockTear`: as docks, and panels may float (tear-off and dock-back); one panel floats in the start state.\n * - `navigator`: a tabbed column on the left, a stack column on the right. No band, no floats.\n *\n * The bottom band starts with the hint's `bottom` panels, else the last def whose `sides` names \"bottom\" (a def\n * without `sides` may be dropped there, but doesn't start there).\n *\n * A legacy entry. See docs/placement.md, Entry: desk.\n */\nimport {\n createPanels,\n floatSize,\n layoutPanels,\n panelDrop,\n panelTargets,\n showTabs,\n type PanelDef,\n type PanelDrop,\n type PanelPlace,\n type PanelTarget,\n type PanelTargetInput,\n type PanelsLayout,\n type PanelsOptions,\n type PanelsState,\n} from \"../panels\";\n\nexport type PresetId = \"docks\" | \"docksFull\" | \"dockTear\" | \"navigator\";\n\n/** Which panels start on which side (ids in order), and in the bottom band (a preset with one); the others are placed by the preset. */\nexport interface DeskHint {\n readonly left?: readonly string[];\n readonly right?: readonly string[];\n readonly bottom?: readonly string[];\n}\n\nexport interface DeskPreset {\n readonly id: PresetId;\n /** The panels options the preset lays out with (the caller's own options go over them). */\n readonly options: Partial<PanelsOptions>;\n /** Whether its panels may float: when not, `presetTargets` offers no float target. */\n readonly floats: boolean;\n /** Its start state for these panels. */\n start(defs: readonly PanelDef[], hint?: DeskHint): PanelsState;\n}\n\ntype Stage = Parameters<typeof layoutPanels>[2];\ntype Point = Parameters<typeof panelDrop>[2];\n\n/**\n * Split the panels between the sides: the hint's first, then the rest in order, each to a side it may dock on, the\n * left side taking the first half of them.\n */\nfunction split(defs: readonly PanelDef[], hint: DeskHint = {}): { left: string[]; right: string[] } {\n const known = new Set(defs.map((d) => d.id));\n const left = (hint.left ?? []).filter((id) => known.has(id));\n const right = (hint.right ?? []).filter((id) => known.has(id) && !left.includes(id));\n const rest = defs.filter((d) => !left.includes(d.id) && !right.includes(d.id));\n const half = Math.ceil(defs.length / 2);\n for (const d of rest) {\n const mayL = !d.sides || d.sides.includes(\"left\");\n const mayR = !d.sides || d.sides.includes(\"right\");\n if (mayL && (left.length < half || !mayR)) left.push(d.id);\n else if (mayR) right.push(d.id);\n else left.push(d.id);\n }\n return { left, right };\n}\n\nconst columns = (ids: readonly string[]): string[][] => (ids.length ? [[...ids]] : []);\n\n/** The bottom band's start: the hint's, else the last def whose `sides` names \"bottom\". */\nfunction bottomOf(defs: readonly PanelDef[], hint: DeskHint = {}): string[] {\n const known = new Set(defs.map((d) => d.id));\n if (hint.bottom) return hint.bottom.filter((id) => known.has(id));\n const last = [...defs].reverse().find((d) => d.sides?.includes(\"bottom\"));\n return last ? [last.id] : [];\n}\n\n/** The defs and hint with the band's panels taken out, so the sides split the rest. */\nconst sidesOnly = (defs: readonly PanelDef[], hint: DeskHint | undefined, band: readonly string[]): [PanelDef[], DeskHint | undefined] => [\n defs.filter((d) => !band.includes(d.id)),\n hint && { ...hint, left: hint.left?.filter((id) => !band.includes(id)), right: hint.right?.filter((id) => !band.includes(id)) },\n];\n\nconst banded = (start: (defs: readonly PanelDef[], hint?: DeskHint) => PanelsState) => (defs: readonly PanelDef[], hint?: DeskHint): PanelsState => {\n const bottom = bottomOf(defs, hint);\n const [rest, h] = sidesOnly(defs, hint, bottom);\n const s = start(rest, h);\n return bottom.length ? createPanels(defs, { ...startOf(s), bottom }) : s;\n};\n\n/** A plain start back from a state (columns, floats and lists; the clock is rebuilt in listing order). */\nfunction startOf(s: PanelsState): Parameters<typeof createPanels>[1] {\n return {\n left: s.sides.left.map((c) => c.panels),\n right: s.sides.right.map((c) => c.panels),\n floats: s.floats.map((f) => ({ id: f.id, x: f.rect.x, y: f.rect.y, width: f.rect.width, height: f.rect.height, ...(f.pinned ? { pinned: true } : {}) })),\n folded: s.folded,\n kept: s.kept,\n closed: s.closed,\n };\n}\n\nconst docksStart = (defs: readonly PanelDef[], hint?: DeskHint): PanelsState => {\n const { left, right } = split(defs, hint);\n return createPanels(defs, { left: columns(left), right: columns(right) });\n};\n\nconst BOTTOM = { mode: \"reserved\", span: \"between\" } as const;\n\nconst docks: DeskPreset = { id: \"docks\", options: { fold: \"rail\", bands: { bottom: BOTTOM } }, floats: false, start: banded(docksStart) };\n\nconst docksFull: DeskPreset = { id: \"docksFull\", options: { fold: \"rail\", bands: { bottom: { ...BOTTOM, span: \"full\" } } }, floats: false, start: banded(docksStart) };\n\nconst dockTear: DeskPreset = {\n id: \"dockTear\",\n options: { fold: \"rail\", floats: \"clamp\", bands: { bottom: BOTTOM } },\n floats: true,\n // As docks, with the right side's last panel that may float torn off, next to the left column.\n start: banded((defs, hint) => {\n const { left, right } = split(defs, hint);\n const can = (id: string): boolean => defs.find((d) => d.id === id)?.floats !== false;\n const torn = [...right].reverse().find(can) ?? [...left].reverse().find(can);\n const keep = (ids: readonly string[]): string[] => ids.filter((id) => id !== torn);\n const leftW = Math.max(0, ...keep(left).map((id) => defs.find((d) => d.id === id)!.width.natural));\n const size = floatSize(defs.find((d) => d.id === torn));\n return createPanels(defs, {\n left: columns(keep(left)),\n right: columns(keep(right)),\n ...(torn ? { floats: [{ id: torn, x: leftW + 24, y: 24, width: size.natural.width, height: size.natural.height }] } : {}),\n });\n }),\n};\n\nconst navigator: DeskPreset = {\n id: \"navigator\",\n options: { fold: \"rail\" },\n floats: false,\n start(defs, hint) {\n const s = docksStart(defs, hint);\n return s.sides.left.length ? showTabs(s, \"left\", 0, true) : s;\n },\n};\n\nexport const PRESETS: Readonly<Record<PresetId, DeskPreset>> = { docks, docksFull, dockTear, navigator };\n\n/** `layoutPanels` with the preset's options under the caller's. */\nexport function presetLayout(preset: DeskPreset, defs: readonly PanelDef[], state: PanelsState, stage: Stage, options: Partial<PanelsOptions> = {}): PanelsLayout {\n return layoutPanels(defs, state, stage, { ...preset.options, ...options });\n}\n\n/** The target input with the preset's options under the caller's, and only the places the preset allows. */\nexport function presetInput(preset: DeskPreset, input: PanelTargetInput): PanelTargetInput {\n const allows = (id: string, place: PanelPlace): boolean => (place.kind !== \"float\" || preset.floats) && (input.allows?.(id, place) ?? true);\n return { ...input, options: { ...preset.options, ...input.options }, allows };\n}\n\n/** `panelTargets` with the preset's options under the caller's, and only the places the preset allows. */\nexport function presetTargets(preset: DeskPreset, input: PanelTargetInput): PanelTarget[] {\n return panelTargets(presetInput(preset, input));\n}\n\n/** `panelDrop` laid out with the preset's options (so the slot is where the preset lays the panel). */\nexport function presetDrop(preset: DeskPreset, input: PanelTargetInput, target: PanelTarget, point: Point, grab: Point): PanelDrop {\n return panelDrop(presetInput(preset, input), target, point, grab);\n}\n"],"mappings":";;;;;;;;;;;;AA4DA,SAAS,MAAM,MAA2B,OAAiB,CAAC,GAAwC;AAClG,QAAM,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AAC3C,QAAM,QAAQ,KAAK,QAAQ,CAAC,GAAG,OAAO,CAAC,OAAO,MAAM,IAAI,EAAE,CAAC;AAC3D,QAAM,SAAS,KAAK,SAAS,CAAC,GAAG,OAAO,CAAC,OAAO,MAAM,IAAI,EAAE,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC;AACnF,QAAM,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE,EAAE,KAAK,CAAC,MAAM,SAAS,EAAE,EAAE,CAAC;AAC7E,QAAM,OAAO,KAAK,KAAK,KAAK,SAAS,CAAC;AACtC,aAAW,KAAK,MAAM;AACpB,UAAM,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,SAAS,MAAM;AAChD,UAAM,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,SAAS,OAAO;AACjD,QAAI,SAAS,KAAK,SAAS,QAAQ,CAAC,MAAO,MAAK,KAAK,EAAE,EAAE;AAAA,aAChD,KAAM,OAAM,KAAK,EAAE,EAAE;AAAA,QACzB,MAAK,KAAK,EAAE,EAAE;AAAA,EACrB;AACA,SAAO,EAAE,MAAM,MAAM;AACvB;AAEA,IAAM,UAAU,CAAC,QAAwC,IAAI,SAAS,CAAC,CAAC,GAAG,GAAG,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AAO,SAAS,GAAG,MAAM,QAAQ,GAAG,OAAO;AAC9E;AAGO,SAAS,cAAc,QAAoB,OAAwC;AACxF,SAAO,aAAa,YAAY,QAAQ,KAAK,CAAC;AAChD;AAGO,SAAS,WAAW,QAAoB,OAAyB,QAAqB,OAAc,MAAwB;AACjI,SAAO,UAAU,YAAY,QAAQ,KAAK,GAAG,QAAQ,OAAO,IAAI;AAClE;","names":[]}
@@ -1044,9 +1044,10 @@ interface SceneRefusal {
1044
1044
  * item `Y` in `X|Y` and `Y|Z`), the boundary is that item's middle as drawn (in the held spot's own layout with
1045
1045
  * `options.spot`, so a column takes a panel by halves of what is seen). On a bar or a toolbar rail, and between any two
1046
1046
  * other spots, it is halfway across the gap between their landings, each in its own layout, so the pointer is at the
1047
- * landing it picks and a toolbar moved along an occupied lane stays at the hand. On a bar or a toolbar rail that gap is
1048
- * measured where the item is held (`options.grab`): halfway between the points the pointer would hold in each landing,
1049
- * so a pointer back at its press point picks the item's own place however far from its middle it was pressed. Cuts are
1047
+ * landing it picks and a toolbar moved along an occupied lane stays at the hand. On a bar or a toolbar rail, two landings
1048
+ * that overlap (spots a pitch apart, the pointer inside both) are cut where the item is held (`options.grab`): halfway
1049
+ * between the points the pointer would hold in each, so a pointer back at its press point picks the item's own place
1050
+ * however far from its middle it was pressed; landings apart are cut halfway across their gap whatever the grab. Cuts are
1050
1051
  * kept inside the lane and in order. The spots come from the same generation and filter as `targets()`, so a spot's
1051
1052
  * landing is exactly what its drop commits. Spot ids are keyed by the lane, zone and neighboring items, so they survive
1052
1053
  * the window resizing and most items opening or moving; virtual lanes are keyed by the column they lie beside, not
@@ -1085,17 +1086,27 @@ interface LaneRefusal {
1085
1086
  }
1086
1087
  /**
1087
1088
  * A place guide's mark, in the lane's layout as drawn: a `line` across the lane between two items that touch (no room
1088
- * for the item between them but its own; as thick as their gap allows, up to 2 px, so zero where they meet and the host
1089
- * strokes it), also at a lane's end next to an item, a `box` over a free stretch the item fits in. Never over an item
1090
- * drawn there, the held one included, nor a line in a refused stretch.
1089
+ * between them but the edge's own gap; as thick as their gap allows, up to 2 px, so zero where they meet and the host
1090
+ * strokes it), a `box` over free room the item lands in, and a `hatch` over the part of a neighbor that gives way.
1091
+ * Where the free room is shorter than the item (a lane's end, a gap between items wider than the edge's gap), the spot
1092
+ * there is drawn as it lands: a box over the free room and a hatch over the rest of its landing (the edge of the
1093
+ * neighbor that will move), the two together the landing; with no free room at a lane's end, the hatch alone. A box
1094
+ * over another edge's docked items (an empty side rail over a column's outer strip) is a hatch there too: they move
1095
+ * aside when the lane opens. Never a box or a line over an item drawn there, nor anything over the held one; nothing in
1096
+ * a refused stretch; no two edge lanes' marks overlap (at a corner a lane not drawn gives way to a drawn one, and
1097
+ * between two not drawn the bar owns it; a virtual lane, a new column's line or a declared rail, is drawn over what it
1098
+ * would push). As seen (no `spot`) the lifted item is drawn nowhere, so its own place is free room
1099
+ * in its lane; with `spot`, every lane's marks lie in that spot's layout (the held item there, its room open).
1091
1100
  */
1092
1101
  interface LaneMark {
1093
1102
  /**
1094
1103
  * Stable while the items either side stay: `<lane>/line/<before>|<after>`, `<lane>/box/<before>|<after>` (`#<n>` for a
1095
- * stretch's later pieces), `^` and `$` at the lane's ends; a virtual lane's `<lane>/box/<spot id>`. Key a drawing by it.
1104
+ * stretch's later pieces; `:before` or `:after` for the room beside the held item), `<lane>/hatch/<before>|<after>`
1105
+ * (`~2` for the second side), `^` and `$` at the lane's ends; a virtual lane's `<lane>/box/<spot id>`. Key a drawing by
1106
+ * it.
1096
1107
  */
1097
1108
  readonly id: string;
1098
- readonly kind: "line" | "box";
1109
+ readonly kind: "line" | "box" | "hatch";
1099
1110
  readonly rect: Rect;
1100
1111
  }
1101
1112
  interface Lane {
@@ -1108,13 +1119,22 @@ interface Lane {
1108
1119
  readonly refused: readonly LaneRefusal[];
1109
1120
  /** Its place guides' marks, in the layout as drawn (the held spot's, with `options.spot`). */
1110
1121
  readonly marks: readonly LaneMark[];
1122
+ /**
1123
+ * Its rect is its own: a rail drop strip at the window's side (`Scene.railDrop`), which every other target of the drag
1124
+ * gives up. A landing model gives it the pointer inside it over any lane it overlaps (a flush column's edge).
1125
+ */
1126
+ readonly owns?: true;
1111
1127
  }
1112
1128
  /** Everything a landing model reads for one drag. */
1113
1129
  interface Regions {
1114
1130
  readonly lanes: readonly Lane[];
1115
1131
  /** Refused places outside every lane ("Can't go here"). */
1116
1132
  readonly refused: readonly Rect[];
1117
- /** The content: the open space is it less `blocked`. */
1133
+ /**
1134
+ * Where a float can land (`floatRegion`: the stage less the float insets), as a landing model's `content`: the open
1135
+ * space is it less `blocked`. So the gutter between a column and the pages is open (a release there floats), while
1136
+ * every drawn edge, docked item, chrome and drawn rail stays out of it.
1137
+ */
1118
1138
  readonly content: Rect;
1119
1139
  /** What the open space excludes: drawn edges, docked items, the chrome, a drawn declared rail, `Scene.blocked`. */
1120
1140
  readonly blocked: readonly Rect[];
@@ -1137,16 +1157,23 @@ interface LaneOptions extends SceneTargetOptions {
1137
1157
  * Where the pointer holds the item, from its top left corner as it is now, px (what a target's `after(point, grab)`
1138
1158
  * takes): the press's, constant for the drag (each grab is remembered as its own options), and the same in the call
1139
1159
  * with `spot`. It counts along the item's own length only (its longer side as it is now): on a bar or a toolbar rail
1140
- * along that axis the cut between two spots lies halfway between the points the pointer would hold in each landing
1141
- * (with landings of one length; at the same share of each), so a pointer back at its press point picks the item's own
1142
- * place. Across the item, and in a lane across its length (a rail toolbar over a bar), it is the item's middle, as
1143
- * without a grab. Panel columns take a panel by halves of what is drawn either way. Where another lane's band
1160
+ * along that axis the cut between two overlapping landings lies halfway between the points the pointer would hold in
1161
+ * each (with landings of one length; at the same share of each), kept within half a pitch of their overlap, so a
1162
+ * pointer back at its press point picks the item's own place; landings with a gap between them (either side of a long
1163
+ * neighbor) are cut halfway across it whatever the grab, so the pointer is at the landing it picks (R12). Across the
1164
+ * item, and in a lane across its length (a rail toolbar over a bar), it is the item's middle, as without a grab. Panel columns take a panel by halves of what is drawn either way. Where another lane's band
1144
1165
  * overlaps the press point (an empty bar's band over a rail's end) that lane can still take the pointer first.
1145
1166
  */
1146
1167
  readonly grab?: {
1147
1168
  readonly x: number;
1148
1169
  readonly y: number;
1149
1170
  };
1171
+ /**
1172
+ * How an empty lane's marks draw it (an empty bar or side rail, or a virtual lane, its room not open): `"real"` (the
1173
+ * default), boxes at the size it will take, lying over what moves aside (the page, a column); `"edge"`, each a thin
1174
+ * striped strip (`HATCH_EDGE`) on its window side. Where it lands is the same either way.
1175
+ */
1176
+ readonly emptyLanes?: "real" | "edge";
1150
1177
  }
1151
1178
  /**
1152
1179
  * The lanes and regions of a drag of `dragged`: every lane that takes it with its spots and stretches, the refused
@@ -1155,5 +1182,15 @@ interface LaneOptions extends SceneTargetOptions {
1155
1182
  * worked out again, in that spot's own layout.
1156
1183
  */
1157
1184
  declare function lanes(scene: Scene, dragged: string, options?: LaneOptions): Regions;
1185
+ /**
1186
+ * The striped end inside a box whose room partly fits, px: a cue that the neighbor there gives way, never a measure
1187
+ * (about 6 px drawn, inside a box a host insets 2 px).
1188
+ */
1189
+ declare const HATCH_END = 8;
1190
+ /**
1191
+ * A striped column edge's thickness, px: where an empty lane's band lies over items that move aside when it opens
1192
+ * (about 6 px drawn, 2 px clear of the window's edge).
1193
+ */
1194
+ declare const HATCH_EDGE = 8;
1158
1195
 
1159
- export { type SceneItemLayout as $, type LaneSpot as A, RAIL_MODES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchorAt as F, RAIL_STRIP_MIN as G, RAIL_VISIBILITIES as H, type RailDropPolicy as I, type RailPlace as J, type Kind as K, type Lane as L, type RailSpec as M, type RailVisibility as N, type Orient as O, type Place as P, type ResizeEdges as Q, type Regions as R, type Scene as S, type ResizeLimit as T, SIDES as U, SPOT_PITCH as V, type SceneAfter as W, type SceneChrome as X, type SceneEdgeLayout as Y, type Zone as Z, type SceneFloat as _, type ScenePlace as a, type SceneNote as a0, type SceneRailLayout as a1, type SceneRead as a2, type StoredSceneEdge as a3, type StoredSceneFloat as a4, type StoredSceneItem as a5, ZONES as a6, canFold as a7, close as a8, dockHome as a9, fitResize as aa, floatAt as ab, fold as ac, homeFor as ad, keep as ae, lanes as af, lift as ag, mergeSideColumns as ah, moveTo as ai, open as aj, orient as ak, raise as al, readScene as am, resize as an, setRailMode as ao, setSide as ap, storeScene as aq, use as ar, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SceneRefusal as g, type FloatAnchor as h, type ZoneAccepts as i, type SceneItem as j, type RailMode as k, type SolveOptions as l, type SceneTargetOptions as m, type ColumnTemplate as n, DEFAULT_HIT_BAND as o, DEFAULT_RAIL_MAGNET as p, DEFAULT_STRIP as q, type DockPlace as r, EDGE_ROOM_HOLD as s, FLOAT_ANCHORS as t, type FloatAnchorOffset as u, type FloatPlace as v, type FloatResize as w, type LaneMark as x, type LaneOptions as y, type LaneRefusal as z };
1196
+ export { type SceneEdgeLayout as $, type LaneRefusal as A, type LaneSpot as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchorAt as F, RAIL_MODES as G, HATCH_EDGE as H, RAIL_STRIP_MIN as I, RAIL_VISIBILITIES as J, type Kind as K, type Lane as L, type RailDropPolicy as M, type RailPlace as N, type Orient as O, type Place as P, type RailSpec as Q, type Regions as R, type Scene as S, type RailVisibility as T, type ResizeEdges as U, type ResizeLimit as V, SIDES as W, SPOT_PITCH as X, type SceneAfter as Y, type Zone as Z, type SceneChrome as _, type ScenePlace as a, type SceneFloat as a0, type SceneItemLayout as a1, type SceneNote as a2, type SceneRailLayout as a3, type SceneRead as a4, type StoredSceneEdge as a5, type StoredSceneFloat as a6, type StoredSceneItem as a7, ZONES as a8, canFold as a9, close as aa, dockHome as ab, fitResize as ac, floatAt as ad, fold as ae, homeFor as af, keep as ag, lanes as ah, lift as ai, mergeSideColumns as aj, moveTo as ak, open as al, orient as am, raise as an, readScene as ao, resize as ap, setRailMode as aq, setSide as ar, storeScene as as, use as at, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SceneRefusal as g, type FloatAnchor as h, type ZoneAccepts as i, type SceneItem as j, type RailMode as k, type SolveOptions as l, type SceneTargetOptions as m, type ColumnTemplate as n, DEFAULT_HIT_BAND as o, DEFAULT_RAIL_MAGNET as p, DEFAULT_STRIP as q, type DockPlace as r, EDGE_ROOM_HOLD as s, FLOAT_ANCHORS as t, type FloatAnchorOffset as u, type FloatPlace as v, type FloatResize as w, HATCH_END as x, type LaneMark as y, type LaneOptions as z };
@@ -1,6 +1,6 @@
1
1
  import { P as Point, R as Rect } from './geometry-Bf37LbCT.js';
2
2
  import { S as StackFormKind } from './model-X7eUaKlA.js';
3
- import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget, g as SceneRefusal, R as Regions } from './lanes-0L2Cy12X.js';
3
+ import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget, g as SceneRefusal, R as Regions } from './lanes-D8K4UI3s.js';
4
4
  import './target-BBOCeez2.js';
5
5
 
6
6
  /**
@@ -609,6 +609,11 @@ declare const LANES_SINCE = "26.11.45";
609
609
  * its press point need it, and a host must pass the grab to `lanes()` for them to pass.
610
610
  */
611
611
  declare const GRAB_SINCE = "26.11.46";
612
+ /**
613
+ * The first library version whose grab moves no hop past a long neighbor (26.11.46 and 26.11.47 cut two landings far
614
+ * apart at the grab too, so a toolbar held by its grip hopped a neighbor early): the grip rows need it.
615
+ */
616
+ declare const GRIP_SINCE = "26.11.48";
612
617
  /** The last published version without `lanes()`. */
613
618
  declare const LAST_WITHOUT_LANES = "26.11.44";
614
619
  /** From this date every landing row runs on every host (or at the breaking release, if that comes first). */
@@ -647,11 +652,11 @@ type LandingRule = (options: {
647
652
  };
648
653
  readonly placeGuides?: "off" | "near" | "all";
649
654
  }) => LandingModelLike;
650
- /** A place guide a frame shows: its lane, line or box, and where. */
655
+ /** A place guide a frame shows: its lane, line, box or hatch, and where. */
651
656
  interface LandingCaseGuide {
652
657
  readonly id: string;
653
658
  readonly lane: string;
654
- readonly kind: "line" | "box";
659
+ readonly kind: "line" | "box" | "hatch";
655
660
  readonly rect: Rect;
656
661
  }
657
662
  /** One frame a host reports: the pointer, whether it is still moving along the path, and the model's answer. */
@@ -690,6 +695,11 @@ interface LandingCase {
690
695
  readonly notRegions?: readonly LandingRegionName[];
691
696
  /** Whenever a lane is held, the landing lies within this many px of the pointer. */
692
697
  readonly trail?: number;
698
+ /**
699
+ * On the single frame before a hop (the next frame holds another spot of the same lane), this bound instead of
700
+ * `trail` (R12: 48 px, 56 on that frame). Absent: `trail` on every frame.
701
+ */
702
+ readonly trailBeforeHop?: number;
693
703
  /**
694
704
  * The landing lies no further from the pointer, at worst, than when the same path is played at `slow` px/ms, plus
695
705
  * `by` px: a fast hand trails no more than a slow one does, plus what it may trail.
@@ -787,4 +797,4 @@ declare const CASE_GROUPS: readonly {
787
797
  /** The row with this id, or undefined. */
788
798
  declare const caseById: (id: string) => CaseRow | undefined;
789
799
 
790
- export { type AimArea, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseRequires, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, GRAB_SINCE, type Gesture, type GestureType, type IdMap, type ItemExpect, LANDING_CASES, LANES_DEADLINE, LANES_SINCE, LAST_WITHOUT_LANES, LIFT_THRESHOLD, type LandingCase, type LandingCaseFrame, type LandingCaseGuide, type LandingCaseHost, type LandingCaseResult, type LandingModelLike, type LandingPlay, type LandingRegionName, type LandingRule, type LayoutExpect, type PickCandidate, type PickRule, type Rename, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createLandingHost, createSceneHost, defaultItemSelector, g, idRenames, landingIssues, lanesRatchet, layoutIssues, mapGesture, mapLayout, mapPlace, mapScene, mapStored, pickTarget, resizeStep, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, runLandingCases, winScene, withRefusals };
800
+ export { type AimArea, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseRequires, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, GRAB_SINCE, GRIP_SINCE, type Gesture, type GestureType, type IdMap, type ItemExpect, LANDING_CASES, LANES_DEADLINE, LANES_SINCE, LAST_WITHOUT_LANES, LIFT_THRESHOLD, type LandingCase, type LandingCaseFrame, type LandingCaseGuide, type LandingCaseHost, type LandingCaseResult, type LandingModelLike, type LandingPlay, type LandingRegionName, type LandingRule, type LayoutExpect, type PickCandidate, type PickRule, type Rename, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createLandingHost, createSceneHost, defaultItemSelector, g, idRenames, landingIssues, lanesRatchet, layoutIssues, mapGesture, mapLayout, mapPlace, mapScene, mapStored, pickTarget, resizeStep, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, runLandingCases, winScene, withRefusals };
@@ -20,7 +20,7 @@ import {
20
20
  storeScene,
21
21
  targets,
22
22
  use
23
- } from "./chunk-VNOEEI4L.js";
23
+ } from "./chunk-FJ5R6PMB.js";
24
24
  import "./chunk-AE3BWTAE.js";
25
25
  import {
26
26
  centre,
@@ -2347,6 +2347,7 @@ async function runCasesAsync(rows, makeHost, options = {}) {
2347
2347
  // src/scene/cases/landing.ts
2348
2348
  var LANES_SINCE = "26.11.45";
2349
2349
  var GRAB_SINCE = "26.11.46";
2350
+ var GRIP_SINCE = "26.11.48";
2350
2351
  var LAST_WITHOUT_LANES = "26.11.44";
2351
2352
  var LANES_DEADLINE = "2026-12-31";
2352
2353
  var versionBefore = (a, b) => {
@@ -2379,13 +2380,17 @@ function landingIssues(row2, frames, layout, before) {
2379
2380
  const m = row2.moving;
2380
2381
  if (frames.length === 0) return ["no frames"];
2381
2382
  if (m)
2382
- for (const f2 of frames.filter((x) => x.moving)) {
2383
+ for (const [i, f2] of frames.entries()) {
2384
+ if (!f2.moving) continue;
2383
2385
  const at2 = `at ${Math.round(f2.point.x)},${Math.round(f2.point.y)}`;
2386
+ const next = frames[i + 1];
2387
+ const beforeHop = !!next && next.region === "lane" && f2.region === "lane" && next.lane === f2.lane && next.spot !== f2.spot;
2388
+ const bound = beforeHop && m.trailBeforeHop !== void 0 ? m.trailBeforeHop : m.trail;
2384
2389
  if (m.lane !== void 0 && (f2.region !== "lane" || f2.lane !== m.lane)) out.push(`${at2}: ${f2.region}${f2.lane ? ` in ${f2.lane}` : ""}, not the lane ${m.lane}`);
2385
2390
  if (m.notLanes && f2.lane && m.notLanes.includes(f2.lane)) out.push(`${at2}: held ${f2.lane}`);
2386
2391
  if (m.notRegions && m.notRegions.includes(f2.region)) out.push(`${at2}: ${f2.region}`);
2387
2392
  for (const g2 of m.noGuideIn ? f2.guides ?? [] : []) if (m.noGuideIn.some((r) => touches(g2.rect, r))) out.push(`${at2}: the guide ${g2.id} where nothing lands`);
2388
- if (m.trail !== void 0 && f2.region === "lane" && f2.landing && gapTo(f2.landing, f2.point) > m.trail + 0.5) out.push(`${at2}: the landing ${Math.round(gapTo(f2.landing, f2.point))} px from the pointer (at most ${m.trail})`);
2393
+ if (bound !== void 0 && f2.region === "lane" && f2.landing && gapTo(f2.landing, f2.point) > bound + 0.5) out.push(`${at2}: the landing ${Math.round(gapTo(f2.landing, f2.point))} px from the pointer (at most ${bound}${beforeHop ? ", the frame before a hop" : ""})`);
2389
2394
  if (out.length >= 4) break;
2390
2395
  }
2391
2396
  const last = frames.at(-1);
@@ -2673,6 +2678,55 @@ var LANDING_CASES = [
2673
2678
  home: true,
2674
2679
  requires: GRAB
2675
2680
  },
2681
+ {
2682
+ id: "landing-grip-past-long-neighbor",
2683
+ title: "A toolbar held by its grip and slid past a long neighbor stays at the hand",
2684
+ expect: "A toolbar pressed 6 px into its left end (its grip) in the bottom bar and slid right along it past a 200 px neighbor to the bar's far end at 0.15 px/ms: every frame holds the bar, and the landing lies within 48 px of the pointer, 56 on the frame before a hop (R12): the grab never moves a hop past the neighbor.",
2685
+ scene: landingWindow(["a"], ["b", "c"]),
2686
+ item: "b",
2687
+ path: [
2688
+ { x: 14, y: 622 },
2689
+ { x: 1060, y: 622 }
2690
+ ],
2691
+ speed: 0.15,
2692
+ rest: 40,
2693
+ moving: { lane: "bottom", trail: 48, trailBeforeHop: 56 },
2694
+ requires: { lanes: { since: GRIP_SINCE } }
2695
+ },
2696
+ {
2697
+ id: "landing-grip-across-items",
2698
+ title: "A toolbar held by its grip and slid slowly across two neighbors stays at the hand",
2699
+ expect: "In a top bar of three 200 px toolbars, the first pressed 6 px into its left end (its grip) and slid right across the other two to the bar's end at 0.15 px/ms: every frame holds the bar, and the landing lies within 48 px of the pointer, 56 on the frame before a hop (R12).",
2700
+ scene: landingWindow(["a", "b", "c"]),
2701
+ item: "a",
2702
+ path: [
2703
+ { x: 14, y: 18 },
2704
+ { x: 1060, y: 18 }
2705
+ ],
2706
+ speed: 0.15,
2707
+ rest: 40,
2708
+ moving: { lane: "top", trail: 48, trailBeforeHop: 56 },
2709
+ requires: { lanes: { since: GRIP_SINCE } }
2710
+ },
2711
+ {
2712
+ id: "landing-grip-up-the-rail",
2713
+ title: "A rail toolbar held by its grip and pulled slowly up past its neighbor stays at the hand",
2714
+ expect: "Zoom pressed 6 px below its top (its grip) in its rail and pulled straight up past Tools (158 px long there) to the rail's head at 0.15 px/ms: every frame holds the rail, and the landing lies within 48 px of the pointer, 56 on the frame before a hop (R12).",
2715
+ scene: (() => {
2716
+ const s = landingWindow();
2717
+ const tools = group2("tools", 1);
2718
+ return { ...s, items: { ...s.items, tools: { ...tools, forms: { ...tools.forms, column: [form("icons", 158, 158, 28), form("menu", 0, 0, 0)] } } } };
2719
+ })(),
2720
+ item: "zoom",
2721
+ path: [
2722
+ { x: 15, y: 200 },
2723
+ { x: 15, y: 40 }
2724
+ ],
2725
+ speed: 0.15,
2726
+ rest: 40,
2727
+ moving: { lane: "rail-left", trail: 48, trailBeforeHop: 56 },
2728
+ requires: { lanes: { since: GRIP_SINCE } }
2729
+ },
2676
2730
  {
2677
2731
  id: "landing-across-items",
2678
2732
  title: "A fast hand across docked items trails no further than it must",
@@ -2712,6 +2766,7 @@ export {
2712
2766
  CASE_GROUPS,
2713
2767
  END_REACH,
2714
2768
  GRAB_SINCE,
2769
+ GRIP_SINCE,
2715
2770
  LANDING_CASES,
2716
2771
  LANES_DEADLINE,
2717
2772
  LANES_SINCE,