@likec4/diagram 1.34.1 → 1.35.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/bundle/{chunk-Dd7et66b.js → chunk-C0Eg81Gj.js} +971 -1045
- package/bundle/custom.js +59 -55
- package/bundle/index.js +6656 -4263
- package/dist/LikeC4Diagram.props.d.ts +51 -4
- package/dist/LikeC4ModelProvider.d.ts +3 -3
- package/dist/base/BaseXYFlow.d.ts +2 -2
- package/dist/base/BaseXYFlow.js +3 -3
- package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base/primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base/primitives/element/ElementDetailsButton.js +1 -1
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +3 -3
- package/dist/base/primitives/element/ElementTitle.js +9 -9
- package/dist/bundle/LikeC4View.js +3 -3
- package/dist/bundle/LikeC4View.props.d.ts +8 -4
- package/dist/bundle/custom.js +1 -0
- package/dist/bundle/index.js +1 -0
- package/dist/components/ErrorFallback.d.ts +2 -1
- package/dist/components/ErrorFallback.js +15 -2
- package/dist/components/Link.js +2 -2
- package/dist/components/NavigationLink.d.ts +6 -0
- package/dist/components/NavigationLink.js +25 -0
- package/dist/components/SearchControl.js +1 -1
- package/dist/context/ControlsCustomLayout.d.ts +0 -1
- package/dist/context/DiagramFeatures.d.ts +4 -1
- package/dist/context/IconRenderer.js +6 -6
- package/dist/custom/customNodes.js +10 -2
- package/dist/custom/hooks.d.ts +1 -0
- package/dist/custom/index.js +1 -0
- package/dist/hooks/useDiagram.d.ts +1 -2
- package/dist/hooks/useDiagram.js +1 -5
- package/dist/index.js +1 -0
- package/dist/likec4diagram/DiagramUI.js +8 -4
- package/dist/likec4diagram/DiagramXYFlow.js +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +4 -4
- package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +1 -1
- package/dist/likec4diagram/ui/controls/Controls.js +11 -15
- package/dist/likec4diagram/ui/controls/LayoutDriftNotification.js +1 -1
- package/dist/likec4diagram/ui/controls/ManualLayoutToolsButton.js +9 -9
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +4 -2
- package/dist/likec4diagram/ui/controls/ToggleReadonly.js +2 -2
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +15 -13
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +4 -4
- package/dist/likec4model/LikeC4ModelContext.d.ts +4 -1
- package/dist/likec4model/LikeC4ModelContext.js +2 -1
- package/dist/likec4model/index.d.ts +1 -0
- package/dist/likec4model/useCurrentViewModel.d.ts +2 -0
- package/dist/likec4model/useCurrentViewModel.js +12 -0
- package/dist/likec4model/useLikeC4Model.d.ts +2 -5
- package/dist/likec4model/useLikeC4Model.js +10 -16
- package/dist/navigationpanel/NavigationPanel.d.ts +2 -0
- package/dist/navigationpanel/NavigationPanel.js +124 -0
- package/dist/navigationpanel/NavigationPanelControls.d.ts +1 -0
- package/dist/navigationpanel/NavigationPanelControls.js +134 -0
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +1 -0
- package/dist/navigationpanel/NavigationPanelDropdown.js +436 -0
- package/dist/navigationpanel/_common.d.ts +15 -0
- package/dist/navigationpanel/_common.js +69 -0
- package/dist/navigationpanel/actor.d.ts +300 -0
- package/dist/navigationpanel/actor.js +240 -0
- package/dist/navigationpanel/controls/BurgerButton.d.ts +1 -0
- package/dist/navigationpanel/controls/BurgerButton.js +36 -0
- package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -0
- package/dist/navigationpanel/controls/NavigationButtons.js +44 -0
- package/dist/navigationpanel/controls/OpenSource.d.ts +1 -0
- package/dist/navigationpanel/controls/OpenSource.js +27 -0
- package/dist/navigationpanel/controls/SearchControl.d.ts +1 -0
- package/dist/navigationpanel/controls/SearchControl.js +68 -0
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -0
- package/dist/navigationpanel/controls/ToggleReadonly.js +69 -0
- package/dist/navigationpanel/controls/index.d.ts +5 -0
- package/dist/navigationpanel/editorpanel/CenterCamera.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/CenterCamera.js +12 -0
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +157 -0
- package/dist/navigationpanel/editorpanel/EditorPanel.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/EditorPanel.js +48 -0
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +56 -0
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +174 -0
- package/dist/navigationpanel/editorpanel/_common.d.ts +6 -0
- package/dist/navigationpanel/editorpanel/_common.js +14 -0
- package/dist/navigationpanel/editorpanel/index.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/styles.d.ts +8 -0
- package/dist/navigationpanel/editorpanel/styles.js +79 -0
- package/dist/navigationpanel/hooks.d.ts +20 -0
- package/dist/navigationpanel/hooks.js +38 -0
- package/dist/navigationpanel/index.d.ts +1 -0
- package/dist/navigationpanel/styles.css.d.ts +16 -0
- package/dist/navigationpanel/styles.css.js +32 -0
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.d.ts +2 -0
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +157 -0
- package/dist/navigationpanel/walkthrough/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.31.0_react@19.1.0 → @tabler_icons-react@3.34.1_react@19.1.1}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.31.0_react@19.1.0 → @tabler_icons-react@3.34.1_react@19.1.1}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu2.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +14 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
- package/dist/overlays/element-details/TabPanelDeployments.js +3 -3
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- package/dist/search/components/ElementsColumn.js +1 -1
- package/dist/search/components/PickView.js +1 -1
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +2 -2
- package/dist/state/DiagramActorProvider.d.ts +2 -2
- package/dist/state/DiagramActorProvider.js +48 -10
- package/dist/state/diagram-machine.d.ts +2 -2
- package/dist/styles-min.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css2.js +1 -1
- package/package.json +16 -15
- package/panda.buildinfo.json +170 -134
- package/src/LikeC4Diagram.props.ts +51 -3
- package/src/LikeC4ModelProvider.tsx +3 -3
- package/src/base/BaseXYFlow.tsx +4 -4
- package/src/base/primitives/element/ElementNodeContainer.tsx +2 -2
- package/src/base/primitives/element/ElementTitle.tsx +4 -4
- package/src/bundle/LikeC4View.props.ts +14 -4
- package/src/bundle/LikeC4View.tsx +2 -2
- package/src/components/ErrorFallback.tsx +16 -1
- package/src/components/NavigationLink.tsx +31 -0
- package/src/context/ControlsCustomLayout.ts +0 -1
- package/src/context/DiagramFeatures.tsx +6 -1
- package/src/custom/customNodes.tsx +10 -2
- package/src/custom/hooks.ts +3 -0
- package/src/hooks/useDiagram.ts +0 -8
- package/src/likec4diagram/DiagramUI.tsx +9 -3
- package/src/likec4diagram/DiagramXYFlow.tsx +1 -1
- package/src/likec4diagram/ui/controls/Controls.tsx +8 -18
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +2 -0
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +14 -11
- package/src/likec4model/LikeC4ModelContext.ts +5 -1
- package/src/likec4model/index.ts +3 -0
- package/src/likec4model/useCurrentViewModel.ts +10 -0
- package/src/likec4model/useLikeC4Model.ts +17 -27
- package/src/navigationpanel/NavigationPanel.tsx +136 -0
- package/src/navigationpanel/NavigationPanelControls.tsx +155 -0
- package/src/navigationpanel/NavigationPanelDropdown.tsx +523 -0
- package/src/navigationpanel/_common.tsx +81 -0
- package/src/navigationpanel/actor.ts +321 -0
- package/src/navigationpanel/controls/BurgerButton.tsx +32 -0
- package/src/navigationpanel/controls/NavigationButtons.tsx +36 -0
- package/src/navigationpanel/controls/OpenSource.tsx +28 -0
- package/src/navigationpanel/controls/SearchControl.tsx +64 -0
- package/src/navigationpanel/controls/ToggleReadonly.tsx +66 -0
- package/src/navigationpanel/controls/index.ts +5 -0
- package/src/navigationpanel/editorpanel/CenterCamera.tsx +15 -0
- package/src/navigationpanel/editorpanel/ChangeAutoLayoutButton.tsx +199 -0
- package/src/navigationpanel/editorpanel/EditorPanel.tsx +49 -0
- package/src/navigationpanel/editorpanel/LayoutDriftNotification.tsx +56 -0
- package/src/navigationpanel/editorpanel/ManualLayoutToolsButton.tsx +151 -0
- package/src/navigationpanel/editorpanel/_common.tsx +14 -0
- package/src/navigationpanel/editorpanel/index.ts +1 -0
- package/src/navigationpanel/editorpanel/styles.ts +84 -0
- package/src/navigationpanel/hooks.tsx +70 -0
- package/src/navigationpanel/index.ts +1 -0
- package/src/navigationpanel/styles.css.ts +30 -0
- package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +160 -0
- package/src/navigationpanel/walkthrough/index.tsx +1 -0
- package/src/state/DiagramActorProvider.tsx +60 -12
- package/src/state/diagram-machine.ts +2 -2
- package/dist/base/primitives/element/ElementTitle.css.d.ts +0 -34
- package/dist/base/primitives/element/ElementTitle.css.js +0 -201
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu2.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -13
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.31.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -13
- package/src/base/primitives/element/ElementTitle.css.ts +0 -206
|
@@ -86,6 +86,26 @@ export type OverrideReactFlowProps = Pick<
|
|
|
86
86
|
export type PaddingUnit = 'px' | '%'
|
|
87
87
|
export type PaddingWithUnit = `${number}${PaddingUnit}` | number
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Padding around the diagram
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* {
|
|
94
|
+
* top: '8px',
|
|
95
|
+
* right: '8px',
|
|
96
|
+
* bottom: '8px',
|
|
97
|
+
* left: '8px',
|
|
98
|
+
* }
|
|
99
|
+
*/
|
|
100
|
+
export type ViewPadding = PaddingWithUnit | {
|
|
101
|
+
top?: PaddingWithUnit
|
|
102
|
+
right?: PaddingWithUnit
|
|
103
|
+
bottom?: PaddingWithUnit
|
|
104
|
+
left?: PaddingWithUnit
|
|
105
|
+
x?: PaddingWithUnit
|
|
106
|
+
y?: PaddingWithUnit
|
|
107
|
+
}
|
|
108
|
+
|
|
89
109
|
export interface LikeC4DiagramProperties<A extends aux.Any> {
|
|
90
110
|
view: LayoutedView<A>
|
|
91
111
|
|
|
@@ -108,10 +128,11 @@ export interface LikeC4DiagramProperties<A extends aux.Any> {
|
|
|
108
128
|
readonly?: boolean | undefined
|
|
109
129
|
/**
|
|
110
130
|
* Show/hide panel with top left controls,
|
|
131
|
+
* - `next` - Experimental navigation panel
|
|
111
132
|
*
|
|
112
133
|
* @default true if not readonly
|
|
113
134
|
*/
|
|
114
|
-
controls?: boolean | undefined
|
|
135
|
+
controls?: boolean | 'next' | undefined
|
|
115
136
|
/**
|
|
116
137
|
* If set, initial viewport will show all nodes & edges
|
|
117
138
|
* @default true
|
|
@@ -121,8 +142,29 @@ export interface LikeC4DiagramProperties<A extends aux.Any> {
|
|
|
121
142
|
/**
|
|
122
143
|
* Padding around the diagram
|
|
123
144
|
* @default '8px'
|
|
145
|
+
*
|
|
146
|
+
* @see {@link ViewPadding}
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* <LikeC4Diagram
|
|
151
|
+
* fitViewPadding={{
|
|
152
|
+
* x: '16px',
|
|
153
|
+
* y: '16px',
|
|
154
|
+
* }}
|
|
155
|
+
* />
|
|
156
|
+
*
|
|
157
|
+
* <LikeC4Diagram
|
|
158
|
+
* fitViewPadding={{
|
|
159
|
+
* top: '8px',
|
|
160
|
+
* right: '8px',
|
|
161
|
+
* bottom: '8px',
|
|
162
|
+
* left: '8px',
|
|
163
|
+
* }}
|
|
164
|
+
* />
|
|
165
|
+
* ```
|
|
124
166
|
*/
|
|
125
|
-
fitViewPadding?:
|
|
167
|
+
fitViewPadding?: ViewPadding | undefined
|
|
126
168
|
|
|
127
169
|
/**
|
|
128
170
|
* @default false if readonly
|
|
@@ -223,8 +265,9 @@ export interface LikeC4DiagramProperties<A extends aux.Any> {
|
|
|
223
265
|
/**
|
|
224
266
|
* Improve performance by hiding certain elements and reducing visual effects (disable mix-blend, shadows, animations)
|
|
225
267
|
* Enable it if you have a large or static view
|
|
268
|
+
* - `auto` - will be `true` if view has more then 3000 * 2000 pixels
|
|
226
269
|
*
|
|
227
|
-
* @default 'auto'
|
|
270
|
+
* @default 'auto'
|
|
228
271
|
*/
|
|
229
272
|
reduceGraphics?: 'auto' | boolean | undefined
|
|
230
273
|
|
|
@@ -236,6 +279,11 @@ export interface LikeC4DiagramProperties<A extends aux.Any> {
|
|
|
236
279
|
|
|
237
280
|
/**
|
|
238
281
|
* Customize layout of the controls on the top left
|
|
282
|
+
*
|
|
283
|
+
* @note
|
|
284
|
+
* Ignored if `controls="next"`
|
|
285
|
+
*
|
|
286
|
+
* @see {@link controls}
|
|
239
287
|
*/
|
|
240
288
|
renderControls?: ControlsCustomLayout | undefined
|
|
241
289
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { LikeC4Model } from '@likec4/core/model'
|
|
2
|
-
import type {
|
|
2
|
+
import type { aux } from '@likec4/core/types'
|
|
3
3
|
import { type PropsWithChildren } from 'react'
|
|
4
4
|
import { LikeC4ModelContext } from './likec4model/LikeC4ModelContext'
|
|
5
5
|
|
|
6
|
-
export type LikeC4ModelProviderProps<A extends Any> = PropsWithChildren<{
|
|
6
|
+
export type LikeC4ModelProviderProps<A extends aux.Any = aux.Unknown> = PropsWithChildren<{
|
|
7
7
|
likec4model: LikeC4Model<A>
|
|
8
8
|
}>
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Ensures LikeC4Model context
|
|
12
12
|
*/
|
|
13
|
-
export function LikeC4ModelProvider<A extends Any = Unknown>({
|
|
13
|
+
export function LikeC4ModelProvider<A extends aux.Any = aux.Unknown>({
|
|
14
14
|
children,
|
|
15
15
|
likec4model,
|
|
16
16
|
}: LikeC4ModelProviderProps<A>) {
|
package/src/base/BaseXYFlow.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import { Fragment, useMemo } from 'react'
|
|
|
10
10
|
import type { SetRequired, Simplify } from 'type-fest'
|
|
11
11
|
import { useUpdateEffect } from '../hooks/useUpdateEffect'
|
|
12
12
|
import { useIsZoomTooSmall, useXYStoreApi } from '../hooks/useXYFlow'
|
|
13
|
-
import type {
|
|
13
|
+
import type { ViewPadding } from '../LikeC4Diagram.props'
|
|
14
14
|
import { stopPropagation } from '../utils/xyflow'
|
|
15
15
|
import { type XYBackground, Background } from './Background'
|
|
16
16
|
import { MaxZoom, MinZoom } from './const'
|
|
@@ -23,7 +23,7 @@ export type BaseXYFlowProps<NodeType extends Base.Node, EdgeType extends Base.Ed
|
|
|
23
23
|
nodesSelectable?: boolean
|
|
24
24
|
nodesDraggable?: boolean
|
|
25
25
|
background?: 'transparent' | 'solid' | XYBackground
|
|
26
|
-
fitViewPadding?:
|
|
26
|
+
fitViewPadding?: ViewPadding | undefined
|
|
27
27
|
onViewportResize?: undefined | (() => void)
|
|
28
28
|
}
|
|
29
29
|
& SetRequired<
|
|
@@ -122,12 +122,12 @@ export const BaseXYFlow = <
|
|
|
122
122
|
maxZoom={zoomable ? MaxZoom : 1}
|
|
123
123
|
minZoom={zoomable ? MinZoom : 1}
|
|
124
124
|
fitView={fitView}
|
|
125
|
-
fitViewOptions={
|
|
125
|
+
fitViewOptions={{
|
|
126
126
|
minZoom: MinZoom,
|
|
127
127
|
maxZoom: 1,
|
|
128
128
|
padding: fitViewPadding,
|
|
129
129
|
includeHiddenNodes: false,
|
|
130
|
-
}
|
|
130
|
+
}}
|
|
131
131
|
preventScrolling={zoomable || pannable}
|
|
132
132
|
defaultMarkerColor="var(--xy-edge-stroke)"
|
|
133
133
|
noDragClassName="nodrag"
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
DefaultTextSize,
|
|
8
8
|
} from '@likec4/core/types'
|
|
9
9
|
import { css, cx } from '@likec4/styles/css'
|
|
10
|
-
import type {
|
|
10
|
+
import type { MotionNodeLayoutOptions } from 'motion/react'
|
|
11
11
|
import * as m from 'motion/react-m'
|
|
12
12
|
import { type CSSProperties, type ReactNode, forwardRef } from 'react'
|
|
13
13
|
import type { NodeProps } from '../../types'
|
|
@@ -27,7 +27,7 @@ export type ElementNodeContainerProps =
|
|
|
27
27
|
style?: CSSProperties | undefined
|
|
28
28
|
[key: `data-${string}`]: string | undefined
|
|
29
29
|
}
|
|
30
|
-
&
|
|
30
|
+
& MotionNodeLayoutOptions
|
|
31
31
|
|
|
32
32
|
export function nodeSizes({
|
|
33
33
|
size,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DiagramNode, RichTextOrEmpty } from '@likec4/core/types'
|
|
2
2
|
import { cx } from '@likec4/styles/css'
|
|
3
3
|
import { Box } from '@likec4/styles/jsx'
|
|
4
|
+
import { elementNodeData, elementNodeIcon as elementIconRecipe } from '@likec4/styles/recipes'
|
|
4
5
|
import { Text } from '@mantine/core'
|
|
5
6
|
import { isEmpty, isNumber, isTruthy } from 'remeda'
|
|
6
7
|
import type { Simplify } from 'type-fest'
|
|
@@ -8,7 +9,6 @@ import { IconRenderer } from '../../../context/IconRenderer'
|
|
|
8
9
|
import type { NodeProps, NonOptional } from '../../types'
|
|
9
10
|
import { MarkdownBlock } from '../MarkdownBlock'
|
|
10
11
|
import { nodeSizes } from './ElementNodeContainer'
|
|
11
|
-
import * as styles from './ElementTitle.css'
|
|
12
12
|
|
|
13
13
|
type Data = Simplify<
|
|
14
14
|
& NonOptional<
|
|
@@ -37,9 +37,9 @@ export function ElementTitle({ id, data, iconSize }: ElementTitleProps) {
|
|
|
37
37
|
title: data.title,
|
|
38
38
|
icon: data.icon,
|
|
39
39
|
},
|
|
40
|
-
className:
|
|
40
|
+
className: elementIconRecipe(),
|
|
41
41
|
})
|
|
42
|
-
const classes =
|
|
42
|
+
const classes = elementNodeData({
|
|
43
43
|
hasIcon: isTruthy(elementIcon),
|
|
44
44
|
hasDescription: !!data.description?.nonEmpty,
|
|
45
45
|
hasTechnology: !isEmpty(data.technology ?? ''),
|
|
@@ -56,7 +56,7 @@ export function ElementTitle({ id, data, iconSize }: ElementTitleProps) {
|
|
|
56
56
|
style={isNumber(iconSize)
|
|
57
57
|
? {
|
|
58
58
|
// @ts-ignore
|
|
59
|
-
[
|
|
59
|
+
['--likec4-icon-size']: `${iconSize}px`,
|
|
60
60
|
}
|
|
61
61
|
: undefined}
|
|
62
62
|
>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { WhereOperator } from '@likec4/core/types'
|
|
2
2
|
import type * as aux from '@likec4/core/types/_aux'
|
|
3
3
|
import type { CSSProperties } from 'react'
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
CustomNodes,
|
|
6
|
+
ElementIconRenderer,
|
|
7
|
+
OverrideReactFlowProps,
|
|
8
|
+
PaddingWithUnit,
|
|
9
|
+
ViewPadding,
|
|
10
|
+
} from '../LikeC4Diagram.props'
|
|
5
11
|
|
|
6
12
|
export interface LikeC4ViewProps<A extends aux.Any> {
|
|
7
13
|
/**
|
|
@@ -69,8 +75,10 @@ export interface LikeC4ViewProps<A extends aux.Any> {
|
|
|
69
75
|
/**
|
|
70
76
|
* Padding around the diagram
|
|
71
77
|
* @default '8px'
|
|
78
|
+
*
|
|
79
|
+
* @see {@link ViewPadding}
|
|
72
80
|
*/
|
|
73
|
-
fitViewPadding?:
|
|
81
|
+
fitViewPadding?: ViewPadding | undefined
|
|
74
82
|
|
|
75
83
|
/**
|
|
76
84
|
* Display diagram title / description
|
|
@@ -182,9 +190,11 @@ export interface LikeC4BrowserProps {
|
|
|
182
190
|
|
|
183
191
|
/**
|
|
184
192
|
* Show/hide panel with top left controls,
|
|
185
|
-
*
|
|
193
|
+
* - `next` - show navigation panel (Experimental)
|
|
194
|
+
*
|
|
195
|
+
* @default `next`
|
|
186
196
|
*/
|
|
187
|
-
controls?: boolean | undefined
|
|
197
|
+
controls?: boolean | 'next' | undefined
|
|
188
198
|
|
|
189
199
|
/**
|
|
190
200
|
* Display diagram title / description
|
|
@@ -69,7 +69,7 @@ const LikeC4ViewInner = memo<LikeC4ViewInnerProps<aux.Any>>(({
|
|
|
69
69
|
renderNodes,
|
|
70
70
|
...props
|
|
71
71
|
}) => {
|
|
72
|
-
const likec4model = useLikeC4Model(
|
|
72
|
+
const likec4model = useLikeC4Model()
|
|
73
73
|
const colorScheme = useColorScheme(explicitColorScheme)
|
|
74
74
|
|
|
75
75
|
const [shadowRootProps, cssstyle] = useShadowRootStyle(keepAspectRatio, view)
|
|
@@ -159,7 +159,7 @@ const LikeC4ViewInner = memo<LikeC4ViewInnerProps<aux.Any>>(({
|
|
|
159
159
|
enableRelationshipDetails
|
|
160
160
|
enableSearch
|
|
161
161
|
enableElementTags
|
|
162
|
-
controls
|
|
162
|
+
controls="next"
|
|
163
163
|
readonly
|
|
164
164
|
fitView
|
|
165
165
|
fitViewPadding={'32px'}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Box } from '@likec4/styles/jsx'
|
|
2
2
|
import { Button, Code, Group, Notification, ScrollAreaAutosize } from '@mantine/core'
|
|
3
3
|
import { IconX } from '@tabler/icons-react'
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
type ErrorBoundaryProps,
|
|
6
|
+
type FallbackProps,
|
|
7
|
+
ErrorBoundary as ErrorBoundaryComponent,
|
|
8
|
+
} from 'react-error-boundary'
|
|
5
9
|
|
|
6
10
|
export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
|
|
7
11
|
const errorString = error instanceof Error ? error.message : 'Unknown error'
|
|
@@ -28,3 +32,14 @@ export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
|
|
|
28
32
|
</Box>
|
|
29
33
|
)
|
|
30
34
|
}
|
|
35
|
+
|
|
36
|
+
export function ErrorBoundary(props: Pick<ErrorBoundaryProps, 'onReset' | 'onError' | 'children'>) {
|
|
37
|
+
return (
|
|
38
|
+
<ErrorBoundaryComponent
|
|
39
|
+
FallbackComponent={ErrorFallback}
|
|
40
|
+
onError={(err, info) => {
|
|
41
|
+
console.error(err, info)
|
|
42
|
+
}}
|
|
43
|
+
{...props} />
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cx } from '@likec4/styles/css'
|
|
2
|
+
import { navigationLink } from '@likec4/styles/recipes'
|
|
3
|
+
import { type NavLinkProps, NavLink } from '@mantine/core'
|
|
4
|
+
import { forwardRef } from 'react'
|
|
5
|
+
|
|
6
|
+
export interface NavigationLinkProps
|
|
7
|
+
extends NavLinkProps, Omit<React.ComponentPropsWithoutRef<'button'>, keyof NavLinkProps>
|
|
8
|
+
{
|
|
9
|
+
truncateLabel?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const NavigationLink = forwardRef<HTMLButtonElement, NavigationLinkProps>((
|
|
13
|
+
{ className, truncateLabel = true, ...others },
|
|
14
|
+
ref,
|
|
15
|
+
) => (
|
|
16
|
+
<NavLink
|
|
17
|
+
{...others}
|
|
18
|
+
component="button"
|
|
19
|
+
classNames={navigationLink({
|
|
20
|
+
truncateLabel,
|
|
21
|
+
})}
|
|
22
|
+
className={cx(
|
|
23
|
+
'group',
|
|
24
|
+
'mantine-active',
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
ref={ref}
|
|
28
|
+
/>
|
|
29
|
+
))
|
|
30
|
+
|
|
31
|
+
NavigationLink.displayName = 'NavigationLink'
|
|
@@ -25,8 +25,13 @@ const FeatureNames = [
|
|
|
25
25
|
'ElementTags',
|
|
26
26
|
] as const
|
|
27
27
|
export type FeatureName = typeof FeatureNames[number]
|
|
28
|
+
|
|
29
|
+
type CustomFeatures = {
|
|
30
|
+
enableControls: 'next' | boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
export type EnabledFeatures = {
|
|
29
|
-
[P in `enable${FeatureName}`]: boolean
|
|
34
|
+
[P in `enable${FeatureName}`]: P extends keyof CustomFeatures ? CustomFeatures[P] : boolean
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
export const AllDisabled: EnabledFeatures = mapToObj(
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { DeployedInstanceModel, DeploymentNodeModel, NodeModel } from '@likec4/core/model'
|
|
2
2
|
import type { Any } from '@likec4/core/types'
|
|
3
|
+
import { DEV } from 'esm-env'
|
|
3
4
|
import type { ReactNode } from 'react'
|
|
4
5
|
import { customNode } from '../base/primitives'
|
|
5
6
|
import type { NodeProps } from '../base/types'
|
|
6
7
|
import type { Types } from '../likec4diagram/types'
|
|
7
|
-
import {
|
|
8
|
+
import { useLikeC4ViewModel } from '../likec4model/useLikeC4Model'
|
|
8
9
|
|
|
9
10
|
function customDiagramNode<
|
|
10
11
|
P extends {
|
|
@@ -15,7 +16,14 @@ function customDiagramNode<
|
|
|
15
16
|
Node: (props: P) => ReactNode,
|
|
16
17
|
): (props: P['nodeProps']) => ReactNode {
|
|
17
18
|
return customNode((props) => {
|
|
18
|
-
const viewModel =
|
|
19
|
+
const viewModel = useLikeC4ViewModel(props.data.viewId)
|
|
20
|
+
if (!viewModel) {
|
|
21
|
+
if (DEV) {
|
|
22
|
+
throw new Error(`View "${props.data.viewId}" not found, requested by customNode "${props.id}"`)
|
|
23
|
+
}
|
|
24
|
+
console.error(`View "${props.data.viewId}" not found in likec4model`, { props })
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
19
27
|
const model = viewModel.node(props.id)
|
|
20
28
|
// @ts-ignore
|
|
21
29
|
return <Node nodeProps={props} nodeModel={model} />
|
package/src/custom/hooks.ts
CHANGED
package/src/hooks/useDiagram.ts
CHANGED
|
@@ -252,14 +252,6 @@ export function useDiagramActorSnapshot<T = unknown>(
|
|
|
252
252
|
return useXstateSelector(actorRef, useCallbackRef(selector), compare)
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
export function useDiagramSyncLayoutState<T = unknown>(
|
|
256
|
-
selector: (state: SyncLayoutActorSnapshot) => T,
|
|
257
|
-
compare: (a: NoInfer<T>, b: NoInfer<T>) => boolean = shallowEqual,
|
|
258
|
-
): T {
|
|
259
|
-
const syncLayoutActorRef = useDiagramActorSnapshot(s => s.context.syncLayoutActorRef as SyncLayoutActorRef)
|
|
260
|
-
return useXstateSelector(syncLayoutActorRef, useCallbackRef(selector), compare)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
255
|
/**
|
|
264
256
|
* Read diagram context
|
|
265
257
|
*/
|
|
@@ -2,12 +2,14 @@ import { memo } from 'react'
|
|
|
2
2
|
import { useEnabledFeatures } from '../context'
|
|
3
3
|
import { useOverlaysActorRef } from '../hooks/useOverlaysActor'
|
|
4
4
|
import { useSearchActorRef } from '../hooks/useSearchActor'
|
|
5
|
+
import { NavigationPanel } from '../navigationpanel'
|
|
5
6
|
import { Overlays } from '../overlays/Overlays'
|
|
6
7
|
import { Search } from '../search/Search'
|
|
7
8
|
import { Controls, DiagramTitlePanel, DynamicViewWalkthrough, NotationPanel } from './ui'
|
|
8
9
|
|
|
9
10
|
export const DiagramUI = memo(() => {
|
|
10
11
|
const {
|
|
12
|
+
enableControls,
|
|
11
13
|
enableViewTitle,
|
|
12
14
|
enableNotations,
|
|
13
15
|
enableDynamicViewWalkthrough,
|
|
@@ -19,11 +21,15 @@ export const DiagramUI = memo(() => {
|
|
|
19
21
|
|
|
20
22
|
return (
|
|
21
23
|
<>
|
|
22
|
-
<Controls />
|
|
24
|
+
{enableControls === 'next' ? <NavigationPanel /> : <Controls />}
|
|
23
25
|
{overlaysActorRef && <Overlays overlaysActorRef={overlaysActorRef} />}
|
|
24
|
-
{enableViewTitle && <DiagramTitlePanel />}
|
|
25
26
|
{enableNotations && <NotationPanel />}
|
|
26
|
-
{
|
|
27
|
+
{enableControls !== 'next' && (
|
|
28
|
+
<>
|
|
29
|
+
{enableViewTitle && <DiagramTitlePanel />}
|
|
30
|
+
{enableDynamicViewWalkthrough && <DynamicViewWalkthrough />}
|
|
31
|
+
</>
|
|
32
|
+
)}
|
|
27
33
|
{enableSearch && searchActorRef && <Search searchActorRef={searchActorRef} />}
|
|
28
34
|
</>
|
|
29
35
|
)
|
|
@@ -39,9 +39,9 @@ const equalsXYProps = (a: ReturnType<typeof selectXYProps>, b: ReturnType<typeof
|
|
|
39
39
|
a.initialized === b.initialized &&
|
|
40
40
|
a.pannable === b.pannable &&
|
|
41
41
|
a.zoomable === b.zoomable &&
|
|
42
|
-
a.fitViewPadding === b.fitViewPadding &&
|
|
43
42
|
a.enableFitView === b.enableFitView &&
|
|
44
43
|
a.enableReadOnly === b.enableReadOnly &&
|
|
44
|
+
shallowEqual(a.fitViewPadding, b.fitViewPadding) &&
|
|
45
45
|
shallowEqual(a.nodes, b.nodes) &&
|
|
46
46
|
shallowEqual(a.edges, b.edges) &&
|
|
47
47
|
shallowEqual(a.viewport ?? null, b.viewport ?? null)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cx } from '@likec4/styles/css'
|
|
2
|
+
import { hstack } from '@likec4/styles/patterns'
|
|
2
3
|
import { ActionIconGroup, Badge, Box, Group, Loader, Stack } from '@mantine/core'
|
|
3
4
|
import { IconFileSymlink, IconFocusCentered, IconMenu2 } from '@tabler/icons-react'
|
|
4
5
|
import { LayoutGroup, m } from 'motion/react'
|
|
@@ -7,7 +8,7 @@ import { SearchControl } from '../../../components/SearchControl'
|
|
|
7
8
|
import { useDiagramEventHandlers, useEnabledFeatures } from '../../../context'
|
|
8
9
|
import { type ControlsCustomLayout, useControlsCustomLayout } from '../../../context/ControlsCustomLayout'
|
|
9
10
|
import { useMantinePortalProps } from '../../../hooks'
|
|
10
|
-
import { useDiagram, useDiagramContext
|
|
11
|
+
import { useDiagram, useDiagramContext } from '../../../hooks/useDiagram'
|
|
11
12
|
import { stopPropagation } from '../../../utils'
|
|
12
13
|
import { ActionIcon, Tooltip } from './_shared'
|
|
13
14
|
import { ChangeAutoLayoutButton } from './ChangeAutoLayoutButton'
|
|
@@ -23,9 +24,7 @@ const ControlsDefaultLayout: ControlsCustomLayout = ({
|
|
|
23
24
|
search,
|
|
24
25
|
actionsGroup,
|
|
25
26
|
}) => (
|
|
26
|
-
<
|
|
27
|
-
component={m.div}
|
|
28
|
-
// @ts-expect-error group component not fully polymorphic
|
|
27
|
+
<m.div
|
|
29
28
|
initial={{
|
|
30
29
|
opacity: 0.05,
|
|
31
30
|
translateX: -30,
|
|
@@ -41,13 +40,15 @@ const ControlsDefaultLayout: ControlsCustomLayout = ({
|
|
|
41
40
|
translateX: -30,
|
|
42
41
|
translateY: -10,
|
|
43
42
|
}}
|
|
44
|
-
align="flex-start"
|
|
45
43
|
className={cx(
|
|
44
|
+
hstack({
|
|
45
|
+
gap: 'sm',
|
|
46
|
+
alignItems: 'flex-start',
|
|
47
|
+
}),
|
|
46
48
|
'react-flow__panel',
|
|
47
49
|
css.panel,
|
|
48
50
|
'likec4-top-left-panel',
|
|
49
51
|
)}
|
|
50
|
-
gap="xs"
|
|
51
52
|
onClick={stopPropagation}
|
|
52
53
|
>
|
|
53
54
|
<Stack align="flex-start" gap="xs">
|
|
@@ -64,7 +65,7 @@ const ControlsDefaultLayout: ControlsCustomLayout = ({
|
|
|
64
65
|
<Box>
|
|
65
66
|
{search}
|
|
66
67
|
</Box>
|
|
67
|
-
</
|
|
68
|
+
</m.div>
|
|
68
69
|
)
|
|
69
70
|
|
|
70
71
|
export const Controls = memo(() => {
|
|
@@ -110,7 +111,6 @@ export const Controls = memo(() => {
|
|
|
110
111
|
}}
|
|
111
112
|
/>
|
|
112
113
|
)}
|
|
113
|
-
syncInProgressBadge={<SyncLayoutBadge />}
|
|
114
114
|
actionsGroup={
|
|
115
115
|
<ActionIconGroup className={css.actionIconGroup} orientation="vertical">
|
|
116
116
|
{enableVscode && (
|
|
@@ -151,13 +151,3 @@ export const Controls = memo(() => {
|
|
|
151
151
|
</>
|
|
152
152
|
)
|
|
153
153
|
})
|
|
154
|
-
|
|
155
|
-
const SyncLayoutBadge = () => {
|
|
156
|
-
const isPending = useDiagramSyncLayoutState(s => s.hasTag('pending'))
|
|
157
|
-
if (!isPending) return null
|
|
158
|
-
return (
|
|
159
|
-
<Badge color="pink" radius={'xs'} size="xs" variant="light" leftSection={<Loader color={'orange'} size={8} />}>
|
|
160
|
-
Pending...
|
|
161
|
-
</Badge>
|
|
162
|
-
)
|
|
163
|
-
}
|
|
@@ -19,6 +19,7 @@ export const NavigationButtons = () => {
|
|
|
19
19
|
<AnimatePresence>
|
|
20
20
|
{hasStepBack && (
|
|
21
21
|
<ActionIcon
|
|
22
|
+
variant="subtle"
|
|
22
23
|
component={m.button}
|
|
23
24
|
onClick={e => {
|
|
24
25
|
e.stopPropagation()
|
|
@@ -38,6 +39,7 @@ export const NavigationButtons = () => {
|
|
|
38
39
|
)}
|
|
39
40
|
{hasStepForward && (
|
|
40
41
|
<ActionIcon
|
|
42
|
+
variant="subtle"
|
|
41
43
|
component={m.button}
|
|
42
44
|
layout
|
|
43
45
|
initial={{ opacity: 0.05, transform: 'translateX(10px)' }}
|
|
@@ -7,25 +7,28 @@ import { AnimatePresence, m } from 'motion/react'
|
|
|
7
7
|
import { MarkdownBlock } from '../../../base/primitives'
|
|
8
8
|
import { Link } from '../../../components/Link'
|
|
9
9
|
import { useDiagramContext } from '../../../hooks/useDiagram'
|
|
10
|
+
import { useCurrentViewModel } from '../../../likec4model'
|
|
10
11
|
import type { DiagramContext } from '../../../state/types'
|
|
11
12
|
import * as styles from './DiagramTitlePanel.css'
|
|
12
13
|
|
|
13
14
|
function selector(context: DiagramContext) {
|
|
14
15
|
return {
|
|
15
|
-
id: context.view.id,
|
|
16
|
-
title: context.view.title ?? 'untitled',
|
|
17
|
-
description: RichText.from(context.view.description),
|
|
18
|
-
links: context.view.links,
|
|
16
|
+
// id: context.view.id,
|
|
17
|
+
// title: context.view.title ?? 'untitled',
|
|
18
|
+
// description: RichText.from(context.view.description),
|
|
19
|
+
// links: context.view.links,
|
|
19
20
|
isNotActiveWalkthrough: context.activeWalkthrough === null,
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export function DiagramTitlePanel() {
|
|
24
|
-
const
|
|
25
|
+
const view = useCurrentViewModel()
|
|
26
|
+
const { isNotActiveWalkthrough } = useDiagramContext(selector)
|
|
25
27
|
const [isCollapsed, setCollapsed] = useLocalStorage({
|
|
26
28
|
key: 'diagram-title-webview-collapsed',
|
|
27
29
|
defaultValue: false,
|
|
28
30
|
})
|
|
31
|
+
const title = view.title ?? 'untitled'
|
|
29
32
|
const toggle = () => setCollapsed(v => !v)
|
|
30
33
|
|
|
31
34
|
return (
|
|
@@ -124,10 +127,10 @@ export function DiagramTitlePanel() {
|
|
|
124
127
|
userSelect: 'all',
|
|
125
128
|
}}>
|
|
126
129
|
<span style={{ userSelect: 'none' }}>id:{' '}</span>
|
|
127
|
-
{id}
|
|
130
|
+
{view.id}
|
|
128
131
|
</Text>
|
|
129
132
|
</Group>
|
|
130
|
-
{description.nonEmpty && (
|
|
133
|
+
{view.description.nonEmpty && (
|
|
131
134
|
<Spoiler
|
|
132
135
|
maxHeight={60}
|
|
133
136
|
showLabel={
|
|
@@ -143,10 +146,10 @@ export function DiagramTitlePanel() {
|
|
|
143
146
|
<MarkdownBlock
|
|
144
147
|
className={styles.description}
|
|
145
148
|
textScale={0.9}
|
|
146
|
-
value={description} />
|
|
149
|
+
value={view.description} />
|
|
147
150
|
</Spoiler>
|
|
148
151
|
)}
|
|
149
|
-
{description.isEmpty && (
|
|
152
|
+
{view.description.isEmpty && (
|
|
150
153
|
<Text
|
|
151
154
|
component={'div'}
|
|
152
155
|
size="xs"
|
|
@@ -154,13 +157,13 @@ export function DiagramTitlePanel() {
|
|
|
154
157
|
no description
|
|
155
158
|
</Text>
|
|
156
159
|
)}
|
|
157
|
-
{links && (
|
|
160
|
+
{view.links.length > 0 && (
|
|
158
161
|
<Stack
|
|
159
162
|
mt={'xs'}
|
|
160
163
|
gap={4}
|
|
161
164
|
justify="stretch"
|
|
162
165
|
align="stretch">
|
|
163
|
-
{links.map((link) => <Link value={link} key={link.url} />)}
|
|
166
|
+
{view.links.map((link) => <Link value={link} key={link.url} />)}
|
|
164
167
|
</Stack>
|
|
165
168
|
)}
|
|
166
169
|
</>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { LikeC4Model } from '@likec4/core/model'
|
|
1
|
+
import type { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model'
|
|
2
|
+
import type { aux, DiagramView } from '@likec4/core/types'
|
|
2
3
|
import { createContext } from 'react'
|
|
3
4
|
|
|
4
5
|
export const LikeC4ModelContext = createContext<LikeC4Model<any> | null>(null)
|
|
6
|
+
|
|
7
|
+
export type CurrentViewModel = LikeC4ViewModel<aux.UnknownLayouted, DiagramView<aux.UnknownLayouted>>
|
|
8
|
+
export const CurrentViewModelContext = createContext<CurrentViewModel | null>(null)
|
package/src/likec4model/index.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from 'react'
|
|
2
|
+
import { type CurrentViewModel, CurrentViewModelContext } from './LikeC4ModelContext'
|
|
3
|
+
|
|
4
|
+
export function useCurrentViewModel(): CurrentViewModel {
|
|
5
|
+
const vm = useContext(CurrentViewModelContext)
|
|
6
|
+
if (!vm) {
|
|
7
|
+
throw new Error('No LikeC4ViewModel in context found')
|
|
8
|
+
}
|
|
9
|
+
return vm
|
|
10
|
+
}
|