@graphty/graphty-element 2.3.0 → 2.3.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 (48) hide show
  1. package/dist/ai.js +115 -222
  2. package/dist/catalog.js +56 -55
  3. package/dist/chunks/{AiManager-Bd_r1Hei.js → AiManager-BBmGJbH4.js} +793 -654
  4. package/dist/chunks/{DataSource-bt0DhBjG.js → DataSource-OeN3NeyD.js} +1 -1
  5. package/dist/chunks/{GraphSession-iNyKm7Ds.js → GraphSession-Bef1AYw9.js} +2136 -2104
  6. package/dist/chunks/{GraphStyle-D0PXnZKu.js → GraphStyle-Cwr55SAE.js} +5 -2
  7. package/dist/chunks/{VoiceInputAdapter-DszYl6Ha.js → VoiceInputAdapter-Dr9Gcmds.js} +1 -1
  8. package/dist/chunks/{XRPivotCameraController-XtxbbZ-D.js → XRPivotCameraController-BbfgZWpS.js} +1 -1
  9. package/dist/chunks/algorithms-CpX56sUB.js +3482 -0
  10. package/dist/chunks/{capability-check-BqIEXcun.js → capability-check-Blhb2aBB.js} +1 -1
  11. package/dist/chunks/{detect-DM29BEaB.js → detect-Cqwshr9a.js} +1 -1
  12. package/dist/chunks/{format-detection-BEdmtvsy.js → format-detection-BXGO1lSn.js} +1 -1
  13. package/dist/chunks/{index-CD0_RJv-.js → index-C0mIoumR.js} +2258 -2129
  14. package/dist/chunks/optionsFromZod-17lkrAJs.js +2565 -0
  15. package/dist/chunks/paletteRegistry-x7WOEKZY.js +1153 -0
  16. package/dist/chunks/scales-BRwl51k8.js +3047 -0
  17. package/dist/custom-elements.json +1 -1
  18. package/dist/extend.js +42 -42
  19. package/dist/graphty-catalog.json +1 -1
  20. package/dist/graphty.bundle.js +25814 -25456
  21. package/dist/graphty.js +29 -29
  22. package/dist/schema.js +1 -1
  23. package/dist/session.d.ts +1 -1
  24. package/dist/session.js +28 -29
  25. package/dist/src/Graph.d.ts +33 -3
  26. package/dist/src/camera/builtins.d.ts +14 -1
  27. package/dist/src/camera/types.d.ts +7 -0
  28. package/dist/src/cameras/CameraManager.d.ts +13 -0
  29. package/dist/src/cameras/OrbitCameraController.d.ts +9 -0
  30. package/dist/src/catalog/types.d.ts +10 -0
  31. package/dist/src/config/GraphStyle.d.ts +5 -1
  32. package/dist/src/config/StyleTemplate.d.ts +2 -2
  33. package/dist/src/graphty-element.d.ts +11 -6
  34. package/dist/src/managers/StylePainter.d.ts +9 -0
  35. package/dist/src/managers/UpdateManager.d.ts +5 -0
  36. package/dist/src/session/results/index.d.ts +1 -1
  37. package/dist/src/session/results/statistics.d.ts +8 -1
  38. package/dist/src/session/results/types.d.ts +33 -0
  39. package/dist/src/session/selection/targets.d.ts +4 -1
  40. package/dist/src/session/styles/predicate.d.ts +26 -1
  41. package/dist/src/session/styles/repaint.d.ts +11 -0
  42. package/dist/src/session/styles/selector.d.ts +13 -1
  43. package/dist/src/session/styles/sources.d.ts +9 -0
  44. package/package.json +1 -1
  45. package/dist/chunks/Algorithm-RQ629NLb.js +0 -494
  46. package/dist/chunks/cameras-ii4vngYY.js +0 -435
  47. package/dist/chunks/paletteRegistry-DnWHQsAD.js +0 -3166
  48. package/dist/chunks/scales-DyuwlJKI.js +0 -6087
