@likec4/diagram 1.3.0 → 1.5.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.
Files changed (95) hide show
  1. package/dist/LikeC4Diagram.css.d.ts +0 -1
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.props.d.ts +7 -2
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.mjs +1580 -1194
  6. package/dist/state/DiagramContext.d.ts +97 -4169
  7. package/dist/state/diagramStore.d.ts +98 -4172
  8. package/dist/state/hooks.d.ts +4 -0
  9. package/dist/state/index.d.ts +1 -3
  10. package/dist/state/useDiagramStore.d.ts +3 -4622
  11. package/dist/state/useNavigationHistory.d.ts +5 -0
  12. package/dist/style.css +217 -159
  13. package/dist/theme.css.d.ts +5 -0
  14. package/dist/ui/BackwardForwardPanel.css.d.ts +1 -0
  15. package/dist/ui/BackwardForwardPanel.d.ts +1 -0
  16. package/dist/ui/DiagramTitlePanel.css.d.ts +1 -1
  17. package/dist/ui/OptionsPanel.d.ts +1 -3
  18. package/dist/ui/options/EdgeOptions.d.ts +19 -0
  19. package/dist/ui/options/NodeOptions.d.ts +2 -2
  20. package/dist/xyflow/EdgeMarkers.d.ts +11 -0
  21. package/dist/xyflow/XYFlowEvents.d.ts +12 -9
  22. package/dist/xyflow/XYFlowInner.d.ts +1 -0
  23. package/dist/xyflow/const.d.ts +3 -3
  24. package/dist/xyflow/diagram-to-xyflow.d.ts +1 -1
  25. package/dist/xyflow/edges/RelationshipEdge.d.ts +4 -3
  26. package/dist/xyflow/edges/edges.css.d.ts +1 -0
  27. package/dist/xyflow/edges/utils.d.ts +1 -0
  28. package/dist/xyflow/hooks/index.d.ts +3 -2
  29. package/dist/xyflow/hooks/useXYFlow.d.ts +22 -21
  30. package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +1 -0
  31. package/dist/xyflow/nodes/element/ElementIcon.d.ts +1 -4
  32. package/dist/xyflow/nodes/element/element.css.d.ts +3 -1
  33. package/dist/xyflow/types.d.ts +2 -32
  34. package/package.json +21 -21
  35. package/src/LikeC4Diagram.css.ts +10 -8
  36. package/src/LikeC4Diagram.props.ts +12 -5
  37. package/src/LikeC4Diagram.tsx +43 -26
  38. package/src/globals.css.ts +11 -4
  39. package/src/index.ts +1 -1
  40. package/src/mantine.css.ts +2 -2
  41. package/src/state/DiagramContext.tsx +47 -16
  42. package/src/state/diagramStore.ts +89 -80
  43. package/src/state/hooks.ts +5 -0
  44. package/src/state/index.ts +1 -3
  45. package/src/state/useDiagramStore.ts +6 -13
  46. package/src/state/useNavigationHistory.ts +39 -0
  47. package/src/theme.css.ts +5 -0
  48. package/src/ui/BackwardForwardPanel.css.ts +22 -0
  49. package/src/ui/BackwardForwardPanel.tsx +59 -0
  50. package/src/ui/DiagramTitlePanel.css.ts +17 -6
  51. package/src/ui/DiagramTitlePanel.tsx +108 -94
  52. package/src/ui/DynamicViewWalkthrough.tsx +6 -4
  53. package/src/ui/OptionsPanel.tsx +37 -18
  54. package/src/ui/options/EdgeOptions.tsx +157 -0
  55. package/src/ui/options/NodeOptions.tsx +37 -29
  56. package/src/xyflow/EdgeMarkers.tsx +148 -0
  57. package/src/xyflow/FitviewOnDiagramChange.tsx +8 -4
  58. package/src/xyflow/SelectEdgesOnNodeFocus.tsx +59 -55
  59. package/src/xyflow/SyncWithDiagram.tsx +13 -20
  60. package/src/xyflow/XYFlow.tsx +2 -4
  61. package/src/xyflow/XYFlowEvents.tsx +48 -33
  62. package/src/xyflow/XYFlowInner.tsx +6 -3
  63. package/src/xyflow/const.ts +3 -3
  64. package/src/xyflow/diagram-to-xyflow.ts +18 -53
  65. package/src/xyflow/edges/RelationshipEdge.tsx +218 -126
  66. package/src/xyflow/edges/edges.css.ts +44 -26
  67. package/src/xyflow/edges/utils.ts +10 -0
  68. package/src/xyflow/hooks/index.ts +4 -2
  69. package/src/xyflow/hooks/useLayoutConstraints.ts +5 -5
  70. package/src/xyflow/hooks/useXYFlow.ts +28 -1
  71. package/src/xyflow/nodes/compound/CompoundNode.css.ts +41 -31
  72. package/src/xyflow/nodes/compound/CompoundNode.tsx +52 -53
  73. package/src/xyflow/nodes/element/ElementIcon.tsx +11 -22
  74. package/src/xyflow/nodes/element/ElementLink.tsx +11 -16
  75. package/src/xyflow/nodes/element/ElementNode.tsx +69 -114
  76. package/src/xyflow/nodes/element/element.css.ts +48 -15
  77. package/src/xyflow/nodes/shared/NavigateToBtn.tsx +1 -1
  78. package/src/xyflow/types.ts +2 -4
  79. package/src/xyflow/utils.ts +3 -6
  80. package/dist/KeepAspectRatioContainer.d.ts +0 -9
  81. package/dist/icons/Clipboard.d.ts +0 -3
  82. package/dist/icons/Link.d.ts +0 -3
  83. package/dist/icons/ZoomIn.d.ts +0 -3
  84. package/dist/icons/index.d.ts +0 -3
  85. package/dist/mantine/theme.d.ts +0 -3
  86. package/dist/state/WhenInitialized.d.ts +0 -3
  87. package/dist/ui/Camera.d.ts +0 -3
  88. package/src/KeepAspectRatioContainer.tsx +0 -36
  89. package/src/icons/Clipboard.tsx +0 -24
  90. package/src/icons/Link.tsx +0 -23
  91. package/src/icons/ZoomIn.tsx +0 -25
  92. package/src/icons/index.ts +0 -3
  93. package/src/mantine/theme.ts +0 -20
  94. package/src/state/WhenInitialized.tsx +0 -24
  95. package/src/ui/Camera.tsx +0 -174
