@graphty/graphty-element 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/AGENTS.md +4 -3
  2. package/dist/ai.js +115 -222
  3. package/dist/catalog.js +46 -44
  4. package/dist/chunks/{AiManager-Bd_r1Hei.js → AiManager-BD9XK30e.js} +793 -654
  5. package/dist/chunks/{DataSource-bt0DhBjG.js → DataSource-B8vf2uhW.js} +3 -3
  6. package/dist/chunks/{GraphSession-iNyKm7Ds.js → GraphSession-dcwOjGJh.js} +3028 -2918
  7. package/dist/chunks/{GraphStyle-D0PXnZKu.js → GraphStyle-Cwr55SAE.js} +5 -2
  8. package/dist/chunks/{GraphtyError-BwcnblTH.js → GraphtyError-B93WRH3e.js} +8 -6
  9. package/dist/chunks/{GraphtyLogger-5KEttFUo.js → GraphtyLogger-CqOVV13Y.js} +2 -2
  10. package/dist/chunks/{NodeStyle-DKj7HjMJ.js → NodeStyle-CtmA7dXi.js} +16 -14
  11. package/dist/chunks/{VoiceInputAdapter-DszYl6Ha.js → VoiceInputAdapter-D0tHHi9G.js} +1 -1
  12. package/dist/chunks/{XRPivotCameraController-XtxbbZ-D.js → XRPivotCameraController-DTfhvhHz.js} +2 -2
  13. package/dist/chunks/algorithms-BF0X6RPw.js +3627 -0
  14. package/dist/chunks/{capability-check-BqIEXcun.js → capability-check-BJzlK4oL.js} +1 -1
  15. package/dist/chunks/{detect-DM29BEaB.js → detect-vJxK7n0D.js} +2 -2
  16. package/dist/chunks/{format-detection-BEdmtvsy.js → format-detection-C80TLQ2e.js} +1 -1
  17. package/dist/chunks/{index-CD0_RJv-.js → index-2xkq7wyD.js} +11482 -10971
  18. package/dist/chunks/optionsFromZod-BuTOFgVM.js +2572 -0
  19. package/dist/chunks/paletteRegistry-A63C71Gn.js +1155 -0
  20. package/dist/chunks/{registry-CSba5QGJ.js → registry-jB46Gmeb.js} +1 -1
  21. package/dist/chunks/scales-B2d-7Bf0.js +3220 -0
  22. package/dist/chunks/{types-B7bX5c0K.js → types-C_c53VgR.js} +31 -26
  23. package/dist/commands.d.ts +4 -0
  24. package/dist/custom-elements.json +1 -1
  25. package/dist/extend.js +45 -45
  26. package/dist/graphty-catalog.json +245 -12
  27. package/dist/graphty.bundle.js +40762 -39403
  28. package/dist/graphty.js +33 -33
  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.d.ts +1 -1
  33. package/dist/session.js +29 -30
  34. package/dist/src/Graph.d.ts +112 -10
  35. package/dist/src/acceleration/AccelerationController.d.ts +14 -3
  36. package/dist/src/acceleration/types.d.ts +78 -0
  37. package/dist/src/algorithms/KCoreAlgorithm.d.ts +26 -0
  38. package/dist/src/algorithms/LinkPredictionAlgorithm.d.ts +41 -0
  39. package/dist/src/camera/builtins.d.ts +14 -1
  40. package/dist/src/camera/types.d.ts +7 -0
  41. package/dist/src/cameras/CameraManager.d.ts +13 -0
  42. package/dist/src/cameras/OrbitCameraController.d.ts +9 -0
  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/types.d.ts +87 -6
  47. package/dist/src/config/EdgeStyle.d.ts +35 -0
  48. package/dist/src/config/GraphStyle.d.ts +5 -1
  49. package/dist/src/config/StyleTemplate.d.ts +2 -2
  50. package/dist/src/config/index.d.ts +1 -1
  51. package/dist/src/data/GEXFDataSource.d.ts +23 -0
  52. package/dist/src/errors/codes.d.ts +14 -0
  53. package/dist/src/events.d.ts +30 -0
  54. package/dist/src/graphty-element.d.ts +77 -32
  55. package/dist/src/layout/GridLayoutEngine.d.ts +37 -0
  56. package/dist/src/layout/LayoutEngine.d.ts +7 -7
  57. package/dist/src/layout/NGraphLayoutEngine.d.ts +2 -0
  58. package/dist/src/layout/RadialLayoutEngine.d.ts +37 -0
  59. package/dist/src/layout/SimulationLayoutEngine.d.ts +12 -0
  60. package/dist/src/managers/DataManager.d.ts +69 -2
  61. package/dist/src/managers/EventManager.d.ts +10 -4
  62. package/dist/src/managers/GraphContext.d.ts +2 -1
  63. package/dist/src/managers/LayoutManager.d.ts +30 -3
  64. package/dist/src/managers/StylePainter.d.ts +9 -0
  65. package/dist/src/managers/UpdateManager.d.ts +5 -0
  66. package/dist/src/meshes/MeshCache.d.ts +18 -0
  67. package/dist/src/meshes/NodeEffects.d.ts +16 -11
  68. package/dist/src/meshes/NodeMesh.d.ts +2 -2
  69. package/dist/src/meshes/RichTextParser.d.ts +26 -0
  70. package/dist/src/meshes/RichTextRenderer.d.ts +0 -1
  71. package/dist/src/session/cost/estimate.d.ts +1 -1
  72. package/dist/src/session/layout.d.ts +3 -3
  73. package/dist/src/session/results/index.d.ts +1 -1
  74. package/dist/src/session/results/statistics.d.ts +8 -1
  75. package/dist/src/session/results/types.d.ts +33 -0
  76. package/dist/src/session/runs/RunsApi.d.ts +1 -1
  77. package/dist/src/session/selection/targets.d.ts +4 -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/predicate.d.ts +26 -1
  81. package/dist/src/session/styles/repaint.d.ts +13 -1
  82. package/dist/src/session/styles/selector.d.ts +13 -1
  83. package/dist/src/session/styles/sources.d.ts +9 -0
  84. package/dist/src/session/types.d.ts +6 -6
  85. package/dist/webgpu.js +2 -2
  86. package/package.json +6 -6
  87. package/dist/chunks/Algorithm-RQ629NLb.js +0 -494
  88. package/dist/chunks/cameras-ii4vngYY.js +0 -435
  89. package/dist/chunks/paletteRegistry-DnWHQsAD.js +0 -3166
  90. package/dist/chunks/scales-DyuwlJKI.js +0 -6087
