@mantine/hooks
Version:
A collection of 50+ hooks for state and UI management
1 lines • 56.7 kB
Source Map (JSON)
{"version":3,"file":"use-splitter.mjs","names":[],"sources":["../../src/use-splitter/use-splitter.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-deprecated */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useUncontrolled } from '../use-uncontrolled/use-uncontrolled';\n\n/** Pane size expressed in CSS units. A bare `number` or `%` string is a flexible size (shares\n * the leftover space), `px`/`rem` strings are fixed sizes that keep their pixel size when the\n * container is resized. */\nexport type SplitterPaneSize = number | `${number}%` | `${number}px` | `${number}rem`;\n\n/** Keyboard step expressed in CSS units. A bare `number` or `%` string is a percentage of the\n * container, `px`/`rem` strings are resolved to pixels. */\nexport type SplitterStep = number | `${number}%` | `${number}px` | `${number}rem`;\n\nexport interface UseSplitterPanel {\n /** Initial size, a `number`/`%` is a flexible size, `px`/`rem` is a fixed size. A bare number is treated as a percentage. */\n defaultSize: SplitterPaneSize;\n /** Minimum size in the same units as `defaultSize`, `0` by default */\n min?: SplitterPaneSize;\n /** Maximum size in the same units as `defaultSize`, no limit by default */\n max?: SplitterPaneSize;\n /** Whether this panel can be collapsed, `false` by default */\n collapsible?: boolean;\n /** Size below which the panel snaps to collapsed, defaults to `min` */\n collapseThreshold?: SplitterPaneSize;\n}\n\n/** Panel configuration resolved to numeric units (percent or pixels) passed to redistribute functions */\nexport interface UseSplitterResolvedPanel {\n /** Resolved default size in the same units as redistribute sizes */\n defaultSize: number;\n /** Resolved minimum size */\n min?: number;\n /** Resolved maximum size */\n max?: number;\n /** Whether this panel can be collapsed */\n collapsible?: boolean;\n /** Resolved collapse threshold */\n collapseThreshold?: number;\n}\n\nexport interface UseSplitterRedistributeInput {\n /** Current sizes before applying delta, in resolved units (percent or pixels) */\n sizes: number[];\n /** Resolved panel configurations, in the same units as `sizes` */\n panels: UseSplitterResolvedPanel[];\n /** Index of the handle being dragged */\n handleIndex: number;\n /** Requested size change in resolved units (positive = grow before-panel) */\n delta: number;\n}\n\nexport type UseSplitterRedistributeFn = (input: UseSplitterRedistributeInput) => number[];\n\nexport interface UseSplitterOptions {\n /** Panel configuration array (minimum 2 panels) */\n panels: UseSplitterPanel[];\n /** Layout direction, `'horizontal'` by default */\n orientation?: 'horizontal' | 'vertical';\n /** Controlled sizes, each value keeps the unit it was declared in */\n sizes?: SplitterPaneSize[];\n /** Called during resize with updated sizes, each value keeps its declared unit */\n onSizeChange?: (sizes: SplitterPaneSize[]) => void;\n /** Called when drag starts */\n onResizeStart?: (handleIndex: number) => void;\n /** Called when drag ends */\n onResizeEnd?: (handleIndex: number, sizes: SplitterPaneSize[]) => void;\n /** Called when a panel collapses or expands */\n onCollapseChange?: (panelIndex: number, collapsed: boolean) => void;\n /** How to borrow space from non-adjacent panels when the immediate neighbor is at its min/max.\n * `'nearest'` takes from the nearest panel in the drag direction first.\n * `'equal'` distributes equally among all panels in the drag direction.\n * A function receives sizes, panels, handleIndex and delta, and returns new sizes.\n * When not set, only the two adjacent panels are affected. */\n redistribute?: 'nearest' | 'equal' | UseSplitterRedistributeFn;\n /** Keyboard step size, a `number`/`%` is a percentage, `px`/`rem` is resolved to pixels, `1` by default */\n step?: SplitterStep;\n /** Shift+arrow step size, a `number`/`%` is a percentage, `px`/`rem` is resolved to pixels, `10` by default */\n shiftStep?: SplitterStep;\n /** Text direction for keyboard nav, `'ltr'` by default */\n dir?: 'ltr' | 'rtl';\n /** Restore the two panels adjacent to a handle to their default ratio (preserving their combined size) when the handle is double-clicked, `true` by default */\n resetOnDoubleClick?: boolean;\n /** Enable/disable the hook, `true` by default */\n enabled?: boolean;\n}\n\nexport interface UseSplitterReturnValue<T extends HTMLElement = any> {\n /** Ref callback for the container element */\n ref: React.RefCallback<T | null>;\n /** Current panel sizes, each value keeps the unit it was declared in */\n sizes: SplitterPaneSize[];\n /** Whether sizes are tracked in pixels because any pane size, `min`, `max`, `step`, `shiftStep`\n * or `collapseThreshold` uses a fixed `px`/`rem` unit */\n pixelMode: boolean;\n /** Which panels are currently collapsed */\n collapsed: boolean[];\n /** Index of handle being dragged, or -1 */\n activeHandle: number;\n /** Get props to spread on each resize handle */\n getHandleProps: (input: { index: number }) => {\n ref: React.RefCallback<HTMLElement>;\n role: 'separator';\n 'aria-orientation': 'horizontal' | 'vertical';\n 'aria-valuenow': number;\n 'aria-valuemin': number;\n 'aria-valuemax': number;\n tabIndex: number;\n onKeyDown: React.KeyboardEventHandler;\n onDoubleClick: React.MouseEventHandler;\n 'data-active': boolean | undefined;\n 'data-orientation': 'horizontal' | 'vertical';\n };\n /** Programmatically set sizes, each value keeps its declared unit */\n setSizes: (sizes: SplitterPaneSize[]) => void;\n /** Collapse a panel */\n collapse: (panelIndex: number) => void;\n /** Expand a collapsed panel */\n expand: (panelIndex: number) => void;\n /** Toggle collapse of a panel */\n toggleCollapse: (panelIndex: number) => void;\n /** Reset the two panels adjacent to a handle to their default ratio, preserving\n * their combined size */\n reset: (handleIndex: number) => void;\n}\n\nconst PX_RE = /^(-?[\\d.]+)px$/;\nconst REM_RE = /^(-?[\\d.]+)rem$/;\nconst PERCENT_RE = /^(-?[\\d.]+)%$/;\n\nfunction isFixedSize(size: SplitterPaneSize | undefined): boolean {\n return typeof size === 'string' && (PX_RE.test(size) || REM_RE.test(size));\n}\n\nfunction sizeMagnitude(size: SplitterPaneSize): number {\n return typeof size === 'number' ? size : parseFloat(size);\n}\n\nfunction detectPixelMode(options: UseSplitterOptions): boolean {\n return (\n options.panels.some(\n (panel) =>\n isFixedSize(panel.defaultSize) ||\n isFixedSize(panel.min) ||\n isFixedSize(panel.max) ||\n isFixedSize(panel.collapseThreshold)\n ) ||\n isFixedSize(options.step) ||\n isFixedSize(options.shiftStep) ||\n (options.sizes?.some(isFixedSize) ?? false)\n );\n}\n\nfunction getRootFontSize(): number {\n if (typeof window === 'undefined') {\n return 16;\n }\n const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);\n return Number.isFinite(fontSize) && fontSize > 0 ? fontSize : 16;\n}\n\nfunction resolveSize(\n size: SplitterPaneSize,\n pixelMode: boolean,\n containerPx: number,\n rootFontSize: number\n): number {\n if (!pixelMode) {\n return sizeMagnitude(size);\n }\n\n if (typeof size === 'number') {\n return (size / 100) * containerPx;\n }\n\n const percent = PERCENT_RE.exec(size);\n if (percent) {\n return (parseFloat(percent[1]) / 100) * containerPx;\n }\n\n const rem = REM_RE.exec(size);\n if (rem) {\n return parseFloat(rem[1]) * rootFontSize;\n }\n\n const px = PX_RE.exec(size);\n if (px) {\n return parseFloat(px[1]);\n }\n\n return 0;\n}\n\n/** Down-scaling factor applied to fixed panes when their combined pixel size overflows the\n * container, so they shrink to fit (matching `resolveWorkingSizes`). Returns `1` when nothing\n * overflows or the layout is not in pixel mode. Encoders divide by this to invert the scaling and\n * persist the original absolute sizes instead of the shrunk-to-fit ones. */\nfunction getFixedScale(\n sizes: SplitterPaneSize[],\n pixelMode: boolean,\n containerPx: number,\n rootFontSize: number\n): number {\n if (!pixelMode) {\n return 1;\n }\n\n let fixedTotal = 0;\n sizes.forEach((size) => {\n if (isFixedSize(size)) {\n fixedTotal += resolveSize(size, true, containerPx, rootFontSize);\n }\n });\n\n return fixedTotal > containerPx && fixedTotal > 0 ? containerPx / fixedTotal : 1;\n}\n\n/** Resolves all sizes to pixels at once. Fixed panes get their absolute pixel size, flexible panes\n * share the leftover space by their weight ratio – matching how the layout is rendered with\n * `flex-grow`, so drag math operates on the same pixel sizes the user sees. */\nfunction resolveWorkingSizes(\n sizes: SplitterPaneSize[],\n pixelMode: boolean,\n containerPx: number,\n rootFontSize: number\n): number[] {\n if (!pixelMode) {\n return sizes.map((size) => sizeMagnitude(size));\n }\n\n let fixedTotal = 0;\n let flexibleWeight = 0;\n sizes.forEach((size) => {\n if (isFixedSize(size)) {\n fixedTotal += resolveSize(size, true, containerPx, rootFontSize);\n } else {\n flexibleWeight += sizeMagnitude(size);\n }\n });\n\n const leftover = Math.max(0, containerPx - fixedTotal);\n const fixedScale = getFixedScale(sizes, pixelMode, containerPx, rootFontSize);\n\n return sizes.map((size) => {\n if (isFixedSize(size)) {\n return resolveSize(size, true, containerPx, rootFontSize) * fixedScale;\n }\n return flexibleWeight > 0 ? (sizeMagnitude(size) / flexibleWeight) * leftover : 0;\n });\n}\n\nfunction encodeSize(\n value: number,\n original: SplitterPaneSize,\n pixelMode: boolean,\n containerPx: number,\n rootFontSize: number,\n fixedScale: number = 1\n): SplitterPaneSize {\n if (!pixelMode) {\n return typeof original === 'string' && PERCENT_RE.test(original) ? `${value}%` : value;\n }\n\n if (typeof original === 'number') {\n return containerPx > 0 ? (value / containerPx) * 100 : original;\n }\n\n if (PERCENT_RE.test(original)) {\n return `${containerPx > 0 ? (value / containerPx) * 100 : parseFloat(original)}%`;\n }\n\n const absolute = fixedScale > 0 ? value / fixedScale : value;\n\n if (REM_RE.test(original)) {\n return `${rootFontSize > 0 ? absolute / rootFontSize : 0}rem`;\n }\n\n return `${absolute}px`;\n}\n\n/** Encodes working pixel sizes back to raw sizes after a resize, keeping the unit each pane was\n * declared in. Panes whose working size did not change keep their original raw value. When fixed\n * panes overflow the container they render down-scaled, so their working sizes are scaled back up to\n * absolute sizes (preserving their declared sizes). If the resize instead hands space to a flexible\n * pane the overflow clears and the layout leaves the down-scaled regime: every pane is then encoded\n * from its current working size – including untouched fixed panes (so they do not jump back to their\n * over-sized value) and untouched flexible panes (so a pane that was squeezed to `0` does not keep a\n * stale weight and steal the freed space on the next render). */\nfunction encodeWorkingSizes(\n nextWorking: number[],\n baseWorking: number[],\n baseRaw: SplitterPaneSize[],\n pixelMode: boolean,\n containerPx: number,\n rootFontSize: number\n): SplitterPaneSize[] {\n const fixedScale = getFixedScale(baseRaw, pixelMode, containerPx, rootFontSize);\n\n let fixedWorkingSum = 0;\n nextWorking.forEach((value, i) => {\n if (isFixedSize(baseRaw[i])) {\n fixedWorkingSum += value;\n }\n });\n const overflowCleared = fixedScale < 1 && fixedWorkingSum < containerPx - 1e-6;\n const encodeScale = overflowCleared ? 1 : fixedScale;\n\n return nextWorking.map((value, i) =>\n overflowCleared || Math.abs(value - baseWorking[i]) > 1e-6\n ? encodeSize(value, baseRaw[i], pixelMode, containerPx, rootFontSize, encodeScale)\n : baseRaw[i]\n );\n}\n\nfunction resolvePanel(\n panel: UseSplitterPanel,\n pixelMode: boolean,\n containerPx: number,\n rootFontSize: number\n): UseSplitterResolvedPanel {\n return {\n defaultSize: resolveSize(panel.defaultSize, pixelMode, containerPx, rootFontSize),\n min: panel.min != null ? resolveSize(panel.min, pixelMode, containerPx, rootFontSize) : 0,\n max:\n panel.max != null\n ? resolveSize(panel.max, pixelMode, containerPx, rootFontSize)\n : pixelMode\n ? containerPx\n : 100,\n collapseThreshold:\n panel.collapseThreshold != null\n ? resolveSize(panel.collapseThreshold, pixelMode, containerPx, rootFontSize)\n : undefined,\n collapsible: panel.collapsible,\n };\n}\n\nfunction resolveStep(\n step: SplitterStep,\n pixelMode: boolean,\n containerPx: number,\n rootFontSize: number\n): number {\n return resolveSize(step, pixelMode, containerPx, rootFontSize);\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction getMin(panel: UseSplitterResolvedPanel): number {\n return panel.min ?? 0;\n}\n\nfunction getMax(panel: UseSplitterResolvedPanel): number {\n return panel.max ?? Infinity;\n}\n\nfunction getCollapseThreshold(panel: UseSplitterResolvedPanel): number {\n return panel.collapseThreshold ?? getMin(panel);\n}\n\ninterface SplitterInternalState {\n isDragging: boolean;\n handleIndex: number;\n startPointer: number;\n containerSize: number;\n rootFontSize: number;\n pixelMode: boolean;\n startSizes: number[];\n startRaw: SplitterPaneSize[];\n preCollapseSizes: SplitterPaneSize[];\n}\n\nfunction createInitialInternalState(): SplitterInternalState {\n return {\n isDragging: false,\n handleIndex: -1,\n startPointer: 0,\n containerSize: 0,\n rootFontSize: 16,\n pixelMode: false,\n startSizes: [],\n startRaw: [],\n preCollapseSizes: [],\n };\n}\n\nfunction checkCollapse(\n sizes: number[],\n panels: UseSplitterResolvedPanel[],\n handleIndex: number,\n delta: number\n): number[] | null {\n const beforeIdx = handleIndex;\n const afterIdx = handleIndex + 1;\n const beforePanel = panels[beforeIdx];\n const afterPanel = panels[afterIdx];\n\n const rawBefore = sizes[beforeIdx] + delta;\n const rawAfter = sizes[afterIdx] - delta;\n\n if (\n beforePanel.collapsible &&\n rawBefore < getCollapseThreshold(beforePanel) &&\n rawBefore < sizes[beforeIdx]\n ) {\n const result = [...sizes];\n result[afterIdx] += result[beforeIdx];\n result[beforeIdx] = 0;\n return result;\n }\n\n if (\n afterPanel.collapsible &&\n rawAfter < getCollapseThreshold(afterPanel) &&\n rawAfter < sizes[afterIdx]\n ) {\n const result = [...sizes];\n result[beforeIdx] += result[afterIdx];\n result[afterIdx] = 0;\n return result;\n }\n\n return null;\n}\n\nfunction applyAdjacentOnly(\n sizes: number[],\n panels: UseSplitterResolvedPanel[],\n handleIndex: number,\n delta: number\n): number[] {\n const result = [...sizes];\n const beforeIdx = handleIndex;\n const afterIdx = handleIndex + 1;\n\n const total = result[beforeIdx] + result[afterIdx];\n const effectiveBeforeMax = Math.min(getMax(panels[beforeIdx]), total - getMin(panels[afterIdx]));\n const effectiveBeforeMin = Math.max(getMin(panels[beforeIdx]), total - getMax(panels[afterIdx]));\n const newBefore = clamp(result[beforeIdx] + delta, effectiveBeforeMin, effectiveBeforeMax);\n result[beforeIdx] = newBefore;\n result[afterIdx] = total - newBefore;\n return result;\n}\n\nfunction redistributeNearest(\n sizes: number[],\n panels: UseSplitterResolvedPanel[],\n handleIndex: number,\n delta: number\n): number[] {\n const result = [...sizes];\n\n if (delta > 0) {\n const growIdx = handleIndex;\n const maxGrow = getMax(panels[growIdx]) - result[growIdx];\n const wantedGrow = Math.min(delta, maxGrow);\n\n let taken = 0;\n for (let i = handleIndex + 1; i < result.length && taken < wantedGrow; i += 1) {\n const canGive = result[i] - getMin(panels[i]);\n const take = Math.min(canGive, wantedGrow - taken);\n result[i] -= take;\n taken += take;\n }\n\n result[growIdx] += taken;\n } else if (delta < 0) {\n const growIdx = handleIndex + 1;\n const maxGrow = getMax(panels[growIdx]) - result[growIdx];\n const wantedGrow = Math.min(Math.abs(delta), maxGrow);\n\n let taken = 0;\n for (let i = handleIndex; i >= 0 && taken < wantedGrow; i -= 1) {\n const canGive = result[i] - getMin(panels[i]);\n const take = Math.min(canGive, wantedGrow - taken);\n result[i] -= take;\n taken += take;\n }\n\n result[growIdx] += taken;\n }\n\n return result;\n}\n\nfunction redistributeEqual(\n sizes: number[],\n panels: UseSplitterResolvedPanel[],\n handleIndex: number,\n delta: number\n): number[] {\n const result = [...sizes];\n\n if (delta > 0) {\n const growIdx = handleIndex;\n const maxGrow = getMax(panels[growIdx]) - result[growIdx];\n const wantedGrow = Math.min(delta, maxGrow);\n\n const donors: number[] = [];\n for (let i = handleIndex + 1; i < result.length; i += 1) {\n if (result[i] > getMin(panels[i])) {\n donors.push(i);\n }\n }\n\n let remaining = wantedGrow;\n while (remaining > 0.001 && donors.length > 0) {\n const perDonor = remaining / donors.length;\n const exhausted: number[] = [];\n\n for (let d = 0; d < donors.length; d += 1) {\n const idx = donors[d];\n const canGive = result[idx] - getMin(panels[idx]);\n const take = Math.min(canGive, perDonor);\n result[idx] -= take;\n remaining -= take;\n if (canGive <= perDonor + 0.001) {\n exhausted.push(d);\n }\n }\n\n for (let i = exhausted.length - 1; i >= 0; i -= 1) {\n donors.splice(exhausted[i], 1);\n }\n\n if (exhausted.length === 0) {\n break;\n }\n }\n\n result[growIdx] += wantedGrow - remaining;\n } else if (delta < 0) {\n const growIdx = handleIndex + 1;\n const maxGrow = getMax(panels[growIdx]) - result[growIdx];\n const wantedGrow = Math.min(Math.abs(delta), maxGrow);\n\n const donors: number[] = [];\n for (let i = handleIndex; i >= 0; i -= 1) {\n if (result[i] > getMin(panels[i])) {\n donors.push(i);\n }\n }\n\n let remaining = wantedGrow;\n while (remaining > 0.001 && donors.length > 0) {\n const perDonor = remaining / donors.length;\n const exhausted: number[] = [];\n\n for (let d = 0; d < donors.length; d += 1) {\n const idx = donors[d];\n const canGive = result[idx] - getMin(panels[idx]);\n const take = Math.min(canGive, perDonor);\n result[idx] -= take;\n remaining -= take;\n if (canGive <= perDonor + 0.001) {\n exhausted.push(d);\n }\n }\n\n for (let i = exhausted.length - 1; i >= 0; i -= 1) {\n donors.splice(exhausted[i], 1);\n }\n\n if (exhausted.length === 0) {\n break;\n }\n }\n\n result[growIdx] += wantedGrow - remaining;\n }\n\n return result;\n}\n\nfunction applyConstraints(\n sizes: number[],\n panels: UseSplitterResolvedPanel[],\n handleIndex: number,\n delta: number,\n redistribute?: 'nearest' | 'equal' | UseSplitterRedistributeFn\n): number[] {\n if (typeof redistribute === 'function') {\n return redistribute({ sizes: [...sizes], panels, handleIndex, delta });\n }\n\n if (redistribute === 'nearest' || redistribute === 'equal') {\n const strategy = redistribute === 'nearest' ? redistributeNearest : redistributeEqual;\n const result = strategy(sizes, panels, handleIndex, delta);\n\n const beforeIdx = handleIndex;\n const afterIdx = handleIndex + 1;\n const beforePanel = panels[beforeIdx];\n const afterPanel = panels[afterIdx];\n\n if (\n beforePanel.collapsible &&\n result[beforeIdx] < getCollapseThreshold(beforePanel) &&\n result[beforeIdx] < sizes[beforeIdx]\n ) {\n const freed = result[beforeIdx];\n result[afterIdx] += freed;\n result[beforeIdx] = 0;\n } else if (\n afterPanel.collapsible &&\n result[afterIdx] < getCollapseThreshold(afterPanel) &&\n result[afterIdx] < sizes[afterIdx]\n ) {\n const freed = result[afterIdx];\n result[beforeIdx] += freed;\n result[afterIdx] = 0;\n }\n\n return result;\n }\n\n const collapsed = checkCollapse(sizes, panels, handleIndex, delta);\n if (collapsed) {\n return collapsed;\n }\n\n return applyAdjacentOnly(sizes, panels, handleIndex, delta);\n}\n\nexport function useSplitter<T extends HTMLElement = any>(\n options: UseSplitterOptions\n): UseSplitterReturnValue<T> {\n const {\n panels,\n orientation = 'horizontal',\n sizes: controlledSizes,\n onSizeChange,\n onCollapseChange,\n redistribute,\n step = 1,\n shiftStep = 10,\n dir = 'ltr',\n resetOnDoubleClick = true,\n enabled = true,\n } = options;\n\n const pixelMode = detectPixelMode(options);\n\n const defaultSizes = panels.map((panel) => panel.defaultSize);\n\n const [currentSizes, setCurrentSizes] = useUncontrolled<SplitterPaneSize[]>({\n value: controlledSizes,\n defaultValue: defaultSizes,\n finalValue: defaultSizes,\n onChange: onSizeChange,\n });\n\n const [activeHandle, setActiveHandle] = useState(-1);\n const [containerSize, setContainerSize] = useState(0);\n\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n const internalStateRef = useRef<SplitterInternalState>(createInitialInternalState());\n const containerRef = useRef<T | null>(null);\n const containerSizeRef = useRef(0);\n const rootFontSizeRef = useRef(16);\n const documentControllerRef = useRef<AbortController | null>(null);\n const frameRef = useRef(0);\n const currentSizesRef = useRef(currentSizes);\n currentSizesRef.current = currentSizes;\n\n const preCollapseSizesRef = useRef<SplitterPaneSize[]>(defaultSizes);\n\n const collapsed = currentSizes.map((size) => sizeMagnitude(size) === 0);\n\n const measureContainer = useCallback(() => {\n const node = containerRef.current;\n if (!node) {\n return 0;\n }\n const rect = node.getBoundingClientRect();\n return (optionsRef.current.orientation ?? 'horizontal') === 'horizontal'\n ? rect.width\n : rect.height;\n }, []);\n\n const updateSizes = useCallback(\n (newSizes: SplitterPaneSize[]) => {\n currentSizesRef.current = newSizes;\n setCurrentSizes(newSizes);\n },\n [setCurrentSizes]\n );\n\n const collapsePanel = useCallback(\n (panelIndex: number) => {\n if (!panels[panelIndex]?.collapsible) {\n return;\n }\n const raw = currentSizesRef.current;\n if (sizeMagnitude(raw[panelIndex]) === 0) {\n return;\n }\n\n const container = pixelMode ? containerSizeRef.current || measureContainer() : 0;\n const rootFontSize = rootFontSizeRef.current;\n const working = resolveWorkingSizes(raw, pixelMode, container, rootFontSize);\n\n preCollapseSizesRef.current = [...raw];\n const freedSize = working[panelIndex];\n working[panelIndex] = 0;\n\n const neighbor = panelIndex === 0 ? 1 : panelIndex - 1;\n working[neighbor] += freedSize;\n\n updateSizes(\n working.map((value, i) => encodeSize(value, raw[i], pixelMode, container, rootFontSize))\n );\n onCollapseChange?.(panelIndex, true);\n },\n [panels, pixelMode, measureContainer, updateSizes, onCollapseChange]\n );\n\n const expandPanel = useCallback(\n (panelIndex: number) => {\n if (!panels[panelIndex]?.collapsible) {\n return;\n }\n const raw = currentSizesRef.current;\n if (sizeMagnitude(raw[panelIndex]) !== 0) {\n return;\n }\n\n const container = pixelMode ? containerSizeRef.current || measureContainer() : 0;\n const rootFontSize = rootFontSizeRef.current;\n const working = resolveWorkingSizes(raw, pixelMode, container, rootFontSize);\n\n const preCollapse = preCollapseSizesRef.current;\n const restoreSource =\n preCollapse[panelIndex] != null && sizeMagnitude(preCollapse[panelIndex]) !== 0\n ? preCollapse[panelIndex]\n : panels[panelIndex].defaultSize;\n const restoreSize = resolveSize(restoreSource, pixelMode, container, rootFontSize);\n\n const neighbor = panelIndex === 0 ? 1 : panelIndex - 1;\n const neighborMin =\n panels[neighbor].min != null\n ? resolveSize(panels[neighbor].min!, pixelMode, container, rootFontSize)\n : 0;\n const available = Math.max(0, working[neighbor] - neighborMin);\n const actualRestore = Math.min(restoreSize, available);\n\n if (actualRestore <= 0) {\n return;\n }\n\n working[panelIndex] = actualRestore;\n working[neighbor] -= actualRestore;\n\n updateSizes(\n working.map((value, i) => encodeSize(value, raw[i], pixelMode, container, rootFontSize))\n );\n onCollapseChange?.(panelIndex, false);\n },\n [panels, pixelMode, measureContainer, updateSizes, onCollapseChange]\n );\n\n const toggleCollapsePanel = useCallback(\n (panelIndex: number) => {\n if (sizeMagnitude(currentSizesRef.current[panelIndex]) === 0) {\n expandPanel(panelIndex);\n } else {\n collapsePanel(panelIndex);\n }\n },\n [collapsePanel, expandPanel]\n );\n\n const emitCollapseTransitions = useCallback(\n (\n prev: SplitterPaneSize[],\n next: number[],\n indices: number[],\n preCollapseSnapshot: SplitterPaneSize[]\n ) => {\n const onChange = optionsRef.current.onCollapseChange;\n for (const idx of indices) {\n const wasCollapsed = sizeMagnitude(prev[idx]) === 0;\n const nowCollapsed = next[idx] === 0;\n if (!wasCollapsed && nowCollapsed) {\n preCollapseSizesRef.current = [...preCollapseSnapshot];\n onChange?.(idx, true);\n } else if (wasCollapsed && !nowCollapsed) {\n onChange?.(idx, false);\n }\n }\n },\n []\n );\n\n const reset = useCallback(\n (handleIndex: number) => {\n const raw = currentSizesRef.current;\n\n const beforeIdx = handleIndex;\n const afterIdx = handleIndex + 1;\n if (beforeIdx < 0 || afterIdx >= raw.length) {\n return;\n }\n\n const container = pixelMode ? containerSizeRef.current || measureContainer() : 0;\n const rootFontSize = rootFontSizeRef.current;\n const working = resolveWorkingSizes(raw, pixelMode, container, rootFontSize);\n const resolvedPanels = optionsRef.current.panels.map((panel) =>\n resolvePanel(panel, pixelMode, container, rootFontSize)\n );\n\n const total = working[beforeIdx] + working[afterIdx];\n const defBefore = resolvedPanels[beforeIdx].defaultSize;\n const defAfter = resolvedPanels[afterIdx].defaultSize;\n const defTotal = defBefore + defAfter;\n const targetBefore = defTotal === 0 ? total / 2 : total * (defBefore / defTotal);\n\n const next = applyAdjacentOnly(\n working,\n resolvedPanels,\n beforeIdx,\n targetBefore - working[beforeIdx]\n );\n emitCollapseTransitions(raw, next, [beforeIdx, afterIdx], raw);\n updateSizes(encodeWorkingSizes(next, working, raw, pixelMode, container, rootFontSize));\n },\n [emitCollapseTransitions, updateSizes, pixelMode, measureContainer]\n );\n\n const containerRefCallback: React.RefCallback<T | null> = useCallback((node) => {\n containerRef.current = node;\n }, []);\n\n useEffect(() => {\n if (!pixelMode || typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n\n const node = containerRef.current;\n if (!node) {\n return undefined;\n }\n\n let frame = 0;\n const update = () => {\n const rect = node.getBoundingClientRect();\n const size =\n (optionsRef.current.orientation ?? 'horizontal') === 'horizontal'\n ? rect.width\n : rect.height;\n rootFontSizeRef.current = getRootFontSize();\n containerSizeRef.current = size;\n setContainerSize((prev) => (prev !== size ? size : prev));\n };\n\n const observer = new ResizeObserver(() => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(update);\n });\n\n observer.observe(node);\n update();\n\n return () => {\n cancelAnimationFrame(frame);\n observer.disconnect();\n };\n }, [pixelMode, orientation]);\n\n const handleRefCallbacks = useRef<Map<number, (node: HTMLElement | null) => void>>(new Map());\n const handleElementControllers = useRef<Map<number, AbortController>>(new Map());\n\n const getHandleRefCallback = useCallback(\n (handleIndex: number): React.RefCallback<HTMLElement> => {\n if (handleRefCallbacks.current.has(handleIndex)) {\n return handleRefCallbacks.current.get(handleIndex)!;\n }\n\n const callback = (node: HTMLElement | null) => {\n const existingController = handleElementControllers.current.get(handleIndex);\n if (existingController) {\n existingController.abort();\n handleElementControllers.current.delete(handleIndex);\n }\n\n if (!node) {\n return;\n }\n\n const elementController = new AbortController();\n handleElementControllers.current.set(handleIndex, elementController);\n\n const onPointerDown = (event: PointerEvent) => {\n if (optionsRef.current.enabled === false) {\n return;\n }\n if (event.button !== 0) {\n return;\n }\n\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const opts = optionsRef.current;\n const isHorizontal = (opts.orientation ?? 'horizontal') === 'horizontal';\n const rect = container.getBoundingClientRect();\n const containerSizePx = isHorizontal ? rect.width : rect.height;\n const pointerPos = isHorizontal ? event.clientX : event.clientY;\n const isPixelMode = detectPixelMode(opts);\n const rootFontSize = getRootFontSize();\n\n const s = internalStateRef.current;\n s.isDragging = true;\n s.handleIndex = handleIndex;\n s.startPointer = pointerPos;\n s.containerSize = containerSizePx;\n s.rootFontSize = rootFontSize;\n s.pixelMode = isPixelMode;\n s.startRaw = [...currentSizesRef.current];\n s.startSizes = resolveWorkingSizes(\n s.startRaw,\n isPixelMode,\n containerSizePx,\n rootFontSize\n );\n s.preCollapseSizes = [...preCollapseSizesRef.current];\n\n setActiveHandle(handleIndex);\n document.body.style.userSelect = 'none';\n document.body.style.webkitUserSelect = 'none';\n document.body.style.cursor = isHorizontal ? 'col-resize' : 'row-resize';\n\n opts.onResizeStart?.(handleIndex);\n\n documentControllerRef.current?.abort();\n documentControllerRef.current = new AbortController();\n const sig = documentControllerRef.current.signal;\n\n document.addEventListener('pointermove', onPointerMove, { signal: sig });\n document.addEventListener('pointerup', onPointerUp, { signal: sig });\n document.addEventListener('pointercancel', onPointerUp, { signal: sig });\n };\n\n const flushResize = (pointerEvent: PointerEvent) => {\n const s = internalStateRef.current;\n if (!s.containerSize) {\n return;\n }\n const opts = optionsRef.current;\n const isHorizontal = (opts.orientation ?? 'horizontal') === 'horizontal';\n const isRtl = isHorizontal && opts.dir === 'rtl';\n const pointerPos = isHorizontal ? pointerEvent.clientX : pointerEvent.clientY;\n const pixelDelta = (isRtl ? -1 : 1) * (pointerPos - s.startPointer);\n const delta = s.pixelMode ? pixelDelta : (pixelDelta / s.containerSize) * 100;\n\n const resolvedPanels = opts.panels.map((panel) =>\n resolvePanel(panel, s.pixelMode, s.containerSize, s.rootFontSize)\n );\n\n const newSizes = applyConstraints(\n s.startSizes,\n resolvedPanels,\n s.handleIndex,\n delta,\n opts.redistribute\n );\n\n const prevSizes = currentSizesRef.current;\n emitCollapseTransitions(\n prevSizes,\n newSizes,\n [s.handleIndex, s.handleIndex + 1],\n s.startRaw\n );\n\n const encoded = encodeWorkingSizes(\n newSizes,\n s.startSizes,\n s.startRaw,\n s.pixelMode,\n s.containerSize,\n s.rootFontSize\n );\n currentSizesRef.current = encoded;\n setCurrentSizes(encoded);\n };\n\n const onPointerMove = (event: PointerEvent) => {\n const s = internalStateRef.current;\n if (!s.isDragging) {\n return;\n }\n\n cancelAnimationFrame(frameRef.current);\n frameRef.current = requestAnimationFrame(() => {\n flushResize(event);\n });\n };\n\n const onPointerUp = (event: PointerEvent) => {\n const s = internalStateRef.current;\n if (!s.isDragging) {\n return;\n }\n\n cancelAnimationFrame(frameRef.current);\n flushResize(event);\n\n s.isDragging = false;\n const finishedHandle = s.handleIndex;\n s.handleIndex = -1;\n\n setActiveHandle(-1);\n document.body.style.userSelect = '';\n document.body.style.webkitUserSelect = '';\n document.body.style.cursor = '';\n\n documentControllerRef.current?.abort();\n documentControllerRef.current = null;\n\n optionsRef.current.onResizeEnd?.(finishedHandle, [...currentSizesRef.current]);\n };\n\n node.addEventListener('pointerdown', onPointerDown, {\n signal: elementController.signal,\n });\n };\n\n handleRefCallbacks.current.set(handleIndex, callback);\n return callback;\n },\n [setCurrentSizes]\n );\n\n const getHandleProps = useCallback(\n (input: { index: number }) => {\n const { index } = input;\n const orient = orientation;\n const rootFontSize = rootFontSizeRef.current;\n const working = resolveWorkingSizes(currentSizes, pixelMode, containerSize, rootFontSize);\n const resolvedPanels = panels.map((panel) =>\n resolvePanel(panel, pixelMode, containerSize, rootFontSize)\n );\n const beforeSize = working[index] ?? 0;\n const beforePanel = resolvedPanels[index];\n\n return {\n ref: getHandleRefCallback(index),\n role: 'separator' as const,\n 'aria-orientation': orient,\n 'aria-valuenow': Math.round(beforeSize),\n 'aria-valuemin': Math.round(getMin(beforePanel)),\n 'aria-valuemax': Math.round(getMax(beforePanel)),\n tabIndex: 0,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (!enabled) {\n return;\n }\n\n const isHorizontal = orient === 'horizontal';\n const isRtl = dir === 'rtl';\n\n const container = pixelMode ? containerSizeRef.current || measureContainer() : 0;\n const liveRootFontSize = rootFontSizeRef.current;\n const liveWorking = resolveWorkingSizes(\n currentSizes,\n pixelMode,\n container,\n liveRootFontSize\n );\n const livePanels = panels.map((panel) =>\n resolvePanel(panel, pixelMode, container, liveRootFontSize)\n );\n const liveBeforePanel = livePanels[index];\n const liveAfterPanel = livePanels[index + 1];\n\n let delta = 0;\n const currentStep = resolveStep(\n event.shiftKey ? shiftStep : step,\n pixelMode,\n container,\n liveRootFontSize\n );\n\n switch (event.key) {\n case 'ArrowLeft': {\n if (!isHorizontal) {\n return;\n }\n delta = isRtl ? currentStep : -currentStep;\n break;\n }\n case 'ArrowRight': {\n if (!isHorizontal) {\n return;\n }\n delta = isRtl ? -currentStep : currentStep;\n break;\n }\n case 'ArrowUp': {\n if (isHorizontal) {\n return;\n }\n delta = -currentStep;\n break;\n }\n case 'ArrowDown': {\n if (isHorizontal) {\n return;\n }\n delta = currentStep;\n break;\n }\n case 'Home': {\n delta = -(liveWorking[index] - getMin(liveBeforePanel));\n break;\n }\n case 'End': {\n delta = getMax(liveBeforePanel) - liveWorking[index];\n break;\n }\n case 'Enter': {\n const beforeCollapsible = liveBeforePanel?.collapsible;\n const afterCollapsible = liveAfterPanel?.collapsible;\n\n if (beforeCollapsible && liveWorking[index] <= liveWorking[index + 1]) {\n toggleCollapsePanel(index);\n event.preventDefault();\n return;\n }\n if (afterCollapsible) {\n toggleCollapsePanel(index + 1);\n event.preventDefault();\n return;\n }\n if (beforeCollapsible) {\n toggleCollapsePanel(index);\n event.preventDefault();\n return;\n }\n return;\n }\n default:\n return;\n }\n\n event.preventDefault();\n\n if (delta !== 0) {\n const newSizes = applyConstraints(liveWorking, livePanels, index, delta, redistribute);\n emitCollapseTransitions(currentSizes, newSizes, [index, index + 1], currentSizes);\n updateSizes(\n encodeWorkingSizes(\n newSizes,\n liveWorking,\n currentSizes,\n pixelMode,\n container,\n liveRootFontSize\n )\n );\n }\n },\n onDoubleClick: () => {\n if (!enabled || !resetOnDoubleClick) {\n return;\n }\n reset(index);\n },\n 'data-active': activeHandle === index || undefined,\n 'data-orientation': orient,\n };\n },\n [\n orientation,\n currentSizes,\n panels,\n pixelMode,\n containerSize,\n enabled,\n dir,\n step,\n shiftStep,\n resetOnDoubleClick,\n activeHandle,\n redistribute,\n measureContainer,\n getHandleRefCallback,\n toggleCollapsePanel,\n updateSizes,\n emitCollapseTransitions,\n reset,\n ]\n );\n\n useEffect(\n () => () => {\n documentControllerRef.current?.abort();\n documentControllerRef.current = null;\n handleElementControllers.current.forEach((controller) => controller.abort());\n handleElementControllers.current.clear();\n cancelAnimationFrame(frameRef.current);\n\n if (internalStateRef.current.isDragging) {\n internalStateRef.current.isDragging = false;\n document.body.style.userSelect = '';\n document.body.style.webkitUserSelect = '';\n document.body.style.cursor = '';\n }\n },\n []\n );\n\n return {\n ref: containerRefCallback,\n sizes: currentSizes,\n pixelMode,\n collapsed,\n activeHandle,\n getHandleProps,\n setSizes: updateSizes,\n collapse: collapsePanel,\n expand: expandPanel,\n toggleCollapse: toggleCollapsePanel,\n reset,\n };\n}\n\nexport namespace useSplitter {\n export type Panel = UseSplitterPanel;\n export type Options = UseSplitterOptions;\n export type RedistributeInput = UseSplitterRedistributeInput;\n export type RedistributeFn = UseSplitterRedistributeFn;\n export type ResolvedPanel = UseSplitterResolvedPanel;\n export type ReturnValue<T extends HTMLElement = any> = UseSplitterReturnValue<T>;\n export type PaneSize = SplitterPaneSize;\n export type Step = SplitterStep;\n}\n"],"mappings":";;;;AA6HA,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,aAAa;AAEnB,SAAS,YAAY,MAA6C;CAChE,OAAO,OAAO,SAAS,aAAa,MAAM,KAAK,IAAI,KAAK,OAAO,KAAK,IAAI;AAC1E;AAEA,SAAS,cAAc,MAAgC;CACrD,OAAO,OAAO,SAAS,WAAW,OAAO,WAAW,IAAI;AAC1D;AAEA,SAAS,gBAAgB,SAAsC;CAC7D,OACE,QAAQ,OAAO,MACZ,UACC,YAAY,MAAM,WAAW,KAC7B,YAAY,MAAM,GAAG,KACrB,YAAY,MAAM,GAAG,KACrB,YAAY,MAAM,iBAAiB,CACvC,KACA,YAAY,QAAQ,IAAI,KACxB,YAAY,QAAQ,SAAS,MAC5B,QAAQ,OAAO,KAAK,WAAW,KAAK;AAEzC;AAEA,SAAS,kBAA0B;CACjC,IAAI,OAAO,WAAW,aACpB,OAAO;CAET,MAAM,WAAW,WAAW,iBAAiB,SAAS,eAAe,CAAC,CAAC,QAAQ;CAC/E,OAAO,OAAO,SAAS,QAAQ,KAAK,WAAW,IAAI,WAAW;AAChE;AAEA,SAAS,YACP,MACA,WACA,aACA,cACQ;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