@cosmos.gl/graph 2.6.2-rc.0 → 2.7.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/.eslintrc +147 -0
  2. package/.github/SECURITY.md +13 -0
  3. package/.github/dco.yml +4 -0
  4. package/.github/workflows/github_pages.yml +54 -0
  5. package/.storybook/main.ts +26 -0
  6. package/.storybook/manager-head.html +1 -0
  7. package/.storybook/manager.ts +14 -0
  8. package/.storybook/preview.ts +29 -0
  9. package/.storybook/style.css +3 -0
  10. package/CHARTER.md +69 -0
  11. package/CODE_OF_CONDUCT.md +178 -0
  12. package/CONTRIBUTING.md +22 -0
  13. package/GOVERNANCE.md +21 -0
  14. package/cosmos-2-0-migration-notes.md +98 -0
  15. package/cosmos_awesome.md +96 -0
  16. package/dist/config.d.ts +5 -9
  17. package/dist/graph/utils/error-message.d.ts +1 -1
  18. package/dist/helper.d.ts +39 -2
  19. package/dist/index-FUIgayhu.js +19827 -0
  20. package/dist/index-FUIgayhu.js.map +1 -0
  21. package/dist/index.d.ts +17 -64
  22. package/dist/index.js +14 -14654
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.min.js +1062 -475
  25. package/dist/index.min.js.map +1 -1
  26. package/dist/modules/Clusters/index.d.ts +11 -3
  27. package/dist/modules/ForceCenter/index.d.ts +10 -3
  28. package/dist/modules/ForceGravity/index.d.ts +5 -1
  29. package/dist/modules/ForceLink/index.d.ts +8 -5
  30. package/dist/modules/ForceManyBody/index.d.ts +16 -7
  31. package/dist/modules/ForceMouse/index.d.ts +5 -1
  32. package/dist/modules/GraphData/index.d.ts +0 -1
  33. package/dist/modules/Lines/index.d.ts +11 -5
  34. package/dist/modules/Points/index.d.ts +31 -13
  35. package/dist/modules/Store/index.d.ts +93 -0
  36. package/dist/modules/core-module.d.ts +3 -3
  37. package/dist/stories/beginners/basic-set-up/data-gen.d.ts +4 -0
  38. package/dist/stories/beginners/basic-set-up/index.d.ts +6 -0
  39. package/dist/stories/beginners/link-hovering/data-generator.d.ts +19 -0
  40. package/dist/stories/beginners/link-hovering/index.d.ts +6 -0
  41. package/dist/stories/beginners/point-labels/data.d.ts +13 -0
  42. package/dist/stories/beginners/point-labels/index.d.ts +10 -0
  43. package/dist/stories/beginners/point-labels/labels.d.ts +8 -0
  44. package/dist/stories/beginners/quick-start.d.ts +6 -0
  45. package/dist/stories/beginners/remove-points/config.d.ts +2 -0
  46. package/dist/stories/beginners/remove-points/data-gen.d.ts +4 -0
  47. package/dist/stories/beginners/remove-points/index.d.ts +6 -0
  48. package/dist/stories/beginners.stories.d.ts +10 -0
  49. package/dist/stories/clusters/polygon-selection/index.d.ts +6 -0
  50. package/dist/stories/clusters/polygon-selection/polygon.d.ts +20 -0
  51. package/dist/stories/clusters/radial.d.ts +6 -0
  52. package/dist/stories/clusters/with-labels.d.ts +6 -0
  53. package/dist/stories/clusters/worm.d.ts +6 -0
  54. package/dist/stories/clusters.stories.d.ts +9 -0
  55. package/dist/stories/create-cluster-labels.d.ts +4 -0
  56. package/dist/stories/create-cosmos.d.ts +17 -0
  57. package/dist/stories/create-story.d.ts +16 -0
  58. package/dist/stories/experiments/full-mesh.d.ts +6 -0
  59. package/dist/stories/experiments/mesh-with-holes.d.ts +6 -0
  60. package/dist/stories/experiments.stories.d.ts +7 -0
  61. package/dist/stories/generate-mesh-data.d.ts +12 -0
  62. package/dist/stories/geospatial/moscow-metro-stations/index.d.ts +16 -0
  63. package/dist/stories/geospatial/moscow-metro-stations/moscow-metro-coords.d.ts +1 -0
  64. package/dist/stories/geospatial/moscow-metro-stations/point-colors.d.ts +1 -0
  65. package/dist/stories/geospatial.stories.d.ts +6 -0
  66. package/dist/stories/shapes/all-shapes/index.d.ts +6 -0
  67. package/dist/stories/shapes/image-example/index.d.ts +6 -0
  68. package/dist/stories/shapes.stories.d.ts +7 -0
  69. package/dist/stories/test-luma-migration.d.ts +6 -0
  70. package/dist/stories/test.stories.d.ts +6 -0
  71. package/dist/webgl-device-B9ewDj5L.js +3923 -0
  72. package/dist/webgl-device-B9ewDj5L.js.map +1 -0
  73. package/logo.svg +3 -0
  74. package/package.json +5 -7
  75. package/rollup.config.js +70 -0
  76. package/src/config.ts +728 -0
  77. package/src/declaration.d.ts +12 -0
  78. package/src/graph/utils/error-message.ts +23 -0
  79. package/src/helper.ts +113 -0
  80. package/src/index.ts +1769 -0
  81. package/src/modules/Clusters/calculate-centermass.frag +12 -0
  82. package/src/modules/Clusters/calculate-centermass.vert +38 -0
  83. package/src/modules/Clusters/force-cluster.frag +55 -0
  84. package/src/modules/Clusters/index.ts +578 -0
  85. package/src/modules/Drag/index.ts +33 -0
  86. package/src/modules/FPSMonitor/css.ts +53 -0
  87. package/src/modules/FPSMonitor/index.ts +28 -0
  88. package/src/modules/ForceCenter/calculate-centermass.frag +9 -0
  89. package/src/modules/ForceCenter/calculate-centermass.vert +26 -0
  90. package/src/modules/ForceCenter/force-center.frag +37 -0
  91. package/src/modules/ForceCenter/index.ts +284 -0
  92. package/src/modules/ForceGravity/force-gravity.frag +40 -0
  93. package/src/modules/ForceGravity/index.ts +107 -0
  94. package/src/modules/ForceLink/force-spring.ts +89 -0
  95. package/src/modules/ForceLink/index.ts +293 -0
  96. package/src/modules/ForceManyBody/calculate-level.frag +9 -0
  97. package/src/modules/ForceManyBody/calculate-level.vert +37 -0
  98. package/src/modules/ForceManyBody/force-centermass.frag +61 -0
  99. package/src/modules/ForceManyBody/force-level.frag +138 -0
  100. package/src/modules/ForceManyBody/index.ts +525 -0
  101. package/src/modules/ForceManyBody/quadtree-frag-shader.ts +89 -0
  102. package/src/modules/ForceManyBodyQuadtree/calculate-level.frag +9 -0
  103. package/src/modules/ForceManyBodyQuadtree/calculate-level.vert +25 -0
  104. package/src/modules/ForceManyBodyQuadtree/index.ts +157 -0
  105. package/src/modules/ForceManyBodyQuadtree/quadtree-frag-shader.ts +93 -0
  106. package/src/modules/ForceMouse/force-mouse.frag +35 -0
  107. package/src/modules/ForceMouse/index.ts +102 -0
  108. package/src/modules/GraphData/index.ts +383 -0
  109. package/src/modules/Lines/draw-curve-line.frag +59 -0
  110. package/src/modules/Lines/draw-curve-line.vert +248 -0
  111. package/src/modules/Lines/geometry.ts +18 -0
  112. package/src/modules/Lines/hovered-line-index.frag +43 -0
  113. package/src/modules/Lines/hovered-line-index.vert +13 -0
  114. package/src/modules/Lines/index.ts +661 -0
  115. package/src/modules/Points/atlas-utils.ts +137 -0
  116. package/src/modules/Points/drag-point.frag +34 -0
  117. package/src/modules/Points/draw-highlighted.frag +44 -0
  118. package/src/modules/Points/draw-highlighted.vert +145 -0
  119. package/src/modules/Points/draw-points.frag +259 -0
  120. package/src/modules/Points/draw-points.vert +203 -0
  121. package/src/modules/Points/fill-sampled-points.frag +12 -0
  122. package/src/modules/Points/fill-sampled-points.vert +51 -0
  123. package/src/modules/Points/find-hovered-point.frag +15 -0
  124. package/src/modules/Points/find-hovered-point.vert +90 -0
  125. package/src/modules/Points/find-points-on-area-selection.frag +88 -0
  126. package/src/modules/Points/find-points-on-polygon-selection.frag +89 -0
  127. package/src/modules/Points/index.ts +2292 -0
  128. package/src/modules/Points/track-positions.frag +30 -0
  129. package/src/modules/Points/update-position.frag +39 -0
  130. package/src/modules/Shared/buffer.ts +39 -0
  131. package/src/modules/Shared/clear.frag +10 -0
  132. package/src/modules/Shared/quad.vert +13 -0
  133. package/src/modules/Store/index.ts +283 -0
  134. package/src/modules/Zoom/index.ts +148 -0
  135. package/src/modules/core-module.ts +28 -0
  136. package/src/stories/1. welcome.mdx +75 -0
  137. package/src/stories/2. configuration.mdx +111 -0
  138. package/src/stories/3. api-reference.mdx +591 -0
  139. package/src/stories/beginners/basic-set-up/data-gen.ts +33 -0
  140. package/src/stories/beginners/basic-set-up/index.ts +167 -0
  141. package/src/stories/beginners/basic-set-up/style.css +35 -0
  142. package/src/stories/beginners/link-hovering/data-generator.ts +198 -0
  143. package/src/stories/beginners/link-hovering/index.ts +65 -0
  144. package/src/stories/beginners/link-hovering/style.css +73 -0
  145. package/src/stories/beginners/point-labels/data.ts +73 -0
  146. package/src/stories/beginners/point-labels/index.ts +69 -0
  147. package/src/stories/beginners/point-labels/labels.ts +46 -0
  148. package/src/stories/beginners/point-labels/style.css +16 -0
  149. package/src/stories/beginners/quick-start.ts +54 -0
  150. package/src/stories/beginners/remove-points/config.ts +25 -0
  151. package/src/stories/beginners/remove-points/data-gen.ts +30 -0
  152. package/src/stories/beginners/remove-points/index.ts +96 -0
  153. package/src/stories/beginners/remove-points/style.css +31 -0
  154. package/src/stories/beginners.stories.ts +130 -0
  155. package/src/stories/clusters/polygon-selection/index.ts +52 -0
  156. package/src/stories/clusters/polygon-selection/polygon.ts +143 -0
  157. package/src/stories/clusters/polygon-selection/style.css +8 -0
  158. package/src/stories/clusters/radial.ts +24 -0
  159. package/src/stories/clusters/with-labels.ts +54 -0
  160. package/src/stories/clusters/worm.ts +40 -0
  161. package/src/stories/clusters.stories.ts +77 -0
  162. package/src/stories/create-cluster-labels.ts +50 -0
  163. package/src/stories/create-cosmos.ts +72 -0
  164. package/src/stories/create-story.ts +51 -0
  165. package/src/stories/experiments/full-mesh.ts +13 -0
  166. package/src/stories/experiments/mesh-with-holes.ts +13 -0
  167. package/src/stories/experiments.stories.ts +43 -0
  168. package/src/stories/generate-mesh-data.ts +125 -0
  169. package/src/stories/geospatial/moscow-metro-stations/index.ts +66 -0
  170. package/src/stories/geospatial/moscow-metro-stations/moscow-metro-coords.ts +1 -0
  171. package/src/stories/geospatial/moscow-metro-stations/point-colors.ts +46 -0
  172. package/src/stories/geospatial/moscow-metro-stations/style.css +30 -0
  173. package/src/stories/geospatial.stories.ts +30 -0
  174. package/src/stories/shapes/all-shapes/index.ts +73 -0
  175. package/src/stories/shapes/image-example/icons/box.png +0 -0
  176. package/src/stories/shapes/image-example/icons/lego.png +0 -0
  177. package/src/stories/shapes/image-example/icons/s.png +0 -0
  178. package/src/stories/shapes/image-example/icons/swift.png +0 -0
  179. package/src/stories/shapes/image-example/icons/toolbox.png +0 -0
  180. package/src/stories/shapes/image-example/index.ts +246 -0
  181. package/src/stories/shapes.stories.ts +37 -0
  182. package/src/stories/test-luma-migration.ts +195 -0
  183. package/src/stories/test.stories.ts +25 -0
  184. package/src/variables.ts +68 -0
  185. package/tsconfig.json +41 -0
  186. package/vite.config.ts +52 -0
