import { TileryActiveTabChangeEvent, TileryPanelsCloseEvent, TileryPanelsOpenEvent, TileryPanelSplitEvent, TileryTabsCloseEvent, TileryTabsMoveEvent, TileryTabsOpenEvent } from './lifecycle'; import { TileryEdge, TileryInitialLayout, TileryDividerOrientation, TileryLayoutState, TileryController, TileryPanel, TileryPanelId, TilerySize, TileryTab, TileryTabId, TileryTabInit } from 'tilery/internal'; /** * Controls whether a per-panel control is shown: a constant for all panels, or * a predicate evaluated against each panel. */ export type TileryPanelVisibility = boolean | ((panel: TileryPanel) => boolean); /** * Produces the tab to open when the new-tab button is pressed; returning * nothing skips opening a tab. */ export type TileryNewTabHandler = (panel: TileryPanel, ctx: { tilery: TileryController; }) => TileryTabInit | void; /** Context for `renderPanelActions`, including a way to close the menu. */ export type TileryPanelActionsRenderContext = { /** Controller for the current Tilery instance. */ tilery: TileryController; /** Closes the open panel action menu. */ closeMenu: () => void; }; /** * Props Tilery hands to a custom tab trigger; spread them onto your element to * preserve selection, drag, and accessibility behavior. */ export type TileryTabTriggerProps = React.HTMLAttributes & { /** Ref callback Tilery uses to track the trigger element. */ ref: React.RefCallback; /** Class name carrying Tilery's tab styling. */ className: string; /** ARIA role identifying the element as a tab. */ role: 'tab'; /** Whether this tab is the panel's active tab. */ 'aria-selected': boolean; /** Roving tab index: `0` for the active tab, `-1` for the rest. */ tabIndex: number; /** Active-state hook for styling. */ 'data-active': boolean; /** Whether the tab can be closed. */ 'data-closable': boolean; /** Whether the tab can be dragged. */ 'data-draggable': boolean; /** Identifier of the tab this trigger represents. */ 'data-tab-id': TileryTabId; }; /** Context passed to a `renderTabTrigger` renderer for a single tab. */ export type TileryTabTriggerRenderContext = { /** The tab being rendered. */ tab: TileryTab; /** Whether the tab is currently active. */ isActive: boolean; /** Props that must be spread onto the rendered trigger element. */ props: TileryTabTriggerProps; /** The tab header content to render inside the trigger. */ children: React.ReactNode; }; /** * Renders the clickable element for a tab (e.g. an anchor or router link) * instead of the default trigger. */ export type TileryTabTriggerRenderer = (ctx: TileryTabTriggerRenderContext) => React.ReactElement; /** Whether a resize was driven by the keyboard or by pointer dragging. */ export type TileryResizeInput = 'keyboard' | 'pointer'; /** Whether a resize event is a live update or the final committed value. */ export type TileryResizePhase = 'resize' | 'end'; /** The axis a panel was resized along. */ export type TileryResizeDimension = 'width' | 'height'; /** A single panel's size change reported within a resize event. */ export type TileryResizePanelChange = { /** Panel whose size changed. */ panelId: TileryPanelId; /** Axis that changed. */ dimension: TileryResizeDimension; /** Size before the change, as a percentage of the container. */ previousSize: number; /** Size after the change, as a percentage of the container. */ size: number; /** Previous size in pixels, when the container could be measured. */ previousPixelSize?: number; /** New size in pixels, when the container could be measured. */ pixelSize?: number; }; /** Identifies the handle that drove a resize and its before/after geometry. */ export type TileryResizeSource = { type: 'divider'; dividerId: string; orientation: TileryDividerOrientation; previousPosition: number; position: number; } | { type: 'junction'; junctionId: string; previousX: number; previousY: number; x: number; y: number; verticalDividerId: string; horizontalDividerId: string; } | { type: 'edge'; panelId: TileryPanelId; side: TileryEdge; previousSize: number; size: number; }; /** Payload for `onResize` and `onResizeEnd` describing a resize interaction. */ export type TileryResizeEvent = { /** Whether this is a live resize update or the committed end value. */ phase: TileryResizePhase; /** Whether the keyboard or pointer drove the resize. */ input: TileryResizeInput; /** The handle that drove the resize and its geometry. */ source: TileryResizeSource; /** Every panel whose size changed in this step. */ changes: TileryResizePanelChange[]; /** Layout state before the resize. */ previousState: TileryLayoutState; /** Layout state after the resize. */ state: TileryLayoutState; }; /** Props for the {@link Tilery} component. */ export type TileryProps = { /** Initial panel and tab configuration that seeds the workspace. */ initialLayout: TileryInitialLayout; /** Renders the content shown inside a tab's button in the tab bar. */ renderTabHeader: (tab: TileryTab, ctx: { isActive: boolean; }) => React.ReactNode; /** * Renders the tab's clickable element when it needs to be a link or router * component. Spread the provided props onto your element to keep selection, * drag, and accessibility behavior intact. */ renderTabTrigger?: TileryTabTriggerRenderer; /** Renders the panel content displayed for a tab. */ renderTabContent: (tab: TileryTab) => React.ReactNode; /** * Optional resolver for a tab's accessible label. Gives icon-only tabs and * their close buttons a meaningful name for screen readers. */ getTabLabel?: (tab: TileryTab) => string; /** Called after every state change; use it to persist or inspect layout. */ onChange?: (state: TileryLayoutState) => void; /** * Fires continuously while a divider, junction, or edge is being resized by * pointer or keyboard. */ onResize?: (event: TileryResizeEvent) => void; /** * Fires once a resize commits: on pointer release, after each keyboard step, * and after a double-click divider reset (reported as `input: 'pointer'`). */ onResizeEnd?: (event: TileryResizeEvent) => void; /** Fires when one or more panels switch from one active tab to another. */ onActiveTabChange?: (event: TileryActiveTabChangeEvent) => void; /** Fires when tabs move between panels, indexes, floating, or splits. */ onTabsMove?: (event: TileryTabsMoveEvent) => void; /** * Fires when panels are created through floating extraction, popout, or * layout replacement. */ onPanelsOpen?: (event: TileryPanelsOpenEvent) => void; /** Fires when a panel is split into two, explicitly or by a tab move. */ onPanelSplit?: (event: TileryPanelSplitEvent) => void; /** Fires when tabs are added to a panel. */ onTabsOpen?: (event: TileryTabsOpenEvent) => void; /** * Fires when tabs are removed. Does not fire when a tab merely moves out of a * panel; that case surfaces through `onPanelsClose` instead. */ onTabsClose?: (event: TileryTabsCloseEvent) => void; /** * Fires when panels are removed. When a panel closes because its last tab * moved out, the moved tab is reported here even though `onTabsClose` did not * fire. */ onPanelsClose?: (event: TileryPanelsCloseEvent) => void; /** * Default minimum panel size applied where the layout tree does not specify a * per-panel constraint. * @defaultValue 10 */ minSize?: TilerySize; /** * Enables or disables every resize handle in the instance. * @defaultValue true */ resizable?: boolean; /** * Pointer hit-target size, in pixels, for dividers and junction resize * controls. * @defaultValue 24 */ resizeHandleHitSize?: number; /** * Shows the built-in panel action menu button, for all panels or per panel. * @defaultValue false */ showActionsButton?: TileryPanelVisibility; /** * Shows the optional new-tab button, for all panels or per panel. * @defaultValue false */ showNewTabButton?: TileryPanelVisibility; /** Responds to the new-tab button, returning the tab to open (if any). */ onNewTab?: TileryNewTabHandler; /** Appends custom content to a panel's built-in action menu. */ renderPanelActions?: (panel: TileryPanel, ctx: TileryPanelActionsRenderContext) => React.ReactNode; /** Customizes the icon shown on a panel's action menu button. */ renderActionsButtonIcon?: (panel: TileryPanel) => React.ReactNode; }; /** * Renders a resizable, tabbed panel workspace from an initial layout. Accepts a * `TileryController` ref for imperative control and emits resize and lifecycle * events as panels and tabs change. */ export declare const Tilery: (props: TileryProps & { ref?: React.Ref; }) => React.ReactElement; //# sourceMappingURL=tilery.d.ts.map