@40rty/ams-ui 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2QRYXSCB.js → chunk-CKNELL6G.js} +582 -823
- package/dist/{chunk-JQNZ5UUK.js → chunk-I5QE47QY.js} +12 -41
- package/dist/chunk-WDL5PHO2.js +36 -0
- package/dist/chunk-WVD2Y2N2.js +318 -0
- package/dist/conversation.js +10 -7
- package/dist/css/shell/spacefront-island.css +113 -74
- package/dist/index.js +12 -12
- package/dist/island.js +80 -51
- package/dist/shell.js +19 -11
- package/dist/types/catalog-data/content.d.ts +16 -16
- package/dist/types/catalog-data/ecommerce.d.ts +88 -88
- package/dist/types/catalog-data/social.d.ts +28 -28
- package/dist/types/conversation/blocks/schemas.d.ts +72 -72
- package/dist/types/shell/SpacefrontIsland.d.ts +13 -10
- package/dist/types/shell/index.d.ts +1 -1
- package/dist/types/shell/mobile/MorphIsland.d.ts +1 -1
- package/dist/types/shell/mobile/{hero-entry-point.d.ts → entry-point.d.ts} +35 -14
- package/dist/types/shell/mobile/island-metrics.d.ts +1 -1
- package/dist/types/shell/use-scroll-edges.d.ts +15 -0
- package/package.json +2 -2
|
@@ -4,16 +4,28 @@ import {
|
|
|
4
4
|
useSideDockSpacing
|
|
5
5
|
} from "./chunk-H6MSAD5M.js";
|
|
6
6
|
import {
|
|
7
|
-
Spinner,
|
|
8
|
-
cn,
|
|
9
7
|
useMediaQuery,
|
|
10
8
|
useScrollLock
|
|
11
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-I5QE47QY.js";
|
|
12
10
|
import {
|
|
13
11
|
AgentPresenceWidget,
|
|
14
12
|
PresenceBriefRail,
|
|
15
13
|
useLabels
|
|
16
14
|
} from "./chunk-2HM6EVDV.js";
|
|
15
|
+
import {
|
|
16
|
+
submitOnEnter,
|
|
17
|
+
useScrollThreshold
|
|
18
|
+
} from "./chunk-PHXP2SKS.js";
|
|
19
|
+
import {
|
|
20
|
+
AttachButton,
|
|
21
|
+
AttachmentStrip,
|
|
22
|
+
DictationButton,
|
|
23
|
+
ListeningWaveform
|
|
24
|
+
} from "./chunk-WVD2Y2N2.js";
|
|
25
|
+
import {
|
|
26
|
+
Spinner,
|
|
27
|
+
cn
|
|
28
|
+
} from "./chunk-WDL5PHO2.js";
|
|
17
29
|
import {
|
|
18
30
|
AgentCaret,
|
|
19
31
|
AnimatePresence,
|
|
@@ -28,13 +40,9 @@ import {
|
|
|
28
40
|
useScrollDirection,
|
|
29
41
|
useTransform
|
|
30
42
|
} from "./chunk-432XYPDT.js";
|
|
31
|
-
import {
|
|
32
|
-
submitOnEnter,
|
|
33
|
-
useScrollThreshold
|
|
34
|
-
} from "./chunk-PHXP2SKS.js";
|
|
35
43
|
|
|
36
44
|
// src/shell/Composer.tsx
|
|
37
|
-
import * as
|
|
45
|
+
import * as React9 from "react";
|
|
38
46
|
import { useFourtySession as useFourtySession2, useConversationState, useComposerPlaceholder as useComposerPlaceholder2, useFormFactor as useFormFactor5 } from "@40rty/ams-sdk";
|
|
39
47
|
import { ThreadHeadroom, useHydrated, useScrollHasMoreBelow, useThreadRows, useThreadJumpMarks, useThreadLanding } from "@40rty/ams-sdk";
|
|
40
48
|
|
|
@@ -49,8 +57,37 @@ function useThreadRelandKey() {
|
|
|
49
57
|
import { ArrowUp, Square } from "lucide-react";
|
|
50
58
|
|
|
51
59
|
// src/shell/ComposerChipStrip.tsx
|
|
52
|
-
import * as
|
|
60
|
+
import * as React3 from "react";
|
|
53
61
|
import { useSuggestionsWithDefaults } from "@40rty/ams-sdk";
|
|
62
|
+
|
|
63
|
+
// src/shell/use-scroll-edges.ts
|
|
64
|
+
import * as React2 from "react";
|
|
65
|
+
function useScrollEdges() {
|
|
66
|
+
const [el, setEl] = React2.useState(null);
|
|
67
|
+
const [fade, setFade] = React2.useState("none");
|
|
68
|
+
React2.useEffect(() => {
|
|
69
|
+
if (el === null) return;
|
|
70
|
+
const update = () => {
|
|
71
|
+
const start = el.scrollLeft > 1;
|
|
72
|
+
const end = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
|
|
73
|
+
setFade(start && end ? "both" : start ? "start" : end ? "end" : "none");
|
|
74
|
+
};
|
|
75
|
+
update();
|
|
76
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
77
|
+
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
78
|
+
if (resize !== null) resize.observe(el);
|
|
79
|
+
const mutation = typeof MutationObserver === "undefined" ? null : new MutationObserver(update);
|
|
80
|
+
if (mutation !== null) mutation.observe(el, { childList: true, subtree: true });
|
|
81
|
+
return () => {
|
|
82
|
+
el.removeEventListener("scroll", update);
|
|
83
|
+
if (resize !== null) resize.disconnect();
|
|
84
|
+
if (mutation !== null) mutation.disconnect();
|
|
85
|
+
};
|
|
86
|
+
}, [el]);
|
|
87
|
+
return { ref: setEl, fade };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/shell/ComposerChipStrip.tsx
|
|
54
91
|
import { jsx } from "react/jsx-runtime";
|
|
55
92
|
var CHIP_TAP = { scale: 0.96, transition: { duration: 0.08, ease: "easeOut" } };
|
|
56
93
|
function ComposerChipStrip({
|
|
@@ -64,15 +101,16 @@ function ComposerChipStrip({
|
|
|
64
101
|
const agentChips = suggestions ? suggestions.actions.filter((a) => typeof a.label === "string" && a.label.trim().length > 0) : [];
|
|
65
102
|
const hasAgentChips = agentChips.length > 0;
|
|
66
103
|
const showStarters = !hasAgentChips && value.length === 0 && starterSuggestions !== void 0 && starterSuggestions.length > 0;
|
|
67
|
-
const [submitted, setSubmitted] =
|
|
68
|
-
const
|
|
69
|
-
|
|
104
|
+
const [submitted, setSubmitted] = React3.useState(false);
|
|
105
|
+
const edges = useScrollEdges();
|
|
106
|
+
const submittedRef = React3.useRef(false);
|
|
107
|
+
React3.useEffect(() => {
|
|
70
108
|
submittedRef.current = false;
|
|
71
109
|
setSubmitted(false);
|
|
72
110
|
}, [suggestions]);
|
|
73
111
|
const contentSig = hasAgentChips ? agentChips.map((a) => `${a.id}:${a.label}`).join("|") : (starterSuggestions === void 0 ? [] : starterSuggestions).join("|");
|
|
74
|
-
const prevSigRef =
|
|
75
|
-
const groupSeqRef =
|
|
112
|
+
const prevSigRef = React3.useRef("");
|
|
113
|
+
const groupSeqRef = React3.useRef(0);
|
|
76
114
|
if (contentSig !== prevSigRef.current) {
|
|
77
115
|
const isExtension = prevSigRef.current.length > 0 && contentSig.startsWith(prevSigRef.current);
|
|
78
116
|
if (!isExtension) groupSeqRef.current += 1;
|
|
@@ -151,8 +189,10 @@ function ComposerChipStrip({
|
|
|
151
189
|
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(
|
|
152
190
|
motion.div,
|
|
153
191
|
{
|
|
192
|
+
ref: isRow ? edges.ref : void 0,
|
|
154
193
|
className: "fourty-composer-chips",
|
|
155
194
|
"data-orientation": orientation,
|
|
195
|
+
"data-fade": isRow ? edges.fade : void 0,
|
|
156
196
|
style: containerStyle,
|
|
157
197
|
initial: { opacity: 1 },
|
|
158
198
|
animate: { opacity: 1 },
|
|
@@ -236,107 +276,8 @@ function AnimatedPlaceholder({ text }) {
|
|
|
236
276
|
) });
|
|
237
277
|
}
|
|
238
278
|
|
|
239
|
-
// src/shell/DictationButton.tsx
|
|
240
|
-
import { AudioLines } from "lucide-react";
|
|
241
|
-
|
|
242
|
-
// src/shell/ListeningWaveform.tsx
|
|
243
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
244
|
-
var LISTENING_BARS = [
|
|
245
|
-
{ id: "a", from: 0.45, to: 1, duration: 0.5, delay: 0 },
|
|
246
|
-
{ id: "b", from: 0.9, to: 0.35, duration: 0.62, delay: 0.09 },
|
|
247
|
-
{ id: "c", from: 0.55, to: 0.95, duration: 0.46, delay: 0.04 },
|
|
248
|
-
{ id: "d", from: 1, to: 0.4, duration: 0.55, delay: 0.13 }
|
|
249
|
-
];
|
|
250
|
-
function ListeningWaveform({
|
|
251
|
-
color,
|
|
252
|
-
barWidth = 2.5,
|
|
253
|
-
gap = 2.5,
|
|
254
|
-
height = 16
|
|
255
|
-
}) {
|
|
256
|
-
return /* @__PURE__ */ jsx3(
|
|
257
|
-
"span",
|
|
258
|
-
{
|
|
259
|
-
"aria-hidden": "true",
|
|
260
|
-
style: { display: "inline-flex", alignItems: "center", justifyContent: "center", gap, height },
|
|
261
|
-
children: LISTENING_BARS.map((bar) => /* @__PURE__ */ jsx3(
|
|
262
|
-
motion.span,
|
|
263
|
-
{
|
|
264
|
-
initial: { scaleY: bar.from },
|
|
265
|
-
animate: { scaleY: bar.to },
|
|
266
|
-
transition: {
|
|
267
|
-
duration: bar.duration,
|
|
268
|
-
delay: bar.delay,
|
|
269
|
-
repeat: Infinity,
|
|
270
|
-
repeatType: "mirror",
|
|
271
|
-
ease: "easeInOut"
|
|
272
|
-
},
|
|
273
|
-
style: {
|
|
274
|
-
width: barWidth,
|
|
275
|
-
height: "100%",
|
|
276
|
-
borderRadius: 1,
|
|
277
|
-
background: color,
|
|
278
|
-
transformOrigin: "center"
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
bar.id
|
|
282
|
-
))
|
|
283
|
-
}
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// src/shell/DictationButton.tsx
|
|
288
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
289
|
-
var MIC_CLASS = "fourty-composer-mic";
|
|
290
|
-
var MIC_IDLE_COLOR = "var(--fourty-mic-idle, var(--color-text-muted))";
|
|
291
|
-
var MIC_ACTIVE_COLOR = "var(--fourty-mic-active, var(--color-primary))";
|
|
292
|
-
function DictationButton({
|
|
293
|
-
listening,
|
|
294
|
-
supported,
|
|
295
|
-
onToggle,
|
|
296
|
-
className,
|
|
297
|
-
style
|
|
298
|
-
}) {
|
|
299
|
-
if (!supported) return null;
|
|
300
|
-
return /* @__PURE__ */ jsx4(
|
|
301
|
-
motion.button,
|
|
302
|
-
{
|
|
303
|
-
type: "button",
|
|
304
|
-
onClick: onToggle,
|
|
305
|
-
"aria-label": listening ? "Stop dictation" : "Dictate",
|
|
306
|
-
"aria-pressed": listening,
|
|
307
|
-
title: listening ? "Stop dictation" : "Dictate",
|
|
308
|
-
className: cn(MIC_CLASS, className),
|
|
309
|
-
whileHover: pressPresets.icon.whileHover,
|
|
310
|
-
whileTap: pressPresets.icon.whileTap,
|
|
311
|
-
animate: { color: listening ? MIC_ACTIVE_COLOR : MIC_IDLE_COLOR },
|
|
312
|
-
transition: pressPresets.icon.transition,
|
|
313
|
-
style: {
|
|
314
|
-
// Mirror the send button's footprint so the two read as a paired
|
|
315
|
-
// control set: a full-height 32px cell, transparent (vs. the send's
|
|
316
|
-
// fill) to keep the send the primary action. Sharp, no radius — fits
|
|
317
|
-
// the SM stencilled composer.
|
|
318
|
-
background: "transparent",
|
|
319
|
-
border: 0,
|
|
320
|
-
padding: 0,
|
|
321
|
-
cursor: "pointer",
|
|
322
|
-
display: "inline-flex",
|
|
323
|
-
alignItems: "center",
|
|
324
|
-
justifyContent: "center",
|
|
325
|
-
flex: "0 0 32px",
|
|
326
|
-
width: 32,
|
|
327
|
-
alignSelf: "stretch",
|
|
328
|
-
...style
|
|
329
|
-
},
|
|
330
|
-
children: listening ? (
|
|
331
|
-
// The listening waveform replaces the glyph while a session is live.
|
|
332
|
-
/* @__PURE__ */ jsx4(ListeningWaveform, { color: MIC_ACTIVE_COLOR })
|
|
333
|
-
) : /* @__PURE__ */ jsx4(AudioLines, { size: 16, strokeWidth: 1.6 })
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
279
|
// src/shell/InlineCompletion.tsx
|
|
339
|
-
import * as
|
|
280
|
+
import * as React4 from "react";
|
|
340
281
|
import { useConversationMessages, useComposerPlaceholder, useInlineCompletion } from "@40rty/ams-sdk";
|
|
341
282
|
|
|
342
283
|
// src/shell/composer/field-metrics.ts
|
|
@@ -365,7 +306,7 @@ function fieldClampsFrom(el, maxLines = COMPOSER_MAX_LINES) {
|
|
|
365
306
|
}
|
|
366
307
|
|
|
367
308
|
// src/shell/InlineCompletion.tsx
|
|
368
|
-
import { jsx as
|
|
309
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
369
310
|
function InlineCompletion({
|
|
370
311
|
textareaRef,
|
|
371
312
|
value,
|
|
@@ -375,9 +316,9 @@ function InlineCompletion({
|
|
|
375
316
|
}) {
|
|
376
317
|
const messages = useConversationMessages();
|
|
377
318
|
const agentPlaceholder = useComposerPlaceholder();
|
|
378
|
-
const [caretAtEnd, setCaretAtEnd] =
|
|
379
|
-
const [focused, setFocused] =
|
|
380
|
-
|
|
319
|
+
const [caretAtEnd, setCaretAtEnd] = React4.useState(true);
|
|
320
|
+
const [focused, setFocused] = React4.useState(false);
|
|
321
|
+
React4.useEffect(() => {
|
|
381
322
|
const ta = textareaRef.current;
|
|
382
323
|
if (ta === null) return;
|
|
383
324
|
const sync = () => {
|
|
@@ -405,7 +346,7 @@ function InlineCompletion({
|
|
|
405
346
|
ta.removeEventListener("blur", onBlur);
|
|
406
347
|
};
|
|
407
348
|
}, [textareaRef]);
|
|
408
|
-
const candidates =
|
|
349
|
+
const candidates = React4.useMemo(() => {
|
|
409
350
|
const out = [];
|
|
410
351
|
const seen = /* @__PURE__ */ new Set();
|
|
411
352
|
const push = (s) => {
|
|
@@ -429,12 +370,12 @@ function InlineCompletion({
|
|
|
429
370
|
candidates,
|
|
430
371
|
enabled: focused && caretAtEnd
|
|
431
372
|
});
|
|
432
|
-
const justAcceptedRef =
|
|
433
|
-
const accept =
|
|
373
|
+
const justAcceptedRef = React4.useRef(false);
|
|
374
|
+
const accept = React4.useCallback(() => {
|
|
434
375
|
onAccept(completion.completion);
|
|
435
376
|
justAcceptedRef.current = true;
|
|
436
377
|
}, [onAccept, completion.completion]);
|
|
437
|
-
|
|
378
|
+
React4.useEffect(() => {
|
|
438
379
|
if (!justAcceptedRef.current) return;
|
|
439
380
|
justAcceptedRef.current = false;
|
|
440
381
|
const ta = textareaRef.current;
|
|
@@ -444,11 +385,11 @@ function InlineCompletion({
|
|
|
444
385
|
ta.setSelectionRange(end, end);
|
|
445
386
|
setCaretAtEnd(true);
|
|
446
387
|
}, [value, textareaRef]);
|
|
447
|
-
const completionRef =
|
|
388
|
+
const completionRef = React4.useRef(completion);
|
|
448
389
|
completionRef.current = completion;
|
|
449
|
-
const acceptRef =
|
|
390
|
+
const acceptRef = React4.useRef(accept);
|
|
450
391
|
acceptRef.current = accept;
|
|
451
|
-
|
|
392
|
+
React4.useEffect(() => {
|
|
452
393
|
const ta = textareaRef.current;
|
|
453
394
|
if (ta === null) return;
|
|
454
395
|
const onKeyDown = (e) => {
|
|
@@ -466,9 +407,9 @@ function InlineCompletion({
|
|
|
466
407
|
ta.addEventListener("keydown", onKeyDown);
|
|
467
408
|
return () => ta.removeEventListener("keydown", onKeyDown);
|
|
468
409
|
}, [textareaRef]);
|
|
469
|
-
const overlayRef =
|
|
470
|
-
const [maxFieldPx, setMaxFieldPx] =
|
|
471
|
-
const copyMetrics =
|
|
410
|
+
const overlayRef = React4.useRef(null);
|
|
411
|
+
const [maxFieldPx, setMaxFieldPx] = React4.useState(COMPOSER_MAX_FIELD_PX);
|
|
412
|
+
const copyMetrics = React4.useCallback((node) => {
|
|
472
413
|
overlayRef.current = node;
|
|
473
414
|
if (node === null) return;
|
|
474
415
|
const ta = textareaRef.current;
|
|
@@ -483,8 +424,8 @@ function InlineCompletion({
|
|
|
483
424
|
}, [textareaRef]);
|
|
484
425
|
const active = completion.active;
|
|
485
426
|
const ghost = completion.ghost;
|
|
486
|
-
const [truncated, setTruncated] =
|
|
487
|
-
|
|
427
|
+
const [truncated, setTruncated] = React4.useState(false);
|
|
428
|
+
React4.useEffect(() => {
|
|
488
429
|
if (!active) {
|
|
489
430
|
onGhostHeight(0);
|
|
490
431
|
setTruncated(false);
|
|
@@ -497,7 +438,7 @@ function InlineCompletion({
|
|
|
497
438
|
setTruncated(contentPx > maxFieldPx);
|
|
498
439
|
return () => onGhostHeight(0);
|
|
499
440
|
}, [active, ghost, value, onGhostHeight, maxFieldPx]);
|
|
500
|
-
|
|
441
|
+
React4.useEffect(() => {
|
|
501
442
|
const ta = textareaRef.current;
|
|
502
443
|
if (ta === null) return;
|
|
503
444
|
const sync = () => {
|
|
@@ -534,8 +475,8 @@ function InlineCompletion({
|
|
|
534
475
|
boxSizing: "border-box"
|
|
535
476
|
},
|
|
536
477
|
children: [
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ jsx3("span", { style: { color: "transparent" }, children: value }),
|
|
479
|
+
/* @__PURE__ */ jsx3(
|
|
539
480
|
"span",
|
|
540
481
|
{
|
|
541
482
|
onClick: accept,
|
|
@@ -547,7 +488,7 @@ function InlineCompletion({
|
|
|
547
488
|
children: completion.ghost
|
|
548
489
|
}
|
|
549
490
|
),
|
|
550
|
-
truncated && /* @__PURE__ */
|
|
491
|
+
truncated && /* @__PURE__ */ jsx3(
|
|
551
492
|
"span",
|
|
552
493
|
{
|
|
553
494
|
style: {
|
|
@@ -569,214 +510,10 @@ function InlineCompletion({
|
|
|
569
510
|
// src/shell/Composer.tsx
|
|
570
511
|
import { usePromptComposer } from "@40rty/ams-sdk";
|
|
571
512
|
|
|
572
|
-
// src/shell/composer/AttachmentStrip.tsx
|
|
573
|
-
import * as React4 from "react";
|
|
574
|
-
import { X, FileText, AlertCircle, ImageOff } from "lucide-react";
|
|
575
|
-
import { isImageAttachment } from "@40rty/ams-sdk";
|
|
576
|
-
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
577
|
-
var STRIP_CLASS = "fourty-composer-attachments";
|
|
578
|
-
var THUMB = 52;
|
|
579
|
-
function Thumb({ a }) {
|
|
580
|
-
const [imgFailed, setImgFailed] = React4.useState(false);
|
|
581
|
-
if (a.previewUrl !== null && !imgFailed) {
|
|
582
|
-
return /* @__PURE__ */ jsx6(
|
|
583
|
-
"img",
|
|
584
|
-
{
|
|
585
|
-
src: a.previewUrl,
|
|
586
|
-
alt: a.name,
|
|
587
|
-
onError: () => setImgFailed(true),
|
|
588
|
-
style: { width: "100%", height: "100%", objectFit: "cover", display: "block" }
|
|
589
|
-
}
|
|
590
|
-
);
|
|
591
|
-
}
|
|
592
|
-
const Icon = isImageAttachment(a.mimeType) ? ImageOff : FileText;
|
|
593
|
-
return /* @__PURE__ */ jsxs2(
|
|
594
|
-
"div",
|
|
595
|
-
{
|
|
596
|
-
style: {
|
|
597
|
-
width: "100%",
|
|
598
|
-
height: "100%",
|
|
599
|
-
display: "flex",
|
|
600
|
-
flexDirection: "column",
|
|
601
|
-
alignItems: "center",
|
|
602
|
-
justifyContent: "center",
|
|
603
|
-
gap: 2,
|
|
604
|
-
padding: 4,
|
|
605
|
-
color: "var(--color-text-muted)"
|
|
606
|
-
},
|
|
607
|
-
children: [
|
|
608
|
-
/* @__PURE__ */ jsx6(Icon, { size: 18, strokeWidth: 1.5 }),
|
|
609
|
-
/* @__PURE__ */ jsx6(
|
|
610
|
-
"span",
|
|
611
|
-
{
|
|
612
|
-
style: {
|
|
613
|
-
fontSize: 8,
|
|
614
|
-
lineHeight: 1.1,
|
|
615
|
-
maxWidth: "100%",
|
|
616
|
-
overflow: "hidden",
|
|
617
|
-
textOverflow: "ellipsis",
|
|
618
|
-
whiteSpace: "nowrap"
|
|
619
|
-
},
|
|
620
|
-
children: a.name
|
|
621
|
-
}
|
|
622
|
-
)
|
|
623
|
-
]
|
|
624
|
-
}
|
|
625
|
-
);
|
|
626
|
-
}
|
|
627
|
-
function AttachmentStrip({
|
|
628
|
-
attachments,
|
|
629
|
-
onRemove
|
|
630
|
-
}) {
|
|
631
|
-
if (attachments.length === 0) return null;
|
|
632
|
-
return /* @__PURE__ */ jsx6(
|
|
633
|
-
"div",
|
|
634
|
-
{
|
|
635
|
-
className: STRIP_CLASS,
|
|
636
|
-
style: { display: "flex", flexWrap: "wrap", gap: 8 },
|
|
637
|
-
children: /* @__PURE__ */ jsx6(AnimatePresence, { initial: false, children: attachments.map((a) => /* @__PURE__ */ jsxs2(
|
|
638
|
-
motion.div,
|
|
639
|
-
{
|
|
640
|
-
layout: true,
|
|
641
|
-
initial: { opacity: 0, scale: 0.9 },
|
|
642
|
-
animate: { opacity: 1, scale: 1 },
|
|
643
|
-
exit: { opacity: 0, scale: 0.9 },
|
|
644
|
-
transition: { duration: 0.18, ease: [0.22, 1, 0.36, 1] },
|
|
645
|
-
title: a.error !== null ? a.error : a.name,
|
|
646
|
-
style: {
|
|
647
|
-
position: "relative",
|
|
648
|
-
width: THUMB,
|
|
649
|
-
height: THUMB,
|
|
650
|
-
flex: `0 0 ${THUMB}px`,
|
|
651
|
-
overflow: "hidden",
|
|
652
|
-
background: "var(--color-surface-alt)",
|
|
653
|
-
border: `1px solid ${a.status === "error" ? "var(--color-danger, #d4503e)" : "var(--color-border)"}`
|
|
654
|
-
},
|
|
655
|
-
children: [
|
|
656
|
-
/* @__PURE__ */ jsx6(Thumb, { a }),
|
|
657
|
-
a.status === "uploading" && /* @__PURE__ */ jsx6(
|
|
658
|
-
"div",
|
|
659
|
-
{
|
|
660
|
-
style: {
|
|
661
|
-
position: "absolute",
|
|
662
|
-
inset: 0,
|
|
663
|
-
display: "flex",
|
|
664
|
-
alignItems: "center",
|
|
665
|
-
justifyContent: "center",
|
|
666
|
-
background: "rgba(0,0,0,0.35)",
|
|
667
|
-
color: "#fff"
|
|
668
|
-
},
|
|
669
|
-
children: /* @__PURE__ */ jsx6(Spinner, {})
|
|
670
|
-
}
|
|
671
|
-
),
|
|
672
|
-
a.status === "error" && /* @__PURE__ */ jsx6(
|
|
673
|
-
"div",
|
|
674
|
-
{
|
|
675
|
-
style: {
|
|
676
|
-
position: "absolute",
|
|
677
|
-
inset: 0,
|
|
678
|
-
display: "flex",
|
|
679
|
-
alignItems: "center",
|
|
680
|
-
justifyContent: "center",
|
|
681
|
-
background: "color-mix(in srgb, var(--color-danger, #d4503e) 18%, transparent)",
|
|
682
|
-
color: "var(--color-danger, #d4503e)"
|
|
683
|
-
},
|
|
684
|
-
children: /* @__PURE__ */ jsx6(AlertCircle, { size: 18, strokeWidth: 1.5 })
|
|
685
|
-
}
|
|
686
|
-
),
|
|
687
|
-
/* @__PURE__ */ jsx6(
|
|
688
|
-
"button",
|
|
689
|
-
{
|
|
690
|
-
type: "button",
|
|
691
|
-
onClick: () => onRemove(a.localId),
|
|
692
|
-
"aria-label": `Remove ${a.name}`,
|
|
693
|
-
style: {
|
|
694
|
-
position: "absolute",
|
|
695
|
-
top: 2,
|
|
696
|
-
right: 2,
|
|
697
|
-
width: 16,
|
|
698
|
-
height: 16,
|
|
699
|
-
display: "inline-flex",
|
|
700
|
-
alignItems: "center",
|
|
701
|
-
justifyContent: "center",
|
|
702
|
-
background: "var(--color-text)",
|
|
703
|
-
color: "var(--color-surface)",
|
|
704
|
-
border: 0,
|
|
705
|
-
borderRadius: 8,
|
|
706
|
-
cursor: "pointer",
|
|
707
|
-
padding: 0
|
|
708
|
-
},
|
|
709
|
-
children: /* @__PURE__ */ jsx6(X, { size: 10, strokeWidth: 2 })
|
|
710
|
-
}
|
|
711
|
-
)
|
|
712
|
-
]
|
|
713
|
-
},
|
|
714
|
-
a.localId
|
|
715
|
-
)) })
|
|
716
|
-
}
|
|
717
|
-
);
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
// src/shell/composer/AttachButton.tsx
|
|
721
|
-
import * as React5 from "react";
|
|
722
|
-
import { Image as ImageIcon } from "lucide-react";
|
|
723
|
-
import { ATTACHMENT_ACCEPT } from "@40rty/ams-sdk";
|
|
724
|
-
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
725
|
-
var ATTACH_CLASS = "fourty-composer-attach";
|
|
726
|
-
var ATTACH_COLOR = "var(--fourty-attach-color, var(--color-text-muted))";
|
|
727
|
-
function AttachButton({ onFiles, className, style }) {
|
|
728
|
-
const inputRef = React5.useRef(null);
|
|
729
|
-
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
730
|
-
/* @__PURE__ */ jsx7(
|
|
731
|
-
"input",
|
|
732
|
-
{
|
|
733
|
-
ref: inputRef,
|
|
734
|
-
type: "file",
|
|
735
|
-
multiple: true,
|
|
736
|
-
accept: ATTACHMENT_ACCEPT,
|
|
737
|
-
style: { display: "none" },
|
|
738
|
-
onChange: (e) => {
|
|
739
|
-
const files = e.target.files;
|
|
740
|
-
if (files !== null && files.length > 0) onFiles(files);
|
|
741
|
-
e.target.value = "";
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
),
|
|
745
|
-
/* @__PURE__ */ jsx7(
|
|
746
|
-
motion.button,
|
|
747
|
-
{
|
|
748
|
-
type: "button",
|
|
749
|
-
onClick: () => inputRef.current?.click(),
|
|
750
|
-
"aria-label": "Attach a file",
|
|
751
|
-
title: "Attach a file",
|
|
752
|
-
className: cn(ATTACH_CLASS, className),
|
|
753
|
-
whileHover: pressPresets.icon.whileHover,
|
|
754
|
-
whileTap: pressPresets.icon.whileTap,
|
|
755
|
-
transition: pressPresets.icon.transition,
|
|
756
|
-
style: {
|
|
757
|
-
background: "transparent",
|
|
758
|
-
border: 0,
|
|
759
|
-
padding: 0,
|
|
760
|
-
cursor: "pointer",
|
|
761
|
-
display: "inline-flex",
|
|
762
|
-
alignItems: "center",
|
|
763
|
-
justifyContent: "center",
|
|
764
|
-
flex: "0 0 32px",
|
|
765
|
-
width: 32,
|
|
766
|
-
alignSelf: "stretch",
|
|
767
|
-
color: ATTACH_COLOR,
|
|
768
|
-
...style
|
|
769
|
-
},
|
|
770
|
-
children: /* @__PURE__ */ jsx7(ImageIcon, { size: 18, strokeWidth: 1.6 })
|
|
771
|
-
}
|
|
772
|
-
)
|
|
773
|
-
] });
|
|
774
|
-
}
|
|
775
|
-
|
|
776
513
|
// src/shell/composer/ClearSessionButton.tsx
|
|
777
514
|
import { SquarePen } from "lucide-react";
|
|
778
515
|
import { useFormFactor } from "@40rty/ams-sdk";
|
|
779
|
-
import { jsx as
|
|
516
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
780
517
|
var CLEAR_CLASS = "fourty-composer-clear";
|
|
781
518
|
var CLEAR_COLOR = "var(--fourty-clear-color, var(--color-text-muted))";
|
|
782
519
|
var CLEAR_BORDER = "var(--fourty-clear-border, none)";
|
|
@@ -789,7 +526,7 @@ function ClearSessionButton({
|
|
|
789
526
|
style
|
|
790
527
|
}) {
|
|
791
528
|
const { isMobile } = useFormFactor();
|
|
792
|
-
return /* @__PURE__ */
|
|
529
|
+
return /* @__PURE__ */ jsx4(
|
|
793
530
|
motion.button,
|
|
794
531
|
{
|
|
795
532
|
type: "button",
|
|
@@ -818,16 +555,16 @@ function ClearSessionButton({
|
|
|
818
555
|
color: CLEAR_COLOR,
|
|
819
556
|
...style
|
|
820
557
|
},
|
|
821
|
-
children: /* @__PURE__ */
|
|
558
|
+
children: /* @__PURE__ */ jsx4(SquarePen, { size: 15, strokeWidth: 1.5 })
|
|
822
559
|
}
|
|
823
560
|
);
|
|
824
561
|
}
|
|
825
562
|
|
|
826
563
|
// src/shell/composer/ConversationHistoryButton.tsx
|
|
827
|
-
import * as
|
|
564
|
+
import * as React5 from "react";
|
|
828
565
|
import { History, Check } from "lucide-react";
|
|
829
566
|
import { useFormFactor as useFormFactor2 } from "@40rty/ams-sdk";
|
|
830
|
-
import { jsx as
|
|
567
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
831
568
|
var ROOT_CLASS = "fourty-conversation-history";
|
|
832
569
|
var TRIGGER_COLOR = "var(--fourty-clear-color, var(--color-text-muted))";
|
|
833
570
|
var TRIGGER_BORDER = "var(--fourty-clear-border, none)";
|
|
@@ -841,10 +578,10 @@ function ConversationHistoryButton({
|
|
|
841
578
|
className,
|
|
842
579
|
style
|
|
843
580
|
}) {
|
|
844
|
-
const [open, setOpen] =
|
|
845
|
-
const rootRef =
|
|
581
|
+
const [open, setOpen] = React5.useState(false);
|
|
582
|
+
const rootRef = React5.useRef(null);
|
|
846
583
|
const { isMobile } = useFormFactor2();
|
|
847
|
-
|
|
584
|
+
React5.useEffect(() => {
|
|
848
585
|
if (!open) return;
|
|
849
586
|
const root = rootRef.current;
|
|
850
587
|
if (!root) return;
|
|
@@ -855,8 +592,8 @@ function ConversationHistoryButton({
|
|
|
855
592
|
doc.addEventListener("mousedown", onDown);
|
|
856
593
|
return () => doc.removeEventListener("mousedown", onDown);
|
|
857
594
|
}, [open]);
|
|
858
|
-
return /* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
595
|
+
return /* @__PURE__ */ jsxs2("div", { ref: rootRef, className: cn(ROOT_CLASS, className), style: { position: "relative", ...style }, children: [
|
|
596
|
+
/* @__PURE__ */ jsx5(
|
|
860
597
|
motion.button,
|
|
861
598
|
{
|
|
862
599
|
type: "button",
|
|
@@ -884,10 +621,10 @@ function ConversationHistoryButton({
|
|
|
884
621
|
height: 28,
|
|
885
622
|
color: TRIGGER_COLOR
|
|
886
623
|
},
|
|
887
|
-
children: /* @__PURE__ */
|
|
624
|
+
children: /* @__PURE__ */ jsx5(History, { size: 15, strokeWidth: 1.5 })
|
|
888
625
|
}
|
|
889
626
|
),
|
|
890
|
-
/* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ jsx5(AnimatePresence, { children: open && /* @__PURE__ */ jsx5(
|
|
891
628
|
motion.div,
|
|
892
629
|
{
|
|
893
630
|
role: "listbox",
|
|
@@ -911,7 +648,7 @@ function ConversationHistoryButton({
|
|
|
911
648
|
},
|
|
912
649
|
children: conversations.map((c) => {
|
|
913
650
|
const isCurrent = c.sessionId === currentSessionId;
|
|
914
|
-
return /* @__PURE__ */
|
|
651
|
+
return /* @__PURE__ */ jsxs2(
|
|
915
652
|
"button",
|
|
916
653
|
{
|
|
917
654
|
type: "button",
|
|
@@ -940,7 +677,7 @@ function ConversationHistoryButton({
|
|
|
940
677
|
color: isCurrent ? "var(--color-text-muted)" : "var(--color-text)"
|
|
941
678
|
},
|
|
942
679
|
children: [
|
|
943
|
-
/* @__PURE__ */
|
|
680
|
+
/* @__PURE__ */ jsx5(
|
|
944
681
|
"span",
|
|
945
682
|
{
|
|
946
683
|
style: {
|
|
@@ -953,9 +690,9 @@ function ConversationHistoryButton({
|
|
|
953
690
|
children: c.title
|
|
954
691
|
}
|
|
955
692
|
),
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
isCurrent && /* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ jsxs2("span", { style: { flex: "0 0 auto", display: "inline-flex", alignItems: "center", gap: 6 }, children: [
|
|
694
|
+
/* @__PURE__ */ jsx5("span", { style: { fontSize: 11, color: "var(--color-text-muted)", letterSpacing: 0.2 }, children: formatRelative(c.updatedAt) }),
|
|
695
|
+
isCurrent && /* @__PURE__ */ jsx5(Check, { size: 13, strokeWidth: 2, "aria-hidden": "true" })
|
|
959
696
|
] })
|
|
960
697
|
]
|
|
961
698
|
},
|
|
@@ -979,10 +716,10 @@ function formatRelative(ts) {
|
|
|
979
716
|
}
|
|
980
717
|
|
|
981
718
|
// src/shell/composer/ShareCanvasButton.tsx
|
|
982
|
-
import * as
|
|
719
|
+
import * as React6 from "react";
|
|
983
720
|
import { Check as Check2, Share2 } from "lucide-react";
|
|
984
721
|
import { useFormFactor as useFormFactor3, useFourtySession } from "@40rty/ams-sdk";
|
|
985
|
-
import { Fragment
|
|
722
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
986
723
|
var SHARE_CLASS = "fourty-composer-share";
|
|
987
724
|
var SHARE_COLOR = "var(--fourty-clear-color, var(--color-text-muted))";
|
|
988
725
|
var SHARE_BORDER = "var(--fourty-clear-border, none)";
|
|
@@ -995,13 +732,13 @@ function ShareCanvasButton() {
|
|
|
995
732
|
const { sessionId, shareCanvas } = useFourtySession();
|
|
996
733
|
const labels = useLabels();
|
|
997
734
|
const { isMobile } = useFormFactor3();
|
|
998
|
-
const [phase, setPhase] =
|
|
999
|
-
const rootRef =
|
|
1000
|
-
const ackRef =
|
|
1001
|
-
|
|
735
|
+
const [phase, setPhase] = React6.useState({ kind: "closed" });
|
|
736
|
+
const rootRef = React6.useRef(null);
|
|
737
|
+
const ackRef = React6.useRef(null);
|
|
738
|
+
React6.useEffect(() => () => {
|
|
1002
739
|
if (ackRef.current !== null) clearTimeout(ackRef.current);
|
|
1003
740
|
}, []);
|
|
1004
|
-
|
|
741
|
+
React6.useEffect(() => {
|
|
1005
742
|
if (phase.kind === "closed") return;
|
|
1006
743
|
const onDown = (e) => {
|
|
1007
744
|
const root = rootRef.current;
|
|
@@ -1059,8 +796,8 @@ function ShareCanvasButton() {
|
|
|
1059
796
|
if (sessionId === null) return null;
|
|
1060
797
|
const isOpen = phase.kind !== "closed";
|
|
1061
798
|
const canShareNatively = typeof navigator !== "undefined" && typeof navigator.share === "function";
|
|
1062
|
-
return /* @__PURE__ */
|
|
1063
|
-
/* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ jsxs3("div", { className: "fourty-composer-share-root", ref: rootRef, children: [
|
|
800
|
+
/* @__PURE__ */ jsx6(
|
|
1064
801
|
motion.button,
|
|
1065
802
|
{
|
|
1066
803
|
type: "button",
|
|
@@ -1090,17 +827,17 @@ function ShareCanvasButton() {
|
|
|
1090
827
|
height: 28,
|
|
1091
828
|
color: SHARE_COLOR
|
|
1092
829
|
},
|
|
1093
|
-
children: /* @__PURE__ */
|
|
830
|
+
children: /* @__PURE__ */ jsx6(Share2, { size: 15, strokeWidth: 1.5 })
|
|
1094
831
|
}
|
|
1095
832
|
),
|
|
1096
|
-
isOpen && /* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
phase.kind === "minting" && /* @__PURE__ */
|
|
1100
|
-
phase.kind === "failed" && /* @__PURE__ */
|
|
1101
|
-
phase.kind === "ready" && /* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
833
|
+
isOpen && /* @__PURE__ */ jsxs3("div", { className: "fourty-share-pop", role: "dialog", "aria-label": labels.canvas.shareTitle, children: [
|
|
834
|
+
/* @__PURE__ */ jsx6("div", { className: "fourty-share-pop__title", children: labels.canvas.shareTitle }),
|
|
835
|
+
/* @__PURE__ */ jsx6("p", { className: "fourty-share-pop__body", children: labels.canvas.shareExplain }),
|
|
836
|
+
phase.kind === "minting" && /* @__PURE__ */ jsx6("div", { className: "fourty-share-pop__link", "aria-busy": "true" }),
|
|
837
|
+
phase.kind === "failed" && /* @__PURE__ */ jsx6("div", { className: "fourty-share-pop__failed", children: labels.canvas.shareUnavailable }),
|
|
838
|
+
phase.kind === "ready" && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
839
|
+
/* @__PURE__ */ jsxs3("div", { className: "fourty-share-pop__field", children: [
|
|
840
|
+
/* @__PURE__ */ jsx6(
|
|
1104
841
|
"input",
|
|
1105
842
|
{
|
|
1106
843
|
className: "fourty-share-pop__link",
|
|
@@ -1109,7 +846,7 @@ function ShareCanvasButton() {
|
|
|
1109
846
|
onFocus: (e) => e.currentTarget.select()
|
|
1110
847
|
}
|
|
1111
848
|
),
|
|
1112
|
-
/* @__PURE__ */
|
|
849
|
+
/* @__PURE__ */ jsxs3(
|
|
1113
850
|
"button",
|
|
1114
851
|
{
|
|
1115
852
|
type: "button",
|
|
@@ -1119,15 +856,15 @@ function ShareCanvasButton() {
|
|
|
1119
856
|
void copy();
|
|
1120
857
|
},
|
|
1121
858
|
children: [
|
|
1122
|
-
phase.copied ? /* @__PURE__ */
|
|
859
|
+
phase.copied ? /* @__PURE__ */ jsx6(Check2, { size: 12, strokeWidth: 2.5 }) : null,
|
|
1123
860
|
phase.copied ? labels.canvas.shareCopied : labels.canvas.shareCopy
|
|
1124
861
|
]
|
|
1125
862
|
}
|
|
1126
863
|
)
|
|
1127
864
|
] }),
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1130
|
-
canShareNatively && /* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ jsxs3("div", { className: "fourty-share-pop__foot", children: [
|
|
866
|
+
/* @__PURE__ */ jsx6("span", { className: "fourty-share-pop__expiry", children: labels.canvas.shareExpiry(LINK_DAYS) }),
|
|
867
|
+
canShareNatively && /* @__PURE__ */ jsx6("button", { type: "button", className: "fourty-share-pop__native", onClick: () => {
|
|
1131
868
|
void shareNatively();
|
|
1132
869
|
}, children: labels.canvas.shareNative })
|
|
1133
870
|
] })
|
|
@@ -1137,7 +874,7 @@ function ShareCanvasButton() {
|
|
|
1137
874
|
}
|
|
1138
875
|
|
|
1139
876
|
// src/shell/composer/ThreadJumpRail.tsx
|
|
1140
|
-
import * as
|
|
877
|
+
import * as React7 from "react";
|
|
1141
878
|
import { useFormFactor as useFormFactor4 } from "@40rty/ams-sdk";
|
|
1142
879
|
|
|
1143
880
|
// src/shell/composer/composer-metrics.ts
|
|
@@ -1149,7 +886,7 @@ function chipAreaPx(isMobile) {
|
|
|
1149
886
|
var DOCK_HEADER_AREA_PX = 64;
|
|
1150
887
|
|
|
1151
888
|
// src/shell/composer/ThreadJumpRail.tsx
|
|
1152
|
-
import { jsx as
|
|
889
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1153
890
|
var MIN_JUMP_RAIL_MARKS = 3;
|
|
1154
891
|
var JUMP_RAIL_GUTTER_PX = 64;
|
|
1155
892
|
var MAX_TICKS = 7;
|
|
@@ -1166,21 +903,21 @@ var TICK_OPACITY = 0.35;
|
|
|
1166
903
|
var TICK_CURRENT_OPACITY = 0.9;
|
|
1167
904
|
function ThreadJumpRail({ marks, className }) {
|
|
1168
905
|
const { isMobile } = useFormFactor4();
|
|
1169
|
-
const [open, setOpen] =
|
|
1170
|
-
const [rowHoverKey, setRowHoverKey] =
|
|
1171
|
-
const rootRef =
|
|
1172
|
-
const panelRef =
|
|
1173
|
-
const trackRef =
|
|
1174
|
-
const openTimer =
|
|
1175
|
-
const clearOpenTimer =
|
|
906
|
+
const [open, setOpen] = React7.useState(false);
|
|
907
|
+
const [rowHoverKey, setRowHoverKey] = React7.useState(null);
|
|
908
|
+
const rootRef = React7.useRef(null);
|
|
909
|
+
const panelRef = React7.useRef(null);
|
|
910
|
+
const trackRef = React7.useRef(null);
|
|
911
|
+
const openTimer = React7.useRef(null);
|
|
912
|
+
const clearOpenTimer = React7.useCallback(() => {
|
|
1176
913
|
if (openTimer.current !== null) {
|
|
1177
914
|
clearTimeout(openTimer.current);
|
|
1178
915
|
openTimer.current = null;
|
|
1179
916
|
}
|
|
1180
917
|
}, []);
|
|
1181
|
-
|
|
1182
|
-
const [scrubbing, setScrubbing] =
|
|
1183
|
-
const scrub =
|
|
918
|
+
React7.useEffect(() => clearOpenTimer, [clearOpenTimer]);
|
|
919
|
+
const [scrubbing, setScrubbing] = React7.useState(false);
|
|
920
|
+
const scrub = React7.useRef({
|
|
1184
921
|
startX: 0,
|
|
1185
922
|
startY: 0,
|
|
1186
923
|
lastY: 0,
|
|
@@ -1188,14 +925,14 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1188
925
|
timer: null,
|
|
1189
926
|
active: false
|
|
1190
927
|
});
|
|
1191
|
-
const clearLongPressTimer =
|
|
928
|
+
const clearLongPressTimer = React7.useCallback(() => {
|
|
1192
929
|
if (scrub.current.timer !== null) {
|
|
1193
930
|
clearTimeout(scrub.current.timer);
|
|
1194
931
|
scrub.current.timer = null;
|
|
1195
932
|
}
|
|
1196
933
|
}, []);
|
|
1197
|
-
|
|
1198
|
-
const jumpToClientY =
|
|
934
|
+
React7.useEffect(() => clearLongPressTimer, [clearLongPressTimer]);
|
|
935
|
+
const jumpToClientY = React7.useCallback((clientY) => {
|
|
1199
936
|
const track = trackRef.current;
|
|
1200
937
|
if (track === null || marks.length === 0) return;
|
|
1201
938
|
const rect = track.getBoundingClientRect();
|
|
@@ -1245,7 +982,7 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1245
982
|
e.stopPropagation();
|
|
1246
983
|
}
|
|
1247
984
|
};
|
|
1248
|
-
|
|
985
|
+
React7.useEffect(() => {
|
|
1249
986
|
if (!isMobile || !open) return;
|
|
1250
987
|
const root = rootRef.current;
|
|
1251
988
|
if (root === null) return;
|
|
@@ -1259,7 +996,7 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1259
996
|
const tickCount = Math.min(marks.length, MAX_TICKS);
|
|
1260
997
|
const currentIndex = marks.findIndex((m) => m.isCurrent);
|
|
1261
998
|
const activeTick = currentIndex < 0 ? -1 : Math.floor(currentIndex / marks.length * tickCount);
|
|
1262
|
-
|
|
999
|
+
React7.useEffect(() => {
|
|
1263
1000
|
if (!open) return;
|
|
1264
1001
|
const panel = panelRef.current;
|
|
1265
1002
|
if (panel === null) return;
|
|
@@ -1272,7 +1009,7 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1272
1009
|
setOpen(false);
|
|
1273
1010
|
setRowHoverKey(null);
|
|
1274
1011
|
};
|
|
1275
|
-
return /* @__PURE__ */
|
|
1012
|
+
return /* @__PURE__ */ jsxs4(
|
|
1276
1013
|
"div",
|
|
1277
1014
|
{
|
|
1278
1015
|
ref: rootRef,
|
|
@@ -1305,7 +1042,7 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1305
1042
|
pointerEvents: open ? "auto" : "none"
|
|
1306
1043
|
},
|
|
1307
1044
|
children: [
|
|
1308
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ jsx7(
|
|
1309
1046
|
"div",
|
|
1310
1047
|
{
|
|
1311
1048
|
ref: trackRef,
|
|
@@ -1354,7 +1091,7 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1354
1091
|
transition: "opacity 120ms ease",
|
|
1355
1092
|
pointerEvents: open ? "none" : "auto"
|
|
1356
1093
|
},
|
|
1357
|
-
children: Array.from({ length: tickCount }, (_, slot) => /* @__PURE__ */
|
|
1094
|
+
children: Array.from({ length: tickCount }, (_, slot) => /* @__PURE__ */ jsx7(
|
|
1358
1095
|
"span",
|
|
1359
1096
|
{
|
|
1360
1097
|
"aria-hidden": "true",
|
|
@@ -1371,7 +1108,7 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1371
1108
|
))
|
|
1372
1109
|
}
|
|
1373
1110
|
),
|
|
1374
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ jsx7(AnimatePresence, { children: open && /* @__PURE__ */ jsx7(
|
|
1375
1112
|
motion.div,
|
|
1376
1113
|
{
|
|
1377
1114
|
role: "listbox",
|
|
@@ -1412,7 +1149,7 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1412
1149
|
},
|
|
1413
1150
|
children: marks.map((mark, i) => {
|
|
1414
1151
|
const selected = rowHoverKey === mark.key;
|
|
1415
|
-
return /* @__PURE__ */
|
|
1152
|
+
return /* @__PURE__ */ jsx7(
|
|
1416
1153
|
"button",
|
|
1417
1154
|
{
|
|
1418
1155
|
type: "button",
|
|
@@ -1462,10 +1199,10 @@ function ThreadJumpRail({ marks, className }) {
|
|
|
1462
1199
|
}
|
|
1463
1200
|
|
|
1464
1201
|
// src/shell/composer/use-field-autosize.ts
|
|
1465
|
-
import * as
|
|
1202
|
+
import * as React8 from "react";
|
|
1466
1203
|
function useFieldAutosize(taRef, value, ghostPx, maxLines) {
|
|
1467
|
-
const [fieldPx, setFieldPx] =
|
|
1468
|
-
|
|
1204
|
+
const [fieldPx, setFieldPx] = React8.useState(COMPOSER_MIN_FIELD_PX);
|
|
1205
|
+
React8.useEffect(() => {
|
|
1469
1206
|
const ta = taRef.current;
|
|
1470
1207
|
if (ta === null) return;
|
|
1471
1208
|
ta.style.height = "auto";
|
|
@@ -1479,7 +1216,7 @@ function useFieldAutosize(taRef, value, ghostPx, maxLines) {
|
|
|
1479
1216
|
}
|
|
1480
1217
|
|
|
1481
1218
|
// src/shell/Composer.tsx
|
|
1482
|
-
import { jsx as
|
|
1219
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1483
1220
|
function controlLaneStyle(expanded) {
|
|
1484
1221
|
return {
|
|
1485
1222
|
display: "flex",
|
|
@@ -1519,14 +1256,14 @@ function Composer({
|
|
|
1519
1256
|
const { isMobile } = useFormFactor5();
|
|
1520
1257
|
const chipOrientation = isMobile ? "row" : "list";
|
|
1521
1258
|
const chipArea = chipAreaPx(isMobile);
|
|
1522
|
-
const onAbort =
|
|
1259
|
+
const onAbort = React9.useCallback(() => session.abortGeneration(), [session]);
|
|
1523
1260
|
const agentPlaceholder = useComposerPlaceholder2();
|
|
1524
1261
|
const effectivePlaceholder = agentPlaceholder !== null ? agentPlaceholder : placeholder;
|
|
1525
|
-
const [focused, setFocused] =
|
|
1526
|
-
const taRef =
|
|
1527
|
-
const scrollRef =
|
|
1528
|
-
const [scrollerEl, setScrollerEl] =
|
|
1529
|
-
const attachScroller =
|
|
1262
|
+
const [focused, setFocused] = React9.useState(false);
|
|
1263
|
+
const taRef = React9.useRef(null);
|
|
1264
|
+
const scrollRef = React9.useRef(null);
|
|
1265
|
+
const [scrollerEl, setScrollerEl] = React9.useState(null);
|
|
1266
|
+
const attachScroller = React9.useCallback((el) => {
|
|
1530
1267
|
scrollRef.current = el;
|
|
1531
1268
|
setScrollerEl(el);
|
|
1532
1269
|
}, []);
|
|
@@ -1544,10 +1281,10 @@ function Composer({
|
|
|
1544
1281
|
canSend,
|
|
1545
1282
|
submit
|
|
1546
1283
|
} = usePromptComposer({ attachments: attachmentsController });
|
|
1547
|
-
const [ghostPx, setGhostPx] =
|
|
1284
|
+
const [ghostPx, setGhostPx] = React9.useState(0);
|
|
1548
1285
|
const fieldPx = useFieldAutosize(taRef, value, ghostPx);
|
|
1549
1286
|
const expanded = isFieldExpanded(fieldPx);
|
|
1550
|
-
|
|
1287
|
+
React9.useEffect(() => {
|
|
1551
1288
|
if (!typeToFocus) return;
|
|
1552
1289
|
const ta = taRef.current;
|
|
1553
1290
|
if (!ta) return;
|
|
@@ -1576,7 +1313,7 @@ function Composer({
|
|
|
1576
1313
|
}
|
|
1577
1314
|
submitOnEnter(submit)(e);
|
|
1578
1315
|
};
|
|
1579
|
-
return /* @__PURE__ */
|
|
1316
|
+
return /* @__PURE__ */ jsxs5(
|
|
1580
1317
|
"aside",
|
|
1581
1318
|
{
|
|
1582
1319
|
className: "ams-side-panel",
|
|
@@ -1597,7 +1334,7 @@ function Composer({
|
|
|
1597
1334
|
flexDirection: "column"
|
|
1598
1335
|
},
|
|
1599
1336
|
children: [
|
|
1600
|
-
/* @__PURE__ */
|
|
1337
|
+
/* @__PURE__ */ jsx8(
|
|
1601
1338
|
"div",
|
|
1602
1339
|
{
|
|
1603
1340
|
style: {
|
|
@@ -1616,8 +1353,8 @@ function Composer({
|
|
|
1616
1353
|
gap: isMobile ? 14 : 2,
|
|
1617
1354
|
pointerEvents: "auto"
|
|
1618
1355
|
},
|
|
1619
|
-
children: /* @__PURE__ */
|
|
1620
|
-
hasOtherConversations && /* @__PURE__ */
|
|
1356
|
+
children: /* @__PURE__ */ jsxs5(AnimatePresence, { initial: false, children: [
|
|
1357
|
+
hasOtherConversations && /* @__PURE__ */ jsx8(
|
|
1621
1358
|
ConversationHistoryButton,
|
|
1622
1359
|
{
|
|
1623
1360
|
conversations: session.recentConversations,
|
|
@@ -1629,18 +1366,18 @@ function Composer({
|
|
|
1629
1366
|
hasConversation && // Archives the current conversation (keeps it in history) and
|
|
1630
1367
|
// opens a fresh one — NOT a destructive wipe, so the visitor can
|
|
1631
1368
|
// switch back via the history control beside it.
|
|
1632
|
-
/* @__PURE__ */
|
|
1369
|
+
/* @__PURE__ */ jsx8(ClearSessionButton, { onClear: () => session.newConversation() }, "new"),
|
|
1633
1370
|
hasConversation && shareCanvas && // Read-only link to the canvas, on the clipboard. A session
|
|
1634
1371
|
// utility, so it sits with the other two rather than on the canvas
|
|
1635
1372
|
// — see ShareCanvasButton for why it is not `?session=`. Opt-in
|
|
1636
1373
|
// (`shareCanvas`): handing a stranger a frozen copy of this
|
|
1637
1374
|
// visitor's canvas is a space's decision, not a default.
|
|
1638
|
-
/* @__PURE__ */
|
|
1375
|
+
/* @__PURE__ */ jsx8(ShareCanvasButton, {}, "share")
|
|
1639
1376
|
] })
|
|
1640
1377
|
}
|
|
1641
1378
|
),
|
|
1642
|
-
/* @__PURE__ */
|
|
1643
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ jsxs5("div", { style: { position: "relative", flex: 1, minHeight: 0 }, children: [
|
|
1380
|
+
/* @__PURE__ */ jsxs5(
|
|
1644
1381
|
"div",
|
|
1645
1382
|
{
|
|
1646
1383
|
ref: attachScroller,
|
|
@@ -1671,12 +1408,12 @@ function Composer({
|
|
|
1671
1408
|
},
|
|
1672
1409
|
children: [
|
|
1673
1410
|
threadHistory(scrollRef),
|
|
1674
|
-
/* @__PURE__ */
|
|
1411
|
+
/* @__PURE__ */ jsx8(ThreadHeadroom, {})
|
|
1675
1412
|
]
|
|
1676
1413
|
}
|
|
1677
1414
|
),
|
|
1678
|
-
showJumpRail && /* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
1415
|
+
showJumpRail && /* @__PURE__ */ jsx8(ThreadJumpRail, { marks: jumpMarks }),
|
|
1416
|
+
/* @__PURE__ */ jsxs5(
|
|
1680
1417
|
"div",
|
|
1681
1418
|
{
|
|
1682
1419
|
style: {
|
|
@@ -1687,7 +1424,7 @@ function Composer({
|
|
|
1687
1424
|
pointerEvents: "auto"
|
|
1688
1425
|
},
|
|
1689
1426
|
children: [
|
|
1690
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ jsx8(
|
|
1691
1428
|
"div",
|
|
1692
1429
|
{
|
|
1693
1430
|
"aria-hidden": true,
|
|
@@ -1704,7 +1441,7 @@ function Composer({
|
|
|
1704
1441
|
}
|
|
1705
1442
|
}
|
|
1706
1443
|
),
|
|
1707
|
-
/* @__PURE__ */
|
|
1444
|
+
/* @__PURE__ */ jsx8("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsx8(
|
|
1708
1445
|
ComposerChipStrip,
|
|
1709
1446
|
{
|
|
1710
1447
|
value,
|
|
@@ -1718,7 +1455,7 @@ function Composer({
|
|
|
1718
1455
|
}
|
|
1719
1456
|
)
|
|
1720
1457
|
] }),
|
|
1721
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ jsx8("div", { style: { padding: "4px 16px 12px" }, children: /* @__PURE__ */ jsxs5(
|
|
1722
1459
|
motion.div,
|
|
1723
1460
|
{
|
|
1724
1461
|
className: isStreaming ? "fourty-composer-rim-pulse" : void 0,
|
|
@@ -1750,7 +1487,7 @@ function Composer({
|
|
|
1750
1487
|
borderRadius: expanded ? "var(--fourty-chat-radius-expanded, min(var(--fourty-chat-radius, 0px), 20px))" : "var(--fourty-chat-radius, 0px)"
|
|
1751
1488
|
},
|
|
1752
1489
|
children: [
|
|
1753
|
-
/* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ jsx8(
|
|
1754
1491
|
motion.span,
|
|
1755
1492
|
{
|
|
1756
1493
|
"aria-hidden": "true",
|
|
@@ -1773,11 +1510,11 @@ function Composer({
|
|
|
1773
1510
|
}
|
|
1774
1511
|
}
|
|
1775
1512
|
),
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1513
|
+
/* @__PURE__ */ jsx8(AttachmentStrip, { attachments: attach.attachments, onRemove: attach.remove }),
|
|
1514
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", alignItems: expanded ? "flex-end" : "center", gap: 8 }, children: [
|
|
1515
|
+
/* @__PURE__ */ jsx8("div", { style: controlLaneStyle(expanded), children: /* @__PURE__ */ jsx8(AttachButton, { onFiles: attach.addFiles }) }),
|
|
1516
|
+
/* @__PURE__ */ jsxs5("div", { style: { flex: 1, position: "relative", minWidth: 0 }, children: [
|
|
1517
|
+
/* @__PURE__ */ jsx8(
|
|
1781
1518
|
"textarea",
|
|
1782
1519
|
{
|
|
1783
1520
|
ref: taRef,
|
|
@@ -1825,7 +1562,7 @@ function Composer({
|
|
|
1825
1562
|
}
|
|
1826
1563
|
}
|
|
1827
1564
|
),
|
|
1828
|
-
value.length === 0 && /* @__PURE__ */
|
|
1565
|
+
value.length === 0 && /* @__PURE__ */ jsx8(
|
|
1829
1566
|
"span",
|
|
1830
1567
|
{
|
|
1831
1568
|
"aria-hidden": "true",
|
|
@@ -1845,10 +1582,10 @@ function Composer({
|
|
|
1845
1582
|
display: "inline-block",
|
|
1846
1583
|
maxWidth: "100%"
|
|
1847
1584
|
},
|
|
1848
|
-
children: /* @__PURE__ */
|
|
1585
|
+
children: /* @__PURE__ */ jsx8(AnimatedPlaceholder, { text: effectivePlaceholder })
|
|
1849
1586
|
}
|
|
1850
1587
|
),
|
|
1851
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ jsx8(
|
|
1852
1589
|
InlineCompletion,
|
|
1853
1590
|
{
|
|
1854
1591
|
textareaRef: taRef,
|
|
@@ -1859,8 +1596,8 @@ function Composer({
|
|
|
1859
1596
|
}
|
|
1860
1597
|
)
|
|
1861
1598
|
] }),
|
|
1862
|
-
/* @__PURE__ */
|
|
1863
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ jsxs5("div", { style: controlLaneStyle(expanded), children: [
|
|
1600
|
+
/* @__PURE__ */ jsx8(
|
|
1864
1601
|
DictationButton,
|
|
1865
1602
|
{
|
|
1866
1603
|
listening: dictation.listening,
|
|
@@ -1868,7 +1605,7 @@ function Composer({
|
|
|
1868
1605
|
onToggle: dictation.toggle
|
|
1869
1606
|
}
|
|
1870
1607
|
),
|
|
1871
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsx8(AnimatePresence, { initial: false, children: (canSend || isStreaming) && /* @__PURE__ */ jsx8(
|
|
1872
1609
|
motion.button,
|
|
1873
1610
|
{
|
|
1874
1611
|
type: "button",
|
|
@@ -1897,7 +1634,7 @@ function Composer({
|
|
|
1897
1634
|
flex: "0 0 32px",
|
|
1898
1635
|
alignSelf: "stretch"
|
|
1899
1636
|
},
|
|
1900
|
-
children: showStop ? /* @__PURE__ */
|
|
1637
|
+
children: showStop ? /* @__PURE__ */ jsx8(Square, { size: 11, strokeWidth: 1.5, fill: "currentColor" }) : /* @__PURE__ */ jsx8(ArrowUp, { size: 14, strokeWidth: 1.5 })
|
|
1901
1638
|
},
|
|
1902
1639
|
"send"
|
|
1903
1640
|
) })
|
|
@@ -1912,9 +1649,9 @@ function Composer({
|
|
|
1912
1649
|
}
|
|
1913
1650
|
|
|
1914
1651
|
// src/shell/ConversationTransition.tsx
|
|
1915
|
-
import * as
|
|
1652
|
+
import * as React10 from "react";
|
|
1916
1653
|
import { useFourtySession as useFourtySession3 } from "@40rty/ams-sdk";
|
|
1917
|
-
import { jsx as
|
|
1654
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1918
1655
|
function ConversationTransition({
|
|
1919
1656
|
children,
|
|
1920
1657
|
className,
|
|
@@ -1922,14 +1659,14 @@ function ConversationTransition({
|
|
|
1922
1659
|
}) {
|
|
1923
1660
|
const { sessionId } = useFourtySession3();
|
|
1924
1661
|
const reduce = useReducedMotion();
|
|
1925
|
-
const firstSessionRef =
|
|
1662
|
+
const firstSessionRef = React10.useRef(null);
|
|
1926
1663
|
if (firstSessionRef.current === null && sessionId !== null) firstSessionRef.current = sessionId;
|
|
1927
1664
|
const isFirstSession = sessionId === null || sessionId === firstSessionRef.current;
|
|
1928
1665
|
const conversationKey = isFirstSession ? "\u2205" : sessionId;
|
|
1929
1666
|
if (reduce === true) {
|
|
1930
|
-
return /* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ jsx9("div", { className, style, children });
|
|
1931
1668
|
}
|
|
1932
|
-
return /* @__PURE__ */
|
|
1669
|
+
return /* @__PURE__ */ jsx9(
|
|
1933
1670
|
motion.div,
|
|
1934
1671
|
{
|
|
1935
1672
|
initial: { opacity: 0 },
|
|
@@ -1944,9 +1681,9 @@ function ConversationTransition({
|
|
|
1944
1681
|
}
|
|
1945
1682
|
|
|
1946
1683
|
// src/shell/VoiceControl.tsx
|
|
1947
|
-
import * as
|
|
1684
|
+
import * as React11 from "react";
|
|
1948
1685
|
import { useFourtySession as useFourtySession4, useVoiceCapture } from "@40rty/ams-sdk";
|
|
1949
|
-
import { jsx as
|
|
1686
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1950
1687
|
var ROOT_CLASS3 = "fourty-voice-control";
|
|
1951
1688
|
var TRANSCRIPT_CLASS = "fourty-voice-control__transcript";
|
|
1952
1689
|
function VoiceControl({
|
|
@@ -1955,7 +1692,7 @@ function VoiceControl({
|
|
|
1955
1692
|
style
|
|
1956
1693
|
}) {
|
|
1957
1694
|
const session = useFourtySession4();
|
|
1958
|
-
const onCommit =
|
|
1695
|
+
const onCommit = React11.useCallback(
|
|
1959
1696
|
(text) => session.sendMessage(text),
|
|
1960
1697
|
[session]
|
|
1961
1698
|
);
|
|
@@ -1965,7 +1702,7 @@ function VoiceControl({
|
|
|
1965
1702
|
if (!voice.supported) return null;
|
|
1966
1703
|
const listening = voice.state === "listening";
|
|
1967
1704
|
const showCaption = listening && voice.transcript.length > 0;
|
|
1968
|
-
return /* @__PURE__ */
|
|
1705
|
+
return /* @__PURE__ */ jsxs6(
|
|
1969
1706
|
"div",
|
|
1970
1707
|
{
|
|
1971
1708
|
className: cn(ROOT_CLASS3, className),
|
|
@@ -1978,7 +1715,7 @@ function VoiceControl({
|
|
|
1978
1715
|
...style
|
|
1979
1716
|
},
|
|
1980
1717
|
children: [
|
|
1981
|
-
showCaption && /* @__PURE__ */
|
|
1718
|
+
showCaption && /* @__PURE__ */ jsx10(
|
|
1982
1719
|
"span",
|
|
1983
1720
|
{
|
|
1984
1721
|
className: TRANSCRIPT_CLASS,
|
|
@@ -1997,7 +1734,7 @@ function VoiceControl({
|
|
|
1997
1734
|
children: voice.transcript
|
|
1998
1735
|
}
|
|
1999
1736
|
),
|
|
2000
|
-
/* @__PURE__ */
|
|
1737
|
+
/* @__PURE__ */ jsx10(
|
|
2001
1738
|
DictationButton,
|
|
2002
1739
|
{
|
|
2003
1740
|
listening,
|
|
@@ -2011,9 +1748,9 @@ function VoiceControl({
|
|
|
2011
1748
|
}
|
|
2012
1749
|
|
|
2013
1750
|
// src/shell/VoiceIsland.tsx
|
|
2014
|
-
import * as
|
|
2015
|
-
import { ArrowUp as ArrowUp2, X
|
|
2016
|
-
import { jsx as
|
|
1751
|
+
import * as React12 from "react";
|
|
1752
|
+
import { ArrowUp as ArrowUp2, X } from "lucide-react";
|
|
1753
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2017
1754
|
var ROOT_CLASS4 = "fourty-voice-island";
|
|
2018
1755
|
var WAVE_CLASS = "fourty-voice-island__wave";
|
|
2019
1756
|
var TRANSCRIPT_CLASS2 = "fourty-voice-island__transcript";
|
|
@@ -2024,13 +1761,13 @@ var ISLAND_FG = "var(--fourty-voice-island-fg, var(--color-surface))";
|
|
|
2024
1761
|
var WAVE_COLOR = "var(--fourty-voice-wave, var(--fourty-voice-island-fg, var(--color-surface)))";
|
|
2025
1762
|
function VoiceIsland({ transcript, onStop, onCancel, idleHint = "Listening\u2026" }) {
|
|
2026
1763
|
const hasText = transcript.trim().length > 0;
|
|
2027
|
-
const captionRef =
|
|
2028
|
-
|
|
1764
|
+
const captionRef = React12.useRef(null);
|
|
1765
|
+
React12.useEffect(() => {
|
|
2029
1766
|
const el = captionRef.current;
|
|
2030
1767
|
if (el === null) return;
|
|
2031
1768
|
el.scrollTop = el.scrollHeight;
|
|
2032
1769
|
}, [transcript]);
|
|
2033
|
-
return /* @__PURE__ */
|
|
1770
|
+
return /* @__PURE__ */ jsxs7(
|
|
2034
1771
|
motion.div,
|
|
2035
1772
|
{
|
|
2036
1773
|
className: ROOT_CLASS4,
|
|
@@ -2063,8 +1800,8 @@ function VoiceIsland({ transcript, onStop, onCancel, idleHint = "Listening\u2026
|
|
|
2063
1800
|
boxShadow: "0 12px 34px rgba(18, 18, 18, 0.32)"
|
|
2064
1801
|
},
|
|
2065
1802
|
children: [
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
/* @__PURE__ */
|
|
1803
|
+
/* @__PURE__ */ jsx11("span", { className: WAVE_CLASS, style: { display: "inline-flex", flexShrink: 0, alignSelf: "center" }, children: /* @__PURE__ */ jsx11(ListeningWaveform, { color: WAVE_COLOR, barWidth: 3.5, gap: 3, height: 22 }) }),
|
|
1804
|
+
/* @__PURE__ */ jsx11(
|
|
2068
1805
|
"span",
|
|
2069
1806
|
{
|
|
2070
1807
|
ref: captionRef,
|
|
@@ -2090,7 +1827,7 @@ function VoiceIsland({ transcript, onStop, onCancel, idleHint = "Listening\u2026
|
|
|
2090
1827
|
children: hasText ? transcript : idleHint
|
|
2091
1828
|
}
|
|
2092
1829
|
),
|
|
2093
|
-
/* @__PURE__ */
|
|
1830
|
+
/* @__PURE__ */ jsx11(
|
|
2094
1831
|
"button",
|
|
2095
1832
|
{
|
|
2096
1833
|
type: "button",
|
|
@@ -2111,10 +1848,10 @@ function VoiceIsland({ transcript, onStop, onCancel, idleHint = "Listening\u2026
|
|
|
2111
1848
|
color: "inherit",
|
|
2112
1849
|
opacity: 0.72
|
|
2113
1850
|
},
|
|
2114
|
-
children: /* @__PURE__ */
|
|
1851
|
+
children: /* @__PURE__ */ jsx11(X, { size: 16, strokeWidth: 1.8 })
|
|
2115
1852
|
}
|
|
2116
1853
|
),
|
|
2117
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ jsx11(
|
|
2118
1855
|
"button",
|
|
2119
1856
|
{
|
|
2120
1857
|
type: "button",
|
|
@@ -2137,7 +1874,7 @@ function VoiceIsland({ transcript, onStop, onCancel, idleHint = "Listening\u2026
|
|
|
2137
1874
|
background: "var(--fourty-voice-stop-bg, var(--color-surface))",
|
|
2138
1875
|
color: "var(--fourty-voice-stop-fg, var(--color-primary))"
|
|
2139
1876
|
},
|
|
2140
|
-
children: /* @__PURE__ */
|
|
1877
|
+
children: /* @__PURE__ */ jsx11(ArrowUp2, { size: 16, strokeWidth: 2.2 })
|
|
2141
1878
|
}
|
|
2142
1879
|
)
|
|
2143
1880
|
]
|
|
@@ -2146,7 +1883,7 @@ function VoiceIsland({ transcript, onStop, onCancel, idleHint = "Listening\u2026
|
|
|
2146
1883
|
}
|
|
2147
1884
|
|
|
2148
1885
|
// src/shell/BottomSheet.tsx
|
|
2149
|
-
import * as
|
|
1886
|
+
import * as React13 from "react";
|
|
2150
1887
|
import {
|
|
2151
1888
|
motion as motion2,
|
|
2152
1889
|
animate as animate2,
|
|
@@ -2156,7 +1893,7 @@ import {
|
|
|
2156
1893
|
useReducedMotion as useReducedMotion2
|
|
2157
1894
|
} from "framer-motion";
|
|
2158
1895
|
import useMeasure from "react-use-measure";
|
|
2159
|
-
import { Fragment as
|
|
1896
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2160
1897
|
var ROOT_CLASS5 = "fourty-bottom-sheet";
|
|
2161
1898
|
var OVERLAY_CLASS = "fourty-bottom-sheet__overlay";
|
|
2162
1899
|
var CONTENT_CLASS = "fourty-bottom-sheet__content";
|
|
@@ -2181,18 +1918,18 @@ function BottomSheet({
|
|
|
2181
1918
|
const reduceMotion = useReducedMotion2() === true;
|
|
2182
1919
|
const [sheetRef, sheetBounds] = useMeasure();
|
|
2183
1920
|
const dragControls = useDragControls();
|
|
2184
|
-
const [detent, setDetent] =
|
|
2185
|
-
const [bodyMounted, setBodyMounted] =
|
|
1921
|
+
const [detent, setDetent] = React13.useState("peek");
|
|
1922
|
+
const [bodyMounted, setBodyMounted] = React13.useState(false);
|
|
2186
1923
|
const y = useMotionValue2(2e3);
|
|
2187
1924
|
const fullPx = sheetBounds.height;
|
|
2188
1925
|
const collapsedT = fullPx > 0 ? Math.max(0, fullPx - peekHeight) : 0;
|
|
2189
|
-
const targetFor =
|
|
1926
|
+
const targetFor = React13.useCallback(
|
|
2190
1927
|
(d) => d === "full" ? 0 : collapsedT,
|
|
2191
1928
|
[collapsedT]
|
|
2192
1929
|
);
|
|
2193
|
-
const didInit =
|
|
2194
|
-
const prevDetent =
|
|
2195
|
-
|
|
1930
|
+
const didInit = React13.useRef(false);
|
|
1931
|
+
const prevDetent = React13.useRef(detent);
|
|
1932
|
+
React13.useEffect(() => {
|
|
2196
1933
|
if (collapsedT === 0 && fullPx === 0) return;
|
|
2197
1934
|
const target = targetFor(detent);
|
|
2198
1935
|
const isTransition = prevDetent.current !== detent;
|
|
@@ -2204,14 +1941,14 @@ function BottomSheet({
|
|
|
2204
1941
|
y.set(target);
|
|
2205
1942
|
didInit.current = true;
|
|
2206
1943
|
}, [detent, targetFor, collapsedT, fullPx, reduceMotion, y]);
|
|
2207
|
-
|
|
1944
|
+
React13.useEffect(() => {
|
|
2208
1945
|
if (detent === "full") setBodyMounted(true);
|
|
2209
1946
|
}, [detent]);
|
|
2210
|
-
|
|
1947
|
+
React13.useEffect(() => {
|
|
2211
1948
|
if (onDetentChange !== void 0) onDetentChange(detent);
|
|
2212
1949
|
}, [detent, onDetentChange]);
|
|
2213
|
-
const collapseInit =
|
|
2214
|
-
|
|
1950
|
+
const collapseInit = React13.useRef(true);
|
|
1951
|
+
React13.useEffect(() => {
|
|
2215
1952
|
if (collapseInit.current) {
|
|
2216
1953
|
collapseInit.current = false;
|
|
2217
1954
|
return;
|
|
@@ -2232,9 +1969,9 @@ function BottomSheet({
|
|
|
2232
1969
|
}
|
|
2233
1970
|
dragControls.start(e);
|
|
2234
1971
|
};
|
|
2235
|
-
const dragConstraints =
|
|
2236
|
-
return /* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
1972
|
+
const dragConstraints = React13.useMemo(() => ({ top: 0, bottom: collapsedT }), [collapsedT]);
|
|
1973
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1974
|
+
/* @__PURE__ */ jsx12(
|
|
2238
1975
|
motion2.div,
|
|
2239
1976
|
{
|
|
2240
1977
|
"aria-hidden": "true",
|
|
@@ -2252,7 +1989,7 @@ function BottomSheet({
|
|
|
2252
1989
|
}
|
|
2253
1990
|
}
|
|
2254
1991
|
),
|
|
2255
|
-
/* @__PURE__ */
|
|
1992
|
+
/* @__PURE__ */ jsxs8(
|
|
2256
1993
|
motion2.div,
|
|
2257
1994
|
{
|
|
2258
1995
|
ref: sheetRef,
|
|
@@ -2295,7 +2032,7 @@ function BottomSheet({
|
|
|
2295
2032
|
setDetent(Math.abs(cur - 0) < Math.abs(cur - collapsedT) ? "full" : "peek");
|
|
2296
2033
|
},
|
|
2297
2034
|
children: [
|
|
2298
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsxs8(
|
|
2299
2036
|
"div",
|
|
2300
2037
|
{
|
|
2301
2038
|
style: {
|
|
@@ -2306,7 +2043,7 @@ function BottomSheet({
|
|
|
2306
2043
|
overflow: detent === "full" ? "visible" : "hidden"
|
|
2307
2044
|
},
|
|
2308
2045
|
children: [
|
|
2309
|
-
/* @__PURE__ */
|
|
2046
|
+
/* @__PURE__ */ jsx12(
|
|
2310
2047
|
"div",
|
|
2311
2048
|
{
|
|
2312
2049
|
className: HANDLE_CLASS,
|
|
@@ -2319,7 +2056,7 @@ function BottomSheet({
|
|
|
2319
2056
|
cursor: "grab",
|
|
2320
2057
|
touchAction: "none"
|
|
2321
2058
|
},
|
|
2322
|
-
children: /* @__PURE__ */
|
|
2059
|
+
children: /* @__PURE__ */ jsx12(
|
|
2323
2060
|
"div",
|
|
2324
2061
|
{
|
|
2325
2062
|
style: {
|
|
@@ -2333,7 +2070,7 @@ function BottomSheet({
|
|
|
2333
2070
|
)
|
|
2334
2071
|
}
|
|
2335
2072
|
),
|
|
2336
|
-
/* @__PURE__ */
|
|
2073
|
+
/* @__PURE__ */ jsx12(
|
|
2337
2074
|
"div",
|
|
2338
2075
|
{
|
|
2339
2076
|
className: PEEK_CLASS,
|
|
@@ -2345,7 +2082,7 @@ function BottomSheet({
|
|
|
2345
2082
|
]
|
|
2346
2083
|
}
|
|
2347
2084
|
),
|
|
2348
|
-
/* @__PURE__ */
|
|
2085
|
+
/* @__PURE__ */ jsx12("div", { className: BODY_CLASS, style: { position: "relative", flex: 1, minHeight: 0 }, children: bodyMounted && (typeof children === "function" ? children(api) : children) })
|
|
2349
2086
|
]
|
|
2350
2087
|
}
|
|
2351
2088
|
)
|
|
@@ -2353,14 +2090,14 @@ function BottomSheet({
|
|
|
2353
2090
|
}
|
|
2354
2091
|
|
|
2355
2092
|
// src/shell/TurnAsk.tsx
|
|
2356
|
-
import * as
|
|
2093
|
+
import * as React14 from "react";
|
|
2357
2094
|
import { turnAskSegments, useTurnAskReply } from "@40rty/ams-sdk";
|
|
2358
|
-
import { jsx as
|
|
2095
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2359
2096
|
function TurnAsk({ ask, answerable }) {
|
|
2360
2097
|
const reply = useTurnAskReply();
|
|
2361
|
-
return /* @__PURE__ */
|
|
2362
|
-
if (segment.kind === "text" || !answerable) return /* @__PURE__ */
|
|
2363
|
-
return /* @__PURE__ */
|
|
2098
|
+
return /* @__PURE__ */ jsx13("p", { className: "fourty-turn-ask", style: { margin: "0.75em 0 0" }, children: turnAskSegments(ask).map((segment, i) => {
|
|
2099
|
+
if (segment.kind === "text" || !answerable) return /* @__PURE__ */ jsx13(React14.Fragment, { children: segment.text }, i);
|
|
2100
|
+
return /* @__PURE__ */ jsx13(
|
|
2364
2101
|
"button",
|
|
2365
2102
|
{
|
|
2366
2103
|
type: "button",
|
|
@@ -2393,24 +2130,24 @@ var ANSWER_STYLE = {
|
|
|
2393
2130
|
};
|
|
2394
2131
|
|
|
2395
2132
|
// src/shell/TypedPlaceholder.tsx
|
|
2396
|
-
import * as
|
|
2397
|
-
import { jsx as
|
|
2133
|
+
import * as React15 from "react";
|
|
2134
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2398
2135
|
var TYPE_MS = 46;
|
|
2399
2136
|
var DELETE_MS = 22;
|
|
2400
2137
|
var HOLD_MS = 1600;
|
|
2401
2138
|
var RESTART_MS = 420;
|
|
2402
2139
|
function TypedPlaceholder({ entries, caret = true, className }) {
|
|
2403
2140
|
const key = entries.join("\0");
|
|
2404
|
-
const list =
|
|
2141
|
+
const list = React15.useMemo(
|
|
2405
2142
|
() => entries.filter((e) => e.length > 0),
|
|
2406
2143
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2407
2144
|
[key]
|
|
2408
2145
|
);
|
|
2409
2146
|
const reduced = useReducedMotion() === true;
|
|
2410
|
-
const [index, setIndex] =
|
|
2411
|
-
const [count, setCount] =
|
|
2412
|
-
const [phase, setPhase] =
|
|
2413
|
-
const [seen, setSeen] =
|
|
2147
|
+
const [index, setIndex] = React15.useState(0);
|
|
2148
|
+
const [count, setCount] = React15.useState(0);
|
|
2149
|
+
const [phase, setPhase] = React15.useState("typing");
|
|
2150
|
+
const [seen, setSeen] = React15.useState(list);
|
|
2414
2151
|
if (seen !== list) {
|
|
2415
2152
|
setSeen(list);
|
|
2416
2153
|
setIndex(0);
|
|
@@ -2418,7 +2155,7 @@ function TypedPlaceholder({ entries, caret = true, className }) {
|
|
|
2418
2155
|
setPhase("typing");
|
|
2419
2156
|
}
|
|
2420
2157
|
const current = list.length > 0 ? list[index % list.length] : void 0;
|
|
2421
|
-
|
|
2158
|
+
React15.useEffect(() => {
|
|
2422
2159
|
if (reduced || current === void 0) return;
|
|
2423
2160
|
const step = () => {
|
|
2424
2161
|
if (phase === "typing") {
|
|
@@ -2445,9 +2182,9 @@ function TypedPlaceholder({ entries, caret = true, className }) {
|
|
|
2445
2182
|
}, [phase, count, current, list.length, reduced]);
|
|
2446
2183
|
if (current === void 0) return null;
|
|
2447
2184
|
const shown = reduced ? current : current.slice(0, count);
|
|
2448
|
-
return /* @__PURE__ */
|
|
2185
|
+
return /* @__PURE__ */ jsxs9("span", { className, "aria-hidden": "true", children: [
|
|
2449
2186
|
shown,
|
|
2450
|
-
caret && !reduced && /* @__PURE__ */
|
|
2187
|
+
caret && !reduced && /* @__PURE__ */ jsx14(AgentCaret, { inline: true })
|
|
2451
2188
|
] });
|
|
2452
2189
|
}
|
|
2453
2190
|
|
|
@@ -2457,7 +2194,7 @@ import {
|
|
|
2457
2194
|
} from "@40rty/ams-sdk";
|
|
2458
2195
|
|
|
2459
2196
|
// src/shell/ShellScaffold.tsx
|
|
2460
|
-
import
|
|
2197
|
+
import React28 from "react";
|
|
2461
2198
|
import { useDockState } from "@40rty/ams-sdk";
|
|
2462
2199
|
|
|
2463
2200
|
// src/shell/slots.ts
|
|
@@ -2468,16 +2205,16 @@ function resolveShellSlot(slot, dock) {
|
|
|
2468
2205
|
}
|
|
2469
2206
|
|
|
2470
2207
|
// src/shell/mobile/DefaultMobileShell.tsx
|
|
2471
|
-
import * as
|
|
2208
|
+
import * as React26 from "react";
|
|
2472
2209
|
import { useSessionState, useFourtySession as useFourtySession7 } from "@40rty/ams-sdk";
|
|
2473
2210
|
|
|
2474
2211
|
// src/shell/mobile/MobileChrome.tsx
|
|
2475
2212
|
import { useScrollContainerRef } from "@40rty/ams-sdk";
|
|
2476
2213
|
|
|
2477
2214
|
// src/shell/ChromeSurface.tsx
|
|
2478
|
-
import { jsx as
|
|
2215
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2479
2216
|
function ChromeSurface({ visible, lifted }) {
|
|
2480
|
-
return /* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ jsx15(
|
|
2481
2218
|
"div",
|
|
2482
2219
|
{
|
|
2483
2220
|
"aria-hidden": true,
|
|
@@ -2519,10 +2256,10 @@ var ISLAND_CLEARANCE_BREATHING = 16 + 16;
|
|
|
2519
2256
|
var MOBILE_CANVAS_BOTTOM_CLEARANCE = VOICE_ISLAND_HEIGHT + ISLAND_CLEARANCE_BREATHING;
|
|
2520
2257
|
|
|
2521
2258
|
// src/shell/mobile/MobileChrome.tsx
|
|
2522
|
-
import { jsx as
|
|
2259
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2523
2260
|
function MobileChrome({ logo, launchers }) {
|
|
2524
2261
|
const scrolled = useScrollThreshold(useScrollContainerRef(), 0);
|
|
2525
|
-
return /* @__PURE__ */
|
|
2262
|
+
return /* @__PURE__ */ jsxs10(
|
|
2526
2263
|
"div",
|
|
2527
2264
|
{
|
|
2528
2265
|
"data-fourty-shell-part": "topbar",
|
|
@@ -2536,8 +2273,8 @@ function MobileChrome({ logo, launchers }) {
|
|
|
2536
2273
|
zIndex: 50
|
|
2537
2274
|
},
|
|
2538
2275
|
children: [
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2276
|
+
/* @__PURE__ */ jsx16(ChromeSurface, { visible: true, lifted: scrolled }),
|
|
2277
|
+
/* @__PURE__ */ jsxs10(
|
|
2541
2278
|
"div",
|
|
2542
2279
|
{
|
|
2543
2280
|
style: {
|
|
@@ -2552,8 +2289,8 @@ function MobileChrome({ logo, launchers }) {
|
|
|
2552
2289
|
pointerEvents: "none"
|
|
2553
2290
|
},
|
|
2554
2291
|
children: [
|
|
2555
|
-
/* @__PURE__ */
|
|
2556
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx16("div", { style: { pointerEvents: "auto", minWidth: 0, display: "inline-flex", alignItems: "center", overflow: "hidden" }, children: logo }),
|
|
2293
|
+
/* @__PURE__ */ jsx16("div", { style: { pointerEvents: "auto", flexShrink: 0, display: "inline-flex", alignItems: "center", gap: 2 }, children: launchers })
|
|
2557
2294
|
]
|
|
2558
2295
|
}
|
|
2559
2296
|
)
|
|
@@ -2563,7 +2300,7 @@ function MobileChrome({ logo, launchers }) {
|
|
|
2563
2300
|
}
|
|
2564
2301
|
|
|
2565
2302
|
// src/shell/mobile/MobileVoiceConsole.tsx
|
|
2566
|
-
import * as
|
|
2303
|
+
import * as React24 from "react";
|
|
2567
2304
|
import { useCurrentMessageIndex, useDisplayedLayout, useExclusiveOverlay, useFourtySession as useFourtySession6, useVoiceCapture as useVoiceCapture2, useScrollContainerRef as useScrollContainerRef2, useWakeLock } from "@40rty/ams-sdk";
|
|
2568
2305
|
|
|
2569
2306
|
// src/shell/mobile/turn-end-action.ts
|
|
@@ -2581,19 +2318,19 @@ function turnEndAction(inputs) {
|
|
|
2581
2318
|
import { useComposerAttachments } from "@40rty/ams-sdk";
|
|
2582
2319
|
|
|
2583
2320
|
// src/shell/mobile/MorphIsland.tsx
|
|
2584
|
-
import * as
|
|
2321
|
+
import * as React20 from "react";
|
|
2585
2322
|
import { useComposerChipSelect } from "@40rty/ams-sdk";
|
|
2586
2323
|
|
|
2587
2324
|
// src/shell/mobile/RestIsland.tsx
|
|
2588
|
-
import * as
|
|
2325
|
+
import * as React18 from "react";
|
|
2589
2326
|
import { useComposerPlaceholder as useComposerPlaceholder3, useFourtySession as useFourtySession5 } from "@40rty/ams-sdk";
|
|
2590
2327
|
|
|
2591
2328
|
// src/shell/mobile/IslandInputBar.tsx
|
|
2592
|
-
import * as
|
|
2329
|
+
import * as React17 from "react";
|
|
2593
2330
|
import { usePromptComposer as usePromptComposer2 } from "@40rty/ams-sdk";
|
|
2594
2331
|
|
|
2595
2332
|
// src/shell/mobile/IslandComposeGroup.tsx
|
|
2596
|
-
import { Fragment as
|
|
2333
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2597
2334
|
function IslandComposeGroup({
|
|
2598
2335
|
value,
|
|
2599
2336
|
onValueChange,
|
|
@@ -2606,8 +2343,8 @@ function IslandComposeGroup({
|
|
|
2606
2343
|
attachments,
|
|
2607
2344
|
taRef
|
|
2608
2345
|
}) {
|
|
2609
|
-
return /* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
2347
|
+
/* @__PURE__ */ jsx17(
|
|
2611
2348
|
AttachButton,
|
|
2612
2349
|
{
|
|
2613
2350
|
onFiles: attachments.addFiles,
|
|
@@ -2615,8 +2352,8 @@ function IslandComposeGroup({
|
|
|
2615
2352
|
style: { color: "inherit", flex: "0 0 34px", width: 34, height: 34, alignSelf: "auto" }
|
|
2616
2353
|
}
|
|
2617
2354
|
),
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2355
|
+
/* @__PURE__ */ jsxs11("div", { style: { position: "relative", flex: 1, minWidth: 0 }, children: [
|
|
2356
|
+
/* @__PURE__ */ jsx17(
|
|
2620
2357
|
"textarea",
|
|
2621
2358
|
{
|
|
2622
2359
|
ref: taRef,
|
|
@@ -2665,7 +2402,7 @@ function IslandComposeGroup({
|
|
|
2665
2402
|
}
|
|
2666
2403
|
}
|
|
2667
2404
|
),
|
|
2668
|
-
placeholderAnimated === true && value.length === 0 && /* @__PURE__ */
|
|
2405
|
+
placeholderAnimated === true && value.length === 0 && /* @__PURE__ */ jsx17(
|
|
2669
2406
|
"span",
|
|
2670
2407
|
{
|
|
2671
2408
|
"aria-hidden": "true",
|
|
@@ -2681,7 +2418,7 @@ function IslandComposeGroup({
|
|
|
2681
2418
|
pointerEvents: "none",
|
|
2682
2419
|
overflow: "hidden"
|
|
2683
2420
|
},
|
|
2684
|
-
children: /* @__PURE__ */
|
|
2421
|
+
children: /* @__PURE__ */ jsx17(AnimatedPlaceholder, { text: placeholder })
|
|
2685
2422
|
}
|
|
2686
2423
|
)
|
|
2687
2424
|
] })
|
|
@@ -2689,10 +2426,10 @@ function IslandComposeGroup({
|
|
|
2689
2426
|
}
|
|
2690
2427
|
|
|
2691
2428
|
// src/shell/mobile/use-blur-on-canvas-gesture.ts
|
|
2692
|
-
import * as
|
|
2429
|
+
import * as React16 from "react";
|
|
2693
2430
|
var SURFACE = ".fourty-morph-surface";
|
|
2694
2431
|
function useBlurOnCanvasGesture(taRef) {
|
|
2695
|
-
|
|
2432
|
+
React16.useEffect(() => {
|
|
2696
2433
|
const doc = document;
|
|
2697
2434
|
const onGesture = (e) => {
|
|
2698
2435
|
const field = taRef.current;
|
|
@@ -2716,7 +2453,7 @@ function useBlurOnCanvasGesture(taRef) {
|
|
|
2716
2453
|
// src/shell/mobile/IslandNavButtons.tsx
|
|
2717
2454
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
2718
2455
|
import { useCanvasBack, useCanvasForward } from "@40rty/ams-sdk";
|
|
2719
|
-
import { Fragment as
|
|
2456
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2720
2457
|
var STEP_BUTTON_STYLE = {
|
|
2721
2458
|
flexShrink: 0,
|
|
2722
2459
|
height: 40,
|
|
@@ -2733,8 +2470,8 @@ function IslandNavButtons() {
|
|
|
2733
2470
|
const { canGoBack, goBack } = useCanvasBack();
|
|
2734
2471
|
const { canGoForward, goForward } = useCanvasForward();
|
|
2735
2472
|
if (!canGoBack && !canGoForward) return null;
|
|
2736
|
-
return /* @__PURE__ */
|
|
2737
|
-
canGoBack && /* @__PURE__ */
|
|
2473
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2474
|
+
canGoBack && /* @__PURE__ */ jsx18(
|
|
2738
2475
|
"button",
|
|
2739
2476
|
{
|
|
2740
2477
|
type: "button",
|
|
@@ -2742,10 +2479,10 @@ function IslandNavButtons() {
|
|
|
2742
2479
|
onClick: goBack,
|
|
2743
2480
|
"aria-label": "Back",
|
|
2744
2481
|
style: STEP_BUTTON_STYLE,
|
|
2745
|
-
children: /* @__PURE__ */
|
|
2482
|
+
children: /* @__PURE__ */ jsx18(ChevronLeft, { size: 19, strokeWidth: 1.8 })
|
|
2746
2483
|
}
|
|
2747
2484
|
),
|
|
2748
|
-
canGoForward && /* @__PURE__ */
|
|
2485
|
+
canGoForward && /* @__PURE__ */ jsx18(
|
|
2749
2486
|
"button",
|
|
2750
2487
|
{
|
|
2751
2488
|
type: "button",
|
|
@@ -2753,15 +2490,15 @@ function IslandNavButtons() {
|
|
|
2753
2490
|
onClick: goForward,
|
|
2754
2491
|
"aria-label": "Forward",
|
|
2755
2492
|
style: STEP_BUTTON_STYLE,
|
|
2756
|
-
children: /* @__PURE__ */
|
|
2493
|
+
children: /* @__PURE__ */ jsx18(ChevronRight, { size: 19, strokeWidth: 1.8 })
|
|
2757
2494
|
}
|
|
2758
2495
|
)
|
|
2759
2496
|
] });
|
|
2760
2497
|
}
|
|
2761
2498
|
|
|
2762
2499
|
// src/shell/mobile/IslandTrailingAction.tsx
|
|
2763
|
-
import { AudioLines
|
|
2764
|
-
import { jsx as
|
|
2500
|
+
import { AudioLines, ArrowUp as ArrowUp3, Square as Square2 } from "lucide-react";
|
|
2501
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2765
2502
|
var STAMP_BUTTON_STYLE = {
|
|
2766
2503
|
flexShrink: 0,
|
|
2767
2504
|
marginLeft: 2,
|
|
@@ -2777,12 +2514,12 @@ var STAMP_BUTTON_STYLE = {
|
|
|
2777
2514
|
};
|
|
2778
2515
|
function IslandTrailingAction({ state }) {
|
|
2779
2516
|
if (state.kind === "send") {
|
|
2780
|
-
return /* @__PURE__ */
|
|
2517
|
+
return /* @__PURE__ */ jsx19("button", { type: "button", className: "fourty-island-send", onClick: state.onSend, "aria-label": "Send", style: STAMP_BUTTON_STYLE, children: /* @__PURE__ */ jsx19(ArrowUp3, { size: 18, strokeWidth: 2.2 }) });
|
|
2781
2518
|
}
|
|
2782
2519
|
if (state.kind === "stop") {
|
|
2783
|
-
return /* @__PURE__ */
|
|
2520
|
+
return /* @__PURE__ */ jsx19("button", { type: "button", className: "fourty-island-stop", onClick: state.onStop, "aria-label": "Stop", style: STAMP_BUTTON_STYLE, children: /* @__PURE__ */ jsx19(Square2, { size: 13, strokeWidth: 1.5, fill: "currentColor" }) });
|
|
2784
2521
|
}
|
|
2785
|
-
return /* @__PURE__ */
|
|
2522
|
+
return /* @__PURE__ */ jsx19(
|
|
2786
2523
|
"button",
|
|
2787
2524
|
{
|
|
2788
2525
|
type: "button",
|
|
@@ -2801,13 +2538,13 @@ function IslandTrailingAction({ state }) {
|
|
|
2801
2538
|
alignItems: "center",
|
|
2802
2539
|
justifyContent: "center"
|
|
2803
2540
|
},
|
|
2804
|
-
children: /* @__PURE__ */
|
|
2541
|
+
children: /* @__PURE__ */ jsx19(AudioLines, { size: 18, strokeWidth: 1.7 })
|
|
2805
2542
|
}
|
|
2806
2543
|
);
|
|
2807
2544
|
}
|
|
2808
2545
|
|
|
2809
2546
|
// src/shell/mobile/IslandInputBar.tsx
|
|
2810
|
-
import { jsx as
|
|
2547
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2811
2548
|
var NOTCH_PAD_LEFT = 8;
|
|
2812
2549
|
function IslandInputBar({
|
|
2813
2550
|
onSpeak,
|
|
@@ -2826,8 +2563,8 @@ function IslandInputBar({
|
|
|
2826
2563
|
const labels = useLabels();
|
|
2827
2564
|
const { value, setValue, canSend, submit, onPaste } = usePromptComposer2({ attachments });
|
|
2828
2565
|
const showStop = isStreaming && !canSend;
|
|
2829
|
-
const taRef =
|
|
2830
|
-
const send =
|
|
2566
|
+
const taRef = React17.useRef(null);
|
|
2567
|
+
const send = React17.useCallback(() => {
|
|
2831
2568
|
submit();
|
|
2832
2569
|
taRef.current?.blur();
|
|
2833
2570
|
}, [submit]);
|
|
@@ -2841,18 +2578,18 @@ function IslandInputBar({
|
|
|
2841
2578
|
const fieldPx = useFieldAutosize(taRef, value, 0, ISLAND_FIELD_MAX_LINES);
|
|
2842
2579
|
useBlurOnCanvasGesture(taRef);
|
|
2843
2580
|
const expanded = value.length > 0 && fieldPx > ISLAND_FIELD_LINE_PX * 1.5;
|
|
2844
|
-
return /* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ jsxs13(
|
|
2845
2582
|
"div",
|
|
2846
2583
|
{
|
|
2847
2584
|
className: "fourty-island-bar",
|
|
2848
2585
|
style: { display: "flex", alignItems: expanded ? "flex-end" : "center", gap: 2, minHeight: height, padding: "4px 6px" },
|
|
2849
2586
|
children: [
|
|
2850
|
-
!showStop && /* @__PURE__ */
|
|
2587
|
+
!showStop && /* @__PURE__ */ jsx20(IslandNavButtons, {}),
|
|
2851
2588
|
showStop ? (
|
|
2852
2589
|
// Non-scrolling shell: owns the tap; when expanded it carries the
|
|
2853
2590
|
// bottom scroll-fade so that stays put while the read region below
|
|
2854
2591
|
// it scrolls.
|
|
2855
|
-
/* @__PURE__ */
|
|
2592
|
+
/* @__PURE__ */ jsx20(
|
|
2856
2593
|
"div",
|
|
2857
2594
|
{
|
|
2858
2595
|
role: "button",
|
|
@@ -2869,7 +2606,7 @@ function IslandInputBar({
|
|
|
2869
2606
|
className: "fourty-island-notch",
|
|
2870
2607
|
"data-expanded": notchExpanded ? "true" : "false",
|
|
2871
2608
|
style: { flex: 1, minWidth: 0, cursor: "pointer" },
|
|
2872
|
-
children: /* @__PURE__ */
|
|
2609
|
+
children: /* @__PURE__ */ jsx20(
|
|
2873
2610
|
"div",
|
|
2874
2611
|
{
|
|
2875
2612
|
className: "fourty-island-notch__read",
|
|
@@ -2879,7 +2616,7 @@ function IslandInputBar({
|
|
|
2879
2616
|
)
|
|
2880
2617
|
}
|
|
2881
2618
|
)
|
|
2882
|
-
) : /* @__PURE__ */
|
|
2619
|
+
) : /* @__PURE__ */ jsx20(
|
|
2883
2620
|
IslandComposeGroup,
|
|
2884
2621
|
{
|
|
2885
2622
|
value,
|
|
@@ -2894,14 +2631,14 @@ function IslandInputBar({
|
|
|
2894
2631
|
taRef
|
|
2895
2632
|
}
|
|
2896
2633
|
),
|
|
2897
|
-
/* @__PURE__ */
|
|
2634
|
+
/* @__PURE__ */ jsx20(IslandTrailingAction, { state: trailingState })
|
|
2898
2635
|
]
|
|
2899
2636
|
}
|
|
2900
2637
|
);
|
|
2901
2638
|
}
|
|
2902
2639
|
|
|
2903
2640
|
// src/shell/mobile/RestIsland.tsx
|
|
2904
|
-
import { jsx as
|
|
2641
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2905
2642
|
var SETTLE_EASE = [0.22, 1, 0.36, 1];
|
|
2906
2643
|
var READ_FADE = { duration: 0.24, ease: SETTLE_EASE };
|
|
2907
2644
|
function RestIsland({
|
|
@@ -2916,35 +2653,35 @@ function RestIsland({
|
|
|
2916
2653
|
const hasHint = typeof agentHint === "string" && agentHint.trim().length > 0;
|
|
2917
2654
|
const session = useFourtySession5();
|
|
2918
2655
|
const isStreaming = session.isSubmitting || session.isRunning;
|
|
2919
|
-
const onStop =
|
|
2920
|
-
const [notchExpanded, setNotchExpanded] =
|
|
2921
|
-
|
|
2656
|
+
const onStop = React18.useCallback(() => session.abortGeneration(), [session]);
|
|
2657
|
+
const [notchExpanded, setNotchExpanded] = React18.useState(false);
|
|
2658
|
+
React18.useEffect(() => {
|
|
2922
2659
|
if (!isStreaming) setNotchExpanded(false);
|
|
2923
2660
|
}, [isStreaming]);
|
|
2924
|
-
const onNotchClick =
|
|
2925
|
-
const notch = /* @__PURE__ */
|
|
2926
|
-
const [focused, setFocused] =
|
|
2927
|
-
const blurTimer =
|
|
2661
|
+
const onNotchClick = React18.useCallback(() => setNotchExpanded((v) => !v), []);
|
|
2662
|
+
const notch = /* @__PURE__ */ jsx21(AgentPresenceWidget, { expanded: notchExpanded, suppressIdleFallback: true, staticBand: true });
|
|
2663
|
+
const [focused, setFocused] = React18.useState(false);
|
|
2664
|
+
const blurTimer = React18.useRef(null);
|
|
2928
2665
|
const clearBlurTimer = () => {
|
|
2929
2666
|
if (blurTimer.current !== null) {
|
|
2930
2667
|
clearTimeout(blurTimer.current);
|
|
2931
2668
|
blurTimer.current = null;
|
|
2932
2669
|
}
|
|
2933
2670
|
};
|
|
2934
|
-
const onInputFocus =
|
|
2671
|
+
const onInputFocus = React18.useCallback(() => {
|
|
2935
2672
|
clearBlurTimer();
|
|
2936
2673
|
setFocused(true);
|
|
2937
2674
|
}, []);
|
|
2938
|
-
const onInputBlur =
|
|
2675
|
+
const onInputBlur = React18.useCallback(() => {
|
|
2939
2676
|
clearBlurTimer();
|
|
2940
2677
|
blurTimer.current = setTimeout(() => setFocused(false), 150);
|
|
2941
2678
|
}, []);
|
|
2942
|
-
|
|
2943
|
-
|
|
2679
|
+
React18.useEffect(() => clearBlurTimer, []);
|
|
2680
|
+
React18.useEffect(() => {
|
|
2944
2681
|
if (onComposeFocusChange === void 0) return;
|
|
2945
2682
|
onComposeFocusChange(focused);
|
|
2946
2683
|
}, [focused, onComposeFocusChange]);
|
|
2947
|
-
|
|
2684
|
+
React18.useEffect(() => {
|
|
2948
2685
|
if (!isStreaming) return;
|
|
2949
2686
|
if (blurTimer.current !== null) {
|
|
2950
2687
|
clearTimeout(blurTimer.current);
|
|
@@ -2953,7 +2690,7 @@ function RestIsland({
|
|
|
2953
2690
|
setFocused(false);
|
|
2954
2691
|
}, [isStreaming]);
|
|
2955
2692
|
const showBrief = !isStreaming && !focused;
|
|
2956
|
-
return /* @__PURE__ */
|
|
2693
|
+
return /* @__PURE__ */ jsxs14(
|
|
2957
2694
|
"div",
|
|
2958
2695
|
{
|
|
2959
2696
|
className: "fourty-island-rest",
|
|
@@ -2965,7 +2702,7 @@ function RestIsland({
|
|
|
2965
2702
|
color: "var(--fourty-island-fg, var(--color-on-dark, #FFFFFF))"
|
|
2966
2703
|
},
|
|
2967
2704
|
children: [
|
|
2968
|
-
/* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ jsx21(AnimatePresence, { initial: false, children: showBrief && /* @__PURE__ */ jsx21(
|
|
2969
2706
|
motion.div,
|
|
2970
2707
|
{
|
|
2971
2708
|
className: "fourty-island-dossier",
|
|
@@ -2973,11 +2710,11 @@ function RestIsland({
|
|
|
2973
2710
|
animate: { opacity: 1 },
|
|
2974
2711
|
exit: { opacity: 0 },
|
|
2975
2712
|
transition: READ_FADE,
|
|
2976
|
-
children: /* @__PURE__ */
|
|
2713
|
+
children: /* @__PURE__ */ jsx21(PresenceBriefRail, {})
|
|
2977
2714
|
},
|
|
2978
2715
|
"presence-brief"
|
|
2979
2716
|
) }),
|
|
2980
|
-
/* @__PURE__ */
|
|
2717
|
+
/* @__PURE__ */ jsx21(AnimatePresence, { initial: false, children: focused && /* @__PURE__ */ jsx21(
|
|
2981
2718
|
motion.div,
|
|
2982
2719
|
{
|
|
2983
2720
|
className: "fourty-island-chips",
|
|
@@ -2985,7 +2722,7 @@ function RestIsland({
|
|
|
2985
2722
|
animate: { opacity: 1 },
|
|
2986
2723
|
exit: { opacity: 0 },
|
|
2987
2724
|
transition: READ_FADE,
|
|
2988
|
-
children: /* @__PURE__ */
|
|
2725
|
+
children: /* @__PURE__ */ jsx21(
|
|
2989
2726
|
ComposerChipStrip,
|
|
2990
2727
|
{
|
|
2991
2728
|
orientation: "row",
|
|
@@ -2998,8 +2735,8 @@ function RestIsland({
|
|
|
2998
2735
|
},
|
|
2999
2736
|
"chips"
|
|
3000
2737
|
) }),
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
2738
|
+
/* @__PURE__ */ jsx21(AttachmentStrip, { attachments: attachments.attachments, onRemove: attachments.remove }),
|
|
2739
|
+
/* @__PURE__ */ jsx21(
|
|
3003
2740
|
IslandInputBar,
|
|
3004
2741
|
{
|
|
3005
2742
|
onSpeak,
|
|
@@ -3049,7 +2786,7 @@ function nearestDetent(current, velocityY, travelPx, ladder) {
|
|
|
3049
2786
|
}
|
|
3050
2787
|
|
|
3051
2788
|
// src/shell/mobile/use-sheet-fold-gesture.ts
|
|
3052
|
-
import * as
|
|
2789
|
+
import * as React19 from "react";
|
|
3053
2790
|
function findVerticalScrollerAtTouch(target) {
|
|
3054
2791
|
let el = target instanceof HTMLElement ? target : null;
|
|
3055
2792
|
while (el !== null && !el.classList.contains("fourty-morph-surface")) {
|
|
@@ -3068,13 +2805,13 @@ function isScrollerAtTop(scroller) {
|
|
|
3068
2805
|
return scroller.scrollTop <= 0;
|
|
3069
2806
|
}
|
|
3070
2807
|
function useSheetFoldGesture({ sheetFaceRef, atSheet, travel, progress, settle }) {
|
|
3071
|
-
const atSheetRef =
|
|
2808
|
+
const atSheetRef = React19.useRef(atSheet);
|
|
3072
2809
|
atSheetRef.current = atSheet;
|
|
3073
|
-
const travelRef =
|
|
2810
|
+
const travelRef = React19.useRef(travel);
|
|
3074
2811
|
travelRef.current = travel;
|
|
3075
|
-
const settleRef =
|
|
2812
|
+
const settleRef = React19.useRef(settle);
|
|
3076
2813
|
settleRef.current = settle;
|
|
3077
|
-
|
|
2814
|
+
React19.useEffect(() => {
|
|
3078
2815
|
const el = sheetFaceRef.current;
|
|
3079
2816
|
if (el === null) return;
|
|
3080
2817
|
let tracking = false;
|
|
@@ -3163,7 +2900,7 @@ function useSheetFoldGesture({ sheetFaceRef, atSheet, travel, progress, settle }
|
|
|
3163
2900
|
}
|
|
3164
2901
|
|
|
3165
2902
|
// src/shell/mobile/MorphIsland.tsx
|
|
3166
|
-
import { jsx as
|
|
2903
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3167
2904
|
var SNAP_SPRING = { type: "spring", stiffness: 380, damping: 40, mass: 0.9 };
|
|
3168
2905
|
var FLUSH_EASE = [0.22, 1, 0.36, 1];
|
|
3169
2906
|
var FLUSH_SETTLE = { duration: 0.24, ease: FLUSH_EASE };
|
|
@@ -3171,7 +2908,7 @@ var FOLD_SETTLE = { duration: 0.25, ease: FLUSH_EASE };
|
|
|
3171
2908
|
var FOLD_CONTENT_OUT = 0.3;
|
|
3172
2909
|
var FOLD_GLYPH_IN = 0.34;
|
|
3173
2910
|
var ISLAND_EDGE_LAYER = "var(--fourty-island-edge, 0 0 0 0 transparent)";
|
|
3174
|
-
var DEFAULT_COLLAPSED_MARK = /* @__PURE__ */
|
|
2911
|
+
var DEFAULT_COLLAPSED_MARK = /* @__PURE__ */ jsx22("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.75, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx22("rect", { x: "2", y: "9", width: "20", height: "6", rx: "3" }) });
|
|
3175
2912
|
var NACRE_PAINT_ID = "fourty-island-nacre";
|
|
3176
2913
|
var RING_GAP = 2;
|
|
3177
2914
|
var NACRE_PERIOD_S = 10;
|
|
@@ -3189,7 +2926,7 @@ function NacreDefs({ animate: animated }) {
|
|
|
3189
2926
|
treat as having no timeline to run, and this surface's primary target is
|
|
3190
2927
|
iOS Safari — the one engine with a history of doing so. The element costs
|
|
3191
2928
|
a pixel nobody will ever see. */
|
|
3192
|
-
/* @__PURE__ */
|
|
2929
|
+
/* @__PURE__ */ jsx22(
|
|
3193
2930
|
"svg",
|
|
3194
2931
|
{
|
|
3195
2932
|
width: "1",
|
|
@@ -3197,7 +2934,7 @@ function NacreDefs({ animate: animated }) {
|
|
|
3197
2934
|
"aria-hidden": true,
|
|
3198
2935
|
focusable: "false",
|
|
3199
2936
|
style: { position: "absolute", width: 1, height: 1, overflow: "hidden", pointerEvents: "none" },
|
|
3200
|
-
children: /* @__PURE__ */
|
|
2937
|
+
children: /* @__PURE__ */ jsx22("defs", { children: /* @__PURE__ */ jsxs15(
|
|
3201
2938
|
"linearGradient",
|
|
3202
2939
|
{
|
|
3203
2940
|
id: NACRE_PAINT_ID,
|
|
@@ -3209,21 +2946,21 @@ function NacreDefs({ animate: animated }) {
|
|
|
3209
2946
|
spreadMethod: "pad",
|
|
3210
2947
|
gradientTransform: "translate(-44 0)",
|
|
3211
2948
|
children: [
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
3214
|
-
/* @__PURE__ */
|
|
3215
|
-
/* @__PURE__ */
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
/* @__PURE__ */
|
|
3219
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsx22("stop", { offset: "0%", stopColor: "#FFFFFF" }),
|
|
2950
|
+
/* @__PURE__ */ jsx22("stop", { offset: "18%", stopColor: "#FFFFFF" }),
|
|
2951
|
+
/* @__PURE__ */ jsx22("stop", { offset: "32%", stopColor: "#FFC2E2" }),
|
|
2952
|
+
/* @__PURE__ */ jsx22("stop", { offset: "44%", stopColor: "#FFE3AE" }),
|
|
2953
|
+
/* @__PURE__ */ jsx22("stop", { offset: "56%", stopColor: "#6FE9D2" }),
|
|
2954
|
+
/* @__PURE__ */ jsx22("stop", { offset: "68%", stopColor: "#9FB4FF" }),
|
|
2955
|
+
/* @__PURE__ */ jsx22("stop", { offset: "82%", stopColor: "#FFFFFF" }),
|
|
2956
|
+
/* @__PURE__ */ jsx22("stop", { offset: "100%", stopColor: "#FFFFFF" }),
|
|
3220
2957
|
animated && /* Off one edge to off the other in the first fifth of the cycle,
|
|
3221
2958
|
then parked for the remaining eight seconds — the same proportion
|
|
3222
2959
|
the old border sheen settled on, for the same reason: a light
|
|
3223
2960
|
that is always moving is one nobody notices. The end positions
|
|
3224
2961
|
put the coloured span clear of the 0-24 box, so the eight quiet
|
|
3225
2962
|
seconds are a mark that is exactly plain white. */
|
|
3226
|
-
/* @__PURE__ */
|
|
2963
|
+
/* @__PURE__ */ jsx22(
|
|
3227
2964
|
"animateTransform",
|
|
3228
2965
|
{
|
|
3229
2966
|
attributeName: "gradientTransform",
|
|
@@ -3242,8 +2979,8 @@ function NacreDefs({ animate: animated }) {
|
|
|
3242
2979
|
);
|
|
3243
2980
|
}
|
|
3244
2981
|
function usePrefersReducedMotion() {
|
|
3245
|
-
const [reduced, setReduced] =
|
|
3246
|
-
|
|
2982
|
+
const [reduced, setReduced] = React20.useState(false);
|
|
2983
|
+
React20.useEffect(() => {
|
|
3247
2984
|
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
3248
2985
|
setReduced(mq.matches);
|
|
3249
2986
|
const onChange = (e) => setReduced(e.matches);
|
|
@@ -3256,20 +2993,20 @@ var SHEET_TOP_INSET = MOBILE_TOPBAR_HEIGHT;
|
|
|
3256
2993
|
var SHEET_SIDE_INSET = 8;
|
|
3257
2994
|
var ISLAND_FALLBACK_H = VOICE_ISLAND_HEIGHT + 20;
|
|
3258
2995
|
var GRIP_H = ISLAND_GRIP_H;
|
|
3259
|
-
var MorphIsland =
|
|
2996
|
+
var MorphIsland = React20.forwardRef(
|
|
3260
2997
|
function MorphIsland2({ placeholder, placeholderExamples, attachments, onSpeak, folded, restGapPx, onSummon, historySheet, bottomOffset, enterFromFloor = false, sheetFlush, onOpenChange, onIslandHeightChange, onComposeFocusChange, collapsedMark }, ref) {
|
|
3261
2998
|
const onChipSelect = useComposerChipSelect();
|
|
3262
2999
|
const reducedMotion = usePrefersReducedMotion();
|
|
3263
3000
|
const progress = useMotionValue(0);
|
|
3264
|
-
const dockRef =
|
|
3265
|
-
const islandFaceRef =
|
|
3266
|
-
const gripRef =
|
|
3267
|
-
const sheetFaceRef =
|
|
3268
|
-
const [vw, setVw] =
|
|
3269
|
-
const [vh, setVh] =
|
|
3270
|
-
const [islandH, setIslandH] =
|
|
3271
|
-
const [gripH, setGripH] =
|
|
3272
|
-
|
|
3001
|
+
const dockRef = React20.useRef(null);
|
|
3002
|
+
const islandFaceRef = React20.useRef(null);
|
|
3003
|
+
const gripRef = React20.useRef(null);
|
|
3004
|
+
const sheetFaceRef = React20.useRef(null);
|
|
3005
|
+
const [vw, setVw] = React20.useState(0);
|
|
3006
|
+
const [vh, setVh] = React20.useState(0);
|
|
3007
|
+
const [islandH, setIslandH] = React20.useState(ISLAND_FALLBACK_H);
|
|
3008
|
+
const [gripH, setGripH] = React20.useState(GRIP_H);
|
|
3009
|
+
React20.useEffect(() => {
|
|
3273
3010
|
const el = dockRef.current;
|
|
3274
3011
|
if (el === null) return;
|
|
3275
3012
|
const view = el.ownerDocument.defaultView;
|
|
@@ -3281,7 +3018,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3281
3018
|
ro.observe(el);
|
|
3282
3019
|
return () => ro.disconnect();
|
|
3283
3020
|
}, []);
|
|
3284
|
-
|
|
3021
|
+
React20.useEffect(() => {
|
|
3285
3022
|
const el = islandFaceRef.current;
|
|
3286
3023
|
if (el === null) return;
|
|
3287
3024
|
const view = el.ownerDocument.defaultView;
|
|
@@ -3296,7 +3033,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3296
3033
|
ro.observe(el);
|
|
3297
3034
|
return () => ro.disconnect();
|
|
3298
3035
|
}, [onIslandHeightChange]);
|
|
3299
|
-
|
|
3036
|
+
React20.useEffect(() => {
|
|
3300
3037
|
const el = gripRef.current;
|
|
3301
3038
|
if (el === null) return;
|
|
3302
3039
|
const view = el.ownerDocument.defaultView;
|
|
@@ -3308,9 +3045,9 @@ var MorphIsland = React21.forwardRef(
|
|
|
3308
3045
|
ro.observe(el);
|
|
3309
3046
|
return () => ro.disconnect();
|
|
3310
3047
|
}, []);
|
|
3311
|
-
const floorProbeRef =
|
|
3312
|
-
const [floorGapPx, setFloorGapPx] =
|
|
3313
|
-
|
|
3048
|
+
const floorProbeRef = React20.useRef(null);
|
|
3049
|
+
const [floorGapPx, setFloorGapPx] = React20.useState(0);
|
|
3050
|
+
React20.useEffect(() => {
|
|
3314
3051
|
const el = floorProbeRef.current;
|
|
3315
3052
|
if (el === null) return;
|
|
3316
3053
|
const view = el.ownerDocument.defaultView;
|
|
@@ -3319,8 +3056,8 @@ var MorphIsland = React21.forwardRef(
|
|
|
3319
3056
|
ro.observe(el);
|
|
3320
3057
|
return () => ro.disconnect();
|
|
3321
3058
|
}, []);
|
|
3322
|
-
const [slabRadius, setSlabRadius] =
|
|
3323
|
-
|
|
3059
|
+
const [slabRadius, setSlabRadius] = React20.useState(0);
|
|
3060
|
+
React20.useLayoutEffect(() => {
|
|
3324
3061
|
const el = floorProbeRef.current;
|
|
3325
3062
|
if (el === null) return;
|
|
3326
3063
|
const view = el.ownerDocument.defaultView;
|
|
@@ -3328,8 +3065,8 @@ var MorphIsland = React21.forwardRef(
|
|
|
3328
3065
|
const r = Number.parseFloat(view.getComputedStyle(el).borderTopLeftRadius);
|
|
3329
3066
|
if (Number.isFinite(r) && r !== slabRadius) setSlabRadius(r);
|
|
3330
3067
|
}, [slabRadius, vw]);
|
|
3331
|
-
const [collapsedRadius, setCollapsedRadius] =
|
|
3332
|
-
|
|
3068
|
+
const [collapsedRadius, setCollapsedRadius] = React20.useState(ISLAND_COLLAPSED_H / 2);
|
|
3069
|
+
React20.useLayoutEffect(() => {
|
|
3333
3070
|
const el = floorProbeRef.current;
|
|
3334
3071
|
if (el === null) return;
|
|
3335
3072
|
const view = el.ownerDocument.defaultView;
|
|
@@ -3343,23 +3080,23 @@ var MorphIsland = React21.forwardRef(
|
|
|
3343
3080
|
const collapsedInset = vw > 0 ? Math.max(0, (vw - ISLAND_COLLAPSED_W) / 2) : sideInset;
|
|
3344
3081
|
const sheetH = vh > 0 ? Math.max(islandH, vh - SHEET_TOP_INSET) : islandH;
|
|
3345
3082
|
const collapsedH = islandH + gripH;
|
|
3346
|
-
const ladder =
|
|
3083
|
+
const ladder = React20.useMemo(
|
|
3347
3084
|
() => detentLadder(collapsedH, sheetH),
|
|
3348
3085
|
[collapsedH, sheetH]
|
|
3349
3086
|
);
|
|
3350
3087
|
const firstOpen = ladder.length > 1 ? ladder[1] : 1;
|
|
3351
|
-
const dim2 =
|
|
3088
|
+
const dim2 = React20.useMemo(() => dimSpan(ladder), [ladder]);
|
|
3352
3089
|
const height = useTransform(progress, [0, 1], [collapsedH, sheetH]);
|
|
3353
3090
|
const foldT = useMotionValue(folded ? 1 : 0);
|
|
3354
|
-
|
|
3091
|
+
React20.useEffect(() => {
|
|
3355
3092
|
const controls = animate(foldT, folded ? 1 : 0, FOLD_SETTLE);
|
|
3356
3093
|
return () => controls.stop();
|
|
3357
3094
|
}, [foldT, folded]);
|
|
3358
|
-
const [folding, setFolding] =
|
|
3095
|
+
const [folding, setFolding] = React20.useState(folded);
|
|
3359
3096
|
useMotionValueEvent(foldT, "change", (v) => setFolding(v > 0));
|
|
3360
3097
|
const entryTravel = collapsedH + restGapPx;
|
|
3361
3098
|
const entryT = useMotionValue(enterFromFloor ? 1 : 0);
|
|
3362
|
-
|
|
3099
|
+
React20.useEffect(() => {
|
|
3363
3100
|
if (!enterFromFloor) return;
|
|
3364
3101
|
const controls = animate(entryT, 0, ISLAND_ENTER_SPRING);
|
|
3365
3102
|
return () => controls.stop();
|
|
@@ -3380,7 +3117,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3380
3117
|
});
|
|
3381
3118
|
const foldContentOut = useTransform(foldT, (f) => 1 - clamp01(f / FOLD_CONTENT_OUT));
|
|
3382
3119
|
const flushMax = useMotionValue(sheetFlush ? floorGapPx : 0);
|
|
3383
|
-
|
|
3120
|
+
React20.useEffect(() => {
|
|
3384
3121
|
const controls = animate(flushMax, sheetFlush ? floorGapPx : 0, FLUSH_SETTLE);
|
|
3385
3122
|
return () => controls.stop();
|
|
3386
3123
|
}, [flushMax, sheetFlush, floorGapPx]);
|
|
@@ -3414,9 +3151,9 @@ var MorphIsland = React21.forwardRef(
|
|
|
3414
3151
|
([o, f]) => (1 - clamp01(o / 0.34)) * clamp01((clamp01(f) - FOLD_GLYPH_IN) / (1 - FOLD_GLYPH_IN))
|
|
3415
3152
|
);
|
|
3416
3153
|
const scrimOpacity = useTransform(progress, [dim2.from, dim2.to], [0, 0.42], { clamp: true });
|
|
3417
|
-
const [atSheet, setAtSheet] =
|
|
3418
|
-
const [modal, setModal] =
|
|
3419
|
-
const [active, setActive] =
|
|
3154
|
+
const [atSheet, setAtSheet] = React20.useState(false);
|
|
3155
|
+
const [modal, setModal] = React20.useState(false);
|
|
3156
|
+
const [active, setActive] = React20.useState(false);
|
|
3420
3157
|
useMotionValueEvent(progress, "change", (v) => {
|
|
3421
3158
|
setAtSheet((prev) => {
|
|
3422
3159
|
const n = v > firstOpen * 0.5;
|
|
@@ -3431,10 +3168,10 @@ var MorphIsland = React21.forwardRef(
|
|
|
3431
3168
|
return prev === n ? prev : n;
|
|
3432
3169
|
});
|
|
3433
3170
|
});
|
|
3434
|
-
|
|
3171
|
+
React20.useEffect(() => {
|
|
3435
3172
|
onOpenChange?.(atSheet);
|
|
3436
3173
|
}, [atSheet, onOpenChange]);
|
|
3437
|
-
|
|
3174
|
+
React20.useLayoutEffect(() => {
|
|
3438
3175
|
if (active) return;
|
|
3439
3176
|
const face = islandFaceRef.current;
|
|
3440
3177
|
if (face !== null && face.offsetHeight > 0 && face.offsetHeight !== islandH) {
|
|
@@ -3447,7 +3184,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3447
3184
|
}
|
|
3448
3185
|
});
|
|
3449
3186
|
useScrollLock(modal, dockRef);
|
|
3450
|
-
const snapTo =
|
|
3187
|
+
const snapTo = React20.useCallback((target) => {
|
|
3451
3188
|
if (target === 0) {
|
|
3452
3189
|
const face = sheetFaceRef.current;
|
|
3453
3190
|
if (face !== null) {
|
|
@@ -3457,11 +3194,11 @@ var MorphIsland = React21.forwardRef(
|
|
|
3457
3194
|
}
|
|
3458
3195
|
animate(progress, target, SNAP_SPRING);
|
|
3459
3196
|
}, [progress]);
|
|
3460
|
-
|
|
3197
|
+
React20.useImperativeHandle(ref, () => ({
|
|
3461
3198
|
open: () => snapTo(1),
|
|
3462
3199
|
close: () => snapTo(0)
|
|
3463
3200
|
}), [snapTo]);
|
|
3464
|
-
const panStart =
|
|
3201
|
+
const panStart = React20.useRef(0);
|
|
3465
3202
|
const travel = Math.max(1, sheetH - islandH);
|
|
3466
3203
|
const onPanStart = () => {
|
|
3467
3204
|
panStart.current = progress.get();
|
|
@@ -3470,13 +3207,13 @@ var MorphIsland = React21.forwardRef(
|
|
|
3470
3207
|
const next = panStart.current + -info.offset.y / travel;
|
|
3471
3208
|
progress.set(Math.min(1, Math.max(0, next)));
|
|
3472
3209
|
};
|
|
3473
|
-
const settle =
|
|
3210
|
+
const settle = React20.useCallback((velocityY) => {
|
|
3474
3211
|
snapTo(nearestDetent(progress.get(), velocityY, travel, ladder));
|
|
3475
3212
|
}, [snapTo, progress, travel, ladder]);
|
|
3476
3213
|
const onPanEnd = (_e, info) => {
|
|
3477
3214
|
settle(info.velocity.y);
|
|
3478
3215
|
};
|
|
3479
|
-
const islandFacePanEngaged =
|
|
3216
|
+
const islandFacePanEngaged = React20.useRef(false);
|
|
3480
3217
|
const onIslandFacePanStart = (e) => {
|
|
3481
3218
|
const target = e.target instanceof HTMLElement ? e.target : null;
|
|
3482
3219
|
const onControl = target !== null && target.closest(
|
|
@@ -3494,7 +3231,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3494
3231
|
onPanEnd(e, info);
|
|
3495
3232
|
};
|
|
3496
3233
|
useSheetFoldGesture({ sheetFaceRef, atSheet, travel, progress, settle });
|
|
3497
|
-
return /* @__PURE__ */
|
|
3234
|
+
return /* @__PURE__ */ jsxs15(
|
|
3498
3235
|
motion.div,
|
|
3499
3236
|
{
|
|
3500
3237
|
ref: dockRef,
|
|
@@ -3505,7 +3242,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3505
3242
|
transition: { duration: 0.18, ease: [0.22, 1, 0.36, 1] },
|
|
3506
3243
|
style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 60 },
|
|
3507
3244
|
children: [
|
|
3508
|
-
/* @__PURE__ */
|
|
3245
|
+
/* @__PURE__ */ jsx22(
|
|
3509
3246
|
"div",
|
|
3510
3247
|
{
|
|
3511
3248
|
ref: floorProbeRef,
|
|
@@ -3522,7 +3259,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3522
3259
|
}
|
|
3523
3260
|
}
|
|
3524
3261
|
),
|
|
3525
|
-
/* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx22(
|
|
3526
3263
|
motion.div,
|
|
3527
3264
|
{
|
|
3528
3265
|
"aria-hidden": true,
|
|
@@ -3536,7 +3273,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3536
3273
|
}
|
|
3537
3274
|
}
|
|
3538
3275
|
),
|
|
3539
|
-
/* @__PURE__ */
|
|
3276
|
+
/* @__PURE__ */ jsx22(
|
|
3540
3277
|
motion.div,
|
|
3541
3278
|
{
|
|
3542
3279
|
className: "fourty-island-aura",
|
|
@@ -3556,7 +3293,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3556
3293
|
}
|
|
3557
3294
|
}
|
|
3558
3295
|
),
|
|
3559
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ jsx22(
|
|
3560
3297
|
motion.div,
|
|
3561
3298
|
{
|
|
3562
3299
|
className: "fourty-island-ring",
|
|
@@ -3576,7 +3313,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3576
3313
|
}
|
|
3577
3314
|
}
|
|
3578
3315
|
),
|
|
3579
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ jsxs15(
|
|
3580
3317
|
motion.div,
|
|
3581
3318
|
{
|
|
3582
3319
|
className: "fourty-morph-surface",
|
|
@@ -3638,7 +3375,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3638
3375
|
flexDirection: "column"
|
|
3639
3376
|
},
|
|
3640
3377
|
children: [
|
|
3641
|
-
/* @__PURE__ */
|
|
3378
|
+
/* @__PURE__ */ jsx22(
|
|
3642
3379
|
motion.div,
|
|
3643
3380
|
{
|
|
3644
3381
|
"aria-hidden": true,
|
|
@@ -3652,7 +3389,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3652
3389
|
}
|
|
3653
3390
|
}
|
|
3654
3391
|
),
|
|
3655
|
-
/* @__PURE__ */
|
|
3392
|
+
/* @__PURE__ */ jsx22(
|
|
3656
3393
|
motion.div,
|
|
3657
3394
|
{
|
|
3658
3395
|
"aria-hidden": true,
|
|
@@ -3666,7 +3403,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3666
3403
|
}
|
|
3667
3404
|
}
|
|
3668
3405
|
),
|
|
3669
|
-
/* @__PURE__ */
|
|
3406
|
+
/* @__PURE__ */ jsx22(
|
|
3670
3407
|
motion.div,
|
|
3671
3408
|
{
|
|
3672
3409
|
ref: gripRef,
|
|
@@ -3701,7 +3438,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3701
3438
|
pointerEvents: folded ? "none" : "auto"
|
|
3702
3439
|
},
|
|
3703
3440
|
"aria-hidden": folded ? true : void 0,
|
|
3704
|
-
children: /* @__PURE__ */
|
|
3441
|
+
children: /* @__PURE__ */ jsx22(
|
|
3705
3442
|
"svg",
|
|
3706
3443
|
{
|
|
3707
3444
|
"aria-hidden": true,
|
|
@@ -3709,7 +3446,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3709
3446
|
viewBox: "0 0 32 5",
|
|
3710
3447
|
fill: "none",
|
|
3711
3448
|
preserveAspectRatio: "none",
|
|
3712
|
-
children: /* @__PURE__ */
|
|
3449
|
+
children: /* @__PURE__ */ jsx22(
|
|
3713
3450
|
"polyline",
|
|
3714
3451
|
{
|
|
3715
3452
|
points: "1,4 16,1 31,4",
|
|
@@ -3724,7 +3461,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3724
3461
|
)
|
|
3725
3462
|
}
|
|
3726
3463
|
),
|
|
3727
|
-
/* @__PURE__ */
|
|
3464
|
+
/* @__PURE__ */ jsx22(
|
|
3728
3465
|
motion.div,
|
|
3729
3466
|
{
|
|
3730
3467
|
ref: sheetFaceRef,
|
|
@@ -3747,7 +3484,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3747
3484
|
children: historySheet(() => snapTo(0))
|
|
3748
3485
|
}
|
|
3749
3486
|
),
|
|
3750
|
-
/* @__PURE__ */
|
|
3487
|
+
/* @__PURE__ */ jsx22(
|
|
3751
3488
|
motion.div,
|
|
3752
3489
|
{
|
|
3753
3490
|
ref: islandFaceRef,
|
|
@@ -3774,7 +3511,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3774
3511
|
touchAction: "pan-x",
|
|
3775
3512
|
zIndex: 1
|
|
3776
3513
|
},
|
|
3777
|
-
children: /* @__PURE__ */
|
|
3514
|
+
children: /* @__PURE__ */ jsx22(
|
|
3778
3515
|
RestIsland,
|
|
3779
3516
|
{
|
|
3780
3517
|
placeholder,
|
|
@@ -3787,7 +3524,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3787
3524
|
)
|
|
3788
3525
|
}
|
|
3789
3526
|
),
|
|
3790
|
-
/* @__PURE__ */
|
|
3527
|
+
/* @__PURE__ */ jsxs15(
|
|
3791
3528
|
motion.div,
|
|
3792
3529
|
{
|
|
3793
3530
|
className: "fourty-island-collapsed",
|
|
@@ -3805,7 +3542,7 @@ var MorphIsland = React21.forwardRef(
|
|
|
3805
3542
|
},
|
|
3806
3543
|
"data-folded": folded ? "true" : "false",
|
|
3807
3544
|
children: [
|
|
3808
|
-
/* @__PURE__ */
|
|
3545
|
+
/* @__PURE__ */ jsx22(NacreDefs, { animate: !reducedMotion }),
|
|
3809
3546
|
collapsedMark !== void 0 ? collapsedMark : DEFAULT_COLLAPSED_MARK
|
|
3810
3547
|
]
|
|
3811
3548
|
}
|
|
@@ -3819,26 +3556,26 @@ var MorphIsland = React21.forwardRef(
|
|
|
3819
3556
|
}
|
|
3820
3557
|
);
|
|
3821
3558
|
|
|
3822
|
-
// src/shell/mobile/
|
|
3823
|
-
import * as
|
|
3824
|
-
import { jsx as
|
|
3825
|
-
var
|
|
3826
|
-
function
|
|
3559
|
+
// src/shell/mobile/entry-point.tsx
|
|
3560
|
+
import * as React21 from "react";
|
|
3561
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3562
|
+
var EntryPointContext = React21.createContext(null);
|
|
3563
|
+
function EntryPointProvider({
|
|
3827
3564
|
claim,
|
|
3828
3565
|
claimed,
|
|
3829
3566
|
children
|
|
3830
3567
|
}) {
|
|
3831
|
-
const value =
|
|
3832
|
-
return /* @__PURE__ */
|
|
3568
|
+
const value = React21.useMemo(() => ({ claim, claimed }), [claim, claimed]);
|
|
3569
|
+
return /* @__PURE__ */ jsx23(EntryPointContext.Provider, { value, children });
|
|
3833
3570
|
}
|
|
3834
|
-
function
|
|
3835
|
-
const ctx =
|
|
3571
|
+
function useEntryPointClaimed() {
|
|
3572
|
+
const ctx = React21.useContext(EntryPointContext);
|
|
3836
3573
|
return ctx !== null && ctx.claimed;
|
|
3837
3574
|
}
|
|
3838
|
-
function
|
|
3839
|
-
const ctx =
|
|
3575
|
+
function useClaimEntryPoint(active) {
|
|
3576
|
+
const ctx = React21.useContext(EntryPointContext);
|
|
3840
3577
|
const claim = ctx === null ? null : ctx.claim;
|
|
3841
|
-
|
|
3578
|
+
React21.useEffect(() => {
|
|
3842
3579
|
if (claim === null || !active) return;
|
|
3843
3580
|
claim(1);
|
|
3844
3581
|
return () => claim(-1);
|
|
@@ -3847,8 +3584,8 @@ function useClaimHeroEntryPoint(active) {
|
|
|
3847
3584
|
function useOnScreen(ref, opts) {
|
|
3848
3585
|
const enter = opts !== void 0 && opts.enter !== void 0 ? opts.enter : 0.9;
|
|
3849
3586
|
const exit = opts !== void 0 && opts.exit !== void 0 ? opts.exit : 0.25;
|
|
3850
|
-
const [on, setOn] =
|
|
3851
|
-
|
|
3587
|
+
const [on, setOn] = React21.useState(true);
|
|
3588
|
+
React21.useEffect(() => {
|
|
3852
3589
|
const el = ref.current;
|
|
3853
3590
|
if (el === null || typeof IntersectionObserver === "undefined") return;
|
|
3854
3591
|
const observer = new IntersectionObserver(
|
|
@@ -3865,14 +3602,38 @@ function useOnScreen(ref, opts) {
|
|
|
3865
3602
|
}, [ref, enter, exit]);
|
|
3866
3603
|
return on;
|
|
3867
3604
|
}
|
|
3605
|
+
function useFocusWithin(ref) {
|
|
3606
|
+
const [focused, setFocused] = React21.useState(false);
|
|
3607
|
+
React21.useEffect(() => {
|
|
3608
|
+
const el = ref.current;
|
|
3609
|
+
if (el === null) return;
|
|
3610
|
+
const sync = () => setFocused(el.contains(document.activeElement));
|
|
3611
|
+
sync();
|
|
3612
|
+
el.addEventListener("focusin", sync);
|
|
3613
|
+
const leave = () => {
|
|
3614
|
+
queueMicrotask(sync);
|
|
3615
|
+
};
|
|
3616
|
+
el.addEventListener("focusout", leave);
|
|
3617
|
+
return () => {
|
|
3618
|
+
el.removeEventListener("focusin", sync);
|
|
3619
|
+
el.removeEventListener("focusout", leave);
|
|
3620
|
+
};
|
|
3621
|
+
}, [ref]);
|
|
3622
|
+
return focused;
|
|
3623
|
+
}
|
|
3624
|
+
function useEntryPoint(ref, showing) {
|
|
3625
|
+
const onScreen = useOnScreen(ref);
|
|
3626
|
+
const focused = useFocusWithin(ref);
|
|
3627
|
+
useClaimEntryPoint(showing && (onScreen || focused));
|
|
3628
|
+
}
|
|
3868
3629
|
|
|
3869
3630
|
// src/shell/mobile/use-island-fold-scroll.ts
|
|
3870
|
-
import * as
|
|
3631
|
+
import * as React22 from "react";
|
|
3871
3632
|
import { isNavScrollActive } from "@40rty/ams-sdk";
|
|
3872
3633
|
var SCROLL_IDLE_MS = 240;
|
|
3873
3634
|
function useIslandFoldScroll(scrollRef) {
|
|
3874
|
-
const [scrolling, setScrolling] =
|
|
3875
|
-
|
|
3635
|
+
const [scrolling, setScrolling] = React22.useState(false);
|
|
3636
|
+
React22.useEffect(() => {
|
|
3876
3637
|
const el = scrollRef.current;
|
|
3877
3638
|
if (el === null) return;
|
|
3878
3639
|
let timer = null;
|
|
@@ -3893,10 +3654,10 @@ function useIslandFoldScroll(scrollRef) {
|
|
|
3893
3654
|
}
|
|
3894
3655
|
|
|
3895
3656
|
// src/shell/mobile/use-keyboard-inset.ts
|
|
3896
|
-
import * as
|
|
3657
|
+
import * as React23 from "react";
|
|
3897
3658
|
function useKeyboardInset(ref) {
|
|
3898
|
-
const [inset, setInset] =
|
|
3899
|
-
|
|
3659
|
+
const [inset, setInset] = React23.useState(0);
|
|
3660
|
+
React23.useEffect(() => {
|
|
3900
3661
|
const el = ref.current;
|
|
3901
3662
|
if (el === null) return;
|
|
3902
3663
|
const doc = el.ownerDocument;
|
|
@@ -3921,21 +3682,21 @@ function useKeyboardInset(ref) {
|
|
|
3921
3682
|
}
|
|
3922
3683
|
|
|
3923
3684
|
// src/shell/mobile/MobileVoiceConsole.tsx
|
|
3924
|
-
import { jsx as
|
|
3685
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3925
3686
|
function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, onIslandHeightChange, enterFromFloor, collapsedMark }) {
|
|
3926
3687
|
const session = useFourtySession6();
|
|
3927
3688
|
const layout = useDisplayedLayout();
|
|
3928
|
-
const [mode, setMode] =
|
|
3689
|
+
const [mode, setMode] = React24.useState("rest");
|
|
3929
3690
|
const attach = useComposerAttachments();
|
|
3930
|
-
const morphRef =
|
|
3931
|
-
const [threadRelandKey, setThreadRelandKey] =
|
|
3932
|
-
const [sheetOpen, setSheetOpen] =
|
|
3691
|
+
const morphRef = React24.useRef(null);
|
|
3692
|
+
const [threadRelandKey, setThreadRelandKey] = React24.useState(0);
|
|
3693
|
+
const [sheetOpen, setSheetOpen] = React24.useState(false);
|
|
3933
3694
|
useExclusiveOverlay(
|
|
3934
3695
|
"conversation-sheet",
|
|
3935
3696
|
sheetOpen,
|
|
3936
|
-
|
|
3697
|
+
React24.useCallback(() => morphRef.current?.close(), [])
|
|
3937
3698
|
);
|
|
3938
|
-
const anchorRef =
|
|
3699
|
+
const anchorRef = React24.useRef(null);
|
|
3939
3700
|
const chromeInset = useKeyboardInset(anchorRef);
|
|
3940
3701
|
const keyboardLikely = chromeInset > KEYBOARD_LIKELY_MIN_PX;
|
|
3941
3702
|
const restGap = keyboardLikely ? ISLAND_KEYBOARD_GAP : ISLAND_BOTTOM_GAP;
|
|
@@ -3943,20 +3704,20 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
3943
3704
|
const scrollRef = useScrollContainerRef2();
|
|
3944
3705
|
const { atTop, collapsed } = useScrollDirection({ container: scrollRef });
|
|
3945
3706
|
const { scrolling } = useIslandFoldScroll(scrollRef);
|
|
3946
|
-
const handleIslandHeightChange =
|
|
3707
|
+
const handleIslandHeightChange = React24.useCallback(
|
|
3947
3708
|
(height) => {
|
|
3948
3709
|
onIslandHeightChange?.(height);
|
|
3949
3710
|
},
|
|
3950
3711
|
[onIslandHeightChange]
|
|
3951
3712
|
);
|
|
3952
3713
|
const working = session.isRunning || session.isSubmitting;
|
|
3953
|
-
const [summoned, setSummoned] =
|
|
3954
|
-
const summonArmed =
|
|
3955
|
-
const onSummon =
|
|
3714
|
+
const [summoned, setSummoned] = React24.useState(enterFromFloor === true);
|
|
3715
|
+
const summonArmed = React24.useRef(false);
|
|
3716
|
+
const onSummon = React24.useCallback(() => {
|
|
3956
3717
|
setSummoned(true);
|
|
3957
3718
|
summonArmed.current = false;
|
|
3958
3719
|
}, []);
|
|
3959
|
-
|
|
3720
|
+
React24.useEffect(() => {
|
|
3960
3721
|
if (!summoned) return;
|
|
3961
3722
|
if (!scrolling) {
|
|
3962
3723
|
summonArmed.current = true;
|
|
@@ -3964,18 +3725,18 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
3964
3725
|
}
|
|
3965
3726
|
if (summonArmed.current) setSummoned(false);
|
|
3966
3727
|
}, [scrolling, summoned]);
|
|
3967
|
-
const [composing, setComposing] =
|
|
3968
|
-
const
|
|
3969
|
-
const
|
|
3970
|
-
|
|
3971
|
-
const was =
|
|
3972
|
-
|
|
3973
|
-
if (was && !
|
|
3974
|
-
}, [
|
|
3975
|
-
const folded = mode === "rest" && !working && !sheetOpen && !summoned && !composing && (
|
|
3728
|
+
const [composing, setComposing] = React24.useState(false);
|
|
3729
|
+
const entryPointClaimed = useEntryPointClaimed();
|
|
3730
|
+
const claimWasHeld = React24.useRef(entryPointClaimed);
|
|
3731
|
+
React24.useEffect(() => {
|
|
3732
|
+
const was = claimWasHeld.current;
|
|
3733
|
+
claimWasHeld.current = entryPointClaimed;
|
|
3734
|
+
if (was && !entryPointClaimed) onSummon();
|
|
3735
|
+
}, [entryPointClaimed, onSummon]);
|
|
3736
|
+
const folded = mode === "rest" && !working && !sheetOpen && !summoned && !composing && (entryPointClaimed || !atTop && collapsed);
|
|
3976
3737
|
const currentMessageIndex = useCurrentMessageIndex();
|
|
3977
|
-
const prevMessageIndex =
|
|
3978
|
-
|
|
3738
|
+
const prevMessageIndex = React24.useRef(currentMessageIndex);
|
|
3739
|
+
React24.useEffect(() => {
|
|
3979
3740
|
const changed = currentMessageIndex !== prevMessageIndex.current;
|
|
3980
3741
|
prevMessageIndex.current = currentMessageIndex;
|
|
3981
3742
|
if (changed && sheetOpen) morphRef.current?.close();
|
|
@@ -3992,7 +3753,7 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
3992
3753
|
silenceMs: 2e3
|
|
3993
3754
|
});
|
|
3994
3755
|
useWakeLock(voice.state === "listening" || working);
|
|
3995
|
-
const [micDeniedNotice, setMicDeniedNotice] =
|
|
3756
|
+
const [micDeniedNotice, setMicDeniedNotice] = React24.useState(false);
|
|
3996
3757
|
const startVoice = () => {
|
|
3997
3758
|
if (!voice.supported) {
|
|
3998
3759
|
morphRef.current?.open();
|
|
@@ -4010,7 +3771,7 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
4010
3771
|
voice.cancel();
|
|
4011
3772
|
setMode("rest");
|
|
4012
3773
|
};
|
|
4013
|
-
|
|
3774
|
+
React24.useEffect(() => {
|
|
4014
3775
|
if (mode !== "listening" || voice.state !== "idle") return;
|
|
4015
3776
|
setMode("rest");
|
|
4016
3777
|
if (voice.permissionDenied) {
|
|
@@ -4019,11 +3780,11 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
4019
3780
|
return () => clearTimeout(timer);
|
|
4020
3781
|
}
|
|
4021
3782
|
}, [mode, voice.state, voice.permissionDenied]);
|
|
4022
|
-
const wasRunning =
|
|
4023
|
-
const turnStartLayoutSig =
|
|
4024
|
-
const turnStartMsgCount =
|
|
4025
|
-
const answerHandled =
|
|
4026
|
-
|
|
3783
|
+
const wasRunning = React24.useRef(false);
|
|
3784
|
+
const turnStartLayoutSig = React24.useRef("");
|
|
3785
|
+
const turnStartMsgCount = React24.useRef(0);
|
|
3786
|
+
const answerHandled = React24.useRef(true);
|
|
3787
|
+
React24.useEffect(() => {
|
|
4027
3788
|
if (session.isRunning && !wasRunning.current) {
|
|
4028
3789
|
setMode("rest");
|
|
4029
3790
|
morphRef.current?.close();
|
|
@@ -4048,8 +3809,8 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
4048
3809
|
}
|
|
4049
3810
|
}
|
|
4050
3811
|
}, [session.isRunning, layout, session.messages]);
|
|
4051
|
-
return /* @__PURE__ */
|
|
4052
|
-
/* @__PURE__ */
|
|
3812
|
+
return /* @__PURE__ */ jsxs16(ThreadRelandContext.Provider, { value: threadRelandKey, children: [
|
|
3813
|
+
/* @__PURE__ */ jsx24(AnimatePresence, { initial: false, children: mode === "rest" && /* @__PURE__ */ jsx24(
|
|
4053
3814
|
MorphIsland,
|
|
4054
3815
|
{
|
|
4055
3816
|
ref: morphRef,
|
|
@@ -4071,7 +3832,7 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
4071
3832
|
},
|
|
4072
3833
|
"morph"
|
|
4073
3834
|
) }),
|
|
4074
|
-
/* @__PURE__ */
|
|
3835
|
+
/* @__PURE__ */ jsx24(
|
|
4075
3836
|
"div",
|
|
4076
3837
|
{
|
|
4077
3838
|
ref: anchorRef,
|
|
@@ -4087,22 +3848,22 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
|
|
|
4087
3848
|
pointerEvents: "none",
|
|
4088
3849
|
zIndex: 60
|
|
4089
3850
|
},
|
|
4090
|
-
children: /* @__PURE__ */
|
|
3851
|
+
children: /* @__PURE__ */ jsx24("div", { style: { pointerEvents: "auto", display: "flex", justifyContent: "center", maxWidth: "100%" }, children: /* @__PURE__ */ jsx24(AnimatePresence, { mode: "wait", initial: false, children: mode === "listening" ? /* @__PURE__ */ jsx24(VoiceIsland, { transcript: voice.transcript, onStop: stopVoice, onCancel: cancelVoice }, "listening") : null }) })
|
|
4091
3852
|
}
|
|
4092
3853
|
)
|
|
4093
3854
|
] });
|
|
4094
3855
|
}
|
|
4095
3856
|
|
|
4096
3857
|
// src/shell/mobile/PageComposerDock.tsx
|
|
4097
|
-
import * as
|
|
4098
|
-
import { jsx as
|
|
3858
|
+
import * as React25 from "react";
|
|
3859
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4099
3860
|
function PageComposerDock({
|
|
4100
3861
|
bottom,
|
|
4101
3862
|
onHeightChange,
|
|
4102
3863
|
children
|
|
4103
3864
|
}) {
|
|
4104
|
-
const ref =
|
|
4105
|
-
|
|
3865
|
+
const ref = React25.useRef(null);
|
|
3866
|
+
React25.useLayoutEffect(() => {
|
|
4106
3867
|
const node = ref.current;
|
|
4107
3868
|
if (node === null) return;
|
|
4108
3869
|
const report = () => onHeightChange(node.getBoundingClientRect().height);
|
|
@@ -4111,7 +3872,7 @@ function PageComposerDock({
|
|
|
4111
3872
|
observer.observe(node);
|
|
4112
3873
|
return () => observer.disconnect();
|
|
4113
3874
|
}, [onHeightChange]);
|
|
4114
|
-
return /* @__PURE__ */
|
|
3875
|
+
return /* @__PURE__ */ jsx25("div", { ref, "data-fourty-shell-part": "canvasComposer", style: { position: "fixed", left: 0, right: 0, bottom, zIndex: 40 }, children });
|
|
4115
3876
|
}
|
|
4116
3877
|
|
|
4117
3878
|
// src/shell/mobile/document-scroll-ref.ts
|
|
@@ -4135,7 +3896,7 @@ function documentScrollRef(forwarded) {
|
|
|
4135
3896
|
}
|
|
4136
3897
|
|
|
4137
3898
|
// src/shell/mobile/DefaultMobileShell.tsx
|
|
4138
|
-
import { Fragment as
|
|
3899
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4139
3900
|
var MOBILE_GUTTER_MAX = 16;
|
|
4140
3901
|
function scrollToTop() {
|
|
4141
3902
|
if (typeof document === "undefined") return;
|
|
@@ -4147,44 +3908,44 @@ function DefaultMobileShell(props) {
|
|
|
4147
3908
|
const { messages } = useSessionState();
|
|
4148
3909
|
const { isSubmitting, isRunning } = useFourtySession7();
|
|
4149
3910
|
const working = isSubmitting || isRunning;
|
|
4150
|
-
const [open, setOpen] =
|
|
4151
|
-
const toggle =
|
|
4152
|
-
const dock =
|
|
3911
|
+
const [open, setOpen] = React26.useState(false);
|
|
3912
|
+
const toggle = React26.useCallback(() => setOpen((v) => !v), []);
|
|
3913
|
+
const dock = React26.useMemo(() => ({ open, toggle }), [open, toggle]);
|
|
4153
3914
|
const gutter = Math.min(props.gutter === void 0 ? MOBILE_GUTTER_MAX : props.gutter, MOBILE_GUTTER_MAX);
|
|
4154
3915
|
const placeholder = props.placeholder === void 0 ? DEFAULT_PLACEHOLDER : props.placeholder;
|
|
4155
3916
|
const canvasGutterStyle = { paddingLeft: gutter, paddingRight: gutter, "--fourty-canvas-gutter": `${gutter}px` };
|
|
4156
|
-
const [islandFaceHeight, setIslandFaceHeight] =
|
|
4157
|
-
const [
|
|
4158
|
-
const
|
|
4159
|
-
|
|
3917
|
+
const [islandFaceHeight, setIslandFaceHeight] = React26.useState(null);
|
|
3918
|
+
const [entryPointClaims, setEntryPointClaims] = React26.useState(0);
|
|
3919
|
+
const claimEntryPoint = React26.useCallback((delta) => {
|
|
3920
|
+
setEntryPointClaims((n) => Math.max(0, n + delta));
|
|
4160
3921
|
}, []);
|
|
4161
|
-
const
|
|
4162
|
-
const withholdIsland =
|
|
3922
|
+
const entryPointClaimed = entryPointClaims > 0;
|
|
3923
|
+
const withholdIsland = entryPointClaimed && !working;
|
|
4163
3924
|
const hasAsked = messages.some((m) => m.role === "user");
|
|
4164
|
-
const hadAsked =
|
|
4165
|
-
|
|
3925
|
+
const hadAsked = React26.useRef(hasAsked);
|
|
3926
|
+
React26.useEffect(() => {
|
|
4166
3927
|
const was = hadAsked.current;
|
|
4167
3928
|
hadAsked.current = hasAsked;
|
|
4168
3929
|
if (!was || hasAsked) return;
|
|
4169
3930
|
scrollToTop();
|
|
4170
3931
|
}, [hasAsked]);
|
|
4171
|
-
const wasWithheld =
|
|
3932
|
+
const wasWithheld = React26.useRef(false);
|
|
4172
3933
|
const enterFromFloor = wasWithheld.current && !withholdIsland;
|
|
4173
|
-
|
|
3934
|
+
React26.useEffect(() => {
|
|
4174
3935
|
wasWithheld.current = withholdIsland;
|
|
4175
3936
|
}, [withholdIsland]);
|
|
4176
3937
|
const pageComposes = props.canvasComposer !== void 0;
|
|
4177
3938
|
const measuredClearance = islandFaceHeight === null ? MOBILE_CANVAS_BOTTOM_CLEARANCE : islandFaceHeight + ISLAND_CLEARANCE_BREATHING;
|
|
4178
3939
|
const canvasBottomClearance = withholdIsland ? 0 : measuredClearance;
|
|
4179
|
-
const shellRef =
|
|
3940
|
+
const shellRef = React26.useRef(null);
|
|
4180
3941
|
const chromeInset = useKeyboardInset(shellRef);
|
|
4181
3942
|
const restingChromeInset = chromeInset > KEYBOARD_LIKELY_MIN_PX ? 0 : chromeInset;
|
|
4182
3943
|
const resolveScrollRef = documentScrollRef(props.scrollRef);
|
|
4183
|
-
const rootRef =
|
|
3944
|
+
const rootRef = React26.useCallback((node) => {
|
|
4184
3945
|
shellRef.current = node;
|
|
4185
3946
|
resolveScrollRef(node);
|
|
4186
3947
|
}, [props.scrollRef]);
|
|
4187
|
-
|
|
3948
|
+
React26.useLayoutEffect(() => {
|
|
4188
3949
|
if (typeof window === "undefined") return;
|
|
4189
3950
|
const nav = window.performance.getEntriesByType("navigation")[0];
|
|
4190
3951
|
const isReload = nav !== void 0 && nav.type === "reload";
|
|
@@ -4196,7 +3957,7 @@ function DefaultMobileShell(props) {
|
|
|
4196
3957
|
window.history.scrollRestoration = previous;
|
|
4197
3958
|
};
|
|
4198
3959
|
}, []);
|
|
4199
|
-
|
|
3960
|
+
React26.useEffect(() => {
|
|
4200
3961
|
const target = document.scrollingElement;
|
|
4201
3962
|
if (!(target instanceof HTMLElement)) return;
|
|
4202
3963
|
const previous = target.style.scrollPaddingTop;
|
|
@@ -4205,7 +3966,7 @@ function DefaultMobileShell(props) {
|
|
|
4205
3966
|
target.style.scrollPaddingTop = previous;
|
|
4206
3967
|
};
|
|
4207
3968
|
}, []);
|
|
4208
|
-
return /* @__PURE__ */
|
|
3969
|
+
return /* @__PURE__ */ jsxs17(
|
|
4209
3970
|
"div",
|
|
4210
3971
|
{
|
|
4211
3972
|
ref: rootRef,
|
|
@@ -4241,29 +4002,29 @@ function DefaultMobileShell(props) {
|
|
|
4241
4002
|
background: "var(--fourty-color-bg)"
|
|
4242
4003
|
},
|
|
4243
4004
|
children: [
|
|
4244
|
-
/* @__PURE__ */
|
|
4245
|
-
/* @__PURE__ */
|
|
4246
|
-
/* @__PURE__ */
|
|
4005
|
+
/* @__PURE__ */ jsx26(MobileChrome, { logo: resolveShellSlot(props.logo, dock), launchers: resolveShellSlot(props.launchers, dock) }),
|
|
4006
|
+
/* @__PURE__ */ jsxs17(EntryPointProvider, { claim: claimEntryPoint, claimed: entryPointClaimed, children: [
|
|
4007
|
+
/* @__PURE__ */ jsx26(
|
|
4247
4008
|
"main",
|
|
4248
4009
|
{
|
|
4249
4010
|
style: {
|
|
4250
4011
|
paddingBottom: `${canvasBottomClearance + restingChromeInset + ISLAND_BOTTOM_GAP}px`
|
|
4251
4012
|
},
|
|
4252
|
-
children: /* @__PURE__ */
|
|
4253
|
-
/* @__PURE__ */
|
|
4013
|
+
children: /* @__PURE__ */ jsxs17("div", { style: canvasGutterStyle, children: [
|
|
4014
|
+
/* @__PURE__ */ jsx26(ConversationTransition, { children: props.canvas }),
|
|
4254
4015
|
props.footer
|
|
4255
4016
|
] })
|
|
4256
4017
|
}
|
|
4257
4018
|
),
|
|
4258
|
-
pageComposes && !withholdIsland && /* @__PURE__ */
|
|
4259
|
-
!pageComposes && !withholdIsland && /* @__PURE__ */
|
|
4019
|
+
pageComposes && !withholdIsland && /* @__PURE__ */ jsx26(PageComposerDock, { bottom: chromeInset, onHeightChange: setIslandFaceHeight, children: resolveShellSlot(props.canvasComposer, dock) }),
|
|
4020
|
+
!pageComposes && !withholdIsland && /* @__PURE__ */ jsx26(
|
|
4260
4021
|
MobileVoiceConsole,
|
|
4261
4022
|
{
|
|
4262
4023
|
enterFromFloor,
|
|
4263
4024
|
placeholder,
|
|
4264
4025
|
placeholderExamples: props.placeholderExamples,
|
|
4265
4026
|
collapsedMark: props.collapsedMark,
|
|
4266
|
-
historySheet: (close) => /* @__PURE__ */
|
|
4027
|
+
historySheet: (close) => /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
4267
4028
|
props.presenceNotch !== void 0 && // Bleeds the notch's OWN background up UNDER the grip's row
|
|
4268
4029
|
// (negative `marginTop` pulls the box up by the grip's exact
|
|
4269
4030
|
// height; `paddingTop` pushes the notch's real CONTENT back
|
|
@@ -4273,8 +4034,8 @@ function DefaultMobileShell(props) {
|
|
|
4273
4034
|
// opacity once `atSheet`) — a visible seam between the grip
|
|
4274
4035
|
// and the notch's own color, right where they should read as
|
|
4275
4036
|
// one continuous surface.
|
|
4276
|
-
/* @__PURE__ */
|
|
4277
|
-
/* @__PURE__ */
|
|
4037
|
+
/* @__PURE__ */ jsx26("div", { style: { marginTop: -ISLAND_GRIP_H, paddingTop: ISLAND_GRIP_H }, children: props.presenceNotch }),
|
|
4038
|
+
/* @__PURE__ */ jsx26("div", { style: { position: "relative", flex: 1, minHeight: 0 }, children: resolveShellSlot(props.composer, { open: true, toggle: close }) })
|
|
4278
4039
|
] }),
|
|
4279
4040
|
onIslandHeightChange: setIslandFaceHeight
|
|
4280
4041
|
}
|
|
@@ -4287,14 +4048,14 @@ function DefaultMobileShell(props) {
|
|
|
4287
4048
|
}
|
|
4288
4049
|
|
|
4289
4050
|
// src/shell/dock-context.tsx
|
|
4290
|
-
import * as
|
|
4291
|
-
import { jsx as
|
|
4292
|
-
var ShellDockContext =
|
|
4051
|
+
import * as React27 from "react";
|
|
4052
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4053
|
+
var ShellDockContext = React27.createContext(null);
|
|
4293
4054
|
function ShellDockProvider({ value, children }) {
|
|
4294
|
-
return /* @__PURE__ */
|
|
4055
|
+
return /* @__PURE__ */ jsx27(ShellDockContext.Provider, { value, children });
|
|
4295
4056
|
}
|
|
4296
4057
|
function useShellDock() {
|
|
4297
|
-
const dock =
|
|
4058
|
+
const dock = React27.useContext(ShellDockContext);
|
|
4298
4059
|
if (dock === null) {
|
|
4299
4060
|
throw new Error("useShellDock: no ShellDockProvider in the tree \u2014 this component must render inside a ShellScaffold canvas.");
|
|
4300
4061
|
}
|
|
@@ -4302,7 +4063,7 @@ function useShellDock() {
|
|
|
4302
4063
|
}
|
|
4303
4064
|
|
|
4304
4065
|
// src/shell/ShellScaffold.tsx
|
|
4305
|
-
import { jsx as
|
|
4066
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4306
4067
|
var DEFAULTS = {
|
|
4307
4068
|
dockWidth: 420,
|
|
4308
4069
|
dockTop: 0,
|
|
@@ -4329,21 +4090,21 @@ function ShellScaffold(props) {
|
|
|
4329
4090
|
};
|
|
4330
4091
|
const isMobile = useMediaQuery(mq);
|
|
4331
4092
|
const dock = useDockState(props.reopenDockOnMessage === true, props.canvasComposer === void 0);
|
|
4332
|
-
const [
|
|
4333
|
-
const
|
|
4334
|
-
|
|
4093
|
+
const [entryPointClaims, setEntryPointClaims] = React28.useState(0);
|
|
4094
|
+
const claimEntryPoint = React28.useCallback((delta) => {
|
|
4095
|
+
setEntryPointClaims((n) => Math.max(0, n + delta));
|
|
4335
4096
|
}, []);
|
|
4336
|
-
const
|
|
4097
|
+
const entryPointClaimed = entryPointClaims > 0;
|
|
4337
4098
|
const resizable = props.resizableDock === true;
|
|
4338
|
-
const [liveWidth, setLiveWidth] =
|
|
4339
|
-
const [resizing, setResizing] =
|
|
4099
|
+
const [liveWidth, setLiveWidth] = React28.useState(dockWidth);
|
|
4100
|
+
const [resizing, setResizing] = React28.useState(false);
|
|
4340
4101
|
const effectiveWidth = resizable ? liveWidth : dockWidth;
|
|
4341
4102
|
const canvasSpacing = useSideDockSpacing(dock.open, effectiveWidth, !resizing);
|
|
4342
4103
|
if (props.mobile !== void 0 && isMobile) {
|
|
4343
|
-
return /* @__PURE__ */
|
|
4104
|
+
return /* @__PURE__ */ jsx28(ShellDockProvider, { value: dock, children: props.mobile });
|
|
4344
4105
|
}
|
|
4345
4106
|
if (isMobile) {
|
|
4346
|
-
return /* @__PURE__ */
|
|
4107
|
+
return /* @__PURE__ */ jsx28(ShellDockProvider, { value: dock, children: /* @__PURE__ */ jsx28(
|
|
4347
4108
|
DefaultMobileShell,
|
|
4348
4109
|
{
|
|
4349
4110
|
canvas: props.canvas,
|
|
@@ -4362,11 +4123,11 @@ function ShellScaffold(props) {
|
|
|
4362
4123
|
}
|
|
4363
4124
|
) });
|
|
4364
4125
|
}
|
|
4365
|
-
const canvasContent = /* @__PURE__ */
|
|
4366
|
-
return /* @__PURE__ */
|
|
4126
|
+
const canvasContent = /* @__PURE__ */ jsx28(ShellDockProvider, { value: dock, children: /* @__PURE__ */ jsx28(EntryPointProvider, { claim: claimEntryPoint, claimed: entryPointClaimed, children: wrapTransition ? /* @__PURE__ */ jsx28(ConversationTransition, { children: props.canvas }) : props.canvas }) });
|
|
4127
|
+
return /* @__PURE__ */ jsxs18("div", { style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, background: "var(--fourty-color-bg)" }, children: [
|
|
4367
4128
|
props.presenceNotch,
|
|
4368
|
-
/* @__PURE__ */
|
|
4369
|
-
/* @__PURE__ */
|
|
4129
|
+
/* @__PURE__ */ jsxs18("div", { style: { position: "relative", flex: 1, minHeight: 0, background: "var(--fourty-color-bg)" }, children: [
|
|
4130
|
+
/* @__PURE__ */ jsx28(
|
|
4370
4131
|
"main",
|
|
4371
4132
|
{
|
|
4372
4133
|
ref: props.scrollRef,
|
|
@@ -4380,15 +4141,15 @@ function ShellScaffold(props) {
|
|
|
4380
4141
|
scrollPaddingTop: paddingTop,
|
|
4381
4142
|
...canvasSpacing
|
|
4382
4143
|
},
|
|
4383
|
-
children: /* @__PURE__ */
|
|
4384
|
-
/* @__PURE__ */
|
|
4385
|
-
props.canvasComposer !== void 0 && !
|
|
4144
|
+
children: /* @__PURE__ */ jsxs18("div", { "data-fourty-canvas": "", style: canvasGutterStyle, children: [
|
|
4145
|
+
/* @__PURE__ */ jsx28("div", { style: { flex: 1, minHeight: 0 }, children: canvasContent }),
|
|
4146
|
+
props.canvasComposer !== void 0 && !entryPointClaimed && /* @__PURE__ */ jsx28("div", { "data-fourty-shell-part": "composer", style: { position: "sticky", bottom: 0, zIndex: dockZIndex }, children: resolveShellSlot(props.canvasComposer, dock) }),
|
|
4386
4147
|
props.footer
|
|
4387
4148
|
] })
|
|
4388
4149
|
}
|
|
4389
4150
|
),
|
|
4390
4151
|
resolveShellSlot(props.header, dock),
|
|
4391
|
-
/* @__PURE__ */
|
|
4152
|
+
/* @__PURE__ */ jsx28(
|
|
4392
4153
|
SideDock,
|
|
4393
4154
|
{
|
|
4394
4155
|
open: dock.open,
|
|
@@ -4410,17 +4171,17 @@ function ShellScaffold(props) {
|
|
|
4410
4171
|
}
|
|
4411
4172
|
|
|
4412
4173
|
// src/shell/MenuDrawer.tsx
|
|
4413
|
-
import * as
|
|
4174
|
+
import * as React30 from "react";
|
|
4414
4175
|
import { useFormFactor as useFormFactor6 } from "@40rty/ams-sdk";
|
|
4415
4176
|
|
|
4416
4177
|
// src/shell/menu-columns.tsx
|
|
4417
|
-
import { jsx as
|
|
4178
|
+
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4418
4179
|
function MenuColumn({
|
|
4419
4180
|
column,
|
|
4420
4181
|
onPick
|
|
4421
4182
|
}) {
|
|
4422
|
-
return /* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4183
|
+
return /* @__PURE__ */ jsxs19("div", { style: { minWidth: 132, display: "flex", flexDirection: "column" }, children: [
|
|
4184
|
+
/* @__PURE__ */ jsx29(
|
|
4424
4185
|
"div",
|
|
4425
4186
|
{
|
|
4426
4187
|
style: {
|
|
@@ -4434,7 +4195,7 @@ function MenuColumn({
|
|
|
4434
4195
|
children: column.title
|
|
4435
4196
|
}
|
|
4436
4197
|
),
|
|
4437
|
-
column.links.map((l) => /* @__PURE__ */
|
|
4198
|
+
column.links.map((l) => /* @__PURE__ */ jsx29(
|
|
4438
4199
|
motion.button,
|
|
4439
4200
|
{
|
|
4440
4201
|
type: "button",
|
|
@@ -4462,14 +4223,14 @@ function MenuColumn({
|
|
|
4462
4223
|
}
|
|
4463
4224
|
|
|
4464
4225
|
// src/shell/MenuFlyout.tsx
|
|
4465
|
-
import { jsx as
|
|
4226
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4466
4227
|
function MenuFlyout({
|
|
4467
4228
|
item,
|
|
4468
4229
|
onPick
|
|
4469
4230
|
}) {
|
|
4470
4231
|
const columns = item.megaMenu?.columns;
|
|
4471
4232
|
if (columns === void 0 || columns.length === 0) return null;
|
|
4472
|
-
return /* @__PURE__ */
|
|
4233
|
+
return /* @__PURE__ */ jsx30(
|
|
4473
4234
|
motion.div,
|
|
4474
4235
|
{
|
|
4475
4236
|
initial: { opacity: 0, x: -10 },
|
|
@@ -4489,16 +4250,16 @@ function MenuFlyout({
|
|
|
4489
4250
|
flexWrap: "wrap",
|
|
4490
4251
|
alignContent: "flex-start"
|
|
4491
4252
|
},
|
|
4492
|
-
children: columns.map((col) => /* @__PURE__ */
|
|
4253
|
+
children: columns.map((col) => /* @__PURE__ */ jsx30(MenuColumn, { column: col, onPick }, col.title))
|
|
4493
4254
|
}
|
|
4494
4255
|
);
|
|
4495
4256
|
}
|
|
4496
4257
|
|
|
4497
4258
|
// src/shell/MenuNav.tsx
|
|
4498
|
-
import * as
|
|
4259
|
+
import * as React29 from "react";
|
|
4499
4260
|
|
|
4500
4261
|
// src/shell/MenuAccordionPanel.tsx
|
|
4501
|
-
import { jsx as
|
|
4262
|
+
import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4502
4263
|
function MenuAccordionPanel({
|
|
4503
4264
|
item,
|
|
4504
4265
|
onPick
|
|
@@ -4507,7 +4268,7 @@ function MenuAccordionPanel({
|
|
|
4507
4268
|
const columns = item.megaMenu?.columns;
|
|
4508
4269
|
if (columns === void 0 || columns.length === 0) return null;
|
|
4509
4270
|
const action = item.action;
|
|
4510
|
-
return /* @__PURE__ */
|
|
4271
|
+
return /* @__PURE__ */ jsx31(
|
|
4511
4272
|
motion.div,
|
|
4512
4273
|
{
|
|
4513
4274
|
role: "menu",
|
|
@@ -4522,7 +4283,7 @@ function MenuAccordionPanel({
|
|
|
4522
4283
|
// UNDER its department row rather than as another top-level section.
|
|
4523
4284
|
background: "color-mix(in srgb, var(--color-text) 4%, transparent)"
|
|
4524
4285
|
},
|
|
4525
|
-
children: /* @__PURE__ */
|
|
4286
|
+
children: /* @__PURE__ */ jsxs20(
|
|
4526
4287
|
"div",
|
|
4527
4288
|
{
|
|
4528
4289
|
style: {
|
|
@@ -4532,7 +4293,7 @@ function MenuAccordionPanel({
|
|
|
4532
4293
|
padding: "4px 24px 22px 24px"
|
|
4533
4294
|
},
|
|
4534
4295
|
children: [
|
|
4535
|
-
action !== void 0 && /* @__PURE__ */
|
|
4296
|
+
action !== void 0 && /* @__PURE__ */ jsxs20(
|
|
4536
4297
|
motion.button,
|
|
4537
4298
|
{
|
|
4538
4299
|
type: "button",
|
|
@@ -4557,12 +4318,12 @@ function MenuAccordionPanel({
|
|
|
4557
4318
|
color: "var(--color-text)"
|
|
4558
4319
|
},
|
|
4559
4320
|
children: [
|
|
4560
|
-
/* @__PURE__ */
|
|
4561
|
-
/* @__PURE__ */
|
|
4321
|
+
/* @__PURE__ */ jsx31("span", { children: labels.menu.shopAll(item.label) }),
|
|
4322
|
+
/* @__PURE__ */ jsx31("span", { "aria-hidden": "true", style: { opacity: 0.5 }, children: "\u2192" })
|
|
4562
4323
|
]
|
|
4563
4324
|
}
|
|
4564
4325
|
),
|
|
4565
|
-
columns.map((col) => /* @__PURE__ */
|
|
4326
|
+
columns.map((col) => /* @__PURE__ */ jsx31(MenuColumn, { column: col, onPick }, col.title))
|
|
4566
4327
|
]
|
|
4567
4328
|
}
|
|
4568
4329
|
)
|
|
@@ -4571,7 +4332,7 @@ function MenuAccordionPanel({
|
|
|
4571
4332
|
}
|
|
4572
4333
|
|
|
4573
4334
|
// src/shell/MenuNav.tsx
|
|
4574
|
-
import { jsx as
|
|
4335
|
+
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4575
4336
|
function MenuNav({
|
|
4576
4337
|
items,
|
|
4577
4338
|
mode,
|
|
@@ -4579,12 +4340,12 @@ function MenuNav({
|
|
|
4579
4340
|
onOpenChange,
|
|
4580
4341
|
onPick
|
|
4581
4342
|
}) {
|
|
4582
|
-
return /* @__PURE__ */
|
|
4343
|
+
return /* @__PURE__ */ jsx32("nav", { style: { display: "flex", flexDirection: "column", paddingBottom: 24 }, children: items.map((item, i) => {
|
|
4583
4344
|
const hasMega = item.megaMenu !== void 0 && item.megaMenu.columns.length > 0;
|
|
4584
4345
|
const isOpen = openIndex === i;
|
|
4585
4346
|
const inverted = mode === "hover" && isOpen;
|
|
4586
|
-
return /* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4347
|
+
return /* @__PURE__ */ jsxs21(React29.Fragment, { children: [
|
|
4348
|
+
/* @__PURE__ */ jsxs21(
|
|
4588
4349
|
motion.button,
|
|
4589
4350
|
{
|
|
4590
4351
|
type: "button",
|
|
@@ -4621,8 +4382,8 @@ function MenuNav({
|
|
|
4621
4382
|
textAlign: "left"
|
|
4622
4383
|
},
|
|
4623
4384
|
children: [
|
|
4624
|
-
/* @__PURE__ */
|
|
4625
|
-
/* @__PURE__ */
|
|
4385
|
+
/* @__PURE__ */ jsx32("span", { children: item.label }),
|
|
4386
|
+
/* @__PURE__ */ jsx32(
|
|
4626
4387
|
"span",
|
|
4627
4388
|
{
|
|
4628
4389
|
"aria-hidden": "true",
|
|
@@ -4640,19 +4401,19 @@ function MenuNav({
|
|
|
4640
4401
|
]
|
|
4641
4402
|
}
|
|
4642
4403
|
),
|
|
4643
|
-
mode === "accordion" && /* @__PURE__ */
|
|
4404
|
+
mode === "accordion" && /* @__PURE__ */ jsx32(AnimatePresence, { initial: false, children: isOpen && hasMega && /* @__PURE__ */ jsx32(MenuAccordionPanel, { item, onPick }) })
|
|
4644
4405
|
] }, item.label);
|
|
4645
4406
|
}) });
|
|
4646
4407
|
}
|
|
4647
4408
|
|
|
4648
4409
|
// src/shell/MenuDrawer.tsx
|
|
4649
|
-
import { Fragment as
|
|
4410
|
+
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4650
4411
|
function MenuTrigger({
|
|
4651
4412
|
onClick,
|
|
4652
4413
|
icon,
|
|
4653
4414
|
label
|
|
4654
4415
|
}) {
|
|
4655
|
-
return /* @__PURE__ */
|
|
4416
|
+
return /* @__PURE__ */ jsxs22(
|
|
4656
4417
|
motion.button,
|
|
4657
4418
|
{
|
|
4658
4419
|
type: "button",
|
|
@@ -4678,7 +4439,7 @@ function MenuTrigger({
|
|
|
4678
4439
|
},
|
|
4679
4440
|
children: [
|
|
4680
4441
|
icon,
|
|
4681
|
-
label !== void 0 && /* @__PURE__ */
|
|
4442
|
+
label !== void 0 && /* @__PURE__ */ jsx33("span", { children: label })
|
|
4682
4443
|
]
|
|
4683
4444
|
}
|
|
4684
4445
|
);
|
|
@@ -4691,7 +4452,7 @@ function MenuDrawer({
|
|
|
4691
4452
|
onSelectItem,
|
|
4692
4453
|
panelWidth = DEFAULT_PANEL_WIDTH
|
|
4693
4454
|
}) {
|
|
4694
|
-
const pick =
|
|
4455
|
+
const pick = React30.useCallback(
|
|
4695
4456
|
(item) => {
|
|
4696
4457
|
onClose();
|
|
4697
4458
|
onSelectItem(item);
|
|
@@ -4700,15 +4461,15 @@ function MenuDrawer({
|
|
|
4700
4461
|
);
|
|
4701
4462
|
const { isMobile, isTouch } = useFormFactor6();
|
|
4702
4463
|
const mode = isTouch || isMobile ? "accordion" : "hover";
|
|
4703
|
-
const panelRef =
|
|
4464
|
+
const panelRef = React30.useRef(null);
|
|
4704
4465
|
useScrollLock(open, panelRef);
|
|
4705
|
-
const [openIndex, setOpenIndex] =
|
|
4706
|
-
|
|
4466
|
+
const [openIndex, setOpenIndex] = React30.useState(null);
|
|
4467
|
+
React30.useEffect(() => {
|
|
4707
4468
|
if (!open) setOpenIndex(null);
|
|
4708
4469
|
}, [open]);
|
|
4709
4470
|
const openItem = openIndex === null ? null : items[openIndex];
|
|
4710
|
-
return /* @__PURE__ */
|
|
4711
|
-
/* @__PURE__ */
|
|
4471
|
+
return /* @__PURE__ */ jsx33(AnimatePresence, { children: open && /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
4472
|
+
/* @__PURE__ */ jsx33(
|
|
4712
4473
|
motion.div,
|
|
4713
4474
|
{
|
|
4714
4475
|
initial: { opacity: 0 },
|
|
@@ -4724,7 +4485,7 @@ function MenuDrawer({
|
|
|
4724
4485
|
}
|
|
4725
4486
|
}
|
|
4726
4487
|
),
|
|
4727
|
-
/* @__PURE__ */
|
|
4488
|
+
/* @__PURE__ */ jsxs22(
|
|
4728
4489
|
"div",
|
|
4729
4490
|
{
|
|
4730
4491
|
ref: panelRef,
|
|
@@ -4743,7 +4504,7 @@ function MenuDrawer({
|
|
|
4743
4504
|
alignItems: "stretch"
|
|
4744
4505
|
},
|
|
4745
4506
|
children: [
|
|
4746
|
-
/* @__PURE__ */
|
|
4507
|
+
/* @__PURE__ */ jsxs22(
|
|
4747
4508
|
motion.aside,
|
|
4748
4509
|
{
|
|
4749
4510
|
initial: { x: "-100%" },
|
|
@@ -4772,7 +4533,7 @@ function MenuDrawer({
|
|
|
4772
4533
|
overflowY: "auto"
|
|
4773
4534
|
},
|
|
4774
4535
|
children: [
|
|
4775
|
-
/* @__PURE__ */
|
|
4536
|
+
/* @__PURE__ */ jsx33(
|
|
4776
4537
|
"div",
|
|
4777
4538
|
{
|
|
4778
4539
|
style: {
|
|
@@ -4783,7 +4544,7 @@ function MenuDrawer({
|
|
|
4783
4544
|
justifyContent: "flex-end",
|
|
4784
4545
|
padding: "0 16px"
|
|
4785
4546
|
},
|
|
4786
|
-
children: /* @__PURE__ */
|
|
4547
|
+
children: /* @__PURE__ */ jsx33(
|
|
4787
4548
|
motion.button,
|
|
4788
4549
|
{
|
|
4789
4550
|
type: "button",
|
|
@@ -4805,7 +4566,7 @@ function MenuDrawer({
|
|
|
4805
4566
|
justifyContent: "center",
|
|
4806
4567
|
color: "var(--color-text)"
|
|
4807
4568
|
},
|
|
4808
|
-
children: /* @__PURE__ */
|
|
4569
|
+
children: /* @__PURE__ */ jsx33("svg", { viewBox: "0 0 24 24", width: 13, height: 13, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx33(
|
|
4809
4570
|
"path",
|
|
4810
4571
|
{
|
|
4811
4572
|
d: "M18 6 6 18M6 6l12 12",
|
|
@@ -4819,7 +4580,7 @@ function MenuDrawer({
|
|
|
4819
4580
|
)
|
|
4820
4581
|
}
|
|
4821
4582
|
),
|
|
4822
|
-
/* @__PURE__ */
|
|
4583
|
+
/* @__PURE__ */ jsx33(
|
|
4823
4584
|
MenuNav,
|
|
4824
4585
|
{
|
|
4825
4586
|
items,
|
|
@@ -4832,7 +4593,7 @@ function MenuDrawer({
|
|
|
4832
4593
|
]
|
|
4833
4594
|
}
|
|
4834
4595
|
),
|
|
4835
|
-
mode === "hover" && /* @__PURE__ */
|
|
4596
|
+
mode === "hover" && /* @__PURE__ */ jsx33(AnimatePresence, { children: openItem !== null && openItem !== void 0 && openItem.megaMenu !== void 0 && /* @__PURE__ */ jsx33(MenuFlyout, { item: openItem, onPick: pick }) })
|
|
4836
4597
|
]
|
|
4837
4598
|
}
|
|
4838
4599
|
)
|
|
@@ -4840,22 +4601,22 @@ function MenuDrawer({
|
|
|
4840
4601
|
}
|
|
4841
4602
|
|
|
4842
4603
|
// src/shell/MenuNavBar.tsx
|
|
4843
|
-
import * as
|
|
4844
|
-
import { jsx as
|
|
4604
|
+
import * as React31 from "react";
|
|
4605
|
+
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4845
4606
|
function MenuNavBar({
|
|
4846
4607
|
items,
|
|
4847
4608
|
onSelectItem,
|
|
4848
4609
|
gap = 26
|
|
4849
4610
|
}) {
|
|
4850
|
-
const [openIndex, setOpenIndex] =
|
|
4851
|
-
const pick =
|
|
4611
|
+
const [openIndex, setOpenIndex] = React31.useState(null);
|
|
4612
|
+
const pick = React31.useCallback(
|
|
4852
4613
|
(item) => {
|
|
4853
4614
|
setOpenIndex(null);
|
|
4854
4615
|
onSelectItem(item);
|
|
4855
4616
|
},
|
|
4856
4617
|
[onSelectItem]
|
|
4857
4618
|
);
|
|
4858
|
-
return /* @__PURE__ */
|
|
4619
|
+
return /* @__PURE__ */ jsx34(
|
|
4859
4620
|
"nav",
|
|
4860
4621
|
{
|
|
4861
4622
|
"aria-label": "Site menu",
|
|
@@ -4874,8 +4635,8 @@ function MenuNavBar({
|
|
|
4874
4635
|
// not on the shared `nav`, so the panel's `left: 0` lands under
|
|
4875
4636
|
// THIS label instead of the row's first item regardless of which
|
|
4876
4637
|
// one is hovered.
|
|
4877
|
-
/* @__PURE__ */
|
|
4878
|
-
/* @__PURE__ */
|
|
4638
|
+
/* @__PURE__ */ jsxs23("div", { style: { position: "relative" }, children: [
|
|
4639
|
+
/* @__PURE__ */ jsx34(
|
|
4879
4640
|
motion.button,
|
|
4880
4641
|
{
|
|
4881
4642
|
type: "button",
|
|
@@ -4905,7 +4666,7 @@ function MenuNavBar({
|
|
|
4905
4666
|
children: item.label
|
|
4906
4667
|
}
|
|
4907
4668
|
),
|
|
4908
|
-
/* @__PURE__ */
|
|
4669
|
+
/* @__PURE__ */ jsx34(AnimatePresence, { children: isOpen && item.megaMenu !== void 0 && /* @__PURE__ */ jsx34(
|
|
4909
4670
|
motion.div,
|
|
4910
4671
|
{
|
|
4911
4672
|
initial: { opacity: 0, y: -6 },
|
|
@@ -4921,7 +4682,7 @@ function MenuNavBar({
|
|
|
4921
4682
|
paddingTop: 14,
|
|
4922
4683
|
zIndex: 55
|
|
4923
4684
|
},
|
|
4924
|
-
children: /* @__PURE__ */
|
|
4685
|
+
children: /* @__PURE__ */ jsx34(
|
|
4925
4686
|
"div",
|
|
4926
4687
|
{
|
|
4927
4688
|
style: {
|
|
@@ -4931,7 +4692,7 @@ function MenuNavBar({
|
|
|
4931
4692
|
display: "flex",
|
|
4932
4693
|
gap: 30
|
|
4933
4694
|
},
|
|
4934
|
-
children: item.megaMenu.columns.map((col) => /* @__PURE__ */
|
|
4695
|
+
children: item.megaMenu.columns.map((col) => /* @__PURE__ */ jsx34(MenuColumn, { column: col, onPick: pick }, col.title))
|
|
4935
4696
|
}
|
|
4936
4697
|
)
|
|
4937
4698
|
}
|
|
@@ -4944,9 +4705,9 @@ function MenuNavBar({
|
|
|
4944
4705
|
}
|
|
4945
4706
|
|
|
4946
4707
|
// src/shell/ShellMenuChrome.tsx
|
|
4947
|
-
import * as
|
|
4708
|
+
import * as React32 from "react";
|
|
4948
4709
|
import { useExclusiveOverlay as useExclusiveOverlay2, useFormFactor as useFormFactor7, useScrollContainerRef as useScrollContainerRef3 } from "@40rty/ams-sdk";
|
|
4949
|
-
import { Fragment as
|
|
4710
|
+
import { Fragment as Fragment9, jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4950
4711
|
function ShellMenuChrome({
|
|
4951
4712
|
logo,
|
|
4952
4713
|
menuIcon,
|
|
@@ -4958,12 +4719,12 @@ function ShellMenuChrome({
|
|
|
4958
4719
|
panelWidth,
|
|
4959
4720
|
className
|
|
4960
4721
|
}) {
|
|
4961
|
-
const [open, setOpen] =
|
|
4962
|
-
useExclusiveOverlay2("menu", open,
|
|
4722
|
+
const [open, setOpen] = React32.useState(false);
|
|
4723
|
+
useExclusiveOverlay2("menu", open, React32.useCallback(() => setOpen(false), []));
|
|
4963
4724
|
const { isMobile } = useFormFactor7();
|
|
4964
4725
|
const scrolled = useScrollThreshold(useScrollContainerRef3(), 0);
|
|
4965
|
-
return /* @__PURE__ */
|
|
4966
|
-
isMobile ? /* @__PURE__ */
|
|
4726
|
+
return /* @__PURE__ */ jsxs24(Fragment9, { children: [
|
|
4727
|
+
isMobile ? /* @__PURE__ */ jsxs24(
|
|
4967
4728
|
"div",
|
|
4968
4729
|
{
|
|
4969
4730
|
"data-fourty-shell-part": "menuChrome",
|
|
@@ -4988,12 +4749,12 @@ function ShellMenuChrome({
|
|
|
4988
4749
|
zIndex: 50
|
|
4989
4750
|
},
|
|
4990
4751
|
children: [
|
|
4991
|
-
/* @__PURE__ */
|
|
4992
|
-
/* @__PURE__ */
|
|
4993
|
-
/* @__PURE__ */
|
|
4752
|
+
/* @__PURE__ */ jsx35("span", { style: { justifySelf: "start", display: "inline-flex", alignItems: "center" }, children: items.length > 0 && /* @__PURE__ */ jsx35(MenuTrigger, { onClick: () => setOpen(true), icon: menuIcon }) }),
|
|
4753
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "inline-flex", alignItems: "center", minWidth: 0 }, children: logo }),
|
|
4754
|
+
/* @__PURE__ */ jsx35("span", { "aria-hidden": true })
|
|
4994
4755
|
]
|
|
4995
4756
|
}
|
|
4996
|
-
) : /* @__PURE__ */
|
|
4757
|
+
) : /* @__PURE__ */ jsxs24(
|
|
4997
4758
|
"div",
|
|
4998
4759
|
{
|
|
4999
4760
|
"data-fourty-shell-part": "menuChrome",
|
|
@@ -5015,15 +4776,15 @@ function ShellMenuChrome({
|
|
|
5015
4776
|
zIndex: 50
|
|
5016
4777
|
},
|
|
5017
4778
|
children: [
|
|
5018
|
-
/* @__PURE__ */
|
|
5019
|
-
/* @__PURE__ */
|
|
4779
|
+
/* @__PURE__ */ jsx35(ChromeSurface, { visible: scrolled, lifted: scrolled }),
|
|
4780
|
+
/* @__PURE__ */ jsxs24("div", { style: { position: "relative", display: "flex", alignItems: "center", gap, minWidth: 0 }, children: [
|
|
5020
4781
|
logo,
|
|
5021
|
-
items.length > 0 && /* @__PURE__ */
|
|
4782
|
+
items.length > 0 && /* @__PURE__ */ jsx35(MenuNavBar, { items, onSelectItem })
|
|
5022
4783
|
] })
|
|
5023
4784
|
]
|
|
5024
4785
|
}
|
|
5025
4786
|
),
|
|
5026
|
-
isMobile && /* @__PURE__ */
|
|
4787
|
+
isMobile && /* @__PURE__ */ jsx35(
|
|
5027
4788
|
MenuDrawer,
|
|
5028
4789
|
{
|
|
5029
4790
|
open,
|
|
@@ -5038,7 +4799,7 @@ function ShellMenuChrome({
|
|
|
5038
4799
|
|
|
5039
4800
|
// src/shell/LauncherDock.tsx
|
|
5040
4801
|
import { useFormFactor as useFormFactor8 } from "@40rty/ams-sdk";
|
|
5041
|
-
import { jsx as
|
|
4802
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5042
4803
|
function LauncherDock({
|
|
5043
4804
|
children,
|
|
5044
4805
|
top = 12,
|
|
@@ -5049,7 +4810,7 @@ function LauncherDock({
|
|
|
5049
4810
|
}) {
|
|
5050
4811
|
const { isMobile } = useFormFactor8();
|
|
5051
4812
|
if (isMobile) {
|
|
5052
|
-
return /* @__PURE__ */
|
|
4813
|
+
return /* @__PURE__ */ jsx36(
|
|
5053
4814
|
"div",
|
|
5054
4815
|
{
|
|
5055
4816
|
"data-fourty-shell-part": "launchers",
|
|
@@ -5059,7 +4820,7 @@ function LauncherDock({
|
|
|
5059
4820
|
}
|
|
5060
4821
|
);
|
|
5061
4822
|
}
|
|
5062
|
-
return /* @__PURE__ */
|
|
4823
|
+
return /* @__PURE__ */ jsx36(
|
|
5063
4824
|
"div",
|
|
5064
4825
|
{
|
|
5065
4826
|
"data-fourty-shell-part": "launchers",
|
|
@@ -5083,7 +4844,7 @@ function LauncherDock({
|
|
|
5083
4844
|
}
|
|
5084
4845
|
|
|
5085
4846
|
// src/shell/Button.tsx
|
|
5086
|
-
import { Fragment as
|
|
4847
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5087
4848
|
var SIZE_SPEC = {
|
|
5088
4849
|
sm: { padding: "8px 14px", fontSize: 11, iconSize: 14, height: 32 },
|
|
5089
4850
|
md: { padding: "12px 24px", fontSize: 13.3333, iconSize: 16, height: 42 },
|
|
@@ -5236,7 +4997,7 @@ function Button({
|
|
|
5236
4997
|
};
|
|
5237
4998
|
const labelText = children !== void 0 ? children : label;
|
|
5238
4999
|
const computedAriaLabel = ariaLabel !== void 0 ? ariaLabel : isIconOnly && label !== void 0 ? label : void 0;
|
|
5239
|
-
return /* @__PURE__ */
|
|
5000
|
+
return /* @__PURE__ */ jsx37(
|
|
5240
5001
|
"button",
|
|
5241
5002
|
{
|
|
5242
5003
|
type,
|
|
@@ -5246,11 +5007,11 @@ function Button({
|
|
|
5246
5007
|
style: baseStyle,
|
|
5247
5008
|
onMouseEnter,
|
|
5248
5009
|
onMouseLeave,
|
|
5249
|
-
children: loading ? /* @__PURE__ */
|
|
5250
|
-
Icon && iconPosition === "left" && !isIconOnly && /* @__PURE__ */
|
|
5251
|
-
Icon && isIconOnly && /* @__PURE__ */
|
|
5010
|
+
children: loading ? /* @__PURE__ */ jsx37(Spinner, { size: s.iconSize - 2 }) : /* @__PURE__ */ jsxs25(Fragment10, { children: [
|
|
5011
|
+
Icon && iconPosition === "left" && !isIconOnly && /* @__PURE__ */ jsx37(Icon, { size: s.iconSize, strokeWidth: 1.5 }),
|
|
5012
|
+
Icon && isIconOnly && /* @__PURE__ */ jsx37(Icon, { size: s.iconSize + 2, strokeWidth: 1.5 }),
|
|
5252
5013
|
!isIconOnly && labelText,
|
|
5253
|
-
Icon && iconPosition === "right" && !isIconOnly && /* @__PURE__ */
|
|
5014
|
+
Icon && iconPosition === "right" && !isIconOnly && /* @__PURE__ */ jsx37(Icon, { size: s.iconSize, strokeWidth: 1.5 })
|
|
5254
5015
|
] })
|
|
5255
5016
|
}
|
|
5256
5017
|
);
|
|
@@ -5258,7 +5019,7 @@ function Button({
|
|
|
5258
5019
|
|
|
5259
5020
|
// src/shell/Skeleton.tsx
|
|
5260
5021
|
import { motion as motion3 } from "framer-motion";
|
|
5261
|
-
import { jsx as
|
|
5022
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
5262
5023
|
var BASE_STYLE = {
|
|
5263
5024
|
display: "inline-block",
|
|
5264
5025
|
backgroundColor: "var(--color-surface-alt, #f3f3f3)",
|
|
@@ -5282,13 +5043,13 @@ function Skeleton({
|
|
|
5282
5043
|
style
|
|
5283
5044
|
}) {
|
|
5284
5045
|
const variantStyle = variant === "text" ? { width: dim(width, "100%"), height: dim(height, "1em") } : variant === "pill" ? { width: dim(width, 48), height: dim(height, 18) } : { width: dim(width, "100%"), height: dim(height, "100%") };
|
|
5285
|
-
return /* @__PURE__ */
|
|
5046
|
+
return /* @__PURE__ */ jsx38(
|
|
5286
5047
|
"span",
|
|
5287
5048
|
{
|
|
5288
5049
|
className,
|
|
5289
5050
|
"aria-hidden": "true",
|
|
5290
5051
|
style: { ...BASE_STYLE, ...variantStyle, ...style },
|
|
5291
|
-
children: /* @__PURE__ */
|
|
5052
|
+
children: /* @__PURE__ */ jsx38(
|
|
5292
5053
|
motion3.span,
|
|
5293
5054
|
{
|
|
5294
5055
|
style: SHIMMER_OVERLAY_STYLE,
|
|
@@ -5303,11 +5064,7 @@ function Skeleton({
|
|
|
5303
5064
|
export {
|
|
5304
5065
|
ComposerChipStrip,
|
|
5305
5066
|
AnimatedPlaceholder,
|
|
5306
|
-
ListeningWaveform,
|
|
5307
|
-
DictationButton,
|
|
5308
5067
|
InlineCompletion,
|
|
5309
|
-
AttachmentStrip,
|
|
5310
|
-
AttachButton,
|
|
5311
5068
|
ClearSessionButton,
|
|
5312
5069
|
ConversationHistoryButton,
|
|
5313
5070
|
ShareCanvasButton,
|
|
@@ -5325,8 +5082,10 @@ export {
|
|
|
5325
5082
|
ISLAND_KEYBOARD_GAP,
|
|
5326
5083
|
KEYBOARD_LIKELY_MIN_PX,
|
|
5327
5084
|
MorphIsland,
|
|
5328
|
-
|
|
5085
|
+
useClaimEntryPoint,
|
|
5329
5086
|
useOnScreen,
|
|
5087
|
+
useFocusWithin,
|
|
5088
|
+
useEntryPoint,
|
|
5330
5089
|
MobileVoiceConsole,
|
|
5331
5090
|
DefaultMobileShell,
|
|
5332
5091
|
ShellDockProvider,
|