@likec4/diagram 1.47.0 → 1.49.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/LICENSE +1 -1
- package/README.md +8 -10
- package/adhoc-editor/package.json +4 -0
- package/dist/LikeC4Diagram.d.ts +2 -1
- package/dist/LikeC4Diagram.js +85 -81
- package/dist/LikeC4Diagram.props.d.ts +10 -6
- 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 +10 -8
- package/dist/LikeC4Styles.d.ts +3 -6
- package/dist/LikeC4Styles.js +44 -43
- package/dist/LikeC4View.d.ts +22 -1
- package/dist/LikeC4View.js +40 -25
- package/dist/ReactLikeC4.d.ts +13 -2
- package/dist/ReactLikeC4.js +8 -4
- 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 +4 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +74 -0
- 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 +14 -0
- package/dist/adhoc-editor/hooks.js +29 -0
- package/dist/adhoc-editor/index.d.ts +2 -0
- package/dist/adhoc-editor/index.js +1 -0
- package/dist/adhoc-editor/state/ActorProvider.d.ts +5 -0
- package/dist/adhoc-editor/state/ActorProvider.js +40 -0
- package/dist/adhoc-editor/state/actor.d.ts +13 -0
- package/dist/adhoc-editor/state/actor.editor.d.ts +56 -0
- package/dist/adhoc-editor/state/actor.editor.js +205 -0
- package/dist/adhoc-editor/state/actor.js +16 -0
- package/dist/adhoc-editor/state/actor.layouter.d.ts +51 -0
- package/dist/adhoc-editor/state/actor.layouter.js +70 -0
- package/dist/adhoc-editor/state/actor.types.d.ts +63 -0
- package/dist/adhoc-editor/state/actor.types.js +29 -0
- 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 +6 -0
- package/dist/base/const.d.ts +2 -0
- package/dist/base/const.js +2 -1
- package/dist/base/updateEdges.js +26 -3
- package/dist/base/updateNodes.js +8 -5
- package/dist/base-primitives/Markdown.d.ts +1 -1
- package/dist/base-primitives/Markdown.js +1 -1
- package/dist/base-primitives/NodeHandles.d.ts +4 -2
- package/dist/base-primitives/NodeHandles.js +46 -19
- package/dist/base-primitives/compound/CompoundActionButton.js +28 -12
- package/dist/base-primitives/compound/CompoundDetailsButton.js +24 -9
- package/dist/base-primitives/compound/CompoundNodeContainer.js +11 -8
- package/dist/base-primitives/compound/CompoundTitle.js +1 -2
- package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +5 -2
- 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 +17 -20
- package/dist/base-primitives/element/ElementActionButtons.js +57 -59
- package/dist/base-primitives/element/ElementData.d.ts +7 -7
- package/dist/base-primitives/element/ElementData.js +61 -48
- package/dist/base-primitives/element/ElementDetailsButton.js +48 -18
- package/dist/base-primitives/element/ElementNodeContainer.d.ts +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.js +24 -10
- package/dist/base-primitives/element/ElementShape.d.ts +2 -2
- package/dist/base-primitives/element/ElementShape.js +70 -7
- package/dist/base-primitives/element/ElementTags.d.ts +6 -2
- package/dist/base-primitives/element/ElementTags.js +55 -32
- package/dist/base-primitives/index.d.ts +1 -1
- package/dist/base-primitives/memoEdge.js +1 -1
- package/dist/base-primitives/memoNode.js +1 -1
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/Link.js +3 -3
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +5 -26
- package/dist/components/PortalToContainer.js +3 -4
- package/dist/components/RootContainer.js +9 -19
- 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 +2 -0
- package/dist/context/DefaultMantineProvider.js +75 -0
- 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 +16 -13
- package/dist/context/EnsureMantine.d.ts +0 -3
- package/dist/context/EnsureMantine.js +3 -4
- package/dist/context/FramerMotionConfig.d.ts +1 -3
- package/dist/context/IconRenderer.d.ts +19 -4
- package/dist/context/IconRenderer.js +52 -25
- 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 +13 -5
- package/dist/custom/hooks.d.ts +2 -2
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +16 -15
- package/dist/editor/LikeC4EditorCallbacks.d.ts +18 -0
- package/dist/editor/LikeC4EditorCallbacks.js +5 -0
- package/dist/editor/LikeC4EditorProvider.d.ts +30 -18
- package/dist/editor/LikeC4EditorProvider.js +3 -3
- package/dist/editor/applyChangesToManualLayout.js +7 -6
- package/dist/editor/editorActor.actions.d.ts +25 -25
- package/dist/editor/editorActor.actions.js +22 -22
- package/dist/editor/editorActor.setup.d.ts +84 -0
- package/dist/editor/editorActor.setup.js +38 -0
- package/dist/editor/editorActor.states.d.ts +9 -0
- package/dist/editor/{editorActor.js → editorActor.states.js} +21 -72
- package/dist/editor/index.d.ts +4 -3
- package/dist/editor/useEditorActorLogic.d.ts +2 -565
- package/dist/editor/useEditorActorLogic.js +14 -21
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/safeContext.d.ts +4 -5
- package/dist/hooks/useCallbackRef.d.ts +6 -0
- package/dist/hooks/useCallbackRef.js +7 -6
- package/dist/hooks/useCurrentView.js +5 -10
- package/dist/hooks/useCurrentViewModel.d.ts +8 -2
- package/dist/hooks/useCurrentViewModel.js +3 -7
- package/dist/hooks/useDiagram.d.ts +9 -1
- package/dist/hooks/useDiagram.js +10 -4
- package/dist/hooks/useDiagramCompareLayout.d.ts +6 -6
- package/dist/hooks/useDiagramCompareLayout.js +1 -1
- package/dist/hooks/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +2 -2
- 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/hooks/useSetState.d.ts +6 -1
- package/dist/hooks/useSetState.js +7 -4
- package/dist/hooks/useXYFlow.d.ts +7 -1
- package/dist/hooks/useXYFlow.js +4 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -1
- package/dist/likec4diagram/DiagramUI.js +1 -3
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -1
- package/dist/likec4diagram/DiagramXYFlow.js +29 -18
- package/dist/likec4diagram/convert-to-xyflow.d.ts +2 -1
- package/dist/likec4diagram/convert-to-xyflow.js +2 -6
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +34 -37
- package/dist/likec4diagram/custom/edges/edges.css.js +2 -1
- package/dist/likec4diagram/custom/edges/useControlPoints.js +3 -3
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +3 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +52 -34
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
- 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 +10 -6
- package/dist/likec4diagram/custom/nodes/nodes.js +30 -8
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +5 -4
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +14 -9
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +4 -4
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +3 -3
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +16 -36
- package/dist/likec4diagram/relationship-popover/components.d.ts +7 -0
- package/dist/likec4diagram/relationship-popover/components.js +39 -0
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +39 -66
- package/dist/likec4diagram/state/assign.d.ts +1 -1
- package/dist/likec4diagram/state/createViewChange.js +16 -4
- 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 +92 -0
- package/dist/likec4diagram/state/machine.actions.js +127 -58
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +23 -2
- package/dist/likec4diagram/state/machine.actions.layout.js +68 -15
- package/dist/likec4diagram/state/machine.d.ts +1 -1
- package/dist/likec4diagram/state/machine.js +35 -31
- package/dist/likec4diagram/state/machine.setup.d.ts +40 -7
- package/dist/likec4diagram/state/machine.setup.js +13 -4
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +32 -2
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +1 -1
- package/dist/likec4diagram/state/machine.state.navigating.js +82 -50
- package/dist/likec4diagram/state/machine.state.ready.d.ts +565 -579
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +17 -148
- package/dist/likec4diagram/state/machine.state.ready.focused.js +6 -14
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +11 -96
- package/dist/likec4diagram/state/machine.state.ready.idle.js +7 -12
- package/dist/likec4diagram/state/machine.state.ready.js +89 -70
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +4 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +4 -3
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +145 -2
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +29 -21
- package/dist/likec4diagram/state/types.d.ts +1 -1
- package/dist/likec4diagram/state/utils.d.ts +14 -14
- package/dist/likec4diagram/state/utils.js +12 -4
- package/dist/likec4diagram/types.d.ts +11 -3
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.d.ts +12 -12
- package/dist/likec4diagram/useLayoutConstraints.js +126 -84
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +15 -8
- package/dist/navigationpanel/NavigationPanel.js +4 -3
- package/dist/navigationpanel/NavigationPanelControls.js +4 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +13 -13
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +2 -3
- 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/comparepanel/LayoutTypeSwitcher.js +4 -5
- package/dist/navigationpanel/controls/DetailsControls.js +7 -7
- package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
- 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.d.ts +1 -2
- package/dist/navigationpanel/controls/SearchControl.js +8 -12
- package/dist/navigationpanel/controls/ToggleReadonly.js +5 -6
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +12 -6
- 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/editorpanel/styles.js +4 -4
- package/dist/navigationpanel/styles.css.d.ts +1 -1
- package/dist/navigationpanel/styles.css.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -6
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +77 -77
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.3 → @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.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @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.3 → @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.3 → @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 +15 -15
- package/dist/overlays/element-details/ElementDetailsCard.js +39 -40
- package/dist/overlays/element-details/MetadataValue.js +11 -12
- package/dist/overlays/element-details/TabPanelDeployments.js +8 -6
- package/dist/overlays/element-details/TabPanelRelationships.css.js +10 -30
- 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 +3 -2
- package/dist/overlays/overlaysActor.js +19 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +0 -5
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -4
- package/dist/overlays/relationship-details/SelectEdge.css.js +6 -6
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/compute.js +1 -1
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- package/dist/overlays/relationship-details/custom/nodeTypes.js +14 -1
- package/dist/overlays/relationship-details/layout.js +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +0 -5
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +116 -21
- 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 +21 -6
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +14 -1
- package/dist/overlays/relationships-browser/layout.d.ts +1 -1
- package/dist/overlays/relationships-browser/layout.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/actor.js +8 -31
- 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/projects-overview/panel/ProjectsOverviewPanel.js +1 -1
- package/dist/search/Search.d.ts +2 -4
- package/dist/search/Search.js +67 -44
- package/dist/search/components/ElementsColumn.css.js +6 -6
- package/dist/search/components/ElementsColumn.js +93 -60
- package/dist/search/components/PickView.d.ts +3 -1
- package/dist/search/components/PickView.js +12 -7
- 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.d.ts +1 -1
- package/dist/search/components/_shared.css.js +12 -12
- package/dist/search/components/utils.js +1 -4
- package/dist/search/hooks.d.ts +1 -6
- package/dist/search/hooks.js +15 -9
- 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 +25 -22
- package/dist/shadowroot/styles.css.d.ts +0 -2
- package/dist/shadowroot/styles.css.js +4 -36
- package/dist/styles-font.css2.js +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/view-bounds.d.ts +3 -2
- package/dist/utils/view-bounds.js +10 -6
- package/dist/utils/xyflow.d.ts +27 -6
- package/dist/utils/xyflow.js +68 -23
- package/package.json +39 -37
- package/panda.buildinfo.json +226 -161
- package/styles-font.css +1 -1
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/bundle/index.js +0 -51974
- package/bundle/package.json +0 -4
- package/dist/editor/__tests__/fixture.d.ts +0 -205
- package/dist/editor/editorActor.d.ts +0 -653
- package/dist/likec4diagram/relationship-popover/styles.css.d.ts +0 -2
- package/dist/likec4diagram/relationship-popover/styles.css.js +0 -28
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/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.3/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.3/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.3/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -14
- package/dist/overlays/relationships-browser/custom/styles.css.d.ts +0 -1
- package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
|
@@ -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,4 +1,10 @@
|
|
|
1
|
-
import { CurrentViewModel } from '../context/LikeC4ModelContext';
|
|
1
|
+
import { CurrentViewModel, useOptionalCurrentViewModel } from '../context/LikeC4ModelContext';
|
|
2
2
|
export type { CurrentViewModel };
|
|
3
|
-
export
|
|
3
|
+
export { useOptionalCurrentViewModel, };
|
|
4
|
+
/**
|
|
5
|
+
* Hook to get the current view model from the context.
|
|
6
|
+
* Throws an error if no view model is found in the context.
|
|
7
|
+
*
|
|
8
|
+
* @see useOptionalCurrentViewModel
|
|
9
|
+
*/
|
|
4
10
|
export declare function useCurrentViewModel(): CurrentViewModel;
|
|
@@ -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,14 +5,20 @@ 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
|
}
|
|
12
|
-
function
|
|
15
|
+
function selectDiagramActorContext(selector) {
|
|
16
|
+
return (state) => selector(state.context);
|
|
17
|
+
}
|
|
18
|
+
function useDiagramContext(selector, compare = shallowEqual, deps = []) {
|
|
13
19
|
const actorRef = useDiagramActorRef();
|
|
14
20
|
const selectorRef = useCallbackRef(selector);
|
|
15
|
-
const select = useCallback((s) => selectorRef(s.context), deps
|
|
21
|
+
const select = useCallback((s) => selectorRef(s.context), deps);
|
|
16
22
|
return useSelector(actorRef, select, compare);
|
|
17
23
|
}
|
|
18
24
|
function useOnDiagramEvent(event, callback, options) {
|
|
@@ -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
|
-
drifts: never
|
|
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
|
};
|
|
@@ -19,7 +19,7 @@ function useLikeC4ElementsTree(viewId) {
|
|
|
19
19
|
} else {
|
|
20
20
|
return [...model.roots()].map(buildNode).sort(sortByLabel);
|
|
21
21
|
}
|
|
22
|
-
}, [model, viewId
|
|
22
|
+
}, [model, viewId]);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { sortByLabel, useLikeC4ElementsTree };
|
|
@@ -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 };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { NonEmptyObject } from 'type-fest';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Differs from useState in that:
|
|
4
|
+
* - it uses custom equal function (shallowEqual by default) to determine whether the state has changed.
|
|
5
|
+
* - allows partial updates to the state
|
|
6
|
+
*/
|
|
7
|
+
export declare function useSetState<T extends object>(initialState: T | (() => T), equal?: (a: T, b: T) => boolean): readonly [T, (statePartial: NonEmptyObject<Partial<T>> | ((current: T) => NonEmptyObject<Partial<T>>)) => void];
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { shallowEqual } from 'fast-equals';
|
|
2
|
-
import { useState, useCallback } from 'react';
|
|
2
|
+
import { useState, useRef, useCallback } from 'react';
|
|
3
3
|
|
|
4
|
-
function useSetState(initialState) {
|
|
4
|
+
function useSetState(initialState, equal) {
|
|
5
5
|
const [state, _setState] = useState(initialState);
|
|
6
|
+
const equalFn = equal ?? shallowEqual;
|
|
7
|
+
const equalFnRef = useRef(equalFn);
|
|
8
|
+
equalFnRef.current = equalFn;
|
|
6
9
|
const setState = useCallback(
|
|
7
10
|
(statePartial) => _setState((current) => {
|
|
8
11
|
const next = {
|
|
9
12
|
...current,
|
|
10
13
|
...typeof statePartial === "function" ? statePartial(current) : statePartial
|
|
11
14
|
};
|
|
12
|
-
return
|
|
15
|
+
return equalFnRef.current(current, next) ? current : next;
|
|
13
16
|
}),
|
|
14
|
-
[]
|
|
17
|
+
[_setState]
|
|
15
18
|
);
|
|
16
19
|
return [state, setState];
|
|
17
20
|
}
|
|
@@ -12,5 +12,11 @@ export type XYStoreApi = {
|
|
|
12
12
|
};
|
|
13
13
|
export type XYInternalNode = InternalNode<Types.AnyNode>;
|
|
14
14
|
export declare function useXYInternalNode(id: string): XYInternalNode | undefined;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Returns the current zoom level of the flow.
|
|
17
|
+
* @param precision The number of decimal places to round to, defaults to 2 (i.e. 1.23)
|
|
18
|
+
* @returns The current zoom level of the flow.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useCurrentZoom(precision?: number): number;
|
|
21
|
+
export declare function useCurrentZoomAtLeast(minZoom: number): boolean;
|
|
16
22
|
export declare function useIsZoomTooSmall(): boolean;
|
package/dist/hooks/useXYFlow.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useStore, useStoreApi, useReactFlow } from '@xyflow/react';
|
|
2
2
|
import { shallowEqual } from 'fast-equals';
|
|
3
|
+
import { useCallback } from 'react';
|
|
3
4
|
import { useCallbackRef } from './useCallbackRef.js';
|
|
4
5
|
|
|
5
6
|
function useXYFlow() {
|
|
@@ -14,13 +15,12 @@ function useXYStore(selector, equalityFn) {
|
|
|
14
15
|
function useXYStoreApi() {
|
|
15
16
|
return useStoreApi();
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return useStore(selectCurrentZoom);
|
|
18
|
+
function useCurrentZoomAtLeast(minZoom) {
|
|
19
|
+
return useStore(useCallback((state) => state.transform[2] >= minZoom, [minZoom]));
|
|
20
20
|
}
|
|
21
21
|
const selectZoom = (state) => state.transform[2] < 0.2;
|
|
22
22
|
function useIsZoomTooSmall() {
|
|
23
23
|
return useStore(selectZoom);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export {
|
|
26
|
+
export { useCurrentZoomAtLeast, useIsZoomTooSmall, useXYFlow, useXYStore, useXYStoreApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { IconRendererProvider } from './context/IconRenderer';
|
|
2
2
|
export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
|
|
3
|
-
export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick,
|
|
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
|
-
export {
|
|
5
|
+
export { LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
|
|
6
|
+
export { createLikeC4Editor, type LikeC4EditorCallbacks, } from './editor/LikeC4EditorCallbacks';
|
|
6
7
|
export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './LikeC4ProjectsProvider';
|
|
7
8
|
export { type DiagramApi, type DiagramContext, useDiagram, useDiagramContext, useOnDiagramEvent, } from './hooks/useDiagram';
|
|
8
9
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from './hooks/useLikeC4Model';
|
|
9
|
-
export { useCurrentViewModel } from './hooks/useCurrentViewModel';
|
|
10
|
+
export { type CurrentViewModel, useCurrentViewModel, useOptionalCurrentViewModel, } from './hooks/useCurrentViewModel';
|
|
10
11
|
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './hooks/useLikeC4Project';
|
|
11
12
|
export { useLikeC4Styles } from './hooks/useLikeC4Styles';
|
|
12
13
|
export { useUpdateEffect } from './hooks/useUpdateEffect';
|
|
@@ -15,6 +16,6 @@ export { StaticLikeC4Diagram } from './StaticLikeC4Diagram';
|
|
|
15
16
|
export { LikeC4View } from './LikeC4View';
|
|
16
17
|
export type { LikeC4BrowserProps, LikeC4ViewProps } from './LikeC4View';
|
|
17
18
|
export { ReactLikeC4, type ReactLikeC4Props } from './ReactLikeC4';
|
|
18
|
-
export { useCurrentViewId } from './hooks/useCurrentView';
|
|
19
|
+
export { useCurrentView, useCurrentViewId, } from './hooks/useCurrentView';
|
|
19
20
|
export { pickViewBounds } from './utils/view-bounds';
|
|
20
21
|
export { LikeC4ProjectsOverview, type LikeC4ProjectsOverviewProps, } from './LikeC4ProjectsOverview';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { IconRendererProvider } from './context/IconRenderer.js';
|
|
|
2
2
|
export { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
3
3
|
export { LikeC4ModelProvider } from './LikeC4ModelProvider.js';
|
|
4
4
|
export { LikeC4EditorProvider } from './editor/LikeC4EditorProvider.js';
|
|
5
|
+
export { createLikeC4Editor } from './editor/LikeC4EditorCallbacks.js';
|
|
5
6
|
export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
|
|
6
7
|
export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
|
|
7
8
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
|
|
@@ -12,7 +13,8 @@ export { useUpdateEffect } from './hooks/useUpdateEffect.js';
|
|
|
12
13
|
export { StaticLikeC4Diagram } from './StaticLikeC4Diagram.js';
|
|
13
14
|
export { LikeC4View } from './LikeC4View.js';
|
|
14
15
|
export { ReactLikeC4 } from './ReactLikeC4.js';
|
|
15
|
-
export { useCurrentViewId } from './hooks/useCurrentView.js';
|
|
16
|
+
export { useCurrentView, useCurrentViewId } from './hooks/useCurrentView.js';
|
|
16
17
|
export { pickViewBounds } from './utils/view-bounds.js';
|
|
17
18
|
export { LikeC4ProjectsOverview } from './LikeC4ProjectsOverview.js';
|
|
18
19
|
export { useDiagram } from './hooks/safeContext.js';
|
|
20
|
+
export { useOptionalCurrentViewModel } from './context/LikeC4ModelContext.js';
|
|
@@ -4,7 +4,6 @@ import { memo, useCallback } from 'react';
|
|
|
4
4
|
import { ErrorBoundary } from '../components/ErrorFallback.js';
|
|
5
5
|
import { useEnabledFeatures } from '../context/DiagramFeatures.js';
|
|
6
6
|
import { useOverlaysActorRef } from '../hooks/useOverlaysActor.js';
|
|
7
|
-
import { useSearchActorRef } from '../hooks/useSearchActor.js';
|
|
8
7
|
import { Overlays } from '../overlays/Overlays.js';
|
|
9
8
|
import { Search } from '../search/Search.js';
|
|
10
9
|
import { RelationshipPopover } from './relationship-popover/RelationshipPopover.js';
|
|
@@ -23,7 +22,6 @@ const LikeC4DiagramUI = memo(() => {
|
|
|
23
22
|
} = useEnabledFeatures();
|
|
24
23
|
const rerender = useRerender();
|
|
25
24
|
const overlaysActorRef = useOverlaysActorRef();
|
|
26
|
-
const searchActorRef = useSearchActorRef();
|
|
27
25
|
const handleReset = useCallback(() => {
|
|
28
26
|
console.warn("DiagramUI: resetting error boundary and rerendering...");
|
|
29
27
|
rerender();
|
|
@@ -32,7 +30,7 @@ const LikeC4DiagramUI = memo(() => {
|
|
|
32
30
|
enableControls && /* @__PURE__ */ jsx(NavigationPanel, {}),
|
|
33
31
|
overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
|
|
34
32
|
enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
|
|
35
|
-
enableSearch &&
|
|
33
|
+
enableSearch && /* @__PURE__ */ jsx(Search, {}),
|
|
36
34
|
enableRelationshipDetails && enableReadOnly && /* @__PURE__ */ jsx(RelationshipPopover, {}),
|
|
37
35
|
enableCompareWithLatest && /* @__PURE__ */ jsx(LayoutDriftFrame, {})
|
|
38
36
|
] });
|
|
@@ -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;
|