@likec4/diagram 1.9.0 → 1.12.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 (113) hide show
  1. package/package.json +20 -43
  2. package/src/LikeC4CustomColors.tsx +5 -2
  3. package/src/LikeC4Diagram.css.ts +1 -1
  4. package/src/LikeC4Diagram.props.ts +40 -94
  5. package/src/LikeC4Diagram.tsx +14 -4
  6. package/src/LikeC4ModelProvider.tsx +21 -0
  7. package/src/StaticLikeC4Diagram.tsx +1 -0
  8. package/src/globals.css.ts +2 -3
  9. package/src/hooks/index.ts +1 -0
  10. package/src/hooks/useMantinePortalProps.ts +8 -0
  11. package/src/hooks/useXYFlow.ts +1 -2
  12. package/src/index.ts +9 -0
  13. package/src/likec4model/LikeC4ModelContext.ts +4 -0
  14. package/src/likec4model/index.ts +1 -0
  15. package/src/likec4model/useLikeC4Model.ts +58 -0
  16. package/src/state/diagram-to-xyflow.ts +1 -2
  17. package/src/state/diagramStore.ts +185 -66
  18. package/src/{theme.css.ts → theme-vars.ts} +11 -4
  19. package/src/ui/DiagramTitlePanel.css.ts +2 -3
  20. package/src/ui/DiagramTitlePanel.tsx +25 -3
  21. package/src/ui/DynamicViewWalkthrough.css.ts +28 -2
  22. package/src/ui/DynamicViewWalkthrough.tsx +97 -52
  23. package/src/ui/OptionsPanel.css.ts +1 -2
  24. package/src/ui/OptionsPanel.tsx +5 -2
  25. package/src/ui/notation/NotationPanel.css.ts +2 -3
  26. package/src/ui/notation/NotationPanel.tsx +10 -11
  27. package/src/ui/options/NodeOptions.tsx +4 -1
  28. package/src/ui/top-left/ChangeAutoLayoutButton.tsx +122 -71
  29. package/src/ui/top-left/TopLeftPanel.tsx +128 -117
  30. package/src/ui/top-left/_shared.ts +7 -6
  31. package/src/ui/top-left/styles.css.ts +48 -8
  32. package/src/utils/vector.ts +57 -0
  33. package/src/xyflow/FitviewOnDiagramChange.tsx +5 -4
  34. package/src/xyflow/SelectEdgesOnNodeFocus.tsx +7 -5
  35. package/src/xyflow/XYFlow.tsx +13 -17
  36. package/src/xyflow/XYFlowEvents.tsx +58 -58
  37. package/src/xyflow/XYFlowInner.tsx +4 -8
  38. package/src/xyflow/edges/EdgeLabel.tsx +185 -0
  39. package/src/xyflow/edges/RelationshipEdge.tsx +170 -137
  40. package/src/xyflow/edges/RelationshipsDropdownMenu.css.ts +60 -0
  41. package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +214 -0
  42. package/src/xyflow/edges/edges.css.ts +75 -7
  43. package/src/xyflow/nodes/compound/CompoundNode.css.ts +1 -2
  44. package/src/xyflow/nodes/compound/CompoundNode.tsx +25 -8
  45. package/src/xyflow/nodes/element/ElementLink.css.ts +1 -1
  46. package/src/xyflow/nodes/element/ElementLink.tsx +4 -8
  47. package/src/xyflow/nodes/element/ElementNode.tsx +47 -8
  48. package/src/xyflow/nodes/element/element.css.ts +1 -2
  49. package/src/xyflow/nodes/shared/Toolbar.tsx +426 -0
  50. package/src/xyflow/types.ts +1 -24
  51. package/src/xyflow/useLayoutConstraints.ts +10 -6
  52. package/dist/LikeC4CustomColors.d.ts +0 -3
  53. package/dist/LikeC4CustomColors.props.d.ts +0 -5
  54. package/dist/LikeC4Diagram.css.d.ts +0 -4
  55. package/dist/LikeC4Diagram.d.ts +0 -7
  56. package/dist/LikeC4Diagram.props.d.ts +0 -154
  57. package/dist/StaticLikeC4Diagram.d.ts +0 -4
  58. package/dist/globals.css.d.ts +0 -1
  59. package/dist/hooks/index.d.ts +0 -4
  60. package/dist/hooks/useDiagramState.d.ts +0 -6
  61. package/dist/hooks/useSetState.d.ts +0 -3
  62. package/dist/hooks/useUpdateEffect.d.ts +0 -5
  63. package/dist/hooks/useXYFlow.d.ts +0 -267
  64. package/dist/index.d.ts +0 -9
  65. package/dist/index.mjs +0 -3684
  66. package/dist/mantine/EnsureMantine.d.ts +0 -8
  67. package/dist/mantine.css.d.ts +0 -3
  68. package/dist/state/DiagramContext.d.ts +0 -1192
  69. package/dist/state/diagram-to-xyflow.d.ts +0 -12
  70. package/dist/state/diagramStore.d.ts +0 -1268
  71. package/dist/style.css +0 -2139
  72. package/dist/theme.css.d.ts +0 -63
  73. package/dist/ui/DiagramTitlePanel.css.d.ts +0 -4
  74. package/dist/ui/DiagramTitlePanel.d.ts +0 -1
  75. package/dist/ui/DynamicViewWalkthrough.css.d.ts +0 -3
  76. package/dist/ui/DynamicViewWalkthrough.d.ts +0 -1
  77. package/dist/ui/OptionsPanel.css.d.ts +0 -1
  78. package/dist/ui/OptionsPanel.d.ts +0 -1
  79. package/dist/ui/notation/NotationPanel.css.d.ts +0 -6
  80. package/dist/ui/notation/NotationPanel.d.ts +0 -1
  81. package/dist/ui/notation/index.d.ts +0 -1
  82. package/dist/ui/options/EdgeOptions.d.ts +0 -19
  83. package/dist/ui/options/NodeOptions.d.ts +0 -19
  84. package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +0 -3
  85. package/dist/ui/top-left/TopLeftPanel.d.ts +0 -4
  86. package/dist/ui/top-left/_shared.d.ts +0 -5
  87. package/dist/ui/top-left/styles.css.d.ts +0 -3
  88. package/dist/xyflow/EdgeMarkers.d.ts +0 -12
  89. package/dist/xyflow/FitviewOnDiagramChange.d.ts +0 -4
  90. package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +0 -1
  91. package/dist/xyflow/XYFlow.d.ts +0 -12
  92. package/dist/xyflow/XYFlowBackground.d.ts +0 -11
  93. package/dist/xyflow/XYFlowEvents.d.ts +0 -161
  94. package/dist/xyflow/XYFlowInner.d.ts +0 -10
  95. package/dist/xyflow/const.d.ts +0 -7
  96. package/dist/xyflow/edges/RelationshipEdge.d.ts +0 -32
  97. package/dist/xyflow/edges/edges.css.d.ts +0 -12
  98. package/dist/xyflow/edges/utils.d.ts +0 -17
  99. package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +0 -11
  100. package/dist/xyflow/nodes/compound/CompoundNode.d.ts +0 -6
  101. package/dist/xyflow/nodes/compound/index.d.ts +0 -1
  102. package/dist/xyflow/nodes/element/ElementLink.css.d.ts +0 -3
  103. package/dist/xyflow/nodes/element/ElementLink.d.ts +0 -7
  104. package/dist/xyflow/nodes/element/ElementNode.d.ts +0 -6
  105. package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +0 -18
  106. package/dist/xyflow/nodes/element/element.css.d.ts +0 -19
  107. package/dist/xyflow/nodes/element/index.d.ts +0 -1
  108. package/dist/xyflow/nodes/shared/NavigateToBtn.d.ts +0 -5
  109. package/dist/xyflow/types.d.ts +0 -50
  110. package/dist/xyflow/useLayoutConstraints.d.ts +0 -9
  111. package/dist/xyflow/utils.d.ts +0 -18
  112. package/src/mantine.css.ts +0 -7
  113. package/src/reset.d.ts +0 -2
