@graphty/graphty-element 2.3.1 → 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 (86) hide show
  1. package/AGENTS.md +4 -3
  2. package/dist/ai.js +3 -3
  3. package/dist/catalog.js +28 -27
  4. package/dist/chunks/{AiManager-BBmGJbH4.js → AiManager-DNJCoeTO.js} +5 -5
  5. package/dist/chunks/{DataSource-OeN3NeyD.js → DataSource-xL3Yn0Pa.js} +72 -61
  6. package/dist/chunks/{GraphSession-Bef1AYw9.js → GraphSession-PFm2tJ_j.js} +2942 -2822
  7. package/dist/chunks/{GraphtyLogger-5KEttFUo.js → GraphtyLogger-kbOx2zq3.js} +170 -222
  8. package/dist/chunks/{NodeStyle-DKj7HjMJ.js → NodeStyle-CtmA7dXi.js} +16 -14
  9. package/dist/chunks/{VoiceInputAdapter-Dr9Gcmds.js → VoiceInputAdapter-CDNKQgUK.js} +1 -1
  10. package/dist/chunks/{XRPivotCameraController-BbfgZWpS.js → XRPivotCameraController-JdlLBcD7.js} +146 -134
  11. package/dist/chunks/{algorithms-CpX56sUB.js → algorithms-B87OPYw4.js} +780 -635
  12. package/dist/chunks/{capability-check-Blhb2aBB.js → capability-check-B2oYf_30.js} +1 -1
  13. package/dist/chunks/{detect-Cqwshr9a.js → detect-tuYQLJbT.js} +2 -2
  14. package/dist/chunks/{format-detection-BXGO1lSn.js → format-detection-BG6CMwPO.js} +1 -1
  15. package/dist/chunks/{index-C0mIoumR.js → index-6GDfNfwJ.js} +3185 -2731
  16. package/dist/chunks/{optionsFromZod-17lkrAJs.js → optionsFromZod-DHLLiX_8.js} +275 -267
  17. package/dist/chunks/{paletteRegistry-x7WOEKZY.js → paletteRegistry-jg9uS7wo.js} +72 -70
  18. package/dist/chunks/pluginRegistry-MaTIDh6l.js +238 -0
  19. package/dist/chunks/{registry-CSba5QGJ.js → registry-DQeq4B2K.js} +8 -8
  20. package/dist/chunks/{scales-BRwl51k8.js → scales-BXHmwPXC.js} +572 -399
  21. package/dist/chunks/{types-B7bX5c0K.js → types-C_c53VgR.js} +31 -26
  22. package/dist/commands.d.ts +4 -0
  23. package/dist/custom-elements.json +1 -1
  24. package/dist/extend.js +8 -8
  25. package/dist/graphty-catalog.json +245 -12
  26. package/dist/graphty.bundle.js +37843 -36551
  27. package/dist/graphty.js +69 -65
  28. package/dist/index.d.ts +3 -0
  29. package/dist/logging.js +2 -2
  30. package/dist/schema.d.ts +1 -1
  31. package/dist/schema.js +42 -40
  32. package/dist/session.js +6 -6
  33. package/dist/src/Edge.d.ts +4 -4
  34. package/dist/src/Graph.d.ts +79 -7
  35. package/dist/src/acceleration/AccelerationController.d.ts +20 -3
  36. package/dist/src/acceleration/registry.d.ts +3 -0
  37. package/dist/src/acceleration/types.d.ts +85 -0
  38. package/dist/src/algorithms/Algorithm.d.ts +13 -0
  39. package/dist/src/algorithms/KCoreAlgorithm.d.ts +26 -0
  40. package/dist/src/algorithms/LinkPredictionAlgorithm.d.ts +41 -0
  41. package/dist/src/cameras/InputUtils.d.ts +67 -0
  42. package/dist/src/cameras/XRInputHandler.d.ts +0 -8
  43. package/dist/src/catalog/algorithms.d.ts +5 -5
  44. package/dist/src/catalog/index.d.ts +2 -2
  45. package/dist/src/catalog/layouts.d.ts +7 -6
  46. package/dist/src/catalog/pluginRegistry.d.ts +62 -0
  47. package/dist/src/catalog/registry.d.ts +7 -0
  48. package/dist/src/catalog/types.d.ts +77 -6
  49. package/dist/src/config/EdgeStyle.d.ts +35 -0
  50. package/dist/src/config/index.d.ts +1 -1
  51. package/dist/src/data/DataSource.d.ts +1 -1
  52. package/dist/src/data/GEXFDataSource.d.ts +23 -0
  53. package/dist/src/errors/codes.d.ts +16 -1
  54. package/dist/src/events.d.ts +30 -0
  55. package/dist/src/graphty-element.d.ts +66 -26
  56. package/dist/src/layout/GridLayoutEngine.d.ts +37 -0
  57. package/dist/src/layout/LayoutEngine.d.ts +7 -7
  58. package/dist/src/layout/NGraphLayoutEngine.d.ts +2 -0
  59. package/dist/src/layout/RadialLayoutEngine.d.ts +37 -0
  60. package/dist/src/layout/SimulationLayoutEngine.d.ts +12 -0
  61. package/dist/src/managers/DataManager.d.ts +69 -2
  62. package/dist/src/managers/EventManager.d.ts +10 -4
  63. package/dist/src/managers/GraphContext.d.ts +2 -1
  64. package/dist/src/managers/LayoutManager.d.ts +30 -3
  65. package/dist/src/meshes/CustomLineRenderer.d.ts +11 -9
  66. package/dist/src/meshes/EdgeMesh.d.ts +18 -9
  67. package/dist/src/meshes/FilledArrowRenderer.d.ts +61 -23
  68. package/dist/src/meshes/MeshCache.d.ts +18 -0
  69. package/dist/src/meshes/NodeEffects.d.ts +16 -11
  70. package/dist/src/meshes/NodeMesh.d.ts +2 -2
  71. package/dist/src/meshes/PatternedLineRenderer.d.ts +5 -37
  72. package/dist/src/meshes/PerSceneMaterials.d.ts +49 -0
  73. package/dist/src/meshes/RichTextParser.d.ts +26 -0
  74. package/dist/src/meshes/RichTextRenderer.d.ts +0 -1
  75. package/dist/src/session/cost/estimate.d.ts +1 -1
  76. package/dist/src/session/layout.d.ts +3 -3
  77. package/dist/src/session/runs/RunsApi.d.ts +1 -1
  78. package/dist/src/session/styles/StylesApi.d.ts +6 -0
  79. package/dist/src/session/styles/intern.d.ts +26 -5
  80. package/dist/src/session/styles/repaint.d.ts +2 -1
  81. package/dist/src/session/types.d.ts +6 -6
  82. package/dist/src/xr/XRSessionManager.d.ts +1 -1
  83. package/dist/webgpu.d.ts +8 -0
  84. package/dist/webgpu.js +2 -2
  85. package/package.json +6 -6
  86. package/dist/chunks/GraphtyError-BwcnblTH.js +0 -132
