@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
package/dist/graphty.js CHANGED
@@ -1,79 +1,81 @@
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 t, I as _, L, N as C, O as A, R as N, S as n, f as g, g as T, h as p, U as I, i as d } from "./chunks/index-uohvGegX.js";
2
- import { a as G, S as l, b as f } from "./chunks/paletteRegistry-B-oS4YxP.js";
3
- import { D as h, E as y } from "./chunks/DataSource-DK4GZBKg.js";
4
- import { A as m } from "./chunks/Algorithm-BdcqHKps.js";
5
- import { e as u, E as x, N as P, a as c, P as B, R as V, S as H, d as b, b as Y, c as F } from "./chunks/NodeStyle-CS7dj20m.js";
6
- import { A as K, a as k, G as v, i as w, b as Q } from "./chunks/GraphtyError-B3eKs4yg.js";
7
- import { A as j, a as q, C as z } from "./chunks/types-Dwm9waL2.js";
8
- import { B as Z, a as $, b as aa, C as sa, G as ea, c as ra, I as Ea, O as Oa, d as oa, e as Sa, f as Ra, P as ta, g as _a, h as La, R as Ca, T as Aa, i as Na, V as na, Y as ga } from "./chunks/sequential-Zym81qm7.js";
9
- import { a as pa, G as Ia, V as da, i as ia } from "./chunks/GraphStyle-D0PXnZKu.js";
10
- import { c as la } from "./chunks/common-DWNKjpH_.js";
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-Cz47b_vU.js";
2
+ import { a as p, S as G, b as f } from "./chunks/paletteRegistry-NrWOKT-A.js";
3
+ import { D as y, E as D } from "./chunks/DataSource-DEg3igzS.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-Cup9O1lu.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";
11
10
  export {
12
- K as ACCELERATION_ERROR_CODES,
13
- j as ACCELERATION_MIN_NODES_DEFAULT,
14
- q as ACCELERATION_MIN_NODES_KEY,
15
- m as Algorithm,
11
+ j as ACCELERATION_ERROR_CODES,
12
+ P as ACCELERATION_MIN_NODES_DEFAULT,
13
+ U as ACCELERATION_MIN_NODES_KEY,
14
+ c as ACCELERATION_POLICIES,
15
+ m as ACCELERATION_POLICY_DEFAULT,
16
+ u as Algorithm,
16
17
  e as AlgorithmManager,
17
- r as AnimationCancelledError,
18
- Z as BLUES_COLORS,
19
- $ as BLUE_HIGHLIGHT,
20
- aa as BLUE_ORANGE_COLORS,
21
- E as BUILTIN_PRESETS,
22
- sa as CARBON_COLORS,
23
- z as CPU_PRECISION,
24
- pa as DEFAULT_VIEW_MODE,
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
+ la as DEFAULT_VIEW_MODE,
25
26
  O as DataManager,
26
- h as DataSource,
27
- u as EDGE_CONSTANTS,
27
+ y as DataSource,
28
+ H as EDGE_CONSTANTS,
28
29
  o as Edge,
29
- x as EdgeStyle,
30
- y as ErrorAggregator,
30
+ b as EdgeStyle,
31
+ D as ErrorAggregator,
31
32
  S as EventManager,
32
- k as GRAPHTY_ERROR_CODES,
33
- ea as GREENS_COLORS,
34
- ra as GREEN_SUCCESS,
33
+ q as GRAPHTY_ERROR_CODES,
34
+ ra as GREENS_COLORS,
35
+ Oa as GREEN_SUCCESS,
35
36
  R as Graph,
36
- Ia as GraphBackground,
37
- t as Graphty,
38
- v as GraphtyError,
39
- Ea as INFERNO_COLORS,
40
- _ as InputManager,
41
- G as LayoutEngine,
37
+ da as GraphBackground,
38
+ _ as Graphty,
39
+ z as GraphtyError,
40
+ oa as INFERNO_COLORS,
41
+ t as InputManager,
42
+ p as LayoutEngine,
42
43
  L as LayoutManager,
43
44
  C as Node,
44
- P as NodeShapes,
45
- c as NodeStyle,
46
- Oa as OKABE_ITO_COLORS,
47
- oa as ORANGES_COLORS,
48
- Sa as ORANGE_WARNING,
49
- Ra as OTHER_GROUP_COLOR,
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
+ ta as OTHER_GROUP_COLOR,
50
51
  A as OperationQueueManager,
51
- ta as PASTEL_COLORS,
52
- _a as PLASMA_COLORS,
53
- La as PURPLE_GREEN_COLORS,
54
- B as PolyhedronType,
55
- Ca as RED_BLUE_COLORS,
52
+ La as PASTEL_COLORS,
53
+ Ca as PLASMA_COLORS,
54
+ Aa as PURPLE_GREEN_COLORS,
55
+ W as PolyhedronType,
56
+ Na as RED_BLUE_COLORS,
56
57
  N as RenderManager,
57
- V as RichTextStyle,
58
- H as SHAPE_CONSTANTS,
58
+ k as RichTextStyle,
59
+ K as SHAPE_CONSTANTS,
59
60
  n as ScreenshotError,
60
- g as ScreenshotErrorCode,
61
+ I as ScreenshotErrorCode,
61
62
  T as SelectionManager,
62
- l as SimpleLayoutConfig,
63
+ G as SimpleLayoutConfig,
63
64
  f as SimpleLayoutEngine,
64
- p as StatsManager,
65
- Aa as TOL_MUTED_COLORS,
66
- Na as TOL_VIBRANT_COLORS,
67
- I as UpdateManager,
68
- da as VIEW_MODE_VALUES,
69
- na as VIRIDIS_COLORS,
65
+ g as StatsManager,
66
+ na as TOL_MUTED_COLORS,
67
+ Ia as TOL_VIBRANT_COLORS,
68
+ i as UpdateManager,
69
+ pa as VIEW_MODE_VALUES,
70
+ Ta as VIRIDIS_COLORS,
70
71
  ga as YLORBR_COLORS,
71
- la as colorToHex,
72
- b as defaultEdgeStyle,
73
- Y as defaultNodeStyle,
74
- F as defaultRichTextLabelStyle,
75
- d as defaultXRConfig,
76
- w as isGraphtyError,
77
- Q as isGraphtyErrorCode,
78
- ia as isViewMode
72
+ ha as colorToHex,
73
+ v as defaultEdgeStyle,
74
+ w as defaultNodeStyle,
75
+ Q as defaultRichTextLabelStyle,
76
+ l as defaultXRConfig,
77
+ B as isAccelerationPolicy,
78
+ J as isGraphtyError,
79
+ Z as isGraphtyErrorCode,
80
+ Ga as isViewMode
79
81
  };
