@likec4/diagram 1.28.0 → 1.28.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 +967 -1150
- package/dist/LikeC4CustomColors.js +2 -2
- package/dist/LikeC4Diagram.js +2 -2
- package/dist/LikeC4ModelProvider.js +1 -1
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +3 -0
- package/dist/_virtual/react.production.js +3 -0
- package/dist/base/BaseXYFlow.js +5 -5
- package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/customEdge.d.ts +1 -1
- package/dist/base/primitives/customEdge.js +2 -2
- package/dist/base/primitives/customNode.js +2 -2
- package/dist/base/primitives/edge/EdgeContainer.js +1 -1
- package/dist/base/primitives/edge/EdgeLabel.js +1 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
- package/dist/base/primitives/edge/EdgePath.js +23 -16
- package/dist/base/primitives/edge/edge.css.js +1 -1
- package/dist/base/primitives/element/ElementActionButtons.js +1 -2
- package/dist/base/primitives/element/ElementDetailsButton.js +1 -2
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
- package/dist/base/updateEdges.js +7 -2
- package/dist/base/updateNodes.js +11 -3
- package/dist/bundle/LikeC4View.js +3 -3
- package/dist/bundle/ReactLikeC4.js +1 -1
- package/dist/bundle/ShadowRoot.js +3 -3
- package/dist/bundle/styles.css.js +3 -3
- package/dist/context/ControlsCustomLayout.js +1 -1
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.js +7 -7
- package/dist/context/EnsureMantine.js +2 -2
- package/dist/context/FramerMotionConfig.js +2 -2
- package/dist/context/IconRenderer.js +4 -4
- package/dist/context/ReduceGraphics.js +2 -2
- package/dist/context/RootContainer.js +5 -9
- package/dist/hooks/safeContext.js +3 -3
- package/dist/hooks/useCurrentViewId.js +1 -1
- package/dist/hooks/useDiagram.d.ts +4 -4
- package/dist/hooks/useDiagram.js +2 -2
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +1 -1
- package/dist/hooks/useXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramUI.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +2 -2
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +7 -7
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
- package/dist/likec4diagram/custom/index.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +6 -6
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -4
- package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
- package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
- package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
- package/dist/likec4diagram/ui/search/state.js +11 -9
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
- package/dist/likec4diagram/useLayoutConstraints.js +3 -3
- package/dist/likec4model/LikeC4ModelContext.js +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
- package/dist/likec4model/useLikeC4Model.js +2 -2
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
- package/dist/overlays/Overlays.js +6 -6
- package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
- package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +6 -3
- package/dist/overlays/element-details/actor.d.ts +2 -2
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.js +8 -7
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
- package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
- package/dist/overlays/relationship-details/SelectEdge.js +3 -6
- package/dist/overlays/relationship-details/actor.d.ts +4 -1
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
- package/dist/overlays/relationship-details/hooks.d.ts +4 -1
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
- package/dist/overlays/relationships-browser/SelectElement.js +8 -5
- package/dist/overlays/relationships-browser/actor.d.ts +2 -1
- package/dist/overlays/relationships-browser/actor.js +6 -12
- package/dist/overlays/relationships-browser/const.d.ts +2 -1
- package/dist/overlays/relationships-browser/const.js +6 -1
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationships-browser/hooks.d.ts +2 -1
- package/dist/overlays/relationships-browser/hooks.js +4 -4
- package/dist/overlays/relationships-browser/layout.js +2 -2
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
- package/dist/state/DiagramActorProvider.js +5 -3
- package/dist/state/diagram-machine.d.ts +4 -4
- package/dist/state/diagram-machine.js +3 -4
- package/dist/styles.css.js +1 -1
- package/package.json +17 -13
- package/src/base/BaseXYFlow.tsx +2 -2
- package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgePath.tsx +22 -14
- package/src/base/primitives/edge/edge.css.ts +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
- package/src/base/primitives/element/ElementDetailsButton.tsx +2 -2
- package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
- package/src/base/updateEdges.ts +6 -9
- package/src/base/updateNodes.ts +10 -14
- package/src/context/FramerMotionConfig.tsx +1 -1
- package/src/context/RootContainer.tsx +0 -4
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +2 -2
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
- package/src/likec4diagram/ui/controls/Controls.tsx +53 -55
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -1
- package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
- package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
- package/src/likec4diagram/ui/search/state.ts +8 -6
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/overlays/Overlays.tsx +2 -2
- package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
- package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
- package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
- package/src/overlays/overlay/Overlay.tsx +2 -1
- package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
- package/src/overlays/relationship-details/actor.ts +2 -1
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
- package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
- package/src/overlays/relationships-browser/actor.ts +8 -13
- package/src/overlays/relationships-browser/const.ts +8 -1
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
- package/src/state/DiagramActorProvider.tsx +4 -1
- package/src/state/diagram-machine.ts +2 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs, Fragment
|
|
2
|
-
import { ifilter,
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { ifilter, sortParentsFirst, isAncestor, nameFromFqn } from '@likec4/core';
|
|
3
3
|
import { cx } from '@likec4/styles/css';
|
|
4
4
|
import { useTree, Tree, ActionIcon, UnstyledButton, Box, Group, Highlight, Tooltip, Text } from '@mantine/core';
|
|
5
5
|
import { useCallbackRef } from '@mantine/hooks';
|
|
6
6
|
import { IconChevronRight } from '@tabler/icons-react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { isEmpty, pipe, reduce,
|
|
8
|
+
import * as m from 'motion/react-m';
|
|
9
|
+
import { r as reactExports } from '../../../_virtual/index.js';
|
|
10
|
+
import { isEmpty, pipe, reduce, only, partition, first } from 'remeda';
|
|
11
11
|
import { IconOrShapeRenderer } from '../../../context/IconRenderer.js';
|
|
12
12
|
import { sortByLabel } from '../../../likec4model/useLikeC4ElementsTree.js';
|
|
13
13
|
import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
|
|
@@ -21,11 +21,7 @@ const btn = buttonsva();
|
|
|
21
21
|
function ElementsColumn() {
|
|
22
22
|
const search = useNormalizedSearch();
|
|
23
23
|
const model = useLikeC4Model(true);
|
|
24
|
-
const {
|
|
25
|
-
all,
|
|
26
|
-
byid,
|
|
27
|
-
roots: data
|
|
28
|
-
} = useMemo(() => {
|
|
24
|
+
const data = reactExports.useMemo(() => {
|
|
29
25
|
const searchTerms = search.split(".");
|
|
30
26
|
let elements;
|
|
31
27
|
if (isEmpty(search) || search === "kind:") {
|
|
@@ -41,9 +37,9 @@ function ElementsColumn() {
|
|
|
41
37
|
return (element.title + " " + element.id + " " + (element.description ?? "")).toLocaleLowerCase().includes(search);
|
|
42
38
|
});
|
|
43
39
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const byid = {};
|
|
41
|
+
const { all, roots } = pipe(
|
|
42
|
+
[...elements],
|
|
47
43
|
sortParentsFirst,
|
|
48
44
|
reduce((acc, element) => {
|
|
49
45
|
const treeItem = {
|
|
@@ -53,6 +49,7 @@ function ElementsColumn() {
|
|
|
53
49
|
searchTerms,
|
|
54
50
|
children: []
|
|
55
51
|
};
|
|
52
|
+
byid[treeItem.value] = treeItem;
|
|
56
53
|
const parent = acc.all.findLast((root) => isAncestor(root.value, treeItem.value));
|
|
57
54
|
if (parent) {
|
|
58
55
|
parent.children.push(treeItem);
|
|
@@ -70,15 +67,32 @@ function ElementsColumn() {
|
|
|
70
67
|
})
|
|
71
68
|
);
|
|
72
69
|
return {
|
|
73
|
-
all
|
|
74
|
-
byid
|
|
70
|
+
all,
|
|
71
|
+
byid,
|
|
75
72
|
roots: roots.sort(sortByLabel)
|
|
76
73
|
};
|
|
77
74
|
}, [model, search]);
|
|
75
|
+
const handleClick = useHandleElementSelection();
|
|
76
|
+
if (data.all.length === 0) {
|
|
77
|
+
return /* @__PURE__ */ jsx(NothingFound, {});
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ jsx(ElementsTree, { data, handleClick });
|
|
80
|
+
}
|
|
81
|
+
const setHoveredNode = () => {
|
|
82
|
+
};
|
|
83
|
+
function ElementsTree({
|
|
84
|
+
data: {
|
|
85
|
+
all,
|
|
86
|
+
byid,
|
|
87
|
+
roots
|
|
88
|
+
},
|
|
89
|
+
handleClick
|
|
90
|
+
}) {
|
|
78
91
|
const tree = useTree({
|
|
79
92
|
multiple: false
|
|
80
93
|
});
|
|
81
|
-
|
|
94
|
+
tree.setHoveredNode = setHoveredNode;
|
|
95
|
+
reactExports.useEffect(() => {
|
|
82
96
|
tree.collapseAllNodes();
|
|
83
97
|
for (const nd of all) {
|
|
84
98
|
if (nd.children.length > 0) {
|
|
@@ -86,65 +100,62 @@ function ElementsColumn() {
|
|
|
86
100
|
}
|
|
87
101
|
}
|
|
88
102
|
}, [all]);
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
selectOnClick: false,
|
|
99
|
-
tree,
|
|
100
|
-
data,
|
|
101
|
-
levelOffset: "lg",
|
|
102
|
-
classNames: {
|
|
103
|
-
root: treeRoot,
|
|
104
|
-
node: cx(focusable, treeNode),
|
|
105
|
-
label: treeLabel,
|
|
106
|
-
subtree: treeSubtree
|
|
107
|
-
},
|
|
108
|
-
onKeyDownCapture: (e) => {
|
|
109
|
-
const target = e.target;
|
|
110
|
-
const id = target.getAttribute("data-value");
|
|
111
|
-
const node = !!id && byid[id];
|
|
112
|
-
if (!node) return;
|
|
113
|
-
if (e.key === "ArrowUp") {
|
|
114
|
-
if (id === data[0]?.value) {
|
|
115
|
-
stopAndPrevent(e);
|
|
116
|
-
moveFocusToSearchInput();
|
|
117
|
-
}
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (e.key === "ArrowRight") {
|
|
121
|
-
const hasChildren = node.children.length > 0;
|
|
122
|
-
if (hasChildren && tree.expandedState[id] === false) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const label = e.target.querySelector(".mantine-Tree-label") ?? target;
|
|
126
|
-
const maxY = label.getBoundingClientRect().y;
|
|
127
|
-
const viewButtons = [...document.querySelectorAll(
|
|
128
|
-
`[data-likec4-search-views] .${focusable}`
|
|
129
|
-
)];
|
|
130
|
-
let view = viewButtons.length > 1 ? viewButtons.find((el, i, all2) => centerY(el) > maxY || i === all2.length - 1) : null;
|
|
131
|
-
view ??= first(viewButtons);
|
|
132
|
-
if (view) {
|
|
133
|
-
stopAndPrevent(e);
|
|
134
|
-
view.focus();
|
|
135
|
-
}
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (e.key === " " || e.key === "Enter") {
|
|
139
|
-
stopAndPrevent(e);
|
|
140
|
-
handleClick(node.element);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
renderNode: ElementTreeNode
|
|
103
|
+
const onKeyDownCapture = useCallbackRef((e) => {
|
|
104
|
+
const target = e.target;
|
|
105
|
+
const id = target.getAttribute("data-value");
|
|
106
|
+
const node = !!id && byid[id];
|
|
107
|
+
if (!node) return;
|
|
108
|
+
if (e.key === "ArrowUp") {
|
|
109
|
+
if (id === roots[0]?.value) {
|
|
110
|
+
stopAndPrevent(e);
|
|
111
|
+
moveFocusToSearchInput();
|
|
145
112
|
}
|
|
146
|
-
|
|
147
|
-
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (e.key === "ArrowRight") {
|
|
116
|
+
const hasChildren = node.children.length > 0;
|
|
117
|
+
if (hasChildren && tree.expandedState[id] === false) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const label = e.target.querySelector(".mantine-Tree-label") ?? target;
|
|
121
|
+
const maxY = label.getBoundingClientRect().y;
|
|
122
|
+
const viewButtons = [...document.querySelectorAll(
|
|
123
|
+
`[data-likec4-search-views] .${focusable}`
|
|
124
|
+
)];
|
|
125
|
+
let view = viewButtons.length > 1 ? viewButtons.find((el, i, all2) => centerY(el) > maxY || i === all2.length - 1) : null;
|
|
126
|
+
view ??= first(viewButtons);
|
|
127
|
+
if (view) {
|
|
128
|
+
stopAndPrevent(e);
|
|
129
|
+
view.focus();
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (e.key === " " || e.key === "Enter") {
|
|
134
|
+
stopAndPrevent(e);
|
|
135
|
+
handleClick(node.element);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return /* @__PURE__ */ jsx(
|
|
140
|
+
Tree,
|
|
141
|
+
{
|
|
142
|
+
"data-likec4-search-elements": true,
|
|
143
|
+
allowRangeSelection: false,
|
|
144
|
+
clearSelectionOnOutsideClick: true,
|
|
145
|
+
selectOnClick: false,
|
|
146
|
+
tree,
|
|
147
|
+
data: roots,
|
|
148
|
+
levelOffset: "lg",
|
|
149
|
+
classNames: {
|
|
150
|
+
root: treeRoot,
|
|
151
|
+
node: cx(focusable, treeNode),
|
|
152
|
+
label: treeLabel,
|
|
153
|
+
subtree: treeSubtree
|
|
154
|
+
},
|
|
155
|
+
onKeyDownCapture,
|
|
156
|
+
renderNode: ElementTreeNode
|
|
157
|
+
}
|
|
158
|
+
);
|
|
148
159
|
}
|
|
149
160
|
function ElementTreeNode({ node, elementProps, hasChildren, expanded }) {
|
|
150
161
|
const { element, searchTerms } = node;
|
|
@@ -224,11 +235,11 @@ function ElementTreeNode({ node, elementProps, hasChildren, expanded }) {
|
|
|
224
235
|
]
|
|
225
236
|
}
|
|
226
237
|
)
|
|
227
|
-
] }
|
|
238
|
+
] });
|
|
228
239
|
}
|
|
229
240
|
function useHandleElementSelection() {
|
|
230
241
|
const navigateTo = useCloseSearchAndNavigateTo();
|
|
231
|
-
return
|
|
242
|
+
return reactExports.useCallback((element) => {
|
|
232
243
|
const views = [...element.views()];
|
|
233
244
|
if (views.length === 0) {
|
|
234
245
|
return;
|
|
@@ -244,7 +255,7 @@ function useHandleElementSelection() {
|
|
|
244
255
|
scoped,
|
|
245
256
|
others
|
|
246
257
|
});
|
|
247
|
-
});
|
|
258
|
+
}, [setPickView, navigateTo]);
|
|
248
259
|
}
|
|
249
260
|
|
|
250
261
|
export { ElementsColumn };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { MemoExoticComponent } from 'react';
|
|
2
|
+
export declare const LikeC4Search: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { css } from '@likec4/styles/css';
|
|
3
|
+
import { Box } from '@likec4/styles/jsx';
|
|
4
|
+
import { Portal, Group, ActionIcon, Grid, GridCol, Title, ScrollArea, ScrollAreaAutosize, Stack } from '@mantine/core';
|
|
5
|
+
import { useDisclosure, useHotkeys, useCallbackRef, useWindowEvent, useFocusTrap, useFocusReturn } from '@mantine/hooks';
|
|
4
6
|
import { IconX } from '@tabler/icons-react';
|
|
5
|
-
import { AnimatePresence, m, LayoutGroup } from '
|
|
6
|
-
import {
|
|
7
|
+
import { AnimatePresence, m, LayoutGroup } from 'motion/react';
|
|
8
|
+
import { r as reactExports } from '../../../_virtual/index.js';
|
|
7
9
|
import { SearchControl } from '../../../components/SearchControl.js';
|
|
8
10
|
import { ElementsColumn } from './ElementsColumn.js';
|
|
9
11
|
import { backdrop, root, scrollArea, pickviewBackdrop, pickview, pickviewGroup } from './LikeC4Search.css.js';
|
|
10
12
|
import { LikeC4SearchInput } from './SearchInput.js';
|
|
11
|
-
import { LikeC4SearchContext, useCloseSearch, wasResetPickView, usePickView, setPickView } from './state.js';
|
|
13
|
+
import { LikeC4SearchContext, useCloseSearch, useIsPickViewActive, wasResetPickView, usePickView, setPickView } from './state.js';
|
|
12
14
|
import { stopAndPrevent } from './utils.js';
|
|
13
15
|
import { ViewsColumn, ViewButton } from './ViewsColum.js';
|
|
14
16
|
import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps.js';
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
const LikeC4Search = reactExports.memo(() => {
|
|
17
19
|
const [searchOpened, searchOps] = useDisclosure(false);
|
|
18
20
|
useHotkeys([
|
|
19
21
|
["mod+k", () => searchOps.toggle(), {
|
|
@@ -23,7 +25,7 @@ function LikeC4Search() {
|
|
|
23
25
|
preventDefault: true
|
|
24
26
|
}]
|
|
25
27
|
]);
|
|
26
|
-
const afterCloseCbRef = useRef(null);
|
|
28
|
+
const afterCloseCbRef = reactExports.useRef(null);
|
|
27
29
|
const close = useCallbackRef((cb) => {
|
|
28
30
|
afterCloseCbRef.current = cb ?? null;
|
|
29
31
|
searchOps.close();
|
|
@@ -45,8 +47,8 @@ function LikeC4Search() {
|
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
),
|
|
48
|
-
/* @__PURE__ */ jsx(Portal, { ...portalProps,
|
|
49
|
-
/* @__PURE__ */ jsx(
|
|
50
|
+
/* @__PURE__ */ jsx(Portal, { ...portalProps, reuseTargetNode: true, children: /* @__PURE__ */ jsxs(AnimatePresence, { onExitComplete, children: [
|
|
51
|
+
searchOpened && /* @__PURE__ */ jsx(
|
|
50
52
|
m.div,
|
|
51
53
|
{
|
|
52
54
|
className: backdrop,
|
|
@@ -54,25 +56,26 @@ function LikeC4Search() {
|
|
|
54
56
|
animate: {
|
|
55
57
|
opacity: 1,
|
|
56
58
|
transition: {
|
|
57
|
-
duration: 0.
|
|
59
|
+
duration: 0.13
|
|
58
60
|
}
|
|
59
61
|
},
|
|
60
62
|
exit: {
|
|
61
63
|
opacity: 0,
|
|
62
64
|
transition: {
|
|
63
|
-
duration: 0.
|
|
65
|
+
duration: 0.13
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
},
|
|
67
69
|
"backdrop"
|
|
68
70
|
),
|
|
69
|
-
/* @__PURE__ */ jsx(LikeC4SearchOverlay, {}, "overlay")
|
|
70
|
-
] }) })
|
|
71
|
+
searchOpened && /* @__PURE__ */ jsx(LikeC4SearchOverlay, {}, "overlay")
|
|
72
|
+
] }) })
|
|
71
73
|
] });
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
+
});
|
|
75
|
+
LikeC4Search.displayName = "LikeC4Search";
|
|
76
|
+
const LikeC4SearchOverlay = () => {
|
|
74
77
|
const close = useCloseSearch();
|
|
75
|
-
const
|
|
78
|
+
const pickViewActive = useIsPickViewActive();
|
|
76
79
|
useWindowEvent(
|
|
77
80
|
"keydown",
|
|
78
81
|
(event) => {
|
|
@@ -88,9 +91,9 @@ function LikeC4SearchOverlay() {
|
|
|
88
91
|
return /* @__PURE__ */ jsxs(
|
|
89
92
|
m.div,
|
|
90
93
|
{
|
|
91
|
-
ref,
|
|
92
94
|
className: root,
|
|
93
|
-
"data-likec4-search": true,
|
|
95
|
+
"data-likec4-search": "true",
|
|
96
|
+
initial: false,
|
|
94
97
|
animate: {
|
|
95
98
|
opacity: 1,
|
|
96
99
|
scale: 1,
|
|
@@ -99,8 +102,9 @@ function LikeC4SearchOverlay() {
|
|
|
99
102
|
exit: {
|
|
100
103
|
opacity: 0,
|
|
101
104
|
scale: 0.9,
|
|
105
|
+
translateY: -30,
|
|
102
106
|
transition: {
|
|
103
|
-
duration: 0.
|
|
107
|
+
duration: 0.13
|
|
104
108
|
}
|
|
105
109
|
},
|
|
106
110
|
children: [
|
|
@@ -126,12 +130,12 @@ function LikeC4SearchOverlay() {
|
|
|
126
130
|
/* @__PURE__ */ jsxs(
|
|
127
131
|
Grid,
|
|
128
132
|
{
|
|
129
|
-
|
|
133
|
+
className: css({
|
|
130
134
|
containerName: "likec4-search-elements",
|
|
131
135
|
containerType: "size",
|
|
132
136
|
overflow: "hidden",
|
|
133
137
|
flexGrow: 1
|
|
134
|
-
},
|
|
138
|
+
}),
|
|
135
139
|
children: [
|
|
136
140
|
/* @__PURE__ */ jsx(GridCol, { span: 6, children: /* @__PURE__ */ jsx(
|
|
137
141
|
ScrollArea,
|
|
@@ -156,12 +160,11 @@ function LikeC4SearchOverlay() {
|
|
|
156
160
|
]
|
|
157
161
|
}
|
|
158
162
|
),
|
|
159
|
-
/* @__PURE__ */ jsx(
|
|
160
|
-
/* @__PURE__ */ jsx(PickView, {})
|
|
163
|
+
pickViewActive && /* @__PURE__ */ jsx(PickView, {})
|
|
161
164
|
]
|
|
162
165
|
}
|
|
163
166
|
);
|
|
164
|
-
}
|
|
167
|
+
};
|
|
165
168
|
function PickView() {
|
|
166
169
|
const pickview$1 = usePickView();
|
|
167
170
|
const focusTrapRef = useFocusTrap(!!pickview$1);
|
|
@@ -4,7 +4,7 @@ import { useCombobox, ComboboxOption, Text, Combobox, ComboboxTarget, Input, rem
|
|
|
4
4
|
import { useFocusWithin, useIsFirstRender, useDebouncedValue, useWindowEvent } from '@mantine/hooks';
|
|
5
5
|
import { usePreviousDistinct } from '@react-hookz/web';
|
|
6
6
|
import { IconSearch } from '@tabler/icons-react';
|
|
7
|
-
import '
|
|
7
|
+
import '../../../_virtual/index.js';
|
|
8
8
|
import { isString, keys, only } from 'remeda';
|
|
9
9
|
import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
|
|
10
10
|
import { input } from './LikeC4Search.css.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { isDeploymentView } from '@likec4/core';
|
|
3
3
|
import { cx } from '@likec4/styles/css';
|
|
4
|
-
import {
|
|
4
|
+
import { Box } from '@likec4/styles/jsx';
|
|
5
|
+
import { Stack, VisuallyHidden, UnstyledButton, createScopedKeydownHandler, ThemeIcon, Group, Highlight, Badge } from '@mantine/core';
|
|
5
6
|
import { IconStack2, IconZoomScan } from '@tabler/icons-react';
|
|
6
|
-
import
|
|
7
|
+
import * as m from 'motion/react-m';
|
|
7
8
|
import { first } from 'remeda';
|
|
8
9
|
import { useCurrentViewId } from '../../../hooks/useCurrentViewId.js';
|
|
9
10
|
import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DiagramNode } from '@likec4/core';
|
|
2
2
|
import { createSafeContext } from '@mantine/core';
|
|
3
|
-
import
|
|
3
|
+
import '@mantine/hooks';
|
|
4
4
|
import { useStore } from '@nanostores/react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { computed, atom, onMount } from 'nanostores';
|
|
6
|
+
import { r as reactExports } from '../../../_virtual/index.js';
|
|
7
7
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
8
8
|
|
|
9
9
|
const $search = atom("");
|
|
@@ -18,7 +18,7 @@ const $normalizedSearch = computed($search, (search) => {
|
|
|
18
18
|
return v.length > 1 ? v : "";
|
|
19
19
|
});
|
|
20
20
|
function useNormalizedSearch() {
|
|
21
|
-
return useDeferredValue(useStore($normalizedSearch));
|
|
21
|
+
return reactExports.useDeferredValue(useStore($normalizedSearch));
|
|
22
22
|
}
|
|
23
23
|
const [LikeC4SearchContext, useCloseSearch] = createSafeContext("LikeC4Search");
|
|
24
24
|
const $pickView = atom(null);
|
|
@@ -45,18 +45,20 @@ function useIsPickViewActive() {
|
|
|
45
45
|
function useCloseSearchAndNavigateTo() {
|
|
46
46
|
const diagram = useDiagram();
|
|
47
47
|
const close = useCloseSearch();
|
|
48
|
-
return
|
|
48
|
+
return reactExports.useCallback((viewId, fromElementFqn) => {
|
|
49
49
|
close(() => {
|
|
50
50
|
fromElementFqn ??= $pickView.get()?.elementFqn;
|
|
51
51
|
setPickView(null);
|
|
52
52
|
const fromNode = fromElementFqn ? diagram.getContext().view.nodes.find((n) => DiagramNode.modelRef(n) === fromElementFqn)?.id : void 0;
|
|
53
|
-
if (diagram.currentView.id
|
|
54
|
-
diagram.
|
|
53
|
+
if (diagram.currentView.id !== viewId) {
|
|
54
|
+
diagram.navigateTo(viewId, fromNode);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
if (fromNode) {
|
|
58
|
+
diagram.focusNode(fromNode);
|
|
59
|
+
}
|
|
58
60
|
});
|
|
59
|
-
});
|
|
61
|
+
}, [close, diagram]);
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
export { LikeC4SearchContext, setPickView, setSearch, useCloseSearch, useCloseSearchAndNavigateTo, useIsPickViewActive, useNormalizedSearch, usePickView, useSearch, wasResetPickView };
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Box, Button, Badge, ButtonGroup } from '@mantine/core';
|
|
3
3
|
import { IconPlayerPlayFilled, IconPlayerSkipBackFilled, IconPlayerStopFilled, IconPlayerSkipForwardFilled } from '@tabler/icons-react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { AnimatePresence, m } from '
|
|
5
|
+
import { AnimatePresence, m } from 'motion/react';
|
|
6
6
|
import { isTruthy, isNonNull } from 'remeda';
|
|
7
7
|
import { useDiagramContext, useDiagram } from '../../../hooks/useDiagram.js';
|
|
8
8
|
import { parallelStateFrame, btn, buttons, container } from './DynamicViewWalkthrough.css.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { nonNullable } from '@likec4/core';
|
|
2
2
|
import '@xyflow/react';
|
|
3
3
|
import { getNodeDimensions } from '@xyflow/system';
|
|
4
|
-
import {
|
|
4
|
+
import { r as reactExports } from '../_virtual/index.js';
|
|
5
5
|
import { pipe, filter, hasAtLeast, map } from 'remeda';
|
|
6
6
|
import { useDiagram } from '../hooks/useDiagram.js';
|
|
7
7
|
import { useXYStoreApi } from '../hooks/useXYFlow.js';
|
|
@@ -186,8 +186,8 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
186
186
|
function useLayoutConstraints() {
|
|
187
187
|
const xystore = useXYStoreApi();
|
|
188
188
|
const diagram = useDiagram();
|
|
189
|
-
const solverRef = useRef(void 0);
|
|
190
|
-
return useMemo(() => {
|
|
189
|
+
const solverRef = reactExports.useRef(void 0);
|
|
190
|
+
return reactExports.useMemo(() => {
|
|
191
191
|
let wasPending = false;
|
|
192
192
|
const initial = { x: 0, y: 0 };
|
|
193
193
|
let moved = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compareNatural } from '@likec4/core';
|
|
2
|
-
import {
|
|
2
|
+
import { r as reactExports } from '../_virtual/index.js';
|
|
3
3
|
import { useLikeC4Model } from './useLikeC4Model.js';
|
|
4
4
|
|
|
5
5
|
const sortByLabel = (a, b) => compareNatural(a.label, b.label);
|
|
@@ -12,7 +12,7 @@ function buildNode(element) {
|
|
|
12
12
|
}
|
|
13
13
|
function useLikeC4ElementsTree(viewId) {
|
|
14
14
|
const model = useLikeC4Model(true);
|
|
15
|
-
return useMemo(() => {
|
|
15
|
+
return reactExports.useMemo(() => {
|
|
16
16
|
if (viewId) {
|
|
17
17
|
const view = model.view(viewId);
|
|
18
18
|
return [...view.roots()].map(buildNode).sort(sortByLabel);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as reactExports } from '../_virtual/index.js';
|
|
2
2
|
import { isString, isNonNullish, isDefined } from 'remeda';
|
|
3
3
|
import { LikeC4ModelContext } from './LikeC4ModelContext.js';
|
|
4
4
|
|
|
5
5
|
function useLikeC4Model(strict, type) {
|
|
6
|
-
const model = useContext(LikeC4ModelContext);
|
|
6
|
+
const model = reactExports.useContext(LikeC4ModelContext);
|
|
7
7
|
if (isString(type) && isNonNullish(model) && model.type !== type) {
|
|
8
8
|
throw new Error(`Invalid LikeC4ModelContext, expected "${type}" but got "${model.type}" in context`);
|
|
9
9
|
}
|