ropav 0.1.6 → 0.1.8

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 (310) hide show
  1. package/README.md +7 -1
  2. package/dist/accordion.css +17 -17
  3. package/dist/accordion.js +123 -155
  4. package/dist/alert.css +18 -18
  5. package/dist/alert.js +10 -11
  6. package/dist/ancestry.js +136 -0
  7. package/dist/aria.js +14 -0
  8. package/dist/aspect-ratio.js +1 -1
  9. package/dist/attributes.js +9 -0
  10. package/dist/attributes2.js +29 -0
  11. package/dist/avatar.css +19 -19
  12. package/dist/avatar.js +9 -17
  13. package/dist/badge.css +16 -16
  14. package/dist/badge.js +5 -5
  15. package/dist/button-group.js +1 -1
  16. package/dist/button-link.js +4 -3
  17. package/dist/button.js +4 -3
  18. package/dist/button.scss_vue_type_style_index_0_src_true_lang.js +1 -1
  19. package/dist/calendar.css +173 -0
  20. package/dist/calendar.js +714 -0
  21. package/dist/calendar2.js +37 -0
  22. package/dist/card.js +1 -1
  23. package/dist/checkbox.css +32 -32
  24. package/dist/checkbox.js +22 -28
  25. package/dist/chevron-left.js +12 -0
  26. package/dist/collapse.css +6 -6
  27. package/dist/collapse.js +7 -6
  28. package/dist/collectionNavigation.js +2 -99
  29. package/dist/color-input.css +19 -19
  30. package/dist/color-input.js +14 -13
  31. package/dist/color-picker.css +40 -40
  32. package/dist/color-picker.js +247 -276
  33. package/dist/color-picker2.js +1 -9
  34. package/dist/color-swatch.css +4 -4
  35. package/dist/color-swatch.js +6 -8
  36. package/dist/color.js +5 -10
  37. package/dist/combobox.css +251 -0
  38. package/dist/combobox.js +410 -0
  39. package/dist/componentColors.js +125 -84
  40. package/dist/componentRef.js +26 -0
  41. package/dist/components/accordion/accordionContext.d.ts +3 -0
  42. package/dist/components/accordion/accordionModel.d.ts +14 -0
  43. package/dist/components/accordion/index.d.ts +2 -1
  44. package/dist/components/accordion/index.js +1 -1
  45. package/dist/components/accordion/types.d.ts +1 -2
  46. package/dist/components/accordion/useAccordion.d.ts +2 -2
  47. package/dist/components/accordion/useAccordionItem.d.ts +2 -0
  48. package/dist/components/calendar/calendar.d.ts +30 -0
  49. package/dist/components/calendar/calendarBehavior.d.ts +49 -0
  50. package/dist/components/calendar/index.d.ts +3 -0
  51. package/dist/components/calendar/index.js +3 -0
  52. package/dist/components/calendar/types.d.ts +53 -0
  53. package/dist/components/calendar/useCalendar.d.ts +24 -0
  54. package/dist/components/checkbox/useCheckbox.d.ts +1 -2
  55. package/dist/components/color-picker/index.js +2 -2
  56. package/dist/components/color-picker/types.d.ts +2 -2
  57. package/dist/components/color-picker/useColorPickerDrag.d.ts +1 -1
  58. package/dist/components/color-picker/useColorPickerSaturation.d.ts +22 -0
  59. package/dist/components/color-picker/useColorPickerSlider.d.ts +20 -0
  60. package/dist/components/color-picker/useColorPickerValue.d.ts +1 -1
  61. package/dist/components/combobox/combobox.d.ts +29 -0
  62. package/dist/components/combobox/comboboxModel.d.ts +4 -0
  63. package/dist/components/combobox/index.d.ts +3 -0
  64. package/dist/components/combobox/index.js +2 -0
  65. package/dist/components/combobox/types.d.ts +43 -0
  66. package/dist/components/combobox/useCombobox.d.ts +45 -0
  67. package/dist/components/date-picker/date-picker.d.ts +33 -0
  68. package/dist/components/date-picker/datePickerModel.d.ts +10 -0
  69. package/dist/components/date-picker/index.d.ts +4 -0
  70. package/dist/components/date-picker/index.js +2 -0
  71. package/dist/components/date-picker/types.d.ts +57 -0
  72. package/dist/components/date-picker/useDatePicker.d.ts +29 -0
  73. package/dist/components/date-picker/useDatePickerValueState.d.ts +21 -0
  74. package/dist/components/dialog/{dialog-core.d.ts → dialogContext.d.ts} +1 -5
  75. package/dist/components/dialog/useDialogContentInteractions.d.ts +18 -0
  76. package/dist/components/dialog/useDialogRootState.d.ts +19 -0
  77. package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
  78. package/dist/components/dropdown-menu/dropdown-menu-item-row.d.ts +1 -1
  79. package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +1 -1
  80. package/dist/components/dropdown-menu/dropdown-menu-model.d.ts +8 -0
  81. package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +2 -2
  82. package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
  83. package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +1 -1
  84. package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +1 -1
  85. package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
  86. package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +17 -30
  87. package/dist/components/dropdown-menu/dropdownMenuDataModel.d.ts +20 -0
  88. package/dist/components/dropdown-menu/dropdownMenuInteraction.d.ts +3 -0
  89. package/dist/components/dropdown-menu/dropdownMenuInteractionNavigation.d.ts +24 -0
  90. package/dist/components/dropdown-menu/dropdownMenuInteractionRegistry.d.ts +42 -0
  91. package/dist/components/dropdown-menu/dropdownMenuInteractionTypes.d.ts +114 -0
  92. package/dist/components/dropdown-menu/useDropdownMenu.d.ts +11 -11
  93. package/dist/components/dropdown-menu/useDropdownMenuContextTrigger.d.ts +9 -0
  94. package/dist/components/dropdown-menu/useDropdownMenuDataController.d.ts +35 -0
  95. package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +24 -0
  96. package/dist/components/dropdown-menu/useDropdownMenuHoverIntent.d.ts +6 -5
  97. package/dist/components/dropdown-menu/useDropdownMenuInteractionDismissal.d.ts +17 -0
  98. package/dist/components/dropdown-menu/useDropdownMenuInteractionKeyboard.d.ts +19 -0
  99. package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +0 -1
  100. package/dist/components/dropdown-menu/useDropdownMenuPresentation.d.ts +28 -0
  101. package/dist/components/dropdown-menu/useDropdownMenuPrimitiveContent.d.ts +2 -2
  102. package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +1 -1
  103. package/dist/components/dropdown-menu/useDropdownMenuTargetBindings.d.ts +19 -0
  104. package/dist/components/dropzone/dropzone.d.ts +31 -0
  105. package/dist/components/dropzone/dropzoneModel.d.ts +16 -0
  106. package/dist/components/dropzone/index.d.ts +3 -0
  107. package/dist/components/dropzone/index.js +2 -0
  108. package/dist/components/dropzone/types.d.ts +56 -0
  109. package/dist/components/dropzone/useDropzone.d.ts +25 -0
  110. package/dist/components/file-input/file-input.d.ts +29 -0
  111. package/dist/components/file-input/index.d.ts +3 -0
  112. package/dist/components/file-input/index.js +2 -0
  113. package/dist/components/file-input/types.d.ts +37 -0
  114. package/dist/components/file-input/useFileInput.d.ts +15 -0
  115. package/dist/components/floating/index.js +2 -2
  116. package/dist/components/floating/useFloatingPosition.d.ts +1 -14
  117. package/dist/components/floating/useFloatingTargetLifecycle.d.ts +32 -0
  118. package/dist/components/floating/useHoverDisclosure.d.ts +10 -0
  119. package/dist/components/hover-card/hover-card.d.ts +25 -0
  120. package/dist/components/hover-card/index.d.ts +3 -0
  121. package/dist/components/hover-card/index.js +2 -0
  122. package/dist/components/hover-card/types.d.ts +45 -0
  123. package/dist/components/hover-card/useHoverCard.d.ts +22 -0
  124. package/dist/components/hover-card/useHoverCardDisclosure.d.ts +19 -0
  125. package/dist/components/multi-select/index.d.ts +3 -0
  126. package/dist/components/multi-select/index.js +2 -0
  127. package/dist/components/multi-select/multi-select.d.ts +30 -0
  128. package/dist/components/multi-select/multiSelectModel.d.ts +3 -0
  129. package/dist/components/multi-select/types.d.ts +49 -0
  130. package/dist/components/multi-select/useMultiSelect.d.ts +46 -0
  131. package/dist/components/number-input/numberInputModel.d.ts +15 -0
  132. package/dist/components/number-input/useNumberInput.d.ts +3 -19
  133. package/dist/components/pagination/index.d.ts +1 -1
  134. package/dist/components/pagination/index.js +1 -1
  135. package/dist/components/pagination/paginationModel.d.ts +4 -0
  136. package/dist/components/pagination/types.d.ts +15 -0
  137. package/dist/components/pagination/usePagination.d.ts +3 -19
  138. package/dist/components/popover/usePopoverBindings.d.ts +13 -0
  139. package/dist/components/progress/progressModel.d.ts +8 -0
  140. package/dist/components/progress/useProgress.d.ts +0 -6
  141. package/dist/components/radio/useRadio.d.ts +1 -2
  142. package/dist/components/scroll-area/scroll-area.d.ts +1 -1
  143. package/dist/components/scroll-area/scrollAreaModel.d.ts +64 -0
  144. package/dist/components/scroll-area/useScrollArea.d.ts +70 -53
  145. package/dist/components/scroll-area/{useScrollAreaPresentation.d.ts → useScrollAreaAttributes.d.ts} +37 -17
  146. package/dist/components/scroll-area/useScrollAreaDerivedState.d.ts +8 -0
  147. package/dist/components/scroll-area/useScrollAreaMeasurement.d.ts +35 -0
  148. package/dist/components/scroll-area/useScrollAreaPointer.d.ts +11 -9
  149. package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +15 -20
  150. package/dist/components/segmented-control/index.d.ts +3 -0
  151. package/dist/components/segmented-control/index.js +2 -0
  152. package/dist/components/segmented-control/segmented-control.d.ts +26 -0
  153. package/dist/components/segmented-control/types.d.ts +47 -0
  154. package/dist/components/segmented-control/useSegmentedControl.d.ts +15 -0
  155. package/dist/components/select/useSelect.d.ts +31 -19
  156. package/dist/components/slider/rangeSliderModel.d.ts +41 -0
  157. package/dist/components/slider/{sliderCore.d.ts → sliderModel.d.ts} +0 -1
  158. package/dist/components/slider/useRangeSlider.d.ts +9 -17
  159. package/dist/components/slider/useRangeSliderPointer.d.ts +1 -1
  160. package/dist/components/slider/useRangeSliderValueState.d.ts +40 -0
  161. package/dist/components/slider/useSlider.d.ts +7 -13
  162. package/dist/components/slider/useSliderPointerPreview.d.ts +22 -0
  163. package/dist/components/slider/useSliderTooltipState.d.ts +40 -0
  164. package/dist/components/slider/useSliderValueState.d.ts +33 -0
  165. package/dist/components/tags-input/index.d.ts +3 -0
  166. package/dist/components/tags-input/index.js +2 -0
  167. package/dist/components/tags-input/tags-input.d.ts +27 -0
  168. package/dist/components/tags-input/tagsInputModel.d.ts +12 -0
  169. package/dist/components/tags-input/types.d.ts +37 -0
  170. package/dist/components/tags-input/useTagsInput.d.ts +23 -0
  171. package/dist/components/teleport-provider/index.js +1 -1
  172. package/dist/components/teleport-provider/useTeleportTarget.d.ts +1 -2
  173. package/dist/components/toast/useToastLifecycle.d.ts +19 -0
  174. package/dist/components/tooltip/useTooltip.d.ts +1 -2
  175. package/dist/components/tooltip/useTooltipTargetBindings.d.ts +12 -0
  176. package/dist/css.js +12 -0
  177. package/dist/date-picker.css +49 -0
  178. package/dist/date-picker.js +809 -0
  179. package/dist/dialog.js +215 -218
  180. package/dist/direction.js +6 -0
  181. package/dist/dropdown-menu.css +21 -3
  182. package/dist/dropdown-menu.js +1626 -1185
  183. package/dist/dropzone.css +135 -0
  184. package/dist/dropzone.js +431 -0
  185. package/dist/events.js +59 -0
  186. package/dist/field.css +8 -8
  187. package/dist/field.js +13 -25
  188. package/dist/file-input.css +135 -0
  189. package/dist/file-input.js +198 -0
  190. package/dist/floatingOffset.js +11 -0
  191. package/dist/focus-trap.js +7 -5
  192. package/dist/focusNavigation.js +37 -0
  193. package/dist/hover-card.css +80 -0
  194. package/dist/hover-card.js +402 -0
  195. package/dist/icon-button.css +8 -8
  196. package/dist/icon-button.js +7 -6
  197. package/dist/index.d.ts +9 -0
  198. package/dist/index.js +20 -9
  199. package/dist/input.css +24 -24
  200. package/dist/input.js +19 -31
  201. package/dist/interactive.js +18 -0
  202. package/dist/internal/composables/useOverlayLayer.d.ts +12 -0
  203. package/dist/modal.js +2 -2
  204. package/dist/multi-select.css +316 -0
  205. package/dist/multi-select.js +481 -0
  206. package/dist/nativeChoice.js +169 -0
  207. package/dist/number-input.css +18 -18
  208. package/dist/number-input.js +44 -44
  209. package/dist/number.js +22 -0
  210. package/dist/overlay.js +3 -2
  211. package/dist/pagination.css +28 -28
  212. package/dist/pagination.js +66 -73
  213. package/dist/pointerSession.js +130 -0
  214. package/dist/popover.css +55 -37
  215. package/dist/popover.js +75 -101
  216. package/dist/progress.js +10 -13
  217. package/dist/query.js +40 -0
  218. package/dist/radio.css +18 -18
  219. package/dist/radio.js +30 -36
  220. package/dist/rafScheduler.js +34 -0
  221. package/dist/scroll-area.css +28 -28
  222. package/dist/scroll-area.js +540 -554
  223. package/dist/segmented-control.css +176 -0
  224. package/dist/segmented-control.js +382 -0
  225. package/dist/select.css +50 -48
  226. package/dist/select.js +131 -289
  227. package/dist/slider.css +191 -191
  228. package/dist/slider.js +720 -706
  229. package/dist/styles-api.d.ts +0 -1
  230. package/dist/styles-api.js +1 -4
  231. package/dist/switch.css +17 -17
  232. package/dist/switch.js +14 -15
  233. package/dist/tabs.css +43 -43
  234. package/dist/tabs.js +29 -56
  235. package/dist/tags-input.css +197 -0
  236. package/dist/tags-input.js +380 -0
  237. package/dist/text.js +17 -0
  238. package/dist/textarea.css +26 -26
  239. package/dist/textarea.js +21 -32
  240. package/dist/toast.css +26 -26
  241. package/dist/toast.js +141 -118
  242. package/dist/tooltip.css +12 -12
  243. package/dist/tooltip.js +64 -63
  244. package/dist/useCollapse.js +8 -11
  245. package/dist/useControlState.js +3 -6
  246. package/dist/useEditableOptionList.js +216 -0
  247. package/dist/useFlatOptionCollection.js +134 -0
  248. package/dist/useFloatingPosition.js +14 -40
  249. package/dist/useFloatingTargetLifecycle.js +127 -0
  250. package/dist/useFormControl.js +1 -0
  251. package/dist/useHoverDisclosure.js +561 -0
  252. package/dist/useNativeChoiceTransaction.js +46 -0
  253. package/dist/useNativeFileSelection.js +86 -0
  254. package/dist/useOverlayZIndex.js +246 -19
  255. package/dist/useTeleportTarget.js +3 -14
  256. package/dist/useTypeahead.js +94 -0
  257. package/dist/utils/aria.d.ts +3 -0
  258. package/dist/utils/attributes.d.ts +2 -0
  259. package/dist/utils/bem.d.ts +3 -0
  260. package/dist/utils/collectionNavigation.d.ts +2 -0
  261. package/dist/utils/color.d.ts +7 -0
  262. package/dist/{components/color-picker/color-picker-utils.d.ts → utils/colorPicker.d.ts} +5 -4
  263. package/dist/utils/componentColors.d.ts +7 -0
  264. package/dist/utils/css.d.ts +3 -0
  265. package/dist/utils/date.d.ts +13 -0
  266. package/dist/utils/dateAvailability.d.ts +7 -0
  267. package/dist/utils/dom/ancestry.d.ts +8 -0
  268. package/dist/utils/dom/attributes.d.ts +16 -0
  269. package/dist/utils/dom/componentRef.d.ts +4 -0
  270. package/dist/utils/dom/direction.d.ts +2 -0
  271. package/dist/utils/dom/events.d.ts +5 -0
  272. package/dist/utils/dom/files.d.ts +3 -0
  273. package/dist/utils/dom/focusNavigation.d.ts +7 -0
  274. package/dist/utils/dom/interactive.d.ts +2 -0
  275. package/dist/utils/dom/nativeChoice.d.ts +17 -0
  276. package/dist/utils/dom/pointerSession.d.ts +20 -0
  277. package/dist/utils/dom/query.d.ts +4 -0
  278. package/dist/utils/dom/scroll.d.ts +24 -0
  279. package/dist/utils/floatingOffset.d.ts +10 -0
  280. package/dist/utils/geometry.d.ts +14 -0
  281. package/dist/utils/indexPath.d.ts +6 -0
  282. package/dist/utils/number.d.ts +4 -0
  283. package/dist/utils/optionFilter.d.ts +5 -0
  284. package/dist/utils/rafScheduler.d.ts +4 -0
  285. package/dist/utils/text.d.ts +2 -0
  286. package/docs/code-architecture.md +118 -0
  287. package/docs/public-floating-api.md +13 -9
  288. package/docs/public-styles-api.md +25 -12
  289. package/package.json +51 -14
  290. package/src/styles/_mixins.scss +26 -0
  291. package/src/styles/styles-manifest.json +1 -2
  292. package/dist/components/dropdown-menu/dropdown-menu-outside.d.ts +0 -3
  293. package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +0 -21
  294. package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +0 -36
  295. package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +0 -29
  296. package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +0 -52
  297. package/dist/components/dropdown-menu/useDropdownMenuNavigation.d.ts +0 -17
  298. package/dist/components/dropdown-menu/useDropdownSubmenus.d.ts +0 -18
  299. package/dist/components/scroll-area/scrollAreaCore.d.ts +0 -30
  300. package/dist/components/scroll-area/useScrollAreaControls.d.ts +0 -25
  301. package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +0 -38
  302. package/dist/components/select/useSelectNativeControl.d.ts +0 -9
  303. package/dist/components/select/useSelectNativeValue.d.ts +0 -9
  304. package/dist/floating.js +0 -415
  305. /package/dist/components/alert/{useAlertColor.d.ts → alertColor.d.ts} +0 -0
  306. /package/dist/components/avatar/{useAvatarColor.d.ts → avatarColor.d.ts} +0 -0
  307. /package/dist/components/badge/{useBadgeColor.d.ts → badgeColor.d.ts} +0 -0
  308. /package/dist/components/button/{useButtonColor.d.ts → buttonColor.d.ts} +0 -0
  309. /package/dist/components/color-swatch/{useColorSwatchColor.d.ts → colorSwatchColor.d.ts} +0 -0
  310. /package/dist/components/toast/{useToastColor.d.ts → toastColor.d.ts} +0 -0
