@likec4/diagram 1.7.2 → 1.7.4
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/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 +2 -2
- package/dist/index.mjs +818 -448
- 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 +58 -37
- 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/const.d.ts +1 -0
- 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/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 +2 -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.css.ts +2 -2
- package/src/ui/DiagramTitlePanel.tsx +62 -44
- 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 +11 -10
- package/src/xyflow/XYFlowEvents.tsx +44 -18
- package/src/xyflow/XYFlowInner.tsx +5 -7
- package/src/xyflow/const.ts +1 -0
- 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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DiagramNode, DiagramView, Fqn, NodeId, ViewID } from '@likec4/core';
|
|
1
|
+
import { DiagramNode, DiagramView, Fqn, NodeId, ViewChange, ViewID } from '@likec4/core';
|
|
2
2
|
import { OnEdgesChange, OnNodesChange } from '@xyflow/react';
|
|
3
3
|
import { MouseEvent as ReactMouseEvent } from 'react';
|
|
4
4
|
import { Exact, Simplify } from 'type-fest';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { XYStoreApi } from '../hooks/useXYFlow';
|
|
6
|
+
import { ElementIconRenderer, LikeC4DiagramEventHandlers, WhereOperator } from '../LikeC4Diagram.props';
|
|
7
7
|
import { XYFlowEdge, XYFlowInstance, XYFlowNode } from '../xyflow/types';
|
|
8
8
|
|
|
9
9
|
type RequiredOrNull<T> = {
|
|
@@ -13,6 +13,7 @@ export type DiagramInitialState = {
|
|
|
13
13
|
view: DiagramView;
|
|
14
14
|
readonly: boolean;
|
|
15
15
|
showElementLinks: boolean;
|
|
16
|
+
showNavigationButtons: boolean;
|
|
16
17
|
fitViewEnabled: boolean;
|
|
17
18
|
fitViewPadding: number;
|
|
18
19
|
zoomable: boolean;
|
|
@@ -22,6 +23,7 @@ export type DiagramInitialState = {
|
|
|
22
23
|
experimentalEdgeEditing: boolean;
|
|
23
24
|
enableFocusMode: boolean;
|
|
24
25
|
renderIcon: ElementIconRenderer | null;
|
|
26
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
25
27
|
enableDynamicViewWalkthrough: boolean;
|
|
26
28
|
xyflow: XYFlowInstance;
|
|
27
29
|
xystore: XYStoreApi;
|
|
@@ -60,7 +62,7 @@ export type DiagramState = Simplify<DiagramInitialState & {
|
|
|
60
62
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
61
63
|
resetLastClicked: () => void;
|
|
62
64
|
getElement(id: Fqn): DiagramNode | null;
|
|
63
|
-
triggerChangeElementStyle: (change:
|
|
65
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
64
66
|
/**
|
|
65
67
|
* @returns true if there was pending save layout
|
|
66
68
|
*/
|
|
@@ -82,6 +84,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
82
84
|
view: DiagramView;
|
|
83
85
|
readonly: boolean;
|
|
84
86
|
showElementLinks: boolean;
|
|
87
|
+
showNavigationButtons: boolean;
|
|
85
88
|
fitViewEnabled: boolean;
|
|
86
89
|
fitViewPadding: number;
|
|
87
90
|
zoomable: boolean;
|
|
@@ -91,6 +94,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
91
94
|
experimentalEdgeEditing: boolean;
|
|
92
95
|
enableFocusMode: boolean;
|
|
93
96
|
renderIcon: ElementIconRenderer | null;
|
|
97
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
94
98
|
enableDynamicViewWalkthrough: boolean;
|
|
95
99
|
xyflow: XYFlowInstance;
|
|
96
100
|
xystore: XYStoreApi;
|
|
@@ -104,7 +108,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
104
108
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
105
109
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
106
110
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
107
|
-
|
|
111
|
+
onBurgerMenuClick: (() => void) | null;
|
|
112
|
+
onOpenSourceView: (() => void) | null;
|
|
113
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
114
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
108
115
|
readonly storeDevId: string;
|
|
109
116
|
xynodes: XYFlowNode[];
|
|
110
117
|
xyedges: XYFlowEdge[];
|
|
@@ -137,7 +144,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
137
144
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
138
145
|
resetLastClicked: () => void;
|
|
139
146
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
140
|
-
triggerChangeElementStyle: (change:
|
|
147
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
141
148
|
cancelSaveManualLayout: () => boolean;
|
|
142
149
|
scheduleSaveManualLayout: () => void;
|
|
143
150
|
triggerSaveManualLayout: () => void;
|
|
@@ -157,6 +164,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
157
164
|
view: DiagramView;
|
|
158
165
|
readonly: boolean;
|
|
159
166
|
showElementLinks: boolean;
|
|
167
|
+
showNavigationButtons: boolean;
|
|
160
168
|
fitViewEnabled: boolean;
|
|
161
169
|
fitViewPadding: number;
|
|
162
170
|
zoomable: boolean;
|
|
@@ -166,6 +174,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
166
174
|
experimentalEdgeEditing: boolean;
|
|
167
175
|
enableFocusMode: boolean;
|
|
168
176
|
renderIcon: ElementIconRenderer | null;
|
|
177
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
169
178
|
enableDynamicViewWalkthrough: boolean;
|
|
170
179
|
xyflow: XYFlowInstance;
|
|
171
180
|
xystore: XYStoreApi;
|
|
@@ -179,7 +188,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
179
188
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
180
189
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
181
190
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
182
|
-
|
|
191
|
+
onBurgerMenuClick: (() => void) | null;
|
|
192
|
+
onOpenSourceView: (() => void) | null;
|
|
193
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
194
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
183
195
|
readonly storeDevId: string;
|
|
184
196
|
xynodes: XYFlowNode[];
|
|
185
197
|
xyedges: {
|
|
@@ -240,7 +252,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
240
252
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
241
253
|
resetLastClicked: () => void;
|
|
242
254
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
243
|
-
triggerChangeElementStyle: (change:
|
|
255
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
244
256
|
cancelSaveManualLayout: () => boolean;
|
|
245
257
|
scheduleSaveManualLayout: () => void;
|
|
246
258
|
triggerSaveManualLayout: () => void;
|
|
@@ -286,6 +298,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
286
298
|
view: DiagramView;
|
|
287
299
|
readonly: boolean;
|
|
288
300
|
showElementLinks: boolean;
|
|
301
|
+
showNavigationButtons: boolean;
|
|
289
302
|
fitViewEnabled: boolean;
|
|
290
303
|
fitViewPadding: number;
|
|
291
304
|
zoomable: boolean;
|
|
@@ -295,6 +308,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
295
308
|
experimentalEdgeEditing: boolean;
|
|
296
309
|
enableFocusMode: boolean;
|
|
297
310
|
renderIcon: ElementIconRenderer | null;
|
|
311
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
298
312
|
enableDynamicViewWalkthrough: boolean;
|
|
299
313
|
xyflow: XYFlowInstance;
|
|
300
314
|
xystore: XYStoreApi;
|
|
@@ -308,7 +322,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
308
322
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
309
323
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
310
324
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
311
|
-
|
|
325
|
+
onBurgerMenuClick: (() => void) | null;
|
|
326
|
+
onOpenSourceView: (() => void) | null;
|
|
327
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
328
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
312
329
|
readonly storeDevId: string;
|
|
313
330
|
xynodes: XYFlowNode[];
|
|
314
331
|
xyedges: {
|
|
@@ -369,7 +386,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
369
386
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
370
387
|
resetLastClicked: () => void;
|
|
371
388
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
372
|
-
triggerChangeElementStyle: (change:
|
|
389
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
373
390
|
cancelSaveManualLayout: () => boolean;
|
|
374
391
|
scheduleSaveManualLayout: () => void;
|
|
375
392
|
triggerSaveManualLayout: () => void;
|
|
@@ -416,6 +433,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
416
433
|
view: DiagramView;
|
|
417
434
|
readonly: boolean;
|
|
418
435
|
showElementLinks: boolean;
|
|
436
|
+
showNavigationButtons: boolean;
|
|
419
437
|
fitViewEnabled: boolean;
|
|
420
438
|
fitViewPadding: number;
|
|
421
439
|
zoomable: boolean;
|
|
@@ -425,6 +443,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
425
443
|
experimentalEdgeEditing: boolean;
|
|
426
444
|
enableFocusMode: boolean;
|
|
427
445
|
renderIcon: ElementIconRenderer | null;
|
|
446
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
428
447
|
enableDynamicViewWalkthrough: boolean;
|
|
429
448
|
xyflow: XYFlowInstance;
|
|
430
449
|
xystore: XYStoreApi;
|
|
@@ -438,7 +457,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
438
457
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
439
458
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
440
459
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
441
|
-
|
|
460
|
+
onBurgerMenuClick: (() => void) | null;
|
|
461
|
+
onOpenSourceView: (() => void) | null;
|
|
462
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
463
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
442
464
|
readonly storeDevId: string;
|
|
443
465
|
xynodes: XYFlowNode[];
|
|
444
466
|
xyedges: {
|
|
@@ -499,7 +521,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
499
521
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
500
522
|
resetLastClicked: () => void;
|
|
501
523
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
502
|
-
triggerChangeElementStyle: (change:
|
|
524
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
503
525
|
cancelSaveManualLayout: () => boolean;
|
|
504
526
|
scheduleSaveManualLayout: () => void;
|
|
505
527
|
triggerSaveManualLayout: () => void;
|
|
@@ -553,6 +575,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
553
575
|
view: DiagramView;
|
|
554
576
|
readonly: boolean;
|
|
555
577
|
showElementLinks: boolean;
|
|
578
|
+
showNavigationButtons: boolean;
|
|
556
579
|
fitViewEnabled: boolean;
|
|
557
580
|
fitViewPadding: number;
|
|
558
581
|
zoomable: boolean;
|
|
@@ -562,6 +585,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
562
585
|
experimentalEdgeEditing: boolean;
|
|
563
586
|
enableFocusMode: boolean;
|
|
564
587
|
renderIcon: ElementIconRenderer | null;
|
|
588
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
565
589
|
enableDynamicViewWalkthrough: boolean;
|
|
566
590
|
xyflow: XYFlowInstance;
|
|
567
591
|
xystore: XYStoreApi;
|
|
@@ -575,7 +599,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
575
599
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
576
600
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
577
601
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
578
|
-
|
|
602
|
+
onBurgerMenuClick: (() => void) | null;
|
|
603
|
+
onOpenSourceView: (() => void) | null;
|
|
604
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
605
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
579
606
|
readonly storeDevId: string;
|
|
580
607
|
xynodes: XYFlowNode[];
|
|
581
608
|
xyedges: {
|
|
@@ -636,7 +663,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
636
663
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
637
664
|
resetLastClicked: () => void;
|
|
638
665
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
639
|
-
triggerChangeElementStyle: (change:
|
|
666
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
640
667
|
cancelSaveManualLayout: () => boolean;
|
|
641
668
|
scheduleSaveManualLayout: () => void;
|
|
642
669
|
triggerSaveManualLayout: () => void;
|
|
@@ -682,6 +709,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
682
709
|
view: DiagramView;
|
|
683
710
|
readonly: boolean;
|
|
684
711
|
showElementLinks: boolean;
|
|
712
|
+
showNavigationButtons: boolean;
|
|
685
713
|
fitViewEnabled: boolean;
|
|
686
714
|
fitViewPadding: number;
|
|
687
715
|
zoomable: boolean;
|
|
@@ -691,6 +719,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
691
719
|
experimentalEdgeEditing: boolean;
|
|
692
720
|
enableFocusMode: boolean;
|
|
693
721
|
renderIcon: ElementIconRenderer | null;
|
|
722
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
694
723
|
enableDynamicViewWalkthrough: boolean;
|
|
695
724
|
xyflow: XYFlowInstance;
|
|
696
725
|
xystore: XYStoreApi;
|
|
@@ -704,7 +733,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
704
733
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
705
734
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
706
735
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
707
|
-
|
|
736
|
+
onBurgerMenuClick: (() => void) | null;
|
|
737
|
+
onOpenSourceView: (() => void) | null;
|
|
738
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
739
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
708
740
|
readonly storeDevId: string;
|
|
709
741
|
xynodes: XYFlowNode[];
|
|
710
742
|
xyedges: {
|
|
@@ -765,7 +797,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
765
797
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
766
798
|
resetLastClicked: () => void;
|
|
767
799
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
768
|
-
triggerChangeElementStyle: (change:
|
|
800
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
769
801
|
cancelSaveManualLayout: () => boolean;
|
|
770
802
|
scheduleSaveManualLayout: () => void;
|
|
771
803
|
triggerSaveManualLayout: () => void;
|
|
@@ -811,6 +843,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
811
843
|
view: DiagramView;
|
|
812
844
|
readonly: boolean;
|
|
813
845
|
showElementLinks: boolean;
|
|
846
|
+
showNavigationButtons: boolean;
|
|
814
847
|
fitViewEnabled: boolean;
|
|
815
848
|
fitViewPadding: number;
|
|
816
849
|
zoomable: boolean;
|
|
@@ -820,6 +853,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
820
853
|
experimentalEdgeEditing: boolean;
|
|
821
854
|
enableFocusMode: boolean;
|
|
822
855
|
renderIcon: ElementIconRenderer | null;
|
|
856
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
823
857
|
enableDynamicViewWalkthrough: boolean;
|
|
824
858
|
xyflow: XYFlowInstance;
|
|
825
859
|
xystore: XYStoreApi;
|
|
@@ -833,7 +867,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
833
867
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
834
868
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
835
869
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
836
|
-
|
|
870
|
+
onBurgerMenuClick: (() => void) | null;
|
|
871
|
+
onOpenSourceView: (() => void) | null;
|
|
872
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
873
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
837
874
|
readonly storeDevId: string;
|
|
838
875
|
xynodes: XYFlowNode[];
|
|
839
876
|
xyedges: {
|
|
@@ -894,7 +931,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
894
931
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
895
932
|
resetLastClicked: () => void;
|
|
896
933
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
897
|
-
triggerChangeElementStyle: (change:
|
|
934
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
898
935
|
cancelSaveManualLayout: () => boolean;
|
|
899
936
|
scheduleSaveManualLayout: () => void;
|
|
900
937
|
triggerSaveManualLayout: () => void;
|
|
@@ -940,6 +977,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
940
977
|
view: DiagramView;
|
|
941
978
|
readonly: boolean;
|
|
942
979
|
showElementLinks: boolean;
|
|
980
|
+
showNavigationButtons: boolean;
|
|
943
981
|
fitViewEnabled: boolean;
|
|
944
982
|
fitViewPadding: number;
|
|
945
983
|
zoomable: boolean;
|
|
@@ -949,6 +987,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
949
987
|
experimentalEdgeEditing: boolean;
|
|
950
988
|
enableFocusMode: boolean;
|
|
951
989
|
renderIcon: ElementIconRenderer | null;
|
|
990
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
952
991
|
enableDynamicViewWalkthrough: boolean;
|
|
953
992
|
xyflow: XYFlowInstance;
|
|
954
993
|
xystore: XYStoreApi;
|
|
@@ -962,7 +1001,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
962
1001
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
963
1002
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
964
1003
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
965
|
-
|
|
1004
|
+
onBurgerMenuClick: (() => void) | null;
|
|
1005
|
+
onOpenSourceView: (() => void) | null;
|
|
1006
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
1007
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
966
1008
|
readonly storeDevId: string;
|
|
967
1009
|
xynodes: XYFlowNode[];
|
|
968
1010
|
xyedges: {
|
|
@@ -1023,7 +1065,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
1023
1065
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
1024
1066
|
resetLastClicked: () => void;
|
|
1025
1067
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
1026
|
-
triggerChangeElementStyle: (change:
|
|
1068
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
1027
1069
|
cancelSaveManualLayout: () => boolean;
|
|
1028
1070
|
scheduleSaveManualLayout: () => void;
|
|
1029
1071
|
triggerSaveManualLayout: () => void;
|
|
@@ -1069,6 +1111,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
1069
1111
|
view: DiagramView;
|
|
1070
1112
|
readonly: boolean;
|
|
1071
1113
|
showElementLinks: boolean;
|
|
1114
|
+
showNavigationButtons: boolean;
|
|
1072
1115
|
fitViewEnabled: boolean;
|
|
1073
1116
|
fitViewPadding: number;
|
|
1074
1117
|
zoomable: boolean;
|
|
@@ -1078,6 +1121,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
1078
1121
|
experimentalEdgeEditing: boolean;
|
|
1079
1122
|
enableFocusMode: boolean;
|
|
1080
1123
|
renderIcon: ElementIconRenderer | null;
|
|
1124
|
+
whereFilter: WhereOperator<string, string> | null;
|
|
1081
1125
|
enableDynamicViewWalkthrough: boolean;
|
|
1082
1126
|
xyflow: XYFlowInstance;
|
|
1083
1127
|
xystore: XYStoreApi;
|
|
@@ -1091,7 +1135,10 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
1091
1135
|
onEdgeContextMenu: import('../LikeC4Diagram.props').OnEdgeClick | null;
|
|
1092
1136
|
onCanvasClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
1093
1137
|
onCanvasDblClick: import('../LikeC4Diagram.props').OnCanvasClick | null;
|
|
1094
|
-
|
|
1138
|
+
onBurgerMenuClick: (() => void) | null;
|
|
1139
|
+
onOpenSourceView: (() => void) | null;
|
|
1140
|
+
onOpenSourceElement: ((fqn: Fqn) => void) | null;
|
|
1141
|
+
onOpenSourceRelation: ((id: import('@likec4/core').RelationID) => void) | null;
|
|
1095
1142
|
readonly storeDevId: string;
|
|
1096
1143
|
xynodes: XYFlowNode[];
|
|
1097
1144
|
xyedges: {
|
|
@@ -1152,7 +1199,7 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
1152
1199
|
setLastClickedEdge: (edgeId: string | null) => void;
|
|
1153
1200
|
resetLastClicked: () => void;
|
|
1154
1201
|
getElement: (id: Fqn) => DiagramNode | null;
|
|
1155
|
-
triggerChangeElementStyle: (change:
|
|
1202
|
+
triggerChangeElementStyle: (change: ViewChange.ChangeElementStyle) => void;
|
|
1156
1203
|
cancelSaveManualLayout: () => boolean;
|
|
1157
1204
|
scheduleSaveManualLayout: () => void;
|
|
1158
1205
|
triggerSaveManualLayout: () => void;
|
|
@@ -1196,4 +1243,6 @@ export declare function createDiagramStore<T extends Exact<DiagramInitialState,
|
|
|
1196
1243
|
}>;
|
|
1197
1244
|
}>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
1198
1245
|
}>;
|
|
1246
|
+
export type DiagramZustandStore = ReturnType<typeof createDiagramStore>;
|
|
1247
|
+
export type DiagramStoreApi = Readonly<Pick<DiagramZustandStore, 'getState' | 'setState' | 'subscribe'>>;
|
|
1199
1248
|
export {};
|
package/dist/style.css
CHANGED
|
@@ -1291,7 +1291,7 @@ svg.react-flow__connectionline {
|
|
|
1291
1291
|
--bexn7q0: black;
|
|
1292
1292
|
--xy-edge-stroke: var(--likec4-relation-lineColor);
|
|
1293
1293
|
--xy-edge-stroke-selected: color-mix(in srgb, var(--likec4-relation-lineColor), var(--bexn7q0) 35%);
|
|
1294
|
-
--xy-edge-label-color: color-mix(in srgb, var(--likec4-relation-labelColor), rgba(255 255 255 / 0.85)
|
|
1294
|
+
--xy-edge-label-color: color-mix(in srgb, var(--likec4-relation-labelColor), rgba(255 255 255 / 0.85) 40%);
|
|
1295
1295
|
--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-relation-labelBg), transparent 40%);
|
|
1296
1296
|
--xy-edge-stroke-width: 3;
|
|
1297
1297
|
}
|
|
@@ -1385,12 +1385,29 @@ svg.react-flow__connectionline {
|
|
|
1385
1385
|
.bexn7q2 .bexn7q8 {
|
|
1386
1386
|
animation-play-state: paused;
|
|
1387
1387
|
}
|
|
1388
|
-
.
|
|
1389
|
-
|
|
1388
|
+
.bexn7q9 {
|
|
1389
|
+
flex: 0 0 auto;
|
|
1390
|
+
font-weight: 600;
|
|
1391
|
+
font-size: calc(0.875rem * var(--mantine-scale));
|
|
1392
|
+
line-height: 1;
|
|
1393
|
+
padding: 5px 5px;
|
|
1394
|
+
text-align: center;
|
|
1395
|
+
min-width: 22px;
|
|
1396
|
+
border-top-left-radius: 2px;
|
|
1397
|
+
border-bottom-left-radius: 2px;
|
|
1398
|
+
background-color: color-mix(in srgb, var(--likec4-relation-labelBg), var(--bexn7q0) 5%);
|
|
1399
|
+
font-variant-numeric: tabular-nums;
|
|
1400
|
+
}
|
|
1401
|
+
:where([data-mantine-color-scheme="dark"]) :where([data-likec4-color="gray"]) .bexn7q9 {
|
|
1402
|
+
background-color: color-mix(in srgb, var(--likec4-relation-labelBg), var(--bexn7q0) 15%);
|
|
1403
|
+
}
|
|
1404
|
+
.bexn7qd {
|
|
1405
|
+
--bexn7qc: translate(var(--bexn7qa, -50%), var(--bexn7qb, -50%));
|
|
1390
1406
|
top: 0;
|
|
1391
1407
|
left: 0;
|
|
1392
1408
|
padding: 2px 4px 4px 4px;
|
|
1393
1409
|
font-family: var(--likec4-font-family);
|
|
1410
|
+
display: flex;
|
|
1394
1411
|
position: absolute;
|
|
1395
1412
|
pointer-events: all;
|
|
1396
1413
|
cursor: pointer;
|
|
@@ -1399,45 +1416,32 @@ svg.react-flow__connectionline {
|
|
|
1399
1416
|
mix-blend-mode: plus-lighter;
|
|
1400
1417
|
color: var(--xy-edge-label-color);
|
|
1401
1418
|
background-color: var(--xy-edge-label-background-color);
|
|
1402
|
-
border-radius:
|
|
1403
|
-
transform: var(--
|
|
1419
|
+
border-radius: 2px;
|
|
1420
|
+
transform: var(--bexn7qc);
|
|
1404
1421
|
}
|
|
1405
|
-
.
|
|
1422
|
+
.bexn7qd[data-edge-hovered="true"] {
|
|
1406
1423
|
transition: all 140ms ease-in-out;
|
|
1407
|
-
transform: var(--
|
|
1424
|
+
transform: var(--bexn7qc) scale(1.12);
|
|
1408
1425
|
}
|
|
1409
|
-
.
|
|
1426
|
+
.bexn7qd:has(.bexn7q9) {
|
|
1427
|
+
padding: 0;
|
|
1428
|
+
gap: 2px;
|
|
1429
|
+
}
|
|
1430
|
+
.bexn7qd:is(.bexn7q2) {
|
|
1410
1431
|
opacity: 0.3;
|
|
1411
1432
|
transition: opacity 600ms ease-in-out, filter 600ms ease-in-out;
|
|
1412
1433
|
transition-delay: 200ms;
|
|
1413
1434
|
filter: grayscale(0.85) var(--likec4-safari-animation-hook, blur(1px));
|
|
1414
1435
|
will-change: opacity, filter;
|
|
1415
1436
|
}
|
|
1416
|
-
.bexn7qd {
|
|
1417
|
-
position: absolute;
|
|
1418
|
-
top: -2px;
|
|
1419
|
-
left: -2px;
|
|
1420
|
-
font-weight: 500;
|
|
1421
|
-
font-size: calc(1rem * var(--mantine-scale));
|
|
1422
|
-
line-height: 0.9;
|
|
1423
|
-
padding: 4px 6px;
|
|
1424
|
-
border-radius: 99999px;
|
|
1425
|
-
text-align: center;
|
|
1426
|
-
min-width: 22px;
|
|
1427
|
-
background-color: var(--xy-edge-label-background-color);
|
|
1428
|
-
transition: all 120ms ease-out;
|
|
1429
|
-
transform: translateX(-100%);
|
|
1430
|
-
font-variant-numeric: tabular-nums;
|
|
1431
|
-
}
|
|
1432
|
-
:where([data-edge-hovered="true"],[data-edge-active="true"]) .bexn7qd {
|
|
1433
|
-
font-weight: 600;
|
|
1434
|
-
background-color: color-mix(in srgb, var(--likec4-relation-labelBg), transparent 5%);
|
|
1435
|
-
}
|
|
1436
1437
|
.bexn7qe {
|
|
1437
1438
|
text-align: left;
|
|
1438
1439
|
white-space-collapse: preserve-breaks;
|
|
1439
1440
|
font-size: calc(0.875rem * var(--mantine-scale));
|
|
1440
1441
|
line-height: 1.185;
|
|
1442
|
+
}
|
|
1443
|
+
.bexn7qd:has(.bexn7q9) .bexn7qe {
|
|
1444
|
+
padding: 2px 5px 4px 2px;
|
|
1441
1445
|
}@keyframes lbtzdoa {
|
|
1442
1446
|
from {
|
|
1443
1447
|
opacity: 0.6;
|
|
@@ -1962,13 +1966,6 @@ drop-shadow(1px 1px 16px rgb(0 0 0 / 3%))
|
|
|
1962
1966
|
}
|
|
1963
1967
|
._4ysv0o2 {
|
|
1964
1968
|
text-align: left;
|
|
1965
|
-
}._19mimxc0 {
|
|
1966
|
-
top: var(--likec4-navigation-panel-top, 0.8rem);
|
|
1967
|
-
left: var(--likec4-navigation-panel-left, 1rem);
|
|
1968
|
-
margin: 0;
|
|
1969
|
-
}
|
|
1970
|
-
._19mimxc0 .mantine-ActionIcon-root {
|
|
1971
|
-
--ai-size: var(--ai-size-lg);
|
|
1972
1969
|
}.hbkbtj0 {
|
|
1973
1970
|
bottom: 0;
|
|
1974
1971
|
left: 0;
|
|
@@ -1995,13 +1992,13 @@ drop-shadow(1px 1px 16px rgb(0 0 0 / 3%))
|
|
|
1995
1992
|
}
|
|
1996
1993
|
@media (min-width: 48em) {
|
|
1997
1994
|
.hbkbtj1 {
|
|
1998
|
-
min-width:
|
|
1995
|
+
min-width: 250px;
|
|
1999
1996
|
max-width: 90vw;
|
|
2000
1997
|
}
|
|
2001
1998
|
}
|
|
2002
1999
|
@media (min-width: 62em) {
|
|
2003
2000
|
.hbkbtj1 {
|
|
2004
|
-
min-width:
|
|
2001
|
+
min-width: 350px;
|
|
2005
2002
|
max-width: 70vw;
|
|
2006
2003
|
}
|
|
2007
2004
|
}._2jkb2y0 {
|
|
@@ -2042,4 +2039,28 @@ drop-shadow(1px 1px 16px rgb(0 0 0 / 3%))
|
|
|
2042
2039
|
right: var(--likec4-options-panel-right, 1rem);
|
|
2043
2040
|
margin: 0;
|
|
2044
2041
|
box-shadow: var(--mantine-shadow-xl);
|
|
2042
|
+
}._1snasyb0 {
|
|
2043
|
+
top: var(--likec4-navigation-panel-top, 1rem);
|
|
2044
|
+
left: var(--likec4-navigation-panel-left, 1rem);
|
|
2045
|
+
margin: 0;
|
|
2046
|
+
}
|
|
2047
|
+
.likec4-top-left-panel .action-icon {
|
|
2048
|
+
--ai-size: var(--ai-size-lg);
|
|
2049
|
+
}
|
|
2050
|
+
.likec4-top-left-panel .action-icon .tabler-icon {
|
|
2051
|
+
width: 70%;
|
|
2052
|
+
height: 70%;
|
|
2053
|
+
}
|
|
2054
|
+
._1snasyb1 .tabler-icon {
|
|
2055
|
+
width: 75%;
|
|
2056
|
+
height: 75%;
|
|
2057
|
+
}
|
|
2058
|
+
._1snasyb2 {
|
|
2059
|
+
background: var(--mantine-color-gray-2);
|
|
2060
|
+
border-radius: var(--mantine-radius-sm);
|
|
2061
|
+
border: 1px solid var(--mantine-color-gray-3);
|
|
2062
|
+
}
|
|
2063
|
+
:where([data-mantine-color-scheme="dark"]) ._1snasyb2 {
|
|
2064
|
+
background: var(--mantine-color-dark-5);
|
|
2065
|
+
border: 1px solid var(--mantine-color-dark-4);
|
|
2045
2066
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const Tooltip: import('react').ForwardRefExoticComponent<import('@mantine/core').TooltipProps & import('react').RefAttributes<HTMLDivElement> & {
|
|
2
|
+
component?: any;
|
|
3
|
+
renderRoot?: (props: Record<string, any>) => React.ReactNode;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const ActionIcon: <L = "button">(props: import('@mantine/core').PolymorphicComponentProps<L, import('@mantine/core').ActionIconProps>) => React.ReactElement;
|
|
@@ -5,7 +5,6 @@ type XYFlowInnerProps = PropsWithChildren<{
|
|
|
5
5
|
background: NonNullable<LikeC4DiagramProperties['background']>;
|
|
6
6
|
controls: boolean;
|
|
7
7
|
showDiagramTitle: boolean;
|
|
8
|
-
showNavigationButtons: boolean;
|
|
9
8
|
}>;
|
|
10
9
|
export declare const XYFlowInner: import('react').NamedExoticComponent<XYFlowInnerProps>;
|
|
11
10
|
export {};
|
package/dist/xyflow/const.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export declare const markerContext: string;
|
|
|
5
5
|
export declare const controlPoint: string;
|
|
6
6
|
export declare const controlDragging: string;
|
|
7
7
|
export declare const cssEdgePath: string;
|
|
8
|
+
export declare const stepEdgeNumber: string;
|
|
8
9
|
export declare const varLabelX: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
9
10
|
export declare const varLabelY: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
10
11
|
export declare const edgeLabel: string;
|
|
11
|
-
export declare const stepEdgeNumber: string;
|
|
12
12
|
export declare const edgeLabelText: string;
|
package/dist/xyflow/utils.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { DiagramEdge, Point } from '@likec4/core/types';
|
|
2
|
-
import { XYPosition } from '@xyflow/react';
|
|
2
|
+
import { Rect, XYPosition } from '@xyflow/react';
|
|
3
|
+
import { InternalXYFlowNode } from './types';
|
|
3
4
|
|
|
4
5
|
export declare function toDomPrecision(v: number | null): number;
|
|
5
6
|
export declare function distance(a: XYPosition, b: XYPosition): number;
|
|
7
|
+
export declare const nodeToRect: (nd: InternalXYFlowNode) => Rect;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a rectangle is completely inside another rectangle.
|
|
10
|
+
*
|
|
11
|
+
* @param test - The rectangle to test.
|
|
12
|
+
* @param target - The target rectangle.
|
|
13
|
+
* @returns `true` if the `test` rectangle is completely inside the `target` rectangle, otherwise `false`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isInside: (test: Rect, target: Rect) => boolean;
|
|
6
16
|
export declare function bezierControlPoints(diagramEdge: DiagramEdge): XYPosition[];
|
|
7
17
|
export declare function isSamePoint(a: XYPosition | Point, b: XYPosition | Point): boolean;
|
|
8
18
|
export declare function distanceBetweenPoints(a: XYPosition, b: XYPosition): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/diagram",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
@@ -54,27 +54,27 @@
|
|
|
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
|
-
"@xyflow/react": "12.0.
|
|
57
|
+
"@xyflow/react": "12.0.4",
|
|
58
58
|
"@xyflow/system": "0.0.37",
|
|
59
59
|
"bezier-js": "^6.1.4",
|
|
60
60
|
"clsx": "^2.1.1",
|
|
61
61
|
"d3-shape": "^3.2.0",
|
|
62
62
|
"esm-env": "^1.0.0",
|
|
63
63
|
"fast-equals": "^5.0.1",
|
|
64
|
-
"framer-motion": "^11.3.
|
|
64
|
+
"framer-motion": "^11.3.24",
|
|
65
65
|
"remeda": "^2.3.0",
|
|
66
66
|
"zustand": "^4.5.4"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@likec4/core": "1.7.
|
|
69
|
+
"@likec4/core": "1.7.4",
|
|
70
70
|
"@mantine/core": "^7.11.2",
|
|
71
71
|
"@mantine/hooks": "^7.11.2",
|
|
72
72
|
"react": "^18.3.1",
|
|
73
73
|
"react-dom": "^18.3.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@likec4/core": "1.7.
|
|
77
|
-
"@likec4/tsconfig": "1.7.
|
|
76
|
+
"@likec4/core": "1.7.4",
|
|
77
|
+
"@likec4/tsconfig": "1.7.4",
|
|
78
78
|
"@mantine/core": "7.11.2",
|
|
79
79
|
"@mantine/hooks": "7.11.2",
|
|
80
80
|
"@mantine/vanilla-extract": "7.11.2",
|