@adecore/agents-react 0.70.1 → 0.71.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/dist/chat/ui/CodeBlock.d.ts +6 -1
- package/dist/chat/ui/CodeBlock.js +39 -23
- package/dist/chat/ui/intelligent-ui/UiReply.js +11 -2
- package/dist/chat/ui/intelligent-ui/key-caps.d.ts +1 -0
- package/dist/chat/ui/intelligent-ui/key-caps.js +45 -0
- package/dist/chat/ui/intelligent-ui/link-action.d.ts +9 -0
- package/dist/chat/ui/intelligent-ui/link-action.js +32 -0
- package/dist/chat/ui/intelligent-ui/node-text.js +1 -1
- package/dist/chat/ui/intelligent-ui/patch-clip.d.ts +4 -0
- package/dist/chat/ui/intelligent-ui/patch-clip.js +64 -0
- package/dist/chat/ui/intelligent-ui/registry.js +31 -5
- package/dist/chat/ui/intelligent-ui/render-context.d.ts +13 -0
- package/dist/chat/ui/intelligent-ui/renderers/alternatives.d.ts +6 -0
- package/dist/chat/ui/intelligent-ui/renderers/alternatives.js +296 -0
- package/dist/chat/ui/intelligent-ui/renderers/changes.d.ts +4 -0
- package/dist/chat/ui/intelligent-ui/renderers/changes.js +266 -0
- package/dist/chat/ui/intelligent-ui/renderers/chart.js +522 -371
- package/dist/chat/ui/intelligent-ui/renderers/content.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/content.js +94 -43
- package/dist/chat/ui/intelligent-ui/renderers/data.js +478 -245
- package/dist/chat/ui/intelligent-ui/renderers/diff.d.ts +4 -0
- package/dist/chat/ui/intelligent-ui/renderers/diff.js +427 -0
- package/dist/chat/ui/intelligent-ui/renderers/inputs.d.ts +1 -0
- package/dist/chat/ui/intelligent-ui/renderers/inputs.js +354 -110
- package/dist/chat/ui/intelligent-ui/renderers/keys.d.ts +3 -0
- package/dist/chat/ui/intelligent-ui/renderers/keys.js +60 -0
- package/dist/chat/ui/intelligent-ui/renderers/links.d.ts +13 -2
- package/dist/chat/ui/intelligent-ui/renderers/links.js +65 -85
- package/dist/chat/ui/intelligent-ui/renderers/meter.d.ts +4 -0
- package/dist/chat/ui/intelligent-ui/renderers/meter.js +371 -0
- package/dist/chat/ui/intelligent-ui/renderers/quote.d.ts +3 -0
- package/dist/chat/ui/intelligent-ui/renderers/quote.js +123 -0
- package/dist/chat/ui/intelligent-ui/renderers/radio.d.ts +3 -0
- package/dist/chat/ui/intelligent-ui/renderers/radio.js +205 -0
- package/dist/chat/ui/intelligent-ui/renderers/structure.d.ts +2 -0
- package/dist/chat/ui/intelligent-ui/renderers/structure.js +156 -45
- package/dist/chat/ui/intelligent-ui/renderers/text.js +365 -215
- package/dist/chat/ui/intelligent-ui/renderers/tree.d.ts +5 -0
- package/dist/chat/ui/intelligent-ui/renderers/tree.js +284 -0
- package/dist/chat/ui/intelligent-ui/table-data.d.ts +9 -2
- package/dist/chat/ui/intelligent-ui/table-data.js +68 -3
- package/dist/chat/ui/intelligent-ui/tones.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/tones.js +7 -7
- package/dist/chat/ui/intelligent-ui/use-ui-diffs.d.ts +4 -0
- package/dist/chat/ui/intelligent-ui/use-ui-diffs.js +201 -0
- package/dist/host/host.d.ts +2 -1
- package/dist/locales/en/agent-chat.d.ts +56 -0
- package/dist/locales/en/agent-chat.js +57 -1
- package/dist/locales/nl/agent-chat.d.ts +56 -0
- package/dist/locales/nl/agent-chat.js +57 -1
- package/dist/theme.css +6 -0
- package/package.json +9 -9
- package/src/chat/ui/CodeBlock.tsx +38 -18
- package/src/chat/ui/intelligent-ui/UiReply.tsx +13 -2
- package/src/chat/ui/intelligent-ui/key-caps.ts +51 -0
- package/src/chat/ui/intelligent-ui/link-action.ts +32 -0
- package/src/chat/ui/intelligent-ui/node-text.ts +1 -0
- package/src/chat/ui/intelligent-ui/patch-clip.ts +83 -0
- package/src/chat/ui/intelligent-ui/registry.ts +31 -4
- package/src/chat/ui/intelligent-ui/render-context.ts +21 -0
- package/src/chat/ui/intelligent-ui/renderers/alternatives.tsx +76 -0
- package/src/chat/ui/intelligent-ui/renderers/changes.tsx +97 -0
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +122 -46
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +27 -7
- package/src/chat/ui/intelligent-ui/renderers/data.tsx +165 -52
- package/src/chat/ui/intelligent-ui/renderers/diff.tsx +144 -0
- package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +111 -19
- package/src/chat/ui/intelligent-ui/renderers/keys.tsx +26 -0
- package/src/chat/ui/intelligent-ui/renderers/links.tsx +40 -24
- package/src/chat/ui/intelligent-ui/renderers/meter.tsx +105 -0
- package/src/chat/ui/intelligent-ui/renderers/quote.tsx +29 -0
- package/src/chat/ui/intelligent-ui/renderers/radio.tsx +130 -0
- package/src/chat/ui/intelligent-ui/renderers/structure.tsx +54 -7
- package/src/chat/ui/intelligent-ui/renderers/text.tsx +70 -36
- package/src/chat/ui/intelligent-ui/renderers/tree.tsx +85 -0
- package/src/chat/ui/intelligent-ui/table-data.ts +84 -6
- package/src/chat/ui/intelligent-ui/tones.ts +7 -7
- package/src/chat/ui/intelligent-ui/use-ui-diffs.ts +119 -0
- package/src/host/host.ts +4 -0
- package/src/locales/en/agent-chat.ts +57 -1
- package/src/locales/nl/agent-chat.ts +57 -1
- package/src/theme.css +6 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { Icon, Pill } from '@adecore/ui';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Minus, Plus } from 'lucide-react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { uiChildrenOf } from '../node-text.js';
|
|
7
|
+
/* Cards side by side, stacked in a narrow block; three stand in one row only where the block is wide enough for them. */
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export function AlternativesRenderer(t0) {
|
|
10
|
+
const $ = _c(14);
|
|
11
|
+
const {
|
|
12
|
+
node,
|
|
13
|
+
children
|
|
14
|
+
} = t0;
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useTranslation("agent-chat");
|
|
18
|
+
let count;
|
|
19
|
+
let t1;
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[0] !== node || $[1] !== t) {
|
|
22
|
+
count = uiChildrenOf(node, "Alternative").length;
|
|
23
|
+
t1 = "group";
|
|
24
|
+
t2 = t("blocks.alternatives.label", {
|
|
25
|
+
count
|
|
26
|
+
});
|
|
27
|
+
$[0] = node;
|
|
28
|
+
$[1] = t;
|
|
29
|
+
$[2] = count;
|
|
30
|
+
$[3] = t1;
|
|
31
|
+
$[4] = t2;
|
|
32
|
+
} else {
|
|
33
|
+
count = $[2];
|
|
34
|
+
t1 = $[3];
|
|
35
|
+
t2 = $[4];
|
|
36
|
+
}
|
|
37
|
+
const t3 = count === 3 && "@min-[640px]:grid-cols-3";
|
|
38
|
+
let t4;
|
|
39
|
+
if ($[5] !== t3) {
|
|
40
|
+
t4 = clsx("chat-ui-nodes grid gap-2 @min-[420px]:grid-cols-2", t3);
|
|
41
|
+
$[5] = t3;
|
|
42
|
+
$[6] = t4;
|
|
43
|
+
} else {
|
|
44
|
+
t4 = $[6];
|
|
45
|
+
}
|
|
46
|
+
let t5;
|
|
47
|
+
if ($[7] !== children || $[8] !== t4) {
|
|
48
|
+
t5 = /*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: t4,
|
|
50
|
+
children: children
|
|
51
|
+
});
|
|
52
|
+
$[7] = children;
|
|
53
|
+
$[8] = t4;
|
|
54
|
+
$[9] = t5;
|
|
55
|
+
} else {
|
|
56
|
+
t5 = $[9];
|
|
57
|
+
}
|
|
58
|
+
let t6;
|
|
59
|
+
if ($[10] !== t1 || $[11] !== t2 || $[12] !== t5) {
|
|
60
|
+
t6 = /*#__PURE__*/_jsx("div", {
|
|
61
|
+
role: t1,
|
|
62
|
+
"aria-label": t2,
|
|
63
|
+
className: "@container",
|
|
64
|
+
children: t5
|
|
65
|
+
});
|
|
66
|
+
$[10] = t1;
|
|
67
|
+
$[11] = t2;
|
|
68
|
+
$[12] = t5;
|
|
69
|
+
$[13] = t6;
|
|
70
|
+
} else {
|
|
71
|
+
t6 = $[13];
|
|
72
|
+
}
|
|
73
|
+
return t6;
|
|
74
|
+
}
|
|
75
|
+
/*
|
|
76
|
+
* It only shows: a person chooses with a Choice under it. The description and the points come in the order
|
|
77
|
+
* they were written, so the first point keeps its distance from the words above it by its place among them.
|
|
78
|
+
*/
|
|
79
|
+
export function AlternativeRenderer(t0) {
|
|
80
|
+
const $ = _c(17);
|
|
81
|
+
const {
|
|
82
|
+
node,
|
|
83
|
+
children
|
|
84
|
+
} = t0;
|
|
85
|
+
const {
|
|
86
|
+
t
|
|
87
|
+
} = useTranslation("agent-chat");
|
|
88
|
+
const {
|
|
89
|
+
title,
|
|
90
|
+
recommended
|
|
91
|
+
} = node.props;
|
|
92
|
+
const t1 = recommended === true && "ring-2 ring-accent ring-inset";
|
|
93
|
+
let t2;
|
|
94
|
+
if ($[0] !== t1) {
|
|
95
|
+
t2 = clsx("flex min-w-0 flex-col gap-2 rounded-xl bg-ui-tile p-3", t1);
|
|
96
|
+
$[0] = t1;
|
|
97
|
+
$[1] = t2;
|
|
98
|
+
} else {
|
|
99
|
+
t2 = $[1];
|
|
100
|
+
}
|
|
101
|
+
let t3;
|
|
102
|
+
if ($[2] !== title) {
|
|
103
|
+
t3 = /*#__PURE__*/_jsx("div", {
|
|
104
|
+
className: "min-w-0 grow text-xs font-semibold wrap-break-word text-text",
|
|
105
|
+
children: title
|
|
106
|
+
});
|
|
107
|
+
$[2] = title;
|
|
108
|
+
$[3] = t3;
|
|
109
|
+
} else {
|
|
110
|
+
t3 = $[3];
|
|
111
|
+
}
|
|
112
|
+
let t4;
|
|
113
|
+
if ($[4] !== recommended || $[5] !== t) {
|
|
114
|
+
t4 = recommended === true && /*#__PURE__*/_jsx(Pill, {
|
|
115
|
+
shape: "tag",
|
|
116
|
+
size: "sm",
|
|
117
|
+
tone: "accent",
|
|
118
|
+
className: "shrink-0",
|
|
119
|
+
children: t("blocks.alternatives.recommended")
|
|
120
|
+
});
|
|
121
|
+
$[4] = recommended;
|
|
122
|
+
$[5] = t;
|
|
123
|
+
$[6] = t4;
|
|
124
|
+
} else {
|
|
125
|
+
t4 = $[6];
|
|
126
|
+
}
|
|
127
|
+
let t5;
|
|
128
|
+
if ($[7] !== t3 || $[8] !== t4) {
|
|
129
|
+
t5 = /*#__PURE__*/_jsxs("div", {
|
|
130
|
+
className: "flex items-start gap-2",
|
|
131
|
+
children: [t3, t4]
|
|
132
|
+
});
|
|
133
|
+
$[7] = t3;
|
|
134
|
+
$[8] = t4;
|
|
135
|
+
$[9] = t5;
|
|
136
|
+
} else {
|
|
137
|
+
t5 = $[9];
|
|
138
|
+
}
|
|
139
|
+
let t6;
|
|
140
|
+
if ($[10] !== children) {
|
|
141
|
+
t6 = /*#__PURE__*/_jsx("div", {
|
|
142
|
+
className: "text-xs wrap-break-word text-text-muted [&>div]:mt-1 [&>div:first-of-type]:mt-2",
|
|
143
|
+
children: children
|
|
144
|
+
});
|
|
145
|
+
$[10] = children;
|
|
146
|
+
$[11] = t6;
|
|
147
|
+
} else {
|
|
148
|
+
t6 = $[11];
|
|
149
|
+
}
|
|
150
|
+
let t7;
|
|
151
|
+
if ($[12] !== t2 || $[13] !== t5 || $[14] !== t6 || $[15] !== title) {
|
|
152
|
+
t7 = /*#__PURE__*/_jsxs("section", {
|
|
153
|
+
"aria-label": title,
|
|
154
|
+
className: t2,
|
|
155
|
+
children: [t5, t6]
|
|
156
|
+
});
|
|
157
|
+
$[12] = t2;
|
|
158
|
+
$[13] = t5;
|
|
159
|
+
$[14] = t6;
|
|
160
|
+
$[15] = title;
|
|
161
|
+
$[16] = t7;
|
|
162
|
+
} else {
|
|
163
|
+
t7 = $[16];
|
|
164
|
+
}
|
|
165
|
+
return t7;
|
|
166
|
+
}
|
|
167
|
+
function Point(t0) {
|
|
168
|
+
const $ = _c(13);
|
|
169
|
+
const {
|
|
170
|
+
icon,
|
|
171
|
+
tone,
|
|
172
|
+
said,
|
|
173
|
+
children
|
|
174
|
+
} = t0;
|
|
175
|
+
let t1;
|
|
176
|
+
if ($[0] !== tone) {
|
|
177
|
+
t1 = clsx("mt-1 shrink-0", tone);
|
|
178
|
+
$[0] = tone;
|
|
179
|
+
$[1] = t1;
|
|
180
|
+
} else {
|
|
181
|
+
t1 = $[1];
|
|
182
|
+
}
|
|
183
|
+
let t2;
|
|
184
|
+
if ($[2] !== icon || $[3] !== t1) {
|
|
185
|
+
t2 = /*#__PURE__*/_jsx(Icon, {
|
|
186
|
+
icon: icon,
|
|
187
|
+
size: 12,
|
|
188
|
+
className: t1
|
|
189
|
+
});
|
|
190
|
+
$[2] = icon;
|
|
191
|
+
$[3] = t1;
|
|
192
|
+
$[4] = t2;
|
|
193
|
+
} else {
|
|
194
|
+
t2 = $[4];
|
|
195
|
+
}
|
|
196
|
+
let t3;
|
|
197
|
+
if ($[5] !== said) {
|
|
198
|
+
t3 = /*#__PURE__*/_jsx("span", {
|
|
199
|
+
className: "sr-only",
|
|
200
|
+
children: said
|
|
201
|
+
});
|
|
202
|
+
$[5] = said;
|
|
203
|
+
$[6] = t3;
|
|
204
|
+
} else {
|
|
205
|
+
t3 = $[6];
|
|
206
|
+
}
|
|
207
|
+
let t4;
|
|
208
|
+
if ($[7] !== children) {
|
|
209
|
+
t4 = /*#__PURE__*/_jsx("span", {
|
|
210
|
+
className: "min-w-0",
|
|
211
|
+
children: children
|
|
212
|
+
});
|
|
213
|
+
$[7] = children;
|
|
214
|
+
$[8] = t4;
|
|
215
|
+
} else {
|
|
216
|
+
t4 = $[8];
|
|
217
|
+
}
|
|
218
|
+
let t5;
|
|
219
|
+
if ($[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
|
|
220
|
+
t5 = /*#__PURE__*/_jsxs("div", {
|
|
221
|
+
className: "flex items-start gap-1.5 text-2xs text-text",
|
|
222
|
+
children: [t2, t3, t4]
|
|
223
|
+
});
|
|
224
|
+
$[9] = t2;
|
|
225
|
+
$[10] = t3;
|
|
226
|
+
$[11] = t4;
|
|
227
|
+
$[12] = t5;
|
|
228
|
+
} else {
|
|
229
|
+
t5 = $[12];
|
|
230
|
+
}
|
|
231
|
+
return t5;
|
|
232
|
+
}
|
|
233
|
+
export function ProRenderer(t0) {
|
|
234
|
+
const $ = _c(5);
|
|
235
|
+
const {
|
|
236
|
+
children
|
|
237
|
+
} = t0;
|
|
238
|
+
const {
|
|
239
|
+
t
|
|
240
|
+
} = useTranslation("agent-chat");
|
|
241
|
+
let t1;
|
|
242
|
+
if ($[0] !== t) {
|
|
243
|
+
t1 = t("blocks.alternatives.pro");
|
|
244
|
+
$[0] = t;
|
|
245
|
+
$[1] = t1;
|
|
246
|
+
} else {
|
|
247
|
+
t1 = $[1];
|
|
248
|
+
}
|
|
249
|
+
let t2;
|
|
250
|
+
if ($[2] !== children || $[3] !== t1) {
|
|
251
|
+
t2 = /*#__PURE__*/_jsx(Point, {
|
|
252
|
+
icon: Plus,
|
|
253
|
+
tone: "text-positive",
|
|
254
|
+
said: t1,
|
|
255
|
+
children: children
|
|
256
|
+
});
|
|
257
|
+
$[2] = children;
|
|
258
|
+
$[3] = t1;
|
|
259
|
+
$[4] = t2;
|
|
260
|
+
} else {
|
|
261
|
+
t2 = $[4];
|
|
262
|
+
}
|
|
263
|
+
return t2;
|
|
264
|
+
}
|
|
265
|
+
export function ConRenderer(t0) {
|
|
266
|
+
const $ = _c(5);
|
|
267
|
+
const {
|
|
268
|
+
children
|
|
269
|
+
} = t0;
|
|
270
|
+
const {
|
|
271
|
+
t
|
|
272
|
+
} = useTranslation("agent-chat");
|
|
273
|
+
let t1;
|
|
274
|
+
if ($[0] !== t) {
|
|
275
|
+
t1 = t("blocks.alternatives.con");
|
|
276
|
+
$[0] = t;
|
|
277
|
+
$[1] = t1;
|
|
278
|
+
} else {
|
|
279
|
+
t1 = $[1];
|
|
280
|
+
}
|
|
281
|
+
let t2;
|
|
282
|
+
if ($[2] !== children || $[3] !== t1) {
|
|
283
|
+
t2 = /*#__PURE__*/_jsx(Point, {
|
|
284
|
+
icon: Minus,
|
|
285
|
+
tone: "text-status-error",
|
|
286
|
+
said: t1,
|
|
287
|
+
children: children
|
|
288
|
+
});
|
|
289
|
+
$[2] = children;
|
|
290
|
+
$[3] = t1;
|
|
291
|
+
$[4] = t2;
|
|
292
|
+
} else {
|
|
293
|
+
t2 = $[4];
|
|
294
|
+
}
|
|
295
|
+
return t2;
|
|
296
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UiProps } from '@adecore/intelligent-ui';
|
|
2
|
+
import type { UiRendererProps } from '../render-context.js';
|
|
3
|
+
export declare function ChangesRenderer({ node, children }: UiRendererProps<UiProps<'Changes'>>): import("react").JSX.Element;
|
|
4
|
+
export declare function ChangeRenderer({ node, children, context }: UiRendererProps<UiProps<'Change'>>): import("react").JSX.Element;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { FileIcon, MiddleTruncate, Tooltip } from '@adecore/ui';
|
|
3
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { uiLinkAction } from '../link-action.js';
|
|
7
|
+
import { uiChildrenOf, uiNodeLabel } from '../node-text.js';
|
|
8
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export function ChangesRenderer(t0) {
|
|
10
|
+
const $ = _c(6);
|
|
11
|
+
const {
|
|
12
|
+
node,
|
|
13
|
+
children
|
|
14
|
+
} = t0;
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useTranslation("agent-chat");
|
|
18
|
+
let t1;
|
|
19
|
+
if ($[0] !== node || $[1] !== t) {
|
|
20
|
+
t1 = t("blocks.changes.label", {
|
|
21
|
+
count: uiChildrenOf(node, "Change").length
|
|
22
|
+
});
|
|
23
|
+
$[0] = node;
|
|
24
|
+
$[1] = t;
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else {
|
|
27
|
+
t1 = $[2];
|
|
28
|
+
}
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[3] !== children || $[4] !== t1) {
|
|
31
|
+
t2 = /*#__PURE__*/_jsx("ul", {
|
|
32
|
+
"aria-label": t1,
|
|
33
|
+
className: "chat-ui-nodes chat-ui-flat flex flex-col rounded-xl bg-ui-tile p-1.5",
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
$[3] = children;
|
|
37
|
+
$[4] = t1;
|
|
38
|
+
$[5] = t2;
|
|
39
|
+
} else {
|
|
40
|
+
t2 = $[5];
|
|
41
|
+
}
|
|
42
|
+
return t2;
|
|
43
|
+
}
|
|
44
|
+
/* The share of added against removed lines, drawn only; the two numbers beside it say it in words. */
|
|
45
|
+
function ChangeBar(t0) {
|
|
46
|
+
const $ = _c(6);
|
|
47
|
+
const {
|
|
48
|
+
added,
|
|
49
|
+
removed
|
|
50
|
+
} = t0;
|
|
51
|
+
const total = added + removed;
|
|
52
|
+
let t1;
|
|
53
|
+
if ($[0] !== added || $[1] !== removed || $[2] !== total) {
|
|
54
|
+
t1 = total > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
56
|
+
className: "bg-positive",
|
|
57
|
+
style: {
|
|
58
|
+
width: `${added / total * 100}%`
|
|
59
|
+
}
|
|
60
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
61
|
+
className: "bg-status-error",
|
|
62
|
+
style: {
|
|
63
|
+
width: `${removed / total * 100}%`
|
|
64
|
+
}
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
$[0] = added;
|
|
68
|
+
$[1] = removed;
|
|
69
|
+
$[2] = total;
|
|
70
|
+
$[3] = t1;
|
|
71
|
+
} else {
|
|
72
|
+
t1 = $[3];
|
|
73
|
+
}
|
|
74
|
+
let t2;
|
|
75
|
+
if ($[4] !== t1) {
|
|
76
|
+
t2 = /*#__PURE__*/_jsx("span", {
|
|
77
|
+
"aria-hidden": true,
|
|
78
|
+
className: "flex h-1.5 w-12 shrink-0 overflow-hidden rounded-full bg-track",
|
|
79
|
+
children: t1
|
|
80
|
+
});
|
|
81
|
+
$[4] = t1;
|
|
82
|
+
$[5] = t2;
|
|
83
|
+
} else {
|
|
84
|
+
t2 = $[5];
|
|
85
|
+
}
|
|
86
|
+
return t2;
|
|
87
|
+
}
|
|
88
|
+
/*
|
|
89
|
+
* One changed file as a row that opens its diff the way a Diff chip does, once the host says it can. Until
|
|
90
|
+
* then, and for a file it cannot open, the row is text with the reason on its path. The note stands under
|
|
91
|
+
* the row, outside the button, since its prose may hold a link of its own.
|
|
92
|
+
*/
|
|
93
|
+
export function ChangeRenderer(t0) {
|
|
94
|
+
const $ = _c(32);
|
|
95
|
+
const {
|
|
96
|
+
node,
|
|
97
|
+
children,
|
|
98
|
+
context
|
|
99
|
+
} = t0;
|
|
100
|
+
const {
|
|
101
|
+
t
|
|
102
|
+
} = useTranslation("agent-chat");
|
|
103
|
+
const {
|
|
104
|
+
path,
|
|
105
|
+
added,
|
|
106
|
+
removed,
|
|
107
|
+
state
|
|
108
|
+
} = node.props;
|
|
109
|
+
let t1;
|
|
110
|
+
if ($[0] !== context || $[1] !== path || $[2] !== t) {
|
|
111
|
+
t1 = uiLinkAction(t, {
|
|
112
|
+
type: "Diff",
|
|
113
|
+
path
|
|
114
|
+
}, context);
|
|
115
|
+
$[0] = context;
|
|
116
|
+
$[1] = path;
|
|
117
|
+
$[2] = t;
|
|
118
|
+
$[3] = t1;
|
|
119
|
+
} else {
|
|
120
|
+
t1 = $[3];
|
|
121
|
+
}
|
|
122
|
+
const {
|
|
123
|
+
open,
|
|
124
|
+
reason
|
|
125
|
+
} = t1;
|
|
126
|
+
const counted = added !== undefined || removed !== undefined;
|
|
127
|
+
let t2;
|
|
128
|
+
if ($[4] !== open || $[5] !== path || $[6] !== reason) {
|
|
129
|
+
t2 = open !== null || reason === null ? /*#__PURE__*/_jsx(MiddleTruncate, {
|
|
130
|
+
text: path,
|
|
131
|
+
className: "min-w-0 grow font-mono text-code text-text"
|
|
132
|
+
}) : /*#__PURE__*/_jsx(Tooltip, {
|
|
133
|
+
label: reason,
|
|
134
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
135
|
+
tabIndex: 0,
|
|
136
|
+
className: "min-w-0 grow truncate rounded-sm font-mono text-code text-text-muted",
|
|
137
|
+
children: path
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
$[4] = open;
|
|
141
|
+
$[5] = path;
|
|
142
|
+
$[6] = reason;
|
|
143
|
+
$[7] = t2;
|
|
144
|
+
} else {
|
|
145
|
+
t2 = $[7];
|
|
146
|
+
}
|
|
147
|
+
const name = t2;
|
|
148
|
+
let t3;
|
|
149
|
+
if ($[8] !== path) {
|
|
150
|
+
t3 = /*#__PURE__*/_jsx(FileIcon, {
|
|
151
|
+
path: path,
|
|
152
|
+
size: 14,
|
|
153
|
+
className: "shrink-0"
|
|
154
|
+
});
|
|
155
|
+
$[8] = path;
|
|
156
|
+
$[9] = t3;
|
|
157
|
+
} else {
|
|
158
|
+
t3 = $[9];
|
|
159
|
+
}
|
|
160
|
+
let t4;
|
|
161
|
+
if ($[10] !== state || $[11] !== t) {
|
|
162
|
+
t4 = state !== undefined && /*#__PURE__*/_jsx("span", {
|
|
163
|
+
className: "shrink-0 text-2xs text-text-muted",
|
|
164
|
+
children: t(`blocks.changes.state.${state}`)
|
|
165
|
+
});
|
|
166
|
+
$[10] = state;
|
|
167
|
+
$[11] = t;
|
|
168
|
+
$[12] = t4;
|
|
169
|
+
} else {
|
|
170
|
+
t4 = $[12];
|
|
171
|
+
}
|
|
172
|
+
let t5;
|
|
173
|
+
if ($[13] !== added || $[14] !== counted || $[15] !== removed || $[16] !== t) {
|
|
174
|
+
t5 = counted && /*#__PURE__*/_jsxs(_Fragment, {
|
|
175
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
176
|
+
className: "min-w-8 shrink-0 text-right text-2xs text-positive tabular-nums",
|
|
177
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
178
|
+
"aria-hidden": true,
|
|
179
|
+
children: ["+", formatNumber(added ?? 0)]
|
|
180
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
181
|
+
className: "sr-only",
|
|
182
|
+
children: t("blocks.changes.added", {
|
|
183
|
+
count: added ?? 0
|
|
184
|
+
})
|
|
185
|
+
})]
|
|
186
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
187
|
+
className: "min-w-8 shrink-0 text-right text-2xs text-status-error tabular-nums",
|
|
188
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
189
|
+
"aria-hidden": true,
|
|
190
|
+
children: ["-", formatNumber(removed ?? 0)]
|
|
191
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
192
|
+
className: "sr-only",
|
|
193
|
+
children: t("blocks.changes.removed", {
|
|
194
|
+
count: removed ?? 0
|
|
195
|
+
})
|
|
196
|
+
})]
|
|
197
|
+
}), /*#__PURE__*/_jsx(ChangeBar, {
|
|
198
|
+
added: added ?? 0,
|
|
199
|
+
removed: removed ?? 0
|
|
200
|
+
})]
|
|
201
|
+
});
|
|
202
|
+
$[13] = added;
|
|
203
|
+
$[14] = counted;
|
|
204
|
+
$[15] = removed;
|
|
205
|
+
$[16] = t;
|
|
206
|
+
$[17] = t5;
|
|
207
|
+
} else {
|
|
208
|
+
t5 = $[17];
|
|
209
|
+
}
|
|
210
|
+
let t6;
|
|
211
|
+
if ($[18] !== name || $[19] !== t3 || $[20] !== t4 || $[21] !== t5) {
|
|
212
|
+
t6 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
213
|
+
children: [t3, name, t4, t5]
|
|
214
|
+
});
|
|
215
|
+
$[18] = name;
|
|
216
|
+
$[19] = t3;
|
|
217
|
+
$[20] = t4;
|
|
218
|
+
$[21] = t5;
|
|
219
|
+
$[22] = t6;
|
|
220
|
+
} else {
|
|
221
|
+
t6 = $[22];
|
|
222
|
+
}
|
|
223
|
+
const row = t6;
|
|
224
|
+
let t7;
|
|
225
|
+
if ($[23] !== open || $[24] !== row) {
|
|
226
|
+
t7 = open === null ? /*#__PURE__*/_jsx("div", {
|
|
227
|
+
className: "flex min-h-8.5 w-full min-w-0 items-center gap-2.5 rounded-lg px-1.5 text-left text-xs",
|
|
228
|
+
children: row
|
|
229
|
+
}) : /*#__PURE__*/_jsx("button", {
|
|
230
|
+
type: "button",
|
|
231
|
+
className: clsx("flex min-h-8.5 w-full min-w-0 items-center gap-2.5 rounded-lg px-1.5 text-left text-xs", "hover:bg-text/4"),
|
|
232
|
+
onClick: open,
|
|
233
|
+
children: row
|
|
234
|
+
});
|
|
235
|
+
$[23] = open;
|
|
236
|
+
$[24] = row;
|
|
237
|
+
$[25] = t7;
|
|
238
|
+
} else {
|
|
239
|
+
t7 = $[25];
|
|
240
|
+
}
|
|
241
|
+
let t8;
|
|
242
|
+
if ($[26] !== children || $[27] !== node) {
|
|
243
|
+
t8 = uiNodeLabel(node) !== "" && /*#__PURE__*/_jsx("p", {
|
|
244
|
+
className: "pr-1.5 pb-1.5 pl-7.5 text-2xs wrap-break-word text-text-muted",
|
|
245
|
+
children: children
|
|
246
|
+
});
|
|
247
|
+
$[26] = children;
|
|
248
|
+
$[27] = node;
|
|
249
|
+
$[28] = t8;
|
|
250
|
+
} else {
|
|
251
|
+
t8 = $[28];
|
|
252
|
+
}
|
|
253
|
+
let t9;
|
|
254
|
+
if ($[29] !== t7 || $[30] !== t8) {
|
|
255
|
+
t9 = /*#__PURE__*/_jsxs("li", {
|
|
256
|
+
className: "flex min-w-0 flex-col",
|
|
257
|
+
children: [t7, t8]
|
|
258
|
+
});
|
|
259
|
+
$[29] = t7;
|
|
260
|
+
$[30] = t8;
|
|
261
|
+
$[31] = t9;
|
|
262
|
+
} else {
|
|
263
|
+
t9 = $[31];
|
|
264
|
+
}
|
|
265
|
+
return t9;
|
|
266
|
+
}
|