@graview/pages 0.1.74 → 0.2.0

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.
@@ -0,0 +1,434 @@
1
+ /*
2
+ * PAGES AND THE SCENE ARE ONE PLACE: THE ARITHMETIC
3
+ * (Graview HQ feature:f-page-zooms-out-to-the-city).
4
+ *
5
+ * Pure, no DOM. One number says where a person is: the ALTITUDE, from 0
6
+ * (the page, the whole window) through 1 (the page as a panel beside its
7
+ * place in the city) to 2 (the city, every page and view of the app a
8
+ * board standing on its place, this page among them). It is not a mode: it
9
+ * is read off the Scene's own camera — how close it is — so a slow pinch
10
+ * moves everything a little, and the levels are where it rests when let go.
11
+ * From it follow the page's box, where it stands, and where the camera aims.
12
+ *
13
+ * THE PROJECTION IS THE CITY'S OWN. The city is drawn isometric, its ground
14
+ * a 2:1 lattice, and in that projection the ground's diagonal that runs
15
+ * across the window is level on the window. A board standing upright along
16
+ * that diagonal is therefore drawn as an upright rectangle: no shear, no
17
+ * turn, no perspective, at every zoom — only moved and scaled, as the
18
+ * camera moves and scales everything else. So a page goes into its board by
19
+ * translation and uniform scale alone, and the boards keep their shape as
20
+ * the camera rises or falls.
21
+ */
22
+ /** How wide a desk's panel may be, and how high a phone's sheet may stand (the share above it), on this window. */
23
+ export function panelRange(view) {
24
+ // A phone's sheet never rises so far that the city above it is lost under the control: it keeps the control's room and a band of city.
25
+ if (phoneOf(view))
26
+ return { min: Math.min(0.4, Math.max(0.15, (CONTROL_ROOM + 180) / Math.max(1, view.height - (view.top ?? 0)))), max: 0.7, default: 0.4 };
27
+ const fallback = Math.round(Math.max(420, Math.min(760, view.width * 0.36)));
28
+ return { min: Math.min(fallback, 360), max: Math.max(fallback, Math.round(view.width * 0.72)), default: fallback };
29
+ }
30
+ /** The levels: the page, the panel beside the city, the city. */
31
+ export const PAGE = 0;
32
+ export const PANEL = 1;
33
+ export const CITY = 2;
34
+ export const LEVELS = CITY;
35
+ /** What each level is called, where a person is told it. */
36
+ export const LEVEL_NAMES = ["Page", "Nearby", "City"];
37
+ /** The height the control at the foot keeps on a phone, above the sheet, with its margin. */
38
+ export const CONTROL_ROOM = 72;
39
+ /** A window narrower than this is a phone's: the panel a sheet from the foot. */
40
+ export const PHONE = 600;
41
+ const phoneOf = (view) => view.width <= PHONE;
42
+ /**
43
+ * HOW CLOSE THE SCENE'S CAMERA IS AT EACH LEVEL — its own zoom from
44
+ * altitude, where 1 is the whole city fitted to the window — closest at
45
+ * the page and furthest at the city, so pulling back from a page is the
46
+ * camera rising. The page's own (level 0) is where the camera waits, a
47
+ * little closer than the panel's, so stepping out begins as a pull back.
48
+ */
49
+ export function levelZooms(where, view) {
50
+ if (where.type === "record") {
51
+ const panel = phoneOf(view) ? 2 : 2.2;
52
+ return [Math.min(2.9, panel * 1.3), panel, 1];
53
+ }
54
+ if (where.type === "home" || where.type === "overview")
55
+ return [1.8, 1.4, 1];
56
+ return [2.1, 1.6, 1];
57
+ }
58
+ /**
59
+ * THE ALTITUDE A ZOOM IS AT: between two levels, as far between them as the
60
+ * zoom is, on the ratio (so each step of a pinch moves it as much). Held
61
+ * within the page and the city.
62
+ */
63
+ export function altitudeAt(zoom, zooms) {
64
+ if (zoom >= zooms[0])
65
+ return 0;
66
+ for (let level = 0; level < zooms.length - 1; level++) {
67
+ const near = zooms[level];
68
+ const far = zooms[level + 1];
69
+ if (zoom <= near && zoom >= far)
70
+ return level + Math.log(near / zoom) / Math.log(near / far);
71
+ }
72
+ return zooms.length - 1;
73
+ }
74
+ /** The zoom an altitude is at: `altitudeAt` the other way. */
75
+ export function zoomAtAltitude(altitude, zooms) {
76
+ const a = Math.max(0, Math.min(zooms.length - 1, altitude));
77
+ const level = Math.min(zooms.length - 2, Math.floor(a));
78
+ const near = zooms[level];
79
+ const far = zooms[level + 1];
80
+ return near * Math.pow(far / near, a - level);
81
+ }
82
+ /** The level an altitude rests at when let go: the nearest. */
83
+ export const restingLevel = (altitude) => Math.max(PAGE, Math.min(CITY, Math.round(altitude)));
84
+ /**
85
+ * THE PANEL'S BOX: on a desk a column at the window's right, the city to
86
+ * its left; on a phone a sheet from the foot, the city above it.
87
+ */
88
+ export function panelBox(view) {
89
+ const bar = view.top ?? 0;
90
+ const range = panelRange(view);
91
+ const asked = view.panel === undefined ? range.default : Math.max(range.min, Math.min(range.max, view.panel));
92
+ if (phoneOf(view)) {
93
+ const top = Math.round(bar + (view.height - bar) * asked);
94
+ return { x: 8, y: top, width: view.width - 16, height: view.height - top - 8 };
95
+ }
96
+ const width = Math.round(asked);
97
+ return { x: view.width - width - 12, y: bar + 12, width, height: view.height - bar - 24 };
98
+ }
99
+ /** Where the place stands on the window: beside the panel at the page and the panel, the city's middle at the city. */
100
+ export function aimAt(level, view, room = CONTROL_ROOM) {
101
+ const bar = view.top ?? 0;
102
+ if (level <= PANEL) {
103
+ const panel = panelBox(view);
104
+ // On a phone the control (and the legend, when it is open) rides at the foot of the city, above the sheet: the place is aimed in what they leave, never less than half of it.
105
+ const kept = Math.max(CONTROL_ROOM, Math.min(room, (panel.y - bar) / 2));
106
+ if (phoneOf(view))
107
+ return { x: view.width / 2, y: (bar + panel.y - kept) / 2 };
108
+ // At a desk the control and the legend stand at the foot of the city's column: the place is aimed in what they leave above them.
109
+ const foot = Math.max(0, Math.min(room - CONTROL_ROOM, (view.height - bar) / 2));
110
+ return { x: panel.x / 2, y: bar + (view.height - bar - foot) / 2 };
111
+ }
112
+ // A little below the middle of what the bar leaves: the boards rise from the city, and want the room above it.
113
+ return { x: view.width / 2, y: bar + (view.height - bar) * 0.56 };
114
+ }
115
+ const lerp = (a, b, t) => a + (b - a) * t;
116
+ const ease = (t) => (t <= 0 ? 0 : t >= 1 ? 1 : t * t * (3 - 2 * t));
117
+ /** The page's box at an altitude: the window at 0, the panel from 1 on, every step between drawn. */
118
+ export function pageBox(altitude, view) {
119
+ // The page under the bar: the window less the bar, which stays where it is.
120
+ const bar = view.top ?? 0;
121
+ const full = { x: 0, y: bar, width: view.width, height: view.height - bar };
122
+ const panel = panelBox(view);
123
+ const t = ease(Math.min(1, Math.max(0, altitude)));
124
+ return { x: lerp(full.x, panel.x, t), y: lerp(full.y, panel.y, t), width: lerp(full.width, panel.width, t), height: lerp(full.height, panel.height, t) };
125
+ }
126
+ /*
127
+ * THE BOARDS. Every page and view of the app stands in the city as a board:
128
+ * an upright face, its foot on its place. A board is what a page is at the
129
+ * city — the page's own top, cut to a board's proportion — so the page a
130
+ * person was reading becomes its own board by moving and shrinking, and the
131
+ * others are drawn the same way.
132
+ */
133
+ /** A board's width in the city's own pixels, at the city's zoom (1). */
134
+ export const BOARD_WIDTH = 96;
135
+ /** A board's width at the city's zoom on this window: a fifth of a phone's width, at most `BOARD_WIDTH`. The city is fitted to the window, so the boards are sized with it. */
136
+ export const boardWidthFor = (view) => Math.round(Math.max(64, Math.min(BOARD_WIDTH, view.width * 0.18)));
137
+ /** A board is this much wider than it is tall. */
138
+ export const BOARD_ASPECT = 1.5;
139
+ /** How tall a page is cut as it becomes its board: its own width over the board's proportion. */
140
+ export const boardCut = (panel) => panel.width / BOARD_ASPECT;
141
+ export function standingAt(altitude, panel, foot, width) {
142
+ const t = ease(Math.max(0, Math.min(1, altitude - PANEL)));
143
+ const height = lerp(panel.height, boardCut(panel), t);
144
+ const from = { x: panel.x + panel.width / 2, y: panel.y + height };
145
+ const scale = Math.exp(lerp(0, Math.log(width / panel.width), t));
146
+ return { x: lerp(0, foot.x - from.x, t), y: lerp(0, foot.y - from.y, t), scale, height };
147
+ }
148
+ /** The standing as CSS, about the page's foot (`SHEET_ORIGIN`): a translation and a uniform scale, nothing else. */
149
+ export function standingCss(standing) {
150
+ if (standing.x === 0 && standing.y === 0 && standing.scale === 1)
151
+ return "none";
152
+ return `translate(${standing.x.toFixed(2)}px, ${standing.y.toFixed(2)}px) scale(${standing.scale.toFixed(5)})`;
153
+ }
154
+ /** The transform's origin: the middle of the page's foot. */
155
+ export const SHEET_ORIGIN = "50% 100%";
156
+ export const LEVEL_LIVE = { x: 0, y: 0, s: 1 };
157
+ /** Where the camera puts a point of the picture. */
158
+ export const project = (live, p) => ({ x: p.x * live.s + live.x, y: p.y * live.s + live.y });
159
+ /** The camera that grows the picture by `s` and puts its point `p` at the window's point `at`. */
160
+ export const cameraPutting = (p, at, s) => ({ s, x: at.x - p.x * s, y: at.y - p.y * s });
161
+ /**
162
+ * BETWEEN TWO CAMERAS, AS FAR AS `t`: the place the page stands on moves in
163
+ * a straight line on the window while the picture grows or shrinks
164
+ * steadily, so it never swings out of the way and back.
165
+ */
166
+ export function cameraBetween(from, to, about, t) {
167
+ const a = project(from, about);
168
+ const b = project(to, about);
169
+ const s = Math.exp(lerp(Math.log(from.s), Math.log(to.s), t));
170
+ return cameraPutting(about, { x: lerp(a.x, b.x, t), y: lerp(a.y, b.y, t) }, s);
171
+ }
172
+ /** The smallest box around boxes, or null for none. */
173
+ export function unionOf(boxes) {
174
+ if (boxes.length === 0)
175
+ return null;
176
+ const left = Math.min(...boxes.map((box) => box.x));
177
+ const top = Math.min(...boxes.map((box) => box.y));
178
+ const right = Math.max(...boxes.map((box) => box.x + box.width));
179
+ const bottom = Math.max(...boxes.map((box) => box.y + box.height));
180
+ return { x: left, y: top, width: right - left, height: bottom - top };
181
+ }
182
+ const middleOf = (box) => ({ x: box.x + box.width / 2, y: box.y + box.height / 2 });
183
+ const inside = (point, box) => point.x > box.x && point.x < box.x + box.width && point.y > box.y && point.y < box.y + box.height;
184
+ /**
185
+ * WHERE A PLACE OF SEVERAL KINDS STANDS: where their districts meet — the
186
+ * middle of their middles — unless that falls inside one kind's district,
187
+ * when it stands on a plaza at the city's edge, above the districts it
188
+ * shows. Never inside one kind's district.
189
+ */
190
+ export function meetingOf(districts, all) {
191
+ if (districts.length === 0)
192
+ return null;
193
+ const middles = districts.map(middleOf);
194
+ const meet = { x: middles.reduce((sum, one) => sum + one.x, 0) / middles.length, y: middles.reduce((sum, one) => sum + one.y, 0) / middles.length };
195
+ if (districts.length > 1 && !all.some((box) => inside(meet, box)))
196
+ return meet;
197
+ const around = unionOf(all.length > 0 ? all : districts);
198
+ return { x: meet.x, y: around.y - 12 };
199
+ }
200
+ /**
201
+ * THE POINT OF THE PICTURE A PAGE STANDS ON: its building's roof, its
202
+ * district's middle, where its districts meet, or — the home — a plaza at
203
+ * the city's back edge, over all of it.
204
+ */
205
+ export function anchorOf(where, place) {
206
+ if (where.type === "record" && place.building)
207
+ return { x: place.building.x + place.building.width / 2, y: place.building.y + place.building.height * 0.3 };
208
+ if ((where.type === "record" || where.type === "list") && place.district)
209
+ return middleOf(place.district);
210
+ if (where.type === "place")
211
+ return place.districts?.length === 1 ? middleOf(place.districts[0]) : meetingOf(place.districts ?? [], place.all ?? []);
212
+ const city = unionOf(place.all ?? []);
213
+ return city ? middleOf(city) : null;
214
+ }
215
+ /**
216
+ * WHERE A PAGE'S BOARD STANDS: on a district, at its back corner, so the
217
+ * board rises behind the district's buildings rather than in front of them; on a
218
+ * record, on its building's roof; the home, at the city's back edge.
219
+ */
220
+ export function footOf(where, place) {
221
+ if (where.type === "record" && place.building)
222
+ return { x: place.building.x + place.building.width / 2, y: place.building.y + place.building.height * 0.3 };
223
+ // The district's back corner: the top of its tile as the window has it.
224
+ const back = (box) => ({ x: box.x + box.width / 2, y: box.y + 2 });
225
+ if ((where.type === "record" || where.type === "list") && place.district)
226
+ return back(place.district);
227
+ if (where.type === "place") {
228
+ if (place.districts?.length === 1)
229
+ return back(place.districts[0]);
230
+ return meetingOf(place.districts ?? [], place.all ?? []);
231
+ }
232
+ const city = unionOf(place.all ?? []);
233
+ return city ? { x: city.x + city.width / 2, y: city.y - 8 } : null;
234
+ }
235
+ /**
236
+ * WHERE A LINE LEAVES THE PAGE: from the page's edge that faces the city —
237
+ * its left at a desk, its top on a phone — level with the part it is
238
+ * about, so no line is drawn across the words of the page.
239
+ */
240
+ export function leaveFrom(part, page, phone) {
241
+ if (phone)
242
+ return { x: Math.max(page.x + 12, Math.min(page.x + page.width - 12, part.x)), y: page.y };
243
+ return { x: page.x, y: Math.max(page.y + 12, Math.min(page.y + page.height - 12, part.y)) };
244
+ }
245
+ /**
246
+ * A LINE THAT WOULD END UNDER THE PAGE ends at the page's edge nearest its
247
+ * building instead, an arrow there pointing on toward it. Null when the
248
+ * building is not under the page.
249
+ */
250
+ export function edgeToward(to, page) {
251
+ if (!inside(to, page))
252
+ return null;
253
+ const edges = [
254
+ { x: page.x, y: to.y },
255
+ { x: page.x + page.width, y: to.y },
256
+ { x: to.x, y: page.y },
257
+ { x: to.x, y: page.y + page.height },
258
+ ];
259
+ return edges.reduce((best, p) => (Math.hypot(p.x - to.x, p.y - to.y) < Math.hypot(best.x - to.x, best.y - to.y) ? p : best));
260
+ }
261
+ /**
262
+ * THE NEAREST BOARD IN A DIRECTION, for the arrow keys: among the boxes
263
+ * whose middle lies that way, the one nearest, the way it points counting
264
+ * double against the way across. Null when there is none that way.
265
+ */
266
+ export function nearestThatWay(from, others, way) {
267
+ const at = middleOf(from);
268
+ let best = null;
269
+ for (const other of others) {
270
+ const m = middleOf(other.box);
271
+ const dx = m.x - at.x;
272
+ const dy = m.y - at.y;
273
+ const along = way === "left" ? -dx : way === "right" ? dx : way === "up" ? -dy : dy;
274
+ const across = way === "left" || way === "right" ? Math.abs(dy) : Math.abs(dx);
275
+ if (along <= 1)
276
+ continue;
277
+ const cost = along + across * 2;
278
+ if (!best || cost < best.cost)
279
+ best = { key: other.key, cost };
280
+ }
281
+ return best?.key ?? null;
282
+ }
283
+ /*
284
+ * THE VIEWS STAND ON THEIR DISTRICTS. A view of one kind stands as a sign in
285
+ * the ground the city keeps for it under its district's name — the layout
286
+ * holds that room (`LayoutOptions.standing`), so no other district's name
287
+ * is placed on it — three to a row, the rows one behind another down the
288
+ * ground; a view of several kinds, or of none (the home, the connections),
289
+ * stands on the plaza at the city's back edge, the rows rising behind it.
290
+ * Each sign is an upright card on a short post, facing the camera: in the
291
+ * city's projection a face along the level diagonal is drawn as it is.
292
+ */
293
+ /** Signs side by side in a row before another stands behind. */
294
+ export const SIGNS_PER_ROW = 3;
295
+ /** The post a sign stands on, and the room between signs, in the city's pixels at its zoom. */
296
+ export const SIGN_POST = 10;
297
+ export const SIGN_GAP = 8;
298
+ /** The room a district keeps under its name for so many signs this wide: what the layout is asked to hold. */
299
+ export function signRoom(count, width) {
300
+ const rows = Math.ceil(count / SIGNS_PER_ROW);
301
+ const cols = Math.min(count, SIGNS_PER_ROW);
302
+ return { width: cols * width + (cols - 1) * SIGN_GAP, height: rows * (width / BOARD_ASPECT + SIGN_POST + SIGN_GAP) };
303
+ }
304
+ /**
305
+ * WHERE EACH SIGN'S CARD STANDS — the middle of its foot, where its post
306
+ * meets it — for signs in rows from a point: `down` from the top of the
307
+ * room under a district's name (the first row at the top), or `up` from the
308
+ * plaza's front edge (the first row in front, the rest rising behind).
309
+ */
310
+ export function signFeet(keys, from, width, way) {
311
+ const height = width / BOARD_ASPECT;
312
+ const step = height + SIGN_POST + SIGN_GAP;
313
+ const feet = new Map();
314
+ keys.forEach((key, index) => {
315
+ const row = Math.floor(index / SIGNS_PER_ROW);
316
+ const inRow = Math.min(SIGNS_PER_ROW, keys.length - row * SIGNS_PER_ROW);
317
+ const col = index % SIGNS_PER_ROW;
318
+ const x = from.x + (col - (inRow - 1) / 2) * (width + SIGN_GAP);
319
+ const y = way === "down" ? from.y + row * step + height : from.y - SIGN_POST - row * step;
320
+ feet.set(key, { x, y });
321
+ });
322
+ return feet;
323
+ }
324
+ /**
325
+ * THE CAMERA THAT FITS THE CITY AND ITS VIEWS into the part of the window
326
+ * nothing stands over — below the bar, above the control at the foot — with
327
+ * a margin: how much closer (or further) than now, and where.
328
+ */
329
+ export function fitCamera(around, area, margin = 16, most = Infinity) {
330
+ const room = { x: area.x + margin, y: area.y + margin, width: Math.max(1, area.width - 2 * margin), height: Math.max(1, area.height - 2 * margin) };
331
+ const s = Math.min(most, room.width / Math.max(1, around.width), room.height / Math.max(1, around.height));
332
+ return cameraPutting({ x: around.x + around.width / 2, y: around.y + around.height / 2 }, { x: room.x + room.width / 2, y: room.y + room.height / 2 }, s);
333
+ }
334
+ /**
335
+ * THE CITY FITTED BESIDE WHAT STANDS AT THE FOOT. The control, the legend
336
+ * over it when it is open, and the timeline beside them each keep their
337
+ * rect: the city is fitted either above all of them, or to the right of
338
+ * them and above the control, whichever draws it larger — never under any.
339
+ */
340
+ export function fitBeside(around, view, reserved, margin = 16, most = Infinity) {
341
+ const bar = view.top ?? 0;
342
+ const whole = { x: 0, y: bar, width: view.width, height: view.height - bar };
343
+ const kept = reserved.filter((box) => box.width > 0 && box.height > 0);
344
+ if (kept.length === 0)
345
+ return fitCamera(around, whole, margin, most);
346
+ const top = Math.min(...kept.map((box) => box.y));
347
+ const right = Math.max(...kept.map((box) => box.x + box.width));
348
+ const above = fitCamera(around, { x: 0, y: bar, width: view.width, height: Math.max(1, top - bar) }, margin, most);
349
+ // Beside them, above the line of what stands lowest (the control itself): nothing is drawn down at the window's foot.
350
+ const lowest = Math.max(...kept.map((box) => box.y + box.height));
351
+ const foot = Math.min(...kept.filter((box) => box.y + box.height >= lowest - 1).map((box) => box.y));
352
+ const beside = fitCamera(around, { x: right, y: bar, width: Math.max(1, view.width - right), height: Math.max(1, foot - bar) }, margin, most);
353
+ return beside.s > above.s ? beside : above;
354
+ }
355
+ const clampTo = (p, box) => ({ x: Math.max(box.x, Math.min(box.x + box.width, p.x)), y: Math.max(box.y, Math.min(box.y + box.height, p.y)) });
356
+ const grown = (box, by) => ({ x: box.x - by, y: box.y - by, width: box.width + 2 * by, height: box.height + 2 * by });
357
+ const inBox = (p, box) => p.x >= box.x && p.x <= box.x + box.width && p.y >= box.y && p.y <= box.y + box.height;
358
+ /** A point of the curve from `from` through `bend` to `to`, as far as `t`. */
359
+ export const curveAt = (from, bend, to, t) => ({
360
+ x: (1 - t) ** 2 * from.x + 2 * (1 - t) * t * bend.x + t * t * to.x,
361
+ y: (1 - t) ** 2 * from.y + 2 * (1 - t) * t * bend.y + t * t * to.y,
362
+ });
363
+ /** Whether no point of the curve falls inside any of the boxes. */
364
+ export function curveClear(from, bend, to, boxes, steps = 48) {
365
+ if (boxes.length === 0)
366
+ return true;
367
+ for (let i = 1; i < steps; i++) {
368
+ const p = curveAt(from, bend, to, i / steps);
369
+ if (boxes.some((box) => inside(p, box)))
370
+ return false;
371
+ }
372
+ return true;
373
+ }
374
+ /** How far a line's end keeps from the page's edge: its ring's reach, and the panel's edge that is dragged there. */
375
+ export const END_ROOM = 20;
376
+ /** How far a line keeps from what is reserved: its stroke and a little air. */
377
+ const KEEP_OFF = 3;
378
+ /** And how far its end ring reaches. */
379
+ const RING = 9;
380
+ export function routeLine(given, target, area, phone, reserved = []) {
381
+ const keepOut = reserved.filter((box) => box.width > 0 && box.height > 0).map((box) => grown(box, KEEP_OFF));
382
+ // The line starts where the page's edge meets the city's part: never beside the control, below or past it.
383
+ let from = phone ? { x: Math.max(area.x, Math.min(area.x + area.width, given.x)), y: given.y } : { x: given.x, y: Math.max(area.y, Math.min(area.y + area.height, given.y)) };
384
+ // Something standing on that edge (a phone's control rides on the sheet's top): the line leaves the edge past it.
385
+ for (let step = 0; step < keepOut.length; step++) {
386
+ const on = keepOut.find((box) => (phone ? from.x >= box.x && from.x <= box.x + box.width && box.y + box.height >= from.y - 40 && box.y <= from.y : from.y >= box.y && from.y <= box.y + box.height && box.x + box.width >= from.x - 40 && box.x <= from.x));
387
+ if (!on)
388
+ break;
389
+ from = phone ? { x: on.x + on.width + 8, y: from.y } : { x: from.x, y: on.y - 8 };
390
+ }
391
+ if (phone ? from.x > area.x + area.width : from.y < area.y)
392
+ return null;
393
+ // The end keeps clear of the page's edge, by its ring and the edge that is dragged there.
394
+ const ends = phone ? { ...area, height: Math.max(0, area.height - END_ROOM) } : { ...area, width: Math.max(0, area.width - END_ROOM) };
395
+ let to = inBox(target, ends) ? target : clampTo(target, ends);
396
+ // An end under what is reserved stops at its nearest edge instead, pointing on.
397
+ const under = keepOut.find((box) => inside(to, grown(box, RING)));
398
+ if (under) {
399
+ const out = grown(under, RING + 1);
400
+ const at = to;
401
+ const ways = [
402
+ { x: at.x, y: out.y },
403
+ { x: out.x + out.width, y: at.y },
404
+ { x: out.x, y: at.y },
405
+ { x: at.x, y: out.y + out.height },
406
+ ].filter((p) => inBox(p, ends) && !keepOut.some((box) => inside(p, grown(box, RING))));
407
+ if (ways.length === 0)
408
+ return null;
409
+ to = ways.reduce((best, p) => (Math.hypot(p.x - at.x, p.y - at.y) < Math.hypot(best.x - at.x, best.y - at.y) ? p : best));
410
+ }
411
+ const toward = to.x === target.x && to.y === target.y ? null : target;
412
+ /*
413
+ * THE BEND: out along the edge's normal and never past the city's part —
414
+ * every point of the curve lies between its ends and this one — as near
415
+ * the edge as lets the curve keep off everything reserved.
416
+ */
417
+ const reach = Math.min(80, Math.max(16, Math.hypot(to.x - from.x, to.y - from.y) / 2));
418
+ const span = phone ? from.y - area.y : from.x - area.x;
419
+ for (let out = reach; out <= Math.max(reach, span) + 12; out += 12) {
420
+ const bend = clampTo(phone ? { x: from.x, y: from.y - out } : { x: from.x - out, y: from.y }, area);
421
+ if (curveClear(from, bend, to, keepOut))
422
+ return { from, to, toward, bend };
423
+ }
424
+ return null;
425
+ }
426
+ /** The part of the window the city is seen in beside the page: left of it at a desk, above it on a phone; under the bar, above the control. */
427
+ export function cityArea(page, view, control, phone) {
428
+ const top = (view.top ?? 0) + 6;
429
+ // Above the control: on a phone it rides on the sheet, so the city's part ends over it.
430
+ const bottom = phone ? page.y - 6 : Math.min(view.height - 6, control ? control.y - 6 : Infinity);
431
+ const right = phone ? view.width - 6 : page.x - 6;
432
+ return { x: 6, y: top, width: Math.max(0, right - 6), height: Math.max(0, bottom - top) };
433
+ }
434
+ //# sourceMappingURL=one-place-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-place-geometry.js","sourceRoot":"","sources":["../src/one-place-geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAuBH,m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@@ -0,0 +1,79 @@
1
+ import { type AnySchema } from "@graview/core";
2
+ import { type ReactNode, type RefObject } from "react";
3
+ import { type PageContext } from "./page-context.js";
4
+ import { PHONE, type PageWhere } from "./one-place-geometry.js";
5
+ /** What the frame asks the camera for, read by the city part each frame. */
6
+ export interface Motion {
7
+ /** A level to move to (the button, a key, a press), taken when it is read. */
8
+ level: number | null;
9
+ /** How far a hand on the page has scrubbed the altitude since the last frame. */
10
+ scrub: number;
11
+ /** A scrub under way, until the hand lets go. */
12
+ scrubbing: boolean;
13
+ /** Fingers on the glass: nothing settles while they are. */
14
+ held: boolean;
15
+ /** The panel's edge being dragged: the camera follows it, and is written into the view when let go. */
16
+ resizing: boolean;
17
+ }
18
+ /** One of the app's pages and views, as it stands in the city: a board. */
19
+ export interface Board {
20
+ readonly key: string;
21
+ readonly label: string;
22
+ /** Its path on this face. */
23
+ readonly path: string;
24
+ /** What it is, said over its title: the home, a list, a view, a record. */
25
+ /** What it is, said to a screen reader: the home, a list, a view, a record's page. */
26
+ readonly eyebrow: string;
27
+ /** What it shows, live: the first few of its records' names, drawn on its sign. */
28
+ readonly lines: readonly string[];
29
+ readonly kind?: string | undefined;
30
+ readonly where: PageWhere;
31
+ }
32
+ /** What the city part is handed. */
33
+ export interface OnePlaceCityProps {
34
+ /** The place the page stands on. */
35
+ readonly where: PageWhere;
36
+ /** Whether the page has left the window (or is asked to): the Scene is drawn, and its view is the overview, only then. */
37
+ readonly out: boolean;
38
+ /** The page's own element: the one thing that moves between the levels. */
39
+ readonly sheet: RefObject<HTMLDivElement | null>;
40
+ /** The Connected list's box in the page, grown as the page becomes the panel. */
41
+ readonly connected: RefObject<HTMLDivElement | null>;
42
+ /** The boards, and which is this page's. */
43
+ readonly boards: readonly Board[];
44
+ readonly current: string;
45
+ /** Each board's button, by key, and the layer that holds them. */
46
+ readonly boardEls: RefObject<Map<string, HTMLButtonElement>>;
47
+ readonly boardLayer: RefObject<HTMLDivElement | null>;
48
+ /** The button that moves a level: a phone's rides above the sheet. */
49
+ readonly fab: RefObject<HTMLDivElement | null>;
50
+ readonly view: {
51
+ readonly width: number;
52
+ readonly height: number;
53
+ readonly top: number;
54
+ readonly panel?: number;
55
+ };
56
+ readonly lessMotion: boolean;
57
+ /** What an address on the page is: a record, a kind's list, or nothing of the city's. */
58
+ readonly resolve: (pathname: string) => PageWhere | null;
59
+ /** That record (or that kind's list), at a level. */
60
+ readonly openRecord: (id: string, level: number) => void;
61
+ readonly openKind: (kind: string, level: number) => void;
62
+ /** A press on bare ground: at the city, no view chosen. */
63
+ readonly onGround: () => void;
64
+ readonly motion: {
65
+ readonly current: Motion;
66
+ };
67
+ /** Told as the level rested at or headed for, whether the page is out of the window, or whether it is moving, changes. */
68
+ readonly onAltitude: (now: {
69
+ readonly level: number;
70
+ readonly away: boolean;
71
+ readonly moving: boolean;
72
+ }) => void;
73
+ }
74
+ export declare function OnePlace<S extends AnySchema>({ context, children }: {
75
+ readonly context: PageContext<S>;
76
+ readonly children: ReactNode;
77
+ }): import("react").JSX.Element;
78
+ export { PHONE };
79
+ //# sourceMappingURL=one-place.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-place.d.ts","sourceRoot":"","sources":["../src/one-place.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmD,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAIhG,OAAO,EAAiO,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtR,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAInE,OAAO,EAAkF,KAAK,EAAY,KAAK,SAAS,EAAa,MAAM,yBAAyB,CAAC;AAqCrK,4EAA4E;AAC5E,MAAM,WAAW,MAAM;IACrB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;IACnB,4D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