@flamingo-stack/openframe-frontend-core 0.0.454 → 0.0.455-snapshot.20260719161719
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-UGFB5EAW.js → chunk-2I3GN7WW.js} +4 -4
- package/dist/{chunk-44AD5D3C.cjs → chunk-6K6LAD6H.cjs} +18 -18
- package/dist/{chunk-44AD5D3C.cjs.map → chunk-6K6LAD6H.cjs.map} +1 -1
- package/dist/{chunk-UPRY4I63.cjs → chunk-6TI3DCOG.cjs} +3 -3
- package/dist/{chunk-UPRY4I63.cjs.map → chunk-6TI3DCOG.cjs.map} +1 -1
- package/dist/{chunk-YAZIVPUF.cjs → chunk-A7FTNFBX.cjs} +73 -73
- package/dist/{chunk-YAZIVPUF.cjs.map → chunk-A7FTNFBX.cjs.map} +1 -1
- package/dist/{chunk-YJ7SPS7I.js → chunk-DAEKUR3J.js} +2 -2
- package/dist/{chunk-PT233TJV.js → chunk-DU6R7XNU.js} +2 -2
- package/dist/{chunk-OZZ4VQ52.cjs → chunk-DYBATZJP.cjs} +5 -5
- package/dist/{chunk-OZZ4VQ52.cjs.map → chunk-DYBATZJP.cjs.map} +1 -1
- package/dist/{chunk-PB24PKG2.cjs → chunk-F2CCUPKC.cjs} +29 -29
- package/dist/{chunk-PB24PKG2.cjs.map → chunk-F2CCUPKC.cjs.map} +1 -1
- package/dist/{chunk-OGKDOG5D.js → chunk-F3IBBAKV.js} +2 -2
- package/dist/{chunk-IM5A5F2E.cjs → chunk-GC63K4VD.cjs} +73 -73
- package/dist/{chunk-IM5A5F2E.cjs.map → chunk-GC63K4VD.cjs.map} +1 -1
- package/dist/{chunk-N2UFIQAD.cjs → chunk-GQZGCMRF.cjs} +7 -7
- package/dist/{chunk-N2UFIQAD.cjs.map → chunk-GQZGCMRF.cjs.map} +1 -1
- package/dist/{chunk-EQWE64RJ.js → chunk-ILUX3DXS.js} +2 -2
- package/dist/{chunk-NUT3HRKS.cjs → chunk-INH6SIP5.cjs} +12 -12
- package/dist/{chunk-NUT3HRKS.cjs.map → chunk-INH6SIP5.cjs.map} +1 -1
- package/dist/{chunk-QF3NQW7C.cjs → chunk-IOHQJOLR.cjs} +35 -81
- package/dist/chunk-IOHQJOLR.cjs.map +1 -0
- package/dist/{chunk-TMST2WFZ.js → chunk-JHIT44TA.js} +3 -3
- package/dist/{chunk-ACUD4XVZ.cjs → chunk-KH5VTGCS.cjs} +40 -40
- package/dist/{chunk-ACUD4XVZ.cjs.map → chunk-KH5VTGCS.cjs.map} +1 -1
- package/dist/{chunk-MX2ITMKK.js → chunk-LAFCXJVT.js} +5 -5
- package/dist/{chunk-55ISAJFV.js → chunk-LMBPJAQ2.js} +6 -6
- package/dist/{chunk-MLFFBQ5B.js → chunk-MK2YWJAA.js} +98 -144
- package/dist/chunk-MK2YWJAA.js.map +1 -0
- package/dist/{chunk-5HQV2F5K.cjs → chunk-TXS2AMFV.cjs} +32 -32
- package/dist/{chunk-5HQV2F5K.cjs.map → chunk-TXS2AMFV.cjs.map} +1 -1
- package/dist/{chunk-GOWE4WSU.js → chunk-U27TXTAK.js} +6 -6
- package/dist/{chunk-UOTHXOCS.js → chunk-UEKCD6WV.js} +5539 -5559
- package/dist/chunk-UEKCD6WV.js.map +1 -0
- package/dist/{chunk-XH33VG5A.cjs → chunk-UHVVNVUE.cjs} +40 -40
- package/dist/{chunk-XH33VG5A.cjs.map → chunk-UHVVNVUE.cjs.map} +1 -1
- package/dist/{chunk-AJAF456I.js → chunk-UXKSOJR7.js} +3 -3
- package/dist/{chunk-WLUIXASU.cjs → chunk-VZNJ3RYI.cjs} +15 -15
- package/dist/{chunk-WLUIXASU.cjs.map → chunk-VZNJ3RYI.cjs.map} +1 -1
- package/dist/{chunk-YED55PQY.js → chunk-YLTY4Z4B.js} +3 -3
- package/dist/{chunk-72VDY6MM.cjs → chunk-YMGOTPY7.cjs} +1431 -1451
- package/dist/chunk-YMGOTPY7.cjs.map +1 -0
- package/dist/{chunk-JUNKHNWE.js → chunk-ZQHGSR3H.js} +5 -5
- package/dist/components/case-studies/index.cjs +9 -9
- package/dist/components/case-studies/index.js +3 -3
- package/dist/components/chat/chat-message-list.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/guide-welcome.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +3 -9
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.d.ts +0 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +2 -8
- package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
- package/dist/components/chat/quick-action-chip.d.ts +48 -0
- package/dist/components/chat/quick-action-chip.d.ts.map +1 -1
- package/dist/components/chat/quick-action-marquee.d.ts.map +1 -1
- package/dist/components/chat/quick-action-wall.d.ts +6 -3
- package/dist/components/chat/quick-action-wall.d.ts.map +1 -1
- package/dist/components/chat/types/component.types.d.ts +17 -12
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/contact/index.js +3 -3
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/docs/index.js +5 -5
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/index.js +3 -3
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/cards-strip.d.ts.map +1 -1
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/index.js +2 -2
- package/dist/components/help-center-pages/index.cjs +22 -22
- package/dist/components/help-center-pages/index.js +13 -13
- package/dist/components/index.cjs +135 -141
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +11 -17
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +3 -3
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +5 -5
- package/dist/components/related-content/index.js +4 -4
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +3 -9
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +2 -8
- package/dist/components/ui/marquee-wall.d.ts +8 -1
- package/dist/components/ui/marquee-wall.d.ts.map +1 -1
- package/dist/hooks/index.cjs +2 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/ui/index.d.ts +1 -0
- package/dist/hooks/ui/index.d.ts.map +1 -1
- package/dist/hooks/ui/use-reset-on-page-hidden.d.ts +19 -0
- package/dist/hooks/ui/use-reset-on-page-hidden.d.ts.map +1 -0
- package/dist/hooks/use-near-viewport.d.ts +3 -1
- package/dist/hooks/use-near-viewport.d.ts.map +1 -1
- package/dist/index.cjs +3 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -10
- package/package.json +1 -1
- package/src/components/chat/approval-request-message.tsx +1 -1
- package/src/components/chat/chat-context-picker.tsx +1 -1
- package/src/components/chat/chat-input.tsx +1 -1
- package/src/components/chat/chat-message-list.tsx +47 -0
- package/src/components/chat/chat-message-skeleton.tsx +1 -1
- package/src/components/chat/chat-sidebar-skeleton.tsx +1 -1
- package/src/components/chat/chat-sidebar.tsx +2 -2
- package/src/components/chat/chat-ticket-list.tsx +1 -1
- package/src/components/chat/context-items-list.tsx +1 -1
- package/src/components/chat/embeddable-chat.tsx +46 -6
- package/src/components/chat/guide-welcome.tsx +24 -14
- package/src/components/chat/index.ts +0 -2
- package/src/components/chat/mingo-chat-history.tsx +1 -1
- package/src/components/chat/mingo-welcome.tsx +42 -27
- package/src/components/chat/quick-action-chip.tsx +77 -0
- package/src/components/chat/quick-action-marquee.tsx +1 -2
- package/src/components/chat/quick-action-wall.tsx +13 -4
- package/src/components/chat/slash-command-suggestions.tsx +1 -1
- package/src/components/chat/tool-call-blocks.tsx +1 -1
- package/src/components/chat/types/component.types.ts +17 -15
- package/src/components/features/cards-strip.tsx +16 -0
- package/src/components/ui/marquee-wall.tsx +160 -10
- package/src/hooks/.index.md +0 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/ui/index.ts +1 -0
- package/src/hooks/ui/use-reset-on-page-hidden.ts +32 -0
- package/src/hooks/use-near-viewport.ts +36 -12
- package/src/stories/ChatContainer.stories.tsx +15 -12
- package/src/stories/QuickActionWall.stories.tsx +1 -2
- package/dist/chunk-72VDY6MM.cjs.map +0 -1
- package/dist/chunk-MLFFBQ5B.js.map +0 -1
- package/dist/chunk-QF3NQW7C.cjs.map +0 -1
- package/dist/chunk-UOTHXOCS.js.map +0 -1
- package/dist/components/chat/chat-quick-action-row.d.ts +0 -84
- package/dist/components/chat/chat-quick-action-row.d.ts.map +0 -1
- package/dist/components/chat/chat-quick-action.d.ts +0 -11
- package/dist/components/chat/chat-quick-action.d.ts.map +0 -1
- package/dist/hooks/use-quick-action-hint.d.ts +0 -25
- package/dist/hooks/use-quick-action-hint.d.ts.map +0 -1
- package/src/components/chat/.chat-quick-action.md +0 -46
- package/src/components/chat/chat-quick-action-row.tsx +0 -282
- package/src/components/chat/chat-quick-action.tsx +0 -59
- package/src/hooks/.use-quick-action-hint.md +0 -43
- package/src/hooks/use-quick-action-hint.ts +0 -126
- /package/dist/{chunk-UGFB5EAW.js.map → chunk-2I3GN7WW.js.map} +0 -0
- /package/dist/{chunk-YJ7SPS7I.js.map → chunk-DAEKUR3J.js.map} +0 -0
- /package/dist/{chunk-PT233TJV.js.map → chunk-DU6R7XNU.js.map} +0 -0
- /package/dist/{chunk-OGKDOG5D.js.map → chunk-F3IBBAKV.js.map} +0 -0
- /package/dist/{chunk-EQWE64RJ.js.map → chunk-ILUX3DXS.js.map} +0 -0
- /package/dist/{chunk-TMST2WFZ.js.map → chunk-JHIT44TA.js.map} +0 -0
- /package/dist/{chunk-MX2ITMKK.js.map → chunk-LAFCXJVT.js.map} +0 -0
- /package/dist/{chunk-55ISAJFV.js.map → chunk-LMBPJAQ2.js.map} +0 -0
- /package/dist/{chunk-GOWE4WSU.js.map → chunk-U27TXTAK.js.map} +0 -0
- /package/dist/{chunk-AJAF456I.js.map → chunk-UXKSOJR7.js.map} +0 -0
- /package/dist/{chunk-YED55PQY.js.map → chunk-YLTY4Z4B.js.map} +0 -0
- /package/dist/{chunk-JUNKHNWE.js.map → chunk-ZQHGSR3H.js.map} +0 -0
|
@@ -4,6 +4,7 @@ import * as React from 'react'
|
|
|
4
4
|
import { cn } from '../../utils/cn'
|
|
5
5
|
import { useMarqueeEngine } from '../../hooks/ui/use-marquee-engine'
|
|
6
6
|
import { useMediaQuery } from '../../hooks/ui/use-media-query'
|
|
7
|
+
import { useResetOnPageHidden } from '../../hooks/ui/use-reset-on-page-hidden'
|
|
7
8
|
import { useSuppressCloneFocus } from '../../hooks/ui/use-suppress-clone-focus'
|
|
8
9
|
import { NEAR_VIEWPORT_ROOT_MARGIN } from '../../hooks/use-near-viewport'
|
|
9
10
|
|
|
@@ -153,6 +154,13 @@ export interface MarqueeWallProps {
|
|
|
153
154
|
* must never move under a pointing cursor (required for interactive chip
|
|
154
155
|
* walls). Default true. */
|
|
155
156
|
pauseOnHover?: boolean
|
|
157
|
+
/** Opt-in MANUAL scroll: pointer-drag + horizontal wheel move the wall along
|
|
158
|
+
* its axis (transform-based — no inner scroller is created, so it stays
|
|
159
|
+
* deck-safe). The auto-marquee pauses during the interaction and briefly
|
|
160
|
+
* after, then resumes drifting from wherever the user left it. Off by
|
|
161
|
+
* default (decorative walls stay auto-only); enabled on the embeddable-chat
|
|
162
|
+
* quick-action walls so users can browse the actions by hand. */
|
|
163
|
+
dragScroll?: boolean
|
|
156
164
|
/** Edge fade(s) — the "there's more" affordance. ONE spelling of the
|
|
157
165
|
* clip-and-fade across every wall surface. */
|
|
158
166
|
fade?: MarqueeWallFadeEdge | ReadonlyArray<MarqueeWallFadeEdge>
|
|
@@ -295,6 +303,7 @@ export function MarqueeWall({
|
|
|
295
303
|
speed = 40,
|
|
296
304
|
animate = true,
|
|
297
305
|
pauseOnHover = true,
|
|
306
|
+
dragScroll = false,
|
|
298
307
|
fade,
|
|
299
308
|
fadeColor = 'var(--color-bg)',
|
|
300
309
|
fadeSize,
|
|
@@ -386,6 +395,9 @@ export function MarqueeWall({
|
|
|
386
395
|
|
|
387
396
|
// ---- pause-reason set ------------------------------------------------------
|
|
388
397
|
const pointerInsideRef = React.useRef(false)
|
|
398
|
+
const clearPointerInside = React.useCallback(() => {
|
|
399
|
+
pointerInsideRef.current = false
|
|
400
|
+
}, [])
|
|
389
401
|
const onPointerEnter = React.useCallback((e: React.PointerEvent) => {
|
|
390
402
|
if (e.pointerType === 'touch') return
|
|
391
403
|
pointerInsideRef.current = true
|
|
@@ -394,6 +406,21 @@ export function MarqueeWall({
|
|
|
394
406
|
if (e.pointerType === 'touch') return
|
|
395
407
|
pointerInsideRef.current = false
|
|
396
408
|
}, [])
|
|
409
|
+
// Stale-flag self-heal (shared SSOT): if a `pointerleave` is MISSED (tab blur,
|
|
410
|
+
// overlay under the cursor, interrupted pointer), `inside` stays stuck true and
|
|
411
|
+
// the wall freezes forever — so un-stick it whenever the tab hides / the window
|
|
412
|
+
// loses focus. The next real pointer/enter re-arms it.
|
|
413
|
+
useResetOnPageHidden(clearPointerInside)
|
|
414
|
+
|
|
415
|
+
// ---- manual drag / wheel scroll (opt-in via `dragScroll`) ------------------
|
|
416
|
+
// Transform-based (no inner scroller → deck-safe): drag/wheel move the
|
|
417
|
+
// engine's float position directly; `draggingRef` + a short suppress window
|
|
418
|
+
// pause the auto-marquee during and just after the interaction so it resumes
|
|
419
|
+
// drifting from where the user left it. Refs declared here (before the engine)
|
|
420
|
+
// so `isPaused` can read them; the handlers (which need the engine's `wrap`)
|
|
421
|
+
// are defined after the engine call.
|
|
422
|
+
const draggingRef = React.useRef(false)
|
|
423
|
+
const dragSuppressUntilRef = React.useRef(0)
|
|
397
424
|
|
|
398
425
|
// ---- transform driver ------------------------------------------------------
|
|
399
426
|
const applyTransform = React.useCallback(
|
|
@@ -414,6 +441,26 @@ export function MarqueeWall({
|
|
|
414
441
|
},
|
|
415
442
|
[axis, reverse, trackId],
|
|
416
443
|
)
|
|
444
|
+
// Sync-aware position writer — THE single entry point for every position
|
|
445
|
+
// update (the engine's rAF apply AND the manual drag/wheel handlers). With a
|
|
446
|
+
// `sync` controller it publishes to the shared position and drives every peer
|
|
447
|
+
// wall's transform; without one it just writes our own. Routing drag/wheel
|
|
448
|
+
// through here (instead of raw `applyTransform`) keeps a wall that is both
|
|
449
|
+
// `sync`-ed and `dragScroll`-ed in lockstep with its peers — a direct
|
|
450
|
+
// `applyTransform` would move only this wall and leave `sync.position` + peers
|
|
451
|
+
// stale. Members' own `apply` stays the raw `applyTransform` (no re-publish),
|
|
452
|
+
// so the `forEach` fan-out can't recurse.
|
|
453
|
+
const applyPos = React.useCallback(
|
|
454
|
+
(pos: number) => {
|
|
455
|
+
if (sync) {
|
|
456
|
+
sync.position = pos
|
|
457
|
+
sync.members.forEach(m => m.apply(pos))
|
|
458
|
+
} else {
|
|
459
|
+
applyTransform(pos)
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
[sync, applyTransform],
|
|
463
|
+
)
|
|
417
464
|
// Clear any residual offset only when the marquee turns off STRUCTURALLY
|
|
418
465
|
// (content shrank so it fits, reduced-motion flipped) — the static wall must
|
|
419
466
|
// sit at its natural origin. A mere run-gate pause (`animate` false) does NOT
|
|
@@ -457,18 +504,16 @@ export function MarqueeWall({
|
|
|
457
504
|
}
|
|
458
505
|
}, [sync, applyTransform])
|
|
459
506
|
|
|
460
|
-
const { posRef } = useMarqueeEngine({
|
|
507
|
+
const { posRef, wrap } = useMarqueeEngine({
|
|
461
508
|
active: marqueeActive && nearViewport && isDriver,
|
|
462
509
|
speed,
|
|
463
|
-
isPaused:
|
|
464
|
-
(pauseOnHover && pointerInsideRef.current) ||
|
|
510
|
+
isPaused: now =>
|
|
511
|
+
(pauseOnHover && pointerInsideRef.current) ||
|
|
512
|
+
draggingRef.current ||
|
|
513
|
+
now < dragSuppressUntilRef.current ||
|
|
514
|
+
document.visibilityState === 'hidden',
|
|
465
515
|
getWrapSize: () => wrapSizeRef.current,
|
|
466
|
-
apply:
|
|
467
|
-
? pos => {
|
|
468
|
-
sync.position = pos
|
|
469
|
-
sync.members.forEach(m => m.apply(pos))
|
|
470
|
-
}
|
|
471
|
-
: applyTransform,
|
|
516
|
+
apply: applyPos,
|
|
472
517
|
// Synced pairs: a re-elected driver resumes from the pair's live position
|
|
473
518
|
// (engine seeds from readBack on activation) instead of restarting at 0.
|
|
474
519
|
readBack: sync ? () => sync.position : undefined,
|
|
@@ -490,17 +535,122 @@ export function MarqueeWall({
|
|
|
490
535
|
}
|
|
491
536
|
}, [marqueeMounted, reverse, posRef])
|
|
492
537
|
|
|
538
|
+
// ---- manual drag / wheel handlers (only wired when `dragScroll`) -----------
|
|
539
|
+
const DRAG_RESUME_MS = 1200
|
|
540
|
+
const dragStartRef = React.useRef({ coord: 0, pos: 0 })
|
|
541
|
+
const dragMovedRef = React.useRef(false)
|
|
542
|
+
const suppressClickRef = React.useRef(false)
|
|
543
|
+
|
|
544
|
+
const onDragPointerDown = React.useCallback((e: React.PointerEvent) => {
|
|
545
|
+
if (!marqueeMounted) return
|
|
546
|
+
draggingRef.current = true
|
|
547
|
+
dragMovedRef.current = false
|
|
548
|
+
// Clear any click-suppress left armed by a prior drag that ended WITHOUT a
|
|
549
|
+
// synthetic click on this container (pointercancel, or the pointer released
|
|
550
|
+
// off the wall) — otherwise `onDragClickCapture` would swallow this fresh
|
|
551
|
+
// tap's action. A new press is unambiguously a new intent.
|
|
552
|
+
suppressClickRef.current = false
|
|
553
|
+
dragStartRef.current = { coord: axis === 'y' ? e.clientY : e.clientX, pos: posRef.current }
|
|
554
|
+
try { containerRef.current?.setPointerCapture(e.pointerId) } catch { /* capture is best-effort */ }
|
|
555
|
+
}, [marqueeMounted, axis, posRef])
|
|
556
|
+
|
|
557
|
+
const onDragPointerMove = React.useCallback((e: React.PointerEvent) => {
|
|
558
|
+
if (!draggingRef.current) return
|
|
559
|
+
const delta = (axis === 'y' ? e.clientY : e.clientX) - dragStartRef.current.coord
|
|
560
|
+
if (Math.abs(delta) > 3) dragMovedRef.current = true
|
|
561
|
+
// Track follows the pointer. `applyPos` maps pos→translate as `-pos`
|
|
562
|
+
// (forward) / `pos-wrap` (reverse), so a rightward/downward drag (delta > 0)
|
|
563
|
+
// must DECREASE pos on a forward wall and INCREASE it on a reverse one.
|
|
564
|
+
// Via `applyPos` (not raw `applyTransform`) so synced peer walls follow.
|
|
565
|
+
posRef.current = wrap(dragStartRef.current.pos + (reverse ? delta : -delta))
|
|
566
|
+
applyPos(posRef.current)
|
|
567
|
+
dragSuppressUntilRef.current = performance.now() + DRAG_RESUME_MS
|
|
568
|
+
}, [axis, reverse, wrap, posRef, applyPos])
|
|
569
|
+
|
|
570
|
+
const onDragPointerUp = React.useCallback((e: React.PointerEvent) => {
|
|
571
|
+
if (!draggingRef.current) return
|
|
572
|
+
draggingRef.current = false
|
|
573
|
+
// A real drag ends over a chip → swallow the synthetic click so the drag
|
|
574
|
+
// doesn't fire the chip's action.
|
|
575
|
+
if (dragMovedRef.current) suppressClickRef.current = true
|
|
576
|
+
dragSuppressUntilRef.current = performance.now() + DRAG_RESUME_MS
|
|
577
|
+
try { containerRef.current?.releasePointerCapture(e.pointerId) } catch { /* best-effort */ }
|
|
578
|
+
}, [])
|
|
579
|
+
|
|
580
|
+
const onDragClickCapture = React.useCallback((e: React.MouseEvent) => {
|
|
581
|
+
if (suppressClickRef.current) {
|
|
582
|
+
suppressClickRef.current = false
|
|
583
|
+
e.preventDefault()
|
|
584
|
+
e.stopPropagation()
|
|
585
|
+
}
|
|
586
|
+
}, [])
|
|
587
|
+
|
|
588
|
+
// Along-axis wheel → move the wall. Wired as a NATIVE non-passive listener
|
|
589
|
+
// (not React's `onWheel`, which React attaches passively so `preventDefault`
|
|
590
|
+
// is a no-op): once WE consume an along-axis wheel we must `preventDefault` to
|
|
591
|
+
// suppress the browser's horizontal history-swipe (two-finger trackpad) on an
|
|
592
|
+
// x-wall. An x-wall ignores vertical page-scroll wheels (and vice-versa) so the
|
|
593
|
+
// surrounding page still scrolls normally.
|
|
594
|
+
React.useEffect(() => {
|
|
595
|
+
const el = containerRef.current
|
|
596
|
+
if (!el || !dragScroll || !marqueeMounted) return
|
|
597
|
+
const onWheel = (e: WheelEvent) => {
|
|
598
|
+
// Only claim the DOMINANT-axis wheel (per axis), so a cross-axis wheel
|
|
599
|
+
// still scrolls the page: an x-wall ignores vertical wheels, a y-wall
|
|
600
|
+
// ignores horizontal ones.
|
|
601
|
+
const primary =
|
|
602
|
+
axis === 'y'
|
|
603
|
+
? Math.abs(e.deltaY) >= Math.abs(e.deltaX)
|
|
604
|
+
? e.deltaY
|
|
605
|
+
: 0
|
|
606
|
+
: Math.abs(e.deltaX) >= Math.abs(e.deltaY)
|
|
607
|
+
? e.deltaX
|
|
608
|
+
: 0
|
|
609
|
+
if (primary === 0) return
|
|
610
|
+
e.preventDefault()
|
|
611
|
+
// Via `applyPos` (not raw `applyTransform`) so synced peer walls follow.
|
|
612
|
+
posRef.current = wrap(posRef.current + (reverse ? -primary : primary))
|
|
613
|
+
applyPos(posRef.current)
|
|
614
|
+
dragSuppressUntilRef.current = performance.now() + DRAG_RESUME_MS
|
|
615
|
+
}
|
|
616
|
+
el.addEventListener('wheel', onWheel, { passive: false })
|
|
617
|
+
return () => el.removeEventListener('wheel', onWheel)
|
|
618
|
+
}, [dragScroll, marqueeMounted, axis, reverse, wrap, posRef, applyPos])
|
|
619
|
+
|
|
493
620
|
// ---- render ----------------------------------------------------------------
|
|
494
621
|
const renderContent = (isClone: boolean) =>
|
|
495
622
|
typeof children === 'function' ? children({ isClone }) : children
|
|
496
623
|
|
|
624
|
+
// Reduced-motion static fallback: when the marquee does NOT mount (chiefly
|
|
625
|
+
// prefers-reduced-motion) but the content OVERFLOWS, the drag/transform path
|
|
626
|
+
// is inert — so on a `dragScroll` wall fall back to NATIVE
|
|
627
|
+
// overflow scroll along the axis. Otherwise the overflowing chips would be
|
|
628
|
+
// clipped by `overflow-hidden` with no way to reach them (a11y regression vs
|
|
629
|
+
// the old wrapping row). The visible thin scrollbar (global `*` rule) is the
|
|
630
|
+
// right affordance for reduced-motion users. No engine needed — the browser
|
|
631
|
+
// scrolls the single static track.
|
|
632
|
+
const staticScrollable = dragScroll && overflows && !marqueeMounted
|
|
633
|
+
|
|
497
634
|
return (
|
|
498
635
|
<div
|
|
499
636
|
ref={containerRef}
|
|
500
|
-
className={cn(
|
|
637
|
+
className={cn(
|
|
638
|
+
'relative',
|
|
639
|
+
staticScrollable ? (axis === 'y' ? 'overflow-y-auto' : 'overflow-x-auto') : 'overflow-hidden',
|
|
640
|
+
dragScroll && marqueeMounted && 'cursor-grab active:cursor-grabbing select-none',
|
|
641
|
+
className,
|
|
642
|
+
)}
|
|
643
|
+
// x-walls let vertical page-scroll pass (`pan-y`) and own horizontal
|
|
644
|
+
// drags; y-walls the reverse. Only when drag is actually live.
|
|
645
|
+
style={dragScroll && marqueeMounted ? { touchAction: axis === 'y' ? 'pan-x' : 'pan-y' } : undefined}
|
|
501
646
|
data-marquee-track={trackId}
|
|
502
647
|
onPointerEnter={onPointerEnter}
|
|
503
648
|
onPointerLeave={onPointerLeave}
|
|
649
|
+
onPointerDown={dragScroll ? onDragPointerDown : undefined}
|
|
650
|
+
onPointerMove={dragScroll ? onDragPointerMove : undefined}
|
|
651
|
+
onPointerUp={dragScroll ? onDragPointerUp : undefined}
|
|
652
|
+
onPointerCancel={dragScroll ? onDragPointerUp : undefined}
|
|
653
|
+
onClickCapture={dragScroll ? onDragClickCapture : undefined}
|
|
504
654
|
>
|
|
505
655
|
<div
|
|
506
656
|
ref={trackRef}
|
package/src/hooks/.index.md
CHANGED
|
@@ -9,7 +9,6 @@ Central barrel export file for the hooks package, re-exporting all custom React
|
|
|
9
9
|
| `./platform` | Platform-specific hooks |
|
|
10
10
|
| `./use-toast` | Toast notification hook |
|
|
11
11
|
| `./use-contact-submission` | Contact form submission hook |
|
|
12
|
-
| `./use-quick-action-hint` | Quick action hint display hook |
|
|
13
12
|
| `./use-copy-to-clipboard` | Clipboard write hook |
|
|
14
13
|
| `./use-batch-images` | Authenticated batch image loading |
|
|
15
14
|
| `./use-authenticated-image` | Single authenticated image hook |
|
package/src/hooks/index.ts
CHANGED
package/src/hooks/ui/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './use-media-query'
|
|
|
12
12
|
export * from './use-memoized-callback'
|
|
13
13
|
export * from './use-notification-permission'
|
|
14
14
|
export * from './use-onboarding-state'
|
|
15
|
+
export * from './use-reset-on-page-hidden'
|
|
15
16
|
export * from './use-search'
|
|
16
17
|
export * from './use-suppress-clone-focus'
|
|
17
18
|
export * from './use-table-pagination'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runs `reset` whenever the tab is hidden or the window loses focus — exactly the
|
|
5
|
+
* moments a `pointerleave` / `pointercancel` can be SWALLOWED (tab blur, an
|
|
6
|
+
* overlay mounting under the cursor, an interrupted pointer), which otherwise
|
|
7
|
+
* leaves a hover/"inside" flag stuck `true` and freezes a marquee FOREVER. The
|
|
8
|
+
* next real pointer/hover re-arms the flag.
|
|
9
|
+
*
|
|
10
|
+
* SSOT self-heal for every marquee surface (MarqueeWall, CardsStrip) so the
|
|
11
|
+
* blur + `visibilitychange` wiring lives in one place. `reset` almost always
|
|
12
|
+
* only UN-sticks state. The one edge: on `blur` WITHOUT the tab hiding (a second
|
|
13
|
+
* window focused beside this one), clearing the hover-pause can let the marquee
|
|
14
|
+
* resume under a still-stationary cursor in the now-unfocused window — it
|
|
15
|
+
* re-pauses on the next `pointermove`/`pointerenter`. We keep the `blur` reset
|
|
16
|
+
* anyway because it's the only signal that catches a tab-blur that swallows the
|
|
17
|
+
* `pointerleave` without a `visibilitychange`. Pass a STABLE `reset` (memoize
|
|
18
|
+
* with `useCallback`) — the listeners re-attach whenever its identity changes.
|
|
19
|
+
*/
|
|
20
|
+
export function useResetOnPageHidden(reset: () => void): void {
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const onVisibility = () => {
|
|
23
|
+
if (document.visibilityState === 'hidden') reset()
|
|
24
|
+
}
|
|
25
|
+
window.addEventListener('blur', reset)
|
|
26
|
+
document.addEventListener('visibilitychange', onVisibility)
|
|
27
|
+
return () => {
|
|
28
|
+
window.removeEventListener('blur', reset)
|
|
29
|
+
document.removeEventListener('visibilitychange', onVisibility)
|
|
30
|
+
}
|
|
31
|
+
}, [reset])
|
|
32
|
+
}
|
|
@@ -29,19 +29,39 @@
|
|
|
29
29
|
|
|
30
30
|
import { useEffect, useRef, useState, useCallback } from 'react';
|
|
31
31
|
|
|
32
|
-
// Per-rootMargin IO map. Multiple call sites with different
|
|
33
|
-
// get their own singleton observer.
|
|
32
|
+
// Per-(rootMargin, threshold) IO map. Multiple call sites with different
|
|
33
|
+
// margins/thresholds each get their own singleton observer.
|
|
34
34
|
const observers = new Map<string, IntersectionObserver>();
|
|
35
35
|
const subscribers = new WeakMap<Element, () => void>();
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// Slack for the explicit ratio check: an element sized to exactly meet the
|
|
38
|
+
// threshold can report a ratio a hair under it (sub-pixel / float rounding), so
|
|
39
|
+
// accept `ratio >= threshold - EPSILON`. With `threshold: 0` this is a no-op
|
|
40
|
+
// (ratio is always ≥ 0 > -EPSILON) — the `isIntersecting` check alone gates.
|
|
41
|
+
const THRESHOLD_EPSILON = 0.01;
|
|
42
|
+
|
|
43
|
+
/** Stable map key for an observer config. */
|
|
44
|
+
function observerKey(rootMargin: string, threshold: number): string {
|
|
45
|
+
return `${rootMargin}|${threshold}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getObserverFor(rootMargin: string, threshold: number): IntersectionObserver {
|
|
49
|
+
const key = observerKey(rootMargin, threshold);
|
|
50
|
+
const existing = observers.get(key);
|
|
39
51
|
if (existing) return existing;
|
|
40
52
|
|
|
41
53
|
const io = new IntersectionObserver(
|
|
42
54
|
(entries) => {
|
|
43
55
|
entries.forEach((entry) => {
|
|
56
|
+
// Enforce the threshold EXPLICITLY. `isIntersecting` is spec-defined as
|
|
57
|
+
// `intersectionRatio > 0` (any overlap), so the initial `observe()`
|
|
58
|
+
// firing can report `true` at, say, 20% visible even with
|
|
59
|
+
// `threshold: 0.5` — which would prematurely pass the gate. Require both
|
|
60
|
+
// an intersection AND the ratio to actually meet the threshold (minus a
|
|
61
|
+
// small epsilon for the float rounding where the ratio lands a hair
|
|
62
|
+
// under the exact value).
|
|
44
63
|
if (!entry.isIntersecting) return;
|
|
64
|
+
if (entry.intersectionRatio < threshold - THRESHOLD_EPSILON) return;
|
|
45
65
|
// Race-safe: re-read the callback at fire time. A late IO firing
|
|
46
66
|
// after cleanup must not invoke a stale callback.
|
|
47
67
|
const cb = subscribers.get(entry.target);
|
|
@@ -52,9 +72,9 @@ function getObserverFor(rootMargin: string): IntersectionObserver {
|
|
|
52
72
|
}
|
|
53
73
|
});
|
|
54
74
|
},
|
|
55
|
-
{ rootMargin }
|
|
75
|
+
{ rootMargin, threshold }
|
|
56
76
|
);
|
|
57
|
-
observers.set(
|
|
77
|
+
observers.set(key, io);
|
|
58
78
|
return io;
|
|
59
79
|
}
|
|
60
80
|
|
|
@@ -78,12 +98,16 @@ export interface UseNearViewportResult<T extends Element = HTMLElement> {
|
|
|
78
98
|
* '500px' = element starts mounting 500px before scroll-in.
|
|
79
99
|
* '1000px' = a full viewport's worth of lookahead.
|
|
80
100
|
* '0px' = strict on-screen detection.
|
|
101
|
+
* @param threshold Fraction of the element that must be visible before firing
|
|
102
|
+
* (0 = any pixel — the default; 0.5 = at least half on-screen).
|
|
81
103
|
*/
|
|
82
104
|
export function useNearViewport<T extends Element = HTMLElement>(
|
|
83
|
-
rootMargin: string = NEAR_VIEWPORT_ROOT_MARGIN
|
|
105
|
+
rootMargin: string = NEAR_VIEWPORT_ROOT_MARGIN,
|
|
106
|
+
threshold: number = 0
|
|
84
107
|
): UseNearViewportResult<T> {
|
|
85
108
|
const [isNear, setIsNear] = useState(false);
|
|
86
109
|
const elRef = useRef<T | null>(null);
|
|
110
|
+
const key = observerKey(rootMargin, threshold);
|
|
87
111
|
|
|
88
112
|
// Subscribe/unsubscribe on element change.
|
|
89
113
|
const ref = useCallback(
|
|
@@ -96,7 +120,7 @@ export function useNearViewport<T extends Element = HTMLElement>(
|
|
|
96
120
|
const stillOurs = subscribers.get(prev);
|
|
97
121
|
if (stillOurs) {
|
|
98
122
|
subscribers.delete(prev);
|
|
99
|
-
observers.get(
|
|
123
|
+
observers.get(key)?.unobserve(prev);
|
|
100
124
|
}
|
|
101
125
|
}
|
|
102
126
|
|
|
@@ -105,9 +129,9 @@ export function useNearViewport<T extends Element = HTMLElement>(
|
|
|
105
129
|
|
|
106
130
|
const cb = () => setIsNear(true);
|
|
107
131
|
subscribers.set(node, cb);
|
|
108
|
-
getObserverFor(rootMargin).observe(node);
|
|
132
|
+
getObserverFor(rootMargin, threshold).observe(node);
|
|
109
133
|
},
|
|
110
|
-
[rootMargin]
|
|
134
|
+
[key, rootMargin, threshold]
|
|
111
135
|
);
|
|
112
136
|
|
|
113
137
|
// Unsubscribe on unmount. Identity check guards the StrictMode race.
|
|
@@ -117,10 +141,10 @@ export function useNearViewport<T extends Element = HTMLElement>(
|
|
|
117
141
|
if (!el) return;
|
|
118
142
|
if (subscribers.get(el)) {
|
|
119
143
|
subscribers.delete(el);
|
|
120
|
-
observers.get(
|
|
144
|
+
observers.get(key)?.unobserve(el);
|
|
121
145
|
}
|
|
122
146
|
};
|
|
123
|
-
}, [
|
|
147
|
+
}, [key]);
|
|
124
148
|
|
|
125
149
|
return { ref, isNear };
|
|
126
150
|
}
|
|
@@ -9,11 +9,8 @@ import {
|
|
|
9
9
|
} from '../components/chat/chat-container'
|
|
10
10
|
import { ChatInput } from '../components/chat/chat-input'
|
|
11
11
|
import { ChatMessageList } from '../components/chat/chat-message-list'
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
ChatQuickActionRowSkeleton,
|
|
15
|
-
type QuickActionChip,
|
|
16
|
-
} from '../components/chat/chat-quick-action-row'
|
|
12
|
+
import { QuickActionWall } from '../components/chat/quick-action-wall'
|
|
13
|
+
import type { QuickActionChip } from '../components/chat/quick-action-chip'
|
|
17
14
|
import { ModelDisplay, ModelDisplaySkeleton } from '../components/chat/model-display'
|
|
18
15
|
import type { Message } from '../components/chat/types/message.types'
|
|
19
16
|
import { cn } from '../utils/cn'
|
|
@@ -145,13 +142,19 @@ function FaeChatShell({
|
|
|
145
142
|
/>
|
|
146
143
|
</ChatContent>
|
|
147
144
|
<ChatFooter fullWidth={fullWidth}>
|
|
148
|
-
{/* Quick
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
145
|
+
{/* Quick actions above the composer — the shared `QuickActionWall`
|
|
146
|
+
(its own 1:1 skeleton drives the loading variant, same pattern as
|
|
147
|
+
ModelDisplay). */}
|
|
148
|
+
<QuickActionWall
|
|
149
|
+
className="mb-[var(--spacing-system-s)] max-h-28"
|
|
150
|
+
chips={SAMPLE_QUICK_ACTIONS}
|
|
151
|
+
loading={modelLoading}
|
|
152
|
+
rows={2}
|
|
153
|
+
fade={['left', 'right']}
|
|
154
|
+
fadeSize={{ left: 32 }}
|
|
155
|
+
fadeColor="var(--color-bg)"
|
|
156
|
+
copyGap="var(--spacing-system-xxs)"
|
|
157
|
+
/>
|
|
155
158
|
<ChatInput
|
|
156
159
|
onSend={handleSend}
|
|
157
160
|
placeholder="Message Fae..."
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
|
2
2
|
import { QuickActionWall, interleave } from '../components/chat/quick-action-wall'
|
|
3
|
-
import type { QuickActionChip } from '../components/chat/
|
|
4
|
-
import type { QuickActionThemeSpec } from '../components/chat/quick-action-chip'
|
|
3
|
+
import type { QuickActionChip, QuickActionThemeSpec } from '../components/chat/quick-action-chip'
|
|
5
4
|
|
|
6
5
|
// Theme specs are CALLER-supplied (the lib ships no registry, no fallbacks):
|
|
7
6
|
// these are this story's own demo specs — real consumers resolve agent
|