@graphty/graphty-element 2.4.0 → 2.5.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 (46) hide show
  1. package/dist/ai.js +3 -3
  2. package/dist/catalog.js +6 -6
  3. package/dist/chunks/{AiManager-BD9XK30e.js → AiManager-DNJCoeTO.js} +5 -5
  4. package/dist/chunks/{DataSource-B8vf2uhW.js → DataSource-xL3Yn0Pa.js} +72 -61
  5. package/dist/chunks/{GraphSession-dcwOjGJh.js → GraphSession-PFm2tJ_j.js} +1483 -1441
  6. package/dist/chunks/{GraphtyLogger-CqOVV13Y.js → GraphtyLogger-kbOx2zq3.js} +169 -221
  7. package/dist/chunks/{VoiceInputAdapter-D0tHHi9G.js → VoiceInputAdapter-CDNKQgUK.js} +1 -1
  8. package/dist/chunks/{XRPivotCameraController-DTfhvhHz.js → XRPivotCameraController-JdlLBcD7.js} +146 -134
  9. package/dist/chunks/{algorithms-BF0X6RPw.js → algorithms-B87OPYw4.js} +2 -2
  10. package/dist/chunks/{capability-check-BJzlK4oL.js → capability-check-B2oYf_30.js} +1 -1
  11. package/dist/chunks/{detect-vJxK7n0D.js → detect-tuYQLJbT.js} +2 -2
  12. package/dist/chunks/{format-detection-C80TLQ2e.js → format-detection-BG6CMwPO.js} +1 -1
  13. package/dist/chunks/{index-2xkq7wyD.js → index-6GDfNfwJ.js} +2928 -2856
  14. package/dist/chunks/{optionsFromZod-BuTOFgVM.js → optionsFromZod-DHLLiX_8.js} +237 -236
  15. package/dist/chunks/{paletteRegistry-A63C71Gn.js → paletteRegistry-jg9uS7wo.js} +66 -66
  16. package/dist/chunks/pluginRegistry-MaTIDh6l.js +238 -0
  17. package/dist/chunks/{registry-jB46Gmeb.js → registry-DQeq4B2K.js} +8 -8
  18. package/dist/chunks/{scales-B2d-7Bf0.js → scales-BXHmwPXC.js} +4 -4
  19. package/dist/extend.js +7 -7
  20. package/dist/graphty-catalog.json +1 -1
  21. package/dist/graphty.bundle.js +25128 -24837
  22. package/dist/graphty.js +67 -63
  23. package/dist/index.d.ts +3 -0
  24. package/dist/logging.js +2 -2
  25. package/dist/session.js +5 -5
  26. package/dist/src/Edge.d.ts +4 -4
  27. package/dist/src/acceleration/AccelerationController.d.ts +6 -0
  28. package/dist/src/acceleration/registry.d.ts +3 -0
  29. package/dist/src/acceleration/types.d.ts +7 -0
  30. package/dist/src/algorithms/Algorithm.d.ts +13 -0
  31. package/dist/src/cameras/InputUtils.d.ts +67 -0
  32. package/dist/src/cameras/XRInputHandler.d.ts +0 -8
  33. package/dist/src/catalog/pluginRegistry.d.ts +62 -0
  34. package/dist/src/catalog/registry.d.ts +7 -0
  35. package/dist/src/data/DataSource.d.ts +1 -1
  36. package/dist/src/errors/codes.d.ts +2 -1
  37. package/dist/src/meshes/CustomLineRenderer.d.ts +11 -9
  38. package/dist/src/meshes/EdgeMesh.d.ts +18 -9
  39. package/dist/src/meshes/FilledArrowRenderer.d.ts +61 -23
  40. package/dist/src/meshes/PatternedLineRenderer.d.ts +5 -37
  41. package/dist/src/meshes/PerSceneMaterials.d.ts +49 -0
  42. package/dist/src/xr/XRSessionManager.d.ts +1 -1
  43. package/dist/webgpu.d.ts +8 -0
  44. package/dist/webgpu.js +2 -2
  45. package/package.json +5 -5
  46. package/dist/chunks/GraphtyError-B93WRH3e.js +0 -134
package/dist/graphty.js CHANGED
@@ -1,81 +1,85 @@
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";
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
+ s as AlgorithmManager,
18
19
  r as AnimationCancelledError,
