react-resizable-panels 3.0.6 → 4.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +253 -250
- package/dist/react-resizable-panels.cjs +2 -0
- package/dist/react-resizable-panels.cjs.map +1 -0
- package/dist/react-resizable-panels.d.ts +316 -2
- package/dist/react-resizable-panels.js +1050 -2371
- package/dist/react-resizable-panels.js.map +1 -0
- package/package.json +94 -66
- package/dist/declarations/src/Panel.d.ts +0 -70
- package/dist/declarations/src/PanelGroup.d.ts +0 -38
- package/dist/declarations/src/PanelResizeHandle.d.ts +0 -23
- package/dist/declarations/src/PanelResizeHandleRegistry.d.ts +0 -19
- package/dist/declarations/src/constants.d.ts +0 -15
- package/dist/declarations/src/hooks/usePanelGroupContext.d.ts +0 -4
- package/dist/declarations/src/index.d.ts +0 -23
- package/dist/declarations/src/types.d.ts +0 -3
- package/dist/declarations/src/utils/assert.d.ts +0 -1
- package/dist/declarations/src/utils/csp.d.ts +0 -2
- package/dist/declarations/src/utils/cursor.d.ts +0 -18
- package/dist/declarations/src/utils/dom/getPanelElement.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getPanelElementsForGroup.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getPanelGroupElement.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElement.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElementIndex.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElementsForGroup.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandlePanelIds.d.ts +0 -2
- package/dist/declarations/src/utils/rects/getIntersectingRectangle.d.ts +0 -2
- package/dist/declarations/src/utils/rects/intersects.d.ts +0 -2
- package/dist/declarations/src/utils/rects/types.d.ts +0 -6
- package/dist/react-resizable-panels.browser.development.js +0 -2592
- package/dist/react-resizable-panels.browser.js +0 -2486
- package/dist/react-resizable-panels.development.edge-light.js +0 -2365
- package/dist/react-resizable-panels.development.js +0 -2599
- package/dist/react-resizable-panels.edge-light.js +0 -2264
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-resizable-panels.js","sources":["../lib/global/styles/convertEmToPixels.ts","../lib/global/styles/convertRemToPixels.ts","../lib/global/styles/convertVhToPixels.ts","../lib/global/styles/convertVwToPixels.ts","../lib/global/styles/parseSizeAndUnit.ts","../lib/global/styles/sizeStyleToPixels.ts","../lib/global/utils/formatLayoutNumber.ts","../lib/global/dom/calculateAvailableGroupSize.ts","../lib/global/dom/calculatePanelConstraints.ts","../lib/utils/EventEmitter.ts","../lib/global/mutableState.ts","../lib/constants.ts","../lib/global/dom/calculateHitRegions.ts","../lib/global/utils/getDistanceBetweenPointAndRect.ts","../lib/global/utils/findClosetHitRegion.ts","../lib/global/utils/isCoarsePointer.ts","../lib/global/utils/findMatchingHitRegions.ts","../lib/global/pointer-events/onPointerDown.ts","../lib/global/cursor/getCursorStyle.ts","../lib/global/cursor/updateCursorStyle.ts","../lib/utils/assert.ts","../lib/utils/isArrayEqual.ts","../lib/global/utils/layoutNumbersEqual.ts","../lib/global/utils/compareLayoutNumbers.ts","../lib/global/utils/validatePanelSize.ts","../lib/global/utils/adjustLayoutByDelta.ts","../lib/global/utils/layoutsEqual.ts","../lib/global/pointer-events/onPointerMove.ts","../lib/global/pointer-events/onPointerUp.ts","../lib/global/utils/calculateDefaultLayout.ts","../lib/global/utils/notifySeparator.ts","../lib/global/utils/validatePanelGroupLayout.ts","../lib/global/mountGroup.ts","../lib/hooks/useId.ts","../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/hooks/useStableCallback.ts","../lib/hooks/useMergedRefs.ts","../lib/components/panel/constants.ts","../lib/components/group/getPanelSizeCssPropertyName.ts","../lib/components/group/GroupContext.ts","../lib/components/group/sortByElementOffset.ts","../lib/global/utils/getImperativeGroupMethods.ts","../lib/components/group/useGroupImperativeHandle.ts","../lib/components/group/Group.tsx","../lib/components/group/auto-save/getStorageKey.ts","../lib/components/group/auto-save/loadGroupLayout.ts","../lib/components/group/auto-save/saveGroupLayout.ts","../lib/components/group/useDefaultLayout.ts","../lib/components/group/useGroupCallbackRef.ts","../lib/components/group/useGroupRef.ts","../lib/components/group/useGroupContext.ts","../lib/global/utils/getImperativePanelMethods.ts","../lib/components/panel/usePanelImperativeHandle.ts","../lib/components/panel/Panel.tsx","../lib/components/panel/usePanelCallbackRef.ts","../lib/components/panel/usePanelRef.ts","../lib/components/separator/Separator.tsx"],"sourcesContent":["export function convertEmToPixels(element: Element, value: number) {\n const style = getComputedStyle(element);\n const fontSize = parseFloat(style.fontSize);\n\n return value * fontSize;\n}\n","export function convertRemToPixels(element: Element, value: number) {\n const style = getComputedStyle(element.ownerDocument.body);\n const fontSize = parseFloat(style.fontSize);\n\n return value * fontSize;\n}\n","export function convertVhToPixels(value: number) {\n return (value / 100) * window.innerHeight;\n}\n","export function convertVwToPixels(value: number) {\n return (value / 100) * window.innerWidth;\n}\n","import type { SizeUnit } from \"../../components/panel/types\";\n\nexport function parseSizeAndUnit(\n size: number | string\n): [numeric: number, size: SizeUnit] {\n switch (typeof size) {\n case \"number\": {\n return [size, \"px\"];\n }\n case \"string\": {\n const numeric = parseFloat(size);\n\n if (size.endsWith(\"%\")) {\n return [numeric, \"%\"];\n } else if (size.endsWith(\"px\")) {\n return [numeric, \"px\"];\n } else if (size.endsWith(\"rem\")) {\n return [numeric, \"rem\"];\n } else if (size.endsWith(\"em\")) {\n return [numeric, \"em\"];\n } else if (size.endsWith(\"vh\")) {\n return [numeric, \"vh\"];\n } else if (size.endsWith(\"vw\")) {\n return [numeric, \"vw\"];\n }\n\n return [numeric, \"%\"];\n }\n }\n}\n","import { convertEmToPixels } from \"./convertEmToPixels\";\nimport { convertRemToPixels } from \"./convertRemToPixels\";\nimport { convertVhToPixels } from \"./convertVhToPixels\";\nimport { convertVwToPixels } from \"./convertVwToPixels\";\nimport { parseSizeAndUnit } from \"./parseSizeAndUnit\";\n\nexport function sizeStyleToPixels({\n groupSize,\n panelElement,\n styleProp\n}: {\n groupSize: number;\n panelElement: HTMLElement;\n styleProp: number | string;\n}) {\n let pixels: number | undefined = undefined;\n\n const [size, unit] = parseSizeAndUnit(styleProp);\n\n switch (unit) {\n case \"%\": {\n pixels = (size / 100) * groupSize;\n break;\n }\n case \"px\": {\n pixels = size;\n break;\n }\n case \"rem\": {\n pixels = convertRemToPixels(panelElement, size);\n break;\n }\n case \"em\": {\n pixels = convertEmToPixels(panelElement, size);\n break;\n }\n case \"vh\": {\n pixels = convertVhToPixels(size);\n break;\n }\n case \"vw\": {\n pixels = convertVwToPixels(size);\n break;\n }\n }\n\n return pixels;\n}\n","export function formatLayoutNumber(number: number) {\n return parseFloat(number.toFixed(3));\n}\n","import type { RegisteredGroup } from \"../../components/group/types\";\n\nexport function calculateAvailableGroupSize({\n group\n}: {\n group: RegisteredGroup;\n}) {\n const { direction, panels } = group;\n\n return panels.reduce((totalSize, panel) => {\n totalSize +=\n direction === \"horizontal\"\n ? panel.element.offsetWidth\n : panel.element.offsetHeight;\n return totalSize;\n }, 0);\n}\n","import type { RegisteredGroup } from \"../../components/group/types\";\nimport type { PanelConstraints } from \"../../components/panel/types\";\nimport { sizeStyleToPixels } from \"../styles/sizeStyleToPixels\";\nimport { formatLayoutNumber } from \"../utils/formatLayoutNumber\";\nimport { calculateAvailableGroupSize } from \"./calculateAvailableGroupSize\";\n\nexport function calculatePanelConstraints(group: RegisteredGroup) {\n const { panels } = group;\n\n const groupSize = calculateAvailableGroupSize({ group });\n\n return panels.map<PanelConstraints>((panel) => {\n const { element, panelConstraints } = panel;\n\n let collapsedSize = 0;\n if (panelConstraints.collapsedSize) {\n const pixels = sizeStyleToPixels({\n groupSize,\n panelElement: element,\n styleProp: panelConstraints.collapsedSize\n });\n\n collapsedSize = formatLayoutNumber((pixels / groupSize) * 100);\n }\n\n let defaultSize: number | undefined = undefined;\n if (panelConstraints.defaultSize) {\n const pixels = sizeStyleToPixels({\n groupSize,\n panelElement: element,\n styleProp: panelConstraints.defaultSize\n });\n\n defaultSize = formatLayoutNumber((pixels / groupSize) * 100);\n }\n\n let minSize = 0;\n if (panelConstraints.minSize) {\n const pixels = sizeStyleToPixels({\n groupSize,\n panelElement: element,\n styleProp: panelConstraints.minSize\n });\n\n minSize = formatLayoutNumber((pixels / groupSize) * 100);\n }\n\n let maxSize = 100;\n if (panelConstraints.maxSize) {\n const pixels = sizeStyleToPixels({\n groupSize,\n panelElement: element,\n styleProp: panelConstraints.maxSize\n });\n\n maxSize = formatLayoutNumber((pixels / groupSize) * 100);\n }\n\n return {\n collapsedSize,\n collapsible: panelConstraints.collapsible === true,\n defaultSize,\n minSize,\n maxSize,\n panelId: panel.id\n };\n });\n}\n","export type EventMap = {\n [key: string]: unknown;\n};\n\nexport type EventListener<Data> = (data: Data) => void;\n\nexport class EventEmitter<Events extends EventMap> {\n #listenerMap: {\n [Key in keyof Events]?: EventListener<Events[Key]>[];\n } = {};\n\n addListener<Type extends keyof Events>(\n type: Type,\n listener: EventListener<Events[Type]>\n ) {\n const listeners = this.#listenerMap[type];\n if (listeners === undefined) {\n this.#listenerMap[type] = [listener];\n } else {\n if (!listeners.includes(listener)) {\n listeners.push(listener);\n }\n }\n\n return () => {\n this.removeListener(type, listener);\n };\n }\n\n emit<Type extends keyof Events>(type: Type, data: Events[Type]) {\n const listeners = this.#listenerMap[type];\n if (listeners !== undefined) {\n if (listeners.length === 1) {\n const listener = listeners[0];\n listener.call(null, data);\n } else {\n let didThrow = false;\n let caughtError = null;\n\n // Clone the current listeners before calling\n // in case calling triggers listeners to be added or removed\n const clonedListeners = Array.from(listeners);\n for (let i = 0; i < clonedListeners.length; i++) {\n const listener = clonedListeners[i];\n try {\n listener.call(null, data);\n } catch (error) {\n if (caughtError === null) {\n didThrow = true;\n caughtError = error;\n }\n }\n }\n\n if (didThrow) {\n throw caughtError;\n }\n }\n }\n }\n\n removeAllListeners() {\n this.#listenerMap = {};\n }\n\n removeListener<Type extends keyof Events>(\n type: Type,\n listener: EventListener<Events[Type]>\n ) {\n const listeners = this.#listenerMap[type];\n if (listeners !== undefined) {\n const index = listeners.indexOf(listener);\n if (index >= 0) {\n listeners.splice(index, 1);\n }\n }\n }\n}\n","import type { Layout, RegisteredGroup } from \"../components/group/types\";\nimport type { PanelConstraints } from \"../components/panel/types\";\nimport { EventEmitter } from \"../utils/EventEmitter\";\nimport type { InteractionState } from \"./types\";\n\ntype UpdaterFunction = (prevState: State) => Partial<State>;\n\nexport type MountedGroupMap = Map<\n RegisteredGroup,\n {\n derivedPanelConstraints: PanelConstraints[];\n layout: Layout;\n }\n>;\n\ntype Events = {\n cursorFlagsChange: number;\n interactionStateChange: InteractionState;\n mountedGroupsChange: MountedGroupMap;\n};\n\ntype State = {\n cursorFlags: number;\n interactionState: InteractionState;\n mountedGroups: MountedGroupMap;\n};\n\nlet state: State = {\n cursorFlags: 0,\n interactionState: {\n state: \"inactive\"\n },\n mountedGroups: new Map()\n};\n\nexport const eventEmitter = new EventEmitter<Events>();\n\nexport function read(): State {\n return state;\n}\n\nexport function update(value: Partial<State> | UpdaterFunction) {\n const partialState = typeof value === \"function\" ? value(state) : value;\n if (state === partialState) {\n return state;\n }\n\n state = {\n ...state,\n ...partialState\n };\n\n if (partialState.cursorFlags !== undefined) {\n eventEmitter.emit(\"cursorFlagsChange\", state.cursorFlags);\n }\n\n if (partialState.interactionState !== undefined) {\n eventEmitter.emit(\"interactionStateChange\", state.interactionState);\n }\n\n if (partialState.mountedGroups !== undefined) {\n eventEmitter.emit(\"mountedGroupsChange\", state.mountedGroups);\n }\n\n return state;\n}\n","// Constants used for memoization\nexport const EMPTY_ARRAY: unknown[] = [];\nexport const EMPTY_DOM_RECT: DOMRectReadOnly = {\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n toJSON: () => {},\n top: 0,\n width: 0,\n x: 0,\n y: 0\n};\nexport const EMPTY_OBJECT = {};\nexport const EMPTY_POINT = { x: 0, y: 0 };\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const IDENTITY_FUNCTION = (value: any) => value;\nexport const NOOP_FUNCTION = () => {};\n\n// Cursor flags\nexport const CURSOR_FLAG_HORIZONTAL_MIN = 0b0001;\nexport const CURSOR_FLAG_HORIZONTAL_MAX = 0b0010;\nexport const CURSOR_FLAG_VERTICAL_MIN = 0b0100;\nexport const CURSOR_FLAG_VERTICAL_MAX = 0b1000;\n\n// Misc. shared values\nexport const DEFAULT_POINTER_PRECISION = {\n coarse: 10,\n precise: 5\n};\n","import type { RegisteredGroup } from \"../../components/group/types\";\nimport type { RegisteredPanel } from \"../../components/panel/types\";\nimport type { RegisteredSeparator } from \"../../components/separator/types\";\n\nexport type HitRegion = {\n group: RegisteredGroup;\n panels: [panel: RegisteredPanel, panel: RegisteredPanel];\n rect: DOMRect;\n separator: RegisteredSeparator | undefined;\n};\n\n/**\n * Determines hit regions for a Group; a hit region is either:\n * - 1: An explicit Separator element\n * - 2: The edge of a Panel element that has another Panel beside it\n *\n * This method determines bounding rects of all regions for the particular group.\n */\nexport function calculateHitRegions(group: RegisteredGroup) {\n const { direction, element: groupElement, panels, separators } = group;\n\n // Sort elements by offset before traversing\n const sortedChildElements: HTMLElement[] = Array.from(groupElement.children)\n .filter((child) => child instanceof HTMLElement)\n .sort((a, b) => {\n const rectA = a.getBoundingClientRect();\n const rectB = b.getBoundingClientRect();\n\n return direction === \"horizontal\"\n ? rectA.left - rectB.left\n : rectA.top - rectB.top;\n });\n\n const hitRegions: HitRegion[] = [];\n\n let prevPanel: RegisteredPanel | undefined = undefined;\n let prevSeparator: RegisteredSeparator | undefined = undefined;\n\n for (const childElement of sortedChildElements) {\n const panelData = panels.find(\n (current) => current.element === childElement\n );\n if (panelData) {\n if (prevPanel) {\n const prevRect = prevPanel.element.getBoundingClientRect();\n const rect = childElement.getBoundingClientRect();\n\n hitRegions.push({\n group,\n panels: [prevPanel, panelData],\n separator: prevSeparator,\n rect:\n direction === \"horizontal\"\n ? new DOMRect(\n prevRect.right,\n rect.top,\n rect.left - prevRect.right,\n rect.height\n )\n : new DOMRect(\n rect.left,\n prevRect.bottom,\n rect.width,\n rect.top - prevRect.bottom\n )\n });\n }\n\n prevPanel = panelData;\n } else {\n const separatorData = separators.find(\n (current) => current.element === childElement\n );\n if (separatorData) {\n // No-op; this area will be included by default when closing the next panel\n prevSeparator = separatorData;\n } else {\n prevPanel = undefined;\n prevSeparator = undefined;\n }\n }\n }\n\n return hitRegions;\n}\n","import type { Point } from \"../../types\";\n\nexport function getDistanceBetweenPointAndRect(\n point: Point,\n rect: DOMRectReadOnly\n) {\n return {\n x:\n point.x >= rect.left && point.x <= rect.right\n ? 0\n : Math.min(\n Math.abs(point.x - rect.left),\n Math.abs(point.x - rect.right)\n ),\n y:\n point.y >= rect.top && point.y <= rect.bottom\n ? 0\n : Math.min(\n Math.abs(point.y - rect.top),\n Math.abs(point.y - rect.bottom)\n )\n };\n}\n","import type { Direction } from \"../../components/group/types\";\nimport type { Point } from \"../../types\";\nimport type { HitRegion } from \"../dom/calculateHitRegions\";\nimport { getDistanceBetweenPointAndRect } from \"./getDistanceBetweenPointAndRect\";\n\nexport function findClosetHitRegion(\n direction: Direction,\n hitRegions: HitRegion[],\n point: Point\n) {\n let closestHitRegion: HitRegion | undefined = undefined;\n let minDistance = {\n x: Infinity,\n y: Infinity\n };\n\n for (const hitRegion of hitRegions) {\n const data = getDistanceBetweenPointAndRect(point, hitRegion.rect);\n switch (direction) {\n case \"horizontal\": {\n if (data.x <= minDistance.x) {\n closestHitRegion = hitRegion;\n minDistance = data;\n }\n break;\n }\n case \"vertical\": {\n if (data.y <= minDistance.y) {\n closestHitRegion = hitRegion;\n minDistance = data;\n }\n break;\n }\n }\n }\n\n return closestHitRegion\n ? {\n distance: minDistance,\n hitRegion: closestHitRegion\n }\n : undefined;\n}\n","let cached: boolean | undefined = undefined;\n\nexport function isCoarsePointer(): boolean {\n if (cached === undefined) {\n if (typeof matchMedia === \"function\") {\n cached = !!matchMedia(\"(pointer:coarse)\").matches;\n } else {\n cached = false;\n }\n }\n\n return cached;\n}\n","import { DEFAULT_POINTER_PRECISION } from \"../../constants\";\nimport type { MountedGroupMap } from \"../mutableState\";\nimport {\n calculateHitRegions,\n type HitRegion\n} from \"../dom/calculateHitRegions\";\nimport { findClosetHitRegion } from \"./findClosetHitRegion\";\nimport { isCoarsePointer } from \"./isCoarsePointer\";\n\nexport function findMatchingHitRegions(\n event: PointerEvent,\n mountedGroups: MountedGroupMap\n): HitRegion[] {\n const matchingHitRegions: HitRegion[] = [];\n\n mountedGroups.forEach((_, groupData) => {\n if (groupData.disabled) {\n return;\n }\n\n const maxDistance = isCoarsePointer()\n ? DEFAULT_POINTER_PRECISION.coarse\n : DEFAULT_POINTER_PRECISION.precise;\n\n const hitRegions = calculateHitRegions(groupData);\n const match = findClosetHitRegion(groupData.direction, hitRegions, {\n x: event.clientX,\n y: event.clientY\n });\n\n if (\n match &&\n match.distance.x <= maxDistance &&\n match.distance.y <= maxDistance\n ) {\n matchingHitRegions.push(match.hitRegion);\n }\n });\n\n return matchingHitRegions;\n}\n","import type { Layout, RegisteredGroup } from \"../../components/group/types\";\nimport type { RegisteredPanel } from \"../../components/panel/types\";\nimport type { RegisteredSeparator } from \"../../components/separator/types\";\nimport { read, update } from \"../mutableState\";\nimport { findMatchingHitRegions } from \"../utils/findMatchingHitRegions\";\n\nexport function onPointerDown(event: PointerEvent) {\n if (event.defaultPrevented) {\n return;\n }\n\n const { mountedGroups } = read();\n\n const hitRegions = findMatchingHitRegions(event, mountedGroups);\n\n const groups = new Set<RegisteredGroup>();\n const panels = new Set<RegisteredPanel>();\n const separators = new Set<RegisteredSeparator>();\n const initialLayoutMap = new Map<RegisteredGroup, Layout>();\n\n hitRegions.forEach((current) => {\n groups.add(current.group);\n current.panels.forEach((panel) => {\n panels.add(panel);\n });\n if (current.separator) {\n separators.add(current.separator);\n }\n\n const match = mountedGroups.get(current.group);\n if (match) {\n initialLayoutMap.set(current.group, match.layout);\n }\n });\n\n update({\n interactionState: {\n hitRegions,\n initialLayoutMap,\n pointerDownAtPoint: { x: event.clientX, y: event.clientY },\n state: \"active\"\n }\n });\n\n if (hitRegions.length) {\n event.preventDefault();\n }\n}\n","import type { Properties } from \"csstype\";\nimport type { RegisteredGroup } from \"../../components/group/types\";\nimport {\n CURSOR_FLAG_HORIZONTAL_MAX,\n CURSOR_FLAG_HORIZONTAL_MIN,\n CURSOR_FLAG_VERTICAL_MAX,\n CURSOR_FLAG_VERTICAL_MIN\n} from \"../../constants\";\nimport type { InteractionState } from \"../types\";\n\nexport function getCursorStyle({\n cursorFlags,\n groups,\n state\n}: {\n cursorFlags: number;\n groups: RegisteredGroup[];\n state: InteractionState[\"state\"];\n}): Properties[\"cursor\"] | null {\n let horizontalCount = 0;\n let verticalCount = 0;\n\n switch (state) {\n case \"active\":\n case \"hover\": {\n groups.forEach((group) => {\n if (group.disableCursor) {\n return;\n }\n\n switch (group.direction) {\n case \"horizontal\": {\n horizontalCount++;\n break;\n }\n case \"vertical\": {\n verticalCount++;\n break;\n }\n }\n });\n }\n }\n\n if (horizontalCount === 0 && verticalCount === 0) {\n return null;\n }\n\n switch (state) {\n case \"active\": {\n const horizontalMin = (cursorFlags & CURSOR_FLAG_HORIZONTAL_MIN) !== 0;\n const horizontalMax = (cursorFlags & CURSOR_FLAG_HORIZONTAL_MAX) !== 0;\n const verticalMin = (cursorFlags & CURSOR_FLAG_VERTICAL_MIN) !== 0;\n const verticalMax = (cursorFlags & CURSOR_FLAG_VERTICAL_MAX) !== 0;\n\n if (cursorFlags) {\n if (horizontalMin) {\n if (verticalMin) {\n return \"se-resize\";\n } else if (verticalMax) {\n return \"ne-resize\";\n } else {\n return \"e-resize\";\n }\n } else if (horizontalMax) {\n if (verticalMin) {\n return \"sw-resize\";\n } else if (verticalMax) {\n return \"nw-resize\";\n } else {\n return \"w-resize\";\n }\n } else if (verticalMin) {\n return \"s-resize\";\n } else if (verticalMax) {\n return \"n-resize\";\n }\n }\n break;\n }\n }\n\n if (horizontalCount > 0 && verticalCount > 0) {\n return \"move\";\n } else if (horizontalCount > 0) {\n return \"ew-resize\";\n } else {\n return \"ns-resize\";\n }\n}\n","import type { Properties } from \"csstype\";\nimport { read } from \"../mutableState\";\nimport { getCursorStyle } from \"./getCursorStyle\";\n\nlet prevCursor: Properties[\"cursor\"] | null = null;\nlet styleSheet: CSSStyleSheet | undefined = undefined;\n\nexport function updateCursorStyle() {\n if (styleSheet === undefined) {\n styleSheet = new CSSStyleSheet();\n\n document.adoptedStyleSheets = [styleSheet];\n }\n\n const { cursorFlags, interactionState } = read();\n\n switch (interactionState.state) {\n case \"active\":\n case \"hover\": {\n const style = getCursorStyle({\n cursorFlags,\n groups: interactionState.hitRegions.map((current) => current.group),\n state: interactionState.state\n });\n\n if (prevCursor === style) {\n return;\n }\n\n prevCursor = style;\n\n if (style) {\n if (styleSheet.cssRules.length === 0) {\n styleSheet.insertRule(`*{cursor: ${style} !important;}`);\n } else {\n styleSheet.replaceSync(`*{cursor: ${style} !important;}`);\n }\n } else if (styleSheet.cssRules.length === 1) {\n styleSheet.deleteRule(0);\n }\n break;\n }\n case \"inactive\": {\n prevCursor = null;\n\n if (styleSheet.cssRules.length === 1) {\n styleSheet.deleteRule(0);\n }\n break;\n }\n }\n}\n","export function assert(\n expectedCondition: unknown,\n message: string = \"Assertion error\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","export function isArrayEqual(a: number[], b: number[]) {\n if (a.length !== b.length) {\n return false;\n } else {\n for (let index = 0; index < a.length; index++) {\n if (a[index] != b[index]) {\n return false;\n }\n }\n }\n return true;\n}\n","import { formatLayoutNumber } from \"./formatLayoutNumber\";\n\nexport function layoutNumbersEqual(\n actual: number,\n expected: number,\n minimumDelta = 0\n) {\n return (\n Math.abs(formatLayoutNumber(actual) - formatLayoutNumber(expected)) <=\n minimumDelta\n );\n}\n","import { layoutNumbersEqual } from \"./layoutNumbersEqual\";\n\nexport function compareLayoutNumbers(actual: number, expected: number) {\n if (layoutNumbersEqual(actual, expected)) {\n return 0;\n } else {\n return actual > expected ? 1 : -1;\n }\n}\n","import type { PanelConstraints } from \"../../components/panel/types\";\nimport { compareLayoutNumbers } from \"./compareLayoutNumbers\";\nimport { formatLayoutNumber } from \"./formatLayoutNumber\";\n\n// Panel size must be in percentages; pixel values should be pre-converted\nexport function validatePanelSize({\n panelConstraints,\n size\n}: {\n panelConstraints: PanelConstraints;\n size: number;\n}) {\n const {\n collapsedSize = 0,\n collapsible,\n maxSize = 100,\n minSize = 0\n } = panelConstraints;\n\n if (compareLayoutNumbers(size, minSize) < 0) {\n if (collapsible) {\n // Collapsible panels should snap closed or open only once they cross the halfway point between collapsed and min size.\n const halfwayPoint = (collapsedSize + minSize) / 2;\n if (compareLayoutNumbers(size, halfwayPoint) < 0) {\n size = collapsedSize;\n } else {\n size = minSize;\n }\n } else {\n size = minSize;\n }\n }\n\n size = Math.min(maxSize, size);\n size = formatLayoutNumber(size);\n\n return size;\n}\n","import type { Layout } from \"../../components/group/types\";\nimport type { PanelConstraints } from \"../../components/panel/types\";\nimport { assert } from \"../../utils/assert\";\nimport { isArrayEqual } from \"../../utils/isArrayEqual\";\nimport { compareLayoutNumbers } from \"../utils/compareLayoutNumbers\";\nimport { layoutNumbersEqual } from \"../utils/layoutNumbersEqual\";\nimport { validatePanelSize } from \"../utils/validatePanelSize\";\n\n// All units must be in percentages; pixel values should be pre-converted\nexport function adjustLayoutByDelta({\n delta,\n initialLayout: initialLayoutProp,\n panelConstraints: panelConstraintsArray,\n pivotIndices,\n prevLayout: prevLayoutProp,\n trigger\n}: {\n delta: number;\n initialLayout: Layout;\n panelConstraints: PanelConstraints[];\n pivotIndices: number[];\n prevLayout: Layout;\n trigger: \"imperative-api\" | \"keyboard\" | \"mouse-or-touch\";\n}): Layout {\n if (layoutNumbersEqual(delta, 0)) {\n return initialLayoutProp;\n }\n\n const initialLayout = Object.values(initialLayoutProp);\n const prevLayout = Object.values(prevLayoutProp);\n const nextLayout = [...initialLayout];\n\n const [firstPivotIndex, secondPivotIndex] = pivotIndices;\n assert(firstPivotIndex != null, \"Invalid first pivot index\");\n assert(secondPivotIndex != null, \"Invalid second pivot index\");\n\n let deltaApplied = 0;\n\n // const DEBUG = [];\n // DEBUG.push(`adjustLayoutByDelta()`);\n // DEBUG.push(` initialLayout: ${initialLayout.join(\", \")}`);\n // DEBUG.push(` prevLayout: ${prevLayout.join(\", \")}`);\n // DEBUG.push(` delta: ${delta}`);\n // DEBUG.push(` pivotIndices: ${pivotIndices.join(\", \")}`);\n // DEBUG.push(` trigger: ${trigger}`);\n // DEBUG.push(\"\");\n\n // A resizing panel affects the panels before or after it.\n //\n // A negative delta means the panel(s) immediately after the separator should grow/expand by decreasing its offset.\n // Other panels may also need to shrink/contract (and shift) to make room, depending on the min weights.\n //\n // A positive delta means the panel(s) immediately before the separator should \"expand\".\n // This is accomplished by shrinking/contracting (and shifting) one or more of the panels after the separator.\n\n {\n // If this is a resize triggered by a keyboard event, our logic for expanding/collapsing is different.\n // We no longer check the halfway threshold because this may prevent the panel from expanding at all.\n if (trigger === \"keyboard\") {\n {\n // Check if we should expand a collapsed panel\n const index = delta < 0 ? secondPivotIndex : firstPivotIndex;\n const panelConstraints = panelConstraintsArray[index];\n assert(\n panelConstraints,\n `Panel constraints not found for index ${index}`\n );\n\n const {\n collapsedSize = 0,\n collapsible,\n minSize = 0\n } = panelConstraints;\n\n // DEBUG.push(`edge case check 1: ${index}`);\n // DEBUG.push(` -> collapsible? ${collapsible}`);\n if (collapsible) {\n const prevSize = initialLayout[index];\n assert(\n prevSize != null,\n `Previous layout not found for panel index ${index}`\n );\n\n if (layoutNumbersEqual(prevSize, collapsedSize)) {\n const localDelta = minSize - prevSize;\n // DEBUG.push(` -> expand delta: ${localDelta}`);\n\n if (compareLayoutNumbers(localDelta, Math.abs(delta)) > 0) {\n delta = delta < 0 ? 0 - localDelta : localDelta;\n // DEBUG.push(` -> delta: ${delta}`);\n }\n }\n }\n }\n\n {\n // Check if we should collapse a panel at its minimum size\n const index = delta < 0 ? firstPivotIndex : secondPivotIndex;\n const panelConstraints = panelConstraintsArray[index];\n assert(\n panelConstraints,\n `No panel constraints found for index ${index}`\n );\n\n const {\n collapsedSize = 0,\n collapsible,\n minSize = 0\n } = panelConstraints;\n\n // DEBUG.push(`edge case check 2: ${index}`);\n // DEBUG.push(` -> collapsible? ${collapsible}`);\n if (collapsible) {\n const prevSize = initialLayout[index];\n assert(\n prevSize != null,\n `Previous layout not found for panel index ${index}`\n );\n\n if (layoutNumbersEqual(prevSize, minSize)) {\n const localDelta = prevSize - collapsedSize;\n // DEBUG.push(` -> expand delta: ${localDelta}`);\n\n if (compareLayoutNumbers(localDelta, Math.abs(delta)) > 0) {\n delta = delta < 0 ? 0 - localDelta : localDelta;\n // DEBUG.push(` -> delta: ${delta}`);\n }\n }\n }\n }\n }\n // DEBUG.push(\"\");\n }\n\n {\n // Pre-calculate max available delta in the opposite direction of our pivot.\n // This will be the maximum amount we're allowed to expand/contract the panels in the primary direction.\n // If this amount is less than the requested delta, adjust the requested delta.\n // If this amount is greater than the requested delta, that's useful information too–\n // as an expanding panel might change from collapsed to min size.\n\n const increment = delta < 0 ? 1 : -1;\n\n let index = delta < 0 ? secondPivotIndex : firstPivotIndex;\n let maxAvailableDelta = 0;\n\n // DEBUG.push(\"pre calc...\");\n while (true) {\n const prevSize = initialLayout[index];\n assert(\n prevSize != null,\n `Previous layout not found for panel index ${index}`\n );\n\n const maxSafeSize = validatePanelSize({\n panelConstraints: panelConstraintsArray[index],\n size: 100\n });\n const delta = maxSafeSize - prevSize;\n // DEBUG.push(` ${index}: ${prevSize} -> ${maxSafeSize}`);\n\n maxAvailableDelta += delta;\n index += increment;\n\n if (index < 0 || index >= panelConstraintsArray.length) {\n break;\n }\n }\n\n // DEBUG.push(` -> max available delta: ${maxAvailableDelta}`);\n const minAbsDelta = Math.min(Math.abs(delta), Math.abs(maxAvailableDelta));\n delta = delta < 0 ? 0 - minAbsDelta : minAbsDelta;\n // DEBUG.push(` -> adjusted delta: ${delta}`);\n // DEBUG.push(\"\");\n }\n\n {\n // Delta added to a panel needs to be subtracted from other panels (within the constraints that those panels allow).\n\n const pivotIndex = delta < 0 ? firstPivotIndex : secondPivotIndex;\n let index = pivotIndex;\n while (index >= 0 && index < panelConstraintsArray.length) {\n const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);\n\n const prevSize = initialLayout[index];\n assert(\n prevSize != null,\n `Previous layout not found for panel index ${index}`\n );\n\n const unsafeSize = prevSize - deltaRemaining;\n const safeSize = validatePanelSize({\n panelConstraints: panelConstraintsArray[index],\n size: unsafeSize\n });\n\n if (!layoutNumbersEqual(prevSize, safeSize)) {\n deltaApplied += prevSize - safeSize;\n\n nextLayout[index] = safeSize;\n\n if (\n deltaApplied\n .toFixed(3)\n .localeCompare(Math.abs(delta).toFixed(3), undefined, {\n numeric: true\n }) >= 0\n ) {\n break;\n }\n }\n\n if (delta < 0) {\n index--;\n } else {\n index++;\n }\n }\n }\n // DEBUG.push(`after 1: ${nextLayout.join(\", \")}`);\n // DEBUG.push(` deltaApplied: ${deltaApplied}`);\n // DEBUG.push(\"\");\n\n // If we were unable to resize any of the panels panels, return the previous state.\n // This will essentially bailout and ignore e.g. drags past a panel's boundaries\n if (isArrayEqual(prevLayout, nextLayout)) {\n // DEBUG.push(`bailout to previous layout: ${prevLayout.join(\", \")}`);\n // console.log(DEBUG.join(\"\\n\"));\n\n return prevLayoutProp;\n }\n\n {\n // Now distribute the applied delta to the panels in the other direction\n const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;\n\n const prevSize = initialLayout[pivotIndex];\n assert(\n prevSize != null,\n `Previous layout not found for panel index ${pivotIndex}`\n );\n\n const unsafeSize = prevSize + deltaApplied;\n const safeSize = validatePanelSize({\n panelConstraints: panelConstraintsArray[pivotIndex],\n size: unsafeSize\n });\n\n // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.\n nextLayout[pivotIndex] = safeSize;\n\n // Edge case where expanding or contracting one panel caused another one to change collapsed state\n if (!layoutNumbersEqual(safeSize, unsafeSize)) {\n let deltaRemaining = unsafeSize - safeSize;\n\n const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;\n let index = pivotIndex;\n while (index >= 0 && index < panelConstraintsArray.length) {\n const prevSize = nextLayout[index];\n assert(\n prevSize != null,\n `Previous layout not found for panel index ${index}`\n );\n\n const unsafeSize = prevSize + deltaRemaining;\n const safeSize = validatePanelSize({\n panelConstraints: panelConstraintsArray[index],\n size: unsafeSize\n });\n\n if (!layoutNumbersEqual(prevSize, safeSize)) {\n deltaRemaining -= safeSize - prevSize;\n\n nextLayout[index] = safeSize;\n }\n\n if (layoutNumbersEqual(deltaRemaining, 0)) {\n break;\n }\n\n if (delta > 0) {\n index--;\n } else {\n index++;\n }\n }\n }\n }\n // DEBUG.push(`after 2: ${nextLayout.join(\", \")}`);\n // DEBUG.push(` deltaApplied: ${deltaApplied}`);\n // DEBUG.push(\"\");\n\n const totalSize = Object.values(nextLayout).reduce(\n (total, size) => size + total,\n 0\n );\n // DEBUG.push(`total size: ${totalSize}`);\n\n // If our new layout doesn't add up to 100%, that means the requested delta can't be applied\n // In that case, fall back to our most recent valid layout\n // Allow for a small rounding difference, else e.g. 3 panel layouts may never be considered valid\n if (!layoutNumbersEqual(totalSize, 100, 0.1)) {\n // DEBUG.push(`bailout to previous layout: ${prevLayout.join(\", \")}`);\n // console.log(DEBUG.join(\"\\n\"));\n\n return prevLayoutProp;\n }\n\n const prevLayoutKeys = Object.keys(prevLayoutProp);\n\n // console.log(DEBUG.join(\"\\n\"));\n return nextLayout.reduce<Layout>((accumulated, current, index) => {\n accumulated[prevLayoutKeys[index]] = current;\n return accumulated;\n }, {});\n}\n","import type { Layout } from \"../../components/group/types\";\nimport { compareLayoutNumbers } from \"./compareLayoutNumbers\";\n\nexport function layoutsEqual(a: Layout, b: Layout): boolean {\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const id in a) {\n if (compareLayoutNumbers(a[id], b[id]) !== 0) {\n return false;\n }\n }\n\n return true;\n}\n","import {\n CURSOR_FLAG_HORIZONTAL_MAX,\n CURSOR_FLAG_HORIZONTAL_MIN,\n CURSOR_FLAG_VERTICAL_MAX,\n CURSOR_FLAG_VERTICAL_MIN\n} from \"../../constants\";\nimport { updateCursorStyle } from \"../cursor/updateCursorStyle\";\nimport { read, update } from \"../mutableState\";\nimport { adjustLayoutByDelta } from \"../utils/adjustLayoutByDelta\";\nimport { findMatchingHitRegions } from \"../utils/findMatchingHitRegions\";\nimport { layoutsEqual } from \"../utils/layoutsEqual\";\n\nexport function onPointerMove(event: PointerEvent) {\n if (event.defaultPrevented) {\n return;\n }\n\n const { interactionState, mountedGroups } = read();\n\n switch (interactionState.state) {\n case \"active\": {\n // Edge case (see #340)\n // Detect when the pointer has been released outside an iframe on a different domain\n if (\n // Skip this check for \"pointerleave\" events, else Firefox triggers a false positive (see #514)\n event.type !== \"pointerleave\" &&\n event.buttons === 0\n ) {\n update((prevState) =>\n prevState.interactionState.state === \"inactive\"\n ? prevState\n : {\n cursorFlags: 0,\n interactionState: {\n state: \"inactive\"\n }\n }\n );\n\n return;\n }\n\n let cursorFlags = 0;\n const nextMountedGroups = new Map(mountedGroups);\n\n // Note that HitRegions are frozen once a drag has started\n // Modify the Group layouts for all matching HitRegions though\n interactionState.hitRegions.forEach((current) => {\n const { direction, disableCursor, element, panels } = current.group;\n\n let deltaAsPercentage = 0;\n if (interactionState.state === \"active\") {\n if (direction === \"horizontal\") {\n deltaAsPercentage =\n ((event.clientX - interactionState.pointerDownAtPoint.x) /\n element.offsetWidth) *\n 100;\n } else {\n deltaAsPercentage =\n ((event.clientY - interactionState.pointerDownAtPoint.y) /\n element.offsetHeight) *\n 100;\n }\n }\n\n const initialLayout = interactionState.initialLayoutMap.get(\n current.group\n );\n const { derivedPanelConstraints, layout: prevLayout } =\n mountedGroups.get(current.group) ?? {};\n if (derivedPanelConstraints && initialLayout && prevLayout) {\n const nextLayout = adjustLayoutByDelta({\n delta: deltaAsPercentage,\n initialLayout,\n panelConstraints: derivedPanelConstraints,\n pivotIndices: current.panels.map((panel) => panels.indexOf(panel)),\n prevLayout,\n trigger: \"mouse-or-touch\"\n });\n\n if (layoutsEqual(nextLayout, prevLayout)) {\n if (deltaAsPercentage !== 0 && !disableCursor) {\n // An unchanged means the cursor has exceeded the allowed bounds\n switch (direction) {\n case \"horizontal\": {\n cursorFlags |=\n deltaAsPercentage < 0\n ? CURSOR_FLAG_HORIZONTAL_MIN\n : CURSOR_FLAG_HORIZONTAL_MAX;\n break;\n }\n case \"vertical\": {\n cursorFlags |=\n deltaAsPercentage < 0\n ? CURSOR_FLAG_VERTICAL_MIN\n : CURSOR_FLAG_VERTICAL_MAX;\n break;\n }\n }\n }\n } else {\n nextMountedGroups.set(current.group, {\n derivedPanelConstraints: derivedPanelConstraints,\n layout: nextLayout\n });\n\n // Save the most recent layout for this group of panels in-memory\n // so that layouts will be remembered between different sets of conditionally rendered panels\n const panelIdsKey = current.group.panels\n .map(({ id }) => id)\n .join(\",\");\n current.group.inMemoryLayouts[panelIdsKey] = nextLayout;\n }\n }\n });\n\n update({\n cursorFlags,\n mountedGroups: nextMountedGroups\n });\n\n updateCursorStyle();\n break;\n }\n default: {\n // Update HitRegions if a drag has not been started\n const hitRegions = findMatchingHitRegions(event, mountedGroups);\n\n if (hitRegions.length === 0) {\n if (interactionState.state !== \"inactive\") {\n update({\n interactionState: { state: \"inactive\" }\n });\n }\n } else {\n update({\n interactionState: {\n hitRegions,\n state: \"hover\"\n }\n });\n }\n\n updateCursorStyle();\n break;\n }\n }\n}\n","import { updateCursorStyle } from \"../cursor/updateCursorStyle\";\nimport { read, update } from \"../mutableState\";\n\nexport function onPointerUp(event: PointerEvent) {\n if (event.defaultPrevented) {\n return;\n }\n\n event.preventDefault();\n\n const { interactionState } = read();\n\n switch (interactionState.state) {\n case \"active\": {\n update({\n cursorFlags: 0,\n interactionState: {\n state: \"inactive\"\n }\n });\n\n updateCursorStyle();\n }\n }\n}\n","import type { Layout } from \"../../components/group/types\";\nimport type { PanelConstraints } from \"../../components/panel/types\";\nimport { formatLayoutNumber } from \"./formatLayoutNumber\";\n\nexport function calculateDefaultLayout(\n derivedPanelConstraints: PanelConstraints[]\n): Layout {\n let explicitCount = 0;\n let total = 0;\n\n const layout: Layout = {};\n\n for (const current of derivedPanelConstraints) {\n if (current.defaultSize !== undefined) {\n explicitCount++;\n\n const size = formatLayoutNumber(current.defaultSize);\n\n total += size;\n layout[current.panelId] = size;\n } else {\n // @ts-expect-error Add panel keys in order to simplify traversal elsewhere; we'll fill them in in the loop below\n layout[current.panelId] = undefined;\n }\n }\n\n const remainingPanelCount = derivedPanelConstraints.length - explicitCount;\n if (remainingPanelCount !== 0) {\n const size = formatLayoutNumber((100 - total) / remainingPanelCount);\n\n for (const current of derivedPanelConstraints) {\n if (current.defaultSize === undefined) {\n layout[current.panelId] = size;\n }\n }\n }\n\n return layout;\n}\n","import type { RegisteredGroup } from \"../../components/group/types\";\nimport { calculateAvailableGroupSize } from \"../dom/calculateAvailableGroupSize\";\nimport { formatLayoutNumber } from \"./formatLayoutNumber\";\n\nexport function notifySeparator(\n group: RegisteredGroup,\n element: HTMLElement,\n borderBoxSize: readonly ResizeObserverSize[]\n) {\n const resizeObserverSize = borderBoxSize[0];\n if (!resizeObserverSize) {\n return;\n }\n\n const panel = group.panels.find((current) => current.element === element);\n if (!panel || !panel.onResize) {\n return;\n }\n\n const groupSize = calculateAvailableGroupSize({ group });\n\n panel.onResize({\n asPercentage: formatLayoutNumber(\n (resizeObserverSize.inlineSize / groupSize) * 100\n ),\n inPixels: resizeObserverSize.inlineSize\n });\n}\n","import type { Layout } from \"../../components/group/types\";\nimport type { PanelConstraints } from \"../../components/panel/types\";\nimport { assert } from \"../../utils/assert\";\nimport { layoutNumbersEqual } from \"./layoutNumbersEqual\";\nimport { validatePanelSize } from \"./validatePanelSize\";\n\n// All units must be in percentages; pixel values should be pre-converted\nexport function validatePanelGroupLayout({\n layout,\n panelConstraints\n}: {\n layout: Layout;\n panelConstraints: PanelConstraints[];\n}): Layout {\n const prevLayout = Object.values(layout);\n const nextLayout = [...prevLayout];\n\n const nextLayoutTotalSize = nextLayout.reduce(\n (accumulated, current) => accumulated + current,\n 0\n );\n\n // Validate layout expectations\n if (nextLayout.length !== panelConstraints.length) {\n throw Error(\n `Invalid ${panelConstraints.length} panel layout: ${nextLayout\n .map((size) => `${size}%`)\n .join(\", \")}`\n );\n } else if (\n !layoutNumbersEqual(nextLayoutTotalSize, 100) &&\n nextLayout.length > 0\n ) {\n for (let index = 0; index < panelConstraints.length; index++) {\n const unsafeSize = nextLayout[index];\n assert(unsafeSize != null, `No layout data found for index ${index}`);\n const safeSize = (100 / nextLayoutTotalSize) * unsafeSize;\n nextLayout[index] = safeSize;\n }\n }\n\n let remainingSize = 0;\n\n // First pass: Validate the proposed layout given each panel's constraints\n for (let index = 0; index < panelConstraints.length; index++) {\n const unsafeSize = nextLayout[index];\n assert(unsafeSize != null, `No layout data found for index ${index}`);\n\n const safeSize = validatePanelSize({\n panelConstraints: panelConstraints[index],\n size: unsafeSize\n });\n\n if (unsafeSize != safeSize) {\n remainingSize += unsafeSize - safeSize;\n\n nextLayout[index] = safeSize;\n }\n }\n\n // If there is additional, left over space, assign it to any panel(s) that permits it\n // (It's not worth taking multiple additional passes to evenly distribute)\n if (!layoutNumbersEqual(remainingSize, 0)) {\n for (let index = 0; index < panelConstraints.length; index++) {\n const prevSize = nextLayout[index];\n assert(prevSize != null, `No layout data found for index ${index}`);\n const unsafeSize = prevSize + remainingSize;\n const safeSize = validatePanelSize({\n panelConstraints: panelConstraints[index],\n size: unsafeSize\n });\n\n if (prevSize !== safeSize) {\n remainingSize -= safeSize - prevSize;\n nextLayout[index] = safeSize;\n\n // Once we've used up the remainder, bail\n if (layoutNumbersEqual(remainingSize, 0)) {\n break;\n }\n }\n }\n }\n\n const prevLayoutKeys = Object.keys(layout);\n\n return nextLayout.reduce<Layout>((accumulated, current, index) => {\n accumulated[prevLayoutKeys[index]] = current;\n return accumulated;\n }, {});\n}\n","import type { Layout, RegisteredGroup } from \"../components/group/types\";\nimport { calculatePanelConstraints } from \"./dom/calculatePanelConstraints\";\nimport { update } from \"./mutableState\";\nimport { onPointerDown } from \"./pointer-events/onPointerDown\";\nimport { onPointerMove } from \"./pointer-events/onPointerMove\";\nimport { onPointerUp } from \"./pointer-events/onPointerUp\";\nimport { calculateDefaultLayout } from \"./utils/calculateDefaultLayout\";\nimport { notifySeparator } from \"./utils/notifySeparator\";\nimport { validatePanelGroupLayout } from \"./utils/validatePanelGroupLayout\";\n\nexport function mountGroup(group: RegisteredGroup) {\n let isMounted = false;\n\n // Add Panels with onResize callbacks to ResizeObserver\n // Add Group to ResizeObserver also in order to sync % based constraints\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { borderBoxSize, target } = entry;\n if (target === group.element) {\n if (isMounted) {\n update((prevState) => {\n const match = prevState.mountedGroups.get(group);\n if (match) {\n return {\n mountedGroups: new Map(prevState.mountedGroups).set(group, {\n derivedPanelConstraints: calculatePanelConstraints(group),\n layout: match.layout\n })\n };\n }\n return prevState;\n });\n }\n } else {\n notifySeparator(group, target as HTMLElement, borderBoxSize);\n }\n }\n });\n resizeObserver.observe(group.element);\n group.panels.forEach((panel) => {\n if (panel.onResize) {\n resizeObserver.observe(panel.element);\n }\n });\n\n // Calculate initial layout for the new Panel configuration\n const derivedPanelConstraints = calculatePanelConstraints(group);\n const panelIdsKey = group.panels.map(({ id }) => id).join(\",\");\n\n const defaultLayoutUnsafe: Layout =\n group.inMemoryLayouts[panelIdsKey] ??\n group.defaultLayout ??\n calculateDefaultLayout(derivedPanelConstraints);\n const defaultLayoutSafe = validatePanelGroupLayout({\n layout: defaultLayoutUnsafe,\n panelConstraints: derivedPanelConstraints\n });\n\n const nextState = update((prevState) => ({\n mountedGroups: new Map(prevState.mountedGroups).set(group, {\n derivedPanelConstraints,\n layout: defaultLayoutSafe\n })\n }));\n\n isMounted = true;\n\n // If this is the first group to be mounted, initialize event handlers\n if (nextState.mountedGroups.size === 1) {\n window.addEventListener(\"pointerdown\", onPointerDown);\n window.addEventListener(\"pointerleave\", onPointerMove);\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n\n // TODO Add keyboard event listeners\n }\n\n return function unmountGroup() {\n const nextState = update((prevState) => {\n const mountedGroups = new Map(prevState.mountedGroups);\n mountedGroups.delete(group);\n\n return { mountedGroups };\n });\n\n isMounted = false;\n\n // If this was the last group to be mounted, tear down event handlers\n if (nextState.mountedGroups.size === 0) {\n window.removeEventListener(\"pointerdown\", onPointerDown);\n window.removeEventListener(\"pointerleave\", onPointerMove);\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n\n // TODO Remove keyboard event listeners\n }\n\n resizeObserver.disconnect();\n };\n}\n","import { useId as useIdReact } from \"react\";\n\nexport function useId(stableId: number | string | undefined) {\n const dynamicId = useIdReact();\n\n return `${stableId ?? dynamicId}`;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","import { useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n// Forked from useEventCallback (usehooks-ts)\nexport function useStableCallback<Return>(fn: () => Return): () => Return;\nexport function useStableCallback<Args, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return;\nexport function useStableCallback<Args, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return {\n const ref = useRef<typeof fn>(fn);\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((args: Args) => ref.current?.(args), [ref]) as (\n args: Args\n ) => Return;\n}\n","import { type Ref } from \"react\";\nimport { useStableCallback } from \"./useStableCallback\";\n\ntype PossibleRef<Type> = Ref<Type> | undefined;\n\nexport function useMergedRefs<Type>(...refs: PossibleRef<Type>[]) {\n return useStableCallback((value: Type | null) => {\n refs.forEach((ref) => {\n if (ref) {\n switch (typeof ref) {\n case \"function\": {\n ref(value);\n break;\n }\n case \"object\": {\n ref.current = value;\n break;\n }\n }\n }\n });\n });\n}\n","export const POINTER_EVENTS_CSS_PROPERTY_NAME =\n \"--react-resizable-panels--panel--pointer-events\";\n","export function getPanelSizeCssPropertyName(groupId: string, panelId: string) {\n const groupIdEscaped = groupId.replace(/[^a-zA-Z0-9\\-_]/g, \"\");\n const panelIdEscaped = panelId.replace(/[^a-zA-Z0-9\\-_]/g, \"\");\n\n return `--react-resizable-panels--${groupIdEscaped}--${panelIdEscaped}`;\n}\n","import { createContext } from \"react\";\nimport type { GroupContextType } from \"./types\";\n\nexport const GroupContext = createContext<GroupContextType | null>(null);\n","import type { Direction } from \"./types\";\n\nexport function sortByElementOffset<Type extends { element: HTMLElement }>(\n direction: Direction,\n panelsOrSeparators: Type[]\n): Type[] {\n return panelsOrSeparators.sort(\n direction === \"horizontal\"\n ? (a, b) => a.element.offsetLeft - b.element.offsetLeft\n : (a, b) => a.element.offsetTop - b.element.offsetTop\n );\n}\n","import type {\n GroupImperativeHandle,\n Layout\n} from \"../../components/group/types\";\nimport { read, update } from \"../mutableState\";\nimport { layoutsEqual } from \"./layoutsEqual\";\nimport { validatePanelGroupLayout } from \"./validatePanelGroupLayout\";\n\nexport function getImperativeGroupMethods({\n groupId\n}: {\n groupId: string;\n}): GroupImperativeHandle {\n const find = () => {\n const { mountedGroups } = read();\n for (const [group, { derivedPanelConstraints, layout }] of mountedGroups) {\n if (group.id === groupId) {\n return { derivedPanelConstraints, group, layout };\n }\n }\n\n throw Error(`Group ${groupId} not found`);\n };\n\n return {\n getLayout() {\n const { layout } = find();\n\n return layout;\n },\n setLayout(unsafeLayout: Layout) {\n const { derivedPanelConstraints, group, layout: prevLayout } = find();\n\n const nextLayout = validatePanelGroupLayout({\n layout: unsafeLayout,\n panelConstraints: derivedPanelConstraints\n });\n\n if (!layoutsEqual(prevLayout, nextLayout)) {\n update((prevState) => ({\n mountedGroups: new Map(prevState.mountedGroups).set(group, {\n derivedPanelConstraints,\n layout: nextLayout\n })\n }));\n }\n\n return nextLayout;\n }\n };\n}\n","import { useImperativeHandle, useRef, type Ref } from \"react\";\nimport { IDENTITY_FUNCTION } from \"../../constants\";\nimport { getImperativeGroupMethods } from \"../../global/utils/getImperativeGroupMethods\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport type { GroupImperativeHandle } from \"./types\";\n\nexport function useGroupImperativeHandle(\n groupId: string,\n groupRef: Ref<GroupImperativeHandle> | undefined\n) {\n const imperativeGroupRef = useRef<GroupImperativeHandle>({\n getLayout: () => ({}),\n setLayout: IDENTITY_FUNCTION\n });\n\n useImperativeHandle(groupRef, () => imperativeGroupRef.current, []);\n\n useIsomorphicLayoutEffect(() => {\n Object.assign(\n imperativeGroupRef.current,\n getImperativeGroupMethods({ groupId })\n );\n });\n}\n","\"use client\";\nimport { useMemo, useRef, useState } from \"react\";\nimport { mountGroup } from \"../../global/mountGroup\";\nimport { eventEmitter, read } from \"../../global/mutableState\";\nimport { layoutsEqual } from \"../../global/utils/layoutsEqual\";\nimport { useId } from \"../../hooks/useId\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMergedRefs } from \"../../hooks/useMergedRefs\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { POINTER_EVENTS_CSS_PROPERTY_NAME } from \"../panel/constants\";\nimport type { RegisteredPanel } from \"../panel/types\";\nimport type { RegisteredSeparator } from \"../separator/types\";\nimport { getPanelSizeCssPropertyName } from \"./getPanelSizeCssPropertyName\";\nimport { GroupContext } from \"./GroupContext\";\nimport { sortByElementOffset } from \"./sortByElementOffset\";\nimport type { GroupProps, Layout, RegisteredGroup } from \"./types\";\nimport { useGroupImperativeHandle } from \"./useGroupImperativeHandle\";\n\n// TODO Validate unique Panel and Separator ids\n// TODO Warn if Group is defaultLayout is provided and Panel(s) do not have ids\n\n/**\n * A Group wraps a set of resizable Panel components.\n * Group content can be resized _horizontally_ or _vertically_.\n *\n * For unit testing purposes, Group elements always include the following data attributes:\n *\n * ```html\n * <div data-group data-group-id=\"your-group-id\">\n * ```\n */\nexport function Group({\n children,\n className,\n defaultLayout,\n direction = \"horizontal\",\n disableCursor,\n disabled,\n elementRef,\n groupRef,\n id: idProp,\n onLayoutChange: onLayoutChangeUnstable,\n style\n}: GroupProps) {\n const prevLayoutRef = useRef<Layout>({});\n\n const onLayoutChangeStable = useStableCallback((layout: Layout) => {\n if (layoutsEqual(prevLayoutRef.current, layout)) {\n // Memoize callback\n return;\n }\n\n prevLayoutRef.current = layout;\n onLayoutChangeUnstable?.(layout);\n });\n\n const id = useId(idProp);\n\n const [dragActive, setDragActive] = useState(false);\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n const inMemoryLayoutsRef = useRef<{\n [panelIds: string]: Layout;\n }>({});\n const [layout, setLayout] = useState<Layout>(defaultLayout ?? {});\n const [panels, setPanels] = useState<RegisteredPanel[]>([]);\n const [separators, setSeparators] = useState<RegisteredSeparator[]>([]);\n\n const mergedRef = useMergedRefs(setElement, elementRef);\n\n useGroupImperativeHandle(id, groupRef);\n\n const context = useMemo(\n () => ({\n direction,\n id,\n registerPanel: (panel: RegisteredPanel) => {\n setPanels((prev) => sortByElementOffset(direction, [...prev, panel]));\n return () => {\n setPanels((prev) => prev.filter((current) => current !== panel));\n };\n },\n registerSeparator: (separator: RegisteredSeparator) => {\n setSeparators((prev) =>\n sortByElementOffset(direction, [...prev, separator])\n );\n return () => {\n setSeparators((prev) =>\n prev.filter((current) => current !== separator)\n );\n };\n }\n }),\n [direction, id]\n );\n\n // Register Group and child Panels/Separators with global state\n // Listen to global state for drag state related to this Group\n useIsomorphicLayoutEffect(() => {\n if (element !== null && panels.length > 0) {\n const group: RegisteredGroup = {\n defaultLayout,\n direction,\n disableCursor: !!disableCursor,\n disabled: !!disabled,\n element,\n id,\n inMemoryLayouts: inMemoryLayoutsRef.current,\n panels,\n separators\n };\n\n const unmountGroup = mountGroup(group);\n\n const globalState = read();\n const match = globalState.mountedGroups.get(group);\n if (match) {\n setLayout(match.layout);\n onLayoutChangeStable?.(match.layout);\n }\n\n const removeInteractionStateChangeListener = eventEmitter.addListener(\n \"interactionStateChange\",\n (interactionState) => {\n switch (interactionState.state) {\n case \"active\":\n case \"hover\": {\n setDragActive(\n interactionState.hitRegions.some(\n (current) => current.group === group\n )\n );\n break;\n }\n }\n }\n );\n\n const removeMountedGroupsChangeEventListener = eventEmitter.addListener(\n \"mountedGroupsChange\",\n (mountedGroups) => {\n const match = mountedGroups.get(group);\n if (match && match.derivedPanelConstraints.length > 0) {\n setLayout(match.layout);\n onLayoutChangeStable?.(match.layout);\n }\n }\n );\n\n return () => {\n unmountGroup();\n removeInteractionStateChangeListener();\n removeMountedGroupsChangeEventListener();\n };\n }\n }, [\n defaultLayout,\n direction,\n disableCursor,\n disabled,\n element,\n id,\n onLayoutChangeStable,\n panels,\n separators\n ]);\n\n // Panel layouts and Group dragging state are shared via CSS variables\n const cssVariables: { [key: string]: number | string | undefined } = {\n [POINTER_EVENTS_CSS_PROPERTY_NAME]: dragActive ? \"none\" : undefined\n };\n for (const panelId in layout) {\n const propertyName = getPanelSizeCssPropertyName(id, panelId);\n const flexGrow = layout[panelId];\n cssVariables[propertyName] = flexGrow;\n }\n\n return (\n <GroupContext.Provider value={context}>\n <div\n className={className}\n data-group\n data-group-id={id}\n data-group-direction={direction}\n ref={mergedRef}\n style={{\n ...style,\n ...cssVariables,\n display: \"flex\",\n flexDirection: direction === \"horizontal\" ? \"row\" : \"column\",\n flexWrap: \"nowrap\",\n overflow: \"hidden\"\n }}\n >\n {children}\n </div>\n </GroupContext.Provider>\n );\n}\n","export function getStorageKey(id: string): string {\n return `react-resizable-panels:${id}`;\n}\n","import type { Layout } from \"../types\";\nimport { getStorageKey } from \"./getStorageKey\";\n\nexport function loadGroupLayout({\n id,\n storage\n}: {\n id: string;\n storage: Pick<Storage, \"getItem\" | \"setItem\">;\n}): Layout | undefined {\n try {\n const storageKey = getStorageKey(id);\n const text = storage.getItem(storageKey);\n if (text) {\n return JSON.parse(text) as Layout;\n }\n } catch (error) {\n console.error(error);\n }\n}\n","import type { Layout } from \"../types\";\nimport { getStorageKey } from \"./getStorageKey\";\n\nexport function saveGroupLayout({\n id,\n layout,\n storage\n}: {\n id: string;\n layout: Layout;\n storage: Pick<Storage, \"getItem\" | \"setItem\">;\n}) {\n try {\n const storageKey = getStorageKey(id);\n\n storage.setItem(storageKey, JSON.stringify(layout));\n } catch (error) {\n console.error(error);\n }\n}\n","import { useCallback, useRef } from \"react\";\nimport { loadGroupLayout } from \"./auto-save/loadGroupLayout\";\nimport { saveGroupLayout } from \"./auto-save/saveGroupLayout\";\nimport type { Layout, OnGroupLayoutChange } from \"./types\";\n\nexport function useDefaultLayout({\n groupId,\n storage = localStorage\n}: {\n groupId: string;\n storage?: Pick<Storage, \"getItem\" | \"setItem\">;\n}) {\n const defaultLayoutRef = useRef<Layout | undefined | null>(null);\n if (defaultLayoutRef.current === null) {\n defaultLayoutRef.current = loadGroupLayout({\n id: groupId,\n storage\n });\n }\n\n const onLayoutChange = useCallback<NonNullable<OnGroupLayoutChange>>(\n (layout) =>\n saveGroupLayout({\n id: groupId,\n layout,\n storage\n }),\n [groupId, storage]\n );\n\n return {\n defaultLayout: defaultLayoutRef.current,\n onLayoutChange\n };\n}\n","import { useState } from \"react\";\nimport type { GroupImperativeHandle } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Group component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport function useGroupCallbackRef() {\n return useState<GroupImperativeHandle | null>(null);\n}\n","import { useRef } from \"react\";\nimport type { GroupImperativeHandle } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Group component.\n */\nexport function useGroupRef() {\n return useRef<GroupImperativeHandle>(null);\n}\n","import { useContext } from \"react\";\nimport { assert } from \"../../utils/assert\";\nimport { GroupContext } from \"./GroupContext\";\n\nexport function useGroupContext() {\n const context = useContext(GroupContext);\n assert(context, \"Unexpected\");\n\n return context;\n}\n","import type { PanelImperativeHandle } from \"../../components/panel/types\";\nimport { calculateAvailableGroupSize } from \"../dom/calculateAvailableGroupSize\";\nimport { read } from \"../mutableState\";\nimport { formatLayoutNumber } from \"./formatLayoutNumber\";\nimport { layoutNumbersEqual } from \"./layoutNumbersEqual\";\n\nexport function getImperativePanelMethods({\n groupId,\n panelId\n}: {\n groupId: string;\n panelId: string;\n}): PanelImperativeHandle {\n const find = () => {\n const { mountedGroups } = read();\n for (const [group, { derivedPanelConstraints, layout }] of mountedGroups) {\n if (group.id === groupId) {\n return { derivedPanelConstraints, group, layout };\n }\n }\n\n throw Error(`Group ${groupId} not found`);\n };\n\n const getPanelConstraints = () => {\n const match = find().derivedPanelConstraints.find(\n (current) => current.panelId === panelId\n );\n if (match !== undefined) {\n return match;\n }\n\n throw Error(`Panel constraints not found for Panel ${panelId}`);\n };\n\n const getPanel = () => {\n const match = find().group.panels.find((current) => current.id === panelId);\n if (match !== undefined) {\n return match;\n }\n\n throw Error(`Layout not found for Panel ${panelId}`);\n };\n\n const getPanelSize = () => {\n const match = find().layout[panelId];\n if (match !== undefined) {\n return match;\n }\n\n throw Error(`Layout not found for Panel ${panelId}`);\n };\n\n const setPanelSize = (_size: number) => {\n // TODO Calculate next layout\n // TODO Validate next layout\n // TODO Update group state\n };\n\n return {\n collapse: () => {\n const { collapsible, collapsedSize } = getPanelConstraints();\n const size = getPanelSize();\n\n if (collapsible && size !== collapsedSize) {\n setPanelSize(collapsedSize);\n }\n },\n expand: () => {\n const { collapsible, collapsedSize, minSize } = getPanelConstraints();\n const size = getPanelSize();\n\n if (collapsible && size === collapsedSize) {\n setPanelSize(minSize);\n }\n },\n getSize: () => {\n const { group } = find();\n const asPercentage = getPanelSize();\n const { element } = getPanel();\n\n const inPixels =\n group.direction === \"horizontal\"\n ? element.offsetWidth\n : element.offsetHeight;\n\n return {\n asPercentage,\n inPixels\n };\n },\n isCollapsed: () => {\n const { collapsible, collapsedSize } = getPanelConstraints();\n const size = getPanelSize();\n\n return collapsible && layoutNumbersEqual(collapsedSize, size);\n },\n resize: (size: number | string) => {\n const prevSize = getPanelSize();\n if (prevSize !== size) {\n let asPercentage;\n switch (typeof size) {\n case \"number\": {\n const { group } = find();\n const groupSize = calculateAvailableGroupSize({ group });\n asPercentage = formatLayoutNumber((size / groupSize) * 100);\n break;\n }\n case \"string\": {\n asPercentage = parseFloat(size);\n break;\n }\n }\n\n setPanelSize(asPercentage);\n }\n }\n } satisfies PanelImperativeHandle;\n}\n","import { useImperativeHandle, useRef, type Ref } from \"react\";\nimport { NOOP_FUNCTION } from \"../../constants\";\nimport { getImperativePanelMethods } from \"../../global/utils/getImperativePanelMethods\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useGroupContext } from \"../group/useGroupContext\";\nimport type { PanelImperativeHandle } from \"./types\";\n\nexport function usePanelImperativeHandle(\n panelId: string,\n panelRef: Ref<PanelImperativeHandle> | undefined\n) {\n const { id: groupId } = useGroupContext();\n\n const imperativePanelRef = useRef<PanelImperativeHandle>({\n collapse: NOOP_FUNCTION,\n expand: NOOP_FUNCTION,\n getSize: () => ({\n asPercentage: 0,\n inPixels: 0\n }),\n isCollapsed: () => false,\n resize: NOOP_FUNCTION\n });\n\n useImperativeHandle(panelRef, () => imperativePanelRef.current, []);\n\n useIsomorphicLayoutEffect(() => {\n Object.assign(\n imperativePanelRef.current,\n getImperativePanelMethods({ groupId, panelId })\n );\n });\n}\n","\"use client\";\n\nimport type { Property } from \"csstype\";\nimport { useState } from \"react\";\nimport { useId } from \"../../hooks/useId\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMergedRefs } from \"../../hooks/useMergedRefs\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { getPanelSizeCssPropertyName } from \"../group/getPanelSizeCssPropertyName\";\nimport { useGroupContext } from \"../group/useGroupContext\";\nimport { POINTER_EVENTS_CSS_PROPERTY_NAME } from \"./constants\";\nimport type { PanelProps, PanelSize } from \"./types\";\nimport { usePanelImperativeHandle } from \"./usePanelImperativeHandle\";\n\n// TODO Validate CSS styles\n// Warn and remove the following: width/height (including min/max), flex/flex-basis/flex-grow/flex-shrink, and padding\n\n/**\n * A Panel wraps resizable content and can be configured with min/max size constraints and collapsible behavior.\n *\n * Panel size props can be specified using the following CSS units:\n * - Pixels (default if value is of type `number`)\n * - Percentages (default if value is of type `string`)\n * - Font sizes (em, rem)\n * - Viewport sizes (vh, vw)\n *\n * For unit testing purposes, Panel elements always include the following data attributes:\n *\n * ```html\n * <div data-panel data-panel-id=\"your-panel-id\">\n * ```\n */\nexport function Panel({\n children,\n className,\n collapsedSize = 0,\n collapsible = false,\n defaultSize,\n elementRef,\n id: idProp,\n maxSize = \"100\",\n minSize = \"0\",\n onResize: onResizeUnstable,\n panelRef,\n style\n}: PanelProps) {\n const idIsStable = !!idProp;\n\n const id = useId(idProp);\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const mergedRef = useMergedRefs(setElement, elementRef);\n\n const { id: groupId, registerPanel } = useGroupContext();\n\n const hasOnResize = onResizeUnstable !== null;\n const onResizeStable = useStableCallback((panelSize: PanelSize) => {\n onResizeUnstable?.(panelSize);\n });\n\n // Register Panel with parent Group\n useIsomorphicLayoutEffect(() => {\n if (element !== null) {\n return registerPanel({\n element,\n id,\n idIsStable,\n onResize: hasOnResize ? onResizeStable : undefined,\n panelConstraints: {\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize\n }\n });\n }\n }, [\n collapsedSize,\n collapsible,\n defaultSize,\n element,\n hasOnResize,\n id,\n idIsStable,\n maxSize,\n minSize,\n onResizeStable,\n registerPanel\n ]);\n\n usePanelImperativeHandle(id, panelRef);\n\n const flexGrowVar = getPanelSizeCssPropertyName(groupId, id);\n\n return (\n <div\n data-panel\n data-panel-id={id}\n ref={mergedRef}\n style={{\n flexBasis: 0,\n flexGrow: `var(${flexGrowVar}, 1)`,\n flexShrink: 1,\n\n // Prevent Panel content from interfering with panel size\n overflow: \"hidden\",\n\n // Disable pointer events inside of a panel during resize\n // This avoid edge cases like nested iframes\n pointerEvents:\n `var(${POINTER_EVENTS_CSS_PROPERTY_NAME})` as Property.PointerEvents\n }}\n >\n <div\n className={className}\n style={{\n width: \"100%\",\n height: \"100%\",\n ...style\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n","import { useState } from \"react\";\nimport type { PanelImperativeHandle } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Panel component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport function usePanelCallbackRef() {\n return useState<PanelImperativeHandle | null>(null);\n}\n","import { useRef } from \"react\";\nimport type { PanelImperativeHandle } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Panel component.\n */\nexport function usePanelRef() {\n return useRef<PanelImperativeHandle>(null);\n}\n","\"use client\";\n\nimport { useState } from \"react\";\nimport { eventEmitter } from \"../../global/mutableState\";\nimport type { InteractionState } from \"../../global/types\";\nimport { useId } from \"../../hooks/useId\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useGroupContext } from \"../group/useGroupContext\";\nimport type { RegisteredSeparator, SeparatorProps } from \"./types\";\nimport { useMergedRefs } from \"../../hooks/useMergedRefs\";\n\n/**\n * Separators are not _required_ but they are _recommended_ as they improve keyboard accessibility.\n *\n * Separators should be rendered as the direct child of a Group component.\n *\n * For unit testing purposes, Separator elements always include the following data attributes:\n *\n * ```html\n * <div data-separator data-separator-id=\"your-separator-id\" />\n * ```\n */\nexport function Separator({\n children,\n className,\n elementRef,\n id: idProp,\n style\n}: SeparatorProps) {\n const id = useId(idProp);\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n const [dragState, setDragState] =\n useState<InteractionState[\"state\"]>(\"inactive\");\n\n const mergedRef = useMergedRefs(setElement, elementRef);\n\n const { registerSeparator } = useGroupContext();\n\n // Register Separator with parent Group\n // Listen to global state for drag state related to this Separator\n useIsomorphicLayoutEffect(() => {\n if (element !== null) {\n const separator: RegisteredSeparator = {\n element,\n id\n };\n\n const unregisterSeparator = registerSeparator(separator);\n\n const removeEventListener = eventEmitter.addListener(\n \"interactionStateChange\",\n (interactionState) => {\n setDragState(\n interactionState.state !== \"inactive\" &&\n interactionState.hitRegions.some(\n (hitRegion) => hitRegion.separator === separator\n )\n ? interactionState.state\n : \"inactive\"\n );\n }\n );\n\n return () => {\n unregisterSeparator();\n removeEventListener();\n };\n }\n }, [element, id, registerSeparator]);\n\n return (\n <div\n children={children}\n className={className}\n data-separator\n data-separator-id={id}\n data-separator-state={dragState}\n ref={mergedRef}\n style={{\n flexBasis: \"auto\",\n ...style,\n flexGrow: 0,\n flexShrink: 0\n }}\n />\n );\n}\n"],"names":["convertEmToPixels","element","value","style","fontSize","convertRemToPixels","convertVhToPixels","convertVwToPixels","parseSizeAndUnit","size","numeric","sizeStyleToPixels","groupSize","panelElement","styleProp","pixels","unit","formatLayoutNumber","number","calculateAvailableGroupSize","group","direction","panels","totalSize","panel","calculatePanelConstraints","panelConstraints","collapsedSize","defaultSize","minSize","maxSize","EventEmitter","#listenerMap","type","listener","listeners","data","didThrow","caughtError","clonedListeners","i","error","index","state","eventEmitter","read","update","partialState","IDENTITY_FUNCTION","NOOP_FUNCTION","CURSOR_FLAG_HORIZONTAL_MIN","CURSOR_FLAG_HORIZONTAL_MAX","CURSOR_FLAG_VERTICAL_MIN","CURSOR_FLAG_VERTICAL_MAX","DEFAULT_POINTER_PRECISION","calculateHitRegions","groupElement","separators","sortedChildElements","child","a","b","rectA","rectB","hitRegions","prevPanel","prevSeparator","childElement","panelData","current","prevRect","rect","separatorData","getDistanceBetweenPointAndRect","point","findClosetHitRegion","closestHitRegion","minDistance","hitRegion","cached","isCoarsePointer","findMatchingHitRegions","event","mountedGroups","matchingHitRegions","_","groupData","maxDistance","match","onPointerDown","groups","initialLayoutMap","getCursorStyle","cursorFlags","horizontalCount","verticalCount","horizontalMin","horizontalMax","verticalMin","verticalMax","prevCursor","styleSheet","updateCursorStyle","interactionState","assert","expectedCondition","message","isArrayEqual","layoutNumbersEqual","actual","expected","minimumDelta","compareLayoutNumbers","validatePanelSize","collapsible","halfwayPoint","adjustLayoutByDelta","delta","initialLayoutProp","panelConstraintsArray","pivotIndices","prevLayoutProp","trigger","initialLayout","prevLayout","nextLayout","firstPivotIndex","secondPivotIndex","deltaApplied","increment","maxAvailableDelta","prevSize","minAbsDelta","deltaRemaining","unsafeSize","safeSize","pivotIndex","total","prevLayoutKeys","accumulated","layoutsEqual","id","onPointerMove","prevState","nextMountedGroups","disableCursor","deltaAsPercentage","derivedPanelConstraints","panelIdsKey","onPointerUp","calculateDefaultLayout","explicitCount","layout","remainingPanelCount","notifySeparator","borderBoxSize","resizeObserverSize","validatePanelGroupLayout","nextLayoutTotalSize","remainingSize","mountGroup","isMounted","resizeObserver","entries","entry","target","defaultLayoutUnsafe","defaultLayoutSafe","nextState","useId","stableId","dynamicId","useIdReact","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","useStableCallback","fn","ref","useRef","useCallback","args","useMergedRefs","refs","POINTER_EVENTS_CSS_PROPERTY_NAME","getPanelSizeCssPropertyName","groupId","panelId","groupIdEscaped","panelIdEscaped","GroupContext","createContext","sortByElementOffset","panelsOrSeparators","getImperativeGroupMethods","find","unsafeLayout","useGroupImperativeHandle","groupRef","imperativeGroupRef","useImperativeHandle","Group","children","className","defaultLayout","disabled","elementRef","idProp","onLayoutChangeUnstable","prevLayoutRef","onLayoutChangeStable","dragActive","setDragActive","useState","setElement","inMemoryLayoutsRef","setLayout","setPanels","setSeparators","mergedRef","context","useMemo","prev","separator","unmountGroup","removeInteractionStateChangeListener","removeMountedGroupsChangeEventListener","cssVariables","propertyName","flexGrow","jsx","getStorageKey","loadGroupLayout","storage","storageKey","text","saveGroupLayout","useDefaultLayout","defaultLayoutRef","onLayoutChange","useGroupCallbackRef","useGroupRef","useGroupContext","useContext","getImperativePanelMethods","getPanelConstraints","getPanel","getPanelSize","asPercentage","inPixels","usePanelImperativeHandle","panelRef","imperativePanelRef","Panel","onResizeUnstable","idIsStable","registerPanel","hasOnResize","onResizeStable","panelSize","flexGrowVar","usePanelCallbackRef","usePanelRef","Separator","dragState","setDragState","registerSeparator","unregisterSeparator","removeEventListener"],"mappings":";;;AAAO,SAASA,GAAkBC,GAAkBC,GAAe;AACjE,QAAMC,IAAQ,iBAAiBF,CAAO,GAChCG,IAAW,WAAWD,EAAM,QAAQ;AAE1C,SAAOD,IAAQE;AACjB;ACLO,SAASC,GAAmBJ,GAAkBC,GAAe;AAClE,QAAMC,IAAQ,iBAAiBF,EAAQ,cAAc,IAAI,GACnDG,IAAW,WAAWD,EAAM,QAAQ;AAE1C,SAAOD,IAAQE;AACjB;ACLO,SAASE,GAAkBJ,GAAe;AAC/C,SAAQA,IAAQ,MAAO,OAAO;AAChC;ACFO,SAASK,GAAkBL,GAAe;AAC/C,SAAQA,IAAQ,MAAO,OAAO;AAChC;ACAO,SAASM,GACdC,GACmC;AACnC,UAAQ,OAAOA,GAAA;AAAA,IACb,KAAK;AACH,aAAO,CAACA,GAAM,IAAI;AAAA,IAEpB,KAAK,UAAU;AACb,YAAMC,IAAU,WAAWD,CAAI;AAE/B,aAAIA,EAAK,SAAS,GAAG,IACZ,CAACC,GAAS,GAAG,IACXD,EAAK,SAAS,IAAI,IACpB,CAACC,GAAS,IAAI,IACZD,EAAK,SAAS,KAAK,IACrB,CAACC,GAAS,KAAK,IACbD,EAAK,SAAS,IAAI,IACpB,CAACC,GAAS,IAAI,IACZD,EAAK,SAAS,IAAI,IACpB,CAACC,GAAS,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,GAEjB,CAAC9M,GAASqN,CAAU,IAAID,EAAgC,IAAI,GAC5D,CAACmD,GAAWC,CAAY,IAC5BpD,EAAoC,UAAU,GAE1CM,IAAYrC,GAAcgC,GAAYR,CAAU,GAEhD,EAAE,mBAAA4D,EAAA,IAAsBxB,GAAA;AAI9B,SAAArE,EAA0B,MAAM;AAC9B,QAAI5K,MAAY,MAAM;AACpB,YAAM8N,IAAiC;AAAA,QACrC,SAAA9N;AAAA,QACA,IAAA4I;AAAA,MAAA,GAGI8H,IAAsBD,EAAkB3C,CAAS,GAEjD6C,IAAsBhO,EAAa;AAAA,QACvC;AAAA,QACA,CAAC2D,MAAqB;AACpB,UAAAkK;AAAA,YACElK,EAAiB,UAAU,cACzBA,EAAiB,WAAW;AAAA,cAC1B,CAACzB,MAAcA,EAAU,cAAciJ;AAAA,YAAA,IAEvCxH,EAAiB,QACjB;AAAA,UAAA;AAAA,QAER;AAAA,MAAA;AAGF,aAAO,MAAM;AACX,QAAAoK,EAAA,GACAC,EAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC3Q,GAAS4I,GAAI6H,CAAiB,CAAC,GAGjC,gBAAApC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAA5B;AAAA,MACA,WAAAC;AAAA,MACA,kBAAc;AAAA,MACd,qBAAmB9D;AAAA,MACnB,wBAAsB2H;AAAA,MACtB,KAAK7C;AAAA,MACL,OAAO;AAAA,QACL,WAAW;AAAA,QACX,GAAGxN;AAAA,QACH,UAAU;AAAA,QACV,YAAY;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAGN;"}
|
package/package.json
CHANGED
|
@@ -1,81 +1,109 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-resizable-panels",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)"
|
|
8
|
+
],
|
|
7
9
|
"license": "MIT",
|
|
10
|
+
"homepage": "http://react-resizable-panels.now.sh/",
|
|
8
11
|
"repository": {
|
|
9
12
|
"type": "git",
|
|
10
|
-
"url": "
|
|
13
|
+
"url": "https://github.com/bvaughn/react-resizable-panels.git"
|
|
11
14
|
},
|
|
12
|
-
"
|
|
15
|
+
"main": "dist/react-resizable-panels.cjs",
|
|
16
|
+
"module": "dist/react-resizable-panels.js",
|
|
17
|
+
"types": "dist/react-resizable-panels.d.ts",
|
|
13
18
|
"files": [
|
|
14
|
-
"dist"
|
|
15
|
-
"package.json",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE"
|
|
19
|
+
"dist"
|
|
18
20
|
],
|
|
19
|
-
"exports": {
|
|
20
|
-
".": {
|
|
21
|
-
"types": "./dist/react-resizable-panels.js",
|
|
22
|
-
"development": {
|
|
23
|
-
"edge-light": "./dist/react-resizable-panels.development.edge-light.js",
|
|
24
|
-
"worker": "./dist/react-resizable-panels.development.edge-light.js",
|
|
25
|
-
"workerd": "./dist/react-resizable-panels.development.edge-light.js",
|
|
26
|
-
"browser": "./dist/react-resizable-panels.browser.development.js",
|
|
27
|
-
"node": "./dist/react-resizable-panels.development.edge-light.js",
|
|
28
|
-
"default": "./dist/react-resizable-panels.development.js"
|
|
29
|
-
},
|
|
30
|
-
"edge-light": "./dist/react-resizable-panels.edge-light.js",
|
|
31
|
-
"worker": "./dist/react-resizable-panels.edge-light.js",
|
|
32
|
-
"workerd": "./dist/react-resizable-panels.edge-light.js",
|
|
33
|
-
"browser": "./dist/react-resizable-panels.browser.js",
|
|
34
|
-
"node": "./dist/react-resizable-panels.edge-light.js",
|
|
35
|
-
"default": "./dist/react-resizable-panels.js"
|
|
36
|
-
},
|
|
37
|
-
"./package.json": "./package.json"
|
|
38
|
-
},
|
|
39
|
-
"imports": {
|
|
40
|
-
"#is-development": {
|
|
41
|
-
"development": "./src/env-conditions/development.ts",
|
|
42
|
-
"default": "./src/env-conditions/production.ts"
|
|
43
|
-
},
|
|
44
|
-
"#is-browser": {
|
|
45
|
-
"edge-light": "./src/env-conditions/server.ts",
|
|
46
|
-
"workerd": "./src/env-conditions/server.ts",
|
|
47
|
-
"worker": "./src/env-conditions/server.ts",
|
|
48
|
-
"browser": "./src/env-conditions/browser.ts",
|
|
49
|
-
"node": "./src/env-conditions/server.ts",
|
|
50
|
-
"default": "./src/env-conditions/check-is-browser.ts"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"types": "dist/react-resizable-panels.d.ts",
|
|
54
21
|
"scripts": {
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "pnpm run build:lib && pnpm run build:docs",
|
|
24
|
+
"build:docs": "TARGET=docs vite build",
|
|
25
|
+
"build:lib": "TARGET=lib vite build",
|
|
26
|
+
"compile": "pnpm run compile:code-snippets && pnpm run compile:docs",
|
|
27
|
+
"compile:code-snippets": "node --loader ts-node/esm ./scripts/compile-code-snippets.ts",
|
|
28
|
+
"compile:docs": "node --loader ts-node/esm ./scripts/compile-docs.ts",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"prerelease": "rm -rf dist && pnpm run build:lib",
|
|
31
|
+
"prettier": "prettier --write \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
|
|
32
|
+
"prettier:ci": "prettier --check \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
|
|
33
|
+
"preview": "vite preview",
|
|
34
|
+
"test": "vitest",
|
|
35
|
+
"test:ci": "vitest run",
|
|
36
|
+
"test:debug": "vitest --inspect-brk=127.0.0.1:3000 --no-file-parallelism",
|
|
37
|
+
"tsc": "tsc -b"
|
|
62
38
|
},
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"@babel/plugin-proposal-optional-chaining": "7.21.0",
|
|
66
|
-
"@vitest/ui": "^3.1.2",
|
|
67
|
-
"eslint": "^8.37.0",
|
|
68
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
69
|
-
"jsdom": "^26.1.0",
|
|
70
|
-
"react": "experimental",
|
|
71
|
-
"react-dom": "experimental",
|
|
72
|
-
"vitest": "^3.1.2"
|
|
39
|
+
"lint-staged": {
|
|
40
|
+
"**/*": "prettier --write --ignore-unknown"
|
|
73
41
|
},
|
|
74
42
|
"peerDependencies": {
|
|
75
|
-
"react": "^
|
|
76
|
-
"react-dom": "^
|
|
43
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
44
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
77
45
|
},
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@codemirror/lang-css": "latest",
|
|
48
|
+
"@codemirror/lang-html": "latest",
|
|
49
|
+
"@codemirror/lang-javascript": "latest",
|
|
50
|
+
"@codemirror/lang-markdown": "latest",
|
|
51
|
+
"@codemirror/language": "latest",
|
|
52
|
+
"@codemirror/state": "latest",
|
|
53
|
+
"@csstools/postcss-oklab-function": "^4.0.11",
|
|
54
|
+
"@eslint/js": "^9.30.1",
|
|
55
|
+
"@headlessui/react": "^2.2.4",
|
|
56
|
+
"@headlessui/tailwindcss": "^0.2.2",
|
|
57
|
+
"@heroicons/react": "^2.2.0",
|
|
58
|
+
"@lezer/highlight": "latest",
|
|
59
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
60
|
+
"@tailwindplus/elements": "^1.0.5",
|
|
61
|
+
"@testing-library/jest-dom": "^6.6.4",
|
|
62
|
+
"@testing-library/react": "^16.3.0",
|
|
63
|
+
"@testing-library/user-event": "^14.6.1",
|
|
64
|
+
"@ts-ast-parser/core": "^0.8.0",
|
|
65
|
+
"@types/compression": "^1.8.1",
|
|
66
|
+
"@types/express": "^5.0.5",
|
|
67
|
+
"@types/node": "^24.2.0",
|
|
68
|
+
"@types/react": "^19.1.8",
|
|
69
|
+
"@types/react-dom": "^19.1.6",
|
|
70
|
+
"@vitejs/plugin-react-swc": "^3.10.2",
|
|
71
|
+
"clsx": "^2.1.1",
|
|
72
|
+
"compression": "^1.8.1",
|
|
73
|
+
"csstype": "^3.1.3",
|
|
74
|
+
"eslint": "^9.30.1",
|
|
75
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
76
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
77
|
+
"express": "^5.1.0",
|
|
78
|
+
"globals": "^16.3.0",
|
|
79
|
+
"husky": "^9.1.7",
|
|
80
|
+
"jsdom": "^26.1.0",
|
|
81
|
+
"lint-staged": "^16.1.4",
|
|
82
|
+
"marked": "^16.4.1",
|
|
83
|
+
"postcss": "^8.5.6",
|
|
84
|
+
"prettier": "3.6.2",
|
|
85
|
+
"prettier-plugin-tailwindcss": "^0.7.1",
|
|
86
|
+
"react": "^19.1.0",
|
|
87
|
+
"react-docgen-typescript": "^2.4.0",
|
|
88
|
+
"react-dom": "^19.1.0",
|
|
89
|
+
"react-error-boundary": "^6.0.0",
|
|
90
|
+
"react-router-dom": "^7.6.3",
|
|
91
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
92
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
93
|
+
"rollup-preserve-directives": "^1.1.3",
|
|
94
|
+
"sirv": "^3.0.2",
|
|
95
|
+
"tailwind-merge": "^3.3.1",
|
|
96
|
+
"tailwindcss": "^4.1.11",
|
|
97
|
+
"terser": "^5.43.1",
|
|
98
|
+
"ts-blank-space": "^0.6.2",
|
|
99
|
+
"ts-node": "^10.9.2",
|
|
100
|
+
"typescript": "~5.8.3",
|
|
101
|
+
"typescript-eslint": "^8.35.1",
|
|
102
|
+
"typescript-json-schema": "^0.65.1",
|
|
103
|
+
"vite": "^7.0.4",
|
|
104
|
+
"vite-plugin-dts": "^4.5.4",
|
|
105
|
+
"vite-plugin-svgr": "^4.3.0",
|
|
106
|
+
"vitest": "^3.2.4",
|
|
107
|
+
"zustand": "^5.0.7"
|
|
108
|
+
}
|
|
81
109
|
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ForwardedRef, HTMLAttributes, PropsWithChildren, ReactElement } from "react";
|
|
2
|
-
export type PanelOnCollapse = () => void;
|
|
3
|
-
export type PanelOnExpand = () => void;
|
|
4
|
-
export type PanelOnResize = (size: number, prevSize: number | undefined) => void;
|
|
5
|
-
export type PanelCallbacks = {
|
|
6
|
-
onCollapse?: PanelOnCollapse;
|
|
7
|
-
onExpand?: PanelOnExpand;
|
|
8
|
-
onResize?: PanelOnResize;
|
|
9
|
-
};
|
|
10
|
-
export type PanelConstraints = {
|
|
11
|
-
collapsedSize?: number | undefined;
|
|
12
|
-
collapsible?: boolean | undefined;
|
|
13
|
-
defaultSize?: number | undefined;
|
|
14
|
-
maxSize?: number | undefined;
|
|
15
|
-
minSize?: number | undefined;
|
|
16
|
-
};
|
|
17
|
-
export type PanelData = {
|
|
18
|
-
callbacks: PanelCallbacks;
|
|
19
|
-
constraints: PanelConstraints;
|
|
20
|
-
id: string;
|
|
21
|
-
idIsFromProps: boolean;
|
|
22
|
-
order: number | undefined;
|
|
23
|
-
};
|
|
24
|
-
export type ImperativePanelHandle = {
|
|
25
|
-
collapse: () => void;
|
|
26
|
-
expand: (minSize?: number) => void;
|
|
27
|
-
getId(): string;
|
|
28
|
-
getSize(): number;
|
|
29
|
-
isCollapsed: () => boolean;
|
|
30
|
-
isExpanded: () => boolean;
|
|
31
|
-
resize: (size: number) => void;
|
|
32
|
-
};
|
|
33
|
-
export type PanelProps<T extends keyof HTMLElementTagNameMap = keyof HTMLElementTagNameMap> = Omit<HTMLAttributes<HTMLElementTagNameMap[T]>, "id" | "onResize"> & PropsWithChildren<{
|
|
34
|
-
className?: string;
|
|
35
|
-
collapsedSize?: number | undefined;
|
|
36
|
-
collapsible?: boolean | undefined;
|
|
37
|
-
defaultSize?: number | undefined;
|
|
38
|
-
id?: string;
|
|
39
|
-
maxSize?: number | undefined;
|
|
40
|
-
minSize?: number | undefined;
|
|
41
|
-
onCollapse?: PanelOnCollapse;
|
|
42
|
-
onExpand?: PanelOnExpand;
|
|
43
|
-
onResize?: PanelOnResize;
|
|
44
|
-
order?: number;
|
|
45
|
-
style?: object;
|
|
46
|
-
tagName?: T;
|
|
47
|
-
}>;
|
|
48
|
-
export declare function PanelWithForwardedRef({ children, className: classNameFromProps, collapsedSize, collapsible, defaultSize, forwardedRef, id: idFromProps, maxSize, minSize, onCollapse, onExpand, onResize, order, style: styleFromProps, tagName: Type, ...rest }: PanelProps & {
|
|
49
|
-
forwardedRef: ForwardedRef<ImperativePanelHandle>;
|
|
50
|
-
}): ReactElement;
|
|
51
|
-
export declare namespace PanelWithForwardedRef {
|
|
52
|
-
var displayName: string;
|
|
53
|
-
}
|
|
54
|
-
export declare const Panel: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLObjectElement | HTMLElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLSpanElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement>, "id" | "onResize"> & {
|
|
55
|
-
className?: string;
|
|
56
|
-
collapsedSize?: number | undefined;
|
|
57
|
-
collapsible?: boolean | undefined;
|
|
58
|
-
defaultSize?: number | undefined;
|
|
59
|
-
id?: string;
|
|
60
|
-
maxSize?: number | undefined;
|
|
61
|
-
minSize?: number | undefined;
|
|
62
|
-
onCollapse?: PanelOnCollapse;
|
|
63
|
-
onExpand?: PanelOnExpand;
|
|
64
|
-
onResize?: PanelOnResize;
|
|
65
|
-
order?: number;
|
|
66
|
-
style?: object;
|
|
67
|
-
tagName?: keyof HTMLElementTagNameMap | undefined;
|
|
68
|
-
} & {
|
|
69
|
-
children?: import("react").ReactNode | undefined;
|
|
70
|
-
} & import("react").RefAttributes<ImperativePanelHandle>>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes, PropsWithChildren } from "react";
|
|
2
|
-
import { Direction } from "./types.js";
|
|
3
|
-
export type ImperativePanelGroupHandle = {
|
|
4
|
-
getId: () => string;
|
|
5
|
-
getLayout: () => number[];
|
|
6
|
-
setLayout: (layout: number[]) => void;
|
|
7
|
-
};
|
|
8
|
-
export type PanelGroupStorage = {
|
|
9
|
-
getItem(name: string): string | null;
|
|
10
|
-
setItem(name: string, value: string): void;
|
|
11
|
-
};
|
|
12
|
-
export type PanelGroupOnLayout = (layout: number[]) => void;
|
|
13
|
-
export type PanelGroupProps = Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id"> & PropsWithChildren<{
|
|
14
|
-
autoSaveId?: string | null;
|
|
15
|
-
className?: string;
|
|
16
|
-
direction: Direction;
|
|
17
|
-
id?: string | null;
|
|
18
|
-
keyboardResizeBy?: number | null;
|
|
19
|
-
onLayout?: PanelGroupOnLayout | null;
|
|
20
|
-
storage?: PanelGroupStorage;
|
|
21
|
-
style?: CSSProperties;
|
|
22
|
-
tagName?: keyof HTMLElementTagNameMap;
|
|
23
|
-
dir?: "auto" | "ltr" | "rtl" | undefined;
|
|
24
|
-
}>;
|
|
25
|
-
export declare const PanelGroup: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id"> & {
|
|
26
|
-
autoSaveId?: string | null;
|
|
27
|
-
className?: string;
|
|
28
|
-
direction: Direction;
|
|
29
|
-
id?: string | null;
|
|
30
|
-
keyboardResizeBy?: number | null;
|
|
31
|
-
onLayout?: PanelGroupOnLayout | null;
|
|
32
|
-
storage?: PanelGroupStorage;
|
|
33
|
-
style?: CSSProperties;
|
|
34
|
-
tagName?: keyof HTMLElementTagNameMap;
|
|
35
|
-
dir?: "auto" | "ltr" | "rtl" | undefined;
|
|
36
|
-
} & {
|
|
37
|
-
children?: import("react").ReactNode | undefined;
|
|
38
|
-
} & import("react").RefAttributes<ImperativePanelGroupHandle>>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes, PropsWithChildren, ReactElement } from "react";
|
|
2
|
-
import { PointerHitAreaMargins } from "./PanelResizeHandleRegistry.js";
|
|
3
|
-
export type PanelResizeHandleOnDragging = (isDragging: boolean) => void;
|
|
4
|
-
export type ResizeHandlerState = "drag" | "hover" | "inactive";
|
|
5
|
-
export type PanelResizeHandleProps = Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id" | "onBlur" | "onClick" | "onFocus" | "onPointerDown" | "onPointerUp"> & PropsWithChildren<{
|
|
6
|
-
className?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
hitAreaMargins?: PointerHitAreaMargins;
|
|
9
|
-
id?: string | null;
|
|
10
|
-
onBlur?: () => void;
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
onDragging?: PanelResizeHandleOnDragging;
|
|
13
|
-
onFocus?: () => void;
|
|
14
|
-
onPointerDown?: () => void;
|
|
15
|
-
onPointerUp?: () => void;
|
|
16
|
-
style?: CSSProperties;
|
|
17
|
-
tabIndex?: number;
|
|
18
|
-
tagName?: keyof HTMLElementTagNameMap;
|
|
19
|
-
}>;
|
|
20
|
-
export declare function PanelResizeHandle({ children, className: classNameFromProps, disabled, hitAreaMargins, id: idFromProps, onBlur, onClick, onDragging, onFocus, onPointerDown, onPointerUp, style: styleFromProps, tabIndex, tagName: Type, ...rest }: PanelResizeHandleProps): ReactElement;
|
|
21
|
-
export declare namespace PanelResizeHandle {
|
|
22
|
-
var displayName: string;
|
|
23
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Direction, ResizeEvent } from "./types.js";
|
|
2
|
-
export type ResizeHandlerAction = "down" | "move" | "up";
|
|
3
|
-
export type SetResizeHandlerState = (action: ResizeHandlerAction, isActive: boolean, event: ResizeEvent | null) => void;
|
|
4
|
-
export type PointerHitAreaMargins = {
|
|
5
|
-
coarse: number;
|
|
6
|
-
fine: number;
|
|
7
|
-
};
|
|
8
|
-
export type ResizeHandlerData = {
|
|
9
|
-
direction: Direction;
|
|
10
|
-
element: HTMLElement;
|
|
11
|
-
hitAreaMargins: PointerHitAreaMargins;
|
|
12
|
-
setResizeHandlerState: SetResizeHandlerState;
|
|
13
|
-
};
|
|
14
|
-
export declare const EXCEEDED_HORIZONTAL_MIN = 1;
|
|
15
|
-
export declare const EXCEEDED_HORIZONTAL_MAX = 2;
|
|
16
|
-
export declare const EXCEEDED_VERTICAL_MIN = 4;
|
|
17
|
-
export declare const EXCEEDED_VERTICAL_MAX = 8;
|
|
18
|
-
export declare function registerResizeHandle(resizeHandleId: string, element: HTMLElement, direction: Direction, hitAreaMargins: PointerHitAreaMargins, setResizeHandlerState: SetResizeHandlerState): () => void;
|
|
19
|
-
export declare function reportConstraintsViolation(resizeHandleId: string, flag: number): void;
|