@likec4/diagram 1.21.0 → 1.21.1
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/dist/base/BaseXYFlow.js +0 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/edge/EdgeLabel.js +2 -2
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +6 -1
- package/dist/base/primitives/element/ElementNodeContainer.js +31 -13
- package/dist/base/primitives/element/ElementTitle.js +7 -3
- package/dist/hooks/index.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/likec4diagram/DiagramUI.js +1 -2
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +1 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +4 -3
- package/dist/likec4diagram/ui/index.d.ts +2 -0
- package/dist/overlays/Overlays.js +1 -1
- package/dist/overlays/element-details/TabPanelDeployments.js +4 -2
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/src/base/BaseXYFlow.tsx +0 -1
- package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -7
- package/src/base/primitives/element/ElementNodeContainer.tsx +36 -16
- package/src/base/primitives/element/ElementTitle.css.ts +12 -9
- package/src/base/primitives/element/ElementTitle.tsx +6 -2
- package/src/base/primitives/element/styles.css.ts +16 -38
- package/src/globals.css.ts +2 -0
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +15 -1
- package/src/likec4diagram/DiagramUI.tsx +1 -4
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +1 -0
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -0
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +110 -107
- package/src/likec4diagram/ui/index.ts +2 -0
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -3
- package/src/overlays/Overlays.tsx +1 -1
- package/src/overlays/element-details/ElementDetailsCard.tsx +1 -4
- package/src/overlays/element-details/TabPanelDeployments.tsx +4 -4
- package/dist/hooks/useCurrentViewId.js +0 -8
package/dist/base/BaseXYFlow.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createPolymorphicComponent, Box } from "@mantine/core";
|
|
3
|
-
import { assignInlineVars } from "
|
|
3
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { m } from "framer-motion";
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
import { isNumber, clamp } from "remeda";
|
|
8
|
-
import { indicator, compoundBg, compoundBorder, varCompoundOpacity, container
|
|
8
|
+
import { indicator, compoundBg, compoundBorder, varBorderTransparency, varCompoundOpacity, container } from "./CompoundNodeContainer.css.js";
|
|
9
9
|
const CompoundNodeContainer = createPolymorphicComponent(
|
|
10
10
|
forwardRef(({
|
|
11
11
|
nodeProps: {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { isStepEdgeId, extractStep } from "@likec4/core";
|
|
3
3
|
import { createPolymorphicComponent, Box, Text } from "@mantine/core";
|
|
4
|
-
import { assignInlineVars } from "
|
|
4
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { EdgeLabelRenderer } from "@xyflow/react";
|
|
6
6
|
import clsx from "clsx";
|
|
7
7
|
import { forwardRef } from "react";
|
|
8
8
|
import { isTruthy, isNumber } from "remeda";
|
|
9
9
|
import { useIsZoomTooSmall } from "../../../hooks/useXYFlow.js";
|
|
10
10
|
import { ZIndexes } from "../../const.js";
|
|
11
|
-
import { edgeLabel, stepEdgeNumber, secondColumn, edgeLabelText, edgeLabelTechnology, edgeVars, edgeLabelContainer, dimmed
|
|
11
|
+
import { edgeLabel, stepEdgeNumber, secondColumn, edgeLabelText, edgeLabelTechnology, varTranslate, edgeVars, edgeLabelContainer, dimmed } from "./EdgeLabel.css.js";
|
|
12
12
|
const toCssVarValue = (value) => {
|
|
13
13
|
if (value === void 0) return void 0;
|
|
14
14
|
return isNumber(value) ? `${value}px` : value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiagramNode } from '@likec4/core';
|
|
1
|
+
import { DiagramNode, ElementStyle, ShapeSize, SpacingSize, TextSize } from '@likec4/core';
|
|
2
2
|
import { BoxProps, PolymorphicComponentProps } from '@mantine/core';
|
|
3
3
|
import { PropsWithChildren, FunctionComponent, ReactNode } from 'react';
|
|
4
4
|
import { NodeProps } from '../../types';
|
|
@@ -6,6 +6,11 @@ type RequiredData = Pick<DiagramNode, 'color' | 'shape' | 'style'>;
|
|
|
6
6
|
type ElementNodeContainerProps = BoxProps & PropsWithChildren<{
|
|
7
7
|
nodeProps: NodeProps<RequiredData>;
|
|
8
8
|
}>;
|
|
9
|
+
export declare function nodeSizes({ size, padding, textSize, }: ElementStyle): {
|
|
10
|
+
size: ShapeSize;
|
|
11
|
+
padding: SpacingSize;
|
|
12
|
+
textSize: TextSize;
|
|
13
|
+
};
|
|
9
14
|
export declare const ElementNodeContainer: (<C = "div">(props: PolymorphicComponentProps<C, ElementNodeContainerProps>) => React.ReactElement) & Omit< FunctionComponent<(BoxProps & {
|
|
10
15
|
nodeProps: NodeProps<RequiredData>;
|
|
11
16
|
} & {
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DefaultTextSize, DefaultPaddingSize
|
|
2
|
+
import { DefaultShapeSize, DefaultTextSize, DefaultPaddingSize } from "@likec4/core";
|
|
3
3
|
import { createPolymorphicComponent, Box } from "@mantine/core";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { m } from "framer-motion";
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
import { container } from "./ElementNodeContainer.css.js";
|
|
8
|
+
function nodeSizes({
|
|
9
|
+
size,
|
|
10
|
+
padding,
|
|
11
|
+
textSize
|
|
12
|
+
}) {
|
|
13
|
+
if (!size && !!textSize) {
|
|
14
|
+
size = textSize;
|
|
15
|
+
}
|
|
16
|
+
if (!textSize && !!size) {
|
|
17
|
+
textSize = size;
|
|
18
|
+
}
|
|
19
|
+
if (!padding && !!size) {
|
|
20
|
+
padding = size;
|
|
21
|
+
}
|
|
22
|
+
size ?? (size = DefaultShapeSize);
|
|
23
|
+
textSize ?? (textSize = DefaultTextSize);
|
|
24
|
+
padding ?? (padding = DefaultPaddingSize);
|
|
25
|
+
return {
|
|
26
|
+
size,
|
|
27
|
+
padding,
|
|
28
|
+
textSize
|
|
29
|
+
};
|
|
30
|
+
}
|
|
8
31
|
const ElementNodeContainer = createPolymorphicComponent(
|
|
9
32
|
forwardRef(({
|
|
10
33
|
nodeProps: {
|
|
@@ -28,17 +51,11 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
28
51
|
scale = 1.02;
|
|
29
52
|
break;
|
|
30
53
|
}
|
|
31
|
-
|
|
54
|
+
const {
|
|
32
55
|
size,
|
|
33
56
|
padding,
|
|
34
57
|
textSize
|
|
35
|
-
} = data.style;
|
|
36
|
-
if (!size && !!textSize) {
|
|
37
|
-
size = textSize;
|
|
38
|
-
}
|
|
39
|
-
if (!textSize && !!size) {
|
|
40
|
-
textSize = size;
|
|
41
|
-
}
|
|
58
|
+
} = nodeSizes(data.style);
|
|
42
59
|
return /* @__PURE__ */ jsx(
|
|
43
60
|
Box,
|
|
44
61
|
{
|
|
@@ -58,9 +75,9 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
58
75
|
"data-hovered": isHovered,
|
|
59
76
|
"data-likec4-color": data.color,
|
|
60
77
|
"data-likec4-shape": data.shape,
|
|
61
|
-
"data-likec4-shape-size": size
|
|
62
|
-
"data-likec4-padding": padding
|
|
63
|
-
"data-likec4-text-size": textSize
|
|
78
|
+
"data-likec4-shape-size": size,
|
|
79
|
+
"data-likec4-padding": padding,
|
|
80
|
+
"data-likec4-text-size": textSize,
|
|
64
81
|
"data-likec4-dimmed": isDimmed,
|
|
65
82
|
...rest,
|
|
66
83
|
children
|
|
@@ -70,5 +87,6 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
70
87
|
);
|
|
71
88
|
ElementNodeContainer.displayName = "ElementNodeContainer";
|
|
72
89
|
export {
|
|
73
|
-
ElementNodeContainer
|
|
90
|
+
ElementNodeContainer,
|
|
91
|
+
nodeSizes
|
|
74
92
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import "@likec4/core";
|
|
3
3
|
import { Box, Text } from "@mantine/core";
|
|
4
|
-
import { assignInlineVars } from "
|
|
4
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import { isNumber, isTruthy } from "remeda";
|
|
7
7
|
import { IconRenderer } from "../../../context/IconRenderer.js";
|
|
8
8
|
import { hiddenIfZoomTooSmall } from "../../../LikeC4Diagram.css.js";
|
|
9
|
+
import { nodeSizes } from "./ElementNodeContainer.js";
|
|
9
10
|
import { elementIcon, title, technology, description, elementTextData, elementDataContainer, hasIcon } from "./ElementTitle.css.js";
|
|
10
11
|
import { iconSize } from "./styles.css.js";
|
|
11
12
|
function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
@@ -17,6 +18,9 @@ function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
|
17
18
|
},
|
|
18
19
|
className: elementIcon
|
|
19
20
|
});
|
|
21
|
+
const size = nodeSizes(data.style).size;
|
|
22
|
+
const isSm = size === "sm";
|
|
23
|
+
const isSmOrXs = isSm || size === "xs";
|
|
20
24
|
return /* @__PURE__ */ jsxs(
|
|
21
25
|
Box,
|
|
22
26
|
{
|
|
@@ -38,7 +42,7 @@ function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
|
38
42
|
{
|
|
39
43
|
component: "h3",
|
|
40
44
|
className: clsx(title, "likec4-element-title"),
|
|
41
|
-
lineClamp: 3,
|
|
45
|
+
lineClamp: isSmOrXs ? 2 : 3,
|
|
42
46
|
children: data.title
|
|
43
47
|
}
|
|
44
48
|
),
|
|
@@ -55,7 +59,7 @@ function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
|
55
59
|
{
|
|
56
60
|
component: "div",
|
|
57
61
|
className: clsx(description, "likec4-element-description"),
|
|
58
|
-
lineClamp: 5,
|
|
62
|
+
lineClamp: isSmOrXs ? 3 : 5,
|
|
59
63
|
children: data.description
|
|
60
64
|
}
|
|
61
65
|
)
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { useCurrentViewId } from './useCurrentViewId';
|
|
2
|
-
export type { DiagramContext } from './useDiagramContext';
|
|
3
2
|
export { useMantinePortalProps } from './useMantinePortalProps';
|
|
4
3
|
export { useSetState } from './useSetState';
|
|
5
4
|
export { useUpdateEffect } from './useUpdateEffect';
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export { LikeC4ModelProvider } from './LikeC4ModelProvider';
|
|
|
7
7
|
export { useSetState } from './hooks/useSetState';
|
|
8
8
|
export { useUpdateEffect } from './hooks/useUpdateEffect';
|
|
9
9
|
export { vars, xyvars } from './theme-vars';
|
|
10
|
-
export type
|
|
10
|
+
export type { ChangeEvent, DiagramNodeWithNavigate, ElementIconRenderer, LikeC4ColorScheme, LikeC4DiagramEventHandlers, LikeC4DiagramProperties, OnCanvasClick, OnChange, OnEdgeClick, OnNavigateTo, OnNodeClick, OpenSourceParams, WhereOperator, } from './LikeC4Diagram.props';
|
|
11
11
|
export { StaticLikeC4Diagram } from './StaticLikeC4Diagram';
|
|
12
12
|
export type { StaticLikeC4DiagramProps } from './StaticLikeC4Diagram';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
2
|
import { LikeC4Search } from "../LikeC4Search.js";
|
|
4
3
|
import { Overlays } from "../overlays/Overlays.js";
|
|
5
|
-
import { DynamicViewWalkthrough } from "./ui/walkthrough/DynamicViewWalkthrough.js";
|
|
6
4
|
import { Controls } from "./ui/controls/Controls.js";
|
|
7
5
|
import { IfEnabled } from "../context/DiagramFeatures.js";
|
|
8
6
|
import { DiagramTitlePanel } from "./ui/diagram-title/DiagramTitlePanel.js";
|
|
9
7
|
import { NotationPanel } from "./ui/notation/NotationPanel.js";
|
|
8
|
+
import { DynamicViewWalkthrough } from "./ui/walkthrough/DynamicViewWalkthrough.js";
|
|
10
9
|
function DiagramUI() {
|
|
11
10
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
11
|
/* @__PURE__ */ jsx(Controls, {}),
|
|
@@ -11,16 +11,17 @@ const selector = (s) => ({
|
|
|
11
11
|
id: s.view.id,
|
|
12
12
|
title: s.view.title ?? "untitled",
|
|
13
13
|
description: s.view.description,
|
|
14
|
-
links: s.view.links
|
|
14
|
+
links: s.view.links,
|
|
15
|
+
isNotActiveWalkthrough: s.activeWalkthrough === null
|
|
15
16
|
});
|
|
16
17
|
function DiagramTitlePanel() {
|
|
17
|
-
const { id, title: title$1, description: description$1, links } = useDiagramContext(selector);
|
|
18
|
+
const { id, title: title$1, description: description$1, links, isNotActiveWalkthrough } = useDiagramContext(selector);
|
|
18
19
|
const [isCollapsed, setCollapsed] = useLocalStorage({
|
|
19
20
|
key: "diagram-title-webview-collapsed",
|
|
20
21
|
defaultValue: false
|
|
21
22
|
});
|
|
22
23
|
const toggle = () => setCollapsed((v) => !v);
|
|
23
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(
|
|
24
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isNotActiveWalkthrough && /* @__PURE__ */ jsx(
|
|
24
25
|
m.div,
|
|
25
26
|
{
|
|
26
27
|
initial: { opacity: 0.05, scale: 0.7 },
|
|
@@ -64,7 +64,7 @@ const Overlays = memo(() => {
|
|
|
64
64
|
rectFromNode
|
|
65
65
|
} = useDiagramActorState(selector, equals);
|
|
66
66
|
const isMotionReduced = useReducedMotion() ?? false;
|
|
67
|
-
const isActiveOverlay = !!activeElementDetailsOf;
|
|
67
|
+
const isActiveOverlay = !!activeElementDetailsOf || !!relationshipsBrowserActor || !!relationshipDetailsActor;
|
|
68
68
|
useEffect(() => {
|
|
69
69
|
if (!xyflowRendererDom || isMotionReduced) return;
|
|
70
70
|
animate(xyflowRendererDom, {
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTree, Alert, Tree, Box, rem, Button, Group, Text, ThemeIcon, Menu } from "@mantine/core";
|
|
3
3
|
import { IconInfoCircle, IconTarget, IconZoomScan } from "@tabler/icons-react";
|
|
4
4
|
import { memo, useMemo, useEffect } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { useDiagram } from "../../hooks/useDiagram.js";
|
|
6
6
|
import { useLikeC4Model } from "../../likec4model/useLikeC4Model.js";
|
|
7
7
|
import { treeNodeLabel, treeNode, nodeLabel, instanceLabel } from "./TabPanelDeployments.css.js";
|
|
8
8
|
import { stopPropagation } from "../../utils/xyflow.js";
|
|
@@ -18,7 +18,8 @@ const DeploymentNodeRenderer = ({
|
|
|
18
18
|
const DeployedInstanceRenderer = ({
|
|
19
19
|
instance
|
|
20
20
|
}) => {
|
|
21
|
-
const
|
|
21
|
+
const diagram = useDiagram();
|
|
22
|
+
const currentViewId = diagram.currentView().id;
|
|
22
23
|
const views = [...instance.views()];
|
|
23
24
|
return /* @__PURE__ */ jsxs(Group, { className: instanceLabel, gap: 4, children: [
|
|
24
25
|
/* @__PURE__ */ jsx(ThemeIcon, { color: "gray", variant: "transparent", size: "xs", flex: 0, children: /* @__PURE__ */ jsx(IconTarget, { stroke: 1.2 }) }),
|
|
@@ -56,6 +57,7 @@ const DeployedInstanceRenderer = ({
|
|
|
56
57
|
},
|
|
57
58
|
onClick: (e) => {
|
|
58
59
|
e.stopPropagation();
|
|
60
|
+
diagram.navigateTo(view.id);
|
|
59
61
|
},
|
|
60
62
|
children: view.title
|
|
61
63
|
},
|