@n-uf/placement 26.11.52 → 26.11.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +89 -1
  2. package/README.md +27 -58
  3. package/dist/{chunk-VLTYJHUA.js → chunk-2UVUFEBP.js} +4 -8
  4. package/dist/{chunk-VLTYJHUA.js.map → chunk-2UVUFEBP.js.map} +1 -1
  5. package/dist/{geometry-Bf37LbCT.d.ts → geometry-L5gCoiZV.d.ts} +2 -8
  6. package/dist/index.d.ts +64 -42
  7. package/dist/index.js +6 -66
  8. package/dist/index.js.map +1 -1
  9. package/dist/popup.d.ts +49 -0
  10. package/dist/popup.js +58 -0
  11. package/dist/popup.js.map +1 -0
  12. package/dist/stack.d.ts +529 -228
  13. package/dist/stack.js +701 -28
  14. package/dist/stack.js.map +1 -1
  15. package/dist/tiling.d.ts +48 -5
  16. package/dist/tiling.js +198 -19
  17. package/dist/tiling.js.map +1 -1
  18. package/package.json +9 -36
  19. package/dist/chunk-2GGJ4GVR.js +0 -9
  20. package/dist/chunk-2GGJ4GVR.js.map +0 -1
  21. package/dist/chunk-3ZICYLWL.js +0 -791
  22. package/dist/chunk-3ZICYLWL.js.map +0 -1
  23. package/dist/chunk-67D32MZ4.js +0 -4178
  24. package/dist/chunk-67D32MZ4.js.map +0 -1
  25. package/dist/chunk-AE3BWTAE.js +0 -838
  26. package/dist/chunk-AE3BWTAE.js.map +0 -1
  27. package/dist/chunk-JVAR67OL.js +0 -172
  28. package/dist/chunk-JVAR67OL.js.map +0 -1
  29. package/dist/chunk-NF7RYK3U.js +0 -429
  30. package/dist/chunk-NF7RYK3U.js.map +0 -1
  31. package/dist/chunk-R3AAANRY.js +0 -220
  32. package/dist/chunk-R3AAANRY.js.map +0 -1
  33. package/dist/chunk-TWI644JK.js +0 -221
  34. package/dist/chunk-TWI644JK.js.map +0 -1
  35. package/dist/constructions-Cbz7uEAZ.d.ts +0 -251
  36. package/dist/desk.d.ts +0 -51
  37. package/dist/desk.js +0 -111
  38. package/dist/desk.js.map +0 -1
  39. package/dist/dock.d.ts +0 -25
  40. package/dist/dock.js +0 -397
  41. package/dist/dock.js.map +0 -1
  42. package/dist/float-fit-DCYxRMru.d.ts +0 -37
  43. package/dist/lanes-DIwUqchd.d.ts +0 -1321
  44. package/dist/model-X7eUaKlA.d.ts +0 -337
  45. package/dist/panels.d.ts +0 -60
  46. package/dist/panels.js +0 -99
  47. package/dist/panels.js.map +0 -1
  48. package/dist/regions-Db_RyT4P.d.ts +0 -48
  49. package/dist/scene-cases.d.ts +0 -888
  50. package/dist/scene-cases.js +0 -3149
  51. package/dist/scene-cases.js.map +0 -1
  52. package/dist/scene.d.ts +0 -290
  53. package/dist/scene.js +0 -128
  54. package/dist/scene.js.map +0 -1
  55. package/dist/target-BBOCeez2.d.ts +0 -69
  56. package/dist/targets-C9ZVhmCl.d.ts +0 -621
  57. package/dist/targets.d.ts +0 -212
  58. package/dist/targets.js +0 -447
  59. package/dist/targets.js.map +0 -1
  60. package/dist/toolbar.d.ts +0 -167
  61. package/dist/toolbar.js +0 -55
  62. package/dist/toolbar.js.map +0 -1
