@flowuent-org/diagramming-core 1.3.10 → 1.4.1
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/.editorconfig +13 -13
- package/.eslintignore +1 -1
- package/.eslintrc.json +35 -35
- package/.prettierignore +3 -3
- package/.prettierrc +3 -3
- package/.vscode/settings.json +6 -6
- package/README.md +95 -95
- package/apps/authentication/tsconfig.app.json +23 -23
- package/apps/authentication/tsconfig.json +21 -21
- package/apps/authentication/tsconfig.spec.json +28 -28
- package/apps/diagramming/.eslintrc.json +18 -18
- package/apps/diagramming/index.html +16 -16
- package/apps/diagramming/project.json +53 -53
- package/apps/diagramming/public/aws-icons/compute/App Runner.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Application Auto Scaling.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Batch.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Bottlerocket.svg +19 -19
- package/apps/diagramming/public/aws-icons/compute/Compute Optimizer.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/EC2 Auto Scaling.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/EC2 Image Builder.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/EC2.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Elastic Beanstalk.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Elastic Fabric Adapter.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Fargate.svg +19 -19
- package/apps/diagramming/public/aws-icons/compute/Genomics CLI.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Lambda.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Local Zones.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/NICE DCV.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/NICE EnginFrame.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Nitro Enclaves.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Outposts family.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Outposts rack.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Outposts servers.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/ParallelCluster.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Serverless Application Repository.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/SimSpace Weaver.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Deadline.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Frost.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Sequoia.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Stoke.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox XMesh.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/VMware Cloud on AWS.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Wavelength.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/ECS Anywhere.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/EKS Anywhere.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/EKS Cloud.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/EKS Distro.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Elastic Container Registry.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Elastic Container Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Elastic Kubernetes Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Fargate.svg +19 -19
- package/apps/diagramming/public/aws-icons/container/Red Hat OpenShift Service on AWS.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Aurora.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Database Migration Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/DocumentDB.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/ElastiCache.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Keyspaces.svg +15 -15
- package/apps/diagramming/public/aws-icons/database/MemoryDB for Redis.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Neptune.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/RDS on VMware.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/RDS.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Timestream.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/App Mesh.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Client VPN.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Cloud Directory.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Cloud Map.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Cloud WAN.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/CloudFront.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Direct Connect.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Elastic Load Balancing.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Global Accelerator.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Private 5G.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/PrivateLink.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Route 53.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Site to Site VPN.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Transit Gateway.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/VPC Lattice.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Verified Access.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Virtual Private Cloud.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Artifact.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Audit Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Certificate Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/CloudHSM.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Cognito.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Detective.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Directory Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Firewall Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/GuardDuty.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/IAM Identity Center.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Identity and Access Management.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Inspector.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Key Management Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Macie.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Network Firewall.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Resource Access Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Secrets Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Security Hub.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Security Lake.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Shield.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Signer.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Verified Permissions.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/WAF.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Backup.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/EFS.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Elastic Block Store.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Elastic Disaster Recovery.svg +15 -15
- package/apps/diagramming/public/aws-icons/storage/FSx for Lustre.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx for NetApp ONTAP.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx for OpenZFS.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx for WFS.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/File Cache.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/S3 on Outposts.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Simple Storage Service Glacier.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Simple Storage Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowball Edge.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowball.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowcone.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowmobile.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Storage Gateway.svg +17 -17
- package/apps/diagramming/public/azure-icons/compute/02112-icon-service-Automanaged-VM.svg +1 -1
- package/apps/diagramming/public/azure-icons/databases/02390-icon-service-Azure-SQL.svg +1 -1
- package/apps/diagramming/public/azure-icons/databases/02392-icon-service-SSIS-Lift-And-Shift-IR.svg +1 -1
- package/apps/diagramming/public/azure-icons/networking/02145-icon-service-Resource-Management-Private-Link.svg +1 -1
- package/apps/diagramming/public/azure-icons/security/02247-icon-service-Microsoft-Defender-for-IoT.svg +1 -1
- package/apps/diagramming/public/sample-node-complete.json +63 -63
- package/apps/diagramming/public/sample-node-data.json +63 -63
- package/apps/diagramming/src/AutomationDiagramData.ts +147 -480
- package/apps/diagramming/src/CollaborationDiagramData.ts +127 -127
- package/apps/diagramming/src/CustomIconExamples.ts +233 -233
- package/apps/diagramming/src/DiagramTabs.tsx +205 -205
- package/apps/diagramming/src/Pages/DevPlayground.tsx +3 -3
- package/apps/diagramming/src/Pages/Home.tsx +111 -111
- package/apps/diagramming/src/SequenceDiagramData.ts +215 -215
- package/apps/diagramming/src/StateMachineDiagramData.ts +64 -64
- package/apps/diagramming/src/UseCaseDiagramData.ts +52 -52
- package/apps/diagramming/src/cloud-data.ts +371 -371
- package/apps/diagramming/src/components/AddNodeView.tsx +252 -252
- package/apps/diagramming/src/createSelecors.tsx +17 -17
- package/apps/diagramming/src/index.scss +12 -12
- package/apps/diagramming/src/main.tsx +463 -463
- package/apps/diagramming/src/node-data.ts +664 -664
- package/apps/diagramming/src/sample-workflow-content.ts +55 -55
- package/apps/diagramming/src/stencil-items.ts +31 -31
- package/apps/diagramming/src/style.css +13 -13
- package/apps/diagramming/src/tabsStore.tsx +152 -152
- package/apps/diagramming/src/vite-env.d.ts +1 -1
- package/apps/diagramming/tsconfig.app.json +23 -23
- package/apps/diagramming/tsconfig.json +21 -21
- package/apps/diagramming/tsconfig.spec.json +28 -28
- package/apps/diagramming/vite.config.ts +34 -34
- package/apps/diagramming/webpack.config.js +13 -13
- package/apps/workflow/.eslintrc.json +18 -18
- package/apps/workflow/group/group-form-hooks/index.ts +3 -3
- package/apps/workflow/group/group-form-hooks/useFormValidation.ts +20 -20
- package/apps/workflow/group/group-form-schema/SettingsTabFormSchema.ts +7 -7
- package/apps/workflow/group/group-form-schema/index.ts +3 -3
- package/apps/workflow/i18n.ts +19 -19
- package/apps/workflow/index.html +16 -16
- package/apps/workflow/locales/en/translation.json +713 -713
- package/apps/workflow/project.json +8 -8
- package/apps/workflow/src/app/app.module.css +1 -1
- package/apps/workflow/src/app/app.spec.tsx +15 -15
- package/apps/workflow/src/app/app.tsx +370 -370
- package/apps/workflow/src/main.tsx +13 -13
- package/apps/workflow/src/styles.css +1 -1
- package/apps/workflow/src/theme/index.ts +546 -546
- package/apps/workflow/tsconfig.app.json +23 -23
- package/apps/workflow/tsconfig.json +21 -21
- package/apps/workflow/tsconfig.spec.json +28 -28
- package/apps/workflow/vite.config.ts +51 -51
- package/nx.json +58 -58
- package/package.json +1 -1
- package/packages/api/.babelrc +12 -12
- package/packages/api/.eslintrc.json +18 -18
- package/packages/api/README.md +7 -7
- package/packages/api/project.json +8 -8
- package/packages/api/src/index.ts +3 -3
- package/packages/api/src/lib/jsonPlaceholderService/endpoints.ts +3 -3
- package/packages/api/src/lib/jsonPlaceholderService/service.ts +13 -13
- package/packages/api/tsconfig.json +17 -17
- package/packages/api/tsconfig.lib.json +24 -24
- package/packages/atoms/.babelrc +12 -12
- package/packages/atoms/.eslintrc.json +18 -18
- package/packages/atoms/README.md +7 -7
- package/packages/atoms/forms/AuthenticationTabForm/authenticationTabForm.json +224 -224
- package/packages/atoms/forms/AuthenticationTabForm/index.tsx +255 -255
- package/packages/atoms/forms/SettingsTabForm/index.tsx +85 -85
- package/packages/atoms/forms/SettingsTabForm/settingTabForm.json +27 -27
- package/packages/atoms/forms/index.ts +4 -4
- package/packages/atoms/project.json +8 -8
- package/packages/atoms/src/index.ts +33 -33
- package/packages/atoms/src/lib/Accordion/Accordion.module.css +7 -7
- package/packages/atoms/src/lib/Accordion/Accordion.spec.tsx +13 -13
- package/packages/atoms/src/lib/Accordion/Accordion.tsx +29 -29
- package/packages/atoms/src/lib/Alert/Alert.module.css +7 -7
- package/packages/atoms/src/lib/Alert/Alert.spec.tsx +10 -10
- package/packages/atoms/src/lib/Alert/Alert.tsx +19 -19
- package/packages/atoms/src/lib/Avatar/Avatar.module.css +7 -7
- package/packages/atoms/src/lib/Avatar/Avatar.spec.tsx +10 -10
- package/packages/atoms/src/lib/Avatar/Avatar.tsx +22 -22
- package/packages/atoms/src/lib/Box/Box.module.css +7 -7
- package/packages/atoms/src/lib/Box/Box.spec.tsx +10 -10
- package/packages/atoms/src/lib/Box/Box.tsx +19 -19
- package/packages/atoms/src/lib/BulkEdit/BulkEdit.module.css +7 -7
- package/packages/atoms/src/lib/BulkEdit/BulkEdit.spec.tsx +10 -10
- package/packages/atoms/src/lib/BulkEdit/BulkEdit.tsx +15 -15
- package/packages/atoms/src/lib/Button/Button.module.css +7 -7
- package/packages/atoms/src/lib/Button/Button.spec.tsx +10 -10
- package/packages/atoms/src/lib/Button/Button.tsx +78 -78
- package/packages/atoms/src/lib/Card/Card.module.css +7 -7
- package/packages/atoms/src/lib/Card/Card.spec.tsx +10 -10
- package/packages/atoms/src/lib/Card/Card.tsx +19 -19
- package/packages/atoms/src/lib/CardContent/CardContent.module.css +7 -7
- package/packages/atoms/src/lib/CardContent/CardContent.spec.tsx +10 -10
- package/packages/atoms/src/lib/CardContent/CardContent.tsx +22 -22
- package/packages/atoms/src/lib/FormTextField/FormTextField.module.css +7 -7
- package/packages/atoms/src/lib/FormTextField/FormTextField.spec.tsx +10 -10
- package/packages/atoms/src/lib/FormTextField/FormTextField.tsx +35 -35
- package/packages/atoms/src/lib/Grid/Grid.module.css +7 -7
- package/packages/atoms/src/lib/Grid/Grid.spec.tsx +10 -10
- package/packages/atoms/src/lib/Grid/Grid.tsx +19 -19
- package/packages/atoms/src/lib/Stack/Stack.module.css +7 -7
- package/packages/atoms/src/lib/Stack/Stack.spec.tsx +10 -10
- package/packages/atoms/src/lib/Stack/Stack.tsx +19 -19
- package/packages/atoms/src/lib/Switch/Switch.module.css +7 -7
- package/packages/atoms/src/lib/Switch/Switch.spec.tsx +10 -10
- package/packages/atoms/src/lib/Switch/Switch.tsx +46 -46
- package/packages/atoms/src/lib/TableView/TableView.module.css +7 -7
- package/packages/atoms/src/lib/TableView/TableView.spec.tsx +10 -10
- package/packages/atoms/src/lib/TableView/TableView.tsx +88 -88
- package/packages/atoms/src/lib/TextField/TextField.module.css +7 -7
- package/packages/atoms/src/lib/TextField/TextField.spec.tsx +10 -10
- package/packages/atoms/src/lib/TextField/TextField.tsx +17 -17
- package/packages/atoms/src/lib/Typography/Typography.module.css +7 -7
- package/packages/atoms/src/lib/Typography/Typography.spec.tsx +10 -10
- package/packages/atoms/src/lib/Typography/Typography.tsx +22 -22
- package/packages/atoms/tsconfig.json +17 -17
- package/packages/atoms/tsconfig.lib.json +30 -30
- package/packages/common/.babelrc +12 -12
- package/packages/common/.eslintrc.json +18 -18
- package/packages/common/README.md +7 -7
- package/packages/common/project.json +8 -8
- package/packages/common/src/index.ts +4 -4
- package/packages/common/src/lib/generateRandomProfilePic.ts +3 -3
- package/packages/common/src/lib/generateValidationSchema.ts +46 -46
- package/packages/common/tsconfig.json +17 -17
- package/packages/common/tsconfig.lib.json +24 -24
- package/packages/contexts/.babelrc +12 -12
- package/packages/contexts/.eslintrc.json +18 -18
- package/packages/contexts/README.md +7 -7
- package/packages/contexts/project.json +8 -8
- package/packages/contexts/src/index.ts +2 -2
- package/packages/contexts/tsconfig.json +17 -17
- package/packages/contexts/tsconfig.lib.json +24 -24
- package/packages/diagrams/.babelrc +12 -12
- package/packages/diagrams/.ctirc +208 -208
- package/packages/diagrams/.eslintrc.json +17 -17
- package/packages/diagrams/CUSTOM_ICONS.md +232 -232
- package/packages/diagrams/GOOGLE_SHEETS_IMPLEMENTATION.md +233 -233
- package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
- package/packages/diagrams/README.md +7 -7
- package/packages/diagrams/UNDO_REDO_API.md +306 -306
- package/packages/diagrams/locales/en/translation.json +713 -713
- package/packages/diagrams/package.json +27 -27
- package/packages/diagrams/pnpm-lock.yaml +2606 -2606
- package/packages/diagrams/project.json +42 -42
- package/packages/diagrams/rollup.config.js +26 -26
- package/packages/diagrams/src/DiagramFlow.tsx +7 -7
- package/packages/diagrams/src/declarations.d.ts +7 -7
- package/packages/diagrams/src/index.ts +8 -1
- package/packages/diagrams/src/index.ts.bak +99 -99
- package/packages/diagrams/src/lib/assets/markers/markers.param.tsx +101 -101
- package/packages/diagrams/src/lib/assets/markers/markers.type.ts +10 -10
- package/packages/diagrams/src/lib/atoms/ActorNode.tsx +123 -123
- package/packages/diagrams/src/lib/atoms/AddParallelColButton.tsx +26 -26
- package/packages/diagrams/src/lib/atoms/BendpointNode.tsx +71 -71
- package/packages/diagrams/src/lib/atoms/CardBlockTypeSelector.tsx +35 -35
- package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
- package/packages/diagrams/src/lib/atoms/CardMainContent.tsx +19 -19
- package/packages/diagrams/src/lib/atoms/ConnectionPoints.tsx +149 -149
- package/packages/diagrams/src/lib/atoms/ContentAssist.tsx +341 -341
- package/packages/diagrams/src/lib/atoms/DiagramControls.tsx +56 -56
- package/packages/diagrams/src/lib/atoms/ExpressionInput.tsx +437 -437
- package/packages/diagrams/src/lib/atoms/FloatingConnectionLine.tsx +73 -73
- package/packages/diagrams/src/lib/atoms/LazyIcon.tsx +31 -31
- package/packages/diagrams/src/lib/atoms/MarkerSelector.tsx +106 -106
- package/packages/diagrams/src/lib/atoms/MultiSelectInput.tsx +87 -87
- package/packages/diagrams/src/lib/atoms/ParameterInput.tsx +199 -199
- package/packages/diagrams/src/lib/atoms/PropertyInput.tsx +114 -114
- package/packages/diagrams/src/lib/atoms/StyledBox.tsx +69 -69
- package/packages/diagrams/src/lib/atoms/ValidationError.tsx +37 -37
- package/packages/diagrams/src/lib/atoms/ValidationMessage.tsx +63 -63
- package/packages/diagrams/src/lib/components/AiButton.tsx +52 -52
- package/packages/diagrams/src/lib/components/ControlEdgeList.tsx +303 -303
- package/packages/diagrams/src/lib/components/CreateFunctionModal.tsx +264 -264
- package/packages/diagrams/src/lib/components/CustomCodeModal.tsx +287 -287
- package/packages/diagrams/src/lib/components/DiagramPanel.tsx +331 -331
- package/packages/diagrams/src/lib/components/FunctionModalTooltip.tsx +30 -30
- package/packages/diagrams/src/lib/components/GraphQLCustomCodeModal.tsx +210 -210
- package/packages/diagrams/src/lib/components/Header.tsx +143 -143
- package/packages/diagrams/src/lib/components/MiniMapCommon.tsx +24 -24
- package/packages/diagrams/src/lib/components/ResizeIcon.tsx +81 -81
- package/packages/diagrams/src/lib/components/SideBar.tsx +40 -40
- package/packages/diagrams/src/lib/components/automation/AISuggestionsModal.tsx +269 -269
- package/packages/diagrams/src/lib/components/automation/AISuggestionsPanel.tsx +28 -175
- package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationDecisionNode.tsx +94 -0
- package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationExecutionPanel.tsx +439 -439
- package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationInteractionNode.tsx +693 -693
- package/packages/diagrams/src/lib/components/automation/AutomationMonitoringNode.tsx +399 -399
- package/packages/diagrams/src/lib/components/automation/AutomationNavigationNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationNodeCard.tsx +414 -0
- package/packages/diagrams/src/lib/components/automation/AutomationSlackNode.tsx +694 -694
- package/packages/diagrams/src/lib/components/automation/AutomationSmsNode.tsx +62 -0
- package/packages/diagrams/src/lib/components/automation/AutomationStartNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationTelegramNode.tsx +664 -664
- package/packages/diagrams/src/lib/components/automation/AutomationVoiceCallNode.tsx +65 -0
- package/packages/diagrams/src/lib/components/automation/AutomationWorkflowNode.tsx +85 -0
- package/packages/diagrams/src/lib/components/automation/NodeAIAssistantPopup.tsx +504 -504
- package/packages/diagrams/src/lib/components/automation/index.ts +29 -19
- package/packages/diagrams/src/lib/components/automation/statusColors.ts +124 -124
- package/packages/diagrams/src/lib/contexts/CardDataProvider.tsx +111 -111
- package/packages/diagrams/src/lib/contexts/DiagramProvider.tsx +392 -391
- package/packages/diagrams/src/lib/contexts/diagramStoreTypes.tsx +134 -134
- package/packages/diagrams/src/lib/contexts/onConnect.ts +39 -39
- package/packages/diagrams/src/lib/contexts/onDragStart.ts +45 -45
- package/packages/diagrams/src/lib/contexts/onNodeDragEnd.ts +179 -179
- package/packages/diagrams/src/lib/contexts/onNodesChange.ts +406 -406
- package/packages/diagrams/src/lib/contexts/onReconnect.ts +59 -59
- package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +65 -65
- package/packages/diagrams/src/lib/contexts/setContentHeight.ts +14 -14
- package/packages/diagrams/src/lib/contexts/setDiagramType.ts +10 -10
- package/packages/diagrams/src/lib/contexts/setEdgeShapeType.ts +7 -7
- package/packages/diagrams/src/lib/contexts/setEdges.ts +9 -9
- package/packages/diagrams/src/lib/contexts/setLayoutDirection.ts +9 -9
- package/packages/diagrams/src/lib/contexts/setNodeSetting.ts +17 -17
- package/packages/diagrams/src/lib/contexts/setNodes.ts +10 -10
- package/packages/diagrams/src/lib/contexts/setPannable.ts +7 -7
- package/packages/diagrams/src/lib/contexts/setSelectedEdge.ts +7 -7
- package/packages/diagrams/src/lib/contexts/setSelectedNode.ts +7 -7
- package/packages/diagrams/src/lib/contexts/undo.ts +163 -163
- package/packages/diagrams/src/lib/contexts/updateNodeSetting.ts +17 -17
- package/packages/diagrams/src/lib/examples/TwilioWhatsAppConfigExample.ts +128 -128
- package/packages/diagrams/src/lib/externals.ts +4 -4
- package/packages/diagrams/src/lib/hooks/customUseReactFlow.tsx +90 -90
- package/packages/diagrams/src/lib/hooks/updateNodes.ts +45 -45
- package/packages/diagrams/src/lib/hooks/useAddChildButton.tsx +61 -61
- package/packages/diagrams/src/lib/hooks/useAddSwitchCase.ts +75 -75
- package/packages/diagrams/src/lib/hooks/useAutoRegisterFunctions.ts +135 -135
- package/packages/diagrams/src/lib/hooks/useAutoRegisterVariables.ts +286 -286
- package/packages/diagrams/src/lib/hooks/useDeleteNodeByEvent.ts +64 -64
- package/packages/diagrams/src/lib/hooks/useDragCallbacks.tsx +122 -122
- package/packages/diagrams/src/lib/hooks/useFormValidation.ts +349 -349
- package/packages/diagrams/src/lib/hooks/useFunctionFormCallbacks.ts +136 -136
- package/packages/diagrams/src/lib/hooks/useIsSelectedNode.ts +11 -11
- package/packages/diagrams/src/lib/hooks/useModalControls.ts +13 -13
- package/packages/diagrams/src/lib/hooks/useNodeDragHandlers.ts +43 -43
- package/packages/diagrams/src/lib/hooks/useNodeSelection.ts +55 -55
- package/packages/diagrams/src/lib/hooks/useRenderDividers.tsx +19 -19
- package/packages/diagrams/src/lib/hooks/useRenderPins.tsx +74 -74
- package/packages/diagrams/src/lib/hooks/useResizeObserver.ts +21 -21
- package/packages/diagrams/src/lib/hooks/useTreeChildNode.ts +536 -536
- package/packages/diagrams/src/lib/i18n.ts +42 -42
- package/packages/diagrams/src/lib/icons/icons.tsx +324 -0
- package/packages/diagrams/src/lib/icons/index.ts +29 -0
- package/packages/diagrams/src/lib/icons/types.ts +7 -0
- package/packages/diagrams/src/lib/molecules/AddingBlock.tsx +147 -147
- package/packages/diagrams/src/lib/molecules/AvailableVariablesDisplay.tsx +57 -57
- package/packages/diagrams/src/lib/molecules/Block.tsx +143 -143
- package/packages/diagrams/src/lib/molecules/BlockProvider.tsx +28 -28
- package/packages/diagrams/src/lib/molecules/BlockWrapper.tsx +14 -14
- package/packages/diagrams/src/lib/molecules/ConditionRule.tsx +131 -131
- package/packages/diagrams/src/lib/molecules/DraggablePane.tsx +198 -198
- package/packages/diagrams/src/lib/molecules/EntityNodeBlocks.tsx +66 -66
- package/packages/diagrams/src/lib/molecules/SideHandles.tsx +215 -215
- package/packages/diagrams/src/lib/molecules/StencilItem.tsx +85 -85
- package/packages/diagrams/src/lib/molecules/WorkflowNodeActionButtons.tsx +62 -62
- package/packages/diagrams/src/lib/molecules/animated-add-button.tsx +83 -83
- package/packages/diagrams/src/lib/molecules/json-viewer.tsx +107 -107
- package/packages/diagrams/src/lib/organisms/AddNodeView.tsx +102 -102
- package/packages/diagrams/src/lib/organisms/Card/EntityNode.tsx +259 -259
- package/packages/diagrams/src/lib/organisms/Card/card.params.ts +29 -29
- package/packages/diagrams/src/lib/organisms/Card/card.types.ts +5 -5
- package/packages/diagrams/src/lib/organisms/CodeModal.tsx +105 -105
- package/packages/diagrams/src/lib/organisms/ConditionRuleGroup.tsx +138 -138
- package/packages/diagrams/src/lib/organisms/CustomEdge/EdgeMarkers.tsx +51 -51
- package/packages/diagrams/src/lib/organisms/CustomEdge/custom-edge-generator.tsx +135 -135
- package/packages/diagrams/src/lib/organisms/CustomEdge/custom-edge.params.ts +6 -6
- package/packages/diagrams/src/lib/organisms/CustomEdge/custom-edge.type.ts +15 -15
- package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -121
- package/packages/diagrams/src/lib/organisms/CustomEdge/useEdgeModal.ts +37 -37
- package/packages/diagrams/src/lib/organisms/CustomEdge/useEdgePath.tsx +99 -99
- package/packages/diagrams/src/lib/organisms/DownloadPanel.tsx +345 -345
- package/packages/diagrams/src/lib/organisms/EdgeModal.tsx +243 -243
- package/packages/diagrams/src/lib/organisms/HistoryPane.tsx +118 -118
- package/packages/diagrams/src/lib/organisms/NodeContextMenu.tsx +259 -259
- package/packages/diagrams/src/lib/organisms/PropertiesPane.tsx +276 -276
- package/packages/diagrams/src/lib/organisms/SmartDynamicForm.tsx +226 -226
- package/packages/diagrams/src/lib/organisms/Stencil.tsx +60 -60
- package/packages/diagrams/src/lib/organisms/UseDiagramStore.tsx +4 -4
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +45 -45
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeTypeDisplay.tsx +114 -114
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/WorkflowNodeIcons.tsx +21 -23
- package/packages/diagrams/src/lib/organisms/WorkflowNode.tsx +484 -484
- package/packages/diagrams/src/lib/services/GoogleSheetsService.ts +961 -961
- package/packages/diagrams/src/lib/services/SlackService.ts +134 -134
- package/packages/diagrams/src/lib/services/TwilioWhatsAppService.ts +273 -273
- package/packages/diagrams/src/lib/styles.css +55 -55
- package/packages/diagrams/src/lib/templates/PageLinks.tsx +13 -13
- package/packages/diagrams/src/lib/templates/arch/ArchDiagram.tsx +793 -793
- package/packages/diagrams/src/lib/templates/arch/components/EdgeDialog.tsx +82 -82
- package/packages/diagrams/src/lib/templates/arch/components/EdgeSettings.tsx +81 -81
- package/packages/diagrams/src/lib/templates/arch/components/GroupControls.tsx +59 -59
- package/packages/diagrams/src/lib/templates/arch/components/GroupSizeDialog.tsx +81 -81
- package/packages/diagrams/src/lib/templates/arch/components/NodeDialog.tsx +214 -214
- package/packages/diagrams/src/lib/templates/arch/components/nodeTypes.ts +91 -91
- package/packages/diagrams/src/lib/templates/arch/controls/ArchDiagramControls.tsx +349 -349
- package/packages/diagrams/src/lib/templates/arch/data/templatee-data.ts +212 -212
- package/packages/diagrams/src/lib/templates/cloud-arch/components/CloudArchitectureDiagram.tsx +3912 -3912
- package/packages/diagrams/src/lib/templates/cloud-arch/components/FormatConverter.tsx +809 -809
- package/packages/diagrams/src/lib/templates/cloud-arch/components/FragmentImporter.tsx +276 -276
- package/packages/diagrams/src/lib/templates/cloud-arch/components/PropertiesPanel.tsx +1063 -1063
- package/packages/diagrams/src/lib/templates/cloud-arch/components/ServiceIconPicker.tsx +138 -138
- package/packages/diagrams/src/lib/templates/cloud-arch/components/SettingsSidebar.tsx +656 -656
- package/packages/diagrams/src/lib/templates/cloud-arch/components/SubnetSelector.tsx +468 -468
- package/packages/diagrams/src/lib/templates/cloud-arch/components/nodes/ServiceNode.tsx +310 -310
- package/packages/diagrams/src/lib/templates/cloud-arch/components/nodes/SubnetNode.tsx +475 -475
- package/packages/diagrams/src/lib/templates/cloud-arch/components/nodes/UsersNode.tsx +277 -277
- package/packages/diagrams/src/lib/templates/cloud-arch/data/diagramManager.ts +364 -364
- package/packages/diagrams/src/lib/templates/cloud-arch/data/types.ts +183 -183
- package/packages/diagrams/src/lib/templates/cloud-arch/integration/diagramValidator.ts +379 -379
- package/packages/diagrams/src/lib/templates/cloud-arch/messages/errorMessages.json +95 -95
- package/packages/diagrams/src/lib/templates/cloud-arch/types/localization.ts +368 -368
- package/packages/diagrams/src/lib/templates/cloud-arch/types/validation.ts +72 -72
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/aws-icons.ts +557 -557
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/awsValidation.ts +446 -446
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/azure-icons.ts +802 -802
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/azureValidation.ts +495 -495
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/cloudValidation.ts +929 -929
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/errorMessages.ts +283 -283
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/gcp-icons.ts +186 -186
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/gcpValidation.ts +312 -312
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/genericValidation.ts +689 -689
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/iconMapping.ts +383 -383
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/idGenerator.ts +220 -220
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/localizationManager.ts +300 -300
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/restrictionEngine.ts +550 -550
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/restrictionValidator.ts +400 -400
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/serviceIcons.tsx +129 -129
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/serviceMapping.ts +330 -330
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/translations.ts +54 -54
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/validationExtractor.ts +342 -342
- package/packages/diagrams/src/lib/templates/collaborationDiagram/CollaborationDiagram.tsx +15 -15
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/AddCollabEdgeDialog.tsx +181 -181
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/CollabLayout.ts +182 -182
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/CollabObjectNodeSettings.tsx +86 -86
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/CollaborationDiagramFlow.tsx +731 -731
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/DraggableEdgeLabel.tsx +123 -123
- package/packages/diagrams/src/lib/templates/collaborationDiagram/controls/CollaborationControls.tsx +131 -131
- package/packages/diagrams/src/lib/templates/collaborationDiagram/nodes/CollabEdge.tsx +170 -170
- package/packages/diagrams/src/lib/templates/collaborationDiagram/nodes/CollabObjectNode.tsx +178 -178
- package/packages/diagrams/src/lib/templates/home.style.css +16 -16
- package/packages/diagrams/src/lib/templates/node-forms/ApiForm.tsx +416 -416
- package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
- package/packages/diagrams/src/lib/templates/node-forms/ForLoopNode.tsx +313 -313
- package/packages/diagrams/src/lib/templates/node-forms/FunctionForm.tsx +211 -211
- package/packages/diagrams/src/lib/templates/node-forms/GraphQLForm.tsx +679 -679
- package/packages/diagrams/src/lib/templates/node-forms/IfNodeForm.tsx +97 -97
- package/packages/diagrams/src/lib/templates/node-forms/LetNodeForm.tsx +533 -533
- package/packages/diagrams/src/lib/templates/node-forms/LoopNode.tsx +149 -149
- package/packages/diagrams/src/lib/templates/node-forms/NodeForm.tsx +383 -383
- package/packages/diagrams/src/lib/templates/node-forms/ReturnNodeForm.tsx +96 -96
- package/packages/diagrams/src/lib/templates/node-forms/SetNodeForm.tsx +141 -141
- package/packages/diagrams/src/lib/templates/node-forms/SwitchNodeForm.tsx +249 -249
- package/packages/diagrams/src/lib/templates/node-forms/TryCatchForm.tsx +167 -167
- package/packages/diagrams/src/lib/templates/nodeFormSchema.json +84 -84
- package/packages/diagrams/src/lib/templates/sequence/SequenceDiagram.tsx +22 -22
- package/packages/diagrams/src/lib/templates/sequence/components/ActivationBarNode.tsx +33 -33
- package/packages/diagrams/src/lib/templates/sequence/components/AddMessageDialog.tsx +302 -302
- package/packages/diagrams/src/lib/templates/sequence/components/CombinedFragmentNode.tsx +65 -65
- package/packages/diagrams/src/lib/templates/sequence/components/EntitySettings.tsx +559 -559
- package/packages/diagrams/src/lib/templates/sequence/components/FragmentSettings.tsx +116 -116
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceComponents.tsx +14 -14
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceDiagramFlow.tsx +1361 -1361
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceEntityNode.tsx +394 -394
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceMessageEdge.tsx +272 -272
- package/packages/diagrams/src/lib/templates/sequence/components/SimpleEntitySettings.tsx +89 -89
- package/packages/diagrams/src/lib/templates/sequence/controls/DiagramControls.tsx +707 -707
- package/packages/diagrams/src/lib/templates/sequence/data/template-data.ts +635 -635
- package/packages/diagrams/src/lib/templates/stateMachine/StateMachineDiagram.tsx +66 -66
- package/packages/diagrams/src/lib/templates/stateMachine/components/CompositeStateNodeSettings.tsx +638 -638
- package/packages/diagrams/src/lib/templates/stateMachine/components/CustomEdge.tsx +220 -220
- package/packages/diagrams/src/lib/templates/stateMachine/components/EdgeSettings.tsx +193 -193
- package/packages/diagrams/src/lib/templates/stateMachine/components/SelfConnectingEdge.tsx +41 -41
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateMachineComponents.tsx +49 -49
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateMachineDiagramFlow.tsx +1238 -1238
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateMachineLayout.ts +350 -350
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateNodeSettings.tsx +188 -188
- package/packages/diagrams/src/lib/templates/stateMachine/components/useSelfTransition.ts +114 -114
- package/packages/diagrams/src/lib/templates/stateMachine/controls/StateDiagramControls.tsx +488 -488
- package/packages/diagrams/src/lib/templates/stateMachine/data/template-data.ts +4 -4
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/ChoicePointNode.tsx +54 -54
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/CompositeStateNode.tsx +225 -225
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/EntryPointNode.tsx +31 -31
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/ExitPointNode.tsx +44 -44
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/FinalStateNode.tsx +41 -41
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/ForkJoinNode.tsx +53 -53
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/HistoryStateNode.tsx +36 -36
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/InitialStateNode.tsx +29 -29
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/JunctionPointNode.tsx +33 -33
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/PinPointNode.tsx +111 -111
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/StateNode.tsx +124 -124
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/bendPoint.tsx +71 -71
- package/packages/diagrams/src/lib/templates/systemFlow/SystemFlowDiagram.tsx +67 -67
- package/packages/diagrams/src/lib/templates/systemFlow/components/EdgeSettings.tsx +330 -330
- package/packages/diagrams/src/lib/templates/systemFlow/components/FloatingEdge.tsx +219 -219
- package/packages/diagrams/src/lib/templates/systemFlow/components/SystemFlowComponents.tsx +28 -28
- package/packages/diagrams/src/lib/templates/systemFlow/components/SystemFlowDiagramFlow.tsx +1179 -1179
- package/packages/diagrams/src/lib/templates/systemFlow/components/SystemFlowNodeSettings.tsx +151 -151
- package/packages/diagrams/src/lib/templates/systemFlow/controls/SystemFlowControls.tsx +435 -435
- package/packages/diagrams/src/lib/templates/systemFlow/data/template-data.ts +308 -308
- package/packages/diagrams/src/lib/templates/systemFlow/demo.tsx +91 -91
- package/packages/diagrams/src/lib/templates/systemFlow/index.ts +5 -5
- package/packages/diagrams/src/lib/templates/systemFlow/nodes/BendpointNode.tsx +80 -80
- package/packages/diagrams/src/lib/templates/systemFlow/nodes/SystemNode.tsx +92 -92
- package/packages/diagrams/src/lib/templates/systemFlow/nodes/TreeSystemNode.tsx +755 -755
- package/packages/diagrams/src/lib/templates/useCaseDiagram/UseCaseDiagram.tsx +16 -16
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/ActorNodeSettings.tsx +103 -103
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/AddRelationshipDialog.tsx +186 -186
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/PackageNodeSettings.tsx +205 -205
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/UseCaseDiagramFlow.tsx +637 -637
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/UseCaseNodeSettings.tsx +120 -120
- package/packages/diagrams/src/lib/templates/useCaseDiagram/controls/UseCaseControls.tsx +289 -289
- package/packages/diagrams/src/lib/templates/useCaseDiagram/nodes/PackageNode.tsx +83 -83
- package/packages/diagrams/src/lib/templates/useCaseDiagram/nodes/UseCaseEdge.tsx +115 -115
- package/packages/diagrams/src/lib/templates/useCaseDiagram/nodes/UseCaseNode.tsx +230 -230
- package/packages/diagrams/src/lib/templates/validationSchema.json +277 -277
- package/packages/diagrams/src/lib/theme.ts +439 -439
- package/packages/diagrams/src/lib/types/FunctionSignature.ts +11 -11
- package/packages/diagrams/src/lib/types/SmartDynamicFormField.ts +37 -37
- package/packages/diagrams/src/lib/types/automation-node-data-types.ts +45 -131
- package/packages/diagrams/src/lib/types/available-variables.ts +18 -18
- package/packages/diagrams/src/lib/types/card-node.ts +68 -68
- package/packages/diagrams/src/lib/types/collaboration-types.ts +114 -114
- package/packages/diagrams/src/lib/types/colors.ts +25 -25
- package/packages/diagrams/src/lib/types/condition-builder.ts +18 -18
- package/packages/diagrams/src/lib/types/diagram-types.ts +14 -14
- package/packages/diagrams/src/lib/types/edge-types.ts +39 -39
- package/packages/diagrams/src/lib/types/function-execution.ts +35 -35
- package/packages/diagrams/src/lib/types/hooks.types.ts +6 -6
- package/packages/diagrams/src/lib/types/ndoe-form-types.ts +139 -139
- package/packages/diagrams/src/lib/types/node-types.ts +13 -23
- package/packages/diagrams/src/lib/types/sequence-types.ts +178 -178
- package/packages/diagrams/src/lib/types/shared-node-types.ts +21 -21
- package/packages/diagrams/src/lib/types/state-machine-types.ts +225 -225
- package/packages/diagrams/src/lib/types/stencil-item.ts +7 -7
- package/packages/diagrams/src/lib/types/structures.ts +80 -80
- package/packages/diagrams/src/lib/types/system-flow-types.ts +129 -129
- package/packages/diagrams/src/lib/types/usecase-types.ts +84 -84
- package/packages/diagrams/src/lib/types/validation-types.ts +134 -134
- package/packages/diagrams/src/lib/types/workflow-content-dynamic-form-type.ts +23 -23
- package/packages/diagrams/src/lib/types/workflow-node-data-types.ts +172 -172
- package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +658 -1179
- package/packages/diagrams/src/lib/utils/add-new-block.ts +34 -34
- package/packages/diagrams/src/lib/utils/add-new-node.ts +52 -52
- package/packages/diagrams/src/lib/utils/addToHistory.ts +15 -15
- package/packages/diagrams/src/lib/utils/automation-flow-processor.ts +556 -619
- package/packages/diagrams/src/lib/utils/closestPoint.ts +45 -45
- package/packages/diagrams/src/lib/utils/color-options.tsx +26 -26
- package/packages/diagrams/src/lib/utils/compress-img.ts +59 -59
- package/packages/diagrams/src/lib/utils/configLoader.ts +329 -329
- package/packages/diagrams/src/lib/utils/constant-lengths.ts +8 -8
- package/packages/diagrams/src/lib/utils/create-updated.tsx +40 -40
- package/packages/diagrams/src/lib/utils/createHistoryChange.ts +3 -3
- package/packages/diagrams/src/lib/utils/dividerUtils.tsx +59 -59
- package/packages/diagrams/src/lib/utils/edge-hooks.ts +53 -53
- package/packages/diagrams/src/lib/utils/elkLayout.ts +297 -297
- package/packages/diagrams/src/lib/utils/event-hooks.ts +69 -69
- package/packages/diagrams/src/lib/utils/event-store.ts +58 -58
- package/packages/diagrams/src/lib/utils/flow-node-hooks.ts +28 -28
- package/packages/diagrams/src/lib/utils/flow-to-js.ts +1465 -1465
- package/packages/diagrams/src/lib/utils/functionGenerator.ts +38 -38
- package/packages/diagrams/src/lib/utils/generateEdgesFromNodeOrder.ts +113 -113
- package/packages/diagrams/src/lib/utils/helpers.types.ts +10 -10
- package/packages/diagrams/src/lib/utils/highlightText.tsx +93 -93
- package/packages/diagrams/src/lib/utils/iconMapper.tsx +76 -76
- package/packages/diagrams/src/lib/utils/logger.ts +5 -5
- package/packages/diagrams/src/lib/utils/model-hooks.ts +129 -129
- package/packages/diagrams/src/lib/utils/node-hooks.ts +78 -78
- package/packages/diagrams/src/lib/utils/nodeAIAssistantConfig.ts +54 -54
- package/packages/diagrams/src/lib/utils/nodeOrderByEdges.ts +437 -437
- package/packages/diagrams/src/lib/utils/nodeutils.ts +242 -242
- package/packages/diagrams/src/lib/utils/object.ts +13 -13
- package/packages/diagrams/src/lib/utils/useDebounce.ts +19 -19
- package/packages/diagrams/src/lib/utils/utilities.ts +105 -105
- package/packages/diagrams/src/lib/utils/validationEngine.ts +610 -610
- package/packages/diagrams/src/lib/utils/vhToPixels.ts +9 -9
- package/packages/diagrams/tsconfig.json +21 -21
- package/packages/diagrams/tsconfig.lib.json +26 -25
- package/packages/diagrams/webpack.config.js +17 -17
- package/packages/interfaces/.babelrc +12 -12
- package/packages/interfaces/.eslintrc.json +18 -18
- package/packages/interfaces/README.md +7 -7
- package/packages/interfaces/project.json +8 -8
- package/packages/interfaces/src/index.ts +21 -21
- package/packages/interfaces/src/lib/Button.tsx +1 -1
- package/packages/interfaces/src/lib/DataGrid.ts +14 -14
- package/packages/interfaces/src/lib/StyledBox.tsx +1 -1
- package/packages/interfaces/src/lib/ToolbarItem.ts +7 -7
- package/packages/interfaces/src/lib/UserCard.ts +8 -8
- package/packages/interfaces/src/lib/yup.ts +3 -3
- package/packages/interfaces/tsconfig.json +17 -17
- package/packages/interfaces/tsconfig.lib.json +24 -24
- package/packages/molecules/.babelrc +12 -12
- package/packages/molecules/.eslintrc.json +18 -18
- package/packages/molecules/README.md +7 -7
- package/packages/molecules/project.json +8 -8
- package/packages/molecules/src/index.ts +47 -41
- package/packages/molecules/src/lib/ActionTextField/ActionTextField.module.css +7 -7
- package/packages/molecules/src/lib/ActionTextField/ActionTextField.spec.tsx +10 -10
- package/packages/molecules/src/lib/ActionTextField/ActionTextField.tsx +33 -33
- package/packages/molecules/src/lib/ClosableButton/CloseableButton.module.css +7 -7
- package/packages/molecules/src/lib/ClosableButton/CloseableButton.spec.tsx +11 -11
- package/packages/molecules/src/lib/ClosableButton/CloseableButton.tsx +69 -69
- package/packages/molecules/src/lib/EditorTab/EditorTab.module.css +7 -7
- package/packages/molecules/src/lib/EditorTab/EditorTab.spec.tsx +10 -10
- package/packages/molecules/src/lib/EditorTab/EditorTab.tsx +42 -42
- package/packages/molecules/src/lib/EditorTab/TabPanel.tsx +25 -25
- package/packages/molecules/src/lib/ParamsActionField/ParamsActionField.module.css +7 -7
- package/packages/molecules/src/lib/ParamsActionField/ParamsActionField.spec.tsx +10 -10
- package/packages/molecules/src/lib/ParamsActionField/ParamsActionField.tsx +24 -24
- package/packages/molecules/src/lib/SvgIcons/icons.tsx +323 -291
- package/packages/molecules/src/lib/SvgIcons/index.ts +31 -25
- package/packages/molecules/src/lib/SvgIcons/types.ts +7 -7
- package/packages/molecules/src/lib/TableWithInlineView/TableWithInlineView.module.css +7 -7
- package/packages/molecules/src/lib/TableWithInlineView/TableWithInlineView.spec.tsx +10 -10
- package/packages/molecules/src/lib/TableWithInlineView/TableWithInlineView.tsx +47 -47
- package/packages/molecules/src/lib/UserCard/UserCard.module.css +7 -7
- package/packages/molecules/src/lib/UserCard/UserCard.spec.tsx +11 -11
- package/packages/molecules/src/lib/UserCard/UserCard.tsx +22 -22
- package/packages/molecules/src/lib/VerbSelection/HTTPVerbSelection.module.css +7 -7
- package/packages/molecules/src/lib/VerbSelection/HTTPVerbSelection.spec.tsx +10 -10
- package/packages/molecules/src/lib/VerbSelection/HTTPVerbSelection.tsx +72 -72
- package/packages/molecules/tsconfig.json +17 -17
- package/packages/molecules/tsconfig.lib.json +30 -30
- package/packages/organisms/.babelrc +12 -12
- package/packages/organisms/.eslintrc.json +18 -18
- package/packages/organisms/README.md +7 -7
- package/packages/organisms/project.json +8 -8
- package/packages/organisms/src/index.ts +4 -4
- package/packages/organisms/src/lib/EditorToolbar/EditorToolbar.module.css +7 -7
- package/packages/organisms/src/lib/EditorToolbar/EditorToolbar.spec.tsx +10 -10
- package/packages/organisms/src/lib/EditorToolbar/EditorToolbar.tsx +117 -117
- package/packages/organisms/src/lib/EditorToolbar/SortableItem.tsx +51 -51
- package/packages/organisms/src/lib/UserList/UserList.module.css +7 -7
- package/packages/organisms/src/lib/UserList/UserList.spec.tsx +11 -11
- package/packages/organisms/src/lib/UserList/UserList.tsx +48 -48
- package/packages/organisms/src/lib/UserList/store.ts +49 -49
- package/packages/organisms/tsconfig.json +17 -17
- package/packages/organisms/tsconfig.lib.json +24 -24
- package/packages/zustand/.babelrc +12 -12
- package/packages/zustand/.eslintrc.json +18 -18
- package/packages/zustand/README.md +7 -7
- package/packages/zustand/project.json +8 -8
- package/packages/zustand/src/index.ts +4 -4
- package/packages/zustand/tsconfig.json +17 -17
- package/packages/zustand/tsconfig.lib.json +24 -24
- package/tsconfig.base.json +29 -29
- package/packages/diagrams/src/lib/components/automation/AutomationAISuggestionNode.tsx +0 -304
- package/packages/diagrams/src/lib/components/automation/AutomationEmailNode.tsx +0 -773
- package/packages/diagrams/src/lib/components/automation/AutomationGoogleServicesNode.tsx +0 -779
- package/packages/diagrams/src/lib/components/automation/AutomationNoteNode.tsx +0 -422
- package/packages/diagrams/src/lib/components/automation/AutomationSheetsNode.tsx +0 -1135
- package/packages/diagrams/src/lib/examples/GoogleSheetsConfigurationExamples.ts +0 -306
package/packages/diagrams/src/lib/templates/useCaseDiagram/components/UseCaseDiagramFlow.tsx
CHANGED
|
@@ -1,637 +1,637 @@
|
|
|
1
|
-
import React, { useCallback, useState, useRef, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
ReactFlow,
|
|
4
|
-
Background,
|
|
5
|
-
useNodesState,
|
|
6
|
-
useEdgesState,
|
|
7
|
-
Node,
|
|
8
|
-
Edge,
|
|
9
|
-
NodeMouseHandler,
|
|
10
|
-
Connection,
|
|
11
|
-
OnConnectStartParams,
|
|
12
|
-
} from '@xyflow/react';
|
|
13
|
-
import {
|
|
14
|
-
UseCaseDiagramProps,
|
|
15
|
-
UseCaseNodeData,
|
|
16
|
-
PackageNodeData,
|
|
17
|
-
UseCaseEdgeData,
|
|
18
|
-
UseCaseEdgeType,
|
|
19
|
-
CreateNodeParams,
|
|
20
|
-
CreateNodeResult,
|
|
21
|
-
HistoryState,
|
|
22
|
-
RelationshipDialogState,
|
|
23
|
-
} from '../../../types/usecase-types';
|
|
24
|
-
import { ActorNodeData } from '../../../types/shared-node-types';
|
|
25
|
-
import UseCaseControls from '../controls/UseCaseControls';
|
|
26
|
-
import ActorNode from '../../../atoms/ActorNode';
|
|
27
|
-
import UseCaseNode from '../nodes/UseCaseNode';
|
|
28
|
-
import PackageNode from '../nodes/PackageNode';
|
|
29
|
-
import UseCaseEdge from '../nodes/UseCaseEdge';
|
|
30
|
-
import { Button, Paper, Box } from '@mui/material';
|
|
31
|
-
import UndoIcon from '@mui/icons-material/Undo';
|
|
32
|
-
import RedoIcon from '@mui/icons-material/Redo';
|
|
33
|
-
import DownloadIcon from '@mui/icons-material/Download';
|
|
34
|
-
import UploadIcon from '@mui/icons-material/Upload';
|
|
35
|
-
import ActorNodeSettings from './ActorNodeSettings';
|
|
36
|
-
import AddRelationshipDialog from './AddRelationshipDialog';
|
|
37
|
-
import UseCaseNodeSettings from './UseCaseNodeSettings';
|
|
38
|
-
import PackageNodeSettings from './PackageNodeSettings';
|
|
39
|
-
import DiagramPanel from '../../../components/DiagramPanel';
|
|
40
|
-
import Sidebar from '../../../components/SideBar';
|
|
41
|
-
import MiniMapCommon from '../../../components/MiniMapCommon';
|
|
42
|
-
import AiButton from '../../../components/AiButton';
|
|
43
|
-
|
|
44
|
-
const nodeTypes = {
|
|
45
|
-
actor: ActorNode,
|
|
46
|
-
usecase: UseCaseNode,
|
|
47
|
-
package: PackageNode,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const edgeTypes = {
|
|
51
|
-
association: UseCaseEdge,
|
|
52
|
-
include: UseCaseEdge,
|
|
53
|
-
extend: UseCaseEdge,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// Utility: Get a random position for a new node
|
|
57
|
-
function getRandomPosition(): { x: number; y: number } {
|
|
58
|
-
return { x: 100 + Math.random() * 400, y: 100 + Math.random() * 300 };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Utility: Get absolute position of a node (recursively sums parent positions)
|
|
62
|
-
function getAbsolutePosition(
|
|
63
|
-
node: Node,
|
|
64
|
-
allNodes: Node[],
|
|
65
|
-
): { x: number; y: number } {
|
|
66
|
-
let x = node.position.x;
|
|
67
|
-
let y = node.position.y;
|
|
68
|
-
let current = node;
|
|
69
|
-
while (current.parentId) {
|
|
70
|
-
const parent = allNodes.find((n) => n.id === current.parentId);
|
|
71
|
-
if (!parent) break;
|
|
72
|
-
x += parent.position.x;
|
|
73
|
-
y += parent.position.y;
|
|
74
|
-
current = parent;
|
|
75
|
-
}
|
|
76
|
-
return { x, y };
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Utility: Shallow compare node/edge arrays by id and length
|
|
80
|
-
function shallowCompareById(a: (Node | Edge)[], b: (Node | Edge)[]) {
|
|
81
|
-
if (a.length !== b.length) return false;
|
|
82
|
-
const aIds = a.map((n) => n.id).sort();
|
|
83
|
-
const bIds = b.map((n) => n.id).sort();
|
|
84
|
-
for (let i = 0; i < aIds.length; i++) {
|
|
85
|
-
if (aIds[i] !== bIds[i]) return false;
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Utility: Debounce function
|
|
91
|
-
function debounce(fn: (...args: unknown[]) => void, delay: number) {
|
|
92
|
-
let timer: NodeJS.Timeout | null = null;
|
|
93
|
-
return (...args: unknown[]) => {
|
|
94
|
-
if (timer) clearTimeout(timer);
|
|
95
|
-
timer = setTimeout(() => fn(...args), delay);
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const UseCaseDiagramFlow: React.FC<UseCaseDiagramProps> = ({
|
|
100
|
-
caseNodes,
|
|
101
|
-
caseEdges,
|
|
102
|
-
}) => {
|
|
103
|
-
const [nodes, setNodes, onNodesChange] = useNodesState(caseNodes);
|
|
104
|
-
const [edges, setEdges, onEdgesChange] = useEdgesState(caseEdges);
|
|
105
|
-
|
|
106
|
-
// Improved history state for undo/redo
|
|
107
|
-
const [history, setHistory] = useState<HistoryState[]>(
|
|
108
|
-
[],
|
|
109
|
-
);
|
|
110
|
-
const [historyIndex, setHistoryIndex] = useState<number>(-1);
|
|
111
|
-
const isUndoRedoAction = useRef(false);
|
|
112
|
-
|
|
113
|
-
// Debounced history update
|
|
114
|
-
const debouncedUpdateHistory = useRef(
|
|
115
|
-
debounce(
|
|
116
|
-
(...args: unknown[]) => {
|
|
117
|
-
const [nodes, edges, history, historyIndex, setHistory, setHistoryIndex] = args as [
|
|
118
|
-
Node[],
|
|
119
|
-
Edge[],
|
|
120
|
-
HistoryState[],
|
|
121
|
-
number,
|
|
122
|
-
React.Dispatch<React.SetStateAction<HistoryState[]>>,
|
|
123
|
-
React.Dispatch<React.SetStateAction<number>>
|
|
124
|
-
];
|
|
125
|
-
const newHistoryEntry: HistoryState = {
|
|
126
|
-
nodes: [...nodes],
|
|
127
|
-
edges: [...edges],
|
|
128
|
-
};
|
|
129
|
-
const currentState = history[historyIndex];
|
|
130
|
-
if (
|
|
131
|
-
shallowCompareById(currentState.nodes, newHistoryEntry.nodes) &&
|
|
132
|
-
shallowCompareById(currentState.edges, newHistoryEntry.edges)
|
|
133
|
-
) {
|
|
134
|
-
return; // No change, don't add to history
|
|
135
|
-
}
|
|
136
|
-
// Trim future history if we're in the middle of the history stack
|
|
137
|
-
const newHistory = history.slice(0, historyIndex + 1);
|
|
138
|
-
newHistory.push(newHistoryEntry);
|
|
139
|
-
setHistory(newHistory);
|
|
140
|
-
setHistoryIndex(newHistory.length - 1);
|
|
141
|
-
},
|
|
142
|
-
300,
|
|
143
|
-
),
|
|
144
|
-
).current;
|
|
145
|
-
|
|
146
|
-
// Initialize history with initial state
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
if (history.length === 0) {
|
|
149
|
-
setHistory([{ nodes: [...nodes], edges: [...edges] }]);
|
|
150
|
-
setHistoryIndex(0);
|
|
151
|
-
}
|
|
152
|
-
}, []); // Only run on mount
|
|
153
|
-
|
|
154
|
-
// Debounced save to history on nodes/edges change
|
|
155
|
-
useEffect(() => {
|
|
156
|
-
if (isUndoRedoAction.current || history.length === 0) return;
|
|
157
|
-
debouncedUpdateHistory(
|
|
158
|
-
nodes,
|
|
159
|
-
edges,
|
|
160
|
-
history,
|
|
161
|
-
historyIndex,
|
|
162
|
-
setHistory,
|
|
163
|
-
setHistoryIndex,
|
|
164
|
-
);
|
|
165
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
|
-
}, [nodes, edges]);
|
|
167
|
-
|
|
168
|
-
// Undo handler
|
|
169
|
-
const handleUndo = useCallback(() => {
|
|
170
|
-
if (historyIndex > 0) {
|
|
171
|
-
isUndoRedoAction.current = true;
|
|
172
|
-
const prev = history[historyIndex - 1];
|
|
173
|
-
setNodes(prev.nodes);
|
|
174
|
-
setEdges(prev.edges);
|
|
175
|
-
setHistoryIndex(historyIndex - 1);
|
|
176
|
-
setTimeout(() => {
|
|
177
|
-
isUndoRedoAction.current = false;
|
|
178
|
-
}, 0);
|
|
179
|
-
}
|
|
180
|
-
}, [history, historyIndex, setNodes, setEdges]);
|
|
181
|
-
|
|
182
|
-
// Redo handler
|
|
183
|
-
const handleRedo = useCallback(() => {
|
|
184
|
-
if (historyIndex < history.length - 1) {
|
|
185
|
-
isUndoRedoAction.current = true;
|
|
186
|
-
const next = history[historyIndex + 1];
|
|
187
|
-
setNodes(next.nodes);
|
|
188
|
-
setEdges(next.edges);
|
|
189
|
-
setHistoryIndex(historyIndex + 1);
|
|
190
|
-
setTimeout(() => {
|
|
191
|
-
isUndoRedoAction.current = false;
|
|
192
|
-
}, 0);
|
|
193
|
-
}
|
|
194
|
-
}, [history, historyIndex, setNodes, setEdges]);
|
|
195
|
-
|
|
196
|
-
// Keyboard shortcuts for undo/redo
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
199
|
-
// Ctrl+Z or Cmd+Z (undo)
|
|
200
|
-
if ((e.ctrlKey || e.metaKey) && e.key === 'z' && !e.shiftKey) {
|
|
201
|
-
e.preventDefault();
|
|
202
|
-
handleUndo();
|
|
203
|
-
}
|
|
204
|
-
// Ctrl+Y or Cmd+Shift+Z (redo)
|
|
205
|
-
if (
|
|
206
|
-
((e.ctrlKey || e.metaKey) && e.key === 'y') ||
|
|
207
|
-
((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === 'z')
|
|
208
|
-
) {
|
|
209
|
-
e.preventDefault();
|
|
210
|
-
handleRedo();
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
214
|
-
return () => {
|
|
215
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
216
|
-
};
|
|
217
|
-
}, [handleUndo, handleRedo]);
|
|
218
|
-
|
|
219
|
-
const handleClear = useCallback(() => {
|
|
220
|
-
const cleared = { nodes: [], edges: [] };
|
|
221
|
-
const newHistory = history.slice(0, historyIndex + 1);
|
|
222
|
-
newHistory.push(cleared);
|
|
223
|
-
setNodes([]);
|
|
224
|
-
setEdges([]);
|
|
225
|
-
setHistory(newHistory);
|
|
226
|
-
setHistoryIndex(newHistory.length - 1);
|
|
227
|
-
}, [history, historyIndex, setNodes, setEdges]);
|
|
228
|
-
|
|
229
|
-
// Node creation helpers (DRY)
|
|
230
|
-
function createNode({
|
|
231
|
-
type,
|
|
232
|
-
label,
|
|
233
|
-
data = {},
|
|
234
|
-
style,
|
|
235
|
-
business,
|
|
236
|
-
parentNode,
|
|
237
|
-
width,
|
|
238
|
-
height,
|
|
239
|
-
}: CreateNodeParams): CreateNodeResult {
|
|
240
|
-
const id = `${type}-${Date.now()}-${Math.floor(Math.random() * 10000)}`;
|
|
241
|
-
const position = getRandomPosition();
|
|
242
|
-
let nodeData: UseCaseNodeData | PackageNodeData;
|
|
243
|
-
switch (type) {
|
|
244
|
-
case 'actor':
|
|
245
|
-
nodeData = {
|
|
246
|
-
label: label || 'Actor',
|
|
247
|
-
style: style || 'stickman',
|
|
248
|
-
...data,
|
|
249
|
-
} as ActorNodeData;
|
|
250
|
-
break;
|
|
251
|
-
case 'usecase':
|
|
252
|
-
nodeData = {
|
|
253
|
-
label: label || 'Use Case',
|
|
254
|
-
business: !!business,
|
|
255
|
-
...data,
|
|
256
|
-
} as UseCaseNodeData;
|
|
257
|
-
break;
|
|
258
|
-
case 'package':
|
|
259
|
-
nodeData = {
|
|
260
|
-
label: label || 'Package',
|
|
261
|
-
width,
|
|
262
|
-
height,
|
|
263
|
-
...data
|
|
264
|
-
} as PackageNodeData;
|
|
265
|
-
break;
|
|
266
|
-
default:
|
|
267
|
-
nodeData = { label: label || 'Node', ...data } as UseCaseNodeData;
|
|
268
|
-
}
|
|
269
|
-
return {
|
|
270
|
-
id,
|
|
271
|
-
type,
|
|
272
|
-
position,
|
|
273
|
-
data: nodeData,
|
|
274
|
-
...(parentNode
|
|
275
|
-
? { parentNode, extent: 'parent' as const, draggable: true }
|
|
276
|
-
: {}),
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const handleAddActor = useCallback(
|
|
281
|
-
(type: 'stickman' | 'business') => {
|
|
282
|
-
const label = `${type === 'business' ? 'Business Actor' : 'Actor'} ${nodes.filter((n) => n.type === 'actor' && (type === 'business' ? n.data.style === 'business' : n.data.style !== 'business')).length + 1}`;
|
|
283
|
-
const newNode = createNode({ type: 'actor', label, style: type });
|
|
284
|
-
setNodes((nds) => [...nds, newNode]);
|
|
285
|
-
},
|
|
286
|
-
[nodes, setNodes],
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
const handleAddUseCase = useCallback(() => {
|
|
290
|
-
const label = `Use Case ${nodes.filter((n) => n.type === 'usecase' && !n.data.business).length + 1}`;
|
|
291
|
-
const newNode = createNode({ type: 'usecase', label, business: false });
|
|
292
|
-
setNodes((nds) => [...nds, newNode]);
|
|
293
|
-
}, [nodes, setNodes]);
|
|
294
|
-
|
|
295
|
-
const handleAddBusinessUseCase = useCallback(() => {
|
|
296
|
-
const label = `Business Use Case ${nodes.filter((n) => n.type === 'usecase' && n.data.business).length + 1}`;
|
|
297
|
-
const newNode = createNode({ type: 'usecase', label, business: true });
|
|
298
|
-
setNodes((nds) => [...nds, newNode]);
|
|
299
|
-
}, [nodes, setNodes]);
|
|
300
|
-
|
|
301
|
-
const handleAddPackage = useCallback(() => {
|
|
302
|
-
const label = `Package ${nodes.filter((n) => n.type === 'package').length + 1}`;
|
|
303
|
-
const newNode = createNode({ type: 'package', label });
|
|
304
|
-
setNodes((nds) => [...nds, newNode]);
|
|
305
|
-
}, [nodes, setNodes]);
|
|
306
|
-
|
|
307
|
-
// Relationship dialog state
|
|
308
|
-
const [relationshipDialogOpen, setRelationshipDialogOpen] = useState(false);
|
|
309
|
-
const [pendingRelationshipType, setPendingRelationshipType] = useState<
|
|
310
|
-
null | 'association' | 'include' | 'extend'
|
|
311
|
-
>(null);
|
|
312
|
-
const [pendingSourceId, setPendingSourceId] = useState<string | null>(null);
|
|
313
|
-
const [pendingTargetId, setPendingTargetId] = useState<string | null>(null);
|
|
314
|
-
const [editingEdge, setEditingEdge] = useState<Edge<UseCaseEdgeData> | null>(null);
|
|
315
|
-
|
|
316
|
-
const handleAddAssociation = useCallback(() => {
|
|
317
|
-
setPendingRelationshipType('association');
|
|
318
|
-
setRelationshipDialogOpen(true);
|
|
319
|
-
setEditingEdge(null);
|
|
320
|
-
}, []);
|
|
321
|
-
const handleAddInclude = useCallback(() => {
|
|
322
|
-
setPendingRelationshipType('include');
|
|
323
|
-
setRelationshipDialogOpen(true);
|
|
324
|
-
setEditingEdge(null);
|
|
325
|
-
}, []);
|
|
326
|
-
const handleAddExtend = useCallback(() => {
|
|
327
|
-
setPendingRelationshipType('extend');
|
|
328
|
-
setRelationshipDialogOpen(true);
|
|
329
|
-
setEditingEdge(null);
|
|
330
|
-
}, []);
|
|
331
|
-
|
|
332
|
-
const handleEditRelationship = useCallback((edge: Edge<UseCaseEdgeData>) => {
|
|
333
|
-
setEditingEdge(edge);
|
|
334
|
-
setPendingRelationshipType((edge.data?.type || edge.type) as UseCaseEdgeType);
|
|
335
|
-
setPendingSourceId(edge.source);
|
|
336
|
-
setPendingTargetId(edge.target);
|
|
337
|
-
setRelationshipDialogOpen(true);
|
|
338
|
-
}, []);
|
|
339
|
-
|
|
340
|
-
// Manual edge creation state
|
|
341
|
-
const [connectStartNodeId, setConnectStartNodeId] = useState<string | null>(
|
|
342
|
-
null,
|
|
343
|
-
);
|
|
344
|
-
const [pendingSourceHandle, setPendingSourceHandle] = useState<string | null>(
|
|
345
|
-
null,
|
|
346
|
-
);
|
|
347
|
-
const [pendingTargetHandle, setPendingTargetHandle] = useState<string | null>(
|
|
348
|
-
null,
|
|
349
|
-
);
|
|
350
|
-
const handleConnectStart = useCallback(
|
|
351
|
-
(
|
|
352
|
-
event: MouseEvent | TouchEvent,
|
|
353
|
-
params: OnConnectStartParams,
|
|
354
|
-
) => {
|
|
355
|
-
setConnectStartNodeId(params.nodeId);
|
|
356
|
-
},
|
|
357
|
-
[],
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
const handleConnect = useCallback(
|
|
361
|
-
(params: Connection) => {
|
|
362
|
-
if (!params.source || !params.target) return;
|
|
363
|
-
const trueSource = connectStartNodeId || params.source;
|
|
364
|
-
const trueTarget =
|
|
365
|
-
trueSource === params.source ? params.target : params.source;
|
|
366
|
-
let sourceHandle = params.sourceHandle || 'right';
|
|
367
|
-
let targetHandle = params.targetHandle || 'left';
|
|
368
|
-
const sourceNode = nodes.find((n) => n.id === trueSource);
|
|
369
|
-
const targetNode = nodes.find((n) => n.id === trueTarget);
|
|
370
|
-
let sourceAbsX = 0,
|
|
371
|
-
targetAbsX = 0;
|
|
372
|
-
if (sourceNode && targetNode) {
|
|
373
|
-
sourceAbsX = getAbsolutePosition(sourceNode, nodes).x;
|
|
374
|
-
targetAbsX = getAbsolutePosition(targetNode, nodes).x;
|
|
375
|
-
}
|
|
376
|
-
if (sourceNode && targetNode && sourceAbsX > targetAbsX) {
|
|
377
|
-
setPendingSourceId(trueTarget);
|
|
378
|
-
setPendingTargetId(trueSource);
|
|
379
|
-
setPendingSourceHandle(targetHandle);
|
|
380
|
-
setPendingTargetHandle(sourceHandle);
|
|
381
|
-
} else {
|
|
382
|
-
setPendingSourceId(trueSource);
|
|
383
|
-
setPendingTargetId(trueTarget);
|
|
384
|
-
setPendingSourceHandle(sourceHandle);
|
|
385
|
-
setPendingTargetHandle(targetHandle);
|
|
386
|
-
}
|
|
387
|
-
setPendingRelationshipType('association');
|
|
388
|
-
setRelationshipDialogOpen(true);
|
|
389
|
-
setConnectStartNodeId(null);
|
|
390
|
-
},
|
|
391
|
-
[connectStartNodeId, nodes],
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
const handleAddRelationship = (
|
|
395
|
-
sourceId: string,
|
|
396
|
-
targetId: string,
|
|
397
|
-
type: 'association' | 'include' | 'extend',
|
|
398
|
-
label?: string,
|
|
399
|
-
arrowHeadSource?: 'none' | 'triangle' | 'v',
|
|
400
|
-
arrowHeadTarget?: 'none' | 'triangle' | 'v',
|
|
401
|
-
) => {
|
|
402
|
-
if (editingEdge) {
|
|
403
|
-
setEdges((eds) =>
|
|
404
|
-
eds.map((e) =>
|
|
405
|
-
e.id === editingEdge.id
|
|
406
|
-
? {
|
|
407
|
-
...e,
|
|
408
|
-
source: sourceId,
|
|
409
|
-
target: targetId,
|
|
410
|
-
type,
|
|
411
|
-
data: {
|
|
412
|
-
...e.data,
|
|
413
|
-
type,
|
|
414
|
-
label,
|
|
415
|
-
arrowHeadSource: arrowHeadSource || 'none',
|
|
416
|
-
arrowHeadTarget: arrowHeadTarget || 'none',
|
|
417
|
-
},
|
|
418
|
-
sourceHandle: pendingSourceHandle || undefined,
|
|
419
|
-
targetHandle: pendingTargetHandle || undefined,
|
|
420
|
-
}
|
|
421
|
-
: e,
|
|
422
|
-
),
|
|
423
|
-
);
|
|
424
|
-
setEditingEdge(null);
|
|
425
|
-
} else {
|
|
426
|
-
const id = `${type}-${edges.length + 1}-${Date.now()}`;
|
|
427
|
-
const newEdge: Edge<UseCaseEdgeData> = {
|
|
428
|
-
id,
|
|
429
|
-
source: sourceId,
|
|
430
|
-
target: targetId,
|
|
431
|
-
type,
|
|
432
|
-
data: {
|
|
433
|
-
type,
|
|
434
|
-
label,
|
|
435
|
-
arrowHeadSource: arrowHeadSource || 'none',
|
|
436
|
-
arrowHeadTarget: arrowHeadTarget || 'none',
|
|
437
|
-
},
|
|
438
|
-
sourceHandle: pendingSourceHandle || undefined,
|
|
439
|
-
targetHandle: pendingTargetHandle || undefined,
|
|
440
|
-
};
|
|
441
|
-
setEdges((eds) => [...eds, newEdge]);
|
|
442
|
-
}
|
|
443
|
-
setPendingSourceHandle(null);
|
|
444
|
-
setPendingTargetHandle(null);
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
const handleDeleteRelationship = () => {
|
|
448
|
-
if (editingEdge) {
|
|
449
|
-
setEdges((eds) => eds.filter((e) => e.id !== editingEdge.id));
|
|
450
|
-
setEditingEdge(null);
|
|
451
|
-
setRelationshipDialogOpen(false);
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
// Export/import diagram
|
|
456
|
-
const exportDiagram = useCallback(() => {
|
|
457
|
-
const diagramData = { nodes, edges };
|
|
458
|
-
const dataStr = JSON.stringify(diagramData, null, 2);
|
|
459
|
-
const dataUri =
|
|
460
|
-
'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr);
|
|
461
|
-
const exportFileDefaultName = 'usecase-diagram.json';
|
|
462
|
-
const linkElement = document.createElement('a');
|
|
463
|
-
linkElement.setAttribute('href', dataUri);
|
|
464
|
-
linkElement.setAttribute('download', exportFileDefaultName);
|
|
465
|
-
linkElement.click();
|
|
466
|
-
}, [nodes, edges]);
|
|
467
|
-
|
|
468
|
-
const importDiagram = useCallback(
|
|
469
|
-
(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
470
|
-
if (!event.target.files || event.target.files.length === 0) return;
|
|
471
|
-
const fileReader = new FileReader();
|
|
472
|
-
fileReader.readAsText(event.target.files[0], 'UTF-8');
|
|
473
|
-
fileReader.onload = (e) => {
|
|
474
|
-
try {
|
|
475
|
-
if (!e.target || typeof e.target.result !== 'string') return;
|
|
476
|
-
const imported = JSON.parse(e.target.result);
|
|
477
|
-
if (imported.nodes && imported.edges) {
|
|
478
|
-
setNodes(imported.nodes);
|
|
479
|
-
setEdges(imported.edges);
|
|
480
|
-
}
|
|
481
|
-
} catch (error) {
|
|
482
|
-
console.error('Error importing diagram:', error);
|
|
483
|
-
alert('Failed to import diagram. Invalid file format.');
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
},
|
|
487
|
-
[setNodes, setEdges],
|
|
488
|
-
);
|
|
489
|
-
|
|
490
|
-
const [selectedNode, setSelectedNode] = useState<Node | null>(null);
|
|
491
|
-
|
|
492
|
-
const handleNodeDoubleClick = useCallback<NonNullable<NodeMouseHandler>>(
|
|
493
|
-
(event, node) => {
|
|
494
|
-
setSelectedNode(node);
|
|
495
|
-
},
|
|
496
|
-
[],
|
|
497
|
-
);
|
|
498
|
-
|
|
499
|
-
const handleUpdateNode = useCallback(
|
|
500
|
-
(updates: Partial<UseCaseNodeData | PackageNodeData | ActorNodeData>) => {
|
|
501
|
-
if (!selectedNode) return;
|
|
502
|
-
setNodes((nds) =>
|
|
503
|
-
nds.map((n) =>
|
|
504
|
-
n.id === selectedNode.id
|
|
505
|
-
? { ...n, data: { ...n.data, ...updates } }
|
|
506
|
-
: n,
|
|
507
|
-
),
|
|
508
|
-
);
|
|
509
|
-
},
|
|
510
|
-
[selectedNode, setNodes],
|
|
511
|
-
);
|
|
512
|
-
|
|
513
|
-
return (
|
|
514
|
-
<div style={{ display: 'flex', width: '100%', height: '100vh' }}>
|
|
515
|
-
<div>
|
|
516
|
-
<Sidebar>
|
|
517
|
-
<UseCaseControls
|
|
518
|
-
onAddActor={handleAddActor}
|
|
519
|
-
onAddUseCase={handleAddUseCase}
|
|
520
|
-
onAddBusinessUseCase={handleAddBusinessUseCase}
|
|
521
|
-
onAddPackage={handleAddPackage}
|
|
522
|
-
onAddAssociation={handleAddAssociation}
|
|
523
|
-
onAddInclude={handleAddInclude}
|
|
524
|
-
onAddExtend={handleAddExtend}
|
|
525
|
-
edges={edges as Edge<UseCaseEdgeData>[]}
|
|
526
|
-
nodes={nodes}
|
|
527
|
-
onEditRelationship={handleEditRelationship}
|
|
528
|
-
/>
|
|
529
|
-
</Sidebar>
|
|
530
|
-
</div>
|
|
531
|
-
<div style={{ flex: 1, height: '100%', position: 'relative' }}>
|
|
532
|
-
<ReactFlow
|
|
533
|
-
nodes={nodes}
|
|
534
|
-
edges={edges.map((edge) => ({
|
|
535
|
-
...edge,
|
|
536
|
-
label:
|
|
537
|
-
typeof edge.data?.label === 'string'
|
|
538
|
-
? edge.data.label
|
|
539
|
-
: undefined,
|
|
540
|
-
}))}
|
|
541
|
-
onNodesChange={onNodesChange}
|
|
542
|
-
onEdgesChange={onEdgesChange}
|
|
543
|
-
onConnect={handleConnect}
|
|
544
|
-
onConnectStart={handleConnectStart}
|
|
545
|
-
nodeTypes={nodeTypes}
|
|
546
|
-
edgeTypes={edgeTypes}
|
|
547
|
-
fitView
|
|
548
|
-
onNodeDoubleClick={handleNodeDoubleClick}
|
|
549
|
-
onEdgeClick={(_, edge) => handleEditRelationship(edge as Edge<UseCaseEdgeData>)}
|
|
550
|
-
onPaneClick={() => {
|
|
551
|
-
setSelectedNode(null);
|
|
552
|
-
}}
|
|
553
|
-
>
|
|
554
|
-
<Background color="#f8f9fa" gap={16} />
|
|
555
|
-
<MiniMapCommon />
|
|
556
|
-
<AiButton />
|
|
557
|
-
</ReactFlow>
|
|
558
|
-
|
|
559
|
-
{/* Node Settings Panel */}
|
|
560
|
-
{selectedNode && selectedNode.type === 'actor' && (
|
|
561
|
-
<ActorNodeSettings
|
|
562
|
-
open={true}
|
|
563
|
-
node={selectedNode as Node<ActorNodeData>}
|
|
564
|
-
onUpdate={handleUpdateNode}
|
|
565
|
-
onClose={() => setSelectedNode(null)}
|
|
566
|
-
/>
|
|
567
|
-
)}
|
|
568
|
-
{selectedNode && selectedNode.type === 'usecase' && (
|
|
569
|
-
<UseCaseNodeSettings
|
|
570
|
-
open={true}
|
|
571
|
-
node={selectedNode as unknown as Node<UseCaseNodeData>}
|
|
572
|
-
onUpdate={handleUpdateNode}
|
|
573
|
-
onClose={() => setSelectedNode(null)}
|
|
574
|
-
/>
|
|
575
|
-
)}
|
|
576
|
-
{selectedNode && selectedNode.type === 'package' && (
|
|
577
|
-
<PackageNodeSettings
|
|
578
|
-
nodeId={selectedNode.id}
|
|
579
|
-
data={selectedNode.data as unknown as PackageNodeData}
|
|
580
|
-
nodes={nodes}
|
|
581
|
-
setNodes={setNodes}
|
|
582
|
-
onUpdate={handleUpdateNode}
|
|
583
|
-
onClose={() => setSelectedNode(null)}
|
|
584
|
-
/>
|
|
585
|
-
)}
|
|
586
|
-
{/* Bottom-right panel for controls */}
|
|
587
|
-
<DiagramPanel
|
|
588
|
-
historyIndex={historyIndex}
|
|
589
|
-
historyLength={history.length}
|
|
590
|
-
onUndo={handleUndo}
|
|
591
|
-
onRedo={handleRedo}
|
|
592
|
-
onClear={handleClear}
|
|
593
|
-
onImport={importDiagram}
|
|
594
|
-
isSettingsOpen={false}
|
|
595
|
-
onToggleSettings={() => { }}
|
|
596
|
-
/>
|
|
597
|
-
<AddRelationshipDialog
|
|
598
|
-
open={relationshipDialogOpen}
|
|
599
|
-
onClose={() => {
|
|
600
|
-
setRelationshipDialogOpen(false);
|
|
601
|
-
setEditingEdge(null);
|
|
602
|
-
}}
|
|
603
|
-
onAddRelationship={(
|
|
604
|
-
sourceId,
|
|
605
|
-
targetId,
|
|
606
|
-
type,
|
|
607
|
-
label,
|
|
608
|
-
arrowHeadSource,
|
|
609
|
-
arrowHeadTarget,
|
|
610
|
-
) => {
|
|
611
|
-
handleAddRelationship(
|
|
612
|
-
sourceId,
|
|
613
|
-
targetId,
|
|
614
|
-
type,
|
|
615
|
-
label,
|
|
616
|
-
arrowHeadSource,
|
|
617
|
-
arrowHeadTarget,
|
|
618
|
-
);
|
|
619
|
-
setRelationshipDialogOpen(false);
|
|
620
|
-
setPendingSourceId(null);
|
|
621
|
-
setPendingTargetId(null);
|
|
622
|
-
setPendingRelationshipType(null);
|
|
623
|
-
setEditingEdge(null);
|
|
624
|
-
}}
|
|
625
|
-
nodes={nodes}
|
|
626
|
-
initialSourceId={editingEdge ? editingEdge.source : pendingSourceId}
|
|
627
|
-
initialTargetId={editingEdge ? editingEdge.target : pendingTargetId}
|
|
628
|
-
onDialogOpen={() => { }}
|
|
629
|
-
editingEdge={editingEdge}
|
|
630
|
-
onDeleteRelationship={handleDeleteRelationship}
|
|
631
|
-
/>
|
|
632
|
-
</div>
|
|
633
|
-
</div>
|
|
634
|
-
);
|
|
635
|
-
};
|
|
636
|
-
|
|
637
|
-
export default UseCaseDiagramFlow;
|
|
1
|
+
import React, { useCallback, useState, useRef, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ReactFlow,
|
|
4
|
+
Background,
|
|
5
|
+
useNodesState,
|
|
6
|
+
useEdgesState,
|
|
7
|
+
Node,
|
|
8
|
+
Edge,
|
|
9
|
+
NodeMouseHandler,
|
|
10
|
+
Connection,
|
|
11
|
+
OnConnectStartParams,
|
|
12
|
+
} from '@xyflow/react';
|
|
13
|
+
import {
|
|
14
|
+
UseCaseDiagramProps,
|
|
15
|
+
UseCaseNodeData,
|
|
16
|
+
PackageNodeData,
|
|
17
|
+
UseCaseEdgeData,
|
|
18
|
+
UseCaseEdgeType,
|
|
19
|
+
CreateNodeParams,
|
|
20
|
+
CreateNodeResult,
|
|
21
|
+
HistoryState,
|
|
22
|
+
RelationshipDialogState,
|
|
23
|
+
} from '../../../types/usecase-types';
|
|
24
|
+
import { ActorNodeData } from '../../../types/shared-node-types';
|
|
25
|
+
import UseCaseControls from '../controls/UseCaseControls';
|
|
26
|
+
import ActorNode from '../../../atoms/ActorNode';
|
|
27
|
+
import UseCaseNode from '../nodes/UseCaseNode';
|
|
28
|
+
import PackageNode from '../nodes/PackageNode';
|
|
29
|
+
import UseCaseEdge from '../nodes/UseCaseEdge';
|
|
30
|
+
import { Button, Paper, Box } from '@mui/material';
|
|
31
|
+
import UndoIcon from '@mui/icons-material/Undo';
|
|
32
|
+
import RedoIcon from '@mui/icons-material/Redo';
|
|
33
|
+
import DownloadIcon from '@mui/icons-material/Download';
|
|
34
|
+
import UploadIcon from '@mui/icons-material/Upload';
|
|
35
|
+
import ActorNodeSettings from './ActorNodeSettings';
|
|
36
|
+
import AddRelationshipDialog from './AddRelationshipDialog';
|
|
37
|
+
import UseCaseNodeSettings from './UseCaseNodeSettings';
|
|
38
|
+
import PackageNodeSettings from './PackageNodeSettings';
|
|
39
|
+
import DiagramPanel from '../../../components/DiagramPanel';
|
|
40
|
+
import Sidebar from '../../../components/SideBar';
|
|
41
|
+
import MiniMapCommon from '../../../components/MiniMapCommon';
|
|
42
|
+
import AiButton from '../../../components/AiButton';
|
|
43
|
+
|
|
44
|
+
const nodeTypes = {
|
|
45
|
+
actor: ActorNode,
|
|
46
|
+
usecase: UseCaseNode,
|
|
47
|
+
package: PackageNode,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const edgeTypes = {
|
|
51
|
+
association: UseCaseEdge,
|
|
52
|
+
include: UseCaseEdge,
|
|
53
|
+
extend: UseCaseEdge,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Utility: Get a random position for a new node
|
|
57
|
+
function getRandomPosition(): { x: number; y: number } {
|
|
58
|
+
return { x: 100 + Math.random() * 400, y: 100 + Math.random() * 300 };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Utility: Get absolute position of a node (recursively sums parent positions)
|
|
62
|
+
function getAbsolutePosition(
|
|
63
|
+
node: Node,
|
|
64
|
+
allNodes: Node[],
|
|
65
|
+
): { x: number; y: number } {
|
|
66
|
+
let x = node.position.x;
|
|
67
|
+
let y = node.position.y;
|
|
68
|
+
let current = node;
|
|
69
|
+
while (current.parentId) {
|
|
70
|
+
const parent = allNodes.find((n) => n.id === current.parentId);
|
|
71
|
+
if (!parent) break;
|
|
72
|
+
x += parent.position.x;
|
|
73
|
+
y += parent.position.y;
|
|
74
|
+
current = parent;
|
|
75
|
+
}
|
|
76
|
+
return { x, y };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Utility: Shallow compare node/edge arrays by id and length
|
|
80
|
+
function shallowCompareById(a: (Node | Edge)[], b: (Node | Edge)[]) {
|
|
81
|
+
if (a.length !== b.length) return false;
|
|
82
|
+
const aIds = a.map((n) => n.id).sort();
|
|
83
|
+
const bIds = b.map((n) => n.id).sort();
|
|
84
|
+
for (let i = 0; i < aIds.length; i++) {
|
|
85
|
+
if (aIds[i] !== bIds[i]) return false;
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Utility: Debounce function
|
|
91
|
+
function debounce(fn: (...args: unknown[]) => void, delay: number) {
|
|
92
|
+
let timer: NodeJS.Timeout | null = null;
|
|
93
|
+
return (...args: unknown[]) => {
|
|
94
|
+
if (timer) clearTimeout(timer);
|
|
95
|
+
timer = setTimeout(() => fn(...args), delay);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const UseCaseDiagramFlow: React.FC<UseCaseDiagramProps> = ({
|
|
100
|
+
caseNodes,
|
|
101
|
+
caseEdges,
|
|
102
|
+
}) => {
|
|
103
|
+
const [nodes, setNodes, onNodesChange] = useNodesState(caseNodes);
|
|
104
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState(caseEdges);
|
|
105
|
+
|
|
106
|
+
// Improved history state for undo/redo
|
|
107
|
+
const [history, setHistory] = useState<HistoryState[]>(
|
|
108
|
+
[],
|
|
109
|
+
);
|
|
110
|
+
const [historyIndex, setHistoryIndex] = useState<number>(-1);
|
|
111
|
+
const isUndoRedoAction = useRef(false);
|
|
112
|
+
|
|
113
|
+
// Debounced history update
|
|
114
|
+
const debouncedUpdateHistory = useRef(
|
|
115
|
+
debounce(
|
|
116
|
+
(...args: unknown[]) => {
|
|
117
|
+
const [nodes, edges, history, historyIndex, setHistory, setHistoryIndex] = args as [
|
|
118
|
+
Node[],
|
|
119
|
+
Edge[],
|
|
120
|
+
HistoryState[],
|
|
121
|
+
number,
|
|
122
|
+
React.Dispatch<React.SetStateAction<HistoryState[]>>,
|
|
123
|
+
React.Dispatch<React.SetStateAction<number>>
|
|
124
|
+
];
|
|
125
|
+
const newHistoryEntry: HistoryState = {
|
|
126
|
+
nodes: [...nodes],
|
|
127
|
+
edges: [...edges],
|
|
128
|
+
};
|
|
129
|
+
const currentState = history[historyIndex];
|
|
130
|
+
if (
|
|
131
|
+
shallowCompareById(currentState.nodes, newHistoryEntry.nodes) &&
|
|
132
|
+
shallowCompareById(currentState.edges, newHistoryEntry.edges)
|
|
133
|
+
) {
|
|
134
|
+
return; // No change, don't add to history
|
|
135
|
+
}
|
|
136
|
+
// Trim future history if we're in the middle of the history stack
|
|
137
|
+
const newHistory = history.slice(0, historyIndex + 1);
|
|
138
|
+
newHistory.push(newHistoryEntry);
|
|
139
|
+
setHistory(newHistory);
|
|
140
|
+
setHistoryIndex(newHistory.length - 1);
|
|
141
|
+
},
|
|
142
|
+
300,
|
|
143
|
+
),
|
|
144
|
+
).current;
|
|
145
|
+
|
|
146
|
+
// Initialize history with initial state
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (history.length === 0) {
|
|
149
|
+
setHistory([{ nodes: [...nodes], edges: [...edges] }]);
|
|
150
|
+
setHistoryIndex(0);
|
|
151
|
+
}
|
|
152
|
+
}, []); // Only run on mount
|
|
153
|
+
|
|
154
|
+
// Debounced save to history on nodes/edges change
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (isUndoRedoAction.current || history.length === 0) return;
|
|
157
|
+
debouncedUpdateHistory(
|
|
158
|
+
nodes,
|
|
159
|
+
edges,
|
|
160
|
+
history,
|
|
161
|
+
historyIndex,
|
|
162
|
+
setHistory,
|
|
163
|
+
setHistoryIndex,
|
|
164
|
+
);
|
|
165
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
|
+
}, [nodes, edges]);
|
|
167
|
+
|
|
168
|
+
// Undo handler
|
|
169
|
+
const handleUndo = useCallback(() => {
|
|
170
|
+
if (historyIndex > 0) {
|
|
171
|
+
isUndoRedoAction.current = true;
|
|
172
|
+
const prev = history[historyIndex - 1];
|
|
173
|
+
setNodes(prev.nodes);
|
|
174
|
+
setEdges(prev.edges);
|
|
175
|
+
setHistoryIndex(historyIndex - 1);
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
isUndoRedoAction.current = false;
|
|
178
|
+
}, 0);
|
|
179
|
+
}
|
|
180
|
+
}, [history, historyIndex, setNodes, setEdges]);
|
|
181
|
+
|
|
182
|
+
// Redo handler
|
|
183
|
+
const handleRedo = useCallback(() => {
|
|
184
|
+
if (historyIndex < history.length - 1) {
|
|
185
|
+
isUndoRedoAction.current = true;
|
|
186
|
+
const next = history[historyIndex + 1];
|
|
187
|
+
setNodes(next.nodes);
|
|
188
|
+
setEdges(next.edges);
|
|
189
|
+
setHistoryIndex(historyIndex + 1);
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
isUndoRedoAction.current = false;
|
|
192
|
+
}, 0);
|
|
193
|
+
}
|
|
194
|
+
}, [history, historyIndex, setNodes, setEdges]);
|
|
195
|
+
|
|
196
|
+
// Keyboard shortcuts for undo/redo
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
199
|
+
// Ctrl+Z or Cmd+Z (undo)
|
|
200
|
+
if ((e.ctrlKey || e.metaKey) && e.key === 'z' && !e.shiftKey) {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
handleUndo();
|
|
203
|
+
}
|
|
204
|
+
// Ctrl+Y or Cmd+Shift+Z (redo)
|
|
205
|
+
if (
|
|
206
|
+
((e.ctrlKey || e.metaKey) && e.key === 'y') ||
|
|
207
|
+
((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === 'z')
|
|
208
|
+
) {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
handleRedo();
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
214
|
+
return () => {
|
|
215
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
216
|
+
};
|
|
217
|
+
}, [handleUndo, handleRedo]);
|
|
218
|
+
|
|
219
|
+
const handleClear = useCallback(() => {
|
|
220
|
+
const cleared = { nodes: [], edges: [] };
|
|
221
|
+
const newHistory = history.slice(0, historyIndex + 1);
|
|
222
|
+
newHistory.push(cleared);
|
|
223
|
+
setNodes([]);
|
|
224
|
+
setEdges([]);
|
|
225
|
+
setHistory(newHistory);
|
|
226
|
+
setHistoryIndex(newHistory.length - 1);
|
|
227
|
+
}, [history, historyIndex, setNodes, setEdges]);
|
|
228
|
+
|
|
229
|
+
// Node creation helpers (DRY)
|
|
230
|
+
function createNode({
|
|
231
|
+
type,
|
|
232
|
+
label,
|
|
233
|
+
data = {},
|
|
234
|
+
style,
|
|
235
|
+
business,
|
|
236
|
+
parentNode,
|
|
237
|
+
width,
|
|
238
|
+
height,
|
|
239
|
+
}: CreateNodeParams): CreateNodeResult {
|
|
240
|
+
const id = `${type}-${Date.now()}-${Math.floor(Math.random() * 10000)}`;
|
|
241
|
+
const position = getRandomPosition();
|
|
242
|
+
let nodeData: UseCaseNodeData | PackageNodeData;
|
|
243
|
+
switch (type) {
|
|
244
|
+
case 'actor':
|
|
245
|
+
nodeData = {
|
|
246
|
+
label: label || 'Actor',
|
|
247
|
+
style: style || 'stickman',
|
|
248
|
+
...data,
|
|
249
|
+
} as ActorNodeData;
|
|
250
|
+
break;
|
|
251
|
+
case 'usecase':
|
|
252
|
+
nodeData = {
|
|
253
|
+
label: label || 'Use Case',
|
|
254
|
+
business: !!business,
|
|
255
|
+
...data,
|
|
256
|
+
} as UseCaseNodeData;
|
|
257
|
+
break;
|
|
258
|
+
case 'package':
|
|
259
|
+
nodeData = {
|
|
260
|
+
label: label || 'Package',
|
|
261
|
+
width,
|
|
262
|
+
height,
|
|
263
|
+
...data
|
|
264
|
+
} as PackageNodeData;
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
nodeData = { label: label || 'Node', ...data } as UseCaseNodeData;
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
id,
|
|
271
|
+
type,
|
|
272
|
+
position,
|
|
273
|
+
data: nodeData,
|
|
274
|
+
...(parentNode
|
|
275
|
+
? { parentNode, extent: 'parent' as const, draggable: true }
|
|
276
|
+
: {}),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const handleAddActor = useCallback(
|
|
281
|
+
(type: 'stickman' | 'business') => {
|
|
282
|
+
const label = `${type === 'business' ? 'Business Actor' : 'Actor'} ${nodes.filter((n) => n.type === 'actor' && (type === 'business' ? n.data.style === 'business' : n.data.style !== 'business')).length + 1}`;
|
|
283
|
+
const newNode = createNode({ type: 'actor', label, style: type });
|
|
284
|
+
setNodes((nds) => [...nds, newNode]);
|
|
285
|
+
},
|
|
286
|
+
[nodes, setNodes],
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
const handleAddUseCase = useCallback(() => {
|
|
290
|
+
const label = `Use Case ${nodes.filter((n) => n.type === 'usecase' && !n.data.business).length + 1}`;
|
|
291
|
+
const newNode = createNode({ type: 'usecase', label, business: false });
|
|
292
|
+
setNodes((nds) => [...nds, newNode]);
|
|
293
|
+
}, [nodes, setNodes]);
|
|
294
|
+
|
|
295
|
+
const handleAddBusinessUseCase = useCallback(() => {
|
|
296
|
+
const label = `Business Use Case ${nodes.filter((n) => n.type === 'usecase' && n.data.business).length + 1}`;
|
|
297
|
+
const newNode = createNode({ type: 'usecase', label, business: true });
|
|
298
|
+
setNodes((nds) => [...nds, newNode]);
|
|
299
|
+
}, [nodes, setNodes]);
|
|
300
|
+
|
|
301
|
+
const handleAddPackage = useCallback(() => {
|
|
302
|
+
const label = `Package ${nodes.filter((n) => n.type === 'package').length + 1}`;
|
|
303
|
+
const newNode = createNode({ type: 'package', label });
|
|
304
|
+
setNodes((nds) => [...nds, newNode]);
|
|
305
|
+
}, [nodes, setNodes]);
|
|
306
|
+
|
|
307
|
+
// Relationship dialog state
|
|
308
|
+
const [relationshipDialogOpen, setRelationshipDialogOpen] = useState(false);
|
|
309
|
+
const [pendingRelationshipType, setPendingRelationshipType] = useState<
|
|
310
|
+
null | 'association' | 'include' | 'extend'
|
|
311
|
+
>(null);
|
|
312
|
+
const [pendingSourceId, setPendingSourceId] = useState<string | null>(null);
|
|
313
|
+
const [pendingTargetId, setPendingTargetId] = useState<string | null>(null);
|
|
314
|
+
const [editingEdge, setEditingEdge] = useState<Edge<UseCaseEdgeData> | null>(null);
|
|
315
|
+
|
|
316
|
+
const handleAddAssociation = useCallback(() => {
|
|
317
|
+
setPendingRelationshipType('association');
|
|
318
|
+
setRelationshipDialogOpen(true);
|
|
319
|
+
setEditingEdge(null);
|
|
320
|
+
}, []);
|
|
321
|
+
const handleAddInclude = useCallback(() => {
|
|
322
|
+
setPendingRelationshipType('include');
|
|
323
|
+
setRelationshipDialogOpen(true);
|
|
324
|
+
setEditingEdge(null);
|
|
325
|
+
}, []);
|
|
326
|
+
const handleAddExtend = useCallback(() => {
|
|
327
|
+
setPendingRelationshipType('extend');
|
|
328
|
+
setRelationshipDialogOpen(true);
|
|
329
|
+
setEditingEdge(null);
|
|
330
|
+
}, []);
|
|
331
|
+
|
|
332
|
+
const handleEditRelationship = useCallback((edge: Edge<UseCaseEdgeData>) => {
|
|
333
|
+
setEditingEdge(edge);
|
|
334
|
+
setPendingRelationshipType((edge.data?.type || edge.type) as UseCaseEdgeType);
|
|
335
|
+
setPendingSourceId(edge.source);
|
|
336
|
+
setPendingTargetId(edge.target);
|
|
337
|
+
setRelationshipDialogOpen(true);
|
|
338
|
+
}, []);
|
|
339
|
+
|
|
340
|
+
// Manual edge creation state
|
|
341
|
+
const [connectStartNodeId, setConnectStartNodeId] = useState<string | null>(
|
|
342
|
+
null,
|
|
343
|
+
);
|
|
344
|
+
const [pendingSourceHandle, setPendingSourceHandle] = useState<string | null>(
|
|
345
|
+
null,
|
|
346
|
+
);
|
|
347
|
+
const [pendingTargetHandle, setPendingTargetHandle] = useState<string | null>(
|
|
348
|
+
null,
|
|
349
|
+
);
|
|
350
|
+
const handleConnectStart = useCallback(
|
|
351
|
+
(
|
|
352
|
+
event: MouseEvent | TouchEvent,
|
|
353
|
+
params: OnConnectStartParams,
|
|
354
|
+
) => {
|
|
355
|
+
setConnectStartNodeId(params.nodeId);
|
|
356
|
+
},
|
|
357
|
+
[],
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
const handleConnect = useCallback(
|
|
361
|
+
(params: Connection) => {
|
|
362
|
+
if (!params.source || !params.target) return;
|
|
363
|
+
const trueSource = connectStartNodeId || params.source;
|
|
364
|
+
const trueTarget =
|
|
365
|
+
trueSource === params.source ? params.target : params.source;
|
|
366
|
+
let sourceHandle = params.sourceHandle || 'right';
|
|
367
|
+
let targetHandle = params.targetHandle || 'left';
|
|
368
|
+
const sourceNode = nodes.find((n) => n.id === trueSource);
|
|
369
|
+
const targetNode = nodes.find((n) => n.id === trueTarget);
|
|
370
|
+
let sourceAbsX = 0,
|
|
371
|
+
targetAbsX = 0;
|
|
372
|
+
if (sourceNode && targetNode) {
|
|
373
|
+
sourceAbsX = getAbsolutePosition(sourceNode, nodes).x;
|
|
374
|
+
targetAbsX = getAbsolutePosition(targetNode, nodes).x;
|
|
375
|
+
}
|
|
376
|
+
if (sourceNode && targetNode && sourceAbsX > targetAbsX) {
|
|
377
|
+
setPendingSourceId(trueTarget);
|
|
378
|
+
setPendingTargetId(trueSource);
|
|
379
|
+
setPendingSourceHandle(targetHandle);
|
|
380
|
+
setPendingTargetHandle(sourceHandle);
|
|
381
|
+
} else {
|
|
382
|
+
setPendingSourceId(trueSource);
|
|
383
|
+
setPendingTargetId(trueTarget);
|
|
384
|
+
setPendingSourceHandle(sourceHandle);
|
|
385
|
+
setPendingTargetHandle(targetHandle);
|
|
386
|
+
}
|
|
387
|
+
setPendingRelationshipType('association');
|
|
388
|
+
setRelationshipDialogOpen(true);
|
|
389
|
+
setConnectStartNodeId(null);
|
|
390
|
+
},
|
|
391
|
+
[connectStartNodeId, nodes],
|
|
392
|
+
);
|
|
393
|
+
|
|
394
|
+
const handleAddRelationship = (
|
|
395
|
+
sourceId: string,
|
|
396
|
+
targetId: string,
|
|
397
|
+
type: 'association' | 'include' | 'extend',
|
|
398
|
+
label?: string,
|
|
399
|
+
arrowHeadSource?: 'none' | 'triangle' | 'v',
|
|
400
|
+
arrowHeadTarget?: 'none' | 'triangle' | 'v',
|
|
401
|
+
) => {
|
|
402
|
+
if (editingEdge) {
|
|
403
|
+
setEdges((eds) =>
|
|
404
|
+
eds.map((e) =>
|
|
405
|
+
e.id === editingEdge.id
|
|
406
|
+
? {
|
|
407
|
+
...e,
|
|
408
|
+
source: sourceId,
|
|
409
|
+
target: targetId,
|
|
410
|
+
type,
|
|
411
|
+
data: {
|
|
412
|
+
...e.data,
|
|
413
|
+
type,
|
|
414
|
+
label,
|
|
415
|
+
arrowHeadSource: arrowHeadSource || 'none',
|
|
416
|
+
arrowHeadTarget: arrowHeadTarget || 'none',
|
|
417
|
+
},
|
|
418
|
+
sourceHandle: pendingSourceHandle || undefined,
|
|
419
|
+
targetHandle: pendingTargetHandle || undefined,
|
|
420
|
+
}
|
|
421
|
+
: e,
|
|
422
|
+
),
|
|
423
|
+
);
|
|
424
|
+
setEditingEdge(null);
|
|
425
|
+
} else {
|
|
426
|
+
const id = `${type}-${edges.length + 1}-${Date.now()}`;
|
|
427
|
+
const newEdge: Edge<UseCaseEdgeData> = {
|
|
428
|
+
id,
|
|
429
|
+
source: sourceId,
|
|
430
|
+
target: targetId,
|
|
431
|
+
type,
|
|
432
|
+
data: {
|
|
433
|
+
type,
|
|
434
|
+
label,
|
|
435
|
+
arrowHeadSource: arrowHeadSource || 'none',
|
|
436
|
+
arrowHeadTarget: arrowHeadTarget || 'none',
|
|
437
|
+
},
|
|
438
|
+
sourceHandle: pendingSourceHandle || undefined,
|
|
439
|
+
targetHandle: pendingTargetHandle || undefined,
|
|
440
|
+
};
|
|
441
|
+
setEdges((eds) => [...eds, newEdge]);
|
|
442
|
+
}
|
|
443
|
+
setPendingSourceHandle(null);
|
|
444
|
+
setPendingTargetHandle(null);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
const handleDeleteRelationship = () => {
|
|
448
|
+
if (editingEdge) {
|
|
449
|
+
setEdges((eds) => eds.filter((e) => e.id !== editingEdge.id));
|
|
450
|
+
setEditingEdge(null);
|
|
451
|
+
setRelationshipDialogOpen(false);
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// Export/import diagram
|
|
456
|
+
const exportDiagram = useCallback(() => {
|
|
457
|
+
const diagramData = { nodes, edges };
|
|
458
|
+
const dataStr = JSON.stringify(diagramData, null, 2);
|
|
459
|
+
const dataUri =
|
|
460
|
+
'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr);
|
|
461
|
+
const exportFileDefaultName = 'usecase-diagram.json';
|
|
462
|
+
const linkElement = document.createElement('a');
|
|
463
|
+
linkElement.setAttribute('href', dataUri);
|
|
464
|
+
linkElement.setAttribute('download', exportFileDefaultName);
|
|
465
|
+
linkElement.click();
|
|
466
|
+
}, [nodes, edges]);
|
|
467
|
+
|
|
468
|
+
const importDiagram = useCallback(
|
|
469
|
+
(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
470
|
+
if (!event.target.files || event.target.files.length === 0) return;
|
|
471
|
+
const fileReader = new FileReader();
|
|
472
|
+
fileReader.readAsText(event.target.files[0], 'UTF-8');
|
|
473
|
+
fileReader.onload = (e) => {
|
|
474
|
+
try {
|
|
475
|
+
if (!e.target || typeof e.target.result !== 'string') return;
|
|
476
|
+
const imported = JSON.parse(e.target.result);
|
|
477
|
+
if (imported.nodes && imported.edges) {
|
|
478
|
+
setNodes(imported.nodes);
|
|
479
|
+
setEdges(imported.edges);
|
|
480
|
+
}
|
|
481
|
+
} catch (error) {
|
|
482
|
+
console.error('Error importing diagram:', error);
|
|
483
|
+
alert('Failed to import diagram. Invalid file format.');
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
},
|
|
487
|
+
[setNodes, setEdges],
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
const [selectedNode, setSelectedNode] = useState<Node | null>(null);
|
|
491
|
+
|
|
492
|
+
const handleNodeDoubleClick = useCallback<NonNullable<NodeMouseHandler>>(
|
|
493
|
+
(event, node) => {
|
|
494
|
+
setSelectedNode(node);
|
|
495
|
+
},
|
|
496
|
+
[],
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const handleUpdateNode = useCallback(
|
|
500
|
+
(updates: Partial<UseCaseNodeData | PackageNodeData | ActorNodeData>) => {
|
|
501
|
+
if (!selectedNode) return;
|
|
502
|
+
setNodes((nds) =>
|
|
503
|
+
nds.map((n) =>
|
|
504
|
+
n.id === selectedNode.id
|
|
505
|
+
? { ...n, data: { ...n.data, ...updates } }
|
|
506
|
+
: n,
|
|
507
|
+
),
|
|
508
|
+
);
|
|
509
|
+
},
|
|
510
|
+
[selectedNode, setNodes],
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
return (
|
|
514
|
+
<div style={{ display: 'flex', width: '100%', height: '100vh' }}>
|
|
515
|
+
<div>
|
|
516
|
+
<Sidebar>
|
|
517
|
+
<UseCaseControls
|
|
518
|
+
onAddActor={handleAddActor}
|
|
519
|
+
onAddUseCase={handleAddUseCase}
|
|
520
|
+
onAddBusinessUseCase={handleAddBusinessUseCase}
|
|
521
|
+
onAddPackage={handleAddPackage}
|
|
522
|
+
onAddAssociation={handleAddAssociation}
|
|
523
|
+
onAddInclude={handleAddInclude}
|
|
524
|
+
onAddExtend={handleAddExtend}
|
|
525
|
+
edges={edges as Edge<UseCaseEdgeData>[]}
|
|
526
|
+
nodes={nodes}
|
|
527
|
+
onEditRelationship={handleEditRelationship}
|
|
528
|
+
/>
|
|
529
|
+
</Sidebar>
|
|
530
|
+
</div>
|
|
531
|
+
<div style={{ flex: 1, height: '100%', position: 'relative' }}>
|
|
532
|
+
<ReactFlow
|
|
533
|
+
nodes={nodes}
|
|
534
|
+
edges={edges.map((edge) => ({
|
|
535
|
+
...edge,
|
|
536
|
+
label:
|
|
537
|
+
typeof edge.data?.label === 'string'
|
|
538
|
+
? edge.data.label
|
|
539
|
+
: undefined,
|
|
540
|
+
}))}
|
|
541
|
+
onNodesChange={onNodesChange}
|
|
542
|
+
onEdgesChange={onEdgesChange}
|
|
543
|
+
onConnect={handleConnect}
|
|
544
|
+
onConnectStart={handleConnectStart}
|
|
545
|
+
nodeTypes={nodeTypes}
|
|
546
|
+
edgeTypes={edgeTypes}
|
|
547
|
+
fitView
|
|
548
|
+
onNodeDoubleClick={handleNodeDoubleClick}
|
|
549
|
+
onEdgeClick={(_, edge) => handleEditRelationship(edge as Edge<UseCaseEdgeData>)}
|
|
550
|
+
onPaneClick={() => {
|
|
551
|
+
setSelectedNode(null);
|
|
552
|
+
}}
|
|
553
|
+
>
|
|
554
|
+
<Background color="#f8f9fa" gap={16} />
|
|
555
|
+
<MiniMapCommon />
|
|
556
|
+
<AiButton />
|
|
557
|
+
</ReactFlow>
|
|
558
|
+
|
|
559
|
+
{/* Node Settings Panel */}
|
|
560
|
+
{selectedNode && selectedNode.type === 'actor' && (
|
|
561
|
+
<ActorNodeSettings
|
|
562
|
+
open={true}
|
|
563
|
+
node={selectedNode as Node<ActorNodeData>}
|
|
564
|
+
onUpdate={handleUpdateNode}
|
|
565
|
+
onClose={() => setSelectedNode(null)}
|
|
566
|
+
/>
|
|
567
|
+
)}
|
|
568
|
+
{selectedNode && selectedNode.type === 'usecase' && (
|
|
569
|
+
<UseCaseNodeSettings
|
|
570
|
+
open={true}
|
|
571
|
+
node={selectedNode as unknown as Node<UseCaseNodeData>}
|
|
572
|
+
onUpdate={handleUpdateNode}
|
|
573
|
+
onClose={() => setSelectedNode(null)}
|
|
574
|
+
/>
|
|
575
|
+
)}
|
|
576
|
+
{selectedNode && selectedNode.type === 'package' && (
|
|
577
|
+
<PackageNodeSettings
|
|
578
|
+
nodeId={selectedNode.id}
|
|
579
|
+
data={selectedNode.data as unknown as PackageNodeData}
|
|
580
|
+
nodes={nodes}
|
|
581
|
+
setNodes={setNodes}
|
|
582
|
+
onUpdate={handleUpdateNode}
|
|
583
|
+
onClose={() => setSelectedNode(null)}
|
|
584
|
+
/>
|
|
585
|
+
)}
|
|
586
|
+
{/* Bottom-right panel for controls */}
|
|
587
|
+
<DiagramPanel
|
|
588
|
+
historyIndex={historyIndex}
|
|
589
|
+
historyLength={history.length}
|
|
590
|
+
onUndo={handleUndo}
|
|
591
|
+
onRedo={handleRedo}
|
|
592
|
+
onClear={handleClear}
|
|
593
|
+
onImport={importDiagram}
|
|
594
|
+
isSettingsOpen={false}
|
|
595
|
+
onToggleSettings={() => { }}
|
|
596
|
+
/>
|
|
597
|
+
<AddRelationshipDialog
|
|
598
|
+
open={relationshipDialogOpen}
|
|
599
|
+
onClose={() => {
|
|
600
|
+
setRelationshipDialogOpen(false);
|
|
601
|
+
setEditingEdge(null);
|
|
602
|
+
}}
|
|
603
|
+
onAddRelationship={(
|
|
604
|
+
sourceId,
|
|
605
|
+
targetId,
|
|
606
|
+
type,
|
|
607
|
+
label,
|
|
608
|
+
arrowHeadSource,
|
|
609
|
+
arrowHeadTarget,
|
|
610
|
+
) => {
|
|
611
|
+
handleAddRelationship(
|
|
612
|
+
sourceId,
|
|
613
|
+
targetId,
|
|
614
|
+
type,
|
|
615
|
+
label,
|
|
616
|
+
arrowHeadSource,
|
|
617
|
+
arrowHeadTarget,
|
|
618
|
+
);
|
|
619
|
+
setRelationshipDialogOpen(false);
|
|
620
|
+
setPendingSourceId(null);
|
|
621
|
+
setPendingTargetId(null);
|
|
622
|
+
setPendingRelationshipType(null);
|
|
623
|
+
setEditingEdge(null);
|
|
624
|
+
}}
|
|
625
|
+
nodes={nodes}
|
|
626
|
+
initialSourceId={editingEdge ? editingEdge.source : pendingSourceId}
|
|
627
|
+
initialTargetId={editingEdge ? editingEdge.target : pendingTargetId}
|
|
628
|
+
onDialogOpen={() => { }}
|
|
629
|
+
editingEdge={editingEdge}
|
|
630
|
+
onDeleteRelationship={handleDeleteRelationship}
|
|
631
|
+
/>
|
|
632
|
+
</div>
|
|
633
|
+
</div>
|
|
634
|
+
);
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
export default UseCaseDiagramFlow;
|