@likec4/diagram 1.31.0 → 1.32.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/bundle/{chunk-BBzMXzCg.js → chunk-BvTQaUYl.js} +1675 -1207
- package/bundle/custom.js +50 -47
- package/bundle/index.js +2482 -2438
- package/dist/LikeC4CustomColors.d.ts +2 -7
- package/dist/LikeC4CustomColors.js +17 -6
- package/dist/LikeC4Diagram.d.ts +3 -2
- package/dist/LikeC4Diagram.js +10 -14
- package/dist/LikeC4Diagram.props.d.ts +28 -22
- package/dist/LikeC4ModelProvider.d.ts +5 -4
- package/dist/StaticLikeC4Diagram.d.ts +3 -2
- package/dist/StaticLikeC4Diagram.js +2 -2
- package/dist/base/BaseXYFlow.js +5 -5
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/index.d.ts +2 -1
- package/dist/base/primitives/compound/CompoundActionButton.js +2 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -1
- package/dist/base/primitives/compound/CompoundTitle.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundTitle.js +2 -1
- package/dist/base/primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +1 -0
- package/dist/base/primitives/edge/EdgeLabel.d.ts +3 -3
- package/dist/base/primitives/edge/EdgeLabel.js +6 -4
- package/dist/base/primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeMarkers.d.ts +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
- package/dist/base/primitives/element/ElementActionButtons.js +10 -9
- package/dist/base/primitives/element/ElementDetailsButton.js +2 -1
- package/dist/base/primitives/element/ElementShape.d.ts +1 -1
- package/dist/base/primitives/element/ElementTags.d.ts +14 -0
- package/dist/base/primitives/element/ElementTags.js +176 -0
- package/dist/base/primitives/element/ElementTitle.d.ts +5 -4
- package/dist/base/primitives/element/ElementTitle.js +6 -6
- package/dist/base/primitives/index.d.ts +1 -0
- package/dist/base/types.Base.d.ts +54 -0
- package/dist/base/types.Base.js +48 -0
- package/dist/base/types.d.ts +2 -52
- package/dist/bundle/LikeC4View.d.ts +2 -1
- package/dist/bundle/LikeC4View.js +8 -6
- package/dist/bundle/LikeC4View.props.d.ts +15 -4
- package/dist/bundle/ReactLikeC4.d.ts +4 -7
- package/dist/bundle/ReactLikeC4.js +3 -2
- package/dist/bundle/index.js +1 -1
- package/dist/components/ErrorFallback.d.ts +2 -0
- package/dist/components/ErrorFallback.js +29 -0
- package/dist/context/DiagramEventHandlers.d.ts +6 -5
- package/dist/context/DiagramFeatures.d.ts +2 -2
- package/dist/context/DiagramFeatures.js +3 -31
- package/dist/context/EnsureMantine.js +1 -1
- package/dist/context/IconRenderer.js +1 -4
- package/dist/context/RootContainer.js +5 -1
- package/dist/context/TagStylesContext.d.ts +7 -0
- package/dist/context/TagStylesContext.js +85 -0
- package/dist/custom/components.d.ts +1 -1
- package/dist/custom/customNodes.d.ts +27 -17
- package/dist/custom/hooks.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useDiagram.d.ts +73 -38
- package/dist/hooks/useDiagram.js +7 -3
- package/dist/hooks/useMantinePortalProps.d.ts +2 -2
- package/dist/hooks/useSearchActor.d.ts +2 -0
- package/dist/hooks/useSearchActor.js +10 -0
- package/dist/hooks/useUpdateEffect.js +3 -0
- package/dist/hooks/useXYFlow.d.ts +39 -37
- package/dist/hooks/useXYFlow.js +5 -1
- package/dist/index.js +1 -1
- package/dist/likec4diagram/DiagramUI.js +7 -2
- package/dist/likec4diagram/DiagramXYFlow.d.ts +4 -3
- package/dist/likec4diagram/DiagramXYFlow.js +104 -107
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +7 -6
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +8 -0
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +7 -5
- package/dist/likec4diagram/custom/index.d.ts +7 -6
- package/dist/likec4diagram/custom/nodes/nodes.js +39 -26
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +3 -3
- package/dist/likec4diagram/types.d.ts +5 -5
- package/dist/likec4diagram/ui/controls/Controls.js +12 -4
- package/dist/likec4diagram/ui/notation/NotationPanel.js +1 -1
- package/dist/likec4diagram/useViewToNodesEdges.d.ts +5 -3
- package/dist/likec4diagram/useViewToNodesEdges.js +20 -30
- package/dist/likec4model/LikeC4ModelContext.d.ts +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
- package/dist/likec4model/useLikeC4Model.d.ts +22 -10
- package/dist/likec4model/useLikeC4Model.js +11 -7
- package/dist/overlays/Overlays.js +4 -27
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.js +19 -12
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelDeployments.js +1 -1
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelStructure.d.ts +1 -1
- package/dist/overlays/element-details/actor.d.ts +288 -286
- package/dist/overlays/overlay/Overlay.css.d.ts +57 -2
- package/dist/overlays/overlay/Overlay.css.js +76 -39
- package/dist/overlays/overlay/Overlay.d.ts +12 -0
- package/dist/overlays/overlay/Overlay.js +36 -25
- package/dist/overlays/overlaysActor.d.ts +1 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +3 -2
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
- package/dist/overlays/relationship-details/_types.d.ts +2 -2
- package/dist/overlays/relationship-details/actor.js +7 -7
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +3 -2
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -0
- package/dist/overlays/relationship-details/hooks.d.ts +10 -9
- package/dist/overlays/relationship-details/layout-to-xyflow.js +1 -0
- package/dist/overlays/relationship-details/layout.js +3 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +3 -2
- package/dist/overlays/relationships-browser/SelectElement.js +1 -1
- package/dist/overlays/relationships-browser/_types.d.ts +2 -2
- package/dist/overlays/relationships-browser/actor.d.ts +1 -1
- package/dist/overlays/relationships-browser/actor.js +7 -7
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +3 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +8 -5
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -0
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +10 -6
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +4 -3
- package/dist/search/Search.d.ts +5 -0
- package/dist/search/Search.js +192 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.js +0 -1
- package/dist/search/components/ElementsColumn.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.js +21 -19
- package/dist/search/components/PickView.d.ts +4 -0
- package/dist/search/components/PickView.js +135 -0
- package/dist/search/components/SearchByTags.d.ts +1 -0
- package/dist/search/components/SearchByTags.js +116 -0
- package/dist/search/components/SearchInput.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/SearchInput.js +53 -34
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.d.ts +3 -2
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.js +14 -13
- package/dist/{likec4diagram/ui/search → search/components}/_shared.css.js +26 -35
- package/dist/{likec4diagram/ui/search/LikeC4Search.css.d.ts → search/components/styles.css.d.ts} +0 -2
- package/dist/search/components/styles.css.js +60 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.d.ts +1 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.js +7 -1
- package/dist/search/hooks.d.ts +16 -0
- package/dist/search/hooks.js +35 -0
- package/dist/search/searchActor.d.ts +90 -0
- package/dist/search/searchActor.js +75 -0
- package/dist/state/DiagramActorProvider.d.ts +9 -7
- package/dist/state/DiagramActorProvider.js +24 -18
- package/dist/state/assign.d.ts +0 -1
- package/dist/state/assign.js +9 -19
- package/dist/state/diagram-machine.d.ts +430 -176
- package/dist/state/diagram-machine.js +119 -54
- package/dist/state/syncManualLayoutActor.d.ts +2 -2
- package/dist/state/types.d.ts +2 -0
- package/dist/state/utils.d.ts +2 -0
- package/dist/state/utils.js +3 -0
- package/dist/styles-min.css +1 -1
- package/dist/styles-xyflow.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css2.js +1 -1
- package/package.json +18 -18
- package/panda.buildinfo.json +171 -148
- package/src/LikeC4CustomColors.tsx +21 -6
- package/src/LikeC4Diagram.props.ts +35 -30
- package/src/LikeC4Diagram.tsx +19 -20
- package/src/LikeC4ModelProvider.tsx +6 -5
- package/src/StaticLikeC4Diagram.tsx +8 -6
- package/src/base/const.ts +1 -1
- package/src/base/index.ts +2 -1
- package/src/base/primitives/compound/CompoundActionButton.tsx +2 -1
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -1
- package/src/base/primitives/compound/CompoundTitle.tsx +3 -2
- package/src/base/primitives/edge/EdgeContainer.tsx +2 -1
- package/src/base/primitives/edge/EdgeLabel.css.ts +1 -0
- package/src/base/primitives/edge/EdgeLabel.tsx +20 -15
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeMarkers.tsx +2 -1
- package/src/base/primitives/edge/EdgePath.tsx +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +11 -10
- package/src/base/primitives/element/ElementDetailsButton.tsx +2 -1
- package/src/base/primitives/element/ElementShape.tsx +2 -1
- package/src/base/primitives/element/ElementTags.tsx +182 -0
- package/src/base/primitives/element/ElementTitle.tsx +21 -15
- package/src/base/primitives/index.ts +1 -0
- package/src/base/types.Base.ts +104 -0
- package/src/base/types.ts +2 -99
- package/src/bundle/LikeC4View.props.ts +17 -4
- package/src/bundle/LikeC4View.tsx +17 -19
- package/src/bundle/ReactLikeC4.tsx +14 -26
- package/src/components/ErrorFallback.tsx +30 -0
- package/src/context/DiagramEventHandlers.tsx +5 -4
- package/src/context/DiagramFeatures.tsx +3 -22
- package/src/context/EnsureMantine.tsx +1 -1
- package/src/context/IconRenderer.tsx +1 -4
- package/src/context/RootContainer.tsx +9 -3
- package/src/context/TagStylesContext.tsx +96 -0
- package/src/custom/components.ts +2 -0
- package/src/custom/customNodes.tsx +24 -14
- package/src/custom/hooks.ts +1 -0
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useCurrentViewId.ts +1 -4
- package/src/hooks/useDiagram.ts +104 -12
- package/src/hooks/useMantinePortalProps.ts +10 -1
- package/src/hooks/useSearchActor.ts +11 -0
- package/src/hooks/useUpdateEffect.ts +7 -4
- package/src/hooks/useXYFlow.ts +5 -0
- package/src/likec4diagram/DiagramUI.tsx +5 -0
- package/src/likec4diagram/DiagramXYFlow.tsx +115 -118
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +9 -0
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +10 -9
- package/src/likec4diagram/custom/nodes/nodes.tsx +45 -43
- package/src/likec4diagram/custom/nodes/toolbar/_shared.tsx +11 -3
- package/src/likec4diagram/types.ts +5 -3
- package/src/likec4diagram/ui/controls/Controls.tsx +11 -4
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -2
- package/src/likec4diagram/useViewToNodesEdges.ts +34 -36
- package/src/likec4model/LikeC4ModelContext.ts +2 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +1 -1
- package/src/likec4model/useLikeC4Model.ts +18 -16
- package/src/overlays/Overlays.tsx +5 -32
- package/src/overlays/element-details/ElementDetailsCard.tsx +25 -18
- package/src/overlays/element-details/TabPanelDeployments.tsx +3 -2
- package/src/overlays/element-details/TabPanelRelationships.tsx +2 -1
- package/src/overlays/element-details/TabPanelStructure.tsx +1 -1
- package/src/overlays/element-details/actor.ts +2 -2
- package/src/overlays/overlay/Overlay.css.ts +75 -38
- package/src/overlays/overlay/Overlay.tsx +43 -26
- package/src/overlays/overlaysActor.ts +1 -1
- package/src/overlays/relationship-details/RelationshipDetails.tsx +4 -4
- package/src/overlays/relationship-details/_types.ts +2 -1
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +4 -0
- package/src/overlays/relationship-details/layout-to-xyflow.ts +1 -0
- package/src/overlays/relationship-details/layout.ts +3 -1
- package/src/overlays/relationships-browser/SelectElement.tsx +1 -1
- package/src/overlays/relationships-browser/_types.ts +2 -1
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +4 -0
- package/src/overlays/relationships-browser/layout.ts +12 -7
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +4 -4
- package/src/search/Search.tsx +237 -0
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.css.ts +0 -29
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.tsx +24 -22
- package/src/search/components/PickView.tsx +140 -0
- package/src/search/components/SearchByTags.tsx +109 -0
- package/src/{likec4diagram/ui/search → search/components}/SearchInput.tsx +63 -36
- package/src/{likec4diagram/ui/search → search/components}/ViewsColum.tsx +17 -18
- package/src/{likec4diagram/ui/search → search/components}/_shared.css.ts +26 -37
- package/src/{likec4diagram/ui/search/LikeC4Search.css.ts → search/components/styles.css.ts} +9 -36
- package/src/{likec4diagram/ui/search → search/components}/utils.ts +7 -0
- package/src/search/hooks.ts +41 -0
- package/src/search/searchActor.ts +99 -0
- package/src/state/DiagramActorProvider.tsx +36 -25
- package/src/state/assign.ts +10 -10
- package/src/state/diagram-machine.ts +115 -52
- package/src/state/syncManualLayoutActor.ts +1 -1
- package/src/state/types.ts +2 -0
- package/src/state/utils.ts +4 -0
- package/dist/base/types.js +0 -54
- package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +0 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +0 -87
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +0 -2
- package/dist/likec4diagram/ui/search/LikeC4Search.js +0 -267
- package/dist/likec4diagram/ui/search/SearchInput.d.ts +0 -1
- package/dist/likec4diagram/ui/search/state.d.ts +0 -19
- package/dist/likec4diagram/ui/search/state.js +0 -63
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +0 -301
- package/src/likec4diagram/ui/search/state.ts +0 -78
- /package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.js +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/_shared.css.d.ts +0 -0
- /package/src/{likec4diagram/ui/search → search/components}/ViewsColumn.css.ts +0 -0
|
@@ -2,7 +2,8 @@ import { Types } from '../types';
|
|
|
2
2
|
import { MemoExoticComponent, FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
3
3
|
import { NodeProps } from '../../base';
|
|
4
4
|
import { Position, XYPosition } from '@xyflow/system';
|
|
5
|
-
import {
|
|
5
|
+
import { EdgeData, Dimmed } from '../../base/types.Base';
|
|
6
|
+
import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId } from '@likec4/core';
|
|
6
7
|
export declare const BuiltinNodes: {
|
|
7
8
|
element: MemoExoticComponent<(props: NodeProps<Types.ElementNodeData, "element">) => import("react/jsx-runtime").JSX.Element>;
|
|
8
9
|
deployment: MemoExoticComponent<(props: NodeProps<Types.DeploymentElementNodeData, "deployment">) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -38,21 +39,21 @@ export declare const edgeTypes: {
|
|
|
38
39
|
markerEnd?: string;
|
|
39
40
|
pathOptions?: any;
|
|
40
41
|
interactionWidth?: number;
|
|
41
|
-
data:
|
|
42
|
+
data: EdgeData & {
|
|
42
43
|
hovered?: boolean;
|
|
43
44
|
active?: boolean;
|
|
44
|
-
dimmed?:
|
|
45
|
+
dimmed?: Dimmed;
|
|
45
46
|
id: EdgeId;
|
|
46
47
|
label: string | null;
|
|
47
48
|
points: NonEmptyArray<Point>;
|
|
48
49
|
color: Color | undefined;
|
|
50
|
+
head: RelationshipArrowType | undefined;
|
|
49
51
|
line: RelationshipLineType | undefined;
|
|
50
52
|
dir: "forward" | "back" | "both" | undefined;
|
|
51
|
-
tail: RelationshipArrowType | undefined;
|
|
52
|
-
head: RelationshipArrowType | undefined;
|
|
53
53
|
technology: string | undefined;
|
|
54
|
+
tail: RelationshipArrowType | undefined;
|
|
54
55
|
labelBBox: BBox | null | undefined;
|
|
55
|
-
navigateTo: ViewId<string> | undefined;
|
|
56
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
56
57
|
notes: string | undefined;
|
|
57
58
|
labelXY: XYPosition | null;
|
|
58
59
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
3
3
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
4
4
|
import { CompoundActions } from './CompoundActions.js';
|
|
5
5
|
import { DeploymentElementActions, ElementActions } from './ElementActions.js';
|
|
@@ -12,6 +12,7 @@ import { DefaultHandles } from '../../../base/primitives/NodeHandles.js';
|
|
|
12
12
|
import { ElementNodeContainer } from '../../../base/primitives/element/ElementNodeContainer.js';
|
|
13
13
|
import { ElementShape } from '../../../base/primitives/element/ElementShape.js';
|
|
14
14
|
import { ElementTitle } from '../../../base/primitives/element/ElementTitle.js';
|
|
15
|
+
import { ElementTags } from '../../../base/primitives/element/ElementTags.js';
|
|
15
16
|
import { CompoundDetailsButton } from '../../../base/primitives/compound/CompoundDetailsButton.js';
|
|
16
17
|
import { ElementDetailsButton } from '../../../base/primitives/element/ElementDetailsButton.js';
|
|
17
18
|
|
|
@@ -47,41 +48,53 @@ function CompoundDetailsButtonWithHandler(props) {
|
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
|
-
const ElementNode = customNode((props) =>
|
|
51
|
-
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
const ElementNode = customNode((props) => {
|
|
52
|
+
const { enableElementTags, enableReadOnly } = useEnabledFeatures();
|
|
53
|
+
return /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
54
|
+
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
55
|
+
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
56
|
+
enableElementTags && /* @__PURE__ */ jsx(ElementTags, { ...props }),
|
|
57
|
+
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
58
|
+
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
59
|
+
!enableReadOnly && /* @__PURE__ */ jsx(ElementToolbar, { ...props }),
|
|
60
|
+
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
61
|
+
] });
|
|
62
|
+
});
|
|
58
63
|
ElementNode.displayName = "ElementNode";
|
|
59
|
-
const DeploymentNode = customNode((props) =>
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
const DeploymentNode = customNode((props) => {
|
|
65
|
+
const { enableElementTags, enableReadOnly } = useEnabledFeatures();
|
|
66
|
+
return /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
68
|
+
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
69
|
+
enableElementTags && /* @__PURE__ */ jsx(ElementTags, { ...props }),
|
|
70
|
+
/* @__PURE__ */ jsx(DeploymentElementActions, { ...props }),
|
|
71
|
+
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
72
|
+
!enableReadOnly && /* @__PURE__ */ jsx(DeploymentElementToolbar, { ...props }),
|
|
73
|
+
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
74
|
+
] });
|
|
75
|
+
});
|
|
67
76
|
DeploymentNode.displayName = "DeploymentNode";
|
|
68
77
|
const CompoundElementNode = customNode((props) => {
|
|
69
|
-
|
|
78
|
+
const { enableElementDetails, enableReadOnly } = useEnabledFeatures();
|
|
70
79
|
return /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
|
|
71
80
|
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
72
81
|
/* @__PURE__ */ jsx(CompoundActions, { ...props }),
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
enableElementDetails && /* @__PURE__ */ jsx(CompoundDetailsButtonWithHandler, { ...props }),
|
|
83
|
+
!enableReadOnly && /* @__PURE__ */ jsx(CompoundElementToolbar, { ...props }),
|
|
75
84
|
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
76
85
|
] });
|
|
77
86
|
});
|
|
78
87
|
CompoundElementNode.displayName = "CompoundElementNode";
|
|
79
|
-
const CompoundDeploymentNode = customNode((props) =>
|
|
80
|
-
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
const CompoundDeploymentNode = customNode((props) => {
|
|
89
|
+
const { enableElementDetails, enableReadOnly } = useEnabledFeatures();
|
|
90
|
+
return /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
|
|
91
|
+
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
92
|
+
/* @__PURE__ */ jsx(CompoundActions, { ...props }),
|
|
93
|
+
enableElementDetails && /* @__PURE__ */ jsx(CompoundDetailsButtonWithHandler, { ...props }),
|
|
94
|
+
!enableReadOnly && /* @__PURE__ */ jsx(CompoundDeploymentToolbar, { ...props }),
|
|
95
|
+
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
96
|
+
] });
|
|
97
|
+
});
|
|
85
98
|
CompoundDeploymentNode.displayName = "CompoundDeploymentNode";
|
|
86
99
|
const ViewGroupNode = customNode((props) => /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
|
|
87
100
|
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fqn, ThemeColor, ViewChange } from '@likec4/core';
|
|
1
|
+
import { DeploymentFqn, Fqn, ThemeColor, ViewChange } from '@likec4/core';
|
|
2
2
|
import { MergeExclusive } from 'type-fest';
|
|
3
3
|
import { NodeProps } from '../../../../base';
|
|
4
4
|
import { Types } from '../../../types';
|
|
@@ -25,7 +25,7 @@ export declare const Tooltip: ForwardRefExoticComponent< TooltipProps & RefAttri
|
|
|
25
25
|
component?: any;
|
|
26
26
|
renderRoot?: (props: Record<string, any>) => React.ReactNode;
|
|
27
27
|
}>;
|
|
28
|
-
export declare function useHandlers(target: Fqn, props: NodeProps<Types.NodeData>): {
|
|
28
|
+
export declare function useHandlers(target: Fqn | DeploymentFqn, props: NodeProps<Types.NodeData>): {
|
|
29
29
|
elementColor: "blue" | "gray" | "green" | "indigo" | "red" | "amber" | "slate" | "muted" | "primary" | "secondary" | "sky";
|
|
30
30
|
onColorPreview: (color: ThemeColor | null) => void;
|
|
31
31
|
onChange: OnStyleChange;
|
|
@@ -36,5 +36,5 @@ export declare function BrowseRelationshipsButton({ fqn }: {
|
|
|
36
36
|
export declare function GoToSourceButton(props: MergeExclusive<{
|
|
37
37
|
elementId: Fqn;
|
|
38
38
|
}, {
|
|
39
|
-
deploymentId:
|
|
39
|
+
deploymentId: DeploymentFqn;
|
|
40
40
|
}>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiagramEdge, DiagramNode, Fqn, IconUrl, ViewId } from '@likec4/core';
|
|
1
|
+
import { DeploymentFqn, DiagramEdge, DiagramNode, Fqn, IconUrl, ViewId } from '@likec4/core/types';
|
|
2
2
|
import { XYPosition } from '@xyflow/system';
|
|
3
3
|
import { OptionalKeysOf, Simplify } from 'type-fest';
|
|
4
4
|
import { Base, ReactFlowEdge, ReactFlowNode } from '../base/types';
|
|
@@ -8,7 +8,7 @@ type NonOptional<T extends object> = Simplify<{
|
|
|
8
8
|
[P in OptionalKeysOf<T>]-?: T[P] | undefined;
|
|
9
9
|
}>;
|
|
10
10
|
export declare namespace Types {
|
|
11
|
-
type LeafNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, 'id' | 'title' | 'technology' | 'description' | 'color' | 'shape' | 'width' | 'level' | 'height' | 'style' | 'position'>> & {
|
|
11
|
+
type LeafNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, 'id' | 'title' | 'technology' | 'description' | 'color' | 'shape' | 'width' | 'level' | 'height' | 'style' | 'tags' | 'position'>> & {
|
|
12
12
|
/**
|
|
13
13
|
* View this node belongs to
|
|
14
14
|
*/
|
|
@@ -32,10 +32,10 @@ export declare namespace Types {
|
|
|
32
32
|
*/
|
|
33
33
|
type DeploymentElementNodeData = LeafNodeData & {
|
|
34
34
|
navigateTo: ViewId | null;
|
|
35
|
-
deploymentFqn:
|
|
35
|
+
deploymentFqn: DeploymentFqn;
|
|
36
36
|
modelFqn: Fqn | null;
|
|
37
37
|
};
|
|
38
|
-
type CompoundNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, 'id' | 'title' | 'color' | 'shape' | 'style' | 'position'>> & {
|
|
38
|
+
type CompoundNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, 'id' | 'title' | 'color' | 'shape' | 'style' | 'tags' | 'position'>> & {
|
|
39
39
|
/**
|
|
40
40
|
* View this node belongs to
|
|
41
41
|
*/
|
|
@@ -52,7 +52,7 @@ export declare namespace Types {
|
|
|
52
52
|
navigateTo: ViewId | null;
|
|
53
53
|
};
|
|
54
54
|
type CompoundDeploymentNodeData = CompoundNodeData & {
|
|
55
|
-
deploymentFqn:
|
|
55
|
+
deploymentFqn: DeploymentFqn;
|
|
56
56
|
/**
|
|
57
57
|
* If set - this node refers to a model element
|
|
58
58
|
*/
|
|
@@ -4,9 +4,9 @@ import { ActionIconGroup, Group, Stack, Box, Badge, Loader } from '@mantine/core
|
|
|
4
4
|
import { IconFileSymlink, IconFocusCentered, IconMenu2 } from '@tabler/icons-react';
|
|
5
5
|
import { m, LayoutGroup } from 'motion/react';
|
|
6
6
|
import { memo } from 'react';
|
|
7
|
+
import { SearchControl } from '../../../components/SearchControl.js';
|
|
7
8
|
import { useControlsCustomLayout } from '../../../context/ControlsCustomLayout.js';
|
|
8
9
|
import { useDiagramContext, useDiagram, useDiagramSyncLayoutState } from '../../../hooks/useDiagram.js';
|
|
9
|
-
import { LikeC4Search } from '../search/LikeC4Search.js';
|
|
10
10
|
import { Tooltip, ActionIcon } from './_shared.js';
|
|
11
11
|
import { ChangeAutoLayoutButton } from './ChangeAutoLayoutButton.js';
|
|
12
12
|
import { LayoutDriftNotification } from './LayoutDriftNotification.js';
|
|
@@ -71,8 +71,7 @@ const ControlsDefaultLayout = ({
|
|
|
71
71
|
}
|
|
72
72
|
);
|
|
73
73
|
const Controls = memo(() => {
|
|
74
|
-
const {
|
|
75
|
-
viewId: c.view.id,
|
|
74
|
+
const { hasLayoutDrift, viewportChanged, isNotActiveWalkthrough } = useDiagramContext((c) => ({
|
|
76
75
|
hasLayoutDrift: c.view.hasLayoutDrift ?? false,
|
|
77
76
|
viewportChanged: c.viewportChangedManually,
|
|
78
77
|
isNotActiveWalkthrough: c.activeWalkthrough === null
|
|
@@ -106,7 +105,15 @@ const Controls = memo(() => {
|
|
|
106
105
|
}
|
|
107
106
|
),
|
|
108
107
|
navigationButtons: enableNavigationButtons && /* @__PURE__ */ jsx(NavigationButtons, {}),
|
|
109
|
-
search: enableSearch && /* @__PURE__ */ jsx(
|
|
108
|
+
search: enableSearch && /* @__PURE__ */ jsx(
|
|
109
|
+
SearchControl,
|
|
110
|
+
{
|
|
111
|
+
onClick: (e) => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
diagram.openSearch();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
),
|
|
110
117
|
syncInProgressBadge: /* @__PURE__ */ jsx(SyncLayoutBadge, {}),
|
|
111
118
|
actionsGroup: /* @__PURE__ */ jsxs(ActionIconGroup, { className: actionIconGroup, orientation: "vertical", children: [
|
|
112
119
|
enableVscode && /* @__PURE__ */ jsx(Tooltip, { label: "Open source", ...portalProps, children: /* @__PURE__ */ jsx(
|
|
@@ -114,6 +121,7 @@ const Controls = memo(() => {
|
|
|
114
121
|
{
|
|
115
122
|
onClick: (e) => {
|
|
116
123
|
e.stopPropagation();
|
|
124
|
+
const viewId = diagram.currentView.id;
|
|
117
125
|
onOpenSource?.({ view: viewId });
|
|
118
126
|
},
|
|
119
127
|
children: /* @__PURE__ */ jsx(IconFileSymlink, { stroke: 1.5 })
|
|
@@ -113,7 +113,7 @@ const ElementNotation = ({ value }) => {
|
|
|
113
113
|
};
|
|
114
114
|
const selector = (s) => ({
|
|
115
115
|
id: s.view.id,
|
|
116
|
-
notations: s.view.notation?.
|
|
116
|
+
notations: s.view.notation?.nodes ?? [],
|
|
117
117
|
isVisible: true
|
|
118
118
|
// isVisible: isNullish(s.focusedNodeId ?? s.activeWalkthrough),
|
|
119
119
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { DiagramView, WhereOperator } from '@likec4/core';
|
|
2
2
|
import { Types } from './types';
|
|
3
|
-
|
|
3
|
+
type ViewToNodesEdgeInput = {
|
|
4
4
|
view: DiagramView;
|
|
5
|
-
where: WhereOperator
|
|
5
|
+
where: WhereOperator | null;
|
|
6
6
|
nodesSelectable: boolean;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export declare function useViewToNodesEdges(params: ViewToNodesEdgeInput): {
|
|
8
9
|
xynodes: Types.Node[];
|
|
9
10
|
xyedges: Types.Edge[];
|
|
10
11
|
};
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Queue, whereOperatorAsPredicate, nonNullable,
|
|
2
|
-
import {
|
|
1
|
+
import { Queue, whereOperatorAsPredicate, nonNullable, GroupElementKind, invariant } from '@likec4/core';
|
|
2
|
+
import { useCustomCompareMemo } from '@react-hookz/web';
|
|
3
|
+
import { shallowEqual, deepEqual } from 'fast-equals';
|
|
3
4
|
import { pick, hasAtLeast } from 'remeda';
|
|
4
5
|
import { ZIndexes } from '../base/const.js';
|
|
5
6
|
|
|
@@ -8,7 +9,7 @@ function viewToNodesEdge(opts) {
|
|
|
8
9
|
view,
|
|
9
10
|
nodesSelectable: selectable
|
|
10
11
|
} = opts;
|
|
11
|
-
view.
|
|
12
|
+
view._type === "dynamic"; const xynodes = [], xyedges = [], nodeLookup = /* @__PURE__ */ new Map();
|
|
12
13
|
const queue = Queue.from(view.nodes.reduce(
|
|
13
14
|
(acc, node) => {
|
|
14
15
|
nodeLookup.set(node.id, node);
|
|
@@ -37,7 +38,7 @@ function viewToNodesEdge(opts) {
|
|
|
37
38
|
let next;
|
|
38
39
|
while (next = queue.dequeue()) {
|
|
39
40
|
const { node, parent } = next;
|
|
40
|
-
const isCompound = hasAtLeast(node.children, 1) || node.kind ==
|
|
41
|
+
const isCompound = hasAtLeast(node.children, 1) || node.kind == GroupElementKind;
|
|
41
42
|
if (isCompound) {
|
|
42
43
|
for (const child of node.children) {
|
|
43
44
|
queue.enqueue({ node: nodeById(child), parent: node });
|
|
@@ -54,8 +55,8 @@ function viewToNodesEdge(opts) {
|
|
|
54
55
|
const id = ns + node.id;
|
|
55
56
|
const base = {
|
|
56
57
|
id,
|
|
57
|
-
selectable: selectable && node.kind !==
|
|
58
|
-
focusable: selectable && node.kind !==
|
|
58
|
+
selectable: selectable && node.kind !== GroupElementKind,
|
|
59
|
+
focusable: selectable && node.kind !== GroupElementKind,
|
|
59
60
|
deletable: false,
|
|
60
61
|
position,
|
|
61
62
|
zIndex: isCompound ? ZIndexes.Compound : ZIndexes.Element,
|
|
@@ -65,7 +66,7 @@ function viewToNodesEdge(opts) {
|
|
|
65
66
|
},
|
|
66
67
|
initialWidth: node.width,
|
|
67
68
|
initialHeight: node.height,
|
|
68
|
-
hidden: node.kind !==
|
|
69
|
+
hidden: node.kind !== GroupElementKind && !visiblePredicate(node),
|
|
69
70
|
...parent && {
|
|
70
71
|
parentId: ns + parent.id
|
|
71
72
|
}
|
|
@@ -79,6 +80,7 @@ function viewToNodesEdge(opts) {
|
|
|
79
80
|
style: node.style,
|
|
80
81
|
depth: node.depth ?? 0,
|
|
81
82
|
icon: node.icon ?? "none",
|
|
83
|
+
tags: node.tags ?? null,
|
|
82
84
|
position: node.position
|
|
83
85
|
};
|
|
84
86
|
const leafNodeData = {
|
|
@@ -94,10 +96,11 @@ function viewToNodesEdge(opts) {
|
|
|
94
96
|
shape: node.shape,
|
|
95
97
|
style: node.style,
|
|
96
98
|
icon: node.icon ?? null,
|
|
99
|
+
tags: node.tags,
|
|
97
100
|
position: node.position,
|
|
98
101
|
isMultiple: node.style?.multiple ?? false
|
|
99
102
|
};
|
|
100
|
-
if (node.kind ===
|
|
103
|
+
if (node.kind === GroupElementKind) {
|
|
101
104
|
xynodes.push({
|
|
102
105
|
...base,
|
|
103
106
|
type: "view-group",
|
|
@@ -109,8 +112,8 @@ function viewToNodesEdge(opts) {
|
|
|
109
112
|
});
|
|
110
113
|
continue;
|
|
111
114
|
}
|
|
112
|
-
const modelFqn =
|
|
113
|
-
const deploymentFqn =
|
|
115
|
+
const modelFqn = node.modelRef ?? null;
|
|
116
|
+
const deploymentFqn = node.deploymentRef ?? null;
|
|
114
117
|
if (!modelFqn && !deploymentFqn) {
|
|
115
118
|
console.error("Invalid node", node);
|
|
116
119
|
throw new Error("Element should have either modelRef or deploymentRef");
|
|
@@ -221,26 +224,13 @@ function viewToNodesEdge(opts) {
|
|
|
221
224
|
xyedges
|
|
222
225
|
};
|
|
223
226
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
...opts
|
|
232
|
-
}) {
|
|
233
|
-
return useDeepCompareMemo(() => {
|
|
234
|
-
return viewToNodesEdge({
|
|
235
|
-
view: {
|
|
236
|
-
id,
|
|
237
|
-
nodes,
|
|
238
|
-
edges,
|
|
239
|
-
__
|
|
240
|
-
},
|
|
241
|
-
...opts
|
|
242
|
-
});
|
|
243
|
-
}, [id, __, nodes, edges, opts]);
|
|
227
|
+
const viewToNodesEdgeEqual = (a, b) => a.view.id === b.view.id && a.view._type === b.view._type && a.nodesSelectable === b.nodesSelectable && shallowEqual(a.view.nodes, b.view.nodes) && shallowEqual(a.view.edges, b.view.edges) && deepEqual(a.where, b.where);
|
|
228
|
+
function useViewToNodesEdges(params) {
|
|
229
|
+
return useCustomCompareMemo(
|
|
230
|
+
() => viewToNodesEdge(params),
|
|
231
|
+
[params],
|
|
232
|
+
([a], [b]) => !!a && !!b && viewToNodesEdgeEqual(a, b)
|
|
233
|
+
);
|
|
244
234
|
}
|
|
245
235
|
|
|
246
236
|
export { useViewToNodesEdges };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LikeC4Model } from '@likec4/core/model';
|
|
2
2
|
import { Context } from 'react';
|
|
3
|
-
export declare const LikeC4ModelContext: Context<LikeC4Model<
|
|
3
|
+
export declare const LikeC4ModelContext: Context<LikeC4Model<any> | null>;
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { LikeC4Model } from '@likec4/core/model';
|
|
2
|
-
|
|
3
|
-
export declare function useLikeC4Model(
|
|
4
|
-
export declare function useLikeC4Model(
|
|
5
|
-
export declare function useLikeC4Model
|
|
6
|
-
export declare function useLikeC4Model
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { aux, LikeC4Model } from '@likec4/core/model';
|
|
2
|
+
import { TagSpecification, ElementSpecification, RelationshipSpecification, CustomColorDefinitions } from '@likec4/core';
|
|
3
|
+
export declare function useLikeC4Model<A extends aux.Any = aux.Unknown>(): LikeC4Model<A>;
|
|
4
|
+
export declare function useLikeC4Model<A extends aux.Any = aux.Unknown>(type: 'layouted'): LikeC4Model.Layouted<A>;
|
|
5
|
+
export declare function useLikeC4Model<A extends aux.Any = aux.Unknown>(type: 'computed'): LikeC4Model.Computed<A>;
|
|
6
|
+
export declare function useLikeC4Model<A extends aux.Any = aux.Unknown>(type: 'layouted' | 'computed' | undefined): LikeC4Model<A>;
|
|
7
|
+
export declare function useLikeC4Specification(): {
|
|
8
|
+
tags: {
|
|
9
|
+
[x: string]: TagSpecification;
|
|
10
|
+
};
|
|
11
|
+
elements: {
|
|
12
|
+
[x: string]: Partial< ElementSpecification>;
|
|
13
|
+
};
|
|
14
|
+
deployments: {
|
|
15
|
+
[x: string]: Partial< ElementSpecification>;
|
|
16
|
+
};
|
|
17
|
+
relationships: {
|
|
18
|
+
[x: string]: Partial< RelationshipSpecification>;
|
|
19
|
+
};
|
|
20
|
+
metadataKeys?: string[];
|
|
21
|
+
customColors?: CustomColorDefinitions;
|
|
22
|
+
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { isString
|
|
2
|
+
import { isString } from 'remeda';
|
|
3
3
|
import { LikeC4ModelContext } from './LikeC4ModelContext.js';
|
|
4
4
|
|
|
5
|
-
function useLikeC4Model(
|
|
5
|
+
function useLikeC4Model(type) {
|
|
6
6
|
const model = useContext(LikeC4ModelContext);
|
|
7
|
-
if (
|
|
8
|
-
throw new Error(`Invalid LikeC4ModelContext, expected "${type}" but got "${model.type}" in context`);
|
|
9
|
-
}
|
|
10
|
-
if (isDefined(strict) && strict === true && !model) {
|
|
7
|
+
if (!model) {
|
|
11
8
|
throw new Error("No LikeC4Model found in context");
|
|
12
9
|
}
|
|
10
|
+
if (isString(type) && model.stage !== type) {
|
|
11
|
+
throw new Error(`Invalid LikeC4ModelContext, expected "${type}" but got "${model.stage}" in context`);
|
|
12
|
+
}
|
|
13
13
|
return model;
|
|
14
14
|
}
|
|
15
|
+
function useLikeC4Specification() {
|
|
16
|
+
const model = useLikeC4Model();
|
|
17
|
+
return model.$data.specification;
|
|
18
|
+
}
|
|
15
19
|
|
|
16
|
-
export { useLikeC4Model };
|
|
20
|
+
export { useLikeC4Model, useLikeC4Specification };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { nonexhaustive } from '@likec4/core';
|
|
3
|
-
import { Box, Notification, ScrollAreaAutosize, Code, Group, Button } from '@mantine/core';
|
|
4
|
-
import { IconX } from '@tabler/icons-react';
|
|
5
3
|
import { useSelector } from '@xstate/react';
|
|
6
4
|
import { animate } from 'motion';
|
|
7
5
|
import { useReducedMotionConfig, LayoutGroup, AnimatePresence } from 'motion/react';
|
|
8
6
|
import { useMemo, useEffect } from 'react';
|
|
9
7
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
8
|
import { isNonNullish } from 'remeda';
|
|
9
|
+
import { ErrorFallback } from '../components/ErrorFallback.js';
|
|
11
10
|
import { ElementDetails } from './element-details/ElementDetails.js';
|
|
12
11
|
import { Overlay } from './overlay/Overlay.js';
|
|
13
12
|
import { RelationshipDetails } from './relationship-details/RelationshipDetails.js';
|
|
@@ -15,28 +14,6 @@ import { RelationshipsBrowser } from './relationships-browser/RelationshipsBrows
|
|
|
15
14
|
import { useXYStore } from '../hooks/useXYFlow.js';
|
|
16
15
|
import { DiagramFeatures } from '../context/DiagramFeatures.js';
|
|
17
16
|
|
|
18
|
-
function Fallback({ error, resetErrorBoundary }) {
|
|
19
|
-
const errorString = error instanceof Error ? error.message : "Unknown error";
|
|
20
|
-
return /* @__PURE__ */ jsx(Box, { pos: "fixed", top: 0, left: 0, w: "100%", p: 0, style: { zIndex: 1e3 }, children: /* @__PURE__ */ jsxs(
|
|
21
|
-
Notification,
|
|
22
|
-
{
|
|
23
|
-
icon: /* @__PURE__ */ jsx(IconX, { style: { width: 16, height: 16 } }),
|
|
24
|
-
styles: {
|
|
25
|
-
icon: {
|
|
26
|
-
alignSelf: "flex-start"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
color: "red",
|
|
30
|
-
title: "Oops, something went wrong",
|
|
31
|
-
p: "xl",
|
|
32
|
-
withCloseButton: false,
|
|
33
|
-
children: [
|
|
34
|
-
/* @__PURE__ */ jsx(ScrollAreaAutosize, { maw: "100%", mah: 400, children: /* @__PURE__ */ jsx(Code, { block: true, children: errorString }) }),
|
|
35
|
-
/* @__PURE__ */ jsx(Group, { gap: "xs", mt: "xl", children: /* @__PURE__ */ jsx(Button, { color: "gray", size: "xs", variant: "light", onClick: () => resetErrorBoundary(), children: "Reset" }) })
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
) });
|
|
39
|
-
}
|
|
40
17
|
const selectOverlays = (s) => {
|
|
41
18
|
return s.context.overlays.map((overlay) => {
|
|
42
19
|
switch (overlay.type) {
|
|
@@ -72,7 +49,7 @@ function Overlays({ overlaysActorRef }) {
|
|
|
72
49
|
]);
|
|
73
50
|
const overlays = useSelector(overlaysActorRef, selectOverlays, compareSelectOverlays);
|
|
74
51
|
const isMotionReduced = useReducedMotionConfig() ?? false;
|
|
75
|
-
const isActiveOverlay = overlays.
|
|
52
|
+
const isActiveOverlay = overlays.some((overlay) => overlay.type === "elementDetails");
|
|
76
53
|
useEffect(() => {
|
|
77
54
|
if (!xyflowRendererDom || isMotionReduced) return;
|
|
78
55
|
animate(xyflowRendererDom, {
|
|
@@ -121,7 +98,7 @@ function Overlays({ overlaysActorRef }) {
|
|
|
121
98
|
nonexhaustive(overlay);
|
|
122
99
|
}
|
|
123
100
|
});
|
|
124
|
-
return /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent:
|
|
101
|
+
return /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: () => overlaysActorRef.send({ type: "close.all" }), children: /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: overlaysReact }) }) }) });
|
|
125
102
|
}
|
|
126
103
|
|
|
127
104
|
export { Overlays };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { isScopedElementView, isDeploymentView } from '@likec4/core';
|
|
3
2
|
import { cx, css } from '@likec4/styles/css';
|
|
4
3
|
import { RemoveScroll, Card, Group, Text, CloseButton, Badge, Flex, ActionIconGroup, ActionIcon, Tooltip as Tooltip$1, Tabs, TabsList, TabsTab, TabsPanel, ScrollArea, Box, Stack, Divider as Divider$1, Code, UnstyledButton, ThemeIcon } from '@mantine/core';
|
|
5
4
|
import { useViewportSize, useSessionStorage } from '@mantine/hooks';
|
|
@@ -8,6 +7,7 @@ import { IconExternalLink, IconFileSymlink, IconZoomScan, IconStack2 } from '@ta
|
|
|
8
7
|
import { useDragControls, useMotionValue, m } from 'motion/react';
|
|
9
8
|
import { useState, useCallback, useRef } from 'react';
|
|
10
9
|
import { pipe, map, partition, only, clamp, isNullish } from 'remeda';
|
|
10
|
+
import { ElementTag } from '../../base/primitives/element/ElementTags.js';
|
|
11
11
|
import { Link } from '../../components/Link.js';
|
|
12
12
|
import { useDiagram } from '../../hooks/useDiagram.js';
|
|
13
13
|
import { elementIcon, cardHeader, title, tabsPanel, tabsTab, tabsList, tabsRoot, propertiesGrid, resizeHandle, card, backdropOpacity, backdropBlur, dialog, propertyLabel, viewButton, viewButtonTitle } from './ElementDetailsCard.css.js';
|
|
@@ -64,17 +64,14 @@ function ElementDetailsCard({
|
|
|
64
64
|
defaultValue: "Properties"
|
|
65
65
|
});
|
|
66
66
|
const diagram = useDiagram();
|
|
67
|
-
const likec4model = useLikeC4Model(
|
|
67
|
+
const likec4model = useLikeC4Model();
|
|
68
68
|
const viewModel = likec4model.view(viewId);
|
|
69
69
|
const nodeModel = fromNode ? viewModel.findNode(fromNode) : viewModel.findNodeWithElement(fqn);
|
|
70
70
|
const elementModel = viewModel.$model.element(fqn);
|
|
71
71
|
const [viewsOf, otherViews] = pipe(
|
|
72
72
|
[...elementModel.views()],
|
|
73
73
|
map((v) => v.$view),
|
|
74
|
-
partition((
|
|
75
|
-
const v = view;
|
|
76
|
-
return isScopedElementView(v) && v.viewOf === fqn;
|
|
77
|
-
})
|
|
74
|
+
partition((v) => v._type === "element" && v.viewOf === fqn)
|
|
78
75
|
);
|
|
79
76
|
let defaultView = nodeModel?.navigateTo?.$view ?? elementModel.defaultView?.$view ?? null;
|
|
80
77
|
if (defaultView?.id === viewId) {
|
|
@@ -262,11 +259,21 @@ function ElementDetailsCard({
|
|
|
262
259
|
] }),
|
|
263
260
|
/* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
|
|
264
261
|
/* @__PURE__ */ jsx(SmallLabel, { children: "tags" }),
|
|
265
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 4, flex: 1, mt: 6, children: [
|
|
266
|
-
elementModel.tags.map((tag) => /* @__PURE__ */
|
|
267
|
-
|
|
262
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 4, flex: 1, mt: 6, wrap: "wrap", children: [
|
|
263
|
+
elementModel.tags.map((tag) => /* @__PURE__ */ jsx(
|
|
264
|
+
ElementTag,
|
|
265
|
+
{
|
|
266
|
+
tag,
|
|
267
|
+
css: {
|
|
268
|
+
cursor: "pointer"
|
|
269
|
+
},
|
|
270
|
+
onClick: (e) => {
|
|
271
|
+
e.stopPropagation();
|
|
272
|
+
diagram.openSearch(`#${tag}`);
|
|
273
|
+
}
|
|
274
|
+
},
|
|
268
275
|
tag
|
|
269
|
-
|
|
276
|
+
)),
|
|
270
277
|
elementModel.tags.length === 0 && /* @__PURE__ */ jsx(Badge, { radius: "sm", size: "sm", fw: 600, color: "gray", children: "—" })
|
|
271
278
|
] })
|
|
272
279
|
] }),
|
|
@@ -274,7 +281,7 @@ function ElementDetailsCard({
|
|
|
274
281
|
ActionIconGroup,
|
|
275
282
|
{
|
|
276
283
|
style: {
|
|
277
|
-
alignSelf: "flex-
|
|
284
|
+
alignSelf: "flex-start"
|
|
278
285
|
},
|
|
279
286
|
children: [
|
|
280
287
|
defaultLink && /* @__PURE__ */ jsx(
|
|
@@ -409,7 +416,7 @@ const ViewButton = ({
|
|
|
409
416
|
onNavigateTo
|
|
410
417
|
}) => {
|
|
411
418
|
return /* @__PURE__ */ jsx(UnstyledButton, { className: viewButton, onClick: (e) => onNavigateTo(view.id, e), children: /* @__PURE__ */ jsxs(Group, { gap: 6, align: "start", wrap: "nowrap", children: [
|
|
412
|
-
/* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", children:
|
|
419
|
+
/* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", children: view._type === "deployment" ? /* @__PURE__ */ jsx(IconStack2, { stroke: 1.8 }) : /* @__PURE__ */ jsx(IconZoomScan, { stroke: 1.8 }) }),
|
|
413
420
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
414
421
|
/* @__PURE__ */ jsx(Text, { component: "div", className: viewButtonTitle, lineClamp: 1, children: view.title || "untitled" }),
|
|
415
422
|
view.description && /* @__PURE__ */ jsx(Text, { component: "div", mt: 2, fz: "xs", c: "dimmed", lh: 1.4, lineClamp: 1, children: view.description })
|
|
@@ -73,7 +73,7 @@ const DeployedInstanceRenderer = ({
|
|
|
73
73
|
const setHoveredNode = () => {
|
|
74
74
|
};
|
|
75
75
|
const TabPanelDeployments = memo(({ elementFqn }) => {
|
|
76
|
-
const element = useLikeC4Model(
|
|
76
|
+
const element = useLikeC4Model().element(elementFqn);
|
|
77
77
|
const deployments = [...element.deployments()];
|
|
78
78
|
const tree = useTree({
|
|
79
79
|
multiple: false
|