Open History to see the last commit
1const COMPOSER_FLOATING_LAYER_SELECTOR = [
2 '[data-composer-drawer-layer="true"]',
3 '[data-chat-composer-floating-layer="true"]',
4].join(",");
5
6export const composerFloatingLayerProps = {
7 "data-chat-composer-floating-layer": "true",
8} as const;
9
10export function isInsideComposerFloatingLayer(target: EventTarget | null): boolean {
11 return target instanceof Element && target.closest(COMPOSER_FLOATING_LAYER_SELECTOR) !== null;
12}
13
14// Banners, the approval row, and the tasks badge dock above the surface. A
15// pointer or focus landing on one of them acts on that control and must not
16// expand a resting or collapsed composer.
17export function isInsideCollapsedComposerControls(target: EventTarget | null): boolean {
18 return (
19 target instanceof Element &&
20 target.closest('[data-chat-composer-collapsed-controls="true"]') !== null
21 );
22}
23
24export function isInsideRestingComposerControlScope(target: EventTarget | null): boolean {
25 return (
26 target instanceof Element &&
27 (target.closest('[data-chat-composer-resting-controls="true"]') !== null ||
28 target.closest('[data-chat-composer-resting-images="true"]') !== null ||
29 isInsideComposerFloatingLayer(target))
30 );
31}