@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
package/dist/LikeC4Diagram.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export type LikeC4DiagramProps<A extends Any = Any> = PropsWithChildren<LikeC4Di
|
|
|
8
8
|
*
|
|
9
9
|
* Use {@link ReactLikeC4} or {@link LikeC4View} for ready-to-use component
|
|
10
10
|
*/
|
|
11
|
-
export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource,
|
|
11
|
+
export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onInitialized, view, className, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
|
package/dist/LikeC4Diagram.js
CHANGED
|
@@ -2,17 +2,18 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useCustomCompareMemo } from '@react-hookz/web';
|
|
3
3
|
import { ReactFlowProvider } from '@xyflow/react';
|
|
4
4
|
import { deepEqual } from 'fast-equals';
|
|
5
|
-
import { useRef } from 'react';
|
|
6
|
-
import { isPlainObject, mapValues } from 'remeda';
|
|
5
|
+
import { useRef, Profiler } from 'react';
|
|
6
|
+
import { isEmptyish, isPlainObject, mapValues } from 'remeda';
|
|
7
7
|
import { RootContainer } from './components/RootContainer.js';
|
|
8
8
|
import { TagStylesProvider } from './context/TagStylesContext.js';
|
|
9
9
|
import { useId } from './hooks/useId.js';
|
|
10
|
+
import { useOptionalLikeC4Model } from './hooks/useLikeC4Model.js';
|
|
10
11
|
import { LikeC4DiagramUI } from './likec4diagram/DiagramUI.js';
|
|
11
12
|
import { LikeC4DiagramXYFlow } from './likec4diagram/DiagramXYFlow.js';
|
|
12
13
|
import { DiagramActorProvider } from './likec4diagram/state/DiagramActorProvider.js';
|
|
13
14
|
import { LikeC4Styles } from './LikeC4Styles.js';
|
|
14
15
|
import { pickViewBounds } from './utils/view-bounds.js';
|
|
15
|
-
import {
|
|
16
|
+
import { useOptionalLikeC4Editor } from './editor/LikeC4EditorProvider.js';
|
|
16
17
|
import { MinZoom, MaxZoom, FitViewPaddings } from './base/const.js';
|
|
17
18
|
import { EnsureMantine } from './context/EnsureMantine.js';
|
|
18
19
|
import { FramerMotionConfig } from './context/FramerMotionConfig.js';
|
|
@@ -30,7 +31,7 @@ function LikeC4Diagram({
|
|
|
30
31
|
onNodeClick,
|
|
31
32
|
onNodeContextMenu,
|
|
32
33
|
onOpenSource,
|
|
33
|
-
|
|
34
|
+
onLogoClick,
|
|
34
35
|
onLayoutTypeChange,
|
|
35
36
|
onInitialized,
|
|
36
37
|
view,
|
|
@@ -64,7 +65,10 @@ function LikeC4Diagram({
|
|
|
64
65
|
}) {
|
|
65
66
|
const id = useId();
|
|
66
67
|
const initialRef = useRef(null);
|
|
67
|
-
const
|
|
68
|
+
const optionalLikeC4Model = useOptionalLikeC4Model();
|
|
69
|
+
enableCompareWithLatest = enableCompareWithLatest && !!onLayoutTypeChange && !!optionalLikeC4Model && !isEmptyish(optionalLikeC4Model.$data.manualLayouts);
|
|
70
|
+
const hasLikeC4Model = !!optionalLikeC4Model;
|
|
71
|
+
const hasEditor = !!useOptionalLikeC4Editor();
|
|
68
72
|
const readonly = !hasEditor;
|
|
69
73
|
nodesSelectable ??= hasEditor || enableFocusMode || !!onNavigateTo || !!onNodeClick;
|
|
70
74
|
const bounds = pickViewBounds(view, dynamicViewVariant);
|
|
@@ -84,8 +88,9 @@ function LikeC4Diagram({
|
|
|
84
88
|
initialMinZoom: MinZoom
|
|
85
89
|
};
|
|
86
90
|
}
|
|
87
|
-
const isReducedGraphicsMode = reduceGraphics === "auto" ? pannable &&
|
|
88
|
-
return /* @__PURE__ */ jsx(
|
|
91
|
+
const isReducedGraphicsMode = reduceGraphics === "auto" ? pannable && view.bounds.width * view.bounds.height > 16e6 && view.nodes.some((n) => n.children?.length > 0) : reduceGraphics;
|
|
92
|
+
return /* @__PURE__ */ jsx(Profiler, { id: "LikeC4Diagram", onRender: () => {
|
|
93
|
+
}, children: /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsx(
|
|
89
94
|
FramerMotionConfig,
|
|
90
95
|
{
|
|
91
96
|
...isReducedGraphicsMode && { reducedMotion: "always" },
|
|
@@ -98,17 +103,17 @@ function LikeC4Diagram({
|
|
|
98
103
|
enableReadOnly: readonly,
|
|
99
104
|
enableFocusMode,
|
|
100
105
|
enableNavigateTo: !!onNavigateTo,
|
|
101
|
-
enableElementDetails,
|
|
102
|
-
enableRelationshipDetails,
|
|
103
|
-
enableRelationshipBrowser,
|
|
104
|
-
enableSearch,
|
|
106
|
+
enableElementDetails: enableElementDetails && hasLikeC4Model,
|
|
107
|
+
enableRelationshipDetails: enableRelationshipDetails && hasLikeC4Model,
|
|
108
|
+
enableRelationshipBrowser: enableRelationshipBrowser && hasLikeC4Model,
|
|
109
|
+
enableSearch: enableSearch && hasLikeC4Model,
|
|
105
110
|
enableNavigationButtons: showNavigationButtons && !!onNavigateTo,
|
|
106
111
|
enableDynamicViewWalkthrough: view._type === "dynamic" && enableDynamicViewWalkthrough,
|
|
107
112
|
enableNotations,
|
|
108
113
|
enableVscode: !!onOpenSource,
|
|
109
114
|
enableControls: controls,
|
|
110
115
|
enableElementTags,
|
|
111
|
-
enableCompareWithLatest
|
|
116
|
+
enableCompareWithLatest
|
|
112
117
|
},
|
|
113
118
|
children: /* @__PURE__ */ jsxs(
|
|
114
119
|
DiagramEventHandlers,
|
|
@@ -123,7 +128,7 @@ function LikeC4Diagram({
|
|
|
123
128
|
onNodeClick,
|
|
124
129
|
onNodeContextMenu,
|
|
125
130
|
onOpenSource,
|
|
126
|
-
|
|
131
|
+
onLogoClick,
|
|
127
132
|
onInitialized,
|
|
128
133
|
onLayoutTypeChange
|
|
129
134
|
},
|
|
@@ -137,6 +142,7 @@ function LikeC4Diagram({
|
|
|
137
142
|
children: /* @__PURE__ */ jsxs(
|
|
138
143
|
DiagramActorProvider,
|
|
139
144
|
{
|
|
145
|
+
id,
|
|
140
146
|
view,
|
|
141
147
|
zoomable,
|
|
142
148
|
pannable,
|
|
@@ -167,7 +173,7 @@ function LikeC4Diagram({
|
|
|
167
173
|
}
|
|
168
174
|
) })
|
|
169
175
|
}
|
|
170
|
-
) });
|
|
176
|
+
) }) });
|
|
171
177
|
}
|
|
172
178
|
const toLiteralPaddingWithUnit = (value) => {
|
|
173
179
|
if (typeof value === "number") {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiagramEdge, DiagramNode, DynamicViewDisplayVariant, LayoutedView, LayoutType,
|
|
1
|
+
import { DiagramEdge, DiagramNode, DynamicViewDisplayVariant, LayoutedView, LayoutType, WhereOperator } from '@likec4/core/types';
|
|
2
2
|
import { ReactFlowProps } from '@xyflow/react';
|
|
3
3
|
import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
4
4
|
import { CamelCasedProperties, SetRequired } from 'type-fest';
|
|
@@ -235,10 +235,6 @@ export type OnEdgeClick<A extends Any = Unknown> = (edge: DiagramEdge<A>, event:
|
|
|
235
235
|
*/
|
|
236
236
|
export type OnCanvasClick = (event: ReactMouseEvent) => void;
|
|
237
237
|
export type OnCanvasContextMenu = (event: ReactMouseEvent | MouseEvent) => void;
|
|
238
|
-
export type ChangeEvent = {
|
|
239
|
-
change: ViewChange;
|
|
240
|
-
};
|
|
241
|
-
export type OnChange = (event: ChangeEvent) => void;
|
|
242
238
|
export type OnInitialized = (params: {
|
|
243
239
|
diagram: DiagramApi;
|
|
244
240
|
xyflow: XYFlowInstance;
|
|
@@ -253,7 +249,7 @@ export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
|
|
|
253
249
|
onEdgeContextMenu?: OnEdgeClick<A> | null | undefined;
|
|
254
250
|
onCanvasClick?: OnCanvasClick | null | undefined;
|
|
255
251
|
onCanvasDblClick?: OnCanvasClick | null | undefined;
|
|
256
|
-
|
|
252
|
+
onLogoClick?: null | undefined | (() => void);
|
|
257
253
|
onOpenSource?: OnOpenSource<A> | null | undefined;
|
|
258
254
|
onInitialized?: OnInitialized | null | undefined;
|
|
259
255
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Simplify } from 'type-fest';
|
|
2
|
+
import { ProjectsOverviewProps } from './projects-overview';
|
|
3
|
+
export type LikeC4ProjectsOverviewProps = Simplify<Omit<ProjectsOverviewProps, 'id'> & {
|
|
4
|
+
className?: string;
|
|
5
|
+
onSelectProject?: ProjectsOverviewProps['onNavigateToProject'];
|
|
6
|
+
}>;
|
|
7
|
+
export declare function LikeC4ProjectsOverview({ view, className, onNavigateToProject, ...props }: LikeC4ProjectsOverviewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { RootContainer } from './components/RootContainer.js';
|
|
3
|
+
import { useId } from './hooks/useId.js';
|
|
4
|
+
import { useChangeLikeC4Project } from './hooks/useLikeC4Project.js';
|
|
5
|
+
import { LikeC4Styles } from './LikeC4Styles.js';
|
|
6
|
+
import { EnsureMantine } from './context/EnsureMantine.js';
|
|
7
|
+
import { FramerMotionConfig } from './context/FramerMotionConfig.js';
|
|
8
|
+
import { ProjectsOverview } from './projects-overview/ProjectsOverview.js';
|
|
9
|
+
|
|
10
|
+
function LikeC4ProjectsOverview({
|
|
11
|
+
view,
|
|
12
|
+
className,
|
|
13
|
+
onNavigateToProject,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const onChangeLikeC4Project = useChangeLikeC4Project();
|
|
17
|
+
const id = useId();
|
|
18
|
+
onNavigateToProject ??= onChangeLikeC4Project;
|
|
19
|
+
return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsxs(FramerMotionConfig, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(LikeC4Styles, { id }),
|
|
21
|
+
/* @__PURE__ */ jsx(RootContainer, { id, className, children: /* @__PURE__ */ jsx(
|
|
22
|
+
ProjectsOverview,
|
|
23
|
+
{
|
|
24
|
+
view,
|
|
25
|
+
onNavigateToProject,
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
) })
|
|
29
|
+
] }) });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { LikeC4ProjectsOverview };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { deepEqual } from 'fast-equals';
|
|
3
|
-
import { useContext,
|
|
3
|
+
import { useContext, useEffect, useState } from 'react';
|
|
4
4
|
import { LikeC4ProjectsContext } from './context/LikeC4ProjectsContext.js';
|
|
5
5
|
import { useCallbackRef } from './hooks/useCallbackRef.js';
|
|
6
6
|
|
|
@@ -10,14 +10,16 @@ function LikeC4ProjectsProvider({
|
|
|
10
10
|
onProjectChange: _onProjectChange
|
|
11
11
|
}) {
|
|
12
12
|
const outerScope = useContext(LikeC4ProjectsContext);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (outerScope) {
|
|
15
|
+
console.warn("LikeC4ProjectsProvider should not be nested inside another one");
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
16
18
|
const onProjectChange = useCallbackRef(_onProjectChange);
|
|
17
19
|
const [value, setValue] = useState(() => ({ projects, onProjectChange }));
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
setValue((current) => {
|
|
20
|
-
return deepEqual(current.projects, projects) ? current : {
|
|
22
|
+
return deepEqual(current.projects, projects) ? current : { ...current, projects };
|
|
21
23
|
});
|
|
22
24
|
}, [projects]);
|
|
23
25
|
return /* @__PURE__ */ jsx(LikeC4ProjectsContext.Provider, { value, children });
|
package/dist/LikeC4Styles.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const LikeC4Styles: NamedExoticComponent<{
|
|
1
|
+
export declare function LikeC4Styles({ id }: {
|
|
3
2
|
id: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* @internal Memoized styles gives a performance boost during development
|
|
7
|
-
*/
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/LikeC4Styles.js
CHANGED
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useMantineStyleNonce } from '@mantine/core';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useMemo, memo } from 'react';
|
|
4
|
+
import { pipe, entries, map, join } from 'remeda';
|
|
5
|
+
import { MAX_COMPOUND_DEPTH } from './base/const.js';
|
|
6
6
|
import { useLikeC4Styles } from './hooks/useLikeC4Styles.js';
|
|
7
7
|
|
|
8
8
|
const scheme = (scheme2) => `[data-mantine-color-scheme="${scheme2}"]`;
|
|
9
9
|
const whenDark = scheme("dark");
|
|
10
|
-
const MAX_DEPTH = 5;
|
|
11
10
|
const generateCompoundColors = (rootSelector, name, colors, depth) => {
|
|
12
|
-
const
|
|
13
|
-
scale(color, {
|
|
14
|
-
l: -22 - 5 * depth,
|
|
15
|
-
s: -10 - 6 * depth
|
|
16
|
-
})
|
|
17
|
-
);
|
|
18
|
-
const compoundLightColor = (color) => toHex(
|
|
19
|
-
scale(color, {
|
|
20
|
-
l: -20 - 3 * depth,
|
|
21
|
-
s: -3 - 6 * depth
|
|
22
|
-
})
|
|
23
|
-
);
|
|
24
|
-
const selector = `:where(${rootSelector} [data-likec4-color="${name}"][data-compound-depth="${depth}"])`;
|
|
11
|
+
const selector = `${rootSelector} :is([data-likec4-color="${name}"][data-compound-depth="${depth}"])`;
|
|
25
12
|
return `
|
|
26
13
|
${selector} {
|
|
27
|
-
--likec4-palette-fill: ${
|
|
28
|
-
--likec4-palette-stroke: ${
|
|
14
|
+
--likec4-palette-fill: ${colors.fill};
|
|
15
|
+
--likec4-palette-stroke: ${colors.stroke};
|
|
29
16
|
}
|
|
30
|
-
|
|
31
|
-
--likec4-palette-fill: ${compoundDarkColor(colors.elements.fill)};
|
|
32
|
-
--likec4-palette-stroke: ${compoundDarkColor(colors.elements.stroke)};
|
|
33
|
-
}
|
|
34
|
-
`.trim();
|
|
17
|
+
`;
|
|
35
18
|
};
|
|
36
|
-
function toStyle(
|
|
19
|
+
function toStyle(styles, params) {
|
|
20
|
+
const { rootSelector, name, colors } = params;
|
|
37
21
|
const { elements, relationships } = colors;
|
|
38
|
-
const selector =
|
|
22
|
+
const selector = `${rootSelector} :is([data-likec4-color=${name}])`;
|
|
39
23
|
return [
|
|
40
24
|
`
|
|
41
25
|
${selector} {
|
|
@@ -46,38 +30,55 @@ ${selector} {
|
|
|
46
30
|
--likec4-palette-relation-stroke: ${relationships.line};
|
|
47
31
|
--likec4-palette-relation-label: ${relationships.label};
|
|
48
32
|
--likec4-palette-relation-label-bg: ${relationships.labelBg};
|
|
49
|
-
--likec4-palette-relation-stroke-selected: ${
|
|
33
|
+
--likec4-palette-relation-stroke-selected: oklch(from ${relationships.line} calc(l - 0.15) c h);
|
|
50
34
|
}
|
|
51
35
|
${whenDark} ${selector} {
|
|
52
|
-
--likec4-palette-relation-stroke-selected: ${
|
|
36
|
+
--likec4-palette-relation-stroke-selected: oklch(from ${relationships.line} calc(l + 0.15) c h);
|
|
53
37
|
}
|
|
54
38
|
|
|
55
|
-
|
|
56
|
-
...
|
|
57
|
-
|
|
39
|
+
`,
|
|
40
|
+
...styles.colorsForCompounds(elements, MAX_COMPOUND_DEPTH).map(
|
|
41
|
+
(colors2, depth) => generateCompoundColors(rootSelector, name, colors2, depth + 1)
|
|
42
|
+
)
|
|
43
|
+
].map((s) => s.trim()).join("\n");
|
|
58
44
|
}
|
|
59
|
-
function generateBuiltInColorStyles(
|
|
45
|
+
function generateBuiltInColorStyles(styles, rootSelector) {
|
|
60
46
|
return pipe(
|
|
61
|
-
theme.colors,
|
|
47
|
+
styles.theme.colors,
|
|
62
48
|
entries(),
|
|
63
|
-
map(
|
|
49
|
+
map(
|
|
50
|
+
([name, colors]) => toStyle(styles, {
|
|
51
|
+
rootSelector,
|
|
52
|
+
name,
|
|
53
|
+
colors
|
|
54
|
+
})
|
|
55
|
+
),
|
|
64
56
|
join("\n")
|
|
65
57
|
);
|
|
66
58
|
}
|
|
67
|
-
|
|
59
|
+
function LikeC4Styles({ id }) {
|
|
68
60
|
const rootSelector = `#${id}`;
|
|
69
61
|
const nonce = useMantineStyleNonce()?.();
|
|
70
|
-
const
|
|
71
|
-
const colorsStyles = generateBuiltInColorStyles(rootSelector,
|
|
62
|
+
const $styles = useLikeC4Styles();
|
|
63
|
+
const colorsStyles = useMemo(() => generateBuiltInColorStyles($styles, rootSelector), [rootSelector, $styles]);
|
|
72
64
|
return /* @__PURE__ */ jsx(
|
|
73
|
-
|
|
65
|
+
MemoizedStyle,
|
|
74
66
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
nonce
|
|
67
|
+
id,
|
|
68
|
+
nonce,
|
|
69
|
+
colorsStyles
|
|
79
70
|
}
|
|
80
71
|
);
|
|
81
|
-
}
|
|
72
|
+
}
|
|
73
|
+
const MemoizedStyle = memo(({ id, nonce, colorsStyles }) => /* @__PURE__ */ jsx(
|
|
74
|
+
"style",
|
|
75
|
+
{
|
|
76
|
+
type: "text/css",
|
|
77
|
+
"data-likec4-colors": id,
|
|
78
|
+
dangerouslySetInnerHTML: { __html: colorsStyles },
|
|
79
|
+
nonce
|
|
80
|
+
}
|
|
81
|
+
));
|
|
82
|
+
MemoizedStyle.displayName = "MemoizedStyle";
|
|
82
83
|
|
|
83
84
|
export { LikeC4Styles };
|
package/dist/LikeC4View.d.ts
CHANGED
|
@@ -6,6 +6,14 @@ export interface LikeC4ViewProps<A extends t.aux.Any = t.aux.UnknownLayouted> {
|
|
|
6
6
|
* View to display.
|
|
7
7
|
*/
|
|
8
8
|
viewId: t.aux.ViewId<A>;
|
|
9
|
+
/**
|
|
10
|
+
* Layout to display
|
|
11
|
+
* - `auto`: auto-layouted from the current sources
|
|
12
|
+
* - `manual`: manually layouted (if available, falls back to `auto`)
|
|
13
|
+
*
|
|
14
|
+
* @default 'manual'
|
|
15
|
+
*/
|
|
16
|
+
layoutType?: t.LayoutType | undefined;
|
|
9
17
|
/**
|
|
10
18
|
* Enable/disable panning
|
|
11
19
|
* @default false
|
|
@@ -260,4 +268,4 @@ export interface LikeC4BrowserProps {
|
|
|
260
268
|
*
|
|
261
269
|
* Component is wrapped in ShadowRoot to isolate styles.
|
|
262
270
|
*/
|
|
263
|
-
export declare function LikeC4View<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, className, pannable, zoomable, keepAspectRatio, colorScheme, injectFontCss, controls, background, browser, showNavigationButtons, enableNotations, enableFocusMode, enableDynamicViewWalkthrough, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, reduceGraphics, mantineTheme, styleNonce, style, reactFlowProps, renderNodes, children, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
|
|
271
|
+
export declare function LikeC4View<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, className, pannable, zoomable, keepAspectRatio, colorScheme, injectFontCss, controls, layoutType: initialLayoutType, background, browser, showNavigationButtons, enableNotations, enableFocusMode, enableDynamicViewWalkthrough, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, reduceGraphics, mantineTheme, styleNonce, style, reactFlowProps, renderNodes, children, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
|
package/dist/LikeC4View.js
CHANGED
|
@@ -14,7 +14,7 @@ import { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
|
14
14
|
import { Overlay } from './overlays/overlay/Overlay.js';
|
|
15
15
|
import { ShadowRoot } from './shadowroot/ShadowRoot.js';
|
|
16
16
|
import { pickViewBounds } from './utils/view-bounds.js';
|
|
17
|
-
import IconX from './node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.
|
|
17
|
+
import IconX from './node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js';
|
|
18
18
|
|
|
19
19
|
const cssInteractive = css({
|
|
20
20
|
cursor: "pointer",
|
|
@@ -32,6 +32,7 @@ function LikeC4View({
|
|
|
32
32
|
colorScheme,
|
|
33
33
|
injectFontCss = true,
|
|
34
34
|
controls = false,
|
|
35
|
+
layoutType: initialLayoutType = "manual",
|
|
35
36
|
background = "transparent",
|
|
36
37
|
browser = true,
|
|
37
38
|
showNavigationButtons = false,
|
|
@@ -52,11 +53,11 @@ function LikeC4View({
|
|
|
52
53
|
}) {
|
|
53
54
|
const rootRef = useRef(null);
|
|
54
55
|
const likec4model = useOptionalLikeC4Model();
|
|
55
|
-
const [layoutType, setLayoutType] = useState(
|
|
56
|
+
const [layoutType, setLayoutType] = useState(initialLayoutType);
|
|
56
57
|
const [browserViewId, _onNavigateTo] = useState(null);
|
|
57
58
|
const onNavigateTo = useCallbackRef((viewId2) => {
|
|
58
59
|
if (viewId2 && viewId2 !== browserViewId) {
|
|
59
|
-
setLayoutType(
|
|
60
|
+
setLayoutType(initialLayoutType);
|
|
60
61
|
}
|
|
61
62
|
_onNavigateTo(viewId2);
|
|
62
63
|
});
|
|
@@ -66,17 +67,18 @@ function LikeC4View({
|
|
|
66
67
|
if (!likec4model) {
|
|
67
68
|
return /* @__PURE__ */ jsx(ErrorMessage, { children: "LikeC4Model not found. Make sure you provided LikeC4ModelProvider." });
|
|
68
69
|
}
|
|
69
|
-
const
|
|
70
|
-
if (!
|
|
70
|
+
const viewModel = likec4model.findView(viewId);
|
|
71
|
+
if (!viewModel) {
|
|
71
72
|
return /* @__PURE__ */ jsx(ViewNotFound, { viewId });
|
|
72
73
|
}
|
|
73
|
-
if (
|
|
74
|
+
if (!viewModel.isLayouted()) {
|
|
74
75
|
return /* @__PURE__ */ jsxs(ErrorMessage, { children: [
|
|
75
76
|
'LikeC4 View "$',
|
|
76
77
|
viewId,
|
|
77
78
|
'" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
|
|
78
79
|
] });
|
|
79
80
|
}
|
|
81
|
+
const view = initialLayoutType === "manual" ? viewModel.$layouted : viewModel.$view;
|
|
80
82
|
const browserViewModel = browserViewId ? likec4model.findView(browserViewId) : null;
|
|
81
83
|
const browserView = layoutType === "manual" ? browserViewModel?.$layouted : browserViewModel?.$view;
|
|
82
84
|
const hasNotations = !!enableNotations && (view.notation?.nodes?.length ?? 0) > 0;
|
|
@@ -131,8 +133,8 @@ function LikeC4View({
|
|
|
131
133
|
},
|
|
132
134
|
reactFlowProps,
|
|
133
135
|
renderNodes,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
...props,
|
|
137
|
+
children
|
|
136
138
|
}
|
|
137
139
|
),
|
|
138
140
|
/* @__PURE__ */ jsx(AnimatePresence, { ...root, children: browserView && /* @__PURE__ */ jsxs(Overlay, { openDelay: 0, onClose: () => onNavigateTo(null), children: [
|
package/dist/ReactLikeC4.d.ts
CHANGED
|
@@ -3,6 +3,16 @@ import { LikeC4DiagramEventHandlers, LikeC4DiagramProperties } from './LikeC4Dia
|
|
|
3
3
|
import type * as t from '@likec4/core/types';
|
|
4
4
|
export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
|
|
5
5
|
viewId: t.aux.ViewId<A>;
|
|
6
|
+
/**
|
|
7
|
+
* Layout to display
|
|
8
|
+
* - `auto`: auto-layouted from the current sources
|
|
9
|
+
* - `manual`: manually layouted (if available, falls back to `auto`)
|
|
10
|
+
*
|
|
11
|
+
* Uncontrolled initial value, use `onLayoutTypeChange` to control it.
|
|
12
|
+
*
|
|
13
|
+
* @default 'manual'
|
|
14
|
+
*/
|
|
15
|
+
layoutType?: t.LayoutType | undefined;
|
|
6
16
|
/**
|
|
7
17
|
* Keep aspect ratio of the diagram
|
|
8
18
|
*
|
|
@@ -14,7 +24,7 @@ export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
|
|
|
14
24
|
*/
|
|
15
25
|
colorScheme?: 'light' | 'dark' | undefined;
|
|
16
26
|
/**
|
|
17
|
-
* LikeC4 views are using 'IBM Plex Sans' font.
|
|
27
|
+
* LikeC4 views are using 'IBM Plex Sans Variable' font.
|
|
18
28
|
* By default, component injects the CSS to document head.
|
|
19
29
|
* Set to false if you want to handle the font yourself.
|
|
20
30
|
*
|
|
@@ -33,4 +43,4 @@ export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
|
|
|
33
43
|
*
|
|
34
44
|
* Component is wrapped in ShadowRoot to isolate styles.
|
|
35
45
|
*/
|
|
36
|
-
export declare function ReactLikeC4<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, className, colorScheme, injectFontCss, enableNotations, keepAspectRatio, style, mantineTheme, styleNonce, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare function ReactLikeC4<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, layoutType: initialLayoutType, className, colorScheme, injectFontCss, enableNotations, keepAspectRatio, style, mantineTheme, styleNonce, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
|
package/dist/ReactLikeC4.js
CHANGED
|
@@ -8,6 +8,7 @@ import { pickViewBounds } from './utils/view-bounds.js';
|
|
|
8
8
|
|
|
9
9
|
function ReactLikeC4({
|
|
10
10
|
viewId,
|
|
11
|
+
layoutType: initialLayoutType = "manual",
|
|
11
12
|
className,
|
|
12
13
|
colorScheme,
|
|
13
14
|
injectFontCss = true,
|
|
@@ -22,17 +23,18 @@ function ReactLikeC4({
|
|
|
22
23
|
if (!likec4model) {
|
|
23
24
|
return /* @__PURE__ */ jsx(ErrorMessage, { children: "LikeC4Model not found. Make sure you provided LikeC4ModelProvider." });
|
|
24
25
|
}
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
26
|
+
const viewModel = likec4model.findView(viewId);
|
|
27
|
+
if (!viewModel) {
|
|
27
28
|
return /* @__PURE__ */ jsx(ViewNotFound, { viewId });
|
|
28
29
|
}
|
|
29
|
-
if (
|
|
30
|
+
if (!viewModel.isLayouted()) {
|
|
30
31
|
return /* @__PURE__ */ jsxs(ErrorMessage, { children: [
|
|
31
32
|
'LikeC4 View "$',
|
|
32
33
|
viewId,
|
|
33
34
|
'" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
|
|
34
35
|
] });
|
|
35
36
|
}
|
|
37
|
+
const view = initialLayoutType === "manual" ? viewModel.$layouted : viewModel.$view;
|
|
36
38
|
const bounds = pickViewBounds(view, props.dynamicViewVariant);
|
|
37
39
|
const hasNotations = !!enableNotations && (view.notation?.nodes?.length ?? 0) > 0;
|
|
38
40
|
return /* @__PURE__ */ jsx(
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren, Context } from 'react';
|
|
2
|
+
import { AdhocEditorActorRef } from './actor';
|
|
3
|
+
import { AdhocViewService } from './actor.types';
|
|
4
|
+
export declare const AdhocEditorActorContext: Context<AdhocEditorActorRef | null>;
|
|
5
|
+
export declare function AdhocEditorActorProvider({ children, service }: PropsWithChildren<{
|
|
6
|
+
service: AdhocViewService;
|
|
7
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useLogger } from '@mantine/hooks';
|
|
3
|
+
import { useActorRef } from '@xstate/react';
|
|
4
|
+
import { useRef, useEffect, createContext } from 'react';
|
|
5
|
+
import { fromPromise } from 'xstate';
|
|
6
|
+
import { adhocEditorLogic } from './actor.js';
|
|
7
|
+
|
|
8
|
+
const AdhocEditorActorContext = createContext(null);
|
|
9
|
+
const State = {
|
|
10
|
+
read: () => JSON.parse(sessionStorage.getItem("adhoc-editor-state") || "null") ?? void 0,
|
|
11
|
+
write: (state) => sessionStorage.setItem("adhoc-editor-state", JSON.stringify(state))
|
|
12
|
+
};
|
|
13
|
+
function AdhocEditorActorProvider({ children, service }) {
|
|
14
|
+
const serviceRef = useRef(service);
|
|
15
|
+
serviceRef.current = service;
|
|
16
|
+
const actorRef = useActorRef(
|
|
17
|
+
adhocEditorLogic.provide({
|
|
18
|
+
actors: {
|
|
19
|
+
service: fromPromise(({ input }) => serviceRef.current.process(input))
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
{
|
|
23
|
+
id: "adhoc-editor",
|
|
24
|
+
snapshot: State.read(),
|
|
25
|
+
systemId: "adhoc-editor",
|
|
26
|
+
inspect: (event) => {
|
|
27
|
+
console.log("[AdhocEditorActor]", event);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
useLogger("AdhocEditorActor", [actorRef]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const subscription = actorRef.subscribe((state) => {
|
|
34
|
+
State.write(state);
|
|
35
|
+
});
|
|
36
|
+
return () => subscription.unsubscribe();
|
|
37
|
+
}, [actorRef]);
|
|
38
|
+
return /* @__PURE__ */ jsx(AdhocEditorActorContext.Provider, { value: actorRef, children });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { AdhocEditorActorContext, AdhocEditorActorProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EditorNavigationPanel: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useSelector } from '@xstate/react';
|
|
3
|
+
import { prop } from 'remeda';
|
|
4
|
+
import { NavigationPanel } from '../components/NavigationPanel.js';
|
|
5
|
+
import { useAdhocEditorActor, selectFromContext } from './hooks.js';
|
|
6
|
+
import { ViewRulesPanel } from './viewrules/ViewRulesPanel.js';
|
|
7
|
+
|
|
8
|
+
const selectRules = selectFromContext(prop("rules"));
|
|
9
|
+
const EditorNavigationPanel = () => {
|
|
10
|
+
const actorRef = useAdhocEditorActor();
|
|
11
|
+
const rules = useSelector(actorRef, selectRules);
|
|
12
|
+
return /* @__PURE__ */ jsxs(NavigationPanel.Root, { children: [
|
|
13
|
+
/* @__PURE__ */ jsxs(NavigationPanel.Body, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx(NavigationPanel.Logo, {}),
|
|
15
|
+
/* @__PURE__ */ jsx(NavigationPanel.Label, { children: "View Editor" })
|
|
16
|
+
] }),
|
|
17
|
+
rules.length > 0 && /* @__PURE__ */ jsx(NavigationPanel.Dropdown, { css: { maxW: "250px" }, children: /* @__PURE__ */ jsx(
|
|
18
|
+
ViewRulesPanel,
|
|
19
|
+
{
|
|
20
|
+
rules,
|
|
21
|
+
onToggle: (rule) => {
|
|
22
|
+
actorRef.send({ type: "toggle.rule", ruleId: rule.id });
|
|
23
|
+
},
|
|
24
|
+
onDelete: (rule) => {
|
|
25
|
+
actorRef.send({ type: "delete.rule", ruleId: rule.id });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
) })
|
|
29
|
+
] });
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { EditorNavigationPanel };
|