likec4 1.18.0 → 1.19.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/LICENSE +1 -1
- package/__app__/index.html +0 -1
- package/__app__/react/likec4.tsx +11 -8
- package/__app__/src/chunks/-index-overview-C9eO_hFX.js +309 -0
- package/__app__/src/chunks/-view-lazy-data-CI4xD57c.js +9 -0
- package/__app__/src/chunks/index-KI-kE60c.js +465 -0
- package/__app__/src/chunks/likec4-CusAw_j6.js +6106 -0
- package/__app__/src/chunks/main-DY2KbFcO.js +24136 -0
- package/__app__/src/chunks/mantine-B_6mKFFA.js +13671 -0
- package/__app__/src/chunks/tanstack-router-BBWuTKWO.js +2373 -0
- package/__app__/src/icons.js +6 -6
- package/__app__/src/main.js +1 -1
- package/__app__/src/style.css +1 -1
- package/__app__/webcomponent/webcomponent.js +21699 -21851
- package/dist/chunks/prompt.mjs +35 -35
- package/dist/cli/index.mjs +91 -88
- package/dist/index.d.mts +410 -2388
- package/dist/index.d.ts +410 -2388
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +258 -0
- package/dist/model/index.d.ts +258 -0
- package/dist/model/index.mjs +1 -0
- package/dist/shared/likec4.CbSUX9bc.mjs +1853 -0
- package/dist/shared/likec4.DCwaTTuF.d.mts +1625 -0
- package/dist/shared/likec4.DCwaTTuF.d.ts +1625 -0
- package/dist/shared/likec4.LktBLTET.mjs +9 -0
- package/package.json +65 -62
- package/react/index.d.ts +150 -918
- package/react/index.js +39830 -0
- package/react/style.css +1 -1
- package/__app__/src/chunks/-index-overview-CBnvpD1d.js +0 -309
- package/__app__/src/chunks/-view-lazy-data-WZmbIsHq.js +0 -9
- package/__app__/src/chunks/index-CIsxIzOH.js +0 -465
- package/__app__/src/chunks/likec4-DslTxitT.js +0 -6109
- package/__app__/src/chunks/main-ByUdz_Be.js +0 -24285
- package/__app__/src/chunks/mantine-oFa3ZrEq.js +0 -13658
- package/__app__/src/chunks/tanstack-router-BWjXKr0n.js +0 -2373
- package/dist/shared/likec4.lgHXhASw.mjs +0 -1832
- package/react/index.mjs +0 -41515
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useOverviewGraph } from "virtual:likec4/overview-graph";
|
|
3
|
-
import { c as createReactComponent, I as IconFolderFilled, n, u as useUpdateEffect, i, a as nonexhaustive } from "./main-ByUdz_Be.js";
|
|
4
|
-
import { u as useRouter } from "./tanstack-router-BWjXKr0n.js";
|
|
5
|
-
import { B as BaseEdge, H as Handle, P as Position, u as useNodesState, a as useEdgesState, i as index, b as Background, c as BackgroundVariant } from "./likec4-DslTxitT.js";
|
|
6
|
-
import { memo, useRef, useMemo } from "react";
|
|
7
|
-
import { P as Paper, c as clsx, G as Group, T as ThemeIcon, a as Text, C as Card, b as CardSection, d as Center, I as Image, B as Box, u as useMantineColorScheme } from "./mantine-oFa3ZrEq.js";
|
|
8
|
-
import { usePreviewUrl } from "virtual:likec4/previews";
|
|
9
|
-
/**
|
|
10
|
-
* @license @tabler/icons-react v3.17.0 - MIT
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the MIT license.
|
|
13
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/
|
|
15
|
-
var IconLoader = createReactComponent("outline", "loader", "IconLoader", [["path", { d: "M12 6l0 -3", key: "svg-0" }], ["path", { d: "M16.25 7.75l2.15 -2.15", key: "svg-1" }], ["path", { d: "M18 12l3 0", key: "svg-2" }], ["path", { d: "M16.25 16.25l2.15 2.15", key: "svg-3" }], ["path", { d: "M12 18l0 3", key: "svg-4" }], ["path", { d: "M7.75 16.25l-2.15 2.15", key: "svg-5" }], ["path", { d: "M6 12l-3 0", key: "svg-6" }], ["path", { d: "M7.75 7.75l-2.15 -2.15", key: "svg-7" }]]);
|
|
16
|
-
/**
|
|
17
|
-
* @license @tabler/icons-react v3.17.0 - MIT
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the MIT license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/
|
|
22
|
-
var IconFileFilled = createReactComponent("filled", "file-filled", "IconFileFilled", [["path", { d: "M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z", key: "svg-0" }], ["path", { d: "M19 7h-4l-.001 -4.001z", key: "svg-1" }]]), root = "mxt2a80";
|
|
23
|
-
function edgePath(points) {
|
|
24
|
-
return points.reduce((acc, [x, y], i2) => acc + `${i2 === 0 ? "M" : " L"} ${x},${y}`, "");
|
|
25
|
-
}
|
|
26
|
-
function LinkEdge({
|
|
27
|
-
id,
|
|
28
|
-
data,
|
|
29
|
-
...props
|
|
30
|
-
}) {
|
|
31
|
-
if (!data)
|
|
32
|
-
return null;
|
|
33
|
-
const path = edgePath(data.points);
|
|
34
|
-
return /* @__PURE__ */ jsx(
|
|
35
|
-
BaseEdge,
|
|
36
|
-
{
|
|
37
|
-
id,
|
|
38
|
-
path,
|
|
39
|
-
...props
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
var handleCenter = "_1n8mzjc0", toplevelNode = "_1n8mzjc1", nestedNode = "_1n8mzjc2", dimmed = "_1n8mzjc3", folderNode = "_1n8mzjc4", fileNode = "_1n8mzjc5", viewNode = "_1n8mzjc6", viewNodeImageSection = "_1n8mzjc7", viewTitle = "_1n8mzjc8";
|
|
44
|
-
const FolderNode = /* @__PURE__ */ memo(function({
|
|
45
|
-
data,
|
|
46
|
-
parentId,
|
|
47
|
-
id
|
|
48
|
-
}) {
|
|
49
|
-
const isTopLevel = n(parentId);
|
|
50
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
|
-
/* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, className: handleCenter }),
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
53
|
-
Paper,
|
|
54
|
-
{
|
|
55
|
-
p: "sm",
|
|
56
|
-
pt: "xs",
|
|
57
|
-
radius: "md",
|
|
58
|
-
withBorder: !0,
|
|
59
|
-
shadow: isTopLevel ? "lg" : "xs",
|
|
60
|
-
className: clsx(
|
|
61
|
-
folderNode,
|
|
62
|
-
isTopLevel ? toplevelNode : nestedNode,
|
|
63
|
-
data.dimmed && dimmed
|
|
64
|
-
),
|
|
65
|
-
children: /* @__PURE__ */ jsxs(Group, { gap: 8, children: [
|
|
66
|
-
/* @__PURE__ */ jsx(ThemeIcon, { size: 24, variant: "transparent", color: "dark.4", children: /* @__PURE__ */ jsx(IconFolderFilled, { size: "100%" }) }),
|
|
67
|
-
/* @__PURE__ */ jsx(Text, { size: "lg", fw: 500, children: data.label })
|
|
68
|
-
] })
|
|
69
|
-
}
|
|
70
|
-
),
|
|
71
|
-
/* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, className: handleCenter })
|
|
72
|
-
] });
|
|
73
|
-
}), FileNode = /* @__PURE__ */ memo(function({
|
|
74
|
-
data,
|
|
75
|
-
parentId,
|
|
76
|
-
id
|
|
77
|
-
}) {
|
|
78
|
-
const isTopLevel = n(parentId);
|
|
79
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80
|
-
/* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, className: handleCenter }),
|
|
81
|
-
/* @__PURE__ */ jsx(
|
|
82
|
-
Paper,
|
|
83
|
-
{
|
|
84
|
-
p: "sm",
|
|
85
|
-
pt: "xs",
|
|
86
|
-
radius: "md",
|
|
87
|
-
withBorder: !0,
|
|
88
|
-
shadow: isTopLevel ? "lg" : "xs",
|
|
89
|
-
className: clsx(
|
|
90
|
-
fileNode,
|
|
91
|
-
isTopLevel ? toplevelNode : nestedNode,
|
|
92
|
-
data.dimmed && dimmed
|
|
93
|
-
),
|
|
94
|
-
children: /* @__PURE__ */ jsxs(Group, { gap: 8, children: [
|
|
95
|
-
/* @__PURE__ */ jsx(ThemeIcon, { size: 24, variant: "transparent", color: "dark.3", children: /* @__PURE__ */ jsx(IconFileFilled, { size: "100%" }) }),
|
|
96
|
-
/* @__PURE__ */ jsx(Text, { size: "lg", fw: 500, children: data.label })
|
|
97
|
-
] })
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
/* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, className: handleCenter })
|
|
101
|
-
] });
|
|
102
|
-
}), ViewNode = /* @__PURE__ */ memo(function({
|
|
103
|
-
data,
|
|
104
|
-
height = 320
|
|
105
|
-
}) {
|
|
106
|
-
const imageUrl = usePreviewUrl(data.viewId);
|
|
107
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
-
/* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, className: handleCenter }),
|
|
109
|
-
/* @__PURE__ */ jsxs(
|
|
110
|
-
Card,
|
|
111
|
-
{
|
|
112
|
-
className: clsx(
|
|
113
|
-
viewNode,
|
|
114
|
-
data.dimmed && dimmed
|
|
115
|
-
),
|
|
116
|
-
withBorder: !0,
|
|
117
|
-
shadow: "xs",
|
|
118
|
-
padding: 0,
|
|
119
|
-
children: [
|
|
120
|
-
/* @__PURE__ */ jsx(CardSection, { className: viewNodeImageSection, children: imageUrl ? /* @__PURE__ */ jsx(
|
|
121
|
-
Image,
|
|
122
|
-
{
|
|
123
|
-
src: imageUrl,
|
|
124
|
-
fit: "contain",
|
|
125
|
-
h: height - 60
|
|
126
|
-
}
|
|
127
|
-
) : /* @__PURE__ */ jsx(Center, { h: height - 60, children: /* @__PURE__ */ jsxs(Group, { children: [
|
|
128
|
-
/* @__PURE__ */ jsx(ThemeIcon, { size: 60, variant: "transparent", color: "dark", children: /* @__PURE__ */ jsx(IconLoader, { stroke: 1.5, size: "100%" }) }),
|
|
129
|
-
/* @__PURE__ */ jsx(Text, { size: "xl", fw: 500, c: "dimmed", children: "Preview not available" })
|
|
130
|
-
] }) }) }),
|
|
131
|
-
/* @__PURE__ */ jsx(Box, { className: viewTitle, h: 60, p: "sm", pl: "md", children: /* @__PURE__ */ jsx(Text, { component: "div", size: "lg", fw: 500, children: data.label }) })
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
),
|
|
135
|
-
/* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, className: handleCenter })
|
|
136
|
-
] });
|
|
137
|
-
}), nodeTypes = {
|
|
138
|
-
folder: FolderNode,
|
|
139
|
-
file: FileNode,
|
|
140
|
-
view: ViewNode
|
|
141
|
-
}, edgeTypes = {
|
|
142
|
-
link: LinkEdge
|
|
143
|
-
}, overviewGraphToXYFlowData = (graph) => ({
|
|
144
|
-
nodes: graph.nodes.map(({ id, parentId, position, width, height, ...node }) => {
|
|
145
|
-
const parent = parentId ? graph.nodes.find((n2) => n2.id === parentId) : null, rect = {
|
|
146
|
-
...position,
|
|
147
|
-
width,
|
|
148
|
-
height
|
|
149
|
-
};
|
|
150
|
-
parent && (position = {
|
|
151
|
-
x: position.x - parent.position.x,
|
|
152
|
-
y: position.y - parent.position.y
|
|
153
|
-
});
|
|
154
|
-
const xyparent = parent ? { parentId: parent.id } : {};
|
|
155
|
-
switch (node.type) {
|
|
156
|
-
case "file":
|
|
157
|
-
case "folder":
|
|
158
|
-
return {
|
|
159
|
-
id,
|
|
160
|
-
type: node.type,
|
|
161
|
-
data: {
|
|
162
|
-
dimmed: !1,
|
|
163
|
-
label: node.label,
|
|
164
|
-
path: node.path,
|
|
165
|
-
rect
|
|
166
|
-
},
|
|
167
|
-
deletable: !1,
|
|
168
|
-
position,
|
|
169
|
-
width,
|
|
170
|
-
height,
|
|
171
|
-
zIndex: 1,
|
|
172
|
-
...xyparent
|
|
173
|
-
};
|
|
174
|
-
case "view":
|
|
175
|
-
return {
|
|
176
|
-
id,
|
|
177
|
-
type: "view",
|
|
178
|
-
data: {
|
|
179
|
-
dimmed: !1,
|
|
180
|
-
label: node.label,
|
|
181
|
-
viewId: node.viewId,
|
|
182
|
-
rect
|
|
183
|
-
},
|
|
184
|
-
selectable: !1,
|
|
185
|
-
deletable: !1,
|
|
186
|
-
position,
|
|
187
|
-
width,
|
|
188
|
-
height,
|
|
189
|
-
zIndex: 3,
|
|
190
|
-
...xyparent
|
|
191
|
-
};
|
|
192
|
-
default:
|
|
193
|
-
nonexhaustive(node);
|
|
194
|
-
}
|
|
195
|
-
}),
|
|
196
|
-
edges: graph.edges.map((edge) => ({
|
|
197
|
-
id: edge.id,
|
|
198
|
-
source: edge.source,
|
|
199
|
-
target: edge.target,
|
|
200
|
-
type: "link",
|
|
201
|
-
zIndex: 2,
|
|
202
|
-
hidden: !0,
|
|
203
|
-
data: {
|
|
204
|
-
points: edge.points
|
|
205
|
-
}
|
|
206
|
-
}))
|
|
207
|
-
});
|
|
208
|
-
function OverviewDiagrams({
|
|
209
|
-
graph,
|
|
210
|
-
fitViewPadding = 0.1,
|
|
211
|
-
zoomable = !0,
|
|
212
|
-
pannable = !0
|
|
213
|
-
}) {
|
|
214
|
-
const router = useRouter(), xyflowRef = useRef(), { colorScheme } = useMantineColorScheme(), xyflowdata = useMemo(() => overviewGraphToXYFlowData(graph), [graph]), [nodes, setNodes, onNodesChange] = useNodesState(xyflowdata.nodes), [edges, setEdges, onEdgeChanges] = useEdgesState(xyflowdata.edges);
|
|
215
|
-
useUpdateEffect(() => {
|
|
216
|
-
setNodes(
|
|
217
|
-
(nodes2) => xyflowdata.nodes.map((n2) => {
|
|
218
|
-
const current = nodes2.find((node) => node.id === n2.id);
|
|
219
|
-
return current ? { ...i(current, ["selected", "hidden"]), ...n2 } : n2;
|
|
220
|
-
})
|
|
221
|
-
), setEdges(xyflowdata.edges);
|
|
222
|
-
}, [xyflowdata.nodes, xyflowdata.edges]);
|
|
223
|
-
const focusedNode = nodes.find((node) => node.selected);
|
|
224
|
-
return useUpdateEffect(() => {
|
|
225
|
-
const xyflow = xyflowRef.current;
|
|
226
|
-
xyflow && (focusedNode ? xyflow.fitView({
|
|
227
|
-
maxZoom: 1,
|
|
228
|
-
padding: fitViewPadding,
|
|
229
|
-
nodes: [focusedNode],
|
|
230
|
-
duration: 450
|
|
231
|
-
}) : xyflow.fitView({
|
|
232
|
-
maxZoom: 1,
|
|
233
|
-
padding: fitViewPadding,
|
|
234
|
-
duration: 800
|
|
235
|
-
}));
|
|
236
|
-
}, [focusedNode?.id ?? null]), /* @__PURE__ */ jsx(
|
|
237
|
-
index,
|
|
238
|
-
{
|
|
239
|
-
colorMode: colorScheme === "auto" ? "system" : colorScheme,
|
|
240
|
-
className: root,
|
|
241
|
-
nodeTypes,
|
|
242
|
-
edgeTypes,
|
|
243
|
-
nodes,
|
|
244
|
-
onNodesChange,
|
|
245
|
-
edges,
|
|
246
|
-
onEdgesChange: onEdgeChanges,
|
|
247
|
-
fitView: !0,
|
|
248
|
-
fitViewOptions: useMemo(() => ({
|
|
249
|
-
minZoom: 0.05,
|
|
250
|
-
maxZoom: 1,
|
|
251
|
-
padding: fitViewPadding,
|
|
252
|
-
includeHiddenNodes: !0
|
|
253
|
-
}), [fitViewPadding]),
|
|
254
|
-
nodesDraggable: !1,
|
|
255
|
-
nodesConnectable: !1,
|
|
256
|
-
nodesFocusable: !0,
|
|
257
|
-
edgesReconnectable: !1,
|
|
258
|
-
edgesFocusable: !1,
|
|
259
|
-
multiSelectionKeyCode: null,
|
|
260
|
-
zoomOnPinch: zoomable,
|
|
261
|
-
zoomOnScroll: !pannable && zoomable,
|
|
262
|
-
zoomOnDoubleClick: !1,
|
|
263
|
-
...!zoomable && {
|
|
264
|
-
zoomActivationKeyCode: null
|
|
265
|
-
},
|
|
266
|
-
maxZoom: zoomable ? 2 : 1,
|
|
267
|
-
minZoom: zoomable ? 0.01 : 1,
|
|
268
|
-
preventScrolling: zoomable || pannable,
|
|
269
|
-
noDragClassName: "nodrag",
|
|
270
|
-
noPanClassName: "nopan",
|
|
271
|
-
panOnScroll: pannable,
|
|
272
|
-
panOnDrag: pannable,
|
|
273
|
-
...!pannable && {
|
|
274
|
-
selectionKeyCode: null
|
|
275
|
-
},
|
|
276
|
-
onInit: (instance) => xyflowRef.current = instance,
|
|
277
|
-
onNodeClick: (event, node) => {
|
|
278
|
-
if (node.type === "view") {
|
|
279
|
-
event.stopPropagation(), setNodes((nodes2) => nodes2.map(({ data, ...n2 }) => ({ ...n2, data: { ...data, dimmed: n2.id !== node.id } }))), xyflowRef.current?.fitView({
|
|
280
|
-
maxZoom: 10,
|
|
281
|
-
padding: 0,
|
|
282
|
-
nodes: [node],
|
|
283
|
-
duration: 1200
|
|
284
|
-
}), setTimeout(() => {
|
|
285
|
-
xyflowRef.current?.updateNodeData(node.id, { dimmed: !0 });
|
|
286
|
-
}, 400), setTimeout(() => {
|
|
287
|
-
router.navigate({
|
|
288
|
-
to: "/view/$viewId/",
|
|
289
|
-
params: {
|
|
290
|
-
viewId: node.data.viewId
|
|
291
|
-
},
|
|
292
|
-
search: !0
|
|
293
|
-
});
|
|
294
|
-
}, 800);
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
node.selected && (event.stopPropagation(), setNodes((nodes2) => nodes2.map((n2) => n2.id === node.id ? { ...n2, selected: !1 } : n2)));
|
|
298
|
-
},
|
|
299
|
-
children: /* @__PURE__ */ jsx(Background, { variant: BackgroundVariant.Dots, size: 4, gap: 50 })
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
function OverviewPage() {
|
|
304
|
-
const graph = useOverviewGraph();
|
|
305
|
-
return /* @__PURE__ */ jsx(Box, { pos: "fixed", inset: 0, children: /* @__PURE__ */ jsx(OverviewDiagrams, { graph }) });
|
|
306
|
-
}
|
|
307
|
-
export {
|
|
308
|
-
OverviewPage as default
|
|
309
|
-
};
|