@graview/react 0.1.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.
Files changed (147) hide show
  1. package/LICENSE +96 -0
  2. package/README.md +20 -0
  3. package/dist/activity.d.ts +113 -0
  4. package/dist/activity.d.ts.map +1 -0
  5. package/dist/activity.js +207 -0
  6. package/dist/activity.js.map +1 -0
  7. package/dist/animation.d.ts +64 -0
  8. package/dist/animation.d.ts.map +1 -0
  9. package/dist/animation.js +245 -0
  10. package/dist/animation.js.map +1 -0
  11. package/dist/captions.d.ts +43 -0
  12. package/dist/captions.d.ts.map +1 -0
  13. package/dist/captions.js +61 -0
  14. package/dist/captions.js.map +1 -0
  15. package/dist/channels.d.ts +15 -0
  16. package/dist/channels.d.ts.map +1 -0
  17. package/dist/channels.js +114 -0
  18. package/dist/channels.js.map +1 -0
  19. package/dist/connectors.d.ts +176 -0
  20. package/dist/connectors.d.ts.map +1 -0
  21. package/dist/connectors.js +837 -0
  22. package/dist/connectors.js.map +1 -0
  23. package/dist/context.d.ts +348 -0
  24. package/dist/context.d.ts.map +1 -0
  25. package/dist/context.js +568 -0
  26. package/dist/context.js.map +1 -0
  27. package/dist/drawn.d.ts +60 -0
  28. package/dist/drawn.d.ts.map +1 -0
  29. package/dist/drawn.js +58 -0
  30. package/dist/drawn.js.map +1 -0
  31. package/dist/edge-signs.d.ts +13 -0
  32. package/dist/edge-signs.d.ts.map +1 -0
  33. package/dist/edge-signs.js +76 -0
  34. package/dist/edge-signs.js.map +1 -0
  35. package/dist/hooks.d.ts +160 -0
  36. package/dist/hooks.d.ts.map +1 -0
  37. package/dist/hooks.js +457 -0
  38. package/dist/hooks.js.map +1 -0
  39. package/dist/index.d.ts +37 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +22 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/keyboard.d.ts +5 -0
  44. package/dist/keyboard.d.ts.map +1 -0
  45. package/dist/keyboard.js +178 -0
  46. package/dist/keyboard.js.map +1 -0
  47. package/dist/kit.d.ts +10 -0
  48. package/dist/kit.d.ts.map +1 -0
  49. package/dist/kit.js +32 -0
  50. package/dist/kit.js.map +1 -0
  51. package/dist/local-intelligence.d.ts +31 -0
  52. package/dist/local-intelligence.d.ts.map +1 -0
  53. package/dist/local-intelligence.js +66 -0
  54. package/dist/local-intelligence.js.map +1 -0
  55. package/dist/motion.d.ts +17 -0
  56. package/dist/motion.d.ts.map +1 -0
  57. package/dist/motion.js +26 -0
  58. package/dist/motion.js.map +1 -0
  59. package/dist/occupants.d.ts +45 -0
  60. package/dist/occupants.d.ts.map +1 -0
  61. package/dist/occupants.js +57 -0
  62. package/dist/occupants.js.map +1 -0
  63. package/dist/parallel.d.ts +19 -0
  64. package/dist/parallel.d.ts.map +1 -0
  65. package/dist/parallel.js +30 -0
  66. package/dist/parallel.js.map +1 -0
  67. package/dist/picking.d.ts +30 -0
  68. package/dist/picking.d.ts.map +1 -0
  69. package/dist/picking.js +140 -0
  70. package/dist/picking.js.map +1 -0
  71. package/dist/plots.d.ts +106 -0
  72. package/dist/plots.d.ts.map +1 -0
  73. package/dist/plots.js +306 -0
  74. package/dist/plots.js.map +1 -0
  75. package/dist/pointer.d.ts +27 -0
  76. package/dist/pointer.d.ts.map +1 -0
  77. package/dist/pointer.js +39 -0
  78. package/dist/pointer.js.map +1 -0
  79. package/dist/presence.d.ts +110 -0
  80. package/dist/presence.d.ts.map +1 -0
  81. package/dist/presence.js +280 -0
  82. package/dist/presence.js.map +1 -0
  83. package/dist/rails.d.ts +11 -0
  84. package/dist/rails.d.ts.map +1 -0
  85. package/dist/rails.js +15 -0
  86. package/dist/rails.js.map +1 -0
  87. package/dist/resolved-view.d.ts +78 -0
  88. package/dist/resolved-view.d.ts.map +1 -0
  89. package/dist/resolved-view.js +365 -0
  90. package/dist/resolved-view.js.map +1 -0
  91. package/dist/robot.d.ts +114 -0
  92. package/dist/robot.d.ts.map +1 -0
  93. package/dist/robot.js +93 -0
  94. package/dist/robot.js.map +1 -0
  95. package/dist/routes.d.ts +50 -0
  96. package/dist/routes.d.ts.map +1 -0
  97. package/dist/routes.js +150 -0
  98. package/dist/routes.js.map +1 -0
  99. package/dist/scene-camera.d.ts +25 -0
  100. package/dist/scene-camera.d.ts.map +1 -0
  101. package/dist/scene-camera.js +130 -0
  102. package/dist/scene-camera.js.map +1 -0
  103. package/dist/scene-hand.d.ts +110 -0
  104. package/dist/scene-hand.d.ts.map +1 -0
  105. package/dist/scene-hand.js +317 -0
  106. package/dist/scene-hand.js.map +1 -0
  107. package/dist/scene-helpers.d.ts +46 -0
  108. package/dist/scene-helpers.d.ts.map +1 -0
  109. package/dist/scene-helpers.js +108 -0
  110. package/dist/scene-helpers.js.map +1 -0
  111. package/dist/scene-lines.d.ts +76 -0
  112. package/dist/scene-lines.d.ts.map +1 -0
  113. package/dist/scene-lines.js +578 -0
  114. package/dist/scene-lines.js.map +1 -0
  115. package/dist/scene-root.d.ts +71 -0
  116. package/dist/scene-root.d.ts.map +1 -0
  117. package/dist/scene-root.js +790 -0
  118. package/dist/scene-root.js.map +1 -0
  119. package/dist/scene.d.ts +17 -0
  120. package/dist/scene.d.ts.map +1 -0
  121. package/dist/scene.js +17 -0
  122. package/dist/scene.js.map +1 -0
  123. package/dist/seat-marks.d.ts +35 -0
  124. package/dist/seat-marks.d.ts.map +1 -0
  125. package/dist/seat-marks.js +43 -0
  126. package/dist/seat-marks.js.map +1 -0
  127. package/dist/settings.d.ts +30 -0
  128. package/dist/settings.d.ts.map +1 -0
  129. package/dist/settings.js +73 -0
  130. package/dist/settings.js.map +1 -0
  131. package/dist/view-boundary.d.ts +33 -0
  132. package/dist/view-boundary.d.ts.map +1 -0
  133. package/dist/view-boundary.js +53 -0
  134. package/dist/view-boundary.js.map +1 -0
  135. package/dist/view-host.d.ts +57 -0
  136. package/dist/view-host.d.ts.map +1 -0
  137. package/dist/view-host.js +474 -0
  138. package/dist/view-host.js.map +1 -0
  139. package/dist/view-registry.d.ts +122 -0
  140. package/dist/view-registry.d.ts.map +1 -0
  141. package/dist/view-registry.js +20 -0
  142. package/dist/view-registry.js.map +1 -0
  143. package/dist/where-drawn.d.ts +151 -0
  144. package/dist/where-drawn.d.ts.map +1 -0
  145. package/dist/where-drawn.js +231 -0
  146. package/dist/where-drawn.js.map +1 -0
  147. package/package.json +60 -0
