@graview/pages 0.1.73 → 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.
- package/README.md +14 -0
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +11 -1
- package/dist/context-menu.js.map +1 -1
- package/dist/device.d.ts +146 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/device.js +564 -0
- package/dist/device.js.map +1 -0
- package/dist/face-controls.d.ts.map +1 -1
- package/dist/face-controls.js +17 -2
- package/dist/face-controls.js.map +1 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +3 -0
- package/dist/form.js.map +1 -1
- package/dist/one-place-city.d.ts +9 -0
- package/dist/one-place-city.d.ts.map +1 -0
- package/dist/one-place-city.js +960 -0
- package/dist/one-place-city.js.map +1 -0
- package/dist/one-place-control.d.ts +28 -0
- package/dist/one-place-control.d.ts.map +1 -0
- package/dist/one-place-control.js +5 -0
- package/dist/one-place-control.js.map +1 -0
- package/dist/one-place-geometry.d.ts +226 -0
- package/dist/one-place-geometry.d.ts.map +1 -0
- package/dist/one-place-geometry.js +434 -0
- package/dist/one-place-geometry.js.map +1 -0
- package/dist/one-place.d.ts +79 -0
- package/dist/one-place.d.ts.map +1 -0
- package/dist/one-place.js +1115 -0
- package/dist/one-place.js.map +1 -0
- package/dist/page-context.d.ts +9 -0
- package/dist/page-context.d.ts.map +1 -1
- package/dist/page-context.js +3 -0
- package/dist/page-context.js.map +1 -1
- package/dist/page-home.d.ts.map +1 -1
- package/dist/page-home.js +2 -2
- package/dist/page-home.js.map +1 -1
- package/dist/page-search.d.ts.map +1 -1
- package/dist/page-search.js +32 -4
- package/dist/page-search.js.map +1 -1
- package/dist/page-shell.d.ts.map +1 -1
- package/dist/page-shell.js +55 -10
- package/dist/page-shell.js.map +1 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +17 -3
- package/dist/router.js.map +1 -1
- package/dist/static-read.d.ts +45 -0
- package/dist/static-read.d.ts.map +1 -0
- package/dist/static-read.js +100 -0
- package/dist/static-read.js.map +1 -0
- package/dist/static.d.ts.map +1 -1
- package/dist/static.js +5 -80
- package/dist/static.js.map +1 -1
- package/package.json +10 -6
|
@@ -0,0 +1,960 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { labelOf, ONE_FACE_LAYERS } from "@graview/core";
|
|
3
|
+
import { EMPTY_VIEW, toUrl, withOverview } from "@graview/layout/view";
|
|
4
|
+
import { Scene } from "@graview/react";
|
|
5
|
+
import { useGraview, useNavigation } from "@graview/react/provider";
|
|
6
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
7
|
+
import { aimAt, altitudeAt, anchorOf, BOARD_ASPECT, boardWidthFor, fitBeside, SIGN_GAP, SIGN_POST, signFeet, signRoom, cameraBetween, cameraPutting, CITY, cityArea, footOf, leaveFrom, routeLine, LEVEL_LIVE, levelZooms, PAGE, pageBox, PANEL, panelBox, PHONE, project, restingLevel, SHEET_ORIGIN, standingAt, standingCss, unionOf } from "./one-place-geometry.js";
|
|
8
|
+
/*
|
|
9
|
+
* THE CITY UNDER THE PAGE, AND ONE CAMERA OVER BOTH
|
|
10
|
+
* (Graview HQ feature:f-page-zooms-out-to-the-city).
|
|
11
|
+
*
|
|
12
|
+
* The Scene itself, in the provider the pages draw with, at its overview:
|
|
13
|
+
* `layout` → `placeCity`, its plots, its buildings, its streets. Over it,
|
|
14
|
+
* nothing but the page the person was reading — the same element at every
|
|
15
|
+
* altitude — and the lines from its parts to their buildings.
|
|
16
|
+
*
|
|
17
|
+
* ONE FRAME, ONE NUMBER. Each animation frame reads the Scene's own camera
|
|
18
|
+
* (its committed zoom and the move between stops it is painting, `live`)
|
|
19
|
+
* and turns it into the ALTITUDE — or, while this face is moving the
|
|
20
|
+
* camera itself (Up, Down, a pinch on the page), sets that camera from the
|
|
21
|
+
* altitude. From the altitude in that frame follow the page's box, how it
|
|
22
|
+
* stands, how much of the Connected list has grown in, the city's fade,
|
|
23
|
+
* and the lines: each line's building end is the building's place in the
|
|
24
|
+
* picture carried through that same camera, and its page end is read from
|
|
25
|
+
* the page after its own transform for that frame is written. Nothing is
|
|
26
|
+
* read from a frame before.
|
|
27
|
+
*
|
|
28
|
+
* Between levels the camera is the Scene's move between stops, painted on
|
|
29
|
+
* its layers outside React; at a level it is written into the view once,
|
|
30
|
+
* and the city laid out again at that zoom.
|
|
31
|
+
*/
|
|
32
|
+
/*
|
|
33
|
+
* WHAT A DRAWN PART SAYS IT SHOWS. A page, a lens and a view each mark the
|
|
34
|
+
* record a part of them shows, and the line from that part to the record's
|
|
35
|
+
* building is read off the mark, whatever drew it: the pick every shipped
|
|
36
|
+
* lens and the Scene's own views carry (`data-graview-pick`, what a press
|
|
37
|
+
* there chooses), a routed page's row (`data-graview-record`), and a view's
|
|
38
|
+
* own link to a record (`data-record`). One line a record, from the first
|
|
39
|
+
* of its parts in sight: a task drawn on three days of a calendar is one
|
|
40
|
+
* line, not three. A part scrolled out of the page draws none.
|
|
41
|
+
*/
|
|
42
|
+
const RECORD_PARTS = "[data-graview-pick], [data-graview-record], [data-record]";
|
|
43
|
+
const recordShownBy = (element) => element.getAttribute("data-graview-pick") ?? element.getAttribute("data-graview-record") ?? element.getAttribute("data-record");
|
|
44
|
+
/*
|
|
45
|
+
* THE CITY ON THIS FACE. The Scene's own zoom and its signs past the edge
|
|
46
|
+
* are not this face's: the control at the foot and the camera are. Nor are
|
|
47
|
+
* the Scene's lines and words from a chosen record to what it is linked
|
|
48
|
+
* to: the page beside the city says those, and its lines leave from where
|
|
49
|
+
* it says them. The record the page is about stands out from the rest —
|
|
50
|
+
* lifted off its plot and lit in the accent — while what it is linked to
|
|
51
|
+
* stays lit as the Scene lights it, and everything else is quiet.
|
|
52
|
+
*/
|
|
53
|
+
const CITY_CSS = `
|
|
54
|
+
[data-testid="one-place-city"] .graview-zoom, [data-testid="one-place-city"] .graview-edge-sign, [data-testid="one-place-city"] .graview-record-links, [data-testid="one-place-city"] .graview-drive-in { display: none; }
|
|
55
|
+
[data-testid="one-place-city"] .graview-building[data-graview-here] { translate: 0 -7px; }
|
|
56
|
+
[data-testid="one-place-city"] .graview-building[data-graview-here] .graview-iso-roof { fill: var(--graview-accent); }
|
|
57
|
+
[data-testid="one-place-city"] .graview-building[data-graview-here] .graview-iso-left { fill: color-mix(in srgb, var(--graview-accent) 55%, black); }
|
|
58
|
+
[data-testid="one-place-city"] .graview-building[data-graview-here] .graview-iso-right { fill: color-mix(in srgb, var(--graview-accent) 72%, black); }
|
|
59
|
+
`;
|
|
60
|
+
const zoomNowOf = (cam) => cam.zoom().toFixed(4);
|
|
61
|
+
/** The most lines drawn from a page's parts: past this a list's lines are a hatch. */
|
|
62
|
+
const MOST_LINES = 40;
|
|
63
|
+
/** How long one level's move takes. A person who asked for less motion is cut straight there. */
|
|
64
|
+
export const MOVE_MS = 560;
|
|
65
|
+
/** A hand that has stopped zooming for this long has let go: the altitude settles to the nearest level. */
|
|
66
|
+
const LET_GO_MS = 240;
|
|
67
|
+
const NS = "http://www.w3.org/2000/svg";
|
|
68
|
+
const kindOfId = (id) => (id === null ? null : id.startsWith("kind:") ? id.slice(5) : id.startsWith("aggregate:") && !id.includes("|") && !id.includes("+") ? id.slice(10) : null);
|
|
69
|
+
const boxOf = (rect) => ({ x: rect.left, y: rect.top, width: rect.width, height: rect.height });
|
|
70
|
+
const middle = (box) => ({ x: box.x + box.width / 2, y: box.y + box.height / 2 });
|
|
71
|
+
const keyOf = (where) => (where.type === "record" ? `record:${where.id}` : where.type === "list" ? `list:${where.kind}` : where.type === "place" ? `place:${where.kinds.join(",")}` : where.type);
|
|
72
|
+
const ease = (t) => (t <= 0 ? 0 : t >= 1 ? 1 : t * t * (3 - 2 * t));
|
|
73
|
+
const level = (live) => Math.abs(live.s - 1) < 1e-4 && Math.abs(live.x) < 0.05 && Math.abs(live.y) < 0.05;
|
|
74
|
+
const clamp01 = (t) => Math.max(0, Math.min(1, t));
|
|
75
|
+
export function OnePlaceCity({ where, out, sheet, connected, boards, current, boardEls, boardLayer, fab, view, lessMotion, resolve, openRecord, openKind, onGround, motion, onAltitude }) {
|
|
76
|
+
const { store } = useGraview();
|
|
77
|
+
const { view: seen, go } = useNavigation();
|
|
78
|
+
const box = useRef(null);
|
|
79
|
+
const overlay = useRef(null);
|
|
80
|
+
const rings = useRef(null);
|
|
81
|
+
const camera = useRef(null);
|
|
82
|
+
/*
|
|
83
|
+
* THE SCENE'S STOP: always the overview — its lens over the grid and its
|
|
84
|
+
* shelf of districts are not drawn on this face — and nothing chosen on
|
|
85
|
+
* it, so it draws no lines of its own from a choice and no outline of
|
|
86
|
+
* one: this face draws the one set of lines. (A record its plot has no
|
|
87
|
+
* room to draw — one of a "+415" — stands on its district.)
|
|
88
|
+
*/
|
|
89
|
+
const wanted = useMemo(() => withOverview(EMPTY_VIEW, true), []);
|
|
90
|
+
const asked = useRef("");
|
|
91
|
+
/*
|
|
92
|
+
* ONLY ONCE THE PAGE GOES OUT. While it is read, the view the provider
|
|
93
|
+
* holds is the page's own (what the page's quick ask is about, say), and
|
|
94
|
+
* the Scene is not drawn; out, the Scene's view is the overview; in
|
|
95
|
+
* again, the page's own view comes back.
|
|
96
|
+
*/
|
|
97
|
+
const kept = useRef(null);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (out) {
|
|
100
|
+
kept.current ??= seen;
|
|
101
|
+
const next = { ...wanted, ...(seen.overview && seen.pan ? { pan: seen.pan } : {}) };
|
|
102
|
+
asked.current = toUrl(next);
|
|
103
|
+
go(next);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (kept.current) {
|
|
107
|
+
const back = kept.current;
|
|
108
|
+
kept.current = null;
|
|
109
|
+
asked.current = toUrl(back);
|
|
110
|
+
go(back);
|
|
111
|
+
}
|
|
112
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
+
}, [out]);
|
|
114
|
+
/* The Scene's own way down — a record focused, a district gone into — is that place, in the panel. A pan is the camera's own and is kept. */
|
|
115
|
+
const latestOut = useRef(out);
|
|
116
|
+
latestOut.current = out;
|
|
117
|
+
const latest = useRef({ openRecord, openKind });
|
|
118
|
+
latest.current = { openRecord, openKind };
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
// While the page is read the view is the page's own, and none of this is the Scene's.
|
|
121
|
+
if (!latestOut.current || toUrl(seen) === asked.current)
|
|
122
|
+
return;
|
|
123
|
+
if (seen.overview && seen.focusId === null)
|
|
124
|
+
return;
|
|
125
|
+
const focus = seen.focusId;
|
|
126
|
+
const back = { ...wanted, ...(seen.pan ? { pan: seen.pan } : {}) };
|
|
127
|
+
asked.current = toUrl(back);
|
|
128
|
+
go(back);
|
|
129
|
+
const record = focus && store.graph.getNode(focus) ? focus : null;
|
|
130
|
+
const kind = kindOfId(focus);
|
|
131
|
+
// A record chosen in the city is its own page, beside the city: never a view of the Scene's own about it.
|
|
132
|
+
if (record)
|
|
133
|
+
latest.current.openRecord(record, PANEL);
|
|
134
|
+
else if (kind)
|
|
135
|
+
latest.current.openKind(kind, PANEL);
|
|
136
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
137
|
+
}, [seen]);
|
|
138
|
+
/*
|
|
139
|
+
* THE GROUND KEPT FOR THE VIEWS: the city is laid out with room under each
|
|
140
|
+
* district's name for the views of its kind, so they stand beside it and
|
|
141
|
+
* no other district's name is placed on them (`LayoutOptions.standing`).
|
|
142
|
+
*/
|
|
143
|
+
const roomKey = useMemo(() => {
|
|
144
|
+
const counts = new Map();
|
|
145
|
+
for (const board of boards) {
|
|
146
|
+
const kind = board.where.type === "record" ? null : signKindOf(board.where);
|
|
147
|
+
if (kind)
|
|
148
|
+
counts.set(kind, (counts.get(kind) ?? 0) + 1);
|
|
149
|
+
}
|
|
150
|
+
const width = boardWidthFor(view);
|
|
151
|
+
return JSON.stringify([...counts].sort().map(([kind, count]) => [kind, signRoom(count, width)]));
|
|
152
|
+
}, [boards, view]);
|
|
153
|
+
/* And the plaza's room at the top: the views of no one kind, in rows, under the bar. */
|
|
154
|
+
const plaza = useMemo(() => {
|
|
155
|
+
const count = boards.filter((board) => board.where.type !== "record" && signKindOf(board.where) === null).length;
|
|
156
|
+
return count === 0 ? 0 : Math.ceil(signRoom(count, boardWidthFor(view)).height + 12);
|
|
157
|
+
}, [boards, view]);
|
|
158
|
+
const sceneOptions = useMemo(() => ({ standing: Object.fromEntries(JSON.parse(roomKey)), plaza: plaza + view.top }), [roomKey, plaza, view.top]);
|
|
159
|
+
const state = useRef({ where, out, view, lessMotion, resolve, onAltitude, boards, current });
|
|
160
|
+
state.current = { where, out, view, lessMotion, resolve, onAltitude, boards, current };
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
let frame = 0;
|
|
163
|
+
let world = { plots: new Map(), buildings: new Map(), plates: new Map(), named: new Map() };
|
|
164
|
+
/** The camera between stops this frame, as painted — the last one seen while the view takes in a move just let go. */
|
|
165
|
+
let painted = LEVEL_LIVE;
|
|
166
|
+
/** The level the camera rests at, and the altitude this frame. */
|
|
167
|
+
let rest = PAGE;
|
|
168
|
+
let altitude = PAGE;
|
|
169
|
+
/** A move of the camera this face is making: from one camera to another, about the place. */
|
|
170
|
+
let move = null;
|
|
171
|
+
/** What stood at the foot when the City was last fitted: the legend opened or put away there fits it again. */
|
|
172
|
+
let cityFoot = "";
|
|
173
|
+
/** Where the camera stood when it came to rest at the City: a hand that moved it since keeps it. */
|
|
174
|
+
let cityAt = "";
|
|
175
|
+
/** A zoom the person's own hand made on the Scene, and when it last moved. */
|
|
176
|
+
let handZoom = 0;
|
|
177
|
+
/*
|
|
178
|
+
* THE ZOOM THIS FACE LAST LEFT THE CAMERA AT. Only a zoom that differs
|
|
179
|
+
* from it is a hand's: a new address at rest asks the camera for a
|
|
180
|
+
* different zoom for the same level (a list's, not a record's), and read
|
|
181
|
+
* against that level's zoom it looked like a pinch — the altitude was
|
|
182
|
+
* read off it and settled to another level: the page came down to the
|
|
183
|
+
* page after Back, or went back up to the city after a view was chosen.
|
|
184
|
+
*/
|
|
185
|
+
let ownZoom = null;
|
|
186
|
+
/** The panel as it was last frame, and whether a hand has moved it since the camera was written. */
|
|
187
|
+
let lastPanel = "";
|
|
188
|
+
/** When the city was last read, and what it was read for. */
|
|
189
|
+
let lastRead = -Infinity;
|
|
190
|
+
let lastReadKey = "";
|
|
191
|
+
let resized = false;
|
|
192
|
+
let handSince = 0;
|
|
193
|
+
let lastPlace = "";
|
|
194
|
+
let lastReported = "";
|
|
195
|
+
/* When the camera was last written into the view: the Scene settles what is painted a beat after (its wheel's rule), so nothing new is painted until that beat has passed. */
|
|
196
|
+
let committedAt = -Infinity;
|
|
197
|
+
const QUIET_MS = 220;
|
|
198
|
+
const lines = new Map();
|
|
199
|
+
/** The picture as laid out now, read while nothing is painted over it. */
|
|
200
|
+
const readWorld = (holder) => {
|
|
201
|
+
const plots = new Map();
|
|
202
|
+
for (const plot of holder.querySelectorAll("[data-graview-plot]")) {
|
|
203
|
+
const kind = kindOfId(plot.getAttribute("data-graview-plot"));
|
|
204
|
+
const tile = plot.querySelector(".graview-plot-tile") ?? plot;
|
|
205
|
+
if (kind)
|
|
206
|
+
plots.set(kind, boxOf(tile.getBoundingClientRect()));
|
|
207
|
+
}
|
|
208
|
+
const buildings = new Map();
|
|
209
|
+
for (const building of holder.querySelectorAll("[data-graview-building]"))
|
|
210
|
+
buildings.set(building.getAttribute("data-graview-building"), boxOf(building.getBoundingClientRect()));
|
|
211
|
+
const plates = new Map();
|
|
212
|
+
const named = new Map();
|
|
213
|
+
for (const face of holder.querySelectorAll(".graview-kind-face[data-graview-nameplate]")) {
|
|
214
|
+
const said = face.getAttribute("data-graview-nameplate") ?? "none";
|
|
215
|
+
const kind = kindOfId(face.closest("[data-graview-view]")?.getAttribute("data-graview-view") ?? null);
|
|
216
|
+
if (!kind || said.endsWith("above") || said.endsWith("aside"))
|
|
217
|
+
continue;
|
|
218
|
+
const box = boxOf(face.getBoundingClientRect());
|
|
219
|
+
if (box.width > 0 && box.height > 0)
|
|
220
|
+
named.set(kind, box);
|
|
221
|
+
if (said !== "none")
|
|
222
|
+
plates.set(kind, box);
|
|
223
|
+
}
|
|
224
|
+
return { plots, buildings, plates, named };
|
|
225
|
+
};
|
|
226
|
+
/** What a page stands on in the picture as it is laid out. */
|
|
227
|
+
const placeIn = (at, w) => ({
|
|
228
|
+
building: at.type === "record" ? (w.buildings.get(at.id) ?? null) : null,
|
|
229
|
+
district: at.type === "record" || at.type === "list" ? (w.plots.get(at.kind) ?? null) : null,
|
|
230
|
+
districts: at.type === "place" ? at.kinds.flatMap((kind) => (w.plots.has(kind) ? [w.plots.get(kind)] : [])) : [],
|
|
231
|
+
all: [...w.plots.values()],
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* WHERE EACH VIEW STANDS, in the picture as laid out: worked out again
|
|
235
|
+
* whenever the picture is read. A view of one kind in the room its
|
|
236
|
+
* district keeps under its name; the rest on the plaza at the city's
|
|
237
|
+
* back edge; a record's own page on its building's roof. And the box
|
|
238
|
+
* around all of it, which the city's camera fits.
|
|
239
|
+
*/
|
|
240
|
+
let slots = new Map();
|
|
241
|
+
/** The city and every view standing in it, as last read: what the city's camera fits. */
|
|
242
|
+
let whole = null;
|
|
243
|
+
const standAll = (w, zoomNow) => {
|
|
244
|
+
const width = boardWidthFor(state.current.view) * zoomNow;
|
|
245
|
+
const height = width / BOARD_ASPECT;
|
|
246
|
+
const byKind = new Map();
|
|
247
|
+
const plaza = [];
|
|
248
|
+
const next = new Map();
|
|
249
|
+
for (const board of state.current.boards) {
|
|
250
|
+
if (board.where.type === "record") {
|
|
251
|
+
const at = footOf(board.where, placeIn(board.where, w));
|
|
252
|
+
if (at)
|
|
253
|
+
next.set(board.key, at);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const kind = signKindOf(board.where);
|
|
257
|
+
if (kind && w.plots.has(kind))
|
|
258
|
+
byKind.set(kind, [...(byKind.get(kind) ?? []), board.key]);
|
|
259
|
+
else
|
|
260
|
+
plaza.push(board.key);
|
|
261
|
+
}
|
|
262
|
+
const boxes = [...w.plots.values(), ...w.plates.values()];
|
|
263
|
+
/*
|
|
264
|
+
* WHAT A VIEW MAY NOT STAND ON: any district's ground and buildings,
|
|
265
|
+
* any district's name, any view already stood. The room under a
|
|
266
|
+
* district's name is held for its views by the layout; where that
|
|
267
|
+
* room runs onto the next district (the map's lattice is the
|
|
268
|
+
* declaration's, and does not move), the views stand along the
|
|
269
|
+
* district's other sides instead — the first side that is clear.
|
|
270
|
+
*/
|
|
271
|
+
const taken = [...w.plots.values(), ...w.plates.values()];
|
|
272
|
+
const overlap = (a, b) => Math.max(0, Math.min(a.x + a.width, b.x + b.width) - Math.max(a.x, b.x)) * Math.max(0, Math.min(a.y + a.height, b.y + b.height) - Math.max(a.y, b.y));
|
|
273
|
+
const signBox = (foot) => ({ x: foot.x - width / 2 - 2, y: foot.y - height - 2, width: width + 4, height: height + SIGN_POST * zoomNow + 4 });
|
|
274
|
+
// The plaza first: a district's views stand clear of it.
|
|
275
|
+
const city = unionOf([...w.plots.values()]);
|
|
276
|
+
if (city && plaza.length > 0) {
|
|
277
|
+
for (const [key, foot] of signFeet(plaza, { x: city.x + city.width / 2, y: city.y - 6 }, width, "up")) {
|
|
278
|
+
next.set(key, foot);
|
|
279
|
+
boxes.push({ x: foot.x - width / 2, y: foot.y - height, width, height: height + SIGN_POST * zoomNow });
|
|
280
|
+
taken.push(signBox(foot));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
for (const [kind, keys] of byKind) {
|
|
284
|
+
const tile = w.plots.get(kind);
|
|
285
|
+
const plate = w.plates.get(kind);
|
|
286
|
+
const own = [tile, ...(plate ? [plate] : [])];
|
|
287
|
+
const others = taken.filter((box) => !own.includes(box));
|
|
288
|
+
const rowWidth = (n) => n * width + (n - 1) * SIGN_GAP;
|
|
289
|
+
// Under its name, said or not: the layout held that room there (`LayoutOptions.standing`).
|
|
290
|
+
const name = plate ?? w.named.get(kind);
|
|
291
|
+
const under = { x: tile.x + tile.width / 2, y: (name ? name.y + name.height : tile.y + tile.height) + 6 };
|
|
292
|
+
// Behind the district, over the tallest of the blocks at its back corner.
|
|
293
|
+
const blocks = [...w.buildings.values()].filter((one) => one.x + one.width / 2 > tile.x && one.x + one.width / 2 < tile.x + tile.width && one.y + one.height / 2 > tile.y && one.y + one.height / 2 < tile.y + tile.height);
|
|
294
|
+
const back = Math.min(tile.y, ...blocks.map((one) => one.y)) - 4;
|
|
295
|
+
// The room the layout holds under the name first; then behind the district, and beside it.
|
|
296
|
+
const candidates = [
|
|
297
|
+
{ feet: signFeet(keys, under, width, "down") },
|
|
298
|
+
{ feet: signFeet(keys, { x: tile.x + tile.width / 2, y: back }, width, "up") },
|
|
299
|
+
{ feet: signFeet(keys, { x: tile.x - 8 - rowWidth(Math.min(keys.length, 3)) / 2, y: tile.y + tile.height / 2 - (height + SIGN_POST * zoomNow) / 2 }, width, "down") },
|
|
300
|
+
{ feet: signFeet(keys, { x: tile.x + tile.width + 8 + rowWidth(Math.min(keys.length, 3)) / 2, y: tile.y + tile.height / 2 - (height + SIGN_POST * zoomNow) / 2 }, width, "down") },
|
|
301
|
+
];
|
|
302
|
+
// A view stands on its own district: a foot nearer another district's ground than its own reads as that one's, and weighs more than any overlap.
|
|
303
|
+
const gap = (p, b) => Math.hypot(Math.max(b.x - p.x, 0, p.x - (b.x + b.width)), Math.max(b.y - p.y, 0, p.y - (b.y + b.height)));
|
|
304
|
+
const astray = (foot) => [...w.plots.entries()].some(([other, box]) => other !== kind && gap(foot, box) <= gap(foot, tile)) ? 1e6 : 0;
|
|
305
|
+
const cost = (feet) => [...feet.values()].reduce((sum, foot) => sum + astray(foot) + others.concat(own.slice(1)).reduce((inner, box) => inner + overlap(signBox(foot), box), 0) + overlap(signBox(foot), tile), 0);
|
|
306
|
+
const best = candidates.reduce((pick, one) => (cost(one.feet) < cost(pick.feet) - 0.5 ? one : pick));
|
|
307
|
+
for (const [key, foot] of best.feet) {
|
|
308
|
+
next.set(key, foot);
|
|
309
|
+
boxes.push({ x: foot.x - width / 2, y: foot.y - height, width, height: height + SIGN_POST * zoomNow });
|
|
310
|
+
taken.push(signBox(foot));
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
slots = next;
|
|
314
|
+
whole = unionOf(boxes);
|
|
315
|
+
};
|
|
316
|
+
/*
|
|
317
|
+
* WHAT STANDS AT THE FOOT: the control, the legend over it when it is
|
|
318
|
+
* open, and the timeline beside them — each its own rect, read in the
|
|
319
|
+
* frame that uses it. `now` is where they are this frame (a phone's
|
|
320
|
+
* control rides on the sheet at Nearby); `rest` is where they stand at
|
|
321
|
+
* the window's foot, which is where they are at the City.
|
|
322
|
+
*/
|
|
323
|
+
const footNow = () => {
|
|
324
|
+
const holder = fab.current;
|
|
325
|
+
if (!holder)
|
|
326
|
+
return { now: [], rest: [], key: "" };
|
|
327
|
+
const bottom = holder.getBoundingClientRect().bottom;
|
|
328
|
+
const height = state.current.view.height;
|
|
329
|
+
const now = [holder.querySelector("[data-graview-one-face-dock]"), holder.querySelector("[data-graview-past-slot] > *")].flatMap((el) => {
|
|
330
|
+
const r = el?.getBoundingClientRect();
|
|
331
|
+
return r && r.width > 0 && r.height > 0 ? [boxOf(r)] : [];
|
|
332
|
+
});
|
|
333
|
+
// At rest the region stands 16 pixels off the window's foot: each rect where it would be there.
|
|
334
|
+
const rest = now.map((box) => ({ ...box, y: height - 16 - (bottom - box.y) }));
|
|
335
|
+
// What changes the fit: the control and the legend over it (the first rect). The timeline's width follows the window's, and a resize refits on its own.
|
|
336
|
+
const dock = rest[0];
|
|
337
|
+
return { now, rest, key: dock ? `${Math.round(dock.x)},${Math.round(dock.y)},${Math.round(dock.width)},${Math.round(dock.height)}` : "" };
|
|
338
|
+
};
|
|
339
|
+
/** How much of the window above a phone's sheet the control and the legend keep, at Nearby. */
|
|
340
|
+
const footRoom = () => {
|
|
341
|
+
const dock = fab.current?.querySelector("[data-graview-one-face-dock]")?.getBoundingClientRect();
|
|
342
|
+
return dock ? dock.height + 24 : 72;
|
|
343
|
+
};
|
|
344
|
+
/** The place the page stands on, in the picture. */
|
|
345
|
+
const anchorIn = (at, w) => anchorOf(at, {
|
|
346
|
+
building: at.type === "record" ? (w.buildings.get(at.id) ?? null) : null,
|
|
347
|
+
district: at.type === "record" || at.type === "list" ? (w.plots.get(at.kind) ?? null) : null,
|
|
348
|
+
districts: at.type === "place" ? at.kinds.flatMap((kind) => (w.plots.has(kind) ? [w.plots.get(kind)] : [])) : [],
|
|
349
|
+
all: [...w.plots.values()],
|
|
350
|
+
});
|
|
351
|
+
/** The camera a level asks for, against the view's own: how much closer than now, and the place where that level aims it. */
|
|
352
|
+
const cameraFor = (lvl, anchor, zoomNow) => {
|
|
353
|
+
const now = state.current;
|
|
354
|
+
const zooms = levelZooms(now.where, now.view);
|
|
355
|
+
const s = zooms[lvl] / zoomNow;
|
|
356
|
+
if (lvl === CITY) {
|
|
357
|
+
/*
|
|
358
|
+
* THE CITY AT ITS OWN FIT (zoom 1: the Scene's, with room kept under
|
|
359
|
+
* each name for its views and at the top for the plaza), its middle
|
|
360
|
+
* and the plaza above it in the middle of what the bar and the
|
|
361
|
+
* control at the foot leave. Worked out once, before the move, and
|
|
362
|
+
* held: the camera goes straight there and stops.
|
|
363
|
+
*/
|
|
364
|
+
if (whole) {
|
|
365
|
+
// Fitted beside what stands at the foot as it stands there at the City, its legend's rect read now.
|
|
366
|
+
const fitted = fitBeside(whole, now.view, footNow().rest, 20, s);
|
|
367
|
+
// Never past what the camera can be written at: a fit below its reach was painted, then put back up when written — an overshoot.
|
|
368
|
+
const least = (camera.current?.range.min ?? 0) / zoomNow;
|
|
369
|
+
if (fitted.s >= least)
|
|
370
|
+
return fitted;
|
|
371
|
+
const middle = { x: whole.x + whole.width / 2, y: whole.y + whole.height / 2 };
|
|
372
|
+
return cameraPutting(middle, project(fitted, middle), least);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (lvl === CITY || now.where.type === "home" || now.where.type === "overview") {
|
|
376
|
+
const city = unionOf([...world.plots.values()]);
|
|
377
|
+
const middleOfCity = city ? middle(city) : anchor;
|
|
378
|
+
return cameraPutting(middleOfCity, aimAt(CITY, now.view), s);
|
|
379
|
+
}
|
|
380
|
+
return cameraPutting(anchor, aimAt(lvl === PAGE ? PANEL : lvl, now.view, footRoom()), s);
|
|
381
|
+
};
|
|
382
|
+
/** Start a move of the camera to a level. */
|
|
383
|
+
const moveTo = (cam, toLevel, anchor, now) => {
|
|
384
|
+
const from = painted;
|
|
385
|
+
const to = cameraFor(toLevel, anchor, cam.zoom());
|
|
386
|
+
const fromAltitude = altitude;
|
|
387
|
+
if (state.current.lessMotion) {
|
|
388
|
+
cam.liveTo(to);
|
|
389
|
+
painted = to;
|
|
390
|
+
altitude = toLevel;
|
|
391
|
+
rest = toLevel;
|
|
392
|
+
cityFoot = "";
|
|
393
|
+
cam.commit();
|
|
394
|
+
committedAt = performance.now();
|
|
395
|
+
ownZoom = cam.zoom();
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
move = {
|
|
399
|
+
from,
|
|
400
|
+
to,
|
|
401
|
+
fromAltitude,
|
|
402
|
+
toAltitude: toLevel,
|
|
403
|
+
about: anchor,
|
|
404
|
+
start: now,
|
|
405
|
+
foot: footNow().key,
|
|
406
|
+
done: () => {
|
|
407
|
+
rest = toLevel;
|
|
408
|
+
altitude = toLevel;
|
|
409
|
+
cityFoot = "";
|
|
410
|
+
cam.commit();
|
|
411
|
+
committedAt = performance.now();
|
|
412
|
+
ownZoom = null;
|
|
413
|
+
},
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
const tick = (now) => {
|
|
417
|
+
frame = requestAnimationFrame(tick);
|
|
418
|
+
const holder = box.current;
|
|
419
|
+
const plane = sheet.current;
|
|
420
|
+
const cam = camera.current;
|
|
421
|
+
if (!holder || !plane || !cam)
|
|
422
|
+
return;
|
|
423
|
+
const at = state.current;
|
|
424
|
+
const asking = motion.current;
|
|
425
|
+
/*
|
|
426
|
+
* WHILE THE PAGE IS READ the Scene is not drawn at all: no room, no
|
|
427
|
+
* scroll, no pointer, no keyboard. Asked out, it is drawn a frame
|
|
428
|
+
* before anything moves, laid out, and the camera aimed out of sight
|
|
429
|
+
* where stepping out begins; only then does the page move.
|
|
430
|
+
*/
|
|
431
|
+
const drawn = at.out || rest !== PAGE || move !== null || asking.scrubbing || altitude > 0.001;
|
|
432
|
+
if (!drawn) {
|
|
433
|
+
if (holder.style.display !== "none") {
|
|
434
|
+
holder.style.display = "none";
|
|
435
|
+
holder.style.visibility = "hidden";
|
|
436
|
+
plane.style.transform = "";
|
|
437
|
+
plane.style.opacity = "";
|
|
438
|
+
plane.style.borderRadius = "";
|
|
439
|
+
draw([], 0);
|
|
440
|
+
}
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (holder.style.display === "none") {
|
|
444
|
+
holder.style.display = "block";
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
/* THE CAMERA AS IT IS: a move between stops painted now, or the view's own. */
|
|
448
|
+
const live = cam.live();
|
|
449
|
+
const between = !level(live);
|
|
450
|
+
// Settling: a move written into the view not yet laid out, or written too recently for a new one to be painted safely.
|
|
451
|
+
const settling = cam.moving() && !between;
|
|
452
|
+
// Written too recently for a new move to be painted safely: the Scene settles what is painted a beat after a commit.
|
|
453
|
+
const calm = now - committedAt >= QUIET_MS;
|
|
454
|
+
if (between)
|
|
455
|
+
painted = live;
|
|
456
|
+
else if (!settling) {
|
|
457
|
+
painted = LEVEL_LIVE;
|
|
458
|
+
/*
|
|
459
|
+
* THE CITY READ AGAIN ONLY WHEN IT MAY HAVE MOVED: a camera written,
|
|
460
|
+
* the window or the views changed, or a while gone by (a record added
|
|
461
|
+
* lays its district out again) — never every frame of a page at rest.
|
|
462
|
+
*/
|
|
463
|
+
const readKey = `${at.view.width}x${at.view.height}|${at.boards.length}|${at.current}|${zoomNowOf(cam)}|${holder.querySelector(".graview-plots > g")?.getAttribute("transform") ?? ""}`;
|
|
464
|
+
// An empty city is read again every frame until it has laid out; a pan moves the city's own transform, which is in the key.
|
|
465
|
+
if (world.plots.size === 0 || readKey !== lastReadKey || committedAt > lastRead || now - lastRead > 500) {
|
|
466
|
+
world = readWorld(holder);
|
|
467
|
+
standAll(world, cam.zoom());
|
|
468
|
+
lastRead = now;
|
|
469
|
+
lastReadKey = readKey;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const anchor = world.plots.size > 0 ? anchorIn(at.where, world) : null;
|
|
473
|
+
const zooms = levelZooms(at.where, at.view);
|
|
474
|
+
const zoomNow = cam.zoom();
|
|
475
|
+
const placeKey = `${keyOf(at.where)}|${at.view.width}x${at.view.height}`;
|
|
476
|
+
/* At the page, the camera waits where stepping out begins: aimed for each place before anything moves. */
|
|
477
|
+
let ready = rest !== PAGE || move !== null || asking.scrubbing;
|
|
478
|
+
if (!ready && anchor && !settling) {
|
|
479
|
+
// Painted, not written into the view: the move starts from it in this same frame, and only its end is written.
|
|
480
|
+
const want = cameraFor(PAGE, anchor, zoomNow);
|
|
481
|
+
if (Math.hypot(want.x - painted.x, want.y - painted.y) + Math.abs(want.s - painted.s) * 100 > 0.5) {
|
|
482
|
+
cam.liveTo(want);
|
|
483
|
+
painted = want;
|
|
484
|
+
}
|
|
485
|
+
ready = true;
|
|
486
|
+
}
|
|
487
|
+
/* WHAT IS ASKED: a level (Up, Down, a press), or a scrub of the altitude by a hand on the page. */
|
|
488
|
+
if (ready && calm && anchor && asking.level !== null && !move && !settling) {
|
|
489
|
+
const toLevel = asking.level;
|
|
490
|
+
asking.level = null;
|
|
491
|
+
if (toLevel !== rest || placeKey !== lastPlace)
|
|
492
|
+
moveTo(cam, toLevel, anchor, now);
|
|
493
|
+
lastPlace = placeKey;
|
|
494
|
+
}
|
|
495
|
+
if (ready && calm && anchor && asking.scrub !== 0 && !settling) {
|
|
496
|
+
// As far as the hand has gone, but no more than a step a frame: a hand ahead of the camera is caught up with, never jumped to.
|
|
497
|
+
const delta = Math.max(-0.12, Math.min(0.12, asking.scrub));
|
|
498
|
+
asking.scrub -= delta;
|
|
499
|
+
move = null;
|
|
500
|
+
const target = Math.max(PAGE, Math.min(CITY, altitude + delta));
|
|
501
|
+
// The cameras of the levels either side, the one rested at as it is (a pan the person made is kept).
|
|
502
|
+
const lower = Math.floor(target);
|
|
503
|
+
const upper = Math.min(CITY, lower + 1);
|
|
504
|
+
const camOf = (lvl) => (lvl === rest ? cameraFor(rest, anchor, zoomNow) : cameraFor(lvl, anchor, zoomNow));
|
|
505
|
+
const placed = cameraBetween(camOf(lower), camOf(upper), anchor, target - lower);
|
|
506
|
+
cam.liveTo(placed);
|
|
507
|
+
painted = placed;
|
|
508
|
+
altitude = target;
|
|
509
|
+
handSince = now;
|
|
510
|
+
asking.scrubbing = true;
|
|
511
|
+
}
|
|
512
|
+
if (asking.scrubbing && !asking.held && now - handSince > LET_GO_MS && !settling && calm) {
|
|
513
|
+
asking.scrubbing = false;
|
|
514
|
+
if (anchor)
|
|
515
|
+
moveTo(cam, restingLevel(altitude), anchor, now);
|
|
516
|
+
}
|
|
517
|
+
/* A MOVE UNDER WAY: the camera set from how far it has got. */
|
|
518
|
+
if (move) {
|
|
519
|
+
/*
|
|
520
|
+
* WHAT STANDS AT THE FOOT CHANGED UNDER WAY — the legend opens as the
|
|
521
|
+
* level it is shown at is headed for — and the camera's end is
|
|
522
|
+
* worked out again from it, in this frame: the fit and the aim read
|
|
523
|
+
* the rects as they are, never as they were when the move began.
|
|
524
|
+
*/
|
|
525
|
+
const foot = footNow().key;
|
|
526
|
+
if (foot !== move.foot) {
|
|
527
|
+
// From where the camera is painted now, toward the new end: never a jump in the middle of the move.
|
|
528
|
+
move.foot = foot;
|
|
529
|
+
move.from = painted;
|
|
530
|
+
move.fromAltitude = altitude;
|
|
531
|
+
move.start = now;
|
|
532
|
+
move.to = cameraFor(move.toAltitude, move.about, cam.zoom());
|
|
533
|
+
}
|
|
534
|
+
const t = clamp01((now - move.start) / MOVE_MS);
|
|
535
|
+
const e = ease(t);
|
|
536
|
+
const placed = cameraBetween(move.from, move.to, move.about, e);
|
|
537
|
+
cam.liveTo(placed);
|
|
538
|
+
painted = placed;
|
|
539
|
+
altitude = move.fromAltitude + (move.toAltitude - move.fromAltitude) * e;
|
|
540
|
+
if (t >= 1) {
|
|
541
|
+
const finished = move;
|
|
542
|
+
move = null;
|
|
543
|
+
finished.done();
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
else if (!asking.scrubbing && !settling) {
|
|
547
|
+
/*
|
|
548
|
+
* AT REST, OR THE PERSON'S OWN HAND ON THE SCENE: a pinch or a
|
|
549
|
+
* ctrl+wheel over the city zooms its camera, and the altitude is
|
|
550
|
+
* where that zoom is — every step of it. Let go, it settles to the
|
|
551
|
+
* nearest level.
|
|
552
|
+
*/
|
|
553
|
+
const effective = zoomNow * painted.s;
|
|
554
|
+
const atZoom = altitudeAt(effective, zooms);
|
|
555
|
+
// The zoom a move just written into the view settles a beat later: it is the face's own once it is still.
|
|
556
|
+
if (ownZoom === null && calm)
|
|
557
|
+
ownZoom = effective;
|
|
558
|
+
/*
|
|
559
|
+
* AT THE CITY THE CAMERA IS FREE. A pinch or a wheel there moves
|
|
560
|
+
* closer to whatever is under the hand and back out — the views
|
|
561
|
+
* standing there seen nearer — and never goes down into one: that is
|
|
562
|
+
* choosing a view, or the control. The Scene keeps the camera within
|
|
563
|
+
* its reach, so the city is never lost.
|
|
564
|
+
*/
|
|
565
|
+
if (rest === CITY && !move) {
|
|
566
|
+
altitude = CITY;
|
|
567
|
+
/*
|
|
568
|
+
* The legend opened or put away at the City: the city is fitted
|
|
569
|
+
* again beside it — unless the person has moved the camera there
|
|
570
|
+
* since it came to the City, which is theirs to keep.
|
|
571
|
+
*/
|
|
572
|
+
const foot = footNow().key;
|
|
573
|
+
const where = `${zoomNowOf(cam)}|${holder.querySelector(".graview-plots > g")?.getAttribute("transform") ?? ""}`;
|
|
574
|
+
if (cityFoot === "") {
|
|
575
|
+
// Recorded once the camera written at the City has settled.
|
|
576
|
+
if (calm) {
|
|
577
|
+
cityFoot = foot;
|
|
578
|
+
cityAt = where;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
else if (foot !== cityFoot && calm && anchor) {
|
|
582
|
+
cityFoot = foot;
|
|
583
|
+
if (where === cityAt)
|
|
584
|
+
moveTo(cam, CITY, anchor, now);
|
|
585
|
+
}
|
|
586
|
+
if (ownZoom !== null && Math.abs(Math.log(effective / ownZoom)) > 0.001)
|
|
587
|
+
ownZoom = effective;
|
|
588
|
+
}
|
|
589
|
+
else if (rest !== PAGE && ownZoom !== null && Math.abs(Math.log(effective / ownZoom)) > 0.03) {
|
|
590
|
+
if (handZoom !== effective) {
|
|
591
|
+
handZoom = effective;
|
|
592
|
+
handSince = now;
|
|
593
|
+
}
|
|
594
|
+
altitude = atZoom;
|
|
595
|
+
if (now - handSince > LET_GO_MS && !asking.held && anchor && calm)
|
|
596
|
+
moveTo(cam, restingLevel(atZoom), anchor, now);
|
|
597
|
+
}
|
|
598
|
+
else if (!(rest !== PAGE && placeKey !== lastPlace))
|
|
599
|
+
altitude = rest;
|
|
600
|
+
}
|
|
601
|
+
/*
|
|
602
|
+
* THE PANEL SIZED BY HAND: the city beside it follows on the one
|
|
603
|
+
* camera in the same frame — painted while the edge moves, written
|
|
604
|
+
* into the view once when it is let go, never fitted again after.
|
|
605
|
+
*/
|
|
606
|
+
const panelNow = `${panelBox(at.view).x},${panelBox(at.view).y},${panelBox(at.view).width}`;
|
|
607
|
+
if (rest === PANEL && !move && !asking.scrubbing && anchor && !settling && panelNow !== lastPanel) {
|
|
608
|
+
if (lastPanel !== "") {
|
|
609
|
+
const want = cameraFor(PANEL, anchor, zoomNow);
|
|
610
|
+
cam.liveTo(want);
|
|
611
|
+
painted = want;
|
|
612
|
+
resized = true;
|
|
613
|
+
}
|
|
614
|
+
lastPanel = panelNow;
|
|
615
|
+
}
|
|
616
|
+
else if (rest !== PANEL)
|
|
617
|
+
lastPanel = "";
|
|
618
|
+
if (resized && !asking.resizing && !move && rest === PANEL) {
|
|
619
|
+
resized = false;
|
|
620
|
+
cam.commit();
|
|
621
|
+
committedAt = performance.now();
|
|
622
|
+
ownZoom = null;
|
|
623
|
+
}
|
|
624
|
+
// Moving to another place at a level above the page: the camera flies there and stays at that level.
|
|
625
|
+
if (rest !== PAGE && !move && !asking.scrubbing && anchor && placeKey !== lastPlace && !settling && calm && holder.querySelector("[data-graview-settled]")) {
|
|
626
|
+
lastPlace = placeKey;
|
|
627
|
+
// Chosen at the city — a Find result, a link — a page lands beside the city, as a view chosen there does.
|
|
628
|
+
moveTo(cam, rest === CITY ? PANEL : rest, anchor, now);
|
|
629
|
+
}
|
|
630
|
+
/* THE PAGE: its box from the altitude, then — past the panel — moved and scaled into its board, as the camera has it this frame. */
|
|
631
|
+
const a = altitude;
|
|
632
|
+
// Out, or asked out and waiting for the camera to be aimed: the page is not back in until nothing asks it out.
|
|
633
|
+
const away = a > 0.001 || move !== null || asking.scrubbing || (asking.level !== null && asking.level > PAGE) || asking.scrub !== 0;
|
|
634
|
+
holder.style.visibility = away ? "visible" : "hidden";
|
|
635
|
+
// Drawn but not yet moved out, or on its way between levels, the city takes no pointer and no keyboard, as the boards do not: a press lands where the move ends.
|
|
636
|
+
const reachable = away && !move && !(rest === PAGE && !asking.scrubbing);
|
|
637
|
+
if (holder.inert === reachable)
|
|
638
|
+
holder.inert = !reachable;
|
|
639
|
+
holder.style.opacity = String(a >= PANEL ? 1 : ease(clamp01(a * 1.3)));
|
|
640
|
+
const phone = at.view.width <= PHONE;
|
|
641
|
+
const panel = panelBox(at.view);
|
|
642
|
+
const pageAt = pageBox(a, at.view);
|
|
643
|
+
/* The boards' size this frame: their width in the picture, carried through the camera painted now. */
|
|
644
|
+
const boardWidth = boardWidthFor(at.view) * zoomNow * painted.s;
|
|
645
|
+
// The view the page goes into is as wide as it will be where the move ends: held, so the page shrinks one way only.
|
|
646
|
+
const intoWidth = move && move.toAltitude >= CITY ? boardWidthFor(at.view) * zoomNow * move.to.s : boardWidth;
|
|
647
|
+
const ownSlot = slots.get(at.current);
|
|
648
|
+
const ownFoot = ownSlot ? project(painted, ownSlot) : anchor ? project(painted, anchor) : { x: at.view.width / 2, y: at.view.height / 2 };
|
|
649
|
+
const standing = away && a > PANEL ? standingAt(a, panel, ownFoot, intoWidth) : null;
|
|
650
|
+
if (away) {
|
|
651
|
+
plane.style.left = `${pageAt.x.toFixed(2)}px`;
|
|
652
|
+
plane.style.top = `${pageAt.y.toFixed(2)}px`;
|
|
653
|
+
plane.style.width = `${pageAt.width.toFixed(2)}px`;
|
|
654
|
+
plane.style.height = `${(standing ? standing.height : pageAt.height).toFixed(2)}px`;
|
|
655
|
+
plane.style.transformOrigin = SHEET_ORIGIN;
|
|
656
|
+
plane.style.transform = standing ? standingCss(standing) : "none";
|
|
657
|
+
plane.style.opacity = "1";
|
|
658
|
+
// As a board its corners are a board's, the camera's scale undone.
|
|
659
|
+
plane.style.borderRadius = `${(a >= PANEL ? 10 / (standing?.scale ?? 1) : 10 * a).toFixed(2)}px`;
|
|
660
|
+
if (standing && plane.scrollTop !== 0 && a > 1.9)
|
|
661
|
+
plane.scrollTop = 0;
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
plane.style.transform = "";
|
|
665
|
+
plane.style.opacity = "";
|
|
666
|
+
plane.style.borderRadius = "";
|
|
667
|
+
}
|
|
668
|
+
/* The Connected list grows into the page as it becomes the panel, and folds away as the page becomes its board. */
|
|
669
|
+
const grown = a <= PANEL ? clamp01((a - 0.55) / 0.45) : 1 - clamp01((a - PANEL) / 0.4);
|
|
670
|
+
const list = connected.current;
|
|
671
|
+
if (list) {
|
|
672
|
+
const inner = list.firstElementChild;
|
|
673
|
+
list.style.height = `${((inner?.scrollHeight ?? 0) * ease(grown)).toFixed(2)}px`;
|
|
674
|
+
list.style.opacity = String(ease(grown));
|
|
675
|
+
}
|
|
676
|
+
/* THE BOARDS: each on its slot, through this frame's camera, at the page's own size scaled. */
|
|
677
|
+
const shownBoards = ease(clamp01((a - 1.25) / 0.6));
|
|
678
|
+
const layer = boardLayer.current;
|
|
679
|
+
if (layer) {
|
|
680
|
+
const reachable = a > 1.5 && !move;
|
|
681
|
+
if (layer.inert === reachable)
|
|
682
|
+
layer.inert = !reachable;
|
|
683
|
+
layer.setAttribute("data-graview-boards-shown", shownBoards.toFixed(3));
|
|
684
|
+
}
|
|
685
|
+
for (const [key, button] of boardEls.current ?? []) {
|
|
686
|
+
const slot = slots.get(key);
|
|
687
|
+
if (!slot || shownBoards <= 0.001) {
|
|
688
|
+
if (button.style.opacity !== "0")
|
|
689
|
+
button.style.opacity = "0";
|
|
690
|
+
button.style.pointerEvents = "none";
|
|
691
|
+
continue;
|
|
692
|
+
}
|
|
693
|
+
const foot = project(painted, slot);
|
|
694
|
+
const w = boardWidth;
|
|
695
|
+
const h = w / BOARD_ASPECT;
|
|
696
|
+
button.style.left = `${(foot.x - w / 2).toFixed(2)}px`;
|
|
697
|
+
button.style.top = `${(foot.y - h).toFixed(2)}px`;
|
|
698
|
+
button.style.width = `${w.toFixed(2)}px`;
|
|
699
|
+
button.style.height = `${h.toFixed(2)}px`;
|
|
700
|
+
button.style.opacity = key === at.current ? "1" : shownBoards.toFixed(3);
|
|
701
|
+
button.style.setProperty("--graview-sign-post", `${(SIGN_POST * zoomNow * painted.s).toFixed(2)}px`);
|
|
702
|
+
button.style.pointerEvents = a > 1.5 && !move ? "auto" : "none";
|
|
703
|
+
const face = button.firstElementChild;
|
|
704
|
+
if (face)
|
|
705
|
+
face.style.transform = `scale(${(w / panel.width).toFixed(5)})`;
|
|
706
|
+
}
|
|
707
|
+
/* The button that moves a level: on a phone it rides above the sheet while the page is one, and comes back to the foot at the city. */
|
|
708
|
+
const button = fab.current;
|
|
709
|
+
if (button) {
|
|
710
|
+
const lift = phone ? (a <= PANEL ? ease(a) : 1 - ease(clamp01(a - PANEL))) : 0;
|
|
711
|
+
button.style.bottom = `${(16 + lift * Math.max(0, at.view.height - panel.y + 10 - 16)).toFixed(2)}px`;
|
|
712
|
+
}
|
|
713
|
+
/* THE LINES, from this frame's numbers. */
|
|
714
|
+
const shown = a <= PANEL ? ease(clamp01((a - 0.6) / 0.4)) : 1 - ease(clamp01((a - PANEL) / 0.45));
|
|
715
|
+
const found = [];
|
|
716
|
+
if (shown > 0.01) {
|
|
717
|
+
const pageRect = boxOf(plane.getBoundingClientRect());
|
|
718
|
+
const controlRect = fab.current?.querySelector('[data-graview-one-face-dock]')?.getBoundingClientRect();
|
|
719
|
+
const area = cityArea(pageRect, at.view, controlRect ? boxOf(controlRect) : null, phone);
|
|
720
|
+
// Everything that stands at the foot this frame, each its own rect: no line runs under any of them.
|
|
721
|
+
const reserved = footNow().now;
|
|
722
|
+
const subjectId = at.where.type === "record" ? at.where.id : null;
|
|
723
|
+
const taken = new Set();
|
|
724
|
+
// A district the Scene draws in this frame: one it has let go of off the window has no end to give.
|
|
725
|
+
const drawnPlot = (kind) => holder.querySelector(`[data-graview-plot="kind:${CSS.escape(kind)}"]`) !== null;
|
|
726
|
+
const endOf = (target) => {
|
|
727
|
+
if (target.type === "record") {
|
|
728
|
+
// Still standing in this frame (a plot shows fewer buildings as it changes): its place in the picture; else its district.
|
|
729
|
+
const building = holder.querySelector(`[data-graview-building="${CSS.escape(target.id)}"]`) ? world.buildings.get(target.id) : undefined;
|
|
730
|
+
if (building)
|
|
731
|
+
return { at: project(painted, { x: building.x + building.width / 2, y: building.y + building.height / 2 }), on: "building" };
|
|
732
|
+
const kind = store.graph.getNode(target.id)?.kind;
|
|
733
|
+
const district = kind && drawnPlot(kind) ? world.plots.get(kind) : undefined;
|
|
734
|
+
return district ? { at: project(painted, middle(district)), on: `kind:${kind}` } : null;
|
|
735
|
+
}
|
|
736
|
+
const district = drawnPlot(target.kind) ? world.plots.get(target.kind) : undefined;
|
|
737
|
+
return district ? { at: project(painted, middle(district)), on: `kind:${target.kind}` } : null;
|
|
738
|
+
};
|
|
739
|
+
const labelFor = (target) => {
|
|
740
|
+
if (target.type !== "record")
|
|
741
|
+
return target.kind;
|
|
742
|
+
const node = store.graph.getNode(target.id);
|
|
743
|
+
return node ? labelOf(store.schema.tryDefinition(node.kind), node) : target.id;
|
|
744
|
+
};
|
|
745
|
+
// The page's own parts first — a link to a record's page, a row that names one — then the Connected rows for what the page does not show.
|
|
746
|
+
const parts = [...plane.querySelectorAll(`a[href], ${RECORD_PARTS}`)].sort((x, y) => Number(x.closest("[data-graview-connected]") !== null) - Number(y.closest("[data-graview-connected]") !== null));
|
|
747
|
+
for (const element of parts) {
|
|
748
|
+
if (found.length >= MOST_LINES)
|
|
749
|
+
break;
|
|
750
|
+
if (element.closest("nav, header, [role=navigation], [role=banner]"))
|
|
751
|
+
continue;
|
|
752
|
+
const named = recordShownBy(element);
|
|
753
|
+
let target = null;
|
|
754
|
+
if (named !== null && store.graph.getNode(named))
|
|
755
|
+
target = { type: "record", id: named };
|
|
756
|
+
else if (element instanceof HTMLAnchorElement && element.href) {
|
|
757
|
+
const resolved = at.resolve(element.pathname);
|
|
758
|
+
target = resolved?.type === "record" ? { type: "record", id: resolved.id } : resolved?.type === "list" ? { type: "list", kind: resolved.kind } : null;
|
|
759
|
+
}
|
|
760
|
+
if (!target || (target.type === "record" && target.id === subjectId))
|
|
761
|
+
continue;
|
|
762
|
+
const key = target.type === "record" ? target.id : `kind:${target.kind}`;
|
|
763
|
+
if (taken.has(key))
|
|
764
|
+
continue;
|
|
765
|
+
const rect = element.getBoundingClientRect();
|
|
766
|
+
if (rect.width < 1 || rect.height < 1)
|
|
767
|
+
continue;
|
|
768
|
+
const part = { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
|
|
769
|
+
// Only what is in sight on the page: a part scrolled past, or under the page's own edge, draws none.
|
|
770
|
+
const port = element.closest("[data-graview-one-place]");
|
|
771
|
+
const visible = port ? port.getBoundingClientRect() : null;
|
|
772
|
+
if (!visible || part.x < visible.left || part.x > visible.right || part.y < visible.top || part.y > visible.bottom)
|
|
773
|
+
continue;
|
|
774
|
+
// The line leaves the page's edge that faces the city, level with the part: never across the page's words.
|
|
775
|
+
const from = leaveFrom(part, pageRect, phone);
|
|
776
|
+
const end = endOf(target);
|
|
777
|
+
if (!end)
|
|
778
|
+
continue;
|
|
779
|
+
taken.add(key);
|
|
780
|
+
const route = routeLine(from, end.at, area, phone, reserved);
|
|
781
|
+
if (!route)
|
|
782
|
+
continue;
|
|
783
|
+
found.push({ key, from: route.from, to: route.to, bend: route.bend, under: route.toward, on: end.on, target, label: labelFor(target) });
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
draw(found, shown);
|
|
787
|
+
/* Told what the frame says, when it changes: the level rested at or headed for, and whether the page is out of the window. */
|
|
788
|
+
const said = `${move ? move.toAltitude : restingLevel(a)}|${away ? 1 : 0}|${move || asking.scrubbing ? 1 : 0}`;
|
|
789
|
+
if (said !== lastReported) {
|
|
790
|
+
lastReported = said;
|
|
791
|
+
at.onAltitude({ level: move ? move.toAltitude : restingLevel(a), away, moving: move !== null || asking.scrubbing });
|
|
792
|
+
}
|
|
793
|
+
/* The record the page is about, marked where it stands: the one building that is "you are here". */
|
|
794
|
+
const hereId = at.where.type === "record" ? at.where.id : null;
|
|
795
|
+
const marked = holder.querySelector("[data-graview-here]");
|
|
796
|
+
if (marked && marked.getAttribute("data-graview-building") !== hereId)
|
|
797
|
+
marked.removeAttribute("data-graview-here");
|
|
798
|
+
if (hereId && (!marked || marked.getAttribute("data-graview-building") !== hereId))
|
|
799
|
+
holder.querySelector(`[data-graview-building="${CSS.escape(hereId)}"]`)?.setAttribute("data-graview-here", "");
|
|
800
|
+
holder.setAttribute("data-graview-altitude-now", a.toFixed(3));
|
|
801
|
+
// The camera's zoom as painted in this frame, for a reader of the move (the harness holds it to going one way).
|
|
802
|
+
holder.setAttribute("data-graview-camera-zoom", (zoomNow * painted.s).toFixed(4));
|
|
803
|
+
};
|
|
804
|
+
/* The overlay, written in the frame it is measured in: no React state per frame. */
|
|
805
|
+
const draw = (found, opacity) => {
|
|
806
|
+
const control = fab.current?.querySelector('[data-graview-one-face-dock]')?.getBoundingClientRect() ?? null;
|
|
807
|
+
const svg = overlay.current;
|
|
808
|
+
const ringLayer = rings.current;
|
|
809
|
+
if (!svg || !ringLayer)
|
|
810
|
+
return;
|
|
811
|
+
svg.style.opacity = String(opacity);
|
|
812
|
+
ringLayer.style.opacity = String(opacity);
|
|
813
|
+
// No lines, no group of their ends: nothing of it outside the page's landmarks while the page is read.
|
|
814
|
+
ringLayer.hidden = found.length === 0;
|
|
815
|
+
const keep = new Set(found.map((line) => line.key));
|
|
816
|
+
for (const [key, drawn] of lines) {
|
|
817
|
+
if (keep.has(key))
|
|
818
|
+
continue;
|
|
819
|
+
drawn.g.remove();
|
|
820
|
+
drawn.ring.remove();
|
|
821
|
+
lines.delete(key);
|
|
822
|
+
}
|
|
823
|
+
/* One marker where several lines end together: the first one's, the rest drawn without a ring of their own. */
|
|
824
|
+
const ringsAt = [];
|
|
825
|
+
for (const line of found) {
|
|
826
|
+
let drawn = lines.get(line.key);
|
|
827
|
+
if (!drawn) {
|
|
828
|
+
const g = document.createElementNS(NS, "g");
|
|
829
|
+
const path = document.createElementNS(NS, "path");
|
|
830
|
+
path.setAttribute("fill", "none");
|
|
831
|
+
path.setAttribute("stroke", "var(--graview-accent)");
|
|
832
|
+
path.setAttribute("stroke-width", "1.5");
|
|
833
|
+
path.setAttribute("stroke-opacity", "0.8");
|
|
834
|
+
path.setAttribute("stroke-linecap", "round");
|
|
835
|
+
const dot = document.createElementNS(NS, "circle");
|
|
836
|
+
dot.setAttribute("r", "2.5");
|
|
837
|
+
dot.setAttribute("fill", "var(--graview-accent)");
|
|
838
|
+
const arrow = document.createElementNS(NS, "path");
|
|
839
|
+
arrow.setAttribute("fill", "var(--graview-accent)");
|
|
840
|
+
g.append(path, dot, arrow);
|
|
841
|
+
svg.append(g);
|
|
842
|
+
const ring = document.createElement("button");
|
|
843
|
+
ring.type = "button";
|
|
844
|
+
ring.setAttribute("data-testid", "one-place-ring");
|
|
845
|
+
ring.style.cssText = "position:fixed;width:16px;height:16px;padding:0;border-radius:8px;border:2px solid var(--graview-accent);background:color-mix(in srgb, var(--graview-accent) 18%, transparent);cursor:pointer;";
|
|
846
|
+
const target = line.target;
|
|
847
|
+
ring.addEventListener("click", () => (target.type === "record" ? latest.current.openRecord(target.id, PANEL) : latest.current.openKind(target.kind, PANEL)));
|
|
848
|
+
ringLayer.append(ring);
|
|
849
|
+
drawn = { g, path, dot, arrow, ring };
|
|
850
|
+
lines.set(line.key, drawn);
|
|
851
|
+
}
|
|
852
|
+
const { from, to } = line;
|
|
853
|
+
const bend = line.bend;
|
|
854
|
+
drawn.g.setAttribute("data-graview-line", line.key);
|
|
855
|
+
drawn.g.setAttribute("data-graview-line-on", line.on);
|
|
856
|
+
drawn.g.toggleAttribute("data-graview-line-under", line.under !== null);
|
|
857
|
+
drawn.g.setAttribute("data-graview-line-from", `${from.x.toFixed(2)},${from.y.toFixed(2)}`);
|
|
858
|
+
drawn.g.setAttribute("data-graview-line-to", `${to.x.toFixed(2)},${to.y.toFixed(2)}`);
|
|
859
|
+
drawn.g.setAttribute("data-graview-line-bend", `${bend.x.toFixed(2)},${bend.y.toFixed(2)}`);
|
|
860
|
+
if (line.under)
|
|
861
|
+
drawn.g.setAttribute("data-graview-line-toward", `${line.under.x.toFixed(2)},${line.under.y.toFixed(2)}`);
|
|
862
|
+
else
|
|
863
|
+
drawn.g.removeAttribute("data-graview-line-toward");
|
|
864
|
+
drawn.path.setAttribute("d", `M${from.x.toFixed(2)},${from.y.toFixed(2)} Q${bend.x.toFixed(2)},${bend.y.toFixed(2)} ${to.x.toFixed(2)},${to.y.toFixed(2)}`);
|
|
865
|
+
drawn.dot.setAttribute("cx", from.x.toFixed(2));
|
|
866
|
+
drawn.dot.setAttribute("cy", from.y.toFixed(2));
|
|
867
|
+
if (line.under) {
|
|
868
|
+
// An arrow at the page's edge, pointing on toward the building under the page.
|
|
869
|
+
const angle = Math.atan2(line.under.y - to.y, line.under.x - to.x);
|
|
870
|
+
const tip = { x: to.x + Math.cos(angle) * 7, y: to.y + Math.sin(angle) * 7 };
|
|
871
|
+
const left = { x: to.x + Math.cos(angle + 2.4) * 6, y: to.y + Math.sin(angle + 2.4) * 6 };
|
|
872
|
+
const right = { x: to.x + Math.cos(angle - 2.4) * 6, y: to.y + Math.sin(angle - 2.4) * 6 };
|
|
873
|
+
drawn.arrow.setAttribute("d", `M${tip.x.toFixed(2)},${tip.y.toFixed(2)} L${left.x.toFixed(2)},${left.y.toFixed(2)} L${right.x.toFixed(2)},${right.y.toFixed(2)} Z`);
|
|
874
|
+
// The marker toward a building out of sight is the way to it: its name said, a press flies there.
|
|
875
|
+
const crowded = ringsAt.some((p) => Math.hypot(p.x - to.x, p.y - to.y) < 28);
|
|
876
|
+
drawn.ring.style.display = crowded ? "none" : "";
|
|
877
|
+
if (!crowded)
|
|
878
|
+
ringsAt.push(to);
|
|
879
|
+
drawn.ring.style.left = `${(to.x - 8).toFixed(2)}px`;
|
|
880
|
+
drawn.ring.style.top = `${(to.y - 8).toFixed(2)}px`;
|
|
881
|
+
}
|
|
882
|
+
else {
|
|
883
|
+
drawn.arrow.setAttribute("d", "");
|
|
884
|
+
// An end under the bar, or under the control at the foot, is not offered: they stand over it.
|
|
885
|
+
const under = control && to.x > control.left - 10 && to.x < control.right + 10 && to.y > control.top - 10 && to.y < control.bottom + 10;
|
|
886
|
+
const crowded = ringsAt.some((p) => Math.hypot(p.x - to.x, p.y - to.y) < 28);
|
|
887
|
+
drawn.ring.style.display = to.y < (state.current.view.top ?? 0) + 8 || under || crowded ? "none" : "";
|
|
888
|
+
if (!crowded)
|
|
889
|
+
ringsAt.push(to);
|
|
890
|
+
drawn.ring.style.left = `${(to.x - 8).toFixed(2)}px`;
|
|
891
|
+
drawn.ring.style.top = `${(to.y - 8).toFixed(2)}px`;
|
|
892
|
+
}
|
|
893
|
+
drawn.ring.setAttribute("data-graview-to", line.target.type === "record" ? line.target.id : `kind:${line.target.kind}`);
|
|
894
|
+
drawn.ring.setAttribute("aria-label", line.target.type === "record" ? `Open ${line.label}` : `Open the ${line.label} list`);
|
|
895
|
+
drawn.ring.title = line.label;
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
frame = requestAnimationFrame(tick);
|
|
899
|
+
return () => {
|
|
900
|
+
cancelAnimationFrame(frame);
|
|
901
|
+
for (const drawn of lines.values()) {
|
|
902
|
+
drawn.g.remove();
|
|
903
|
+
drawn.ring.remove();
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
907
|
+
}, []);
|
|
908
|
+
/*
|
|
909
|
+
* A building pressed, above the page: its record, in the panel, the camera
|
|
910
|
+
* flying to it. The Scene's blocks take no press of their own (their tile
|
|
911
|
+
* does, for the district), so the building is found by where each stands.
|
|
912
|
+
* The end of a drag is the camera's, not a press.
|
|
913
|
+
*/
|
|
914
|
+
const downAt = useRef(null);
|
|
915
|
+
const pressed = (event) => {
|
|
916
|
+
const from = downAt.current;
|
|
917
|
+
if (from && Math.hypot(event.clientX - from.x, event.clientY - from.y) > 6)
|
|
918
|
+
return;
|
|
919
|
+
let id = null;
|
|
920
|
+
let front = -Infinity;
|
|
921
|
+
for (const building of box.current?.querySelectorAll("[data-graview-building]") ?? []) {
|
|
922
|
+
const r = building.getBoundingClientRect();
|
|
923
|
+
if (event.clientX < r.left || event.clientX > r.right || event.clientY < r.top || event.clientY > r.bottom)
|
|
924
|
+
continue;
|
|
925
|
+
if (r.bottom > front) {
|
|
926
|
+
front = r.bottom;
|
|
927
|
+
id = building.getAttribute("data-graview-building");
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
if (!id || !store.graph.getNode(id)) {
|
|
931
|
+
// Bare ground, or a district's own tile, which the Scene takes: at the city, no view is chosen any more.
|
|
932
|
+
if (!event.target?.closest?.("[data-graview-plot], .graview-kind-card, button, a"))
|
|
933
|
+
onGround();
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
event.preventDefault();
|
|
937
|
+
event.stopPropagation();
|
|
938
|
+
// A building is a record: its own page, beside the city, the camera coming down to it.
|
|
939
|
+
openRecord(id, PANEL);
|
|
940
|
+
};
|
|
941
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: box, "data-testid": "one-place-city", onPointerDownCapture: (event) => {
|
|
942
|
+
downAt.current = { x: event.clientX, y: event.clientY };
|
|
943
|
+
}, onClickCapture: pressed,
|
|
944
|
+
/*
|
|
945
|
+
* While the page is read the city is laid out, out of sight, so the
|
|
946
|
+
* first frame out has it to move: no pointer, no keyboard, no room
|
|
947
|
+
* in the page — and what of it reaches past the window is inside a
|
|
948
|
+
* box that scrolls, as a phone's sideways row would be.
|
|
949
|
+
*/
|
|
950
|
+
style: { position: "fixed", inset: 0, zIndex: ONE_FACE_LAYERS.city, display: "none", visibility: "hidden", overflow: "hidden", containerType: "size" }, children: [_jsx("style", { children: CITY_CSS }), _jsx(Scene, { renderer: "dom", blur: false, animate: false, camera: camera, options: sceneOptions, style: { width: "100%", height: "100%" } })] }), _jsx("svg", { ref: overlay, "aria-hidden": "true", "data-testid": "one-place-lines", width: view.width, height: view.height, style: { position: "fixed", left: 0, top: 0, zIndex: ONE_FACE_LAYERS.marks, pointerEvents: "none", overflow: "visible", opacity: 0 } }), _jsx("div", { ref: rings, hidden: true, role: "group", "aria-label": "What this page shows, in the city", style: { position: "fixed", left: 0, top: 0, width: 0, height: 0, zIndex: ONE_FACE_LAYERS.marks, opacity: 0 } })] }));
|
|
951
|
+
}
|
|
952
|
+
/** The one kind a view stands on: a kind's list, or a view of one kind; null for the home, a view of several kinds and the connections. */
|
|
953
|
+
export function signKindOf(where) {
|
|
954
|
+
if (where.type === "list")
|
|
955
|
+
return where.kind;
|
|
956
|
+
if (where.type === "place" && where.kinds.length === 1)
|
|
957
|
+
return where.kinds[0];
|
|
958
|
+
return null;
|
|
959
|
+
}
|
|
960
|
+
//# sourceMappingURL=one-place-city.js.map
|