@frontera-sdk/chat-ui 1.50.79 → 1.50.80
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/agent-picker.js +6 -6
- package/dist/{capture-NO5ZIGP6.js → capture-G4CDPSBH.js} +1 -1
- package/dist/chat.d.ts +1 -1
- package/dist/chat.js +4594 -941
- package/dist/{chunk-V44YVBRX.js → chunk-2P4IEVOQ.js} +29 -12
- package/dist/{chunk-WMN6BPPS.js → chunk-4FRTPVJT.js} +2 -2
- package/dist/{chunk-UTKQ6G2A.js → chunk-5B25DNOG.js} +7 -7
- package/dist/{chunk-FTLVGUG5.js → chunk-7AT2LRVW.js} +2640 -153
- package/dist/{chunk-FNIHHKOZ.js → chunk-C2TZSGKK.js} +1374 -186
- package/dist/{chunk-BDJFVRYR.js → chunk-C3HW5S2Z.js} +57 -18
- package/dist/chunk-CWAOLMFS.js +32 -0
- package/dist/{chunk-26L3ST3H.js → chunk-EFFOOCIK.js} +5975 -639
- package/dist/{chunk-J7EWRXEC.js → chunk-EXPHCRFP.js} +3 -3
- package/dist/{chunk-PH7AYVSS.js → chunk-FLOAEPRU.js} +4 -4
- package/dist/chunk-LGVMMBL3.js +33 -0
- package/dist/{chunk-IQXJEZM7.js → chunk-LOBDKA2D.js} +328 -32
- package/dist/{chunk-FDGBZFGN.js → chunk-PKNEC4LJ.js} +528 -12
- package/dist/{chunk-TSKFBMGC.js → chunk-PUMRNN3R.js} +117 -66
- package/dist/{chunk-S3ECTKA3.js → chunk-QBV7MAFV.js} +30 -4
- package/dist/{chunk-F6PEZE7A.js → chunk-T5SANYSX.js} +3 -10
- package/dist/{chunk-AFVU5VT6.js → chunk-TUDJ35AB.js} +1071 -87
- package/dist/{chunk-ROJM44GB.js → chunk-UWKO24VT.js} +28 -2
- package/dist/{chunk-KHF7OM3F.js → chunk-UZ6RDWCT.js} +4 -4
- package/dist/chunk-X3QVICX7.js +32 -0
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -1
- package/dist/header.d.ts +1 -1
- package/dist/header.js +15 -15
- package/dist/message.js +14 -15
- package/dist/new-session.d.ts +1 -1
- package/dist/new-session.js +7 -8
- package/dist/parts.js +6 -6
- package/dist/{pdf-deck-view-inner-AY4FYDAJ.js → pdf-deck-view-inner-KW6RIALH.js} +7 -8
- package/dist/{pdf-document-view-inner-NC5MBN7X.js → pdf-document-view-inner-AJEP5IJC.js} +6 -7
- package/dist/{pdf-viewer-inner-GPES3KG2.js → pdf-viewer-inner-CXWPRACH.js} +2 -2
- package/dist/pending-cards.js +7 -7
- package/dist/platform.css +1 -1
- package/package.json +7 -4
- package/dist/chunk-6BPHEBCF.js +0 -639
- package/dist/chunk-IXDM5R55.js +0 -23
- package/dist/chunk-XLX3L3P4.js +0 -43
- package/dist/vega-chart-block-NQADYNWQ.js +0 -2857
- package/dist/{chunk-7ADM3CKD.js → chunk-6JLWE7M3.js} +0 -0
- package/dist/{pdf-cover-thumbnail-inner-4N2Q5AAG.js → pdf-cover-thumbnail-inner-B2P6S25B.js} +0 -0
- package/dist/{types-BDqLaBfH.d.ts → types-BZhoOcz2.d.ts} +3 -3
- /package/dist/{univer-workbook-LSBVETAQ.js → univer-workbook-PENO65OQ.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontera-sdk/chat-ui",
|
|
3
|
-
"version": "1.50.
|
|
3
|
+
"version": "1.50.80",
|
|
4
4
|
"description": "Ready-made React components for embedding a Frontera agent conversation — message rendering, tool calls, artifacts and composer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"frontera",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"scripts": {
|
|
82
82
|
"test": "bun test",
|
|
83
83
|
"typecheck": "bunx tsc --noEmit",
|
|
84
|
-
"vendor": "bun run scripts/
|
|
84
|
+
"vendor": "bun run scripts/vendor-icons.ts && bun run scripts/vendor-theme.ts",
|
|
85
85
|
"build:css": "bunx @tailwindcss/cli -i src/tailwind.css -o dist/platform.css --minify && bun run scripts/build-css.ts && bun run scripts/scope-css.ts",
|
|
86
86
|
"prepublishOnly": "bun run build",
|
|
87
87
|
"check:externals": "bun run scripts/check-externals.ts",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"@elysiajs/eden": "^1.4.9",
|
|
92
|
-
"@frontera-sdk/chat": "1.50.
|
|
93
|
-
"@frontera-sdk/core": "1.50.
|
|
92
|
+
"@frontera-sdk/chat": "1.50.80",
|
|
93
|
+
"@frontera-sdk/core": "1.50.80",
|
|
94
94
|
"@radix-ui/react-alert-dialog": "^1.1.23",
|
|
95
95
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
96
96
|
"@radix-ui/react-compose-refs": "^1.1.5",
|
|
@@ -140,6 +140,9 @@
|
|
|
140
140
|
"react-dom": "^19.0.0"
|
|
141
141
|
},
|
|
142
142
|
"devDependencies": {
|
|
143
|
+
"@frontera/chat": "0.1.0",
|
|
144
|
+
"@frontera/icons": "0.1.0",
|
|
145
|
+
"@frontera/platform-kit": "0.1.0",
|
|
143
146
|
"@happy-dom/global-registrator": "^20.11.1",
|
|
144
147
|
"@tailwindcss/cli": "^4.3.3",
|
|
145
148
|
"@tailwindcss/typography": "^0.5.19",
|
package/dist/chunk-6BPHEBCF.js
DELETED
|
@@ -1,639 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useRef, useState, useEffect, Component } from 'react';
|
|
3
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
// src/vendor/plugins/charts/chart-utils.tsx
|
|
6
|
-
var SERIES_COLORS = [
|
|
7
|
-
"var(--chart-1)",
|
|
8
|
-
"var(--chart-2)",
|
|
9
|
-
"var(--chart-3)",
|
|
10
|
-
"var(--chart-4)",
|
|
11
|
-
"var(--chart-5)",
|
|
12
|
-
"var(--chart-6)",
|
|
13
|
-
"var(--chart-7)",
|
|
14
|
-
"var(--chart-8)",
|
|
15
|
-
"var(--chart-9)",
|
|
16
|
-
"var(--chart-10)"
|
|
17
|
-
];
|
|
18
|
-
function formatCompact(value) {
|
|
19
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
20
|
-
return String(value ?? "");
|
|
21
|
-
}
|
|
22
|
-
const abs = Math.abs(value);
|
|
23
|
-
if (abs >= 1e9) return (value / 1e9).toFixed(1).replace(/\.0$/, "") + "B";
|
|
24
|
-
if (abs >= 1e6) return (value / 1e6).toFixed(1).replace(/\.0$/, "") + "M";
|
|
25
|
-
if (abs >= 1e3) return (value / 1e3).toFixed(1).replace(/\.0$/, "") + "K";
|
|
26
|
-
return value.toLocaleString();
|
|
27
|
-
}
|
|
28
|
-
var FALLBACK_HEX = [
|
|
29
|
-
"#e25d33",
|
|
30
|
-
"#2a9d8f",
|
|
31
|
-
"#264653",
|
|
32
|
-
"#e9c46a",
|
|
33
|
-
"#f4a261",
|
|
34
|
-
"#d94f9e",
|
|
35
|
-
"#f07623",
|
|
36
|
-
"#14a383",
|
|
37
|
-
"#5b5ce6",
|
|
38
|
-
"#0d8ecf"
|
|
39
|
-
];
|
|
40
|
-
function resolveColor(index, customColors) {
|
|
41
|
-
if (customColors && customColors[index]) return customColors[index];
|
|
42
|
-
return SERIES_COLORS[index % SERIES_COLORS.length];
|
|
43
|
-
}
|
|
44
|
-
function useChartColors(count) {
|
|
45
|
-
const ref = useRef(null);
|
|
46
|
-
const [colors, setColors] = useState(
|
|
47
|
-
() => FALLBACK_HEX.slice(0, count)
|
|
48
|
-
);
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
const el = ref.current ?? document.documentElement;
|
|
51
|
-
const resolved = [];
|
|
52
|
-
for (let i = 0; i < count; i++) {
|
|
53
|
-
const varName = `--chart-${i + 1}`;
|
|
54
|
-
const raw = getComputedStyle(el).getPropertyValue(varName).trim();
|
|
55
|
-
if (raw) {
|
|
56
|
-
const temp = document.createElement("div");
|
|
57
|
-
temp.style.color = raw;
|
|
58
|
-
document.body.appendChild(temp);
|
|
59
|
-
const computed = getComputedStyle(temp).color;
|
|
60
|
-
document.body.removeChild(temp);
|
|
61
|
-
resolved.push(computed || FALLBACK_HEX[i % FALLBACK_HEX.length]);
|
|
62
|
-
} else {
|
|
63
|
-
resolved.push(FALLBACK_HEX[i % FALLBACK_HEX.length]);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
setColors(resolved);
|
|
67
|
-
}, [count]);
|
|
68
|
-
return colors;
|
|
69
|
-
}
|
|
70
|
-
function ChartTooltipContent({
|
|
71
|
-
active,
|
|
72
|
-
payload,
|
|
73
|
-
label,
|
|
74
|
-
formatter
|
|
75
|
-
}) {
|
|
76
|
-
if (!active || !payload?.length) return null;
|
|
77
|
-
return (
|
|
78
|
-
// `border` alone resolves to currentColor, which inherits whatever the host
|
|
79
|
-
// paints with — subtle inside recharts' own wrapper, a hard white outline
|
|
80
|
-
// anywhere else. Name the token so the box looks the same wherever it is
|
|
81
|
-
// mounted.
|
|
82
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-surface-overlay px-3 py-2 text-xs text-popover-foreground shadow-md", children: [
|
|
83
|
-
label != null && label !== "" && /* @__PURE__ */ jsx("div", { className: "mb-1 font-medium", children: label instanceof Date ? label.toLocaleDateString() : String(label) }),
|
|
84
|
-
/* @__PURE__ */ jsx("div", { className: "flex max-h-64 flex-col gap-0.5 overflow-y-auto overscroll-contain scrollbar", children: payload.map((item, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
86
|
-
"span",
|
|
87
|
-
{
|
|
88
|
-
className: "inline-block h-2.5 w-2.5 rounded-full",
|
|
89
|
-
style: { backgroundColor: item.color }
|
|
90
|
-
}
|
|
91
|
-
),
|
|
92
|
-
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
93
|
-
item.name ?? item.dataKey,
|
|
94
|
-
":"
|
|
95
|
-
] }),
|
|
96
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: formatter && item.value != null ? formatter(item.value) : String(item.value ?? "") })
|
|
97
|
-
] }, i)) })
|
|
98
|
-
] })
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
var ChartErrorBoundary = class extends Component {
|
|
102
|
-
constructor(props) {
|
|
103
|
-
super(props);
|
|
104
|
-
this.state = { hasError: false };
|
|
105
|
-
}
|
|
106
|
-
static getDerivedStateFromError() {
|
|
107
|
-
return { hasError: true };
|
|
108
|
-
}
|
|
109
|
-
render() {
|
|
110
|
-
if (this.state.hasError) {
|
|
111
|
-
return this.props.fallback;
|
|
112
|
-
}
|
|
113
|
-
return this.props.children;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
var RECHARTS_THEME_CLS = "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden [&_.recharts-legend-item-text]:!text-muted-foreground text-xs";
|
|
117
|
-
function RawJsonFallback({ content }) {
|
|
118
|
-
return /* @__PURE__ */ jsx("pre", { className: "overflow-auto rounded-md bg-muted p-3 text-xs text-muted-foreground", children: /* @__PURE__ */ jsx("code", { children: content }) });
|
|
119
|
-
}
|
|
120
|
-
var SKELETON_LABELS = {
|
|
121
|
-
datatable: "Crafting data table\u2026",
|
|
122
|
-
"chart-line": "Crafting chart\u2026",
|
|
123
|
-
"chart-bar": "Crafting chart\u2026",
|
|
124
|
-
"chart-pie": "Crafting chart\u2026",
|
|
125
|
-
"chart-funnel": "Crafting chart\u2026",
|
|
126
|
-
scorecard: "Crafting scorecard\u2026",
|
|
127
|
-
"force-field": "Crafting diagram\u2026",
|
|
128
|
-
"vega-chart": "Crafting chart\u2026"
|
|
129
|
-
};
|
|
130
|
-
function TableSkeleton() {
|
|
131
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
132
|
-
/* @__PURE__ */ jsx("div", { className: "h-8 rounded bg-muted animate-pulse" }),
|
|
133
|
-
Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
134
|
-
/* @__PURE__ */ jsx("div", { className: "h-6 flex-[2] rounded bg-muted/60 animate-pulse" }),
|
|
135
|
-
/* @__PURE__ */ jsx("div", { className: "h-6 flex-1 rounded bg-muted/60 animate-pulse" }),
|
|
136
|
-
/* @__PURE__ */ jsx("div", { className: "h-6 flex-1 rounded bg-muted/60 animate-pulse" })
|
|
137
|
-
] }, i))
|
|
138
|
-
] });
|
|
139
|
-
}
|
|
140
|
-
function ChartSkeleton() {
|
|
141
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-1.5 h-[180px] pt-4 pb-2 px-2", children: [
|
|
142
|
-
/* @__PURE__ */ jsx("div", { className: "w-px h-full bg-muted-foreground/20" }),
|
|
143
|
-
[60, 80, 45, 90, 70, 55, 85].map((h, i) => /* @__PURE__ */ jsx(
|
|
144
|
-
"div",
|
|
145
|
-
{
|
|
146
|
-
className: "flex-1 rounded-t bg-muted animate-pulse",
|
|
147
|
-
style: { height: `${h}%` }
|
|
148
|
-
},
|
|
149
|
-
i
|
|
150
|
-
))
|
|
151
|
-
] });
|
|
152
|
-
}
|
|
153
|
-
function ScorecardSkeleton() {
|
|
154
|
-
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-2 p-3 rounded-md bg-muted/30", children: [
|
|
155
|
-
/* @__PURE__ */ jsx("div", { className: "h-3 w-16 rounded bg-muted animate-pulse" }),
|
|
156
|
-
/* @__PURE__ */ jsx("div", { className: "h-6 w-24 rounded bg-muted animate-pulse" }),
|
|
157
|
-
/* @__PURE__ */ jsx("div", { className: "h-3 w-12 rounded bg-muted/60 animate-pulse" })
|
|
158
|
-
] }, i)) });
|
|
159
|
-
}
|
|
160
|
-
function SkeletonContent({ type }) {
|
|
161
|
-
if (type === "datatable") return /* @__PURE__ */ jsx(TableSkeleton, {});
|
|
162
|
-
if (type === "scorecard") return /* @__PURE__ */ jsx(ScorecardSkeleton, {});
|
|
163
|
-
return /* @__PURE__ */ jsx(ChartSkeleton, {});
|
|
164
|
-
}
|
|
165
|
-
function ChartBlockSkeleton({ type }) {
|
|
166
|
-
const label = SKELETON_LABELS[type] ?? "Loading\u2026";
|
|
167
|
-
return /* @__PURE__ */ jsxs("div", { className: "my-4 w-full p-4 rounded-xl border bg-surface-raised", children: [
|
|
168
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-3", children: [
|
|
169
|
-
/* @__PURE__ */ jsxs(
|
|
170
|
-
"svg",
|
|
171
|
-
{
|
|
172
|
-
className: "h-4 w-4 animate-spin text-muted-foreground",
|
|
173
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
174
|
-
fill: "none",
|
|
175
|
-
viewBox: "0 0 24 24",
|
|
176
|
-
children: [
|
|
177
|
-
/* @__PURE__ */ jsx(
|
|
178
|
-
"circle",
|
|
179
|
-
{
|
|
180
|
-
className: "opacity-25",
|
|
181
|
-
cx: "12",
|
|
182
|
-
cy: "12",
|
|
183
|
-
r: "10",
|
|
184
|
-
stroke: "currentColor",
|
|
185
|
-
strokeWidth: "4"
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
/* @__PURE__ */ jsx(
|
|
189
|
-
"path",
|
|
190
|
-
{
|
|
191
|
-
className: "opacity-75",
|
|
192
|
-
fill: "currentColor",
|
|
193
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
194
|
-
}
|
|
195
|
-
)
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
-
),
|
|
199
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: label })
|
|
200
|
-
] }),
|
|
201
|
-
/* @__PURE__ */ jsx(SkeletonContent, { type })
|
|
202
|
-
] });
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// src/vendor/plugins/vega-chart/vega-theme.ts
|
|
206
|
-
var QUALITATIVE_COLORS = [
|
|
207
|
-
"#5b8dee",
|
|
208
|
-
// blue
|
|
209
|
-
"#3dab82",
|
|
210
|
-
// teal
|
|
211
|
-
"#e8883e",
|
|
212
|
-
// orange
|
|
213
|
-
"#9b7ef5",
|
|
214
|
-
// purple
|
|
215
|
-
"#e05c78",
|
|
216
|
-
// rose
|
|
217
|
-
"#3ab5cc",
|
|
218
|
-
// cyan
|
|
219
|
-
"#a4b83a",
|
|
220
|
-
// olive-lime
|
|
221
|
-
"#d47a4a",
|
|
222
|
-
// terra
|
|
223
|
-
"#748cd4",
|
|
224
|
-
// periwinkle
|
|
225
|
-
"#4cad6a",
|
|
226
|
-
// green
|
|
227
|
-
"#c47eb5",
|
|
228
|
-
// mauve
|
|
229
|
-
"#d4a43e",
|
|
230
|
-
// gold
|
|
231
|
-
"#e87860",
|
|
232
|
-
// coral
|
|
233
|
-
"#4890c4",
|
|
234
|
-
// steel blue
|
|
235
|
-
"#8eb43e",
|
|
236
|
-
// yellow-green
|
|
237
|
-
"#b45e78",
|
|
238
|
-
// old rose
|
|
239
|
-
"#3ea8a0",
|
|
240
|
-
// teal-blue
|
|
241
|
-
"#d4784a",
|
|
242
|
-
// burnt orange
|
|
243
|
-
"#7858c4",
|
|
244
|
-
// medium violet
|
|
245
|
-
"#58a458",
|
|
246
|
-
// forest
|
|
247
|
-
"#e08898",
|
|
248
|
-
// light pink
|
|
249
|
-
"#c4a858",
|
|
250
|
-
// warm yellow
|
|
251
|
-
"#5888d4",
|
|
252
|
-
// cornflower
|
|
253
|
-
"#c46848"
|
|
254
|
-
// tomato
|
|
255
|
-
];
|
|
256
|
-
var PRIMARY_COLOR = "#4F46E5";
|
|
257
|
-
function resolveChartColors(count = 24) {
|
|
258
|
-
if (typeof document === "undefined") return QUALITATIVE_COLORS.slice(0, count);
|
|
259
|
-
const el = document.documentElement;
|
|
260
|
-
const resolved = [];
|
|
261
|
-
for (let i = 0; i < count; i++) {
|
|
262
|
-
const raw = getComputedStyle(el).getPropertyValue(`--chart-${i + 1}`).trim();
|
|
263
|
-
if (raw) {
|
|
264
|
-
const temp = document.createElement("div");
|
|
265
|
-
temp.style.color = raw;
|
|
266
|
-
document.body.appendChild(temp);
|
|
267
|
-
const computed = getComputedStyle(temp).color;
|
|
268
|
-
document.body.removeChild(temp);
|
|
269
|
-
resolved.push(computed || QUALITATIVE_COLORS[i % QUALITATIVE_COLORS.length]);
|
|
270
|
-
} else {
|
|
271
|
-
resolved.push(QUALITATIVE_COLORS[i % QUALITATIVE_COLORS.length]);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return resolved;
|
|
275
|
-
}
|
|
276
|
-
function resolveCssVar(varName, fallback) {
|
|
277
|
-
if (typeof document === "undefined") return fallback;
|
|
278
|
-
const raw = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
279
|
-
if (!raw) return fallback;
|
|
280
|
-
const temp = document.createElement("div");
|
|
281
|
-
temp.style.color = raw;
|
|
282
|
-
document.body.appendChild(temp);
|
|
283
|
-
const computed = getComputedStyle(temp).color;
|
|
284
|
-
document.body.removeChild(temp);
|
|
285
|
-
return computed || fallback;
|
|
286
|
-
}
|
|
287
|
-
function buildVegaTheme({
|
|
288
|
-
legendOrientation = "top",
|
|
289
|
-
showLegend = true,
|
|
290
|
-
showTitle = true
|
|
291
|
-
}) {
|
|
292
|
-
const colors = resolveChartColors(24);
|
|
293
|
-
const textColor = resolveCssVar("--foreground", "#1a1a1a");
|
|
294
|
-
const mutedColor = resolveCssVar("--muted-foreground", "#6b7280");
|
|
295
|
-
const gridColor = resolveCssVar("--border", "#e5e7eb");
|
|
296
|
-
return {
|
|
297
|
-
background: "transparent",
|
|
298
|
-
font: "Inter, sans-serif",
|
|
299
|
-
range: { category: colors },
|
|
300
|
-
axis: {
|
|
301
|
-
domain: false,
|
|
302
|
-
// No axis domain line
|
|
303
|
-
tickSize: 0,
|
|
304
|
-
// No tick marks
|
|
305
|
-
labelColor: mutedColor,
|
|
306
|
-
labelFontSize: 11,
|
|
307
|
-
labelFont: "Inter, sans-serif",
|
|
308
|
-
labelFontWeight: 400,
|
|
309
|
-
labelPadding: 12,
|
|
310
|
-
labelLimit: 200,
|
|
311
|
-
// Allow longer labels (default 160 truncates region names)
|
|
312
|
-
titleColor: textColor,
|
|
313
|
-
titleFontSize: 12,
|
|
314
|
-
titleFont: "Inter, sans-serif",
|
|
315
|
-
titleFontWeight: 500,
|
|
316
|
-
titlePadding: 10,
|
|
317
|
-
gridColor,
|
|
318
|
-
gridDash: [1]
|
|
319
|
-
// Dotted grid lines
|
|
320
|
-
},
|
|
321
|
-
axisX: {
|
|
322
|
-
grid: false
|
|
323
|
-
// No X-axis grid
|
|
324
|
-
},
|
|
325
|
-
axisY: {
|
|
326
|
-
grid: true
|
|
327
|
-
// Y-axis dotted grid only
|
|
328
|
-
},
|
|
329
|
-
// Styled unconditionally. `showLegend: false` never hid a legend — it only
|
|
330
|
-
// dropped this block — and hiding is done with `legend.disable` in
|
|
331
|
-
// `adaptSpecForMobile`. So on the phone card, which passes showLegend
|
|
332
|
-
// false, every legend that survived rendered in Vega's OWN default black:
|
|
333
|
-
// invisible on a dark card. Colours belong to the theme whether or not a
|
|
334
|
-
// caller expects a legend to appear.
|
|
335
|
-
legend: {
|
|
336
|
-
...showLegend ? { orient: legendOrientation, direction: "horizontal" } : {},
|
|
337
|
-
labelColor: mutedColor,
|
|
338
|
-
labelFontSize: 11,
|
|
339
|
-
labelFont: "Inter, sans-serif",
|
|
340
|
-
labelFontWeight: 400,
|
|
341
|
-
titleColor: textColor,
|
|
342
|
-
titleFontSize: 12,
|
|
343
|
-
titleFont: "Inter, sans-serif",
|
|
344
|
-
titleFontWeight: 500
|
|
345
|
-
},
|
|
346
|
-
title: {
|
|
347
|
-
color: showTitle ? textColor : "transparent",
|
|
348
|
-
fontSize: 14,
|
|
349
|
-
fontWeight: 600,
|
|
350
|
-
font: "Inter, sans-serif"
|
|
351
|
-
},
|
|
352
|
-
view: {
|
|
353
|
-
stroke: "transparent"
|
|
354
|
-
},
|
|
355
|
-
bar: {
|
|
356
|
-
cornerRadiusTopLeft: 2,
|
|
357
|
-
cornerRadiusTopRight: 2
|
|
358
|
-
},
|
|
359
|
-
line: {
|
|
360
|
-
strokeWidth: 2
|
|
361
|
-
},
|
|
362
|
-
point: {
|
|
363
|
-
size: 30,
|
|
364
|
-
filled: true
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
function ChartReadout({
|
|
369
|
-
label,
|
|
370
|
-
total,
|
|
371
|
-
rows,
|
|
372
|
-
pinned,
|
|
373
|
-
footer
|
|
374
|
-
}) {
|
|
375
|
-
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-lg border border-border bg-surface-raised", children: [
|
|
376
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-1.5", children: [
|
|
377
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: label }),
|
|
378
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: total })
|
|
379
|
-
] }),
|
|
380
|
-
pinned != null ? pinned : null,
|
|
381
|
-
/* @__PURE__ */ jsx("div", { className: "px-3 py-1", children: rows.map((r) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1 text-xs", children: [
|
|
382
|
-
/* @__PURE__ */ jsx(
|
|
383
|
-
"span",
|
|
384
|
-
{
|
|
385
|
-
"aria-hidden": true,
|
|
386
|
-
className: "size-2 shrink-0 rounded-full",
|
|
387
|
-
style: { background: r.color }
|
|
388
|
-
}
|
|
389
|
-
),
|
|
390
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground", children: r.label }),
|
|
391
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium tabular-nums", children: r.value }),
|
|
392
|
-
r.sub != null ? /* @__PURE__ */ jsx("span", { className: "w-12 text-right font-mono text-[11px] tabular-nums text-muted-foreground", children: r.sub }) : null
|
|
393
|
-
] }, r.key)) }),
|
|
394
|
-
footer != null ? /* @__PURE__ */ jsx("div", { className: "border-t border-border", children: footer }) : null
|
|
395
|
-
] });
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// ../../node_modules/d3-format/src/formatDecimal.js
|
|
399
|
-
function formatDecimal_default(x) {
|
|
400
|
-
return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
|
|
401
|
-
}
|
|
402
|
-
function formatDecimalParts(x, p) {
|
|
403
|
-
if (!isFinite(x) || x === 0) return null;
|
|
404
|
-
var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
|
|
405
|
-
return [
|
|
406
|
-
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
|
407
|
-
+x.slice(i + 1)
|
|
408
|
-
];
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// ../../node_modules/d3-format/src/exponent.js
|
|
412
|
-
function exponent_default(x) {
|
|
413
|
-
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// ../../node_modules/d3-format/src/formatGroup.js
|
|
417
|
-
function formatGroup_default(grouping, thousands) {
|
|
418
|
-
return function(value, width) {
|
|
419
|
-
var i = value.length, t = [], j = 0, g = grouping[0], length = 0;
|
|
420
|
-
while (i > 0 && g > 0) {
|
|
421
|
-
if (length + g + 1 > width) g = Math.max(1, width - length);
|
|
422
|
-
t.push(value.substring(i -= g, i + g));
|
|
423
|
-
if ((length += g + 1) > width) break;
|
|
424
|
-
g = grouping[j = (j + 1) % grouping.length];
|
|
425
|
-
}
|
|
426
|
-
return t.reverse().join(thousands);
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// ../../node_modules/d3-format/src/formatNumerals.js
|
|
431
|
-
function formatNumerals_default(numerals) {
|
|
432
|
-
return function(value) {
|
|
433
|
-
return value.replace(/[0-9]/g, function(i) {
|
|
434
|
-
return numerals[+i];
|
|
435
|
-
});
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// ../../node_modules/d3-format/src/formatSpecifier.js
|
|
440
|
-
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
441
|
-
function formatSpecifier(specifier) {
|
|
442
|
-
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
|
443
|
-
var match;
|
|
444
|
-
return new FormatSpecifier({
|
|
445
|
-
fill: match[1],
|
|
446
|
-
align: match[2],
|
|
447
|
-
sign: match[3],
|
|
448
|
-
symbol: match[4],
|
|
449
|
-
zero: match[5],
|
|
450
|
-
width: match[6],
|
|
451
|
-
comma: match[7],
|
|
452
|
-
precision: match[8] && match[8].slice(1),
|
|
453
|
-
trim: match[9],
|
|
454
|
-
type: match[10]
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
formatSpecifier.prototype = FormatSpecifier.prototype;
|
|
458
|
-
function FormatSpecifier(specifier) {
|
|
459
|
-
this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
|
|
460
|
-
this.align = specifier.align === void 0 ? ">" : specifier.align + "";
|
|
461
|
-
this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
|
|
462
|
-
this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
|
|
463
|
-
this.zero = !!specifier.zero;
|
|
464
|
-
this.width = specifier.width === void 0 ? void 0 : +specifier.width;
|
|
465
|
-
this.comma = !!specifier.comma;
|
|
466
|
-
this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
|
|
467
|
-
this.trim = !!specifier.trim;
|
|
468
|
-
this.type = specifier.type === void 0 ? "" : specifier.type + "";
|
|
469
|
-
}
|
|
470
|
-
FormatSpecifier.prototype.toString = function() {
|
|
471
|
-
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
// ../../node_modules/d3-format/src/formatTrim.js
|
|
475
|
-
function formatTrim_default(s) {
|
|
476
|
-
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
|
|
477
|
-
switch (s[i]) {
|
|
478
|
-
case ".":
|
|
479
|
-
i0 = i1 = i;
|
|
480
|
-
break;
|
|
481
|
-
case "0":
|
|
482
|
-
if (i0 === 0) i0 = i;
|
|
483
|
-
i1 = i;
|
|
484
|
-
break;
|
|
485
|
-
default:
|
|
486
|
-
if (!+s[i]) break out;
|
|
487
|
-
if (i0 > 0) i0 = 0;
|
|
488
|
-
break;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
// ../../node_modules/d3-format/src/formatPrefixAuto.js
|
|
495
|
-
var prefixExponent;
|
|
496
|
-
function formatPrefixAuto_default(x, p) {
|
|
497
|
-
var d = formatDecimalParts(x, p);
|
|
498
|
-
if (!d) return prefixExponent = void 0, x.toPrecision(p);
|
|
499
|
-
var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
|
|
500
|
-
return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// ../../node_modules/d3-format/src/formatRounded.js
|
|
504
|
-
function formatRounded_default(x, p) {
|
|
505
|
-
var d = formatDecimalParts(x, p);
|
|
506
|
-
if (!d) return x + "";
|
|
507
|
-
var coefficient = d[0], exponent = d[1];
|
|
508
|
-
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// ../../node_modules/d3-format/src/formatTypes.js
|
|
512
|
-
var formatTypes_default = {
|
|
513
|
-
"%": (x, p) => (x * 100).toFixed(p),
|
|
514
|
-
"b": (x) => Math.round(x).toString(2),
|
|
515
|
-
"c": (x) => x + "",
|
|
516
|
-
"d": formatDecimal_default,
|
|
517
|
-
"e": (x, p) => x.toExponential(p),
|
|
518
|
-
"f": (x, p) => x.toFixed(p),
|
|
519
|
-
"g": (x, p) => x.toPrecision(p),
|
|
520
|
-
"o": (x) => Math.round(x).toString(8),
|
|
521
|
-
"p": (x, p) => formatRounded_default(x * 100, p),
|
|
522
|
-
"r": formatRounded_default,
|
|
523
|
-
"s": formatPrefixAuto_default,
|
|
524
|
-
"X": (x) => Math.round(x).toString(16).toUpperCase(),
|
|
525
|
-
"x": (x) => Math.round(x).toString(16)
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
// ../../node_modules/d3-format/src/identity.js
|
|
529
|
-
function identity_default(x) {
|
|
530
|
-
return x;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
// ../../node_modules/d3-format/src/locale.js
|
|
534
|
-
var map = Array.prototype.map;
|
|
535
|
-
var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
536
|
-
function locale_default(locale2) {
|
|
537
|
-
var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
|
|
538
|
-
function newFormat(specifier, options) {
|
|
539
|
-
specifier = formatSpecifier(specifier);
|
|
540
|
-
var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
|
|
541
|
-
if (type === "n") comma = true, type = "g";
|
|
542
|
-
else if (!formatTypes_default[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
|
|
543
|
-
if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
|
|
544
|
-
var prefix = (options && options.prefix !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== void 0 ? options.suffix : "");
|
|
545
|
-
var formatType = formatTypes_default[type], maybeSuffix = /[defgprs%]/.test(type);
|
|
546
|
-
precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
|
|
547
|
-
function format2(value) {
|
|
548
|
-
var valuePrefix = prefix, valueSuffix = suffix, i, n, c;
|
|
549
|
-
if (type === "c") {
|
|
550
|
-
valueSuffix = formatType(value) + valueSuffix;
|
|
551
|
-
value = "";
|
|
552
|
-
} else {
|
|
553
|
-
value = +value;
|
|
554
|
-
var valueNegative = value < 0 || 1 / value < 0;
|
|
555
|
-
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
|
|
556
|
-
if (trim) value = formatTrim_default(value);
|
|
557
|
-
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
|
|
558
|
-
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
559
|
-
valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== void 0 ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
560
|
-
if (maybeSuffix) {
|
|
561
|
-
i = -1, n = value.length;
|
|
562
|
-
while (++i < n) {
|
|
563
|
-
if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
|
564
|
-
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
|
565
|
-
value = value.slice(0, i);
|
|
566
|
-
break;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
if (comma && !zero) value = group(value, Infinity);
|
|
572
|
-
var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
|
573
|
-
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
|
574
|
-
switch (align) {
|
|
575
|
-
case "<":
|
|
576
|
-
value = valuePrefix + value + valueSuffix + padding;
|
|
577
|
-
break;
|
|
578
|
-
case "=":
|
|
579
|
-
value = valuePrefix + padding + value + valueSuffix;
|
|
580
|
-
break;
|
|
581
|
-
case "^":
|
|
582
|
-
value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
|
|
583
|
-
break;
|
|
584
|
-
default:
|
|
585
|
-
value = padding + valuePrefix + value + valueSuffix;
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
return numerals(value);
|
|
589
|
-
}
|
|
590
|
-
format2.toString = function() {
|
|
591
|
-
return specifier + "";
|
|
592
|
-
};
|
|
593
|
-
return format2;
|
|
594
|
-
}
|
|
595
|
-
function formatPrefix2(specifier, value) {
|
|
596
|
-
var e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
|
|
597
|
-
return function(value2) {
|
|
598
|
-
return f(k * value2);
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
return {
|
|
602
|
-
format: newFormat,
|
|
603
|
-
formatPrefix: formatPrefix2
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
// ../../node_modules/d3-format/src/defaultLocale.js
|
|
608
|
-
var locale;
|
|
609
|
-
var format;
|
|
610
|
-
var formatPrefix;
|
|
611
|
-
defaultLocale({
|
|
612
|
-
thousands: ",",
|
|
613
|
-
grouping: [3],
|
|
614
|
-
currency: ["$", ""]
|
|
615
|
-
});
|
|
616
|
-
function defaultLocale(definition) {
|
|
617
|
-
locale = locale_default(definition);
|
|
618
|
-
format = locale.format;
|
|
619
|
-
formatPrefix = locale.formatPrefix;
|
|
620
|
-
return locale;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
// ../../node_modules/d3-format/src/precisionFixed.js
|
|
624
|
-
function precisionFixed_default(step) {
|
|
625
|
-
return Math.max(0, -exponent_default(Math.abs(step)));
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
// ../../node_modules/d3-format/src/precisionPrefix.js
|
|
629
|
-
function precisionPrefix_default(step, value) {
|
|
630
|
-
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// ../../node_modules/d3-format/src/precisionRound.js
|
|
634
|
-
function precisionRound_default(step, max) {
|
|
635
|
-
step = Math.abs(step), max = Math.abs(max) - step;
|
|
636
|
-
return Math.max(0, exponent_default(max) - exponent_default(step)) + 1;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
export { ChartBlockSkeleton, ChartErrorBoundary, ChartReadout, ChartTooltipContent, PRIMARY_COLOR, RECHARTS_THEME_CLS, RawJsonFallback, buildVegaTheme, format, formatCompact, formatPrefix, formatSpecifier, precisionFixed_default, precisionPrefix_default, precisionRound_default, resolveColor, useChartColors };
|