@adecore/agents-react 0.70.0 → 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/logic/fork.js +1 -0
- package/dist/chat/logic/thread-cards.js +1 -0
- package/dist/chat/logic/timeline.js +7 -0
- 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/chat/ui/rows/MessageRows.d.ts +4 -1
- package/dist/chat/ui/rows/MessageRows.js +92 -1
- package/dist/chat/ui/rows/Rows.js +45 -31
- package/dist/host/host.d.ts +2 -1
- package/dist/host/timeline-row.d.ts +5 -1
- package/dist/locales/en/agent-chat.d.ts +62 -0
- package/dist/locales/en/agent-chat.js +63 -1
- package/dist/locales/nl/agent-chat.d.ts +62 -0
- package/dist/locales/nl/agent-chat.js +63 -1
- package/dist/theme.css +6 -0
- package/package.json +9 -9
- package/src/chat/logic/fork.ts +1 -0
- package/src/chat/logic/thread-cards.ts +1 -0
- package/src/chat/logic/timeline.ts +4 -0
- 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/chat/ui/rows/MessageRows.tsx +23 -0
- package/src/chat/ui/rows/Rows.tsx +3 -0
- package/src/host/host.ts +4 -0
- package/src/host/timeline-row.ts +3 -0
- package/src/locales/en/agent-chat.ts +63 -1
- package/src/locales/nl/agent-chat.ts +63 -1
- package/src/theme.css +6 -0
|
@@ -4,16 +4,18 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { FileDiff, GitCommitHorizontal, SquareDashed } from 'lucide-react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { CHIP_IN_MESSAGE } from '../../chips.js';
|
|
7
|
-
import {
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
-
const PLAIN = {
|
|
10
|
-
state: 'plain'
|
|
11
|
-
};
|
|
7
|
+
import { UI_PLAIN_LINK, uiBaseName, uiPlainLinkReason } from '../link-action.js';
|
|
12
8
|
/* A link in a block is a quiet card on its tile, unlike a mention in a message, which wears the accent. */
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
10
|
const UI_CHIP = 'bg-ui-inset font-mono text-text shadow-[inset_0_0_0_1px_var(--border)]';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
/* The states of a node a chip shows as a dot, each in the color the rest of the app gives that state. */
|
|
12
|
+
const NODE_STATUS = {
|
|
13
|
+
running: 'bg-status-running',
|
|
14
|
+
needsYou: 'bg-status-needs-you',
|
|
15
|
+
done: 'bg-status-idle'
|
|
16
|
+
};
|
|
17
|
+
function nodeStatus(link) {
|
|
18
|
+
return link.status !== undefined && Object.hasOwn(NODE_STATUS, link.status) ? link.status : null;
|
|
17
19
|
}
|
|
18
20
|
function plainText(target, link) {
|
|
19
21
|
switch (target.type) {
|
|
@@ -27,7 +29,7 @@ function plainText(target, link) {
|
|
|
27
29
|
return link.label ?? target.id;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
function chipFace(target, link) {
|
|
32
|
+
function chipFace(target, link, t) {
|
|
31
33
|
switch (target.type) {
|
|
32
34
|
case 'File':
|
|
33
35
|
return {
|
|
@@ -37,7 +39,7 @@ function chipFace(target, link) {
|
|
|
37
39
|
size: 14
|
|
38
40
|
}), /*#__PURE__*/_jsx("span", {
|
|
39
41
|
className: "truncate",
|
|
40
|
-
children:
|
|
42
|
+
children: uiBaseName(target.path)
|
|
41
43
|
}), target.line !== undefined && /*#__PURE__*/_jsxs("span", {
|
|
42
44
|
className: "opacity-70",
|
|
43
45
|
children: [":", target.line]
|
|
@@ -53,7 +55,7 @@ function chipFace(target, link) {
|
|
|
53
55
|
size: 12
|
|
54
56
|
}), /*#__PURE__*/_jsx("span", {
|
|
55
57
|
className: "truncate",
|
|
56
|
-
children:
|
|
58
|
+
children: uiBaseName(target.path)
|
|
57
59
|
})]
|
|
58
60
|
}),
|
|
59
61
|
hint: target.path
|
|
@@ -72,18 +74,31 @@ function chipFace(target, link) {
|
|
|
72
74
|
hint: link.label ?? target.sha
|
|
73
75
|
};
|
|
74
76
|
case 'Node':
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
{
|
|
78
|
+
const status = nodeStatus(link);
|
|
79
|
+
const said = status === null ? null : t(`blocks.node.status.${status}`);
|
|
80
|
+
return {
|
|
81
|
+
face: /*#__PURE__*/_jsxs(_Fragment, {
|
|
82
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
83
|
+
icon: SquareDashed,
|
|
84
|
+
size: 12
|
|
85
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
86
|
+
className: "truncate",
|
|
87
|
+
children: link.label ?? target.id
|
|
88
|
+
}), status !== null && /*#__PURE__*/_jsxs(_Fragment, {
|
|
89
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
90
|
+
"aria-hidden": true,
|
|
91
|
+
className: clsx('size-1.5 shrink-0 rounded-full', NODE_STATUS[status])
|
|
92
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
93
|
+
className: "sr-only",
|
|
94
|
+
children: said
|
|
95
|
+
})]
|
|
96
|
+
})]
|
|
97
|
+
}),
|
|
98
|
+
// The dot says the state by its color alone, so the chip says it in words too.
|
|
99
|
+
hint: said
|
|
100
|
+
};
|
|
101
|
+
}
|
|
87
102
|
}
|
|
88
103
|
}
|
|
89
104
|
/*
|
|
@@ -91,23 +106,24 @@ function chipFace(target, link) {
|
|
|
91
106
|
* can open the target; one it cannot, outside the project or gone, stays mono text with the reason
|
|
92
107
|
* in a tooltip. A chip fades in, since a link reads as text until the host checked it.
|
|
93
108
|
*/
|
|
94
|
-
function UiLinkChip(t0) {
|
|
95
|
-
const $ = _c(
|
|
109
|
+
export function UiLinkChip(t0) {
|
|
110
|
+
const $ = _c(13);
|
|
96
111
|
const {
|
|
97
112
|
target,
|
|
98
|
-
context
|
|
113
|
+
context,
|
|
114
|
+
refused
|
|
99
115
|
} = t0;
|
|
100
116
|
const {
|
|
101
117
|
t
|
|
102
118
|
} = useTranslation("agent-chat");
|
|
103
119
|
let t1;
|
|
104
120
|
let t2;
|
|
105
|
-
if ($[0] !== context || $[1] !==
|
|
121
|
+
if ($[0] !== context || $[1] !== refused || $[2] !== t || $[3] !== target) {
|
|
106
122
|
t2 = Symbol.for("react.early_return_sentinel");
|
|
107
123
|
bb0: {
|
|
108
|
-
const link = context.link?.(target) ??
|
|
124
|
+
const link = refused === undefined ? context.link?.(target) ?? UI_PLAIN_LINK : UI_PLAIN_LINK;
|
|
109
125
|
if (link.state === "plain") {
|
|
110
|
-
const reason =
|
|
126
|
+
const reason = refused ?? uiPlainLinkReason(t, link, context);
|
|
111
127
|
const text = /*#__PURE__*/_jsx("span", {
|
|
112
128
|
tabIndex: reason === null ? undefined : 0,
|
|
113
129
|
className: "font-mono text-code break-all text-text-muted",
|
|
@@ -119,16 +135,17 @@ function UiLinkChip(t0) {
|
|
|
119
135
|
});
|
|
120
136
|
break bb0;
|
|
121
137
|
}
|
|
122
|
-
t1 = chipFace(target, link);
|
|
138
|
+
t1 = chipFace(target, link, t);
|
|
123
139
|
}
|
|
124
140
|
$[0] = context;
|
|
125
|
-
$[1] =
|
|
126
|
-
$[2] =
|
|
127
|
-
$[3] =
|
|
128
|
-
$[4] =
|
|
141
|
+
$[1] = refused;
|
|
142
|
+
$[2] = t;
|
|
143
|
+
$[3] = target;
|
|
144
|
+
$[4] = t1;
|
|
145
|
+
$[5] = t2;
|
|
129
146
|
} else {
|
|
130
|
-
t1 = $[
|
|
131
|
-
t2 = $[
|
|
147
|
+
t1 = $[4];
|
|
148
|
+
t2 = $[5];
|
|
132
149
|
}
|
|
133
150
|
if (t2 !== Symbol.for("react.early_return_sentinel")) {
|
|
134
151
|
return t2;
|
|
@@ -141,7 +158,7 @@ function UiLinkChip(t0) {
|
|
|
141
158
|
openLink
|
|
142
159
|
} = context;
|
|
143
160
|
let t3;
|
|
144
|
-
if ($[
|
|
161
|
+
if ($[6] !== face || $[7] !== openLink || $[8] !== target) {
|
|
145
162
|
t3 = openLink === undefined ? /*#__PURE__*/_jsx("span", {
|
|
146
163
|
className: clsx(CHIP_IN_MESSAGE, UI_CHIP, "transition-opacity duration-120 starting:opacity-0"),
|
|
147
164
|
children: face
|
|
@@ -151,30 +168,30 @@ function UiLinkChip(t0) {
|
|
|
151
168
|
onClick: () => openLink(target),
|
|
152
169
|
children: face
|
|
153
170
|
});
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
171
|
+
$[6] = face;
|
|
172
|
+
$[7] = openLink;
|
|
173
|
+
$[8] = target;
|
|
174
|
+
$[9] = t3;
|
|
158
175
|
} else {
|
|
159
|
-
t3 = $[
|
|
176
|
+
t3 = $[9];
|
|
160
177
|
}
|
|
161
178
|
const chip = t3;
|
|
162
179
|
let t4;
|
|
163
|
-
if ($[
|
|
180
|
+
if ($[10] !== chip || $[11] !== hint) {
|
|
164
181
|
t4 = hint === null ? chip : /*#__PURE__*/_jsx(Tooltip, {
|
|
165
182
|
label: hint,
|
|
166
183
|
children: chip
|
|
167
184
|
});
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
185
|
+
$[10] = chip;
|
|
186
|
+
$[11] = hint;
|
|
187
|
+
$[12] = t4;
|
|
171
188
|
} else {
|
|
172
|
-
t4 = $[
|
|
189
|
+
t4 = $[12];
|
|
173
190
|
}
|
|
174
191
|
return t4;
|
|
175
192
|
}
|
|
176
193
|
/* A link with children is a row: the chip and what the agent says about it. */
|
|
177
|
-
function LinkRow(t0) {
|
|
194
|
+
export function LinkRow(t0) {
|
|
178
195
|
const $ = _c(11);
|
|
179
196
|
const {
|
|
180
197
|
target,
|
|
@@ -280,43 +297,6 @@ export function FileRenderer(t0) {
|
|
|
280
297
|
}
|
|
281
298
|
return t3;
|
|
282
299
|
}
|
|
283
|
-
export function DiffRenderer(t0) {
|
|
284
|
-
const $ = _c(7);
|
|
285
|
-
const {
|
|
286
|
-
node,
|
|
287
|
-
children,
|
|
288
|
-
context
|
|
289
|
-
} = t0;
|
|
290
|
-
let t1;
|
|
291
|
-
if ($[0] !== node.props.path) {
|
|
292
|
-
t1 = {
|
|
293
|
-
type: "Diff",
|
|
294
|
-
path: node.props.path
|
|
295
|
-
};
|
|
296
|
-
$[0] = node.props.path;
|
|
297
|
-
$[1] = t1;
|
|
298
|
-
} else {
|
|
299
|
-
t1 = $[1];
|
|
300
|
-
}
|
|
301
|
-
const t2 = node.children.length > 0;
|
|
302
|
-
let t3;
|
|
303
|
-
if ($[2] !== children || $[3] !== context || $[4] !== t1 || $[5] !== t2) {
|
|
304
|
-
t3 = /*#__PURE__*/_jsx(LinkRow, {
|
|
305
|
-
target: t1,
|
|
306
|
-
context: context,
|
|
307
|
-
described: t2,
|
|
308
|
-
children: children
|
|
309
|
-
});
|
|
310
|
-
$[2] = children;
|
|
311
|
-
$[3] = context;
|
|
312
|
-
$[4] = t1;
|
|
313
|
-
$[5] = t2;
|
|
314
|
-
$[6] = t3;
|
|
315
|
-
} else {
|
|
316
|
-
t3 = $[6];
|
|
317
|
-
}
|
|
318
|
-
return t3;
|
|
319
|
-
}
|
|
320
300
|
export function CommitRenderer(t0) {
|
|
321
301
|
const $ = _c(7);
|
|
322
302
|
const {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UiProps } from '@adecore/intelligent-ui';
|
|
2
|
+
import type { UiRendererProps } from '../render-context.js';
|
|
3
|
+
export declare function MeterRenderer({ node, children }: UiRendererProps<UiProps<'Meter'>>): import("react").JSX.Element;
|
|
4
|
+
export declare function PartsRenderer({ node }: UiRendererProps<UiProps<'Parts'>>): import("react").JSX.Element;
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { Icon, Meter, SegmentBar } from '@adecore/ui';
|
|
3
|
+
import { formatPercent, formatRounded } from '@adecore/ui/format';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { uiChildrenOf, uiNodeLabel, uiWithUnit } from '../node-text.js';
|
|
7
|
+
import { UI_TONE_COLOR, UI_TONE_ICONS, UI_TONE_TEXT } from '../tones.js';
|
|
8
|
+
/*
|
|
9
|
+
* A value against its limit, unlike Progress no word on work that runs. The tone colors the reading and
|
|
10
|
+
* gives it the tone's icon; the bar stays the accent. Without a max the value stands alone, as a
|
|
11
|
+
* percentage would.
|
|
12
|
+
*/
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
export function MeterRenderer(t0) {
|
|
15
|
+
const $ = _c(55);
|
|
16
|
+
const {
|
|
17
|
+
node,
|
|
18
|
+
children
|
|
19
|
+
} = t0;
|
|
20
|
+
const {
|
|
21
|
+
t
|
|
22
|
+
} = useTranslation("agent-chat");
|
|
23
|
+
const {
|
|
24
|
+
value,
|
|
25
|
+
max,
|
|
26
|
+
mark,
|
|
27
|
+
unit,
|
|
28
|
+
tone,
|
|
29
|
+
detail
|
|
30
|
+
} = node.props;
|
|
31
|
+
let label;
|
|
32
|
+
let said;
|
|
33
|
+
let t1;
|
|
34
|
+
let t2;
|
|
35
|
+
let t3;
|
|
36
|
+
let t4;
|
|
37
|
+
let t5;
|
|
38
|
+
let t6;
|
|
39
|
+
let t7;
|
|
40
|
+
let t8;
|
|
41
|
+
if ($[0] !== children || $[1] !== mark || $[2] !== max || $[3] !== node || $[4] !== t || $[5] !== tone || $[6] !== unit || $[7] !== value) {
|
|
42
|
+
const figure = uiWithUnit(formatRounded(value, 2), unit);
|
|
43
|
+
const limit = max === undefined ? null : uiWithUnit(formatRounded(max, 2), unit);
|
|
44
|
+
const toned = tone !== undefined && tone !== "neutral";
|
|
45
|
+
let t9;
|
|
46
|
+
if ($[18] !== node) {
|
|
47
|
+
t9 = uiNodeLabel(node);
|
|
48
|
+
$[18] = node;
|
|
49
|
+
$[19] = t9;
|
|
50
|
+
} else {
|
|
51
|
+
t9 = $[19];
|
|
52
|
+
}
|
|
53
|
+
label = t9;
|
|
54
|
+
said = [limit === null ? figure : t("blocks.meter.reading", {
|
|
55
|
+
value: figure,
|
|
56
|
+
max: limit
|
|
57
|
+
}), mark === undefined ? "" : t("blocks.meter.mark", {
|
|
58
|
+
mark: uiWithUnit(formatRounded(mark, 2), unit)
|
|
59
|
+
}), toned ? t(`blocks.event.tone.${tone}`) : ""].filter(_temp).join(", ");
|
|
60
|
+
t8 = "chat-ui-flat flex flex-col gap-2 rounded-xl bg-ui-tile p-3";
|
|
61
|
+
t6 = "flex items-baseline justify-between gap-3 text-xs";
|
|
62
|
+
if ($[20] !== children) {
|
|
63
|
+
t7 = /*#__PURE__*/_jsx("span", {
|
|
64
|
+
className: "min-w-0 text-text-muted",
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
$[20] = children;
|
|
68
|
+
$[21] = t7;
|
|
69
|
+
} else {
|
|
70
|
+
t7 = $[21];
|
|
71
|
+
}
|
|
72
|
+
t1 = true;
|
|
73
|
+
t2 = "flex shrink-0 items-baseline gap-1 tabular-nums";
|
|
74
|
+
if ($[22] !== tone || $[23] !== toned) {
|
|
75
|
+
t3 = toned && /*#__PURE__*/_jsx(Icon, {
|
|
76
|
+
icon: UI_TONE_ICONS[tone],
|
|
77
|
+
size: 12,
|
|
78
|
+
className: clsx("self-center", UI_TONE_TEXT[tone])
|
|
79
|
+
});
|
|
80
|
+
$[22] = tone;
|
|
81
|
+
$[23] = toned;
|
|
82
|
+
$[24] = t3;
|
|
83
|
+
} else {
|
|
84
|
+
t3 = $[24];
|
|
85
|
+
}
|
|
86
|
+
const t10 = toned ? UI_TONE_TEXT[tone] : "text-text";
|
|
87
|
+
let t11;
|
|
88
|
+
if ($[25] !== t10) {
|
|
89
|
+
t11 = clsx("font-semibold", t10);
|
|
90
|
+
$[25] = t10;
|
|
91
|
+
$[26] = t11;
|
|
92
|
+
} else {
|
|
93
|
+
t11 = $[26];
|
|
94
|
+
}
|
|
95
|
+
t4 = /*#__PURE__*/_jsx("span", {
|
|
96
|
+
className: t11,
|
|
97
|
+
children: figure
|
|
98
|
+
});
|
|
99
|
+
t5 = limit !== null && /*#__PURE__*/_jsx("span", {
|
|
100
|
+
className: "text-text-muted",
|
|
101
|
+
children: t("blocks.meter.of", {
|
|
102
|
+
max: limit
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
$[0] = children;
|
|
106
|
+
$[1] = mark;
|
|
107
|
+
$[2] = max;
|
|
108
|
+
$[3] = node;
|
|
109
|
+
$[4] = t;
|
|
110
|
+
$[5] = tone;
|
|
111
|
+
$[6] = unit;
|
|
112
|
+
$[7] = value;
|
|
113
|
+
$[8] = label;
|
|
114
|
+
$[9] = said;
|
|
115
|
+
$[10] = t1;
|
|
116
|
+
$[11] = t2;
|
|
117
|
+
$[12] = t3;
|
|
118
|
+
$[13] = t4;
|
|
119
|
+
$[14] = t5;
|
|
120
|
+
$[15] = t6;
|
|
121
|
+
$[16] = t7;
|
|
122
|
+
$[17] = t8;
|
|
123
|
+
} else {
|
|
124
|
+
label = $[8];
|
|
125
|
+
said = $[9];
|
|
126
|
+
t1 = $[10];
|
|
127
|
+
t2 = $[11];
|
|
128
|
+
t3 = $[12];
|
|
129
|
+
t4 = $[13];
|
|
130
|
+
t5 = $[14];
|
|
131
|
+
t6 = $[15];
|
|
132
|
+
t7 = $[16];
|
|
133
|
+
t8 = $[17];
|
|
134
|
+
}
|
|
135
|
+
let t9;
|
|
136
|
+
if ($[27] !== t1 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
|
|
137
|
+
t9 = /*#__PURE__*/_jsxs("span", {
|
|
138
|
+
"aria-hidden": t1,
|
|
139
|
+
className: t2,
|
|
140
|
+
children: [t3, t4, t5]
|
|
141
|
+
});
|
|
142
|
+
$[27] = t1;
|
|
143
|
+
$[28] = t2;
|
|
144
|
+
$[29] = t3;
|
|
145
|
+
$[30] = t4;
|
|
146
|
+
$[31] = t5;
|
|
147
|
+
$[32] = t9;
|
|
148
|
+
} else {
|
|
149
|
+
t9 = $[32];
|
|
150
|
+
}
|
|
151
|
+
let t10;
|
|
152
|
+
if ($[33] !== t6 || $[34] !== t7 || $[35] !== t9) {
|
|
153
|
+
t10 = /*#__PURE__*/_jsxs("div", {
|
|
154
|
+
className: t6,
|
|
155
|
+
children: [t7, t9]
|
|
156
|
+
});
|
|
157
|
+
$[33] = t6;
|
|
158
|
+
$[34] = t7;
|
|
159
|
+
$[35] = t9;
|
|
160
|
+
$[36] = t10;
|
|
161
|
+
} else {
|
|
162
|
+
t10 = $[36];
|
|
163
|
+
}
|
|
164
|
+
const t11 = max ?? 100;
|
|
165
|
+
let t12;
|
|
166
|
+
if ($[37] !== mark) {
|
|
167
|
+
t12 = mark === undefined ? undefined : [mark];
|
|
168
|
+
$[37] = mark;
|
|
169
|
+
$[38] = t12;
|
|
170
|
+
} else {
|
|
171
|
+
t12 = $[38];
|
|
172
|
+
}
|
|
173
|
+
let t13;
|
|
174
|
+
if ($[39] !== label || $[40] !== t) {
|
|
175
|
+
t13 = label === "" ? t("blocks.meter.label") : label;
|
|
176
|
+
$[39] = label;
|
|
177
|
+
$[40] = t;
|
|
178
|
+
$[41] = t13;
|
|
179
|
+
} else {
|
|
180
|
+
t13 = $[41];
|
|
181
|
+
}
|
|
182
|
+
let t14;
|
|
183
|
+
if ($[42] !== said || $[43] !== t11 || $[44] !== t12 || $[45] !== t13 || $[46] !== value) {
|
|
184
|
+
t14 = /*#__PURE__*/_jsx(Meter, {
|
|
185
|
+
value: value,
|
|
186
|
+
max: t11,
|
|
187
|
+
marks: t12,
|
|
188
|
+
label: t13,
|
|
189
|
+
valueText: said
|
|
190
|
+
});
|
|
191
|
+
$[42] = said;
|
|
192
|
+
$[43] = t11;
|
|
193
|
+
$[44] = t12;
|
|
194
|
+
$[45] = t13;
|
|
195
|
+
$[46] = value;
|
|
196
|
+
$[47] = t14;
|
|
197
|
+
} else {
|
|
198
|
+
t14 = $[47];
|
|
199
|
+
}
|
|
200
|
+
let t15;
|
|
201
|
+
if ($[48] !== detail) {
|
|
202
|
+
t15 = detail !== undefined && detail !== "" && /*#__PURE__*/_jsx("p", {
|
|
203
|
+
className: "text-2xs wrap-anywhere text-text-muted",
|
|
204
|
+
children: detail
|
|
205
|
+
});
|
|
206
|
+
$[48] = detail;
|
|
207
|
+
$[49] = t15;
|
|
208
|
+
} else {
|
|
209
|
+
t15 = $[49];
|
|
210
|
+
}
|
|
211
|
+
let t16;
|
|
212
|
+
if ($[50] !== t10 || $[51] !== t14 || $[52] !== t15 || $[53] !== t8) {
|
|
213
|
+
t16 = /*#__PURE__*/_jsxs("div", {
|
|
214
|
+
className: t8,
|
|
215
|
+
children: [t10, t14, t15]
|
|
216
|
+
});
|
|
217
|
+
$[50] = t10;
|
|
218
|
+
$[51] = t14;
|
|
219
|
+
$[52] = t15;
|
|
220
|
+
$[53] = t8;
|
|
221
|
+
$[54] = t16;
|
|
222
|
+
} else {
|
|
223
|
+
t16 = $[54];
|
|
224
|
+
}
|
|
225
|
+
return t16;
|
|
226
|
+
}
|
|
227
|
+
/* The most parts one bar holds, which is as many colors as the chart palette has. */
|
|
228
|
+
function _temp(part) {
|
|
229
|
+
return part !== "";
|
|
230
|
+
}
|
|
231
|
+
const PARTS = 6;
|
|
232
|
+
/*
|
|
233
|
+
* One bar divided by the values of its parts, and under it what each part is and its share. A part
|
|
234
|
+
* wears the next color of the chart palette, or its tone. The bar is the list a screen reader hears,
|
|
235
|
+
* with every value in it; the legend repeats it for the eye.
|
|
236
|
+
*/
|
|
237
|
+
export function PartsRenderer(t0) {
|
|
238
|
+
const $ = _c(20);
|
|
239
|
+
const {
|
|
240
|
+
node
|
|
241
|
+
} = t0;
|
|
242
|
+
const {
|
|
243
|
+
t
|
|
244
|
+
} = useTranslation("agent-chat");
|
|
245
|
+
const {
|
|
246
|
+
unit
|
|
247
|
+
} = node.props;
|
|
248
|
+
let t1;
|
|
249
|
+
let t2;
|
|
250
|
+
let t3;
|
|
251
|
+
let t4;
|
|
252
|
+
let t5;
|
|
253
|
+
if ($[0] !== node || $[1] !== t || $[2] !== unit) {
|
|
254
|
+
const children = uiChildrenOf(node, "Part").slice(0, PARTS);
|
|
255
|
+
const total = children.reduce(_temp2, 0);
|
|
256
|
+
let t6;
|
|
257
|
+
if ($[8] !== t || $[9] !== total || $[10] !== unit) {
|
|
258
|
+
t6 = (part_0, index) => {
|
|
259
|
+
const {
|
|
260
|
+
value,
|
|
261
|
+
tone
|
|
262
|
+
} = part_0.props;
|
|
263
|
+
const share = formatPercent(total > 0 ? value / total * 100 : 0);
|
|
264
|
+
const name = uiNodeLabel(part_0);
|
|
265
|
+
return {
|
|
266
|
+
id: part_0.id,
|
|
267
|
+
name,
|
|
268
|
+
share,
|
|
269
|
+
value,
|
|
270
|
+
color: tone === undefined ? `var(--chart-${index + 1})` : UI_TONE_COLOR[tone],
|
|
271
|
+
said: t("blocks.parts.part", {
|
|
272
|
+
label: name,
|
|
273
|
+
value: uiWithUnit(formatRounded(value, 2), unit),
|
|
274
|
+
share
|
|
275
|
+
})
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
$[8] = t;
|
|
279
|
+
$[9] = total;
|
|
280
|
+
$[10] = unit;
|
|
281
|
+
$[11] = t6;
|
|
282
|
+
} else {
|
|
283
|
+
t6 = $[11];
|
|
284
|
+
}
|
|
285
|
+
const parts = children.map(t6);
|
|
286
|
+
t4 = "chat-ui-flat flex flex-col gap-2.5 rounded-xl bg-ui-tile p-3";
|
|
287
|
+
t5 = total > 0 ? /*#__PURE__*/_jsx(SegmentBar, {
|
|
288
|
+
size: "sm",
|
|
289
|
+
label: t("blocks.parts.label"),
|
|
290
|
+
parts: parts.filter(_temp3).map(_temp4)
|
|
291
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
292
|
+
"aria-hidden": true,
|
|
293
|
+
className: "h-1.5 rounded-full bg-track"
|
|
294
|
+
});
|
|
295
|
+
t1 = total > 0 || undefined;
|
|
296
|
+
t2 = "flex flex-wrap gap-x-4 gap-y-1 text-2xs";
|
|
297
|
+
t3 = parts.map(_temp5);
|
|
298
|
+
$[0] = node;
|
|
299
|
+
$[1] = t;
|
|
300
|
+
$[2] = unit;
|
|
301
|
+
$[3] = t1;
|
|
302
|
+
$[4] = t2;
|
|
303
|
+
$[5] = t3;
|
|
304
|
+
$[6] = t4;
|
|
305
|
+
$[7] = t5;
|
|
306
|
+
} else {
|
|
307
|
+
t1 = $[3];
|
|
308
|
+
t2 = $[4];
|
|
309
|
+
t3 = $[5];
|
|
310
|
+
t4 = $[6];
|
|
311
|
+
t5 = $[7];
|
|
312
|
+
}
|
|
313
|
+
let t6;
|
|
314
|
+
if ($[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
|
|
315
|
+
t6 = /*#__PURE__*/_jsx("ul", {
|
|
316
|
+
"aria-hidden": t1,
|
|
317
|
+
className: t2,
|
|
318
|
+
children: t3
|
|
319
|
+
});
|
|
320
|
+
$[12] = t1;
|
|
321
|
+
$[13] = t2;
|
|
322
|
+
$[14] = t3;
|
|
323
|
+
$[15] = t6;
|
|
324
|
+
} else {
|
|
325
|
+
t6 = $[15];
|
|
326
|
+
}
|
|
327
|
+
let t7;
|
|
328
|
+
if ($[16] !== t4 || $[17] !== t5 || $[18] !== t6) {
|
|
329
|
+
t7 = /*#__PURE__*/_jsxs("div", {
|
|
330
|
+
className: t4,
|
|
331
|
+
children: [t5, t6]
|
|
332
|
+
});
|
|
333
|
+
$[16] = t4;
|
|
334
|
+
$[17] = t5;
|
|
335
|
+
$[18] = t6;
|
|
336
|
+
$[19] = t7;
|
|
337
|
+
} else {
|
|
338
|
+
t7 = $[19];
|
|
339
|
+
}
|
|
340
|
+
return t7;
|
|
341
|
+
}
|
|
342
|
+
function _temp5(part_3) {
|
|
343
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
344
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
345
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
346
|
+
className: "size-2 shrink-0 rounded-xs",
|
|
347
|
+
style: {
|
|
348
|
+
backgroundColor: part_3.color
|
|
349
|
+
}
|
|
350
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
351
|
+
className: "min-w-0 truncate text-text-muted",
|
|
352
|
+
children: part_3.name
|
|
353
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
354
|
+
className: "shrink-0 font-semibold text-text tabular-nums",
|
|
355
|
+
children: part_3.share
|
|
356
|
+
})]
|
|
357
|
+
}, part_3.id);
|
|
358
|
+
}
|
|
359
|
+
function _temp4(part_2) {
|
|
360
|
+
return {
|
|
361
|
+
value: part_2.value,
|
|
362
|
+
label: part_2.said,
|
|
363
|
+
color: part_2.color
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function _temp3(part_1) {
|
|
367
|
+
return part_1.value > 0;
|
|
368
|
+
}
|
|
369
|
+
function _temp2(sum, part) {
|
|
370
|
+
return sum + part.props.value;
|
|
371
|
+
}
|