@cosmos.gl/graph 2.7.0-beta.0 → 2.7.0-beta.2

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 (203) hide show
  1. package/dist/{index-FUIgayhu.js → index-CSMQs8iI.js} +4920 -4871
  2. package/dist/index-CSMQs8iI.js.map +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/index.min.js +71 -74
  5. package/dist/index.min.js.map +1 -1
  6. package/dist/{config.d.ts → src/config.d.ts} +18 -21
  7. package/dist/{index.d.ts → src/index.d.ts} +77 -7
  8. package/dist/{modules → src/modules}/Clusters/index.d.ts +6 -7
  9. package/dist/{modules → src/modules}/ForceCenter/index.d.ts +5 -4
  10. package/dist/{modules → src/modules}/ForceGravity/index.d.ts +5 -2
  11. package/dist/{modules → src/modules}/ForceLink/index.d.ts +5 -2
  12. package/dist/{modules → src/modules}/ForceManyBody/index.d.ts +5 -4
  13. package/dist/{modules → src/modules}/ForceMouse/index.d.ts +5 -2
  14. package/dist/{modules → src/modules}/GraphData/index.d.ts +1 -0
  15. package/dist/{modules → src/modules}/Lines/index.d.ts +5 -0
  16. package/dist/{modules → src/modules}/Points/index.d.ts +6 -8
  17. package/dist/src/modules/Shared/buffer.d.ts +1 -0
  18. package/dist/src/modules/Shared/texture-utils.d.ts +8 -0
  19. package/dist/src/modules/Shared/uniform-utils.d.ts +11 -0
  20. package/dist/{modules → src/modules}/Store/index.d.ts +1 -0
  21. package/dist/{variables.d.ts → src/variables.d.ts} +0 -2
  22. package/dist/vite.config.d.ts +2 -0
  23. package/dist/{webgl-device-B9ewDj5L.js → webgl-device-QoBMYpnS.js} +204 -194
  24. package/dist/webgl-device-QoBMYpnS.js.map +1 -0
  25. package/package.json +9 -6
  26. package/.eslintrc +0 -147
  27. package/.github/SECURITY.md +0 -13
  28. package/.github/dco.yml +0 -4
  29. package/.github/workflows/github_pages.yml +0 -54
  30. package/.storybook/main.ts +0 -26
  31. package/.storybook/manager-head.html +0 -1
  32. package/.storybook/manager.ts +0 -14
  33. package/.storybook/preview.ts +0 -29
  34. package/.storybook/style.css +0 -3
  35. package/CHARTER.md +0 -69
  36. package/CODE_OF_CONDUCT.md +0 -178
  37. package/CONTRIBUTING.md +0 -22
  38. package/GOVERNANCE.md +0 -21
  39. package/cosmos-2-0-migration-notes.md +0 -98
  40. package/cosmos_awesome.md +0 -96
  41. package/dist/index-FUIgayhu.js.map +0 -1
  42. package/dist/modules/ForceManyBody/quadtree-frag-shader.d.ts +0 -1
  43. package/dist/modules/ForceManyBodyQuadtree/index.d.ts +0 -15
  44. package/dist/modules/ForceManyBodyQuadtree/quadtree-frag-shader.d.ts +0 -1
  45. package/dist/modules/Shared/buffer.d.ts +0 -8
  46. package/dist/stories/beginners/basic-set-up/data-gen.d.ts +0 -4
  47. package/dist/stories/beginners/basic-set-up/index.d.ts +0 -6
  48. package/dist/stories/beginners/link-hovering/data-generator.d.ts +0 -19
  49. package/dist/stories/beginners/link-hovering/index.d.ts +0 -6
  50. package/dist/stories/beginners/point-labels/data.d.ts +0 -13
  51. package/dist/stories/beginners/point-labels/index.d.ts +0 -10
  52. package/dist/stories/beginners/point-labels/labels.d.ts +0 -8
  53. package/dist/stories/beginners/quick-start.d.ts +0 -6
  54. package/dist/stories/beginners/remove-points/config.d.ts +0 -2
  55. package/dist/stories/beginners/remove-points/data-gen.d.ts +0 -4
  56. package/dist/stories/beginners/remove-points/index.d.ts +0 -6
  57. package/dist/stories/beginners.stories.d.ts +0 -10
  58. package/dist/stories/clusters/polygon-selection/index.d.ts +0 -6
  59. package/dist/stories/clusters/polygon-selection/polygon.d.ts +0 -20
  60. package/dist/stories/clusters/radial.d.ts +0 -6
  61. package/dist/stories/clusters/with-labels.d.ts +0 -6
  62. package/dist/stories/clusters/worm.d.ts +0 -6
  63. package/dist/stories/clusters.stories.d.ts +0 -9
  64. package/dist/stories/create-cluster-labels.d.ts +0 -4
  65. package/dist/stories/create-cosmos.d.ts +0 -17
  66. package/dist/stories/create-story.d.ts +0 -16
  67. package/dist/stories/experiments/full-mesh.d.ts +0 -6
  68. package/dist/stories/experiments/mesh-with-holes.d.ts +0 -6
  69. package/dist/stories/experiments.stories.d.ts +0 -7
  70. package/dist/stories/generate-mesh-data.d.ts +0 -12
  71. package/dist/stories/geospatial/moscow-metro-stations/index.d.ts +0 -16
  72. package/dist/stories/geospatial/moscow-metro-stations/moscow-metro-coords.d.ts +0 -1
  73. package/dist/stories/geospatial/moscow-metro-stations/point-colors.d.ts +0 -1
  74. package/dist/stories/geospatial.stories.d.ts +0 -6
  75. package/dist/stories/shapes/all-shapes/index.d.ts +0 -6
  76. package/dist/stories/shapes/image-example/index.d.ts +0 -6
  77. package/dist/stories/shapes.stories.d.ts +0 -7
  78. package/dist/stories/test-luma-migration.d.ts +0 -6
  79. package/dist/stories/test.stories.d.ts +0 -6
  80. package/dist/webgl-device-B9ewDj5L.js.map +0 -1
  81. package/logo.svg +0 -3
  82. package/rollup.config.js +0 -70
  83. package/src/config.ts +0 -728
  84. package/src/declaration.d.ts +0 -12
  85. package/src/graph/utils/error-message.ts +0 -23
  86. package/src/helper.ts +0 -113
  87. package/src/index.ts +0 -1769
  88. package/src/modules/Clusters/calculate-centermass.frag +0 -12
  89. package/src/modules/Clusters/calculate-centermass.vert +0 -38
  90. package/src/modules/Clusters/force-cluster.frag +0 -55
  91. package/src/modules/Clusters/index.ts +0 -578
  92. package/src/modules/Drag/index.ts +0 -33
  93. package/src/modules/FPSMonitor/css.ts +0 -53
  94. package/src/modules/FPSMonitor/index.ts +0 -28
  95. package/src/modules/ForceCenter/calculate-centermass.frag +0 -9
  96. package/src/modules/ForceCenter/calculate-centermass.vert +0 -26
  97. package/src/modules/ForceCenter/force-center.frag +0 -37
  98. package/src/modules/ForceCenter/index.ts +0 -284
  99. package/src/modules/ForceGravity/force-gravity.frag +0 -40
  100. package/src/modules/ForceGravity/index.ts +0 -107
  101. package/src/modules/ForceLink/force-spring.ts +0 -89
  102. package/src/modules/ForceLink/index.ts +0 -293
  103. package/src/modules/ForceManyBody/calculate-level.frag +0 -9
  104. package/src/modules/ForceManyBody/calculate-level.vert +0 -37
  105. package/src/modules/ForceManyBody/force-centermass.frag +0 -61
  106. package/src/modules/ForceManyBody/force-level.frag +0 -138
  107. package/src/modules/ForceManyBody/index.ts +0 -525
  108. package/src/modules/ForceManyBody/quadtree-frag-shader.ts +0 -89
  109. package/src/modules/ForceManyBodyQuadtree/calculate-level.frag +0 -9
  110. package/src/modules/ForceManyBodyQuadtree/calculate-level.vert +0 -25
  111. package/src/modules/ForceManyBodyQuadtree/index.ts +0 -157
  112. package/src/modules/ForceManyBodyQuadtree/quadtree-frag-shader.ts +0 -93
  113. package/src/modules/ForceMouse/force-mouse.frag +0 -35
  114. package/src/modules/ForceMouse/index.ts +0 -102
  115. package/src/modules/GraphData/index.ts +0 -383
  116. package/src/modules/Lines/draw-curve-line.frag +0 -59
  117. package/src/modules/Lines/draw-curve-line.vert +0 -248
  118. package/src/modules/Lines/geometry.ts +0 -18
  119. package/src/modules/Lines/hovered-line-index.frag +0 -43
  120. package/src/modules/Lines/hovered-line-index.vert +0 -13
  121. package/src/modules/Lines/index.ts +0 -661
  122. package/src/modules/Points/atlas-utils.ts +0 -137
  123. package/src/modules/Points/drag-point.frag +0 -34
  124. package/src/modules/Points/draw-highlighted.frag +0 -44
  125. package/src/modules/Points/draw-highlighted.vert +0 -145
  126. package/src/modules/Points/draw-points.frag +0 -259
  127. package/src/modules/Points/draw-points.vert +0 -203
  128. package/src/modules/Points/fill-sampled-points.frag +0 -12
  129. package/src/modules/Points/fill-sampled-points.vert +0 -51
  130. package/src/modules/Points/find-hovered-point.frag +0 -15
  131. package/src/modules/Points/find-hovered-point.vert +0 -90
  132. package/src/modules/Points/find-points-on-area-selection.frag +0 -88
  133. package/src/modules/Points/find-points-on-polygon-selection.frag +0 -89
  134. package/src/modules/Points/index.ts +0 -2292
  135. package/src/modules/Points/track-positions.frag +0 -30
  136. package/src/modules/Points/update-position.frag +0 -39
  137. package/src/modules/Shared/buffer.ts +0 -39
  138. package/src/modules/Shared/clear.frag +0 -10
  139. package/src/modules/Shared/quad.vert +0 -13
  140. package/src/modules/Store/index.ts +0 -283
  141. package/src/modules/Zoom/index.ts +0 -148
  142. package/src/modules/core-module.ts +0 -28
  143. package/src/stories/1. welcome.mdx +0 -75
  144. package/src/stories/2. configuration.mdx +0 -111
  145. package/src/stories/3. api-reference.mdx +0 -591
  146. package/src/stories/beginners/basic-set-up/data-gen.ts +0 -33
  147. package/src/stories/beginners/basic-set-up/index.ts +0 -167
  148. package/src/stories/beginners/basic-set-up/style.css +0 -35
  149. package/src/stories/beginners/link-hovering/data-generator.ts +0 -198
  150. package/src/stories/beginners/link-hovering/index.ts +0 -65
  151. package/src/stories/beginners/link-hovering/style.css +0 -73
  152. package/src/stories/beginners/point-labels/data.ts +0 -73
  153. package/src/stories/beginners/point-labels/index.ts +0 -69
  154. package/src/stories/beginners/point-labels/labels.ts +0 -46
  155. package/src/stories/beginners/point-labels/style.css +0 -16
  156. package/src/stories/beginners/quick-start.ts +0 -54
  157. package/src/stories/beginners/remove-points/config.ts +0 -25
  158. package/src/stories/beginners/remove-points/data-gen.ts +0 -30
  159. package/src/stories/beginners/remove-points/index.ts +0 -96
  160. package/src/stories/beginners/remove-points/style.css +0 -31
  161. package/src/stories/beginners.stories.ts +0 -130
  162. package/src/stories/clusters/polygon-selection/index.ts +0 -52
  163. package/src/stories/clusters/polygon-selection/polygon.ts +0 -143
  164. package/src/stories/clusters/polygon-selection/style.css +0 -8
  165. package/src/stories/clusters/radial.ts +0 -24
  166. package/src/stories/clusters/with-labels.ts +0 -54
  167. package/src/stories/clusters/worm.ts +0 -40
  168. package/src/stories/clusters.stories.ts +0 -77
  169. package/src/stories/create-cluster-labels.ts +0 -50
  170. package/src/stories/create-cosmos.ts +0 -72
  171. package/src/stories/create-story.ts +0 -51
  172. package/src/stories/experiments/full-mesh.ts +0 -13
  173. package/src/stories/experiments/mesh-with-holes.ts +0 -13
  174. package/src/stories/experiments.stories.ts +0 -43
  175. package/src/stories/generate-mesh-data.ts +0 -125
  176. package/src/stories/geospatial/moscow-metro-stations/index.ts +0 -66
  177. package/src/stories/geospatial/moscow-metro-stations/moscow-metro-coords.ts +0 -1
  178. package/src/stories/geospatial/moscow-metro-stations/point-colors.ts +0 -46
  179. package/src/stories/geospatial/moscow-metro-stations/style.css +0 -30
  180. package/src/stories/geospatial.stories.ts +0 -30
  181. package/src/stories/shapes/all-shapes/index.ts +0 -73
  182. package/src/stories/shapes/image-example/icons/box.png +0 -0
  183. package/src/stories/shapes/image-example/icons/lego.png +0 -0
  184. package/src/stories/shapes/image-example/icons/s.png +0 -0
  185. package/src/stories/shapes/image-example/icons/swift.png +0 -0
  186. package/src/stories/shapes/image-example/icons/toolbox.png +0 -0
  187. package/src/stories/shapes/image-example/index.ts +0 -246
  188. package/src/stories/shapes.stories.ts +0 -37
  189. package/src/stories/test-luma-migration.ts +0 -195
  190. package/src/stories/test.stories.ts +0 -25
  191. package/src/variables.ts +0 -68
  192. package/tsconfig.json +0 -41
  193. package/vite.config.ts +0 -52
  194. /package/dist/{graph → src/graph}/utils/error-message.d.ts +0 -0
  195. /package/dist/{helper.d.ts → src/helper.d.ts} +0 -0
  196. /package/dist/{modules → src/modules}/Drag/index.d.ts +0 -0
  197. /package/dist/{modules → src/modules}/FPSMonitor/css.d.ts +0 -0
  198. /package/dist/{modules → src/modules}/FPSMonitor/index.d.ts +0 -0
  199. /package/dist/{modules → src/modules}/ForceLink/force-spring.d.ts +0 -0
  200. /package/dist/{modules → src/modules}/Lines/geometry.d.ts +0 -0
  201. /package/dist/{modules → src/modules}/Points/atlas-utils.d.ts +0 -0
  202. /package/dist/{modules → src/modules}/Zoom/index.d.ts +0 -0
  203. /package/dist/{modules → src/modules}/core-module.d.ts +0 -0