package/dist/index.d.ts CHANGED
@@ -70,4 +70,4 @@ export { BUILTIN_PRESETS } from "./src/camera/presets";
70
70
  export type { AccelerationErrorCode, GraphtyErrorCode, GraphtyErrorInit, GraphtyErrorJson, GraphtyErrorSource, GraphtyErrorTarget, } from "./src/errors";
71
71
  export { ACCELERATION_ERROR_CODES, GRAPHTY_ERROR_CODES, GraphtyError, isGraphtyError, isGraphtyErrorCode, } from "./src/errors";
72
72
  export type { AccelerationCapabilities, AccelerationPolicy, AccelerationPrecision, AccelerationState, AccelerationStatus, AcceleratorDeviceInfo, AcceleratorFactory, AcceleratorFactoryOptions, CalibrationRecord, Capabilities, CaptureCapability, GraphAccelerator, Limits, WorkerCapability, XrCapability, } from "./src/acceleration";
73
- export { ACCELERATION_MIN_NODES_DEFAULT, ACCELERATION_MIN_NODES_KEY, CPU_PRECISION } from "./src/acceleration";
73
+ export { ACCELERATION_MIN_NODES_DEFAULT, ACCELERATION_MIN_NODES_KEY, ACCELERATION_POLICIES, ACCELERATION_POLICY_DEFAULT, CPU_PRECISION, isAccelerationPolicy, } from "./src/acceleration";
package/dist/logging.js CHANGED
@@ -1,5 +1,5 @@
1
- import { d as c, p } from "./chunks/GraphtyLogger-CK03SnJi.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-CK03SnJi.js";
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";
3
3
  const g = "graphty-element-logging-config";
