/*! * react-mosaic-ui — Copyright 2025-2026 HeoJeongBo — Apache-2.0 * Derived from react-mosaic (https://github.com/nomcopter/react-mosaic), * Copyright 2019 Kevin Verdieck, originally developed at Palantir Technologies, Inc. * Modified for react-mosaic-ui — see NOTICE for the list of changes. */ import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import react__default, { ReactNode, ComponentType } from 'react'; type MosaicKey = string | number; type MosaicDirection = 'row' | 'column'; type MosaicBranch = 'first' | 'second'; type MosaicPath = MosaicBranch[]; type MosaicNode = MosaicParent | T; interface MosaicParent { direction: MosaicDirection; first: MosaicNode; second: MosaicNode; splitPercentage?: number; } declare enum MosaicDropTargetPosition { TOP = "TOP", BOTTOM = "BOTTOM", LEFT = "LEFT", RIGHT = "RIGHT" } declare enum Corner { TOP_LEFT = 1, TOP_RIGHT = 2, BOTTOM_LEFT = 3, BOTTOM_RIGHT = 4 } interface ResizeOptions { minimumPaneSizePercentage?: number; } interface BoundingBox { top: number; right: number; bottom: number; left: number; } interface MosaicUpdate { path: MosaicPath; spec: MosaicUpdateSpec; } type MosaicUpdateSpec = { $set: MosaicNode; } | { splitPercentage?: { $set: number; }; direction?: { $set: MosaicDirection; }; first?: MosaicUpdateSpec; second?: MosaicUpdateSpec; }; interface MosaicDragItem { mosaicId: string; path: MosaicPath; } interface MosaicDropData { path: MosaicPath; position: MosaicDropTargetPosition; } type TileRenderer = (id: T, path: MosaicPath) => react.ReactNode; type CreateNode = () => T | Promise; interface MosaicPanelConfig { id: TId; title: string; content: react.ReactNode; renderToolbar?: () => react.ReactNode; Wrapper?: react.ComponentType<{ children: react.ReactNode; }>; closable?: boolean; hideToolbar?: boolean; bodyPadding?: string | number; bodyClassName?: string; } interface DragBindings { ref: (el: HTMLElement | null) => void; } interface MosaicRootActions { expand: (path: MosaicPath, percentage?: number) => void; remove: (path: MosaicPath) => void; hide: (path: MosaicPath) => void; replaceWith: (path: MosaicPath, node: MosaicNode) => void; updateTree: (updates: MosaicUpdate[], suppressOnRelease?: boolean) => void; getRoot: () => MosaicNode | null; add: (newNode: T, direction?: MosaicDirection) => void; maximize: (path: MosaicPath) => void; restore: () => void; isMaximized: () => boolean; } interface MosaicContextValue { mosaicActions: MosaicRootActions; mosaicId: string; renderTile: TileRenderer; } interface MosaicWindowActions { split: () => Promise; replaceWithNew: () => Promise; getPath: () => MosaicPath; } interface MosaicWindowContextValue { mosaicWindowActions: MosaicWindowActions; panelId?: T; } interface MosaicBaseProps { renderTile: TileRenderer; onChange?: (node: MosaicNode | null) => void; onRelease?: (node: MosaicNode | null) => void; className?: string; resize?: ResizeOptions; zeroStateView?: JSX.Element; mosaicId?: string; ariaLabel?: string; highlightActive?: boolean; children?: React.ReactNode; } interface MosaicControlledProps extends MosaicBaseProps { value: MosaicNode | null; onChange: (node: MosaicNode | null) => void; } interface MosaicUncontrolledProps extends MosaicBaseProps { initialValue: MosaicNode | null; } type MosaicProps = MosaicControlledProps | MosaicUncontrolledProps; declare const Mosaic: (props: MosaicProps) => react_jsx_runtime.JSX.Element; interface MosaicWindowProps { title: string; path: MosaicPath; children: ReactNode; createNode?: CreateNode; toolbarControls?: ReactNode; additionalControls?: ReactNode; renderToolbar?: (props: MosaicWindowToolbarProps, defaultToolbar: ReactNode) => ReactNode; onDragStart?: () => void; onDragEnd?: (type: 'drop' | 'reset') => void; onError?: (error: unknown, action: 'split' | 'replace') => void; className?: string; closable?: boolean; hideToolbar?: boolean; bodyClassName?: string; bodyPadding?: string | number; ariaLabel?: string; panelId?: T; } interface MosaicWindowToolbarProps { title: string; path: MosaicPath; createNode?: CreateNode; toolbarControls?: ReactNode; additionalControls?: ReactNode; dragHandle: DragBindings; closable?: boolean; onError?: (error: unknown, action: 'split' | 'replace') => void; } declare const MosaicWindowImpl: ({ title, path, children, createNode, toolbarControls, additionalControls, renderToolbar, onDragStart, onDragEnd, onError, className, closable, hideToolbar, bodyClassName, bodyPadding, ariaLabel, panelId, }: MosaicWindowProps) => react_jsx_runtime.JSX.Element; declare const MosaicWindow: typeof MosaicWindowImpl; interface SplitProps { direction: MosaicDirection; percentage: number; onChange: (percentage: number) => void; onRelease?: (percentage: number) => void; boundingBox: BoundingBox; minimumPaneSizePercentage?: number; } declare const Split: ({ direction, percentage, onChange, onRelease, boundingBox, minimumPaneSizePercentage, }: SplitProps) => react_jsx_runtime.JSX.Element; interface MosaicDropTargetProps { position: MosaicDropTargetPosition; path: MosaicPath; mosaicId: string; hitArea?: 'window' | 'viewport-edge'; } declare const MosaicDropTarget: react__default.MemoExoticComponent<({ position, path, mosaicId, hitArea, }: MosaicDropTargetProps) => react_jsx_runtime.JSX.Element>; type GetDirectionFn = (nextCount: number) => MosaicDirection; interface MosaicLayoutProps extends Omit, 'renderTile' | 'value' | 'onChange' | 'initialValue'> { panels: MosaicPanelConfig[]; className?: string; initialNode?: MosaicNode | null; getDirection?: GetDirectionFn; onPanelClose?: (id: TId) => void; onNodeChange?: (node: MosaicNode | null) => void; } declare function MosaicLayout({ panels, className, initialNode, getDirection, onPanelClose, onNodeChange, ...mosaicProps }: MosaicLayoutProps): react_jsx_runtime.JSX.Element; declare function useMosaicPanels(): { panels: MosaicPanelConfig[]; addPanel: (panel: MosaicPanelConfig) => void; removePanel: (id: TId) => void; togglePanel: (panelOrId: MosaicPanelConfig | TId) => void; hasPanel: (id: TId) => boolean; clearPanels: () => void; updatePanel: (id: TId, updates: Partial>) => void; getPanelById: (id: TId) => MosaicPanelConfig | null; }; interface PersistedPanelEntry> { component: ComponentType; toolbar?: ComponentType; wrapper?: ComponentType<{ children: ReactNode; }>; closable?: boolean; title?: string; componentProps?: TProps extends Record ? never : TProps; } type PersistedLayoutRegistry = Record>; type ValidatedRegistry = { [K in keyof R]: R[K] extends { component: ComponentType; } ? PersistedPanelEntry

: R[K]; }; declare function defineRegistry>>(registry: R & ValidatedRegistry): R; interface UsePersistedLayoutOptions { storageKey: string; registry: PersistedLayoutRegistry; titles?: Partial>; defaultPanelIds?: TId[]; autoSaveDelayMs?: number; syncAcrossTabs?: boolean; onSave?: (node: MosaicNode | null) => void; onReset?: (node: MosaicNode | null) => void; onPanelOpen?: (id: TId) => void; onPanelClose?: (id: TId) => void; onNodeChange?: (node: MosaicNode | null) => void; } interface UsePersistedLayoutResult { panels: MosaicPanelConfig[]; initialNode: MosaicNode | null; onNodeChange: (node: MosaicNode | null) => void; saveLayout: () => void; addPanel: (id: TId) => void; removePanel: (id: TId) => void; hasPanel: (id: TId) => boolean; activeIds: ReadonlySet; isDirty: boolean; clearLayout: () => void; resetLayout: () => void; PanelStateProvider: ComponentType<{ children: ReactNode; }>; } declare function usePersistedLayout(options: UsePersistedLayoutOptions): UsePersistedLayoutResult; interface UsePanelStateOptions { defaultState: T | (() => T); version?: number; migrate?: (persisted: unknown, fromVersion: number) => T; } declare function usePanelState(options: UsePanelStateOptions): [T, (updater: T | ((prev: T) => T)) => void]; declare const isParent: (node: MosaicNode | null) => node is MosaicParent; declare const getLeaves: (node: MosaicNode | null) => T[]; declare const pruneTree: (node: MosaicNode | null, validIds: Set) => MosaicNode | null; declare const getNodeAtPath: (node: MosaicNode, path: MosaicPath) => MosaicNode | null; declare const getAndAssertNodeAtPathExists: (node: MosaicNode, path: MosaicPath) => MosaicNode; declare const createBalancedTreeFromLeaves: (leaves: T[], startDirection?: MosaicDirection) => MosaicNode | null; declare const getPathToCorner: (node: MosaicNode, corner: Corner) => MosaicPath; declare const getOtherDirection: (direction: MosaicDirection) => MosaicDirection; declare const getOtherBranch: (branch: MosaicBranch) => MosaicBranch; declare const countNodes: (node: MosaicNode | null) => number; declare const getTreeDepth: (node: MosaicNode | null) => number; declare const updateTree: (root: MosaicNode | null, updates: MosaicUpdate[]) => MosaicNode | null; declare const createRemoveUpdate: (root: MosaicNode | null, path: MosaicPath) => MosaicUpdate; declare const createExpandUpdate: (path: MosaicPath, percentage?: number) => MosaicUpdate; declare const createHideUpdate: (path: MosaicPath) => MosaicUpdate; declare const createDragToUpdates: (root: MosaicNode, sourcePath: MosaicPath, destinationPath: MosaicPath, position: MosaicDropTargetPosition) => MosaicUpdate[]; declare const createReplaceUpdate: (path: MosaicPath, node: MosaicNode) => MosaicUpdate; declare const createSplitUpdate: (root: MosaicNode, path: MosaicPath, newNode: T, direction?: MosaicDirection) => MosaicUpdate; declare const MosaicContext: react.Context>; declare const MosaicWindowContext: react.Context>; declare function useMosaicContext(): MosaicContextValue; declare function useMosaicWindowContext(): MosaicWindowContextValue; export { Corner, Mosaic, MosaicContext, MosaicDropTarget, MosaicDropTargetPosition, MosaicLayout, MosaicWindow, MosaicWindowContext, Split, countNodes, createBalancedTreeFromLeaves, createDragToUpdates, createExpandUpdate, createHideUpdate, createRemoveUpdate, createReplaceUpdate, createSplitUpdate, defineRegistry, getAndAssertNodeAtPathExists, getLeaves, getNodeAtPath, getOtherBranch, getOtherDirection, getPathToCorner, getTreeDepth, isParent, pruneTree, updateTree, useMosaicContext, useMosaicPanels, useMosaicWindowContext, usePanelState, usePersistedLayout }; export type { BoundingBox, CreateNode, DragBindings, GetDirectionFn, MosaicBranch, MosaicContextValue, MosaicControlledProps, MosaicDirection, MosaicDragItem, MosaicDropData, MosaicDropTargetProps, MosaicKey, MosaicLayoutProps, MosaicNode, MosaicPanelConfig, MosaicParent, MosaicPath, MosaicProps, MosaicRootActions, MosaicUncontrolledProps, MosaicUpdate, MosaicUpdateSpec, MosaicWindowActions, MosaicWindowContextValue, MosaicWindowProps, MosaicWindowToolbarProps, PersistedLayoutRegistry, PersistedPanelEntry, ResizeOptions, SplitProps, TileRenderer, UsePanelStateOptions, UsePersistedLayoutOptions, UsePersistedLayoutResult };