@@ -0,0 +1,98 @@
1
+ ### Migration Guide cosmos.gl v2.0
2
+
3
+ #### Introduction
4
+
5
+ Welcome to the updated cosmos.gl library! Version 2.0 introduces significant improvements in data handling and performance, marking a major milestone for the library. This guide will help you transition to the new version smoothly.
6
+
7
+ #### Key Changes in Data Handling
8
+
9
+ This update is centered on enhancing data performance by utilizing formats directly compatible with WebGL. Since WebGL operates with buffers and framebuffers created from arrays of numbers, we have introduced new methods to handle data more efficiently.
10
+
11
+ #### Replacing `setData`
12
+
13
+ The `setData` method has been replaced with `setPointPositions` and `setLinks`. These new methods accept Float32Array, which are directly used to create WebGL textures.
14
+
15
+ **Before:**
16
+ ```js
17
+ graph.setData(
18
+ [{ id: 'a' }, { id: 'b' }], // Nodes
19
+ [{ source: 'a', target: 'b' }] // Links
20
+ );
21
+ ```
22
+
23
+ **After:**
24
+ ```js
25
+ graph.setPointPositions(new Float32Array([
26
+ 400, 400, // x and y of the first point
27
+ 500, 500, // x and y of the second point
28
+ ]));
29
+ graph.setLinks(new Float32Array([
30
+ 0, 1 // Link between the first and second point
31
+ ]));
32
+ ```
33
+
34
+ #### Configuration Updates
35
+
36
+ Accessor functions for styling such as `nodeColor`, `nodeSize`, `linkColor`, `linkWidth`, and `linkArrows`, are eliminated. You can now set these attributes directly using Float32Array.
37
+
38
+ **Old Method for Setting Node Color:**
39
+ ```js
40
+ config.nodeColor = node => node.color;
41
+ ```
42
+
43
+ **New Method for Setting Point Colors:**
44
+ ```js
45
+ graph.setPointColors(new Float32Array([
46
+ 0.5, 0.5, 1, 1, // r, g, b, alpha for the first point
47
+ 0.5, 1, 0.5, 1, // r, g, b, alpha for the second point
48
+ ]));
49
+ ```
50
+
51
+ **Flat Configuration Object:**
52
+
53
+ The configuration object is now flat instead of nested.
54
+
55
+ **Old Config:**
56
+ ```js
57
+ const config = {
58
+ backgroundColor: 'black',
59
+ simulation: {
60
+ repulsion: 0.5,
61
+ },
62
+ events: {
63
+ onNodeMouseOver: (node, index, pos) => console.log(`Hovered over node ${node.id}`)
64
+ }
65
+ }
66
+ ```
67
+
68
+ **New config:**
69
+ ```js
70
+ const config = {
71
+ backgroundColor: 'black',
72
+ simulationRepulsion: 0.5,
73
+ onPointMouseOver: (index, pos) => console.log(`Hovered over point at index ${index}`);
74
+ }
75
+ ```
76
+
77
+ **Initialization Change: From Canvas to Div**
78
+
79
+ In version 2.0, the initialization of the graph now requires a div element instead of a canvas element.
80
+
81
+ **Before**
82
+ ```js
83
+ const canvas = document.getElementById('myCanvas')
84
+ const graph = new Graph(canvas, config)
85
+ ```
86
+
87
+ **After**
88
+ ```js
89
+ const div = document.getElementById('myDiv')
90
+ const graph = new Graph(div, config)
91
+ ```
92
+
93
+ **Summary of Additional Changes**
94
+
95
+ - **Terminology Update:** "Node" is now "Point," but "Link" remains unchanged.
96
+ - **API Modifications:** All methods that focused on node objects have been updated or replaced to handle indices.
97
+ - **Manual Rendering:** After setting data or updating point/link properties, remember to run `graph.render()` to update WebGL textures and render the graph with the new data.
98
+
@@ -0,0 +1,96 @@
1
+ ## About
2
+ The cosmos.gl awesome list is a list of awesome things curated by the community.
3
+
4
+ ## cosmos.gl Examples:
5
+ **MathWorks/Kuu** The MathWorks, Inc: symmetric positive definite matrix
6
+ - Source: https://sparse.tamu.edu/MathWorks/Kuu
7
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/Kuu.csv
8
+
9
+ **HB/blckhole** S CONNECTIVITY STRUCTURE OF A GEODESIC DOME ON A COARSE BASE
10
+ - Source: https://sparse.tamu.edu/HB/blckhole
11
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/blckhole.csv
12
+
13
+ **HB/can_229** SYMMETRIC PATTERN FROM CANNES,LUCIEN MARRO,JUNE 1981.
14
+ - Source: https://sparse.tamu.edu/HB/can_229
15
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/can_229.csv
16
+
17
+ **Gset/G34** 2D torus, 40-by-50, uniformly random +1/-1 entries
18
+ - Source: https://sparse.tamu.edu/Gset/G34
19
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/G34.csv
20
+
21
+ **Pothen/sphere3** sphere3, with coordinates. From NASA, collected by Alex Pothen
22
+ - Source: https://sparse.tamu.edu/Pothen/sphere3
23
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/sphere3.csv
24
+
25
+ **Bydder/mri1** MRI reconstruction (1), from Mark Bydder, UCSD
26
+ - Source: https://sparse.tamu.edu/Bydder/mri1
27
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/mri1.csv
28
+
29
+ **Mittelmann/pds-90** Patient distribution (evacuation) system
30
+ - Source: https://sparse.tamu.edu/Mittelmann/pds-90
31
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/pds-90.csv
32
+
33
+ **Chen/pkustk10** PKU SYMMETRIC STIFFNESS, 4 TOWER SILO
34
+ - Source: https://sparse.tamu.edu/Chen/pkustk10
35
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/pkustk10.csv
36
+
37
+ **GHS_indef/aug3d** Gould, Hu, & Scott: expanded system-3D PDE (CUTEr)
38
+ - Source: https://sparse.tamu.edu/GHS_indef/aug3d
39
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/aug3d.csv
40
+
41
+ **Nasa/barth5** BARTH5: Nasa matrix, but with a diagonal added to the original matrix
42
+ - Source: https://sparse.tamu.edu/Nasa/barth5
43
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/barth5.csv
44
+
45
+ **DIMACS10/delaunay_n10**
46
+ DIMACS10 set: delaunay/delaunay_n10
47
+ - Source: https://sparse.tamu.edu/DIMACS10/delaunay_n10
48
+ - Example:https://cosmograph.app/run/?data=https://cosmograph.app/data/delaunay_n10.csv
49
+
50
+ **HB/dwt_1005** SYMMETRIC CONNECTION TABLE FROM DTNSRDC, WASHINGTON
51
+ - Source: https://sparse.tamu.edu/HB/dwt_1005
52
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/dwt_1005.csv
53
+
54
+ **HB/gre_1107** UNSYMMETRIC MATRIX FROM GRENOBLE,FRANCOIS CACHARD,MARCH 1981.
55
+ - Source: https://sparse.tamu.edu/HB/gre_1107
56
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/gre_1107.csv
57
+
58
+ **Hollinger/jan99jac040sc** Jacobian from Bank of Canada ‘jan99’ model, oldstack 040, with scaling
59
+ - Source: https://sparse.tamu.edu/Hollinger/jan99jac040sc
60
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/jan99jac040sc.csv
61
+
62
+ **HB/man_5976** MANTEUFFEL’S FINITE ELEMENT PROBLEM (CONDENSED)
63
+ - Source: https://sparse.tamu.edu/HB/man_5976
64
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/man_5976.csv
65
+
66
+ **Boeing/msc01440** SYMMETRIC TEST MATRIX FROM MSC/NASTRAN CYLF8.OUT2
67
+ - Source: https://sparse.tamu.edu/Boeing/msc01440
68
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/msc01440.csv
69
+
70
+ **Nasa/nasa4704** STRUCTURE FROM NASA LANGLEY, 4704 DEGREES OF FREEDOM
71
+ - Source: https://sparse.tamu.edu/Nasa/nasa4704
72
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/nasa4704.csv
73
+
74
+ **Bai/rw5151** MARKOV CHAIN MODELING, RANDOM WALK (M = 100) G. W. STEWART
75
+ - Source: https://sparse.tamu.edu/Bai/rw5151
76
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/rw5151.csv
77
+
78
+ **Shyy/shyy41** Wei Shyy, Univ. Florida. CFD/Navier-Stokes,viscous flow, fully coupled
79
+ - Source: https://sparse.tamu.edu/Shyy/shyy41
80
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/shyy41.csv
81
+
82
+ **Shyy/shyy161** Wei Shyy, Univ. Florida. CFD/Navier-Stokes,viscous flow, fully coupled
83
+ - Source: https://sparse.tamu.edu/Shyy/shyy161
84
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/shyy161.csv
85
+
86
+ **HB/young3c** real matrix from aero research, David Young, corrected RUA version
87
+ - Source: https://sparse.tamu.edu/HB/young3c
88
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/young3c.csv
89
+
90
+ **TKK/cyl6** Cylindrical shell, non-linear analysis, 3 RHS vectors at step 6. R Kouhia
91
+ - Source: https://sparse.tamu.edu/TKK/cyl6
92
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/cyl6.csv
93
+
94
+ **GHS_psdef/cvxbqp1** Gould, Hu, & Scott: barrier Hessian from convex QP (CUTEr)
95
+ - Source: https://sparse.tamu.edu/GHS_psdef/cvxbqp1
96
+ - Example: https://cosmograph.app/run/?data=https://cosmograph.app/data/cvxbqp1.csv
package/dist/config.d.ts CHANGED
@@ -27,15 +27,13 @@ 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 */
32
30
  pointColor?: string | [number, number, number, number];
