@n-uf/placement 26.11.48 → 26.11.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +23 -1702
- package/dist/{chunk-IDWMDPY7.js → chunk-NM4ADJC2.js} +267 -61
- package/dist/chunk-NM4ADJC2.js.map +1 -0
- package/dist/{chunk-GIBUM6TB.js → chunk-TWI644JK.js} +1 -1
- package/dist/chunk-TWI644JK.js.map +1 -0
- package/dist/desk.d.ts +2 -0
- package/dist/desk.js.map +1 -1
- package/dist/{lanes-BcglySmh.d.ts → lanes-CkFz9E5l.d.ts} +69 -10
- package/dist/scene-cases.d.ts +13 -2
- package/dist/scene-cases.js +30 -5
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +2 -2
- package/dist/scene.js +1 -1
- package/dist/targets.js +1 -1
- package/dist/toolbar.d.ts +2 -0
- package/dist/toolbar.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-GIBUM6TB.js.map +0 -1
- package/dist/chunk-IDWMDPY7.js.map +0 -1
|
@@ -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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Q,MAAM,IAAI,CAAC,EAAG,CAAC,CAAC,GAAG,CAAC;AAC7N,SAAK,KAAK,EAAE,MAAM,GAAG,MAAM,IAAI,OAAO,MAAM,EAAE,EAAE,QAAQ,IAAI,GAAG,IAAI,GAAG,EAAE,EAAG,CAAC,IAAI,MAAM,GAAG,OAAO,OAAO,OAAO,GAAG,IAAI,kBAAe,CAAC;AAAA,EACvI;AACA,OAAK,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE;AAC/B,QAAM,QAAQ,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,EAAG,KAAK,EAAE,MAAM,GAAG,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;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,CAAC,IAAI,CAAC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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,MAA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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":[]}
|
|
@@ -762,8 +762,9 @@ declare function fitResize(scene: Scene, id: string, rect: Rect, moving: ResizeE
|
|
|
762
762
|
|
|
763
763
|
/**
|
|
764
764
|
* Where a docked item goes: before the `at`-th item of `zone` (default the item's own zone) in `edge`, keeping `space`
|
|
765
|
-
* px free on its zone's open side (`SceneItem.space`; 0: none).
|
|
766
|
-
*
|
|
765
|
+
* px free on its zone's open side (`SceneItem.space`; absent or 0: none). Docked into the room a placed neighbor keeps,
|
|
766
|
+
* it consumes that room: the neighbor keeps what is left and moves only by what the room lacks. (While the edge has
|
|
767
|
+
* spare length to give every room; a squeezed edge shares its spare out, and its items may shift by a few px.)
|
|
767
768
|
*/
|
|
768
769
|
interface DockPlace {
|
|
769
770
|
readonly kind?: "gap";
|
|
@@ -799,7 +800,12 @@ type Place = DockPlace | ColumnPlace | RailPlace | FloatPlace;
|
|
|
799
800
|
* calls it as it reads a stored layout, so what it stores is what it shows and what a drag reads.
|
|
800
801
|
*/
|
|
801
802
|
declare function mergeSideColumns(scene: Scene): Scene;
|
|
802
|
-
/**
|
|
803
|
+
/**
|
|
804
|
+
* The scene with the item out of every edge and every float (a dynamic column it leaves empty is deleted). The room it
|
|
805
|
+
* held goes back to its stretch: the first placed item past it, away from its zone's own end (`SceneItem.space`), takes
|
|
806
|
+
* it back, so it stays where it was drawn; the flush items between close up toward the zone's own end. (While the edge
|
|
807
|
+
* has spare length to give every room; a squeezed edge, or items stepping up to wider forms, may shift it by a few px.)
|
|
808
|
+
*/
|
|
803
809
|
declare function lift(scene: Scene, id: string): Scene;
|
|
804
810
|
declare function moveTo(scene: Scene, id: string, place: Place): Scene;
|
|
805
811
|
declare function floatAt(scene: Scene, id: string, at?: Rect, orient?: Orient): Scene;
|
|
@@ -1037,8 +1043,9 @@ interface SceneRefusal {
|
|
|
1037
1043
|
*
|
|
1038
1044
|
* A lane is one edge that takes the held item (a bar, a rail, a column) or a virtual one (a new column's line, a
|
|
1039
1045
|
* declared rail). Its spots are the places a drop there lands, in order along it: before, between and after its items,
|
|
1040
|
-
* and, on a bar or a toolbar rail,
|
|
1041
|
-
*
|
|
1046
|
+
* and, on a bar or a toolbar rail, one sliding spot per free stretch between items, which lands exactly where the hand
|
|
1047
|
+
* holds it (`LaneSpot.slide`; `stretchPositions: "free"`, the default); with `stretchPositions: "pitched"`, spots at a
|
|
1048
|
+
* fixed pitch over those stretches instead (`SPOT_PITCH`), so a toolbar lands close to the hand. Each spot keys where its drop draws the other items (a change between two spots
|
|
1042
1049
|
* with the same key moves only the held item), and each lane carries its place guides' marks in the layout as drawn.
|
|
1043
1050
|
* Each spot has a stretch of the lane that picks it. In a panel column, between two spots that share a neighbor (the
|
|
1044
1051
|
* 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
|
|
@@ -1056,11 +1063,35 @@ interface SceneRefusal {
|
|
|
1056
1063
|
|
|
1057
1064
|
/** The pitch of the spots over a bar's free stretches, px: a quarter of a typical toolbar's length (158 px in the lab). */
|
|
1058
1065
|
declare const SPOT_PITCH = 40;
|
|
1066
|
+
/**
|
|
1067
|
+
* A sliding spot's range (`LaneOptions.stretchPositions: "free"`): where the landing's start may lie along the lane,
|
|
1068
|
+
* from flush against the neighbor before the stretch to flush against the one after it, and the starts it snaps to.
|
|
1069
|
+
*/
|
|
1070
|
+
interface LaneSlide {
|
|
1071
|
+
readonly from: number;
|
|
1072
|
+
readonly to: number;
|
|
1073
|
+
/**
|
|
1074
|
+
* Its two ends, the item's own place where it lies here, and every other dock that lands inside, in order. Each is a
|
|
1075
|
+
* start that commits what lies there (a taken-over dock as it is), so none is dropped for lying near another, except
|
|
1076
|
+
* within twice the snap distance of the item's own place, where home wins.
|
|
1077
|
+
*/
|
|
1078
|
+
readonly snaps: readonly number[];
|
|
1079
|
+
/** How near a snap point the landing's start snaps to it, px (`LaneOptions.snapDistance`). */
|
|
1080
|
+
readonly snapDistance: number;
|
|
1081
|
+
/**
|
|
1082
|
+
* The grain of a start that snaps to nothing, px: a multiple of `step` (whole px, 1) within `[from, to]`. The one rule
|
|
1083
|
+
* `target.after`, a landing model's frame and its release all read, so the frame shows what the drop commits:
|
|
1084
|
+
* with `c = clamp(raw, from, to)`, the start is the nearest snap point within `snapDistance` of `c`, else
|
|
1085
|
+
* `clamp(round(c / step) * step, from, to)`.
|
|
1086
|
+
*/
|
|
1087
|
+
readonly step: number;
|
|
1088
|
+
}
|
|
1059
1089
|
/** One place a drop in a lane lands. */
|
|
1060
1090
|
interface LaneSpot {
|
|
1061
1091
|
/**
|
|
1062
1092
|
* Stable across solves: `<lane>/<zone>/<item before or ^>|<item after or $>`; an empty edge's `<lane>/<zone>`; a
|
|
1063
|
-
* pitched spot `…@<pitches from its neighbor>`; a
|
|
1093
|
+
* pitched spot `…@<pitches from its neighbor>`; a sliding spot `<lane>/<zone>/<before>|<after>@slide`, named by the
|
|
1094
|
+
* stretch; a virtual lane's `<lane>/line` or `<lane>/end`.
|
|
1064
1095
|
*/
|
|
1065
1096
|
readonly id: string;
|
|
1066
1097
|
/** Its stretch of the lane, along the lane's axis, inside the lane's range. */
|
|
@@ -1069,10 +1100,21 @@ interface LaneSpot {
|
|
|
1069
1100
|
readonly landing: Rect;
|
|
1070
1101
|
/** The drop: its place and `after()` (the layout after it, the room). */
|
|
1071
1102
|
readonly target: SceneTarget;
|
|
1072
|
-
/**
|
|
1103
|
+
/**
|
|
1104
|
+
* The item's own place (a release there changes nothing). A spot's `target.place` is the dock at the spot's listed
|
|
1105
|
+
* landing (on the item's own sliding spot its own zone, index and `space`); a sliding spot commits through
|
|
1106
|
+
* `target.after(point, grab)`, and the landing release's `home` and `at` say where, never the place kind.
|
|
1107
|
+
*/
|
|
1073
1108
|
readonly home?: true;
|
|
1074
1109
|
/** A spot at a pitch over a free stretch (`SceneItem.space`). */
|
|
1075
1110
|
readonly pitched?: true;
|
|
1111
|
+
/**
|
|
1112
|
+
* A free stretch as one sliding spot (`stretchPositions: "free"`): its drop lands where the pointer holds it, the
|
|
1113
|
+
* landing's start at the pointer less the grab, clamped to `[from, to]` and snapped within `snapDistance`, and
|
|
1114
|
+
* `target.after(point, grab)` commits that (a dock keeping the `space` that puts it there). Its `landing` is the one at
|
|
1115
|
+
* the stretch's point nearest the item's own place (that place where it lies here), else at its start.
|
|
1116
|
+
*/
|
|
1117
|
+
readonly slide?: LaneSlide;
|
|
1076
1118
|
/**
|
|
1077
1119
|
* Where its drop draws every item other than the held one, as a key: a change between two spots with the same key
|
|
1078
1120
|
* moves only the held item; between two with different keys it reflows the window.
|
|
@@ -1130,7 +1172,11 @@ interface Regions {
|
|
|
1130
1172
|
readonly lanes: readonly Lane[];
|
|
1131
1173
|
/** Refused places outside every lane ("Can't go here"). */
|
|
1132
1174
|
readonly refused: readonly Rect[];
|
|
1133
|
-
/**
|
|
1175
|
+
/**
|
|
1176
|
+
* Where a float can land (`floatRegion`: the stage less the float insets), as a landing model's `content`: the open
|
|
1177
|
+
* space is it less `blocked`. So the gutter between a column and the pages is open (a release there floats), while
|
|
1178
|
+
* every drawn edge, docked item, chrome and drawn rail stays out of it.
|
|
1179
|
+
*/
|
|
1134
1180
|
readonly content: Rect;
|
|
1135
1181
|
/** What the open space excludes: drawn edges, docked items, the chrome, a drawn declared rail, `Scene.blocked`. */
|
|
1136
1182
|
readonly blocked: readonly Rect[];
|
|
@@ -1145,8 +1191,21 @@ interface Regions {
|
|
|
1145
1191
|
readonly refusals: readonly SceneRefusal[];
|
|
1146
1192
|
}
|
|
1147
1193
|
interface LaneOptions extends SceneTargetOptions {
|
|
1148
|
-
/**
|
|
1194
|
+
/**
|
|
1195
|
+
* The pitch of a bar's free-stretch spots, px (default `SPOT_PITCH`). 0 or less turns pitched spots off. Under `"free"` it only sets the sampling step that checks a
|
|
1196
|
+
* stretch's range (every `pitch` px; `SPOT_PITCH` when 0 or less), never a spot of its own.
|
|
1197
|
+
*/
|
|
1149
1198
|
readonly pitch?: number;
|
|
1199
|
+
/**
|
|
1200
|
+
* How a free stretch on a bar or a toolbar rail offers its range of landings, from flush against the neighbor before
|
|
1201
|
+
* it to flush against the one after it: `"free"` (the default), one sliding spot (`LaneSpot.slide`) that lands where
|
|
1202
|
+
* the pointer holds the item, snapped to its ends and the item's own place within `snapDistance`; `"pitched"`, a
|
|
1203
|
+
* spot every `pitch` px, its ends included. Either way a step comes only where the order changes (passing a
|
|
1204
|
+
* neighbor), cut as between any two spots.
|
|
1205
|
+
*/
|
|
1206
|
+
readonly stretchPositions?: "free" | "pitched";
|
|
1207
|
+
/** Under `"free"`, how near a snap point a landing snaps to it, px (default 8). */
|
|
1208
|
+
readonly snapDistance?: number;
|
|
1150
1209
|
/** The spot held now: its lane's stretches are drawn in its own layout (the room open). Default: the layout as seen. */
|
|
1151
1210
|
readonly spot?: string;
|
|
1152
1211
|
/**
|
|
@@ -1189,4 +1248,4 @@ declare const HATCH_END = 8;
|
|
|
1189
1248
|
*/
|
|
1190
1249
|
declare const HATCH_EDGE = 8;
|
|
1191
1250
|
|
|
1192
|
-
export { type
|
|
1251
|
+
export { type SceneChrome as $, type LaneRefusal as A, type LaneSlide as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchorAt as F, type LaneSpot as G, HATCH_EDGE as H, RAIL_MODES as I, RAIL_STRIP_MIN as J, type Kind as K, type LaneOptions as L, RAIL_VISIBILITIES as M, type RailDropPolicy as N, type Orient as O, type Place as P, type RailPlace as Q, type Regions as R, type Scene as S, type RailSpec as T, type RailVisibility as U, type ResizeEdges as V, type ResizeLimit as W, SIDES as X, SPOT_PITCH as Y, type Zone as Z, type SceneAfter as _, type ScenePlace as a, type SceneEdgeLayout as a0, type SceneFloat as a1, type SceneItemLayout as a2, type SceneNote as a3, type SceneRailLayout as a4, type SceneRead as a5, type StoredSceneEdge as a6, type StoredSceneFloat as a7, type StoredSceneItem as a8, ZONES as a9, canFold as aa, close as ab, dockHome as ac, fitResize as ad, floatAt as ae, fold as af, homeFor as ag, keep as ah, lanes as ai, lift as aj, mergeSideColumns as ak, moveTo as al, open as am, orient as an, raise as ao, readScene as ap, resize as aq, setRailMode as ar, setSide as as, storeScene as at, use as au, 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 Lane as y, type LaneMark as z };
|
package/dist/scene-cases.d.ts
CHANGED
|
@@ -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-
|
|
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, L as LaneOptions } from './lanes-CkFz9E5l.js';
|
|
4
4
|
import './target-BBOCeez2.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -614,6 +614,11 @@ declare const GRAB_SINCE = "26.11.46";
|
|
|
614
614
|
* apart at the grab too, so a toolbar held by its grip hopped a neighbor early): the grip rows need it.
|
|
615
615
|
*/
|
|
616
616
|
declare const GRIP_SINCE = "26.11.48";
|
|
617
|
+
/**
|
|
618
|
+
* The first library version where a dock consumes the room it lands in and an item over a neighbor takes its place (the
|
|
619
|
+
* neighbor giving way): the rows passing a neighbor that keeps room need it.
|
|
620
|
+
*/
|
|
621
|
+
declare const ROOM_SINCE = "26.11.50";
|
|
617
622
|
/** The last published version without `lanes()`. */
|
|
618
623
|
declare const LAST_WITHOUT_LANES = "26.11.44";
|
|
619
624
|
/** From this date every landing row runs on every host (or at the breaking release, if that comes first). */
|
|
@@ -650,6 +655,11 @@ type LandingRule = (options: {
|
|
|
650
655
|
readonly lane: string;
|
|
651
656
|
readonly spot: string;
|
|
652
657
|
};
|
|
658
|
+
/** Where the press holds the item (a landing model's `grab`): a sliding spot's landing follows the pointer less it. */
|
|
659
|
+
readonly grab?: {
|
|
660
|
+
readonly x: number;
|
|
661
|
+
readonly y: number;
|
|
662
|
+
};
|
|
653
663
|
readonly placeGuides?: "off" | "near" | "all";
|
|
654
664
|
}) => LandingModelLike;
|
|
655
665
|
/** A place guide a frame shows: its lane, line, box or hatch, and where. */
|
|
@@ -781,6 +791,7 @@ declare function lanesRatchet(r: {
|
|
|
781
791
|
declare function createLandingHost(o: {
|
|
782
792
|
readonly landing: LandingRule;
|
|
783
793
|
readonly version?: string;
|
|
794
|
+
readonly stretchPositions?: LaneOptions["stretchPositions"];
|
|
784
795
|
}): LandingCaseHost;
|
|
785
796
|
declare const LANDING_CASES: readonly LandingCase[];
|
|
786
797
|
|
|
@@ -797,4 +808,4 @@ declare const CASE_GROUPS: readonly {
|
|
|
797
808
|
/** The row with this id, or undefined. */
|
|
798
809
|
declare const caseById: (id: string) => CaseRow | undefined;
|
|
799
810
|
|
|
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 };
|
|
811
|
+
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, ROOM_SINCE, 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 };
|
package/dist/scene-cases.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
storeScene,
|
|
21
21
|
targets,
|
|
22
22
|
use
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NM4ADJC2.js";
|
|
24
24
|
import "./chunk-AE3BWTAE.js";
|
|
25
25
|
import {
|
|
26
26
|
centre,
|
|
@@ -2348,6 +2348,7 @@ async function runCasesAsync(rows, makeHost, options = {}) {
|
|
|
2348
2348
|
var LANES_SINCE = "26.11.45";
|
|
2349
2349
|
var GRAB_SINCE = "26.11.46";
|
|
2350
2350
|
var GRIP_SINCE = "26.11.48";
|
|
2351
|
+
var ROOM_SINCE = "26.11.50";
|
|
2351
2352
|
var LAST_WITHOUT_LANES = "26.11.44";
|
|
2352
2353
|
var LANES_DEADLINE = "2026-12-31";
|
|
2353
2354
|
var versionBefore = (a, b) => {
|
|
@@ -2447,10 +2448,11 @@ function createLandingHost(o) {
|
|
|
2447
2448
|
if (!own) throw new Error(`no item ${row2.item}`);
|
|
2448
2449
|
const press = row2.path[0];
|
|
2449
2450
|
const grab = { x: press.x - own.rect.x, y: press.y - own.rect.y };
|
|
2450
|
-
const
|
|
2451
|
-
const
|
|
2451
|
+
const laneOptions = { previous, grab, ...o.stretchPositions ? { stretchPositions: o.stretchPositions } : {} };
|
|
2452
|
+
const regions = lanes(s, row2.item, laneOptions);
|
|
2453
|
+
const regionsFor = (spot2) => lanes(s, row2.item, { ...laneOptions, spot: spot2 });
|
|
2452
2454
|
const home = regions.lanes.flatMap((l) => l.spots.filter((x) => x.home).map((x) => ({ lane: l.id, spot: x.id })))[0];
|
|
2453
|
-
const model = o.landing({ regions, regionsFor, floatLanding: (p) => regions.float?.after(p, grab).layout.items[row2.item]?.rect ?? null, ...home ? { home } : {}, placeGuides: "near" });
|
|
2455
|
+
const model = o.landing({ regions, regionsFor, grab, floatLanding: (p) => regions.float?.after(p, grab).layout.items[row2.item]?.rect ?? null, ...home ? { home } : {}, placeGuides: "near" });
|
|
2454
2456
|
const frames = [];
|
|
2455
2457
|
const play = (p, t2, moving) => {
|
|
2456
2458
|
const f2 = model.update(p, t2);
|
|
@@ -2467,7 +2469,7 @@ function createLandingHost(o) {
|
|
|
2467
2469
|
for (let r = SAMPLE; r <= (row2.rest ?? 0); r += SAMPLE) play(at2, t += SAMPLE, false);
|
|
2468
2470
|
const out = model.release();
|
|
2469
2471
|
const spot = out?.kind === "spot" ? [...regions.lanes, ...regionsFor(out.spot).lanes].flatMap((l) => l.spots).find((x) => x.id === out.spot) : void 0;
|
|
2470
|
-
const target = out?.kind === "float" ? regions.float : spot && !
|
|
2472
|
+
const target = out?.kind === "float" ? regions.float : spot && out?.kind === "spot" && !out.home ? spot.target : null;
|
|
2471
2473
|
const next = target ? target.after(at2, grab).scene : s;
|
|
2472
2474
|
return { frames, layout: solve(next, { previous }), before: previous };
|
|
2473
2475
|
}
|
|
@@ -2727,6 +2729,28 @@ var LANDING_CASES = [
|
|
|
2727
2729
|
moving: { lane: "rail-left", trail: 48, trailBeforeHop: 56 },
|
|
2728
2730
|
requires: { lanes: { since: GRIP_SINCE } }
|
|
2729
2731
|
},
|
|
2732
|
+
...[0.15, 0.6].map(
|
|
2733
|
+
(speed) => ({
|
|
2734
|
+
id: `landing-room-up-past-placed-${speed === 0.15 ? "slow" : "fast"}`,
|
|
2735
|
+
title: `A rail toolbar held by its grip and pulled up past a long neighbor that keeps room stays at the hand (${speed} px/ms)`,
|
|
2736
|
+
expect: `Tools (158 px) keeps 100 px of room above it at the rail's head, and Zoom keeps 80 px below Tools. Zoom pressed by its grip and pulled straight up past Tools to the rail's head at ${speed} px/ms: every frame holds the rail, and the landing lies within 48 px of the pointer, 56 on the frame before a hop. Over the free room a drop consumes it; over Tools, Zoom takes Tools' place and Tools gives way, so the landings either side of Tools are never a whole Tools apart.`,
|
|
2737
|
+
scene: (() => {
|
|
2738
|
+
const s = landingWindow();
|
|
2739
|
+
const tools = group2("tools", 1);
|
|
2740
|
+
const zoom = group2("zoom", 2);
|
|
2741
|
+
return { ...s, items: { ...s.items, tools: { ...tools, space: 100, forms: { ...tools.forms, column: [form("icons", 158, 158, 28), form("menu", 0, 0, 0)] } }, zoom: { ...zoom, space: 80 } } };
|
|
2742
|
+
})(),
|
|
2743
|
+
item: "zoom",
|
|
2744
|
+
path: [
|
|
2745
|
+
{ x: 15, y: 380 },
|
|
2746
|
+
{ x: 15, y: 40 }
|
|
2747
|
+
],
|
|
2748
|
+
speed,
|
|
2749
|
+
rest: 40,
|
|
2750
|
+
moving: { lane: "rail-left", trail: 48, trailBeforeHop: 56 },
|
|
2751
|
+
requires: { lanes: { since: ROOM_SINCE } }
|
|
2752
|
+
})
|
|
2753
|
+
),
|
|
2730
2754
|
{
|
|
2731
2755
|
id: "landing-across-items",
|
|
2732
2756
|
title: "A fast hand across docked items trails no further than it must",
|
|
@@ -2772,6 +2796,7 @@ export {
|
|
|
2772
2796
|
LANES_SINCE,
|
|
2773
2797
|
LAST_WITHOUT_LANES,
|
|
2774
2798
|
LIFT_THRESHOLD,
|
|
2799
|
+
ROOM_SINCE,
|
|
2775
2800
|
WINDOW_A,
|
|
2776
2801
|
WINDOW_B,
|
|
2777
2802
|
WINDOW_BARE,
|