@hanzo/browser-extension 1.9.53 → 1.9.55
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/package.json +3 -2
- package/src/Chat.tsx +164 -0
- package/src/answer/AnswerEngine.tsx +140 -115
- package/src/answer/Toolbar.tsx +93 -0
- package/src/newtab.css +10 -464
- package/src/safari/SafariWebExtensionHandler.swift +153 -0
- package/src/shared/Prose.tsx +29 -0
- package/src/sidebar.css +16 -418
- package/src/sidebar.html +10 -71
- package/src/answer/Composer.tsx +0 -147
- package/src/answer/Models.tsx +0 -118
- package/src/answer/Source.tsx +0 -26
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SafariWebExtensionHandler.swift
|
|
3
|
+
// Shared (Extension)
|
|
4
|
+
//
|
|
5
|
+
// Relays the extension to zapd, which is the same fabric Chrome and Firefox
|
|
6
|
+
// join. They reach it by spawning `zapd` over stdio as a native messaging
|
|
7
|
+
// host; Safari cannot spawn a binary, so it carries the last hop itself and
|
|
8
|
+
// writes to the router's socket directly.
|
|
9
|
+
//
|
|
10
|
+
// The message is the router envelope the shared transport already sends —
|
|
11
|
+
// { t, flags, from, to, payload } with a base64 payload — so the browser side
|
|
12
|
+
// is byte-identical across all three engines and only the hop changes.
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
import SafariServices
|
|
16
|
+
import Foundation
|
|
17
|
+
import os.log
|
|
18
|
+
|
|
19
|
+
/// One connection to the router, kept open across messages.
|
|
20
|
+
///
|
|
21
|
+
/// A native port is a channel, not a request: the router pushes ROUTE commands
|
|
22
|
+
/// on it long after the extension last spoke, and a socket opened per message
|
|
23
|
+
/// would miss every one of them.
|
|
24
|
+
final class ZapSocket {
|
|
25
|
+
static let shared = ZapSocket()
|
|
26
|
+
|
|
27
|
+
private let path = NSHomeDirectory() + "/.zap/run/zapd.sock"
|
|
28
|
+
private var fd: Int32 = -1
|
|
29
|
+
private let lock = NSLock()
|
|
30
|
+
|
|
31
|
+
/// Connect if we are not already. Returns false when the router is absent —
|
|
32
|
+
/// which is a normal state (zapd not running), not an error to throw at the
|
|
33
|
+
/// browser.
|
|
34
|
+
@discardableResult
|
|
35
|
+
private func connect() -> Bool {
|
|
36
|
+
if fd >= 0 { return true }
|
|
37
|
+
let s = socket(AF_UNIX, SOCK_STREAM, 0)
|
|
38
|
+
if s < 0 { return false }
|
|
39
|
+
|
|
40
|
+
var addr = sockaddr_un()
|
|
41
|
+
addr.sun_family = sa_family_t(AF_UNIX)
|
|
42
|
+
let bytes = Array(path.utf8)
|
|
43
|
+
// sun_path is a fixed C array; a path that does not fit is not a path
|
|
44
|
+
// this socket can name, and truncating it would name a different one.
|
|
45
|
+
guard bytes.count < MemoryLayout.size(ofValue: addr.sun_path) else { close(s); return false }
|
|
46
|
+
withUnsafeMutablePointer(to: &addr.sun_path) { p in
|
|
47
|
+
p.withMemoryRebound(to: CChar.self, capacity: bytes.count + 1) { dst in
|
|
48
|
+
for (i, b) in bytes.enumerated() { dst[i] = CChar(bitPattern: b) }
|
|
49
|
+
dst[bytes.count] = 0
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
let size = socklen_t(MemoryLayout<sockaddr_un>.size)
|
|
53
|
+
let ok = withUnsafePointer(to: &addr) { p in
|
|
54
|
+
p.withMemoryRebound(to: sockaddr.self, capacity: 1) { sa in
|
|
55
|
+
Darwin.connect(s, sa, size) == 0
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if !ok { close(s); return false }
|
|
59
|
+
fd = s
|
|
60
|
+
return true
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private func drop() {
|
|
64
|
+
if fd >= 0 { close(fd) }
|
|
65
|
+
fd = -1
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// Send one envelope and read one back.
|
|
69
|
+
///
|
|
70
|
+
/// Length-prefixed both ways, matching the native messaging framing the
|
|
71
|
+
/// other two engines get from the host: u32 little-endian, then the JSON.
|
|
72
|
+
func exchange(_ message: Any) -> Any? {
|
|
73
|
+
lock.lock()
|
|
74
|
+
defer { lock.unlock() }
|
|
75
|
+
guard connect() else { return nil }
|
|
76
|
+
guard let body = try? JSONSerialization.data(withJSONObject: message) else { return nil }
|
|
77
|
+
|
|
78
|
+
var length = UInt32(body.count).littleEndian
|
|
79
|
+
var frame = Data(bytes: &length, count: 4)
|
|
80
|
+
frame.append(body)
|
|
81
|
+
|
|
82
|
+
guard write(frame) else { drop(); return nil }
|
|
83
|
+
guard let header = read(exactly: 4) else { drop(); return nil }
|
|
84
|
+
let expected = header.withUnsafeBytes { $0.load(as: UInt32.self).littleEndian }
|
|
85
|
+
// A reply that claims more than the router will ever send is a desynced
|
|
86
|
+
// stream, not a big message. Start over rather than block on it.
|
|
87
|
+
guard expected > 0, expected <= 16 * 1024 * 1024, let payload = read(exactly: Int(expected)) else {
|
|
88
|
+
drop(); return nil
|
|
89
|
+
}
|
|
90
|
+
return try? JSONSerialization.jsonObject(with: payload)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private func write(_ data: Data) -> Bool {
|
|
94
|
+
var sent = 0
|
|
95
|
+
return data.withUnsafeBytes { raw -> Bool in
|
|
96
|
+
guard let base = raw.baseAddress else { return false }
|
|
97
|
+
while sent < data.count {
|
|
98
|
+
let n = Darwin.write(fd, base.advanced(by: sent), data.count - sent)
|
|
99
|
+
if n <= 0 { return false }
|
|
100
|
+
sent += n
|
|
101
|
+
}
|
|
102
|
+
return true
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private func read(exactly count: Int) -> Data? {
|
|
107
|
+
var out = Data()
|
|
108
|
+
var buf = [UInt8](repeating: 0, count: count)
|
|
109
|
+
while out.count < count {
|
|
110
|
+
let n = buf.withUnsafeMutableBytes { p -> Int in
|
|
111
|
+
guard let base = p.baseAddress else { return -1 }
|
|
112
|
+
return Darwin.read(fd, base, count - out.count)
|
|
113
|
+
}
|
|
114
|
+
if n <= 0 { return nil }
|
|
115
|
+
out.append(contentsOf: buf[0..<n])
|
|
116
|
+
}
|
|
117
|
+
return out
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|
122
|
+
|
|
123
|
+
func beginRequest(with context: NSExtensionContext) {
|
|
124
|
+
let request = context.inputItems.first as? NSExtensionItem
|
|
125
|
+
|
|
126
|
+
let message: Any?
|
|
127
|
+
if #available(iOS 15.0, macOS 11.0, *) {
|
|
128
|
+
message = request?.userInfo?[SFExtensionMessageKey]
|
|
129
|
+
} else {
|
|
130
|
+
message = request?.userInfo?["message"]
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// iOS has no router to reach: zapd is a desktop daemon and an iOS app
|
|
134
|
+
// has no filesystem path to another process's socket. The extension
|
|
135
|
+
// treats a null reply as "not connected", which is what this is.
|
|
136
|
+
var reply: Any? = nil
|
|
137
|
+
#if os(macOS)
|
|
138
|
+
if let message { reply = ZapSocket.shared.exchange(message) }
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
if reply == nil {
|
|
142
|
+
os_log(.default, "zapd unreachable at ~/.zap/run/zapd.sock")
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let response = NSExtensionItem()
|
|
146
|
+
if #available(iOS 15.0, macOS 11.0, *) {
|
|
147
|
+
response.userInfo = [SFExtensionMessageKey: reply ?? [:]]
|
|
148
|
+
} else {
|
|
149
|
+
response.userInfo = ["message": reply ?? [:]]
|
|
150
|
+
}
|
|
151
|
+
context.completeRequest(returningItems: [response], completionHandler: nil)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { YStack } from '@hanzo/ui';
|
|
3
|
+
import { Code } from '@hanzo/ui/chat';
|
|
4
|
+
import { blocks } from './markdown.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An answer's text, as both surfaces render it: prose as HTML, fenced code as
|
|
8
|
+
* the shared `@hanzo/ui/chat` Code block — which is what carries the language
|
|
9
|
+
* label and the copy control.
|
|
10
|
+
*
|
|
11
|
+
* The `markdown` class is the prose stylesheet's hook and the only thing left
|
|
12
|
+
* here that is CSS rather than a token; the pipeline itself is `blocks()`.
|
|
13
|
+
*/
|
|
14
|
+
export function Prose({ text }: { text: string }) {
|
|
15
|
+
if (!text) return null;
|
|
16
|
+
return (
|
|
17
|
+
<YStack gap="$3" width="100%">
|
|
18
|
+
{blocks(text).map((b, i) =>
|
|
19
|
+
'code' in b ? (
|
|
20
|
+
<Code key={i} language={b.lang} value={b.code}>
|
|
21
|
+
{b.code}
|
|
22
|
+
</Code>
|
|
23
|
+
) : (
|
|
24
|
+
<div key={i} className="markdown" dangerouslySetInnerHTML={{ __html: b.html }} />
|
|
25
|
+
),
|
|
26
|
+
)}
|
|
27
|
+
</YStack>
|
|
28
|
+
);
|
|
29
|
+
}
|
package/src/sidebar.css
CHANGED
|
@@ -189,149 +189,6 @@ html {
|
|
|
189
189
|
object-fit: cover;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
/* ==================== Auth ==================== */
|
|
193
|
-
|
|
194
|
-
.auth-section {
|
|
195
|
-
flex: 1;
|
|
196
|
-
display: flex;
|
|
197
|
-
align-items: center;
|
|
198
|
-
justify-content: center;
|
|
199
|
-
padding: 32px 20px;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.auth-card {
|
|
203
|
-
text-align: center;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.auth-logo {
|
|
207
|
-
width: 56px;
|
|
208
|
-
height: 56px;
|
|
209
|
-
color: var(--text-primary);
|
|
210
|
-
margin-bottom: 20px;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.auth-card h2 {
|
|
214
|
-
font-size: 18px;
|
|
215
|
-
font-weight: 600;
|
|
216
|
-
margin-bottom: 8px;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.auth-card p {
|
|
220
|
-
color: var(--text-secondary);
|
|
221
|
-
font-size: 13px;
|
|
222
|
-
margin-bottom: 24px;
|
|
223
|
-
line-height: 1.5;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/* In-chat login prompt */
|
|
227
|
-
.chat-login-prompt {
|
|
228
|
-
display: flex;
|
|
229
|
-
align-items: center;
|
|
230
|
-
justify-content: center;
|
|
231
|
-
padding: 40px 24px;
|
|
232
|
-
flex: 1;
|
|
233
|
-
animation: fadeIn 0.4s ease;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.auth-card.compact {
|
|
237
|
-
text-align: center;
|
|
238
|
-
max-width: 280px;
|
|
239
|
-
width: 100%;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.auth-card.compact .auth-logo {
|
|
243
|
-
width: 56px;
|
|
244
|
-
height: 56px;
|
|
245
|
-
color: var(--text-primary);
|
|
246
|
-
margin: 0 auto 24px;
|
|
247
|
-
display: block;
|
|
248
|
-
filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.15));
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.auth-card.compact .auth-headline {
|
|
252
|
-
font-size: 22px;
|
|
253
|
-
font-weight: 700;
|
|
254
|
-
color: var(--text-primary);
|
|
255
|
-
margin-bottom: 10px;
|
|
256
|
-
letter-spacing: -0.02em;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.auth-card.compact .auth-sub {
|
|
260
|
-
font-size: 13px;
|
|
261
|
-
color: var(--text-secondary);
|
|
262
|
-
margin-bottom: 24px;
|
|
263
|
-
line-height: 1.5;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/* Sign-in button — matches @hanzo/gui primary button on dark (monochrome) */
|
|
267
|
-
.auth-signin-btn {
|
|
268
|
-
width: 100%;
|
|
269
|
-
padding: 10px 16px;
|
|
270
|
-
height: 40px;
|
|
271
|
-
background: var(--accent);
|
|
272
|
-
color: #0a0a0a;
|
|
273
|
-
border: none;
|
|
274
|
-
border-radius: var(--radius-md);
|
|
275
|
-
font-size: 14px;
|
|
276
|
-
font-weight: 600;
|
|
277
|
-
cursor: pointer;
|
|
278
|
-
transition: background 0.15s, box-shadow 0.15s;
|
|
279
|
-
margin-bottom: 10px;
|
|
280
|
-
letter-spacing: -0.01em;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.auth-signin-btn:hover {
|
|
284
|
-
background: var(--accent-hover);
|
|
285
|
-
box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.auth-signin-btn:active {
|
|
289
|
-
transform: scale(0.98);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.auth-signin-btn:disabled {
|
|
293
|
-
opacity: 0.5;
|
|
294
|
-
cursor: not-allowed;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/* Ghost create account button */
|
|
298
|
-
.auth-create-btn {
|
|
299
|
-
width: 100%;
|
|
300
|
-
padding: 10px 16px;
|
|
301
|
-
height: 36px;
|
|
302
|
-
background: transparent;
|
|
303
|
-
color: var(--text-secondary);
|
|
304
|
-
border: 1px solid var(--border);
|
|
305
|
-
border-radius: var(--radius-md);
|
|
306
|
-
font-size: 13px;
|
|
307
|
-
font-weight: 500;
|
|
308
|
-
cursor: pointer;
|
|
309
|
-
transition: all 0.15s;
|
|
310
|
-
margin-bottom: 16px;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.auth-create-btn:hover {
|
|
314
|
-
color: var(--text-primary);
|
|
315
|
-
background: var(--glass);
|
|
316
|
-
border-color: var(--border-strong);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.auth-card.compact .auth-note {
|
|
320
|
-
font-size: 11px;
|
|
321
|
-
color: var(--text-tertiary);
|
|
322
|
-
margin-bottom: 0;
|
|
323
|
-
line-height: 1.5;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.auth-card.compact .auth-note a {
|
|
327
|
-
color: var(--text-secondary);
|
|
328
|
-
text-decoration: underline;
|
|
329
|
-
text-underline-offset: 2px;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.auth-card.compact .auth-note a:hover {
|
|
333
|
-
color: var(--text-primary);
|
|
334
|
-
}
|
|
335
192
|
|
|
336
193
|
/* ==================== Tab Bar ==================== */
|
|
337
194
|
|
|
@@ -413,80 +270,30 @@ html {
|
|
|
413
270
|
scrollbar-color: rgba(255,255,255,0.08) transparent;
|
|
414
271
|
}
|
|
415
272
|
|
|
273
|
+
|
|
416
274
|
/* ==================== Chat ==================== */
|
|
417
275
|
|
|
418
|
-
|
|
276
|
+
/* The chat tab is one mount node; the shell fills it. */
|
|
277
|
+
#chat {
|
|
419
278
|
flex: 1;
|
|
420
279
|
min-height: 0;
|
|
421
|
-
overflow-y: auto;
|
|
422
|
-
overflow-x: hidden;
|
|
423
|
-
padding: 16px;
|
|
424
|
-
display: flex;
|
|
425
|
-
flex-direction: column;
|
|
426
|
-
gap: 12px;
|
|
427
|
-
scrollbar-width: thin;
|
|
428
|
-
scrollbar-color: rgba(255,255,255,0.08) transparent;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
.chat-welcome {
|
|
432
280
|
display: flex;
|
|
433
281
|
flex-direction: column;
|
|
434
|
-
align-items: center;
|
|
435
|
-
justify-content: center;
|
|
436
|
-
flex: 1;
|
|
437
|
-
text-align: center;
|
|
438
|
-
color: var(--text-tertiary);
|
|
439
|
-
padding: 40px 20px;
|
|
440
|
-
font-size: 12px;
|
|
441
|
-
letter-spacing: 0.01em;
|
|
442
|
-
gap: 8px;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.chat-welcome p {
|
|
446
|
-
animation: breathe 4s infinite ease-in-out;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.msg {
|
|
450
|
-
max-width: 90%;
|
|
451
|
-
padding: 10px 14px;
|
|
452
|
-
border-radius: var(--radius);
|
|
453
|
-
font-size: 13px;
|
|
454
|
-
line-height: 1.5;
|
|
455
|
-
word-wrap: break-word;
|
|
456
|
-
animation: fadeIn 0.3s ease;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
.msg-user {
|
|
460
|
-
align-self: flex-end;
|
|
461
|
-
background: var(--glass-strong);
|
|
462
|
-
backdrop-filter: blur(12px);
|
|
463
|
-
-webkit-backdrop-filter: blur(12px);
|
|
464
|
-
color: var(--text-primary);
|
|
465
|
-
border: 1px solid var(--border);
|
|
466
|
-
border-bottom-right-radius: 4px;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
.msg-assistant {
|
|
470
|
-
align-self: flex-start;
|
|
471
|
-
background: var(--bg-tertiary);
|
|
472
|
-
color: var(--text-primary);
|
|
473
|
-
border-bottom-left-radius: 4px;
|
|
474
|
-
border: 1px solid var(--border);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
.msg-assistant pre {
|
|
478
|
-
background: var(--bg-primary);
|
|
479
|
-
border: 1px solid var(--border);
|
|
480
|
-
border-radius: var(--radius-sm);
|
|
481
|
-
padding: 10px 12px;
|
|
482
|
-
margin: 8px 0;
|
|
483
|
-
overflow-x: auto;
|
|
484
|
-
font-family: 'Geist Mono', 'Monaco', 'Consolas', monospace;
|
|
485
|
-
font-size: 12px;
|
|
486
|
-
line-height: 1.4;
|
|
487
282
|
}
|
|
488
283
|
|
|
489
|
-
|
|
284
|
+
/* Prose inside an assistant turn. The shell renders the turn; markdown is the
|
|
285
|
+
surface's own pipeline, so this is its stylesheet — the same rules the new
|
|
286
|
+
tab uses, at the sidebar's size. */
|
|
287
|
+
.markdown { font-size: 13px; line-height: 1.55; color: var(--text-primary); }
|
|
288
|
+
.markdown > *:last-child { margin-bottom: 0; }
|
|
289
|
+
.markdown h2 { font-size: 15px; margin: 14px 0 6px; font-weight: 600; }
|
|
290
|
+
.markdown h3 { font-size: 14px; margin: 12px 0 6px; font-weight: 600; }
|
|
291
|
+
.markdown h4, .markdown h5 { font-size: 13px; margin: 10px 0 4px; font-weight: 600; }
|
|
292
|
+
.markdown p { margin: 0 0 8px; }
|
|
293
|
+
.markdown ul, .markdown ol { margin: 0 0 8px; padding-left: 20px; }
|
|
294
|
+
.markdown li { margin: 3px 0; }
|
|
295
|
+
.markdown a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
|
|
296
|
+
.markdown code {
|
|
490
297
|
font-family: 'Geist Mono', 'Monaco', 'Consolas', monospace;
|
|
491
298
|
font-size: 12px;
|
|
492
299
|
background: rgba(255,255,255,0.06);
|
|
@@ -494,215 +301,6 @@ html {
|
|
|
494
301
|
border-radius: 3px;
|
|
495
302
|
}
|
|
496
303
|
|
|
497
|
-
.msg-assistant pre code {
|
|
498
|
-
background: none;
|
|
499
|
-
padding: 0;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
.msg-error {
|
|
503
|
-
align-self: center;
|
|
504
|
-
background: var(--error);
|
|
505
|
-
color: white;
|
|
506
|
-
font-size: 12px;
|
|
507
|
-
padding: 6px 12px;
|
|
508
|
-
border-radius: var(--radius-sm);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
.typing-indicator {
|
|
512
|
-
align-self: flex-start;
|
|
513
|
-
color: var(--text-tertiary);
|
|
514
|
-
font-size: 12px;
|
|
515
|
-
padding: 6px 0;
|
|
516
|
-
display: flex;
|
|
517
|
-
align-items: center;
|
|
518
|
-
gap: 4px;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
.typing-indicator span {
|
|
522
|
-
display: inline-block;
|
|
523
|
-
width: 6px;
|
|
524
|
-
height: 6px;
|
|
525
|
-
background: var(--text-tertiary);
|
|
526
|
-
border-radius: 50%;
|
|
527
|
-
animation: typingBounce 1.4s infinite;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
|
|
531
|
-
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
|
|
532
|
-
|
|
533
|
-
/* ==================== Composer (Modern Chat Input) ==================== */
|
|
534
|
-
|
|
535
|
-
.composer {
|
|
536
|
-
padding: 10px;
|
|
537
|
-
flex-shrink: 0;
|
|
538
|
-
position: relative;
|
|
539
|
-
z-index: 10;
|
|
540
|
-
border-top: 1px solid rgba(255,255,255,0.10);
|
|
541
|
-
background: #0f0f0f;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
.composer-box {
|
|
545
|
-
background: #171717;
|
|
546
|
-
border: 1px solid rgba(255,255,255,0.15);
|
|
547
|
-
border-radius: 10px;
|
|
548
|
-
overflow: hidden;
|
|
549
|
-
transition: border-color 0.2s, box-shadow 0.2s;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
.composer-box:focus-within {
|
|
553
|
-
border-color: rgba(255,255,255,0.22);
|
|
554
|
-
box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
.composer-box textarea {
|
|
558
|
-
display: block;
|
|
559
|
-
width: 100%;
|
|
560
|
-
padding: 10px 12px 4px;
|
|
561
|
-
background: transparent;
|
|
562
|
-
border: none;
|
|
563
|
-
color: #fafafa;
|
|
564
|
-
font-size: 13px;
|
|
565
|
-
font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
|
|
566
|
-
line-height: 1.5;
|
|
567
|
-
resize: none;
|
|
568
|
-
outline: none;
|
|
569
|
-
min-height: 36px;
|
|
570
|
-
max-height: 120px;
|
|
571
|
-
box-sizing: border-box;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
.composer-box textarea::placeholder {
|
|
575
|
-
color: #666;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
.composer-bar {
|
|
579
|
-
display: flex;
|
|
580
|
-
align-items: center;
|
|
581
|
-
justify-content: space-between;
|
|
582
|
-
padding: 4px 8px 8px;
|
|
583
|
-
gap: 4px;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
.composer-controls {
|
|
587
|
-
display: flex;
|
|
588
|
-
align-items: center;
|
|
589
|
-
gap: 4px;
|
|
590
|
-
flex: 1;
|
|
591
|
-
min-width: 0;
|
|
592
|
-
overflow: hidden;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
.composer-model {
|
|
596
|
-
padding: 3px 18px 3px 6px;
|
|
597
|
-
background: rgba(255,255,255,0.07);
|
|
598
|
-
border: 1px solid rgba(255,255,255,0.10);
|
|
599
|
-
border-radius: 6px;
|
|
600
|
-
color: #a3a3a3;
|
|
601
|
-
font-size: 10px;
|
|
602
|
-
font-family: inherit;
|
|
603
|
-
cursor: pointer;
|
|
604
|
-
-webkit-appearance: none;
|
|
605
|
-
-moz-appearance: none;
|
|
606
|
-
appearance: none;
|
|
607
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none'%3E%3Cpath d='M2.5 4l2.5 2.5 2.5-2.5' stroke='%236B6B6B' stroke-width='1.2'/%3E%3C/svg%3E");
|
|
608
|
-
background-repeat: no-repeat;
|
|
609
|
-
background-position: right 4px center;
|
|
610
|
-
white-space: nowrap;
|
|
611
|
-
max-width: 110px;
|
|
612
|
-
text-overflow: ellipsis;
|
|
613
|
-
overflow: hidden;
|
|
614
|
-
transition: border-color 0.2s;
|
|
615
|
-
height: 22px;
|
|
616
|
-
flex-shrink: 0;
|
|
617
|
-
line-height: 16px;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
.composer-model:hover {
|
|
621
|
-
border-color: rgba(255,255,255,0.16);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
.composer-model:focus {
|
|
625
|
-
border-color: rgba(255,255,255,0.16);
|
|
626
|
-
outline: none;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
.composer-toggle {
|
|
630
|
-
display: inline-flex;
|
|
631
|
-
align-items: center;
|
|
632
|
-
gap: 2px;
|
|
633
|
-
font-size: 10px;
|
|
634
|
-
color: #666;
|
|
635
|
-
user-select: none;
|
|
636
|
-
cursor: pointer;
|
|
637
|
-
white-space: nowrap;
|
|
638
|
-
padding: 2px 4px;
|
|
639
|
-
border-radius: 4px;
|
|
640
|
-
transition: background 0.15s;
|
|
641
|
-
flex-shrink: 0;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
.composer-toggle:hover {
|
|
645
|
-
background: rgba(255,255,255,0.04);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
.composer-toggle input[type="checkbox"] {
|
|
649
|
-
width: 11px;
|
|
650
|
-
height: 11px;
|
|
651
|
-
accent-color: #fafafa;
|
|
652
|
-
cursor: pointer;
|
|
653
|
-
margin: 0;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
.composer-toggle:has(input:checked) {
|
|
657
|
-
color: #a3a3a3;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
.composer-status {
|
|
661
|
-
font-size: 9px;
|
|
662
|
-
color: var(--text-tertiary);
|
|
663
|
-
white-space: nowrap;
|
|
664
|
-
padding: 1px 5px;
|
|
665
|
-
border-radius: 3px;
|
|
666
|
-
background: var(--glass);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
.composer-send {
|
|
670
|
-
width: 30px;
|
|
671
|
-
height: 30px;
|
|
672
|
-
display: flex;
|
|
673
|
-
align-items: center;
|
|
674
|
-
justify-content: center;
|
|
675
|
-
background: var(--accent);
|
|
676
|
-
border: none;
|
|
677
|
-
border-radius: 50%;
|
|
678
|
-
color: #000;
|
|
679
|
-
cursor: pointer;
|
|
680
|
-
flex-shrink: 0;
|
|
681
|
-
transition: all 0.2s;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
.composer-send:hover {
|
|
685
|
-
background: var(--accent-hover);
|
|
686
|
-
box-shadow: 0 0 12px rgba(255,255,255,0.15);
|
|
687
|
-
transform: scale(1.05);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
.composer-send:active {
|
|
691
|
-
transform: scale(0.95);
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
.composer-send:disabled {
|
|
695
|
-
opacity: 0.15;
|
|
696
|
-
cursor: not-allowed;
|
|
697
|
-
box-shadow: none;
|
|
698
|
-
transform: none;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
.composer-send svg {
|
|
702
|
-
width: 13px;
|
|
703
|
-
height: 13px;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
304
|
/* ==================== Buttons ==================== */
|
|
707
305
|
|
|
708
306
|
.icon-btn {
|