import { CSSProperties, DOMAttributes } from 'react'; import { ArtifactWidth } from '../AppShell.config'; export type { ArtifactWidth }; /** * Pointer, keyboard, and style props for a docked Window drag handle. Spread on * a focusable element; inert in fullscreen or a bare AppShell. */ export type WindowDragHandleProps = Pick, "onPointerDown" | "onPointerMove" | "onPointerUp" | "onPointerCancel" | "onKeyDown"> & { /** Grab cursor and `touch-action: none`; omitted when the handle is inert. */ style?: CSSProperties; }; /** * Current artifact placement. Artifact content can use `drawer` to expose its * own close affordance. */ export type ArtifactPresentation = "inline" | "drawer" | "hidden"; /** Options for showing the artifact via the {@link AppSurfaceHandle}. */ export type ShowArtifactOptions = { /** * Opening width preset. Defaults to the shell's configured * `defaultArtifactWidth`; dragging may resize it afterward. */ width?: ArtifactWidth; }; /** * Imperative controls shared by AppShell and Window. Region intents maximize a * docked Window before applying. Window intents are no-ops in a bare AppShell, * where `isOpen` and `isFullscreen` are always true. */ export type AppSurfaceHandle = { /** Reveal the rail; no-op if the slot is empty. */ showRail: () => void; /** Collapse the inline rail or close its drawer. */ hideRail: () => void; /** Show or hide the rail from its current presentation. */ toggleRail: () => void; /** * Reveal the artifact at an optional width preset. No-op if the slot is * empty. */ showArtifact: (options?: ShowArtifactOptions) => void; /** Collapse the inline artifact or close its drawer. */ hideArtifact: () => void; /** Show or hide the artifact from its current presentation. */ toggleArtifact: (options?: ShowArtifactOptions) => void; /** Show a composing Window. No-op on a bare shell. */ open: () => void; /** Hide a composing Window. No-op on a bare shell. */ close: () => void; /** Toggle a composing Window's open state. No-op on a bare shell. */ toggle: () => void; /** Expand a composing Window to fullscreen. No-op on a bare shell. */ maximize: () => void; /** Restore a composing Window to docked. No-op on a bare shell. */ restore: () => void; /** Toggle a composing Window between docked and fullscreen. No-op on a bare shell. */ toggleSize: () => void; /** * Spread onto a consumer-owned docked Window drag handle. Empty in * fullscreen and on a bare shell. See {@link WindowDragHandleProps}. */ readonly dragHandleProps: WindowDragHandleProps; /** Whether a composing Window is open. Always `true` on a bare shell. */ readonly isOpen: boolean; /** Whether a composing Window is fullscreen. Always `true` on a bare shell. */ readonly isFullscreen: boolean; /** * Artifact placement. `"hidden"` while the region is absent, collapsed, or * the composing Window is docked. */ readonly artifactPresentation: ArtifactPresentation; };