@cosmos.gl/graph 2.7.0-beta.1 → 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.
- package/dist/{index-B1_1MjaX.js → index-CSMQs8iI.js} +4070 -4111
- package/dist/index-CSMQs8iI.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.min.js +59 -74
- package/dist/index.min.js.map +1 -1
- package/dist/{config.d.ts → src/config.d.ts} +0 -16
- package/dist/{index.d.ts → src/index.d.ts} +11 -1
- package/dist/{modules → src/modules}/Clusters/index.d.ts +6 -4
- package/dist/{modules → src/modules}/ForceCenter/index.d.ts +5 -4
- package/dist/{modules → src/modules}/ForceGravity/index.d.ts +5 -2
- package/dist/{modules → src/modules}/ForceLink/index.d.ts +5 -2
- package/dist/{modules → src/modules}/ForceManyBody/index.d.ts +5 -4
- package/dist/{modules → src/modules}/ForceMouse/index.d.ts +5 -2
- package/dist/{modules → src/modules}/Lines/index.d.ts +5 -0
- package/dist/{modules → src/modules}/Points/index.d.ts +4 -4
- package/dist/src/modules/Shared/buffer.d.ts +1 -0
- package/dist/src/modules/Shared/texture-utils.d.ts +8 -0
- package/dist/src/modules/Shared/uniform-utils.d.ts +11 -0
- package/dist/{modules → src/modules}/Store/index.d.ts +1 -0
- package/dist/{variables.d.ts → src/variables.d.ts} +0 -2
- package/dist/vite.config.d.ts +2 -0
- package/dist/{webgl-device-DzkMihDq.js → webgl-device-QoBMYpnS.js} +204 -194
- package/dist/webgl-device-QoBMYpnS.js.map +1 -0
- package/package.json +5 -6
- package/dist/index-B1_1MjaX.js.map +0 -1
- package/dist/modules/ForceManyBody/quadtree-frag-shader.d.ts +0 -1
- package/dist/modules/ForceManyBodyQuadtree/index.d.ts +0 -15
- package/dist/modules/ForceManyBodyQuadtree/quadtree-frag-shader.d.ts +0 -1
- package/dist/modules/Shared/buffer.d.ts +0 -8
- package/dist/webgl-device-DzkMihDq.js.map +0 -1
- /package/dist/{graph → src/graph}/utils/error-message.d.ts +0 -0
- /package/dist/{helper.d.ts → src/helper.d.ts} +0 -0
- /package/dist/{modules → src/modules}/Drag/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/FPSMonitor/css.d.ts +0 -0
- /package/dist/{modules → src/modules}/FPSMonitor/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/ForceLink/force-spring.d.ts +0 -0
- /package/dist/{modules → src/modules}/GraphData/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/Lines/geometry.d.ts +0 -0
- /package/dist/{modules → src/modules}/Points/atlas-utils.d.ts +0 -0
- /package/dist/{modules → src/modules}/Zoom/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/core-module.d.ts +0 -0
|
@@ -213,13 +213,6 @@ export interface GraphConfigInterface {
|
|
|
213
213
|
* Default value: `0.25`
|
|
214
214
|
*/
|
|
215
215
|
linkVisibilityMinTransparency?: number;
|
|
216
|
-
/**
|
|
217
|
-
* Use the classic quadtree algorithm for the Many-Body force.
|
|
218
|
-
* This property will be applied only on component initialization and it
|
|
219
|
-
* can't be changed using the `setConfig` method.
|
|
220
|
-
* Default value: `false`
|
|
221
|
-
*/
|
|
222
|
-
useClassicQuadtree?: boolean;
|
|
223
216
|
/**
|
|
224
217
|
* Decay coefficient. Use smaller values if you want the simulation to "cool down" slower.
|
|
225
218
|
* Default value: `5000`
|
|
@@ -242,16 +235,9 @@ export interface GraphConfigInterface {
|
|
|
242
235
|
simulationRepulsion?: number;
|
|
243
236
|
/**
|
|
244
237
|
* Decreases / increases the detalization of the Many-Body force calculations.
|
|
245
|
-
* When `useClassicQuadtree` is set to `true`, this property corresponds to the Barnes–Hut approximation criterion.
|
|
246
238
|
* Default value: `1.15`
|
|
247
239
|
*/
|
|
248
240
|
simulationRepulsionTheta?: number;
|
|
249
|
-
/**
|
|
250
|
-
* Barnes–Hut approximation depth.
|
|
251
|
-
* Can only be used when `useClassicQuadtree` is set `true`.
|
|
252
|
-
* Default value: `12`
|
|
253
|
-
*/
|
|
254
|
-
simulationRepulsionQuadtreeLevels?: number;
|
|
255
241
|
/**
|
|
256
242
|
* Link spring force coefficient.
|
|
257
243
|
* Default value: `1`
|
|
@@ -588,13 +574,11 @@ export declare class GraphConfig implements GraphConfigInterface {
|
|
|
588
574
|
scaleLinksOnZoom: boolean;
|
|
589
575
|
linkVisibilityDistanceRange: number[];
|
|
590
576
|
linkVisibilityMinTransparency: number;
|
|
591
|
-
useClassicQuadtree: boolean;
|
|
592
577
|
simulationDecay: number;
|
|
593
578
|
simulationGravity: number;
|
|
594
579
|
simulationCenter: number;
|
|
595
580
|
simulationRepulsion: number;
|
|
596
581
|
simulationRepulsionTheta: number;
|
|
597
|
-
simulationRepulsionQuadtreeLevels: number;
|
|
598
582
|
simulationLinkSpring: number;
|
|
599
583
|
simulationLinkDistance: number;
|
|
600
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
|
*/
|
|
@@ -518,6 +519,15 @@ export declare class Graph {
|
|
|
518
519
|
* @returns true if device was not ready and operation was queued, false if device is ready
|
|
519
520
|
*/
|
|
520
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;
|
|
521
531
|
/**
|
|
522
532
|
* Internal device creation method
|
|
523
533
|
* Graph class decides what device to create with sensible defaults
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Framebuffer
|
|
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 clearCentermassCommand;
|
|
7
6
|
private calculateCentermassCommand;
|
|
8
7
|
private applyForcesCommand;
|
|
9
8
|
private clusterTexture;
|
|
@@ -12,7 +11,6 @@ export declare class Clusters extends CoreModule {
|
|
|
12
11
|
private centermassTexture;
|
|
13
12
|
private pointIndices;
|
|
14
13
|
private clustersTextureSize;
|
|
15
|
-
private clearCentermassVertexCoordBuffer;
|
|
16
14
|
private applyForcesVertexCoordBuffer;
|
|
17
15
|
private previousPointsTextureSize;
|
|
18
16
|
private previousClustersTextureSize;
|
|
@@ -22,6 +20,10 @@ export declare class Clusters extends CoreModule {
|
|
|
22
20
|
create(): void;
|
|
23
21
|
initPrograms(): void;
|
|
24
22
|
calculateCentermass(): void;
|
|
25
|
-
run(
|
|
23
|
+
run(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Destruction order matters
|
|
26
|
+
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
27
|
+
*/
|
|
26
28
|
destroy(): void;
|
|
27
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
7
|
+
run(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Destruction order matters
|
|
10
|
+
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
11
|
+
*/
|
|
9
12
|
destroy(): void;
|
|
10
13
|
}
|
|
@@ -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
|
}
|
|
@@ -33,16 +33,12 @@ export declare class Points extends CoreModule {
|
|
|
33
33
|
private findPointsOnAreaSelectionCommand;
|
|
34
34
|
private findPointsOnPolygonSelectionCommand;
|
|
35
35
|
private findHoveredPointCommand;
|
|
36
|
-
private clearHoveredFboCommand;
|
|
37
|
-
private clearSampledPointsFboCommand;
|
|
38
36
|
private fillSampledPointsFboCommand;
|
|
39
37
|
private trackPointsCommand;
|
|
40
38
|
private updatePositionVertexCoordBuffer;
|
|
41
39
|
private dragPointVertexCoordBuffer;
|
|
42
40
|
private findPointsOnAreaSelectionVertexCoordBuffer;
|
|
43
41
|
private findPointsOnPolygonSelectionVertexCoordBuffer;
|
|
44
|
-
private clearHoveredFboVertexCoordBuffer;
|
|
45
|
-
private clearSampledPointsFboVertexCoordBuffer;
|
|
46
42
|
private drawHighlightedVertexCoordBuffer;
|
|
47
43
|
private trackPointsVertexCoordBuffer;
|
|
48
44
|
private trackedIndices;
|
|
@@ -99,6 +95,10 @@ export declare class Points extends CoreModule {
|
|
|
99
95
|
positions: number[];
|
|
100
96
|
};
|
|
101
97
|
getTrackedPositionsArray(): number[];
|
|
98
|
+
/**
|
|
99
|
+
* Destruction order matters
|
|
100
|
+
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
101
|
+
* */
|
|
102
102
|
destroy(): void;
|
|
103
103
|
private swapFbo;
|
|
104
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[];
|