@likec4/diagram 1.6.1 → 1.7.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 +10 -11
- package/dist/hooks/useUpdateEffect.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +572 -464
- package/dist/state/DiagramContext.d.ts +746 -181
- package/dist/state/diagram-to-xyflow.d.ts +10 -0
- package/dist/state/diagramStore.d.ts +782 -202
- package/dist/style.css +273 -275
- package/dist/types.d.ts +20 -0
- package/dist/xyflow/EdgeMarkers.d.ts +1 -0
- package/dist/xyflow/FitviewOnDiagramChange.d.ts +1 -1
- package/dist/xyflow/XYFlow.d.ts +1 -4
- package/dist/xyflow/XYFlowEvents.d.ts +41 -12
- package/dist/xyflow/XYFlowInner.d.ts +0 -1
- package/dist/xyflow/edges/RelationshipEdge.d.ts +3 -3
- package/dist/xyflow/hooks/index.d.ts +0 -1
- package/dist/xyflow/hooks/useXYFlow.d.ts +27 -27
- package/dist/xyflow/types.d.ts +11 -19
- package/dist/xyflow/utils.d.ts +1 -0
- package/package.json +6 -6
- package/src/LikeC4Diagram.props.ts +17 -13
- package/src/LikeC4Diagram.tsx +62 -96
- package/src/globals.css.ts +10 -6
- package/src/hooks/useUpdateEffect.ts +16 -1
- package/src/index.ts +1 -0
- package/src/state/DiagramContext.tsx +19 -27
- package/src/{xyflow → state}/diagram-to-xyflow.ts +19 -18
- package/src/state/diagramStore.ts +404 -192
- package/src/types.ts +22 -0
- package/src/ui/BackwardForwardPanel.tsx +24 -7
- package/src/xyflow/EdgeMarkers.tsx +2 -0
- package/src/xyflow/FitviewOnDiagramChange.tsx +42 -75
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +1 -1
- package/src/xyflow/XYFlow.tsx +57 -32
- package/src/xyflow/XYFlowEvents.tsx +58 -10
- package/src/xyflow/XYFlowInner.tsx +8 -8
- package/src/xyflow/edges/RelationshipEdge.tsx +43 -29
- package/src/xyflow/edges/edges.css.ts +3 -3
- package/src/xyflow/edges/utils.ts +0 -1
- package/src/xyflow/hooks/index.ts +0 -1
- package/src/xyflow/hooks/useLayoutConstraints.ts +42 -65
- package/src/xyflow/nodes/element/ElementNode.tsx +0 -4
- package/src/xyflow/nodes/element/element.css.ts +8 -6
- package/src/xyflow/types.ts +14 -32
- package/src/xyflow/utils.ts +4 -0
- package/dist/xyflow/SyncWithDiagram.d.ts +0 -4
- package/dist/xyflow/diagram-to-xyflow.d.ts +0 -7
- package/src/xyflow/SyncWithDiagram.tsx +0 -85
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, showNavigationButtons, enableDynamicViewWalkthrough, initialWidth, initialHeight, keepAspectRatio, experimentalEdgeEditing, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, renderIcon }: 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, enableFocusMode, initialWidth, initialHeight, keepAspectRatio, experimentalEdgeEditing, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onEditorCommand, renderIcon }: LikeC4DiagramProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BorderStyle, DiagramEdge, DiagramNode, DiagramView,
|
|
2
|
-
import { XYPosition } from '@xyflow/system';
|
|
1
|
+
import { BorderStyle, DiagramEdge, DiagramNode, DiagramView, ElementShape, Fqn, NonEmptyArray, ThemeColor, ViewID, ViewManualLayout } from '@likec4/core';
|
|
3
2
|
import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
3
|
+
import { DiagramEditorCommand } from './types';
|
|
4
4
|
import { XYFlowEdge, XYFlowNode } from './xyflow/types';
|
|
5
5
|
import { XYBackground } from './xyflow/XYFlowBackground';
|
|
6
6
|
|
|
@@ -28,6 +28,7 @@ export type OnEdgeClick = (event: {
|
|
|
28
28
|
xyedge: XYFlowEdge;
|
|
29
29
|
event: ReactMouseEvent;
|
|
30
30
|
}) => void;
|
|
31
|
+
export type OnEditorCommand = (cmd: DiagramEditorCommand) => void;
|
|
31
32
|
/**
|
|
32
33
|
* On pane/canvas click (not on any node or edge)
|
|
33
34
|
*/
|
|
@@ -45,15 +46,7 @@ export declare namespace Changes {
|
|
|
45
46
|
}
|
|
46
47
|
interface SaveManualLayout {
|
|
47
48
|
op: 'save-manual-layout';
|
|
48
|
-
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
width: number;
|
|
52
|
-
height: number;
|
|
53
|
-
}>;
|
|
54
|
-
edges: Record<EdgeId, {
|
|
55
|
-
controlPoints: XYPosition[];
|
|
56
|
-
}>;
|
|
49
|
+
layout: ViewManualLayout;
|
|
57
50
|
}
|
|
58
51
|
}
|
|
59
52
|
export type Change = Changes.ChangeElementStyle | Changes.SaveManualLayout;
|
|
@@ -135,6 +128,11 @@ export interface LikeC4DiagramProperties {
|
|
|
135
128
|
* @default false
|
|
136
129
|
*/
|
|
137
130
|
showNavigationButtons?: undefined | boolean;
|
|
131
|
+
/**
|
|
132
|
+
* If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
|
|
133
|
+
* @default true
|
|
134
|
+
*/
|
|
135
|
+
enableFocusMode?: boolean | undefined;
|
|
138
136
|
/**
|
|
139
137
|
* If Walkthrough for dynamic views should be enabled
|
|
140
138
|
* @default false
|
|
@@ -161,5 +159,6 @@ export interface LikeC4DiagramEventHandlers {
|
|
|
161
159
|
onEdgeContextMenu?: OnEdgeClick | null | undefined;
|
|
162
160
|
onCanvasClick?: OnCanvasClick | null | undefined;
|
|
163
161
|
onCanvasDblClick?: OnCanvasClick | null | undefined;
|
|
162
|
+
onEditorCommand?: OnEditorCommand | null | undefined;
|
|
164
163
|
}
|
|
165
164
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DependenciesComparator, EffectHook } from '@react-hookz/web';
|
|
2
2
|
import { DependencyList, EffectCallback } from 'react';
|
|
3
3
|
|
|
4
|
+
export declare const depsShallowEqual: DependenciesComparator;
|
|
4
5
|
export declare function useUpdateEffect<Callback extends EffectCallback = EffectCallback, Deps extends DependencyList = DependencyList>(callback: Callback, deps: Deps, equalityFn?: DependenciesComparator<Deps>, effectHook?: EffectHook<Callback, Deps>): void;
|
package/dist/index.d.ts
CHANGED