package/dist/graphty.js CHANGED
@@ -1,81 +1,85 @@
1
- import { A as e, a as E, b as r, D as O, E as o, d as S, G as R, e as _, I as L, L as t, N as C, O as A, R as N, S as n, f as I, g as T, h as g, U as i, i as p } from "./chunks/index-C0mIoumR.js";
2
- import { L as l, S as G, a as f } from "./chunks/paletteRegistry-x7WOEKZY.js";
3
- import { D, E as M } from "./chunks/DataSource-OeN3NeyD.js";
4
- import { I as P, J as U, p as c, q as m, A as u, C as x, x as B } from "./chunks/optionsFromZod-17lkrAJs.js";
5
- import { e as H, E as b, N as Y, a as F, P as W, R as K, S as k, d as q, b as v, c as w } from "./chunks/NodeStyle-DKj7HjMJ.js";
6
- import { A as Q, a as X, G as j, i as z, b as Z } from "./chunks/GraphtyError-BwcnblTH.js";
7
- import { B as aa, a as sa, b as ea, C as Ea, G as ra, c as Oa, I as oa, O as Sa, d as Ra, e as _a, f as La, P as ta, g as Ca, h as Aa, R as Na, T as na, i as Ia, V as Ta, Y as ga } from "./chunks/sequential-Zym81qm7.js";
8
- import { a as pa, G as da, V as la, i as Ga } from "./chunks/GraphStyle-Cwr55SAE.js";
9
- import { c as ya } from "./chunks/common-DWNKjpH_.js";
1
+ import { A as s, a as r, b as E, D as O, E as o, d as S, G as R, e as t, I as L, L as _, N as C, O as A, R as N, S as g, f as i, g as n, h as I, U as T, i as p } from "./chunks/index-6GDfNfwJ.js";
2
+ import { L as d, S as G, a as f, r as y } from "./chunks/paletteRegistry-jg9uS7wo.js";
3
+ import { D as M, E as P } from "./chunks/DataSource-xL3Yn0Pa.js";
4
+ import { I as m, J as U, p as c, q as x, A as u, C as B, x as V, r as H } from "./chunks/optionsFromZod-DHLLiX_8.js";
5
+ import { r as Y } from "./chunks/GraphtyLogger-kbOx2zq3.js";
6
+ import { g as W, b as k, N as w, c as K, P as q, R as v, S as J, d as Q, e as X, f as j } from "./chunks/NodeStyle-CtmA7dXi.js";
7
+ import { A as Z, a as $, G as aa, i as ea, b as sa } from "./chunks/pluginRegistry-MaTIDh6l.js";
8
+ import { B as Ea, a as Oa, b as oa, C as Sa, G as Ra, c as ta, I as La, O as _a, d as Ca, e as Aa, f as Na, P as ga, g as ia, h as na, R as Ia, T as Ta, i as pa, V as la, Y as da } from "./chunks/sequential-Zym81qm7.js";
9
+ import { a as fa, G as ya, V as Da, i as Ma } from "./chunks/GraphStyle-Cwr55SAE.js";
10
+ import { c as ha } from "./chunks/common-DWNKjpH_.js";
10
11
  export {
11
- Q as ACCELERATION_ERROR_CODES,
12
- P as ACCELERATION_MIN_NODES_DEFAULT,
12
+ Z as ACCELERATION_ERROR_CODES,
13
+ m as ACCELERATION_MIN_NODES_DEFAULT,
13
14
  U as ACCELERATION_MIN_NODES_KEY,
14
15
  c as ACCELERATION_POLICIES,
15
- m as ACCELERATION_POLICY_DEFAULT,
16
+ x as ACCELERATION_POLICY_DEFAULT,
16
17
  u as Algorithm,
17
- e as AlgorithmManager,
18
- E as AnimationCancelledError,
19
- aa as BLUES_COLORS,
20
- sa as BLUE_HIGHLIGHT,
21
- ea as BLUE_ORANGE_COLORS,
22
- r as BUILTIN_PRESETS,
23
- Ea as CARBON_COLORS,
24
- x as CPU_PRECISION,
25
- pa as DEFAULT_VIEW_MODE,
18
+ s as AlgorithmManager,
19
+ r as AnimationCancelledError,
20
+ Ea as BLUES_COLORS,
21
+ Oa as BLUE_HIGHLIGHT,
22
+ oa as BLUE_ORANGE_COLORS,
23
+ E as BUILTIN_PRESETS,
24
+ Sa as CARBON_COLORS,
25
+ B as CPU_PRECISION,
26
+ fa as DEFAULT_VIEW_MODE,
26
27
  O as DataManager,
27
- D as DataSource,
28
- H as EDGE_CONSTANTS,
28
+ M as DataSource,
29
+ W as EDGE_CONSTANTS,
29
30
  o as Edge,
30
- b as EdgeStyle,
31
- M as ErrorAggregator,
31
+ k as EdgeStyle,
32
+ P as ErrorAggregator,
32
33
  S as EventManager,
33
- X as GRAPHTY_ERROR_CODES,
34
- ra as GREENS_COLORS,
35
- Oa as GREEN_SUCCESS,
34
+ $ as GRAPHTY_ERROR_CODES,
35
+ Ra as GREENS_COLORS,
36
+ ta as GREEN_SUCCESS,
36
37
  R as Graph,
37
- da as GraphBackground,
38
- _ as Graphty,
39
- j as GraphtyError,
40
- oa as INFERNO_COLORS,
38
+ ya as GraphBackground,
39
+ t as Graphty,
40
+ aa as GraphtyError,
41
+ La as INFERNO_COLORS,
41
42
  L as InputManager,
42
- l as LayoutEngine,
43
- t as LayoutManager,
43
+ d as LayoutEngine,
44
+ _ as LayoutManager,
44
45
  C as Node,
45
- Y as NodeShapes,
46
- F as NodeStyle,
47
- Sa as OKABE_ITO_COLORS,
48
- Ra as ORANGES_COLORS,
49
- _a as ORANGE_WARNING,
50
- La as OTHER_GROUP_COLOR,
46
+ w as NodeShapes,
47
+ K as NodeStyle,
48
+ _a as OKABE_ITO_COLORS,
49
+ Ca as ORANGES_COLORS,
50
+ Aa as ORANGE_WARNING,
51
+ Na as OTHER_GROUP_COLOR,
51
52
  A as OperationQueueManager,
52
- ta as PASTEL_COLORS,
53
- Ca as PLASMA_COLORS,
54
- Aa as PURPLE_GREEN_COLORS,
55
- W as PolyhedronType,
56
- Na as RED_BLUE_COLORS,
53
+ ga as PASTEL_COLORS,
54
+ ia as PLASMA_COLORS,
55
+ na as PURPLE_GREEN_COLORS,
56
+ q as PolyhedronType,
57
+ Ia as RED_BLUE_COLORS,
57
58
  N as RenderManager,
58
- K as RichTextStyle,
59
- k as SHAPE_CONSTANTS,
60
- n as ScreenshotError,
61
- I as ScreenshotErrorCode,
62
- T as SelectionManager,
59
+ v as RichTextStyle,
60
+ J as SHAPE_CONSTANTS,
61
+ g as ScreenshotError,
62
+ i as ScreenshotErrorCode,
63
+ n as SelectionManager,
63
64
  G as SimpleLayoutConfig,
64
65
  f as SimpleLayoutEngine,
65
- g as StatsManager,
66
- na as TOL_MUTED_COLORS,
67
- Ia as TOL_VIBRANT_COLORS,
68
- i as UpdateManager,
69
- la as VIEW_MODE_VALUES,
70
- Ta as VIRIDIS_COLORS,
71
- ga as YLORBR_COLORS,
72
- ya as colorToHex,
73
- q as defaultEdgeStyle,
74
- v as defaultNodeStyle,
75
- w as defaultRichTextLabelStyle,
66
+ I as StatsManager,
67
+ Ta as TOL_MUTED_COLORS,
68
+ pa as TOL_VIBRANT_COLORS,
69
+ T as UpdateManager,
70
+ Da as VIEW_MODE_VALUES,
71
+ la as VIRIDIS_COLORS,
72
+ da as YLORBR_COLORS,
73
+ ha as colorToHex,
74
+ Q as defaultEdgeStyle,
75
+ X as defaultNodeStyle,
76
+ j as defaultRichTextLabelStyle,
76
77
  p as defaultXRConfig,
77
- B as isAccelerationPolicy,
78
- z as isGraphtyError,
79
- Z as isGraphtyErrorCode,
80
- Ga as isViewMode
78
+ V as isAccelerationPolicy,
79
+ ea as isGraphtyError,
80
+ sa as isGraphtyErrorCode,
81
+ Ma as isViewMode,
82
+ H as registerCameraView,
83
+ Y as registerLogSink,
84
+ y as registerPalette
81
85
  };