@@ -1,4 +1,5 @@
1
1
  export declare const vars: {
2
+ safariAnimationHook: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
2
3
  default: {
3
4
  font: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
4
5
  };
@@ -31,6 +32,10 @@ export declare const vars: {
31
32
  top: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
32
33
  right: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
33
34
  };
35
+ navigationPanel: {
36
+ top: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
37
+ left: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
38
+ };
34
39
  };
35
40
  export declare const xyvars: {
36
41
  background: {
@@ -0,0 +1 @@
1
+ export declare const panel: string;
@@ -0,0 +1 @@
1
+ export declare function BackwardForwardPanel(): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  export declare const container: string;
2
- export declare const paper: string;
2
+ export declare const card: string;
3
3
  export declare const title: string;
4
4
  export declare const description: string;
@@ -1,3 +1 @@
1
- /// <reference types="react" />
2
- declare const OptionsPanelMemo: import('react').NamedExoticComponent<object>;
3
- export default OptionsPanelMemo;
1
+ export default function OptionsPanel(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
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
+ }>;
@@ -14,6 +14,6 @@ export declare const colors: {
14
14
  }[];
15
15
  export type ThemeColorKey = typeof themedColors[0]['key'];
16
16
  export type ColorKey = typeof colors[0]['key'];
17
- export declare function NodeOptions({ selectedNodeIds }: {
17
+ export declare const NodeOptions: import('react').NamedExoticComponent<{
18
18
  selectedNodeIds: string[];
19
- }): import("react/jsx-runtime").JSX.Element | null;
19
+ }>;
@@ -0,0 +1,11 @@
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
+ };
@@ -1,5 +1,8 @@
1
- import { XYFlowNode } from './types';
1
+ import { ReactFlowProps } from '@xyflow/react';
2
+ import { Simplify } from 'type-fest';
3
+ import { XYFlowEdge, XYFlowNode } from './types';
2
4
 
5
+ export type XYFlowEventHandlers = Simplify<Required<Pick<ReactFlowProps<XYFlowNode, XYFlowEdge>, 'onDoubleClick' | 'onPaneClick' | 'onNodeClick' | 'onNodeDoubleClick' | 'onEdgeClick' | 'onMoveEnd' | 'onNodeContextMenu' | 'onEdgeContextMenu' | 'onPaneContextMenu' | 'onNodeMouseEnter' | 'onNodeMouseLeave' | 'onEdgeMouseEnter' | 'onEdgeMouseLeave'>>>;
3
6
  export declare function useXYFlowEvents(): {
4
7
  onDoubleClick: (event: import('react').MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
8
  onPaneClick: (event: import('react').MouseEvent<Element, MouseEvent>) => void;
@@ -20,7 +23,7 @@ export declare function useXYFlowEvents(): {
20
23
  zIndex?: number;
21
24
  ariaLabel?: string;
22
25
  interactionWidth?: number;
23
- label?: import('react').ReactNode;
26
+ label?: string | import('react').ReactNode;
24
27
  labelStyle?: import('react').CSSProperties;
25
28
  labelShowBg?: boolean;
26
29
  labelBgStyle?: import('react').CSSProperties;
@@ -28,7 +31,7 @@ export declare function useXYFlowEvents(): {
28
31
  labelBgBorderRadius?: number;
29
32
  style?: import('react').CSSProperties;
30
33
  className?: string;
31
- updatable?: import('@xyflow/react').EdgeUpdatable;
34
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
32
35
  focusable?: boolean;
33
36
  data: import('./types').RelationshipData;
34
37
  readonly id: string;
@@ -51,7 +54,7 @@ export declare function useXYFlowEvents(): {
51
54
  zIndex?: number;
52
55
  ariaLabel?: string;
53
56
  interactionWidth?: number;
54
- label?: import('react').ReactNode;
57
+ label?: string | import('react').ReactNode;
55
58
  labelStyle?: import('react').CSSProperties;
56
59
  labelShowBg?: boolean;
57
60
  labelBgStyle?: import('react').CSSProperties;
@@ -59,7 +62,7 @@ export declare function useXYFlowEvents(): {
59
62
  labelBgBorderRadius?: number;
60
63
  style?: import('react').CSSProperties;
61
64
  className?: string;
62
- updatable?: import('@xyflow/react').EdgeUpdatable;
65
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
63
66
  focusable?: boolean;
64
67
  data: import('./types').RelationshipData;
65
68
  readonly id: string;
@@ -83,7 +86,7 @@ export declare function useXYFlowEvents(): {
83
86
  zIndex?: number;
84
87
  ariaLabel?: string;
85
88
  interactionWidth?: number;
86
- label?: import('react').ReactNode;
89
+ label?: string | import('react').ReactNode;
87
90
  labelStyle?: import('react').CSSProperties;
88
91
  labelShowBg?: boolean;
89
92
  labelBgStyle?: import('react').CSSProperties;
@@ -91,7 +94,7 @@ export declare function useXYFlowEvents(): {
91
94
  labelBgBorderRadius?: number;
92
95
  style?: import('react').CSSProperties;
93
96
  className?: string;
94
- updatable?: import('@xyflow/react').EdgeUpdatable;
97
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
95
98
  focusable?: boolean;
96
99
  data: import('./types').RelationshipData;
97
100
  readonly id: string;
@@ -112,7 +115,7 @@ export declare function useXYFlowEvents(): {
112
115
  zIndex?: number;
113
116
  ariaLabel?: string;
114
117
  interactionWidth?: number;
115
- label?: import('react').ReactNode;
118
+ label?: string | import('react').ReactNode;
116
119
  labelStyle?: import('react').CSSProperties;
117
120
  labelShowBg?: boolean;
118
121
  labelBgStyle?: import('react').CSSProperties;
@@ -120,7 +123,7 @@ export declare function useXYFlowEvents(): {
120
123
  labelBgBorderRadius?: number;
121
124
  style?: import('react').CSSProperties;
122
125
  className?: string;
123
- updatable?: import('@xyflow/react').EdgeUpdatable;
126
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
124
127
  focusable?: boolean;
125
128
  data: import('./types').RelationshipData;
126
129
  readonly id: string;
@@ -5,6 +5,7 @@ type XYFlowInnerProps = PropsWithChildren<{
5
5
  background: NonNullable<LikeC4DiagramProperties['background']>;
6
6
  controls: boolean;
7
7
  showDiagramTitle: boolean;
8
+ showNavigationButtons: boolean;
8
9
  enableDynamicViewWalkthrough: boolean;
9
10
  }>;
10
11
  export declare const XYFlowInner: import('react').NamedExoticComponent<XYFlowInnerProps>;
@@ -1,6 +1,6 @@
1
1
  export declare const ZIndexes: {
2
- readonly Compound: 1;
3
- readonly Edge: 2;
4
- readonly Element: 3;
2
+ readonly Compound: 2;
3
+ readonly Edge: 4;
4
+ readonly Element: 6;
5
5
  };
6
6
  export declare const MinZoom = 0.1;
@@ -1,4 +1,4 @@
1
- import { DiagramView } from '@likec4/core';
1
+ import { DiagramView } from '@likec4/core/types';
2
2
  import { XYFlowData } from '../xyflow/types';
3
3
 
4
4
  export declare function diagramViewToXYFlowData(view: Pick<DiagramView, 'id' | 'nodes' | 'edges' | '__' | 'manualLayout'>, opts: {
@@ -1,4 +1,5 @@
1
1
  import { EdgeProps } from '@xyflow/react';
2
+ import { RelationshipData } from '../types';
2
3
 
3
4
  export declare const RelationshipEdge: import('react').NamedExoticComponent<EdgeProps<{
4
5
  source: string;
@@ -15,7 +16,7 @@ export declare const RelationshipEdge: import('react').NamedExoticComponent<Edge
15
16
  zIndex?: number;
16
17
  ariaLabel?: string;
17
18
  interactionWidth?: number;
18
- label?: import('react').ReactNode;
19
+ label?: string | import('react').ReactNode;
19
20
  labelStyle?: import('react').CSSProperties;
20
21
  labelShowBg?: boolean;
21
22
  labelBgStyle?: import('react').CSSProperties;
@@ -23,9 +24,9 @@ export declare const RelationshipEdge: import('react').NamedExoticComponent<Edge
23
24
  labelBgBorderRadius?: number;
24
25
  style?: import('react').CSSProperties;
25
26
  className?: string;
26
- updatable?: import('@xyflow/react').EdgeUpdatable;
27
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
27
28
  focusable?: boolean;
28
- data: import('../types').RelationshipData;
29
+ data: RelationshipData;
29
30
  readonly id: string;
30
31
  readonly type: "relationship";
31
32
  }>>;
@@ -3,6 +3,7 @@ export declare const dimmed: string;
3
3
  export declare const edgePathBg: string;
4
4
  export declare const markerContext: string;
5
5
  export declare const controlPoint: string;
6
+ export declare const controlDragging: string;
6
7
  export declare const cssEdgePath: string;
7
8
  export declare const varLabelX: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
8
9
  export declare const varLabelY: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
@@ -1,6 +1,7 @@
1
1
  import { Position, XYPosition } from '@xyflow/react';
2
2
  import { InternalXYFlowNode } from '../types';
3
3
 
4
+ export declare function getNodeCenter(node: InternalXYFlowNode): XYPosition;
4
5
  export declare function getNodeIntersectionFromCenterToPoint(intersectionNode: InternalXYFlowNode, { x: x1, y: y1 }: XYPosition): {
5
6
  x: number;
6
7
  y: number;
@@ -1,2 +1,3 @@
1
- export * from './useLayoutConstraints';
2
- export * from './useXYFlow';
1
+ export { useLayoutConstraints } from './useLayoutConstraints';
2
+ export { useXYFlow, useXYNodesData, useXYStore, useXYStoreApi } from './useXYFlow';
3
+ export type * from './useXYFlow';
@@ -1,4 +1,4 @@
1
- import { XYFlowNode, XYFlowState } from '../types';
1
+ import { XYFlowEdge, XYFlowNode, XYFlowState } from '../types';
2
2
 
3
3
  export declare const useXYFlow: () => import('@xyflow/react').ReactFlowInstance<XYFlowNode, {
4
4
  source: string;
@@ -15,7 +15,7 @@ export declare const useXYFlow: () => import('@xyflow/react').ReactFlowInstance<
15
15
  zIndex?: number;
16
16
  ariaLabel?: string;
17
17
  interactionWidth?: number;
18
- label?: import('react').ReactNode;
18
+ label?: string | import('react').ReactNode;
19
19
  labelStyle?: import('react').CSSProperties;
20
20
  labelShowBg?: boolean;
21
21
  labelBgStyle?: import('react').CSSProperties;
@@ -23,15 +23,15 @@ export declare const useXYFlow: () => import('@xyflow/react').ReactFlowInstance<
23
23
  labelBgBorderRadius?: number;
24
24
  style?: import('react').CSSProperties;
25
25
  className?: string;
26
- updatable?: import('@xyflow/react').EdgeUpdatable;
26
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
27
27
  focusable?: boolean;
28
28
  data: import('../types').RelationshipData;
29
29
  readonly id: string;
30
30
  readonly type: "relationship";
31
31
  }>;
32
32
  export declare const useXYNodesData: {
33
- (nodeId: string): Pick<XYFlowNode, "id" | "data" | "type"> | null;
34
- (nodeIds: string[]): Pick<XYFlowNode, "id" | "data" | "type">[];
33
+ (nodeId: string): Pick<XYFlowNode, "id" | "type" | "data"> | null;
34
+ (nodeIds: string[]): Pick<XYFlowNode, "id" | "type" | "data">[];
35
35
  };
36
36
  export declare function useXYStore<StateSlice = unknown>(selector: (state: XYFlowState) => StateSlice, equalityFn?: (a: StateSlice, b: StateSlice) => boolean): StateSlice;
37
37
  export declare const useXYStoreApi: () => {
@@ -50,7 +50,7 @@ export declare const useXYStoreApi: () => {
50
50
  zIndex?: number;
51
51
  ariaLabel?: string;
52
52
  interactionWidth?: number;
53
- label?: import('react').ReactNode;
53
+ label?: string | import('react').ReactNode;
54
54
  labelStyle?: import('react').CSSProperties;
55
55
  labelShowBg?: boolean;
56
56
  labelBgStyle?: import('react').CSSProperties;
@@ -58,7 +58,7 @@ export declare const useXYStoreApi: () => {
58
58
  labelBgBorderRadius?: number;
59
59
  style?: import('react').CSSProperties;
60
60
  className?: string;
61
- updatable?: import('@xyflow/react').EdgeUpdatable;
61
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
62
62
  focusable?: boolean;
63
63
  data: import('../types').RelationshipData;
64
64
  readonly id: string;
@@ -79,7 +79,7 @@ export declare const useXYStoreApi: () => {
79
79
  zIndex?: number;
80
80
  ariaLabel?: string;
81
81
  interactionWidth?: number;
82
- label?: import('react').ReactNode;
82
+ label?: string | import('react').ReactNode;
83
83
  labelStyle?: import('react').CSSProperties;
84
84
  labelShowBg?: boolean;
85
85
  labelBgStyle?: import('react').CSSProperties;
@@ -87,7 +87,7 @@ export declare const useXYStoreApi: () => {
87
87
  labelBgBorderRadius?: number;
88
88
  style?: import('react').CSSProperties;
89
89
  className?: string;
90
- updatable?: import('@xyflow/react').EdgeUpdatable;
90
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
91
91
  focusable?: boolean;
92
92
  data: import('../types').RelationshipData;
93
93
  readonly id: string;
@@ -107,7 +107,7 @@ export declare const useXYStoreApi: () => {
107
107
  zIndex?: number;
108
108
  ariaLabel?: string;
109
109
  interactionWidth?: number;
110
- label?: import('react').ReactNode;
110
+ label?: string | import('react').ReactNode;
111
111
  labelStyle?: import('react').CSSProperties;
112
112
  labelShowBg?: boolean;
113
113
  labelBgStyle?: import('react').CSSProperties;
@@ -115,7 +115,7 @@ export declare const useXYStoreApi: () => {
115
115
  labelBgBorderRadius?: number;
116
116
  style?: import('react').CSSProperties;
117
117
  className?: string;
118
- updatable?: import('@xyflow/react').EdgeUpdatable;
118
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
119
119
  focusable?: boolean;
120
120
  data: import('../types').RelationshipData;
121
121
  readonly id: string;
@@ -135,7 +135,7 @@ export declare const useXYStoreApi: () => {
135
135
  zIndex?: number;
136
136
  ariaLabel?: string;
137
137
  interactionWidth?: number;
138
- label?: import('react').ReactNode;
138
+ label?: string | import('react').ReactNode;
139
139
  labelStyle?: import('react').CSSProperties;
140
140
  labelShowBg?: boolean;
141
141
  labelBgStyle?: import('react').CSSProperties;
@@ -143,7 +143,7 @@ export declare const useXYStoreApi: () => {
143
143
  labelBgBorderRadius?: number;
144
144
  style?: import('react').CSSProperties;
145
145
  className?: string;
146
- updatable?: import('@xyflow/react').EdgeUpdatable;
146
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
147
147
  focusable?: boolean;
148
148
  data: import('../types').RelationshipData;
149
149
  readonly id: string;
@@ -163,7 +163,7 @@ export declare const useXYStoreApi: () => {
163
163
  zIndex?: number;
164
164
  ariaLabel?: string;
165
165
  interactionWidth?: number;
166
- label?: import('react').ReactNode;
166
+ label?: string | import('react').ReactNode;
167
167
  labelStyle?: import('react').CSSProperties;
168
168
  labelShowBg?: boolean;
169
169
  labelBgStyle?: import('react').CSSProperties;
@@ -171,7 +171,7 @@ export declare const useXYStoreApi: () => {
171
171
  labelBgBorderRadius?: number;
172
172
  style?: import('react').CSSProperties;
173
173
  className?: string;
174
- updatable?: import('@xyflow/react').EdgeUpdatable;
174
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
175
175
  focusable?: boolean;
176
176
  data: import('../types').RelationshipData;
177
177
  readonly id: string;
@@ -191,7 +191,7 @@ export declare const useXYStoreApi: () => {
191
191
  zIndex?: number;
192
192
  ariaLabel?: string;
193
193
  interactionWidth?: number;
194
- label?: import('react').ReactNode;
194
+ label?: string | import('react').ReactNode;
195
195
  labelStyle?: import('react').CSSProperties;
196
196
  labelShowBg?: boolean;
197
197
  labelBgStyle?: import('react').CSSProperties;
@@ -199,7 +199,7 @@ export declare const useXYStoreApi: () => {
199
199
  labelBgBorderRadius?: number;
200
200
  style?: import('react').CSSProperties;
201
201
  className?: string;
202
- updatable?: import('@xyflow/react').EdgeUpdatable;
202
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
203
203
  focusable?: boolean;
204
204
  data: import('../types').RelationshipData;
205
205
  readonly id: string;
@@ -220,7 +220,7 @@ export declare const useXYStoreApi: () => {
220
220
  zIndex?: number;
221
221
  ariaLabel?: string;
222
222
  interactionWidth?: number;
223
- label?: import('react').ReactNode;
223
+ label?: string | import('react').ReactNode;
224
224
  labelStyle?: import('react').CSSProperties;
225
225
  labelShowBg?: boolean;
226
226
  labelBgStyle?: import('react').CSSProperties;
@@ -228,7 +228,7 @@ export declare const useXYStoreApi: () => {
228
228
  labelBgBorderRadius?: number;
229
229
  style?: import('react').CSSProperties;
230
230
  className?: string;
231
- updatable?: import('@xyflow/react').EdgeUpdatable;
231
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
232
232
  focusable?: boolean;
233
233
  data: import('../types').RelationshipData;
234
234
  readonly id: string;
@@ -248,7 +248,7 @@ export declare const useXYStoreApi: () => {
248
248
  zIndex?: number;
249
249
  ariaLabel?: string;
250
250
  interactionWidth?: number;
251
- label?: import('react').ReactNode;
251
+ label?: string | import('react').ReactNode;
252
252
  labelStyle?: import('react').CSSProperties;
253
253
  labelShowBg?: boolean;
254
254
  labelBgStyle?: import('react').CSSProperties;
@@ -256,7 +256,7 @@ export declare const useXYStoreApi: () => {
256
256
  labelBgBorderRadius?: number;
257
257
  style?: import('react').CSSProperties;
258
258
  className?: string;
259
- updatable?: import('@xyflow/react').EdgeUpdatable;
259
+ reconnectable?: boolean | import('@xyflow/react').HandleType;
260
260
  focusable?: boolean;
261
261
  data: import('../types').RelationshipData;
262
262
  readonly id: string;
@@ -264,3 +264,4 @@ export declare const useXYStoreApi: () => {
264
264
  }>) => void) => () => void;
265
265
  };
266
266
  export type XYStoreApi = ReturnType<typeof useXYStoreApi>;
267
+ export declare function useXYEdgesData(edgeIds: string[]): Pick<XYFlowEdge, 'id' | 'data'>[];
@@ -1,4 +1,5 @@
1
1
  export declare const container: string;
2
+ export declare const nodeHandlerInCenter: string;
2
3
  export declare const dimmed: string;
3
4
  export declare const varOpacity: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
4
5
  export declare const varBorderTransparency: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
@@ -2,9 +2,6 @@ import { XYFlowNode } from '../../types';
2
2
 
3
3
  type ElementIconProps = {
4
4
  node: XYFlowNode['data']['element'];
5
- maxWidth?: number | undefined;
6
- paddingX?: number | undefined;
7
- paddingY?: number | undefined;
8
5
  };
9
- export declare function ElementIcon({ node, paddingY }: ElementIconProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare function ElementIcon({ node: { icon, title, labelBBox } }: ElementIconProps): import("react/jsx-runtime").JSX.Element | null;
10
7
  export {};
@@ -1,5 +1,7 @@
1
1
  export declare const stokeFillMix: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
2
2
  export declare const container: string;
3
+ export declare const handleCenter: string;
4
+ export declare const containerAnimated: string;
3
5
  export declare const dimmed: string;
4
6
  export declare const indicator: string;
5
7
  export declare const fillElementFill: string;
@@ -9,7 +11,7 @@ export declare const title: string;
9
11
  export declare const description: string;
10
12
  export declare const technology: string;
11
13
  export declare const element: string;
12
- export declare const iconMaxH: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
14
+ export declare const iconOffsetY: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
13
15
  export declare const elementIcon: string;
14
16
  export declare const cssShapeSvg: string;
15
17
  export declare const cssNavigateBtn: string;
@@ -1,4 +1,4 @@
1
- import { BBox, DiagramEdge, DiagramNode, Fqn, Point, XYPosition } from '@likec4/core';
1
+ import { BBox, DiagramEdge, DiagramNode, Fqn, XYPosition } from '@likec4/core';
2
2
  import { Edge, EdgeMouseHandler, InternalNode, Node, NodeMouseHandler, OnMoveEnd, OnMoveStart, ReactFlowInstance, ReactFlowState } from '@xyflow/react';
3
3
  import { MouseEvent as ReactMouseEvent } from 'react';
4
4
  import { SetReadonly, SetRequired } from 'type-fest';
@@ -26,8 +26,6 @@ export declare namespace XYFlowNode {
26
26
  export type RelationshipData = {
27
27
  edge: DiagramEdge;
28
28
  controlPoints: XYPosition[] | null;
29
- headPoint: Point | null;
30
- tailPoint: Point | null;
31
29
  type: 'bezier' | 'poly';
32
30
  stepNum: number | null;
33
31
  label: null | {
@@ -39,35 +37,7 @@ export type RelationshipEdge = TypedXYFlowEdge<RelationshipData, 'relationship'>
39
37
  export type XYFlowEdge = RelationshipEdge;
40
38
  export declare namespace XYFlowEdge {
41
39
  type Data = RelationshipData;
42
- const isRelationship: (e: Edge) => e is {
43
- source: string;
44
- target: string;
45
- sourceHandle?: string | null;
46
- targetHandle?: string | null;
47
- animated?: boolean;
48
- hidden?: boolean;
49
- deletable?: boolean;
50
- selectable?: boolean;
51
- selected?: boolean;
52
- markerStart?: import("@xyflow/react").EdgeMarkerType;
53
- markerEnd?: import("@xyflow/react").EdgeMarkerType;
54
- zIndex?: number;
55
- ariaLabel?: string;
56
- interactionWidth?: number;
57
- label?: import("react").ReactNode;
58
- labelStyle?: import("react").CSSProperties;
59
- labelShowBg?: boolean;
60
- labelBgStyle?: import("react").CSSProperties;
61
- labelBgPadding?: [number, number];
62
- labelBgBorderRadius?: number;
63
- style?: import("react").CSSProperties;
64
- className?: string;
65
- updatable?: import("@xyflow/react").EdgeUpdatable;
66
- focusable?: boolean;
67
- data: RelationshipData;
68
- readonly id: string;
69
- readonly type: "relationship";
70
- };
40
+ const isRelationship: (e: Edge) => e is RelationshipEdge;
71
41
  }
72
42
  export type XYFlowInstance = ReactFlowInstance<XYFlowNode, XYFlowEdge>;
73
43
  export type XYFlowState = ReactFlowState<XYFlowNode, XYFlowEdge>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/diagram",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "license": "MIT",
5
5
  "bugs": "https://github.com/likec4/likec4/issues",
6
6
  "homepage": "https://likec4.dev",
@@ -40,7 +40,7 @@
40
40
  "./style.css": "./dist/style.css"
41
41
  }
42
42
  },
43
- "packageManager": "yarn@4.3.0",
43
+ "packageManager": "yarn@4.3.1",
44
44
  "scripts": {
45
45
  "typecheck": "tsc --noEmit",
46
46
  "prepack": "vite build --mode production",
@@ -48,50 +48,50 @@
48
48
  "clean": "run -T rimraf -v -g 'dist/*' .tsbuildinfo"
49
49
  },
50
50
  "dependencies": {
51
- "@likec4/core": "1.3.0",
51
+ "@likec4/core": "1.5.0",
52
52
  "@react-hookz/web": "^24.0.4",
53
- "@tabler/icons-react": "^3.0.0",
53
+ "@tabler/icons-react": "^3.9.0",
54
54
  "@vanilla-extract/css": "^1.15.3",
55
55
  "@vanilla-extract/css-utils": "^0.1.4",
56
56
  "@vanilla-extract/dynamic": "^2.1.1",
57
57
  "d3-shape": "^3.2.0",
58
58
  "esm-env": "^1.0.0",
59
59
  "fast-equals": "^5.0.1",
60
- "framer-motion": "^11.2.2",
61
- "remeda": "^1.61.0",
62
- "zustand": "^4.5.2"
60
+ "framer-motion": "^11.2.13",
61
+ "remeda": "^2.3.0",
62
+ "zustand": "^4.5.4"
63
63
  },
64
64
  "peerDependencies": {
65
- "@mantine/core": "7.10.2",
66
- "@mantine/hooks": "7.10.2",
65
+ "@mantine/core": "^7.11.1",
66
+ "@mantine/hooks": "^7.11.1",
67
67
  "react": "^18.3.1",
68
68
  "react-dom": "^18.3.1"
69
69
  },
70
70
  "devDependencies": {
71
- "@likec4/tsconfig": "1.3.0",
71
+ "@likec4/tsconfig": "1.5.0",
72
72
  "@lume/kiwi": "^0.4.3",
73
- "@mantine/core": "7.10.2",
74
- "@mantine/hooks": "7.10.2",
75
- "@mantine/vanilla-extract": "7.10.2",
73
+ "@mantine/core": "7.11.1",
74
+ "@mantine/hooks": "7.11.1",
75
+ "@mantine/vanilla-extract": "7.11.1",
76
76
  "@total-typescript/ts-reset": "^0.5.1",
77
77
  "@types/bezier-js": "^4.1.3",
78
- "@types/d3-shape": "^3",
78
+ "@types/d3-shape": "^3.1.6",
79
79
  "@types/react": "^18.3.3",
80
80
  "@types/react-dom": "^18.3.0",
81
- "@vanilla-extract/esbuild-plugin": "^2.3.7",
81
+ "@vanilla-extract/esbuild-plugin": "^2.3.8",
82
82
  "@vitejs/plugin-react": "^4.3.1",
83
- "@xyflow/react": "12.0.0-next.21",
84
- "@xyflow/system": "0.0.29",
83
+ "@xyflow/react": "12.0.1",
84
+ "@xyflow/system": "0.0.35",
85
85
  "bezier-js": "^6.1.4",
86
86
  "clsx": "^2.1.1",
87
- "execa": "^9.1.0",
87
+ "execa": "^9.3.0",
88
88
  "khroma": "^2.1.0",
89
89
  "react": "^18.3.1",
90
90
  "react-dom": "^18.3.1",
91
91
  "tilg": "^0.1.1",
92
- "type-fest": "^4.18.2",
93
- "typescript": "^5.4.5",
94
- "vite": "5.3.1",
92
+ "type-fest": "^4.21.0",
93
+ "typescript": "^5.5.3",
94
+ "vite": "5.3.3",
95
95
  "vite-plugin-dts": "^3.9.1"
96
96
  }
97
97
  }
@@ -1,16 +1,18 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css'
2
2
  import { vars, xyvars } from './theme.css'
3
3
 
4
- export const keepAspectRatioContainer = style({
5
- overflow: 'hidden',
6
- position: 'relative',
7
- width: '100%',
8
- height: '100%',
9
- padding: 0
4
+ export const cssReactFlow = style({
5
+ '@supports': {
6
+ // https://wojtek.im/journal/targeting-safari-with-css-media-query
7
+ '(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none)': {
8
+ // TODO: this workaround disables animations in Safari (to improve performance)
9
+ vars: {
10
+ [vars.safariAnimationHook]: ''
11
+ }
12
+ }
13
+ }
10
14
  })
11
15
 
12
- export const cssReactFlow = style({})
13
-
14
16
  globalStyle(`.react-flow${cssReactFlow}`, {
15
17
  vars: {
16
18
  [xyvars.background.color]: vars.likec4.background.color,