@heroui/agent 0.2.0-beta.1 → 0.2.0-beta.2
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/CHANGELOG.md +10 -0
- package/dist/chart-content-USUK4ZM5.js +2696 -0
- package/dist/chunk-AEUPMIPT.js +577 -0
- package/dist/{chunk-RQCTC4JB.js → chunk-EXFDD3K3.js} +1 -1
- package/dist/{chunk-GDDNN2XY.js → chunk-Y6Y6ILXP.js} +2 -2
- package/dist/{component-renderer-IBJDNXSO.js → component-renderer-EOOT6ONY.js} +739 -414
- package/dist/contracts.d.ts +67 -8
- package/dist/contracts.js +224 -4
- package/dist/css/index.css +1 -1
- package/dist/{embed-runtime-XOPQY7Z5.js → embed-runtime-QOATFAS7.js} +170 -95
- package/dist/{identity-NYCXY1mT.d.ts → identity-hIGFpObN.d.ts} +3 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/next.js +2 -2
- package/dist/server.d.ts +1 -1
- package/dist/server.js +6 -1
- package/package.json +25 -26
- package/dist/chart-content-VZ66GD22.js +0 -1391
- package/dist/chunk-DW4AQRM5.js +0 -297
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveOverlayPortalContainer
|
|
3
|
+
} from "./chunk-TOOT6SZ2.js";
|
|
4
|
+
|
|
5
|
+
// ../agent-ui/src/utils/chart-values.ts
|
|
6
|
+
function resolveGaugeBounds(component) {
|
|
7
|
+
return {
|
|
8
|
+
maximum: component.max ?? (component.format?.style === "percent" ? 1 : 100),
|
|
9
|
+
minimum: component.min ?? 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ../agent-ui/src/types.ts
|
|
14
|
+
function componentActionFromSpec(componentId, action) {
|
|
15
|
+
if (action.toolCall) {
|
|
16
|
+
return {
|
|
17
|
+
actionId: action.id,
|
|
18
|
+
args: action.toolCall.arguments,
|
|
19
|
+
componentId,
|
|
20
|
+
label: action.label,
|
|
21
|
+
prompt: action.prompt,
|
|
22
|
+
toolName: action.toolCall.name,
|
|
23
|
+
type: "tool"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (action.prompt) {
|
|
27
|
+
return { componentId, label: action.label, prompt: action.prompt, type: "followup" };
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
function createComponentSelection(component, datum) {
|
|
32
|
+
return { componentId: component.id, componentTitle: component.title, datum };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ../agent-ui/src/utils/formatters.ts
|
|
36
|
+
var numberFormatters = /* @__PURE__ */ new Map();
|
|
37
|
+
function supportedLocale(locale) {
|
|
38
|
+
try {
|
|
39
|
+
return Intl.NumberFormat.supportedLocalesOf([locale])[0] ?? "en";
|
|
40
|
+
} catch {
|
|
41
|
+
return "en";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function formatNumber(value, format, locale = "en") {
|
|
45
|
+
const resolvedLocale = supportedLocale(locale);
|
|
46
|
+
if (!format) return value.toLocaleString(resolvedLocale);
|
|
47
|
+
const options = {
|
|
48
|
+
...format.style === "currency" ? { currency: format.currency, style: "currency" } : {},
|
|
49
|
+
...format.style === "percent" ? { style: "percent" } : {},
|
|
50
|
+
...format.style === "percent" && format.maximumFractionDigits !== void 0 ? { maximumFractionDigits: format.maximumFractionDigits } : {},
|
|
51
|
+
...format.style !== "percent" && format.compact ? { notation: "compact" } : {}
|
|
52
|
+
};
|
|
53
|
+
const cacheKey = `${resolvedLocale}:${JSON.stringify(options)}`;
|
|
54
|
+
let formatter = numberFormatters.get(cacheKey);
|
|
55
|
+
if (!formatter) {
|
|
56
|
+
formatter = new Intl.NumberFormat(resolvedLocale, options);
|
|
57
|
+
numberFormatters.set(cacheKey, formatter);
|
|
58
|
+
}
|
|
59
|
+
return formatter.format(value);
|
|
60
|
+
}
|
|
61
|
+
function formatAxisValue(value, locale = "en") {
|
|
62
|
+
const resolvedLocale = supportedLocale(locale);
|
|
63
|
+
const absolute = Math.abs(value);
|
|
64
|
+
if (absolute >= 1e6)
|
|
65
|
+
return `${(value / 1e6).toLocaleString(resolvedLocale, { maximumFractionDigits: 1 })}M`;
|
|
66
|
+
if (absolute >= 1e3)
|
|
67
|
+
return `${(value / 1e3).toLocaleString(resolvedLocale, { maximumFractionDigits: 1 })}K`;
|
|
68
|
+
return value.toLocaleString(resolvedLocale, { maximumFractionDigits: 1 });
|
|
69
|
+
}
|
|
70
|
+
function formatDelta(value, options = {}, locale = "en") {
|
|
71
|
+
const formatter = new Intl.NumberFormat(supportedLocale(locale), {
|
|
72
|
+
maximumFractionDigits: options.maximumFractionDigits ?? 2,
|
|
73
|
+
signDisplay: "always",
|
|
74
|
+
style: options.style === "percent" ? "percent" : "decimal"
|
|
75
|
+
});
|
|
76
|
+
return formatter.format(value);
|
|
77
|
+
}
|
|
78
|
+
function formatCell(value, format, locale = "en") {
|
|
79
|
+
return typeof value === "number" ? formatNumber(value, format, locale) : String(value ?? "");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ../agent-ui/src/components/component-actions/export-actions.tsx
|
|
83
|
+
import { ChartColumn, Ellipsis, FileCode, FileText, LayoutCells, Picture } from "@gravity-ui/icons";
|
|
84
|
+
import { Button, Dropdown, Label } from "@heroui/react";
|
|
85
|
+
import { useCallback, useRef, useState } from "react";
|
|
86
|
+
|
|
87
|
+
// ../agent-ui/src/components/data-visualization/charts/chart-table.ts
|
|
88
|
+
function humanizeKey(key) {
|
|
89
|
+
const label = key.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
90
|
+
return label ? `${label[0]?.toUpperCase()}${label.slice(1)}` : key;
|
|
91
|
+
}
|
|
92
|
+
function flattenSunburstRows(root) {
|
|
93
|
+
const rows = [];
|
|
94
|
+
const visit = (node, ancestors, depth) => {
|
|
95
|
+
const path = [...ancestors, node.label];
|
|
96
|
+
const childrenValue = node.children?.reduce(
|
|
97
|
+
(total, child) => total + visit(child, path, depth + 1),
|
|
98
|
+
0
|
|
99
|
+
);
|
|
100
|
+
const value = node.children?.length ? childrenValue ?? 0 : node.value ?? 0;
|
|
101
|
+
if (depth > 0) {
|
|
102
|
+
rows.push({ depth, id: node.id, label: node.label, path: path.join(" / "), value });
|
|
103
|
+
}
|
|
104
|
+
return value;
|
|
105
|
+
};
|
|
106
|
+
visit(root, [], 0);
|
|
107
|
+
return rows;
|
|
108
|
+
}
|
|
109
|
+
function chartToDataTable(component) {
|
|
110
|
+
const columns = [];
|
|
111
|
+
const seen = /* @__PURE__ */ new Set();
|
|
112
|
+
const addColumn = (column) => {
|
|
113
|
+
if (seen.has(column.key)) return;
|
|
114
|
+
seen.add(column.key);
|
|
115
|
+
columns.push(column);
|
|
116
|
+
};
|
|
117
|
+
const addKey = (key, format) => addColumn({ format, key, label: humanizeKey(key) });
|
|
118
|
+
switch (component.kind) {
|
|
119
|
+
case "line-chart":
|
|
120
|
+
case "area-chart":
|
|
121
|
+
case "bar-chart":
|
|
122
|
+
case "composed-chart":
|
|
123
|
+
addKey(component.xKey);
|
|
124
|
+
component.series.forEach(
|
|
125
|
+
(series) => addColumn({ format: series.format, key: series.dataKey, label: series.label })
|
|
126
|
+
);
|
|
127
|
+
break;
|
|
128
|
+
case "candlestick-chart":
|
|
129
|
+
addKey(component.xKey);
|
|
130
|
+
addKey(component.openKey, component.format);
|
|
131
|
+
addKey(component.highKey, component.format);
|
|
132
|
+
addKey(component.lowKey, component.format);
|
|
133
|
+
addKey(component.closeKey, component.format);
|
|
134
|
+
break;
|
|
135
|
+
case "funnel-chart":
|
|
136
|
+
addKey(component.labelKey);
|
|
137
|
+
addKey(component.valueKey, component.format);
|
|
138
|
+
break;
|
|
139
|
+
case "gauge-chart":
|
|
140
|
+
addKey("label");
|
|
141
|
+
addKey("value", component.format);
|
|
142
|
+
addKey("min", component.format);
|
|
143
|
+
addKey("max", component.format);
|
|
144
|
+
break;
|
|
145
|
+
case "pie-chart":
|
|
146
|
+
case "donut-chart":
|
|
147
|
+
case "radial-chart":
|
|
148
|
+
addKey(component.labelKey);
|
|
149
|
+
addKey(component.valueKey, component.format);
|
|
150
|
+
break;
|
|
151
|
+
case "radar-chart":
|
|
152
|
+
addKey(component.angleKey);
|
|
153
|
+
component.series.forEach(
|
|
154
|
+
(series) => addColumn({ format: series.format, key: series.dataKey, label: series.label })
|
|
155
|
+
);
|
|
156
|
+
break;
|
|
157
|
+
case "scatter-chart":
|
|
158
|
+
if (component.labelKey) addKey(component.labelKey);
|
|
159
|
+
if (component.groupKey) addKey(component.groupKey);
|
|
160
|
+
addKey(component.xKey, component.format);
|
|
161
|
+
addKey(component.yKey, component.format);
|
|
162
|
+
if (component.sizeKey) addKey(component.sizeKey, component.format);
|
|
163
|
+
break;
|
|
164
|
+
case "heatmap":
|
|
165
|
+
addKey(component.xKey);
|
|
166
|
+
addKey(component.yKey);
|
|
167
|
+
addKey(component.valueKey, component.format);
|
|
168
|
+
break;
|
|
169
|
+
case "sankey-chart":
|
|
170
|
+
addKey("source");
|
|
171
|
+
addKey("target");
|
|
172
|
+
addKey("value", component.format);
|
|
173
|
+
break;
|
|
174
|
+
case "sunburst-chart":
|
|
175
|
+
addKey("id");
|
|
176
|
+
addKey("label");
|
|
177
|
+
addKey("path");
|
|
178
|
+
addKey("depth");
|
|
179
|
+
addKey("value", component.format);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
let rows;
|
|
183
|
+
if (component.kind === "sankey-chart") {
|
|
184
|
+
const labels = new Map(component.nodes.map((node) => [node.id, node.label]));
|
|
185
|
+
rows = component.links.map((link) => ({
|
|
186
|
+
source: labels.get(link.source) ?? link.source,
|
|
187
|
+
target: labels.get(link.target) ?? link.target,
|
|
188
|
+
value: link.value
|
|
189
|
+
}));
|
|
190
|
+
} else if (component.kind === "gauge-chart") {
|
|
191
|
+
const { maximum, minimum } = resolveGaugeBounds(component);
|
|
192
|
+
rows = [
|
|
193
|
+
{
|
|
194
|
+
label: component.label,
|
|
195
|
+
max: maximum,
|
|
196
|
+
min: minimum,
|
|
197
|
+
value: component.value
|
|
198
|
+
}
|
|
199
|
+
];
|
|
200
|
+
} else if (component.kind === "sunburst-chart") {
|
|
201
|
+
rows = flattenSunburstRows(component.data);
|
|
202
|
+
} else {
|
|
203
|
+
rows = component.data;
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
columns,
|
|
207
|
+
description: component.description,
|
|
208
|
+
id: component.id,
|
|
209
|
+
kind: "data-table",
|
|
210
|
+
rows,
|
|
211
|
+
title: component.title,
|
|
212
|
+
variant: "secondary"
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// ../agent-ui/src/components/component-actions/export-utils.ts
|
|
217
|
+
var TABULAR_CHART_KINDS = /* @__PURE__ */ new Set([
|
|
218
|
+
"area-chart",
|
|
219
|
+
"bar-chart",
|
|
220
|
+
"candlestick-chart",
|
|
221
|
+
"composed-chart",
|
|
222
|
+
"donut-chart",
|
|
223
|
+
"funnel-chart",
|
|
224
|
+
"gauge-chart",
|
|
225
|
+
"heatmap",
|
|
226
|
+
"line-chart",
|
|
227
|
+
"pie-chart",
|
|
228
|
+
"radar-chart",
|
|
229
|
+
"radial-chart",
|
|
230
|
+
"sankey-chart",
|
|
231
|
+
"scatter-chart",
|
|
232
|
+
"sunburst-chart"
|
|
233
|
+
]);
|
|
234
|
+
function isTabularChart(component) {
|
|
235
|
+
return TABULAR_CHART_KINDS.has(component.kind);
|
|
236
|
+
}
|
|
237
|
+
function filename(title, extension) {
|
|
238
|
+
const stem = title.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
239
|
+
return `${stem || "agent-ui"}.${extension}`;
|
|
240
|
+
}
|
|
241
|
+
function download(data, type, name) {
|
|
242
|
+
if (typeof document === "undefined" || typeof URL.createObjectURL !== "function") return;
|
|
243
|
+
const url = URL.createObjectURL(new Blob([data], { type }));
|
|
244
|
+
const anchor = document.createElement("a");
|
|
245
|
+
anchor.download = name;
|
|
246
|
+
anchor.href = url;
|
|
247
|
+
anchor.click();
|
|
248
|
+
URL.revokeObjectURL(url);
|
|
249
|
+
}
|
|
250
|
+
function csvCell(value) {
|
|
251
|
+
const text = String(value ?? "");
|
|
252
|
+
return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
|
|
253
|
+
}
|
|
254
|
+
function componentToCsv(component) {
|
|
255
|
+
let rows;
|
|
256
|
+
let keys;
|
|
257
|
+
if (component.kind === "data-table") {
|
|
258
|
+
rows = component.rows;
|
|
259
|
+
keys = component.columns.map((column) => column.key);
|
|
260
|
+
} else if (isTabularChart(component)) {
|
|
261
|
+
const table = chartToDataTable(component);
|
|
262
|
+
rows = table.rows;
|
|
263
|
+
keys = table.columns.map((column) => column.key);
|
|
264
|
+
}
|
|
265
|
+
if (!rows || !keys?.length) return null;
|
|
266
|
+
return [
|
|
267
|
+
keys.map(csvCell).join(","),
|
|
268
|
+
...rows.map((row) => keys.map((key) => csvCell(row[key])).join(","))
|
|
269
|
+
].join("\n");
|
|
270
|
+
}
|
|
271
|
+
var SVG_STYLE_TOKENS = [
|
|
272
|
+
"--accent",
|
|
273
|
+
"--border",
|
|
274
|
+
"--chart-1",
|
|
275
|
+
"--chart-2",
|
|
276
|
+
"--chart-3",
|
|
277
|
+
"--chart-4",
|
|
278
|
+
"--chart-5",
|
|
279
|
+
"--danger",
|
|
280
|
+
"--default-foreground",
|
|
281
|
+
"--focus",
|
|
282
|
+
"--foreground",
|
|
283
|
+
"--muted",
|
|
284
|
+
"--success",
|
|
285
|
+
"--surface",
|
|
286
|
+
"--surface-secondary",
|
|
287
|
+
"--warning"
|
|
288
|
+
];
|
|
289
|
+
var SVG_PRESENTATION_PROPERTIES = [
|
|
290
|
+
"color",
|
|
291
|
+
"display",
|
|
292
|
+
"dominant-baseline",
|
|
293
|
+
"fill",
|
|
294
|
+
"fill-opacity",
|
|
295
|
+
"font-family",
|
|
296
|
+
"font-size",
|
|
297
|
+
"font-style",
|
|
298
|
+
"font-weight",
|
|
299
|
+
"letter-spacing",
|
|
300
|
+
"opacity",
|
|
301
|
+
"paint-order",
|
|
302
|
+
"shape-rendering",
|
|
303
|
+
"stroke",
|
|
304
|
+
"stroke-dasharray",
|
|
305
|
+
"stroke-dashoffset",
|
|
306
|
+
"stroke-linecap",
|
|
307
|
+
"stroke-linejoin",
|
|
308
|
+
"stroke-miterlimit",
|
|
309
|
+
"stroke-opacity",
|
|
310
|
+
"stroke-width",
|
|
311
|
+
"text-anchor",
|
|
312
|
+
"vector-effect",
|
|
313
|
+
"visibility"
|
|
314
|
+
];
|
|
315
|
+
function absoluteSvgLength(value) {
|
|
316
|
+
if (!value || value.trim().endsWith("%")) return 0;
|
|
317
|
+
const parsed = Number.parseFloat(value);
|
|
318
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
319
|
+
}
|
|
320
|
+
function viewBoxDimensions(svg) {
|
|
321
|
+
const values = svg.getAttribute("viewBox")?.trim().split(/[ ,]+/).map(Number);
|
|
322
|
+
return {
|
|
323
|
+
height: values?.length === 4 && Number.isFinite(values[3]) ? Math.max(0, values[3]) : 0,
|
|
324
|
+
width: values?.length === 4 && Number.isFinite(values[2]) ? Math.max(0, values[2]) : 0
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function inlineSvgPresentationStyles(source, clone) {
|
|
328
|
+
const sourceElements = [source, ...Array.from(source.querySelectorAll("*"))];
|
|
329
|
+
const cloneElements = [clone, ...Array.from(clone.querySelectorAll("*"))];
|
|
330
|
+
sourceElements.forEach((element, index) => {
|
|
331
|
+
const target = cloneElements[index];
|
|
332
|
+
if (!target) return;
|
|
333
|
+
const computed = getComputedStyle(element);
|
|
334
|
+
const declarations = SVG_PRESENTATION_PROPERTIES.flatMap((property) => {
|
|
335
|
+
const value = computed.getPropertyValue(property).trim();
|
|
336
|
+
return value ? [`${property}:${value}`] : [];
|
|
337
|
+
});
|
|
338
|
+
if (declarations.length === 0) return;
|
|
339
|
+
target.setAttribute(
|
|
340
|
+
"style",
|
|
341
|
+
[target.getAttribute("style"), ...declarations].filter(Boolean).join(";")
|
|
342
|
+
);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function serializeChartSvg(button) {
|
|
346
|
+
const card = button.closest('[data-slot="agent-ui-card"]');
|
|
347
|
+
const svg = card?.querySelector('[data-slot="agent-ui-chart"] svg');
|
|
348
|
+
if (!(card instanceof HTMLElement) || !(svg instanceof SVGElement)) return null;
|
|
349
|
+
const clone = svg.cloneNode(true);
|
|
350
|
+
const chartName = svg.closest('[data-slot="agent-ui-chart"]')?.getAttribute("aria-label")?.trim();
|
|
351
|
+
const bounds = svg.getBoundingClientRect();
|
|
352
|
+
const viewBox = viewBoxDimensions(svg);
|
|
353
|
+
const width = Math.max(
|
|
354
|
+
1,
|
|
355
|
+
Math.round(bounds.width || absoluteSvgLength(svg.getAttribute("width")) || viewBox.width)
|
|
356
|
+
);
|
|
357
|
+
const height = Math.max(
|
|
358
|
+
1,
|
|
359
|
+
Math.round(bounds.height || absoluteSvgLength(svg.getAttribute("height")) || viewBox.height)
|
|
360
|
+
);
|
|
361
|
+
const styles = getComputedStyle(card);
|
|
362
|
+
const variables = SVG_STYLE_TOKENS.flatMap((token) => {
|
|
363
|
+
const value = styles.getPropertyValue(token).trim();
|
|
364
|
+
return value ? [`${token}:${value}`] : [];
|
|
365
|
+
}).join(";");
|
|
366
|
+
inlineSvgPresentationStyles(svg, clone);
|
|
367
|
+
clone.removeAttribute("aria-hidden");
|
|
368
|
+
clone.setAttribute("role", "img");
|
|
369
|
+
if (chartName) {
|
|
370
|
+
const title = document.createElementNS("http://www.w3.org/2000/svg", "title");
|
|
371
|
+
title.textContent = chartName;
|
|
372
|
+
clone.prepend(title);
|
|
373
|
+
clone.setAttribute("aria-label", chartName);
|
|
374
|
+
}
|
|
375
|
+
clone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
376
|
+
clone.setAttribute("height", String(height));
|
|
377
|
+
clone.setAttribute("width", String(width));
|
|
378
|
+
if (!clone.hasAttribute("viewBox")) clone.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
379
|
+
clone.setAttribute("style", [clone.getAttribute("style"), variables].filter(Boolean).join(";"));
|
|
380
|
+
return { height, markup: new XMLSerializer().serializeToString(clone), width };
|
|
381
|
+
}
|
|
382
|
+
async function exportPng(button, title) {
|
|
383
|
+
const serialized = serializeChartSvg(button);
|
|
384
|
+
if (!serialized || typeof Image === "undefined" || typeof URL.createObjectURL !== "function")
|
|
385
|
+
return;
|
|
386
|
+
const source = URL.createObjectURL(
|
|
387
|
+
new Blob([serialized.markup], { type: "image/svg+xml;charset=utf-8" })
|
|
388
|
+
);
|
|
389
|
+
const image = new Image();
|
|
390
|
+
await new Promise((resolve, reject) => {
|
|
391
|
+
image.onload = () => resolve();
|
|
392
|
+
image.onerror = () => {
|
|
393
|
+
URL.revokeObjectURL(source);
|
|
394
|
+
reject(new Error("Unable to render component image"));
|
|
395
|
+
};
|
|
396
|
+
image.src = source;
|
|
397
|
+
});
|
|
398
|
+
URL.revokeObjectURL(source);
|
|
399
|
+
const canvas = document.createElement("canvas");
|
|
400
|
+
const scale = Math.max(1, window.devicePixelRatio || 1);
|
|
401
|
+
canvas.width = serialized.width * scale;
|
|
402
|
+
canvas.height = serialized.height * scale;
|
|
403
|
+
const context = canvas.getContext("2d");
|
|
404
|
+
if (!context) return;
|
|
405
|
+
context.scale(scale, scale);
|
|
406
|
+
context.drawImage(image, 0, 0, serialized.width, serialized.height);
|
|
407
|
+
const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/png"));
|
|
408
|
+
if (blob) download(blob, "image/png", filename(title, "png"));
|
|
409
|
+
}
|
|
410
|
+
function exportComponent(button, component, format) {
|
|
411
|
+
if (format === "csv") {
|
|
412
|
+
const csv = componentToCsv(component);
|
|
413
|
+
if (csv) download(csv, "text/csv;charset=utf-8", filename(component.title, "csv"));
|
|
414
|
+
} else if (format === "svg") {
|
|
415
|
+
const serialized = serializeChartSvg(button);
|
|
416
|
+
if (serialized)
|
|
417
|
+
download(serialized.markup, "image/svg+xml;charset=utf-8", filename(component.title, "svg"));
|
|
418
|
+
} else {
|
|
419
|
+
void exportPng(button, component.title).catch(() => void 0);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// ../agent-ui/src/components/component-actions/export-actions.tsx
|
|
424
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
425
|
+
var FORMAT_LABELS = {
|
|
426
|
+
csv: "Export as CSV",
|
|
427
|
+
png: "Export as PNG",
|
|
428
|
+
svg: "Export as SVG"
|
|
429
|
+
};
|
|
430
|
+
var FORMAT_ICONS = {
|
|
431
|
+
csv: FileText,
|
|
432
|
+
png: Picture,
|
|
433
|
+
svg: FileCode
|
|
434
|
+
};
|
|
435
|
+
function ComponentExportActions({
|
|
436
|
+
component,
|
|
437
|
+
formats = [],
|
|
438
|
+
onAction,
|
|
439
|
+
viewAction
|
|
440
|
+
}) {
|
|
441
|
+
const triggerRef = useRef(null);
|
|
442
|
+
const [portalContainer, setPortalContainer] = useState();
|
|
443
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
444
|
+
const pointerOpenAt = useRef(0);
|
|
445
|
+
const handleOpenChange = (nextOpen) => {
|
|
446
|
+
if (!nextOpen && Date.now() - pointerOpenAt.current < 350) return;
|
|
447
|
+
setIsOpen(nextOpen);
|
|
448
|
+
};
|
|
449
|
+
const captureTrigger = useCallback((node) => {
|
|
450
|
+
triggerRef.current = node;
|
|
451
|
+
setPortalContainer(resolveOverlayPortalContainer(node));
|
|
452
|
+
}, []);
|
|
453
|
+
const supported = formats.filter((format) => format !== "csv" || componentToCsv(component));
|
|
454
|
+
const triggerLabel = viewAction ? `${supported.length > 0 ? "View and export" : "View"} options for ${component.title}` : `Export options for ${component.title}`;
|
|
455
|
+
if (supported.length === 0 && !viewAction) return null;
|
|
456
|
+
return /* @__PURE__ */ jsx("div", { className: "aui-export-actions", "data-slot": "agent-ui-export-actions", children: /* @__PURE__ */ jsxs(Dropdown, { isOpen, onOpenChange: handleOpenChange, children: [
|
|
457
|
+
/* @__PURE__ */ jsx(
|
|
458
|
+
Button,
|
|
459
|
+
{
|
|
460
|
+
ref: captureTrigger,
|
|
461
|
+
isIconOnly: true,
|
|
462
|
+
"aria-label": triggerLabel,
|
|
463
|
+
size: "sm",
|
|
464
|
+
variant: "ghost",
|
|
465
|
+
onPointerDown: () => {
|
|
466
|
+
pointerOpenAt.current = Date.now();
|
|
467
|
+
},
|
|
468
|
+
children: /* @__PURE__ */ jsx(Ellipsis, {})
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
/* @__PURE__ */ jsx(Dropdown.Popover, { placement: "bottom end", UNSTABLE_portalContainer: portalContainer, children: /* @__PURE__ */ jsxs(
|
|
472
|
+
Dropdown.Menu,
|
|
473
|
+
{
|
|
474
|
+
onAction: (key) => {
|
|
475
|
+
if (key === "view") {
|
|
476
|
+
viewAction?.onAction();
|
|
477
|
+
setIsOpen(false);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const format = key;
|
|
481
|
+
if (triggerRef.current) exportComponent(triggerRef.current, component, format);
|
|
482
|
+
onAction?.({ componentId: component.id, format, type: "export" });
|
|
483
|
+
setIsOpen(false);
|
|
484
|
+
},
|
|
485
|
+
children: [
|
|
486
|
+
viewAction ? /* @__PURE__ */ jsxs(Dropdown.Item, { id: "view", textValue: viewAction.label, children: [
|
|
487
|
+
viewAction.target === "table" ? /* @__PURE__ */ jsx(LayoutCells, { "aria-hidden": "true", className: "size-4 shrink-0" }) : /* @__PURE__ */ jsx(ChartColumn, { "aria-hidden": "true", className: "size-4 shrink-0" }),
|
|
488
|
+
/* @__PURE__ */ jsx(Label, { children: viewAction.label })
|
|
489
|
+
] }) : null,
|
|
490
|
+
supported.map((format) => {
|
|
491
|
+
const FormatIcon = FORMAT_ICONS[format];
|
|
492
|
+
return /* @__PURE__ */ jsxs(Dropdown.Item, { id: format, textValue: FORMAT_LABELS[format], children: [
|
|
493
|
+
/* @__PURE__ */ jsx(FormatIcon, { "aria-hidden": "true", className: "size-4 shrink-0" }),
|
|
494
|
+
/* @__PURE__ */ jsx(Label, { children: FORMAT_LABELS[format] })
|
|
495
|
+
] }, format);
|
|
496
|
+
})
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
) })
|
|
500
|
+
] }) });
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// ../agent-ui/src/components/data-visualization/trend-change/trend-change.tsx
|
|
504
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
505
|
+
function TrendArrow({ direction }) {
|
|
506
|
+
return /* @__PURE__ */ jsx2(
|
|
507
|
+
"svg",
|
|
508
|
+
{
|
|
509
|
+
"aria-hidden": "true",
|
|
510
|
+
className: "aui-change__indicator",
|
|
511
|
+
fill: "none",
|
|
512
|
+
stroke: "currentColor",
|
|
513
|
+
strokeLinecap: "round",
|
|
514
|
+
strokeLinejoin: "round",
|
|
515
|
+
strokeWidth: "2",
|
|
516
|
+
viewBox: "0 0 24 24",
|
|
517
|
+
children: direction === "up" ? /* @__PURE__ */ jsx2("path", { d: "M12 19V5m-5 5 5-5 5 5" }) : /* @__PURE__ */ jsx2("path", { d: "M12 5v14m5-5-5 5-5-5" })
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
function TrendChange({ slot, value }) {
|
|
522
|
+
return /* @__PURE__ */ jsxs2(
|
|
523
|
+
"span",
|
|
524
|
+
{
|
|
525
|
+
className: "aui-change",
|
|
526
|
+
"data-slot": slot,
|
|
527
|
+
"data-trend": value > 0 ? "up" : value < 0 ? "down" : "neutral",
|
|
528
|
+
children: [
|
|
529
|
+
value === 0 ? null : /* @__PURE__ */ jsx2(TrendArrow, { direction: value > 0 ? "up" : "down" }),
|
|
530
|
+
formatDelta(value),
|
|
531
|
+
"%"
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// ../agent-ui/src/components/data-visualization/charts/chart-colors.ts
|
|
538
|
+
var COLORS = [
|
|
539
|
+
"var(--chart-3, var(--accent))",
|
|
540
|
+
"var(--chart-1, oklch(from var(--accent) calc(l - 0.24) c h))",
|
|
541
|
+
"var(--chart-4, oklch(from var(--accent) calc(l + 0.12) c h))",
|
|
542
|
+
"var(--chart-2, oklch(from var(--accent) calc(l - 0.12) c h))",
|
|
543
|
+
"var(--chart-5, oklch(from var(--accent) calc(l + 0.24) c h))"
|
|
544
|
+
];
|
|
545
|
+
var CHART_COLOR_TOKENS = {
|
|
546
|
+
accent: "var(--accent)",
|
|
547
|
+
"chart-1": "var(--chart-1, oklch(from var(--accent) calc(l - 0.24) c h))",
|
|
548
|
+
"chart-2": "var(--chart-2, oklch(from var(--accent) calc(l - 0.12) c h))",
|
|
549
|
+
"chart-3": "var(--chart-3, var(--accent))",
|
|
550
|
+
"chart-4": "var(--chart-4, oklch(from var(--accent) calc(l + 0.12) c h))",
|
|
551
|
+
"chart-5": "var(--chart-5, oklch(from var(--accent) calc(l + 0.24) c h))",
|
|
552
|
+
danger: "var(--danger)",
|
|
553
|
+
default: "var(--default-foreground, var(--foreground))",
|
|
554
|
+
success: "var(--success)",
|
|
555
|
+
warning: "var(--warning)"
|
|
556
|
+
};
|
|
557
|
+
function resolveChartColor(color, index) {
|
|
558
|
+
return color ? CHART_COLOR_TOKENS[color] : COLORS[index % COLORS.length];
|
|
559
|
+
}
|
|
560
|
+
function paletteChartColor(index) {
|
|
561
|
+
return COLORS[index % COLORS.length];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export {
|
|
565
|
+
resolveGaugeBounds,
|
|
566
|
+
componentActionFromSpec,
|
|
567
|
+
createComponentSelection,
|
|
568
|
+
formatNumber,
|
|
569
|
+
formatAxisValue,
|
|
570
|
+
formatCell,
|
|
571
|
+
chartToDataTable,
|
|
572
|
+
ComponentExportActions,
|
|
573
|
+
TrendChange,
|
|
574
|
+
CHART_COLOR_TOKENS,
|
|
575
|
+
resolveChartColor,
|
|
576
|
+
paletteChartColor
|
|
577
|
+
};
|
|
@@ -854,7 +854,7 @@ var LEGACY_AGENT_MODEL_IDS = {
|
|
|
854
854
|
function resolveAgentModelId(value) {
|
|
855
855
|
return LEGACY_AGENT_MODEL_IDS[value] ?? value;
|
|
856
856
|
}
|
|
857
|
-
var DEFAULT_AGENT_PICKER_MODEL_ID = "
|
|
857
|
+
var DEFAULT_AGENT_PICKER_MODEL_ID = "google/gemini-3.6-flash";
|
|
858
858
|
var AGENT_MODEL_OPTIONS = [
|
|
859
859
|
{
|
|
860
860
|
description: "Flagship model for coding, reasoning, and knowledge work",
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
resolveOptions,
|
|
11
11
|
scheduleIdleTask,
|
|
12
12
|
writeAgentShellHandoff
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EXFDD3K3.js";
|
|
14
14
|
|
|
15
15
|
// src/embed/provider.tsx
|
|
16
16
|
import {
|
|
@@ -512,7 +512,7 @@ var embedRuntimePromise;
|
|
|
512
512
|
function loadEmbedRuntime() {
|
|
513
513
|
embedRuntimePromise ??= import(
|
|
514
514
|
/* webpackPrefetch: true */
|
|
515
|
-
"./embed-runtime-
|
|
515
|
+
"./embed-runtime-QOATFAS7.js"
|
|
516
516
|
).then(
|
|
517
517
|
(module) => module.default
|
|
518
518
|
);
|