likec4 1.58.0 → 1.59.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__/codegen/webcomponent.mjs +14 -14
- package/__app__/src/chunks/AIChat.mjs +153 -156
- package/__app__/src/chunks/LikeC4Styles.mjs +1553 -1255
- package/__app__/src/chunks/ProjectsOverview.mjs +127 -130
- package/__app__/src/chunks/hooks.mjs +419 -106
- package/__app__/src/chunks/libs/@floating-ui.mjs +8 -8
- package/__app__/src/chunks/libs/@mantine.mjs +3039 -2135
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +4 -4
- package/__app__/src/chunks/libs/@tanstack.mjs +93 -118
- package/__app__/src/chunks/libs/@xstate/react.mjs +30 -16
- package/__app__/src/chunks/libs/@xyflow/react.mjs +50 -26
- package/__app__/src/chunks/libs/bezier-js.mjs +11 -8
- package/__app__/src/chunks/libs/framer.mjs +1188 -1155
- package/__app__/src/chunks/libs/zod.mjs +191 -188
- package/__app__/src/chunks/rolldown-runtime.mjs +8 -1
- package/__app__/src/chunks/styled-system.mjs +23 -16
- package/__app__/src/main.mjs +22275 -9432
- package/__app__/src/style.css +1 -1
- package/dist/chunks/dist.mjs +10 -0
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/index.d.mts +9 -9
- package/dist/chunks/index2.d.mts +386 -229
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +1 -1
- package/dist/chunks/libs/@logtape/logtape.mjs +3 -3
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +1 -2
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
- package/dist/chunks/libs/chevrotain-allstar.mjs +1 -1
- package/dist/chunks/libs/chevrotain.mjs +4 -4
- package/dist/chunks/libs/json5.mjs +1 -1
- package/dist/chunks/libs/langium.d.mts +2940 -2914
- package/dist/chunks/libs/langium.mjs +9 -9
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/p-queue.mjs +1 -1
- package/dist/chunks/libs/package-manager-detector.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +1 -1
- package/dist/chunks/libs/picomatch.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/unstorage.d.mts +1 -0
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/libs/zod.d.mts +48 -36
- package/dist/chunks/libs/zod.mjs +4 -4
- package/dist/chunks/logger.mjs +1 -0
- package/dist/chunks/node.mjs +57 -66
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +43 -43
- package/dist/cli/index.mjs +159 -157
- package/dist/index.d.mts +2 -3
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +5 -4
- package/dist/vite-plugin/index.d.mts +6 -9
- package/dist/vite-plugin/internal/index.d.mts +15 -10
- package/package.json +37 -37
- package/react/index.d.mts +761 -111
- package/react/index.mjs +13974 -10232
- package/__app__/src/chunks/DiagramActorProvider.mjs +0 -7638
- package/__app__/src/chunks/Markdown.mjs +0 -146
- package/__app__/src/chunks/NavigationPanel.mjs +0 -61
- package/__app__/src/chunks/adhoc-editor.mjs +0 -3386
- package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +0 -1894
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +0 -252
- package/__app__/src/chunks/libs/remeda.mjs +0 -642
|
@@ -5,7 +5,7 @@ import { jsx as x } from "react/jsx-runtime";
|
|
|
5
5
|
import { ComponentName as S } from "likec4:app-config";
|
|
6
6
|
import { LikeC4View as C } from "likec4:react";
|
|
7
7
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js
|
|
8
|
-
var w =
|
|
8
|
+
var w = /*@__PURE__*/ r("ZodMiniType", (t, n) => {
|
|
9
9
|
if (!t._zod) throw Error("Uninitialized schema in ZodMiniType.");
|
|
10
10
|
y.init(t, n), t.def = n, t.type = n.type, t.parse = (e, n) => s(t, e, n, { callee: t.parse }), t.safeParse = (e, n) => i(t, e, n), t.parseAsync = async (e, n) => v(t, e, n, { callee: t.parseAsync }), t.safeParseAsync = async (n, r) => e(t, n, r), t.check = (...e) => t.clone({
|
|
11
11
|
...n,
|
|
@@ -15,19 +15,19 @@ var w = /* @__PURE__ */ r("ZodMiniType", (t, n) => {
|
|
|
15
15
|
onattach: []
|
|
16
16
|
} } : e)]
|
|
17
17
|
}, { parent: !0 }), t.with = t.check, t.clone = (e, n) => _(t, e, n), t.brand = () => t, t.register = ((e, n) => (e.add(t, n), t)), t.apply = (e) => e(t);
|
|
18
|
-
}), T =
|
|
18
|
+
}), T = /*@__PURE__*/ r("ZodMiniString", (e, t) => {
|
|
19
19
|
g.init(e, t), w.init(e, t);
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
// @__NO_SIDE_EFFECTS__
|
|
22
22
|
function string(e) {
|
|
23
23
|
return f(T, e);
|
|
24
24
|
}
|
|
25
|
-
var E =
|
|
25
|
+
var E = /*@__PURE__*/ r("ZodMiniBoolean", (e, t) => {
|
|
26
26
|
c.init(e, t), w.init(e, t);
|
|
27
|
-
}), D =
|
|
27
|
+
}), D = /*@__PURE__*/ r("ZodMiniObject", (e, t) => {
|
|
28
28
|
d.init(e, t), w.init(e, t), a(e, "shape", () => t.shape);
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
// @__NO_SIDE_EFFECTS__
|
|
31
31
|
function object(e, t) {
|
|
32
32
|
return new D({
|
|
33
33
|
type: "object",
|
|
@@ -35,10 +35,10 @@ function object(e, t) {
|
|
|
35
35
|
...n(t)
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
var O =
|
|
38
|
+
var O = /*@__PURE__*/ r("ZodMiniLiteral", (e, t) => {
|
|
39
39
|
p.init(e, t), w.init(e, t);
|
|
40
40
|
});
|
|
41
|
-
|
|
41
|
+
// @__NO_SIDE_EFFECTS__
|
|
42
42
|
function literal(e, t) {
|
|
43
43
|
return new O({
|
|
44
44
|
type: "literal",
|
|
@@ -46,20 +46,20 @@ function literal(e, t) {
|
|
|
46
46
|
...n(t)
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
var k =
|
|
49
|
+
var k = /*@__PURE__*/ r("ZodMiniOptional", (e, t) => {
|
|
50
50
|
u.init(e, t), w.init(e, t);
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
// @__NO_SIDE_EFFECTS__
|
|
53
53
|
function optional(e) {
|
|
54
54
|
return new k({
|
|
55
55
|
type: "optional",
|
|
56
56
|
innerType: e
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
var A =
|
|
59
|
+
var A = /*@__PURE__*/ r("ZodMiniDefault", (e, t) => {
|
|
60
60
|
m.init(e, t), w.init(e, t);
|
|
61
61
|
});
|
|
62
|
-
|
|
62
|
+
// @__NO_SIDE_EFFECTS__
|
|
63
63
|
function _default(e, n) {
|
|
64
64
|
return new A({
|
|
65
65
|
type: "default",
|
|
@@ -69,9 +69,9 @@ function _default(e, n) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
var j =
|
|
72
|
+
var j = /*@__PURE__*/ r("ZodMiniPipe", (e, t) => {
|
|
73
73
|
o.init(e, t), w.init(e, t);
|
|
74
|
-
}), M =
|
|
74
|
+
}), M = /*@__PURE__*/ r("ZodMiniCodec", (e, t) => {
|
|
75
75
|
j.init(e, t), l.init(e, t);
|
|
76
76
|
}), stringbool = (...e) => h({
|
|
77
77
|
Codec: M,
|
|
@@ -1,53 +1,50 @@
|
|
|
1
1
|
import { i as e } from "./rolldown-runtime.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { C as
|
|
6
|
-
import {
|
|
7
|
-
import { i as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { c as I } from "react/compiler-runtime";
|
|
14
|
-
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
15
|
-
import { RichText as he, nonNullable as ge, nonexhaustive as _e } from "@likec4/core";
|
|
2
|
+
import { l as t } from "./libs/@tanstack.mjs";
|
|
3
|
+
import { C as n, F as r, N as i, O as a, _ as o, b as s, c, j as l, k as u, m as d, t as f, v as p, y as m } from "./hooks.mjs";
|
|
4
|
+
import { B as h, Et as g, J as ee, N as te, Xt as ne, Z as _, g as re, ht as v, mt as ie, r as ae, v as y, x as b } from "./libs/@mantine.mjs";
|
|
5
|
+
import { C as x, N as S, _ as C, x as w } from "./styled-system.mjs";
|
|
6
|
+
import { i as oe, m as se } from "./libs/framer.mjs";
|
|
7
|
+
import { a as T, c as E, i as ce, n as D, o as O, r as k, s as A, t as j } from "./libs/zod.mjs";
|
|
8
|
+
import { a as M, i as le, n as ue, r as de, t as fe } from "./libs/@tanstack-ai.mjs";
|
|
9
|
+
import { createContext as pe, use as me, useEffect as he, useRef as N, useState as P } from "react";
|
|
10
|
+
import { c as F } from "react/compiler-runtime";
|
|
11
|
+
import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
12
|
+
import { RichText as ge, nonNullable as z, nonexhaustive as _e } from "@likec4/core";
|
|
16
13
|
import { ElementShapes as ve } from "@likec4/core/styles";
|
|
17
14
|
import { AIAdapter as ye } from "likec4:rpc";
|
|
18
15
|
//#region ../../node_modules/.pnpm/nanostores@1.3.0/node_modules/nanostores/computed/index.js
|
|
19
16
|
var computedStore = (e, t, n) => {
|
|
20
17
|
Array.isArray(e) || (e = [e]);
|
|
21
18
|
let r, i, set = () => {
|
|
22
|
-
if (i ===
|
|
23
|
-
i =
|
|
19
|
+
if (i === s.epoch) return;
|
|
20
|
+
i = s.epoch;
|
|
24
21
|
let n = e.map((e) => e.get());
|
|
25
22
|
if (!r || n.some((e, t) => e !== r[t])) {
|
|
26
23
|
r = n;
|
|
27
24
|
let e = t(...n);
|
|
28
25
|
e && e.then && e.t ? e.then((e) => {
|
|
29
26
|
r === n && a.set(e);
|
|
30
|
-
}) : (a.set(e), i =
|
|
27
|
+
}) : (a.set(e), i = s.epoch);
|
|
31
28
|
}
|
|
32
|
-
}, a = /* @__PURE__ */
|
|
29
|
+
}, a = /* @__PURE__ */ m(void 0), o = a.get;
|
|
33
30
|
a.get = () => (set(), o());
|
|
34
|
-
let
|
|
35
|
-
clearTimeout(
|
|
31
|
+
let c, l = n ? () => {
|
|
32
|
+
clearTimeout(c), c = setTimeout(set);
|
|
36
33
|
} : set;
|
|
37
|
-
return
|
|
38
|
-
let t = e.map((e) => e.listen(
|
|
34
|
+
return p(a, () => {
|
|
35
|
+
let t = e.map((e) => e.listen(l));
|
|
39
36
|
return set(), () => {
|
|
40
37
|
for (let e of t) e();
|
|
41
38
|
};
|
|
42
39
|
}), a;
|
|
43
|
-
}, batched = /* @__NO_SIDE_EFFECTS__ */ (e, t) => computedStore(e, t, !0), B =
|
|
40
|
+
}, batched = /* @__NO_SIDE_EFFECTS__ */ (e, t) => computedStore(e, t, !0), B = pe(null);
|
|
44
41
|
function useChatContext() {
|
|
45
|
-
return
|
|
42
|
+
return z(me(B), "useChatContext: ChatProvider is not provided");
|
|
46
43
|
}
|
|
47
44
|
//#endregion
|
|
48
45
|
//#region src/aichat/ChatInput.tsx
|
|
49
46
|
function ChatInput() {
|
|
50
|
-
let e =
|
|
47
|
+
let e = F(22), { sendMessage: t, isLoading: n, messages: r, clear: i, stop: o } = useChatContext(), [s, c] = P(""), l = N(null), t0;
|
|
51
48
|
e[0] !== n || e[1] !== t || e[2] !== s ? (t0 = () => {
|
|
52
49
|
!s.trim() || n || (t(s), c(""));
|
|
53
50
|
}, e[0] = n, e[1] = t, e[2] = s, e[3] = t0) : t0 = e[3];
|
|
@@ -58,7 +55,7 @@ function ChatInput() {
|
|
|
58
55
|
e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.metaKey && (e.preventDefault(), u());
|
|
59
56
|
}, e[5] = u, e[6] = t2);
|
|
60
57
|
let d;
|
|
61
|
-
e[7] !== n || e[8] !== t2 || e[9] !== s ? (d = /* @__PURE__ */
|
|
58
|
+
e[7] !== n || e[8] !== t2 || e[9] !== s ? (d = /* @__PURE__ */ L(te, {
|
|
62
59
|
flex: 1,
|
|
63
60
|
className: "chat-input",
|
|
64
61
|
placeholder: "Your question...",
|
|
@@ -71,40 +68,40 @@ function ChatInput() {
|
|
|
71
68
|
autosize: !0,
|
|
72
69
|
minRows: 1
|
|
73
70
|
}), e[7] = n, e[8] = t2, e[9] = s, e[10] = d) : d = e[10];
|
|
74
|
-
let
|
|
75
|
-
e[11] !== i || e[12] !== n || e[13] !== r.length ? (
|
|
71
|
+
let f;
|
|
72
|
+
e[11] !== i || e[12] !== n || e[13] !== r.length ? (f = r.length > 0 && !n && /* @__PURE__ */ L(ee, {
|
|
76
73
|
size: "sm",
|
|
77
74
|
color: "red",
|
|
78
75
|
variant: "light",
|
|
79
76
|
onClick: () => i(),
|
|
80
77
|
children: "Clear"
|
|
81
|
-
}), e[11] = i, e[12] = n, e[13] = r.length, e[14] =
|
|
82
|
-
let
|
|
83
|
-
e[15] !== n || e[16] !== o ? (
|
|
78
|
+
}), e[11] = i, e[12] = n, e[13] = r.length, e[14] = f) : f = e[14];
|
|
79
|
+
let p;
|
|
80
|
+
e[15] !== n || e[16] !== o ? (p = n && /* @__PURE__ */ L(v, {
|
|
84
81
|
color: "red",
|
|
85
82
|
variant: "light",
|
|
86
83
|
onClick: () => o(),
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
-
}), e[15] = n, e[16] = o, e[17] =
|
|
89
|
-
let
|
|
90
|
-
return e[18] !== d || e[19] !==
|
|
84
|
+
children: /* @__PURE__ */ L(a, {})
|
|
85
|
+
}), e[15] = n, e[16] = o, e[17] = p) : p = e[17];
|
|
86
|
+
let m;
|
|
87
|
+
return e[18] !== d || e[19] !== f || e[20] !== p ? (m = /* @__PURE__ */ R(w, { children: [
|
|
91
88
|
d,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
] }), e[18] = d, e[19] =
|
|
89
|
+
f,
|
|
90
|
+
p
|
|
91
|
+
] }), e[18] = d, e[19] = f, e[20] = p, e[21] = m) : m = e[21], m;
|
|
95
92
|
}
|
|
96
93
|
//#endregion
|
|
97
94
|
//#region src/aichat/ChatMessage.tsx
|
|
98
95
|
function ChatMessages() {
|
|
99
|
-
let e =
|
|
96
|
+
let e = F(7), { messages: t, error: n } = useChatContext(), r;
|
|
100
97
|
e[0] === t ? r = e[1] : (r = t.map(_temp), e[0] = t, e[1] = r);
|
|
101
98
|
let i;
|
|
102
|
-
e[2] === n ? i = e[3] : (i = n && /* @__PURE__ */
|
|
99
|
+
e[2] === n ? i = e[3] : (i = n && /* @__PURE__ */ L(y, {
|
|
103
100
|
styles: { icon: { alignSelf: "flex-start" } },
|
|
104
101
|
color: "red",
|
|
105
102
|
title: "Oops, something went wrong",
|
|
106
103
|
withCloseButton: !1,
|
|
107
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ R(C, {
|
|
108
105
|
fontSize: "sm",
|
|
109
106
|
fontFamily: "mono",
|
|
110
107
|
whiteSpace: "pre",
|
|
@@ -113,14 +110,14 @@ function ChatMessages() {
|
|
|
113
110
|
})
|
|
114
111
|
}), e[2] = n, e[3] = i);
|
|
115
112
|
let a;
|
|
116
|
-
return e[4] !== r || e[5] !== i ? (a = /* @__PURE__ */
|
|
113
|
+
return e[4] !== r || e[5] !== i ? (a = /* @__PURE__ */ R(I, { children: [r, i] }), e[4] = r, e[5] = i, e[6] = a) : a = e[6], a;
|
|
117
114
|
}
|
|
118
115
|
function _temp(e) {
|
|
119
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ L(ChatMessage, { message: e }, e.id);
|
|
120
117
|
}
|
|
121
118
|
var ChatMessage = (e) => {
|
|
122
|
-
let t =
|
|
123
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (i =
|
|
119
|
+
let t = F(4), { message: n } = e, r = n.role, i;
|
|
120
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (i = S({
|
|
124
121
|
color: "text.bright",
|
|
125
122
|
alignSelf: "flex-end",
|
|
126
123
|
paddingInline: "2",
|
|
@@ -131,28 +128,28 @@ var ChatMessage = (e) => {
|
|
|
131
128
|
whiteSpace: "pre-wrap"
|
|
132
129
|
}), t[0] = i) : i = t[0];
|
|
133
130
|
let a = r === "user" ? UserMessageTextPart : MarkdownTextPart, o;
|
|
134
|
-
return t[1] !== n || t[2] !== a ? (o = /* @__PURE__ */
|
|
131
|
+
return t[1] !== n || t[2] !== a ? (o = /* @__PURE__ */ L(fe, {
|
|
135
132
|
message: n,
|
|
136
133
|
userClassName: i,
|
|
137
134
|
textPartRenderer: a
|
|
138
135
|
}), t[1] = n, t[2] = a, t[3] = o) : o = t[3], o;
|
|
139
136
|
}, UserMessageTextPart = (e) => {
|
|
140
|
-
let t =
|
|
141
|
-
return t[0] === n ? r = t[1] : (r = /* @__PURE__ */
|
|
137
|
+
let t = F(2), { content: n } = e, r;
|
|
138
|
+
return t[0] === n ? r = t[1] : (r = /* @__PURE__ */ L(I, { children: n }), t[0] = n, t[1] = r), r;
|
|
142
139
|
}, MarkdownTextPart = (e) => {
|
|
143
|
-
let t =
|
|
144
|
-
t[0] === n ? r = t[1] : (r =
|
|
140
|
+
let t = F(4), { content: n } = e, r;
|
|
141
|
+
t[0] === n ? r = t[1] : (r = ge.from({ md: n }), t[0] = n, t[1] = r);
|
|
145
142
|
let i;
|
|
146
|
-
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */
|
|
143
|
+
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ L(c, {
|
|
147
144
|
textScale: .95,
|
|
148
145
|
value: r
|
|
149
146
|
}), t[2] = r, t[3] = i), i;
|
|
150
|
-
}, V = /* @__PURE__ */
|
|
147
|
+
}, V = /* @__PURE__ */ m(""), H = /* @__PURE__ */ m("closed"), be = /* @__PURE__ */ batched([V, H], (e, t) => ({
|
|
151
148
|
log: e,
|
|
152
149
|
status: t
|
|
153
150
|
}));
|
|
154
151
|
function useSemanticLayoutLog() {
|
|
155
|
-
return
|
|
152
|
+
return o(be);
|
|
156
153
|
}
|
|
157
154
|
function closeSemanticLayoutLog() {
|
|
158
155
|
H.set("closed"), V.set("");
|
|
@@ -160,20 +157,20 @@ function closeSemanticLayoutLog() {
|
|
|
160
157
|
//#endregion
|
|
161
158
|
//#region src/aichat/SemanticLayoutLog.tsx
|
|
162
159
|
function SemanticLayoutLog() {
|
|
163
|
-
let e =
|
|
160
|
+
let e = F(6), { log: t, status: n } = useSemanticLayoutLog();
|
|
164
161
|
if (n === "closed") return null;
|
|
165
162
|
let r = n === "completed", i;
|
|
166
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */
|
|
163
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ L(ae, {
|
|
167
164
|
order: 4,
|
|
168
165
|
children: "Semantic Layout"
|
|
169
166
|
}), e[0] = i) : i = e[0];
|
|
170
167
|
let a = t || "Waiting for response...", o;
|
|
171
|
-
e[1] === a ? o = e[2] : (o = /* @__PURE__ */
|
|
168
|
+
e[1] === a ? o = e[2] : (o = /* @__PURE__ */ L(C, {
|
|
172
169
|
whiteSpace: "pre-wrap",
|
|
173
170
|
children: a
|
|
174
171
|
}), e[1] = a, e[2] = o);
|
|
175
172
|
let s;
|
|
176
|
-
return e[3] !== r || e[4] !== o ? (s = /* @__PURE__ */
|
|
173
|
+
return e[3] !== r || e[4] !== o ? (s = /* @__PURE__ */ L(b, {
|
|
177
174
|
size: "xl",
|
|
178
175
|
opened: !0,
|
|
179
176
|
onClose: closeSemanticLayoutLog,
|
|
@@ -186,57 +183,57 @@ function SemanticLayoutLog() {
|
|
|
186
183
|
}
|
|
187
184
|
//#endregion
|
|
188
185
|
//#region ../vite-plugin/src/ai/tools.ts
|
|
189
|
-
var U =
|
|
190
|
-
id:
|
|
191
|
-
title:
|
|
192
|
-
shape:
|
|
193
|
-
color:
|
|
194
|
-
icon:
|
|
195
|
-
parentId:
|
|
196
|
-
children:
|
|
197
|
-
x:
|
|
198
|
-
y:
|
|
199
|
-
width:
|
|
200
|
-
height:
|
|
201
|
-
modelFqn:
|
|
202
|
-
}), xe =
|
|
186
|
+
var U = A({
|
|
187
|
+
id: E().meta({ description: "Node ID" }),
|
|
188
|
+
title: E(),
|
|
189
|
+
shape: j(ve),
|
|
190
|
+
color: E().meta({ description: "Node color, from theme or custom" }),
|
|
191
|
+
icon: E().nullish(),
|
|
192
|
+
parentId: E().nullish().meta({ description: "Parent node ID (if node is nested)" }),
|
|
193
|
+
children: D(E()).nullish().meta({ description: "Nested node IDs (if node is compound)" }),
|
|
194
|
+
x: O(),
|
|
195
|
+
y: O(),
|
|
196
|
+
width: O(),
|
|
197
|
+
height: O(),
|
|
198
|
+
modelFqn: E().nullish().meta({ description: "Model element FQN (if node has reference)" })
|
|
199
|
+
}), xe = M({
|
|
203
200
|
name: "read_ui",
|
|
204
201
|
description: "Read current UI state. Use arguments to include additional data.",
|
|
205
202
|
needsApproval: !1,
|
|
206
|
-
inputSchema:
|
|
207
|
-
selectedNode:
|
|
208
|
-
nodes:
|
|
203
|
+
inputSchema: A({
|
|
204
|
+
selectedNode: k().default(!1).meta({ description: "Include selected node (if any)" }),
|
|
205
|
+
nodes: k().default(!1).meta({ description: "Include all nodes from the view" })
|
|
209
206
|
}),
|
|
210
|
-
outputSchema:
|
|
211
|
-
projectId:
|
|
212
|
-
editMode:
|
|
213
|
-
view:
|
|
214
|
-
id:
|
|
215
|
-
title:
|
|
216
|
-
type:
|
|
207
|
+
outputSchema: A({
|
|
208
|
+
projectId: E(),
|
|
209
|
+
editMode: k().meta({ description: "Whether the UI is in edit mode" }),
|
|
210
|
+
view: A({
|
|
211
|
+
id: E(),
|
|
212
|
+
title: E(),
|
|
213
|
+
type: j([
|
|
217
214
|
"element",
|
|
218
215
|
"deployment",
|
|
219
216
|
"dynamic"
|
|
220
217
|
]).meta({ description: "Type of the current view" })
|
|
221
218
|
}).meta({ description: "Current view" }),
|
|
222
|
-
nodes:
|
|
219
|
+
nodes: D(U).nullish(),
|
|
223
220
|
selectedNode: U.nullish()
|
|
224
221
|
})
|
|
225
|
-
}), Se =
|
|
222
|
+
}), Se = M({
|
|
226
223
|
name: "update_ui",
|
|
227
224
|
description: "Update UI state by executing a command.",
|
|
228
225
|
needsApproval: !1,
|
|
229
|
-
inputSchema:
|
|
230
|
-
type:
|
|
231
|
-
elementId:
|
|
232
|
-
}).meta({ description: "Focus UI on an element by its FQN" }),
|
|
233
|
-
outputSchema:
|
|
234
|
-
}), Ce =
|
|
226
|
+
inputSchema: A({ command: ce("type", [A({
|
|
227
|
+
type: T("focus"),
|
|
228
|
+
elementId: E().meta({ description: "Element ID (FQN)" })
|
|
229
|
+
}).meta({ description: "Focus UI on an element by its FQN" }), A({ type: T("fitview") }).meta({ description: "Zoom out to fit all elements in the viewport, and clear any selection/focus" })]) }),
|
|
230
|
+
outputSchema: A({})
|
|
231
|
+
}), Ce = M({
|
|
235
232
|
name: "navigate_to",
|
|
236
233
|
description: "Navigates UI to another view",
|
|
237
234
|
needsApproval: !1,
|
|
238
|
-
inputSchema:
|
|
239
|
-
outputSchema:
|
|
235
|
+
inputSchema: A({ viewId: E().meta({ description: "View ID" }) }),
|
|
236
|
+
outputSchema: A({})
|
|
240
237
|
}), DoubleIndexedKV = class {
|
|
241
238
|
constructor() {
|
|
242
239
|
this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
|
|
@@ -726,24 +723,24 @@ function mapToNodeData(e) {
|
|
|
726
723
|
};
|
|
727
724
|
}
|
|
728
725
|
function useChatTools() {
|
|
729
|
-
let e =
|
|
730
|
-
if (e[0] !==
|
|
726
|
+
let e = F(11), { id: n } = f(), a = t(), o = d(), s;
|
|
727
|
+
if (e[0] !== o || e[1] !== a || e[2] !== n) {
|
|
731
728
|
let t1;
|
|
732
|
-
e[4] ===
|
|
729
|
+
e[4] === a ? t1 = e[5] : (t1 = (e) => {
|
|
733
730
|
let { viewId: t } = e;
|
|
734
|
-
return
|
|
731
|
+
return a({
|
|
735
732
|
to: "./",
|
|
736
733
|
params: (e) => ({
|
|
737
734
|
...e,
|
|
738
735
|
viewId: t
|
|
739
736
|
})
|
|
740
737
|
}), {};
|
|
741
|
-
}, e[4] =
|
|
738
|
+
}, e[4] = a, e[5] = t1);
|
|
742
739
|
let t2;
|
|
743
|
-
e[6] !==
|
|
744
|
-
let { view: t, focusedNode:
|
|
740
|
+
e[6] !== o || e[7] !== n ? (t2 = (e) => {
|
|
741
|
+
let { view: t, focusedNode: a, xynodes: s, xystore: c, toggledFeatures: u, features: d } = o.getContext(), f = u.enableReadOnly ?? d.enableReadOnly, p = mapToNodeData(c.getState()), m = e.nodes === !0 && l(s, p) || void 0, h = e.selectedNode === !0 && r(s, i((e) => !!e.selected || e.id === a), (e) => e ? p(e) : void 0);
|
|
745
742
|
return {
|
|
746
|
-
projectId:
|
|
743
|
+
projectId: n,
|
|
747
744
|
editMode: !f,
|
|
748
745
|
view: {
|
|
749
746
|
id: t.id,
|
|
@@ -753,23 +750,23 @@ function useChatTools() {
|
|
|
753
750
|
...m && { nodes: m },
|
|
754
751
|
...h && { selectedNode: h }
|
|
755
752
|
};
|
|
756
|
-
}, e[6] =
|
|
753
|
+
}, e[6] = o, e[7] = n, e[8] = t2) : t2 = e[8];
|
|
757
754
|
let t3;
|
|
758
|
-
e[9] ===
|
|
755
|
+
e[9] === o ? t3 = e[10] : (t3 = (e) => {
|
|
759
756
|
let { command: t } = e;
|
|
760
757
|
bb50: switch (t.type) {
|
|
761
758
|
case "focus":
|
|
762
|
-
|
|
759
|
+
o.focusOnElement(t.elementId);
|
|
763
760
|
break bb50;
|
|
764
761
|
case "fitview":
|
|
765
|
-
|
|
762
|
+
o.fitDiagram();
|
|
766
763
|
break bb50;
|
|
767
764
|
default: _e(t);
|
|
768
765
|
}
|
|
769
766
|
return {};
|
|
770
|
-
}, e[9] =
|
|
771
|
-
} else
|
|
772
|
-
return
|
|
767
|
+
}, e[9] = o, e[10] = t3), s = de(Ce.client(t1), xe.client(t2), Se.client(t3)), e[0] = o, e[1] = a, e[2] = n, e[3] = s;
|
|
768
|
+
} else s = e[3];
|
|
769
|
+
return s;
|
|
773
770
|
}
|
|
774
771
|
var Q = {
|
|
775
772
|
key: "likec4.ai.chat.messages",
|
|
@@ -792,9 +789,9 @@ var Q = {
|
|
|
792
789
|
}
|
|
793
790
|
};
|
|
794
791
|
function useChat(e) {
|
|
795
|
-
let t =
|
|
792
|
+
let t = F(7), n;
|
|
796
793
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (n = {
|
|
797
|
-
connection:
|
|
794
|
+
connection: le("/__likec4_ai"),
|
|
798
795
|
initialMessages: Q.read()
|
|
799
796
|
}, t[0] = n) : n = t[0];
|
|
800
797
|
let r = n, i = useChatTools(), a;
|
|
@@ -803,10 +800,10 @@ function useChat(e) {
|
|
|
803
800
|
...e,
|
|
804
801
|
tools: i
|
|
805
802
|
}, t[1] = e, t[2] = i, t[3] = a) : a = t[3];
|
|
806
|
-
let o =
|
|
803
|
+
let o = ue(a), t3, s;
|
|
807
804
|
return t[4] === o.messages ? (t3 = t[5], s = t[6]) : (t3 = () => {
|
|
808
805
|
Q.write(o.messages);
|
|
809
|
-
}, s = [o.messages], t[4] = o.messages, t[5] = t3, t[6] = s),
|
|
806
|
+
}, s = [o.messages], t[4] = o.messages, t[5] = t3, t[6] = s), he(t3, s), o;
|
|
810
807
|
}
|
|
811
808
|
//#endregion
|
|
812
809
|
//#region src/aichat/AIChat.tsx
|
|
@@ -829,7 +826,7 @@ var $ = {
|
|
|
829
826
|
}
|
|
830
827
|
};
|
|
831
828
|
function AIChatComponent() {
|
|
832
|
-
let e =
|
|
829
|
+
let e = N(null);
|
|
833
830
|
e.current ||= $.read() ?? {
|
|
834
831
|
right: 16,
|
|
835
832
|
bottom: 100
|
|
@@ -839,14 +836,14 @@ function AIChatComponent() {
|
|
|
839
836
|
left: t.x,
|
|
840
837
|
top: t.y
|
|
841
838
|
});
|
|
842
|
-
}, [t, n] =
|
|
839
|
+
}, [t, n] = ne({
|
|
843
840
|
key: "likec4.ai.chat.collapsed",
|
|
844
841
|
defaultValue: !0
|
|
845
842
|
});
|
|
846
|
-
return /* @__PURE__ */
|
|
843
|
+
return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ R(se, { children: [!t && /* @__PURE__ */ L(h, {
|
|
847
844
|
w: 300,
|
|
848
845
|
pos: "fixed",
|
|
849
|
-
className:
|
|
846
|
+
className: S({
|
|
850
847
|
rounded: "md",
|
|
851
848
|
padding: "xs",
|
|
852
849
|
shadow: "md",
|
|
@@ -857,8 +854,8 @@ function AIChatComponent() {
|
|
|
857
854
|
excludeDragHandleSelector: ".chat-input",
|
|
858
855
|
initialPosition: e.current,
|
|
859
856
|
onPositionChange,
|
|
860
|
-
children: /* @__PURE__ */
|
|
861
|
-
}), t && /* @__PURE__ */
|
|
857
|
+
children: /* @__PURE__ */ L(AIChatWindowContent, { onClose: () => n(!0) })
|
|
858
|
+
}), t && /* @__PURE__ */ L(oe.div, {
|
|
862
859
|
initial: {
|
|
863
860
|
opacity: .1,
|
|
864
861
|
translateX: "10%"
|
|
@@ -877,83 +874,83 @@ function AIChatComponent() {
|
|
|
877
874
|
bottom: 60,
|
|
878
875
|
zIndex: 1e3
|
|
879
876
|
},
|
|
880
|
-
children: /* @__PURE__ */
|
|
877
|
+
children: /* @__PURE__ */ L(re, {
|
|
881
878
|
label: "Show AI Assistant",
|
|
882
879
|
color: "dark",
|
|
883
880
|
fz: "xs",
|
|
884
|
-
children: /* @__PURE__ */
|
|
881
|
+
children: /* @__PURE__ */ L(v, {
|
|
885
882
|
size: "lg",
|
|
886
883
|
variant: "gradient",
|
|
887
884
|
onClick: () => n(!1),
|
|
888
|
-
children: /* @__PURE__ */
|
|
885
|
+
children: /* @__PURE__ */ L(u, { stroke: 1.5 })
|
|
889
886
|
})
|
|
890
887
|
})
|
|
891
|
-
}, "collapsed")] }), /* @__PURE__ */
|
|
888
|
+
}, "collapsed")] }), /* @__PURE__ */ L(SemanticLayoutLog, {})] });
|
|
892
889
|
}
|
|
893
890
|
function AIChatWindowContent(e) {
|
|
894
|
-
let t =
|
|
891
|
+
let t = F(15), { onClose: r } = e, i = N(null), t1;
|
|
895
892
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => {
|
|
896
|
-
|
|
893
|
+
i.current?.scrollIntoView();
|
|
897
894
|
}, t[0] = t1) : t1 = t[0];
|
|
898
|
-
let
|
|
895
|
+
let a = t1, t2;
|
|
899
896
|
t[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => {
|
|
900
|
-
|
|
901
|
-
}, t[1] = t2) : t2 = t[1],
|
|
902
|
-
let
|
|
903
|
-
t[2] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
904
|
-
let
|
|
905
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
897
|
+
a();
|
|
898
|
+
}, t[1] = t2) : t2 = t[1], n(t2, 100);
|
|
899
|
+
let o;
|
|
900
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (o = { onChunk: a }, t[2] = o) : o = t[2];
|
|
901
|
+
let s = useChat(o), c;
|
|
902
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ R(w, { children: [/* @__PURE__ */ L(C, {
|
|
906
903
|
textStyle: "likec4.panel",
|
|
907
904
|
noUserSelect: !0,
|
|
908
905
|
children: "AI Assistant"
|
|
909
|
-
}), /* @__PURE__ */
|
|
906
|
+
}), /* @__PURE__ */ L(_, {
|
|
910
907
|
size: "xs",
|
|
911
908
|
radius: "sm",
|
|
912
909
|
variant: "light",
|
|
913
910
|
children: ye
|
|
914
|
-
})] }), t[3] =
|
|
915
|
-
let
|
|
916
|
-
t[4] ===
|
|
911
|
+
})] }), t[3] = c) : c = t[3];
|
|
912
|
+
let l;
|
|
913
|
+
t[4] === r ? l = t[5] : (l = /* @__PURE__ */ R(w, {
|
|
917
914
|
cursor: "move",
|
|
918
915
|
justify: "space-between",
|
|
919
|
-
children: [
|
|
916
|
+
children: [c, /* @__PURE__ */ L(ie, {
|
|
920
917
|
size: "sm",
|
|
921
918
|
onClick: (e) => {
|
|
922
|
-
e.stopPropagation(),
|
|
919
|
+
e.stopPropagation(), r();
|
|
923
920
|
}
|
|
924
921
|
})]
|
|
925
|
-
}), t[4] =
|
|
922
|
+
}), t[4] = r, t[5] = l);
|
|
923
|
+
let u;
|
|
924
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (u = { content: S({ display: "contents" }) }, t[6] = u) : u = t[6];
|
|
926
925
|
let d;
|
|
927
|
-
t[
|
|
928
|
-
let f;
|
|
929
|
-
t[
|
|
930
|
-
let m, h;
|
|
931
|
-
t[8] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ R(o, {
|
|
926
|
+
t[7] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ L(ChatMessages, {}), t[7] = d) : d = t[7];
|
|
927
|
+
let f, p;
|
|
928
|
+
t[8] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ L(g, {
|
|
932
929
|
scrollbars: "y",
|
|
933
930
|
w: "100%",
|
|
934
931
|
flex: 1,
|
|
935
932
|
mih: 250,
|
|
936
933
|
mah: 350,
|
|
937
|
-
classNames:
|
|
938
|
-
children: /* @__PURE__ */
|
|
939
|
-
ref:
|
|
934
|
+
classNames: u,
|
|
935
|
+
children: /* @__PURE__ */ R(x, { children: [d, /* @__PURE__ */ L("div", {
|
|
936
|
+
ref: i,
|
|
940
937
|
style: { height: 2 }
|
|
941
938
|
})] })
|
|
942
|
-
}),
|
|
943
|
-
let
|
|
944
|
-
t[10] ===
|
|
939
|
+
}), p = /* @__PURE__ */ L(ChatInput, {}), t[8] = f, t[9] = p) : (f = t[8], p = t[9]);
|
|
940
|
+
let m;
|
|
941
|
+
t[10] === l ? m = t[11] : (m = /* @__PURE__ */ R(x, {
|
|
945
942
|
w: "100%",
|
|
946
943
|
children: [
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
944
|
+
l,
|
|
945
|
+
f,
|
|
946
|
+
p
|
|
950
947
|
]
|
|
951
|
-
}), t[10] =
|
|
952
|
-
let
|
|
953
|
-
return t[12] !==
|
|
954
|
-
value:
|
|
955
|
-
children:
|
|
956
|
-
}), t[12] =
|
|
948
|
+
}), t[10] = l, t[11] = m);
|
|
949
|
+
let h;
|
|
950
|
+
return t[12] !== s || t[13] !== m ? (h = /* @__PURE__ */ L(B, {
|
|
951
|
+
value: s,
|
|
952
|
+
children: m
|
|
953
|
+
}), t[12] = s, t[13] = m, t[14] = h) : h = t[14], h;
|
|
957
954
|
}
|
|
958
955
|
//#endregion
|
|
959
956
|
export { AIChatComponent as default };
|