@mcistudio/unoui-vue 1.2.5 → 1.2.7

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 (35) hide show
  1. package/dist/chunks/{Table-M8DquYXh.js → Table-DFBQntI1.js} +3 -2
  2. package/dist/chunks/Table-DFBQntI1.js.map +1 -0
  3. package/dist/chunks/{colorpicker-B-kSQ2Gh.js → colorpicker-CyhB3GJP.js} +227 -204
  4. package/dist/chunks/colorpicker-CyhB3GJP.js.map +1 -0
  5. package/dist/chunks/drawer-BgGY0UFF.js +197 -0
  6. package/dist/chunks/drawer-BgGY0UFF.js.map +1 -0
  7. package/dist/chunks/{input-FN9FbBR8.js → input-CiYVpf72.js} +5 -5
  8. package/dist/chunks/input-CiYVpf72.js.map +1 -0
  9. package/dist/chunks/internal-drag-B2-9vftX.js +29 -0
  10. package/dist/chunks/internal-drag-B2-9vftX.js.map +1 -0
  11. package/dist/chunks/modal-BqB5SsLw.js +82 -0
  12. package/dist/chunks/modal-BqB5SsLw.js.map +1 -0
  13. package/dist/chunks/{pagination-DCJuheFj.js → pagination-zi5YKmBI.js} +2 -2
  14. package/dist/chunks/{pagination-DCJuheFj.js.map → pagination-zi5YKmBI.js.map} +1 -1
  15. package/dist/chunks/{slider-Z03Wx_8m.js → slider-DoS0hURd.js} +3 -3
  16. package/dist/chunks/slider-DoS0hURd.js.map +1 -0
  17. package/dist/colorpicker/index.js +1 -1
  18. package/dist/drawer/index.js +1 -1
  19. package/dist/index.js +7 -7
  20. package/dist/input/index.js +1 -1
  21. package/dist/modal/index.js +1 -1
  22. package/dist/pagination/index.js +1 -1
  23. package/dist/slider/index.js +1 -1
  24. package/dist/style.css +1 -1
  25. package/dist/table/index.js +1 -1
  26. package/dist/utils/internal-drag.d.ts +7 -0
  27. package/package.json +1 -1
  28. package/dist/chunks/Table-M8DquYXh.js.map +0 -1
  29. package/dist/chunks/colorpicker-B-kSQ2Gh.js.map +0 -1
  30. package/dist/chunks/drawer-C3JZ28Xo.js +0 -193
  31. package/dist/chunks/drawer-C3JZ28Xo.js.map +0 -1
  32. package/dist/chunks/input-FN9FbBR8.js.map +0 -1
  33. package/dist/chunks/modal-D6l1iIvE.js +0 -81
  34. package/dist/chunks/modal-D6l1iIvE.js.map +0 -1
  35. package/dist/chunks/slider-Z03Wx_8m.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorpicker-CyhB3GJP.js","names":[],"sources":["../../src/colorpicker/ColorPicker.vue","../../src/colorpicker/ColorPicker.vue","../../src/colorpicker/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, nextTick, onMounted, onUnmounted, reactive, ref, useAttrs, useTemplateRef, watch } from 'vue'\nimport type { CSSProperties } from 'vue'\n\nimport { getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { colorPickerSwatch, colorPickerTrigger, type ColorPickerSize } from '.'\nimport { clampAlpha, clampHue, clampPercent, cloneHsba, colorToHsba, hsbToRgb, hsbaToCss, normalizeDegree, normalizeRgba, parseCssColor, rgbaToCss, rgbaToHex, type ColorPickerHsbaColor, type ColorPickerMode, type ColorPickerValue, type InternalGradientStop } from './color'\n\ndefineOptions({\n inheritAttrs: false\n})\n\ntype EyeDropperConstructor = new () => {\n open: () => Promise<{ sRGBHex: string }>\n}\ntype Booleanish = boolean | 'true' | 'false' | ''\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是对象式颜色值,兼容 giacomohuang/colorpicker 的 solid/linear/radial 结构。 */\n modelValue?: ColorPickerValue\n /** size 是触发器尺寸,可选。 */\n size?: ColorPickerSize\n /** allowGradient 表示是否允许选择 linear/radial 渐变模式。 */\n allowGradient?: Booleanish\n /** allowAlpha 表示是否允许选择透明度;关闭后输出 alpha 固定为 1。 */\n allowAlpha?: Booleanish\n /** disabled 表示是否禁用颜色选择交互。 */\n disabled?: boolean\n }>(),\n {\n modelValue: undefined,\n size: 'md',\n allowGradient: true,\n allowAlpha: true,\n disabled: false\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: ColorPickerValue): void\n (e: 'changed', value: ColorPickerValue): void\n}>()\n\nconst attrs = useAttrs()\nconst rootRef = useTemplateRef<HTMLElement>('rootRef')\nconst panelRef = useTemplateRef<HTMLElement>('panelRef')\nconst paletteRef = useTemplateRef<HTMLElement>('paletteRef')\nconst hueBarRef = useTemplateRef<HTMLElement>('hueBarRef')\nconst opacityBarRef = useTemplateRef<HTMLElement>('opacityBarRef')\nconst gradientBarRef = useTemplateRef<HTMLElement>('gradientBarRef')\nconst degreeRef = useTemplateRef<HTMLElement>('degreeRef')\n\nconst open = ref(false)\nconst activeMode = ref<ColorPickerMode>('solid')\nconst degree = ref(90)\nconst activeGradientStopId = ref<number | null>(null)\nconst draggingGradientStopId = ref<number | null>(null)\nconst pendingRemoveGradientStopId = ref<number | null>(null)\nconst isDraggingHue = ref(false)\nconst isDraggingOpacity = ref(false)\nconst isDraggingDegree = ref(false)\nconst colorInputValue = ref('')\nconst colorInputInvalid = ref(false)\nconst isColorInputFocused = ref(false)\nconst gradientStops = ref<InternalGradientStop[]>([])\nconst paletteColor = reactive<ColorPickerHsbaColor>({ h: 0, s: 0, b: 0, a: 1 })\nconst panelPosition = reactive({ top: 0, left: 0 })\nconst eyeDropperSupported = ref(false)\nlet gradientStopSeed = 0\n/** 当前拖拽会话的取消函数,供二次拖拽、面板关闭和组件卸载统一收尾。 */\nlet dragCleanup: (() => void) | null = null\nlet syncingFromModel = false\nlet lastEmittedValue: ColorPickerValue | null = null\nlet lastEmittedSignature = ''\nlet colorInputCommitTimer: number | null = null\n\nconst modeOptions: { mode: ColorPickerMode; label: string }[] = [\n { mode: 'solid', label: '纯色' },\n { mode: 'linear', label: '线性渐变' },\n { mode: 'radial', label: '径向渐变' }\n]\nconst panelWidth = 260\nconst panelGap = 4\nconst viewportPadding = 8\nconst maxGradientStops = 10\nconst colorInputDebounceMs = 200\n// 控制点拖出渐变条一段距离后松手,按设计语义移除该控制点。\nconst gradientStopRemoveDistance = 24\n\nconst normalizeBooleanProp = (value: Booleanish | undefined, fallback: boolean) => {\n if (value === undefined) return fallback\n if (value === 'false') return false\n if (value === 'true' || value === '') return true\n return value\n}\nconst currentRgba = computed(() => hsbToRgb(paletteColor))\nconst activeDisplayRgba = computed(() => {\n if (activeMode.value === 'solid') return currentRgba.value\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value) ?? gradientStops.value[0]\n return activeStop ? hsbToRgb(activeStop.color) : currentRgba.value\n})\nconst activeColorText = computed(() => rgbaToHex(normalizeOutputRgba(activeDisplayRgba.value)))\nconst isGradientAllowed = computed(() => normalizeBooleanProp(props.allowGradient, true))\nconst isAlphaAllowed = computed(() => normalizeBooleanProp(props.allowAlpha, true))\nconst hueBackground = computed(() => rgbaToCss(hsbToRgb({ h: paletteColor.h, s: 100, b: 100, a: 1 })))\nconst gradientPreviewStops = computed(() =>\n getSortedGradientStops()\n .map((stop) => `${hsbaToCss(stop.color)} ${stop.percent}%`)\n .join(',')\n)\nconst gradientPreview = computed(() => {\n if (activeMode.value === 'linear') return `linear-gradient(${degree.value}deg,${gradientPreviewStops.value})`\n if (activeMode.value === 'radial') return `radial-gradient(circle,${gradientPreviewStops.value})`\n return rgbaToCss(currentRgba.value)\n})\nconst gradientBarBackground = computed(() => `linear-gradient(to right,${gradientPreviewStops.value || `${rgbaToCss(currentRgba.value)} 0%,${rgbaToCss(currentRgba.value)} 100%`})`)\nconst opacityBarBackground = computed(() => {\n const color = normalizeRgba({ ...currentRgba.value, a: 1 })\n return `linear-gradient(to right, rgba(${color.r},${color.g},${color.b},0), rgba(${color.r},${color.g},${color.b},1))`\n})\nconst previewBackground = computed(() => (activeMode.value === 'solid' ? rgbaToCss(currentRgba.value) : gradientPreview.value))\nconst triggerClass = computed(() =>\n clsx(\n attrs.class as string | undefined,\n colorPickerTrigger({\n size: props.size,\n focused: open.value,\n disabled: props.disabled\n })\n )\n)\nconst swatchClass = computed(() => colorPickerSwatch({ size: props.size }))\nconst eyeDropperButtonDisabled = computed(() => props.disabled || !eyeDropperSupported.value)\nconst panelStyle = computed<CSSProperties>(() => ({\n position: 'fixed',\n top: `${panelPosition.top}px`,\n left: `${panelPosition.left}px`,\n width: `${panelWidth}px`,\n maxHeight: `calc(100vh - ${viewportPadding * 2}px)`,\n overflowY: 'auto',\n zIndex: 2000\n}))\nconst paletteStyle = computed<CSSProperties>(() => ({\n background: hueBackground.value,\n height: '9rem'\n}))\nconst colorInputRowStyle = computed<CSSProperties>(() => ({\n gridTemplateColumns: 'minmax(0, 1fr) 56px'\n}))\nconst palettePickerStyle = computed<CSSProperties>(() => ({\n left: `${paletteColor.s}%`,\n top: `${100 - paletteColor.b}%`,\n backgroundColor: rgbaToCss(currentRgba.value)\n}))\nconst huePickerStyle = computed<CSSProperties>(() => ({\n left: `${(paletteColor.h / 360) * 100}%`\n}))\nconst opacityPickerStyle = computed<CSSProperties>(() => ({\n left: `${paletteColor.a * 100}%`\n}))\nconst degreePointerStyle = computed<CSSProperties>(() => ({\n transform: `translateY(-50%) rotate(${degree.value - 90}deg)`\n}))\n\nwatch(\n () => props.modelValue,\n (value) => {\n if (value && (value === lastEmittedValue || getModelSignature(value) === lastEmittedSignature)) {\n lastEmittedValue = null\n lastEmittedSignature = ''\n return\n }\n syncFromModelValue(value)\n },\n { deep: true, immediate: true }\n)\n\nwatch(open, (value) => {\n if (value) void updatePanelPosition()\n else dragCleanup?.()\n})\n\nwatch(\n activeColorText,\n (value) => {\n if (isColorInputFocused.value) return\n colorInputValue.value = value\n colorInputInvalid.value = false\n },\n { immediate: true }\n)\n\nwatch(isGradientAllowed, (value) => {\n if (!value && activeMode.value !== 'solid') {\n activeMode.value = 'solid'\n commitValue()\n }\n})\n\nwatch(isAlphaAllowed, (value) => {\n if (value) return\n let changed = false\n if (paletteColor.a !== 1) {\n paletteColor.a = 1\n changed = true\n }\n gradientStops.value.forEach((stop) => {\n if (stop.color.a !== 1) {\n stop.color.a = 1\n changed = true\n }\n })\n if (changed) commitValue()\n})\n\nfunction isValidMode(mode: unknown): mode is ColorPickerMode {\n return mode === 'solid' || mode === 'linear' || mode === 'radial'\n}\n\nfunction getSortedGradientStops() {\n return [...gradientStops.value].sort((a, b) => a.percent - b.percent)\n}\n\nfunction syncPaletteColor(color: ColorPickerHsbaColor) {\n const normalizedColor = normalizeHsbaForProps(color)\n paletteColor.h = normalizedColor.h\n paletteColor.s = normalizedColor.s\n paletteColor.b = normalizedColor.b\n paletteColor.a = normalizedColor.a\n}\n\nfunction createGradientStop(percent: number, color: ColorPickerHsbaColor): InternalGradientStop {\n return {\n id: gradientStopSeed++,\n percent: clampPercent(percent),\n color: normalizeHsbaForProps(color)\n }\n}\n\nfunction createDefaultGradientStops(color = paletteColor) {\n return [createGradientStop(0, color), createGradientStop(100, color)]\n}\n\nfunction normalizeGradientStops(value?: ColorPickerValue) {\n if (!value?.gradients?.length) return createDefaultGradientStops()\n const stops = value.gradients\n .filter((stop) => stop && typeof stop === 'object')\n .slice(0, maxGradientStops)\n .map((stop) => createGradientStop(stop.percent, colorToHsba(stop.color)))\n\n if (stops.length >= 2) return stops\n if (stops.length === 1) return [stops[0], createGradientStop(100, stops[0].color)]\n return createDefaultGradientStops()\n}\n\nfunction ensureGradientStops() {\n if (gradientStops.value.length >= 2) return\n gradientStops.value = createDefaultGradientStops()\n activeGradientStopId.value = gradientStops.value[0]?.id ?? null\n}\n\nfunction syncPaletteFromActiveGradientStop() {\n if (activeMode.value === 'solid') return\n ensureGradientStops()\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value) ?? gradientStops.value[0]\n if (!activeStop) return\n activeGradientStopId.value = activeStop.id\n syncPaletteColor(activeStop.color)\n}\n\nfunction syncActiveGradientStopColor() {\n if (activeMode.value === 'solid') return\n ensureGradientStops()\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value)\n if (activeStop) activeStop.color = normalizeHsbaForProps(paletteColor)\n}\n\nfunction syncFromModelValue(value?: ColorPickerValue) {\n syncingFromModel = true\n const nextMode = isGradientAllowed.value && isValidMode(value?.mode) ? value.mode : 'solid'\n const paletteSource = value?.color ?? value?.gradients?.[0]?.color\n activeMode.value = nextMode\n degree.value = normalizeDegree(value?.degree)\n syncPaletteColor(colorToHsba(paletteSource))\n gradientStops.value = normalizeGradientStops(value)\n activeGradientStopId.value = gradientStops.value[0]?.id ?? null\n if (nextMode !== 'solid') syncPaletteFromActiveGradientStop()\n syncingFromModel = false\n}\n\nfunction buildModelValue(): ColorPickerValue {\n if (activeMode.value === 'solid') {\n const color = normalizeOutputRgba(currentRgba.value)\n return {\n mode: 'solid',\n color,\n hex: rgbaToHex(color),\n css: `background-color:${rgbaToCss(color)}`\n }\n }\n\n const gradients = getSortedGradientStops().map((stop) => ({\n percent: stop.percent,\n color: normalizeOutputRgba(hsbToRgb(stop.color))\n }))\n const gradientBody = gradients.map((stop) => `${rgbaToCss(stop.color)} ${stop.percent}%`).join(',')\n\n if (activeMode.value === 'linear') {\n return {\n mode: 'linear',\n degree: degree.value,\n gradients,\n css: `background-image:linear-gradient(${degree.value}deg,${gradientBody})`\n }\n }\n\n return {\n mode: 'radial',\n gradients,\n css: `background-image:radial-gradient(${gradientBody})`\n }\n}\n\nfunction commitValue() {\n if (syncingFromModel) return\n const value = buildModelValue()\n lastEmittedValue = value\n lastEmittedSignature = getModelSignature(value)\n emit('update:modelValue', value)\n emit('changed', value)\n}\n\nfunction getModelSignature(value: ColorPickerValue) {\n return JSON.stringify(value)\n}\n\nfunction normalizeHsbaForProps(color: ColorPickerHsbaColor): ColorPickerHsbaColor {\n const normalizedColor = cloneHsba(color)\n if (!isAlphaAllowed.value) normalizedColor.a = 1\n return normalizedColor\n}\n\nfunction normalizeOutputRgba(color: ReturnType<typeof hsbToRgb>) {\n const normalizedColor = normalizeRgba(color)\n if (!isAlphaAllowed.value) normalizedColor.a = 1\n return normalizedColor\n}\n\nfunction clearColorInputCommitTimer() {\n if (colorInputCommitTimer === null) return\n window.clearTimeout(colorInputCommitTimer)\n colorInputCommitTimer = null\n}\n\nfunction applyColorInputValue(options: { formatInput?: boolean } = {}) {\n const color = parseCssColor(colorInputValue.value)\n if (!color) {\n colorInputInvalid.value = true\n return null\n }\n\n const outputColor = normalizeOutputRgba(color)\n const formattedValue = rgbaToHex(outputColor)\n const nextColor = normalizeHsbaForProps(colorToHsba(outputColor))\n colorInputInvalid.value = false\n if (options.formatInput) colorInputValue.value = formattedValue\n syncPaletteColor(nextColor)\n\n if (activeMode.value !== 'solid') {\n ensureGradientStops()\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value) ?? gradientStops.value[0]\n if (activeStop) {\n activeGradientStopId.value = activeStop.id\n activeStop.color = nextColor\n }\n }\n\n commitValue()\n return formattedValue\n}\n\nfunction resetColorInputValue() {\n clearColorInputCommitTimer()\n colorInputValue.value = activeColorText.value\n colorInputInvalid.value = false\n}\n\nfunction scheduleColorInputCommit() {\n clearColorInputCommitTimer()\n colorInputCommitTimer = window.setTimeout(() => {\n colorInputCommitTimer = null\n applyColorInputValue()\n }, colorInputDebounceMs)\n}\n\nfunction handleColorInput(event: Event) {\n const value = (event.target as HTMLInputElement).value\n colorInputValue.value = value\n const parsedColor = parseCssColor(value)\n colorInputInvalid.value = value.trim() !== '' && !parsedColor\n if (parsedColor) {\n scheduleColorInputCommit()\n } else {\n clearColorInputCommitTimer()\n }\n}\n\nfunction handleColorInputKeydown(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n event.preventDefault()\n clearColorInputCommitTimer()\n const formattedValue = applyColorInputValue({ formatInput: true })\n if (formattedValue && event.target instanceof HTMLInputElement) event.target.value = formattedValue\n return\n }\n if (event.key === 'Escape') {\n event.preventDefault()\n resetColorInputValue()\n }\n}\n\nfunction handleColorInputFocus() {\n isColorInputFocused.value = true\n}\n\nfunction handleColorInputBlur(event: FocusEvent) {\n isColorInputFocused.value = false\n clearColorInputCommitTimer()\n const formattedValue = applyColorInputValue({ formatInput: true })\n if (formattedValue && event.target instanceof HTMLInputElement) event.target.value = formattedValue\n}\n\nfunction updatePanelPosition() {\n return nextTick(() => {\n const triggerEl = rootRef.value\n if (!triggerEl) return\n const triggerRect = triggerEl.getBoundingClientRect()\n const panelHeight = panelRef.value?.offsetHeight || 360\n const viewportWidth = window.innerWidth\n const viewportHeight = window.innerHeight\n const maxLeft = viewportWidth - panelWidth - viewportPadding\n const belowTop = triggerRect.bottom + panelGap\n const aboveTop = triggerRect.top - panelHeight - panelGap\n\n panelPosition.left = Math.max(viewportPadding, Math.min(triggerRect.left, maxLeft))\n panelPosition.top = belowTop + panelHeight <= viewportHeight - viewportPadding ? belowTop : Math.max(viewportPadding, aboveTop)\n })\n}\n\nfunction setOpen(value: boolean) {\n if (props.disabled) return\n open.value = value\n}\n\nfunction toggleOpen() {\n setOpen(!open.value)\n}\n\nfunction changeMode(mode: ColorPickerMode) {\n if (props.disabled) return\n if (mode !== 'solid' && !isGradientAllowed.value) return\n activeMode.value = mode\n if (activeMode.value !== 'solid') syncPaletteFromActiveGradientStop()\n commitValue()\n}\n\nfunction updatePaletteFromPointer(event: PointerEvent) {\n const rect = paletteRef.value?.getBoundingClientRect()\n if (!rect) return\n paletteColor.s = clampPercent(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 100)\n paletteColor.b = clampPercent((1 - getBoundedPointerRatio(event.clientY, rect.top, rect.height)) * 100)\n syncActiveGradientStopColor()\n commitValue()\n}\n\nfunction updateHueFromPointer(event: PointerEvent) {\n const rect = hueBarRef.value?.getBoundingClientRect()\n if (!rect) return\n // 色谱条是线性滑块,拖出边界时要停在端点,不能像角度盘一样循环。\n paletteColor.h = Math.round(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 360)\n syncActiveGradientStopColor()\n commitValue()\n}\n\nfunction updateOpacityFromPointer(event: PointerEvent) {\n if (!isAlphaAllowed.value) return\n const rect = opacityBarRef.value?.getBoundingClientRect()\n if (!rect) return\n paletteColor.a = clampAlpha(getBoundedPointerRatio(event.clientX, rect.left, rect.width))\n syncActiveGradientStopColor()\n commitValue()\n}\n\nfunction updateDegreeFromPointer(event: PointerEvent) {\n const rect = degreeRef.value?.getBoundingClientRect()\n if (!rect) return\n const centerX = rect.left + rect.width / 2\n const centerY = rect.top + rect.height / 2\n const rad = Math.atan2(centerY - event.clientY, event.clientX - centerX)\n const nextDegree = 90 - Math.floor((rad * 180) / Math.PI)\n degree.value = clampHue(nextDegree)\n commitValue()\n}\n\nfunction canRemoveGradientStop(stopId: number) {\n return gradientStops.value.length > 2 && gradientStops.value.some((stop) => stop.id === stopId)\n}\n\n// 只按垂直方向判断移除,横向拖动仍然用于调整百分比并夹在条内。\nfunction isPointerOutsideGradientBar(event: PointerEvent, rect: DOMRect) {\n return event.clientY < rect.top - gradientStopRemoveDistance || event.clientY > rect.bottom + gradientStopRemoveDistance\n}\n\nfunction updateGradientStopFromPointer(event: PointerEvent, stopId: number) {\n const rect = gradientBarRef.value?.getBoundingClientRect()\n const stop = gradientStops.value.find((item) => item.id === stopId)\n if (!rect || !stop) return\n stop.percent = clampPercent(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 100)\n pendingRemoveGradientStopId.value = canRemoveGradientStop(stopId) && isPointerOutsideGradientBar(event, rect) ? stopId : null\n commitValue()\n}\n\nfunction getBoundedPointerRatio(clientPosition: number, start: number, size: number) {\n if (!Number.isFinite(size) || size <= 0) return 0\n return Math.min(1, Math.max(0, (clientPosition - start) / size))\n}\n\nfunction startDrag(event: PointerEvent, update: (event: PointerEvent) => void, onEnd?: (event: PointerEvent) => void, onCancel?: () => void): boolean {\n if (props.disabled) return false\n event.preventDefault()\n // 上一次拖拽若因异常释放未收尾,先按取消处理,避免监听叠加。\n dragCleanup?.()\n update(event)\n\n // currentTarget 在事件派发结束后会被清空,必须在同步阶段取出。\n const captureTarget = (event.currentTarget as HTMLElement | null) ?? null\n const pointerId = typeof event.pointerId === 'number' ? event.pointerId : null\n const isSamePointer = (target: PointerEvent) => pointerId === null || target.pointerId === pointerId\n let hasPointerCapture = false\n\n if (pointerId !== null && typeof captureTarget?.setPointerCapture === 'function') {\n try {\n captureTarget.setPointerCapture(pointerId)\n hasPointerCapture = typeof captureTarget.hasPointerCapture === 'function' ? captureTarget.hasPointerCapture(pointerId) : true\n } catch {\n // 元素已卸载等场景无法捕获指针,退化为仅依赖 window 监听。\n hasPointerCapture = false\n }\n }\n\n function removeDragListeners() {\n // 捕获阶段监听:指针落在 Drawer、Modal 等带 .stop 的容器上时,仍能收到 move/up。\n window.removeEventListener('pointermove', handleMove, true)\n window.removeEventListener('pointerup', handleUp, true)\n window.removeEventListener('pointercancel', handleCancel, true)\n window.removeEventListener('blur', handleWindowBlur)\n captureTarget?.removeEventListener('lostpointercapture', handleLostPointerCapture)\n if (hasPointerCapture && pointerId !== null && captureTarget?.hasPointerCapture?.(pointerId)) {\n captureTarget.releasePointerCapture(pointerId)\n }\n if (dragCleanup === cancelDrag) dragCleanup = null\n }\n\n function handleMove(moveEvent: PointerEvent) {\n if (!isSamePointer(moveEvent)) return\n if (props.disabled) {\n cancelDrag()\n return\n }\n moveEvent.preventDefault()\n update(moveEvent)\n }\n\n function handleUp(upEvent: PointerEvent) {\n if (!isSamePointer(upEvent)) return\n removeDragListeners()\n onEnd?.(upEvent)\n }\n\n function handleCancel(cancelEvent: PointerEvent) {\n if (!isSamePointer(cancelEvent)) return\n removeDragListeners()\n onCancel?.()\n }\n\n function handleWindowBlur() {\n removeDragListeners()\n onCancel?.()\n }\n\n function handleLostPointerCapture() {\n removeDragListeners()\n onCancel?.()\n }\n\n function cancelDrag() {\n removeDragListeners()\n onCancel?.()\n }\n\n window.addEventListener('pointermove', handleMove, true)\n window.addEventListener('pointerup', handleUp, true)\n window.addEventListener('pointercancel', handleCancel, true)\n // 指针在窗口外释放或系统夺走焦点时不会派发 pointerup,需主动结束拖拽。\n window.addEventListener('blur', handleWindowBlur)\n if (hasPointerCapture) captureTarget?.addEventListener('lostpointercapture', handleLostPointerCapture)\n dragCleanup = cancelDrag\n return true\n}\n\nfunction handlePalettePointerDown(event: PointerEvent) {\n startDrag(event, updatePaletteFromPointer)\n}\n\nfunction handleHuePointerDown(event: PointerEvent) {\n const stopDragging = () => {\n isDraggingHue.value = false\n }\n if (!startDrag(event, updateHueFromPointer, stopDragging, stopDragging)) return\n isDraggingHue.value = true\n}\n\nfunction handleOpacityPointerDown(event: PointerEvent) {\n const stopDragging = () => {\n isDraggingOpacity.value = false\n }\n if (!startDrag(event, updateOpacityFromPointer, stopDragging, stopDragging)) return\n isDraggingOpacity.value = true\n}\n\nfunction handleDegreePointerDown(event: PointerEvent) {\n const stopDragging = () => {\n isDraggingDegree.value = false\n }\n if (!startDrag(event, updateDegreeFromPointer, stopDragging, stopDragging)) return\n isDraggingDegree.value = true\n}\n\nfunction addGradientStop(event: PointerEvent) {\n if (!isGradientAllowed.value || activeMode.value === 'solid' || gradientStops.value.length >= maxGradientStops) return\n const rect = gradientBarRef.value?.getBoundingClientRect()\n if (!rect) return\n const stop = createGradientStop(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 100, paletteColor)\n gradientStops.value.push(stop)\n activeGradientStopId.value = stop.id\n commitValue()\n}\n\nfunction handleGradientBarPointerDown(event: PointerEvent) {\n if (props.disabled) return\n addGradientStop(event)\n}\n\nfunction handleGradientStopPointerDown(event: PointerEvent, stopId: number) {\n if (props.disabled) return\n const stop = gradientStops.value.find((item) => item.id === stopId)\n if (!stop) return\n const stopDragging = () => {\n draggingGradientStopId.value = null\n pendingRemoveGradientStopId.value = null\n }\n const started = startDrag(\n event,\n (moveEvent) => updateGradientStopFromPointer(moveEvent, stopId),\n () => {\n if (pendingRemoveGradientStopId.value === stopId) removeGradientStop(stopId)\n stopDragging()\n },\n stopDragging\n )\n if (!started) return\n activeGradientStopId.value = stop.id\n draggingGradientStopId.value = stop.id\n syncPaletteColor(stop.color)\n}\n\nfunction handleGradientStopKeydown(event: KeyboardEvent, stopId: number) {\n const stop = gradientStops.value.find((item) => item.id === stopId)\n if (!stop || props.disabled) return\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n event.preventDefault()\n activeGradientStopId.value = stop.id\n stop.percent = clampPercent(stop.percent + (event.key === 'ArrowLeft' ? -1 : 1))\n commitValue()\n }\n}\n\nfunction removeGradientStop(stopId = activeGradientStopId.value) {\n if (stopId === null || gradientStops.value.length <= 2) return\n if (pendingRemoveGradientStopId.value === stopId) pendingRemoveGradientStopId.value = null\n const index = gradientStops.value.findIndex((stop) => stop.id === stopId)\n if (index === -1) return\n gradientStops.value.splice(index, 1)\n const nextStop = gradientStops.value[Math.min(index, gradientStops.value.length - 1)]\n activeGradientStopId.value = nextStop?.id ?? null\n if (nextStop) syncPaletteColor(nextStop.color)\n commitValue()\n}\n\nasync function pickScreenColor() {\n if (props.disabled || typeof window === 'undefined') return\n const EyeDropper = (window as Window & { EyeDropper?: EyeDropperConstructor }).EyeDropper\n if (!EyeDropper) return\n\n try {\n const result = await new EyeDropper().open()\n syncPaletteColor(colorToHsba(result.sRGBHex))\n syncActiveGradientStopColor()\n commitValue()\n } catch {\n // 用户取消系统取色时浏览器会 reject,保持当前颜色即可。\n }\n}\n\nfunction handleTriggerKeydown(event: KeyboardEvent) {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n toggleOpen()\n } else if (event.key === 'Escape') {\n open.value = false\n }\n}\n\nfunction handleDocumentPointerDown(event: PointerEvent) {\n if (!open.value) return\n const target = event.target as Node\n const isOutsideTrigger = rootRef.value && !rootRef.value.contains(target)\n const isOutsidePanel = panelRef.value && !panelRef.value.contains(target)\n if (isOutsideTrigger && isOutsidePanel) open.value = false\n}\n\nfunction handleDocumentKeydown(event: KeyboardEvent) {\n if (!open.value) return\n if (event.key === 'Escape') {\n open.value = false\n }\n}\n\nfunction schedulePanelPositionUpdate() {\n if (open.value) void updatePanelPosition()\n}\n\nonMounted(() => {\n eyeDropperSupported.value = typeof window !== 'undefined' && 'EyeDropper' in window\n document.addEventListener('pointerdown', handleDocumentPointerDown, true)\n document.addEventListener('keydown', handleDocumentKeydown)\n document.addEventListener('scroll', schedulePanelPositionUpdate, true)\n window.addEventListener('resize', schedulePanelPositionUpdate)\n})\n\nonUnmounted(() => {\n dragCleanup?.()\n clearColorInputCommitTimer()\n document.removeEventListener('pointerdown', handleDocumentPointerDown, true)\n document.removeEventListener('keydown', handleDocumentKeydown)\n document.removeEventListener('scroll', schedulePanelPositionUpdate, true)\n window.removeEventListener('resize', schedulePanelPositionUpdate)\n})\n</script>\n\n<template>\n <div ref=\"rootRef\" class=\"relative inline-flex align-middle\" :style=\"getUiAttrStyle(attrs)\">\n <button v-bind=\"getUiExposeAttrs(attrs)\" data-ui-colorpicker=\"true\" type=\"button\" :class=\"triggerClass\" :disabled=\"disabled\" :aria-expanded=\"open\" aria-haspopup=\"dialog\" aria-label=\"选择颜色\" @click=\"toggleOpen\" @keydown=\"handleTriggerKeydown\">\n <span :class=\"swatchClass\">\n <span class=\"block h-full w-full rounded-[inherit]\" :style=\"{ background: previewBackground }\"></span>\n </span>\n </button>\n\n <Teleport to=\"body\">\n <div v-if=\"open\" ref=\"panelRef\" role=\"dialog\" aria-label=\"颜色选择器\" :style=\"panelStyle\" class=\"ui-colorpicker-panel rounded-lg border border-medium bg-primary text-primary shadow-xl outline-none\" @contextmenu.prevent @pointerdown.stop @selectstart.prevent>\n <div v-if=\"isGradientAllowed\" class=\"flex h-10 items-center gap-1 border-b border-medium px-3\">\n <button v-for=\"item in modeOptions\" :key=\"item.mode\" type=\"button\" :title=\"item.label\" :aria-label=\"item.label\" class=\"flex size-6 items-center justify-center rounded bg-transparent\" @click=\"changeMode(item.mode)\">\n <span\n class=\"size-3.5 rounded-full border transition-[border-color,background,filter]\"\n :class=\"[\n item.mode === activeMode ? 'border-[#ff7d3a]' : 'border-[#7d7d7d] grayscale',\n item.mode === 'solid' ? (item.mode === activeMode ? 'bg-[#ffc9b6]' : 'bg-[#e2e2e2]') : '',\n item.mode === 'linear' ? (item.mode === activeMode ? 'bg-[linear-gradient(180deg,#ffc9b6,#ff5011)]' : 'bg-[linear-gradient(180deg,#ffffff,#999999)]') : '',\n item.mode === 'radial' ? (item.mode === activeMode ? 'bg-[radial-gradient(circle,#ffc9b6,#ff5011)]' : 'bg-[radial-gradient(circle,#ffffff,#999999)]') : ''\n ]\"\n ></span>\n </button>\n </div>\n\n <div v-if=\"isGradientAllowed && activeMode !== 'solid'\" class=\"border-b border-medium py-2\">\n <div data-ui-colorpicker-gradient-row=\"true\" class=\"flex items-center mx-3\">\n <div class=\"relative h-4 min-w-0 flex-1 rounded-full border border-medium ui-colorpicker-checker\" @pointerdown=\"handleGradientBarPointerDown\" ref=\"gradientBarRef\">\n <div class=\"absolute inset-0 rounded-full\" :style=\"{ background: gradientBarBackground }\"></div>\n <button\n v-for=\"stop in gradientStops\"\n :key=\"stop.id\"\n type=\"button\"\n class=\"ui-colorpicker-stop absolute top-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(100,116,139,0.75)] outline-none transition-[box-shadow,opacity,transform] hover:scale-125 focus-visible:ring-2 focus-visible:ring-brand/30\"\n :class=\"[stop.id === activeGradientStopId ? 'z-10 ring-2 ring-brand-500' : '', stop.id === draggingGradientStopId ? 'scale-125' : '', stop.id === pendingRemoveGradientStopId ? 'opacity-50' : '']\"\n :style=\"{ left: `${stop.percent}%`, background: hsbaToCss(stop.color) }\"\n :aria-label=\"`渐变节点 ${stop.percent}%`\"\n @pointerdown.stop=\"handleGradientStopPointerDown($event, stop.id)\"\n @keydown=\"handleGradientStopKeydown($event, stop.id)\"\n ></button>\n </div>\n\n <div v-if=\"activeMode === 'linear'\" data-ui-colorpicker-degree-group=\"true\" class=\"flex shrink-0 items-center\">\n <span class=\"min-w-9 text-right font-mono text-xs text-tertiary\">{{ degree }}°</span>\n <div ref=\"degreeRef\" data-ui-colorpicker-degree=\"true\" class=\"relative size-6 overflow-visible rounded-full border border-strong bg-secondary\" @pointerdown=\"handleDegreePointerDown\">\n <span data-ui-colorpicker-degree-pointer=\"true\" class=\"pointer-events-none absolute left-1/2 top-1/2 size-0 origin-left\" :style=\"degreePointerStyle\">\n <span data-ui-colorpicker-degree-line=\"true\" class=\"absolute left-0 top-0 h-0.5 w-2.5 -translate-y-1/2 rounded-full bg-[var(--color-border-strong)]\"></span>\n <span\n data-ui-colorpicker-degree-handle=\"true\"\n class=\"pointer-events-auto absolute left-2.5 top-0 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-strong bg-primary transition-[background-color,border-color,box-shadow,transform] hover:scale-125 hover:border-brand hover:bg-brand-50 hover:shadow-[0_0_0_2px_rgba(59,130,246,0.18)]\"\n :class=\"isDraggingDegree ? 'scale-125 border-brand bg-brand-50 shadow-[0_0_0_2px_rgba(59,130,246,0.18)]' : ''\"\n ></span>\n </span>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"grid gap-3 p-3\">\n <div ref=\"paletteRef\" data-ui-colorpicker-palette=\"true\" class=\"ui-colorpicker-palette relative overflow-hidden rounded-md border border-medium\" :style=\"paletteStyle\" @pointerdown=\"handlePalettePointerDown\">\n <div class=\"ui-colorpicker-palette-layer ui-colorpicker-palette-light\"></div>\n <div class=\"ui-colorpicker-palette-layer ui-colorpicker-palette-dark\"></div>\n <span class=\"ui-colorpicker-picker absolute size-3 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)]\" :style=\"palettePickerStyle\"></span>\n </div>\n\n <div class=\"flex items-center gap-3\">\n <button\n type=\"button\"\n class=\"flex size-8 shrink-0 items-center justify-center rounded-md border border-medium bg-secondary text-tertiary transition-colors hover:border-brand/40 hover:text-brand disabled:cursor-not-allowed disabled:opacity-50\"\n :disabled=\"eyeDropperButtonDisabled\"\n aria-label=\"屏幕取色\"\n title=\"屏幕取色\"\n @click=\"pickScreenColor\"\n >\n <span class=\"i-lucide:pipette size-4\"></span>\n </button>\n\n <div class=\"grid min-w-0 flex-1 gap-2\">\n <div ref=\"hueBarRef\" class=\"ui-colorpicker-huebar relative h-3 rounded-full border border-medium\" @pointerdown=\"handleHuePointerDown\">\n <span\n data-ui-colorpicker-hue-handle=\"true\"\n class=\"ui-colorpicker-bar-picker absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)] transition-transform hover:scale-125\"\n :class=\"isDraggingHue ? 'scale-125' : ''\"\n :style=\"huePickerStyle\"\n ></span>\n </div>\n <div v-if=\"isAlphaAllowed\" ref=\"opacityBarRef\" data-ui-colorpicker-opacity=\"true\" class=\"ui-colorpicker-checker relative h-3 rounded-full border border-medium\" @pointerdown=\"handleOpacityPointerDown\">\n <div class=\"absolute inset-0 rounded-full\" :style=\"{ background: opacityBarBackground }\"></div>\n <span\n data-ui-colorpicker-opacity-handle=\"true\"\n class=\"ui-colorpicker-bar-picker absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)] transition-transform hover:scale-125\"\n :class=\"isDraggingOpacity ? 'scale-125' : ''\"\n :style=\"opacityPickerStyle\"\n ></span>\n </div>\n </div>\n\n <span class=\"ui-colorpicker-checker size-8 shrink-0 overflow-hidden rounded-full border border-medium\">\n <span class=\"block h-full w-full rounded-full\" :style=\"{ background: previewBackground }\"></span>\n </span>\n </div>\n\n <div data-ui-colorpicker-input-row=\"true\" class=\"ui-colorpicker-input-row grid items-center gap-2 text-xs\" :style=\"colorInputRowStyle\">\n <input\n data-ui-colorpicker-color-input=\"true\"\n class=\"min-w-0 rounded border bg-secondary px-2 py-1 font-mono text-secondary outline-none transition-colors focus:border-brand\"\n :class=\"colorInputInvalid ? 'border-[#ff4d4f]' : 'border-medium'\"\n :value=\"colorInputValue\"\n :aria-invalid=\"colorInputInvalid\"\n spellcheck=\"false\"\n @focus=\"handleColorInputFocus\"\n @input=\"handleColorInput\"\n @keydown.stop=\"handleColorInputKeydown\"\n @blur=\"handleColorInputBlur\"\n />\n <span class=\"rounded border border-medium bg-secondary px-2 py-1 text-right font-mono text-tertiary\">{{ isAlphaAllowed ? Math.round(paletteColor.a * 100) : 100 }}%</span>\n </div>\n </div>\n </div>\n </Teleport>\n </div>\n</template>\n\n<style scoped>\n.ui-colorpicker-checker {\n background-color: #fff;\n background-image:\n linear-gradient(45deg, rgba(148, 163, 184, 0.35) 25%, transparent 25%), linear-gradient(-45deg, rgba(148, 163, 184, 0.35) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.35) 75%), linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.35) 75%);\n background-position:\n 0 0,\n 0 6px,\n 6px -6px,\n -6px 0;\n background-size: 12px 12px;\n}\n\n.ui-colorpicker-panel {\n box-sizing: border-box;\n}\n\n.ui-colorpicker-palette {\n height: 9rem;\n}\n\n.ui-colorpicker-palette-layer {\n position: absolute;\n inset: 0;\n}\n\n.ui-colorpicker-palette-light {\n background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));\n}\n\n.ui-colorpicker-palette-dark {\n background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));\n}\n\n.ui-colorpicker-input-row {\n grid-template-columns: minmax(0, 1fr) 56px;\n}\n\n.ui-colorpicker-input-row input {\n min-width: 0;\n}\n\n.ui-colorpicker-picker {\n transform: translate(-50%, -50%);\n}\n\n.ui-colorpicker-huebar {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, nextTick, onMounted, onUnmounted, reactive, ref, useAttrs, useTemplateRef, watch } from 'vue'\nimport type { CSSProperties } from 'vue'\n\nimport { getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { colorPickerSwatch, colorPickerTrigger, type ColorPickerSize } from '.'\nimport { clampAlpha, clampHue, clampPercent, cloneHsba, colorToHsba, hsbToRgb, hsbaToCss, normalizeDegree, normalizeRgba, parseCssColor, rgbaToCss, rgbaToHex, type ColorPickerHsbaColor, type ColorPickerMode, type ColorPickerValue, type InternalGradientStop } from './color'\n\ndefineOptions({\n inheritAttrs: false\n})\n\ntype EyeDropperConstructor = new () => {\n open: () => Promise<{ sRGBHex: string }>\n}\ntype Booleanish = boolean | 'true' | 'false' | ''\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是对象式颜色值,兼容 giacomohuang/colorpicker 的 solid/linear/radial 结构。 */\n modelValue?: ColorPickerValue\n /** size 是触发器尺寸,可选。 */\n size?: ColorPickerSize\n /** allowGradient 表示是否允许选择 linear/radial 渐变模式。 */\n allowGradient?: Booleanish\n /** allowAlpha 表示是否允许选择透明度;关闭后输出 alpha 固定为 1。 */\n allowAlpha?: Booleanish\n /** disabled 表示是否禁用颜色选择交互。 */\n disabled?: boolean\n }>(),\n {\n modelValue: undefined,\n size: 'md',\n allowGradient: true,\n allowAlpha: true,\n disabled: false\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: ColorPickerValue): void\n (e: 'changed', value: ColorPickerValue): void\n}>()\n\nconst attrs = useAttrs()\nconst rootRef = useTemplateRef<HTMLElement>('rootRef')\nconst panelRef = useTemplateRef<HTMLElement>('panelRef')\nconst paletteRef = useTemplateRef<HTMLElement>('paletteRef')\nconst hueBarRef = useTemplateRef<HTMLElement>('hueBarRef')\nconst opacityBarRef = useTemplateRef<HTMLElement>('opacityBarRef')\nconst gradientBarRef = useTemplateRef<HTMLElement>('gradientBarRef')\nconst degreeRef = useTemplateRef<HTMLElement>('degreeRef')\n\nconst open = ref(false)\nconst activeMode = ref<ColorPickerMode>('solid')\nconst degree = ref(90)\nconst activeGradientStopId = ref<number | null>(null)\nconst draggingGradientStopId = ref<number | null>(null)\nconst pendingRemoveGradientStopId = ref<number | null>(null)\nconst isDraggingHue = ref(false)\nconst isDraggingOpacity = ref(false)\nconst isDraggingDegree = ref(false)\nconst colorInputValue = ref('')\nconst colorInputInvalid = ref(false)\nconst isColorInputFocused = ref(false)\nconst gradientStops = ref<InternalGradientStop[]>([])\nconst paletteColor = reactive<ColorPickerHsbaColor>({ h: 0, s: 0, b: 0, a: 1 })\nconst panelPosition = reactive({ top: 0, left: 0 })\nconst eyeDropperSupported = ref(false)\nlet gradientStopSeed = 0\n/** 当前拖拽会话的取消函数,供二次拖拽、面板关闭和组件卸载统一收尾。 */\nlet dragCleanup: (() => void) | null = null\nlet syncingFromModel = false\nlet lastEmittedValue: ColorPickerValue | null = null\nlet lastEmittedSignature = ''\nlet colorInputCommitTimer: number | null = null\n\nconst modeOptions: { mode: ColorPickerMode; label: string }[] = [\n { mode: 'solid', label: '纯色' },\n { mode: 'linear', label: '线性渐变' },\n { mode: 'radial', label: '径向渐变' }\n]\nconst panelWidth = 260\nconst panelGap = 4\nconst viewportPadding = 8\nconst maxGradientStops = 10\nconst colorInputDebounceMs = 200\n// 控制点拖出渐变条一段距离后松手,按设计语义移除该控制点。\nconst gradientStopRemoveDistance = 24\n\nconst normalizeBooleanProp = (value: Booleanish | undefined, fallback: boolean) => {\n if (value === undefined) return fallback\n if (value === 'false') return false\n if (value === 'true' || value === '') return true\n return value\n}\nconst currentRgba = computed(() => hsbToRgb(paletteColor))\nconst activeDisplayRgba = computed(() => {\n if (activeMode.value === 'solid') return currentRgba.value\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value) ?? gradientStops.value[0]\n return activeStop ? hsbToRgb(activeStop.color) : currentRgba.value\n})\nconst activeColorText = computed(() => rgbaToHex(normalizeOutputRgba(activeDisplayRgba.value)))\nconst isGradientAllowed = computed(() => normalizeBooleanProp(props.allowGradient, true))\nconst isAlphaAllowed = computed(() => normalizeBooleanProp(props.allowAlpha, true))\nconst hueBackground = computed(() => rgbaToCss(hsbToRgb({ h: paletteColor.h, s: 100, b: 100, a: 1 })))\nconst gradientPreviewStops = computed(() =>\n getSortedGradientStops()\n .map((stop) => `${hsbaToCss(stop.color)} ${stop.percent}%`)\n .join(',')\n)\nconst gradientPreview = computed(() => {\n if (activeMode.value === 'linear') return `linear-gradient(${degree.value}deg,${gradientPreviewStops.value})`\n if (activeMode.value === 'radial') return `radial-gradient(circle,${gradientPreviewStops.value})`\n return rgbaToCss(currentRgba.value)\n})\nconst gradientBarBackground = computed(() => `linear-gradient(to right,${gradientPreviewStops.value || `${rgbaToCss(currentRgba.value)} 0%,${rgbaToCss(currentRgba.value)} 100%`})`)\nconst opacityBarBackground = computed(() => {\n const color = normalizeRgba({ ...currentRgba.value, a: 1 })\n return `linear-gradient(to right, rgba(${color.r},${color.g},${color.b},0), rgba(${color.r},${color.g},${color.b},1))`\n})\nconst previewBackground = computed(() => (activeMode.value === 'solid' ? rgbaToCss(currentRgba.value) : gradientPreview.value))\nconst triggerClass = computed(() =>\n clsx(\n attrs.class as string | undefined,\n colorPickerTrigger({\n size: props.size,\n focused: open.value,\n disabled: props.disabled\n })\n )\n)\nconst swatchClass = computed(() => colorPickerSwatch({ size: props.size }))\nconst eyeDropperButtonDisabled = computed(() => props.disabled || !eyeDropperSupported.value)\nconst panelStyle = computed<CSSProperties>(() => ({\n position: 'fixed',\n top: `${panelPosition.top}px`,\n left: `${panelPosition.left}px`,\n width: `${panelWidth}px`,\n maxHeight: `calc(100vh - ${viewportPadding * 2}px)`,\n overflowY: 'auto',\n zIndex: 2000\n}))\nconst paletteStyle = computed<CSSProperties>(() => ({\n background: hueBackground.value,\n height: '9rem'\n}))\nconst colorInputRowStyle = computed<CSSProperties>(() => ({\n gridTemplateColumns: 'minmax(0, 1fr) 56px'\n}))\nconst palettePickerStyle = computed<CSSProperties>(() => ({\n left: `${paletteColor.s}%`,\n top: `${100 - paletteColor.b}%`,\n backgroundColor: rgbaToCss(currentRgba.value)\n}))\nconst huePickerStyle = computed<CSSProperties>(() => ({\n left: `${(paletteColor.h / 360) * 100}%`\n}))\nconst opacityPickerStyle = computed<CSSProperties>(() => ({\n left: `${paletteColor.a * 100}%`\n}))\nconst degreePointerStyle = computed<CSSProperties>(() => ({\n transform: `translateY(-50%) rotate(${degree.value - 90}deg)`\n}))\n\nwatch(\n () => props.modelValue,\n (value) => {\n if (value && (value === lastEmittedValue || getModelSignature(value) === lastEmittedSignature)) {\n lastEmittedValue = null\n lastEmittedSignature = ''\n return\n }\n syncFromModelValue(value)\n },\n { deep: true, immediate: true }\n)\n\nwatch(open, (value) => {\n if (value) void updatePanelPosition()\n else dragCleanup?.()\n})\n\nwatch(\n activeColorText,\n (value) => {\n if (isColorInputFocused.value) return\n colorInputValue.value = value\n colorInputInvalid.value = false\n },\n { immediate: true }\n)\n\nwatch(isGradientAllowed, (value) => {\n if (!value && activeMode.value !== 'solid') {\n activeMode.value = 'solid'\n commitValue()\n }\n})\n\nwatch(isAlphaAllowed, (value) => {\n if (value) return\n let changed = false\n if (paletteColor.a !== 1) {\n paletteColor.a = 1\n changed = true\n }\n gradientStops.value.forEach((stop) => {\n if (stop.color.a !== 1) {\n stop.color.a = 1\n changed = true\n }\n })\n if (changed) commitValue()\n})\n\nfunction isValidMode(mode: unknown): mode is ColorPickerMode {\n return mode === 'solid' || mode === 'linear' || mode === 'radial'\n}\n\nfunction getSortedGradientStops() {\n return [...gradientStops.value].sort((a, b) => a.percent - b.percent)\n}\n\nfunction syncPaletteColor(color: ColorPickerHsbaColor) {\n const normalizedColor = normalizeHsbaForProps(color)\n paletteColor.h = normalizedColor.h\n paletteColor.s = normalizedColor.s\n paletteColor.b = normalizedColor.b\n paletteColor.a = normalizedColor.a\n}\n\nfunction createGradientStop(percent: number, color: ColorPickerHsbaColor): InternalGradientStop {\n return {\n id: gradientStopSeed++,\n percent: clampPercent(percent),\n color: normalizeHsbaForProps(color)\n }\n}\n\nfunction createDefaultGradientStops(color = paletteColor) {\n return [createGradientStop(0, color), createGradientStop(100, color)]\n}\n\nfunction normalizeGradientStops(value?: ColorPickerValue) {\n if (!value?.gradients?.length) return createDefaultGradientStops()\n const stops = value.gradients\n .filter((stop) => stop && typeof stop === 'object')\n .slice(0, maxGradientStops)\n .map((stop) => createGradientStop(stop.percent, colorToHsba(stop.color)))\n\n if (stops.length >= 2) return stops\n if (stops.length === 1) return [stops[0], createGradientStop(100, stops[0].color)]\n return createDefaultGradientStops()\n}\n\nfunction ensureGradientStops() {\n if (gradientStops.value.length >= 2) return\n gradientStops.value = createDefaultGradientStops()\n activeGradientStopId.value = gradientStops.value[0]?.id ?? null\n}\n\nfunction syncPaletteFromActiveGradientStop() {\n if (activeMode.value === 'solid') return\n ensureGradientStops()\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value) ?? gradientStops.value[0]\n if (!activeStop) return\n activeGradientStopId.value = activeStop.id\n syncPaletteColor(activeStop.color)\n}\n\nfunction syncActiveGradientStopColor() {\n if (activeMode.value === 'solid') return\n ensureGradientStops()\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value)\n if (activeStop) activeStop.color = normalizeHsbaForProps(paletteColor)\n}\n\nfunction syncFromModelValue(value?: ColorPickerValue) {\n syncingFromModel = true\n const nextMode = isGradientAllowed.value && isValidMode(value?.mode) ? value.mode : 'solid'\n const paletteSource = value?.color ?? value?.gradients?.[0]?.color\n activeMode.value = nextMode\n degree.value = normalizeDegree(value?.degree)\n syncPaletteColor(colorToHsba(paletteSource))\n gradientStops.value = normalizeGradientStops(value)\n activeGradientStopId.value = gradientStops.value[0]?.id ?? null\n if (nextMode !== 'solid') syncPaletteFromActiveGradientStop()\n syncingFromModel = false\n}\n\nfunction buildModelValue(): ColorPickerValue {\n if (activeMode.value === 'solid') {\n const color = normalizeOutputRgba(currentRgba.value)\n return {\n mode: 'solid',\n color,\n hex: rgbaToHex(color),\n css: `background-color:${rgbaToCss(color)}`\n }\n }\n\n const gradients = getSortedGradientStops().map((stop) => ({\n percent: stop.percent,\n color: normalizeOutputRgba(hsbToRgb(stop.color))\n }))\n const gradientBody = gradients.map((stop) => `${rgbaToCss(stop.color)} ${stop.percent}%`).join(',')\n\n if (activeMode.value === 'linear') {\n return {\n mode: 'linear',\n degree: degree.value,\n gradients,\n css: `background-image:linear-gradient(${degree.value}deg,${gradientBody})`\n }\n }\n\n return {\n mode: 'radial',\n gradients,\n css: `background-image:radial-gradient(${gradientBody})`\n }\n}\n\nfunction commitValue() {\n if (syncingFromModel) return\n const value = buildModelValue()\n lastEmittedValue = value\n lastEmittedSignature = getModelSignature(value)\n emit('update:modelValue', value)\n emit('changed', value)\n}\n\nfunction getModelSignature(value: ColorPickerValue) {\n return JSON.stringify(value)\n}\n\nfunction normalizeHsbaForProps(color: ColorPickerHsbaColor): ColorPickerHsbaColor {\n const normalizedColor = cloneHsba(color)\n if (!isAlphaAllowed.value) normalizedColor.a = 1\n return normalizedColor\n}\n\nfunction normalizeOutputRgba(color: ReturnType<typeof hsbToRgb>) {\n const normalizedColor = normalizeRgba(color)\n if (!isAlphaAllowed.value) normalizedColor.a = 1\n return normalizedColor\n}\n\nfunction clearColorInputCommitTimer() {\n if (colorInputCommitTimer === null) return\n window.clearTimeout(colorInputCommitTimer)\n colorInputCommitTimer = null\n}\n\nfunction applyColorInputValue(options: { formatInput?: boolean } = {}) {\n const color = parseCssColor(colorInputValue.value)\n if (!color) {\n colorInputInvalid.value = true\n return null\n }\n\n const outputColor = normalizeOutputRgba(color)\n const formattedValue = rgbaToHex(outputColor)\n const nextColor = normalizeHsbaForProps(colorToHsba(outputColor))\n colorInputInvalid.value = false\n if (options.formatInput) colorInputValue.value = formattedValue\n syncPaletteColor(nextColor)\n\n if (activeMode.value !== 'solid') {\n ensureGradientStops()\n const activeStop = gradientStops.value.find((stop) => stop.id === activeGradientStopId.value) ?? gradientStops.value[0]\n if (activeStop) {\n activeGradientStopId.value = activeStop.id\n activeStop.color = nextColor\n }\n }\n\n commitValue()\n return formattedValue\n}\n\nfunction resetColorInputValue() {\n clearColorInputCommitTimer()\n colorInputValue.value = activeColorText.value\n colorInputInvalid.value = false\n}\n\nfunction scheduleColorInputCommit() {\n clearColorInputCommitTimer()\n colorInputCommitTimer = window.setTimeout(() => {\n colorInputCommitTimer = null\n applyColorInputValue()\n }, colorInputDebounceMs)\n}\n\nfunction handleColorInput(event: Event) {\n const value = (event.target as HTMLInputElement).value\n colorInputValue.value = value\n const parsedColor = parseCssColor(value)\n colorInputInvalid.value = value.trim() !== '' && !parsedColor\n if (parsedColor) {\n scheduleColorInputCommit()\n } else {\n clearColorInputCommitTimer()\n }\n}\n\nfunction handleColorInputKeydown(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n event.preventDefault()\n clearColorInputCommitTimer()\n const formattedValue = applyColorInputValue({ formatInput: true })\n if (formattedValue && event.target instanceof HTMLInputElement) event.target.value = formattedValue\n return\n }\n if (event.key === 'Escape') {\n event.preventDefault()\n resetColorInputValue()\n }\n}\n\nfunction handleColorInputFocus() {\n isColorInputFocused.value = true\n}\n\nfunction handleColorInputBlur(event: FocusEvent) {\n isColorInputFocused.value = false\n clearColorInputCommitTimer()\n const formattedValue = applyColorInputValue({ formatInput: true })\n if (formattedValue && event.target instanceof HTMLInputElement) event.target.value = formattedValue\n}\n\nfunction updatePanelPosition() {\n return nextTick(() => {\n const triggerEl = rootRef.value\n if (!triggerEl) return\n const triggerRect = triggerEl.getBoundingClientRect()\n const panelHeight = panelRef.value?.offsetHeight || 360\n const viewportWidth = window.innerWidth\n const viewportHeight = window.innerHeight\n const maxLeft = viewportWidth - panelWidth - viewportPadding\n const belowTop = triggerRect.bottom + panelGap\n const aboveTop = triggerRect.top - panelHeight - panelGap\n\n panelPosition.left = Math.max(viewportPadding, Math.min(triggerRect.left, maxLeft))\n panelPosition.top = belowTop + panelHeight <= viewportHeight - viewportPadding ? belowTop : Math.max(viewportPadding, aboveTop)\n })\n}\n\nfunction setOpen(value: boolean) {\n if (props.disabled) return\n open.value = value\n}\n\nfunction toggleOpen() {\n setOpen(!open.value)\n}\n\nfunction changeMode(mode: ColorPickerMode) {\n if (props.disabled) return\n if (mode !== 'solid' && !isGradientAllowed.value) return\n activeMode.value = mode\n if (activeMode.value !== 'solid') syncPaletteFromActiveGradientStop()\n commitValue()\n}\n\nfunction updatePaletteFromPointer(event: PointerEvent) {\n const rect = paletteRef.value?.getBoundingClientRect()\n if (!rect) return\n paletteColor.s = clampPercent(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 100)\n paletteColor.b = clampPercent((1 - getBoundedPointerRatio(event.clientY, rect.top, rect.height)) * 100)\n syncActiveGradientStopColor()\n commitValue()\n}\n\nfunction updateHueFromPointer(event: PointerEvent) {\n const rect = hueBarRef.value?.getBoundingClientRect()\n if (!rect) return\n // 色谱条是线性滑块,拖出边界时要停在端点,不能像角度盘一样循环。\n paletteColor.h = Math.round(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 360)\n syncActiveGradientStopColor()\n commitValue()\n}\n\nfunction updateOpacityFromPointer(event: PointerEvent) {\n if (!isAlphaAllowed.value) return\n const rect = opacityBarRef.value?.getBoundingClientRect()\n if (!rect) return\n paletteColor.a = clampAlpha(getBoundedPointerRatio(event.clientX, rect.left, rect.width))\n syncActiveGradientStopColor()\n commitValue()\n}\n\nfunction updateDegreeFromPointer(event: PointerEvent) {\n const rect = degreeRef.value?.getBoundingClientRect()\n if (!rect) return\n const centerX = rect.left + rect.width / 2\n const centerY = rect.top + rect.height / 2\n const rad = Math.atan2(centerY - event.clientY, event.clientX - centerX)\n const nextDegree = 90 - Math.floor((rad * 180) / Math.PI)\n degree.value = clampHue(nextDegree)\n commitValue()\n}\n\nfunction canRemoveGradientStop(stopId: number) {\n return gradientStops.value.length > 2 && gradientStops.value.some((stop) => stop.id === stopId)\n}\n\n// 只按垂直方向判断移除,横向拖动仍然用于调整百分比并夹在条内。\nfunction isPointerOutsideGradientBar(event: PointerEvent, rect: DOMRect) {\n return event.clientY < rect.top - gradientStopRemoveDistance || event.clientY > rect.bottom + gradientStopRemoveDistance\n}\n\nfunction updateGradientStopFromPointer(event: PointerEvent, stopId: number) {\n const rect = gradientBarRef.value?.getBoundingClientRect()\n const stop = gradientStops.value.find((item) => item.id === stopId)\n if (!rect || !stop) return\n stop.percent = clampPercent(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 100)\n pendingRemoveGradientStopId.value = canRemoveGradientStop(stopId) && isPointerOutsideGradientBar(event, rect) ? stopId : null\n commitValue()\n}\n\nfunction getBoundedPointerRatio(clientPosition: number, start: number, size: number) {\n if (!Number.isFinite(size) || size <= 0) return 0\n return Math.min(1, Math.max(0, (clientPosition - start) / size))\n}\n\nfunction startDrag(event: PointerEvent, update: (event: PointerEvent) => void, onEnd?: (event: PointerEvent) => void, onCancel?: () => void): boolean {\n if (props.disabled) return false\n event.preventDefault()\n // 上一次拖拽若因异常释放未收尾,先按取消处理,避免监听叠加。\n dragCleanup?.()\n update(event)\n\n // currentTarget 在事件派发结束后会被清空,必须在同步阶段取出。\n const captureTarget = (event.currentTarget as HTMLElement | null) ?? null\n const pointerId = typeof event.pointerId === 'number' ? event.pointerId : null\n const isSamePointer = (target: PointerEvent) => pointerId === null || target.pointerId === pointerId\n let hasPointerCapture = false\n\n if (pointerId !== null && typeof captureTarget?.setPointerCapture === 'function') {\n try {\n captureTarget.setPointerCapture(pointerId)\n hasPointerCapture = typeof captureTarget.hasPointerCapture === 'function' ? captureTarget.hasPointerCapture(pointerId) : true\n } catch {\n // 元素已卸载等场景无法捕获指针,退化为仅依赖 window 监听。\n hasPointerCapture = false\n }\n }\n\n function removeDragListeners() {\n // 捕获阶段监听:指针落在 Drawer、Modal 等带 .stop 的容器上时,仍能收到 move/up。\n window.removeEventListener('pointermove', handleMove, true)\n window.removeEventListener('pointerup', handleUp, true)\n window.removeEventListener('pointercancel', handleCancel, true)\n window.removeEventListener('blur', handleWindowBlur)\n captureTarget?.removeEventListener('lostpointercapture', handleLostPointerCapture)\n if (hasPointerCapture && pointerId !== null && captureTarget?.hasPointerCapture?.(pointerId)) {\n captureTarget.releasePointerCapture(pointerId)\n }\n if (dragCleanup === cancelDrag) dragCleanup = null\n }\n\n function handleMove(moveEvent: PointerEvent) {\n if (!isSamePointer(moveEvent)) return\n if (props.disabled) {\n cancelDrag()\n return\n }\n moveEvent.preventDefault()\n update(moveEvent)\n }\n\n function handleUp(upEvent: PointerEvent) {\n if (!isSamePointer(upEvent)) return\n removeDragListeners()\n onEnd?.(upEvent)\n }\n\n function handleCancel(cancelEvent: PointerEvent) {\n if (!isSamePointer(cancelEvent)) return\n removeDragListeners()\n onCancel?.()\n }\n\n function handleWindowBlur() {\n removeDragListeners()\n onCancel?.()\n }\n\n function handleLostPointerCapture() {\n removeDragListeners()\n onCancel?.()\n }\n\n function cancelDrag() {\n removeDragListeners()\n onCancel?.()\n }\n\n window.addEventListener('pointermove', handleMove, true)\n window.addEventListener('pointerup', handleUp, true)\n window.addEventListener('pointercancel', handleCancel, true)\n // 指针在窗口外释放或系统夺走焦点时不会派发 pointerup,需主动结束拖拽。\n window.addEventListener('blur', handleWindowBlur)\n if (hasPointerCapture) captureTarget?.addEventListener('lostpointercapture', handleLostPointerCapture)\n dragCleanup = cancelDrag\n return true\n}\n\nfunction handlePalettePointerDown(event: PointerEvent) {\n startDrag(event, updatePaletteFromPointer)\n}\n\nfunction handleHuePointerDown(event: PointerEvent) {\n const stopDragging = () => {\n isDraggingHue.value = false\n }\n if (!startDrag(event, updateHueFromPointer, stopDragging, stopDragging)) return\n isDraggingHue.value = true\n}\n\nfunction handleOpacityPointerDown(event: PointerEvent) {\n const stopDragging = () => {\n isDraggingOpacity.value = false\n }\n if (!startDrag(event, updateOpacityFromPointer, stopDragging, stopDragging)) return\n isDraggingOpacity.value = true\n}\n\nfunction handleDegreePointerDown(event: PointerEvent) {\n const stopDragging = () => {\n isDraggingDegree.value = false\n }\n if (!startDrag(event, updateDegreeFromPointer, stopDragging, stopDragging)) return\n isDraggingDegree.value = true\n}\n\nfunction addGradientStop(event: PointerEvent) {\n if (!isGradientAllowed.value || activeMode.value === 'solid' || gradientStops.value.length >= maxGradientStops) return\n const rect = gradientBarRef.value?.getBoundingClientRect()\n if (!rect) return\n const stop = createGradientStop(getBoundedPointerRatio(event.clientX, rect.left, rect.width) * 100, paletteColor)\n gradientStops.value.push(stop)\n activeGradientStopId.value = stop.id\n commitValue()\n}\n\nfunction handleGradientBarPointerDown(event: PointerEvent) {\n if (props.disabled) return\n addGradientStop(event)\n}\n\nfunction handleGradientStopPointerDown(event: PointerEvent, stopId: number) {\n if (props.disabled) return\n const stop = gradientStops.value.find((item) => item.id === stopId)\n if (!stop) return\n const stopDragging = () => {\n draggingGradientStopId.value = null\n pendingRemoveGradientStopId.value = null\n }\n const started = startDrag(\n event,\n (moveEvent) => updateGradientStopFromPointer(moveEvent, stopId),\n () => {\n if (pendingRemoveGradientStopId.value === stopId) removeGradientStop(stopId)\n stopDragging()\n },\n stopDragging\n )\n if (!started) return\n activeGradientStopId.value = stop.id\n draggingGradientStopId.value = stop.id\n syncPaletteColor(stop.color)\n}\n\nfunction handleGradientStopKeydown(event: KeyboardEvent, stopId: number) {\n const stop = gradientStops.value.find((item) => item.id === stopId)\n if (!stop || props.disabled) return\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n event.preventDefault()\n activeGradientStopId.value = stop.id\n stop.percent = clampPercent(stop.percent + (event.key === 'ArrowLeft' ? -1 : 1))\n commitValue()\n }\n}\n\nfunction removeGradientStop(stopId = activeGradientStopId.value) {\n if (stopId === null || gradientStops.value.length <= 2) return\n if (pendingRemoveGradientStopId.value === stopId) pendingRemoveGradientStopId.value = null\n const index = gradientStops.value.findIndex((stop) => stop.id === stopId)\n if (index === -1) return\n gradientStops.value.splice(index, 1)\n const nextStop = gradientStops.value[Math.min(index, gradientStops.value.length - 1)]\n activeGradientStopId.value = nextStop?.id ?? null\n if (nextStop) syncPaletteColor(nextStop.color)\n commitValue()\n}\n\nasync function pickScreenColor() {\n if (props.disabled || typeof window === 'undefined') return\n const EyeDropper = (window as Window & { EyeDropper?: EyeDropperConstructor }).EyeDropper\n if (!EyeDropper) return\n\n try {\n const result = await new EyeDropper().open()\n syncPaletteColor(colorToHsba(result.sRGBHex))\n syncActiveGradientStopColor()\n commitValue()\n } catch {\n // 用户取消系统取色时浏览器会 reject,保持当前颜色即可。\n }\n}\n\nfunction handleTriggerKeydown(event: KeyboardEvent) {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n toggleOpen()\n } else if (event.key === 'Escape') {\n open.value = false\n }\n}\n\nfunction handleDocumentPointerDown(event: PointerEvent) {\n if (!open.value) return\n const target = event.target as Node\n const isOutsideTrigger = rootRef.value && !rootRef.value.contains(target)\n const isOutsidePanel = panelRef.value && !panelRef.value.contains(target)\n if (isOutsideTrigger && isOutsidePanel) open.value = false\n}\n\nfunction handleDocumentKeydown(event: KeyboardEvent) {\n if (!open.value) return\n if (event.key === 'Escape') {\n open.value = false\n }\n}\n\nfunction schedulePanelPositionUpdate() {\n if (open.value) void updatePanelPosition()\n}\n\nonMounted(() => {\n eyeDropperSupported.value = typeof window !== 'undefined' && 'EyeDropper' in window\n document.addEventListener('pointerdown', handleDocumentPointerDown, true)\n document.addEventListener('keydown', handleDocumentKeydown)\n document.addEventListener('scroll', schedulePanelPositionUpdate, true)\n window.addEventListener('resize', schedulePanelPositionUpdate)\n})\n\nonUnmounted(() => {\n dragCleanup?.()\n clearColorInputCommitTimer()\n document.removeEventListener('pointerdown', handleDocumentPointerDown, true)\n document.removeEventListener('keydown', handleDocumentKeydown)\n document.removeEventListener('scroll', schedulePanelPositionUpdate, true)\n window.removeEventListener('resize', schedulePanelPositionUpdate)\n})\n</script>\n\n<template>\n <div ref=\"rootRef\" class=\"relative inline-flex align-middle\" :style=\"getUiAttrStyle(attrs)\">\n <button v-bind=\"getUiExposeAttrs(attrs)\" data-ui-colorpicker=\"true\" type=\"button\" :class=\"triggerClass\" :disabled=\"disabled\" :aria-expanded=\"open\" aria-haspopup=\"dialog\" aria-label=\"选择颜色\" @click=\"toggleOpen\" @keydown=\"handleTriggerKeydown\">\n <span :class=\"swatchClass\">\n <span class=\"block h-full w-full rounded-[inherit]\" :style=\"{ background: previewBackground }\"></span>\n </span>\n </button>\n\n <Teleport to=\"body\">\n <div v-if=\"open\" ref=\"panelRef\" role=\"dialog\" aria-label=\"颜色选择器\" :style=\"panelStyle\" class=\"ui-colorpicker-panel rounded-lg border border-medium bg-primary text-primary shadow-xl outline-none\" @contextmenu.prevent @pointerdown.stop @selectstart.prevent>\n <div v-if=\"isGradientAllowed\" class=\"flex h-10 items-center gap-1 border-b border-medium px-3\">\n <button v-for=\"item in modeOptions\" :key=\"item.mode\" type=\"button\" :title=\"item.label\" :aria-label=\"item.label\" class=\"flex size-6 items-center justify-center rounded bg-transparent\" @click=\"changeMode(item.mode)\">\n <span\n class=\"size-3.5 rounded-full border transition-[border-color,background,filter]\"\n :class=\"[\n item.mode === activeMode ? 'border-[#ff7d3a]' : 'border-[#7d7d7d] grayscale',\n item.mode === 'solid' ? (item.mode === activeMode ? 'bg-[#ffc9b6]' : 'bg-[#e2e2e2]') : '',\n item.mode === 'linear' ? (item.mode === activeMode ? 'bg-[linear-gradient(180deg,#ffc9b6,#ff5011)]' : 'bg-[linear-gradient(180deg,#ffffff,#999999)]') : '',\n item.mode === 'radial' ? (item.mode === activeMode ? 'bg-[radial-gradient(circle,#ffc9b6,#ff5011)]' : 'bg-[radial-gradient(circle,#ffffff,#999999)]') : ''\n ]\"\n ></span>\n </button>\n </div>\n\n <div v-if=\"isGradientAllowed && activeMode !== 'solid'\" class=\"border-b border-medium py-2\">\n <div data-ui-colorpicker-gradient-row=\"true\" class=\"flex items-center mx-3\">\n <div class=\"relative h-4 min-w-0 flex-1 rounded-full border border-medium ui-colorpicker-checker\" @pointerdown=\"handleGradientBarPointerDown\" ref=\"gradientBarRef\">\n <div class=\"absolute inset-0 rounded-full\" :style=\"{ background: gradientBarBackground }\"></div>\n <button\n v-for=\"stop in gradientStops\"\n :key=\"stop.id\"\n type=\"button\"\n class=\"ui-colorpicker-stop absolute top-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(100,116,139,0.75)] outline-none transition-[box-shadow,opacity,transform] hover:scale-125 focus-visible:ring-2 focus-visible:ring-brand/30\"\n :class=\"[stop.id === activeGradientStopId ? 'z-10 ring-2 ring-brand-500' : '', stop.id === draggingGradientStopId ? 'scale-125' : '', stop.id === pendingRemoveGradientStopId ? 'opacity-50' : '']\"\n :style=\"{ left: `${stop.percent}%`, background: hsbaToCss(stop.color) }\"\n :aria-label=\"`渐变节点 ${stop.percent}%`\"\n @pointerdown.stop=\"handleGradientStopPointerDown($event, stop.id)\"\n @keydown=\"handleGradientStopKeydown($event, stop.id)\"\n ></button>\n </div>\n\n <div v-if=\"activeMode === 'linear'\" data-ui-colorpicker-degree-group=\"true\" class=\"flex shrink-0 items-center\">\n <span class=\"min-w-9 text-right font-mono text-xs text-tertiary\">{{ degree }}°</span>\n <div ref=\"degreeRef\" data-ui-colorpicker-degree=\"true\" class=\"relative size-6 overflow-visible rounded-full border border-strong bg-secondary\" @pointerdown=\"handleDegreePointerDown\">\n <span data-ui-colorpicker-degree-pointer=\"true\" class=\"pointer-events-none absolute left-1/2 top-1/2 size-0 origin-left\" :style=\"degreePointerStyle\">\n <span data-ui-colorpicker-degree-line=\"true\" class=\"absolute left-0 top-0 h-0.5 w-2.5 -translate-y-1/2 rounded-full bg-[var(--color-border-strong)]\"></span>\n <span\n data-ui-colorpicker-degree-handle=\"true\"\n class=\"pointer-events-auto absolute left-2.5 top-0 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-strong bg-primary transition-[background-color,border-color,box-shadow,transform] hover:scale-125 hover:border-brand hover:bg-brand-50 hover:shadow-[0_0_0_2px_rgba(59,130,246,0.18)]\"\n :class=\"isDraggingDegree ? 'scale-125 border-brand bg-brand-50 shadow-[0_0_0_2px_rgba(59,130,246,0.18)]' : ''\"\n ></span>\n </span>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"grid gap-3 p-3\">\n <div ref=\"paletteRef\" data-ui-colorpicker-palette=\"true\" class=\"ui-colorpicker-palette relative overflow-hidden rounded-md border border-medium\" :style=\"paletteStyle\" @pointerdown=\"handlePalettePointerDown\">\n <div class=\"ui-colorpicker-palette-layer ui-colorpicker-palette-light\"></div>\n <div class=\"ui-colorpicker-palette-layer ui-colorpicker-palette-dark\"></div>\n <span class=\"ui-colorpicker-picker absolute size-3 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)]\" :style=\"palettePickerStyle\"></span>\n </div>\n\n <div class=\"flex items-center gap-3\">\n <button\n type=\"button\"\n class=\"flex size-8 shrink-0 items-center justify-center rounded-md border border-medium bg-secondary text-tertiary transition-colors hover:border-brand/40 hover:text-brand disabled:cursor-not-allowed disabled:opacity-50\"\n :disabled=\"eyeDropperButtonDisabled\"\n aria-label=\"屏幕取色\"\n title=\"屏幕取色\"\n @click=\"pickScreenColor\"\n >\n <span class=\"i-lucide:pipette size-4\"></span>\n </button>\n\n <div class=\"grid min-w-0 flex-1 gap-2\">\n <div ref=\"hueBarRef\" class=\"ui-colorpicker-huebar relative h-3 rounded-full border border-medium\" @pointerdown=\"handleHuePointerDown\">\n <span\n data-ui-colorpicker-hue-handle=\"true\"\n class=\"ui-colorpicker-bar-picker absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)] transition-transform hover:scale-125\"\n :class=\"isDraggingHue ? 'scale-125' : ''\"\n :style=\"huePickerStyle\"\n ></span>\n </div>\n <div v-if=\"isAlphaAllowed\" ref=\"opacityBarRef\" data-ui-colorpicker-opacity=\"true\" class=\"ui-colorpicker-checker relative h-3 rounded-full border border-medium\" @pointerdown=\"handleOpacityPointerDown\">\n <div class=\"absolute inset-0 rounded-full\" :style=\"{ background: opacityBarBackground }\"></div>\n <span\n data-ui-colorpicker-opacity-handle=\"true\"\n class=\"ui-colorpicker-bar-picker absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(15,23,42,0.55)] transition-transform hover:scale-125\"\n :class=\"isDraggingOpacity ? 'scale-125' : ''\"\n :style=\"opacityPickerStyle\"\n ></span>\n </div>\n </div>\n\n <span class=\"ui-colorpicker-checker size-8 shrink-0 overflow-hidden rounded-full border border-medium\">\n <span class=\"block h-full w-full rounded-full\" :style=\"{ background: previewBackground }\"></span>\n </span>\n </div>\n\n <div data-ui-colorpicker-input-row=\"true\" class=\"ui-colorpicker-input-row grid items-center gap-2 text-xs\" :style=\"colorInputRowStyle\">\n <input\n data-ui-colorpicker-color-input=\"true\"\n class=\"min-w-0 rounded border bg-secondary px-2 py-1 font-mono text-secondary outline-none transition-colors focus:border-brand\"\n :class=\"colorInputInvalid ? 'border-[#ff4d4f]' : 'border-medium'\"\n :value=\"colorInputValue\"\n :aria-invalid=\"colorInputInvalid\"\n spellcheck=\"false\"\n @focus=\"handleColorInputFocus\"\n @input=\"handleColorInput\"\n @keydown.stop=\"handleColorInputKeydown\"\n @blur=\"handleColorInputBlur\"\n />\n <span class=\"rounded border border-medium bg-secondary px-2 py-1 text-right font-mono text-tertiary\">{{ isAlphaAllowed ? Math.round(paletteColor.a * 100) : 100 }}%</span>\n </div>\n </div>\n </div>\n </Teleport>\n </div>\n</template>\n\n<style scoped>\n.ui-colorpicker-checker {\n background-color: #fff;\n background-image:\n linear-gradient(45deg, rgba(148, 163, 184, 0.35) 25%, transparent 25%), linear-gradient(-45deg, rgba(148, 163, 184, 0.35) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.35) 75%), linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.35) 75%);\n background-position:\n 0 0,\n 0 6px,\n 6px -6px,\n -6px 0;\n background-size: 12px 12px;\n}\n\n.ui-colorpicker-panel {\n box-sizing: border-box;\n}\n\n.ui-colorpicker-palette {\n height: 9rem;\n}\n\n.ui-colorpicker-palette-layer {\n position: absolute;\n inset: 0;\n}\n\n.ui-colorpicker-palette-light {\n background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));\n}\n\n.ui-colorpicker-palette-dark {\n background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));\n}\n\n.ui-colorpicker-input-row {\n grid-template-columns: minmax(0, 1fr) 56px;\n}\n\n.ui-colorpicker-input-row input {\n min-width: 0;\n}\n\n.ui-colorpicker-picker {\n transform: translate(-50%, -50%);\n}\n\n.ui-colorpicker-huebar {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n}\n</style>\n","import { cva } from 'class-variance-authority'\nimport type { VariantProps } from 'class-variance-authority'\n\nexport { default as ColorPicker } from './ColorPicker.vue'\nexport type { ColorPickerGradientStop, ColorPickerMode, ColorPickerRgbaColor, ColorPickerValue } from './color'\n\n/** colorPickerTrigger 定义管理端 ColorPicker 触发按钮样式。 */\nexport const colorPickerTrigger = cva('group/ui-colorpicker inline-flex shrink-0 items-center justify-center overflow-hidden border bg-primary align-middle transition-colors duration-150', {\n variants: {\n size: {\n sm: 'rounded-md p-1',\n md: 'rounded-md p-1',\n lg: 'rounded-md p-1.5'\n },\n focused: {\n true: 'border-brand ring-2 ring-brand/15',\n false: 'border-control hover:border-brand/40'\n },\n disabled: {\n true: 'cursor-not-allowed bg-primary hover:border-control',\n false: 'cursor-pointer'\n }\n },\n defaultVariants: {\n size: 'md',\n focused: false,\n disabled: false\n }\n})\n\n/** colorPickerSwatch 通过内容尺寸和 trigger padding 自然形成标准控件高度。 */\nexport const colorPickerSwatch = cva('ui-colorpicker-checker block shrink-0 overflow-hidden rounded-[inherit]', {\n variants: {\n size: {\n sm: 'size-5',\n md: 'size-6',\n lg: 'size-6'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\n/** ColorPickerProps 是 colorPickerTrigger 变体推导出的组件属性类型。 */\nexport type ColorPickerProps = VariantProps<typeof colorPickerTrigger>\nexport type ColorPickerSize = NonNullable<Color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AAA,CAAA,GAAA,CAAA;;;;yCEr2BlK,KAAqB,GAAI,uJAAuJ;CAC3L,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,SAAS;GACP,MAAM;GACN,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;EACT,UAAU;CACZ;AACF,CAAC,GAGY,KAAoB,GAAI,2EAA2E;CAC9G,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC"}
