@likec4/diagram 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.props.d.ts +27 -4
- package/dist/index.mjs +1543 -1346
- package/dist/state/DiagramContext.d.ts +2353 -264
- package/dist/state/diagramStore.d.ts +2360 -268
- package/dist/state/index.d.ts +0 -1
- package/dist/state/useDiagramStore.d.ts +3 -2534
- package/dist/state/useNavigationHistory.d.ts +5 -0
- package/dist/style.css +194 -131
- package/dist/theme.css.d.ts +5 -1
- package/dist/ui/BackwardForwardPanel.css.d.ts +1 -0
- package/dist/ui/BackwardForwardPanel.d.ts +1 -0
- package/dist/ui/DiagramTitlePanel.css.d.ts +1 -1
- package/dist/xyflow/XYFlow.d.ts +2 -1
- package/dist/xyflow/XYFlowEvents.d.ts +4 -4
- package/dist/xyflow/XYFlowInner.d.ts +2 -1
- package/dist/xyflow/const.d.ts +1 -1
- package/dist/xyflow/diagram-to-xyflow.d.ts +1 -1
- package/dist/xyflow/edges/RelationshipEdge.d.ts +4 -5
- package/dist/xyflow/edges/utils.d.ts +4 -2
- package/dist/xyflow/hooks/useXYFlow.d.ts +9 -9
- package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +3 -1
- package/dist/xyflow/nodes/element/ElementNode.d.ts +1 -1
- package/dist/xyflow/nodes/element/element.css.d.ts +1 -0
- package/dist/xyflow/nodes/element/index.d.ts +1 -1
- package/dist/xyflow/types.d.ts +3 -3
- package/dist/xyflow/utils.d.ts +3 -0
- package/package.json +18 -17
- package/src/LikeC4Diagram.css.ts +15 -5
- package/src/LikeC4Diagram.props.ts +33 -5
- package/src/LikeC4Diagram.tsx +103 -32
- package/src/globals.css.ts +1 -2
- package/src/mantine/theme.ts +1 -0
- package/src/state/DiagramContext.tsx +3 -4
- package/src/state/diagramStore.ts +177 -103
- package/src/state/index.ts +0 -1
- package/src/state/useDiagramStore.ts +6 -13
- package/src/state/useNavigationHistory.ts +39 -0
- package/src/theme.css.ts +5 -1
- package/src/ui/BackwardForwardPanel.css.ts +22 -0
- package/src/ui/BackwardForwardPanel.tsx +59 -0
- package/src/ui/DiagramTitlePanel.css.ts +11 -5
- package/src/ui/DiagramTitlePanel.tsx +108 -96
- package/src/ui/DynamicViewWalkthrough.css.ts +3 -2
- package/src/ui/DynamicViewWalkthrough.tsx +36 -17
- package/src/ui/OptionsPanel.tsx +28 -19
- package/src/ui/options/NodeOptions.tsx +16 -19
- package/src/xyflow/FitviewOnDiagramChange.tsx +15 -23
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -6
- package/src/xyflow/SyncWithDiagram.tsx +21 -2
- package/src/xyflow/XYFlow.tsx +20 -23
- package/src/xyflow/XYFlowEvents.tsx +26 -8
- package/src/xyflow/XYFlowInner.tsx +10 -6
- package/src/xyflow/const.ts +1 -1
- package/src/xyflow/diagram-to-xyflow.ts +4 -41
- package/src/xyflow/edges/RelationshipEdge.tsx +160 -111
- package/src/xyflow/edges/edges.css.ts +41 -26
- package/src/xyflow/edges/utils.ts +5 -2
- package/src/xyflow/hooks/useLayoutConstraints.ts +19 -4
- package/src/xyflow/nodes/compound/CompoundNode.css.ts +45 -37
- package/src/xyflow/nodes/compound/CompoundNode.tsx +36 -26
- package/src/xyflow/nodes/element/ElementNode.tsx +27 -14
- package/src/xyflow/nodes/element/element.css.ts +31 -18
- package/src/xyflow/nodes/element/index.ts +1 -1
- package/src/xyflow/nodes/shared/NavigateToBtn.tsx +7 -3
- package/src/xyflow/types.ts +5 -2
- package/src/xyflow/utils.ts +48 -0
- package/dist/ui/index.d.ts +0 -2
- package/src/ui/index.ts +0 -3
package/dist/LikeC4Diagram.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LikeC4DiagramEventHandlers, LikeC4DiagramProperties } from './LikeC4Diagram.props';
|
|
2
2
|
|
|
3
3
|
export type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers;
|
|
4
|
-
export declare function LikeC4Diagram({ view, className, fitView, fitViewPadding, readonly, pannable, zoomable, nodesSelectable, nodesDraggable, background, controls, showElementLinks, showDiagramTitle, enableDynamicViewWalkthrough, initialWidth, initialHeight, keepAspectRatio, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu }: LikeC4DiagramProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function LikeC4Diagram({ view, className, fitView, fitViewPadding, readonly, pannable, zoomable, nodesSelectable, nodesDraggable, background, controls, showElementLinks, showDiagramTitle, showNavigationButtons, enableDynamicViewWalkthrough, initialWidth, initialHeight, keepAspectRatio, experimentalEdgeEditing, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu }: LikeC4DiagramProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BorderStyle, DiagramEdge, DiagramNode, DiagramView, ElementShape, Fqn, NonEmptyArray, ThemeColor, ViewID } from '@likec4/core';
|
|
1
|
+
import { BorderStyle, DiagramEdge, DiagramNode, DiagramView, EdgeId, ElementShape, Fqn, NonEmptyArray, ThemeColor, ViewID } from '@likec4/core';
|
|
2
|
+
import { XYPosition } from '@xyflow/system';
|
|
2
3
|
import { MouseEvent as ReactMouseEvent } from 'react';
|
|
3
4
|
import { SetRequired, Simplify } from 'type-fest';
|
|
4
5
|
import { XYFlowEdge, XYFlowNode } from './xyflow/types';
|
|
@@ -6,7 +7,7 @@ import { XYBackground } from './xyflow/XYFlowBackground';
|
|
|
6
7
|
|
|
7
8
|
export type DiagramNodeWithNavigate = Simplify<SetRequired<DiagramNode, 'navigateTo'>>;
|
|
8
9
|
export type OnNavigateTo = {
|
|
9
|
-
(to: ViewID, event
|
|
10
|
+
(to: ViewID, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate, xynode?: XYFlowNode): void;
|
|
10
11
|
};
|
|
11
12
|
export type OnNodeClick = (event: {
|
|
12
13
|
element: DiagramNode;
|
|
@@ -33,10 +34,22 @@ export declare namespace Changes {
|
|
|
33
34
|
};
|
|
34
35
|
targets: NonEmptyArray<Fqn>;
|
|
35
36
|
}
|
|
37
|
+
interface SaveManualLayout {
|
|
38
|
+
op: 'save-manual-layout';
|
|
39
|
+
nodes: Record<Fqn, {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}>;
|
|
45
|
+
edges: Record<EdgeId, {
|
|
46
|
+
controlPoints: XYPosition[];
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
36
49
|
}
|
|
37
|
-
export type Change = Changes.ChangeElementStyle;
|
|
50
|
+
export type Change = Changes.ChangeElementStyle | Changes.SaveManualLayout;
|
|
38
51
|
export type ChangeEvent = {
|
|
39
|
-
|
|
52
|
+
change: Change;
|
|
40
53
|
};
|
|
41
54
|
export type OnChange = {
|
|
42
55
|
(event: ChangeEvent): void;
|
|
@@ -108,11 +121,21 @@ export interface LikeC4DiagramProperties {
|
|
|
108
121
|
* @default true
|
|
109
122
|
*/
|
|
110
123
|
showDiagramTitle?: boolean | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Show back/forward navigation buttons
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
showNavigationButtons?: undefined | boolean;
|
|
111
129
|
/**
|
|
112
130
|
* If Walkthrough for dynamic views should be enabled
|
|
113
131
|
* @default false
|
|
114
132
|
*/
|
|
115
133
|
enableDynamicViewWalkthrough?: boolean | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Experimental feature to enable edge editing
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
experimentalEdgeEditing?: boolean | undefined;
|
|
116
139
|
}
|
|
117
140
|
export interface LikeC4DiagramEventHandlers {
|
|
118
141
|
onChange?: OnChange | null | undefined;
|