@mcistudio/unoui-vue 1.0.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.
Files changed (187) hide show
  1. package/README.md +95 -0
  2. package/dist/alert/Alert.vue.d.ts +67 -0
  3. package/dist/alert/index.d.ts +40 -0
  4. package/dist/alert/index.js +2 -0
  5. package/dist/attrs.d.ts +11 -0
  6. package/dist/attrs.js +16 -0
  7. package/dist/attrs.js.map +1 -0
  8. package/dist/badge/Badge.vue.d.ts +57 -0
  9. package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
  10. package/dist/badge/index.d.ts +42 -0
  11. package/dist/badge/index.js +2 -0
  12. package/dist/build.d.ts +2 -0
  13. package/dist/button/Button.vue.d.ts +46 -0
  14. package/dist/button/ButtonGroup.vue.d.ts +13 -0
  15. package/dist/button/index.d.ts +13 -0
  16. package/dist/button/index.js +2 -0
  17. package/dist/checkbox/Checkbox.vue.d.ts +47 -0
  18. package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
  19. package/dist/checkbox/index.d.ts +30 -0
  20. package/dist/checkbox/index.js +2 -0
  21. package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
  22. package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
  23. package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
  24. package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
  25. package/dist/chunks/Table-DhXmuKQd.js +330 -0
  26. package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
  27. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  28. package/dist/chunks/alert-CczW_DKs.js +190 -0
  29. package/dist/chunks/alert-CczW_DKs.js.map +1 -0
  30. package/dist/chunks/badge-BHOZeImh.js +287 -0
  31. package/dist/chunks/badge-BHOZeImh.js.map +1 -0
  32. package/dist/chunks/button-pDObrN_X.js +168 -0
  33. package/dist/chunks/button-pDObrN_X.js.map +1 -0
  34. package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
  35. package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
  36. package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
  37. package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
  38. package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
  39. package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
  40. package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
  41. package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
  42. package/dist/chunks/dropdown-0l967g7D.js +329 -0
  43. package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
  44. package/dist/chunks/form-Qeqkd-HH.js +642 -0
  45. package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
  46. package/dist/chunks/input-BDOXVCrK.js +1281 -0
  47. package/dist/chunks/input-BDOXVCrK.js.map +1 -0
  48. package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
  49. package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
  50. package/dist/chunks/message-xPfuG0EX.js +107 -0
  51. package/dist/chunks/message-xPfuG0EX.js.map +1 -0
  52. package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
  53. package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
  54. package/dist/chunks/modal-D6l1iIvE.js +81 -0
  55. package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
  56. package/dist/chunks/pagination-Bc583AQX.js +265 -0
  57. package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
  58. package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
  59. package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
  60. package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
  61. package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
  62. package/dist/chunks/radio-DnYm59xH.js +477 -0
  63. package/dist/chunks/radio-DnYm59xH.js.map +1 -0
  64. package/dist/chunks/rate-0sme__Kb.js +309 -0
  65. package/dist/chunks/rate-0sme__Kb.js.map +1 -0
  66. package/dist/chunks/select-ChTfQM5u.js +417 -0
  67. package/dist/chunks/select-ChTfQM5u.js.map +1 -0
  68. package/dist/chunks/slider-C-W5GzTP.js +724 -0
  69. package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
  70. package/dist/chunks/splitter-CgfiXY65.js +524 -0
  71. package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
  72. package/dist/chunks/switch-BULGbODP.js +327 -0
  73. package/dist/chunks/switch-BULGbODP.js.map +1 -0
  74. package/dist/chunks/tab-Dxfg1_To.js +663 -0
  75. package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
  76. package/dist/chunks/tag-BYmNsrZC.js +167 -0
  77. package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
  78. package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
  79. package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
  80. package/dist/chunks/tooltip-DMhiAqto.js +242 -0
  81. package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
  82. package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
  83. package/dist/colorpicker/color.d.ts +56 -0
  84. package/dist/colorpicker/color.js +99 -0
  85. package/dist/colorpicker/color.js.map +1 -0
  86. package/dist/colorpicker/index.d.ts +12 -0
  87. package/dist/colorpicker/index.js +2 -0
  88. package/dist/config.d.ts +55 -0
  89. package/dist/config.js +260 -0
  90. package/dist/config.js.map +1 -0
  91. package/dist/datepicker/DatePicker.vue.d.ts +82 -0
  92. package/dist/datepicker/RangePicker.vue.d.ts +87 -0
  93. package/dist/datepicker/index.d.ts +59 -0
  94. package/dist/datepicker/index.js +2 -0
  95. package/dist/drawer/Drawer.vue.d.ts +86 -0
  96. package/dist/drawer/index.d.ts +23 -0
  97. package/dist/drawer/index.js +2 -0
  98. package/dist/dropdown/Dropdown.vue.d.ts +118 -0
  99. package/dist/dropdown/index.d.ts +2 -0
  100. package/dist/dropdown/index.js +2 -0
  101. package/dist/form/Form.vue.d.ts +170 -0
  102. package/dist/form/FormItem.vue.d.ts +83 -0
  103. package/dist/form/index.d.ts +176 -0
  104. package/dist/form/index.js +2 -0
  105. package/dist/index.d.ts +31 -0
  106. package/dist/index.js +32 -0
  107. package/dist/input/Autocomplete.vue.d.ts +121 -0
  108. package/dist/input/Input.vue.d.ts +142 -0
  109. package/dist/input/InputI18n.vue.d.ts +80 -0
  110. package/dist/input/InputTag.vue.d.ts +114 -0
  111. package/dist/input/index.d.ts +41 -0
  112. package/dist/input/index.js +2 -0
  113. package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
  114. package/dist/inputOtp/index.d.ts +21 -0
  115. package/dist/inputOtp/index.js +2 -0
  116. package/dist/message/MessageContainer.vue.d.ts +11 -0
  117. package/dist/message/index.d.ts +20 -0
  118. package/dist/message/index.js +2 -0
  119. package/dist/message/types.d.ts +25 -0
  120. package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
  121. package/dist/millercolumns/index.d.ts +39 -0
  122. package/dist/millercolumns/index.js +2 -0
  123. package/dist/modal/Modal.vue.d.ts +54 -0
  124. package/dist/modal/index.d.ts +2 -0
  125. package/dist/modal/index.js +2 -0
  126. package/dist/pagination/Pagination.vue.d.ts +70 -0
  127. package/dist/pagination/index.d.ts +12 -0
  128. package/dist/pagination/index.js +2 -0
  129. package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
  130. package/dist/popconfirm/index.d.ts +36 -0
  131. package/dist/popconfirm/index.js +2 -0
  132. package/dist/progress/Progress.vue.d.ts +64 -0
  133. package/dist/progress/index.d.ts +26 -0
  134. package/dist/progress/index.js +2 -0
  135. package/dist/qrcode/QRCode.vue.d.ts +87 -0
  136. package/dist/qrcode/index.d.ts +43 -0
  137. package/dist/qrcode/index.js +2 -0
  138. package/dist/qrcode/qr.d.ts +51 -0
  139. package/dist/qrcode/qrcodegen.d.ts +94 -0
  140. package/dist/radio/Radio.vue.d.ts +52 -0
  141. package/dist/radio/RadioGroup.vue.d.ts +44 -0
  142. package/dist/radio/index.d.ts +55 -0
  143. package/dist/radio/index.js +2 -0
  144. package/dist/rate/Rate.vue.d.ts +100 -0
  145. package/dist/rate/index.d.ts +38 -0
  146. package/dist/rate/index.js +2 -0
  147. package/dist/select/Select.vue.d.ts +129 -0
  148. package/dist/select/index.d.ts +33 -0
  149. package/dist/select/index.js +2 -0
  150. package/dist/skeleton/Skeleton.vue.d.ts +31 -0
  151. package/dist/skeleton/index.d.ts +2 -0
  152. package/dist/skeleton/index.js +2 -0
  153. package/dist/slider/Slider.vue.d.ts +81 -0
  154. package/dist/slider/index.d.ts +61 -0
  155. package/dist/slider/index.js +2 -0
  156. package/dist/splitter/Splitter.vue.d.ts +63 -0
  157. package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
  158. package/dist/splitter/index.d.ts +39 -0
  159. package/dist/splitter/index.js +2 -0
  160. package/dist/style.css +2 -0
  161. package/dist/switch/Switch.vue.d.ts +97 -0
  162. package/dist/switch/index.d.ts +31 -0
  163. package/dist/switch/index.js +2 -0
  164. package/dist/tab/TabPane.vue.d.ts +32 -0
  165. package/dist/tab/Tabs.vue.d.ts +87 -0
  166. package/dist/tab/index.d.ts +78 -0
  167. package/dist/tab/index.js +2 -0
  168. package/dist/table/Table.vue.d.ts +96 -0
  169. package/dist/table/index.d.ts +3 -0
  170. package/dist/table/index.js +2 -0
  171. package/dist/table/types.d.ts +35 -0
  172. package/dist/table/types.js +0 -0
  173. package/dist/tag/Tag.vue.d.ts +46 -0
  174. package/dist/tag/index.d.ts +11 -0
  175. package/dist/tag/index.js +2 -0
  176. package/dist/timepicker/TimePicker.vue.d.ts +92 -0
  177. package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
  178. package/dist/timepicker/index.d.ts +39 -0
  179. package/dist/timepicker/index.js +2 -0
  180. package/dist/tooltip/Tooltip.vue.d.ts +79 -0
  181. package/dist/tooltip/index.d.ts +14 -0
  182. package/dist/tooltip/index.js +2 -0
  183. package/dist/uno.d.ts +32 -0
  184. package/dist/uno.js +83 -0
  185. package/dist/uno.js.map +1 -0
  186. package/dist/utils/DnD.d.ts +38 -0
  187. package/package.json +115 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitter-CgfiXY65.js","names":["$slots"],"sources":["../../src/splitter/SplitterPanel.vue","../../src/splitter/SplitterPanel.vue","../../src/splitter/Splitter.vue","../../src/splitter/Splitter.vue","../../src/splitter/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, useAttrs } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport { splitterPanel, type SplitterOrientation, type SplitterPanelCollapsible, type SplitterSize } from '.'\nimport { getUiExposeAttrs } from '../attrs'\n\ndefineOptions({\n inheritAttrs: false\n})\n\nconst props = withDefaults(\n defineProps<{\n /** size 是受控面板大小,数字表示 px,字符串支持百分比。 */\n size?: SplitterSize\n /** defaultSize 是非受控初始大小,数字表示 px,字符串支持百分比。 */\n defaultSize?: SplitterSize\n /** min 是拖拽时允许的最小尺寸。 */\n min?: SplitterSize\n /** max 是拖拽时允许的最大尺寸。 */\n max?: SplitterSize\n /** resizable 表示相邻分隔条是否允许拖拽。 */\n resizable?: boolean\n /** collapsible 配置面板从起始侧或结束侧快速折叠。 */\n collapsible?: SplitterPanelCollapsible\n /** destroyOnHidden 覆盖父级折叠内容销毁策略。 */\n destroyOnHidden?: boolean\n /** @internal Splitter 注入的面板占比。 */\n splitterSize?: number\n /** @internal Splitter 注入的主轴方向。 */\n splitterOrientation?: SplitterOrientation\n /** @internal Splitter 注入的折叠状态。 */\n splitterCollapsed?: boolean\n /** @internal Splitter 注入的全局内容销毁策略。 */\n splitterDestroyOnHidden?: boolean\n /** @internal Splitter 注入的折叠动画状态。 */\n splitterMotion?: boolean\n }>(),\n {\n size: undefined,\n defaultSize: undefined,\n min: undefined,\n max: undefined,\n resizable: true,\n collapsible: false,\n destroyOnHidden: undefined,\n splitterSize: undefined,\n splitterOrientation: 'horizontal',\n splitterCollapsed: false,\n splitterDestroyOnHidden: false,\n splitterMotion: false\n }\n)\n\nconst attrs = useAttrs()\nconst exposeAttrs = computed(() => getUiExposeAttrs(attrs))\nconst panelClass = computed(() => clsx(splitterPanel({ collapsed: props.splitterCollapsed }), attrs.class as string | undefined))\nconst panelStyle = computed<StyleValue>(() => {\n const basis = props.splitterSize === undefined ? undefined : `${props.splitterSize * 100}%`\n const dimensionStyle = basis ? (props.splitterOrientation === 'vertical' ? { flex: `0 0 ${basis}`, height: basis, width: '100%' } : { flex: `0 0 ${basis}`, height: '100%', width: basis }) : { flex: '1 1 0%' }\n const transitionStyle = props.splitterMotion ? { transition: 'flex-basis 180ms ease, width 180ms ease, height 180ms ease' } : undefined\n const attrsStyle = attrs.style as StyleValue | undefined\n\n return [dimensionStyle, transitionStyle, attrsStyle]\n})\nconst shouldRenderContent = computed(() => !(props.splitterCollapsed && (props.destroyOnHidden ?? props.splitterDestroyOnHidden)))\n</script>\n\n<template>\n <div v-bind=\"exposeAttrs\" data-ui-splitter-panel=\"true\" :aria-hidden=\"splitterCollapsed || undefined\" :class=\"panelClass\" :style=\"panelStyle\">\n <slot v-if=\"shouldRenderContent\"></slot>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, useAttrs } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport { splitterPanel, type SplitterOrientation, type SplitterPanelCollapsible, type SplitterSize } from '.'\nimport { getUiExposeAttrs } from '../attrs'\n\ndefineOptions({\n inheritAttrs: false\n})\n\nconst props = withDefaults(\n defineProps<{\n /** size 是受控面板大小,数字表示 px,字符串支持百分比。 */\n size?: SplitterSize\n /** defaultSize 是非受控初始大小,数字表示 px,字符串支持百分比。 */\n defaultSize?: SplitterSize\n /** min 是拖拽时允许的最小尺寸。 */\n min?: SplitterSize\n /** max 是拖拽时允许的最大尺寸。 */\n max?: SplitterSize\n /** resizable 表示相邻分隔条是否允许拖拽。 */\n resizable?: boolean\n /** collapsible 配置面板从起始侧或结束侧快速折叠。 */\n collapsible?: SplitterPanelCollapsible\n /** destroyOnHidden 覆盖父级折叠内容销毁策略。 */\n destroyOnHidden?: boolean\n /** @internal Splitter 注入的面板占比。 */\n splitterSize?: number\n /** @internal Splitter 注入的主轴方向。 */\n splitterOrientation?: SplitterOrientation\n /** @internal Splitter 注入的折叠状态。 */\n splitterCollapsed?: boolean\n /** @internal Splitter 注入的全局内容销毁策略。 */\n splitterDestroyOnHidden?: boolean\n /** @internal Splitter 注入的折叠动画状态。 */\n splitterMotion?: boolean\n }>(),\n {\n size: undefined,\n defaultSize: undefined,\n min: undefined,\n max: undefined,\n resizable: true,\n collapsible: false,\n destroyOnHidden: undefined,\n splitterSize: undefined,\n splitterOrientation: 'horizontal',\n splitterCollapsed: false,\n splitterDestroyOnHidden: false,\n splitterMotion: false\n }\n)\n\nconst attrs = useAttrs()\nconst exposeAttrs = computed(() => getUiExposeAttrs(attrs))\nconst panelClass = computed(() => clsx(splitterPanel({ collapsed: props.splitterCollapsed }), attrs.class as string | undefined))\nconst panelStyle = computed<StyleValue>(() => {\n const basis = props.splitterSize === undefined ? undefined : `${props.splitterSize * 100}%`\n const dimensionStyle = basis ? (props.splitterOrientation === 'vertical' ? { flex: `0 0 ${basis}`, height: basis, width: '100%' } : { flex: `0 0 ${basis}`, height: '100%', width: basis }) : { flex: '1 1 0%' }\n const transitionStyle = props.splitterMotion ? { transition: 'flex-basis 180ms ease, width 180ms ease, height 180ms ease' } : undefined\n const attrsStyle = attrs.style as StyleValue | undefined\n\n return [dimensionStyle, transitionStyle, attrsStyle]\n})\nconst shouldRenderContent = computed(() => !(props.splitterCollapsed && (props.destroyOnHidden ?? props.splitterDestroyOnHidden)))\n</script>\n\n<template>\n <div v-bind=\"exposeAttrs\" data-ui-splitter-panel=\"true\" :aria-hidden=\"splitterCollapsed || undefined\" :class=\"panelClass\" :style=\"panelStyle\">\n <slot v-if=\"shouldRenderContent\"></slot>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { Comment, Fragment, Text, cloneVNode, computed, defineComponent, nextTick, onBeforeUnmount, onMounted, ref, useAttrs, useSlots, watch } from 'vue'\nimport type { CSSProperties, PropType, StyleValue, VNode } from 'vue'\n\nimport { splitterBar, splitterDragger, splitterLine, splitterRoot, type SplitterCollapsibleIconMode, type SplitterCollapsibleOptions, type SplitterOrientation, type SplitterPanelCollapsibleOptions, type SplitterSize } from '.'\nimport { getUiExposeAttrs } from '../attrs'\nimport SplitterPanel from './SplitterPanel.vue'\n\ndefineOptions({\n inheritAttrs: false\n})\n\ninterface PanelRecord {\n vnode: VNode\n key: PropertyKey\n size?: SplitterSize\n defaultSize?: SplitterSize\n min?: SplitterSize\n max?: SplitterSize\n resizable: boolean\n collapsible: Required<SplitterPanelCollapsibleOptions>\n destroyOnHidden?: boolean\n}\n\ninterface DragState {\n index: number\n pointerId: number\n startClient: number\n startRatios: number[]\n}\n\nconst EPSILON = 0.000001\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是所有面板尺寸的本地 v-model,拖拽后输出 px 数组。 */\n modelValue?: SplitterSize[]\n /** defaultValue 是所有面板的非受控初始尺寸。 */\n defaultValue?: SplitterSize[]\n /** orientation 是面板排列方向。 */\n orientation?: SplitterOrientation\n /** lazy 表示拖拽时只移动预览线,松开后再调整面板。 */\n lazy?: boolean\n /** keyboardStep 是键盘方向键每次调整的像素数。 */\n keyboardStep?: number\n /** collapsible 配置折叠动画。 */\n collapsible?: SplitterCollapsibleOptions\n /** destroyOnHidden 表示面板折叠为 0 时销毁内容。 */\n destroyOnHidden?: boolean\n /** ariaLabel 是分割面板根节点的无障碍名称。 */\n ariaLabel?: string\n }>(),\n {\n modelValue: undefined,\n defaultValue: undefined,\n orientation: 'horizontal',\n lazy: false,\n keyboardStep: 10,\n collapsible: undefined,\n destroyOnHidden: false,\n ariaLabel: '分割面板'\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', sizes: number[]): void\n (e: 'resize-start', sizes: number[]): void\n (e: 'resize', sizes: number[]): void\n (e: 'resize-end', sizes: number[]): void\n (e: 'collapse', collapsed: boolean[], sizes: number[]): void\n (e: 'dragger-double-click', index: number): void\n}>()\n\nconst attrs = useAttrs()\nconst slots = useSlots()\nconst rootRef = ref<HTMLElement | null>(null)\nconst containerSize = ref(0)\nconst internalSizes = ref<SplitterSize[]>([])\nconst dragRatios = ref<number[] | null>(null)\nconst dragState = ref<DragState | null>(null)\nconst activeBarIndex = ref(-1)\nconst lazyPreviewOffset = ref(0)\nconst collapsedSizeCache = new Map<number, number>()\nconst splitterId = `ui-splitter-${Math.random().toString(36).slice(2, 9)}`\nlet resizeObserver: ResizeObserver | null = null\nlet previousBodyCursor = ''\nlet previousBodyUserSelect = ''\n\nconst VNodeRenderer = defineComponent({\n name: 'SplitterVNodeRenderer',\n props: {\n node: {\n type: Object as PropType<VNode>,\n required: true\n }\n },\n setup(rendererProps) {\n return () => rendererProps.node\n }\n})\n\nfunction flattenPanelVNodes(nodes: VNode[], result: VNode[] = []) {\n for (const node of nodes) {\n if (node.type === Fragment && Array.isArray(node.children)) {\n flattenPanelVNodes(node.children as VNode[], result)\n continue\n }\n if (node.type === Comment || node.type === Text) continue\n if (node.type === SplitterPanel || (typeof node.type === 'object' && '__name' in node.type && node.type.__name === 'SplitterPanel')) {\n result.push(node)\n }\n }\n return result\n}\n\nfunction readVNodeProp<T>(vnode: VNode, name: string): T | undefined {\n const kebabName = name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n return (vnode.props?.[name] ?? vnode.props?.[kebabName]) as T | undefined\n}\n\nfunction normalizeCollapsible(value: unknown): Required<SplitterPanelCollapsibleOptions> {\n if (value && typeof value === 'object') {\n const options = value as SplitterPanelCollapsibleOptions\n return {\n start: Boolean(options.start),\n end: Boolean(options.end),\n showCollapsibleIcon: options.showCollapsibleIcon ?? 'auto'\n }\n }\n const enabled = value === true || value === ''\n return {\n start: enabled,\n end: enabled,\n showCollapsibleIcon: 'auto'\n }\n}\n\nconst panels = computed<PanelRecord[]>(() =>\n flattenPanelVNodes(slots.default?.() ?? []).map((vnode, index) => ({\n vnode,\n key: vnode.key ?? index,\n size: readVNodeProp<SplitterSize>(vnode, 'size'),\n defaultSize: readVNodeProp<SplitterSize>(vnode, 'defaultSize'),\n min: readVNodeProp<SplitterSize>(vnode, 'min'),\n max: readVNodeProp<SplitterSize>(vnode, 'max'),\n resizable: readVNodeProp<boolean>(vnode, 'resizable') !== false,\n collapsible: normalizeCollapsible(readVNodeProp(vnode, 'collapsible')),\n destroyOnHidden: readVNodeProp<boolean>(vnode, 'destroyOnHidden')\n }))\n)\n\nconst panelIdentity = computed(() => panels.value.map((panel) => String(panel.key)).join('|'))\nconst hasControlledPanelSize = computed(() => panels.value.some((panel) => panel.size !== undefined))\nconst isControlled = computed(() => props.modelValue !== undefined || hasControlledPanelSize.value)\nconst sourceSizes = computed<SplitterSize[]>(() => {\n if (props.modelValue !== undefined) return props.modelValue\n if (hasControlledPanelSize.value) return panels.value.map((panel) => panel.size as SplitterSize)\n if (internalSizes.value.length === panels.value.length) return internalSizes.value\n if (props.defaultValue?.length) return props.defaultValue\n return panels.value.map((panel) => panel.defaultSize as SplitterSize)\n})\n\nfunction parseSize(value: SplitterSize | undefined, total: number, fallback?: number) {\n if (value === undefined || value === null || value === '') return fallback\n if (typeof value === 'string' && value.trim().endsWith('%')) {\n const percent = Number(value.trim().slice(0, -1))\n return Number.isFinite(percent) ? (percent / 100) * total : fallback\n }\n const numeric = Number(value)\n return Number.isFinite(numeric) ? numeric : fallback\n}\n\nfunction distributeDifference(values: number[], minValues: number[], maxValues: number[]) {\n const result = values.map((value, index) => Math.min(maxValues[index], Math.max(minValues[index], value)))\n for (let pass = 0; pass < result.length * 2; pass += 1) {\n const difference = 1 - result.reduce((sum, value) => sum + value, 0)\n if (Math.abs(difference) <= EPSILON) break\n const candidates = result.map((value, index) => ({ index, room: difference > 0 ? maxValues[index] - value : value - minValues[index] })).filter((item) => item.room > EPSILON)\n if (!candidates.length) break\n const share = Math.abs(difference) / candidates.length\n for (const candidate of candidates) {\n const change = Math.min(candidate.room, share)\n result[candidate.index] += difference > 0 ? change : -change\n }\n }\n\n const remainder = 1 - result.reduce((sum, value) => sum + value, 0)\n if (Math.abs(remainder) > EPSILON && result.length) result[result.length - 1] = Math.max(0, result[result.length - 1] + remainder)\n return result\n}\n\nfunction normalizeSizes(rawSizes: SplitterSize[], panelList = panels.value) {\n const count = panelList.length\n if (!count) return []\n const total = containerSize.value > 0 ? containerSize.value : 1\n const rawRatios = Array.from({ length: count }, (_, index) => {\n const parsed = parseSize(rawSizes[index], total)\n return parsed === undefined ? undefined : Math.max(0, parsed / total)\n })\n const minRatios = panelList.map((panel, index) => (rawRatios[index] === 0 ? 0 : Math.max(0, (parseSize(panel.min, total, 0) ?? 0) / total)))\n const maxRatios = panelList.map((panel) => Math.max(0, Math.min(1, (parseSize(panel.max, total, total) ?? total) / total)))\n const specifiedTotal = rawRatios.reduce<number>((sum, value) => sum + (value ?? 0), 0)\n const undefinedIndexes = rawRatios.map((value, index) => (value === undefined ? index : -1)).filter((index) => index >= 0)\n let ratios: number[]\n\n if (!undefinedIndexes.length) {\n if (specifiedTotal <= EPSILON) ratios = rawRatios.map(() => 1 / count)\n else ratios = rawRatios.map((value) => (value ?? 0) / specifiedTotal)\n } else if (specifiedTotal >= 1) {\n ratios = rawRatios.map((value) => (value === undefined ? 0 : value / specifiedTotal))\n } else {\n const rest = (1 - specifiedTotal) / undefinedIndexes.length\n ratios = rawRatios.map((value) => value ?? rest)\n }\n\n return distributeDifference(ratios, minRatios, maxRatios)\n}\n\nconst baseRatios = computed(() => normalizeSizes(sourceSizes.value))\nconst currentRatios = computed(() => dragRatios.value ?? baseRatios.value)\nconst rootClass = computed(() => clsx(splitterRoot({ orientation: props.orientation }), attrs.class as string | undefined))\nconst rootStyle = computed<StyleValue>(() => attrs.style as StyleValue | undefined)\nconst exposeAttrs = computed(() => getUiExposeAttrs(attrs))\nconst panelIds = computed(() => panels.value.map((panel, index) => readVNodeProp<string>(panel.vnode, 'id') ?? `${splitterId}-panel-${index}`))\n\nwatch(panelIdentity, () => {\n internalSizes.value = []\n dragRatios.value = null\n collapsedSizeCache.clear()\n})\n\nwatch(\n () => props.orientation,\n async () => {\n await nextTick()\n measureContainer()\n }\n)\n\nfunction measureContainer() {\n const rect = rootRef.value?.getBoundingClientRect()\n const nextSize = props.orientation === 'vertical' ? rect?.height : rect?.width\n if (nextSize && Number.isFinite(nextSize)) containerSize.value = nextSize\n}\n\nfunction ratiosToPixels(ratios: number[]) {\n const total = containerSize.value\n return ratios.map((ratio) => Number((ratio * total).toFixed(2)))\n}\n\nfunction panelMinPx(index: number, allowCollapsed = false) {\n if (allowCollapsed && currentRatios.value[index] <= EPSILON) return 0\n return parseSize(panels.value[index]?.min, containerSize.value, 0) ?? 0\n}\n\nfunction panelMaxPx(index: number) {\n return parseSize(panels.value[index]?.max, containerSize.value, containerSize.value) ?? containerSize.value\n}\n\nfunction isBarResizable(index: number) {\n const previous = panels.value[index]\n const next = panels.value[index + 1]\n if (!previous || !next || !previous.resizable || !next.resizable) return false\n const sizes = ratiosToPixels(currentRatios.value)\n if (sizes[index] <= EPSILON && panelMinPx(index) > 0) return false\n if (sizes[index + 1] <= EPSILON && panelMinPx(index + 1) > 0) return false\n return true\n}\n\nfunction clampOffset(index: number, requestedOffset: number, startRatios: number[]) {\n const sizes = ratiosToPixels(startRatios)\n const previousSize = sizes[index] ?? 0\n const nextSize = sizes[index + 1] ?? 0\n const lowerBound = Math.max(panelMinPx(index) - previousSize, nextSize - panelMaxPx(index + 1))\n const upperBound = Math.min(panelMaxPx(index) - previousSize, nextSize - panelMinPx(index + 1))\n return Math.min(upperBound, Math.max(lowerBound, requestedOffset))\n}\n\nfunction offsetRatios(index: number, requestedOffset: number, startRatios: number[]) {\n if (containerSize.value <= 0) return startRatios\n const offset = clampOffset(index, requestedOffset, startRatios)\n const next = [...startRatios]\n next[index] += offset / containerSize.value\n next[index + 1] -= offset / containerSize.value\n return next\n}\n\nfunction commitRatios(ratios: number[], emitResize = true) {\n const sizes = ratiosToPixels(ratios)\n if (!isControlled.value) internalSizes.value = sizes\n if (dragState.value) dragRatios.value = ratios\n emit('update:modelValue', sizes)\n if (emitResize) emit('resize', sizes)\n return sizes\n}\n\nfunction boundaryPercent(index: number) {\n return currentRatios.value.slice(0, index + 1).reduce((sum, value) => sum + value, 0) * 100\n}\n\nfunction barStyle(index: number): CSSProperties {\n const transition = props.collapsible?.motion && activeBarIndex.value < 0 ? `${props.orientation === 'vertical' ? 'top' : 'left'} 180ms ease` : undefined\n return props.orientation === 'vertical' ? { top: `${boundaryPercent(index)}%`, transition } : { left: `${boundaryPercent(index)}%`, transition }\n}\n\nfunction previewStyle(index: number): CSSProperties {\n const active = activeBarIndex.value === index && props.lazy\n if (props.orientation === 'vertical') {\n return {\n left: 0,\n right: 0,\n top: `calc(50% + ${active ? lazyPreviewOffset.value : 0}px)`,\n height: '2px',\n transform: 'translateY(-50%)'\n }\n }\n return {\n bottom: 0,\n left: `calc(50% + ${active ? lazyPreviewOffset.value : 0}px)`,\n top: 0,\n width: '2px',\n transform: 'translateX(-50%)'\n }\n}\n\nfunction createPanelVNode(panel: PanelRecord, index: number) {\n const ratio = currentRatios.value[index] ?? 0\n return cloneVNode(panel.vnode, {\n id: panelIds.value[index],\n splitterSize: ratio,\n splitterOrientation: props.orientation,\n splitterCollapsed: ratio <= EPSILON,\n splitterDestroyOnHidden: props.destroyOnHidden,\n splitterMotion: Boolean(props.collapsible?.motion) && activeBarIndex.value < 0\n })\n}\n\nfunction setDraggingDocumentState(active: boolean) {\n if (typeof document === 'undefined') return\n if (active) {\n previousBodyCursor = document.body.style.cursor\n previousBodyUserSelect = document.body.style.userSelect\n document.body.style.cursor = props.orientation === 'vertical' ? 'row-resize' : 'col-resize'\n document.body.style.userSelect = 'none'\n return\n }\n document.body.style.cursor = previousBodyCursor\n document.body.style.userSelect = previousBodyUserSelect\n}\n\nfunction handlePointerDown(event: PointerEvent, index: number) {\n if (event.button !== 0 || !isBarResizable(index)) return\n measureContainer()\n event.preventDefault()\n const startRatios = [...currentRatios.value]\n dragState.value = {\n index,\n pointerId: event.pointerId,\n startClient: props.orientation === 'vertical' ? event.clientY : event.clientX,\n startRatios\n }\n dragRatios.value = startRatios\n activeBarIndex.value = index\n lazyPreviewOffset.value = 0\n setDraggingDocumentState(true)\n rootRef.value?.setPointerCapture?.(event.pointerId)\n emit('resize-start', ratiosToPixels(startRatios))\n}\n\nfunction handlePointerMove(event: PointerEvent) {\n const state = dragState.value\n if (!state || (event.pointerId !== undefined && state.pointerId !== event.pointerId)) return\n const client = props.orientation === 'vertical' ? event.clientY : event.clientX\n const offset = clampOffset(state.index, client - state.startClient, state.startRatios)\n if (props.lazy) {\n lazyPreviewOffset.value = offset\n return\n }\n commitRatios(offsetRatios(state.index, offset, state.startRatios))\n}\n\nfunction finishPointerDrag(event?: PointerEvent) {\n const state = dragState.value\n if (!state || (event?.pointerId !== undefined && state.pointerId !== event.pointerId)) return\n let finalRatios = dragRatios.value ?? state.startRatios\n if (props.lazy) {\n finalRatios = offsetRatios(state.index, lazyPreviewOffset.value, state.startRatios)\n if (Math.abs(lazyPreviewOffset.value) > EPSILON) commitRatios(finalRatios)\n }\n emit('resize-end', ratiosToPixels(finalRatios))\n dragState.value = null\n dragRatios.value = null\n activeBarIndex.value = -1\n lazyPreviewOffset.value = 0\n setDraggingDocumentState(false)\n}\n\nfunction getBarAria(index: number) {\n const sizes = ratiosToPixels(currentRatios.value)\n const previousSize = sizes[index] ?? 0\n const pairSize = previousSize + (sizes[index + 1] ?? 0)\n return {\n now: Math.round(previousSize),\n min: Math.round(Math.max(panelMinPx(index, true), pairSize - panelMaxPx(index + 1))),\n max: Math.round(Math.min(panelMaxPx(index), pairSize - panelMinPx(index + 1, true)))\n }\n}\n\nfunction handleSeparatorKeydown(event: KeyboardEvent, index: number) {\n if (!isBarResizable(index)) return\n const aria = getBarAria(index)\n const step = Math.max(1, props.keyboardStep)\n let offset: number | undefined\n if (props.orientation === 'horizontal' && event.key === 'ArrowLeft') offset = -step\n if (props.orientation === 'horizontal' && event.key === 'ArrowRight') offset = step\n if (props.orientation === 'vertical' && event.key === 'ArrowUp') offset = -step\n if (props.orientation === 'vertical' && event.key === 'ArrowDown') offset = step\n if (event.key === 'Home') offset = aria.min - aria.now\n if (event.key === 'End') offset = aria.max - aria.now\n if (offset === undefined) return\n\n event.preventDefault()\n measureContainer()\n const startRatios = [...currentRatios.value]\n emit('resize-start', ratiosToPixels(startRatios))\n const finalRatios = offsetRatios(index, offset, startRatios)\n const sizes = commitRatios(finalRatios)\n emit('resize-end', sizes)\n}\n\nfunction collapseButtonVisible(mode: SplitterCollapsibleIconMode) {\n return mode !== false\n}\n\nfunction collapseButtonClass(mode: SplitterCollapsibleIconMode) {\n return clsx(\n 'pointer-events-auto absolute z-30 inline-flex size-5 items-center justify-center rounded border border-medium bg-primary text-tertiary shadow-sm outline-none transition-[color,opacity,background-color] hover:bg-secondary hover:text-brand-500 focus-visible:ring-2 focus-visible:ring-brand-400',\n mode === 'auto' && 'opacity-0 group-hover/ui-splitter-bar:opacity-100 group-focus-within/ui-splitter-bar:opacity-100'\n )\n}\n\nfunction collapseButtonStyle(side: 'previous' | 'next'): CSSProperties {\n const offset = side === 'previous' ? '-13px' : '13px'\n if (props.orientation === 'vertical') {\n return { left: `calc(50% + ${offset})`, top: '50%', transform: 'translate(-50%, -50%)' }\n }\n return { left: '50%', top: `calc(50% + ${offset})`, transform: 'translate(-50%, -50%)' }\n}\n\nfunction collapseIconClass(side: 'previous' | 'next', collapsed: boolean) {\n if (props.orientation === 'vertical') {\n if (side === 'previous') return collapsed ? 'i-lucide:chevron-down' : 'i-lucide:chevron-up'\n return collapsed ? 'i-lucide:chevron-up' : 'i-lucide:chevron-down'\n }\n if (side === 'previous') return collapsed ? 'i-lucide:chevron-right' : 'i-lucide:chevron-left'\n return collapsed ? 'i-lucide:chevron-left' : 'i-lucide:chevron-right'\n}\n\nfunction togglePanel(panelIndex: number, neighborIndex: number) {\n measureContainer()\n const sizes = ratiosToPixels(currentRatios.value)\n const panelSize = sizes[panelIndex] ?? 0\n const neighborSize = sizes[neighborIndex] ?? 0\n const pairSize = panelSize + neighborSize\n const nextSizes = [...sizes]\n\n if (panelSize > EPSILON) {\n collapsedSizeCache.set(panelIndex, panelSize)\n nextSizes[panelIndex] = 0\n nextSizes[neighborIndex] = pairSize\n } else {\n const preferred = collapsedSizeCache.get(panelIndex) ?? parseSize(panels.value[panelIndex]?.defaultSize, containerSize.value, pairSize / 2) ?? pairSize / 2\n const minimum = Math.max(panelMinPx(panelIndex), pairSize - panelMaxPx(neighborIndex))\n const maximum = Math.min(panelMaxPx(panelIndex), pairSize - panelMinPx(neighborIndex))\n const restored = Math.min(maximum, Math.max(minimum, preferred))\n nextSizes[panelIndex] = restored\n nextSizes[neighborIndex] = pairSize - restored\n }\n\n const nextRatios = nextSizes.map((size) => (containerSize.value > 0 ? size / containerSize.value : 0))\n const committedSizes = commitRatios(nextRatios)\n emit(\n 'collapse',\n committedSizes.map((size) => size <= EPSILON),\n committedSizes\n )\n}\n\nfunction togglePrevious(index: number) {\n togglePanel(index, index + 1)\n}\n\nfunction toggleNext(index: number) {\n togglePanel(index + 1, index)\n}\n\nfunction handleDraggerDoubleClick(index: number) {\n emit('dragger-double-click', index)\n}\n\nfunction defaultRatios() {\n const defaults = props.defaultValue?.length ? props.defaultValue : panels.value.map((panel) => panel.defaultSize as SplitterSize)\n return normalizeSizes(defaults)\n}\n\nfunction reset() {\n const ratios = defaultRatios()\n const sizes = commitRatios(ratios)\n emit('resize-end', sizes)\n return sizes\n}\n\nfunction getSizes() {\n measureContainer()\n return ratiosToPixels(currentRatios.value)\n}\n\nonMounted(() => {\n measureContainer()\n // Drawer 等浮层会阻止 pointer 事件冒泡,捕获阶段保证浮层内的拖拽仍能完成。\n window.addEventListener('pointermove', handlePointerMove, { capture: true })\n window.addEventListener('pointerup', finishPointerDrag, { capture: true })\n window.addEventListener('pointercancel', finishPointerDrag, { capture: true })\n window.addEventListener('resize', measureContainer)\n if (typeof ResizeObserver !== 'undefined' && rootRef.value) {\n resizeObserver = new ResizeObserver(measureContainer)\n resizeObserver.observe(rootRef.value)\n }\n})\n\nonBeforeUnmount(() => {\n window.removeEventListener('pointermove', handlePointerMove, { capture: true })\n window.removeEventListener('pointerup', finishPointerDrag, { capture: true })\n window.removeEventListener('pointercancel', finishPointerDrag, { capture: true })\n window.removeEventListener('resize', measureContainer)\n resizeObserver?.disconnect()\n setDraggingDocumentState(false)\n})\n\ndefineExpose({\n reset,\n getSizes\n})\n</script>\n\n<template>\n <div ref=\"rootRef\" v-bind=\"exposeAttrs\" data-ui-splitter=\"true\" role=\"group\" :aria-label=\"ariaLabel\" :class=\"rootClass\" :style=\"rootStyle\">\n <template v-for=\"(panel, index) in panels\" :key=\"panel.key\">\n <VNodeRenderer :node=\"createPanelVNode(panel, index)\" />\n\n <div v-if=\"index < panels.length - 1\" data-ui-splitter-bar=\"true\" :class=\"splitterBar({ orientation })\" :style=\"barStyle(index)\">\n <span v-if=\"lazy && activeBarIndex === index\" data-ui-splitter-preview=\"true\" class=\"pointer-events-none absolute z-20 bg-brand-500 dark:bg-brand-400\" :style=\"previewStyle(index)\"></span>\n <div\n data-ui-splitter-dragger=\"true\"\n role=\"separator\"\n :aria-controls=\"`${panelIds[index]} ${panelIds[index + 1]}`\"\n :aria-disabled=\"!isBarResizable(index)\"\n :aria-orientation=\"orientation === 'vertical' ? 'horizontal' : 'vertical'\"\n :aria-valuenow=\"getBarAria(index).now\"\n :aria-valuemin=\"getBarAria(index).min\"\n :aria-valuemax=\"getBarAria(index).max\"\n :tabindex=\"isBarResizable(index) ? 0 : -1\"\n :class=\"splitterDragger({ orientation, resizable: isBarResizable(index) })\"\n @pointerdown=\"handlePointerDown($event, index)\"\n @keydown=\"handleSeparatorKeydown($event, index)\"\n @dblclick=\"handleDraggerDoubleClick(index)\"\n >\n <span :class=\"splitterLine({ orientation, active: activeBarIndex === index, resizable: isBarResizable(index) })\"></span>\n <span v-if=\"$slots.dragger\" class=\"pointer-events-none absolute left-1/2 top-1/2 z-10 inline-flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded bg-primary text-tertiary\">\n <slot name=\"dragger\" :index=\"index\" :active=\"activeBarIndex === index\"></slot>\n </span>\n </div>\n\n <button\n v-if=\"panel.collapsible.end && collapseButtonVisible(panel.collapsible.showCollapsibleIcon)\"\n type=\"button\"\n data-ui-splitter-collapse=\"previous\"\n :aria-label=\"currentRatios[index] <= EPSILON ? '展开前一面板' : '折叠前一面板'\"\n :class=\"collapseButtonClass(panel.collapsible.showCollapsibleIcon)\"\n :style=\"collapseButtonStyle('previous')\"\n @pointerdown.stop\n @click=\"togglePrevious(index)\"\n >\n <span :class=\"collapseIconClass('previous', currentRatios[index] <= EPSILON)\" class=\"size-3.5\"></span>\n </button>\n <button\n v-if=\"panels[index + 1].collapsible.start && collapseButtonVisible(panels[index + 1].collapsible.showCollapsibleIcon)\"\n type=\"button\"\n data-ui-splitter-collapse=\"next\"\n :aria-label=\"currentRatios[index + 1] <= EPSILON ? '展开后一面板' : '折叠后一面板'\"\n :class=\"collapseButtonClass(panels[index + 1].collapsible.showCollapsibleIcon)\"\n :style=\"collapseButtonStyle('next')\"\n @pointerdown.stop\n @click=\"toggleNext(index)\"\n >\n <span :class=\"collapseIconClass('next', currentRatios[index + 1] <= EPSILON)\" class=\"size-3.5\"></span>\n </button>\n </div>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { Comment, Fragment, Text, cloneVNode, computed, defineComponent, nextTick, onBeforeUnmount, onMounted, ref, useAttrs, useSlots, watch } from 'vue'\nimport type { CSSProperties, PropType, StyleValue, VNode } from 'vue'\n\nimport { splitterBar, splitterDragger, splitterLine, splitterRoot, type SplitterCollapsibleIconMode, type SplitterCollapsibleOptions, type SplitterOrientation, type SplitterPanelCollapsibleOptions, type SplitterSize } from '.'\nimport { getUiExposeAttrs } from '../attrs'\nimport SplitterPanel from './SplitterPanel.vue'\n\ndefineOptions({\n inheritAttrs: false\n})\n\ninterface PanelRecord {\n vnode: VNode\n key: PropertyKey\n size?: SplitterSize\n defaultSize?: SplitterSize\n min?: SplitterSize\n max?: SplitterSize\n resizable: boolean\n collapsible: Required<SplitterPanelCollapsibleOptions>\n destroyOnHidden?: boolean\n}\n\ninterface DragState {\n index: number\n pointerId: number\n startClient: number\n startRatios: number[]\n}\n\nconst EPSILON = 0.000001\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是所有面板尺寸的本地 v-model,拖拽后输出 px 数组。 */\n modelValue?: SplitterSize[]\n /** defaultValue 是所有面板的非受控初始尺寸。 */\n defaultValue?: SplitterSize[]\n /** orientation 是面板排列方向。 */\n orientation?: SplitterOrientation\n /** lazy 表示拖拽时只移动预览线,松开后再调整面板。 */\n lazy?: boolean\n /** keyboardStep 是键盘方向键每次调整的像素数。 */\n keyboardStep?: number\n /** collapsible 配置折叠动画。 */\n collapsible?: SplitterCollapsibleOptions\n /** destroyOnHidden 表示面板折叠为 0 时销毁内容。 */\n destroyOnHidden?: boolean\n /** ariaLabel 是分割面板根节点的无障碍名称。 */\n ariaLabel?: string\n }>(),\n {\n modelValue: undefined,\n defaultValue: undefined,\n orientation: 'horizontal',\n lazy: false,\n keyboardStep: 10,\n collapsible: undefined,\n destroyOnHidden: false,\n ariaLabel: '分割面板'\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', sizes: number[]): void\n (e: 'resize-start', sizes: number[]): void\n (e: 'resize', sizes: number[]): void\n (e: 'resize-end', sizes: number[]): void\n (e: 'collapse', collapsed: boolean[], sizes: number[]): void\n (e: 'dragger-double-click', index: number): void\n}>()\n\nconst attrs = useAttrs()\nconst slots = useSlots()\nconst rootRef = ref<HTMLElement | null>(null)\nconst containerSize = ref(0)\nconst internalSizes = ref<SplitterSize[]>([])\nconst dragRatios = ref<number[] | null>(null)\nconst dragState = ref<DragState | null>(null)\nconst activeBarIndex = ref(-1)\nconst lazyPreviewOffset = ref(0)\nconst collapsedSizeCache = new Map<number, number>()\nconst splitterId = `ui-splitter-${Math.random().toString(36).slice(2, 9)}`\nlet resizeObserver: ResizeObserver | null = null\nlet previousBodyCursor = ''\nlet previousBodyUserSelect = ''\n\nconst VNodeRenderer = defineComponent({\n name: 'SplitterVNodeRenderer',\n props: {\n node: {\n type: Object as PropType<VNode>,\n required: true\n }\n },\n setup(rendererProps) {\n return () => rendererProps.node\n }\n})\n\nfunction flattenPanelVNodes(nodes: VNode[], result: VNode[] = []) {\n for (const node of nodes) {\n if (node.type === Fragment && Array.isArray(node.children)) {\n flattenPanelVNodes(node.children as VNode[], result)\n continue\n }\n if (node.type === Comment || node.type === Text) continue\n if (node.type === SplitterPanel || (typeof node.type === 'object' && '__name' in node.type && node.type.__name === 'SplitterPanel')) {\n result.push(node)\n }\n }\n return result\n}\n\nfunction readVNodeProp<T>(vnode: VNode, name: string): T | undefined {\n const kebabName = name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n return (vnode.props?.[name] ?? vnode.props?.[kebabName]) as T | undefined\n}\n\nfunction normalizeCollapsible(value: unknown): Required<SplitterPanelCollapsibleOptions> {\n if (value && typeof value === 'object') {\n const options = value as SplitterPanelCollapsibleOptions\n return {\n start: Boolean(options.start),\n end: Boolean(options.end),\n showCollapsibleIcon: options.showCollapsibleIcon ?? 'auto'\n }\n }\n const enabled = value === true || value === ''\n return {\n start: enabled,\n end: enabled,\n showCollapsibleIcon: 'auto'\n }\n}\n\nconst panels = computed<PanelRecord[]>(() =>\n flattenPanelVNodes(slots.default?.() ?? []).map((vnode, index) => ({\n vnode,\n key: vnode.key ?? index,\n size: readVNodeProp<SplitterSize>(vnode, 'size'),\n defaultSize: readVNodeProp<SplitterSize>(vnode, 'defaultSize'),\n min: readVNodeProp<SplitterSize>(vnode, 'min'),\n max: readVNodeProp<SplitterSize>(vnode, 'max'),\n resizable: readVNodeProp<boolean>(vnode, 'resizable') !== false,\n collapsible: normalizeCollapsible(readVNodeProp(vnode, 'collapsible')),\n destroyOnHidden: readVNodeProp<boolean>(vnode, 'destroyOnHidden')\n }))\n)\n\nconst panelIdentity = computed(() => panels.value.map((panel) => String(panel.key)).join('|'))\nconst hasControlledPanelSize = computed(() => panels.value.some((panel) => panel.size !== undefined))\nconst isControlled = computed(() => props.modelValue !== undefined || hasControlledPanelSize.value)\nconst sourceSizes = computed<SplitterSize[]>(() => {\n if (props.modelValue !== undefined) return props.modelValue\n if (hasControlledPanelSize.value) return panels.value.map((panel) => panel.size as SplitterSize)\n if (internalSizes.value.length === panels.value.length) return internalSizes.value\n if (props.defaultValue?.length) return props.defaultValue\n return panels.value.map((panel) => panel.defaultSize as SplitterSize)\n})\n\nfunction parseSize(value: SplitterSize | undefined, total: number, fallback?: number) {\n if (value === undefined || value === null || value === '') return fallback\n if (typeof value === 'string' && value.trim().endsWith('%')) {\n const percent = Number(value.trim().slice(0, -1))\n return Number.isFinite(percent) ? (percent / 100) * total : fallback\n }\n const numeric = Number(value)\n return Number.isFinite(numeric) ? numeric : fallback\n}\n\nfunction distributeDifference(values: number[], minValues: number[], maxValues: number[]) {\n const result = values.map((value, index) => Math.min(maxValues[index], Math.max(minValues[index], value)))\n for (let pass = 0; pass < result.length * 2; pass += 1) {\n const difference = 1 - result.reduce((sum, value) => sum + value, 0)\n if (Math.abs(difference) <= EPSILON) break\n const candidates = result.map((value, index) => ({ index, room: difference > 0 ? maxValues[index] - value : value - minValues[index] })).filter((item) => item.room > EPSILON)\n if (!candidates.length) break\n const share = Math.abs(difference) / candidates.length\n for (const candidate of candidates) {\n const change = Math.min(candidate.room, share)\n result[candidate.index] += difference > 0 ? change : -change\n }\n }\n\n const remainder = 1 - result.reduce((sum, value) => sum + value, 0)\n if (Math.abs(remainder) > EPSILON && result.length) result[result.length - 1] = Math.max(0, result[result.length - 1] + remainder)\n return result\n}\n\nfunction normalizeSizes(rawSizes: SplitterSize[], panelList = panels.value) {\n const count = panelList.length\n if (!count) return []\n const total = containerSize.value > 0 ? containerSize.value : 1\n const rawRatios = Array.from({ length: count }, (_, index) => {\n const parsed = parseSize(rawSizes[index], total)\n return parsed === undefined ? undefined : Math.max(0, parsed / total)\n })\n const minRatios = panelList.map((panel, index) => (rawRatios[index] === 0 ? 0 : Math.max(0, (parseSize(panel.min, total, 0) ?? 0) / total)))\n const maxRatios = panelList.map((panel) => Math.max(0, Math.min(1, (parseSize(panel.max, total, total) ?? total) / total)))\n const specifiedTotal = rawRatios.reduce<number>((sum, value) => sum + (value ?? 0), 0)\n const undefinedIndexes = rawRatios.map((value, index) => (value === undefined ? index : -1)).filter((index) => index >= 0)\n let ratios: number[]\n\n if (!undefinedIndexes.length) {\n if (specifiedTotal <= EPSILON) ratios = rawRatios.map(() => 1 / count)\n else ratios = rawRatios.map((value) => (value ?? 0) / specifiedTotal)\n } else if (specifiedTotal >= 1) {\n ratios = rawRatios.map((value) => (value === undefined ? 0 : value / specifiedTotal))\n } else {\n const rest = (1 - specifiedTotal) / undefinedIndexes.length\n ratios = rawRatios.map((value) => value ?? rest)\n }\n\n return distributeDifference(ratios, minRatios, maxRatios)\n}\n\nconst baseRatios = computed(() => normalizeSizes(sourceSizes.value))\nconst currentRatios = computed(() => dragRatios.value ?? baseRatios.value)\nconst rootClass = computed(() => clsx(splitterRoot({ orientation: props.orientation }), attrs.class as string | undefined))\nconst rootStyle = computed<StyleValue>(() => attrs.style as StyleValue | undefined)\nconst exposeAttrs = computed(() => getUiExposeAttrs(attrs))\nconst panelIds = computed(() => panels.value.map((panel, index) => readVNodeProp<string>(panel.vnode, 'id') ?? `${splitterId}-panel-${index}`))\n\nwatch(panelIdentity, () => {\n internalSizes.value = []\n dragRatios.value = null\n collapsedSizeCache.clear()\n})\n\nwatch(\n () => props.orientation,\n async () => {\n await nextTick()\n measureContainer()\n }\n)\n\nfunction measureContainer() {\n const rect = rootRef.value?.getBoundingClientRect()\n const nextSize = props.orientation === 'vertical' ? rect?.height : rect?.width\n if (nextSize && Number.isFinite(nextSize)) containerSize.value = nextSize\n}\n\nfunction ratiosToPixels(ratios: number[]) {\n const total = containerSize.value\n return ratios.map((ratio) => Number((ratio * total).toFixed(2)))\n}\n\nfunction panelMinPx(index: number, allowCollapsed = false) {\n if (allowCollapsed && currentRatios.value[index] <= EPSILON) return 0\n return parseSize(panels.value[index]?.min, containerSize.value, 0) ?? 0\n}\n\nfunction panelMaxPx(index: number) {\n return parseSize(panels.value[index]?.max, containerSize.value, containerSize.value) ?? containerSize.value\n}\n\nfunction isBarResizable(index: number) {\n const previous = panels.value[index]\n const next = panels.value[index + 1]\n if (!previous || !next || !previous.resizable || !next.resizable) return false\n const sizes = ratiosToPixels(currentRatios.value)\n if (sizes[index] <= EPSILON && panelMinPx(index) > 0) return false\n if (sizes[index + 1] <= EPSILON && panelMinPx(index + 1) > 0) return false\n return true\n}\n\nfunction clampOffset(index: number, requestedOffset: number, startRatios: number[]) {\n const sizes = ratiosToPixels(startRatios)\n const previousSize = sizes[index] ?? 0\n const nextSize = sizes[index + 1] ?? 0\n const lowerBound = Math.max(panelMinPx(index) - previousSize, nextSize - panelMaxPx(index + 1))\n const upperBound = Math.min(panelMaxPx(index) - previousSize, nextSize - panelMinPx(index + 1))\n return Math.min(upperBound, Math.max(lowerBound, requestedOffset))\n}\n\nfunction offsetRatios(index: number, requestedOffset: number, startRatios: number[]) {\n if (containerSize.value <= 0) return startRatios\n const offset = clampOffset(index, requestedOffset, startRatios)\n const next = [...startRatios]\n next[index] += offset / containerSize.value\n next[index + 1] -= offset / containerSize.value\n return next\n}\n\nfunction commitRatios(ratios: number[], emitResize = true) {\n const sizes = ratiosToPixels(ratios)\n if (!isControlled.value) internalSizes.value = sizes\n if (dragState.value) dragRatios.value = ratios\n emit('update:modelValue', sizes)\n if (emitResize) emit('resize', sizes)\n return sizes\n}\n\nfunction boundaryPercent(index: number) {\n return currentRatios.value.slice(0, index + 1).reduce((sum, value) => sum + value, 0) * 100\n}\n\nfunction barStyle(index: number): CSSProperties {\n const transition = props.collapsible?.motion && activeBarIndex.value < 0 ? `${props.orientation === 'vertical' ? 'top' : 'left'} 180ms ease` : undefined\n return props.orientation === 'vertical' ? { top: `${boundaryPercent(index)}%`, transition } : { left: `${boundaryPercent(index)}%`, transition }\n}\n\nfunction previewStyle(index: number): CSSProperties {\n const active = activeBarIndex.value === index && props.lazy\n if (props.orientation === 'vertical') {\n return {\n left: 0,\n right: 0,\n top: `calc(50% + ${active ? lazyPreviewOffset.value : 0}px)`,\n height: '2px',\n transform: 'translateY(-50%)'\n }\n }\n return {\n bottom: 0,\n left: `calc(50% + ${active ? lazyPreviewOffset.value : 0}px)`,\n top: 0,\n width: '2px',\n transform: 'translateX(-50%)'\n }\n}\n\nfunction createPanelVNode(panel: PanelRecord, index: number) {\n const ratio = currentRatios.value[index] ?? 0\n return cloneVNode(panel.vnode, {\n id: panelIds.value[index],\n splitterSize: ratio,\n splitterOrientation: props.orientation,\n splitterCollapsed: ratio <= EPSILON,\n splitterDestroyOnHidden: props.destroyOnHidden,\n splitterMotion: Boolean(props.collapsible?.motion) && activeBarIndex.value < 0\n })\n}\n\nfunction setDraggingDocumentState(active: boolean) {\n if (typeof document === 'undefined') return\n if (active) {\n previousBodyCursor = document.body.style.cursor\n previousBodyUserSelect = document.body.style.userSelect\n document.body.style.cursor = props.orientation === 'vertical' ? 'row-resize' : 'col-resize'\n document.body.style.userSelect = 'none'\n return\n }\n document.body.style.cursor = previousBodyCursor\n document.body.style.userSelect = previousBodyUserSelect\n}\n\nfunction handlePointerDown(event: PointerEvent, index: number) {\n if (event.button !== 0 || !isBarResizable(index)) return\n measureContainer()\n event.preventDefault()\n const startRatios = [...currentRatios.value]\n dragState.value = {\n index,\n pointerId: event.pointerId,\n startClient: props.orientation === 'vertical' ? event.clientY : event.clientX,\n startRatios\n }\n dragRatios.value = startRatios\n activeBarIndex.value = index\n lazyPreviewOffset.value = 0\n setDraggingDocumentState(true)\n rootRef.value?.setPointerCapture?.(event.pointerId)\n emit('resize-start', ratiosToPixels(startRatios))\n}\n\nfunction handlePointerMove(event: PointerEvent) {\n const state = dragState.value\n if (!state || (event.pointerId !== undefined && state.pointerId !== event.pointerId)) return\n const client = props.orientation === 'vertical' ? event.clientY : event.clientX\n const offset = clampOffset(state.index, client - state.startClient, state.startRatios)\n if (props.lazy) {\n lazyPreviewOffset.value = offset\n return\n }\n commitRatios(offsetRatios(state.index, offset, state.startRatios))\n}\n\nfunction finishPointerDrag(event?: PointerEvent) {\n const state = dragState.value\n if (!state || (event?.pointerId !== undefined && state.pointerId !== event.pointerId)) return\n let finalRatios = dragRatios.value ?? state.startRatios\n if (props.lazy) {\n finalRatios = offsetRatios(state.index, lazyPreviewOffset.value, state.startRatios)\n if (Math.abs(lazyPreviewOffset.value) > EPSILON) commitRatios(finalRatios)\n }\n emit('resize-end', ratiosToPixels(finalRatios))\n dragState.value = null\n dragRatios.value = null\n activeBarIndex.value = -1\n lazyPreviewOffset.value = 0\n setDraggingDocumentState(false)\n}\n\nfunction getBarAria(index: number) {\n const sizes = ratiosToPixels(currentRatios.value)\n const previousSize = sizes[index] ?? 0\n const pairSize = previousSize + (sizes[index + 1] ?? 0)\n return {\n now: Math.round(previousSize),\n min: Math.round(Math.max(panelMinPx(index, true), pairSize - panelMaxPx(index + 1))),\n max: Math.round(Math.min(panelMaxPx(index), pairSize - panelMinPx(index + 1, true)))\n }\n}\n\nfunction handleSeparatorKeydown(event: KeyboardEvent, index: number) {\n if (!isBarResizable(index)) return\n const aria = getBarAria(index)\n const step = Math.max(1, props.keyboardStep)\n let offset: number | undefined\n if (props.orientation === 'horizontal' && event.key === 'ArrowLeft') offset = -step\n if (props.orientation === 'horizontal' && event.key === 'ArrowRight') offset = step\n if (props.orientation === 'vertical' && event.key === 'ArrowUp') offset = -step\n if (props.orientation === 'vertical' && event.key === 'ArrowDown') offset = step\n if (event.key === 'Home') offset = aria.min - aria.now\n if (event.key === 'End') offset = aria.max - aria.now\n if (offset === undefined) return\n\n event.preventDefault()\n measureContainer()\n const startRatios = [...currentRatios.value]\n emit('resize-start', ratiosToPixels(startRatios))\n const finalRatios = offsetRatios(index, offset, startRatios)\n const sizes = commitRatios(finalRatios)\n emit('resize-end', sizes)\n}\n\nfunction collapseButtonVisible(mode: SplitterCollapsibleIconMode) {\n return mode !== false\n}\n\nfunction collapseButtonClass(mode: SplitterCollapsibleIconMode) {\n return clsx(\n 'pointer-events-auto absolute z-30 inline-flex size-5 items-center justify-center rounded border border-medium bg-primary text-tertiary shadow-sm outline-none transition-[color,opacity,background-color] hover:bg-secondary hover:text-brand-500 focus-visible:ring-2 focus-visible:ring-brand-400',\n mode === 'auto' && 'opacity-0 group-hover/ui-splitter-bar:opacity-100 group-focus-within/ui-splitter-bar:opacity-100'\n )\n}\n\nfunction collapseButtonStyle(side: 'previous' | 'next'): CSSProperties {\n const offset = side === 'previous' ? '-13px' : '13px'\n if (props.orientation === 'vertical') {\n return { left: `calc(50% + ${offset})`, top: '50%', transform: 'translate(-50%, -50%)' }\n }\n return { left: '50%', top: `calc(50% + ${offset})`, transform: 'translate(-50%, -50%)' }\n}\n\nfunction collapseIconClass(side: 'previous' | 'next', collapsed: boolean) {\n if (props.orientation === 'vertical') {\n if (side === 'previous') return collapsed ? 'i-lucide:chevron-down' : 'i-lucide:chevron-up'\n return collapsed ? 'i-lucide:chevron-up' : 'i-lucide:chevron-down'\n }\n if (side === 'previous') return collapsed ? 'i-lucide:chevron-right' : 'i-lucide:chevron-left'\n return collapsed ? 'i-lucide:chevron-left' : 'i-lucide:chevron-right'\n}\n\nfunction togglePanel(panelIndex: number, neighborIndex: number) {\n measureContainer()\n const sizes = ratiosToPixels(currentRatios.value)\n const panelSize = sizes[panelIndex] ?? 0\n const neighborSize = sizes[neighborIndex] ?? 0\n const pairSize = panelSize + neighborSize\n const nextSizes = [...sizes]\n\n if (panelSize > EPSILON) {\n collapsedSizeCache.set(panelIndex, panelSize)\n nextSizes[panelIndex] = 0\n nextSizes[neighborIndex] = pairSize\n } else {\n const preferred = collapsedSizeCache.get(panelIndex) ?? parseSize(panels.value[panelIndex]?.defaultSize, containerSize.value, pairSize / 2) ?? pairSize / 2\n const minimum = Math.max(panelMinPx(panelIndex), pairSize - panelMaxPx(neighborIndex))\n const maximum = Math.min(panelMaxPx(panelIndex), pairSize - panelMinPx(neighborIndex))\n const restored = Math.min(maximum, Math.max(minimum, preferred))\n nextSizes[panelIndex] = restored\n nextSizes[neighborIndex] = pairSize - restored\n }\n\n const nextRatios = nextSizes.map((size) => (containerSize.value > 0 ? size / containerSize.value : 0))\n const committedSizes = commitRatios(nextRatios)\n emit(\n 'collapse',\n committedSizes.map((size) => size <= EPSILON),\n committedSizes\n )\n}\n\nfunction togglePrevious(index: number) {\n togglePanel(index, index + 1)\n}\n\nfunction toggleNext(index: number) {\n togglePanel(index + 1, index)\n}\n\nfunction handleDraggerDoubleClick(index: number) {\n emit('dragger-double-click', index)\n}\n\nfunction defaultRatios() {\n const defaults = props.defaultValue?.length ? props.defaultValue : panels.value.map((panel) => panel.defaultSize as SplitterSize)\n return normalizeSizes(defaults)\n}\n\nfunction reset() {\n const ratios = defaultRatios()\n const sizes = commitRatios(ratios)\n emit('resize-end', sizes)\n return sizes\n}\n\nfunction getSizes() {\n measureContainer()\n return ratiosToPixels(currentRatios.value)\n}\n\nonMounted(() => {\n measureContainer()\n // Drawer 等浮层会阻止 pointer 事件冒泡,捕获阶段保证浮层内的拖拽仍能完成。\n window.addEventListener('pointermove', handlePointerMove, { capture: true })\n window.addEventListener('pointerup', finishPointerDrag, { capture: true })\n window.addEventListener('pointercancel', finishPointerDrag, { capture: true })\n window.addEventListener('resize', measureContainer)\n if (typeof ResizeObserver !== 'undefined' && rootRef.value) {\n resizeObserver = new ResizeObserver(measureContainer)\n resizeObserver.observe(rootRef.value)\n }\n})\n\nonBeforeUnmount(() => {\n window.removeEventListener('pointermove', handlePointerMove, { capture: true })\n window.removeEventListener('pointerup', finishPointerDrag, { capture: true })\n window.removeEventListener('pointercancel', finishPointerDrag, { capture: true })\n window.removeEventListener('resize', measureContainer)\n resizeObserver?.disconnect()\n setDraggingDocumentState(false)\n})\n\ndefineExpose({\n reset,\n getSizes\n})\n</script>\n\n<template>\n <div ref=\"rootRef\" v-bind=\"exposeAttrs\" data-ui-splitter=\"true\" role=\"group\" :aria-label=\"ariaLabel\" :class=\"rootClass\" :style=\"rootStyle\">\n <template v-for=\"(panel, index) in panels\" :key=\"panel.key\">\n <VNodeRenderer :node=\"createPanelVNode(panel, index)\" />\n\n <div v-if=\"index < panels.length - 1\" data-ui-splitter-bar=\"true\" :class=\"splitterBar({ orientation })\" :style=\"barStyle(index)\">\n <span v-if=\"lazy && activeBarIndex === index\" data-ui-splitter-preview=\"true\" class=\"pointer-events-none absolute z-20 bg-brand-500 dark:bg-brand-400\" :style=\"previewStyle(index)\"></span>\n <div\n data-ui-splitter-dragger=\"true\"\n role=\"separator\"\n :aria-controls=\"`${panelIds[index]} ${panelIds[index + 1]}`\"\n :aria-disabled=\"!isBarResizable(index)\"\n :aria-orientation=\"orientation === 'vertical' ? 'horizontal' : 'vertical'\"\n :aria-valuenow=\"getBarAria(index).now\"\n :aria-valuemin=\"getBarAria(index).min\"\n :aria-valuemax=\"getBarAria(index).max\"\n :tabindex=\"isBarResizable(index) ? 0 : -1\"\n :class=\"splitterDragger({ orientation, resizable: isBarResizable(index) })\"\n @pointerdown=\"handlePointerDown($event, index)\"\n @keydown=\"handleSeparatorKeydown($event, index)\"\n @dblclick=\"handleDraggerDoubleClick(index)\"\n >\n <span :class=\"splitterLine({ orientation, active: activeBarIndex === index, resizable: isBarResizable(index) })\"></span>\n <span v-if=\"$slots.dragger\" class=\"pointer-events-none absolute left-1/2 top-1/2 z-10 inline-flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded bg-primary text-tertiary\">\n <slot name=\"dragger\" :index=\"index\" :active=\"activeBarIndex === index\"></slot>\n </span>\n </div>\n\n <button\n v-if=\"panel.collapsible.end && collapseButtonVisible(panel.collapsible.showCollapsibleIcon)\"\n type=\"button\"\n data-ui-splitter-collapse=\"previous\"\n :aria-label=\"currentRatios[index] <= EPSILON ? '展开前一面板' : '折叠前一面板'\"\n :class=\"collapseButtonClass(panel.collapsible.showCollapsibleIcon)\"\n :style=\"collapseButtonStyle('previous')\"\n @pointerdown.stop\n @click=\"togglePrevious(index)\"\n >\n <span :class=\"collapseIconClass('previous', currentRatios[index] <= EPSILON)\" class=\"size-3.5\"></span>\n </button>\n <button\n v-if=\"panels[index + 1].collapsible.start && collapseButtonVisible(panels[index + 1].collapsible.showCollapsibleIcon)\"\n type=\"button\"\n data-ui-splitter-collapse=\"next\"\n :aria-label=\"currentRatios[index + 1] <= EPSILON ? '展开后一面板' : '折叠后一面板'\"\n :class=\"collapseButtonClass(panels[index + 1].collapsible.showCollapsibleIcon)\"\n :style=\"collapseButtonStyle('next')\"\n @pointerdown.stop\n @click=\"toggleNext(index)\"\n >\n <span :class=\"collapseIconClass('next', currentRatios[index + 1] <= EPSILON)\" class=\"size-3.5\"></span>\n </button>\n </div>\n </template>\n </div>\n</template>\n","import { cva } from 'class-variance-authority'\nimport type { VariantProps } from 'class-variance-authority'\n\nexport { default as Splitter } from './Splitter.vue'\nexport { default as SplitterPanel } from './SplitterPanel.vue'\n\nexport type SplitterOrientation = 'horizontal' | 'vertical'\nexport type SplitterSize = number | string\nexport type SplitterCollapsibleIconMode = boolean | 'auto'\n\nexport interface SplitterCollapsibleOptions {\n motion?: boolean\n}\n\nexport interface SplitterPanelCollapsibleOptions {\n start?: boolean\n end?: boolean\n showCollapsibleIcon?: SplitterCollapsibleIconMode\n}\n\nexport type SplitterPanelCollapsible = boolean | SplitterPanelCollapsibleOptions\n\n/** splitterRoot 定义分割面板的主轴方向和基础容器约束。 */\nexport const splitterRoot = cva('relative flex min-h-0 min-w-0 overflow-hidden bg-primary text-primary', {\n variants: {\n orientation: {\n horizontal: 'flex-row',\n vertical: 'flex-col'\n }\n },\n defaultVariants: {\n orientation: 'horizontal'\n }\n})\n\n/** splitterPanel 定义面板内容的滚动和收缩边界。 */\nexport const splitterPanel = cva('relative min-h-0 min-w-0 overflow-auto', {\n variants: {\n collapsed: {\n true: 'overflow-hidden',\n false: ''\n }\n },\n defaultVariants: {\n collapsed: false\n }\n})\n\n/** splitterBar 扩大分隔线的拖拽命中区域,但不占用面板布局尺寸。 */\nexport const splitterBar = cva('group/ui-splitter-bar pointer-events-none absolute z-20', {\n variants: {\n orientation: {\n horizontal: 'inset-y-0 w-3 -translate-x-1/2',\n vertical: 'inset-x-0 h-3 -translate-y-1/2'\n }\n },\n defaultVariants: {\n orientation: 'horizontal'\n }\n})\n\n/** splitterDragger 定义可聚焦的 separator 命中区和光标状态。 */\nexport const splitterDragger = cva('group/ui-splitter-dragger pointer-events-auto absolute inset-0 touch-none select-none outline-none', {\n variants: {\n orientation: {\n horizontal: 'cursor-col-resize',\n vertical: 'cursor-row-resize'\n },\n resizable: {\n true: '',\n false: 'cursor-default'\n }\n },\n defaultVariants: {\n orientation: 'horizontal',\n resizable: true\n }\n})\n\n/** splitterLine 定义分隔线默认、悬浮、聚焦和拖拽状态。 */\nexport const splitterLine = cva('pointer-events-none absolute bg-zinc-200 transition-[background-color,width,height] duration-150 dark:bg-zinc-700', {\n variants: {\n orientation: {\n horizontal: 'inset-y-0 left-1/2 w-px -translate-x-1/2',\n vertical: 'inset-x-0 top-1/2 h-px -translate-y-1/2'\n },\n active: {\n true: 'bg-brand-500 dark:bg-brand-400',\n false: 'group-hover/ui-splitter-dragger:bg-brand-400 group-focus-visible/ui-splitter-dragger:bg-brand-500 dark:group-hover/ui-splitter-dragger:bg-brand-400'\n },\n resizable: {\n true: '',\n false: 'bg-zinc-200 opacity-70 dark:bg-zinc-700'\n }\n },\n compoundVariants: [\n { orientation: 'horizontal', active: true, class: 'w-0.5' },\n { orientation: 'vertical', active: true, class: 'h-0.5' }\n ],\n defaultVariants: {\n orientation: 'hor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ACN,OAAO;EACT;CACF;CACA,kBAAkB,CAChB;EAAE,aAAa;EAAc,QAAQ;EAAM,OAAO;CAAQ,GAC1D;EAAE,aAAa;EAAY,QAAQ;EAAM,OAAO;CAAQ,CAC1D;CACA,iBAAiB;EACf,aAAa;EACb,QAAQ;EACR,WAAW;CACb;AACF,CAAC"}
