likec4 1.19.1 → 1.20.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/__app__/react/likec4.tsx +16 -114
- package/__app__/src/chunks/{-index-overview-C9eO_hFX.js → -index-overview-r2wnjkuP.js} +20 -19
- package/__app__/src/chunks/{likec4-CusAw_j6.js → likec4-CK8zVxjc.js} +1172 -1209
- package/__app__/src/chunks/main-DnSU4JID.js +23887 -0
- package/__app__/src/chunks/{mantine-B_6mKFFA.js → mantine-B9NZkjVg.js} +993 -981
- package/__app__/src/chunks/tanstack-router-B9I-d36d.js +3032 -0
- package/__app__/src/main.js +1 -2
- package/__app__/src/style.css +1 -1
- package/__app__/webcomponent/webcomponent.js +31797 -32401
- package/dist/chunks/prompt.cjs +1 -1
- package/dist/chunks/prompt.mjs +1 -1
- package/dist/cli/index.cjs +45 -56
- package/dist/cli/index.mjs +29 -40
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +132 -91
- package/dist/index.d.mts +132 -91
- package/dist/index.d.ts +132 -91
- package/dist/index.mjs +1 -1
- package/dist/model/index.cjs +1 -1
- package/dist/model/index.d.cts +4 -252
- package/dist/model/index.d.mts +4 -252
- package/dist/model/index.d.ts +4 -252
- package/dist/model/index.mjs +1 -1
- package/dist/shared/likec4.DBfW7tKq.cjs +1857 -0
- package/dist/shared/likec4.DCOeDSBO.mjs +1857 -0
- package/package.json +41 -41
- package/react/index.d.ts +771 -1537
- package/react/index.js +36748 -37458
- package/react/style.css +1 -1
- package/__app__/src/chunks/main-DY2KbFcO.js +0 -24136
- package/__app__/src/chunks/tanstack-router-BBWuTKWO.js +0 -2373
- package/dist/shared/likec4.1r1CQuHw.mjs +0 -9
- package/dist/shared/likec4.CLgnaOeL.mjs +0 -1856
- package/dist/shared/likec4.CfqfZIn-.cjs +0 -1856
- package/dist/shared/likec4.D81G5JV4.cjs +0 -9
- package/dist/shared/likec4.DCwaTTuF.d.cts +0 -1625
- package/dist/shared/likec4.DCwaTTuF.d.mts +0 -1625
- package/dist/shared/likec4.DCwaTTuF.d.ts +0 -1625
package/__app__/react/likec4.tsx
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import type { LikeC4Model } from '@likec4/core/model'
|
|
2
|
+
import type { DiagramView, ViewId } from '@likec4/core/types'
|
|
2
3
|
import {
|
|
3
|
-
type LikeC4ViewProps
|
|
4
|
+
type LikeC4ViewProps,
|
|
4
5
|
type ReactLikeC4Props as GenericReactLikeC4Props,
|
|
5
|
-
LikeC4Browser,
|
|
6
6
|
LikeC4ModelProvider as GenericLikeC4ModelProvider,
|
|
7
|
-
|
|
7
|
+
LikeC4View as GenericLikeC4View,
|
|
8
8
|
ReactLikeC4 as GenericReactLikeC4,
|
|
9
|
-
useColorScheme,
|
|
10
|
-
ViewNotFound,
|
|
11
9
|
} from 'likec4/react'
|
|
12
|
-
import { type PropsWithChildren
|
|
10
|
+
import { type PropsWithChildren } from 'react'
|
|
13
11
|
import { Icons } from 'virtual:likec4/icons'
|
|
14
|
-
import type { DiagramView, LikeC4ElementKind, LikeC4Tag, LikeC4ViewId } from 'virtual:likec4/model'
|
|
15
12
|
import { likeC4Model, LikeC4Views, useLikeC4Model } from 'virtual:likec4/model'
|
|
16
13
|
|
|
17
14
|
type IconRendererProps = {
|
|
18
15
|
node: {
|
|
19
16
|
id: string
|
|
20
17
|
title: string
|
|
21
|
-
icon?: string | undefined
|
|
18
|
+
icon?: string | null | undefined
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
21
|
|
|
@@ -27,19 +24,16 @@ export function RenderIcon({ node }: IconRendererProps) {
|
|
|
27
24
|
return IconComponent ? <IconComponent /> : null
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
export { likeC4Model,
|
|
27
|
+
export { likeC4Model, useLikeC4Model }
|
|
31
28
|
|
|
32
|
-
export function useLikeC4ViewModel(viewId:
|
|
29
|
+
export function useLikeC4ViewModel(viewId: ViewId): LikeC4Model.View {
|
|
33
30
|
return useLikeC4Model().view(viewId as any)
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
export function useLikeC4View(viewId:
|
|
33
|
+
export function useLikeC4View(viewId: ViewId): DiagramView {
|
|
37
34
|
return useLikeC4Model().view(viewId as any).$view as DiagramView
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
export type LikeC4ViewProps = BaseLikeC4ViewProps<LikeC4ViewId, LikeC4Tag, LikeC4ElementKind>
|
|
41
|
-
|
|
42
|
-
export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId {
|
|
36
|
+
export function isLikeC4ViewId(value: unknown): value is ViewId {
|
|
43
37
|
return (
|
|
44
38
|
value != null
|
|
45
39
|
&& typeof value === 'string'
|
|
@@ -56,117 +50,25 @@ export function LikeC4ModelProvider({ children }: PropsWithChildren) {
|
|
|
56
50
|
)
|
|
57
51
|
}
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
viewId,
|
|
61
|
-
interactive = true,
|
|
62
|
-
colorScheme: explicitColorScheme,
|
|
63
|
-
injectFontCss = true,
|
|
64
|
-
background = 'transparent',
|
|
65
|
-
browserBackground = 'dots',
|
|
66
|
-
where,
|
|
67
|
-
showDiagramTitle = false,
|
|
68
|
-
showNavigationButtons = false,
|
|
69
|
-
showNotations = false,
|
|
70
|
-
enableFocusMode = false,
|
|
71
|
-
enableElementDetails = false,
|
|
72
|
-
enableRelationshipDetails = false,
|
|
73
|
-
enableRelationshipBrowser = enableRelationshipDetails,
|
|
74
|
-
browserClassName,
|
|
75
|
-
browserStyle,
|
|
76
|
-
mantineTheme,
|
|
77
|
-
styleNonce,
|
|
78
|
-
...props
|
|
79
|
-
}) {
|
|
80
|
-
const view = LikeC4Views[viewId]
|
|
81
|
-
|
|
82
|
-
const [browserViewId, onNavigateTo] = useState(null as LikeC4ViewId | null)
|
|
83
|
-
|
|
84
|
-
const browserView = browserViewId ? LikeC4Views[browserViewId] : null
|
|
85
|
-
|
|
86
|
-
const closeBrowser = useCallback(() => {
|
|
87
|
-
onNavigateTo(null)
|
|
88
|
-
}, [onNavigateTo])
|
|
89
|
-
|
|
90
|
-
const colorScheme = useColorScheme(explicitColorScheme)
|
|
91
|
-
|
|
92
|
-
if (!view) {
|
|
93
|
-
return <ViewNotFound viewId={viewId} />
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (browserViewId && !browserView) {
|
|
97
|
-
return <ViewNotFound viewId={browserViewId} />
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (interactive && enableFocusMode) {
|
|
101
|
-
console.warn('Focus mode is not supported in interactive mode')
|
|
102
|
-
}
|
|
103
|
-
|
|
53
|
+
export function LikeC4View(props: LikeC4ViewProps<string, string, string>) {
|
|
104
54
|
return (
|
|
105
55
|
<LikeC4ModelProvider>
|
|
106
|
-
<
|
|
107
|
-
view={view}
|
|
108
|
-
colorScheme={colorScheme}
|
|
109
|
-
injectFontCss={injectFontCss}
|
|
110
|
-
onNavigateTo={interactive ? onNavigateTo : undefined}
|
|
111
|
-
background={background}
|
|
56
|
+
<GenericLikeC4View
|
|
112
57
|
renderIcon={RenderIcon}
|
|
113
|
-
|
|
114
|
-
showNavigationButtons={showNavigationButtons}
|
|
115
|
-
showNotations={showNotations}
|
|
116
|
-
enableFocusMode={enableFocusMode}
|
|
117
|
-
enableElementDetails={enableElementDetails}
|
|
118
|
-
enableRelationshipBrowser={enableRelationshipBrowser}
|
|
119
|
-
enableRelationshipDetails={enableRelationshipDetails}
|
|
120
|
-
where={where}
|
|
121
|
-
mantineTheme={mantineTheme}
|
|
122
|
-
styleNonce={styleNonce}
|
|
123
|
-
{...props}
|
|
124
|
-
/>
|
|
125
|
-
{browserView && (
|
|
126
|
-
<LikeC4Browser<LikeC4ViewId, LikeC4Tag, LikeC4ElementKind>
|
|
127
|
-
view={browserView}
|
|
128
|
-
injectFontCss={false}
|
|
129
|
-
colorScheme={colorScheme}
|
|
130
|
-
onNavigateTo={onNavigateTo}
|
|
131
|
-
background={browserBackground}
|
|
132
|
-
onClose={closeBrowser}
|
|
133
|
-
renderIcon={RenderIcon}
|
|
134
|
-
where={where}
|
|
135
|
-
className={browserClassName}
|
|
136
|
-
style={browserStyle}
|
|
137
|
-
mantineTheme={mantineTheme}
|
|
138
|
-
styleNonce={styleNonce}
|
|
139
|
-
enableElementDetails
|
|
140
|
-
enableRelationshipBrowser
|
|
141
|
-
enableRelationshipDetails
|
|
142
|
-
/>
|
|
143
|
-
)}
|
|
58
|
+
{...props} />
|
|
144
59
|
</LikeC4ModelProvider>
|
|
145
60
|
)
|
|
146
|
-
}
|
|
147
|
-
LikeC4ViewMemo.displayName = 'LikeC4ViewMemo'
|
|
61
|
+
}
|
|
148
62
|
|
|
149
|
-
|
|
150
|
-
& Omit<GenericReactLikeC4Props<LikeC4ViewId, LikeC4Tag, LikeC4ElementKind>, 'view' | 'renderIcon'>
|
|
151
|
-
& {
|
|
152
|
-
viewId: LikeC4ViewId
|
|
153
|
-
}
|
|
63
|
+
type ReactLikeC4Props = Omit<GenericReactLikeC4Props<string, string, string>, 'renderIcon'>
|
|
154
64
|
|
|
155
|
-
|
|
156
|
-
const view = LikeC4Views[viewId]
|
|
157
|
-
if (!view) {
|
|
158
|
-
return <ViewNotFound viewId={viewId} />
|
|
159
|
-
}
|
|
65
|
+
export function ReactLikeC4(props: ReactLikeC4Props) {
|
|
160
66
|
return (
|
|
161
67
|
<LikeC4ModelProvider>
|
|
162
68
|
<GenericReactLikeC4
|
|
163
|
-
view={view}
|
|
164
69
|
renderIcon={RenderIcon}
|
|
165
70
|
{...props}
|
|
166
71
|
/>
|
|
167
72
|
</LikeC4ModelProvider>
|
|
168
73
|
)
|
|
169
|
-
}
|
|
170
|
-
ReactLikeC4Memo.displayName = 'ReactLikeC4Memo'
|
|
171
|
-
|
|
172
|
-
export { LikeC4ViewMemo as LikeC4View, ReactLikeC4Memo as ReactLikeC4 }
|
|
74
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsx as t, jsxs as u, Fragment as z } from "react/jsx-runtime";
|
|
2
2
|
import { useOverviewGraph as L } from "virtual:likec4/overview-graph";
|
|
3
|
-
import {
|
|
4
|
-
import { u as
|
|
5
|
-
import { B as
|
|
6
|
-
import { memo as k, useRef as
|
|
7
|
-
import {
|
|
3
|
+
import { nonexhaustive as R } from "@likec4/core";
|
|
4
|
+
import { u as V } from "./tanstack-router-B9I-d36d.js";
|
|
5
|
+
import { B as G, H as v, P as g, u as $, a as K, i as U, b as A, c as X } from "./likec4-CK8zVxjc.js";
|
|
6
|
+
import { memo as k, useRef as Y, useMemo as B } from "react";
|
|
7
|
+
import { c as b, I as q, n as S, u as j, i as J } from "./main-DnSU4JID.js";
|
|
8
|
+
import { P as O, c as I, G as C, T as F, a as y, C as Q, b as W, d as ee, I as te, B as P, u as se } from "./mantine-B9NZkjVg.js";
|
|
8
9
|
import { usePreviewUrl as ae } from "virtual:likec4/previews";
|
|
9
10
|
/**
|
|
10
|
-
* @license @tabler/icons-react v3.
|
|
11
|
+
* @license @tabler/icons-react v3.29.0 - MIT
|
|
11
12
|
*
|
|
12
13
|
* This source code is licensed under the MIT license.
|
|
13
14
|
* See the LICENSE file in the root directory of this source tree.
|
|
14
15
|
*/
|
|
15
16
|
var oe = b("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
|
/**
|
|
17
|
-
* @license @tabler/icons-react v3.
|
|
18
|
+
* @license @tabler/icons-react v3.29.0 - MIT
|
|
18
19
|
*
|
|
19
20
|
* This source code is licensed under the MIT license.
|
|
20
21
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -32,7 +33,7 @@ function de({
|
|
|
32
33
|
return null;
|
|
33
34
|
const a = ne(e.points);
|
|
34
35
|
return /* @__PURE__ */ t(
|
|
35
|
-
|
|
36
|
+
G,
|
|
36
37
|
{
|
|
37
38
|
id: r,
|
|
38
39
|
path: a,
|
|
@@ -63,7 +64,7 @@ const fe = /* @__PURE__ */ k(function({
|
|
|
63
64
|
e.dimmed && M
|
|
64
65
|
),
|
|
65
66
|
children: /* @__PURE__ */ u(C, { gap: 8, children: [
|
|
66
|
-
/* @__PURE__ */ t(F, { size: 24, variant: "transparent", color: "dark.4", children: /* @__PURE__ */ t(
|
|
67
|
+
/* @__PURE__ */ t(F, { size: 24, variant: "transparent", color: "dark.4", children: /* @__PURE__ */ t(q, { size: "100%" }) }),
|
|
67
68
|
/* @__PURE__ */ t(y, { size: "lg", fw: 500, children: e.label })
|
|
68
69
|
] })
|
|
69
70
|
}
|
|
@@ -190,7 +191,7 @@ const fe = /* @__PURE__ */ k(function({
|
|
|
190
191
|
...p
|
|
191
192
|
};
|
|
192
193
|
default:
|
|
193
|
-
|
|
194
|
+
R(l);
|
|
194
195
|
}
|
|
195
196
|
}),
|
|
196
197
|
edges: r.edges.map((e) => ({
|
|
@@ -211,17 +212,17 @@ function Ne({
|
|
|
211
212
|
zoomable: s = !0,
|
|
212
213
|
pannable: a = !0
|
|
213
214
|
}) {
|
|
214
|
-
const o =
|
|
215
|
-
|
|
215
|
+
const o = V(), c = Y(void 0), { colorScheme: l } = se(), i = B(() => ye(r), [r]), [w, p, N] = $(i.nodes), [E, H, Z] = K(i.edges);
|
|
216
|
+
j(() => {
|
|
216
217
|
p(
|
|
217
218
|
(n) => i.nodes.map((d) => {
|
|
218
219
|
const f = n.find((m) => m.id === d.id);
|
|
219
|
-
return f ? { ...
|
|
220
|
+
return f ? { ...J(f, ["selected", "hidden"]), ...d } : d;
|
|
220
221
|
})
|
|
221
222
|
), H(i.edges);
|
|
222
223
|
}, [i.nodes, i.edges]);
|
|
223
224
|
const x = w.find((n) => n.selected);
|
|
224
|
-
return
|
|
225
|
+
return j(() => {
|
|
225
226
|
const n = c.current;
|
|
226
227
|
n && (x ? n.fitView({
|
|
227
228
|
maxZoom: 1,
|
|
@@ -234,7 +235,7 @@ function Ne({
|
|
|
234
235
|
duration: 800
|
|
235
236
|
}));
|
|
236
237
|
}, [x?.id ?? null]), /* @__PURE__ */ t(
|
|
237
|
-
|
|
238
|
+
U,
|
|
238
239
|
{
|
|
239
240
|
colorMode: l === "auto" ? "system" : l,
|
|
240
241
|
className: ie,
|
|
@@ -245,7 +246,7 @@ function Ne({
|
|
|
245
246
|
edges: E,
|
|
246
247
|
onEdgesChange: Z,
|
|
247
248
|
fitView: !0,
|
|
248
|
-
fitViewOptions:
|
|
249
|
+
fitViewOptions: B(() => ({
|
|
249
250
|
minZoom: 0.05,
|
|
250
251
|
maxZoom: 1,
|
|
251
252
|
padding: e,
|
|
@@ -296,14 +297,14 @@ function Ne({
|
|
|
296
297
|
}
|
|
297
298
|
d.selected && (n.stopPropagation(), p((f) => f.map((m) => m.id === d.id ? { ...m, selected: !1 } : m)));
|
|
298
299
|
},
|
|
299
|
-
children: /* @__PURE__ */ t(
|
|
300
|
+
children: /* @__PURE__ */ t(A, { variant: X.Dots, size: 4, gap: 50 })
|
|
300
301
|
}
|
|
301
302
|
);
|
|
302
303
|
}
|
|
303
|
-
function
|
|
304
|
+
function je() {
|
|
304
305
|
const r = L();
|
|
305
306
|
return /* @__PURE__ */ t(P, { pos: "fixed", inset: 0, children: /* @__PURE__ */ t(Ne, { graph: r }) });
|
|
306
307
|
}
|
|
307
308
|
export {
|
|
308
|
-
|
|
309
|
+
je as default
|
|
309
310
|
};
|