@neo4j-nvl/base 1.0.0 → 1.1.0-01fc2de1
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/CHANGELOG.md +25 -0
- package/dist/base.mjs +1 -1
- package/dist/types/index.d.ts +44 -11
- package/dist/types/layouts/circularLayout/CircularLayout.d.ts +18 -0
- package/dist/types/layouts/d3forcelayout/d3ForceLayout.d.ts +20 -20
- package/dist/types/layouts/d3forcelayout/types.d.ts +5 -6
- package/dist/types/layouts/forcedirectedlayout/ForceCytoLayout.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +8 -4
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-repulsive-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.d.ts +17 -39
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/types.d.ts +49 -0
- package/dist/types/layouts/gridLayout/GridLayout.d.ts +25 -9
- package/dist/types/modules/NvlController.d.ts +20 -4
- package/dist/types/modules/state/types.d.ts +32 -15
- package/dist/types/modules/state/utils.d.ts +2 -2
- package/dist/types/renderers/domrenderer/BaseRenderer.d.ts +75 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/CanvasRenderer.d.ts +33 -40
- package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.d.ts +168 -0
- package/dist/types/renderers/domrenderer/canvasrenderer/nodeDrawing.d.ts +109 -0
- package/dist/types/renderers/domrenderer/shared/ImageCache.d.ts +16 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/ArrowBundle.d.ts +20 -4
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/ArrowBundler.d.ts +11 -1
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundler.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +175 -0
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/shared/nodes/nodes.d.ts +103 -0
- package/dist/types/renderers/domrenderer/shared/nodes/nodes.test.d.ts +1 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/types.d.ts +2 -2
- package/dist/types/renderers/domrenderer/shared/util.d.ts +16 -0
- package/dist/types/renderers/domrenderer/shared/util.test.d.ts +1 -0
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/vectorUtils.d.ts +1 -1
- package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/wordwrap.d.ts +10 -0
- package/dist/types/renderers/domrenderer/shared/wordwrap.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.d.ts +20 -0
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.d.ts +59 -0
- package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.d.ts +16 -0
- package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.d.ts +78 -0
- package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.test.d.ts +1 -0
- package/dist/types/renderers/webglrenderer/Renderer.d.ts +5 -1
- package/dist/types/renderers/webglrenderer/Renderer.test.d.ts +1 -0
- package/dist/types/types/graph-element.d.ts +1 -1
- package/dist/types/utils/canvasManagement.d.ts +16 -1
- package/dist/types/utils/circularUtils.d.ts +3 -0
- package/dist/types/utils/circularUtils.test.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +7 -3
- package/dist/types/utils/geometry.d.ts +2 -1
- package/dist/types/utils/graphObjectUtils.d.ts +2 -2
- package/dist/types/utils/jsDriverResultTransformer.d.ts +1 -1
- package/dist/types/utils/segmentAnalytics.d.ts +2 -2
- package/package.json +25 -24
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-fragment-verlet.d.ts +0 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-repulsive-fragment-verlet.d.ts +0 -2
- package/dist/types/modules/performance.d.ts +0 -93
- package/dist/types/renderers/canvasrenderer/ImageCache.d.ts +0 -11
- package/dist/types/renderers/canvasrenderer/arrows/arrows.d.ts +0 -55
- package/dist/types/renderers/canvasrenderer/nodes/nodes.d.ts +0 -59
- package/dist/types/renderers/canvasrenderer/util.d.ts +0 -68
- /package/dist/types/{renderers/canvasrenderer/Animation.test.d.ts → layouts/d3forcelayout/circularLayout.test.d.ts} +0 -0
- /package/dist/types/{renderers/canvasrenderer/CanvasRenderer.test.d.ts → layouts/d3forcelayout/d3ForceLayout.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/ImageCache.test.d.ts → domrenderer/BaseRenderer.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/Animation.d.ts +0 -0
- /package/dist/types/renderers/{canvasrenderer/arrows/ArrowBundle.test.d.ts → domrenderer/canvasrenderer/Animation.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/AnimationHandler.d.ts +0 -0
- /package/dist/types/renderers/{canvasrenderer/arrows/ArrowBundler.test.d.ts → domrenderer/canvasrenderer/CanvasRenderer.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/arrows/arrows.test.d.ts → domrenderer/canvasrenderer/arrowDrawing.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/nodes/nodes.test.d.ts → domrenderer/canvasrenderer/nodeDrawing.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/util.test.d.ts → domrenderer/shared/ImageCache.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer/wordwrap.test.d.ts → domrenderer/shared/arrows/ArrowBundle.test.d.ts} +0 -0
- /package/dist/types/renderers/{canvasrenderer → domrenderer/shared}/arrows/constants.d.ts +0 -0
|
@@ -4,7 +4,7 @@ export type FlatRel = Omit<Relationship & {
|
|
|
4
4
|
bundledRels: Omit<Relationship, 'from' | 'to'>[];
|
|
5
5
|
key: string;
|
|
6
6
|
}, 'id'>;
|
|
7
|
-
export declare const getRelItemKey: (from: Node[
|
|
7
|
+
export declare const getRelItemKey: (from: Node["id"], to: Node["id"]) => string;
|
|
8
8
|
export declare const relItemsToFlatKeySet: (relItems: Relationship[]) => Set<string>;
|
|
9
9
|
/**
|
|
10
10
|
* Flattens a list of relationships so only one relationship remains between two nodes.
|
|
@@ -19,7 +19,7 @@ export declare const getAdjNodesMapAndRelMap: (rels: Relationship[]) => {
|
|
|
19
19
|
adjNodesMap: Record<string, Set<string>>;
|
|
20
20
|
relMap: Record<string, Relationship[]>;
|
|
21
21
|
};
|
|
22
|
-
export declare const getConnectedNodesAndRels: (addedNodes: Set<Node[
|
|
22
|
+
export declare const getConnectedNodesAndRels: (addedNodes: Set<Node["id"]>, addedRels: Set<Relationship["id"]>, nodes: DataSet<Node>, rels: DataSet<Relationship>) => {
|
|
23
23
|
connectedNodes: Record<string, Node>;
|
|
24
24
|
connectedRels: Record<string, Relationship>;
|
|
25
25
|
};
|
|
@@ -31,7 +31,7 @@ export declare const recordCollector: (graphElements: NestedGraphElements[]) =>
|
|
|
31
31
|
*
|
|
32
32
|
* @see {@link https://neo4j.com/docs/api/javascript-driver/current/class/lib6/result-transformers.js~ResultTransformers.html|ResultTransformers on Neo4j JS Driver API Docs}
|
|
33
33
|
*/
|
|
34
|
-
export declare const nvlResultTransformer: import("neo4j-driver-core
|
|
34
|
+
export declare const nvlResultTransformer: import("neo4j-driver-core").ResultTransformer<{
|
|
35
35
|
/** The nodes of the graph. */
|
|
36
36
|
nodes: NvlNode[];
|
|
37
37
|
/** The relationships of the graph. */
|
|
@@ -24,7 +24,7 @@ export declare abstract class AnalyticsFunction {
|
|
|
24
24
|
/**
|
|
25
25
|
* Get/fetch unique segment Id from the localstorage.
|
|
26
26
|
*/
|
|
27
|
-
abstract getSegmentTrackingId():
|
|
27
|
+
abstract getSegmentTrackingId(): string;
|
|
28
28
|
/**
|
|
29
29
|
* Track arbitrary event.
|
|
30
30
|
*/
|
|
@@ -44,7 +44,7 @@ export declare class SegmentAnalytics implements AnalyticsFunction {
|
|
|
44
44
|
}): Promise<void>;
|
|
45
45
|
identify(): void;
|
|
46
46
|
loadSavedSegmentId(): string;
|
|
47
|
-
getSegmentTrackingId():
|
|
47
|
+
getSegmentTrackingId(): string;
|
|
48
48
|
saveTrackingId(segmentId: string): void;
|
|
49
49
|
private ready;
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0-01fc2de1",
|
|
4
4
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"description": "Base library for the Neo4j Visualization Library",
|
|
@@ -29,34 +29,35 @@
|
|
|
29
29
|
"postpack": "rm LICENSE.txt && rm CHANGELOG.md"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@neo4j-nvl/layout-workers": "1.
|
|
33
|
-
"@segment/analytics-next": "
|
|
34
|
-
"color-string": "
|
|
35
|
-
"d3-force": "
|
|
36
|
-
"gl-matrix": "
|
|
37
|
-
"glsl-inject-defines": "
|
|
38
|
-
"lodash": "4.
|
|
39
|
-
"loglevel": "
|
|
40
|
-
"mobx": "
|
|
41
|
-
"node-pid-controller": "
|
|
42
|
-
"resizelistener": "
|
|
32
|
+
"@neo4j-nvl/layout-workers": "1.1.0-01fc2de1",
|
|
33
|
+
"@segment/analytics-next": "1.81.1",
|
|
34
|
+
"color-string": "1.9.1",
|
|
35
|
+
"d3-force": "3.0.0",
|
|
36
|
+
"gl-matrix": "3.4.4",
|
|
37
|
+
"glsl-inject-defines": "1.0.3",
|
|
38
|
+
"lodash": "4.18.1",
|
|
39
|
+
"loglevel": "1.9.2",
|
|
40
|
+
"mobx": "3.6.2",
|
|
41
|
+
"node-pid-controller": "1.0.1",
|
|
42
|
+
"resizelistener": "1.1.0",
|
|
43
43
|
"tinycolor2": "1.6.0",
|
|
44
|
-
"uuid": "
|
|
44
|
+
"uuid": "14.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/core": "
|
|
48
|
-
"@types/color-string": "
|
|
49
|
-
"@types/d3-force": "
|
|
50
|
-
"@types/lodash": "4.
|
|
47
|
+
"@babel/core": "7.28.5",
|
|
48
|
+
"@types/color-string": "1.5.5",
|
|
49
|
+
"@types/d3-force": "3.0.10",
|
|
50
|
+
"@types/lodash": "4.17.21",
|
|
51
51
|
"@types/segment-analytics": "0.0.38",
|
|
52
|
-
"@types/tinycolor2": "
|
|
53
|
-
"babel-loader": "
|
|
54
|
-
"copy-webpack-plugin": "
|
|
55
|
-
"neo4j-driver": "
|
|
56
|
-
"webpack": "
|
|
57
|
-
"webpack-cli": "
|
|
52
|
+
"@types/tinycolor2": "1.4.6",
|
|
53
|
+
"babel-loader": "8.4.1",
|
|
54
|
+
"copy-webpack-plugin": "11.0.0",
|
|
55
|
+
"neo4j-driver": "5.28.2",
|
|
56
|
+
"webpack": "5.104.1",
|
|
57
|
+
"webpack-cli": "5.1.4"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"neo4j-driver": "*"
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
|
+
"stableVersion": "1.1.0"
|
|
62
63
|
}
|
package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-fragment-verlet.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "precision mediump float;\n\nuniform sampler2D u_physData;\nuniform sampler2D u_connections;\nuniform sampler2D u_connectionOffsets;\nuniform sampler2D u_pinnedNodes;\nuniform sampler2D u_sizeTexture;\nuniform float u_baseLength;\nuniform float u_curIteration;\nuniform float u_iterationMultiplier;\nuniform vec2 u_gravityCenter;\nuniform float u_numNodes;\nuniform float u_gravity;\n\nuniform sampler2D u_clusterData;\nuniform sampler2D u_prevForce;\nuniform float u_collisionMultiplier;\n\n\nfloat DAMP = 0.6;\nfloat COOL = 0.99998;\nfloat TEMP = max(0.02, pow(COOL, u_curIteration));\nfloat TIMESTEP = 1.0 / 30.0;\nfloat VELOCITYDECAY = 0.6;\nfloat accLimitLow = 500000.0;\nfloat accLimitHigh = 750000.0;\nfloat accLimitPosHigh = 10000000.0;\n\nconst float denseNodeThreshold = 1000.0;\nconst float MIN_DISTANCE = 0.00000001;\nconst float MAX_DISTANCE = 1000000000.0;\nconst float MAX_ACCELERATION = 50000.0;\n\nvec4 getTextureData(sampler2D texture, float index, float base) {\n float x = mod(index, base);\n float y = (index - x) / base;\n return texture2D(texture, vec2(x + 0.5, y + 0.5) / base);\n}\n\nbool isNan(float val) {\n return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;\n}\n\nconst float BIG_NUMBER = 999999999999999999.0;\nbool isInf(float val) {\n return val > BIG_NUMBER || val < -BIG_NUMBER;\n}\n\nvec2 getDelta(vec2 v1, vec2 v2) {\n vec2 delta = v1 - v2;\n float dist = length(delta);\n if (dist < MIN_DISTANCE || isNan(dist)) {\n return vec2(MIN_DISTANCE, MIN_DISTANCE);\n }\n if (dist > MAX_DISTANCE) {\n vec2 normDelta = delta / dist;\n return normDelta * MAX_DISTANCE;\n }\n return delta;\n}\n\nvec4 getOtherNodePosition(float i) {\n return getTextureData(u_physData, i, 256.0);\n}\n\nfloat getCombinedNodeSize(float i, float nodeSize) {\n float otherNodeSize = getTextureData(u_sizeTexture, i, 256.0).a;\n return nodeSize + otherNodeSize;\n}\n\nvec2 getSpringForce(float curConnection, float numConnections, float springFScale, vec4 myPosition, float i) {\n float curSpring = getTextureData(u_connections, curConnection + i, 4096.0).a;\n\n vec4 otherPosition = getTextureData(u_physData, curSpring, 256.0);\n float otherDataPosition = getTextureData(u_connectionOffsets, curSpring, 256.0).a;\n float avgDegree;\n#if INTEL_WORKAROUND\n avgDegree = max(numConnections, 4.0);\n#else\n float otherNumConnections = getTextureData(u_connections, otherDataPosition, 4096.0).a;\n avgDegree = max((otherNumConnections + numConnections * 3.0) / 4.0, 4.0);\n#endif\n\n vec2 delta = getDelta(myPosition.xy, otherPosition.xy);\n float dist = length(delta);\n\n float F = (dist * dist * springFScale) / (u_baseLength * avgDegree);\n if (u_collisionMultiplier > 0.0) {\n F *= u_collisionMultiplier;\n }\n return (-delta / dist) * F;\n}\n\nvec2 getCollisionForce(float combinedNodeSize, float dist, float fScale, vec2 delta) {\n float collisionForce = (combinedNodeSize - dist) / (dist);\n if (u_collisionMultiplier > 0.0) {\n collisionForce *= u_collisionMultiplier;\n }\n return (delta * collisionForce * fScale * combinedNodeSize) / (combinedNodeSize + 1.0);\n}\n\nvec2 getRepulsionForce(float dist, float fScale, vec2 delta) {\n float F = (u_baseLength * u_baseLength * fScale) / (dist);\n return (delta / dist) * F * 0.05;\n}\n\nvoid main(void) {\n float textureSide = 256.0; //#TEXTURE_SIDE#;\n float index = (gl_FragCoord.x - 0.5) + (gl_FragCoord.y - 0.5) * textureSide;\n\n if (index >= u_numNodes) {\n discard;\n }\n\n vec4 clusterData = getTextureData(u_clusterData, index, 256.0);\n\n float clusterIndex = clusterData.x;\n float clusterStartIndex = clusterData.y;\n float clusterSize = clusterData.z;\n float clusterWeight = clusterData.w;\n\n vec4 myPosition = getTextureData(u_physData, index, 256.0);\n vec4 previousForce = getTextureData(u_prevForce, clusterIndex, 256.0);\n\n vec2 acceleration = previousForce.xy;\n\n float isPinned = getTextureData(u_pinnedNodes, index, 256.0).a;\n float nodeSize = getTextureData(u_sizeTexture, index, 256.0).a;\n\n if (isPinned > 0.5) {\n gl_FragColor = vec4(myPosition.xy, 0.0, 0.0);\n return;\n }\n\n float curConnection = getTextureData(u_connectionOffsets, index, 256.0).a;\n float numConnections = getTextureData(u_connections, curConnection, 4096.0).a;\n\n float fScale = 1.0 + sqrt(u_iterationMultiplier);\n float springFScale = fScale;\n\n if (numConnections > denseNodeThreshold) {\n springFScale = sqrt(fScale);\n }\n\n float numOfRels = 0.0;\n\n // Springs\n for (float i = 1.0; i <= 256.0 * 256.0; i++) {\n if (numOfRels >= numConnections) {\n break;\n }\n acceleration += getSpringForce(curConnection, numConnections, springFScale, myPosition, i);\n numOfRels += 1.0;\n }\n\n // Repulsion && collision detection\n if (u_collisionMultiplier > 0.0) {\n float number_of_collisions = 0.0;\n for (float i = 0.0; i < 256.0 * 256.0; i++) {\n if (i >= u_numNodes) {\n break;\n }\n\n if (i == index) {\n continue;\n }\n\n vec4 otherPosition = getOtherNodePosition(i);\n vec2 delta = getDelta(myPosition.xy, otherPosition.xy);\n float dist = length(delta);\n float combinedNodeSize = getCombinedNodeSize(i, nodeSize) * 2.0;\n\n if (dist < combinedNodeSize && number_of_collisions < 40.0) {\n number_of_collisions++;\n acceleration += getCollisionForce(combinedNodeSize, dist, fScale, delta);\n }\n\n if (i >= clusterStartIndex && i < clusterStartIndex + clusterSize) {\n acceleration += getRepulsionForce(dist, fScale, delta);\n }\n }\n } else {\n for (float i = 0.0; i < 256.0 * 256.0; i++) {\n if (i >= clusterStartIndex + clusterSize || i >= u_numNodes) {\n break;\n }\n\n if (i < clusterStartIndex || i == index) {\n continue;\n }\n\n vec4 otherPosition = getOtherNodePosition(i);\n vec2 delta = getDelta(myPosition.xy, otherPosition.xy);\n float dist = length(delta);\n float combinedNodeSize = getCombinedNodeSize(i, nodeSize);\n\n if (dist < combinedNodeSize) {\n acceleration += getCollisionForce(combinedNodeSize, dist, fScale, delta);\n }\n\n acceleration += getRepulsionForce(dist, fScale, delta);\n }\n }\n\n // Gravity\n vec2 delta = getDelta(u_gravityCenter, myPosition.xy);\n float dist = length(delta);\n\n vec2 grav = (delta / dist) * u_gravity * fScale;\n acceleration += grav * smoothstep(0.0, 500.0, dist);\n\n float accMagnitude = length(acceleration);\n acceleration *= min(MAX_ACCELERATION, accMagnitude) / accMagnitude;\n\n float iterationFrictionThreshold = 1000.0;\n\n if (u_curIteration > iterationFrictionThreshold) {\n float friction = 1.0 + pow((u_curIteration - iterationFrictionThreshold), 2.0) / 100.0;\n acceleration *= 1.0 / friction;\n }\n\n if (u_curIteration == 0.0) {\n gl_FragColor = vec4(myPosition.xy, myPosition.zw);\n } else {\n vec2 prevVelocity = myPosition.zw;\n vec2 currentPos = myPosition.xy;\n vec2 prevPos = currentPos - prevVelocity;\n\n vec2 newPos = currentPos + TEMP * ( DAMP * (prevVelocity) + acceleration * TIMESTEP * TIMESTEP);\n vec2 newVelocity = newPos - currentPos;\n gl_FragColor = vec4(newPos, newVelocity);\n }\n}";
|
|
2
|
-
export default _default;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "precision mediump float;\nuniform sampler2D u_physData;\nuniform sampler2D u_clusterData;\nuniform sampler2D u_finestIndexes;\nuniform sampler2D u_prevForce;\n\nuniform float u_baseLength;\nuniform float u_numNodes;\nuniform float u_iterationMultiplier;\nuniform float u_isTopLevel;\n\nfloat PI = 3.1415926535897932384626433832795;\nfloat TIMESTEP = 1.0 / 30.0;\nfloat VELOCITYDECAY = 1.0;\n\nvec4 getTextureData(sampler2D texture, float index, float base) {\n float x = mod(index, base);\n float y = (index - x) / base;\n return texture2D(texture, vec2(x + 0.5, y + 0.5) / base);\n}\n\nfloat getSquaredLogClusterWeight(float value) {\n return pow(log(value), 2.0);\n}\n\nvoid main(void) {\n float index = (gl_FragCoord.x - 0.5) + (gl_FragCoord.y - 0.5) * 256.0;\n\n if (index >= u_numNodes) {\n discard;\n }\n\n vec4 clusterData = getTextureData(u_clusterData, index, 256.0);\n\n float clusterIndex = clusterData.x;\n float clusterStartIndex = clusterData.y;\n float clusterSize = clusterData.z;\n float clusterArea = pow(clusterSize + u_baseLength * 2.0, 2.0);\n\n float finestIndex = getTextureData(u_finestIndexes, index, 256.0).a;\n vec4 myPosition = getTextureData(u_physData, finestIndex, 256.0);\n vec4 previousForce = getTextureData(u_prevForce, clusterIndex, 256.0);\n float fScale = 1.0 + sqrt(u_iterationMultiplier);\n\n vec2 acceleration = previousForce.xy;\n\n // Repulsion & Collision Detection\n for (float i = 0.0; i < 256.0 * 256.0; i++) {\n if (i >= clusterStartIndex + clusterSize || i >= u_numNodes) {\n break;\n }\n if (i < clusterStartIndex || i == index) {\n continue;\n }\n\n vec4 otherClusterData = getTextureData(u_clusterData, i, 256.0);\n float otherClusterWeight = getSquaredLogClusterWeight(otherClusterData.w);\n\n float otherFinestIndex = getTextureData(u_finestIndexes, i, 256.0).a;\n vec4 otherPosition = getTextureData(u_physData, otherFinestIndex, 256.0);\n\n vec2 delta = myPosition.xy - otherPosition.xy;\n float dist = max(length(delta), 0.0000001);\n float maxDist = 25.0;\n float repulsionForceScale = 0.1;\n\n float F = (clusterArea * fScale) / (dist * dist);\n\n if (u_isTopLevel == 1.0) {\n repulsionForceScale = 0.2;\n }\n\n acceleration += ((delta / sqrt(dist)) * F) * repulsionForceScale * otherClusterWeight;\n\n if (dist < maxDist) {\n float collide = (maxDist - dist) / (dist * dist);\n acceleration += delta * collide * fScale * maxDist / (maxDist + 1.0);\n }\n }\n\n gl_FragColor = vec4(acceleration, vec2(finestIndex, 0));\n}";
|
|
2
|
-
export default _default;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A class capable of measuring performance.
|
|
3
|
-
* Usage:
|
|
4
|
-
* When you want to measure a block of code, start by calling
|
|
5
|
-
* performanceTesterInstance.startTest() or
|
|
6
|
-
* performanceTesterInstance.startTest('Some readable name') if you
|
|
7
|
-
* want to control how it prints.
|
|
8
|
-
* After the block of code ends, call performanceTesterInstance.endTest()
|
|
9
|
-
*/
|
|
10
|
-
export default class PerformanceTester {
|
|
11
|
-
disabled: boolean;
|
|
12
|
-
tree: PerformanceTree;
|
|
13
|
-
/**
|
|
14
|
-
* Starts a performance measurement. Every call to this method must be followed
|
|
15
|
-
* by a call to endTest(). Tests can be nested.
|
|
16
|
-
* @param {String} measurement String identifying this measurement. Only used for printing, so
|
|
17
|
-
* keep it human readable.
|
|
18
|
-
*/
|
|
19
|
-
startTest(measurement: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* Ends the last started test, giving it an end time.
|
|
22
|
-
*/
|
|
23
|
-
endTest(): void;
|
|
24
|
-
/**
|
|
25
|
-
* Clears all performance measurements
|
|
26
|
-
*/
|
|
27
|
-
reset(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Prints all the performance measurements to console by calling
|
|
30
|
-
* print() on the performance tree.
|
|
31
|
-
*/
|
|
32
|
-
print(): void;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A tree of PerformanceTreeNodes.
|
|
36
|
-
* @type {PerformanceTree}
|
|
37
|
-
*/
|
|
38
|
-
declare class PerformanceTree {
|
|
39
|
-
root: any;
|
|
40
|
-
current: any;
|
|
41
|
-
/**
|
|
42
|
-
* Empties the tree.
|
|
43
|
-
*/
|
|
44
|
-
clear(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Adds a new node to the tree at the current open position, containing the
|
|
47
|
-
* data provided. It also sets the newly added node as the currently open one.
|
|
48
|
-
* @param {PerformanceData} data A PerformanceData object.
|
|
49
|
-
*/
|
|
50
|
-
add(data: PerformanceData): void;
|
|
51
|
-
/**
|
|
52
|
-
* The tree always maintains a pointer to the currently open node. This
|
|
53
|
-
* method closes that node, closes the data object in contains, and opens
|
|
54
|
-
* the parent node.
|
|
55
|
-
*/
|
|
56
|
-
close(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Gets the data object of the currently open node.
|
|
59
|
-
* @return {PerformanceData} The data object of the currently open node.
|
|
60
|
-
*/
|
|
61
|
-
getCurrentData(): PerformanceData;
|
|
62
|
-
/**
|
|
63
|
-
* Prints this entire tree to the console.
|
|
64
|
-
*/
|
|
65
|
-
print(): void;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Performance measurement data.
|
|
69
|
-
* @type {PerformanceData}
|
|
70
|
-
*/
|
|
71
|
-
declare class PerformanceData {
|
|
72
|
-
/**
|
|
73
|
-
* Instantiates a data measurement, giving it the start time when constructor is called.
|
|
74
|
-
* Remember that you also have to call close on this object to make it valid.
|
|
75
|
-
* @param {String} name String identifying this measurement. Only used for printing, so
|
|
76
|
-
* keep it human readable.
|
|
77
|
-
* @return {PerformanceData} The data object
|
|
78
|
-
*/
|
|
79
|
-
constructor(name: string);
|
|
80
|
-
name: any;
|
|
81
|
-
startTime: any;
|
|
82
|
-
endTime: any;
|
|
83
|
-
/**
|
|
84
|
-
* Sets the endTime measurement on this data object.
|
|
85
|
-
*/
|
|
86
|
-
close(): void;
|
|
87
|
-
/**
|
|
88
|
-
* Gets the time spent on this measurement
|
|
89
|
-
* @return {Number} Time spent in ms
|
|
90
|
-
*/
|
|
91
|
-
_timeSpent(): number;
|
|
92
|
-
}
|
|
93
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Cache } from './types';
|
|
2
|
-
declare class ImageCache {
|
|
3
|
-
cache: Cache;
|
|
4
|
-
constructor();
|
|
5
|
-
getImage(src: string, inverted?: boolean): HTMLCanvasElement;
|
|
6
|
-
private getOrCreateEntry;
|
|
7
|
-
private invertCanvas;
|
|
8
|
-
private loadImage;
|
|
9
|
-
private drawIfNeeded;
|
|
10
|
-
}
|
|
11
|
-
export default ImageCache;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { BorderStyle, DisabledItemStyles } from '../../../modules/state/types';
|
|
2
|
-
import type { Node, Relationship } from '../../../types/graph-element';
|
|
3
|
-
import type { Point } from '../../../utils/geometry';
|
|
4
|
-
import type ImageCache from '../ImageCache';
|
|
5
|
-
import type ArrowBundle from './ArrowBundle';
|
|
6
|
-
/**
|
|
7
|
-
* This function calculates the difference in radius between two nodes.
|
|
8
|
-
* @param toArrowGap - The gap between the node and the arrow on the to side.
|
|
9
|
-
* @param fromArrowGap - The gap between the node and the arrow on the from side.
|
|
10
|
-
* @returns The difference in radius between the two nodes.
|
|
11
|
-
* @comment can be affected for example by the label crust and selected ring
|
|
12
|
-
* as well as a gap between the node and the arrow on it's side.
|
|
13
|
-
*/
|
|
14
|
-
export declare const getRadiusDifference: (toArrowGap: number, fromArrowGap: number) => number;
|
|
15
|
-
/**
|
|
16
|
-
* This function calculates the coordinates of the via point
|
|
17
|
-
* between two nodes. The via point is used to bend the edge
|
|
18
|
-
* between the two nodes.
|
|
19
|
-
* @param fromNode - The node the edge starts from.
|
|
20
|
-
* @param toNode - The node the edge ends at.
|
|
21
|
-
* @param fromArrowGap - The gap between the node and the arrow on the from side.
|
|
22
|
-
* @param toArrowGap - The gap between the node and the arrow on the to side.
|
|
23
|
-
* @returns The coordinates of the via point.
|
|
24
|
-
*/
|
|
25
|
-
export declare const getViaCoordinates: (fromNode: Node, toNode: Node, fromArrowGap: number, toArrowGap: number, rel: Relationship, bundle: ArrowBundle) => Point;
|
|
26
|
-
export declare const getPointsForStraight: (rel: Relationship, bundle: ArrowBundle, fromNode: Node, toNode: Node, showLabel: boolean, curved?: boolean) => Point[];
|
|
27
|
-
/**
|
|
28
|
-
* Draws a label for a relationship.
|
|
29
|
-
* @param ctx - The canvas context.
|
|
30
|
-
* @param x - The x coordinate of the label.
|
|
31
|
-
* @param y - The y coordinate of the label.
|
|
32
|
-
* @param angle - The angle of the label.
|
|
33
|
-
* @param maxWidth - The maximum width of the label.
|
|
34
|
-
* @param rel - The relationship.
|
|
35
|
-
* @param bundle - The arrow bundle.
|
|
36
|
-
* @param disabledItemStyles - The styles for disabled items.
|
|
37
|
-
* @param fontColor - The color of the font.
|
|
38
|
-
* @param flip - Whether to flip the label.
|
|
39
|
-
*/
|
|
40
|
-
export declare const drawLabel: (ctx: CanvasRenderingContext2D, point: Point, angle: number, maxWidth: number, rel: Relationship, bundle: ArrowBundle, disabledItemStyles: DisabledItemStyles, fontColor: string, flip?: boolean) => void;
|
|
41
|
-
export declare const renderWaypointArrow: (ctx: CanvasRenderingContext2D, rel: Relationship, from: Node, to: Node, bundle: ArrowBundle, imageCache: ImageCache, showLabel: boolean, drawCurves: boolean, selectedBorderStyle: BorderStyle, disabledItemStyles: DisabledItemStyles, defaultRelationshipColor?: string) => void;
|
|
42
|
-
export declare const renderSelfArrow: (ctx: CanvasRenderingContext2D, rel: Relationship, node: Node, bundle: ArrowBundle, imageCache: ImageCache, showLabel: boolean, selectedBorderStyle: BorderStyle, disabledItemStyles: DisabledItemStyles, defaultRelationshipColor?: string) => void;
|
|
43
|
-
export declare const renderArrow: (ctx: CanvasRenderingContext2D, rel: Relationship, fromNode: Node, toNode: Node, bundle: ArrowBundle, imageCache: ImageCache, showLabel: boolean, selectedBorderStyle: BorderStyle, disabledItemStyles: DisabledItemStyles, defaultRelationshipColor: string, drawCurves?: boolean) => void;
|
|
44
|
-
export declare const distanceToEdge: (pos: Point, rel: Relationship, fromNode: Node, toNode: Node, bundle: ArrowBundle, showLabel: boolean, drawCurves?: boolean) => number;
|
|
45
|
-
/**
|
|
46
|
-
* Returns the bounding box of the arrow.
|
|
47
|
-
* @param rel - The relationship to get the bounding box for.
|
|
48
|
-
* @param bundle - The arrow bundle the relationship is part of.
|
|
49
|
-
* @param fromNode - The node the relationship is coming from.
|
|
50
|
-
* @param toNode - The node the relationship is going to.
|
|
51
|
-
* @param showLabel - Whether or not a label is shown.
|
|
52
|
-
* @param drawCurves - Whether or the relationship is drawn as a curve.
|
|
53
|
-
* @returns The bounding box of the arrow.
|
|
54
|
-
*/
|
|
55
|
-
export declare const getBoundingBox: (rel: Relationship, bundle: ArrowBundle, fromNode: Node, toNode: Node, showLabel?: boolean, drawCurves?: boolean) => DOMRect | null;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { BorderStyles, DisabledItemStyles } from '../../../modules/state/types';
|
|
2
|
-
import type { Node } from '../../../types/graph-element';
|
|
3
|
-
import type AnimationHandler from '../AnimationHandler';
|
|
4
|
-
type RingStyle = {
|
|
5
|
-
width: number;
|
|
6
|
-
color: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Returns an array of styles for the rings of a node.
|
|
10
|
-
* It takes the node as an argument, and an optional array of size animations.
|
|
11
|
-
* If the node is selected, it returns the selectedStyle.rings array.
|
|
12
|
-
* If the node is not selected, it returns an array containing only one object with
|
|
13
|
-
* a width of 0 and an empty color.
|
|
14
|
-
* @param node - The node to get the ring styles for.
|
|
15
|
-
* @param animationHandler - The animation handler.
|
|
16
|
-
* @param nodeBorderStyles - The node border styles.
|
|
17
|
-
* @returns An array of ring styles.
|
|
18
|
-
*/
|
|
19
|
-
export declare const getRingStyles: (node: Node, animationHandler: AnimationHandler, nodeBorderStyles: any) => RingStyle[];
|
|
20
|
-
/**
|
|
21
|
-
* Returns the bounding box of a node with the given x, y, and size properties.
|
|
22
|
-
* If no size is given, the default size is used.
|
|
23
|
-
* @param Node - The node to get the bounding box for.
|
|
24
|
-
* @returns The bounding box of the node.
|
|
25
|
-
*/
|
|
26
|
-
export declare const getBoundingBox: ({ x, y, size }: Node) => DOMRect;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the caption font size that should be used
|
|
29
|
-
* for the given info level and node diameter.
|
|
30
|
-
* @param infoLevel {number} - The info level.
|
|
31
|
-
* @param nodeRadius {number} - The radius of the node.
|
|
32
|
-
* @param captionSize {number} - The size of the caption.
|
|
33
|
-
* @returns The font size.
|
|
34
|
-
*/
|
|
35
|
-
export declare const infoLevelToFontSize: (infoLevel: number, nodeRadius?: number, captionSize?: number, hasIcon?: boolean) => number;
|
|
36
|
-
/**
|
|
37
|
-
* Returns maximum length of lines
|
|
38
|
-
* @param lines {array} - The lines info
|
|
39
|
-
* @returns The font size.
|
|
40
|
-
*/
|
|
41
|
-
export declare const findMaxLength: (lines: any[], ctx: CanvasRenderingContext2D, pixelRatio: number) => number;
|
|
42
|
-
/**
|
|
43
|
-
* Returns minimum length of lines
|
|
44
|
-
* @param lines {array} - The lines info
|
|
45
|
-
* @returns The font size.
|
|
46
|
-
*/
|
|
47
|
-
export declare const findMinLength: (lines: any[], ctx: CanvasRenderingContext2D, pixelRatio: number) => any;
|
|
48
|
-
/**
|
|
49
|
-
* Draws a node with the given context, node, and image cache.
|
|
50
|
-
* @param ctx {any} - The context to draw the node on.
|
|
51
|
-
* @param node {Node} - The node to draw.
|
|
52
|
-
* @param imageCache {any} - The image cache to use.
|
|
53
|
-
* @param animationHandler {AnimationHandler} - The animation handler.
|
|
54
|
-
* @param nodeBorderStyles {BorderStyles} - The node border styles.
|
|
55
|
-
* @param disabledItemStyles {DisabledItemStyles} - The styles for the disabled items.
|
|
56
|
-
* @param zoomLevel {number} - The current zoom level.
|
|
57
|
-
*/
|
|
58
|
-
export declare const drawNode: (ctx: CanvasRenderingContext2D, node: Node, imageCache: any, animationHandler: AnimationHandler, nodeBorderStyles: BorderStyles, disabledItemStyles: DisabledItemStyles, defaultNodeColor?: string, ellipsisWidth?: number, zoomLevel?: number) => void;
|
|
59
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { Point } from '../../utils/geometry';
|
|
2
|
-
import type { TextSegment } from './types';
|
|
3
|
-
export declare const fontThresholds: [number, number][];
|
|
4
|
-
/**
|
|
5
|
-
* This function takes color in hex format or rgb() or rgba() format and overrides the opacity. Returns rgba() string.
|
|
6
|
-
* @param color - * @param opacity - * @returns rgba() string with the given opacity.
|
|
7
|
-
*/
|
|
8
|
-
export declare const overrideOpacity: (color: string, opacity: number) => string;
|
|
9
|
-
/**
|
|
10
|
-
* The parameters for drawing an arrowhead.
|
|
11
|
-
*/
|
|
12
|
-
type ArrowHeadParameters = {
|
|
13
|
-
headPosition: Point;
|
|
14
|
-
headAngle: number;
|
|
15
|
-
headHeight: number;
|
|
16
|
-
headChinHeight: number;
|
|
17
|
-
headWidth: number;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Creates an arrowhead shape using a polygon.
|
|
21
|
-
* @param ctx - The canvas context to draw on.
|
|
22
|
-
* @param headLineWidth - The width of the arrowhead's outline.
|
|
23
|
-
* @param color - The color of the arrowhead.
|
|
24
|
-
* @param arrowHeadParameters - The parameters for the arrowhead.
|
|
25
|
-
* @param fill - Whether or not to fill the triangle.
|
|
26
|
-
* @param stroke - Whether or not to stroke the triangle.
|
|
27
|
-
*/
|
|
28
|
-
export declare const drawArrowHead: (ctx: CanvasRenderingContext2D, headLineWidth: number, color: string, arrowHeadParameters: ArrowHeadParameters, fill?: boolean, stroke?: boolean) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Draws borders around a node with a given array of border styles
|
|
31
|
-
* @param ctx - The canvas context.
|
|
32
|
-
* @param x - The x coordinate of the node.
|
|
33
|
-
* @param y - The y coordinate of the node.
|
|
34
|
-
* @param innerRadius - The inner radius of the node without any border.
|
|
35
|
-
* @param borderStyles - An array of border styles.
|
|
36
|
-
* @internal
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
39
|
-
export declare const drawCircleBand: (ctx: CanvasRenderingContext2D, x: number, y: number, innerRadius: number, borderStyles: {
|
|
40
|
-
width: number;
|
|
41
|
-
color: string;
|
|
42
|
-
}[]) => void;
|
|
43
|
-
export declare const drawCircle: (ctx: CanvasRenderingContext2D, x: number, y: number, r: number) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Fill a circle band with a gradient from a certain color to transparent
|
|
46
|
-
* @param ctx - The canvas context.
|
|
47
|
-
* @param x - The x coordinate of the node.
|
|
48
|
-
* @param y - The y coordinate of the node.
|
|
49
|
-
* @param color - The color of the gradient.
|
|
50
|
-
* @param radius - The inner radius of the node without any border.
|
|
51
|
-
* @param blur - The blur radius of the gradient.
|
|
52
|
-
* @param maxOpacity - The maximum opacity of the gradient.
|
|
53
|
-
*/
|
|
54
|
-
export declare const drawGradientCircleBand: (ctx: CanvasRenderingContext2D, x: number, y: number, color: string, radius: number, blur: number, maxOpacity?: number) => void;
|
|
55
|
-
/**
|
|
56
|
-
* Draw a circle shape with a solid color
|
|
57
|
-
*/
|
|
58
|
-
export declare const drawSolidCircle: (ctx: CanvasRenderingContext2D, x: number, y: number, color: string, size: number) => void;
|
|
59
|
-
export declare function getIndividualInfoLevels(r: number, zoomLevel: number): {
|
|
60
|
-
nodeInfoLevel: number;
|
|
61
|
-
fontInfoLevel: number;
|
|
62
|
-
iconInfoLevel: number;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Prints the caption for a node
|
|
66
|
-
*/
|
|
67
|
-
export declare const drawNodeCaption: (ctx: CanvasRenderingContext2D, lines: TextSegment[], stylesPerChar: string[][], initialYPos: number, fontSize: number, fontFace: string, lineDistance: number, x: number, y: number, ellipsisWidth: number) => void;
|
|
68
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/renderers/{canvasrenderer → domrenderer/canvasrenderer}/AnimationHandler.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|