@superxd-studio/adptr 0.5.0 → 0.6.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/GENERATIVE.md +1 -1
- package/README.md +20 -11
- package/REUSE.md +11 -1
- package/REVIEW.md +2 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/chunks/{callout-DKMHSnjc.js → callout-B89MDU9m.js} +31 -35
- package/chunks/{canvas-BJ15-XxE.js → canvas-Dd78FPe0.js} +9 -9
- package/chunks/{text-field-BLtoaZFn.js → text-field-mMHllx03.js} +1 -1
- package/chunks/thinking-DlBmZsgc.js +13 -0
- package/chunks/{ui-9DyNsYXY.js → ui-WR0qTNm7.js} +309 -260
- package/generative/index.js +156 -155
- package/interactions/index.js +1073 -499
- package/package.json +2 -1
- package/source/components/icons.tsx +14 -0
- package/source/components/peek.tsx +113 -0
- package/source/components/thinking.tsx +13 -2
- package/source/reusable/generative/index.tsx +14 -9
- package/source/reusable/generative/vocabulary.tsx +4 -2
- package/source/reusable/interactions/context.tsx +4 -0
- package/source/reusable/interactions/copy.ts +39 -0
- package/source/reusable/interactions/gate.tsx +246 -0
- package/source/reusable/interactions/index.ts +14 -0
- package/source/reusable/interactions/presentation.tsx +4 -1
- package/source/reusable/interactions/progress.tsx +240 -0
- package/source/reusable/interactions/receipt.tsx +230 -0
- package/source/reusable/interactions/run.tsx +206 -0
- package/source/reusable/ui/index.ts +1 -0
- package/source/reusable/web/review/index.tsx +21 -10
- package/source/styles/library.css +56 -0
- package/styles.css +1 -1
- package/types/components/icons.d.ts +8 -0
- package/types/components/peek.d.ts +17 -0
- package/types/components/thinking.d.ts +3 -1
- package/types/reusable/interactions/context.d.ts +39 -0
- package/types/reusable/interactions/copy.d.ts +43 -0
- package/types/reusable/interactions/gate.d.ts +39 -0
- package/types/reusable/interactions/index.d.ts +8 -0
- package/types/reusable/interactions/progress.d.ts +45 -0
- package/types/reusable/interactions/receipt.d.ts +54 -0
- package/types/reusable/interactions/run.d.ts +83 -0
- package/types/reusable/ui/index.d.ts +1 -0
- package/ui/index.js +3 -3
- package/web/index.js +350 -353
package/web/index.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { i as e } from "../chunks/core-BCqVRLUy.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
function ae({ className: e }) {
|
|
10
|
-
return /* @__PURE__ */ z("span", {
|
|
11
|
-
"aria-hidden": "true",
|
|
12
|
-
className: n("thinking-matrix", e),
|
|
13
|
-
children: Array.from({ length: 9 }, (e, t) => /* @__PURE__ */ z("i", {}, t))
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
3
|
+
import { E as t, M as n, N as r, O as i, T as a, b as o, c as s, l as c, m as l, n as u, o as d, p as f, t as p, u as m, x as h } from "../chunks/callout-B89MDU9m.js";
|
|
4
|
+
import { t as g } from "../chunks/thinking-DlBmZsgc.js";
|
|
5
|
+
import { c as _, d as v, f as y, h as b, l as x, m as S, n as C, p as w, r as T, u as E } from "../chunks/canvas-Dd78FPe0.js";
|
|
6
|
+
import { ViewTransition as D, addTransitionType as O, createContext as k, startTransition as ee, useEffect as A, useId as j, useLayoutEffect as te, useRef as M, useState as N, useSyncExternalStore as P } from "react";
|
|
7
|
+
import { Button as F, Checkbox as I, Disclosure as L, DisclosurePanel as R, FileTrigger as ne, Label as re, TextArea as ie, TextField as ae } from "react-aria-components";
|
|
8
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
17
9
|
//#region src/reusable/web/attachments/copy.ts
|
|
18
|
-
var
|
|
10
|
+
var H = {
|
|
19
11
|
label: "Attachments",
|
|
20
12
|
add: "Add files",
|
|
21
13
|
empty: "No files attached",
|
|
@@ -39,41 +31,41 @@ var V = {
|
|
|
39
31
|
};
|
|
40
32
|
//#endregion
|
|
41
33
|
//#region src/reusable/web/attachments/index.tsx
|
|
42
|
-
function
|
|
43
|
-
return
|
|
34
|
+
function U(e) {
|
|
35
|
+
return P(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
44
36
|
}
|
|
45
|
-
function
|
|
46
|
-
return i.length ? /* @__PURE__ */
|
|
47
|
-
"aria-label":
|
|
48
|
-
className:
|
|
37
|
+
function W({ items: i, variant: a = "list", className: o, copy: s = H, previewImages: c = !1, onRemove: l, onRetry: f, onCancel: p }) {
|
|
38
|
+
return i.length ? /* @__PURE__ */ B("ul", {
|
|
39
|
+
"aria-label": s.label,
|
|
40
|
+
className: r("min-w-0 list-none p-0", a === "grid" ? "flex flex-wrap gap-3" : a === "inline" ? "flex flex-wrap gap-2" : "flex flex-col gap-2", o),
|
|
49
41
|
children: i.map((i) => {
|
|
50
|
-
let o = ["image/png", "image/jpeg"].includes(i.mediaType),
|
|
51
|
-
if (
|
|
52
|
-
|
|
42
|
+
let o = ["image/png", "image/jpeg"].includes(i.mediaType), m;
|
|
43
|
+
if (c && o && i.file) try {
|
|
44
|
+
m = e(i.file).url;
|
|
53
45
|
} catch {}
|
|
54
|
-
let g = o ?
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
className:
|
|
46
|
+
let g = o ? s.image : ["application/pdf", "text/plain"].includes(i.mediaType) ? s.document : s.file, _ = i.size < 1e3 ? `${i.size} B` : i.size < 1e6 ? `${Math.ceil(i.size / 1e3)} KB` : `${(i.size / 1e6).toFixed(1)} MB`;
|
|
47
|
+
return /* @__PURE__ */ V("li", {
|
|
48
|
+
className: r("flex min-w-0 flex-wrap gap-3 rounded-control border bg-surface px-control-md-x py-control-y", a === "inline" && "max-w-full", a === "grid" && "max-w-full grow basis-64 flex-col flex-nowrap", ["error", "rejected"].includes(i.status) ? "border-error-line" : "border-line-subtle"),
|
|
57
49
|
children: [
|
|
58
|
-
|
|
59
|
-
src:
|
|
50
|
+
m ? /* @__PURE__ */ B("img", {
|
|
51
|
+
src: m,
|
|
60
52
|
alt: "",
|
|
61
53
|
loading: "lazy",
|
|
62
54
|
referrerPolicy: "no-referrer",
|
|
63
|
-
className:
|
|
64
|
-
}) : /* @__PURE__ */
|
|
55
|
+
className: r("size-12 shrink-0 rounded-cell object-cover", a === "grid" && "h-32 w-full")
|
|
56
|
+
}) : /* @__PURE__ */ B("span", {
|
|
65
57
|
className: "flex size-control-sm shrink-0 items-center justify-center rounded-cell bg-surface-muted text-fg-subtle",
|
|
66
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ B(h, {})
|
|
67
59
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
className:
|
|
60
|
+
/* @__PURE__ */ V("div", {
|
|
61
|
+
className: r("flex min-w-32 flex-1 flex-col gap-1", a === "grid" && "w-full min-w-0"),
|
|
70
62
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ B("p", {
|
|
72
64
|
title: i.name,
|
|
73
65
|
className: "truncate type-label text-fg-emphasis",
|
|
74
66
|
children: i.name
|
|
75
67
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ V("p", {
|
|
77
69
|
className: "type-caption text-fg-subtle",
|
|
78
70
|
children: [
|
|
79
71
|
g,
|
|
@@ -81,58 +73,58 @@ function U({ items: i, variant: a = "list", className: o, copy: l = V, previewIm
|
|
|
81
73
|
_
|
|
82
74
|
]
|
|
83
75
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ V("p", {
|
|
85
77
|
className: "flex items-center gap-2 type-caption text-fg-subtle",
|
|
86
|
-
children: [i.status === "uploading" ? /* @__PURE__ */
|
|
78
|
+
children: [i.status === "uploading" ? /* @__PURE__ */ B(d, {}) : null, s[i.status]]
|
|
87
79
|
}),
|
|
88
|
-
i.issue ? /* @__PURE__ */
|
|
80
|
+
i.issue ? /* @__PURE__ */ B("p", {
|
|
89
81
|
className: "type-caption wrap-anywhere text-error",
|
|
90
|
-
children:
|
|
82
|
+
children: s[i.issue]
|
|
91
83
|
}) : null
|
|
92
84
|
]
|
|
93
85
|
}),
|
|
94
|
-
|
|
86
|
+
l || f && ["error", "cancelled"].includes(i.status) || p && i.status === "uploading" ? /* @__PURE__ */ V("div", {
|
|
95
87
|
className: "ml-auto flex shrink-0 items-start gap-1",
|
|
96
88
|
children: [
|
|
97
|
-
|
|
89
|
+
p && i.status === "uploading" ? /* @__PURE__ */ B(u, {
|
|
98
90
|
size: "sm",
|
|
99
91
|
variant: "ghost",
|
|
100
|
-
"aria-label": `${
|
|
101
|
-
onPress: () =>
|
|
102
|
-
children:
|
|
92
|
+
"aria-label": `${s.cancel}: ${i.name}`,
|
|
93
|
+
onPress: () => p(i.id),
|
|
94
|
+
children: s.cancel
|
|
103
95
|
}) : null,
|
|
104
|
-
|
|
96
|
+
f && ["error", "cancelled"].includes(i.status) ? /* @__PURE__ */ B(u, {
|
|
105
97
|
size: "icon-sm",
|
|
106
98
|
variant: "ghost",
|
|
107
|
-
"aria-label": `${
|
|
108
|
-
onPress: () =>
|
|
109
|
-
children: /* @__PURE__ */
|
|
99
|
+
"aria-label": `${s.retry}: ${i.name}`,
|
|
100
|
+
onPress: () => f(i.id),
|
|
101
|
+
children: /* @__PURE__ */ B(t, {})
|
|
110
102
|
}) : null,
|
|
111
|
-
|
|
103
|
+
l ? /* @__PURE__ */ B(u, {
|
|
112
104
|
size: "icon-sm",
|
|
113
105
|
variant: "ghost",
|
|
114
|
-
"aria-label": `${
|
|
115
|
-
onPress: () =>
|
|
116
|
-
children: /* @__PURE__ */
|
|
106
|
+
"aria-label": `${s.remove}: ${i.name}`,
|
|
107
|
+
onPress: () => l(i.id),
|
|
108
|
+
children: /* @__PURE__ */ B(n, {})
|
|
117
109
|
}) : null
|
|
118
110
|
]
|
|
119
111
|
}) : null
|
|
120
112
|
]
|
|
121
113
|
}, i.id);
|
|
122
114
|
})
|
|
123
|
-
}) : /* @__PURE__ */
|
|
124
|
-
className:
|
|
125
|
-
children:
|
|
115
|
+
}) : /* @__PURE__ */ B("p", {
|
|
116
|
+
className: r("type-caption text-fg-subtle", o),
|
|
117
|
+
children: s.empty
|
|
126
118
|
});
|
|
127
119
|
}
|
|
128
|
-
function
|
|
129
|
-
let
|
|
130
|
-
return /* @__PURE__ */
|
|
131
|
-
className:
|
|
120
|
+
function oe({ controller: e, isDisabled: t, description: n, copy: i = H, className: o }) {
|
|
121
|
+
let s = U(e), c = M(null);
|
|
122
|
+
return /* @__PURE__ */ V("div", {
|
|
123
|
+
className: r("flex min-w-0 flex-col gap-3", o),
|
|
132
124
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ V("div", {
|
|
134
126
|
className: "flex flex-wrap items-center gap-3",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
127
|
+
children: [/* @__PURE__ */ B(ne, {
|
|
136
128
|
acceptedFileTypes: [...e.policy.mediaTypes],
|
|
137
129
|
allowsMultiple: !0,
|
|
138
130
|
onSelect: (n) => {
|
|
@@ -143,19 +135,19 @@ function W({ controller: e, isDisabled: t, description: r, copy: i = V, classNam
|
|
|
143
135
|
data: e
|
|
144
136
|
})));
|
|
145
137
|
},
|
|
146
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ V(u, {
|
|
147
139
|
ref: c,
|
|
148
140
|
size: "sm",
|
|
149
141
|
isDisabled: t,
|
|
150
|
-
children: [/* @__PURE__ */
|
|
142
|
+
children: [/* @__PURE__ */ B(a, {}), i.add]
|
|
151
143
|
})
|
|
152
|
-
}), /* @__PURE__ */
|
|
144
|
+
}), /* @__PURE__ */ B("p", {
|
|
153
145
|
className: "type-caption text-fg-subtle",
|
|
154
|
-
children:
|
|
146
|
+
children: n
|
|
155
147
|
})]
|
|
156
148
|
}),
|
|
157
|
-
|
|
158
|
-
items:
|
|
149
|
+
s.items.length ? /* @__PURE__ */ B(W, {
|
|
150
|
+
items: s.items,
|
|
159
151
|
onRemove: (t) => {
|
|
160
152
|
e.remove(t), c.current?.focus();
|
|
161
153
|
},
|
|
@@ -166,18 +158,18 @@ function W({ controller: e, isDisabled: t, description: r, copy: i = V, classNam
|
|
|
166
158
|
e.cancel(t), c.current?.focus();
|
|
167
159
|
}
|
|
168
160
|
}) : null,
|
|
169
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ B("p", {
|
|
170
162
|
role: "status",
|
|
171
163
|
"aria-live": "polite",
|
|
172
|
-
className:
|
|
173
|
-
children:
|
|
164
|
+
className: r("type-caption text-error", !s.issue && "sr-only"),
|
|
165
|
+
children: s.issue ? i[s.issue] : s.items.length ? `${s.items.length} ${i.selected}. ${s.items.map((e) => `${e.name}: ${i[e.status]}`).join(". ")}` : ""
|
|
174
166
|
})
|
|
175
167
|
]
|
|
176
168
|
});
|
|
177
169
|
}
|
|
178
170
|
//#endregion
|
|
179
171
|
//#region src/reusable/web/copy.ts
|
|
180
|
-
var
|
|
172
|
+
var se = {
|
|
181
173
|
label: "Conversation",
|
|
182
174
|
emptyTitle: "What are you working on?",
|
|
183
175
|
emptyNote: "Start with a question, an idea or something you want to make clearer.",
|
|
@@ -205,10 +197,10 @@ var oe = {
|
|
|
205
197
|
function K(e, t) {
|
|
206
198
|
return t > e ? G.forward : t < e ? G.back : null;
|
|
207
199
|
}
|
|
208
|
-
function q(e, t, n =
|
|
200
|
+
function q(e, t, n = ee) {
|
|
209
201
|
if (!e) return t();
|
|
210
202
|
n(() => {
|
|
211
|
-
|
|
203
|
+
O(e), t();
|
|
212
204
|
});
|
|
213
205
|
}
|
|
214
206
|
var J = (e, t) => ({
|
|
@@ -218,21 +210,21 @@ var J = (e, t) => ({
|
|
|
218
210
|
default: "none"
|
|
219
211
|
});
|
|
220
212
|
function Y({ children: e }) {
|
|
221
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ B(D, {
|
|
222
214
|
default: "none",
|
|
223
215
|
update: J("flow-card", "flow-card"),
|
|
224
216
|
children: e
|
|
225
217
|
});
|
|
226
218
|
}
|
|
227
219
|
function X({ children: e }) {
|
|
228
|
-
return /* @__PURE__ */
|
|
220
|
+
return /* @__PURE__ */ B(D, {
|
|
229
221
|
default: "none",
|
|
230
222
|
enter: J("flow-in", "flow-in-swap"),
|
|
231
223
|
exit: J("flow-out", "flow-out-swap"),
|
|
232
224
|
children: e
|
|
233
225
|
});
|
|
234
226
|
}
|
|
235
|
-
|
|
227
|
+
k(null);
|
|
236
228
|
//#endregion
|
|
237
229
|
//#region src/reusable/web/review/copy.ts
|
|
238
230
|
var Z = {
|
|
@@ -321,59 +313,59 @@ var Z = {
|
|
|
321
313
|
"complete",
|
|
322
314
|
"denied"
|
|
323
315
|
]);
|
|
324
|
-
function
|
|
316
|
+
function ce(e, t) {
|
|
325
317
|
return $.has(t) ? K(Q[e], Q[t]) : null;
|
|
326
318
|
}
|
|
327
319
|
//#endregion
|
|
328
320
|
//#region src/reusable/web/review/index.tsx
|
|
329
|
-
function
|
|
330
|
-
return /* @__PURE__ */
|
|
331
|
-
isExpanded:
|
|
332
|
-
onExpandedChange:
|
|
333
|
-
className:
|
|
334
|
-
children: [/* @__PURE__ */
|
|
321
|
+
function le({ change: e, isSelected: t = !1, onSelectionChange: n, isDisabled: i = !1, isApplied: a = !1, isExpanded: o = !0, onExpandedChange: s, comparison: c = "stacked", copy: u = Z }) {
|
|
322
|
+
return /* @__PURE__ */ V(L, {
|
|
323
|
+
isExpanded: o,
|
|
324
|
+
onExpandedChange: s,
|
|
325
|
+
className: r("min-w-0 overflow-hidden rounded-surface border bg-surface shadow-control", t ? "border-line-emphasis" : "border-line-subtle"),
|
|
326
|
+
children: [/* @__PURE__ */ V("div", {
|
|
335
327
|
className: "flex min-w-0 items-center gap-3 px-5 py-4",
|
|
336
328
|
children: [
|
|
337
|
-
/* @__PURE__ */
|
|
329
|
+
/* @__PURE__ */ V(I, {
|
|
338
330
|
isSelected: a || t,
|
|
339
|
-
onChange:
|
|
340
|
-
isDisabled: i || a || !
|
|
331
|
+
onChange: n,
|
|
332
|
+
isDisabled: i || a || !n,
|
|
341
333
|
"aria-label": u.selectChange(e.title),
|
|
342
334
|
className: "group flex min-h-control-md min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-control type-label text-fg-emphasis outline-none data-disabled:cursor-default data-focus-visible:focus-ring",
|
|
343
|
-
children: [/* @__PURE__ */
|
|
344
|
-
className:
|
|
345
|
-
children: a || t ? /* @__PURE__ */
|
|
346
|
-
}), /* @__PURE__ */
|
|
335
|
+
children: [/* @__PURE__ */ B("span", {
|
|
336
|
+
className: r("grid size-5 shrink-0 place-items-center rounded-control border", t ? "border-brand bg-brand text-on-brand" : "border-line-emphasis bg-surface", a && "border-success-line bg-success-subtle text-success"),
|
|
337
|
+
children: a || t ? /* @__PURE__ */ B(f, { className: "size-3.5" }) : null
|
|
338
|
+
}), /* @__PURE__ */ B("span", {
|
|
347
339
|
className: "min-w-0 break-words",
|
|
348
340
|
children: e.title
|
|
349
341
|
})]
|
|
350
342
|
}),
|
|
351
|
-
a ? /* @__PURE__ */
|
|
343
|
+
a ? /* @__PURE__ */ B("span", {
|
|
352
344
|
className: "rounded-pill bg-success-subtle px-2.5 py-1 type-caption text-success",
|
|
353
345
|
children: u.applied
|
|
354
346
|
}) : null,
|
|
355
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ B(F, {
|
|
356
348
|
slot: "trigger",
|
|
357
349
|
"aria-label": u.viewChange(e.title),
|
|
358
350
|
className: "grid size-control-md shrink-0 place-items-center rounded-control text-fg-subtle outline-none data-focus-visible:focus-ring data-hovered:bg-surface-muted",
|
|
359
|
-
children: /* @__PURE__ */
|
|
351
|
+
children: /* @__PURE__ */ B(l, { className: r("transition-transform duration-(--duration-fast) ease-standard", o && "rotate-180") })
|
|
360
352
|
})
|
|
361
353
|
]
|
|
362
|
-
}), /* @__PURE__ */
|
|
354
|
+
}), /* @__PURE__ */ V(R, {
|
|
363
355
|
className: "border-t border-line-subtle",
|
|
364
|
-
children: [/* @__PURE__ */
|
|
365
|
-
className:
|
|
366
|
-
children: [/* @__PURE__ */
|
|
356
|
+
children: [/* @__PURE__ */ V("div", {
|
|
357
|
+
className: r("grid min-w-0", c === "columns" && "grid-cols-2"),
|
|
358
|
+
children: [/* @__PURE__ */ B(ue, {
|
|
367
359
|
label: u.before,
|
|
368
360
|
muted: !0,
|
|
369
361
|
children: e.before
|
|
370
|
-
}), /* @__PURE__ */
|
|
362
|
+
}), /* @__PURE__ */ B(ue, {
|
|
371
363
|
label: u.after,
|
|
372
364
|
children: e.after
|
|
373
365
|
})]
|
|
374
|
-
}), /* @__PURE__ */
|
|
366
|
+
}), /* @__PURE__ */ V("p", {
|
|
375
367
|
className: "border-t border-line-subtle px-5 py-3 type-caption text-fg-subtle",
|
|
376
|
-
children: [/* @__PURE__ */
|
|
368
|
+
children: [/* @__PURE__ */ V("span", {
|
|
377
369
|
className: "sr-only",
|
|
378
370
|
children: [u.reason, ": "]
|
|
379
371
|
}), e.reason]
|
|
@@ -381,293 +373,298 @@ function ce({ change: e, isSelected: t = !1, onSelectionChange: r, isDisabled: i
|
|
|
381
373
|
})]
|
|
382
374
|
});
|
|
383
375
|
}
|
|
384
|
-
function
|
|
385
|
-
return /* @__PURE__ */
|
|
386
|
-
className:
|
|
387
|
-
children: [/* @__PURE__ */
|
|
376
|
+
function ue({ label: e, children: t, muted: n = !1 }) {
|
|
377
|
+
return /* @__PURE__ */ V("div", {
|
|
378
|
+
className: r("min-w-0 px-5 py-4", n ? "bg-surface-muted" : "bg-surface"),
|
|
379
|
+
children: [/* @__PURE__ */ B("p", {
|
|
388
380
|
className: "mb-2 font-mono type-caption text-fg-subtle",
|
|
389
381
|
children: e
|
|
390
|
-
}), /* @__PURE__ */
|
|
382
|
+
}), /* @__PURE__ */ B("p", {
|
|
391
383
|
className: "type-body break-words text-fg",
|
|
392
384
|
children: t
|
|
393
385
|
})]
|
|
394
386
|
});
|
|
395
387
|
}
|
|
396
|
-
function
|
|
397
|
-
let
|
|
398
|
-
return /* @__PURE__ */
|
|
388
|
+
function de({ snapshot: e, headingLevel: t = 2, onReview: n, onDecline: r, onConfirm: i, onBack: a, onRecover: o, onReload: s, copy: l = Z }) {
|
|
389
|
+
let d = t === 2 ? "h2" : "h3", { record: m, decision: h, status: g } = e, _ = h?.changeIds ?? e.selectedIds, v = m?.remainingIds.length ?? 0, y = g === "confirming" || g === "submitting", b = h?.choice === "deny", x = y ? b ? m?.appliedIds.length ? l.declineRemainingTitle : l.denyConfirm : l.confirm : g === "complete" ? l.complete(m?.appliedIds.length ?? 0) : g === "denied" ? l.denied : l.summary, S = g === "ready" || g === "partial", C = g === "complete", w = y ? "confirm" : C || g === "denied" ? "outcome" : "choose";
|
|
390
|
+
return /* @__PURE__ */ B(Y, { children: /* @__PURE__ */ B("section", {
|
|
399
391
|
"aria-label": l.summary,
|
|
400
392
|
className: "min-w-0 rounded-surface border border-line-subtle bg-surface p-5",
|
|
401
|
-
children: /* @__PURE__ */
|
|
393
|
+
children: /* @__PURE__ */ B(X, { children: /* @__PURE__ */ V("div", {
|
|
402
394
|
className: "flex min-w-0 flex-col gap-5",
|
|
403
395
|
children: [
|
|
404
|
-
/* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ V("div", {
|
|
405
397
|
className: "flex items-center gap-3",
|
|
406
|
-
children: [
|
|
398
|
+
children: [C ? /* @__PURE__ */ B("span", {
|
|
407
399
|
className: "flex size-8 shrink-0 animate-done-in items-center justify-center rounded-pill bg-done text-on-done",
|
|
408
|
-
children: /* @__PURE__ */
|
|
409
|
-
}) : null, /* @__PURE__ */
|
|
400
|
+
children: /* @__PURE__ */ B(f, { className: "animate-done-in [animation-delay:var(--duration-pop)]" })
|
|
401
|
+
}) : null, /* @__PURE__ */ B(d, {
|
|
410
402
|
tabIndex: -1,
|
|
411
403
|
"data-review-focus": !0,
|
|
412
404
|
className: "type-heading text-fg-emphasis outline-none",
|
|
413
|
-
children:
|
|
405
|
+
children: x
|
|
414
406
|
})]
|
|
415
407
|
}),
|
|
416
|
-
|
|
408
|
+
m && !["complete", "denied"].includes(g) ? /* @__PURE__ */ V("div", {
|
|
417
409
|
className: "flex min-w-0 flex-col gap-1",
|
|
418
|
-
children: [/* @__PURE__ */
|
|
410
|
+
children: [/* @__PURE__ */ B("p", {
|
|
419
411
|
className: "font-mono type-caption text-fg-subtle",
|
|
420
412
|
children: l.target
|
|
421
|
-
}), /* @__PURE__ */
|
|
413
|
+
}), /* @__PURE__ */ B("p", {
|
|
422
414
|
className: "type-label break-words text-fg-emphasis",
|
|
423
|
-
children:
|
|
415
|
+
children: m.proposal.destination
|
|
424
416
|
})]
|
|
425
417
|
}) : null,
|
|
426
|
-
|
|
418
|
+
S || y && !b ? /* @__PURE__ */ V("div", {
|
|
427
419
|
className: "flex flex-col gap-3",
|
|
428
420
|
children: [
|
|
429
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ B("p", {
|
|
430
422
|
className: "type-label text-fg-emphasis",
|
|
431
|
-
children: l.selected(
|
|
423
|
+
children: l.selected(_.length, v)
|
|
432
424
|
}),
|
|
433
|
-
|
|
425
|
+
_.length ? /* @__PURE__ */ B("ul", {
|
|
434
426
|
className: "flex flex-col gap-2 type-body text-fg",
|
|
435
|
-
children:
|
|
427
|
+
children: m?.proposal.changes.filter((e) => _.includes(e.id)).map((e) => /* @__PURE__ */ V("li", {
|
|
436
428
|
className: "flex items-start gap-2",
|
|
437
|
-
children: [/* @__PURE__ */
|
|
429
|
+
children: [/* @__PURE__ */ B(f, { className: "mt-0.5" }), /* @__PURE__ */ B("span", {
|
|
438
430
|
className: "min-w-0 break-words",
|
|
439
431
|
children: e.title
|
|
440
432
|
})]
|
|
441
433
|
}, e.id))
|
|
442
|
-
}) : /* @__PURE__ */
|
|
434
|
+
}) : /* @__PURE__ */ B("p", {
|
|
443
435
|
className: "type-body text-fg-subtle",
|
|
444
436
|
children: l.noSelection
|
|
445
437
|
}),
|
|
446
|
-
|
|
438
|
+
y ? /* @__PURE__ */ B("p", {
|
|
447
439
|
className: "type-body text-fg-subtle",
|
|
448
440
|
children: l.approvalNote
|
|
449
441
|
}) : null
|
|
450
442
|
]
|
|
451
443
|
}) : null,
|
|
452
|
-
|
|
444
|
+
y && b ? /* @__PURE__ */ B("p", {
|
|
453
445
|
className: "type-body text-fg-subtle",
|
|
454
|
-
children:
|
|
446
|
+
children: m?.appliedIds.length ? l.declineRemainingNote : l.denyNote
|
|
455
447
|
}) : null,
|
|
456
|
-
e.issue === "not-applied" ? /* @__PURE__ */
|
|
448
|
+
e.issue === "not-applied" ? /* @__PURE__ */ B(p, {
|
|
457
449
|
tone: "attention",
|
|
458
450
|
title: l.notApplied,
|
|
459
451
|
children: l.notAppliedNote
|
|
460
452
|
}) : null,
|
|
461
|
-
|
|
453
|
+
g === "uncertain" || g === "checking" ? /* @__PURE__ */ B(p, {
|
|
462
454
|
tone: "attention",
|
|
463
455
|
title: l.uncertain,
|
|
464
456
|
children: l.uncertainNote
|
|
465
457
|
}) : null,
|
|
466
|
-
|
|
458
|
+
g === "conflict" ? /* @__PURE__ */ B(p, {
|
|
467
459
|
tone: "attention",
|
|
468
460
|
title: l.conflict,
|
|
469
461
|
children: l.conflictNote
|
|
470
462
|
}) : null,
|
|
471
|
-
|
|
463
|
+
g === "blocked" ? /* @__PURE__ */ B(p, {
|
|
472
464
|
title: l.blocked,
|
|
473
465
|
children: l.blockedNote
|
|
474
466
|
}) : null,
|
|
475
|
-
|
|
467
|
+
g === "partial" ? /* @__PURE__ */ B(p, {
|
|
476
468
|
tone: "attention",
|
|
477
|
-
title: l.partial(
|
|
469
|
+
title: l.partial(m?.appliedIds.length ?? 0, v),
|
|
478
470
|
children: l.partialNote
|
|
479
471
|
}) : null,
|
|
480
|
-
|
|
472
|
+
g === "complete" ? /* @__PURE__ */ B(p, {
|
|
481
473
|
tone: "success",
|
|
482
|
-
children: l.kept((
|
|
474
|
+
children: l.kept((m?.proposal.changes.length ?? 0) - (m?.appliedIds.length ?? 0))
|
|
483
475
|
}) : null,
|
|
484
|
-
|
|
476
|
+
g === "denied" ? /* @__PURE__ */ B("p", {
|
|
485
477
|
className: "type-body text-fg-subtle",
|
|
486
478
|
children: l.deniedNote
|
|
487
479
|
}) : null,
|
|
488
|
-
/* @__PURE__ */
|
|
489
|
-
className: "flex flex-
|
|
480
|
+
/* @__PURE__ */ V("div", {
|
|
481
|
+
className: "flex flex-wrap items-center justify-end gap-2",
|
|
490
482
|
children: [
|
|
491
|
-
|
|
483
|
+
S ? /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(u, {
|
|
484
|
+
variant: "secondary",
|
|
485
|
+
onPress: r,
|
|
486
|
+
children: m?.appliedIds.length ? l.declineRemaining : l.deny
|
|
487
|
+
}), /* @__PURE__ */ B(u, {
|
|
492
488
|
variant: "primary",
|
|
493
489
|
isDisabled: !e.selectedIds.length,
|
|
494
490
|
onPress: n,
|
|
495
491
|
children: l.review(e.selectedIds.length)
|
|
496
|
-
}), /* @__PURE__ */ z(s, {
|
|
497
|
-
variant: "ghost",
|
|
498
|
-
onPress: r,
|
|
499
|
-
children: p?.appliedIds.length ? l.declineRemaining : l.deny
|
|
500
|
-
})] }) : null,
|
|
501
|
-
v ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(s, {
|
|
502
|
-
variant: "primary",
|
|
503
|
-
isPending: h === "submitting",
|
|
504
|
-
pendingLabel: l.applying,
|
|
505
|
-
onPress: i,
|
|
506
|
-
children: y ? l.denyAction : l.apply(g.length)
|
|
507
|
-
}), e.issue === "not-applied" ? /* @__PURE__ */ z(s, {
|
|
508
|
-
variant: "secondary",
|
|
509
|
-
onPress: o,
|
|
510
|
-
children: l.check
|
|
511
|
-
}) : /* @__PURE__ */ z(s, {
|
|
512
|
-
variant: "ghost",
|
|
513
|
-
isDisabled: h === "submitting",
|
|
514
|
-
onPress: a,
|
|
515
|
-
children: l.back
|
|
516
492
|
})] }) : null,
|
|
517
|
-
|
|
518
|
-
|
|
493
|
+
y ? /* @__PURE__ */ V(z, { children: [
|
|
494
|
+
e.issue === "not-applied" ? null : /* @__PURE__ */ V(u, {
|
|
495
|
+
variant: "secondary",
|
|
496
|
+
isDisabled: g === "submitting",
|
|
497
|
+
onPress: a,
|
|
498
|
+
children: [/* @__PURE__ */ B(c, {}), l.back]
|
|
499
|
+
}),
|
|
500
|
+
/* @__PURE__ */ B(u, {
|
|
501
|
+
variant: "primary",
|
|
502
|
+
className: "ml-auto",
|
|
503
|
+
isPending: g === "submitting",
|
|
504
|
+
pendingLabel: l.applying,
|
|
505
|
+
onPress: i,
|
|
506
|
+
children: b ? l.denyAction : l.apply(_.length)
|
|
507
|
+
}),
|
|
508
|
+
e.issue === "not-applied" ? /* @__PURE__ */ B(u, {
|
|
509
|
+
variant: "secondary",
|
|
510
|
+
onPress: o,
|
|
511
|
+
children: l.check
|
|
512
|
+
}) : null
|
|
513
|
+
] }) : null,
|
|
514
|
+
g === "uncertain" || g === "checking" ? /* @__PURE__ */ B(u, {
|
|
515
|
+
isPending: g === "checking",
|
|
519
516
|
pendingLabel: l.checking,
|
|
520
517
|
onPress: o,
|
|
521
518
|
children: l.check
|
|
522
519
|
}) : null,
|
|
523
|
-
|
|
524
|
-
onPress:
|
|
520
|
+
g === "conflict" ? /* @__PURE__ */ B(u, {
|
|
521
|
+
onPress: s,
|
|
525
522
|
children: l.reload
|
|
526
523
|
}) : null
|
|
527
524
|
]
|
|
528
525
|
})
|
|
529
526
|
]
|
|
530
|
-
}) },
|
|
527
|
+
}) }, w)
|
|
531
528
|
}) });
|
|
532
529
|
}
|
|
533
|
-
function
|
|
534
|
-
let t =
|
|
535
|
-
return
|
|
530
|
+
function fe(e) {
|
|
531
|
+
let t = P(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
532
|
+
return A(() => {
|
|
536
533
|
e.load();
|
|
537
534
|
}, [e]), t;
|
|
538
535
|
}
|
|
539
|
-
function
|
|
540
|
-
let [t, n] =
|
|
541
|
-
return
|
|
536
|
+
function pe(e) {
|
|
537
|
+
let [t, n] = N(e.getSnapshot);
|
|
538
|
+
return A(() => {
|
|
542
539
|
let t = e.getSnapshot(), r = () => {
|
|
543
|
-
let r = e.getSnapshot(), i =
|
|
540
|
+
let r = e.getSnapshot(), i = ce(t.status, r.status);
|
|
544
541
|
t = r, q(i, () => n(r));
|
|
545
542
|
}, i = e.subscribe(r);
|
|
546
543
|
return r(), e.load(), i;
|
|
547
544
|
}, [e]), t;
|
|
548
545
|
}
|
|
549
|
-
function
|
|
550
|
-
return /* @__PURE__ */
|
|
546
|
+
function me(e) {
|
|
547
|
+
return /* @__PURE__ */ B(C, { children: /* @__PURE__ */ B(he, { ...e }) });
|
|
551
548
|
}
|
|
552
|
-
function
|
|
553
|
-
let i =
|
|
554
|
-
|
|
549
|
+
function he({ controller: e, copy: t = Z, className: n }) {
|
|
550
|
+
let i = pe(e), a = M(null), o = M(!1), [s, c] = N(!1), [l, f] = N({}), m = j();
|
|
551
|
+
A(() => {
|
|
555
552
|
if (!a.current) return;
|
|
556
553
|
let e = a.current, t = new ResizeObserver(([t]) => {
|
|
557
554
|
let n = Number.parseFloat(getComputedStyle(document.documentElement).fontSize), r = Number.parseFloat(getComputedStyle(e).getPropertyValue("--breakpoint-md")) || 48;
|
|
558
|
-
|
|
555
|
+
c((t?.contentRect.width ?? 0) >= r * n);
|
|
559
556
|
});
|
|
560
557
|
return t.observe(e), () => t.disconnect();
|
|
561
|
-
}, []),
|
|
558
|
+
}, []), te(() => {
|
|
562
559
|
o.current && ![
|
|
563
560
|
"submitting",
|
|
564
561
|
"checking",
|
|
565
562
|
"loading"
|
|
566
563
|
].includes(i.status) && ((a.current?.contains(document.activeElement) || document.activeElement === document.body) && a.current?.querySelector("[data-review-focus]")?.focus(), o.current = !1);
|
|
567
564
|
}, [i.status]);
|
|
568
|
-
function
|
|
565
|
+
function h(e) {
|
|
569
566
|
e() && (o.current = !0);
|
|
570
567
|
}
|
|
571
|
-
let { record:
|
|
568
|
+
let { record: g, status: v } = i, y = v === "idle" || v === "loading" ? "loading" : v === "load-error" ? "error" : "review", b = [
|
|
572
569
|
"idle",
|
|
573
570
|
"loading",
|
|
574
571
|
"submitting",
|
|
575
572
|
"checking"
|
|
576
573
|
].includes(v), x = {
|
|
577
|
-
idle:
|
|
578
|
-
loading:
|
|
579
|
-
ready:
|
|
580
|
-
confirming:
|
|
581
|
-
submitting:
|
|
582
|
-
checking:
|
|
583
|
-
"load-error":
|
|
584
|
-
uncertain:
|
|
585
|
-
conflict:
|
|
586
|
-
blocked:
|
|
587
|
-
partial:
|
|
588
|
-
complete:
|
|
589
|
-
denied:
|
|
574
|
+
idle: _.loading,
|
|
575
|
+
loading: _.loading,
|
|
576
|
+
ready: _.review,
|
|
577
|
+
confirming: _.confirm,
|
|
578
|
+
submitting: _.applying,
|
|
579
|
+
checking: _.checking,
|
|
580
|
+
"load-error": _.failed,
|
|
581
|
+
uncertain: _.uncertain,
|
|
582
|
+
conflict: _.conflict,
|
|
583
|
+
blocked: _.blocked,
|
|
584
|
+
partial: _.partial,
|
|
585
|
+
complete: _.complete,
|
|
586
|
+
denied: _.denied
|
|
590
587
|
}[v];
|
|
591
|
-
return /* @__PURE__ */
|
|
588
|
+
return /* @__PURE__ */ B(T, {
|
|
592
589
|
phase: `review-${v}-${i.issue ?? ""}`,
|
|
593
|
-
frameClassName:
|
|
590
|
+
frameClassName: n,
|
|
594
591
|
label: x,
|
|
595
592
|
terminal: v === "complete" || v === "denied",
|
|
596
|
-
children: /* @__PURE__ */
|
|
593
|
+
children: /* @__PURE__ */ V("div", {
|
|
597
594
|
ref: a,
|
|
598
|
-
className:
|
|
595
|
+
className: r("@container w-full min-w-0 text-fg", n),
|
|
599
596
|
"aria-busy": b,
|
|
600
597
|
"data-review-status": v,
|
|
601
598
|
children: [
|
|
602
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ B("p", {
|
|
603
600
|
className: "sr-only",
|
|
604
601
|
role: "status",
|
|
605
602
|
"aria-live": "polite",
|
|
606
603
|
children: t.announcement[v]
|
|
607
604
|
}),
|
|
608
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ V("header", {
|
|
609
606
|
className: "mb-6 flex flex-col gap-2",
|
|
610
|
-
children: [/* @__PURE__ */
|
|
607
|
+
children: [/* @__PURE__ */ B("p", {
|
|
611
608
|
className: "font-mono type-caption text-fg-subtle",
|
|
612
609
|
children: t.proposed
|
|
613
|
-
}), /* @__PURE__ */
|
|
610
|
+
}), /* @__PURE__ */ B("h2", {
|
|
614
611
|
id: m,
|
|
615
612
|
className: "type-title text-fg-emphasis",
|
|
616
|
-
children:
|
|
613
|
+
children: g?.proposal.title ?? t.loading
|
|
617
614
|
})]
|
|
618
615
|
}),
|
|
619
|
-
/* @__PURE__ */
|
|
616
|
+
/* @__PURE__ */ B(X, { children: /* @__PURE__ */ B("div", {
|
|
620
617
|
className: "min-w-0",
|
|
621
|
-
children: v === "idle" || v === "loading" ? /* @__PURE__ */
|
|
618
|
+
children: v === "idle" || v === "loading" ? /* @__PURE__ */ V("div", {
|
|
622
619
|
className: "flex min-h-64 items-center justify-center gap-3 rounded-surface border border-line-subtle bg-surface",
|
|
623
|
-
children: [/* @__PURE__ */
|
|
620
|
+
children: [/* @__PURE__ */ B(d, {}), /* @__PURE__ */ B("p", {
|
|
624
621
|
className: "type-body text-fg-subtle",
|
|
625
622
|
children: t.loadingNote
|
|
626
623
|
})]
|
|
627
|
-
}) : v === "load-error" ? /* @__PURE__ */
|
|
624
|
+
}) : v === "load-error" ? /* @__PURE__ */ B(p, {
|
|
628
625
|
tone: "error",
|
|
629
626
|
title: t.loadError,
|
|
630
|
-
actions: /* @__PURE__ */
|
|
631
|
-
onPress: () =>
|
|
627
|
+
actions: /* @__PURE__ */ B(u, {
|
|
628
|
+
onPress: () => h(e.load),
|
|
632
629
|
children: t.retry
|
|
633
630
|
}),
|
|
634
631
|
children: t.loadErrorNote
|
|
635
|
-
}) :
|
|
632
|
+
}) : g && !g.proposal.changes.length ? /* @__PURE__ */ B(p, {
|
|
636
633
|
title: t.empty,
|
|
637
634
|
children: t.emptyNote
|
|
638
|
-
}) : /* @__PURE__ */
|
|
635
|
+
}) : /* @__PURE__ */ V("div", {
|
|
639
636
|
className: "grid min-w-0 items-start gap-6 @3xl:grid-cols-3",
|
|
640
|
-
children: [/* @__PURE__ */
|
|
637
|
+
children: [/* @__PURE__ */ B("div", {
|
|
641
638
|
className: "flex min-w-0 flex-col gap-3 @3xl:col-span-2",
|
|
642
|
-
children: /* @__PURE__ */
|
|
639
|
+
children: /* @__PURE__ */ B("ul", {
|
|
643
640
|
"aria-labelledby": m,
|
|
644
641
|
className: "flex min-w-0 flex-col gap-3",
|
|
645
|
-
children:
|
|
642
|
+
children: g?.proposal.changes.map((n) => /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(le, {
|
|
646
643
|
change: n,
|
|
647
644
|
isSelected: i.selectedIds.includes(n.id),
|
|
648
|
-
isApplied:
|
|
649
|
-
isDisabled: !["ready", "partial"].includes(v) || !
|
|
645
|
+
isApplied: g.appliedIds.includes(n.id),
|
|
646
|
+
isDisabled: !["ready", "partial"].includes(v) || !g.remainingIds.includes(n.id),
|
|
650
647
|
onSelectionChange: (t) => e.select(n.id, t),
|
|
651
|
-
isExpanded:
|
|
652
|
-
onExpandedChange: (e) =>
|
|
648
|
+
isExpanded: l[n.id] ?? !0,
|
|
649
|
+
onExpandedChange: (e) => f((t) => ({
|
|
653
650
|
...t,
|
|
654
651
|
[n.id]: e
|
|
655
652
|
})),
|
|
656
|
-
comparison:
|
|
653
|
+
comparison: s ? "columns" : "stacked",
|
|
657
654
|
copy: t
|
|
658
|
-
}) }, `${
|
|
655
|
+
}) }, `${g.proposal.id}-${n.id}`))
|
|
659
656
|
})
|
|
660
|
-
}), /* @__PURE__ */
|
|
657
|
+
}), /* @__PURE__ */ B("div", {
|
|
661
658
|
className: "min-w-0 @3xl:sticky @3xl:top-6",
|
|
662
|
-
children: /* @__PURE__ */
|
|
659
|
+
children: /* @__PURE__ */ B(de, {
|
|
663
660
|
snapshot: i,
|
|
664
661
|
headingLevel: 3,
|
|
665
|
-
onReview: () =>
|
|
666
|
-
onDecline: () =>
|
|
667
|
-
onConfirm: () =>
|
|
668
|
-
onBack: () =>
|
|
669
|
-
onRecover: () =>
|
|
670
|
-
onReload: () =>
|
|
662
|
+
onReview: () => h(() => e.prepare("approve")),
|
|
663
|
+
onDecline: () => h(() => e.prepare("deny")),
|
|
664
|
+
onConfirm: () => h(e.submit),
|
|
665
|
+
onBack: () => h(e.back),
|
|
666
|
+
onRecover: () => h(e.recover),
|
|
667
|
+
onReload: () => h(e.load),
|
|
671
668
|
copy: t
|
|
672
669
|
})
|
|
673
670
|
})]
|
|
@@ -679,88 +676,88 @@ function me({ controller: e, copy: t = Z, className: r }) {
|
|
|
679
676
|
}
|
|
680
677
|
//#endregion
|
|
681
678
|
//#region src/reusable/web/index.tsx
|
|
682
|
-
function
|
|
683
|
-
return
|
|
679
|
+
function ge(e) {
|
|
680
|
+
return P(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
684
681
|
}
|
|
685
|
-
function
|
|
686
|
-
let [P, F] =
|
|
687
|
-
|
|
688
|
-
|
|
682
|
+
function _e({ snapshot: e, actions: n, copy: a = se, className: c, renderMessage: l, footer: d, attachmentPicker: f, draftFiles: h = [], isAttachmentBlocked: _ = !1, onSent: C, messageCopy: T = b, writeText: E, scrollable: D = !1, autoScroll: O = !0, suggestions: k = [], defaultDraft: ee = "", defaultEditing: A }) {
|
|
683
|
+
let [P, F] = N(ee), [I, L] = N(A), [R, ne] = N(!1), z = M(null), H = M(null), U = M(O), [oe, G] = N(!1);
|
|
684
|
+
te(() => {
|
|
685
|
+
D && O && U.current && H.current && (H.current.scrollTop = H.current.scrollHeight);
|
|
689
686
|
}, [
|
|
690
687
|
e.messages,
|
|
691
688
|
e.status,
|
|
692
|
-
|
|
693
|
-
|
|
689
|
+
D,
|
|
690
|
+
O
|
|
694
691
|
]);
|
|
695
|
-
let
|
|
696
|
-
|
|
697
|
-
},
|
|
698
|
-
L(void 0), window.requestAnimationFrame(
|
|
699
|
-
},
|
|
692
|
+
let K = () => {
|
|
693
|
+
U.current = !0, G(!1), H.current && (H.current.scrollTop = H.current.scrollHeight);
|
|
694
|
+
}, q = () => z.current?.querySelector("[data-chat-composer] textarea")?.focus({ preventScroll: !0 }), J = () => {
|
|
695
|
+
L(void 0), window.requestAnimationFrame(q);
|
|
696
|
+
}, Y = j(), X = j(), Z = e.status === "waiting" || e.status === "streaming", Q = [
|
|
700
697
|
"error",
|
|
701
698
|
"interrupted",
|
|
702
699
|
"cancelled"
|
|
703
|
-
].includes(e.status),
|
|
704
|
-
|
|
700
|
+
].includes(e.status), $ = () => {
|
|
701
|
+
_ || Z || n.send(P, h) && (F(""), K(), C?.());
|
|
705
702
|
};
|
|
706
|
-
return /* @__PURE__ */
|
|
707
|
-
ref:
|
|
708
|
-
"aria-labelledby":
|
|
709
|
-
className:
|
|
703
|
+
return /* @__PURE__ */ V("section", {
|
|
704
|
+
ref: z,
|
|
705
|
+
"aria-labelledby": Y,
|
|
706
|
+
className: r("relative flex min-w-0 flex-col gap-6 rounded-surface bg-surface p-4 sm:p-6", D && "h-conversation", c),
|
|
710
707
|
children: [
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
id:
|
|
708
|
+
/* @__PURE__ */ B("h2", {
|
|
709
|
+
id: Y,
|
|
713
710
|
className: "sr-only",
|
|
714
|
-
children:
|
|
711
|
+
children: a.label
|
|
715
712
|
}),
|
|
716
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ B("div", {
|
|
717
714
|
ref: H,
|
|
718
|
-
role:
|
|
719
|
-
"aria-label":
|
|
720
|
-
tabIndex:
|
|
715
|
+
role: D ? "region" : void 0,
|
|
716
|
+
"aria-label": D ? `${T.transcript}: ${a.label}` : void 0,
|
|
717
|
+
tabIndex: D ? 0 : void 0,
|
|
721
718
|
onScroll: () => {
|
|
722
719
|
let e = H.current;
|
|
723
720
|
if (!e) return;
|
|
724
721
|
let t = e.scrollHeight - e.scrollTop - e.clientHeight < 24;
|
|
725
|
-
|
|
722
|
+
U.current = t, G(!t);
|
|
726
723
|
},
|
|
727
|
-
className:
|
|
728
|
-
children: e.messages.length ? /* @__PURE__ */
|
|
724
|
+
className: r("min-w-0", D && "min-h-0 flex-1 overflow-x-hidden overflow-y-auto rounded-cell outline-none focus-visible:focus-ring"),
|
|
725
|
+
children: e.messages.length ? /* @__PURE__ */ B("ol", {
|
|
729
726
|
className: "flex min-w-0 list-none flex-col gap-6 p-0",
|
|
730
|
-
children: e.messages.map((
|
|
731
|
-
"aria-label":
|
|
727
|
+
children: e.messages.map((i, s) => /* @__PURE__ */ V("li", {
|
|
728
|
+
"aria-label": i.role === "user" ? a.user : a.assistant,
|
|
732
729
|
className: "flex min-w-0 flex-col gap-2",
|
|
733
730
|
children: [
|
|
734
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ B("p", {
|
|
735
732
|
className: "font-mono type-caption text-fg-subtle",
|
|
736
|
-
children:
|
|
733
|
+
children: i.role === "user" ? a.user : a.assistant
|
|
737
734
|
}),
|
|
738
|
-
I ===
|
|
739
|
-
autoFocus:
|
|
740
|
-
text:
|
|
741
|
-
hasFiles: !!
|
|
742
|
-
isDisabled:
|
|
743
|
-
onCancel:
|
|
744
|
-
copy:
|
|
735
|
+
I === i.id && n.edit ? /* @__PURE__ */ B(y, {
|
|
736
|
+
autoFocus: R,
|
|
737
|
+
text: i.text,
|
|
738
|
+
hasFiles: !!i.files?.length,
|
|
739
|
+
isDisabled: Z,
|
|
740
|
+
onCancel: J,
|
|
741
|
+
copy: T,
|
|
745
742
|
onSave: (e) => {
|
|
746
|
-
let
|
|
747
|
-
return
|
|
743
|
+
let t = n.edit?.(i.id, e) ?? !1;
|
|
744
|
+
return t && (J(), K()), t;
|
|
748
745
|
}
|
|
749
|
-
}) : /* @__PURE__ */
|
|
750
|
-
className:
|
|
751
|
-
children: [
|
|
752
|
-
text:
|
|
753
|
-
copy:
|
|
754
|
-
writeText:
|
|
755
|
-
}) :
|
|
756
|
-
text:
|
|
757
|
-
isStreaming:
|
|
758
|
-
copy:
|
|
759
|
-
writeText:
|
|
760
|
-
}) :
|
|
746
|
+
}) : /* @__PURE__ */ V("div", {
|
|
747
|
+
className: r("min-w-0 type-body wrap-anywhere whitespace-pre-wrap text-fg-emphasis", i.role === "user" && "self-end rounded-surface bg-surface-muted px-control-md-x py-control-y"),
|
|
748
|
+
children: [l ? l(i) : i.role === "assistant" && e.status === "streaming" && s === e.messages.length - 1 ? /* @__PURE__ */ B(S, {
|
|
749
|
+
text: i.text,
|
|
750
|
+
copy: T,
|
|
751
|
+
writeText: E
|
|
752
|
+
}) : i.role === "assistant" ? /* @__PURE__ */ B(w, {
|
|
753
|
+
text: i.text,
|
|
754
|
+
isStreaming: Z,
|
|
755
|
+
copy: T,
|
|
756
|
+
writeText: E
|
|
757
|
+
}) : i.text, i.role === "assistant" && !i.text && Z ? /* @__PURE__ */ B(g, {}) : null]
|
|
761
758
|
}),
|
|
762
|
-
|
|
763
|
-
items:
|
|
759
|
+
i.files?.length ? /* @__PURE__ */ B(W, {
|
|
760
|
+
items: i.files.map((e) => ({
|
|
764
761
|
id: e.id,
|
|
765
762
|
name: e.name,
|
|
766
763
|
mediaType: e.mediaType,
|
|
@@ -770,73 +767,73 @@ function ge({ snapshot: e, actions: t, copy: o = oe, className: c, renderMessage
|
|
|
770
767
|
})),
|
|
771
768
|
variant: "inline"
|
|
772
769
|
}) : null,
|
|
773
|
-
I ===
|
|
770
|
+
I === i.id ? null : /* @__PURE__ */ V("div", {
|
|
774
771
|
className: "flex min-w-0 flex-wrap items-center gap-1",
|
|
775
772
|
children: [
|
|
776
|
-
|
|
777
|
-
text:
|
|
773
|
+
i.role === "assistant" && i.text ? /* @__PURE__ */ B(v, {
|
|
774
|
+
text: i.text,
|
|
778
775
|
iconOnly: !0,
|
|
779
|
-
isDisabled:
|
|
780
|
-
copy:
|
|
781
|
-
writeText:
|
|
776
|
+
isDisabled: Z,
|
|
777
|
+
copy: T,
|
|
778
|
+
writeText: E
|
|
782
779
|
}) : null,
|
|
783
|
-
|
|
780
|
+
i.role === "user" && e.capabilities.edit && n.edit ? /* @__PURE__ */ B(u, {
|
|
784
781
|
size: "icon-sm",
|
|
785
782
|
variant: "ghost",
|
|
786
|
-
"aria-label":
|
|
787
|
-
isDisabled:
|
|
783
|
+
"aria-label": T.edit,
|
|
784
|
+
isDisabled: Z,
|
|
788
785
|
onPress: () => {
|
|
789
|
-
|
|
786
|
+
ne(!0), L(i.id);
|
|
790
787
|
},
|
|
791
|
-
children: /* @__PURE__ */
|
|
788
|
+
children: /* @__PURE__ */ B(o, {})
|
|
792
789
|
}) : null,
|
|
793
|
-
|
|
790
|
+
i.role === "assistant" && e.capabilities.regenerate && n.regenerate ? /* @__PURE__ */ B(u, {
|
|
794
791
|
size: "icon-sm",
|
|
795
792
|
variant: "ghost",
|
|
796
|
-
"aria-label":
|
|
797
|
-
isDisabled:
|
|
793
|
+
"aria-label": T.regenerate,
|
|
794
|
+
isDisabled: Z,
|
|
798
795
|
onPress: () => {
|
|
799
|
-
|
|
796
|
+
n.regenerate?.(i.id) && (q(), K());
|
|
800
797
|
},
|
|
801
|
-
children: /* @__PURE__ */
|
|
798
|
+
children: /* @__PURE__ */ B(t, {})
|
|
802
799
|
}) : null,
|
|
803
|
-
e.capabilities.branches && e.branches?.[
|
|
804
|
-
branch: e.branches[
|
|
800
|
+
e.capabilities.branches && e.branches?.[i.id] && n.selectBranch ? /* @__PURE__ */ B(x, {
|
|
801
|
+
branch: e.branches[i.id] ?? {
|
|
805
802
|
index: 0,
|
|
806
803
|
count: 0
|
|
807
804
|
},
|
|
808
|
-
isDisabled:
|
|
809
|
-
copy:
|
|
805
|
+
isDisabled: Z,
|
|
806
|
+
copy: T,
|
|
810
807
|
onPrevious: () => {
|
|
811
|
-
|
|
808
|
+
n.selectBranch?.(i.id, "previous") && q();
|
|
812
809
|
},
|
|
813
810
|
onNext: () => {
|
|
814
|
-
|
|
811
|
+
n.selectBranch?.(i.id, "next") && q();
|
|
815
812
|
}
|
|
816
813
|
}) : null
|
|
817
814
|
]
|
|
818
815
|
})
|
|
819
816
|
]
|
|
820
|
-
},
|
|
821
|
-
}) : /* @__PURE__ */
|
|
817
|
+
}, i.id))
|
|
818
|
+
}) : /* @__PURE__ */ V("div", {
|
|
822
819
|
className: "flex min-h-48 flex-col items-center justify-center gap-2 text-center",
|
|
823
820
|
children: [
|
|
824
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ B("h3", {
|
|
825
822
|
className: "type-heading text-fg-emphasis",
|
|
826
|
-
children:
|
|
823
|
+
children: a.emptyTitle
|
|
827
824
|
}),
|
|
828
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ B("p", {
|
|
829
826
|
className: "max-w-sm type-body text-fg-subtle",
|
|
830
|
-
children:
|
|
827
|
+
children: a.emptyNote
|
|
831
828
|
}),
|
|
832
|
-
|
|
829
|
+
k.length ? /* @__PURE__ */ B("div", {
|
|
833
830
|
className: "mt-3 flex flex-wrap justify-center gap-2",
|
|
834
|
-
children:
|
|
831
|
+
children: k.map((t) => /* @__PURE__ */ B(u, {
|
|
835
832
|
size: "sm",
|
|
836
833
|
isDisabled: !e.capabilities.send,
|
|
837
834
|
className: "h-auto min-h-control-sm max-w-full py-2 whitespace-normal",
|
|
838
835
|
onPress: () => {
|
|
839
|
-
F(t), window.requestAnimationFrame(
|
|
836
|
+
F(t), window.requestAnimationFrame(q);
|
|
840
837
|
},
|
|
841
838
|
children: t
|
|
842
839
|
}, t))
|
|
@@ -844,88 +841,88 @@ function ge({ snapshot: e, actions: t, copy: o = oe, className: c, renderMessage
|
|
|
844
841
|
]
|
|
845
842
|
})
|
|
846
843
|
}),
|
|
847
|
-
|
|
844
|
+
D && oe ? /* @__PURE__ */ V(u, {
|
|
848
845
|
size: "sm",
|
|
849
846
|
className: "self-center shadow-control",
|
|
850
847
|
onPress: () => {
|
|
851
|
-
|
|
848
|
+
K(), q();
|
|
852
849
|
},
|
|
853
|
-
children: [/* @__PURE__ */
|
|
850
|
+
children: [/* @__PURE__ */ B(s, {}), T.latest]
|
|
854
851
|
}) : null,
|
|
855
|
-
/* @__PURE__ */
|
|
852
|
+
/* @__PURE__ */ V("p", {
|
|
856
853
|
role: "status",
|
|
857
854
|
"aria-live": "polite",
|
|
858
|
-
className:
|
|
859
|
-
children: [e.status === "complete" ? /* @__PURE__ */
|
|
855
|
+
className: r("flex items-center gap-2 font-mono type-caption text-fg-subtle", Q && "sr-only"),
|
|
856
|
+
children: [e.status === "complete" ? /* @__PURE__ */ B("span", {
|
|
860
857
|
"aria-hidden": "true",
|
|
861
858
|
className: "size-1.5 shrink-0 rounded-pill bg-done"
|
|
862
|
-
}) : null,
|
|
859
|
+
}) : null, a[e.status]]
|
|
863
860
|
}),
|
|
864
|
-
e.capabilities.attachments ?
|
|
865
|
-
|
|
861
|
+
e.capabilities.attachments ? f : null,
|
|
862
|
+
Q ? /* @__PURE__ */ B(p, {
|
|
866
863
|
tone: e.status === "cancelled" ? "neutral" : "attention",
|
|
867
|
-
actions: e.capabilities.retry ? /* @__PURE__ */
|
|
864
|
+
actions: e.capabilities.retry ? /* @__PURE__ */ B(u, {
|
|
868
865
|
size: "sm",
|
|
869
866
|
onPress: () => {
|
|
870
|
-
|
|
867
|
+
n.retry() && q();
|
|
871
868
|
},
|
|
872
|
-
children:
|
|
869
|
+
children: a.retry
|
|
873
870
|
}) : void 0,
|
|
874
|
-
children:
|
|
871
|
+
children: a[e.status]
|
|
875
872
|
}) : null,
|
|
876
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ V("div", {
|
|
877
874
|
"data-chat-composer": !0,
|
|
878
875
|
className: "conversation-composer min-w-0 rounded-surface border border-line-input bg-surface shadow-control focus-within:border-line-emphasis has-data-focus-visible:border-focus has-data-focus-visible:ring-2 has-data-focus-visible:ring-focus/15",
|
|
879
|
-
children: [/* @__PURE__ */
|
|
876
|
+
children: [/* @__PURE__ */ V(ae, {
|
|
880
877
|
value: P,
|
|
881
878
|
onChange: F,
|
|
882
879
|
isDisabled: !e.capabilities.send || !!I,
|
|
883
880
|
className: "min-w-0",
|
|
884
|
-
children: [/* @__PURE__ */
|
|
881
|
+
children: [/* @__PURE__ */ B(re, {
|
|
885
882
|
className: "sr-only",
|
|
886
|
-
children:
|
|
887
|
-
}), /* @__PURE__ */
|
|
883
|
+
children: a.input
|
|
884
|
+
}), /* @__PURE__ */ B(ie, {
|
|
888
885
|
rows: 3,
|
|
889
886
|
maxLength: 2e4,
|
|
890
|
-
"aria-describedby":
|
|
891
|
-
placeholder:
|
|
887
|
+
"aria-describedby": X,
|
|
888
|
+
placeholder: a.placeholder,
|
|
892
889
|
className: "max-h-48 min-h-24 w-full resize-none rounded-surface bg-transparent px-control-md-x pt-control-y pb-2 type-body text-fg-emphasis outline-none placeholder:text-fg-subtle",
|
|
893
890
|
onKeyDown: (e) => {
|
|
894
|
-
e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && !window.matchMedia("(pointer: coarse)").matches && (e.preventDefault(), !
|
|
891
|
+
e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && !window.matchMedia("(pointer: coarse)").matches && (e.preventDefault(), !Z && !I && $());
|
|
895
892
|
}
|
|
896
893
|
})]
|
|
897
|
-
}), /* @__PURE__ */
|
|
894
|
+
}), /* @__PURE__ */ V("div", {
|
|
898
895
|
className: "flex flex-wrap items-center justify-between gap-3 px-3 pb-3",
|
|
899
|
-
children: [/* @__PURE__ */
|
|
900
|
-
id:
|
|
896
|
+
children: [/* @__PURE__ */ V("p", {
|
|
897
|
+
id: X,
|
|
901
898
|
className: "conversation-key-hint type-caption text-fg-subtle",
|
|
902
|
-
children: [/* @__PURE__ */
|
|
899
|
+
children: [/* @__PURE__ */ B("span", {
|
|
903
900
|
className: "conversation-desktop-hint",
|
|
904
|
-
children:
|
|
905
|
-
}), /* @__PURE__ */
|
|
901
|
+
children: a.hint
|
|
902
|
+
}), /* @__PURE__ */ B("span", {
|
|
906
903
|
className: "conversation-touch-hint",
|
|
907
|
-
children:
|
|
904
|
+
children: a.touchHint
|
|
908
905
|
})]
|
|
909
|
-
}),
|
|
906
|
+
}), Z && e.capabilities.cancel ? /* @__PURE__ */ V(u, {
|
|
910
907
|
size: "sm",
|
|
911
908
|
className: "ml-auto",
|
|
912
909
|
onPress: () => {
|
|
913
|
-
|
|
910
|
+
n.cancel(), q();
|
|
914
911
|
},
|
|
915
|
-
children: [/* @__PURE__ */
|
|
916
|
-
}) : /* @__PURE__ */
|
|
912
|
+
children: [/* @__PURE__ */ B(i, {}), a.stop]
|
|
913
|
+
}) : /* @__PURE__ */ V(u, {
|
|
917
914
|
variant: "primary",
|
|
918
915
|
className: "ml-auto",
|
|
919
916
|
size: "sm",
|
|
920
|
-
isDisabled:
|
|
921
|
-
onPress:
|
|
922
|
-
children: [/* @__PURE__ */
|
|
917
|
+
isDisabled: Z || !!I || _ || !P.trim() && !h.length || !e.capabilities.send,
|
|
918
|
+
onPress: $,
|
|
919
|
+
children: [/* @__PURE__ */ B(m, {}), a.send]
|
|
923
920
|
})]
|
|
924
921
|
})]
|
|
925
922
|
}),
|
|
926
|
-
|
|
923
|
+
d
|
|
927
924
|
]
|
|
928
925
|
});
|
|
929
926
|
}
|
|
930
927
|
//#endregion
|
|
931
|
-
export {
|
|
928
|
+
export { W as AttachmentList, oe as AttachmentPicker, x as BranchPicker, _e as Chat, E as CodeBlock, v as CopyButton, me as DraftReview, y as MessageEditor, w as MessageMarkdown, le as ReviewChangeCard, de as ReviewDecisionPanel, S as StreamingMessage, H as attachmentCopy, b as messageCopy, Z as reviewCopy, U as useAttachments, ge as useChatController, fe as useReview };
|