@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.
Files changed (105) hide show
  1. package/README.md +2 -2
  2. package/dist/base/BaseXYFlow.js +1 -2
  3. package/dist/base/example/_types.d.ts +3 -3
  4. package/dist/base/example/custom.d.ts +3 -2
  5. package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
  6. package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
  7. package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
  8. package/dist/base/primitives/compound/CompoundTitle.css.d.ts +1 -0
  9. package/dist/base/primitives/compound/CompoundTitle.css.js +2 -0
  10. package/dist/base/primitives/compound/CompoundTitle.d.ts +2 -2
  11. package/dist/base/primitives/compound/CompoundTitle.js +17 -6
  12. package/dist/base/primitives/edge/EdgeLabel.js +2 -2
  13. package/dist/base/primitives/element/ElementActionButtons.js +1 -1
  14. package/dist/base/primitives/element/ElementDetailsButton.js +1 -1
  15. package/dist/base/primitives/element/ElementNodeContainer.d.ts +7 -2
  16. package/dist/base/primitives/element/ElementNodeContainer.js +34 -1
  17. package/dist/base/primitives/element/ElementShape.js +1 -1
  18. package/dist/base/primitives/element/ElementTitle.css.d.ts +0 -1
  19. package/dist/base/primitives/element/ElementTitle.css.js +8 -8
  20. package/dist/base/primitives/element/ElementTitle.d.ts +1 -1
  21. package/dist/base/primitives/element/ElementTitle.js +11 -5
  22. package/dist/base/primitives/element/styles.css.d.ts +3 -0
  23. package/dist/base/primitives/element/styles.css.js +6 -0
  24. package/dist/context/DiagramEventHandlers.js +1 -1
  25. package/dist/context/DiagramFeatures.js +1 -1
  26. package/dist/context/RootContainer.js +1 -1
  27. package/dist/hooks/index.d.ts +0 -1
  28. package/dist/hooks/useDiagram.d.ts +1 -2
  29. package/dist/hooks/useXYFlow.js +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/likec4diagram/DiagramUI.d.ts +1 -2
  32. package/dist/likec4diagram/DiagramUI.js +3 -4
  33. package/dist/likec4diagram/XYFlow.js +1 -1
  34. package/dist/likec4diagram/custom/edges/NotePopover.js +1 -1
  35. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  36. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +5 -4
  37. package/dist/likec4diagram/custom/nodes/nodeTypes.js +8 -8
  38. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  39. package/dist/likec4diagram/state/assign.js +1 -1
  40. package/dist/likec4diagram/state/machine.js +5 -5
  41. package/dist/likec4diagram/types.d.ts +2 -2
  42. package/dist/likec4diagram/ui/controls/Controls.js +1 -1
  43. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +5 -4
  44. package/dist/likec4diagram/ui/index.d.ts +2 -0
  45. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +2 -2
  46. package/dist/likec4diagram/useViewToNodesEdges.js +1 -1
  47. package/dist/overlays/Overlays.js +43 -22
  48. package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -3
  49. package/dist/overlays/element-details/ElementDetailsCard.js +38 -39
  50. package/dist/overlays/element-details/TabPanelDeployments.js +5 -3
  51. package/dist/overlays/element-details/TabPanelRelationships.js +14 -30
  52. package/dist/overlays/overlay/Overlay.css.js +2 -1
  53. package/dist/overlays/overlay/Overlay.js +2 -2
  54. package/dist/overlays/relationship-details/SelectEdge.js +1 -1
  55. package/dist/overlays/relationship-details/_types.d.ts +3 -3
  56. package/dist/overlays/relationship-details/actor.js +1 -1
  57. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -3
  58. package/dist/overlays/relationship-details/custom/nodeTypes.js +2 -2
  59. package/dist/overlays/relationship-details/useLayoutedDetails.js +1 -4
  60. package/dist/overlays/relationships-browser/-useRelationshipsView.js +0 -3
  61. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
  62. package/dist/overlays/relationships-browser/_types.d.ts +3 -3
  63. package/dist/overlays/relationships-browser/actor.js +16 -16
  64. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +3 -2
  65. package/dist/overlays/relationships-browser/custom/nodeTypes.js +3 -3
  66. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +3 -2
  67. package/dist/style.css +1 -1
  68. package/package.json +14 -14
  69. package/src/base/BaseXYFlow.tsx +0 -1
  70. package/src/base/example/_types.ts +3 -2
  71. package/src/base/example/useViewToNodesEdges.ts +2 -1
  72. package/src/base/primitives/compound/CompoundTitle.css.ts +27 -1
  73. package/src/base/primitives/compound/CompoundTitle.tsx +12 -2
  74. package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -7
  75. package/src/base/primitives/element/ElementNodeContainer.tsx +41 -1
  76. package/src/base/primitives/element/ElementShape.css.ts +5 -0
  77. package/src/base/primitives/element/ElementTitle.css.ts +25 -29
  78. package/src/base/primitives/element/ElementTitle.tsx +10 -4
  79. package/src/base/primitives/element/styles.css.ts +52 -0
  80. package/src/globals.css.ts +2 -0
  81. package/src/hooks/index.ts +0 -1
  82. package/src/hooks/useDiagram.ts +1 -1
  83. package/src/index.ts +15 -1
  84. package/src/likec4diagram/DiagramUI.tsx +3 -6
  85. package/src/likec4diagram/XYFlow.tsx +2 -2
  86. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
  87. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +1 -0
  88. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +4 -2
  89. package/src/likec4diagram/types.ts +2 -2
  90. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +110 -107
  91. package/src/likec4diagram/ui/index.ts +2 -0
  92. package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -3
  93. package/src/likec4diagram/useViewToNodesEdges.ts +1 -1
  94. package/src/overlays/Overlays.tsx +62 -282
  95. package/src/overlays/element-details/ElementDetailsCard.tsx +214 -261
  96. package/src/overlays/element-details/TabPanelDeployments.tsx +4 -4
  97. package/src/overlays/element-details/TabPanelRelationships.tsx +13 -75
  98. package/src/overlays/overlay/Overlay.tsx +1 -1
  99. package/src/overlays/relationship-details/_types.ts +3 -3
  100. package/src/overlays/relationship-details/useLayoutedDetails.ts +1 -1
  101. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +44 -55
  102. package/src/overlays/relationships-browser/_types.ts +12 -2
  103. package/src/overlays/relationships-browser/actor.ts +11 -10
  104. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +2 -1
  105. 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/cloud)
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 [examples/diagrams-dev](../../examples/diagrams-dev/) workspace
16
+ Use [packages/likec4](../likec4/) workspace
@@ -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 { MaxZoom, MinZoom } from "./const.js";
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: string | null;
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, ElementStyle } from '@likec4/core';
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: string | null;
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 { container, actionButton, actionIcon } from "./CompoundActionButton.css.js";
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 { container, actionIconWrapper, actionIcon } from "./CompoundDetailsButton.css.js";
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 "../../../node_modules/@vanilla-extract/dynamic/dist/vanilla-extract-dynamic.esm.js";
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 { container, varCompoundOpacity, varBorderTransparency, indicator, compoundBg, compoundBorder } from "./CompoundNodeContainer.css.js";
8
+ import { indicator, compoundBg, compoundBorder, varBorderTransparency, varCompoundOpacity, container } from "./CompoundNodeContainer.css.js";
9
9
  const CompoundNodeContainer = createPolymorphicComponent(
10
10
  forwardRef(({
11
11
  nodeProps: {
@@ -1,2 +1,3 @@
1
1
  export declare const compoundTitle: string;
2
2
  export declare const title: string;
3
+ export declare const icon: string;
@@ -1,7 +1,9 @@
1
1
  /* empty css */
2
2
  var compoundTitle = "_1dn4as0";
3
3
  var title = "_1dn4as1";
4
+ var icon = "_1dn4as2";
4
5
  export {
5
6
  compoundTitle,
7
+ icon,
6
8
  title
7
9
  };
@@ -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 { compoundTitle, title } from "./CompoundTitle.css.js";
5
- function CompoundTitle({ data }) {
6
- data.hovered ?? false;
7
- return /* @__PURE__ */ jsx(
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: /* @__PURE__ */ jsx(Text, { className: title, truncate: "end", children: data.title })
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 "../../../node_modules/@vanilla-extract/dynamic/dist/vanilla-extract-dynamic.esm.js";
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 { edgeVars, edgeLabelContainer, dimmed, edgeLabel, stepEdgeNumber, secondColumn, edgeLabelText, edgeLabelTechnology, varTranslate } from "./EdgeLabel.css.js";
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 { container, actionButtons, actionIcon } from "./ElementActionButtons.css.js";
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 { container, actionIconWrapper, actionIcon } from "./ElementDetailsButton.css.js";
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, indicator, fillMixStroke, fillElementFill } from "./ElementShape.css.js";
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 iconSize = "var(--fo05292)";
4
- var title = "fo05293";
5
- var description = "fo05294";
6
- var technology = "fo05295";
7
- var elementDataContainer = "fo05296";
8
- var elementTextData = "fo05297";
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 "../../../node_modules/@vanilla-extract/dynamic/dist/vanilla-extract-dynamic.esm.js";
4
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
4
5
  import clsx from "clsx";
5
- import { isTruthy, isNumber } from "remeda";
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, elementDataContainer, hasIcon, elementTextData, title, technology, description, iconSize } from "./ElementTitle.css.js";
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})`;
@@ -0,0 +1,6 @@
1
+ /* empty css */
2
+ /* empty css */
3
+ var iconSize = "var(--v7x5jk2)";
4
+ export {
5
+ iconSize
6
+ };
@@ -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 { mapToObj, isFunction } from "remeda";
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 { createContext, useContext, useState } from "react";
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, useRef, useContext } from "react";
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({
@@ -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';
@@ -1,5 +1,5 @@
1
1
  import { useCallbackRef } from "@mantine/hooks";
2
- import { useStore, useStoreApi, useReactFlow, useInternalNode } from "@xyflow/react";
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 * from './LikeC4Diagram.props';
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
- import { MemoExoticComponent } from 'react';
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
- const DiagramUI = memo(() => {
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 { isNonNull, isTruthy } from "remeda";
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 { controlDragging, controlPoint } from "./edges.css.js";
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 { Tooltip as Tooltip$1, Menu, MenuTarget, MenuDropdown, MenuLabel, MenuDivider, Box, ActionIcon, Stack, Group, Text, TooltipGroup, Space, MenuItem } from "@mantine/core";
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, forwardRef, Fragment as Fragment$1 } from "react";
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 { ElementActions, DeploymentElementActions } from "./ElementActions.js";
6
- import { CompoundElementToolbar, CompoundDeploymentToolbar } from "./toolbar/CompoundToolbar.js";
7
- import { ElementToolbar, DeploymentElementToolbar } from "./toolbar/ElementToolbar.js";
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 { defaultTheme, invariant } from "@likec4/core";
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 { IconTransform, IconFileSymlink } from "@tabler/icons-react";
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 { omit, mergeDeep, isEmpty } from "remeda";
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";