@cosmos.gl/graph 2.6.0 → 2.6.2-rc.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.
- package/dist/config.d.ts +3 -0
- package/dist/index.d.ts +48 -6
- package/dist/index.js +1346 -1289
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +15 -15
- package/dist/index.min.js.map +1 -1
- package/package.json +5 -1
- package/.eslintrc +0 -147
- package/.github/SECURITY.md +0 -19
- package/.github/dco.yml +0 -4
- package/.github/workflows/github_pages.yml +0 -54
- package/.storybook/main.ts +0 -26
- package/.storybook/manager-head.html +0 -1
- package/.storybook/manager.ts +0 -14
- package/.storybook/preview.ts +0 -29
- package/.storybook/style.css +0 -3
- package/CHARTER.md +0 -69
- package/CODE_OF_CONDUCT.md +0 -178
- package/CONTRIBUTING.md +0 -22
- package/GOVERNANCE.md +0 -21
- package/cosmos-2-0-migration-notes.md +0 -98
- package/cosmos_awesome.md +0 -96
- package/dist/stories/beginners/basic-set-up/data-gen.d.ts +0 -4
- package/dist/stories/beginners/basic-set-up/index.d.ts +0 -5
- package/dist/stories/beginners/link-hovering/data-generator.d.ts +0 -19
- package/dist/stories/beginners/link-hovering/index.d.ts +0 -5
- package/dist/stories/beginners/pinned-points/data-gen.d.ts +0 -5
- package/dist/stories/beginners/pinned-points/index.d.ts +0 -5
- package/dist/stories/beginners/point-labels/data.d.ts +0 -13
- package/dist/stories/beginners/point-labels/index.d.ts +0 -9
- package/dist/stories/beginners/point-labels/labels.d.ts +0 -8
- package/dist/stories/beginners/quick-start.d.ts +0 -5
- package/dist/stories/beginners/remove-points/config.d.ts +0 -2
- package/dist/stories/beginners/remove-points/data-gen.d.ts +0 -4
- package/dist/stories/beginners/remove-points/index.d.ts +0 -5
- package/dist/stories/beginners.stories.d.ts +0 -11
- package/dist/stories/clusters/polygon-selection/index.d.ts +0 -6
- package/dist/stories/clusters/polygon-selection/polygon.d.ts +0 -20
- package/dist/stories/clusters/radial.d.ts +0 -5
- package/dist/stories/clusters/with-labels.d.ts +0 -6
- package/dist/stories/clusters/worm.d.ts +0 -5
- package/dist/stories/clusters.stories.d.ts +0 -9
- package/dist/stories/create-cluster-labels.d.ts +0 -4
- package/dist/stories/create-cosmos.d.ts +0 -16
- package/dist/stories/create-story.d.ts +0 -16
- package/dist/stories/experiments/full-mesh.d.ts +0 -5
- package/dist/stories/experiments/mesh-with-holes.d.ts +0 -5
- package/dist/stories/experiments.stories.d.ts +0 -7
- package/dist/stories/generate-mesh-data.d.ts +0 -12
- package/dist/stories/geospatial/moscow-metro-stations/index.d.ts +0 -15
- package/dist/stories/geospatial/moscow-metro-stations/moscow-metro-coords.d.ts +0 -1
- package/dist/stories/geospatial/moscow-metro-stations/point-colors.d.ts +0 -1
- package/dist/stories/geospatial.stories.d.ts +0 -6
- package/dist/stories/shapes/all-shapes/index.d.ts +0 -5
- package/dist/stories/shapes/image-example/index.d.ts +0 -5
- package/dist/stories/shapes.stories.d.ts +0 -7
- package/logo.svg +0 -3
- package/rollup.config.js +0 -70
- package/src/config.ts +0 -734
- package/src/declaration.d.ts +0 -12
- package/src/graph/utils/error-message.ts +0 -23
- package/src/helper.ts +0 -74
- package/src/index.ts +0 -1635
- package/src/modules/Clusters/calculate-centermass.frag +0 -9
- package/src/modules/Clusters/calculate-centermass.vert +0 -26
- package/src/modules/Clusters/force-cluster.frag +0 -39
- package/src/modules/Clusters/index.ts +0 -200
- package/src/modules/Drag/index.ts +0 -33
- package/src/modules/FPSMonitor/css.ts +0 -53
- package/src/modules/FPSMonitor/index.ts +0 -28
- package/src/modules/ForceCenter/calculate-centermass.frag +0 -9
- package/src/modules/ForceCenter/calculate-centermass.vert +0 -18
- package/src/modules/ForceCenter/force-center.frag +0 -27
- package/src/modules/ForceCenter/index.ts +0 -104
- package/src/modules/ForceGravity/force-gravity.frag +0 -27
- package/src/modules/ForceGravity/index.ts +0 -33
- package/src/modules/ForceLink/force-spring.ts +0 -73
- package/src/modules/ForceLink/index.ts +0 -149
- package/src/modules/ForceManyBody/calculate-level.frag +0 -9
- package/src/modules/ForceManyBody/calculate-level.vert +0 -25
- package/src/modules/ForceManyBody/force-centermass.frag +0 -52
- package/src/modules/ForceManyBody/force-level.frag +0 -121
- package/src/modules/ForceManyBody/index.ts +0 -223
- package/src/modules/ForceManyBody/quadtree-frag-shader.ts +0 -90
- package/src/modules/ForceManyBodyQuadtree/calculate-level.frag +0 -9
- package/src/modules/ForceManyBodyQuadtree/calculate-level.vert +0 -25
- package/src/modules/ForceManyBodyQuadtree/index.ts +0 -157
- package/src/modules/ForceManyBodyQuadtree/quadtree-frag-shader.ts +0 -93
- package/src/modules/ForceMouse/force-mouse.frag +0 -24
- package/src/modules/ForceMouse/index.ts +0 -32
- package/src/modules/GraphData/index.ts +0 -384
- package/src/modules/Lines/draw-curve-line.frag +0 -46
- package/src/modules/Lines/draw-curve-line.vert +0 -194
- package/src/modules/Lines/geometry.ts +0 -18
- package/src/modules/Lines/hovered-line-index.frag +0 -27
- package/src/modules/Lines/hovered-line-index.vert +0 -8
- package/src/modules/Lines/index.ts +0 -273
- package/src/modules/Points/atlas-utils.ts +0 -137
- package/src/modules/Points/drag-point.frag +0 -20
- package/src/modules/Points/draw-highlighted.frag +0 -16
- package/src/modules/Points/draw-highlighted.vert +0 -86
- package/src/modules/Points/draw-points.frag +0 -243
- package/src/modules/Points/draw-points.vert +0 -127
- package/src/modules/Points/fill-sampled-points.frag +0 -9
- package/src/modules/Points/fill-sampled-points.vert +0 -29
- package/src/modules/Points/find-hovered-point.frag +0 -9
- package/src/modules/Points/find-hovered-point.vert +0 -57
- package/src/modules/Points/find-points-on-area-selection.frag +0 -48
- package/src/modules/Points/find-points-on-polygon-selection.frag +0 -65
- package/src/modules/Points/index.ts +0 -968
- package/src/modules/Points/track-positions.frag +0 -18
- package/src/modules/Points/update-position.frag +0 -37
- package/src/modules/Shared/buffer.ts +0 -37
- package/src/modules/Shared/clear.frag +0 -7
- package/src/modules/Shared/quad.vert +0 -12
- package/src/modules/Store/index.ts +0 -173
- package/src/modules/Zoom/index.ts +0 -148
- package/src/modules/core-module.ts +0 -28
- package/src/stories/1. welcome.mdx +0 -81
- package/src/stories/2. configuration.mdx +0 -113
- package/src/stories/3. api-reference.mdx +0 -591
- package/src/stories/beginners/basic-set-up/data-gen.ts +0 -33
- package/src/stories/beginners/basic-set-up/index.ts +0 -163
- package/src/stories/beginners/basic-set-up/style.css +0 -35
- package/src/stories/beginners/link-hovering/data-generator.ts +0 -198
- package/src/stories/beginners/link-hovering/index.ts +0 -61
- package/src/stories/beginners/link-hovering/style.css +0 -73
- package/src/stories/beginners/pinned-points/data-gen.ts +0 -153
- package/src/stories/beginners/pinned-points/index.ts +0 -61
- package/src/stories/beginners/point-labels/data.ts +0 -73
- package/src/stories/beginners/point-labels/index.ts +0 -65
- package/src/stories/beginners/point-labels/labels.ts +0 -46
- package/src/stories/beginners/point-labels/style.css +0 -16
- package/src/stories/beginners/quick-start.ts +0 -50
- package/src/stories/beginners/remove-points/config.ts +0 -25
- package/src/stories/beginners/remove-points/data-gen.ts +0 -30
- package/src/stories/beginners/remove-points/index.ts +0 -92
- package/src/stories/beginners/remove-points/style.css +0 -31
- package/src/stories/beginners.stories.ts +0 -131
- package/src/stories/clusters/polygon-selection/index.ts +0 -51
- package/src/stories/clusters/polygon-selection/polygon.ts +0 -143
- package/src/stories/clusters/polygon-selection/style.css +0 -8
- package/src/stories/clusters/radial.ts +0 -24
- package/src/stories/clusters/with-labels.ts +0 -53
- package/src/stories/clusters/worm.ts +0 -40
- package/src/stories/clusters.stories.ts +0 -77
- package/src/stories/create-cluster-labels.ts +0 -50
- package/src/stories/create-cosmos.ts +0 -68
- package/src/stories/create-story.ts +0 -51
- package/src/stories/experiments/full-mesh.ts +0 -13
- package/src/stories/experiments/mesh-with-holes.ts +0 -13
- package/src/stories/experiments.stories.ts +0 -43
- package/src/stories/generate-mesh-data.ts +0 -125
- package/src/stories/geospatial/moscow-metro-stations/index.ts +0 -62
- package/src/stories/geospatial/moscow-metro-stations/moscow-metro-coords.ts +0 -1
- package/src/stories/geospatial/moscow-metro-stations/point-colors.ts +0 -46
- package/src/stories/geospatial/moscow-metro-stations/style.css +0 -30
- package/src/stories/geospatial.stories.ts +0 -30
- package/src/stories/shapes/all-shapes/index.ts +0 -69
- package/src/stories/shapes/image-example/icons/box.png +0 -0
- package/src/stories/shapes/image-example/icons/lego.png +0 -0
- package/src/stories/shapes/image-example/icons/s.png +0 -0
- package/src/stories/shapes/image-example/icons/swift.png +0 -0
- package/src/stories/shapes/image-example/icons/toolbox.png +0 -0
- package/src/stories/shapes/image-example/index.ts +0 -238
- package/src/stories/shapes.stories.ts +0 -37
- package/src/variables.ts +0 -68
- package/tsconfig.json +0 -41
- package/vite.config.ts +0 -54
|
@@ -1,98 +0,0 @@
|
|
|
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
|
-
|
package/cosmos_awesome.md
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
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
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface Point {
|
|
2
|
-
id: number;
|
|
3
|
-
}
|
|
4
|
-
interface Link {
|
|
5
|
-
source: number;
|
|
6
|
-
target: number;
|
|
7
|
-
}
|
|
8
|
-
interface NetworkData {
|
|
9
|
-
pointPositions: Float32Array;
|
|
10
|
-
pointColors: Float32Array;
|
|
11
|
-
pointSizes: Float32Array;
|
|
12
|
-
links: Float32Array;
|
|
13
|
-
linkColors: Float32Array;
|
|
14
|
-
linkWidths: Float32Array;
|
|
15
|
-
points: Point[];
|
|
16
|
-
connections: Link[];
|
|
17
|
-
}
|
|
18
|
-
export declare function generateData(pointCount?: number): NetworkData;
|
|
19
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const pointsToShowLabelsFor: string[];
|
|
2
|
-
export declare const processPerformances: (performances: {
|
|
3
|
-
theaterCode: string;
|
|
4
|
-
performanceTitle: string;
|
|
5
|
-
theaterName: string;
|
|
6
|
-
}[]) => {
|
|
7
|
-
pointPositions: Float32Array;
|
|
8
|
-
pointColors: Float32Array;
|
|
9
|
-
pointSizes: Float32Array;
|
|
10
|
-
pointLabelToIndex: Map<string, number>;
|
|
11
|
-
pointIndexToLabel: Map<number, string>;
|
|
12
|
-
links: Float32Array;
|
|
13
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/html';
|
|
2
|
-
import { Story } from './create-story';
|
|
3
|
-
import { CosmosStoryProps } from './create-cosmos';
|
|
4
|
-
declare const meta: Meta<CosmosStoryProps>;
|
|
5
|
-
export declare const QuickStart: Story;
|
|
6
|
-
export declare const BasicSetUp: Story;
|
|
7
|
-
export declare const PointLabels: Story;
|
|
8
|
-
export declare const RemovePoints: Story;
|
|
9
|
-
export declare const LinkHovering: Story;
|
|
10
|
-
export declare const PinnedPoints: Story;
|
|
11
|
-
export default meta;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class PolygonSelection {
|
|
2
|
-
private canvas;
|
|
3
|
-
private ctx;
|
|
4
|
-
private isDrawing;
|
|
5
|
-
private points;
|
|
6
|
-
private graphDiv;
|
|
7
|
-
private onPolygonComplete?;
|
|
8
|
-
private boundStartDrawing;
|
|
9
|
-
private boundDraw;
|
|
10
|
-
private boundStopDrawing;
|
|
11
|
-
private resizeObserver;
|
|
12
|
-
constructor(graphDiv: HTMLElement, onPolygonComplete?: (points: [number, number][]) => void);
|
|
13
|
-
enablePolygonMode(): void;
|
|
14
|
-
disablePolygonMode(): void;
|
|
15
|
-
destroy(): void;
|
|
16
|
-
private resizeCanvas;
|
|
17
|
-
private startDrawing;
|
|
18
|
-
private draw;
|
|
19
|
-
private stopDrawing;
|
|
20
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/html';
|
|
2
|
-
import { CosmosStoryProps } from './create-cosmos';
|
|
3
|
-
import { Story } from './create-story';
|
|
4
|
-
declare const meta: Meta<CosmosStoryProps>;
|
|
5
|
-
export declare const Worm: Story;
|
|
6
|
-
export declare const Radial: Story;
|
|
7
|
-
export declare const WithLabels: Story;
|
|
8
|
-
export declare const PolygonSelection: Story;
|
|
9
|
-
export default meta;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Graph, GraphConfigInterface } from '..';
|
|
2
|
-
export type CosmosStoryProps = GraphConfigInterface & {
|
|
3
|
-
pointPositions: Float32Array;
|
|
4
|
-
pointColors?: Float32Array;
|
|
5
|
-
pointSizes?: Float32Array;
|
|
6
|
-
links?: Float32Array;
|
|
7
|
-
linkColors?: Float32Array;
|
|
8
|
-
linkWidths?: Float32Array;
|
|
9
|
-
pointClusters?: number[];
|
|
10
|
-
clusterPositions?: number[];
|
|
11
|
-
clusterStrength?: Float32Array;
|
|
12
|
-
};
|
|
13
|
-
export declare const createCosmos: (props: CosmosStoryProps) => {
|
|
14
|
-
div: HTMLDivElement;
|
|
15
|
-
graph: Graph;
|
|
16
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Graph } from '..';
|
|
2
|
-
import { StoryObj } from '@storybook/html';
|
|
3
|
-
import { CosmosStoryProps } from './create-cosmos';
|
|
4
|
-
export type Story = StoryObj<CosmosStoryProps & {
|
|
5
|
-
graph: Graph;
|
|
6
|
-
destroy?: () => void;
|
|
7
|
-
}>;
|
|
8
|
-
export declare const createStory: (storyFunction: () => {
|
|
9
|
-
graph: Graph;
|
|
10
|
-
div: HTMLDivElement;
|
|
11
|
-
destroy?: () => void;
|
|
12
|
-
} | Promise<{
|
|
13
|
-
graph: Graph;
|
|
14
|
-
div: HTMLDivElement;
|
|
15
|
-
destroy?: () => void;
|
|
16
|
-
}>) => Story;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/html';
|
|
2
|
-
import { Story } from './create-story';
|
|
3
|
-
import { CosmosStoryProps } from './create-cosmos';
|
|
4
|
-
declare const meta: Meta<CosmosStoryProps>;
|
|
5
|
-
export declare const FullMesh: Story;
|
|
6
|
-
export declare const MeshWithHoles: Story;
|
|
7
|
-
export default meta;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type MeshData = {
|
|
2
|
-
pointPositions: Float32Array;
|
|
3
|
-
pointColors: Float32Array;
|
|
4
|
-
pointSizes: Float32Array;
|
|
5
|
-
links: Float32Array;
|
|
6
|
-
linkColors: Float32Array;
|
|
7
|
-
linkWidths: Float32Array;
|
|
8
|
-
pointClusters: number[];
|
|
9
|
-
clusterPositions: number[];
|
|
10
|
-
clusterStrength: Float32Array;
|
|
11
|
-
};
|
|
12
|
-
export declare function generateMeshData(n: number, m: number, nClusters: number, wholeness: number, radialness?: number[]): MeshData;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Graph } from '../../..';
|
|
2
|
-
/**
|
|
3
|
-
* This example demonstrates the importance of rescaling positions by Cosmos.
|
|
4
|
-
* The Moscow Metro station coordinates are are normalized (0-1 range in both dimensions).
|
|
5
|
-
* By default, cosmos.gl rescales these positions to fit the canvas.
|
|
6
|
-
* When disabling rescaling (`rescalePositions: false`):
|
|
7
|
-
* - Points render using raw coordinates
|
|
8
|
-
* - The entire graph occupies a tiny 1x1 area in WebGL's clip space (-1 to 1)
|
|
9
|
-
* - This causes visual artifacts due to WebGL's floating-point precision limitations
|
|
10
|
-
* - Points cluster in the center and may exhibit rendering glitches
|
|
11
|
-
*/
|
|
12
|
-
export declare const moscowMetroStations: () => {
|
|
13
|
-
graph: Graph;
|
|
14
|
-
div: HTMLDivElement;
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const moscowMetroCoords: number[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getPointColors: (pointPositions: number[]) => Float32Array;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/html';
|
|
2
|
-
import { Story } from './create-story';
|
|
3
|
-
import { CosmosStoryProps } from './create-cosmos';
|
|
4
|
-
declare const meta: Meta<CosmosStoryProps>;
|
|
5
|
-
export declare const AllShapes: Story;
|
|
6
|
-
export declare const ImageExample: Story;
|
|
7
|
-
export default meta;
|
package/logo.svg
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="89" height="19" viewBox="0 0 89 19" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M6.968 18.336C2.792 18.336 0.2 15.936 0.2 11.616V7.584C0.2 3.264 2.792 0.863999 6.968 0.863999C11.096 0.863999 13.448 3.264 13.448 7.2V7.344H10.328V7.104C10.328 5.136 9.224 3.696 6.968 3.696C4.712 3.696 3.368 5.184 3.368 7.536V11.664C3.368 14.016 4.712 15.504 6.968 15.504C9.224 15.504 10.328 14.064 10.328 12.096V11.664H13.448V12C13.448 15.936 11.096 18.336 6.968 18.336ZM21.7893 18.336C18.2373 18.336 15.5493 16.08 15.5493 12.24V11.856C15.5493 8.016 18.2373 5.76 21.7893 5.76C25.3413 5.76 28.0293 8.016 28.0293 11.856V12.24C28.0293 16.08 25.3413 18.336 21.7893 18.336ZM21.7893 15.648C23.6373 15.648 25.0053 14.4 25.0053 12.168V11.928C25.0053 9.696 23.6613 8.448 21.7893 8.448C19.9173 8.448 18.5733 9.696 18.5733 11.928V12.168C18.5733 14.4 19.9413 15.648 21.7893 15.648ZM35.7646 18.336C32.6446 18.336 30.5566 16.944 30.1486 14.448L32.9326 13.728C33.2446 15.408 34.3726 15.936 35.7646 15.936C37.1566 15.936 37.8286 15.384 37.8286 14.64C37.8286 13.896 37.2286 13.56 35.8126 13.296L35.1406 13.176C32.6446 12.72 30.5806 11.784 30.5806 9.432C30.5806 7.08 32.4526 5.76 35.2846 5.76C37.9486 5.76 39.7726 7.056 40.3246 8.976L37.5166 9.84C37.2526 8.616 36.4366 8.16 35.2846 8.16C34.1326 8.16 33.5086 8.592 33.5086 9.288C33.5086 10.056 34.1806 10.368 35.2846 10.56L35.9566 10.68C38.6446 11.16 40.7566 11.928 40.7566 14.424C40.7566 16.92 38.7886 18.336 35.7646 18.336ZM43.4066 18V6.096H46.3826V7.392H46.8146C47.2226 6.6 48.1586 5.904 49.7426 5.904C51.4466 5.904 52.4066 6.624 52.9586 7.68H53.3906C53.9186 6.672 54.8306 5.904 56.6546 5.904C58.8626 5.904 60.6386 7.296 60.6386 10.176V18H57.6146V10.392C57.6146 9.096 56.8946 8.424 55.6946 8.424C54.3026 8.424 53.5346 9.336 53.5346 10.968V18H50.5106V10.392C50.5106 9.096 49.7906 8.424 48.5906 8.424C47.1986 8.424 46.4306 9.336 46.4306 10.968V18H43.4066ZM69.5549 18.336C66.0029 18.336 63.3149 16.08 63.3149 12.24V11.856C63.3149 8.016 66.0029 5.76 69.5549 5.76C73.1069 5.76 75.7949 8.016 75.7949 11.856V12.24C75.7949 16.08 73.1069 18.336 69.5549 18.336ZM69.5549 15.648C71.4029 15.648 72.7709 14.4 72.7709 12.168V11.928C72.7709 9.696 71.4269 8.448 69.5549 8.448C67.6829 8.448 66.3389 9.696 66.3389 11.928V12.168C66.3389 14.4 67.7069 15.648 69.5549 15.648ZM83.5303 18.336C80.4103 18.336 78.3223 16.944 77.9143 14.448L80.6983 13.728C81.0103 15.408 82.1383 15.936 83.5303 15.936C84.9223 15.936 85.5943 15.384 85.5943 14.64C85.5943 13.896 84.9943 13.56 83.5783 13.296L82.9062 13.176C80.4103 12.72 78.3463 11.784 78.3463 9.432C78.3463 7.08 80.2183 5.76 83.0503 5.76C85.7143 5.76 87.5383 7.056 88.0903 8.976L85.2823 9.84C85.0183 8.616 84.2023 8.16 83.0503 8.16C81.8983 8.16 81.2743 8.592 81.2743 9.288C81.2743 10.056 81.9463 10.368 83.0503 10.56L83.7223 10.68C86.4103 11.16 88.5223 11.928 88.5223 14.424C88.5223 16.92 86.5543 18.336 83.5303 18.336Z" fill="currentColor"/>
|
|
3
|
-
</svg>
|
package/rollup.config.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import alias from '@rollup/plugin-alias'
|
|
3
|
-
import commonjs from '@rollup/plugin-commonjs'
|
|
4
|
-
import resolve from '@rollup/plugin-node-resolve'
|
|
5
|
-
import terser from '@rollup/plugin-terser'
|
|
6
|
-
import glslify from 'rollup-plugin-glslify'
|
|
7
|
-
import typescript from '@rollup/plugin-typescript'
|
|
8
|
-
import pkg from './package.json'
|
|
9
|
-
|
|
10
|
-
const libraryName = 'index'
|
|
11
|
-
const outputFolder = 'dist'
|
|
12
|
-
|
|
13
|
-
const externals = [
|
|
14
|
-
...Object.keys(pkg.dependencies || {}),
|
|
15
|
-
...Object.keys(pkg.peerDependencies || {}),
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
const config = {
|
|
19
|
-
input: 'src/index.ts',
|
|
20
|
-
output: {
|
|
21
|
-
file: `${outputFolder}/${libraryName}.js`,
|
|
22
|
-
name: 'Cosmos',
|
|
23
|
-
format: 'umd',
|
|
24
|
-
sourcemap: true,
|
|
25
|
-
},
|
|
26
|
-
plugins: [
|
|
27
|
-
resolve(),
|
|
28
|
-
commonjs(),
|
|
29
|
-
glslify({
|
|
30
|
-
include: [
|
|
31
|
-
'**/*.vs',
|
|
32
|
-
'**/*.fs',
|
|
33
|
-
'**/*.vert',
|
|
34
|
-
'**/*.frag',
|
|
35
|
-
'**/*.glsl',
|
|
36
|
-
],
|
|
37
|
-
exclude: 'node_modules/**',
|
|
38
|
-
}),
|
|
39
|
-
typescript(),
|
|
40
|
-
alias({
|
|
41
|
-
resolve: ['', '/index.ts', '.ts'],
|
|
42
|
-
entries: [
|
|
43
|
-
{ find: '@/graph', replacement: path.resolve(__dirname, 'src/') },
|
|
44
|
-
{ find: '@cosmos.gl/graph', replacement: path.resolve(__dirname, 'src/') },
|
|
45
|
-
],
|
|
46
|
-
}),
|
|
47
|
-
],
|
|
48
|
-
}
|
|
49
|
-
// eslint-disable-next-line import/no-default-export
|
|
50
|
-
export default [
|
|
51
|
-
{
|
|
52
|
-
...config,
|
|
53
|
-
external: externals,
|
|
54
|
-
output: {
|
|
55
|
-
...config.output,
|
|
56
|
-
format: 'es',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
...config,
|
|
61
|
-
output: {
|
|
62
|
-
...config.output,
|
|
63
|
-
file: `${outputFolder}/${libraryName}.min.js`,
|
|
64
|
-
},
|
|
65
|
-
plugins: [
|
|
66
|
-
...config.plugins,
|
|
67
|
-
terser(),
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
]
|