@@ -1,14 +1,25 @@
1
1
  import './color-picker.css';
2
- import { n as useStylesApi, t as presence } from "./styles-api.js";
2
+ import { t as useStylesApi } from "./styles-api.js";
3
+ import { n as toPresenceAttribute } from "./attributes.js";
3
4
  import { t as bem } from "./bem.js";
4
5
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
6
+ import { i as roundTo, t as clamp } from "./number.js";
5
7
  import { t as parseCssColor } from "./color.js";
6
8
  import { t as check_default } from "./check.js";
7
9
  import { t as color_swatch_default } from "./color-swatch.js";
8
- import { child, computed, createComponent, createFor, createIf, createInvoker, createSlot, createTemplateRefSetter, defineVaporComponent, delegateEvents, extend, next, nthChild, on, onBeforeUnmount, ref, renderEffect, setAttr, setClass, setDynamicProps, setInsertionState, setProp, setStyle, setValue, template, unref } from "vue";
9
- function clamp(value, min, max) {
10
- return Math.min(max, Math.max(min, value));
11
- }
10
+ import { n as toHTMLElement } from "./componentRef.js";
11
+ import { t as createPointerSession } from "./pointerSession.js";
12
+ import { i as isNodeWithinElement } from "./events.js";
13
+ import { child, computed, createComponent, createFor, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, next, nthChild, on, onBeforeUnmount, ref, renderEffect, setAttr, setClass, setDynamicProps, setInsertionState, setProp, setStyle, setTemplateRefBinding, setValue, template, unref } from "vue";
14
+ //#region src/utils/colorPicker.ts
15
+ var colorPickerFormats = [
16
+ "hex",
17
+ "hexa",
18
+ "rgb",
19
+ "rgba",
20
+ "hsl",
21
+ "hsla"
22
+ ];
12
23
  function clampPercent(value) {
13
24
  return clamp(Number.isFinite(value) ? value : 0, 0, 100);
14
25
  }