4
4
  function O(t) {
5
5
  try {
package/dist/schema.js CHANGED
@@ -2,7 +2,7 @@ import { R as N, e as x } from "./chunks/types-B7bX5c0K.js";
2
2
  import { M as A, h as y, i as M } from "./chunks/interpolation-DY-PNpqX.js";
3
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
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-CS7dj20m.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-Cup9O1lu.js";
6
6
  import { c as ft } 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);
package/dist/session.d.ts CHANGED
@@ -93,7 +93,8 @@ export type { Binding, BindingOverflow, Channel, EdgeId, Encoding, FieldDescript
93
93
  export { isResultShape, RESULT_SHAPES } from "./src/catalog/types";
94
94
  export type { ChannelExplanation, ElementLayerSpec, EncodingRun, EncodingSpec, ExplainTarget, FieldWords, HighlightSpec, Layer, LayerPosition, LayerProblem, LegendBlock, LegendSwatch, RepaintReason, RepaintReport, SessionStylesApi, StyleChange, StyleContribution, StyleExplanation, StylesApi, TemplateOptions, TemplateReport, UnboundLayer, ValidationResult, } from "./src/session/styles";
95
95
  export { quotePath } from "./src/session/styles";
96
- export type { AccelerationCapabilities, AccelerationPolicy, AccelerationState, AccelerationStatus, Capabilities, CaptureCapability, Limits, WorkerCapability, XrCapability, } from "./src/acceleration";
96
+ export type { AccelerationCapabilities, AccelerationPolicy, AccelerationPrecision, AccelerationState, AccelerationStatus, AcceleratorDeviceInfo, Capabilities, CaptureCapability, GraphAccelerator, Limits, WorkerCapability, XrCapability, } from "./src/acceleration";
97
+ export { ACCELERATION_POLICIES, ACCELERATION_POLICY_DEFAULT, isAccelerationPolicy, } from "./src/acceleration";
97
98
  export type { DefaultableLimits } from "./src/session";
98
99
  export { DEFAULT_LIMITS } from "./src/session";
99
100
  export type { AccelerationErrorCode, GraphtyErrorCode, GraphtyErrorInit, GraphtyErrorJson, GraphtyErrorSource, GraphtyErrorTarget, } from "./src/errors";
package/dist/session.js CHANGED
@@ -1,9 +1,10 @@
1
- import { R, e as c } from "./chunks/types-B7bX5c0K.js";
2
- import { A, a as g, G as m, i as C, b as O } from "./chunks/GraphtyError-B3eKs4yg.js";
3
- import { D as h } from "./chunks/GraphSession-D87eymV8.js";
4
- import { a as U, b as y, c as N, Q as I, R as P, d as D, e as w, S as b, T as v, f as G, i as x, g as z, h as F, j as M } from "./chunks/GraphSession-D87eymV8.js";
5
- import { R as H, w as k, x as Y, y as q, z as Q, A as X } from "./chunks/paletteRegistry-B-oS4YxP.js";
6
- import { a as n } from "./chunks/scales-DvGid5Ln.js";
1
+ import { R as A, e as R } from "./chunks/types-B7bX5c0K.js";
2
+ import { A as _, a as C, G as g, i as m, b as L } from "./chunks/GraphtyError-BwcnblTH.js";
3
+ import { g as U, h as I, i as N } from "./chunks/Algorithm-RQ629NLb.js";
4
+ import { D as h } from "./chunks/GraphSession-D3AV8tpF.js";
5
+ import { a as y, b as D, c as w, Q as b, R as v, d as G, e as x, S as z, T as F, f as M, i as j, g as H, h as Y, j as k } from "./chunks/GraphSession-D3AV8tpF.js";
6
+ import { R as Q, w as X, x as B, y as J, z as K, A as V } from "./chunks/paletteRegistry-NrWOKT-A.js";
7
+ import { a as n } from "./chunks/scales-ulKMZPfG.js";
7
8
  const u = Object.freeze({
8
9
  /** Above this node count the element draws less visual detail. A shipped default, not measured. */
9
10
  largeGraphThreshold: 1e4,
@@ -64,34 +65,37 @@ function f(e, a = {}) {
64
65
  });
65
66
  }
66
67
  export {
67
- A as ACCELERATION_ERROR_CODES,
68
- U as DEFAULT_COST_GATE_LIMITS,
69
- y as DEFAULT_EXACT_COMPUTATION_CAP_SECONDS,
68
+ _ as ACCELERATION_ERROR_CODES,
69
+ U as ACCELERATION_POLICIES,
70
+ I as ACCELERATION_POLICY_DEFAULT,
71
+ y as DEFAULT_COST_GATE_LIMITS,
72
+ D as DEFAULT_EXACT_COMPUTATION_CAP_SECONDS,
70
73
  u as DEFAULT_LIMITS,
71
- N as DEFAULT_SCOPE_SAMPLE,
74
+ w as DEFAULT_SCOPE_SAMPLE,
72
75
  h as DEFAULT_SELECTION_CAP,
73
- g as GRAPHTY_ERROR_CODES,
74
- m as GraphtyError,
75
- I as QUEUE_POLICIES,
76
- H as RESULT_FIELD_NAMES,
77
- k as RESULT_ROOT,
78
- R as RESULT_SHAPES,
79
- Y as RESULT_SHAPE_CONTRACTS,
80
- P as RUN_ID_PATTERN,
81
- D as RUN_PHASES,
82
- w as RUN_STATUSES,
83
- b as SET_OPS,
84
- v as TERMINAL_RUN_STATUSES,
85
- G as createGraphSession,
86
- q as defaultReading,
87
- x as isAlgorithmRunCommand,
88
- C as isGraphtyError,
89
- O as isGraphtyErrorCode,
90
- c as isResultShape,
91
- z as isRunId,
92
- F as isRunStatus,
93
- M as isTerminalRunStatus,
94
- Q as quotePath,
76
+ C as GRAPHTY_ERROR_CODES,
77
+ g as GraphtyError,
78
+ b as QUEUE_POLICIES,
79
+ Q as RESULT_FIELD_NAMES,
80
+ X as RESULT_ROOT,
81
+ A as RESULT_SHAPES,
82
+ B as RESULT_SHAPE_CONTRACTS,
83
+ v as RUN_ID_PATTERN,
84
+ G as RUN_PHASES,
85
+ x as RUN_STATUSES,
86
+ z as SET_OPS,
87
+ F as TERMINAL_RUN_STATUSES,
88
+ M as createGraphSession,
89
+ J as defaultReading,
90
+ N as isAccelerationPolicy,
91
+ j as isAlgorithmRunCommand,
92
+ m as isGraphtyError,
93
+ L as isGraphtyErrorCode,
94
+ R as isResultShape,
95
+ H as isRunId,
96
+ Y as isRunStatus,
97
+ k as isTerminalRunStatus,
98
+ K as quotePath,
95
99
  f as recommendLayout,
96
- X as resultPath
100
+ V as resultPath
97
101
  };
@@ -249,7 +249,7 @@ export declare class Edge {
249
249
  * (it disposes a per-element ShaderMaterial that Babylon's default flags would leave behind),
250
250
  * so it is routed to that rather than to `AbstractMesh.dispose`.
251
251
  *
252
- * A DISPOSED EDGE STILL RECEIVES CALLS, which is why {@link Edge.disposed} exists: the layout
252
+ * A DISPOSED EDGE STILL RECEIVES CALLS, which is why {@link Edge.isDisposed} exists: the layout
253
253
  * engine keeps its own edge list and `UpdateManager` walks it every frame regardless of what
254
254
  * DataManager holds. Calling this twice is safe.
255
255
  */
@@ -4,6 +4,7 @@ import "./algorithms/index";
4
4
  import "@babylonjs/core/Culling/ray";
5
5
  import "@babylonjs/core/Animations/animatable";
6
6
  import { AbstractMesh, Engine, Scene, WebGPUEngine, WebXRDefaultExperience } from "@babylonjs/core";
7
+ import { AccelerationController } from "./acceleration";
7
8
  import { VoiceInputAdapter } from "./ai/input/VoiceInputAdapter";
8
9
  import type { ApiKeyManager } from "./ai/keys";
9
10
  import type { CameraState } from "./camera/types.js";
@@ -49,6 +50,16 @@ export declare class Graph implements GraphContext {
49
50
  enableDetailedProfiling?: boolean;
50
51
  private wasSettled;
51
52
  private resizeHandler;
53
+ /**
54
+ * The one acceleration controller this graph, its session and its element share.
55
+ *
56
+ * Built here because it is the earliest owner both the element's `acceleration` attribute and
57
+ * the session can reach: the element builds its Graph in its own constructor, before Lit has
58
+ * parsed an attribute, and the Graph builds the session in its. It is disposed by
59
+ * {@link shutdown}, so it lives and dies with the graph.
60
+ * @since 2.0.0
61
+ */
62
+ readonly acceleration: AccelerationController;
52
63
  /** Event manager for adding/removing event listeners */
53
64
  readonly eventManager: EventManager;
54
65
  private renderManager;
@@ -94,6 +105,20 @@ export declare class Graph implements GraphContext {
94
105
  * Shuts down the graph, stopping animations and disposing all resources.
95
106
  */
96
107
  shutdown(): void;
108
+ /**
109
+ * Frees the accelerator's device buffers for a snapshot the graph has stopped showing.
110
+ *
111
+ * `release` is feature-tested, never required: `GraphAccelerator` declares it through the index
112
+ * signature, so a third party may implement one layout and no residency at all. The undirected
113
+ * copy is released beside the snapshot because that is the copy the device usually holds -- a
114
+ * layout simulation loads the undirected view of every snapshot -- and is skipped when the
115
+ * graph is undirected already, where the two are one object.
116
+ * @param snapshot - The snapshot to release; null before the first freeze, and nothing is done.
117
+ * @param undirected - Its undirected copy, when the caller already holds it. Left out, it is
118
+ * looked up here -- and only once there is something to release it to, so a graph running on
119
+ * the CPU never derives a copy nobody asked for.
120
+ */
121
+ private releaseSnapshot;
97
122
  /**
98
123
  * Executes all algorithms specified in the style template configuration.
99
124
  */
@@ -153,7 +178,7 @@ export declare class Graph implements GraphContext {
153
178
  *
154
179
  * The settings take effect on the next layout the element runs. `preSteps` is read when a
155
180
  * layout starts, so setting it after a graph has already settled changes nothing that is
156
- * already on screen.
181
+ * already on screen. `labels.declutter` is the exception: it takes effect on the next frame.
157
182
  * @param behavior - The fields to change. Anything omitted keeps its current value.
158
183
  */
159
184
  setLayoutBehavior(behavior: GraphBehaviorConfig): void;
@@ -251,7 +276,7 @@ export declare class Graph implements GraphContext {
251
276
  * @returns Promise that resolves when nodes are added
252
277
  * @since 1.0.0
253
278
  * @see {@link addEdges} for adding edges
254
- * @see {@link https://graphty.app/storybook/element/?path=/story/data--default | Data Loading Examples}
279
+ * @see {@link https://graphty.app/storybook/graphty-element/?path=/story/data--basic | Data Loading Examples}
255
280
  * @example
256
281
  * ```typescript
257
282
  * // Add nodes with default ID field
@@ -296,7 +321,7 @@ export declare class Graph implements GraphContext {
296
321
  * @returns Promise that resolves when edges are added
297
322
  * @since 1.0.0
298
323
  * @see {@link addNodes} for adding nodes first
299
- * @see {@link https://graphty.app/storybook/element/?path=/story/data--default | Data Loading Examples}
324
+ * @see {@link https://graphty.app/storybook/graphty-element/?path=/story/data--basic | Data Loading Examples}
300
325
  * @example
301
326
  * ```typescript
302
327
  * // Add edges with default source/target fields
@@ -350,8 +375,8 @@ export declare class Graph implements GraphContext {
350
375
  * @returns Promise that resolves when layout is initialized
351
376
  * @since 1.0.0
352
377
  * @see {@link waitForSettled} to wait for layout completion
353
- * @see {@link https://graphty.app/storybook/element/?path=/story/layout--default | 3D Layout Examples}
354
- * @see {@link https://graphty.app/storybook/element/?path=/story/layout2d--default | 2D Layout Examples}
378
+ * @see {@link https://graphty.app/storybook/graphty-element/?path=/story/layout-3d--circular | 3D Layout Examples}
379
+ * @see {@link https://graphty.app/storybook/graphty-element/?path=/story/layout-2d--circular | 2D Layout Examples}
355
380
  * @example
356
381
  * ```typescript
357
382
  * // Use force-directed layout with custom settings
@@ -398,8 +423,8 @@ export declare class Graph implements GraphContext {
398
423
  * @since 1.0.0
399
424
  * @see {@link Graph.run} for the verb that replaces this one
400
425
  * @see {@link applySuggestedStyles} to visualize results
401
- * @see {@link https://graphty.app/storybook/element/?path=/story/algorithms-centrality--degree | Centrality Examples}
402
- * @see {@link https://graphty.app/storybook/element/?path=/story/algorithms-community--louvain | Community Detection}
426
+ * @see {@link https://graphty.app/storybook/graphty-element/?path=/story/algorithms-centrality--degree | Centrality Examples}
427
+ * @see {@link https://graphty.app/storybook/graphty-element/?path=/story/algorithms-community--louvain | Community Detection}
403
428
  * @example
404
429
  * ```typescript
405
430
  * // This entry point starts the work and hands nothing back. Everything below reads the
@@ -721,6 +746,12 @@ export declare class Graph implements GraphContext {
721
746
  * @returns The EventManager instance
722
747
  */
723
748
  getEventManager(): EventManager;
749
+ /**
750
+ * Get the acceleration controller this graph owns, for a manager reached through GraphContext.
751
+ * @returns The acceleration controller
752
+ * @since 2.0.0
753
+ */
754
+ getAcceleration(): AccelerationController;
724
755
  /**
725
756
  * Get the currently selected node.
726
757
  *
@@ -750,7 +781,7 @@ export declare class Graph implements GraphContext {
750
781
  * @since 1.0.0
751
782
  * @see {@link deselectNode} to clear selection
752
783
  * @see {@link getSelectedNode} to get current selection
753
- * @see {@link https://graphty.app/storybook/element/?path=/story/selection--default | Selection Examples}
784
+ * @see {@link https://graphty.app/storybook/graphty-element/?path=/story/selection--mode-3-d | Selection Examples}
754
785
  * @example
755
786
  * ```typescript
756
787
  * // Select a node and show its details
@@ -919,6 +950,9 @@ export declare class Graph implements GraphContext {
919
950
  isRunning(): boolean;
920
951
  /**
921
952
  * Set whether the layout engine should run.
953
+ *
954
+ * Resuming a simulation layout that had settled restarts it, so "play" moves nodes again;
955
+ * pausing stops the per-frame stepping and nothing else.
922
956
  * @param running - True to start the layout, false to stop it
923
957
  */
924
958
  setRunning(running: boolean): void;
@@ -212,9 +212,8 @@ export declare class Node {
212
212
  * EFFECTS only on the branch that rebuilds the mesh, so an `instance` channel's edit reached
213
213
  * the screen only if some unrelated `mesh` channel happened to change in the same repaint.
214
214
  * That is why a glow was drawn when its colour was in the stack before the first frame and
215
- * ignored when a layer added it afterwards, and why `node.glowStrength` had been declared a
216
- * `mesh` channel: minting a source mesh per strength was the only way to force the rebuild
217
- * that made the strength visible.
215
+ * ignored when a layer added it afterwards. (`node.glowStrength` is a `mesh` channel for a
216
+ * different reason: a glow's strength is set per SOURCE mesh, like its colour.)
218
217
  *
219
218
  * So this method is everything the `instance` role promises, and `paintFrom` calls it on BOTH
220
219
  * of its branches -- once when it has just rebuilt the mesh, because every one of these lives
@@ -263,7 +262,7 @@ export declare class Node {
263
262
  * `removeFromHighlight` call below is what is safe to do: it removes THIS mesh, which for an
264
263
  * instanced node the layer never held.
265
264
  *
266
- * A DISPOSED NODE STILL RECEIVES CALLS, which is why {@link Node.disposed} exists rather than
265
+ * A DISPOSED NODE STILL RECEIVES CALLS, which is why the private `disposed` flag exists rather than
267
266
  * this method simply freeing things. `DataManager.clear()` does not notify the layout engine
268
267
  * (its own standing TODO), so `UpdateManager` keeps iterating the engine's node and edge
269
268
  * lists; and `SelectionManager.selectedNode` holds a Node across a dataset boundary and calls
@@ -129,9 +129,18 @@ export declare class AccelerationController {
129
129
  get status(): AccelerationStatus;
130
130
  /**
131
131
  * The published capabilities subset, which is the `graphty-capabilities-change` detail.
132
+ *
133
+ * The same object is returned until the next transition, so `prev === next` is a valid
134
+ * staleness test for a reader that caches it.
132
135
  * @returns The capabilities the acceleration subsystem publishes.
133
136
  */
134
137
  get capabilities(): AccelerationCapabilities;
138
+ /**
139
+ * Whether {@link dispose} has already run, so a caller can skip {@link start} on a
140
+ * controller whose graph has been shut down.
141
+ * @returns True once the controller has been disposed.
142
+ */
143
+ get disposed(): boolean;
135
144
  /**
136
145
  * The one-word state, for a caller that wants only that.
137
146
  * @returns The state.
@@ -234,6 +243,24 @@ export declare class AccelerationController {
234
243
  * (`AbortError`, `TimeoutError`) propagates unchanged.
235
244
  */
236
245
  run<T>(work: AcceleratedWork, fn: (accelerator: GraphAccelerator) => T | Promise<T>): Promise<AccelerationOutcome<T>>;
246
+ /**
247
+ * Marks the start of a span of accelerated work that this controller does not itself drive.
248
+ *
249
+ * {@link run} covers work shaped like a call: one function, one promise, `"active"` for as
250
+ * long as it takes. A simulation is not shaped like that -- the element hands the graph to
251
+ * the accelerator once and then steps it every frame until the arrangement settles -- so the
252
+ * layout bridge marks the span instead. Without it the state a consumer reads would say
253
+ * `"idle"`, which its own documentation defines as nothing using the accelerator, for the
254
+ * whole of a GPU layout.
255
+ *
256
+ * Counted the way `run()` is: spans overlap freely and the state falls back to `"idle"` when
257
+ * the last one ends. The returned function is idempotent, so a caller may end its span at a
258
+ * settle and again at a dispose without counting out twice. On a disposed controller the
259
+ * call is a no-op rather than a throw: there is no state left to publish, and a frame loop is
260
+ * the wrong place for a shutdown to surface.
261
+ * @returns Ends the span.
262
+ */
263
+ beginWork(): () => void;
237
264
  /**
238
265
  * Releases the accelerator and stops publishing.
239
266
  *
@@ -9,4 +9,4 @@ export { AccelerationController } from "./AccelerationController";
9
9
  export type { AcceleratorRegistration, RegisterAcceleratorOptions } from "./registry";
10
10
  export { AcceleratorRegistry, acceleratorRegistry, registerAccelerator } from "./registry";
11
11
  export type { AccelerationCapabilities, AccelerationPolicy, AccelerationPrecision, AccelerationState, AccelerationStatus, AcceleratorDeviceInfo, AcceleratorFactory, AcceleratorFactoryOptions, CalibrationRecord, Capabilities, CaptureCapability, GraphAccelerator, Limits, WorkerCapability, XrCapability, } from "./types";
12
- export { ACCELERATION_MIN_NODES_DEFAULT, ACCELERATION_MIN_NODES_KEY, CPU_PRECISION, DEFAULT_ACCELERATOR_PRECISION, } from "./types";
12
+ export { ACCELERATION_MIN_NODES_DEFAULT, ACCELERATION_MIN_NODES_KEY, ACCELERATION_POLICIES, ACCELERATION_POLICY_DEFAULT, CPU_PRECISION, DEFAULT_ACCELERATOR_PRECISION, isAccelerationPolicy, } from "./types";
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @file Narrowing the element's accelerator to the seam a CPU package's dispatcher feature-tests.
3
+ *
4
+ * The element attaches ONE {@link GraphAccelerator}, whose accelerated members are open-ended:
5
+ * `webgpu.ts` forwards every callable the peer implements by name, so the object grows a member
6
+ * each time the GPU package ports another layout or algorithm and the element needs no edit.
7
+ * The CPU packages' dispatchers take a narrower thing -- `@graphty/layout`'s `LayoutAccelerator`
8
+ * is three optional layout members plus `release`, and `@graphty/algorithms`'s
9
+ * `AlgorithmAccelerator` is one optional member per algorithm -- and they decide CPU or
10
+ * accelerator by asking whether the member EXISTS (`accelerator?.forceAtlas2 !== undefined` in
11
+ * `createSimulation`, `acc?.pageRank !== undefined` in `accelerated`).
12
+ *
13
+ * That is why this copies only the members that are functions rather than spelling out
14
+ * `forceAtlas2: accelerator.forceAtlas2` for each: an accelerator that implements ForceAtlas2 and
15
+ * nothing else must hand the dispatcher an object with no `fruchtermanReingold` key at all, which
16
+ * is the GPU package's own rule for its accelerator ("an unimplemented member must not exist").
17
+ * A key present and undefined would read as implemented to anything testing with `in`.
18
+ *
19
+ * `dispose` is never copied. The element's controller owns the accelerator's lifetime -- it
20
+ * disposes one it built and leaves an injected one alone -- and a layout that could dispose the
21
+ * device out from under the next run would take that decision away from it.
22
+ */
23
+ import type { AlgorithmAccelerator } from "@graphty/algorithms";
24
+ import type { LayoutAccelerator } from "@graphty/layout";
25
+ import type { GraphAccelerator } from "./types";
26
+ /**
27
+ * Narrows the attached accelerator to the layout seam `createSimulation` feature-tests.
28
+ *
29
+ * The returned object is fresh on every call and holds only the members the accelerator actually
30
+ * implements, each bound to it, so a simulation built from it keeps working however the caller
31
+ * stores it.
32
+ * @param accelerator - The accelerator the controller has attached.
33
+ * @returns The layout half of it, for `createSimulation`'s third argument.
34
+ * @example
35
+ * ```ts
36
+ * const decision = controller.plan({ capability: "forceAtlas2", nodeCount });
37
+ * const simulation = createSimulation("forceatlas2", options, decision.accelerated ? narrowLayout(decision.accelerator) : null);
38
+ * ```
39
+ */
40
+ export declare function narrowLayout(accelerator: GraphAccelerator): LayoutAccelerator;
41
+ /**
42
+ * Narrows the attached accelerator to the algorithm seam `accelerated()` feature-tests.
43
+ *
44
+ * The returned object is fresh on every call and holds only the members the accelerator actually
45
+ * implements, each bound to it, so the dispatcher runs the accelerated implementation where one
46
+ * exists and the CPU port everywhere else.
47
+ * @param accelerator - The accelerator the controller has attached.
48
+ * @returns The algorithm half of it, for `accelerated()`.
49
+ * @example
50
+ * ```ts
51
+ * const outcome = await controller.run({ capability: "pageRank", nodeCount }, (acc) =>
52
+ * accelerated(narrowAlgorithms(acc)).pageRank(snapshot, options),
53
+ * );
54
+ * ```
55
+ */
56
+ export declare function narrowAlgorithms(accelerator: GraphAccelerator): AlgorithmAccelerator;