structured-context-map-views 0.6.1 → 0.7.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 (75) hide show
  1. package/README.md +1 -1
  2. package/dist/{ParameterControls-A1HJWyt9.js → ParameterControls-Be05VST0.js} +505 -188
  3. package/dist/ParameterControls-Be05VST0.js.map +1 -0
  4. package/dist/artifact.html +70 -1
  5. package/dist/artifact.js +2 -2
  6. package/dist/artifact.js.map +1 -1
  7. package/dist/cli.js +12 -6
  8. package/dist/cli.js.map +1 -1
  9. package/dist/{definition-Cp1CCigh.js → definition-SjmROmJC.js} +308 -188
  10. package/dist/definition-SjmROmJC.js.map +1 -0
  11. package/dist/html.js +19 -0
  12. package/dist/html.js.map +1 -0
  13. package/dist/index.js +3 -3
  14. package/dist/node-ctbuxC-s.js +74 -0
  15. package/dist/node-ctbuxC-s.js.map +1 -0
  16. package/dist/node.js +2 -2
  17. package/dist/page.html +94 -25
  18. package/dist/{projection-C-dATsdO.js → projection-DKNLziP0.js} +282 -124
  19. package/dist/projection-DKNLziP0.js.map +1 -0
  20. package/dist/read-definitions-DFcOXatz.js +51 -0
  21. package/dist/read-definitions-DFcOXatz.js.map +1 -0
  22. package/dist/styles.css +69 -0
  23. package/dist/types/artifact/load.d.ts +1 -1
  24. package/dist/types/{layouts/EdgeOverlay.d.ts → components/ConnectorOverlay.d.ts} +6 -15
  25. package/dist/types/components/GraphLayout.d.ts +8 -0
  26. package/dist/types/components/LandscapeLayout.d.ts +9 -0
  27. package/dist/types/{layouts → components}/MapView.d.ts +4 -1
  28. package/dist/types/components/NeighbourhoodLayout.d.ts +7 -0
  29. package/dist/types/{layouts/NodeCard.d.ts → components/NodeComponent.d.ts} +1 -1
  30. package/dist/types/components/TreeLayout.d.ts +6 -0
  31. package/dist/types/{layouts → components}/XYLayout.d.ts +3 -3
  32. package/dist/types/{layouts → components}/annotations-context.d.ts +1 -1
  33. package/dist/types/components/layout.d.ts +22 -0
  34. package/dist/types/core/annotations.d.ts +2 -3
  35. package/dist/types/core/definition.d.ts +664 -30
  36. package/dist/types/core/layouts/graph/schema.d.ts +24 -0
  37. package/dist/types/core/layouts/helpers.d.ts +42 -0
  38. package/dist/types/core/layouts/landscape/projection.d.ts +75 -0
  39. package/dist/types/core/layouts/landscape/schema.d.ts +223 -0
  40. package/dist/types/core/layouts/neighbourhood/projection.d.ts +26 -0
  41. package/dist/types/core/layouts/neighbourhood/schema.d.ts +51 -0
  42. package/dist/types/core/layouts/schemas.d.ts +427 -0
  43. package/dist/types/core/{tree.d.ts → layouts/tree/projection.d.ts} +9 -11
  44. package/dist/types/core/layouts/xy/projection.d.ts +32 -0
  45. package/dist/types/core/{format/xy-layout.d.ts → layouts/xy/schema.d.ts} +2 -0
  46. package/dist/types/core/{format → schema}/definition-schema.d.ts +22 -12
  47. package/dist/types/core/{snapshot.d.ts → space-snapshot.d.ts} +1 -4
  48. package/dist/types/index.d.ts +6 -9
  49. package/dist/types/node/html.d.ts +6 -0
  50. package/dist/types/node/index.d.ts +7 -30
  51. package/dist/types/node/page.d.ts +1 -1
  52. package/dist/types/node/read-definitions.d.ts +17 -0
  53. package/dist/types/node/snapshot.d.ts +1 -1
  54. package/dist/types/viewer/Viewer.d.ts +5 -5
  55. package/package.json +10 -4
  56. package/dist/ParameterControls-A1HJWyt9.js.map +0 -1
  57. package/dist/definition-Cp1CCigh.js.map +0 -1
  58. package/dist/node-aizYAYlq.js +0 -130
  59. package/dist/node-aizYAYlq.js.map +0 -1
  60. package/dist/projection-C-dATsdO.js.map +0 -1
  61. package/dist/types/core/format/index.d.ts +0 -450
  62. package/dist/types/core/format/landscape-layout.d.ts +0 -102
  63. package/dist/types/core/graph.d.ts +0 -16
  64. package/dist/types/core/landscape.d.ts +0 -44
  65. package/dist/types/core/occurrence.d.ts +0 -11
  66. package/dist/types/core/xy.d.ts +0 -43
  67. package/dist/types/layouts/LandscapeLayout.d.ts +0 -8
  68. package/dist/types/layouts/TreeLayout.d.ts +0 -16
  69. /package/dist/types/{layouts → components}/ParameterControls.d.ts +0 -0
  70. /package/dist/types/{layouts → components}/ParameterInputs.d.ts +0 -0
  71. /package/dist/types/{layouts → components}/useParameterControls.d.ts +0 -0
  72. /package/dist/types/core/{format/tree-layout.d.ts → layouts/tree/schema.d.ts} +0 -0
  73. /package/dist/types/core/{format → schema}/param-ref.d.ts +0 -0
  74. /package/dist/types/core/{format → schema}/schema-url.d.ts +0 -0
  75. /package/dist/types/core/{format → schema}/settings.d.ts +0 -0