33
31
  /**
34
32
  * The color to use for points when they are greyed out (when selection is active).
35
33
  * This can be either a hex color string (e.g., '#b3b3b3') or an array of RGBA values
36
34
  * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
37
35
  *
38
- * If not provided, the color will be the same as the point's original color,
36
+ * If not provided, the color will be the same as the `pointColor`,
39
37
  * but darkened or lightened depending on the background color.
40
38
  *
41
39
  * If `pointGreyoutOpacity` is also defined, it will override the alpha/opacity component
@@ -116,8 +114,6 @@ export interface GraphConfigInterface {
116
114
  * in the format `[red, green, blue, alpha]` where each value is a number between 0 and 255.
117
115
  * Default value: '#666666'
118
116
  */
119
- linkDefaultColor?: string | [number, number, number, number];
120
- /** @deprecated Use `linkDefaultColor` instead */
121
117
  linkColor?: string | [number, number, number, number];
122
118
  /**
123
119
  * Universal opacity value applied to all links.
@@ -441,8 +437,10 @@ export interface GraphConfigInterface {
441
437
  */
442
438
  showFPSMonitor?: boolean;
443
439
  /**
444
- * Canvas pixel ratio.
445
- * Default value: `2`
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`
446
444
  */
447
445
  pixelRatio?: number;
