@likec4/diagram 1.48.0 → 1.50.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/README.md +7 -9
- package/adhoc-editor/package.json +4 -0
- package/dist/LikeC4Diagram.d.ts +2 -1
- package/dist/LikeC4Diagram.js +77 -79
- package/dist/LikeC4Diagram.props.d.ts +9 -1
- package/dist/LikeC4ModelProvider.d.ts +4 -4
- package/dist/LikeC4ModelProvider.js +2 -2
- package/dist/LikeC4ProjectsOverview.d.ts +3 -2
- package/dist/LikeC4ProjectsProvider.d.ts +2 -1
- package/dist/LikeC4ProjectsProvider.js +4 -4
- package/dist/LikeC4Styles.d.ts +2 -1
- package/dist/LikeC4View.d.ts +14 -1
- package/dist/LikeC4View.js +31 -18
- package/dist/ReactLikeC4.d.ts +2 -1
- package/dist/ReactLikeC4.js +3 -1
- package/dist/StaticLikeC4Diagram.d.ts +2 -1
- package/dist/StaticLikeC4Diagram.js +1 -0
- package/dist/_virtual/store-1b2fbb72.cjs.js +3 -0
- package/dist/_virtual/xstate-store-react.cjs.js +5 -0
- package/dist/_virtual/xstate-store-react.cjs2.js +3 -0
- package/dist/adhoc-editor/EditorPanel.d.ts +1 -0
- package/dist/adhoc-editor/EditorPanel.js +105 -0
- package/dist/adhoc-editor/ElementsTree.d.ts +2 -0
- package/dist/adhoc-editor/ElementsTree.js +142 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +1 -1
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +46 -43
- package/dist/adhoc-editor/components/Tree.d.ts +48 -0
- package/dist/adhoc-editor/components/Tree.js +296 -0
- package/dist/adhoc-editor/hooks.d.ts +3 -3
- package/dist/adhoc-editor/hooks.js +5 -23
- package/dist/adhoc-editor/index.d.ts +1 -1
- package/dist/adhoc-editor/index.js +1 -0
- package/dist/adhoc-editor/{ActorProvider.d.ts → state/ActorProvider.d.ts} +1 -3
- package/dist/adhoc-editor/{ActorProvider.js → state/ActorProvider.js} +10 -11
- package/dist/adhoc-editor/state/actor.d.ts +13 -0
- package/dist/adhoc-editor/{actor.editor.d.ts → state/actor.editor.d.ts} +6 -4
- package/dist/adhoc-editor/state/actor.editor.js +205 -0
- package/dist/adhoc-editor/{actor.js → state/actor.js} +2 -6
- package/dist/adhoc-editor/{actor.layouter.d.ts → state/actor.layouter.d.ts} +7 -4
- package/dist/adhoc-editor/{actor.layouter.js → state/actor.layouter.js} +17 -13
- package/dist/adhoc-editor/{actor.types.d.ts → state/actor.types.d.ts} +12 -6
- package/dist/adhoc-editor/{actor.types.js → state/actor.types.js} +8 -1
- package/dist/adhoc-editor/state/panel.d.ts +95 -0
- package/dist/adhoc-editor/state/panel.js +139 -0
- package/dist/adhoc-editor/state/utils.d.ts +17 -0
- package/dist/adhoc-editor/state/utils.js +32 -0
- package/dist/adhoc-editor/useElementsTree.d.ts +18 -0
- package/dist/adhoc-editor/useElementsTree.js +130 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +1 -1
- package/dist/base/const.d.ts +1 -0
- package/dist/base-primitives/compound/CompoundActionButton.js +26 -12
- package/dist/base-primitives/compound/CompoundDetailsButton.js +22 -9
- package/dist/base-primitives/compound/CompoundNodeContainer.js +5 -4
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeLabel.js +3 -4
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +2 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +12 -19
- package/dist/base-primitives/edge/EdgeMarkers.js +3 -3
- package/dist/base-primitives/element/ElementActionButtons.js +35 -10
- package/dist/base-primitives/element/ElementDetailsButton.js +47 -18
- package/dist/base-primitives/element/ElementNodeContainer.d.ts +3 -3
- package/dist/base-primitives/element/ElementNodeContainer.js +23 -10
- package/dist/base-primitives/element/ElementShape.d.ts +4 -4
- package/dist/base-primitives/element/ElementShape.js +71 -8
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/Link.js +3 -3
- package/dist/components/Logo.js +1 -1
- package/dist/components/NavigationPanel.js +2 -4
- package/dist/components/PortalToContainer.js +3 -4
- package/dist/components/RootContainer.js +9 -16
- package/dist/components/ViewNotFound.d.ts +3 -3
- package/dist/components/ViewNotFound.js +30 -26
- package/dist/context/CurrentViewModelProvider.d.ts +2 -0
- package/dist/context/CurrentViewModelProvider.js +12 -0
- package/dist/context/DefaultMantineProvider.d.ts +1 -1
- package/dist/context/DefaultMantineProvider.js +10 -1
- package/dist/context/DiagramEventHandlers.d.ts +5 -5
- package/dist/context/DiagramEventHandlers.js +10 -4
- package/dist/context/DiagramFeatures.d.ts +8 -7
- package/dist/context/DiagramFeatures.js +5 -3
- package/dist/context/FramerMotionConfig.d.ts +1 -3
- package/dist/context/IconRenderer.d.ts +5 -4
- package/dist/context/IconRenderer.js +51 -24
- package/dist/context/LikeC4ModelContext.d.ts +10 -5
- package/dist/context/LikeC4ModelContext.js +11 -3
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/LikeC4ProjectsContext.js +6 -2
- package/dist/context/RootContainerContext.d.ts +10 -3
- package/dist/context/RootContainerContext.js +8 -3
- package/dist/context/TagStylesContext.js +1 -1
- package/dist/custom/index.js +16 -15
- package/dist/editor/LikeC4EditorProvider.js +1 -1
- package/dist/editor/applyChangesToManualLayout.js +7 -7
- package/dist/editor/editorActor.actions.js +20 -20
- package/dist/editor/editorActor.setup.js +1 -1
- package/dist/editor/editorActor.states.js +0 -9
- package/dist/editor/useEditorActorLogic.d.ts +1 -2
- package/dist/editor/useEditorActorLogic.js +8 -11
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/safeContext.d.ts +4 -5
- package/dist/hooks/useCallbackRef.js +7 -6
- package/dist/hooks/useCurrentView.js +5 -10
- package/dist/hooks/useCurrentViewModel.d.ts +2 -6
- package/dist/hooks/useCurrentViewModel.js +3 -7
- package/dist/hooks/useDiagram.d.ts +9 -1
- package/dist/hooks/useDiagram.js +8 -2
- package/dist/hooks/useDiagramCompareLayout.d.ts +5 -5
- package/dist/hooks/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +1 -1
- package/dist/hooks/useLikeC4Model.d.ts +6 -2
- package/dist/hooks/useLikeC4Model.js +7 -9
- package/dist/hooks/useLikeC4Project.d.ts +4 -6
- package/dist/hooks/useLikeC4Project.js +19 -31
- package/dist/hooks/useLikeC4Styles.js +3 -9
- package/dist/hooks/useMantinePortalProps.d.ts +1 -1
- package/dist/hooks/useMediaPrint.d.ts +0 -2
- package/dist/hooks/useOverlaysActor.js +4 -4
- package/dist/hooks/useSearchActor.js +4 -4
- package/dist/index.d.ts +1 -3
- package/dist/index.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -1
- package/dist/likec4diagram/DiagramXYFlow.js +5 -7
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +22 -24
- package/dist/likec4diagram/custom/edges/edges.css.js +2 -1
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +40 -55
- package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +3 -20
- package/dist/likec4diagram/custom/nodes/NodeNotes.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +286 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -2
- package/dist/likec4diagram/custom/nodes/nodes.js +5 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +12 -8
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -28
- package/dist/likec4diagram/state/DiagramActorProvider.js +30 -56
- package/dist/likec4diagram/state/diagram-api.d.ts +11 -0
- package/dist/likec4diagram/state/diagram-api.js +15 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +27 -0
- package/dist/likec4diagram/state/machine.actions.js +78 -21
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +38 -3
- package/dist/likec4diagram/state/machine.js +4 -1
- package/dist/likec4diagram/state/machine.setup.d.ts +19 -2
- package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
- package/dist/likec4diagram/state/machine.state.ready.d.ts +61 -1
- package/dist/likec4diagram/state/machine.state.ready.js +11 -3
- package/dist/likec4diagram/state/utils.d.ts +2 -1
- package/dist/likec4diagram/state/utils.js +1 -1
- package/dist/likec4diagram/types.d.ts +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.d.ts +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +6 -29
- package/dist/likec4diagram/useLayoutConstraints.d.ts +12 -12
- package/dist/likec4diagram/useLayoutConstraints.js +125 -86
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +2 -0
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +7 -2
- package/dist/navigationpanel/NavigationPanel.js +2 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +13 -13
- package/dist/navigationpanel/_common.js +2 -2
- package/dist/navigationpanel/actor.js +1 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
- package/dist/navigationpanel/comparepanel/ComparePanel.js +155 -29
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +264 -0
- package/dist/navigationpanel/controls/DetailsControls.js +4 -4
- package/dist/navigationpanel/controls/LayoutWarning.js +1 -1
- package/dist/navigationpanel/controls/LogoButton.js +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/SearchControl.js +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
- package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -6
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +16 -16
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +1 -1
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/dist/store-1b2fbb72.cjs.js +742 -0
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/react/dist/xstate-store-react.cjs.js +175 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +11 -11
- package/dist/overlays/element-details/ElementDetailsCard.js +44 -45
- package/dist/overlays/element-details/MetadataValue.js +7 -7
- package/dist/overlays/element-details/TabPanelDeployments.js +4 -4
- package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -5
- package/dist/overlays/element-details/TabPanelRelationships.js +4 -5
- package/dist/overlays/element-details/TabPanelStructure.css.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actorContext.d.ts +1 -1
- package/dist/overlays/overlaysActor.js +1 -1
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
- package/dist/overlays/relationship-details/SelectEdge.css.js +4 -4
- 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 +6 -6
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.js +1 -1
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +1 -1
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -1
- package/dist/projects-overview/ProjectsOverview.js +2 -2
- package/dist/projects-overview/ProjectsOverviewXY.d.ts +1 -5
- package/dist/projects-overview/ProjectsOverviewXY.js +1 -1
- package/dist/projects-overview/actor.d.ts +1 -1
- package/dist/projects-overview/context.d.ts +2 -2
- package/dist/projects-overview/context.js +2 -1
- package/dist/projects-overview/custom/nodeTypes.js +1 -1
- package/dist/search/Search.d.ts +2 -1
- package/dist/search/Search.js +108 -87
- package/dist/search/components/ElementsColumn.css.js +3 -3
- package/dist/search/components/ElementsColumn.js +93 -59
- package/dist/search/components/PickView.js +8 -4
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +2 -2
- package/dist/search/components/ViewsColum.d.ts +2 -1
- package/dist/search/components/ViewsColum.js +39 -35
- package/dist/search/components/ViewsColumn.css.js +1 -1
- package/dist/search/components/_shared.css.js +11 -11
- package/dist/search/components/utils.js +1 -4
- package/dist/search/hooks.js +4 -1
- package/dist/search/searchActor.d.ts +12 -2
- package/dist/search/searchActor.js +60 -4
- package/dist/shadowroot/ShadowRoot.d.ts +5 -2
- package/dist/shadowroot/ShadowRoot.js +7 -5
- package/dist/shadowroot/styles.css.js +3 -2
- package/dist/styles.css2.js +1 -1
- package/dist/utils/view-bounds.d.ts +3 -2
- package/dist/utils/view-bounds.js +1 -1
- package/dist/utils/xyflow.d.ts +10 -5
- package/dist/utils/xyflow.js +24 -22
- package/package.json +33 -32
- package/panda.buildinfo.json +176 -87
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/bundle/index.js +0 -52554
- package/bundle/package.json +0 -4
- package/dist/adhoc-editor/EditorNavigationPanel.d.ts +0 -1
- package/dist/adhoc-editor/EditorNavigationPanel.js +0 -32
- package/dist/adhoc-editor/SelectElementOverlay.d.ts +0 -1
- package/dist/adhoc-editor/SelectElementOverlay.js +0 -124
- package/dist/adhoc-editor/actor.d.ts +0 -131
- package/dist/adhoc-editor/actor.editor.js +0 -96
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +0 -104
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { invariant, nonNullable } from '@likec4/core';
|
|
2
|
-
import { BBox, vector } from '@likec4/core/geometry';
|
|
2
|
+
import { BBox, convertPoint, vector } from '@likec4/core/geometry';
|
|
3
3
|
import { setAutoFreeze, produce, castDraft } from 'immer';
|
|
4
|
-
import { isNullish } from 'remeda';
|
|
4
|
+
import { map, isNullish } from 'remeda';
|
|
5
5
|
|
|
6
6
|
function applyChangesToManualLayout(manualView, latestView) {
|
|
7
7
|
try {
|
|
@@ -144,7 +144,7 @@ function makeAsStraightLine(edge, sourceNode, targetNode) {
|
|
|
144
144
|
const controlPoints = edgeControlPoints(sourceNode, targetNode);
|
|
145
145
|
const labelPos = controlPoints[0];
|
|
146
146
|
return produce(edge, (draft) => {
|
|
147
|
-
draft.points =
|
|
147
|
+
draft.points = castDraft(map(controlPoints, convertPoint));
|
|
148
148
|
draft.controlPoints = controlPoints;
|
|
149
149
|
if (edge.labelBBox) {
|
|
150
150
|
draft.labelBBox.x = labelPos.x;
|
|
@@ -166,8 +166,8 @@ function edgeControlPoints(source, target) {
|
|
|
166
166
|
const loopSize = 80;
|
|
167
167
|
const centerOfTopBoundary = vector(0, source.height || 0).multiply(-0.5).add(sourceCenter);
|
|
168
168
|
return [
|
|
169
|
-
centerOfTopBoundary.add(vector(-loopSize / 2.5, -loopSize)).
|
|
170
|
-
centerOfTopBoundary.add(vector(loopSize / 2.5, -loopSize)).
|
|
169
|
+
centerOfTopBoundary.add(vector(-loopSize / 2.5, -loopSize)).trunc().toObject(),
|
|
170
|
+
centerOfTopBoundary.add(vector(loopSize / 2.5, -loopSize)).trunc().toObject()
|
|
171
171
|
];
|
|
172
172
|
}
|
|
173
173
|
const sourceToTargetVector = targetCenter.subtract(sourceCenter);
|
|
@@ -175,8 +175,8 @@ function edgeControlPoints(source, target) {
|
|
|
175
175
|
const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.multiply(-1));
|
|
176
176
|
const sourceToTarget = targetBorderPoint.subtract(sourceBorderPoint);
|
|
177
177
|
return [
|
|
178
|
-
sourceBorderPoint.add(sourceToTarget.multiply(0.4)).
|
|
179
|
-
sourceBorderPoint.add(sourceToTarget.multiply(0.6)).
|
|
178
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.4)).trunc().toObject(),
|
|
179
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.6)).trunc().toObject()
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -2,7 +2,7 @@ import { last, filter, isNot, omit } from 'remeda';
|
|
|
2
2
|
import { createViewChange } from '../likec4diagram/state/createViewChange.js';
|
|
3
3
|
import { machine } from './editorActor.setup.js';
|
|
4
4
|
|
|
5
|
-
const diagramActorRef =
|
|
5
|
+
const diagramActorRef = (system) => {
|
|
6
6
|
return system.get("diagram");
|
|
7
7
|
};
|
|
8
8
|
const getDiagramContext = function(system) {
|
|
@@ -17,21 +17,17 @@ const saveStateBeforeEdit = () => machine.assign(({ system }) => {
|
|
|
17
17
|
const parentContext = getDiagramContext(system);
|
|
18
18
|
return {
|
|
19
19
|
beforeEditing: {
|
|
20
|
-
xynodes: parentContext.xynodes.map(
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...omit(e, ["selected"]),
|
|
32
|
-
data: omit(e.data, ["active", "dimmed", "hovered"])
|
|
33
|
-
})
|
|
34
|
-
),
|
|
20
|
+
xynodes: parentContext.xynodes.map(({ measured, data, ...n }) => ({
|
|
21
|
+
...omit(n, ["selected", "dragging", "resizing"]),
|
|
22
|
+
data: omit(data, ["dimmed", "hovered"]),
|
|
23
|
+
measured,
|
|
24
|
+
initialWidth: measured?.width ?? n.width ?? n.initialWidth,
|
|
25
|
+
initialHeight: measured?.height ?? n.height ?? n.initialHeight
|
|
26
|
+
})),
|
|
27
|
+
xyedges: parentContext.xyedges.map(({ data, ...e }) => ({
|
|
28
|
+
...omit(e, ["selected"]),
|
|
29
|
+
data: omit(data, ["active", "dimmed", "hovered"])
|
|
30
|
+
})),
|
|
35
31
|
change: createViewChange(parentContext),
|
|
36
32
|
view: parentContext.view,
|
|
37
33
|
synched: false
|
|
@@ -67,13 +63,17 @@ const pushHistory = () => machine.assign(({ context }) => {
|
|
|
67
63
|
editing: null
|
|
68
64
|
};
|
|
69
65
|
}
|
|
66
|
+
const history = [
|
|
67
|
+
...context.history,
|
|
68
|
+
snapshot
|
|
69
|
+
];
|
|
70
|
+
if (history.length > 50) {
|
|
71
|
+
history.shift();
|
|
72
|
+
}
|
|
70
73
|
return {
|
|
71
74
|
beforeEditing: null,
|
|
72
75
|
editing: null,
|
|
73
|
-
history
|
|
74
|
-
...context.history,
|
|
75
|
-
snapshot
|
|
76
|
-
]
|
|
76
|
+
history
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
79
|
const stopEditing = () => machine.enqueueActions(({ event, enqueue }) => {
|
|
@@ -87,15 +87,6 @@ const applyLatestToManual = machine.createStateConfig({
|
|
|
87
87
|
saveStateBeforeEdit()
|
|
88
88
|
],
|
|
89
89
|
initial: "call",
|
|
90
|
-
on: {
|
|
91
|
-
// catch all events
|
|
92
|
-
"*": {
|
|
93
|
-
actions: [
|
|
94
|
-
log(({ event }) => `applyLatestToManual received unexpected event: ${event.type}`),
|
|
95
|
-
reschedule(500)
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
90
|
states: {
|
|
100
91
|
// Fetch latest and manual layouts
|
|
101
92
|
// Apply changes, send update to diagram
|
|
@@ -5,16 +5,19 @@ import { editorActorLogic } from './editorActor.states.js';
|
|
|
5
5
|
import { useOptionalLikeC4Editor } from './LikeC4EditorProvider.js';
|
|
6
6
|
import { useCallbackRef } from '../hooks/useCallbackRef.js';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const promisify = (fn) => {
|
|
9
|
+
return Promise.resolve().then(() => fn());
|
|
10
|
+
};
|
|
11
|
+
function useEditorActorLogic() {
|
|
9
12
|
const port = useOptionalLikeC4Editor();
|
|
10
13
|
const applyLatest = useCallbackRef(
|
|
11
|
-
async ({ input: { viewId
|
|
14
|
+
async ({ input: { viewId, current } }) => {
|
|
12
15
|
if (!port) {
|
|
13
16
|
console.error("No editor port available for applying latest to manual layout");
|
|
14
17
|
return Promise.reject(new Error("No editor port"));
|
|
15
18
|
}
|
|
16
|
-
const manual = await
|
|
17
|
-
const latest = await
|
|
19
|
+
const manual = await promisify(() => current ?? port.fetchView(viewId, "manual"));
|
|
20
|
+
const latest = await promisify(() => port.fetchView(viewId, "auto"));
|
|
18
21
|
const updated = applyChangesToManualLayout(manual, latest);
|
|
19
22
|
return {
|
|
20
23
|
updated
|
|
@@ -28,13 +31,7 @@ function useEditorActorLogic(viewId) {
|
|
|
28
31
|
return Promise.reject(new Error("No editor port"));
|
|
29
32
|
}
|
|
30
33
|
for (const change of input.changes) {
|
|
31
|
-
await
|
|
32
|
-
console.error("Failed to execute change", {
|
|
33
|
-
change,
|
|
34
|
-
err
|
|
35
|
-
});
|
|
36
|
-
return Promise.reject(err);
|
|
37
|
-
});
|
|
34
|
+
await promisify(() => port.handleChange(input.viewId, change));
|
|
38
35
|
}
|
|
39
36
|
return {};
|
|
40
37
|
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { useCurrentZoom, useCurrentZoomAtLeast, useIsZoomTooSmall, useXYFlow, us
|
|
|
8
8
|
export type { XYFlowInstance, XYStoreApi, XYStoreState } from './useXYFlow';
|
|
9
9
|
export { useCurrentView, useCurrentViewId } from './useCurrentView';
|
|
10
10
|
export { useCurrentViewModel } from './useCurrentViewModel';
|
|
11
|
-
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './useLikeC4Model';
|
|
12
|
-
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './useLikeC4Project';
|
|
11
|
+
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, useOptionalLikeC4Model, } from './useLikeC4Model';
|
|
12
|
+
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './useLikeC4Project';
|
|
13
13
|
export { useLikeC4Styles } from './useLikeC4Styles';
|
|
14
14
|
export * from './useDiagram';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { DiagramActorRef } from '../custom';
|
|
2
|
-
import { DiagramApi } from '../likec4diagram/state/diagram-api';
|
|
3
1
|
import { Provider } from 'react';
|
|
4
|
-
import {
|
|
2
|
+
import { DiagramApi } from '../likec4diagram/state/diagram-api';
|
|
3
|
+
import { DiagramActorRef } from '../likec4diagram/state/types';
|
|
5
4
|
export declare const DiagramActorContextProvider: Provider<DiagramActorRef>;
|
|
6
|
-
export declare const DiagramApiContextProvider: Provider<DiagramApi
|
|
5
|
+
export declare const DiagramApiContextProvider: Provider<DiagramApi>;
|
|
7
6
|
export declare function useDiagramActorRef(): DiagramActorRef;
|
|
8
|
-
export declare function useDiagram(): DiagramApi
|
|
7
|
+
export declare function useDiagram(): DiagramApi;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
1
|
+
import { useRef, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
function useCallbackRef(callback) {
|
|
4
4
|
const ref = useRef(callback);
|
|
5
5
|
ref.current = callback;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
function callbackRef(...args) {
|
|
8
|
+
return ref.current?.(...args);
|
|
9
|
+
}
|
|
10
|
+
return callbackRef;
|
|
11
|
+
}, []);
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export { useCallbackRef };
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { shallowEqual } from 'fast-equals';
|
|
3
|
-
import 'react';
|
|
4
|
-
import { useDiagramActorRef } from './safeContext.js';
|
|
1
|
+
import { useDiagramSnapshot, selectDiagramActor } from './useDiagram.js';
|
|
5
2
|
|
|
6
|
-
const selectViewId = (s) => s.context.view.id;
|
|
3
|
+
const selectViewId = selectDiagramActor((s) => s.context.view.id);
|
|
7
4
|
function useCurrentViewId() {
|
|
8
|
-
|
|
9
|
-
return useSelector(actorRef, selectViewId);
|
|
5
|
+
return useDiagramSnapshot(selectViewId);
|
|
10
6
|
}
|
|
11
|
-
const selectView = (s) => s.context.view;
|
|
7
|
+
const selectView = selectDiagramActor((s) => s.context.view);
|
|
12
8
|
function useCurrentView() {
|
|
13
|
-
|
|
14
|
-
return useSelector(actorRef, selectView, shallowEqual);
|
|
9
|
+
return useDiagramSnapshot(selectView);
|
|
15
10
|
}
|
|
16
11
|
|
|
17
12
|
export { useCurrentView, useCurrentViewId };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { CurrentViewModel } from '../context/LikeC4ModelContext';
|
|
1
|
+
import { CurrentViewModel, useOptionalCurrentViewModel } from '../context/LikeC4ModelContext';
|
|
2
2
|
export type { CurrentViewModel };
|
|
3
|
-
|
|
4
|
-
* Returns the current view model from the context, or null if no view model is found.
|
|
5
|
-
* @see useCurrentViewModel
|
|
6
|
-
*/
|
|
7
|
-
export declare function useOptionalCurrentViewModel(): CurrentViewModel | null;
|
|
3
|
+
export { useOptionalCurrentViewModel, };
|
|
8
4
|
/**
|
|
9
5
|
* Hook to get the current view model from the context.
|
|
10
6
|
* Throws an error if no view model is found in the context.
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CurrentViewModelContext } from '../context/LikeC4ModelContext.js';
|
|
1
|
+
import { useOptionalCurrentViewModel } from '../context/LikeC4ModelContext.js';
|
|
3
2
|
|
|
4
|
-
function useOptionalCurrentViewModel() {
|
|
5
|
-
return useContext(CurrentViewModelContext);
|
|
6
|
-
}
|
|
7
3
|
function useCurrentViewModel() {
|
|
8
|
-
const vm =
|
|
4
|
+
const vm = useOptionalCurrentViewModel();
|
|
9
5
|
if (!vm) {
|
|
10
|
-
throw new Error("No
|
|
6
|
+
throw new Error("No CurrentViewModelContext found");
|
|
11
7
|
}
|
|
12
8
|
return vm;
|
|
13
9
|
}
|
|
@@ -4,7 +4,15 @@ import { DiagramActorSnapshot, DiagramContext, DiagramEmittedEvents } from '../l
|
|
|
4
4
|
import { useDiagram, useDiagramActorRef } from './safeContext';
|
|
5
5
|
export { useDiagram, useDiagramActorRef };
|
|
6
6
|
export type { DiagramApi, DiagramContext };
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Helper to create a selector for diagram actor snapshot
|
|
9
|
+
*/
|
|
10
|
+
export declare function selectDiagramActor<T = unknown>(selector: (state: DiagramActorSnapshot) => T): (state: DiagramActorSnapshot) => T;
|
|
11
|
+
export declare function useDiagramSnapshot<T = unknown>(selector: (state: DiagramActorSnapshot) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean): T;
|
|
12
|
+
/**
|
|
13
|
+
* Helper to create a selector for diagram actor snapshot
|
|
14
|
+
*/
|
|
15
|
+
export declare function selectDiagramActorContext<T = unknown>(selector: (state: DiagramContext) => T): (state: DiagramActorSnapshot) => T;
|
|
8
16
|
/**
|
|
9
17
|
* Read diagram context
|
|
10
18
|
*/
|
package/dist/hooks/useDiagram.js
CHANGED
|
@@ -5,10 +5,16 @@ import { useDiagramActorRef } from './safeContext.js';
|
|
|
5
5
|
export { useDiagram } from './safeContext.js';
|
|
6
6
|
import { useCallbackRef } from './useCallbackRef.js';
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function selectDiagramActor(selector) {
|
|
9
|
+
return selector;
|
|
10
|
+
}
|
|
11
|
+
function useDiagramSnapshot(selector, compare = shallowEqual) {
|
|
9
12
|
const actorRef = useDiagramActorRef();
|
|
10
13
|
return useSelector(actorRef, selector, compare);
|
|
11
14
|
}
|
|
15
|
+
function selectDiagramActorContext(selector) {
|
|
16
|
+
return (state) => selector(state.context);
|
|
17
|
+
}
|
|
12
18
|
function useDiagramContext(selector, compare = shallowEqual, deps = []) {
|
|
13
19
|
const actorRef = useDiagramActorRef();
|
|
14
20
|
const selectorRef = useCallbackRef(selector);
|
|
@@ -38,4 +44,4 @@ function useOnDiagramEvent(event, callback, options) {
|
|
|
38
44
|
}, [actorRef, event, once]);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
export {
|
|
47
|
+
export { selectDiagramActor, selectDiagramActorContext, useDiagramActorRef, useDiagramContext, useDiagramSnapshot, useOnDiagramEvent };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { DiagramActorSnapshot } from '../likec4diagram/state/types';
|
|
2
2
|
import type * as t from '@likec4/core/types';
|
|
3
3
|
declare const selectCompareLayoutState: ({ context }: DiagramActorSnapshot) => {
|
|
4
|
-
hasEditor: false;
|
|
5
4
|
isEnabled: false;
|
|
5
|
+
hasEditor: false;
|
|
6
6
|
isEditable: false;
|
|
7
7
|
isActive: false;
|
|
8
8
|
drifts: never;
|
|
9
9
|
canApplyLatest: boolean;
|
|
10
10
|
layout: t.LayoutType;
|
|
11
11
|
} | {
|
|
12
|
-
hasEditor: boolean;
|
|
13
12
|
isEnabled: true;
|
|
13
|
+
hasEditor: boolean;
|
|
14
14
|
isEditable: boolean;
|
|
15
15
|
isActive: boolean;
|
|
16
|
-
drifts: t.
|
|
16
|
+
drifts: readonly [t.LayoutedViewDriftReason, ...t.LayoutedViewDriftReason[]];
|
|
17
17
|
canApplyLatest: boolean;
|
|
18
18
|
layout: t.LayoutType;
|
|
19
19
|
};
|
|
20
|
-
type DiagramCompareLayoutState = ReturnType<typeof selectCompareLayoutState>;
|
|
21
|
-
type DiagramCompareLayoutOps = {
|
|
20
|
+
export type DiagramCompareLayoutState = ReturnType<typeof selectCompareLayoutState>;
|
|
21
|
+
export type DiagramCompareLayoutOps = {
|
|
22
22
|
/**
|
|
23
23
|
* Toggles the compare mode on or off.
|
|
24
24
|
*/
|
|
@@ -4,7 +4,7 @@ interface LikeC4ModelTreeNodeData {
|
|
|
4
4
|
value: Fqn;
|
|
5
5
|
children: LikeC4ModelTreeNodeData[];
|
|
6
6
|
}
|
|
7
|
-
export declare const sortByLabel: (a: LikeC4ModelTreeNodeData, b: LikeC4ModelTreeNodeData) =>
|
|
7
|
+
export declare const sortByLabel: (a: LikeC4ModelTreeNodeData, b: LikeC4ModelTreeNodeData) => number;
|
|
8
8
|
/**
|
|
9
9
|
* Returns a tree of elements in the model.
|
|
10
10
|
* If `viewId` is provided, returns the tree of elements in the view.
|
|
@@ -5,7 +5,7 @@ import { useLikeC4Model } from './useLikeC4Model.js';
|
|
|
5
5
|
const sortByLabel = (a, b) => compareNatural(a.label, b.label);
|
|
6
6
|
function buildNode(element) {
|
|
7
7
|
return {
|
|
8
|
-
label: element.title,
|
|
8
|
+
label: element.title || element.id,
|
|
9
9
|
value: element.id,
|
|
10
10
|
children: [...element.children()].map(buildNode).sort(sortByLabel)
|
|
11
11
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
|
|
2
|
+
import { useOptionalLikeC4Model } from '../context/LikeC4ModelContext';
|
|
2
3
|
import type * as t from '@likec4/core/types';
|
|
3
4
|
type Any = t.aux.Any;
|
|
4
|
-
export
|
|
5
|
+
export { useOptionalLikeC4Model, };
|
|
6
|
+
/**
|
|
7
|
+
* @returns The LikeC4Model from context.
|
|
8
|
+
* @throws If no LikeC4ModelProvider is found.
|
|
9
|
+
*/
|
|
5
10
|
export declare function useLikeC4Model<A extends Any = t.aux.UnknownLayouted>(): LikeC4Model<A>;
|
|
6
11
|
export declare function useLikeC4ViewModel<A extends Any = t.aux.UnknownLayouted>(viewId: t.aux.ViewId<A>): LikeC4ViewModel<A>;
|
|
7
12
|
export declare function useLikeC4Specification(): t.Specification<t.aux.UnknownLayouted>;
|
|
8
|
-
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { deepEqual } from 'fast-equals';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { useOptionalLikeC4Model } from '../context/LikeC4ModelContext.js';
|
|
4
4
|
|
|
5
|
-
function useOptionalLikeC4Model() {
|
|
6
|
-
return useContext(LikeC4ModelContext);
|
|
7
|
-
}
|
|
8
5
|
function useLikeC4Model() {
|
|
9
|
-
const model =
|
|
6
|
+
const model = useOptionalLikeC4Model();
|
|
10
7
|
if (!model) {
|
|
11
8
|
throw new Error("LikeC4Model not found. Make sure you have LikeC4ModelProvider.");
|
|
12
9
|
}
|
|
@@ -18,10 +15,11 @@ function useLikeC4ViewModel(viewId) {
|
|
|
18
15
|
}
|
|
19
16
|
function useLikeC4Specification() {
|
|
20
17
|
const model = useLikeC4Model();
|
|
21
|
-
const
|
|
18
|
+
const _specification = model.specification;
|
|
19
|
+
const [specification, setSpecification] = useState(_specification);
|
|
22
20
|
useEffect(() => {
|
|
23
|
-
setSpecification((current) => deepEqual(current,
|
|
24
|
-
}, [
|
|
21
|
+
setSpecification((current) => deepEqual(current, _specification) ? current : _specification);
|
|
22
|
+
}, [_specification]);
|
|
25
23
|
return specification;
|
|
26
24
|
}
|
|
27
25
|
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { LikeC4Project, ProjectId } from '@likec4/core/types';
|
|
2
2
|
import { LikeC4ProjectsContext } from '../context/LikeC4ProjectsContext';
|
|
3
|
+
export declare function useLikeC4ProjectsContext(): LikeC4ProjectsContext;
|
|
3
4
|
/**
|
|
4
5
|
* @returns The list of available projects, or empty array if no projects are available.
|
|
5
6
|
*/
|
|
6
7
|
export declare function useLikeC4Projects(): ReadonlyArray<LikeC4Project>;
|
|
7
8
|
/**
|
|
8
|
-
* @returns The callback to change current project.
|
|
9
|
+
* @returns The callback to change current project, or a no-op if no LikeC4ProjectsProvider is found.
|
|
9
10
|
*/
|
|
10
11
|
export declare function useChangeLikeC4Project(): (id: ProjectId) => void;
|
|
11
|
-
/**
|
|
12
|
-
* @returns The callback to change current project.
|
|
13
|
-
*/
|
|
14
|
-
export declare function useLikeC4ProjectsContext(): LikeC4ProjectsContext;
|
|
15
12
|
/**
|
|
16
13
|
* @returns True if there are more than one project available in the context.
|
|
17
14
|
*/
|
|
@@ -22,6 +19,7 @@ export declare function useHasProjects(): boolean;
|
|
|
22
19
|
export declare function useLikeC4ProjectId(): ProjectId;
|
|
23
20
|
/**
|
|
24
21
|
* Returns current LikeC4 project.
|
|
25
|
-
* Requires
|
|
22
|
+
* Requires LikeC4ModelProvider in the tree.
|
|
23
|
+
* Falls back to model's project if LikeC4ProjectsProvider is not available.
|
|
26
24
|
*/
|
|
27
25
|
export declare function useLikeC4Project(): LikeC4Project;
|
|
@@ -1,57 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { LikeC4ProjectsContext } from '../context/LikeC4ProjectsContext.js';
|
|
1
|
+
import { useOptionalLikeC4Model } from '../context/LikeC4ModelContext.js';
|
|
2
|
+
import { useOptionalProjectsContext } from '../context/LikeC4ProjectsContext.js';
|
|
4
3
|
|
|
5
4
|
const emptyProjects = [];
|
|
6
|
-
function
|
|
7
|
-
const ctx = useContext(LikeC4ProjectsContext);
|
|
8
|
-
if (!ctx) {
|
|
9
|
-
return emptyProjects;
|
|
10
|
-
}
|
|
11
|
-
return ctx.projects;
|
|
12
|
-
}
|
|
13
|
-
const emptyOnProjectChange = (id) => {
|
|
5
|
+
function onProjectChange(id) {
|
|
14
6
|
console.warn(`Triggered callback to change project to ${id}, but no <LikeC4ProjectsProvider/> found`);
|
|
15
|
-
};
|
|
16
|
-
function useChangeLikeC4Project() {
|
|
17
|
-
const ctx = useContext(LikeC4ProjectsContext);
|
|
18
|
-
if (!ctx) {
|
|
19
|
-
return emptyOnProjectChange;
|
|
20
|
-
}
|
|
21
|
-
return ctx.onProjectChange;
|
|
22
7
|
}
|
|
23
8
|
const emptyContext = {
|
|
24
9
|
projects: emptyProjects,
|
|
25
|
-
onProjectChange
|
|
10
|
+
onProjectChange
|
|
26
11
|
};
|
|
27
12
|
function useLikeC4ProjectsContext() {
|
|
28
|
-
return
|
|
13
|
+
return useOptionalProjectsContext() ?? emptyContext;
|
|
14
|
+
}
|
|
15
|
+
function useLikeC4Projects() {
|
|
16
|
+
return useLikeC4ProjectsContext().projects;
|
|
17
|
+
}
|
|
18
|
+
function useChangeLikeC4Project() {
|
|
19
|
+
return useLikeC4ProjectsContext().onProjectChange;
|
|
29
20
|
}
|
|
30
21
|
function useHasProjects() {
|
|
31
|
-
const ctx =
|
|
22
|
+
const ctx = useOptionalProjectsContext();
|
|
32
23
|
if (!ctx) {
|
|
33
24
|
return false;
|
|
34
25
|
}
|
|
35
26
|
return ctx.projects.length > 1;
|
|
36
27
|
}
|
|
37
28
|
function useLikeC4ProjectId() {
|
|
38
|
-
const ctx =
|
|
29
|
+
const ctx = useOptionalLikeC4Model();
|
|
39
30
|
if (!ctx) {
|
|
40
31
|
throw new Error("No LikeC4ModelProvider found");
|
|
41
32
|
}
|
|
42
33
|
return ctx.projectId;
|
|
43
34
|
}
|
|
44
35
|
function useLikeC4Project() {
|
|
45
|
-
const
|
|
46
|
-
const projectsCtx =
|
|
47
|
-
if (!
|
|
48
|
-
throw new Error("No
|
|
49
|
-
}
|
|
50
|
-
const project = projectsCtx.projects.find((p) => p.id === projectId);
|
|
51
|
-
if (!project) {
|
|
52
|
-
throw new Error(`Project with id '${projectId}' not found in LikeC4ProjectsProvider`);
|
|
36
|
+
const modelCtx = useOptionalLikeC4Model();
|
|
37
|
+
const projectsCtx = useOptionalProjectsContext();
|
|
38
|
+
if (!modelCtx) {
|
|
39
|
+
throw new Error("No LikeC4ModelProvider found");
|
|
53
40
|
}
|
|
54
|
-
|
|
41
|
+
const project = projectsCtx?.projects.find((p) => p.id === modelCtx.projectId);
|
|
42
|
+
return project ?? modelCtx.project;
|
|
55
43
|
}
|
|
56
44
|
|
|
57
45
|
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { LikeC4Styles } from '@likec4/core/styles';
|
|
2
|
-
import {
|
|
3
|
-
import { LikeC4ModelContext } from '../context/LikeC4ModelContext.js';
|
|
2
|
+
import { useOptionalLikeC4Model } from '../context/LikeC4ModelContext.js';
|
|
4
3
|
|
|
5
4
|
function useLikeC4Styles() {
|
|
6
|
-
const model =
|
|
7
|
-
|
|
8
|
-
const [styles, setStyles] = useState($styles);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
setStyles((current) => current.equals($styles) ? current : $styles);
|
|
11
|
-
}, [$styles]);
|
|
12
|
-
return styles;
|
|
5
|
+
const model = useOptionalLikeC4Model();
|
|
6
|
+
return model?.$styles ?? LikeC4Styles.DEFAULT;
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
export { useLikeC4Styles };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDiagramSnapshot, selectDiagramActor } from './useDiagram.js';
|
|
2
2
|
|
|
3
|
-
const select = (s) => {
|
|
3
|
+
const select = selectDiagramActor((s) => {
|
|
4
4
|
return s.children.overlays;
|
|
5
|
-
};
|
|
5
|
+
});
|
|
6
6
|
function useOverlaysActorRef() {
|
|
7
|
-
return
|
|
7
|
+
return useDiagramSnapshot(select, Object.is);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export { useOverlaysActorRef };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDiagramSnapshot, selectDiagramActor } from './useDiagram.js';
|
|
2
2
|
|
|
3
|
-
const select = (s) => {
|
|
3
|
+
const select = selectDiagramActor((s) => {
|
|
4
4
|
return s.children.search ?? null;
|
|
5
|
-
};
|
|
5
|
+
});
|
|
6
6
|
function useSearchActorRef() {
|
|
7
|
-
return
|
|
7
|
+
return useDiagramSnapshot(select, Object.is);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export { useSearchActorRef };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { IconRendererProvider } from './context/IconRenderer';
|
|
2
2
|
export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
|
|
3
|
-
export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, WhereOperator, } from './LikeC4Diagram.props';
|
|
3
|
+
export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, ViewPaddings, WhereOperator, } from './LikeC4Diagram.props';
|
|
4
4
|
export { LikeC4ModelProvider, type LikeC4ModelProviderProps, } from './LikeC4ModelProvider';
|
|
5
5
|
export { LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
|
|
6
6
|
export { createLikeC4Editor, type LikeC4EditorCallbacks, } from './editor/LikeC4EditorCallbacks';
|
|
@@ -19,5 +19,3 @@ export { ReactLikeC4, type ReactLikeC4Props } from './ReactLikeC4';
|
|
|
19
19
|
export { useCurrentView, useCurrentViewId, } from './hooks/useCurrentView';
|
|
20
20
|
export { pickViewBounds } from './utils/view-bounds';
|
|
21
21
|
export { LikeC4ProjectsOverview, type LikeC4ProjectsOverviewProps, } from './LikeC4ProjectsOverview';
|
|
22
|
-
export type { AdhocViewService, } from './adhoc-editor/actor.types';
|
|
23
|
-
export { LikeC4AdHocViewEditor, } from './adhoc-editor/LikeC4AdHocViewEditor';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { createLikeC4Editor } from './editor/LikeC4EditorCallbacks.js';
|
|
|
6
6
|
export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
|
|
7
7
|
export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
|
|
8
8
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
|
|
9
|
-
export { useCurrentViewModel
|
|
9
|
+
export { useCurrentViewModel } from './hooks/useCurrentViewModel.js';
|
|
10
10
|
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from './hooks/useLikeC4Project.js';
|
|
11
11
|
export { useLikeC4Styles } from './hooks/useLikeC4Styles.js';
|
|
12
12
|
export { useUpdateEffect } from './hooks/useUpdateEffect.js';
|
|
@@ -16,5 +16,5 @@ export { ReactLikeC4 } from './ReactLikeC4.js';
|
|
|
16
16
|
export { useCurrentView, useCurrentViewId } from './hooks/useCurrentView.js';
|
|
17
17
|
export { pickViewBounds } from './utils/view-bounds.js';
|
|
18
18
|
export { LikeC4ProjectsOverview } from './LikeC4ProjectsOverview.js';
|
|
19
|
-
export { LikeC4AdHocViewEditor } from './adhoc-editor/LikeC4AdHocViewEditor.js';
|
|
20
19
|
export { useDiagram } from './hooks/safeContext.js';
|
|
20
|
+
export { useOptionalCurrentViewModel } from './context/LikeC4ModelContext.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
3
|
import { Simplify } from 'type-fest';
|
|
3
4
|
import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
|
|
4
5
|
export type LikeC4DiagramXYFlowProps = PropsWithChildren<Simplify<Pick<LikeC4DiagramProperties<any>, 'background' | 'reactFlowProps' | 'renderNodes'>>>;
|
|
5
|
-
export declare function LikeC4DiagramXYFlow({ background, reactFlowProps, children, renderNodes, }: LikeC4DiagramXYFlowProps):
|
|
6
|
+
export declare function LikeC4DiagramXYFlow({ background, reactFlowProps, children, renderNodes, }: LikeC4DiagramXYFlowProps): JSX.Element;
|