@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
@@ -16,6 +16,7 @@
16
16
  * The file is free of Babylon.js, Lit and DOM references so it can be re-exported from the
17
17
  * Node-safe entry points.
18
18
  */
19
+ import type { AlgorithmAccelerator } from "@graphty/algorithms";
19
20
  import type { AccelerationErrorCode } from "../errors";
20
21
  /**
21
22
  * Where hardware acceleration stands, in one word.
@@ -362,3 +363,80 @@ export declare const ACCELERATION_MIN_NODES_KEY = "acceleration.minNodes";
362
363
  * which is not part of the published documentation site.
363
364
  */
364
365
  export declare const ACCELERATION_MIN_NODES_DEFAULT = 0;
366
+ /**
367
+ * Where and when the per-capability floors below were measured, as the plan's reason quotes it.
368
+ */
369
+ export declare const ACCELERATION_MIN_NODES_MEASUREMENT = "RTX 4070 SUPER, headless Chromium, 2026-09-25";
370
+ /**
371
+ * The node count below which the element declines the accelerator for one capability, when the
372
+ * consumer has not set {@link ACCELERATION_MIN_NODES_KEY} themselves.
373
+ *
374
+ * {@link ACCELERATION_MIN_NODES_DEFAULT} is 0 because it was measured for the forceatlas2
375
+ * LAYOUT, whose accelerated frame was never slower than the CPU's at any size. A traversal is a
376
+ * different shape of work: the whole walk is one call, and on the device that call has a floor
377
+ * of several submit round trips whatever the size, so below some node count the CPU walk is done
378
+ * before the device has started. One number cannot serve both, which is why the layout default
379
+ * stays 0 and each algorithm capability the adapters route carries its own floor here.
380
+ *
381
+ * MEASURED, not guessed. `tmp/traversal-threshold/kernel-cpu-vs-gpu.ts` (the harness, kept
382
+ * out of the tree) mounted `<graphty-element acceleration="required">` in headless Chromium on
383
+ * the dev box (RTX 4070 SUPER through ANGLE's Vulkan backend, 2026-09-25, load average
384
+ * 18 to 23), took the accelerator the element built, built seeded undirected graphs with ten
385
+ * edges per node and integer weights 1..10 in the page, and timed the two dispatchers
386
+ * `Algorithm.accelerated()` uses -- `accelerated(null)` for the CPU port and
387
+ * `accelerated(narrowAlgorithms(accelerator))` for the device -- directly on the snapshot, so no
388
+ * renderer frame is in the loop. Medians of nine warm calls after one cold call, in ms:
389
+ *
390
+ * | nodes / edges | BFS cpu | BFS gpu | sssp cpu | sssp gpu | pageRank cpu | pageRank gpu | components cpu | components gpu |
391
+ * | ------------- | ------: | ------: | -------: | -------: | -----------: | -----------: | -------------: | -------------: |
392
+ * | 1k / 10k | 0.1 | 7.8 | 0.3 | 7.3 | 0.7 | 3.0 | 0.2 | 3.9 |
393
+ * | 5k / 50k | 0.6 | 8.8 | 1.6 | 7.9 | 5.3 | 2.9 | 1.2 | 5.3 |
394
+ * | 10k / 100k | 1.0 | 7.5 | 2.8 | 7.2 | 4.6 | 2.9 | 2.3 | 7.4 |
395
+ * | 20k / 200k | 1.7 | 9.1 | 3.8 | 13.5 | 16.2 | 3.0 | 4.8 | 7.5 |
396
+ * | 50k / 500k | 5.7 | 13.0 | 25.8 | 27.6 | 50.3 | 4.3 | 11.6 | 7.8 |
397
+ * | 100k / 1M | 9.8 | 17.3 | 30.4 | 49.2 | 67.4 | 5.6 | 16.2 | 8.6 |
398
+ * | 200k / 2M | 17.6 | 23.2 | 73.0 | 79.6 | 148.3 | 10.5 | 29.9 | 11.5 |
399
+ * | 500k / 5M | 88.3 | 33.6 | 343.8 | 150.3 | 523.0 | 36.1 | 99.7 | 20.9 |
400
+ * | 1M / 10M | 250.9 | 24.2 | 1031.1 | 274.9 | 1762.4 | 17.5 | 215.7 | 43.2 |
401
+ *
402
+ * The two traversals were then measured twice more around their crossover, because the device's
403
+ * time at one size moves with what else the box is doing (the first sweep's 200k row was taken
404
+ * at a load average of 22.6, the repeats at about 18):
405
+ *
406
+ * | nodes / edges | BFS cpu | BFS gpu | sssp cpu | sssp gpu |
407
+ * | ------------- | ------: | ------: | -------: | -------: |
408
+ * | 100k / 1M | 7.4 | 9.5 | 26.9 | 20.9 |
409
+ * | 200k / 2M | 15.6 | 10.1 | 66.3 | 37.8 |
410
+ * | 200k / 2M | 17.8 | 11.0 | 70.6 | 42.5 |
411
+ * | 300k / 3M | 35.2 | 13.3 | 129.2 | 77.1 |
412
+ * | 300k / 3M | 34.4 | 18.9 | 129.8 | 65.2 |
413
+ * | 400k / 4M | 63.3 | 30.7 | 226.6 | 128.2 |
414
+ * | 500k / 5M | 93.1 | 32.5 | 361.9 | 200.0 |
415
+ *
416
+ * So: BFS loses at 100k in both runs and splits at 200k (one loss, two wins); Dijkstra splits at
417
+ * both 100k and 200k; from 300k up the device wins every run of both by two to ten times.
418
+ * PageRank wins from 5k and connected components from 50k, in the one run each was measured.
419
+ *
420
+ * A floor is the smallest measured size at which the device's median was at or below the CPU
421
+ * port's IN EVERY RUN, so a size that won under one load and lost under another is below it. A
422
+ * capability that is not listed has no floor and follows {@link ACCELERATION_MIN_NODES_DEFAULT}.
423
+ *
424
+ * Two things the table does not cover. It is one card and one browser: a slower CPU or a
425
+ * slower device moves the crossover, and a consumer who has measured their own machine sets
426
+ * `acceleration.minNodes`, which replaces every floor here with their number. And it is the
427
+ * kernel's time, not the run's: through the element a run also publishes its result rows,
428
+ * which costs the same on either path and is why the element-level numbers in the issue read
429
+ * higher on both sides.
430
+ *
431
+ * Under `acceleration="required"` the floors do not apply: `"required"` is what a benchmark
432
+ * runs under, and a benchmark of the small end of the curve has to reach the device.
433
+ */
434
+ /**
435
+ * The capabilities a floor can name: the seam's algorithm members, by their exact names.
436
+ *
437
+ * Typed against the seam rather than as a string so that a member renamed on one side and not
438
+ * the other is a compile error here, not a floor that silently stops applying and sends that
439
+ * capability back to the GPU at every size.
440
+ */
441
+ export type FlooredCapability = Exclude<keyof AlgorithmAccelerator, "kind" | "release">;
442
+ export declare const ACCELERATION_MIN_NODES_BY_CAPABILITY: Readonly<Partial<Record<FlooredCapability, number>>>;
@@ -0,0 +1,26 @@
1
+ import type { FieldDescriptor, NodeId } from "../catalog/types";
2
+ import { MetricAlgorithm } from "./metrics/MetricAlgorithm";
3
+ import type { MetricMeasurement, MetricRunContext } from "./metrics/types";
4
+ /**
5
+ * K-core decomposition: how deep in the graph's densely connected core each node sits.
6
+ *
7
+ * A node's core number is the largest k for which it belongs to a k-core -- the largest part of
8
+ * the graph in which every node has at least k neighbours. Every node has one, so every node is
9
+ * measured.
10
+ */
11
+ export declare class KCoreAlgorithm extends MetricAlgorithm {
12
+ static namespace: string;
13
+ static type: string;
14
+ /**
15
+ * The fields a k-core result publishes.
16
+ * @returns The uniform node-metric fields.
17
+ */
18
+ protected resultFields(): readonly FieldDescriptor[];
19
+ /**
20
+ * Give every node its core number.
21
+ * @param context - Where progress goes and where cancellation arrives.
22
+ * @param nodeIds - The nodes to measure.
23
+ * @returns One core number per node.
24
+ */
25
+ protected measure(context: MetricRunContext, nodeIds: readonly NodeId[]): Promise<MetricMeasurement>;
26
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @file Link prediction: the pairs of unconnected nodes most likely to be joined next.
3
+ *
4
+ * The answer is a list of scored pairs, not a value on each node or edge -- a predicted link is
5
+ * an edge that does not exist yet, so there is no element to hang it on. The result is shaped as
6
+ * a pair list, which is why a run of it suggests no style: painting it would mean inventing the
7
+ * thing it painted.
8
+ */
9
+ import { adamicAdarPrediction, commonNeighborsPrediction } from "@graphty/algorithms";
10
+ import { type OptionsSchema as ZodOptionsSchema } from "../config";
11
+ import { type AlgorithmOutput, type AlgorithmRunContext, DeclaredAlgorithm } from "./results";
12
+ import type { OptionsSchema } from "./types/OptionSchema";
13
+ /** The two scoring methods, by the name the `method` option takes. */
14
+ declare const METHODS: {
15
+ readonly "adamic-adar": typeof adamicAdarPrediction;
16
+ readonly "common-neighbors": typeof commonNeighborsPrediction;
17
+ };
18
+ /** Options for link prediction. */
19
+ interface LinkPredictionOptions extends Record<string, unknown> {
20
+ /** Which score ranks the pairs. */
21
+ method: keyof typeof METHODS;
22
+ /** How many of the best-scoring pairs to keep. */
23
+ topK: number;
24
+ }
25
+ /**
26
+ * Link prediction: scores every pair of nodes that is not already joined by how many neighbours
27
+ * the two share, and keeps the best.
28
+ */
29
+ export declare class LinkPredictionAlgorithm extends DeclaredAlgorithm<LinkPredictionOptions> {
30
+ static namespace: string;
31
+ static type: string;
32
+ static zodOptionsSchema: ZodOptionsSchema;
33
+ static optionsSchema: OptionsSchema;
34
+ /**
35
+ * Score every unconnected pair of nodes and keep the best.
36
+ * @param context - What the element gave the run.
37
+ * @returns The scored pairs, best first, or null when the graph has no nodes.
38
+ */
39
+ compute(context: AlgorithmRunContext): Promise<AlgorithmOutput | null>;
40
+ }
41
+ export {};
@@ -14,7 +14,9 @@
14
14
  * times the longest side: every one of those is what the element computed before, so no picture
15
15
  * moves. They disagree with each other -- the orbit controller's own framing pads 5 percent and
16
16
  * the 2D controller's pads 10 percent -- and this file does not average them, because averaging
17
- * them would change what a saved screenshot looks like. A plugin picks its own.
17
+ * them would change what a saved screenshot looks like. A plugin picks its own. The one
18
+ * exception is the isometric `beta`: it was 0.615, the elevation above the horizon, in a field
19
+ * measured down from the pole, and no picture depended on it because nothing applied it.
18
20
  *
19
21
  * THESE ARE NOT REGISTERED. A built-in id is reserved and `registerCameraView` refuses one, so
20
22
  * the table below is looked up first and the registry second, which is what keeps a registration
@@ -27,3 +29,14 @@ import type { CameraState, CameraViewInput } from "./types";
27
29
  * @returns The function, or undefined when the element ships no view by that name.
28
30
  */
29
31
  export declare function builtInCameraView(id: string): ((input: CameraViewInput) => CameraState) | undefined;
32
+ /**
33
+ * Turn an orbit state given as angles into the position the element's cameras are placed from.
34
+ *
35
+ * `alpha`, `beta` and `radius` follow Babylon's ArcRotate convention: the viewer stands at
36
+ * target + radius * (cos(alpha) sin(beta), cos(beta), sin(alpha) sin(beta)). A state that already
37
+ * carries a position or a pivot rotation, or lacks an angle or a distance (`radius`, or
38
+ * `cameraDistance`), is returned unchanged.
39
+ * @param state - The state a caller or a camera view asked for.
40
+ * @returns The same state, with `position` (and `cameraDistance` from `radius`) filled in.
41
+ */
42
+ export declare function orbitAnglesToPosition(state: CameraState): CameraState;
@@ -60,8 +60,15 @@ export interface CameraState {
60
60
  y: number;
61
61
  z: number;
62
62
  };
63
+ /**
64
+ * Orbit angles in Babylon's ArcRotate convention: `alpha` turns around the +y axis starting
65
+ * from +x, `beta` is measured down from +y (0 looks straight down, PI/2 is level). With
66
+ * `radius` they place the viewer at target + radius * (cos(alpha) sin(beta), cos(beta),
67
+ * sin(alpha) sin(beta)). Ignored when the state also gives `position` or `pivotRotation`.
68
+ */
63
69
  alpha?: number;
64
70
  beta?: number;
71
+ /** Distance from `target` for an orbit state given as `alpha` and `beta`. */
65
72
  radius?: number;
66
73
  fov?: number;
67
74
  zoom?: number;
@@ -14,6 +14,13 @@ interface InputHandler {
14
14
  update(): void;
15
15
  }
16
16
  export type CameraKey = "orbit" | "2d" | "xr";
17
+ /**
18
+ * The camera each drawing view mode is drawn through. The immersive modes have none here: their
19
+ * camera belongs to the XR session.
20
+ * @param viewMode - The view mode.
21
+ * @returns The camera key, or undefined for a mode with no camera of its own.
22
+ */
23
+ export declare function cameraForViewMode(viewMode: string): CameraKey | undefined;
17
24
  /**
18
25
  * Manages multiple camera controllers and their input handlers.
19
26
  * Provides functionality to register, activate, and switch between different camera types.
@@ -63,6 +70,12 @@ export declare class CameraManager {
63
70
  * @returns The active controller or null if no camera is active
64
71
  */
65
72
  getActiveController(): CameraController | null;
73
+ /**
74
+ * Gets a registered camera controller, whether or not it is the active one.
75
+ * @param key - The identifier the controller was registered under
76
+ * @returns The controller, or undefined when nothing is registered under the key
77
+ */
78
+ getController(key: CameraKey): CameraController | undefined;
66
79
  /**
67
80
  * Temporarily disable the active input handler (e.g., during node dragging)
68
81
  */
@@ -54,6 +54,15 @@ export declare class OrbitCameraController {
54
54
  * @param delta - Distance delta to adjust camera by
55
55
  */
56
56
  zoom(delta: number): void;
57
+ /**
58
+ * The distance rule every programmatic writer of `cameraDistance` follows: floored at
59
+ * `minZoomDistance`, never capped. The ceiling is a zoom-out limit for a reader, not a
60
+ * framing limit -- a saved state for a large graph can sit beyond it, and `zoom` accepts that
61
+ * -- while a distance under the floor would make the next zoom IN jump the camera outwards.
62
+ * @param distance - The distance asked for.
63
+ * @returns The distance to use.
64
+ */
65
+ clampDistance(distance: number): number;
57
66
  /**
58
67
  * Update camera position relative to the pivot.
59
68
  * Parents camera to pivot and positions at negative Z distance.
@@ -20,10 +20,10 @@
20
20
  * `JSON.stringify`, a `postMessage` to a worker and a write to a saved document, and a
21
21
  * closure survives none of those. A cost estimate that needs code belongs to
22
22
  * `session.estimate()`, which runs where the code is.
23
- * - **The table only lists what ships.** Four members of `KNOWN_ALGORITHMS` -- `all-paths`,
24
- * `clustering-coefficient`, `k-core` and `link-prediction` -- are not registered by this
25
- * package and therefore have no descriptor here. A catalogue that advertised them would be
26
- * lying about what the element can run.
23
+ * - **The table only lists what ships.** Two members of `KNOWN_ALGORITHMS` -- `all-paths` and
24
+ * `clustering-coefficient`, listed in `DEPRECATED_ALGORITHMS` -- are not implemented and
25
+ * therefore have no descriptor here. A catalogue that advertised them would be lying about
26
+ * what the element can run.
27
27
  *
28
28
  * Two conventions worth stating once:
29
29
  *
@@ -70,7 +70,7 @@ export interface BuiltInAlgorithmDescriptor extends AlgorithmDescriptor {
70
70
  /**
71
71
  * Every algorithm this package registers, as a plain-JSON descriptor.
72
72
  *
73
- * Twenty-one descriptors for twenty-three registered algorithms: the two single-source
73
+ * Twenty-three descriptors for twenty-five registered algorithms: the two single-source
74
74
  * shortest-path engines are one key with a `method` parameter, and the two component algorithms
75
75
  * are one key with a `strength` parameter. Each descriptor's `legacyKeys` names the 1.10 keys it
76
76
  * replaces and the parameters that reproduce them.
@@ -9,8 +9,8 @@ export type { LabelAnimation, LabelBadge, LabelGradientDirection, LabelGradientT
9
9
  export { LABEL_STYLE_FIELDS } from "./label-style";
10
10
  export type { OptionsFromZodOptions, OptionsSource, OptionUiMeta } from "./optionsFromZod";
11
11
  export { optionsFromZod } from "./optionsFromZod";
12
- export type { AlgorithmDescriptor, AlgorithmKey, AttributeDescriptor, AttributeType, Binding, CameraDescriptor, CameraId, CatalogApi, Channel, ChannelValue, CostClass, DrawingMode, EdgeId, EdgeLinePattern, Encoding, FieldDescriptor, FormatDescriptor, FormatId, FunctionDescriptor, GraphtyErrorCode, KnownAlgorithm, LabelStyle, LayerId, LayerKind, LayerSource, LayerSpec, LayoutDescriptor, LayoutId, LogSinkDescriptor, LogSinkId, MetricAvailability, NodeId, OptionBound, OptionChoice, OptionDescriptor, OptionType, PaletteDescriptor, PaletteId, Path, Query, QueryValidation, ResultShape, Rgba, RunId, ScaleDescriptor, Scope, ScopeId, Selector, StaticStyle, StyleDocument, ThemeDescriptor, } from "./types";
13
- export { ATTRIBUTE_TYPES, COST_CLASSES, isAttributeType, isCostClass, isOptionBound, isOptionType, isResultShape, KNOWN_ALGORITHMS, KNOWN_CAMERA_IDS, KNOWN_FORMAT_IDS, KNOWN_LAYOUT_IDS, KNOWN_LOG_SINK_IDS, KNOWN_PALETTE_IDS, OPTION_BOUND_SOURCES, OPTION_TYPES, RESULT_SHAPES, } from "./types";
12
+ export type { AlgorithmDescriptor, AlgorithmKey, AttributeDescriptor, AttributeType, Binding, CameraDescriptor, CameraId, CatalogApi, Channel, ChannelValue, CostClass, DeprecatedAlgorithm, DeprecatedCatalogMethod, DrawingMode, EdgeId, EdgeLinePattern, Encoding, FieldDescriptor, FormatDescriptor, FormatId, FunctionDescriptor, GraphtyErrorCode, KnownAlgorithm, LabelStyle, LayerId, LayerKind, LayerSource, LayerSpec, LayoutDescriptor, LayoutId, LogSinkDescriptor, LogSinkId, MetricAvailability, NodeId, OptionBound, OptionChoice, OptionDescriptor, OptionType, PaletteDescriptor, PaletteId, Path, Query, QueryValidation, ResultShape, Rgba, RunId, ScaleDescriptor, Scope, ScopeId, Selector, StaticStyle, StyleDocument, ThemeDescriptor, } from "./types";
13
+ export { ATTRIBUTE_TYPES, COST_CLASSES, DEPRECATED_ALGORITHMS, isAttributeType, isCostClass, isOptionBound, isOptionType, isResultShape, KNOWN_ALGORITHMS, KNOWN_CAMERA_IDS, KNOWN_FORMAT_IDS, KNOWN_LAYOUT_IDS, KNOWN_LOG_SINK_IDS, KNOWN_PALETTE_IDS, OPTION_BOUND_SOURCES, OPTION_TYPES, RESULT_SHAPES, } from "./types";
14
14
  /**
15
15
  * What the element does NOT serve on the styling surface, said out loud.
16
16
  *
@@ -2,7 +2,7 @@
2
2
  * @file The layout catalogue: the arrangements the element offers, and the engines behind them.
3
3
  *
4
4
  * A public layout name says what the arrangement IS -- "force", "hierarchical", "circular" --
5
- * and never which library draws it. The element registers seventeen engines whose registered
5
+ * and never which library draws it. The element registers nineteen engines whose registered
6
6
  * names ARE their implementations ("ngraph", "d3", "forceatlas2"), and freezing those into the
7
7
  * public API makes swapping an implementation a rename every consumer can see. So the engine is
8
8
  * data on the descriptor instead: `LayoutDescriptor.engine` names the implementation the element
@@ -14,10 +14,11 @@
14
14
  * descriptor a consumer reads carries the default engine and that engine's options; the rest of
15
15
  * the list is there for a consumer that wants to choose.
16
16
  *
17
- * Two names in the built-in layout list have no engine behind them yet, and two engines describe
18
- * an arrangement that list has no name for. Both are recorded here -- {@link UNSERVED_LAYOUT_IDS}
19
- * and the `spiral` and `planar` entries -- rather than left for a consumer to discover by asking
20
- * for a layout that never answers, or by never learning a capability exists.
17
+ * A name in the built-in layout list with no engine behind it would be recorded in
18
+ * {@link UNSERVED_LAYOUT_IDS} (none is, today), and two engines describe an arrangement that list
19
+ * has no name for, which the `spiral` and `planar` entries record -- rather than left for a
20
+ * consumer to discover by asking for a layout that never answers, or by never learning a
21
+ * capability exists.
21
22
  *
22
23
  * `sizeRating` is the largest graph the default engine is recommended for, read from its cost: a
23
24
  * placement that visits each node once rates "any", an iterative all-pairs force rates 2000.
@@ -78,7 +79,7 @@ export declare const LAYOUT_DESCRIPTORS: readonly LayoutDescriptor[];
78
79
  /**
79
80
  * The built-in layout names no registered engine draws yet. Listed rather than omitted, because
80
81
  * a name that is in the type and missing from the catalogue is otherwise discovered by asking
81
- * for it and getting an error.
82
+ * for it and getting an error. Empty today: every built-in name has an engine.
82
83
  */
83
84
  export declare const UNSERVED_LAYOUT_IDS: readonly UnservedLayout[];
84
85
  /**
@@ -53,10 +53,29 @@ export type Query = string;
53
53
  /**
54
54
  * The built-in algorithms. The list is also available at runtime so a consumer can enumerate
55
55
  * the built-in set without a catalogue instance.
56
+ *
57
+ * Two of these names are deprecated: `all-paths` and `clustering-coefficient` are reserved but
58
+ * not implemented, and starting either fails with `E_UNSUPPORTED`. See
59
+ * {@link DEPRECATED_ALGORITHMS}.
56
60
  */
57
61
  export declare const KNOWN_ALGORITHMS: readonly ["degree", "betweenness", "closeness", "pagerank", "eigenvector", "katz", "hits", "louvain", "leiden", "label-propagation", "components", "shortest-path", "all-pairs-distance", "all-paths", "max-flow", "min-cut", "k-core", "clustering-coefficient", "girvan-newman", "bfs", "dfs", "kruskal", "prim", "bipartite-matching", "link-prediction"];
58
- /** One of the built-in algorithms. */
62
+ /**
63
+ * One of the built-in algorithms. `all-paths` and `clustering-coefficient` are deprecated and do
64
+ * not run; see {@link DEPRECATED_ALGORITHMS}.
65
+ */
59
66
  export type KnownAlgorithm = (typeof KNOWN_ALGORITHMS)[number];
67
+ /**
68
+ * The built-in algorithm names the element reserves but does not run.
69
+ *
70
+ * Nothing implements these two yet. The names stay in {@link KNOWN_ALGORITHMS}, so no plugin can
71
+ * claim them and no code that names them stops compiling, but starting one fails with
72
+ * `E_UNSUPPORTED` rather than `E_UNKNOWN_ALGORITHM`. Each is removed at the next major release
73
+ * unless it is implemented first: `all-paths` is tracked by issue #329 and
74
+ * `clustering-coefficient` by issue #330.
75
+ */
76
+ export declare const DEPRECATED_ALGORITHMS: readonly ["all-paths", "clustering-coefficient"];
77
+ /** A built-in algorithm name the element reserves but does not run, and will remove. */
78
+ export type DeprecatedAlgorithm = (typeof DEPRECATED_ALGORITHMS)[number];
60
79
  /**
61
80
  * An algorithm key. The built-in names keep autocomplete alive; the string arm accepts a
62
81
  * plugin's name.
@@ -271,6 +290,16 @@ export type Selector = {
271
290
  match: "ids";
272
291
  nodes?: readonly NodeId[];
273
292
  edges?: readonly EdgeId[];
293
+ }
294
+ /**
295
+ * The top `n` elements by one run field (`results.<run>.<field>`), cut only between tie
296
+ * groups: a group of equal values is painted whole, and only when all of it fits inside `n`.
297
+ * See `TopRanking` for the policy.
298
+ */
299
+ | {
300
+ match: "top";
301
+ path: Path;
302
+ n: number;
274
303
  } | {
275
304
  match: "everything";
276
305
  };
@@ -436,13 +465,23 @@ export interface ScaleDescriptor {
436
465
  domainKind: "numeric" | "categorical" | "boolean";
437
466
  options: readonly OptionDescriptor[];
438
467
  }
439
- /** One named style document, offered as a whole look. */
468
+ /**
469
+ * One named style document, offered as a whole look.
470
+ *
471
+ * Nothing produces one yet: it is returned only by the deprecated `CatalogApi.themes()`, and goes
472
+ * with it at the next major release unless that is implemented first (issue #331).
473
+ */
440
474
  export interface ThemeDescriptor {
441
475
  name: string;
442
476
  plainName: string;
443
477
  document: StyleDocument;
444
478
  }
445
- /** One function the expression grammar accepts. */
479
+ /**
480
+ * One function the expression grammar accepts.
481
+ *
482
+ * Nothing produces one yet: it is returned only by the deprecated `CatalogApi.functions()`, and
483
+ * goes with it at the next major release unless that is implemented first (issue #332).
484
+ */
446
485
  export interface FunctionDescriptor {
447
486
  name: string;
448
487
  /** The smallest and largest argument count accepted. */
@@ -514,7 +553,12 @@ export type Scope = "visible" | "graph" | "selection" | "largest-component" | {
514
553
  } | {
515
554
  nodes: readonly NodeId[];
516
555
  };
517
- /** The catalogue: everything the element can offer, as data. */
556
+ /**
557
+ * The catalogue: everything the element can offer, as data.
558
+ *
559
+ * `session.catalog` implements every method here except the six named in
560
+ * {@link DeprecatedCatalogMethod}, which nothing implements yet.
561
+ */
518
562
  export interface CatalogApi {
519
563
  algorithms(): readonly AlgorithmDescriptor[];
520
564
  layouts(): readonly LayoutDescriptor[];
@@ -523,24 +567,61 @@ export interface CatalogApi {
523
567
  cameras(): readonly CameraDescriptor[];
524
568
  logSinks(): readonly LogSinkDescriptor[];
525
569
  scales(): readonly ScaleDescriptor[];
570
+ /**
571
+ * @deprecated Not implemented. Removed at the next major release unless it is implemented
572
+ * first (issue #331).
573
+ */
526
574
  themes(): readonly ThemeDescriptor[];
575
+ /**
576
+ * @deprecated Not implemented. Removed at the next major release unless it is implemented
577
+ * first (issue #332).
578
+ */
527
579
  functions(): readonly FunctionDescriptor[];
580
+ /**
581
+ * @deprecated Not implemented. Removed at the next major release unless it is implemented
582
+ * first (issue #333).
583
+ */
528
584
  timeAttributes(): readonly AttributeDescriptor[];
529
585
  metrics(): readonly MetricAvailability[];
530
- /** The metrics that can run on this graph. A runtime query, not a static list. */
586
+ /**
587
+ * The metrics that can run on this graph. A runtime query, not a static list.
588
+ * @deprecated Not implemented; `metrics()` carries `available` and `reason` for the same
589
+ * question. Removed at the next major release unless it is implemented first (issue #334).
590
+ */
531
591
  applicable(): readonly MetricAvailability[];
592
+ /**
593
+ * @deprecated Not implemented. Removed at the next major release unless it is implemented
594
+ * first (issue #335).
595
+ */
532
596
  validate(query: Query, o?: {
533
597
  kind?: "selector" | "filter" | "formula";
534
598
  }): QueryValidation;
535
- /** The options for one algorithm or layout, with data-dependent bounds resolved. */
599
+ /**
600
+ * The options for one algorithm or layout, with data-dependent bounds resolved.
601
+ * @deprecated Not implemented; `algorithms()` and `layouts()` carry the static option
602
+ * descriptors. Removed at the next major release unless it is implemented first (issue #336).
603
+ */
536
604
  optionsFor(key: AlgorithmKey | LayoutId, scope?: Scope): Promise<readonly OptionDescriptor[]>;
537
605
  }
606
+ /**
607
+ * The {@link CatalogApi} methods nothing implements yet, which `session.catalog` leaves out.
608
+ *
609
+ * Implementing one means deleting its name here: `SessionCatalogApi` is derived from this list,
610
+ * so the two cannot drift apart.
611
+ */
612
+ export type DeprecatedCatalogMethod = "themes" | "functions" | "timeAttributes" | "applicable" | "validate" | "optionsFor";
538
613
  /**
539
614
  * Tell whether a value is one of the option types.
540
615
  * @param value - The value to test.
541
616
  * @returns True when the value is a member of OPTION_TYPES.
542
617
  */
543
618
  export declare function isOptionType(value: unknown): value is OptionType;
619
+ /**
620
+ * Tell whether an algorithm key names a built-in the element reserves but does not run.
621
+ * @param key - The algorithm key.
622
+ * @returns True when the key is a member of DEPRECATED_ALGORITHMS.
623
+ */
624
+ export declare function isDeprecatedAlgorithm(key: string): key is DeprecatedAlgorithm;
544
625
  /**
545
626
  * Tell whether a value is one of the cost classes.
546
627
  * @param value - The value to test.
@@ -1,4 +1,39 @@
1
1
  import { z } from "zod/v4";
2
+ /**
3
+ * Every arrow the edge renderer can draw at the head or tail of an edge, in schema order.
4
+ * Read `EdgeArrowTypes.options` for the list, e.g. to build a picker.
5
+ */
6
+ export declare const EdgeArrowTypes: z.ZodEnum<{
7
+ none: "none";
8
+ dot: "dot";
9
+ normal: "normal";
10
+ inverted: "inverted";
11
+ "sphere-dot": "sphere-dot";
12
+ "open-dot": "open-dot";
13
+ tee: "tee";
14
+ "open-normal": "open-normal";
15
+ diamond: "diamond";
16
+ "open-diamond": "open-diamond";
17
+ crow: "crow";
18
+ box: "box";
19
+ "half-open": "half-open";
20
+ vee: "vee";
21
+ }>;
22
+ /**
23
+ * Every line pattern the edge renderer can draw, in schema order.
24
+ * Read `EdgeLineTypes.options` for the list, e.g. to build a picker.
25
+ */
26
+ export declare const EdgeLineTypes: z.ZodEnum<{
27
+ solid: "solid";
28
+ dot: "dot";
29
+ diamond: "diamond";
30
+ box: "box";
31
+ star: "star";
32
+ dash: "dash";
33
+ "dash-dot": "dash-dot";
34
+ sinewave: "sinewave";
35
+ zigzag: "zigzag";
36
+ }>;
2
37
  /**
3
38
  * Everything a style layer can say about how one edge is drawn.
4
39
  *
@@ -99,7 +99,11 @@ export declare const GraphStyle: z.ZodObject<{
99
99
  /** How solid the halo is, in `[0, 1]`. Low enough to read as a highlight rather than a node. */
100
100
  opacity: z.ZodDefault<z.ZodNumber>;
101
101
  }, z.core.$strict>>;
102
- startingCameraDistance: z.ZodDefault<z.ZodNumber>;
102
+ /**
103
+ * How far the camera starts from the graph, in scene units. Set, it places the camera and
104
+ * turns off the element's automatic zoom-to-fit; unset, the graph is framed to fit.
105
+ */
106
+ startingCameraDistance: z.ZodOptional<z.ZodNumber>;
103
107
  layout: z.ZodOptional<z.ZodString>;
104
108
  layoutOptions: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
105
109
  /**
@@ -22,7 +22,7 @@ declare const StyleTemplateV1: z.ZodObject<{
22
22
  scale: z.ZodDefault<z.ZodNumber>;
23
23
  opacity: z.ZodDefault<z.ZodNumber>;
24
24
  }, z.core.$strict>>;
25
- startingCameraDistance: z.ZodDefault<z.ZodNumber>;
25
+ startingCameraDistance: z.ZodOptional<z.ZodNumber>;
26
26
  layout: z.ZodOptional<z.ZodString>;
27
27
  layoutOptions: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
28
28
  viewMode: z.ZodDefault<z.ZodEnum<{
@@ -958,7 +958,7 @@ export declare const StyleTemplate: z.ZodDiscriminatedUnion<[z.ZodObject<{
958
958
  scale: z.ZodDefault<z.ZodNumber>;
959
959
  opacity: z.ZodDefault<z.ZodNumber>;
960
960
  }, z.core.$strict>>;
961
- startingCameraDistance: z.ZodDefault<z.ZodNumber>;
961
+ startingCameraDistance: z.ZodOptional<z.ZodNumber>;
962
962
  layout: z.ZodOptional<z.ZodString>;
963
963
  layoutOptions: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
964
964
  viewMode: z.ZodDefault<z.ZodEnum<{
@@ -1,7 +1,7 @@
1
1
  export type { AdHocData, ImageData } from "./common";
2
2
  export { colorToHex } from "./common";
3
3
  export type { EdgeStyleConfig } from "./EdgeStyle";
4
- export { defaultEdgeStyle, EdgeStyle } from "./EdgeStyle";
4
+ export { defaultEdgeStyle, EdgeArrowTypes, EdgeLineTypes, EdgeStyle } from "./EdgeStyle";
5
5
  export type { FetchEdgesFn, FetchNodesFn, GraphBehaviorConfig } from "./GraphBehavior";
6
6
  export type { NodeIdType } from "./GraphBehavior";
7
7
  export { GraphBehaviorOpts } from "./GraphBehavior";
@@ -3,6 +3,14 @@ type GEXFDataSourceConfig = BaseDataSourceConfig;
3
3
  /**
4
4
  * Data source for loading graph data from GEXF (Graph Exchange XML Format) files.
5
5
  * Supports node and edge attributes, attribute types, and dynamic graphs.
6
+ *
7
+ * Dynamic graphs keep their time data on each record rather than acting on it:
8
+ * - a node's or edge's `start` / `end` / `timestamp` (see {@link readInterval}) go onto its data
9
+ * under those names, and its `<spells>` go onto `spells` as a list of the same intervals;
10
+ * - an attribute with time-sliced `attvalue`s becomes a list of `{ value, start, end }` slices
11
+ * instead of a single value. An attribute with no timed `attvalue` keeps its plain value.
12
+ *
13
+ * Dynamic `viz:*` elements (timed positions, colours or sizes) are not read.
6
14
  */
7
15
  export declare class GEXFDataSource extends DataSource {
8
16
  static readonly type = "gexf";
@@ -60,6 +68,21 @@ export declare class GEXFDataSource extends DataSource {
60
68
  * @returns the edge records, and how many edges stated each direction
61
69
  */
62
70
  private parseEdges;
71
+ /**
72
+ * Copy a node's or edge's lifetime, spells and attribute values onto its record.
73
+ *
74
+ * Every `attvalue` for one attribute is kept: if any of them is timed, the attribute becomes
75
+ * the list of all its slices, `{ value, start, end }`, in file order; otherwise it keeps its
76
+ * plain value, so a static file reads exactly as it always has.
77
+ * @param obj - the parsed `<node>` or `<edge>`
78
+ * @param obj.attvalues - its `<attvalues>` element, if any
79
+ * @param obj.attvalues.attvalue - the `<attvalue>` children
80
+ * @param obj.spells - its `<spells>` element, if any
81
+ * @param obj.spells.spell - the `<spell>` children
82
+ * @param record - the record being built, written in place
83
+ * @param attributes - the attribute definitions for this element class
84
+ */
85
+ private readTimeData;
63
86
  private parseValue;
64
87
  }
65
88
  export {};
@@ -185,6 +185,20 @@ export type GraphtyErrorCode =
185
185
  * import plan or the data.
186
186
  */
187
187
  | "E_ID_MISSING"
188
+ /**
189
+ * A load read its source to the end and found nothing in it: no node records and no edge
190
+ * records. It is reported as a failure rather than as a success with zero counts, and a
191
+ * load asked to `replace` keeps the graph it would have replaced. `details` carry the
192
+ * format. The caller checks the file, or the format it was read as.
193
+ */
194
+ | "E_EMPTY_LOAD"
195
+ /**
196
+ * A load was overtaken: a REPLACING load was called after it, or `clearData` ran, so its data
197
+ * would have replaced or mixed into the newer dataset. It stops without touching the graph.
198
+ * `details` carry the format. Not a fault in the source; the caller ignores it, or loads
199
+ * again.
200
+ */
201
+ | "E_SUPERSEDED"
188
202
  /**
189
203
  * The graph exceeds a hard structural limit of an index or of the accelerator, and no scope
190
204
  * or sample makes the work runnable. `details` carry the size and the limit. Distinct from