package/dist/graphty.js CHANGED
@@ -1,62 +1,62 @@
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 t, L, 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 l } from "./chunks/index-CD0_RJv-.js";
2
- import { a as p, S as G, b as f } from "./chunks/paletteRegistry-DnWHQsAD.js";
3
- import { D as y, E as D } from "./chunks/DataSource-bt0DhBjG.js";
4
- import { k as P, l as U, g as c, h as m, A as u, C as x, i as B } from "./chunks/Algorithm-RQ629NLb.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 v, b as w, c as Q } from "./chunks/NodeStyle-DKj7HjMJ.js";
6
- import { A as j, a as q, G as z, i as J, 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 ta, P as La, 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 la, G as da, V as pa, i as Ga } from "./chunks/GraphStyle-D0PXnZKu.js";
9
- import { c as ha } from "./chunks/common-DWNKjpH_.js";
1
+ import { A as e, a as r, b as E, 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-2xkq7wyD.js";
2
+ import { L as l, S as G, a as f } from "./chunks/paletteRegistry-A63C71Gn.js";
3
+ import { D, E as M } from "./chunks/DataSource-B8vf2uhW.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-BuTOFgVM.js";
5
+ import { g as H, b, N as Y, c as F, P as W, R as K, S as k, d as q, e as v, f as w } from "./chunks/NodeStyle-CtmA7dXi.js";
6
+ import { A as Q, a as X, G as j, i as z, b as Z } from "./chunks/GraphtyError-B93WRH3e.js";
7
+ import { B as aa, a as sa, b as ea, C as ra, G as Ea, 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";
10
10
  export {
11
- j as ACCELERATION_ERROR_CODES,
11
+ Q as ACCELERATION_ERROR_CODES,
12
12
  P as ACCELERATION_MIN_NODES_DEFAULT,
13
13
  U as ACCELERATION_MIN_NODES_KEY,
14
14
  c as ACCELERATION_POLICIES,
15
15
  m as ACCELERATION_POLICY_DEFAULT,
16
16
  u as Algorithm,
17
17
  e as AlgorithmManager,
18
- E as AnimationCancelledError,
18
+ r as AnimationCancelledError,
19
19
  aa as BLUES_COLORS,
20
20
  sa as BLUE_HIGHLIGHT,
21
21
  ea as BLUE_ORANGE_COLORS,
22
- r as BUILTIN_PRESETS,
23
- Ea as CARBON_COLORS,
22
+ E as BUILTIN_PRESETS,
23
+ ra as CARBON_COLORS,
24
24
  x as CPU_PRECISION,
25
- la as DEFAULT_VIEW_MODE,
25
+ pa as DEFAULT_VIEW_MODE,
26
26
  O as DataManager,
27
- y as DataSource,
27
+ D as DataSource,
28
28
  H as EDGE_CONSTANTS,
29
29
  o as Edge,
30
30
  b as EdgeStyle,
31
- D as ErrorAggregator,
31
+ M as ErrorAggregator,
32
32
  S as EventManager,
33
- q as GRAPHTY_ERROR_CODES,
34
- ra as GREENS_COLORS,
33
+ X as GRAPHTY_ERROR_CODES,
34
+ Ea as GREENS_COLORS,
35
35
  Oa as GREEN_SUCCESS,
36
36
  R as Graph,
37
37
  da as GraphBackground,
38
38
  _ as Graphty,
39
- z as GraphtyError,
39
+ j as GraphtyError,
40
40
  oa as INFERNO_COLORS,
41
- t as InputManager,
42
- p as LayoutEngine,
43
- L as LayoutManager,
41
+ L as InputManager,
42
+ l as LayoutEngine,
43
+ t as LayoutManager,
44
44
  C as Node,
45
45
  Y as NodeShapes,
46
46
  F as NodeStyle,
47
47
  Sa as OKABE_ITO_COLORS,
48
48
  Ra as ORANGES_COLORS,
49
49
  _a as ORANGE_WARNING,
50
- ta as OTHER_GROUP_COLOR,
50
+ La as OTHER_GROUP_COLOR,
51
51
  A as OperationQueueManager,
52
- La as PASTEL_COLORS,
52
+ ta as PASTEL_COLORS,
53
53
  Ca as PLASMA_COLORS,
54
54
  Aa as PURPLE_GREEN_COLORS,
55
55
  W as PolyhedronType,
56
56
  Na as RED_BLUE_COLORS,
57
57
  N as RenderManager,
58
- k as RichTextStyle,
59
- K as SHAPE_CONSTANTS,
58
+ K as RichTextStyle,
59
+ k as SHAPE_CONSTANTS,
60
60
  n as ScreenshotError,
61
61
  I as ScreenshotErrorCode,
62
62
  T as SelectionManager,
@@ -66,16 +66,16 @@ export {
66
66
  na as TOL_MUTED_COLORS,
67
67
  Ia as TOL_VIBRANT_COLORS,
68
68
  i as UpdateManager,
69
- pa as VIEW_MODE_VALUES,
69
+ la as VIEW_MODE_VALUES,
70
70
  Ta as VIRIDIS_COLORS,
71
71
  ga as YLORBR_COLORS,
72
- ha as colorToHex,
73
- v as defaultEdgeStyle,
74
- w as defaultNodeStyle,
75
- Q as defaultRichTextLabelStyle,
76
- l as defaultXRConfig,
72
+ ya as colorToHex,
73
+ q as defaultEdgeStyle,
74
+ v as defaultNodeStyle,
75
+ w as defaultRichTextLabelStyle,
76
+ p as defaultXRConfig,
77
77
  B as isAccelerationPolicy,
78
- J as isGraphtyError,
78
+ z as isGraphtyError,
79
79
  Z as isGraphtyErrorCode,
80
80
  Ga as isViewMode
81
81
  };
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-CqOVV13Y.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-CqOVV13Y.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-D0PXnZKu.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.d.ts CHANGED
@@ -78,7 +78,7 @@ export type { LayoutRecommendation, LayoutRecommendationOptions } from "./src/se
78
78
  export { recommendLayout } from "./src/session";
79
79
  export type { BatchResult, BatchStep, Caveats, EngineVersions, Precision, Progress, QueueEntry, QueuePolicy, ResolvedScope, Run, RunChange, RunDirection, RunExecutionContext, RunExecutor, RunOptions, RunOutcome, RunPhase, RunProgressReport, RunQueue, RunRecord, RunRemoval, RunsApi, RunScopeRecord, RunSpec, RunStatus, RunStyle, StaleNote, StartOptions, WeightMeaning, } from "./src/session/runs";
80
80
  export { isRunId, isRunStatus, isTerminalRunStatus, QUEUE_POLICIES, RUN_ID_PATTERN, RUN_PHASES, RUN_STATUSES, TERMINAL_RUN_STATUSES, } from "./src/session/runs";
81
- export type { Histogram, HistogramBin, HistogramBinning, HistogramOptions, Normalization, NumericColumnView, RankingEntry, ReadingOptions, ResultsApi, ResultSummary, RunRef, RunResult, SummaryEntry, SummaryGroup, } from "./src/session/results";
81
+ export type { Histogram, HistogramBin, HistogramBinning, HistogramOptions, Normalization, NumericColumnView, RankingEntry, ReadingOptions, ResultsApi, ResultSummary, RunRef, RunResult, SummaryEntry, SummaryGroup, TopRanking, } from "./src/session/results";
82
82
  export { defaultReading, RESULT_FIELD_NAMES, RESULT_ROOT, RESULT_SHAPE_CONTRACTS, resultPath } from "./src/session/results";
83
83
  export type { SavedScope, ScopeApi, ScopeCount, ScopeCountOptions } from "./src/session/scope";
84
84
  export { DEFAULT_SCOPE_SAMPLE } from "./src/session/scope";
package/dist/session.js CHANGED
@@ -1,10 +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 g } from "./chunks/GraphtyError-BwcnblTH.js";
3
- import { g as O, h as U, i as I } from "./chunks/Algorithm-RQ629NLb.js";
4
- import { D as h } from "./chunks/GraphSession-iNyKm7Ds.js";
5
- import { a as N, b as y, c as D, d as v, Q as w, R as G, e as b, f as x, S as F, T as M, g as z, i as k, h as H, j as Y, k as j } from "./chunks/GraphSession-iNyKm7Ds.js";
6
- import { R as Q, t as X, u as B, v as J, w as K, x as V } from "./chunks/paletteRegistry-DnWHQsAD.js";
7
- import { L as s } from "./chunks/scales-DyuwlJKI.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/GraphtyError-B93WRH3e.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-BuTOFgVM.js";
4
+ import { D as h } from "./chunks/GraphSession-dcwOjGJh.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-dcwOjGJh.js";
6
+ import { L as s } from "./chunks/scales-B2d-7Bf0.js";
8
7
  const u = [
9
8
  {
10
9
  id: "fixed",
@@ -53,34 +52,34 @@ export {
53
52
  c as ACCELERATION_ERROR_CODES,
54
53
  O as ACCELERATION_POLICIES,
55
54
  U as ACCELERATION_POLICY_DEFAULT,
56
- N as DEFAULT_COST_GATE_LIMITS,
57
- y as DEFAULT_EXACT_COMPUTATION_CAP_SECONDS,
55
+ b as DEFAULT_COST_GATE_LIMITS,
56
+ x as DEFAULT_EXACT_COMPUTATION_CAP_SECONDS,
58
57
  h as DEFAULT_LIMITS,
59
- D as DEFAULT_SCOPE_SAMPLE,
60
- v as DEFAULT_SELECTION_CAP,
58
+ F as DEFAULT_SCOPE_SAMPLE,
59
+ z as DEFAULT_SELECTION_CAP,
61
60
  C as GRAPHTY_ERROR_CODES,
62
61
  p as GraphtyError,
63
- w as QUEUE_POLICIES,
64
- Q as RESULT_FIELD_NAMES,
65
- X as RESULT_ROOT,
62
+ M as QUEUE_POLICIES,
63
+ I as RESULT_FIELD_NAMES,
64
+ P as RESULT_ROOT,
66
65
  R as RESULT_SHAPES,
67
- B as RESULT_SHAPE_CONTRACTS,
68
- G as RUN_ID_PATTERN,
69
- b as RUN_PHASES,
70
- x as RUN_STATUSES,
71
- F as SET_OPS,
72
- M as TERMINAL_RUN_STATUSES,
73
- z as createGraphSession,
74
- J as defaultReading,
75
- I as isAccelerationPolicy,
76
- k as isAlgorithmRunCommand,
66
+ y as RESULT_SHAPE_CONTRACTS,
67
+ k as RUN_ID_PATTERN,
68
+ H as RUN_PHASES,
69
+ Y as RUN_STATUSES,
70
+ j as SET_OPS,
71
+ q as TERMINAL_RUN_STATUSES,
72
+ Q as createGraphSession,
73
+ N as defaultReading,
74
+ D as isAccelerationPolicy,
75
+ X as isAlgorithmRunCommand,
77
76
  m as isGraphtyError,
78
- g as isGraphtyErrorCode,
77
+ L as isGraphtyErrorCode,
79
78
  _ as isResultShape,
80
- H as isRunId,
81
- Y as isRunStatus,
82
- j as isTerminalRunStatus,
83
- K as quotePath,
79
+ B as isRunId,
80
+ J as isRunStatus,
81
+ K as isTerminalRunStatus,
82
+ w as quotePath,
84
83
  T as recommendLayout,
85
- V as resultPath
84
+ v as resultPath
86
85
  };
@@ -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
@@ -558,9 +621,17 @@ export declare class Graph implements GraphContext {
558
621
  [key: string]: unknown;
559
622
  }[], options?: QueueableOptions): Promise<void>;
560
623
  /**
561
- * Set the active camera mode (e.g., "arcRotate", "universal").
562
- * @param mode - Camera mode key to activate
624
+ * Activate the camera that belongs to the current view mode: `"2d"` in 2D, `"orbit"` in 3D.
625
+ *
626
+ * A camera belongs to one view mode, and switching between them is `setViewMode`'s job: it
627
+ * also rebuilds the meshes and the layout for the new mode. A camera from the other mode is
628
+ * refused rather than activated, because activating it would leave the scene drawing through
629
+ * one mode's camera while recording the other, and `setViewMode` would then take the scene
630
+ * for already being where it was asked to go.
631
+ * @param mode - Camera key to activate
563
632
  * @param options - Queue options for operation ordering
633
+ * @throws A `GraphtyError` with `E_BAD_COMMAND` when the camera does not belong to the view
634
+ * mode the graph is in (or is going to, once queued view-mode changes run).
564
635
  */
565
636
  setCameraMode(mode: CameraKey, options?: QueueableOptions): Promise<void>;
566
637
  /**
@@ -706,7 +777,13 @@ export declare class Graph implements GraphContext {
706
777
  *
707
778
  * It does nothing while no style pass is bound: a pass whose answer nothing draws is a pass
708
779
  * over the graph for no picture.
709
- * @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.
710
787
  */
711
788
  private repaintFromSession;
712
789
  /**
@@ -900,6 +977,27 @@ export declare class Graph implements GraphContext {
900
977
  * the session begins when a consumer calls `setViewMode` from a click.
901
978
  */
902
979
  private applyOpeningViewMode;
980
+ /**
981
+ * Frame the graph on the element's own initiative -- after a data load, a new layout, or the
982
+ * first settlement -- unless the configuration placed the camera itself with
983
+ * `startingCameraDistance`. An explicit `zoomToFit()` is not affected.
984
+ */
985
+ private autoFrame;
986
+ /**
987
+ * Set how far the camera stands from the graph, and stop the element framing the graph on its
988
+ * own. Undefined hands framing back to zoom-to-fit.
989
+ *
990
+ * The 3D orbit camera is moved to the distance (floored at its minimum zoom distance). The 2D
991
+ * camera's half-width becomes the half-extent the 3D camera's field of view covers at that
992
+ * distance, so switching view mode keeps a comparable framing.
993
+ * @param distance - The distance, in scene units, or undefined for automatic framing.
994
+ * @throws A `GraphtyError` with `E_OPTION_RANGE` when the distance is not a finite number.
995
+ */
996
+ setStartingCameraDistance(distance: number | undefined): void;
997
+ /**
998
+ * Place both cameras from the configured `startingCameraDistance`, when there is one.
999
+ */
1000
+ private applyStartingCameraDistance;
903
1001
  /**
904
1002
  * Set the view mode.
905
1003
  * This controls the camera type, input handling, and rendering approach.
@@ -955,7 +1053,9 @@ export declare class Graph implements GraphContext {
955
1053
  * Set whether the layout engine should run.
956
1054
  *
957
1055
  * Resuming a simulation layout that had settled restarts it, so "play" moves nodes again;
958
- * 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.
959
1059
  * @param running - True to start the layout, false to stop it
960
1060
  */
961
1061
  setRunning(running: boolean): void;
@@ -1340,8 +1440,9 @@ export declare class Graph implements GraphContext {
1340
1440
  * Required because cameraDistance is not a scene node property
1341
1441
  * @param orbitController - Orbit camera controller instance
1342
1442
  * @param orbitController.cameraDistance - Current camera distance from pivot
1443
+ * @param orbitController.clampDistance - The controller's distance rule (the zoom floor)
1343
1444
  * @param orbitController.updateCameraPosition - Function to update camera position
1344
- * @param targetDistance - Target camera distance to animate to
1445
+ * @param requestedDistance - Camera distance to animate to, before the zoom floor applies
1345
1446
  * @param frameCount - Number of frames for the animation
1346
1447
  * @param fps - Frames per second for the animation
1347
1448
  * @param easing - Optional easing function name
@@ -1522,7 +1623,8 @@ export declare class Graph implements GraphContext {
1522
1623
  * Set graph data (delegates to data manager)
1523
1624
  * @param data - Graph data object
1524
1625
  * @param data.nodes - Array of node data objects
1525
- * @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.
1526
1628
  */
1527
1629
  setData(data: {
1528
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;
@@ -223,9 +227,10 @@ export declare class AccelerationController {
223
227
  /**
224
228
  * Decides where one piece of work runs, before any of it starts.
225
229
  *
226
- * The decision is the only place a CPU answer can come from, and there are four of them:
230
+ * The decision is the only place a CPU answer can come from, and there are five of them:
227
231
  * the policy is `"off"`, no accelerator is attached, the graph is below
228
- * `acceleration.minNodes`, or the attached accelerator does not implement this capability.
232
+ * `acceleration.minNodes`, the graph is below the built-in floor measured for this
233
+ * capability, or the attached accelerator does not implement this capability.
229
234
  *
230
235
  * Under `"required"` two of them throw instead of answering quietly -- no accelerator, and
231
236
  * an accelerator without this capability -- because both are absence, and absence is what
@@ -233,6 +238,12 @@ export declare class AccelerationController {
233
238
  * runs on the CPU: an accelerator IS attached and healthy, and the threshold is a statement
234
239
  * about what pays, not about what is possible. `"off"` cannot arise under `"required"`,
235
240
  * because a policy is one of three.
241
+ *
242
+ * The built-in floor is different from the threshold in both directions. It applies only
243
+ * while the consumer has NOT set `acceleration.minNodes` -- a consumer's number, even 0,
244
+ * replaces it -- and it does NOT apply under `"required"`, because `"required"` is the
245
+ * policy a benchmark runs under and a benchmark of the small end of the curve must be able to
246
+ * reach the device.
236
247
  * @param work - The capability the work needs and the size of the graph it is over.
237
248
  * @returns Where the work runs.
238
249
  * @throws A `GraphtyError` with `E_NO_ACCELERATOR` when the policy is `"required"` and the