@likec4/diagram 1.48.0 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -9
- package/adhoc-editor/package.json +4 -0
- package/dist/LikeC4Diagram.d.ts +2 -1
- package/dist/LikeC4Diagram.js +77 -79
- package/dist/LikeC4Diagram.props.d.ts +9 -1
- package/dist/LikeC4ModelProvider.d.ts +4 -4
- package/dist/LikeC4ModelProvider.js +2 -2
- package/dist/LikeC4ProjectsOverview.d.ts +3 -2
- package/dist/LikeC4ProjectsProvider.d.ts +2 -1
- package/dist/LikeC4ProjectsProvider.js +4 -4
- package/dist/LikeC4Styles.d.ts +2 -1
- package/dist/LikeC4View.d.ts +14 -1
- package/dist/LikeC4View.js +31 -18
- package/dist/ReactLikeC4.d.ts +2 -1
- package/dist/ReactLikeC4.js +3 -1
- package/dist/StaticLikeC4Diagram.d.ts +2 -1
- package/dist/StaticLikeC4Diagram.js +1 -0
- package/dist/_virtual/store-1b2fbb72.cjs.js +3 -0
- package/dist/_virtual/xstate-store-react.cjs.js +5 -0
- package/dist/_virtual/xstate-store-react.cjs2.js +3 -0
- package/dist/adhoc-editor/EditorPanel.d.ts +1 -0
- package/dist/adhoc-editor/EditorPanel.js +105 -0
- package/dist/adhoc-editor/ElementsTree.d.ts +2 -0
- package/dist/adhoc-editor/ElementsTree.js +142 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +1 -1
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +46 -43
- package/dist/adhoc-editor/components/Tree.d.ts +48 -0
- package/dist/adhoc-editor/components/Tree.js +296 -0
- package/dist/adhoc-editor/hooks.d.ts +3 -3
- package/dist/adhoc-editor/hooks.js +5 -23
- package/dist/adhoc-editor/index.d.ts +1 -1
- package/dist/adhoc-editor/index.js +1 -0
- package/dist/adhoc-editor/{ActorProvider.d.ts → state/ActorProvider.d.ts} +1 -3
- package/dist/adhoc-editor/{ActorProvider.js → state/ActorProvider.js} +10 -11
- package/dist/adhoc-editor/state/actor.d.ts +13 -0
- package/dist/adhoc-editor/{actor.editor.d.ts → state/actor.editor.d.ts} +6 -4
- package/dist/adhoc-editor/state/actor.editor.js +205 -0
- package/dist/adhoc-editor/{actor.js → state/actor.js} +2 -6
- package/dist/adhoc-editor/{actor.layouter.d.ts → state/actor.layouter.d.ts} +7 -4
- package/dist/adhoc-editor/{actor.layouter.js → state/actor.layouter.js} +17 -13
- package/dist/adhoc-editor/{actor.types.d.ts → state/actor.types.d.ts} +12 -6
- package/dist/adhoc-editor/{actor.types.js → state/actor.types.js} +8 -1
- package/dist/adhoc-editor/state/panel.d.ts +95 -0
- package/dist/adhoc-editor/state/panel.js +139 -0
- package/dist/adhoc-editor/state/utils.d.ts +17 -0
- package/dist/adhoc-editor/state/utils.js +32 -0
- package/dist/adhoc-editor/useElementsTree.d.ts +18 -0
- package/dist/adhoc-editor/useElementsTree.js +130 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +1 -1
- package/dist/base/const.d.ts +1 -0
- package/dist/base-primitives/compound/CompoundActionButton.js +26 -12
- package/dist/base-primitives/compound/CompoundDetailsButton.js +22 -9
- package/dist/base-primitives/compound/CompoundNodeContainer.js +5 -4
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeLabel.js +3 -4
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +2 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +12 -19
- package/dist/base-primitives/edge/EdgeMarkers.js +3 -3
- package/dist/base-primitives/element/ElementActionButtons.js +35 -10
- package/dist/base-primitives/element/ElementDetailsButton.js +47 -18
- package/dist/base-primitives/element/ElementNodeContainer.d.ts +3 -3
- package/dist/base-primitives/element/ElementNodeContainer.js +23 -10
- package/dist/base-primitives/element/ElementShape.d.ts +4 -4
- package/dist/base-primitives/element/ElementShape.js +71 -8
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/Link.js +3 -3
- package/dist/components/Logo.js +1 -1
- package/dist/components/NavigationPanel.js +2 -4
- package/dist/components/PortalToContainer.js +3 -4
- package/dist/components/RootContainer.js +9 -16
- package/dist/components/ViewNotFound.d.ts +3 -3
- package/dist/components/ViewNotFound.js +30 -26
- package/dist/context/CurrentViewModelProvider.d.ts +2 -0
- package/dist/context/CurrentViewModelProvider.js +12 -0
- package/dist/context/DefaultMantineProvider.d.ts +1 -1
- package/dist/context/DefaultMantineProvider.js +10 -1
- package/dist/context/DiagramEventHandlers.d.ts +5 -5
- package/dist/context/DiagramEventHandlers.js +10 -4
- package/dist/context/DiagramFeatures.d.ts +8 -7
- package/dist/context/DiagramFeatures.js +5 -3
- package/dist/context/FramerMotionConfig.d.ts +1 -3
- package/dist/context/IconRenderer.d.ts +5 -4
- package/dist/context/IconRenderer.js +51 -24
- package/dist/context/LikeC4ModelContext.d.ts +10 -5
- package/dist/context/LikeC4ModelContext.js +11 -3
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/LikeC4ProjectsContext.js +6 -2
- package/dist/context/RootContainerContext.d.ts +10 -3
- package/dist/context/RootContainerContext.js +8 -3
- package/dist/context/TagStylesContext.js +1 -1
- package/dist/custom/index.js +16 -15
- package/dist/editor/LikeC4EditorProvider.js +1 -1
- package/dist/editor/applyChangesToManualLayout.js +7 -7
- package/dist/editor/editorActor.actions.js +20 -20
- package/dist/editor/editorActor.setup.js +1 -1
- package/dist/editor/editorActor.states.js +0 -9
- package/dist/editor/useEditorActorLogic.d.ts +1 -2
- package/dist/editor/useEditorActorLogic.js +8 -11
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/safeContext.d.ts +4 -5
- package/dist/hooks/useCallbackRef.js +7 -6
- package/dist/hooks/useCurrentView.js +5 -10
- package/dist/hooks/useCurrentViewModel.d.ts +2 -6
- package/dist/hooks/useCurrentViewModel.js +3 -7
- package/dist/hooks/useDiagram.d.ts +9 -1
- package/dist/hooks/useDiagram.js +8 -2
- package/dist/hooks/useDiagramCompareLayout.d.ts +5 -5
- package/dist/hooks/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +1 -1
- package/dist/hooks/useLikeC4Model.d.ts +6 -2
- package/dist/hooks/useLikeC4Model.js +7 -9
- package/dist/hooks/useLikeC4Project.d.ts +4 -6
- package/dist/hooks/useLikeC4Project.js +19 -31
- package/dist/hooks/useLikeC4Styles.js +3 -9
- package/dist/hooks/useMantinePortalProps.d.ts +1 -1
- package/dist/hooks/useMediaPrint.d.ts +0 -2
- package/dist/hooks/useOverlaysActor.js +4 -4
- package/dist/hooks/useSearchActor.js +4 -4
- package/dist/index.d.ts +1 -3
- package/dist/index.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -1
- package/dist/likec4diagram/DiagramXYFlow.js +5 -7
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +22 -24
- package/dist/likec4diagram/custom/edges/edges.css.js +2 -1
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +40 -55
- package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +3 -20
- package/dist/likec4diagram/custom/nodes/NodeNotes.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +286 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -2
- package/dist/likec4diagram/custom/nodes/nodes.js +5 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +12 -8
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -28
- package/dist/likec4diagram/state/DiagramActorProvider.js +30 -56
- package/dist/likec4diagram/state/diagram-api.d.ts +11 -0
- package/dist/likec4diagram/state/diagram-api.js +15 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +27 -0
- package/dist/likec4diagram/state/machine.actions.js +78 -21
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +38 -3
- package/dist/likec4diagram/state/machine.js +4 -1
- package/dist/likec4diagram/state/machine.setup.d.ts +19 -2
- package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
- package/dist/likec4diagram/state/machine.state.ready.d.ts +61 -1
- package/dist/likec4diagram/state/machine.state.ready.js +11 -3
- package/dist/likec4diagram/state/utils.d.ts +2 -1
- package/dist/likec4diagram/state/utils.js +1 -1
- package/dist/likec4diagram/types.d.ts +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.d.ts +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +6 -29
- package/dist/likec4diagram/useLayoutConstraints.d.ts +12 -12
- package/dist/likec4diagram/useLayoutConstraints.js +125 -86
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +2 -0
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +7 -2
- package/dist/navigationpanel/NavigationPanel.js +2 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +13 -13
- package/dist/navigationpanel/_common.js +2 -2
- package/dist/navigationpanel/actor.js +1 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
- package/dist/navigationpanel/comparepanel/ComparePanel.js +155 -29
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +264 -0
- package/dist/navigationpanel/controls/DetailsControls.js +4 -4
- package/dist/navigationpanel/controls/LayoutWarning.js +1 -1
- package/dist/navigationpanel/controls/LogoButton.js +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/SearchControl.js +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
- package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -6
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +16 -16
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +1 -1
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/dist/store-1b2fbb72.cjs.js +742 -0
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/react/dist/xstate-store-react.cjs.js +175 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +11 -11
- package/dist/overlays/element-details/ElementDetailsCard.js +44 -45
- package/dist/overlays/element-details/MetadataValue.js +7 -7
- package/dist/overlays/element-details/TabPanelDeployments.js +4 -4
- package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -5
- package/dist/overlays/element-details/TabPanelRelationships.js +4 -5
- package/dist/overlays/element-details/TabPanelStructure.css.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actorContext.d.ts +1 -1
- package/dist/overlays/overlaysActor.js +1 -1
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
- package/dist/overlays/relationship-details/SelectEdge.css.js +4 -4
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -6
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.js +1 -1
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +1 -1
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -1
- package/dist/projects-overview/ProjectsOverview.js +2 -2
- package/dist/projects-overview/ProjectsOverviewXY.d.ts +1 -5
- package/dist/projects-overview/ProjectsOverviewXY.js +1 -1
- package/dist/projects-overview/actor.d.ts +1 -1
- package/dist/projects-overview/context.d.ts +2 -2
- package/dist/projects-overview/context.js +2 -1
- package/dist/projects-overview/custom/nodeTypes.js +1 -1
- package/dist/search/Search.d.ts +2 -1
- package/dist/search/Search.js +108 -87
- package/dist/search/components/ElementsColumn.css.js +3 -3
- package/dist/search/components/ElementsColumn.js +93 -59
- package/dist/search/components/PickView.js +8 -4
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +2 -2
- package/dist/search/components/ViewsColum.d.ts +2 -1
- package/dist/search/components/ViewsColum.js +39 -35
- package/dist/search/components/ViewsColumn.css.js +1 -1
- package/dist/search/components/_shared.css.js +11 -11
- package/dist/search/components/utils.js +1 -4
- package/dist/search/hooks.js +4 -1
- package/dist/search/searchActor.d.ts +12 -2
- package/dist/search/searchActor.js +60 -4
- package/dist/shadowroot/ShadowRoot.d.ts +5 -2
- package/dist/shadowroot/ShadowRoot.js +7 -5
- package/dist/shadowroot/styles.css.js +3 -2
- package/dist/styles.css2.js +1 -1
- package/dist/utils/view-bounds.d.ts +3 -2
- package/dist/utils/view-bounds.js +1 -1
- package/dist/utils/xyflow.d.ts +10 -5
- package/dist/utils/xyflow.js +24 -22
- package/package.json +33 -32
- package/panda.buildinfo.json +176 -87
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/bundle/index.js +0 -52554
- package/bundle/package.json +0 -4
- package/dist/adhoc-editor/EditorNavigationPanel.d.ts +0 -1
- package/dist/adhoc-editor/EditorNavigationPanel.js +0 -32
- package/dist/adhoc-editor/SelectElementOverlay.d.ts +0 -1
- package/dist/adhoc-editor/SelectElementOverlay.js +0 -124
- package/dist/adhoc-editor/actor.d.ts +0 -131
- package/dist/adhoc-editor/actor.editor.js +0 -96
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +0 -104
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -14
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { sva, cx, css, cva } from '@likec4/styles/css';
|
|
3
|
+
import { createStyleContext } from '@likec4/styles/jsx';
|
|
4
|
+
import { IconOrShapeRenderer } from '../../context/IconRenderer.js';
|
|
5
|
+
import IconChevronRight from '../../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js';
|
|
6
|
+
|
|
7
|
+
const statebtn = cva({
|
|
8
|
+
base: {
|
|
9
|
+
border: "none",
|
|
10
|
+
display: "inline-flex",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
justifySelf: "flex-end",
|
|
14
|
+
fontSize: "[8px]",
|
|
15
|
+
fontFamily: "mono",
|
|
16
|
+
fontWeight: "bold",
|
|
17
|
+
letterSpacing: "[0.5px]",
|
|
18
|
+
marginLeft: "2",
|
|
19
|
+
// marginRight: '[calc((var(--depth, 1) - 1) * {spacing.4.5} + {spacing.2})]',
|
|
20
|
+
py: "1",
|
|
21
|
+
px: "1.5",
|
|
22
|
+
lineHeight: "1",
|
|
23
|
+
rounded: "sm",
|
|
24
|
+
minWidth: 32,
|
|
25
|
+
transition: "normal",
|
|
26
|
+
_hover: {
|
|
27
|
+
color: "text.bright"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
variants: {
|
|
31
|
+
state: {
|
|
32
|
+
// 'include-explicit' | 'include-implicit' | 'exclude' | 'disabled' | 'not-present'
|
|
33
|
+
["include-explicit"]: {
|
|
34
|
+
backgroundColor: "grass.6",
|
|
35
|
+
color: "text"
|
|
36
|
+
// color: 'grass.0',
|
|
37
|
+
},
|
|
38
|
+
["include-implicit"]: {
|
|
39
|
+
backgroundColor: "grass.6",
|
|
40
|
+
color: "text"
|
|
41
|
+
// color: 'grass.0',
|
|
42
|
+
},
|
|
43
|
+
exclude: {
|
|
44
|
+
backgroundColor: "red.6",
|
|
45
|
+
color: "text"
|
|
46
|
+
},
|
|
47
|
+
["disabled"]: {
|
|
48
|
+
// backgroundColor: 'default.disabled',
|
|
49
|
+
color: "text.dimmed"
|
|
50
|
+
},
|
|
51
|
+
"not-present": {
|
|
52
|
+
color: "text.dimmed",
|
|
53
|
+
backgroundColor: "default.hover/50"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
state: "not-present"
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const icon = css.raw({
|
|
62
|
+
flex: 0,
|
|
63
|
+
display: "flex",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
color: "text.dimmed",
|
|
66
|
+
// _groupFocus: 'inherit',
|
|
67
|
+
// _groupHover: 'inherit',
|
|
68
|
+
// },
|
|
69
|
+
_groupHover: {
|
|
70
|
+
color: "text"
|
|
71
|
+
},
|
|
72
|
+
_groupFocusWithin: {
|
|
73
|
+
color: "mantine.colors.primary.lightColor!"
|
|
74
|
+
},
|
|
75
|
+
_groupFocusVisible: {
|
|
76
|
+
color: "mantine.colors.primary.lightColor!"
|
|
77
|
+
},
|
|
78
|
+
"& :where(.likec4-shape-icon, .likec4-element-icon)": {
|
|
79
|
+
display: "contents"
|
|
80
|
+
},
|
|
81
|
+
"& :where(svg, img)": {
|
|
82
|
+
width: "10px",
|
|
83
|
+
height: "10px"
|
|
84
|
+
},
|
|
85
|
+
"@/md": {
|
|
86
|
+
"& :where(svg, img)": {
|
|
87
|
+
width: "14px",
|
|
88
|
+
height: "14px"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"@/lg": {
|
|
92
|
+
"& :where(svg, img)": {
|
|
93
|
+
width: "16px",
|
|
94
|
+
height: "16px"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
opacity: {
|
|
98
|
+
base: 0.8,
|
|
99
|
+
_groupFocusVisible: 1,
|
|
100
|
+
_groupHover: 1
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const control = css.raw({
|
|
104
|
+
paddingLeft: "[calc((var(--depth, 1) - 1) * {spacing.2} + {spacing.1})]",
|
|
105
|
+
px: "1",
|
|
106
|
+
py: "1",
|
|
107
|
+
mb: "0",
|
|
108
|
+
columnGap: "1",
|
|
109
|
+
"@/md": {
|
|
110
|
+
paddingLeft: "[calc((var(--depth, 1) - 1) * {spacing.2} + {spacing.2})]",
|
|
111
|
+
px: "2",
|
|
112
|
+
py: "1.5",
|
|
113
|
+
mb: "0.5",
|
|
114
|
+
columnGap: "2"
|
|
115
|
+
},
|
|
116
|
+
"@/lg": {
|
|
117
|
+
paddingLeft: "[calc((var(--depth, 1) - 1) * {spacing.3} + {spacing.2.5})]",
|
|
118
|
+
py: "2.5"
|
|
119
|
+
},
|
|
120
|
+
cursor: "pointer",
|
|
121
|
+
border: "none",
|
|
122
|
+
appearance: "none",
|
|
123
|
+
width: "full",
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
display: "grid",
|
|
126
|
+
gridTemplateColumns: "auto 1fr auto",
|
|
127
|
+
gridTemplateRows: "auto auto",
|
|
128
|
+
rounded: "sm",
|
|
129
|
+
backgroundColor: {
|
|
130
|
+
base: "transparent",
|
|
131
|
+
_hover: {
|
|
132
|
+
base: "mantine.colors.gray[1]",
|
|
133
|
+
_dark: "mantine.colors.dark[5]"
|
|
134
|
+
},
|
|
135
|
+
_focusWithin: "mantine.colors.primary.lightHover!",
|
|
136
|
+
_focusVisible: "mantine.colors.primary.lightHover!"
|
|
137
|
+
},
|
|
138
|
+
color: {
|
|
139
|
+
base: "text",
|
|
140
|
+
_hover: "text.bright",
|
|
141
|
+
_focusWithin: "mantine.colors.primary.lightColor!",
|
|
142
|
+
_focusVisible: "mantine.colors.primary.lightColor!"
|
|
143
|
+
},
|
|
144
|
+
// _hover: {
|
|
145
|
+
// backgroundColor: {
|
|
146
|
+
// base: 'mantine.colors.gray[1]',
|
|
147
|
+
// _dark: 'mantine.colors.dark[5]',
|
|
148
|
+
// },
|
|
149
|
+
// },
|
|
150
|
+
_focusVisible: {
|
|
151
|
+
outline: "none"
|
|
152
|
+
// backgroundColor: 'mantine.colors.primary.lightHover!',
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const tree = sva({
|
|
156
|
+
slots: [
|
|
157
|
+
"branch",
|
|
158
|
+
"item",
|
|
159
|
+
// leaf
|
|
160
|
+
"control",
|
|
161
|
+
// branch control
|
|
162
|
+
"state",
|
|
163
|
+
// chip
|
|
164
|
+
"icon",
|
|
165
|
+
"label",
|
|
166
|
+
"content",
|
|
167
|
+
// branch content
|
|
168
|
+
"indicator"
|
|
169
|
+
// branch indicator
|
|
170
|
+
],
|
|
171
|
+
base: {
|
|
172
|
+
branch: {},
|
|
173
|
+
item: {
|
|
174
|
+
...control
|
|
175
|
+
},
|
|
176
|
+
control: {
|
|
177
|
+
...control
|
|
178
|
+
},
|
|
179
|
+
state: {
|
|
180
|
+
border: "none",
|
|
181
|
+
display: "inline-flex",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
justifySelf: "flex-end",
|
|
184
|
+
marginLeft: "2",
|
|
185
|
+
// marginRight: '[calc((var(--depth, 1) - 1) * {spacing.4.5} + {spacing.2})]',
|
|
186
|
+
"--chip-fz": "9px",
|
|
187
|
+
"--chip-checked-padding": "{spacing.1}",
|
|
188
|
+
"--chip-padding": "{spacing.1}",
|
|
189
|
+
"--chip-spacing": "0",
|
|
190
|
+
"--chip-size": "16px",
|
|
191
|
+
// '& label': {
|
|
192
|
+
// color: 'text',
|
|
193
|
+
// _groupFocusVisible: {
|
|
194
|
+
// backgroundColor: 'mantine.colors.primary.lightHover!',
|
|
195
|
+
// },
|
|
196
|
+
// // backgroundColor: 'transparent',
|
|
197
|
+
// },
|
|
198
|
+
transition: "opacity 150ms ease-out"
|
|
199
|
+
// opacity: {
|
|
200
|
+
// base: 0.4,
|
|
201
|
+
// _checked: 1,
|
|
202
|
+
// _groupFocusVisible: 1,
|
|
203
|
+
// _groupHover: 1,
|
|
204
|
+
// },
|
|
205
|
+
},
|
|
206
|
+
icon: {
|
|
207
|
+
...icon
|
|
208
|
+
},
|
|
209
|
+
label: {
|
|
210
|
+
cursor: "inherit",
|
|
211
|
+
color: "inherit",
|
|
212
|
+
userSelect: "none",
|
|
213
|
+
textStyle: "xxs",
|
|
214
|
+
truncate: "ellipsis",
|
|
215
|
+
"@/sm": {
|
|
216
|
+
textStyle: "xs"
|
|
217
|
+
},
|
|
218
|
+
"@/md": {
|
|
219
|
+
textStyle: "sm"
|
|
220
|
+
},
|
|
221
|
+
fontWeight: "[450]",
|
|
222
|
+
display: "inline-flex",
|
|
223
|
+
alignItems: "center",
|
|
224
|
+
gap: "2"
|
|
225
|
+
},
|
|
226
|
+
indicator: {
|
|
227
|
+
color: "inherit",
|
|
228
|
+
transition: "transform 150ms ease-out",
|
|
229
|
+
width: "12px",
|
|
230
|
+
opacity: 0.75,
|
|
231
|
+
"@/md": {
|
|
232
|
+
width: "14px"
|
|
233
|
+
},
|
|
234
|
+
_open: {
|
|
235
|
+
transform: "rotate(90deg)"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
content: {}
|
|
239
|
+
},
|
|
240
|
+
variants: {},
|
|
241
|
+
defaultVariants: {}
|
|
242
|
+
});
|
|
243
|
+
const { withRootProvider, withContext } = createStyleContext(tree);
|
|
244
|
+
const Root = withRootProvider("div");
|
|
245
|
+
const Branch = withContext("div", "branch");
|
|
246
|
+
const Item = withContext("div", "item", {
|
|
247
|
+
forwardProps: [],
|
|
248
|
+
defaultProps: {
|
|
249
|
+
className: "group"
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
const Control = withContext("div", "control", {
|
|
253
|
+
forwardProps: [],
|
|
254
|
+
defaultProps: {
|
|
255
|
+
className: "group"
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
const ElementState = ({ node, state, onClick, className, ...props }) => {
|
|
259
|
+
const cls = cx(
|
|
260
|
+
className,
|
|
261
|
+
"mantine-active",
|
|
262
|
+
statebtn({ state })
|
|
263
|
+
);
|
|
264
|
+
return /* @__PURE__ */ jsx("div", { ...props, onClick, className: cls, children: state });
|
|
265
|
+
};
|
|
266
|
+
const State = withContext(ElementState, "state", {
|
|
267
|
+
forwardProps: ["node", "state", "onClick", "className"]
|
|
268
|
+
});
|
|
269
|
+
const Icon = withContext(IconOrShapeRenderer, "icon", {
|
|
270
|
+
forwardProps: ["element", "className"]
|
|
271
|
+
});
|
|
272
|
+
const Label = withContext("div", "label", {
|
|
273
|
+
forwardProps: []
|
|
274
|
+
});
|
|
275
|
+
const Content = withContext("div", "content", {
|
|
276
|
+
forwardProps: []
|
|
277
|
+
});
|
|
278
|
+
const Indicator = withContext(IconChevronRight, "indicator", {
|
|
279
|
+
forwardProps: [],
|
|
280
|
+
defaultProps: {
|
|
281
|
+
size: 14
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
const Tree = {
|
|
285
|
+
Root,
|
|
286
|
+
Branch,
|
|
287
|
+
Item,
|
|
288
|
+
Control,
|
|
289
|
+
State,
|
|
290
|
+
Icon,
|
|
291
|
+
Label,
|
|
292
|
+
Content,
|
|
293
|
+
Indicator
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export { Tree };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { LayoutedElementView, Any } from '@likec4/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { AdhocEditorActorRef, AdhocEditorSnapshot } from './state/actor';
|
|
3
|
+
import { Provider } from 'react';
|
|
4
|
+
export declare const AdhocEditorActorContextProvider: Provider<AdhocEditorActorRef | null>;
|
|
4
5
|
export declare function useAdhocEditorActor(): AdhocEditorActorRef;
|
|
5
6
|
export declare function useAdhocEditor(): {
|
|
6
7
|
open: () => void;
|
|
7
8
|
close: () => void;
|
|
8
9
|
toggleRule: (ruleId: string) => void;
|
|
9
|
-
include: (element: ElementModel) => void;
|
|
10
10
|
};
|
|
11
11
|
export declare function useAdhocEditorSnapshot<T = unknown>(selector: (state: AdhocEditorSnapshot) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean): T;
|
|
12
12
|
export declare function useAdhocView(): LayoutedElementView< Any>;
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { nonNullable } from '@likec4/core';
|
|
2
2
|
import { useSelector } from '@xstate/react';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { AdhocEditorActorContext } from './ActorProvider.js';
|
|
3
|
+
import 'fast-equals';
|
|
4
|
+
import { createContext, useContext } from 'react';
|
|
6
5
|
|
|
6
|
+
const AdhocEditorActorContext = createContext(null);
|
|
7
|
+
const AdhocEditorActorContextProvider = AdhocEditorActorContext.Provider;
|
|
7
8
|
function useAdhocEditorActor() {
|
|
8
9
|
return nonNullable(useContext(AdhocEditorActorContext), "No AdhocEditorActorContext");
|
|
9
10
|
}
|
|
10
|
-
function useAdhocEditor() {
|
|
11
|
-
const actorRef = useAdhocEditorActor();
|
|
12
|
-
return useMemo(() => ({
|
|
13
|
-
open: () => actorRef.send({ type: "select.open" }),
|
|
14
|
-
close: () => actorRef.send({ type: "select.close" }),
|
|
15
|
-
toggleRule: (ruleId) => actorRef.send({ type: "toggle.rule", ruleId }),
|
|
16
|
-
include: (element) => actorRef.send({ type: "include.element", model: element.id })
|
|
17
|
-
}), [actorRef]);
|
|
18
|
-
}
|
|
19
|
-
function useAdhocEditorSnapshot(selector, compare = shallowEqual) {
|
|
20
|
-
const actorRef = useAdhocEditorActor();
|
|
21
|
-
return useSelector(actorRef, selector, compare);
|
|
22
|
-
}
|
|
23
11
|
const EMPTY_VIEW = {
|
|
24
12
|
id: "adhoc",
|
|
25
13
|
["_type"]: "element",
|
|
@@ -37,11 +25,5 @@ function useAdhocView() {
|
|
|
37
25
|
const actorRef = useAdhocEditorActor();
|
|
38
26
|
return useSelector(actorRef, selectView);
|
|
39
27
|
}
|
|
40
|
-
function selectFromSnapshot(selector) {
|
|
41
|
-
return selector;
|
|
42
|
-
}
|
|
43
|
-
function selectFromContext(selector) {
|
|
44
|
-
return (state) => selector(state.context);
|
|
45
|
-
}
|
|
46
28
|
|
|
47
|
-
export {
|
|
29
|
+
export { AdhocEditorActorContextProvider, useAdhocEditorActor, useAdhocView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LikeC4AdHocViewEditor } from './LikeC4AdHocViewEditor.js';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren
|
|
2
|
-
import { AdhocEditorActorRef } from './actor';
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
3
2
|
import { AdhocViewService } from './actor.types';
|
|
4
|
-
export declare const AdhocEditorActorContext: Context<AdhocEditorActorRef | null>;
|
|
5
3
|
export declare function AdhocEditorActorProvider({ children, service }: PropsWithChildren<{
|
|
6
4
|
service: AdhocViewService;
|
|
7
5
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useLogger } from '@mantine/hooks';
|
|
3
2
|
import { useActorRef } from '@xstate/react';
|
|
4
|
-
import { useRef,
|
|
3
|
+
import { useRef, useMemo, useEffect } from 'react';
|
|
5
4
|
import { fromPromise } from 'xstate';
|
|
5
|
+
import { AdhocEditorActorContextProvider } from '../hooks.js';
|
|
6
6
|
import { adhocEditorLogic } from './actor.js';
|
|
7
7
|
|
|
8
|
-
const AdhocEditorActorContext = createContext(null);
|
|
9
8
|
const State = {
|
|
10
9
|
read: () => JSON.parse(sessionStorage.getItem("adhoc-editor-state") || "null") ?? void 0,
|
|
11
10
|
write: (state) => sessionStorage.setItem("adhoc-editor-state", JSON.stringify(state))
|
|
@@ -13,12 +12,13 @@ const State = {
|
|
|
13
12
|
function AdhocEditorActorProvider({ children, service }) {
|
|
14
13
|
const serviceRef = useRef(service);
|
|
15
14
|
serviceRef.current = service;
|
|
15
|
+
const provided = useMemo(() => ({
|
|
16
|
+
actors: {
|
|
17
|
+
service: fromPromise(({ input }) => serviceRef.current.process(input))
|
|
18
|
+
}
|
|
19
|
+
}), []);
|
|
16
20
|
const actorRef = useActorRef(
|
|
17
|
-
adhocEditorLogic.provide(
|
|
18
|
-
actors: {
|
|
19
|
-
service: fromPromise(({ input }) => serviceRef.current.process(input))
|
|
20
|
-
}
|
|
21
|
-
}),
|
|
21
|
+
adhocEditorLogic.provide(provided),
|
|
22
22
|
{
|
|
23
23
|
id: "adhoc-editor",
|
|
24
24
|
snapshot: State.read(),
|
|
@@ -28,14 +28,13 @@ function AdhocEditorActorProvider({ children, service }) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
|
-
useLogger("AdhocEditorActor", [actorRef]);
|
|
32
31
|
useEffect(() => {
|
|
33
32
|
const subscription = actorRef.subscribe((state) => {
|
|
34
33
|
State.write(state);
|
|
35
34
|
});
|
|
36
35
|
return () => subscription.unsubscribe();
|
|
37
36
|
}, [actorRef]);
|
|
38
|
-
return /* @__PURE__ */ jsx(
|
|
37
|
+
return /* @__PURE__ */ jsx(AdhocEditorActorContextProvider, { value: actorRef, children });
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
export {
|
|
40
|
+
export { AdhocEditorActorProvider };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActorRef, SnapshotFrom, StateMachine } from 'xstate';
|
|
2
|
+
import { editor } from './actor.editor';
|
|
3
|
+
import { layouter } from './actor.layouter';
|
|
4
|
+
import { Context, EmittedEvents, Events } from './actor.types';
|
|
5
|
+
export interface AdhocEditorLogic extends StateMachine<Context, Events, any, any, any, any, any, {
|
|
6
|
+
layouter: keyof typeof layouter['states'];
|
|
7
|
+
editor: keyof typeof editor['states'];
|
|
8
|
+
}, any, any, EmittedEvents, any, any, any> {
|
|
9
|
+
}
|
|
10
|
+
export declare const adhocEditorLogic: AdhocEditorLogic;
|
|
11
|
+
export type AdhocEditorSnapshot = SnapshotFrom<AdhocEditorLogic>;
|
|
12
|
+
export interface AdhocEditorActorRef extends ActorRef<AdhocEditorSnapshot, Events, EmittedEvents> {
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Context, Events, AdhocViewServiceActor, EmittedEvents } from './actor.types';
|
|
1
2
|
import { ActionFunction } from 'xstate';
|
|
2
|
-
import { Context, Events, AdhocViewServiceActor } from './actor.types';
|
|
3
3
|
export declare const editor: {
|
|
4
4
|
initial: string;
|
|
5
5
|
states: {
|
|
@@ -30,13 +30,15 @@ export declare const editor: {
|
|
|
30
30
|
selecting: {
|
|
31
31
|
id: string;
|
|
32
32
|
on: {
|
|
33
|
-
'
|
|
34
|
-
target: "#layouting";
|
|
33
|
+
'toggle.element': {
|
|
35
34
|
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
36
35
|
src: "service";
|
|
37
36
|
logic: AdhocViewServiceActor;
|
|
38
37
|
id: string | undefined;
|
|
39
|
-
}, never,
|
|
38
|
+
}, never, {
|
|
39
|
+
type: "hasView";
|
|
40
|
+
params: unknown;
|
|
41
|
+
}, never, EmittedEvents>[];
|
|
40
42
|
};
|
|
41
43
|
'select.close': {
|
|
42
44
|
target: "#idle";
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { ModelFqnExpr } from '@likec4/core';
|
|
2
|
+
import { nonexhaustive, invariant, stringHash } from '@likec4/core/utils';
|
|
3
|
+
import { last } from 'remeda';
|
|
4
|
+
import { assertEvent } from 'xstate';
|
|
5
|
+
import { emitViewUpdate } from './actor.layouter.js';
|
|
6
|
+
import { machine } from './actor.types.js';
|
|
7
|
+
|
|
8
|
+
const to = {
|
|
9
|
+
idle: { target: "#idle" },
|
|
10
|
+
selecting: { target: "#selecting" },
|
|
11
|
+
layouting: { target: "#layouting" }
|
|
12
|
+
};
|
|
13
|
+
function nextId({ rules }, salt = "") {
|
|
14
|
+
return stringHash((rules.at(-1)?.id ?? (/* @__PURE__ */ new Date()).toISOString()) + salt);
|
|
15
|
+
}
|
|
16
|
+
const isRuleOf = (fqn) => (rule) => {
|
|
17
|
+
return ModelFqnExpr.isModelRef(rule.expr) && rule.expr.ref.model === fqn;
|
|
18
|
+
};
|
|
19
|
+
const isIncludeOf = (fqn) => (rule) => {
|
|
20
|
+
return rule.type === "include" && ModelFqnExpr.isModelRef(rule.expr) && rule.expr.ref.model === fqn;
|
|
21
|
+
};
|
|
22
|
+
const isExcludeOf = (fqn) => (rule) => {
|
|
23
|
+
return rule.type === "exclude" && ModelFqnExpr.isModelRef(rule.expr) && rule.expr.ref.model === fqn;
|
|
24
|
+
};
|
|
25
|
+
function deriveElementState(id, { rules, view }) {
|
|
26
|
+
const ruleOf = rules.find(isRuleOf(id));
|
|
27
|
+
if (ruleOf && !ruleOf.enabled) {
|
|
28
|
+
return {
|
|
29
|
+
state: "disabled",
|
|
30
|
+
ruleId: ruleOf.id
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const isIncludedInView = view ? view.nodes.some((node) => node.modelRef === id) : false;
|
|
34
|
+
const includeRule = rules.find(isIncludeOf(id));
|
|
35
|
+
const excludeRule = rules.find(isExcludeOf(id));
|
|
36
|
+
switch (true) {
|
|
37
|
+
case (includeRule && isIncludedInView):
|
|
38
|
+
return {
|
|
39
|
+
state: "include-explicit",
|
|
40
|
+
ruleId: includeRule.id
|
|
41
|
+
};
|
|
42
|
+
case (!includeRule && isIncludedInView):
|
|
43
|
+
return {
|
|
44
|
+
state: "include-implicit",
|
|
45
|
+
ruleId: void 0
|
|
46
|
+
};
|
|
47
|
+
case (includeRule && !isIncludedInView):
|
|
48
|
+
return {
|
|
49
|
+
state: "not-present",
|
|
50
|
+
ruleId: includeRule.id
|
|
51
|
+
};
|
|
52
|
+
case !!excludeRule:
|
|
53
|
+
return {
|
|
54
|
+
state: "exclude",
|
|
55
|
+
ruleId: excludeRule.id
|
|
56
|
+
};
|
|
57
|
+
default: {
|
|
58
|
+
invariant(isIncludedInView === false, "Element not in view should not be included or excluded by any rule");
|
|
59
|
+
return {
|
|
60
|
+
state: "not-present",
|
|
61
|
+
ruleId: void 0
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const enableRule = (ruleId) => machine.assign(({ context }) => {
|
|
67
|
+
return {
|
|
68
|
+
rules: context.rules.map((rule) => {
|
|
69
|
+
if (rule.id === ruleId && !rule.enabled) {
|
|
70
|
+
return {
|
|
71
|
+
...rule,
|
|
72
|
+
enabled: true
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return rule;
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
const addElementRules = (fqn, type) => machine.assign(({ context }) => {
|
|
80
|
+
return {
|
|
81
|
+
rules: [
|
|
82
|
+
...context.rules,
|
|
83
|
+
{
|
|
84
|
+
id: nextId(context, type + fqn),
|
|
85
|
+
expr: { ref: { model: fqn } },
|
|
86
|
+
enabled: true,
|
|
87
|
+
type
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
const removeElementRules = (fqn) => machine.assign(({ context }) => {
|
|
93
|
+
const isRule = isRuleOf(fqn);
|
|
94
|
+
return {
|
|
95
|
+
rules: context.rules.filter((rule) => {
|
|
96
|
+
return !isRule(rule);
|
|
97
|
+
})
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
const toggleElement = () => machine.enqueueActions(({ context, event, enqueue }) => {
|
|
101
|
+
assertEvent(event, "toggle.element");
|
|
102
|
+
const isRuleOfTheElement = isRuleOf(event.id);
|
|
103
|
+
const lastRule = last(context.rules);
|
|
104
|
+
if (lastRule && isRuleOfTheElement(lastRule)) {
|
|
105
|
+
enqueue.assign({
|
|
106
|
+
rules: context.rules.slice(0, -1)
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const state = deriveElementState(event.id, context);
|
|
111
|
+
switch (state.state) {
|
|
112
|
+
case "disabled": {
|
|
113
|
+
enqueue(enableRule(state.ruleId));
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
// Include element if it is not in view and not included/excluded by any rule
|
|
117
|
+
case "not-present": {
|
|
118
|
+
enqueue(removeElementRules(event.id));
|
|
119
|
+
enqueue(addElementRules(event.id, "include"));
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
case "include-implicit": {
|
|
123
|
+
enqueue(removeElementRules(event.id));
|
|
124
|
+
enqueue(addElementRules(event.id, "exclude"));
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "include-explicit":
|
|
128
|
+
case "exclude": {
|
|
129
|
+
enqueue(removeElementRules(event.id));
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
default:
|
|
133
|
+
nonexhaustive(state);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const toggleRule = () => machine.assign(({ context, event }) => {
|
|
137
|
+
assertEvent(event, "toggle.rule");
|
|
138
|
+
return {
|
|
139
|
+
rules: context.rules.map((rule) => {
|
|
140
|
+
if (rule.id === event.ruleId) {
|
|
141
|
+
return {
|
|
142
|
+
...rule,
|
|
143
|
+
enabled: !rule.enabled
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return rule;
|
|
147
|
+
})
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
const deleteRule = () => machine.assign(({ context, event }) => {
|
|
151
|
+
assertEvent(event, "delete.rule");
|
|
152
|
+
return {
|
|
153
|
+
rules: context.rules.filter((rule) => rule.id !== event.ruleId)
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
const scheduleLayout = () => machine.raise({ type: "layout" });
|
|
157
|
+
const idle = machine.createStateConfig({
|
|
158
|
+
id: "idle",
|
|
159
|
+
on: {
|
|
160
|
+
"select.open": {
|
|
161
|
+
...to.selecting
|
|
162
|
+
},
|
|
163
|
+
"toggle.rule": {
|
|
164
|
+
actions: toggleRule(),
|
|
165
|
+
...to.layouting
|
|
166
|
+
},
|
|
167
|
+
"delete.rule": {
|
|
168
|
+
actions: deleteRule(),
|
|
169
|
+
...to.layouting
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
const selecting = machine.createStateConfig({
|
|
174
|
+
id: "selecting",
|
|
175
|
+
on: {
|
|
176
|
+
"toggle.element": {
|
|
177
|
+
actions: [
|
|
178
|
+
toggleElement(),
|
|
179
|
+
emitViewUpdate(),
|
|
180
|
+
scheduleLayout()
|
|
181
|
+
]
|
|
182
|
+
// ...to.layouting,
|
|
183
|
+
},
|
|
184
|
+
"select.close": {
|
|
185
|
+
...to.idle
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const layouting = machine.createStateConfig({
|
|
190
|
+
id: "layouting",
|
|
191
|
+
always: {
|
|
192
|
+
actions: scheduleLayout(),
|
|
193
|
+
...to.idle
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
const editor = machine.createStateConfig({
|
|
197
|
+
initial: "selecting",
|
|
198
|
+
states: {
|
|
199
|
+
idle,
|
|
200
|
+
selecting,
|
|
201
|
+
layouting
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
export { editor };
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { editor } from './actor.editor.js';
|
|
2
2
|
import { layouter } from './actor.layouter.js';
|
|
3
|
-
import { machine } from './actor.types.js';
|
|
3
|
+
import { machine, createContext } from './actor.types.js';
|
|
4
4
|
|
|
5
5
|
const _adhocEditorLogic = machine.createMachine({
|
|
6
6
|
id: "adhoc-editor",
|
|
7
|
-
context:
|
|
8
|
-
view: null,
|
|
9
|
-
error: void 0,
|
|
10
|
-
rules: []
|
|
11
|
-
}),
|
|
7
|
+
context: createContext,
|
|
12
8
|
type: "parallel",
|
|
13
9
|
states: {
|
|
14
10
|
layouter,
|