@likec4/diagram 1.20.3 → 1.21.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/README.md +2 -2
- package/dist/base/BaseXYFlow.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/base/primitives/element/ElementNodeContainer.js +15 -0
- 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 +4 -2
- 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/useDiagram.d.ts +1 -2
- package/dist/hooks/useXYFlow.js +1 -1
- package/dist/likec4diagram/DiagramUI.d.ts +1 -2
- package/dist/likec4diagram/DiagramUI.js +3 -3
- 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 +4 -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 +1 -1
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +2 -2
- package/dist/likec4diagram/useViewToNodesEdges.js +1 -1
- package/dist/overlays/Overlays.js +42 -21
- 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 +1 -1
- 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 +12 -12
- 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.tsx +21 -1
- package/src/base/primitives/element/ElementShape.css.ts +5 -0
- package/src/base/primitives/element/ElementTitle.css.ts +17 -24
- package/src/base/primitives/element/ElementTitle.tsx +4 -2
- package/src/base/primitives/element/styles.css.ts +74 -0
- package/src/hooks/useDiagram.ts +1 -1
- package/src/likec4diagram/DiagramUI.tsx +2 -2
- package/src/likec4diagram/XYFlow.tsx +2 -2
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -2
- package/src/likec4diagram/types.ts +2 -2
- package/src/likec4diagram/useViewToNodesEdges.ts +1 -1
- package/src/overlays/Overlays.tsx +61 -281
- package/src/overlays/element-details/ElementDetailsCard.tsx +213 -257
- 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/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 = ({
|
|
@@ -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
|
|
@@ -5,7 +5,7 @@ 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, varCompoundOpacity, container, varBorderTransparency } 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
|
}
|
|
@@ -8,7 +8,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, edgeVars, edgeLabelContainer, dimmed, varTranslate } 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: {
|
|
@@ -2,7 +2,7 @@ import { DiagramNode } 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
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DefaultTextSize, DefaultPaddingSize, DefaultShapeSize } from "@likec4/core";
|
|
2
3
|
import { createPolymorphicComponent, Box } from "@mantine/core";
|
|
3
4
|
import clsx from "clsx";
|
|
4
5
|
import { m } from "framer-motion";
|
|
@@ -27,6 +28,17 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
27
28
|
scale = 1.02;
|
|
28
29
|
break;
|
|
29
30
|
}
|
|
31
|
+
let {
|
|
32
|
+
size,
|
|
33
|
+
padding,
|
|
34
|
+
textSize
|
|
35
|
+
} = data.style;
|
|
36
|
+
if (!size && !!textSize) {
|
|
37
|
+
size = textSize;
|
|
38
|
+
}
|
|
39
|
+
if (!textSize && !!size) {
|
|
40
|
+
textSize = size;
|
|
41
|
+
}
|
|
30
42
|
return /* @__PURE__ */ jsx(
|
|
31
43
|
Box,
|
|
32
44
|
{
|
|
@@ -46,6 +58,9 @@ const ElementNodeContainer = createPolymorphicComponent(
|
|
|
46
58
|
"data-hovered": isHovered,
|
|
47
59
|
"data-likec4-color": data.color,
|
|
48
60
|
"data-likec4-shape": data.shape,
|
|
61
|
+
"data-likec4-shape-size": size ?? DefaultShapeSize,
|
|
62
|
+
"data-likec4-padding": padding ?? DefaultPaddingSize,
|
|
63
|
+
"data-likec4-text-size": textSize ?? DefaultTextSize,
|
|
49
64
|
"data-likec4-dimmed": isDimmed,
|
|
50
65
|
...rest,
|
|
51
66
|
children
|
|
@@ -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,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@likec4/core";
|
|
2
3
|
import { Box, Text } from "@mantine/core";
|
|
3
4
|
import { assignInlineVars } from "../../../node_modules/@vanilla-extract/dynamic/dist/vanilla-extract-dynamic.esm.js";
|
|
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 { elementIcon,
|
|
9
|
+
import { elementIcon, title, technology, description, elementTextData, elementDataContainer, hasIcon } from "./ElementTitle.css.js";
|
|
10
|
+
import { iconSize } from "./styles.css.js";
|
|
9
11
|
function ElementTitle({ id, data, iconSize: iconSize$1 }) {
|
|
10
12
|
const elementIcon$1 = IconRenderer({
|
|
11
13
|
element: {
|
|
@@ -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({
|
|
@@ -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) {
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import "react";
|
|
3
3
|
import { LikeC4Search } from "../LikeC4Search.js";
|
|
4
4
|
import { Overlays } from "../overlays/Overlays.js";
|
|
5
5
|
import { DynamicViewWalkthrough } from "./ui/walkthrough/DynamicViewWalkthrough.js";
|
|
@@ -7,7 +7,7 @@ import { Controls } from "./ui/controls/Controls.js";
|
|
|
7
7
|
import { IfEnabled } from "../context/DiagramFeatures.js";
|
|
8
8
|
import { DiagramTitlePanel } from "./ui/diagram-title/DiagramTitlePanel.js";
|
|
9
9
|
import { NotationPanel } from "./ui/notation/NotationPanel.js";
|
|
10
|
-
|
|
10
|
+
function DiagramUI() {
|
|
11
11
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
12
|
/* @__PURE__ */ jsx(Controls, {}),
|
|
13
13
|
/* @__PURE__ */ jsx(Overlays, {}),
|
|
@@ -16,7 +16,7 @@ const DiagramUI = memo(() => {
|
|
|
16
16
|
/* @__PURE__ */ jsx(IfEnabled, { feature: "Notations", children: /* @__PURE__ */ jsx(NotationPanel, {}) }),
|
|
17
17
|
/* @__PURE__ */ jsx(IfEnabled, { feature: "DynamicViewWalkthrough", children: /* @__PURE__ */ jsx(DynamicViewWalkthrough, {}) })
|
|
18
18
|
] });
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
export {
|
|
21
21
|
DiagramUI
|
|
22
22
|
};
|
|
@@ -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",
|
|
@@ -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";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getViewportForBounds,
|
|
1
|
+
import { nonNullable, invariant, nonexhaustive, getBBoxCenter, getParallelStepsPrefix, DiagramNode } from "@likec4/core";
|
|
2
|
+
import { getViewportForBounds, applyEdgeChanges, applyNodeChanges } from "@xyflow/react";
|
|
3
3
|
import { nodeToRect } from "@xyflow/system";
|
|
4
|
-
import { hasAtLeast,
|
|
5
|
-
import { setup, assertEvent,
|
|
4
|
+
import { hasAtLeast, prop, clamp, first } from "remeda";
|
|
5
|
+
import { setup, assertEvent, stopChild, assign, cancel, raise, enqueueActions, spawnChild, sendTo, and, or } from "xstate";
|
|
6
6
|
import { MinZoom } from "../../base/const.js";
|
|
7
7
|
import { AllDisabled } from "../../context/DiagramFeatures.js";
|
|
8
8
|
import { relationshipDetailsActor } from "../../overlays/relationship-details/actor.js";
|
|
9
9
|
import { relationshipsBrowserActor } from "../../overlays/relationships-browser/actor.js";
|
|
10
10
|
import { createLayoutConstraints } from "../useLayoutConstraints.js";
|
|
11
11
|
import { getAligner, toNodeRect } from "./aligners.js";
|
|
12
|
-
import {
|
|
12
|
+
import { resetEdgeControlPoints, updateEdgeData, updateNodeData, updateNavigationHistory, mergeXYNodesEdges, navigateForward, navigateBack, unfocusNodesEdges, updateActiveWalkthrough, focusNodesEdges, lastClickedNode } from "./assign.js";
|
|
13
13
|
import { hotkeyActor } from "./hotkeyActor.js";
|
|
14
14
|
import { syncManualLayoutActor } from "./syncManualLayoutActor.js";
|
|
15
15
|
import { focusedBounds } from "./utils.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiagramEdge, DiagramNode, Fqn, ViewId } from '@likec4/core';
|
|
1
|
+
import { DiagramEdge, DiagramNode, Fqn, IconUrl, ViewId } from '@likec4/core';
|
|
2
2
|
import { XYPosition } from '@xyflow/system';
|
|
3
3
|
import { OptionalKeysOf, Simplify } from 'type-fest';
|
|
4
4
|
import { Base } from '../base';
|
|
@@ -34,7 +34,7 @@ export declare namespace Types {
|
|
|
34
34
|
};
|
|
35
35
|
type CompoundNodeData = Base.NodeData<NonOptional<Pick<DiagramNode, 'id' | 'title' | 'color' | 'shape' | 'style' | 'position'>> & {
|
|
36
36
|
depth: number;
|
|
37
|
-
icon
|
|
37
|
+
icon?: IconUrl;
|
|
38
38
|
}>;
|
|
39
39
|
type CompoundElementNodeData = CompoundNodeData & {
|
|
40
40
|
modelFqn: Fqn;
|
|
@@ -12,7 +12,7 @@ import { ChangeAutoLayoutButton } from "./ChangeAutoLayoutButton.js";
|
|
|
12
12
|
import { LayoutDriftNotification } from "./LayoutDriftNotification.js";
|
|
13
13
|
import { ManualLayoutToolsButton } from "./ManualLayoutToolsButton.js";
|
|
14
14
|
import { NavigationButtons } from "./NavigationButtons.js";
|
|
15
|
-
import {
|
|
15
|
+
import { actionIconGroup, panel } from "./styles.css.js";
|
|
16
16
|
import { useDiagramEventHandlers } from "../../../context/DiagramEventHandlers.js";
|
|
17
17
|
import { useEnabledFeatures } from "../../../context/DiagramFeatures.js";
|
|
18
18
|
import { useMantinePortalProps } from "../../../hooks/useMantinePortalProps.js";
|
|
@@ -5,7 +5,7 @@ import { IconMenu } from "@tabler/icons-react";
|
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import { AnimatePresence, m } from "framer-motion";
|
|
7
7
|
import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
|
|
8
|
-
import {
|
|
8
|
+
import { card, title, description, container } from "./DiagramTitlePanel.css.js";
|
|
9
9
|
import { Link } from "../../../base/Link.js";
|
|
10
10
|
const selector = (s) => ({
|
|
11
11
|
id: s.view.id,
|
|
@@ -3,10 +3,10 @@ import { Box, Button, Badge, ButtonGroup } from "@mantine/core";
|
|
|
3
3
|
import { IconPlayerPlayFilled, IconPlayerSkipBackFilled, IconPlayerStopFilled, IconPlayerSkipForwardFilled } from "@tabler/icons-react";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { AnimatePresence, m } from "framer-motion";
|
|
6
|
-
import {
|
|
6
|
+
import { isTruthy, isNonNull } from "remeda";
|
|
7
7
|
import { useDiagram } from "../../../hooks/useDiagram.js";
|
|
8
8
|
import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
|
|
9
|
-
import { parallelStateFrame,
|
|
9
|
+
import { parallelStateFrame, btn, buttons, container } from "./DynamicViewWalkthrough.css.js";
|
|
10
10
|
import { useXYStore } from "../../../hooks/useXYFlow.js";
|
|
11
11
|
function DynamicViewWalkthrough() {
|
|
12
12
|
const isMobile = useXYStore((s) => s.width <= 750);
|