@graphty/graphty-element 2.4.0 → 2.4.1

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 (46) hide show
  1. package/dist/ai.js +3 -3
  2. package/dist/catalog.js +6 -6
  3. package/dist/chunks/{AiManager-BD9XK30e.js → AiManager-DNJCoeTO.js} +5 -5
  4. package/dist/chunks/{DataSource-B8vf2uhW.js → DataSource-xL3Yn0Pa.js} +72 -61
  5. package/dist/chunks/{GraphSession-dcwOjGJh.js → GraphSession-PFm2tJ_j.js} +1483 -1441
  6. package/dist/chunks/{GraphtyLogger-CqOVV13Y.js → GraphtyLogger-kbOx2zq3.js} +169 -221
  7. package/dist/chunks/{VoiceInputAdapter-D0tHHi9G.js → VoiceInputAdapter-CDNKQgUK.js} +1 -1
  8. package/dist/chunks/{XRPivotCameraController-DTfhvhHz.js → XRPivotCameraController-JdlLBcD7.js} +146 -134
  9. package/dist/chunks/{algorithms-BF0X6RPw.js → algorithms-B87OPYw4.js} +2 -2
  10. package/dist/chunks/{capability-check-BJzlK4oL.js → capability-check-B2oYf_30.js} +1 -1
  11. package/dist/chunks/{detect-vJxK7n0D.js → detect-tuYQLJbT.js} +2 -2
  12. package/dist/chunks/{format-detection-C80TLQ2e.js → format-detection-BG6CMwPO.js} +1 -1
  13. package/dist/chunks/{index-2xkq7wyD.js → index-6GDfNfwJ.js} +2928 -2856
  14. package/dist/chunks/{optionsFromZod-BuTOFgVM.js → optionsFromZod-DHLLiX_8.js} +237 -236
  15. package/dist/chunks/{paletteRegistry-A63C71Gn.js → paletteRegistry-jg9uS7wo.js} +66 -66
  16. package/dist/chunks/pluginRegistry-MaTIDh6l.js +238 -0
  17. package/dist/chunks/{registry-jB46Gmeb.js → registry-DQeq4B2K.js} +8 -8
  18. package/dist/chunks/{scales-B2d-7Bf0.js → scales-BXHmwPXC.js} +4 -4
  19. package/dist/extend.js +7 -7
  20. package/dist/graphty-catalog.json +1 -1
  21. package/dist/graphty.bundle.js +25128 -24837
  22. package/dist/graphty.js +67 -63
  23. package/dist/index.d.ts +3 -0
  24. package/dist/logging.js +2 -2
  25. package/dist/session.js +5 -5
  26. package/dist/src/Edge.d.ts +4 -4
  27. package/dist/src/acceleration/AccelerationController.d.ts +6 -0
  28. package/dist/src/acceleration/registry.d.ts +3 -0
  29. package/dist/src/acceleration/types.d.ts +7 -0
  30. package/dist/src/algorithms/Algorithm.d.ts +13 -0
  31. package/dist/src/cameras/InputUtils.d.ts +67 -0
  32. package/dist/src/cameras/XRInputHandler.d.ts +0 -8
  33. package/dist/src/catalog/pluginRegistry.d.ts +62 -0
  34. package/dist/src/catalog/registry.d.ts +7 -0
  35. package/dist/src/data/DataSource.d.ts +1 -1
  36. package/dist/src/errors/codes.d.ts +2 -1
  37. package/dist/src/meshes/CustomLineRenderer.d.ts +11 -9
  38. package/dist/src/meshes/EdgeMesh.d.ts +18 -9
  39. package/dist/src/meshes/FilledArrowRenderer.d.ts +61 -23
  40. package/dist/src/meshes/PatternedLineRenderer.d.ts +5 -37
  41. package/dist/src/meshes/PerSceneMaterials.d.ts +49 -0
  42. package/dist/src/xr/XRSessionManager.d.ts +1 -1
  43. package/dist/webgpu.d.ts +8 -0
  44. package/dist/webgpu.js +2 -2
  45. package/package.json +6 -6
  46. package/dist/chunks/GraphtyError-B93WRH3e.js +0 -134
@@ -1,9 +1,9 @@
1
- import { q as b, G as F } from "./GraphtyLogger-CqOVV13Y.js";
1
+ import { c as b, G as g, S as F } from "./pluginRegistry-MaTIDh6l.js";
2
2
  import { a as T, b as D, d as k } from "./types-C_c53VgR.js";
3
3
  import { remapArray as S, INVALID_INDEX as N } from "@graphty/graph-format";
