@kortexya/nodus 0.1.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/LICENSE +37 -0
- package/README.md +60 -0
- package/__vite-plugin-wasm-helper-1Aiokjk5.js +24 -0
- package/assets/hypergraphWorker-DV0aFI3L.js +1 -0
- package/assets/layoutWorker-DwDJwbgr.js +285 -0
- package/assets/nodus_wasm-C0vDfO5K.js +1 -0
- package/chunk-DmhlhrBa.js +11 -0
- package/nodus.src.bundle.js +33577 -0
- package/nodus_render_wasm-Bs6hlsx-.js +2617 -0
- package/nodus_wasm-DKYQVSUZ.js +2789 -0
- package/package.json +61 -0
- package/types/Nodus.d.ts +100 -0
- package/types/algorithms/concentric/index.d.ts +29 -0
- package/types/algorithms/concentricFactory.d.ts +43 -0
- package/types/algorithms/force/Alea.d.ts +13 -0
- package/types/algorithms/force/BVH.d.ts +35 -0
- package/types/algorithms/force/LayoutData.d.ts +40 -0
- package/types/algorithms/force/Packing.d.ts +31 -0
- package/types/algorithms/force/Physics.d.ts +61 -0
- package/types/algorithms/force/SEC.d.ts +14 -0
- package/types/algorithms/force/Topology.d.ts +3 -0
- package/types/algorithms/force/index.d.ts +54 -0
- package/types/algorithms/force-gpu/ParticleSystem.d.ts +45 -0
- package/types/algorithms/force-gpu/Settings.d.ts +60 -0
- package/types/algorithms/force-gpu/Simulation.d.ts +7 -0
- package/types/algorithms/force-gpu/getGlContext.d.ts +10 -0
- package/types/algorithms/force-gpu/gpuLayout.d.ts +14 -0
- package/types/algorithms/force-gpu/index.d.ts +2 -0
- package/types/algorithms/force-gpu/kernels/index.d.ts +176 -0
- package/types/algorithms/force-gpu/kernels/utils.d.ts +31 -0
- package/types/algorithms/force-gpu/shaders/aabb.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/bhExpand.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/bhTranslate.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/cellLookup.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/index.d.ts +9 -0
- package/types/algorithms/force-gpu/shaders/integrate.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/morton.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/sortIntervals.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/sortKeys.d.ts +2 -0
- package/types/algorithms/force-gpu/shaders/types.d.ts +10 -0
- package/types/algorithms/force-gpu/webgl/helpers.d.ts +24 -0
- package/types/algorithms/force-gpu/webgl/index.d.ts +4 -0
- package/types/algorithms/force-gpu/webgl/program.d.ts +15 -0
- package/types/algorithms/forceFactory.d.ts +55 -0
- package/types/algorithms/forceLinkFactory.d.ts +40 -0
- package/types/algorithms/grid/index.d.ts +26 -0
- package/types/algorithms/gridFactory.d.ts +30 -0
- package/types/algorithms/hierarchical/index.d.ts +80 -0
- package/types/algorithms/hierarchical/sugiyama.d.ts +144 -0
- package/types/algorithms/hierarchicalFactory.d.ts +49 -0
- package/types/algorithms/index.d.ts +13 -0
- package/types/algorithms/radial/index.d.ts +33 -0
- package/types/algorithms/radialFactory.d.ts +54 -0
- package/types/algorithms/sequential/index.d.ts +37 -0
- package/types/algorithms/sequentialFactory.d.ts +37 -0
- package/types/core/Edge.d.ts +67 -0
- package/types/core/EdgeList.d.ts +86 -0
- package/types/core/Node.d.ts +89 -0
- package/types/core/NodeList.d.ts +105 -0
- package/types/core/Transformation.d.ts +108 -0
- package/types/core/enums.d.ts +16 -0
- package/types/geometry/BoundingBox.d.ts +41 -0
- package/types/geometry/index.d.ts +276 -0
- package/types/geometry/types.d.ts +27 -0
- package/types/hypergraph/Hypergraph.d.ts +74 -0
- package/types/hypergraph/KoenigGraph.d.ts +29 -0
- package/types/hypergraph/Simplifier.d.ts +39 -0
- package/types/hypergraph/Statistics.d.ts +55 -0
- package/types/hypergraph/forbidden/StrangledHyperedge.d.ts +12 -0
- package/types/hypergraph/forbidden/StrangledVertex.d.ts +16 -0
- package/types/hypergraph/forbidden/ThreeAdjacentCluster2.d.ts +10 -0
- package/types/hypergraph/forbidden/TwoAdjacentCluster3.d.ts +14 -0
- package/types/hypergraph/forbidden/index.d.ts +22 -0
- package/types/hypergraph/index.d.ts +21 -0
- package/types/hypergraph/layout/Adam.d.ts +12 -0
- package/types/hypergraph/layout/Energy.d.ts +55 -0
- package/types/hypergraph/layout/LBFGS.d.ts +32 -0
- package/types/hypergraph/layout/Optimizer.d.ts +60 -0
- package/types/hypergraph/layout/Reverser.d.ts +42 -0
- package/types/hypergraph/operations/AtomicOperation.d.ts +54 -0
- package/types/hypergraph/operations/HyperedgeMerger.d.ts +30 -0
- package/types/hypergraph/operations/HyperedgeRemoval.d.ts +27 -0
- package/types/hypergraph/operations/VertexMerger.d.ts +32 -0
- package/types/hypergraph/operations/VertexRemoval.d.ts +30 -0
- package/types/hypergraph/operations/index.d.ts +19 -0
- package/types/hypergraph/osfkb/adapter.d.ts +315 -0
- package/types/hypergraph/render/Interaction.d.ts +40 -0
- package/types/hypergraph/render/PolygonRenderer.d.ts +50 -0
- package/types/hypergraph/render/SVGPolygonRenderer.d.ts +7 -0
- package/types/hypergraph/types.d.ts +170 -0
- package/types/index.d.ts +21 -0
- package/types/internals/Algorithms.d.ts +68 -0
- package/types/internals/AlgorithmsPrimitives.d.ts +18 -0
- package/types/internals/Animations.d.ts +39 -0
- package/types/internals/AttributePathPrimitives.d.ts +2 -0
- package/types/internals/Brand.d.ts +22 -0
- package/types/internals/Camera.d.ts +115 -0
- package/types/internals/CameraInteractions.d.ts +15 -0
- package/types/internals/CameraInteractionsPrimitives.d.ts +18 -0
- package/types/internals/Captor.d.ts +56 -0
- package/types/internals/CaptorPrimitives.d.ts +9 -0
- package/types/internals/ClassModule.d.ts +42 -0
- package/types/internals/ConnectNodes.d.ts +23 -0
- package/types/internals/CurvatureManager.d.ts +14 -0
- package/types/internals/DataModule.d.ts +29 -0
- package/types/internals/Disabled.d.ts +27 -0
- package/types/internals/DomModule.d.ts +87 -0
- package/types/internals/DragModule.d.ts +14 -0
- package/types/internals/ElementSet.d.ts +17 -0
- package/types/internals/EventsModule.d.ts +41 -0
- package/types/internals/FlexArray.d.ts +54 -0
- package/types/internals/Geo.d.ts +127 -0
- package/types/internals/Graph.d.ts +109 -0
- package/types/internals/Graphics.d.ts +112 -0
- package/types/internals/GraphicsEngine.d.ts +96 -0
- package/types/internals/Hover.d.ts +32 -0
- package/types/internals/Hypergraph.d.ts +112 -0
- package/types/internals/IndexList.d.ts +28 -0
- package/types/internals/IndividualAttributes.d.ts +27 -0
- package/types/internals/Interactions.d.ts +45 -0
- package/types/internals/Keyboard.d.ts +25 -0
- package/types/internals/LabelManager.d.ts +56 -0
- package/types/internals/Lasso.d.ts +22 -0
- package/types/internals/Layers.d.ts +79 -0
- package/types/internals/LayersPrimitives.d.ts +5 -0
- package/types/internals/Layouts.d.ts +35 -0
- package/types/internals/LayoutsInternal.d.ts +37 -0
- package/types/internals/LayoutsPrimitives.d.ts +23 -0
- package/types/internals/Legend.d.ts +33 -0
- package/types/internals/LegendPrimitives.d.ts +3 -0
- package/types/internals/Locate.d.ts +43 -0
- package/types/internals/LocatePrimitives.d.ts +20 -0
- package/types/internals/MappingManager.d.ts +27 -0
- package/types/internals/MappingPrimitives.d.ts +29 -0
- package/types/internals/Module.d.ts +23 -0
- package/types/internals/Mouse.d.ts +42 -0
- package/types/internals/NodusModules.d.ts +99 -0
- package/types/internals/PositionModule.d.ts +10 -0
- package/types/internals/PulseModule.d.ts +29 -0
- package/types/internals/Quadtree.d.ts +100 -0
- package/types/internals/RectangleSelect.d.ts +18 -0
- package/types/internals/Resizing.d.ts +48 -0
- package/types/internals/Rewiring.d.ts +64 -0
- package/types/internals/SchemaWatchPrimitives.d.ts +75 -0
- package/types/internals/Selection.d.ts +52 -0
- package/types/internals/SelectionModule.d.ts +27 -0
- package/types/internals/Settings.d.ts +20 -0
- package/types/internals/Snapping.d.ts +54 -0
- package/types/internals/Spatial.d.ts +50 -0
- package/types/internals/SpatialPrimitives.d.ts +75 -0
- package/types/internals/Storage.d.ts +46 -0
- package/types/internals/StyleRulesModule.d.ts +21 -0
- package/types/internals/Synchronizer.d.ts +17 -0
- package/types/internals/Tooltip.d.ts +25 -0
- package/types/internals/TooltipPrimitives.d.ts +21 -0
- package/types/internals/Topology.d.ts +50 -0
- package/types/internals/Touch.d.ts +16 -0
- package/types/internals/Transformations.d.ts +36 -0
- package/types/internals/VirtualMouse.d.ts +52 -0
- package/types/internals/WasmHGrid.d.ts +25 -0
- package/types/internals/WatcherModule.d.ts +25 -0
- package/types/internals/Workers.d.ts +79 -0
- package/types/internals/algorithmExports.d.ts +333 -0
- package/types/internals/algorithmHelpers.d.ts +36 -0
- package/types/internals/attributes/AttributesManager.d.ts +216 -0
- package/types/internals/attributes/ElementAttributesManager.d.ts +119 -0
- package/types/internals/attributes/attributeHelpers.d.ts +70 -0
- package/types/internals/attributes/flexArrayFactories.d.ts +277 -0
- package/types/internals/easing.d.ts +15 -0
- package/types/internals/helpers.d.ts +79 -0
- package/types/internals/hypergraphWorker.d.ts +37 -0
- package/types/internals/hypergraphWorkerHost.d.ts +40 -0
- package/types/internals/labels/SpatialGrid.d.ts +29 -0
- package/types/internals/labels/fillEdgeTexts.d.ts +25 -0
- package/types/internals/labels/fillNodeTexts.d.ts +24 -0
- package/types/internals/labels/helpers.d.ts +180 -0
- package/types/internals/layoutWorker.d.ts +21 -0
- package/types/internals/rendering/BoundariesManager.d.ts +53 -0
- package/types/internals/rendering/Buffer2.d.ts +91 -0
- package/types/internals/rendering/BufferList.d.ts +86 -0
- package/types/internals/rendering/CpuRenderer.d.ts +128 -0
- package/types/internals/rendering/EasingManager.d.ts +40 -0
- package/types/internals/rendering/EdgeDrawer.d.ts +54 -0
- package/types/internals/rendering/ElementGroup.d.ts +66 -0
- package/types/internals/rendering/MemoryManager.d.ts +71 -0
- package/types/internals/rendering/NodeDrawer.d.ts +49 -0
- package/types/internals/rendering/PatternManager.d.ts +29 -0
- package/types/internals/rendering/RENDER_MAPPING.d.ts +5 -0
- package/types/internals/rendering/RendererBase.d.ts +127 -0
- package/types/internals/rendering/ShapeManager.d.ts +46 -0
- package/types/internals/rendering/TextManager.d.ts +112 -0
- package/types/internals/rendering/canvasHelpers.d.ts +5 -0
- package/types/internals/rendering/constants.d.ts +125 -0
- package/types/internals/rendering/curveHelpers.d.ts +96 -0
- package/types/internals/rendering/drawerHelpers.d.ts +32 -0
- package/types/internals/rendering/float16.d.ts +25 -0
- package/types/internals/rendering/hitDetection.d.ts +89 -0
- package/types/internals/rendering/loadGraph.d.ts +103 -0
- package/types/internals/rendering/objectInfo.d.ts +46 -0
- package/types/internals/rendering/packing.d.ts +46 -0
- package/types/internals/rendering/shapeHelpers.d.ts +26 -0
- package/types/internals/rendering/types.d.ts +143 -0
- package/types/internals/renderingBinaryPrimitives.d.ts +110 -0
- package/types/internals/utilsExports.d.ts +408 -0
- package/types/internals/wasmBackend.d.ts +38 -0
- package/types/internals/wasmColumns.d.ts +61 -0
- package/types/internals/wasmInit.d.ts +1 -0
- package/types/modules/APIModule.d.ts +8 -0
- package/types/modules/AlgorithmsAPI.d.ts +15 -0
- package/types/modules/BrandAPI.d.ts +6 -0
- package/types/modules/CaptorAPI.d.ts +9 -0
- package/types/modules/ClassesAPI.d.ts +9 -0
- package/types/modules/DebugAPI.d.ts +18 -0
- package/types/modules/DisabledAPI.d.ts +11 -0
- package/types/modules/DomAPI.d.ts +9 -0
- package/types/modules/EventsAPI.d.ts +16 -0
- package/types/modules/ExportAPI.d.ts +23 -0
- package/types/modules/GeneratorsAPI.d.ts +12 -0
- package/types/modules/GeoAPI.d.ts +20 -0
- package/types/modules/GraphAPI.d.ts +26 -0
- package/types/modules/GraphicsAPI.d.ts +8 -0
- package/types/modules/HypergraphAPI.d.ts +71 -0
- package/types/modules/KeyboardAPI.d.ts +6 -0
- package/types/modules/LayersAPI.d.ts +7 -0
- package/types/modules/LayoutsAPI.d.ts +25 -0
- package/types/modules/LegendAPI.d.ts +9 -0
- package/types/modules/MouseAPI.d.ts +16 -0
- package/types/modules/ParseAPI.d.ts +83 -0
- package/types/modules/RulesAPI.d.ts +7 -0
- package/types/modules/SchemaAPI.d.ts +9 -0
- package/types/modules/SelectionAPI.d.ts +12 -0
- package/types/modules/SettingsAPI.d.ts +9 -0
- package/types/modules/StylesAPI.d.ts +64 -0
- package/types/modules/ToolsAPI.d.ts +68 -0
- package/types/modules/TransformationsAPI.d.ts +30 -0
- package/types/modules/ViewAPI.d.ts +52 -0
- package/types/publicTypes.d.ts +56 -0
- package/types/renderers/CanvasRenderer.d.ts +86 -0
- package/types/renderers/Renderer.d.ts +13 -0
- package/types/renderers/SVGRenderer.d.ts +57 -0
- package/types/renderers/WasmGraphRenderer.d.ts +118 -0
- package/types/renderers/WasmRendererAdapter.d.ts +38 -0
- package/types/tools/ConnectNodesAPI.d.ts +42 -0
- package/types/tools/LassoAPI.d.ts +78 -0
- package/types/tools/RectangleSelectAPI.d.ts +51 -0
- package/types/tools/ResizingAPI.d.ts +62 -0
- package/types/tools/RewiringAPI.d.ts +78 -0
- package/types/tools/SnappingAPI.d.ts +71 -0
- package/types/tools/ToolsAPI.d.ts +46 -0
- package/types/tools/TooltipAPI.d.ts +141 -0
- package/types/transformations/TransformationsEngine.d.ts +602 -0
- package/types/utils/index.d.ts +6 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory functions that create the typed FlexArray collections for edge and
|
|
3
|
+
* node visual attributes.
|
|
4
|
+
*
|
|
5
|
+
* Each function returns a nested object whose leaves are graph `Attribute`
|
|
6
|
+
* instances (FlexArrays). The structure mirrors the attribute path hierarchy
|
|
7
|
+
* (e.g. `stroke.color`, `badges.topLeft.text.content`).
|
|
8
|
+
*/
|
|
9
|
+
import type { Graph } from '../Graph';
|
|
10
|
+
/**
|
|
11
|
+
* A `FlexArray` (or `Attribute`) is the graph engine's typed sparse array.
|
|
12
|
+
* The exact implementation lives in Graph / FlexArray modules — here we only
|
|
13
|
+
* use the factory method `graph.createAttribute(isNode, params, original)`.
|
|
14
|
+
*/
|
|
15
|
+
type Attribute = any;
|
|
16
|
+
interface FlexArrayOptions {
|
|
17
|
+
/** Whether to create the attribute as an original (source-of-truth) copy */
|
|
18
|
+
original: boolean;
|
|
19
|
+
/** Whether to populate with default values (true on first creation) */
|
|
20
|
+
useDefaultValues: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** The shape of the object returned by `createEdgeFlexArrays`. */
|
|
23
|
+
export interface EdgeFlexArrays {
|
|
24
|
+
width: Attribute;
|
|
25
|
+
scalingMethod: Attribute;
|
|
26
|
+
color: Attribute;
|
|
27
|
+
opacity: Attribute;
|
|
28
|
+
minVisibleSize: Attribute;
|
|
29
|
+
layer: Attribute;
|
|
30
|
+
detectable: Attribute;
|
|
31
|
+
curvature: Attribute;
|
|
32
|
+
adjustAnchors: Attribute;
|
|
33
|
+
shape: {
|
|
34
|
+
body: Attribute;
|
|
35
|
+
head: Attribute;
|
|
36
|
+
tail: Attribute;
|
|
37
|
+
style: Attribute;
|
|
38
|
+
};
|
|
39
|
+
stroke: {
|
|
40
|
+
color: Attribute;
|
|
41
|
+
width: Attribute;
|
|
42
|
+
scalingMethod: Attribute;
|
|
43
|
+
minVisibleSize: Attribute;
|
|
44
|
+
};
|
|
45
|
+
halo: {
|
|
46
|
+
color: Attribute;
|
|
47
|
+
width: Attribute;
|
|
48
|
+
scalingMethod: Attribute;
|
|
49
|
+
};
|
|
50
|
+
badge: EdgeBadgeFlexArrays;
|
|
51
|
+
pulse: PulseFlexArrays;
|
|
52
|
+
outline: OutlineFlexArrays;
|
|
53
|
+
text: EdgeTextFlexArrays;
|
|
54
|
+
}
|
|
55
|
+
interface EdgeBadgeFlexArrays {
|
|
56
|
+
color: Attribute;
|
|
57
|
+
size: Attribute;
|
|
58
|
+
position: Attribute;
|
|
59
|
+
marginBottom: Attribute;
|
|
60
|
+
marginToText: Attribute;
|
|
61
|
+
minVisibleSize: Attribute;
|
|
62
|
+
scalingMethod: Attribute;
|
|
63
|
+
image: {
|
|
64
|
+
url: Attribute;
|
|
65
|
+
scale: Attribute;
|
|
66
|
+
};
|
|
67
|
+
stroke: {
|
|
68
|
+
color: Attribute;
|
|
69
|
+
width: Attribute;
|
|
70
|
+
scalingMethod: Attribute;
|
|
71
|
+
};
|
|
72
|
+
text: {
|
|
73
|
+
content: Attribute;
|
|
74
|
+
color: Attribute;
|
|
75
|
+
font: Attribute;
|
|
76
|
+
style: Attribute;
|
|
77
|
+
scale: Attribute;
|
|
78
|
+
paddingLeft: Attribute;
|
|
79
|
+
paddingTop: Attribute;
|
|
80
|
+
};
|
|
81
|
+
rotateWithEdge: Attribute;
|
|
82
|
+
}
|
|
83
|
+
interface PulseFlexArrays {
|
|
84
|
+
enabled: Attribute;
|
|
85
|
+
duration: Attribute;
|
|
86
|
+
interval: Attribute;
|
|
87
|
+
startColor: Attribute;
|
|
88
|
+
endColor: Attribute;
|
|
89
|
+
width: Attribute;
|
|
90
|
+
startRatio: Attribute;
|
|
91
|
+
endRatio: Attribute;
|
|
92
|
+
}
|
|
93
|
+
interface OutlineFlexArrays {
|
|
94
|
+
enabled: Attribute;
|
|
95
|
+
color: Attribute;
|
|
96
|
+
minVisibleSize: Attribute;
|
|
97
|
+
}
|
|
98
|
+
interface EdgeTextFlexArrays {
|
|
99
|
+
content: Attribute;
|
|
100
|
+
font: Attribute;
|
|
101
|
+
color: Attribute;
|
|
102
|
+
size: Attribute;
|
|
103
|
+
scale: Attribute;
|
|
104
|
+
style: Attribute;
|
|
105
|
+
align: Attribute;
|
|
106
|
+
margin: Attribute;
|
|
107
|
+
padding: Attribute;
|
|
108
|
+
position: Attribute;
|
|
109
|
+
backgroundColor: Attribute;
|
|
110
|
+
minVisibleSize: Attribute;
|
|
111
|
+
adjustAngle: Attribute;
|
|
112
|
+
scaling: Attribute;
|
|
113
|
+
maxLineLength: Attribute;
|
|
114
|
+
outline: {
|
|
115
|
+
color: Attribute;
|
|
116
|
+
width: Attribute;
|
|
117
|
+
};
|
|
118
|
+
secondary: EdgeSecondaryTextFlexArrays;
|
|
119
|
+
}
|
|
120
|
+
interface EdgeSecondaryTextFlexArrays {
|
|
121
|
+
content: Attribute;
|
|
122
|
+
font: Attribute;
|
|
123
|
+
color: Attribute;
|
|
124
|
+
size: Attribute;
|
|
125
|
+
scale: Attribute;
|
|
126
|
+
style: Attribute;
|
|
127
|
+
align: Attribute;
|
|
128
|
+
margin: Attribute;
|
|
129
|
+
padding: Attribute;
|
|
130
|
+
backgroundColor: Attribute;
|
|
131
|
+
minVisibleSize: Attribute;
|
|
132
|
+
outline: {
|
|
133
|
+
color: Attribute;
|
|
134
|
+
width: Attribute;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** The shape of the object returned by `createNodeFlexArrays`. */
|
|
138
|
+
export interface NodeFlexArrays {
|
|
139
|
+
x: Attribute;
|
|
140
|
+
y: Attribute;
|
|
141
|
+
radius: Attribute;
|
|
142
|
+
scalingMethod: Attribute;
|
|
143
|
+
color: Attribute;
|
|
144
|
+
opacity: Attribute;
|
|
145
|
+
shape: Attribute;
|
|
146
|
+
layer: Attribute;
|
|
147
|
+
detectable: Attribute;
|
|
148
|
+
draggable: Attribute;
|
|
149
|
+
layoutable: Attribute;
|
|
150
|
+
innerStroke: {
|
|
151
|
+
width: Attribute;
|
|
152
|
+
scalingMethod: Attribute;
|
|
153
|
+
color: Attribute;
|
|
154
|
+
minVisibleSize: Attribute;
|
|
155
|
+
};
|
|
156
|
+
outerStroke: {
|
|
157
|
+
width: Attribute;
|
|
158
|
+
scalingMethod: Attribute;
|
|
159
|
+
color: Attribute;
|
|
160
|
+
minVisibleSize: Attribute;
|
|
161
|
+
};
|
|
162
|
+
badges: {
|
|
163
|
+
topLeft: NodeBadgeFlexArrays;
|
|
164
|
+
topRight: NodeBadgeFlexArrays;
|
|
165
|
+
bottomLeft: NodeBadgeFlexArrays;
|
|
166
|
+
bottomRight: NodeBadgeFlexArrays;
|
|
167
|
+
};
|
|
168
|
+
halo: {
|
|
169
|
+
color: Attribute;
|
|
170
|
+
width: Attribute;
|
|
171
|
+
scalingMethod: Attribute;
|
|
172
|
+
strokeColor: Attribute;
|
|
173
|
+
strokeWidth: Attribute;
|
|
174
|
+
clustering: Attribute;
|
|
175
|
+
hideNonAdjacentEdges: Attribute;
|
|
176
|
+
};
|
|
177
|
+
pulse: PulseFlexArrays;
|
|
178
|
+
icon: {
|
|
179
|
+
content: Attribute;
|
|
180
|
+
font: Attribute;
|
|
181
|
+
color: Attribute;
|
|
182
|
+
scale: Attribute;
|
|
183
|
+
style: Attribute;
|
|
184
|
+
minVisibleSize: Attribute;
|
|
185
|
+
};
|
|
186
|
+
image: {
|
|
187
|
+
url: Attribute;
|
|
188
|
+
scale: Attribute;
|
|
189
|
+
fit: Attribute;
|
|
190
|
+
tile: Attribute;
|
|
191
|
+
minVisibleSize: Attribute;
|
|
192
|
+
};
|
|
193
|
+
outline: OutlineFlexArrays;
|
|
194
|
+
text: NodeTextFlexArrays;
|
|
195
|
+
}
|
|
196
|
+
interface NodeBadgeFlexArrays {
|
|
197
|
+
color: Attribute;
|
|
198
|
+
scale: Attribute;
|
|
199
|
+
positionScale: Attribute;
|
|
200
|
+
minVisibleSize: Attribute;
|
|
201
|
+
scalingMethod: Attribute;
|
|
202
|
+
image: {
|
|
203
|
+
url: Attribute;
|
|
204
|
+
scale: Attribute;
|
|
205
|
+
};
|
|
206
|
+
stroke: {
|
|
207
|
+
color: Attribute;
|
|
208
|
+
width: Attribute;
|
|
209
|
+
scalingMethod: Attribute;
|
|
210
|
+
};
|
|
211
|
+
text: {
|
|
212
|
+
content: Attribute;
|
|
213
|
+
color: Attribute;
|
|
214
|
+
font: Attribute;
|
|
215
|
+
style: Attribute;
|
|
216
|
+
scale: Attribute;
|
|
217
|
+
paddingLeft: Attribute;
|
|
218
|
+
paddingTop: Attribute;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
interface NodeTextFlexArrays {
|
|
222
|
+
content: Attribute;
|
|
223
|
+
font: Attribute;
|
|
224
|
+
color: Attribute;
|
|
225
|
+
size: Attribute;
|
|
226
|
+
scale: Attribute;
|
|
227
|
+
style: Attribute;
|
|
228
|
+
align: Attribute;
|
|
229
|
+
margin: Attribute;
|
|
230
|
+
padding: Attribute;
|
|
231
|
+
backgroundColor: Attribute;
|
|
232
|
+
tip: Attribute;
|
|
233
|
+
minVisibleSize: Attribute;
|
|
234
|
+
scaling: Attribute;
|
|
235
|
+
position: Attribute;
|
|
236
|
+
maxLineLength: Attribute;
|
|
237
|
+
truncateLength: Attribute;
|
|
238
|
+
outline: {
|
|
239
|
+
color: Attribute;
|
|
240
|
+
width: Attribute;
|
|
241
|
+
};
|
|
242
|
+
secondary: NodeSecondaryTextFlexArrays;
|
|
243
|
+
}
|
|
244
|
+
interface NodeSecondaryTextFlexArrays {
|
|
245
|
+
content: Attribute;
|
|
246
|
+
font: Attribute;
|
|
247
|
+
color: Attribute;
|
|
248
|
+
size: Attribute;
|
|
249
|
+
scale: Attribute;
|
|
250
|
+
style: Attribute;
|
|
251
|
+
align: Attribute;
|
|
252
|
+
margin: Attribute;
|
|
253
|
+
padding: Attribute;
|
|
254
|
+
backgroundColor: Attribute;
|
|
255
|
+
minVisibleSize: Attribute;
|
|
256
|
+
outline: {
|
|
257
|
+
color: Attribute;
|
|
258
|
+
width: Attribute;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Creates the full set of typed FlexArray attributes for **edges**.
|
|
263
|
+
*
|
|
264
|
+
* @param graph - The internal graph instance (provides `createAttribute`).
|
|
265
|
+
* @param opts - Whether to create original attributes and whether to set
|
|
266
|
+
* default values.
|
|
267
|
+
*/
|
|
268
|
+
export declare function createEdgeFlexArrays(graph: Graph, { original, useDefaultValues }: FlexArrayOptions): EdgeFlexArrays;
|
|
269
|
+
/**
|
|
270
|
+
* Creates the full set of typed FlexArray attributes for **nodes**.
|
|
271
|
+
*
|
|
272
|
+
* @param graph - The internal graph instance (provides `createAttribute`).
|
|
273
|
+
* @param opts - Whether to create original attributes and whether to set
|
|
274
|
+
* default values.
|
|
275
|
+
*/
|
|
276
|
+
export declare function createNodeFlexArrays(graph: Graph, { original, useDefaultValues }: FlexArrayOptions): NodeFlexArrays;
|
|
277
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard easing functions for animation timing.
|
|
3
|
+
*
|
|
4
|
+
* Each function maps a normalized time value `t` in the range [0, 1] to an
|
|
5
|
+
* eased progress value, providing linear, quadratic, and cubic curves with
|
|
6
|
+
* in/out/in-out variants.
|
|
7
|
+
*/
|
|
8
|
+
export declare const linear: (t: number) => number;
|
|
9
|
+
export declare const quadraticIn: (t: number) => number;
|
|
10
|
+
export declare const quadraticOut: (t: number) => number;
|
|
11
|
+
export declare const quadraticInOut: (t: number) => number;
|
|
12
|
+
export declare const cubicIn: (t: number) => number;
|
|
13
|
+
export declare const cubicOut: (t: number) => number;
|
|
14
|
+
export declare const cubicInOut: (t: number) => number;
|
|
15
|
+
export declare const easingFunctions: Record<string, (t: number) => number>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared internal helper functions used across multiple Nodus modules.
|
|
3
|
+
* These are standalone utility functions with no cross-module dependencies.
|
|
4
|
+
*/
|
|
5
|
+
/** Flatten a nested object to dot-separated keys. */
|
|
6
|
+
export declare function flatten(obj: any, leafTest?: (v: any) => boolean, sep?: string): Record<string, any>;
|
|
7
|
+
/** Unflatten a dot-keyed object back to nested object. */
|
|
8
|
+
export declare function unflatten(obj: Record<string, any>): any;
|
|
9
|
+
/** Set a nested property by dot-path string or array of keys. */
|
|
10
|
+
export declare function setProperty(obj: any, path: string | string[] | null, value: any): void;
|
|
11
|
+
/** Get a nested property by dot-path. */
|
|
12
|
+
export declare function getProperty(obj: any, path: string | string[]): any;
|
|
13
|
+
/** Convert a property path specification to array of keys or null. */
|
|
14
|
+
export declare function toPropertyPath2(path: any): string[] | null;
|
|
15
|
+
/** Get or create a property change entry in the changes array. */
|
|
16
|
+
export declare function findPropertyChange(changes: any[], path: string[] | null): any;
|
|
17
|
+
/** Flatten array (one level). */
|
|
18
|
+
export declare function flattenArray<T>(arr: (T | T[])[]): T[];
|
|
19
|
+
export declare function requestAnimFrame(cb: FrameRequestCallback, ctx?: any): number;
|
|
20
|
+
export declare function cancelAnimFrame(id: number): void;
|
|
21
|
+
export declare function getCurrentTime(): number;
|
|
22
|
+
export declare const isWindowAvailable: boolean;
|
|
23
|
+
export declare const isDocumentAvailable: boolean;
|
|
24
|
+
export declare const isRealBrowser: boolean;
|
|
25
|
+
export declare const isRealBrowserMainThread: boolean;
|
|
26
|
+
export declare function getPixelRatio(): number;
|
|
27
|
+
export declare function resizeElement(el: HTMLElement | HTMLCanvasElement, w: number, h: number, ratio?: number): void;
|
|
28
|
+
export declare function getStyle(el: HTMLElement, prop: string): string | null;
|
|
29
|
+
export declare function requestFullScreen(el: HTMLElement): Promise<void>;
|
|
30
|
+
export declare function cancelFullScreen(): Promise<void>;
|
|
31
|
+
export declare function isFullScreenFn(): boolean;
|
|
32
|
+
/** Cross-browser ResizeObserver. */
|
|
33
|
+
export declare function getResizeObserver(cb: (entries?: any) => void): ResizeObserver;
|
|
34
|
+
export declare function forEach(obj: any, fn: (value: any, key: any) => void, ctx?: any): void;
|
|
35
|
+
/** Math helpers for Camera. */
|
|
36
|
+
export declare function irrelevant(v: number): boolean;
|
|
37
|
+
export declare function screenToGraphOffset(pt: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}, zoom: number, sinAngle: number, cosAngle: number): {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
export declare function rotatePoint(px: number, py: number, cx: number, cy: number, angle: number, out?: {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}): {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
/** Zoom transition that follows a smooth interpolated path between two view states. */
|
|
52
|
+
export declare function zoomInterpolate(p0: [number, number, number], p1: [number, number, number]): (t: number) => [number, number, number];
|
|
53
|
+
export declare const IS_POINTER: boolean;
|
|
54
|
+
export declare const BUTTON_MAPPING: Record<number, 'left' | 'middle' | 'right'>;
|
|
55
|
+
export declare const DRAG_TOLERANCE = 6;
|
|
56
|
+
export declare const TOUCH_CONSTANTS: {
|
|
57
|
+
readonly doubleTapTimer: 500;
|
|
58
|
+
readonly touchEventRate: 15;
|
|
59
|
+
};
|
|
60
|
+
export declare function addPointerStart(addEvent: any, el: any, handler: (evt: any) => void): any;
|
|
61
|
+
export declare function addPointerMove(addWinEvent: any, el: any, handler: (evt: any) => void): any;
|
|
62
|
+
export declare function addPointerEnd(addWinEvent: any, el: any, handler: (evt: any) => void): any;
|
|
63
|
+
export declare function addPointerCancel(addWinEvent: any, el: any, handler: (evt: any) => void): any;
|
|
64
|
+
export declare function removePointerListener(removeWinEvent: any, el: any, type: string, handler: any): void;
|
|
65
|
+
export declare function getDocument(): Document | {
|
|
66
|
+
createElementNS: () => null;
|
|
67
|
+
createElement: () => null;
|
|
68
|
+
implementation: {
|
|
69
|
+
createDocument: () => never;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export declare function getWheelDelta(event: any): number;
|
|
73
|
+
export declare function initPointerEvents(): void;
|
|
74
|
+
export declare function clearPointerEvents(): void;
|
|
75
|
+
export declare function noop(): void;
|
|
76
|
+
export declare const DOM_LAYERS: readonly ["graphics", "legend", "brand"];
|
|
77
|
+
export declare const DEFAULT_MIN_WIDTH = 300;
|
|
78
|
+
export declare const DEFAULT_MIN_HEIGHT = 300;
|
|
79
|
+
export declare const FULLSCREEN_DELAY = 200;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hypergraph layout worker entry.
|
|
3
|
+
*
|
|
4
|
+
* The L-BFGS optimization (paper §5.3) is a self-contained run-to-
|
|
5
|
+
* completion computation rather than the per-tick iteration the existing
|
|
6
|
+
* layoutWorker drives, so we use a different protocol: one `run`
|
|
7
|
+
* message in, periodic `progress` messages out, one `done` message at
|
|
8
|
+
* the end. The host (`internals/Hypergraph.ts`) is responsible for
|
|
9
|
+
* re-applying the worker's final state to the main-thread hypergraph
|
|
10
|
+
* and refreshing the polygon layer.
|
|
11
|
+
*
|
|
12
|
+
* Protocol (postMessage shapes)
|
|
13
|
+
*
|
|
14
|
+
* Main → Worker:
|
|
15
|
+
* { type: 'run', id,
|
|
16
|
+
* hypergraph: HypergraphData, // current scale (H_n if simplified)
|
|
17
|
+
* operations: AtomicOperationRecord[], // reversal stack
|
|
18
|
+
* originalCardinality: [id, number][], // serialized Map<HypergraphId, number>
|
|
19
|
+
* initialPositions: [id, {x,y}][], // optional warm-start primal
|
|
20
|
+
* initialDualPositions: [id, {x,y}][], // optional warm-start dual
|
|
21
|
+
* options: LayoutOptions }
|
|
22
|
+
* { type: 'cancel', id }
|
|
23
|
+
*
|
|
24
|
+
* Worker → Main:
|
|
25
|
+
* { type: 'progress', id, info: LayoutProgress }
|
|
26
|
+
* { type: 'done', id,
|
|
27
|
+
* finalHypergraph: HypergraphData, // post-reversal (= H_0 if started at H_n)
|
|
28
|
+
* vertexPositions: [id, {x,y}][],
|
|
29
|
+
* dualPositions: [id, {x,y}][],
|
|
30
|
+
* energy: number }
|
|
31
|
+
* { type: 'error', id, error: string }
|
|
32
|
+
*
|
|
33
|
+
* The worker re-imports the same algorithm core that runs on the main
|
|
34
|
+
* thread — `Hypergraph`, `optimize`, `reverse` — so there is exactly
|
|
35
|
+
* one implementation to test.
|
|
36
|
+
*/
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main-thread host for the hypergraph layout worker.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the message-based RPC into a single async function `runLayoutJob`
|
|
5
|
+
* with the same signature as calling `optimize()` + `reverse()` inline.
|
|
6
|
+
* Falls back to inline execution when Web Workers aren't available
|
|
7
|
+
* (SSR, jsdom test envs, browsers with workers disabled).
|
|
8
|
+
*/
|
|
9
|
+
import type { AtomicOperationRecord, HypergraphData, HypergraphId, LayoutOptions, Vec2 } from '../hypergraph/types';
|
|
10
|
+
export interface LayoutJobInput {
|
|
11
|
+
/** Current hypergraph state (typically H_n if simplified). */
|
|
12
|
+
hypergraph: HypergraphData;
|
|
13
|
+
/** Reversal stack from a prior simplification, or empty. */
|
|
14
|
+
operations: AtomicOperationRecord[];
|
|
15
|
+
/** H_0 cardinalities for paper §5.3 polygon sizing. */
|
|
16
|
+
originalCardinality: Map<HypergraphId, number>;
|
|
17
|
+
/** Optional warm-start positions. */
|
|
18
|
+
initialPositions?: Map<HypergraphId, Vec2>;
|
|
19
|
+
initialDualPositions?: Map<HypergraphId, Vec2>;
|
|
20
|
+
options: LayoutOptions;
|
|
21
|
+
/** Throttle the worker → main progress stream. Default 25 iters. */
|
|
22
|
+
progressEvery?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface LayoutJobResult {
|
|
25
|
+
/** Hypergraph state after optimization + reversal (H_0 in the typical pipeline). */
|
|
26
|
+
finalHypergraph: HypergraphData;
|
|
27
|
+
vertexPositions: Map<HypergraphId, Vec2>;
|
|
28
|
+
dualPositions: Map<HypergraphId, Vec2>;
|
|
29
|
+
energy: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Run optimize + (optional) reverse in a worker. The host main thread
|
|
33
|
+
* stays interactive while L-BFGS chews through iterations; progress
|
|
34
|
+
* events fire via `input.options.onProgress` as they normally would.
|
|
35
|
+
*
|
|
36
|
+
* @param useWorker false to force the inline (sync) path even when a
|
|
37
|
+
* worker is available. Useful for tests or for users
|
|
38
|
+
* who want strictly serialized execution.
|
|
39
|
+
*/
|
|
40
|
+
export declare function runLayoutJob(input: LayoutJobInput, useWorker?: boolean): Promise<LayoutJobResult>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpatialGrid: 2D spatial hash grid for fast overlap detection of label bounding boxes.
|
|
3
|
+
* Uses a cell-based grid to provide O(1) insertion and query for nearby elements,
|
|
4
|
+
* avoiding O(n²) pairwise collision checks.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SpatialGrid {
|
|
7
|
+
private grid;
|
|
8
|
+
private bounds;
|
|
9
|
+
private cellSize;
|
|
10
|
+
constructor(bounds: number[], cellSize?: number);
|
|
11
|
+
/**
|
|
12
|
+
* Returns all cell keys that a rectangle (centered at x,y with size w×h) overlaps.
|
|
13
|
+
*/
|
|
14
|
+
private getCellsForRect;
|
|
15
|
+
/**
|
|
16
|
+
* Insert an element id into all grid cells that its bounding box overlaps.
|
|
17
|
+
* @param id - Element identifier (index into the rects array)
|
|
18
|
+
* @param x - Center X of the bounding box
|
|
19
|
+
* @param y - Center Y of the bounding box
|
|
20
|
+
* @param w - Width of the bounding box
|
|
21
|
+
* @param h - Height of the bounding box
|
|
22
|
+
*/
|
|
23
|
+
insert(id: number, x: number, y: number, w: number, h: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Query all element ids whose bounding boxes potentially overlap a given rectangle.
|
|
26
|
+
*/
|
|
27
|
+
getNearbyElements(x: number, y: number, w: number, h: number): Set<number>;
|
|
28
|
+
clear(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fillEdgeTexts: determines which edge labels to show and their positions.
|
|
3
|
+
*
|
|
4
|
+
* Iterates through edge indices in layer order (highest layer first),
|
|
5
|
+
* computes label geometry for each edge, checks for collisions using the
|
|
6
|
+
* SpatialGrid, and populates the output structure with bounding boxes
|
|
7
|
+
* and oriented rects for visible labels.
|
|
8
|
+
*/
|
|
9
|
+
import { SpatialGrid } from './SpatialGrid';
|
|
10
|
+
import { type EdgeAttributes, type NodeAttributes, type FrameData, type LabelOutput, type MeasureTextFn } from './helpers';
|
|
11
|
+
/**
|
|
12
|
+
* Fill edge text labels into the output structure.
|
|
13
|
+
*
|
|
14
|
+
* @param indices - Array of edge indices to process
|
|
15
|
+
* @param frame - Current frame/camera data (angle, zoom, etc.)
|
|
16
|
+
* @param edgeAttrs - Edge attribute flex arrays
|
|
17
|
+
* @param nodeAttrs - Node attribute flex arrays (needed for source/target positions)
|
|
18
|
+
* @param measureText - Function to measure text dimensions
|
|
19
|
+
* @param output - Output structure to populate with label bboxes and rects
|
|
20
|
+
* @param hoveredEdge - Index of currently hovered edge (or null)
|
|
21
|
+
* @param geoEnabled - Whether geographic mode is enabled
|
|
22
|
+
* @param grid - SpatialGrid for overlap detection
|
|
23
|
+
* @returns The populated output structure
|
|
24
|
+
*/
|
|
25
|
+
export declare function fillEdgeTexts(indices: number[], frame: FrameData, edgeAttrs: EdgeAttributes, nodeAttrs: NodeAttributes, measureText: MeasureTextFn, output: LabelOutput, hoveredEdge: number | null, geoEnabled: boolean, grid: SpatialGrid): LabelOutput;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fillNodeTexts: determines which node labels to show and their positions.
|
|
3
|
+
*
|
|
4
|
+
* Iterates through node indices in layer order (highest layer first),
|
|
5
|
+
* computes label geometry for each node, checks for collisions using the
|
|
6
|
+
* SpatialGrid, and populates the output structure with bounding boxes
|
|
7
|
+
* and oriented rects for visible labels.
|
|
8
|
+
*/
|
|
9
|
+
import { SpatialGrid } from './SpatialGrid';
|
|
10
|
+
import { type NodeAttributes, type FrameData, type LabelOutput } from './helpers';
|
|
11
|
+
/**
|
|
12
|
+
* Fill node text labels into the output structure.
|
|
13
|
+
*
|
|
14
|
+
* @param indices - Array of node indices to process
|
|
15
|
+
* @param frame - Current frame/camera data (angle, zoom, sin, cos)
|
|
16
|
+
* @param nodeAttrs - Node attribute flex arrays
|
|
17
|
+
* @param getDisplacement - Function returning the 10-element displacement tuple for a node index
|
|
18
|
+
* @param output - Output structure to populate with label bboxes and rects
|
|
19
|
+
* @param hoveredNode - Index of currently hovered node (or null)
|
|
20
|
+
* @param grid - SpatialGrid for overlap detection
|
|
21
|
+
* @param preventOverlap - Whether to perform overlap avoidance
|
|
22
|
+
* @returns The populated output structure
|
|
23
|
+
*/
|
|
24
|
+
export declare function fillNodeTexts(indices: number[], frame: FrameData, nodeAttrs: NodeAttributes, getDisplacement: (index: number) => [number, number, number, number, number, number, number, number, number, number], output: LabelOutput, hoveredNode: number | null, grid: SpatialGrid, preventOverlap: boolean): LabelOutput;
|