@likec4/diagram 1.22.1 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LikeC4Diagram.js +2 -3
- package/dist/base/BaseXYFlow.js +0 -1
- package/dist/base/example/custom.d.ts +1 -1
- package/dist/base/primitives/customEdge.d.ts +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
- package/dist/context/DiagramEventHandlers.d.ts +6 -2
- package/dist/context/DiagramEventHandlers.js +25 -20
- package/dist/context/DiagramFeatures.js +9 -22
- package/dist/{style.css → diagram.css} +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/safeContext.d.ts +7 -0
- package/dist/hooks/safeContext.js +14 -0
- package/dist/hooks/useCurrentViewId.js +1 -1
- package/dist/hooks/useDiagram.d.ts +6587 -5969
- package/dist/hooks/useDiagram.js +26 -14
- package/dist/index.js +1 -1
- package/dist/likec4diagram/DiagramUI.js +12 -5
- package/dist/likec4diagram/XYFlow.js +3 -4
- package/dist/likec4diagram/custom/edges/NotePopover.js +1 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -7
- package/dist/likec4diagram/custom/index.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +1 -1
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +1 -2
- package/dist/likec4diagram/ui/controls/Controls.js +3 -13
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -2
- package/dist/likec4diagram/ui/controls/ToggleReadonly.js +1 -2
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +8 -9
- package/dist/likec4diagram/ui/notation/NotationPanel.js +1 -2
- package/dist/likec4diagram/ui/search/LikeC4Search.js +2 -4
- package/dist/likec4diagram/ui/search/ViewsColum.js +1 -1
- package/dist/likec4diagram/ui/search/state.js +1 -1
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -2
- package/dist/likec4diagram/useViewToNodesEdges.d.ts +0 -1
- package/dist/likec4diagram/useViewToNodesEdges.js +0 -2
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Accordion/Accordion.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Affix/Affix.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Alert/Alert.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Anchor/Anchor.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/AngleSlider/AngleSlider.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/AppShell/AppShell.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/AspectRatio/AspectRatio.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Avatar/Avatar.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/BackgroundImage/BackgroundImage.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Badge/Badge.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Blockquote/Blockquote.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Breadcrumbs/Breadcrumbs.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Burger/Burger.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Button/Button.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Card/Card.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Center/Center.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Checkbox/Checkbox.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Checkbox/CheckboxCard/CheckboxCard.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Chip/Chip.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/CloseButton/CloseButton.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Code/Code.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ColorInput/ColorInput.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ColorPicker/ColorPicker.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ColorSwatch/ColorSwatch.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Combobox/Combobox.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Container/Container.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Dialog/Dialog.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Divider/Divider.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Drawer/Drawer.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Fieldset/Fieldset.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Flex/Flex.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/FloatingIndicator/FloatingIndicator.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Grid/Grid.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Group/Group.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Image/Image.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Indicator/Indicator.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/InlineInput/InlineInput.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Input/Input.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Kbd/Kbd.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/List/List.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Loader/Loader.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/LoadingOverlay/LoadingOverlay.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Mark/Mark.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Menu/Menu.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Modal/Modal.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ModalBase/ModalBase.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/NavLink/NavLink.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Notification/Notification.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/NumberInput/NumberInput.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Overlay/Overlay.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Pagination/Pagination.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Paper/Paper.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/PasswordInput/PasswordInput.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Pill/Pill.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/PillsInput/PillsInput.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/PinInput/PinInput.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Popover/Popover.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Progress/Progress.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Radio/Radio.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Radio/RadioCard/RadioCard.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Radio/RadioIndicator/RadioIndicator.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Rating/Rating.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/RingProgress/RingProgress.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ScrollArea/ScrollArea.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/SegmentedControl/SegmentedControl.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/SemiCircleProgress/SemiCircleProgress.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/SimpleGrid/SimpleGrid.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Skeleton/Skeleton.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Slider/Slider.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Spoiler/Spoiler.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Stack/Stack.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Stepper/Stepper.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Switch/Switch.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Table/Table.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/TableOfContents/TableOfContents.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Tabs/Tabs.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Text/Text.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ThemeIcon/ThemeIcon.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Timeline/Timeline.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Title/Title.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Tooltip/Tooltip.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Tree/Tree.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/TypographyStylesProvider/TypographyStylesProvider.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.module.css.mjs.vanilla.css.js +1 -0
- package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/VisuallyHidden/VisuallyHidden.module.css.mjs.vanilla.css.js +1 -0
- package/dist/overlays/Overlays.d.ts +4 -1
- package/dist/overlays/Overlays.js +72 -60
- package/dist/overlays/element-details/ElementDetails.d.ts +6 -0
- package/dist/overlays/element-details/ElementDetails.js +31 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +4 -9
- package/dist/overlays/element-details/TabPanelDeployments.js +1 -1
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +3 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +20 -20
- package/dist/overlays/element-details/actor.d.ts +20626 -0
- package/dist/overlays/element-details/actor.js +68 -0
- package/dist/overlays/element-details/actorContext.d.ts +7 -0
- package/dist/overlays/element-details/actorContext.js +14 -0
- package/dist/overlays/overlay/Overlay.css.js +87 -87
- package/dist/overlays/overlay/Overlay.js +16 -1
- package/dist/overlays/overlaysActor.d.ts +190 -0
- package/dist/overlays/overlaysActor.js +233 -0
- package/dist/overlays/relationship-details/actor.d.ts +130 -4
- package/dist/overlays/relationship-details/actor.js +2 -2
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +17 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +17 -19
- package/dist/overlays/relationships-browser/actor.d.ts +1095 -8
- package/dist/overlays/relationships-browser/actor.js +181 -173
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -2
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +17 -0
- package/dist/overlays/relationships-browser/hooks.d.ts +1 -1
- package/dist/overlays/relationships-browser/hooks.js +7 -5
- package/dist/overlays/types.d.ts +29 -0
- package/dist/{likec4diagram/DiagramActor.d.ts → state/DiagramActorProvider.d.ts} +2 -2
- package/dist/state/DiagramActorProvider.js +77 -0
- package/dist/{likec4diagram/state → state}/assign.d.ts +2 -2
- package/dist/{likec4diagram/state → state}/assign.js +2 -2
- package/dist/state/diagram-machine.d.ts +11680 -0
- package/dist/{likec4diagram/state/machine.js → state/diagram-machine.js} +105 -194
- package/dist/{likec4diagram/state → state}/hotkeyActor.d.ts +1 -1
- package/dist/state/hotkeyActor.js +26 -0
- package/dist/state/inspector.d.ts +4 -0
- package/dist/{likec4diagram/state → state}/syncManualLayoutActor.d.ts +7 -8
- package/dist/{likec4diagram/state → state}/syncManualLayoutActor.js +3 -5
- package/dist/state/types.d.ts +19 -0
- package/dist/state/utils.d.ts +17 -0
- package/dist/{likec4diagram/state → state}/utils.js +20 -1
- package/package.json +20 -24
- package/src/LikeC4Diagram.tsx +3 -5
- package/src/base/BaseXYFlow.tsx +2 -1
- package/src/base/primitives/compound/CompoundTitle.css.ts +0 -5
- package/src/context/DiagramEventHandlers.tsx +27 -13
- package/src/context/DiagramFeatures.tsx +8 -21
- package/src/hooks/index.ts +0 -1
- package/src/hooks/safeContext.tsx +16 -0
- package/src/hooks/useCurrentViewId.ts +2 -2
- package/src/hooks/useDiagram.ts +42 -15
- package/src/likec4diagram/DiagramUI.tsx +14 -11
- package/src/likec4diagram/XYFlow.tsx +4 -5
- package/src/likec4diagram/custom/edges/NotePopover.tsx +1 -2
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +6 -7
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +1 -1
- package/src/likec4diagram/ui/controls/ChangeAutoLayoutButton.tsx +2 -3
- package/src/likec4diagram/ui/controls/Controls.tsx +2 -4
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -2
- package/src/likec4diagram/ui/controls/ToggleReadonly.tsx +2 -3
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +8 -11
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -3
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +1 -4
- package/src/likec4diagram/ui/search/ViewsColum.tsx +1 -1
- package/src/likec4diagram/ui/search/state.ts +1 -1
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -2
- package/src/likec4diagram/useViewToNodesEdges.ts +0 -4
- package/src/overlays/Overlays.tsx +81 -71
- package/src/overlays/element-details/ElementDetails.tsx +33 -0
- package/src/overlays/element-details/ElementDetailsCard.tsx +8 -18
- package/src/overlays/element-details/TabPanelDeployments.tsx +1 -1
- package/src/overlays/element-details/TabPanelRelationships.tsx +33 -32
- package/src/overlays/element-details/actor.ts +102 -0
- package/src/overlays/element-details/actorContext.tsx +16 -0
- package/src/overlays/overlay/Overlay.tsx +14 -11
- package/src/overlays/overlaysActor.ts +278 -0
- package/src/overlays/relationship-details/actor.ts +8 -11
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +18 -0
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +23 -29
- package/src/overlays/relationships-browser/actor.ts +216 -220
- package/src/overlays/relationships-browser/custom/ElementActions.tsx +3 -2
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +20 -0
- package/src/overlays/relationships-browser/hooks.ts +7 -5
- package/src/overlays/types.ts +39 -0
- package/src/state/DiagramActorProvider.tsx +97 -0
- package/src/{likec4diagram/state → state}/assign.ts +4 -4
- package/src/{likec4diagram/state/machine.ts → state/diagram-machine.ts} +130 -205
- package/src/state/hotkeyActor.ts +29 -0
- package/src/state/inspector.ts +5 -0
- package/src/{likec4diagram/state → state}/syncManualLayoutActor.ts +8 -12
- package/src/state/types.ts +23 -0
- package/src/{likec4diagram/state → state}/utils.ts +24 -2
- package/dist/hooks/useDiagramActor.d.ts +0 -5
- package/dist/hooks/useDiagramActor.js +0 -21
- package/dist/hooks/useDiagramContext.d.ts +0 -3
- package/dist/hooks/useDiagramContext.js +0 -10
- package/dist/likec4diagram/DiagramActor.js +0 -82
- package/dist/likec4diagram/state/actorContext.d.ts +0 -52075
- package/dist/likec4diagram/state/actorContext.js +0 -12
- package/dist/likec4diagram/state/hotkeyActor.js +0 -18
- package/dist/likec4diagram/state/inspector.d.ts +0 -5
- package/dist/likec4diagram/state/machine.d.ts +0 -11025
- package/dist/likec4diagram/state/utils.d.ts +0 -8
- package/src/hooks/useDiagramActor.ts +0 -27
- package/src/hooks/useDiagramContext.ts +0 -14
- package/src/likec4diagram/DiagramActor.tsx +0 -92
- package/src/likec4diagram/state/actorContext.ts +0 -8
- package/src/likec4diagram/state/hotkeyActor.ts +0 -20
- package/src/likec4diagram/state/inspector.ts +0 -23
- /package/dist/{likec4diagram/state → state}/aligners.d.ts +0 -0
- /package/dist/{likec4diagram/state → state}/aligners.js +0 -0
- /package/src/{likec4diagram/state → state}/aligners.ts +0 -0
package/src/LikeC4Diagram.tsx
CHANGED
|
@@ -11,12 +11,11 @@ import {
|
|
|
11
11
|
} from './context'
|
|
12
12
|
import { LikeC4CustomColors } from './LikeC4CustomColors'
|
|
13
13
|
import { type LikeC4DiagramEventHandlers, type LikeC4DiagramProperties } from './LikeC4Diagram.props'
|
|
14
|
-
import { DiagramActor } from './likec4diagram/DiagramActor'
|
|
15
|
-
import { DiagramUI } from './likec4diagram/DiagramUI'
|
|
16
14
|
import type { Types } from './likec4diagram/types'
|
|
17
15
|
import { useViewToNodesEdges } from './likec4diagram/useViewToNodesEdges'
|
|
18
16
|
import { LikeC4DiagramXYFlow } from './likec4diagram/XYFlow'
|
|
19
17
|
import { useLikeC4Model } from './likec4model'
|
|
18
|
+
import { DiagramActorProvider } from './state/DiagramActorProvider'
|
|
20
19
|
|
|
21
20
|
export type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers
|
|
22
21
|
export function LikeC4Diagram({
|
|
@@ -68,7 +67,6 @@ export function LikeC4Diagram({
|
|
|
68
67
|
const xyNodesEdges = useViewToNodesEdges({
|
|
69
68
|
view,
|
|
70
69
|
where,
|
|
71
|
-
nodesDraggable,
|
|
72
70
|
nodesSelectable,
|
|
73
71
|
})
|
|
74
72
|
|
|
@@ -129,7 +127,7 @@ export function LikeC4Diagram({
|
|
|
129
127
|
fitView={fitView}
|
|
130
128
|
{...initialRef.current}
|
|
131
129
|
>
|
|
132
|
-
<
|
|
130
|
+
<DiagramActorProvider
|
|
133
131
|
input={{
|
|
134
132
|
view,
|
|
135
133
|
pannable,
|
|
@@ -142,7 +140,7 @@ export function LikeC4Diagram({
|
|
|
142
140
|
nodesSelectable={nodesSelectable}
|
|
143
141
|
background={background}
|
|
144
142
|
/>
|
|
145
|
-
</
|
|
143
|
+
</DiagramActorProvider>
|
|
146
144
|
</XYFlowProvider>
|
|
147
145
|
</RootContainer>
|
|
148
146
|
</DiagramEventHandlers>
|
package/src/base/BaseXYFlow.tsx
CHANGED
|
@@ -115,7 +115,8 @@ export const BaseXYFlow = <
|
|
|
115
115
|
{...(!pannable && {
|
|
116
116
|
selectionKeyCode: null,
|
|
117
117
|
})}
|
|
118
|
-
|
|
118
|
+
// TODO: benchmarks first
|
|
119
|
+
//onlyRenderVisibleElements={nodes.length > 75}
|
|
119
120
|
elementsSelectable={nodesSelectable}
|
|
120
121
|
nodesFocusable={nodesDraggable || nodesSelectable}
|
|
121
122
|
edgesFocusable={false}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSyncedRef } from '@react-hookz/web'
|
|
2
|
-
import { type PropsWithChildren, createContext, useContext, useMemo } from 'react'
|
|
2
|
+
import { type PropsWithChildren, type RefObject, createContext, useContext, useMemo } from 'react'
|
|
3
3
|
import { isFunction, mapToObj } from 'remeda'
|
|
4
4
|
import type { LikeC4DiagramEventHandlers } from '../LikeC4Diagram.props'
|
|
5
5
|
|
|
@@ -21,9 +21,16 @@ const HandlerNames = [
|
|
|
21
21
|
'onCanvasDblClick',
|
|
22
22
|
] as const
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
type DiagramEventHandlersContextValue = RequiredOrNull<LikeC4DiagramEventHandlers> & {
|
|
25
|
+
handlersRef: RefObject<LikeC4DiagramEventHandlers>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const DiagramEventHandlersContext = createContext<DiagramEventHandlersContextValue>({
|
|
29
|
+
...mapToObj(HandlerNames, (name) => [name, null]),
|
|
30
|
+
handlersRef: {
|
|
31
|
+
current: {},
|
|
32
|
+
},
|
|
33
|
+
})
|
|
27
34
|
|
|
28
35
|
export function DiagramEventHandlers({
|
|
29
36
|
handlers,
|
|
@@ -33,16 +40,19 @@ export function DiagramEventHandlers({
|
|
|
33
40
|
|
|
34
41
|
const deps = HandlerNames.map((name) => isFunction(handlers[name]))
|
|
35
42
|
|
|
43
|
+
const value = useMemo((): DiagramEventHandlersContextValue => ({
|
|
44
|
+
...mapToObj(HandlerNames, (name) => {
|
|
45
|
+
if (handlersRef.current[name]) {
|
|
46
|
+
// @ts-expect-error TODO: fix this
|
|
47
|
+
return [name, (...args: any[]) => handlersRef.current[name]?.(...args)]
|
|
48
|
+
}
|
|
49
|
+
return [name, null]
|
|
50
|
+
}),
|
|
51
|
+
handlersRef,
|
|
52
|
+
}), [handlersRef, ...deps])
|
|
53
|
+
|
|
36
54
|
return (
|
|
37
|
-
<DiagramEventHandlersContext.Provider
|
|
38
|
-
value={useMemo(() =>
|
|
39
|
-
mapToObj(HandlerNames, (name) => {
|
|
40
|
-
if (handlersRef.current[name]) {
|
|
41
|
-
// @ts-expect-error TODO: fix this
|
|
42
|
-
return [name, (...args: any[]) => handlersRef.current[name]?.(...args)]
|
|
43
|
-
}
|
|
44
|
-
return [name, null]
|
|
45
|
-
}), [handlersRef, ...deps])}>
|
|
55
|
+
<DiagramEventHandlersContext.Provider value={value}>
|
|
46
56
|
{children}
|
|
47
57
|
</DiagramEventHandlersContext.Provider>
|
|
48
58
|
)
|
|
@@ -51,3 +61,7 @@ export function DiagramEventHandlers({
|
|
|
51
61
|
export function useDiagramEventHandlers() {
|
|
52
62
|
return useContext(DiagramEventHandlersContext)
|
|
53
63
|
}
|
|
64
|
+
|
|
65
|
+
export function useDiagramEventHandlersRef() {
|
|
66
|
+
return useContext(DiagramEventHandlersContext).handlersRef
|
|
67
|
+
}
|
|
@@ -47,42 +47,29 @@ const validate = (features: EnabledFeatures) => {
|
|
|
47
47
|
enableRelationshipDetails,
|
|
48
48
|
enableRelationshipBrowser,
|
|
49
49
|
enableSearch,
|
|
50
|
+
enableEdgeEditing,
|
|
50
51
|
...rest
|
|
51
52
|
} = features
|
|
52
53
|
if (!enableLikeC4Model) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (enableRelationshipDetails) {
|
|
58
|
-
console.warn('enableRelationshipDetails is ignored because requires enableLikeC4Model')
|
|
59
|
-
enableRelationshipDetails = false
|
|
60
|
-
}
|
|
61
|
-
if (enableRelationshipBrowser) {
|
|
62
|
-
console.warn('enableRelationshipBrowser is ignored because requires LikeC4Model')
|
|
63
|
-
enableRelationshipBrowser = false
|
|
64
|
-
}
|
|
65
|
-
if (enableSearch) {
|
|
66
|
-
console.warn('enableSearch is ignored because requires LikeC4Model')
|
|
67
|
-
enableSearch = false
|
|
68
|
-
}
|
|
54
|
+
enableElementDetails = false
|
|
55
|
+
enableRelationshipDetails = false
|
|
56
|
+
enableRelationshipBrowser = false
|
|
57
|
+
enableSearch = false
|
|
69
58
|
}
|
|
70
59
|
|
|
71
60
|
if (enableReadOnly) {
|
|
72
|
-
|
|
73
|
-
console.warn('enableEdgeEditing is ignored because enabled ReadOnly')
|
|
74
|
-
rest.enableEdgeEditing = false
|
|
75
|
-
}
|
|
61
|
+
enableEdgeEditing = false
|
|
76
62
|
}
|
|
77
63
|
|
|
78
64
|
return {
|
|
79
|
-
...rest,
|
|
80
65
|
enableReadOnly,
|
|
81
66
|
enableLikeC4Model,
|
|
82
67
|
enableElementDetails,
|
|
83
68
|
enableRelationshipDetails,
|
|
84
69
|
enableRelationshipBrowser,
|
|
85
70
|
enableSearch,
|
|
71
|
+
enableEdgeEditing,
|
|
72
|
+
...rest,
|
|
86
73
|
}
|
|
87
74
|
}
|
|
88
75
|
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext, use } from 'react'
|
|
2
|
+
import type { DiagramActorRef } from '../state/types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* To improve experience with HMR, we use `createSafeContext` as a boundary for hoooks
|
|
6
|
+
*/
|
|
7
|
+
export const DiagramActorSafeContext = createContext<DiagramActorRef>(null as any)
|
|
8
|
+
DiagramActorSafeContext.displayName = 'DiagramActorSafeContext'
|
|
9
|
+
|
|
10
|
+
export const useDiagramActorRef = () => {
|
|
11
|
+
const ctx = use(DiagramActorSafeContext)
|
|
12
|
+
if (ctx === null) {
|
|
13
|
+
throw new Error('DiagramActorRef is not provided')
|
|
14
|
+
}
|
|
15
|
+
return ctx
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ViewId } from '@likec4/core'
|
|
2
|
-
import type { DiagramContext } from '../
|
|
3
|
-
import { useDiagramContext } from './
|
|
2
|
+
import type { DiagramContext } from '../state/types'
|
|
3
|
+
import { useDiagramContext } from './useDiagram'
|
|
4
4
|
|
|
5
5
|
const selectViewId = (state: DiagramContext) => state.view.id
|
|
6
6
|
export function useCurrentViewId(): ViewId {
|
package/src/hooks/useDiagram.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DiagramView, type EdgeId, type Fqn, type NodeId, type ViewId } from '@likec4/core'
|
|
2
|
+
import { useCallbackRef } from '@mantine/hooks'
|
|
3
|
+
import { useSelector as useXstateSelector } from '@xstate/react'
|
|
4
|
+
import { shallowEqual } from 'fast-equals'
|
|
2
5
|
import { useMemo, useTransition } from 'react'
|
|
3
6
|
import type { PartialDeep } from 'type-fest'
|
|
4
7
|
import type { FeatureName } from '../context/DiagramFeatures'
|
|
5
|
-
import { useDiagramActor } from '../hooks/useDiagramActor'
|
|
6
8
|
import type { OpenSourceParams } from '../LikeC4Diagram.props'
|
|
7
|
-
import type { AlignmentMode } from '../likec4diagram/state/aligners'
|
|
8
|
-
import { DiagramContext } from '../likec4diagram/state/machine'
|
|
9
9
|
import type { Types } from '../likec4diagram/types'
|
|
10
|
+
import type { AlignmentMode } from '../state/aligners'
|
|
11
|
+
import type { DiagramActorSnapshot, DiagramContext, SyncLayoutActorRef, SyncLayoutActorSnapshot } from '../state/types'
|
|
12
|
+
import { findDiagramEdge, findDiagramNode } from '../state/utils'
|
|
13
|
+
import { useDiagramActorRef } from './safeContext'
|
|
14
|
+
|
|
15
|
+
export { useDiagramActorRef }
|
|
10
16
|
|
|
11
17
|
export function useDiagram() {
|
|
12
|
-
const actor =
|
|
18
|
+
const actor = useDiagramActorRef()
|
|
13
19
|
const [, startTransition] = useTransition()
|
|
14
20
|
return useMemo(() => ({
|
|
15
21
|
send: actor.send,
|
|
@@ -50,11 +56,7 @@ export function useDiagram() {
|
|
|
50
56
|
actor.send({ type: 'open.relationshipDetails', edgeId })
|
|
51
57
|
})
|
|
52
58
|
},
|
|
53
|
-
|
|
54
|
-
startTransition(() => {
|
|
55
|
-
actor.send({ type: 'close.overlay' })
|
|
56
|
-
})
|
|
57
|
-
},
|
|
59
|
+
|
|
58
60
|
updateNodeData: (nodeId: NodeId, data: PartialDeep<Types.NodeData>) => {
|
|
59
61
|
actor.send({ type: 'update.nodeData', nodeId, data })
|
|
60
62
|
},
|
|
@@ -73,7 +75,7 @@ export function useDiagram() {
|
|
|
73
75
|
* @returns true if there was pending request to save layout
|
|
74
76
|
*/
|
|
75
77
|
cancelSaveManualLayout: () => {
|
|
76
|
-
const syncState = actor.getSnapshot().
|
|
78
|
+
const syncState = actor.getSnapshot().children.syncLayout?.getSnapshot().value
|
|
77
79
|
actor.send({ type: 'saveManualLayout.cancel' })
|
|
78
80
|
return syncState === 'pending' || syncState === 'paused'
|
|
79
81
|
},
|
|
@@ -93,11 +95,13 @@ export function useDiagram() {
|
|
|
93
95
|
/**
|
|
94
96
|
* @warning Do not use in render phase
|
|
95
97
|
*/
|
|
96
|
-
currentView
|
|
98
|
+
get currentView(): DiagramView {
|
|
99
|
+
return actor.getSnapshot().context.view
|
|
100
|
+
},
|
|
97
101
|
/**
|
|
98
102
|
* @warning Do not use in render phase
|
|
99
103
|
*/
|
|
100
|
-
|
|
104
|
+
getSnapshot: () => actor.getSnapshot(),
|
|
101
105
|
/**
|
|
102
106
|
* @warning Do not use in render phase
|
|
103
107
|
*/
|
|
@@ -106,13 +110,13 @@ export function useDiagram() {
|
|
|
106
110
|
* @warning Do not use in render phase
|
|
107
111
|
*/
|
|
108
112
|
findDiagramNode: (xynodeId: string) => {
|
|
109
|
-
return
|
|
113
|
+
return findDiagramNode(actor.getSnapshot().context, xynodeId)
|
|
110
114
|
},
|
|
111
115
|
/**
|
|
112
116
|
* @warning Do not use in render phase
|
|
113
117
|
*/
|
|
114
118
|
findDiagramEdge: (xyedgeId: string) => {
|
|
115
|
-
return
|
|
119
|
+
return findDiagramEdge(actor.getSnapshot().context, xyedgeId)
|
|
116
120
|
},
|
|
117
121
|
|
|
118
122
|
startWalkthrough: () => {
|
|
@@ -132,3 +136,26 @@ export function useDiagram() {
|
|
|
132
136
|
},
|
|
133
137
|
}), [actor])
|
|
134
138
|
}
|
|
139
|
+
|
|
140
|
+
export function useDiagramActorSnapshot<T = unknown>(
|
|
141
|
+
selector: (state: DiagramActorSnapshot) => T,
|
|
142
|
+
compare: (a: NoInfer<T>, b: NoInfer<T>) => boolean = shallowEqual,
|
|
143
|
+
): T {
|
|
144
|
+
const actorRef = useDiagramActorRef()
|
|
145
|
+
return useXstateSelector(actorRef, useCallbackRef(selector), compare)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function useDiagramSyncLayoutState<T = unknown>(
|
|
149
|
+
selector: (state: SyncLayoutActorSnapshot) => T,
|
|
150
|
+
compare: (a: NoInfer<T>, b: NoInfer<T>) => boolean = shallowEqual,
|
|
151
|
+
): T {
|
|
152
|
+
const syncLayoutActorRef = useDiagramActorSnapshot(s => s.context.syncLayoutActorRef as SyncLayoutActorRef)
|
|
153
|
+
return useXstateSelector(syncLayoutActorRef, useCallbackRef(selector), compare)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function useDiagramContext<T = unknown>(
|
|
157
|
+
selector: (state: DiagramContext) => T,
|
|
158
|
+
compare: (a: NoInfer<T>, b: NoInfer<T>) => boolean = shallowEqual,
|
|
159
|
+
) {
|
|
160
|
+
return useDiagramActorSnapshot(useCallbackRef(s => selector(s.context)), compare)
|
|
161
|
+
}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEnabledFeatures } from '../context'
|
|
2
|
+
import { useDiagramActorSnapshot } from '../hooks/useDiagram'
|
|
2
3
|
import { Overlays } from '../overlays/Overlays'
|
|
3
4
|
import { Controls, DiagramTitlePanel, DynamicViewWalkthrough, NotationPanel } from './ui'
|
|
4
5
|
|
|
5
6
|
export function DiagramUI() {
|
|
7
|
+
const {
|
|
8
|
+
enableViewTitle,
|
|
9
|
+
enableNotations,
|
|
10
|
+
enableDynamicViewWalkthrough,
|
|
11
|
+
} = useEnabledFeatures()
|
|
12
|
+
|
|
13
|
+
const overlaysActorRef = useDiagramActorSnapshot(s => s.children.overlays)
|
|
14
|
+
|
|
6
15
|
return (
|
|
7
16
|
<>
|
|
8
17
|
<Controls />
|
|
9
|
-
<Overlays />
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<IfEnabled feature="Notations">
|
|
14
|
-
<NotationPanel />
|
|
15
|
-
</IfEnabled>
|
|
16
|
-
<IfEnabled feature="DynamicViewWalkthrough">
|
|
17
|
-
<DynamicViewWalkthrough />
|
|
18
|
-
</IfEnabled>
|
|
18
|
+
{overlaysActorRef && <Overlays overlaysActorRef={overlaysActorRef} />}
|
|
19
|
+
{enableViewTitle && <DiagramTitlePanel />}
|
|
20
|
+
{enableNotations && <NotationPanel />}
|
|
21
|
+
{enableDynamicViewWalkthrough && <DynamicViewWalkthrough />}
|
|
19
22
|
</>
|
|
20
23
|
)
|
|
21
24
|
}
|
|
@@ -6,12 +6,11 @@ import { memo } from 'react'
|
|
|
6
6
|
import type { EnforceOptional } from 'type-fest/source/enforce-optional'
|
|
7
7
|
import { BaseXYFlow } from '../base/BaseXYFlow'
|
|
8
8
|
import { useDiagramEventHandlers } from '../context'
|
|
9
|
-
import { useDiagram } from '../hooks/useDiagram'
|
|
10
|
-
import { useDiagramContext } from '../hooks/useDiagramContext'
|
|
9
|
+
import { useDiagram, useDiagramContext } from '../hooks/useDiagram'
|
|
11
10
|
import type { LikeC4DiagramProperties } from '../LikeC4Diagram.props'
|
|
11
|
+
import type { DiagramContext } from '../state/types'
|
|
12
12
|
import { edgeTypes, nodeTypes } from './custom'
|
|
13
13
|
import { DiagramUI } from './DiagramUI'
|
|
14
|
-
import type { DiagramContext } from './state/machine'
|
|
15
14
|
import type { Types } from './types'
|
|
16
15
|
import { useLayoutConstraints } from './useLayoutConstraints'
|
|
17
16
|
|
|
@@ -23,7 +22,7 @@ const selectXYProps = (ctx: DiagramContext) => ({
|
|
|
23
22
|
zoomable: ctx.zoomable,
|
|
24
23
|
fitViewPadding: ctx.fitViewPadding,
|
|
25
24
|
enableFitView: ctx.features.enableFitView,
|
|
26
|
-
enableReadOnly: ctx.features.enableReadOnly,
|
|
25
|
+
enableReadOnly: ctx.features.enableReadOnly || ctx.toggledFeatures.enableReadOnly,
|
|
27
26
|
...(!ctx.features.enableFitView && {
|
|
28
27
|
viewport: {
|
|
29
28
|
x: -Math.min(ctx.view.bounds.x, 0),
|
|
@@ -146,7 +145,7 @@ export const LikeC4DiagramXYFlow = memo<LikeC4DiagramXYFlowProps>(({ background,
|
|
|
146
145
|
{...enableFitView && {
|
|
147
146
|
onViewportResize,
|
|
148
147
|
}}
|
|
149
|
-
nodesDraggable={nodesDraggable}
|
|
148
|
+
nodesDraggable={notReadOnly && nodesDraggable}
|
|
150
149
|
nodesSelectable={nodesSelectable}
|
|
151
150
|
{...(notReadOnly && nodesDraggable && layoutConstraints)}
|
|
152
151
|
{...props}>
|
|
@@ -13,8 +13,7 @@ import { useDebouncedEffect } from '@react-hookz/web'
|
|
|
13
13
|
import { type PropsWithChildren, useState } from 'react'
|
|
14
14
|
import { isNonNull, isTruthy } from 'remeda'
|
|
15
15
|
import { useMantinePortalProps } from '../../../hooks'
|
|
16
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
17
|
-
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
16
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
18
17
|
import { stopPropagation } from '../../../utils'
|
|
19
18
|
import * as edgesCss from './NotePopover.css'
|
|
20
19
|
|
|
@@ -291,7 +291,7 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
291
291
|
let renderLabel: undefined | ((props: any) => any)
|
|
292
292
|
if (!isControlPointDragging) {
|
|
293
293
|
const notes = props.data.notes
|
|
294
|
-
if (notes && isStepEdgeId(props.id) && diagram.
|
|
294
|
+
if (notes && isStepEdgeId(props.id) && diagram.getContext().activeWalkthrough?.stepId === props.id) {
|
|
295
295
|
renderLabel = (props: any) => (
|
|
296
296
|
<NotePopover notes={notes}>
|
|
297
297
|
<div {...props} />
|
|
@@ -30,10 +30,9 @@ import { filter, isTruthy, map, partition, pipe } from 'remeda'
|
|
|
30
30
|
import { Link } from '../../../components/Link'
|
|
31
31
|
import { IfEnabled, useDiagramEventHandlers, useEnabledFeature } from '../../../context'
|
|
32
32
|
import { useMantinePortalProps } from '../../../hooks'
|
|
33
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
34
|
-
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
33
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
35
34
|
import { useLikeC4Model } from '../../../likec4model'
|
|
36
|
-
import {
|
|
35
|
+
import { findDiagramEdge, findDiagramNode } from '../../../state/utils'
|
|
37
36
|
import * as css from './RelationshipsDropdownMenu.css'
|
|
38
37
|
|
|
39
38
|
const stopPropagation: MouseEventHandler = (e) => e.stopPropagation()
|
|
@@ -62,9 +61,9 @@ export function RelationshipsDropdownMenu({
|
|
|
62
61
|
disabled?: boolean | undefined
|
|
63
62
|
}>) {
|
|
64
63
|
const { diagramEdge, sourceNode, targetNode } = useDiagramContext(ctx => ({
|
|
65
|
-
diagramEdge:
|
|
66
|
-
sourceNode:
|
|
67
|
-
targetNode:
|
|
64
|
+
diagramEdge: findDiagramEdge(ctx, edgeId),
|
|
65
|
+
sourceNode: findDiagramNode(ctx, source),
|
|
66
|
+
targetNode: findDiagramNode(ctx, target),
|
|
68
67
|
}))
|
|
69
68
|
const likec4model = useLikeC4Model(true)
|
|
70
69
|
const diagram = useDiagram()
|
|
@@ -189,7 +188,7 @@ const Relationship = forwardRef<
|
|
|
189
188
|
const diagram = useDiagram()
|
|
190
189
|
const { enableNavigateTo } = useEnabledFeature('NavigateTo')
|
|
191
190
|
const { onOpenSource } = useDiagramEventHandlers()
|
|
192
|
-
const viewId = diagram.currentView
|
|
191
|
+
const viewId = diagram.currentView.id
|
|
193
192
|
|
|
194
193
|
const sourceId = getShortId(r, r.source.id, sourceNode)
|
|
195
194
|
const targetId = getShortId(r, r.target.id, targetNode)
|
|
@@ -4,7 +4,7 @@ import { type NodeToolbarProps, NodeToolbar } from '@xyflow/react'
|
|
|
4
4
|
import clsx from 'clsx'
|
|
5
5
|
import type { ReactNode } from 'react'
|
|
6
6
|
import type { Base } from '../../../../base'
|
|
7
|
-
import { useDiagramContext } from '../../../../hooks/
|
|
7
|
+
import { useDiagramContext } from '../../../../hooks/useDiagram'
|
|
8
8
|
import { stopPropagation } from '../../../../utils/xyflow'
|
|
9
9
|
import * as css from './styles.css'
|
|
10
10
|
|
|
@@ -22,9 +22,8 @@ import { useDebouncedCallback } from '@react-hookz/web'
|
|
|
22
22
|
import { IconLayoutDashboard } from '@tabler/icons-react'
|
|
23
23
|
import { forwardRef, useState } from 'react'
|
|
24
24
|
import { useDiagramEventHandlers } from '../../../context'
|
|
25
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
26
|
-
import {
|
|
27
|
-
import type { DiagramContext } from '../../state/machine'
|
|
25
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
26
|
+
import type { DiagramContext } from '../../../state/types'
|
|
28
27
|
import { ActionIcon, Tooltip } from './_shared'
|
|
29
28
|
import * as css from './styles.css'
|
|
30
29
|
|
|
@@ -5,9 +5,7 @@ import { LayoutGroup } from 'framer-motion'
|
|
|
5
5
|
import { memo } from 'react'
|
|
6
6
|
import { useDiagramEventHandlers, useEnabledFeatures } from '../../../context'
|
|
7
7
|
import { useMantinePortalProps } from '../../../hooks'
|
|
8
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
9
|
-
import { useDiagramSyncLayoutState } from '../../../hooks/useDiagramActor'
|
|
10
|
-
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
8
|
+
import { useDiagram, useDiagramContext, useDiagramSyncLayoutState } from '../../../hooks/useDiagram'
|
|
11
9
|
import { stopPropagation } from '../../../utils'
|
|
12
10
|
import { LikeC4Search } from '../search/LikeC4Search'
|
|
13
11
|
import { ActionIcon, Tooltip } from './_shared'
|
|
@@ -102,7 +100,7 @@ export const Controls = memo(() => {
|
|
|
102
100
|
</Stack>
|
|
103
101
|
<Group>
|
|
104
102
|
{enableSearch && <LikeC4Search />}
|
|
105
|
-
{notReadOnly && <SyncLayoutBadge />}
|
|
103
|
+
{/* {notReadOnly && <SyncLayoutBadge />} */}
|
|
106
104
|
</Group>
|
|
107
105
|
</Group>
|
|
108
106
|
)
|
|
@@ -3,8 +3,7 @@ import { IconChevronRight } from '@tabler/icons-react'
|
|
|
3
3
|
import { AnimatePresence, m } from 'framer-motion'
|
|
4
4
|
|
|
5
5
|
import { IconChevronLeft } from '@tabler/icons-react'
|
|
6
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
7
|
-
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
6
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
8
7
|
import { ActionIcon } from './_shared'
|
|
9
8
|
|
|
10
9
|
export const NavigationButtons = () => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IconLock, IconLockOpen2 } from '@tabler/icons-react'
|
|
2
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
3
|
-
import {
|
|
4
|
-
import type { DiagramContext } from '../../state/machine'
|
|
2
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
3
|
+
import type { DiagramContext } from '../../../state/types'
|
|
5
4
|
import { ActionIcon, Tooltip } from './_shared'
|
|
6
5
|
|
|
7
6
|
const selector = (state: DiagramContext) => ({
|
|
@@ -4,20 +4,17 @@ import { IconMenu } from '@tabler/icons-react'
|
|
|
4
4
|
import clsx from 'clsx'
|
|
5
5
|
import { AnimatePresence, m } from 'framer-motion'
|
|
6
6
|
import { Link } from '../../../components/Link'
|
|
7
|
-
import { useDiagramContext } from '../../../hooks/
|
|
8
|
-
import type { DiagramContext } from '../../state/machine'
|
|
7
|
+
import { useDiagramContext } from '../../../hooks/useDiagram'
|
|
9
8
|
import * as css from './DiagramTitlePanel.css'
|
|
10
9
|
|
|
11
|
-
const selector = (s: DiagramContext) => ({
|
|
12
|
-
id: s.view.id,
|
|
13
|
-
title: s.view.title ?? 'untitled',
|
|
14
|
-
description: s.view.description,
|
|
15
|
-
links: s.view.links,
|
|
16
|
-
isNotActiveWalkthrough: s.activeWalkthrough === null,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
10
|
export function DiagramTitlePanel() {
|
|
20
|
-
const { id, title, description, links, isNotActiveWalkthrough } = useDiagramContext(
|
|
11
|
+
const { id, title, description, links, isNotActiveWalkthrough } = useDiagramContext(s => ({
|
|
12
|
+
id: s.view.id,
|
|
13
|
+
title: s.view.title ?? 'untitled',
|
|
14
|
+
description: s.view.description,
|
|
15
|
+
links: s.view.links,
|
|
16
|
+
isNotActiveWalkthrough: s.activeWalkthrough === null,
|
|
17
|
+
}))
|
|
21
18
|
const [isCollapsed, setCollapsed] = useLocalStorage({
|
|
22
19
|
key: 'diagram-title-webview-collapsed',
|
|
23
20
|
defaultValue: false,
|
|
@@ -24,10 +24,9 @@ import { memo, useState } from 'react'
|
|
|
24
24
|
import { ceil, isNonNullish } from 'remeda'
|
|
25
25
|
import { ElementShape } from '../../../base/primitives'
|
|
26
26
|
import { useMantinePortalProps } from '../../../hooks'
|
|
27
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
28
|
-
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
27
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
29
28
|
import { useXYStore } from '../../../hooks/useXYFlow'
|
|
30
|
-
import { DiagramContext } from '../../../
|
|
29
|
+
import type { DiagramContext } from '../../../state/types'
|
|
31
30
|
import { vars } from '../../../theme-vars'
|
|
32
31
|
import * as css from './NotationPanel.css'
|
|
33
32
|
|
|
@@ -105,10 +105,7 @@ export function LikeC4Search() {
|
|
|
105
105
|
|
|
106
106
|
function LikeC4SearchOverlay() {
|
|
107
107
|
const close = useCloseSearch()
|
|
108
|
-
const
|
|
109
|
-
const { ref: forcusRef, focused } = useFocusWithin()
|
|
110
|
-
|
|
111
|
-
const ref = useMergedRef(forcusRef, focusTrapRef)
|
|
108
|
+
const ref = useFocusTrap()
|
|
112
109
|
|
|
113
110
|
useWindowEvent(
|
|
114
111
|
'keydown',
|
|
@@ -20,7 +20,7 @@ import { IconStack2, IconZoomScan } from '@tabler/icons-react'
|
|
|
20
20
|
import clsx from 'clsx'
|
|
21
21
|
import { m } from 'framer-motion'
|
|
22
22
|
import { first } from 'remeda'
|
|
23
|
-
import { useCurrentViewId } from '../../../hooks'
|
|
23
|
+
import { useCurrentViewId } from '../../../hooks/useCurrentViewId'
|
|
24
24
|
import { useLikeC4Model } from '../../../likec4model/useLikeC4Model'
|
|
25
25
|
import { emptyBoX } from './_shared.css'
|
|
26
26
|
import { useCloseSearchAndNavigateTo, useNormalizedSearch } from './state'
|
|
@@ -66,7 +66,7 @@ export function useCloseSearchAndNavigateTo() {
|
|
|
66
66
|
const fromNode = fromElementFqn
|
|
67
67
|
? diagram.getContext().view.nodes.find(n => DiagramNode.modelRef(n) === fromElementFqn)?.id
|
|
68
68
|
: undefined
|
|
69
|
-
if (diagram.currentView
|
|
69
|
+
if (diagram.currentView.id === viewId && fromNode) {
|
|
70
70
|
diagram.focusNode(fromNode)
|
|
71
71
|
return
|
|
72
72
|
}
|
|
@@ -9,8 +9,7 @@ import clsx from 'clsx'
|
|
|
9
9
|
import { AnimatePresence, m } from 'framer-motion'
|
|
10
10
|
import { isNonNull, isTruthy } from 'remeda'
|
|
11
11
|
import { useXYStore } from '../../../hooks'
|
|
12
|
-
import { useDiagram } from '../../../hooks/useDiagram'
|
|
13
|
-
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
12
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
14
13
|
import * as css from './DynamicViewWalkthrough.css'
|
|
15
14
|
|
|
16
15
|
export function DynamicViewWalkthrough() {
|
|
@@ -21,7 +21,6 @@ import type { Types } from './types'
|
|
|
21
21
|
function viewToNodesEdge(opts: {
|
|
22
22
|
view: Pick<DiagramView, 'id' | 'nodes' | 'edges' | '__'>
|
|
23
23
|
where: WhereOperator<string, string> | undefined
|
|
24
|
-
nodesDraggable: boolean
|
|
25
24
|
nodesSelectable: boolean
|
|
26
25
|
}): {
|
|
27
26
|
xynodes: Types.Node[]
|
|
@@ -29,7 +28,6 @@ function viewToNodesEdge(opts: {
|
|
|
29
28
|
} {
|
|
30
29
|
const {
|
|
31
30
|
view,
|
|
32
|
-
nodesDraggable: draggable,
|
|
33
31
|
nodesSelectable: selectable,
|
|
34
32
|
} = opts
|
|
35
33
|
const isDynamicView = view.__ === 'dynamic',
|
|
@@ -95,7 +93,6 @@ function viewToNodesEdge(opts: {
|
|
|
95
93
|
|
|
96
94
|
const base = {
|
|
97
95
|
id,
|
|
98
|
-
draggable: draggable,
|
|
99
96
|
selectable: selectable && node.kind !== ElementKind.Group,
|
|
100
97
|
focusable: selectable && !isCompound,
|
|
101
98
|
deletable: false,
|
|
@@ -281,7 +278,6 @@ export function useViewToNodesEdges({
|
|
|
281
278
|
}: {
|
|
282
279
|
view: DiagramView
|
|
283
280
|
where: WhereOperator<string, string> | undefined
|
|
284
|
-
nodesDraggable: boolean
|
|
285
281
|
nodesSelectable: boolean
|
|
286
282
|
}) {
|
|
287
283
|
return useDeepCompareMemo(() => {
|