package/dist/index.d.ts CHANGED
@@ -54,6 +54,9 @@ export { DataSource } from "./src/data/DataSource";
54
54
  export type { DataLoadingError, ErrorSummary } from "./src/data/index";
55
55
  export { ErrorAggregator } from "./src/data/index";
56
56
  export { Algorithm } from "./src/algorithms/Algorithm";
57
+ export { registerCameraView } from "./src/catalog/cameraRegistry";
58
+ export { registerLogSink } from "./src/catalog/logSinkRegistry";
59
+ export { registerPalette } from "./src/catalog/paletteRegistry";
57
60
  export type { CameraStateChangedEvent, DataLoadingCompleteEvent, DataLoadingErrorEvent, DataLoadingErrorSummaryEvent, DataLoadingProgressEvent, EdgeAddEvent, EdgeEvent, EdgeEventType, EdgeGenericEvent, EventCallbackType, EventType, GraphDataAddedEvent, GraphDataLoadedEvent, GraphErrorEvent, GraphEvent, GraphEventType, GraphGenericEvent, GraphLayoutInitializedEvent, GraphSettledEvent, NodeAddEvent, NodeClickEvent, NodeDragEndEvent, NodeDragStartEvent, NodeEvent, NodeEventDetail, NodeEventType, NodeGenericEvent, NodeHoverEvent, } from "./src/events";