@@ -1,63 +0,0 @@
1
- export declare const vars: {
2
- safariAnimationHook: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
3
- default: {
4
- font: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
5
- };
6
- likec4: {
7
- font: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
8
- background: {
9
- color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
10
- pattern: {
11
- color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
12
- };
13
- };
14
- };
15
- compound: {
16
- font: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
17
- titleColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
18
- };
19
- element: {
20
- font: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
21
- fill: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
22
- stroke: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
23
- hiContrast: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
24
- loContrast: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
25
- };
26
- relation: {
27
- lineColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
28
- labelColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
29
- labelBgColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
30
- };
31
- optionsPanel: {
32
- top: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
33
- right: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
34
- };
35
- navigationPanel: {
36
- top: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
37
- left: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
38
- };
39
- };
40
- export declare const xyvars: {
41
- background: {
42
- color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
43
- pattern: {
44
- color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
45
- };
46
- };
47
- edge: {
48
- stroke: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
49
- strokeSelected: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
50
- labelColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
51
- labelBgColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
52
- strokeWidth: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
53
- };
54
- node: {
55
- color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
56
- border: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
57
- backgroundColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
58
- groupBackgroundColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
59
- boxshadowHover: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
60
- boxshadowSelected: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
61
- borderRadius: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
62
- };
63
- };
@@ -1,4 +0,0 @@
1
- export declare const container: string;
2
- export declare const card: string;
3
- export declare const title: string;
4
- export declare const description: string;
@@ -1 +0,0 @@
1
- export default function DiagramTitlePanel(): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +0,0 @@
1
- export declare const container: string;
2
- export declare const buttons: string;
3
- export declare const btn: string;
@@ -1 +0,0 @@
1
- export declare function DynamicViewWalkthrough(): import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export declare const panel: string;
@@ -1 +0,0 @@
1
- export default function OptionsPanel(): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- export declare const container: string;
2
- export declare const card: string;
3
- export declare const tabPanel: string;
4
- export declare const elementNotation: string;
5
- export declare const shapeSvg: string;
6
- export declare const shapeBadge: string;
@@ -1 +0,0 @@
1
- export declare function NotationPanel(): import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export { NotationPanel as default } from './NotationPanel';
@@ -1,19 +0,0 @@
1
- export declare const themedColors: ({
2
- key: "primary";
3
- value: "#3b82f6";
4
- } | {
5
- key: "secondary";
6
- value: "#0284c7";
7
- } | {
8
- key: "muted";
9
- value: "#64748b";
10
- })[];
11
- export declare const colors: {
12
- key: "amber" | "blue" | "gray" | "slate" | "green" | "indigo" | "red" | "sky";
13
- value: "#3b82f6" | "#0284c7" | "#64748b" | "#737373" | "#AC4D39" | "#428a4f" | "#A35829" | "#6366f1";
14
- }[];
15
- export type ThemeColorKey = typeof themedColors[0]['key'];
16
- export type ColorKey = typeof colors[0]['key'];
17
- export declare const EdgeOptions: import('react').NamedExoticComponent<{
18
- selectedEdgeIds: string[];
19
- }>;
@@ -1,19 +0,0 @@
1
- export declare const themedColors: ({
2
- key: "primary";
3
- value: "#3b82f6";
4
- } | {
5
- key: "secondary";
6
- value: "#0284c7";
7
- } | {
8
- key: "muted";
9
- value: "#64748b";
10
- })[];
11
- export declare const colors: {
12
- key: "amber" | "blue" | "gray" | "slate" | "green" | "indigo" | "red" | "sky";
13
- value: "#3b82f6" | "#0284c7" | "#64748b" | "#737373" | "#AC4D39" | "#428a4f" | "#A35829" | "#6366f1";
14
- }[];
15
- export type ThemeColorKey = typeof themedColors[0]['key'];
16
- export type ColorKey = typeof colors[0]['key'];
17
- export declare const NodeOptions: import('react').NamedExoticComponent<{
18
- selectedNodeIds: string[];
19
- }>;
@@ -1,3 +0,0 @@
1
- import { PopoverProps } from '@mantine/core';
2
-
3
- export declare const ChangeAutoLayoutButton: (props: PopoverProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- export declare const TopLeftPanel: {
2
- (): import("react/jsx-runtime").JSX.Element;
3
- displayName: string;
4
- };
@@ -1,5 +0,0 @@
1
- export declare const Tooltip: import('react').ForwardRefExoticComponent<import('@mantine/core').TooltipProps & import('react').RefAttributes<HTMLDivElement> & {
2
- component?: any;
3
- renderRoot?: (props: Record<string, any>) => React.ReactNode;
4
- }>;
5
- export declare const ActionIcon: <L = "button">(props: import('@mantine/core').PolymorphicComponentProps<L, import('@mantine/core').ActionIconProps>) => React.ReactElement;
@@ -1,3 +0,0 @@
1
- export declare const panel: string;
2
- export declare const autolayoutIcon: string;
3
- export declare const autolayoutIndicator: string;
@@ -1,12 +0,0 @@
1
- import { SVGProps } from 'react';
2
-
3
- export declare const EdgeMarkers: {
4
- Arrow: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
5
- OArrow: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
6
- Open: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
7
- Diamond: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
8
- ODiamond: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
9
- Dot: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
10
- ODot: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
11
- };
12
- export type EdgeMarkerType = keyof typeof EdgeMarkers;
@@ -1,4 +0,0 @@
1
- /**
2
- * Fits the view when diagram changes
3
- */
4
- export declare function FitViewOnDiagramChange(): import("react/jsx-runtime").JSX.Element | null;
@@ -1 +0,0 @@
1
- export declare function SelectEdgesOnNodeFocus(): null;
@@ -1,12 +0,0 @@
1
- import { CSSProperties, PropsWithChildren } from 'react';
2
-
3
- type XYFlowWrapperProps = PropsWithChildren<{
4
- colorMode?: 'system' | 'light' | 'dark';
5
- className?: string | undefined;
6
- style?: CSSProperties | undefined;
7
- }>;
8
- export declare function XYFlow({ colorMode, className, children, style }: XYFlowWrapperProps): import("react/jsx-runtime").JSX.Element;
9
- export declare namespace XYFlow {
10
- var displayName: string;
11
- }
12
- export {};
@@ -1,11 +0,0 @@
1
- import { BackgroundProps } from '@xyflow/react';
2
- import { OverrideProperties } from 'type-fest';
3
-
4
- export type XYBackgroundVariant = 'dots' | 'lines' | 'cross';
5
- export type XYBackground = XYBackgroundVariant | OverrideProperties<BackgroundProps, {
6
- variant: XYBackgroundVariant;
7
- }>;
8
- export type XYBackgroundProps = {
9
- background: XYBackground;
10
- };
11
- export declare function XYFlowBackground({ background }: XYBackgroundProps): import("react/jsx-runtime").JSX.Element;
@@ -1,161 +0,0 @@
1
- import { ReactFlowProps } from '@xyflow/react';
2
- import { Simplify } from 'type-fest';
3
- import { XYFlowEdge, XYFlowNode } from './types';
4
-
5
- export type XYFlowEventHandlers = Simplify<Required<Pick<ReactFlowProps<XYFlowNode, XYFlowEdge>, 'onDoubleClick' | 'onPaneClick' | 'onNodeClick' | 'onNodeDoubleClick' | 'onEdgeClick' | 'onEdgeDoubleClick' | 'onMoveEnd' | 'onNodeContextMenu' | 'onEdgeContextMenu' | 'onPaneContextMenu' | 'onNodeMouseEnter' | 'onNodeMouseLeave' | 'onEdgeMouseEnter' | 'onEdgeMouseLeave'>>>;
6
- export declare function useXYFlowEvents(): {
7
- onDoubleClick: (event: import('react').MouseEvent<HTMLDivElement, MouseEvent>) => void;
8
- onPaneClick: (event: import('react').MouseEvent<Element, MouseEvent>) => void;
9
- onNodeContextMenu: (event: import('react').MouseEvent<Element, MouseEvent>, xynode: XYFlowNode) => void;
10
- onPaneContextMenu: (event: MouseEvent | import('react').MouseEvent<Element, MouseEvent>) => void;
11
- onEdgeContextMenu: (event: import('react').MouseEvent<Element, MouseEvent>, xyedge: {
12
- id: string;
13
- type: "relationship";
14
- source: string;
15
- target: string;
16
- sourceHandle?: string | null;
17
- targetHandle?: string | null;
18
- animated?: boolean;
19
- hidden?: boolean;
20
- deletable?: boolean;
21
- selectable?: boolean;
22
- data: import('./types').RelationshipData;
23
- selected?: boolean;
24
- markerStart?: import('@xyflow/react').EdgeMarkerType;
25
- markerEnd?: import('@xyflow/react').EdgeMarkerType;
26
- zIndex?: number;
27
- ariaLabel?: string;
28
- interactionWidth?: number;
29
- label?: string | import('react').ReactNode;
30
- labelStyle?: import('react').CSSProperties;
31
- labelShowBg?: boolean;
32
- labelBgStyle?: import('react').CSSProperties;
33
- labelBgPadding?: [number, number];
34
- labelBgBorderRadius?: number;
35
- style?: import('react').CSSProperties;
36
- className?: string;
37
- reconnectable?: boolean | import('@xyflow/react').HandleType;
38
- focusable?: boolean;
39
- }) => void;
40
- onNodeClick: (event: import('react').MouseEvent<Element, MouseEvent>, xynode: XYFlowNode) => void;
41
- onNodeDoubleClick: (event: import('react').MouseEvent<Element, MouseEvent>, xynode: XYFlowNode) => void;
42
- onEdgeClick: (event: import('react').MouseEvent<Element, MouseEvent>, xyedge: {
43
- id: string;
44
- type: "relationship";
45
- source: string;
46
- target: string;
47
- sourceHandle?: string | null;
48
- targetHandle?: string | null;
49
- animated?: boolean;
50
- hidden?: boolean;
51
- deletable?: boolean;
52
- selectable?: boolean;
53
- data: import('./types').RelationshipData;
54
- selected?: boolean;
55
- markerStart?: import('@xyflow/react').EdgeMarkerType;
56
- markerEnd?: import('@xyflow/react').EdgeMarkerType;
57
- zIndex?: number;
58
- ariaLabel?: string;
59
- interactionWidth?: number;
60
- label?: string | import('react').ReactNode;
61
- labelStyle?: import('react').CSSProperties;
62
- labelShowBg?: boolean;
63
- labelBgStyle?: import('react').CSSProperties;
64
- labelBgPadding?: [number, number];
65
- labelBgBorderRadius?: number;
66
- style?: import('react').CSSProperties;
67
- className?: string;
68
- reconnectable?: boolean | import('@xyflow/react').HandleType;
69
- focusable?: boolean;
70
- }) => void;
71
- onEdgeDoubleClick: (event: import('react').MouseEvent<Element, MouseEvent>, xyedge: {
72
- id: string;
73
- type: "relationship";
74
- source: string;
75
- target: string;
76
- sourceHandle?: string | null;
77
- targetHandle?: string | null;
78
- animated?: boolean;
79
- hidden?: boolean;
80
- deletable?: boolean;
81
- selectable?: boolean;
82
- data: import('./types').RelationshipData;
83
- selected?: boolean;
84
- markerStart?: import('@xyflow/react').EdgeMarkerType;
85
- markerEnd?: import('@xyflow/react').EdgeMarkerType;
86
- zIndex?: number;
87
- ariaLabel?: string;
88
- interactionWidth?: number;
89
- label?: string | import('react').ReactNode;
90
- labelStyle?: import('react').CSSProperties;
91
- labelShowBg?: boolean;
92
- labelBgStyle?: import('react').CSSProperties;
93
- labelBgPadding?: [number, number];
94
- labelBgBorderRadius?: number;
95
- style?: import('react').CSSProperties;
96
- className?: string;
97
- reconnectable?: boolean | import('@xyflow/react').HandleType;
98
- focusable?: boolean;
99
- }) => void;
100
- onMoveEnd: (event: MouseEvent | TouchEvent | null, _viewport: import('@xyflow/react').Viewport) => void;
101
- onNodeMouseEnter: (_event: import('react').MouseEvent<Element, MouseEvent>, xynode: XYFlowNode) => void;
102
- onNodeMouseLeave: (_event: import('react').MouseEvent<Element, MouseEvent>, xynode: XYFlowNode) => void;
103
- onEdgeMouseEnter: (_event: import('react').MouseEvent<Element, MouseEvent>, { id, source, target }: {
104
- id: string;
105
- type: "relationship";
106
- source: string;
107
- target: string;
108
- sourceHandle?: string | null;
109
- targetHandle?: string | null;
110
- animated?: boolean;
111
- hidden?: boolean;
112
- deletable?: boolean;
113
- selectable?: boolean;
114
- data: import('./types').RelationshipData;
115
- selected?: boolean;
116
- markerStart?: import('@xyflow/react').EdgeMarkerType;
117
- markerEnd?: import('@xyflow/react').EdgeMarkerType;
118
- zIndex?: number;
119
- ariaLabel?: string;
120
- interactionWidth?: number;
121
- label?: string | import('react').ReactNode;
122
- labelStyle?: import('react').CSSProperties;
123
- labelShowBg?: boolean;
124
- labelBgStyle?: import('react').CSSProperties;
125
- labelBgPadding?: [number, number];
126
- labelBgBorderRadius?: number;
127
- style?: import('react').CSSProperties;
128
- className?: string;
129
- reconnectable?: boolean | import('@xyflow/react').HandleType;
130
- focusable?: boolean;
131
- }) => void;
132
- onEdgeMouseLeave: (_event: import('react').MouseEvent<Element, MouseEvent>, xyedge: {
133
- id: string;
134
- type: "relationship";
135
- source: string;
136
- target: string;
137
- sourceHandle?: string | null;
138
- targetHandle?: string | null;
139
- animated?: boolean;
140
- hidden?: boolean;
141
- deletable?: boolean;
142
- selectable?: boolean;
143
- data: import('./types').RelationshipData;
144
- selected?: boolean;
145
- markerStart?: import('@xyflow/react').EdgeMarkerType;
146
- markerEnd?: import('@xyflow/react').EdgeMarkerType;
147
- zIndex?: number;
148
- ariaLabel?: string;
149
- interactionWidth?: number;
150
- label?: string | import('react').ReactNode;
151
- labelStyle?: import('react').CSSProperties;
152
- labelShowBg?: boolean;
153
- labelBgStyle?: import('react').CSSProperties;
154
- labelBgPadding?: [number, number];
155
- labelBgBorderRadius?: number;
156
- style?: import('react').CSSProperties;
157
- className?: string;
158
- reconnectable?: boolean | import('@xyflow/react').HandleType;
159
- focusable?: boolean;
160
- }) => void;
161
- };
@@ -1,10 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
3
-
4
- type XYFlowInnerProps = PropsWithChildren<{
5
- background: NonNullable<LikeC4DiagramProperties['background']>;
6
- controls: boolean;
7
- showDiagramTitle: boolean;
8
- }>;
9
- export declare const XYFlowInner: import('react').NamedExoticComponent<XYFlowInnerProps>;
10
- export {};
@@ -1,7 +0,0 @@
1
- export declare const ZIndexes: {
2
- readonly Compound: 2;
3
- readonly Edge: 4;
4
- readonly Element: 6;
5
- };
6
- export declare const MinZoom = 0.1;
7
- export declare const MaxZoom = 2;
@@ -1,32 +0,0 @@
1
- import { EdgeProps } from '@xyflow/react';
2
- import { RelationshipData } from '../types';
3
-
4
- export declare const RelationshipEdge: import('react').NamedExoticComponent<EdgeProps<{
5
- id: string;
6
- type: "relationship";
7
- source: string;
8
- target: string;
9
- sourceHandle?: string | null;
10
- targetHandle?: string | null;
11
- animated?: boolean;
12
- hidden?: boolean;
13
- deletable?: boolean;
14
- selectable?: boolean;
15
- data: RelationshipData;
16
- selected?: boolean;
17
- markerStart?: import('@xyflow/react').EdgeMarkerType;
18
- markerEnd?: import('@xyflow/react').EdgeMarkerType;
19
- zIndex?: number;
20
- ariaLabel?: string;
21
- interactionWidth?: number;
22
- label?: string | import('react').ReactNode;
23
- labelStyle?: import('react').CSSProperties;
24
- labelShowBg?: boolean;
25
- labelBgStyle?: import('react').CSSProperties;
26
- labelBgPadding?: [number, number];
27
- labelBgBorderRadius?: number;
28
- style?: import('react').CSSProperties;
29
- className?: string;
30
- reconnectable?: boolean | import('@xyflow/react').HandleType;
31
- focusable?: boolean;
32
- }>>;
@@ -1,12 +0,0 @@
1
- export declare const container: string;
2
- export declare const dimmed: string;
3
- export declare const edgePathBg: string;
4
- export declare const markerContext: string;
5
- export declare const controlPoint: string;
6
- export declare const controlDragging: string;
7
- export declare const cssEdgePath: string;
8
- export declare const stepEdgeNumber: string;
9
- export declare const varLabelX: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
10
- export declare const varLabelY: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
11
- export declare const edgeLabel: string;
12
- export declare const edgeLabelText: string;
@@ -1,17 +0,0 @@
1
- import { Position, XYPosition } from '@xyflow/react';
2
- import { InternalXYFlowNode } from '../types';
3
-
4
- export declare function getNodeCenter(node: InternalXYFlowNode): XYPosition;
5
- export declare function getNodeIntersectionFromCenterToPoint(intersectionNode: InternalXYFlowNode, { x: x1, y: y1 }: XYPosition): {
6
- x: number;
7
- y: number;
8
- };
9
- export declare function getPointPosition(node: InternalXYFlowNode, intersectionPoint: XYPosition): readonly [number, number, Position];
10
- export declare function getEdgeParams(source: InternalXYFlowNode, target: InternalXYFlowNode): {
11
- sx: number;
12
- sy: number;
13
- tx: number;
14
- ty: number;
15
- sourcePos: Position;
16
- targetPos: Position;
17
- };
@@ -1,11 +0,0 @@
1
- export declare const container: string;
2
- export declare const nodeHandlerInCenter: string;
3
- export declare const dimmed: string;
4
- export declare const varOpacity: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
5
- export declare const varBorderTransparency: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
6
- export declare const compoundBody: string;
7
- export declare const transparent: string;
8
- export declare const title: string;
9
- export declare const titleWithNavigation: string;
10
- export declare const indicator: string;
11
- export declare const navigateBtn: string;
@@ -1,6 +0,0 @@
1
- import { NodeProps } from '@xyflow/react';
2
- import { CompoundXYFlowNode } from '../../types';
3
-
4
- type CompoundNodeProps = Pick<NodeProps<CompoundXYFlowNode>, 'id' | 'data' | 'width' | 'height' | 'selected'>;
5
- export declare const CompoundNodeMemo: import('react').NamedExoticComponent<CompoundNodeProps>;
6
- export {};
@@ -1 +0,0 @@
1
- export { CompoundNodeMemo as CompoundNode } from './CompoundNode';
@@ -1,3 +0,0 @@
1
- export declare const elementLink: string;
2
- export declare const trigger: string;
3
- export declare const linkButton: string;
@@ -1,7 +0,0 @@
1
- import { XYFlowNode } from '../../types';
2
-
3
- type ElementLinkProps = {
4
- element: XYFlowNode['data']['element'];
5
- };
6
- export declare function ElementLink({ element }: ElementLinkProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,6 +0,0 @@
1
- import { NodeProps } from '@xyflow/react';
2
- import { ElementXYFlowNode } from '../../types';
3
-
4
- type ElementNodeProps = NodeProps<ElementXYFlowNode>;
5
- export declare const ElementNodeMemo: import('react').NamedExoticComponent<ElementNodeProps>;
6
- export {};
@@ -1,18 +0,0 @@
1
- import { ElementShape } from '@likec4/core';
2
-
3
- export declare function cylinderSVGPath(diameter: number, height: number, tilt?: number): {
4
- path: string;
5
- ry: number;
6
- rx: number;
7
- };
8
- type ElementShapeSvgProps = {
9
- shape: ElementShape;
10
- w: number;
11
- h: number;
12
- };
13
- export declare function ElementShapeSvg({ shape, w, h }: ElementShapeSvgProps): import("react/jsx-runtime").JSX.Element;
14
- /**
15
- * When element is selected, this component is used to render the indicator
16
- */
17
- export declare function SelectedIndicator({ shape, w, h }: ElementShapeSvgProps): import("react/jsx-runtime").JSX.Element;
18
- export {};
@@ -1,19 +0,0 @@
1
- export declare const stokeFillMix: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
2
- export declare const container: string;
3
- export declare const handleCenter: string;
4
- export declare const containerAnimated: string;
5
- export declare const dimmed: string;
6
- export declare const indicator: string;
7
- export declare const fillElementFill: string;
8
- export declare const fillElementStroke: string;
9
- export declare const fillMixStroke: string;
10
- export declare const hasIcon: string;
11
- export declare const title: string;
12
- export declare const description: string;
13
- export declare const technology: string;
14
- export declare const elementDataContainer: string;
15
- export declare const elementTextData: string;
16
- export declare const elementIcon: string;
17
- export declare const cssShapeSvgMultiple: string;
18
- export declare const cssShapeSvg: string;
19
- export declare const cssNavigateBtn: string;
@@ -1 +0,0 @@
1
- export { ElementNodeMemo as ElementNode } from './ElementNode';
@@ -1,5 +0,0 @@
1
- export type NavigateToBtnProps = {
2
- xynodeId: string;
3
- className?: string;
4
- };
5
- export declare function NavigateToBtn({ xynodeId, className }: NavigateToBtnProps): import("react/jsx-runtime").JSX.Element;
@@ -1,50 +0,0 @@
1
- import { BBox, DiagramEdge, DiagramNode, Fqn, XYPoint } from '@likec4/core';
2
- import { Edge, EdgeMouseHandler, InternalNode, Node, NodeMouseHandler, OnMoveEnd, OnMoveStart, ReactFlowInstance, ReactFlowState } from '@xyflow/react';
3
- import { MouseEvent as ReactMouseEvent } from 'react';
4
- import { Simplify } from 'type-fest';
5
-
6
- export type ElementXYFlowNode = Node<{
7
- fqn: Fqn;
8
- element: DiagramNode;
9
- }, 'element'>;
10
- export type CompoundXYFlowNode = Node<{
11
- fqn: Fqn;
12
- element: DiagramNode;
13
- }, 'compound'>;
14
- export type XYFlowNode = ElementXYFlowNode | CompoundXYFlowNode;
15
- export type InternalXYFlowNode = InternalNode<XYFlowNode>;
16
- export declare namespace XYFlowNode {
17
- function isCompound(node: unknown): node is CompoundXYFlowNode;
18
- function isElement(node: Node): node is ElementXYFlowNode;
19
- const is: (node: Node) => node is XYFlowNode;
20
- }
21
- export type RelationshipData = {
22
- edge: DiagramEdge;
23
- controlPoints: XYPoint[] | null;
24
- stepNum: number | null;
25
- label: null | {
26
- bbox: BBox;
27
- text: string;
28
- };
29
- };
30
- export type RelationshipEdge = Simplify<Edge<RelationshipData, 'relationship'> & {
31
- type: 'relationship';
32
- data: RelationshipData;
33
- }>;
34
- export type XYFlowEdge = RelationshipEdge;
35
- export declare namespace XYFlowEdge {
36
- type Data = RelationshipData;
37
- const isRelationship: (e: Edge) => e is RelationshipEdge;
38
- }
39
- export type XYFlowInstance = ReactFlowInstance<XYFlowNode, XYFlowEdge>;
40
- export type XYFlowState = ReactFlowState<XYFlowNode, XYFlowEdge>;
41
- export type XYFlowEventHandlers = {
42
- onPanelClick: (event: ReactMouseEvent) => void;
43
- onNodeContextMenu: NodeMouseHandler<XYFlowNode>;
44
- onEdgeContextMenu: EdgeMouseHandler<XYFlowEdge>;
45
- onPaneContextMenu: (event: ReactMouseEvent | MouseEvent) => void;
46
- onNodeClick: NodeMouseHandler<XYFlowNode>;
47
- onEdgeClick: EdgeMouseHandler<XYFlowEdge>;
48
- onMoveStart: OnMoveStart;
49
- onMoveEnd: OnMoveEnd;
50
- };
@@ -1,9 +0,0 @@
1
- import { ReactFlowProps } from '@xyflow/react';
2
- import { XYFlowNode } from './types';
3
-
4
- type LayoutConstraints = Required<Pick<ReactFlowProps<XYFlowNode>, 'onNodeDragStart' | 'onNodeDrag' | 'onNodeDragStop'>>;
5
- /**
6
- * Keeps the layout constraints (parent nodes and children) when dragging a node
7
- */
8
- export declare function useLayoutConstraints(): LayoutConstraints;
9
- export {};
@@ -1,18 +0,0 @@
1
- import { DiagramEdge, Point } from '@likec4/core';
2
- import { Rect, XYPosition } from '@xyflow/react';
3
- import { InternalXYFlowNode } from './types';
4
-
5
- export declare function toDomPrecision(v: number | null): number;
6
- export declare function distance(a: XYPosition, b: XYPosition): number;
7
- export declare const nodeToRect: (nd: InternalXYFlowNode) => Rect;
8
- /**
9
- * Checks if a rectangle is completely inside another rectangle.
10
- *
11
- * @param test - The rectangle to test.
12
- * @param target - The target rectangle.
13
- * @returns `true` if the `test` rectangle is completely inside the `target` rectangle, otherwise `false`.
14
- */
15
- export declare const isInside: (test: Rect, target: Rect) => boolean;
16
- export declare function bezierControlPoints(diagramEdge: DiagramEdge): XYPosition[];
17
- export declare function isSamePoint(a: XYPosition | Point, b: XYPosition | Point): boolean;
18
- export declare function distanceBetweenPoints(a: XYPosition, b: XYPosition): number;