@@ -27,7 +38,18 @@ function clampOpacity(value) {
27
38
  return clamp(Number.isFinite(value) ? value : 100, 0, 100);
28
39
  }
29
40
  function roundPercent(value) {
30
- return Math.round(value * 100) / 100;
41
+ return roundTo(value);
42
+ }
43
+ function getColorPickerKeyboardValue(key, currentValue, maxValue, step = 1) {
44
+ switch (key) {
45
+ case "ArrowRight":
46
+ case "ArrowUp": return currentValue + step;
47
+ case "ArrowLeft":
48
+ case "ArrowDown": return currentValue - step;
49
+ case "Home": return 0;
50
+ case "End": return maxValue;
51
+ default: return;
52
+ }
31
53
  }
32
54
  function isColorPickerAlphaFormat(format) {
33
55
  return format === "hexa" || format === "rgba" || format === "hsla";
@@ -142,127 +164,129 @@ function formatAlpha(opacity) {
142
164
  return formatNumber(clampOpacity(opacity) / 100);
143
165
  }
144
166
  function formatNumber(value) {
145
- return String(Math.round(value * 100) / 100);
167
+ return String(roundTo(value));
146
168
  }
147
169
  //#endregion
148
170
  //#region src/components/color-picker/useColorPickerDrag.ts
149
- function getPointerId(event) {
150
- return Number.isFinite(event.pointerId) ? event.pointerId : void 0;
151
- }
152
171
  function useColorPickerDrag({ target, focusTarget, readonly, isGeometryValid, updateFromPointer }) {
153
- let session;
154
- let frameWindow = null;
155
- let frameId;
156
- let geometryDirty = false;
157
- let pendingPointer;
158
- function isCurrentPointer(event) {
159
- const currentSession = session;
160
- if (!currentSession) return false;
161
- const pointerId = getPointerId(event);
162
- return currentSession.pointerId === void 0 || pointerId === currentSession.pointerId;
163
- }
164
- function cancelScheduledFrame() {
165
- if (frameId !== void 0) frameWindow?.cancelAnimationFrame(frameId);
166
- frameWindow = null;
167
- frameId = void 0;
168
- }
169
- function applyScheduledUpdate(currentSession) {
170
- if (session !== currentSession) return;
171
- if (geometryDirty) {
172
- const rect = currentSession.element.getBoundingClientRect();
173
- if (!isGeometryValid(rect)) return;
174
- currentSession.rect = rect;
175
- geometryDirty = false;
176
- }
177
- const pointer = pendingPointer;
178
- pendingPointer = void 0;
179
- if (pointer) updateFromPointer(pointer, currentSession.rect);
180
- }
181
- function flushScheduledUpdate() {
182
- const currentSession = session;
183
- cancelScheduledFrame();
184
- if (currentSession) applyScheduledUpdate(currentSession);
185
- }
186
- function scheduleUpdate() {
187
- const currentSession = session;
188
- if (!currentSession) return;
189
- const view = currentSession.view;
190
- if (!view?.requestAnimationFrame) {
191
- applyScheduledUpdate(currentSession);
192
- return;
193
- }
194
- if (frameId !== void 0) return;
195
- frameWindow = view;
196
- frameId = view.requestAnimationFrame(() => {
197
- frameWindow = null;
198
- frameId = void 0;
199
- applyScheduledUpdate(currentSession);
200
- });
172
+ function refreshGeometry(currentSession) {
173
+ const rect = currentSession.element.getBoundingClientRect();
174
+ if (!isGeometryValid(rect)) return false;
175
+ currentSession.geometryValid = true;
176
+ currentSession.rect = rect;
177
+ return true;
201
178
  }
202
- function onGeometryChange() {
203
- if (!session) return;
204
- geometryDirty = true;
205
- scheduleUpdate();
206
- }
207
- function stopDragging() {
208
- const stoppedSession = session;
209
- if (!stoppedSession) return;
210
- stoppedSession.view?.removeEventListener("pointermove", onPointerMove);
211
- stoppedSession.view?.removeEventListener("pointerup", onPointerEnd);
212
- stoppedSession.view?.removeEventListener("pointercancel", onPointerEnd);
213
- stoppedSession.view?.removeEventListener("resize", onGeometryChange);
214
- stoppedSession.view?.removeEventListener("scroll", onGeometryChange, true);
215
- cancelScheduledFrame();
216
- geometryDirty = false;
217
- pendingPointer = void 0;
218
- session = void 0;
219
- }
220
- function onPointerMove(event) {
221
- if (!isCurrentPointer(event)) return;
222
- pendingPointer = {
179
+ function applyPointer(event, currentSession) {
180
+ updateFromPointer({
223
181
  clientX: event.clientX,
224
182
  clientY: event.clientY
183
+ }, currentSession.rect);
184
+ }
185
+ const pointerSession = createPointerSession({
186
+ onStart(event, currentSession) {
187
+ if (currentSession.geometryValid) applyPointer(event, currentSession);
188
+ },
189
+ onUpdate: applyPointer,
190
+ refreshGeometry
191
+ });
192
+ function onPointerDown(event) {
193
+ return pointerSession.start(event, () => {
194
+ if (readonly()) return;
195
+ const element = target.value;
196
+ if (!element) return;
197
+ event.preventDefault();
198
+ (focusTarget?.value ?? element).focus();
199
+ const rect = element.getBoundingClientRect();
200
+ const geometryValid = isGeometryValid(rect);
201
+ return {
202
+ geometryDirty: !geometryValid,
203
+ state: {
204
+ element,
205
+ geometryValid,
206
+ rect
207
+ },
208
+ target: element
209
+ };
210
+ });
211
+ }
212
+ onBeforeUnmount(pointerSession.stop);
213
+ return { onPointerDown };
214
+ }
215
+ //#endregion
216
+ //#region src/components/color-picker/useColorPickerSaturation.ts
217
+ function useColorPickerSaturation({ modelValue, hue, readonly, onChange }) {
218
+ const saturationRef = ref(null);
219
+ const saturationInputRef = ref(null);
220
+ const selection = computed(() => {
221
+ const currentSelection = modelValue();
222
+ return {
223
+ saturation: clampPercent(currentSelection.saturation),
224
+ value: clampPercent(currentSelection.value)
225
225
  };
226
- scheduleUpdate();
226
+ });
227
+ const normalizedHue = computed(() => normalizeHue(hue()));
228
+ function setSaturationElement(value) {
229
+ saturationRef.value = toHTMLElement(value);
227
230
  }
228
- function onPointerEnd(event) {
229
- if (!isCurrentPointer(event)) return;
230
- if (event.type === "pointerup") flushScheduledUpdate();
231
- stopDragging();
231
+ function setSaturationInput(value) {
232
+ saturationInputRef.value = toHTMLElement(value);
232
233
  }
233
- function onPointerDown(event) {
234
- if (readonly() || event.button !== 0 || event.isPrimary === false) return;
235
- const el = target.value;
236
- if (!el) return;
237
- event.preventDefault();
238
- (focusTarget?.value ?? el).focus();
239
- stopDragging();
240
- const nextSession = {
241
- element: el,
242
- pointerId: getPointerId(event),
243
- rect: el.getBoundingClientRect(),
244
- view: el.ownerDocument.defaultView
234
+ function commitSelection(nextSaturation, nextValue) {
235
+ if (readonly()) return;
236
+ const nextSelection = {
237
+ saturation: roundPercent(clampPercent(nextSaturation)),
238
+ value: roundPercent(clampPercent(nextValue))
245
239
  };
246
- session = nextSession;
247
- geometryDirty = !isGeometryValid(nextSession.rect);
248
- if (!geometryDirty) updateFromPointer({
249
- clientX: event.clientX,
250
- clientY: event.clientY
251
- }, nextSession.rect);
252
- if (session !== nextSession) return;
253
- nextSession.view?.addEventListener("pointermove", onPointerMove);
254
- nextSession.view?.addEventListener("pointerup", onPointerEnd);
255
- nextSession.view?.addEventListener("pointercancel", onPointerEnd);
256
- nextSession.view?.addEventListener("resize", onGeometryChange);
257
- nextSession.view?.addEventListener("scroll", onGeometryChange, true);
258
- }
259
- onBeforeUnmount(stopDragging);
260
- return { onPointerDown };
240
+ if (nextSelection.saturation === selection.value.saturation && nextSelection.value === selection.value.value) return;
241
+ onChange(nextSelection);
242
+ }
243
+ function updateAxis(axis, nextValue) {
244
+ if (axis === "saturation") {
245
+ commitSelection(nextValue, selection.value.value);
246
+ return;
247
+ }
248
+ commitSelection(selection.value.saturation, nextValue);
249
+ }
250
+ function onAxisKeydown(event, axis) {
251
+ const currentValue = axis === "saturation" ? selection.value.saturation : selection.value.value;
252
+ const nextValue = getColorPickerKeyboardValue(event.key, currentValue, 100, event.shiftKey ? 10 : void 0);
253
+ if (nextValue === void 0) return;
254
+ event.preventDefault();
255
+ if (!readonly()) updateAxis(axis, nextValue);
256
+ }
257
+ function onAxisInput(event, axis) {
258
+ const input = event.currentTarget;
259
+ if (!(input instanceof HTMLInputElement)) return;
260
+ if (readonly()) {
261
+ input.value = String(axis === "saturation" ? selection.value.saturation : selection.value.value);
262
+ return;
263
+ }
264
+ updateAxis(axis, Number(input.value));
265
+ }
266
+ function updateFromTwoDimensionalPointer(pointer, rect) {
267
+ if (rect.width <= 0 || rect.height <= 0) return;
268
+ commitSelection((pointer.clientX - rect.left) / rect.width * 100, 100 - (pointer.clientY - rect.top) / rect.height * 100);
269
+ }
270
+ const { onPointerDown } = useColorPickerDrag({
271
+ target: saturationRef,
272
+ focusTarget: saturationInputRef,
273
+ readonly,
274
+ isGeometryValid: (rect) => rect.width > 0 && rect.height > 0,
275
+ updateFromPointer: updateFromTwoDimensionalPointer
276
+ });
277
+ return {
278
+ setSaturationElement,
279
+ setSaturationInput,
280
+ selection,
281
+ normalizedHue,
282
+ onPointerDown,
283
+ onAxisKeydown,
284
+ onAxisInput
285
+ };
261
286
  }
262
287
  //#endregion
263
288
  //#region src/components/color-picker/color-picker-saturation.vue?vue&type=script&setup=true&vapor=true&lang.ts
264
- var t0$2 = template("<div data-v-22669f8e role=group data-control=saturation><input data-v-22669f8e class=\"rp-color-picker__axis-input rp-color-picker__axis-input--saturation\"type=range min=0 max=100 step=1 aria-label=Saturation aria-orientation=horizontal><input data-v-22669f8e class=\"rp-color-picker__axis-input rp-color-picker__axis-input--value\"type=range min=0 max=100 step=1 aria-label=Value aria-orientation=vertical><span data-v-22669f8e class=rp-color-picker__surface aria-hidden=true></span><span data-v-22669f8e data-control=saturation aria-hidden=true>", 1);
265
- delegateEvents("input", "keydown", "pointerdown");
289
+ var t0$2 = template("<div data-v-9c7fa05b role=group data-control=saturation><input data-v-9c7fa05b class=\"rp-color-picker__axis-input rp-color-picker__axis-input--saturation\"type=range min=0 max=100 step=1 aria-label=Saturation aria-orientation=horizontal><input data-v-9c7fa05b class=\"rp-color-picker__axis-input rp-color-picker__axis-input--value\"type=range min=0 max=100 step=1 aria-label=Value aria-orientation=vertical><span data-v-9c7fa05b class=rp-color-picker__surface aria-hidden=true></span><span data-v-9c7fa05b data-control=saturation aria-hidden=true>", 1);
266
290
  //#endregion
267
291
  //#region src/components/color-picker/color-picker-saturation.vue
268
292
  var color_picker_saturation_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
@@ -312,124 +336,115 @@ var color_picker_saturation_default = /*#__PURE__*/ _plugin_vue_export_helper_de
312
336
  setup(__props, { emit: __emit }) {
313
337
  const props = __props;
314
338
  const emit = __emit;
315
- const saturationRef = ref(null);
316
- const saturationInputRef = ref(null);
317
- const saturation = computed(() => clampPercent(props.modelValue.saturation));
318
- const value = computed(() => clampPercent(props.modelValue.value));
319
- const hue = computed(() => normalizeHue(props.hue));
339
+ const { setSaturationElement, setSaturationInput, selection, normalizedHue, onPointerDown, onAxisKeydown, onAxisInput } = useColorPickerSaturation({
340
+ modelValue: () => props.modelValue,
341
+ hue: () => props.hue,
342
+ readonly: () => props.readonly,
343
+ onChange: (nextSelection) => emit("update:modelValue", nextSelection)
344
+ });
320
345
  const saturationStyle = computed(() => ({
321
- "--_rp-color-picker-hue": String(normalizeHueForColor(hue.value)),
322
- "--_rp-color-picker-saturation-x": `${saturation.value}%`,
323
- "--_rp-color-picker-saturation-y": `${100 - value.value}%`,
324
- "--_rp-color-picker-current": getHsvCssColor(hue.value, saturation.value, value.value)
346
+ "--_rp-color-picker-hue": String(normalizeHueForColor(normalizedHue.value)),
347
+ "--_rp-color-picker-saturation-x": `${selection.value.saturation}%`,
348
+ "--_rp-color-picker-saturation-y": `${100 - selection.value.value}%`,
349
+ "--_rp-color-picker-current": getHsvCssColor(normalizedHue.value, selection.value.saturation, selection.value.value)
325
350
  }));
326
- const ariaValueText = computed(() => `${Math.round(saturation.value)}% saturation, ${Math.round(value.value)}% value`);
351
+ const ariaValueText = computed(() => `${Math.round(selection.value.saturation)}% saturation, ${Math.round(selection.value.value)}% value`);
327
352
  const groupAriaLabel = computed(() => props.labelledby ? void 0 : props.ariaLabel || "Color area");
328
- function updateValue(nextSaturation, nextValue) {
329
- if (props.readonly) return;
330
- const normalizedSaturation = roundPercent(clampPercent(nextSaturation));
331
- const normalizedValue = roundPercent(clampPercent(nextValue));
332
- if (normalizedSaturation === saturation.value && normalizedValue === value.value) return;
333
- emit("update:modelValue", {
334
- saturation: normalizedSaturation,
335
- value: normalizedValue
336
- });
337
- }
338
- function updateFromPointer(e, rect) {
339
- if (rect.width <= 0 || rect.height <= 0) return;
340
- updateValue((e.clientX - rect.left) / rect.width * 100, 100 - (e.clientY - rect.top) / rect.height * 100);
341
- }
342
- const { onPointerDown } = useColorPickerDrag({
343
- target: saturationRef,
344
- focusTarget: saturationInputRef,
345
- readonly: () => props.readonly,
346
- isGeometryValid: (rect) => rect.width > 0 && rect.height > 0,
347
- updateFromPointer
348
- });
349
- function onAxisKeydown(event, axis) {
350
- const currentValue = axis === "saturation" ? saturation.value : value.value;
351
- const step = event.shiftKey ? 10 : 1;
352
- let nextValue;
353
- switch (event.key) {
354
- case "ArrowRight":
355
- case "ArrowUp":
356
- nextValue = currentValue + step;
357
- break;
358
- case "ArrowLeft":
359
- case "ArrowDown":
360
- nextValue = currentValue - step;
361
- break;
362
- case "Home":
363
- nextValue = 0;
364
- break;
365
- case "End":
366
- nextValue = 100;
367
- break;
368
- }
369
- if (nextValue === void 0) return;
370
- event.preventDefault();
371
- if (!props.readonly) updateAxis(axis, nextValue);
372
- }
373
- function onAxisInput(event, axis) {
374
- const input = event.currentTarget;
375
- if (!(input instanceof HTMLInputElement)) return;
376
- if (props.readonly) {
377
- input.value = String(axis === "saturation" ? saturation.value : value.value);
378
- return;
379
- }
380
- updateAxis(axis, Number(input.value));
381
- }
382
- function updateAxis(axis, nextValue) {
383
- if (axis === "saturation") updateValue(nextValue, value.value);
384
- else updateValue(saturation.value, nextValue);
385
- }
386
353
  const _setTemplateRef = createTemplateRefSetter();
387
354
  const n3 = t0$2();
388
355
  const n0 = child(n3);
389
356
  const n1 = next(n0, 1);
390
357
  const n2 = nthChild(n3, 3);
391
- n0.$evtinput = createInvoker(($event) => onAxisInput($event, "saturation"));
392
- n0.$evtkeydown = createInvoker(($event) => onAxisKeydown($event, "saturation"));
393
- _setTemplateRef(n0, saturationInputRef, null, "saturationInputRef");
394
- n1.$evtinput = createInvoker(($event) => onAxisInput($event, "value"));
395
- n1.$evtkeydown = createInvoker(($event) => onAxisKeydown($event, "value"));
396
- n3.$evtpointerdown = createInvoker((e) => unref(onPointerDown)(e));
397
- _setTemplateRef(n3, saturationRef, null, "saturationRef");
358
+ on(n0, "input", ($event) => unref(onAxisInput)($event, "saturation"));
359
+ on(n0, "keydown", ($event) => unref(onAxisKeydown)($event, "saturation"));
360
+ on(n1, "input", ($event) => unref(onAxisInput)($event, "value"));
361
+ on(n1, "keydown", ($event) => unref(onAxisKeydown)($event, "value"));
362
+ on(n3, "pointerdown", (e) => unref(onPointerDown)(e));
398
363
  renderEffect(() => {
399
364
  const _describedby = __props.describedby;
400
365
  const _readonly = __props.readonly;
401
366
  const _id = __props.id;
402
- const _saturation = saturation.value;
367
+ const _selection = unref(selection);
403
368
  const _ariaValueText = ariaValueText.value;
404
- const _value = value.value;
405
369
  setClass(n3, ["rp-color-picker__saturation", __props.controlClass]);
406
370
  setStyle(n3, [saturationStyle.value, __props.controlStyle]);
407
371
  setAttr(n3, "aria-label", groupAriaLabel.value);
408
372
  setAttr(n3, "aria-labelledby", __props.labelledby);
409
373
  setAttr(n3, "aria-describedby", _describedby);
410
- setAttr(n3, "data-readonly", unref(presence)(_readonly));
374
+ setAttr(n3, "data-readonly", unref(toPresenceAttribute)(_readonly));
411
375
  setProp(n0, "id", _id);
412
- setValue(n0, _saturation);
413
- setAttr(n0, "aria-valuenow", Math.round(_saturation));
376
+ setValue(n0, _selection.saturation);
377
+ setAttr(n0, "aria-valuenow", Math.round(_selection.saturation));
414
378
  setAttr(n0, "aria-valuetext", _ariaValueText);
415
379
  setAttr(n0, "aria-describedby", _describedby);
416
380
  setAttr(n0, "aria-readonly", _readonly || void 0);
381
+ _setTemplateRef(n0, setSaturationInput, null, "setSaturationInput");
417
382
  setProp(n1, "id", _id ? `${_id}-value` : void 0);
418
- setValue(n1, _value);
419
- setAttr(n1, "aria-valuenow", Math.round(_value));
383
+ setValue(n1, _selection.value);
384
+ setAttr(n1, "aria-valuenow", Math.round(_selection.value));
420
385
  setAttr(n1, "aria-valuetext", _ariaValueText);
421
386
  setAttr(n1, "aria-describedby", _describedby);
422
387
  setAttr(n1, "aria-readonly", _readonly || void 0);
423
388
  setClass(n2, ["rp-color-picker__handle", __props.handleClass]);
424
389
  setStyle(n2, __props.handleStyle);
390
+ _setTemplateRef(n3, setSaturationElement, null, "setSaturationElement");
425
391
  });
426
392
  return n3;
427
393
  }
428
- }), [["__scopeId", "data-v-22669f8e"]]);
394
+ }), [["__scopeId", "data-v-9c7fa05b"]]);
395
+ //#endregion
396
+ //#region src/components/color-picker/useColorPickerSlider.ts
397
+ function useColorPickerSlider({ variant, value, readonly, onChange }) {
398
+ const sliderRef = ref(null);
399
+ const sliderState = computed(() => {
400
+ const isHue = variant() === "hue";
401
+ const normalizedValue = isHue ? normalizeHue(value()) : clampOpacity(value());
402
+ return {
403
+ isHue,
404
+ max: isHue ? 359 : 100,
405
+ value: normalizedValue,
406
+ outputValue: normalizeOutputValue(normalizedValue, isHue)
407
+ };
408
+ });
409
+ function setSliderElement(element) {
410
+ sliderRef.value = toHTMLElement(element);
411
+ }
412
+ function commitValue(nextValue) {
413
+ if (readonly()) return;
414
+ const normalizedNextValue = normalizeOutputValue(nextValue, sliderState.value.isHue);
415
+ if (normalizedNextValue === sliderState.value.outputValue) return;
416
+ onChange(normalizedNextValue);
417
+ }
418
+ function updateFromHorizontalPointer(pointer, rect) {
419
+ if (rect.width <= 0) return;
420
+ commitValue((pointer.clientX - rect.left) / rect.width * sliderState.value.max);
421
+ }
422
+ const { onPointerDown } = useColorPickerDrag({
423
+ target: sliderRef,
424
+ readonly,
425
+ isGeometryValid: (rect) => rect.width > 0,
426
+ updateFromPointer: updateFromHorizontalPointer
427
+ });
428
+ function onKeydown(event) {
429
+ if (readonly()) return;
430
+ const nextValue = getColorPickerKeyboardValue(event.key, sliderState.value.value, sliderState.value.max, event.shiftKey ? 10 : void 0);
431
+ if (nextValue === void 0) return;
432
+ event.preventDefault();
433
+ commitValue(nextValue);
434
+ }
435
+ return {
436
+ setSliderElement,
437
+ sliderState,
438
+ onPointerDown,
439
+ onKeydown
440
+ };
441
+ }
442
+ function normalizeOutputValue(nextValue, isHue) {
443
+ return isHue ? Math.round(clampHue(nextValue)) : roundPercent(clampOpacity(nextValue));
444
+ }
429
445
  //#endregion
