@cosmos.gl/graph 3.0.0-beta.6 → 3.0.0-beta.7

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.
package/README.md CHANGED
@@ -75,6 +75,25 @@ graph.render()
75
75
 
76
76
  ---
77
77
 
78
+ ### What's New in v3.0?
79
+
80
+ cosmos.gl v3.0 brings a new rendering engine, async initialization, and several new features:
81
+
82
+ - **luma.gl (WebGL 2)** — rendering ported from regl to [luma.gl](https://luma.gl/), with support for sharing a custom `Device` across multiple graphs via `new Graph(div, config, devicePromise)`.
83
+ - **Async initialization** — the constructor returns immediately; all public methods queue until the device is ready. Use `graph.ready` / `graph.isReady` to know when the graph is usable.
84
+ - **Simulation control** — rendering is now separate from simulation. The simulation starts automatically by default; use `start()`, `stop()`, `pause()`, and `unpause()` to control it independently.
85
+ - **Link sampling** — sample visible links on screen with `getSampledLinks()` and `getSampledLinkPositionsMap()` for rendering labels or overlays along links.
86
+ - **Context menu support** — new callbacks for right-click interactions: `onContextMenu`, `onPointContextMenu`, `onLinkContextMenu`, `onBackgroundContextMenu`.
87
+ - **Fit viewport to points** — `setZoomTransformByPointPositions()` zooms and pans to fit a set of points into view.
88
+ - **Hover improvements** — `onPointMouseOver` now includes an `isSelected` parameter; hover correctly highlights the topmost point when points overlap.
89
+ - **Config API changes** — `setConfig()` now resets all values to defaults before applying; use the new `setConfigPartial()` to update individual properties without resetting the rest.
90
+ - **Init-only config fields** — `enableSimulation`, `initialZoomLevel`, `randomSeed`, and `attribution` can only be set during initialization and are preserved across config updates.
91
+ - **Default point shape** — new `pointDefaultShape` config property lets you set the fallback shape for all points when no per-point shapes are provided. Accepts a `PointShape` enum value (e.g., `PointShape.Star`), a plain number (e.g., `6`), or a numeric string (e.g., `"6"`).
92
+ - **Exported defaults** — `defaultConfigValues` is now part of the public API.
93
+ - **Optimized hover detection** — skips GPU work when the mouse hasn't moved.
94
+
95
+ Check the [Migration Guide](./migration-notes.md) for upgrading from v2.
96
+
78
97
  ### What's New in v2.0?
79
98
 
80
99
  cosmos.gl v2.0 introduces significant improvements in performance and data handling:
@@ -86,7 +105,7 @@ cosmos.gl v2.0 introduces significant improvements in performance and data handl
86
105
  - New Point Clustering force (`setPointClusters`, `setClusterPositions` and `setPointClusterStrength`).
87
106
  - Ability to drag points.
88
107
 
89
- Check the [Migration Guide](./cosmos-2-0-migration-notes.md) for details.
108
+ Check the [Migration Guide](./migration-notes.md) for upgrading from v1.
90
109
 
91
110
  ---
92
111
 
@@ -116,7 +135,7 @@ Check the [Migration Guide](./cosmos-2-0-migration-notes.md) for details.
116
135
  - 🧑‍💻 [Quick Start](https://cosmosgl.github.io/graph/?path=/docs/welcome-to-cosmos--docs)
117
136
  - 🛠 [Configuration](https://cosmosgl.github.io/graph/?path=/docs/configuration--docs)
118
137
  - ⚙️ [API Reference](https://cosmosgl.github.io/graph/?path=/docs/api-reference--docs)
119
- - 🚀 [Migration Guide](https://github.com/cosmosgl/graph/blob/main/cosmos-2-0-migration-notes.md)
138
+ - 🚀 [Migration Guide](https://github.com/cosmosgl/graph/blob/main/migration-notes.md)
120
139
 
121
140
  ---
122
141
 
package/dist/config.d.ts CHANGED
@@ -1,52 +1,54 @@
1
1
  import { D3ZoomEvent } from 'd3-zoom';
2
2
  import { D3DragEvent } from 'd3-drag';
3
3
  import { Hovered } from './modules/Store';
4
+ import { PointShape } from './modules/GraphData';
4
5
  export interface GraphConfigInterface {
5
6
  /**
6
7
  * If set to `false`, the simulation will not run.
7
8
  * This property will be applied only on component initialization and it
8
- * can't be changed using the `setConfig` method.
9
+ * can't be changed using the `setConfig` or `setConfigPartial` methods.
9
10
  * Default value: `true`
10
11
  */
11
- enableSimulation?: boolean;
12
+ enableSimulation: boolean;
12
13
  /**
13
14
  * Canvas background color.
14
15
  * Can be either a hex color string (e.g., '#b3b3b3') or an array of RGBA values.
15
16
  * Default value: '#222222'
16
17
  */
17
- backgroundColor?: string | [number, number, number, number];
18
+ backgroundColor: string | [number, number, number, number];
18
19
  /**
19
20
  * Simulation space size.
20
21
  * Default value: `4096` (larger values may crash on some devices, e.g. iOS; see https://github.com/cosmosgl/graph/issues/203).
21
22
  */
22
- spaceSize?: number;
23
+ spaceSize: number;
23
24
  /**
24
25
  * The default color to use for points when no point colors are provided,
25
26
  * or if the color value in the array is `undefined` or `null`.
26
27
  * This can be either a hex color string (e.g., '#b3b3b3') or an array of RGBA values
27
- * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
28
+ * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 1.
28
29
  * Default value: '#b3b3b3'
29
30
  */
30
- pointDefaultColor?: string | [number, number, number, number];
31
+ pointDefaultColor: string | [number, number, number, number];
31
32
  /**
32
33
  * The color to use for points when they are greyed out (when selection is active).
33
34
  * This can be either a hex color string (e.g., '#b3b3b3') or an array of RGBA values
34
- * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
35
+ * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 1.
35
36
  *
36
37
  * If not provided, the color will be the same as the point's original color,
37
38
  * but darkened or lightened depending on the background color.
38
39
  *
39
- * If `pointGreyoutOpacity` is also defined, it will override the alpha/opacity component
40
+ * If `pointGreyoutOpacity` is also defined, it will be multiplied with the final alpha
40
41
  * of this color.
41
42
  *
42
43
  * Default value: `undefined`
43
44
  */
44
45
  pointGreyoutColor?: string | [number, number, number, number];
45
46
  /**
46
- * Opacity value for points when they are greyed out (when selection is active).
47
+ * Opacity multiplier for points when they are greyed out (when selection is active).
47
48
  * Values range from 0 (completely transparent) to 1 (fully opaque).
48
49
  *
49
- * If defined, this value will override the alpha/opacity component of `pointGreyoutColor`.
50
+ * When defined, this value is multiplied with the point's final alpha instead of the
51
+ * default `pointOpacity`. When `undefined`, greyed-out points use `pointOpacity` as their multiplier.
50
52
  *
51
53
  * Default value: `undefined`
52
54
  */
@@ -56,46 +58,53 @@ export interface GraphConfigInterface {
56
58
  * if the size value in the array is `undefined` or `null`.
57
59
  * Default value: `4`
58
60
  */
59
- pointDefaultSize?: number;
61
+ pointDefaultSize: number;
62
+ /**
63
+ * The default shape to use for points when no point shapes are provided via `setPointShapes()`,
64
+ * or if the shape value in the array is `undefined`, `null`, or invalid.
65
+ * Accepts a `PointShape` enum value (e.g., `PointShape.Circle`), a plain number (e.g., `2`), or a numeric string (e.g., `"2"`).
66
+ * Default value: `PointShape.Circle`
67
+ */
68
+ pointDefaultShape: PointShape | `${PointShape}`;
60
69
  /**
61
70
  * Universal opacity value applied to all points.
62
71
  * This value multiplies with individual point alpha values (if set via setPointColors).
63
72
  * Useful for dynamically controlling opacity of all points without updating individual RGBA arrays.
64
73
  * Default value: `1.0`
65
74
  */
66
- pointOpacity?: number;
75
+ pointOpacity: number;
67
76
  /**
68
77
  * Scale factor for the point size.
69
78
  * Default value: `1`
70
79
  */
71
- pointSizeScale?: number;
80
+ pointSizeScale: number;
72
81
  /**
73
82
  * Cursor style to use when hovering over a point
74
83
  * Default value: `auto`
75
84
  */
76
- hoveredPointCursor?: string;
85
+ hoveredPointCursor: string;
77
86
  /**
78
87
  * Cursor style to use when hovering over a link
79
88
  * Default value: `auto`
80
89
  */
81
- hoveredLinkCursor?: string;
90
+ hoveredLinkCursor: string;
82
91
  /**
83
92
  * Turns ring rendering around a point on hover on / off
84
93
  * Default value: `false`
85
94
  */
86
- renderHoveredPointRing?: boolean;
95
+ renderHoveredPointRing: boolean;
87
96
  /**
88
97
  * Hovered point ring color hex value.
89
98
  * Can be either a hex color string (e.g., '#b3b3b3') or an array of RGBA values.
90
99
  * Default value: `white`
91
100
  */
92
- hoveredPointRingColor?: string | [number, number, number, number];
101
+ hoveredPointRingColor: string | [number, number, number, number];
93
102
  /**
94
103
  * Focused point ring color hex value.
95
104
  * Can be either a hex color string (e.g., '#b3b3b3') or an array of RGBA values.
96
105
  * Default value: `white`
97
106
  */
98
- focusedPointRingColor?: string | [number, number, number, number];
107
+ focusedPointRingColor: string | [number, number, number, number];
99
108
  /**
100
109
  * Set focus on a point by index. A ring will be highlighted around the focused point.
101
110
  * When set to `undefined`, no point is focused.
@@ -106,36 +115,36 @@ export interface GraphConfigInterface {
106
115
  * Turns link rendering on / off.
107
116
  * Default value: `true`
108
117
  */
109
- renderLinks?: boolean;
118
+ renderLinks: boolean;
110
119
  /**
111
120
  * The default color to use for links when no link colors are provided,
112
121
  * or if the color value in the array is `undefined` or `null`.
113
122
  * This can be either a hex color string (e.g., '#666666') or an array of RGBA values
114
- * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
123
+ * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 1.
115
124
  * Default value: '#666666'
116
125
  */
117
- linkDefaultColor?: string | [number, number, number, number];
126
+ linkDefaultColor: string | [number, number, number, number];
118
127
  /**
119
128
  * Universal opacity value applied to all links.
120
129
  * This value multiplies with individual link alpha values (if set via setLinkColors).
121
130
  * Useful for dynamically controlling opacity of all links without updating individual RGBA arrays.
122
131
  * Default value: `1.0`
123
132
  */
124
- linkOpacity?: number;
133
+ linkOpacity: number;
125
134
  /**
126
135
  * Greyed out link opacity value when the selection is active.
127
136
  * Default value: `0.1`
128
137
  */
129
- linkGreyoutOpacity?: number;
138
+ linkGreyoutOpacity: number;
130
139
  /**
131
140
  * The default width value to use for links when no link widths are provided or if the width value in the array is `undefined` or `null`.
132
141
  * Default value: `1`
133
142
  */
134
- linkDefaultWidth?: number;
143
+ linkDefaultWidth: number;
135
144
  /**
136
145
  * The color to use for links when they are hovered.
137
146
  * This can be either a hex color string (e.g., '#ff3333') or an array of RGBA values
138
- * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
147
+ * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 1.
139
148
  * Default value: `undefined`
140
149
  */
141
150
  hoveredLinkColor?: string | [number, number, number, number];
@@ -144,49 +153,49 @@ export interface GraphConfigInterface {
144
153
  * The hovered width is calculated as: originalWidth + hoveredLinkWidthIncrease
145
154
  * Default value: `5`
146
155
  */
147
- hoveredLinkWidthIncrease?: number;
156
+ hoveredLinkWidthIncrease: number;
148
157
  /**
149
158
  * Scale factor for the link width.
150
159
  * Default value: `1`
151
160
  */
152
- linkWidthScale?: number;
161
+ linkWidthScale: number;
153
162
  /**
154
163
  * Increase or decrease the size of the links when zooming in or out.
155
164
  * Default value: `false`
156
165
  */
157
- scaleLinksOnZoom?: boolean;
166
+ scaleLinksOnZoom: boolean;
158
167
  /**
159
168
  * If set to true, links are rendered as curved lines.
160
169
  * Otherwise as straight lines.
161
170
  * Default value: `false`
162
171
  */
163
- curvedLinks?: boolean;
172
+ curvedLinks: boolean;
164
173
  /**
165
174
  * Number of segments in a curved line.
166
175
  * Default value: `19`.
167
176
  */
168
- curvedLinkSegments?: number;
177
+ curvedLinkSegments: number;
169
178
  /**
170
179
  * Weight affects the shape of the curve.
171
180
  * Default value: `0.8`.
172
181
  */
173
- curvedLinkWeight?: number;
182
+ curvedLinkWeight: number;
174
183
  /**
175
184
  * Defines the position of the control point of the curve on the normal from the centre of the line.
176
185
  * If set to 1 then the control point is at a distance equal to the length of the line.
177
186
  * Default value: `0.5`
178
187
  */
179
- curvedLinkControlPointDistance?: number;
188
+ curvedLinkControlPointDistance: number;
180
189
  /**
181
190
  * The default link arrow value that controls whether or not to display link arrows.
182
191
  * Default value: `false`
183
192
  */
184
- linkDefaultArrows?: boolean;
193
+ linkDefaultArrows: boolean;
185
194
  /**
186
195
  * Scale factor for the link arrows size.
187
196
  * Default value: `1`
188
197
  */
189
- linkArrowsSizeScale?: number;
198
+ linkArrowsSizeScale: number;
190
199
  /**
191
200
  * The range defines the minimum and maximum link visibility distance in pixels.
192
201
  * The link will be fully opaque when its length is less than the first number in the array,
@@ -196,77 +205,77 @@ export interface GraphConfigInterface {
196
205
  * (e.g. links become longer when you zoom in, and shorter when you zoom out).
197
206
  * Default value: `[50, 150]`
198
207
  */
199
- linkVisibilityDistanceRange?: number[];
208
+ linkVisibilityDistanceRange: number[];
200
209
  /**
201
210
  * The transparency value that the link will have when its length reaches
202
211
  * the maximum link distance value from `linkVisibilityDistanceRange`.
203
212
  * Default value: `0.25`
204
213
  */
205
- linkVisibilityMinTransparency?: number;
214
+ linkVisibilityMinTransparency: number;
206
215
  /**
207
216
  * Decay coefficient. Use smaller values if you want the simulation to "cool down" slower.
208
217
  * Default value: `5000`
209
218
  */
210
- simulationDecay?: number;
219
+ simulationDecay: number;
211
220
  /**
212
221
  * Gravity force coefficient.
213
222
  * Default value: `0.25`
214
223
  */
215
- simulationGravity?: number;
224
+ simulationGravity: number;
216
225
  /**
217
226
  * Centering to center mass force coefficient.
218
227
  * Default value: `0`
219
228
  */
220
- simulationCenter?: number;
229
+ simulationCenter: number;
221
230
  /**
222
231
  * Repulsion force coefficient.
223
232
  * Default value: `1.0`
224
233
  */
225
- simulationRepulsion?: number;
234
+ simulationRepulsion: number;
226
235
  /**
227
236
  * Decreases / increases the detalization of the Many-Body force calculations.
228
237
  * Default value: `1.15`
229
238
  */
230
- simulationRepulsionTheta?: number;
239
+ simulationRepulsionTheta: number;
231
240
  /**
232
241
  * Link spring force coefficient.
233
242
  * Default value: `1`
234
243
  */
235
- simulationLinkSpring?: number;
244
+ simulationLinkSpring: number;
236
245
  /**
237
246
  * Minimum link distance.
238
247
  * Default value: `10`
239
248
  */
240
- simulationLinkDistance?: number;
249
+ simulationLinkDistance: number;
241
250
  /**
242
251
  * Range of random link distance values.
243
252
  * Default value: `[1, 1.2]`
244
253
  */
245
- simulationLinkDistRandomVariationRange?: number[];
254
+ simulationLinkDistRandomVariationRange: number[];
246
255
  /**
247
256
  * Repulsion coefficient from mouse position.
248
257
  * The repulsion force is activated by pressing the right mouse button.
249
258
  * Default value: `2`
250
259
  */
251
- simulationRepulsionFromMouse?: number;
260
+ simulationRepulsionFromMouse: number;
252
261
  /**
253
262
  * Enable or disable the repulsion force from mouse when right-clicking.
254
263
  * When set to `true`, holding the right mouse button will activate the mouse repulsion force.
255
264
  * When set to `false`, right-clicking will not trigger any repulsion force.
256
265
  * Default value: `false`
257
266
  */
258
- enableRightClickRepulsion?: boolean;
267
+ enableRightClickRepulsion: boolean;
259
268
  /**
260
269
  * Friction coefficient.
261
270
  * Values range from 0 (high friction, stops quickly) to 1 (no friction, keeps moving).
262
271
  * Default value: `0.85`
263
272
  */
264
- simulationFriction?: number;
273
+ simulationFriction: number;
265
274
  /**
266
275
  * Cluster coefficient.
267
276
  * Default value: `0.1`
268
277
  */
269
- simulationCluster?: number;
278
+ simulationCluster: number;
270
279
  /**
271
280
  * Callback function that will be called when the simulation starts.
272
281
  * Default value: `undefined`
@@ -445,64 +454,67 @@ export interface GraphConfigInterface {
445
454
  * Show WebGL performance monitor.
446
455
  * Default value: `false`
447
456
  */
448
- showFPSMonitor?: boolean;
457
+ showFPSMonitor: boolean;
449
458
  /**
450
459
  * Pixel ratio for the canvas. Higher values use more GPU memory but provide better quality on high-DPI displays.
451
460
  * Default value: `window.devicePixelRatio || 2`
452
461
  */
453
- pixelRatio?: number;
462
+ pixelRatio: number;
454
463
  /**
455
464
  * Increase or decrease the size of the points when zooming in or out.
456
465
  * Default value: `false`
457
466
  */
458
- scalePointsOnZoom?: boolean;
467
+ scalePointsOnZoom: boolean;
459
468
  /**
460
- * Initial zoom level. Can be set once during graph initialization.
469
+ * Initial zoom level. This property will be applied only on component initialization and it
470
+ * can't be changed using the `setConfig` or `setConfigPartial` methods.
461
471
  * If set, `fitViewOnInit` value will be ignored.
462
472
  * Default value: `undefined`
463
473
  */
464
474
  initialZoomLevel?: number;
465
475
  /**
466
476
  * Enables or disables zooming in and out.
467
- * Default: `true`
477
+ * Default value: `true`
468
478
  */
469
- enableZoom?: boolean;
479
+ enableZoom: boolean;
470
480
  /**
471
- * Controls whether the simulation remains active during zoom operations.
481
+ * Controls whether the simulation remains active during interactive (user-driven) zoom operations.
472
482
  * When set to `true`, the simulation continues running while zooming.
473
483
  * When set to `false`, the simulation pauses during zoom operations.
484
+ * Programmatic zoom methods (e.g., `zoomToPointByIndex`, `fitView`) default to running the simulation
485
+ * regardless of this setting, but can be controlled via their `enableSimulation` parameter.
474
486
  * Default value: `false`
475
487
  */
476
- enableSimulationDuringZoom?: boolean;
488
+ enableSimulationDuringZoom: boolean;
477
489
  /**
478
490
  * Enables or disables dragging of points in the graph.
479
491
  * Default value: `false`
480
492
  */
481
- enableDrag?: boolean;
493
+ enableDrag: boolean;
482
494
  /**
483
495
  * Whether to center and zoom the view to fit all points in the scene on initialization or not.
484
496
  * Ignored if `initialZoomLevel` is set.
485
497
  * Default: `true`
486
498
  */
487
- fitViewOnInit?: boolean;
499
+ fitViewOnInit: boolean;
488
500
  /**
489
501
  * Delay in milliseconds before fitting the view when `fitViewOnInit` is enabled.
490
502
  * Useful if you want the layout to stabilize a bit before fitting.
491
503
  * Default: `250`
492
504
  */
493
- fitViewDelay?: number;
505
+ fitViewDelay: number;
494
506
  /**
495
507
  * Padding to apply when fitting the view to show all points.
496
- * This value is added to the calculated bounding box to provide some extra space around the points.
508
+ * This value should be between 0 and 1, and is added to the calculated bounding box to provide some extra space around the points.
497
509
  * This is used when the `fitViewOnInit` option is enabled.
498
510
  * Default: `0.1`
499
511
  */
500
- fitViewPadding?: number;
512
+ fitViewPadding: number;
501
513
  /**
502
514
  * Duration in milliseconds for fitting the view to show all points when fitViewOnInit is enabled.
503
515
  * Default: `250`
504
516
  */
505
- fitViewDuration?: number;
517
+ fitViewDuration: number;
506
518
  /**
507
519
  * When `fitViewOnInit` is set to `true`, fits the view to show the points within a rectangle
508
520
  * defined by its two corner coordinates `[[left, bottom], [right, top]]` in the scene space.
@@ -520,22 +532,22 @@ export interface GraphConfigInterface {
520
532
  * the randomness of the layout across different simulation runs.
521
533
  * It is useful when you want the graph to always look the same on same datasets.
522
534
  * This property will be applied only on component initialization and it
523
- * can't be changed using the `setConfig` method.
535
+ * can't be changed using the `setConfig` or `setConfigPartial` methods.
524
536
  * Default value: undefined
525
537
  */
526
538
  randomSeed?: number | string;
527
539
  /**
528
540
  * Point sampling distance in pixels between neighboring points when calling the `getSampledPointPositionsMap` method.
529
541
  * This parameter determines how many points will be included in the sample.
530
- * Default value: `150`
542
+ * Default value: `100`
531
543
  */
532
- pointSamplingDistance?: number;
544
+ pointSamplingDistance: number;
533
545
  /**
534
546
  * Link sampling distance in pixels between neighboring links when calling the `getSampledLinks` method.
535
547
  * This parameter determines how many links will be included in the sample (based on link midpoints in screen space).
536
- * Default value: `150`
548
+ * Default value: `100`
537
549
  */
538
- linkSamplingDistance?: number;
550
+ linkSamplingDistance: number;
539
551
  /**
540
552
  * Controls automatic position adjustment of points in the visible space.
541
553
  *
@@ -547,103 +559,54 @@ export interface GraphConfigInterface {
547
559
  * When explicitly set:
548
560
  * - `true`: Forces points positions to be rescaled
549
561
  * - `false`: Forces points positions to not be rescaled
562
+ *
563
+ * Default value: `undefined`
550
564
  */
551
565
  rescalePositions?: boolean | undefined;
552
566
  /**
553
567
  * Controls the text shown in the bottom right corner.
554
568
  * - When a non-empty string is provided: Displays the string as HTML
555
569
  * - When empty string or not provided: No text is displayed
570
+ *
571
+ * This property is applied only on component initialization and
572
+ * can't be changed using the `setConfig` or `setConfigPartial` methods.
573
+ *
574
+ * Default value: `''`
556
575
  */
557
- attribution?: string;
558
- }
559
- export declare class GraphConfig implements GraphConfigInterface {
560
- enableSimulation: boolean;
561
- backgroundColor: string;
562
- spaceSize: number;
563
- pointDefaultColor: string;
564
- pointGreyoutOpacity: undefined;
565
- pointGreyoutColor: undefined;
566
- pointDefaultSize: number;
567
- pointOpacity: number;
568
- pointSizeScale: number;
569
- hoveredPointCursor: string;
570
- hoveredLinkCursor: string;
571
- renderHoveredPointRing: boolean;
572
- hoveredPointRingColor: string;
573
- focusedPointRingColor: string;
574
- focusedPointIndex: undefined;
575
- linkDefaultColor: string;
576
- linkOpacity: number;
577
- linkGreyoutOpacity: number;
578
- linkDefaultWidth: number;
579
- linkWidthScale: number;
580
- hoveredLinkColor: undefined;
581
- hoveredLinkWidthIncrease: number;
582
- renderLinks: boolean;
583
- curvedLinks: boolean;
584
- curvedLinkSegments: number;
585
- curvedLinkWeight: number;
586
- curvedLinkControlPointDistance: number;
587
- linkDefaultArrows: boolean;
588
- linkArrowsSizeScale: number;
589
- scaleLinksOnZoom: boolean;
590
- linkVisibilityDistanceRange: number[];
591
- linkVisibilityMinTransparency: number;
592
- simulationDecay: number;
593
- simulationGravity: number;
594
- simulationCenter: number;
595
- simulationRepulsion: number;
596
- simulationRepulsionTheta: number;
597
- simulationLinkSpring: number;
598
- simulationLinkDistance: number;
599
- simulationLinkDistRandomVariationRange: number[];
600
- simulationRepulsionFromMouse: number;
601
- enableRightClickRepulsion: boolean;
602
- simulationFriction: number;
603
- simulationCluster: number;
604
- onSimulationStart: GraphConfigInterface['onSimulationStart'];
605
- onSimulationTick: GraphConfigInterface['onSimulationTick'];
606
- onSimulationEnd: GraphConfigInterface['onSimulationEnd'];
607
- onSimulationPause: GraphConfigInterface['onSimulationPause'];
608
- onSimulationUnpause: GraphConfigInterface['onSimulationUnpause'];
609
- onClick: GraphConfigInterface['onClick'];
610
- onPointClick: GraphConfigInterface['onPointClick'];
611
- onLinkClick: GraphConfigInterface['onLinkClick'];
612
- onBackgroundClick: GraphConfigInterface['onBackgroundClick'];
613
- onContextMenu: GraphConfigInterface['onContextMenu'];
614
- onPointContextMenu: GraphConfigInterface['onPointContextMenu'];
615
- onLinkContextMenu: GraphConfigInterface['onLinkContextMenu'];
616
- onBackgroundContextMenu: GraphConfigInterface['onBackgroundContextMenu'];
617
- onMouseMove: GraphConfigInterface['onMouseMove'];
618
- onPointMouseOver: GraphConfigInterface['onPointMouseOver'];
619
- onPointMouseOut: GraphConfigInterface['onPointMouseOut'];
620
- onLinkMouseOver: GraphConfigInterface['onLinkMouseOver'];
621
- onLinkMouseOut: GraphConfigInterface['onLinkMouseOut'];
622
- onZoomStart: GraphConfigInterface['onZoomStart'];
623
- onZoom: GraphConfigInterface['onZoom'];
624
- onZoomEnd: GraphConfigInterface['onZoomEnd'];
625
- onDragStart: GraphConfigInterface['onDragStart'];
626
- onDrag: GraphConfigInterface['onDrag'];
627
- onDragEnd: GraphConfigInterface['onDragEnd'];
628
- showFPSMonitor: boolean;
629
- pixelRatio: number;
630
- scalePointsOnZoom: boolean;
631
- initialZoomLevel: undefined;
632
- enableZoom: boolean;
633
- enableSimulationDuringZoom: boolean;
634
- enableDrag: boolean;
635
- fitViewOnInit: boolean;
636
- fitViewDelay: number;
637
- fitViewPadding: number;
638
- fitViewDuration: number;
639
- fitViewByPointsInRect: undefined;
640
- fitViewByPointIndices: undefined;
641
- randomSeed: undefined;
642
- pointSamplingDistance: number;
643
- linkSamplingDistance: number;
644
576
  attribution: string;
645
- rescalePositions: undefined;
646
- init(config: GraphConfigInterface): void;
647
- deepMergeConfig<T>(current: T, next: T, key: keyof T): void;
648
- private getConfig;
649
577
  }
578
+ /**
579
+ * Requires all keys from T to be present, while preserving
580
+ * the original value types (including `| undefined` for optional properties).
581
+ */
582
+ export type Complete<T> = {
583
+ [K in keyof Required<T>]: T[K];
584
+ };
585
+ /**
586
+ * Configuration options for the Graph constructor and `setConfig()` method.
587
+ * All properties are optional — any omitted properties will use their default values.
588
+ *
589
+ * Note: calling `setConfig()` fully resets the configuration to defaults before
590
+ * applying the provided values. Properties not included in the call will revert
591
+ * to their defaults, not retain their previous values.
592
+ */
593
+ export type GraphConfig = Partial<GraphConfigInterface>;
594
+ /** Returns a fresh copy of `defaultConfigValues` with arrays cloned to prevent shared references. */
595
+ export declare function createDefaultConfig(): GraphConfigInterface;
596
+ /**
597
+ * Resets the config object to default values in place, preserving the object reference
598
+ * so that modules (Zoom, Store, etc.) that hold a reference to it stay in sync.
599
+ */
600
+ export declare function resetConfigToDefaults(target: GraphConfigInterface): void;
601
+ /**
602
+ * Applies only the provided `source` values onto `target`, leaving all other
603
+ * properties unchanged.
604
+ *
605
+ * Mutates `target` in place (via `Object.assign`) rather than replacing it,
606
+ * because multiple modules (Zoom, Store, etc.) hold a reference to the same config object.
607
+ *
608
+ * - When `useDefaultsForUndefined` is `false` (default): explicit `undefined` values in `source` are skipped.
609
+ * - When `useDefaultsForUndefined` is `true`: explicit `undefined` values are replaced with their defaults.
610
+ * - Array values are shallow-cloned to prevent shared references.
611
+ */
612
+ export declare function applyConfig(target: GraphConfigInterface, source: GraphConfig, useDefaultsForUndefined?: boolean): void;