@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,6 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useContext, createContext } from 'react';
|
|
3
|
+
import { useSetState } from '../hooks/useSetState.js';
|
|
4
|
+
import { useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
4
5
|
|
|
5
6
|
const DefaultFeatures = {
|
|
6
7
|
enableEditor: false,
|
|
@@ -18,7 +19,8 @@ const DefaultFeatures = {
|
|
|
18
19
|
enableNavigationButtons: false,
|
|
19
20
|
enableFitView: false,
|
|
20
21
|
enableVscode: false,
|
|
21
|
-
enableElementTags: false
|
|
22
|
+
enableElementTags: false,
|
|
23
|
+
enableNotes: false
|
|
22
24
|
};
|
|
23
25
|
const DiagramFeaturesContext = createContext(DefaultFeatures);
|
|
24
26
|
function DiagramFeatures({
|
|
@@ -27,19 +29,20 @@ function DiagramFeatures({
|
|
|
27
29
|
overrides
|
|
28
30
|
}) {
|
|
29
31
|
const outerScope = useContext(DiagramFeaturesContext);
|
|
30
|
-
const [scope, setScope] =
|
|
31
|
-
|
|
32
|
+
const [scope, setScope] = useSetState(() => ({
|
|
33
|
+
...outerScope,
|
|
34
|
+
...features,
|
|
35
|
+
...overrides
|
|
36
|
+
}));
|
|
37
|
+
useUpdateEffect(
|
|
32
38
|
() => {
|
|
33
|
-
setScope(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
...overrides
|
|
38
|
-
};
|
|
39
|
-
return shallowEqual(current, next) ? current : next;
|
|
39
|
+
setScope({
|
|
40
|
+
...outerScope,
|
|
41
|
+
...features,
|
|
42
|
+
...overrides
|
|
40
43
|
});
|
|
41
44
|
},
|
|
42
|
-
[outerScope, features, overrides]
|
|
45
|
+
[outerScope, features, overrides, setScope]
|
|
43
46
|
);
|
|
44
47
|
return /* @__PURE__ */ jsx(DiagramFeaturesContext.Provider, { value: scope, children });
|
|
45
48
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
type EnsureMantineProps = PropsWithChildren<{}>;
|
|
3
3
|
export declare function EnsureMantine({ children }: EnsureMantineProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare namespace EnsureMantine {
|
|
5
|
-
var displayName: string;
|
|
6
|
-
}
|
|
7
4
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { MantineContext
|
|
2
|
+
import { MantineContext } from '@mantine/core';
|
|
3
3
|
import { useContext, useEffect } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { DefaultMantineProvider } from './DefaultMantineProvider.js';
|
|
5
5
|
|
|
6
6
|
function EnsureMantine({ children }) {
|
|
7
7
|
const mantineCtx = useContext(MantineContext);
|
|
@@ -11,10 +11,9 @@ function EnsureMantine({ children }) {
|
|
|
11
11
|
}
|
|
12
12
|
}, []);
|
|
13
13
|
if (!mantineCtx) {
|
|
14
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
+
return /* @__PURE__ */ jsx(DefaultMantineProvider, { children });
|
|
15
15
|
}
|
|
16
16
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
17
17
|
}
|
|
18
|
-
EnsureMantine.displayName = "EnsureMantine";
|
|
19
18
|
|
|
20
19
|
export { EnsureMantine };
|
|
@@ -3,8 +3,6 @@ export declare const FramerMotionConfig: ({ reducedMotion, children, }: PropsWit
|
|
|
3
3
|
/**
|
|
4
4
|
* If true, will respect the device prefersReducedMotion setting by switching
|
|
5
5
|
* transform animations off.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
6
|
*/
|
|
9
|
-
reducedMotion?: "always" | "never" | "user";
|
|
7
|
+
reducedMotion?: "always" | "never" | "user" | undefined;
|
|
10
8
|
}>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { ElementShape } from '@likec4/core';
|
|
2
|
-
import { CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
+
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
import { ElementIconRenderer } from '../LikeC4Diagram.props';
|
|
4
|
+
/**
|
|
5
|
+
* Provider for custom element icon renderers
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const MyIconRenderer: ElementIconRenderer = ({ node }) => {
|
|
10
|
+
* return <div>{node.title}</div>
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* <IconRendererProvider value={MyIconRenderer}>
|
|
14
|
+
* <LikeC4Diagram />
|
|
15
|
+
* </IconRendererProvider>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
4
18
|
export declare function IconRendererProvider({ value, children, }: PropsWithChildren<{
|
|
5
19
|
value: ElementIconRenderer | null;
|
|
6
20
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,13 +26,14 @@ export declare function IconRenderer({ element, className, style, }: {
|
|
|
12
26
|
};
|
|
13
27
|
className?: string | undefined;
|
|
14
28
|
style?: CSSProperties | undefined;
|
|
15
|
-
}):
|
|
16
|
-
export declare function IconOrShapeRenderer({ element, className, }: {
|
|
29
|
+
}): ReactNode;
|
|
30
|
+
export declare function IconOrShapeRenderer({ element, className, style, }: {
|
|
17
31
|
element: {
|
|
18
32
|
id: string;
|
|
19
33
|
title: string;
|
|
20
34
|
shape: ElementShape;
|
|
21
35
|
icon?: string | null | undefined;
|
|
22
36
|
};
|
|
23
|
-
className
|
|
37
|
+
className?: string;
|
|
38
|
+
style?: CSSProperties | undefined;
|
|
24
39
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@likec4/styles/css';
|
|
3
3
|
import { createContext, useContext } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import IconReorder from '../node_modules/.pnpm/@tabler_icons-react@3.36.
|
|
8
|
-
import IconUser from '../node_modules/.pnpm/@tabler_icons-react@3.36.
|
|
9
|
-
import IconDeviceMobile from '../node_modules/.pnpm/@tabler_icons-react@3.36.
|
|
10
|
-
import IconBrowser from '../node_modules/.pnpm/@tabler_icons-react@3.36.
|
|
4
|
+
import IconRectangularPrism from '../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js';
|
|
5
|
+
import IconFileText from '../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js';
|
|
6
|
+
import IconCylinder from '../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js';
|
|
7
|
+
import IconReorder from '../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js';
|
|
8
|
+
import IconUser from '../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js';
|
|
9
|
+
import IconDeviceMobile from '../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js';
|
|
10
|
+
import IconBrowser from '../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js';
|
|
11
11
|
|
|
12
12
|
const IconRendererContext = createContext(null);
|
|
13
13
|
function IconRendererProvider({
|
|
@@ -20,6 +20,26 @@ function IconRendererProvider({
|
|
|
20
20
|
}
|
|
21
21
|
return /* @__PURE__ */ jsx(IconRendererContext.Provider, { value, children });
|
|
22
22
|
}
|
|
23
|
+
function decodeSvgDataUrl(dataUrl) {
|
|
24
|
+
if (!dataUrl.startsWith("data:image/svg+xml")) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
if (dataUrl.includes(";base64,")) {
|
|
29
|
+
const base64Content = dataUrl.split(";base64,")[1];
|
|
30
|
+
if (base64Content) {
|
|
31
|
+
return atob(base64Content);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
const encodedContent = dataUrl.split(",")[1];
|
|
35
|
+
if (encodedContent) {
|
|
36
|
+
return decodeURIComponent(encodedContent);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
23
43
|
function IconRenderer({
|
|
24
44
|
element,
|
|
25
45
|
className,
|
|
@@ -30,8 +50,13 @@ function IconRenderer({
|
|
|
30
50
|
return null;
|
|
31
51
|
}
|
|
32
52
|
let icon;
|
|
33
|
-
if (element.icon.startsWith("http://") || element.icon.startsWith("https://")) {
|
|
34
|
-
|
|
53
|
+
if (element.icon.startsWith("http://") || element.icon.startsWith("https://") || element.icon.startsWith("data:image")) {
|
|
54
|
+
const svgContent = element.icon.startsWith("data:image/svg+xml") ? decodeSvgDataUrl(element.icon) : null;
|
|
55
|
+
if (svgContent) {
|
|
56
|
+
icon = /* @__PURE__ */ jsx("span", { style: { display: "contents" }, dangerouslySetInnerHTML: { __html: svgContent } });
|
|
57
|
+
} else {
|
|
58
|
+
icon = /* @__PURE__ */ jsx("img", { src: element.icon, alt: element.title });
|
|
59
|
+
}
|
|
35
60
|
} else if (RenderIcon) {
|
|
36
61
|
icon = /* @__PURE__ */ jsx(RenderIcon, { node: element });
|
|
37
62
|
}
|
|
@@ -60,27 +85,29 @@ const ShapeIcons = {
|
|
|
60
85
|
rectangle: IconRectangularPrism,
|
|
61
86
|
storage: IconCylinder,
|
|
62
87
|
bucket: IconCylinder,
|
|
63
|
-
document: IconFileText
|
|
88
|
+
document: IconFileText,
|
|
89
|
+
component: IconRectangularPrism
|
|
64
90
|
};
|
|
65
91
|
function IconOrShapeRenderer({
|
|
66
92
|
element,
|
|
67
|
-
className
|
|
93
|
+
className,
|
|
94
|
+
style
|
|
68
95
|
}) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return
|
|
96
|
+
if (!element.icon || element.icon === "none") {
|
|
97
|
+
const ShapeIcon = ShapeIcons[element.shape];
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: cx(
|
|
102
|
+
className,
|
|
103
|
+
"likec4-shape-icon"
|
|
104
|
+
),
|
|
105
|
+
style,
|
|
106
|
+
children: /* @__PURE__ */ jsx(ShapeIcon, {})
|
|
107
|
+
}
|
|
108
|
+
);
|
|
72
109
|
}
|
|
73
|
-
|
|
74
|
-
return /* @__PURE__ */ jsx(
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
className: cx(
|
|
78
|
-
className,
|
|
79
|
-
"likec4-shape-icon"
|
|
80
|
-
),
|
|
81
|
-
children: /* @__PURE__ */ jsx(ShapeIcon, {})
|
|
82
|
-
}
|
|
83
|
-
);
|
|
110
|
+
return /* @__PURE__ */ jsx(IconRenderer, { element, className, style });
|
|
84
111
|
}
|
|
85
112
|
|
|
86
113
|
export { IconOrShapeRenderer, IconRenderer, IconRendererProvider };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
|
|
2
|
-
import {
|
|
3
|
-
import { PropsWithChildren,
|
|
2
|
+
import { LayoutedView } from '@likec4/core/types';
|
|
3
|
+
import { PropsWithChildren, Provider } from 'react';
|
|
4
4
|
import type * as t from '@likec4/core/types';
|
|
5
5
|
type UnknownLayouted = t.aux.UnknownLayouted;
|
|
6
|
-
export declare const
|
|
7
|
-
export type CurrentViewModel = LikeC4ViewModel<UnknownLayouted,
|
|
8
|
-
export declare const CurrentViewModelContext:
|
|
6
|
+
export declare const LikeC4ModelContextProvider: Provider<LikeC4Model<any> | null>;
|
|
7
|
+
export type CurrentViewModel = LikeC4ViewModel<UnknownLayouted, LayoutedView<UnknownLayouted>>;
|
|
8
|
+
export declare const CurrentViewModelContext: Provider<CurrentViewModel | null>;
|
|
9
9
|
export declare function EnsureCurrentViewModel({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
/**
|
|
11
|
+
* @returns The LikeC4Model from context, or null if no LikeC4ModelProvider is found.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useOptionalLikeC4Model<A extends t.aux.Any = UnknownLayouted>(): LikeC4Model<A> | null;
|
|
14
|
+
export declare function useOptionalCurrentViewModel(): CurrentViewModel | null;
|
|
10
15
|
export {};
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import 'react/jsx-runtime';
|
|
2
|
-
import { createContext } from 'react';
|
|
2
|
+
import { useContext, createContext } from 'react';
|
|
3
3
|
|
|
4
4
|
const LikeC4ModelContext = createContext(null);
|
|
5
|
-
const
|
|
5
|
+
const LikeC4ModelContextProvider = LikeC4ModelContext.Provider;
|
|
6
|
+
const CurrentViewModelCtx = createContext(null);
|
|
7
|
+
const CurrentViewModelContext = CurrentViewModelCtx.Provider;
|
|
8
|
+
function useOptionalLikeC4Model() {
|
|
9
|
+
return useContext(LikeC4ModelContext);
|
|
10
|
+
}
|
|
11
|
+
function useOptionalCurrentViewModel() {
|
|
12
|
+
return useContext(CurrentViewModelCtx);
|
|
13
|
+
}
|
|
6
14
|
|
|
7
|
-
export { CurrentViewModelContext,
|
|
15
|
+
export { CurrentViewModelContext, LikeC4ModelContextProvider, useOptionalCurrentViewModel, useOptionalLikeC4Model };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LikeC4Project, ProjectId } from '@likec4/core/types';
|
|
2
|
-
import {
|
|
2
|
+
import { Provider } from 'react';
|
|
3
3
|
export type LikeC4ProjectsContext = {
|
|
4
4
|
projects: ReadonlyArray<LikeC4Project>;
|
|
5
5
|
onProjectChange: (id: ProjectId) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const LikeC4ProjectsContextProvider: Provider<LikeC4ProjectsContext | null>;
|
|
8
|
+
export declare function useOptionalProjectsContext(): LikeC4ProjectsContext | null;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
1
|
+
import { useContext, createContext } from 'react';
|
|
2
2
|
|
|
3
3
|
const LikeC4ProjectsContext = createContext(null);
|
|
4
|
+
const LikeC4ProjectsContextProvider = LikeC4ProjectsContext.Provider;
|
|
5
|
+
function useOptionalProjectsContext() {
|
|
6
|
+
return useContext(LikeC4ProjectsContext);
|
|
7
|
+
}
|
|
4
8
|
|
|
5
|
-
export {
|
|
9
|
+
export { LikeC4ProjectsContextProvider, useOptionalProjectsContext };
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { WritableAtom } from 'nanostores';
|
|
2
|
-
import { RefObject,
|
|
3
|
-
export declare const
|
|
2
|
+
import { RefObject, Provider } from 'react';
|
|
3
|
+
export declare const RootContainerContextProvider: Provider<{
|
|
4
4
|
id: string;
|
|
5
|
+
selector: string;
|
|
5
6
|
ref: RefObject<HTMLDivElement | null>;
|
|
6
7
|
} | null>;
|
|
8
|
+
export declare function useRootContainerContext(): {
|
|
9
|
+
id: string;
|
|
10
|
+
selector: string;
|
|
11
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
12
|
+
} | null;
|
|
7
13
|
export declare function useRootContainer(): {
|
|
8
14
|
id: string;
|
|
15
|
+
selector: string;
|
|
9
16
|
ref: RefObject<HTMLDivElement | null>;
|
|
10
17
|
};
|
|
11
18
|
export declare function useRootContainerRef(): RefObject<HTMLDivElement | null>;
|
|
12
19
|
export declare function useRootContainerElement(): HTMLDivElement | null;
|
|
13
|
-
export declare const
|
|
20
|
+
export declare const ReduceGraphicsModeProvider: Provider<boolean | null>;
|
|
14
21
|
/**
|
|
15
22
|
* Hook to determine if reduced graphics mode is enabled.
|
|
16
23
|
*/
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { createSafeContext } from '@mantine/core';
|
|
2
2
|
import '@nanostores/react';
|
|
3
|
-
import {
|
|
3
|
+
import { useContext, createContext } from 'react';
|
|
4
4
|
|
|
5
5
|
const RootContainerContext = createContext(null);
|
|
6
|
+
const RootContainerContextProvider = RootContainerContext.Provider;
|
|
7
|
+
function useRootContainerContext() {
|
|
8
|
+
return useContext(RootContainerContext);
|
|
9
|
+
}
|
|
6
10
|
function useRootContainer() {
|
|
7
|
-
const ctx =
|
|
11
|
+
const ctx = useRootContainerContext();
|
|
8
12
|
if (!ctx) {
|
|
9
13
|
throw new Error("useRootContainer must be used within a RootContainer");
|
|
10
14
|
}
|
|
@@ -17,6 +21,7 @@ function useRootContainerElement() {
|
|
|
17
21
|
return useRootContainer().ref.current;
|
|
18
22
|
}
|
|
19
23
|
const ReduceGraphicsModeCtx = createContext(null);
|
|
24
|
+
const ReduceGraphicsModeProvider = ReduceGraphicsModeCtx.Provider;
|
|
20
25
|
function useIsReducedGraphics() {
|
|
21
26
|
const isReduced = useContext(ReduceGraphicsModeCtx);
|
|
22
27
|
if (isReduced === null) {
|
|
@@ -28,4 +33,4 @@ const [PanningAtomSafeCtx, usePanningAtom] = createSafeContext(
|
|
|
28
33
|
"PanningAtomSafeCtx is not provided"
|
|
29
34
|
);
|
|
30
35
|
|
|
31
|
-
export { PanningAtomSafeCtx,
|
|
36
|
+
export { PanningAtomSafeCtx, ReduceGraphicsModeProvider, RootContainerContextProvider, useIsReducedGraphics, usePanningAtom, useRootContainer, useRootContainerContext, useRootContainerElement, useRootContainerRef };
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { isTagColorSpecified } from '@likec4/core';
|
|
3
3
|
import { DefaultTagColors } from '@likec4/core/styles';
|
|
4
4
|
import { useMantineStyleNonce } from '@mantine/core';
|
|
5
|
-
import { createContext, memo
|
|
5
|
+
import { useContext, createContext, memo } from 'react';
|
|
6
6
|
import { isEmpty, pipe, entries, flatMap, join } from 'remeda';
|
|
7
7
|
import { useLikeC4Specification } from '../hooks/useLikeC4Model.js';
|
|
8
8
|
|
|
@@ -46,15 +46,23 @@ function generateStylesheet(tags, rootSelector) {
|
|
|
46
46
|
}
|
|
47
47
|
function TagStylesProvider({ children, rootSelector }) {
|
|
48
48
|
const tags = useLikeC4Specification().tags;
|
|
49
|
+
const nonce = useMantineStyleNonce()?.();
|
|
49
50
|
const stylesheet = generateStylesheet(tags, rootSelector);
|
|
50
51
|
return /* @__PURE__ */ jsxs(TagStylesContext.Provider, { value: tags, children: [
|
|
51
|
-
stylesheet !== "" && /* @__PURE__ */ jsx(TagStylesheet, { stylesheet }),
|
|
52
|
+
stylesheet !== "" && /* @__PURE__ */ jsx(TagStylesheet, { nonce, stylesheet }),
|
|
52
53
|
children
|
|
53
54
|
] });
|
|
54
55
|
}
|
|
55
|
-
const TagStylesheet = memo(({ stylesheet }) => {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const TagStylesheet = memo(({ stylesheet, nonce }) => {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"style",
|
|
59
|
+
{
|
|
60
|
+
"data-likec4-tags": true,
|
|
61
|
+
type: "text/css",
|
|
62
|
+
dangerouslySetInnerHTML: { __html: stylesheet },
|
|
63
|
+
nonce
|
|
64
|
+
}
|
|
65
|
+
);
|
|
58
66
|
});
|
|
59
67
|
function useTagSpecification(tag) {
|
|
60
68
|
const specs = useContext(TagStylesContext);
|
package/dist/custom/hooks.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { useDiagramEventHandlers, } from '../context/DiagramEventHandlers';
|
|
|
3
3
|
export { type EnabledFeatures, type FeatureName, useEnabledFeatures, } from '../context/DiagramFeatures';
|
|
4
4
|
export { useCurrentView, useCurrentViewId, } from '../hooks/useCurrentView';
|
|
5
5
|
export { type DiagramApi, useDiagram, useDiagramActorRef, useDiagramContext, useOnDiagramEvent, } from '../hooks/useDiagram';
|
|
6
|
-
export { useCurrentViewModel, } from '../hooks/useCurrentViewModel';
|
|
7
|
-
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from '../hooks/useLikeC4Model';
|
|
6
|
+
export { type CurrentViewModel, useCurrentViewModel, useOptionalCurrentViewModel, } from '../hooks/useCurrentViewModel';
|
|
7
|
+
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, useOptionalLikeC4Model, } from '../hooks/useLikeC4Model';
|
|
8
8
|
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from '../hooks/useLikeC4Project';
|
|
9
9
|
export { useLikeC4Styles, } from '../hooks/useLikeC4Styles';
|
|
10
10
|
export { useSetState } from '../hooks/useSetState';
|
package/dist/custom/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from './customNodes';
|
|
|
3
3
|
export * from './hooks';
|
|
4
4
|
export * from './primitives';
|
|
5
5
|
export type { BaseEdge, BaseEdgeData, BaseEdgeProps, BaseEdgePropsWithData, BaseNode, BaseNodeData, BaseNodeProps, BaseNodePropsWithData, } from '../base/types';
|
|
6
|
-
export type {
|
|
6
|
+
export type { DiagramNodeWithNavigate, ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, LikeC4DiagramEventHandlers, LikeC4DiagramProperties, NodeRenderers, OnCanvasClick, OnEdgeClick, OnNavigateTo, OnNodeClick, OpenSourceParams, PaddingUnit, PaddingWithUnit, ViewPadding, WhereOperator, } from '../LikeC4Diagram.props';
|
|
7
7
|
export { Base } from '../base/Base';
|
|
8
8
|
export type { Types } from '../likec4diagram/types';
|
|
9
9
|
export { type EnabledFeatures, IfEnabled, IfNotEnabled, IfNotReadOnly, IfReadOnly, useEnabledFeatures, } from '../context/DiagramFeatures';
|
package/dist/custom/index.js
CHANGED
|
@@ -5,28 +5,16 @@ export { Overlay } from '../overlays/overlay/Overlay.js';
|
|
|
5
5
|
export { PortalToContainer } from '../components/PortalToContainer.js';
|
|
6
6
|
export { ShadowRoot } from '../shadowroot/ShadowRoot.js';
|
|
7
7
|
export { FramerMotionConfig } from '../context/FramerMotionConfig.js';
|
|
8
|
+
export { CompoundActionButton } from '../base-primitives/compound/CompoundActionButton.js';
|
|
8
9
|
export { CompoundActions } from '../likec4diagram/custom/nodes/CompoundActions.js';
|
|
9
10
|
export { CompoundDeploymentNode, CompoundDetailsButtonWithHandler, CompoundElementNode, DeploymentNode, ElementDetailsButtonWithHandler, ElementNode, ViewGroupNode } from '../likec4diagram/custom/nodes/nodes.js';
|
|
10
11
|
export { CompoundDeploymentToolbar, CompoundElementToolbar } from '../likec4diagram/custom/nodes/toolbar/CompoundToolbar.js';
|
|
11
|
-
export { DeploymentElementActions, ElementActions } from '../likec4diagram/custom/nodes/ElementActions.js';
|
|
12
|
-
export { DeploymentElementToolbar, ElementToolbar } from '../likec4diagram/custom/nodes/toolbar/ElementToolbar.js';
|
|
13
|
-
export { SequenceActorNode, SequenceParallelArea } from '../likec4diagram/custom/nodes/SequenceActorNode.js';
|
|
14
|
-
export { Toolbar } from '../likec4diagram/custom/nodes/toolbar/Toolbar.js';
|
|
15
|
-
export { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
16
|
-
export { useCurrentView, useCurrentViewId } from '../hooks/useCurrentView.js';
|
|
17
|
-
export { useDiagram, useDiagramActorRef } from '../hooks/safeContext.js';
|
|
18
|
-
export { useDiagramContext, useOnDiagramEvent } from '../hooks/useDiagram.js';
|
|
19
|
-
export { useCurrentViewModel } from '../hooks/useCurrentViewModel.js';
|
|
20
|
-
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from '../hooks/useLikeC4Model.js';
|
|
21
|
-
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from '../hooks/useLikeC4Project.js';
|
|
22
|
-
export { useLikeC4Styles } from '../hooks/useLikeC4Styles.js';
|
|
23
|
-
export { useSetState } from '../hooks/useSetState.js';
|
|
24
|
-
export { useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
25
|
-
export { CompoundActionButton } from '../base-primitives/compound/CompoundActionButton.js';
|
|
26
12
|
export { CompoundDetailsButton } from '../base-primitives/compound/CompoundDetailsButton.js';
|
|
27
13
|
export { CompoundNodeContainer } from '../base-primitives/compound/CompoundNodeContainer.js';
|
|
28
14
|
export { CompoundTitle } from '../base-primitives/compound/CompoundTitle.js';
|
|
29
15
|
export { DefaultHandles } from '../base-primitives/NodeHandles.js';
|
|
16
|
+
export { DeploymentElementActions, ElementActions } from '../likec4diagram/custom/nodes/ElementActions.js';
|
|
17
|
+
export { DeploymentElementToolbar, ElementToolbar } from '../likec4diagram/custom/nodes/toolbar/ElementToolbar.js';
|
|
30
18
|
export { ElementActionButtons } from '../base-primitives/element/ElementActionButtons.js';
|
|
31
19
|
export { ElementData } from '../base-primitives/element/ElementData.js';
|
|
32
20
|
export { ElementDetailsButton } from '../base-primitives/element/ElementDetailsButton.js';
|
|
@@ -34,5 +22,18 @@ export { ElementNodeContainer } from '../base-primitives/element/ElementNodeCont
|
|
|
34
22
|
export { ElementShape } from '../base-primitives/element/ElementShape.js';
|
|
35
23
|
export { ElementTag, ElementTags } from '../base-primitives/element/ElementTags.js';
|
|
36
24
|
export { Markdown } from '../base-primitives/Markdown.js';
|
|
25
|
+
export { SequenceActorNode, SequenceParallelArea } from '../likec4diagram/custom/nodes/SequenceActorNode.js';
|
|
26
|
+
export { Toolbar } from '../likec4diagram/custom/nodes/toolbar/Toolbar.js';
|
|
37
27
|
export { memoEdge } from '../base-primitives/memoEdge.js';
|
|
38
28
|
export { memoNode } from '../base-primitives/memoNode.js';
|
|
29
|
+
export { useCurrentView, useCurrentViewId } from '../hooks/useCurrentView.js';
|
|
30
|
+
export { useCurrentViewModel } from '../hooks/useCurrentViewModel.js';
|
|
31
|
+
export { useDiagram, useDiagramActorRef } from '../hooks/safeContext.js';
|
|
32
|
+
export { useDiagramContext, useOnDiagramEvent } from '../hooks/useDiagram.js';
|
|
33
|
+
export { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
34
|
+
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from '../hooks/useLikeC4Project.js';
|
|
35
|
+
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from '../hooks/useLikeC4Model.js';
|
|
36
|
+
export { useLikeC4Styles } from '../hooks/useLikeC4Styles.js';
|
|
37
|
+
export { useOptionalCurrentViewModel, useOptionalLikeC4Model } from '../context/LikeC4ModelContext.js';
|
|
38
|
+
export { useSetState } from '../hooks/useSetState.js';
|
|
39
|
+
export { useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as t from '@likec4/core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Callbacks from LikeC4 Editor.
|
|
4
|
+
*/
|
|
5
|
+
export interface LikeC4EditorCallbacks {
|
|
6
|
+
/**
|
|
7
|
+
* Fetch a view by its ID and layout type.
|
|
8
|
+
*
|
|
9
|
+
* @param viewId - The ID of the view to fetch.
|
|
10
|
+
* @param layout - The layout type to use when fetching the view.
|
|
11
|
+
*/
|
|
12
|
+
fetchView(viewId: t.ViewId, layout?: t.LayoutType): t.LayoutedView | Promise<t.LayoutedView>;
|
|
13
|
+
/**
|
|
14
|
+
* Callback invoked when the view changes.
|
|
15
|
+
*/
|
|
16
|
+
handleChange(viewId: t.ViewId, change: t.ViewChange): void | Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function createLikeC4Editor(callbacks: LikeC4EditorCallbacks): LikeC4EditorCallbacks;
|
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
import { PropsWithChildren
|
|
2
|
-
import
|
|
3
|
-
export type LikeC4EditorPort = {
|
|
4
|
-
/**
|
|
5
|
-
* Fetch a view by its ID and layout type.
|
|
6
|
-
*
|
|
7
|
-
* @param viewId - The ID of the view to fetch.
|
|
8
|
-
* @param layout - The layout type to use when fetching the view.
|
|
9
|
-
*/
|
|
10
|
-
fetchView(viewId: t.ViewId, layout?: t.LayoutType): t.LayoutedView | Promise<t.LayoutedView>;
|
|
11
|
-
/**
|
|
12
|
-
* Callback invoked when the view changes.
|
|
13
|
-
*/
|
|
14
|
-
handleChange(viewId: t.ViewId, change: t.ViewChange): void | Promise<void>;
|
|
15
|
-
};
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { LikeC4EditorCallbacks } from './LikeC4EditorCallbacks';
|
|
16
3
|
export type LikeC4EditorProviderProps = PropsWithChildren<{
|
|
17
|
-
editor:
|
|
4
|
+
editor: LikeC4EditorCallbacks;
|
|
18
5
|
}>;
|
|
19
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Provider for the LikeC4 Editor.
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
*
|
|
11
|
+
* // Not required to use memo for editor callbacks
|
|
12
|
+
* const editor = createLikeC4Editor({
|
|
13
|
+
* fetchView: async (viewId, layout) => {
|
|
14
|
+
* // fetch view logic
|
|
15
|
+
* },
|
|
16
|
+
* handleChange: (viewId, change) => {
|
|
17
|
+
* // handle change logic
|
|
18
|
+
* }
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* <LikeC4EditorProvider
|
|
22
|
+
* editor={editor}>
|
|
23
|
+
* <App />
|
|
24
|
+
* </LikeC4EditorProvider>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
20
27
|
export declare function LikeC4EditorProvider({ children, editor }: LikeC4EditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* Component that ensures the editor context is available.
|
|
30
|
+
*
|
|
31
|
+
* @param children - The children to render.
|
|
32
|
+
*/
|
|
21
33
|
export declare function EnsureEditorContext({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
-
export declare function
|
|
34
|
+
export declare function useOptionalLikeC4Editor(): LikeC4EditorCallbacks | null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { useContext, createContext } from 'react';
|
|
3
3
|
|
|
4
4
|
const LikeC4EditorReactContext = createContext(null);
|
|
5
5
|
function LikeC4EditorProvider({ children, editor }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(LikeC4EditorReactContext.Provider, { value: editor, children });
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function useOptionalLikeC4Editor() {
|
|
9
9
|
return useContext(LikeC4EditorReactContext);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export { LikeC4EditorProvider,
|
|
12
|
+
export { LikeC4EditorProvider, useOptionalLikeC4Editor };
|
|
@@ -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,6 +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 = castDraft(map(controlPoints, convertPoint));
|
|
147
148
|
draft.controlPoints = controlPoints;
|
|
148
149
|
if (edge.labelBBox) {
|
|
149
150
|
draft.labelBBox.x = labelPos.x;
|
|
@@ -165,8 +166,8 @@ function edgeControlPoints(source, target) {
|
|
|
165
166
|
const loopSize = 80;
|
|
166
167
|
const centerOfTopBoundary = vector(0, source.height || 0).multiply(-0.5).add(sourceCenter);
|
|
167
168
|
return [
|
|
168
|
-
centerOfTopBoundary.add(vector(-loopSize / 2.5, -loopSize)).
|
|
169
|
-
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()
|
|
170
171
|
];
|
|
171
172
|
}
|
|
172
173
|
const sourceToTargetVector = targetCenter.subtract(sourceCenter);
|
|
@@ -174,8 +175,8 @@ function edgeControlPoints(source, target) {
|
|
|
174
175
|
const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.multiply(-1));
|
|
175
176
|
const sourceToTarget = targetBorderPoint.subtract(sourceBorderPoint);
|
|
176
177
|
return [
|
|
177
|
-
sourceBorderPoint.add(sourceToTarget.multiply(0.4)).
|
|
178
|
-
sourceBorderPoint.add(sourceToTarget.multiply(0.6)).
|
|
178
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.4)).trunc().toObject(),
|
|
179
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.6)).trunc().toObject()
|
|
179
180
|
];
|
|
180
181
|
}
|
|
181
182
|
|