19
- aa as BLUES_COLORS,
20
- sa as BLUE_HIGHLIGHT,
21
- ea as BLUE_ORANGE_COLORS,
20
+ Ea as BLUES_COLORS,
21
+ Oa as BLUE_HIGHLIGHT,
22
+ oa as BLUE_ORANGE_COLORS,
22
23
  E as BUILTIN_PRESETS,
23
- ra as CARBON_COLORS,
24
- x as CPU_PRECISION,
25
- pa as DEFAULT_VIEW_MODE,
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
- Ea 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-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";
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/session.js CHANGED
@@ -1,9 +1,9 @@
1
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";
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
@@ -190,6 +190,12 @@ export declare class AccelerationController {
190
190
  *
191
191
  * Switching to `"off"` releases the accelerator, because holding a device nobody is allowed
192
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.
193
199
  * @param policy - The new policy.
194
200
  */
195
201
  setPolicy(policy: AccelerationPolicy): void;
@@ -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
  /**
@@ -221,6 +221,13 @@ export type AcceleratorFactory = (options?: AcceleratorFactoryOptions) => Promis
221
221
  * renders. It is plain, frozen, serialisable data: no GPU objects, no promises, no classes.
222
222
  */
223
223
  export interface AccelerationStatus {
224
+ /**
225
+ * The policy in force: what the consumer asked for, however they asked -- the `acceleration`
226
+ * attribute, the property, or `session.acceleration`. A change of policy publishes a new
227
+ * status even when the state does not move.
228
+ * @since 2.3.0
229
+ */
230
+ readonly policy: AccelerationPolicy;
224
231
  /** The one-word state. */
225
232
  readonly state: AccelerationState;
226
233
  /** The attached accelerator's backend, when one is attached. */
@@ -50,8 +50,21 @@ export interface AlgorithmStatics {
50
50
  *
51
51
  * Absent, the element estimates from the `costClass` the descriptor declares, which is what
52
52
  * every algorithm this package ships does.
53
+ *
54
+ * Prefer {@link costUnits}: seconds written on one machine are wrong on every other, and no
55
+ * calibration can scale them, so an estimate from this hook always reports "modelled".
53
56
  */
54
57
  cost?: (n: number, m: number) => number;
58
+ /**
59
+ * A cost model in WORK UNITS over a graph of n nodes and m edges, for the whole run.
60
+ *
61
+ * The units are those of the descriptor's `costClass`: elements for `instant` and
62
+ * `iterative` (count every iteration), source-edge pairs for `heavy`, operations for
63
+ * `cubic`. The element divides them by the rate it measured for that class on this device,
64
+ * so the estimate follows the machine and reports "calibrated" once the device is probed,
65
+ * exactly as a built-in's does. Wins over {@link cost} when both are declared.
66
+ */
67
+ costUnits?: (n: number, m: number) => number;
55
68
  /**
56
69
  * The plugin's own version, recorded on every run this algorithm produces.
57
70
  *
@@ -1,3 +1,4 @@
1
+ import { Vector3 } from "@babylonjs/core";
1
2
  /**
2
3
  * Shared input utility functions for camera controllers.
3
4
  * Used by both 3D (OrbitInputController) and XR (XRInputHandler).
@@ -11,3 +12,69 @@
11
12
  * @returns Adjusted value with deadzone and curve applied
12
13
  */
13
14
  export declare function applyDeadzone(value: number, threshold?: number): number;
15
+ /** Thumbstick deflection, per axis, that XR input ignores. */
16
+ export declare const XR_THUMBSTICK_DEADZONE = 0.15;
17
+ /**
18
+ * Whether a tracked hand is pinching, with hysteresis: a hand that is already pinching lets go at
19
+ * a looser distance than an open hand needs to start.
20
+ * @param distance - Thumb tip to index tip, in metres
21
+ * @param wasPinching - Whether the hand was pinching last frame
22
+ * @returns Whether the hand is pinching now
23
+ */
24
+ export declare function isPinching(distance: number, wasPinching: boolean): boolean;
25
+ /**
26
+ * How firmly a tracked hand is pinching: 1 with the finger tips touching, falling to 0 at the
27
+ * pinch start distance.
28
+ * @param distance - Thumb tip to index tip, in metres
29
+ * @returns Pinch strength in [0, 1]
30
+ */
31
+ export declare function pinchStrength(distance: number): number;
32
+ /** What one frame of thumbstick input does to the XR pivot. Zero (or a zoom of 1) means leave it alone. */
33
+ interface ThumbstickDeltas {
34
+ /** Radians, for `PivotController.rotate`. */
35
+ yaw: number;
36
+ /** Radians, for `PivotController.rotate`. */
37
+ pitch: number;
38
+ /** Factor, for `PivotController.zoom`. */
39
+ zoom: number;
40
+ /** Distance, for `PivotController.panViewRelative`. */
41
+ pan: number;
42
+ }
43
+ /**
44
+ * Map one frame of thumbstick input to pivot movement. Left stick X yaws and Y pitches (forward
45
+ * moves the graph up, as mouse and touch do); right stick Y zooms (forward zooms in) and X pans.
46
+ * @param left - Left stick axes, each in [-1, 1]
47
+ * @param left.x - Left stick X
48
+ * @param left.y - Left stick Y
49
+ * @param right - Right stick axes, each in [-1, 1]
50
+ * @param right.x - Right stick X
51
+ * @param right.y - Right stick Y
52
+ * @returns The movement to apply this frame
53
+ */
54
+ export declare function thumbstickDeltas(left: {
55
+ x: number;
56
+ y: number;
57
+ }, right: {
58
+ x: number;
59
+ y: number;
60
+ }): ThumbstickDeltas;
61
+ /** What one frame of a two-hand gesture does to the XR pivot. */
62
+ interface TwoHandGestureDelta {
63
+ /** Factor, for `PivotController.zoom`, clamped to [0.9, 1.1]. Hands moving apart zoom out. */
64
+ zoom: number;
65
+ /** Unit axis for `PivotController.rotateAroundAxis`, or null when the hands did not turn. */
66
+ axis: Vector3 | null;
67
+ /** Radians, for `PivotController.rotateAroundAxis`. */
68
+ angle: number;
69
+ }
70
+ /**
71
+ * Map the change in the line between two pinching hands, from one frame to the next, to pivot
72
+ * movement: the change in its length zooms, and the change in its direction rotates.
73
+ * @param previousDistance - Distance between the hands last frame
74
+ * @param previousDirection - Unit vector from left hand to right hand last frame
75
+ * @param distance - Distance between the hands this frame
76
+ * @param direction - Unit vector from left hand to right hand this frame
77
+ * @returns The movement to apply this frame
78
+ */
79
+ export declare function twoHandGestureDelta(previousDistance: number, previousDirection: Vector3, distance: number, direction: Vector3): TwoHandGestureDelta;
80
+ export {};
@@ -32,14 +32,6 @@ export declare class XRInputHandler {
32
32
  private previousDirection;
33
33
  private wasPinching;
34
34
  private handTrackingFeature;
35
- private readonly DEADZONE;
36
- private readonly YAW_SPEED;
37
- private readonly PITCH_SPEED;
38
- private readonly PAN_SPEED;
39
- private readonly ZOOM_SPEED;
40
- private readonly GESTURE_ZOOM_SENSITIVITY;
41
- private readonly _PINCH_START;
42
- private readonly _PINCH_END;
43
35
  private lastControllerRemovedTime;
44
36
  private readonly INPUT_SWITCH_DELAY_MS;
45
37
  private isDraggingNode;
@@ -33,6 +33,12 @@
33
33
  * {@link PluginRegistry.clearForTesting} exists so a suite can leave the registry as it found
34
34
  * it, and is named so nobody can mistake it for part of the contract.
35
35
  *
36
+ * ONE STORE PER PAGE, NOT PER COPY. A page can evaluate graphty-element twice -- the self-contained
37
+ * bundle beside an `./extend` import, two installs of the package, a dev server loading one module
38
+ * under two URLs -- and the element deliberately survives that. Every registry therefore keeps its
39
+ * state on `globalThis` under a `Symbol.for` key ({@link sharedStore}), so a registration made
40
+ * through any copy reaches the element any other copy defined.
41
+ *
36
42
  * NOTHING HERE IMPORTS A CLASS, a reader, an engine or a renderer. A registry holds whatever it
37
43
  * was handed at run time, which is what keeps `./catalog` and `./extend` resolvable in Node.
38
44
  */
@@ -110,6 +116,62 @@ export interface PluginRegistrySpec<TEntry, TDescriptor> {
110
116
  */
111
117
  builtInIds(): readonly string[];
112
118
  }
119
+ /**
120
+ * The one instance of a piece of registry state on this page, whichever copy of graphty-element
121
+ * asks for it.
122
+ *
123
+ * Keyed on `Symbol.for`, which is shared by every realm-local module graph, so two copies of this
124
+ * module find the same value. The `v1` names the shape of what is stored, and that includes the
125
+ * shape of every entry and descriptor inside it, not only the container: any change to an entry
126
+ * or a descriptor that an older copy on the same page cannot read must bump the version, so the
127
+ * two copies keep separate stores rather than misreading each other's.
128
+ * @param kind - Which piece of state.
129
+ * @param create - Builds it the first time any copy asks.
130
+ * @returns The page's instance.
131
+ */
132
+ export declare function sharedStore<T>(kind: string, create: () => T): T;
133
+ /**
134
+ * A map from name to implementation (a class, a factory) that this copy of graphty-element reads
135
+ * first and every other copy on the page reads after its own.
136
+ *
137
+ * THIS COPY'S OWN ENTRIES WIN, because they include its built-ins: a second copy's box shape is
138
+ * built with the second copy's Babylon.js, and its degree algorithm extends the second copy's base
139
+ * class, so handing those to this copy's element would mix two renderers in one scene. What a copy
140
+ * does not have itself -- a plugin registered through another copy -- comes from the page's
141
+ * shared map.
142
+ */
143
+ export declare class SharedImplementationMap<V> {
144
+ #private;
145
+ /**
146
+ * Join the page's shared map for this extension point, creating it if this copy is first.
147
+ * @param kind - Which extension point, which names the page's shared map.
148
+ */
149
+ constructor(kind: string);
150
+ /**
151
+ * File an implementation for this copy and for every other copy on the page.
152
+ * @param name - The name it is filed under.
153
+ * @param value - The implementation.
154
+ */
155
+ set(name: string, value: V): void;
156
+ /**
157
+ * This copy's implementation, or else the one another copy filed.
158
+ * @param name - The name.
159
+ * @returns The implementation, or undefined when no copy filed one.
160
+ */
161
+ get(name: string): V | undefined;
162
+ /**
163
+ * Whether THIS copy filed the name, which is what a built-in duplicate check asks: another
164
+ * copy registering its own built-ins is not a collision.
165
+ * @param name - The name.
166
+ * @returns True when this copy filed it.
167
+ */
168
+ hasOwn(name: string): boolean;
169
+ /**
170
+ * Every name any copy filed.
171
+ * @returns The names, this copy's first.
172
+ */
173
+ keys(): IterableIterator<string>;
174
+ }
113
175
  /**
114
176
  * Build a registry for one extension point.
115
177
  * @param spec - How this kind of extension is read.
@@ -61,6 +61,13 @@ export interface RegisteredAlgorithm {
61
61
  * plugin still supplies real arithmetic for the estimator to use.
62
62
  */
63
63
  readonly cost?: (n: number, m: number) => number;
64
+ /**
65
+ * A cost model in work units of the descriptor's cost class, read from `static costUnits`.
66
+ *
67
+ * The estimator divides it by this device's rate for that class, so calibration scales it.
68
+ * Wins over {@link cost} when both are present.
69
+ */
70
+ readonly costUnits?: (n: number, m: number) => number;
64
71
  /**
65
72
  * The plugin's own version, read from `static version`.
66
73
  *
@@ -1,5 +1,5 @@
1
1
  import * as z4 from "zod/v4/core";
2
- import type { RegisterOptions } from "../catalog/pluginRegistry";
2
+ import { type RegisterOptions } from "../catalog/pluginRegistry";
3
3
  import type { FormatDescriptor } from "../catalog/types";
4
4
  import { AdHocData } from "../config";
5
5
  import { ErrorAggregator } from "./ErrorAggregator.js";
@@ -163,7 +163,8 @@ export type GraphtyErrorCode =
163
163
  /**
164
164
  * A source could not be fetched: a network failure, a non-2xx status, a CORS refusal or an
165
165
  * unreadable file. `details` carry the url and the status where there was one, and `cause`
166
- * carries the original failure. Usually recoverable by retrying.
166
+ * carries the original failure. Recoverable by retrying, except a client error (a 4xx other
167
+ * than 408 and 429), which fails after one request with `recoverable: false`.
167
168
  */
168
169
  | "E_FETCH_FAILED"
169
170
  /**
@@ -34,19 +34,21 @@ interface CustomLineOptions {
34
34
  */
35
35
  export declare class CustomLineRenderer {
36
36
  private static shadersRegistered;
37
- private static activeMaterials;
38
- private static registeredScene;
39
37
  /**
40
- * Register custom line shaders
38
+ * Every line material, grouped by scene, each scene's group given that scene's render size
39
+ * once per frame. See {@link PerSceneMaterials} for the defect (issue #45).
41
40
  */
42
- static registerShaders(): void;
41
+ private static readonly resolutionTracked;
42
+ /**
43
+ * Number of line materials receiving per-frame resolution updates.
44
+ * @param scene - Count only this scene's materials; omit for every scene
45
+ * @returns Count of tracked materials
46
+ */
47
+ static getActiveMaterialCount(scene?: Scene): number;
43
48
  /**
44
- * Register the shared resolution update callback
45
- * This callback updates ALL line materials at once, instead of having one callback per material.
46
- * This dramatically improves performance when rendering many edges.
47
- * @param scene - The Babylon.js scene to register the callback on
49
+ * Register custom line shaders
48
50
  */
49
- private static registerResolutionCallback;
51
+ static registerShaders(): void;
50
52
  /**
51
53
  * Calculate evenly-spaced dot positions along a line path
52
54
  * @param points - Path points defining the line
@@ -1,4 +1,4 @@
1
- import { AbstractMesh, type Scene, Vector3 } from "@babylonjs/core";
1
+ import { AbstractMesh, type InstancedMesh, type Scene, Vector3 } from "@babylonjs/core";
2
2
  import type { EdgeStyleConfig } from "../config";
3
3
  import type { MeshCache } from "./MeshCache";
4
4
  import { PatternedLineMesh } from "./PatternedLineMesh";
@@ -80,26 +80,35 @@ export declare class EdgeMesh {
80
80
  *
81
81
  * In 2D mode, uses StandardMaterial with XY rotation.
82
82
  * In 3D mode, uses shader-based billboard rendering.
83
+ *
84
+ * The head is an InstancedMesh of a batch its scene shares with every head of the same
85
+ * shape (and, where the material holds them, the same colour and opacity), so a graph's
86
+ * arrowheads cost a draw call per batch rather than per edge. See
87
+ * `FilledArrowRenderer.instanceOf`.
83
88
  * @param _cache - MeshCache instance (currently unused, kept for API compatibility)
84
89
  * @param _styleId - Style ID (currently unused, kept for API compatibility)
85
90
  * @param options - Arrow head options including type, width, color, size, and opacity
86
91
  * @param scene - Babylon.js scene
87
92
  * @returns The created arrow mesh, or null if type is "none" or undefined
88
93
  */
89
- static createArrowHead(_cache: MeshCache, _styleId: string, options: ArrowHeadOptions, scene: Scene): AbstractMesh | null;
94
+ static createArrowHead(_cache: MeshCache, _styleId: string, options: ArrowHeadOptions, scene: Scene): InstancedMesh | null;
90
95
  /**
91
- * Create a filled arrow base mesh using FilledArrowRenderer
92
- * Returns a cached mesh template with thin instance support.
93
- * lineDirection is set per-instance when creating thin instances.
94
- * @param type - Arrow type (normal, inverted, diamond, etc.)
96
+ * A 3D sphere-dot arrowhead: an unlit sphere, batched by colour and opacity, sized by the
97
+ * instance's scale.
95
98
  * @param length - Arrow length in world units
96
- * @param _width - Arrow width in world units (reserved for future use)
97
99
  * @param color - Arrow color as hex string
98
100
  * @param opacity - Arrow opacity (0-1)
99
101
  * @param scene - Babylon.js scene
100
- * @returns Created arrow mesh
102
+ * @returns The sphere instance
103
+ */
104
+ private static createSphereDot;
105
+ /**
106
+ * Build the normalized geometry of a billboarded arrow type (every filled type but sphere-dot).
107
+ * @param type - Arrow type (normal, inverted, diamond, etc.)
108
+ * @param scene - Babylon.js scene
109
+ * @returns The arrow's geometry, with no material
101
110
  */
102
- private static createFilledArrow;
111
+ private static createArrowShape;
103
112
  private static createStaticLine;
104
113
  private static createAnimatedLine;
105
114
  private static createAnimatedTexture;