@mechane-ai/elements 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai.js +139 -133
- package/dist/packages/ai/src/conversation.d.ts +5 -1
- package/package.json +1 -1
package/dist/ai.js
CHANGED
|
@@ -5,62 +5,68 @@ import { c as f, d as p } from "./src-BVsyKLQ8.js";
|
|
|
5
5
|
import { c as m, u as h } from "./src-R0kgHFPZ.js";
|
|
6
6
|
import { t as g } from "./accessibility-C-aIZ1Yx.js";
|
|
7
7
|
import * as _ from "@stylexjs/stylex";
|
|
8
|
-
import { createContext as v, useContext as y, useId as b,
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { ArrowDown as
|
|
11
|
-
import { MessageScroller as
|
|
8
|
+
import { createContext as v, useContext as y, useId as b, useLayoutEffect as x, useRef as S, useState as C } from "react";
|
|
9
|
+
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
10
|
+
import { ArrowDown as E, ArrowUp as D, File as O, GitBranch as k, Square as A } from "lucide-react";
|
|
11
|
+
import { MessageScroller as j, useMessageScroller as M, useMessageScrollerScrollable as N } from "@shadcn/react/message-scroller";
|
|
12
12
|
// packages/ai/src/approval.tsx
|
|
13
|
-
function
|
|
14
|
-
return /* @__PURE__ */
|
|
13
|
+
function P(t) {
|
|
14
|
+
return /* @__PURE__ */ T("section", {
|
|
15
15
|
"aria-label": t.title,
|
|
16
16
|
"data-request-id": t.requestId,
|
|
17
17
|
className: "x78zum5 xdt5ytf x1n8ia3y xeuugli x1c8xbx5 xmkeg23 x1y0btm7 x1ey3b81 x1ok0vyi xpvm0e4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
18
18
|
children: [
|
|
19
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ w("h3", {
|
|
20
20
|
className: "x1ghz6dp xtqrqnz x1778rvt xk4h15q xj0a0fe",
|
|
21
21
|
children: t.title
|
|
22
22
|
}),
|
|
23
|
-
t.description !== void 0 && /* @__PURE__ */
|
|
23
|
+
t.description !== void 0 && /* @__PURE__ */ w("p", {
|
|
24
24
|
className: "x1ghz6dp x153jb6y xj0a0fe",
|
|
25
25
|
children: t.description
|
|
26
26
|
}),
|
|
27
27
|
t.children,
|
|
28
|
-
t.status === "pending" ? /* @__PURE__ */
|
|
28
|
+
t.status === "pending" ? /* @__PURE__ */ T(i, { children: [/* @__PURE__ */ w(e, {
|
|
29
29
|
variant: "solid",
|
|
30
30
|
onClick: t.onApprove,
|
|
31
31
|
disabled: t.isDisabled === !0 || t.busy !== void 0,
|
|
32
32
|
isPending: t.busy === "approve",
|
|
33
33
|
pendingLabel: "Approving…",
|
|
34
34
|
children: t.approveLabel ?? "Approve"
|
|
35
|
-
}), /* @__PURE__ */
|
|
35
|
+
}), /* @__PURE__ */ w(e, {
|
|
36
36
|
onClick: t.onDeny,
|
|
37
37
|
disabled: t.isDisabled === !0 || t.busy !== void 0,
|
|
38
38
|
isPending: t.busy === "deny",
|
|
39
39
|
pendingLabel: "Denying…",
|
|
40
40
|
children: t.denyLabel ?? "Deny"
|
|
41
|
-
})] }) : /* @__PURE__ */
|
|
41
|
+
})] }) : /* @__PURE__ */ w(s, { children: t.statusLabel })
|
|
42
42
|
]
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
// packages/ai/src/conversation.tsx
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
let i =
|
|
49
|
-
return
|
|
46
|
+
var F = v(void 0);
|
|
47
|
+
function I({ children: e, initialPosition: t = "end", shouldFollow: n = !0, viewportRef: r }) {
|
|
48
|
+
let i = S(null), a = r ?? i, [o] = C(t);
|
|
49
|
+
return x(() => {
|
|
50
|
+
typeof o == "object" && a.current?.scrollTo({
|
|
51
|
+
top: o.top,
|
|
52
|
+
left: o.left ?? 0,
|
|
53
|
+
behavior: "instant"
|
|
54
|
+
});
|
|
55
|
+
}, [o, a]), /* @__PURE__ */ w(F.Provider, {
|
|
50
56
|
value: a,
|
|
51
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ w(j.Provider, {
|
|
52
58
|
autoScroll: n,
|
|
53
|
-
defaultScrollPosition:
|
|
54
|
-
children: /* @__PURE__ */
|
|
59
|
+
defaultScrollPosition: typeof o == "object" ? "start" : o,
|
|
60
|
+
children: /* @__PURE__ */ w(j.Root, {
|
|
55
61
|
className: "x1n2onr6 x78zum5 xdt5ytf x5yr21d x2lwn1j xeuugli xpvm0e4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
56
62
|
children: e
|
|
57
63
|
})
|
|
58
64
|
})
|
|
59
65
|
});
|
|
60
66
|
}
|
|
61
|
-
function
|
|
62
|
-
let r = y(
|
|
63
|
-
return /* @__PURE__ */
|
|
67
|
+
function L({ label: e, children: t, scrollRestorationId: n }) {
|
|
68
|
+
let r = y(F);
|
|
69
|
+
return /* @__PURE__ */ w(j.Viewport, {
|
|
64
70
|
ref: r,
|
|
65
71
|
"aria-label": e,
|
|
66
72
|
"data-scroll-restoration-id": n,
|
|
@@ -68,8 +74,8 @@ function F({ label: e, children: t, scrollRestorationId: n }) {
|
|
|
68
74
|
children: t
|
|
69
75
|
});
|
|
70
76
|
}
|
|
71
|
-
function
|
|
72
|
-
return /* @__PURE__ */
|
|
77
|
+
function R({ children: e, isStreaming: t = !1 }) {
|
|
78
|
+
return /* @__PURE__ */ w(j.Content, {
|
|
73
79
|
"aria-live": "polite",
|
|
74
80
|
"aria-relevant": "additions",
|
|
75
81
|
"aria-busy": t,
|
|
@@ -77,50 +83,50 @@ function I({ children: e, isStreaming: t = !1 }) {
|
|
|
77
83
|
children: e
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
|
-
function
|
|
81
|
-
return /* @__PURE__ */
|
|
86
|
+
function z({ messageId: e, children: t }) {
|
|
87
|
+
return /* @__PURE__ */ w(j.Item, {
|
|
82
88
|
messageId: e,
|
|
83
89
|
className: "xeuugli xj0a0fe",
|
|
84
90
|
children: t
|
|
85
91
|
});
|
|
86
92
|
}
|
|
87
|
-
function
|
|
88
|
-
return /* @__PURE__ */
|
|
93
|
+
function B({ children: e }) {
|
|
94
|
+
return /* @__PURE__ */ w("div", {
|
|
89
95
|
className: "x9f619 x2lah0s xeuugli xh8yej3 xe10afn xvueqy4 xn9t2bk x1m92p3w",
|
|
90
96
|
children: e
|
|
91
97
|
});
|
|
92
98
|
}
|
|
93
|
-
function
|
|
94
|
-
let { end: t } =
|
|
95
|
-
return t ? /* @__PURE__ */
|
|
99
|
+
function V({ label: e = "Jump to latest" }) {
|
|
100
|
+
let { end: t } = N();
|
|
101
|
+
return t ? /* @__PURE__ */ w("div", {
|
|
96
102
|
className: "x10l6tqk xwthv0x x1nrll8i xuuh30 x1tv4vx4 xeuugli",
|
|
97
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ w(H, { label: e })
|
|
98
104
|
}) : null;
|
|
99
105
|
}
|
|
100
|
-
function
|
|
101
|
-
let { scrollToEnd: r } =
|
|
102
|
-
return /* @__PURE__ */
|
|
106
|
+
function H({ label: t, onActivate: n }) {
|
|
107
|
+
let { scrollToEnd: r } = M(), i = y(F);
|
|
108
|
+
return /* @__PURE__ */ T(e, {
|
|
103
109
|
onClick: () => {
|
|
104
110
|
n?.(), requestAnimationFrame(() => {
|
|
105
111
|
let e = i?.current;
|
|
106
112
|
e != null && (r({ behavior: "instant" }), e.focus({ preventScroll: !0 }));
|
|
107
113
|
});
|
|
108
114
|
},
|
|
109
|
-
children: [/* @__PURE__ */
|
|
115
|
+
children: [/* @__PURE__ */ w(E, {
|
|
110
116
|
size: 14,
|
|
111
117
|
"aria-hidden": !0
|
|
112
118
|
}), t]
|
|
113
119
|
});
|
|
114
120
|
}
|
|
115
|
-
var
|
|
116
|
-
Root:
|
|
117
|
-
Viewport:
|
|
118
|
-
Content:
|
|
119
|
-
Item:
|
|
120
|
-
Controls:
|
|
121
|
-
LatestButton:
|
|
122
|
-
JumpToLatest:
|
|
123
|
-
},
|
|
121
|
+
var U = {
|
|
122
|
+
Root: I,
|
|
123
|
+
Viewport: L,
|
|
124
|
+
Content: R,
|
|
125
|
+
Item: z,
|
|
126
|
+
Controls: B,
|
|
127
|
+
LatestButton: H,
|
|
128
|
+
JumpToLatest: V
|
|
129
|
+
}, W = {
|
|
124
130
|
root: {
|
|
125
131
|
k1xSpc: "x78zum5",
|
|
126
132
|
kXwgrk: "xdt5ytf",
|
|
@@ -146,72 +152,72 @@ var V = {
|
|
|
146
152
|
k8WAf4: "xn9t2bk",
|
|
147
153
|
$$css: !0
|
|
148
154
|
}
|
|
149
|
-
},
|
|
150
|
-
user:
|
|
151
|
-
assistant:
|
|
152
|
-
system:
|
|
153
|
-
},
|
|
155
|
+
}, G = {
|
|
156
|
+
user: W.user,
|
|
157
|
+
assistant: W.assistant,
|
|
158
|
+
system: W.system
|
|
159
|
+
}, K = {
|
|
154
160
|
"x-default-marker": "x-default-marker",
|
|
155
161
|
$$css: !0
|
|
156
162
|
};
|
|
157
|
-
function
|
|
158
|
-
return /* @__PURE__ */
|
|
163
|
+
function q({ author: e, children: t, id: n, kind: r = "assistant", meta: i, avatar: a, actions: o, attachments: s }) {
|
|
164
|
+
return /* @__PURE__ */ T("article", {
|
|
159
165
|
id: n,
|
|
160
166
|
"aria-label": e,
|
|
161
|
-
..._.props(
|
|
167
|
+
..._.props(W.root, G[r], K),
|
|
162
168
|
children: [
|
|
163
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ T("header", {
|
|
164
170
|
className: "x78zum5 x6s0dn4 x1hnptsi x1a02dak xeuugli",
|
|
165
171
|
children: [
|
|
166
|
-
a !== void 0 && /* @__PURE__ */
|
|
172
|
+
a !== void 0 && /* @__PURE__ */ w("span", {
|
|
167
173
|
className: "x3nfvp2 x2lah0s",
|
|
168
174
|
children: a
|
|
169
175
|
}),
|
|
170
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ w("span", {
|
|
171
177
|
className: "xk4h15q xeuugli xj0a0fe",
|
|
172
178
|
children: e
|
|
173
179
|
}),
|
|
174
|
-
i !== void 0 && /* @__PURE__ */
|
|
180
|
+
i !== void 0 && /* @__PURE__ */ w("div", {
|
|
175
181
|
className: "x153jb6y xy8obcc xas2l8k xeuugli xj0a0fe",
|
|
176
182
|
children: i
|
|
177
183
|
})
|
|
178
184
|
]
|
|
179
185
|
}),
|
|
180
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ w("div", {
|
|
181
187
|
className: "xeuugli xj0a0fe x1ytb0s6",
|
|
182
188
|
children: t
|
|
183
189
|
}),
|
|
184
|
-
s !== void 0 && /* @__PURE__ */
|
|
190
|
+
s !== void 0 && /* @__PURE__ */ w("div", {
|
|
185
191
|
className: "x78zum5 x1a02dak x1qjc9v5 x1hnptsi xeuugli",
|
|
186
192
|
children: s
|
|
187
193
|
}),
|
|
188
|
-
o !== void 0 && /* @__PURE__ */
|
|
194
|
+
o !== void 0 && /* @__PURE__ */ w("footer", {
|
|
189
195
|
className: "x78zum5 x1a02dak x6s0dn4 xeuugli xunmzkg x1hc1fzr x12vu8c0 xtf8l8m x1thm12b",
|
|
190
196
|
children: o
|
|
191
197
|
})
|
|
192
198
|
]
|
|
193
199
|
});
|
|
194
200
|
}
|
|
195
|
-
function
|
|
196
|
-
return /* @__PURE__ */
|
|
201
|
+
function J({ name: e, description: t, href: n, actions: r }) {
|
|
202
|
+
return /* @__PURE__ */ T("div", {
|
|
197
203
|
className: "x78zum5 x1a02dak x6s0dn4 x1n8ia3y xeuugli x193iq5w x1mvvolr xmkeg23 x1y0btm7 x1ey3b81 x1ok0vyi xpvm0e4 x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
198
204
|
children: [
|
|
199
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ w(O, {
|
|
200
206
|
size: 16,
|
|
201
207
|
"aria-hidden": !0,
|
|
202
208
|
className: "x153jb6y x2lah0s"
|
|
203
209
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ T("div", {
|
|
205
211
|
className: "x78zum5 xdt5ytf xfko13i x1slnebi xeuugli xj0a0fe",
|
|
206
|
-
children: [n === void 0 ? /* @__PURE__ */
|
|
212
|
+
children: [n === void 0 ? /* @__PURE__ */ w("span", { children: e }) : /* @__PURE__ */ w(l, {
|
|
207
213
|
href: n,
|
|
208
214
|
children: e
|
|
209
|
-
}), t !== void 0 && /* @__PURE__ */
|
|
215
|
+
}), t !== void 0 && /* @__PURE__ */ w("span", {
|
|
210
216
|
className: "x153jb6y xy8obcc xas2l8k xeuugli xj0a0fe",
|
|
211
217
|
children: t
|
|
212
218
|
})]
|
|
213
219
|
}),
|
|
214
|
-
r !== void 0 && /* @__PURE__ */
|
|
220
|
+
r !== void 0 && /* @__PURE__ */ w("div", {
|
|
215
221
|
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli",
|
|
216
222
|
children: r
|
|
217
223
|
})
|
|
@@ -219,103 +225,103 @@ function K({ name: e, description: t, href: n, actions: r }) {
|
|
|
219
225
|
});
|
|
220
226
|
}
|
|
221
227
|
// packages/ai/src/message-action.tsx
|
|
222
|
-
function
|
|
228
|
+
function Y(e) {
|
|
223
229
|
if (e.kind === "link") {
|
|
224
230
|
let { kind: t, label: n, ...i } = e;
|
|
225
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ w(r, {
|
|
226
232
|
...i,
|
|
227
233
|
"aria-label": n
|
|
228
234
|
});
|
|
229
235
|
}
|
|
230
236
|
let { kind: t, label: n, ...i } = e;
|
|
231
|
-
return /* @__PURE__ */
|
|
237
|
+
return /* @__PURE__ */ w(c, {
|
|
232
238
|
...i,
|
|
233
239
|
variant: "ghost",
|
|
234
240
|
"aria-label": n
|
|
235
241
|
});
|
|
236
242
|
}
|
|
237
|
-
function
|
|
238
|
-
return /* @__PURE__ */
|
|
243
|
+
function X(e) {
|
|
244
|
+
return /* @__PURE__ */ T(d.Root, { children: [/* @__PURE__ */ w(d.Trigger, { render: Y(e) }), /* @__PURE__ */ w(d.Portal, { children: /* @__PURE__ */ w(d.Positioner, { children: /* @__PURE__ */ w(d.Popup, { children: e.label }) }) })] });
|
|
239
245
|
}
|
|
240
246
|
// packages/ai/src/message-boundary.tsx
|
|
241
|
-
function
|
|
242
|
-
return /* @__PURE__ */
|
|
247
|
+
function Z({ label: e, children: t }) {
|
|
248
|
+
return /* @__PURE__ */ T(a.Root, {
|
|
243
249
|
className: "xeuugli x1kbiq1m xykt701 xpu655y",
|
|
244
|
-
children: [/* @__PURE__ */
|
|
250
|
+
children: [/* @__PURE__ */ T(a.Trigger, {
|
|
245
251
|
className: "xlqzeqv x1hnptsi x153jb6y xy8obcc xas2l8k xj57cvi",
|
|
246
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ w(k, {
|
|
247
253
|
size: 14,
|
|
248
254
|
"aria-hidden": !0,
|
|
249
255
|
className: "x2lah0s"
|
|
250
|
-
}), /* @__PURE__ */
|
|
256
|
+
}), /* @__PURE__ */ w("span", {
|
|
251
257
|
className: "xeuugli xj0a0fe",
|
|
252
258
|
children: e
|
|
253
259
|
})]
|
|
254
|
-
}), /* @__PURE__ */
|
|
260
|
+
}), /* @__PURE__ */ w(a.Panel, {
|
|
255
261
|
className: "x153jb6y xy8obcc xas2l8k",
|
|
256
262
|
children: t
|
|
257
263
|
})]
|
|
258
264
|
});
|
|
259
265
|
}
|
|
260
266
|
// packages/ai/src/prompt-input.tsx
|
|
261
|
-
var
|
|
267
|
+
var Q = { action: {
|
|
262
268
|
keTefX: "xvc5jky",
|
|
263
269
|
$$css: !0
|
|
264
270
|
} };
|
|
265
|
-
function
|
|
266
|
-
return /* @__PURE__ */
|
|
271
|
+
function $({ isCompact: e = !1 }) {
|
|
272
|
+
return /* @__PURE__ */ w("div", {
|
|
267
273
|
"aria-hidden": !0,
|
|
268
274
|
inert: !0,
|
|
269
275
|
className: "x78zum5 xdt5ytf x1hnptsi xeuugli xh8yej3 xe10afn xvueqy4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
270
|
-
children: /* @__PURE__ */
|
|
276
|
+
children: /* @__PURE__ */ T("div", {
|
|
271
277
|
className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1mvvolr xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb x1gd1hh4 x1u8w8hx x14xc8xn x1nvizq4 xgzwmep",
|
|
272
|
-
children: [/* @__PURE__ */
|
|
278
|
+
children: [/* @__PURE__ */ w("div", {
|
|
273
279
|
..._.props(n.base, n.field, n.textarea, n.plainTextarea),
|
|
274
|
-
children: /* @__PURE__ */
|
|
280
|
+
children: /* @__PURE__ */ w(p, {
|
|
275
281
|
lines: e ? 1 : 2,
|
|
276
282
|
width: "22ch"
|
|
277
283
|
})
|
|
278
|
-
}), /* @__PURE__ */
|
|
284
|
+
}), /* @__PURE__ */ T("div", {
|
|
279
285
|
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi",
|
|
280
|
-
children: [/* @__PURE__ */
|
|
286
|
+
children: [/* @__PURE__ */ w("div", {
|
|
281
287
|
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli x12lumcd xy8obcc xas2l8k",
|
|
282
|
-
children: /* @__PURE__ */
|
|
283
|
-
}), /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ w(p, { width: "8ch" })
|
|
289
|
+
}), /* @__PURE__ */ w(f, {
|
|
284
290
|
isIconOnly: !0,
|
|
285
|
-
xstyle:
|
|
291
|
+
xstyle: Q.action
|
|
286
292
|
})]
|
|
287
293
|
})]
|
|
288
294
|
})
|
|
289
295
|
});
|
|
290
296
|
}
|
|
291
|
-
function
|
|
297
|
+
function ee({ label: e, value: t, onValueChange: n, onSubmit: r, name: i = "prompt", placeholder: a, maxLength: o, required: s = !0, isPending: l = !1, disabled: u = !1, isSubmitDisabled: f = !1, submitLabel: p = "Send message", pendingLabel: v = "Sending…", enterBehavior: y = "newline", isCompact: x = !1, description: S, error: C, controls: E, attachments: O, onStop: k, isStopPending: j = !1, stopLabel: M = "Stop response" }) {
|
|
292
298
|
let N = b(), P = u || l, F = p;
|
|
293
|
-
|
|
299
|
+
k === void 0 ? l ? F = v : y === "submit" && (F = `${p} · Enter`) : F = j ? "Stopping…" : M;
|
|
294
300
|
function I(e) {
|
|
295
301
|
if (y !== "submit" || e.key !== "Enter" || e.repeat) return;
|
|
296
302
|
let t = e.altKey || e.ctrlKey || e.metaKey;
|
|
297
|
-
e.shiftKey || t || e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229 || (e.preventDefault(), !P && !f &&
|
|
303
|
+
e.shiftKey || t || e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229 || (e.preventDefault(), !P && !f && k === void 0 && e.currentTarget.form?.requestSubmit());
|
|
298
304
|
}
|
|
299
305
|
function L(e) {
|
|
300
|
-
e.preventDefault(), !P && !f &&
|
|
306
|
+
e.preventDefault(), !P && !f && k === void 0 && r(e);
|
|
301
307
|
}
|
|
302
|
-
return /* @__PURE__ */
|
|
308
|
+
return /* @__PURE__ */ w("form", {
|
|
303
309
|
onSubmit: L,
|
|
304
310
|
className: "x78zum5 xdt5ytf x1hnptsi xeuugli xh8yej3 xe10afn xvueqy4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
305
|
-
children: /* @__PURE__ */
|
|
306
|
-
invalid:
|
|
311
|
+
children: /* @__PURE__ */ T(m.Root, {
|
|
312
|
+
invalid: C !== void 0,
|
|
307
313
|
children: [
|
|
308
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ w(m.Label, {
|
|
309
315
|
..._.props(g.hidden),
|
|
310
316
|
children: e
|
|
311
317
|
}),
|
|
312
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ T("div", {
|
|
313
319
|
...{
|
|
314
320
|
0: { className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1mvvolr xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb x1gd1hh4 x1u8w8hx x14xc8xn x1nvizq4 xgzwmep" },
|
|
315
321
|
1: { className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1mvvolr xmkeg23 x1y0btm7 xy32g2j x1r7kqkb x1gd1hh4 x1u8w8hx x14xc8xn x1nvizq4 xgzwmep x1oddvo6" }
|
|
316
|
-
}[
|
|
322
|
+
}[C !== void 0 | 0],
|
|
317
323
|
children: [
|
|
318
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ w(h, {
|
|
319
325
|
appearance: "plain",
|
|
320
326
|
rows: x ? 1 : 2,
|
|
321
327
|
isCompact: x,
|
|
@@ -328,75 +334,75 @@ function Q({ label: e, value: t, onValueChange: n, onSubmit: r, name: i = "promp
|
|
|
328
334
|
required: s,
|
|
329
335
|
disabled: u,
|
|
330
336
|
readOnly: l,
|
|
331
|
-
"aria-errormessage":
|
|
337
|
+
"aria-errormessage": C === void 0 ? void 0 : N
|
|
332
338
|
}),
|
|
333
|
-
|
|
334
|
-
/* @__PURE__ */
|
|
339
|
+
O,
|
|
340
|
+
/* @__PURE__ */ T("div", {
|
|
335
341
|
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi",
|
|
336
|
-
children: [
|
|
342
|
+
children: [E !== void 0 && /* @__PURE__ */ w("div", {
|
|
337
343
|
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli x12lumcd",
|
|
338
|
-
children:
|
|
339
|
-
}), /* @__PURE__ */
|
|
340
|
-
xstyle:
|
|
344
|
+
children: E
|
|
345
|
+
}), /* @__PURE__ */ T(d.Root, { children: [/* @__PURE__ */ w(d.Trigger, { render: k === void 0 ? /* @__PURE__ */ w(c, {
|
|
346
|
+
xstyle: Q.action,
|
|
341
347
|
type: "submit",
|
|
342
348
|
variant: "solid",
|
|
343
349
|
"aria-label": l ? v : p,
|
|
344
350
|
disabled: u || f,
|
|
345
351
|
isPending: l,
|
|
346
|
-
children: /* @__PURE__ */
|
|
352
|
+
children: /* @__PURE__ */ w(D, {
|
|
347
353
|
size: 16,
|
|
348
354
|
"aria-hidden": !0
|
|
349
355
|
})
|
|
350
|
-
}) : /* @__PURE__ */
|
|
351
|
-
xstyle:
|
|
356
|
+
}) : /* @__PURE__ */ w(c, {
|
|
357
|
+
xstyle: Q.action,
|
|
352
358
|
type: "button",
|
|
353
359
|
"aria-label": j ? "Stopping…" : M,
|
|
354
360
|
onClick: (e) => {
|
|
355
|
-
e.preventDefault(),
|
|
361
|
+
e.preventDefault(), k();
|
|
356
362
|
},
|
|
357
363
|
disabled: u,
|
|
358
364
|
isPending: j,
|
|
359
|
-
children: /* @__PURE__ */
|
|
365
|
+
children: /* @__PURE__ */ w(A, {
|
|
360
366
|
size: 14,
|
|
361
367
|
"aria-hidden": !0
|
|
362
368
|
})
|
|
363
|
-
}) }), /* @__PURE__ */
|
|
369
|
+
}) }), /* @__PURE__ */ w(d.Portal, { children: /* @__PURE__ */ w(d.Positioner, { children: /* @__PURE__ */ w(d.Popup, { children: F }) }) })] })]
|
|
364
370
|
})
|
|
365
371
|
]
|
|
366
372
|
}),
|
|
367
|
-
|
|
368
|
-
|
|
373
|
+
S !== void 0 && /* @__PURE__ */ w(m.Description, { children: S }),
|
|
374
|
+
C !== void 0 && /* @__PURE__ */ w(m.Error, {
|
|
369
375
|
id: N,
|
|
370
376
|
match: !0,
|
|
371
377
|
role: "alert",
|
|
372
|
-
children:
|
|
378
|
+
children: C
|
|
373
379
|
})
|
|
374
380
|
]
|
|
375
381
|
})
|
|
376
382
|
});
|
|
377
383
|
}
|
|
378
384
|
// packages/ai/src/sources.tsx
|
|
379
|
-
function
|
|
380
|
-
return /* @__PURE__ */
|
|
385
|
+
function te({ sources: e, label: t = "Sources" }) {
|
|
386
|
+
return /* @__PURE__ */ T("section", {
|
|
381
387
|
"aria-label": t,
|
|
382
388
|
className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft",
|
|
383
389
|
children: [
|
|
384
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ w("h3", {
|
|
385
391
|
className: "x1ghz6dp xtqrqnz x1778rvt xk4h15q xj0a0fe",
|
|
386
392
|
children: t
|
|
387
393
|
}),
|
|
388
|
-
e.length === 0 && /* @__PURE__ */
|
|
394
|
+
e.length === 0 && /* @__PURE__ */ w("p", {
|
|
389
395
|
className: "x1ghz6dp x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
390
396
|
children: "No sources supplied."
|
|
391
397
|
}),
|
|
392
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ w("ol", {
|
|
393
399
|
className: "x78zum5 xdt5ytf x1n8ia3y x1ghz6dp x1717udv x3ct3a4",
|
|
394
|
-
children: e.map((e) => /* @__PURE__ */
|
|
400
|
+
children: e.map((e) => /* @__PURE__ */ T("li", {
|
|
395
401
|
className: "x78zum5 xdt5ytf xfko13i xeuugli xj0a0fe",
|
|
396
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ w("span", { children: /* @__PURE__ */ w(l, {
|
|
397
403
|
href: e.href,
|
|
398
404
|
children: e.title
|
|
399
|
-
}) }), e.description !== void 0 && /* @__PURE__ */
|
|
405
|
+
}) }), e.description !== void 0 && /* @__PURE__ */ w("p", {
|
|
400
406
|
className: "x1ghz6dp x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
401
407
|
children: e.description
|
|
402
408
|
})]
|
|
@@ -405,21 +411,21 @@ function $({ sources: e, label: t = "Sources" }) {
|
|
|
405
411
|
]
|
|
406
412
|
});
|
|
407
413
|
}
|
|
408
|
-
function
|
|
409
|
-
return /* @__PURE__ */
|
|
414
|
+
function ne({ source: e, label: n }) {
|
|
415
|
+
return /* @__PURE__ */ w("span", {
|
|
410
416
|
className: "xt0psk2 x11njtxf xss6m8b",
|
|
411
|
-
children: /* @__PURE__ */
|
|
412
|
-
render: /* @__PURE__ */
|
|
417
|
+
children: /* @__PURE__ */ T(u.Root, { children: [/* @__PURE__ */ w(u.Trigger, {
|
|
418
|
+
render: /* @__PURE__ */ w(t, {}),
|
|
413
419
|
"aria-label": `Source ${n}: ${e.title}`,
|
|
414
420
|
children: n
|
|
415
|
-
}), /* @__PURE__ */
|
|
421
|
+
}), /* @__PURE__ */ w(u.Portal, { children: /* @__PURE__ */ w(u.Positioner, {
|
|
416
422
|
side: "top",
|
|
417
|
-
children: /* @__PURE__ */
|
|
423
|
+
children: /* @__PURE__ */ w(u.Popup, { children: /* @__PURE__ */ T(o, {
|
|
418
424
|
isCompact: !0,
|
|
419
425
|
children: [
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
e.description !== void 0 && /* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ w(u.Title, { children: e.title }),
|
|
427
|
+
e.description !== void 0 && /* @__PURE__ */ w(u.Description, { children: e.description }),
|
|
428
|
+
/* @__PURE__ */ w(l, {
|
|
423
429
|
href: e.href,
|
|
424
430
|
children: "Open source"
|
|
425
431
|
})
|
|
@@ -428,4 +434,4 @@ function ee({ source: e, label: n }) {
|
|
|
428
434
|
}) })] })
|
|
429
435
|
});
|
|
430
436
|
}
|
|
431
|
-
export {
|
|
437
|
+
export { P as Approval, U as Conversation, ne as InlineCitation, q as Message, X as MessageAction, J as MessageAttachment, Z as MessageBoundary, ee as PromptInput, $ as PromptInputPlaceholder, te as Sources };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ReactNode, RefObject } from 'react';
|
|
2
2
|
export type ConversationRootProps = {
|
|
3
3
|
readonly children: ReactNode;
|
|
4
|
-
|
|
4
|
+
/** Captured at mount. A saved offset starts in reading mode; mount once the content is ready. */
|
|
5
|
+
readonly initialPosition?: 'start' | 'end' | {
|
|
6
|
+
readonly top: number;
|
|
7
|
+
readonly left?: number;
|
|
8
|
+
} | undefined;
|
|
5
9
|
readonly shouldFollow?: boolean;
|
|
6
10
|
readonly viewportRef?: RefObject<HTMLDivElement | null> | undefined;
|
|
7
11
|
};
|
package/package.json
CHANGED