@likec4/diagram 1.18.0 → 1.19.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/dist/LikeC4CustomColors.d.ts +7 -0
- package/dist/LikeC4CustomColors.js +30 -0
- package/dist/LikeC4Diagram.css.d.ts +5 -0
- package/dist/LikeC4Diagram.css.js +13 -0
- package/dist/LikeC4Diagram.d.ts +6 -0
- package/dist/LikeC4Diagram.js +194 -0
- package/dist/LikeC4Diagram.props.d.ts +166 -0
- package/dist/LikeC4ModelProvider.d.ts +9 -0
- package/dist/LikeC4ModelProvider.js +12 -0
- package/dist/LikeC4Search.css.d.ts +1 -0
- package/dist/LikeC4Search.css.js +5 -0
- package/dist/LikeC4Search.d.ts +2 -0
- package/dist/LikeC4Search.js +96 -0
- package/dist/StaticLikeC4Diagram.d.ts +3 -0
- package/dist/StaticLikeC4Diagram.js +41 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/controls/Text.d.ts +2 -0
- package/dist/controls/Text.js +7 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +1 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.js +5 -0
- package/dist/controls/action-button-bar/ActionButtonBar.d.ts +9 -0
- package/dist/controls/action-button-bar/ActionButtonBar.js +100 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +10 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.js +9 -0
- package/dist/controls/action-buttons/ActionButton.css.d.ts +1 -0
- package/dist/controls/action-buttons/ActionButton.css.js +5 -0
- package/dist/controls/action-buttons/ActionButton.d.ts +9 -0
- package/dist/controls/action-buttons/ActionButton.js +66 -0
- package/dist/controls/action-buttons/ActionButtons.d.ts +12 -0
- package/dist/controls/action-buttons/ActionButtons.js +99 -0
- package/dist/globals.css.d.ts +1 -0
- package/dist/globals.css.js +92 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/useDiagramState.d.ts +6 -0
- package/dist/hooks/useDiagramState.js +27 -0
- package/dist/hooks/useMantinePortalProps.d.ts +9 -0
- package/dist/hooks/useMantinePortalProps.js +9 -0
- package/dist/hooks/useSetState.d.ts +2 -0
- package/dist/hooks/useSetState.js +19 -0
- package/dist/hooks/useUpdateEffect.d.ts +4 -0
- package/dist/hooks/useUpdateEffect.js +32 -0
- package/dist/hooks/useXYFlow.d.ts +270 -0
- package/dist/hooks/useXYFlow.js +20 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +25 -0
- package/dist/likec4model/LikeC4ModelContext.d.ts +3 -0
- package/dist/likec4model/LikeC4ModelContext.js +5 -0
- package/dist/likec4model/index.d.ts +2 -0
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +12 -0
- package/dist/likec4model/useLikeC4ElementsTree.js +25 -0
- package/dist/likec4model/useLikeC4Model.d.ts +20 -0
- package/dist/likec4model/useLikeC4Model.js +55 -0
- package/dist/overlays/OverlayContext.d.ts +10 -0
- package/dist/overlays/OverlayContext.js +9 -0
- package/dist/overlays/Overlays.css.d.ts +3 -0
- package/dist/overlays/Overlays.css.js +7 -0
- package/dist/overlays/Overlays.d.ts +2 -0
- package/dist/overlays/Overlays.js +137 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +5 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +185 -0
- package/dist/overlays/edge-details/SelectEdge.css.d.ts +7 -0
- package/dist/overlays/edge-details/SelectEdge.css.js +17 -0
- package/dist/overlays/edge-details/SelectEdge.d.ts +5 -0
- package/dist/overlays/edge-details/SelectEdge.js +129 -0
- package/dist/overlays/edge-details/_types.d.ts +14 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.d.ts +21 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.js +270 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.js +76 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.js +159 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +84 -0
- package/dist/overlays/edge-details/xyflow/styles.css.d.ts +9 -0
- package/dist/overlays/edge-details/xyflow/styles.css.js +21 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.d.ts +16 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +33 -0
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +484 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.d.ts +4 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.js +11 -0
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +7 -0
- package/dist/overlays/element-details/TabPanelDeployments.js +173 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.d.ts +5 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -0
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +8 -0
- package/dist/overlays/element-details/TabPanelRelationships.js +157 -0
- package/dist/overlays/element-details/TabPanelStructure.css.d.ts +2 -0
- package/dist/overlays/element-details/TabPanelStructure.css.js +7 -0
- package/dist/overlays/element-details/TabPanelStructure.d.ts +25 -0
- package/dist/overlays/element-details/TabPanelStructure.js +91 -0
- package/dist/overlays/index.d.ts +1 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +5 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.js +193 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +19 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.js +290 -0
- package/dist/overlays/relationships-of/SelectElement.css.d.ts +2 -0
- package/dist/overlays/relationships-of/SelectElement.css.js +7 -0
- package/dist/overlays/relationships-of/SelectElement.d.ts +7 -0
- package/dist/overlays/relationships-of/SelectElement.js +126 -0
- package/dist/overlays/relationships-of/_types.d.ts +28 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +22 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.js +496 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.js +120 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.js +194 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +5 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.js +18 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +123 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +14 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.js +24 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +4 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +12 -0
- package/dist/overlays/shared/xyflow/_types.d.ts +77 -0
- package/dist/state/DiagramContext.d.ts +1609 -0
- package/dist/state/DiagramContext.js +101 -0
- package/dist/state/aligners.d.ts +42 -0
- package/dist/state/aligners.js +349 -0
- package/dist/state/diagram-to-xyflow.d.ts +11 -0
- package/dist/state/diagram-to-xyflow.js +113 -0
- package/dist/state/diagramStore.d.ts +1705 -0
- package/dist/state/diagramStore.js +808 -0
- package/dist/state/diagramStore.layout.d.ts +4 -0
- package/dist/state/diagramStore.layout.js +56 -0
- package/dist/style.css +1 -0
- package/dist/theme-vars.css.d.ts +72 -0
- package/dist/theme-vars.css.js +6 -0
- package/dist/theme-vars.css.ts.vanilla.css.js +1 -0
- package/dist/theme-vars.d.ts +3 -0
- package/dist/theme-vars.js +5 -0
- package/dist/ui/DiagramTitlePanel.css.d.ts +4 -0
- package/dist/ui/DiagramTitlePanel.css.js +11 -0
- package/dist/ui/DiagramTitlePanel.d.ts +1 -0
- package/dist/ui/DiagramTitlePanel.js +159 -0
- package/dist/ui/DynamicViewWalkthrough.css.d.ts +4 -0
- package/dist/ui/DynamicViewWalkthrough.css.js +11 -0
- package/dist/ui/DynamicViewWalkthrough.d.ts +1 -0
- package/dist/ui/DynamicViewWalkthrough.js +156 -0
- package/dist/ui/EnsureMantine.d.ts +7 -0
- package/dist/ui/EnsureMantine.js +14 -0
- package/dist/ui/FramerMotionConfig.d.ts +2 -0
- package/dist/ui/FramerMotionConfig.js +14 -0
- package/dist/ui/Link.d.ts +4 -0
- package/dist/ui/Link.js +36 -0
- package/dist/ui/notation/NotationPanel.css.d.ts +6 -0
- package/dist/ui/notation/NotationPanel.css.js +16 -0
- package/dist/ui/notation/NotationPanel.d.ts +1 -0
- package/dist/ui/notation/NotationPanel.js +250 -0
- package/dist/ui/notation/index.d.ts +1 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +2 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.js +159 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.js +137 -0
- package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
- package/dist/ui/top-left/TopLeftPanel.js +211 -0
- package/dist/ui/top-left/_shared.d.ts +7 -0
- package/dist/ui/top-left/_shared.js +22 -0
- package/dist/ui/top-left/styles.css.d.ts +8 -0
- package/dist/ui/top-left/styles.css.js +17 -0
- package/dist/utils/types.d.ts +8 -0
- package/dist/utils/vector.d.ts +24 -0
- package/dist/utils/vector.js +55 -0
- package/dist/xyflow/EdgeMarkers.d.ts +12 -0
- package/dist/xyflow/EdgeMarkers.js +192 -0
- package/dist/xyflow/FitviewOnDiagramChange.d.ts +4 -0
- package/dist/xyflow/FitviewOnDiagramChange.js +72 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +1 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.js +96 -0
- package/dist/xyflow/XYFlow.d.ts +8 -0
- package/dist/xyflow/XYFlow.js +145 -0
- package/dist/xyflow/XYFlowBackground.d.ts +10 -0
- package/dist/xyflow/XYFlowBackground.js +25 -0
- package/dist/xyflow/XYFlowInner.d.ts +8 -0
- package/dist/xyflow/XYFlowInner.js +41 -0
- package/dist/xyflow/const.d.ts +7 -0
- package/dist/xyflow/const.js +12 -0
- package/dist/xyflow/edges/EdgeLabel.d.ts +7 -0
- package/dist/xyflow/edges/EdgeLabel.js +160 -0
- package/dist/xyflow/edges/RelationshipEdge.d.ts +6 -0
- package/dist/xyflow/edges/RelationshipEdge.js +443 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.d.ts +4 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.js +11 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.d.ts +13 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.js +211 -0
- package/dist/xyflow/edges/edges.css.d.ts +17 -0
- package/dist/xyflow/edges/edges.css.js +37 -0
- package/dist/xyflow/edges/utils.d.ts +16 -0
- package/dist/xyflow/edges/utils.js +24 -0
- package/dist/xyflow/nodes/AnimateVariants.d.ts +1313 -0
- package/dist/xyflow/nodes/AnimateVariants.js +123 -0
- package/dist/xyflow/nodes/Node.css.d.ts +3 -0
- package/dist/xyflow/nodes/Node.css.js +9 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +14 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.js +27 -0
- package/dist/xyflow/nodes/compound/CompoundNode.d.ts +6 -0
- package/dist/xyflow/nodes/compound/CompoundNode.js +216 -0
- package/dist/xyflow/nodes/compound/index.d.ts +1 -0
- package/dist/xyflow/nodes/element/ElementLink.css.d.ts +3 -0
- package/dist/xyflow/nodes/element/ElementLink.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.js +190 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +17 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.js +175 -0
- package/dist/xyflow/nodes/element/element.css.d.ts +18 -0
- package/dist/xyflow/nodes/element/element.css.js +31 -0
- package/dist/xyflow/nodes/element/index.d.ts +1 -0
- package/dist/xyflow/nodes/shared/ElementIcon.d.ts +8 -0
- package/dist/xyflow/nodes/shared/ElementIcon.js +38 -0
- package/dist/xyflow/nodes/shared/Toolbar.d.ts +9 -0
- package/dist/xyflow/nodes/shared/Toolbar.js +436 -0
- package/dist/xyflow/types.d.ts +36 -0
- package/dist/xyflow/useLayoutConstraints.d.ts +42 -0
- package/dist/xyflow/useLayoutConstraints.js +226 -0
- package/dist/xyflow/useXYFlowEvents.d.ts +160 -0
- package/dist/xyflow/useXYFlowEvents.js +275 -0
- package/dist/xyflow/utils.d.ts +22 -0
- package/dist/xyflow/utils.js +72 -0
- package/package.json +34 -27
- package/src/LikeC4Diagram.tsx +4 -4
- package/src/LikeC4Search.css.ts +12 -0
- package/src/LikeC4Search.tsx +39 -90
- package/src/controls/Text.ts +5 -0
- package/src/controls/action-button-bar/ActionButtonBar.css.ts +13 -0
- package/src/controls/action-button-bar/ActionButtonBar.tsx +138 -0
- package/src/controls/action-button-bar/useActionButtonBarCtx.ts +13 -0
- package/src/controls/action-buttons/ActionButton.css.ts +29 -0
- package/src/controls/action-buttons/ActionButton.tsx +66 -0
- package/src/controls/action-buttons/ActionButtons.tsx +138 -0
- package/src/hooks/useXYFlow.ts +8 -8
- package/src/index.ts +12 -6
- package/src/likec4model/index.ts +12 -2
- package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +18 -12
- package/src/overlays/edge-details/_types.ts +13 -37
- package/src/overlays/edge-details/use-layouted-edge-details.ts +16 -14
- package/src/overlays/edge-details/xyflow/CompoundNode.tsx +3 -11
- package/src/overlays/edge-details/xyflow/ElementNode.tsx +4 -11
- package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +3 -3
- package/src/overlays/edge-details/xyflow/styles.css.ts +1 -59
- package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +23 -23
- package/src/overlays/relationships-of/_types.ts +20 -58
- package/src/overlays/relationships-of/use-layouted-relationships.ts +36 -40
- package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +9 -13
- package/src/overlays/relationships-of/xyflow/ElementNode.tsx +12 -15
- package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +4 -7
- package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +16 -14
- package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +60 -0
- package/src/overlays/shared/xyflow/_types.ts +87 -0
- package/src/state/diagram-to-xyflow.ts +6 -7
- package/src/state/diagramStore.layout.ts +3 -4
- package/src/state/diagramStore.ts +35 -37
- package/src/theme-vars.css.ts +81 -0
- package/src/theme-vars.ts +8 -81
- package/src/ui/DiagramTitlePanel.tsx +6 -6
- package/src/utils/types.ts +6 -0
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -3
- package/src/xyflow/XYFlow.tsx +2 -2
- package/src/xyflow/edges/EdgeLabel.tsx +25 -18
- package/src/xyflow/edges/RelationshipEdge.tsx +5 -3
- package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +3 -3
- package/src/xyflow/edges/edges.css.ts +68 -74
- package/src/xyflow/edges/utils.ts +6 -6
- package/src/xyflow/nodes/AnimateVariants.ts +143 -0
- package/src/xyflow/nodes/Node.css.ts +44 -0
- package/src/xyflow/nodes/compound/CompoundNode.css.ts +1 -64
- package/src/xyflow/nodes/compound/CompoundNode.tsx +69 -182
- package/src/xyflow/nodes/element/ElementLink.tsx +2 -3
- package/src/xyflow/nodes/element/ElementNode.tsx +64 -266
- package/src/xyflow/nodes/element/element.css.ts +0 -57
- package/src/xyflow/nodes/shared/Toolbar.tsx +30 -30
- package/src/xyflow/types.ts +48 -51
- package/src/xyflow/useLayoutConstraints.ts +9 -9
- package/src/xyflow/useXYFlowEvents.ts +13 -30
- package/src/xyflow/utils.ts +2 -2
- package/src/xyflow/nodes/use-animate-variants.tsx +0 -64
package/LICENSE
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomColorDefinitions } from '@likec4/core';
|
|
2
|
+
import { NamedExoticComponent } from 'react';
|
|
3
|
+
interface LikeC4CustomColorsProperties {
|
|
4
|
+
customColors: CustomColorDefinitions;
|
|
5
|
+
}
|
|
6
|
+
export declare const LikeC4CustomColors: NamedExoticComponent<LikeC4CustomColorsProperties>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import "@likec4/core";
|
|
3
|
+
import { useMantineStyleNonce } from "@mantine/core";
|
|
4
|
+
import { deepEqual } from "fast-equals";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { entries } from "remeda";
|
|
7
|
+
import { vars } from "./theme-vars.css.js";
|
|
8
|
+
function toStyle(name, colorValues) {
|
|
9
|
+
const rules = [
|
|
10
|
+
...entries(colorValues.elements).map(([key, value]) => `${stripCssVarReference(vars.element[key])}: ${value};`),
|
|
11
|
+
...entries(colorValues.relationships).map(([key, value]) => `${stripCssVarReference(vars.relation[key])}: ${value};`)
|
|
12
|
+
].join("\n");
|
|
13
|
+
return `:where([data-likec4-color=${name}]) {
|
|
14
|
+
${rules}
|
|
15
|
+
}`;
|
|
16
|
+
}
|
|
17
|
+
function stripCssVarReference(ref) {
|
|
18
|
+
const end = ref.indexOf(",");
|
|
19
|
+
return ref.substring(4, end == -1 ? ref.length - 1 : end);
|
|
20
|
+
}
|
|
21
|
+
const LikeC4CustomColors = memo(({ customColors }) => {
|
|
22
|
+
var _a;
|
|
23
|
+
const styles = entries(customColors).map(([name, color]) => toStyle(name, color)).join("\n");
|
|
24
|
+
const nonce = (_a = useMantineStyleNonce()) == null ? void 0 : _a();
|
|
25
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("style", { type: "text/css", dangerouslySetInnerHTML: { __html: styles }, nonce }) });
|
|
26
|
+
}, deepEqual);
|
|
27
|
+
LikeC4CustomColors.displayName = "LikeC4CustomColors";
|
|
28
|
+
export {
|
|
29
|
+
LikeC4CustomColors
|
|
30
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
var cssReactFlow = "_2h8g8h0";
|
|
3
|
+
var notInitialized = "_2h8g8h1";
|
|
4
|
+
var cssDisablePan = "_2h8g8h2";
|
|
5
|
+
var cssTransparentBg = "_2h8g8h3";
|
|
6
|
+
var cssNoControls = "_2h8g8h4";
|
|
7
|
+
export {
|
|
8
|
+
cssDisablePan,
|
|
9
|
+
cssNoControls,
|
|
10
|
+
cssReactFlow,
|
|
11
|
+
cssTransparentBg,
|
|
12
|
+
notInitialized
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LikeC4DiagramEventHandlers, LikeC4DiagramProperties } from './LikeC4Diagram.props';
|
|
2
|
+
export type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers;
|
|
3
|
+
export declare function LikeC4Diagram({ view, className, fitView, fitViewPadding, readonly, pannable, zoomable, nodesSelectable, nodesDraggable, background, controls, showDiagramTitle, showNotations, enableDynamicViewWalkthrough, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableSearch, initialWidth, initialHeight, keepAspectRatio, experimentalEdgeEditing, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onBurgerMenuClick, renderIcon, where, showNavigationButtons }: LikeC4DiagramProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare namespace LikeC4Diagram {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { isDeploymentView } from "@likec4/core";
|
|
3
|
+
import { ReactFlowProvider } from "@xyflow/react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { deepEqual } from "fast-equals";
|
|
6
|
+
import { useRef, useEffect, memo } from "react";
|
|
7
|
+
import { isEmpty } from "remeda";
|
|
8
|
+
import { rootClassName } from "./globals.css.js";
|
|
9
|
+
import { useDiagramState } from "./hooks/useDiagramState.js";
|
|
10
|
+
import { LikeC4CustomColors } from "./LikeC4CustomColors.js";
|
|
11
|
+
import { cssReactFlow, cssNoControls, cssDisablePan, cssTransparentBg, notInitialized } from "./LikeC4Diagram.css.js";
|
|
12
|
+
import { LikeC4Search } from "./LikeC4Search.js";
|
|
13
|
+
import { DiagramContextProvider } from "./state/DiagramContext.js";
|
|
14
|
+
import { EnsureMantine } from "./ui/EnsureMantine.js";
|
|
15
|
+
import { FramerMotionConfig } from "./ui/FramerMotionConfig.js";
|
|
16
|
+
import { FitViewOnDiagramChange } from "./xyflow/FitviewOnDiagramChange.js";
|
|
17
|
+
import { SelectEdgesOnNodeFocus } from "./xyflow/SelectEdgesOnNodeFocus.js";
|
|
18
|
+
import { XYFlow } from "./xyflow/XYFlow.js";
|
|
19
|
+
import { XYFlowInner } from "./xyflow/XYFlowInner.js";
|
|
20
|
+
import { useLikeC4Model } from "./likec4model/useLikeC4Model.js";
|
|
21
|
+
import { Overlays } from "./overlays/Overlays.js";
|
|
22
|
+
function LikeC4Diagram({
|
|
23
|
+
view,
|
|
24
|
+
className,
|
|
25
|
+
fitView = true,
|
|
26
|
+
fitViewPadding = 0,
|
|
27
|
+
readonly = true,
|
|
28
|
+
pannable = true,
|
|
29
|
+
zoomable = true,
|
|
30
|
+
nodesSelectable = !readonly,
|
|
31
|
+
nodesDraggable = !readonly,
|
|
32
|
+
background = "dots",
|
|
33
|
+
controls = !readonly,
|
|
34
|
+
showDiagramTitle = true,
|
|
35
|
+
showNotations = true,
|
|
36
|
+
enableDynamicViewWalkthrough = false,
|
|
37
|
+
enableFocusMode = false,
|
|
38
|
+
enableElementDetails = false,
|
|
39
|
+
enableRelationshipDetails = enableElementDetails,
|
|
40
|
+
enableRelationshipBrowser = enableRelationshipDetails,
|
|
41
|
+
enableSearch = true,
|
|
42
|
+
initialWidth,
|
|
43
|
+
initialHeight,
|
|
44
|
+
keepAspectRatio = false,
|
|
45
|
+
experimentalEdgeEditing = false,
|
|
46
|
+
onCanvasClick,
|
|
47
|
+
onCanvasContextMenu,
|
|
48
|
+
onCanvasDblClick,
|
|
49
|
+
onEdgeClick,
|
|
50
|
+
onChange,
|
|
51
|
+
onEdgeContextMenu,
|
|
52
|
+
onNavigateTo,
|
|
53
|
+
onNodeClick,
|
|
54
|
+
onNodeContextMenu,
|
|
55
|
+
onOpenSource,
|
|
56
|
+
onBurgerMenuClick,
|
|
57
|
+
renderIcon,
|
|
58
|
+
where,
|
|
59
|
+
showNavigationButtons = !!onNavigateTo
|
|
60
|
+
}) {
|
|
61
|
+
const hasLikec4model = !!useLikeC4Model();
|
|
62
|
+
const initialRef = useRef({
|
|
63
|
+
defaultNodes: [],
|
|
64
|
+
defaultEdges: [],
|
|
65
|
+
initialWidth: initialWidth ?? view.bounds.width,
|
|
66
|
+
initialHeight: initialHeight ?? view.bounds.height
|
|
67
|
+
});
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (readonly !== true && where != null) {
|
|
70
|
+
console.warn("Ignore filter, supported in readonly mode only\n", { where });
|
|
71
|
+
}
|
|
72
|
+
if (hasLikec4model) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (enableRelationshipDetails) {
|
|
76
|
+
console.warn("Invalid showRelationshipDetails=true, requires LikeC4ModelProvider");
|
|
77
|
+
}
|
|
78
|
+
if (enableElementDetails) {
|
|
79
|
+
console.warn("Invalid enableElementDetails=true, requires LikeC4ModelProvider");
|
|
80
|
+
}
|
|
81
|
+
if (enableRelationshipBrowser) {
|
|
82
|
+
console.warn("Invalid enableRelationshipBrowser=true, requires LikeC4ModelProvider");
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsx(FramerMotionConfig, { children: /* @__PURE__ */ jsxs(
|
|
86
|
+
ReactFlowProvider,
|
|
87
|
+
{
|
|
88
|
+
fitView,
|
|
89
|
+
...initialRef.current,
|
|
90
|
+
children: [
|
|
91
|
+
!isEmpty(view.customColorDefinitions) && /* @__PURE__ */ jsx(LikeC4CustomColors, { customColors: view.customColorDefinitions }),
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
DiagramContextProvider,
|
|
94
|
+
{
|
|
95
|
+
view,
|
|
96
|
+
keepAspectRatio,
|
|
97
|
+
className: clsx(rootClassName, className),
|
|
98
|
+
readonly,
|
|
99
|
+
experimentalEdgeEditing: !readonly && experimentalEdgeEditing,
|
|
100
|
+
pannable,
|
|
101
|
+
zoomable,
|
|
102
|
+
nodesDraggable,
|
|
103
|
+
nodesSelectable: nodesSelectable || enableFocusMode,
|
|
104
|
+
hasLikeC4Model: hasLikec4model,
|
|
105
|
+
fitViewEnabled: fitView,
|
|
106
|
+
fitViewPadding,
|
|
107
|
+
controls,
|
|
108
|
+
showNavigationButtons: showNavigationButtons && !!onNavigateTo,
|
|
109
|
+
showNotations,
|
|
110
|
+
enableFocusMode,
|
|
111
|
+
enableSearch: hasLikec4model && enableSearch,
|
|
112
|
+
enableElementDetails: enableElementDetails && hasLikec4model,
|
|
113
|
+
enableDynamicViewWalkthrough,
|
|
114
|
+
enableRelationshipBrowser: enableRelationshipBrowser && hasLikec4model,
|
|
115
|
+
enableRelationshipDetails: enableRelationshipDetails && hasLikec4model && !isDeploymentView(view),
|
|
116
|
+
whereFilter: readonly ? where ?? null : null,
|
|
117
|
+
renderIcon: renderIcon ?? null,
|
|
118
|
+
onCanvasClick: onCanvasClick ?? null,
|
|
119
|
+
onCanvasContextMenu: onCanvasContextMenu ?? null,
|
|
120
|
+
onEdgeClick: onEdgeClick ?? null,
|
|
121
|
+
onEdgeContextMenu: onEdgeContextMenu ?? null,
|
|
122
|
+
onNodeClick: onNodeClick ?? null,
|
|
123
|
+
onNodeContextMenu: onNodeContextMenu ?? null,
|
|
124
|
+
onChange: onChange ?? null,
|
|
125
|
+
onNavigateTo: onNavigateTo ?? null,
|
|
126
|
+
onCanvasDblClick: onCanvasDblClick ?? null,
|
|
127
|
+
onOpenSource: onOpenSource ?? null,
|
|
128
|
+
onBurgerMenuClick: onBurgerMenuClick ?? null,
|
|
129
|
+
children: /* @__PURE__ */ jsx(
|
|
130
|
+
LikeC4DiagramInnerMemo,
|
|
131
|
+
{
|
|
132
|
+
background,
|
|
133
|
+
showDiagramTitle,
|
|
134
|
+
enableSearch: hasLikec4model && enableSearch
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
) }) });
|
|
142
|
+
}
|
|
143
|
+
LikeC4Diagram.displayName = "LikeC4Diagram";
|
|
144
|
+
const LikeC4DiagramInnerMemo = /* @__PURE__ */ memo(function LikeC4DiagramInner({
|
|
145
|
+
background,
|
|
146
|
+
showDiagramTitle,
|
|
147
|
+
enableSearch
|
|
148
|
+
}) {
|
|
149
|
+
const {
|
|
150
|
+
isInitialized,
|
|
151
|
+
pannable,
|
|
152
|
+
fitView,
|
|
153
|
+
enableFocusMode,
|
|
154
|
+
enableOverlays
|
|
155
|
+
} = useDiagramState((s) => ({
|
|
156
|
+
isInitialized: s.initialized,
|
|
157
|
+
pannable: s.pannable,
|
|
158
|
+
fitView: s.fitViewEnabled,
|
|
159
|
+
enableFocusMode: s.enableFocusMode,
|
|
160
|
+
enableOverlays: s.hasLikeC4Model && (s.enableRelationshipBrowser || s.enableElementDetails)
|
|
161
|
+
}));
|
|
162
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
163
|
+
/* @__PURE__ */ jsx(
|
|
164
|
+
XYFlow,
|
|
165
|
+
{
|
|
166
|
+
className: clsx(
|
|
167
|
+
"likec4-diagram",
|
|
168
|
+
cssReactFlow,
|
|
169
|
+
cssNoControls,
|
|
170
|
+
pannable !== true && cssDisablePan,
|
|
171
|
+
background === "transparent" && cssTransparentBg,
|
|
172
|
+
isInitialized ? "initialized" : notInitialized
|
|
173
|
+
),
|
|
174
|
+
children: /* @__PURE__ */ jsx(
|
|
175
|
+
XYFlowInner,
|
|
176
|
+
{
|
|
177
|
+
showDiagramTitle,
|
|
178
|
+
background
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
enableOverlays && /* @__PURE__ */ jsx(Overlays, {}),
|
|
184
|
+
enableSearch && /* @__PURE__ */ jsx(LikeC4Search, {}),
|
|
185
|
+
isInitialized && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
186
|
+
fitView && /* @__PURE__ */ jsx(FitViewOnDiagramChange, {}),
|
|
187
|
+
enableFocusMode && /* @__PURE__ */ jsx(SelectEdgesOnNodeFocus, {})
|
|
188
|
+
] })
|
|
189
|
+
] });
|
|
190
|
+
}, deepEqual);
|
|
191
|
+
LikeC4DiagramInnerMemo.displayName = "LikeC4DiagramInnerMemo";
|
|
192
|
+
export {
|
|
193
|
+
LikeC4Diagram
|
|
194
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { DiagramEdge, DiagramNode, DiagramView, Fqn, RelationId, ViewChange, ViewId, WhereOperator } from '@likec4/core';
|
|
2
|
+
import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
3
|
+
import { XYBackground } from './xyflow/XYFlowBackground';
|
|
4
|
+
export type { WhereOperator };
|
|
5
|
+
export type DiagramNodeWithNavigate<ID extends string = ViewId> = Omit<DiagramNode, 'navigateTo'> & {
|
|
6
|
+
navigateTo: ID;
|
|
7
|
+
};
|
|
8
|
+
type ElementIconNodeProps = {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
icon?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type ElementIconRenderer = (props: {
|
|
14
|
+
node: ElementIconNodeProps;
|
|
15
|
+
}) => ReactNode;
|
|
16
|
+
export type OnNavigateTo<ID extends string = ViewId> = (to: ID, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<ID>) => void;
|
|
17
|
+
export type OnNodeClick = (node: DiagramNode, event: ReactMouseEvent) => void;
|
|
18
|
+
export type OnEdgeClick = (edge: DiagramEdge, event: ReactMouseEvent) => void;
|
|
19
|
+
/**
|
|
20
|
+
* On pane/canvas click (not on any node or edge)
|
|
21
|
+
*/
|
|
22
|
+
export type OnCanvasClick = (event: ReactMouseEvent) => void;
|
|
23
|
+
export type ChangeEvent = {
|
|
24
|
+
change: ViewChange;
|
|
25
|
+
};
|
|
26
|
+
export type OnChange = (event: ChangeEvent) => void;
|
|
27
|
+
export type LikeC4ColorScheme = 'light' | 'dark';
|
|
28
|
+
export interface LikeC4DiagramProperties {
|
|
29
|
+
view: DiagramView;
|
|
30
|
+
className?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Enable/disable panning
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
pannable?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Enable/disable zooming
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
zoomable?: boolean | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Disable any editing (dragging still can be enabled with `nodesDraggable`)
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
readonly?: boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Show/hide panel with top left controls,
|
|
48
|
+
*
|
|
49
|
+
* @default true if not readonly
|
|
50
|
+
*/
|
|
51
|
+
controls?: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* If set, initial viewport will show all nodes & edges
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
fitView?: boolean | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Seems like this is percentage of the view size
|
|
59
|
+
* @default 0
|
|
60
|
+
*/
|
|
61
|
+
fitViewPadding?: number | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* @default false if readonly
|
|
64
|
+
*/
|
|
65
|
+
nodesSelectable?: boolean | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* @default false if readonly
|
|
68
|
+
*/
|
|
69
|
+
nodesDraggable?: boolean | undefined;
|
|
70
|
+
initialWidth?: number | undefined;
|
|
71
|
+
initialHeight?: number | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Keep aspect ratio of the diagram
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
keepAspectRatio?: boolean | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Background pattern
|
|
79
|
+
* @default 'dots'
|
|
80
|
+
*/
|
|
81
|
+
background?: 'transparent' | 'solid' | XYBackground | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Display webview with diagram title / description
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
showDiagramTitle?: boolean | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Show back/forward history navigation buttons
|
|
89
|
+
* @default true if `onNavigateTo` is set
|
|
90
|
+
*/
|
|
91
|
+
showNavigationButtons?: undefined | boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Display notations of the view
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
showNotations?: boolean | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Display dropdown with details on relationship's label click
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
enableRelationshipDetails?: boolean | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
enableFocusMode?: boolean | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Enable search popup for elements and views
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
enableSearch?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Enable modal with element details
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
enableElementDetails?: boolean | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Experimental feature to browse relationships
|
|
119
|
+
*
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
enableRelationshipBrowser?: boolean | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* If Walkthrough for dynamic views should be enabled
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
enableDynamicViewWalkthrough?: boolean | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Experimental feature to enable edge editing
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
132
|
+
experimentalEdgeEditing?: boolean | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Render icon for an element, bundled or remote
|
|
135
|
+
* By default, if icon is http:// or https://, it will be rendered as an image
|
|
136
|
+
*/
|
|
137
|
+
renderIcon?: ElementIconRenderer | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Dynamic filter, applies both to nodes and edges
|
|
140
|
+
*/
|
|
141
|
+
where?: WhereOperator<string, string> | undefined;
|
|
142
|
+
}
|
|
143
|
+
export type OpenSourceParams = {
|
|
144
|
+
element: Fqn;
|
|
145
|
+
property?: string;
|
|
146
|
+
} | {
|
|
147
|
+
relation: RelationId;
|
|
148
|
+
} | {
|
|
149
|
+
deployment: Fqn;
|
|
150
|
+
property?: string;
|
|
151
|
+
} | {
|
|
152
|
+
view: ViewId;
|
|
153
|
+
};
|
|
154
|
+
export interface LikeC4DiagramEventHandlers {
|
|
155
|
+
onChange?: OnChange | null | undefined;
|
|
156
|
+
onNavigateTo?: OnNavigateTo | null | undefined;
|
|
157
|
+
onNodeClick?: OnNodeClick | null | undefined;
|
|
158
|
+
onNodeContextMenu?: OnNodeClick | null | undefined;
|
|
159
|
+
onCanvasContextMenu?: OnCanvasClick | null | undefined;
|
|
160
|
+
onEdgeClick?: OnEdgeClick | null | undefined;
|
|
161
|
+
onEdgeContextMenu?: OnEdgeClick | null | undefined;
|
|
162
|
+
onCanvasClick?: OnCanvasClick | null | undefined;
|
|
163
|
+
onCanvasDblClick?: OnCanvasClick | null | undefined;
|
|
164
|
+
onBurgerMenuClick?: null | undefined | (() => void);
|
|
165
|
+
onOpenSource?: null | undefined | ((params: OpenSourceParams) => void);
|
|
166
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LikeC4Model } from '@likec4/core';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export type LikeC4ModelProviderProps = PropsWithChildren<{
|
|
4
|
+
likec4model: LikeC4Model;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* Ensures LikeC4Model context
|
|
8
|
+
*/
|
|
9
|
+
export declare function LikeC4ModelProvider({ children, likec4model }: LikeC4ModelProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { LikeC4ModelContext } from "./likec4model/LikeC4ModelContext.js";
|
|
4
|
+
function LikeC4ModelProvider({
|
|
5
|
+
children,
|
|
6
|
+
likec4model
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsx(LikeC4ModelContext.Provider, { value: likec4model, children });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
LikeC4ModelProvider
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const actionSection: string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { rem } from "@mantine/core";
|
|
3
|
+
import { Spotlight } from "@mantine/spotlight";
|
|
4
|
+
import { IconSearch, IconRectangularPrism, IconStack2, IconSitemap } from "@tabler/icons-react";
|
|
5
|
+
import { memo, useMemo } from "react";
|
|
6
|
+
import { pipe, filter, map } from "remeda";
|
|
7
|
+
import { actionSection } from "./LikeC4Search.css.js";
|
|
8
|
+
import { useDiagramState, useDiagramStoreApi } from "./hooks/useDiagramState.js";
|
|
9
|
+
import { useLikeC4Model } from "./likec4model/useLikeC4Model.js";
|
|
10
|
+
import { useMantinePortalProps } from "./hooks/useMantinePortalProps.js";
|
|
11
|
+
const LikeC4Search = memo(() => {
|
|
12
|
+
const view = useDiagramState((s) => s.view);
|
|
13
|
+
const model = useLikeC4Model(true);
|
|
14
|
+
const store = useDiagramStoreApi();
|
|
15
|
+
const getNodeActionsData = () => {
|
|
16
|
+
const { focusOnNode } = store.getState();
|
|
17
|
+
return pipe(
|
|
18
|
+
view.nodes,
|
|
19
|
+
filter((n) => !!n.title),
|
|
20
|
+
map((n) => ({
|
|
21
|
+
id: n.id,
|
|
22
|
+
label: n.title,
|
|
23
|
+
...n.description && {
|
|
24
|
+
description: n.description
|
|
25
|
+
},
|
|
26
|
+
keywords: [
|
|
27
|
+
n.title,
|
|
28
|
+
...(n.tags ?? []).map((t) => `#${t}`),
|
|
29
|
+
...n.description ? [n.description] : []
|
|
30
|
+
].filter((k) => k.toLowerCase()),
|
|
31
|
+
onClick: () => focusOnNode(n.id),
|
|
32
|
+
leftSection: /* @__PURE__ */ jsx(IconRectangularPrism, {})
|
|
33
|
+
}))
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
const getViewActionsData = () => {
|
|
37
|
+
const views = [...model.views()];
|
|
38
|
+
return map(views, (v) => ({
|
|
39
|
+
id: v.id,
|
|
40
|
+
label: v.title ?? v.id,
|
|
41
|
+
...v.$view.description && {
|
|
42
|
+
description: v.$view.description
|
|
43
|
+
},
|
|
44
|
+
keywords: [
|
|
45
|
+
v.title ?? v.id,
|
|
46
|
+
...v.tags ?? [],
|
|
47
|
+
...v.$view.description ? [v.$view.description] : []
|
|
48
|
+
],
|
|
49
|
+
onClick: () => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
store.setState({
|
|
52
|
+
lastOnNavigate: {
|
|
53
|
+
fromView: view.id,
|
|
54
|
+
toView: v.id,
|
|
55
|
+
fromNode: null
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
(_b = (_a = store.getState()).onNavigateTo) == null ? void 0 : _b.call(_a, v.id);
|
|
59
|
+
},
|
|
60
|
+
leftSection: v.isDeploymentView() ? /* @__PURE__ */ jsx(IconStack2, {}) : /* @__PURE__ */ jsx(IconSitemap, {})
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
const actions = useMemo(() => [
|
|
64
|
+
{
|
|
65
|
+
group: "Elements",
|
|
66
|
+
actions: getNodeActionsData()
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
group: "Views",
|
|
70
|
+
actions: getViewActionsData()
|
|
71
|
+
}
|
|
72
|
+
], [model, store, view]);
|
|
73
|
+
const portalProps = useMantinePortalProps();
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
Spotlight,
|
|
76
|
+
{
|
|
77
|
+
...portalProps,
|
|
78
|
+
actions,
|
|
79
|
+
nothingFound: "Nothing found...",
|
|
80
|
+
shortcut: ["mod + f", "mod + k"],
|
|
81
|
+
scrollable: true,
|
|
82
|
+
highlightQuery: true,
|
|
83
|
+
maxHeight: 350,
|
|
84
|
+
classNames: {
|
|
85
|
+
actionSection
|
|
86
|
+
},
|
|
87
|
+
searchProps: {
|
|
88
|
+
leftSection: /* @__PURE__ */ jsx(IconSearch, { style: { width: rem(18), height: rem(18) }, stroke: 1.5 }),
|
|
89
|
+
placeholder: "Search elements and views..."
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
export {
|
|
95
|
+
LikeC4Search
|
|
96
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LikeC4DiagramProperties } from './LikeC4Diagram.props';
|
|
2
|
+
export type StaticLikeC4DiagramProps = Pick<LikeC4DiagramProperties, 'view' | 'keepAspectRatio' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'enableElementDetails' | 'enableRelationshipDetails' | 'enableRelationshipBrowser' | 'initialWidth' | 'initialHeight' | 'renderIcon' | 'where'>;
|
|
3
|
+
export declare function StaticLikeC4Diagram({ view, fitView, fitViewPadding, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, background, ...rest }: StaticLikeC4DiagramProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LikeC4Diagram } from "./LikeC4Diagram.js";
|
|
3
|
+
function StaticLikeC4Diagram({
|
|
4
|
+
view,
|
|
5
|
+
fitView = true,
|
|
6
|
+
fitViewPadding = 0,
|
|
7
|
+
enableElementDetails = false,
|
|
8
|
+
enableRelationshipDetails = false,
|
|
9
|
+
enableRelationshipBrowser = enableRelationshipDetails,
|
|
10
|
+
background = "transparent",
|
|
11
|
+
...rest
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
LikeC4Diagram,
|
|
15
|
+
{
|
|
16
|
+
view,
|
|
17
|
+
readonly: true,
|
|
18
|
+
fitView,
|
|
19
|
+
fitViewPadding,
|
|
20
|
+
pannable: false,
|
|
21
|
+
zoomable: false,
|
|
22
|
+
controls: false,
|
|
23
|
+
background,
|
|
24
|
+
showDiagramTitle: false,
|
|
25
|
+
showNotations: false,
|
|
26
|
+
enableElementDetails,
|
|
27
|
+
enableRelationshipDetails,
|
|
28
|
+
enableRelationshipBrowser,
|
|
29
|
+
enableDynamicViewWalkthrough: false,
|
|
30
|
+
experimentalEdgeEditing: false,
|
|
31
|
+
enableFocusMode: false,
|
|
32
|
+
nodesSelectable: false,
|
|
33
|
+
nodesDraggable: false,
|
|
34
|
+
enableSearch: false,
|
|
35
|
+
...rest
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
StaticLikeC4Diagram
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const container: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type ShiftX = 'left' | 'spread' | 'right';
|
|
3
|
+
type ShiftY = 'top' | 'spread' | 'bottom';
|
|
4
|
+
type ActionButtonBarProps = PropsWithChildren<{
|
|
5
|
+
shiftX?: ShiftX;
|
|
6
|
+
shiftY?: ShiftY;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const ActionButtonBar: ({ shiftX, shiftY, children, }: ActionButtonBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|