'use client'; import { createContext, useContext } from 'react'; import type { ComposerAttachHandle } from './types'; /** * Exposes the composer's attach pipeline to descendants — chiefly * `ComposerMenuButton`, so a `+`-menu "Attach" item reaches the same * `openPicker` as the paperclip button without a prop drill. * * `null` when no attach pipeline is mounted (composer without * `showAttachmentButton` / `attach` config). */ const AttachContext = createContext(null); export const AttachProvider = AttachContext.Provider; /** Read the attach pipeline. Returns `null` outside an attach-enabled composer. */ export function useComposerAttachContext(): ComposerAttachHandle | null { return useContext(AttachContext); }