@@ -0,0 +1,197 @@
1
+ import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
+ import { t } from "./internal-drag-B2-9vftX.js";
3
+ import { cva as n } from "class-variance-authority";
4
+ import { Teleport as ee, Transition as r, computed as i, createBlock as te, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, inject as d, nextTick as ne, normalizeClass as f, normalizeStyle as p, onBeforeUnmount as m, openBlock as h, provide as re, ref as g, renderSlot as _, toDisplayString as ie, unref as ae, vShow as v, watch as y, withCtx as b, withDirectives as x, withModifiers as S } from "vue";
5
+ //#region src/drawer/Drawer.vue?vue&type=script&setup=true&lang.ts
6
+ var C = {
7
+ key: 0,
8
+ class: "flex min-h-12 items-center justify-between gap-3 border-b border-zinc-100/50 px-4 py-3 dark:border-zinc-800/50"
9
+ }, oe = { class: "min-w-0 truncate text-xs font-bold uppercase tracking-widest text-zinc-500" }, w = {
10
+ key: 1,
11
+ class: "flex justify-end gap-2 border-t border-zinc-100/50 bg-zinc-50/30 px-3 py-2.5 dark:border-zinc-800/50 dark:bg-zinc-800/30"
12
+ }, T = 180, E = /*#__PURE__*/ e(/* @__PURE__ */ u({
13
+ __name: "Drawer",
14
+ props: {
15
+ modelValue: {
16
+ type: Boolean,
17
+ default: void 0
18
+ },
19
+ visible: {
20
+ type: Boolean,
21
+ default: void 0
22
+ },
23
+ title: { default: "" },
24
+ direction: { default: "rtl" },
25
+ size: { default: "30%" },
26
+ withHeader: {
27
+ type: Boolean,
28
+ default: !0
29
+ },
30
+ showClose: {
31
+ type: Boolean,
32
+ default: !0
33
+ },
34
+ closeOnClickModal: {
35
+ type: Boolean,
36
+ default: !0
37
+ },
38
+ closeOnPressEscape: {
39
+ type: Boolean,
40
+ default: !0
41
+ },
42
+ beforeClose: {
43
+ type: Function,
44
+ default: void 0
45
+ },
46
+ destroyOnClose: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ modal: {
51
+ type: Boolean,
52
+ default: !0
53
+ },
54
+ lockScroll: {
55
+ type: Boolean,
56
+ default: !0
57
+ },
58
+ zIndex: { default: 2e3 },
59
+ bodyClass: { default: "" },
60
+ push: {
61
+ type: [Boolean, Object],
62
+ default: !0
63
+ }
64
+ },
65
+ emits: [
66
+ "update:modelValue",
67
+ "update:visible",
68
+ "open",
69
+ "opened",
70
+ "close",
71
+ "closed"
72
+ ],
73
+ setup(e, { emit: n }) {
74
+ let u = e, E = n, k = t(), A = i(() => u.modelValue ?? u.visible ?? !1), j = g(A.value), M = Symbol("ui-drawer"), N = d(D, null), P = g([]), F = i(() => u.direction === "rtl" || u.direction === "ltr"), I = i(() => typeof u.size == "number" ? `${u.size}px` : u.size), L = i(() => u.push === !1 ? 0 : typeof u.push == "object" && u.push.distance !== void 0 ? u.push.distance : N ? N.pushDistance.value : T), R = i(() => G(L.value)), z = i(() => {
75
+ if (!P.value.length) return;
76
+ let e = R.value;
77
+ if (e !== "0px") switch (u.direction) {
78
+ case "rtl": return `translateX(-${e})`;
79
+ case "ltr": return `translateX(${e})`;
80
+ case "ttb": return `translateY(${e})`;
81
+ case "btt": return `translateY(-${e})`;
82
+ default: return;
83
+ }
84
+ }), B = i(() => ({
85
+ width: F.value ? I.value : void 0,
86
+ height: F.value ? void 0 : I.value,
87
+ transform: z.value
88
+ })), V = i(() => `ui-drawer-${u.direction}`), H = "", U = !1, W = !1;
89
+ function G(e) {
90
+ return typeof e == "number" ? `${e}px` : e;
91
+ }
92
+ function K(e) {
93
+ E("update:modelValue", e), E("update:visible", e);
94
+ }
95
+ function q() {
96
+ K(!1), E("close");
97
+ }
98
+ async function J() {
99
+ if (!u.beforeClose) {
100
+ q();
101
+ return;
102
+ }
103
+ let e = !1, t = await u.beforeClose(() => {
104
+ e = !0, q();
105
+ });
106
+ t === !1 || e || (u.beforeClose.length === 0 || t !== void 0) && q();
107
+ }
108
+ function Y(e) {
109
+ !A.value || !u.closeOnPressEscape || e.key !== "Escape" || (e.preventDefault(), e.stopPropagation(), J());
110
+ }
111
+ function X(e) {
112
+ k(e) || e.stopPropagation();
113
+ }
114
+ function Z() {
115
+ !u.lockScroll || typeof document > "u" || (H = document.body.style.overflow, document.body.style.overflow = "hidden");
116
+ }
117
+ function Q() {
118
+ !u.lockScroll || typeof document > "u" || (document.body.style.overflow = H);
119
+ }
120
+ function se(e) {
121
+ u.push === !1 || P.value.includes(e) || (P.value = [...P.value, e]);
122
+ }
123
+ function ce(e) {
124
+ P.value.includes(e) && (P.value = P.value.filter((t) => t !== e));
125
+ }
126
+ function le() {
127
+ !N || W || (N.push(M), W = !0);
128
+ }
129
+ function $() {
130
+ !N || !W || (N.pull(M), W = !1);
131
+ }
132
+ return re(D, {
133
+ pushDistance: L,
134
+ push: se,
135
+ pull: ce
136
+ }), y(A, (e) => {
137
+ e ? (j.value = !0, U = !0, le(), Z(), E("open"), window.addEventListener("keydown", Y, { capture: !0 }), ne(() => E("opened"))) : ($(), P.value = [], Q(), window.removeEventListener("keydown", Y, { capture: !0 }), U && E("closed"), u.destroyOnClose && window.setTimeout(() => {
138
+ A.value || (j.value = !1);
139
+ }, 180));
140
+ }, { immediate: !0 }), m(() => {
141
+ $(), Q(), window.removeEventListener("keydown", Y, { capture: !0 });
142
+ }), (t, n) => (h(), te(ee, { to: "body" }, [l(r, { name: "ui-drawer-fade" }, {
143
+ default: b(() => [j.value ? x((h(), o("div", {
144
+ key: 0,
145
+ class: "fixed inset-0 pointer-events-auto",
146
+ style: p({ zIndex: e.zIndex }),
147
+ onMousemove: X,
148
+ onMousedown: X,
149
+ onMouseup: X,
150
+ onPointermove: X,
151
+ onPointerdown: X,
152
+ onPointerup: X,
153
+ onWheel: n[1] ||= S(() => {}, ["stop"]),
154
+ onClick: n[2] ||= S(() => {}, ["stop"]),
155
+ onDblclick: n[3] ||= S(() => {}, ["stop"]),
156
+ onContextmenu: n[4] ||= S(() => {}, ["stop"])
157
+ }, [e.modal ? (h(), o("div", {
158
+ key: 0,
159
+ class: "absolute inset-0 bg-zinc-900/10 backdrop-blur-sm",
160
+ onClick: n[0] ||= (t) => e.closeOnClickModal && J()
161
+ })) : a("", !0), l(r, {
162
+ name: V.value,
163
+ appear: ""
164
+ }, {
165
+ default: b(() => [x(s("aside", {
166
+ class: f(["ui-drawer-panel", ae(O)({ direction: e.direction })]),
167
+ style: p(B.value),
168
+ "data-ui-drawer": "true"
169
+ }, [
170
+ e.withHeader ? (h(), o("header", C, [_(t.$slots, "header", {}, () => [s("h3", oe, [_(t.$slots, "icon", {}, void 0, !0), c(" " + ie(e.title), 1)])], !0), e.showClose ? (h(), o("button", {
171
+ key: 0,
172
+ type: "button",
173
+ "aria-label": "关闭",
174
+ class: "group flex size-7 shrink-0 items-center justify-center rounded-full transition-colors hover:bg-brand-200 dark:hover:bg-brand-500",
175
+ onClick: J
176
+ }, [...n[5] ||= [s("span", { class: "i-lucide:x size-4 text-zinc-400 group-hover:text-brand-600 dark:group-hover:text-brand-200" }, null, -1)]])) : a("", !0)])) : a("", !0),
177
+ s("div", { class: f(["min-h-0 flex-1 overflow-auto", e.bodyClass]) }, [!e.destroyOnClose || A.value ? _(t.$slots, "default", { key: 0 }, void 0, !0) : a("", !0)], 2),
178
+ t.$slots.footer ? (h(), o("footer", w, [_(t.$slots, "footer", {}, void 0, !0)])) : a("", !0)
179
+ ], 6), [[v, A.value]])]),
180
+ _: 3
181
+ }, 8, ["name"])], 36)), [[v, A.value]]) : a("", !0)]),
182
+ _: 3
183
+ })]));
184
+ }
185
+ }), [["__scopeId", "data-v-61bd1b86"]]), D = Symbol("ui-drawer-context"), O = n("fixed z-10 flex bg-white/95 shadow-2xl backdrop-blur-md dark:bg-zinc-900/95", {
186
+ variants: { direction: {
187
+ rtl: "inset-y-0 right-0 flex-col border-l border-white/20 dark:border-zinc-800/50",
188
+ ltr: "inset-y-0 left-0 flex-col border-r border-white/20 dark:border-zinc-800/50",
189
+ ttb: "inset-x-0 top-0 flex-col border-b border-white/20 dark:border-zinc-800/50",
190
+ btt: "inset-x-0 bottom-0 flex-col border-t border-white/20 dark:border-zinc-800/50"
191
+ } },
192
+ defaultVariants: { direction: "rtl" }
193
+ });
194
+ //#endregion
195
+ export { O as n, E as r, D as t };
196
+
197
+ //# sourceMappingURL=drawer-BgGY0UFF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer-BgGY0UFF.js","names":["$slots"],"sources":["../../src/drawer/Drawer.vue","../../src/drawer/Drawer.vue","../../src/drawer/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, inject, nextTick, onBeforeUnmount, provide, ref, watch, type CSSProperties } from 'vue'\n\nimport { createInternalDragBoundary } from '../utils/internal-drag'\n\nimport { drawerContextKey, drawerPanel, type DrawerDirection, type DrawerPush, type DrawerPushDistance } from '.'\n\ntype DrawerBeforeClose = (done: () => void) => void | boolean | Promise<void | boolean>\n\nconst DEFAULT_PUSH_DISTANCE = 180\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 控制抽屉显示状态,兼容 Element Plus v-model。 */\n modelValue?: boolean\n /** visible 控制抽屉显示状态,兼容本地 Modal 的 v-model:visible。 */\n visible?: boolean\n /** title 是默认标题文本。 */\n title?: string\n /** direction 是抽屉弹出方向,可选 rtl/ltr/ttb/btt。 */\n direction?: DrawerDirection\n /** size 是抽屉宽度或高度,数字按 px 处理。 */\n size?: number | string\n /** withHeader 表示是否渲染头部区域。 */\n withHeader?: boolean\n /** showClose 表示是否展示关闭按钮。 */\n showClose?: boolean\n /** closeOnClickModal 表示是否允许点击遮罩关闭。 */\n closeOnClickModal?: boolean\n /** closeOnPressEscape 表示是否允许 Esc 关闭。 */\n closeOnPressEscape?: boolean\n /** beforeClose 在关闭前执行,返回 false 或不调用 done 可阻止关闭。 */\n beforeClose?: DrawerBeforeClose\n /** destroyOnClose 表示关闭后是否销毁默认插槽内容。 */\n destroyOnClose?: boolean\n /** modal 表示是否展示遮罩。 */\n modal?: boolean\n /** lockScroll 表示打开时是否锁定 body 滚动。 */\n lockScroll?: boolean\n /** zIndex 控制抽屉层级。 */\n zIndex?: number | string\n /** bodyClass 是正文区域额外类名。 */\n bodyClass?: string\n /** push 控制多层 Drawer 打开时父级抽屉是否被推动。 */\n push?: DrawerPush\n }>(),\n {\n modelValue: undefined,\n visible: undefined,\n title: '',\n direction: 'rtl',\n size: '30%',\n withHeader: true,\n showClose: true,\n closeOnClickModal: true,\n closeOnPressEscape: true,\n beforeClose: undefined,\n destroyOnClose: false,\n modal: true,\n lockScroll: true,\n zIndex: 2000,\n bodyClass: '',\n push: true\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n (e: 'update:visible', value: boolean): void\n (e: 'open'): void\n (e: 'opened'): void\n (e: 'close'): void\n (e: 'closed'): void\n}>()\n\nconst shouldAllowInteraction = createInternalDragBoundary()\nconst isVisible = computed(() => props.modelValue ?? props.visible ?? false)\nconst shouldRender = ref(isVisible.value)\nconst drawerId = Symbol('ui-drawer')\nconst parentDrawer = inject(drawerContextKey, null)\nconst pushedChildIds = ref<symbol[]>([])\nconst isHorizontal = computed(() => props.direction === 'rtl' || props.direction === 'ltr')\nconst normalizedSize = computed(() => (typeof props.size === 'number' ? `${props.size}px` : props.size))\nconst pushDistance = computed<DrawerPushDistance>(() => {\n if (props.push === false) return 0\n if (typeof props.push === 'object' && props.push.distance !== undefined) return props.push.distance\n if (parentDrawer) return parentDrawer.pushDistance.value\n return DEFAULT_PUSH_DISTANCE\n})\nconst normalizedPushDistance = computed(() => normalizeCssSize(pushDistance.value))\nconst pushTransform = computed(() => {\n if (!pushedChildIds.value.length) return undefined\n\n const distance = normalizedPushDistance.value\n if (distance === '0px') return undefined\n\n switch (props.direction) {\n case 'rtl':\n return `translateX(-${distance})`\n case 'ltr':\n return `translateX(${distance})`\n case 'ttb':\n return `translateY(${distance})`\n case 'btt':\n return `translateY(-${distance})`\n default:\n return undefined\n }\n})\nconst panelStyle = computed<CSSProperties>(() => ({\n width: isHorizontal.value ? normalizedSize.value : undefined,\n height: isHorizontal.value ? undefined : normalizedSize.value,\n transform: pushTransform.value\n}))\nconst transitionName = computed(() => `ui-drawer-${props.direction}`)\nlet previousBodyOverflow = ''\nlet hasOpened = false\nlet hasPushedParent = false\n\nfunction normalizeCssSize(value: DrawerPushDistance) {\n return typeof value === 'number' ? `${value}px` : value\n}\n\nfunction syncVisible(value: boolean) {\n emit('update:modelValue', value)\n emit('update:visible', value)\n}\n\nfunction closeNow() {\n syncVisible(false)\n emit('close')\n}\n\nasync function requestClose() {\n if (!props.beforeClose) {\n closeNow()\n return\n }\n\n let doneCalled = false\n const done = () => {\n doneCalled = true\n closeNow()\n }\n\n const result = await props.beforeClose(done)\n if (result === false || doneCalled) return\n if (props.beforeClose.length === 0 || result !== undefined) closeNow()\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n if (!isVisible.value || !props.closeOnPressEscape || event.key !== 'Escape') return\n event.preventDefault()\n event.stopPropagation()\n void requestClose()\n}\n\n/** Drawer 默认拦截页面事件;内部拖拽控件只放行当前手势的 move/up。 */\nfunction handleInteractionEvent(event: Event) {\n if (!shouldAllowInteraction(event)) event.stopPropagation()\n}\n\nfunction lockBodyScroll() {\n if (!props.lockScroll || typeof document === 'undefined') return\n previousBodyOverflow = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n}\n\nfunction unlockBodyScroll() {\n if (!props.lockScroll || typeof document === 'undefined') return\n document.body.style.overflow = previousBodyOverflow\n}\n\nfunction pushChild(id: symbol) {\n if (props.push === false || pushedChildIds.value.includes(id)) return\n pushedChildIds.value = [...pushedChildIds.value, id]\n}\n\nfunction pullChild(id: symbol) {\n if (!pushedChildIds.value.includes(id)) return\n pushedChildIds.value = pushedChildIds.value.filter((childId) => childId !== id)\n}\n\nfunction pushParent() {\n if (!parentDrawer || hasPushedParent) return\n parentDrawer.push(drawerId)\n hasPushedParent = true\n}\n\nfunction pullParent() {\n if (!parentDrawer || !hasPushedParent) return\n parentDrawer.pull(drawerId)\n hasPushedParent = false\n}\n\nprovide(drawerContextKey, {\n pushDistance,\n push: pushChild,\n pull: pullChild\n})\n\nwatch(\n isVisible,\n (visible) => {\n if (visible) {\n shouldRender.value = true\n hasOpened = true\n pushParent()\n lockBodyScroll()\n emit('open')\n window.addEventListener('keydown', handleKeydown, { capture: true })\n nextTick(() => emit('opened'))\n } else {\n pullParent()\n pushedChildIds.value = []\n unlockBodyScroll()\n window.removeEventListener('keydown', handleKeydown, { capture: true })\n if (hasOpened) emit('closed')\n if (props.destroyOnClose) {\n window.setTimeout(() => {\n if (!isVisible.value) shouldRender.value = false\n }, 180)\n }\n }\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => {\n pullParent()\n unlockBodyScroll()\n window.removeEventListener('keydown', handleKeydown, { capture: true })\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <Transition name=\"ui-drawer-fade\">\n <div\n v-if=\"shouldRender\"\n v-show=\"isVisible\"\n class=\"fixed inset-0 pointer-events-auto\"\n :style=\"{ zIndex }\"\n @mousemove=\"handleInteractionEvent\"\n @mousedown=\"handleInteractionEvent\"\n @mouseup=\"handleInteractionEvent\"\n @pointermove=\"handleInteractionEvent\"\n @pointerdown=\"handleInteractionEvent\"\n @pointerup=\"handleInteractionEvent\"\n @wheel.stop\n @click.stop\n @dblclick.stop\n @contextmenu.stop\n >\n <div v-if=\"modal\" class=\"absolute inset-0 bg-zinc-900/10 backdrop-blur-sm\" @click=\"closeOnClickModal && requestClose()\"></div>\n\n <Transition :name=\"transitionName\" appear>\n <aside v-show=\"isVisible\" :class=\"['ui-drawer-panel', drawerPanel({ direction })]\" :style=\"panelStyle\" data-ui-drawer=\"true\">\n <header v-if=\"withHeader\" class=\"flex min-h-12 items-center justify-between gap-3 border-b border-zinc-100/50 px-4 py-3 dark:border-zinc-800/50\">\n <slot name=\"header\">\n <h3 class=\"min-w-0 truncate text-xs font-bold uppercase tracking-widest text-zinc-500\">\n <slot name=\"icon\"></slot>\n {{ title }}\n </h3>\n </slot>\n <button v-if=\"showClose\" type=\"button\" aria-label=\"关闭\" class=\"group flex size-7 shrink-0 items-center justify-center rounded-full transition-colors hover:bg-brand-200 dark:hover:bg-brand-500\" @click=\"requestClose\">\n <span class=\"i-lucide:x size-4 text-zinc-400 group-hover:text-brand-600 dark:group-hover:text-brand-200\"></span>\n </button>\n </header>\n\n <div class=\"min-h-0 flex-1 overflow-auto\" :class=\"bodyClass\">\n <slot v-if=\"!destroyOnClose || isVisible\"></slot>\n </div>\n\n <footer v-if=\"$slots.footer\" class=\"flex justify-end gap-2 border-t border-zinc-100/50 bg-zinc-50/30 px-3 py-2.5 dark:border-zinc-800/50 dark:bg-zinc-800/30\">\n <slot name=\"footer\"></slot>\n </footer>\n </aside>\n </Transition>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.ui-drawer-fade-enter-active,\n.ui-drawer-fade-leave-active {\n transition: opacity 160ms ease;\n}\n\n.ui-drawer-fade-enter-from,\n.ui-drawer-fade-leave-to {\n opacity: 0;\n}\n\n.ui-drawer-panel {\n transition: transform 180ms ease;\n}\n\n.ui-drawer-rtl-enter-active,\n.ui-drawer-rtl-leave-active,\n.ui-drawer-ltr-enter-active,\n.ui-drawer-ltr-leave-active,\n.ui-drawer-ttb-enter-active,\n.ui-drawer-ttb-leave-active,\n.ui-drawer-btt-enter-active,\n.ui-drawer-btt-leave-active {\n transition: transform 180ms ease;\n}\n\n.ui-drawer-rtl-enter-from,\n.ui-drawer-rtl-leave-to {\n transform: translateX(100%);\n}\n\n.ui-drawer-ltr-enter-from,\n.ui-drawer-ltr-leave-to {\n transform: translateX(-100%);\n}\n\n.ui-drawer-ttb-enter-from,\n.ui-drawer-ttb-leave-to {\n transform: translateY(-100%);\n}\n\n.ui-drawer-btt-enter-from,\n.ui-drawer-btt-leave-to {\n transform: translateY(100%);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, inject, nextTick, onBeforeUnmount, provide, ref, watch, type CSSProperties } from 'vue'\n\nimport { createInternalDragBoundary } from '../utils/internal-drag'\n\nimport { drawerContextKey, drawerPanel, type DrawerDirection, type DrawerPush, type DrawerPushDistance } from '.'\n\ntype DrawerBeforeClose = (done: () => void) => void | boolean | Promise<void | boolean>\n\nconst DEFAULT_PUSH_DISTANCE = 180\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 控制抽屉显示状态,兼容 Element Plus v-model。 */\n modelValue?: boolean\n /** visible 控制抽屉显示状态,兼容本地 Modal 的 v-model:visible。 */\n visible?: boolean\n /** title 是默认标题文本。 */\n title?: string\n /** direction 是抽屉弹出方向,可选 rtl/ltr/ttb/btt。 */\n direction?: DrawerDirection\n /** size 是抽屉宽度或高度,数字按 px 处理。 */\n size?: number | string\n /** withHeader 表示是否渲染头部区域。 */\n withHeader?: boolean\n /** showClose 表示是否展示关闭按钮。 */\n showClose?: boolean\n /** closeOnClickModal 表示是否允许点击遮罩关闭。 */\n closeOnClickModal?: boolean\n /** closeOnPressEscape 表示是否允许 Esc 关闭。 */\n closeOnPressEscape?: boolean\n /** beforeClose 在关闭前执行,返回 false 或不调用 done 可阻止关闭。 */\n beforeClose?: DrawerBeforeClose\n /** destroyOnClose 表示关闭后是否销毁默认插槽内容。 */\n destroyOnClose?: boolean\n /** modal 表示是否展示遮罩。 */\n modal?: boolean\n /** lockScroll 表示打开时是否锁定 body 滚动。 */\n lockScroll?: boolean\n /** zIndex 控制抽屉层级。 */\n zIndex?: number | string\n /** bodyClass 是正文区域额外类名。 */\n bodyClass?: string\n /** push 控制多层 Drawer 打开时父级抽屉是否被推动。 */\n push?: DrawerPush\n }>(),\n {\n modelValue: undefined,\n visible: undefined,\n title: '',\n direction: 'rtl',\n size: '30%',\n withHeader: true,\n showClose: true,\n closeOnClickModal: true,\n closeOnPressEscape: true,\n beforeClose: undefined,\n destroyOnClose: false,\n modal: true,\n lockScroll: true,\n zIndex: 2000,\n bodyClass: '',\n push: true\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n (e: 'update:visible', value: boolean): void\n (e: 'open'): void\n (e: 'opened'): void\n (e: 'close'): void\n (e: 'closed'): void\n}>()\n\nconst shouldAllowInteraction = createInternalDragBoundary()\nconst isVisible = computed(() => props.modelValue ?? props.visible ?? false)\nconst shouldRender = ref(isVisible.value)\nconst drawerId = Symbol('ui-drawer')\nconst parentDrawer = inject(drawerContextKey, null)\nconst pushedChildIds = ref<symbol[]>([])\nconst isHorizontal = computed(() => props.direction === 'rtl' || props.direction === 'ltr')\nconst normalizedSize = computed(() => (typeof props.size === 'number' ? `${props.size}px` : props.size))\nconst pushDistance = computed<DrawerPushDistance>(() => {\n if (props.push === false) return 0\n if (typeof props.push === 'object' && props.push.distance !== undefined) return props.push.distance\n if (parentDrawer) return parentDrawer.pushDistance.value\n return DEFAULT_PUSH_DISTANCE\n})\nconst normalizedPushDistance = computed(() => normalizeCssSize(pushDistance.value))\nconst pushTransform = computed(() => {\n if (!pushedChildIds.value.length) return undefined\n\n const distance = normalizedPushDistance.value\n if (distance === '0px') return undefined\n\n switch (props.direction) {\n case 'rtl':\n return `translateX(-${distance})`\n case 'ltr':\n return `translateX(${distance})`\n case 'ttb':\n return `translateY(${distance})`\n case 'btt':\n return `translateY(-${distance})`\n default:\n return undefined\n }\n})\nconst panelStyle = computed<CSSProperties>(() => ({\n width: isHorizontal.value ? normalizedSize.value : undefined,\n height: isHorizontal.value ? undefined : normalizedSize.value,\n transform: pushTransform.value\n}))\nconst transitionName = computed(() => `ui-drawer-${props.direction}`)\nlet previousBodyOverflow = ''\nlet hasOpened = false\nlet hasPushedParent = false\n\nfunction normalizeCssSize(value: DrawerPushDistance) {\n return typeof value === 'number' ? `${value}px` : value\n}\n\nfunction syncVisible(value: boolean) {\n emit('update:modelValue', value)\n emit('update:visible', value)\n}\n\nfunction closeNow() {\n syncVisible(false)\n emit('close')\n}\n\nasync function requestClose() {\n if (!props.beforeClose) {\n closeNow()\n return\n }\n\n let doneCalled = false\n const done = () => {\n doneCalled = true\n closeNow()\n }\n\n const result = await props.beforeClose(done)\n if (result === false || doneCalled) return\n if (props.beforeClose.length === 0 || result !== undefined) closeNow()\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n if (!isVisible.value || !props.closeOnPressEscape || event.key !== 'Escape') return\n event.preventDefault()\n event.stopPropagation()\n void requestClose()\n}\n\n/** Drawer 默认拦截页面事件;内部拖拽控件只放行当前手势的 move/up。 */\nfunction handleInteractionEvent(event: Event) {\n if (!shouldAllowInteraction(event)) event.stopPropagation()\n}\n\nfunction lockBodyScroll() {\n if (!props.lockScroll || typeof document === 'undefined') return\n previousBodyOverflow = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n}\n\nfunction unlockBodyScroll() {\n if (!props.lockScroll || typeof document === 'undefined') return\n document.body.style.overflow = previousBodyOverflow\n}\n\nfunction pushChild(id: symbol) {\n if (props.push === false || pushedChildIds.value.includes(id)) return\n pushedChildIds.value = [...pushedChildIds.value, id]\n}\n\nfunction pullChild(id: symbol) {\n if (!pushedChildIds.value.includes(id)) return\n pushedChildIds.value = pushedChildIds.value.filter((childId) => childId !== id)\n}\n\nfunction pushParent() {\n if (!parentDrawer || hasPushedParent) return\n parentDrawer.push(drawerId)\n hasPushedParent = true\n}\n\nfunction pullParent() {\n if (!parentDrawer || !hasPushedParent) return\n parentDrawer.pull(drawerId)\n hasPushedParent = false\n}\n\nprovide(drawerContextKey, {\n pushDistance,\n push: pushChild,\n pull: pullChild\n})\n\nwatch(\n isVisible,\n (visible) => {\n if (visible) {\n shouldRender.value = true\n hasOpened = true\n pushParent()\n lockBodyScroll()\n emit('open')\n window.addEventListener('keydown', handleKeydown, { capture: true })\n nextTick(() => emit('opened'))\n } else {\n pullParent()\n pushedChildIds.value = []\n unlockBodyScroll()\n window.removeEventListener('keydown', handleKeydown, { capture: true })\n if (hasOpened) emit('closed')\n if (props.destroyOnClose) {\n window.setTimeout(() => {\n if (!isVisible.value) shouldRender.value = false\n }, 180)\n }\n }\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => {\n pullParent()\n unlockBodyScroll()\n window.removeEventListener('keydown', handleKeydown, { capture: true })\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <Transition name=\"ui-drawer-fade\">\n <div\n v-if=\"shouldRender\"\n v-show=\"isVisible\"\n class=\"fixed inset-0 pointer-events-auto\"\n :style=\"{ zIndex }\"\n @mousemove=\"handleInteractionEvent\"\n @mousedown=\"handleInteractionEvent\"\n @mouseup=\"handleInteractionEvent\"\n @pointermove=\"handleInteractionEvent\"\n @pointerdown=\"handleInteractionEvent\"\n @pointerup=\"handleInteractionEvent\"\n @wheel.stop\n @click.stop\n @dblclick.stop\n @contextmenu.stop\n >\n <div v-if=\"modal\" class=\"absolute inset-0 bg-zinc-900/10 backdrop-blur-sm\" @click=\"closeOnClickModal && requestClose()\"></div>\n\n <Transition :name=\"transitionName\" appear>\n <aside v-show=\"isVisible\" :class=\"['ui-drawer-panel', drawerPanel({ direction })]\" :style=\"panelStyle\" data-ui-drawer=\"true\">\n <header v-if=\"withHeader\" class=\"flex min-h-12 items-center justify-between gap-3 border-b border-zinc-100/50 px-4 py-3 dark:border-zinc-800/50\">\n <slot name=\"header\">\n <h3 class=\"min-w-0 truncate text-xs font-bold uppercase tracking-widest text-zinc-500\">\n <slot name=\"icon\"></slot>\n {{ title }}\n </h3>\n </slot>\n <button v-if=\"showClose\" type=\"button\" aria-label=\"关闭\" class=\"group flex size-7 shrink-0 items-center justify-center rounded-full transition-colors hover:bg-brand-200 dark:hover:bg-brand-500\" @click=\"requestClose\">\n <span class=\"i-lucide:x size-4 text-zinc-400 group-hover:text-brand-600 dark:group-hover:text-brand-200\"></span>\n </button>\n </header>\n\n <div class=\"min-h-0 flex-1 overflow-auto\" :class=\"bodyClass\">\n <slot v-if=\"!destroyOnClose || isVisible\"></slot>\n </div>\n\n <footer v-if=\"$slots.footer\" class=\"flex justify-end gap-2 border-t border-zinc-100/50 bg-zinc-50/30 px-3 py-2.5 dark:border-zinc-800/50 dark:bg-zinc-800/30\">\n <slot name=\"footer\"></slot>\n </footer>\n </aside>\n </Transition>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.ui-drawer-fade-enter-active,\n.ui-drawer-fade-leave-active {\n transition: opacity 160ms ease;\n}\n\n.ui-drawer-fade-enter-from,\n.ui-drawer-fade-leave-to {\n opacity: 0;\n}\n\n.ui-drawer-panel {\n transition: transform 180ms ease;\n}\n\n.ui-drawer-rtl-enter-active,\n.ui-drawer-rtl-leave-active,\n.ui-drawer-ltr-enter-active,\n.ui-drawer-ltr-leave-active,\n.ui-drawer-ttb-enter-active,\n.ui-drawer-ttb-leave-active,\n.ui-drawer-btt-enter-active,\n.ui-drawer-btt-leave-active {\n transition: transform 180ms ease;\n}\n\n.ui-drawer-rtl-enter-from,\n.ui-drawer-rtl-leave-to {\n transform: translateX(100%);\n}\n\n.ui-drawer-ltr-enter-from,\n.ui-drawer-ltr-leave-to {\n transform: translateX(-100%);\n}\n\n.ui-drawer-ttb-enter-from,\n.ui-drawer-ttb-leave-to {\n transform: translateY(-100%);\n}\n\n.ui-drawer-btt-enter-from,\n.ui-drawer-btt-leave-to {\n transform: translateY(100%);\n}\n</style>\n","import { cva } from 'class-variance-authority'\nimport type { VariantProps } from 'class-variance-authority'\nimport type { ComputedRef, InjectionKey } from 'vue'\n\nexport { default as Drawer } from './Drawer.vue'\n\n/** DrawerDirection 是抽屉弹出方向,命名兼容 Element Plus。 */\nexport type DrawerDirection = 'rtl' | 'ltr' | 'ttb' | 'btt'\n\n/** DrawerPushDistance 是多层 Drawer 推动父级抽屉的距离。 */\nexport type DrawerPushDistance = number | string\n\n/** DrawerPush 控制多层 Drawer 打开时父级抽屉是否被推动。 */\nexport type DrawerPush = boolean | { distance?: DrawerPushDistance }\n\nexport interface DrawerContext {\n pushDistance: ComputedRef<DrawerPushDistance>\n push: (id: symbol) => void\n pull: (id: symbol) => void\n}\n\nexport const drawerContextKey: InjectionKey<DrawerContext> = Symbol('ui-drawer-context')\n\n/** drawerPanel 定义 Drawer 面板基础位置和布局。 */\nexport const drawerPanel = cva('fixed z-10 flex bg-white/95 shadow-2xl backdrop-blur-md dark:bg-zinc-900/95', {\n variants: {\n direction: {\n rtl: 'inset-y-0 right-0 flex-col border-l border-white/20 dark:border-zinc-800/50',\n ltr: 'inset-y-0 left-0 flex-col border-r border-white/20 dark:border-zinc-800/50',\n ttb: 'inset-x-0 top-0 flex-col border-b border-white/20 dark:border-zinc-800/50',\n btt: 'inset-x-0 bottom-0 flex-col border-t border-white/20 dark:border-zinc-800/50'\n }\n },\n defaultVariants: {\n direction: 'rtl'\n }\n})\n\n/** DrawerProps 是 drawerPanel 变体推导出的组件属性类型。 */\nexport type DrawerProps = VariantProps<typeof drawerPanel>\n"],"mappings":";;;;;;;;;;;GASM,IAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE9B,IAAM,IAAQ,GAuDR,IAAO,GASP,IAAyB,EAA2B,GACpD,IAAY,QAAe,EAAM,cAAc,EAAM,WAAW,EAAK,GACrE,IAAe,EAAI,EAAU,KAAK,GAClC,IAAW,OAAO,WAAW,GAC7B,IAAe,EAAO,GAAkB,IAAI,GAC5C,IAAiB,EAAc,CAAC,CAAC,GACjC,IAAe,QAAe,EAAM,cAAc,SAAS,EAAM,cAAc,KAAK,GACpF,IAAi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JL,EAGK,MAHL,IAGK,CAFH,EAAyB,EAAA,QAAA,QAAA,CAAA,GAAA,KAAA,GAAA,EAAA,GAAA,EAAA,MACzB,GAAG,EAAA,KAAK,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,EAAA,GAGE,EAAA,aAAA,EAAA,GAAd,EAES,UAAA;;MAFgB,MAAK;MAAS,cAAW;MAAK,OAAM;MAAoI,SAAO;sBACtM,EAAgH,QAAA,EAA1G,OAAM,6FAA4F,GAAA,MAAA,EAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA;KAI5G,EAEM,OAAA,EAFD,OAAK,EAAA,CAAC,gCAAuC,EAAA,SAAS,CAAA,EAAA,GAAA,CAAA,CAC5C,EAAA,kBAAkB,EAAA,QAA/B,EAAiD,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,GAAA,KAAA,GAAA,EAAA,IAAA,EAAA,IAAA,EAAA,CAAA,GAAA,CAAA;KAGrCA,EAAAA,OAAO,UAAA,EAAA,GAArB,EAES,UAFT,GAES,CADP,EAA2B,EAAA,QAAA,UAAA,CAAA,GAAA,KAAA,GAAA,EAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA;gBAlBhB,EAAA,KAAS,CAAA,CAAA,CAAA,CAAA;;gCAjBlB,EAAA,KAAS,CAAA,CAAA,IAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;;;yCE3NZ,IAAgD,OAAO,mBAAmB,GAG1E,IAAc,EAAI,+EAA+E;CAC5G,UAAU,EACR,WAAW;EACT,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;CACP,EACF;CACA,iBAAiB,EACf,WAAW,MACb;AACF,CAAC"}
@@ -4,7 +4,7 @@ import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
4
  import { getUiAttrStyle as r } from "../attrs.js";
