@likec4/diagram 1.47.0 → 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 +5489 -4909
- package/dist/LikeC4Diagram.js +18 -12
- package/dist/LikeC4Diagram.props.d.ts +1 -5
- 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.d.ts +1 -1
- package/dist/base-primitives/Markdown.js +1 -1
- package/dist/base-primitives/NodeHandles.d.ts +4 -2
- package/dist/base-primitives/NodeHandles.js +46 -19
- package/dist/base-primitives/compound/CompoundActionButton.js +3 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +3 -1
- package/dist/base-primitives/compound/CompoundNodeContainer.js +6 -4
- package/dist/base-primitives/compound/CompoundTitle.js +1 -2
- package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +5 -2
- package/dist/base-primitives/edge/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 +1 -0
- 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 +2 -2
- package/dist/components/NavigationPanel.js +9 -28
- 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/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 +8 -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/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 +7 -4
- package/dist/index.js +4 -2
- package/dist/likec4diagram/DiagramUI.js +1 -3
- package/dist/likec4diagram/DiagramXYFlow.js +25 -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 +5 -4
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +7 -6
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +3 -3
- 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/navigationpanel/NavigationPanel.js +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +4 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
- package/dist/navigationpanel/_common.d.ts +1 -1
- 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/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/dropdown/ProjectsMenu.js +12 -6
- package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
- package/dist/navigationpanel/editorpanel/styles.js +4 -4
- package/dist/navigationpanel/styles.css.d.ts +1 -1
- package/dist/navigationpanel/styles.css.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +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/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/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/actor.js +8 -31
- package/dist/projects-overview/custom/nodeTypes.js +1 -1
- package/dist/projects-overview/panel/ProjectsOverviewPanel.js +1 -1
- 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.d.ts +1 -1
- 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 +21 -20
- package/panda.buildinfo.json +80 -104
- package/styles-font.css +1 -1
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- 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/overlays/relationships-browser/custom/styles.css.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/IconFileText.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { MantineContext
|
|
2
|
+
import { MantineContext } from '@mantine/core';
|
|
3
3
|
import { useContext, useEffect } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { DefaultMantineProvider } from './DefaultMantineProvider.js';
|
|
5
5
|
|
|
6
6
|
function EnsureMantine({ children }) {
|
|
7
7
|
const mantineCtx = useContext(MantineContext);
|
|
@@ -11,10 +11,9 @@ function EnsureMantine({ children }) {
|
|
|
11
11
|
}
|
|
12
12
|
}, []);
|
|
13
13
|
if (!mantineCtx) {
|
|
14
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
+
return /* @__PURE__ */ jsx(DefaultMantineProvider, { children });
|
|
15
15
|
}
|
|
16
16
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
17
17
|
}
|
|
18
|
-
EnsureMantine.displayName = "EnsureMantine";
|
|
19
18
|
|
|
20
19
|
export { EnsureMantine };
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { ElementShape } from '@likec4/core';
|
|
2
2
|
import { CSSProperties, PropsWithChildren } from 'react';
|
|
3
3
|
import { ElementIconRenderer } from '../LikeC4Diagram.props';
|
|
4
|
+
/**
|
|
5
|
+
* Provider for custom element icon renderers
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const MyIconRenderer: ElementIconRenderer = ({ node }) => {
|
|
10
|
+
* return <div>{node.title}</div>
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* <IconRendererProvider value={MyIconRenderer}>
|
|
14
|
+
* <LikeC4Diagram />
|
|
15
|
+
* </IconRendererProvider>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
4
18
|
export declare function IconRendererProvider({ value, children, }: PropsWithChildren<{
|
|
5
19
|
value: ElementIconRenderer | null;
|
|
6
20
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@likec4/styles/css';
|
|
3
3
|
import { createContext, useContext } from 'react';
|
|
4
|
-
import IconFileText from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
5
|
-
import IconCylinder from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
6
|
-
import IconRectangularPrism from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
7
|
-
import IconReorder from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
8
|
-
import IconUser from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
9
|
-
import IconDeviceMobile from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
10
|
-
import IconBrowser from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
4
|
+
import IconFileText from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js';
|
|
5
|
+
import IconCylinder from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js';
|
|
6
|
+
import IconRectangularPrism from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js';
|
|
7
|
+
import IconReorder from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js';
|
|
8
|
+
import IconUser from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js';
|
|
9
|
+
import IconDeviceMobile from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js';
|
|
10
|
+
import IconBrowser from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js';
|
|
11
11
|
|
|
12
12
|
const IconRendererContext = createContext(null);
|
|
13
13
|
function IconRendererProvider({
|
|
@@ -30,7 +30,7 @@ function IconRenderer({
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
let icon;
|
|
33
|
-
if (element.icon.startsWith("http://") || element.icon.startsWith("https://")) {
|
|
33
|
+
if (element.icon.startsWith("http://") || element.icon.startsWith("https://") || element.icon.startsWith("data:image")) {
|
|
34
34
|
icon = /* @__PURE__ */ jsx("img", { src: element.icon, alt: element.title });
|
|
35
35
|
} else if (RenderIcon) {
|
|
36
36
|
icon = /* @__PURE__ */ jsx(RenderIcon, { node: element });
|
|
@@ -46,15 +46,23 @@ function generateStylesheet(tags, rootSelector) {
|
|
|
46
46
|
}
|
|
47
47
|
function TagStylesProvider({ children, rootSelector }) {
|
|
48
48
|
const tags = useLikeC4Specification().tags;
|
|
49
|
+
const nonce = useMantineStyleNonce()?.();
|
|
49
50
|
const stylesheet = generateStylesheet(tags, rootSelector);
|
|
50
51
|
return /* @__PURE__ */ jsxs(TagStylesContext.Provider, { value: tags, children: [
|
|
51
|
-
stylesheet !== "" && /* @__PURE__ */ jsx(TagStylesheet, { stylesheet }),
|
|
52
|
+
stylesheet !== "" && /* @__PURE__ */ jsx(TagStylesheet, { nonce, stylesheet }),
|
|
52
53
|
children
|
|
53
54
|
] });
|
|
54
55
|
}
|
|
55
|
-
const TagStylesheet = memo(({ stylesheet }) => {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const TagStylesheet = memo(({ stylesheet, nonce }) => {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"style",
|
|
59
|
+
{
|
|
60
|
+
"data-likec4-tags": true,
|
|
61
|
+
type: "text/css",
|
|
62
|
+
dangerouslySetInnerHTML: { __html: stylesheet },
|
|
63
|
+
nonce
|
|
64
|
+
}
|
|
65
|
+
);
|
|
58
66
|
});
|
|
59
67
|
function useTagSpecification(tag) {
|
|
60
68
|
const specs = useContext(TagStylesContext);
|
package/dist/custom/hooks.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { useDiagramEventHandlers, } from '../context/DiagramEventHandlers';
|
|
|
3
3
|
export { type EnabledFeatures, type FeatureName, useEnabledFeatures, } from '../context/DiagramFeatures';
|
|
4
4
|
export { useCurrentView, useCurrentViewId, } from '../hooks/useCurrentView';
|
|
5
5
|
export { type DiagramApi, useDiagram, useDiagramActorRef, useDiagramContext, useOnDiagramEvent, } from '../hooks/useDiagram';
|
|
6
|
-
export { useCurrentViewModel, } from '../hooks/useCurrentViewModel';
|
|
7
|
-
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from '../hooks/useLikeC4Model';
|
|
6
|
+
export { type CurrentViewModel, useCurrentViewModel, useOptionalCurrentViewModel, } from '../hooks/useCurrentViewModel';
|
|
7
|
+
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, useOptionalLikeC4Model, } from '../hooks/useLikeC4Model';
|
|
8
8
|
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from '../hooks/useLikeC4Project';
|
|
9
9
|
export { useLikeC4Styles, } from '../hooks/useLikeC4Styles';
|
|
10
10
|
export { useSetState } from '../hooks/useSetState';
|
package/dist/custom/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from './customNodes';
|
|
|
3
3
|
export * from './hooks';
|
|
4
4
|
export * from './primitives';
|
|
5
5
|
export type { BaseEdge, BaseEdgeData, BaseEdgeProps, BaseEdgePropsWithData, BaseNode, BaseNodeData, BaseNodeProps, BaseNodePropsWithData, } from '../base/types';
|
|
6
|
-
export type {
|
|
6
|
+
export type { DiagramNodeWithNavigate, ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, LikeC4DiagramEventHandlers, LikeC4DiagramProperties, NodeRenderers, OnCanvasClick, OnEdgeClick, OnNavigateTo, OnNodeClick, OpenSourceParams, PaddingUnit, PaddingWithUnit, ViewPadding, WhereOperator, } from '../LikeC4Diagram.props';
|
|
7
7
|
export { Base } from '../base/Base';
|
|
8
8
|
export type { Types } from '../likec4diagram/types';
|
|
9
9
|
export { type EnabledFeatures, IfEnabled, IfNotEnabled, IfNotReadOnly, IfReadOnly, useEnabledFeatures, } from '../context/DiagramFeatures';
|
package/dist/custom/index.js
CHANGED
|
@@ -16,8 +16,8 @@ export { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
|
16
16
|
export { useCurrentView, useCurrentViewId } from '../hooks/useCurrentView.js';
|
|
17
17
|
export { useDiagram, useDiagramActorRef } from '../hooks/safeContext.js';
|
|
18
18
|
export { useDiagramContext, useOnDiagramEvent } from '../hooks/useDiagram.js';
|
|
19
|
-
export { useCurrentViewModel } from '../hooks/useCurrentViewModel.js';
|
|
20
|
-
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from '../hooks/useLikeC4Model.js';
|
|
19
|
+
export { useCurrentViewModel, useOptionalCurrentViewModel } from '../hooks/useCurrentViewModel.js';
|
|
20
|
+
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, useOptionalLikeC4Model } from '../hooks/useLikeC4Model.js';
|
|
21
21
|
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from '../hooks/useLikeC4Project.js';
|
|
22
22
|
export { useLikeC4Styles } from '../hooks/useLikeC4Styles.js';
|
|
23
23
|
export { useSetState } from '../hooks/useSetState.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as t from '@likec4/core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Callbacks from LikeC4 Editor.
|
|
4
|
+
*/
|
|
5
|
+
export interface LikeC4EditorCallbacks {
|
|
6
|
+
/**
|
|
7
|
+
* Fetch a view by its ID and layout type.
|
|
8
|
+
*
|
|
9
|
+
* @param viewId - The ID of the view to fetch.
|
|
10
|
+
* @param layout - The layout type to use when fetching the view.
|
|
11
|
+
*/
|
|
12
|
+
fetchView(viewId: t.ViewId, layout?: t.LayoutType): t.LayoutedView | Promise<t.LayoutedView>;
|
|
13
|
+
/**
|
|
14
|
+
* Callback invoked when the view changes.
|
|
15
|
+
*/
|
|
16
|
+
handleChange(viewId: t.ViewId, change: t.ViewChange): void | Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function createLikeC4Editor(callbacks: LikeC4EditorCallbacks): LikeC4EditorCallbacks;
|
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
import { PropsWithChildren
|
|
2
|
-
import
|
|
3
|
-
export type LikeC4EditorPort = {
|
|
4
|
-
/**
|
|
5
|
-
* Fetch a view by its ID and layout type.
|
|
6
|
-
*
|
|
7
|
-
* @param viewId - The ID of the view to fetch.
|
|
8
|
-
* @param layout - The layout type to use when fetching the view.
|
|
9
|
-
*/
|
|
10
|
-
fetchView(viewId: t.ViewId, layout?: t.LayoutType): t.LayoutedView | Promise<t.LayoutedView>;
|
|
11
|
-
/**
|
|
12
|
-
* Callback invoked when the view changes.
|
|
13
|
-
*/
|
|
14
|
-
handleChange(viewId: t.ViewId, change: t.ViewChange): void | Promise<void>;
|
|
15
|
-
};
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { LikeC4EditorCallbacks } from './LikeC4EditorCallbacks';
|
|
16
3
|
export type LikeC4EditorProviderProps = PropsWithChildren<{
|
|
17
|
-
editor:
|
|
4
|
+
editor: LikeC4EditorCallbacks;
|
|
18
5
|
}>;
|
|
19
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Provider for the LikeC4 Editor.
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
*
|
|
11
|
+
* // Not required to use memo for editor callbacks
|
|
12
|
+
* const editor = createLikeC4Editor({
|
|
13
|
+
* fetchView: async (viewId, layout) => {
|
|
14
|
+
* // fetch view logic
|
|
15
|
+
* },
|
|
16
|
+
* handleChange: (viewId, change) => {
|
|
17
|
+
* // handle change logic
|
|
18
|
+
* }
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* <LikeC4EditorProvider
|
|
22
|
+
* editor={editor}>
|
|
23
|
+
* <App />
|
|
24
|
+
* </LikeC4EditorProvider>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
20
27
|
export declare function LikeC4EditorProvider({ children, editor }: LikeC4EditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* Component that ensures the editor context is available.
|
|
30
|
+
*
|
|
31
|
+
* @param children - The children to render.
|
|
32
|
+
*/
|
|
21
33
|
export declare function EnsureEditorContext({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
-
export declare function
|
|
34
|
+
export declare function useOptionalLikeC4Editor(): LikeC4EditorCallbacks | null;
|
|
@@ -5,8 +5,8 @@ const LikeC4EditorReactContext = createContext(null);
|
|
|
5
5
|
function LikeC4EditorProvider({ children, editor }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(LikeC4EditorReactContext.Provider, { value: editor, children });
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function useOptionalLikeC4Editor() {
|
|
9
9
|
return useContext(LikeC4EditorReactContext);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export { LikeC4EditorProvider,
|
|
12
|
+
export { LikeC4EditorProvider, useOptionalLikeC4Editor };
|
|
@@ -144,6 +144,7 @@ function makeAsStraightLine(edge, sourceNode, targetNode) {
|
|
|
144
144
|
const controlPoints = edgeControlPoints(sourceNode, targetNode);
|
|
145
145
|
const labelPos = controlPoints[0];
|
|
146
146
|
return produce(edge, (draft) => {
|
|
147
|
+
draft.points = controlPoints.map((p) => [p.x, p.y]);
|
|
147
148
|
draft.controlPoints = controlPoints;
|
|
148
149
|
if (edge.labelBBox) {
|
|
149
150
|
draft.labelBBox.x = labelPos.x;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ViewChange } from '@likec4/core/types';
|
|
2
2
|
import { ActionFunction, CancelAction, Values, PromiseActorLogic, EventObject, NonReducibleUnknown, StopAction } from 'xstate';
|
|
3
|
-
import { EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './editorActor';
|
|
3
|
+
import { EditorActorContext, EditorActorEvent, EditorActorEmitedEvent } from './editorActor.setup';
|
|
4
4
|
import { HotkeyActorLogic } from './hotkeyActor';
|
|
5
|
-
export declare const raiseSync: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "
|
|
5
|
+
export declare const raiseSync: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "500ms" | "waitBeforeSync", never>;
|
|
6
6
|
export declare const cancelSync: () => CancelAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>;
|
|
7
|
-
export declare const reschedule: (delay?: number) => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "
|
|
7
|
+
export declare const reschedule: (delay?: number) => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, never, never, never, "500ms" | "waitBeforeSync", never>;
|
|
8
8
|
type LayoutChanges = ViewChange.ResetManualLayout | ViewChange.SaveViewSnapshot;
|
|
9
9
|
export declare const isLayoutChange: (change: ViewChange) => change is LayoutChanges;
|
|
10
10
|
export declare const withoutSnapshotChanges: (data: ViewChange[]) => (ViewChange.ChangeElementStyle | ViewChange.ChangeAutoLayout)[];
|
|
@@ -16,12 +16,12 @@ export declare const saveStateBeforeEdit: () => ActionFunction<EditorActorContex
|
|
|
16
16
|
};
|
|
17
17
|
applyLatest: {
|
|
18
18
|
src: "applyLatest";
|
|
19
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
19
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
20
20
|
id: string | undefined;
|
|
21
21
|
};
|
|
22
22
|
executeChange: {
|
|
23
23
|
src: "executeChange";
|
|
24
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
24
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
25
25
|
id: string | undefined;
|
|
26
26
|
};
|
|
27
27
|
}>, never, never, never, never>;
|
|
@@ -33,12 +33,12 @@ export declare const startEditing: () => ActionFunction<EditorActorContext, Edit
|
|
|
33
33
|
};
|
|
34
34
|
applyLatest: {
|
|
35
35
|
src: "applyLatest";
|
|
36
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
36
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
37
37
|
id: string | undefined;
|
|
38
38
|
};
|
|
39
39
|
executeChange: {
|
|
40
40
|
src: "executeChange";
|
|
41
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
41
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
42
42
|
id: string | undefined;
|
|
43
43
|
};
|
|
44
44
|
}>, never, Values<{
|
|
@@ -50,7 +50,7 @@ export declare const startEditing: () => ActionFunction<EditorActorContext, Edit
|
|
|
50
50
|
type: "can undo";
|
|
51
51
|
params: unknown;
|
|
52
52
|
};
|
|
53
|
-
}>, "
|
|
53
|
+
}>, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
54
54
|
export declare const stopHotkey: () => StopAction<EditorActorContext, EditorActorEvent, undefined, EditorActorEvent>;
|
|
55
55
|
export declare const ensureHotKey: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
56
56
|
hotkey: {
|
|
@@ -60,12 +60,12 @@ export declare const ensureHotKey: () => ActionFunction<EditorActorContext, Edit
|
|
|
60
60
|
};
|
|
61
61
|
applyLatest: {
|
|
62
62
|
src: "applyLatest";
|
|
63
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
63
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
64
64
|
id: string | undefined;
|
|
65
65
|
};
|
|
66
66
|
executeChange: {
|
|
67
67
|
src: "executeChange";
|
|
68
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
68
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
69
69
|
id: string | undefined;
|
|
70
70
|
};
|
|
71
71
|
}>, never, Values<{
|
|
@@ -77,7 +77,7 @@ export declare const ensureHotKey: () => ActionFunction<EditorActorContext, Edit
|
|
|
77
77
|
type: "can undo";
|
|
78
78
|
params: unknown;
|
|
79
79
|
};
|
|
80
|
-
}>, "
|
|
80
|
+
}>, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
81
81
|
export declare const pushHistory: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
82
82
|
hotkey: {
|
|
83
83
|
src: "hotkey";
|
|
@@ -86,12 +86,12 @@ export declare const pushHistory: () => ActionFunction<EditorActorContext, Edito
|
|
|
86
86
|
};
|
|
87
87
|
applyLatest: {
|
|
88
88
|
src: "applyLatest";
|
|
89
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
89
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
90
90
|
id: string | undefined;
|
|
91
91
|
};
|
|
92
92
|
executeChange: {
|
|
93
93
|
src: "executeChange";
|
|
94
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
94
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
95
95
|
id: string | undefined;
|
|
96
96
|
};
|
|
97
97
|
}>, never, never, never, never>;
|
|
@@ -103,12 +103,12 @@ export declare const stopEditing: () => ActionFunction<EditorActorContext, Edito
|
|
|
103
103
|
};
|
|
104
104
|
applyLatest: {
|
|
105
105
|
src: "applyLatest";
|
|
106
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
106
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
107
107
|
id: string | undefined;
|
|
108
108
|
};
|
|
109
109
|
executeChange: {
|
|
110
110
|
src: "executeChange";
|
|
111
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
111
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
112
112
|
id: string | undefined;
|
|
113
113
|
};
|
|
114
114
|
}>, never, Values<{
|
|
@@ -120,7 +120,7 @@ export declare const stopEditing: () => ActionFunction<EditorActorContext, Edito
|
|
|
120
120
|
type: "can undo";
|
|
121
121
|
params: unknown;
|
|
122
122
|
};
|
|
123
|
-
}>, "
|
|
123
|
+
}>, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
124
124
|
export declare const markHistoryAsSynched: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
125
125
|
hotkey: {
|
|
126
126
|
src: "hotkey";
|
|
@@ -129,12 +129,12 @@ export declare const markHistoryAsSynched: () => ActionFunction<EditorActorConte
|
|
|
129
129
|
};
|
|
130
130
|
applyLatest: {
|
|
131
131
|
src: "applyLatest";
|
|
132
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
132
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
133
133
|
id: string | undefined;
|
|
134
134
|
};
|
|
135
135
|
executeChange: {
|
|
136
136
|
src: "executeChange";
|
|
137
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
137
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
138
138
|
id: string | undefined;
|
|
139
139
|
};
|
|
140
140
|
}>, never, never, never, never>;
|
|
@@ -146,12 +146,12 @@ export declare const popHistory: () => ActionFunction<EditorActorContext, Editor
|
|
|
146
146
|
};
|
|
147
147
|
applyLatest: {
|
|
148
148
|
src: "applyLatest";
|
|
149
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
149
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
150
150
|
id: string | undefined;
|
|
151
151
|
};
|
|
152
152
|
executeChange: {
|
|
153
153
|
src: "executeChange";
|
|
154
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
154
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
155
155
|
id: string | undefined;
|
|
156
156
|
};
|
|
157
157
|
}>, never, never, never, never>;
|
|
@@ -163,12 +163,12 @@ export declare const undo: () => ActionFunction<EditorActorContext, EditorActorE
|
|
|
163
163
|
};
|
|
164
164
|
applyLatest: {
|
|
165
165
|
src: "applyLatest";
|
|
166
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
166
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
167
167
|
id: string | undefined;
|
|
168
168
|
};
|
|
169
169
|
executeChange: {
|
|
170
170
|
src: "executeChange";
|
|
171
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
171
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
172
172
|
id: string | undefined;
|
|
173
173
|
};
|
|
174
174
|
}>, never, Values<{
|
|
@@ -180,7 +180,7 @@ export declare const undo: () => ActionFunction<EditorActorContext, EditorActorE
|
|
|
180
180
|
type: "can undo";
|
|
181
181
|
params: unknown;
|
|
182
182
|
};
|
|
183
|
-
}>, "
|
|
183
|
+
}>, "500ms" | "waitBeforeSync", EditorActorEmitedEvent>;
|
|
184
184
|
export declare const addSnapshotToPendingChanges: () => ActionFunction<EditorActorContext, EditorActorEvent, EditorActorEvent, undefined, Values<{
|
|
185
185
|
hotkey: {
|
|
186
186
|
src: "hotkey";
|
|
@@ -189,12 +189,12 @@ export declare const addSnapshotToPendingChanges: () => ActionFunction<EditorAct
|
|
|
189
189
|
};
|
|
190
190
|
applyLatest: {
|
|
191
191
|
src: "applyLatest";
|
|
192
|
-
logic: PromiseActorLogic<import("./editorActor").EditorCalls.ApplyLatestToManual.Output, import("./editorActor").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
192
|
+
logic: PromiseActorLogic<import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Output, import("./editorActor.setup").EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
193
193
|
id: string | undefined;
|
|
194
194
|
};
|
|
195
195
|
executeChange: {
|
|
196
196
|
src: "executeChange";
|
|
197
|
-
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
197
|
+
logic: PromiseActorLogic<NonReducibleUnknown, import("./editorActor.setup").EditorCalls.ExecuteChange.Input, EventObject>;
|
|
198
198
|
id: string | undefined;
|
|
199
199
|
};
|
|
200
200
|
}>, never, never, never, never>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { last, filter, isNot, omit } from 'remeda';
|
|
2
2
|
import { createViewChange } from '../likec4diagram/state/createViewChange.js';
|
|
3
|
-
import { machine } from './editorActor.js';
|
|
3
|
+
import { machine } from './editorActor.setup.js';
|
|
4
4
|
|
|
5
5
|
const diagramActorRef = function(system) {
|
|
6
6
|
return system.get("diagram");
|
|
@@ -10,7 +10,7 @@ const getDiagramContext = function(system) {
|
|
|
10
10
|
};
|
|
11
11
|
const raiseSync = () => machine.raise({ type: "sync" }, { delay: 200, id: "sync" });
|
|
12
12
|
const cancelSync = () => machine.cancel("sync");
|
|
13
|
-
const reschedule = (delay =
|
|
13
|
+
const reschedule = (delay = 350) => machine.raise(({ event }) => event, { delay });
|
|
14
14
|
const isLayoutChange = (change) => change.op === "reset-manual-layout" || change.op === "save-view-snapshot";
|
|
15
15
|
const withoutSnapshotChanges = filter(isNot(isLayoutChange));
|
|
16
16
|
const saveStateBeforeEdit = () => machine.assign(({ system }) => {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { NonReducibleUnknown, SetupReturn, PromiseActorLogic, EventObject, MetaObject } from 'xstate';
|
|
2
|
+
import { Types } from '../likec4diagram/types';
|
|
3
|
+
import { HotKeyEvent, HotkeyActorLogic } from './hotkeyActor';
|
|
4
|
+
import type * as t from '@likec4/core/types';
|
|
5
|
+
export declare namespace EditorCalls {
|
|
6
|
+
type ApplyLatestToManual = (params: {
|
|
7
|
+
input: ApplyLatestToManual.Input;
|
|
8
|
+
}) => Promise<ApplyLatestToManual.Output>;
|
|
9
|
+
namespace ApplyLatestToManual {
|
|
10
|
+
type Input = {
|
|
11
|
+
viewId: t.ViewId;
|
|
12
|
+
current: t.LayoutedView | undefined;
|
|
13
|
+
};
|
|
14
|
+
type Output = {
|
|
15
|
+
updated: t.LayoutedView;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
type ExecuteChange = (params: {
|
|
19
|
+
input: ExecuteChange.Input;
|
|
20
|
+
}) => Promise<ExecuteChange.Output>;
|
|
21
|
+
namespace ExecuteChange {
|
|
22
|
+
type Input = {
|
|
23
|
+
viewId: t.ViewId;
|
|
24
|
+
changes: t.ViewChange[];
|
|
25
|
+
};
|
|
26
|
+
type Output = NonReducibleUnknown;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export type EditorActorEvent = {
|
|
30
|
+
type: 'sync';
|
|
31
|
+
} | {
|
|
32
|
+
type: 'change';
|
|
33
|
+
change: t.ViewChange;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'edit.start';
|
|
36
|
+
subject: 'node' | 'edge';
|
|
37
|
+
} | {
|
|
38
|
+
type: 'edit.finish';
|
|
39
|
+
wasChanged?: boolean;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'applyLatestToManual';
|
|
42
|
+
} | {
|
|
43
|
+
type: 'synced';
|
|
44
|
+
} | {
|
|
45
|
+
type: 'cancel';
|
|
46
|
+
} | {
|
|
47
|
+
type: 'reset';
|
|
48
|
+
} | HotKeyEvent;
|
|
49
|
+
export type HistorySnapshot = {
|
|
50
|
+
view: t.LayoutedView;
|
|
51
|
+
change: t.ViewChange.SaveViewSnapshot;
|
|
52
|
+
xynodes: Types.Node[];
|
|
53
|
+
xyedges: Types.Edge[];
|
|
54
|
+
synched: boolean;
|
|
55
|
+
};
|
|
56
|
+
export interface EditorActorInput {
|
|
57
|
+
viewId: t.ViewId;
|
|
58
|
+
}
|
|
59
|
+
export interface EditorActorContext {
|
|
60
|
+
viewId: t.ViewId;
|
|
61
|
+
pendingChanges: t.ViewChange[];
|
|
62
|
+
history: ReadonlyArray<HistorySnapshot>;
|
|
63
|
+
/**
|
|
64
|
+
* The state before editing started
|
|
65
|
+
*/
|
|
66
|
+
beforeEditing: HistorySnapshot | null;
|
|
67
|
+
/**
|
|
68
|
+
* The subject of the edit
|
|
69
|
+
*/
|
|
70
|
+
editing: 'node' | 'edge' | null;
|
|
71
|
+
}
|
|
72
|
+
export type EditorActorEmitedEvent = {
|
|
73
|
+
type: 'idle';
|
|
74
|
+
};
|
|
75
|
+
export declare const machine: SetupReturn<EditorActorContext, EditorActorEvent, {
|
|
76
|
+
applyLatest: PromiseActorLogic<EditorCalls.ApplyLatestToManual.Output, EditorCalls.ApplyLatestToManual.Input, EventObject>;
|
|
77
|
+
executeChange: PromiseActorLogic<NonReducibleUnknown, EditorCalls.ExecuteChange.Input, EventObject>;
|
|
78
|
+
hotkey: HotkeyActorLogic;
|
|
79
|
+
}, {
|
|
80
|
+
hotkey: "hotkey";
|
|
81
|
+
}, {}, {
|
|
82
|
+
'has pending': unknown;
|
|
83
|
+
'can undo': unknown;
|
|
84
|
+
}, "500ms" | "waitBeforeSync", "pending", EditorActorInput, NonReducibleUnknown, EditorActorEmitedEvent, MetaObject>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { setup, fromPromise } from 'xstate';
|
|
2
|
+
import { hotkeyActorLogic } from './hotkeyActor.js';
|
|
3
|
+
|
|
4
|
+
const applyLatest = fromPromise(
|
|
5
|
+
() => {
|
|
6
|
+
throw new Error("Not implemented");
|
|
7
|
+
}
|
|
8
|
+
);
|
|
9
|
+
const executeChange = fromPromise(
|
|
10
|
+
() => {
|
|
11
|
+
throw new Error("Not implemented");
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
const machine = setup({
|
|
15
|
+
types: {
|
|
16
|
+
context: {},
|
|
17
|
+
events: {},
|
|
18
|
+
emitted: {},
|
|
19
|
+
input: {},
|
|
20
|
+
children: {},
|
|
21
|
+
tags: {}
|
|
22
|
+
},
|
|
23
|
+
delays: {
|
|
24
|
+
"500ms": 500,
|
|
25
|
+
"waitBeforeSync": 2e3
|
|
26
|
+
},
|
|
27
|
+
actors: {
|
|
28
|
+
applyLatest,
|
|
29
|
+
executeChange,
|
|
30
|
+
hotkey: hotkeyActorLogic
|
|
31
|
+
},
|
|
32
|
+
guards: {
|
|
33
|
+
"has pending": ({ context }) => context.pendingChanges.length > 0,
|
|
34
|
+
"can undo": ({ context }) => context.history.length > 0
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { machine };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActorRef, SnapshotFrom, StateMachine } from 'xstate';
|
|
2
|
+
import { EditorActorContext, EditorActorEmitedEvent, EditorActorEvent, EditorActorInput } from './editorActor.setup';
|
|
3
|
+
export type { EditorActorContext, EditorActorEmitedEvent, EditorActorEvent, EditorActorInput, } from './editorActor.setup';
|
|
4
|
+
export interface EditorActorLogic extends StateMachine<EditorActorContext, EditorActorEvent, any, any, any, any, any, 'idle' | 'editing' | 'pending' | 'afterEdit' | 'applyLatestToManual' | 'executeChanges', any, EditorActorInput, any, EditorActorEmitedEvent, any, any> {
|
|
5
|
+
}
|
|
6
|
+
export declare const editorActorLogic: EditorActorLogic;
|
|
7
|
+
export type EditorActorSnapshot = SnapshotFrom<EditorActorLogic>;
|
|
8
|
+
export interface EditorActorRef extends ActorRef<EditorActorSnapshot, EditorActorEvent, EditorActorEmitedEvent> {
|
|
9
|
+
}
|