@kineviz/gl 0.4.2 → 0.4.3
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NodeData, EdgeData as EdgeData$1, CategoryConfig, RelationshipConfig, LayoutEngineMode, LayoutEngineStatus, LayoutEngineCapabilities, LayoutGraphSnapshot, LayoutSettings, LayoutGraphDelta, LayoutTickResult, GraphEntityId, Position3D, LayoutEngineEventMap, GraphSnapshot as GraphSnapshot$1, GraphDelta, PropertyValue, GraphDeltaResult, GraphData, IndexManager, GraphQueries, GraphSchema, IconFontConfig, CategorySchema, RelationshipSchema, PropertySchema, CaptionDef } from '@kineviz/graph-core';
|
|
2
2
|
export { CaptionDef, CategoryConfig, CategorySchema, ColorMappingType, EdgeCaptionConfig, EdgeData, EdgeWidthMapping, EventBus as GraphCoreEventBus, GraphData, GraphDelta, GraphDeltaMetadata, GraphDeltaResult, GraphEdgeUpdatePatch, GraphEntityId, GraphNodeUpdatePatch, GraphQueries, GraphSchema, GraphSnapshot, IconFontConfig, IconMapping, ImageUrlMapping, IndexManager, IndexSystem, LayoutEdgeDeltaPatch, LayoutEdgeRecord, LayoutEngineCapabilities, LayoutEngineEventMap, LayoutEngineMode, LayoutEngineStatus, LayoutGraphDelta, LayoutGraphSnapshot, LayoutNodeDeltaPatch, LayoutNodeRecord, LayoutSettings, LayoutTickResult, NeighborInfo, NodeCaptionConfig, NodeData, NodePinPatch, NodePositionPatch, Position3D, PropertySchema, PropertyType, PropertyValue, RelationshipConfig, RelationshipSchema, SizeMapping } from '@kineviz/graph-core';
|
|
3
3
|
import { CircleLayoutOptions, GridLayoutOptions, LineLayoutOptions, SpiralLayoutOptions, CubeLayoutOptions, SphereLayoutOptions, ScatterLayoutOptions, EgoLayoutOptions, PlotAxisInfo } from '@kineviz/gpu-compute';
|
|
4
|
-
export { AlignByLayoutOptions, CategoryAxisMapping, CircleLayoutOptions, CubeLayoutOptions, EasingType, EgoLayoutOptions, GPUForceController, GPUForceLayoutController, GPUForceLayoutEngine, GeometricLayoutConfig, GridLayoutOptions, LayoutContext, LayoutFunction, LayoutResult, LayoutTween, LineLayoutOptions, PlotAxisInfo, PlotLayoutResult, PlotMultiCategoryOptions, PlotMultiCategoryResult, PlotScatterLayoutOptions, RotateLayoutOptions, ScaleLayoutOptions, ScatterLayoutOptions, ShiftLayoutOptions, SphereLayoutOptions, SpiralLayoutOptions, StatelessComputeFn, StatelessLayoutEngine, TweenOptions, Vec3, WebGPUForceLayoutController, WebGPULayoutControllerAdapter, alignByLayout, circleLayout, computeCenter, computeDomain, cubeLayout, egoLayout, executeLayout, generateTicks, gridLayout, isWebGPUAvailable, lineLayout, linearScale, logScale, parseNumericValue, plotMultiCategoryScatterLayout, plotScatterLayout, rotateLayout, scaleLayout, scatterLayout, shiftLayout, sphereLayout, spiralLayout } from '@kineviz/gpu-compute';
|
|
4
|
+
export { AlignByLayoutOptions, CategoryAxisMapping, CircleLayoutOptions, CreateForceLayoutOptions, CubeLayoutOptions, EasingType, EgoLayoutOptions, ForceLayoutBackend, ForceLayoutHandle, GPUForceController, GPUForceLayoutConfig, GPUForceLayoutController, GPUForceLayoutEngine, GPULayoutControllerAdapter, GeometricLayoutConfig, GridLayoutOptions, LayoutContext, LayoutFunction, LayoutResult, LayoutTween, LineLayoutOptions, PlotAxisInfo, PlotLayoutResult, PlotMultiCategoryOptions, PlotMultiCategoryResult, PlotScatterLayoutOptions, RotateLayoutOptions, ScaleLayoutOptions, ScatterLayoutOptions, ShiftLayoutOptions, SphereLayoutOptions, SpiralLayoutOptions, StatelessComputeFn, StatelessLayoutEngine, TweenOptions, Vec3, WebGPUForceLayoutController, WebGPULayoutControllerAdapter, alignByLayout, circleLayout, computeCenter, computeDomain, createForceLayout, cubeLayout, egoLayout, executeLayout, generateTicks, gridLayout, isWebGPUAvailable, lineLayout, linearScale, logScale, parseNumericValue, plotMultiCategoryScatterLayout, plotScatterLayout, rotateLayout, scaleLayout, scatterLayout, shiftLayout, sphereLayout, spiralLayout } from '@kineviz/gpu-compute';
|
|
5
5
|
import * as THREE$1 from 'three';
|
|
6
6
|
import { Group, Camera, Object3D, WebGLRenderer } from 'three';
|
|
7
7
|
import { OntologyRegistry, ResolvedOntology } from '@kineviz/ontology';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NodeData, EdgeData as EdgeData$1, CategoryConfig, RelationshipConfig, LayoutEngineMode, LayoutEngineStatus, LayoutEngineCapabilities, LayoutGraphSnapshot, LayoutSettings, LayoutGraphDelta, LayoutTickResult, GraphEntityId, Position3D, LayoutEngineEventMap, GraphSnapshot as GraphSnapshot$1, GraphDelta, PropertyValue, GraphDeltaResult, GraphData, IndexManager, GraphQueries, GraphSchema, IconFontConfig, CategorySchema, RelationshipSchema, PropertySchema, CaptionDef } from '@kineviz/graph-core';
|
|
2
2
|
export { CaptionDef, CategoryConfig, CategorySchema, ColorMappingType, EdgeCaptionConfig, EdgeData, EdgeWidthMapping, EventBus as GraphCoreEventBus, GraphData, GraphDelta, GraphDeltaMetadata, GraphDeltaResult, GraphEdgeUpdatePatch, GraphEntityId, GraphNodeUpdatePatch, GraphQueries, GraphSchema, GraphSnapshot, IconFontConfig, IconMapping, ImageUrlMapping, IndexManager, IndexSystem, LayoutEdgeDeltaPatch, LayoutEdgeRecord, LayoutEngineCapabilities, LayoutEngineEventMap, LayoutEngineMode, LayoutEngineStatus, LayoutGraphDelta, LayoutGraphSnapshot, LayoutNodeDeltaPatch, LayoutNodeRecord, LayoutSettings, LayoutTickResult, NeighborInfo, NodeCaptionConfig, NodeData, NodePinPatch, NodePositionPatch, Position3D, PropertySchema, PropertyType, PropertyValue, RelationshipConfig, RelationshipSchema, SizeMapping } from '@kineviz/graph-core';
|
|
3
3
|
import { CircleLayoutOptions, GridLayoutOptions, LineLayoutOptions, SpiralLayoutOptions, CubeLayoutOptions, SphereLayoutOptions, ScatterLayoutOptions, EgoLayoutOptions, PlotAxisInfo } from '@kineviz/gpu-compute';
|
|
4
|
-
export { AlignByLayoutOptions, CategoryAxisMapping, CircleLayoutOptions, CubeLayoutOptions, EasingType, EgoLayoutOptions, GPUForceController, GPUForceLayoutController, GPUForceLayoutEngine, GeometricLayoutConfig, GridLayoutOptions, LayoutContext, LayoutFunction, LayoutResult, LayoutTween, LineLayoutOptions, PlotAxisInfo, PlotLayoutResult, PlotMultiCategoryOptions, PlotMultiCategoryResult, PlotScatterLayoutOptions, RotateLayoutOptions, ScaleLayoutOptions, ScatterLayoutOptions, ShiftLayoutOptions, SphereLayoutOptions, SpiralLayoutOptions, StatelessComputeFn, StatelessLayoutEngine, TweenOptions, Vec3, WebGPUForceLayoutController, WebGPULayoutControllerAdapter, alignByLayout, circleLayout, computeCenter, computeDomain, cubeLayout, egoLayout, executeLayout, generateTicks, gridLayout, isWebGPUAvailable, lineLayout, linearScale, logScale, parseNumericValue, plotMultiCategoryScatterLayout, plotScatterLayout, rotateLayout, scaleLayout, scatterLayout, shiftLayout, sphereLayout, spiralLayout } from '@kineviz/gpu-compute';
|
|
4
|
+
export { AlignByLayoutOptions, CategoryAxisMapping, CircleLayoutOptions, CreateForceLayoutOptions, CubeLayoutOptions, EasingType, EgoLayoutOptions, ForceLayoutBackend, ForceLayoutHandle, GPUForceController, GPUForceLayoutConfig, GPUForceLayoutController, GPUForceLayoutEngine, GPULayoutControllerAdapter, GeometricLayoutConfig, GridLayoutOptions, LayoutContext, LayoutFunction, LayoutResult, LayoutTween, LineLayoutOptions, PlotAxisInfo, PlotLayoutResult, PlotMultiCategoryOptions, PlotMultiCategoryResult, PlotScatterLayoutOptions, RotateLayoutOptions, ScaleLayoutOptions, ScatterLayoutOptions, ShiftLayoutOptions, SphereLayoutOptions, SpiralLayoutOptions, StatelessComputeFn, StatelessLayoutEngine, TweenOptions, Vec3, WebGPUForceLayoutController, WebGPULayoutControllerAdapter, alignByLayout, circleLayout, computeCenter, computeDomain, createForceLayout, cubeLayout, egoLayout, executeLayout, generateTicks, gridLayout, isWebGPUAvailable, lineLayout, linearScale, logScale, parseNumericValue, plotMultiCategoryScatterLayout, plotScatterLayout, rotateLayout, scaleLayout, scatterLayout, shiftLayout, sphereLayout, spiralLayout } from '@kineviz/gpu-compute';
|
|
5
5
|
import * as THREE$1 from 'three';
|
|
6
6
|
import { Group, Camera, Object3D, WebGLRenderer } from 'three';
|
|
7
7
|
import { OntologyRegistry, ResolvedOntology } from '@kineviz/ontology';
|
package/dist/index.js
CHANGED
|
@@ -71,6 +71,7 @@ __export(index_exports, {
|
|
|
71
71
|
GPUForceLayoutController: () => GPUForceLayoutController,
|
|
72
72
|
GPUForceLayoutEngine: () => GPUForceLayoutEngine,
|
|
73
73
|
GPUGroupRingRenderer: () => GPUGroupRingRenderer,
|
|
74
|
+
GPULayoutControllerAdapter: () => GPULayoutControllerAdapter,
|
|
74
75
|
GPULayoutProviderAdapter: () => GPULayoutProviderAdapter,
|
|
75
76
|
GPUNodeRenderer: () => GPUNodeRenderer,
|
|
76
77
|
GPUPositionProvider: () => GPUPositionProvider,
|
|
@@ -164,6 +165,7 @@ __export(index_exports, {
|
|
|
164
165
|
createDefaultItems: () => createDefaultItems,
|
|
165
166
|
createDefaultRegistry: () => createDefaultRegistry,
|
|
166
167
|
createEdgeTextCloud: () => createEdgeTextCloud,
|
|
168
|
+
createForceLayout: () => createForceLayout,
|
|
167
169
|
createTextCloud: () => createTextCloud,
|
|
168
170
|
cubeLayout: () => cubeLayout,
|
|
169
171
|
defaultEdgeStyles: () => defaultEdgeStyles,
|
|
@@ -8023,6 +8025,61 @@ var GPUForceLayoutController = class {
|
|
|
8023
8025
|
const edgeRatio = (nearMin + nearMax) / count2;
|
|
8024
8026
|
}
|
|
8025
8027
|
};
|
|
8028
|
+
var GPULayoutControllerAdapter = class {
|
|
8029
|
+
constructor(c2) {
|
|
8030
|
+
this.c = c2;
|
|
8031
|
+
this.mode = "gpu";
|
|
8032
|
+
}
|
|
8033
|
+
// mode='gpu' → positions live in the WebGL FBO texture; the engine's
|
|
8034
|
+
// GPUNodeRenderer/GPUEdgeRenderer sample it directly (no CPU readback).
|
|
8035
|
+
getPositionTexture() {
|
|
8036
|
+
return this.c.getPositionTexture();
|
|
8037
|
+
}
|
|
8038
|
+
getTextureSize() {
|
|
8039
|
+
return this.c.getTextureSize();
|
|
8040
|
+
}
|
|
8041
|
+
getSpaceSize() {
|
|
8042
|
+
return this.c.getSpaceSize();
|
|
8043
|
+
}
|
|
8044
|
+
// The controller self-ticks via its own RAF; the engine's per-frame tick()
|
|
8045
|
+
// is a no-op here (same as the WebGPU adapter).
|
|
8046
|
+
tick() {
|
|
8047
|
+
}
|
|
8048
|
+
start() {
|
|
8049
|
+
this.c.startLayout();
|
|
8050
|
+
}
|
|
8051
|
+
stop() {
|
|
8052
|
+
this.c.stopLayout();
|
|
8053
|
+
}
|
|
8054
|
+
// Annotated to the interface shape so the public getter doesn't leak the
|
|
8055
|
+
// controller's non-exported LayoutGraph type (TS4041 in standalone DTS build).
|
|
8056
|
+
get graph() {
|
|
8057
|
+
return this.c.graph;
|
|
8058
|
+
}
|
|
8059
|
+
// Drive the engine's render loop while the simulation is converging: positions
|
|
8060
|
+
// keep moving until alpha decays (isFinish). Without this, RenderRuntime.update()
|
|
8061
|
+
// short-circuits on _needsRender=false and never reflects the moving layout.
|
|
8062
|
+
get needsUpdate() {
|
|
8063
|
+
return !this.c.isFinish;
|
|
8064
|
+
}
|
|
8065
|
+
clearNeedsUpdate() {
|
|
8066
|
+
}
|
|
8067
|
+
pinNodes(nodes) {
|
|
8068
|
+
this.c.pinNodes(nodes);
|
|
8069
|
+
}
|
|
8070
|
+
unpinNodes(nodeIds) {
|
|
8071
|
+
this.c.unpinNodes(nodeIds);
|
|
8072
|
+
}
|
|
8073
|
+
transitionDimensions(dimensions, duration) {
|
|
8074
|
+
this.c.transitionDimensions(dimensions, duration);
|
|
8075
|
+
}
|
|
8076
|
+
getDimensions() {
|
|
8077
|
+
return this.c.getDimensions();
|
|
8078
|
+
}
|
|
8079
|
+
updateOption(name, value) {
|
|
8080
|
+
this.c.updateLayoutOption(name, value);
|
|
8081
|
+
}
|
|
8082
|
+
};
|
|
8026
8083
|
var DEFAULTS = {
|
|
8027
8084
|
charge: -0.01,
|
|
8028
8085
|
gravity: 0.1,
|
|
@@ -8699,6 +8756,36 @@ var WebGPULayoutControllerAdapter = class {
|
|
|
8699
8756
|
this.c.updateLayoutOption(name, value);
|
|
8700
8757
|
}
|
|
8701
8758
|
};
|
|
8759
|
+
function createForceLayout(options) {
|
|
8760
|
+
const { backend = "auto", renderer, config, graph, autoStart = true } = options;
|
|
8761
|
+
let chosen;
|
|
8762
|
+
if (backend === "webgpu") {
|
|
8763
|
+
if (isWebGPUAvailable()) {
|
|
8764
|
+
chosen = "webgpu";
|
|
8765
|
+
} else {
|
|
8766
|
+
console.warn('[createForceLayout] backend="webgpu" requested but navigator.gpu is unavailable; falling back to WebGL.');
|
|
8767
|
+
chosen = "webgl";
|
|
8768
|
+
}
|
|
8769
|
+
} else if (backend === "webgl") {
|
|
8770
|
+
chosen = "webgl";
|
|
8771
|
+
} else {
|
|
8772
|
+
chosen = isWebGPUAvailable() ? "webgpu" : "webgl";
|
|
8773
|
+
}
|
|
8774
|
+
const scratch = graph ?? { layoutNodes: [], layoutEdges: [], renderNeedsUpdate: true };
|
|
8775
|
+
if (chosen === "webgpu") {
|
|
8776
|
+
const controller = new WebGPUForceLayoutController(scratch);
|
|
8777
|
+
controller.config(config);
|
|
8778
|
+
const adapter = new WebGPULayoutControllerAdapter(controller);
|
|
8779
|
+
if (autoStart) controller.startLayout();
|
|
8780
|
+
return { controller, adapter, backend: "webgpu" };
|
|
8781
|
+
} else {
|
|
8782
|
+
const controller = new GPUForceLayoutController(scratch, renderer);
|
|
8783
|
+
controller.config(config);
|
|
8784
|
+
const adapter = new GPULayoutControllerAdapter(controller);
|
|
8785
|
+
if (autoStart) controller.startLayout();
|
|
8786
|
+
return { controller, adapter, backend: "webgl" };
|
|
8787
|
+
}
|
|
8788
|
+
}
|
|
8702
8789
|
function mergeSnapshotWithDelta(snapshot, delta) {
|
|
8703
8790
|
const nodeMap = new Map(snapshot.nodes.map((n) => [n.id, { ...n }]));
|
|
8704
8791
|
const edgeMap = new Map(snapshot.edges.map((e) => [e.id, { ...e }]));
|
|
@@ -55986,6 +56073,7 @@ function setLicenseKey(key) {
|
|
|
55986
56073
|
GPUForceLayoutController,
|
|
55987
56074
|
GPUForceLayoutEngine,
|
|
55988
56075
|
GPUGroupRingRenderer,
|
|
56076
|
+
GPULayoutControllerAdapter,
|
|
55989
56077
|
GPULayoutProviderAdapter,
|
|
55990
56078
|
GPUNodeRenderer,
|
|
55991
56079
|
GPUPositionProvider,
|
|
@@ -56079,6 +56167,7 @@ function setLicenseKey(key) {
|
|
|
56079
56167
|
createDefaultItems,
|
|
56080
56168
|
createDefaultRegistry,
|
|
56081
56169
|
createEdgeTextCloud,
|
|
56170
|
+
createForceLayout,
|
|
56082
56171
|
createTextCloud,
|
|
56083
56172
|
cubeLayout,
|
|
56084
56173
|
defaultEdgeStyles,
|