4
4
  import { z as O } from "zod/v4";
5
- import { G as g } from "./GraphtyError-B93WRH3e.js";
6
- import { c as v } from "./common-DWNKjpH_.js";
5
+ import { G as v } from "./GraphtyLogger-kbOx2zq3.js";
6
+ import { c as L } from "./common-DWNKjpH_.js";
7
7
  const f = b({
8
8
  kind: "format",
9
9
  idOf: (i) => i.descriptor.id,
@@ -11,22 +11,22 @@ const f = b({
11
11
  implementationOf: (i) => i.descriptor,
12
12
  builtInIds: () => T
13
13
  });
14
- function it(i, t) {
14
+ function st(i, t) {
15
15
  f.register(i, t);
16
16
  }
17
- function st() {
17
+ function rt() {
18
18
  return f.entries();
19
19
  }
20
- function L() {
20
+ function $() {
21
21
  return f.descriptors();
22
22
  }
23
- function $(i) {
23
+ function M(i) {
24
24
  return f.byId(i);
25
25
  }
26
- function rt() {
26
+ function nt() {
27
27
  f.clearForTesting();
28
28
  }
29
- const M = {
29
+ const R = {
30
30
  "edge-list": "Edge List",
31
31
  "node-list": "Node List",
32
32
  "adjacency-list": "Adjacency List",
@@ -34,7 +34,7 @@ const M = {
34
34
  gephi: "Gephi Export",
35
35
  cytoscape: "Cytoscape Export",
36
36
  generic: "Generic"
37
- }, R = [
37
+ }, j = [
38
38
  {
39
39
  name: "delimiter",
40
40
  plainName: "Column Separator",
@@ -47,7 +47,7 @@ const M = {
47
47
  plainName: "File Shape",
48
48
  technicalName: "variant",
49
49
  type: "enum",
50
- values: Object.entries(M).map(([i, t]) => ({ value: i, label: t })),
50
+ values: Object.entries(R).map(([i, t]) => ({ value: i, label: t })),
51
51
  description: "Which CSV shape to read. Worked out from the header row when it is not set."
52
52
  },
53
53
  {
@@ -72,7 +72,7 @@ const M = {
72
72
  type: "string",
73
73
  description: "Where to find the node an edge ends at. Left unset, the element looks for target, then dst, then to."
74
74
  }
75
- ], j = [
75
+ ], z = [
76
76
  {
77
77
  name: "nodeIdPath",
78
78
  plainName: "Node Id Field",
@@ -88,7 +88,7 @@ const M = {
88
88
  mimeTypes: ["application/json"],
89
89
  canImport: !0,
90
90
  canExport: !1,
91
- options: [...j, ...h]
91
+ options: [...z, ...h]
92
92
  },
93
93
  {
94
94
  id: "csv",
@@ -97,7 +97,7 @@ const M = {
97
97
  mimeTypes: ["text/csv", "text/tab-separated-values", "text/plain"],
98
98
  canImport: !0,
99
99
  canExport: !1,
100
- options: [...R, ...h]
100
+ options: [...j, ...h]
101
101
  },
102
102
  {
103
103
  id: "graphml",
@@ -149,16 +149,16 @@ const M = {
149
149
  canExport: !1,
150
150
  options: h
151
151
  }
152
- ], nt = [
152
+ ], ot = [
153
153
  { id: "sif", reason: "No data source reads the Cytoscape simple interaction format." },
154
154
  { id: "cx2", reason: "No data source reads the Cytoscape Exchange format." }
155
155
  ];
156
- function ot(i) {
157
- return _.find((t) => t.id === i) ?? $(i)?.descriptor;
158
- }
159
156
  function at(i) {
157
+ return _.find((t) => t.id === i) ?? M(i)?.descriptor;
158
+ }
159
+ function lt(i) {
160
160
  const t = i.toLowerCase();
161
- return [..._, ...L()].filter(
161
+ return [..._, ...$()].filter(
162
162
  (e) => e.extensions.includes(t)
163
163
  );
164
164
  }
@@ -169,19 +169,19 @@ const m = b({
169
169
  implementationOf: (i) => i.descriptor,
170
170
  builtInIds: () => D
171
171
  });
172
- function z(i, t) {
172
+ function B(i, t) {
173
173
  m.register(i, t);
174
174
  }
175
- function lt() {
175
+ function ct() {
176
176
  return m.descriptors();
177
177
  }
178
- function ct(i) {
178
+ function ht(i) {
179
179
  return m.byId(i);
180
180
  }
181
- function ht() {
181
+ function dt() {
182
182
  m.clearForTesting();
183
183
  }
184
- const o = 3, B = 1024;
184
+ const o = 3, C = 1024;
185
185
  function p(i, t) {
186
186
  if (!Number.isInteger(i) || i < 0)
187
187
  throw new RangeError(`ElementPositions: ${t} must be a non-negative integer, found ${String(i)}`);
@@ -195,7 +195,7 @@ class x {
195
195
  * Allocate the backing array, every row unplaced and unpinned.
196
196
  * @param capacity - rows to reserve before the first growth; a non-negative integer
197
197
  */
198
- constructor(t = B) {
198
+ constructor(t = C) {
199
199
  this.components = o, this.rows = 0, p(t, "capacity");
200
200
  const e = Math.max(1, t);
201
201
  this.array = new Float32Array(o * e), this.array.fill(Number.NaN), this.pins = new Uint8Array(e);
@@ -445,7 +445,7 @@ class x {
445
445
  return o * t;
446
446
  }
447
447
  }
448
- const l = /* @__PURE__ */ new Map(), C = Object.freeze([
448
+ const l = new F("layout"), W = Object.freeze([
449
449
  "arf",
450
450
  "bfs",
451
451
  "bipartite",
@@ -465,11 +465,11 @@ const l = /* @__PURE__ */ new Map(), C = Object.freeze([
465
465
  "spiral",
466
466
  "spring",
467
467
  "spring-electrical"
468
- ]), W = F.getLogger(["graphty", "layout"]), P = 1e-6;
469
- function G(i, t) {
468
+ ]), G = v.getLogger(["graphty", "layout"]), P = 1e-6;
469
+ function U(i, t) {
470
470
  return JSON.stringify([i, t]);
471
471
  }
472
- const U = 10;
472
+ const V = 10;
473
473
  function A(i) {
474
474
  return new g({
475
475
  code: "E_DUPLICATE_PLUGIN",
@@ -528,7 +528,7 @@ const E = class E {
528
528
  * @param _nodes - the nodes that have just arrived
529
529
  */
530
530
  updatePositions(t) {
531
- for (let e = 0; e < U; e++) {
531
+ for (let e = 0; e < V; e++) {
532
532
  if (this.isSettled)
533
533
  return;
534
534
  this.step();
@@ -684,7 +684,7 @@ const E = class E {
684
684
  for (const a of t) {
685
685
  const c = a.index >= 0 && a.index < s.length ? s[a.index] : 1;
686
686
  c !== 1 && (n = !0);
687
- const I = G(a.srcId, a.dstId);
687
+ const I = U(a.srcId, a.dstId);
688
688
  r.set(I, (r.get(I) ?? 0) + c);
689
689
  }
690
690
  return n ? r : null;
@@ -705,7 +705,7 @@ const E = class E {
705
705
  let s = 0;
706
706
  for (const r of e.values())
707
707
  r < P && s++;
708
- s > 0 && W.warn("Edge weights at or below zero were clamped before the layout read them", {
708
+ s > 0 && G.warn("Edge weights at or below zero were clamped before the layout read them", {
709
709
  layout: t,
710
710
  clamped: s,
711
711
  epsilon: P
@@ -766,7 +766,7 @@ const E = class E {
766
766
  });
767
767
  if (l.get(s) === t)
768
768
  return t;
769
- const n = C.includes(s);
769
+ const n = W.includes(s);
770
770
  if (r === void 0) {
771
771
  if (!n)
772
772
  throw new g({
@@ -775,7 +775,7 @@ const E = class E {
775
775
  source: "registry",
776
776
  details: { kind: "layout", name: s, field: "descriptor" }
777
777
  });
778
- if (l.has(s))
778
+ if (l.hasOwn(s))
779
779
  throw A(s);
780
780
  return l.set(s, t), t;
781
781
  }
@@ -788,7 +788,7 @@ const E = class E {
788
788
  source: "registry",
789
789
  details: { kind: "layout", name: s, field: "descriptor.id", id: r.id }
790
790
  });
791
- return z({
791
+ return B({
792
792
  descriptor: { ...r, honoursWeights: e.honoursWeights ?? !1 },
793
793
  type: s
794
794
  }), l.set(s, t), t;
@@ -853,17 +853,17 @@ const E = class E {
853
853
  };
854
854
  E.honoursWeights = !1;
855
855
  let w = E;
856
- const V = O.looseObject({
856
+ const X = O.looseObject({
857
857
  scalingFactor: O.number().default(100)
858
858
  });
859
- class dt extends w {
859
+ class ut extends w {
860
860
  /**
861
861
  * Create a simple layout engine
862
862
  * @param opts - Configuration options including scalingFactor
863
863
  */
864
864
  constructor(t = {}) {
865
865
  super(), this._nodes = [], this._edges = [], this.stale = !0, this.positions = {}, this.scalingFactor = 100, this.isSettled = !0;
866
- const e = V.parse(t);
866
+ const e = X.parse(t);
867
867
  this.scalingFactor = e.scalingFactor;
868
868
  }
869
869
  /**
@@ -1052,37 +1052,37 @@ class dt extends w {
1052
1052
  */
1053
1053
  publishedOr(t, e) {
1054
1054
  const s = { x: 0, y: 0, z: 0 };
1055
- return t !== void 0 && this.readNodePosition(t, s) ? s : X(this.positions[e], this.scalingFactor);
1055
+ return t !== void 0 && this.readNodePosition(t, s) ? s : K(this.positions[e], this.scalingFactor);
1056
1056
  }
1057
1057
  }
1058
- function X(i, t) {
1058
+ function K(i, t) {
1059
1059
  if (!i || i.length === 0)
1060
1060
  return { x: 0, y: 0, z: 0 };
1061
1061
  const e = i[0] * t, s = i[1] * t, r = (i[2] ?? 0) * t;
1062
1062
  return { x: e, y: s, z: r };
1063
1063
  }
1064
- const K = /^#[0-9a-f]{6}$/i;
1064
+ const H = /^#[0-9a-f]{6}$/i;
1065
1065
  function q(i) {
1066
1066
  if (typeof i != "string" || i.trim() === "")
1067
1067
  return null;
1068
1068
  try {
1069
- const t = v(i.trim());
1069
+ const t = L(i.trim());
1070
1070
  if (t === void 0)
1071
1071
  return null;
1072
1072
  const e = t.length === 9 ? t.slice(0, 7) : t;
1073
- return K.test(e) ? e.toUpperCase() : null;
1073
+ return H.test(e) ? e.toUpperCase() : null;
1074
1074
  } catch {
1075
1075
  return null;
1076
1076
  }
1077
1077
  }
1078
- function H(i) {
1078
+ function J(i) {
1079
1079
  return JSON.stringify([i.id, i.kind, i.colors, i.capacity, i.colorblindSafe]);
1080
1080
  }
1081
1081
  const y = b({
1082
1082
  kind: "palette",
1083
1083
  idOf: (i) => i.id,
1084
1084
  descriptorOf: (i) => i,
1085
- implementationOf: H,
1085
+ implementationOf: J,
1086
1086
  builtInIds: () => k
1087
1087
  });
1088
1088
  function u(i, t, e) {
@@ -1093,7 +1093,7 @@ function u(i, t, e) {
1093
1093
  details: { kind: "palette", name: typeof i == "string" ? i : "", field: t }
1094
1094
  });
1095
1095
  }
1096
- function ut(i, t) {
1096
+ function pt(i, t) {
1097
1097
  typeof i != "object" && u("", "descriptor", "registerPalette takes a palette descriptor"), (i.plainName === void 0 || i.plainName === "") && u(i.id, "plainName", `the palette "${String(i.id)}" was registered without a plain name`), i.kind !== "sequential" && i.kind !== "diverging" && i.kind !== "categorical" && u(
1098
1098
  i.id,
1099
1099
  "kind",
@@ -1119,13 +1119,13 @@ function ut(i, t) {
1119
1119
  t
1120
1120
  );
1121
1121
  }
1122
- function pt() {
1122
+ function gt() {
1123
1123
  return y.descriptors();
1124
1124
  }
1125
- function gt(i) {
1125
+ function ft(i) {
1126
1126
  return y.byId(i);
1127
1127
  }
1128
- function ft() {
1128
+ function mt() {
1129
1129
  y.clearForTesting();
1130
1130
  }
1131
1131
  export {
@@ -1133,23 +1133,23 @@ export {
1133
1133
  _ as F,
1134
1134
  w as L,
1135
1135
  o as P,
1136
- V as S,
1137
- nt as U,
1136
+ X as S,
1137
+ ot as U,
1138
1138
  P as W,
1139
- dt as a,
1140
- ht as b,
1141
- rt as c,
1142
- ft as d,
1143
- L as e,
1144
- lt as f,
1145
- pt as g,
1146
- st as h,
1147
- ot as i,
1148
- at as j,
1149
- G as k,
1150
- ct as l,
1151
- gt as m,
1139
+ ut as a,
1140
+ dt as b,
1141
+ nt as c,
1142
+ mt as d,
1143
+ $ as e,
1144
+ ct as f,
1145
+ gt as g,
1146
+ rt as h,
1147
+ at as i,
1148
+ lt as j,
1149
+ U as k,
1150
+ ht as l,
1151
+ ft as m,
1152
1152
  d as n,
1153
- it as p,
1154
- ut as r
1153
+ st as p,
1154
+ pt as r
1155
1155
  };
@@ -0,0 +1,238 @@
1
+ const N = {
2
+ E_BAD_COMMAND: "E_BAD_COMMAND",
3
+ E_BAD_QUERY: "E_BAD_QUERY",
4
+ E_BAD_LAYER: "E_BAD_LAYER",
5
+ E_BAD_SELECTOR: "E_BAD_SELECTOR",
6
+ E_BAD_FORMULA: "E_BAD_FORMULA",
7
+ E_SELECTOR_EMPTY: "E_SELECTOR_EMPTY",
8
+ E_UNSCOPED_RUN_ENCODING: "E_UNSCOPED_RUN_ENCODING",
9
+ E_UNKNOWN_SCALE: "E_UNKNOWN_SCALE",
10
+ E_UNKNOWN_CHANNEL: "E_UNKNOWN_CHANNEL",
11
+ E_UNKNOWN_OPTION: "E_UNKNOWN_OPTION",
12
+ E_OPTION_RANGE: "E_OPTION_RANGE",
13
+ E_UNKNOWN_ATTRIBUTE: "E_UNKNOWN_ATTRIBUTE",
14
+ E_UNKNOWN_ALGORITHM: "E_UNKNOWN_ALGORITHM",
15
+ E_UNKNOWN_LAYOUT: "E_UNKNOWN_LAYOUT",
16
+ E_UNKNOWN_FORMAT: "E_UNKNOWN_FORMAT",
17
+ E_UNKNOWN_PALETTE: "E_UNKNOWN_PALETTE",
18
+ E_UNKNOWN_CAMERA: "E_UNKNOWN_CAMERA",
19
+ E_UNKNOWN_SINK: "E_UNKNOWN_SINK",
20
+ E_UNKNOWN_RUN: "E_UNKNOWN_RUN",
21
+ E_UNSTABLE_RUN_ID: "E_UNSTABLE_RUN_ID",
22
+ E_DUPLICATE_ID: "E_DUPLICATE_ID",
23
+ E_DUPLICATE_EDGE: "E_DUPLICATE_EDGE",
24
+ E_DUPLICATE_PLUGIN: "E_DUPLICATE_PLUGIN",
25
+ E_PROTECTED: "E_PROTECTED",
26
+ E_FETCH_FAILED: "E_FETCH_FAILED",
27
+ E_PARSE_FAILED: "E_PARSE_FAILED",
28
+ E_EDGE_ENDPOINTS_UNRESOLVED: "E_EDGE_ENDPOINTS_UNRESOLVED",
29
+ E_ID_MISSING: "E_ID_MISSING",
30
+ E_EMPTY_LOAD: "E_EMPTY_LOAD",
31
+ E_SUPERSEDED: "E_SUPERSEDED",
32
+ E_TOO_LARGE: "E_TOO_LARGE",
33
+ E_OUT_OF_MEMORY: "E_OUT_OF_MEMORY",
34
+ E_CAP_EXCEEDED: "E_CAP_EXCEEDED",
35
+ E_SCOPE_EMPTY: "E_SCOPE_EMPTY",
36
+ E_NOT_CONVERGED: "E_NOT_CONVERGED",
37
+ E_NO_ACCELERATOR: "E_NO_ACCELERATOR",
38
+ E_NO_WEBGPU: "E_NO_WEBGPU",
39
+ E_NO_ADAPTER: "E_NO_ADAPTER",
40
+ E_SOFTWARE_ONLY: "E_SOFTWARE_ONLY",
41
+ E_DEVICE_INCORRECT: "E_DEVICE_INCORRECT",
42
+ E_DEVICE_LOST: "E_DEVICE_LOST",
43
+ E_NO_WEBGL: "E_NO_WEBGL",
44
+ E_UNSUPPORTED: "E_UNSUPPORTED",
45
+ E_READONLY: "E_READONLY",
46
+ E_DISPOSED: "E_DISPOSED",
47
+ E_INTERNAL: "E_INTERNAL"
48
+ }, T = Object.freeze(Object.values(N)), D = Object.freeze([
49
+ N.E_NO_WEBGPU,
50
+ N.E_NO_ADAPTER,
51
+ N.E_SOFTWARE_ONLY,
52
+ N.E_DEVICE_INCORRECT,
53
+ N.E_DEVICE_LOST,
54
+ N.E_TOO_LARGE
55
+ ]);
56
+ function i(e) {
57
+ return typeof e == "string" && Object.hasOwn(N, e);
58
+ }
59
+ const d = Object.freeze({});
60
+ function A(e) {
61
+ if (typeof e != "object" || e === null || !("code" in e))
62
+ return;
63
+ const { code: E } = e;
64
+ return i(E) ? E : void 0;
65
+ }
66
+ function c(e) {
67
+ if (typeof e != "object" || e === null || !("code" in e))
68
+ return;
69
+ const { code: E } = e;
70
+ return typeof E == "string" && !i(E) ? E : void 0;
71
+ }
72
+ class O extends Error {
73
+ /**
74
+ * Builds an error.
75
+ * @param init - The code, the message, the failing area and anything else known about the
76
+ * failure.
77
+ */
78
+ constructor(E) {
79
+ super(E.message, E.cause === void 0 ? void 0 : { cause: E.cause }), this.name = "GraphtyError", Object.setPrototypeOf(this, new.target.prototype), this.code = E.code, this.source = E.source, this.recoverable = E.recoverable ?? !1, this.details = E.details === void 0 ? d : Object.freeze({ ...E.details }), E.target !== void 0 && (this.target = E.target);
80
+ }
81
+ /**
82
+ * Re-reports a failure from somewhere else as a `GraphtyError`.
83
+ *
84
+ * A sibling package -- graph-io, graph-format, the WebGPU peer -- throws its own class. The
85
+ * class does not cross the boundary, so the element carries the code instead: when the
86
+ * original's `code` is one the element knows, that code wins; when it is a string the
87
+ * element does not know, it is kept in `details.sourceCode` and the caller's code is used.
88
+ * A value that is already a `GraphtyError` is returned untouched, so the most specific code
89
+ * survives.
90
+ * @param cause - The thrown value being wrapped.
91
+ * @param init - The code, area and facts to use when the original supplies none.
92
+ * @returns The error to throw.
93
+ */
94
+ static wrap(E, _) {
95
+ if (E instanceof O)
96
+ return E;
97
+ const r = A(E), s = c(E), n = _.message ?? (E instanceof Error ? E.message : String(E)), t = s === void 0 ? _.details : { ..._.details, sourceCode: s };
98
+ return new O({
99
+ ..._,
100
+ code: r ?? _.code,
101
+ message: n,
102
+ details: t,
103
+ cause: E
104
+ });
105
+ }
106
+ /**
107
+ * Renders the error as plain JSON.
108
+ *
109
+ * Called by `JSON.stringify`, and used wherever an error has to survive a boundary a class
110
+ * cannot cross: a log line, a worker message, a bug report.
111
+ * @returns The serialisable form.
112
+ */
113
+ toJSON() {
114
+ const E = {
115
+ name: this.name,
116
+ code: this.code,
117
+ message: this.message,
118
+ source: this.source,
119
+ recoverable: this.recoverable,
120
+ details: this.details
121
+ };
122
+ return this.target !== void 0 && (E.target = this.target), this.cause instanceof Error && (E.causeMessage = this.cause.message), E;
123
+ }
124
+ }
125
+ function R(e) {
126
+ return e instanceof O;
127
+ }
128
+ function a(e, E) {
129
+ const _ = globalThis, r = /* @__PURE__ */ Symbol.for(`graphty.registry.v1.${e}`);
130
+ return _[r] ??= E(), _[r];
131
+ }
132
+ class U {
133
+ #E = /* @__PURE__ */ new Map();
134
+ #e;
135
+ /**
136
+ * Join the page's shared map for this extension point, creating it if this copy is first.
137
+ * @param kind - Which extension point, which names the page's shared map.
138
+ */
139
+ constructor(E) {
140
+ this.#e = a(`${E}-implementations`, () => /* @__PURE__ */ new Map());
141
+ }
142
+ /**
143
+ * File an implementation for this copy and for every other copy on the page.
144
+ * @param name - The name it is filed under.
145
+ * @param value - The implementation.
146
+ */
147
+ set(E, _) {
148
+ this.#E.set(E, _), this.#e.set(E, _);
149
+ }
150
+ /**
151
+ * This copy's implementation, or else the one another copy filed.
152
+ * @param name - The name.
153
+ * @returns The implementation, or undefined when no copy filed one.
154
+ */
155
+ get(E) {
156
+ return this.#E.get(E) ?? this.#e.get(E);
157
+ }
158
+ /**
159
+ * Whether THIS copy filed the name, which is what a built-in duplicate check asks: another
160
+ * copy registering its own built-ins is not a collision.
161
+ * @param name - The name.
162
+ * @returns True when this copy filed it.
163
+ */
164
+ hasOwn(E) {
165
+ return this.#E.has(E);
166
+ }
167
+ /**
168
+ * Every name any copy filed.
169
+ * @returns The names, this copy's first.
170
+ */
171
+ keys() {
172
+ return (/* @__PURE__ */ new Set([...this.#E.keys(), ...this.#e.keys()])).values();
173
+ }
174
+ }
175
+ function C(e) {
176
+ const E = a(e.kind, () => ({
177
+ entries: /* @__PURE__ */ new Map(),
178
+ warned: /* @__PURE__ */ new Set(),
179
+ cached: null
180
+ })), { entries: _, warned: r } = E;
181
+ return {
182
+ register(s, n) {
183
+ const t = e.idOf(s);
184
+ if (typeof t != "string" || t === "")
185
+ throw new O({
186
+ code: "E_BAD_COMMAND",
187
+ message: `a ${e.kind} registration needs an id`,
188
+ source: "registry",
189
+ details: { kind: e.kind, field: "id" }
190
+ });
191
+ if (e.builtInIds().includes(t))
192
+ throw new O({
193
+ code: "E_DUPLICATE_PLUGIN",
194
+ message: `"${t}" is the id of a ${e.kind} the element ships, and a built-in id may not be taken: a saved document that named it yesterday has to mean the same thing today`,
195
+ source: "registry",
196
+ details: { kind: e.kind, name: t, builtIn: !0 }
197
+ });
198
+ const o = _.get(t);
199
+ if (o !== void 0) {
200
+ if (e.implementationOf(o) === e.implementationOf(s))
201
+ return;
202
+ if (n?.strict === !0)
203
+ throw new O({
204
+ code: "E_DUPLICATE_PLUGIN",
205
+ message: `a ${e.kind} named "${t}" is already registered`,
206
+ source: "registry",
207
+ details: { kind: e.kind, name: t }
208
+ });
209
+ r.has(t) || (r.add(t), console.warn(
210
+ `graphty: a second ${e.kind} named "${t}" replaced the first. Register one implementation per name, or pass { strict: true } to make this throw.`
211
+ ));
212
+ }
213
+ _.set(t, s), E.cached = null;
214
+ },
215
+ entries() {
216
+ return Object.freeze([..._.values()]);
217
+ },
218
+ descriptors() {
219
+ return E.cached ??= Object.freeze([..._.values()].map((s) => e.descriptorOf(s))), E.cached;
220
+ },
221
+ byId(s) {
222
+ return _.get(s);
223
+ },
224
+ clearForTesting() {
225
+ _.clear(), r.clear(), E.cached = null;
226
+ }
227
+ };
228
+ }
229
+ export {
230
+ D as A,
231
+ O as G,
232
+ U as S,
233
+ T as a,
234
+ i as b,
235
+ C as c,
236
+ R as i,
237
+ a as s
238
+ };
@@ -1,5 +1,5 @@
1
- import { G as a } from "./GraphtyError-B93WRH3e.js";
2
- class n {
1
+ import { s as n, G as a } from "./pluginRegistry-MaTIDh6l.js";
2
+ class c {
3
3
  #e = /* @__PURE__ */ new Map();
4
4
  #t = /* @__PURE__ */ new Set();
5
5
  #a = /* @__PURE__ */ new Set();
@@ -102,12 +102,12 @@ class n {
102
102
  e();
103
103
  }
104
104
  }
105
- const c = new n();
106
- function i(r, e) {
107
- c.register(r, e);
105
+ const o = n("accelerator", () => new c());
106
+ function h(r, e) {
107
+ o.register(r, e);
108
108
  }
109
109
  export {
110
- n as A,
111
- c as a,
112
- i as r
110
+ c as A,
111
+ o as a,
112
+ h as r
113
113
  };
@@ -1,11 +1,11 @@
1
1
  import { arfLayout as Le, bfsLayout as Te, bipartiteLayout as We, circularLayout as Ae, createSimulation as _e, seedPositions as Be, resolveNodeVector as Ge, gridLayout as qe, kamadaKawaiLayout as je, multipartiteLayout as Ue, planarLayout as He, radialLayout as Ke, randomLayout as Ve, shellLayout as Ye, spectralLayout as $e, spiralLayout as Je } from "@graphty/layout";
2
2
  import { z as i } from "zod/v4";
3
- import { a as y, S as v, L as fe, k as Ze, W as Qe, l as ke, m as Xe, g as ze } from "./paletteRegistry-A63C71Gn.js";
4
- import { k as u, j as et } from "./algorithms-BF0X6RPw.js";
3
+ import { a as y, S as v, L as fe, k as Ze, W as Qe, l as ke, m as Xe, g as ze } from "./paletteRegistry-jg9uS7wo.js";
4
+ import { k as u, j as et } from "./algorithms-B87OPYw4.js";
5
5
  import { forceLink as tt, forceSimulation as it, forceManyBody as st, forceCenter as nt } from "d3-force-3d";
6
6
  import { makeMask as xe, maskSet as ue } from "@graphty/graph-format";
7
- import { C as me, E as at, o as ot } from "./optionsFromZod-BuTOFgVM.js";
8
- import { G as pe } from "./GraphtyError-B93WRH3e.js";
7
+ import { C as me, E as at, o as ot } from "./optionsFromZod-DHLLiX_8.js";
8
+ import { G as pe } from "./pluginRegistry-MaTIDh6l.js";
9
9
  import rt from "ngraph.forcelayout";
10
10
  import lt from "ngraph.graph";
11
11
  import { V as ct, Y as dt, g as ht, I as ut, B as mt, G as pt, d as gt, O as Se, i as Ne, T as De, P as we, C as Oe, h as ft, b as bt, R as yt, a as Me, c as Ee, e as Ie } from "./sequential-Zym81qm7.js";
package/dist/extend.js CHANGED
@@ -1,11 +1,11 @@
1
- import { c as s, r as a, a as t, b as o } from "./chunks/GraphtyLogger-CqOVV13Y.js";
2
- import { A as c, D as g, a as d, L as l, O as p, P as m, c as n, b as S, d as E, e as O, f as F, g as A, h as D, m as _, i as L, n as T, o as R, r as N, j as f, k as C, l as h, s as I, v as P } from "./chunks/optionsFromZod-BuTOFgVM.js";
1
+ import { c as s, r as a, a as t, b as o } from "./chunks/GraphtyLogger-kbOx2zq3.js";
2
+ import { A as c, D as g, a as d, L as l, O as p, P as m, c as n, b as S, d as E, e as O, f as F, g as A, h as D, m as _, i as L, n as T, o as R, r as N, j as f, k as C, l as h, s as I, v as P } from "./chunks/optionsFromZod-DHLLiX_8.js";
3
3
  import { K as u, a as x, b as K, c as k, d as G, O as v, i as W } from "./chunks/types-C_c53VgR.js";
4
- import { L as M, S as U, a as V, c as Y, b as j, d as w, r as H, e as Z, f as q, g as z } from "./chunks/paletteRegistry-A63C71Gn.js";
5
- import { d as J, a as Q } from "./chunks/detect-vJxK7n0D.js";
6
- import { D as $, E as ee } from "./chunks/DataSource-B8vf2uhW.js";
7
- import { A as se, a as ae, r as te } from "./chunks/registry-jB46Gmeb.js";
8
- import { G as ie, i as ce } from "./chunks/GraphtyError-B93WRH3e.js";
4
+ import { L as M, S as U, a as V, c as Y, b as j, d as w, r as H, e as Z, f as q, g as z } from "./chunks/paletteRegistry-jg9uS7wo.js";
5
+ import { d as J, a as Q } from "./chunks/detect-tuYQLJbT.js";
6
+ import { D as $, E as ee } from "./chunks/DataSource-xL3Yn0Pa.js";
7
+ import { A as se, a as ae, r as te } from "./chunks/registry-DQeq4B2K.js";
8
+ import { G as ie, i as ce } from "./chunks/pluginRegistry-MaTIDh6l.js";
9
9
  export {
10
10
  se as AcceleratorRegistry,
11
11
  c as Algorithm,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$generated": "THIS FILE IS AUTO GENERATED: DO NOT EDIT THIS FILE. INSTEAD EDIT the descriptor tables in graphty-element/src/catalog/ AND RUN graphty-element/scripts/generate-catalog-json.mjs (it runs as part of `npm run build`).",
3
3
  "package": "@graphty/graphty-element",
4
- "version": "2.3.1",
4
+ "version": "2.4.0",
5
5
  "algorithms": [
6
6
  {
7
7
  "key": "degree",