@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,123 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { uiNodeText } from '../node-text.js';
|
|
5
|
+
import { UI_TONE_FILL } from '../tones.js';
|
|
6
|
+
/*
|
|
7
|
+
* Words from somewhere else, read as written: a line of a log keeps its stars and underscores, and with
|
|
8
|
+
* `mono` its line breaks too. The bar at the start edge wears the tone, which a screen reader hears as a word.
|
|
9
|
+
*/
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export function QuoteRenderer(t0) {
|
|
12
|
+
const $ = _c(23);
|
|
13
|
+
const {
|
|
14
|
+
node
|
|
15
|
+
} = t0;
|
|
16
|
+
const {
|
|
17
|
+
t
|
|
18
|
+
} = useTranslation("agent-chat");
|
|
19
|
+
const {
|
|
20
|
+
tone,
|
|
21
|
+
source,
|
|
22
|
+
mono
|
|
23
|
+
} = node.props;
|
|
24
|
+
const shown = tone ?? "neutral";
|
|
25
|
+
const t1 = UI_TONE_FILL[shown];
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[0] !== t1) {
|
|
28
|
+
t2 = clsx("w-0.75 shrink-0 rounded-full", t1);
|
|
29
|
+
$[0] = t1;
|
|
30
|
+
$[1] = t2;
|
|
31
|
+
} else {
|
|
32
|
+
t2 = $[1];
|
|
33
|
+
}
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[2] !== t2) {
|
|
36
|
+
t3 = /*#__PURE__*/_jsx("span", {
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
className: t2
|
|
39
|
+
});
|
|
40
|
+
$[2] = t2;
|
|
41
|
+
$[3] = t3;
|
|
42
|
+
} else {
|
|
43
|
+
t3 = $[3];
|
|
44
|
+
}
|
|
45
|
+
let t4;
|
|
46
|
+
if ($[4] !== shown || $[5] !== t) {
|
|
47
|
+
t4 = shown !== "neutral" && /*#__PURE__*/_jsx("span", {
|
|
48
|
+
className: "sr-only",
|
|
49
|
+
children: t(`blocks.event.tone.${shown}`)
|
|
50
|
+
});
|
|
51
|
+
$[4] = shown;
|
|
52
|
+
$[5] = t;
|
|
53
|
+
$[6] = t4;
|
|
54
|
+
} else {
|
|
55
|
+
t4 = $[6];
|
|
56
|
+
}
|
|
57
|
+
const t5 = mono === true ? "font-mono text-code whitespace-pre-wrap" : "text-xs";
|
|
58
|
+
let t6;
|
|
59
|
+
if ($[7] !== t5) {
|
|
60
|
+
t6 = clsx("wrap-anywhere text-text", t5);
|
|
61
|
+
$[7] = t5;
|
|
62
|
+
$[8] = t6;
|
|
63
|
+
} else {
|
|
64
|
+
t6 = $[8];
|
|
65
|
+
}
|
|
66
|
+
let t7;
|
|
67
|
+
if ($[9] !== node) {
|
|
68
|
+
t7 = uiNodeText(node).trim();
|
|
69
|
+
$[9] = node;
|
|
70
|
+
$[10] = t7;
|
|
71
|
+
} else {
|
|
72
|
+
t7 = $[10];
|
|
73
|
+
}
|
|
74
|
+
let t8;
|
|
75
|
+
if ($[11] !== t6 || $[12] !== t7) {
|
|
76
|
+
t8 = /*#__PURE__*/_jsx("blockquote", {
|
|
77
|
+
className: t6,
|
|
78
|
+
children: t7
|
|
79
|
+
});
|
|
80
|
+
$[11] = t6;
|
|
81
|
+
$[12] = t7;
|
|
82
|
+
$[13] = t8;
|
|
83
|
+
} else {
|
|
84
|
+
t8 = $[13];
|
|
85
|
+
}
|
|
86
|
+
let t9;
|
|
87
|
+
if ($[14] !== source) {
|
|
88
|
+
t9 = source !== undefined && source !== "" && /*#__PURE__*/_jsx("figcaption", {
|
|
89
|
+
className: "text-2xs wrap-anywhere text-text-muted",
|
|
90
|
+
children: source
|
|
91
|
+
});
|
|
92
|
+
$[14] = source;
|
|
93
|
+
$[15] = t9;
|
|
94
|
+
} else {
|
|
95
|
+
t9 = $[15];
|
|
96
|
+
}
|
|
97
|
+
let t10;
|
|
98
|
+
if ($[16] !== t4 || $[17] !== t8 || $[18] !== t9) {
|
|
99
|
+
t10 = /*#__PURE__*/_jsxs("div", {
|
|
100
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
101
|
+
children: [t4, t8, t9]
|
|
102
|
+
});
|
|
103
|
+
$[16] = t4;
|
|
104
|
+
$[17] = t8;
|
|
105
|
+
$[18] = t9;
|
|
106
|
+
$[19] = t10;
|
|
107
|
+
} else {
|
|
108
|
+
t10 = $[19];
|
|
109
|
+
}
|
|
110
|
+
let t11;
|
|
111
|
+
if ($[20] !== t10 || $[21] !== t3) {
|
|
112
|
+
t11 = /*#__PURE__*/_jsxs("figure", {
|
|
113
|
+
className: "flex gap-3 rounded-xl bg-ui-tile px-3 py-2.5",
|
|
114
|
+
children: [t3, t10]
|
|
115
|
+
});
|
|
116
|
+
$[20] = t10;
|
|
117
|
+
$[21] = t3;
|
|
118
|
+
$[22] = t11;
|
|
119
|
+
} else {
|
|
120
|
+
t11 = $[22];
|
|
121
|
+
}
|
|
122
|
+
return t11;
|
|
123
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useId, useRef } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { uiChildrenOf, uiNodeLabel } from '../node-text.js';
|
|
6
|
+
import { bindingOf, PENDING } from './binding.js';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const NEXT_KEYS = new Set(['ArrowDown', 'ArrowRight']);
|
|
9
|
+
const PREVIOUS_KEYS = new Set(['ArrowUp', 'ArrowLeft']);
|
|
10
|
+
/*
|
|
11
|
+
* One value out of a list whose options each take a line of explanation. Like Segmented, an Option is a
|
|
12
|
+
* radio by its place, since a value may be any scalar. The group is one tab stop, and an arrow key moves
|
|
13
|
+
* the focus and the choice together, as a radio group does.
|
|
14
|
+
*/
|
|
15
|
+
export function RadioRenderer(t0) {
|
|
16
|
+
const $ = _c(33);
|
|
17
|
+
const {
|
|
18
|
+
node,
|
|
19
|
+
context
|
|
20
|
+
} = t0;
|
|
21
|
+
const {
|
|
22
|
+
t
|
|
23
|
+
} = useTranslation("agent-chat");
|
|
24
|
+
const id = useId();
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
27
|
+
t1 = [];
|
|
28
|
+
$[0] = t1;
|
|
29
|
+
} else {
|
|
30
|
+
t1 = $[0];
|
|
31
|
+
}
|
|
32
|
+
const radios = useRef(t1);
|
|
33
|
+
let t2;
|
|
34
|
+
let t3;
|
|
35
|
+
let t4;
|
|
36
|
+
let t5;
|
|
37
|
+
let t6;
|
|
38
|
+
let t7;
|
|
39
|
+
let t8;
|
|
40
|
+
let t9;
|
|
41
|
+
if ($[1] !== context || $[2] !== id || $[3] !== node || $[4] !== t) {
|
|
42
|
+
const binding = bindingOf(node, context);
|
|
43
|
+
const current = binding?.value ?? node.props.value;
|
|
44
|
+
const {
|
|
45
|
+
label
|
|
46
|
+
} = node.props;
|
|
47
|
+
const named = label !== undefined && label !== "";
|
|
48
|
+
const options = uiChildrenOf(node, "Option").map(_temp);
|
|
49
|
+
const picked = options.findIndex(option_0 => option_0.value === current);
|
|
50
|
+
const enabled = binding !== null;
|
|
51
|
+
const pick = index => {
|
|
52
|
+
const option_1 = options[index];
|
|
53
|
+
if (option_1 !== undefined && enabled) {
|
|
54
|
+
binding.onValueChange(option_1.value);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const onKeyDown = (event, index_0) => {
|
|
58
|
+
if (!enabled) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (event.key === " " || event.key === "Enter") {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
pick(index_0);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const step = NEXT_KEYS.has(event.key) ? 1 : PREVIOUS_KEYS.has(event.key) ? -1 : 0;
|
|
67
|
+
if (step === 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
const next = (index_0 + step + options.length) % options.length;
|
|
72
|
+
pick(next);
|
|
73
|
+
radios.current[next]?.focus();
|
|
74
|
+
};
|
|
75
|
+
const t10 = !node.complete && PENDING;
|
|
76
|
+
if ($[13] !== t10) {
|
|
77
|
+
t8 = clsx("flex flex-col gap-1.5", t10);
|
|
78
|
+
$[13] = t10;
|
|
79
|
+
$[14] = t8;
|
|
80
|
+
} else {
|
|
81
|
+
t8 = $[14];
|
|
82
|
+
}
|
|
83
|
+
if ($[15] !== id || $[16] !== label || $[17] !== named) {
|
|
84
|
+
t9 = named && /*#__PURE__*/_jsx("span", {
|
|
85
|
+
id: `${id}-label`,
|
|
86
|
+
className: "px-0.5 text-2xs text-text-muted",
|
|
87
|
+
children: label
|
|
88
|
+
});
|
|
89
|
+
$[15] = id;
|
|
90
|
+
$[16] = label;
|
|
91
|
+
$[17] = named;
|
|
92
|
+
$[18] = t9;
|
|
93
|
+
} else {
|
|
94
|
+
t9 = $[18];
|
|
95
|
+
}
|
|
96
|
+
t2 = "radiogroup";
|
|
97
|
+
t3 = named ? `${id}-label` : undefined;
|
|
98
|
+
if ($[19] !== named || $[20] !== t) {
|
|
99
|
+
t4 = named ? undefined : t("blocks.options");
|
|
100
|
+
$[19] = named;
|
|
101
|
+
$[20] = t;
|
|
102
|
+
$[21] = t4;
|
|
103
|
+
} else {
|
|
104
|
+
t4 = $[21];
|
|
105
|
+
}
|
|
106
|
+
t5 = enabled ? undefined : true;
|
|
107
|
+
t6 = "flex flex-col gap-1.5";
|
|
108
|
+
t7 = options.map((option_2, index_1) => {
|
|
109
|
+
const checked = index_1 === picked;
|
|
110
|
+
const described = option_2.detail !== undefined && option_2.detail !== "";
|
|
111
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
112
|
+
ref: element => {
|
|
113
|
+
radios.current[index_1] = element;
|
|
114
|
+
},
|
|
115
|
+
role: "radio",
|
|
116
|
+
"aria-checked": checked,
|
|
117
|
+
"aria-disabled": enabled ? undefined : true,
|
|
118
|
+
"aria-labelledby": `${id}-${index_1}-label`,
|
|
119
|
+
"aria-describedby": described ? `${id}-${index_1}-detail` : undefined,
|
|
120
|
+
tabIndex: checked || picked === -1 && index_1 === 0 ? 0 : -1,
|
|
121
|
+
className: clsx("focus-ring flex min-h-10 items-start gap-3 rounded-xl bg-ui-tile px-3 py-2.5 text-xs text-text", checked && "ring-2 ring-accent ring-inset", enabled && "cursor-pointer hover:bg-surface-active"),
|
|
122
|
+
onClick: () => pick(index_1),
|
|
123
|
+
onKeyDown: event_0 => onKeyDown(event_0, index_1),
|
|
124
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
125
|
+
"aria-hidden": true,
|
|
126
|
+
className: clsx("mt-0.5 size-4 shrink-0 rounded-full", checked ? "border-5 border-accent bg-accent-text" : "border border-border-strong bg-ui-inset")
|
|
127
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
128
|
+
className: "flex min-w-0 grow flex-col gap-0.5",
|
|
129
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
130
|
+
id: `${id}-${index_1}-label`,
|
|
131
|
+
className: "font-medium wrap-break-word",
|
|
132
|
+
children: option_2.label
|
|
133
|
+
}), described && /*#__PURE__*/_jsx("span", {
|
|
134
|
+
id: `${id}-${index_1}-detail`,
|
|
135
|
+
className: "text-2xs wrap-break-word text-text-muted",
|
|
136
|
+
children: option_2.detail
|
|
137
|
+
})]
|
|
138
|
+
})]
|
|
139
|
+
}, option_2.id);
|
|
140
|
+
});
|
|
141
|
+
$[1] = context;
|
|
142
|
+
$[2] = id;
|
|
143
|
+
$[3] = node;
|
|
144
|
+
$[4] = t;
|
|
145
|
+
$[5] = t2;
|
|
146
|
+
$[6] = t3;
|
|
147
|
+
$[7] = t4;
|
|
148
|
+
$[8] = t5;
|
|
149
|
+
$[9] = t6;
|
|
150
|
+
$[10] = t7;
|
|
151
|
+
$[11] = t8;
|
|
152
|
+
$[12] = t9;
|
|
153
|
+
} else {
|
|
154
|
+
t2 = $[5];
|
|
155
|
+
t3 = $[6];
|
|
156
|
+
t4 = $[7];
|
|
157
|
+
t5 = $[8];
|
|
158
|
+
t6 = $[9];
|
|
159
|
+
t7 = $[10];
|
|
160
|
+
t8 = $[11];
|
|
161
|
+
t9 = $[12];
|
|
162
|
+
}
|
|
163
|
+
let t10;
|
|
164
|
+
if ($[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 || $[26] !== t6 || $[27] !== t7) {
|
|
165
|
+
t10 = /*#__PURE__*/_jsx("div", {
|
|
166
|
+
role: t2,
|
|
167
|
+
"aria-labelledby": t3,
|
|
168
|
+
"aria-label": t4,
|
|
169
|
+
"aria-disabled": t5,
|
|
170
|
+
className: t6,
|
|
171
|
+
children: t7
|
|
172
|
+
});
|
|
173
|
+
$[22] = t2;
|
|
174
|
+
$[23] = t3;
|
|
175
|
+
$[24] = t4;
|
|
176
|
+
$[25] = t5;
|
|
177
|
+
$[26] = t6;
|
|
178
|
+
$[27] = t7;
|
|
179
|
+
$[28] = t10;
|
|
180
|
+
} else {
|
|
181
|
+
t10 = $[28];
|
|
182
|
+
}
|
|
183
|
+
let t11;
|
|
184
|
+
if ($[29] !== t10 || $[30] !== t8 || $[31] !== t9) {
|
|
185
|
+
t11 = /*#__PURE__*/_jsxs("div", {
|
|
186
|
+
className: t8,
|
|
187
|
+
children: [t9, t10]
|
|
188
|
+
});
|
|
189
|
+
$[29] = t10;
|
|
190
|
+
$[30] = t8;
|
|
191
|
+
$[31] = t9;
|
|
192
|
+
$[32] = t11;
|
|
193
|
+
} else {
|
|
194
|
+
t11 = $[32];
|
|
195
|
+
}
|
|
196
|
+
return t11;
|
|
197
|
+
}
|
|
198
|
+
function _temp(option) {
|
|
199
|
+
return {
|
|
200
|
+
id: option.id,
|
|
201
|
+
label: uiNodeLabel(option),
|
|
202
|
+
detail: option.props.detail,
|
|
203
|
+
value: option.props.value
|
|
204
|
+
};
|
|
205
|
+
}
|
|
@@ -4,3 +4,5 @@ export declare function TabsRenderer({ node, children, context }: UiRendererProp
|
|
|
4
4
|
export declare function TabRenderer({ node, children }: UiRendererProps<UiProps<'Tab'>>): import("react").JSX.Element;
|
|
5
5
|
export declare function SectionsRenderer({ node, children, context }: UiRendererProps<UiProps<'Sections'>>): import("react").JSX.Element;
|
|
6
6
|
export declare function SectionRenderer({ node, children, context }: UiRendererProps<UiProps<'Section'>>): import("react").JSX.Element;
|
|
7
|
+
export declare function ColumnsRenderer({ node, children }: UiRendererProps<UiProps<'Columns'>>): import("react").JSX.Element;
|
|
8
|
+
export declare function PaneRenderer({ node, children }: UiRendererProps<UiProps<'Pane'>>): import("react").JSX.Element;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { Icon, Tabs } from '@adecore/ui';
|
|
2
|
+
import { Icon, Pill, Tabs } from '@adecore/ui';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { ChevronRight } from 'lucide-react';
|
|
5
|
-
import { createContext, useContext, useId } from 'react';
|
|
5
|
+
import { createContext, useContext, useId, useState } from 'react';
|
|
6
6
|
import { useBlockLocal } from '../block-local.js';
|
|
7
7
|
import { uiChildrenOf } from '../node-text.js';
|
|
8
|
+
import { UI_TONE_PILL } from '../tones.js';
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
const SectionsContext = createContext({
|
|
10
11
|
touched: false,
|
|
11
12
|
touch: () => undefined
|
|
12
13
|
});
|
|
13
|
-
/* A tab that arrives while the block streams is not picked: the one that was open stays open. */
|
|
14
|
+
/* A tab that arrives while the block streams is not picked: the one that was open stays open. A badge is a small count or label beside the title. */
|
|
14
15
|
export function TabsRenderer(t0) {
|
|
15
16
|
const $ = _c(11);
|
|
16
17
|
const {
|
|
@@ -70,10 +71,14 @@ export function TabsRenderer(t0) {
|
|
|
70
71
|
return t10;
|
|
71
72
|
}
|
|
72
73
|
function _temp2(tab_0) {
|
|
73
|
-
return /*#__PURE__*/
|
|
74
|
+
return /*#__PURE__*/_jsxs(Tabs.Tab, {
|
|
74
75
|
value: tab_0.id,
|
|
75
76
|
"data-ui-reveal": tab_0.id,
|
|
76
|
-
children: tab_0.props.title
|
|
77
|
+
children: [tab_0.props.title, tab_0.props.badge !== undefined && tab_0.props.badge !== "" && /*#__PURE__*/_jsx(Pill, {
|
|
78
|
+
size: "sm",
|
|
79
|
+
className: "tabular-nums",
|
|
80
|
+
children: tab_0.props.badge
|
|
81
|
+
})]
|
|
77
82
|
}, tab_0.id);
|
|
78
83
|
}
|
|
79
84
|
function _temp() {
|
|
@@ -153,18 +158,27 @@ export function SectionsRenderer(t0) {
|
|
|
153
158
|
}
|
|
154
159
|
return t4;
|
|
155
160
|
}
|
|
156
|
-
/*
|
|
161
|
+
/*
|
|
162
|
+
* Arrives as `open` says. Without it a section arrives open until the person folds one of the set themselves.
|
|
163
|
+
* The prop is read on every draw, since a section stands before its tag has streamed in whole; only what the
|
|
164
|
+
* person chose is kept. The badge is a tag at the end of the header, in the section's tone.
|
|
165
|
+
*/
|
|
157
166
|
function _temp3() {
|
|
158
167
|
return false;
|
|
159
168
|
}
|
|
160
169
|
export function SectionRenderer(t0) {
|
|
161
|
-
const $ = _c(
|
|
170
|
+
const $ = _c(30);
|
|
162
171
|
const {
|
|
163
172
|
node,
|
|
164
173
|
children,
|
|
165
174
|
context
|
|
166
175
|
} = t0;
|
|
167
176
|
const fold = useContext(SectionsContext);
|
|
177
|
+
const {
|
|
178
|
+
title,
|
|
179
|
+
badge,
|
|
180
|
+
tone
|
|
181
|
+
} = node.props;
|
|
168
182
|
let t1;
|
|
169
183
|
if ($[0] !== fold.touched) {
|
|
170
184
|
t1 = () => !fold.touched;
|
|
@@ -173,18 +187,20 @@ export function SectionRenderer(t0) {
|
|
|
173
187
|
} else {
|
|
174
188
|
t1 = $[1];
|
|
175
189
|
}
|
|
176
|
-
const [
|
|
190
|
+
const [arrivedOpen] = useState(t1);
|
|
191
|
+
const [chosen, setChosen] = useBlockLocal(context, node.id, _temp4);
|
|
192
|
+
const open = chosen ?? node.props.open ?? arrivedOpen;
|
|
177
193
|
const contentId = useId();
|
|
178
194
|
const t2 = node.id;
|
|
179
195
|
let t3;
|
|
180
|
-
if ($[2] !== fold || $[3] !== open || $[4] !==
|
|
196
|
+
if ($[2] !== fold || $[3] !== open || $[4] !== setChosen) {
|
|
181
197
|
t3 = () => {
|
|
182
198
|
fold.touch();
|
|
183
|
-
|
|
199
|
+
setChosen(!open);
|
|
184
200
|
};
|
|
185
201
|
$[2] = fold;
|
|
186
202
|
$[3] = open;
|
|
187
|
-
$[4] =
|
|
203
|
+
$[4] = setChosen;
|
|
188
204
|
$[5] = t3;
|
|
189
205
|
} else {
|
|
190
206
|
t3 = $[5];
|
|
@@ -211,64 +227,159 @@ export function SectionRenderer(t0) {
|
|
|
211
227
|
t6 = $[9];
|
|
212
228
|
}
|
|
213
229
|
let t7;
|
|
214
|
-
if ($[10] !==
|
|
230
|
+
if ($[10] !== title) {
|
|
215
231
|
t7 = /*#__PURE__*/_jsx("span", {
|
|
216
|
-
className: "min-w-0 truncate",
|
|
217
|
-
children:
|
|
232
|
+
className: "min-w-0 grow truncate",
|
|
233
|
+
children: title
|
|
218
234
|
});
|
|
219
|
-
$[10] =
|
|
235
|
+
$[10] = title;
|
|
220
236
|
$[11] = t7;
|
|
221
237
|
} else {
|
|
222
238
|
t7 = $[11];
|
|
223
239
|
}
|
|
224
240
|
let t8;
|
|
225
|
-
if ($[12] !==
|
|
226
|
-
t8 = /*#__PURE__*/
|
|
241
|
+
if ($[12] !== badge || $[13] !== tone) {
|
|
242
|
+
t8 = badge !== undefined && badge !== "" && /*#__PURE__*/_jsx(Pill, {
|
|
243
|
+
shape: "tag",
|
|
244
|
+
size: "sm",
|
|
245
|
+
tone: tone === undefined ? "muted" : UI_TONE_PILL[tone],
|
|
246
|
+
children: badge
|
|
247
|
+
});
|
|
248
|
+
$[12] = badge;
|
|
249
|
+
$[13] = tone;
|
|
250
|
+
$[14] = t8;
|
|
251
|
+
} else {
|
|
252
|
+
t8 = $[14];
|
|
253
|
+
}
|
|
254
|
+
let t9;
|
|
255
|
+
if ($[15] !== contentId || $[16] !== node.id || $[17] !== open || $[18] !== t3 || $[19] !== t6 || $[20] !== t7 || $[21] !== t8) {
|
|
256
|
+
t9 = /*#__PURE__*/_jsxs("button", {
|
|
227
257
|
type: "button",
|
|
228
258
|
"data-ui-reveal": t2,
|
|
229
259
|
"aria-expanded": open,
|
|
230
260
|
"aria-controls": contentId,
|
|
231
261
|
className: "flex min-h-10 w-full items-center gap-2 rounded-xl px-3 text-left text-xs font-medium text-text hover:bg-text/4",
|
|
232
262
|
onClick: t3,
|
|
233
|
-
children: [t6, t7]
|
|
263
|
+
children: [t6, t7, t8]
|
|
234
264
|
});
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
265
|
+
$[15] = contentId;
|
|
266
|
+
$[16] = node.id;
|
|
267
|
+
$[17] = open;
|
|
268
|
+
$[18] = t3;
|
|
269
|
+
$[19] = t6;
|
|
270
|
+
$[20] = t7;
|
|
271
|
+
$[21] = t8;
|
|
272
|
+
$[22] = t9;
|
|
242
273
|
} else {
|
|
243
|
-
|
|
274
|
+
t9 = $[22];
|
|
244
275
|
}
|
|
245
|
-
const
|
|
246
|
-
let
|
|
247
|
-
if ($[
|
|
248
|
-
|
|
276
|
+
const t10 = !open;
|
|
277
|
+
let t11;
|
|
278
|
+
if ($[23] !== children || $[24] !== contentId || $[25] !== t10) {
|
|
279
|
+
t11 = /*#__PURE__*/_jsx("div", {
|
|
249
280
|
id: contentId,
|
|
250
|
-
hidden:
|
|
281
|
+
hidden: t10,
|
|
251
282
|
className: "chat-ui-section-body chat-ui-nodes flex flex-col gap-3 px-3 pb-3",
|
|
252
283
|
children: children
|
|
253
284
|
});
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
285
|
+
$[23] = children;
|
|
286
|
+
$[24] = contentId;
|
|
287
|
+
$[25] = t10;
|
|
288
|
+
$[26] = t11;
|
|
258
289
|
} else {
|
|
259
|
-
|
|
290
|
+
t11 = $[26];
|
|
260
291
|
}
|
|
261
|
-
let
|
|
262
|
-
if ($[
|
|
263
|
-
|
|
292
|
+
let t12;
|
|
293
|
+
if ($[27] !== t11 || $[28] !== t9) {
|
|
294
|
+
t12 = /*#__PURE__*/_jsxs("section", {
|
|
264
295
|
className: "rounded-xl bg-ui-tile",
|
|
265
|
-
children: [
|
|
296
|
+
children: [t9, t11]
|
|
297
|
+
});
|
|
298
|
+
$[27] = t11;
|
|
299
|
+
$[28] = t9;
|
|
300
|
+
$[29] = t12;
|
|
301
|
+
} else {
|
|
302
|
+
t12 = $[29];
|
|
303
|
+
}
|
|
304
|
+
return t12;
|
|
305
|
+
}
|
|
306
|
+
/* The one component that divides the width: its panes stand side by side and stack in a narrow block. */
|
|
307
|
+
function _temp4() {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
export function ColumnsRenderer(t0) {
|
|
311
|
+
const $ = _c(5);
|
|
312
|
+
const {
|
|
313
|
+
node,
|
|
314
|
+
children
|
|
315
|
+
} = t0;
|
|
316
|
+
const panes = uiChildrenOf(node, "Pane").length;
|
|
317
|
+
const t1 = panes >= 3 ? "@min-[420px]:grid-cols-3" : "@min-[420px]:grid-cols-2";
|
|
318
|
+
let t2;
|
|
319
|
+
if ($[0] !== t1) {
|
|
320
|
+
t2 = clsx("chat-ui-nodes grid gap-3", t1);
|
|
321
|
+
$[0] = t1;
|
|
322
|
+
$[1] = t2;
|
|
323
|
+
} else {
|
|
324
|
+
t2 = $[1];
|
|
325
|
+
}
|
|
326
|
+
let t3;
|
|
327
|
+
if ($[2] !== children || $[3] !== t2) {
|
|
328
|
+
t3 = /*#__PURE__*/_jsx("div", {
|
|
329
|
+
className: "@container",
|
|
330
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
331
|
+
className: t2,
|
|
332
|
+
children: children
|
|
333
|
+
})
|
|
334
|
+
});
|
|
335
|
+
$[2] = children;
|
|
336
|
+
$[3] = t2;
|
|
337
|
+
$[4] = t3;
|
|
338
|
+
} else {
|
|
339
|
+
t3 = $[4];
|
|
340
|
+
}
|
|
341
|
+
return t3;
|
|
342
|
+
}
|
|
343
|
+
/* Stacks its children as a tab panel does, under a small title where it has one. */
|
|
344
|
+
export function PaneRenderer(t0) {
|
|
345
|
+
const $ = _c(8);
|
|
346
|
+
const {
|
|
347
|
+
node,
|
|
348
|
+
children
|
|
349
|
+
} = t0;
|
|
350
|
+
const {
|
|
351
|
+
title
|
|
352
|
+
} = node.props;
|
|
353
|
+
const titleId = useId();
|
|
354
|
+
const named = title !== undefined && title !== "";
|
|
355
|
+
const t1 = named ? titleId : undefined;
|
|
356
|
+
let t2;
|
|
357
|
+
if ($[0] !== named || $[1] !== title || $[2] !== titleId) {
|
|
358
|
+
t2 = named && /*#__PURE__*/_jsx("div", {
|
|
359
|
+
id: titleId,
|
|
360
|
+
className: "px-0.5 text-2xs font-semibold text-text-muted",
|
|
361
|
+
children: title
|
|
362
|
+
});
|
|
363
|
+
$[0] = named;
|
|
364
|
+
$[1] = title;
|
|
365
|
+
$[2] = titleId;
|
|
366
|
+
$[3] = t2;
|
|
367
|
+
} else {
|
|
368
|
+
t2 = $[3];
|
|
369
|
+
}
|
|
370
|
+
let t3;
|
|
371
|
+
if ($[4] !== children || $[5] !== t1 || $[6] !== t2) {
|
|
372
|
+
t3 = /*#__PURE__*/_jsxs("section", {
|
|
373
|
+
"aria-labelledby": t1,
|
|
374
|
+
className: "chat-ui-nodes flex min-w-0 flex-col gap-2",
|
|
375
|
+
children: [t2, children]
|
|
266
376
|
});
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
377
|
+
$[4] = children;
|
|
378
|
+
$[5] = t1;
|
|
379
|
+
$[6] = t2;
|
|
380
|
+
$[7] = t3;
|
|
270
381
|
} else {
|
|
271
|
-
|
|
382
|
+
t3 = $[7];
|
|
272
383
|
}
|
|
273
|
-
return
|
|
384
|
+
return t3;
|
|
274
385
|
}
|