@@ -0,0 +1,327 @@
1
+ import { getUiAttrClass as e, getUiAttrStyle as t, getUiExposeAttrs as n } from "../attrs.js";
2
+ import { cva as r } from "class-variance-authority";
3
+ import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, mergeProps as l, normalizeClass as u, normalizeStyle as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g, useAttrs as _, watch as v } from "vue";
4
+ import { clsx as y } from "clsx";
5
+ //#region src/switch/Switch.vue?vue&type=script&setup=true&lang.ts
6
+ var b = [
7
+ "id",
8
+ "aria-checked",
9
+ "name",
10
+ "value",
11
+ "checked",
12
+ "disabled"
13
+ ], x = {
14
+ key: 3,
15
+ class: "truncate"
16
+ }, S = {
17
+ key: 0,
18
+ class: "i-lucide:loader-2 size-[82%] animate-spin"
19
+ }, C = /* @__PURE__ */ c({
20
+ inheritAttrs: !1,
21
+ __name: "Switch",
22
+ props: {
23
+ modelValue: {
24
+ type: [
25
+ String,
26
+ Number,
27
+ Boolean
28
+ ],
29
+ default: void 0
30
+ },
31
+ checked: {
32
+ type: Boolean,
33
+ default: void 0
34
+ },
35
+ activeValue: {
36
+ type: [
37
+ String,
38
+ Number,
39
+ Boolean
40
+ ],
41
+ default: !0
42
+ },
43
+ inactiveValue: {
44
+ type: [
45
+ String,
46
+ Number,
47
+ Boolean
48
+ ],
49
+ default: !1
50
+ },
51
+ disabled: {
52
+ type: Boolean,
53
+ default: !1
54
+ },
55
+ loading: {
56
+ type: Boolean,
57
+ default: !1
58
+ },
59
+ size: { default: "md" },
60
+ width: { default: void 0 },
61
+ activeText: { default: "" },
62
+ inactiveText: { default: "" },
63
+ activeIcon: { default: "" },
64
+ inactiveIcon: { default: "" },
65
+ activeActionIcon: { default: "" },
66
+ inactiveActionIcon: { default: "" },
67
+ inlinePrompt: {
68
+ type: Boolean,
69
+ default: !1
70
+ },
71
+ activeColor: { default: "" },
72
+ inactiveColor: { default: "" },
73
+ beforeChange: {
74
+ type: Function,
75
+ default: void 0
76
+ },
77
+ name: { default: void 0 },
78
+ id: { default: void 0 }
79
+ },
80
+ emits: [
81
+ "update:modelValue",
82
+ "input",
83
+ "change",
84
+ "focus",
85
+ "blur"
86
+ ],
87
+ setup(r, { emit: c }) {
88
+ let C = r, k = c, A = _(), j = p(!!C.checked), M = p(!1), N = i(() => C.disabled || C.loading || M.value), P = i(() => C.modelValue === void 0 ? j.value : Object.is(C.modelValue, C.activeValue)), F = i(() => P.value ? C.activeValue : C.inactiveValue), I = i(() => P.value ? C.activeText : C.inactiveText), L = i(() => P.value ? C.activeIcon : C.inactiveIcon), R = i(() => P.value ? C.activeActionIcon : C.inactiveActionIcon), z = i(() => C.inlinePrompt && (!!I.value || !!L.value)), B = i(() => y(e(A), w({
89
+ size: C.size,
90
+ disabled: N.value
91
+ }))), V = i(() => T({
92
+ size: C.size,
93
+ checked: P.value,
94
+ disabled: N.value
95
+ })), H = i(() => E({
96
+ size: C.size,
97
+ checked: P.value,
98
+ disabled: N.value
99
+ })), U = i(() => D({
100
+ size: C.size,
101
+ checked: P.value
102
+ })), W = i(() => O({
103
+ checked: !P.value,
104
+ disabled: N.value
105
+ })), G = i(() => O({
106
+ checked: P.value,
107
+ disabled: N.value
108
+ })), K = (e) => {
109
+ if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
110
+ }, q = i(() => {
111
+ let e = P.value ? C.activeColor : C.inactiveColor;
112
+ return {
113
+ width: K(C.width),
114
+ backgroundColor: e || void 0,
115
+ borderColor: e || void 0
116
+ };
117
+ });
118
+ v(() => C.checked, (e) => {
119
+ C.modelValue === void 0 && (j.value = !!e);
120
+ });
121
+ function J(e) {
122
+ let t = e.target;
123
+ t && (t.checked = P.value);
124
+ }
125
+ async function Y() {
126
+ if (!C.beforeChange) return !0;
127
+ try {
128
+ return await C.beforeChange() !== !1;
129
+ } catch {
130
+ return !1;
131
+ }
132
+ }
133
+ function X(e, t) {
134
+ j.value = e;
135
+ let n = e ? C.activeValue : C.inactiveValue;
136
+ k("update:modelValue", n), k("input", n, t), k("change", n, t);
137
+ }
138
+ function Z(e) {
139
+ N.value && J(e);
140
+ }
141
+ async function Q(e) {
142
+ if (N.value) {
143
+ J(e);
144
+ return;
145
+ }
146
+ let t = e.target.checked;
147
+ if (C.beforeChange) {
148
+ J(e), M.value = !0;
149
+ let t = await Y();
150
+ if (M.value = !1, !t) return;
151
+ }
152
+ X(t, e);
153
+ }
154
+ return (e, i) => (f(), o("label", {
155
+ class: u(B.value),
156
+ style: d(g(t)(g(A)))
157
+ }, [
158
+ r.inactiveText && !r.inlinePrompt ? (f(), o("span", {
159
+ key: 0,
160
+ class: u(W.value)
161
+ }, h(r.inactiveText), 3)) : a("", !0),
162
+ s("span", {
163
+ class: u(V.value),
164
+ style: d(q.value)
165
+ }, [
166
+ s("input", l(g(n)(g(A)), {
167
+ id: r.id,
168
+ "data-map-ui-switch": "true",
169
+ type: "checkbox",
170
+ role: "switch",
171
+ "aria-checked": P.value,
172
+ name: r.name,
173
+ value: String(F.value),
174
+ checked: P.value,
175
+ disabled: N.value,
176
+ class: "absolute inset-0 z-20 m-0 h-full w-full cursor-inherit opacity-0",
177
+ onChange: Q,
178
+ onInput: Z,
179
+ onFocus: i[0] ||= (e) => k("focus", e),
180
+ onBlur: i[1] ||= (e) => k("blur", e)
181
+ }), null, 16, b),
182
+ z.value ? (f(), o("span", {
183
+ key: 0,
184
+ class: u(U.value)
185
+ }, [P.value && e.$slots.active ? m(e.$slots, "active", { key: 0 }) : !P.value && e.$slots.inactive ? m(e.$slots, "inactive", { key: 1 }) : L.value ? (f(), o("span", {
186
+ key: 2,
187
+ class: u([L.value, "size-3 shrink-0"])
188
+ }, null, 2)) : (f(), o("span", x, h(I.value), 1))], 2)) : a("", !0),
189
+ s("span", {
190
+ class: u(H.value),
191
+ "aria-hidden": "true"
192
+ }, [r.loading || M.value ? (f(), o("span", S)) : P.value && e.$slots["active-action"] ? m(e.$slots, "active-action", { key: 1 }) : !P.value && e.$slots["inactive-action"] ? m(e.$slots, "inactive-action", { key: 2 }) : R.value ? (f(), o("span", {
193
+ key: 3,
194
+ class: u([R.value, "size-[82%]"])
195
+ }, null, 2)) : a("", !0)], 2)
196
+ ], 6),
197
+ r.activeText && !r.inlinePrompt ? (f(), o("span", {
198
+ key: 1,
199
+ class: u(G.value)
200
+ }, h(r.activeText), 3)) : a("", !0)
201
+ ], 6));
202
+ }
203
+ }), w = r("inline-flex w-fit items-center align-middle transition-colors duration-150", {
204
+ variants: {
205
+ size: {
206
+ sm: "gap-1.5 text-xs/5",
207
+ md: "gap-2 text-sm/5",
208
+ lg: "gap-2.5 text-base/6"
209
+ },
210
+ disabled: {
211
+ true: "cursor-not-allowed opacity-70",
212
+ false: "cursor-pointer"
213
+ }
214
+ },
215
+ defaultVariants: {
216
+ size: "md",
217
+ disabled: !1
218
+ }
219
+ }), T = r("relative inline-flex shrink-0 items-center overflow-hidden rounded-full border align-middle transition-colors duration-200", {
220
+ variants: {
221
+ size: {
222
+ sm: "h-4 min-w-8",
223
+ md: "h-5 min-w-10",
224
+ lg: "h-6 min-w-12"
225
+ },
226
+ checked: {
227
+ true: "",
228
+ false: ""
229
+ },
230
+ disabled: {
231
+ true: "cursor-not-allowed",
232
+ false: "cursor-pointer"
233
+ }
234
+ },
235
+ compoundVariants: [
236
+ {
237
+ checked: !0,
238
+ disabled: !1,
239
+ class: "border-brand-500 bg-brand-500 hover:border-brand-400 hover:bg-brand-400 dark:border-brand-400 dark:bg-brand-500"
240
+ },
241
+ {
242
+ checked: !0,
243
+ disabled: !0,
244
+ class: "border-zinc-400 bg-zinc-400 dark:border-zinc-600 dark:bg-zinc-700"
245
+ },
246
+ {
247
+ checked: !1,
248
+ disabled: !1,
249
+ class: "border-zinc-300 bg-zinc-300 hover:border-zinc-400 hover:bg-zinc-400 dark:border-zinc-600 dark:bg-zinc-700 dark:hover:border-zinc-500 dark:hover:bg-zinc-600"
250
+ },
251
+ {
252
+ checked: !1,
253
+ disabled: !0,
254
+ class: "border-zinc-300 bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800"
255
+ }
256
+ ],
257
+ defaultVariants: {
258
+ size: "md",
259
+ checked: !1,
260
+ disabled: !1
261
+ }
262
+ }), E = r("absolute top-1/2 z-10 flex -translate-y-1/2 items-center justify-center rounded-full bg-white text-zinc-500 shadow-[0_1px_3px_0_rgba(15,23,42,0.25)] transition-all duration-200", {
263
+ variants: {
264
+ size: {
265
+ sm: "size-3 text-[9px]",
266
+ md: "size-4 text-[10px]",
267
+ lg: "size-5 text-xs"
268
+ },
269
+ checked: {
270
+ true: "left-[calc(100%_-_0.125rem)] -translate-x-full",
271
+ false: "left-0.5"
272
+ },
273
+ disabled: {
274
+ true: "bg-zinc-100 text-zinc-400 dark:bg-zinc-300",
275
+ false: ""
276
+ }
277
+ },
278
+ defaultVariants: {
279
+ size: "md",
280
+ checked: !1,
281
+ disabled: !1
282
+ }
283
+ }), D = r("pointer-events-none absolute inset-y-0 z-0 flex min-w-0 items-center overflow-hidden px-1 font-medium text-white transition-colors duration-200", {
284
+ variants: {
285
+ size: {
286
+ sm: "text-[9px]",
287
+ md: "text-[10px]",
288
+ lg: "text-xs"
289
+ },
290
+ checked: {
291
+ true: "left-0 right-[42%] justify-start",
292
+ false: "left-[42%] right-0 justify-end"
293
+ }
294
+ },
295
+ defaultVariants: {
296
+ size: "md",
297
+ checked: !1
298
+ }
299
+ }), O = r("select-none transition-colors duration-150", {
300
+ variants: {
301
+ checked: {
302
+ true: "",
303
+ false: ""
304
+ },
305
+ disabled: {
306
+ true: "text-tertiary",
307
+ false: ""
308
+ }
309
+ },
310
+ compoundVariants: [{
311
+ checked: !0,
312
+ disabled: !1,
313
+ class: "text-brand-500 dark:text-brand-400"
314
+ }, {
315
+ checked: !1,
316
+ disabled: !1,
317
+ class: "text-tertiary"
318
+ }],
319
+ defaultVariants: {
320
+ checked: !1,
321
+ disabled: !1
322
+ }
323
+ });
324
+ //#endregion
325
+ export { w as a, T as i, O as n, C as o, D as r, E as t };
326
+
327
+ //# sourceMappingURL=switch-BULGbODP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-BULGbODP.js","names":["$slots"],"sources":["../../src/switch/Switch.vue","../../src/switch/Switch.vue","../../src/switch/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, ref, useAttrs, watch } from 'vue'\nimport type { CSSProperties } from 'vue'\n\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { switchAction, switchLabel, switchPrompt, switchTrack, switchWrapper, type SwitchProps } from '.'\n\ndefineOptions({\n inheritAttrs: false\n})\n\ntype SwitchValue = string | number | boolean\ntype BeforeChange = () => boolean | Promise<boolean>\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是 v-model 绑定值,可选;传入时优先于 checked。 */\n modelValue?: SwitchValue\n /** checked 是非受控默认开启态,可选。 */\n checked?: boolean\n /** activeValue 是开启态提交值,可选,默认 true。 */\n activeValue?: SwitchValue\n /** inactiveValue 是关闭态提交值,可选,默认 false。 */\n inactiveValue?: SwitchValue\n /** disabled 表示是否禁用交互,可选,默认 false。 */\n disabled?: boolean\n /** loading 表示是否展示加载态,并暂时禁用交互,可选,默认 false。 */\n loading?: boolean\n /** size 表示开关尺寸,可选,默认 md。 */\n size?: SwitchProps['size']\n /** width 是轨道宽度,可选;数字会按 px 处理。 */\n width?: number | string\n /** activeText 是开启态文案,可选。 */\n activeText?: string\n /** inactiveText 是关闭态文案,可选。 */\n inactiveText?: string\n /** activeIcon 是开启态轨道内图标类名,可选。 */\n activeIcon?: string\n /** inactiveIcon 是关闭态轨道内图标类名,可选。 */\n inactiveIcon?: string\n /** activeActionIcon 是开启态圆点内图标类名,可选。 */\n activeActionIcon?: string\n /** inactiveActionIcon 是关闭态圆点内图标类名,可选。 */\n inactiveActionIcon?: string\n /** inlinePrompt 表示是否把 activeText/inactiveText 或图标展示在轨道内。 */\n inlinePrompt?: boolean\n /** activeColor 是开启态轨道自定义颜色,可选。 */\n activeColor?: string\n /** inactiveColor 是关闭态轨道自定义颜色,可选。 */\n inactiveColor?: string\n /** beforeChange 在切换前执行,返回 false 或 reject 时阻止切换。 */\n beforeChange?: BeforeChange\n /** name 是原生 input name,可选。 */\n name?: string\n /** id 是原生 input id,可选。 */\n id?: string\n }>(),\n {\n modelValue: undefined,\n checked: undefined,\n activeValue: true,\n inactiveValue: false,\n disabled: false,\n loading: false,\n size: 'md',\n width: undefined,\n activeText: '',\n inactiveText: '',\n activeIcon: '',\n inactiveIcon: '',\n activeActionIcon: '',\n inactiveActionIcon: '',\n inlinePrompt: false,\n activeColor: '',\n inactiveColor: '',\n beforeChange: undefined,\n name: undefined,\n id: undefined\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: SwitchValue): void\n (e: 'input', value: SwitchValue, event: Event): void\n (e: 'change', value: SwitchValue, event: Event): void\n (e: 'focus', event: FocusEvent): void\n (e: 'blur', event: FocusEvent): void\n}>()\n\nconst attrs = useAttrs()\nconst internalChecked = ref(!!props.checked)\nconst switching = ref(false)\nconst isDisabled = computed(() => props.disabled || props.loading || switching.value)\nconst isChecked = computed(() => (props.modelValue === undefined ? internalChecked.value : Object.is(props.modelValue, props.activeValue)))\nconst currentValue = computed(() => (isChecked.value ? props.activeValue : props.inactiveValue))\nconst currentPromptText = computed(() => (isChecked.value ? props.activeText : props.inactiveText))\nconst currentPromptIcon = computed(() => (isChecked.value ? props.activeIcon : props.inactiveIcon))\nconst currentActionIcon = computed(() => (isChecked.value ? props.activeActionIcon : props.inactiveActionIcon))\nconst hasInlinePrompt = computed(() => props.inlinePrompt && (!!currentPromptText.value || !!currentPromptIcon.value))\n\nconst wrapperClass = computed(() =>\n clsx(\n getUiAttrClass(attrs),\n switchWrapper({\n size: props.size,\n disabled: isDisabled.value\n })\n )\n)\nconst trackClass = computed(() =>\n switchTrack({\n size: props.size,\n checked: isChecked.value,\n disabled: isDisabled.value\n })\n)\nconst actionClass = computed(() =>\n switchAction({\n size: props.size,\n checked: isChecked.value,\n disabled: isDisabled.value\n })\n)\nconst promptClass = computed(() =>\n switchPrompt({\n size: props.size,\n checked: isChecked.value\n })\n)\nconst inactiveLabelClass = computed(() =>\n switchLabel({\n checked: !isChecked.value,\n disabled: isDisabled.value\n })\n)\nconst activeLabelClass = computed(() =>\n switchLabel({\n checked: isChecked.value,\n disabled: isDisabled.value\n })\n)\n\nconst getSizeValue = (value: number | string | undefined) => {\n if (value === undefined || value === '') return undefined\n return typeof value === 'number' ? `${value}px` : value\n}\n\nconst trackStyle = computed<CSSProperties>(() => {\n const color = isChecked.value ? props.activeColor : props.inactiveColor\n return {\n width: getSizeValue(props.width),\n backgroundColor: color || undefined,\n borderColor: color || undefined\n }\n})\n\nwatch(\n () => props.checked,\n (checked) => {\n if (props.modelValue === undefined) {\n internalChecked.value = !!checked\n }\n }\n)\n\nfunction syncInputChecked(event: Event) {\n const target = event.target as HTMLInputElement | null\n if (target) target.checked = isChecked.value\n}\n\nasync function canSwitch() {\n if (!props.beforeChange) return true\n try {\n const result = await props.beforeChange()\n return result !== false\n } catch {\n return false\n }\n}\n\nfunction commitChecked(checked: boolean, event: Event) {\n internalChecked.value = checked\n const nextValue = checked ? props.activeValue : props.inactiveValue\n emit('update:modelValue', nextValue)\n emit('input', nextValue, event)\n emit('change', nextValue, event)\n}\n\nfunction handleInput(event: Event) {\n if (isDisabled.value) {\n syncInputChecked(event)\n }\n}\n\n/**\n * handleChange 在提交切换前执行 beforeChange,确保异步阻止时原生 input 状态被回滚。\n */\nasync function handleChange(event: Event) {\n if (isDisabled.value) {\n syncInputChecked(event)\n return\n }\n\n const checked = (event.target as HTMLInputElement).checked\n if (props.beforeChange) {\n syncInputChecked(event)\n switching.value = true\n const approved = await canSwitch()\n switching.value = false\n if (!approved) return\n }\n commitChecked(checked, event)\n}\n</script>\n\n<template>\n <label :class=\"wrapperClass\" :style=\"getUiAttrStyle(attrs)\">\n <span v-if=\"inactiveText && !inlinePrompt\" :class=\"inactiveLabelClass\">{{ inactiveText }}</span>\n <span :class=\"trackClass\" :style=\"trackStyle\">\n <input\n v-bind=\"getUiExposeAttrs(attrs)\"\n :id=\"id\"\n data-map-ui-switch=\"true\"\n type=\"checkbox\"\n role=\"switch\"\n :aria-checked=\"isChecked\"\n :name=\"name\"\n :value=\"String(currentValue)\"\n :checked=\"isChecked\"\n :disabled=\"isDisabled\"\n class=\"absolute inset-0 z-20 m-0 h-full w-full cursor-inherit opacity-0\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @focus=\"emit('focus', $event)\"\n @blur=\"emit('blur', $event)\"\n />\n <span v-if=\"hasInlinePrompt\" :class=\"promptClass\">\n <slot v-if=\"isChecked && $slots.active\" name=\"active\"></slot>\n <slot v-else-if=\"!isChecked && $slots.inactive\" name=\"inactive\"></slot>\n <span v-else-if=\"currentPromptIcon\" :class=\"currentPromptIcon\" class=\"size-3 shrink-0\"></span>\n <span v-else class=\"truncate\">{{ currentPromptText }}</span>\n </span>\n <span :class=\"actionClass\" aria-hidden=\"true\">\n <span v-if=\"loading || switching\" class=\"i-lucide:loader-2 size-[82%] animate-spin\"></span>\n <slot v-else-if=\"isChecked && $slots['active-action']\" name=\"active-action\"></slot>\n <slot v-else-if=\"!isChecked && $slots['inactive-action']\" name=\"inactive-action\"></slot>\n <span v-else-if=\"currentActionIcon\" :class=\"currentActionIcon\" class=\"size-[82%]\"></span>\n </span>\n </span>\n <span v-if=\"activeText && !inlinePrompt\" :class=\"activeLabelClass\">{{ activeText }}</span>\n </label>\n</template>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, ref, useAttrs, watch } from 'vue'\nimport type { CSSProperties } from 'vue'\n\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { switchAction, switchLabel, switchPrompt, switchTrack, switchWrapper, type SwitchProps } from '.'\n\ndefineOptions({\n inheritAttrs: false\n})\n\ntype SwitchValue = string | number | boolean\ntype BeforeChange = () => boolean | Promise<boolean>\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是 v-model 绑定值,可选;传入时优先于 checked。 */\n modelValue?: SwitchValue\n /** checked 是非受控默认开启态,可选。 */\n checked?: boolean\n /** activeValue 是开启态提交值,可选,默认 true。 */\n activeValue?: SwitchValue\n /** inactiveValue 是关闭态提交值,可选,默认 false。 */\n inactiveValue?: SwitchValue\n /** disabled 表示是否禁用交互,可选,默认 false。 */\n disabled?: boolean\n /** loading 表示是否展示加载态,并暂时禁用交互,可选,默认 false。 */\n loading?: boolean\n /** size 表示开关尺寸,可选,默认 md。 */\n size?: SwitchProps['size']\n /** width 是轨道宽度,可选;数字会按 px 处理。 */\n width?: number | string\n /** activeText 是开启态文案,可选。 */\n activeText?: string\n /** inactiveText 是关闭态文案,可选。 */\n inactiveText?: string\n /** activeIcon 是开启态轨道内图标类名,可选。 */\n activeIcon?: string\n /** inactiveIcon 是关闭态轨道内图标类名,可选。 */\n inactiveIcon?: string\n /** activeActionIcon 是开启态圆点内图标类名,可选。 */\n activeActionIcon?: string\n /** inactiveActionIcon 是关闭态圆点内图标类名,可选。 */\n inactiveActionIcon?: string\n /** inlinePrompt 表示是否把 activeText/inactiveText 或图标展示在轨道内。 */\n inlinePrompt?: boolean\n /** activeColor 是开启态轨道自定义颜色,可选。 */\n activeColor?: string\n /** inactiveColor 是关闭态轨道自定义颜色,可选。 */\n inactiveColor?: string\n /** beforeChange 在切换前执行,返回 false 或 reject 时阻止切换。 */\n beforeChange?: BeforeChange\n /** name 是原生 input name,可选。 */\n name?: string\n /** id 是原生 input id,可选。 */\n id?: string\n }>(),\n {\n modelValue: undefined,\n checked: undefined,\n activeValue: true,\n inactiveValue: false,\n disabled: false,\n loading: false,\n size: 'md',\n width: undefined,\n activeText: '',\n inactiveText: '',\n activeIcon: '',\n inactiveIcon: '',\n activeActionIcon: '',\n inactiveActionIcon: '',\n inlinePrompt: false,\n activeColor: '',\n inactiveColor: '',\n beforeChange: undefined,\n name: undefined,\n id: undefined\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: SwitchValue): void\n (e: 'input', value: SwitchValue, event: Event): void\n (e: 'change', value: SwitchValue, event: Event): void\n (e: 'focus', event: FocusEvent): void\n (e: 'blur', event: FocusEvent): void\n}>()\n\nconst attrs = useAttrs()\nconst internalChecked = ref(!!props.checked)\nconst switching = ref(false)\nconst isDisabled = computed(() => props.disabled || props.loading || switching.value)\nconst isChecked = computed(() => (props.modelValue === undefined ? internalChecked.value : Object.is(props.modelValue, props.activeValue)))\nconst currentValue = computed(() => (isChecked.value ? props.activeValue : props.inactiveValue))\nconst currentPromptText = computed(() => (isChecked.value ? props.activeText : props.inactiveText))\nconst currentPromptIcon = computed(() => (isChecked.value ? props.activeIcon : props.inactiveIcon))\nconst currentActionIcon = computed(() => (isChecked.value ? props.activeActionIcon : props.inactiveActionIcon))\nconst hasInlinePrompt = computed(() => props.inlinePrompt && (!!currentPromptText.value || !!currentPromptIcon.value))\n\nconst wrapperClass = computed(() =>\n clsx(\n getUiAttrClass(attrs),\n switchWrapper({\n size: props.size,\n disabled: isDisabled.value\n })\n )\n)\nconst trackClass = computed(() =>\n switchTrack({\n size: props.size,\n checked: isChecked.value,\n disabled: isDisabled.value\n })\n)\nconst actionClass = computed(() =>\n switchAction({\n size: props.size,\n checked: isChecked.value,\n disabled: isDisabled.value\n })\n)\nconst promptClass = computed(() =>\n switchPrompt({\n size: props.size,\n checked: isChecked.value\n })\n)\nconst inactiveLabelClass = computed(() =>\n switchLabel({\n checked: !isChecked.value,\n disabled: isDisabled.value\n })\n)\nconst activeLabelClass = computed(() =>\n switchLabel({\n checked: isChecked.value,\n disabled: isDisabled.value\n })\n)\n\nconst getSizeValue = (value: number | string | undefined) => {\n if (value === undefined || value === '') return undefined\n return typeof value === 'number' ? `${value}px` : value\n}\n\nconst trackStyle = computed<CSSProperties>(() => {\n const color = isChecked.value ? props.activeColor : props.inactiveColor\n return {\n width: getSizeValue(props.width),\n backgroundColor: color || undefined,\n borderColor: color || undefined\n }\n})\n\nwatch(\n () => props.checked,\n (checked) => {\n if (props.modelValue === undefined) {\n internalChecked.value = !!checked\n }\n }\n)\n\nfunction syncInputChecked(event: Event) {\n const target = event.target as HTMLInputElement | null\n if (target) target.checked = isChecked.value\n}\n\nasync function canSwitch() {\n if (!props.beforeChange) return true\n try {\n const result = await props.beforeChange()\n return result !== false\n } catch {\n return false\n }\n}\n\nfunction commitChecked(checked: boolean, event: Event) {\n internalChecked.value = checked\n const nextValue = checked ? props.activeValue : props.inactiveValue\n emit('update:modelValue', nextValue)\n emit('input', nextValue, event)\n emit('change', nextValue, event)\n}\n\nfunction handleInput(event: Event) {\n if (isDisabled.value) {\n syncInputChecked(event)\n }\n}\n\n/**\n * handleChange 在提交切换前执行 beforeChange,确保异步阻止时原生 input 状态被回滚。\n */\nasync function handleChange(event: Event) {\n if (isDisabled.value) {\n syncInputChecked(event)\n return\n }\n\n const checked = (event.target as HTMLInputElement).checked\n if (props.beforeChange) {\n syncInputChecked(event)\n switching.value = true\n const approved = await canSwitch()\n switching.value = false\n if (!approved) return\n }\n commitChecked(checked, event)\n}\n</script>\n\n<template>\n <label :class=\"wrapperClass\" :style=\"getUiAttrStyle(attrs)\">\n <span v-if=\"inactiveText && !inlinePrompt\" :class=\"inactiveLabelClass\">{{ inactiveText }}</span>\n <span :class=\"trackClass\" :style=\"trackStyle\">\n <input\n v-bind=\"getUiExposeAttrs(attrs)\"\n :id=\"id\"\n data-map-ui-switch=\"true\"\n type=\"checkbox\"\n role=\"switch\"\n :aria-checked=\"isChecked\"\n :name=\"name\"\n :value=\"String(currentValue)\"\n :checked=\"isChecked\"\n :disabled=\"isDisabled\"\n class=\"absolute inset-0 z-20 m-0 h-full w-full cursor-inherit opacity-0\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @focus=\"emit('focus', $event)\"\n @blur=\"emit('blur', $event)\"\n />\n <span v-if=\"hasInlinePrompt\" :class=\"promptClass\">\n <slot v-if=\"isChecked && $slots.active\" name=\"active\"></slot>\n <slot v-else-if=\"!isChecked && $slots.inactive\" name=\"inactive\"></slot>\n <span v-else-if=\"currentPromptIcon\" :class=\"currentPromptIcon\" class=\"size-3 shrink-0\"></span>\n <span v-else class=\"truncate\">{{ currentPromptText }}</span>\n </span>\n <span :class=\"actionClass\" aria-hidden=\"true\">\n <span v-if=\"loading || switching\" class=\"i-lucide:loader-2 size-[82%] animate-spin\"></span>\n <slot v-else-if=\"isChecked && $slots['active-action']\" name=\"active-action\"></slot>\n <slot v-else-if=\"!isChecked && $slots['inactive-action']\" name=\"inactive-action\"></slot>\n <span v-else-if=\"currentActionIcon\" :class=\"currentActionIcon\" class=\"size-[82%]\"></span>\n </span>\n </span>\n <span v-if=\"activeText && !inlinePrompt\" :class=\"activeLabelClass\">{{ activeText }}</span>\n </label>\n</template>\n","import { cva } from 'class-variance-authority'\nimport type { VariantProps } from 'class-variance-authority'\n\nexport { default as Switch } from './Switch.vue'\n\n/** switchWrapper 定义管理端 Switch 外层文字和轨道的排版。 */\nexport const switchWrapper = cva('inline-flex w-fit items-center align-middle transition-colors duration-150', {\n variants: {\n size: {\n sm: 'gap-1.5 text-xs/5',\n md: 'gap-2 text-sm/5',\n lg: 'gap-2.5 text-base/6'\n },\n disabled: {\n true: 'cursor-not-allowed opacity-70',\n false: 'cursor-pointer'\n }\n },\n defaultVariants: {\n size: 'md',\n disabled: false\n }\n})\n\n/** switchTrack 定义管理端 Switch 开关轨道的样式变体。 */\nexport const switchTrack = cva('relative inline-flex shrink-0 items-center overflow-hidden rounded-full border align-middle transition-colors duration-200', {\n variants: {\n size: {\n sm: 'h-4 min-w-8',\n md: 'h-5 min-w-10',\n lg: 'h-6 min-w-12'\n },\n checked: {\n true: '',\n false: ''\n },\n disabled: {\n true: 'cursor-not-allowed',\n false: 'cursor-pointer'\n }\n },\n compoundVariants: [\n {\n checked: true,\n disabled: false,\n class: 'border-brand-500 bg-brand-500 hover:border-brand-400 hover:bg-brand-400 dark:border-brand-400 dark:bg-brand-500'\n },\n {\n checked: true,\n disabled: true,\n class: 'border-zinc-400 bg-zinc-400 dark:border-zinc-600 dark:bg-zinc-700'\n },\n {\n checked: false,\n disabled: false,\n class: 'border-zinc-300 bg-zinc-300 hover:border-zinc-400 hover:bg-zinc-400 dark:border-zinc-600 dark:bg-zinc-700 dark:hover:border-zinc-500 dark:hover:bg-zinc-600'\n },\n {\n checked: false,\n disabled: true,\n class: 'border-zinc-300 bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800'\n }\n ],\n defaultVariants: {\n size: 'md',\n checked: false,\n disabled: false\n }\n})\n\n/** switchAction 定义 Switch 内部圆点的位置、尺寸和图标承载样式。 */\nexport const switchAction = cva('absolute top-1/2 z-10 flex -translate-y-1/2 items-center justify-center rounded-full bg-white text-zinc-500 shadow-[0_1px_3px_0_rgba(15,23,42,0.25)] transition-all duration-200', {\n variants: {\n size: {\n sm: 'size-3 text-[9px]',\n md: 'size-4 text-[10px]',\n lg: 'size-5 text-xs'\n },\n checked: {\n true: 'left-[calc(100%_-_0.125rem)] -translate-x-full',\n false: 'left-0.5'\n },\n disabled: {\n true: 'bg-zinc-100 text-zinc-400 dark:bg-zinc-300',\n false: ''\n }\n },\n defaultVariants: {\n size: 'md',\n checked: false,\n disabled: false\n }\n})\n\n/** switchPrompt 定义 inline-prompt 模式下轨道内文案或图标的位置。 */\nexport const switchPrompt = cva('pointer-events-none absolute inset-y-0 z-0 flex min-w-0 items-center overflow-hidden px-1 font-medium text-white transition-colors duration-200', {\n variants: {\n size: {\n sm: 'text-[9px]',\n md: 'text-[10px]',\n lg: 'text-xs'\n },\n checked: {\n true: 'left-0 right-[42%] justify-start',\n false: 'left-[42%] right-0 justify-end'\n }\n },\n defaultVariants: {\n size: 'md',\n checked: false\n }\n})\n\n/** switchLabel 定义 Switch 两侧非内联文案的选中态样式。 */\nexport const switchLabel = cva('select-none transition-colors duration-150', {\n variants: {\n checked: {\n true: '',\n false: ''\n },\n disabled: {\n true: 'text-tertiary',\n false: ''\n }\n },\n compoundVariants: [\n { checked: true, disabled: false, class: 'text-brand-500 dark:text-brand-400' },\n { checked: false, disabled: false, class: 'text-tertiary' }\n ],\n defaultVariants: {\n checked: false,\n disabled: false\n }\n})\n\n/** SwitchProps 是 switchTrack 变体推导出的组件属性类型。 */\nexport type SwitchProps = VariantProps<typeof switchTrack>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAeA,IAAM,IAAQ,GAmER,IAAO,GAQP,IAAQ,EAAS,GACjB,IAAkB,EAAI,CAAC,CAAC,EAAM,OAAO,GACrC,IAAY,EAAI,EAAK,GACrB,IAAa,QAAe,EAAM,YAAY,EAAM,WAAW,EAAU,KAAK,GAC9E,IAAY,QAAgB,EAAM,eAAe,KAAA,IAAY,EAAgB,QAAQ,OAAO,GAAG,EAAM,YAAY,EAAM,WAAW,CAAE,GACpI,IAAe,QAAgB,EAAU,QAAQ,EAAM,cAAc,EAAM,aAAc,GACzF,IAAoB,QAAgB,EAAU,QAAQ,EAAM,aAAa,EAAM,YAAa,GAC5F,IAAoB,QAAgB,EAAU,QAAQ,EAAM,aAAa,EAAM,YAAa,GAC5F,IAAoB,QAAgB,EAAU,QAAQ,EAAM,mBAAmB,EAAM,kBAAmB,GACxG,IAAkB,QAAe,EAAM,iBAAiB,CAAC,CAAC,EAAkB,SAAS,CAAC,CAAC,EAAkB,MAAM,GAE/G,IAAe,QACnB,EACE,EAAe,CAAK,GACpB,EAAc;GACZ,MAAM,EAAM;GACZ,UAAU,EAAW;EACvB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