@graphty/graphty-element 2.0.1 → 2.2.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 (81) hide show
  1. package/README.md +3 -3
  2. package/dist/ai.js +4 -4
  3. package/dist/catalog.js +5 -5
  4. package/dist/chunks/{AiManager-awS0MNr1.js → AiManager-Dp1mOkPm.js} +5 -5
  5. package/dist/chunks/{Algorithm-BdcqHKps.js → Algorithm-RQ629NLb.js} +210 -92
  6. package/dist/chunks/{DataSource-DK4GZBKg.js → DataSource-DEg3igzS.js} +3 -3
  7. package/dist/chunks/{GraphSession-D87eymV8.js → GraphSession-D3AV8tpF.js} +2527 -2248
  8. package/dist/chunks/{GraphtyError-B3eKs4yg.js → GraphtyError-BwcnblTH.js} +10 -8
  9. package/dist/chunks/{GraphtyLogger-CK03SnJi.js → GraphtyLogger-5KEttFUo.js} +1 -1
  10. package/dist/chunks/{NodeStyle-CS7dj20m.js → NodeStyle-Cup9O1lu.js} +2 -1
  11. package/dist/chunks/{VoiceInputAdapter-CcnCmxo5.js → VoiceInputAdapter-Bbze1r8k.js} +1 -1
  12. package/dist/chunks/{XRPivotCameraController-UjMsbran.js → XRPivotCameraController-8Il3KxFm.js} +2 -2
  13. package/dist/chunks/{cameras-BeIAlMWR.js → cameras-CeJYi-Na.js} +17 -18
  14. package/dist/chunks/{capability-check-DcKFwS6q.js → capability-check-EUCOfQLP.js} +1 -1
  15. package/dist/chunks/{detect-B-YbbP7i.js → detect-CqN0mC6u.js} +3 -3
  16. package/dist/chunks/{format-detection-DohSEZnb.js → format-detection-C8vbCSlS.js} +1 -1
  17. package/dist/chunks/{index-uohvGegX.js → index-Cz47b_vU.js} +1957 -1318
  18. package/dist/chunks/{paletteRegistry-B-oS4YxP.js → paletteRegistry-NrWOKT-A.js} +17 -17
  19. package/dist/chunks/{registry-DU-e49Y2.js → registry-CSba5QGJ.js} +1 -1
  20. package/dist/chunks/{scales-DvGid5Ln.js → scales-ulKMZPfG.js} +2206 -1357
  21. package/dist/custom-elements.json +1 -1
  22. package/dist/extend.js +26 -27
  23. package/dist/graphty-catalog.json +7 -4
  24. package/dist/graphty.bundle.js +36572 -34379
  25. package/dist/graphty.js +66 -64
  26. package/dist/index.d.ts +1 -1
  27. package/dist/logging.js +2 -2
  28. package/dist/schema.js +1 -1
  29. package/dist/session.d.ts +2 -1
  30. package/dist/session.js +37 -33
  31. package/dist/src/Edge.d.ts +1 -1
  32. package/dist/src/Graph.d.ts +42 -8
  33. package/dist/src/Node.d.ts +3 -4
  34. package/dist/src/acceleration/AccelerationController.d.ts +27 -0
  35. package/dist/src/acceleration/index.d.ts +1 -1
  36. package/dist/src/acceleration/narrow.d.ts +56 -0
  37. package/dist/src/acceleration/types.d.ts +88 -7
  38. package/dist/src/algorithms/Algorithm.d.ts +96 -2
  39. package/dist/src/algorithms/BFSAlgorithm.d.ts +9 -0
  40. package/dist/src/algorithms/DijkstraAlgorithm.d.ts +2 -8
  41. package/dist/src/algorithms/PageRankAlgorithm.d.ts +8 -0
  42. package/dist/src/algorithms/utils/graphUtils.d.ts +13 -0
  43. package/dist/src/cameras/OrbitCameraController.d.ts +1 -0
  44. package/dist/src/catalog/layouts.d.ts +13 -1
  45. package/dist/src/config/GraphBehavior.d.ts +16 -0
  46. package/dist/src/config/GraphStyle.d.ts +1 -1
  47. package/dist/src/config/StyleTemplate.d.ts +10 -0
  48. package/dist/src/data/CSVDataSource.d.ts +1 -0
  49. package/dist/src/data/csv-variant-detection.d.ts +11 -0
  50. package/dist/src/errors/codes.d.ts +14 -1
  51. package/dist/src/events.d.ts +17 -4
  52. package/dist/src/graphty-element.d.ts +52 -4
  53. package/dist/src/layout/ForceAtlas2LayoutEngine.d.ts +28 -45
  54. package/dist/src/layout/LayoutEngine.d.ts +7 -7
  55. package/dist/src/layout/SimulationLayoutEngine.d.ts +458 -0
  56. package/dist/src/layout/SpringElectricalLayoutEngine.d.ts +32 -0
  57. package/dist/src/layout/SpringLayoutEngine.d.ts +22 -32
  58. package/dist/src/managers/DataManager.d.ts +2 -0
  59. package/dist/src/managers/EventManager.d.ts +7 -0
  60. package/dist/src/managers/GraphContext.d.ts +6 -0
  61. package/dist/src/managers/LabelDeclutter.d.ts +97 -0
  62. package/dist/src/managers/LayoutManager.d.ts +98 -4
  63. package/dist/src/managers/RenderManager.d.ts +7 -0
  64. package/dist/src/managers/UpdateManager.d.ts +1 -1
  65. package/dist/src/meshes/NodeEffects.d.ts +29 -5
  66. package/dist/src/meshes/RichTextLabel.d.ts +17 -0
  67. package/dist/src/session/catalog.d.ts +2 -2
  68. package/dist/src/session/query.d.ts +83 -0
  69. package/dist/src/session/runs/types.d.ts +10 -4
  70. package/dist/src/session/selection/targets.d.ts +20 -3
  71. package/dist/src/session/styles/StylesApi.d.ts +18 -0
  72. package/dist/src/session/styles/channels.d.ts +0 -2
  73. package/dist/src/session/styles/legend.d.ts +9 -0
  74. package/dist/src/session/styles/predicate.d.ts +11 -0
  75. package/dist/src/session/styles/sources.d.ts +16 -0
  76. package/dist/src/session/types.d.ts +38 -2
  77. package/dist/src/testing/fakeAccelerator.d.ts +323 -0
  78. package/dist/webgpu.d.ts +23 -1
  79. package/dist/webgpu.js +70 -32
  80. package/package.json +10 -8
  81. package/dist/chunks/types-Dwm9waL2.js +0 -7
