@likec4/diagram 1.46.4 → 1.48.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 +1 -1
- package/bundle/index.js +7332 -5799
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +20 -14
- package/dist/LikeC4Diagram.props.d.ts +2 -6
- package/dist/LikeC4ProjectsOverview.d.ts +7 -0
- package/dist/LikeC4ProjectsOverview.js +32 -0
- package/dist/LikeC4ProjectsProvider.js +7 -5
- package/dist/LikeC4Styles.d.ts +2 -6
- package/dist/LikeC4Styles.js +44 -43
- package/dist/LikeC4View.d.ts +9 -1
- package/dist/LikeC4View.js +10 -8
- package/dist/ReactLikeC4.d.ts +12 -2
- package/dist/ReactLikeC4.js +5 -3
- package/dist/adhoc-editor/ActorProvider.d.ts +7 -0
- package/dist/adhoc-editor/ActorProvider.js +41 -0
- package/dist/adhoc-editor/EditorNavigationPanel.d.ts +1 -0
- package/dist/adhoc-editor/EditorNavigationPanel.js +32 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +4 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +71 -0
- package/dist/adhoc-editor/SelectElementOverlay.d.ts +1 -0
- package/dist/adhoc-editor/SelectElementOverlay.js +124 -0
- package/dist/adhoc-editor/actor.d.ts +131 -0
- package/dist/adhoc-editor/actor.editor.d.ts +54 -0
- package/dist/adhoc-editor/actor.editor.js +96 -0
- package/dist/adhoc-editor/actor.js +20 -0
- package/dist/adhoc-editor/actor.layouter.d.ts +48 -0
- package/dist/adhoc-editor/actor.layouter.js +66 -0
- package/dist/adhoc-editor/actor.types.d.ts +57 -0
- package/dist/adhoc-editor/actor.types.js +22 -0
- package/dist/adhoc-editor/hooks.d.ts +14 -0
- package/dist/adhoc-editor/hooks.js +47 -0
- package/dist/adhoc-editor/index.d.ts +2 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +6 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +104 -0
- package/dist/base/const.d.ts +1 -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.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 +3 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +3 -1
- package/dist/base-primitives/compound/CompoundNodeContainer.d.ts +4 -3
- package/dist/base-primitives/compound/CompoundNodeContainer.js +6 -4
- package/dist/base-primitives/compound/CompoundTitle.js +1 -2
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +5 -2
- package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -1
- package/dist/base-primitives/element/ElementActionButtons.js +31 -58
- 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 +2 -1
- package/dist/base-primitives/element/ElementNodeContainer.d.ts +2 -2
- package/dist/base-primitives/element/ElementNodeContainer.js +3 -3
- package/dist/base-primitives/element/ElementShape.js +109 -20
- 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 +2 -2
- package/dist/components/Logo.js +1 -1
- package/dist/components/NavigationPanel.d.ts +11 -0
- package/dist/components/NavigationPanel.js +50 -0
- package/dist/components/RootContainer.js +5 -8
- package/dist/context/DefaultMantineProvider.d.ts +2 -0
- package/dist/context/DefaultMantineProvider.js +66 -0
- package/dist/context/DiagramEventHandlers.js +1 -1
- package/dist/context/DiagramFeatures.js +12 -11
- package/dist/context/EnsureMantine.d.ts +0 -3
- package/dist/context/EnsureMantine.js +3 -4
- package/dist/context/IconRenderer.d.ts +14 -0
- package/dist/context/IconRenderer.js +11 -8
- package/dist/context/TagStylesContext.js +12 -4
- package/dist/custom/hooks.d.ts +2 -2
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +2 -2
- 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 +2 -2
- package/dist/editor/applyChangesToManualLayout.js +1 -0
- package/dist/editor/editorActor.actions.d.ts +25 -25
- package/dist/editor/editorActor.actions.js +2 -2
- 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} +22 -64
- package/dist/editor/index.d.ts +4 -3
- package/dist/editor/useEditorActorLogic.d.ts +2 -564
- package/dist/editor/useEditorActorLogic.js +8 -12
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useCallbackRef.d.ts +6 -0
- package/dist/hooks/useCurrentViewModel.d.ts +10 -0
- package/dist/hooks/useDiagram.js +2 -2
- package/dist/hooks/useDiagramCompareLayout.d.ts +1 -1
- package/dist/hooks/useDiagramCompareLayout.js +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +1 -1
- package/dist/hooks/useLikeC4Model.js +2 -2
- package/dist/hooks/useLikeC4Project.js +10 -2
- package/dist/hooks/useLikeC4Styles.js +0 -3
- 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 +9 -5
- package/dist/index.js +6 -3
- package/dist/likec4diagram/DiagramUI.js +1 -3
- package/dist/likec4diagram/DiagramXYFlow.js +26 -12
- 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 +13 -14
- 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 +68 -35
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -5
- package/dist/likec4diagram/custom/nodes/nodes.js +25 -6
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +8 -7
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +1 -38
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +35 -19
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +9 -5
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +6 -1
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +46 -10
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +2 -2
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -15
- 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 +14 -15
- package/dist/likec4diagram/state/assign.d.ts +1 -1
- package/dist/likec4diagram/state/createViewChange.js +16 -4
- package/dist/likec4diagram/state/machine.actions.d.ts +65 -0
- package/dist/likec4diagram/state/machine.actions.js +51 -39
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +22 -2
- package/dist/likec4diagram/state/machine.actions.layout.js +32 -14
- package/dist/likec4diagram/state/machine.d.ts +1 -1
- package/dist/likec4diagram/state/machine.js +31 -30
- package/dist/likec4diagram/state/machine.setup.d.ts +21 -5
- 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 +81 -49
- package/dist/likec4diagram/state/machine.state.ready.d.ts +508 -582
- 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 +80 -69
- 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 +13 -14
- package/dist/likec4diagram/state/utils.js +11 -3
- package/dist/likec4diagram/types.d.ts +9 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.js +4 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +5 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +10 -8
- package/dist/likec4diagram/xyflow-sequence/utils.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanel.js +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +6 -4
- package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
- package/dist/navigationpanel/_common.js +1 -2
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +4 -5
- package/dist/navigationpanel/controls/DetailsControls.js +5 -5
- package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
- package/dist/navigationpanel/controls/LogoButton.d.ts +1 -0
- package/dist/navigationpanel/controls/{BurgerButton.js → LogoButton.js} +5 -5
- 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 +4 -5
- package/dist/navigationpanel/controls/index.d.ts +1 -1
- 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.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +67 -67
- 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/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +4 -4
- package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
- package/dist/overlays/element-details/MetadataValue.js +6 -7
- package/dist/overlays/element-details/TabPanelDeployments.js +7 -5
- package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -25
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +3 -2
- package/dist/overlays/overlaysActor.js +18 -0
- 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 +2 -2
- 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.js +2 -2
- 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/edgeTypes.js +0 -1
- 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/projects-overview/ProjectsOverview.d.ts +13 -0
- package/dist/projects-overview/ProjectsOverview.js +57 -0
- package/dist/projects-overview/ProjectsOverviewXY.d.ts +17 -0
- package/dist/projects-overview/ProjectsOverviewXY.js +98 -0
- package/dist/projects-overview/_types.d.ts +34 -0
- package/dist/projects-overview/actor.d.ts +121 -0
- package/dist/projects-overview/actor.js +359 -0
- package/dist/projects-overview/context.d.ts +4 -0
- package/dist/projects-overview/context.js +9 -0
- package/dist/projects-overview/custom/edgeTypes.d.ts +3 -0
- package/dist/projects-overview/custom/edgeTypes.js +23 -0
- package/dist/projects-overview/custom/index.d.ts +2 -0
- package/dist/projects-overview/custom/nodeTypes.d.ts +2 -0
- package/dist/projects-overview/custom/nodeTypes.js +45 -0
- package/dist/projects-overview/hooks.d.ts +5 -0
- package/dist/projects-overview/hooks.js +14 -0
- package/dist/projects-overview/index.d.ts +1 -0
- package/dist/projects-overview/layouted-to-xyflow.d.ts +6 -0
- package/dist/projects-overview/layouted-to-xyflow.js +49 -0
- package/dist/projects-overview/panel/ProjectsOverviewPanel.d.ts +1 -0
- package/dist/projects-overview/panel/ProjectsOverviewPanel.js +11 -0
- package/dist/projects-overview/persistence.d.ts +5 -0
- package/dist/projects-overview/persistence.js +24 -0
- package/dist/search/Search.d.ts +1 -4
- package/dist/search/Search.js +89 -87
- package/dist/search/components/ElementsColumn.css.js +3 -3
- package/dist/search/components/ElementsColumn.js +3 -4
- package/dist/search/components/PickView.d.ts +3 -1
- package/dist/search/components/PickView.js +5 -4
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +2 -2
- package/dist/search/components/_shared.css.js +1 -1
- package/dist/search/components/utils.js +1 -1
- package/dist/search/hooks.d.ts +1 -6
- package/dist/search/hooks.js +12 -9
- package/dist/search/searchActor.d.ts +1 -1
- package/dist/shadowroot/ShadowRoot.js +20 -19
- package/dist/shadowroot/styles.css.d.ts +0 -2
- package/dist/shadowroot/styles.css.js +1 -34
- package/dist/styles-font.css2.js +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/view-bounds.js +9 -5
- package/dist/utils/xyflow.d.ts +19 -3
- package/dist/utils/xyflow.js +52 -9
- package/package.json +23 -22
- package/panda.buildinfo.json +93 -84
- package/styles-font.css +1 -1
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/base-primitives/element/ElementNodeContainer.css.d.ts +0 -1
- package/dist/base-primitives/element/ElementNodeContainer.css.js +0 -39
- 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/navigationpanel/controls/BurgerButton.d.ts +0 -1
- package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
- /package/dist/{overlays/relationships-browser → projects-overview}/custom/styles.css.d.ts +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { ReactFlowProvider } from '@xyflow/react';
|
|
3
|
+
import { Profiler } from 'react';
|
|
4
|
+
import { FitViewPaddings } from '../base/const.js';
|
|
5
|
+
import { RootContainer } from '../components/RootContainer.js';
|
|
6
|
+
import { DiagramFeatures } from '../context/DiagramFeatures.js';
|
|
7
|
+
import { EnsureMantine } from '../context/EnsureMantine.js';
|
|
8
|
+
import { FramerMotionConfig } from '../context/FramerMotionConfig.js';
|
|
9
|
+
import { TagStylesProvider } from '../context/TagStylesContext.js';
|
|
10
|
+
import { useId } from '../hooks/useId.js';
|
|
11
|
+
import { LikeC4DiagramXYFlow } from '../likec4diagram/DiagramXYFlow.js';
|
|
12
|
+
import { DiagramActorProvider } from '../likec4diagram/state/DiagramActorProvider.js';
|
|
13
|
+
import { LikeC4Styles } from '../LikeC4Styles.js';
|
|
14
|
+
import { AdhocEditorActorProvider } from './ActorProvider.js';
|
|
15
|
+
import { EditorNavigationPanel } from './EditorNavigationPanel.js';
|
|
16
|
+
import { useAdhocView } from './hooks.js';
|
|
17
|
+
import { SelectElementOverlay } from './SelectElementOverlay.js';
|
|
18
|
+
|
|
19
|
+
function LikeC4AdHocViewEditor({ service }) {
|
|
20
|
+
const id = useId();
|
|
21
|
+
return /* @__PURE__ */ jsx(Profiler, { id: "LikeC4AdHocViewEditor", onRender: () => {
|
|
22
|
+
}, children: /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsx(FramerMotionConfig, { children: /* @__PURE__ */ jsxs(
|
|
23
|
+
DiagramFeatures,
|
|
24
|
+
{
|
|
25
|
+
features: {
|
|
26
|
+
enableFitView: true,
|
|
27
|
+
enableEditor: false,
|
|
28
|
+
enableReadOnly: true,
|
|
29
|
+
enableFocusMode: false,
|
|
30
|
+
enableNavigateTo: false,
|
|
31
|
+
enableElementDetails: false,
|
|
32
|
+
enableRelationshipDetails: false,
|
|
33
|
+
enableRelationshipBrowser: false,
|
|
34
|
+
enableSearch: false,
|
|
35
|
+
enableNavigationButtons: false,
|
|
36
|
+
enableDynamicViewWalkthrough: false,
|
|
37
|
+
enableNotations: false,
|
|
38
|
+
enableVscode: false,
|
|
39
|
+
enableControls: false,
|
|
40
|
+
enableElementTags: false,
|
|
41
|
+
enableCompareWithLatest: false
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(LikeC4Styles, { id }),
|
|
45
|
+
/* @__PURE__ */ jsx(TagStylesProvider, { rootSelector: `#${id}`, children: /* @__PURE__ */ jsx(RootContainer, { id, children: /* @__PURE__ */ jsxs(AdhocEditorActorProvider, { service, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(LikeC4AdHocView, { id }),
|
|
47
|
+
/* @__PURE__ */ jsx(EditorNavigationPanel, {}),
|
|
48
|
+
/* @__PURE__ */ jsx(SelectElementOverlay, {})
|
|
49
|
+
] }) }) })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
) }) }) });
|
|
53
|
+
}
|
|
54
|
+
function LikeC4AdHocView({ id }) {
|
|
55
|
+
const view = useAdhocView();
|
|
56
|
+
return /* @__PURE__ */ jsx(ReactFlowProvider, { fitView: true, initialNodes: [], initialEdges: [], children: /* @__PURE__ */ jsx(
|
|
57
|
+
DiagramActorProvider,
|
|
58
|
+
{
|
|
59
|
+
id,
|
|
60
|
+
view,
|
|
61
|
+
zoomable: true,
|
|
62
|
+
pannable: true,
|
|
63
|
+
fitViewPadding: FitViewPaddings.withControls,
|
|
64
|
+
nodesDraggable: false,
|
|
65
|
+
nodesSelectable: true,
|
|
66
|
+
children: /* @__PURE__ */ jsx(LikeC4DiagramXYFlow, {})
|
|
67
|
+
}
|
|
68
|
+
) });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { LikeC4AdHocViewEditor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SelectElementOverlay(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cx, css } from '@likec4/styles/css';
|
|
3
|
+
import { VStack, styled } from '@likec4/styles/jsx';
|
|
4
|
+
import { flex, center, vstack } from '@likec4/styles/patterns';
|
|
5
|
+
import { Button, Input, ScrollAreaAutosize } from '@mantine/core';
|
|
6
|
+
import { useInputState } from '@mantine/hooks';
|
|
7
|
+
import { AnimatePresence, m } from 'motion/react';
|
|
8
|
+
import { useLikeC4Model } from '../hooks/useLikeC4Model.js';
|
|
9
|
+
import { Overlay } from '../overlays/overlay/Overlay.js';
|
|
10
|
+
import { useAdhocEditor, useAdhocEditorSnapshot, selectFromSnapshot, selectFromContext } from './hooks.js';
|
|
11
|
+
|
|
12
|
+
const selectIfEmpty = selectFromContext((c) => !c.view || c.view.nodes.length === 0);
|
|
13
|
+
function SelectElementsButton({ onClick }) {
|
|
14
|
+
const isEmpty = useAdhocEditorSnapshot(selectIfEmpty);
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
m.div,
|
|
17
|
+
{
|
|
18
|
+
layout: "position",
|
|
19
|
+
layoutId: "select-button-container",
|
|
20
|
+
className: cx(
|
|
21
|
+
flex({
|
|
22
|
+
pointerEvents: "none",
|
|
23
|
+
position: "absolute",
|
|
24
|
+
justifyContent: "center"
|
|
25
|
+
}),
|
|
26
|
+
isEmpty && center({ inset: "0" }),
|
|
27
|
+
!isEmpty && css({
|
|
28
|
+
top: "3",
|
|
29
|
+
width: "100%"
|
|
30
|
+
})
|
|
31
|
+
),
|
|
32
|
+
children: /* @__PURE__ */ jsx(
|
|
33
|
+
Button,
|
|
34
|
+
{
|
|
35
|
+
component: m.button,
|
|
36
|
+
layout: "position",
|
|
37
|
+
layoutId: "select-button",
|
|
38
|
+
className: css({
|
|
39
|
+
pointerEvents: "all"
|
|
40
|
+
}),
|
|
41
|
+
size: isEmpty ? "xl" : "lg",
|
|
42
|
+
variant: "default",
|
|
43
|
+
radius: isEmpty ? "xl" : "lg",
|
|
44
|
+
onClick,
|
|
45
|
+
children: "Add elements"
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const isSelecting = selectFromSnapshot((s) => s.value.editor === "selecting");
|
|
52
|
+
function SelectElementOverlay() {
|
|
53
|
+
const editor = useAdhocEditor();
|
|
54
|
+
const isOpened = useAdhocEditorSnapshot(isSelecting);
|
|
55
|
+
return /* @__PURE__ */ jsxs(AnimatePresence, { mode: "popLayout", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(SelectElementsButton, { onClick: () => editor.open() }, "select-button"),
|
|
57
|
+
isOpened && /* @__PURE__ */ jsx(Overlay, { onClose: () => editor.close(), children: /* @__PURE__ */ jsx(SelectElementOverlayBody, {}) }, "select-overlay")
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
function SelectElementOverlayBody() {
|
|
61
|
+
const editor = useAdhocEditor();
|
|
62
|
+
const [input, setInput] = useInputState("");
|
|
63
|
+
const elements = useLikeC4Model().elements().toArray();
|
|
64
|
+
return /* @__PURE__ */ jsxs(VStack, { h: "100%", flex: "1", alignItems: "stretch", children: [
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
Input,
|
|
67
|
+
{
|
|
68
|
+
size: "lg",
|
|
69
|
+
variant: "unstyled",
|
|
70
|
+
placeholder: "Search by title, description or start with # or kind:",
|
|
71
|
+
autoFocus: true,
|
|
72
|
+
"data-autofocus": true,
|
|
73
|
+
value: input,
|
|
74
|
+
onChange: setInput,
|
|
75
|
+
"data-likec4-search-input": true,
|
|
76
|
+
onKeyDownCapture: (e) => {
|
|
77
|
+
switch (e.key) {
|
|
78
|
+
case "Escape": {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
editor.close();
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case "Enter": {
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
editor.close();
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
default: {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
ScrollAreaAutosize,
|
|
99
|
+
{
|
|
100
|
+
scrollbars: "y",
|
|
101
|
+
type: "scroll",
|
|
102
|
+
classNames: {
|
|
103
|
+
content: vstack({
|
|
104
|
+
alignItems: "stretch"
|
|
105
|
+
})
|
|
106
|
+
},
|
|
107
|
+
children: elements.map((el) => /* @__PURE__ */ jsx(
|
|
108
|
+
styled.button,
|
|
109
|
+
{
|
|
110
|
+
onClick: (e) => {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
editor.include(el);
|
|
113
|
+
editor.close();
|
|
114
|
+
},
|
|
115
|
+
children: el.title
|
|
116
|
+
},
|
|
117
|
+
el.id
|
|
118
|
+
))
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { SelectElementOverlay };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ActorRef, SnapshotFrom, StateMachine, ActorRefFromLogic, NonReducibleUnknown, MetaObject, LogAction, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, DoneActorEvent, ErrorActorEvent } from 'xstate';
|
|
2
|
+
import { EmittedEvents, Events, Context, AdhocViewServiceActor } from './actor.types';
|
|
3
|
+
import { AdhocViewPredicate } from '@likec4/core/compute-view';
|
|
4
|
+
import { LayoutedElementView } from '@likec4/core';
|
|
5
|
+
declare const _adhocEditorLogic: StateMachine<Context, Events, {
|
|
6
|
+
[x: string]: ActorRefFromLogic<AdhocViewServiceActor> | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
src: "service";
|
|
9
|
+
logic: AdhocViewServiceActor;
|
|
10
|
+
id: string | undefined;
|
|
11
|
+
}, never, {
|
|
12
|
+
type: "hasView";
|
|
13
|
+
params: unknown;
|
|
14
|
+
}, never, {
|
|
15
|
+
editor: "idle" | "selecting" | "layouting";
|
|
16
|
+
layouter: "idle" | "call";
|
|
17
|
+
}, "hasView", NonReducibleUnknown, NonReducibleUnknown, EmittedEvents, MetaObject, {
|
|
18
|
+
readonly id: "adhoc-editor";
|
|
19
|
+
readonly context: () => {
|
|
20
|
+
view: null;
|
|
21
|
+
error: undefined;
|
|
22
|
+
rules: never[];
|
|
23
|
+
};
|
|
24
|
+
readonly type: "parallel";
|
|
25
|
+
readonly states: {
|
|
26
|
+
readonly layouter: {
|
|
27
|
+
initial: string;
|
|
28
|
+
states: {
|
|
29
|
+
idle: {
|
|
30
|
+
id: string;
|
|
31
|
+
entry: LogAction<Context, Events, undefined, Events>;
|
|
32
|
+
exit: LogAction<Context, Events, undefined, Events>;
|
|
33
|
+
on: {
|
|
34
|
+
layout: {
|
|
35
|
+
target: "#layouter-call";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
call: {
|
|
40
|
+
id: string;
|
|
41
|
+
entry: LogAction<Context, Events, undefined, Events>;
|
|
42
|
+
exit: LogAction<Context, Events, undefined, Events>;
|
|
43
|
+
invoke: {
|
|
44
|
+
src: "service";
|
|
45
|
+
input: ({ context }: {
|
|
46
|
+
context: Context;
|
|
47
|
+
event: Events;
|
|
48
|
+
self: ActorRef< MachineSnapshot<Context, Events, Record<string, AnyActorRef>, StateValue, string, unknown, any, any>, Events, AnyEventObject>;
|
|
49
|
+
}) => {
|
|
50
|
+
predicates: AdhocViewPredicate[];
|
|
51
|
+
};
|
|
52
|
+
onDone: {
|
|
53
|
+
target: "#layouter-idle";
|
|
54
|
+
actions: ActionFunction<Context, DoneActorEvent<{
|
|
55
|
+
view: LayoutedElementView;
|
|
56
|
+
}, string>, Events, undefined, {
|
|
57
|
+
src: "service";
|
|
58
|
+
logic: AdhocViewServiceActor;
|
|
59
|
+
id: string | undefined;
|
|
60
|
+
}, never, never, never, never>;
|
|
61
|
+
};
|
|
62
|
+
onError: {
|
|
63
|
+
target: "#layouter-idle";
|
|
64
|
+
actions: LogAction<Context, ErrorActorEvent<unknown, string>, undefined, Events>[];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
readonly editor: {
|
|
71
|
+
initial: string;
|
|
72
|
+
states: {
|
|
73
|
+
idle: {
|
|
74
|
+
id: string;
|
|
75
|
+
on: {
|
|
76
|
+
'select.open': {
|
|
77
|
+
target: "#selecting";
|
|
78
|
+
};
|
|
79
|
+
'toggle.rule': {
|
|
80
|
+
target: "#layouting";
|
|
81
|
+
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
82
|
+
src: "service";
|
|
83
|
+
logic: AdhocViewServiceActor;
|
|
84
|
+
id: string | undefined;
|
|
85
|
+
}, never, never, never, never>;
|
|
86
|
+
};
|
|
87
|
+
'delete.rule': {
|
|
88
|
+
target: "#layouting";
|
|
89
|
+
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
90
|
+
src: "service";
|
|
91
|
+
logic: AdhocViewServiceActor;
|
|
92
|
+
id: string | undefined;
|
|
93
|
+
}, never, never, never, never>;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
selecting: {
|
|
98
|
+
id: string;
|
|
99
|
+
on: {
|
|
100
|
+
'include.element': {
|
|
101
|
+
target: "#layouting";
|
|
102
|
+
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
103
|
+
src: "service";
|
|
104
|
+
logic: AdhocViewServiceActor;
|
|
105
|
+
id: string | undefined;
|
|
106
|
+
}, never, never, never, never>;
|
|
107
|
+
};
|
|
108
|
+
'select.close': {
|
|
109
|
+
target: "#idle";
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
layouting: {
|
|
114
|
+
id: string;
|
|
115
|
+
always: {
|
|
116
|
+
target: "#idle";
|
|
117
|
+
actions: ActionFunction<Context, Events, Events, undefined, never, never, never, never, never>;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
}>;
|
|
124
|
+
type Infer = typeof _adhocEditorLogic;
|
|
125
|
+
export interface AdhocEditorLogic extends Infer {
|
|
126
|
+
}
|
|
127
|
+
export declare const adhocEditorLogic: AdhocEditorLogic;
|
|
128
|
+
export type AdhocEditorSnapshot = SnapshotFrom<AdhocEditorLogic>;
|
|
129
|
+
export interface AdhocEditorActorRef extends ActorRef<AdhocEditorSnapshot, Events, EmittedEvents> {
|
|
130
|
+
}
|
|
131
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ActionFunction } from 'xstate';
|
|
2
|
+
import { Context, Events, AdhocViewServiceActor } from './actor.types';
|
|
3
|
+
export declare const editor: {
|
|
4
|
+
initial: string;
|
|
5
|
+
states: {
|
|
6
|
+
idle: {
|
|
7
|
+
id: string;
|
|
8
|
+
on: {
|
|
9
|
+
'select.open': {
|
|
10
|
+
target: "#selecting";
|
|
11
|
+
};
|
|
12
|
+
'toggle.rule': {
|
|
13
|
+
target: "#layouting";
|
|
14
|
+
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
15
|
+
src: "service";
|
|
16
|
+
logic: AdhocViewServiceActor;
|
|
17
|
+
id: string | undefined;
|
|
18
|
+
}, never, never, never, never>;
|
|
19
|
+
};
|
|
20
|
+
'delete.rule': {
|
|
21
|
+
target: "#layouting";
|
|
22
|
+
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
23
|
+
src: "service";
|
|
24
|
+
logic: AdhocViewServiceActor;
|
|
25
|
+
id: string | undefined;
|
|
26
|
+
}, never, never, never, never>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
selecting: {
|
|
31
|
+
id: string;
|
|
32
|
+
on: {
|
|
33
|
+
'include.element': {
|
|
34
|
+
target: "#layouting";
|
|
35
|
+
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
36
|
+
src: "service";
|
|
37
|
+
logic: AdhocViewServiceActor;
|
|
38
|
+
id: string | undefined;
|
|
39
|
+
}, never, never, never, never>;
|
|
40
|
+
};
|
|
41
|
+
'select.close': {
|
|
42
|
+
target: "#idle";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
layouting: {
|
|
47
|
+
id: string;
|
|
48
|
+
always: {
|
|
49
|
+
target: "#idle";
|
|
50
|
+
actions: ActionFunction<Context, Events, Events, undefined, never, never, never, never, never>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { stringHash } from '@likec4/core/utils';
|
|
2
|
+
import { assertEvent } from 'xstate';
|
|
3
|
+
import { machine } from './actor.types.js';
|
|
4
|
+
|
|
5
|
+
const to = {
|
|
6
|
+
idle: { target: "#idle" },
|
|
7
|
+
selecting: { target: "#selecting" },
|
|
8
|
+
layouting: { target: "#layouting" }
|
|
9
|
+
};
|
|
10
|
+
const includePredicate = () => machine.assign(({ context, event }) => {
|
|
11
|
+
const id = stringHash((context.rules.at(-1)?.id ?? (/* @__PURE__ */ new Date()).toISOString()) + event.type);
|
|
12
|
+
switch (event.type) {
|
|
13
|
+
case "include.element": {
|
|
14
|
+
return {
|
|
15
|
+
rules: [
|
|
16
|
+
...context.rules,
|
|
17
|
+
{
|
|
18
|
+
id,
|
|
19
|
+
expr: { ref: { model: event.model } },
|
|
20
|
+
enabled: true,
|
|
21
|
+
type: "include"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
default: {
|
|
27
|
+
throw new Error(`Unexpected event ${event.type}}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const toggleRule = () => machine.assign(({ context, event }) => {
|
|
32
|
+
assertEvent(event, "toggle.rule");
|
|
33
|
+
return {
|
|
34
|
+
rules: context.rules.map((rule) => {
|
|
35
|
+
if (rule.id === event.ruleId) {
|
|
36
|
+
return {
|
|
37
|
+
...rule,
|
|
38
|
+
enabled: !rule.enabled
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return rule;
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
const deleteRule = () => machine.assign(({ context, event }) => {
|
|
46
|
+
assertEvent(event, "delete.rule");
|
|
47
|
+
return {
|
|
48
|
+
rules: context.rules.filter((rule) => rule.id !== event.ruleId)
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const scheduleLayout = () => machine.raise({ type: "layout" });
|
|
52
|
+
const idle = machine.createStateConfig({
|
|
53
|
+
id: "idle",
|
|
54
|
+
on: {
|
|
55
|
+
"select.open": {
|
|
56
|
+
...to.selecting
|
|
57
|
+
},
|
|
58
|
+
"toggle.rule": {
|
|
59
|
+
actions: toggleRule(),
|
|
60
|
+
...to.layouting
|
|
61
|
+
},
|
|
62
|
+
"delete.rule": {
|
|
63
|
+
actions: deleteRule(),
|
|
64
|
+
...to.layouting
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const selecting = machine.createStateConfig({
|
|
69
|
+
id: "selecting",
|
|
70
|
+
on: {
|
|
71
|
+
"include.element": {
|
|
72
|
+
actions: includePredicate(),
|
|
73
|
+
...to.layouting
|
|
74
|
+
},
|
|
75
|
+
"select.close": {
|
|
76
|
+
...to.idle
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const layouting = machine.createStateConfig({
|
|
81
|
+
id: "layouting",
|
|
82
|
+
always: {
|
|
83
|
+
actions: scheduleLayout(),
|
|
84
|
+
...to.idle
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const editor = machine.createStateConfig({
|
|
88
|
+
initial: "idle",
|
|
89
|
+
states: {
|
|
90
|
+
idle,
|
|
91
|
+
selecting,
|
|
92
|
+
layouting
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export { editor };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { editor } from './actor.editor.js';
|
|
2
|
+
import { layouter } from './actor.layouter.js';
|
|
3
|
+
import { machine } from './actor.types.js';
|
|
4
|
+
|
|
5
|
+
const _adhocEditorLogic = machine.createMachine({
|
|
6
|
+
id: "adhoc-editor",
|
|
7
|
+
context: () => ({
|
|
8
|
+
view: null,
|
|
9
|
+
error: void 0,
|
|
10
|
+
rules: []
|
|
11
|
+
}),
|
|
12
|
+
type: "parallel",
|
|
13
|
+
states: {
|
|
14
|
+
layouter,
|
|
15
|
+
editor
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const adhocEditorLogic = _adhocEditorLogic;
|
|
19
|
+
|
|
20
|
+
export { adhocEditorLogic };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { LogAction, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, DoneActorEvent, ErrorActorEvent } from 'xstate';
|
|
2
|
+
import { Context, Events, AdhocViewServiceActor } from './actor.types';
|
|
3
|
+
import { AdhocViewPredicate } from '@likec4/core/compute-view';
|
|
4
|
+
import { LayoutedElementView } from '@likec4/core';
|
|
5
|
+
export declare const layouter: {
|
|
6
|
+
initial: string;
|
|
7
|
+
states: {
|
|
8
|
+
idle: {
|
|
9
|
+
id: string;
|
|
10
|
+
entry: LogAction<Context, Events, undefined, Events>;
|
|
11
|
+
exit: LogAction<Context, Events, undefined, Events>;
|
|
12
|
+
on: {
|
|
13
|
+
layout: {
|
|
14
|
+
target: "#layouter-call";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
call: {
|
|
19
|
+
id: string;
|
|
20
|
+
entry: LogAction<Context, Events, undefined, Events>;
|
|
21
|
+
exit: LogAction<Context, Events, undefined, Events>;
|
|
22
|
+
invoke: {
|
|
23
|
+
src: "service";
|
|
24
|
+
input: ({ context }: {
|
|
25
|
+
context: Context;
|
|
26
|
+
event: Events;
|
|
27
|
+
self: ActorRef<MachineSnapshot<Context, Events, Record<string, AnyActorRef>, StateValue, string, unknown, any, any>, Events, AnyEventObject>;
|
|
28
|
+
}) => {
|
|
29
|
+
predicates: AdhocViewPredicate[];
|
|
30
|
+
};
|
|
31
|
+
onDone: {
|
|
32
|
+
target: "#layouter-idle";
|
|
33
|
+
actions: ActionFunction<Context, DoneActorEvent<{
|
|
34
|
+
view: LayoutedElementView;
|
|
35
|
+
}, string>, Events, undefined, {
|
|
36
|
+
src: "service";
|
|
37
|
+
logic: AdhocViewServiceActor;
|
|
38
|
+
id: string | undefined;
|
|
39
|
+
}, never, never, never, never>;
|
|
40
|
+
};
|
|
41
|
+
onError: {
|
|
42
|
+
target: "#layouter-idle";
|
|
43
|
+
actions: LogAction<Context, ErrorActorEvent<unknown, string>, undefined, Events>[];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { objectHash } from '@likec4/core/utils';
|
|
2
|
+
import { piped, filter, map } from 'remeda';
|
|
3
|
+
import { log, assign } 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 selectEnabled = piped(
|
|
21
|
+
filter((rule) => rule.enabled),
|
|
22
|
+
map(ruleToPredicate)
|
|
23
|
+
);
|
|
24
|
+
const call = machine.createStateConfig({
|
|
25
|
+
id: to.call.target.substring(1),
|
|
26
|
+
entry: log("entry call ->"),
|
|
27
|
+
exit: log(" -> call exit "),
|
|
28
|
+
invoke: {
|
|
29
|
+
src: "service",
|
|
30
|
+
input: ({ context }) => ({
|
|
31
|
+
predicates: selectEnabled(context.rules)
|
|
32
|
+
}),
|
|
33
|
+
onDone: {
|
|
34
|
+
actions: assign({
|
|
35
|
+
view: ({ context, event }) => {
|
|
36
|
+
const id = objectHash(selectEnabled(context.rules));
|
|
37
|
+
return {
|
|
38
|
+
...event.output.view,
|
|
39
|
+
hash: id,
|
|
40
|
+
id
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
error: void 0
|
|
44
|
+
}),
|
|
45
|
+
...to.idle
|
|
46
|
+
},
|
|
47
|
+
onError: {
|
|
48
|
+
actions: [
|
|
49
|
+
log(({ event }) => `error: ${event.error}`),
|
|
50
|
+
assign({
|
|
51
|
+
error: ({ event }) => `${event.error}`
|
|
52
|
+
})
|
|
53
|
+
],
|
|
54
|
+
...to.idle
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const layouter = machine.createStateConfig({
|
|
59
|
+
initial: "idle",
|
|
60
|
+
states: {
|
|
61
|
+
idle,
|
|
62
|
+
call
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export { layouter };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AdhocViewPredicate } from '@likec4/core/compute-view';
|
|
2
|
+
import { Fqn, LayoutedElementView, ModelExpression } 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: ModelExpression;
|
|
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
|
+
export type Events = {
|
|
32
|
+
type: 'include.element';
|
|
33
|
+
model: Fqn;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'exclude.element';
|
|
36
|
+
model: Fqn;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'toggle.rule';
|
|
39
|
+
ruleId: string;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'delete.rule';
|
|
42
|
+
ruleId: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'select.open';
|
|
45
|
+
} | {
|
|
46
|
+
type: 'select.close';
|
|
47
|
+
} | {
|
|
48
|
+
type: 'layout';
|
|
49
|
+
} | {
|
|
50
|
+
type: 'dispose';
|
|
51
|
+
};
|
|
52
|
+
export declare const machine: SetupReturn<Context, Events, {
|
|
53
|
+
service: AdhocViewServiceActor;
|
|
54
|
+
}, {}, {}, {
|
|
55
|
+
hasView: unknown;
|
|
56
|
+
}, never, "hasView", NonReducibleUnknown, NonReducibleUnknown, EmittedEvents, MetaObject>;
|
|
57
|
+
export {};
|