@likec4/diagram 1.7.1 → 1.7.3
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 +38 -22
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/globals.css.d.ts +0 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/{state/useDiagramStore.d.ts → hooks/useDiagramState.d.ts} +2 -3
- package/dist/{xyflow/hooks → hooks}/useXYFlow.d.ts +10 -10
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +755 -401
- package/dist/state/DiagramContext.d.ts +74 -30
- package/dist/state/diagram-to-xyflow.d.ts +2 -0
- package/dist/state/diagramStore.d.ts +71 -22
- package/dist/style.css +655 -35
- package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +3 -0
- package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
- package/dist/ui/top-left/_shared.d.ts +5 -0
- package/dist/ui/top-left/styles.css.d.ts +3 -0
- package/dist/xyflow/XYFlowInner.d.ts +0 -1
- package/dist/xyflow/edges/edges.css.d.ts +1 -1
- package/dist/xyflow/{hooks/useLayoutConstraints.d.ts → useLayoutConstraints.d.ts} +1 -1
- package/dist/xyflow/utils.d.ts +11 -1
- package/package.json +6 -6
- package/src/LikeC4Diagram.props.ts +66 -32
- package/src/LikeC4Diagram.tsx +19 -12
- package/src/StaticLikeC4Diagram.tsx +2 -0
- package/src/globals.css.ts +0 -2
- package/src/hooks/index.ts +2 -0
- package/src/{state/useDiagramStore.ts → hooks/useDiagramState.ts} +3 -4
- package/src/{xyflow/hooks → hooks}/useXYFlow.ts +1 -1
- package/src/index.ts +4 -2
- package/src/state/DiagramContext.tsx +15 -7
- package/src/state/diagram-to-xyflow.ts +17 -3
- package/src/state/diagramStore.ts +73 -38
- package/src/ui/DiagramTitlePanel.tsx +1 -1
- package/src/ui/DynamicViewWalkthrough.tsx +1 -2
- package/src/ui/OptionsPanel.tsx +1 -1
- package/src/ui/options/EdgeOptions.tsx +1 -16
- package/src/ui/options/NodeOptions.tsx +38 -13
- package/src/ui/top-left/ChangeAutoLayoutButton.tsx +131 -0
- package/src/ui/top-left/TopLeftPanel.tsx +213 -0
- package/src/ui/top-left/_shared.ts +19 -0
- package/src/ui/top-left/styles.css.ts +38 -0
- package/src/xyflow/FitviewOnDiagramChange.tsx +2 -2
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +87 -59
- package/src/xyflow/XYFlow.tsx +7 -8
- package/src/xyflow/XYFlowEvents.tsx +39 -19
- package/src/xyflow/XYFlowInner.tsx +5 -7
- package/src/xyflow/edges/RelationshipEdge.tsx +60 -27
- package/src/xyflow/edges/edges.css.ts +29 -25
- package/src/xyflow/nodes/compound/CompoundNode.tsx +1 -1
- package/src/xyflow/nodes/element/ElementLink.tsx +1 -2
- package/src/xyflow/nodes/element/ElementNode.tsx +7 -5
- package/src/xyflow/nodes/shared/NavigateToBtn.tsx +1 -1
- package/src/xyflow/{hooks/useLayoutConstraints.ts → useLayoutConstraints.ts} +3 -3
- package/src/xyflow/utils.ts +25 -1
- package/dist/state/hooks.d.ts +0 -4
- package/dist/state/index.d.ts +0 -2
- package/dist/state/useNavigationHistory.d.ts +0 -5
- package/dist/types.d.ts +0 -20
- package/dist/ui/BackwardForwardPanel.css.d.ts +0 -1
- package/dist/ui/BackwardForwardPanel.d.ts +0 -1
- package/dist/xyflow/hooks/index.d.ts +0 -2
- package/src/state/hooks.ts +0 -5
- package/src/state/index.ts +0 -2
- package/src/state/useNavigationHistory.ts +0 -39
- package/src/types.ts +0 -22
- package/src/ui/BackwardForwardPanel.css.ts +0 -22
- package/src/ui/BackwardForwardPanel.tsx +0 -76
- package/src/xyflow/hooks/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,
|
|
4
|
+
export declare function LikeC4Diagram({ view, className, fitView, fitViewPadding, readonly, pannable, zoomable, nodesSelectable, nodesDraggable, background, controls, showElementLinks, showDiagramTitle, enableDynamicViewWalkthrough, enableFocusMode, initialWidth, initialHeight, keepAspectRatio, experimentalEdgeEditing, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSourceElement, onOpenSourceView, onOpenSourceRelation, onBurgerMenuClick, renderIcon, where, showNavigationButtons }: LikeC4DiagramProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DiagramEdge, DiagramNode, DiagramView, Fqn, NonEmptyArray, RelationID, ViewChange, ViewID } from '@likec4/core';
|
|
2
2
|
import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
3
|
-
import { DiagramEditorCommand } from './types';
|
|
4
3
|
import { XYFlowEdge, XYFlowNode } from './xyflow/types';
|
|
5
4
|
import { XYBackground } from './xyflow/XYFlowBackground';
|
|
6
5
|
|
|
6
|
+
type EqualOperator<V> = {
|
|
7
|
+
eq: V;
|
|
8
|
+
neq?: never;
|
|
9
|
+
} | {
|
|
10
|
+
eq?: never;
|
|
11
|
+
neq: V;
|
|
12
|
+
};
|
|
13
|
+
type AllNever = {
|
|
14
|
+
not?: never;
|
|
15
|
+
and?: never;
|
|
16
|
+
or?: never;
|
|
17
|
+
tag?: never;
|
|
18
|
+
kind?: never;
|
|
19
|
+
};
|
|
20
|
+
type TagKindOperator<Tag, Kind> = Omit<AllNever, 'tag' | 'kind'> & ({
|
|
21
|
+
tag: EqualOperator<Tag>;
|
|
22
|
+
kind?: never;
|
|
23
|
+
} | {
|
|
24
|
+
tag?: never;
|
|
25
|
+
kind: EqualOperator<Kind>;
|
|
26
|
+
});
|
|
27
|
+
type NotOperator<Tag, Kind> = Omit<AllNever, 'not'> & {
|
|
28
|
+
not: TagKindOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
29
|
+
};
|
|
30
|
+
type AndOperator<Tag, Kind> = Omit<AllNever, 'and'> & {
|
|
31
|
+
and: NonEmptyArray<TagKindOperator<Tag, Kind> | OrOperator<Tag, Kind> | NotOperator<Tag, Kind>>;
|
|
32
|
+
};
|
|
33
|
+
type OrOperator<Tag, Kind> = Omit<AllNever, 'or'> & {
|
|
34
|
+
or: NonEmptyArray<TagKindOperator<Tag, Kind> | AndOperator<Tag, Kind> | NotOperator<Tag, Kind>>;
|
|
35
|
+
};
|
|
36
|
+
export type WhereOperator<Tag extends string, Kind extends string> = TagKindOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
7
37
|
export type DiagramNodeWithNavigate = Omit<DiagramNode, 'navigateTo'> & {
|
|
8
38
|
navigateTo: ViewID;
|
|
9
39
|
};
|
|
@@ -28,30 +58,12 @@ export type OnEdgeClick = (event: {
|
|
|
28
58
|
xyedge: XYFlowEdge;
|
|
29
59
|
event: ReactMouseEvent;
|
|
30
60
|
}) => void;
|
|
31
|
-
export type OnEditorCommand = (cmd: DiagramEditorCommand) => void;
|
|
32
61
|
/**
|
|
33
62
|
* On pane/canvas click (not on any node or edge)
|
|
34
63
|
*/
|
|
35
64
|
export type OnCanvasClick = (event: ReactMouseEvent) => void;
|
|
36
|
-
export declare namespace Changes {
|
|
37
|
-
interface ChangeElementStyle {
|
|
38
|
-
op: 'change-element-style';
|
|
39
|
-
style: {
|
|
40
|
-
border?: BorderStyle;
|
|
41
|
-
opacity?: number;
|
|
42
|
-
shape?: ElementShape;
|
|
43
|
-
color?: ThemeColor;
|
|
44
|
-
};
|
|
45
|
-
targets: NonEmptyArray<Fqn>;
|
|
46
|
-
}
|
|
47
|
-
interface SaveManualLayout {
|
|
48
|
-
op: 'save-manual-layout';
|
|
49
|
-
layout: ViewManualLayout;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export type Change = Changes.ChangeElementStyle | Changes.SaveManualLayout;
|
|
53
65
|
export type ChangeEvent = {
|
|
54
|
-
change:
|
|
66
|
+
change: ViewChange;
|
|
55
67
|
};
|
|
56
68
|
export type OnChange = {
|
|
57
69
|
(event: ChangeEvent): void;
|
|
@@ -148,6 +160,7 @@ export interface LikeC4DiagramProperties {
|
|
|
148
160
|
* By default, if icon is http:// or https://, it will be rendered as an image
|
|
149
161
|
*/
|
|
150
162
|
renderIcon?: ElementIconRenderer | undefined;
|
|
163
|
+
where?: WhereOperator<string, string> | undefined;
|
|
151
164
|
}
|
|
152
165
|
export interface LikeC4DiagramEventHandlers {
|
|
153
166
|
onChange?: OnChange | null | undefined;
|
|
@@ -159,6 +172,9 @@ export interface LikeC4DiagramEventHandlers {
|
|
|
159
172
|
onEdgeContextMenu?: OnEdgeClick | null | undefined;
|
|
160
173
|
onCanvasClick?: OnCanvasClick | null | undefined;
|
|
161
174
|
onCanvasDblClick?: OnCanvasClick | null | undefined;
|
|
162
|
-
|
|
175
|
+
onBurgerMenuClick?: null | undefined | (() => void);
|
|
176
|
+
onOpenSourceView?: null | undefined | (() => void);
|
|
177
|
+
onOpenSourceElement?: null | undefined | ((fqn: Fqn) => void);
|
|
178
|
+
onOpenSourceRelation?: null | undefined | ((id: RelationID) => void);
|
|
163
179
|
}
|
|
164
180
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LikeC4DiagramProperties } from './LikeC4Diagram.props';
|
|
2
2
|
|
|
3
|
-
export type StaticLikeC4DiagramProps = Pick<LikeC4DiagramProperties, 'view' | 'keepAspectRatio' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'initialWidth' | 'initialHeight' | 'renderIcon'>;
|
|
3
|
+
export type StaticLikeC4DiagramProps = Pick<LikeC4DiagramProperties, 'view' | 'keepAspectRatio' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'initialWidth' | 'initialHeight' | 'renderIcon' | 'where'>;
|
|
4
4
|
export declare function StaticLikeC4Diagram({ view, fitView, fitViewPadding, background, ...rest }: StaticLikeC4DiagramProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/globals.css.d.ts
CHANGED
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DiagramState } from './diagramStore';
|
|
1
|
+
import { DiagramState, DiagramStoreApi } from '../state/diagramStore';
|
|
3
2
|
|
|
4
3
|
declare function useDiagramState<StateSlice = unknown>(selector: (state: DiagramState) => StateSlice, equalityFn?: (a: StateSlice, b: StateSlice) => boolean): StateSlice;
|
|
5
|
-
export type DiagramStoreApi = Readonly<Pick<DiagramZustandStore, 'getState' | 'setState' | 'subscribe'>>;
|
|
6
4
|
declare function useDiagramStoreApi(): DiagramStoreApi;
|
|
5
|
+
export type { DiagramState, DiagramStoreApi };
|
|
7
6
|
export { useDiagramState, useDiagramStoreApi };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { XYFlowEdge, XYFlowNode, XYFlowState } from '../types';
|
|
1
|
+
import { XYFlowEdge, XYFlowNode, XYFlowState } from '../xyflow/types';
|
|
2
2
|
|
|
3
3
|
export declare const useXYFlow: () => import('@xyflow/react').ReactFlowInstance<XYFlowNode, {
|
|
4
4
|
id: string;
|
|
@@ -11,7 +11,7 @@ export declare const useXYFlow: () => import('@xyflow/react').ReactFlowInstance<
|
|
|
11
11
|
hidden?: boolean;
|
|
12
12
|
deletable?: boolean;
|
|
13
13
|
selectable?: boolean;
|
|
14
|
-
data: import('../types').RelationshipData;
|
|
14
|
+
data: import('../xyflow/types').RelationshipData;
|
|
15
15
|
selected?: boolean;
|
|
16
16
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
17
17
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -46,7 +46,7 @@ export declare const useXYStoreApi: () => {
|
|
|
46
46
|
hidden?: boolean;
|
|
47
47
|
deletable?: boolean;
|
|
48
48
|
selectable?: boolean;
|
|
49
|
-
data: import('../types').RelationshipData;
|
|
49
|
+
data: import('../xyflow/types').RelationshipData;
|
|
50
50
|
selected?: boolean;
|
|
51
51
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
52
52
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -75,7 +75,7 @@ export declare const useXYStoreApi: () => {
|
|
|
75
75
|
hidden?: boolean;
|
|
76
76
|
deletable?: boolean;
|
|
77
77
|
selectable?: boolean;
|
|
78
|
-
data: import('../types').RelationshipData;
|
|
78
|
+
data: import('../xyflow/types').RelationshipData;
|
|
79
79
|
selected?: boolean;
|
|
80
80
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
81
81
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -103,7 +103,7 @@ export declare const useXYStoreApi: () => {
|
|
|
103
103
|
hidden?: boolean;
|
|
104
104
|
deletable?: boolean;
|
|
105
105
|
selectable?: boolean;
|
|
106
|
-
data: import('../types').RelationshipData;
|
|
106
|
+
data: import('../xyflow/types').RelationshipData;
|
|
107
107
|
selected?: boolean;
|
|
108
108
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
109
109
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -131,7 +131,7 @@ export declare const useXYStoreApi: () => {
|
|
|
131
131
|
hidden?: boolean;
|
|
132
132
|
deletable?: boolean;
|
|
133
133
|
selectable?: boolean;
|
|
134
|
-
data: import('../types').RelationshipData;
|
|
134
|
+
data: import('../xyflow/types').RelationshipData;
|
|
135
135
|
selected?: boolean;
|
|
136
136
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
137
137
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -159,7 +159,7 @@ export declare const useXYStoreApi: () => {
|
|
|
159
159
|
hidden?: boolean;
|
|
160
160
|
deletable?: boolean;
|
|
161
161
|
selectable?: boolean;
|
|
162
|
-
data: import('../types').RelationshipData;
|
|
162
|
+
data: import('../xyflow/types').RelationshipData;
|
|
163
163
|
selected?: boolean;
|
|
164
164
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
165
165
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -187,7 +187,7 @@ export declare const useXYStoreApi: () => {
|
|
|
187
187
|
hidden?: boolean;
|
|
188
188
|
deletable?: boolean;
|
|
189
189
|
selectable?: boolean;
|
|
190
|
-
data: import('../types').RelationshipData;
|
|
190
|
+
data: import('../xyflow/types').RelationshipData;
|
|
191
191
|
selected?: boolean;
|
|
192
192
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
193
193
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -216,7 +216,7 @@ export declare const useXYStoreApi: () => {
|
|
|
216
216
|
hidden?: boolean;
|
|
217
217
|
deletable?: boolean;
|
|
218
218
|
selectable?: boolean;
|
|
219
|
-
data: import('../types').RelationshipData;
|
|
219
|
+
data: import('../xyflow/types').RelationshipData;
|
|
220
220
|
selected?: boolean;
|
|
221
221
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
222
222
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
|
@@ -244,7 +244,7 @@ export declare const useXYStoreApi: () => {
|
|
|
244
244
|
hidden?: boolean;
|
|
245
245
|
deletable?: boolean;
|
|
246
246
|
selectable?: boolean;
|
|
247
|
-
data: import('../types').RelationshipData;
|
|
247
|
+
data: import('../xyflow/types').RelationshipData;
|
|
248
248
|
selected?: boolean;
|
|
249
249
|
markerStart?: import('@xyflow/react').EdgeMarkerType;
|
|
250
250
|
markerEnd?: import('@xyflow/react').EdgeMarkerType;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
|
|
1
2
|
export { LikeC4Diagram } from './LikeC4Diagram';
|
|
2
3
|
export { StaticLikeC4Diagram } from './StaticLikeC4Diagram';
|
|
3
|
-
export { useSetState
|
|
4
|
+
export { useSetState } from './hooks/useSetState';
|
|
5
|
+
export { useUpdateEffect } from './hooks/useUpdateEffect';
|
|
4
6
|
export type * from './LikeC4Diagram';
|
|
5
7
|
export type * from './LikeC4Diagram.props';
|
|
6
8
|
export type * from './StaticLikeC4Diagram';
|
|
7
|
-
export type * from './types';
|
|
8
9
|
export type * from './xyflow/types';
|