@darajs/ui-causal-graph-editor 0.4.8
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 +201 -0
- package/README.md +12 -0
- package/dist/CanvasPool.5cd3cdcd.js +30 -0
- package/dist/SharedSystems.140ebe02.js +1905 -0
- package/dist/WebGLRenderer.6ede660f.js +2241 -0
- package/dist/WebGPURenderer.f884c756.js +1544 -0
- package/dist/browserAll.2dcaa9f7.js +953 -0
- package/dist/colorToUniform.7c604fe6.js +76 -0
- package/dist/index.a01cfc5f.js +61895 -0
- package/dist/index.js +35 -0
- package/dist/index.umd.cjs +10287 -0
- package/dist/init.73e5c5e2.js +2602 -0
- package/dist/style.css +1 -0
- package/dist/types/graph-viewer/causal-graph-editor.d.ts +58 -0
- package/dist/types/graph-viewer/causal-graph-editor.d.ts.map +1 -0
- package/dist/types/graph-viewer/storybook/stories-utils.d.ts +1247 -0
- package/dist/types/graph-viewer/storybook/stories-utils.d.ts.map +1 -0
- package/dist/types/graph-viewer/utils/use-iterate-edges.d.ts +32 -0
- package/dist/types/graph-viewer/utils/use-iterate-edges.d.ts.map +1 -0
- package/dist/types/graph-viewer/utils/use-iterate-nodes.d.ts +32 -0
- package/dist/types/graph-viewer/utils/use-iterate-nodes.d.ts.map +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/jest-setup.d.ts +18 -0
- package/dist/types/jest-setup.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/index.d.ts +19 -0
- package/dist/types/node-hierarchy-builder/index.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/layer-divider.d.ts +15 -0
- package/dist/types/node-hierarchy-builder/layer-divider.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/layer-label-editor.d.ts +24 -0
- package/dist/types/node-hierarchy-builder/layer-label-editor.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/layer.d.ts +35 -0
- package/dist/types/node-hierarchy-builder/layer.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/node-hierarchy-builder.d.ts +27 -0
- package/dist/types/node-hierarchy-builder/node-hierarchy-builder.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/node.d.ts +21 -0
- package/dist/types/node-hierarchy-builder/node.d.ts.map +1 -0
- package/dist/types/node-hierarchy-builder/shared.d.ts +93 -0
- package/dist/types/node-hierarchy-builder/shared.d.ts.map +1 -0
- package/dist/types/shared/causal-graph-store.d.ts +118 -0
- package/dist/types/shared/causal-graph-store.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/add-node-button.d.ts +25 -0
- package/dist/types/shared/editor-overlay/buttons/add-node-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/center-graph-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/center-graph-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-all-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-all-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-expand-button.d.ts +26 -0
- package/dist/types/shared/editor-overlay/buttons/collapse-expand-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/drag-mode-button.d.ts +27 -0
- package/dist/types/shared/editor-overlay/buttons/drag-mode-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/index.d.ts +24 -0
- package/dist/types/shared/editor-overlay/buttons/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/recalculate-layout-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/recalculate-layout-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/save-image-button.d.ts +7 -0
- package/dist/types/shared/editor-overlay/buttons/save-image-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/buttons/soft-edge-arrow-button.d.ts +19 -0
- package/dist/types/shared/editor-overlay/buttons/soft-edge-arrow-button.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/floating-elements.d.ts +29 -0
- package/dist/types/shared/editor-overlay/floating-elements.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/index.d.ts +22 -0
- package/dist/types/shared/editor-overlay/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/index.d.ts +19 -0
- package/dist/types/shared/editor-overlay/legend/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/legend-data.d.ts +49 -0
- package/dist/types/shared/editor-overlay/legend/legend-data.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/legend-list.d.ts +6 -0
- package/dist/types/shared/editor-overlay/legend/legend-list.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/legend/legend.d.ts +7 -0
- package/dist/types/shared/editor-overlay/legend/legend.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/overlay.d.ts +42 -0
- package/dist/types/shared/editor-overlay/overlay.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-editor.d.ts +8 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-info-content.d.ts +41 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/edge-info-content.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/editor-props.d.ts +35 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/editor-props.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/encoder-editor.d.ts +23 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/encoder-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/index.d.ts +18 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/pag-editor.d.ts +23 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/pag-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/resolver-editor.d.ts +7 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/resolver-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/constraint-editor.d.ts +27 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/constraint-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/description-editor.d.ts +15 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/description-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/direction-editor.d.ts +21 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/direction-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/edge-type-editor.d.ts +17 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/edge-type-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/index.d.ts +19 -0
- package/dist/types/shared/editor-overlay/panel-content/edge/sections/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/index.d.ts +20 -0
- package/dist/types/shared/editor-overlay/panel-content/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/node/index.d.ts +18 -0
- package/dist/types/shared/editor-overlay/panel-content/node/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/node/label-editor.d.ts +11 -0
- package/dist/types/shared/editor-overlay/panel-content/node/label-editor.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/node/node-info-content.d.ts +34 -0
- package/dist/types/shared/editor-overlay/panel-content/node/node-info-content.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-content.d.ts +17 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-content.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-title.d.ts +12 -0
- package/dist/types/shared/editor-overlay/panel-content/panel-title.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/panel-content/styled.d.ts +9 -0
- package/dist/types/shared/editor-overlay/panel-content/styled.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/positional-divs.d.ts +25 -0
- package/dist/types/shared/editor-overlay/positional-divs.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/search-bar/index.d.ts +19 -0
- package/dist/types/shared/editor-overlay/search-bar/index.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/search-bar/search-bar.d.ts +21 -0
- package/dist/types/shared/editor-overlay/search-bar/search-bar.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/search-bar/use-search.d.ts +32 -0
- package/dist/types/shared/editor-overlay/search-bar/use-search.d.ts.map +1 -0
- package/dist/types/shared/editor-overlay/zoom-prompt.d.ts +9 -0
- package/dist/types/shared/editor-overlay/zoom-prompt.d.ts.map +1 -0
- package/dist/types/shared/graph-context.d.ts +26 -0
- package/dist/types/shared/graph-context.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/circular-layout.d.ts +32 -0
- package/dist/types/shared/graph-layout/circular-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/common.d.ts +96 -0
- package/dist/types/shared/graph-layout/common.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/custom-layout.d.ts +36 -0
- package/dist/types/shared/graph-layout/custom-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/fcose-layout.d.ts +132 -0
- package/dist/types/shared/graph-layout/fcose-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/force-atlas-layout.d.ts +103 -0
- package/dist/types/shared/graph-layout/force-atlas-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/index.d.ts +25 -0
- package/dist/types/shared/graph-layout/index.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/marketing-layout.d.ts +63 -0
- package/dist/types/shared/graph-layout/marketing-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/planar-layout.d.ts +67 -0
- package/dist/types/shared/graph-layout/planar-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/spring-layout.d.ts +101 -0
- package/dist/types/shared/graph-layout/spring-layout.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/circular.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/circular.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/client.d.ts +22 -0
- package/dist/types/shared/graph-layout/worker/client.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/fcose.d.ts +18 -0
- package/dist/types/shared/graph-layout/worker/fcose.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/force-atlas.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/force-atlas.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/marketing.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/marketing.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/planar.d.ts +5 -0
- package/dist/types/shared/graph-layout/worker/planar.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/spring.d.ts +19 -0
- package/dist/types/shared/graph-layout/worker/spring.d.ts.map +1 -0
- package/dist/types/shared/graph-layout/worker/worker.d.ts +27 -0
- package/dist/types/shared/graph-layout/worker/worker.d.ts.map +1 -0
- package/dist/types/shared/parsers.d.ts +43 -0
- package/dist/types/shared/parsers.d.ts.map +1 -0
- package/dist/types/shared/pointer-context.d.ts +20 -0
- package/dist/types/shared/pointer-context.d.ts.map +1 -0
- package/dist/types/shared/rendering/background.d.ts +48 -0
- package/dist/types/shared/rendering/background.d.ts.map +1 -0
- package/dist/types/shared/rendering/colors.d.ts +27 -0
- package/dist/types/shared/rendering/colors.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/curve.d.ts +51 -0
- package/dist/types/shared/rendering/edge/curve.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/definitions.d.ts +73 -0
- package/dist/types/shared/rendering/edge/definitions.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/edge-object.d.ts +93 -0
- package/dist/types/shared/rendering/edge/edge-object.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/index.d.ts +19 -0
- package/dist/types/shared/rendering/edge/index.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/symbols.d.ts +40 -0
- package/dist/types/shared/rendering/edge/symbols.d.ts.map +1 -0
- package/dist/types/shared/rendering/edge/utils.d.ts +27 -0
- package/dist/types/shared/rendering/edge/utils.d.ts.map +1 -0
- package/dist/types/shared/rendering/engine.d.ts +436 -0
- package/dist/types/shared/rendering/engine.d.ts.map +1 -0
- package/dist/types/shared/rendering/grouping/group-container-object.d.ts +56 -0
- package/dist/types/shared/rendering/grouping/group-container-object.d.ts.map +1 -0
- package/dist/types/shared/rendering/grouping/index.d.ts +2 -0
- package/dist/types/shared/rendering/grouping/index.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/definitions.d.ts +59 -0
- package/dist/types/shared/rendering/node/definitions.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/index.d.ts +20 -0
- package/dist/types/shared/rendering/node/index.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/node-object.d.ts +78 -0
- package/dist/types/shared/rendering/node/node-object.d.ts.map +1 -0
- package/dist/types/shared/rendering/node/utils.d.ts +33 -0
- package/dist/types/shared/rendering/node/utils.d.ts.map +1 -0
- package/dist/types/shared/rendering/svg.d.ts +26 -0
- package/dist/types/shared/rendering/svg.d.ts.map +1 -0
- package/dist/types/shared/rendering/text.d.ts +33 -0
- package/dist/types/shared/rendering/text.d.ts.map +1 -0
- package/dist/types/shared/rendering/texture-cache.d.ts +47 -0
- package/dist/types/shared/rendering/texture-cache.d.ts.map +1 -0
- package/dist/types/shared/rendering/use-render-engine.d.ts +115 -0
- package/dist/types/shared/rendering/use-render-engine.d.ts.map +1 -0
- package/dist/types/shared/rendering/utils.d.ts +27 -0
- package/dist/types/shared/rendering/utils.d.ts.map +1 -0
- package/dist/types/shared/serializer.d.ts +39 -0
- package/dist/types/shared/serializer.d.ts.map +1 -0
- package/dist/types/shared/settings-context.d.ts +56 -0
- package/dist/types/shared/settings-context.d.ts.map +1 -0
- package/dist/types/shared/styles.d.ts +4 -0
- package/dist/types/shared/styles.d.ts.map +1 -0
- package/dist/types/shared/use-causal-graph-editor.d.ts +22 -0
- package/dist/types/shared/use-causal-graph-editor.d.ts.map +1 -0
- package/dist/types/shared/use-drag-mode.d.ts +33 -0
- package/dist/types/shared/use-drag-mode.d.ts.map +1 -0
- package/dist/types/shared/use-edge-encoder.d.ts +45 -0
- package/dist/types/shared/use-edge-encoder.d.ts.map +1 -0
- package/dist/types/shared/use-graph-tooltip.d.ts +15 -0
- package/dist/types/shared/use-graph-tooltip.d.ts.map +1 -0
- package/dist/types/shared/use-pane-visibility.d.ts +12 -0
- package/dist/types/shared/use-pane-visibility.d.ts.map +1 -0
- package/dist/types/shared/utils.d.ts +79 -0
- package/dist/types/shared/utils.d.ts.map +1 -0
- package/dist/types/types.d.ts +277 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/webworkerAll.2e3715a5.js +7 -0
- package/package.json +120 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
import type { DefaultTheme } from '@darajs/styled-components';
|
|
3
|
+
import type { NotificationPayload } from '@darajs/ui-notifications';
|
|
4
|
+
import type { GraphLayout } from '../graph-layout';
|
|
5
|
+
import type { DragMode } from '../use-drag-mode';
|
|
6
|
+
import type { EdgeConstraint, SimulationEdge, SimulationGraph, ZoomThresholds } from '../../types';
|
|
7
|
+
import { EditorMode } from '../../types';
|
|
8
|
+
import type { PixiEdgeStyle } from './edge';
|
|
9
|
+
export interface EngineEvents {
|
|
10
|
+
backgroundClick: () => void;
|
|
11
|
+
createEdge: (event: PIXI.FederatedMouseEvent, source: string, target: string) => void;
|
|
12
|
+
dragEnd: () => void;
|
|
13
|
+
dragStart: () => void;
|
|
14
|
+
edgeClick: (event: PIXI.FederatedMouseEvent, source: string, target: string) => void;
|
|
15
|
+
edgeMouseout: (event: PIXI.FederatedMouseEvent, edgeKey: string) => void;
|
|
16
|
+
edgeMouseover: (event: PIXI.FederatedMouseEvent, edgeKey: string) => void;
|
|
17
|
+
nodeClick: (event: PIXI.FederatedMouseEvent, nodeKey: string) => void;
|
|
18
|
+
nodeMouseout: (event: PIXI.FederatedMouseEvent, nodeKey: string) => void;
|
|
19
|
+
nodeMouseover: (event: PIXI.FederatedMouseEvent, nodeKey: string) => void;
|
|
20
|
+
groupMouseout: (event: PIXI.FederatedMouseEvent, groupKey: string) => void;
|
|
21
|
+
groupMouseover: (event: PIXI.FederatedMouseEvent, groupKey: string) => void;
|
|
22
|
+
layoutComputationStart: () => void;
|
|
23
|
+
layoutComputationEnd: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const ENGINE_EVENTS: Array<keyof EngineEvents>;
|
|
26
|
+
export declare class Engine extends PIXI.EventEmitter<EngineEvents> {
|
|
27
|
+
/** App instance */
|
|
28
|
+
private app;
|
|
29
|
+
/** Background object */
|
|
30
|
+
private background;
|
|
31
|
+
/** Available edge constraints */
|
|
32
|
+
private constraints;
|
|
33
|
+
/** Parent container where canvas is rendered in */
|
|
34
|
+
private container;
|
|
35
|
+
/** Running layout worker instance */
|
|
36
|
+
private layoutWorker;
|
|
37
|
+
/** Debounced version of `this.updateLayout` in case multiple changes come in at the same time */
|
|
38
|
+
debouncedUpdateLayout: import("lodash").DebouncedFunc<(retry?: boolean) => Promise<void>>;
|
|
39
|
+
/** Current drag mode */
|
|
40
|
+
private dragMode;
|
|
41
|
+
/** Container storing edge graphics */
|
|
42
|
+
private edgeLayer;
|
|
43
|
+
/** Edge ID -> EdgeObject cache */
|
|
44
|
+
private edgeMap;
|
|
45
|
+
/** Container storing edge symbol graphics */
|
|
46
|
+
private edgeSymbolsLayer;
|
|
47
|
+
/** Whether the graph is editable */
|
|
48
|
+
private editable;
|
|
49
|
+
/** Current editor mode */
|
|
50
|
+
private editorMode;
|
|
51
|
+
/** Graph state */
|
|
52
|
+
private graph;
|
|
53
|
+
/** Whether engine has been started */
|
|
54
|
+
initialized: boolean;
|
|
55
|
+
/** Whether there is an edge being created */
|
|
56
|
+
private isCreatingEdge;
|
|
57
|
+
/** Whether a node is being moved */
|
|
58
|
+
private isMovingNode;
|
|
59
|
+
/** Graph layout instance */
|
|
60
|
+
private layout?;
|
|
61
|
+
/** Which edge the user is holding down mouse button on */
|
|
62
|
+
private mousedownEdgeKey;
|
|
63
|
+
/** Which node the user is holding down mouse button on */
|
|
64
|
+
private mousedownNodeKey;
|
|
65
|
+
/** Container storing node label graphics */
|
|
66
|
+
private nodeLabelLayer;
|
|
67
|
+
/** Container storing node graphics */
|
|
68
|
+
private nodeLayer;
|
|
69
|
+
/** Node ID -> NodeObject cache */
|
|
70
|
+
private nodeMap;
|
|
71
|
+
/** Center position of the node user pressed mousedown on, stored while user is holding down mouse1 */
|
|
72
|
+
private nodeMousedownCenterPosition;
|
|
73
|
+
/** Last mousedown event position stored while user is holding down mouse1 */
|
|
74
|
+
private nodeMousedownPosition;
|
|
75
|
+
/** Callback executed when a node is added */
|
|
76
|
+
private onAddNode?;
|
|
77
|
+
/** Callback executed when an edge is added */
|
|
78
|
+
private onAddEdge?;
|
|
79
|
+
/** Callback executed when engine is being destroyed */
|
|
80
|
+
private onCleanup?;
|
|
81
|
+
/** Container storing group container graphics */
|
|
82
|
+
private groupContainerLayer;
|
|
83
|
+
/** Group ID -> GroupContainerObject cache */
|
|
84
|
+
private groupContainerMap;
|
|
85
|
+
/** Group ID -> simulation edge array */
|
|
86
|
+
private collapsedEdgesMap;
|
|
87
|
+
private onGraphAttributesUpdatedBound;
|
|
88
|
+
private onGraphNodeAddedBound;
|
|
89
|
+
private onGraphEdgeAddedBound;
|
|
90
|
+
private onGraphEdgeDroppedBound;
|
|
91
|
+
private onGraphNodeDroppedBound;
|
|
92
|
+
private onGraphEdgeAttributesUpdatedBound;
|
|
93
|
+
private onGraphNodeAttributesUpdatedBound;
|
|
94
|
+
private onDocumentMouseMoveBound;
|
|
95
|
+
private onDocumentMouseUpBound;
|
|
96
|
+
private onLayoutComputationStartedBound;
|
|
97
|
+
private onLayoutComputationDoneBound;
|
|
98
|
+
/** Callback executed when a drag motion is done */
|
|
99
|
+
private onEndDrag?;
|
|
100
|
+
/** Callback executed when a node is being moved */
|
|
101
|
+
private onMove?;
|
|
102
|
+
/** Callback executed when a drag motion is started */
|
|
103
|
+
private onStartDrag?;
|
|
104
|
+
/** Callback for raising error from a layout build into the Graph component */
|
|
105
|
+
private errorHandler?;
|
|
106
|
+
/** Callback executed when an edge needs style change */
|
|
107
|
+
private processEdgeStyle?;
|
|
108
|
+
/** Last render request ID - used to skip extra render calls */
|
|
109
|
+
private renderRequestId;
|
|
110
|
+
/** Whether the styles are dirty and need to be updated in the animation frame */
|
|
111
|
+
private isStyleDirty;
|
|
112
|
+
/** ResizeObserver instance watching window resizes */
|
|
113
|
+
private resizeObserver;
|
|
114
|
+
/** Current node search results */
|
|
115
|
+
private searchResults;
|
|
116
|
+
/** Currently selected edge. We keep track of it here so we can unselect it when need be */
|
|
117
|
+
private selectedEdge;
|
|
118
|
+
/** Currently selected node. We keep track of it here so we can unselect it when need be */
|
|
119
|
+
private selectedNode;
|
|
120
|
+
/** Current range of edge strength values provided in meta attributes */
|
|
121
|
+
private strengthRange;
|
|
122
|
+
/** Texture cache instance */
|
|
123
|
+
private textureCache;
|
|
124
|
+
/** Current theme */
|
|
125
|
+
private theme;
|
|
126
|
+
/** Graph UID */
|
|
127
|
+
private uid;
|
|
128
|
+
/** Viewport instance */
|
|
129
|
+
private viewport;
|
|
130
|
+
/** Optional user-provided zoom thresholds */
|
|
131
|
+
private zoomThresholds?;
|
|
132
|
+
/** whether zoom on scroll should be enabled only when the graph is focused */
|
|
133
|
+
private requireFocusToZoom;
|
|
134
|
+
/** Whether the graph is currently focused */
|
|
135
|
+
private isFocused;
|
|
136
|
+
constructor(graph: SimulationGraph, layout: GraphLayout, editable: boolean, editorMode: EditorMode, theme: DefaultTheme, constraints?: EdgeConstraint[], zoomThresholds?: ZoomThresholds, errorHandler?: (error: NotificationPayload) => void, processEdgeStyle?: (edge: PixiEdgeStyle, attributes: SimulationEdge) => PixiEdgeStyle, requireFocusToZoom?: boolean);
|
|
137
|
+
/**
|
|
138
|
+
* Get the center position of the rendered viewport
|
|
139
|
+
*/
|
|
140
|
+
getCenterPosition(): PIXI.PointData;
|
|
141
|
+
/**
|
|
142
|
+
* Cleanup the app appropriately
|
|
143
|
+
*/
|
|
144
|
+
destroy(): void;
|
|
145
|
+
/**
|
|
146
|
+
* Mark styles to update them in the next animation frame
|
|
147
|
+
*/
|
|
148
|
+
markStylesDirty(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Request the graph to be re-rendered
|
|
151
|
+
*/
|
|
152
|
+
requestRender(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Reset the viewport to fit the graph centered on screen
|
|
155
|
+
*/
|
|
156
|
+
resetViewport(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Collapse all groups present in the graph
|
|
159
|
+
*/
|
|
160
|
+
collapseAllGroups(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Expand all groups present in the graph
|
|
163
|
+
*/
|
|
164
|
+
expandAllGroups(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Update matched status based on new search result
|
|
167
|
+
*
|
|
168
|
+
* @param ids ids found in search result
|
|
169
|
+
*/
|
|
170
|
+
searchNodes(ids: string[]): void;
|
|
171
|
+
/**
|
|
172
|
+
* Select an edge with given id
|
|
173
|
+
*
|
|
174
|
+
* @param id id of the edge
|
|
175
|
+
*/
|
|
176
|
+
selectEdge(path: [string, string]): void;
|
|
177
|
+
/**
|
|
178
|
+
* Select a node with given id
|
|
179
|
+
*
|
|
180
|
+
* @param id id of the node
|
|
181
|
+
*/
|
|
182
|
+
selectNode(id: string): void;
|
|
183
|
+
/**
|
|
184
|
+
* Update drag mode
|
|
185
|
+
*
|
|
186
|
+
* @param dragMode drag mode to set
|
|
187
|
+
*/
|
|
188
|
+
setDragMode(dragMode: DragMode): void;
|
|
189
|
+
/**
|
|
190
|
+
* Update theme used
|
|
191
|
+
*
|
|
192
|
+
* @param theme theme used
|
|
193
|
+
*/
|
|
194
|
+
setTheme(theme: DefaultTheme): void;
|
|
195
|
+
/**
|
|
196
|
+
* Start the rendering engine
|
|
197
|
+
*
|
|
198
|
+
* @param container container to start in - canvas will be injected into it
|
|
199
|
+
*/
|
|
200
|
+
start(container: HTMLElement): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Notify the engine about focus change on the graph canvas
|
|
203
|
+
*
|
|
204
|
+
* This is used to enable/disable behaviour depending on focus state, e.g. zoom on wheel
|
|
205
|
+
*
|
|
206
|
+
* @param isFocused - focus state
|
|
207
|
+
*/
|
|
208
|
+
setFocus(isFocused: boolean): void;
|
|
209
|
+
/**
|
|
210
|
+
* Toggle zoom-on-wheel behaviour
|
|
211
|
+
*
|
|
212
|
+
* @param isEnabled - whether to enable or disable wheel zoom
|
|
213
|
+
*/
|
|
214
|
+
toggleWheelZoom(isEnabled: boolean): void;
|
|
215
|
+
/**
|
|
216
|
+
* Wheel listener which disables the default browser scrolling behaviour
|
|
217
|
+
*
|
|
218
|
+
* @param event - mouse wheel event
|
|
219
|
+
*/
|
|
220
|
+
private static wheelListener;
|
|
221
|
+
/**
|
|
222
|
+
* Extract current visible canvas state to an image
|
|
223
|
+
*/
|
|
224
|
+
extractImage(): Promise<string>;
|
|
225
|
+
/**
|
|
226
|
+
* Update the set of constraints
|
|
227
|
+
*
|
|
228
|
+
* @param constraints new constraints
|
|
229
|
+
*/
|
|
230
|
+
updateConstraints(constraints: EdgeConstraint[]): void;
|
|
231
|
+
/**
|
|
232
|
+
* Create an edge
|
|
233
|
+
*
|
|
234
|
+
* @param id edge id
|
|
235
|
+
* @param attributes edge attributes
|
|
236
|
+
* @param source source node id
|
|
237
|
+
* @param target target node i
|
|
238
|
+
* @param sourceAttributes source node attributes
|
|
239
|
+
* @param targetAttributes target node attributes
|
|
240
|
+
*/
|
|
241
|
+
private createEdge;
|
|
242
|
+
/**
|
|
243
|
+
* Create the graph.
|
|
244
|
+
*
|
|
245
|
+
* Creates edges and nodes based on current graph state.
|
|
246
|
+
*/
|
|
247
|
+
private createGraph;
|
|
248
|
+
/**
|
|
249
|
+
* Create a node
|
|
250
|
+
*
|
|
251
|
+
* @param id node id
|
|
252
|
+
* @param attributes node attributes
|
|
253
|
+
*/
|
|
254
|
+
private createNode;
|
|
255
|
+
/**
|
|
256
|
+
* Create a group container
|
|
257
|
+
*
|
|
258
|
+
* @param id node id
|
|
259
|
+
* @param nodes a list of simulation nodes that are part of the group
|
|
260
|
+
*/
|
|
261
|
+
private createGroupContainer;
|
|
262
|
+
/**
|
|
263
|
+
* Creates all group containers
|
|
264
|
+
*/
|
|
265
|
+
private createGroupContainers;
|
|
266
|
+
/**
|
|
267
|
+
* Drop the edge graphics from the renderer
|
|
268
|
+
*
|
|
269
|
+
* @param id edge id
|
|
270
|
+
*/
|
|
271
|
+
private dropEdge;
|
|
272
|
+
/**
|
|
273
|
+
* Drop the node graphics from the renderer
|
|
274
|
+
*
|
|
275
|
+
* @param id node id
|
|
276
|
+
*/
|
|
277
|
+
private dropNode;
|
|
278
|
+
/**
|
|
279
|
+
* Drop the group container graphics from the renderer
|
|
280
|
+
*
|
|
281
|
+
* @param id node id
|
|
282
|
+
*/
|
|
283
|
+
private dropGroupContainer;
|
|
284
|
+
/**
|
|
285
|
+
* Enables drag behaviour
|
|
286
|
+
*
|
|
287
|
+
* Pauses viewport dragging and installs listeners for mouse movement
|
|
288
|
+
*/
|
|
289
|
+
private enableDragBehaviour;
|
|
290
|
+
/**
|
|
291
|
+
* Get constraint for given edge
|
|
292
|
+
*
|
|
293
|
+
* @param source edge source
|
|
294
|
+
* @param target edge target
|
|
295
|
+
*/
|
|
296
|
+
private getConstraint;
|
|
297
|
+
/**
|
|
298
|
+
* Get style object to determine edge behaviour
|
|
299
|
+
*
|
|
300
|
+
* @param edge edge object to get styles for
|
|
301
|
+
* @param attributes edge attributes
|
|
302
|
+
* @param constraint optional attached constraint, used in edge encoder mode
|
|
303
|
+
*/
|
|
304
|
+
private getEdgeStyle;
|
|
305
|
+
/**
|
|
306
|
+
* Get style object to determine node behaviour
|
|
307
|
+
*
|
|
308
|
+
* @param node node object to get styles for
|
|
309
|
+
* @param attributes node attributes
|
|
310
|
+
*/
|
|
311
|
+
private getNodeStyle;
|
|
312
|
+
/**
|
|
313
|
+
* Enable hover state for given edge
|
|
314
|
+
*
|
|
315
|
+
* @param id id of edge to hover
|
|
316
|
+
*/
|
|
317
|
+
private hoverEdge;
|
|
318
|
+
/**
|
|
319
|
+
* Enable hover state for given node
|
|
320
|
+
*
|
|
321
|
+
* @param id id of node to hover
|
|
322
|
+
*/
|
|
323
|
+
private hoverNode;
|
|
324
|
+
/**
|
|
325
|
+
* Move given node to target position
|
|
326
|
+
*
|
|
327
|
+
* @param nodeKey id of node to move
|
|
328
|
+
* @param point target position
|
|
329
|
+
*/
|
|
330
|
+
private moveNode;
|
|
331
|
+
/**
|
|
332
|
+
* Callback invoked when layout worker has finished computing layout
|
|
333
|
+
*/
|
|
334
|
+
private onLayoutComputationDone;
|
|
335
|
+
/**
|
|
336
|
+
* Callback invoked when a request is sent to the layout worker
|
|
337
|
+
*/
|
|
338
|
+
private onLayoutComputationStart;
|
|
339
|
+
/**
|
|
340
|
+
* Move handler - drag behaviour
|
|
341
|
+
*
|
|
342
|
+
* @param event mouse event
|
|
343
|
+
*/
|
|
344
|
+
private onDocumentMouseMove;
|
|
345
|
+
/**
|
|
346
|
+
* On mouse up, stop drag - reset stored mousedown keys and remove moving listener
|
|
347
|
+
*/
|
|
348
|
+
private onDocumentMouseUp;
|
|
349
|
+
private onGraphAttributesUpdated;
|
|
350
|
+
private onGraphNodeAdded;
|
|
351
|
+
private onGraphEdgeAdded;
|
|
352
|
+
private onGraphEdgeDropped;
|
|
353
|
+
private onGraphNodeDropped;
|
|
354
|
+
private onGraphEdgeAttributesUpdated;
|
|
355
|
+
private onGraphNodeAttributesUpdated;
|
|
356
|
+
/**
|
|
357
|
+
* Apply a given layout to the graph
|
|
358
|
+
*
|
|
359
|
+
* @param layout layout to apply
|
|
360
|
+
*/
|
|
361
|
+
private setLayout;
|
|
362
|
+
/**
|
|
363
|
+
* Get relative strength definition based on all edge thickness provided
|
|
364
|
+
*
|
|
365
|
+
* @param attributes edge attributes
|
|
366
|
+
*/
|
|
367
|
+
private getRelativeStrength;
|
|
368
|
+
/**
|
|
369
|
+
* Disable hover state for given edge
|
|
370
|
+
*
|
|
371
|
+
* @param id id of edge to unhover
|
|
372
|
+
*/
|
|
373
|
+
private unhoverEdge;
|
|
374
|
+
/**
|
|
375
|
+
* Disable hover state for given node
|
|
376
|
+
*
|
|
377
|
+
* @param id id of node to unhover
|
|
378
|
+
*/
|
|
379
|
+
private unhoverNode;
|
|
380
|
+
/**
|
|
381
|
+
* Update edge style
|
|
382
|
+
*
|
|
383
|
+
* @param id id of edge to update
|
|
384
|
+
* @param attributes edge attributes
|
|
385
|
+
* @param source source node ID
|
|
386
|
+
* @param target target node ID
|
|
387
|
+
* @param sourceNodeAttributes source node attributes
|
|
388
|
+
* @param targetNodeAttributes target node attributes
|
|
389
|
+
*/
|
|
390
|
+
private updateEdgeStyle;
|
|
391
|
+
/**
|
|
392
|
+
* Update style for given edge
|
|
393
|
+
*
|
|
394
|
+
* @param edgeKey id of edge to update
|
|
395
|
+
*/
|
|
396
|
+
private updateEdgeStyleByKey;
|
|
397
|
+
/**
|
|
398
|
+
* Update visibility of graph parts.
|
|
399
|
+
*
|
|
400
|
+
* Applies culling to hide off-screen graphics, updates LOD based on zoom level
|
|
401
|
+
*/
|
|
402
|
+
private updateGraphVisibility;
|
|
403
|
+
/**
|
|
404
|
+
* Recompute the layout and apply it
|
|
405
|
+
*/
|
|
406
|
+
private updateLayout;
|
|
407
|
+
/**
|
|
408
|
+
* Update style of given node
|
|
409
|
+
*
|
|
410
|
+
* @param id id of node to update
|
|
411
|
+
* @param attributes node attributes
|
|
412
|
+
*/
|
|
413
|
+
private updateNodeStyle;
|
|
414
|
+
/**
|
|
415
|
+
* Update style of given group container
|
|
416
|
+
*
|
|
417
|
+
* @param id id of group to update
|
|
418
|
+
* @param nodes array of nodes that are part of the group
|
|
419
|
+
*/
|
|
420
|
+
private updateGroupContainerStyle;
|
|
421
|
+
/**
|
|
422
|
+
* Update style for given node
|
|
423
|
+
*
|
|
424
|
+
* @param nodeKey id of node to update
|
|
425
|
+
*/
|
|
426
|
+
private updateNodeStyleByKey;
|
|
427
|
+
/**
|
|
428
|
+
* Recalculate current strength range based on thickness properties
|
|
429
|
+
*/
|
|
430
|
+
private updateStrengthRange;
|
|
431
|
+
/**
|
|
432
|
+
* Update the visuals of each node, edge and group containers
|
|
433
|
+
*/
|
|
434
|
+
private updateStyles;
|
|
435
|
+
}
|
|
436
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../../src/shared/rendering/engine.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,KAAK,EACR,cAAc,EAGd,cAAc,EACd,eAAe,EAEf,cAAc,EACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAY,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI9C,OAAO,KAAK,EAA0B,aAAa,EAAE,MAAM,QAAQ,CAAC;AAoBpE,MAAM,WAAW,YAAY;IACzB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,UAAU,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,mBAAmB,E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yBzB,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,4BAA4B;IAKpC;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAyBjB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAuB3B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAYnB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAYnB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IAmCvB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;OAEG;YACW,YAAY;IA0E1B;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAUvB;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAQjC;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAK5B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;OAEG;IACH,OAAO,CAAC,YAAY;CAavB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as PIXI from 'pixi.js';
|
|
18
|
+
import type { DefaultTheme } from '@darajs/styled-components';
|
|
19
|
+
import type { SimulationNode } from '../../../types';
|
|
20
|
+
import type { TextureCache } from '../texture-cache';
|
|
21
|
+
import { MOUSE_EVENTS } from '../utils';
|
|
22
|
+
/**
|
|
23
|
+
* Represents a drawn Group Container object
|
|
24
|
+
*/
|
|
25
|
+
export declare class GroupContainerObject extends PIXI.EventEmitter<(typeof MOUSE_EVENTS)[number]> {
|
|
26
|
+
groupContainerGfx: PIXI.Container;
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Create a new group container, including sprites for:
|
|
30
|
+
* - rectangle
|
|
31
|
+
* - border
|
|
32
|
+
*/
|
|
33
|
+
private createGroupContainer;
|
|
34
|
+
/**
|
|
35
|
+
* Update container style of a given groupContainerGfx container
|
|
36
|
+
*
|
|
37
|
+
* @param groupContainerGfx group container graphics pixi container
|
|
38
|
+
* @param nodes list of simulation nodes
|
|
39
|
+
* @param textureCache texture cache instance
|
|
40
|
+
*/
|
|
41
|
+
static updateContainerStyle(groupContainerGfx: PIXI.Container, nodes: SimulationNode[], textureCache: TextureCache, theme: DefaultTheme): void;
|
|
42
|
+
/**
|
|
43
|
+
* Moves all group container graphics to given position
|
|
44
|
+
*
|
|
45
|
+
* @param position position to move to
|
|
46
|
+
*/
|
|
47
|
+
updatePosition(position: PIXI.PointData): void;
|
|
48
|
+
/**
|
|
49
|
+
* Update styles of all group container graphics
|
|
50
|
+
*
|
|
51
|
+
* @param nodeStyle current node style
|
|
52
|
+
* @param textureCache texture cache instance
|
|
53
|
+
*/
|
|
54
|
+
updateStyle(nodes: SimulationNode[], textureCache: TextureCache, theme: DefaultTheme): void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=group-container-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-container-object.d.ts","sourceRoot":"","sources":["../../../../../src/shared/rendering/grouping/group-container-object.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAA0B,MAAM,UAAU,CAAC;AAKhE;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACtF,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;;IAOlC;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACvB,iBAAiB,EAAE,IAAI,CAAC,SAAS,EACjC,KAAK,EAAE,cAAc,EAAE,EACvB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,YAAY,GACpB,IAAI;IAwCP;;;;OAIG;IACH,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,IAAI;IAI9C;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI;CAsB9F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/rendering/grouping/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { DefaultTheme } from '@darajs/styled-components';
|
|
18
|
+
import type { NodeCategory } from '../../../types';
|
|
19
|
+
export declare const BORDER_PADDING = 2;
|
|
20
|
+
/**
|
|
21
|
+
* Defines complete set of information used to determine node visuals
|
|
22
|
+
*/
|
|
23
|
+
export interface PixiNodeStyle {
|
|
24
|
+
/** Node background color */
|
|
25
|
+
color?: string;
|
|
26
|
+
/** The category the node belongs to */
|
|
27
|
+
category: NodeCategory;
|
|
28
|
+
/** Border/shadow color */
|
|
29
|
+
highlight_color?: string;
|
|
30
|
+
/** Whether there is a edge currently selected */
|
|
31
|
+
isEdgeSelected: boolean;
|
|
32
|
+
/** Whether there is a new edge being created from this node */
|
|
33
|
+
isSourceOfNewEdge: boolean;
|
|
34
|
+
/** Node text */
|
|
35
|
+
label: string;
|
|
36
|
+
/** Node text color */
|
|
37
|
+
label_color?: string;
|
|
38
|
+
/** Node text font size */
|
|
39
|
+
label_size?: number;
|
|
40
|
+
/** Node size */
|
|
41
|
+
size: number;
|
|
42
|
+
/** Current node state */
|
|
43
|
+
state: NodeState;
|
|
44
|
+
/** Current theme object */
|
|
45
|
+
theme: DefaultTheme;
|
|
46
|
+
/** Whether the node should show as a group node or not */
|
|
47
|
+
isGroupNode?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Current node state
|
|
51
|
+
*/
|
|
52
|
+
export interface NodeState {
|
|
53
|
+
/** Whether an edge connected to the node is selected */
|
|
54
|
+
attachedEdgeSelected: boolean;
|
|
55
|
+
hover: boolean;
|
|
56
|
+
matched: boolean;
|
|
57
|
+
selected: boolean;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../../src/shared/rendering/node/definitions.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,QAAQ,EAAE,YAAY,CAAC;IACvB,0BAA0B;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,cAAc,EAAE,OAAO,CAAC;IACxB,+DAA+D;IAC/D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,2BAA2B;IAC3B,KAAK,EAAE,YAAY,CAAC;IACpB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,wDAAwD;IACxD,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { NodeObject } from './node-object';
|
|
18
|
+
export { type PixiNodeStyle } from './definitions';
|
|
19
|
+
export { getNodeSize } from './utils';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/rendering/node/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
import { EventEmitter } from 'pixi.js';
|
|
3
|
+
import type { ZoomState } from '../../../types';
|
|
4
|
+
import type { TextureCache } from '../texture-cache';
|
|
5
|
+
import { MOUSE_EVENTS } from '../utils';
|
|
6
|
+
import type { NodeState, PixiNodeStyle } from './definitions';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a drawn Node object
|
|
9
|
+
*/
|
|
10
|
+
export declare class NodeObject extends EventEmitter<(typeof MOUSE_EVENTS)[number]> {
|
|
11
|
+
nodeGfx: PIXI.Container;
|
|
12
|
+
nodeLabelGfx: PIXI.Container;
|
|
13
|
+
/**
|
|
14
|
+
* Current node state
|
|
15
|
+
*/
|
|
16
|
+
state: NodeState;
|
|
17
|
+
constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Create a new node container, including sprites for:
|
|
20
|
+
* - circle
|
|
21
|
+
* - border
|
|
22
|
+
*/
|
|
23
|
+
private createNode;
|
|
24
|
+
/**
|
|
25
|
+
* Create a new node label, including a sprite for the text
|
|
26
|
+
*/
|
|
27
|
+
private createNodeLabel;
|
|
28
|
+
/**
|
|
29
|
+
* Update node style of a given nodeGfx container
|
|
30
|
+
*
|
|
31
|
+
* @param nodeGfx node graphics container
|
|
32
|
+
* @param nodeStyle current node style
|
|
33
|
+
* @param textureCache texture cache instance
|
|
34
|
+
*/
|
|
35
|
+
static updateNodeStyle(nodeGfx: PIXI.Container, nodeStyle: PixiNodeStyle, textureCache: TextureCache): void;
|
|
36
|
+
/**
|
|
37
|
+
* Update node style of a given nodeLabelGfx container
|
|
38
|
+
*
|
|
39
|
+
* @param nodeLabelGfx node label graphics container
|
|
40
|
+
* @param nodeStyle current node style
|
|
41
|
+
* @param textureCache texture cache instance
|
|
42
|
+
*/
|
|
43
|
+
static updateNodeLabelStyle(nodeLabelGfx: PIXI.Container, nodeStyle: PixiNodeStyle, textureCache: TextureCache): void;
|
|
44
|
+
/**
|
|
45
|
+
* Update visibility of node elements based on zoomstep
|
|
46
|
+
*
|
|
47
|
+
* @param nodeGfx node graphics container
|
|
48
|
+
* @param zoomStep zoom step
|
|
49
|
+
*/
|
|
50
|
+
static updateNodeVisibility(nodeGfx: PIXI.Container, zoomState: ZoomState, state: NodeState): void;
|
|
51
|
+
/**
|
|
52
|
+
* Update visibility of node label elements based on zoomstep
|
|
53
|
+
*
|
|
54
|
+
* @param nodeGfx node label graphics container
|
|
55
|
+
* @param zoomStep zoom step
|
|
56
|
+
*/
|
|
57
|
+
static updateNodeLabelVisibility(nodeLabelGfx: PIXI.Container, zoomState: ZoomState): void;
|
|
58
|
+
/**
|
|
59
|
+
* Moves all node graphics to given position
|
|
60
|
+
*
|
|
61
|
+
* @param position position to move to
|
|
62
|
+
*/
|
|
63
|
+
updatePosition(position: PIXI.PointData): void;
|
|
64
|
+
/**
|
|
65
|
+
* Update styles of all node graphics
|
|
66
|
+
*
|
|
67
|
+
* @param nodeStyle current node style
|
|
68
|
+
* @param textureCache texture cache instance
|
|
69
|
+
*/
|
|
70
|
+
updateStyle(nodeStyle: PixiNodeStyle, textureCache: TextureCache): void;
|
|
71
|
+
/**
|
|
72
|
+
* Update visibility of node graphics
|
|
73
|
+
*
|
|
74
|
+
* @param zoomStep current zoom step
|
|
75
|
+
*/
|
|
76
|
+
updateVisibility(zoomState: ZoomState): void;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=node-object.d.ts.map
|