package/dist/dock.js DELETED
@@ -1,397 +0,0 @@
1
- import {
2
- BAR,
3
- DEFAULT_OPTIONS,
4
- DOCK,
5
- DRAWER_DOCK,
6
- G,
7
- LAYER,
8
- OVER_MARGIN,
9
- RAIL,
10
- TITLE,
11
- TORN_W,
12
- TREE_COLUMN,
13
- accordion,
14
- aroundDocs,
15
- bar,
16
- catalogOf,
17
- columnHeights,
18
- docKey,
19
- dockGeometry,
20
- idOf,
21
- intoRail,
22
- isDocKey,
23
- isPanelKey,
24
- liftOut,
25
- paletteArea,
26
- palettes,
27
- panelKey,
28
- pill,
29
- pillBetween,
30
- plural,
31
- rail,
32
- share,
33
- startState,
34
- stripGeometry,
35
- stripMin,
36
- tabbed,
37
- tabbedIntoRail,
38
- tileMin,
39
- tiles,
40
- toggleClosed,
41
- toggleFold,
42
- touch,
43
- treeArea,
44
- treeFloats,
45
- treeRails,
46
- treeShown,
47
- treeTiles,
48
- withActive,
49
- withDocs
50
- } from "./chunk-NF7RYK3U.js";
51
- import "./chunk-R3AAANRY.js";
52
- import {
53
- clampInto,
54
- rect
55
- } from "./chunk-VLTYJHUA.js";
56
-
57
- // src/dock/constructions.ts
58
- function docks(cat, s, size, opt, mode, notes) {
59
- const out = /* @__PURE__ */ new Map();
60
- const { width: W, height: H } = size;
61
- const d = dockGeometry(cat, s, size, opt, mode, notes);
62
- rail(out, "left", 0, 0, d.h, s.left);
63
- rail(out, "right", W - RAIL, 0, d.h, d.right);
64
- let folded = 0;
65
- if (d.lOpen) folded += accordion(cat, out, s, RAIL + G, G, DOCK - G, d.h - 2 * G, s.left);
66
- else intoRail(cat, out, 0, 0, DOCK - G, s.left, "left");
67
- if (d.rOpen) folded += accordion(cat, out, s, W - RAIL - DOCK, G, DOCK - G, d.h - 2 * G, d.right);
68
- else intoRail(cat, out, W - RAIL, 0, DOCK - G, d.right, "right");
69
- if (folded) notes.push({ code: "sections-folded", text: `${plural(folded, "section", "sections")} folded to ${folded > 1 ? "headers" : "a header"}` });
70
- const overlay = opt.bottom === "overlay";
71
- if (d.bottomRect) {
72
- const b = d.bottomRect;
73
- const n = s.bottom.length;
74
- const w = (b.width - G * (n - 1)) / n;
75
- s.bottom.forEach((id, i) => {
76
- const open = d.bh > TITLE;
77
- out.set(panelKey(id), {
78
- rect: rect(b.x + i * (w + G), b.y, w, b.height),
79
- look: overlay ? open ? "float" : "header" : open ? "section" : "header",
80
- layer: overlay ? LAYER.overlay : LAYER.dock,
81
- accent: true,
82
- ...overlay ? { shadow: true } : {},
83
- ...open ? { min: { height: cat.natural(id) } } : {}
84
- });
85
- });
86
- }
87
- const docsBottom = d.bottomOn && !overlay ? H - G - d.bh : H;
88
- const p = pill(opt, d.x0, d.x1 - d.x0, 0, overlay && d.bottomOn ? H - G - d.bh : docsBottom);
89
- const bottomOfDocs = overlay && d.bottomOn && !(opt.toolbar === "bottom" && opt.toolbarSpace === "reserved") ? H - G : p.bottom;
90
- tiles(out, rect(d.x0, p.top, d.x1 - d.x0, bottomOfDocs - p.top), s.docs);
91
- out.set("toolbar", p.placed);
92
- return out;
93
- }
94
- function tornOff(cat, out, s, size, notes) {
95
- const docRects = [...out.entries()].filter(([k]) => isDocKey(k)).map(([, p]) => p.rect);
96
- const right = docRects.length ? Math.max(...docRects.map((r) => r.x + r.width)) : size.width / 2;
97
- const top = docRects.length ? Math.min(...docRects.map((r) => r.y)) : 0;
98
- let shaded = 0;
99
- s.torn.forEach((f, i) => {
100
- const full = cat.natural(f.id);
101
- const at = f.at ?? { x: right - 12 - TORN_W - 22 * i, y: top + 40 + 22 * i };
102
- const fits = at.y + full <= size.height - G;
103
- const shade = s.folded.includes(f.id) || !fits;
104
- if (!fits && !s.folded.includes(f.id)) shaded++;
105
- const r = clampInto(rect(at.x, at.y, TORN_W, shade ? TITLE : full), rect(0, 0, size.width, size.height));
106
- out.set(panelKey(f.id), { rect: r, look: shade ? "header" : "float", layer: LAYER.float, shadow: true, ...shade ? {} : { min: { height: full } } });
107
- });
108
- if (s.torn.length) {
109
- const items = s.torn.map((f) => panelKey(f.id));
110
- 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` });
111
- }
112
- if (shaded) notes.push({ code: "torn-shaded", text: `${plural(shaded, "floating panel", "floating panels")} shaded` });
113
- }
114
- function tree(cat, s, size, notes) {
115
- const out = /* @__PURE__ */ new Map();
116
- const area = treeArea(size, s);
117
- const rails = treeRails(s);
118
- for (const side of ["left", "right"]) {
119
- if (!rails[side]) continue;
120
- const ids = (side === "left" ? s.tree.L : s.tree.R).map(idOf);
121
- const x = side === "left" ? 0 : size.width - RAIL;
122
- rail(out, side, x, BAR, size.height - BAR, ids);
123
- intoRail(cat, out, x, BAR, TREE_COLUMN, ids, side);
124
- }
125
- if (rails.left || rails.right) {
126
- const both = rails.left && rails.right;
127
- const text = `${both ? "both side columns" : `the ${rails.left ? "left" : "right"} column`} folded to ${both ? "their rails" : "its rail"}`;
128
- notes.push({ code: "columns-railed", text, ...both ? {} : { side: rails.left ? "left" : "right" } });
129
- }
130
- const { tree: t, floats } = treeFloats(cat, treeShown(s), area);
131
- 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) });
132
- floats.forEach((k, i) => {
133
- const m = isDocKey(k) ? { w: 300, h: 190 } : { w: 200, h: cat.natural(idOf(k)) };
134
- 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));
135
- out.set(k, { rect: r, look: isDocKey(k) ? "doc" : "float", layer: LAYER.float, shadow: true });
136
- });
137
- 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(", ")}` });
138
- out.set("toolbar", bar(size.width));
139
- return out;
140
- }
141
- function treeStart(cat, docs, size) {
142
- const s = startState(cat, docs);
143
- if (!size) return s;
144
- const both = { ...s, closed: ["right", "left"] };
145
- const panels = s.tree.C.filter((k) => !isDocKey(k));
146
- const tries = [s, { ...s, closed: ["right"] }, both, { ...both, tree: { ...s.tree, R: [...s.tree.R, ...panels], C: s.tree.C.filter(isDocKey) } }];
147
- return tries.find((st) => treeFloats(cat, treeShown(st), treeArea(size, st)).floats.length === 0) ?? tries.at(-1);
148
- }
149
- var NAV_L = 240;
150
- var NAV_R = 240;
151
- var NAV_MIN = 380;
152
- function navigator(cat, s, size, opt, notes) {
153
- const out = /* @__PURE__ */ new Map();
154
- const { width: W, height: H } = size;
155
- let lw = s.left.length ? NAV_L : 0;
156
- let rw = s.right.length ? NAV_R : 0;
157
- if (rw && W - lw - rw < NAV_MIN) {
158
- rw = RAIL;
159
- notes.push({ code: "tabs-folded", side: "right", text: "inspector folded to icon tabs" });
160
- }
161
- if (lw && W - lw - rw < NAV_MIN) {
162
- lw = RAIL;
163
- notes.push({ code: "tabs-folded", side: "left", text: "navigator folded to icon tabs" });
164
- }
165
- const side = (sd, x, w, full, ids) => {
166
- if (w === RAIL) {
167
- rail(out, sd, x, 0, H, ids);
168
- tabbedIntoRail(cat, out, sd, ids, x, 0, full);
169
- } else if (w > 0) {
170
- rail(out, sd, sd === "left" ? x : x + w - RAIL, 0, H, ids, true);
171
- tabbed(out, sd, ids, s.active[sd], x, 0, w, H, false);
172
- }
173
- };
174
- side("left", 0, lw, NAV_L, s.left);
175
- side("right", W - rw, rw, NAV_R, s.right);
176
- const cx = lw + G;
177
- const cw = W - lw - rw - 2 * G;
178
- const p = pill(opt, cx, cw, 0, H);
179
- tiles(out, rect(cx, p.top, cw, p.bottom - p.top), s.docs);
180
- out.set("toolbar", p.placed);
181
- return out;
182
- }
183
- var DRAWER_L = 240;
184
- var DRAWER_R = 240;
185
- function drawers(cat, s, size, notes) {
186
- const out = /* @__PURE__ */ new Map();
187
- const { width: W, height: H } = size;
188
- const y = BAR;
189
- const h = H - BAR;
190
- const rDocked = W >= DRAWER_DOCK.right;
191
- const lDocked = W >= DRAWER_DOCK.left;
192
- const lOpen = s.left.length > 0 && !s.closed.includes("left");
193
- const rOpen = s.right.length > 0 && !s.closed.includes("right");
194
- if (!rDocked && rOpen) notes.push({ code: "drawer-over", side: "right", text: "right drawer slides over the documents" });
195
- if (!lDocked && lOpen) notes.push({ code: "drawer-over", side: "left", text: rDocked || !rOpen ? "left drawer slides over the documents" : "left drawer slides over too" });
196
- rail(out, "left", 0, y, h, s.left);
197
- rail(out, "right", W - RAIL, y, h, s.right);
198
- const x0 = RAIL + (lDocked && lOpen ? DRAWER_L : 0) + G;
199
- const x1 = W - RAIL - (rDocked && rOpen ? DRAWER_R : 0) - G;
200
- tiles(out, rect(x0, y + G, x1 - x0, h - 2 * G), s.docs);
201
- const both = !lDocked && !rDocked && lOpen && rOpen;
202
- const half = (W - 2 * RAIL - G) / 2;
203
- const lw = both ? Math.min(DRAWER_L, half) : DRAWER_L;
204
- const rw = both ? Math.min(DRAWER_R, half) : DRAWER_R;
205
- if (lOpen) tabbed(out, "left", s.left, s.active.left, RAIL, y, lw, h, !lDocked);
206
- else tabbedIntoRail(cat, out, "left", s.left, 0, y, DRAWER_L);
207
- if (rOpen) tabbed(out, "right", s.right, s.active.right, W - RAIL - rw, y, rw, h, !rDocked);
208
- else tabbedIntoRail(cat, out, "right", s.right, W - RAIL, y, DRAWER_R);
209
- out.set("toolbar", bar(W));
210
- return out;
211
- }
212
- function strip(cat, s, size, notes) {
213
- const out = /* @__PURE__ */ new Map();
214
- const { width: W, height: H } = size;
215
- const g = stripGeometry(cat, s, size, notes);
216
- g.cols.forEach((c, ci) => {
217
- const mins = c.map((k) => stripMin(cat, k));
218
- const heights = c.some(isDocKey) ? share(g.h - G * (c.length - 1), mins) : columnHeights(g.h, mins, G);
219
- let cy = g.y;
220
- c.forEach((k, i) => {
221
- 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] } });
222
- cy += heights[i] + G;
223
- });
224
- });
225
- const scrolls = g.total > W;
226
- 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` });
227
- out.set("track", { rect: rect(0, H - 5, W, 5), look: "track", layer: LAYER.toolbar, ...scrolls ? {} : { hidden: true } });
228
- const tw = scrolls ? W / g.total * W : W;
229
- out.set("thumb", { rect: rect(scrolls ? g.scroll / g.total * W : 0, H - 5, tw, 5), look: "thumb", layer: LAYER.toolbar, ...scrolls ? {} : { hidden: true } });
230
- out.set("toolbar", bar(W));
231
- return out;
232
- }
233
- function floatOver(cat, s, size, opt, notes) {
234
- const out = /* @__PURE__ */ new Map();
235
- const { area } = paletteArea(size, opt);
236
- const pals = palettes(cat, s, area, size.width, OVER_MARGIN, notes);
237
- const tb = pillBetween(opt, size, [...pals.values()].map((p) => p.rect));
238
- tiles(out, area, s.docs);
239
- let covered = 0;
240
- for (const [id, p] of pals) {
241
- out.set(panelKey(id), { rect: p.rect, look: p.shaded ? "header" : "float", layer: LAYER.float, shadow: true, ...p.shaded ? {} : { min: { height: cat.natural(id) } } });
242
- covered += p.rect.width * p.rect.height;
243
- }
244
- notes.push({ code: "palettes-cover", text: `palettes cover ${Math.round(covered / (area.width * area.height) * 100)}% of the documents` });
245
- out.set("toolbar", tb);
246
- return out;
247
- }
248
- function floatAround(cat, s, size, opt, notes) {
249
- const out = /* @__PURE__ */ new Map();
250
- const { area } = paletteArea(size, opt);
251
- const pals = palettes(cat, s, area, size.width, 0, notes);
252
- const tb = pillBetween(opt, size, [...pals.values()].map((p) => p.rect));
253
- const docsRect = aroundDocs(pals, area);
254
- tiles(out, docsRect, s.docs);
255
- let used = docsRect.width * docsRect.height;
256
- for (const [id, p] of pals) {
257
- out.set(panelKey(id), { rect: p.rect, look: p.shaded ? "header" : "palette", layer: LAYER.palette, shadow: true, ...p.shaded ? {} : { min: { height: cat.natural(id) } } });
258
- used += p.rect.width * p.rect.height;
259
- }
260
- 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` });
261
- out.set("toolbar", tb);
262
- return out;
263
- }
264
- var withNotes = (f) => (s, size, opt) => {
265
- const notes = [];
266
- const items = f(s, size, opt, notes);
267
- return { items, notes };
268
- };
269
- function createDesk(spec) {
270
- const cat = catalogOf(spec);
271
- const initial = (docs) => startState(cat, docs);
272
- const sides = (patch) => (docs) => {
273
- const s = startState(cat, docs);
274
- return { ...s, ...patch(s) };
275
- };
276
- const noBottom = sides((s) => ({ right: [...s.right, ...s.bottom], bottom: [] }));
277
- const plain = sides(() => ({}));
278
- const list = [
279
- {
280
- id: "docks",
281
- title: "Edge docks",
282
- 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.",
283
- pill: true,
284
- bottom: true,
285
- initial: plain,
286
- layout: withNotes((s, size, opt, notes) => docks(cat, s, size, opt, "between", notes))
287
- },
288
- {
289
- id: "docksFull",
290
- title: "Edge docks, full-width bottom dock",
291
- 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.",
292
- pill: true,
293
- bottom: true,
294
- initial: plain,
295
- layout: withNotes((s, size, opt, notes) => docks(cat, s, size, opt, "full", notes))
296
- },
297
- {
298
- id: "tree",
299
- title: "One tiling tree",
300
- 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.",
301
- pill: false,
302
- bottom: false,
303
- initial: (docs, size) => treeStart(cat, docs, size),
304
- layout: withNotes((s, size, _opt, notes) => tree(cat, s, size, notes))
305
- },
306
- {
307
- id: "navigator",
308
- title: "Navigator + inspector",
309
- 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.",
310
- pill: true,
311
- bottom: false,
312
- initial: noBottom,
313
- layout: withNotes((s, size, opt, notes) => navigator(cat, s, size, opt, notes))
314
- },
315
- {
316
- id: "strip",
317
- title: "Scrolling strip",
318
- 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.",
319
- pill: false,
320
- bottom: false,
321
- initial: plain,
322
- layout: withNotes((s, size, _opt, notes) => strip(cat, s, size, notes))
323
- },
324
- {
325
- id: "drawers",
326
- title: "Drawers",
327
- idea: "Documents take the screen; each side is a drawer with tabs. Wide, the drawers dock and push; narrow, they slide over the documents.",
328
- pill: false,
329
- bottom: false,
330
- initial: noBottom,
331
- layout: withNotes((s, size, _opt, notes) => drawers(cat, s, size, notes))
332
- },
333
- {
334
- id: "floatOver",
335
- title: "Floating palettes over the documents",
336
- 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.",
337
- pill: true,
338
- bottom: false,
339
- initial: plain,
340
- layout: withNotes((s, size, opt, notes) => floatOver(cat, s, size, opt, notes))
341
- },
342
- {
343
- id: "floatAround",
344
- title: "Floating palettes, documents tile around",
345
- 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.",
346
- pill: true,
347
- bottom: false,
348
- initial: plain,
349
- layout: withNotes((s, size, opt, notes) => floatAround(cat, s, size, opt, notes))
350
- },
351
- {
352
- id: "dockTear",
353
- title: "Edge docks + tear-off",
354
- 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.",
355
- pill: true,
356
- bottom: true,
357
- initial: plain,
358
- layout: withNotes((s, size, opt, notes) => {
359
- const out = docks(cat, s, size, opt, "between", notes);
360
- tornOff(cat, out, s, size, notes);
361
- return out;
362
- })
363
- }
364
- ];
365
- const constructions = [];
366
- const desk = {
367
- catalog: cat,
368
- constructions,
369
- constructionOf: (id) => constructions.find((c) => c.id === id),
370
- initialState: initial,
371
- natural: cat.natural,
372
- titleOf: cat.title
373
- };
374
- constructions.push(...list.map((c) => ({ ...c, desk })));
375
- return desk;
376
- }
377
- var draggable = (c, key) => key.startsWith("panel:") || key.startsWith("doc:") && (c.id === "tree" || c.id === "strip");
378
- export {
379
- DEFAULT_OPTIONS,
380
- G,
381
- LAYER,
382
- createDesk,
383
- docKey,
384
- draggable,
385
- idOf,
386
- isDocKey,
387
- isPanelKey,
388
- liftOut,
389
- panelKey,
390
- stripGeometry,
391
- toggleClosed,
392
- toggleFold,
393
- touch,
394
- withActive,
395
- withDocs
396
- };
397
- //# sourceMappingURL=dock.js.map
package/dist/dock.js.map DELETED
@@ -1 +0,0 @@
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,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AAA,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":[]}
@@ -1,37 +0,0 @@
1
- import { R as Rect } from './geometry-Bf37LbCT.js';
2
-
3
- /**
4
- * `fitFloat(rect, stage, avoid)`: the rect a float gets. It is moved (never resized) to lie inside the stage, then beside
5
- * whatever docked content it would cover: the nearest place inside the stage that is clear of every `avoid` rect (the
6
- * docked items' rects, in the same px). One larger than the stage keeps its top-left corner on the stage's; if no clear
7
- * place exists the float stays where it covers the least and `covers` says which rects.
8
- *
9
- * A clear place is found whenever one exists: the x's are tried nearest first and, for each, the blocked stretches of y
10
- * are merged and skipped, so no clear place is missed however many places lie between. Cost (measured in a test run on
11
- * a laptop): about 100 docked rects 0.1 ms, 300 a few ms even when no place is clear (6 ms median, 15 ms worst), 1,000
12
- * about 17 ms; a safety net stops the clear search after 3 million rect tests and says so in `searchCapped`; a stage
13
- * with no clear place looks at the 2,048 nearest places for the least covered.
14
- *
15
- * The Scene's floats are fitted with it (`solve`), and `./scene` exports it. It lives at the root, beside the geometry,
16
- * so the deprecated `./stack` floats reach it without a door into `./scene`.
17
- */
18
-
19
- interface FloatFit {
20
- /** The float's rect: inside the stage and clear of the docked content where a clear place exists. */
21
- readonly rect: Rect;
22
- /** It was moved to lie inside the stage. */
23
- readonly clamped: boolean;
24
- /** It was moved beside the docked content it would have covered. */
25
- readonly snapped: boolean;
26
- /**
27
- * Indexes into `avoid` of the rects it still covers. Empty whenever a clear place was found, which is whenever one
28
- * exists (unless `searchCapped`); not empty only when the stage has no clear place for the float, and then it stays
29
- * where it covers the least among the 2,048 nearest candidate places.
30
- */
31
- readonly covers: readonly number[];
32
- /** The safety net on the clear search was hit (thousands of rects): the place found may not be the nearest, or a clear place may exist that was not found. Normally false. */
33
- readonly searchCapped: boolean;
34
- }
35
- declare function fitFloat(want: Rect, stage: Rect, avoid?: readonly Rect[]): FloatFit;
36
-
37
- export { type FloatFit as F, fitFloat as f };