glassbrain 0.2.0-alpha.6 → 0.2.0-alpha.7

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.
@@ -31,6 +31,7 @@ import {
31
31
  indexModel,
32
32
  isFiltering,
33
33
  isNarrowing,
34
+ kindTable,
34
35
  mixHex,
35
36
  nodeWeight,
36
37
  originView,
@@ -53,17 +54,17 @@ import {
53
54
  unionSides,
54
55
  untheme,
55
56
  validateModel
56
- } from "./chunk-3SAL4526.js";
57
+ } from "./chunk-FNTYI7VP.js";
57
58
  import {
58
59
  DetailPanel,
59
60
  I,
60
61
  Icon,
61
62
  StringsContext,
62
63
  useStrings
63
- } from "./chunk-3P34XHQ2.js";
64
+ } from "./chunk-3KUNYSJE.js";
64
65
  import {
65
66
  EN
66
- } from "./chunk-5DEN6HXJ.js";
67
+ } from "./chunk-Q35ZKWKF.js";
67
68
  import {
68
69
  LAYOUTS,
69
70
  inlinePool
@@ -1713,7 +1714,7 @@ function LayerPicker({ layers, view, setView, disabled, collapsed }) {
1713
1714
  const ro = new ResizeObserver(measure);
1714
1715
  ro.observe(root);
1715
1716
  return () => ro.disconnect();
1716
- }, [single, layers.length]);
1717
+ }, [single, layers.length, collapsed]);
1717
1718
  useLayoutEffect2(() => {
1718
1719
  const root = box.current;
1719
1720
  if (!root) return;
@@ -1749,6 +1750,7 @@ function LayerPicker({ layers, view, setView, disabled, collapsed }) {
1749
1750
  {
1750
1751
  "data-v": l.id,
1751
1752
  disabled,
1753
+ tabIndex: collapsed ? -1 : void 0,
1752
1754
  className: lit ? "on" : "",
1753
1755
  ...stacked ? { "aria-pressed": lit } : { role: "radio", "aria-checked": lit },
1754
1756
  title: stacked ? t.stackLayer(l.label, lit) : t.viewLayer(l.label),
@@ -2005,7 +2007,7 @@ function Toolbar(p) {
2005
2007
  const originPick = controls.origins && p.origins.length > 1;
2006
2008
  const multi = controls.layers && p.layers.length > 1;
2007
2009
  const showLayer = (l) => setView(view.planes ? { layers: [...view.layers ?? [], l] } : { layers: [l] });
2008
- return /* @__PURE__ */ jsxs("div", { className: `gb-bar${multi ? " has-layers" : ""}`, children: [
2010
+ return /* @__PURE__ */ jsxs("div", { className: `gb-bar${multi && view.planes ? " has-layers" : ""}`, children: [
2009
2011
  controls.search && /* @__PURE__ */ jsx(
2010
2012
  SearchBox,
2011
2013
  {
@@ -2055,7 +2057,6 @@ function Toolbar(p) {
2055
2057
  ] })
2056
2058
  ] });
2057
2059
  }
2058
- var GROUP_CAP = 100;
2059
2060
  function Issues({ issues, onPick }) {
2060
2061
  const t = useStrings();
2061
2062
  const pop = usePopover(ISSUES_PLACE);
@@ -2063,28 +2064,31 @@ function Issues({ issues, onPick }) {
2063
2064
  const by = /* @__PURE__ */ new Map();
2064
2065
  for (const it of issues) {
2065
2066
  const name = it.group ?? it.kind;
2066
- const g = by.get(name) ?? by.set(name, { name, error: false, items: [] }).get(name);
2067
+ const key = `${it.level}:${name}`;
2068
+ const g = by.get(key) ?? by.set(key, { name, level: it.level, items: [] }).get(key);
2067
2069
  g.items.push(it);
2068
- if (it.level === "error") g.error = true;
2069
2070
  }
2070
- return [...by.values()].sort((a, b) => +b.error - +a.error || b.items.length - a.items.length);
2071
+ const rank = { error: 0, warn: 1, info: 2 };
2072
+ return [...by.values()].sort((a, b) => rank[a.level] - rank[b.level]);
2071
2073
  }, [issues]);
2072
2074
  const errors = issues.filter((i) => i.level === "error").length;
2073
- const warns = issues.length - errors;
2075
+ const warns = issues.filter((i) => i.level === "warn").length;
2076
+ const infos = issues.filter((i) => i.level === "info").length;
2077
+ const level = groups[0].level;
2074
2078
  const target = (it) => it.nodeId ?? it.edge?.source;
2075
2079
  return /* @__PURE__ */ jsxs("div", { className: "gb-menu", ref: pop.ref, children: [
2076
- /* @__PURE__ */ jsxs(
2080
+ /* @__PURE__ */ jsx(
2077
2081
  "button",
2078
2082
  {
2079
- className: `gb-pill ${errors ? "gb-err" : "gb-hint"}`,
2083
+ className: "gb-icon-btn gb-check-button",
2080
2084
  onClick: () => pop.setOpen(!pop.open),
2081
2085
  "aria-expanded": pop.open,
2082
- title: t.issuesTip(errors, warns),
2083
- children: [
2084
- /* @__PURE__ */ jsx(Icon, { d: I.warn, size: 14 }),
2085
- " ",
2086
- errors || warns
2087
- ]
2086
+ title: t.issuesTip(errors, warns, infos),
2087
+ "aria-label": t.issuesTip(errors, warns, infos),
2088
+ children: /* @__PURE__ */ jsxs("span", { className: `gb-check-${level}`, "aria-hidden": "true", children: [
2089
+ /* @__PURE__ */ jsx(Icon, { d: I[level], size: 18 }),
2090
+ /* @__PURE__ */ jsx("span", { className: "gb-check-badge", children: issues.length > 99 ? "99+" : issues.length })
2091
+ ] })
2088
2092
  }
2089
2093
  ),
2090
2094
  pop.open && /* @__PURE__ */ jsxs(
@@ -2093,27 +2097,33 @@ function Issues({ issues, onPick }) {
2093
2097
  ref: pop.panelRef,
2094
2098
  className: "gb-panel gb-issues",
2095
2099
  role: "dialog",
2100
+ "aria-label": t.issuesTitle(errors, warns, infos),
2096
2101
  "data-x": pop.placement?.align,
2097
2102
  "data-y": pop.placement?.side,
2098
2103
  style: pop.placement ? { left: pop.placement.left, top: pop.placement.top, right: "auto", bottom: "auto" } : { visibility: "hidden" },
2099
2104
  children: [
2100
- /* @__PURE__ */ jsx("div", { className: "gb-panel-h", children: t.issuesTitle(errors, warns) }),
2101
- groups.map((g) => /* @__PURE__ */ jsxs("details", { open: groups.length === 1, children: [
2102
- /* @__PURE__ */ jsxs("summary", { className: g.error ? "is-err" : "", children: [
2103
- /* @__PURE__ */ jsx("span", { children: g.name }),
2105
+ /* @__PURE__ */ jsx("div", { className: "gb-panel-h", children: t.issuesTitle(errors, warns, infos) }),
2106
+ groups.map((g) => /* @__PURE__ */ jsxs("details", { open: g.level !== "info", children: [
2107
+ /* @__PURE__ */ jsxs("summary", { className: `gb-check-${g.level}`, children: [
2108
+ /* @__PURE__ */ jsxs("span", { children: [
2109
+ g.level,
2110
+ " \xB7 ",
2111
+ g.name
2112
+ ] }),
2104
2113
  /* @__PURE__ */ jsx("b", { children: g.items.length })
2105
2114
  ] }),
2106
- /* @__PURE__ */ jsxs("ul", { children: [
2107
- g.items.slice(0, GROUP_CAP).map((it, i) => {
2108
- const id = target(it);
2109
- return /* @__PURE__ */ jsx("li", { className: id ? "is-link" : "", onClick: id ? () => {
2115
+ /* @__PURE__ */ jsx("ul", { children: g.items.map((it, i) => {
2116
+ const id = target(it);
2117
+ return /* @__PURE__ */ jsxs("li", { children: [
2118
+ id ? /* @__PURE__ */ jsx("button", { className: "gb-issue-target", onClick: () => {
2110
2119
  onPick(id);
2111
2120
  pop.setOpen(false);
2112
- } : void 0, children: it.message }, i);
2113
- }),
2114
- g.items.length > GROUP_CAP && /* @__PURE__ */ jsx("li", { className: "gb-more", children: t.moreItems(g.items.length - GROUP_CAP) })
2115
- ] })
2116
- ] }, g.name))
2121
+ }, children: it.message }) : /* @__PURE__ */ jsx("div", { children: it.message }),
2122
+ it.where && /* @__PURE__ */ jsx("small", { className: "gb-issue-where", children: it.where }),
2123
+ it.fix && /* @__PURE__ */ jsx("div", { className: "gb-issue-fix", children: it.fix })
2124
+ ] }, i);
2125
+ }) })
2126
+ ] }, `${g.level}:${g.name}`))
2117
2127
  ]
2118
2128
  }
2119
2129
  )
@@ -2303,7 +2313,8 @@ function installGraphInput(cy, el, actions) {
2303
2313
  el.addEventListener(name, fn, { capture, passive: false });
2304
2314
  bindings.push(() => el.removeEventListener(name, fn, capture));
2305
2315
  };
2306
- on("wheel", (e) => {
2316
+ const pane = el.parentElement;
2317
+ const wheel = (e) => {
2307
2318
  e.preventDefault();
2308
2319
  interact();
2309
2320
  if (e.ctrlKey || e.metaKey) {
@@ -2313,7 +2324,9 @@ function installGraphInput(cy, el, actions) {
2313
2324
  renderedPosition: { x: e.clientX - rect.left, y: e.clientY - rect.top }
2314
2325
  });
2315
2326
  } else cy.panBy({ x: -e.deltaX, y: -e.deltaY });
2316
- });
2327
+ };
2328
+ pane.addEventListener("wheel", wheel, { passive: false });
2329
+ bindings.push(() => pane.removeEventListener("wheel", wheel));
2317
2330
  on("mouseleave", () => actions.hover?.(null));
2318
2331
  const captured = /* @__PURE__ */ new Set();
2319
2332
  const point = (e) => {
@@ -2420,17 +2433,51 @@ function zoomPath(a, b) {
2420
2433
  }
2421
2434
  var easeInOut = (x) => x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;
2422
2435
 
2436
+ // src/react/GlassPlanes.tsx
2437
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
2438
+ function GlassPlanes({ plates, viewport, theme, alpha, hot }) {
2439
+ return /* @__PURE__ */ jsx2("div", { className: "gb-glass-planes", style: { opacity: alpha }, "aria-hidden": "true", children: plates.map((p) => {
2440
+ const points = p.points.map(([x, y]) => [x * viewport.zoom + viewport.pan.x, y * viewport.zoom + viewport.pan.y]);
2441
+ const left = Math.min(...points.map((p2) => p2[0])), top = Math.min(...points.map((p2) => p2[1]));
2442
+ const width = Math.max(...points.map((p2) => p2[0])) - left, height = Math.max(...points.map((p2) => p2[1])) - top;
2443
+ if (width <= 0 || height <= 0) return null;
2444
+ const local = points.map(([x, y]) => [x - left, y - top]);
2445
+ const clip = `polygon(${local.map(([x, y]) => `${100 * x / width}% ${100 * y / height}%`).join(",")})`;
2446
+ const c = plateColors(theme, p.color);
2447
+ const hue = mixHex(theme.canvas, p.color, 0.64);
2448
+ return /* @__PURE__ */ jsxs2(
2449
+ "div",
2450
+ {
2451
+ className: "gb-glass-plane",
2452
+ "data-layer": p.layer,
2453
+ style: { left, top, width, height, opacity: (p.alpha ?? 1) * (hot && hot !== p.layer ? 0.45 : 1) },
2454
+ children: [
2455
+ /* @__PURE__ */ jsx2("div", { className: "gb-glass-surface", style: {
2456
+ clipPath: clip,
2457
+ background: `linear-gradient(165deg, #ffffff26, #ffffff00 38%), linear-gradient(145deg, ${hue}6d, ${hue}${hot === p.layer ? "48" : "2d"} 55%, ${hue}5b)`
2458
+ } }),
2459
+ /* @__PURE__ */ jsxs2("svg", { width, height, className: "gb-glass-rim", children: [
2460
+ /* @__PURE__ */ jsx2("polygon", { points: local.map((p2) => p2.join(",")).join(" "), fill: "none", stroke: c.stroke, strokeOpacity: 0.8, strokeWidth: hot === p.layer ? 2.25 : 1.5 }),
2461
+ /* @__PURE__ */ jsx2("polyline", { points: local.slice(0, 3).map((p2) => p2.join(",")).join(" "), fill: "none", stroke: mixHex(p.color, "#ffffff", 0.72), strokeOpacity: 0.85, strokeWidth: 1.25 })
2462
+ ] })
2463
+ ]
2464
+ },
2465
+ p.layer
2466
+ );
2467
+ }) });
2468
+ }
2469
+
2423
2470
  // src/react/EditPanel.tsx
2424
2471
  import { useEffect as useEffect2, useId, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
2425
- import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
2472
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2426
2473
  var PICK_MAX = 8;
2427
2474
  function NodeRef({ id, model, colorOf, sub }) {
2428
2475
  const n = model.index.get(id);
2429
- return /* @__PURE__ */ jsxs2(Fragment2, { children: [
2430
- /* @__PURE__ */ jsx2("i", { className: "gb-dot", style: { background: colorOf(id) } }),
2431
- /* @__PURE__ */ jsxs2("span", { className: "gb-ref-main", children: [
2432
- /* @__PURE__ */ jsx2("span", { className: "gb-ref-label", children: n?.label ?? id }),
2433
- sub && /* @__PURE__ */ jsx2("span", { className: "gb-ref-sub", children: sub })
2476
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
2477
+ /* @__PURE__ */ jsx3("i", { className: "gb-dot", style: { background: colorOf(id) } }),
2478
+ /* @__PURE__ */ jsxs3("span", { className: "gb-ref-main", children: [
2479
+ /* @__PURE__ */ jsx3("span", { className: "gb-ref-label", children: n?.label ?? id }),
2480
+ sub && /* @__PURE__ */ jsx3("span", { className: "gb-ref-sub", children: sub })
2434
2481
  ] })
2435
2482
  ] });
2436
2483
  }
@@ -2461,8 +2508,8 @@ function NodePicker({ model, value, onChange, exclude, empty, autoFocus, label,
2461
2508
  }
2462
2509
  });
2463
2510
  const pathOf = (id) => idx.ancestorsOf(id).slice(0, 2).reverse().map((a) => model.index.get(a)?.label).filter(Boolean).join(" / ");
2464
- return /* @__PURE__ */ jsxs2("div", { className: `gb-pick${open ? " is-open" : ""}`, children: [
2465
- cur && !open ? /* @__PURE__ */ jsxs2(
2511
+ return /* @__PURE__ */ jsxs3("div", { className: `gb-pick${open ? " is-open" : ""}`, children: [
2512
+ cur && !open ? /* @__PURE__ */ jsxs3(
2466
2513
  "button",
2467
2514
  {
2468
2515
  ref: curRef,
@@ -2478,16 +2525,16 @@ function NodePicker({ model, value, onChange, exclude, empty, autoFocus, label,
2478
2525
  }
2479
2526
  },
2480
2527
  children: [
2481
- /* @__PURE__ */ jsx2(NodeRef, { id: cur.id, model, colorOf, sub: cur.id }),
2482
- /* @__PURE__ */ jsx2("i", { className: "gb-pick-x", "aria-hidden": true, onClick: (e) => {
2528
+ /* @__PURE__ */ jsx3(NodeRef, { id: cur.id, model, colorOf, sub: cur.id }),
2529
+ /* @__PURE__ */ jsx3("i", { className: "gb-pick-x", "aria-hidden": true, onClick: (e) => {
2483
2530
  e.stopPropagation();
2484
2531
  choose(null);
2485
- }, children: /* @__PURE__ */ jsx2(Icon, { d: I.x, size: 12 }) })
2532
+ }, children: /* @__PURE__ */ jsx3(Icon, { d: I.x, size: 12 }) })
2486
2533
  ]
2487
2534
  }
2488
- ) : /* @__PURE__ */ jsxs2("span", { className: "gb-input gb-pick-field", children: [
2489
- /* @__PURE__ */ jsx2(Icon, { d: I.search, size: 14 }),
2490
- /* @__PURE__ */ jsx2(
2535
+ ) : /* @__PURE__ */ jsxs3("span", { className: "gb-input gb-pick-field", children: [
2536
+ /* @__PURE__ */ jsx3(Icon, { d: I.search, size: 14 }),
2537
+ /* @__PURE__ */ jsx3(
2491
2538
  "input",
2492
2539
  {
2493
2540
  id: inputId,
@@ -2521,7 +2568,7 @@ function NodePicker({ model, value, onChange, exclude, empty, autoFocus, label,
2521
2568
  }
2522
2569
  )
2523
2570
  ] }),
2524
- open && hits.length > 0 && /* @__PURE__ */ jsx2("ul", { className: "gb-pick-list", role: "listbox", onMouseDown: (e) => e.preventDefault(), children: hits.map((id, i) => /* @__PURE__ */ jsx2(
2571
+ open && hits.length > 0 && /* @__PURE__ */ jsx3("ul", { className: "gb-pick-list", role: "listbox", onMouseDown: (e) => e.preventDefault(), children: hits.map((id, i) => /* @__PURE__ */ jsx3(
2525
2572
  "li",
2526
2573
  {
2527
2574
  role: "option",
@@ -2529,7 +2576,7 @@ function NodePicker({ model, value, onChange, exclude, empty, autoFocus, label,
2529
2576
  className: i === active ? "on" : "",
2530
2577
  onMouseEnter: () => setActive(i),
2531
2578
  onClick: () => choose(id),
2532
- children: /* @__PURE__ */ jsx2(NodeRef, { id, model, colorOf, sub: pathOf(id) || id })
2579
+ children: /* @__PURE__ */ jsx3(NodeRef, { id, model, colorOf, sub: pathOf(id) || id })
2533
2580
  },
2534
2581
  id
2535
2582
  )) })
@@ -2554,7 +2601,7 @@ function readContent(text) {
2554
2601
  }
2555
2602
  function Shell({ title, onClose, onSubmit, foot, error, children }) {
2556
2603
  const t = useStrings();
2557
- return /* @__PURE__ */ jsxs2(
2604
+ return /* @__PURE__ */ jsxs3(
2558
2605
  "form",
2559
2606
  {
2560
2607
  className: "gb-detail gb-edit",
@@ -2566,19 +2613,19 @@ function Shell({ title, onClose, onSubmit, foot, error, children }) {
2566
2613
  if (e.key === "Escape" && !e.defaultPrevented) onClose();
2567
2614
  },
2568
2615
  children: [
2569
- /* @__PURE__ */ jsxs2("div", { className: "gb-dh", children: [
2570
- /* @__PURE__ */ jsx2("span", { className: "gb-dh-title", children: title }),
2571
- /* @__PURE__ */ jsx2("span", { className: "gb-dh-act", children: /* @__PURE__ */ jsx2("button", { type: "button", className: "gb-ibtn", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(Icon, { d: I.x, size: 15 }) }) })
2616
+ /* @__PURE__ */ jsxs3("div", { className: "gb-dh", children: [
2617
+ /* @__PURE__ */ jsx3("span", { className: "gb-dh-title", children: title }),
2618
+ /* @__PURE__ */ jsx3("span", { className: "gb-dh-act", children: /* @__PURE__ */ jsx3("button", { type: "button", className: "gb-ibtn", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx3(Icon, { d: I.x, size: 15 }) }) })
2572
2619
  ] }),
2573
- /* @__PURE__ */ jsx2("div", { className: "gb-db gb-form", children }),
2574
- error && /* @__PURE__ */ jsx2("div", { className: "gb-edit-err", role: "alert", children: error }),
2575
- /* @__PURE__ */ jsx2("div", { className: "gb-df", children: foot })
2620
+ /* @__PURE__ */ jsx3("div", { className: "gb-db gb-form", children }),
2621
+ error && /* @__PURE__ */ jsx3("div", { className: "gb-edit-err", role: "alert", children: error }),
2622
+ /* @__PURE__ */ jsx3("div", { className: "gb-df", children: foot })
2576
2623
  ]
2577
2624
  }
2578
2625
  );
2579
2626
  }
2580
2627
  function EditPanel({ target, model, onSubmit, onCancel, onRetarget, renderEditor, colorOf = () => void 0 }) {
2581
- return target.what === "node" ? /* @__PURE__ */ jsx2(
2628
+ return target.what === "node" ? /* @__PURE__ */ jsx3(
2582
2629
  NodeForm,
2583
2630
  {
2584
2631
  target,
@@ -2590,7 +2637,7 @@ function EditPanel({ target, model, onSubmit, onCancel, onRetarget, renderEditor
2590
2637
  colorOf
2591
2638
  },
2592
2639
  target.id ?? "+"
2593
- ) : /* @__PURE__ */ jsx2(EdgeForm, { source: target.source, model, onSubmit, onCancel, colorOf }, target.source ?? "+");
2640
+ ) : /* @__PURE__ */ jsx3(EdgeForm, { source: target.source, model, onSubmit, onCancel, colorOf }, target.source ?? "+");
2594
2641
  }
2595
2642
  function useSubmit(onSubmit) {
2596
2643
  const t = useStrings();
@@ -2659,16 +2706,16 @@ function NodeForm({ target, model, onSubmit, onCancel, onRetarget, renderEditor,
2659
2706
  }
2660
2707
  if (submit({ op: "updateNode", id: node.id, set })) onCancel();
2661
2708
  };
2662
- const foot = confirming && node ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
2663
- /* @__PURE__ */ jsx2("span", { className: "gb-confirm", children: t.confirmRemove(edges.length) }),
2664
- /* @__PURE__ */ jsxs2("span", { className: "gb-form-act", children: [
2665
- /* @__PURE__ */ jsx2("button", { type: "button", className: "gb-btn", onClick: () => setConfirming(false), children: t.cancel }),
2666
- /* @__PURE__ */ jsx2("button", { type: "button", className: "gb-btn gb-danger", onClick: () => {
2709
+ const foot = confirming && node ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
2710
+ /* @__PURE__ */ jsx3("span", { className: "gb-confirm", children: t.confirmRemove(edges.length) }),
2711
+ /* @__PURE__ */ jsxs3("span", { className: "gb-form-act", children: [
2712
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "gb-btn", onClick: () => setConfirming(false), children: t.cancel }),
2713
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "gb-btn gb-danger", onClick: () => {
2667
2714
  if (submit({ op: "removeNode", id: node.id })) onCancel();
2668
2715
  }, children: t.remove })
2669
2716
  ] })
2670
- ] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
2671
- node ? /* @__PURE__ */ jsx2(
2717
+ ] }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
2718
+ node ? /* @__PURE__ */ jsx3(
2672
2719
  "button",
2673
2720
  {
2674
2721
  type: "button",
@@ -2678,17 +2725,17 @@ function NodeForm({ target, model, onSubmit, onCancel, onRetarget, renderEditor,
2678
2725
  onClick: () => setConfirming(true),
2679
2726
  children: t.remove
2680
2727
  }
2681
- ) : /* @__PURE__ */ jsx2("span", {}),
2682
- /* @__PURE__ */ jsxs2("span", { className: "gb-form-act", children: [
2683
- /* @__PURE__ */ jsx2("button", { type: "button", className: "gb-btn", onClick: onCancel, children: t.cancel }),
2684
- /* @__PURE__ */ jsx2("button", { type: "submit", className: "gb-btn gb-primary", disabled: creating && (!id.trim() || !!idErr), children: creating ? t.create : t.save })
2728
+ ) : /* @__PURE__ */ jsx3("span", {}),
2729
+ /* @__PURE__ */ jsxs3("span", { className: "gb-form-act", children: [
2730
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "gb-btn", onClick: onCancel, children: t.cancel }),
2731
+ /* @__PURE__ */ jsx3("button", { type: "submit", className: "gb-btn gb-primary", disabled: creating && (!id.trim() || !!idErr), children: creating ? t.create : t.save })
2685
2732
  ] })
2686
2733
  ] });
2687
- return /* @__PURE__ */ jsxs2(Shell, { title: creating ? t.newNode : t.editNode, onClose: onCancel, onSubmit: save, foot, error, children: [
2688
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2689
- /* @__PURE__ */ jsx2("label", { className: "gb-k", htmlFor: `${uid}-id`, children: t.id }),
2690
- creating ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
2691
- /* @__PURE__ */ jsx2(
2734
+ return /* @__PURE__ */ jsxs3(Shell, { title: creating ? t.newNode : t.editNode, onClose: onCancel, onSubmit: save, foot, error, children: [
2735
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2736
+ /* @__PURE__ */ jsx3("label", { className: "gb-k", htmlFor: `${uid}-id`, children: t.id }),
2737
+ creating ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
2738
+ /* @__PURE__ */ jsx3(
2692
2739
  "input",
2693
2740
  {
2694
2741
  id: `${uid}-id`,
@@ -2699,12 +2746,12 @@ function NodeForm({ target, model, onSubmit, onCancel, onRetarget, renderEditor,
2699
2746
  onChange: (e) => setId(e.target.value)
2700
2747
  }
2701
2748
  ),
2702
- /* @__PURE__ */ jsx2("small", { className: idErr ? "is-bad" : "", children: idErr ? t.error[idErr] : t.idHint })
2703
- ] }) : /* @__PURE__ */ jsx2("code", { className: "gb-id", children: node.id })
2749
+ /* @__PURE__ */ jsx3("small", { className: idErr ? "is-bad" : "", children: idErr ? t.error[idErr] : t.idHint })
2750
+ ] }) : /* @__PURE__ */ jsx3("code", { className: "gb-id", children: node.id })
2704
2751
  ] }),
2705
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2706
- /* @__PURE__ */ jsx2("label", { className: "gb-k", htmlFor: `${uid}-parent`, children: t.parent }),
2707
- /* @__PURE__ */ jsx2(
2752
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2753
+ /* @__PURE__ */ jsx3("label", { className: "gb-k", htmlFor: `${uid}-parent`, children: t.parent }),
2754
+ /* @__PURE__ */ jsx3(
2708
2755
  NodePicker,
2709
2756
  {
2710
2757
  id: `${uid}-parent`,
@@ -2721,20 +2768,20 @@ function NodeForm({ target, model, onSubmit, onCancel, onRetarget, renderEditor,
2721
2768
  }
2722
2769
  )
2723
2770
  ] }),
2724
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2725
- /* @__PURE__ */ jsx2("label", { className: "gb-k", htmlFor: `${uid}-before`, children: "Before" }),
2726
- /* @__PURE__ */ jsxs2("select", { id: `${uid}-before`, className: "gb-input", value: before ?? "", onChange: (e) => setBefore(e.target.value || null), children: [
2727
- /* @__PURE__ */ jsx2("option", { value: "", children: "Last" }),
2728
- model.nodes.filter((n) => n.id !== node?.id && (n.parent ?? null) === parent).sort((a, b) => (a.order ?? Infinity) - (b.order ?? Infinity)).map((n) => /* @__PURE__ */ jsx2("option", { value: n.id, children: n.label }, n.id))
2771
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2772
+ /* @__PURE__ */ jsx3("label", { className: "gb-k", htmlFor: `${uid}-before`, children: "Before" }),
2773
+ /* @__PURE__ */ jsxs3("select", { id: `${uid}-before`, className: "gb-input", value: before ?? "", onChange: (e) => setBefore(e.target.value || null), children: [
2774
+ /* @__PURE__ */ jsx3("option", { value: "", children: "Last" }),
2775
+ model.nodes.filter((n) => n.id !== node?.id && (n.parent ?? null) === parent).sort((a, b) => (a.order ?? Infinity) - (b.order ?? Infinity)).map((n) => /* @__PURE__ */ jsx3("option", { value: n.id, children: n.label }, n.id))
2729
2776
  ] })
2730
2777
  ] }),
2731
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld gb-grow", children: [
2732
- /* @__PURE__ */ jsxs2("label", { className: "gb-k", htmlFor: `${uid}-json`, children: [
2778
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld gb-grow", children: [
2779
+ /* @__PURE__ */ jsxs3("label", { className: "gb-k", htmlFor: `${uid}-json`, children: [
2733
2780
  t.content,
2734
2781
  " ",
2735
- /* @__PURE__ */ jsx2("em", { children: t.contentHint })
2782
+ /* @__PURE__ */ jsx3("em", { children: t.contentHint })
2736
2783
  ] }),
2737
- renderEditor ? renderEditor({ value: text, onChange: setText }) : /* @__PURE__ */ jsx2(
2784
+ renderEditor ? renderEditor({ value: text, onChange: setText }) : /* @__PURE__ */ jsx3(
2738
2785
  "textarea",
2739
2786
  {
2740
2787
  id: `${uid}-json`,
@@ -2746,19 +2793,19 @@ function NodeForm({ target, model, onSubmit, onCancel, onRetarget, renderEditor,
2746
2793
  }
2747
2794
  )
2748
2795
  ] }),
2749
- node && /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2750
- /* @__PURE__ */ jsxs2("span", { className: "gb-k", children: [
2796
+ node && /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2797
+ /* @__PURE__ */ jsxs3("span", { className: "gb-k", children: [
2751
2798
  t.relations,
2752
2799
  " ",
2753
- /* @__PURE__ */ jsx2("em", { children: edges.length || "" })
2800
+ /* @__PURE__ */ jsx3("em", { children: edges.length || "" })
2754
2801
  ] }),
2755
- /* @__PURE__ */ jsx2("ul", { className: "gb-rel", children: edges.map((e, i) => {
2802
+ /* @__PURE__ */ jsx3("ul", { className: "gb-rel", children: edges.map((e, i) => {
2756
2803
  const out = e.source === node.id;
2757
- return /* @__PURE__ */ jsxs2("li", { children: [
2758
- /* @__PURE__ */ jsx2("span", { className: "gb-rel-dir", "aria-hidden": true, children: out ? "\u2192" : "\u2190" }),
2759
- /* @__PURE__ */ jsx2(NodeRef, { id: out ? e.target : e.source, model, colorOf }),
2760
- e.kind && /* @__PURE__ */ jsx2("span", { className: "gb-r-kind", children: e.kind }),
2761
- /* @__PURE__ */ jsx2(
2804
+ return /* @__PURE__ */ jsxs3("li", { children: [
2805
+ /* @__PURE__ */ jsx3("span", { className: "gb-rel-dir", "aria-hidden": true, children: out ? "\u2192" : "\u2190" }),
2806
+ /* @__PURE__ */ jsx3(NodeRef, { id: out ? e.target : e.source, model, colorOf }),
2807
+ e.kind && /* @__PURE__ */ jsx3("span", { className: "gb-r-kind", children: e.kind }),
2808
+ /* @__PURE__ */ jsx3(
2762
2809
  "button",
2763
2810
  {
2764
2811
  type: "button",
@@ -2766,13 +2813,13 @@ function NodeForm({ target, model, onSubmit, onCancel, onRetarget, renderEditor,
2766
2813
  "aria-label": t.removeEdge,
2767
2814
  title: t.removeEdge,
2768
2815
  onClick: () => submit({ op: "removeEdge", edge: { source: e.source, target: e.target, kind: e.kind } }),
2769
- children: /* @__PURE__ */ jsx2(Icon, { d: I.x, size: 13 })
2816
+ children: /* @__PURE__ */ jsx3(Icon, { d: I.x, size: 13 })
2770
2817
  }
2771
2818
  )
2772
2819
  ] }, i);
2773
2820
  }) }),
2774
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "gb-add", onClick: () => onRetarget({ what: "edge", source: node.id }), children: [
2775
- /* @__PURE__ */ jsx2(Icon, { d: I.plus, size: 13 }),
2821
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "gb-add", onClick: () => onRetarget({ what: "edge", source: node.id }), children: [
2822
+ /* @__PURE__ */ jsx3(Icon, { d: I.plus, size: 13 }),
2776
2823
  t.addEdge
2777
2824
  ] })
2778
2825
  ] })
@@ -2794,21 +2841,21 @@ function EdgeForm({ source: src, model, onSubmit, onCancel, colorOf }) {
2794
2841
  };
2795
2842
  if (submit(op)) onCancel();
2796
2843
  };
2797
- const foot = /* @__PURE__ */ jsxs2(Fragment2, { children: [
2798
- /* @__PURE__ */ jsx2("span", {}),
2799
- /* @__PURE__ */ jsxs2("span", { className: "gb-form-act", children: [
2800
- /* @__PURE__ */ jsx2("button", { type: "button", className: "gb-btn", onClick: onCancel, children: t.cancel }),
2801
- /* @__PURE__ */ jsx2("button", { type: "submit", className: "gb-btn gb-primary", disabled: !source || !target, children: t.create })
2844
+ const foot = /* @__PURE__ */ jsxs3(Fragment2, { children: [
2845
+ /* @__PURE__ */ jsx3("span", {}),
2846
+ /* @__PURE__ */ jsxs3("span", { className: "gb-form-act", children: [
2847
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "gb-btn", onClick: onCancel, children: t.cancel }),
2848
+ /* @__PURE__ */ jsx3("button", { type: "submit", className: "gb-btn gb-primary", disabled: !source || !target, children: t.create })
2802
2849
  ] })
2803
2850
  ] });
2804
- return /* @__PURE__ */ jsxs2(Shell, { title: t.newEdge, onClose: onCancel, onSubmit: save, foot, error, children: [
2805
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2806
- /* @__PURE__ */ jsx2("label", { className: "gb-k", htmlFor: `${uid}-s`, children: t.source }),
2807
- /* @__PURE__ */ jsx2(NodePicker, { id: `${uid}-s`, model, value: source, onChange: setSource, autoFocus: !src, label: t.source, colorOf })
2851
+ return /* @__PURE__ */ jsxs3(Shell, { title: t.newEdge, onClose: onCancel, onSubmit: save, foot, error, children: [
2852
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2853
+ /* @__PURE__ */ jsx3("label", { className: "gb-k", htmlFor: `${uid}-s`, children: t.source }),
2854
+ /* @__PURE__ */ jsx3(NodePicker, { id: `${uid}-s`, model, value: source, onChange: setSource, autoFocus: !src, label: t.source, colorOf })
2808
2855
  ] }),
2809
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2810
- /* @__PURE__ */ jsx2("label", { className: "gb-k", htmlFor: `${uid}-t`, children: t.target }),
2811
- /* @__PURE__ */ jsx2(
2856
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2857
+ /* @__PURE__ */ jsx3("label", { className: "gb-k", htmlFor: `${uid}-t`, children: t.target }),
2858
+ /* @__PURE__ */ jsx3(
2812
2859
  NodePicker,
2813
2860
  {
2814
2861
  id: `${uid}-t`,
@@ -2822,14 +2869,14 @@ function EdgeForm({ source: src, model, onSubmit, onCancel, colorOf }) {
2822
2869
  }
2823
2870
  )
2824
2871
  ] }),
2825
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2826
- /* @__PURE__ */ jsx2("label", { className: "gb-k", htmlFor: `${uid}-k`, children: t.kind }),
2827
- /* @__PURE__ */ jsx2("input", { id: `${uid}-k`, className: "gb-input", value: kind, list: `${uid}-kinds`, spellCheck: false, onChange: (e) => setKind(e.target.value) }),
2828
- /* @__PURE__ */ jsx2("datalist", { id: `${uid}-kinds`, children: kinds.map((k) => /* @__PURE__ */ jsx2("option", { value: k }, k)) })
2872
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2873
+ /* @__PURE__ */ jsx3("label", { className: "gb-k", htmlFor: `${uid}-k`, children: t.kind }),
2874
+ /* @__PURE__ */ jsx3("input", { id: `${uid}-k`, className: "gb-input", value: kind, list: `${uid}-kinds`, spellCheck: false, onChange: (e) => setKind(e.target.value) }),
2875
+ /* @__PURE__ */ jsx3("datalist", { id: `${uid}-kinds`, children: kinds.map((k) => /* @__PURE__ */ jsx3("option", { value: k }, k)) })
2829
2876
  ] }),
2830
- /* @__PURE__ */ jsxs2("div", { className: "gb-fld", children: [
2831
- /* @__PURE__ */ jsx2("label", { className: "gb-k", htmlFor: `${uid}-l`, children: t.edgeLabel }),
2832
- /* @__PURE__ */ jsx2("input", { id: `${uid}-l`, className: "gb-input", value: label, spellCheck: false, onChange: (e) => setLabel(e.target.value) })
2877
+ /* @__PURE__ */ jsxs3("div", { className: "gb-fld", children: [
2878
+ /* @__PURE__ */ jsx3("label", { className: "gb-k", htmlFor: `${uid}-l`, children: t.edgeLabel }),
2879
+ /* @__PURE__ */ jsx3("input", { id: `${uid}-l`, className: "gb-input", value: label, spellCheck: false, onChange: (e) => setLabel(e.target.value) })
2833
2880
  ] })
2834
2881
  ] });
2835
2882
  }
@@ -2837,15 +2884,15 @@ function EdgeForm({ source: src, model, onSubmit, onCancel, colorOf }) {
2837
2884
  // src/react/Legend.tsx
2838
2885
  import { useCallback, useEffect as useEffect3, useLayoutEffect as useLayoutEffect3, useMemo as useMemo3, useRef as useRef3, useState as useState4 } from "react";
2839
2886
  import { createPortal } from "react-dom";
2840
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2887
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
2841
2888
  function applyLook(profile, look) {
2842
2889
  if (!look || !(look.nodePalette || look.edgePalette || look.nodeSize || look.edgeWidth)) return profile;
2843
2890
  return {
2844
2891
  ...profile,
2845
- nodePalette: { ...profile.nodePalette, ...look.nodePalette },
2846
- edgePalette: { ...profile.edgePalette, ...look.edgePalette },
2847
- nodeSize: { ...profile.nodeSize, ...look.nodeSize },
2848
- edgeWidth: { ...profile.edgeWidth, ...look.edgeWidth }
2892
+ nodePalette: kindTable(profile.nodePalette, look.nodePalette),
2893
+ edgePalette: kindTable(profile.edgePalette, look.edgePalette),
2894
+ nodeSize: kindTable(profile.nodeSize, look.nodeSize),
2895
+ edgeWidth: kindTable(profile.edgeWidth, look.edgeWidth)
2849
2896
  };
2850
2897
  }
2851
2898
  var isEmptyLook = (l) => !l.skeleton && ![l.nodePalette, l.edgePalette, l.nodeSize, l.edgeWidth].some((m) => m && Object.keys(m).length);
@@ -2873,15 +2920,15 @@ function readMarks(c, cy, style, nodeKinds, edgeKinds) {
2873
2920
  };
2874
2921
  }
2875
2922
  function tally(model, profile) {
2876
- const nodes = {};
2877
- const edges = {};
2923
+ const nodes = /* @__PURE__ */ Object.create(null);
2924
+ const edges = /* @__PURE__ */ Object.create(null);
2878
2925
  let plain = 0;
2879
2926
  for (const n of model.nodes) {
2880
2927
  const hollow = !!n.flags?.some((f) => profile.placeholderFlags.includes(f));
2881
2928
  if (!hollow && n.kind) nodes[n.kind] = (nodes[n.kind] ?? 0) + 1;
2882
2929
  else plain++;
2883
2930
  }
2884
- for (const e of model.edges) if (e.kind && e.kind in profile.edgePalette) edges[e.kind] = (edges[e.kind] ?? 0) + 1;
2931
+ for (const e of model.edges) if (e.kind && Object.hasOwn(profile.edgePalette, e.kind)) edges[e.kind] = (edges[e.kind] ?? 0) + 1;
2885
2932
  return { nodes, edges, plain };
2886
2933
  }
2887
2934
  var SCALES = [0.5, 1, 2];
@@ -2912,7 +2959,7 @@ function Item(p) {
2912
2959
  ctl.done(k, byKeyboard);
2913
2960
  if (byKeyboard) btn.current?.focus({ preventScroll: true });
2914
2961
  };
2915
- return /* @__PURE__ */ jsxs3(
2962
+ return /* @__PURE__ */ jsxs4(
2916
2963
  "span",
2917
2964
  {
2918
2965
  ref: item,
@@ -2929,7 +2976,7 @@ function Item(p) {
2929
2976
  if (!e.currentTarget.contains(e.relatedTarget) && !e.relatedTarget?.closest?.(".gb-lg-pop")) ctl.focus(k, false, false);
2930
2977
  },
2931
2978
  children: [
2932
- /* @__PURE__ */ jsxs3(
2979
+ /* @__PURE__ */ jsxs4(
2933
2980
  "button",
2934
2981
  {
2935
2982
  ref: btn,
@@ -2943,12 +2990,12 @@ function Item(p) {
2943
2990
  onFocus: (e) => ctl.focus(k, true, e.currentTarget.matches(":focus-visible")),
2944
2991
  children: [
2945
2992
  p.mark,
2946
- p.label && /* @__PURE__ */ jsx3("span", { children: p.label }),
2947
- p.count != null && /* @__PURE__ */ jsx3("b", { children: p.count })
2993
+ p.label && /* @__PURE__ */ jsx4("span", { children: p.label }),
2994
+ p.count != null && /* @__PURE__ */ jsx4("b", { children: p.count })
2948
2995
  ]
2949
2996
  }
2950
2997
  ),
2951
- open && portalRoot && createPortal(/* @__PURE__ */ jsxs3(
2998
+ open && portalRoot && createPortal(/* @__PURE__ */ jsxs4(
2952
2999
  "div",
2953
3000
  {
2954
3001
  ref: panel,
@@ -2966,7 +3013,7 @@ function Item(p) {
2966
3013
  }
2967
3014
  },
2968
3015
  children: [
2969
- p.onToggle && /* @__PURE__ */ jsx3(
3016
+ p.onToggle && /* @__PURE__ */ jsx4(
2970
3017
  "button",
2971
3018
  {
2972
3019
  type: "button",
@@ -2978,12 +3025,12 @@ function Item(p) {
2978
3025
  p.onToggle();
2979
3026
  finish(e.detail === 0);
2980
3027
  },
2981
- children: /* @__PURE__ */ jsx3(Eye, { off: p.off })
3028
+ children: /* @__PURE__ */ jsx4(Eye, { off: p.off })
2982
3029
  }
2983
3030
  ),
2984
- /* @__PURE__ */ jsxs3("label", { className: "gb-lg-well", title: `${t.legendColor} \xB7 ${p.color}`, children: [
2985
- /* @__PURE__ */ jsx3("i", { style: { background: p.color } }),
2986
- /* @__PURE__ */ jsx3(
3031
+ /* @__PURE__ */ jsxs4("label", { className: "gb-lg-well", title: `${t.legendColor} \xB7 ${p.color}`, children: [
3032
+ /* @__PURE__ */ jsx4("i", { style: { background: p.color } }),
3033
+ /* @__PURE__ */ jsx4(
2987
3034
  "input",
2988
3035
  {
2989
3036
  ref: well,
@@ -2995,8 +3042,8 @@ function Item(p) {
2995
3042
  }
2996
3043
  )
2997
3044
  ] }),
2998
- p.onScale && /* @__PURE__ */ jsx3("i", { className: "gb-lg-sep" }),
2999
- p.onScale && /* @__PURE__ */ jsx3("span", { className: "gb-lg-segm", role: "group", "aria-label": t.legendSize, children: SCALES.map((s) => /* @__PURE__ */ jsx3(
3045
+ p.onScale && /* @__PURE__ */ jsx4("i", { className: "gb-lg-sep" }),
3046
+ p.onScale && /* @__PURE__ */ jsx4("span", { className: "gb-lg-segm", role: "group", "aria-label": t.legendSize, children: SCALES.map((s) => /* @__PURE__ */ jsx4(
3000
3047
  "button",
3001
3048
  {
3002
3049
  type: "button",
@@ -3004,7 +3051,7 @@ function Item(p) {
3004
3051
  "aria-pressed": s === (p.scale ?? 1),
3005
3052
  title: `${s}\xD7`,
3006
3053
  onClick: () => p.onScale(s),
3007
- children: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 16 10", width: 16, height: 10, children: p.glyph === "line" ? /* @__PURE__ */ jsx3("line", { x1: 2, y1: 5, x2: 14, y2: 5, stroke: "currentColor", strokeWidth: s * 1.6, strokeLinecap: "round" }) : /* @__PURE__ */ jsx3("circle", { cx: 8, cy: 5, r: 1.6 + s * 1.4, fill: "currentColor" }) })
3054
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 10", width: 16, height: 10, children: p.glyph === "line" ? /* @__PURE__ */ jsx4("line", { x1: 2, y1: 5, x2: 14, y2: 5, stroke: "currentColor", strokeWidth: s * 1.6, strokeLinecap: "round" }) : /* @__PURE__ */ jsx4("circle", { cx: 8, cy: 5, r: 1.6 + s * 1.4, fill: "currentColor" }) })
3008
3055
  },
3009
3056
  s
3010
3057
  )) })
@@ -3016,7 +3063,7 @@ function Item(p) {
3016
3063
  );
3017
3064
  }
3018
3065
  function Eye({ off }) {
3019
- return /* @__PURE__ */ jsxs3(
3066
+ return /* @__PURE__ */ jsxs4(
3020
3067
  "svg",
3021
3068
  {
3022
3069
  viewBox: "0 0 16 16",
@@ -3028,9 +3075,9 @@ function Eye({ off }) {
3028
3075
  strokeLinecap: "round",
3029
3076
  strokeLinejoin: "round",
3030
3077
  children: [
3031
- /* @__PURE__ */ jsx3("path", { d: "M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8Z" }),
3032
- /* @__PURE__ */ jsx3("circle", { cx: 8, cy: 8, r: 2 }),
3033
- off && /* @__PURE__ */ jsx3("path", { d: "M2.5 2.5l11 11" })
3078
+ /* @__PURE__ */ jsx4("path", { d: "M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8Z" }),
3079
+ /* @__PURE__ */ jsx4("circle", { cx: 8, cy: 8, r: 2 }),
3080
+ off && /* @__PURE__ */ jsx4("path", { d: "M2.5 2.5l11 11" })
3034
3081
  ]
3035
3082
  }
3036
3083
  );
@@ -3038,14 +3085,14 @@ function Eye({ off }) {
3038
3085
  function NodeMark({ color, shape = "circle", ring, off, scale = 1 }) {
3039
3086
  const paint = off ? { fill: "none", stroke: color, strokeWidth: 1.4 } : { fill: color, stroke: ring, strokeWidth: 1.2 };
3040
3087
  const r = (off ? 4.8 : 5.5) * (1 + 0.2 * Math.log2(scale));
3041
- return /* @__PURE__ */ jsx3("svg", { className: "gb-lg-mark", viewBox: "0 0 14 14", width: 14, height: 14, children: shape === "hexagon" ? /* @__PURE__ */ jsx3("polygon", { points: [0, 1, 2, 3, 4, 5].map((i) => `${7 + r * Math.sin(i * Math.PI / 3)},${7 - r * Math.cos(i * Math.PI / 3)}`).join(" "), ...paint }) : shape === "diamond" ? /* @__PURE__ */ jsx3("polygon", { points: `7,${7 - r} ${7 + r},7 7,${7 + r} ${7 - r},7`, ...paint }) : shape === "rect" ? /* @__PURE__ */ jsx3("rect", { x: 7 - r * 0.85, y: 7 - r * 0.85, width: r * 1.7, height: r * 1.7, rx: 1.5, ...paint }) : /* @__PURE__ */ jsx3("circle", { cx: 7, cy: 7, r, ...paint }) });
3088
+ return /* @__PURE__ */ jsx4("svg", { className: "gb-lg-mark", viewBox: "0 0 14 14", width: 14, height: 14, children: shape === "hexagon" ? /* @__PURE__ */ jsx4("polygon", { points: [0, 1, 2, 3, 4, 5].map((i) => `${7 + r * Math.sin(i * Math.PI / 3)},${7 - r * Math.cos(i * Math.PI / 3)}`).join(" "), ...paint }) : shape === "diamond" ? /* @__PURE__ */ jsx4("polygon", { points: `7,${7 - r} ${7 + r},7 7,${7 + r} ${7 - r},7`, ...paint }) : shape === "rect" ? /* @__PURE__ */ jsx4("rect", { x: 7 - r * 0.85, y: 7 - r * 0.85, width: r * 1.7, height: r * 1.7, rx: 1.5, ...paint }) : /* @__PURE__ */ jsx4("circle", { cx: 7, cy: 7, r, ...paint }) });
3042
3089
  }
3043
3090
  var DASH = { dashed: "4 2.5", dotted: "0.1 3" };
3044
3091
  function EdgeMark({ color, stroke, off, scale = 1 }) {
3045
3092
  const sw = 1.8 * (1 + 0.3 * Math.log2(scale));
3046
3093
  const x1 = stroke.tail === "triangle" ? 6 : 2, x2 = stroke.head === "triangle" ? 18 : 22;
3047
- return /* @__PURE__ */ jsxs3("svg", { className: "gb-lg-mark", viewBox: "0 0 24 12", width: 24, height: 12, opacity: off ? 0.35 : 1, children: [
3048
- /* @__PURE__ */ jsx3(
3094
+ return /* @__PURE__ */ jsxs4("svg", { className: "gb-lg-mark", viewBox: "0 0 24 12", width: 24, height: 12, opacity: off ? 0.35 : 1, children: [
3095
+ /* @__PURE__ */ jsx4(
3049
3096
  "line",
3050
3097
  {
3051
3098
  x1,
@@ -3058,20 +3105,20 @@ function EdgeMark({ color, stroke, off, scale = 1 }) {
3058
3105
  strokeDasharray: DASH[stroke.dash]
3059
3106
  }
3060
3107
  ),
3061
- stroke.head === "triangle" && /* @__PURE__ */ jsx3("polygon", { points: "17,2.5 23,6 17,9.5", fill: color }),
3062
- stroke.tail === "triangle" && /* @__PURE__ */ jsx3("polygon", { points: "7,2.5 1,6 7,9.5", fill: color }),
3063
- stroke.head === "tee" && /* @__PURE__ */ jsx3("path", { d: "M22,2.5 V9.5", stroke: color, strokeWidth: 1.8 }),
3064
- stroke.tail === "tee" && /* @__PURE__ */ jsx3("path", { d: "M2,2.5 V9.5", stroke: color, strokeWidth: 1.8 })
3108
+ stroke.head === "triangle" && /* @__PURE__ */ jsx4("polygon", { points: "17,2.5 23,6 17,9.5", fill: color }),
3109
+ stroke.tail === "triangle" && /* @__PURE__ */ jsx4("polygon", { points: "7,2.5 1,6 7,9.5", fill: color }),
3110
+ stroke.head === "tee" && /* @__PURE__ */ jsx4("path", { d: "M22,2.5 V9.5", stroke: color, strokeWidth: 1.8 }),
3111
+ stroke.tail === "tee" && /* @__PURE__ */ jsx4("path", { d: "M2,2.5 V9.5", stroke: color, strokeWidth: 1.8 })
3065
3112
  ] });
3066
3113
  }
3067
3114
  function SkeletonEdge({ theme }) {
3068
3115
  const id = useMemo3(() => `gb-lg-contain-${Math.random().toString(36).slice(2)}`, []);
3069
- return /* @__PURE__ */ jsxs3("svg", { className: "gb-lg-mark", viewBox: "0 0 30 12", width: 30, height: 12, children: [
3070
- /* @__PURE__ */ jsx3("defs", { children: /* @__PURE__ */ jsxs3("linearGradient", { id, children: [
3071
- /* @__PURE__ */ jsx3("stop", { offset: "0", stopColor: skeletonColor(theme, 0) }),
3072
- /* @__PURE__ */ jsx3("stop", { offset: "1", stopColor: skeletonColor(theme, 1) })
3116
+ return /* @__PURE__ */ jsxs4("svg", { className: "gb-lg-mark", viewBox: "0 0 30 12", width: 30, height: 12, children: [
3117
+ /* @__PURE__ */ jsx4("defs", { children: /* @__PURE__ */ jsxs4("linearGradient", { id, children: [
3118
+ /* @__PURE__ */ jsx4("stop", { offset: "0", stopColor: skeletonColor(theme, 0) }),
3119
+ /* @__PURE__ */ jsx4("stop", { offset: "1", stopColor: skeletonColor(theme, 1) })
3073
3120
  ] }) }),
3074
- /* @__PURE__ */ jsx3("polygon", { points: "1,5.25 29,3 29,9 1,6.75", fill: `url(#${id})` })
3121
+ /* @__PURE__ */ jsx4("polygon", { points: "1,5.25 29,3 29,9 1,6.75", fill: `url(#${id})` })
3075
3122
  ] });
3076
3123
  }
3077
3124
  function LegendFrame({ collapsed, children }) {
@@ -3110,7 +3157,7 @@ function LegendFrame({ collapsed, children }) {
3110
3157
  ro.observe(el);
3111
3158
  return () => ro.disconnect();
3112
3159
  }, []);
3113
- return /* @__PURE__ */ jsx3("div", { className: "gb-legend", ref: root, children });
3160
+ return /* @__PURE__ */ jsx4("div", { className: "gb-legend", ref: root, children });
3114
3161
  }
3115
3162
  function Legend(p) {
3116
3163
  const t = useStrings();
@@ -3203,7 +3250,7 @@ function Legend(p) {
3203
3250
  const name = (k) => profile.kindLabels[k] ?? k;
3204
3251
  const colorOfKind = (k) => profile.nodePalette[k] ?? theme.skeleton;
3205
3252
  const shown = (c) => themeColor(theme, c);
3206
- const content = p.collapsed ? /* @__PURE__ */ jsx3(
3253
+ const content = p.collapsed ? /* @__PURE__ */ jsx4(
3207
3254
  "button",
3208
3255
  {
3209
3256
  type: "button",
@@ -3212,20 +3259,20 @@ function Legend(p) {
3212
3259
  "aria-label": t.legend,
3213
3260
  title: t.legend,
3214
3261
  onClick: () => p.onCollapsed(false),
3215
- children: /* @__PURE__ */ jsx3(Icon, { d: I.legend })
3262
+ children: /* @__PURE__ */ jsx4(Icon, { d: I.legend })
3216
3263
  }
3217
- ) : /* @__PURE__ */ jsxs3("div", { className: "gb-lg", ref: rootRef, children: [
3218
- /* @__PURE__ */ jsxs3("div", { className: "gb-lg-body", children: [
3219
- p.caption && /* @__PURE__ */ jsx3("div", { className: "gb-lg-cap", children: p.caption }),
3220
- /* @__PURE__ */ jsxs3("div", { className: "gb-lg-row", children: [
3221
- count.plain > 0 && /* @__PURE__ */ jsx3(
3264
+ ) : /* @__PURE__ */ jsxs4("div", { className: "gb-lg", ref: rootRef, children: [
3265
+ /* @__PURE__ */ jsxs4("div", { className: "gb-lg-body", children: [
3266
+ p.caption && /* @__PURE__ */ jsx4("div", { className: "gb-lg-cap", children: p.caption }),
3267
+ /* @__PURE__ */ jsxs4("div", { className: "gb-lg-row", children: [
3268
+ count.plain > 0 && /* @__PURE__ */ jsx4(
3222
3269
  Item,
3223
3270
  {
3224
3271
  ...slot("n:"),
3225
3272
  color: theme.skeleton,
3226
3273
  onPick: setSkeleton,
3227
3274
  title: t.legendPlain,
3228
- mark: /* @__PURE__ */ jsx3(NodeMark, { color: defaultNodeColor(theme, 0.3), ring: theme.canvas }),
3275
+ mark: /* @__PURE__ */ jsx4(NodeMark, { color: defaultNodeColor(theme, 0.3), ring: theme.canvas }),
3229
3276
  label: t.legendPlainName,
3230
3277
  count: count.plain
3231
3278
  }
@@ -3233,7 +3280,7 @@ function Legend(p) {
3233
3280
  nodeKinds.map((k) => {
3234
3281
  const off = p.hidden.nodes.includes(k);
3235
3282
  const scale = profile.nodeSize[k] ?? 1;
3236
- return /* @__PURE__ */ jsx3(
3283
+ return /* @__PURE__ */ jsx4(
3237
3284
  Item,
3238
3285
  {
3239
3286
  ...slot(`n:${k}`),
@@ -3245,7 +3292,7 @@ function Legend(p) {
3245
3292
  scale,
3246
3293
  glyph: "dot",
3247
3294
  onScale: (s) => set("nodeSize", k, s),
3248
- mark: /* @__PURE__ */ jsx3(NodeMark, { color: shown(colorOfKind(k)), shape: marks.shape(k), ring: theme.canvas, off, scale }),
3295
+ mark: /* @__PURE__ */ jsx4(NodeMark, { color: shown(colorOfKind(k)), shape: marks.shape(k), ring: theme.canvas, off, scale }),
3249
3296
  label: name(k),
3250
3297
  count: count.nodes[k]
3251
3298
  },
@@ -3253,22 +3300,22 @@ function Legend(p) {
3253
3300
  );
3254
3301
  })
3255
3302
  ] }),
3256
- /* @__PURE__ */ jsxs3("div", { className: "gb-lg-row", children: [
3257
- /* @__PURE__ */ jsx3(
3303
+ /* @__PURE__ */ jsxs4("div", { className: "gb-lg-row", children: [
3304
+ /* @__PURE__ */ jsx4(
3258
3305
  Item,
3259
3306
  {
3260
3307
  ...slot("e:"),
3261
3308
  color: theme.skeleton,
3262
3309
  onPick: setSkeleton,
3263
3310
  title: t.legendContains,
3264
- mark: /* @__PURE__ */ jsx3(SkeletonEdge, { theme }),
3311
+ mark: /* @__PURE__ */ jsx4(SkeletonEdge, { theme }),
3265
3312
  label: t.legendContainsName
3266
3313
  }
3267
3314
  ),
3268
3315
  edgeKinds.map((k) => {
3269
3316
  const off = p.hidden.edges.includes(k);
3270
3317
  const scale = profile.edgeWidth[k] ?? 1;
3271
- return /* @__PURE__ */ jsx3(
3318
+ return /* @__PURE__ */ jsx4(
3272
3319
  Item,
3273
3320
  {
3274
3321
  ...slot(`e:${k}`),
@@ -3280,7 +3327,7 @@ function Legend(p) {
3280
3327
  scale,
3281
3328
  glyph: "line",
3282
3329
  onScale: (s) => set("edgeWidth", k, s),
3283
- mark: /* @__PURE__ */ jsx3(EdgeMark, { color: shown(profile.edgePalette[k]), stroke: marks.stroke(k), off, scale }),
3330
+ mark: /* @__PURE__ */ jsx4(EdgeMark, { color: shown(profile.edgePalette[k]), stroke: marks.stroke(k), off, scale }),
3284
3331
  label: name(k),
3285
3332
  count: count.edges[k]
3286
3333
  },
@@ -3289,24 +3336,24 @@ function Legend(p) {
3289
3336
  })
3290
3337
  ] }),
3291
3338
  p.delta && /* Change legend: only a legend, not a filter. Marks match the text on the graph: strikethrough = removed, underline = added. */
3292
- /* @__PURE__ */ jsx3("div", { className: "gb-lg-row gb-lg-diff", children: CHANGE_ORDER.filter((k) => p.delta.counts[k] > 0).map((k) => /* @__PURE__ */ jsxs3("span", { className: `gb-lg-chg${PAST_KINDS.has(k) ? " past" : ""}`, children: [
3293
- /* @__PURE__ */ jsx3("i", { style: { boxShadow: `0 0 0 2px ${DIFF_COLORS[k]}b0, 0 0 0 5px ${DIFF_COLORS[k]}40` } }),
3294
- /* @__PURE__ */ jsx3("span", { style: k === "added" ? { textDecoration: `underline 2px ${DIFF_COLORS[k]}`, textUnderlineOffset: 3 } : PAST_KINDS.has(k) ? { textDecoration: `line-through 2px ${DIFF_COLORS[k]}` } : void 0, children: t.change[k] }),
3295
- /* @__PURE__ */ jsx3("b", { children: p.delta.counts[k] })
3339
+ /* @__PURE__ */ jsx4("div", { className: "gb-lg-row gb-lg-diff", children: CHANGE_ORDER.filter((k) => p.delta.counts[k] > 0).map((k) => /* @__PURE__ */ jsxs4("span", { className: `gb-lg-chg${PAST_KINDS.has(k) ? " past" : ""}`, children: [
3340
+ /* @__PURE__ */ jsx4("i", { style: { boxShadow: `0 0 0 2px ${DIFF_COLORS[k]}b0, 0 0 0 5px ${DIFF_COLORS[k]}40` } }),
3341
+ /* @__PURE__ */ jsx4("span", { style: k === "added" ? { textDecoration: `underline 2px ${DIFF_COLORS[k]}`, textUnderlineOffset: 3 } : PAST_KINDS.has(k) ? { textDecoration: `line-through 2px ${DIFF_COLORS[k]}` } : void 0, children: t.change[k] }),
3342
+ /* @__PURE__ */ jsx4("b", { children: p.delta.counts[k] })
3296
3343
  ] }, k)) }),
3297
- /* @__PURE__ */ jsx3("div", { className: "gb-lg-foot", children: isEmptyLook(look) && !p.hidden.nodes.length && !p.hidden.edges.length ? /* @__PURE__ */ jsx3("span", { children: t.legendHint }) : /* @__PURE__ */ jsx3("button", { type: "button", onClick: () => {
3344
+ /* @__PURE__ */ jsx4("div", { className: "gb-lg-foot", children: isEmptyLook(look) && !p.hidden.nodes.length && !p.hidden.edges.length ? /* @__PURE__ */ jsx4("span", { children: t.legendHint }) : /* @__PURE__ */ jsx4("button", { type: "button", onClick: () => {
3298
3345
  onLook({});
3299
3346
  p.onShowAll();
3300
3347
  }, children: t.legendReset }) })
3301
3348
  ] }),
3302
- /* @__PURE__ */ jsx3("span", { className: "gb-lg-act", children: /* @__PURE__ */ jsx3("button", { type: "button", className: "gb-lg-btn", onClick: () => p.onCollapsed(true), "aria-expanded": true, "aria-label": t.legend, title: t.legend, children: /* @__PURE__ */ jsx3(Icon, { d: I.collapse, size: 13 }) }) })
3349
+ /* @__PURE__ */ jsx4("span", { className: "gb-lg-act", children: /* @__PURE__ */ jsx4("button", { type: "button", className: "gb-lg-btn", onClick: () => p.onCollapsed(true), "aria-expanded": true, "aria-label": t.legend, title: t.legend, children: /* @__PURE__ */ jsx4(Icon, { d: I.collapse, size: 13 }) }) })
3303
3350
  ] });
3304
- return /* @__PURE__ */ jsx3(LegendFrame, { collapsed: p.collapsed, children: content });
3351
+ return /* @__PURE__ */ jsx4(LegendFrame, { collapsed: p.collapsed, children: content });
3305
3352
  }
3306
3353
 
3307
3354
  // src/react/DiffOverlay.tsx
3308
3355
  import { useMemo as useMemo4 } from "react";
3309
- import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
3356
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
3310
3357
  var DEFAULT_MAX = 600;
3311
3358
  var PAD2 = 4;
3312
3359
  var GLOW_PASSES = [[26, 0.05], [15, 0.13], [6, 0.55]];
@@ -3383,11 +3430,11 @@ function DiffOverlay(p) {
3383
3430
  const t = `translate(${viewport.pan.x},${viewport.pan.y}) scale(${viewport.zoom})`;
3384
3431
  const inv = 1 / Math.max(viewport.zoom, 0.02);
3385
3432
  const dash = { strokeDasharray: `${5 * inv} ${4 * inv}` };
3386
- return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3387
- /* @__PURE__ */ jsx4("svg", { className: "gb-diff-under", "aria-hidden": true, children: /* @__PURE__ */ jsxs4("g", { transform: t, children: [
3388
- INKS.map((ink) => /* @__PURE__ */ jsxs4("g", { className: `gb-glow gb-glow-${ink}`, children: [
3389
- edgeGlow[ink] && GLOW_EDGE_PASSES.map(([w, o]) => /* @__PURE__ */ jsx4("path", { d: edgeGlow[ink], strokeWidth: w * inv, strokeOpacity: o }, `e${w}`)),
3390
- nodeGlow.map((lv, i) => lv[ink] && GLOW_PASSES.map(([w, o]) => /* @__PURE__ */ jsx4(
3433
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
3434
+ /* @__PURE__ */ jsx5("svg", { className: "gb-diff-under", "aria-hidden": true, children: /* @__PURE__ */ jsxs5("g", { transform: t, children: [
3435
+ INKS.map((ink) => /* @__PURE__ */ jsxs5("g", { className: `gb-glow gb-glow-${ink}`, children: [
3436
+ edgeGlow[ink] && GLOW_EDGE_PASSES.map(([w, o]) => /* @__PURE__ */ jsx5("path", { d: edgeGlow[ink], strokeWidth: w * inv, strokeOpacity: o }, `e${w}`)),
3437
+ nodeGlow.map((lv, i) => lv[ink] && GLOW_PASSES.map(([w, o]) => /* @__PURE__ */ jsx5(
3391
3438
  "path",
3392
3439
  {
3393
3440
  d: lv[ink],
@@ -3397,14 +3444,14 @@ function DiffOverlay(p) {
3397
3444
  `n${i}-${w}`
3398
3445
  )))
3399
3446
  ] }, ink)),
3400
- wireD && /* @__PURE__ */ jsx4("path", { className: "gb-pastwire", d: wireD, strokeWidth: 2 * inv, style: dash })
3447
+ wireD && /* @__PURE__ */ jsx5("path", { className: "gb-pastwire", d: wireD, strokeWidth: 2 * inv, style: dash })
3401
3448
  ] }) }),
3402
- truncated > 0 && /* @__PURE__ */ jsx4("div", { className: "gb-diff-trunc", children: str.diffTruncated(truncated) })
3449
+ truncated > 0 && /* @__PURE__ */ jsx5("div", { className: "gb-diff-trunc", children: str.diffTruncated(truncated) })
3403
3450
  ] });
3404
3451
  }
3405
3452
 
3406
3453
  // src/react/GraphCanvas.tsx
3407
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
3454
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
3408
3455
  var TIGHTEN_MAX = 400;
3409
3456
  var NODE_PITCH = 150;
3410
3457
  var SEED_MAX = 60;
@@ -3746,7 +3793,7 @@ function Drawer({ children }) {
3746
3793
  }, [open]);
3747
3794
  const content = children || (gone ? null : last.current);
3748
3795
  if (!content) return null;
3749
- return /* @__PURE__ */ jsx5("div", { className: `gb-drawer${open ? "" : " is-closing"}`, children: content });
3796
+ return /* @__PURE__ */ jsx6("div", { className: `gb-drawer${open ? "" : " is-closing"}`, children: content });
3750
3797
  }
3751
3798
  var DRAWER_MS = 200;
3752
3799
  function GraphCanvas(props) {
@@ -3926,7 +3973,7 @@ function GraphCanvas(props) {
3926
3973
  () => pastRenderModel ? buildElements(pastRenderModel, profile, { past: true }) : null,
3927
3974
  [pastRenderModel, profile]
3928
3975
  );
3929
- const issues = useMemo5(() => validateModel(model, profile), [model, profile]);
3976
+ const issues = useMemo5(() => props.issues ?? validateModel(editingModel, profile), [props.issues, editingModel, profile]);
3930
3977
  const onIssuesRef = useRef4(onIssues);
3931
3978
  onIssuesRef.current = onIssues;
3932
3979
  useEffect4(() => {
@@ -5538,6 +5585,21 @@ ${lt}`;
5538
5585
  setView({ query: "" });
5539
5586
  }, [applyHover, flyTo, selectEle, setView]);
5540
5587
  pickRef.current = pick;
5588
+ const [pendingIssue, setPendingIssue] = useState5(null);
5589
+ const pickIssue = useCallback2((id) => {
5590
+ if (!model.index.has(id) && editingModel.index.has(id)) {
5591
+ setPendingIssue(id);
5592
+ setView({ planes: false });
5593
+ } else pick(id);
5594
+ }, [model, editingModel, pick, setView]);
5595
+ useEffect4(() => {
5596
+ if (!pendingIssue || !model.index.has(pendingIssue)) return;
5597
+ const frame = requestAnimationFrame(() => {
5598
+ pickRef.current(pendingIssue);
5599
+ setPendingIssue(null);
5600
+ });
5601
+ return () => cancelAnimationFrame(frame);
5602
+ }, [model, pendingIssue]);
5541
5603
  useEffect4(() => {
5542
5604
  if (diff) return;
5543
5605
  setSelected((s) => {
@@ -5574,7 +5636,7 @@ ${lt}`;
5574
5636
  const startAdd = useCallback2((what) => {
5575
5637
  setEditing(what === "node" ? { what, parent: selected?.id ?? null } : { what, source: selected?.id });
5576
5638
  }, [selected]);
5577
- const editPanel = editing && /* @__PURE__ */ jsx5(
5639
+ const editPanel = editing && /* @__PURE__ */ jsx6(
5578
5640
  EditPanel,
5579
5641
  {
5580
5642
  target: editing,
@@ -5612,10 +5674,10 @@ ${lt}`;
5612
5674
  return () => window.removeEventListener("keydown", onKey);
5613
5675
  }, [compact, zoomBy, fit]);
5614
5676
  if (model.nodes.length === 0 && model.errors.length === 0) {
5615
- return /* @__PURE__ */ jsx5(StringsContext.Provider, { value: strings, children: /* @__PURE__ */ jsxs5("div", { className: `gb-root ${className ?? ""}`, style: rootStyle, children: [
5616
- /* @__PURE__ */ jsxs5("div", { className: "gb-empty", children: [
5617
- /* @__PURE__ */ jsx5("div", { children: emptyMessage ?? strings.empty }),
5618
- editable && !editing && /* @__PURE__ */ jsx5("button", { className: "gb-link", onClick: () => startAdd("node"), children: strings.addNode })
5677
+ return /* @__PURE__ */ jsx6(StringsContext.Provider, { value: strings, children: /* @__PURE__ */ jsxs6("div", { className: `gb-root ${className ?? ""}`, style: rootStyle, children: [
5678
+ /* @__PURE__ */ jsxs6("div", { className: "gb-empty", children: [
5679
+ /* @__PURE__ */ jsx6("div", { children: emptyMessage ?? strings.empty }),
5680
+ editable && !editing && /* @__PURE__ */ jsx6("button", { className: "gb-link", onClick: () => startAdd("node"), children: strings.addNode })
5619
5681
  ] }),
5620
5682
  editPanel
5621
5683
  ] }) });
@@ -5623,91 +5685,79 @@ ${lt}`;
5623
5685
  const filtering = isFiltering(view);
5624
5686
  const panes = !!diff;
5625
5687
  const platesOn = !panes && plates.length > 0 && plateAlpha > 0.01;
5626
- return /* @__PURE__ */ jsx5(StringsContext.Provider, { value: strings, children: /* @__PURE__ */ jsxs5("div", { className: `gb-root ${className ?? ""}`, style: rootStyle, children: [
5627
- /* @__PURE__ */ jsxs5("div", { className: "gb-stage", ref: stageRef, style: { background: theme.canvas }, children: [
5628
- platesOn && /* @__PURE__ */ jsx5("svg", { className: "gb-planes", style: { opacity: plateAlpha }, children: /* @__PURE__ */ jsx5("g", { transform: `translate(${viewport.pan.x},${viewport.pan.y}) scale(${viewport.zoom})`, children: plates.map((p) => {
5629
- const c = plateColors(theme, p.color);
5630
- return /* @__PURE__ */ jsx5(
5631
- "polygon",
5688
+ return /* @__PURE__ */ jsx6(StringsContext.Provider, { value: strings, children: /* @__PURE__ */ jsxs6("div", { className: `gb-root ${className ?? ""}`, style: rootStyle, children: [
5689
+ /* @__PURE__ */ jsxs6("div", { className: "gb-stage", ref: stageRef, style: { background: theme.canvas }, children: [
5690
+ /* @__PURE__ */ jsxs6("div", { className: "gb-scene", children: [
5691
+ platesOn && /* @__PURE__ */ jsx6(GlassPlanes, { plates, viewport, theme, alpha: plateAlpha, hot: hotLayer }),
5692
+ panes ? (
5693
+ /* Left = before, right = now, sharing one set of coordinates and one viewport: "unchanged things are the same
5694
+ screen pixel in both columns" is the whole value of two columns. */
5695
+ /* @__PURE__ */ jsxs6("div", { className: "gb-panes", children: [
5696
+ /* @__PURE__ */ jsxs6("div", { className: "gb-pane", children: [
5697
+ !prog && /* @__PURE__ */ jsx6(
5698
+ DiffOverlay,
5699
+ {
5700
+ delta: diff,
5701
+ geom: pastGeom,
5702
+ viewport,
5703
+ only: diffOnly,
5704
+ side: "past",
5705
+ visible: filtering ? resolved.visible : null
5706
+ }
5707
+ ),
5708
+ /* @__PURE__ */ jsx6("div", { ref: mirrorElRef, className: "gb-canvas" }),
5709
+ /* @__PURE__ */ jsx6("canvas", { ref: mirrorCanvasRef, className: "gb-labels" }),
5710
+ /* @__PURE__ */ jsxs6("div", { className: "gb-pane-tag", children: [
5711
+ diff.labels.before,
5712
+ " \xB7 ",
5713
+ strings.past
5714
+ ] })
5715
+ ] }),
5716
+ /* @__PURE__ */ jsxs6("div", { className: "gb-pane", children: [
5717
+ !prog && /* @__PURE__ */ jsx6(
5718
+ DiffOverlay,
5719
+ {
5720
+ delta: diff,
5721
+ geom: diffGeom,
5722
+ viewport,
5723
+ only: diffOnly,
5724
+ side: "now",
5725
+ visible: filtering ? resolved.visible : null
5726
+ }
5727
+ ),
5728
+ /* @__PURE__ */ jsx6("div", { ref: containerRef, className: "gb-canvas" }),
5729
+ /* @__PURE__ */ jsx6("canvas", { ref: labelCanvasRef, className: "gb-labels" }),
5730
+ /* @__PURE__ */ jsxs6("div", { className: "gb-pane-tag gb-pane-now", children: [
5731
+ diff.labels.after,
5732
+ " \xB7 ",
5733
+ strings.now
5734
+ ] })
5735
+ ] }),
5736
+ /* @__PURE__ */ jsx6("div", { className: "gb-flow", "aria-hidden": true, children: /* @__PURE__ */ jsx6("svg", { viewBox: "-32 -25 64 50", children: /* @__PURE__ */ jsx6("path", { d: "M-31.84,-12.16 H7.52 V-24.32 L31.84,0 L7.52,24.32 V12.16 H-31.84 Z", fill: theme.canvas }) }) })
5737
+ ] }, "panes")
5738
+ ) : /* @__PURE__ */ jsx6("div", { ref: containerRef, className: "gb-canvas" }, "solo"),
5739
+ !panes && /* @__PURE__ */ jsx6("canvas", { ref: labelCanvasRef, className: "gb-labels" }),
5740
+ platesOn && /* @__PURE__ */ jsx6("svg", { className: "gb-plane-labels", style: { opacity: plateAlpha }, children: /* @__PURE__ */ jsx6("g", { transform: `translate(${viewport.pan.x},${viewport.pan.y}) scale(${viewport.zoom})`, children: plates.map((p) => /* @__PURE__ */ jsx6(
5741
+ "text",
5632
5742
  {
5633
- opacity: (p.alpha ?? 1) * (hotLayer && hotLayer !== p.layer ? 0.45 : 1),
5634
- points: p.points.map(([x, y]) => `${x},${y}`).join(" "),
5635
- fill: p.color,
5636
- fillOpacity: hotLayer === p.layer ? 0.16 : 0.07,
5637
- stroke: c.stroke,
5638
- strokeWidth: (hotLayer === p.layer ? 3 : 2) / viewport.zoom
5743
+ opacity: p.alpha ?? 1,
5744
+ x: p.anchor[0],
5745
+ y: p.anchor[1],
5746
+ fontSize: 22 / viewport.zoom,
5747
+ fill: plateColors(theme, p.color).text,
5748
+ fontWeight: 700,
5749
+ stroke: theme.canvas,
5750
+ strokeWidth: 4 / viewport.zoom,
5751
+ paintOrder: "stroke",
5752
+ style: { userSelect: "none", pointerEvents: "auto", cursor: "default" },
5753
+ onMouseEnter: () => hoverLayer(p.layer),
5754
+ onMouseLeave: () => hoverLayer(null),
5755
+ children: p.label
5639
5756
  },
5640
5757
  p.layer
5641
- );
5642
- }) }) }),
5643
- panes ? (
5644
- /* Left = before, right = now, sharing one set of coordinates and one viewport: "unchanged things are the same
5645
- screen pixel in both columns" is the whole value of two columns. */
5646
- /* @__PURE__ */ jsxs5("div", { className: "gb-panes", children: [
5647
- /* @__PURE__ */ jsxs5("div", { className: "gb-pane", children: [
5648
- !prog && /* @__PURE__ */ jsx5(
5649
- DiffOverlay,
5650
- {
5651
- delta: diff,
5652
- geom: pastGeom,
5653
- viewport,
5654
- only: diffOnly,
5655
- side: "past",
5656
- visible: filtering ? resolved.visible : null
5657
- }
5658
- ),
5659
- /* @__PURE__ */ jsx5("div", { ref: mirrorElRef, className: "gb-canvas" }),
5660
- /* @__PURE__ */ jsx5("canvas", { ref: mirrorCanvasRef, className: "gb-labels" }),
5661
- /* @__PURE__ */ jsxs5("div", { className: "gb-pane-tag", children: [
5662
- diff.labels.before,
5663
- " \xB7 ",
5664
- strings.past
5665
- ] })
5666
- ] }),
5667
- /* @__PURE__ */ jsxs5("div", { className: "gb-pane", children: [
5668
- !prog && /* @__PURE__ */ jsx5(
5669
- DiffOverlay,
5670
- {
5671
- delta: diff,
5672
- geom: diffGeom,
5673
- viewport,
5674
- only: diffOnly,
5675
- side: "now",
5676
- visible: filtering ? resolved.visible : null
5677
- }
5678
- ),
5679
- /* @__PURE__ */ jsx5("div", { ref: containerRef, className: "gb-canvas" }),
5680
- /* @__PURE__ */ jsx5("canvas", { ref: labelCanvasRef, className: "gb-labels" }),
5681
- /* @__PURE__ */ jsxs5("div", { className: "gb-pane-tag gb-pane-now", children: [
5682
- diff.labels.after,
5683
- " \xB7 ",
5684
- strings.now
5685
- ] })
5686
- ] }),
5687
- /* @__PURE__ */ jsx5("div", { className: "gb-flow", "aria-hidden": true, children: /* @__PURE__ */ jsx5("svg", { viewBox: "-32 -25 64 50", children: /* @__PURE__ */ jsx5("path", { d: "M-31.84,-12.16 H7.52 V-24.32 L31.84,0 L7.52,24.32 V12.16 H-31.84 Z", fill: theme.canvas }) }) })
5688
- ] }, "panes")
5689
- ) : /* @__PURE__ */ jsx5("div", { ref: containerRef, className: "gb-canvas" }, "solo"),
5690
- !panes && /* @__PURE__ */ jsx5("canvas", { ref: labelCanvasRef, className: "gb-labels" }),
5691
- platesOn && /* @__PURE__ */ jsx5("svg", { className: "gb-plane-labels", style: { opacity: plateAlpha }, children: /* @__PURE__ */ jsx5("g", { transform: `translate(${viewport.pan.x},${viewport.pan.y}) scale(${viewport.zoom})`, children: plates.map((p) => /* @__PURE__ */ jsx5(
5692
- "text",
5693
- {
5694
- opacity: p.alpha ?? 1,
5695
- x: p.anchor[0],
5696
- y: p.anchor[1],
5697
- fontSize: 22 / viewport.zoom,
5698
- fill: plateColors(theme, p.color).text,
5699
- fontWeight: 700,
5700
- stroke: theme.canvas,
5701
- strokeWidth: 4 / viewport.zoom,
5702
- paintOrder: "stroke",
5703
- style: { userSelect: "none", pointerEvents: "auto", cursor: "default" },
5704
- onMouseEnter: () => hoverLayer(p.layer),
5705
- onMouseLeave: () => hoverLayer(null),
5706
- children: p.label
5707
- },
5708
- p.layer
5709
- )) }) }),
5710
- !compact && /* @__PURE__ */ jsx5(
5758
+ )) }) })
5759
+ ] }),
5760
+ !compact && /* @__PURE__ */ jsx6(
5711
5761
  Toolbar,
5712
5762
  {
5713
5763
  view,
@@ -5730,58 +5780,60 @@ ${lt}`;
5730
5780
  onForceLayers
5731
5781
  }
5732
5782
  ),
5733
- (note || model.errors.length > 0 || legend && !compact) && /* Bottom left: the host's caption (if any) on top, the legend below. Top left is tools, bottom right is the camera. */
5734
- /* @__PURE__ */ jsxs5("div", { className: "gb-bl", children: [
5735
- (note && !(legend && !compact) || model.errors.length > 0) && /* @__PURE__ */ jsxs5("div", { className: "gb-note", children: [
5736
- !(legend && !compact) && note,
5737
- model.errors.length > 0 && // The names must appear on this line. Reporting only a number, "16 sources could not be parsed" sends people back to
5738
- // try the files one by one, while locating them only takes printing the origin. The full list is in title.
5739
- /* @__PURE__ */ jsx5("span", { className: "gb-warn", title: model.errors.map((e) => `${e.origin}: ${e.message}`).join("\n"), children: strings.parseErrors(
5740
- model.errors.length,
5741
- model.errors.slice(0, 2).map((e) => e.origin).join(", ") + (model.errors.length > 2 ? ", \u2026" : "")
5742
- ) })
5783
+ /* @__PURE__ */ jsxs6("div", { className: "gb-footer", children: [
5784
+ (note || model.errors.length > 0 || legend && !compact) && /* Bottom left: the host's caption (if any) on top, the legend below. Top left is tools, bottom right is the camera. */
5785
+ /* @__PURE__ */ jsxs6("div", { className: "gb-bl", children: [
5786
+ (note && !(legend && !compact) || model.errors.length > 0) && /* @__PURE__ */ jsxs6("div", { className: "gb-note", children: [
5787
+ !(legend && !compact) && note,
5788
+ model.errors.length > 0 && // The names must appear on this line. Reporting only a number, "16 sources could not be parsed" sends people back to
5789
+ // try the files one by one, while locating them only takes printing the origin. The full list is in title.
5790
+ /* @__PURE__ */ jsx6("span", { className: "gb-warn", title: model.errors.map((e) => `${e.origin}: ${e.message}`).join("\n"), children: strings.parseErrors(
5791
+ model.errors.length,
5792
+ model.errors.slice(0, 2).map((e) => e.origin).join(", ") + (model.errors.length > 2 ? ", \u2026" : "")
5793
+ ) })
5794
+ ] }),
5795
+ legend && !compact && /* @__PURE__ */ jsx6(
5796
+ Legend,
5797
+ {
5798
+ model,
5799
+ profile: lookProfile,
5800
+ theme,
5801
+ look,
5802
+ onLook: setLook,
5803
+ cy: liveCy,
5804
+ delta: diff,
5805
+ hidden: { nodes: view.hiddenNodeKinds ?? [], edges: view.hiddenEdgeKinds ?? [] },
5806
+ onToggle: (which, kind) => {
5807
+ const key = which === "nodes" ? "hiddenNodeKinds" : "hiddenEdgeKinds";
5808
+ const cur = view[key] ?? [];
5809
+ setView({ [key]: cur.includes(kind) ? cur.filter((x) => x !== kind) : [...cur, kind] });
5810
+ },
5811
+ onEmphasis: setLegendEmphasis,
5812
+ onShowAll: () => setView({ hiddenNodeKinds: [], hiddenEdgeKinds: [] }),
5813
+ collapsed: legendCollapsed,
5814
+ onCollapsed: setLegendCollapsed,
5815
+ caption: note
5816
+ }
5817
+ )
5743
5818
  ] }),
5744
- legend && !compact && /* @__PURE__ */ jsx5(
5745
- Legend,
5819
+ !compact && /* @__PURE__ */ jsx6(
5820
+ ZoomDock,
5746
5821
  {
5747
- model,
5748
- profile: lookProfile,
5749
- theme,
5750
- look,
5751
- onLook: setLook,
5752
- cy: liveCy,
5753
- delta: diff,
5754
- hidden: { nodes: view.hiddenNodeKinds ?? [], edges: view.hiddenEdgeKinds ?? [] },
5755
- onToggle: (which, kind) => {
5756
- const key = which === "nodes" ? "hiddenNodeKinds" : "hiddenEdgeKinds";
5757
- const cur = view[key] ?? [];
5758
- setView({ [key]: cur.includes(kind) ? cur.filter((x) => x !== kind) : [...cur, kind] });
5759
- },
5760
- onEmphasis: setLegendEmphasis,
5761
- onShowAll: () => setView({ hiddenNodeKinds: [], hiddenEdgeKinds: [] }),
5762
- collapsed: legendCollapsed,
5763
- onCollapsed: setLegendCollapsed,
5764
- caption: note
5822
+ zoom: controls.zoom,
5823
+ onZoom: zoomBy,
5824
+ onFit: fit,
5825
+ issues: showIssues ? issues : [],
5826
+ onPick: pickIssue
5765
5827
  }
5766
5828
  )
5767
5829
  ] }),
5768
- !compact && /* @__PURE__ */ jsx5(
5769
- ZoomDock,
5770
- {
5771
- zoom: controls.zoom,
5772
- onZoom: zoomBy,
5773
- onFit: fit,
5774
- issues: showIssues ? issues : [],
5775
- onPick: pick
5776
- }
5777
- ),
5778
- prog && /* @__PURE__ */ jsx5("div", { className: "gb-mask", children: /* @__PURE__ */ jsxs5("div", { children: [
5779
- /* @__PURE__ */ jsx5("span", { className: "gb-spin" }),
5830
+ prog && /* @__PURE__ */ jsx6("div", { className: "gb-mask", children: /* @__PURE__ */ jsxs6("div", { children: [
5831
+ /* @__PURE__ */ jsx6("span", { className: "gb-spin" }),
5780
5832
  prog.total > 0 ? strings.layingOut(prog.done, prog.total) : strings.preparing
5781
5833
  ] }) }),
5782
- compact && /* @__PURE__ */ jsx5("div", { style: { position: "absolute", bottom: 4, left: 8, fontSize: 10.5, opacity: 0.6, pointerEvents: "none" }, children: strings.stats(stats.nodes, stats.edges) })
5834
+ compact && /* @__PURE__ */ jsx6("div", { style: { position: "absolute", bottom: 4, left: 8, fontSize: 10.5, opacity: 0.6, pointerEvents: "none" }, children: strings.stats(stats.nodes, stats.edges) })
5783
5835
  ] }),
5784
- /* @__PURE__ */ jsx5(Drawer, { children: editPanel || (detailPanel && selected ? /* @__PURE__ */ jsx5(
5836
+ /* @__PURE__ */ jsx6(Drawer, { children: editPanel || (detailPanel && selected ? /* @__PURE__ */ jsx6(
5785
5837
  DetailPanel,
5786
5838
  {
5787
5839
  node: selected,