@fxhash/open-form-graph 0.0.1 → 0.0.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/OpenFormGraph-CdcWNN86.d.ts +24 -0
- package/dist/OpenFormGraph-i8VSTamk.js +2170 -0
- package/dist/OpenFormGraph-i8VSTamk.js.map +1 -0
- package/dist/_types-CjgCTzqc.d.ts +82 -0
- package/dist/components.d.ts +3 -0
- package/dist/components.js +4 -0
- package/dist/constants-BNPHdbBA.d.ts +313 -0
- package/dist/index.d.ts +125 -133
- package/dist/index.js +3 -2098
- package/dist/provider-PqOen2FE.js +106 -0
- package/dist/provider-PqOen2FE.js.map +1 -0
- package/dist/provider.d.ts +3 -0
- package/dist/provider.js +3 -0
- package/package.json +15 -10
- package/dist/index.js.map +0 -1
@@ -0,0 +1,313 @@
|
|
1
|
+
import { ColorTransform, Focus, HighlightStyle, MouseListener, Point, RGB, RawGraphData, RootNodeImageSources, SimNode, ThemeMode, Transform, TransformListener } from "./_types-CjgCTzqc.js";
|
2
|
+
import { Dispatch, MutableRefObject, ReactNode } from "react";
|
3
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
4
|
+
import * as d3_scale2 from "d3-scale";
|
5
|
+
import { EventEmitter } from "@fxhash/utils";
|
6
|
+
|
7
|
+
//#region src/_interfaces.d.ts
|
8
|
+
interface GraphConfig {
|
9
|
+
debug: false;
|
10
|
+
nodeSize: number;
|
11
|
+
minClusterSize: number;
|
12
|
+
maxClusterSize: number;
|
13
|
+
minZoom: number;
|
14
|
+
maxZoom: number;
|
15
|
+
theme: {
|
16
|
+
dark: [number, number, number];
|
17
|
+
light: [number, number, number];
|
18
|
+
};
|
19
|
+
}
|
20
|
+
//#endregion
|
21
|
+
//#region src/util/color.d.ts
|
22
|
+
interface ColorHandler {
|
23
|
+
(arg?: number): string;
|
24
|
+
(arg: ColorTransform): ColorHandler;
|
25
|
+
rgb: RGB;
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Some utility functions to handle colors
|
29
|
+
*/
|
30
|
+
declare function color(rgb: RGB): ColorHandler;
|
31
|
+
/**
|
32
|
+
* Dims a color to white or black
|
33
|
+
* @param color An array of 3 numbers representing RGB values (0-255)
|
34
|
+
* @param dimFactor A value between 0 and 1 where 0 is completely black and 1 is the original color
|
35
|
+
* @returns A new array with the dimmed RGB values
|
36
|
+
*/
|
37
|
+
declare function dim(factor?: number, white?: boolean): ColorTransform;
|
38
|
+
//#endregion
|
39
|
+
//#region src/sim/TransformCanvas.d.ts
|
40
|
+
declare class TransformCanvas {
|
41
|
+
private canvas;
|
42
|
+
private transform;
|
43
|
+
private targetTransform;
|
44
|
+
private isAnimating;
|
45
|
+
private animationFrame;
|
46
|
+
private focus;
|
47
|
+
private offset;
|
48
|
+
private isDragging;
|
49
|
+
private dragStart;
|
50
|
+
private hasMoved;
|
51
|
+
private lastPointerPos;
|
52
|
+
private lastMovePos;
|
53
|
+
private velocity;
|
54
|
+
private lastDragTime;
|
55
|
+
private momentumFrame;
|
56
|
+
private touchStart;
|
57
|
+
private pinchStartDist;
|
58
|
+
private pinchStartScale;
|
59
|
+
private noInteraction;
|
60
|
+
private dpr;
|
61
|
+
private resizeObserver;
|
62
|
+
private mediaQueryList;
|
63
|
+
onUpdate?: TransformListener;
|
64
|
+
onClick?: MouseListener;
|
65
|
+
onMove?: MouseListener;
|
66
|
+
constructor(canvas: HTMLCanvasElement, options?: {
|
67
|
+
onUpdate?: TransformListener;
|
68
|
+
onClick?: MouseListener;
|
69
|
+
onMove?: MouseListener;
|
70
|
+
offset?: Point;
|
71
|
+
});
|
72
|
+
private bindEventHandlers;
|
73
|
+
private attachEventListeners;
|
74
|
+
private setupDPRMonitoring;
|
75
|
+
private updateDPR;
|
76
|
+
toCanvasCoords(clientX: number, clientY: number): Point;
|
77
|
+
private toCSSCoords;
|
78
|
+
private startMomentum;
|
79
|
+
private applyMomentum;
|
80
|
+
private lerp;
|
81
|
+
private animateTransform;
|
82
|
+
private startAnimation;
|
83
|
+
private stopAnimation;
|
84
|
+
private interruptAnimation;
|
85
|
+
private handleWheel;
|
86
|
+
private handleMouseDown;
|
87
|
+
private handleMouseMove;
|
88
|
+
private handleMouseUp;
|
89
|
+
private handleCanvasClick;
|
90
|
+
private handleTouchStart;
|
91
|
+
private handleTouchMove;
|
92
|
+
private handleTouchEnd;
|
93
|
+
resetZoom(): void;
|
94
|
+
transformTo(update: Partial<Transform>): void;
|
95
|
+
getTransformationFromWorld(worldX: number, worldY: number, newScale?: number): {
|
96
|
+
x: number;
|
97
|
+
y: number;
|
98
|
+
scale: number;
|
99
|
+
};
|
100
|
+
transformToWorld(worldX: number, worldY: number, newScale?: number): void;
|
101
|
+
trackCursor(): void;
|
102
|
+
setNoInteraction(noInteraction: boolean): void;
|
103
|
+
focusOn(focus: Focus | null): void;
|
104
|
+
resetFocus(): void;
|
105
|
+
destroy(): void;
|
106
|
+
getTransform(): Readonly<Transform>;
|
107
|
+
getTargetTransform(): Readonly<Transform>;
|
108
|
+
getFocus(): Readonly<Focus | null>;
|
109
|
+
setOffset(offset: Point): void;
|
110
|
+
}
|
111
|
+
//#endregion
|
112
|
+
//#region src/sim/_interfaces.d.ts
|
113
|
+
interface IOpenGraphSimulation {
|
114
|
+
width: number;
|
115
|
+
height: number;
|
116
|
+
config: GraphConfig;
|
117
|
+
rootImageSources: RootNodeImageSources;
|
118
|
+
canvas: HTMLCanvasElement;
|
119
|
+
theme: ThemeMode;
|
120
|
+
emitter: OpenGraphEventEmitter;
|
121
|
+
selectedNode: SimNode | null;
|
122
|
+
hoveredNode: SimNode | null;
|
123
|
+
highlights: HighlightStyle[];
|
124
|
+
transformCanvas: TransformCanvas;
|
125
|
+
initialize(data: RawGraphData, rootId: string): void;
|
126
|
+
restart(): void;
|
127
|
+
resize(width: number, height: number): void;
|
128
|
+
setTheme(theme: ThemeMode): void;
|
129
|
+
setHideThumbnails(hide: boolean): void;
|
130
|
+
setSelectedNode(node: SimNode | null): void;
|
131
|
+
setHighlights(highlights: HighlightStyle[]): void;
|
132
|
+
setNoInteraction(noInteraction: boolean): void;
|
133
|
+
getNodeById(nodeId: string): SimNode | null;
|
134
|
+
getNodeScreenPosition(node: SimNode): {
|
135
|
+
x: number;
|
136
|
+
y: number;
|
137
|
+
};
|
138
|
+
getNodeSize(nodeId: string): number;
|
139
|
+
destroy(): void;
|
140
|
+
}
|
141
|
+
type OpenGraphEventsTypemap = {
|
142
|
+
"transform-changed": Transform;
|
143
|
+
"hovered-node-changed": SimNode | null;
|
144
|
+
"selected-node-changed": SimNode | null;
|
145
|
+
draw: IOpenGraphSimulation;
|
146
|
+
};
|
147
|
+
declare class OpenGraphEventEmitter extends EventEmitter<OpenGraphEventsTypemap> {}
|
148
|
+
//#endregion
|
149
|
+
//#region src/sim/OpenGraphSimulation.d.ts
|
150
|
+
interface OpenGraphSimulationProps {
|
151
|
+
width: number;
|
152
|
+
height: number;
|
153
|
+
config?: GraphConfig;
|
154
|
+
rootImageSources?: RootNodeImageSources;
|
155
|
+
canvas: HTMLCanvasElement;
|
156
|
+
theme?: ThemeMode;
|
157
|
+
loadNodeImage?: (node: SimNode) => Promise<string | undefined>;
|
158
|
+
translate?: {
|
159
|
+
x: number;
|
160
|
+
y: number;
|
161
|
+
};
|
162
|
+
lockedNodeId?: string;
|
163
|
+
highlights?: HighlightStyle[];
|
164
|
+
}
|
165
|
+
declare class OpenGraphSimulation implements IOpenGraphSimulation {
|
166
|
+
width: number;
|
167
|
+
height: number;
|
168
|
+
config: GraphConfig;
|
169
|
+
rootImageSources: RootNodeImageSources;
|
170
|
+
canvas: HTMLCanvasElement;
|
171
|
+
transformCanvas: TransformCanvas;
|
172
|
+
theme: ThemeMode;
|
173
|
+
private rawData?;
|
174
|
+
emitter: OpenGraphEventEmitter;
|
175
|
+
private translate;
|
176
|
+
private data;
|
177
|
+
private prunedData;
|
178
|
+
private subGraph;
|
179
|
+
private rootId;
|
180
|
+
private simulation;
|
181
|
+
private clusterSizeRange;
|
182
|
+
private maxDepth;
|
183
|
+
private isTicking;
|
184
|
+
private tickCount;
|
185
|
+
private loadNodeImage?;
|
186
|
+
private imageCache;
|
187
|
+
private rootImages;
|
188
|
+
private hideThumbnails;
|
189
|
+
private noInteraction;
|
190
|
+
lockedNodeId?: string;
|
191
|
+
selectedNode: SimNode | null;
|
192
|
+
hoveredNode: SimNode | null;
|
193
|
+
highlights: HighlightStyle[];
|
194
|
+
private renderLayers;
|
195
|
+
constructor(props: OpenGraphSimulationProps);
|
196
|
+
private get center();
|
197
|
+
private get origin();
|
198
|
+
private getNodeAtPosition;
|
199
|
+
getNodeScreenPosition: (node: SimNode) => {
|
200
|
+
x: number;
|
201
|
+
y: number;
|
202
|
+
};
|
203
|
+
getNodeCanvasPosition: (node: SimNode) => {
|
204
|
+
x: number;
|
205
|
+
y: number;
|
206
|
+
};
|
207
|
+
screenToWorld(_x: number, _y: number): {
|
208
|
+
x: number;
|
209
|
+
y: number;
|
210
|
+
};
|
211
|
+
worldToScreen(worldX: number, worldY: number): {
|
212
|
+
x: number;
|
213
|
+
y: number;
|
214
|
+
};
|
215
|
+
handleClick: (x: number, y: number) => void;
|
216
|
+
handleClickNode: (node: SimNode | null, options?: {
|
217
|
+
noToggle?: boolean;
|
218
|
+
triggerFocus?: boolean;
|
219
|
+
}) => void;
|
220
|
+
updateScene: () => void;
|
221
|
+
handleMove: (x: number, y: number) => void;
|
222
|
+
handleTransform: (t: Transform) => void;
|
223
|
+
updateHighlights: () => void;
|
224
|
+
initialize: (data: RawGraphData, rootId: string) => void;
|
225
|
+
get lockedNode(): SimNode | null;
|
226
|
+
triggerSelected: (triggerFocus?: boolean) => void;
|
227
|
+
restart: (alpha?: number) => void;
|
228
|
+
get rootNode(): SimNode | null;
|
229
|
+
handleTick: () => void;
|
230
|
+
setTranslate({
|
231
|
+
x,
|
232
|
+
y
|
233
|
+
}: {
|
234
|
+
x: number;
|
235
|
+
y: number;
|
236
|
+
}): void;
|
237
|
+
get visiblityScale(): d3_scale2.ScaleLogarithmic<number, number, never>;
|
238
|
+
get color(): ColorHandler;
|
239
|
+
get colorContrast(): ColorHandler;
|
240
|
+
getNodeSize: (nodeId: string) => number;
|
241
|
+
private updateRenderLayers;
|
242
|
+
private renderLink;
|
243
|
+
private renderNode;
|
244
|
+
private renderSessionNode;
|
245
|
+
private renderRootNode;
|
246
|
+
private renderCollapsedNode;
|
247
|
+
private renderExpandedNode;
|
248
|
+
onDraw: () => void;
|
249
|
+
private drawDebug;
|
250
|
+
private drawDebugDepthCircles;
|
251
|
+
private onEnd;
|
252
|
+
private loadNodeImages;
|
253
|
+
destroy: () => void;
|
254
|
+
resize: (width: number, height: number) => void;
|
255
|
+
setTheme: (theme: ThemeMode) => void;
|
256
|
+
setHideThumbnails: (hide: boolean) => void;
|
257
|
+
setSelectedNode: (node: SimNode | null) => void;
|
258
|
+
private _highlightHash?;
|
259
|
+
setHighlights: (highlights: HighlightStyle[]) => void;
|
260
|
+
setNoInteraction: (noInteraction: boolean) => void;
|
261
|
+
getNodeById: (nodeId: string) => SimNode | null;
|
262
|
+
setLockedNodeId: (nodeId?: string | null) => void;
|
263
|
+
handleClickDebug: (x: number, y: number) => void;
|
264
|
+
circles: Array<Point>;
|
265
|
+
onDrawDebug: () => void;
|
266
|
+
}
|
267
|
+
//#endregion
|
268
|
+
//#region src/context/provider.d.ts
|
269
|
+
interface OpenFormGraphProviderProps {
|
270
|
+
rootId: string;
|
271
|
+
rootImageSources: RootNodeImageSources;
|
272
|
+
theme: ThemeMode;
|
273
|
+
children: ReactNode;
|
274
|
+
config?: GraphConfig;
|
275
|
+
data: RawGraphData;
|
276
|
+
onSelectedNodeChange?: (node: SimNode | null) => void;
|
277
|
+
onHoveredNodeChange?: (node: SimNode | null) => void;
|
278
|
+
lockedNodeId?: string;
|
279
|
+
}
|
280
|
+
interface OpenFormGraphApi {
|
281
|
+
rootId: string;
|
282
|
+
rootImageSources: RootNodeImageSources;
|
283
|
+
setSelectedNode: Dispatch<SimNode | null>;
|
284
|
+
setHoveredNode: Dispatch<SimNode | null>;
|
285
|
+
theme: ThemeMode;
|
286
|
+
hideThumbnails: boolean;
|
287
|
+
setHideThumbnails: Dispatch<boolean>;
|
288
|
+
config: GraphConfig;
|
289
|
+
data: RawGraphData;
|
290
|
+
simulation: MutableRefObject<OpenGraphSimulation | null>;
|
291
|
+
selectedNode: SimNode | null;
|
292
|
+
hoveredNode: SimNode | null;
|
293
|
+
setSelectedNodeById: (nodeId: string) => void;
|
294
|
+
lockedNodeId?: string;
|
295
|
+
}
|
296
|
+
declare function OpenFormGraphProvider({
|
297
|
+
theme,
|
298
|
+
rootId,
|
299
|
+
children,
|
300
|
+
rootImageSources,
|
301
|
+
config,
|
302
|
+
data,
|
303
|
+
lockedNodeId
|
304
|
+
}: OpenFormGraphProviderProps): react_jsx_runtime1.JSX.Element;
|
305
|
+
declare function useOpenFormGraph(): OpenFormGraphApi;
|
306
|
+
//#endregion
|
307
|
+
//#region src/context/constants.d.ts
|
308
|
+
declare const VOID_ROOT_ID = "void-root";
|
309
|
+
declare const VOID_DETACH_ID = "void-detach";
|
310
|
+
declare const DEFAULT_GRAPH_CONFIG: GraphConfig;
|
311
|
+
//#endregion
|
312
|
+
export { ColorHandler, DEFAULT_GRAPH_CONFIG as DEFAULT_GRAPH_CONFIG$1, GraphConfig, IOpenGraphSimulation, OpenFormGraphApi, OpenFormGraphProvider as OpenFormGraphProvider$1, OpenGraphEventEmitter as OpenGraphEventEmitter$1, OpenGraphEventsTypemap, OpenGraphSimulation as OpenGraphSimulation$1, TransformCanvas as TransformCanvas$1, VOID_DETACH_ID as VOID_DETACH_ID$1, VOID_ROOT_ID as VOID_ROOT_ID$1, color as color$1, dim as dim$1, useOpenFormGraph as useOpenFormGraph$1 };
|
313
|
+
//# sourceMappingURL=constants-BNPHdbBA.d.ts.map
|
package/dist/index.d.ts
CHANGED
@@ -1,139 +1,131 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import
|
1
|
+
import { ColorTransform, CustomHighlight, Focus, GraphData, HighlightStyle, Link, MouseListener, NestedRawNode, Node, NodeState, Point, RGB, RawGraphData, RawLink, RawNode, RootNodeImageSources, SimLink, SimNode, SimpleHighlight, ThemeMode, Transform, TransformListener } from "./_types-CjgCTzqc.js";
|
2
|
+
import { OpenFormGraph$1 as OpenFormGraph } from "./OpenFormGraph-CdcWNN86.js";
|
3
|
+
import { ColorHandler, DEFAULT_GRAPH_CONFIG$1 as DEFAULT_GRAPH_CONFIG, GraphConfig, IOpenGraphSimulation, OpenFormGraphApi, OpenFormGraphProvider$1 as OpenFormGraphProvider, OpenGraphEventEmitter$1 as OpenGraphEventEmitter, OpenGraphEventsTypemap, OpenGraphSimulation$1 as OpenGraphSimulation, TransformCanvas$1 as TransformCanvas, VOID_DETACH_ID$1 as VOID_DETACH_ID, VOID_ROOT_ID$1 as VOID_ROOT_ID, color$1 as color, dim$1 as dim, useOpenFormGraph$1 as useOpenFormGraph } from "./constants-BNPHdbBA.js";
|
4
|
+
import * as d3_force5 from "d3-force";
|
5
5
|
|
6
|
-
|
7
|
-
id: string;
|
8
|
-
label?: string;
|
9
|
-
imgSrc?: string;
|
10
|
-
};
|
11
|
-
type RawLink = {
|
12
|
-
source: string;
|
13
|
-
target: string;
|
14
|
-
};
|
15
|
-
type Link = {
|
16
|
-
source: Node;
|
17
|
-
target: Node;
|
18
|
-
};
|
19
|
-
type Node = {
|
20
|
-
id: string;
|
21
|
-
collapsed: boolean;
|
22
|
-
hide: boolean;
|
23
|
-
clusterSize: number;
|
24
|
-
level?: number;
|
25
|
-
childLinks: Link[];
|
26
|
-
image?: HTMLImageElement;
|
27
|
-
} & RawNode;
|
28
|
-
type RawGraphData = {
|
29
|
-
nodes: RawNode[];
|
30
|
-
links: RawLink[];
|
31
|
-
};
|
32
|
-
type GraphData = {
|
33
|
-
nodes: Node[];
|
34
|
-
links: Link[];
|
35
|
-
};
|
36
|
-
type RGB = [number, number, number];
|
37
|
-
type ColorTransform = (rgb: RGB) => RGB;
|
38
|
-
|
39
|
-
interface GraphConfig {
|
40
|
-
debug: false;
|
41
|
-
nodeSize: number;
|
42
|
-
minClusterSize: number;
|
43
|
-
maxClusterSize: number;
|
44
|
-
minZoom: number;
|
45
|
-
maxZoom: number;
|
46
|
-
focusPadding: number;
|
47
|
-
minDagLevelDistance: number;
|
48
|
-
maxDagLevelDistance: number;
|
49
|
-
theme: {
|
50
|
-
dark: [number, number, number];
|
51
|
-
light: [number, number, number];
|
52
|
-
};
|
53
|
-
}
|
54
|
-
interface LayoutConfig {
|
55
|
-
velocityDecay: number;
|
56
|
-
alphaDecay: number;
|
57
|
-
alphaMin: number;
|
58
|
-
dagLevelDistance: number;
|
59
|
-
}
|
60
|
-
type _ForceGraphMethods = ForceGraphMethods<Node, Link> | ForceGraphMethods$1<Node, Link>;
|
61
|
-
interface OpenFormGraphApi {
|
62
|
-
ref: React.MutableRefObject<_ForceGraphMethods | undefined>;
|
63
|
-
rootId: string;
|
64
|
-
data: GraphData;
|
65
|
-
onClickNode: (nodeId: string) => void;
|
66
|
-
hasNodeChildren: (nodeId: string) => boolean;
|
67
|
-
clusterSizeRange: [number, number];
|
68
|
-
graphLevelRange: [number, number];
|
69
|
-
setLayoutConfig: React.Dispatch<React.SetStateAction<LayoutConfig>>;
|
70
|
-
layoutConfig: LayoutConfig;
|
71
|
-
selectedNode: Node | null;
|
72
|
-
selectedNodeId: string | null;
|
73
|
-
setSelectedNodeId: (node: string | null) => void;
|
74
|
-
highlights: GraphData;
|
75
|
-
theme: "dark" | "light";
|
76
|
-
setTheme: (theme: "dark" | "light") => void;
|
77
|
-
config: GraphConfig;
|
78
|
-
setConfig: React.Dispatch<React.SetStateAction<GraphConfig>>;
|
79
|
-
getNodeSize: (nodeId: string) => number;
|
80
|
-
getNodeForce: (nodeId: string) => number;
|
81
|
-
search: (startNodeId: string, rootId: string) => {
|
82
|
-
nodes: Node[];
|
83
|
-
links: Link[];
|
84
|
-
};
|
85
|
-
}
|
86
|
-
|
87
|
-
interface ProjectGraphProps$1 {
|
88
|
-
width: number;
|
89
|
-
height: number;
|
90
|
-
}
|
91
|
-
declare function OpenFormGraph(props: ProjectGraphProps$1): react_jsx_runtime.JSX.Element;
|
92
|
-
|
93
|
-
interface ProjectGraphProps {
|
94
|
-
width: number;
|
95
|
-
height: number;
|
96
|
-
}
|
97
|
-
declare function OpenFormGraph3D(props: ProjectGraphProps): react_jsx_runtime.JSX.Element;
|
98
|
-
|
99
|
-
interface OpenFormGraphProviderProps {
|
100
|
-
config?: Partial<GraphConfig>;
|
101
|
-
theme: "dark" | "light";
|
102
|
-
children: ReactNode;
|
103
|
-
data: {
|
104
|
-
nodes: RawNode[];
|
105
|
-
links: RawLink[];
|
106
|
-
};
|
107
|
-
rootId: string;
|
108
|
-
}
|
109
|
-
declare function OpenFormGraphProvider({ config, theme, data, rootId: _rootId, children, }: OpenFormGraphProviderProps): react_jsx_runtime.JSX.Element;
|
110
|
-
declare function useOpenFormGraph(): OpenFormGraphApi;
|
111
|
-
|
112
|
-
declare const VOID_ROOT_ID = "void-root";
|
113
|
-
declare const DEFAULT_GRAPH_CONFIG: GraphConfig;
|
6
|
+
//#region src/util/canvas.d.ts
|
114
7
|
|
115
|
-
declare function normalize(val: number, min: number, max: number, minOut: number, maxOut: number): number;
|
116
|
-
|
117
|
-
interface ColorHandler {
|
118
|
-
(arg?: number): string;
|
119
|
-
(arg: ColorTransform): ColorHandler;
|
120
|
-
rgb: RGB;
|
121
|
-
}
|
122
|
-
declare function color(rgb: RGB): ColorHandler;
|
123
8
|
/**
|
124
|
-
*
|
125
|
-
* @param
|
126
|
-
* @param
|
127
|
-
* @
|
9
|
+
* draws a circle on the canvas
|
10
|
+
* @param ctx - The canvas rendering context
|
11
|
+
* @param x - The x-coordinate of the circle's center
|
12
|
+
* @param y - The y-coordinate of the circle's center
|
13
|
+
* @param radius - The radius of the circle (default is 5)
|
14
|
+
* @param options - Optional parameters for styling the circle
|
15
|
+
* @param options.fill - Whether to fill the circle (default is true)
|
16
|
+
* @param options.fillStyle - The fill color of the circle
|
17
|
+
* @param options.stroke - Whether to stroke the circle (default is false)
|
18
|
+
* @param options.strokeStyle - The stroke color of the circle
|
19
|
+
* @param options.lineWidth - The width of the stroke (default is 0.2)
|
20
|
+
* @returns void
|
128
21
|
*/
|
129
|
-
declare function
|
130
|
-
|
22
|
+
declare function circle(ctx: CanvasRenderingContext2D, x: number, y: number, radius?: number, options?: {
|
23
|
+
fill?: boolean;
|
24
|
+
fillStyle?: string;
|
25
|
+
stroke?: boolean;
|
26
|
+
strokeStyle?: string;
|
27
|
+
lineWidth?: number;
|
28
|
+
}): void;
|
29
|
+
/**
|
30
|
+
* draws a rectangle on the canvas
|
31
|
+
* @param ctx - The canvas rendering context
|
32
|
+
* @param x - The x-coordinate of the rectangle's top-left corner
|
33
|
+
* @param y - The y-coordinate of the rectangle's top-left corner
|
34
|
+
* @param width - The width of the rectangle
|
35
|
+
* @param height - The height of the rectangle
|
36
|
+
* @param options - Optional parameters for styling the rectangle
|
37
|
+
* @param options.fill - Whether to fill the rectangle (default is true)
|
38
|
+
* @param options.fillStyle - The fill color of the rectangle
|
39
|
+
* @param options.stroke - Whether to stroke the rectangle (default is false)
|
40
|
+
* @param options.strokeStyle - The stroke color of the rectangle
|
41
|
+
* @param options.lineWidth - The width of the stroke (default is 0.2)
|
42
|
+
* @param options.borderRadius - The radius of the corners (default is 0)
|
43
|
+
* @returns void
|
44
|
+
*/
|
45
|
+
declare function rect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, options?: {
|
46
|
+
fill?: boolean;
|
47
|
+
fillStyle?: string;
|
48
|
+
stroke?: boolean;
|
49
|
+
strokeStyle?: string;
|
50
|
+
lineWidth?: number;
|
51
|
+
borderRadius?: number;
|
52
|
+
}): void;
|
53
|
+
/**
|
54
|
+
* draws an image on the canvas with optional border radius and opacity
|
55
|
+
* @param ctx - The canvas rendering context
|
56
|
+
* @param image - The HTMLImageElement to draw
|
57
|
+
* @param x - The x-coordinate of the image's top-left corner
|
58
|
+
* @param y - The y-coordinate of the image's top-left corner
|
59
|
+
* @param width - The width of the image
|
60
|
+
* @param height - The height of the image
|
61
|
+
* @param borderRadius - The radius of the corners (default is 0)
|
62
|
+
* @param opacity - The opacity of the image (default is 1.0)
|
63
|
+
* @param bgColor - Optional background color to fill the clipped area
|
64
|
+
* @returns void
|
65
|
+
*/
|
66
|
+
declare function img(ctx: CanvasRenderingContext2D, image: HTMLImageElement, x: number, y: number, width: number, height: number, borderRadius?: number, opacity?: number, bgColor?: string): void;
|
67
|
+
declare function hexagon(ctx: CanvasRenderingContext2D, x: number, y: number, radius: number, options?: {
|
68
|
+
fill?: boolean;
|
69
|
+
fillStyle?: string;
|
70
|
+
stroke?: boolean;
|
71
|
+
strokeStyle?: string;
|
72
|
+
lineWidth?: number;
|
73
|
+
rotation?: number;
|
74
|
+
borderRadius?: number;
|
75
|
+
}): void;
|
76
|
+
//#endregion
|
77
|
+
//#region src/util/data.d.ts
|
131
78
|
declare function generateTree(maxNodes: number, maxChildren: number): RawGraphData;
|
132
|
-
declare function
|
133
|
-
|
134
|
-
|
79
|
+
declare function getPrunedData(startId: string, nodes: SimNode[], links: SimLink[], highlights?: HighlightStyle[]): {
|
80
|
+
nodes: SimNode[];
|
81
|
+
links: d3_force5.SimulationLinkDatum<SimNode>[];
|
135
82
|
};
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
83
|
+
/**
|
84
|
+
* Automatically identifies root nodes and builds a nested structure
|
85
|
+
* @param nodes Array of raw nodes
|
86
|
+
* @param links Array of links between nodes
|
87
|
+
* @returns Array of nested nodes starting from identified roots
|
88
|
+
*/
|
89
|
+
declare function buildTreeFromGraphData(nodes: RawNode[], links: RawLink[]): NestedRawNode<RawNode>[];
|
90
|
+
/**
|
91
|
+
* Recursively retrieves all parents of a node from a graph data structure
|
92
|
+
* @param {string} nodeHash - The hash of the node to find parents for
|
93
|
+
* @param {RawNode[]} nodes - Array of nodes in the graph
|
94
|
+
* @param {RawLink[]} links - Array of links connecting the nodes
|
95
|
+
* @returns {RawNode[]} - Array of parent nodes
|
96
|
+
*/
|
97
|
+
declare function searchParents(nodeHash: string, nodes: RawNode[], links: RawLink[]): RawNode[];
|
98
|
+
//#endregion
|
99
|
+
//#region src/util/graph.d.ts
|
100
|
+
declare function getNodeId(n: any): any;
|
101
|
+
declare function getParents(id: string, links: SimLink[]): string[];
|
102
|
+
declare function getAllParentsUntil(nodeId: string, links: SimLink[], stopAtId: string): string[];
|
103
|
+
declare function getChildren(id: string, links: SimLink[]): string[];
|
104
|
+
declare function getClusterSize(id: string, links: RawLink[]): number;
|
105
|
+
declare function getNodeDepth(id: string, links: RawLink[]): number;
|
106
|
+
declare function getRootParent(id: string, links: RawLink[], stop?: string): string | null;
|
107
|
+
declare function hasOnlyLeafs(id: string, links: RawLink[]): boolean;
|
108
|
+
declare function getNodeSubgraph(nodeId: string, nodes: SimNode[], links: SimLink[], rootId: string): {
|
109
|
+
nodes: SimNode[];
|
110
|
+
links: SimLink[];
|
111
|
+
};
|
112
|
+
//#endregion
|
113
|
+
//#region src/util/img.d.ts
|
114
|
+
declare function loadHTMLImageElement(src: string): Promise<HTMLImageElement>;
|
115
|
+
//#endregion
|
116
|
+
//#region src/util/highlights.d.ts
|
117
|
+
declare const red: RGB;
|
118
|
+
declare class Highlight {
|
119
|
+
static owner: (id: string) => CustomHighlight;
|
120
|
+
static primary: (id: string) => CustomHighlight;
|
121
|
+
static evolved: (id: string) => CustomHighlight;
|
122
|
+
static minted: (id: string) => CustomHighlight;
|
123
|
+
}
|
124
|
+
//#endregion
|
125
|
+
//#region src/util/types.d.ts
|
126
|
+
declare function isSimNode(node: SimNode | string | number): node is SimNode;
|
127
|
+
declare function isSimLink(link: SimLink): link is SimLink;
|
128
|
+
declare function isCustomHighlight(highlight: CustomHighlight | SimpleHighlight): highlight is CustomHighlight;
|
129
|
+
//#endregion
|
130
|
+
export { ColorHandler, ColorTransform, CustomHighlight, DEFAULT_GRAPH_CONFIG, Focus, GraphConfig, GraphData, Highlight, HighlightStyle, IOpenGraphSimulation, Link, MouseListener, NestedRawNode, Node, NodeState, OpenFormGraph, OpenFormGraphApi, OpenFormGraphProvider, OpenGraphEventEmitter, OpenGraphEventsTypemap, OpenGraphSimulation, Point, RGB, RawGraphData, RawLink, RawNode, RootNodeImageSources, SimLink, SimNode, SimpleHighlight, ThemeMode, Transform, TransformCanvas, TransformListener, VOID_DETACH_ID, VOID_ROOT_ID, buildTreeFromGraphData, circle, color, dim, generateTree, getAllParentsUntil, getChildren, getClusterSize, getNodeDepth, getNodeId, getNodeSubgraph, getParents, getPrunedData, getRootParent, hasOnlyLeafs, hexagon, img, isCustomHighlight, isSimLink, isSimNode, loadHTMLImageElement, rect, red, searchParents, useOpenFormGraph };
|
131
|
+
//# sourceMappingURL=index.d.ts.map
|