448
446
  /**
@@ -549,7 +547,6 @@ export declare class GraphConfig implements GraphConfigInterface {
549
547
  backgroundColor: string;
550
548
  spaceSize: number;
551
549
  pointColor: string;
552
- pointDefaultColor: undefined;
553
550
  pointGreyoutOpacity: undefined;
554
551
  pointGreyoutColor: undefined;
555
552
  pointSize: number;
@@ -562,7 +559,6 @@ export declare class GraphConfig implements GraphConfigInterface {
562
559
  focusedPointRingColor: string;
563
560
  focusedPointIndex: undefined;
564
561
  linkColor: string;
565
- linkDefaultColor: undefined;
566
562
  linkOpacity: number;
567
563
  linkGreyoutOpacity: number;
568
564
  linkWidth: number;
@@ -3,4 +3,4 @@
3
3
  * @param container The HTML element to append the error message to
4
4
  * @returns The created error div element
5
5
  */
6
- export declare function createWebGLErrorMessage(container: HTMLElement): HTMLDivElement;
6
+ export declare function createWebGLErrorMessage(container: HTMLElement, error: string): HTMLDivElement;
package/dist/helper.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { default as regl } from 'regl';
1
+ import { Device, Framebuffer } from '@luma.gl/core';
2
2
  import { default as DOMPurify } from 'dompurify';