@@ -27,13 +27,15 @@ export interface GraphConfigInterface {
27
27
  * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
28
28
  * Default value: '#b3b3b3'
29
29
  */
30
+ pointDefaultColor?: string | [number, number, number, number];
31
+ /** @deprecated Use `pointDefaultColor` instead */
30
32
  pointColor?: string | [number, number, number, number];
31
33
  /**
32
34
  * The color to use for points when they are greyed out (when selection is active).
33
35
  * This can be either a hex color string (e.g., '#b3b3b3') or an array of RGBA values
34
36
  * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
35
37
  *
36
- * If not provided, the color will be the same as the `pointColor`,
38
+ * If not provided, the color will be the same as the point's original color,
37
39
  * but darkened or lightened depending on the background color.
38
40
  *
39
41
  * If `pointGreyoutOpacity` is also defined, it will override the alpha/opacity component
@@ -56,6 +58,8 @@ export interface GraphConfigInterface {
56
58
  * if the size value in the array is `undefined` or `null`.
57
59
  * Default value: `4`
58
60
  */
61
+ pointDefaultSize?: number;
62
+ /** @deprecated Use `pointDefaultSize` instead */
59
63
  pointSize?: number;
60
64
  /**
61
65
  * Universal opacity value applied to all points.
@@ -114,6 +118,8 @@ export interface GraphConfigInterface {
114
118
  * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
115
119
  * Default value: '#666666'
116
120
  */
121
+ linkDefaultColor?: string | [number, number, number, number];
122
+ /** @deprecated Use `linkDefaultColor` instead */
117
123
  linkColor?: string | [number, number, number, number];
118
124
  /**
119
125
  * Universal opacity value applied to all links.
@@ -131,6 +137,8 @@ export interface GraphConfigInterface {
131
137
  * 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
138
  * Default value: `1`
133
139
  */
140
+ linkDefaultWidth?: number;
141
+ /** @deprecated Use `linkDefaultWidth` instead */
134
142
  linkWidth?: number;
135
143
  /**
136
144
  * The color to use for links when they are hovered.
@@ -181,6 +189,8 @@ export interface GraphConfigInterface {
181
189
  * The default link arrow value that controls whether or not to display link arrows.
182
190
  * Default value: `false`
183
191
  */
192
+ linkDefaultArrows?: boolean;
193
+ /** @deprecated Use `linkDefaultArrows` instead */
184
194
  linkArrows?: boolean;
185
195
  /**
186
196
  * Scale factor for the link arrows size.
@@ -203,13 +213,6 @@ export interface GraphConfigInterface {
203
213
  * Default value: `0.25`
204
214
  */
205
215
  linkVisibilityMinTransparency?: number;
206
- /**
207
- * Use the classic quadtree algorithm for the Many-Body force.
208
- * This property will be applied only on component initialization and it
209
- * can't be changed using the `setConfig` method.
210
- * Default value: `false`
211
- */
212
- useClassicQuadtree?: boolean;
213
216
  /**
214
217
  * Decay coefficient. Use smaller values if you want the simulation to "cool down" slower.
215
218
  * Default value: `5000`
@@ -232,16 +235,9 @@ export interface GraphConfigInterface {
232
235
  simulationRepulsion?: number;
233
236
  /**
234
237
  * Decreases / increases the detalization of the Many-Body force calculations.
235
- * When `useClassicQuadtree` is set to `true`, this property corresponds to the Barnes–Hut approximation criterion.
236
238
  * Default value: `1.15`
237
239
  */
238
240
  simulationRepulsionTheta?: number;
239
- /**
240
- * Barnes–Hut approximation depth.
241
- * Can only be used when `useClassicQuadtree` is set `true`.
242
- * Default value: `12`
243
- */
244
- simulationRepulsionQuadtreeLevels?: number;
245
241
  /**
246
242
  * Link spring force coefficient.
247
243
  * Default value: `1`
@@ -437,10 +433,8 @@ export interface GraphConfigInterface {
437
433
  */
438
434
  showFPSMonitor?: boolean;
439
435
  /**
440
- * Pixel ratio for the canvas. Controls the resolution of the drawing buffer.
441
- * - Higher values use more GPU memory but provide better quality on high-DPI displays
442
- * - If not provided, uses `window.devicePixelRatio` or falls back to `2`
443
- * Default value: `typeof window !== 'undefined' ? window.devicePixelRatio || 2 : 2`
436
+ * Pixel ratio for the canvas. Higher values use more GPU memory but provide better quality on high-DPI displays.
437
+ * Default value: `window.devicePixelRatio || 2`
444
438
  */
445
439
  pixelRatio?: number;
446
440
  /**
@@ -547,9 +541,11 @@ export declare class GraphConfig implements GraphConfigInterface {
547
541
  backgroundColor: string;
548
542
  spaceSize: number;
549
543
  pointColor: string;
544
+ pointDefaultColor: undefined;
550
545
  pointGreyoutOpacity: undefined;
551
546
  pointGreyoutColor: undefined;
552
547
  pointSize: number;
548
+ pointDefaultSize: undefined;
553
549
  pointOpacity: number;
554
550
  pointSizeScale: number;
555
551
  hoveredPointCursor: string;
@@ -559,9 +555,11 @@ export declare class GraphConfig implements GraphConfigInterface {
559
555
  focusedPointRingColor: string;
560
556
  focusedPointIndex: undefined;
561
557
  linkColor: string;
558
+ linkDefaultColor: undefined;
562
559
  linkOpacity: number;
563
560
  linkGreyoutOpacity: number;
564
561
  linkWidth: number;
562
+ linkDefaultWidth: undefined;
565
563
  linkWidthScale: number;
566
564
  hoveredLinkColor: undefined;
567
565
  hoveredLinkWidthIncrease: number;
@@ -571,17 +569,16 @@ export declare class GraphConfig implements GraphConfigInterface {
571
569
  curvedLinkWeight: number;
572
570
  curvedLinkControlPointDistance: number;
573
571
  linkArrows: boolean;
572
+ linkDefaultArrows: undefined;
574
573
  linkArrowsSizeScale: number;
575
574
  scaleLinksOnZoom: boolean;
576
575
  linkVisibilityDistanceRange: number[];
577
576
  linkVisibilityMinTransparency: number;
578
- useClassicQuadtree: boolean;
579
577
  simulationDecay: number;
580
578
  simulationGravity: number;
581
579
  simulationCenter: number;
582
580
  simulationRepulsion: number;
583
581
  simulationRepulsionTheta: number;
584
- simulationRepulsionQuadtreeLevels: number;
585
582
  simulationLinkSpring: number;
586
583
  simulationLinkDistance: number;
587
584
  simulationLinkDistRandomVariationRange: number[];
@@ -1,3 +1,4 @@
1
+ import { Device } from '@luma.gl/core';
1
2
  import { GraphConfig, GraphConfigInterface } from './config';
2
3
  import { GraphData } from './modules/GraphData';
3
4
  export declare class Graph {
@@ -53,7 +54,7 @@ export declare class Graph {
53
54
  private isForceCenterUpdateNeeded;
54
55
  private isPointImageSizesUpdateNeeded;
55
56
  private _isDestroyed;
56
- constructor(div: HTMLDivElement, config?: GraphConfigInterface);
57
+ constructor(div: HTMLDivElement, config?: GraphConfigInterface, devicePromise?: Promise<Device>);
57
58
  /**
58
59
  * Returns the current simulation progress
59
60
  */
@@ -239,11 +240,31 @@ export declare class Graph {
239
240
  */
240
241
  setPointClusterStrength(clusterStrength: Float32Array): void;
241
242
  /**
242
- * Renders the graph.
243
+ * Sets which points are pinned (fixed) in position.
243
244
  *
244
- * @param {number} [simulationAlpha] - Optional value between 0 and 1
245
- * that controls the initial energy of the simulation.The higher the value,
246
- * the more initial energy the simulation will get. Zero value stops the simulation.
245
+ * Pinned points:
246
+ * - Do not move due to physics forces (gravity, repulsion, link forces, etc.)
247
+ * - Still participate in force calculations (other nodes are attracted to/repelled by them)
248
+ * - Can still be dragged by the user if `enableDrag` is true
249
+ *
250
+ * @param {number[] | null} pinnedIndices - Array of point indices to pin. Set to `[]` or `null` to unpin all points.
251
+ * @example
252
+ * // Pin points 0 and 5
253
+ * graph.setPinnedPoints([0, 5])
254
+ *
255
+ * // Unpin all points
256
+ * graph.setPinnedPoints([])
257
+ * graph.setPinnedPoints(null)
258
+ */
259
+ setPinnedPoints(pinnedIndices: number[] | null): void;
260
+ /**
261
+ * Renders the graph and starts rendering.
262
+ * Does NOT modify simulation state - use start(), stop(), pause(), unpause() to control simulation.
263
+ *
264
+ * @param {number} [simulationAlpha] - Optional alpha value to set.
265
+ * - If 0: Sets alpha to 0, simulation stops after one frame (graph becomes static).
266
+ * - If positive: Sets alpha to that value.
267
+ * - If undefined: Keeps current alpha value.
247
268
  */
248
269
  render(simulationAlpha?: number): void;
249
270
  /**
@@ -440,12 +461,19 @@ export declare class Graph {
440
461
  getScaleY(): ((y: number) => number) | undefined;
441
462
  /**
442
463
  * Start the simulation.
464
+ * This only controls the simulation state, not rendering.
443
465
  * @param alpha Value from 0 to 1. The higher the value, the more initial energy the simulation will get.
444
466
  */
445
467
  start(alpha?: number): void;
468
+ /**
469
+ * Stop the simulation. This stops the simulation and resets its state.
470
+ * Use start() to begin a new simulation cycle.
471
+ */
472
+ stop(): void;
446
473
  /**
447
474
  * Pause the simulation. When paused, the simulation stops running
448
- * and can be resumed using the unpause method.
475
+ * but preserves its current state (progress, alpha).
476
+ * Can be resumed using the unpause method.
449
477
  */
450
478
  pause(): void;
451
479
  /**
@@ -460,7 +488,8 @@ export declare class Graph {
460
488
  */
461
489
  restart(): void;
462
490
  /**
463
- * Render only one frame of the simulation (stops the simulation if it was running).
491
+ * Run one step of the simulation manually.
492
+ * Works even when the simulation is paused.
464
493
  */
465
494
  step(): void;
466
495
  /**
@@ -490,15 +519,56 @@ export declare class Graph {
490
519
  * @returns true if device was not ready and operation was queued, false if device is ready
491
520
  */
492
521
  private ensureDevice;
522
+ /**
523
+ * Validates that a device has the required HTMLCanvasElement canvas context.
524
+ * Cosmos requires an HTMLCanvasElement canvas context and does not support
525
+ * OffscreenCanvas or compute-only devices.
526
+ * @param device - The device to validate
527
+ * @returns The validated canvas context (guaranteed to be non-null and HTMLCanvasElement type)
528
+ * @throws Error if the device does not meet Cosmos requirements
529
+ */
530
+ private validateDevice;
493
531
  /**
494
532
  * Internal device creation method
495
533
  * Graph class decides what device to create with sensible defaults
496
534
  */
497
535
  private createDevice;
536
+ /**
537
+ * Updates and recreates the graph visualization based on pending changes.
538
+ *
539
+ * @param simulationAlpha - Optional alpha value to set. If not provided, keeps current alpha.
540
+ */
498
541
  private update;
542
+ /**
543
+ * Runs one step of the simulation (forces, position updates, alpha decay).
544
+ * This is the core simulation logic that can be called by step() or during rendering.
545
+ *
546
+ * @param forceExecution - Controls whether to run the simulation step when paused.
547
+ * - If true: Always runs the simulation step, even when isSimulationRunning is false.
548
+ * Used by step() to allow manual stepping while the simulation is paused.
549
+ * - If false: Only runs if isSimulationRunning is true. Used during rendering
550
+ * to respect pause/unpause state.
551
+ */
552
+ private runSimulationStep;
499
553
  private initPrograms;
554
+ /**
555
+ * The rendering loop - schedules itself to run continuously
556
+ */
500
557
  private frame;
558
+ /**
559
+ * Renders a single frame (the actual rendering logic).
560
+ * This does NOT schedule the next frame.
561
+ */
562
+ private renderFrame;
501
563
  private stopFrames;
564
+ /**
565
+ * Starts continuous rendering
566
+ */
567
+ private startFrames;
568
+ /**
569
+ * Called automatically when simulation completes (alpha < ALPHA_MIN).
570
+ * Rendering continues after this is called (for rendering/interaction).
571
+ */
502
572
  private end;
503
573
  private onClick;
504
574
  private updateMousePosition;
@@ -1,12 +1,8 @@
1
- import { Framebuffer, RenderPass } from '@luma.gl/core';
1
+ import { Framebuffer } from '@luma.gl/core';
2
2
  import { CoreModule } from '../core-module';
3
3
  export declare class Clusters extends CoreModule {
4
4
  centermassFbo: Framebuffer | undefined;
5
5
  clusterCount: number | undefined;
6
- private clusterFbo;
7
- private clusterPositionsFbo;
8
- private clusterForceCoefficientFbo;
9
- private clearCentermassCommand;
10
6
  private calculateCentermassCommand;
11
7
  private applyForcesCommand;
12
8
  private clusterTexture;
@@ -15,7 +11,6 @@ export declare class Clusters extends CoreModule {
15
11
  private centermassTexture;
16
12
  private pointIndices;
17
13
  private clustersTextureSize;
18
- private clearCentermassVertexCoordBuffer;
19
14
  private applyForcesVertexCoordBuffer;
20
15
  private previousPointsTextureSize;
21
16
  private previousClustersTextureSize;
@@ -25,6 +20,10 @@ export declare class Clusters extends CoreModule {
25
20
  create(): void;
26
21
  initPrograms(): void;
27
22
  calculateCentermass(): void;
28
- run(renderPass?: RenderPass): void;
23
+ run(): void;
24
+ /**
25
+ * Destruction order matters
26
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
27
+ */
29
28
  destroy(): void;
30
29
  }
@@ -1,19 +1,20 @@
1
- import { RenderPass } from '@luma.gl/core';
2
1
  import { CoreModule } from '../core-module';
3
2
  export declare class ForceCenter extends CoreModule {
4
3
  private centermassTexture;
5
4
  private centermassFbo;
6
5
  private pointIndices;
7
- private clearCentermassCommand;
8
6
  private calculateCentermassCommand;
9
7
  private runCommand;
10
- private clearVertexCoordBuffer;
11
8
  private forceVertexCoordBuffer;
12
9
  private calculateUniformStore;
13
10
  private forceUniformStore;
14
11
  private previousPointsTextureSize;
15
12
  create(): void;
16
13
  initPrograms(): void;
17
- run(renderPass?: RenderPass): void;
14
+ run(): void;
15
+ /**
16
+ * Destruction order matters
17
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
18
+ */
18
19
  destroy(): void;
19
20
  }
@@ -1,10 +1,13 @@
1
- import { RenderPass } from '@luma.gl/core';
2
1
  import { CoreModule } from '../core-module';
3
2
  export declare class ForceGravity extends CoreModule {
4
3
  private runCommand;
5
4
  private vertexCoordBuffer;
6
5
  private uniformStore;
7
6
  initPrograms(): void;
8
- run(renderPass?: RenderPass): void;
7
+ run(): void;
8
+ /**
9
+ * Destruction order matters
10
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
11
+ */
9
12
  destroy(): void;
10
13
  }
@@ -1,4 +1,3 @@
1
- import { RenderPass } from '@luma.gl/core';
2
1
  import { CoreModule } from '../core-module';
3
2
  export declare enum LinkDirection {
4
3
  OUTGOING = "outgoing",
@@ -20,6 +19,10 @@ export declare class ForceLink extends CoreModule {
20
19
  private randomDistanceTexture;
21
20
  create(direction: LinkDirection): void;
22
21
  initPrograms(): void;
23
- run(renderPass?: RenderPass): void;
22
+ run(): void;
23
+ /**
24
+ * Destruction order matters
25
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
26
+ */
24
27
  destroy(): void;
25
28
  }
@@ -1,15 +1,12 @@
1
- import { RenderPass } from '@luma.gl/core';
2
1
  import { CoreModule } from '../core-module';
3
2
  export declare class ForceManyBody extends CoreModule {
4
3
  private randomValuesTexture;
5
4
  private pointIndices;
6
5
  private levels;
7
6
  private levelTargets;
8
- private clearLevelsCommand;
9
7
  private calculateLevelsCommand;
10
8
  private forceCommand;
11
9
  private forceFromItsOwnCentermassCommand;
12
- private clearLevelsVertexCoordBuffer;
13
10
  private forceVertexCoordBuffer;
14
11
  private calculateLevelsUniformStore;
15
12
  private forceUniformStore;
@@ -18,7 +15,11 @@ export declare class ForceManyBody extends CoreModule {
18
15
  private previousSpaceSize;
19
16
  create(): void;
20
17
  initPrograms(): void;
21
- run(renderPass?: RenderPass): void;
18
+ run(): void;
19
+ /**
20
+ * Destruction order matters
21
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
22
+ */
22
23
  destroy(): void;
23
24
  private drawLevels;
24
25
  private drawForces;
@@ -1,10 +1,13 @@
1
- import { RenderPass } from '@luma.gl/core';
2
1
  import { CoreModule } from '../core-module';
3
2
  export declare class ForceMouse extends CoreModule {
4
3
  private runCommand;
5
4
  private vertexCoordBuffer;
6
5
  private uniformStore;
7
6
  initPrograms(): void;
8
- run(renderPass?: RenderPass): void;
7
+ run(): void;
8
+ /**
9
+ * Destruction order matters
10
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
11
+ */
9
12
  destroy(): void;
10
13
  }
@@ -24,6 +24,7 @@ export declare class GraphData {
24
24
  inputPointClusters: (number | undefined)[] | undefined;
25
25
  inputClusterPositions: (number | undefined)[] | undefined;
26
26
  inputClusterStrength: Float32Array | undefined;
27
+ inputPinnedPoints: number[] | undefined;
27
28
  pointPositions: Float32Array | undefined;
28
29
  pointColors: Float32Array | undefined;
29
30
  pointSizes: Float32Array | undefined;
@@ -28,4 +28,9 @@ export declare class Lines extends CoreModule {
28
28
  updateArrow(): void;
29
29
  updateCurveLineGeometry(): void;
30
30
  findHoveredLine(): void;
31
+ /**
32
+ * Destruction order matters
33
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
34
+ */
35
+ destroy(): void;
31
36
  }
@@ -6,7 +6,6 @@ export declare class Points extends CoreModule {
6
6
  velocityFbo: Framebuffer | undefined;
7
7
  selectedFbo: Framebuffer | undefined;
8
8
  hoveredFbo: Framebuffer | undefined;
9
- greyoutStatusFbo: Framebuffer | undefined;
10
9
  scaleX: ((x: number) => number) | undefined;
11
10
  scaleY: ((y: number) => number) | undefined;
12
11
  shouldSkipRescale: boolean | undefined;
@@ -17,14 +16,12 @@ export declare class Points extends CoreModule {
17
16
  velocityTexture: Texture | undefined;
18
17
  greyoutStatusTexture: Texture | undefined;
19
18
  private colorBuffer;
20
- private sizeFbo;
21
19
  private sizeBuffer;
22
20
  private shapeBuffer;
23
21
  private imageIndicesBuffer;
24
22
  private imageSizesBuffer;
25
23
  private imageAtlasCoordsTexture;
26
24
  private imageAtlasCoordsTextureSize;
27
- private trackedIndicesFbo;
28
25
  private trackedPositionsFbo;
29
26
  private sampledPointsFbo;
30
27
  private trackedPositions;
@@ -36,24 +33,20 @@ export declare class Points extends CoreModule {
36
33
  private findPointsOnAreaSelectionCommand;
37
34
  private findPointsOnPolygonSelectionCommand;
38
35
  private findHoveredPointCommand;
39
- private clearHoveredFboCommand;
40
- private clearSampledPointsFboCommand;
41
36
  private fillSampledPointsFboCommand;
42
37
  private trackPointsCommand;
43
38
  private updatePositionVertexCoordBuffer;
44
39
  private dragPointVertexCoordBuffer;
45
40
  private findPointsOnAreaSelectionVertexCoordBuffer;
46
41
  private findPointsOnPolygonSelectionVertexCoordBuffer;
47
- private clearHoveredFboVertexCoordBuffer;
48
- private clearSampledPointsFboVertexCoordBuffer;
49
42
  private drawHighlightedVertexCoordBuffer;
50
43
  private trackPointsVertexCoordBuffer;
51
44
  private trackedIndices;
52
45
  private selectedTexture;
46
+ private pinnedStatusTexture;
53
47
  private sizeTexture;
54
48
  private trackedIndicesTexture;
55
49
  private polygonPathTexture;
56
- private polygonPathFbo;
57
50
  private polygonPathLength;
58
51
  private drawPointIndices;
59
52
  private hoveredPointIndices;
@@ -71,6 +64,7 @@ export declare class Points extends CoreModule {
71
64
  initPrograms(): void;
72
65
  updateColor(): void;
73
66
  updateGreyoutStatus(): void;
67
+ updatePinnedStatus(): void;
74
68
  updateSize(): void;
75
69
  updateShape(): void;
76
70
  updateImageIndices(): void;
@@ -101,6 +95,10 @@ export declare class Points extends CoreModule {
101
95
  positions: number[];
102
96
  };
103
97
  getTrackedPositionsArray(): number[];
98
+ /**
99
+ * Destruction order matters
100
+ * Models -> Framebuffers -> Textures -> UniformStores -> Buffers
101
+ * */
104
102
  destroy(): void;
105
103
  private swapFbo;
106
104
  private rescaleInitialNodePositions;
@@ -0,0 +1 @@
1
+ export declare function createIndexesForBuffer(textureSize: number): Float32Array;
@@ -0,0 +1,8 @@
1
+ import { TextureFormat } from '@luma.gl/core';
2
+ /**
3
+ * Calculates bytesPerRow for texture uploads.
4
+ * @param format - Texture format
5
+ * @param width - Texture width in pixels
6
+ * @returns bytesPerRow in bytes
7
+ */
8
+ export declare function getBytesPerRow(format: TextureFormat, width: number): number;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Validates and normalizes array values to fixed-size tuples for shader uniforms.
3
+ */
4
+ /**
5
+ * Ensures a value is a vec2 tuple [number, number].
6
+ */
7
+ export declare function ensureVec2(arr: number[] | undefined, fallback: [number, number]): [number, number];
8
+ /**
9
+ * Ensures a value is a vec4 tuple [number, number, number, number].
10
+ */
11
+ export declare function ensureVec4(arr: number[] | undefined, fallback: [number, number, number, number]): [number, number, number, number];
@@ -147,6 +147,7 @@ export declare class Store {
147
147
  /**
148
148
  * If the config parameter `spaceSize` exceeds the limits of WebGL,
149
149
  * it reduces the space size without changing the config parameter.
150
+ * Ensures `spaceSize` is always a positive number >= 2 (required for Math.log2).
150
151
  */
151
152
  adjustSpaceSize(configSpaceSize: number, webglMaxTextureSize: number): void;
152
153
  /**
@@ -30,14 +30,12 @@ export declare const defaultConfigValues: {
30
30
  hoveredLinkWidthIncrease: number;
31
31
  focusedPointRingColor: string;
32
32
  focusedPointIndex: undefined;
33
- useClassicQuadtree: boolean;
34
33
  simulation: {
35
34
  decay: number;
36
35
  gravity: number;
37
36
  center: number;
38
37
  repulsion: number;
39
38
  repulsionTheta: number;
40
- repulsionQuadtreeLevels: number;
41
39
  linkSpring: number;
42
40
  linkDistance: number;
43
41
  linkDistRandomVariationRange: number[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vite').UserConfigFnObject;
2
+ export default _default;