430
446
  //#region src/components/color-picker/color-picker-slider.vue?vue&type=script&setup=true&vapor=true&lang.ts
431
- var t0$1 = template("<div data-v-0299a505 role=slider tabindex=0 aria-orientation=horizontal aria-valuemin=0><span data-v-0299a505 aria-hidden=true></span><span data-v-0299a505 aria-hidden=true>", 1);
432
- delegateEvents("pointerdown", "keydown");
447
+ var t0$1 = template("<div data-v-3a0ac9e0 role=slider tabindex=0 aria-orientation=horizontal aria-valuemin=0><span data-v-3a0ac9e0 aria-hidden=true></span><span data-v-3a0ac9e0 aria-hidden=true>", 1);
433
448
  //#endregion
434
449
  //#region src/components/color-picker/color-picker-slider.vue
435
450
  var color_picker_slider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
@@ -476,92 +491,51 @@ var color_picker_slider_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
476
491
  setup(__props, { emit: __emit }) {
477
492
  const props = __props;
478
493
  const emit = __emit;
479
- const sliderRef = ref(null);
480
- const isHue = computed(() => props.variant === "hue");
481
- const max = computed(() => isHue.value ? 359 : 100);
494
+ const { setSliderElement, sliderState, onPointerDown, onKeydown } = useColorPickerSlider({
495
+ variant: () => props.variant,
496
+ value: () => props.value,
497
+ readonly: () => props.readonly,
498
+ onChange: (value) => emit("update:value", value)
499
+ });
482
500
  const rootClass = computed(() => `rp-color-picker__${props.variant}`);
483
501
  const surfaceClass = computed(() => ["rp-color-picker__slider-surface", `rp-color-picker__${props.variant}-surface`]);
484
502
  const internalHandleClass = computed(() => ["rp-color-picker__slider-handle", `rp-color-picker__${props.variant}-handle`]);
485
- const normalizedValue = computed(() => isHue.value ? normalizeHue(props.value) : clampOpacity(props.value));
486
- const currentOutputValue = computed(() => normalizeOutputValue(normalizedValue.value));
487
503
  const sliderStyle = computed(() => {
488
- const style = { "--_rp-color-picker-slider-x": `${currentOutputValue.value / max.value * 100}%` };
489
- if (isHue.value) style["--_rp-color-picker-hue"] = String(normalizeHueForColor(currentOutputValue.value));
504
+ const style = { "--_rp-color-picker-slider-x": `${sliderState.value.outputValue / sliderState.value.max * 100}%` };
505
+ if (sliderState.value.isHue) style["--_rp-color-picker-hue"] = String(normalizeHueForColor(sliderState.value.outputValue));
490
506
  else style["--_rp-color-picker-opacity-color"] = props.color;
491
507
  return style;
492
508
  });
493
- const ariaLabel = computed(() => isHue.value ? "Hue" : "Opacity");
494
- const ariaValueText = computed(() => isHue.value ? `${Math.round(normalizedValue.value)} degrees hue` : `${Math.round(normalizedValue.value)}% opacity`);
495
- function updateValue(nextValue) {
496
- if (props.readonly) return;
497
- const normalizedNextValue = normalizeOutputValue(nextValue);
498
- if (normalizedNextValue === currentOutputValue.value) return;
499
- emit("update:value", normalizedNextValue);
500
- }
501
- function updateFromPointer(e, rect) {
502
- if (rect.width <= 0) return;
503
- updateValue((e.clientX - rect.left) / rect.width * max.value);
504
- }
505
- const { onPointerDown } = useColorPickerDrag({
506
- target: sliderRef,
507
- readonly: () => props.readonly,
508
- isGeometryValid: (rect) => rect.width > 0,
509
- updateFromPointer
510
- });
511
- function onKeydown(e) {
512
- if (props.readonly) return;
513
- const step = e.shiftKey ? 10 : 1;
514
- switch (e.key) {
515
- case "ArrowRight":
516
- case "ArrowUp":
517
- e.preventDefault();
518
- updateValue(normalizedValue.value + step);
519
- break;
520
- case "ArrowLeft":
521
- case "ArrowDown":
522
- e.preventDefault();
523
- updateValue(normalizedValue.value - step);
524
- break;
525
- case "Home":
526
- e.preventDefault();
527
- updateValue(0);
528
- break;
529
- case "End":
530
- e.preventDefault();
531
- updateValue(max.value);
532
- break;
533
- }
534
- }
535
- function normalizeOutputValue(value) {
536
- return isHue.value ? Math.round(clampHue(value)) : roundPercent(clampOpacity(value));
537
- }
509
+ const ariaLabel = computed(() => sliderState.value.isHue ? "Hue" : "Opacity");
510
+ const ariaValueText = computed(() => sliderState.value.isHue ? `${Math.round(sliderState.value.value)} degrees hue` : `${Math.round(sliderState.value.value)}% opacity`);
538
511
  const _setTemplateRef = createTemplateRefSetter();
539
512
  const n2 = t0$1();
540
513
  const n0 = child(n2);
541
514
  const n1 = next(n0, 1);
542
- n2.$evtpointerdown = createInvoker((e) => unref(onPointerDown)(e));
543
- n2.$evtkeydown = createInvoker(onKeydown);
544
- _setTemplateRef(n2, sliderRef, null, "sliderRef");
515
+ on(n2, "pointerdown", (e) => unref(onPointerDown)(e));
516
+ on(n2, "keydown", (e) => unref(onKeydown)(e));
545
517
  renderEffect(() => {
518
+ const _sliderState = unref(sliderState);
546
519
  const _readonly = __props.readonly;
547
520
  const _variant = __props.variant;
548
521
  setClass(n2, [rootClass.value, __props.controlClass]);
549
522
  setStyle(n2, [sliderStyle.value, __props.controlStyle]);
550
523
  setAttr(n2, "aria-label", ariaLabel.value);
551
- setAttr(n2, "aria-valuemax", max.value);
552
- setAttr(n2, "aria-valuenow", Math.round(normalizedValue.value));
524
+ setAttr(n2, "aria-valuemax", _sliderState.max);
525
+ setAttr(n2, "aria-valuenow", Math.round(_sliderState.value));
553
526
  setAttr(n2, "aria-valuetext", ariaValueText.value);
554
527
  setAttr(n2, "aria-readonly", _readonly || void 0);
555
- setAttr(n2, "data-readonly", unref(presence)(_readonly));
528
+ setAttr(n2, "data-readonly", unref(toPresenceAttribute)(_readonly));
556
529
  setAttr(n2, "data-control", _variant);
557
530
  setClass(n0, surfaceClass.value);
558
531
  setClass(n1, [internalHandleClass.value, __props.handleClass]);
559
532
  setStyle(n1, __props.handleStyle);
560
533
  setAttr(n1, "data-control", _variant);
534
+ _setTemplateRef(n2, setSliderElement, null, "setSliderElement");
561
535
  });
562
536
  return n2;
563
537
  }
