@likec4/diagram 1.20.3 → 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/README.md +2 -2
- package/dist/base/BaseXYFlow.js +1 -2
- package/dist/base/example/_types.d.ts +3 -3
- package/dist/base/example/custom.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/compound/CompoundTitle.css.d.ts +1 -0
- package/dist/base/primitives/compound/CompoundTitle.css.js +2 -0
- package/dist/base/primitives/compound/CompoundTitle.d.ts +2 -2
- package/dist/base/primitives/compound/CompoundTitle.js +17 -6
- package/dist/base/primitives/edge/EdgeLabel.js +2 -2
- package/dist/base/primitives/element/ElementActionButtons.js +1 -1
- package/dist/base/primitives/element/ElementDetailsButton.js +1 -1
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +7 -2
- package/dist/base/primitives/element/ElementNodeContainer.js +34 -1
- package/dist/base/primitives/element/ElementShape.js +1 -1
- package/dist/base/primitives/element/ElementTitle.css.d.ts +0 -1
- package/dist/base/primitives/element/ElementTitle.css.js +8 -8
- package/dist/base/primitives/element/ElementTitle.d.ts +1 -1
- package/dist/base/primitives/element/ElementTitle.js +11 -5
- package/dist/base/primitives/element/styles.css.d.ts +3 -0
- package/dist/base/primitives/element/styles.css.js +6 -0
- package/dist/context/DiagramEventHandlers.js +1 -1
- package/dist/context/DiagramFeatures.js +1 -1
- package/dist/context/RootContainer.js +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useDiagram.d.ts +1 -2
- package/dist/hooks/useXYFlow.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/likec4diagram/DiagramUI.d.ts +1 -2
- package/dist/likec4diagram/DiagramUI.js +3 -4
- package/dist/likec4diagram/XYFlow.js +1 -1
- package/dist/likec4diagram/custom/edges/NotePopover.js +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +5 -4
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +8 -8
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/machine.js +5 -5
- package/dist/likec4diagram/types.d.ts +2 -2
- package/dist/likec4diagram/ui/controls/Controls.js +1 -1
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +5 -4
- package/dist/likec4diagram/ui/index.d.ts +2 -0
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +2 -2
- package/dist/likec4diagram/useViewToNodesEdges.js +1 -1
- package/dist/overlays/Overlays.js +43 -22
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +38 -39
- package/dist/overlays/element-details/TabPanelDeployments.js +5 -3
- package/dist/overlays/element-details/TabPanelRelationships.js +14 -30
- package/dist/overlays/overlay/Overlay.css.js +2 -1
- package/dist/overlays/overlay/Overlay.js +2 -2
- package/dist/overlays/relationship-details/SelectEdge.js +1 -1
- package/dist/overlays/relationship-details/_types.d.ts +3 -3
- package/dist/overlays/relationship-details/actor.js +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -3
- package/dist/overlays/relationship-details/custom/nodeTypes.js +2 -2
- package/dist/overlays/relationship-details/useLayoutedDetails.js +1 -4
- package/dist/overlays/relationships-browser/-useRelationshipsView.js +0 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
- package/dist/overlays/relationships-browser/_types.d.ts +3 -3
- package/dist/overlays/relationships-browser/actor.js +16 -16
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +3 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +3 -3
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +3 -2
- package/dist/style.css +1 -1
- package/package.json +14 -14
- package/src/base/BaseXYFlow.tsx +0 -1
- package/src/base/example/_types.ts +3 -2
- package/src/base/example/useViewToNodesEdges.ts +2 -1
- package/src/base/primitives/compound/CompoundTitle.css.ts +27 -1
- package/src/base/primitives/compound/CompoundTitle.tsx +12 -2
- package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -7
- package/src/base/primitives/element/ElementNodeContainer.tsx +41 -1
- package/src/base/primitives/element/ElementShape.css.ts +5 -0
- package/src/base/primitives/element/ElementTitle.css.ts +25 -29
- package/src/base/primitives/element/ElementTitle.tsx +10 -4
- package/src/base/primitives/element/styles.css.ts +52 -0
- package/src/globals.css.ts +2 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useDiagram.ts +1 -1
- package/src/index.ts +15 -1
- package/src/likec4diagram/DiagramUI.tsx +3 -6
- package/src/likec4diagram/XYFlow.tsx +2 -2
- 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 +4 -2
- package/src/likec4diagram/types.ts +2 -2
- 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/likec4diagram/useViewToNodesEdges.ts +1 -1
- package/src/overlays/Overlays.tsx +62 -282
- package/src/overlays/element-details/ElementDetailsCard.tsx +214 -261
- package/src/overlays/element-details/TabPanelDeployments.tsx +4 -4
- package/src/overlays/element-details/TabPanelRelationships.tsx +13 -75
- package/src/overlays/overlay/Overlay.tsx +1 -1
- package/src/overlays/relationship-details/_types.ts +3 -3
- package/src/overlays/relationship-details/useLayoutedDetails.ts +1 -1
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +44 -55
- package/src/overlays/relationships-browser/_types.ts +12 -2
- package/src/overlays/relationships-browser/actor.ts +11 -10
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +2 -1
- package/dist/hooks/useCurrentViewId.js +0 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@likec4/diagram`
|
|
2
2
|
|
|
3
|
-
[docs](https://likec4.dev/docs/tools/react/) | [demo](https://template.likec4.dev/view/
|
|
3
|
+
[docs](https://likec4.dev/docs/tools/react/) | [demo](https://template.likec4.dev/view/index/)
|
|
4
4
|
|
|
5
5
|
React components to render diagrams.
|
|
6
6
|
Although you can use them directly, it is recommended to use [likec4](../likec4/) CLI to generate components from LikeC4 sources.
|
|
@@ -13,4 +13,4 @@ npm add @likec4/diagram
|
|
|
13
13
|
|
|
14
14
|
### Local Development
|
|
15
15
|
|
|
16
|
-
Use [
|
|
16
|
+
Use [packages/likec4](../likec4/) workspace
|
package/dist/base/BaseXYFlow.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useIsZoomTooSmall } from "../hooks/useXYFlow.js";
|
|
|
7
7
|
import { cssReactFlow, cssDisablePan, cssTransparentBg } from "../LikeC4Diagram.css.js";
|
|
8
8
|
import { stopPropagation } from "../utils/xyflow.js";
|
|
9
9
|
import { Background } from "./Background.js";
|
|
10
|
-
import {
|
|
10
|
+
import { MinZoom, MaxZoom } from "./const.js";
|
|
11
11
|
import { Base } from "./types.js";
|
|
12
12
|
import { useUpdateEffect } from "../hooks/useUpdateEffect.js";
|
|
13
13
|
const BaseXYFlow = ({
|
|
@@ -38,7 +38,6 @@ const BaseXYFlow = ({
|
|
|
38
38
|
nodes,
|
|
39
39
|
edges,
|
|
40
40
|
className: clsx(
|
|
41
|
-
"likec4-diagram",
|
|
42
41
|
cssReactFlow,
|
|
43
42
|
pannable !== true && cssDisablePan,
|
|
44
43
|
background === "transparent" && cssTransparentBg,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Color, DiagramNode, Fqn } from '@likec4/core';
|
|
1
|
+
import { Color, DiagramNode, Fqn, IconUrl } from '@likec4/core';
|
|
2
2
|
import { Base, NonOptional, ReactFlowEdge, ReactFlowNode } from '../types';
|
|
3
3
|
export declare namespace ExampleTypes {
|
|
4
|
-
type ElementNodeData = Base.NodeData<NonOptional<Pick<DiagramNode, 'title' | 'technology' | 'description' | 'color' | 'shape' | 'width' | 'height' | 'navigateTo'>> & {
|
|
4
|
+
type ElementNodeData = Base.NodeData<NonOptional<Pick<DiagramNode, 'title' | 'technology' | 'description' | 'color' | 'shape' | 'style' | 'width' | 'height' | 'navigateTo'>> & {
|
|
5
5
|
fqn: Fqn;
|
|
6
6
|
icon: string | null;
|
|
7
7
|
}>;
|
|
8
8
|
type CompoundNodeData = Base.NodeData<NonOptional<Pick<DiagramNode, 'title' | 'color' | 'shape' | 'style'>> & {
|
|
9
9
|
fqn: Fqn;
|
|
10
10
|
depth: number;
|
|
11
|
-
icon:
|
|
11
|
+
icon: IconUrl;
|
|
12
12
|
}>;
|
|
13
13
|
type ElementNode = ReactFlowNode<ElementNodeData, 'element'>;
|
|
14
14
|
type CompoundNode = ReactFlowNode<CompoundNodeData, 'compound'>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { NodeProps } from '..';
|
|
3
|
-
import { Color, ViewId, Fqn,
|
|
3
|
+
import { ElementStyle, Color, ViewId, Fqn, IconUrl } from '@likec4/core';
|
|
4
4
|
import { Position } from '@xyflow/system';
|
|
5
5
|
export declare const nodeTypes: {
|
|
6
6
|
element: NamedExoticComponent<NodeProps<{
|
|
7
|
+
style: ElementStyle;
|
|
7
8
|
title: string;
|
|
8
9
|
description: string | null;
|
|
9
10
|
width: number;
|
|
@@ -24,7 +25,7 @@ export declare const nodeTypes: {
|
|
|
24
25
|
color: Color;
|
|
25
26
|
fqn: Fqn;
|
|
26
27
|
depth: number;
|
|
27
|
-
icon:
|
|
28
|
+
icon: IconUrl;
|
|
28
29
|
hovered?: boolean;
|
|
29
30
|
dimmed?: import("..").Base.Dimmed;
|
|
30
31
|
}>>;
|
|
@@ -5,7 +5,7 @@ import clsx from "clsx";
|
|
|
5
5
|
import { m } from "framer-motion";
|
|
6
6
|
import { hiddenIfZoomTooSmall } from "../../../LikeC4Diagram.css.js";
|
|
7
7
|
import { stopPropagation } from "../../../utils/xyflow.js";
|
|
8
|
-
import {
|
|
8
|
+
import { actionIcon, actionButton, container } from "./CompoundActionButton.css.js";
|
|
9
9
|
function CompoundActionButton({
|
|
10
10
|
data: {
|
|
11
11
|
hovered: isHovered = false
|
|
@@ -5,7 +5,7 @@ import clsx from "clsx";
|
|
|
5
5
|
import { m } from "framer-motion";
|
|
6
6
|
import { hiddenIfZoomTooSmall } from "../../../LikeC4Diagram.css.js";
|
|
7
7
|
import { stopPropagation } from "../../../utils/xyflow.js";
|
|
8
|
-
import {
|
|
8
|
+
import { actionIcon, actionIconWrapper, container } from "./CompoundDetailsButton.css.js";
|
|
9
9
|
function CompoundDetailsButton({
|
|
10
10
|
data: {
|
|
11
11
|
hovered: isHovered = false
|
|
@@ -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 {
|
|
8
|
+
import { indicator, compoundBg, compoundBorder, varBorderTransparency, varCompoundOpacity, container } from "./CompoundNodeContainer.css.js";
|
|
9
9
|
const CompoundNodeContainer = createPolymorphicComponent(
|
|
10
10
|
forwardRef(({
|
|
11
11
|
nodeProps: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DiagramNode } from '@likec4/core';
|
|
2
2
|
import { NodeProps } from '../../types';
|
|
3
|
-
type Data = Pick<DiagramNode, 'color' | 'title'>;
|
|
3
|
+
type Data = Pick<DiagramNode, 'color' | 'title' | 'icon'>;
|
|
4
4
|
type CompoundTitleProps = NodeProps<Data>;
|
|
5
|
-
export declare function CompoundTitle({ data }: CompoundTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function CompoundTitle({ id, data }: CompoundTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "@mantine/core";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { icon, title, compoundTitle } from "./CompoundTitle.css.js";
|
|
5
|
+
import { IconRenderer } from "../../../context/IconRenderer.js";
|
|
6
|
+
function CompoundTitle({ id, data }) {
|
|
7
|
+
const elementIcon = IconRenderer({
|
|
8
|
+
element: {
|
|
9
|
+
id,
|
|
10
|
+
title: data.title,
|
|
11
|
+
icon: data.icon
|
|
12
|
+
},
|
|
13
|
+
className: icon
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsxs(
|
|
8
16
|
Box,
|
|
9
17
|
{
|
|
10
18
|
className: clsx(
|
|
11
19
|
compoundTitle,
|
|
12
20
|
"likec4-compound-title"
|
|
13
21
|
),
|
|
14
|
-
children:
|
|
22
|
+
children: [
|
|
23
|
+
elementIcon,
|
|
24
|
+
/* @__PURE__ */ jsx(Text, { className: title, truncate: "end", children: data.title })
|
|
25
|
+
]
|
|
15
26
|
}
|
|
16
27
|
);
|
|
17
28
|
}
|
|
@@ -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 {
|
|
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;
|
|
@@ -4,7 +4,7 @@ import clsx from "clsx";
|
|
|
4
4
|
import { m } from "framer-motion";
|
|
5
5
|
import { hiddenIfZoomTooSmall } from "../../../LikeC4Diagram.css.js";
|
|
6
6
|
import { stopPropagation } from "../../../utils/xyflow.js";
|
|
7
|
-
import {
|
|
7
|
+
import { actionIcon, actionButtons, container } from "./ElementActionButtons.css.js";
|
|
8
8
|
function ElementActionButtons({
|
|
9
9
|
id,
|
|
10
10
|
selected = false,
|
|
@@ -5,7 +5,7 @@ import clsx from "clsx";
|
|
|
5
5
|
import { m } from "framer-motion";
|
|
6
6
|
import { hiddenIfZoomTooSmall } from "../../../LikeC4Diagram.css.js";
|
|
7
7
|
import { stopPropagation } from "../../../utils/xyflow.js";
|
|
8
|
-
import {
|
|
8
|
+
import { actionIcon, actionIconWrapper, container } from "./ElementDetailsButton.css.js";
|
|
9
9
|
function ElementDetailsButton({
|
|
10
10
|
selected = false,
|
|
11
11
|
data: {
|
|
@@ -1,11 +1,16 @@
|
|
|
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';
|
|
5
|
-
type RequiredData = Pick<DiagramNode, 'color' | 'shape'>;
|
|
5
|
+
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,9 +1,33 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DefaultShapeSize, DefaultTextSize, DefaultPaddingSize } from "@likec4/core";
|
|
2
3
|
import { createPolymorphicComponent, Box } from "@mantine/core";
|
|
3
4
|
import clsx from "clsx";
|
|
4
5
|
import { m } from "framer-motion";
|
|
5
6
|
import { forwardRef } from "react";
|
|
6
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
|
+
}
|
|
7
31
|
const ElementNodeContainer = createPolymorphicComponent(
|
|
8
32
|
forwardRef(({
|
|
9
33
|
nodeProps: {
|
|
@@ -27,6 +51,11 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
27
51
|
scale = 1.02;
|
|
28
52
|
break;
|
|
29
53
|
}
|
|
54
|
+
const {
|
|
55
|
+
size,
|
|
56
|
+
padding,
|
|
57
|
+
textSize
|
|
58
|
+
} = nodeSizes(data.style);
|
|
30
59
|
return /* @__PURE__ */ jsx(
|
|
31
60
|
Box,
|
|
32
61
|
{
|
|
@@ -46,6 +75,9 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
46
75
|
"data-hovered": isHovered,
|
|
47
76
|
"data-likec4-color": data.color,
|
|
48
77
|
"data-likec4-shape": data.shape,
|
|
78
|
+
"data-likec4-shape-size": size,
|
|
79
|
+
"data-likec4-padding": padding,
|
|
80
|
+
"data-likec4-text-size": textSize,
|
|
49
81
|
"data-likec4-dimmed": isDimmed,
|
|
50
82
|
...rest,
|
|
51
83
|
children
|
|
@@ -55,5 +87,6 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
55
87
|
);
|
|
56
88
|
ElementNodeContainer.displayName = "ElementNodeContainer";
|
|
57
89
|
export {
|
|
58
|
-
ElementNodeContainer
|
|
90
|
+
ElementNodeContainer,
|
|
91
|
+
nodeSizes
|
|
59
92
|
};
|
|
@@ -3,7 +3,7 @@ import { nonexhaustive } from "@likec4/core";
|
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { hiddenIfZoomTooSmall } from "../../../LikeC4Diagram.css.js";
|
|
5
5
|
import { toDomPrecision } from "../../../utils/xyflow.js";
|
|
6
|
-
import { shapeSvgMultiple, shapeSvg,
|
|
6
|
+
import { shapeSvgMultiple, shapeSvg, fillMixStroke, fillElementFill, indicator } from "./ElementShape.css.js";
|
|
7
7
|
function cylinderSVGPath(diameter, height, tilt = 0.065) {
|
|
8
8
|
const radius = Math.round(diameter / 2);
|
|
9
9
|
const rx = radius;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const hasIcon: string;
|
|
2
|
-
export declare const iconSize: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
3
2
|
export declare const title: string;
|
|
4
3
|
export declare const description: string;
|
|
5
4
|
export declare const technology: string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
1
3
|
/* empty css */
|
|
2
4
|
var hasIcon = "fo05290";
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var elementIcon = "fo05298";
|
|
5
|
+
var title = "fo05292";
|
|
6
|
+
var description = "fo05293";
|
|
7
|
+
var technology = "fo05294";
|
|
8
|
+
var elementDataContainer = "fo05295";
|
|
9
|
+
var elementTextData = "fo05296";
|
|
10
|
+
var elementIcon = "fo05297";
|
|
10
11
|
export {
|
|
11
12
|
description,
|
|
12
13
|
elementDataContainer,
|
|
13
14
|
elementIcon,
|
|
14
15
|
elementTextData,
|
|
15
16
|
hasIcon,
|
|
16
|
-
iconSize,
|
|
17
17
|
technology,
|
|
18
18
|
title
|
|
19
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DiagramNode } from '@likec4/core';
|
|
2
2
|
import { NodeProps } from '../../types';
|
|
3
|
-
type Data = Pick<DiagramNode, 'title' | 'technology' | 'description' | 'color'> & {
|
|
3
|
+
type Data = Pick<DiagramNode, 'title' | 'technology' | 'description' | 'color' | 'style'> & {
|
|
4
4
|
icon?: string | null;
|
|
5
5
|
};
|
|
6
6
|
type ElementTitleProps = NodeProps<Data> & {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@likec4/core";
|
|
2
3
|
import { Box, Text } from "@mantine/core";
|
|
3
|
-
import { assignInlineVars } from "
|
|
4
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
4
5
|
import clsx from "clsx";
|
|
5
|
-
import {
|
|
6
|
+
import { isNumber, isTruthy } from "remeda";
|
|
6
7
|
import { IconRenderer } from "../../../context/IconRenderer.js";
|
|
7
8
|
import { hiddenIfZoomTooSmall } from "../../../LikeC4Diagram.css.js";
|
|
8
|
-
import {
|
|
9
|
+
import { nodeSizes } from "./ElementNodeContainer.js";
|
|
10
|
+
import { elementIcon, title, technology, description, elementTextData, elementDataContainer, hasIcon } from "./ElementTitle.css.js";
|
|
11
|
+
import { iconSize } from "./styles.css.js";
|
|
9
12
|
function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
10
13
|
const elementIcon$1 = IconRenderer({
|
|
11
14
|
element: {
|
|
@@ -15,6 +18,9 @@ function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
|
15
18
|
},
|
|
16
19
|
className: elementIcon
|
|
17
20
|
});
|
|
21
|
+
const size = nodeSizes(data.style).size;
|
|
22
|
+
const isSm = size === "sm";
|
|
23
|
+
const isSmOrXs = isSm || size === "xs";
|
|
18
24
|
return /* @__PURE__ */ jsxs(
|
|
19
25
|
Box,
|
|
20
26
|
{
|
|
@@ -36,7 +42,7 @@ function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
|
36
42
|
{
|
|
37
43
|
component: "h3",
|
|
38
44
|
className: clsx(title, "likec4-element-title"),
|
|
39
|
-
lineClamp: 3,
|
|
45
|
+
lineClamp: isSmOrXs ? 2 : 3,
|
|
40
46
|
children: data.title
|
|
41
47
|
}
|
|
42
48
|
),
|
|
@@ -53,7 +59,7 @@ function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
|
53
59
|
{
|
|
54
60
|
component: "div",
|
|
55
61
|
className: clsx(description, "likec4-element-description"),
|
|
56
|
-
lineClamp: 5,
|
|
62
|
+
lineClamp: isSmOrXs ? 3 : 5,
|
|
57
63
|
children: data.description
|
|
58
64
|
}
|
|
59
65
|
)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const textSize: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
2
|
+
export declare const paddingSize: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
3
|
+
export declare const iconSize: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useSyncedRef } from "@react-hookz/web";
|
|
3
3
|
import { createContext, useMemo, useContext } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { isFunction, mapToObj } from "remeda";
|
|
5
5
|
const HandlerNames = [
|
|
6
6
|
"onBurgerMenuClick",
|
|
7
7
|
"onNavigateTo",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCustomCompareEffect } from "@react-hookz/web";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext, createContext, useState } from "react";
|
|
4
4
|
import { mapToObj, pick, map } from "remeda";
|
|
5
5
|
import { depsShallowEqual } from "../hooks/useUpdateEffect.js";
|
|
6
6
|
const FeatureNames = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@mantine/core";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { createContext, createRef,
|
|
4
|
+
import { useRef, createContext, createRef, useContext } from "react";
|
|
5
5
|
import { rootClassName } from "../globals.css.js";
|
|
6
6
|
const RootContainerContext = createContext(createRef());
|
|
7
7
|
function RootContainer({
|
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';
|
|
@@ -2,9 +2,8 @@ import { EdgeId, Fqn, NodeId, ViewId, DiagramView, ViewChange, RelationId, Color
|
|
|
2
2
|
import { PartialDeep } from 'type-fest';
|
|
3
3
|
import { OpenSourceParams } from '../LikeC4Diagram.props';
|
|
4
4
|
import { AlignmentMode } from '../likec4diagram/state/aligners';
|
|
5
|
+
import { DiagramContext, Events, Input, ActionArg } from '../likec4diagram/state/machine';
|
|
5
6
|
import { Types } from '../likec4diagram/types';
|
|
6
|
-
import { DiagramContext } from './useDiagramContext';
|
|
7
|
-
import { Events, Input, ActionArg } from '../likec4diagram/state/machine';
|
|
8
7
|
import { MachineSnapshot, ActorRefFromLogic, CallbackActorLogic, AnyEventObject, NonReducibleUnknown, StateMachine, EventObject, MetaObject, AnyActorLogic, ConditionalRequired, InputFrom, RequiredLogicInput, IsNotNever, ActorRef, AnyActorRef, StateValue, ActionFunction, ActorLogic, RequiredActorOptions, GetConcreteByKey, Values, StopAction, CancelAction } from 'xstate';
|
|
9
8
|
import { HotKeyEvent } from '../likec4diagram/state/hotkeyActor';
|
|
10
9
|
import { Input, Events } from '../likec4diagram/state/syncManualLayoutActor';
|
package/dist/hooks/useXYFlow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallbackRef } from "@mantine/hooks";
|
|
2
|
-
import {
|
|
2
|
+
import { useStoreApi, useStore, useReactFlow, useInternalNode } from "@xyflow/react";
|
|
3
3
|
import { shallowEqual } from "fast-equals";
|
|
4
4
|
const useXYFlow = useReactFlow;
|
|
5
5
|
function useXYStore(selector, equalityFn) {
|
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,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const DiagramUI: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
1
|
+
export declare function DiagramUI(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from "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";
|
|
10
|
-
|
|
8
|
+
import { DynamicViewWalkthrough } from "./ui/walkthrough/DynamicViewWalkthrough.js";
|
|
9
|
+
function DiagramUI() {
|
|
11
10
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
11
|
/* @__PURE__ */ jsx(Controls, {}),
|
|
13
12
|
/* @__PURE__ */ jsx(Overlays, {}),
|
|
@@ -16,7 +15,7 @@ const DiagramUI = memo(() => {
|
|
|
16
15
|
/* @__PURE__ */ jsx(IfEnabled, { feature: "Notations", children: /* @__PURE__ */ jsx(NotationPanel, {}) }),
|
|
17
16
|
/* @__PURE__ */ jsx(IfEnabled, { feature: "DynamicViewWalkthrough", children: /* @__PURE__ */ jsx(DynamicViewWalkthrough, {}) })
|
|
18
17
|
] });
|
|
19
|
-
}
|
|
18
|
+
}
|
|
20
19
|
export {
|
|
21
20
|
DiagramUI
|
|
22
21
|
};
|
|
@@ -3,12 +3,12 @@ import { nonNullable } from "@likec4/core";
|
|
|
3
3
|
import { useCallbackRef } from "@mantine/hooks";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { shallowEqual } from "fast-equals";
|
|
6
|
+
import { BaseXYFlow } from "../base/BaseXYFlow.js";
|
|
6
7
|
import { useDiagram } from "../hooks/useDiagram.js";
|
|
7
8
|
import { useDiagramContext } from "../hooks/useDiagramContext.js";
|
|
8
9
|
import { edgeTypes } from "./custom/index.js";
|
|
9
10
|
import { useLayoutConstraints } from "./useLayoutConstraints.js";
|
|
10
11
|
import { useDiagramEventHandlers } from "../context/DiagramEventHandlers.js";
|
|
11
|
-
import { BaseXYFlow } from "../base/BaseXYFlow.js";
|
|
12
12
|
import { nodeTypes } from "./custom/nodes/nodeTypes.js";
|
|
13
13
|
const selectXYProps = (ctx) => ({
|
|
14
14
|
initialized: ctx.initialized,
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Popover, PopoverTarget, PopoverDropdown, Stack, ScrollAreaAutosize, Text, CloseButton, Group, Button } from "@mantine/core";
|
|
3
3
|
import { useDebouncedEffect } from "@react-hookz/web";
|
|
4
4
|
import { useState } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { isTruthy, isNonNull } from "remeda";
|
|
6
6
|
import { useDiagram } from "../../../hooks/useDiagram.js";
|
|
7
7
|
import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
|
|
8
8
|
import { edgeNoteText, edgeNoteCloseButton } from "./NotePopover.css.js";
|
|
@@ -8,7 +8,7 @@ import { isTruthy, first, last } from "remeda";
|
|
|
8
8
|
import { useDiagram } from "../../../hooks/useDiagram.js";
|
|
9
9
|
import { VectorImpl, vector } from "../../../utils/vector.js";
|
|
10
10
|
import { isSamePoint, bezierControlPoints, bezierPath } from "../../../utils/xyflow.js";
|
|
11
|
-
import {
|
|
11
|
+
import { controlPoint, controlDragging } from "./edges.css.js";
|
|
12
12
|
import { NotePopover } from "./NotePopover.js";
|
|
13
13
|
import { RelationshipsDropdownMenu } from "./RelationshipsDropdownMenu.js";
|
|
14
14
|
import { getNodeIntersectionFromCenterToPoint } from "./utils.js";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DiagramNode, nameFromFqn } from "@likec4/core";
|
|
3
|
-
import {
|
|
3
|
+
import { Menu, MenuTarget, MenuDropdown, MenuLabel, MenuDivider, Box, ActionIcon, MenuItem, Stack, Group, Text, TooltipGroup, Space, Tooltip as Tooltip$1 } from "@mantine/core";
|
|
4
4
|
import { IconInfoCircle, IconArrowRight, IconZoomScan, IconFileSymlink } from "@tabler/icons-react";
|
|
5
5
|
import clsx from "clsx";
|
|
6
|
-
import { useCallback,
|
|
6
|
+
import { useCallback, Fragment as Fragment$1, forwardRef } from "react";
|
|
7
7
|
import { pipe, map, filter, isTruthy, partition } from "remeda";
|
|
8
|
+
import { Link } from "../../../base/Link.js";
|
|
8
9
|
import { useDiagram } from "../../../hooks/useDiagram.js";
|
|
9
10
|
import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
|
|
10
|
-
import { menuDropdown, menuItemRelationship, endpoint, title } from "./RelationshipsDropdownMenu.css.js";
|
|
11
11
|
import { DiagramContext } from "../../state/machine.js";
|
|
12
|
+
import { menuDropdown, endpoint, title, menuItemRelationship } from "./RelationshipsDropdownMenu.css.js";
|
|
12
13
|
import { useLikeC4Model } from "../../../likec4model/useLikeC4Model.js";
|
|
13
14
|
import { useMantinePortalProps } from "../../../hooks/useMantinePortalProps.js";
|
|
14
15
|
import { useEnabledFeature, IfEnabled } from "../../../context/DiagramFeatures.js";
|
|
15
16
|
import { useDiagramEventHandlers } from "../../../context/DiagramEventHandlers.js";
|
|
16
|
-
import { Link } from "../../../base/Link.js";
|
|
17
17
|
const stopPropagation = (e) => e.stopPropagation();
|
|
18
18
|
const Tooltip = Tooltip$1.withProps({
|
|
19
19
|
color: "gray",
|
|
@@ -92,6 +92,7 @@ function RelationshipsDropdownMenu({
|
|
|
92
92
|
closeOnItemClick: false,
|
|
93
93
|
disabled,
|
|
94
94
|
position: "bottom-start",
|
|
95
|
+
middlewares: { size: { padding: 8 } },
|
|
95
96
|
...portalProps,
|
|
96
97
|
children: [
|
|
97
98
|
/* @__PURE__ */ jsx(MenuTarget, { children }),
|
|
@@ -2,18 +2,18 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "@likec4/core";
|
|
3
3
|
import { useDiagram } from "../../../hooks/useDiagram.js";
|
|
4
4
|
import { CompoundActions } from "./CompoundActions.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { DeploymentElementActions, ElementActions } from "./ElementActions.js";
|
|
6
|
+
import { CompoundDeploymentToolbar, CompoundElementToolbar } from "./toolbar/CompoundToolbar.js";
|
|
7
|
+
import { DeploymentElementToolbar, ElementToolbar } from "./toolbar/ElementToolbar.js";
|
|
8
8
|
import { customNode } from "../../../base/primitives/customNode.js";
|
|
9
|
-
import { ElementNodeContainer } from "../../../base/primitives/element/ElementNodeContainer.js";
|
|
10
|
-
import { ElementShape } from "../../../base/primitives/element/ElementShape.js";
|
|
11
|
-
import { ElementTitle } from "../../../base/primitives/element/ElementTitle.js";
|
|
12
|
-
import { IfNotEnabled, IfEnabled, useEnabledFeature } from "../../../context/DiagramFeatures.js";
|
|
13
|
-
import { DefaultHandles } from "../../../base/primitives/NodeHandles.js";
|
|
14
9
|
import { CompoundNodeContainer } from "../../../base/primitives/compound/CompoundNodeContainer.js";
|
|
15
10
|
import { CompoundTitle } from "../../../base/primitives/compound/CompoundTitle.js";
|
|
11
|
+
import { DefaultHandles } from "../../../base/primitives/NodeHandles.js";
|
|
12
|
+
import { IfNotEnabled, IfEnabled, useEnabledFeature } from "../../../context/DiagramFeatures.js";
|
|
16
13
|
import { CompoundDetailsButton } from "../../../base/primitives/compound/CompoundDetailsButton.js";
|
|
14
|
+
import { ElementNodeContainer } from "../../../base/primitives/element/ElementNodeContainer.js";
|
|
15
|
+
import { ElementShape } from "../../../base/primitives/element/ElementShape.js";
|
|
16
|
+
import { ElementTitle } from "../../../base/primitives/element/ElementTitle.js";
|
|
17
17
|
import { ElementDetailsButton } from "../../../base/primitives/element/ElementDetailsButton.js";
|
|
18
18
|
const ElementDetailsButtonWithHandler = ({ fqn, ...props }) => {
|
|
19
19
|
const { enableElementDetails } = useEnabledFeature("ElementDetails");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { invariant, defaultTheme } from "@likec4/core";
|
|
3
3
|
import { Tooltip as Tooltip$1, ActionIcon } from "@mantine/core";
|
|
4
4
|
import { useCallbackRef } from "@mantine/hooks";
|
|
5
|
-
import {
|
|
5
|
+
import { IconFileSymlink, IconTransform } from "@tabler/icons-react";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { keys } from "remeda";
|
|
8
8
|
import { useDiagram } from "../../../../hooks/useDiagram.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { nonNullable, invariant } from "@likec4/core";
|
|
2
2
|
import { getNodeDimensions } from "@xyflow/system";
|
|
3
3
|
import { deepEqual } from "fast-equals";
|
|
4
|
-
import {
|
|
4
|
+
import { isEmpty, mergeDeep, omit } from "remeda";
|
|
5
5
|
import { assertEvent } from "xstate";
|
|
6
6
|
import { VectorImpl, vector } from "../../utils/vector.js";
|
|
7
7
|
import { Base } from "../../base/types.js";
|