@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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ActionFunction, LogAction, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, DoneActorEvent, ErrorActorEvent } from 'xstate';
|
|
2
|
+
import { Context, Events, EmittedEvents, AdhocViewServiceActor } from './actor.types';
|
|
3
|
+
import { AdhocViewPredicate } from '@likec4/core/compute-view';
|
|
4
|
+
import { LayoutedElementView } from '@likec4/core';
|
|
5
|
+
export declare const emitViewUpdate: () => ActionFunction<Context, Events, Events, undefined, never, never, never, never, EmittedEvents>;
|
|
6
|
+
export declare const layouter: {
|
|
7
|
+
initial: string;
|
|
8
|
+
states: {
|
|
9
|
+
idle: {
|
|
10
|
+
id: string;
|
|
11
|
+
entry: LogAction<Context, Events, undefined, Events>;
|
|
12
|
+
exit: LogAction<Context, Events, undefined, Events>;
|
|
13
|
+
on: {
|
|
14
|
+
layout: {
|
|
15
|
+
target: "#layouter-call";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
call: {
|
|
20
|
+
id: string;
|
|
21
|
+
entry: LogAction<Context, Events, undefined, Events>;
|
|
22
|
+
exit: LogAction<Context, Events, undefined, Events>;
|
|
23
|
+
invoke: {
|
|
24
|
+
src: "service";
|
|
25
|
+
input: ({ context }: {
|
|
26
|
+
context: Context;
|
|
27
|
+
event: Events;
|
|
28
|
+
self: ActorRef<MachineSnapshot<Context, Events, Record<string, AnyActorRef>, StateValue, string, unknown, any, any>, Events, AnyEventObject>;
|
|
29
|
+
}) => {
|
|
30
|
+
predicates: AdhocViewPredicate[];
|
|
31
|
+
};
|
|
32
|
+
onDone: {
|
|
33
|
+
target: "#layouter-idle";
|
|
34
|
+
actions: ( ActionFunction<Context, DoneActorEvent<{
|
|
35
|
+
view: LayoutedElementView;
|
|
36
|
+
}, string>, Events, undefined, {
|
|
37
|
+
src: "service";
|
|
38
|
+
logic: AdhocViewServiceActor;
|
|
39
|
+
id: string | undefined;
|
|
40
|
+
}, never, never, never, never> | ActionFunction<Context, DoneActorEvent<{
|
|
41
|
+
view: LayoutedElementView;
|
|
42
|
+
}, string>, Events, undefined, never, never, never, never, EmittedEvents>)[];
|
|
43
|
+
};
|
|
44
|
+
onError: {
|
|
45
|
+
target: "#layouter-idle";
|
|
46
|
+
actions: LogAction<Context, ErrorActorEvent<unknown, string>, undefined, Events>[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { objectHash } from '@likec4/core/utils';
|
|
2
|
+
import { piped, filter, map } from 'remeda';
|
|
3
|
+
import { log, assign, emit } from 'xstate';
|
|
4
|
+
import { machine, ruleToPredicate } from './actor.types.js';
|
|
5
|
+
|
|
6
|
+
const to = {
|
|
7
|
+
idle: { target: "#layouter-idle" },
|
|
8
|
+
call: { target: "#layouter-call" }
|
|
9
|
+
};
|
|
10
|
+
const idle = machine.createStateConfig({
|
|
11
|
+
id: to.idle.target.substring(1),
|
|
12
|
+
entry: log("entry idle ->"),
|
|
13
|
+
exit: log(" -> idle exit "),
|
|
14
|
+
on: {
|
|
15
|
+
"layout": {
|
|
16
|
+
...to.call
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const emitViewUpdate = () => machine.emit({ type: "view.update" });
|
|
21
|
+
const selectEnabled = piped(
|
|
22
|
+
filter((rule) => rule.enabled),
|
|
23
|
+
map(ruleToPredicate)
|
|
24
|
+
);
|
|
25
|
+
const call = machine.createStateConfig({
|
|
26
|
+
id: to.call.target.substring(1),
|
|
27
|
+
entry: log("entry call ->"),
|
|
28
|
+
exit: log(" -> call exit "),
|
|
29
|
+
invoke: {
|
|
30
|
+
src: "service",
|
|
31
|
+
input: ({ context }) => ({
|
|
32
|
+
predicates: selectEnabled(context.rules)
|
|
33
|
+
}),
|
|
34
|
+
onDone: {
|
|
35
|
+
actions: [
|
|
36
|
+
assign({
|
|
37
|
+
view: ({ context, event }) => {
|
|
38
|
+
const id = objectHash(selectEnabled(context.rules));
|
|
39
|
+
return {
|
|
40
|
+
...event.output.view,
|
|
41
|
+
hash: id,
|
|
42
|
+
id
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
error: void 0
|
|
46
|
+
}),
|
|
47
|
+
emit({ type: "view.update" })
|
|
48
|
+
],
|
|
49
|
+
...to.idle
|
|
50
|
+
},
|
|
51
|
+
onError: {
|
|
52
|
+
actions: [
|
|
53
|
+
log(({ event }) => `error: ${event.error}`),
|
|
54
|
+
assign({
|
|
55
|
+
error: ({ event }) => `${event.error}`
|
|
56
|
+
})
|
|
57
|
+
],
|
|
58
|
+
...to.idle
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const layouter = machine.createStateConfig({
|
|
63
|
+
initial: "idle",
|
|
64
|
+
states: {
|
|
65
|
+
idle,
|
|
66
|
+
call
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export { emitViewUpdate, layouter };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AdhocViewPredicate } from '@likec4/core/compute-view';
|
|
2
|
+
import { Fqn, LayoutedElementView, ModelFqnExpr } from '@likec4/core/types';
|
|
3
|
+
import { PromiseActorLogic } from 'xstate/actors';
|
|
4
|
+
import { SetupReturn, NonReducibleUnknown, MetaObject } from 'xstate';
|
|
5
|
+
type CalcAdhocViewInput = {
|
|
6
|
+
predicates: AdhocViewPredicate[];
|
|
7
|
+
};
|
|
8
|
+
type CalcAdhocViewOutput = {
|
|
9
|
+
view: LayoutedElementView;
|
|
10
|
+
};
|
|
11
|
+
export type AdhocViewService = {
|
|
12
|
+
process: (input: CalcAdhocViewInput) => Promise<CalcAdhocViewOutput>;
|
|
13
|
+
};
|
|
14
|
+
export type AdhocViewServiceActor = PromiseActorLogic<CalcAdhocViewOutput, CalcAdhocViewInput>;
|
|
15
|
+
export type Input = {};
|
|
16
|
+
export type AdhocRule = {
|
|
17
|
+
id: string;
|
|
18
|
+
expr: ModelFqnExpr.Ref;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
type: 'include' | 'exclude';
|
|
21
|
+
};
|
|
22
|
+
export declare function ruleToPredicate(rule: AdhocRule): AdhocViewPredicate;
|
|
23
|
+
export interface Context {
|
|
24
|
+
view: LayoutedElementView | null;
|
|
25
|
+
error: string | undefined;
|
|
26
|
+
rules: AdhocRule[];
|
|
27
|
+
}
|
|
28
|
+
export type EmittedEvents = {
|
|
29
|
+
type: 'navigate.to';
|
|
30
|
+
} | {
|
|
31
|
+
type: 'view.update';
|
|
32
|
+
} | {
|
|
33
|
+
type: 'click.element';
|
|
34
|
+
id: Fqn;
|
|
35
|
+
};
|
|
36
|
+
export type Events = {
|
|
37
|
+
type: 'toggle.element';
|
|
38
|
+
id: Fqn;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'click.element';
|
|
41
|
+
id: Fqn;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'toggle.rule';
|
|
44
|
+
ruleId: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'delete.rule';
|
|
47
|
+
ruleId: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'select.open';
|
|
50
|
+
} | {
|
|
51
|
+
type: 'select.close';
|
|
52
|
+
} | {
|
|
53
|
+
type: 'layout';
|
|
54
|
+
} | {
|
|
55
|
+
type: 'dispose';
|
|
56
|
+
};
|
|
57
|
+
export declare const machine: SetupReturn<Context, Events, {
|
|
58
|
+
service: AdhocViewServiceActor;
|
|
59
|
+
}, {}, {}, {
|
|
60
|
+
hasView: unknown;
|
|
61
|
+
}, never, "hasView", NonReducibleUnknown, NonReducibleUnknown, EmittedEvents, MetaObject>;
|
|
62
|
+
export declare function createContext(): Context;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { setup } from 'xstate';
|
|
2
|
+
|
|
3
|
+
function ruleToPredicate(rule) {
|
|
4
|
+
return rule.type === "include" ? { include: [rule.expr] } : { exclude: [rule.expr] };
|
|
5
|
+
}
|
|
6
|
+
const machine = setup({
|
|
7
|
+
types: {
|
|
8
|
+
context: {},
|
|
9
|
+
tags: "",
|
|
10
|
+
// input: {} as Input,
|
|
11
|
+
events: {},
|
|
12
|
+
emitted: {}
|
|
13
|
+
},
|
|
14
|
+
actors: {
|
|
15
|
+
service: {}
|
|
16
|
+
},
|
|
17
|
+
guards: {
|
|
18
|
+
hasView: ({ context }) => context.view !== null
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
function createContext() {
|
|
22
|
+
return {
|
|
23
|
+
view: null,
|
|
24
|
+
error: void 0,
|
|
25
|
+
rules: []
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { createContext, machine, ruleToPredicate };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Fqn } from '@likec4/core';
|
|
2
|
+
import { StoreSnapshot, Store } from '@xstate/store';
|
|
3
|
+
import { TreeCollection } from '@zag-js/collection';
|
|
4
|
+
import { PropsWithChildren } from 'react';
|
|
5
|
+
import { TreeNodeData } from '../useElementsTree';
|
|
6
|
+
type EditorPanelState = {
|
|
7
|
+
searchInput: string;
|
|
8
|
+
expandedValue: string[];
|
|
9
|
+
collection: TreeCollection<TreeNodeData>;
|
|
10
|
+
};
|
|
11
|
+
declare const createEditorPanelStore: ({ initial, sideEffects, }: {
|
|
12
|
+
initial: TreeCollection<TreeNodeData>;
|
|
13
|
+
sideEffects: {
|
|
14
|
+
onElementStateClick: (payload: {
|
|
15
|
+
id: Fqn;
|
|
16
|
+
}) => void;
|
|
17
|
+
};
|
|
18
|
+
}) => Store<EditorPanelState, {
|
|
19
|
+
inputChange: {
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
inputKeyDown: {};
|
|
23
|
+
modelUpdate: {
|
|
24
|
+
collection: TreeCollection<TreeNodeData>;
|
|
25
|
+
};
|
|
26
|
+
elementClick: {
|
|
27
|
+
id: Fqn;
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
type: "inputKeyDown";
|
|
31
|
+
}>;
|
|
32
|
+
export type EditorPanelStore = ReturnType<typeof createEditorPanelStore>;
|
|
33
|
+
export declare const EditorPanelStoreProvider: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function selectEditorPanelState<T>(selector: (state: EditorPanelState) => T): [
|
|
35
|
+
selector: (snapshot: StoreSnapshot<EditorPanelState>) => T,
|
|
36
|
+
compare: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean
|
|
37
|
+
];
|
|
38
|
+
export declare function selectEditorPanelState<T>(selector: (state: EditorPanelState) => T, compare: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean): [
|
|
39
|
+
selector: (snapshot: StoreSnapshot<EditorPanelState>) => T,
|
|
40
|
+
compare: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean
|
|
41
|
+
];
|
|
42
|
+
export declare function useEditorPanelStore(): Store<EditorPanelState, {
|
|
43
|
+
inputChange: {
|
|
44
|
+
value: string;
|
|
45
|
+
};
|
|
46
|
+
inputKeyDown: {};
|
|
47
|
+
modelUpdate: {
|
|
48
|
+
collection: TreeCollection<TreeNodeData>;
|
|
49
|
+
};
|
|
50
|
+
elementClick: {
|
|
51
|
+
id: Fqn;
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
type: "inputKeyDown";
|
|
55
|
+
}>;
|
|
56
|
+
export declare function useEditorPanelState<T>(arg1: readonly [
|
|
57
|
+
(snapshot: StoreSnapshot<EditorPanelState>) => T,
|
|
58
|
+
(a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean
|
|
59
|
+
]): T;
|
|
60
|
+
export declare function useEditorPanelState<T>(selector: (snapshot: StoreSnapshot<EditorPanelState>) => T, compare?: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean): T;
|
|
61
|
+
/**
|
|
62
|
+
* Hook to subscribe to editor panel events
|
|
63
|
+
* @param args - The event name and handler function
|
|
64
|
+
* @example
|
|
65
|
+
* useOnEditorPanelEvent('inputKeyDown', () => {
|
|
66
|
+
* console.log('Input key down event')
|
|
67
|
+
* })
|
|
68
|
+
*/
|
|
69
|
+
export declare function useOnEditorPanelEvent(...args: Parameters<EditorPanelStore['on']>): void;
|
|
70
|
+
/**
|
|
71
|
+
* Hook to access the editor panel store trigger or create a wrapped trigger function
|
|
72
|
+
*
|
|
73
|
+
* @overload
|
|
74
|
+
* @returns The store trigger object
|
|
75
|
+
*
|
|
76
|
+
* @overload
|
|
77
|
+
* @template T - The parameter types for the wrapped trigger function
|
|
78
|
+
* @param trigger - A function that receives the store trigger as the first parameter
|
|
79
|
+
* @returns A wrapped function that calls the trigger with the store trigger prepended
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Get the trigger object directly
|
|
83
|
+
* const trigger = useEditorPanelTrigger()
|
|
84
|
+
* trigger.inputChange({ value: 'search' })
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* // Create a wrapped trigger function
|
|
88
|
+
* const handleInputChange = useEditorPanelTrigger((trigger, value: string) => {
|
|
89
|
+
* trigger.inputChange({ value })
|
|
90
|
+
* })
|
|
91
|
+
* handleInputChange('search')
|
|
92
|
+
*/
|
|
93
|
+
export declare function useEditorPanelTrigger(): EditorPanelStore['trigger'];
|
|
94
|
+
export declare function useEditorPanelTrigger<T extends any[]>(trigger: (...params: [trigger: EditorPanelStore['trigger'], ...T]) => void): (...args: T) => void;
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createStore, shallowEqual } from '@xstate/store';
|
|
3
|
+
import { useRef, useMemo, useEffect, createContext, useContext } from 'react';
|
|
4
|
+
import { hasAtLeast } from 'remeda';
|
|
5
|
+
import { useAdhocEditorActor } from '../hooks.js';
|
|
6
|
+
import { createTreeCollection } from '../useElementsTree.js';
|
|
7
|
+
import { deriveElementStates } from './utils.js';
|
|
8
|
+
import { useLikeC4Model } from '../../hooks/useLikeC4Model.js';
|
|
9
|
+
import { useUpdateEffect } from '../../hooks/useUpdateEffect.js';
|
|
10
|
+
import { x as xstateStoreReact_cjsExports } from '../../_virtual/xstate-store-react.cjs.js';
|
|
11
|
+
import { useCallbackRef } from '../../hooks/useCallbackRef.js';
|
|
12
|
+
|
|
13
|
+
const createEditorPanelStore = ({
|
|
14
|
+
initial,
|
|
15
|
+
sideEffects
|
|
16
|
+
}) => createStore({
|
|
17
|
+
context: {
|
|
18
|
+
searchInput: "",
|
|
19
|
+
expandedValue: [],
|
|
20
|
+
collection: initial
|
|
21
|
+
},
|
|
22
|
+
emits: {
|
|
23
|
+
inputKeyDown: (payload) => {
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
on: {
|
|
27
|
+
"inputChange": (context, event) => {
|
|
28
|
+
return {
|
|
29
|
+
...context,
|
|
30
|
+
searchInput: event.value
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
"inputKeyDown": (context, event, enqueue) => {
|
|
34
|
+
enqueue.emit.inputKeyDown();
|
|
35
|
+
},
|
|
36
|
+
"modelUpdate": (context, event) => {
|
|
37
|
+
return {
|
|
38
|
+
...context,
|
|
39
|
+
collection: event.collection
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
"elementClick": (context, event, enqueue) => {
|
|
43
|
+
const current = context.collection.findNode(event.id);
|
|
44
|
+
const path = context.collection.getIndexPath(event.id);
|
|
45
|
+
if (!current || !path) {
|
|
46
|
+
return context;
|
|
47
|
+
}
|
|
48
|
+
enqueue.effect(() => {
|
|
49
|
+
sideEffects.onElementStateClick({ id: event.id });
|
|
50
|
+
});
|
|
51
|
+
return context;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const EditorPanelStoreContext = createContext(null);
|
|
56
|
+
const EditorPanelStoreProvider = (props) => {
|
|
57
|
+
const likec4model = useLikeC4Model();
|
|
58
|
+
const likec4modelRef = useRef(likec4model);
|
|
59
|
+
likec4modelRef.current = likec4model;
|
|
60
|
+
const actorRef = useAdhocEditorActor();
|
|
61
|
+
const store = useMemo(() => createEditorPanelStore({
|
|
62
|
+
initial: createTreeCollection(likec4model),
|
|
63
|
+
sideEffects: {
|
|
64
|
+
onElementStateClick({ id }) {
|
|
65
|
+
actorRef.send({ type: "toggle.element", id });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}), [actorRef]);
|
|
69
|
+
useUpdateEffect(() => {
|
|
70
|
+
store.trigger.modelUpdate({
|
|
71
|
+
collection: createTreeCollection(
|
|
72
|
+
likec4model,
|
|
73
|
+
deriveElementStates(actorRef.getSnapshot().context)
|
|
74
|
+
)
|
|
75
|
+
});
|
|
76
|
+
}, [likec4model]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const subscription = actorRef.on("view.update", () => {
|
|
79
|
+
store.trigger.modelUpdate({
|
|
80
|
+
collection: createTreeCollection(
|
|
81
|
+
likec4modelRef.current,
|
|
82
|
+
deriveElementStates(actorRef.getSnapshot().context)
|
|
83
|
+
)
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
return () => {
|
|
87
|
+
subscription.unsubscribe();
|
|
88
|
+
};
|
|
89
|
+
}, [actorRef]);
|
|
90
|
+
return /* @__PURE__ */ jsx(EditorPanelStoreContext.Provider, { value: store, children: props.children });
|
|
91
|
+
};
|
|
92
|
+
function selectEditorPanelState(selector, compare) {
|
|
93
|
+
return [
|
|
94
|
+
(snapshot) => selector(snapshot.context),
|
|
95
|
+
compare ?? shallowEqual
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
function useEditorPanelStore() {
|
|
99
|
+
return useContext(EditorPanelStoreContext);
|
|
100
|
+
}
|
|
101
|
+
function useEditorPanelState(...args) {
|
|
102
|
+
const store = useEditorPanelStore();
|
|
103
|
+
let selector, compare;
|
|
104
|
+
if (args.length === 2) {
|
|
105
|
+
[selector, compare] = args;
|
|
106
|
+
} else if (args.length === 1 && Array.isArray(args[0]) && hasAtLeast(args[0], 2)) {
|
|
107
|
+
[selector, compare] = args[0];
|
|
108
|
+
} else if (args.length === 1 && Array.isArray(args[0]) && hasAtLeast(args[0], 1)) {
|
|
109
|
+
[selector, compare] = [args[0], shallowEqual];
|
|
110
|
+
} else if (args.length === 1 && typeof args[0] === "function") {
|
|
111
|
+
[selector, compare] = [args[0], shallowEqual];
|
|
112
|
+
} else {
|
|
113
|
+
throw new Error("Invalid arguments for useEditorPanelState");
|
|
114
|
+
}
|
|
115
|
+
return xstateStoreReact_cjsExports.useSelector(store, selector, compare);
|
|
116
|
+
}
|
|
117
|
+
function useOnEditorPanelEvent(...args) {
|
|
118
|
+
const store = useEditorPanelStore();
|
|
119
|
+
const event = args[0];
|
|
120
|
+
const handler = useCallbackRef(args[1]);
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
const subscription = store.on(event, handler);
|
|
123
|
+
return () => {
|
|
124
|
+
subscription.unsubscribe();
|
|
125
|
+
};
|
|
126
|
+
}, [event, store]);
|
|
127
|
+
}
|
|
128
|
+
function useEditorPanelTrigger(...args) {
|
|
129
|
+
const store = useEditorPanelStore();
|
|
130
|
+
if (args.length === 0) {
|
|
131
|
+
return store.trigger;
|
|
132
|
+
}
|
|
133
|
+
const trigger = args[0];
|
|
134
|
+
return useCallbackRef((...args2) => {
|
|
135
|
+
trigger(...[store.trigger, ...args2]);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { EditorPanelStoreProvider, selectEditorPanelState, useEditorPanelState, useEditorPanelStore, useEditorPanelTrigger, useOnEditorPanelEvent };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fqn } from '@likec4/core/types';
|
|
2
|
+
import { Context } from './actor.types';
|
|
3
|
+
/**
|
|
4
|
+
* Derives the state of elements in the view based on the active rules.
|
|
5
|
+
*
|
|
6
|
+
* Categorizes elements into:
|
|
7
|
+
* - Explicitly included: Elements that are both in the view and have an enabled include rule
|
|
8
|
+
* - Implicitly included: Elements in the view without an explicit include rule
|
|
9
|
+
* - Excluded: Elements with an enabled exclude rule that are not in the view
|
|
10
|
+
*/
|
|
11
|
+
export declare function deriveElementStates({ rules, view }: Pick<Context, 'rules' | 'view'>): {
|
|
12
|
+
includedExplicit: Set<Fqn>;
|
|
13
|
+
includedImplicit: Set<Fqn>;
|
|
14
|
+
excluded: Set<Fqn>;
|
|
15
|
+
disabled: Set<Fqn>;
|
|
16
|
+
};
|
|
17
|
+
export type ElementStates = ReturnType<typeof deriveElementStates>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { toSet, difference } from '@likec4/core/utils';
|
|
2
|
+
import { isNonNullish, pipe, filter, map } from 'remeda';
|
|
3
|
+
|
|
4
|
+
function deriveElementStates({ rules, view }) {
|
|
5
|
+
const includedInView = new Set(view ? view.nodes.map((node) => node.modelRef ?? null).filter(isNonNullish) : []);
|
|
6
|
+
const explicits = pipe(
|
|
7
|
+
rules,
|
|
8
|
+
filter((r) => r.type === "include" && r.enabled),
|
|
9
|
+
map((r) => r.expr.ref.model),
|
|
10
|
+
toSet()
|
|
11
|
+
);
|
|
12
|
+
const excluded = pipe(
|
|
13
|
+
rules,
|
|
14
|
+
filter((r) => r.type === "exclude" && r.enabled),
|
|
15
|
+
map((r) => r.expr.ref.model),
|
|
16
|
+
toSet()
|
|
17
|
+
);
|
|
18
|
+
const disabled = pipe(
|
|
19
|
+
rules,
|
|
20
|
+
filter((r) => !r.enabled),
|
|
21
|
+
map((r) => r.expr.ref.model),
|
|
22
|
+
toSet()
|
|
23
|
+
);
|
|
24
|
+
return {
|
|
25
|
+
disabled,
|
|
26
|
+
includedExplicit: explicits,
|
|
27
|
+
includedImplicit: difference(includedInView, explicits),
|
|
28
|
+
excluded: difference(excluded, includedInView)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { deriveElementStates };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LikeC4Model } from '@likec4/core/model';
|
|
2
|
+
import { ElementShape, Fqn } from '@likec4/core/types';
|
|
3
|
+
import { TreeCollection } from '@zag-js/collection';
|
|
4
|
+
import { ElementStates } from './state/utils';
|
|
5
|
+
import * as tree from '@zag-js/tree-view';
|
|
6
|
+
export interface TreeNodeData {
|
|
7
|
+
id: Fqn;
|
|
8
|
+
title: string;
|
|
9
|
+
icon?: string | undefined;
|
|
10
|
+
shape: ElementShape;
|
|
11
|
+
children: TreeNodeData[];
|
|
12
|
+
state: 'include-explicit' | 'include-implicit' | 'exclude' | 'disabled' | 'not-present';
|
|
13
|
+
}
|
|
14
|
+
export interface ElementsTreeProps extends tree.Props<TreeNodeData> {
|
|
15
|
+
}
|
|
16
|
+
export declare function createTreeCollection(model: LikeC4Model, states?: ElementStates): TreeCollection<TreeNodeData>;
|
|
17
|
+
export type TreeApi = tree.Api<any, TreeNodeData>;
|
|
18
|
+
export declare function useElementsTree(): TreeApi;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { compareNaturalHierarchically, toArray } from '@likec4/core/utils';
|
|
2
|
+
import { useMachine, normalizeProps } from '@zag-js/react';
|
|
3
|
+
import * as tree from '@zag-js/tree-view';
|
|
4
|
+
import { useDeferredValue, useMemo, useState, useEffect } from 'react';
|
|
5
|
+
import { difference, hasAtLeast, sort } from 'remeda';
|
|
6
|
+
import { useId } from '../hooks/useId.js';
|
|
7
|
+
import { useEditorPanelState, useOnEditorPanelEvent, selectEditorPanelState } from './state/panel.js';
|
|
8
|
+
|
|
9
|
+
function getElementState(id, states) {
|
|
10
|
+
if (!states) {
|
|
11
|
+
return "not-present";
|
|
12
|
+
}
|
|
13
|
+
if (states.disabled.has(id)) {
|
|
14
|
+
return "disabled";
|
|
15
|
+
}
|
|
16
|
+
if (states.includedExplicit.has(id)) {
|
|
17
|
+
return "include-explicit";
|
|
18
|
+
}
|
|
19
|
+
if (states.includedImplicit.has(id)) {
|
|
20
|
+
return "include-implicit";
|
|
21
|
+
}
|
|
22
|
+
if (states.excluded.has(id)) {
|
|
23
|
+
return "exclude";
|
|
24
|
+
}
|
|
25
|
+
return "not-present";
|
|
26
|
+
}
|
|
27
|
+
function mapToTreeNodes(elements, states) {
|
|
28
|
+
return toArray(elements).map((el) => ({
|
|
29
|
+
id: el.id,
|
|
30
|
+
title: el.title,
|
|
31
|
+
shape: el.shape,
|
|
32
|
+
icon: el.icon ?? void 0,
|
|
33
|
+
children: mapToTreeNodes(el.children(), states),
|
|
34
|
+
state: getElementState(el.id, states)
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function createTreeCollection(model, states) {
|
|
38
|
+
return tree.collection({
|
|
39
|
+
rootNode: {
|
|
40
|
+
id: "@ROOT",
|
|
41
|
+
title: "",
|
|
42
|
+
shape: "rectangle",
|
|
43
|
+
icon: void 0,
|
|
44
|
+
children: mapToTreeNodes(model.roots(), states),
|
|
45
|
+
state: "not-present"
|
|
46
|
+
},
|
|
47
|
+
nodeToValue(node) {
|
|
48
|
+
return node.id;
|
|
49
|
+
},
|
|
50
|
+
nodeToString(node) {
|
|
51
|
+
return node.title;
|
|
52
|
+
},
|
|
53
|
+
nodeToChildren(node) {
|
|
54
|
+
return node.children;
|
|
55
|
+
},
|
|
56
|
+
isNodeDisabled() {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const select = selectEditorPanelState(
|
|
62
|
+
(s) => ({
|
|
63
|
+
searchInput: s.searchInput.length > 2 ? s.searchInput.toLowerCase() : "",
|
|
64
|
+
collection: s.collection
|
|
65
|
+
}),
|
|
66
|
+
(a, b) => a?.searchInput === b.searchInput && a?.collection.isEqual(b.collection)
|
|
67
|
+
);
|
|
68
|
+
function useElementsTree() {
|
|
69
|
+
const { searchInput, collection } = useEditorPanelState(select);
|
|
70
|
+
const lowerCaseInput = useDeferredValue(searchInput);
|
|
71
|
+
const filteredCollection = useMemo(() => {
|
|
72
|
+
if (!lowerCaseInput) return collection;
|
|
73
|
+
return collection.filter((c) => c.title.toLowerCase().includes(lowerCaseInput));
|
|
74
|
+
}, [collection, lowerCaseInput]);
|
|
75
|
+
const [expandedValue, setExpandedValue] = useState([]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (filteredCollection === collection) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
setExpandedValue((current) => {
|
|
81
|
+
const newBranches = difference(filteredCollection.getBranchValues(), current);
|
|
82
|
+
if (hasAtLeast(newBranches, 1)) {
|
|
83
|
+
return sort([...current, ...newBranches], compareNaturalHierarchically());
|
|
84
|
+
}
|
|
85
|
+
return current;
|
|
86
|
+
});
|
|
87
|
+
}, [filteredCollection]);
|
|
88
|
+
const service = useMachine(tree.machine, {
|
|
89
|
+
id: useId(),
|
|
90
|
+
collection: filteredCollection,
|
|
91
|
+
defaultCheckedValue: [],
|
|
92
|
+
defaultSelectedValue: [],
|
|
93
|
+
expandedValue,
|
|
94
|
+
onExpandedChange({ expandedValue: expandedValue2 }) {
|
|
95
|
+
setExpandedValue(expandedValue2);
|
|
96
|
+
},
|
|
97
|
+
// checkedValue,
|
|
98
|
+
// defaultExpandedValue: [],
|
|
99
|
+
// defaultFocusedValue: null,
|
|
100
|
+
// onCheckedChange({ checkedValue }) {
|
|
101
|
+
// console.log({ checkedValue })
|
|
102
|
+
// },
|
|
103
|
+
onFocusChange(details) {
|
|
104
|
+
console.log("Focus change", details);
|
|
105
|
+
},
|
|
106
|
+
onSelectionChange(details) {
|
|
107
|
+
console.log("Selection change", details);
|
|
108
|
+
}
|
|
109
|
+
// expandOnClick,
|
|
110
|
+
// onSelectionChange({ focusedValue, selectedNodes }) {
|
|
111
|
+
// console.log({ focusedValue, selectedNodes })
|
|
112
|
+
// if (selectedNodes.length === 0) {
|
|
113
|
+
// return
|
|
114
|
+
// }
|
|
115
|
+
// api.deselect(selectedNodes.map(n => n.id))
|
|
116
|
+
// },
|
|
117
|
+
});
|
|
118
|
+
service.context.get("focusedValue")?.slice;
|
|
119
|
+
const api = tree.connect(service, normalizeProps);
|
|
120
|
+
api.select;
|
|
121
|
+
useOnEditorPanelEvent("inputKeyDown", () => {
|
|
122
|
+
const first = api.collection.getFirstNode()?.id;
|
|
123
|
+
if (first) {
|
|
124
|
+
api.focus(first);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return api;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { createTreeCollection, useElementsTree };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AdhocRule } from '../state/actor.types';
|
|
2
|
+
export declare function ViewRulesPanel({ rules, onToggle, onDelete, }: {
|
|
3
|
+
rules: AdhocRule[];
|
|
4
|
+
onToggle: (rule: AdhocRule) => void;
|
|
5
|
+
onDelete: (rule: AdhocRule) => void;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/base/const.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const ZIndexes: {
|
|
2
2
|
readonly Compound: 1;
|
|
3
3
|
readonly Edge: 20;
|
|
4
|
+
readonly EdgeLabel: 25;
|
|
4
5
|
readonly Element: 20;
|
|
5
6
|
readonly Max: 30;
|
|
6
7
|
};
|
|
@@ -15,3 +16,4 @@ export declare const FitViewPaddings: {
|
|
|
15
16
|
bottom: "16px";
|
|
16
17
|
};
|
|
17
18
|
};
|
|
19
|
+
export declare const MAX_COMPOUND_DEPTH = 5;
|