564
- }), [["__scopeId", "data-v-0299a505"]]);
538
+ }), [["__scopeId", "data-v-3a0ac9e0"]]);
565
539
  //#endregion
566
540
  //#region src/components/color-picker/useColorPickerSwatches.ts
567
541
  var MAX_SWATCHES_PER_ROW = 15;
@@ -595,9 +569,7 @@ function useColorPickerSwatches(props, options) {
595
569
  focusedSwatchIndex.value = index;
596
570
  }
597
571
  function onSwatchesFocusout(event) {
598
- const group = event.currentTarget;
599
- const nextTarget = event.relatedTarget;
600
- if (group instanceof HTMLElement && nextTarget instanceof Node && group.contains(nextTarget)) return;
572
+ if (isNodeWithinElement(event.relatedTarget, event.currentTarget)) return;
601
573
  focusedSwatchIndex.value = null;
602
574
  }
603
575
  function onSwatchKeydown(event, index) {
@@ -720,11 +692,10 @@ function getComparableColor(color) {
720
692
  }
721
693
  //#endregion
722
694
  //#region src/components/color-picker/color-picker.vue?vue&type=script&setup=true&vapor=true&lang.ts
723
- var t0 = template("<div data-v-41c4ca07 class=rp-color-picker__header><span data-v-41c4ca07>");
724
- var t1 = template("<button data-v-41c4ca07>");
725
- var t2 = template("<div data-v-41c4ca07>");
726
- var t3 = template("<div data-v-41c4ca07>", 1);
727
- delegateEvents("click", "keydown", "focusout");
695
+ var t0 = template("<div data-v-7fe38e4e class=rp-color-picker__header><span data-v-7fe38e4e>");
696
+ var t1 = template("<button data-v-7fe38e4e>");
697
+ var t2 = template("<div data-v-7fe38e4e>");
698
+ var t3 = template("<div data-v-7fe38e4e>", 1);
728
699
  //#endregion
729
700
  //#region src/components/color-picker/color-picker.vue
730
701
  var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
@@ -763,14 +734,14 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
763
734
  const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
764
735
  const rootAttrs = computed(() => getRootAttrs({
765
736
  class: rootClass.value,
766
- "data-readonly": presence(props.readonly)
737
+ "data-readonly": toPresenceAttribute(props.readonly)
767
738
  }));
768
739
  const { selectedColor, saturationValue, opacityColor, showAlphaControls, updateSelection, updateHue, updateOpacity, selectColor, isColorSelected } = useColorPickerValue(props, (value) => emit("update:modelValue", value));
769
740
  const { swatchesRef, normalizedSwatchesPerRow, validSwatches, swatchesStyle, swatchSize, isSwatchSelected, getSwatchTabindex, selectSwatch, onSwatchFocus, onSwatchesFocusout, onSwatchKeydown } = useColorPickerSwatches(props, {
770
741
  isSelected: isColorSelected,
771
742
  select: selectColor
772
743
  });
773
- const _setTemplateRef = createTemplateRefSetter();
744
+ const templateRefs = { swatches: swatchesRef };
774
745
  const n22 = t3();
775
746
  renderEffect(() => setDynamicProps(n22, [rootAttrs.value]));
776
747
  setInsertionState(n22, null, 0);
@@ -850,7 +821,7 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
850
821
  const _index = _for_key0.value;
851
822
  const _isSwatchSelected = unref(isSwatchSelected);
852
823
  const _swatch = _for_item0.value;
853
- const _presence = unref(presence);
824
+ const _toPresenceAttribute = unref(toPresenceAttribute);
854
825
  setDynamicProps(n20, [unref(getPartAttrs)("swatch", { class: "rp-color-picker__swatch" }), {
855
826
  type: "button",
856
827
  role: "radio",
@@ -859,8 +830,8 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
859
830
  "aria-checked": _isSwatchSelected(_index),
860
831
  "aria-label": `Select color ${_swatch}`,
861
832
  title: _swatch,
862
- "data-selected": _presence(_isSwatchSelected(_index)),
863
- "data-readonly": _presence(_readonly)
833
+ "data-selected": _toPresenceAttribute(_isSwatchSelected(_index)),
834
+ "data-readonly": _toPresenceAttribute(_readonly)
864
835
  }]);
865
836
  });
