@flamingo-stack/openframe-frontend-core 0.0.693 → 0.0.694-2513.7700.1
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-GDZ7IC5B.js → chunk-234IIQIS.js} +2 -2
- package/dist/{chunk-DVEFZ5DU.cjs → chunk-2EQED5SZ.cjs} +34 -34
- package/dist/{chunk-DVEFZ5DU.cjs.map → chunk-2EQED5SZ.cjs.map} +1 -1
- package/dist/{chunk-JUNOY5HK.js → chunk-2HX6AADM.js} +15 -17
- package/dist/chunk-2HX6AADM.js.map +1 -0
- package/dist/{chunk-EZFSUHNP.js → chunk-33L2IR62.js} +3 -3
- package/dist/{chunk-TFSRPBVT.js → chunk-42LIHMRA.js} +4 -4
- package/dist/{chunk-MIZU2OTO.cjs → chunk-63BLVGXZ.cjs} +4 -4
- package/dist/{chunk-MIZU2OTO.cjs.map → chunk-63BLVGXZ.cjs.map} +1 -1
- package/dist/{chunk-BFV4L3D7.js → chunk-6ZSDKDOV.js} +8 -8
- package/dist/{chunk-UVUNBXS6.js → chunk-7IINE3MK.js} +48 -5
- package/dist/chunk-7IINE3MK.js.map +1 -0
- package/dist/{chunk-N3526CTH.cjs → chunk-7TO3CWPM.cjs} +3 -3
- package/dist/{chunk-N3526CTH.cjs.map → chunk-7TO3CWPM.cjs.map} +1 -1
- package/dist/{chunk-WJAMBSMW.js → chunk-7VO6NC67.js} +4 -4
- package/dist/{chunk-SC44YJCF.js → chunk-A7RKT5SO.js} +2 -2
- package/dist/{chunk-ID5QPM3X.js → chunk-BW6YBATM.js} +102 -69
- package/dist/chunk-BW6YBATM.js.map +1 -0
- package/dist/{chunk-CMA74BXW.cjs → chunk-C27F6GBZ.cjs} +751 -718
- package/dist/{chunk-CMA74BXW.cjs.map → chunk-C27F6GBZ.cjs.map} +1 -1
- package/dist/{chunk-DVSPRY2V.cjs → chunk-ESMDIJIN.cjs} +3 -3
- package/dist/{chunk-DVSPRY2V.cjs.map → chunk-ESMDIJIN.cjs.map} +1 -1
- package/dist/{chunk-FMPH6G3E.cjs → chunk-FNGX5WZM.cjs} +497 -474
- package/dist/chunk-FNGX5WZM.cjs.map +1 -0
- package/dist/{chunk-5NUOZZRR.js → chunk-GWQCUC53.js} +4 -4
- package/dist/{chunk-XI2BAIKJ.js → chunk-HBMGSGZY.js} +6 -6
- package/dist/{chunk-HM7ZGABI.js → chunk-HEBLLLLD.js} +2 -2
- package/dist/{chunk-HRGG56GC.cjs → chunk-HJZ3UTUE.cjs} +83 -83
- package/dist/{chunk-HRGG56GC.cjs.map → chunk-HJZ3UTUE.cjs.map} +1 -1
- package/dist/{chunk-3HGVRJTC.cjs → chunk-JB25CCOB.cjs} +47 -47
- package/dist/{chunk-3HGVRJTC.cjs.map → chunk-JB25CCOB.cjs.map} +1 -1
- package/dist/{chunk-BDGNKIHU.cjs → chunk-JISKS7RJ.cjs} +26 -26
- package/dist/{chunk-BDGNKIHU.cjs.map → chunk-JISKS7RJ.cjs.map} +1 -1
- package/dist/{chunk-DDCQG3WO.cjs → chunk-K5GSLGV2.cjs} +18 -18
- package/dist/{chunk-DDCQG3WO.cjs.map → chunk-K5GSLGV2.cjs.map} +1 -1
- package/dist/{chunk-SG57SBYG.cjs → chunk-K5K2FRQK.cjs} +19 -19
- package/dist/{chunk-SG57SBYG.cjs.map → chunk-K5K2FRQK.cjs.map} +1 -1
- package/dist/{chunk-WSYCPIRG.cjs → chunk-KBSL4FCL.cjs} +9 -9
- package/dist/{chunk-WSYCPIRG.cjs.map → chunk-KBSL4FCL.cjs.map} +1 -1
- package/dist/{chunk-SDORFSFK.cjs → chunk-KDUDL4PB.cjs} +37 -37
- package/dist/{chunk-SDORFSFK.cjs.map → chunk-KDUDL4PB.cjs.map} +1 -1
- package/dist/{chunk-RKIMG67Q.cjs → chunk-KJHIFF6H.cjs} +16 -16
- package/dist/{chunk-RKIMG67Q.cjs.map → chunk-KJHIFF6H.cjs.map} +1 -1
- package/dist/{chunk-QDH62H4N.js → chunk-LHYOESIQ.js} +4 -4
- package/dist/{chunk-6H5PPQWP.cjs → chunk-LPFU6U7O.cjs} +5 -5
- package/dist/{chunk-6H5PPQWP.cjs.map → chunk-LPFU6U7O.cjs.map} +1 -1
- package/dist/{chunk-I72FRMF6.js → chunk-N7HFUBOV.js} +3 -3
- package/dist/{chunk-53O6PQ3F.cjs → chunk-NDLFK57D.cjs} +7 -7
- package/dist/{chunk-53O6PQ3F.cjs.map → chunk-NDLFK57D.cjs.map} +1 -1
- package/dist/{chunk-XWAT6ZP5.js → chunk-O4RDXDVS.js} +12 -12
- package/dist/{chunk-4KM5MVBM.cjs → chunk-Q2B2MGFU.cjs} +7 -7
- package/dist/{chunk-4KM5MVBM.cjs.map → chunk-Q2B2MGFU.cjs.map} +1 -1
- package/dist/{chunk-5CZZ4JLE.js → chunk-QP54LMXJ.js} +38 -15
- package/dist/{chunk-5CZZ4JLE.js.map → chunk-QP54LMXJ.js.map} +1 -1
- package/dist/{chunk-QRA2JXE4.cjs → chunk-RE6PGOSS.cjs} +6 -8
- package/dist/chunk-RE6PGOSS.cjs.map +1 -0
- package/dist/{chunk-C2SVJVEB.js → chunk-SH5GPYSV.js} +2 -2
- package/dist/{chunk-UWJZRI5J.cjs → chunk-SJFB4Z4L.cjs} +105 -105
- package/dist/{chunk-UWJZRI5J.cjs.map → chunk-SJFB4Z4L.cjs.map} +1 -1
- package/dist/{chunk-7EPGJOKN.js → chunk-TA3JJFEO.js} +4 -4
- package/dist/{chunk-PPRD3PTW.js → chunk-TBR3UTFY.js} +6 -6
- package/dist/{chunk-USKQURNF.cjs → chunk-TG3VBMDG.cjs} +3 -3
- package/dist/{chunk-USKQURNF.cjs.map → chunk-TG3VBMDG.cjs.map} +1 -1
- package/dist/{chunk-F2ZBNRTF.js → chunk-TV5SZJ3N.js} +12 -12
- package/dist/{chunk-GVMVPMDE.js → chunk-TXSQLORA.js} +6 -6
- package/dist/{chunk-INVP4WLX.js → chunk-UCXZRJIE.js} +7 -7
- package/dist/{chunk-I27PWVWE.cjs → chunk-WT4HURQN.cjs} +46 -3
- package/dist/chunk-WT4HURQN.cjs.map +1 -0
- package/dist/{chunk-XAOAYDGR.js → chunk-WZJWIZVH.js} +4 -4
- package/dist/{chunk-IC2SDW6U.js → chunk-XKNKGBUX.js} +10 -8
- package/dist/{chunk-IC2SDW6U.js.map → chunk-XKNKGBUX.js.map} +1 -1
- package/dist/{chunk-LNKLB7GM.cjs → chunk-XNTQHC26.cjs} +28 -28
- package/dist/{chunk-LNKLB7GM.cjs.map → chunk-XNTQHC26.cjs.map} +1 -1
- package/dist/{chunk-2YVTGPM7.js → chunk-XZILGCXJ.js} +2 -2
- package/dist/{chunk-JAQK3GQJ.cjs → chunk-Y5AFMYYN.cjs} +46 -44
- package/dist/chunk-Y5AFMYYN.cjs.map +1 -0
- package/dist/{chunk-7BC3NJAV.cjs → chunk-ZCPMWXIB.cjs} +25 -25
- package/dist/{chunk-7BC3NJAV.cjs.map → chunk-ZCPMWXIB.cjs.map} +1 -1
- package/dist/{chunk-S54QA2VE.cjs → chunk-ZUGAHQDB.cjs} +7 -7
- package/dist/{chunk-S54QA2VE.cjs.map → chunk-ZUGAHQDB.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +21 -21
- package/dist/components/case-studies/index.js +8 -8
- package/dist/components/chat/chat-message-list.d.ts.map +1 -1
- package/dist/components/chat/chat-typing-indicator.d.ts.map +1 -1
- package/dist/components/chat/cycling-phrase.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +5 -5
- package/dist/components/chat/index.js +4 -4
- package/dist/components/contact/index.cjs +9 -9
- package/dist/components/contact/index.js +8 -8
- package/dist/components/docs/index.cjs +12 -12
- package/dist/components/docs/index.js +11 -11
- package/dist/components/embeds/index.cjs +9 -9
- package/dist/components/embeds/index.js +8 -8
- package/dist/components/faq/index.cjs +10 -10
- package/dist/components/faq/index.js +9 -9
- package/dist/components/features/index.cjs +8 -8
- package/dist/components/features/index.js +7 -7
- package/dist/components/help-center-pages/index.cjs +107 -107
- package/dist/components/help-center-pages/index.js +22 -22
- package/dist/components/index.cjs +69 -69
- package/dist/components/index.js +22 -22
- package/dist/components/meeting-scheduler/index.cjs +59 -59
- package/dist/components/meeting-scheduler/index.js +9 -9
- package/dist/components/navigation/app-layout-drawer.d.ts.map +1 -1
- package/dist/components/navigation/index.cjs +11 -11
- package/dist/components/navigation/index.js +10 -10
- package/dist/components/onboarding-guides/index.cjs +12 -12
- package/dist/components/onboarding-guides/index.js +11 -11
- package/dist/components/related-content/index.cjs +6 -6
- package/dist/components/related-content/index.js +5 -5
- package/dist/components/tickets/index.cjs +13 -13
- package/dist/components/tickets/index.js +12 -12
- package/dist/components/ui/index.cjs +8 -8
- package/dist/components/ui/index.js +7 -7
- package/dist/components/ui/markdown/engine.d.ts +0 -21
- package/dist/components/ui/markdown/engine.d.ts.map +1 -1
- package/dist/hooks/index.cjs +6 -6
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/use-authed-asset-src.d.ts.map +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -12
- package/dist/tailwind.config.cjs +14 -1
- package/dist/tailwind.config.cjs.map +1 -1
- package/dist/tailwind.config.js +14 -1
- package/dist/tailwind.config.js.map +1 -1
- package/eslint-config/README.md +13 -0
- package/eslint-config/base.js +15 -0
- package/eslint-config/webview-performance.js +75 -0
- package/package.json +1 -1
- package/src/components/chat/chat-message-enhanced.tsx +1 -1
- package/src/components/chat/chat-message-list.tsx +55 -14
- package/src/components/chat/chat-typing-indicator.tsx +18 -29
- package/src/components/chat/cycling-phrase.tsx +1 -11
- package/src/components/chat/embeddable-chat.tsx +9 -6
- package/src/components/navigation/app-layout-drawer.tsx +53 -7
- package/src/components/ui/__tests__/__snapshots__/markdown-parity.test.tsx.snap +29 -29
- package/src/components/ui/markdown/engine.tsx +56 -12
- package/src/hooks/use-authed-asset-src.ts +58 -6
- package/tailwind.config.ts +13 -0
- package/dist/chunk-FMPH6G3E.cjs.map +0 -1
- package/dist/chunk-I27PWVWE.cjs.map +0 -1
- package/dist/chunk-ID5QPM3X.js.map +0 -1
- package/dist/chunk-JAQK3GQJ.cjs.map +0 -1
- package/dist/chunk-JUNOY5HK.js.map +0 -1
- package/dist/chunk-QRA2JXE4.cjs.map +0 -1
- package/dist/chunk-UVUNBXS6.js.map +0 -1
- /package/dist/{chunk-GDZ7IC5B.js.map → chunk-234IIQIS.js.map} +0 -0
- /package/dist/{chunk-EZFSUHNP.js.map → chunk-33L2IR62.js.map} +0 -0
- /package/dist/{chunk-TFSRPBVT.js.map → chunk-42LIHMRA.js.map} +0 -0
- /package/dist/{chunk-BFV4L3D7.js.map → chunk-6ZSDKDOV.js.map} +0 -0
- /package/dist/{chunk-WJAMBSMW.js.map → chunk-7VO6NC67.js.map} +0 -0
- /package/dist/{chunk-SC44YJCF.js.map → chunk-A7RKT5SO.js.map} +0 -0
- /package/dist/{chunk-5NUOZZRR.js.map → chunk-GWQCUC53.js.map} +0 -0
- /package/dist/{chunk-XI2BAIKJ.js.map → chunk-HBMGSGZY.js.map} +0 -0
- /package/dist/{chunk-HM7ZGABI.js.map → chunk-HEBLLLLD.js.map} +0 -0
- /package/dist/{chunk-QDH62H4N.js.map → chunk-LHYOESIQ.js.map} +0 -0
- /package/dist/{chunk-I72FRMF6.js.map → chunk-N7HFUBOV.js.map} +0 -0
- /package/dist/{chunk-XWAT6ZP5.js.map → chunk-O4RDXDVS.js.map} +0 -0
- /package/dist/{chunk-C2SVJVEB.js.map → chunk-SH5GPYSV.js.map} +0 -0
- /package/dist/{chunk-7EPGJOKN.js.map → chunk-TA3JJFEO.js.map} +0 -0
- /package/dist/{chunk-PPRD3PTW.js.map → chunk-TBR3UTFY.js.map} +0 -0
- /package/dist/{chunk-F2ZBNRTF.js.map → chunk-TV5SZJ3N.js.map} +0 -0
- /package/dist/{chunk-GVMVPMDE.js.map → chunk-TXSQLORA.js.map} +0 -0
- /package/dist/{chunk-INVP4WLX.js.map → chunk-UCXZRJIE.js.map} +0 -0
- /package/dist/{chunk-XAOAYDGR.js.map → chunk-WZJWIZVH.js.map} +0 -0
- /package/dist/{chunk-2YVTGPM7.js.map → chunk-XZILGCXJ.js.map} +0 -0
|
@@ -51,6 +51,15 @@ const BOTTOM_THRESHOLD_PX = 70;
|
|
|
51
51
|
* finishing against the target captured when the call was made. */
|
|
52
52
|
const FOLLOW_RETAIN_MS = 350;
|
|
53
53
|
|
|
54
|
+
/** How long the scrollHeight poll keeps running after the thread last grew,
|
|
55
|
+
* in ms. Long enough for the async growth that lands after a message —
|
|
56
|
+
* images settling, entity cards resolving out of their skeletons — and
|
|
57
|
+
* short enough that an idle open drawer stops waking the page every frame. */
|
|
58
|
+
const GROWTH_WATCH_IDLE_MS = 10_000;
|
|
59
|
+
|
|
60
|
+
/** Media events after which the thread's height can have changed. */
|
|
61
|
+
const MEDIA_SETTLE_EVENTS = ['load', 'error', 'loadedmetadata'] as const;
|
|
62
|
+
|
|
54
63
|
/*
|
|
55
64
|
* Stick-to-bottom: `use-stick-to-bottom` (stackblitz-labs)
|
|
56
65
|
*
|
|
@@ -252,6 +261,9 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
252
261
|
// because that call also re-sets the library's `isAtBottom`, a lost
|
|
253
262
|
// lock self-heals instead of being permanent.
|
|
254
263
|
const followBottomRef = useRef(false);
|
|
264
|
+
// Restarts the follow effect's scrollHeight poll; null while it is not
|
|
265
|
+
// installed.
|
|
266
|
+
const kickGrowthWatchRef = useRef<(() => void) | null>(null);
|
|
255
267
|
|
|
256
268
|
// Drives the jump-to-bottom affordance. Derived from GEOMETRY, not
|
|
257
269
|
// from the library's `isAtBottom`: that flag is the one this list
|
|
@@ -425,11 +437,7 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
425
437
|
measure();
|
|
426
438
|
};
|
|
427
439
|
|
|
428
|
-
|
|
429
|
-
ro.observe(content); // tokens, entity cards, images
|
|
430
|
-
ro.observe(scroller); // streaming loader / source chips below it
|
|
431
|
-
|
|
432
|
-
// GROWTH WATCH — the load-bearing one, because the ResizeObserver above
|
|
440
|
+
// GROWTH WATCH — the load-bearing one, because the ResizeObserver below
|
|
433
441
|
// is not reliable for this list.
|
|
434
442
|
//
|
|
435
443
|
// `content` is a SNAPSHOT taken when this effect installed, and the deps
|
|
@@ -443,20 +451,42 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
443
451
|
// A poll on `scrollHeight` sidesteps the whole question of WHICH node is
|
|
444
452
|
// live: it reads the scroller (always mounted, it owns the listeners)
|
|
445
453
|
// and reacts to growth from any source — tokens, images settling, cards
|
|
446
|
-
// resolving.
|
|
447
|
-
//
|
|
448
|
-
//
|
|
454
|
+
// resolving. It stops once the thread has not grown for
|
|
455
|
+
// GROWTH_WATCH_IDLE_MS — polled every frame forever it kept an idle open
|
|
456
|
+
// drawer rendering at 60fps (~5% of a core in WebKit) — and `kick`
|
|
457
|
+
// restarts it on everything that can grow the thread: new messages and
|
|
458
|
+
// typing-state changes (the effect below), scroll, the observer, and
|
|
459
|
+
// media inside the thread settling (an image loading or failing, a video
|
|
460
|
+
// learning its size) — that can land well after the last message, when
|
|
461
|
+
// the observer may be watching a detached node.
|
|
449
462
|
let growthRaf = 0;
|
|
450
463
|
let lastScrollHeight = scroller.scrollHeight;
|
|
451
|
-
|
|
464
|
+
let lastGrowthAt = performance.now();
|
|
465
|
+
const watchGrowth = (now: number) => {
|
|
466
|
+
const height = scroller.scrollHeight;
|
|
467
|
+
if (height !== lastScrollHeight) {
|
|
468
|
+
lastScrollHeight = height;
|
|
469
|
+
lastGrowthAt = now;
|
|
470
|
+
reassert();
|
|
471
|
+
} else if (now - lastGrowthAt > GROWTH_WATCH_IDLE_MS) {
|
|
472
|
+
growthRaf = 0;
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
452
475
|
growthRaf = requestAnimationFrame(watchGrowth);
|
|
476
|
+
};
|
|
477
|
+
const kick = () => {
|
|
478
|
+
lastGrowthAt = performance.now();
|
|
479
|
+
if (!growthRaf) growthRaf = requestAnimationFrame(watchGrowth);
|
|
480
|
+
};
|
|
481
|
+
kick();
|
|
482
|
+
kickGrowthWatchRef.current = kick;
|
|
453
483
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
lastScrollHeight = height;
|
|
484
|
+
const ro = new ResizeObserver(() => {
|
|
485
|
+
kick();
|
|
457
486
|
reassert();
|
|
458
|
-
};
|
|
459
|
-
|
|
487
|
+
});
|
|
488
|
+
ro.observe(content); // tokens, entity cards, images
|
|
489
|
+
ro.observe(scroller); // streaming loader / source chips below it
|
|
460
490
|
|
|
461
491
|
// --- user-intent disarm ---------------------------------------
|
|
462
492
|
// Only a deliberate move AWAY from the bottom releases the lock.
|
|
@@ -543,6 +573,7 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
543
573
|
rearmIfAtBottom();
|
|
544
574
|
};
|
|
545
575
|
const onScroll = () => {
|
|
576
|
+
kick();
|
|
546
577
|
const st = scroller.scrollTop;
|
|
547
578
|
if (pointerDown && st < lastScrollTop) disarm();
|
|
548
579
|
lastScrollTop = st;
|
|
@@ -578,6 +609,8 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
578
609
|
scroller.addEventListener('touchmove', onTouchMove, { passive: true });
|
|
579
610
|
window.addEventListener('pointerdown', onPointerDown, winCapture);
|
|
580
611
|
scroller.addEventListener('scroll', onScroll, { passive: true });
|
|
612
|
+
// Media events do not bubble — capture them from the elements inside.
|
|
613
|
+
for (const type of MEDIA_SETTLE_EVENTS) scroller.addEventListener(type, kick, { capture: true, passive: true });
|
|
581
614
|
window.addEventListener('pointerup', endPointer, winCapture);
|
|
582
615
|
window.addEventListener('pointercancel', endPointer, winCapture);
|
|
583
616
|
// Bubble phase, NOT capture — see the note above.
|
|
@@ -586,6 +619,7 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
586
619
|
return () => {
|
|
587
620
|
ro.disconnect();
|
|
588
621
|
cancelAnimationFrame(growthRaf);
|
|
622
|
+
kickGrowthWatchRef.current = null;
|
|
589
623
|
scroller.removeEventListener('wheel', onWheel);
|
|
590
624
|
scroller.removeEventListener('keydown', onKeyDown);
|
|
591
625
|
scroller.removeEventListener('touchstart', onTouchStart);
|
|
@@ -593,6 +627,7 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
593
627
|
// `capture` must match the add call or the listener is not removed.
|
|
594
628
|
window.removeEventListener('pointerdown', onPointerDown, { capture: true });
|
|
595
629
|
scroller.removeEventListener('scroll', onScroll);
|
|
630
|
+
for (const type of MEDIA_SETTLE_EVENTS) scroller.removeEventListener(type, kick, { capture: true });
|
|
596
631
|
window.removeEventListener('pointerup', endPointer, { capture: true });
|
|
597
632
|
window.removeEventListener('pointercancel', endPointer, { capture: true });
|
|
598
633
|
// Added WITHOUT capture — the remove must match.
|
|
@@ -611,6 +646,12 @@ const ChatMessageList = forwardRef<HTMLDivElement, ChatMessageListProps>(
|
|
|
611
646
|
// observing and listening on DETACHED nodes.
|
|
612
647
|
}, [autoScroll, scrollRef, contentRef, scrollToBottom, stopScroll, isLoading]);
|
|
613
648
|
|
|
649
|
+
// Restart the growth watch (see GROWTH WATCH above) whenever the thread
|
|
650
|
+
// can be about to grow; it stops itself again once growth settles.
|
|
651
|
+
useEffect(() => {
|
|
652
|
+
kickGrowthWatchRef.current?.();
|
|
653
|
+
}, [messages, isTyping]);
|
|
654
|
+
|
|
614
655
|
// ---- Passive-demo hard pin (pinBottom) ---------------------------
|
|
615
656
|
// Scripted in-page replays (the Fae/Mingo demos) have no human at the
|
|
616
657
|
// keyboard, so the newest streamed content must ALWAYS sit at the
|
|
@@ -16,44 +16,33 @@ const ChatTypingIndicator = forwardRef<HTMLDivElement, ChatTypingIndicatorProps>
|
|
|
16
16
|
lg: 'h-8',
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const dotAnimation = `
|
|
20
|
-
@keyframes dotPulse {
|
|
21
|
-
0%, 80%, 100% {
|
|
22
|
-
transform: scale(1);
|
|
23
|
-
opacity: 0.7;
|
|
24
|
-
}
|
|
25
|
-
40% {
|
|
26
|
-
transform: scale(1.5);
|
|
27
|
-
opacity: 1;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
19
|
return (
|
|
33
20
|
<div ref={ref} className={cn('flex items-center gap-2', className)} {...props}>
|
|
34
|
-
<style dangerouslySetInnerHTML={{ __html: dotAnimation }} />
|
|
35
21
|
{showText && <span className="text-ods-text-secondary text-h6">Assistant is typing</span>}
|
|
36
22
|
<div className={cn('inline-flex items-center justify-center gap-1', containerSizeClasses[size])}>
|
|
37
23
|
<div
|
|
38
|
-
className={cn(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
24
|
+
className={cn(
|
|
25
|
+
dotSizeClasses[size],
|
|
26
|
+
'animate-dot-pulse rounded-full',
|
|
27
|
+
dotClassName || 'bg-ods-text-primary',
|
|
28
|
+
)}
|
|
29
|
+
style={{ animationDelay: '0ms' }}
|
|
43
30
|
/>
|
|
44
31
|
<div
|
|
45
|
-
className={cn(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
32
|
+
className={cn(
|
|
33
|
+
dotSizeClasses[size],
|
|
34
|
+
'animate-dot-pulse rounded-full',
|
|
35
|
+
dotClassName || 'bg-ods-text-primary',
|
|
36
|
+
)}
|
|
37
|
+
style={{ animationDelay: '200ms' }}
|
|
50
38
|
/>
|
|
51
39
|
<div
|
|
52
|
-
className={cn(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
40
|
+
className={cn(
|
|
41
|
+
dotSizeClasses[size],
|
|
42
|
+
'animate-dot-pulse rounded-full',
|
|
43
|
+
dotClassName || 'bg-ods-text-primary',
|
|
44
|
+
)}
|
|
45
|
+
style={{ animationDelay: '400ms' }}
|
|
57
46
|
/>
|
|
58
47
|
</div>
|
|
59
48
|
</div>
|
|
@@ -14,14 +14,6 @@ interface CyclingPhraseProps {
|
|
|
14
14
|
holdMs?: number;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// Idempotent keyframe — multiple component instances share the same
|
|
18
|
-
// CSS rule, no duplication issues.
|
|
19
|
-
const BLINK_KEYFRAMES = `
|
|
20
|
-
@keyframes cyclingCursorBlink {
|
|
21
|
-
50% { opacity: 0; }
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
17
|
/**
|
|
26
18
|
* Terminal-style cycling word: a fixed-size block cursor walks left-
|
|
27
19
|
* to-right through the word, overwriting the previous word's char at
|
|
@@ -99,21 +91,19 @@ export function CyclingPhrase({ words, className, charMs = 60, holdMs = 4500 }:
|
|
|
99
91
|
const cursorBlock = (
|
|
100
92
|
<span
|
|
101
93
|
aria-hidden
|
|
102
|
-
className="inline-block bg-current align-baseline"
|
|
94
|
+
className="inline-block animate-cursor-blink bg-current align-baseline"
|
|
103
95
|
style={{
|
|
104
96
|
width: '0.6em',
|
|
105
97
|
height: '1em',
|
|
106
98
|
verticalAlign: '-0.1em',
|
|
107
99
|
marginLeft: '1px',
|
|
108
100
|
marginRight: '1px',
|
|
109
|
-
animation: 'cyclingCursorBlink 1s steps(1) infinite',
|
|
110
101
|
}}
|
|
111
102
|
/>
|
|
112
103
|
);
|
|
113
104
|
|
|
114
105
|
return (
|
|
115
106
|
<span className={cn('relative inline-block whitespace-nowrap', className)}>
|
|
116
|
-
<style dangerouslySetInnerHTML={{ __html: BLINK_KEYFRAMES }} />
|
|
117
107
|
{/* Invisible placeholder — pins width to longest word + "..." */}
|
|
118
108
|
<span aria-hidden className="invisible">
|
|
119
109
|
{placeholder}...
|
|
@@ -1932,16 +1932,20 @@ function EmbeddableChatInner({
|
|
|
1932
1932
|
// Measured off the panel NODE (state), not a ref read once on mount. In the
|
|
1933
1933
|
// `drawer` shell the panel body does not exist until the drawer opens, so a
|
|
1934
1934
|
// mount-time ref read saw `null`, bailed, and — with `[]` deps — never ran
|
|
1935
|
-
// again:
|
|
1935
|
+
// again: the width stayed 0, `canSplit` stayed false, and EVERY drawer
|
|
1936
1936
|
// host was silently pinned to the stacked single-column list no matter how
|
|
1937
1937
|
// wide it was. Only `shell="none"` hosts (the panel is inline and present at
|
|
1938
1938
|
// mount) ever reached the split layout.
|
|
1939
|
-
|
|
1939
|
+
//
|
|
1940
|
+
// Only the split threshold is state, not the width: the observer fires on
|
|
1941
|
+
// every pixel of a drawer drag, and a width in state re-rendered this whole
|
|
1942
|
+
// component each frame for a value that changes at one width.
|
|
1943
|
+
const [canSplit, setCanSplit] = useState(false);
|
|
1940
1944
|
useEffect(() => {
|
|
1941
1945
|
if (!panelBoundary || typeof ResizeObserver === 'undefined') return undefined;
|
|
1942
1946
|
const ro = new ResizeObserver(entries => {
|
|
1943
1947
|
const w = entries[0]?.contentRect?.width;
|
|
1944
|
-
if (typeof w === 'number')
|
|
1948
|
+
if (typeof w === 'number') setCanSplit(w >= SPLIT_MIN_WIDTH);
|
|
1945
1949
|
});
|
|
1946
1950
|
ro.observe(panelBoundary);
|
|
1947
1951
|
return () => ro.disconnect();
|
|
@@ -1959,7 +1963,7 @@ function EmbeddableChatInner({
|
|
|
1959
1963
|
// a reactive (non-mount-only) effect.
|
|
1960
1964
|
const setPanelNode = useCallback((node: HTMLDivElement | null) => {
|
|
1961
1965
|
setPanelBoundary(node);
|
|
1962
|
-
if (node)
|
|
1966
|
+
if (node) setCanSplit(node.clientWidth >= SPLIT_MIN_WIDTH);
|
|
1963
1967
|
}, []);
|
|
1964
1968
|
|
|
1965
1969
|
// Rail collapse toggle (Figma ⟶| control), persisted so it survives the
|
|
@@ -2005,7 +2009,6 @@ function EmbeddableChatInner({
|
|
|
2005
2009
|
// right chat block stays put), and only falls back to the full-panel archive
|
|
2006
2010
|
// when stacked/collapsed.
|
|
2007
2011
|
const splitEligible = historyListMode;
|
|
2008
|
-
const canSplit = panelWidth >= SPLIT_MIN_WIDTH;
|
|
2009
2012
|
// Embedded previews (hero demo tabs) always use the compact single-column
|
|
2010
2013
|
// header, never the two-column split — so `previewMode` opts out of `wideMingo`.
|
|
2011
2014
|
const wideMingo = splitEligible && canSplit && !previewMode;
|
|
@@ -2286,7 +2289,7 @@ function EmbeddableChatInner({
|
|
|
2286
2289
|
// expand toggle + the chat-block header (the fill column shows
|
|
2287
2290
|
// the chat / new-chat welcome). No back chevron — chat-list
|
|
2288
2291
|
// navigation is the rail toggle. Shown whenever the panel is wide
|
|
2289
|
-
// enough to split (
|
|
2292
|
+
// enough to split (width ≥ `SPLIT_MIN_WIDTH`), NOT gated on
|
|
2290
2293
|
// the viewport `md` breakpoint — otherwise a 720–799px panel on a
|
|
2291
2294
|
// sub-`md` viewport would split the body yet drop to the mobile
|
|
2292
2295
|
// single-bar header (no rail search / collapse controls).
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type ComponentRef,
|
|
9
9
|
type KeyboardEvent,
|
|
10
10
|
type PointerEvent,
|
|
11
|
+
type RefObject,
|
|
11
12
|
createContext,
|
|
12
13
|
forwardRef,
|
|
13
14
|
useCallback,
|
|
@@ -299,7 +300,22 @@ function useContainedResizableSize({
|
|
|
299
300
|
}
|
|
300
301
|
}, [enabled, size, storageKey]);
|
|
301
302
|
|
|
302
|
-
return { size, setSize };
|
|
303
|
+
return { size, setSize, clampSize: clampToContainer };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** Ends a drawer resize drag: commits the size it reached and restores the
|
|
307
|
+
* page's cursor and text selection. No-op when no drag is in progress. */
|
|
308
|
+
function finishDrag(
|
|
309
|
+
startRef: RefObject<{ x: number; y: number; size: number } | null>,
|
|
310
|
+
dragSizeRef: RefObject<number | null>,
|
|
311
|
+
commit: (size: number) => void,
|
|
312
|
+
): void {
|
|
313
|
+
if (!startRef.current) return;
|
|
314
|
+
startRef.current = null;
|
|
315
|
+
if (dragSizeRef.current !== null) commit(dragSizeRef.current);
|
|
316
|
+
dragSizeRef.current = null;
|
|
317
|
+
document.body.style.cursor = '';
|
|
318
|
+
document.body.style.userSelect = '';
|
|
303
319
|
}
|
|
304
320
|
|
|
305
321
|
interface AppLayoutDrawerResizeHandleProps {
|
|
@@ -308,6 +324,10 @@ interface AppLayoutDrawerResizeHandleProps {
|
|
|
308
324
|
minSize: number;
|
|
309
325
|
maxSize: number;
|
|
310
326
|
onSize: (next: number) => void;
|
|
327
|
+
/** Clamp a candidate size to the min/max and the container. */
|
|
328
|
+
clampSize: (next: number) => number;
|
|
329
|
+
/** The panel the size applies to — written directly while dragging. */
|
|
330
|
+
panelRef: RefObject<HTMLDivElement | null>;
|
|
311
331
|
ariaLabel?: string;
|
|
312
332
|
}
|
|
313
333
|
|
|
@@ -317,10 +337,22 @@ function AppLayoutDrawerResizeHandle({
|
|
|
317
337
|
minSize,
|
|
318
338
|
maxSize,
|
|
319
339
|
onSize,
|
|
340
|
+
clampSize,
|
|
341
|
+
panelRef,
|
|
320
342
|
ariaLabel,
|
|
321
343
|
}: AppLayoutDrawerResizeHandleProps) {
|
|
322
344
|
const isHorizontal = HORIZONTAL_SIDES.has(side);
|
|
323
345
|
const startRef = useRef<{ x: number; y: number; size: number } | null>(null);
|
|
346
|
+
// Size reached by the drag in progress, committed to React state on release.
|
|
347
|
+
const dragSizeRef = useRef<number | null>(null);
|
|
348
|
+
const onSizeRef = useRef(onSize);
|
|
349
|
+
useEffect(() => {
|
|
350
|
+
onSizeRef.current = onSize;
|
|
351
|
+
}, [onSize]);
|
|
352
|
+
// The handle can unmount mid-drag (a persist-mode drawer closing), and then
|
|
353
|
+
// no pointer event ends the drag: end it here, or the panel keeps a width
|
|
354
|
+
// React state never received and the page keeps the resize cursor.
|
|
355
|
+
useEffect(() => () => finishDrag(startRef, dragSizeRef, onSizeRef.current), []);
|
|
324
356
|
|
|
325
357
|
const direction = side === 'right' || side === 'bottom' ? -1 : 1;
|
|
326
358
|
|
|
@@ -333,23 +365,32 @@ function AppLayoutDrawerResizeHandle({
|
|
|
333
365
|
document.body.style.userSelect = 'none';
|
|
334
366
|
};
|
|
335
367
|
|
|
368
|
+
// The drag writes the panel's size straight to the DOM and commits it to
|
|
369
|
+
// state once, on release. Committing every pointermove re-rendered the
|
|
370
|
+
// drawer per event — ~16% of a drag's CPU in WebKit on top of the reflow the
|
|
371
|
+
// resize itself costs. ResizeObserver consumers inside the panel still see
|
|
372
|
+
// every change. A re-render of the drawer mid-drag (e.g. a streamed chunk)
|
|
373
|
+
// does not undo the write: React diffs against its previous render, where
|
|
374
|
+
// the size is unchanged, so it leaves the style alone.
|
|
336
375
|
const handlePointerMove = (e: PointerEvent<HTMLDivElement>) => {
|
|
337
376
|
const start = startRef.current;
|
|
338
|
-
|
|
377
|
+
const panel = panelRef.current;
|
|
378
|
+
if (!start || !panel) return;
|
|
339
379
|
const delta = isHorizontal ? e.clientX - start.x : e.clientY - start.y;
|
|
340
|
-
|
|
380
|
+
const next = clampSize(start.size + delta * direction);
|
|
381
|
+
dragSizeRef.current = next;
|
|
382
|
+
panel.style[isHorizontal ? 'width' : 'height'] = `${next}px`;
|
|
383
|
+
e.currentTarget.setAttribute('aria-valuenow', String(Math.round(next)));
|
|
341
384
|
};
|
|
342
385
|
|
|
343
386
|
const endDrag = (e: PointerEvent<HTMLDivElement>) => {
|
|
344
387
|
if (!startRef.current) return;
|
|
345
|
-
startRef
|
|
388
|
+
finishDrag(startRef, dragSizeRef, onSize);
|
|
346
389
|
try {
|
|
347
390
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
348
391
|
} catch {
|
|
349
392
|
// ignore — pointer may already be released
|
|
350
393
|
}
|
|
351
|
-
document.body.style.cursor = '';
|
|
352
|
-
document.body.style.userSelect = '';
|
|
353
394
|
};
|
|
354
395
|
|
|
355
396
|
const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
@@ -405,6 +446,7 @@ function AppLayoutDrawerResizeHandle({
|
|
|
405
446
|
onPointerMove={handlePointerMove}
|
|
406
447
|
onPointerUp={endDrag}
|
|
407
448
|
onPointerCancel={endDrag}
|
|
449
|
+
onLostPointerCapture={endDrag}
|
|
408
450
|
onKeyDown={handleKeyDown}
|
|
409
451
|
className={cn(
|
|
410
452
|
'group absolute z-20 flex touch-none select-none',
|
|
@@ -585,7 +627,8 @@ const AppLayoutDrawerContent = forwardRef<ComponentRef<typeof DialogPrimitive.Co
|
|
|
585
627
|
return () => mq.removeEventListener('change', update);
|
|
586
628
|
}, [mobileBreakpoint]);
|
|
587
629
|
|
|
588
|
-
const
|
|
630
|
+
const panelRef = useRef<HTMLDivElement>(null);
|
|
631
|
+
const { size, setSize, clampSize } = useContainedResizableSize({
|
|
589
632
|
enabled: resizable,
|
|
590
633
|
isHorizontal,
|
|
591
634
|
minSize,
|
|
@@ -670,10 +713,13 @@ const AppLayoutDrawerContent = forwardRef<ComponentRef<typeof DialogPrimitive.Co
|
|
|
670
713
|
minSize={minSize}
|
|
671
714
|
maxSize={maxSize}
|
|
672
715
|
onSize={setSize}
|
|
716
|
+
clampSize={clampSize}
|
|
717
|
+
panelRef={panelRef}
|
|
673
718
|
ariaLabel={resizeAriaLabel}
|
|
674
719
|
/>
|
|
675
720
|
) : null}
|
|
676
721
|
<div
|
|
722
|
+
ref={panelRef}
|
|
677
723
|
className={cn(
|
|
678
724
|
appLayoutDrawerPanelVariants({ side, flush }),
|
|
679
725
|
// Mobile: fill the container (the side already pins one axis) and
|