{"version":3,"file":"resize-section-config.mjs","names":[],"sources":["../../../../src/components/AppShell/use-app-shell-resize/resize-section-config.ts"],"sourcesContent":["import type { AppShellResizeSection } from '../AppShell.types';\n\nexport interface ResizeSectionConfig {\n  /** Axis the pointer moves along to resize the section */\n  axis: 'horizontal' | 'vertical';\n\n  /** `aria-orientation` of the separator element */\n  orientation: 'vertical' | 'horizontal';\n\n  /** CSS variable that controls the section size */\n  sizeVariable: string;\n\n  /** CSS variable that controls the space reserved for the section */\n  offsetVariable: string;\n\n  /** CSS variable that controls the grid track size in `mode=\"static\"` */\n  gridWidthVariable?: string;\n\n  /** CSS variable that controls whether the resize handle is displayed */\n  handleDisplayVariable: string;\n\n  /** CSS variable that exposes a safe-area inset baked into the section's measured size, if any */\n  safeAreaVariable?: string;\n\n  /** `1` when moving towards the end of the axis grows the section, `-1` otherwise */\n  sign: 1 | -1;\n}\n\nexport const RESIZE_SECTIONS: Record<AppShellResizeSection, ResizeSectionConfig> = {\n  navbar: {\n    axis: 'horizontal',\n    orientation: 'vertical',\n    sizeVariable: '--app-shell-navbar-width',\n    offsetVariable: '--app-shell-navbar-offset',\n    gridWidthVariable: '--app-shell-navbar-grid-width',\n    handleDisplayVariable: '--app-shell-navbar-resize-handle-display',\n    sign: 1,\n  },\n  aside: {\n    axis: 'horizontal',\n    orientation: 'vertical',\n    sizeVariable: '--app-shell-aside-width',\n    offsetVariable: '--app-shell-aside-offset',\n    gridWidthVariable: '--app-shell-aside-grid-width',\n    handleDisplayVariable: '--app-shell-aside-resize-handle-display',\n    sign: -1,\n  },\n  header: {\n    axis: 'vertical',\n    orientation: 'horizontal',\n    sizeVariable: '--app-shell-header-height',\n    offsetVariable: '--app-shell-header-offset',\n    handleDisplayVariable: '--app-shell-header-resize-handle-display',\n    sign: 1,\n  },\n  footer: {\n    axis: 'vertical',\n    orientation: 'horizontal',\n    sizeVariable: '--app-shell-footer-height',\n    offsetVariable: '--app-shell-footer-offset',\n    handleDisplayVariable: '--app-shell-footer-resize-handle-display',\n    safeAreaVariable: '--app-shell-footer-safe-area',\n    sign: -1,\n  },\n};\n\nexport const RESIZE_SECTION_NAMES = Object.keys(RESIZE_SECTIONS) as AppShellResizeSection[];\n\ninterface GetResizeDeltaInput {\n  section: AppShellResizeSection;\n  deltaX: number;\n  deltaY: number;\n  dir: 'ltr' | 'rtl';\n}\n\nexport function getResizeDelta({ section, deltaX, deltaY, dir }: GetResizeDeltaInput) {\n  const config = RESIZE_SECTIONS[section];\n\n  if (config.axis === 'vertical') {\n    return deltaY * config.sign;\n  }\n\n  return deltaX * config.sign * (dir === 'rtl' ? -1 : 1);\n}\n"],"mappings":";;AA4BA,MAAa,kBAAsE;CACjF,QAAQ;EACN,MAAM;EACN,aAAa;EACb,cAAc;EACd,gBAAgB;EAChB,mBAAmB;EACnB,uBAAuB;EACvB,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,aAAa;EACb,cAAc;EACd,gBAAgB;EAChB,mBAAmB;EACnB,uBAAuB;EACvB,MAAM;CACR;CACA,QAAQ;EACN,MAAM;EACN,aAAa;EACb,cAAc;EACd,gBAAgB;EAChB,uBAAuB;EACvB,MAAM;CACR;CACA,QAAQ;EACN,MAAM;EACN,aAAa;EACb,cAAc;EACd,gBAAgB;EAChB,uBAAuB;EACvB,kBAAkB;EAClB,MAAM;CACR;AACF;AAEA,MAAa,uBAAuB,OAAO,KAAK,eAAe;AAS/D,SAAgB,eAAe,EAAE,SAAS,QAAQ,QAAQ,OAA4B;CACpF,MAAM,SAAS,gBAAgB;CAE/B,IAAI,OAAO,SAAS,YAClB,OAAO,SAAS,OAAO;CAGzB,OAAO,SAAS,OAAO,QAAQ,QAAQ,QAAQ,KAAK;AACtD"}