866
837
  setInsertionState(n20, null, 0);
@@ -873,17 +844,17 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
873
844
  return createComponent(unref(check_default), { class: "rp-color-picker__swatch-check" });
874
845
  }, null, 129);
875
846
  }, { _: 8 }));
876
- n20.$evtclick = createInvoker(() => unref(selectSwatch)(_for_item0.value));
847
+ on(n20, "click", () => unref(selectSwatch)(_for_item0.value));
877
848
  on(n20, "focus", () => unref(onSwatchFocus)(_for_key0.value));
878
- n20.$evtkeydown = createInvoker(($event) => unref(onSwatchKeydown)($event, _for_key0.value));
849
+ on(n20, "keydown", ($event) => unref(onSwatchKeydown)($event, _for_key0.value));
879
850
  return n20;
880
851
  }, (swatch, index) => `${swatch}-${index}`, 9);
881
- n21.$evtfocusout = createInvoker((e) => unref(onSwatchesFocusout)(e));
882
- _setTemplateRef(n21, swatchesRef, null, "swatchesRef");
852
+ on(n21, "focusout", (e) => unref(onSwatchesFocusout)(e));
853
+ setTemplateRefBinding(n21, () => templateRefs.swatches);
883
854
  return n21;
884
855
  });
885
856
  return n22;
886
857
  }
887
- }), [["__scopeId", "data-v-41c4ca07"]]);
858
+ }), [["__scopeId", "data-v-7fe38e4e"]]);
888
859
  //#endregion
889
- export { formatColorPickerValue as n, parseColorPickerValue as r, color_picker_default as t };
860
+ export { parseColorPickerValue as i, colorPickerFormats as n, formatColorPickerValue as r, color_picker_default as t };