@brett_lamy/ui 3.1.0 → 5.0.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 +4 -4
- package/dist/components/animated-height.d.ts +3 -1
- package/dist/components/animated-height.d.ts.map +1 -1
- package/dist/components/animated-height.js +11 -11
- package/dist/components/artifact-chat-container.d.ts.map +1 -1
- package/dist/components/artifact-chat-container.js +81 -82
- package/dist/components/button.d.ts +4 -3
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +22 -9
- package/dist/components/canvas.d.ts +91 -0
- package/dist/components/canvas.d.ts.map +1 -0
- package/dist/components/canvas.js +296 -0
- package/dist/components/composer/composer-cards.d.ts +55 -0
- package/dist/components/composer/composer-cards.d.ts.map +1 -0
- package/dist/components/composer/composer-cards.js +351 -0
- package/dist/components/composer/composer.d.ts +9 -1
- package/dist/components/composer/composer.d.ts.map +1 -1
- package/dist/components/composer/composer.js +179 -154
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +127 -0
- package/dist/components/credenza.d.ts.map +1 -1
- package/dist/components/credenza.js +52 -92
- package/dist/components/cron-editor.d.ts +47 -0
- package/dist/components/cron-editor.d.ts.map +1 -0
- package/dist/components/cron-editor.js +297 -0
- package/dist/components/dropdown-menu.d.ts +3 -1
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +5 -5
- package/dist/components/edge-drawer.d.ts.map +1 -1
- package/dist/components/edge-drawer.js +1 -0
- package/dist/components/file-upload.d.ts +121 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +405 -0
- package/dist/components/filter-input.d.ts +22 -0
- package/dist/components/filter-input.d.ts.map +1 -0
- package/dist/components/filter-input.js +126 -0
- package/dist/components/filter.d.ts +154 -0
- package/dist/components/filter.d.ts.map +1 -0
- package/dist/components/filter.js +815 -0
- package/dist/components/floating-chat.d.ts.map +1 -1
- package/dist/components/floating-chat.js +71 -88
- package/dist/components/floating-sheet.d.ts +21 -5
- package/dist/components/floating-sheet.d.ts.map +1 -1
- package/dist/components/floating-sheet.js +113 -116
- package/dist/components/markdown-editor.d.ts +2 -0
- package/dist/components/markdown-editor.d.ts.map +1 -1
- package/dist/components/markdown-editor.js +46 -45
- package/dist/components/markdown-view.d.ts +6 -1
- package/dist/components/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view.js +13 -11
- package/dist/components/navigation-stack.d.ts +3 -5
- package/dist/components/navigation-stack.d.ts.map +1 -1
- package/dist/components/navigation-stack.js +212 -382
- package/dist/components/passkey-enroll-dialog.d.ts +36 -0
- package/dist/components/passkey-enroll-dialog.d.ts.map +1 -0
- package/dist/components/passkey-enroll-dialog.js +234 -0
- package/dist/components/result-table.d.ts +38 -0
- package/dist/components/result-table.d.ts.map +1 -0
- package/dist/components/result-table.js +161 -0
- package/dist/components/schema-tree.d.ts +19 -0
- package/dist/components/schema-tree.d.ts.map +1 -0
- package/dist/components/schema-tree.js +172 -0
- package/dist/components/side-drawer.d.ts.map +1 -1
- package/dist/components/side-drawer.js +117 -143
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +4 -1
- package/dist/components/spinner-shapes.d.ts +263 -0
- package/dist/components/spinner-shapes.d.ts.map +1 -0
- package/dist/components/spinner-shapes.js +771 -0
- package/dist/components/spinner.d.ts +133 -3
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/spinner.js +445 -29
- package/dist/components/sql-console.d.ts +28 -0
- package/dist/components/sql-console.d.ts.map +1 -0
- package/dist/components/sql-console.js +348 -0
- package/dist/components/sql-editor.d.ts +47 -0
- package/dist/components/sql-editor.d.ts.map +1 -0
- package/dist/components/sql-editor.js +170 -0
- package/dist/components/tab-view.d.ts +2 -2
- package/dist/components/tab-view.d.ts.map +1 -1
- package/dist/components/tab-view.js +63 -49
- package/dist/components/tailscale-login-button.d.ts +53 -0
- package/dist/components/tailscale-login-button.d.ts.map +1 -0
- package/dist/components/tailscale-login-button.js +197 -0
- package/dist/components/time-input.d.ts +46 -0
- package/dist/components/time-input.d.ts.map +1 -0
- package/dist/components/time-input.js +258 -0
- package/dist/components/toast.d.ts +5 -2
- package/dist/components/toast.d.ts.map +1 -1
- package/dist/components/toast.js +249 -125
- package/dist/components/vault-gate.d.ts +60 -0
- package/dist/components/vault-gate.d.ts.map +1 -0
- package/dist/components/vault-gate.js +382 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +86 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +129 -85
- package/dist/lib/back-history.d.ts +5 -0
- package/dist/lib/back-history.d.ts.map +1 -0
- package/dist/lib/back-history.js +44 -0
- package/dist/lib/canvas-math.d.ts +82 -0
- package/dist/lib/canvas-math.d.ts.map +1 -0
- package/dist/lib/canvas-math.js +226 -0
- package/dist/lib/controllable-state.d.ts +4 -0
- package/dist/lib/controllable-state.d.ts.map +1 -0
- package/dist/lib/controllable-state.js +11 -0
- package/dist/lib/cron.d.ts +55 -0
- package/dist/lib/cron.d.ts.map +1 -0
- package/dist/lib/cron.js +269 -0
- package/dist/lib/edge-swipe.d.ts +36 -0
- package/dist/lib/edge-swipe.d.ts.map +1 -0
- package/dist/lib/edge-swipe.js +73 -0
- package/dist/lib/file-upload.d.ts +187 -0
- package/dist/lib/file-upload.d.ts.map +1 -0
- package/dist/lib/file-upload.js +349 -0
- package/dist/lib/filter-query.d.ts +90 -0
- package/dist/lib/filter-query.d.ts.map +1 -0
- package/dist/lib/filter-query.js +459 -0
- package/dist/lib/filter.d.ts +120 -0
- package/dist/lib/filter.d.ts.map +1 -0
- package/dist/lib/filter.js +399 -0
- package/dist/lib/format-bytes.d.ts +3 -0
- package/dist/lib/format-bytes.d.ts.map +1 -0
- package/dist/lib/format-bytes.js +16 -0
- package/dist/lib/gpu-cron.d.ts +51 -0
- package/dist/lib/gpu-cron.d.ts.map +1 -0
- package/dist/lib/gpu-cron.js +81 -0
- package/dist/lib/gpu-query/featurize.d.ts +19 -0
- package/dist/lib/gpu-query/featurize.d.ts.map +1 -0
- package/dist/lib/gpu-query/featurize.js +88 -0
- package/dist/lib/gpu-query/index.d.ts +73 -0
- package/dist/lib/gpu-query/index.d.ts.map +1 -0
- package/dist/lib/gpu-query/index.js +117 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts +30 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.d.ts +8 -0
- package/dist/lib/gpu-query/model.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.js +91 -0
- package/dist/lib/gpu-query/schema.d.ts +40 -0
- package/dist/lib/gpu-query/schema.d.ts.map +1 -0
- package/dist/lib/gpu-query/schema.js +0 -0
- package/dist/lib/gpu-query/webgpu.d.ts +12 -0
- package/dist/lib/gpu-query/webgpu.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.d.ts +17 -0
- package/dist/lib/gpu-query/weights.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.js +40 -0
- package/dist/lib/gpu-query/weights.json.d.ts +3 -0
- package/dist/lib/gpu-query/weights2.js +25 -0
- package/dist/lib/gpu-time.d.ts +77 -0
- package/dist/lib/gpu-time.d.ts.map +1 -0
- package/dist/lib/gpu-time.js +260 -0
- package/dist/lib/morph-path.d.ts +22 -0
- package/dist/lib/morph-path.d.ts.map +1 -0
- package/dist/lib/morph-path.js +42 -0
- package/dist/lib/passkey.d.ts +120 -0
- package/dist/lib/passkey.d.ts.map +1 -0
- package/dist/lib/passkey.js +186 -0
- package/dist/lib/persistent-state.d.ts +9 -0
- package/dist/lib/persistent-state.d.ts.map +1 -0
- package/dist/lib/persistent-state.js +37 -0
- package/dist/lib/pglite-core.d.ts +219 -0
- package/dist/lib/pglite-core.d.ts.map +1 -0
- package/dist/lib/pglite-core.js +273 -0
- package/dist/lib/pglite-files.d.ts +7 -0
- package/dist/lib/pglite-files.d.ts.map +1 -0
- package/dist/lib/pglite-files.js +17 -0
- package/dist/lib/pglite-schema.d.ts +58 -0
- package/dist/lib/pglite-schema.d.ts.map +1 -0
- package/dist/lib/pglite-schema.js +105 -0
- package/dist/lib/pglite-storage.d.ts +33 -0
- package/dist/lib/pglite-storage.d.ts.map +1 -0
- package/dist/lib/pglite-storage.js +55 -0
- package/dist/lib/pglite-transfer.d.ts +53 -0
- package/dist/lib/pglite-transfer.d.ts.map +1 -0
- package/dist/lib/pglite-transfer.js +126 -0
- package/dist/lib/pglite.d.ts +106 -0
- package/dist/lib/pglite.d.ts.map +1 -0
- package/dist/lib/pglite.js +298 -0
- package/dist/lib/pull-to-refresh.d.ts +24 -0
- package/dist/lib/pull-to-refresh.d.ts.map +1 -0
- package/dist/lib/pull-to-refresh.js +74 -0
- package/dist/lib/scroll-hidden.d.ts +6 -0
- package/dist/lib/scroll-hidden.d.ts.map +1 -0
- package/dist/lib/scroll-hidden.js +21 -0
- package/dist/lib/sheet-drag.d.ts +10 -2
- package/dist/lib/sheet-drag.d.ts.map +1 -1
- package/dist/lib/sheet-drag.js +72 -69
- package/dist/lib/sql-format.d.ts +62 -0
- package/dist/lib/sql-format.d.ts.map +1 -0
- package/dist/lib/sql-format.js +175 -0
- package/dist/lib/sql-lex.d.ts +25 -0
- package/dist/lib/sql-lex.d.ts.map +1 -0
- package/dist/lib/sql-lex.js +135 -0
- package/dist/lib/tab-lock.d.ts +28 -0
- package/dist/lib/tab-lock.d.ts.map +1 -0
- package/dist/lib/tab-lock.js +80 -0
- package/dist/lib/tailscale-connect.d.ts +56 -0
- package/dist/lib/tailscale-connect.d.ts.map +1 -0
- package/dist/lib/tailscale-connect.js +99 -0
- package/dist/lib/tailscale-fake.d.ts +33 -0
- package/dist/lib/tailscale-fake.d.ts.map +1 -0
- package/dist/lib/tailscale-fake.js +80 -0
- package/dist/lib/tailscale-policy.d.ts +71 -0
- package/dist/lib/tailscale-policy.d.ts.map +1 -0
- package/dist/lib/tailscale-policy.js +244 -0
- package/dist/lib/tailscale-react.d.ts +20 -0
- package/dist/lib/tailscale-react.d.ts.map +1 -0
- package/dist/lib/tailscale-react.js +37 -0
- package/dist/lib/tailscale-router/bridge.d.ts +60 -0
- package/dist/lib/tailscale-router/bridge.d.ts.map +1 -0
- package/dist/lib/tailscale-router/bridge.js +198 -0
- package/dist/lib/tailscale-router/react.d.ts +19 -0
- package/dist/lib/tailscale-router/react.d.ts.map +1 -0
- package/dist/lib/tailscale-router/react.js +52 -0
- package/dist/lib/tailscale.d.ts +204 -0
- package/dist/lib/tailscale.d.ts.map +1 -0
- package/dist/lib/tailscale.js +443 -0
- package/dist/lib/title-flight.d.ts +34 -0
- package/dist/lib/title-flight.d.ts.map +1 -0
- package/dist/lib/title-flight.js +123 -0
- package/dist/lib/vault-react.d.ts +49 -0
- package/dist/lib/vault-react.d.ts.map +1 -0
- package/dist/lib/vault-react.js +196 -0
- package/dist/lib/vault-storage.d.ts +30 -0
- package/dist/lib/vault-storage.d.ts.map +1 -0
- package/dist/lib/vault-storage.js +105 -0
- package/dist/lib/vault.d.ts +200 -0
- package/dist/lib/vault.d.ts.map +1 -0
- package/dist/lib/vault.js +641 -0
- package/dist/tailscale-sw.js +332 -0
- package/package.json +35 -5
- package/dist/components/icon-button.d.ts +0 -19
- package/dist/components/icon-button.d.ts.map +0 -1
- package/dist/components/icon-button.js +0 -31
- package/dist/components/measure-h.d.ts +0 -7
- package/dist/components/measure-h.d.ts.map +0 -1
- package/dist/components/measure-h.js +0 -20
- package/dist/components/snap-sheet.d.ts +0 -13
- package/dist/components/snap-sheet.d.ts.map +0 -1
- package/dist/components/snap-sheet.js +0 -100
|
@@ -64,23 +64,23 @@ function me(e) {
|
|
|
64
64
|
function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a, defaultAttachments: o = [], onAttachmentsChange: s, expanded: c, defaultExpanded: l = !1, onExpandedChange: u, streaming: d = !1, onStop: f, onSubmit: p, annotator: m, annotateCanvas: x, acceptedFileTypes: E, maxFileSize: D, maxFiles: O, onDropFiles: M, onFilesRejected: F, collapsed: I, defaultCollapsed: L = "none", onCollapsedChange: ee, collapseOnScroll: R, collapseTo: z = "compact", collapseAnchor: te = "bottom", fabPosition: re = "end", fabIcon: ie, children: B, className: ae, style: oe, ref: V }) {
|
|
65
65
|
let se = k.useContext(fe), ce = h(), le = m === void 0 ? ce : m, [H, ue] = G(t, n, r), [U, W] = G(a, o, s), [he, be] = G(c, l, u), [K, q] = G(I, L, ee), [J, Ce] = j(null), [we, Te] = j(null), [Ee, De] = j(null), Y = A(null), Oe = A(H);
|
|
66
66
|
Oe.current = H;
|
|
67
|
-
let
|
|
68
|
-
|
|
69
|
-
let
|
|
67
|
+
let ke = A(U);
|
|
68
|
+
ke.current = U;
|
|
69
|
+
let Ae = !!(H.trim() || U.length), je = k.useCallback((e) => W((t) => t.some((t) => t.id === e.id) ? t : [...t, e]), [W]), Me = k.useCallback((e, t) => W((n) => n.map((n) => n.id === e ? {
|
|
70
70
|
...n,
|
|
71
71
|
...t
|
|
72
|
-
} : n)), [W]),
|
|
72
|
+
} : n)), [W]), Ne = (e) => {
|
|
73
73
|
J?.commands.removeAttachment(e), W((t) => t.filter((t) => t.id !== e));
|
|
74
|
-
},
|
|
74
|
+
}, X = A(/* @__PURE__ */ new Map()), Pe = A([]), Fe = A(0);
|
|
75
75
|
k.useEffect(() => {
|
|
76
76
|
let e = new Set(U.map((e) => e.id));
|
|
77
|
-
|
|
78
|
-
e.has(n) || (URL.revokeObjectURL(t),
|
|
77
|
+
X.current.forEach((t, n) => {
|
|
78
|
+
e.has(n) || (URL.revokeObjectURL(t), X.current.delete(n));
|
|
79
79
|
});
|
|
80
80
|
}, [U]), k.useEffect(() => () => {
|
|
81
|
-
|
|
81
|
+
X.current.forEach((e) => URL.revokeObjectURL(e)), X.current.clear(), Pe.current.forEach((e) => URL.revokeObjectURL(e)), Pe.current = [];
|
|
82
82
|
}, []);
|
|
83
|
-
let
|
|
83
|
+
let Ie = g(), [Le, Re] = j(""), ze = (e) => {
|
|
84
84
|
if (!e.length) return;
|
|
85
85
|
if (F) return F(e);
|
|
86
86
|
let t = (e) => {
|
|
@@ -95,11 +95,11 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
95
95
|
i.length && `${t(i)} ${o(i)} over the ${S(D)} limit.`,
|
|
96
96
|
a.length && `${t(a)} didn't fit — a draft holds ${O} attachment${O === 1 ? "" : "s"}.`
|
|
97
97
|
].filter(Boolean), c = e.length;
|
|
98
|
-
|
|
98
|
+
Ie.warning(c === 1 ? "Couldn't attach a file" : `Couldn't attach ${c} files`, {
|
|
99
99
|
id: "composer-files-rejected",
|
|
100
100
|
description: s.join(" ")
|
|
101
101
|
});
|
|
102
|
-
},
|
|
102
|
+
}, Be = (e, t) => {
|
|
103
103
|
let n = J;
|
|
104
104
|
if (!n || n.isDestroyed || !e.length) return;
|
|
105
105
|
let r = t === void 0 ? void 0 : Math.min(t, n.state.doc.content.size), i = r === void 0 ? n.state.selection.$from : n.state.doc.resolve(r), a = i.parent.isTextblock ? i.parent.textBetween(Math.max(0, i.parentOffset - 1), i.parentOffset, "", "") : "", o = [...a && !/\s/.test(a) ? [{
|
|
@@ -116,7 +116,7 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
116
116
|
text: " "
|
|
117
117
|
}])], s = n.chain().focus();
|
|
118
118
|
(r === void 0 ? s.insertContent(o) : s.insertContentAt(r, o)).run();
|
|
119
|
-
},
|
|
119
|
+
}, Ve = (e, { source: t = "api", point: n } = {}) => {
|
|
120
120
|
let r = [], i = e.filter((e) => {
|
|
121
121
|
if (!_(e, E)) r.push({
|
|
122
122
|
file: e,
|
|
@@ -130,13 +130,13 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
130
130
|
return !1;
|
|
131
131
|
});
|
|
132
132
|
if (O != null) {
|
|
133
|
-
let e = Math.max(0, O -
|
|
133
|
+
let e = Math.max(0, O - ke.current.length - Fe.current);
|
|
134
134
|
i.slice(e).forEach((e) => r.push({
|
|
135
135
|
file: e,
|
|
136
136
|
reason: "count"
|
|
137
137
|
})), i = i.slice(0, e);
|
|
138
138
|
}
|
|
139
|
-
if (
|
|
139
|
+
if (ze(r), i.length && M) {
|
|
140
140
|
let e = M(i, t);
|
|
141
141
|
e === !1 ? i = [] : Array.isArray(e) && (i = e);
|
|
142
142
|
}
|
|
@@ -157,7 +157,7 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
157
157
|
top: n.y
|
|
158
158
|
})?.pos);
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
Be(o, s), Re(`Attached ${i.length === 1 ? a[0].name : `${i.length} files`}.`);
|
|
161
161
|
for (let { file: e, kind: t, id: n, name: r } of a) {
|
|
162
162
|
let i = {
|
|
163
163
|
id: n,
|
|
@@ -167,9 +167,9 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
167
167
|
kind: t,
|
|
168
168
|
file: e
|
|
169
169
|
};
|
|
170
|
-
|
|
170
|
+
Fe.current++;
|
|
171
171
|
let a = (e) => {
|
|
172
|
-
|
|
172
|
+
Fe.current--, je(e);
|
|
173
173
|
};
|
|
174
174
|
if (t === "image") {
|
|
175
175
|
C(e).then((e) => a({
|
|
@@ -179,7 +179,7 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
179
179
|
continue;
|
|
180
180
|
}
|
|
181
181
|
let o = URL.createObjectURL(e);
|
|
182
|
-
|
|
182
|
+
X.current.set(n, o), t === "text" ? w(e).then((e) => a({
|
|
183
183
|
...i,
|
|
184
184
|
src: o,
|
|
185
185
|
excerpt: e
|
|
@@ -192,17 +192,23 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
192
192
|
src: o
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
}, He = A(null), [Ue, We] = j(!1), Ge = k.useCallback((e) => {
|
|
196
|
+
He.current = e, We(!!e);
|
|
197
|
+
}, []), Ke = A(p);
|
|
198
|
+
Ke.current = p;
|
|
199
|
+
let qe = k.useCallback((e, t) => Ke.current?.(e, t), []), Je = () => {
|
|
200
|
+
if (!Ae) return;
|
|
201
|
+
let e = d ? He.current : null;
|
|
202
|
+
if (d && !e) return;
|
|
203
|
+
let t = Oe.current.trim(), n = ke.current;
|
|
204
|
+
for (let e of n) {
|
|
205
|
+
let t = X.current.get(e.id);
|
|
206
|
+
t && (Pe.current.push(t), X.current.delete(e.id));
|
|
201
207
|
}
|
|
202
|
-
W([]), J && J.commands.clearContent(!0), ue(""), p?.(
|
|
203
|
-
},
|
|
208
|
+
W([]), J && J.commands.clearContent(!0), ue(""), e ? e(t, n) : p?.(t, n);
|
|
209
|
+
}, Ye = () => {
|
|
204
210
|
f?.();
|
|
205
|
-
},
|
|
211
|
+
}, Xe = A({
|
|
206
212
|
collapsed: K,
|
|
207
213
|
collapseTo: z,
|
|
208
214
|
streaming: d,
|
|
@@ -210,7 +216,7 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
210
216
|
blocked: () => !1,
|
|
211
217
|
set: q
|
|
212
218
|
});
|
|
213
|
-
|
|
219
|
+
Xe.current = {
|
|
214
220
|
collapsed: K,
|
|
215
221
|
collapseTo: z,
|
|
216
222
|
streaming: d,
|
|
@@ -231,7 +237,7 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
231
237
|
t: e,
|
|
232
238
|
d: a
|
|
233
239
|
});
|
|
234
|
-
let l =
|
|
240
|
+
let l = Xe.current;
|
|
235
241
|
if (a < ge) {
|
|
236
242
|
r = 0, l.collapsed !== "none" && l.set("none");
|
|
237
243
|
return;
|
|
@@ -250,34 +256,37 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
250
256
|
};
|
|
251
257
|
return e.addEventListener("scroll", a, { passive: !0 }), () => e.removeEventListener("scroll", a);
|
|
252
258
|
}, [R, te]);
|
|
253
|
-
let
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
let e =
|
|
257
|
-
|
|
258
|
-
}, [
|
|
259
|
-
let
|
|
259
|
+
let Z = `${K}|${he}`, Ze = A(Z), Q = A(null);
|
|
260
|
+
Z !== Ze.current && !Q.current && typeof window < "u" && (Q.current = xe(Y.current)), k.useLayoutEffect(() => {
|
|
261
|
+
Ze.current = Z;
|
|
262
|
+
let e = Q.current;
|
|
263
|
+
Q.current = null, e && !i() && Se(Y.current, e);
|
|
264
|
+
}, [Z]);
|
|
265
|
+
let Qe = () => {
|
|
260
266
|
q("none"), requestAnimationFrame(() => J?.commands.focus("end"));
|
|
261
|
-
},
|
|
267
|
+
}, $e = !!R || I !== void 0 || L === "fab" || z === "fab", et = A(void 0), tt = A(null), nt = {
|
|
262
268
|
value: H,
|
|
263
269
|
setValue: ue,
|
|
264
270
|
attachments: U,
|
|
265
|
-
addAttachment:
|
|
266
|
-
removeAttachment:
|
|
267
|
-
updateAttachment:
|
|
268
|
-
attachFiles:
|
|
271
|
+
addAttachment: je,
|
|
272
|
+
removeAttachment: Ne,
|
|
273
|
+
updateAttachment: Me,
|
|
274
|
+
attachFiles: Ve,
|
|
269
275
|
acceptedFileTypes: E,
|
|
270
276
|
expanded: he,
|
|
271
277
|
setExpanded: be,
|
|
272
278
|
streaming: d,
|
|
273
|
-
canSend:
|
|
274
|
-
send:
|
|
275
|
-
stop:
|
|
279
|
+
canSend: Ae,
|
|
280
|
+
send: Je,
|
|
281
|
+
stop: Ye,
|
|
282
|
+
submit: qe,
|
|
283
|
+
canQueue: Ue,
|
|
284
|
+
setQueue: Ge,
|
|
276
285
|
annotate: (e) => {
|
|
277
|
-
let t =
|
|
286
|
+
let t = ke.current.find((t) => t.id === e);
|
|
278
287
|
if (t && me(t) !== "image") return;
|
|
279
|
-
let n = typeof CSS < "u" ? CSS.escape(e) : e, r =
|
|
280
|
-
|
|
288
|
+
let n = typeof CSS < "u" ? CSS.escape(e) : e, r = tt.current;
|
|
289
|
+
et.current = () => {
|
|
281
290
|
let t = r?.isConnected && r.getAttribute("data-attachment-id") === e ? r : Y.current?.querySelector(`[data-slot="composer-attachment"][data-attachment-id="${n}"]`);
|
|
282
291
|
return t?.querySelector("img") ?? t ?? null;
|
|
283
292
|
}, Te(e);
|
|
@@ -291,13 +300,13 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
291
300
|
setCollapsed: q,
|
|
292
301
|
optionsOutlet: Ee,
|
|
293
302
|
setOptionsOutlet: De,
|
|
294
|
-
fab:
|
|
303
|
+
fab: $e ? {
|
|
295
304
|
icon: ie,
|
|
296
|
-
restore:
|
|
305
|
+
restore: Qe
|
|
297
306
|
} : null
|
|
298
307
|
}, $ = we ? U.find((e) => e.id === we) : void 0;
|
|
299
308
|
return /* @__PURE__ */ N(de.Provider, {
|
|
300
|
-
value:
|
|
309
|
+
value: nt,
|
|
301
310
|
children: /* @__PURE__ */ P(fe.Provider, {
|
|
302
311
|
value: null,
|
|
303
312
|
children: [/* @__PURE__ */ P("div", {
|
|
@@ -310,7 +319,7 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
310
319
|
"data-collapsed": K,
|
|
311
320
|
"data-fab-position": re,
|
|
312
321
|
onPointerDownCapture: (e) => {
|
|
313
|
-
|
|
322
|
+
tt.current = e.target.closest?.("[data-attachment-id]") ?? null;
|
|
314
323
|
},
|
|
315
324
|
className: e("group/composer relative box-border flex w-full min-w-0 flex-col", se?.className, ae),
|
|
316
325
|
style: oe,
|
|
@@ -322,16 +331,16 @@ function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a,
|
|
|
322
331
|
"data-slot": "composer-announcer",
|
|
323
332
|
role: "status",
|
|
324
333
|
"aria-live": "polite",
|
|
325
|
-
children:
|
|
334
|
+
children: Le
|
|
326
335
|
}) })]
|
|
327
336
|
}), $?.src ? /* @__PURE__ */ N(ct, {
|
|
328
337
|
src: $.src,
|
|
329
338
|
canvas: x,
|
|
330
339
|
annotator: le,
|
|
331
|
-
origin:
|
|
340
|
+
origin: et.current,
|
|
332
341
|
onClose: () => Te(null),
|
|
333
342
|
onSave: (e) => {
|
|
334
|
-
|
|
343
|
+
Me($.id, {
|
|
335
344
|
src: e,
|
|
336
345
|
type: "image/png"
|
|
337
346
|
}), Te(null);
|
|
@@ -426,7 +435,7 @@ function we({ children: e }) {
|
|
|
426
435
|
}
|
|
427
436
|
function Te({ className: t }) {
|
|
428
437
|
let { collapsed: n, setOptionsOutlet: r } = U(), i = n === "compact";
|
|
429
|
-
return /* @__PURE__ */ P(M, { children: [i ? /* @__PURE__ */ N(
|
|
438
|
+
return /* @__PURE__ */ P(M, { children: [i ? /* @__PURE__ */ N(Pe, {}) : null, /* @__PURE__ */ N("span", {
|
|
430
439
|
ref: r,
|
|
431
440
|
"data-slot": "composer-options-outlet",
|
|
432
441
|
className: e(i ? "contents" : "hidden", t)
|
|
@@ -496,7 +505,7 @@ function Oe(e, t) {
|
|
|
496
505
|
isFocusVisible: p
|
|
497
506
|
};
|
|
498
507
|
}
|
|
499
|
-
function
|
|
508
|
+
function ke({ state: t, label: n, hint: r }) {
|
|
500
509
|
return /* @__PURE__ */ N(E, { children: t ? /* @__PURE__ */ N(O.div, {
|
|
501
510
|
"data-slot": "composer-drop-overlay",
|
|
502
511
|
"data-state": t,
|
|
@@ -563,7 +572,7 @@ function X({ state: t, label: n, hint: r }) {
|
|
|
563
572
|
})
|
|
564
573
|
}, "drop") : null });
|
|
565
574
|
}
|
|
566
|
-
function
|
|
575
|
+
function Ae({ size: n, dropZone: r = !0, dropLabel: i, className: a, ref: o, children: c, ...l }) {
|
|
567
576
|
let { renderCard: u, collapsed: d, fab: p, acceptedFileTypes: m } = U(), h = d === "fab" && !!p, g = A(null), _ = Oe(g, !r || h), v = !r || h ? null : _.isDropTarget ? "drop" : _.isFocusVisible ? "focus" : null, y = /* @__PURE__ */ P("div", {
|
|
568
577
|
ref: (e) => {
|
|
569
578
|
g.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
|
|
@@ -582,7 +591,7 @@ function ke({ size: n, dropZone: r = !0, dropLabel: i, className: a, ref: o, chi
|
|
|
582
591
|
"aria-hidden": h || void 0,
|
|
583
592
|
children: c
|
|
584
593
|
}),
|
|
585
|
-
r ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(
|
|
594
|
+
r ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(ke, {
|
|
586
595
|
state: v,
|
|
587
596
|
label: i,
|
|
588
597
|
hint: m?.length ? b(m) : "Images, documents, code — any file"
|
|
@@ -609,7 +618,7 @@ function ke({ size: n, dropZone: r = !0, dropLabel: i, className: a, ref: o, chi
|
|
|
609
618
|
});
|
|
610
619
|
return /* @__PURE__ */ N(M, { children: u ? u(y) : y });
|
|
611
620
|
}
|
|
612
|
-
var
|
|
621
|
+
var je = B("box-border flex min-w-0 items-center gap-[5px]", {
|
|
613
622
|
variants: { align: {
|
|
614
623
|
"block-start": "order-[-2] w-full px-3 pt-2.5",
|
|
615
624
|
"inline-start": "order-[-1] shrink-0 self-start pt-2 pl-2",
|
|
@@ -618,24 +627,24 @@ var Ae = B("box-border flex min-w-0 items-center gap-[5px]", {
|
|
|
618
627
|
} },
|
|
619
628
|
defaultVariants: { align: "block-end" }
|
|
620
629
|
});
|
|
621
|
-
function
|
|
630
|
+
function Me({ align: t, className: n, ref: r, ...i }) {
|
|
622
631
|
return /* @__PURE__ */ N("div", {
|
|
623
632
|
ref: r,
|
|
624
633
|
"data-slot": "composer-addon",
|
|
625
634
|
"data-align": t ?? "block-end",
|
|
626
|
-
className: e(
|
|
635
|
+
className: e(je({ align: t }), n),
|
|
627
636
|
...i
|
|
628
637
|
});
|
|
629
638
|
}
|
|
630
|
-
function
|
|
631
|
-
return /* @__PURE__ */ N(
|
|
639
|
+
function Ne({ className: t, ...n }) {
|
|
640
|
+
return /* @__PURE__ */ N(Me, {
|
|
632
641
|
"data-slot": "composer-footer",
|
|
633
642
|
align: "block-end",
|
|
634
643
|
className: e("flex-wrap group-data-[collapsed=compact]/composer:order-1 group-data-[collapsed=compact]/composer:[&>[data-slot=composer-spacer]]:hidden group-data-[collapsed=compact]/composer:w-auto group-data-[collapsed=compact]/composer:flex-nowrap group-data-[collapsed=compact]/composer:py-[7px] group-data-[collapsed=compact]/composer:pr-[7px] group-data-[collapsed=compact]/composer:pl-0", t),
|
|
635
644
|
...n
|
|
636
645
|
});
|
|
637
646
|
}
|
|
638
|
-
function
|
|
647
|
+
function X({ className: t, ...n }) {
|
|
639
648
|
return /* @__PURE__ */ N("span", {
|
|
640
649
|
"data-slot": "composer-spacer",
|
|
641
650
|
"aria-hidden": "true",
|
|
@@ -643,7 +652,7 @@ function Q({ className: t, ...n }) {
|
|
|
643
652
|
...n
|
|
644
653
|
});
|
|
645
654
|
}
|
|
646
|
-
function
|
|
655
|
+
function Pe({ className: t, ...n }) {
|
|
647
656
|
return /* @__PURE__ */ N("span", {
|
|
648
657
|
"data-slot": "composer-separator",
|
|
649
658
|
role: "separator",
|
|
@@ -652,7 +661,7 @@ function Me({ className: t, ...n }) {
|
|
|
652
661
|
...n
|
|
653
662
|
});
|
|
654
663
|
}
|
|
655
|
-
function
|
|
664
|
+
function Fe({ icon: t, className: n, children: r, ...i }) {
|
|
656
665
|
return /* @__PURE__ */ P("span", {
|
|
657
666
|
"data-slot": "composer-text",
|
|
658
667
|
className: e("flex min-w-0 items-center gap-[7px] text-caption text-muted-foreground", n),
|
|
@@ -664,7 +673,7 @@ function Ne({ icon: t, className: n, children: r, ...i }) {
|
|
|
664
673
|
}) : null, r]
|
|
665
674
|
});
|
|
666
675
|
}
|
|
667
|
-
var
|
|
676
|
+
var Ie = B(e(t, "flex shrink-0 cursor-pointer items-center justify-center border-0 font-sans outline-none data-disabled:cursor-default data-disabled:opacity-35 data-focus-visible:ring-2 data-focus-visible:ring-primary/60"), {
|
|
668
677
|
variants: {
|
|
669
678
|
variant: {
|
|
670
679
|
ghost: "bg-transparent text-muted-foreground hover:bg-secondary!",
|
|
@@ -693,10 +702,10 @@ var Pe = B(e(t, "flex shrink-0 cursor-pointer items-center justify-center border
|
|
|
693
702
|
tint: !1
|
|
694
703
|
}
|
|
695
704
|
});
|
|
696
|
-
function
|
|
705
|
+
function Le({ variant: t, size: n, tint: r, className: i, ...a }) {
|
|
697
706
|
return /* @__PURE__ */ N(f, {
|
|
698
707
|
"data-slot": "composer-button",
|
|
699
|
-
className: e(
|
|
708
|
+
className: e(Ie({
|
|
700
709
|
variant: t,
|
|
701
710
|
size: n ?? (t === "pill" ? "pill" : t === "primary" || t === "destructive" ? "round" : "icon"),
|
|
702
711
|
tint: !!r
|
|
@@ -704,7 +713,7 @@ function Fe({ variant: t, size: n, tint: r, className: i, ...a }) {
|
|
|
704
713
|
...a
|
|
705
714
|
});
|
|
706
715
|
}
|
|
707
|
-
function
|
|
716
|
+
function Re({ icon: e, children: t }) {
|
|
708
717
|
return /* @__PURE__ */ P(M, { children: [
|
|
709
718
|
typeof e == "string" ? /* @__PURE__ */ N(s, {
|
|
710
719
|
name: e,
|
|
@@ -723,11 +732,11 @@ function Ie({ icon: e, children: t }) {
|
|
|
723
732
|
})
|
|
724
733
|
] });
|
|
725
734
|
}
|
|
726
|
-
var
|
|
727
|
-
function
|
|
735
|
+
var ze = B("relative flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[7px] text-footnote text-foreground outline-none data-focused:bg-secondary data-pressed:bg-secondary-strong data-disabled:cursor-default data-disabled:opacity-40");
|
|
736
|
+
function Be({ className: t, children: n, ...r }) {
|
|
728
737
|
return /* @__PURE__ */ N(ee, {
|
|
729
738
|
"data-slot": "composer-menu-item",
|
|
730
|
-
className: e(
|
|
739
|
+
className: e(ze(), t),
|
|
731
740
|
...r,
|
|
732
741
|
children: re(n, (e, { isSelected: t, selectionMode: n }) => /* @__PURE__ */ P(M, { children: [n === "none" ? null : /* @__PURE__ */ N("span", {
|
|
733
742
|
className: "grid w-3.5 shrink-0 place-items-center text-primary",
|
|
@@ -758,15 +767,15 @@ function Re({ className: t, children: n, ...r }) {
|
|
|
758
767
|
}), e] }))
|
|
759
768
|
});
|
|
760
769
|
}
|
|
761
|
-
function
|
|
770
|
+
function Ve({ "aria-label": t, options: n, value: r, defaultValue: i, onChange: a, icon: o, tint: s, className: c, menuClassName: l }) {
|
|
762
771
|
let [u, d] = G(r, i ?? n[0]?.id ?? "", a), f = n.find((e) => e.id === u) ?? n[0];
|
|
763
|
-
return /* @__PURE__ */ P(R, { children: [/* @__PURE__ */ N(
|
|
772
|
+
return /* @__PURE__ */ P(R, { children: [/* @__PURE__ */ N(Le, {
|
|
764
773
|
"data-slot": "composer-select",
|
|
765
774
|
variant: "pill",
|
|
766
775
|
tint: s,
|
|
767
776
|
"aria-label": `${t}: ${f?.label ?? ""}`,
|
|
768
777
|
className: c,
|
|
769
|
-
children: /* @__PURE__ */ N(
|
|
778
|
+
children: /* @__PURE__ */ N(Re, {
|
|
770
779
|
icon: o,
|
|
771
780
|
children: f?.short ?? f?.label
|
|
772
781
|
})
|
|
@@ -783,7 +792,7 @@ function ze({ "aria-label": t, options: n, value: r, defaultValue: i, onChange:
|
|
|
783
792
|
t != null && d(String(t));
|
|
784
793
|
},
|
|
785
794
|
className: "outline-none",
|
|
786
|
-
children: n.map((e) => /* @__PURE__ */ N(
|
|
795
|
+
children: n.map((e) => /* @__PURE__ */ N(Be, {
|
|
787
796
|
id: e.id,
|
|
788
797
|
textValue: e.label,
|
|
789
798
|
children: /* @__PURE__ */ P("span", {
|
|
@@ -800,7 +809,7 @@ function ze({ "aria-label": t, options: n, value: r, defaultValue: i, onChange:
|
|
|
800
809
|
})
|
|
801
810
|
})] });
|
|
802
811
|
}
|
|
803
|
-
function
|
|
812
|
+
function He() {
|
|
804
813
|
return /* @__PURE__ */ P("svg", {
|
|
805
814
|
width: "30",
|
|
806
815
|
height: "30",
|
|
@@ -825,7 +834,7 @@ function Be() {
|
|
|
825
834
|
})]
|
|
826
835
|
});
|
|
827
836
|
}
|
|
828
|
-
function
|
|
837
|
+
function Ue({ id: e, children: t }) {
|
|
829
838
|
return /* @__PURE__ */ N(E, {
|
|
830
839
|
mode: "popLayout",
|
|
831
840
|
initial: !1,
|
|
@@ -851,8 +860,8 @@ function Ve({ id: e, children: t }) {
|
|
|
851
860
|
}, e)
|
|
852
861
|
});
|
|
853
862
|
}
|
|
854
|
-
function
|
|
855
|
-
let { streaming: c, stop: l } = U(), u = c || !!r, d = n === "solid" ? /* @__PURE__ */ N(
|
|
863
|
+
function We({ variant: n = "ring", forceMount: r, className: i, ...o }) {
|
|
864
|
+
let { streaming: c, stop: l } = U(), u = c || !!r, d = n === "solid" ? /* @__PURE__ */ N(Le, {
|
|
856
865
|
"data-slot": "composer-stop",
|
|
857
866
|
variant: "destructive",
|
|
858
867
|
"aria-label": "Stop",
|
|
@@ -866,7 +875,7 @@ function He({ variant: n = "ring", forceMount: r, className: i, ...o }) {
|
|
|
866
875
|
onPress: l,
|
|
867
876
|
"aria-label": "Stop",
|
|
868
877
|
...o,
|
|
869
|
-
children: [/* @__PURE__ */ N(
|
|
878
|
+
children: [/* @__PURE__ */ N(He, {}), /* @__PURE__ */ N(s, {
|
|
870
879
|
name: "stop-square",
|
|
871
880
|
size: 12,
|
|
872
881
|
sw: 2.4
|
|
@@ -897,19 +906,19 @@ function He({ variant: n = "ring", forceMount: r, className: i, ...o }) {
|
|
|
897
906
|
}, "stop") : null
|
|
898
907
|
});
|
|
899
908
|
}
|
|
900
|
-
function
|
|
901
|
-
let { streaming: o, canSend: c,
|
|
909
|
+
function Ge({ morph: n = !0, stopVariant: r = "ring", className: i, ...a }) {
|
|
910
|
+
let { streaming: o, canSend: c, canQueue: l, send: u, stop: d } = U(), p = o && l && c, m = o && n && !p;
|
|
902
911
|
return /* @__PURE__ */ N(f, {
|
|
903
|
-
"data-slot":
|
|
904
|
-
"data-state":
|
|
905
|
-
"aria-label":
|
|
906
|
-
isDisabled:
|
|
907
|
-
onPress:
|
|
908
|
-
className: e(t, "relative flex size-[30px] shrink-0 cursor-pointer items-center justify-center overflow-visible rounded-[50%] border-0 p-0 font-sans text-white outline-none data-disabled:cursor-default data-focus-visible:ring-2 data-focus-visible:ring-primary/60", "[transition:background-color_var(--duration-spring-snappy)_var(--ease-spring-snappy),opacity_var(--duration-spring-snappy)_var(--ease-spring-snappy),color_var(--duration-spring-snappy)_var(--ease-spring-snappy)]",
|
|
912
|
+
"data-slot": m ? "composer-stop" : "composer-send",
|
|
913
|
+
"data-state": m ? "stop" : p ? "queue" : "send",
|
|
914
|
+
"aria-label": m ? "Stop" : p ? "Queue message" : "Send",
|
|
915
|
+
isDisabled: m ? !1 : !c || o && !l,
|
|
916
|
+
onPress: m ? d : u,
|
|
917
|
+
className: e(t, "relative flex size-[30px] shrink-0 cursor-pointer items-center justify-center overflow-visible rounded-[50%] border-0 p-0 font-sans text-white outline-none data-disabled:cursor-default data-focus-visible:ring-2 data-focus-visible:ring-primary/60", "[transition:background-color_var(--duration-spring-snappy)_var(--ease-spring-snappy),opacity_var(--duration-spring-snappy)_var(--ease-spring-snappy),color_var(--duration-spring-snappy)_var(--ease-spring-snappy)]", m ? r === "solid" ? "bg-destructive" : "bg-transparent text-foreground" : "bg-primary data-disabled:opacity-35", i),
|
|
909
918
|
...a,
|
|
910
|
-
children: /* @__PURE__ */ N(
|
|
911
|
-
id:
|
|
912
|
-
children:
|
|
919
|
+
children: /* @__PURE__ */ N(Ue, {
|
|
920
|
+
id: m ? `stop-${r}` : "send",
|
|
921
|
+
children: m ? r === "solid" ? /* @__PURE__ */ N("span", { className: "block size-[9px] rounded-[2px] bg-current" }) : /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(He, {}), /* @__PURE__ */ N(s, {
|
|
913
922
|
name: "stop-square",
|
|
914
923
|
size: 12,
|
|
915
924
|
sw: 2.4
|
|
@@ -921,7 +930,7 @@ function Ue({ morph: n = !0, stopVariant: r = "ring", className: i, ...a }) {
|
|
|
921
930
|
})
|
|
922
931
|
});
|
|
923
932
|
}
|
|
924
|
-
function
|
|
933
|
+
function Ke({ acceptedFileTypes: e, allowsMultiple: t = !0, acceptDirectory: n, defaultCamera: r, icon: i = "plus", label: a = "Add files", className: o, onPress: c, ...l }) {
|
|
925
934
|
let { attachFiles: u, acceptedFileTypes: d } = U();
|
|
926
935
|
return /* @__PURE__ */ N(I, {
|
|
927
936
|
acceptedFileTypes: e ?? d,
|
|
@@ -929,7 +938,7 @@ function We({ acceptedFileTypes: e, allowsMultiple: t = !0, acceptDirectory: n,
|
|
|
929
938
|
acceptDirectory: n,
|
|
930
939
|
defaultCamera: r,
|
|
931
940
|
onSelect: (e) => u(Array.from(e ?? []), { source: "picker" }),
|
|
932
|
-
children: /* @__PURE__ */ N(
|
|
941
|
+
children: /* @__PURE__ */ N(Le, {
|
|
933
942
|
"data-slot": "composer-add",
|
|
934
943
|
variant: "ghost",
|
|
935
944
|
"aria-label": a,
|
|
@@ -947,8 +956,8 @@ function We({ acceptedFileTypes: e, allowsMultiple: t = !0, acceptDirectory: n,
|
|
|
947
956
|
})
|
|
948
957
|
});
|
|
949
958
|
}
|
|
950
|
-
function
|
|
951
|
-
return /* @__PURE__ */ N(
|
|
959
|
+
function qe({ accept: e, acceptedFileTypes: t, label: n = "Attach files", ...r }) {
|
|
960
|
+
return /* @__PURE__ */ N(Ke, {
|
|
952
961
|
"data-slot": "composer-attach",
|
|
953
962
|
icon: "paperclip-diagonal",
|
|
954
963
|
label: n,
|
|
@@ -956,7 +965,7 @@ function Ge({ accept: e, acceptedFileTypes: t, label: n = "Attach files", ...r }
|
|
|
956
965
|
...r
|
|
957
966
|
});
|
|
958
967
|
}
|
|
959
|
-
function
|
|
968
|
+
function Je({ className: n }) {
|
|
960
969
|
let { expanded: r, setExpanded: i } = U(), a = r ? "Collapse composer" : "Expand composer";
|
|
961
970
|
return /* @__PURE__ */ N(p, {
|
|
962
971
|
"data-slot": "composer-expand",
|
|
@@ -967,7 +976,7 @@ function Ke({ className: n }) {
|
|
|
967
976
|
i(!r);
|
|
968
977
|
},
|
|
969
978
|
title: a,
|
|
970
|
-
children: /* @__PURE__ */ N(
|
|
979
|
+
children: /* @__PURE__ */ N(Ue, {
|
|
971
980
|
id: r ? "restore" : "expand",
|
|
972
981
|
children: /* @__PURE__ */ N(s, {
|
|
973
982
|
name: r ? "arrows-collapse" : "arrows-expand",
|
|
@@ -977,13 +986,13 @@ function Ke({ className: n }) {
|
|
|
977
986
|
})
|
|
978
987
|
});
|
|
979
988
|
}
|
|
980
|
-
var
|
|
989
|
+
var Ye = c({
|
|
981
990
|
scope: "terminal",
|
|
982
991
|
appearance: "dark"
|
|
983
|
-
}),
|
|
992
|
+
}), Xe = c({
|
|
984
993
|
scope: "workbench",
|
|
985
994
|
appearance: "dark"
|
|
986
|
-
}),
|
|
995
|
+
}), Z = {
|
|
987
996
|
image: {
|
|
988
997
|
icon: "photo",
|
|
989
998
|
color: "var(--success, oklch(0.723 0.191 149.6))",
|
|
@@ -1020,17 +1029,17 @@ var qe = c({
|
|
|
1020
1029
|
label: "File"
|
|
1021
1030
|
}
|
|
1022
1031
|
};
|
|
1023
|
-
function
|
|
1032
|
+
function Ze(e, t) {
|
|
1024
1033
|
let n = x(e.name).toUpperCase();
|
|
1025
|
-
return [n && n.length <= 5 ? n :
|
|
1034
|
+
return [n && n.length <= 5 ? n : Z[t].label, S(e.size)].filter(Boolean).join(" · ");
|
|
1026
1035
|
}
|
|
1027
|
-
function
|
|
1036
|
+
function Q({ children: t, className: n }) {
|
|
1028
1037
|
return /* @__PURE__ */ N("span", {
|
|
1029
1038
|
className: e("pointer-events-none absolute bottom-1 left-1 grid h-[18px] min-w-[18px] place-items-center rounded-md bg-black/55 px-1 text-[9.5px] leading-none font-bold tracking-[.02em] text-white uppercase", n),
|
|
1030
1039
|
children: t
|
|
1031
1040
|
});
|
|
1032
1041
|
}
|
|
1033
|
-
function
|
|
1042
|
+
function Qe({ a: e, kind: t }) {
|
|
1034
1043
|
let n = x(e.name);
|
|
1035
1044
|
if (t === "video" && e.preview) return /* @__PURE__ */ P("span", {
|
|
1036
1045
|
className: "relative block h-[58px] w-[104px]",
|
|
@@ -1058,7 +1067,7 @@ function Ze({ a: e, kind: t }) {
|
|
|
1058
1067
|
className: "[&_path]:fill-current"
|
|
1059
1068
|
})
|
|
1060
1069
|
}),
|
|
1061
|
-
n ? /* @__PURE__ */ N(
|
|
1070
|
+
n ? /* @__PURE__ */ N(Q, { children: n }) : null
|
|
1062
1071
|
]
|
|
1063
1072
|
});
|
|
1064
1073
|
if (t === "text" && e.excerpt) return /* @__PURE__ */ P("span", {
|
|
@@ -1066,9 +1075,9 @@ function Ze({ a: e, kind: t }) {
|
|
|
1066
1075
|
children: [/* @__PURE__ */ N("span", {
|
|
1067
1076
|
className: "block h-full overflow-hidden px-[7px] pt-[6px] font-mono text-[6px] leading-[8px] whitespace-pre text-muted-foreground [mask-image:linear-gradient(to_bottom,#000_45%,transparent_92%)]",
|
|
1068
1077
|
children: e.excerpt
|
|
1069
|
-
}), n ? /* @__PURE__ */ N(
|
|
1078
|
+
}), n ? /* @__PURE__ */ N(Q, { children: n }) : null]
|
|
1070
1079
|
});
|
|
1071
|
-
let r =
|
|
1080
|
+
let r = Z[t];
|
|
1072
1081
|
return /* @__PURE__ */ P("span", {
|
|
1073
1082
|
className: "flex h-[58px] w-[164px] min-w-0 items-center gap-2.5 px-2.5 text-left",
|
|
1074
1083
|
children: [/* @__PURE__ */ N("span", {
|
|
@@ -1086,12 +1095,12 @@ function Ze({ a: e, kind: t }) {
|
|
|
1086
1095
|
children: e.name
|
|
1087
1096
|
}), /* @__PURE__ */ N("span", {
|
|
1088
1097
|
className: "truncate text-caption2 leading-[14px] text-muted-foreground",
|
|
1089
|
-
children:
|
|
1098
|
+
children: Ze(e, t)
|
|
1090
1099
|
})]
|
|
1091
1100
|
})]
|
|
1092
1101
|
});
|
|
1093
1102
|
}
|
|
1094
|
-
function
|
|
1103
|
+
function $e({ className: t, ...n }) {
|
|
1095
1104
|
let { attachments: r, annotate: i, canAnnotate: o, removeAttachment: c, editor: l } = U(), u = A(null), d = (e) => {
|
|
1096
1105
|
let t = Array.from(u.current?.querySelectorAll("[data-slot=\"composer-attachment-open\"]") ?? []), n = t.findIndex((t) => t.closest("[data-attachment-id]")?.getAttribute("data-attachment-id") === e), r = t[n + 1] ?? t[n - 1];
|
|
1097
1106
|
c(e), r ? r.focus() : l?.commands.focus("end");
|
|
@@ -1116,7 +1125,7 @@ function Qe({ className: t, ...n }) {
|
|
|
1116
1125
|
opacity: 0
|
|
1117
1126
|
},
|
|
1118
1127
|
transition: a.smooth,
|
|
1119
|
-
children: /* @__PURE__ */ N(
|
|
1128
|
+
children: /* @__PURE__ */ N(Me, {
|
|
1120
1129
|
ref: u,
|
|
1121
1130
|
"data-slot": "composer-attachments",
|
|
1122
1131
|
align: "block-start",
|
|
@@ -1126,7 +1135,7 @@ function Qe({ className: t, ...n }) {
|
|
|
1126
1135
|
mode: "popLayout",
|
|
1127
1136
|
initial: !1,
|
|
1128
1137
|
children: r.map((t) => {
|
|
1129
|
-
let n = me(t), l = n === "image", u =
|
|
1138
|
+
let n = me(t), l = n === "image", u = Ze(t, n);
|
|
1130
1139
|
return /* @__PURE__ */ P(O.div, {
|
|
1131
1140
|
layout: "position",
|
|
1132
1141
|
layoutDependency: r.map((e) => e.id).join(),
|
|
@@ -1158,8 +1167,8 @@ function Qe({ className: t, ...n }) {
|
|
|
1158
1167
|
onKeyDown: p(t.id),
|
|
1159
1168
|
title: `${o ? "Annotate" : "Preview"} ${t.name}`,
|
|
1160
1169
|
"aria-label": `${o ? "Annotate" : "Preview"} ${t.name}`,
|
|
1161
|
-
"data-theme-scope":
|
|
1162
|
-
className: e(
|
|
1170
|
+
"data-theme-scope": Ye["data-theme-scope"],
|
|
1171
|
+
className: e(Ye.className, "block cursor-pointer overflow-hidden rounded-ctl border border-border bg-background p-0"),
|
|
1163
1172
|
children: t.src ? /* @__PURE__ */ N("img", {
|
|
1164
1173
|
src: t.src,
|
|
1165
1174
|
alt: t.name,
|
|
@@ -1194,7 +1203,7 @@ function Qe({ className: t, ...n }) {
|
|
|
1194
1203
|
title: `${t.name}${u ? ` · ${u}` : ""}`,
|
|
1195
1204
|
"aria-label": `Open ${t.name}${u ? `, ${u}` : ""}`,
|
|
1196
1205
|
className: "block cursor-pointer overflow-hidden rounded-ctl border border-border bg-secondary p-0 font-sans outline-none data-focus-visible:ring-2 data-focus-visible:ring-primary/60",
|
|
1197
|
-
children: /* @__PURE__ */ N(
|
|
1206
|
+
children: /* @__PURE__ */ N(Qe, {
|
|
1198
1207
|
a: t,
|
|
1199
1208
|
kind: n
|
|
1200
1209
|
})
|
|
@@ -1203,8 +1212,12 @@ function Qe({ className: t, ...n }) {
|
|
|
1203
1212
|
c(t.id);
|
|
1204
1213
|
},
|
|
1205
1214
|
"aria-label": `Remove ${t.name}`,
|
|
1206
|
-
className: "absolute -top-
|
|
1207
|
-
children: "
|
|
1215
|
+
className: "absolute -top-[9px] -right-[9px] grid size-6 cursor-pointer place-items-center border-0 bg-transparent p-0 text-[10px] leading-none text-muted-foreground",
|
|
1216
|
+
children: /* @__PURE__ */ N("span", {
|
|
1217
|
+
"aria-hidden": "true",
|
|
1218
|
+
className: "grid size-[18px] place-items-center rounded-[50%] border border-border bg-popover",
|
|
1219
|
+
children: "✕"
|
|
1220
|
+
})
|
|
1208
1221
|
})]
|
|
1209
1222
|
}, t.id);
|
|
1210
1223
|
})
|
|
@@ -1213,63 +1226,75 @@ function Qe({ className: t, ...n }) {
|
|
|
1213
1226
|
}, "strip") : null
|
|
1214
1227
|
});
|
|
1215
1228
|
}
|
|
1216
|
-
function
|
|
1229
|
+
function et(e) {
|
|
1217
1230
|
let { $from: t, empty: n } = e.state.selection;
|
|
1218
1231
|
return n && t.depth === 1 && t.parent.type.name === "paragraph";
|
|
1219
1232
|
}
|
|
1220
|
-
var
|
|
1233
|
+
var tt = [H.create({
|
|
1221
1234
|
name: "composerFileDrop",
|
|
1222
1235
|
addProseMirrorPlugins() {
|
|
1223
1236
|
return [new ue({ props: { handleDOMEvents: { drop: (e, t) => !!t.dataTransfer && Array.from(t.dataTransfer.types ?? []).includes("Files") && !!e.dom.closest("[data-slot=\"composer-card\"][data-drop-zone]") } } })];
|
|
1224
1237
|
}
|
|
1225
1238
|
})];
|
|
1226
|
-
function
|
|
1227
|
-
let
|
|
1228
|
-
|
|
1229
|
-
let
|
|
1230
|
-
let t =
|
|
1231
|
-
return !t || e.key !== "Enter" ? !1 : e.metaKey || e.ctrlKey ? (
|
|
1232
|
-
},
|
|
1239
|
+
function nt({ placeholder: t = "Ask anything — @ files, / commands, paste images", "aria-label": n = "Message", autoFocus: r, imagePaste: i = "chip", slashMenu: a = !0, references: o, className: s }) {
|
|
1240
|
+
let c = U(), { value: l, setValue: f, expanded: p, attachments: m, addAttachment: h, setEditor: g, collapsed: _ } = c, v = A(c);
|
|
1241
|
+
v.current = c;
|
|
1242
|
+
let y = A(null), b = (e) => {
|
|
1243
|
+
let t = y.current;
|
|
1244
|
+
return !t || e.key !== "Enter" ? !1 : e.metaKey || e.ctrlKey ? (v.current.send(), !0) : e.shiftKey ? t.commands.insertContent({ type: "hardBreak" }) : document.querySelector(".slash-menu") || !et(t) ? !1 : (v.current.send(), !0);
|
|
1245
|
+
}, x = (e) => {
|
|
1233
1246
|
let t = e.clipboardData, n = Array.from(t?.files ?? []);
|
|
1234
|
-
if (n.length) return n.every((e) => e.type.startsWith("image/")) && (
|
|
1235
|
-
let
|
|
1236
|
-
return !d(
|
|
1237
|
-
},
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1247
|
+
if (n.length) return n.every((e) => e.type.startsWith("image/")) && (i === "inline" || t?.getData("text/plain").trim()) ? !1 : (e.preventDefault(), v.current.attachFiles(n, { source: "paste" }), !0);
|
|
1248
|
+
let r = t?.getData("text/plain") ?? "";
|
|
1249
|
+
return !d(r) || !y.current ? !1 : u(y.current, r);
|
|
1250
|
+
}, S = A(n);
|
|
1251
|
+
S.current = n;
|
|
1252
|
+
let C = k.useCallback((e) => {
|
|
1253
|
+
try {
|
|
1254
|
+
e && !e.isDestroyed && e.view.dom.setAttribute("aria-label", S.current);
|
|
1255
|
+
} catch {}
|
|
1256
|
+
}, []);
|
|
1257
|
+
k.useEffect(() => C(y.current), [
|
|
1258
|
+
n,
|
|
1259
|
+
C,
|
|
1260
|
+
c.editor
|
|
1261
|
+
]);
|
|
1262
|
+
let w = k.useCallback((e) => {
|
|
1263
|
+
y.current = e, g(e), C(e);
|
|
1264
|
+
}, [g, C]), T = k.useCallback((e) => {
|
|
1265
|
+
v.current.annotate(e.id);
|
|
1241
1266
|
}, []);
|
|
1242
1267
|
return /* @__PURE__ */ N("div", {
|
|
1243
1268
|
"data-slot": "composer-input",
|
|
1244
1269
|
className: "order-0 min-w-0 flex-1 basis-[60%]",
|
|
1245
1270
|
children: /* @__PURE__ */ N(oe, {
|
|
1246
|
-
markdown:
|
|
1247
|
-
onChange:
|
|
1271
|
+
markdown: l,
|
|
1272
|
+
onChange: f,
|
|
1248
1273
|
toolbar: !1,
|
|
1249
|
-
slashMenu:
|
|
1250
|
-
references:
|
|
1274
|
+
slashMenu: a,
|
|
1275
|
+
references: o,
|
|
1251
1276
|
placeholder: t,
|
|
1252
|
-
autofocus:
|
|
1253
|
-
className: e("wb-composer-doc",
|
|
1254
|
-
onKeyDown:
|
|
1255
|
-
onPaste:
|
|
1256
|
-
imagePaste:
|
|
1257
|
-
attachments:
|
|
1277
|
+
autofocus: r,
|
|
1278
|
+
className: e("wb-composer-doc", p && _ === "none" && "wb-composer-doc-expanded", _ === "compact" && "wb-composer-doc-compact", s),
|
|
1279
|
+
onKeyDown: b,
|
|
1280
|
+
onPaste: x,
|
|
1281
|
+
imagePaste: i,
|
|
1282
|
+
attachments: m,
|
|
1258
1283
|
onAttachmentAdd: ({ file: e, ...t }) => {
|
|
1259
|
-
|
|
1284
|
+
h({
|
|
1260
1285
|
...t,
|
|
1261
1286
|
kind: "image",
|
|
1262
1287
|
file: e
|
|
1263
1288
|
});
|
|
1264
1289
|
},
|
|
1265
|
-
onAttachmentRemove: (e) => e.forEach((e) =>
|
|
1266
|
-
onAttachmentOpen:
|
|
1267
|
-
onEditorReady:
|
|
1268
|
-
extensions:
|
|
1290
|
+
onAttachmentRemove: (e) => e.forEach((e) => v.current.removeAttachment(e)),
|
|
1291
|
+
onAttachmentOpen: T,
|
|
1292
|
+
onEditorReady: w,
|
|
1293
|
+
extensions: tt
|
|
1269
1294
|
})
|
|
1270
1295
|
});
|
|
1271
1296
|
}
|
|
1272
|
-
var
|
|
1297
|
+
var $ = B("relative box-border flex min-w-0 flex-col text-caption text-muted-foreground", {
|
|
1273
1298
|
variants: {
|
|
1274
1299
|
side: {
|
|
1275
1300
|
top: "order-[-1]",
|
|
@@ -1405,7 +1430,7 @@ function at({ side: t = "bottom", variant: n, inset: r = 12, draggable: i = !1,
|
|
|
1405
1430
|
"data-open": i && C || void 0,
|
|
1406
1431
|
"data-dragging": F.dragging || void 0,
|
|
1407
1432
|
"data-peeking": i && P > 0 && !C || void 0,
|
|
1408
|
-
className: e(
|
|
1433
|
+
className: e($({
|
|
1409
1434
|
side: t,
|
|
1410
1435
|
variant: n
|
|
1411
1436
|
}), i && "has-[>[data-slot=composer-bump-handle]>[data-bump-grip]]:pt-3", v),
|
|
@@ -1622,12 +1647,12 @@ function ct({ src: t, onClose: n, onSave: r, canvas: o, annotator: s, origin: c
|
|
|
1622
1647
|
className: "relative outline-none",
|
|
1623
1648
|
children: /* @__PURE__ */ N(F, {
|
|
1624
1649
|
"aria-label": w ? "Preview image" : "Annotate image",
|
|
1625
|
-
...
|
|
1626
|
-
className: e(
|
|
1650
|
+
...Xe,
|
|
1651
|
+
className: e(Xe.className, "flex max-w-[90vw] flex-col gap-2.5 text-foreground outline-none"),
|
|
1627
1652
|
children: _ ? /* @__PURE__ */ N(_, { children: T }) : T(o === void 0 ? null : { canvas: o })
|
|
1628
1653
|
})
|
|
1629
1654
|
})]
|
|
1630
1655
|
});
|
|
1631
1656
|
}
|
|
1632
1657
|
//#endregion
|
|
1633
|
-
export { ct as AnnotateLightbox, he as Composer,
|
|
1658
|
+
export { ct as AnnotateLightbox, he as Composer, Ke as ComposerAdd, Me as ComposerAddon, qe as ComposerAttach, $e as ComposerAttachments, at as ComposerBump, st as ComposerBumpContent, ot as ComposerBumpHandle, Le as ComposerButton, Ae as ComposerCard, Je as ComposerExpand, Ce as ComposerFab, Ne as ComposerFooter, nt as ComposerInput, Be as ComposerMenuItem, we as ComposerOptions, Te as ComposerOptionsOutlet, W as ComposerOutlet, Re as ComposerPillLabel, Ve as ComposerSelect, Ge as ComposerSend, Pe as ComposerSeparator, X as ComposerSpacer, We as ComposerStop, Fe as ComposerText, je as composerAddonVariants, $ as composerBumpVariants, Ie as composerButtonVariants, Ee as composerCardVariants, J as composerFabVariants, ze as composerMenuItemVariants, U as useComposer, it as useComposerBump };
|