@likec4/diagram 1.27.0 → 1.27.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/index.js +327 -281
- package/dist/LikeC4Diagram.js +2 -8
- package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +1 -4
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
- package/dist/base/primitives/edge/EdgePath.js +0 -3
- package/dist/base/primitives/edge/edge.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.css.js +1 -0
- package/dist/base/primitives/element/ElementShape.css.js +1 -12
- package/dist/base/primitives/element/ElementTitle.css.js +3 -2
- package/dist/base/types.js +2 -2
- package/dist/components/Link.js +1 -1
- package/dist/hooks/useDiagram.d.ts +320 -490
- package/dist/likec4diagram/DiagramXYFlow.js +10 -9
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +30 -41
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +6 -1
- package/dist/likec4diagram/ui/controls/LayoutDriftNotification.js +13 -5
- package/dist/likec4diagram/useLayoutConstraints.d.ts +11 -10
- package/dist/likec4diagram/useLayoutConstraints.js +64 -61
- package/dist/overlays/Overlays.js +2 -2
- package/dist/overlays/overlay/Overlay.css.js +31 -12
- package/dist/overlays/overlay/Overlay.js +30 -27
- package/dist/overlays/relationship-details/useLayoutedDetails.js +1 -1
- package/dist/overlays/relationships-browser/SelectElement.js +4 -4
- package/dist/state/DiagramActorProvider.d.ts +4 -2
- package/dist/state/DiagramActorProvider.js +30 -37
- package/dist/state/assign.js +2 -2
- package/dist/state/diagram-machine.d.ts +450 -608
- package/dist/state/diagram-machine.js +87 -57
- package/dist/styles.css.js +1 -1
- package/package.json +5 -5
- package/src/LikeC4Diagram.tsx +1 -7
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeLabel.css.ts +1 -4
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgePath.tsx +0 -3
- package/src/base/primitives/edge/edge.css.ts +2 -0
- package/src/base/primitives/element/ElementNodeContainer.css.ts +1 -0
- package/src/base/primitives/element/ElementShape.css.ts +1 -12
- package/src/base/primitives/element/ElementTitle.css.ts +3 -2
- package/src/base/types.ts +2 -7
- package/src/components/Link.tsx +3 -1
- package/src/likec4diagram/DiagramXYFlow.tsx +11 -9
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +39 -48
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +2 -2
- package/src/likec4diagram/custom/nodes/toolbar/styles.css.ts +5 -0
- package/src/likec4diagram/ui/controls/LayoutDriftNotification.tsx +8 -4
- package/src/likec4diagram/useLayoutConstraints.ts +84 -89
- package/src/overlays/Overlays.tsx +2 -2
- package/src/overlays/overlay/Overlay.css.ts +30 -12
- package/src/overlays/overlay/Overlay.tsx +35 -29
- package/src/overlays/relationship-details/useLayoutedDetails.ts +1 -1
- package/src/overlays/relationships-browser/SelectElement.tsx +5 -5
- package/src/state/DiagramActorProvider.tsx +40 -50
- package/src/state/assign.ts +2 -2
- package/src/state/diagram-machine.ts +100 -69
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs,
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { ancestorsFqn } from '@likec4/core';
|
|
3
3
|
import { useTree, Group, Box, Popover, PopoverTarget, Button, Text, PopoverDropdown, ScrollAreaAutosize, Tree, ActionIcon, Tooltip, SegmentedControl } from '@mantine/core';
|
|
4
4
|
import { IconSelector, IconChevronRight } from '@tabler/icons-react';
|
|
@@ -44,8 +44,8 @@ const SelectElement = memo(() => {
|
|
|
44
44
|
});
|
|
45
45
|
tree.select(subjectId);
|
|
46
46
|
}, [subjectId]);
|
|
47
|
-
return /* @__PURE__ */ jsxs(Group, { ref: root, gap: "xs",
|
|
48
|
-
enableSelectSubject && /* @__PURE__ */ jsxs(
|
|
47
|
+
return /* @__PURE__ */ jsxs(Group, { ref: root, gap: "xs", pos: "relative", children: [
|
|
48
|
+
enableSelectSubject && /* @__PURE__ */ jsxs(Group, { gap: 4, wrap: "nowrap", children: [
|
|
49
49
|
/* @__PURE__ */ jsx(
|
|
50
50
|
Box,
|
|
51
51
|
{
|
|
@@ -153,7 +153,7 @@ const SelectElement = memo(() => {
|
|
|
153
153
|
}
|
|
154
154
|
) })
|
|
155
155
|
] }),
|
|
156
|
-
enableChangeScope && /* @__PURE__ */ jsxs(
|
|
156
|
+
enableChangeScope && /* @__PURE__ */ jsxs(Group, { gap: 4, wrap: "nowrap", children: [
|
|
157
157
|
enableSelectSubject && /* @__PURE__ */ jsx(
|
|
158
158
|
Box,
|
|
159
159
|
{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { WhereOperator } from '@likec4/core';
|
|
1
2
|
import { PropsWithChildren } from 'react';
|
|
2
3
|
import { Input } from './diagram-machine';
|
|
3
|
-
type ActorContextInput = Omit<Input, 'xystore' | '
|
|
4
|
-
export declare function DiagramActorProvider({ input, children }: PropsWithChildren<{
|
|
4
|
+
type ActorContextInput = Omit<Input, 'xystore' | 'xynodes' | 'xyedges'>;
|
|
5
|
+
export declare function DiagramActorProvider({ input: { view, ...inputs }, where, children, }: PropsWithChildren<{
|
|
5
6
|
input: ActorContextInput;
|
|
7
|
+
where?: WhereOperator<string, string> | undefined;
|
|
6
8
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useDeepCompareEffect } from '@react-hookz/web';
|
|
2
3
|
import { useActorRef, useSelector } from '@xstate/react';
|
|
3
4
|
import { useStoreApi } from '@xyflow/react';
|
|
4
5
|
import { shallowEqual } from 'fast-equals';
|
|
5
|
-
import {
|
|
6
|
+
import { useEffect } from 'react';
|
|
6
7
|
import { useDiagramEventHandlersRef } from '../context/DiagramEventHandlers.js';
|
|
7
8
|
import { useEnabledFeatures, DiagramFeatures } from '../context/DiagramFeatures.js';
|
|
8
9
|
import { DiagramActorSafeContext } from '../hooks/safeContext.js';
|
|
9
10
|
import { useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
11
|
+
import { useViewToNodesEdges } from '../likec4diagram/useViewToNodesEdges.js';
|
|
10
12
|
import { diagramMachine } from './diagram-machine.js';
|
|
11
13
|
import { syncManualLayoutActorLogic } from './syncManualLayoutActor.js';
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
const selectToggledFeatures = (state) => state.context.toggledFeatures;
|
|
16
|
+
function DiagramActorProvider({
|
|
17
|
+
input: {
|
|
18
|
+
view,
|
|
19
|
+
...inputs
|
|
20
|
+
},
|
|
21
|
+
where,
|
|
22
|
+
children
|
|
23
|
+
}) {
|
|
14
24
|
const handlersRef = useDiagramEventHandlersRef();
|
|
15
25
|
const xystore = useStoreApi();
|
|
16
|
-
const
|
|
17
|
-
|
|
26
|
+
const actorRef = useActorRef(
|
|
27
|
+
diagramMachine.provide({
|
|
18
28
|
actions: {
|
|
19
29
|
"trigger:NavigateTo": (_, { viewId }) => {
|
|
20
30
|
handlersRef.current.onNavigateTo?.(viewId);
|
|
@@ -35,52 +45,35 @@ function DiagramActorProvider({ input, children }) {
|
|
|
35
45
|
}
|
|
36
46
|
})
|
|
37
47
|
}
|
|
38
|
-
})
|
|
39
|
-
}, [handlersRef]);
|
|
40
|
-
const actorRef = useActorRef(
|
|
41
|
-
logic,
|
|
48
|
+
}),
|
|
42
49
|
{
|
|
43
|
-
id: `diagram:${
|
|
50
|
+
id: `diagram:${view.id}`,
|
|
44
51
|
systemId: "diagram",
|
|
45
52
|
// ...inspector,
|
|
46
53
|
input: {
|
|
47
54
|
xystore,
|
|
48
|
-
|
|
55
|
+
view,
|
|
56
|
+
...inputs
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
);
|
|
52
|
-
return /* @__PURE__ */ jsxs(DiagramActorSafeContext, { value: actorRef, children: [
|
|
53
|
-
/* @__PURE__ */ jsx(SyncStore, { input, actorRef }),
|
|
54
|
-
/* @__PURE__ */ jsx(DiagramActorToggledFeatures, { actorRef, children })
|
|
55
|
-
] });
|
|
56
|
-
}
|
|
57
|
-
const SyncStore = ({ input: { view, xyedges, xynodes, ...inputs }, actorRef }) => {
|
|
58
60
|
const features = useEnabledFeatures();
|
|
59
61
|
useUpdateEffect(() => {
|
|
60
62
|
actorRef.send({ type: "update.inputs", inputs });
|
|
61
|
-
}, [
|
|
63
|
+
}, [inputs]);
|
|
62
64
|
useEffect(() => {
|
|
63
65
|
actorRef.send({ type: "update.features", features });
|
|
64
|
-
}, [
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
cancelAnimationFrame(frameReq.current);
|
|
74
|
-
}
|
|
75
|
-
frameReq.current = null;
|
|
76
|
-
};
|
|
77
|
-
}, [actorRef, view, xyedges, xynodes]);
|
|
78
|
-
return null;
|
|
79
|
-
};
|
|
80
|
-
const selectToggledFeatures = (state) => state.context.toggledFeatures;
|
|
81
|
-
function DiagramActorToggledFeatures({ children, actorRef }) {
|
|
66
|
+
}, [features]);
|
|
67
|
+
const { xyedges, xynodes } = useViewToNodesEdges({
|
|
68
|
+
view,
|
|
69
|
+
where,
|
|
70
|
+
nodesSelectable: inputs.nodesSelectable
|
|
71
|
+
});
|
|
72
|
+
useDeepCompareEffect(() => {
|
|
73
|
+
actorRef.send({ type: "update.view", view, xyedges, xynodes });
|
|
74
|
+
}, [view, xyedges, xynodes]);
|
|
82
75
|
const toggledFeatures = useSelector(actorRef, selectToggledFeatures, shallowEqual);
|
|
83
|
-
return /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children });
|
|
76
|
+
return /* @__PURE__ */ jsx(DiagramActorSafeContext, { value: actorRef, children: /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children }) });
|
|
84
77
|
}
|
|
85
78
|
|
|
86
79
|
export { DiagramActorProvider };
|
package/dist/state/assign.js
CHANGED
|
@@ -338,8 +338,8 @@ function updateActiveWalkthrough({ context }) {
|
|
|
338
338
|
});
|
|
339
339
|
}),
|
|
340
340
|
xynodes: context.xynodes.map((node) => {
|
|
341
|
-
const
|
|
342
|
-
return Base.setDimmed(node,
|
|
341
|
+
const dimmed = step.source !== node.id && step.target !== node.id;
|
|
342
|
+
return Base.setDimmed(node, dimmed);
|
|
343
343
|
})
|
|
344
344
|
};
|
|
345
345
|
}
|