@@ -0,0 +1,578 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { edgeSelectionId, edgeOfSelection } from "@graview/layout";
3
+ import { CONNECTOR_DASH, connectorStroke, styleFor } from "@graview/render";
4
+ import { useMemo, useLayoutEffect, useState } from "react";
5
+ import { kitConnector, useKit } from "./kit.js";
6
+ import { orthogonalPoints, polylineD, routePoint, routedQuadratic } from "./routes.js";
7
+ import { Connectors, connectorStrands, tieRoute } from "./connectors.js";
8
+ import { drawnBox, measureVisible, visibleRect } from "./where-drawn.js";
9
+ import { captionRuns } from "./captions.js";
10
+ import { railInset } from "./rails.js";
11
+ /**
12
+ * EVERY LINE IN THE SCENE, measured against the DOM it is drawn over.
13
+ *
14
+ * Both line layers measure elements — panels, spans, chips — and anything
15
+ * measured during a render reads the PREVIOUS commit's geometry. The scene
16
+ * used to live with that: a tween paints sixty frames so one stale frame
17
+ * is invisible, and a settle tick after the last one catches the rest. A
18
+ * cut had no such cover, and a drag left every line one pointer event
19
+ * behind the card it was tied to.
20
+ *
21
+ * So the lines are their own component, and after each commit that could
22
+ * have moved anything — a new frame, a new selection, a graph edit that
23
+ * re-flowed a view — they re-render ONCE from a layout effect, before the
24
+ * browser paints. Only this subtree renders twice; the hosts do not.
25
+ *
26
+ * The strands are resolved here rather than inside a layer because two
27
+ * layers need the same answer: the connector layer draws them, and the
28
+ * ties layer yields to exactly the relations that already have a line.
29
+ * Deciding that from the layout alone was the bug: a session's line into
30
+ * the week was CLAIMED as drawn while it actually rose from the panel's
31
+ * centre, so selecting the session lit three of its four drills and left
32
+ * the fourth to a faint line from nowhere.
33
+ */
34
+ export function Lines({ frame, width, height, scheme, overview, selection, emphasis, stageRef, store, graphNodes, onPickEdge, liveOf, holding = false, }) {
35
+ const [asked, remeasure] = useState(0);
36
+ /*
37
+ * MEASURED ONCE, AFTER THE DOM IS THERE. Measuring during render read the
38
+ * boxes of the frame before, so every frame was measured twice — once
39
+ * wrong, and again after a re-render to get it right. Now the render
40
+ * draws from the layout's own boxes, and the measurement is taken once,
41
+ * after commit and before paint, and is what is drawn.
42
+ */
43
+ const [measured, setMeasured] = useState(null);
44
+ /*
45
+ * NOTHING MEASURES WHILE MOVING (docs/scale.md). Both ends of every line
46
+ * are in flight during a transition, so no line drawn then is right; and
47
+ * measuring every host, every pick and every member box on every frame
48
+ * was the largest cost of a transition. The lines leave with the flight
49
+ * and are measured once, where it lands. A pan moves them by transform
50
+ * with the world, which is not a new frame, so they follow the hand.
51
+ */
52
+ const moving = frame.t < 1;
53
+ useLayoutEffect(() => {
54
+ if (moving || holding)
55
+ return;
56
+ setMeasured(connectorStrands(frame.nodes, frame.connectors, stageRef.current, overview, scheme));
57
+ }, [frame, moving, holding, selection, overview, graphNodes, scheme, asked, stageRef]);
58
+ /*
59
+ * A LINE POINTS AT WHERE A THING IS, NOT AT WHERE IT WAS.
60
+ *
61
+ * Connectors are anchored on MEASURED DOM boxes — that is what lets a line
62
+ * land on one row of a matrix rather than on the panel containing it — and
63
+ * the measurement was taken once, when the frame, the selection, the
64
+ * altitude or the graph changed. None of those is what moves a row.
65
+ *
66
+ * What moves a row is a scroll. A matrix wider than its panel, a roster
67
+ * taller than its card, a lens with a filter in it: the content slides and
68
+ * every line still points at the place the content used to be. It does
69
+ * not look like a stale measurement, it looks like the lines are wrong
70
+ * about the graph.
71
+ *
72
+ * Scroll does not bubble, so this listens in the capture phase and hears
73
+ * every scroller in the stage; a ResizeObserver catches the other half —
74
+ * a panel that grows because something inside it opened moves everything
75
+ * below it, and no frame changed.
76
+ */
77
+ /*
78
+ * Which views there are, not where they are: a drag moves every view it
79
+ * touches on every pointer move, and re-observing the whole stage for
80
+ * each of those moves cost more than the drag.
81
+ */
82
+ const views = frame.nodes.map((node) => node.id).join("\n");
83
+ useLayoutEffect(() => {
84
+ const stage = stageRef.current;
85
+ if (stage === null || typeof window === "undefined")
86
+ return;
87
+ let queued = 0;
88
+ const again = () => {
89
+ if (queued !== 0)
90
+ return;
91
+ queued = requestAnimationFrame(() => {
92
+ queued = 0;
93
+ remeasure((n) => n + 1);
94
+ });
95
+ };
96
+ stage.addEventListener("scroll", again, { capture: true, passive: true });
97
+ window.addEventListener("resize", again, { passive: true });
98
+ const watch = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(again);
99
+ if (watch) {
100
+ watch.observe(stage);
101
+ /* Every view, because a view growing moves its neighbours' members. */
102
+ for (const view of stage.querySelectorAll("[data-graview-view]"))
103
+ watch.observe(view);
104
+ }
105
+ return () => {
106
+ if (queued !== 0)
107
+ cancelAnimationFrame(queued);
108
+ stage.removeEventListener("scroll", again, { capture: true });
109
+ window.removeEventListener("resize", again);
110
+ watch?.disconnect();
111
+ };
112
+ }, [stageRef, views]);
113
+ if (moving)
114
+ return null;
115
+ /*
116
+ * Without a DOM — the first render, a server — the lines stand on the
117
+ * layout's own boxes; and so they do while a card is held, following the
118
+ * hand from the layout rather than measuring the page on every move.
119
+ */
120
+ const strands = (holding ? null : measured) ?? connectorStrands(frame.nodes, frame.connectors, null, overview, scheme);
121
+ const drawnSingles = new Set();
122
+ for (const strand of strands) {
123
+ if (strand.edges.length !== 1)
124
+ continue;
125
+ const edge = strand.edges[0];
126
+ drawnSingles.add(`${strand.connector.kind}|${edge.from}|${edge.to}`);
127
+ }
128
+ return (_jsxs(_Fragment, { children: [_jsx(Connectors, { strands: strands, result: frame, scheme: scheme, overview: overview, selection: selection, emphasis: emphasis, stageRef: stageRef, onPickEdge: onPickEdge, liveOf: liveOf }), _jsx(SelectionTies, { stageRef: stageRef, nodes: frame.nodes, scheme: scheme, selection: selection, store: store, graphNodes: graphNodes, overview: overview, width: width, height: height, onPickEdge: onPickEdge, alreadyDrawn: drawnSingles, tick: asked })] }));
129
+ }
130
+ function SelectionTies({ stageRef, nodes, scheme, selection, store, graphNodes, overview, width, height, onPickEdge, alreadyDrawn, tick, }) {
131
+ const kit = useKit();
132
+ const ties = useMemo(() => {
133
+ if (selection.length === 0 || selection.length > 4)
134
+ return [];
135
+ const chosen = new Set(selection);
136
+ const found = [];
137
+ /*
138
+ * A SELECTED EDGE KEEPS ITS LINE. Ties used to derive only from
139
+ * selected nodes, so picking a line replaced the selection and the
140
+ * line's own reason to exist vanished under it — an inspector about a
141
+ * relation the picture no longer showed.
142
+ */
143
+ for (const id of selection) {
144
+ const edge = edgeOfSelection(id);
145
+ if (edge)
146
+ found.push({ kind: edge.kind, self: edge.from, other: edge.to });
147
+ }
148
+ for (const edge of store.graph.allEdges()) {
149
+ const self = chosen.has(edge.from) ? edge.from : chosen.has(edge.to) ? edge.to : null;
150
+ if (!self)
151
+ continue;
152
+ const other = self === edge.from ? edge.to : edge.from;
153
+ if (chosen.has(other))
154
+ continue;
155
+ found.push({ kind: edge.kind, self, other });
156
+ }
157
+ if (found.length <= 14)
158
+ return found;
159
+ /*
160
+ * A busy selection keeps its FIRST FOURTEEN rather than losing all of
161
+ * them: a person on half the roster went from a fan of lines to none
162
+ * at all the moment their sixteenth edge arrived, which read as the
163
+ * selection having no relations. Ties to a card actually on screen
164
+ * come first — a line to a real thing beats a line to a stand-in.
165
+ */
166
+ const placed = new Set(nodes.map((node) => node.id));
167
+ return found
168
+ .map((tie, index) => ({ tie, index, real: placed.has(tie.other) ? 0 : 1 }))
169
+ .sort((a, b) => a.real - b.real || a.index - b.index)
170
+ .slice(0, 14)
171
+ .map(({ tie }) => tie);
172
+ }, [store, selection, graphNodes, nodes]);
173
+ /*
174
+ * MEASURED AFTER COMMIT, NOT DURING RENDER.
175
+ *
176
+ * These lines are anchored on the DOM, and the render that draws a frame
177
+ * runs before that frame's DOM exists — so every tie was measured against
178
+ * the frame before, and after the last frame of a navigation nothing
179
+ * rendered again: the lines stayed where the cards had been, dashes
180
+ * starting in the air at the edge of a card that had moved. The
181
+ * measurement is taken in a layout effect, after the boxes are where the
182
+ * frame put them and before paint, and again whenever the layer's tick
183
+ * says a scroll or a resize moved something.
184
+ */
185
+ const measure = () => {
186
+ if (ties.length === 0 || typeof document === "undefined")
187
+ return [];
188
+ const stage = stageRef.current?.getBoundingClientRect();
189
+ if (!stage)
190
+ return [];
191
+ /*
192
+ * The ELEMENT standing for an id, when the view drew one: a pick target,
193
+ * or a board slot (an occupied slot's pick is its occupant, but the slot
194
+ * itself is still a place a tie can land on).
195
+ */
196
+ /*
197
+ * EVERY element wearing the id, as candidate anchors. One node can be
198
+ * drawn several times — a chip in a card, a row label, a matrix dot per
199
+ * relation — and which drawing a tie should land on depends on where the
200
+ * OTHER end is: the pair of drawings closest to each other is the line a
201
+ * person would draw. (Picking the single smallest element anchored a
202
+ * 3.2-row tie to a 5.2-row dot three rows away.) Chrome is not scene:
203
+ * the activity rail and inspector repeat node names as chips, and a tie
204
+ * must never land on the furniture.
205
+ */
206
+ /*
207
+ * A MARK IS NOT THE THING.
208
+ *
209
+ * A lens that draws a relation — a coverage matrix above all — marks the
210
+ * crossing of a row and a column, and the mark wears the column's id so
211
+ * a press on it means the column. Read as an anchor, that made a selected
212
+ * revenue stream fan five dashed lines up into the cells of somebody
213
+ * else's ownership matrix: lines that said nothing about ownership and
214
+ * crossed the whole picture to restate a fact the district below already
215
+ * held. The fundamental mistake was treating everything that wears an id
216
+ * as a place the thing is. A view says which of its drawings are marks
217
+ * (`data-graview-mark`) and a tie never lands on one; a thing drawn only
218
+ * as marks falls through to the district that holds it, which is where
219
+ * the thing is. Said explicitly rather than guessed from repetition: a
220
+ * planting drawn across five months of a calendar is drawn five times
221
+ * and is still the thing, every time.
222
+ */
223
+ const elementBoxes = (id, insideOwnCard) => {
224
+ const els = stageRef.current?.querySelectorAll(`[data-graview-pick="${CSS.escape(id)}"], [data-graview-slot="${CSS.escape(id)}"]`);
225
+ const boxes = [];
226
+ for (const el of els ?? []) {
227
+ if (el.closest("[data-graview-offstage]"))
228
+ continue;
229
+ if (insideOwnCard(el))
230
+ continue;
231
+ if (el.closest("[data-graview-mark]"))
232
+ continue;
233
+ // What shows of it, not its whole rectangle: a chip scrolled off the
234
+ // end of its roster anchors nothing.
235
+ const rect = visibleRect(el, stageRef.current);
236
+ if (!rect)
237
+ continue;
238
+ // A rotated header's bounding box is a huge diagonal rectangle whose
239
+ // border is nowhere near the visible text — anything card-sized or
240
+ // smaller stays; the degenerate stays out via the closest-pair pick
241
+ // preferring compact boxes on ties below.
242
+ boxes.push(rect);
243
+ }
244
+ // Compact drawings first, so a distance tie resolves to the chip, not
245
+ // the panel that contains it.
246
+ return boxes.sort((a, b) => a.width * a.height - b.width * b.height);
247
+ };
248
+ /** The laid-out node that IS this id, or stands for it. */
249
+ const hostOf = (id) => nodes.find((node) => node.id === id) ??
250
+ nodes.find((node) => node.aggregate?.memberIds.includes(id));
251
+ /*
252
+ * A VIEW THAT DRAWS BOTH ENDS HAS DRAWN THE RELATION.
253
+ *
254
+ * `connectorStrands` has said this for as long as there have been lines;
255
+ * ties said a weaker version of it — "not inside the SELECTION's own
256
+ * card" — and in a matrix neither end owns the card. The coverage lens
257
+ * belongs to the volunteers; a chosen shift is a row in it. So the guard
258
+ * never fired, and choosing a shift drew a tie from its row label to the
259
+ * cell in the chosen volunteer's column: a horizontal rule across one
260
+ * row of a table, restating the mark already sitting at its end. The
261
+ * cell IS the edge — the lens draws it, and lights it when either end is
262
+ * chosen.
263
+ *
264
+ * Asked of the drawings rather than the nodes, so it holds however the
265
+ * view came to draw them.
266
+ */
267
+ const drawingsOf = (id) => `[data-graview-pick="${CSS.escape(id)}"], [data-graview-slot="${CSS.escape(id)}"]`;
268
+ const someViewDrawsBoth = (a, b) => {
269
+ const stageNow = stageRef.current;
270
+ if (!stageNow)
271
+ return false;
272
+ for (const host of stageNow.querySelectorAll("[data-graview-view]")) {
273
+ const here = host.querySelector(drawingsOf(a));
274
+ if (here === null || here.closest("[data-graview-offstage]"))
275
+ continue;
276
+ const there = host.querySelector(drawingsOf(b));
277
+ if (there !== null && !there.closest("[data-graview-offstage]"))
278
+ return true;
279
+ }
280
+ return false;
281
+ };
282
+ const seen = new Set();
283
+ const found = [];
284
+ for (const tie of ties) {
285
+ if (someViewDrawsBoth(tie.self, tie.other))
286
+ continue;
287
+ const selfHost = hostOf(tie.self);
288
+ const selfHostEl = selfHost
289
+ ? stageRef.current?.querySelector(`[data-graview-view="${CSS.escape(selfHost.id)}"]`)
290
+ : null;
291
+ const fromCandidates = elementBoxes(tie.self, () => false);
292
+ const hasFromEl = fromCandidates.length > 0;
293
+ if (!hasFromEl && selfHost) {
294
+ const box = measureVisible(stageRef.current, selfHost.id, false) ?? drawnBox(selfHost, scheme);
295
+ if (box)
296
+ fromCandidates.push(box);
297
+ }
298
+ /*
299
+ * Where the OTHER end lands, in order of honesty:
300
+ *
301
+ * 1. Its own placed card — a raised or ring node is the thing itself,
302
+ * and beats any chip that merely mentions it (the fan of dashes
303
+ * sweeping out of the fixture card's own border was ties preferring
304
+ * the card's OWN chips over the real cards below).
305
+ * 2. An element standing for it — but never one inside the view that
306
+ * already draws the selection. A VIEW THAT DRAWS BOTH ENDS HAS
307
+ * DRAWN THE RELATION; `connectorStrands` has said so for as long as
308
+ * there have been lines, and ties made an exception for chip-to-chip
309
+ * inside one view, on the grounds that it was the view's wiring made
310
+ * visible. In a matrix it is the opposite. The cell at the
311
+ * intersection IS the edge — the lens marks it, and lights it when
312
+ * either end is chosen — so the tie added a second drawing of the
313
+ * same fact, and because both ends sit in one row it drew it as a
314
+ * horizontal rule running from the row label to the cell. One rule
315
+ * for both layers, and the view keeps its own relations.
316
+ * 3. The group card containing it — unless that is the very card the
317
+ * selection sits in, in which case the tie is internal and the
318
+ * view's own emphasis already shows it.
319
+ */
320
+ const otherNode = nodes.find((node) => node.id === tie.other);
321
+ const toCandidates = [];
322
+ // The far end STANDS IN for the node when nothing draws the node
323
+ // itself: a person with no card of their own resolves to their kind's
324
+ // district. Such a line recedes below — it points at where the rest
325
+ // live rather than claiming the thing is there.
326
+ let toProxy = false;
327
+ if (otherNode) {
328
+ const box = measureVisible(stageRef.current, otherNode.id, overview) ?? drawnBox(otherNode, scheme);
329
+ if (box)
330
+ toCandidates.push(box);
331
+ }
332
+ else {
333
+ toCandidates.push(...elementBoxes(tie.other, (el) => (selfHostEl ? selfHostEl.contains(el) : false)));
334
+ if (toCandidates.length === 0) {
335
+ const otherHost = hostOf(tie.other);
336
+ if (otherHost && (!selfHost || otherHost.id !== selfHost.id)) {
337
+ const box = measureVisible(stageRef.current, otherHost.id, overview) ??
338
+ drawnBox(otherHost, scheme);
339
+ if (box) {
340
+ toCandidates.push(box);
341
+ toProxy = true;
342
+ }
343
+ }
344
+ }
345
+ }
346
+ if (fromCandidates.length === 0 || toCandidates.length === 0)
347
+ continue;
348
+ /*
349
+ * From ALTITUDE a stand-in line says nothing the constellation does
350
+ * not already draw between the districts themselves — and the two
351
+ * near-identical dashes to one district read as a mistake. The proxy
352
+ * tie is a ground-level device.
353
+ */
354
+ if (toProxy && overview)
355
+ continue;
356
+ /*
357
+ * THE CLOSEST PAIR of drawings is the line a person would draw. Both
358
+ * ends can be on screen more than once; a tie between the two nearest
359
+ * instances says the relation without crossing the picture to reach a
360
+ * copy further away.
361
+ */
362
+ let fromBox = fromCandidates[0];
363
+ let toBox = toCandidates[0];
364
+ let nearest = Infinity;
365
+ for (const a of fromCandidates) {
366
+ for (const b of toCandidates) {
367
+ const gap = Math.hypot(a.x + a.width / 2 - (b.x + b.width / 2), a.y + a.height / 2 - (b.y + b.height / 2));
368
+ if (gap < nearest) {
369
+ nearest = gap;
370
+ fromBox = a;
371
+ toBox = b;
372
+ }
373
+ }
374
+ }
375
+ /*
376
+ * ONE LINE PER RELATION. The connector layer draws (and takes clicks
377
+ * for) any relation whose both ends are placed cards; a tie repeating
378
+ * it produced the double line where one answered the pointer and its
379
+ * twin did not. The tie yields BEFORE claiming a dedupe slot, or a
380
+ * later tie sharing its coordinates dies for a line never drawn.
381
+ */
382
+ if (alreadyDrawn?.has(`${tie.kind}|${tie.self}|${tie.other}`) ||
383
+ alreadyDrawn?.has(`${tie.kind}|${tie.other}|${tie.self}`)) {
384
+ continue;
385
+ }
386
+ /*
387
+ * One line per relation between two DRAWINGS. Keyed on both boxes in
388
+ * full: keyed on the origin's x alone, two selected chips stacked in
389
+ * one column lost one of their ties to the same target.
390
+ */
391
+ const key = `${tie.kind}:${Math.round(fromBox.x)},${Math.round(fromBox.y)}` +
392
+ `:${Math.round(toBox.x)},${Math.round(toBox.y)}`;
393
+ if (seen.has(key))
394
+ continue;
395
+ seen.add(key);
396
+ const route = tieRoute(fromBox, toBox);
397
+ if (!route)
398
+ continue;
399
+ const { from, to, control } = route;
400
+ // The real edge this tie stands for, oriented the way the graph holds it.
401
+ const oriented = [...store.graph.allEdges()].find((edge) => edge.kind === tie.kind &&
402
+ ((edge.from === tie.self && edge.to === tie.other) ||
403
+ (edge.from === tie.other && edge.to === tie.self)));
404
+ found.push({
405
+ key: `${tie.kind}:${tie.self}:${tie.other}`,
406
+ kind: tie.kind,
407
+ endX: to.x,
408
+ endY: to.y,
409
+ from,
410
+ to,
411
+ control,
412
+ fromBox,
413
+ toBox,
414
+ proxy: toProxy,
415
+ edgeId: oriented ? edgeSelectionId(oriented.kind, oriented.from, oriented.to) : null,
416
+ });
417
+ }
418
+ return found;
419
+ };
420
+ const [lines, setLines] = useState([]);
421
+ useLayoutEffect(() => {
422
+ setLines(measure());
423
+ // The measurement depends on the DOM the frame committed, which these
424
+ // name; `measure` itself closes over nothing that changes without them.
425
+ // eslint-disable-next-line react-hooks/exhaustive-deps
426
+ }, [ties, nodes, overview, scheme, width, height, alreadyDrawn, tick, stageRef]);
427
+ if (lines.length === 0)
428
+ return null;
429
+ return (_jsx("svg", { "aria-hidden": lines.some((line) => line.edgeId) ? undefined : true, "data-graview-ties": lines.length, "data-graview-world": "", width: width, height: height, style: {
430
+ position: "absolute",
431
+ left: 0,
432
+ top: 0,
433
+ pointerEvents: "none",
434
+ // Over the views: these lines START on an element inside one, and a
435
+ // line into the shelf that dives behind the focus card en route says
436
+ // nothing.
437
+ zIndex: 3,
438
+ }, children: lines.map((line) => {
439
+ const { connector, style } = kitConnector(kit, line.kind);
440
+ // A kind the kit keeps quiet is not drawn — still selectable from the inspector.
441
+ if (!connector.visible)
442
+ return null;
443
+ const quadratic = { p0: line.from, c: line.control, p1: line.to };
444
+ // The route is the kit's call: the arc the layout chose, its chord, or two elbows.
445
+ const d = connector.route === "orthogonal"
446
+ ? polylineD([orthogonalPoints(line.from, line.to)])
447
+ : (({ p0, c, p1 }) => `M ${p0.x} ${p0.y} Q ${c.x} ${c.y} ${p1.x} ${p1.y}`)(routedQuadratic(connector.route, quadratic));
448
+ /*
449
+ * A tie that stands for one edge takes the pointer, like any line:
450
+ * the hit run is the visible stretch between its two endpoint
451
+ * boxes, so pressing a line never steals a card's click.
452
+ */
453
+ let hit = null;
454
+ // A stand-in line takes no pointer: a 14px corridor across half
455
+ // the scene stole clicks from every card it crossed, to select a
456
+ // relation whose far end is not even drawn. The edge stays
457
+ // selectable where it is really drawn, and from the inspector.
458
+ if (line.edgeId && onPickEdge && !line.proxy) {
459
+ const inside = (box, p) => p.x >= box.x && p.x <= box.x + box.width && p.y >= box.y && p.y <= box.y + box.height;
460
+ const points = [];
461
+ for (let i = 0; i <= 40; i++) {
462
+ const point = routePoint(connector.route, quadratic, i / 40);
463
+ if (inside(line.fromBox, point) || inside(line.toBox, point))
464
+ continue;
465
+ points.push(point);
466
+ }
467
+ if (points.length >= 2) {
468
+ hit = (_jsx("path", { "data-graview-edge": line.edgeId, className: "graview-edge-hit", d: `M ${points[0].x} ${points[0].y} ${points
469
+ .slice(1)
470
+ .map((point) => `L ${point.x} ${point.y}`)
471
+ .join(" ")}`, fill: "none",
472
+ // The ends stay clear: a line lands ON a chip, and a hit stroke that reached
473
+ // the chip took the click meant for it. Seven percent off each end.
474
+ pathLength: 1, strokeDasharray: "0.86", strokeDashoffset: -0.07, stroke: "transparent", strokeWidth: 14, style: { pointerEvents: "stroke", cursor: "pointer" }, onClick: (event) => {
475
+ event.stopPropagation();
476
+ onPickEdge(line.edgeId, { x: event.clientX, y: event.clientY });
477
+ }, onContextMenu: (event) => {
478
+ event.preventDefault();
479
+ event.stopPropagation();
480
+ onPickEdge(line.edgeId, { x: event.clientX, y: event.clientY });
481
+ } }));
482
+ }
483
+ }
484
+ return (
485
+ /*
486
+ * A line to a STAND-IN recedes: the far end is the kind's
487
+ * district, not the thing itself, and five of those at full
488
+ * strength crossing the scene is a hairball. Present enough to
489
+ * say "the rest live over there", never louder than a real tie.
490
+ */
491
+ _jsxs("g", { opacity: line.proxy ? 0.32 : 0.72, children: [_jsx("path", { "data-graview-tie": line.kind, "data-graview-tie-proxy": line.proxy || undefined, d: d, fill: "none", stroke: connectorStroke(style), strokeWidth: line.proxy ? 1.1 : 1.6, strokeDasharray: CONNECTOR_DASH[style.pattern], strokeLinecap: "round" }), _jsx("circle", { cx: line.endX, cy: line.endY, r: line.proxy ? 2 : 2.6, fill: connectorStroke(style) }), hit] }, line.key));
492
+ }) }));
493
+ }
494
+ /**
495
+ * What plane 1 is, said in words, over the run of cards it applies to.
496
+ *
497
+ * The schema has always carried a description on every edge — "who does the
498
+ * run", "a nap that must not be interrupted" — and nothing ever showed them.
499
+ * A row of anonymous cards under the thing you clicked is a puzzle; the same
500
+ * row under "who does the run" is an answer. Layout groups the neighbourhood
501
+ * by edge kind, so each caption spans one contiguous run rather than
502
+ * repeating itself once per card.
503
+ */
504
+ export function RelationCaptions({ nodes, scheme, width: stageWidth, stageRef, moving = false, holding = false, }) {
505
+ const kit = useKit();
506
+ /* Measured after commit, for the reason the ties are: a caption placed
507
+ over where a card WAS hung in open ground after every navigation. */
508
+ const [runs, setRuns] = useState([]);
509
+ useLayoutEffect(() => {
510
+ // Nothing under a held card moves: the captions keep where they were measured.
511
+ if (moving || holding)
512
+ return;
513
+ setRuns(placeCaptions());
514
+ // eslint-disable-next-line react-hooks/exhaustive-deps
515
+ }, [nodes, moving, holding, scheme, stageWidth, stageRef]);
516
+ function placeCaptions() {
517
+ const entries = [];
518
+ for (const node of nodes) {
519
+ if (!node.via || Math.round(node.plane) !== 1)
520
+ continue;
521
+ /*
522
+ * Above the PANEL someone can see, not the band slot the layout allots:
523
+ * a raised card centres its panel in a taller host, so a caption hung
524
+ * from the host's top floated in open ground half a band above the
525
+ * cards it captions.
526
+ */
527
+ const measured = measureVisible(stageRef.current, node.id, false);
528
+ const { scale } = styleFor(1, scheme);
529
+ entries.push({
530
+ key: `${node.via.edgeKind}|${node.via.direction}`,
531
+ text: node.via.description ?? node.via.edgeKind.replace(/-/g, " "),
532
+ left: measured?.x ?? node.x,
533
+ right: measured ? measured.x + measured.width : node.x + node.width * scale,
534
+ top: measured?.y ?? node.y,
535
+ });
536
+ }
537
+ const rails = railInset(stageWidth);
538
+ return captionRuns(entries, { left: rails.left, right: stageWidth - rails.right });
539
+ }
540
+ // The kit may keep the captions off: the edge's words stay on the inspector.
541
+ if (runs.length === 0 || !kit.captions.visible)
542
+ return null;
543
+ if (moving)
544
+ return null;
545
+ return (_jsx("div", { "aria-hidden": "true", style: { position: "absolute", inset: 0, pointerEvents: "none", zIndex: 3 }, children: runs.map((run) => {
546
+ /*
547
+ * The caption may be WIDER than the cards it captions.
548
+ *
549
+ * Constrained to the run, a single neighbour gave it about 240
550
+ * pixels and "attends a block, or rides along on a run" was cut to
551
+ * "attends a block, or rides alo…" — the schema's own words, the one
552
+ * thing this element exists to show, truncated mid-word with empty
553
+ * ground on both sides of it. It is centred over the run and clamped
554
+ * to the stage instead, so it borrows the gutter when it needs it.
555
+ */
556
+ const { left, width: span } = run;
557
+ return (_jsx("div", { "data-graview-relation": run.key, title: run.text, style: {
558
+ position: "absolute",
559
+ left,
560
+ width: span,
561
+ textAlign: "center",
562
+ // Sits in the gutter above the run, not on top of the cards.
563
+ top: Math.max(0, run.top - 19),
564
+ fontSize: "0.75rem",
565
+ letterSpacing: "0.09em",
566
+ textTransform: "uppercase",
567
+ color: "var(--graview-ink-faint)",
568
+ whiteSpace: "nowrap",
569
+ overflow: "hidden",
570
+ textOverflow: "ellipsis",
571
+ }, children: _jsx("span", { style: {
572
+ background: "var(--graview-ground)",
573
+ padding: "1px 7px",
574
+ borderRadius: 4,
575
+ }, children: run.text }) }, run.key));
576
+ }) }));
577
+ }
578
+ //# sourceMappingURL=scene-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-lines.js","sourceRoot":"","sources":["../src/scene-lines.tsx"],"names":[],"mappings":";AACA,OAAO,EAA2B,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAsC,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,KAAK,CAAsB,EACzC,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,E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