@@ -36,23 +36,25 @@ const N = {
36
36
  E_NO_WEBGPU: "E_NO_WEBGPU",
37
37
  E_NO_ADAPTER: "E_NO_ADAPTER",
38
38
  E_SOFTWARE_ONLY: "E_SOFTWARE_ONLY",
39
+ E_DEVICE_INCORRECT: "E_DEVICE_INCORRECT",
39
40
  E_DEVICE_LOST: "E_DEVICE_LOST",
40
41
  E_NO_WEBGL: "E_NO_WEBGL",
41
42
  E_UNSUPPORTED: "E_UNSUPPORTED",
42
43
  E_READONLY: "E_READONLY",
43
44
  E_DISPOSED: "E_DISPOSED",
44
45
  E_INTERNAL: "E_INTERNAL"
45
- }, U = Object.freeze(Object.values(N)), L = Object.freeze([
46
+ }, U = Object.freeze(Object.values(N)), C = Object.freeze([
46
47
  N.E_NO_WEBGPU,
47
48
  N.E_NO_ADAPTER,
48
49
  N.E_SOFTWARE_ONLY,
50
+ N.E_DEVICE_INCORRECT,
49
51
  N.E_DEVICE_LOST,
50
52
  N.E_TOO_LARGE
51
53
  ]);
52
54
  function s(_) {
53
55
  return typeof _ == "string" && Object.hasOwn(N, _);
54
56
  }
55
- const T = Object.freeze({});
57
+ const r = Object.freeze({});
56
58
  function D(_) {
57
59
  if (typeof _ != "object" || _ === null || !("code" in _))
58
60
  return;
@@ -72,7 +74,7 @@ class e extends Error {
72
74
  * failure.
73
75
  */
74
76
  constructor(E) {
75
- 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 ? T : Object.freeze({ ...E.details }), E.target !== void 0 && (this.target = E.target);
77
+ 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 ? r : Object.freeze({ ...E.details }), E.target !== void 0 && (this.target = E.target);
76
78
  }
77
79
  /**
78
80
  * Re-reports a failure from somewhere else as a `GraphtyError`.
@@ -90,12 +92,12 @@ class e extends Error {
90
92
  static wrap(E, O) {
91
93
  if (E instanceof e)
92
94
  return E;
93
- const A = D(E), t = R(E), o = O.message ?? (E instanceof Error ? E.message : String(E)), r = t === void 0 ? O.details : { ...O.details, sourceCode: t };
95
+ const A = D(E), t = R(E), o = O.message ?? (E instanceof Error ? E.message : String(E)), T = t === void 0 ? O.details : { ...O.details, sourceCode: t };
94
96
  return new e({
95
97
  ...O,
96
98
  code: A ?? O.code,
97
99
  message: o,
98
- details: r,
100
+ details: T,
99
101
  cause: E
100
102
  });
101
103
  }
@@ -118,13 +120,13 @@ class e extends Error {
118
120
  return this.target !== void 0 && (E.target = this.target), this.cause instanceof Error && (E.causeMessage = this.cause.message), E;
119
121
  }
120
122
  }
121
- function c(_) {
123
+ function L(_) {
122
124
  return _ instanceof e;
123
125
  }
124
126
  export {
125
- L as A,
127
+ C as A,
126
128
  e as G,
127
129
  U as a,
128
130
  s as b,
129
- c as i
131
+ L as i
130
132
  };
@@ -1,4 +1,4 @@
1
- import { G as c } from "./GraphtyError-B3eKs4yg.js";
1
+ import { G as c } from "./GraphtyError-BwcnblTH.js";
2
2
  import { c as $ } from "./types-B7bX5c0K.js";
3
3
  function G(e) {
4
4
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
@@ -274,7 +274,8 @@ const u = {
274
274
  "geodesic"
275
275
  ]), U = t.strictObject({
276
276
  shape: t.strictObject({
277
- size: t.number().positive().optional(),
277
+ // 0 is legal and draws the smallest visible node; hide a node with `visible: false`.
278
+ size: t.number().nonnegative().optional(),
278
279
  type: f.optional()
279
280
  // custom mesh https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/custom/custom
280
281
  // import mesh https://doc.babylonjs.com/typedoc/functions/BABYLON.ImportMeshAsync
@@ -1,4 +1,4 @@
1
- import { g as ke, h as up } from "./cameras-BeIAlMWR.js";
1
+ import { g as ke, h as up } from "./cameras-CeJYi-Na.js";
2
2
  var ee = { exports: {} };
3
3
  var fp = ee.exports, oo;
4
4
  function op() {
@@ -1,7 +1,7 @@
1
1
  import { Vector3 as f, Quaternion as E, Ray as R, WebXRState as T } from "@babylonjs/core";
2
- import { P as M } from "./index-uohvGegX.js";
2
+ import { P as M } from "./index-Cz47b_vU.js";
3
3
  import "@babylonjs/core/Culling/ray";
4
- import { G as x } from "./GraphtyLogger-CK03SnJi.js";
4
+ import { G as x } from "./GraphtyLogger-5KEttFUo.js";
5
5
  function v(H, t = 0.15) {
6
6
  if (Math.abs(H) < t)
7
7
  return 0;
@@ -1,6 +1,6 @@
1
1
  import { c as y } from "./common-DWNKjpH_.js";
2
- import { N as b, E as g } from "./NodeStyle-CS7dj20m.js";
3
- import { g as f, e as N } from "./Algorithm-BdcqHKps.js";
2
+ import { N as b, E as g } from "./NodeStyle-Cup9O1lu.js";
3
+ import { j as f, e as N } from "./Algorithm-RQ629NLb.js";
4
4
  var L = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
5
  function z(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -9,15 +9,15 @@ const T = /^#?(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
9
9
  function s(e) {
10
10
  return Number.isFinite(e) ? Math.max(0, Math.min(255, Math.round(e))) : 0;
11
11
  }
12
- function i(e) {
12
+ function d(e) {
13
13
  return e.toString(16).padStart(2, "0");
14
14
  }
15
15
  function S(e) {
16
16
  if (!T.test(e))
17
17
  return null;
18
18
  const a = e.startsWith("#") ? e.slice(1) : e, t = a.length <= 4, n = (r) => {
19
- const m = t ? a[r].repeat(2) : a.slice(r * 2, r * 2 + 2);
20
- return parseInt(m, 16);
19
+ const w = t ? a[r].repeat(2) : a.slice(r * 2, r * 2 + 2);
20
+ return parseInt(w, 16);
21
21
  }, o = a.length === 4 || a.length === 8;
22
22
  return {
23
23
  r: n(0),
@@ -45,10 +45,10 @@ function P(e) {
45
45
  }
46
46
  }
47
47
  function c(e) {
48
- const a = s(e.r), t = s(e.g), n = s(e.b), o = Number.isFinite(e.a) ? Math.max(0, Math.min(1, e.a)) : 1, r = `#${i(a)}${i(t)}${i(n)}`;
49
- return { r: a, g: t, b: n, a: o, hex: o === 1 ? r : `${r}${i(Math.round(o * 255))}` };
48
+ const a = s(e.r), t = s(e.g), n = s(e.b), o = Number.isFinite(e.a) ? Math.max(0, Math.min(1, e.a)) : 1, r = `#${d(a)}${d(t)}${d(n)}`;
49
+ return { r: a, g: t, b: n, a: o, hex: o === 1 ? r : `${r}${d(Math.round(o * 255))}` };
50
50
  }
51
- const A = b.options, x = g.shape.line.unwrap().shape.type.unwrap().options, h = g.shape.arrowHead.unwrap().shape.type.unwrap().unwrap().options, C = "An outline has a colour and no width. Babylon draws it with a highlight LAYER, and the stroke's blur size belongs to that layer rather than to a mesh, so every outline on screen is drawn at one width whatever a style asks for -- which is why the node style declares no outline width to ask with. The outline's COLOUR is per style; a width per style would need one highlight layer per width, at a full-screen pass each.", d = 'A caption hangs from the cap at that end of the edge, so an end drawn with no arrow carries none: a tail caption needs `edge.arrowTail` set to something other than "none". The words are what switch a caption on, so a layer that writes only the caption\'s appearance and no words draws nothing, exactly as `node.labelStyle` draws nothing without `node.label`.', p = "A tooltip is drawn on hover and only on hover, so a graph at rest shows none: a layer that writes one changes nothing until a reader points at the node. The words are what switch it on, so a layer that writes only the tooltip's appearance and no words draws nothing, exactly as `node.labelStyle` draws nothing without `node.label`. Only a NODE has a tooltip; `edge.tooltip` was withdrawn in 2.0 because an edge cannot be hovered.", l = {
51
+ const A = b.options, x = g.shape.line.unwrap().shape.type.unwrap().options, h = g.shape.arrowHead.unwrap().shape.type.unwrap().unwrap().options, C = "An outline has a colour and no width. Babylon draws it with a highlight LAYER, and the stroke's blur size belongs to that layer rather than to a mesh, so every outline on screen is drawn at one width whatever a style asks for -- which is why the node style declares no outline width to ask with. The outline's COLOUR is per style; a width per style would need one highlight layer per width, at a full-screen pass each.", i = 'A caption hangs from the cap at that end of the edge, so an end drawn with no arrow carries none: a tail caption needs `edge.arrowTail` set to something other than "none". The words are what switch a caption on, so a layer that writes only the caption\'s appearance and no words draws nothing, exactly as `node.labelStyle` draws nothing without `node.label`.', p = "A tooltip is drawn on hover and only on hover, so a graph at rest shows none: a layer that writes one changes nothing until a reader points at the node. The words are what switch it on, so a layer that writes only the tooltip's appearance and no words draws nothing, exactly as `node.labelStyle` draws nothing without `node.label`. Only a NODE has a tooltip; `edge.tooltip` was withdrawn in 2.0 because an edge cannot be hovered.", l = {
52
52
  "node.color": {
53
53
  channel: "node.color",
54
54
  target: "node",
@@ -143,8 +143,7 @@ const A = b.options, x = g.shape.line.unwrap().shape.type.unwrap().options, h =
143
143
  accepts: "number",
144
144
  min: 0,
145
145
  stylePath: "effect.glow.strength",
146
- renderable: !0,
147
- caveat: "Babylon's glow intensity belongs to the glow LAYER rather than to a mesh, so with two glowing styles on screen both are drawn at whichever strength was applied last. The glow's COLOUR is per style. Per-style strength needs one full-screen pass each."
146
+ renderable: !0
148
147
  },
149
148
  "node.wireframe": {
150
149
  channel: "node.wireframe",
@@ -269,7 +268,7 @@ const A = b.options, x = g.shape.line.unwrap().shape.type.unwrap().options, h =
269
268
  accepts: "text",
270
269
  stylePath: "arrowHead.text.text",
271
270
  renderable: !0,
272
- caveat: d
271
+ caveat: i
273
272
  },
274
273
  "edge.arrowHeadTextStyle": {
275
274
  channel: "edge.arrowHeadTextStyle",
@@ -278,7 +277,7 @@ const A = b.options, x = g.shape.line.unwrap().shape.type.unwrap().options, h =
278
277
  accepts: "labelStyle",
279
278
  stylePath: "arrowHead.text",
280
279
  renderable: !0,
281
- caveat: d
280
+ caveat: i
282
281
  },
283
282
  "edge.arrowTail": {
284
283
  channel: "edge.arrowTail",
@@ -323,7 +322,7 @@ const A = b.options, x = g.shape.line.unwrap().shape.type.unwrap().options, h =
323
322
  accepts: "text",
324
323
  stylePath: "arrowTail.text.text",
325
324
  renderable: !0,
326
- caveat: d
325
+ caveat: i
327
326
  },
328
327
  "edge.arrowTailTextStyle": {
329
328
  channel: "edge.arrowTailTextStyle",
@@ -332,7 +331,7 @@ const A = b.options, x = g.shape.line.unwrap().shape.type.unwrap().options, h =
332
331
  accepts: "labelStyle",
333
332
  stylePath: "arrowTail.text",
334
333
  renderable: !0,
335
- caveat: d
334
+ caveat: i
336
335
  },
337
336
  "edge.animationSpeed": {
338
337
  channel: "edge.animationSpeed",
@@ -374,7 +373,7 @@ function R(e) {
374
373
  (a) => a.target === e
375
374
  );
376
375
  }
377
- const w = Object.freeze([
376
+ const m = Object.freeze([
378
377
  {
379
378
  id: "fitToGraph",
380
379
  plainName: "Fit to graph",
@@ -412,15 +411,15 @@ const w = Object.freeze([
412
411
  }
413
412
  ]);
414
413
  function k(e) {
415
- return w.find((a) => a.id === e) ?? f(e)?.descriptor;
414
+ return m.find((a) => a.id === e) ?? f(e)?.descriptor;
416
415
  }
417
416
  function F(e) {
418
- return [...w, ...N()].filter(
417
+ return [...m, ...N()].filter(
419
418
  (a) => a.modes.includes(e)
420
419
  );
421
420
  }
422
421
  export {
423
- w as C,
422
+ m as C,
424
423
  C as N,
425
424
  u as a,
426
425
  l as b,
@@ -1,4 +1,4 @@
1
- import { c as i, B as m } from "./index-uohvGegX.js";
1
+ import { c as i, B as m } from "./index-Cz47b_vU.js";
2
2
  async function p(n, e) {
3
3
  let s;
4
4
  try {
@@ -1,5 +1,5 @@
1
- import { F as u, q as p } from "./paletteRegistry-B-oS4YxP.js";
2
- import { G as h } from "./GraphtyError-B3eKs4yg.js";
1
+ import { F as u, q as p } from "./paletteRegistry-NrWOKT-A.js";
2
+ import { G as h } from "./GraphtyError-BwcnblTH.js";
3
3
  function f(e) {
4
4
  return e.startsWith("<");
5
5
  }
@@ -10,7 +10,7 @@ const m = [
10
10
  { id: "gml", detect: (e) => !f(e) && /graph\s*\[/i.test(e) },
11
11
  { id: "pajek", detect: (e) => /^\*vertices/i.test(e) },
12
12
  { id: "dot", detect: (e) => /^\s*(strict\s+)?(di)?graph\s+/i.test(e) },
13
- { id: "csv", detect: (e) => !f(e) && /^[\w-]+\s*,\s*[\w-]+/m.test(e) }
13
+ { id: "csv", detect: (e) => !f(e) && /^[\w-]+[ \t]*[,\t;|][ \t]*[\w-]+/m.test(e) }
14
14
  ];
15
15
  function d(e, r) {
16
16
  try {
@@ -1,4 +1,4 @@
1
- import { d as r } from "./detect-B-YbbP7i.js";
1
+ import { d as r } from "./detect-CqN0mC6u.js";
2
2
  function m(t, e) {
3
3
  return r({ filename: t, sample: e });
4
4
  }