@@ -1,18 +1,136 @@
1
- import { i as treeLinks, n as buildLandscape, o as filterAnnotations, r as buildTree, s as worstSeverity, t as buildXYPlot } from "./projection-C-dATsdO.js";
2
- import { a as resolveRegions, i as resolveParameterValues } from "./definition-Cp1CCigh.js";
1
+ import { a as buildLandscape, c as isHierarchyEdge, d as filterAnnotations, f as worstSeverity, i as buildNeighbourhood, l as occurrenceKey, n as buildTree, o as assignLanes, r as treeConnectors, s as edgesWithin, t as buildXYPlot } from "./projection-DKNLziP0.js";
2
+ import { a as resolveParameterValues, o as resolveRegions } from "./definition-SjmROmJC.js";
3
3
  import { createContext, useCallback, useContext, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
4
+ import { forceCollide, forceLink, forceManyBody, forceSimulation, forceX, forceY } from "d3-force";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- /** The annotations a map view shows, already narrowed by its validation settings. Read by node cards. */
6
+ /** The annotations a map view shows, already narrowed by its validation settings. Read by node components. */
6
7
  var AnnotationsContext = createContext(/* @__PURE__ */ new Map());
7
8
  var useAnnotations = () => useContext(AnnotationsContext);
8
9
  //#endregion
9
- //#region src/layouts/NodeCard.tsx
10
+ //#region src/components/ConnectorOverlay.tsx
11
+ /**
12
+ * SVG layer drawing connectors between rendered occurrences.
13
+ *
14
+ * Measures occurrence elements after layout and redraws when the container or any occurrence
15
+ * resizes, so it follows embedded panes that resize independently of the window, and reflows
16
+ * such as late font loads. The SVG fills the container instead of being sized from it, so it
17
+ * never holds the container open after the layout shrinks.
18
+ */
19
+ function ConnectorOverlay({ connectors, edges, elements, container, routing }) {
20
+ const [paths, setPaths] = useState([]);
21
+ useLayoutEffect(() => {
22
+ if (!container || !edges.show) return;
23
+ const measure = () => {
24
+ const origin = container.getBoundingClientRect();
25
+ const paths = [];
26
+ for (const { from, to, field, lane = 0, dashed = false } of connectors) {
27
+ const a = elements.get(from)?.getBoundingClientRect();
28
+ const b = elements.get(to)?.getBoundingClientRect();
29
+ if (!a || !b) continue;
30
+ const [d, at] = routing === "straight" ? line(a, b, origin, lane) : connector(a, b, origin, routing);
31
+ paths.push({
32
+ key: `${from}→${to}${field ?? ""}`,
33
+ d,
34
+ dashed,
35
+ label: edges.labels ? field : void 0,
36
+ at
37
+ });
38
+ }
39
+ setPaths(paths);
40
+ };
41
+ measure();
42
+ const observer = new ResizeObserver(measure);
43
+ observer.observe(container);
44
+ for (const element of elements.values()) observer.observe(element);
45
+ return () => observer.disconnect();
46
+ }, [
47
+ connectors,
48
+ edges.show,
49
+ edges.labels,
50
+ elements,
51
+ container,
52
+ routing
53
+ ]);
54
+ if (!edges.show) return null;
55
+ return /* @__PURE__ */ jsxs("svg", {
56
+ "aria-hidden": "true",
57
+ className: "mv:pointer-events-none mv:absolute mv:inset-0 mv:h-full mv:w-full mv:overflow-visible",
58
+ children: [paths.map(({ key, d, dashed }) => /* @__PURE__ */ jsx("path", {
59
+ d,
60
+ className: `mv:fill-none ${dashed ? "mv:stroke-accent/60" : "mv:stroke-muted/50"}`,
61
+ strokeWidth: 1.5,
62
+ strokeDasharray: dashed ? "4 3" : void 0
63
+ }, key)), paths.map(({ key, label, at }) => label ? /* @__PURE__ */ jsx("text", {
64
+ x: at[0],
65
+ y: at[1],
66
+ textAnchor: "middle",
67
+ dominantBaseline: "central",
68
+ paintOrder: "stroke",
69
+ strokeWidth: 4,
70
+ className: "mv:fill-muted mv:stroke-surface mv:text-[10px]",
71
+ children: label
72
+ }, `${key}:label`) : null)]
73
+ });
74
+ }
75
+ /** Cubic curve from the parent's trailing edge to the child's leading edge, and its midpoint. */
76
+ function connector(a, b, origin, orientation) {
77
+ if (orientation === "vertical") {
78
+ const x1 = a.left + a.width / 2 - origin.left;
79
+ const y1 = a.bottom - origin.top;
80
+ const x2 = b.left + b.width / 2 - origin.left;
81
+ const y2 = b.top - origin.top;
82
+ const my = (y1 + y2) / 2;
83
+ return [`M${x1},${y1} C${x1},${my} ${x2},${my} ${x2},${y2}`, [(x1 + x2) / 2, my]];
84
+ }
85
+ const x1 = a.right - origin.left;
86
+ const y1 = a.top + a.height / 2 - origin.top;
87
+ const x2 = b.left - origin.left;
88
+ const y2 = b.top + b.height / 2 - origin.top;
89
+ const mx = (x1 + x2) / 2;
90
+ return [`M${x1},${y1} C${mx},${y1} ${mx},${y2} ${x2},${y2}`, [mx, (y1 + y2) / 2]];
91
+ }
92
+ /** Pixels between parallel straight connectors. */
93
+ var LANE_GAP = 6;
94
+ /**
95
+ * Straight line between centres, shifted sideways by its lane; the layout draws nodes over the
96
+ * overlay to hide the ends. The shift is relative to a fixed orientation of the pair, so connectors in
97
+ * opposite directions between the same nodes still separate.
98
+ */
99
+ function line(a, b, origin, lane) {
100
+ const x1 = a.left + a.width / 2 - origin.left;
101
+ const y1 = a.top + a.height / 2 - origin.top;
102
+ const x2 = b.left + b.width / 2 - origin.left;
103
+ const y2 = b.top + b.height / 2 - origin.top;
104
+ const flip = x1 < x2 || x1 === x2 && y1 < y2 ? 1 : -1;
105
+ const length = Math.hypot(x2 - x1, y2 - y1) || 1;
106
+ const dx = -(y2 - y1) / length * lane * LANE_GAP * flip;
107
+ const dy = (x2 - x1) / length * lane * LANE_GAP * flip;
108
+ return [`M${x1 + dx},${y1 + dy} L${x2 + dx},${y2 + dy}`, [(x1 + x2) / 2 + dx, (y1 + y2) / 2 + dy]];
109
+ }
110
+ //#endregion
111
+ //#region src/components/layout.ts
112
+ /** Connects a layout's occurrences to its `ConnectorOverlay`: `register` fills `elements` during commit, ahead of the overlay's layout effect. */
113
+ function useOccurrenceElements() {
114
+ const [container, setContainer] = useState(null);
115
+ const elements = useRef(/* @__PURE__ */ new Map()).current;
116
+ return {
117
+ container,
118
+ setContainer,
119
+ elements,
120
+ register: useCallback((key) => (el) => {
121
+ if (el) elements.set(key, el);
122
+ else elements.delete(key);
123
+ }, [elements])
124
+ };
125
+ }
126
+ //#endregion
127
+ //#region src/components/NodeComponent.tsx
10
128
  /**
11
129
  * A clickable node, drawn as a card (title plus selected fields) or a compact shape with a
12
130
  * tooltip. Deliberately a `div` with button semantics rather than a `<button>`: hosts style
13
131
  * native form controls globally (Obsidian fixes button height and disables wrapping).
14
132
  */
15
- function NodeCard({ node, repeat, nodes, onSelect }) {
133
+ function NodeComponent({ node, repeat, nodes, onSelect }) {
16
134
  const select = () => onSelect?.(node);
17
135
  const annotations = useAnnotations().get(node.id);
18
136
  const label = `${node.resolvedType}: ${node.title}${repeat ? " (shown in full elsewhere)" : ""}${annotationsLabel(annotations)}`;
@@ -99,11 +217,139 @@ function formatValue(value) {
99
217
  return String(value);
100
218
  }
101
219
  //#endregion
102
- //#region src/layouts/LandscapeLayout.tsx
220
+ //#region src/components/GraphLayout.tsx
221
+ var CARD_ROOM = {
222
+ width: 230,
223
+ height: 110
224
+ };
225
+ var SHAPE_ROOM = {
226
+ width: 170,
227
+ height: 40
228
+ };
229
+ var TICKS = 300;
230
+ var PADDING = 24;
231
+ var BAND_ASPECT = 4;
232
+ var BAND_GAP = 1.5;
233
+ var LOOSE_PER_ROW = 4;
103
234
  /**
104
- * Nested containers following the layout's grouping levels; the last level is drawn as nodes.
105
- * Flexbox does the nesting and wrapping. Containment shows the grouping edges, so no connectors
106
- * are drawn. PROTOTYPE: `edges.show` has no effect here; other edges aren't drawn yet.
235
+ * The space graph as a network, positioned by a force simulation. The hierarchy gives it shape:
236
+ * hierarchy edges hold their nodes close and each level settles below the one above, while
237
+ * relationship edges pull weakly and are drawn dashed.
238
+ */
239
+ function GraphLayout({ graph, region, instanceId, onNodeSelect }) {
240
+ const shape = region.nodes.style === "shape";
241
+ const plot = useMemo(() => settle(graph, region.id, region.layout.edgeFields, shape ? SHAPE_ROOM : CARD_ROOM), [
242
+ graph,
243
+ region.id,
244
+ region.layout.edgeFields,
245
+ shape
246
+ ]);
247
+ const { container, setContainer, elements, register } = useOccurrenceElements();
248
+ return /* @__PURE__ */ jsxs("div", {
249
+ ref: setContainer,
250
+ className: "mv:relative mv:min-h-full mv:min-w-full",
251
+ style: {
252
+ width: plot.width,
253
+ height: plot.height
254
+ },
255
+ children: [/* @__PURE__ */ jsx(ConnectorOverlay, {
256
+ connectors: plot.connectors,
257
+ edges: region.edges,
258
+ elements,
259
+ container,
260
+ routing: "straight"
261
+ }), plot.points.map(({ key, node, x, y }) => /* @__PURE__ */ jsxs("div", {
262
+ "data-occurrence": `${instanceId}${key}`,
263
+ className: `mv:absolute mv:flex mv:items-center mv:gap-1 ${shape ? "mv:-translate-x-3 mv:-translate-y-3" : "mv:-translate-x-1/2 mv:-translate-y-1/2"}`,
264
+ style: {
265
+ left: x,
266
+ top: y
267
+ },
268
+ children: [/* @__PURE__ */ jsx("div", {
269
+ ref: register(key),
270
+ children: /* @__PURE__ */ jsx(NodeComponent, {
271
+ node,
272
+ repeat: false,
273
+ nodes: region.nodes,
274
+ onSelect: onNodeSelect
275
+ })
276
+ }), shape && /* @__PURE__ */ jsx("span", {
277
+ className: "mv:whitespace-nowrap mv:rounded mv:bg-surface/80 mv:px-0.5 mv:text-xs",
278
+ children: node.title
279
+ })]
280
+ }, key))]
281
+ });
282
+ }
283
+ /**
284
+ * Run the simulation to rest. d3-force seeds its own random source, so the same graph settles
285
+ * the same way on every render.
286
+ *
287
+ * The simulation treats each node as a circle one row high; x is stretched afterwards to the
288
+ * node's width, which packs wide nodes as boxes without a rectangular collision force.
289
+ */
290
+ function settle(graph, regionId, edgeFields, room) {
291
+ const row = room.height;
292
+ const edges = edgesWithin(graph).filter((e) => e.parent !== e.child && (edgeFields.length === 0 || edgeFields.includes(e.field))).map((e) => ({
293
+ source: occurrenceKey(regionId, [e.parent]),
294
+ target: occurrenceKey(regionId, [e.child]),
295
+ field: e.field,
296
+ hierarchy: isHierarchyEdge(e, graph.hierarchy)
297
+ }));
298
+ const connected = new Set(edges.flatMap((e) => [e.source, e.target]));
299
+ const levelTypes = graph.hierarchy?.levels.map((level) => level.type) ?? [];
300
+ const all = [...graph.nodes.values()].map((node) => ({
301
+ key: occurrenceKey(regionId, [node.id]),
302
+ node,
303
+ level: levelTypes.indexOf(node.resolvedType),
304
+ x: 0,
305
+ y: 0
306
+ }));
307
+ const points = all.filter((p) => connected.has(p.key));
308
+ const loose = all.filter((p) => !connected.has(p.key));
309
+ let bandTop = 0;
310
+ const bandCentre = levelTypes.map((_, level) => {
311
+ const count = points.filter((p) => p.level === level).length;
312
+ const depth = Math.max(1, Math.ceil(Math.sqrt(count / BAND_ASPECT))) * row;
313
+ const centre = bandTop + depth / 2;
314
+ bandTop += depth + row * BAND_GAP;
315
+ return centre;
316
+ });
317
+ forceSimulation(points).force("link", forceLink(edges.map((e) => ({ ...e }))).id((point) => point.key).distance(row * 2.5).strength((e) => e.hierarchy ? .2 : .05)).force("charge", forceManyBody().strength(-row / 2).distanceMax(row * 4)).force("collide", forceCollide(row / 2)).force("x", forceX().strength((p) => p.level < 0 ? .01 : .15)).force("y", forceY((p) => bandCentre[p.level] ?? 0).strength((p) => p.level < 0 ? 0 : .6)).stop().tick(TICKS);
318
+ const stretch = room.width / row;
319
+ const left = Math.min(0, ...points.map((p) => p.x));
320
+ const top = Math.min(0, ...points.map((p) => p.y));
321
+ for (const point of points) {
322
+ point.x = (point.x - left) * stretch + room.width / 2 + PADDING;
323
+ point.y = point.y - top + row / 2 + PADDING;
324
+ }
325
+ const width = Math.max(room.width * LOOSE_PER_ROW, ...points.map((p) => p.x + room.width / 2)) + PADDING;
326
+ const bottom = Math.max(0, ...points.map((p) => p.y + row / 2));
327
+ const perRow = Math.max(1, Math.floor((width - 48) / room.width));
328
+ loose.forEach((point, i) => {
329
+ point.x = PADDING + room.width / 2 + i % perRow * room.width;
330
+ point.y = bottom + row * 1.5 + Math.floor(i / perRow) * row;
331
+ });
332
+ const connectors = edges.map((e) => ({
333
+ from: e.source,
334
+ to: e.target,
335
+ field: e.field,
336
+ dashed: !e.hierarchy
337
+ }));
338
+ assignLanes(connectors);
339
+ return {
340
+ points: all,
341
+ connectors,
342
+ width,
343
+ height: Math.max(bottom, ...loose.map((p) => p.y + row / 2)) + PADDING
344
+ };
345
+ }
346
+ //#endregion
347
+ //#region src/components/LandscapeLayout.tsx
348
+ /**
349
+ * Strips of nested containers following each strip's grouping levels; the last level is drawn as
350
+ * nodes. Flexbox does the nesting and wrapping, and CSS grid lays out strips divided into cells.
351
+ * Containment shows the grouping edges, so no connectors are drawn. PROTOTYPE: `edges.show` has no
352
+ * effect here; other edges aren't drawn yet.
107
353
  */
108
354
  function LandscapeLayout({ graph, region, instanceId, onNodeSelect }) {
109
355
  const { layout } = region;
@@ -112,9 +358,8 @@ function LandscapeLayout({ graph, region, instanceId, onNodeSelect }) {
112
358
  region.id,
113
359
  layout
114
360
  ]);
115
- const last = layout.group.length - 1;
116
- const breadcrumb = (occurrence) => {
117
- const level = layout.group[occurrence.level];
361
+ const breadcrumb = (occurrence, levels) => {
362
+ const level = levels[occurrence.level];
118
363
  if (!level || !("type" in level) || level.intermediate !== "breadcrumb") return null;
119
364
  const steps = occurrence.via.filter((step) => step.nodes.length > 0);
120
365
  if (steps.length === 0) return null;
@@ -123,60 +368,164 @@ function LandscapeLayout({ graph, region, instanceId, onNodeSelect }) {
123
368
  children: ["via ", steps.map((step) => step.nodes.map((n) => n.title).join(", ")).join(" › ")]
124
369
  });
125
370
  };
126
- const render = (occurrence, direction) => {
371
+ /** The label of a container or a dimension's group: its node, or its field value. */
372
+ const heading = (occurrence, levels = []) => occurrence.item.kind === "node" ? /* @__PURE__ */ jsx(ContainerHeading, {
373
+ node: occurrence.item.node,
374
+ repeat: "repeatOf" in occurrence && occurrence.repeatOf !== void 0,
375
+ onSelect: onNodeSelect,
376
+ children: "level" in occurrence && breadcrumb(occurrence, levels)
377
+ }) : /* @__PURE__ */ jsxs("span", {
378
+ className: "mv:text-xs mv:font-semibold mv:text-muted",
379
+ children: [
380
+ occurrence.item.field,
381
+ ": ",
382
+ occurrence.item.value === null ? "(none)" : displayValue(occurrence.item.value)
383
+ ]
384
+ });
385
+ const render = (occurrence, direction, levels) => {
127
386
  const repeat = occurrence.repeatOf !== void 0;
128
387
  const marker = { "data-occurrence": `${instanceId}${occurrence.key}` };
129
- if (occurrence.item.kind === "node" && occurrence.level === last) return /* @__PURE__ */ jsxs("li", {
388
+ const isLeaf = (level) => level === levels.length - 1;
389
+ if (occurrence.item.kind === "node" && isLeaf(occurrence.level)) return /* @__PURE__ */ jsxs("li", {
130
390
  ...marker,
131
391
  className: "mv:flex mv:flex-col mv:gap-0.5",
132
- children: [/* @__PURE__ */ jsx(NodeCard, {
392
+ children: [/* @__PURE__ */ jsx(NodeComponent, {
133
393
  node: occurrence.item.node,
134
394
  repeat,
135
395
  nodes: region.nodes,
136
396
  onSelect: onNodeSelect
137
- }), breadcrumb(occurrence)]
397
+ }), breadcrumb(occurrence, levels)]
138
398
  }, occurrence.key);
139
399
  const inner = direction === "horizontal" ? "vertical" : "horizontal";
140
- const holdsNodes = occurrence.level + 1 === last;
400
+ const holdsNodes = isLeaf(occurrence.level + 1);
141
401
  return /* @__PURE__ */ jsxs("li", {
142
402
  ...marker,
143
403
  className: `mv:flex mv:flex-col mv:gap-2 mv:rounded-lg mv:border mv:bg-surface mv:p-2 ${repeat ? "mv:border-dashed mv:border-muted/60" : "mv:border-edge"}`,
144
- children: [occurrence.item.kind === "node" ? /* @__PURE__ */ jsx(ContainerHeading, {
145
- node: occurrence.item.node,
146
- repeat,
147
- onSelect: onNodeSelect,
148
- children: breadcrumb(occurrence)
149
- }) : /* @__PURE__ */ jsxs("span", {
150
- className: "mv:text-xs mv:font-semibold mv:text-muted",
151
- children: [
152
- occurrence.item.field,
153
- ": ",
154
- occurrence.item.value === null ? "(none)" : displayValue(occurrence.item.value)
155
- ]
156
- }), /* @__PURE__ */ jsx(Items, {
404
+ children: [heading(occurrence, levels), /* @__PURE__ */ jsx(Items, {
157
405
  direction: holdsNodes ? "wrap" : inner,
158
- children: occurrence.children.map((child) => render(child, inner))
406
+ children: occurrence.children.map((child) => render(child, inner, levels))
159
407
  })]
160
408
  }, occurrence.key);
161
409
  };
162
410
  const top = layout.orientation;
411
+ const ungroupedClass = "mv:flex mv:flex-col mv:gap-2 mv:rounded-lg mv:border mv:border-dashed mv:border-edge mv:p-2";
412
+ const ungroupedItems = (ungrouped, levels) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
413
+ className: "mv:text-xs mv:font-semibold mv:text-muted",
414
+ children: "Ungrouped"
415
+ }), /* @__PURE__ */ jsx(Items, {
416
+ direction: "wrap",
417
+ children: ungrouped.map((o) => render(o, top, levels))
418
+ })] });
419
+ const [only] = landscape.strips;
420
+ if (!(only && landscape.strips.length === 1 && !landscape.dimension && !only.dimension)) {
421
+ const anyOwn = landscape.strips.some((strip) => strip.dimension);
422
+ const sizes = landscape.strips.map((strip) => (strip.dimension?.length ?? 1) + (strip.ungrouped.length > 0 ? 1 : 0));
423
+ const starts = sizes.map((_, s) => 1 + (landscape.dimension ? 1 : 0) + sizes.slice(0, s).reduce((a, b) => a + b, 0));
424
+ const place = gridPlacement(top, {
425
+ lead: anyOwn ? 2 : 1,
426
+ dimensionSize: landscape.dimension?.length ?? 1,
427
+ leadStrips: landscape.dimension ? 1 : 0,
428
+ strips: sizes.reduce((a, b) => a + b, 0)
429
+ });
430
+ return /* @__PURE__ */ jsx("div", {
431
+ className: "mv:w-max mv:min-w-full mv:p-4",
432
+ children: /* @__PURE__ */ jsxs("div", {
433
+ "data-grid": true,
434
+ className: "mv:grid mv:gap-2",
435
+ style: place.container,
436
+ children: [landscape.dimension?.map((group, i) => /* @__PURE__ */ jsx("div", {
437
+ "data-dimension": "layout",
438
+ "data-occurrence": `${instanceId}${group.key}`,
439
+ className: "mv:self-center mv:px-1",
440
+ style: place.heading(i),
441
+ children: heading(group)
442
+ }, group.key)), landscape.strips.map((strip, s) => {
443
+ const levels = layout.strips[s].group;
444
+ const start = starts[s];
445
+ return /* @__PURE__ */ jsxs("div", {
446
+ className: "mv:contents",
447
+ "data-strip": s,
448
+ children: [
449
+ /* @__PURE__ */ jsx("div", {
450
+ "data-strip-name": true,
451
+ className: "mv:self-center mv:px-1 mv:text-xs mv:font-semibold mv:uppercase mv:tracking-wide mv:text-muted",
452
+ style: place.name(start, Math.max(sizes[s], 1)),
453
+ children: levelLabel(levels[0])
454
+ }),
455
+ strip.dimension?.map((group, j) => /* @__PURE__ */ jsx("div", {
456
+ "data-dimension": "strip",
457
+ "data-occurrence": `${instanceId}${group.key}`,
458
+ className: "mv:self-center mv:px-1",
459
+ style: place.stripHeading(start + j),
460
+ children: heading(group)
461
+ }, group.key)),
462
+ strip.cells.map((cell) => /* @__PURE__ */ jsx("div", {
463
+ "data-cell": true,
464
+ "data-strip-cell": s,
465
+ className: "mv:min-h-12 mv:rounded-lg mv:border mv:border-edge mv:bg-surface mv:p-2",
466
+ style: place.cell(cell.at[0], start + cell.at[1]),
467
+ children: /* @__PURE__ */ jsx(Items, {
468
+ direction: "vertical",
469
+ children: cell.children.map((child) => render(child, top, levels))
470
+ })
471
+ }, cell.key)),
472
+ strip.ungrouped.length > 0 && /* @__PURE__ */ jsx("div", {
473
+ "data-ungrouped": true,
474
+ className: ungroupedClass,
475
+ style: place.ungrouped(start + (strip.dimension?.length ?? 1)),
476
+ children: ungroupedItems(strip.ungrouped, levels)
477
+ })
478
+ ]
479
+ }, s);
480
+ })]
481
+ })
482
+ });
483
+ }
484
+ const levels = layout.strips[0].group;
163
485
  return /* @__PURE__ */ jsx("div", {
164
486
  className: "mv:w-max mv:min-w-full mv:p-4",
165
487
  children: /* @__PURE__ */ jsxs(Items, {
166
- direction: last === 0 ? "wrap" : top,
167
- children: [landscape.groups.map((group) => render(group, top)), landscape.ungrouped.length > 0 && /* @__PURE__ */ jsxs("li", {
168
- className: "mv:flex mv:flex-col mv:gap-2 mv:rounded-lg mv:border mv:border-dashed mv:border-edge mv:p-2",
169
- children: [/* @__PURE__ */ jsx("span", {
170
- className: "mv:text-xs mv:font-semibold mv:text-muted",
171
- children: "Ungrouped"
172
- }), /* @__PURE__ */ jsx(Items, {
173
- direction: "wrap",
174
- children: landscape.ungrouped.map((o) => render(o, top))
175
- })]
488
+ direction: levels.length === 1 ? "wrap" : top,
489
+ children: [only.cells[0].children.map((group) => render(group, top, levels)), only.ungrouped.length > 0 && /* @__PURE__ */ jsx("li", {
490
+ className: ungroupedClass,
491
+ children: ungroupedItems(only.ungrouped, levels)
176
492
  })]
177
493
  })
178
494
  });
179
495
  }
496
+ var levelLabel = (level) => "type" in level ? level.type : level.field;
497
+ /**
498
+ * Where the grid's labels, headings and cells go. The only place that decides which way the layout
499
+ * dimension runs: with `horizontal` its groups sit side by side, like top-level containers elsewhere
500
+ * in this layout, and strips stack; with `vertical` its groups stack and strips sit side by side.
501
+ * Along the layout dimension's axis, the leading positions hold the strip names and, if any strip
502
+ * has its own dimension, that dimension's headings. Along the strips' axis, the first holds the
503
+ * layout dimension's headings.
504
+ * PROTOTYPE: track sizes are fixed guesses, headings scroll away with the grid, and a grid has no
505
+ * connectors or highlights.
506
+ */
507
+ function gridPlacement(orientation, shape) {
508
+ const dimensionAcross = orientation === "horizontal";
509
+ /** A start line, and how many lines it spans. */
510
+ const lines = (start, span = 1) => span === 1 ? start : `${start} / span ${span}`;
511
+ /** `onDimension` runs along the layout dimension's axis, `onStrips` along the strips'. */
512
+ const at = (onDimension, onStrips, dimensionSpan = 1, stripsSpan = 1) => dimensionAcross ? {
513
+ gridColumn: lines(onDimension, dimensionSpan),
514
+ gridRow: lines(onStrips, stripsSpan)
515
+ } : {
516
+ gridColumn: lines(onStrips, stripsSpan),
517
+ gridRow: lines(onDimension, dimensionSpan)
518
+ };
519
+ const groupsStart = shape.lead + 1;
520
+ return {
521
+ container: { gridTemplateColumns: dimensionAcross ? `${"max-content ".repeat(shape.lead)}repeat(${shape.dimensionSize}, minmax(9rem, 1fr))` : `${"max-content ".repeat(shape.leadStrips)}repeat(${shape.strips}, minmax(9rem, 1fr))` },
522
+ heading: (index) => at(groupsStart + index, 1),
523
+ name: (start, span) => at(1, start, 1, span),
524
+ stripHeading: (line) => at(2, line),
525
+ cell: (index, line) => at(groupsStart + index, line),
526
+ ungrouped: (line) => at(groupsStart, line, shape.dimensionSize)
527
+ };
528
+ }
180
529
  function Items({ direction, children }) {
181
530
  const layout = {
182
531
  horizontal: "mv:flex-row mv:items-start mv:gap-3",
@@ -221,93 +570,88 @@ function displayValue(value) {
221
570
  return value.replace(/^\[\[([^\]|]+)(\|[^\]]*)?\]\]$/, "$1");
222
571
  }
223
572
  //#endregion
224
- //#region src/layouts/EdgeOverlay.tsx
573
+ //#region src/components/NeighbourhoodLayout.tsx
574
+ var ACROSS = 3;
575
+ var SIDE_ROWS = 6;
225
576
  /**
226
- * SVG layer drawing connectors between rendered occurrences.
227
- *
228
- * Measures occurrence elements after layout and redraws when the container or any occurrence
229
- * resizes, so it follows embedded panes that resize independently of the window, and reflows
230
- * such as late font loads. The SVG fills the container instead of being sized from it, so it
231
- * never holds the container open after the layout shrinks.
577
+ * One node with its neighbours around it. Selecting a neighbour moves the focus to it; selecting
578
+ * the focus is a regular node selection.
232
579
  */
233
- function EdgeOverlay({ links, elements, container, routing }) {
234
- const [paths, setPaths] = useState([]);
235
- useLayoutEffect(() => {
236
- if (!container) return;
237
- const measure = () => {
238
- const origin = container.getBoundingClientRect();
239
- const paths = [];
240
- for (const { from, to, kind, id, lane = 0 } of links) {
241
- const a = elements.get(from)?.getBoundingClientRect();
242
- const b = elements.get(to)?.getBoundingClientRect();
243
- if (!a || !b) continue;
244
- paths.push({
245
- key: `${from}→${to}${id ?? ""}`,
246
- d: routing === "straight" ? line(a, b, origin, lane) : connector(a, b, origin, routing),
247
- cross: kind === "cross"
248
- });
249
- }
250
- setPaths(paths);
251
- };
252
- measure();
253
- const observer = new ResizeObserver(measure);
254
- observer.observe(container);
255
- for (const element of elements.values()) observer.observe(element);
256
- return () => observer.disconnect();
257
- }, [
258
- links,
259
- elements,
260
- container,
261
- routing
580
+ function NeighbourhoodLayout({ graph, region, instanceId, onNodeSelect, focus, onFocusChange }) {
581
+ const [picked, setPicked] = useState();
582
+ const focusId = picked && picked.from === focus ? picked.id : focus;
583
+ const neighbourhood = useMemo(() => buildNeighbourhood(graph, region.id, region.layout, focusId), [
584
+ graph,
585
+ region.id,
586
+ region.layout,
587
+ focusId
262
588
  ]);
263
- return /* @__PURE__ */ jsx("svg", {
264
- "aria-hidden": "true",
265
- className: "mv:pointer-events-none mv:absolute mv:inset-0 mv:h-full mv:w-full mv:overflow-visible",
266
- children: paths.map(({ key, d, cross }) => /* @__PURE__ */ jsx("path", {
267
- d,
268
- className: `mv:fill-none ${cross ? "mv:stroke-accent/60" : "mv:stroke-muted/50"}`,
269
- strokeWidth: 1.5,
270
- strokeDasharray: cross ? "4 3" : void 0
271
- }, key))
589
+ const { container, setContainer, elements, register } = useOccurrenceElements();
590
+ if (!neighbourhood.focus) return null;
591
+ const current = neighbourhood.focus.node;
592
+ const select = (node) => {
593
+ if (node.id === current.id) return onNodeSelect?.(node);
594
+ setPicked({
595
+ from: focus,
596
+ id: node.id
597
+ });
598
+ onFocusChange?.(node.id);
599
+ };
600
+ const cell = (item) => /* @__PURE__ */ jsx("div", {
601
+ ref: register(item.key),
602
+ className: "mv:relative mv:z-10",
603
+ "data-occurrence": `${instanceId}${item.key}`,
604
+ children: /* @__PURE__ */ jsx(NodeComponent, {
605
+ node: item.node,
606
+ repeat: false,
607
+ nodes: region.nodes,
608
+ onSelect: select
609
+ })
610
+ }, item.key);
611
+ const zone = (items, columns, className = "") => items.length > 0 && /* @__PURE__ */ jsx("div", {
612
+ className: `mv:grid mv:items-center mv:gap-3 ${className}`,
613
+ style: { gridTemplateColumns: `repeat(${Math.min(items.length, columns)}, max-content)` },
614
+ children: items.map(cell)
615
+ });
616
+ const side = (items) => Math.ceil(items.length / SIDE_ROWS);
617
+ const { above, below, left, right } = neighbourhood.roles;
618
+ const { siblings } = neighbourhood;
619
+ return /* @__PURE__ */ jsxs("div", {
620
+ ref: setContainer,
621
+ className: "mv:relative mv:grid mv:w-max mv:min-w-full mv:grid-cols-[auto_auto_auto] mv:items-center mv:justify-center mv:gap-x-24 mv:gap-y-16 mv:p-6",
622
+ children: [
623
+ /* @__PURE__ */ jsx("div", {
624
+ className: "mv:col-start-2 mv:justify-self-center",
625
+ children: zone(above, ACROSS)
626
+ }),
627
+ /* @__PURE__ */ jsx("div", {
628
+ className: "mv:col-start-1 mv:justify-self-end",
629
+ children: zone(left, side(left))
630
+ }),
631
+ /* @__PURE__ */ jsx("div", {
632
+ className: "mv:col-start-2 mv:justify-self-center mv:rounded-md mv:ring-2 mv:ring-accent",
633
+ children: cell(neighbourhood.focus)
634
+ }),
635
+ /* @__PURE__ */ jsxs("div", {
636
+ className: "mv:flex mv:items-center mv:gap-24",
637
+ children: [zone(right, side(right)), zone(siblings, side(siblings), "mv:opacity-70")]
638
+ }),
639
+ /* @__PURE__ */ jsx("div", {
640
+ className: "mv:col-start-2 mv:justify-self-center",
641
+ children: zone(below, ACROSS)
642
+ }),
643
+ /* @__PURE__ */ jsx(ConnectorOverlay, {
644
+ connectors: neighbourhood.connectors,
645
+ edges: region.edges,
646
+ elements,
647
+ container,
648
+ routing: "straight"
649
+ })
650
+ ]
272
651
  });
273
- }
274
- /** Cubic curve from the parent's trailing edge to the child's leading edge. */
275
- function connector(a, b, origin, orientation) {
276
- if (orientation === "vertical") {
277
- const x1 = a.left + a.width / 2 - origin.left;
278
- const y1 = a.bottom - origin.top;
279
- const x2 = b.left + b.width / 2 - origin.left;
280
- const y2 = b.top - origin.top;
281
- const my = (y1 + y2) / 2;
282
- return `M${x1},${y1} C${x1},${my} ${x2},${my} ${x2},${y2}`;
283
- }
284
- const x1 = a.right - origin.left;
285
- const y1 = a.top + a.height / 2 - origin.top;
286
- const x2 = b.left - origin.left;
287
- const y2 = b.top + b.height / 2 - origin.top;
288
- const mx = (x1 + x2) / 2;
289
- return `M${x1},${y1} C${mx},${y1} ${mx},${y2} ${x2},${y2}`;
290
- }
291
- /** Pixels between parallel straight links. */
292
- var LANE_GAP = 6;
293
- /**
294
- * Straight line between centres, shifted sideways by its lane; the layout draws nodes over the
295
- * overlay to hide the ends. The shift is relative to a fixed orientation of the pair, so links in
296
- * opposite directions between the same nodes still separate.
297
- */
298
- function line(a, b, origin, lane) {
299
- const x1 = a.left + a.width / 2 - origin.left;
300
- const y1 = a.top + a.height / 2 - origin.top;
301
- const x2 = b.left + b.width / 2 - origin.left;
302
- const y2 = b.top + b.height / 2 - origin.top;
303
- const flip = x1 < x2 || x1 === x2 && y1 < y2 ? 1 : -1;
304
- const length = Math.hypot(x2 - x1, y2 - y1) || 1;
305
- const dx = -(y2 - y1) / length * lane * LANE_GAP * flip;
306
- const dy = (x2 - x1) / length * lane * LANE_GAP * flip;
307
- return `M${x1 + dx},${y1 + dy} L${x2 + dx},${y2 + dy}`;
308
652
  }
309
653
  //#endregion
310
- //#region src/layouts/TreeLayout.tsx
654
+ //#region src/components/TreeLayout.tsx
311
655
  /**
312
656
  * Tree over the schema's hierarchy. Flexbox does the branching; the SVG overlay draws connectors.
313
657
  */
@@ -318,19 +662,14 @@ function TreeLayout({ graph, region, instanceId, onNodeSelect }) {
318
662
  region.id,
319
663
  dag
320
664
  ]);
321
- const links = useMemo(() => region.edges.show ? treeLinks(tree) : [], [tree, region.edges.show]);
322
- const [container, setContainer] = useState(null);
323
- const elements = useRef(/* @__PURE__ */ new Map()).current;
324
- const register = useCallback((key) => (el) => {
325
- if (el) elements.set(key, el);
326
- else elements.delete(key);
327
- }, [elements]);
665
+ const connectors = useMemo(() => treeConnectors(tree), [tree]);
666
+ const { container, setContainer, elements, register } = useOccurrenceElements();
328
667
  const branch = (occurrence) => /* @__PURE__ */ jsxs("li", {
329
668
  className: `mv:flex mv:items-center ${orientation === "vertical" ? "mv:flex-col" : "mv:flex-row"}`,
330
669
  children: [/* @__PURE__ */ jsx("div", {
331
670
  ref: register(occurrence.key),
332
671
  "data-occurrence": `${instanceId}${occurrence.key}`,
333
- children: /* @__PURE__ */ jsx(NodeCard, {
672
+ children: /* @__PURE__ */ jsx(NodeComponent, {
334
673
  node: occurrence.node,
335
674
  repeat: occurrence.repeatOf !== void 0,
336
675
  nodes: region.nodes,
@@ -342,14 +681,19 @@ function TreeLayout({ graph, region, instanceId, onNodeSelect }) {
342
681
  children: occurrence.children.map(branch)
343
682
  })]
344
683
  }, occurrence.key);
684
+ if (!graph.hierarchy) return /* @__PURE__ */ jsx("p", {
685
+ className: "mv:p-4 mv:text-muted",
686
+ children: "This schema has no hierarchy to draw as a tree."
687
+ });
345
688
  return /* @__PURE__ */ jsxs("div", {
346
689
  ref: setContainer,
347
690
  className: "mv:relative mv:w-max mv:min-w-full mv:p-4",
348
691
  children: [/* @__PURE__ */ jsx(Branches, {
349
692
  orientation,
350
693
  children: [...tree.roots, ...tree.orphans].map(branch)
351
- }), /* @__PURE__ */ jsx(EdgeOverlay, {
352
- links,
694
+ }), /* @__PURE__ */ jsx(ConnectorOverlay, {
695
+ connectors,
696
+ edges: region.edges,
353
697
  elements,
354
698
  container,
355
699
  routing: orientation
@@ -363,7 +707,7 @@ function Branches({ orientation, nested = false, children }) {
363
707
  });
364
708
  }
365
709
  //#endregion
366
- //#region src/layouts/XYLayout.tsx
710
+ //#region src/components/XYLayout.tsx
367
711
  /**
368
712
  * Nodes positioned by two numeric fields, with straight connectors between them. Positions are
369
713
  * percentages of the plot area, which fills the container (scrolling below a minimum size). Nodes that can't be
@@ -377,20 +721,8 @@ function XYLayout({ graph, region, instanceId, onNodeSelect }) {
377
721
  region.id,
378
722
  layout
379
723
  ]);
380
- const links = useMemo(() => region.edges.show ? plot.links.map(({ from, to, field, hierarchy, lane }) => ({
381
- from,
382
- to,
383
- id: field,
384
- lane,
385
- kind: hierarchy ? "tree" : "cross"
386
- })) : [], [plot, region.edges.show]);
387
724
  const shape = region.nodes.style === "shape";
388
- const [container, setContainer] = useState(null);
389
- const elements = useRef(/* @__PURE__ */ new Map()).current;
390
- const register = useCallback((key) => (el) => {
391
- if (el) elements.set(key, el);
392
- else elements.delete(key);
393
- }, [elements]);
725
+ const { container, setContainer, elements, register } = useOccurrenceElements();
394
726
  return /* @__PURE__ */ jsxs("div", {
395
727
  className: "mv:box-border mv:flex mv:h-full mv:min-h-[28rem] mv:min-w-[36rem] mv:flex-col mv:gap-4 mv:p-4",
396
728
  children: [/* @__PURE__ */ jsxs("div", {
@@ -404,8 +736,9 @@ function XYLayout({ graph, region, instanceId, onNodeSelect }) {
404
736
  /* @__PURE__ */ jsxs("div", {
405
737
  ref: setContainer,
406
738
  className: "mv:relative mv:border-b mv:border-l mv:border-edge",
407
- children: [/* @__PURE__ */ jsx(EdgeOverlay, {
408
- links,
739
+ children: [/* @__PURE__ */ jsx(ConnectorOverlay, {
740
+ connectors: plot.connectors,
741
+ edges: region.edges,
409
742
  elements,
410
743
  container,
411
744
  routing: "straight"
@@ -420,7 +753,7 @@ function XYLayout({ graph, region, instanceId, onNodeSelect }) {
420
753
  },
421
754
  children: [/* @__PURE__ */ jsx("div", {
422
755
  ref: register(point.key),
423
- children: /* @__PURE__ */ jsx(NodeCard, {
756
+ children: /* @__PURE__ */ jsx(NodeComponent, {
424
757
  node: point.node,
425
758
  repeat: false,
426
759
  nodes: region.nodes,
@@ -449,7 +782,7 @@ function XYLayout({ graph, region, instanceId, onNodeSelect }) {
449
782
  children: plot.unplaced.map(({ key, node, reasons }) => /* @__PURE__ */ jsxs("li", {
450
783
  "data-occurrence": `${instanceId}${key}`,
451
784
  className: "mv:flex mv:items-center mv:gap-1",
452
- children: [/* @__PURE__ */ jsx(NodeCard, {
785
+ children: [/* @__PURE__ */ jsx(NodeComponent, {
453
786
  node,
454
787
  repeat: false,
455
788
  nodes: region.nodes,
@@ -489,17 +822,20 @@ function format(value) {
489
822
  return Number.isInteger(value) ? String(value) : value.toPrecision(3).replace(/\.?0+$/, "");
490
823
  }
491
824
  //#endregion
492
- //#region src/layouts/MapView.tsx
825
+ //#region src/components/MapView.tsx
493
826
  var EMPTY = /* @__PURE__ */ new Map();
827
+ var LAYOUTS = {
828
+ tree: TreeLayout,
829
+ landscape: LandscapeLayout,
830
+ xy: XYLayout,
831
+ neighbourhood: NeighbourhoodLayout,
832
+ graph: GraphLayout
833
+ };
494
834
  /** Renders a map view definition against a space. Sizes to its container and scrolls within it. */
495
- function MapView({ definition, graph, values, annotations, onNodeSelect }) {
835
+ function MapView({ definition, graph, values, annotations, onNodeSelect, focus, onFocusChange }) {
496
836
  const instanceId = useId();
497
837
  const region = useMemo(() => resolveRegions(definition, values), [definition, values])[0];
498
- const props = {
499
- graph,
500
- instanceId,
501
- onNodeSelect
502
- };
838
+ const Layout = LAYOUTS[region.layout.type];
503
839
  const { validation, validationSources } = region.nodes;
504
840
  const visibleAnnotations = useMemo(() => annotations ? filterAnnotations(annotations, validation, validationSources) : EMPTY, [
505
841
  annotations,
@@ -510,38 +846,19 @@ function MapView({ definition, graph, values, annotations, onNodeSelect }) {
510
846
  value: visibleAnnotations,
511
847
  children: /* @__PURE__ */ jsx("div", {
512
848
  className: "mv:h-full mv:w-full mv:overflow-auto mv:bg-surface mv:text-ink",
513
- children: layoutFor(region, props)
849
+ children: /* @__PURE__ */ jsx(Layout, {
850
+ graph,
851
+ region,
852
+ instanceId,
853
+ onNodeSelect,
854
+ focus,
855
+ onFocusChange
856
+ })
514
857
  })
515
858
  });
516
859
  }
517
- function layoutFor(region, props) {
518
- const { layout } = region;
519
- switch (layout.type) {
520
- case "tree": return /* @__PURE__ */ jsx(TreeLayout, {
521
- ...props,
522
- region: {
523
- ...region,
524
- layout
525
- }
526
- });
527
- case "landscape": return /* @__PURE__ */ jsx(LandscapeLayout, {
528
- ...props,
529
- region: {
530
- ...region,
531
- layout
532
- }
533
- });
534
- case "xy": return /* @__PURE__ */ jsx(XYLayout, {
535
- ...props,
536
- region: {
537
- ...region,
538
- layout
539
- }
540
- });
541
- }
542
- }
543
860
  //#endregion
544
- //#region src/layouts/ParameterInputs.tsx
861
+ //#region src/components/ParameterInputs.tsx
545
862
  var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
546
863
  /** A checkbox for a boolean parameter, labelled with the parameter's title. */
547
864
  function ToggleParameterInput({ parameter, value, onChange }) {
@@ -626,7 +943,7 @@ function ParameterInput({ parameter, value, onChange }) {
626
943
  }
627
944
  }
628
945
  //#endregion
629
- //#region src/layouts/useParameterControls.ts
946
+ //#region src/components/useParameterControls.ts
630
947
  /**
631
948
  * The state behind a map view's parameter controls, with no markup, for hosts that lay the controls
632
949
  * out themselves. Pair each entry with `ParameterInput`, or with one of the typed inputs.
@@ -640,7 +957,7 @@ function useParameterControls(definition, values, onChange) {
640
957
  }));
641
958
  }
642
959
  //#endregion
643
- //#region src/layouts/ParameterControls.tsx
960
+ //#region src/components/ParameterControls.tsx
644
961
  /**
645
962
  * Default layout for a map view's parameter controls: a wrapping row. Hosts wanting their own layout
646
963
  * use `useParameterControls` with `ParameterInput` (or the typed inputs) instead.
@@ -664,4 +981,4 @@ function ParameterControls({ definition, values, onChange }) {
664
981
  //#endregion
665
982
  export { SelectParameterInput as a, ParameterInput as i, useParameterControls as n, ToggleParameterInput as o, MultiSelectParameterInput as r, MapView as s, ParameterControls as t };
666
983
 
667
- //# sourceMappingURL=ParameterControls-A1HJWyt9.js.map
984
+ //# sourceMappingURL=ParameterControls-Be05VST0.js.map