58
61
  export type { Manager, ManagerConfig, ManagerContext, QueueableManager } from "./src/managers/index";
59
62
  export { AlgorithmManager, DataManager, EventManager, InputManager, LayoutManager, OperationQueueManager, RenderManager, SelectionManager, StatsManager, UpdateManager, } from "./src/managers/index";
package/dist/logging.js CHANGED
@@ -1,5 +1,5 @@
1
- import { d as c, p } from "./chunks/GraphtyLogger-5KEttFUo.js";
2
- import { G, e as C, f as M, g as w, h as N, i as V, j as I, k as P, m as U, n as T, o as x } from "./chunks/GraphtyLogger-5KEttFUo.js";
1
+ import { d as c, p } from "./chunks/GraphtyLogger-kbOx2zq3.js";
2
+ import { G, e as C, f as M, g as w, h as N, i as V, j as I, k as P, m as U, n as T, o as x } from "./chunks/GraphtyLogger-kbOx2zq3.js";
3
3
  const g = "graphty-element-logging-config";
4
4
  function O(t) {
5
5
  try {
package/dist/schema.d.ts CHANGED
@@ -22,7 +22,7 @@
22
22
  export type { Binding, BindingOverflow, Channel, ChannelValue, EdgeId, EdgeLinePattern, Encoding, LabelStyle, LayerId, LayerKind, LayerSource, LayerSpec, NodeId, Path, Query, ResultShape, Rgba, RunId, Scope, ScopeId, Selector, StaticStyle, StyleDocument, ThemeDescriptor, } from "./src/catalog/types";
23
23
  export { isResultShape, RESULT_SHAPES } from "./src/catalog/types";
24
24
  export type { AdHocData, EdgeStyleConfig, GraphBackgroundConfig, GraphSelectionStyleConfig, GraphSelectionStyleInput, ImageData, NodeStyleConfig, RichTextStyleType, ViewMode, } from "./src/config/index";
25
- export { colorToHex, DEFAULT_SELECTION_STYLE, DEFAULT_VIEW_MODE, defaultEdgeStyle, defaultNodeStyle, defaultRichTextLabelStyle, EdgeStyle, GraphBackground, GraphSelectionStyleOpts, isViewMode, NodeShapes, NodeStyle, RichTextStyle, VIEW_MODE_VALUES, } from "./src/config/index";
25
+ export { colorToHex, DEFAULT_SELECTION_STYLE, DEFAULT_VIEW_MODE, defaultEdgeStyle, defaultNodeStyle, defaultRichTextLabelStyle, EdgeArrowTypes, EdgeLineTypes, EdgeStyle, GraphBackground, GraphSelectionStyleOpts, isViewMode, NodeShapes, NodeStyle, RichTextStyle, VIEW_MODE_VALUES, } from "./src/config/index";
26
26
  export * from "./src/config/palettes/index";
27
27
  export { areDistinguishableInGrayscale, colorDifference, isPaletteSafe, simulateDeuteranopia, simulateProtanopia, simulateTritanopia, toGrayscale, } from "./src/utils/styleHelpers/accessibility/colorblindSimulation";
28
28
  export type { RgbColor } from "./src/utils/styleHelpers/color/interpolation";
package/dist/schema.js CHANGED
@@ -1,9 +1,9 @@
1
- import { R as N, e as x } from "./chunks/types-B7bX5c0K.js";
2
- import { M as A, h as y, i as M } from "./chunks/interpolation-DY-PNpqX.js";
3
- import { B as D, a as U, b as B, C as P, G as H, c as V, I as $, O as w, d as F, e as W, f as Y, P as j, g as k, h as q, R as K, T as v, i as z, V as J, Y as Q } from "./chunks/sequential-Zym81qm7.js";
4
- import { D as Z, a as tt, G as nt, b as at, V as st, i as et } from "./chunks/GraphStyle-Cwr55SAE.js";
5
- import { E as rt, N as ct, a as it, R as Ot, d as St, b as Rt, c as lt } from "./chunks/NodeStyle-DKj7HjMJ.js";
6
- import { c as ft } from "./chunks/common-DWNKjpH_.js";
1
+ import { R as N, e as x } from "./chunks/types-C_c53VgR.js";
2
+ import { M as h, h as y, i as M } from "./chunks/interpolation-DY-PNpqX.js";
3
+ import { B as D, a as U, b as B, C as P, G as H, c as V, I as w, O as $, d as F, e as W, f as Y, P as j, g as k, h as q, R as K, T as v, i as z, V as J, Y as Q } from "./chunks/sequential-Zym81qm7.js";
4
+ import { D as Z, a as tt, G as nt, b as at, V as et, i as st } from "./chunks/GraphStyle-Cwr55SAE.js";
5
+ import { E as rt, a as ct, b as it, N as Ot, c as St, R as Rt, d as lt, e as ut, f as ft } from "./chunks/NodeStyle-CtmA7dXi.js";
6
+ import { c as Lt } from "./chunks/common-DWNKjpH_.js";
7
7
  function l(t) {
8
8
  const n = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
9
9
  if (!n)
@@ -11,11 +11,11 @@ function l(t) {
11
11
  return [parseInt(n[1], 16), parseInt(n[2], 16), parseInt(n[3], 16)];
12
12
  }
13
13
  function E(t, n, o) {
14
- const e = (a) => {
15
- const s = Math.round(Math.max(0, Math.min(255, a))).toString(16);
16
- return s.length === 1 ? `0${s}` : s;
14
+ const s = (a) => {
15
+ const e = Math.round(Math.max(0, Math.min(255, a))).toString(16);
16
+ return e.length === 1 ? `0${e}` : e;
17
17
  };
18
- return `#${e(t)}${e(n)}${e(o)}`;
18
+ return `#${s(t)}${s(n)}${s(o)}`;
19
19
  }
20
20
  function S(t) {
21
21
  const n = t / 255;
@@ -25,44 +25,44 @@ function R(t) {
25
25
  return t <= 31308e-7 ? t * 12.92 * 255 : (1.055 * Math.pow(t, 1 / 2.4) - 0.055) * 255;
26
26
  }
27
27
  function L(t) {
28
- const [n, o, e] = l(t), a = S(n), s = S(o), r = S(e), O = 0.567 * a + 0.433 * s + 0 * r, c = 0.558 * a + 0.442 * s + 0 * r, i = 0 * a + 0.242 * s + 0.758 * r;
28
+ const [n, o, s] = l(t), a = S(n), e = S(o), r = S(s), O = 0.567 * a + 0.433 * e + 0 * r, c = 0.558 * a + 0.442 * e + 0 * r, i = 0 * a + 0.242 * e + 0.758 * r;
29
29
  return E(R(O), R(c), R(i));
30
30
  }
31
31
  function _(t) {
32
- const [n, o, e] = l(t), a = S(n), s = S(o), r = S(e), O = 0.625 * a + 0.375 * s + 0 * r, c = 0.7 * a + 0.3 * s + 0 * r, i = 0 * a + 0.3 * s + 0.7 * r;
32
+ const [n, o, s] = l(t), a = S(n), e = S(o), r = S(s), O = 0.625 * a + 0.375 * e + 0 * r, c = 0.7 * a + 0.3 * e + 0 * r, i = 0 * a + 0.3 * e + 0.7 * r;
33
33
  return E(R(O), R(c), R(i));
34
34
  }
35
35
  function p(t) {
36
- const [n, o, e] = l(t), a = S(n), s = S(o), r = S(e), O = 0.95 * a + 0.05 * s + 0 * r, c = 0 * a + 0.433 * s + 0.567 * r, i = 0 * a + 0.475 * s + 0.525 * r;
36
+ const [n, o, s] = l(t), a = S(n), e = S(o), r = S(s), O = 0.95 * a + 0.05 * e + 0 * r, c = 0 * a + 0.433 * e + 0.567 * r, i = 0 * a + 0.475 * e + 0.525 * r;
37
37
  return E(R(O), R(c), R(i));
38
38
  }
39
39
  function g(t) {
40
- const [n, o, e] = l(t), a = 0.2126 * n + 0.7152 * o + 0.0722 * e;
40
+ const [n, o, s] = l(t), a = 0.2126 * n + 0.7152 * o + 0.0722 * s;
41
41
  return E(a, a, a);
42
42
  }
43
43
  function f(t, n) {
44
- const [o, e, a] = l(t), [s, r, O] = l(n), c = o - s, i = e - r, u = a - O;
44
+ const [o, s, a] = l(t), [e, r, O] = l(n), c = o - e, i = s - r, u = a - O;
45
45
  return Math.sqrt(c * c + i * i + u * u) / 2.55;
46
46
  }
47
- function b(t, n, o = 10) {
48
- const e = g(t), a = g(n);
49
- return f(e, a) > o;
47
+ function C(t, n, o = 10) {
48
+ const s = g(t), a = g(n);
49
+ return f(s, a) > o;
50
50
  }
51
- function d(t, n = 10) {
51
+ function b(t, n = 10) {
52
52
  const o = {
53
53
  protanopia: !0,
54
54
  deuteranopia: !0,
55
55
  tritanopia: !0,
56
56
  grayscale: !0
57
57
  };
58
- for (let e = 0; e < t.length; e++)
59
- for (let a = e + 1; a < t.length; a++) {
60
- const s = t[e], r = t[a], O = L(s), c = L(r);
58
+ for (let s = 0; s < t.length; s++)
59
+ for (let a = s + 1; a < t.length; a++) {
60
+ const e = t[s], r = t[a], O = L(e), c = L(r);
61
61
  f(O, c) < n && (o.protanopia = !1);
62
- const i = _(s), u = _(r);
62
+ const i = _(e), u = _(r);
63
63
  f(i, u) < n && (o.deuteranopia = !1);
64
- const C = p(s), T = p(r);
65
- f(C, T) < n && (o.tritanopia = !1), b(s, r, n) || (o.grayscale = !1);
64
+ const T = p(e), d = p(r);
65
+ f(T, d) < n && (o.tritanopia = !1), C(e, r, n) || (o.grayscale = !1);
66
66
  }
67
67
  return o;
68
68
  }
@@ -73,16 +73,18 @@ export {
73
73
  P as CARBON_COLORS,
74
74
  Z as DEFAULT_SELECTION_STYLE,
75
75
  tt as DEFAULT_VIEW_MODE,
76
- rt as EdgeStyle,
76
+ rt as EdgeArrowTypes,
77
+ ct as EdgeLineTypes,
78
+ it as EdgeStyle,
77
79
  H as GREENS_COLORS,
78
80
  V as GREEN_SUCCESS,
79
81
  nt as GraphBackground,
80
82
  at as GraphSelectionStyleOpts,
81
- $ as INFERNO_COLORS,
82
- A as MISSING_DATA_COLOR,
83
- ct as NodeShapes,
84
- it as NodeStyle,
85
- w as OKABE_ITO_COLORS,
83
+ w as INFERNO_COLORS,
84
+ h as MISSING_DATA_COLOR,
85
+ Ot as NodeShapes,
86
+ St as NodeStyle,
87
+ $ as OKABE_ITO_COLORS,
86
88
  F as ORANGES_COLORS,
87
89
  W as ORANGE_WARNING,
88
90
  Y as OTHER_GROUP_COLOR,
@@ -91,23 +93,23 @@ export {
91
93
  q as PURPLE_GREEN_COLORS,
92
94
  K as RED_BLUE_COLORS,
93
95
  N as RESULT_SHAPES,
94
- Ot as RichTextStyle,
96
+ Rt as RichTextStyle,
95
97
  v as TOL_MUTED_COLORS,
96
98
  z as TOL_VIBRANT_COLORS,
97
- st as VIEW_MODE_VALUES,
99
+ et as VIEW_MODE_VALUES,
98
100
  J as VIRIDIS_COLORS,
99
101
  Q as YLORBR_COLORS,
100
- b as areDistinguishableInGrayscale,
102
+ C as areDistinguishableInGrayscale,
101
103
  f as colorDifference,
102
- ft as colorToHex,
103
- St as defaultEdgeStyle,
104
- Rt as defaultNodeStyle,
105
- lt as defaultRichTextLabelStyle,
104
+ Lt as colorToHex,
105
+ lt as defaultEdgeStyle,
106
+ ut as defaultNodeStyle,
107
+ ft as defaultRichTextLabelStyle,
106
108
  y as hexToRgb,
107
109
  M as interpolatePalette,
108
- d as isPaletteSafe,
110
+ b as isPaletteSafe,
109
111
  x as isResultShape,
110
- et as isViewMode,
112
+ st as isViewMode,
111
113
  _ as simulateDeuteranopia,
112
114
  L as simulateProtanopia,
113
115
  p as simulateTritanopia,
package/dist/session.js CHANGED
@@ -1,9 +1,9 @@
1
- import { R, e as _ } from "./chunks/types-B7bX5c0K.js";
2
- import { A as c, a as C, G as p, i as m, b as L } from "./chunks/GraphtyError-BwcnblTH.js";
3
- import { p as O, q as U, R as I, t as P, u as y, w as N, x as D, y as w, z as v } from "./chunks/optionsFromZod-17lkrAJs.js";
4
- import { D as h } from "./chunks/GraphSession-Bef1AYw9.js";
5
- import { a as b, b as x, c as F, d as z, Q as M, R as k, e as H, f as Y, S as j, T as q, g as Q, i as X, h as B, j as J, k as K } from "./chunks/GraphSession-Bef1AYw9.js";
6
- import { L as s } from "./chunks/scales-BRwl51k8.js";
1
+ import { R, e as _ } from "./chunks/types-C_c53VgR.js";
2
+ import { A as c, a as C, G as p, i as m, b as L } from "./chunks/pluginRegistry-MaTIDh6l.js";
3
+ import { p as O, q as U, R as I, t as P, u as y, w as N, x as D, y as w, z as v } from "./chunks/optionsFromZod-DHLLiX_8.js";
4
+ import { D as h } from "./chunks/GraphSession-PFm2tJ_j.js";
5
+ import { a as b, b as x, c as F, d as z, Q as M, R as k, e as H, f as Y, S as j, T as q, g as Q, i as X, h as B, j as J, k as K } from "./chunks/GraphSession-PFm2tJ_j.js";
6
+ import { L as s } from "./chunks/scales-BXHmwPXC.js";
7
7
  const u = [
8
8
  {
9
9
  id: "fixed",
@@ -239,10 +239,10 @@ export declare class Edge {
239
239
  * cached SOURCE meshes -- and Babylon disposes a source mesh's instances with it. That is why
240
240
  * node spheres and 3D solid edge lines vanished on a dataset clear while roughly sixty grey
241
241
  * ARROWHEADS stayed on the canvas, in rosettes where the previous dataset's edges had
242
- * converged. Arrowheads are deliberately not cached (`EdgeMesh.createArrowHead` carries a
243
- * "PERFORMANCE FIX: Create individual meshes for all arrow types" note): they are built bare
244
- * against the scene and parented to the `graph-root` TransformNode, which outlives every
245
- * dataset, so nothing ever disposed them. The same was true of the patterned-line meshes
242
+ * converged. Arrowheads are not in the MeshCache (today each is an instance of a per-scene
243
+ * batch that `FilledArrowRenderer.instanceOf` frees with its last head): they are parented
244
+ * to the `graph-root` TransformNode, which outlives every dataset, so nothing but this
245
+ * dispose frees them. The same was true of the patterned-line meshes
246
246
  * (dot/dash/star/...), 2D lines, bezier curves and all three RichTextLabels.
247
247
  *
248
248
  * Every dispose is guarded with `isDisposed()` -- matching the idiom already used in
@@ -49,6 +49,8 @@ export declare class Graph implements GraphContext {
49
49
  runAlgorithmsOnLoad: boolean;
50
50
  enableDetailedProfiling?: boolean;
51
51
  private wasSettled;
52
+ /** How many loads `addDataFromSource` has started; the last one's id. */
53
+ private loadCount;
52
54
  private resizeHandler;
53
55
  /**
54
56
  * The one acceleration controller this graph, its session and its element share.
@@ -202,11 +204,43 @@ export declare class Graph implements GraphContext {
202
204
  *
203
205
  * A load that fails part-way still paints: the rows that did arrive are in the store and on
204
206
  * screen, so leaving them unpainted would be the same defect with a smaller blast radius.
207
+ *
208
+ * EVERY LOAD HAS AN ID. The promise resolves to it, and every event about this load --
209
+ * `data-loading-progress`, `data-loading-complete`, `data-loading-error`, `data-loaded` and
210
+ * the `error` beside a failure -- carries it as `loadId`, so a consumer that started two loads
211
+ * can tell whose report is whose.
205
212
  * @param type - Type/name of the registered data source
206
213
  * @param opts - Options to pass to the data source
207
- * @returns Promise that resolves when data is loaded
214
+ * @param options - How to load
215
+ * @param options.replace - Replace the graph with what the source holds, but only once all of
216
+ * it has parsed: a malformed or empty source rejects and leaves the graph as it was
217
+ * @returns Promise that resolves to the load's id when data is loaded
218
+ */
219
+ addDataFromSource(type: string, opts?: object, options?: {
220
+ replace?: boolean;
221
+ }): Promise<{
222
+ loadId: number;
223
+ }>;
224
+ /**
225
+ * Give a load its id and its place in line, synchronously, at the moment it was asked for.
226
+ *
227
+ * `loadFromFile` and `loadFromUrl` read before they load, so taking the place when the read
228
+ * finished would let an earlier, slower read overtake a later load. Ids rise in call order.
229
+ * @param replace - Whether the load replaces the graph
230
+ * @returns The reservation to hand to `loadReserved`
208
231
  */
209
- addDataFromSource(type: string, opts?: object): Promise<void>;
232
+ private reserveLoad;
233
+ /**
234
+ * Run a load whose place `reserveLoad` already took, then repaint what it loaded.
235
+ * @param type - Type/name of the registered data source
236
+ * @param opts - Options to pass to the data source
237
+ * @param load - The reservation
238
+ * @param load.loadId - The load's id
239
+ * @param load.generation - The load's place in line
240
+ * @param load.replace - Whether the load replaces the graph
241
+ * @returns The load's id
242
+ */
243
+ private loadReserved;
210
244
  /**
211
245
  * Load graph data from a File object with auto-format detection
212
246
  * @param file - File object from file input
@@ -216,13 +250,18 @@ export declare class Graph implements GraphContext {
216
250
  * @param options.edgeSource - Where the node an edge starts at is named in the record. Left
217
251
  * unset, the element reads `source`, then `src`, then `from`
218
252
  * @param options.edgeTarget - Where the node an edge ends at is named in the record
253
+ * @param options.replace - Replace the graph, once the file has parsed; see `addDataFromSource`
254
+ * @returns Promise that resolves to the load's id when data is loaded
219
255
  */
220
256
  loadFromFile(file: File, options?: {
221
257
  format?: string;
222
258
  nodeIdPath?: string;
223
259
  edgeSource?: string;
224
260
  edgeTarget?: string;
225
- }): Promise<void>;
261
+ replace?: boolean;
262
+ }): Promise<{
263
+ loadId: number;
264
+ }>;
226
265
  /**
227
266
  * Load graph data from a URL with auto-format detection
228
267
  * @remarks
@@ -237,6 +276,8 @@ export declare class Graph implements GraphContext {
237
276
  * @param options.edgeSource - Where the node an edge starts at is named in the record. Left
238
277
  * unset, the element reads `source`, then `src`, then `from`
239
278
  * @param options.edgeTarget - Where the node an edge ends at is named in the record
279
+ * @param options.replace - Replace the graph, once the data has parsed; see `addDataFromSource`
280
+ * @returns Promise that resolves to the load's id when data is loaded
240
281
  * @example
241
282
  * ```typescript
242
283
  * // Auto-detect format from extension
@@ -254,7 +295,10 @@ export declare class Graph implements GraphContext {
254
295
  nodeIdPath?: string;
255
296
  edgeSource?: string;
256
297
  edgeTarget?: string;
257
- }): Promise<void>;
298
+ replace?: boolean;
299
+ }): Promise<{
300
+ loadId: number;
301
+ }>;
258
302
  /**
259
303
  * Add a single node to the graph.
260
304
  * @param node - Node data object to add
@@ -358,6 +402,21 @@ export declare class Graph implements GraphContext {
358
402
  * @returns Promise that resolves once the graph holds exactly these edges
359
403
  */
360
404
  setEdges(edges: Record<string | number, unknown>[], options?: AddEdgesOptions & QueueableOptions): Promise<void>;
405
+ /**
406
+ * Replace every node in the graph with a new set.
407
+ *
408
+ * What the `node-data` property does, and the node half of {@link setEdges}. A node whose id is
409
+ * not in the new set is removed the way {@link removeNodes} removes one, so the edges attached
410
+ * to it go too. A node whose id IS in the new set keeps its object and its position; its data
411
+ * is not rewritten. A set past the render ceiling is refused with `E_TOO_LARGE` before a node
412
+ * is removed, so the graph keeps the nodes it had.
413
+ * @param nodes - the nodes the graph should hold afterwards
414
+ * @param idPath - Key to use for node IDs (default: the configured node id path)
415
+ * @param options - Queue options for operation ordering
416
+ * @returns Promise that resolves once the graph holds exactly these nodes
417
+ * @since 2.3.0
418
+ */
419
+ setNodes(nodes: Record<string | number, unknown>[], idPath?: string, options?: QueueableOptions): Promise<void>;
361
420
  /**
362
421
  * Set the layout algorithm and configuration.
363
422
  * @remarks
@@ -523,6 +582,10 @@ export declare class Graph implements GraphContext {
523
582
  * already-applied layer kept that layer's place, and the place it had was the order the RUNS
524
583
  * FINISHED in -- so `applySuggestedStyles(["pagerank", "louvain"])` painted a PageRank
525
584
  * picture whenever PageRank happened to finish last, and a Louvain one whenever it did not.
585
+ *
586
+ * It starts the style edits and returns at once. To wait for the picture, await
587
+ * {@link Graph.waitForStableFrame} after the call: it settles only once every suggested layer
588
+ * is added, stacked in the order named and painted.
526
589
  * @param algorithmKey - A catalogue key such as "degree", a 1.10 address such as
527
590
  * "graphty:degree", or an array of either.
528
591
  * @returns True when at least one suggestion was applied, false when no finished run of that
@@ -714,7 +777,13 @@ export declare class Graph implements GraphContext {
714
777
  *
715
778
  * It does nothing while no style pass is bound: a pass whose answer nothing draws is a pass
716
779
  * over the graph for no picture.
717
- * @returns A promise that settles when the pass has finished.
780
+ *
781
+ * NOTHING AFTER TEARDOWN, AND NOTHING ACROSS A CLEAR. It is queued behind loads and runs, so
782
+ * it can come due after `dispose()` or while the data it started on is being cleared. Either
783
+ * one stops it, quietly: the graph it was painting is gone, and that is not an error.
784
+ * @param signal - The queue operation's own signal, when it runs as one.
785
+ * @returns True when the whole graph was painted, false when there was nothing to paint with
786
+ * or the pass was stopped.
718
787
  */
719
788
  private repaintFromSession;
720
789
  /**
@@ -984,7 +1053,9 @@ export declare class Graph implements GraphContext {
984
1053
  * Set whether the layout engine should run.
985
1054
  *
986
1055
  * Resuming a simulation layout that had settled restarts it, so "play" moves nodes again;
987
- * pausing stops the per-frame stepping and nothing else.
1056
+ * pausing stops the per-frame stepping and nothing else. A pause holds until
1057
+ * `setRunning(true)`: loading data, setting a layout, an accelerator attaching or a drag
1058
+ * never resume it.
988
1059
  * @param running - True to start the layout, false to stop it
989
1060
  */
990
1061
  setRunning(running: boolean): void;
@@ -1552,7 +1623,8 @@ export declare class Graph implements GraphContext {
1552
1623
  * Set graph data (delegates to data manager)
1553
1624
  * @param data - Graph data object
1554
1625
  * @param data.nodes - Array of node data objects
1555
- * @param data.edges - Array of edge data objects
1626
+ * @param data.edges - Array of edge data objects. They load as one batch, so the endpoint
1627
+ * spelling (source/target, src/dst or from/to) is decided once for all of them.
1556
1628
  */
1557
1629
  setData(data: {
1558
1630
  nodes: Record<string, unknown>[];
@@ -82,7 +82,11 @@ type AccelerationOutcome<T> = {
82
82
  interface AccelerationControllerOptions {
83
83
  /** What the consumer asked for. Defaults to `"auto"`. */
84
84
  readonly policy?: AccelerationPolicy;
85
- /** The `acceleration.minNodes` threshold. Defaults to 0: accelerate whenever possible. */
85
+ /**
86
+ * The `acceleration.minNodes` threshold. Left out, the general threshold is 0 and the
87
+ * built-in per-capability floors of {@link ACCELERATION_MIN_NODES_BY_CAPABILITY} apply; any
88
+ * value, including 0, is the consumer's own number and switches those floors off.
89
+ */
86
90
  readonly minNodes?: number;
87
91
  /** The largest graph an accelerator will be asked to compute exactly, passed to the factory. */
88
92
  readonly exactMaxNodes?: number;
@@ -186,6 +190,12 @@ export declare class AccelerationController {
186
190
  *
187
191
  * Switching to `"off"` releases the accelerator, because holding a device nobody is allowed
188
192
  * to use is a cost with no benefit. Switching back to `"auto"` or `"required"` probes again.
193
+ * Leaving `"required"` releases a software accelerator, which only `"required"` accepts, and
194
+ * probes again.
195
+ *
196
+ * A no-op on a disposed controller, rather than a throw: the element forwards its
197
+ * `acceleration` attribute here from `attributeChangedCallback`, where a throw would leave the
198
+ * element unrendered, and a probe nobody can hear would request a device for nothing.
189
199
  * @param policy - The new policy.
190
200
  */
191
201
  setPolicy(policy: AccelerationPolicy): void;
@@ -223,9 +233,10 @@ export declare class AccelerationController {
223
233
  /**
224
234
  * Decides where one piece of work runs, before any of it starts.
225
235
  *
226
- * The decision is the only place a CPU answer can come from, and there are four of them:
236
+ * The decision is the only place a CPU answer can come from, and there are five of them:
227
237
  * the policy is `"off"`, no accelerator is attached, the graph is below
228
- * `acceleration.minNodes`, or the attached accelerator does not implement this capability.
238
+ * `acceleration.minNodes`, the graph is below the built-in floor measured for this
239
+ * capability, or the attached accelerator does not implement this capability.
229
240
  *
230
241
  * Under `"required"` two of them throw instead of answering quietly -- no accelerator, and
231
242
  * an accelerator without this capability -- because both are absence, and absence is what
@@ -233,6 +244,12 @@ export declare class AccelerationController {
233
244
  * runs on the CPU: an accelerator IS attached and healthy, and the threshold is a statement
234
245
  * about what pays, not about what is possible. `"off"` cannot arise under `"required"`,
235
246
  * because a policy is one of three.
247
+ *
248
+ * The built-in floor is different from the threshold in both directions. It applies only
249
+ * while the consumer has NOT set `acceleration.minNodes` -- a consumer's number, even 0,
250
+ * replaces it -- and it does NOT apply under `"required"`, because `"required"` is the
251
+ * policy a benchmark runs under and a benchmark of the small end of the curve must be able to
252
+ * reach the device.
236
253
  * @param work - The capability the work needs and the size of the graph it is over.
237
254
  * @returns Where the work runs.
238
255
  * @throws A `GraphtyError` with `E_NO_ACCELERATOR` when the policy is `"required"` and the
@@ -92,6 +92,9 @@ export declare class AcceleratorRegistry {
92
92
  /**
93
93
  * The registry the element uses when it is not given another, and the one the `./webgpu` entry
94
94
  * point registers into.
95
+ *
96
+ * One per page rather than one per copy of graphty-element, so the `./webgpu` entry reaches the
97
+ * element whichever copy defined it.
95
98
  */
96
99
  export declare const acceleratorRegistry: AcceleratorRegistry;
97
100
  /**