@likec4/diagram 1.38.1 → 1.39.1
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/bundle/{chunk-BZV0K82k.js → chunk-CaxOLfbm.js} +277 -271
- package/bundle/custom.js +39 -39
- package/bundle/index.js +354 -240
- package/dist/LikeC4Diagram.js +4 -2
- package/dist/LikeC4Diagram.props.d.ts +15 -8
- package/dist/LikeC4Styles.d.ts +3 -1
- package/dist/LikeC4Styles.js +52 -20
- package/dist/base/BaseXYFlow.js +5 -5
- package/dist/base/index.d.ts +1 -2
- package/dist/base/primitives/MarkdownBlock.js +2 -1
- package/dist/base/primitives/customEdge.d.ts +3 -3
- package/dist/base/primitives/edge/EdgeLabel.js +1 -2
- package/dist/base/primitives/element/ElementTitle.js +2 -10
- package/dist/base/types.d.ts +62 -5
- package/dist/base/types.js +54 -0
- package/dist/bundle/LikeC4View.d.ts +2 -2
- package/dist/bundle/LikeC4View.props.d.ts +4 -3
- package/dist/bundle/ReactLikeC4.d.ts +4 -4
- package/dist/context/RootContainer.d.ts +2 -1
- package/dist/context/RootContainer.js +1 -2
- package/dist/custom/customNodes.d.ts +2 -1
- package/dist/globals.css.js +1 -1
- package/dist/hooks/useXYFlow.d.ts +28 -29
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +4 -5
- package/dist/likec4diagram/custom/nodes/ElementActions.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +75 -68
- package/dist/likec4diagram/relationship-popover/styles.css.js +8 -5
- package/dist/likec4diagram/types.d.ts +2 -1
- package/dist/likec4diagram/useViewToNodesEdges.js +1 -1
- package/dist/likec4model/LikeC4ModelContext.d.ts +5 -2
- package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
- package/dist/likec4model/useLikeC4Model.d.ts +7 -20
- package/dist/navigationpanel/NavigationPanel.js +3 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -4
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +1 -0
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +83 -0
- package/dist/overlays/element-details/actor.d.ts +556 -557
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +2 -3
- package/dist/overlays/relationship-details/actor.d.ts +1 -1
- package/dist/overlays/relationship-details/actor.js +7 -7
- package/dist/overlays/relationship-details/compute.js +2 -1
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +2 -3
- package/dist/overlays/relationship-details/hooks.d.ts +18 -19
- package/dist/overlays/relationship-details/layout.js +2 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +2 -3
- package/dist/overlays/relationships-browser/actor.d.ts +12 -12
- package/dist/overlays/relationships-browser/actor.js +8 -8
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +2 -3
- package/dist/overlays/relationships-browser/layout.js +2 -1
- package/dist/search/components/ElementsColumn.js +1 -1
- package/dist/state/DiagramActorProvider.js +2 -2
- package/dist/state/assign.js +6 -6
- package/dist/state/diagram-machine.js +14 -14
- package/dist/styles-min.css +1 -1
- package/dist/styles-xyflow.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/xyflow.js +2 -2
- package/package.json +16 -16
- package/panda.buildinfo.json +30 -27
- package/src/LikeC4Diagram.props.ts +16 -16
- package/src/LikeC4Diagram.tsx +4 -2
- package/src/LikeC4Styles.tsx +50 -22
- package/src/base/index.ts +1 -2
- package/src/base/primitives/MarkdownBlock.tsx +1 -0
- package/src/base/primitives/customEdge.ts +5 -5
- package/src/base/primitives/edge/EdgeLabel.tsx +1 -2
- package/src/base/primitives/element/ElementTitle.tsx +10 -22
- package/src/base/types.ts +122 -13
- package/src/bundle/LikeC4View.props.ts +4 -3
- package/src/bundle/LikeC4View.tsx +6 -6
- package/src/bundle/ReactLikeC4.tsx +7 -6
- package/src/context/RootContainer.tsx +2 -2
- package/src/custom/customNodes.ts +3 -1
- package/src/globals.css +2 -2
- package/src/hooks/useSetState.ts +2 -2
- package/src/likec4diagram/custom/nodes/ElementActions.tsx +2 -1
- package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +49 -41
- package/src/likec4diagram/relationship-popover/styles.css.ts +8 -5
- package/src/likec4diagram/types.ts +1 -1
- package/src/likec4diagram/useViewToNodesEdges.ts +1 -1
- package/src/likec4model/LikeC4ModelContext.tsx +5 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +3 -3
- package/src/likec4model/useLikeC4Model.ts +8 -5
- package/src/navigationpanel/NavigationPanel.tsx +2 -0
- package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -1
- package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +3 -1
- package/src/navigationpanel/walkthrough/WalkthroughPanel.tsx +88 -0
- package/src/overlays/relationship-details/compute.ts +3 -12
- package/src/overlays/relationship-details/layout.ts +3 -3
- package/src/overlays/relationships-browser/actor.ts +2 -1
- package/src/overlays/relationships-browser/layout.ts +3 -3
- package/src/search/components/ElementsColumn.tsx +3 -3
- package/src/utils/xyflow.ts +2 -2
- package/dist/base/types.Base.d.ts +0 -54
- package/dist/base/types.Base.js +0 -48
- package/dist/likec4diagram/custom/edges/NotePopover.d.ts +0 -4
- package/src/base/types.Base.ts +0 -104
- package/src/likec4diagram/custom/edges/NotePopover.tsx +0 -95
- /package/dist/{likec4diagram/custom/edges/NotePopover.css.d.ts → navigationpanel/walkthrough/WalkthroughPanel.css.d.ts} +0 -0
- /package/src/{likec4diagram/custom/edges/NotePopover.css.ts → navigationpanel/walkthrough/WalkthroughPanel.css.ts} +0 -0
|
@@ -2,8 +2,7 @@ import { ReactFlowInstance, ReactFlowState, InternalNode } from '@xyflow/react';
|
|
|
2
2
|
import { Types } from '../likec4diagram/types';
|
|
3
3
|
import { EdgeMarkerType, HandleType, XYPosition } from '@xyflow/system';
|
|
4
4
|
import { ReactNode, CSSProperties, AriaRole, SVGAttributes } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, MarkdownOrString } from '@likec4/core';
|
|
5
|
+
import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, RichTextOrEmpty } from '@likec4/core';
|
|
7
6
|
export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
|
|
8
7
|
id: string;
|
|
9
8
|
source: string;
|
|
@@ -31,12 +30,12 @@ export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
|
|
|
31
30
|
reconnectable?: boolean | HandleType;
|
|
32
31
|
focusable?: boolean;
|
|
33
32
|
ariaRole?: AriaRole;
|
|
34
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
33
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
35
34
|
type: "relationship";
|
|
36
35
|
data: {
|
|
37
36
|
hovered?: boolean;
|
|
38
37
|
active?: boolean;
|
|
39
|
-
dimmed?: Dimmed;
|
|
38
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
40
39
|
id: EdgeId;
|
|
41
40
|
label: string | null;
|
|
42
41
|
points: NonEmptyArray<Point>;
|
|
@@ -48,7 +47,7 @@ export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
|
|
|
48
47
|
head: RelationshipArrowType | undefined;
|
|
49
48
|
labelBBox: BBox | null | undefined;
|
|
50
49
|
navigateTo: ViewId<string> | null | undefined;
|
|
51
|
-
notes:
|
|
50
|
+
notes: RichTextOrEmpty;
|
|
52
51
|
labelXY: XYPosition | null;
|
|
53
52
|
controlPoints: XYPosition[] | undefined | null;
|
|
54
53
|
};
|
|
@@ -84,12 +83,12 @@ export declare const useXYStoreApi: () => {
|
|
|
84
83
|
reconnectable?: boolean | HandleType;
|
|
85
84
|
focusable?: boolean;
|
|
86
85
|
ariaRole?: AriaRole;
|
|
87
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
86
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
88
87
|
type: "relationship";
|
|
89
88
|
data: {
|
|
90
89
|
hovered?: boolean;
|
|
91
90
|
active?: boolean;
|
|
92
|
-
dimmed?: Dimmed;
|
|
91
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
93
92
|
id: EdgeId;
|
|
94
93
|
label: string | null;
|
|
95
94
|
points: NonEmptyArray<Point>;
|
|
@@ -101,7 +100,7 @@ export declare const useXYStoreApi: () => {
|
|
|
101
100
|
head: RelationshipArrowType | undefined;
|
|
102
101
|
labelBBox: BBox | null | undefined;
|
|
103
102
|
navigateTo: ViewId<string> | null | undefined;
|
|
104
|
-
notes:
|
|
103
|
+
notes: RichTextOrEmpty;
|
|
105
104
|
labelXY: XYPosition | null;
|
|
106
105
|
controlPoints: XYPosition[] | undefined | null;
|
|
107
106
|
};
|
|
@@ -133,12 +132,12 @@ export declare const useXYStoreApi: () => {
|
|
|
133
132
|
reconnectable?: boolean | HandleType;
|
|
134
133
|
focusable?: boolean;
|
|
135
134
|
ariaRole?: AriaRole;
|
|
136
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
135
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
137
136
|
type: "relationship";
|
|
138
137
|
data: {
|
|
139
138
|
hovered?: boolean;
|
|
140
139
|
active?: boolean;
|
|
141
|
-
dimmed?: Dimmed;
|
|
140
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
142
141
|
id: EdgeId;
|
|
143
142
|
label: string | null;
|
|
144
143
|
points: NonEmptyArray<Point>;
|
|
@@ -150,7 +149,7 @@ export declare const useXYStoreApi: () => {
|
|
|
150
149
|
head: RelationshipArrowType | undefined;
|
|
151
150
|
labelBBox: BBox | null | undefined;
|
|
152
151
|
navigateTo: ViewId<string> | null | undefined;
|
|
153
|
-
notes:
|
|
152
|
+
notes: RichTextOrEmpty;
|
|
154
153
|
labelXY: XYPosition | null;
|
|
155
154
|
controlPoints: XYPosition[] | undefined | null;
|
|
156
155
|
};
|
|
@@ -181,12 +180,12 @@ export declare const useXYStoreApi: () => {
|
|
|
181
180
|
reconnectable?: boolean | HandleType;
|
|
182
181
|
focusable?: boolean;
|
|
183
182
|
ariaRole?: AriaRole;
|
|
184
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
183
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
185
184
|
type: "relationship";
|
|
186
185
|
data: {
|
|
187
186
|
hovered?: boolean;
|
|
188
187
|
active?: boolean;
|
|
189
|
-
dimmed?: Dimmed;
|
|
188
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
190
189
|
id: EdgeId;
|
|
191
190
|
label: string | null;
|
|
192
191
|
points: NonEmptyArray<Point>;
|
|
@@ -198,7 +197,7 @@ export declare const useXYStoreApi: () => {
|
|
|
198
197
|
head: RelationshipArrowType | undefined;
|
|
199
198
|
labelBBox: BBox | null | undefined;
|
|
200
199
|
navigateTo: ViewId<string> | null | undefined;
|
|
201
|
-
notes:
|
|
200
|
+
notes: RichTextOrEmpty;
|
|
202
201
|
labelXY: XYPosition | null;
|
|
203
202
|
controlPoints: XYPosition[] | undefined | null;
|
|
204
203
|
};
|
|
@@ -229,12 +228,12 @@ export declare const useXYStoreApi: () => {
|
|
|
229
228
|
reconnectable?: boolean | HandleType;
|
|
230
229
|
focusable?: boolean;
|
|
231
230
|
ariaRole?: AriaRole;
|
|
232
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
231
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
233
232
|
type: "relationship";
|
|
234
233
|
data: {
|
|
235
234
|
hovered?: boolean;
|
|
236
235
|
active?: boolean;
|
|
237
|
-
dimmed?: Dimmed;
|
|
236
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
238
237
|
id: EdgeId;
|
|
239
238
|
label: string | null;
|
|
240
239
|
points: NonEmptyArray<Point>;
|
|
@@ -246,7 +245,7 @@ export declare const useXYStoreApi: () => {
|
|
|
246
245
|
head: RelationshipArrowType | undefined;
|
|
247
246
|
labelBBox: BBox | null | undefined;
|
|
248
247
|
navigateTo: ViewId<string> | null | undefined;
|
|
249
|
-
notes:
|
|
248
|
+
notes: RichTextOrEmpty;
|
|
250
249
|
labelXY: XYPosition | null;
|
|
251
250
|
controlPoints: XYPosition[] | undefined | null;
|
|
252
251
|
};
|
|
@@ -277,12 +276,12 @@ export declare const useXYStoreApi: () => {
|
|
|
277
276
|
reconnectable?: boolean | HandleType;
|
|
278
277
|
focusable?: boolean;
|
|
279
278
|
ariaRole?: AriaRole;
|
|
280
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
279
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
281
280
|
type: "relationship";
|
|
282
281
|
data: {
|
|
283
282
|
hovered?: boolean;
|
|
284
283
|
active?: boolean;
|
|
285
|
-
dimmed?: Dimmed;
|
|
284
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
286
285
|
id: EdgeId;
|
|
287
286
|
label: string | null;
|
|
288
287
|
points: NonEmptyArray<Point>;
|
|
@@ -294,7 +293,7 @@ export declare const useXYStoreApi: () => {
|
|
|
294
293
|
head: RelationshipArrowType | undefined;
|
|
295
294
|
labelBBox: BBox | null | undefined;
|
|
296
295
|
navigateTo: ViewId<string> | null | undefined;
|
|
297
|
-
notes:
|
|
296
|
+
notes: RichTextOrEmpty;
|
|
298
297
|
labelXY: XYPosition | null;
|
|
299
298
|
controlPoints: XYPosition[] | undefined | null;
|
|
300
299
|
};
|
|
@@ -325,12 +324,12 @@ export declare const useXYStoreApi: () => {
|
|
|
325
324
|
reconnectable?: boolean | HandleType;
|
|
326
325
|
focusable?: boolean;
|
|
327
326
|
ariaRole?: AriaRole;
|
|
328
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
327
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
329
328
|
type: "relationship";
|
|
330
329
|
data: {
|
|
331
330
|
hovered?: boolean;
|
|
332
331
|
active?: boolean;
|
|
333
|
-
dimmed?: Dimmed;
|
|
332
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
334
333
|
id: EdgeId;
|
|
335
334
|
label: string | null;
|
|
336
335
|
points: NonEmptyArray<Point>;
|
|
@@ -342,7 +341,7 @@ export declare const useXYStoreApi: () => {
|
|
|
342
341
|
head: RelationshipArrowType | undefined;
|
|
343
342
|
labelBBox: BBox | null | undefined;
|
|
344
343
|
navigateTo: ViewId<string> | null | undefined;
|
|
345
|
-
notes:
|
|
344
|
+
notes: RichTextOrEmpty;
|
|
346
345
|
labelXY: XYPosition | null;
|
|
347
346
|
controlPoints: XYPosition[] | undefined | null;
|
|
348
347
|
};
|
|
@@ -374,12 +373,12 @@ export declare const useXYStoreApi: () => {
|
|
|
374
373
|
reconnectable?: boolean | HandleType;
|
|
375
374
|
focusable?: boolean;
|
|
376
375
|
ariaRole?: AriaRole;
|
|
377
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
376
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
378
377
|
type: "relationship";
|
|
379
378
|
data: {
|
|
380
379
|
hovered?: boolean;
|
|
381
380
|
active?: boolean;
|
|
382
|
-
dimmed?: Dimmed;
|
|
381
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
383
382
|
id: EdgeId;
|
|
384
383
|
label: string | null;
|
|
385
384
|
points: NonEmptyArray<Point>;
|
|
@@ -391,7 +390,7 @@ export declare const useXYStoreApi: () => {
|
|
|
391
390
|
head: RelationshipArrowType | undefined;
|
|
392
391
|
labelBBox: BBox | null | undefined;
|
|
393
392
|
navigateTo: ViewId<string> | null | undefined;
|
|
394
|
-
notes:
|
|
393
|
+
notes: RichTextOrEmpty;
|
|
395
394
|
labelXY: XYPosition | null;
|
|
396
395
|
controlPoints: XYPosition[] | undefined | null;
|
|
397
396
|
};
|
|
@@ -422,12 +421,12 @@ export declare const useXYStoreApi: () => {
|
|
|
422
421
|
reconnectable?: boolean | HandleType;
|
|
423
422
|
focusable?: boolean;
|
|
424
423
|
ariaRole?: AriaRole;
|
|
425
|
-
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
424
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
|
|
426
425
|
type: "relationship";
|
|
427
426
|
data: {
|
|
428
427
|
hovered?: boolean;
|
|
429
428
|
active?: boolean;
|
|
430
|
-
dimmed?: Dimmed;
|
|
429
|
+
dimmed?: import("../base").Base.Dimmed;
|
|
431
430
|
id: EdgeId;
|
|
432
431
|
label: string | null;
|
|
433
432
|
points: NonEmptyArray<Point>;
|
|
@@ -439,7 +438,7 @@ export declare const useXYStoreApi: () => {
|
|
|
439
438
|
head: RelationshipArrowType | undefined;
|
|
440
439
|
labelBBox: BBox | null | undefined;
|
|
441
440
|
navigateTo: ViewId<string> | null | undefined;
|
|
442
|
-
notes:
|
|
441
|
+
notes: RichTextOrEmpty;
|
|
443
442
|
labelXY: XYPosition | null;
|
|
444
443
|
controlPoints: XYPosition[] | undefined | null;
|
|
445
444
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId,
|
|
1
|
+
import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, RichTextOrEmpty } from '@likec4/core';
|
|
2
2
|
import { XYPosition } from '@xyflow/react';
|
|
3
3
|
import { FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
4
4
|
import { Position } from '@xyflow/system';
|
|
5
|
-
import { EdgeData, Dimmed } from '../../../base/types.Base';
|
|
6
5
|
export declare const RelationshipEdge: FunctionComponent<{
|
|
7
6
|
id: string;
|
|
8
7
|
selected?: boolean;
|
|
@@ -30,10 +29,10 @@ export declare const RelationshipEdge: FunctionComponent<{
|
|
|
30
29
|
markerEnd?: string;
|
|
31
30
|
pathOptions?: any;
|
|
32
31
|
interactionWidth?: number;
|
|
33
|
-
data: EdgeData & {
|
|
32
|
+
data: import("../../../base").Base.EdgeData & {
|
|
34
33
|
hovered?: boolean;
|
|
35
34
|
active?: boolean;
|
|
36
|
-
dimmed?: Dimmed;
|
|
35
|
+
dimmed?: import("../../../base").Base.Dimmed;
|
|
37
36
|
id: EdgeId;
|
|
38
37
|
label: string | null;
|
|
39
38
|
points: NonEmptyArray<Point>;
|
|
@@ -45,7 +44,7 @@ export declare const RelationshipEdge: FunctionComponent<{
|
|
|
45
44
|
head: RelationshipArrowType | undefined;
|
|
46
45
|
labelBBox: BBox | null | undefined;
|
|
47
46
|
navigateTo: ViewId<string> | null | undefined;
|
|
48
|
-
notes:
|
|
47
|
+
notes: RichTextOrEmpty;
|
|
49
48
|
labelXY: XYPosition | null;
|
|
50
49
|
controlPoints: XYPosition[] | undefined | null;
|
|
51
50
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { hasAtLeast } from '@likec4/core';
|
|
3
2
|
import { useMemo } from 'react';
|
|
3
|
+
import { hasAtLeast } from 'remeda';
|
|
4
4
|
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
5
5
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
6
6
|
import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
|
|
@@ -4,18 +4,16 @@ import { nameFromFqn } from '@likec4/core';
|
|
|
4
4
|
import { cx, css } from '@likec4/styles/css';
|
|
5
5
|
import { VStack, styled, HStack, Box } from '@likec4/styles/jsx';
|
|
6
6
|
import { bleed } from '@likec4/styles/patterns';
|
|
7
|
-
import { Portal, ScrollAreaAutosize, Button, Divider,
|
|
7
|
+
import { Portal, ScrollAreaAutosize, Button, Divider, TooltipGroup, Tooltip as Tooltip$1, Text, ActionIcon } from '@mantine/core';
|
|
8
8
|
import { useActorRef, useSelector } from '@xstate/react';
|
|
9
9
|
import { shallowEqual } from 'fast-equals';
|
|
10
|
-
import { memo, useCallback, useRef, useState,
|
|
10
|
+
import { memo, useEffect, useCallback, useRef, useState, Fragment as Fragment$1, forwardRef } from 'react';
|
|
11
11
|
import { pipe, map, filter, isTruthy, partition, clamp } from 'remeda';
|
|
12
12
|
import { Link } from '../../components/Link.js';
|
|
13
13
|
import { useDiagramEventHandlers } from '../../context/DiagramEventHandlers.js';
|
|
14
14
|
import { useEnabledFeatures } from '../../context/DiagramFeatures.js';
|
|
15
15
|
import { useDiagram, useDiagramContext, useOnDiagramEvent } from '../../hooks/useDiagram.js';
|
|
16
16
|
import { useMantinePortalProps } from '../../hooks/useMantinePortalProps.js';
|
|
17
|
-
import { useUpdateEffect } from '../../hooks/useUpdateEffect.js';
|
|
18
|
-
import { useXYStore } from '../../hooks/useXYFlow.js';
|
|
19
17
|
import { findDiagramEdge, findDiagramNode } from '../../state/utils.js';
|
|
20
18
|
import { RelationshipPopoverActorLogic } from './actor.js';
|
|
21
19
|
import { endpoint, title } from './styles.css.js';
|
|
@@ -47,9 +45,9 @@ const RelationshipPopover = memo(() => {
|
|
|
47
45
|
const diagram = useDiagram();
|
|
48
46
|
const { viewId, selected } = useDiagramContext(selectDiagramContext);
|
|
49
47
|
const openedEdgeId = useSelector(actorRef, (s) => s.hasTag("opened") ? s.context.edgeId : null);
|
|
50
|
-
|
|
48
|
+
useOnDiagramEvent("viewChange", () => {
|
|
51
49
|
actorRef.send({ type: "close" });
|
|
52
|
-
}
|
|
50
|
+
});
|
|
53
51
|
useOnDiagramEvent("edgeMouseEnter", ({ edge }) => {
|
|
54
52
|
actorRef.send({ type: "xyedge.mouseEnter", edgeId: edge.data.id });
|
|
55
53
|
});
|
|
@@ -62,7 +60,7 @@ const RelationshipPopover = memo(() => {
|
|
|
62
60
|
useOnDiagramEvent("walkthroughStarted", () => {
|
|
63
61
|
actorRef.send({ type: "close" });
|
|
64
62
|
});
|
|
65
|
-
|
|
63
|
+
useEffect(() => {
|
|
66
64
|
if (selected) {
|
|
67
65
|
actorRef.send({ type: "xyedge.select", edgeId: selected });
|
|
68
66
|
} else {
|
|
@@ -121,7 +119,7 @@ const RelationshipPopover = memo(() => {
|
|
|
121
119
|
const getEdgeLabelElement = (edgeId, container) => {
|
|
122
120
|
return container?.querySelector(`.likec4-edge-label[data-edge-id="${edgeId}"]`) ?? null;
|
|
123
121
|
};
|
|
124
|
-
const
|
|
122
|
+
const POPOVER_PADDING = 8;
|
|
125
123
|
const RelationshipPopoverInternal = ({
|
|
126
124
|
viewId,
|
|
127
125
|
diagramEdge,
|
|
@@ -135,10 +133,9 @@ const RelationshipPopoverInternal = ({
|
|
|
135
133
|
const { onOpenSource } = useDiagramEventHandlers();
|
|
136
134
|
const { portalProps } = useMantinePortalProps();
|
|
137
135
|
const [referenceEl, setReferenceEl] = useState(null);
|
|
138
|
-
const viewport = useXYStore(selectTransform);
|
|
139
136
|
useEffect(() => {
|
|
140
137
|
setReferenceEl(getEdgeLabelElement(diagramEdge.id, portalProps?.target));
|
|
141
|
-
}, [diagramEdge
|
|
138
|
+
}, [diagramEdge]);
|
|
142
139
|
useEffect(() => {
|
|
143
140
|
const reference = referenceEl;
|
|
144
141
|
const popper = ref.current;
|
|
@@ -148,11 +145,11 @@ const RelationshipPopoverInternal = ({
|
|
|
148
145
|
let wasCanceled = false;
|
|
149
146
|
const update = () => {
|
|
150
147
|
computePosition(reference, popper, {
|
|
151
|
-
placement: "bottom",
|
|
148
|
+
placement: "bottom-start",
|
|
152
149
|
middleware: [
|
|
153
150
|
offset(2),
|
|
154
151
|
autoPlacement({
|
|
155
|
-
padding:
|
|
152
|
+
padding: POPOVER_PADDING,
|
|
156
153
|
allowedPlacements: [
|
|
157
154
|
"bottom-start",
|
|
158
155
|
"bottom-end",
|
|
@@ -165,19 +162,19 @@ const RelationshipPopoverInternal = ({
|
|
|
165
162
|
]
|
|
166
163
|
}),
|
|
167
164
|
size({
|
|
168
|
-
padding:
|
|
165
|
+
padding: POPOVER_PADDING,
|
|
169
166
|
apply({ availableHeight, availableWidth, elements }) {
|
|
170
167
|
if (wasCanceled) {
|
|
171
168
|
return;
|
|
172
169
|
}
|
|
173
170
|
Object.assign(elements.floating.style, {
|
|
174
|
-
maxWidth: `${clamp(roundDpr(availableWidth), { min:
|
|
171
|
+
maxWidth: `${clamp(roundDpr(availableWidth), { min: 200, max: 400 })}px`,
|
|
175
172
|
maxHeight: `${clamp(roundDpr(availableHeight), { min: 0, max: 500 })}px`
|
|
176
173
|
});
|
|
177
174
|
}
|
|
178
175
|
}),
|
|
179
176
|
hide({
|
|
180
|
-
padding:
|
|
177
|
+
padding: POPOVER_PADDING * 2
|
|
181
178
|
})
|
|
182
179
|
]
|
|
183
180
|
}).then(({ x, y, middlewareData }) => {
|
|
@@ -188,7 +185,10 @@ const RelationshipPopoverInternal = ({
|
|
|
188
185
|
popper.style.visibility = middlewareData.hide?.referenceHidden ? "hidden" : "visible";
|
|
189
186
|
});
|
|
190
187
|
};
|
|
191
|
-
const cleanup = autoUpdate(reference, popper, update
|
|
188
|
+
const cleanup = autoUpdate(reference, popper, update, {
|
|
189
|
+
ancestorResize: false,
|
|
190
|
+
animationFrame: true
|
|
191
|
+
});
|
|
192
192
|
return () => {
|
|
193
193
|
wasCanceled = true;
|
|
194
194
|
cleanup();
|
|
@@ -252,7 +252,7 @@ const RelationshipPopoverInternal = ({
|
|
|
252
252
|
styles: {
|
|
253
253
|
viewport: {
|
|
254
254
|
overscrollBehavior: "contain",
|
|
255
|
-
minWidth:
|
|
255
|
+
minWidth: 180
|
|
256
256
|
}
|
|
257
257
|
},
|
|
258
258
|
className: cx(
|
|
@@ -272,9 +272,9 @@ const RelationshipPopoverInternal = ({
|
|
|
272
272
|
VStack,
|
|
273
273
|
{
|
|
274
274
|
css: {
|
|
275
|
-
gap: "3
|
|
275
|
+
gap: "3",
|
|
276
276
|
padding: "4",
|
|
277
|
-
paddingTop: "2
|
|
277
|
+
paddingTop: "2"
|
|
278
278
|
},
|
|
279
279
|
children: [
|
|
280
280
|
/* @__PURE__ */ jsx(
|
|
@@ -296,12 +296,19 @@ const RelationshipPopoverInternal = ({
|
|
|
296
296
|
}
|
|
297
297
|
),
|
|
298
298
|
direct.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
299
|
-
/* @__PURE__ */ jsx(
|
|
299
|
+
/* @__PURE__ */ jsx(Label, { children: "DIRECT RELATIONSHIPS" }),
|
|
300
300
|
direct.map(renderRelationship)
|
|
301
301
|
] }),
|
|
302
302
|
nested.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
/* @__PURE__ */ jsx(
|
|
304
|
+
Label,
|
|
305
|
+
{
|
|
306
|
+
css: {
|
|
307
|
+
mt: direct.length > 0 ? "2" : "0"
|
|
308
|
+
},
|
|
309
|
+
children: "RESOLVED FROM NESTED"
|
|
310
|
+
}
|
|
311
|
+
),
|
|
305
312
|
nested.map(renderRelationship)
|
|
306
313
|
] })
|
|
307
314
|
]
|
|
@@ -319,8 +326,8 @@ const Relationship = forwardRef(({
|
|
|
319
326
|
onNavigateTo,
|
|
320
327
|
onOpenSource
|
|
321
328
|
}, ref) => {
|
|
322
|
-
const sourceId =
|
|
323
|
-
const targetId =
|
|
329
|
+
const sourceId = getEndpointId(r, "source", sourceNode);
|
|
330
|
+
const targetId = getEndpointId(r, "target", targetNode);
|
|
324
331
|
const navigateTo = onNavigateTo && r.navigateTo?.id !== viewId ? r.navigateTo?.id : void 0;
|
|
325
332
|
const links = r.links;
|
|
326
333
|
return /* @__PURE__ */ jsxs(
|
|
@@ -330,8 +337,8 @@ const Relationship = forwardRef(({
|
|
|
330
337
|
className: bleed({
|
|
331
338
|
block: "2",
|
|
332
339
|
inline: "2",
|
|
333
|
-
|
|
334
|
-
|
|
340
|
+
paddingY: "2.5",
|
|
341
|
+
paddingX: "2",
|
|
335
342
|
gap: "1",
|
|
336
343
|
rounded: "sm",
|
|
337
344
|
backgroundColor: {
|
|
@@ -342,44 +349,42 @@ const Relationship = forwardRef(({
|
|
|
342
349
|
}
|
|
343
350
|
}),
|
|
344
351
|
children: [
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": sourceNode.color, className: endpoint, children: sourceId }),
|
|
352
|
+
/* @__PURE__ */ jsx(HStack, { gap: "0.5", children: /* @__PURE__ */ jsxs(TooltipGroup, { openDelay: 200, children: [
|
|
353
|
+
/* @__PURE__ */ jsx(Tooltip, { label: sourceId.full, offset: 2, position: "top-start", children: /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": sourceNode.color, className: endpoint, children: sourceId.short }) }),
|
|
347
354
|
/* @__PURE__ */ jsx(IconArrowRight, { stroke: 2.5, size: "11px", opacity: 0.65 }),
|
|
348
|
-
/* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": targetNode.color, className: endpoint, children: targetId }),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
] })
|
|
382
|
-
] }),
|
|
355
|
+
/* @__PURE__ */ jsx(Tooltip, { label: targetId.full, offset: 2, position: "top-start", children: /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": targetNode.color, className: endpoint, children: targetId.short }) }),
|
|
356
|
+
navigateTo && /* @__PURE__ */ jsx(Tooltip, { label: "Open dynamic view", children: /* @__PURE__ */ jsx(
|
|
357
|
+
ActionIcon,
|
|
358
|
+
{
|
|
359
|
+
size: "sm",
|
|
360
|
+
radius: "sm",
|
|
361
|
+
variant: "default",
|
|
362
|
+
onClick: (event) => {
|
|
363
|
+
event.stopPropagation();
|
|
364
|
+
onNavigateTo?.(navigateTo);
|
|
365
|
+
},
|
|
366
|
+
style: {
|
|
367
|
+
alignSelf: "flex-end"
|
|
368
|
+
},
|
|
369
|
+
role: "button",
|
|
370
|
+
children: /* @__PURE__ */ jsx(IconZoomScan, { size: "80%", stroke: 2 })
|
|
371
|
+
}
|
|
372
|
+
) }),
|
|
373
|
+
onOpenSource && /* @__PURE__ */ jsx(Tooltip, { label: "Open source", children: /* @__PURE__ */ jsx(
|
|
374
|
+
ActionIcon,
|
|
375
|
+
{
|
|
376
|
+
size: "sm",
|
|
377
|
+
radius: "sm",
|
|
378
|
+
variant: "default",
|
|
379
|
+
onClick: (event) => {
|
|
380
|
+
event.stopPropagation();
|
|
381
|
+
onOpenSource();
|
|
382
|
+
},
|
|
383
|
+
role: "button",
|
|
384
|
+
children: /* @__PURE__ */ jsx(IconFileSymlink, { size: "80%", stroke: 2 })
|
|
385
|
+
}
|
|
386
|
+
) })
|
|
387
|
+
] }) }),
|
|
383
388
|
/* @__PURE__ */ jsx(Box, { className: title, children: r.title || "untitled" }),
|
|
384
389
|
r.kind && /* @__PURE__ */ jsxs(HStack, { gap: "2", children: [
|
|
385
390
|
/* @__PURE__ */ jsx(Label, { children: "kind" }),
|
|
@@ -415,13 +420,13 @@ const Relationship = forwardRef(({
|
|
|
415
420
|
}
|
|
416
421
|
);
|
|
417
422
|
});
|
|
418
|
-
const Label = styled("
|
|
423
|
+
const Label = styled("div", {
|
|
419
424
|
base: {
|
|
420
|
-
display: "
|
|
425
|
+
display: "block",
|
|
421
426
|
fontSize: "xxs",
|
|
422
427
|
fontWeight: 500,
|
|
423
428
|
userSelect: "none",
|
|
424
|
-
lineHeight: "
|
|
429
|
+
lineHeight: "sm",
|
|
425
430
|
color: "mantine.colors.dimmed"
|
|
426
431
|
}
|
|
427
432
|
});
|
|
@@ -433,9 +438,11 @@ const Tooltip = Tooltip$1.withProps({
|
|
|
433
438
|
offset: 8,
|
|
434
439
|
withinPortal: false
|
|
435
440
|
});
|
|
436
|
-
function
|
|
441
|
+
function getEndpointId(r, endpoint, diagramNode) {
|
|
437
442
|
const diagramNodeId = r.isDeploymentRelation() ? diagramNode.id : diagramNode.modelRef || "";
|
|
438
|
-
|
|
443
|
+
const full = r[endpoint].id;
|
|
444
|
+
const short = nameFromFqn(diagramNodeId) + full.slice(diagramNodeId.length);
|
|
445
|
+
return { full, short };
|
|
439
446
|
}
|
|
440
447
|
|
|
441
448
|
export { RelationshipPopover };
|
|
@@ -5,13 +5,16 @@ const endpoint = css({
|
|
|
5
5
|
fontSize: "xxs",
|
|
6
6
|
fontWeight: 500,
|
|
7
7
|
whiteSpace: "nowrap",
|
|
8
|
-
|
|
8
|
+
paddingX: "1",
|
|
9
|
+
paddingY: "0.5",
|
|
9
10
|
borderRadius: "[2px]",
|
|
10
|
-
background:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
background: {
|
|
12
|
+
_light: "var(--likec4-palette-fill)/90",
|
|
13
|
+
_dark: "var(--likec4-palette-fill)/60"
|
|
14
|
+
},
|
|
15
|
+
lineHeight: "1",
|
|
13
16
|
color: {
|
|
14
|
-
_light:
|
|
17
|
+
_light: "var(--likec4-palette-hiContrast)",
|
|
15
18
|
_dark: "var(--likec4-palette-loContrast)"
|
|
16
19
|
}
|
|
17
20
|
});
|
|
@@ -73,7 +73,8 @@ export declare namespace Types {
|
|
|
73
73
|
type ViewGroupNode = ReactFlowNode<ViewGroupNodeData, 'view-group'>;
|
|
74
74
|
type Node = ElementNode | DeploymentElementNode | CompoundElementNode | CompoundDeploymentNode | ViewGroupNode;
|
|
75
75
|
type NodeData = Node['data'];
|
|
76
|
-
type RelationshipEdgeData = Simplify<Base.EdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'labelBBox' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo'
|
|
76
|
+
type RelationshipEdgeData = Simplify<Base.EdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'labelBBox' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo'>> & {
|
|
77
|
+
notes: RichTextOrEmpty;
|
|
77
78
|
labelXY: XYPosition | null;
|
|
78
79
|
controlPoints: XYPosition[] | undefined | null;
|
|
79
80
|
}>;
|
|
@@ -204,7 +204,7 @@ function viewToNodesEdge(opts) {
|
|
|
204
204
|
id: edge.id,
|
|
205
205
|
label: edge.label,
|
|
206
206
|
technology: edge.technology,
|
|
207
|
-
notes: edge.notes,
|
|
207
|
+
notes: RichText.from(edge.notes),
|
|
208
208
|
navigateTo: edge.navigateTo,
|
|
209
209
|
controlPoints: edge.controlPoints ?? null,
|
|
210
210
|
labelBBox: edge.labelBBox ?? null,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
|
|
2
|
-
import {
|
|
2
|
+
import { DiagramView } from '@likec4/core/types';
|
|
3
3
|
import { PropsWithChildren, Context } from 'react';
|
|
4
|
+
import type * as t from '@likec4/core/types';
|
|
5
|
+
type UnknownLayouted = t.aux.UnknownLayouted;
|
|
4
6
|
export declare const LikeC4ModelContext: Context<LikeC4Model<any> | null>;
|
|
5
|
-
export type CurrentViewModel = LikeC4ViewModel<
|
|
7
|
+
export type CurrentViewModel = LikeC4ViewModel<UnknownLayouted, DiagramView<UnknownLayouted>>;
|
|
6
8
|
export declare const CurrentViewModelContext: Context<CurrentViewModel | null>;
|
|
7
9
|
export declare function EnsureCurrentViewModel({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
elements: {
|
|
10
|
-
[x: string]: Partial< ElementSpecification>;
|
|
11
|
-
};
|
|
12
|
-
deployments: {
|
|
13
|
-
[x: string]: Partial< ElementSpecification>;
|
|
14
|
-
};
|
|
15
|
-
relationships: {
|
|
16
|
-
[x: string]: Partial< RelationshipSpecification>;
|
|
17
|
-
};
|
|
18
|
-
metadataKeys?: string[];
|
|
19
|
-
customColors?: CustomColorDefinitions;
|
|
20
|
-
};
|
|
1
|
+
import { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
|
|
2
|
+
import type * as t from '@likec4/core/types';
|
|
3
|
+
type Any = t.aux.Any;
|
|
4
|
+
export declare function useLikeC4Model<A extends Any = t.aux.UnknownLayouted>(): LikeC4Model<A>;
|
|
5
|
+
export declare function useLikeC4ViewModel<A extends Any = t.aux.UnknownLayouted>(viewId: t.aux.ViewId<A>): LikeC4ViewModel<A>;
|
|
6
|
+
export declare function useLikeC4Specification(): t.Specification<t.aux.UnknownLayouted>;
|
|
7
|
+
export {};
|