package/dist/graphty.js CHANGED
@@ -1,14 +1,14 @@
1
- import { A as e, a as E, b as r, D as O, E as o, d as S, G as R, e as _, I as t, L, N as C, O as A, R as N, S as n, f as I, g as T, h as g, U as i, i as l } from "./chunks/index-CD0_RJv-.js";
2
- import { a as p, S as G, b as f } from "./chunks/paletteRegistry-DnWHQsAD.js";
3
- import { D as y, E as D } from "./chunks/DataSource-bt0DhBjG.js";
4
- import { k as P, l as U, g as c, h as m, A as u, C as x, i as B } from "./chunks/Algorithm-RQ629NLb.js";
5
- import { e as H, E as b, N as Y, a as F, P as W, R as k, S as K, d as v, b as w, c as Q } from "./chunks/NodeStyle-DKj7HjMJ.js";
6
- import { A as j, a as q, G as z, i as J, b as Z } from "./chunks/GraphtyError-BwcnblTH.js";
7
- import { B as aa, a as sa, b as ea, C as Ea, G as ra, c as Oa, I as oa, O as Sa, d as Ra, e as _a, f as ta, P as La, g as Ca, h as Aa, R as Na, T as na, i as Ia, V as Ta, Y as ga } from "./chunks/sequential-Zym81qm7.js";
8
- import { a as la, G as da, V as pa, i as Ga } from "./chunks/GraphStyle-D0PXnZKu.js";
9
- import { c as ha } from "./chunks/common-DWNKjpH_.js";
1
+ import { A as e, a as E, b as r, D as O, E as o, d as S, G as R, e as _, I as L, L as t, N as C, O as A, R as N, S as n, f as I, g as T, h as g, U as i, i as p } from "./chunks/index-C0mIoumR.js";
2
+ import { L as l, S as G, a as f } from "./chunks/paletteRegistry-x7WOEKZY.js";
3
+ import { D, E as M } from "./chunks/DataSource-OeN3NeyD.js";
4
+ import { I as P, J as U, p as c, q as m, A as u, C as x, x as B } from "./chunks/optionsFromZod-17lkrAJs.js";
5
+ import { e as H, E as b, N as Y, a as F, P as W, R as K, S as k, d as q, b as v, c as w } from "./chunks/NodeStyle-DKj7HjMJ.js";
6
+ import { A as Q, a as X, G as j, i as z, b as Z } from "./chunks/GraphtyError-BwcnblTH.js";
7
+ import { B as aa, a as sa, b as ea, C as Ea, G as ra, c as Oa, I as oa, O as Sa, d as Ra, e as _a, f as La, P as ta, g as Ca, h as Aa, R as Na, T as na, i as Ia, V as Ta, Y as ga } from "./chunks/sequential-Zym81qm7.js";
8
+ import { a as pa, G as da, V as la, i as Ga } from "./chunks/GraphStyle-Cwr55SAE.js";
9
+ import { c as ya } from "./chunks/common-DWNKjpH_.js";
10
10
  export {
11
- j as ACCELERATION_ERROR_CODES,
11
+ Q as ACCELERATION_ERROR_CODES,
12
12
  P as ACCELERATION_MIN_NODES_DEFAULT,
13
13
  U as ACCELERATION_MIN_NODES_KEY,
14
14
  c as ACCELERATION_POLICIES,
@@ -22,41 +22,41 @@ export {
22
22
  r as BUILTIN_PRESETS,
23
23
  Ea as CARBON_COLORS,
24
24
  x as CPU_PRECISION,
25
- la as DEFAULT_VIEW_MODE,
25
+ pa as DEFAULT_VIEW_MODE,
26
26
  O as DataManager,
27
- y as DataSource,
27
+ D as DataSource,
28
28
  H as EDGE_CONSTANTS,
29
29
  o as Edge,
30
30
  b as EdgeStyle,
31
- D as ErrorAggregator,
31
+ M as ErrorAggregator,
32
32
  S as EventManager,
33
- q as GRAPHTY_ERROR_CODES,
33
+ X as GRAPHTY_ERROR_CODES,
34
34
  ra as GREENS_COLORS,
35
35
  Oa as GREEN_SUCCESS,
36
36
  R as Graph,
37
37
  da as GraphBackground,
38
38
  _ as Graphty,
39
- z as GraphtyError,
39
+ j as GraphtyError,
40
40
  oa as INFERNO_COLORS,
41
- t as InputManager,
42
- p as LayoutEngine,
43
- L as LayoutManager,
41
+ L as InputManager,
42
+ l as LayoutEngine,
43
+ t as LayoutManager,
44
44
  C as Node,
45
45
  Y as NodeShapes,
46
46
  F as NodeStyle,
47
47
  Sa as OKABE_ITO_COLORS,
48
48
  Ra as ORANGES_COLORS,
49
49
  _a as ORANGE_WARNING,
50
- ta as OTHER_GROUP_COLOR,
50
+ La as OTHER_GROUP_COLOR,
51
51
  A as OperationQueueManager,
52
- La as PASTEL_COLORS,
52
+ ta as PASTEL_COLORS,
53
53
  Ca as PLASMA_COLORS,
54
54
  Aa as PURPLE_GREEN_COLORS,
55
55
  W as PolyhedronType,
56
56
  Na as RED_BLUE_COLORS,
57
57
  N as RenderManager,
58
- k as RichTextStyle,
59
- K as SHAPE_CONSTANTS,
58
+ K as RichTextStyle,
59
+ k as SHAPE_CONSTANTS,
60
60
  n as ScreenshotError,
61
61
  I as ScreenshotErrorCode,
62
62
  T as SelectionManager,
@@ -66,16 +66,16 @@ export {
66
66
  na as TOL_MUTED_COLORS,
67
67
  Ia as TOL_VIBRANT_COLORS,
68
68
  i as UpdateManager,
69
- pa as VIEW_MODE_VALUES,
69
+ la as VIEW_MODE_VALUES,
70
70
  Ta as VIRIDIS_COLORS,
71
71
  ga as YLORBR_COLORS,
72
- ha as colorToHex,
73
- v as defaultEdgeStyle,
74
- w as defaultNodeStyle,
75
- Q as defaultRichTextLabelStyle,
76
- l as defaultXRConfig,
72
+ ya as colorToHex,
73
+ q as defaultEdgeStyle,
74
+ v as defaultNodeStyle,
75
+ w as defaultRichTextLabelStyle,
76
+ p as defaultXRConfig,
77
77
  B as isAccelerationPolicy,
78
- J as isGraphtyError,
78
+ z as isGraphtyError,
79
79
  Z as isGraphtyErrorCode,
80
80
  Ga as isViewMode
81
81
  };
package/dist/schema.js CHANGED
@@ -1,7 +1,7 @@
1
1
  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
- import { D as Z, a as tt, G as nt, b as at, V as st, i as et } from "./chunks/GraphStyle-D0PXnZKu.js";
4
+ import { D as Z, a as tt, G as nt, b as at, V as st, i as et } from "./chunks/GraphStyle-Cwr55SAE.js";
5
5
  import { E as rt, N as ct, a as it, R as Ot, d as St, b as Rt, c as lt } from "./chunks/NodeStyle-DKj7HjMJ.js";
6
6
  import { c as ft } from "./chunks/common-DWNKjpH_.js";
7
7
  function l(t) {
package/dist/session.d.ts CHANGED
@@ -78,7 +78,7 @@ export type { LayoutRecommendation, LayoutRecommendationOptions } from "./src/se
78
78
  export { recommendLayout } from "./src/session";
79
79
  export type { BatchResult, BatchStep, Caveats, EngineVersions, Precision, Progress, QueueEntry, QueuePolicy, ResolvedScope, Run, RunChange, RunDirection, RunExecutionContext, RunExecutor, RunOptions, RunOutcome, RunPhase, RunProgressReport, RunQueue, RunRecord, RunRemoval, RunsApi, RunScopeRecord, RunSpec, RunStatus, RunStyle, StaleNote, StartOptions, WeightMeaning, } from "./src/session/runs";
80
80
  export { isRunId, isRunStatus, isTerminalRunStatus, QUEUE_POLICIES, RUN_ID_PATTERN, RUN_PHASES, RUN_STATUSES, TERMINAL_RUN_STATUSES, } from "./src/session/runs";
81
- export type { Histogram, HistogramBin, HistogramBinning, HistogramOptions, Normalization, NumericColumnView, RankingEntry, ReadingOptions, ResultsApi, ResultSummary, RunRef, RunResult, SummaryEntry, SummaryGroup, } from "./src/session/results";
81
+ export type { Histogram, HistogramBin, HistogramBinning, HistogramOptions, Normalization, NumericColumnView, RankingEntry, ReadingOptions, ResultsApi, ResultSummary, RunRef, RunResult, SummaryEntry, SummaryGroup, TopRanking, } from "./src/session/results";
82
82
  export { defaultReading, RESULT_FIELD_NAMES, RESULT_ROOT, RESULT_SHAPE_CONTRACTS, resultPath } from "./src/session/results";
83
83
  export type { SavedScope, ScopeApi, ScopeCount, ScopeCountOptions } from "./src/session/scope";
84
84
  export { DEFAULT_SCOPE_SAMPLE } from "./src/session/scope";
package/dist/session.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { R, e as _ } from "./chunks/types-B7bX5c0K.js";
2
- import { A as c, a as C, G as p, i as m, b as g } from "./chunks/GraphtyError-BwcnblTH.js";
3
- import { g as O, h as U, i as I } from "./chunks/Algorithm-RQ629NLb.js";
4
- import { D as h } from "./chunks/GraphSession-iNyKm7Ds.js";
5
- import { a as N, b as y, c as D, d as v, Q as w, R as G, e as b, f as x, S as F, T as M, g as z, i as k, h as H, j as Y, k as j } from "./chunks/GraphSession-iNyKm7Ds.js";
6
- import { R as Q, t as X, u as B, v as J, w as K, x as V } from "./chunks/paletteRegistry-DnWHQsAD.js";
7
- import { L as s } from "./chunks/scales-DyuwlJKI.js";
2
+ import { A as c, a as C, G as p, i as m, b as L } from "./chunks/GraphtyError-BwcnblTH.js";
3
+ import { p as O, q as U, R as I, t as P, u as y, w as N, x as D, y as w, z as v } from "./chunks/optionsFromZod-17lkrAJs.js";
4
+ import { D as h } from "./chunks/GraphSession-Bef1AYw9.js";
5
+ import { a as b, b as x, c as F, d as z, Q as M, R as k, e as H, f as Y, S as j, T as q, g as Q, i as X, h as B, j as J, k as K } from "./chunks/GraphSession-Bef1AYw9.js";
6
+ import { L as s } from "./chunks/scales-BRwl51k8.js";
8
7
  const u = [
9
8
  {
10
9
  id: "fixed",
@@ -53,34 +52,34 @@ export {
53
52
  c as ACCELERATION_ERROR_CODES,
54
53
  O as ACCELERATION_POLICIES,
55
54
  U as ACCELERATION_POLICY_DEFAULT,
56
- N as DEFAULT_COST_GATE_LIMITS,
57
- y as DEFAULT_EXACT_COMPUTATION_CAP_SECONDS,
55
+ b as DEFAULT_COST_GATE_LIMITS,
56
+ x as DEFAULT_EXACT_COMPUTATION_CAP_SECONDS,
58
57
  h as DEFAULT_LIMITS,
59
- D as DEFAULT_SCOPE_SAMPLE,
60
- v as DEFAULT_SELECTION_CAP,
58
+ F as DEFAULT_SCOPE_SAMPLE,
59
+ z as DEFAULT_SELECTION_CAP,
61
60
  C as GRAPHTY_ERROR_CODES,
62
61
  p as GraphtyError,
63
- w as QUEUE_POLICIES,
64
- Q as RESULT_FIELD_NAMES,
65
- X as RESULT_ROOT,
62
+ M as QUEUE_POLICIES,
63
+ I as RESULT_FIELD_NAMES,
64
+ P as RESULT_ROOT,
66
65
  R as RESULT_SHAPES,
67
- B as RESULT_SHAPE_CONTRACTS,
68
- G as RUN_ID_PATTERN,
69
- b as RUN_PHASES,
70
- x as RUN_STATUSES,
71
- F as SET_OPS,
72
- M as TERMINAL_RUN_STATUSES,
73
- z as createGraphSession,
74
- J as defaultReading,
75
- I as isAccelerationPolicy,
76
- k as isAlgorithmRunCommand,
66
+ y as RESULT_SHAPE_CONTRACTS,
67
+ k as RUN_ID_PATTERN,
68
+ H as RUN_PHASES,
69
+ Y as RUN_STATUSES,
70
+ j as SET_OPS,
71
+ q as TERMINAL_RUN_STATUSES,
72
+ Q as createGraphSession,
73
+ N as defaultReading,
74
+ D as isAccelerationPolicy,
75
+ X as isAlgorithmRunCommand,
77
76
  m as isGraphtyError,
78
- g as isGraphtyErrorCode,
77
+ L as isGraphtyErrorCode,
79
78
  _ as isResultShape,
80
- H as isRunId,
81
- Y as isRunStatus,
82
- j as isTerminalRunStatus,
83
- K as quotePath,
79
+ B as isRunId,
80
+ J as isRunStatus,
81
+ K as isTerminalRunStatus,
82
+ w as quotePath,
84
83
  T as recommendLayout,
85
- V as resultPath
84
+ v as resultPath
86
85
  };
@@ -558,9 +558,17 @@ export declare class Graph implements GraphContext {
558
558
  [key: string]: unknown;
559
559
  }[], options?: QueueableOptions): Promise<void>;
560
560
  /**
561
- * Set the active camera mode (e.g., "arcRotate", "universal").
562
- * @param mode - Camera mode key to activate
561
+ * Activate the camera that belongs to the current view mode: `"2d"` in 2D, `"orbit"` in 3D.
562
+ *
563
+ * A camera belongs to one view mode, and switching between them is `setViewMode`'s job: it
564
+ * also rebuilds the meshes and the layout for the new mode. A camera from the other mode is
565
+ * refused rather than activated, because activating it would leave the scene drawing through
566
+ * one mode's camera while recording the other, and `setViewMode` would then take the scene
567
+ * for already being where it was asked to go.
568
+ * @param mode - Camera key to activate
563
569
  * @param options - Queue options for operation ordering
570
+ * @throws A `GraphtyError` with `E_BAD_COMMAND` when the camera does not belong to the view
571
+ * mode the graph is in (or is going to, once queued view-mode changes run).
564
572
  */
565
573
  setCameraMode(mode: CameraKey, options?: QueueableOptions): Promise<void>;
566
574
  /**
@@ -900,6 +908,27 @@ export declare class Graph implements GraphContext {
900
908
  * the session begins when a consumer calls `setViewMode` from a click.
901
909
  */
902
910
  private applyOpeningViewMode;
911
+ /**
912
+ * Frame the graph on the element's own initiative -- after a data load, a new layout, or the
913
+ * first settlement -- unless the configuration placed the camera itself with
914
+ * `startingCameraDistance`. An explicit `zoomToFit()` is not affected.
915
+ */
916
+ private autoFrame;
917
+ /**
918
+ * Set how far the camera stands from the graph, and stop the element framing the graph on its
919
+ * own. Undefined hands framing back to zoom-to-fit.
920
+ *
921
+ * The 3D orbit camera is moved to the distance (floored at its minimum zoom distance). The 2D
922
+ * camera's half-width becomes the half-extent the 3D camera's field of view covers at that
923
+ * distance, so switching view mode keeps a comparable framing.
924
+ * @param distance - The distance, in scene units, or undefined for automatic framing.
925
+ * @throws A `GraphtyError` with `E_OPTION_RANGE` when the distance is not a finite number.
926
+ */
927
+ setStartingCameraDistance(distance: number | undefined): void;
928
+ /**
929
+ * Place both cameras from the configured `startingCameraDistance`, when there is one.
930
+ */
931
+ private applyStartingCameraDistance;
903
932
  /**
904
933
  * Set the view mode.
905
934
  * This controls the camera type, input handling, and rendering approach.
@@ -1340,8 +1369,9 @@ export declare class Graph implements GraphContext {
1340
1369
  * Required because cameraDistance is not a scene node property
1341
1370
  * @param orbitController - Orbit camera controller instance
1342
1371
  * @param orbitController.cameraDistance - Current camera distance from pivot
1372
+ * @param orbitController.clampDistance - The controller's distance rule (the zoom floor)
1343
1373
  * @param orbitController.updateCameraPosition - Function to update camera position
1344
- * @param targetDistance - Target camera distance to animate to
1374
+ * @param requestedDistance - Camera distance to animate to, before the zoom floor applies
1345
1375
  * @param frameCount - Number of frames for the animation
1346
1376
  * @param fps - Frames per second for the animation
1347
1377
  * @param easing - Optional easing function name
@@ -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.
@@ -271,6 +271,16 @@ export type Selector = {
271
271
  match: "ids";
272
272
  nodes?: readonly NodeId[];
273
273
  edges?: readonly EdgeId[];
274
+ }
275
+ /**
276
+ * The top `n` elements by one run field (`results.<run>.<field>`), cut only between tie
277
+ * groups: a group of equal values is painted whole, and only when all of it fits inside `n`.
278
+ * See `TopRanking` for the policy.
279
+ */
280
+ | {
281
+ match: "top";
282
+ path: Path;
283
+ n: number;
274
284
  } | {
275
285
  match: "everything";
276
286
  };
@@ -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<{
@@ -575,12 +575,13 @@ export declare class Graphty extends LitElement {
575
575
  */
576
576
  set background(value: GraphBackgroundConfig | undefined);
577
577
  /**
578
- * How far the camera starts from the graph.
578
+ * How far the camera starts from the graph, in scene units.
579
579
  * @remarks
580
- * It is carried in the element's configuration document. NOTHING READS IT YET -- no camera
581
- * is placed from it today, and that was true before this property existed; the property
582
- * makes the setting reachable again rather than newly effective. A graph that has settled is
583
- * framed by `zoomToFit()`.
580
+ * Set, it places the 3D camera at this distance from the orbit centre (never closer than the
581
+ * minimum zoom distance) and gives the 2D camera the same view height, and the element stops
582
+ * framing the graph on its own after a data load or a layout change. `zoomToFit()` still
583
+ * frames it when called. Unset (the default), every load is framed to fit. Setting it on a
584
+ * running graph moves the camera.
584
585
  * @since 2.0.0
585
586
  * @example
586
587
  * ```typescript
@@ -1690,10 +1691,14 @@ export declare class Graphty extends LitElement {
1690
1691
  */
1691
1692
  getMeshCache(): import("./meshes/MeshCache").MeshCache;
1692
1693
  /**
1693
- * Set the camera mode.
1694
+ * Activate the camera of the current view mode: `"orbit"` in 3D, `"2d"` in 2D.
1695
+ * @remarks
1696
+ * A camera from the other view mode is refused; change view mode with `viewMode` or
1697
+ * `setViewMode`, which switches the camera with it.
1694
1698
  * @param mode - Camera mode key
1695
1699
  * @param options - Queue options
1696
1700
  * @returns Promise that resolves when camera mode is set
1701
+ * @throws A `GraphtyError` with `E_BAD_COMMAND` when the camera belongs to another view mode
1697
1702
  * @since 1.5.0
1698
1703
  */
1699
1704
  setCameraMode(mode: import("./cameras/CameraManager").CameraKey, options?: import("./utils/queue-migration").QueueableOptions): Promise<void>;
@@ -114,6 +114,15 @@ export declare class StylePainter {
114
114
  * @returns True when a pass has painted something the renderer has not applied.
115
115
  */
116
116
  get hasPending(): boolean;
117
+ /**
118
+ * Whether a style pass is still on its way: asked for, and not yet announced.
119
+ *
120
+ * Different from {@link StylePainter.hasPending}, which is paint that has ARRIVED and not been
121
+ * drawn. This is paint that has not arrived yet, and what it will change -- a colour, a size,
122
+ * the box the camera frames -- is not known until it does.
123
+ * @returns True while the bound pass is painting or queued to paint.
124
+ */
125
+ get isPainting(): boolean;
117
126
  /**
118
127
  * Take the nodes waiting to be drawn.
119
128
  * @returns Their dense indices. The set is emptied.
@@ -419,6 +419,11 @@ export declare class UpdateManager implements Manager {
419
419
  * @returns True when this frame will re-frame the camera, given a box to frame.
420
420
  */
421
421
  private willZoomToFit;
422
+ /**
423
+ * Whether a style pass has been asked for and has not announced what it painted yet.
424
+ * @returns True while the session's style stack is painting.
425
+ */
426
+ private styleIsPainting;
422
427
  /**
423
428
  * Frame the camera on a box {@link UpdateManager.willZoomToFit} has already approved.
424
429
  * @param box - The box to frame, or undefined when there is nothing to frame.
@@ -13,4 +13,4 @@
13
13
  export { defaultReading } from "./reading";
14
14
  export { createResultsApi, type ResultsRunEntry } from "./ResultsApi";
15
15
  export { createRunResult, type ResultElementValues } from "./RunResult";
16
- export { checkShapeContract, type Histogram, type HistogramBin, type HistogramBinning, type HistogramOptions, type Normalization, type NumericColumnView, type RankingEntry, type ReadingOptions, RESULT_FIELD_NAMES, RESULT_PATH_RUN_PLACEHOLDER, RESULT_ROOT, RESULT_SHAPE_CONTRACTS, resultPath, type ResultsApi, type ResultSummary, type RunRef, type RunResult, type SummaryEntry, type SummaryGroup, } from "./types";
16
+ export { checkShapeContract, type Histogram, type HistogramBin, type HistogramBinning, type HistogramOptions, type Normalization, type NumericColumnView, type RankingEntry, type ReadingOptions, RESULT_FIELD_NAMES, RESULT_PATH_RUN_PLACEHOLDER, RESULT_ROOT, RESULT_SHAPE_CONTRACTS, resultPath, type ResultsApi, type ResultSummary, type RunRef, type RunResult, type SummaryEntry, type SummaryGroup, type TopRanking, } from "./types";
@@ -25,7 +25,7 @@
25
25
  * published from the Node-safe `./session` entry point.
26
26
  */
27
27
  import type { NodeId } from "../../catalog/types";
28
- import type { Histogram, HistogramOptions, Normalization, NumericColumnView, RankingEntry } from "./types";
28
+ import type { Histogram, HistogramOptions, Normalization, NumericColumnView, RankingEntry, TopRanking } from "./types";
29
29
  /**
30
30
  * How many bins a histogram is cut into when the caller does not say.
31
31
  *
@@ -182,6 +182,13 @@ export interface RankableEntry {
182
182
  * @returns The ranking, best first. Entries with no finite value are left out.
183
183
  */
184
184
  export declare function rankEntries(entries: readonly RankableEntry[]): readonly RankingEntry[];
185
+ /**
186
+ * The top `n` of a ranking, cut only between tie groups. See {@link TopRanking} for the policy.
187
+ * @param ranking - The ranking, best first, with tied entries sharing a rank.
188
+ * @param n - The most entries the top may hold, a whole number.
189
+ * @returns The entries taken, and the group that did not fit when one did not.
190
+ */
191
+ export declare function topOfRanking(ranking: readonly RankingEntry[], n: number): TopRanking;
185
192
  /** How one histogram is cut, including the one thing the caller never has to say. */
186
193
  interface HistogramRequest extends HistogramOptions {
187
194
  /**
@@ -479,6 +479,30 @@ export interface RankingEntry {
479
479
  /** The share of measured elements it ranks at or above, from 0 to 1. */
480
480
  readonly percentile: number;
481
481
  }
482
+ /**
483
+ * The top of a ranking, cut only between tie groups.
484
+ *
485
+ * THE TIE POLICY: a group of elements that share a value is taken whole or not at all, and it is
486
+ * taken only when the whole group fits inside the limit. With ranks that share a place (1, 2, 2,
487
+ * 4), a group of size `s` at rank `r` is in exactly when `r + s - 1 <= n`. So the top never holds
488
+ * more than `n` elements and never splits a tie by an arbitrary order -- and it can hold FEWER
489
+ * than `n`, or none at all on a graph whose top value is shared by more than `n` elements.
490
+ * {@link TopRanking.leftOut} and {@link TopRanking.reason} say when that happened.
491
+ */
492
+ export interface TopRanking {
493
+ /** The elements taken, best first: whole tie groups only, never more than the limit. */
494
+ readonly entries: readonly RankingEntry[];
495
+ /**
496
+ * The tie group that stopped the top short: the first group that did not fit, with its
497
+ * value and its size. Null when nothing was left out on account of a tie.
498
+ */
499
+ readonly leftOut: {
500
+ readonly value: number;
501
+ readonly count: number;
502
+ } | null;
503
+ /** Why fewer elements were taken than the limit allowed, in a sentence; null when none were left out. */
504
+ readonly reason: string | null;
505
+ }
482
506
  /** One bar of a histogram. */
483
507
  export interface HistogramBin {
484
508
  /** The lowest value the bin holds, inclusive. */
@@ -646,6 +670,15 @@ export interface RunResult {
646
670
  * @returns The entries, best first.
647
671
  */
648
672
  ranking(field: string, limit?: number): readonly RankingEntry[];
673
+ /**
674
+ * The top `n` elements on one field, cut only between tie groups. See {@link TopRanking}
675
+ * for the tie policy. A `{ match: "top" }` style selector and a `{ top }` selection target
676
+ * both read this, so the two can never disagree about which elements are the top `n`.
677
+ * @param field - The field to rank on.
678
+ * @param n - The most elements the top may hold.
679
+ * @returns The elements taken, and the tie group left out when there was one.
680
+ */
681
+ top(field: string, n: number): TopRanking;
649
682
  /**
650
683
  * The distribution of one numeric field.
651
684
  * @param field - The field to bin.
@@ -104,7 +104,10 @@ export type SelectionTarget = ElementIdTarget | NeighborhoodTarget
104
104
  | {
105
105
  readonly scope: Scope;
106
106
  }
107
- /** The highest-ranked elements of a finished run. */
107
+ /**
108
+ * The highest-ranked elements of a finished run. A tie group is taken whole and only when it
109
+ * fits inside `n`, so this can select fewer than `n` elements, or none. See `TopRanking` in the results types.
110
+ */
108
111
  | {
109
112
  readonly top: {
110
113
  readonly run: RunRef;
@@ -115,6 +115,19 @@ export interface SelectorSource {
115
115
  * @returns The indices, or undefined when the column cannot be enumerated.
116
116
  */
117
117
  readonly measured?: (path: Path, target: SelectorTarget) => ArrayLike<number> | undefined;
118
+ /**
119
+ * The lowest value in the top `n` of one run column, cut only between tie groups (see
120
+ * `RunResult.top`), or undefined when nothing is taken or the column is not a ranked run
121
+ * field for this kind of element. Absent, a `{match:"top"}` selector is refused.
122
+ *
123
+ * Asked once per element, so it must answer from something already computed: a session
124
+ * reads it off the run's result, which keeps the answer per field and `n`.
125
+ * @param path - The column path, `results.<run>.<field>`.
126
+ * @param target - Whether the asking layer paints nodes or edges.
127
+ * @param n - The most elements the top may hold.
128
+ * @returns The cut, or undefined.
129
+ */
130
+ readonly topCut?: (path: Path, target: SelectorTarget, n: number) => number | undefined;
118
131
  }
119
132
  /**
120
133
  * One target's half of a {@link SelectorSource}, resolved once so the predicate never chooses.
@@ -160,7 +173,7 @@ export type ElementPredicate = (index: number) => boolean;
160
173
  /** A selector, reduced to the test a repaint runs and the columns that test reads. */
161
174
  export interface CompiledSelector {
162
175
  /** Which selector kind this was compiled from. */
163
- readonly match: "everything" | "expression" | "has" | "ids";
176
+ readonly match: "everything" | "expression" | "has" | "ids" | "top";
164
177
  /** Which kind of element it speaks about. */
165
178
  readonly target: SelectorTarget;
166
179
  /**
@@ -231,6 +244,18 @@ export declare function hasPredicate(columns: ElementColumns, path: Path): Eleme
231
244
  * @returns The test.
232
245
  */
233
246
  export declare function idsPredicate(columns: ElementColumns, ids: ReadonlySet<EdgeId | NodeId>): ElementPredicate;
247
+ /**
248
+ * The predicate for `{match:"top"}`: the element's value is at or above the top's cut.
249
+ *
250
+ * The cut is asked for per element rather than settled here, because a run that finishes or
251
+ * re-runs after the layer was added publishes a new ranking, and a cut captured now would go on
252
+ * painting the old top.
253
+ * @param columns - Where to read values.
254
+ * @param path - The column path.
255
+ * @param cutOf - The lowest value in the top, or undefined when nothing is in it.
256
+ * @returns The test.
257
+ */
258
+ export declare function topPredicate(columns: ElementColumns, path: Path, cutOf: () => number | undefined): ElementPredicate;
234
259
  /**
235
260
  * Parse and compile `{match:"expression"}`.
236
261
  *
@@ -211,6 +211,17 @@ export interface ElementPaint {
211
211
  * @returns A function that stops the notifications.
212
212
  */
213
213
  onPainted(listener: () => void): () => void;
214
+ /**
215
+ * Whether a pass has been asked for and has not finished yet.
216
+ *
217
+ * A pass YIELDS TO THE EVENT LOOP and waits behind the pass in front of it, so between the
218
+ * edit that asks for it and the announcement that ends it there are frames -- as many as the
219
+ * machine is slow. Nothing is in {@link ElementPaint.lastPainted} for those frames, and a
220
+ * renderer that asked only whether paint was waiting to be drawn would call the picture
221
+ * finished, and frame the camera on it, while a node's new size was still on its way.
222
+ * @returns True from the moment a pass is requested until it has announced what it painted.
223
+ */
224
+ painting(): boolean;
214
225
  /**
215
226
  * The layers the last pass could not paint, and why.
216
227
  * @returns The problems, emptied at the start of every pass.