@likec4/diagram 1.24.0 → 1.24.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/dist/LikeC4Diagram.css.d.ts +5 -0
- package/dist/LikeC4Diagram.css.js +1 -0
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +6 -2
- package/dist/LikeC4Diagram.props.d.ts +6 -0
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +12 -3
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/primitives/compound/CompoundActionButton.css.js +2 -0
- package/dist/base/primitives/compound/CompoundDetailsButton.css.js +2 -0
- package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
- package/dist/base/primitives/compound/CompoundNodeContainer.js +35 -22
- package/dist/base/primitives/compound/CompoundTitle.css.js +3 -1
- package/dist/base/primitives/customNode.js +1 -1
- package/dist/base/primitives/edge/EdgeContainer.js +5 -4
- package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +2 -5
- package/dist/base/primitives/edge/EdgeLabel.js +5 -5
- package/dist/base/primitives/edge/edge.css.d.ts +1 -1
- package/dist/base/primitives/edge/edge.css.js +4 -5
- package/dist/base/primitives/element/ElementActionButtons.css.js +2 -0
- package/dist/base/primitives/element/ElementActionButtons.js +4 -3
- package/dist/base/primitives/element/ElementDetailsButton.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -1
- package/dist/base/primitives/element/ElementShape.css.js +4 -2
- package/dist/base/primitives/element/ElementShape.js +2 -3
- package/dist/base/primitives/element/ElementTitle.css.js +2 -0
- package/dist/base/primitives/element/styles.css.js +2 -0
- package/dist/components/SearchControl.css.js +2 -0
- package/dist/context/FramerMotionConfig.d.ts +9 -1
- package/dist/context/FramerMotionConfig.js +5 -2
- package/dist/context/RootContainer.js +13 -1
- package/dist/diagram.css +1 -1
- package/dist/globals.css.d.ts +2 -0
- package/dist/hooks/safeContext.js +1 -0
- package/dist/hooks/useDiagram.d.ts +554 -864
- package/dist/hooks/useDiagram.js +1 -0
- package/dist/hooks/useIsReducedGraphics.d.ts +4 -0
- package/dist/hooks/useIsReducedGraphics.js +8 -0
- package/dist/hooks/useXYFlow.js +1 -1
- package/dist/likec4diagram/DiagramUI.d.ts +2 -1
- package/dist/likec4diagram/DiagramUI.js +5 -3
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +2 -2
- package/dist/likec4diagram/ui/controls/styles.css.js +2 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.js +2 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +3 -4
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +2 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +12 -8
- package/dist/overlays/element-details/actor.d.ts +9084 -2569
- package/dist/overlays/overlay/Overlay.js +6 -3
- package/dist/overlays/relationship-details/RelationshipDetails.js +31 -17
- package/dist/overlays/relationship-details/actor.d.ts +228 -3
- package/dist/overlays/relationship-details/actor.js +86 -14
- package/dist/overlays/relationship-details/hooks.d.ts +3 -0
- package/dist/overlays/relationship-details/hooks.js +6 -2
- package/dist/overlays/relationships-browser/-useRelationshipsView.js +12 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +12 -3
- package/dist/overlays/relationships-browser/actor.d.ts +271 -54
- package/dist/overlays/relationships-browser/actor.js +86 -23
- package/dist/state/DiagramActorProvider.js +12 -2
- package/dist/state/diagram-machine.d.ts +563 -867
- package/dist/state/diagram-machine.js +82 -81
- package/dist/state/persistence.d.ts +5 -0
- package/dist/state/persistence.js +23 -0
- package/package.json +9 -9
- package/src/LikeC4Diagram.css.ts +13 -5
- package/src/LikeC4Diagram.props.ts +7 -0
- package/src/LikeC4Diagram.tsx +33 -24
- package/src/base/BaseXYFlow.tsx +14 -9
- package/src/base/const.ts +1 -1
- package/src/base/primitives/compound/CompoundActionButton.css.ts +6 -0
- package/src/base/primitives/compound/CompoundDetailsButton.css.ts +4 -0
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +41 -59
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +42 -22
- package/src/base/primitives/compound/CompoundTitle.css.ts +14 -13
- package/src/base/primitives/customNode.ts +3 -2
- package/src/base/primitives/edge/EdgeContainer.tsx +4 -3
- package/src/base/primitives/edge/EdgeLabel.css.ts +17 -11
- package/src/base/primitives/edge/EdgeLabel.tsx +4 -4
- package/src/base/primitives/edge/edge.css.ts +47 -27
- package/src/base/primitives/element/ElementActionButtons.css.ts +4 -0
- package/src/base/primitives/element/ElementActionButtons.tsx +4 -2
- package/src/base/primitives/element/ElementDetailsButton.css.ts +6 -8
- package/src/base/primitives/element/ElementNodeContainer.css.ts +18 -21
- package/src/base/primitives/element/ElementNodeContainer.tsx +3 -1
- package/src/base/primitives/element/ElementShape.css.ts +10 -6
- package/src/base/primitives/element/ElementShape.tsx +2 -2
- package/src/components/SearchControl.css.ts +11 -4
- package/src/context/FramerMotionConfig.tsx +13 -2
- package/src/context/RootContainer.tsx +9 -2
- package/src/globals.css.ts +3 -0
- package/src/hooks/safeContext.tsx +2 -1
- package/src/hooks/useDiagram.ts +1 -0
- package/src/hooks/useIsReducedGraphics.ts +5 -0
- package/src/hooks/useXYFlow.ts +1 -1
- package/src/likec4diagram/DiagramUI.tsx +5 -3
- package/src/likec4diagram/custom/nodes/nodeTypes.tsx +2 -2
- package/src/likec4diagram/ui/controls/styles.css.ts +11 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.ts +10 -3
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +6 -3
- package/src/likec4diagram/ui/search/LikeC4Search.css.ts +1 -0
- package/src/overlays/element-details/ElementDetailsCard.tsx +238 -231
- package/src/overlays/overlay/Overlay.css.ts +1 -9
- package/src/overlays/overlay/Overlay.tsx +6 -3
- package/src/overlays/relationship-details/RelationshipDetails.tsx +83 -66
- package/src/overlays/relationship-details/actor.ts +106 -13
- package/src/overlays/relationship-details/hooks.ts +6 -2
- package/src/overlays/relationships-browser/-useRelationshipsView.ts +10 -0
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +16 -8
- package/src/overlays/relationships-browser/actor.ts +92 -22
- package/src/state/DiagramActorProvider.tsx +13 -2
- package/src/state/diagram-machine.ts +80 -79
- package/src/state/persistence.ts +22 -0
package/dist/hooks/useDiagram.js
CHANGED
package/dist/hooks/useXYFlow.js
CHANGED
|
@@ -10,7 +10,7 @@ function useXYStore(selector, equalityFn) {
|
|
|
10
10
|
}
|
|
11
11
|
const useXYStoreApi = useStoreApi;
|
|
12
12
|
const useXYInternalNode = useInternalNode;
|
|
13
|
-
const selectZoom = (state) => state.transform[2] < 0.
|
|
13
|
+
const selectZoom = (state) => state.transform[2] < 0.25;
|
|
14
14
|
function useIsZoomTooSmall() {
|
|
15
15
|
return useStore(selectZoom);
|
|
16
16
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { MemoExoticComponent } from 'react';
|
|
2
|
+
export declare const DiagramUI: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
2
3
|
import { useDiagramActorSnapshot } from "../hooks/useDiagram.js";
|
|
3
4
|
import { Overlays } from "../overlays/Overlays.js";
|
|
4
5
|
import { useEnabledFeatures } from "../context/DiagramFeatures.js";
|
|
@@ -6,13 +7,13 @@ import { Controls } from "./ui/controls/Controls.js";
|
|
|
6
7
|
import { DiagramTitlePanel } from "./ui/diagram-title/DiagramTitlePanel.js";
|
|
7
8
|
import { NotationPanel } from "./ui/notation/NotationPanel.js";
|
|
8
9
|
import { DynamicViewWalkthrough } from "./ui/walkthrough/DynamicViewWalkthrough.js";
|
|
9
|
-
|
|
10
|
+
const DiagramUI = memo(() => {
|
|
10
11
|
const {
|
|
11
12
|
enableViewTitle,
|
|
12
13
|
enableNotations,
|
|
13
14
|
enableDynamicViewWalkthrough
|
|
14
15
|
} = useEnabledFeatures();
|
|
15
|
-
const overlaysActorRef = useDiagramActorSnapshot((s) => s.children.overlays);
|
|
16
|
+
const overlaysActorRef = useDiagramActorSnapshot((s) => s.children.overlays, Object.is);
|
|
16
17
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
18
|
/* @__PURE__ */ jsx(Controls, {}),
|
|
18
19
|
overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
|
|
@@ -20,7 +21,8 @@ function DiagramUI() {
|
|
|
20
21
|
enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
|
|
21
22
|
enableDynamicViewWalkthrough && /* @__PURE__ */ jsx(DynamicViewWalkthrough, {})
|
|
22
23
|
] });
|
|
23
|
-
}
|
|
24
|
+
});
|
|
25
|
+
DiagramUI.displayName = "DiagramUI";
|
|
24
26
|
export {
|
|
25
27
|
DiagramUI
|
|
26
28
|
};
|
|
@@ -32,7 +32,7 @@ const ElementDetailsButtonWithHandler = ({ fqn, ...props }) => {
|
|
|
32
32
|
};
|
|
33
33
|
const nodeTypes = {
|
|
34
34
|
element: customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
35
|
-
/* @__PURE__ */ jsx(ElementShape, { ...props, isMultiple: props.data.isMultiple }),
|
|
35
|
+
/* @__PURE__ */ jsx(ElementShape, { ...props, isMultiple: props.data.isMultiple, withSelectedIndicator: props.selected }),
|
|
36
36
|
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
37
37
|
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
38
38
|
/* @__PURE__ */ jsx(
|
|
@@ -46,7 +46,7 @@ const nodeTypes = {
|
|
|
46
46
|
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
47
47
|
] })),
|
|
48
48
|
deployment: customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
49
|
-
/* @__PURE__ */ jsx(ElementShape, { ...props, isMultiple: props.data.isMultiple }),
|
|
49
|
+
/* @__PURE__ */ jsx(ElementShape, { ...props, isMultiple: props.data.isMultiple, withSelectedIndicator: props.selected }),
|
|
50
50
|
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
51
51
|
/* @__PURE__ */ jsx(DeploymentElementActions, { ...props }),
|
|
52
52
|
!!props.data.modelFqn && /* @__PURE__ */ jsx(
|
|
@@ -115,8 +115,8 @@ function DiagramTitlePanel() {
|
|
|
115
115
|
Spoiler,
|
|
116
116
|
{
|
|
117
117
|
maxHeight: 42,
|
|
118
|
-
showLabel: /* @__PURE__ */ jsx(Button, { color: "gray", variant: "light", fz: "10", size: "compact-xs", tabIndex: -1, children: "show more" }),
|
|
119
|
-
hideLabel: /* @__PURE__ */ jsx(Button, { color: "gray", variant: "light", fz: "10", size: "compact-xs", tabIndex: -1, children: "hide" }),
|
|
118
|
+
showLabel: /* @__PURE__ */ jsx(Button, { component: "div", color: "gray", variant: "light", fz: "10", size: "compact-xs", tabIndex: -1, children: "show more" }),
|
|
119
|
+
hideLabel: /* @__PURE__ */ jsx(Button, { component: "div", color: "gray", variant: "light", fz: "10", size: "compact-xs", tabIndex: -1, children: "hide" }),
|
|
120
120
|
children: /* @__PURE__ */ jsx(
|
|
121
121
|
Text,
|
|
122
122
|
{
|
|
@@ -151,8 +151,7 @@ function DiagramTitlePanel() {
|
|
|
151
151
|
]
|
|
152
152
|
}
|
|
153
153
|
)
|
|
154
|
-
}
|
|
155
|
-
id
|
|
154
|
+
}
|
|
156
155
|
) });
|
|
157
156
|
}
|
|
158
157
|
export {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { isScopedElementView, isDeploymentView } from "@likec4/core";
|
|
3
|
-
import { Card, Box, Group, Text, CloseButton, Badge, Flex, ActionIconGroup, ActionIcon, Tooltip as Tooltip$1, Tabs, TabsList, TabsTab, TabsPanel, ScrollArea, Stack, Divider as Divider$1, Code, UnstyledButton, ThemeIcon } from "@mantine/core";
|
|
3
|
+
import { RemoveScroll, Card, Box, Group, Text, CloseButton, Badge, Flex, ActionIconGroup, ActionIcon, Tooltip as Tooltip$1, Tabs, TabsList, TabsTab, TabsPanel, ScrollArea, Stack, Divider as Divider$1, Code, UnstyledButton, ThemeIcon } from "@mantine/core";
|
|
4
4
|
import { useViewportSize, useSessionStorage } from "@mantine/hooks";
|
|
5
5
|
import { useSyncedRef, useDebouncedCallback, useTimeoutEffect } from "@react-hookz/web";
|
|
6
6
|
import { IconExternalLink, IconFileSymlink, IconZoomScan, IconStack2 } from "@tabler/icons-react";
|
|
7
|
+
import clsx from "clsx";
|
|
7
8
|
import { useDragControls, useMotionValue, m } from "framer-motion";
|
|
8
9
|
import { useState, useCallback, useRef } from "react";
|
|
9
10
|
import { pipe, map, partition, only, clamp, isNullish } from "remeda";
|
|
10
11
|
import { Link } from "../../components/Link.js";
|
|
11
12
|
import { useDiagram } from "../../hooks/useDiagram.js";
|
|
12
|
-
import {
|
|
13
|
+
import { card, cardHeader, title, tabsPanel, tabsTab, tabsList, tabsRoot, propertiesGrid, resizeHandle, dialog, elementIcon, propertyLabel, viewButton, viewButtonTitle } from "./ElementDetailsCard.css.js";
|
|
13
14
|
import { TabPanelDeployments } from "./TabPanelDeployments.js";
|
|
14
15
|
import { TabPanelRelationships } from "./TabPanelRelationships.js";
|
|
15
16
|
import { TabPanelStructure } from "./TabPanelStructure.js";
|
|
16
17
|
import { useLikeC4Model } from "../../likec4model/useLikeC4Model.js";
|
|
17
18
|
import { useUpdateEffect } from "../../hooks/useUpdateEffect.js";
|
|
18
19
|
import { IconRenderer } from "../../context/IconRenderer.js";
|
|
20
|
+
import { stopPropagation } from "../../utils/xyflow.js";
|
|
19
21
|
import { IfEnabled, DiagramFeatures } from "../../context/DiagramFeatures.js";
|
|
20
22
|
const Divider = Divider$1.withProps({
|
|
21
23
|
mb: 8,
|
|
@@ -144,15 +146,15 @@ function ElementDetailsCard({
|
|
|
144
146
|
if (!((_a2 = ref.current) == null ? void 0 : _a2.open)) {
|
|
145
147
|
(_b2 = ref.current) == null ? void 0 : _b2.showModal();
|
|
146
148
|
}
|
|
147
|
-
},
|
|
149
|
+
}, 20);
|
|
148
150
|
useTimeoutEffect(() => {
|
|
149
151
|
setOpened(true);
|
|
150
|
-
},
|
|
152
|
+
}, 150);
|
|
151
153
|
return /* @__PURE__ */ jsx(
|
|
152
154
|
m.dialog,
|
|
153
155
|
{
|
|
154
156
|
ref,
|
|
155
|
-
className: dialog,
|
|
157
|
+
className: clsx(dialog, RemoveScroll.classNames.fullWidth),
|
|
156
158
|
layout: true,
|
|
157
159
|
layoutRoot: true,
|
|
158
160
|
initial: {
|
|
@@ -172,16 +174,18 @@ function ElementDetailsCard({
|
|
|
172
174
|
},
|
|
173
175
|
onClick: (e) => {
|
|
174
176
|
var _a2, _b2, _c2;
|
|
177
|
+
e.stopPropagation();
|
|
175
178
|
if (((_b2 = (_a2 = e.target) == null ? void 0 : _a2.nodeName) == null ? void 0 : _b2.toUpperCase()) === "DIALOG") {
|
|
176
|
-
e.stopPropagation();
|
|
177
179
|
(_c2 = ref.current) == null ? void 0 : _c2.close();
|
|
178
180
|
}
|
|
179
181
|
},
|
|
182
|
+
onDoubleClick: stopPropagation,
|
|
183
|
+
onPointerDown: stopPropagation,
|
|
180
184
|
onClose: (e) => {
|
|
181
185
|
e.stopPropagation();
|
|
182
186
|
close();
|
|
183
187
|
},
|
|
184
|
-
children: /* @__PURE__ */ jsxs(
|
|
188
|
+
children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: true, removeScrollBar: false, children: /* @__PURE__ */ jsxs(
|
|
185
189
|
Card,
|
|
186
190
|
{
|
|
187
191
|
drag: true,
|
|
@@ -401,7 +405,7 @@ function ElementDetailsCard({
|
|
|
401
405
|
)
|
|
402
406
|
]
|
|
403
407
|
}
|
|
404
|
-
)
|
|
408
|
+
) })
|
|
405
409
|
}
|
|
406
410
|
);
|
|
407
411
|
}
|