@likec4/diagram 1.36.0 → 1.37.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/bundle/{chunk-7MPUJFHj.js → chunk-DSORWspW.js} +1011 -983
- package/bundle/custom.js +64 -56
- package/bundle/index.js +3546 -3321
- package/dist/LikeC4Diagram.props.d.ts +5 -5
- package/dist/LikeC4Styles.js +17 -15
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/StaticLikeC4Diagram.js +3 -0
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +25 -27
- package/dist/base/const.d.ts +4 -4
- package/dist/base/const.js +5 -4
- package/dist/base/primitives/MarkdownBlock.js +4 -1
- package/dist/base/primitives/compound/CompoundActionButton.js +27 -42
- package/dist/base/primitives/compound/CompoundDetailsButton.js +23 -48
- package/dist/base/primitives/compound/CompoundNodeContainer.js +16 -48
- package/dist/base/primitives/compound/CompoundTitle.js +5 -80
- package/dist/base/primitives/compound/actionbtns.css.js +1 -13
- package/dist/base/primitives/customEdge.d.ts +1 -1
- package/dist/base/primitives/customNode.d.ts +4 -4
- package/dist/base/primitives/customNode.js +7 -7
- package/dist/base/primitives/edge/EdgeLabel.d.ts +5 -4
- package/dist/base/primitives/edge/EdgeLabel.js +39 -21
- package/dist/base/primitives/edge/EdgeLabelContainer.js +11 -23
- package/dist/base/primitives/edge/edge.css.js +19 -11
- package/dist/base/primitives/element/ElementShape.js +38 -18
- package/dist/base/primitives/element/ElementTags.js +7 -4
- package/dist/base/primitives/element/ElementTitle.js +10 -2
- package/dist/base/types.d.ts +17 -21
- package/dist/bundle/LikeC4View.d.ts +2 -2
- package/dist/bundle/LikeC4View.js +4 -1
- package/dist/bundle/LikeC4View.props.d.ts +2 -2
- package/dist/bundle/ReactLikeC4.d.ts +3 -3
- package/dist/bundle/custom.js +2 -1
- package/dist/bundle/index.js +2 -1
- package/dist/components/Link.js +3 -2
- package/dist/context/ReduceGraphics.js +2 -5
- package/dist/context/RootContainer.js +1 -5
- package/dist/custom/customNodes.d.ts +32 -26
- package/dist/custom/customNodes.js +12 -8
- package/dist/custom/hooks.d.ts +2 -1
- package/dist/custom/index.js +2 -1
- package/dist/globals.css.js +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useDiagram.d.ts +18 -1
- package/dist/hooks/useDiagram.js +18 -2
- package/dist/hooks/useXYFlow.d.ts +40 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/likec4diagram/DiagramUI.js +7 -3
- package/dist/likec4diagram/DiagramXYFlow.js +9 -9
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +3 -3
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +27 -44
- package/dist/likec4diagram/custom/index.js +3 -3
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +8 -6
- package/dist/likec4diagram/custom/nodes/nodes.js +13 -14
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +2 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +441 -0
- package/dist/likec4diagram/relationship-popover/actor.d.ts +177 -0
- package/dist/likec4diagram/relationship-popover/actor.js +155 -0
- package/dist/likec4diagram/relationship-popover/styles.css.d.ts +2 -0
- package/dist/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.js → relationship-popover/styles.css.js} +4 -17
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +4 -4
- package/dist/likec4diagram/useLayoutConstraints.js +0 -1
- package/dist/likec4model/LikeC4ModelContext.d.ts +2 -1
- package/dist/likec4model/LikeC4ModelContext.js +10 -2
- package/dist/likec4model/useCurrentViewModel.d.ts +1 -0
- package/dist/likec4model/useCurrentViewModel.js +4 -1
- package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
- package/dist/likec4model/useLikeC4Project.js +15 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +1 -2
- package/dist/navigationpanel/actor.js +1 -2
- package/dist/navigationpanel/controls/NavigationButtons.js +1 -5
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/ViewDetailsCard.js +2 -0
- package/dist/overlays/element-details/actor.d.ts +564 -8
- package/dist/overlays/overlay/Overlay.css.d.ts +1 -1
- package/dist/overlays/relationship-details/actor.d.ts +3 -1
- package/dist/overlays/relationship-details/hooks.d.ts +19 -1
- package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -1
- package/dist/overlays/relationship-details/layout.js +1 -2
- package/dist/overlays/relationships-browser/actor.d.ts +26 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +16 -0
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +18 -8
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -1
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/state/DiagramActorProvider.js +5 -23
- package/dist/state/assign.js +24 -10
- package/dist/state/diagram-machine.d.ts +149 -474
- package/dist/state/diagram-machine.js +94 -54
- package/dist/state/types.d.ts +1 -1
- 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/index.d.ts +2 -1
- package/dist/utils/roundDpr.d.ts +1 -0
- package/dist/utils/roundDpr.js +20 -0
- package/dist/utils/xyflow.d.ts +0 -1
- package/dist/utils/xyflow.js +1 -7
- package/package.json +11 -10
- package/panda.buildinfo.json +90 -155
- package/src/LikeC4Diagram.props.ts +5 -5
- package/src/LikeC4Styles.tsx +22 -14
- package/src/StaticLikeC4Diagram.tsx +3 -0
- package/src/base/BaseXYFlow.tsx +26 -29
- package/src/base/const.ts +5 -4
- package/src/base/primitives/MarkdownBlock.tsx +6 -1
- package/src/base/primitives/compound/CompoundActionButton.tsx +31 -43
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +26 -48
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +15 -43
- package/src/base/primitives/compound/CompoundTitle.tsx +4 -76
- package/src/base/primitives/compound/actionbtns.css.ts +0 -12
- package/src/base/primitives/customEdge.ts +1 -1
- package/src/base/primitives/customNode.tsx +20 -24
- package/src/base/primitives/edge/EdgeLabel.tsx +23 -8
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +9 -21
- package/src/base/primitives/edge/edge.css.ts +19 -11
- package/src/base/primitives/element/ElementShape.tsx +40 -18
- package/src/base/primitives/element/ElementTags.tsx +7 -4
- package/src/base/primitives/element/ElementTitle.tsx +23 -11
- package/src/base/types.ts +21 -25
- package/src/bundle/LikeC4View.props.ts +2 -2
- package/src/bundle/LikeC4View.tsx +8 -5
- package/src/bundle/ReactLikeC4.tsx +3 -3
- package/src/components/Link.tsx +3 -2
- package/src/context/RootContainer.tsx +1 -5
- package/src/context/TagStylesContext.tsx +2 -0
- package/src/custom/{customNodes.tsx → customNodes.ts} +58 -52
- package/src/custom/hooks.ts +7 -0
- package/src/globals.css +58 -5
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useDiagram.ts +39 -5
- package/src/hooks/useXYFlow.ts +3 -1
- package/src/index.ts +1 -0
- package/src/likec4diagram/DiagramUI.tsx +11 -2
- package/src/likec4diagram/DiagramXYFlow.tsx +9 -11
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +25 -49
- package/src/likec4diagram/custom/index.ts +5 -4
- package/src/likec4diagram/custom/nodes/nodes.tsx +13 -11
- package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -2
- package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +535 -0
- package/src/likec4diagram/relationship-popover/actor.ts +192 -0
- package/src/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.ts → relationship-popover/styles.css.ts} +3 -19
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +4 -5
- package/src/likec4diagram/useLayoutConstraints.ts +0 -1
- package/src/likec4model/{LikeC4ModelContext.ts → LikeC4ModelContext.tsx} +9 -1
- package/src/likec4model/useCurrentViewModel.ts +4 -0
- package/src/likec4model/useLikeC4ElementsTree.ts +1 -1
- package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -2
- package/src/navigationpanel/actor.ts +2 -2
- package/src/navigationpanel/controls/NavigationButtons.tsx +1 -5
- package/src/navigationpanel/controls/OpenSource.tsx +1 -1
- package/src/navigationpanel/controls/ViewDetailsCard.tsx +2 -0
- package/src/overlays/relationship-details/layout-to-xyflow.ts +0 -1
- package/src/overlays/relationship-details/layout.ts +4 -3
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +22 -8
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +0 -1
- package/src/state/DiagramActorProvider.tsx +8 -25
- package/src/state/assign.ts +24 -10
- package/src/state/diagram-machine.ts +101 -53
- package/src/state/types.ts +4 -1
- package/src/utils/index.ts +2 -1
- package/src/utils/roundDpr.ts +27 -0
- package/src/utils/xyflow.ts +0 -7
- package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -35
- package/dist/base/primitives/compound/CompoundNodeContainer.css.js +0 -132
- package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -7
- package/dist/base/primitives/edge/EdgeLabel.css.js +0 -57
- package/dist/base/primitives/element/ElementShape.css.d.ts +0 -6
- package/dist/base/primitives/element/ElementShape.css.js +0 -107
- package/dist/likec4diagram/custom/edges/NotePopover.css.js +0 -21
- package/dist/likec4diagram/custom/edges/NotePopover.js +0 -91
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.d.ts +0 -5
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.d.ts +0 -13
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +0 -215
- package/dist/likec4diagram/custom/index.d.ts +0 -62
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +0 -10
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -138
- package/src/base/primitives/edge/EdgeLabel.css.ts +0 -64
- package/src/base/primitives/element/ElementShape.css.ts +0 -112
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +0 -281
|
@@ -2,7 +2,7 @@ import { SlotRecipeRuntimeFn } from '@likec4/styles/types';
|
|
|
2
2
|
export declare const backdropBlur = "--_blur";
|
|
3
3
|
export declare const backdropOpacity = "--_opacity";
|
|
4
4
|
export declare const level = "--_level";
|
|
5
|
-
export declare const overlay: SlotRecipeRuntimeFn<"
|
|
5
|
+
export declare const overlay: SlotRecipeRuntimeFn<"dialog" | "body", {
|
|
6
6
|
fullscreen: {
|
|
7
7
|
false: {
|
|
8
8
|
dialog: {
|
|
@@ -5,7 +5,7 @@ import { Base } from '../../base';
|
|
|
5
5
|
import { RelationshipDetailsTypes } from './_types';
|
|
6
6
|
import { LayoutResult } from './layout';
|
|
7
7
|
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
8
|
-
import { ReactNode, CSSProperties } from 'react';
|
|
8
|
+
import { ReactNode, CSSProperties, AriaRole, SVGAttributes } from 'react';
|
|
9
9
|
type XYFLowInstance = ReactFlowInstance<RelationshipDetailsTypes.Node, RelationshipDetailsTypes.Edge>;
|
|
10
10
|
type XYStoreApi = ReturnType<typeof useStoreApi<RelationshipDetailsTypes.Node, RelationshipDetailsTypes.Edge>>;
|
|
11
11
|
export type Input = ExclusiveUnion<{
|
|
@@ -619,6 +619,8 @@ export declare const relationshipDetailsLogic: StateMachine<Readonly<{
|
|
|
619
619
|
className?: string;
|
|
620
620
|
reconnectable?: boolean | HandleType;
|
|
621
621
|
focusable?: boolean;
|
|
622
|
+
ariaRole?: AriaRole;
|
|
623
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
622
624
|
type: "relationship";
|
|
623
625
|
data: {
|
|
624
626
|
hovered?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EdgeId, Fqn, ViewId, RelationId, Color, RelationshipLineType, RichTextOrEmpty, BBox } from '@likec4/core';
|
|
2
2
|
import { RelationshipDetailsActorRef, RelationshipDetailsSnapshot, Events } from './actor';
|
|
3
|
-
import { Context, ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { Context, ReactNode, CSSProperties, AriaRole, SVGAttributes } from 'react';
|
|
4
4
|
import { GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
|
|
5
5
|
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
6
6
|
import { Dimmed } from '../../base/types.Base';
|
|
@@ -47,6 +47,8 @@ export declare function useRelationshipDetails(): {
|
|
|
47
47
|
className?: string;
|
|
48
48
|
reconnectable?: boolean | HandleType;
|
|
49
49
|
focusable?: boolean;
|
|
50
|
+
ariaRole?: AriaRole;
|
|
51
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
50
52
|
type: "relationship";
|
|
51
53
|
data: {
|
|
52
54
|
hovered?: boolean;
|
|
@@ -90,6 +92,8 @@ export declare function useRelationshipDetails(): {
|
|
|
90
92
|
className?: string;
|
|
91
93
|
reconnectable?: boolean | HandleType;
|
|
92
94
|
focusable?: boolean;
|
|
95
|
+
ariaRole?: AriaRole;
|
|
96
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
93
97
|
type: "relationship";
|
|
94
98
|
data: {
|
|
95
99
|
hovered?: boolean;
|
|
@@ -130,6 +134,8 @@ export declare function useRelationshipDetails(): {
|
|
|
130
134
|
className?: string;
|
|
131
135
|
reconnectable?: boolean | HandleType;
|
|
132
136
|
focusable?: boolean;
|
|
137
|
+
ariaRole?: AriaRole;
|
|
138
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
133
139
|
type: "relationship";
|
|
134
140
|
data: {
|
|
135
141
|
hovered?: boolean;
|
|
@@ -169,6 +175,8 @@ export declare function useRelationshipDetails(): {
|
|
|
169
175
|
className?: string;
|
|
170
176
|
reconnectable?: boolean | HandleType;
|
|
171
177
|
focusable?: boolean;
|
|
178
|
+
ariaRole?: AriaRole;
|
|
179
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
172
180
|
type: "relationship";
|
|
173
181
|
data: {
|
|
174
182
|
hovered?: boolean;
|
|
@@ -208,6 +216,8 @@ export declare function useRelationshipDetails(): {
|
|
|
208
216
|
className?: string;
|
|
209
217
|
reconnectable?: boolean | HandleType;
|
|
210
218
|
focusable?: boolean;
|
|
219
|
+
ariaRole?: AriaRole;
|
|
220
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
211
221
|
type: "relationship";
|
|
212
222
|
data: {
|
|
213
223
|
hovered?: boolean;
|
|
@@ -247,6 +257,8 @@ export declare function useRelationshipDetails(): {
|
|
|
247
257
|
className?: string;
|
|
248
258
|
reconnectable?: boolean | HandleType;
|
|
249
259
|
focusable?: boolean;
|
|
260
|
+
ariaRole?: AriaRole;
|
|
261
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
250
262
|
type: "relationship";
|
|
251
263
|
data: {
|
|
252
264
|
hovered?: boolean;
|
|
@@ -286,6 +298,8 @@ export declare function useRelationshipDetails(): {
|
|
|
286
298
|
className?: string;
|
|
287
299
|
reconnectable?: boolean | HandleType;
|
|
288
300
|
focusable?: boolean;
|
|
301
|
+
ariaRole?: AriaRole;
|
|
302
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
289
303
|
type: "relationship";
|
|
290
304
|
data: {
|
|
291
305
|
hovered?: boolean;
|
|
@@ -326,6 +340,8 @@ export declare function useRelationshipDetails(): {
|
|
|
326
340
|
className?: string;
|
|
327
341
|
reconnectable?: boolean | HandleType;
|
|
328
342
|
focusable?: boolean;
|
|
343
|
+
ariaRole?: AriaRole;
|
|
344
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
329
345
|
type: "relationship";
|
|
330
346
|
data: {
|
|
331
347
|
hovered?: boolean;
|
|
@@ -365,6 +381,8 @@ export declare function useRelationshipDetails(): {
|
|
|
365
381
|
className?: string;
|
|
366
382
|
reconnectable?: boolean | HandleType;
|
|
367
383
|
focusable?: boolean;
|
|
384
|
+
ariaRole?: AriaRole;
|
|
385
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
368
386
|
type: "relationship";
|
|
369
387
|
data: {
|
|
370
388
|
hovered?: boolean;
|
|
@@ -121,7 +121,6 @@ function layoutResultToXYFlow(layout) {
|
|
|
121
121
|
target: ns + target,
|
|
122
122
|
sourceHandle: edge.sourceHandle,
|
|
123
123
|
targetHandle: edge.targetHandle,
|
|
124
|
-
zIndex: ZIndexes.Edge,
|
|
125
124
|
// selectable: selectable,
|
|
126
125
|
// hidden: !visiblePredicate(edge),
|
|
127
126
|
deletable: false,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { treeFromElements } from '@likec4/core/compute-view/relationships';
|
|
2
2
|
import dagre from '@dagrejs/dagre';
|
|
3
|
-
import { RichText, invariant } from '@likec4/core';
|
|
4
|
-
import { ifind, DefaultMap } from '@likec4/core/utils';
|
|
3
|
+
import { ifind, RichText, DefaultMap, invariant } from '@likec4/core';
|
|
5
4
|
import { pipe, filter, mapToObj, find, map, tap, reduce, sortBy, prop } from 'remeda';
|
|
6
5
|
|
|
7
6
|
const Sizes = {
|
|
@@ -5,7 +5,7 @@ import { Base } from '../../base';
|
|
|
5
5
|
import { RelationshipsBrowserTypes } from './_types';
|
|
6
6
|
import { LayoutRelationshipsViewResult } from './layout';
|
|
7
7
|
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
8
|
-
import { ReactNode, CSSProperties } from 'react';
|
|
8
|
+
import { ReactNode, CSSProperties, AriaRole, SVGAttributes } from 'react';
|
|
9
9
|
type XYFLowInstance = ReactFlowInstance<RelationshipsBrowserTypes.Node, RelationshipsBrowserTypes.Edge>;
|
|
10
10
|
export type XYStoreApi = ReturnType<typeof useStoreApi<RelationshipsBrowserTypes.Node, RelationshipsBrowserTypes.Edge>>;
|
|
11
11
|
export declare const layouter: PromiseActorLogic<{
|
|
@@ -202,6 +202,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
202
202
|
className?: string;
|
|
203
203
|
reconnectable?: boolean | HandleType;
|
|
204
204
|
focusable?: boolean;
|
|
205
|
+
ariaRole?: AriaRole;
|
|
206
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
205
207
|
type: "relationship";
|
|
206
208
|
data: {
|
|
207
209
|
hovered?: boolean;
|
|
@@ -255,6 +257,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
255
257
|
className?: string;
|
|
256
258
|
reconnectable?: boolean | HandleType;
|
|
257
259
|
focusable?: boolean;
|
|
260
|
+
ariaRole?: AriaRole;
|
|
261
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
258
262
|
type: "relationship";
|
|
259
263
|
data: {
|
|
260
264
|
hovered?: boolean;
|
|
@@ -315,6 +319,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
315
319
|
className?: string;
|
|
316
320
|
reconnectable?: boolean | HandleType;
|
|
317
321
|
focusable?: boolean;
|
|
322
|
+
ariaRole?: AriaRole;
|
|
323
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
318
324
|
type: "relationship";
|
|
319
325
|
data: {
|
|
320
326
|
hovered?: boolean;
|
|
@@ -352,7 +358,7 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
352
358
|
}) => {
|
|
353
359
|
subject: Fqn;
|
|
354
360
|
viewId: ViewId | null;
|
|
355
|
-
scope: "
|
|
361
|
+
scope: "global" | "view";
|
|
356
362
|
closeable: boolean;
|
|
357
363
|
enableSelectSubject: boolean;
|
|
358
364
|
enableChangeScope: boolean;
|
|
@@ -800,6 +806,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
800
806
|
className?: string;
|
|
801
807
|
reconnectable?: boolean | HandleType;
|
|
802
808
|
focusable?: boolean;
|
|
809
|
+
ariaRole?: AriaRole;
|
|
810
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
803
811
|
type: "relationship";
|
|
804
812
|
data: {
|
|
805
813
|
hovered?: boolean;
|
|
@@ -844,6 +852,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
844
852
|
className?: string;
|
|
845
853
|
reconnectable?: boolean | HandleType;
|
|
846
854
|
focusable?: boolean;
|
|
855
|
+
ariaRole?: AriaRole;
|
|
856
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
847
857
|
type: "relationship";
|
|
848
858
|
data: {
|
|
849
859
|
hovered?: boolean;
|
|
@@ -885,6 +895,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
885
895
|
className?: string;
|
|
886
896
|
reconnectable?: boolean | HandleType;
|
|
887
897
|
focusable?: boolean;
|
|
898
|
+
ariaRole?: AriaRole;
|
|
899
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
888
900
|
type: "relationship";
|
|
889
901
|
data: {
|
|
890
902
|
hovered?: boolean;
|
|
@@ -925,6 +937,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
925
937
|
className?: string;
|
|
926
938
|
reconnectable?: boolean | HandleType;
|
|
927
939
|
focusable?: boolean;
|
|
940
|
+
ariaRole?: AriaRole;
|
|
941
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
928
942
|
type: "relationship";
|
|
929
943
|
data: {
|
|
930
944
|
hovered?: boolean;
|
|
@@ -965,6 +979,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
965
979
|
className?: string;
|
|
966
980
|
reconnectable?: boolean | HandleType;
|
|
967
981
|
focusable?: boolean;
|
|
982
|
+
ariaRole?: AriaRole;
|
|
983
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
968
984
|
type: "relationship";
|
|
969
985
|
data: {
|
|
970
986
|
hovered?: boolean;
|
|
@@ -1005,6 +1021,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
1005
1021
|
className?: string;
|
|
1006
1022
|
reconnectable?: boolean | HandleType;
|
|
1007
1023
|
focusable?: boolean;
|
|
1024
|
+
ariaRole?: AriaRole;
|
|
1025
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
1008
1026
|
type: "relationship";
|
|
1009
1027
|
data: {
|
|
1010
1028
|
hovered?: boolean;
|
|
@@ -1045,6 +1063,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
1045
1063
|
className?: string;
|
|
1046
1064
|
reconnectable?: boolean | HandleType;
|
|
1047
1065
|
focusable?: boolean;
|
|
1066
|
+
ariaRole?: AriaRole;
|
|
1067
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
1048
1068
|
type: "relationship";
|
|
1049
1069
|
data: {
|
|
1050
1070
|
hovered?: boolean;
|
|
@@ -1086,6 +1106,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
1086
1106
|
className?: string;
|
|
1087
1107
|
reconnectable?: boolean | HandleType;
|
|
1088
1108
|
focusable?: boolean;
|
|
1109
|
+
ariaRole?: AriaRole;
|
|
1110
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
1089
1111
|
type: "relationship";
|
|
1090
1112
|
data: {
|
|
1091
1113
|
hovered?: boolean;
|
|
@@ -1126,6 +1148,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Context, Events, {
|
|
|
1126
1148
|
className?: string;
|
|
1127
1149
|
reconnectable?: boolean | HandleType;
|
|
1128
1150
|
focusable?: boolean;
|
|
1151
|
+
ariaRole?: AriaRole;
|
|
1152
|
+
domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
|
|
1129
1153
|
type: "relationship";
|
|
1130
1154
|
data: {
|
|
1131
1155
|
hovered?: boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { NodeProps } from '../../../base';
|
|
3
|
+
import { RelationshipsBrowserTypes } from '../_types';
|
|
4
|
+
type NodeTypes = {
|
|
5
|
+
element: FC<NodeProps<RelationshipsBrowserTypes.ElementNodeData>>;
|
|
6
|
+
compound: FC<NodeProps<RelationshipsBrowserTypes.CompoundNodeData>>;
|
|
7
|
+
empty: FC<NodeProps<RelationshipsBrowserTypes.EmptyNodeData>>;
|
|
8
|
+
};
|
|
9
|
+
export declare const ElementNode: NodeTypes['element'];
|
|
10
|
+
export declare const CompoundNode: NodeTypes['compound'];
|
|
11
|
+
export declare const EmptyNode: NodeTypes['empty'];
|
|
12
|
+
type ElementPortsProps = NodeProps<Pick<RelationshipsBrowserTypes.ElementNodeData, 'ports' | 'height'>>;
|
|
13
|
+
export declare const ElementPorts: ({ data: { ports, height: h } }: ElementPortsProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
type CompoundPortsProps = NodeProps<Pick<RelationshipsBrowserTypes.CompoundNodeData, 'ports'>>;
|
|
15
|
+
export declare const CompoundPorts: ({ data }: CompoundPortsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -5,9 +5,9 @@ import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
|
5
5
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
6
6
|
import { ElementActions } from './ElementActions.js';
|
|
7
7
|
import { EmptyNode as EmptyNode$1 } from './EmptyNode.js';
|
|
8
|
-
import { customNode } from '../../../base/primitives/customNode.js';
|
|
9
8
|
import { CompoundNodeContainer } from '../../../base/primitives/compound/CompoundNodeContainer.js';
|
|
10
9
|
import { CompoundTitle } from '../../../base/primitives/compound/CompoundTitle.js';
|
|
10
|
+
import { CompoundDetailsButton } from '../../../base/primitives/compound/CompoundDetailsButton.js';
|
|
11
11
|
import { ElementNodeContainer } from '../../../base/primitives/element/ElementNodeContainer.js';
|
|
12
12
|
import { ElementShape } from '../../../base/primitives/element/ElementShape.js';
|
|
13
13
|
import { ElementTitle } from '../../../base/primitives/element/ElementTitle.js';
|
|
@@ -27,7 +27,7 @@ const ElementDetailsButtonWithHandler = (props) => {
|
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
};
|
|
30
|
-
const ElementNode =
|
|
30
|
+
const ElementNode = (props) => {
|
|
31
31
|
const { enableElementTags } = useEnabledFeatures();
|
|
32
32
|
return /* @__PURE__ */ jsxs(ElementNodeContainer, { layoutId: props.id, nodeProps: props, children: [
|
|
33
33
|
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
@@ -37,17 +37,27 @@ const ElementNode = customNode((props) => {
|
|
|
37
37
|
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
38
38
|
/* @__PURE__ */ jsx(ElementPorts, { ...props })
|
|
39
39
|
] }, props.id);
|
|
40
|
-
}
|
|
41
|
-
const CompoundNode =
|
|
40
|
+
};
|
|
41
|
+
const CompoundNode = (props) => {
|
|
42
|
+
const diagram = useDiagram();
|
|
42
43
|
return /* @__PURE__ */ jsxs(CompoundNodeContainer, { layoutId: props.id, nodeProps: props, children: [
|
|
43
|
-
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
44
44
|
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
CompoundDetailsButton,
|
|
47
|
+
{
|
|
48
|
+
...props,
|
|
49
|
+
onClick: (e) => {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
diagram.openElementDetails(props.data.fqn);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
),
|
|
45
55
|
/* @__PURE__ */ jsx(CompoundPorts, { ...props })
|
|
46
56
|
] }, props.id);
|
|
47
|
-
}
|
|
48
|
-
const EmptyNode =
|
|
57
|
+
};
|
|
58
|
+
const EmptyNode = (props) => {
|
|
49
59
|
return /* @__PURE__ */ jsx(EmptyNode$1, { ...props });
|
|
50
|
-
}
|
|
60
|
+
};
|
|
51
61
|
const ElementPorts = ({ data: { ports, height: h } }) => {
|
|
52
62
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
63
|
ports.in.map((id, i) => /* @__PURE__ */ jsx(
|
|
@@ -137,7 +137,6 @@ function viewToNodesEdge(view) {
|
|
|
137
137
|
target: ns + target,
|
|
138
138
|
sourceHandle: edge.sourceHandle,
|
|
139
139
|
targetHandle: edge.targetHandle,
|
|
140
|
-
zIndex: ZIndexes.Edge,
|
|
141
140
|
// selectable: selectable,
|
|
142
141
|
// hidden: !visiblePredicate(edge),
|
|
143
142
|
// deletable: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SlotRecipeRuntimeFn, SlotRecipeVariantRecord } from '@likec4/styles/types';
|
|
2
2
|
export declare const focusable = "likec4-focusable";
|
|
3
3
|
export declare const emptyBoX: string;
|
|
4
|
-
export declare const buttonsva: SlotRecipeRuntimeFn<"
|
|
4
|
+
export declare const buttonsva: SlotRecipeRuntimeFn<"title" | "description" | "icon" | "root" | "descriptionColor", SlotRecipeVariantRecord<"title" | "description" | "icon" | "root" | "descriptionColor">>;
|
|
@@ -3,12 +3,11 @@ import { useCustomCompareEffect } from '@react-hookz/web';
|
|
|
3
3
|
import { useActorRef, useSelector } from '@xstate/react';
|
|
4
4
|
import { useStoreApi } from '@xyflow/react';
|
|
5
5
|
import { shallowEqual, deepEqual } from 'fast-equals';
|
|
6
|
-
import { useRef, useEffect
|
|
6
|
+
import { useRef, useEffect } from 'react';
|
|
7
7
|
import { ErrorBoundary } from '../components/ErrorFallback.js';
|
|
8
8
|
import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
9
9
|
import { useEnabledFeatures, DiagramFeatures } from '../context/DiagramFeatures.js';
|
|
10
10
|
import { DiagramActorContextProvider } from '../hooks/safeContext.js';
|
|
11
|
-
import { useCurrentViewId } from '../hooks/useCurrentViewId.js';
|
|
12
11
|
import { useViewToNodesEdges } from '../likec4diagram/useViewToNodesEdges.js';
|
|
13
12
|
import { CurrentViewModelContext } from '../likec4model/LikeC4ModelContext.js';
|
|
14
13
|
import { useLikeC4Model } from '../likec4model/useLikeC4Model.js';
|
|
@@ -90,31 +89,14 @@ function DiagramActorProvider({
|
|
|
90
89
|
actorRef.send({ type: "update.view", view, xyedges, xynodes });
|
|
91
90
|
}, [view, xyedges, xynodes]);
|
|
92
91
|
const toggledFeatures = useSelector(actorRef, selectToggledFeatures, shallowEqual);
|
|
93
|
-
return /* @__PURE__ */ jsx(DiagramActorContextProvider, { value: actorRef, children: /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(CurrentViewModelProvider, { children }) }) }) });
|
|
92
|
+
return /* @__PURE__ */ jsx(DiagramActorContextProvider, { value: actorRef, children: /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(CurrentViewModelProvider, { viewId: view.id, children }) }) }) });
|
|
94
93
|
}
|
|
95
94
|
function CurrentViewModelProvider({
|
|
96
|
-
children
|
|
95
|
+
children,
|
|
96
|
+
viewId
|
|
97
97
|
}) {
|
|
98
|
-
const viewId = useCurrentViewId();
|
|
99
98
|
const likec4model = useLikeC4Model();
|
|
100
|
-
const
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
setViewmodel((current) => {
|
|
103
|
-
const nextviewmodel = likec4model.findView(viewId);
|
|
104
|
-
if (!nextviewmodel) {
|
|
105
|
-
console.error(`View "${viewId}" not found in likec4model, current viewmodel: ${current.id}`, {
|
|
106
|
-
currentViewModel: current,
|
|
107
|
-
likec4model
|
|
108
|
-
});
|
|
109
|
-
return current;
|
|
110
|
-
}
|
|
111
|
-
return nextviewmodel;
|
|
112
|
-
});
|
|
113
|
-
}, [likec4model, viewId]);
|
|
114
|
-
if (!viewmodel.isDiagram()) {
|
|
115
|
-
console.warn(`View "${viewId}" is not diagram.
|
|
116
|
-
Make sure you have LikeC4ModelProvider with layouted model.`);
|
|
117
|
-
}
|
|
99
|
+
const viewmodel = likec4model.findView(viewId);
|
|
118
100
|
return /* @__PURE__ */ jsx(CurrentViewModelContext.Provider, { value: viewmodel, children });
|
|
119
101
|
}
|
|
120
102
|
function useActorEventHandlers(actorRef) {
|
package/dist/state/assign.js
CHANGED
|
@@ -237,22 +237,36 @@ function navigateForward({ context }) {
|
|
|
237
237
|
}
|
|
238
238
|
function updateNodeData({ context, event }) {
|
|
239
239
|
assertEvent(event, "update.nodeData");
|
|
240
|
-
const xynodes = context.xynodes.map(
|
|
241
|
-
(node
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
const xynodes = context.xynodes.map((node) => {
|
|
241
|
+
if (node.id !== event.nodeId) {
|
|
242
|
+
return node;
|
|
243
|
+
}
|
|
244
|
+
const data = mergeDeep(node.data, event.data);
|
|
245
|
+
if (deepEqual(data, node.data)) {
|
|
246
|
+
return node;
|
|
244
247
|
}
|
|
245
|
-
|
|
248
|
+
return {
|
|
249
|
+
...node,
|
|
250
|
+
data
|
|
251
|
+
};
|
|
252
|
+
});
|
|
246
253
|
return { xynodes };
|
|
247
254
|
}
|
|
248
255
|
function updateEdgeData({ context, event }) {
|
|
249
256
|
assertEvent(event, "update.edgeData");
|
|
250
|
-
const xyedges = context.xyedges.map(
|
|
251
|
-
(edge
|
|
252
|
-
|
|
253
|
-
|
|
257
|
+
const xyedges = context.xyedges.map((edge) => {
|
|
258
|
+
if (edge.id !== event.edgeId) {
|
|
259
|
+
return edge;
|
|
260
|
+
}
|
|
261
|
+
const data = mergeDeep(edge.data, event.data);
|
|
262
|
+
if (deepEqual(data, edge.data)) {
|
|
263
|
+
return edge;
|
|
254
264
|
}
|
|
255
|
-
|
|
265
|
+
return {
|
|
266
|
+
...edge,
|
|
267
|
+
data
|
|
268
|
+
};
|
|
269
|
+
});
|
|
256
270
|
return { xyedges };
|
|
257
271
|
}
|
|
258
272
|
function resetEdgeControlPoints({ context }) {
|