@gram-ai/elements 1.16.5 → 1.18.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/README.md +41 -11
- package/dist/components/Chat/index.stories.d.ts +42 -0
- package/dist/components/assistant-ui/tooltip-icon-button.d.ts +2 -1
- package/dist/components/ui/tool-ui.d.ts +60 -8
- package/dist/components/ui/tool-ui.stories.d.ts +14 -0
- package/dist/contexts/ToolApprovalContext.d.ts +24 -0
- package/dist/contexts/contexts.d.ts +4 -0
- package/dist/elements.cjs +42 -42
- package/dist/elements.css +1 -1
- package/dist/elements.js +8740 -8375
- package/dist/hooks/useMCPTools.d.ts +1 -1
- package/dist/hooks/useSession.d.ts +0 -4
- package/dist/hooks/useToolApproval.d.ts +5 -0
- package/dist/{index-Bjdy_BPv.js → index-1qi_Rje5.js} +61 -61
- package/dist/index-DY3aJC4I.cjs +16 -0
- package/dist/index.d.ts +2 -1
- package/dist/lib/tools.d.ts +21 -1
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.js +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +30 -26
- package/dist/types/index.d.ts +40 -4
- package/package.json +6 -9
- package/dist/contexts/elementsContextType.d.ts +0 -2
- package/dist/index-CqzaiyM-.cjs +0 -16
- package/dist/types/schemas.d.ts +0 -28
|
@@ -5,7 +5,7 @@ type MCPToolsResult = Awaited<ReturnType<Awaited<ReturnType<typeof createMCPClie
|
|
|
5
5
|
export declare function useMCPTools({ getSession, projectSlug, mcp, environment, }: {
|
|
6
6
|
getSession: GetSessionFn;
|
|
7
7
|
projectSlug: string;
|
|
8
|
-
mcp: string;
|
|
8
|
+
mcp: string | undefined;
|
|
9
9
|
environment: Record<string, unknown>;
|
|
10
10
|
}): UseQueryResult<MCPToolsResult, Error>;
|
|
11
11
|
export {};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { GetSessionFn } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Hook to fetch or retrieve the session token for the chat.
|
|
4
|
-
* If clientToken is provided in config, it will be used directly.
|
|
5
|
-
* Otherwise, if apiKey is provided, it will fetch a new session token.
|
|
6
|
-
*
|
|
7
|
-
* @param config - The ElementsConfig containing clientToken, apiKey, and projectSlug
|
|
8
4
|
* @returns The session token string or null
|
|
9
5
|
*/
|
|
10
6
|
export declare const useSession: ({ getSession, projectSlug, }: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as fe, jsx as te } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
2
|
+
import { createContext as Ce, useContext as We, forwardRef as ze, createElement as se, useRef as be, useState as _e, useMemo as Ue, useEffect as Be } from "react";
|
|
3
3
|
import { useAssistantState as $e } from "@assistant-ui/react";
|
|
4
4
|
import { parse as De, View as Je, Warn as qe } from "vega";
|
|
5
|
-
const Ye =
|
|
5
|
+
const Ye = Ce(
|
|
6
6
|
void 0
|
|
7
|
-
),
|
|
7
|
+
), or = Ce(null), Ae = () => {
|
|
8
8
|
const e = We(Ye);
|
|
9
9
|
if (!e)
|
|
10
10
|
throw new Error("useElements must be used within a ElementsProvider");
|
|
@@ -101,7 +101,7 @@ const Ye = Fe(
|
|
|
101
101
|
"text-subtitle": "text-lg"
|
|
102
102
|
}
|
|
103
103
|
}, Ze = () => {
|
|
104
|
-
const { config: e } =
|
|
104
|
+
const { config: e } = Ae(), r = e.theme?.density ?? "normal";
|
|
105
105
|
return (o) => Xe[r][o];
|
|
106
106
|
}, He = {
|
|
107
107
|
sharp: {
|
|
@@ -126,20 +126,20 @@ const Ye = Fe(
|
|
|
126
126
|
full: "rounded-full"
|
|
127
127
|
}
|
|
128
128
|
}, Ke = () => {
|
|
129
|
-
const { config: e } =
|
|
129
|
+
const { config: e } = Ae(), r = e.theme?.radius ?? "soft";
|
|
130
130
|
return (o) => He[r][o];
|
|
131
131
|
};
|
|
132
|
-
function
|
|
132
|
+
function Se(e) {
|
|
133
133
|
var r, o, t = "";
|
|
134
134
|
if (typeof e == "string" || typeof e == "number") t += e;
|
|
135
135
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
136
136
|
var a = e.length;
|
|
137
|
-
for (r = 0; r < a; r++) e[r] && (o =
|
|
137
|
+
for (r = 0; r < a; r++) e[r] && (o = Se(e[r])) && (t && (t += " "), t += o);
|
|
138
138
|
} else for (o in e) e[o] && (t && (t += " "), t += o);
|
|
139
139
|
return t;
|
|
140
140
|
}
|
|
141
141
|
function Qe() {
|
|
142
|
-
for (var e, r, o = 0, t = "", a = arguments.length; o < a; o++) (e = arguments[o]) && (r =
|
|
142
|
+
for (var e, r, o = 0, t = "", a = arguments.length; o < a; o++) (e = arguments[o]) && (r = Se(e)) && (t && (t += " "), t += r);
|
|
143
143
|
return t;
|
|
144
144
|
}
|
|
145
145
|
const et = (e, r) => {
|
|
@@ -152,7 +152,7 @@ const et = (e, r) => {
|
|
|
152
152
|
}, tt = (e, r) => ({
|
|
153
153
|
classGroupId: e,
|
|
154
154
|
validator: r
|
|
155
|
-
}),
|
|
155
|
+
}), Re = (e = /* @__PURE__ */ new Map(), r = null, o) => ({
|
|
156
156
|
nextPart: e,
|
|
157
157
|
validators: r,
|
|
158
158
|
classGroupId: o
|
|
@@ -166,7 +166,7 @@ const et = (e, r) => {
|
|
|
166
166
|
if (i.startsWith("[") && i.endsWith("]"))
|
|
167
167
|
return st(i);
|
|
168
168
|
const u = i.split(H), c = u[0] === "" && u.length > 1 ? 1 : 0;
|
|
169
|
-
return
|
|
169
|
+
return Ie(u, c, r);
|
|
170
170
|
},
|
|
171
171
|
getConflictingClassGroupIds: (i, u) => {
|
|
172
172
|
if (u) {
|
|
@@ -176,12 +176,12 @@ const et = (e, r) => {
|
|
|
176
176
|
return o[i] || he;
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
|
-
},
|
|
179
|
+
}, Ie = (e, r, o) => {
|
|
180
180
|
if (e.length - r === 0)
|
|
181
181
|
return o.classGroupId;
|
|
182
182
|
const a = e[r], l = o.nextPart.get(a);
|
|
183
183
|
if (l) {
|
|
184
|
-
const g =
|
|
184
|
+
const g = Ie(e, r + 1, l);
|
|
185
185
|
if (g) return g;
|
|
186
186
|
}
|
|
187
187
|
const i = o.validators;
|
|
@@ -203,7 +203,7 @@ const et = (e, r) => {
|
|
|
203
203
|
} = e;
|
|
204
204
|
return at(o, r);
|
|
205
205
|
}, at = (e, r) => {
|
|
206
|
-
const o =
|
|
206
|
+
const o = Re();
|
|
207
207
|
for (const t in e) {
|
|
208
208
|
const a = e[t];
|
|
209
209
|
ae(a, o, t, r);
|
|
@@ -226,7 +226,7 @@ const et = (e, r) => {
|
|
|
226
226
|
}
|
|
227
227
|
dt(e, r, o, t);
|
|
228
228
|
}, lt = (e, r, o) => {
|
|
229
|
-
const t = e === "" ? r :
|
|
229
|
+
const t = e === "" ? r : Ne(r, e);
|
|
230
230
|
t.classGroupId = o;
|
|
231
231
|
}, ct = (e, r, o, t) => {
|
|
232
232
|
if (pt(e)) {
|
|
@@ -238,15 +238,15 @@ const et = (e, r) => {
|
|
|
238
238
|
const a = Object.entries(e), l = a.length;
|
|
239
239
|
for (let i = 0; i < l; i++) {
|
|
240
240
|
const [u, c] = a[i];
|
|
241
|
-
ae(c,
|
|
241
|
+
ae(c, Ne(r, u), o, t);
|
|
242
242
|
}
|
|
243
|
-
},
|
|
243
|
+
}, Ne = (e, r) => {
|
|
244
244
|
let o = e;
|
|
245
245
|
const t = r.split(H), a = t.length;
|
|
246
246
|
for (let l = 0; l < a; l++) {
|
|
247
247
|
const i = t[l];
|
|
248
248
|
let u = o.nextPart.get(i);
|
|
249
|
-
u || (u =
|
|
249
|
+
u || (u = Re(), o.nextPart.set(i, u)), o = u;
|
|
250
250
|
}
|
|
251
251
|
return o;
|
|
252
252
|
}, pt = (e) => "isThemeGetter" in e && e.isThemeGetter === !0, mt = (e) => {
|
|
@@ -381,8 +381,8 @@ const et = (e, r) => {
|
|
|
381
381
|
continue;
|
|
382
382
|
i.push(P);
|
|
383
383
|
const G = a(E, k);
|
|
384
|
-
for (let
|
|
385
|
-
const _ = G[
|
|
384
|
+
for (let T = 0; T < G.length; ++T) {
|
|
385
|
+
const _ = G[T];
|
|
386
386
|
i.push(W + _);
|
|
387
387
|
}
|
|
388
388
|
c = f + (c.length > 0 ? " " + c : c);
|
|
@@ -391,14 +391,14 @@ const et = (e, r) => {
|
|
|
391
391
|
}, yt = (...e) => {
|
|
392
392
|
let r = 0, o, t, a = "";
|
|
393
393
|
for (; r < e.length; )
|
|
394
|
-
(o = e[r++]) && (t =
|
|
394
|
+
(o = e[r++]) && (t = Ee(o)) && (a && (a += " "), a += t);
|
|
395
395
|
return a;
|
|
396
|
-
},
|
|
396
|
+
}, Ee = (e) => {
|
|
397
397
|
if (typeof e == "string")
|
|
398
398
|
return e;
|
|
399
399
|
let r, o = "";
|
|
400
400
|
for (let t = 0; t < e.length; t++)
|
|
401
|
-
e[t] && (r =
|
|
401
|
+
e[t] && (r = Ee(e[t])) && (o && (o += " "), o += r);
|
|
402
402
|
return o;
|
|
403
403
|
}, wt = (e, ...r) => {
|
|
404
404
|
let o, t, a, l;
|
|
@@ -416,18 +416,18 @@ const et = (e, r) => {
|
|
|
416
416
|
}, kt = [], b = (e) => {
|
|
417
417
|
const r = (o) => o[e] || kt;
|
|
418
418
|
return r.isThemeGetter = !0, r;
|
|
419
|
-
},
|
|
419
|
+
}, Te = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, Me = /^\((?:(\w[\w-]*):)?(.+)\)$/i, vt = /^\d+\/\d+$/, Ct = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, zt = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, At = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, St = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, Rt = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, L = (e) => vt.test(e), m = (e) => !!e && !Number.isNaN(Number(e)), I = (e) => !!e && Number.isInteger(Number(e)), re = (e) => e.endsWith("%") && m(e.slice(0, -1)), R = (e) => Ct.test(e), It = () => !0, Nt = (e) => (
|
|
420
420
|
// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
|
|
421
421
|
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
422
422
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
423
423
|
zt.test(e) && !At.test(e)
|
|
424
|
-
), Oe = () => !1, Et = (e) => St.test(e),
|
|
425
|
-
const t =
|
|
424
|
+
), Oe = () => !1, Et = (e) => St.test(e), Tt = (e) => Rt.test(e), Mt = (e) => !s(e) && !n(e), Ot = (e) => V(e, je, Oe), s = (e) => Te.test(e), O = (e) => V(e, Le, Nt), oe = (e) => V(e, Vt, m), we = (e) => V(e, Pe, Oe), Pt = (e) => V(e, Ge, Tt), X = (e) => V(e, Ve, Et), n = (e) => Me.test(e), U = (e) => F(e, Le), Gt = (e) => F(e, Ft), ke = (e) => F(e, Pe), jt = (e) => F(e, je), Lt = (e) => F(e, Ge), Z = (e) => F(e, Ve, !0), V = (e, r, o) => {
|
|
425
|
+
const t = Te.exec(e);
|
|
426
426
|
return t ? t[1] ? r(t[1]) : o(t[2]) : !1;
|
|
427
427
|
}, F = (e, r, o = !1) => {
|
|
428
428
|
const t = Me.exec(e);
|
|
429
429
|
return t ? t[1] ? r(t[1]) : o : !1;
|
|
430
|
-
},
|
|
430
|
+
}, Pe = (e) => e === "position" || e === "percentage", Ge = (e) => e === "image" || e === "url", je = (e) => e === "length" || e === "size" || e === "bg-size", Le = (e) => e === "length", Vt = (e) => e === "number", Ft = (e) => e === "family-name", Ve = (e) => e === "shadow", Wt = () => {
|
|
431
431
|
const e = b("color"), r = b("font"), o = b("text"), t = b("font-weight"), a = b("tracking"), l = b("leading"), i = b("breakpoint"), u = b("container"), c = b("spacing"), g = b("radius"), f = b("shadow"), x = b("inset-shadow"), y = b("text-shadow"), z = b("drop-shadow"), N = b("blur"), C = b("perspective"), k = b("aspect"), E = b("ease"), B = b("animate"), W = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [
|
|
432
432
|
"center",
|
|
433
433
|
"top",
|
|
@@ -446,15 +446,15 @@ const et = (e, r) => {
|
|
|
446
446
|
"bottom-left",
|
|
447
447
|
// Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
|
|
448
448
|
"left-bottom"
|
|
449
|
-
], G = () => [...P(), n, s],
|
|
449
|
+
], G = () => [...P(), n, s], T = () => ["auto", "hidden", "clip", "visible", "scroll"], _ = () => ["auto", "contain", "none"], p = () => [n, s, c], A = () => [L, "full", "auto", ...p()], ie = () => [I, "none", "subgrid", n, s], le = () => ["auto", {
|
|
450
450
|
span: ["full", I, n, s]
|
|
451
|
-
}, I, n, s], $ = () => [I, "auto", n, s], ce = () => ["auto", "min", "max", "fr", n, s], K = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], j = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], S = () => ["auto", ...p()],
|
|
451
|
+
}, I, n, s], $ = () => [I, "auto", n, s], ce = () => ["auto", "min", "max", "fr", n, s], K = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], j = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], S = () => ["auto", ...p()], M = () => [L, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...p()], d = () => [e, n, s], de = () => [...P(), ke, we, {
|
|
452
452
|
position: [n, s]
|
|
453
453
|
}], pe = () => ["no-repeat", {
|
|
454
454
|
repeat: ["", "x", "y", "space", "round"]
|
|
455
|
-
}], me = () => ["auto", "cover", "contain", jt,
|
|
455
|
+
}], me = () => ["auto", "cover", "contain", jt, Ot, {
|
|
456
456
|
size: [n, s]
|
|
457
|
-
}], Q = () => [re, U,
|
|
457
|
+
}], Q = () => [re, U, O], w = () => [
|
|
458
458
|
// Deprecated since Tailwind CSS v4.0.0
|
|
459
459
|
"",
|
|
460
460
|
"none",
|
|
@@ -462,7 +462,7 @@ const et = (e, r) => {
|
|
|
462
462
|
g,
|
|
463
463
|
n,
|
|
464
464
|
s
|
|
465
|
-
], v = () => ["", m, U,
|
|
465
|
+
], v = () => ["", m, U, O], D = () => ["solid", "dashed", "dotted", "double"], ue = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], h = () => [m, re, ke, we], ge = () => [
|
|
466
466
|
// Deprecated since Tailwind CSS v4.0.0
|
|
467
467
|
"",
|
|
468
468
|
"none",
|
|
@@ -481,7 +481,7 @@ const et = (e, r) => {
|
|
|
481
481
|
container: [R],
|
|
482
482
|
"drop-shadow": [R],
|
|
483
483
|
ease: ["in", "out", "in-out"],
|
|
484
|
-
font: [
|
|
484
|
+
font: [Mt],
|
|
485
485
|
"font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
|
|
486
486
|
"inset-shadow": [R],
|
|
487
487
|
leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
|
|
@@ -600,21 +600,21 @@ const et = (e, r) => {
|
|
|
600
600
|
* @see https://tailwindcss.com/docs/overflow
|
|
601
601
|
*/
|
|
602
602
|
overflow: [{
|
|
603
|
-
overflow:
|
|
603
|
+
overflow: T()
|
|
604
604
|
}],
|
|
605
605
|
/**
|
|
606
606
|
* Overflow X
|
|
607
607
|
* @see https://tailwindcss.com/docs/overflow
|
|
608
608
|
*/
|
|
609
609
|
"overflow-x": [{
|
|
610
|
-
"overflow-x":
|
|
610
|
+
"overflow-x": T()
|
|
611
611
|
}],
|
|
612
612
|
/**
|
|
613
613
|
* Overflow Y
|
|
614
614
|
* @see https://tailwindcss.com/docs/overflow
|
|
615
615
|
*/
|
|
616
616
|
"overflow-y": [{
|
|
617
|
-
"overflow-y":
|
|
617
|
+
"overflow-y": T()
|
|
618
618
|
}],
|
|
619
619
|
/**
|
|
620
620
|
* Overscroll Behavior
|
|
@@ -1093,14 +1093,14 @@ const et = (e, r) => {
|
|
|
1093
1093
|
* @see https://tailwindcss.com/docs/width#setting-both-width-and-height
|
|
1094
1094
|
*/
|
|
1095
1095
|
size: [{
|
|
1096
|
-
size:
|
|
1096
|
+
size: M()
|
|
1097
1097
|
}],
|
|
1098
1098
|
/**
|
|
1099
1099
|
* Width
|
|
1100
1100
|
* @see https://tailwindcss.com/docs/width
|
|
1101
1101
|
*/
|
|
1102
1102
|
w: [{
|
|
1103
|
-
w: [u, "screen", ...
|
|
1103
|
+
w: [u, "screen", ...M()]
|
|
1104
1104
|
}],
|
|
1105
1105
|
/**
|
|
1106
1106
|
* Min-Width
|
|
@@ -1112,7 +1112,7 @@ const et = (e, r) => {
|
|
|
1112
1112
|
"screen",
|
|
1113
1113
|
/** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
|
|
1114
1114
|
"none",
|
|
1115
|
-
...
|
|
1115
|
+
...M()
|
|
1116
1116
|
]
|
|
1117
1117
|
}],
|
|
1118
1118
|
/**
|
|
@@ -1130,7 +1130,7 @@ const et = (e, r) => {
|
|
|
1130
1130
|
{
|
|
1131
1131
|
screen: [i]
|
|
1132
1132
|
},
|
|
1133
|
-
...
|
|
1133
|
+
...M()
|
|
1134
1134
|
]
|
|
1135
1135
|
}],
|
|
1136
1136
|
/**
|
|
@@ -1138,21 +1138,21 @@ const et = (e, r) => {
|
|
|
1138
1138
|
* @see https://tailwindcss.com/docs/height
|
|
1139
1139
|
*/
|
|
1140
1140
|
h: [{
|
|
1141
|
-
h: ["screen", "lh", ...
|
|
1141
|
+
h: ["screen", "lh", ...M()]
|
|
1142
1142
|
}],
|
|
1143
1143
|
/**
|
|
1144
1144
|
* Min-Height
|
|
1145
1145
|
* @see https://tailwindcss.com/docs/min-height
|
|
1146
1146
|
*/
|
|
1147
1147
|
"min-h": [{
|
|
1148
|
-
"min-h": ["screen", "lh", "none", ...
|
|
1148
|
+
"min-h": ["screen", "lh", "none", ...M()]
|
|
1149
1149
|
}],
|
|
1150
1150
|
/**
|
|
1151
1151
|
* Max-Height
|
|
1152
1152
|
* @see https://tailwindcss.com/docs/max-height
|
|
1153
1153
|
*/
|
|
1154
1154
|
"max-h": [{
|
|
1155
|
-
"max-h": ["screen", "lh", ...
|
|
1155
|
+
"max-h": ["screen", "lh", ...M()]
|
|
1156
1156
|
}],
|
|
1157
1157
|
// ------------------
|
|
1158
1158
|
// --- Typography ---
|
|
@@ -1162,7 +1162,7 @@ const et = (e, r) => {
|
|
|
1162
1162
|
* @see https://tailwindcss.com/docs/font-size
|
|
1163
1163
|
*/
|
|
1164
1164
|
"font-size": [{
|
|
1165
|
-
text: ["base", o, U,
|
|
1165
|
+
text: ["base", o, U, O]
|
|
1166
1166
|
}],
|
|
1167
1167
|
/**
|
|
1168
1168
|
* Font Smoothing
|
|
@@ -1310,7 +1310,7 @@ const et = (e, r) => {
|
|
|
1310
1310
|
* @see https://tailwindcss.com/docs/text-decoration-thickness
|
|
1311
1311
|
*/
|
|
1312
1312
|
"text-decoration-thickness": [{
|
|
1313
|
-
decoration: [m, "from-font", "auto", n,
|
|
1313
|
+
decoration: [m, "from-font", "auto", n, O]
|
|
1314
1314
|
}],
|
|
1315
1315
|
/**
|
|
1316
1316
|
* Text Decoration Color
|
|
@@ -1797,7 +1797,7 @@ const et = (e, r) => {
|
|
|
1797
1797
|
* @see https://tailwindcss.com/docs/outline-width
|
|
1798
1798
|
*/
|
|
1799
1799
|
"outline-w": [{
|
|
1800
|
-
outline: ["", m, U,
|
|
1800
|
+
outline: ["", m, U, O]
|
|
1801
1801
|
}],
|
|
1802
1802
|
/**
|
|
1803
1803
|
* Outline Color
|
|
@@ -1872,7 +1872,7 @@ const et = (e, r) => {
|
|
|
1872
1872
|
* @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
|
|
1873
1873
|
*/
|
|
1874
1874
|
"ring-offset-w": [{
|
|
1875
|
-
"ring-offset": [m,
|
|
1875
|
+
"ring-offset": [m, O]
|
|
1876
1876
|
}],
|
|
1877
1877
|
/**
|
|
1878
1878
|
* Ring Offset Color
|
|
@@ -2822,7 +2822,7 @@ const et = (e, r) => {
|
|
|
2822
2822
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2823
2823
|
*/
|
|
2824
2824
|
"stroke-w": [{
|
|
2825
|
-
stroke: [m, U,
|
|
2825
|
+
stroke: [m, U, O, oe]
|
|
2826
2826
|
}],
|
|
2827
2827
|
/**
|
|
2828
2828
|
* Stroke
|
|
@@ -2901,10 +2901,10 @@ const et = (e, r) => {
|
|
|
2901
2901
|
function Ut(...e) {
|
|
2902
2902
|
return _t(Qe(e));
|
|
2903
2903
|
}
|
|
2904
|
-
function
|
|
2904
|
+
function sr(e) {
|
|
2905
2905
|
throw new Error(`Unexpected value: ${e}`);
|
|
2906
2906
|
}
|
|
2907
|
-
function
|
|
2907
|
+
function nr(e, r) {
|
|
2908
2908
|
if (!e)
|
|
2909
2909
|
throw new Error(r);
|
|
2910
2910
|
}
|
|
@@ -2914,7 +2914,7 @@ const Bt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), $t = (
|
|
|
2914
2914
|
), ve = (e) => {
|
|
2915
2915
|
const r = $t(e);
|
|
2916
2916
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
2917
|
-
},
|
|
2917
|
+
}, Fe = (...e) => e.filter((r, o, t) => !!r && r.trim() !== "" && t.indexOf(r) === o).join(" ").trim(), Dt = (e) => {
|
|
2918
2918
|
for (const r in e)
|
|
2919
2919
|
if (r.startsWith("aria-") || r === "role" || r === "title")
|
|
2920
2920
|
return !0;
|
|
@@ -2930,7 +2930,7 @@ var Jt = {
|
|
|
2930
2930
|
strokeLinecap: "round",
|
|
2931
2931
|
strokeLinejoin: "round"
|
|
2932
2932
|
};
|
|
2933
|
-
const qt =
|
|
2933
|
+
const qt = ze(
|
|
2934
2934
|
({
|
|
2935
2935
|
color: e = "currentColor",
|
|
2936
2936
|
size: r = 24,
|
|
@@ -2949,7 +2949,7 @@ const qt = Ce(
|
|
|
2949
2949
|
height: r,
|
|
2950
2950
|
stroke: e,
|
|
2951
2951
|
strokeWidth: t ? Number(o) * 24 / Number(r) : o,
|
|
2952
|
-
className:
|
|
2952
|
+
className: Fe("lucide", a),
|
|
2953
2953
|
...!l && !Dt(u) && { "aria-hidden": "true" },
|
|
2954
2954
|
...u
|
|
2955
2955
|
},
|
|
@@ -2960,11 +2960,11 @@ const qt = Ce(
|
|
|
2960
2960
|
)
|
|
2961
2961
|
);
|
|
2962
2962
|
const Yt = (e, r) => {
|
|
2963
|
-
const o =
|
|
2963
|
+
const o = ze(
|
|
2964
2964
|
({ className: t, ...a }, l) => se(qt, {
|
|
2965
2965
|
ref: l,
|
|
2966
2966
|
iconNode: r,
|
|
2967
|
-
className:
|
|
2967
|
+
className: Fe(
|
|
2968
2968
|
`lucide-${Bt(ve(e))}`,
|
|
2969
2969
|
`lucide-${e}`,
|
|
2970
2970
|
t
|
|
@@ -3024,7 +3024,7 @@ const Xt = [
|
|
|
3024
3024
|
);
|
|
3025
3025
|
}, Kt = {
|
|
3026
3026
|
language: "vega",
|
|
3027
|
-
prompt: `When a user requests a chart or visualization, respond with a valid Vega specification (https://vega.github.io/vega/) in a code block with language 'vega'.
|
|
3027
|
+
prompt: `When a user requests a chart or visualization, respond with a valid Vega specification (https://vega.github.io/vega/) in a code block annotated with the language identifier 'vega'.
|
|
3028
3028
|
|
|
3029
3029
|
CRITICAL JSON REQUIREMENTS:
|
|
3030
3030
|
- The code block MUST contain ONLY valid, parseable JSON
|
|
@@ -3042,18 +3042,18 @@ CONTENT GUIDELINES:
|
|
|
3042
3042
|
The Vega spec will be parsed with JSON.parse() - if it fails, the chart will error. Ensure strict JSON validity.`,
|
|
3043
3043
|
Component: Ht,
|
|
3044
3044
|
Header: void 0
|
|
3045
|
-
},
|
|
3045
|
+
}, ar = [Kt];
|
|
3046
3046
|
export {
|
|
3047
|
-
Zt as C,
|
|
3048
3047
|
Ye as E,
|
|
3049
|
-
|
|
3048
|
+
or as T,
|
|
3049
|
+
nr as a,
|
|
3050
3050
|
Qe as b,
|
|
3051
3051
|
Yt as c,
|
|
3052
3052
|
Ut as d,
|
|
3053
3053
|
Ze as e,
|
|
3054
3054
|
Ke as f,
|
|
3055
|
-
|
|
3055
|
+
sr as g,
|
|
3056
3056
|
Kt as h,
|
|
3057
|
-
|
|
3058
|
-
|
|
3057
|
+
ar as r,
|
|
3058
|
+
Ae as u
|
|
3059
3059
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";const B=require("react/jsx-runtime"),C=require("react"),$e=require("@assistant-ui/react"),oe=require("vega"),Ce=C.createContext(void 0),De=C.createContext(null),ie=()=>{const e=C.useContext(Ce);if(!e)throw new Error("useElements must be used within a ElementsProvider");return e},qe={compact:{"p-xs":"p-1","p-sm":"p-1.5","p-md":"p-2","p-lg":"p-2.5","p-xl":"p-3","px-xs":"px-1","px-sm":"px-1.5","px-md":"px-2","px-lg":"px-2.5","px-xl":"px-3","py-xs":"py-1","py-sm":"py-1.5","py-md":"py-2","py-lg":"py-2.5","py-xl":"py-3","gap-sm":"gap-1","gap-md":"gap-1.5","gap-lg":"gap-2","gap-xl":"gap-2.5","h-header":"h-10","h-input":"min-h-10","text-base":"text-sm","text-title":"text-xl","text-subtitle":"text-sm"},normal:{"p-xs":"p-1","p-sm":"p-2","p-md":"p-3","p-lg":"p-4","p-xl":"p-6","px-xs":"px-1","px-sm":"px-2","px-md":"px-3","px-lg":"px-4","px-xl":"px-6","py-xs":"py-1","py-sm":"py-2","py-md":"py-3","py-lg":"py-4","py-xl":"py-6","gap-sm":"gap-1.5","gap-md":"gap-2","gap-lg":"gap-3","gap-xl":"gap-4","h-header":"h-12","h-input":"min-h-12","text-base":"text-base","text-title":"text-2xl","text-subtitle":"text-base"},spacious:{"p-xs":"p-2","p-sm":"p-3","p-md":"p-4","p-lg":"p-6","p-xl":"p-10","px-xs":"px-2","px-sm":"px-3","px-md":"px-4","px-lg":"px-6","px-xl":"px-10","py-xs":"py-2","py-sm":"py-3","py-md":"py-4","py-lg":"py-6","py-xl":"py-10","gap-sm":"gap-2","gap-md":"gap-3","gap-lg":"gap-4","gap-xl":"gap-6","h-header":"h-14","h-input":"min-h-16","text-base":"text-lg","text-title":"text-3xl","text-subtitle":"text-lg"}},ze=()=>{const{config:e}=ie(),r=e.theme?.density??"normal";return o=>qe[r][o]},Je={sharp:{sm:"rounded-sm",md:"rounded",lg:"rounded-md",xl:"rounded-lg",full:"rounded-lg"},soft:{sm:"rounded",md:"rounded-lg",lg:"rounded-xl",xl:"rounded-2xl",full:"rounded-full"},round:{sm:"rounded-lg",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-3xl",full:"rounded-full"}},Ae=()=>{const{config:e}=ie(),r=e.theme?.radius??"soft";return o=>Je[r][o]};function Se(e){var r,o,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(o=Se(e[r]))&&(t&&(t+=" "),t+=o)}else for(o in e)e[o]&&(t&&(t+=" "),t+=o);return t}function Re(){for(var e,r,o=0,t="",a=arguments.length;o<a;o++)(e=arguments[o])&&(r=Se(e))&&(t&&(t+=" "),t+=r);return t}const Ye=(e,r)=>{const o=new Array(e.length+r.length);for(let t=0;t<e.length;t++)o[t]=e[t];for(let t=0;t<r.length;t++)o[e.length+t]=r[t];return o},Xe=(e,r)=>({classGroupId:e,validator:r}),Ie=(e=new Map,r=null,o)=>({nextPart:e,validators:r,classGroupId:o}),Q="-",he=[],Ze="arbitrary..",He=e=>{const r=Qe(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Ke(i);const u=i.split(Q),c=u[0]===""&&u.length>1?1:0;return Ne(u,c,r)},getConflictingClassGroupIds:(i,u)=>{if(u){const c=t[i],g=o[i];return c?g?Ye(g,c):c:g||he}return o[i]||he}}},Ne=(e,r,o)=>{if(e.length-r===0)return o.classGroupId;const a=e[r],l=o.nextPart.get(a);if(l){const g=Ne(e,r+1,l);if(g)return g}const i=o.validators;if(i===null)return;const u=r===0?e.join(Q):e.slice(r).join(Q),c=i.length;for(let g=0;g<c;g++){const f=i[g];if(f.validator(u))return f.classGroupId}},Ke=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=e.slice(1,-1),o=r.indexOf(":"),t=r.slice(0,o);return t?Ze+t:void 0})(),Qe=e=>{const{theme:r,classGroups:o}=e;return et(o,r)},et=(e,r)=>{const o=Ie();for(const t in e){const a=e[t];le(a,o,t,r)}return o},le=(e,r,o,t)=>{const a=e.length;for(let l=0;l<a;l++){const i=e[l];tt(i,r,o,t)}},tt=(e,r,o,t)=>{if(typeof e=="string"){rt(e,r,o);return}if(typeof e=="function"){ot(e,r,o,t);return}st(e,r,o,t)},rt=(e,r,o)=>{const t=e===""?r:Ee(r,e);t.classGroupId=o},ot=(e,r,o,t)=>{if(nt(e)){le(e(t),r,o,t);return}r.validators===null&&(r.validators=[]),r.validators.push(Xe(o,e))},st=(e,r,o,t)=>{const a=Object.entries(e),l=a.length;for(let i=0;i<l;i++){const[u,c]=a[i];le(c,Ee(r,u),o,t)}},Ee=(e,r)=>{let o=e;const t=r.split(Q),a=t.length;for(let l=0;l<a;l++){const i=t[l];let u=o.nextPart.get(i);u||(u=Ie(),o.nextPart.set(i,u)),o=u}return o},nt=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,at=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,o=Object.create(null),t=Object.create(null);const a=(l,i)=>{o[l]=i,r++,r>e&&(r=0,t=o,o=Object.create(null))};return{get(l){let i=o[l];if(i!==void 0)return i;if((i=t[l])!==void 0)return a(l,i),i},set(l,i){l in o?o[l]=i:a(l,i)}}},ae="!",xe=":",it=[],ye=(e,r,o,t,a)=>({modifiers:e,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:t,isExternal:a}),lt=e=>{const{prefix:r,experimentalParseClassName:o}=e;let t=a=>{const l=[];let i=0,u=0,c=0,g;const f=a.length;for(let z=0;z<f;z++){const k=a[z];if(i===0&&u===0){if(k===xe){l.push(a.slice(c,z)),c=z+1;continue}if(k==="/"){g=z;continue}}k==="["?i++:k==="]"?i--:k==="("?u++:k===")"&&u--}const x=l.length===0?a:a.slice(c);let y=x,A=!1;x.endsWith(ae)?(y=x.slice(0,-1),A=!0):x.startsWith(ae)&&(y=x.slice(1),A=!0);const E=g&&g>c?g-c:void 0;return ye(l,A,y,E)};if(r){const a=r+xe,l=t;t=i=>i.startsWith(a)?l(i.slice(a.length)):ye(it,!1,i,void 0,!0)}if(o){const a=t;t=l=>o({className:l,parseClassName:a})}return t},ct=e=>{const r=new Map;return e.orderSensitiveModifiers.forEach((o,t)=>{r.set(o,1e6+t)}),o=>{const t=[];let a=[];for(let l=0;l<o.length;l++){const i=o[l],u=i[0]==="[",c=r.has(i);u||c?(a.length>0&&(a.sort(),t.push(...a),a=[]),t.push(i)):a.push(i)}return a.length>0&&(a.sort(),t.push(...a)),t}},dt=e=>({cache:at(e.cacheSize),parseClassName:lt(e),sortModifiers:ct(e),...He(e)}),pt=/\s+/,mt=(e,r)=>{const{parseClassName:o,getClassGroupId:t,getConflictingClassGroupIds:a,sortModifiers:l}=r,i=[],u=e.trim().split(pt);let c="";for(let g=u.length-1;g>=0;g-=1){const f=u[g],{isExternal:x,modifiers:y,hasImportantModifier:A,baseClassName:E,maybePostfixModifierPosition:z}=o(f);if(x){c=f+(c.length>0?" "+c:c);continue}let k=!!z,T=t(k?E.substring(0,z):E);if(!T){if(!k){c=f+(c.length>0?" "+c:c);continue}if(T=t(E),!T){c=f+(c.length>0?" "+c:c);continue}k=!1}const D=y.length===0?"":y.length===1?y[0]:l(y).join(":"),_=A?D+ae:D,j=_+T;if(i.indexOf(j)>-1)continue;i.push(j);const G=a(T,k);for(let M=0;M<G.length;++M){const U=G[M];i.push(_+U)}c=f+(c.length>0?" "+c:c)}return c},ut=(...e)=>{let r=0,o,t,a="";for(;r<e.length;)(o=e[r++])&&(t=Te(o))&&(a&&(a+=" "),a+=t);return a},Te=e=>{if(typeof e=="string")return e;let r,o="";for(let t=0;t<e.length;t++)e[t]&&(r=Te(e[t]))&&(o&&(o+=" "),o+=r);return o},gt=(e,...r)=>{let o,t,a,l;const i=c=>{const g=r.reduce((f,x)=>x(f),e());return o=dt(g),t=o.cache.get,a=o.cache.set,l=u,u(c)},u=c=>{const g=t(c);if(g)return g;const f=mt(c,o);return a(c,f),f};return l=i,(...c)=>l(ut(...c))},ft=[],b=e=>{const r=o=>o[e]||ft;return r.isThemeGetter=!0,r},Me=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oe=/^\((?:(\w[\w-]*):)?(.+)\)$/i,bt=/^\d+\/\d+$/,ht=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,V=e=>bt.test(e),m=e=>!!e&&!Number.isNaN(Number(e)),N=e=>!!e&&Number.isInteger(Number(e)),se=e=>e.endsWith("%")&&m(e.slice(0,-1)),I=e=>ht.test(e),vt=()=>!0,Ct=e=>xt.test(e)&&!yt.test(e),Pe=()=>!1,zt=e=>wt.test(e),At=e=>kt.test(e),St=e=>!s(e)&&!n(e),Rt=e=>F(e,Le,Pe),s=e=>Me.test(e),P=e=>F(e,Ve,Ct),ne=e=>F(e,Mt,m),we=e=>F(e,je,Pe),It=e=>F(e,Ge,At),H=e=>F(e,Fe,zt),n=e=>Oe.test(e),$=e=>W(e,Ve),Nt=e=>W(e,Ot),ke=e=>W(e,je),Et=e=>W(e,Le),Tt=e=>W(e,Ge),K=e=>W(e,Fe,!0),F=(e,r,o)=>{const t=Me.exec(e);return t?t[1]?r(t[1]):o(t[2]):!1},W=(e,r,o=!1)=>{const t=Oe.exec(e);return t?t[1]?r(t[1]):o:!1},je=e=>e==="position"||e==="percentage",Ge=e=>e==="image"||e==="url",Le=e=>e==="length"||e==="size"||e==="bg-size",Ve=e=>e==="length",Mt=e=>e==="number",Ot=e=>e==="family-name",Fe=e=>e==="shadow",Pt=()=>{const e=b("color"),r=b("font"),o=b("text"),t=b("font-weight"),a=b("tracking"),l=b("leading"),i=b("breakpoint"),u=b("container"),c=b("spacing"),g=b("radius"),f=b("shadow"),x=b("inset-shadow"),y=b("text-shadow"),A=b("drop-shadow"),E=b("blur"),z=b("perspective"),k=b("aspect"),T=b("ease"),D=b("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],G=()=>[...j(),n,s],M=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],p=()=>[n,s,c],S=()=>[V,"full","auto",...p()],ce=()=>[N,"none","subgrid",n,s],de=()=>["auto",{span:["full",N,n,s]},N,n,s],q=()=>[N,"auto",n,s],pe=()=>["auto","min","max","fr",n,s],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...p()],O=()=>[V,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...p()],d=()=>[e,n,s],me=()=>[...j(),ke,we,{position:[n,s]}],ue=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ge=()=>["auto","cover","contain",Et,Rt,{size:[n,s]}],te=()=>[se,$,P],w=()=>["","none","full",g,n,s],v=()=>["",m,$,P],J=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],h=()=>[m,se,ke,we],be=()=>["","none",E,n,s],Y=()=>["none",m,n,s],X=()=>["none",m,n,s],re=()=>[m,n,s],Z=()=>[V,"full",...p()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[I],breakpoint:[I],color:[vt],container:[I],"drop-shadow":[I],ease:["in","out","in-out"],font:[St],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[I],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[I],shadow:[I],spacing:["px",m],text:[I],"text-shadow":[I],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",V,s,n,k]}],container:["container"],columns:[{columns:[m,s,n,u]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:G()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{start:S()}],end:[{end:S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[N,"auto",n,s]}],basis:[{basis:[V,"full","auto",u,...p()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[m,V,"auto","initial","none",s]}],grow:[{grow:["",m,n,s]}],shrink:[{shrink:["",m,n,s]}],order:[{order:[N,"first","last","none",n,s]}],"grid-cols":[{"grid-cols":ce()}],"col-start-end":[{col:de()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":ce()}],"row-start-end":[{row:de()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":pe()}],"auto-rows":[{"auto-rows":pe()}],gap:[{gap:p()}],"gap-x":[{"gap-x":p()}],"gap-y":[{"gap-y":p()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:p()}],px:[{px:p()}],py:[{py:p()}],ps:[{ps:p()}],pe:[{pe:p()}],pt:[{pt:p()}],pr:[{pr:p()}],pb:[{pb:p()}],pl:[{pl:p()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":p()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":p()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],w:[{w:[u,"screen",...O()]}],"min-w":[{"min-w":[u,"screen","none",...O()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[i]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",o,$,P]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,n,ne]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",se,s]}],"font-family":[{font:[Nt,s,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,n,s]}],"line-clamp":[{"line-clamp":[m,"none",n,ne]}],leading:[{leading:[l,...p()]}],"list-image":[{"list-image":["none",n,s]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",n,s]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:d()}],"text-color":[{text:d()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[m,"from-font","auto",n,P]}],"text-decoration-color":[{decoration:d()}],"underline-offset":[{"underline-offset":[m,"auto",n,s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:p()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",n,s]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",n,s]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:me()}],"bg-repeat":[{bg:ue()}],"bg-size":[{bg:ge()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},N,n,s],radial:["",n,s],conic:[N,n,s]},Tt,It]}],"bg-color":[{bg:d()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:d()}],"gradient-via":[{via:d()}],"gradient-to":[{to:d()}],rounded:[{rounded:w()}],"rounded-s":[{"rounded-s":w()}],"rounded-e":[{"rounded-e":w()}],"rounded-t":[{"rounded-t":w()}],"rounded-r":[{"rounded-r":w()}],"rounded-b":[{"rounded-b":w()}],"rounded-l":[{"rounded-l":w()}],"rounded-ss":[{"rounded-ss":w()}],"rounded-se":[{"rounded-se":w()}],"rounded-ee":[{"rounded-ee":w()}],"rounded-es":[{"rounded-es":w()}],"rounded-tl":[{"rounded-tl":w()}],"rounded-tr":[{"rounded-tr":w()}],"rounded-br":[{"rounded-br":w()}],"rounded-bl":[{"rounded-bl":w()}],"border-w":[{border:v()}],"border-w-x":[{"border-x":v()}],"border-w-y":[{"border-y":v()}],"border-w-s":[{"border-s":v()}],"border-w-e":[{"border-e":v()}],"border-w-t":[{"border-t":v()}],"border-w-r":[{"border-r":v()}],"border-w-b":[{"border-b":v()}],"border-w-l":[{"border-l":v()}],"divide-x":[{"divide-x":v()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":v()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:d()}],"border-color-x":[{"border-x":d()}],"border-color-y":[{"border-y":d()}],"border-color-s":[{"border-s":d()}],"border-color-e":[{"border-e":d()}],"border-color-t":[{"border-t":d()}],"border-color-r":[{"border-r":d()}],"border-color-b":[{"border-b":d()}],"border-color-l":[{"border-l":d()}],"divide-color":[{divide:d()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[m,n,s]}],"outline-w":[{outline:["",m,$,P]}],"outline-color":[{outline:d()}],shadow:[{shadow:["","none",f,K,H]}],"shadow-color":[{shadow:d()}],"inset-shadow":[{"inset-shadow":["none",x,K,H]}],"inset-shadow-color":[{"inset-shadow":d()}],"ring-w":[{ring:v()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:d()}],"ring-offset-w":[{"ring-offset":[m,P]}],"ring-offset-color":[{"ring-offset":d()}],"inset-ring-w":[{"inset-ring":v()}],"inset-ring-color":[{"inset-ring":d()}],"text-shadow":[{"text-shadow":["none",y,K,H]}],"text-shadow-color":[{"text-shadow":d()}],opacity:[{opacity:[m,n,s]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[m]}],"mask-image-linear-from-pos":[{"mask-linear-from":h()}],"mask-image-linear-to-pos":[{"mask-linear-to":h()}],"mask-image-linear-from-color":[{"mask-linear-from":d()}],"mask-image-linear-to-color":[{"mask-linear-to":d()}],"mask-image-t-from-pos":[{"mask-t-from":h()}],"mask-image-t-to-pos":[{"mask-t-to":h()}],"mask-image-t-from-color":[{"mask-t-from":d()}],"mask-image-t-to-color":[{"mask-t-to":d()}],"mask-image-r-from-pos":[{"mask-r-from":h()}],"mask-image-r-to-pos":[{"mask-r-to":h()}],"mask-image-r-from-color":[{"mask-r-from":d()}],"mask-image-r-to-color":[{"mask-r-to":d()}],"mask-image-b-from-pos":[{"mask-b-from":h()}],"mask-image-b-to-pos":[{"mask-b-to":h()}],"mask-image-b-from-color":[{"mask-b-from":d()}],"mask-image-b-to-color":[{"mask-b-to":d()}],"mask-image-l-from-pos":[{"mask-l-from":h()}],"mask-image-l-to-pos":[{"mask-l-to":h()}],"mask-image-l-from-color":[{"mask-l-from":d()}],"mask-image-l-to-color":[{"mask-l-to":d()}],"mask-image-x-from-pos":[{"mask-x-from":h()}],"mask-image-x-to-pos":[{"mask-x-to":h()}],"mask-image-x-from-color":[{"mask-x-from":d()}],"mask-image-x-to-color":[{"mask-x-to":d()}],"mask-image-y-from-pos":[{"mask-y-from":h()}],"mask-image-y-to-pos":[{"mask-y-to":h()}],"mask-image-y-from-color":[{"mask-y-from":d()}],"mask-image-y-to-color":[{"mask-y-to":d()}],"mask-image-radial":[{"mask-radial":[n,s]}],"mask-image-radial-from-pos":[{"mask-radial-from":h()}],"mask-image-radial-to-pos":[{"mask-radial-to":h()}],"mask-image-radial-from-color":[{"mask-radial-from":d()}],"mask-image-radial-to-color":[{"mask-radial-to":d()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[m]}],"mask-image-conic-from-pos":[{"mask-conic-from":h()}],"mask-image-conic-to-pos":[{"mask-conic-to":h()}],"mask-image-conic-from-color":[{"mask-conic-from":d()}],"mask-image-conic-to-color":[{"mask-conic-to":d()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:me()}],"mask-repeat":[{mask:ue()}],"mask-size":[{mask:ge()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",n,s]}],filter:[{filter:["","none",n,s]}],blur:[{blur:be()}],brightness:[{brightness:[m,n,s]}],contrast:[{contrast:[m,n,s]}],"drop-shadow":[{"drop-shadow":["","none",A,K,H]}],"drop-shadow-color":[{"drop-shadow":d()}],grayscale:[{grayscale:["",m,n,s]}],"hue-rotate":[{"hue-rotate":[m,n,s]}],invert:[{invert:["",m,n,s]}],saturate:[{saturate:[m,n,s]}],sepia:[{sepia:["",m,n,s]}],"backdrop-filter":[{"backdrop-filter":["","none",n,s]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[m,n,s]}],"backdrop-contrast":[{"backdrop-contrast":[m,n,s]}],"backdrop-grayscale":[{"backdrop-grayscale":["",m,n,s]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m,n,s]}],"backdrop-invert":[{"backdrop-invert":["",m,n,s]}],"backdrop-opacity":[{"backdrop-opacity":[m,n,s]}],"backdrop-saturate":[{"backdrop-saturate":[m,n,s]}],"backdrop-sepia":[{"backdrop-sepia":["",m,n,s]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":p()}],"border-spacing-x":[{"border-spacing-x":p()}],"border-spacing-y":[{"border-spacing-y":p()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",n,s]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[m,"initial",n,s]}],ease:[{ease:["linear","initial",T,n,s]}],delay:[{delay:[m,n,s]}],animate:[{animate:["none",D,n,s]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[z,n,s]}],"perspective-origin":[{"perspective-origin":G()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[n,s,"","none","gpu","cpu"]}],"transform-origin":[{origin:G()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Z()}],"translate-x":[{"translate-x":Z()}],"translate-y":[{"translate-y":Z()}],"translate-z":[{"translate-z":Z()}],"translate-none":["translate-none"],accent:[{accent:d()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:d()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",n,s]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":p()}],"scroll-mx":[{"scroll-mx":p()}],"scroll-my":[{"scroll-my":p()}],"scroll-ms":[{"scroll-ms":p()}],"scroll-me":[{"scroll-me":p()}],"scroll-mt":[{"scroll-mt":p()}],"scroll-mr":[{"scroll-mr":p()}],"scroll-mb":[{"scroll-mb":p()}],"scroll-ml":[{"scroll-ml":p()}],"scroll-p":[{"scroll-p":p()}],"scroll-px":[{"scroll-px":p()}],"scroll-py":[{"scroll-py":p()}],"scroll-ps":[{"scroll-ps":p()}],"scroll-pe":[{"scroll-pe":p()}],"scroll-pt":[{"scroll-pt":p()}],"scroll-pr":[{"scroll-pr":p()}],"scroll-pb":[{"scroll-pb":p()}],"scroll-pl":[{"scroll-pl":p()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",n,s]}],fill:[{fill:["none",...d()]}],"stroke-w":[{stroke:[m,$,P,ne]}],stroke:[{stroke:["none",...d()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},jt=gt(Pt);function We(...e){return jt(Re(e))}function Gt(e){throw new Error(`Unexpected value: ${e}`)}function Lt(e,r){if(!e)throw new Error(r)}const Vt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ft=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,o,t)=>t?t.toUpperCase():o.toLowerCase()),ve=e=>{const r=Ft(e);return r.charAt(0).toUpperCase()+r.slice(1)},_e=(...e)=>e.filter((r,o,t)=>!!r&&r.trim()!==""&&t.indexOf(r)===o).join(" ").trim(),Wt=e=>{for(const r in e)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};var _t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ut=C.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:t,className:a="",children:l,iconNode:i,...u},c)=>C.createElement("svg",{ref:c,..._t,width:r,height:r,stroke:e,strokeWidth:t?Number(o)*24/Number(r):o,className:_e("lucide",a),...!l&&!Wt(u)&&{"aria-hidden":"true"},...u},[...i.map(([g,f])=>C.createElement(g,f)),...Array.isArray(l)?l:[l]]));const Ue=(e,r)=>{const o=C.forwardRef(({className:t,...a},l)=>C.createElement(Ut,{ref:l,iconNode:r,className:_e(`lucide-${Vt(ve(e))}`,`lucide-${e}`,t),...a}));return o.displayName=ve(e),o};const Bt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],$t=Ue("circle-alert",Bt),Dt=({code:e})=>{const r=$e.useAssistantState(({message:x})=>x),o=C.useRef(null),t=C.useRef(null),[a,l]=C.useState(null),i=r.status?.type==="complete",u=Ae(),c=ze(),g=C.useMemo(()=>{const x=e.trim();if(!x)return null;try{return JSON.parse(x)}catch{return null}},[e]),f=i&&g!==null;return C.useEffect(()=>!o.current||!f?void 0:(l(null),(async()=>{try{t.current&&(t.current.finalize(),t.current=null);const y=oe.parse(g),A=new oe.View(y,{container:o.current??void 0,renderer:"svg",hover:!0,logLevel:oe.Warn});t.current=A,await A.runAsync()}catch(y){console.error("Failed to render chart:",y),l(y instanceof Error?y.message:"Failed to render chart")}})(),()=>{t.current&&(t.current.finalize(),t.current=null)}),[f,g]),B.jsxs("div",{className:We("relative flex min-h-[400px] w-fit max-w-full min-w-[400px] items-center justify-center border p-6 after:hidden",u("lg"),c("p-lg")),children:[!f&&!a&&B.jsx("div",{className:"shimmer text-muted-foreground bg-background/80 absolute inset-0 z-10 flex items-center justify-center",children:"Rendering chart..."}),a&&B.jsxs("div",{className:"bg-background absolute inset-0 z-10 flex items-center justify-center gap-2 text-rose-500",children:[B.jsx($t,{name:"alert-circle",className:"h-4 w-4"}),a]}),B.jsx("div",{ref:o,className:f?"block":"hidden"})]})},Be={language:"vega",prompt:`When a user requests a chart or visualization, respond with a valid Vega specification (https://vega.github.io/vega/) in a code block annotated with the language identifier 'vega'.
|
|
2
|
+
|
|
3
|
+
CRITICAL JSON REQUIREMENTS:
|
|
4
|
+
- The code block MUST contain ONLY valid, parseable JSON
|
|
5
|
+
- NO comments (no // or /* */ anywhere)
|
|
6
|
+
- NO trailing commas
|
|
7
|
+
- Use double quotes for all strings and keys
|
|
8
|
+
- NO text before or after the JSON object
|
|
9
|
+
- The JSON must start with { and end with }
|
|
10
|
+
|
|
11
|
+
CONTENT GUIDELINES:
|
|
12
|
+
- Outside the code block, describe trends and insights found in the data
|
|
13
|
+
- Do not describe visual properties or technical implementation details
|
|
14
|
+
- Do not mention "Vega" or other technical terms - this is user-facing
|
|
15
|
+
|
|
16
|
+
The Vega spec will be parsed with JSON.parse() - if it fails, the chart will error. Ensure strict JSON validity.`,Component:Dt,Header:void 0},qt=[Be];exports.ElementsContext=Ce;exports.ToolApprovalContext=De;exports.assert=Lt;exports.assertNever=Gt;exports.chart=Be;exports.clsx=Re;exports.cn=We;exports.createLucideIcon=Ue;exports.recommended=qt;exports.useDensity=ze;exports.useElements=ie;exports.useRadius=Ae;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { useElements as useGramElements } from './hooks/useElements';
|
|
|
3
3
|
export { Chat } from './components/Chat';
|
|
4
4
|
export { defineFrontendTool } from './lib/tools';
|
|
5
5
|
export type { FrontendTool } from './lib/tools';
|
|
6
|
-
export type { ElementsProviderProps, ElementsConfig, ComposerConfig, AttachmentsConfig, ModalConfig, SidecarConfig, ToolsConfig, ModelConfig, ThemeConfig, WelcomeConfig, Suggestion, Model, ModalTriggerPosition, ColorScheme, Radius, Density, Variant, Dimensions, Dimension, ComponentOverrides, } from './types';
|
|
6
|
+
export type { ElementsProviderProps, ElementsConfig, ComposerConfig, AttachmentsConfig, ModalConfig, SidecarConfig, ToolsConfig, ModelConfig, ThemeConfig, WelcomeConfig, Suggestion, Model, ModalTriggerPosition, ColorScheme, COLOR_SCHEMES, GetSessionFn, Radius, RADII, Density, DENSITIES, VARIANTS, Variant, Dimensions, Dimension, ComponentOverrides, } from './types';
|
|
7
|
+
export { MODELS } from './lib/models';
|
|
7
8
|
export type { Plugin } from './types/plugins';
|
package/dist/lib/tools.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONSchema7 } from 'ai';
|
|
1
|
+
import { JSONSchema7, ToolSet } from 'ai';
|
|
2
2
|
import { AssistantToolProps, Tool } from '@assistant-ui/react';
|
|
3
3
|
import { FC } from 'react';
|
|
4
4
|
/**
|
|
@@ -22,7 +22,27 @@ export declare const getEnabledTools: (tools: Record<string, Tool>) => {
|
|
|
22
22
|
export type FrontendTool<TArgs extends Record<string, unknown>, TResult> = FC<AssistantToolProps<TArgs, TResult>> & {
|
|
23
23
|
unstable_tool: AssistantToolProps<TArgs, TResult>;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Sets the approval configuration. Called by ElementsProvider.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setFrontendToolApprovalConfig(helpers: ApprovalHelpers, toolsRequiringApproval: string[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Clears the approval configuration. Called when ElementsProvider unmounts.
|
|
31
|
+
*/
|
|
32
|
+
export declare function clearFrontendToolApprovalConfig(): void;
|
|
25
33
|
/**
|
|
26
34
|
* Make a frontend tool
|
|
27
35
|
*/
|
|
28
36
|
export declare const defineFrontendTool: <TArgs extends Record<string, unknown>, TResult>(tool: Tool, name: string) => FrontendTool<TArgs, TResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Helpers for requesting and tracking tool approval state.
|
|
39
|
+
*/
|
|
40
|
+
export interface ApprovalHelpers {
|
|
41
|
+
requestApproval: (toolName: string, toolCallId: string, args: unknown) => Promise<boolean>;
|
|
42
|
+
isToolApproved: (toolName: string) => boolean;
|
|
43
|
+
whitelistTool: (toolName: string) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Wraps tools with approval logic based on the approval config.
|
|
47
|
+
*/
|
|
48
|
+
export declare function wrapToolsWithApproval(tools: ToolSet, toolsRequiringApproval: string[] | undefined, approvalHelpers: ApprovalHelpers): ToolSet;
|
package/dist/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DY3aJC4I.cjs");exports.chart=e.chart;exports.recommended=e.recommended;
|
package/dist/plugins.js
CHANGED
package/dist/server.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=()=>({session:c}),c=async(t,r,s)=>{const n=process.env.GRAM_API_URL??"https://app.getgram.ai";if(t.method==="POST"){const a=Array.isArray(t.headers["gram-project"])?t.headers["gram-project"][0]:t.headers["gram-project"];fetch(n+"/rpc/chatSessions.create",{method:"POST",body:JSON.stringify({embed_origin:s?.embedOrigin,user_identifier:s?.userIdentifier,expires_after:s?.expiresAfter}),headers:{"Content-Type":"application/json","Gram-Project":typeof a=="string"?a:"","Gram-Key":process.env.GRAM_API_KEY??""}}).then(async e=>{const i=await e.text();r.writeHead(e.status,{"Content-Type":"application/json"}),r.end(i)}).catch(e=>{console.error("Failed to create chat session:",e),r.writeHead(500,{"Content-Type":"application/json"}),r.end(JSON.stringify({error:"Failed to create chat session: "+e.message}))})}};exports.createElementsServerHandlers=o;
|