3
3
  export declare const isFunction: <T>(a: T) => boolean;
4
4
  export declare const isArray: <T>(a: unknown | T[]) => a is T[];
@@ -7,7 +7,44 @@ export declare const isAClassInstance: <T>(a: T) => boolean;
7
7
  export declare const isPlainObject: <T>(a: T) => boolean;
8
8
  export declare function getRgbaColor(value: string | [number, number, number, number]): [number, number, number, number];
9
9
  export declare function rgbToBrightness(r: number, g: number, b: number): number;
10
- export declare function readPixels(reglInstance: regl.Regl, fbo: regl.Framebuffer2D): Float32Array;
10
+ /**
11
+ * TODO: Migrate from deprecated `readPixelsToArrayWebGL` to CommandEncoder API
12
+ *
13
+ * `readPixelsToArrayWebGL` is deprecated in luma.gl v9. The recommended modern approach is:
14
+ *
15
+ * 1. Create a buffer to hold the pixel data:
16
+ * const buffer = device.createBuffer({
17
+ * byteLength: width * height * 4 * 4, // RGBA, 4 bytes per float
18
+ * usage: Buffer.COPY_DST | Buffer.MAP_READ
19
+ * });
20
+ *
21
+ * 2. Copy texture/framebuffer to buffer using command encoder:
22
+ * const commandEncoder = device.createCommandEncoder();
23
+ * commandEncoder.copyTextureToBuffer({
24
+ * sourceTexture: fbo, // Can be Texture or Framebuffer
25
+ * width: sourceWidth ?? fbo.width,
26
+ * height: sourceHeight ?? fbo.height,
27
+ * origin: [sourceX, sourceY],
28
+ * destinationBuffer: buffer
29
+ * });
30
+ * const commandBuffer = commandEncoder.finish();
31
+ * device.submit(commandBuffer);
32
+ *
33
+ * 3. Read the data from the buffer (async):
34
+ * const pixelData = await buffer.readAsync(); // Returns ArrayBuffer
35
+ * return new Float32Array(pixelData);
36
+ *
37
+ * Note: The modern approach is asynchronous, so this function signature would need to change
38
+ * to return Promise<Float32Array> or we'd need to handle async at all call sites (18 locations).
39
+ *
40
+ * Migration impact:
41
+ * - This function is used in 18 places across the codebase
42
+ * - All call sites would need to be updated to handle async
43
+ * - Consider batching the migration to avoid inconsistencies
44
+ *
45
+ * Current status: Deprecated but still functional. Keeping for now until full migration can be planned.
46
+ */
47
+ export declare function readPixels(device: Device, fbo: Framebuffer, sourceX?: number, sourceY?: number, sourceWidth?: number, sourceHeight?: number): Float32Array;
11
48
  export declare function clamp(num: number, min: number, max: number): number;
12
49
  export declare function isNumber(value: number | undefined | null | typeof NaN): boolean;
13
50
  /**