@babylonjs/shared-ui-components 5.28.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/colorPicker/colorComponentEntry.d.ts +18 -0
- package/colorPicker/colorComponentEntry.js +37 -0
- package/colorPicker/colorComponentEntry.js.map +1 -0
- package/colorPicker/colorPicker.d.ts +43 -0
- package/colorPicker/colorPicker.js +137 -0
- package/colorPicker/colorPicker.js.map +1 -0
- package/colorPicker/hexColor.d.ts +20 -0
- package/colorPicker/hexColor.js +43 -0
- package/colorPicker/hexColor.js.map +1 -0
- package/components/Button.d.ts +10 -0
- package/components/Button.js +7 -0
- package/components/Button.js.map +1 -0
- package/components/Icon.d.ts +6 -0
- package/components/Icon.js +7 -0
- package/components/Icon.js.map +1 -0
- package/components/Label.d.ts +7 -0
- package/components/Label.js +7 -0
- package/components/Label.js.map +1 -0
- package/components/MessageDialog.d.ts +7 -0
- package/components/MessageDialog.js +23 -0
- package/components/MessageDialog.js.map +1 -0
- package/components/Toggle.d.ts +8 -0
- package/components/Toggle.js +16 -0
- package/components/Toggle.js.map +1 -0
- package/components/bars/CommandBarComponent.d.ts +16 -0
- package/components/bars/CommandBarComponent.js +69 -0
- package/components/bars/CommandBarComponent.js.map +1 -0
- package/components/bars/CommandButtonComponent.d.ts +11 -0
- package/components/bars/CommandButtonComponent.js +7 -0
- package/components/bars/CommandButtonComponent.js.map +1 -0
- package/components/bars/CommandDropdownComponent.d.ts +26 -0
- package/components/bars/CommandDropdownComponent.js +49 -0
- package/components/bars/CommandDropdownComponent.js.map +1 -0
- package/components/classNames.d.ts +2 -0
- package/components/classNames.js +19 -0
- package/components/classNames.js.map +1 -0
- package/components/colorPicker/ColorComponentEntry.d.ts +18 -0
- package/components/colorPicker/ColorComponentEntry.js +38 -0
- package/components/colorPicker/ColorComponentEntry.js.map +1 -0
- package/components/colorPicker/ColorPicker.d.ts +43 -0
- package/components/colorPicker/ColorPicker.js +138 -0
- package/components/colorPicker/ColorPicker.js.map +1 -0
- package/components/colorPicker/HexColor.d.ts +20 -0
- package/components/colorPicker/HexColor.js +46 -0
- package/components/colorPicker/HexColor.js.map +1 -0
- package/components/lines/ColorLineComponent.d.ts +40 -0
- package/components/lines/ColorLineComponent.js +146 -0
- package/components/lines/ColorLineComponent.js.map +1 -0
- package/components/lines/ColorPickerLineComponent.d.ts +33 -0
- package/components/lines/ColorPickerLineComponent.js +62 -0
- package/components/lines/ColorPickerLineComponent.js.map +1 -0
- package/components/lines/FileButtonLineComponent.d.ts +16 -0
- package/components/lines/FileButtonLineComponent.js +22 -0
- package/components/lines/FileButtonLineComponent.js.map +1 -0
- package/components/lines/NumericInputComponent.d.ts +31 -0
- package/components/lines/NumericInputComponent.js +87 -0
- package/components/lines/NumericInputComponent.js.map +1 -0
- package/license.md +71 -0
- package/lines/booleanLineComponent.d.ts +11 -0
- package/lines/booleanLineComponent.js +15 -0
- package/lines/booleanLineComponent.js.map +1 -0
- package/lines/buttonLineComponent.d.ts +12 -0
- package/lines/buttonLineComponent.js +11 -0
- package/lines/buttonLineComponent.js.map +1 -0
- package/lines/checkBoxLineComponent.d.ts +36 -0
- package/lines/checkBoxLineComponent.js +89 -0
- package/lines/checkBoxLineComponent.js.map +1 -0
- package/lines/color3LineComponent.d.ts +18 -0
- package/lines/color3LineComponent.js +10 -0
- package/lines/color3LineComponent.js.map +1 -0
- package/lines/color4LineComponent.d.ts +18 -0
- package/lines/color4LineComponent.js +10 -0
- package/lines/color4LineComponent.js.map +1 -0
- package/lines/colorLineComponent.d.ts +40 -0
- package/lines/colorLineComponent.js +145 -0
- package/lines/colorLineComponent.js.map +1 -0
- package/lines/colorPickerComponent.d.ts +31 -0
- package/lines/colorPickerComponent.js +61 -0
- package/lines/colorPickerComponent.js.map +1 -0
- package/lines/draggableLineComponent.d.ts +9 -0
- package/lines/draggableLineComponent.js +13 -0
- package/lines/draggableLineComponent.js.map +1 -0
- package/lines/fileButtonLineComponent.d.ts +17 -0
- package/lines/fileButtonLineComponent.js +21 -0
- package/lines/fileButtonLineComponent.js.map +1 -0
- package/lines/fileMultipleButtonLineComponent.d.ts +17 -0
- package/lines/fileMultipleButtonLineComponent.js +21 -0
- package/lines/fileMultipleButtonLineComponent.js.map +1 -0
- package/lines/floatLineComponent.d.ts +50 -0
- package/lines/floatLineComponent.js +176 -0
- package/lines/floatLineComponent.js.map +1 -0
- package/lines/hexLineComponent.d.ts +40 -0
- package/lines/hexLineComponent.js +122 -0
- package/lines/hexLineComponent.js.map +1 -0
- package/lines/iSelectedLineContainer.d.ts +4 -0
- package/lines/iSelectedLineContainer.js +2 -0
- package/lines/iSelectedLineContainer.js.map +1 -0
- package/lines/iconButtonLineComponent.d.ts +11 -0
- package/lines/iconButtonLineComponent.js +11 -0
- package/lines/iconButtonLineComponent.js.map +1 -0
- package/lines/iconComponent.d.ts +9 -0
- package/lines/iconComponent.js +8 -0
- package/lines/iconComponent.js.map +1 -0
- package/lines/indentedTextLineComponent.d.ts +16 -0
- package/lines/indentedTextLineComponent.js +27 -0
- package/lines/indentedTextLineComponent.js.map +1 -0
- package/lines/inputArrowsComponent.d.ts +13 -0
- package/lines/inputArrowsComponent.js +38 -0
- package/lines/inputArrowsComponent.js.map +1 -0
- package/lines/lineContainerComponent.d.ts +19 -0
- package/lines/lineContainerComponent.js +50 -0
- package/lines/lineContainerComponent.js.map +1 -0
- package/lines/linkButtonComponent.d.ts +16 -0
- package/lines/linkButtonComponent.js +21 -0
- package/lines/linkButtonComponent.js.map +1 -0
- package/lines/matrixLineComponent.d.ts +36 -0
- package/lines/matrixLineComponent.js +103 -0
- package/lines/matrixLineComponent.js.map +1 -0
- package/lines/messageLineComponent.d.ts +12 -0
- package/lines/messageLineComponent.js +15 -0
- package/lines/messageLineComponent.js.map +1 -0
- package/lines/numericInputComponent.d.ts +31 -0
- package/lines/numericInputComponent.js +86 -0
- package/lines/numericInputComponent.js.map +1 -0
- package/lines/optionsLineComponent.d.ts +48 -0
- package/lines/optionsLineComponent.js +119 -0
- package/lines/optionsLineComponent.js.map +1 -0
- package/lines/popup.d.ts +4 -0
- package/lines/popup.js +68 -0
- package/lines/popup.js.map +1 -0
- package/lines/radioLineComponent.d.ts +21 -0
- package/lines/radioLineComponent.js +27 -0
- package/lines/radioLineComponent.js.map +1 -0
- package/lines/sliderLineComponent.d.ts +37 -0
- package/lines/sliderLineComponent.js +90 -0
- package/lines/sliderLineComponent.js.map +1 -0
- package/lines/targetsProxy.d.ts +11 -0
- package/lines/targetsProxy.js +43 -0
- package/lines/targetsProxy.js.map +1 -0
- package/lines/textInputLineComponent.d.ts +47 -0
- package/lines/textInputLineComponent.js +155 -0
- package/lines/textInputLineComponent.js.map +1 -0
- package/lines/textLineComponent.d.ts +21 -0
- package/lines/textLineComponent.js +31 -0
- package/lines/textLineComponent.js.map +1 -0
- package/lines/unitButton.d.ts +8 -0
- package/lines/unitButton.js +8 -0
- package/lines/unitButton.js.map +1 -0
- package/lines/valueLineComponent.d.ts +15 -0
- package/lines/valueLineComponent.js +13 -0
- package/lines/valueLineComponent.js.map +1 -0
- package/lines/vector2LineComponent.d.ts +36 -0
- package/lines/vector2LineComponent.js +64 -0
- package/lines/vector2LineComponent.js.map +1 -0
- package/lines/vector3LineComponent.d.ts +41 -0
- package/lines/vector3LineComponent.js +75 -0
- package/lines/vector3LineComponent.js.map +1 -0
- package/lines/vector4LineComponent.d.ts +42 -0
- package/lines/vector4LineComponent.js +82 -0
- package/lines/vector4LineComponent.js.map +1 -0
- package/nodeGraphSystem/displayLedger.d.ts +5 -0
- package/nodeGraphSystem/displayLedger.js +4 -0
- package/nodeGraphSystem/displayLedger.js.map +1 -0
- package/nodeGraphSystem/frameNodePort.d.ts +25 -0
- package/nodeGraphSystem/frameNodePort.js +60 -0
- package/nodeGraphSystem/frameNodePort.js.map +1 -0
- package/nodeGraphSystem/graphCanvas.d.ts +111 -0
- package/nodeGraphSystem/graphCanvas.js +1132 -0
- package/nodeGraphSystem/graphCanvas.js.map +1 -0
- package/nodeGraphSystem/graphFrame.d.ts +153 -0
- package/nodeGraphSystem/graphFrame.js +1329 -0
- package/nodeGraphSystem/graphFrame.js.map +1 -0
- package/nodeGraphSystem/graphNode.d.ts +79 -0
- package/nodeGraphSystem/graphNode.js +460 -0
- package/nodeGraphSystem/graphNode.js.map +1 -0
- package/nodeGraphSystem/interfaces/displayManager.d.ts +13 -0
- package/nodeGraphSystem/interfaces/displayManager.js +2 -0
- package/nodeGraphSystem/interfaces/displayManager.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeContainer.d.ts +6 -0
- package/nodeGraphSystem/interfaces/nodeContainer.js +2 -0
- package/nodeGraphSystem/interfaces/nodeContainer.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeData.d.ts +15 -0
- package/nodeGraphSystem/interfaces/nodeData.js +2 -0
- package/nodeGraphSystem/interfaces/nodeData.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.d.ts +26 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js +2 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js.map +1 -0
- package/nodeGraphSystem/interfaces/portData.d.ts +28 -0
- package/nodeGraphSystem/interfaces/portData.js +8 -0
- package/nodeGraphSystem/interfaces/portData.js.map +1 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +6 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.js +2 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.js.map +1 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +11 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js +2 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js.map +1 -0
- package/nodeGraphSystem/nodeLink.d.ts +31 -0
- package/nodeGraphSystem/nodeLink.js +183 -0
- package/nodeGraphSystem/nodeLink.js.map +1 -0
- package/nodeGraphSystem/nodePort.d.ts +35 -0
- package/nodeGraphSystem/nodePort.js +129 -0
- package/nodeGraphSystem/nodePort.js.map +1 -0
- package/nodeGraphSystem/propertyLedger.d.ts +8 -0
- package/nodeGraphSystem/propertyLedger.js +4 -0
- package/nodeGraphSystem/propertyLedger.js.map +1 -0
- package/nodeGraphSystem/stateManager.d.ts +45 -0
- package/nodeGraphSystem/stateManager.js +19 -0
- package/nodeGraphSystem/stateManager.js.map +1 -0
- package/nodeGraphSystem/tools.d.ts +5 -0
- package/nodeGraphSystem/tools.js +37 -0
- package/nodeGraphSystem/tools.js.map +1 -0
- package/nodeGraphSystem/typeLedger.d.ts +8 -0
- package/nodeGraphSystem/typeLedger.js +3 -0
- package/nodeGraphSystem/typeLedger.js.map +1 -0
- package/nodeGraphSystem/types/framePortData.d.ts +7 -0
- package/nodeGraphSystem/types/framePortData.js +2 -0
- package/nodeGraphSystem/types/framePortData.js.map +1 -0
- package/package.json +55 -0
- package/propertyChangedEvent.d.ts +7 -0
- package/propertyChangedEvent.js +3 -0
- package/propertyChangedEvent.js.map +1 -0
- package/readme.md +6 -0
- package/stories/Button.stories.d.ts +10 -0
- package/stories/Button.stories.js +20 -0
- package/stories/Button.stories.js.map +1 -0
- package/stories/Icon.stories.d.ts +9 -0
- package/stories/Icon.stories.js +17 -0
- package/stories/Icon.stories.js.map +1 -0
- package/stories/Label.stories.d.ts +8 -0
- package/stories/Label.stories.js +11 -0
- package/stories/Label.stories.js.map +1 -0
- package/stories/MessageDialog.stories.d.ts +9 -0
- package/stories/MessageDialog.stories.js +20 -0
- package/stories/MessageDialog.stories.js.map +1 -0
- package/stories/Toggle.stories.d.ts +9 -0
- package/stories/Toggle.stories.js +18 -0
- package/stories/Toggle.stories.js.map +1 -0
- package/stories/bars/CommandBarComponent.stories.d.ts +11 -0
- package/stories/bars/CommandBarComponent.stories.js +13 -0
- package/stories/bars/CommandBarComponent.stories.js.map +1 -0
- package/stories/bars/CommandButtonComponent.stories.d.ts +6 -0
- package/stories/bars/CommandButtonComponent.stories.js +7 -0
- package/stories/bars/CommandButtonComponent.stories.js.map +1 -0
- package/stories/colorPicker/ColorPicker.stories.d.ts +11 -0
- package/stories/colorPicker/ColorPicker.stories.js +5 -0
- package/stories/colorPicker/ColorPicker.stories.js.map +1 -0
- package/stories/lines/ColorLineComponent.stories.d.ts +21 -0
- package/stories/lines/ColorLineComponent.stories.js +10 -0
- package/stories/lines/ColorLineComponent.stories.js.map +1 -0
- package/stories/lines/ColorPickerLineComponent.stories.d.ts +14 -0
- package/stories/lines/ColorPickerLineComponent.stories.js +11 -0
- package/stories/lines/ColorPickerLineComponent.stories.js.map +1 -0
- package/stories/lines/FileButtonLineComponent.stories.d.ts +6 -0
- package/stories/lines/FileButtonLineComponent.stories.js +6 -0
- package/stories/lines/FileButtonLineComponent.stories.js.map +1 -0
- package/stories/lines/NumericInputComponent.stories.d.ts +11 -0
- package/stories/lines/NumericInputComponent.stories.js +6 -0
- package/stories/lines/NumericInputComponent.stories.js.map +1 -0
- package/stringTools.d.ts +11 -0
- package/stringTools.js +89 -0
- package/stringTools.js.map +1 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js +15 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +17 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js +56 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js +13 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +17 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js +39 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js +17 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js +26 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js +18 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +16 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js +28 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js +18 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js +17 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js +15 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js +35 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/lockObject.d.ts +9 -0
- package/tabs/propertyGrids/lockObject.js +12 -0
- package/tabs/propertyGrids/lockObject.js.map +1 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { GraphNode } from "../graphNode";
|
3
|
+
export declare enum PortDataDirection {
|
4
|
+
/** Input */
|
5
|
+
Input = 0,
|
6
|
+
/** Output */
|
7
|
+
Output = 1
|
8
|
+
}
|
9
|
+
export interface IPortData {
|
10
|
+
data: any;
|
11
|
+
name: string;
|
12
|
+
internalName: string;
|
13
|
+
isExposedOnFrame: boolean;
|
14
|
+
exposedPortPosition: number;
|
15
|
+
isConnected: boolean;
|
16
|
+
direction: PortDataDirection;
|
17
|
+
ownerData: any;
|
18
|
+
connectedPort: Nullable<IPortData>;
|
19
|
+
needDualDirectionValidation: boolean;
|
20
|
+
hasEndpoints: boolean;
|
21
|
+
endpoints: Nullable<IPortData[]>;
|
22
|
+
updateDisplayName: (newName: string) => void;
|
23
|
+
canConnectTo: (port: IPortData) => boolean;
|
24
|
+
connectTo: (port: IPortData) => void;
|
25
|
+
disconnectFrom: (port: IPortData) => void;
|
26
|
+
checkCompatibilityState(port: IPortData): number;
|
27
|
+
getCompatibilityIssueMessage(issue: number, targetNode: GraphNode, targetPort: IPortData): string;
|
28
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export var PortDataDirection;
|
2
|
+
(function (PortDataDirection) {
|
3
|
+
/** Input */
|
4
|
+
PortDataDirection[PortDataDirection["Input"] = 0] = "Input";
|
5
|
+
/** Output */
|
6
|
+
PortDataDirection[PortDataDirection["Output"] = 1] = "Output";
|
7
|
+
})(PortDataDirection || (PortDataDirection = {}));
|
8
|
+
//# sourceMappingURL=portData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"portData.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/nodeGraphSystem/interfaces/portData.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IACzB,YAAY;IACZ,2DAAK,CAAA;IACL,aAAa;IACb,6DAAM,CAAA;AACV,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { GraphNode } from \"../graphNode\";\r\n\r\nexport enum PortDataDirection {\r\n /** Input */\r\n Input,\r\n /** Output */\r\n Output,\r\n}\r\n\r\nexport interface IPortData {\r\n data: any;\r\n name: string;\r\n internalName: string;\r\n isExposedOnFrame: boolean;\r\n exposedPortPosition: number;\r\n isConnected: boolean;\r\n direction: PortDataDirection;\r\n ownerData: any;\r\n connectedPort: Nullable<IPortData>;\r\n needDualDirectionValidation: boolean;\r\n hasEndpoints: boolean;\r\n endpoints: Nullable<IPortData[]>;\r\n\r\n updateDisplayName: (newName: string) => void;\r\n canConnectTo: (port: IPortData) => boolean;\r\n connectTo: (port: IPortData) => void;\r\n disconnectFrom: (port: IPortData) => void;\r\n checkCompatibilityState(port: IPortData): number;\r\n getCompatibilityIssueMessage(issue: number, targetNode: GraphNode, targetPort: IPortData): string;\r\n}\r\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"propertyComponentProps.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/nodeGraphSystem/interfaces/propertyComponentProps.ts"],"names":[],"mappings":"","sourcesContent":["import type { StateManager } from \"../stateManager\";\r\nimport type { INodeData } from \"./nodeData\";\r\n\r\nexport interface IPropertyComponentProps {\r\n stateManager: StateManager;\r\n nodeData: INodeData;\r\n}\r\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { GraphFrame } from "../graphFrame";
|
3
|
+
import type { GraphNode } from "../graphNode";
|
4
|
+
import type { NodeLink } from "../nodeLink";
|
5
|
+
import type { NodePort } from "../nodePort";
|
6
|
+
import type { FramePortData } from "../types/framePortData";
|
7
|
+
export interface ISelectionChangedOptions {
|
8
|
+
selection: Nullable<GraphNode | NodeLink | GraphFrame | NodePort | FramePortData>;
|
9
|
+
forceKeepSelection?: boolean;
|
10
|
+
marqueeSelection?: boolean;
|
11
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"selectionChangedOptions.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/nodeGraphSystem/interfaces/selectionChangedOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { GraphFrame } from \"../graphFrame\";\r\nimport type { GraphNode } from \"../graphNode\";\r\n\r\nimport type { NodeLink } from \"../nodeLink\";\r\nimport type { NodePort } from \"../nodePort\";\r\nimport type { FramePortData } from \"../types/framePortData\";\r\n\r\nexport interface ISelectionChangedOptions {\r\n selection: Nullable<GraphNode | NodeLink | GraphFrame | NodePort | FramePortData>;\r\n forceKeepSelection?: boolean;\r\n marqueeSelection?: boolean;\r\n}\r\n"]}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
2
|
+
import type { FrameNodePort } from "./frameNodePort";
|
3
|
+
import type { NodePort } from "./nodePort";
|
4
|
+
import type { GraphNode } from "./graphNode";
|
5
|
+
import type { GraphCanvasComponent } from "./graphCanvas";
|
6
|
+
export declare class NodeLink {
|
7
|
+
private _graphCanvas;
|
8
|
+
private _portA;
|
9
|
+
private _portB?;
|
10
|
+
private _nodeA;
|
11
|
+
private _nodeB?;
|
12
|
+
private _path;
|
13
|
+
private _selectionPath;
|
14
|
+
private _onSelectionChangedObserver;
|
15
|
+
private _isVisible;
|
16
|
+
private _isTargetCandidate;
|
17
|
+
onDisposedObservable: Observable<NodeLink>;
|
18
|
+
get isTargetCandidate(): boolean;
|
19
|
+
set isTargetCandidate(value: boolean);
|
20
|
+
get isVisible(): boolean;
|
21
|
+
set isVisible(value: boolean);
|
22
|
+
get portA(): FrameNodePort | NodePort;
|
23
|
+
get portB(): FrameNodePort | NodePort | undefined;
|
24
|
+
get nodeA(): GraphNode;
|
25
|
+
get nodeB(): GraphNode | undefined;
|
26
|
+
intersectsWith(rect: DOMRect): boolean;
|
27
|
+
update(endX?: number, endY?: number, straight?: boolean): void;
|
28
|
+
constructor(graphCanvas: GraphCanvasComponent, portA: NodePort, nodeA: GraphNode, portB?: NodePort, nodeB?: GraphNode);
|
29
|
+
onClick(evt: MouseEvent): void;
|
30
|
+
dispose(notify?: boolean): void;
|
31
|
+
}
|
@@ -0,0 +1,183 @@
|
|
1
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
2
|
+
import { RefreshNode } from "./tools.js";
|
3
|
+
import commonStyles from "./common.modules.scss";
|
4
|
+
import styles from "./nodeLink.modules.scss";
|
5
|
+
export class NodeLink {
|
6
|
+
constructor(graphCanvas, portA, nodeA, portB, nodeB) {
|
7
|
+
this._isVisible = true;
|
8
|
+
this._isTargetCandidate = false;
|
9
|
+
this.onDisposedObservable = new Observable();
|
10
|
+
this._portA = portA;
|
11
|
+
this._portB = portB;
|
12
|
+
this._nodeA = nodeA;
|
13
|
+
this._nodeB = nodeB;
|
14
|
+
this._graphCanvas = graphCanvas;
|
15
|
+
const document = portA.element.ownerDocument;
|
16
|
+
const svg = graphCanvas.svgCanvas;
|
17
|
+
// Create path
|
18
|
+
this._path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
19
|
+
this._path.setAttribute("fill", "none");
|
20
|
+
this._path.classList.add(styles["link"]);
|
21
|
+
svg.appendChild(this._path);
|
22
|
+
this._selectionPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
23
|
+
this._selectionPath.setAttribute("fill", "none");
|
24
|
+
this._selectionPath.classList.add(styles["selection-link"]);
|
25
|
+
svg.appendChild(this._selectionPath);
|
26
|
+
this._selectionPath.onmousedown = (evt) => this.onClick(evt);
|
27
|
+
if (this._portB) {
|
28
|
+
// Update
|
29
|
+
this.update();
|
30
|
+
}
|
31
|
+
this._onSelectionChangedObserver = this._graphCanvas.stateManager.onSelectionChangedObservable.add((options) => {
|
32
|
+
const { selection } = options || {};
|
33
|
+
if (selection === this) {
|
34
|
+
this._path.classList.add(styles["selected"]);
|
35
|
+
this._selectionPath.classList.add(styles["selected"]);
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
this._path.classList.remove(styles["selected"]);
|
39
|
+
this._selectionPath.classList.remove(styles["selected"]);
|
40
|
+
}
|
41
|
+
});
|
42
|
+
}
|
43
|
+
get isTargetCandidate() {
|
44
|
+
return this._isTargetCandidate;
|
45
|
+
}
|
46
|
+
set isTargetCandidate(value) {
|
47
|
+
if (this._isTargetCandidate === value) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
this._isTargetCandidate = value;
|
51
|
+
if (value) {
|
52
|
+
this._path.classList.add(styles["target-candidate"]);
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
this._path.classList.remove(styles["target-candidate"]);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
get isVisible() {
|
59
|
+
return this._isVisible;
|
60
|
+
}
|
61
|
+
set isVisible(value) {
|
62
|
+
this._isVisible = value;
|
63
|
+
if (!value) {
|
64
|
+
this._path.classList.add(commonStyles["hidden"]);
|
65
|
+
this._selectionPath.classList.add(commonStyles["hidden"]);
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
this._path.classList.remove(commonStyles["hidden"]);
|
69
|
+
this._selectionPath.classList.remove(commonStyles["hidden"]);
|
70
|
+
}
|
71
|
+
this.update();
|
72
|
+
}
|
73
|
+
get portA() {
|
74
|
+
return this._portA;
|
75
|
+
}
|
76
|
+
get portB() {
|
77
|
+
return this._portB;
|
78
|
+
}
|
79
|
+
get nodeA() {
|
80
|
+
return this._nodeA;
|
81
|
+
}
|
82
|
+
get nodeB() {
|
83
|
+
return this._nodeB;
|
84
|
+
}
|
85
|
+
intersectsWith(rect) {
|
86
|
+
const locatRect = this._path.getBoundingClientRect();
|
87
|
+
if (rect.left > locatRect.right || rect.right < locatRect.left || rect.top > locatRect.bottom || rect.bottom < locatRect.top) {
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
const svg = this._graphCanvas.svgCanvas;
|
91
|
+
const rootRect = svg.getBoundingClientRect();
|
92
|
+
const left = rect.x - rootRect.x;
|
93
|
+
const top = rect.y - rootRect.y;
|
94
|
+
const right = left + rect.width;
|
95
|
+
const bottom = top + rect.height;
|
96
|
+
const sampleRate = 10; // Checking 10 times on the path should be enough
|
97
|
+
for (let index = 0; index < 1; index += 1 / sampleRate) {
|
98
|
+
const point = this._path.getPointAtLength(index * this._path.getTotalLength());
|
99
|
+
if (left < point.x && right > point.x && top < point.y && bottom > point.y) {
|
100
|
+
return true;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
return false;
|
104
|
+
}
|
105
|
+
update(endX = 0, endY = 0, straight = false) {
|
106
|
+
const rectA = this._portA.element.getBoundingClientRect();
|
107
|
+
const rootRect = this._graphCanvas.canvasContainer.getBoundingClientRect();
|
108
|
+
const zoom = this._graphCanvas.zoom;
|
109
|
+
const xOffset = rootRect.left;
|
110
|
+
const yOffset = rootRect.top;
|
111
|
+
const startX = (rectA.left - xOffset + 0.5 * rectA.width) / zoom;
|
112
|
+
const startY = (rectA.top - yOffset + 0.5 * rectA.height) / zoom;
|
113
|
+
if (this._portB) {
|
114
|
+
const rectB = this._portB.element.getBoundingClientRect();
|
115
|
+
endX = (rectB.left - xOffset + 0.5 * rectB.width) / zoom;
|
116
|
+
endY = (rectB.top - yOffset + 0.5 * rectB.height) / zoom;
|
117
|
+
}
|
118
|
+
if (straight) {
|
119
|
+
this._path.setAttribute("d", `M${startX},${startY} L${endX},${endY}`);
|
120
|
+
this._path.setAttribute("stroke-dasharray", "10, 10");
|
121
|
+
this._path.setAttribute("stroke-linecap", "round");
|
122
|
+
}
|
123
|
+
else {
|
124
|
+
const deltaX = endX - startX;
|
125
|
+
const deltaY = endY - startY;
|
126
|
+
const tangentLength = Math.min(Math.sqrt(deltaX * deltaX + deltaY * deltaY) * 0.5, 300);
|
127
|
+
this._path.setAttribute("d", `M${startX},${startY} C${startX + tangentLength},${startY} ${endX - tangentLength},${endY} ${endX},${endY}`);
|
128
|
+
this._selectionPath.setAttribute("d", `M${startX},${startY} C${startX + tangentLength},${startY} ${endX - tangentLength},${endY} ${endX},${endY}`);
|
129
|
+
}
|
130
|
+
this._path.setAttribute("stroke", this._portA.element.style.backgroundColor);
|
131
|
+
}
|
132
|
+
onClick(evt) {
|
133
|
+
const stateManager = this._graphCanvas.stateManager;
|
134
|
+
if (evt.altKey) {
|
135
|
+
const nodeA = this._nodeA;
|
136
|
+
const pointA = this._portA.portData;
|
137
|
+
const nodeB = this._nodeB;
|
138
|
+
const pointB = this._portB.portData;
|
139
|
+
if (!stateManager.isElbowConnectionAllowed(this._portA, this._portB)) {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
// Create an elbow at the clicked location
|
143
|
+
stateManager.onNewNodeCreatedObservable.addOnce((newNode) => {
|
144
|
+
const newElbowBlock = newNode.content.data;
|
145
|
+
// Delete previous link
|
146
|
+
this.dispose();
|
147
|
+
// Connect to Elbow block
|
148
|
+
this._graphCanvas.connectNodes(nodeA, pointA, newNode, newNode.getPortDataForPortDataContent(newElbowBlock.input));
|
149
|
+
this._graphCanvas.connectNodes(newNode, newNode.getPortDataForPortDataContent(newElbowBlock.output), nodeB, pointB);
|
150
|
+
stateManager.onRebuildRequiredObservable.notifyObservers(true);
|
151
|
+
});
|
152
|
+
stateManager.onNewBlockRequiredObservable.notifyObservers({
|
153
|
+
type: "ElbowBlock",
|
154
|
+
targetX: evt.clientX,
|
155
|
+
targetY: evt.clientY,
|
156
|
+
needRepositioning: true,
|
157
|
+
});
|
158
|
+
return;
|
159
|
+
}
|
160
|
+
stateManager.onSelectionChangedObservable.notifyObservers({ selection: this });
|
161
|
+
}
|
162
|
+
dispose(notify = true) {
|
163
|
+
this._graphCanvas.stateManager.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);
|
164
|
+
if (this._path.parentElement) {
|
165
|
+
this._path.parentElement.removeChild(this._path);
|
166
|
+
}
|
167
|
+
if (this._selectionPath.parentElement) {
|
168
|
+
this._selectionPath.parentElement.removeChild(this._selectionPath);
|
169
|
+
}
|
170
|
+
if (this._nodeB) {
|
171
|
+
this._nodeA.links.splice(this._nodeA.links.indexOf(this), 1);
|
172
|
+
this._nodeB.links.splice(this._nodeB.links.indexOf(this), 1);
|
173
|
+
this._graphCanvas.links.splice(this._graphCanvas.links.indexOf(this), 1);
|
174
|
+
this._portA.portData.disconnectFrom(this._portB.portData);
|
175
|
+
RefreshNode(this._nodeB);
|
176
|
+
}
|
177
|
+
if (notify) {
|
178
|
+
this.onDisposedObservable.notifyObservers(this);
|
179
|
+
this.onDisposedObservable.clear();
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
183
|
+
//# sourceMappingURL=nodeLink.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nodeLink.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/nodeGraphSystem/nodeLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAMlD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,O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AAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAEzE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAO,CAAC,QAAQ,CAAC,CAAC;YAE3D,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC5B;QAED,IAAI,MAAM,EAAE;YACR,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAEhD,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;SACrC;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { FrameNodePort } from \"./frameNodePort\";\r\nimport type { NodePort } from \"./nodePort\";\r\nimport type { GraphNode } from \"./graphNode\";\r\nimport type { GraphCanvasComponent } from \"./graphCanvas\";\r\nimport type { ISelectionChangedOptions } from \"./interfaces/selectionChangedOptions\";\r\nimport { RefreshNode } from \"./tools\";\r\nimport commonStyles from \"./common.modules.scss\";\r\nimport styles from \"./nodeLink.modules.scss\";\r\n\r\nexport class NodeLink {\r\n private _graphCanvas: GraphCanvasComponent;\r\n private _portA: NodePort | FrameNodePort;\r\n private _portB?: NodePort | FrameNodePort;\r\n private _nodeA: GraphNode;\r\n private _nodeB?: GraphNode;\r\n private _path: SVGPathElement;\r\n private _selectionPath: SVGPathElement;\r\n private _onSelectionChangedObserver: Nullable<Observer<Nullable<ISelectionChangedOptions>>>;\r\n private _isVisible = true;\r\n private _isTargetCandidate = false;\r\n\r\n public onDisposedObservable = new Observable<NodeLink>();\r\n\r\n public get isTargetCandidate() {\r\n return this._isTargetCandidate;\r\n }\r\n\r\n public set isTargetCandidate(value: boolean) {\r\n if (this._isTargetCandidate === value) {\r\n return;\r\n }\r\n\r\n this._isTargetCandidate = value;\r\n\r\n if (value) {\r\n this._path.classList.add(styles[\"target-candidate\"]);\r\n } else {\r\n this._path.classList.remove(styles[\"target-candidate\"]);\r\n }\r\n }\r\n\r\n public get isVisible() {\r\n return this._isVisible;\r\n }\r\n\r\n public set isVisible(value: boolean) {\r\n this._isVisible = value;\r\n\r\n if (!value) {\r\n this._path.classList.add(commonStyles[\"hidden\"]);\r\n this._selectionPath.classList.add(commonStyles[\"hidden\"]);\r\n } else {\r\n this._path.classList.remove(commonStyles[\"hidden\"]);\r\n this._selectionPath.classList.remove(commonStyles[\"hidden\"]);\r\n }\r\n\r\n this.update();\r\n }\r\n\r\n public get portA() {\r\n return this._portA;\r\n }\r\n\r\n public get portB() {\r\n return this._portB;\r\n }\r\n\r\n public get nodeA() {\r\n return this._nodeA;\r\n }\r\n\r\n public get nodeB() {\r\n return this._nodeB;\r\n }\r\n\r\n public intersectsWith(rect: DOMRect) {\r\n const locatRect = this._path.getBoundingClientRect();\r\n if (rect.left > locatRect.right || rect.right < locatRect.left || rect.top > locatRect.bottom || rect.bottom < locatRect.top) {\r\n return false;\r\n }\r\n\r\n const svg = this._graphCanvas.svgCanvas as any as SVGSVGElement;\r\n const rootRect = svg.getBoundingClientRect();\r\n\r\n const left = rect.x - rootRect.x;\r\n const top = rect.y - rootRect.y;\r\n const right = left + rect.width;\r\n const bottom = top + rect.height;\r\n\r\n const sampleRate = 10; // Checking 10 times on the path should be enough\r\n\r\n for (let index = 0; index < 1; index += 1 / sampleRate) {\r\n const point = this._path.getPointAtLength(index * this._path.getTotalLength());\r\n if (left < point.x && right > point.x && top < point.y && bottom > point.y) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public update(endX = 0, endY = 0, straight = false) {\r\n const rectA = this._portA.element.getBoundingClientRect();\r\n const rootRect = this._graphCanvas.canvasContainer.getBoundingClientRect();\r\n const zoom = this._graphCanvas.zoom;\r\n const xOffset = rootRect.left;\r\n const yOffset = rootRect.top;\r\n\r\n const startX = (rectA.left - xOffset + 0.5 * rectA.width) / zoom;\r\n const startY = (rectA.top - yOffset + 0.5 * rectA.height) / zoom;\r\n\r\n if (this._portB) {\r\n const rectB = this._portB.element.getBoundingClientRect();\r\n endX = (rectB.left - xOffset + 0.5 * rectB.width) / zoom;\r\n endY = (rectB.top - yOffset + 0.5 * rectB.height) / zoom;\r\n }\r\n\r\n if (straight) {\r\n this._path.setAttribute(\"d\", `M${startX},${startY} L${endX},${endY}`);\r\n this._path.setAttribute(\"stroke-dasharray\", \"10, 10\");\r\n this._path.setAttribute(\"stroke-linecap\", \"round\");\r\n } else {\r\n const deltaX = endX - startX;\r\n const deltaY = endY - startY;\r\n const tangentLength = Math.min(Math.sqrt(deltaX * deltaX + deltaY * deltaY) * 0.5, 300);\r\n this._path.setAttribute(\"d\", `M${startX},${startY} C${startX + tangentLength},${startY} ${endX - tangentLength},${endY} ${endX},${endY}`);\r\n this._selectionPath.setAttribute(\"d\", `M${startX},${startY} C${startX + tangentLength},${startY} ${endX - tangentLength},${endY} ${endX},${endY}`);\r\n }\r\n this._path.setAttribute(\"stroke\", this._portA.element.style.backgroundColor!);\r\n }\r\n\r\n public constructor(graphCanvas: GraphCanvasComponent, portA: NodePort, nodeA: GraphNode, portB?: NodePort, nodeB?: GraphNode) {\r\n this._portA = portA;\r\n this._portB = portB;\r\n this._nodeA = nodeA;\r\n this._nodeB = nodeB;\r\n this._graphCanvas = graphCanvas;\r\n\r\n const document = portA.element.ownerDocument!;\r\n const svg = graphCanvas.svgCanvas;\r\n\r\n // Create path\r\n this._path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n this._path.setAttribute(\"fill\", \"none\");\r\n this._path.classList.add(styles[\"link\"]);\r\n\r\n svg.appendChild(this._path);\r\n\r\n this._selectionPath = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n this._selectionPath.setAttribute(\"fill\", \"none\");\r\n this._selectionPath.classList.add(styles[\"selection-link\"]);\r\n\r\n svg.appendChild(this._selectionPath);\r\n\r\n this._selectionPath.onmousedown = (evt: MouseEvent) => this.onClick(evt);\r\n\r\n if (this._portB) {\r\n // Update\r\n this.update();\r\n }\r\n\r\n this._onSelectionChangedObserver = this._graphCanvas.stateManager.onSelectionChangedObservable.add((options) => {\r\n const { selection } = options || {};\r\n if (selection === this) {\r\n this._path.classList.add(styles[\"selected\"]);\r\n this._selectionPath.classList.add(styles[\"selected\"]);\r\n } else {\r\n this._path.classList.remove(styles[\"selected\"]);\r\n this._selectionPath.classList.remove(styles[\"selected\"]);\r\n }\r\n });\r\n }\r\n\r\n onClick(evt: MouseEvent) {\r\n const stateManager = this._graphCanvas.stateManager;\r\n if (evt.altKey) {\r\n const nodeA = this._nodeA;\r\n const pointA = this._portA.portData;\r\n const nodeB = this._nodeB!;\r\n const pointB = this._portB!.portData;\r\n\r\n if (!stateManager.isElbowConnectionAllowed(this._portA, this._portB!)) {\r\n return;\r\n }\r\n\r\n // Create an elbow at the clicked location\r\n stateManager.onNewNodeCreatedObservable.addOnce((newNode) => {\r\n const newElbowBlock = newNode.content.data as any;\r\n\r\n // Delete previous link\r\n this.dispose();\r\n\r\n // Connect to Elbow block\r\n this._graphCanvas.connectNodes(nodeA, pointA, newNode, newNode.getPortDataForPortDataContent(newElbowBlock.input)!);\r\n this._graphCanvas.connectNodes(newNode, newNode.getPortDataForPortDataContent(newElbowBlock.output)!, nodeB, pointB);\r\n\r\n stateManager.onRebuildRequiredObservable.notifyObservers(true);\r\n });\r\n\r\n stateManager.onNewBlockRequiredObservable.notifyObservers({\r\n type: \"ElbowBlock\",\r\n targetX: evt.clientX,\r\n targetY: evt.clientY,\r\n needRepositioning: true,\r\n });\r\n return;\r\n }\r\n\r\n stateManager.onSelectionChangedObservable.notifyObservers({ selection: this });\r\n }\r\n\r\n public dispose(notify = true) {\r\n this._graphCanvas.stateManager.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);\r\n\r\n if (this._path.parentElement) {\r\n this._path.parentElement.removeChild(this._path);\r\n }\r\n\r\n if (this._selectionPath.parentElement) {\r\n this._selectionPath.parentElement.removeChild(this._selectionPath);\r\n }\r\n\r\n if (this._nodeB) {\r\n this._nodeA.links.splice(this._nodeA.links.indexOf(this), 1);\r\n this._nodeB.links.splice(this._nodeB.links.indexOf(this), 1);\r\n this._graphCanvas.links.splice(this._graphCanvas.links.indexOf(this), 1);\r\n\r\n this._portA.portData.disconnectFrom(this._portB!.portData);\r\n\r\n RefreshNode(this._nodeB);\r\n }\r\n\r\n if (notify) {\r\n this.onDisposedObservable.notifyObservers(this);\r\n\r\n this.onDisposedObservable.clear();\r\n }\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { Observer } from "@babylonjs/core/Misc/observable.js";
|
3
|
+
import type { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
4
|
+
import type { GraphNode } from "./graphNode";
|
5
|
+
import type { StateManager } from "./stateManager";
|
6
|
+
import type { ISelectionChangedOptions } from "./interfaces/selectionChangedOptions";
|
7
|
+
import type { FrameNodePort } from "./frameNodePort";
|
8
|
+
import type { IDisplayManager } from "./interfaces/displayManager";
|
9
|
+
import type { IPortData } from "./interfaces/portData";
|
10
|
+
export declare class NodePort {
|
11
|
+
portData: IPortData;
|
12
|
+
node: GraphNode;
|
13
|
+
protected _element: HTMLDivElement;
|
14
|
+
protected _img: HTMLImageElement;
|
15
|
+
protected _stateManager: StateManager;
|
16
|
+
protected _portLabelElement: Element;
|
17
|
+
protected _onCandidateLinkMovedObserver: Nullable<Observer<Nullable<Vector2>>>;
|
18
|
+
protected _onSelectionChangedObserver: Nullable<Observer<Nullable<ISelectionChangedOptions>>>;
|
19
|
+
protected _exposedOnFrame: boolean;
|
20
|
+
delegatedPort: Nullable<FrameNodePort>;
|
21
|
+
get element(): HTMLDivElement;
|
22
|
+
get portName(): string;
|
23
|
+
set portName(newName: string);
|
24
|
+
get disabled(): boolean;
|
25
|
+
hasLabel(): boolean;
|
26
|
+
get exposedOnFrame(): boolean;
|
27
|
+
set exposedOnFrame(value: boolean);
|
28
|
+
get exposedPortPosition(): number;
|
29
|
+
set exposedPortPosition(value: number);
|
30
|
+
private _isConnectedToNodeOutsideOfFrame;
|
31
|
+
refresh(): void;
|
32
|
+
constructor(portContainer: HTMLElement, portData: IPortData, node: GraphNode, stateManager: StateManager);
|
33
|
+
dispose(): void;
|
34
|
+
static CreatePortElement(portData: IPortData, node: GraphNode, root: HTMLElement, displayManager: Nullable<IDisplayManager>, stateManager: StateManager): NodePort;
|
35
|
+
}
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import commonStyles from "./common.modules.scss";
|
2
|
+
import localStyles from "./nodePort.modules.scss";
|
3
|
+
export class NodePort {
|
4
|
+
constructor(portContainer, portData, node, stateManager) {
|
5
|
+
this.portData = portData;
|
6
|
+
this.node = node;
|
7
|
+
this.delegatedPort = null;
|
8
|
+
this._element = portContainer.ownerDocument.createElement("div");
|
9
|
+
this._element.classList.add(commonStyles.port);
|
10
|
+
portContainer.appendChild(this._element);
|
11
|
+
this._stateManager = stateManager;
|
12
|
+
this._img = portContainer.ownerDocument.createElement("img");
|
13
|
+
this._element.appendChild(this._img);
|
14
|
+
// determine if node name is editable
|
15
|
+
if (portContainer.children[0].className === commonStyles["port-label"]) {
|
16
|
+
this._portLabelElement = portContainer.children[0];
|
17
|
+
}
|
18
|
+
this._element.port = this;
|
19
|
+
// Drag support
|
20
|
+
this._element.ondragstart = () => false;
|
21
|
+
this._onCandidateLinkMovedObserver = stateManager.onCandidateLinkMoved.add((coords) => {
|
22
|
+
const rect = this._element.getBoundingClientRect();
|
23
|
+
if (!coords || rect.left > coords.x || rect.right < coords.x || rect.top > coords.y || rect.bottom < coords.y) {
|
24
|
+
this._element.classList.remove(localStyles["selected"]);
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
this._element.classList.add(localStyles["selected"]);
|
28
|
+
this._stateManager.onCandidatePortSelectedObservable.notifyObservers(this);
|
29
|
+
});
|
30
|
+
this._onSelectionChangedObserver = this._stateManager.onSelectionChangedObservable.add((options) => {
|
31
|
+
const { selection } = options || {};
|
32
|
+
if (selection === this) {
|
33
|
+
this._img.classList.add(localStyles["selected"]);
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
this._img.classList.remove(localStyles["selected"]);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
this.refresh();
|
40
|
+
}
|
41
|
+
get element() {
|
42
|
+
if (this.delegatedPort) {
|
43
|
+
return this.delegatedPort.element;
|
44
|
+
}
|
45
|
+
return this._element;
|
46
|
+
}
|
47
|
+
get portName() {
|
48
|
+
return this.portData.name;
|
49
|
+
}
|
50
|
+
set portName(newName) {
|
51
|
+
if (this._portLabelElement) {
|
52
|
+
this.portData.updateDisplayName(newName);
|
53
|
+
this._portLabelElement.innerHTML = newName;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
get disabled() {
|
57
|
+
if (!this.portData.isConnected) {
|
58
|
+
return false;
|
59
|
+
}
|
60
|
+
else if (this._isConnectedToNodeOutsideOfFrame()) {
|
61
|
+
//connected to outside node
|
62
|
+
return true;
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
const link = this.node.getLinksForPortData(this.portData);
|
66
|
+
if (link.length) {
|
67
|
+
if (link[0].nodeB === this.node) {
|
68
|
+
// check if this node is the receiving
|
69
|
+
return true;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
hasLabel() {
|
76
|
+
return !!this._portLabelElement;
|
77
|
+
}
|
78
|
+
get exposedOnFrame() {
|
79
|
+
if (!!this.portData.isExposedOnFrame || this._isConnectedToNodeOutsideOfFrame()) {
|
80
|
+
return true;
|
81
|
+
}
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
set exposedOnFrame(value) {
|
85
|
+
if (this.disabled) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
this.portData.isExposedOnFrame = value;
|
89
|
+
}
|
90
|
+
get exposedPortPosition() {
|
91
|
+
return this.portData.exposedPortPosition;
|
92
|
+
}
|
93
|
+
set exposedPortPosition(value) {
|
94
|
+
this.portData.exposedPortPosition = value;
|
95
|
+
}
|
96
|
+
_isConnectedToNodeOutsideOfFrame() {
|
97
|
+
const link = this.node.getLinksForPortData(this.portData);
|
98
|
+
if (link.length) {
|
99
|
+
for (let i = 0; i < link.length; i++) {
|
100
|
+
if (link[i].nodeA.enclosingFrameId !== link[i].nodeB.enclosingFrameId) {
|
101
|
+
return true;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
return false;
|
106
|
+
}
|
107
|
+
refresh() {
|
108
|
+
this._stateManager.applyNodePortDesign(this.portData, this._element, this._img);
|
109
|
+
}
|
110
|
+
dispose() {
|
111
|
+
this._stateManager.onCandidateLinkMoved.remove(this._onCandidateLinkMovedObserver);
|
112
|
+
if (this._onSelectionChangedObserver) {
|
113
|
+
this._stateManager.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
static CreatePortElement(portData, node, root, displayManager, stateManager) {
|
117
|
+
const portContainer = root.ownerDocument.createElement("div");
|
118
|
+
portContainer.classList.add(commonStyles.portLine);
|
119
|
+
root.appendChild(portContainer);
|
120
|
+
if (!displayManager || displayManager.shouldDisplayPortLabels(portData)) {
|
121
|
+
const portLabel = root.ownerDocument.createElement("div");
|
122
|
+
portLabel.classList.add(commonStyles["port-label"]);
|
123
|
+
portLabel.innerHTML = portData.name;
|
124
|
+
portContainer.appendChild(portLabel);
|
125
|
+
}
|
126
|
+
return new NodePort(portContainer, portData, node, stateManager);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
//# sourceMappingURL=nodePort.js.map
|
@@ -0,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,CAAC,CAAC;QAEnD,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAEhC,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,uBAAuB,CAAC,QAAQ,CAAC,EAAE;YACrE,MAAM,SAAS,GAAG,IAAI,CAAC,aAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC3D,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;YACpD,SAAS,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC;YACpC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;SACxC;QAED,OAAO,IAAI,QAAQ,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACrE,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\nimport type { GraphNode } from \"./graphNode\";\r\nimport type { StateManager } from \"./stateManager\";\r\nimport type { ISelectionChangedOptions } from \"./interfaces/selectionChangedOptions\";\r\nimport type { FrameNodePort } from \"./frameNodePort\";\r\nimport type { IDisplayManager } from \"./interfaces/displayManager\";\r\nimport type { IPortData } from \"./interfaces/portData\";\r\nimport commonStyles from \"./common.modules.scss\";\r\nimport localStyles from \"./nodePort.modules.scss\";\r\n\r\nexport class NodePort {\r\n protected _element: HTMLDivElement;\r\n protected _img: HTMLImageElement;\r\n protected _stateManager: StateManager;\r\n protected _portLabelElement: Element;\r\n protected _onCandidateLinkMovedObserver: Nullable<Observer<Nullable<Vector2>>>;\r\n protected _onSelectionChangedObserver: Nullable<Observer<Nullable<ISelectionChangedOptions>>>;\r\n protected _exposedOnFrame: boolean;\r\n public delegatedPort: Nullable<FrameNodePort> = null;\r\n\r\n public get element(): HTMLDivElement {\r\n if (this.delegatedPort) {\r\n return this.delegatedPort.element;\r\n }\r\n\r\n return this._element;\r\n }\r\n\r\n public get portName() {\r\n return this.portData.name;\r\n }\r\n\r\n public set portName(newName: string) {\r\n if (this._portLabelElement) {\r\n this.portData.updateDisplayName(newName);\r\n this._portLabelElement.innerHTML = newName;\r\n }\r\n }\r\n\r\n public get disabled() {\r\n if (!this.portData.isConnected) {\r\n return false;\r\n } else if (this._isConnectedToNodeOutsideOfFrame()) {\r\n //connected to outside node\r\n return true;\r\n } else {\r\n const link = this.node.getLinksForPortData(this.portData);\r\n if (link.length) {\r\n if (link[0].nodeB === this.node) {\r\n // check if this node is the receiving\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n public hasLabel() {\r\n return !!this._portLabelElement;\r\n }\r\n\r\n public get exposedOnFrame() {\r\n if (!!this.portData.isExposedOnFrame || this._isConnectedToNodeOutsideOfFrame()) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n public set exposedOnFrame(value: boolean) {\r\n if (this.disabled) {\r\n return;\r\n }\r\n this.portData.isExposedOnFrame = value;\r\n }\r\n\r\n public get exposedPortPosition() {\r\n return this.portData.exposedPortPosition;\r\n }\r\n\r\n public set exposedPortPosition(value: number) {\r\n this.portData.exposedPortPosition = value;\r\n }\r\n\r\n private _isConnectedToNodeOutsideOfFrame() {\r\n const link = this.node.getLinksForPortData(this.portData);\r\n if (link.length) {\r\n for (let i = 0; i < link.length; i++) {\r\n if (link[i].nodeA.enclosingFrameId !== link[i].nodeB!.enclosingFrameId) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n public refresh() {\r\n this._stateManager.applyNodePortDesign(this.portData, this._element, this._img);\r\n }\r\n\r\n public constructor(portContainer: HTMLElement, public portData: IPortData, public node: GraphNode, stateManager: StateManager) {\r\n this._element = portContainer.ownerDocument!.createElement(\"div\");\r\n this._element.classList.add(commonStyles.port);\r\n portContainer.appendChild(this._element);\r\n this._stateManager = stateManager;\r\n\r\n this._img = portContainer.ownerDocument!.createElement(\"img\");\r\n this._element.appendChild(this._img);\r\n\r\n // determine if node name is editable\r\n if (portContainer.children[0].className === commonStyles[\"port-label\"]) {\r\n this._portLabelElement = portContainer.children[0];\r\n }\r\n\r\n (this._element as any).port = this;\r\n\r\n // Drag support\r\n this._element.ondragstart = () => false;\r\n\r\n this._onCandidateLinkMovedObserver = stateManager.onCandidateLinkMoved.add((coords) => {\r\n const rect = this._element.getBoundingClientRect();\r\n\r\n if (!coords || rect.left > coords.x || rect.right < coords.x || rect.top > coords.y || rect.bottom < coords.y) {\r\n this._element.classList.remove(localStyles[\"selected\"]);\r\n return;\r\n }\r\n\r\n this._element.classList.add(localStyles[\"selected\"]);\r\n this._stateManager.onCandidatePortSelectedObservable.notifyObservers(this);\r\n });\r\n\r\n this._onSelectionChangedObserver = this._stateManager.onSelectionChangedObservable.add((options) => {\r\n const { selection } = options || {};\r\n if (selection === this) {\r\n this._img.classList.add(localStyles[\"selected\"]);\r\n } else {\r\n this._img.classList.remove(localStyles[\"selected\"]);\r\n }\r\n });\r\n\r\n this.refresh();\r\n }\r\n\r\n public dispose() {\r\n this._stateManager.onCandidateLinkMoved.remove(this._onCandidateLinkMovedObserver);\r\n\r\n if (this._onSelectionChangedObserver) {\r\n this._stateManager.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);\r\n }\r\n }\r\n\r\n public static CreatePortElement(portData: IPortData, node: GraphNode, root: HTMLElement, displayManager: Nullable<IDisplayManager>, stateManager: StateManager) {\r\n const portContainer = root.ownerDocument!.createElement(\"div\");\r\n\r\n portContainer.classList.add(commonStyles.portLine);\r\n\r\n root.appendChild(portContainer);\r\n\r\n if (!displayManager || displayManager.shouldDisplayPortLabels(portData)) {\r\n const portLabel = root.ownerDocument!.createElement(\"div\");\r\n portLabel.classList.add(commonStyles[\"port-label\"]);\r\n portLabel.innerHTML = portData.name;\r\n portContainer.appendChild(portLabel);\r\n }\r\n\r\n return new NodePort(portContainer, portData, node, stateManager);\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ComponentClass } from "react";
|
2
|
+
import type { IPropertyComponentProps } from "./interfaces/propertyComponentProps";
|
3
|
+
export declare class PropertyLedger {
|
4
|
+
static DefaultControl: ComponentClass<IPropertyComponentProps>;
|
5
|
+
static RegisteredControls: {
|
6
|
+
[key: string]: ComponentClass<IPropertyComponentProps>;
|
7
|
+
};
|
8
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"propertyLedger.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/nodeGraphSystem/propertyLedger.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;;AAET,iCAAkB,GAA+D,EAAE,CAAC","sourcesContent":["import type { ComponentClass } from \"react\";\r\nimport type { IPropertyComponentProps } from \"./interfaces/propertyComponentProps\";\r\n\r\nexport class PropertyLedger {\r\n public static DefaultControl: ComponentClass<IPropertyComponentProps>;\r\n public static RegisteredControls: { [key: string]: ComponentClass<IPropertyComponentProps> } = {};\r\n}\r\n"]}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import type { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
2
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
3
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
4
|
+
import type { FrameNodePort } from "./frameNodePort";
|
5
|
+
import type { GraphFrame } from "./graphFrame";
|
6
|
+
import type { GraphNode } from "./graphNode";
|
7
|
+
import type { INodeContainer } from "./interfaces/nodeContainer";
|
8
|
+
import type { INodeData } from "./interfaces/nodeData";
|
9
|
+
import type { IPortData } from "./interfaces/portData";
|
10
|
+
import type { ISelectionChangedOptions } from "./interfaces/selectionChangedOptions";
|
11
|
+
import type { NodePort } from "./nodePort";
|
12
|
+
export declare class StateManager {
|
13
|
+
data: any;
|
14
|
+
hostDocument: Document;
|
15
|
+
lockObject: any;
|
16
|
+
onSelectionChangedObservable: Observable<Nullable<ISelectionChangedOptions>>;
|
17
|
+
onFrameCreatedObservable: Observable<GraphFrame>;
|
18
|
+
onUpdateRequiredObservable: Observable<any>;
|
19
|
+
onGraphNodeRemovalObservable: Observable<GraphNode>;
|
20
|
+
onSelectionBoxMoved: Observable<DOMRect | ClientRect>;
|
21
|
+
onCandidateLinkMoved: Observable<Nullable<Vector2>>;
|
22
|
+
onCandidatePortSelectedObservable: Observable<Nullable<FrameNodePort | NodePort>>;
|
23
|
+
onNewNodeCreatedObservable: Observable<GraphNode>;
|
24
|
+
onRebuildRequiredObservable: Observable<boolean>;
|
25
|
+
onErrorMessageDialogRequiredObservable: Observable<string>;
|
26
|
+
onExposePortOnFrameObservable: Observable<GraphNode>;
|
27
|
+
onGridSizeChanged: Observable<void>;
|
28
|
+
onNewBlockRequiredObservable: Observable<{
|
29
|
+
type: string;
|
30
|
+
targetX: number;
|
31
|
+
targetY: number;
|
32
|
+
needRepositioning?: boolean | undefined;
|
33
|
+
}>;
|
34
|
+
exportData: (data: any, frame?: Nullable<GraphFrame>) => string;
|
35
|
+
isElbowConnectionAllowed: (nodeA: FrameNodePort | NodePort, nodeB: FrameNodePort | NodePort) => boolean;
|
36
|
+
applyNodePortDesign: (data: IPortData, element: HTMLElement, img: HTMLImageElement) => void;
|
37
|
+
storeEditorData: (serializationObject: any, frame?: Nullable<GraphFrame>) => void;
|
38
|
+
getEditorDataMap: () => {
|
39
|
+
[key: number]: number;
|
40
|
+
};
|
41
|
+
createDefaultInputData: (rootData: any, portData: IPortData, nodeContainer: INodeContainer) => Nullable<{
|
42
|
+
data: INodeData;
|
43
|
+
name: string;
|
44
|
+
}>;
|
45
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
2
|
+
export class StateManager {
|
3
|
+
constructor() {
|
4
|
+
this.onSelectionChangedObservable = new Observable();
|
5
|
+
this.onFrameCreatedObservable = new Observable();
|
6
|
+
this.onUpdateRequiredObservable = new Observable();
|
7
|
+
this.onGraphNodeRemovalObservable = new Observable();
|
8
|
+
this.onSelectionBoxMoved = new Observable();
|
9
|
+
this.onCandidateLinkMoved = new Observable();
|
10
|
+
this.onCandidatePortSelectedObservable = new Observable();
|
11
|
+
this.onNewNodeCreatedObservable = new Observable();
|
12
|
+
this.onRebuildRequiredObservable = new Observable();
|
13
|
+
this.onErrorMessageDialogRequiredObservable = new Observable();
|
14
|
+
this.onExposePortOnFrameObservable = new Observable();
|
15
|
+
this.onGridSizeChanged = new Observable();
|
16
|
+
this.onNewBlockRequiredObservable = new Observable();
|
17
|
+
}
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=stateManager.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stateManager.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/nodeGraphSystem/stateManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAWlD,MAAM,OAAO,YAAY;IAAzB;QAKI,iCAA4B,GAAG,IAAI,UAAU,EAAsC,CAAC;QACpF,6BAAwB,GAAG,IAAI,UAAU,EAAc,CAAC;QACxD,+BAA0B,GAAG,IAAI,UAAU,EAAiB,CAAC;QAC7D,iCAA4B,GAAG,IAAI,UAAU,EAAa,CAAC;QAC3D,wBAAmB,GAAG,IAAI,UAAU,EAAwB,CAAC;QAC7D,yBAAoB,GAAG,IAAI,UAAU,EAAqB,CAAC;QAC3D,sCAAiC,GAAG,IAAI,UAAU,EAAsC,CAAC;QACzF,+BAA0B,GAAG,IAAI,UAAU,EAAa,CAAC;QACzD,gCAA2B,GAAG,IAAI,UAAU,EAAW,CAAC;QACxD,2CAAsC,GAAG,IAAI,UAAU,EAAU,CAAC;QAClE,kCAA6B,GAAG,IAAI,UAAU,EAAa,CAAC;QAC5D,sBAAiB,GAAG,IAAI,UAAU,EAAQ,CAAC;QAC3C,iCAA4B,GAAG,IAAI,UAAU,EAAmF,CAAC;IAWrI,CAAC;CAAA","sourcesContent":["import type { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { FrameNodePort } from \"./frameNodePort\";\r\nimport type { GraphFrame } from \"./graphFrame\";\r\nimport type { GraphNode } from \"./graphNode\";\r\nimport type { INodeContainer } from \"./interfaces/nodeContainer\";\r\nimport type { INodeData } from \"./interfaces/nodeData\";\r\nimport type { IPortData } from \"./interfaces/portData\";\r\nimport type { ISelectionChangedOptions } from \"./interfaces/selectionChangedOptions\";\r\nimport type { NodePort } from \"./nodePort\";\r\n\r\nexport class StateManager {\r\n data: any;\r\n hostDocument: Document;\r\n lockObject: any;\r\n\r\n onSelectionChangedObservable = new Observable<Nullable<ISelectionChangedOptions>>();\r\n onFrameCreatedObservable = new Observable<GraphFrame>();\r\n onUpdateRequiredObservable = new Observable<Nullable<any>>();\r\n onGraphNodeRemovalObservable = new Observable<GraphNode>();\r\n onSelectionBoxMoved = new Observable<ClientRect | DOMRect>();\r\n onCandidateLinkMoved = new Observable<Nullable<Vector2>>();\r\n onCandidatePortSelectedObservable = new Observable<Nullable<NodePort | FrameNodePort>>();\r\n onNewNodeCreatedObservable = new Observable<GraphNode>();\r\n onRebuildRequiredObservable = new Observable<boolean>();\r\n onErrorMessageDialogRequiredObservable = new Observable<string>();\r\n onExposePortOnFrameObservable = new Observable<GraphNode>();\r\n onGridSizeChanged = new Observable<void>();\r\n onNewBlockRequiredObservable = new Observable<{ type: string; targetX: number; targetY: number; needRepositioning?: boolean }>();\r\n\r\n exportData: (data: any, frame?: Nullable<GraphFrame>) => string;\r\n isElbowConnectionAllowed: (nodeA: FrameNodePort | NodePort, nodeB: FrameNodePort | NodePort) => boolean;\r\n applyNodePortDesign: (data: IPortData, element: HTMLElement, img: HTMLImageElement) => void;\r\n\r\n storeEditorData: (serializationObject: any, frame?: Nullable<GraphFrame>) => void;\r\n\r\n getEditorDataMap: () => { [key: number]: number };\r\n\r\n createDefaultInputData: (rootData: any, portData: IPortData, nodeContainer: INodeContainer) => Nullable<{ data: INodeData; name: string }>;\r\n}\r\n"]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { GraphNode } from "./graphNode";
|
2
|
+
import type { NodeLink } from "./nodeLink";
|
3
|
+
import type { FramePortData } from "./types/framePortData";
|
4
|
+
export declare const IsFramePortData: (variableToCheck: any) => variableToCheck is FramePortData;
|
5
|
+
export declare const RefreshNode: (node: GraphNode, visitedNodes?: Set<GraphNode> | undefined, visitedLinks?: Set<NodeLink> | undefined) => void;
|