5
5
  import { getUnoUILanguageOption as i, normalizeUnoUILanguages as a, useUnoUIConfig as o } from "../config.js";
6
6
  import { t as s } from "./dropdown-B4XuqfaI.js";
7
- import { t as c } from "./modal-D6l1iIvE.js";
7
+ import { t as c } from "./modal-BqB5SsLw.js";
8
8
  import { n as l } from "./tag-BYmNsrZC.js";
9
9
  import { cva as u } from "class-variance-authority";
10
10
  import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createSlots as _, createTextVNode as v, createVNode as y, defineComponent as b, mergeProps as ee, nextTick as x, normalizeClass as S, normalizeStyle as C, onUnmounted as w, openBlock as T, ref as E, renderList as D, renderSlot as O, toDisplayString as k, unref as A, useAttrs as te, useSlots as j, useTemplateRef as M, watch as ne, withCtx as N, withModifiers as P } from "vue";
@@ -198,7 +198,7 @@ var L = {
198
198
  }, Ne = () => {
199
199
  r.disabled || r.readonly || (p.value = null, i("update:modelValue", ""), i("input", "", new Event("input")), i("clear"), we(), s.value?.focus());
200
200
  }, Pe = () => s.value?.focus(), Fe = () => s.value?.blur(), Ie = () => s.value?.select(), Le = null, Re = () => {
201
- window.removeEventListener("pointermove", Ve), window.removeEventListener("pointerup", He), window.removeEventListener("pointercancel", He);
201
+ window.removeEventListener("pointermove", Ve, !0), window.removeEventListener("pointerup", He, !0), window.removeEventListener("pointercancel", He, !0);
202
202
  }, ze = () => {
203
203
  let e = J(r.modelValue);
204
204
  return e === void 0 ? J($(s.value?.value || "")) ?? 0 : e;
@@ -229,7 +229,7 @@ var L = {
229
229
  startX: e.clientX,
230
230
  startValue: t,
231
231
  lastValue: t
232
- }, e.currentTarget?.setPointerCapture?.(e.pointerId), i("drag-start", t, e), window.addEventListener("pointermove", Ve), window.addEventListener("pointerup", He), window.addEventListener("pointercancel", He);
232
+ }, e.currentTarget?.setPointerCapture?.(e.pointerId), i("drag-start", t, e), window.addEventListener("pointermove", Ve, !0), window.addEventListener("pointerup", He, !0), window.addEventListener("pointercancel", He, !0);
233
233
  };
234
234
  return w(() => {
235
235
  Re();
@@ -357,7 +357,7 @@ var L = {
357
357
  }, [O(t.$slots, "append", {}, void 0, !0)], 2)) : m("", !0)
358
358
  ], 2), N() && y() ? (T(), h("div", ie, k(se.value) + " / " + k(e.maxlength), 1)) : m("", !0)], 64));
359
359
  }
360
- }), [["__scopeId", "data-v-6cd11edd"]]), ae = { class: "min-w-0 flex-1 truncate" }, oe = {
360
+ }), [["__scopeId", "data-v-664c2c84"]]), ae = { class: "min-w-0 flex-1 truncate" }, oe = {
361
361
  key: 0,
362
362
  class: "border-t border-medium px-3 py-3 text-center text-sm text-tertiary"
363
363
  }, G = /* @__PURE__ */ b({
@@ -1269,4 +1269,4 @@ var L = {
1269
1269
  //#endregion
1270
1270
  export { _e as a, G as c, X as i, W as l, Z as n, ge as o, ve as r, J as s, Q as t };
1271
1271
 
1272
- //# sourceMappingURL=input-FN9FbBR8.js.map
1272
+ //# sourceMappingURL=input-CiYVpf72.js.map