@cosmos.gl/graph 3.0.0-beta.4 → 3.0.0-beta.6
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 +14 -29
- package/dist/index.d.ts +24 -24
- package/dist/index.js +783 -549
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +158 -65
- package/dist/index.min.js.map +1 -1
- package/dist/modules/Lines/conic-curve-module.d.ts +2 -0
- package/dist/modules/Lines/index.d.ts +10 -0
- package/dist/variables.d.ts +2 -0
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export interface GraphConfigInterface {
|
|
|
16
16
|
*/
|
|
17
17
|
backgroundColor?: string | [number, number, number, number];
|
|
18
18
|
/**
|
|
19
|
-
* Simulation space size
|
|
20
|
-
* Default value: `
|
|
19
|
+
* Simulation space size.
|
|
20
|
+
* Default value: `4096` (larger values may crash on some devices, e.g. iOS; see https://github.com/cosmosgl/graph/issues/203).
|
|
21
21
|
*/
|
|
22
22
|
spaceSize?: number;
|
|
23
23
|
/**
|
|
@@ -28,8 +28,6 @@ export interface GraphConfigInterface {
|
|
|
28
28
|
* Default value: '#b3b3b3'
|
|
29
29
|
*/
|
|
30
30
|
pointDefaultColor?: string | [number, number, number, number];
|
|
31
|
-
/** @deprecated Use `pointDefaultColor` instead */
|
|
32
|
-
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
|
|
@@ -59,8 +57,6 @@ export interface GraphConfigInterface {
|
|
|
59
57
|
* Default value: `4`
|
|
60
58
|
*/
|
|
61
59
|
pointDefaultSize?: number;
|
|
62
|
-
/** @deprecated Use `pointDefaultSize` instead */
|
|
63
|
-
pointSize?: number;
|
|
64
60
|
/**
|
|
65
61
|
* Universal opacity value applied to all points.
|
|
66
62
|
* This value multiplies with individual point alpha values (if set via setPointColors).
|
|
@@ -119,8 +115,6 @@ export interface GraphConfigInterface {
|
|
|
119
115
|
* Default value: '#666666'
|
|
120
116
|
*/
|
|
121
117
|
linkDefaultColor?: string | [number, number, number, number];
|
|
122
|
-
/** @deprecated Use `linkDefaultColor` instead */
|
|
123
|
-
linkColor?: string | [number, number, number, number];
|
|
124
118
|
/**
|
|
125
119
|
* Universal opacity value applied to all links.
|
|
126
120
|
* This value multiplies with individual link alpha values (if set via setLinkColors).
|
|
@@ -138,8 +132,6 @@ export interface GraphConfigInterface {
|
|
|
138
132
|
* Default value: `1`
|
|
139
133
|
*/
|
|
140
134
|
linkDefaultWidth?: number;
|
|
141
|
-
/** @deprecated Use `linkDefaultWidth` instead */
|
|
142
|
-
linkWidth?: number;
|
|
143
135
|
/**
|
|
144
136
|
* The color to use for links when they are hovered.
|
|
145
137
|
* This can be either a hex color string (e.g., '#ff3333') or an array of RGBA values
|
|
@@ -190,8 +182,6 @@ export interface GraphConfigInterface {
|
|
|
190
182
|
* Default value: `false`
|
|
191
183
|
*/
|
|
192
184
|
linkDefaultArrows?: boolean;
|
|
193
|
-
/** @deprecated Use `linkDefaultArrows` instead */
|
|
194
|
-
linkArrows?: boolean;
|
|
195
185
|
/**
|
|
196
186
|
* Scale factor for the link arrows size.
|
|
197
187
|
* Default value: `1`
|
|
@@ -301,12 +291,6 @@ export interface GraphConfigInterface {
|
|
|
301
291
|
* Default value: `undefined`
|
|
302
292
|
*/
|
|
303
293
|
onSimulationPause?: () => void;
|
|
304
|
-
/**
|
|
305
|
-
* Callback function that will be called when the simulation is restarted.
|
|
306
|
-
* @deprecated Use `onSimulationUnpause` instead. This callback will be removed in a future version.
|
|
307
|
-
* Default value: `undefined`
|
|
308
|
-
*/
|
|
309
|
-
onSimulationRestart?: () => void;
|
|
310
294
|
/**
|
|
311
295
|
* Callback function that will be called when the simulation is unpaused.
|
|
312
296
|
* Default value: `undefined`
|
|
@@ -546,6 +530,12 @@ export interface GraphConfigInterface {
|
|
|
546
530
|
* Default value: `150`
|
|
547
531
|
*/
|
|
548
532
|
pointSamplingDistance?: number;
|
|
533
|
+
/**
|
|
534
|
+
* Link sampling distance in pixels between neighboring links when calling the `getSampledLinks` method.
|
|
535
|
+
* This parameter determines how many links will be included in the sample (based on link midpoints in screen space).
|
|
536
|
+
* Default value: `150`
|
|
537
|
+
*/
|
|
538
|
+
linkSamplingDistance?: number;
|
|
549
539
|
/**
|
|
550
540
|
* Controls automatic position adjustment of points in the visible space.
|
|
551
541
|
*
|
|
@@ -570,12 +560,10 @@ export declare class GraphConfig implements GraphConfigInterface {
|
|
|
570
560
|
enableSimulation: boolean;
|
|
571
561
|
backgroundColor: string;
|
|
572
562
|
spaceSize: number;
|
|
573
|
-
|
|
574
|
-
pointDefaultColor: undefined;
|
|
563
|
+
pointDefaultColor: string;
|
|
575
564
|
pointGreyoutOpacity: undefined;
|
|
576
565
|
pointGreyoutColor: undefined;
|
|
577
|
-
|
|
578
|
-
pointDefaultSize: undefined;
|
|
566
|
+
pointDefaultSize: number;
|
|
579
567
|
pointOpacity: number;
|
|
580
568
|
pointSizeScale: number;
|
|
581
569
|
hoveredPointCursor: string;
|
|
@@ -584,12 +572,10 @@ export declare class GraphConfig implements GraphConfigInterface {
|
|
|
584
572
|
hoveredPointRingColor: string;
|
|
585
573
|
focusedPointRingColor: string;
|
|
586
574
|
focusedPointIndex: undefined;
|
|
587
|
-
|
|
588
|
-
linkDefaultColor: undefined;
|
|
575
|
+
linkDefaultColor: string;
|
|
589
576
|
linkOpacity: number;
|
|
590
577
|
linkGreyoutOpacity: number;
|
|
591
|
-
|
|
592
|
-
linkDefaultWidth: undefined;
|
|
578
|
+
linkDefaultWidth: number;
|
|
593
579
|
linkWidthScale: number;
|
|
594
580
|
hoveredLinkColor: undefined;
|
|
595
581
|
hoveredLinkWidthIncrease: number;
|
|
@@ -598,8 +584,7 @@ export declare class GraphConfig implements GraphConfigInterface {
|
|
|
598
584
|
curvedLinkSegments: number;
|
|
599
585
|
curvedLinkWeight: number;
|
|
600
586
|
curvedLinkControlPointDistance: number;
|
|
601
|
-
|
|
602
|
-
linkDefaultArrows: undefined;
|
|
587
|
+
linkDefaultArrows: boolean;
|
|
603
588
|
linkArrowsSizeScale: number;
|
|
604
589
|
scaleLinksOnZoom: boolean;
|
|
605
590
|
linkVisibilityDistanceRange: number[];
|
|
@@ -620,7 +605,6 @@ export declare class GraphConfig implements GraphConfigInterface {
|
|
|
620
605
|
onSimulationTick: GraphConfigInterface['onSimulationTick'];
|
|
621
606
|
onSimulationEnd: GraphConfigInterface['onSimulationEnd'];
|
|
622
607
|
onSimulationPause: GraphConfigInterface['onSimulationPause'];
|
|
623
|
-
onSimulationRestart: GraphConfigInterface['onSimulationRestart'];
|
|
624
608
|
onSimulationUnpause: GraphConfigInterface['onSimulationUnpause'];
|
|
625
609
|
onClick: GraphConfigInterface['onClick'];
|
|
626
610
|
onPointClick: GraphConfigInterface['onPointClick'];
|
|
@@ -656,6 +640,7 @@ export declare class GraphConfig implements GraphConfigInterface {
|
|
|
656
640
|
fitViewByPointIndices: undefined;
|
|
657
641
|
randomSeed: undefined;
|
|
658
642
|
pointSamplingDistance: number;
|
|
643
|
+
linkSamplingDistance: number;
|
|
659
644
|
attribution: string;
|
|
660
645
|
rescalePositions: undefined;
|
|
661
646
|
init(config: GraphConfigInterface): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,11 @@ import { GraphData } from './modules/GraphData';
|
|
|
4
4
|
export declare class Graph {
|
|
5
5
|
config: GraphConfig;
|
|
6
6
|
graph: GraphData;
|
|
7
|
-
/** Promise that resolves
|
|
8
|
-
readonly
|
|
7
|
+
/** Promise that resolves when the graph is fully initialized and ready to use */
|
|
8
|
+
readonly ready: Promise<void>;
|
|
9
|
+
/** Whether the graph has completed initialization */
|
|
10
|
+
isReady: boolean;
|
|
11
|
+
private readonly deviceInitPromise;
|
|
9
12
|
/** Canvas element, assigned asynchronously during device initialization */
|
|
10
13
|
private canvas;
|
|
11
14
|
private attributionDivElement;
|
|
@@ -362,15 +365,6 @@ export declare class Graph {
|
|
|
362
365
|
* @returns A Float32Array containing the indices of points inside a rectangular area.
|
|
363
366
|
*/
|
|
364
367
|
getPointsInRect(selection: [[number, number], [number, number]]): Float32Array;
|
|
365
|
-
/**
|
|
366
|
-
* Get points indices inside a rectangular area.
|
|
367
|
-
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
368
|
-
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
369
|
-
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
370
|
-
* @returns A Float32Array containing the indices of points inside a rectangular area.
|
|
371
|
-
* @deprecated Use `getPointsInRect` instead. This method will be removed in a future version.
|
|
372
|
-
*/
|
|
373
|
-
getPointsInRange(selection: [[number, number], [number, number]]): Float32Array;
|
|
374
368
|
/**
|
|
375
369
|
* Get points indices inside a polygon area.
|
|
376
370
|
* @param polygonPath - Array of points `[[x1, y1], [x2, y2], ..., [xn, yn]]` that defines the polygon.
|
|
@@ -383,13 +377,6 @@ export declare class Graph {
|
|
|
383
377
|
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
384
378
|
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas. */
|
|
385
379
|
selectPointsInRect(selection: [[number, number], [number, number]] | null): void;
|
|
386
|
-
/** Select points inside a rectangular area.
|
|
387
|
-
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
388
|
-
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
389
|
-
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
390
|
-
* @deprecated Use `selectPointsInRect` instead. This method will be removed in a future version.
|
|
391
|
-
*/
|
|
392
|
-
selectPointsInRange(selection: [[number, number], [number, number]] | null): void;
|
|
393
380
|
/** Select points inside a polygon area.
|
|
394
381
|
* @param polygonPath - Array of points `[[x1, y1], [x2, y2], ..., [xn, yn]]` that defines the polygon.
|
|
395
382
|
* The coordinates should be from 0 to the width/height of the canvas.
|
|
@@ -481,6 +468,24 @@ export declare class Graph {
|
|
|
481
468
|
indices: number[];
|
|
482
469
|
positions: number[];
|
|
483
470
|
};
|
|
471
|
+
/**
|
|
472
|
+
* For the links that are currently visible on the screen, get a sample of link indices with their midpoint coordinates and angle.
|
|
473
|
+
* The resulting number of links will depend on the `linkSamplingDistance` configuration property,
|
|
474
|
+
* and the sampled links will be evenly distributed (one link per grid cell, based on link midpoint in screen space).
|
|
475
|
+
* Each value is [x, y, angle]: position in data space; angle in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
|
|
476
|
+
*/
|
|
477
|
+
getSampledLinkPositionsMap(): Map<number, [number, number, number]>;
|
|
478
|
+
/**
|
|
479
|
+
* For the links that are currently visible on the screen, get a sample of link indices, midpoint positions, and angles.
|
|
480
|
+
* The resulting number of links will depend on the `linkSamplingDistance` configuration property,
|
|
481
|
+
* and the sampled links will be evenly distributed.
|
|
482
|
+
* Positions are in data space; angles are in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
|
|
483
|
+
*/
|
|
484
|
+
getSampledLinks(): {
|
|
485
|
+
indices: number[];
|
|
486
|
+
positions: number[];
|
|
487
|
+
angles: number[];
|
|
488
|
+
};
|
|
484
489
|
/**
|
|
485
490
|
* Gets the X-axis of rescaling function.
|
|
486
491
|
*
|
|
@@ -515,12 +520,6 @@ export declare class Graph {
|
|
|
515
520
|
* simulation and continues its execution.
|
|
516
521
|
*/
|
|
517
522
|
unpause(): void;
|
|
518
|
-
/**
|
|
519
|
-
* Restart/Resume the simulation. This method unpauses a paused
|
|
520
|
-
* simulation and resumes its execution.
|
|
521
|
-
* @deprecated Use `unpause()` instead. This method will be removed in a future version.
|
|
522
|
-
*/
|
|
523
|
-
restart(): void;
|
|
524
523
|
/**
|
|
525
524
|
* Run one step of the simulation manually.
|
|
526
525
|
* Works even when the simulation is paused.
|
|
@@ -618,4 +617,5 @@ export declare class Graph {
|
|
|
618
617
|
}
|
|
619
618
|
export type { GraphConfigInterface } from './config';
|
|
620
619
|
export { PointShape } from './modules/GraphData';
|
|
620
|
+
export * from './variables';
|
|
621
621
|
export * from './helper';
|