@likec4/diagram 1.2.2 → 1.3.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 +21 -3
- package/dist/index.mjs +1335 -1240
- package/dist/state/DiagramContext.d.ts +2263 -175
- package/dist/state/diagramStore.d.ts +2272 -180
- package/dist/state/useDiagramStore.d.ts +2409 -321
- package/dist/style.css +123 -92
- package/dist/theme.css.d.ts +0 -1
- package/dist/ui/OptionsPanel.d.ts +3 -1
- package/dist/xyflow/XYFlow.d.ts +2 -1
- package/dist/xyflow/XYFlowInner.d.ts +1 -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 +3 -4
- package/dist/xyflow/edges/utils.d.ts +4 -2
- 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/index.d.ts +1 -1
- package/dist/xyflow/types.d.ts +2 -2
- package/dist/xyflow/utils.d.ts +3 -0
- package/package.json +15 -14
- package/src/LikeC4Diagram.css.ts +4 -4
- package/src/LikeC4Diagram.props.ts +23 -2
- package/src/LikeC4Diagram.tsx +79 -31
- package/src/globals.css.ts +0 -1
- package/src/mantine/theme.ts +1 -0
- package/src/state/DiagramContext.tsx +0 -1
- package/src/state/diagramStore.ts +177 -100
- package/src/theme.css.ts +0 -1
- package/src/ui/DiagramTitlePanel.tsx +3 -3
- package/src/ui/DynamicViewWalkthrough.css.ts +3 -2
- package/src/ui/DynamicViewWalkthrough.tsx +36 -17
- package/src/ui/OptionsPanel.tsx +12 -12
- 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 +5 -4
- package/src/xyflow/const.ts +1 -1
- package/src/xyflow/diagram-to-xyflow.ts +5 -31
- package/src/xyflow/edges/RelationshipEdge.tsx +158 -112
- package/src/xyflow/edges/edges.css.ts +32 -21
- package/src/xyflow/edges/utils.ts +5 -2
- package/src/xyflow/hooks/useLayoutConstraints.ts +17 -3
- package/src/xyflow/nodes/compound/CompoundNode.css.ts +40 -32
- package/src/xyflow/nodes/compound/CompoundNode.tsx +36 -26
- package/src/xyflow/nodes/element/ElementNode.tsx +20 -6
- package/src/xyflow/nodes/element/element.css.ts +15 -15
- 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, 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';
|
|
@@ -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;
|
|
@@ -113,6 +126,11 @@ export interface LikeC4DiagramProperties {
|
|
|
113
126
|
* @default false
|
|
114
127
|
*/
|
|
115
128
|
enableDynamicViewWalkthrough?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Experimental feature to enable edge editing
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
experimentalEdgeEditing?: boolean | undefined;
|
|
116
134
|
}
|
|
117
135
|
export interface LikeC4DiagramEventHandlers {
|
|
118
136
|
onChange?: OnChange | null | undefined;
|