@n-uf/placement 26.11.34 → 26.11.37
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 +163 -0
- package/README.md +147 -20
- package/dist/{chunk-VKB3UWKX.js → chunk-2PWDUBPG.js} +520 -97
- package/dist/chunk-2PWDUBPG.js.map +1 -0
- package/dist/{chunk-AVMZIXGO.js → chunk-NF7RYK3U.js} +9 -49
- package/dist/chunk-NF7RYK3U.js.map +1 -0
- package/dist/chunk-R3AAANRY.js +220 -0
- package/dist/chunk-R3AAANRY.js.map +1 -0
- package/dist/desk.d.ts +2 -2
- package/dist/dock.js +2 -1
- package/dist/dock.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{model-BSIKmANw.d.ts → model-CuE-ML-f.d.ts} +111 -19
- package/dist/panels.d.ts +3 -3
- package/dist/regions-Db_RyT4P.d.ts +48 -0
- package/dist/scene-cases.d.ts +42 -10
- package/dist/scene-cases.js +109 -10
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +100 -6
- package/dist/scene.js +11 -1
- package/dist/stack.d.ts +1 -1
- package/dist/{target-2RYYKkd1.d.ts → target-fhD5UVlt.d.ts} +2 -0
- package/dist/{targets-Du5_4T1u.d.ts → targets-DnVNZVQW.d.ts} +1 -1
- package/dist/targets.d.ts +17 -32
- package/dist/targets.js +20 -54
- package/dist/targets.js.map +1 -1
- package/dist/tiling.d.ts +114 -0
- package/dist/tiling.js +40 -0
- package/dist/tiling.js.map +1 -0
- package/package.json +6 -2
- package/dist/chunk-AVMZIXGO.js.map +0 -1
- package/dist/chunk-VKB3UWKX.js.map +0 -1
package/dist/dock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dock/constructions.ts"],"sourcesContent":["/**\n * The nine desk constructions, presets built from the parts: a state, the stage size and the options in, a placed\n * rect per item out, plus notes saying how it gave way. How each one gives way when width or height runs out:\n *\n * - Edge docks (`docks`): sections fold to headers (least recently used first), the bottom dock folds to its\n * header, the docks fold to their rails (right first). `docksFull` runs the bottom dock across the full width.\n * - One tiling tree (`tree`): the newest tile that breaks a minimum floats.\n * - Navigator + inspector (`navigator`): the sides fold to icon tabs; height never matters.\n * - Scrolling strip (`strip`): a column whose minimums don't fit splits in two; the strip scrolls to the focus.\n * - Drawers (`drawers`): below a width a drawer slides over the documents instead of pushing them.\n * - Palettes over the documents (`floatOver`), and palettes with the documents tiled around them (`floatAround`):\n * the least recently used shade to their title bars; narrow, the stacks merge in one corner.\n * - Edge docks + tear-off (`dockTear`): as the edge docks, and torn-off panels float (and shade when they don't fit).\n */\nimport { clampInto, rect, type Size } from \"../geometry\";\nimport { columnHeights, share } from \"./arrange\";\nimport {\n DRAWER_DOCK,\n OVER_MARGIN,\n TORN_W,\n TREE_COLUMN,\n accordion,\n aroundDocs,\n bar,\n dockGeometry,\n intoRail,\n paletteArea,\n palettes,\n pill,\n pillBetween,\n plural,\n rail,\n stripGeometry,\n stripMin,\n tabbed,\n tabbedIntoRail,\n tileMin,\n tiles,\n treeArea,\n treeFloats,\n treeRails,\n treeShown,\n treeTiles,\n DOCK,\n type Out,\n} from \"./parts\";\nimport { BAR, G, LAYER, RAIL, TITLE, catalogOf, idOf, isDocKey, panelKey, startState, type Catalog, type DeskSpec, type DeskState, type Layout, type Note, type Options, type Side } from \"./model\";\n\n// --- edge docks (docks, docksFull, dockTear) ------------------------------------------------------------------------\n\nfunction docks(cat: Catalog, s: DeskState, size: { width: number; height: number }, opt: Options, mode: \"between\" | \"full\", notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n const d = dockGeometry(cat, s, size, opt, mode, notes);\n rail(out, \"left\", 0, 0, d.h, s.left);\n rail(out, \"right\", W - RAIL, 0, d.h, d.right);\n let folded = 0;\n if (d.lOpen) folded += accordion(cat, out, s, RAIL + G, G, DOCK - G, d.h - 2 * G, s.left);\n else intoRail(cat, out, 0, 0, DOCK - G, s.left, \"left\");\n if (d.rOpen) folded += accordion(cat, out, s, W - RAIL - DOCK, G, DOCK - G, d.h - 2 * G, d.right);\n else intoRail(cat, out, W - RAIL, 0, DOCK - G, d.right, \"right\");\n if (folded) notes.push({ code: \"sections-folded\", text: `${plural(folded, \"section\", \"sections\")} folded to ${folded > 1 ? \"headers\" : \"a header\"}` });\n // Reserved: the documents end above the bottom dock. Overlay: it floats over the documents' lower part.\n const overlay = opt.bottom === \"overlay\";\n if (d.bottomRect) {\n const b = d.bottomRect;\n const n = s.bottom.length;\n const w = (b.width - G * (n - 1)) / n;\n s.bottom.forEach((id, i) => {\n const open = d.bh > TITLE;\n out.set(panelKey(id), {\n rect: rect(b.x + i * (w + G), b.y, w, b.height),\n look: overlay ? (open ? \"float\" : \"header\") : open ? \"section\" : \"header\",\n layer: overlay ? LAYER.overlay : LAYER.dock,\n accent: true,\n ...(overlay ? { shadow: true } : {}),\n ...(open ? { min: { height: cat.natural(id) } } : {}),\n });\n });\n }\n const docsBottom = d.bottomOn && !overlay ? H - G - d.bh : H;\n const p = pill(opt, d.x0, d.x1 - d.x0, 0, overlay && d.bottomOn ? H - G - d.bh : docsBottom);\n // With the bottom dock floating, the documents run down under it (but never under a reserved bottom pill).\n const bottomOfDocs = overlay && d.bottomOn && !(opt.toolbar === \"bottom\" && opt.toolbarSpace === \"reserved\") ? H - G : p.bottom;\n tiles(out, rect(d.x0, p.top, d.x1 - d.x0, bottomOfDocs - p.top), s.docs);\n out.set(\"toolbar\", p.placed);\n return out;\n}\n\n/** Tear-off: torn-off panels float over the documents; one that doesn't fit the stage's height shades to its title bar. */\nfunction tornOff(cat: Catalog, out: Out, s: DeskState, size: Size, notes: Note[]): void {\n const docRects = [...out.entries()].filter(([k]) => isDocKey(k)).map(([, p]) => p.rect);\n const right = docRects.length ? Math.max(...docRects.map((r) => r.x + r.width)) : size.width / 2;\n const top = docRects.length ? Math.min(...docRects.map((r) => r.y)) : 0;\n let shaded = 0;\n s.torn.forEach((f, i) => {\n const full = cat.natural(f.id);\n const at = f.at ?? { x: right - 12 - TORN_W - 22 * i, y: top + 40 + 22 * i };\n const fits = at.y + full <= size.height - G;\n const shade = s.folded.includes(f.id) || !fits;\n if (!fits && !s.folded.includes(f.id)) shaded++;\n const r = clampInto(rect(at.x, at.y, TORN_W, shade ? TITLE : full), rect(0, 0, size.width, size.height));\n out.set(panelKey(f.id), { rect: r, look: shade ? \"header\" : \"float\", layer: LAYER.float, shadow: true, ...(shade ? {} : { min: { height: full } }) });\n });\n if (s.torn.length) {\n const items = s.torn.map((f) => panelKey(f.id));\n notes.push({ code: \"torn-floating\", items, text: `${items.map(cat.title).join(\", \")} ${items.length > 1 ? \"float\" : \"floats\"}; drop on a dock or its rail icon to dock again` });\n }\n if (shaded) notes.push({ code: \"torn-shaded\", text: `${plural(shaded, \"floating panel\", \"floating panels\")} shaded` });\n}\n\n// --- one tiling tree (tree) --------------------------------------------------------------------------------------------\n\nfunction tree(cat: Catalog, s: DeskState, size: Size, notes: Note[]): Out {\n const out: Out = new Map();\n const area = treeArea(size, s);\n // A column folded to its rail: icons at the stage's edge, its panels hidden into them.\n const rails = treeRails(s);\n for (const side of [\"left\", \"right\"] as const) {\n if (!rails[side]) continue;\n const ids = (side === \"left\" ? s.tree.L : s.tree.R).map(idOf);\n const x = side === \"left\" ? 0 : size.width - RAIL;\n rail(out, side, x, BAR, size.height - BAR, ids);\n intoRail(cat, out, x, BAR, TREE_COLUMN, ids, side);\n }\n if (rails.left || rails.right) {\n const both = rails.left && rails.right;\n const text = `${both ? \"both side columns\" : `the ${rails.left ? \"left\" : \"right\"} column`} folded to ${both ? \"their rails\" : \"its rail\"}`;\n notes.push({ code: \"columns-railed\", text, ...(both ? {} : { side: rails.left ? \"left\" : \"right\" }) });\n }\n const { tree: t, floats } = treeFloats(cat, treeShown(s), area);\n for (const [k, r] of treeTiles(cat, t, area)) out.set(k, { rect: r, look: isDocKey(k) ? \"doc\" : \"tile\", layer: LAYER.doc, min: tileMin(cat, k) });\n floats.forEach((k, i) => {\n const m = isDocKey(k) ? { w: 300, h: 190 } : { w: 200, h: cat.natural(idOf(k)) };\n const r = clampInto(rect(size.width / 2 - m.w / 2 + 22 * i, BAR + 40 + 22 * i, m.w, m.h), rect(0, 0, size.width, size.height));\n out.set(k, { rect: r, look: isDocKey(k) ? \"doc\" : \"float\", layer: LAYER.float, shadow: true });\n });\n if (floats.length) notes.push({ code: \"tiles-float\", items: floats, text: `${plural(floats.length, \"tile floats\", \"tiles float\")} (newest first): ${floats.map(cat.title).join(\", \")}` });\n out.set(\"toolbar\", bar(size.width));\n return out;\n}\n\n/**\n * The tree's start: on a stage too narrow for the documents to tile between the side columns, the columns start folded to\n * their rails (the right one first), then the center's panels join the folded right column, so nothing floats\n * until a rail icon opens a column.\n */\nfunction treeStart(cat: Catalog, docs: readonly number[], size?: Size): DeskState {\n const s = startState(cat, docs);\n if (!size) return s;\n const both = { ...s, closed: [\"right\", \"left\"] as Side[] };\n const panels = s.tree.C.filter((k) => !isDocKey(k));\n const tries: DeskState[] = [s, { ...s, closed: [\"right\"] }, both, { ...both, tree: { ...s.tree, R: [...s.tree.R, ...panels], C: s.tree.C.filter(isDocKey) } }];\n return tries.find((st) => treeFloats(cat, treeShown(st), treeArea(size, st)).floats.length === 0) ?? tries.at(-1)!;\n}\n\n// --- navigator + inspector (navigator), and drawers (drawers) ----------------------------------------------------------------------\n\nconst NAV_L = 240;\nconst NAV_R = 240;\nconst NAV_MIN = 380;\n\nfunction navigator(cat: Catalog, s: DeskState, size: Size, opt: Options, notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n let lw = s.left.length ? NAV_L : 0;\n let rw = s.right.length ? NAV_R : 0;\n if (rw && W - lw - rw < NAV_MIN) {\n rw = RAIL;\n notes.push({ code: \"tabs-folded\", side: \"right\", text: \"inspector folded to icon tabs\" });\n }\n if (lw && W - lw - rw < NAV_MIN) {\n lw = RAIL;\n notes.push({ code: \"tabs-folded\", side: \"left\", text: \"navigator folded to icon tabs\" });\n }\n const side = (sd: Side, x: number, w: number, full: number, ids: readonly number[]): void => {\n if (w === RAIL) {\n rail(out, sd, x, 0, H, ids);\n tabbedIntoRail(cat, out, sd, ids, x, 0, full);\n } else if (w > 0) {\n rail(out, sd, sd === \"left\" ? x : x + w - RAIL, 0, H, ids, true);\n tabbed(out, sd, ids, s.active[sd], x, 0, w, H, false);\n }\n };\n side(\"left\", 0, lw, NAV_L, s.left);\n side(\"right\", W - rw, rw, NAV_R, s.right);\n const cx = lw + G;\n const cw = W - lw - rw - 2 * G;\n const p = pill(opt, cx, cw, 0, H);\n tiles(out, rect(cx, p.top, cw, p.bottom - p.top), s.docs);\n out.set(\"toolbar\", p.placed);\n return out;\n}\n\nconst DRAWER_L = 240;\nconst DRAWER_R = 240;\n\nfunction drawers(cat: Catalog, s: DeskState, size: Size, notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n const y = BAR;\n const h = H - BAR;\n const rDocked = W >= DRAWER_DOCK.right;\n const lDocked = W >= DRAWER_DOCK.left;\n const lOpen = s.left.length > 0 && !s.closed.includes(\"left\");\n const rOpen = s.right.length > 0 && !s.closed.includes(\"right\");\n if (!rDocked && rOpen) notes.push({ code: \"drawer-over\", side: \"right\", text: \"right drawer slides over the documents\" });\n if (!lDocked && lOpen) notes.push({ code: \"drawer-over\", side: \"left\", text: rDocked || !rOpen ? \"left drawer slides over the documents\" : \"left drawer slides over too\" });\n rail(out, \"left\", 0, y, h, s.left);\n rail(out, \"right\", W - RAIL, y, h, s.right);\n const x0 = RAIL + (lDocked && lOpen ? DRAWER_L : 0) + G;\n const x1 = W - RAIL - (rDocked && rOpen ? DRAWER_R : 0) - G;\n tiles(out, rect(x0, y + G, x1 - x0, h - 2 * G), s.docs);\n // Both sliding over a stage too narrow for the two side by side: each takes half the room between the rails.\n const both = !lDocked && !rDocked && lOpen && rOpen;\n const half = (W - 2 * RAIL - G) / 2;\n const lw = both ? Math.min(DRAWER_L, half) : DRAWER_L;\n const rw = both ? Math.min(DRAWER_R, half) : DRAWER_R;\n if (lOpen) tabbed(out, \"left\", s.left, s.active.left, RAIL, y, lw, h, !lDocked);\n else tabbedIntoRail(cat, out, \"left\", s.left, 0, y, DRAWER_L);\n if (rOpen) tabbed(out, \"right\", s.right, s.active.right, W - RAIL - rw, y, rw, h, !rDocked);\n else tabbedIntoRail(cat, out, \"right\", s.right, W - RAIL, y, DRAWER_R);\n out.set(\"toolbar\", bar(W));\n return out;\n}\n\n// --- scrolling strip (strip) --------------------------------------------------------------------------------------------\n\nfunction strip(cat: Catalog, s: DeskState, size: Size, notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n const g = stripGeometry(cat, s, size, notes);\n g.cols.forEach((c, ci) => {\n // A column of panels: each at its natural height, the last taking the rest; documents share as before.\n const mins = c.map((k) => stripMin(cat, k));\n const heights = c.some(isDocKey) ? share(g.h - G * (c.length - 1), mins) : columnHeights(g.h, mins, G);\n let cy = g.y;\n c.forEach((k, i) => {\n out.set(k, { rect: rect(g.xs[ci]!, cy, g.widths[ci]!, heights[i]!), look: isDocKey(k) ? \"doc\" : \"tile\", layer: LAYER.doc, offStage: true, min: { width: g.widths[ci]!, height: mins[i]! } });\n cy += heights[i]! + G;\n });\n });\n const scrolls = g.total > W;\n if (scrolls) notes.push({ code: \"strip-scrolls\", text: `the strip is ${Math.round(g.total)} wide: ${Math.round(g.total - W)} px off screen, reached by scrolling` });\n out.set(\"track\", { rect: rect(0, H - 5, W, 5), look: \"track\", layer: LAYER.toolbar, ...(scrolls ? {} : { hidden: true }) });\n const tw = scrolls ? (W / g.total) * W : W;\n out.set(\"thumb\", { rect: rect(scrolls ? (g.scroll / g.total) * W : 0, H - 5, tw, 5), look: \"thumb\", layer: LAYER.toolbar, ...(scrolls ? {} : { hidden: true }) });\n out.set(\"toolbar\", bar(W));\n return out;\n}\n\n// --- floating palettes (floatOver, floatAround) --------------------------------------------------------------------\n\nfunction floatOver(cat: Catalog, s: DeskState, size: Size, opt: Options, notes: Note[]): Out {\n const out: Out = new Map();\n const { area } = paletteArea(size, opt);\n const pals = palettes(cat, s, area, size.width, OVER_MARGIN, notes);\n const tb = pillBetween(opt, size, [...pals.values()].map((p) => p.rect));\n tiles(out, area, s.docs);\n let covered = 0;\n for (const [id, p] of pals) {\n out.set(panelKey(id), { rect: p.rect, look: p.shaded ? \"header\" : \"float\", layer: LAYER.float, shadow: true, ...(p.shaded ? {} : { min: { height: cat.natural(id) } }) });\n covered += p.rect.width * p.rect.height;\n }\n notes.push({ code: \"palettes-cover\", text: `palettes cover ${Math.round((covered / (area.width * area.height)) * 100)}% of the documents` });\n out.set(\"toolbar\", tb);\n return out;\n}\n\nfunction floatAround(cat: Catalog, s: DeskState, size: Size, opt: Options, notes: Note[]): Out {\n const out: Out = new Map();\n const { area } = paletteArea(size, opt);\n const pals = palettes(cat, s, area, size.width, 0, notes);\n const tb = pillBetween(opt, size, [...pals.values()].map((p) => p.rect));\n const docsRect = aroundDocs(pals, area);\n tiles(out, docsRect, s.docs);\n let used = docsRect.width * docsRect.height;\n for (const [id, p] of pals) {\n out.set(panelKey(id), { rect: p.rect, look: p.shaded ? \"header\" : \"palette\", layer: LAYER.palette, shadow: true, ...(p.shaded ? {} : { min: { height: cat.natural(id) } }) });\n used += p.rect.width * p.rect.height;\n }\n notes.push({ code: \"docs-room\", text: `documents get ${Math.round(docsRect.width)} px of width; ${Math.max(0, Math.round((1 - used / (area.width * area.height)) * 100))}% of the desk stays empty under short stacks` });\n out.set(\"toolbar\", tb);\n return out;\n}\n\n// --- the presets ---------------------------------------------------------------------------------------------------\n\nexport type ConstructionId = \"docks\" | \"docksFull\" | \"tree\" | \"navigator\" | \"strip\" | \"drawers\" | \"floatOver\" | \"floatAround\" | \"dockTear\";\n\nexport interface Construction {\n readonly id: ConstructionId;\n readonly title: string;\n readonly idea: string;\n /** It has a floating toolbar pill (top or bottom, reserved or overlay). */\n readonly pill: boolean;\n /** It has a bottom dock (reserved, floating or off). */\n readonly bottom: boolean;\n /** The arrangement it starts from (at this stage size, when it depends on one). */\n readonly initial: (docs: readonly number[], size?: Size) => DeskState;\n readonly layout: (s: DeskState, size: Size, opt: Options) => Layout;\n /** The desk it belongs to (its catalog). */\n readonly desk: Desk;\n}\n\n/** A desk: the catalog, its nine constructions, and the catalog-bound helpers. */\nexport interface Desk {\n readonly catalog: Catalog;\n readonly constructions: readonly Construction[];\n readonly constructionOf: (id: ConstructionId) => Construction;\n /** The arrangement every construction starts from, with these documents open (none by default). */\n readonly initialState: (docs?: readonly number[]) => DeskState;\n readonly natural: (id: number) => number;\n readonly titleOf: (key: string) => string;\n}\n\ntype LayoutFn = (s: DeskState, size: Size, opt: Options, notes: Note[]) => Out;\n\nconst withNotes = (f: LayoutFn) => (s: DeskState, size: Size, opt: Options): Layout => {\n const notes: Note[] = [];\n const items = f(s, size, opt, notes);\n return { items, notes };\n};\n\n/**\n * A desk for these panels: the nine constructions as presets, each a pure layout over the shared state.\n *\n * ```ts\n * const desk = createDesk({ panels: [{ id: 1, title: \"Files\", natural: 160 }], start: { left: [1], right: [], bottom: [] } });\n * const c = desk.constructionOf(\"docks\");\n * const { items, notes } = c.layout(c.initial([1, 2]), { width: 960, height: 560 }, DEFAULT_OPTIONS);\n * ```\n */\nexport function createDesk(spec: DeskSpec): Desk {\n const cat = catalogOf(spec);\n const initial = (docs?: readonly number[]): DeskState => startState(cat, docs);\n const sides = (patch: (s: DeskState) => Partial<DeskState>) => (docs: readonly number[]): DeskState => {\n const s = startState(cat, docs);\n return { ...s, ...patch(s) };\n };\n // Navigator and drawers have no bottom dock: its panels join the right side.\n const noBottom = sides((s) => ({ right: [...s.right, ...s.bottom], bottom: [] }));\n const plain = sides(() => ({}));\n const list: Omit<Construction, \"desk\">[] = [\n {\n id: \"docks\",\n title: \"Edge docks\",\n idea: \"Each side is a dock with a rail of icons; its panels are accordion sections. Short on height, the least recently used fold to headers; short on width, a whole dock folds to its rail (right first). The bottom dock sits between the side docks.\",\n pill: true,\n bottom: true,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => docks(cat, s, size, opt, \"between\", notes)),\n },\n {\n id: \"docksFull\",\n title: \"Edge docks, full-width bottom dock\",\n idea: \"As the edge docks, except the bottom dock runs under everything across the full width; the side docks and their rails stop above it, so they fold sooner.\",\n pill: true,\n bottom: true,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => docks(cat, s, size, opt, \"full\", notes)),\n },\n {\n id: \"tree\",\n title: \"One tiling tree\",\n idea: \"Panels and documents are tiles of one tree, so a panel can sit beside a document. One rule for all: the newest tile that breaks a minimum floats. Opened on a narrow stage, the side columns start folded to rails at its edges.\",\n pill: false,\n bottom: false,\n initial: (docs, size) => treeStart(cat, docs, size),\n layout: withNotes((s, size, _opt, notes) => tree(cat, s, size, notes)),\n },\n {\n id: \"navigator\",\n title: \"Navigator + inspector\",\n idea: \"A fixed left and right side, one panel showing per side (tabs); the toolbar floats over the canvas. Narrow, the sides fold to icon tabs. Height never matters.\",\n pill: true,\n bottom: false,\n initial: noBottom,\n layout: withNotes((s, size, opt, notes) => navigator(cat, s, size, opt, notes)),\n },\n {\n id: \"strip\",\n title: \"Scrolling strip\",\n idea: \"Panels and documents are columns of a strip wider than the screen; nothing shrinks below its minimum, the view scrolls to the focus instead. Short on height, a column splits in two.\",\n pill: false,\n bottom: false,\n initial: plain,\n layout: withNotes((s, size, _opt, notes) => strip(cat, s, size, notes)),\n },\n {\n id: \"drawers\",\n title: \"Drawers\",\n idea: \"Documents take the screen; each side is a drawer with tabs. Wide, the drawers dock and push; narrow, they slide over the documents.\",\n pill: false,\n bottom: false,\n initial: noBottom,\n layout: withNotes((s, size, _opt, notes) => drawers(cat, s, size, notes)),\n },\n {\n id: \"floatOver\",\n title: \"Floating palettes over the documents\",\n idea: \"Documents take the whole desk; panels are palettes floating over them at their natural size, stacked in the top corners and draggable anywhere. Short on height, the least recently used shade to their title bars; the documents never move.\",\n pill: true,\n bottom: false,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => floatOver(cat, s, size, opt, notes)),\n },\n {\n id: \"floatAround\",\n title: \"Floating palettes, documents tile around\",\n idea: \"Palettes float at their natural size but reserve their footprint: the documents tile in the space between them. Nothing is covered; the space under a short stack stays empty.\",\n pill: true,\n bottom: false,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => floatAround(cat, s, size, opt, notes)),\n },\n {\n id: \"dockTear\",\n title: \"Edge docks + tear-off\",\n idea: \"The edge docks, and any panel can be torn off to float over the documents and dropped back on a dock or its rail icon. Docked is the default; floating is the exception you choose.\",\n pill: true,\n bottom: true,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => {\n const out = docks(cat, s, size, opt, \"between\", notes);\n tornOff(cat, out, s, size, notes);\n return out;\n }),\n },\n ];\n const constructions: Construction[] = [];\n const desk: Desk = {\n catalog: cat,\n constructions,\n constructionOf: (id) => constructions.find((c) => c.id === id)!,\n initialState: initial,\n natural: cat.natural,\n titleOf: cat.title,\n };\n constructions.push(...list.map((c) => ({ ...c, desk })));\n return desk;\n}\n\n/** Which items a construction lets the pointer drag: panels everywhere, documents in the tree and the strip. */\nexport const draggable = (c: Construction, key: string): boolean => key.startsWith(\"panel:\") || (key.startsWith(\"doc:\") && (c.id === \"tree\" || c.id === \"strip\"));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,MAAM,KAAc,GAAc,MAAyC,KAAc,MAA0B,OAAoB;AAC9I,QAAM,MAAW,oBAAI,IAAI;AACzB,QAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,IAAI;AAChC,QAAM,IAAI,aAAa,KAAK,GAAG,MAAM,KAAK,MAAM,KAAK;AACrD,OAAK,KAAK,QAAQ,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI;AACnC,OAAK,KAAK,SAAS,IAAI,MAAM,GAAG,EAAE,GAAG,EAAE,KAAK;AAC5C,MAAI,SAAS;AACb,MAAI,EAAE,MA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BAAc,KAAK,GAAG,KAAK,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,KAAK,EAAE,CAAC;AACvD,SAAO;AACT;AAGO,IAAM,YAAY,CAAC,GAAiB,QAAyB,IAAI,WAAW,QAAQ,KAAM,IAAI,WAAW,MAAM,MAAM,EAAE,OAAO,UAAU,EAAE,OAAO;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/dock/constructions.ts"],"sourcesContent":["/**\n * The nine desk constructions, presets built from the parts: a state, the stage size and the options in, a placed\n * rect per item out, plus notes saying how it gave way. How each one gives way when width or height runs out:\n *\n * - Edge docks (`docks`): sections fold to headers (least recently used first), the bottom dock folds to its\n * header, the docks fold to their rails (right first). `docksFull` runs the bottom dock across the full width.\n * - One tiling tree (`tree`): the newest tile that breaks a minimum floats.\n * - Navigator + inspector (`navigator`): the sides fold to icon tabs; height never matters.\n * - Scrolling strip (`strip`): a column whose minimums don't fit splits in two; the strip scrolls to the focus.\n * - Drawers (`drawers`): below a width a drawer slides over the documents instead of pushing them.\n * - Palettes over the documents (`floatOver`), and palettes with the documents tiled around them (`floatAround`):\n * the least recently used shade to their title bars; narrow, the stacks merge in one corner.\n * - Edge docks + tear-off (`dockTear`): as the edge docks, and torn-off panels float (and shade when they don't fit).\n */\nimport { clampInto, rect, type Size } from \"../geometry\";\nimport { columnHeights, share } from \"./arrange\";\nimport {\n DRAWER_DOCK,\n OVER_MARGIN,\n TORN_W,\n TREE_COLUMN,\n accordion,\n aroundDocs,\n bar,\n dockGeometry,\n intoRail,\n paletteArea,\n palettes,\n pill,\n pillBetween,\n plural,\n rail,\n stripGeometry,\n stripMin,\n tabbed,\n tabbedIntoRail,\n tileMin,\n tiles,\n treeArea,\n treeFloats,\n treeRails,\n treeShown,\n treeTiles,\n DOCK,\n type Out,\n} from \"./parts\";\nimport { BAR, G, LAYER, RAIL, TITLE, catalogOf, idOf, isDocKey, panelKey, startState, type Catalog, type DeskSpec, type DeskState, type Layout, type Note, type Options, type Side } from \"./model\";\n\n// --- edge docks (docks, docksFull, dockTear) ------------------------------------------------------------------------\n\nfunction docks(cat: Catalog, s: DeskState, size: { width: number; height: number }, opt: Options, mode: \"between\" | \"full\", notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n const d = dockGeometry(cat, s, size, opt, mode, notes);\n rail(out, \"left\", 0, 0, d.h, s.left);\n rail(out, \"right\", W - RAIL, 0, d.h, d.right);\n let folded = 0;\n if (d.lOpen) folded += accordion(cat, out, s, RAIL + G, G, DOCK - G, d.h - 2 * G, s.left);\n else intoRail(cat, out, 0, 0, DOCK - G, s.left, \"left\");\n if (d.rOpen) folded += accordion(cat, out, s, W - RAIL - DOCK, G, DOCK - G, d.h - 2 * G, d.right);\n else intoRail(cat, out, W - RAIL, 0, DOCK - G, d.right, \"right\");\n if (folded) notes.push({ code: \"sections-folded\", text: `${plural(folded, \"section\", \"sections\")} folded to ${folded > 1 ? \"headers\" : \"a header\"}` });\n // Reserved: the documents end above the bottom dock. Overlay: it floats over the documents' lower part.\n const overlay = opt.bottom === \"overlay\";\n if (d.bottomRect) {\n const b = d.bottomRect;\n const n = s.bottom.length;\n const w = (b.width - G * (n - 1)) / n;\n s.bottom.forEach((id, i) => {\n const open = d.bh > TITLE;\n out.set(panelKey(id), {\n rect: rect(b.x + i * (w + G), b.y, w, b.height),\n look: overlay ? (open ? \"float\" : \"header\") : open ? \"section\" : \"header\",\n layer: overlay ? LAYER.overlay : LAYER.dock,\n accent: true,\n ...(overlay ? { shadow: true } : {}),\n ...(open ? { min: { height: cat.natural(id) } } : {}),\n });\n });\n }\n const docsBottom = d.bottomOn && !overlay ? H - G - d.bh : H;\n const p = pill(opt, d.x0, d.x1 - d.x0, 0, overlay && d.bottomOn ? H - G - d.bh : docsBottom);\n // With the bottom dock floating, the documents run down under it (but never under a reserved bottom pill).\n const bottomOfDocs = overlay && d.bottomOn && !(opt.toolbar === \"bottom\" && opt.toolbarSpace === \"reserved\") ? H - G : p.bottom;\n tiles(out, rect(d.x0, p.top, d.x1 - d.x0, bottomOfDocs - p.top), s.docs);\n out.set(\"toolbar\", p.placed);\n return out;\n}\n\n/** Tear-off: torn-off panels float over the documents; one that doesn't fit the stage's height shades to its title bar. */\nfunction tornOff(cat: Catalog, out: Out, s: DeskState, size: Size, notes: Note[]): void {\n const docRects = [...out.entries()].filter(([k]) => isDocKey(k)).map(([, p]) => p.rect);\n const right = docRects.length ? Math.max(...docRects.map((r) => r.x + r.width)) : size.width / 2;\n const top = docRects.length ? Math.min(...docRects.map((r) => r.y)) : 0;\n let shaded = 0;\n s.torn.forEach((f, i) => {\n const full = cat.natural(f.id);\n const at = f.at ?? { x: right - 12 - TORN_W - 22 * i, y: top + 40 + 22 * i };\n const fits = at.y + full <= size.height - G;\n const shade = s.folded.includes(f.id) || !fits;\n if (!fits && !s.folded.includes(f.id)) shaded++;\n const r = clampInto(rect(at.x, at.y, TORN_W, shade ? TITLE : full), rect(0, 0, size.width, size.height));\n out.set(panelKey(f.id), { rect: r, look: shade ? \"header\" : \"float\", layer: LAYER.float, shadow: true, ...(shade ? {} : { min: { height: full } }) });\n });\n if (s.torn.length) {\n const items = s.torn.map((f) => panelKey(f.id));\n notes.push({ code: \"torn-floating\", items, text: `${items.map(cat.title).join(\", \")} ${items.length > 1 ? \"float\" : \"floats\"}; drop on a dock or its rail icon to dock again` });\n }\n if (shaded) notes.push({ code: \"torn-shaded\", text: `${plural(shaded, \"floating panel\", \"floating panels\")} shaded` });\n}\n\n// --- one tiling tree (tree) --------------------------------------------------------------------------------------------\n\nfunction tree(cat: Catalog, s: DeskState, size: Size, notes: Note[]): Out {\n const out: Out = new Map();\n const area = treeArea(size, s);\n // A column folded to its rail: icons at the stage's edge, its panels hidden into them.\n const rails = treeRails(s);\n for (const side of [\"left\", \"right\"] as const) {\n if (!rails[side]) continue;\n const ids = (side === \"left\" ? s.tree.L : s.tree.R).map(idOf);\n const x = side === \"left\" ? 0 : size.width - RAIL;\n rail(out, side, x, BAR, size.height - BAR, ids);\n intoRail(cat, out, x, BAR, TREE_COLUMN, ids, side);\n }\n if (rails.left || rails.right) {\n const both = rails.left && rails.right;\n const text = `${both ? \"both side columns\" : `the ${rails.left ? \"left\" : \"right\"} column`} folded to ${both ? \"their rails\" : \"its rail\"}`;\n notes.push({ code: \"columns-railed\", text, ...(both ? {} : { side: rails.left ? \"left\" : \"right\" }) });\n }\n const { tree: t, floats } = treeFloats(cat, treeShown(s), area);\n for (const [k, r] of treeTiles(cat, t, area)) out.set(k, { rect: r, look: isDocKey(k) ? \"doc\" : \"tile\", layer: LAYER.doc, min: tileMin(cat, k) });\n floats.forEach((k, i) => {\n const m = isDocKey(k) ? { w: 300, h: 190 } : { w: 200, h: cat.natural(idOf(k)) };\n const r = clampInto(rect(size.width / 2 - m.w / 2 + 22 * i, BAR + 40 + 22 * i, m.w, m.h), rect(0, 0, size.width, size.height));\n out.set(k, { rect: r, look: isDocKey(k) ? \"doc\" : \"float\", layer: LAYER.float, shadow: true });\n });\n if (floats.length) notes.push({ code: \"tiles-float\", items: floats, text: `${plural(floats.length, \"tile floats\", \"tiles float\")} (newest first): ${floats.map(cat.title).join(\", \")}` });\n out.set(\"toolbar\", bar(size.width));\n return out;\n}\n\n/**\n * The tree's start: on a stage too narrow for the documents to tile between the side columns, the columns start folded to\n * their rails (the right one first), then the center's panels join the folded right column, so nothing floats\n * until a rail icon opens a column.\n */\nfunction treeStart(cat: Catalog, docs: readonly number[], size?: Size): DeskState {\n const s = startState(cat, docs);\n if (!size) return s;\n const both = { ...s, closed: [\"right\", \"left\"] as Side[] };\n const panels = s.tree.C.filter((k) => !isDocKey(k));\n const tries: DeskState[] = [s, { ...s, closed: [\"right\"] }, both, { ...both, tree: { ...s.tree, R: [...s.tree.R, ...panels], C: s.tree.C.filter(isDocKey) } }];\n return tries.find((st) => treeFloats(cat, treeShown(st), treeArea(size, st)).floats.length === 0) ?? tries.at(-1)!;\n}\n\n// --- navigator + inspector (navigator), and drawers (drawers) ----------------------------------------------------------------------\n\nconst NAV_L = 240;\nconst NAV_R = 240;\nconst NAV_MIN = 380;\n\nfunction navigator(cat: Catalog, s: DeskState, size: Size, opt: Options, notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n let lw = s.left.length ? NAV_L : 0;\n let rw = s.right.length ? NAV_R : 0;\n if (rw && W - lw - rw < NAV_MIN) {\n rw = RAIL;\n notes.push({ code: \"tabs-folded\", side: \"right\", text: \"inspector folded to icon tabs\" });\n }\n if (lw && W - lw - rw < NAV_MIN) {\n lw = RAIL;\n notes.push({ code: \"tabs-folded\", side: \"left\", text: \"navigator folded to icon tabs\" });\n }\n const side = (sd: Side, x: number, w: number, full: number, ids: readonly number[]): void => {\n if (w === RAIL) {\n rail(out, sd, x, 0, H, ids);\n tabbedIntoRail(cat, out, sd, ids, x, 0, full);\n } else if (w > 0) {\n rail(out, sd, sd === \"left\" ? x : x + w - RAIL, 0, H, ids, true);\n tabbed(out, sd, ids, s.active[sd], x, 0, w, H, false);\n }\n };\n side(\"left\", 0, lw, NAV_L, s.left);\n side(\"right\", W - rw, rw, NAV_R, s.right);\n const cx = lw + G;\n const cw = W - lw - rw - 2 * G;\n const p = pill(opt, cx, cw, 0, H);\n tiles(out, rect(cx, p.top, cw, p.bottom - p.top), s.docs);\n out.set(\"toolbar\", p.placed);\n return out;\n}\n\nconst DRAWER_L = 240;\nconst DRAWER_R = 240;\n\nfunction drawers(cat: Catalog, s: DeskState, size: Size, notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n const y = BAR;\n const h = H - BAR;\n const rDocked = W >= DRAWER_DOCK.right;\n const lDocked = W >= DRAWER_DOCK.left;\n const lOpen = s.left.length > 0 && !s.closed.includes(\"left\");\n const rOpen = s.right.length > 0 && !s.closed.includes(\"right\");\n if (!rDocked && rOpen) notes.push({ code: \"drawer-over\", side: \"right\", text: \"right drawer slides over the documents\" });\n if (!lDocked && lOpen) notes.push({ code: \"drawer-over\", side: \"left\", text: rDocked || !rOpen ? \"left drawer slides over the documents\" : \"left drawer slides over too\" });\n rail(out, \"left\", 0, y, h, s.left);\n rail(out, \"right\", W - RAIL, y, h, s.right);\n const x0 = RAIL + (lDocked && lOpen ? DRAWER_L : 0) + G;\n const x1 = W - RAIL - (rDocked && rOpen ? DRAWER_R : 0) - G;\n tiles(out, rect(x0, y + G, x1 - x0, h - 2 * G), s.docs);\n // Both sliding over a stage too narrow for the two side by side: each takes half the room between the rails.\n const both = !lDocked && !rDocked && lOpen && rOpen;\n const half = (W - 2 * RAIL - G) / 2;\n const lw = both ? Math.min(DRAWER_L, half) : DRAWER_L;\n const rw = both ? Math.min(DRAWER_R, half) : DRAWER_R;\n if (lOpen) tabbed(out, \"left\", s.left, s.active.left, RAIL, y, lw, h, !lDocked);\n else tabbedIntoRail(cat, out, \"left\", s.left, 0, y, DRAWER_L);\n if (rOpen) tabbed(out, \"right\", s.right, s.active.right, W - RAIL - rw, y, rw, h, !rDocked);\n else tabbedIntoRail(cat, out, \"right\", s.right, W - RAIL, y, DRAWER_R);\n out.set(\"toolbar\", bar(W));\n return out;\n}\n\n// --- scrolling strip (strip) --------------------------------------------------------------------------------------------\n\nfunction strip(cat: Catalog, s: DeskState, size: Size, notes: Note[]): Out {\n const out: Out = new Map();\n const { width: W, height: H } = size;\n const g = stripGeometry(cat, s, size, notes);\n g.cols.forEach((c, ci) => {\n // A column of panels: each at its natural height, the last taking the rest; documents share as before.\n const mins = c.map((k) => stripMin(cat, k));\n const heights = c.some(isDocKey) ? share(g.h - G * (c.length - 1), mins) : columnHeights(g.h, mins, G);\n let cy = g.y;\n c.forEach((k, i) => {\n out.set(k, { rect: rect(g.xs[ci]!, cy, g.widths[ci]!, heights[i]!), look: isDocKey(k) ? \"doc\" : \"tile\", layer: LAYER.doc, offStage: true, min: { width: g.widths[ci]!, height: mins[i]! } });\n cy += heights[i]! + G;\n });\n });\n const scrolls = g.total > W;\n if (scrolls) notes.push({ code: \"strip-scrolls\", text: `the strip is ${Math.round(g.total)} wide: ${Math.round(g.total - W)} px off screen, reached by scrolling` });\n out.set(\"track\", { rect: rect(0, H - 5, W, 5), look: \"track\", layer: LAYER.toolbar, ...(scrolls ? {} : { hidden: true }) });\n const tw = scrolls ? (W / g.total) * W : W;\n out.set(\"thumb\", { rect: rect(scrolls ? (g.scroll / g.total) * W : 0, H - 5, tw, 5), look: \"thumb\", layer: LAYER.toolbar, ...(scrolls ? {} : { hidden: true }) });\n out.set(\"toolbar\", bar(W));\n return out;\n}\n\n// --- floating palettes (floatOver, floatAround) --------------------------------------------------------------------\n\nfunction floatOver(cat: Catalog, s: DeskState, size: Size, opt: Options, notes: Note[]): Out {\n const out: Out = new Map();\n const { area } = paletteArea(size, opt);\n const pals = palettes(cat, s, area, size.width, OVER_MARGIN, notes);\n const tb = pillBetween(opt, size, [...pals.values()].map((p) => p.rect));\n tiles(out, area, s.docs);\n let covered = 0;\n for (const [id, p] of pals) {\n out.set(panelKey(id), { rect: p.rect, look: p.shaded ? \"header\" : \"float\", layer: LAYER.float, shadow: true, ...(p.shaded ? {} : { min: { height: cat.natural(id) } }) });\n covered += p.rect.width * p.rect.height;\n }\n notes.push({ code: \"palettes-cover\", text: `palettes cover ${Math.round((covered / (area.width * area.height)) * 100)}% of the documents` });\n out.set(\"toolbar\", tb);\n return out;\n}\n\nfunction floatAround(cat: Catalog, s: DeskState, size: Size, opt: Options, notes: Note[]): Out {\n const out: Out = new Map();\n const { area } = paletteArea(size, opt);\n const pals = palettes(cat, s, area, size.width, 0, notes);\n const tb = pillBetween(opt, size, [...pals.values()].map((p) => p.rect));\n const docsRect = aroundDocs(pals, area);\n tiles(out, docsRect, s.docs);\n let used = docsRect.width * docsRect.height;\n for (const [id, p] of pals) {\n out.set(panelKey(id), { rect: p.rect, look: p.shaded ? \"header\" : \"palette\", layer: LAYER.palette, shadow: true, ...(p.shaded ? {} : { min: { height: cat.natural(id) } }) });\n used += p.rect.width * p.rect.height;\n }\n notes.push({ code: \"docs-room\", text: `documents get ${Math.round(docsRect.width)} px of width; ${Math.max(0, Math.round((1 - used / (area.width * area.height)) * 100))}% of the desk stays empty under short stacks` });\n out.set(\"toolbar\", tb);\n return out;\n}\n\n// --- the presets ---------------------------------------------------------------------------------------------------\n\nexport type ConstructionId = \"docks\" | \"docksFull\" | \"tree\" | \"navigator\" | \"strip\" | \"drawers\" | \"floatOver\" | \"floatAround\" | \"dockTear\";\n\nexport interface Construction {\n readonly id: ConstructionId;\n readonly title: string;\n readonly idea: string;\n /** It has a floating toolbar pill (top or bottom, reserved or overlay). */\n readonly pill: boolean;\n /** It has a bottom dock (reserved, floating or off). */\n readonly bottom: boolean;\n /** The arrangement it starts from (at this stage size, when it depends on one). */\n readonly initial: (docs: readonly number[], size?: Size) => DeskState;\n readonly layout: (s: DeskState, size: Size, opt: Options) => Layout;\n /** The desk it belongs to (its catalog). */\n readonly desk: Desk;\n}\n\n/** A desk: the catalog, its nine constructions, and the catalog-bound helpers. */\nexport interface Desk {\n readonly catalog: Catalog;\n readonly constructions: readonly Construction[];\n readonly constructionOf: (id: ConstructionId) => Construction;\n /** The arrangement every construction starts from, with these documents open (none by default). */\n readonly initialState: (docs?: readonly number[]) => DeskState;\n readonly natural: (id: number) => number;\n readonly titleOf: (key: string) => string;\n}\n\ntype LayoutFn = (s: DeskState, size: Size, opt: Options, notes: Note[]) => Out;\n\nconst withNotes = (f: LayoutFn) => (s: DeskState, size: Size, opt: Options): Layout => {\n const notes: Note[] = [];\n const items = f(s, size, opt, notes);\n return { items, notes };\n};\n\n/**\n * A desk for these panels: the nine constructions as presets, each a pure layout over the shared state.\n *\n * ```ts\n * const desk = createDesk({ panels: [{ id: 1, title: \"Files\", natural: 160 }], start: { left: [1], right: [], bottom: [] } });\n * const c = desk.constructionOf(\"docks\");\n * const { items, notes } = c.layout(c.initial([1, 2]), { width: 960, height: 560 }, DEFAULT_OPTIONS);\n * ```\n */\nexport function createDesk(spec: DeskSpec): Desk {\n const cat = catalogOf(spec);\n const initial = (docs?: readonly number[]): DeskState => startState(cat, docs);\n const sides = (patch: (s: DeskState) => Partial<DeskState>) => (docs: readonly number[]): DeskState => {\n const s = startState(cat, docs);\n return { ...s, ...patch(s) };\n };\n // Navigator and drawers have no bottom dock: its panels join the right side.\n const noBottom = sides((s) => ({ right: [...s.right, ...s.bottom], bottom: [] }));\n const plain = sides(() => ({}));\n const list: Omit<Construction, \"desk\">[] = [\n {\n id: \"docks\",\n title: \"Edge docks\",\n idea: \"Each side is a dock with a rail of icons; its panels are accordion sections. Short on height, the least recently used fold to headers; short on width, a whole dock folds to its rail (right first). The bottom dock sits between the side docks.\",\n pill: true,\n bottom: true,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => docks(cat, s, size, opt, \"between\", notes)),\n },\n {\n id: \"docksFull\",\n title: \"Edge docks, full-width bottom dock\",\n idea: \"As the edge docks, except the bottom dock runs under everything across the full width; the side docks and their rails stop above it, so they fold sooner.\",\n pill: true,\n bottom: true,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => docks(cat, s, size, opt, \"full\", notes)),\n },\n {\n id: \"tree\",\n title: \"One tiling tree\",\n idea: \"Panels and documents are tiles of one tree, so a panel can sit beside a document. One rule for all: the newest tile that breaks a minimum floats. Opened on a narrow stage, the side columns start folded to rails at its edges.\",\n pill: false,\n bottom: false,\n initial: (docs, size) => treeStart(cat, docs, size),\n layout: withNotes((s, size, _opt, notes) => tree(cat, s, size, notes)),\n },\n {\n id: \"navigator\",\n title: \"Navigator + inspector\",\n idea: \"A fixed left and right side, one panel showing per side (tabs); the toolbar floats over the canvas. Narrow, the sides fold to icon tabs. Height never matters.\",\n pill: true,\n bottom: false,\n initial: noBottom,\n layout: withNotes((s, size, opt, notes) => navigator(cat, s, size, opt, notes)),\n },\n {\n id: \"strip\",\n title: \"Scrolling strip\",\n idea: \"Panels and documents are columns of a strip wider than the screen; nothing shrinks below its minimum, the view scrolls to the focus instead. Short on height, a column splits in two.\",\n pill: false,\n bottom: false,\n initial: plain,\n layout: withNotes((s, size, _opt, notes) => strip(cat, s, size, notes)),\n },\n {\n id: \"drawers\",\n title: \"Drawers\",\n idea: \"Documents take the screen; each side is a drawer with tabs. Wide, the drawers dock and push; narrow, they slide over the documents.\",\n pill: false,\n bottom: false,\n initial: noBottom,\n layout: withNotes((s, size, _opt, notes) => drawers(cat, s, size, notes)),\n },\n {\n id: \"floatOver\",\n title: \"Floating palettes over the documents\",\n idea: \"Documents take the whole desk; panels are palettes floating over them at their natural size, stacked in the top corners and draggable anywhere. Short on height, the least recently used shade to their title bars; the documents never move.\",\n pill: true,\n bottom: false,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => floatOver(cat, s, size, opt, notes)),\n },\n {\n id: \"floatAround\",\n title: \"Floating palettes, documents tile around\",\n idea: \"Palettes float at their natural size but reserve their footprint: the documents tile in the space between them. Nothing is covered; the space under a short stack stays empty.\",\n pill: true,\n bottom: false,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => floatAround(cat, s, size, opt, notes)),\n },\n {\n id: \"dockTear\",\n title: \"Edge docks + tear-off\",\n idea: \"The edge docks, and any panel can be torn off to float over the documents and dropped back on a dock or its rail icon. Docked is the default; floating is the exception you choose.\",\n pill: true,\n bottom: true,\n initial: plain,\n layout: withNotes((s, size, opt, notes) => {\n const out = docks(cat, s, size, opt, \"between\", notes);\n tornOff(cat, out, s, size, notes);\n return out;\n }),\n },\n ];\n const constructions: Construction[] = [];\n const desk: Desk = {\n catalog: cat,\n constructions,\n constructionOf: (id) => constructions.find((c) => c.id === id)!,\n initialState: initial,\n natural: cat.natural,\n titleOf: cat.title,\n };\n constructions.push(...list.map((c) => ({ ...c, desk })));\n return desk;\n}\n\n/** Which items a construction lets the pointer drag: panels everywhere, documents in the tree and the strip. */\nexport const draggable = (c: Construction, key: string): boolean => key.startsWith(\"panel:\") || (key.startsWith(\"doc:\") && (c.id === \"tree\" || c.id === \"strip\"));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,MAAM,MAAM,KAAK,GAAG,MAAM,KAAK,WAAW,KAAK;AACrD,gBAAQ,KAAK,KAAK,GAAG,MAAM,KAAK;AAChC,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,gBAAgC,CAAC;AACvC,QAAM,OAAa;AAAA,IACjB,SAAS;AAAA,IACT;AAAA,IACA,gBAAgB,CAAC,OAAO,cAAc,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AAAA,IAC7D,cAAc;AAAA,IACd,SAAS,IAAI;AAAA,IACb,SAAS,IAAI;AAAA,EACf;AACA,gBAAc,KAAK,GAAG,KAAK,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,KAAK,EAAE,CAAC;AACvD,SAAO;AACT;AAGO,IAAM,YAAY,CAAC,GAAiB,QAAyB,IAAI,WAAW,QAAQ,KAAM,IAAI,WAAW,MAAM,MAAM,EAAE,OAAO,UAAU,EAAE,OAAO;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as Point, R as Rect, S as Size } from './geometry-Bf37LbCT.js';
|
|
2
2
|
export { C as COLUMN_REACH, E as EPS, a as PLANE, b as RAIL_EDGE, c as area, d as centre, e as clamp, f as clampInto, g as contains, o as overlap, h as overlaps, r as rect, s as subtract } from './geometry-Bf37LbCT.js';
|
|
3
|
-
export { T as Target } from './target-
|
|
3
|
+
export { T as Target } from './target-fhD5UVlt.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Placing a popup (a drop label, a menu, a tooltip) the way Wayland's xdg-positioner does: an anchor point on the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { R as Rect, S as Size, P as Point } from './geometry-Bf37LbCT.js';
|
|
2
|
-
import { T as Target } from './target-
|
|
2
|
+
import { T as Target } from './target-fhD5UVlt.js';
|
|
3
3
|
import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-X7eUaKlA.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -21,6 +21,19 @@ type Zone = "start" | "center" | "end";
|
|
|
21
21
|
declare const ZONES: readonly Zone[];
|
|
22
22
|
/** A float that follows the content: flush with that side or corner of `layout.content` until a drop gives it a real rect. */
|
|
23
23
|
type FloatAnchor = "content-top-left" | "content-top" | "content-top-right" | "content-right" | "content-bottom-right" | "content-bottom" | "content-bottom-left" | "content-left";
|
|
24
|
+
declare const FLOAT_ANCHORS: readonly FloatAnchor[];
|
|
25
|
+
/**
|
|
26
|
+
* An anchor with an offset: flush with `at`'s side or corner of the content, then `dx` px to the right and `dy` px down
|
|
27
|
+
* (negative: left, up; default 0). It still follows the content, so a host stores "the top-right corner, 12 px down"
|
|
28
|
+
* rather than a pixel position.
|
|
29
|
+
*/
|
|
30
|
+
interface FloatAnchorOffset {
|
|
31
|
+
readonly at: FloatAnchor;
|
|
32
|
+
readonly dx?: number;
|
|
33
|
+
readonly dy?: number;
|
|
34
|
+
}
|
|
35
|
+
/** Where an anchored float sits: an anchor's name, or one with an offset. */
|
|
36
|
+
type FloatAnchorAt = FloatAnchor | FloatAnchorOffset;
|
|
24
37
|
/** Along which axis an item lies: a column runs down, a row (a bar) runs across. */
|
|
25
38
|
type Orient = "column" | "row";
|
|
26
39
|
interface SceneItem {
|
|
@@ -39,8 +52,11 @@ interface SceneItem {
|
|
|
39
52
|
/** Kept: gives way after every item that isn't. */
|
|
40
53
|
readonly kept?: boolean;
|
|
41
54
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
55
|
+
* Folded by hand when 1 or more (`fold` sets it to 1; default unset): it starts at its first folded form (a panel's
|
|
56
|
+
* `header`, a group's `fold`) among the forms of the axis it lies along, never one step down the ladder, and give-way
|
|
57
|
+
* steps down from there. A stored value past that form keeps its place (a scene stored with a later form). With no
|
|
58
|
+
* folded form on that axis it draws unfolded (`canFold`). A float folded by hand is drawn as its bar: that form's
|
|
59
|
+
* natural length, at the float's place.
|
|
44
60
|
*/
|
|
45
61
|
readonly from?: number;
|
|
46
62
|
/**
|
|
@@ -92,7 +108,9 @@ interface Edge {
|
|
|
92
108
|
readonly ring: number;
|
|
93
109
|
/**
|
|
94
110
|
* Top and bottom bars only: across the whole stage (`"full"`, the default) or between the side columns
|
|
95
|
-
* (`"between"`). Left and right edges ignore it.
|
|
111
|
+
* (`"between"`). Left and right edges ignore it. An overlay bar (`mode: "overlay"`) lies over the content, between
|
|
112
|
+
* the columns, unless it sets `span: "full"` by name: then it runs across the full bars' width, over the side columns
|
|
113
|
+
* too. Left out on an overlay bar, it means the content's width, as it always has.
|
|
96
114
|
*/
|
|
97
115
|
readonly span?: "full" | "between";
|
|
98
116
|
/** The kinds a drop may bring here. Deny by default: an empty list takes nothing (an anchor). */
|
|
@@ -174,6 +192,12 @@ interface Edge {
|
|
|
174
192
|
/**
|
|
175
193
|
* A static left or right edge that gives way like a dynamic column: it shrinks toward its minimum, then folds whole
|
|
176
194
|
* into its side's rail, in give-way order with the columns (its items' ages). It is never deleted.
|
|
195
|
+
*
|
|
196
|
+
* On a top or bottom bar (reserved or overlay), it gives way by height: while the content is shorter than
|
|
197
|
+
* `contentMin.height` (overlay bars counted), such bars shrink across toward their minimum (`cross.min`, and each
|
|
198
|
+
* open item's form's `cross.min`), then fold, their items stepping to the next form that fits across (a panel's
|
|
199
|
+
* title bar), unkept before kept, the oldest newest use first, the outer first (`bar-shrunk`, `bar-folded`). Room
|
|
200
|
+
* coming back undoes it in reverse. A bar never draws an item thinner across than its form's `cross.min`.
|
|
177
201
|
*/
|
|
178
202
|
readonly giveWay?: boolean;
|
|
179
203
|
/**
|
|
@@ -181,6 +205,18 @@ interface Edge {
|
|
|
181
205
|
* its toolbars step down before an item moved in from another bar would.
|
|
182
206
|
*/
|
|
183
207
|
readonly priority?: number;
|
|
208
|
+
/**
|
|
209
|
+
* Hidden: kept in the scene with its items, but not in the window (a bar a host doesn't draw, a rail it has turned
|
|
210
|
+
* off). View state: the host decides it each time it builds the scene, and the store never writes it. A hidden edge
|
|
211
|
+
* takes no room, and everything else lays out exactly as if it weren't in the scene; `solve` leaves it and its items
|
|
212
|
+
* out of the layout (no `edges[id]`, no `items[id]`, as for an item placed nowhere), so nothing reads a rect of it.
|
|
213
|
+
* Its items take no part in give-way or folds. It has no targets and no refusals for any kind, no keyboard stops, and
|
|
214
|
+
* its items have none either (dragging one gives nothing); `moveTo` into it is refused as into an edge that doesn't
|
|
215
|
+
* take the kind. Its items stay in it, and `storeScene` / `readScene` keep them. A column a drop makes never takes a
|
|
216
|
+
* hidden edge's id; where a drop makes or removes a column on its side, the side is numbered again with the hidden
|
|
217
|
+
* edge back at its own place. Side columns, rails and bars alike.
|
|
218
|
+
*/
|
|
219
|
+
readonly hidden?: boolean;
|
|
184
220
|
}
|
|
185
221
|
/** What a side's new columns are made from. */
|
|
186
222
|
interface ColumnTemplate {
|
|
@@ -255,11 +291,27 @@ interface SceneFloat {
|
|
|
255
291
|
readonly id: string;
|
|
256
292
|
/** Its rect in stage px (it never scrolls with the content). With `anchor`, only its size counts. */
|
|
257
293
|
readonly rect: Rect;
|
|
258
|
-
/** Follow the content's side or corner until a drop gives it a real rect. */
|
|
259
|
-
readonly anchor?:
|
|
294
|
+
/** Follow the content's side or corner (with an offset, `{ at, dx?, dy? }`) until a drop gives it a real rect. */
|
|
295
|
+
readonly anchor?: FloatAnchorAt;
|
|
260
296
|
/** Which of the item's forms it uses (default: the item's `floatOrientOf`). */
|
|
261
297
|
readonly orient?: Orient;
|
|
298
|
+
/**
|
|
299
|
+
* When it was floated, as a sequence: `floatAt` and `moveTo(…, { kind: "float" })` give a newly floated item one more
|
|
300
|
+
* than the largest `since` among the scene's floats (1 when there are none); moving a float that already floats,
|
|
301
|
+
* `raise`, `use` and `resize` keep it. Among anchored floats the earlier (smaller `since`, missing counting as 0, then
|
|
302
|
+
* the smaller id) wins the place both want.
|
|
303
|
+
*/
|
|
304
|
+
readonly since?: number;
|
|
262
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* A rect the scene keeps clear of, and who keeps clear: `"all"` (the default) for floats and drop targets alike (a
|
|
308
|
+
* slot or a target's landing never lies on it), `"floats"` for floats alone: their placement, drops, opening, a
|
|
309
|
+
* window resize and a resize by hand keep clear of it, while the edges, give-way and every docked target ignore it (a
|
|
310
|
+
* spine the host draws over a column).
|
|
311
|
+
*/
|
|
312
|
+
type SceneChrome = Rect & {
|
|
313
|
+
readonly for?: "all" | "floats";
|
|
314
|
+
};
|
|
263
315
|
interface Scene {
|
|
264
316
|
/** The window's inner rect. */
|
|
265
317
|
readonly stage: Rect;
|
|
@@ -269,8 +321,11 @@ interface Scene {
|
|
|
269
321
|
readonly floats: readonly SceneFloat[];
|
|
270
322
|
/** The kinds that may float. Deny by default. */
|
|
271
323
|
readonly floatKinds: readonly Kind[];
|
|
272
|
-
/**
|
|
273
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Rects the scene keeps clear of (a title the host draws itself, a status line): by default floats and drop targets
|
|
326
|
+
* both; an entry with `for: "floats"` (a spine drawn over a column) only floats. See {@link SceneChrome}.
|
|
327
|
+
*/
|
|
328
|
+
readonly chrome?: readonly SceneChrome[];
|
|
274
329
|
/** Spots where a release cancels: `targets` gives a `none` target over each. */
|
|
275
330
|
readonly blocked?: readonly Rect[];
|
|
276
331
|
/** Per side (left, right): what a new column is made from. A side without one gets no new columns. */
|
|
@@ -406,7 +461,7 @@ interface SceneEdgeLayout {
|
|
|
406
461
|
readonly free: StackFit;
|
|
407
462
|
/** A dynamic column folded into its side's rail (its rect is zero wide there): by hand or by give-way. */
|
|
408
463
|
readonly folded?: "hand" | "auto";
|
|
409
|
-
/** Shrunk by give-way below the
|
|
464
|
+
/** Shrunk by give-way below the size across it asks for: a column's width, a bar's height (`Edge.giveWay`). */
|
|
410
465
|
readonly shrunk?: boolean;
|
|
411
466
|
/** Riding on this column (its rect is the bars'). */
|
|
412
467
|
readonly rides?: string;
|
|
@@ -434,6 +489,8 @@ interface SceneRailLayout {
|
|
|
434
489
|
* - `float-clamped`, `float-moved`: a float was moved into the stage, or clear of what it would cover;
|
|
435
490
|
* - `float-covers`: no clear place exists, and it covers the least it can.
|
|
436
491
|
* - `column-shrunk`, `column-folded`, `kept-folded`: give-way by `contentMin.width`, in give-way order;
|
|
492
|
+
* - `bar-shrunk`, `bar-folded`: give-way by `contentMin.height`, in give-way order: a top or bottom bar with `giveWay`
|
|
493
|
+
* shrank across (`from`, `to`), or its items stepped to the next form that fits (a panel's title bar);
|
|
437
494
|
* - `content-narrow`, `content-short`: the content is still under `contentMin` (overlay bars count against the height).
|
|
438
495
|
* - `no-column-room`: not even one column at its minimum fits beside `contentMin.width` (`layout.columnRoom` false):
|
|
439
496
|
* `width` is the room the stage leaves, `need` the content's minimum plus that column and its gutter.
|
|
@@ -461,6 +518,14 @@ type SceneNote = ({
|
|
|
461
518
|
} | {
|
|
462
519
|
readonly code: "column-folded" | "kept-folded";
|
|
463
520
|
readonly edge: string;
|
|
521
|
+
} | {
|
|
522
|
+
readonly code: "bar-shrunk";
|
|
523
|
+
readonly edge: string;
|
|
524
|
+
readonly from: number;
|
|
525
|
+
readonly to: number;
|
|
526
|
+
} | {
|
|
527
|
+
readonly code: "bar-folded";
|
|
528
|
+
readonly edge: string;
|
|
464
529
|
} | {
|
|
465
530
|
readonly code: "no-column-room";
|
|
466
531
|
readonly width: number;
|
|
@@ -592,7 +657,9 @@ declare function fitResize(scene: Scene, id: string, rect: Rect, moving: ResizeE
|
|
|
592
657
|
* - `floatAt(scene, id, rect?, orient?)`: floats it on top at `rect` (its size becomes `floatSize`); with no rect, at
|
|
593
658
|
* its `floatSizeOf` size anchored to the content's top-right corner: its `floatSize`, else its form's natural size
|
|
594
659
|
* along its orient (the float's, `orient`, else `floatOrientOf`), else the default size.
|
|
595
|
-
* - `fold(scene, id, on)`: folded by hand
|
|
660
|
+
* - `fold(scene, id, on)`: folded by hand (`from: 1`) draws it in its folded form on the axis it lies along (a panel's
|
|
661
|
+
* `header`, a group's `fold`), and give-way steps down from there; unfolding clears `from`. Where it has no folded
|
|
662
|
+
* form (`canFold` false), folding changes nothing.
|
|
596
663
|
* - `use(scene, id)`: the newest age. Under `previous` it reshapes nothing.
|
|
597
664
|
* - `keep(scene, id, on)`, `open(scene, id)`, `close(scene, id)`.
|
|
598
665
|
* - `raise(scene, id)`: a float to the top of the stack; no use, no reshape.
|
|
@@ -624,14 +691,21 @@ interface RailPlace {
|
|
|
624
691
|
interface FloatPlace {
|
|
625
692
|
readonly kind: "float";
|
|
626
693
|
readonly rect?: Rect;
|
|
627
|
-
/** Following the content (only its size counts then)
|
|
628
|
-
readonly anchor?:
|
|
694
|
+
/** Following the content (only its size counts then), at an anchor's name or `{ at, dx?, dy? }`. */
|
|
695
|
+
readonly anchor?: FloatAnchorAt;
|
|
629
696
|
}
|
|
630
697
|
type Place = DockPlace | ColumnPlace | RailPlace | FloatPlace;
|
|
631
698
|
/** The scene with the item out of every edge and every float (a dynamic column it leaves empty is deleted). */
|
|
632
699
|
declare function lift(scene: Scene, id: string): Scene;
|
|
633
700
|
declare function moveTo(scene: Scene, id: string, place: Place): Scene;
|
|
634
701
|
declare function floatAt(scene: Scene, id: string, at?: Rect, orient?: Orient): Scene;
|
|
702
|
+
/**
|
|
703
|
+
* Whether a hand fold of `id` means anything where it lies now: it has a folded form (a panel's `header`, a group's
|
|
704
|
+
* `fold`; a fixed item on a `foldable` edge, a thumbnail anchor, its `rail` tile) among the forms of the axis it lies
|
|
705
|
+
* along (its edge's, its float's orient; either when it lies nowhere). Where it is false, `fold(on)` changes nothing: a
|
|
706
|
+
* host leaves the grip's double-click off. An item folded by hand can always be unfolded.
|
|
707
|
+
*/
|
|
708
|
+
declare function canFold(scene: Scene, id: string): boolean;
|
|
635
709
|
declare function fold(scene: Scene, id: string, on: boolean): Scene;
|
|
636
710
|
declare function use(scene: Scene, id: string): Scene;
|
|
637
711
|
declare function keep(scene: Scene, id: string, on: boolean): Scene;
|
|
@@ -683,7 +757,7 @@ declare function dockHome(scene: Scene, id: string, start: Scene): Scene;
|
|
|
683
757
|
* interface StoredScene {
|
|
684
758
|
* v: 1;
|
|
685
759
|
* edges: { id: string; side: Side; ring: number; items: string[]; size?: number; column?: true }[];
|
|
686
|
-
* floats: { id: string; x: number; y: number; width: number; height: number; orient?: "row" | "column"; anchor?: FloatAnchor }[];
|
|
760
|
+
* floats: { id: string; x: number; y: number; width: number; height: number; orient?: "row" | "column"; anchor?: FloatAnchor | { at: FloatAnchor; dx?: number; dy?: number }; since?: number }[];
|
|
687
761
|
* items: Record<string, { used: number; kept?: true; from?: number; closed?: true; align?: "center" | "end"; floatSize?: { width: number; height: number } }>;
|
|
688
762
|
* railModes?: { left?: "titles" | "icons"; right?: "titles" | "icons" };
|
|
689
763
|
* }
|
|
@@ -693,8 +767,10 @@ declare function dockHome(scene: Scene, id: string, start: Scene): Scene;
|
|
|
693
767
|
* side, ring and limits come from `base`, its order of items and its `size` from the store; a static edge stored on
|
|
694
768
|
* the other side of its axis is moved there (`setSide`, as its side's outermost edge). Dynamic columns
|
|
695
769
|
* (`column: true`) are the store's: one `base` lacks is made from `base.columns[side]`, its ring is the stored one, and
|
|
696
|
-
* columns left empty are deleted, the rings closed up.
|
|
697
|
-
*
|
|
770
|
+
* columns left empty are deleted, the rings closed up. `Edge.hidden` is view state, not stored: the host decides it
|
|
771
|
+
* each time it builds the scene (from the window's width, say). A hidden edge's items are stored like any edge's;
|
|
772
|
+
* `hidden` itself is not written, and read back it comes from `base` only (a stored `hidden` is ignored and listed as
|
|
773
|
+
* `edge:<id>:hidden`). No float has a pinned field: one an old store has is listed and ignored.
|
|
698
774
|
*
|
|
699
775
|
* Reading is lenient: anything but an object of version 1 gives `base` back with the reason in `error`. Inside one,
|
|
700
776
|
* whatever can't be used is dropped and listed in `dropped` (an unknown edge `edge:<id>`, an unknown or repeated item,
|
|
@@ -703,7 +779,10 @@ declare function dockHome(scene: Scene, id: string, start: Scene): Scene;
|
|
|
703
779
|
* `<field>`). A stored edge's order is kept exactly, fixed items where the store put them (in their own edge); a fixed
|
|
704
780
|
* item the store lacks goes back to its base place (trailing ones last). An item the store places nowhere goes where
|
|
705
781
|
* `base` has it, before a stored trailing run of fixed items.
|
|
706
|
-
* A float's rect is clamped into the stage on read
|
|
782
|
+
* A float's rect is clamped into the stage on read; its anchor, with any offset, is kept as stored (an anchored float
|
|
783
|
+
* lies by its anchor, so the clamp never turns it into a pixel position). An unusable anchor is dropped
|
|
784
|
+
* (`float:<id>:anchor`), and so is a bad offset field (`float:<id>:anchor:dx`, `float:<id>:anchor:<field>`). A float's
|
|
785
|
+
* `since` is kept as stored; one that isn't a number from 0 to `Number.MAX_SAFE_INTEGER` is dropped (`float:<id>:since`).
|
|
707
786
|
*/
|
|
708
787
|
|
|
709
788
|
interface StoredSceneEdge {
|
|
@@ -722,7 +801,10 @@ interface StoredSceneFloat {
|
|
|
722
801
|
readonly width: number;
|
|
723
802
|
readonly height: number;
|
|
724
803
|
readonly orient?: Orient;
|
|
725
|
-
|
|
804
|
+
/** An anchor's name, or `{ at, dx?, dy? }`: an anchor with an offset in px. */
|
|
805
|
+
readonly anchor?: FloatAnchorAt;
|
|
806
|
+
/** When it was floated (`SceneFloat.since`). */
|
|
807
|
+
readonly since?: number;
|
|
726
808
|
}
|
|
727
809
|
interface StoredSceneItem {
|
|
728
810
|
readonly used: number;
|
|
@@ -807,8 +889,18 @@ interface SceneRefusal {
|
|
|
807
889
|
readonly id: string;
|
|
808
890
|
readonly edge: string;
|
|
809
891
|
readonly zone: Zone;
|
|
810
|
-
/**
|
|
892
|
+
/**
|
|
893
|
+
* Where the pointer means it, never over a target's hit and never past the stage. An edge that takes the kind in no
|
|
894
|
+
* zone gives one refusal (`n = 0`, zone `start`): its drawn rect, fixed items included, less what targets own. A
|
|
895
|
+
* refused zone of an edge that takes the kind elsewhere: the refused slot's tile, inside the edge's ends.
|
|
896
|
+
*/
|
|
811
897
|
readonly hit: Rect;
|
|
898
|
+
/**
|
|
899
|
+
* A wholly refused edge left in pieces by what targets own (a target in the middle of a bar): every piece, each at
|
|
900
|
+
* least 1 px each way, `hit` the largest. Absent when the refusal is one rect. The pointer is in the refusal when it is
|
|
901
|
+
* in any piece.
|
|
902
|
+
*/
|
|
903
|
+
readonly hits?: readonly Rect[];
|
|
812
904
|
/**
|
|
813
905
|
* `no-room`: the zone takes the kind, but the drop there doesn't fit (a title bar at the title's natural width, say).
|
|
814
906
|
* `own-place`: the stretch beside an item alone in its zone: there is room, but the zone's only place is the item's
|
|
@@ -817,4 +909,4 @@ interface SceneRefusal {
|
|
|
817
909
|
readonly reason: "no-room" | "own-place" | "not-accepted";
|
|
818
910
|
}
|
|
819
911
|
|
|
820
|
-
export {
|
|
912
|
+
export { canFold as $, type RailSpec as A, type RailVisibility as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchorAt as F, type ResizeEdges as G, type ResizeLimit as H, SIDES as I, type SceneAfter as J, type Kind as K, type SceneChrome as L, type SceneEdgeLayout as M, type SceneFloat as N, type Orient as O, type Place as P, type SceneItemLayout as Q, type RailMode as R, type Scene as S, type SceneNote as T, type SceneRailLayout as U, type SceneRead as V, type StoredSceneEdge as W, type StoredSceneFloat as X, type StoredSceneItem as Y, type Zone as Z, ZONES as _, type ScenePlace as a, close as a0, dockHome as a1, fitResize as a2, floatAt as a3, fold as a4, homeFor as a5, keep as a6, lift as a7, moveTo as a8, open as a9, orient as aa, raise as ab, readScene as ac, resize as ad, setRailMode as ae, setSide as af, storeScene as ag, use as ah, 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 SolveOptions as k, type SceneTargetOptions as l, type ColumnTemplate as m, DEFAULT_HIT_BAND as n, DEFAULT_RAIL_MAGNET as o, DEFAULT_STRIP as p, type DockPlace as q, FLOAT_ANCHORS as r, type FloatAnchorOffset as s, type FloatPlace as t, type FloatResize as u, RAIL_MODES as v, RAIL_STRIP_MIN as w, RAIL_VISIBILITIES as x, type RailDropPolicy as y, type RailPlace as z };
|
package/dist/panels.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-
|
|
2
|
-
export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-
|
|
1
|
+
import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-DnVNZVQW.js';
|
|
2
|
+
export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-DnVNZVQW.js';
|
|
3
3
|
import { R as Rect } from './geometry-Bf37LbCT.js';
|
|
4
4
|
export { C as COLUMN_REACH, b as RAIL_EDGE } from './geometry-Bf37LbCT.js';
|
|
5
|
-
import './target-
|
|
5
|
+
import './target-fhD5UVlt.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The panels' stored form: `storePanels(state)` gives plain JSON-safe data (`{ v: 1, … }`); `readPanels(data, defs?)`
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { S as Size, R as Rect, P as Point } from './geometry-Bf37LbCT.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A pane's drop regions: a center rectangle (a drop there swaps with the pane) and four side trapezoids (a drop there
|
|
5
|
+
* splits the pane on that side), formed by the diagonals from each pane corner to the nearest corner of the center.
|
|
6
|
+
* The five regions cover the pane with no gaps and no overlaps.
|
|
7
|
+
*
|
|
8
|
+
* Meant for `@n-uf/motion/drag`'s `placeOf(target, point, previous)`: one target per pane (`paneTargets`), its place
|
|
9
|
+
* the region under the pointer, the previous region held for `hysteresis` px past its boundary so a pointer resting on
|
|
10
|
+
* a boundary doesn't flicker. A region that takes no drop is the consumer's to answer with a null place.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type PaneSide = "top" | "right" | "bottom" | "left";
|
|
14
|
+
type PaneRegion = "center" | PaneSide;
|
|
15
|
+
/** The sides in their tie-break order: at an exact diagonal the first wins (a corner resolves to `top`). */
|
|
16
|
+
declare const PANE_SIDES: readonly PaneSide[];
|
|
17
|
+
interface PaneRegionOptions {
|
|
18
|
+
/** The center rectangle's share of each pane axis (0.05 to 0.95); `centerX` / `centerY` override one axis. */
|
|
19
|
+
readonly center?: number;
|
|
20
|
+
readonly centerX?: number;
|
|
21
|
+
readonly centerY?: number;
|
|
22
|
+
/** The least the center spans on either axis, px (a small pane keeps a usable center). */
|
|
23
|
+
readonly centerMin?: number;
|
|
24
|
+
/** How far past its boundary the previous region holds, px. */
|
|
25
|
+
readonly hysteresis?: number;
|
|
26
|
+
/** Device pixels per px: the center's edges snap to that grid, as the browser draws them. */
|
|
27
|
+
readonly pixelRatio?: number;
|
|
28
|
+
}
|
|
29
|
+
declare const PANE_REGION_DEFAULTS: Required<Omit<PaneRegionOptions, "centerX" | "centerY">>;
|
|
30
|
+
/** The center rectangle of a pane of `size`, in pane-local px (origin at the pane's top-left corner). */
|
|
31
|
+
interface PaneCenter {
|
|
32
|
+
readonly width: number;
|
|
33
|
+
readonly height: number;
|
|
34
|
+
readonly left: number;
|
|
35
|
+
readonly top: number;
|
|
36
|
+
readonly right: number;
|
|
37
|
+
readonly bottom: number;
|
|
38
|
+
}
|
|
39
|
+
/** Where the center rectangle of a pane of `size` lies, by these options. */
|
|
40
|
+
declare function paneCenter(size: Size, options?: PaneRegionOptions): PaneCenter;
|
|
41
|
+
/**
|
|
42
|
+
* The drop region of `pane` (in the same coordinates as `point`) the point is in. With a `previous` region, the point
|
|
43
|
+
* has to be `hysteresis` px past that region's boundary before the region changes: no time-based debounce, only
|
|
44
|
+
* geometry.
|
|
45
|
+
*/
|
|
46
|
+
declare function paneRegion(pane: Rect, point: Point, previous?: PaneRegion | null, options?: PaneRegionOptions): PaneRegion;
|
|
47
|
+
|
|
48
|
+
export { type PaneSide as P, type PaneCenter as a, type PaneRegion as b, PANE_REGION_DEFAULTS as c, PANE_SIDES as d, type PaneRegionOptions as e, paneRegion as f, paneCenter as p };
|