@wfrog/vc-ui 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/es/chunk/{CCmEeM7D.mjs → B3GxuXVE.mjs} +6 -6
  2. package/dist/es/chunk/BL8WhaLp.mjs +427 -0
  3. package/dist/es/chunk/{BiHWk71g.mjs → BPqrpkTb.mjs} +4 -4
  4. package/dist/es/chunk/{C_7t9blX.mjs → BZ1uhZQF.mjs} +1 -1
  5. package/dist/es/chunk/{-ga82G_B.mjs → BdVq9mV6.mjs} +1 -1
  6. package/dist/es/chunk/{DGGhWn1A.mjs → BfjuZmry.mjs} +6 -5
  7. package/dist/es/chunk/{BLLKi_0v.mjs → Bu3XHP55.mjs} +1 -1
  8. package/dist/es/chunk/{DEiqPcuO.mjs → BvNFaD5d.mjs} +3 -3
  9. package/dist/es/chunk/BxibBO68.mjs +5741 -0
  10. package/dist/es/chunk/{DO-mBaf5.mjs → By7FMB3I.mjs} +1 -43
  11. package/dist/es/chunk/{DATKTbFj.mjs → CGhekNBa.mjs} +5 -5
  12. package/dist/es/chunk/{plK2vnjp.mjs → CJ0afvkJ.mjs} +1 -1
  13. package/dist/es/chunk/{CtYp4FB7.mjs → CK5Bluh4.mjs} +2 -2
  14. package/dist/es/chunk/{Vv8g5_A1.mjs → CKZGL4_3.mjs} +9 -8
  15. package/dist/es/chunk/CNEMJL35.mjs +69 -0
  16. package/dist/es/chunk/{C9ldJ8Hh.mjs → CPCieLBG.mjs} +1 -1
  17. package/dist/es/chunk/{C50_dziC.mjs → CQz3lhyS.mjs} +2 -1
  18. package/dist/es/chunk/{Cekqdlxf.mjs → CbYM6R_O.mjs} +12 -77
  19. package/dist/es/chunk/{CQbpo0im.mjs → CboHfRXN.mjs} +5 -6
  20. package/dist/es/chunk/{BambM7zX.mjs → Cdh3HNZa.mjs} +2 -2
  21. package/dist/es/chunk/{aX4SRHmD.mjs → Cg-Krnly.mjs} +2 -1
  22. package/dist/es/chunk/{9qQNa4bM.mjs → Cjp0Czyu.mjs} +1 -1
  23. package/dist/es/chunk/Cmb_E8Ip.mjs +184 -0
  24. package/dist/es/chunk/{BIK5Djc_.mjs → Co77DVCw.mjs} +2 -2
  25. package/dist/es/chunk/CqTa_Vd-.mjs +375 -0
  26. package/dist/es/{components/dual-pane/dual-pane.mjs → chunk/CsjEhAYY.mjs} +11 -91
  27. package/dist/es/chunk/{BQyZW57B.mjs → CwXV7M2F.mjs} +3 -3
  28. package/dist/es/chunk/{b9dx0jdT.mjs → D1MHFKtN.mjs} +3 -3
  29. package/dist/es/chunk/{DskGUrkJ.mjs → D6m3vWpc.mjs} +2 -1
  30. package/dist/es/chunk/{4F1xxyju.mjs → D6nWUATi.mjs} +48 -2117
  31. package/dist/es/chunk/{C6bIuBQg.mjs → D7CQDxqy.mjs} +3 -3
  32. package/dist/es/chunk/{Dqk3gyUk.mjs → D9Lr0Bzb.mjs} +1 -374
  33. package/dist/es/chunk/{Xk5kfdyT.mjs → DAIuzoFs.mjs} +2 -1
  34. package/dist/es/chunk/{OVbHCQoq.mjs → DCS0eqqM.mjs} +3 -101
  35. package/dist/es/chunk/{BJTCqgn1.mjs → DDR6UjaC.mjs} +1 -1
  36. package/dist/es/chunk/{BKmk2ptO.mjs → DNsAO9iB.mjs} +2 -2
  37. package/dist/es/chunk/{-_x5oKYF.mjs → DQK0ezHm.mjs} +5 -4
  38. package/dist/es/chunk/{BQHHM_Gw.mjs → DQi1QPak.mjs} +30 -70
  39. package/dist/es/chunk/{BaqDgAvL.mjs → DSt2uDNE.mjs} +22 -434
  40. package/dist/es/chunk/DSw4GnC6.mjs +44 -0
  41. package/dist/es/chunk/DTbnchOm.mjs +94 -0
  42. package/dist/es/chunk/DViraU6I.mjs +45 -0
  43. package/dist/es/chunk/{C540ZOUa.mjs → DX84QR5M.mjs} +10 -9
  44. package/dist/es/chunk/DYKOYbzT.mjs +2003 -0
  45. package/dist/es/chunk/{D1PKXAql.mjs → D_F7nIja.mjs} +3 -4
  46. package/dist/es/chunk/{DcTh6n4x.mjs → D_Mvdscy.mjs} +5 -4
  47. package/dist/es/chunk/DhGOsWxx.mjs +6 -0
  48. package/dist/es/chunk/{DFxeI_lP.mjs → DhGcJR5p.mjs} +6 -6
  49. package/dist/es/chunk/DxxbB5jY.mjs +34 -0
  50. package/dist/es/chunk/EMeQxUfH.mjs +49 -0
  51. package/dist/es/chunk/{eN6VJ63C.mjs → F2ph6lWu.mjs} +9 -8
  52. package/dist/es/chunk/{Dn-BFXcJ.mjs → dN0VcQc2.mjs} +1 -1
  53. package/dist/es/chunk/{DTpr71Gd.mjs → e5i7OJY-.mjs} +4 -4
  54. package/dist/es/chunk/fueZ9sVu.mjs +890 -0
  55. package/dist/es/chunk/{CV2NA_2e.mjs → ipA7n6-J.mjs} +1 -1
  56. package/dist/es/chunk/{Dw-yyl2m.mjs → q2jRgbir.mjs} +2 -2
  57. package/dist/es/chunk/{C72pWnuz.mjs → w7VqVeWU.mjs} +5 -4
  58. package/dist/es/chunk/{DWcIzeMM.mjs → ytiKcA3H.mjs} +108 -10
  59. package/dist/es/chunk/{DFHjl3eL.mjs → yuIXvUxc.mjs} +1 -1
  60. package/dist/es/components/backbottom/backbottom.mjs +2 -2
  61. package/dist/es/components/button/button.d.ts +2 -1
  62. package/dist/es/components/button/button.mjs +68 -17
  63. package/dist/es/components/button/button.vue.d.ts +4 -1
  64. package/dist/es/components/choice/choice.mjs +3 -2
  65. package/dist/es/components/color-switcher/color-switcher.d.ts +15 -0
  66. package/dist/es/components/color-switcher/color-switcher.mjs +1215 -0
  67. package/dist/es/components/color-switcher/color-switcher.vue.d.ts +122 -0
  68. package/dist/es/components/color-switcher/index.css +5 -0
  69. package/dist/es/components/color-switcher/index.d.ts +4 -0
  70. package/dist/es/components/color-switcher/index.mjs +6 -0
  71. package/dist/es/components/cropper/cropper.mjs +12 -11
  72. package/dist/es/components/cropper/cropper.vue.d.ts +2 -2
  73. package/dist/es/components/currency/currency.mjs +7 -7
  74. package/dist/es/components/dark-switcher/dark-switcher.d.ts +10 -0
  75. package/dist/es/components/dark-switcher/dark-switcher.mjs +87 -0
  76. package/dist/es/components/dark-switcher/dark-switcher.vue.d.ts +12 -0
  77. package/dist/es/components/dark-switcher/index.css +11 -0
  78. package/dist/es/components/dark-switcher/index.d.ts +4 -0
  79. package/dist/es/components/dark-switcher/index.mjs +6 -0
  80. package/dist/es/components/daterange-picker/daterange-picker.mjs +21 -20
  81. package/dist/es/components/dialog/dialog.d.ts +1 -1
  82. package/dist/es/components/dialog/dialog.mjs +46 -61
  83. package/dist/es/components/dialog/dialog.vue.d.ts +1 -3
  84. package/dist/es/components/dialog/index.css +31 -32
  85. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +12 -12
  86. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +5 -5
  87. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +14 -13
  88. package/dist/es/components/document.vue.d.ts +14 -0
  89. package/dist/es/components/drag-verify/drag-verify.mjs +14 -14
  90. package/dist/es/components/drag-verify/index.css +11 -11
  91. package/dist/es/components/drawer/drawer.mjs +14 -14
  92. package/dist/es/components/drawer/index.css +16 -15
  93. package/dist/es/components/easy-pagination/easy-pagination.mjs +4 -4
  94. package/dist/es/components/el-icon/el-icon.mjs +2 -2
  95. package/dist/es/components/example-wrapper.vue.d.ts +19 -0
  96. package/dist/es/components/explorer/docs/data.d.ts +13 -0
  97. package/dist/es/components/explorer/explorer.d.ts +12 -0
  98. package/dist/es/components/explorer/explorer.mjs +64 -0
  99. package/dist/es/components/explorer/explorer.vue.d.ts +183 -0
  100. package/dist/es/components/explorer/explorer2.mjs +6 -0
  101. package/dist/es/components/explorer/index.css +14 -0
  102. package/dist/es/components/explorer/index.d.ts +4 -0
  103. package/dist/es/components/explorer/index.mjs +6 -0
  104. package/dist/es/components/explorer-column-table/explorer-column-table.d.ts +23 -0
  105. package/dist/es/components/explorer-column-table/explorer-column-table.mjs +2948 -0
  106. package/dist/es/components/explorer-column-table/explorer-column-table.vue.d.ts +1486 -0
  107. package/dist/es/components/explorer-column-table/index.css +49 -0
  108. package/dist/es/components/explorer-column-table/index.d.ts +4 -0
  109. package/dist/es/components/explorer-column-table/index.mjs +6 -0
  110. package/dist/es/components/explorer-filter/explorer-filter.d.ts +12 -0
  111. package/dist/es/components/explorer-filter/explorer-filter.mjs +81 -0
  112. package/dist/es/components/explorer-filter/explorer-filter.vue.d.ts +14 -0
  113. package/dist/es/components/explorer-filter/index.css +7 -0
  114. package/dist/es/components/explorer-filter/index.d.ts +4 -0
  115. package/dist/es/components/explorer-filter/index.mjs +6 -0
  116. package/dist/es/components/explorer-footer/explorer-footer.d.ts +5 -0
  117. package/dist/es/components/explorer-footer/explorer-footer.mjs +92 -0
  118. package/dist/es/components/explorer-footer/explorer-footer.vue.d.ts +21 -0
  119. package/dist/es/components/explorer-footer/index.css +7 -0
  120. package/dist/es/components/explorer-footer/index.d.ts +4 -0
  121. package/dist/es/components/explorer-footer/index.mjs +6 -0
  122. package/dist/es/components/explorer-list/explorer-list.d.ts +23 -0
  123. package/dist/es/components/explorer-list/explorer-list.mjs +157 -0
  124. package/dist/es/components/explorer-list/explorer-list.vue.d.ts +38 -0
  125. package/dist/es/components/explorer-list/index.css +47 -0
  126. package/dist/es/components/explorer-list/index.d.ts +4 -0
  127. package/dist/es/components/explorer-list/index.mjs +6 -0
  128. package/dist/es/components/explorer-panel/explorer-panel.d.ts +14 -0
  129. package/dist/es/components/explorer-panel/explorer-panel.mjs +77 -0
  130. package/dist/es/components/explorer-panel/explorer-panel.vue.d.ts +253 -0
  131. package/dist/es/components/explorer-panel/explorer-panel2.mjs +6 -0
  132. package/dist/es/components/explorer-panel/index.css +12 -0
  133. package/dist/es/components/explorer-panel/index.d.ts +4 -0
  134. package/dist/es/components/explorer-panel/index.mjs +6 -0
  135. package/dist/es/components/explorer-query/explorer-query.d.ts +11 -0
  136. package/dist/es/components/explorer-query/explorer-query.mjs +2376 -0
  137. package/dist/es/components/explorer-query/explorer-query.vue.d.ts +396 -0
  138. package/dist/es/components/explorer-query/index.css +36 -0
  139. package/dist/es/components/explorer-query/index.d.ts +4 -0
  140. package/dist/es/components/explorer-query/index.mjs +6 -0
  141. package/dist/es/components/explorer-table/explorer-table.d.ts +11 -0
  142. package/dist/es/components/explorer-table/explorer-table.mjs +116 -0
  143. package/dist/es/components/explorer-table/explorer-table.vue.d.ts +25 -0
  144. package/dist/es/components/explorer-table/index.css +18 -0
  145. package/dist/es/components/explorer-table/index.d.ts +4 -0
  146. package/dist/es/components/explorer-table/index.mjs +6 -0
  147. package/dist/es/components/explorer-tools/components/column-setter.vue.d.ts +3028 -0
  148. package/dist/es/components/explorer-tools/explorer-tools.d.ts +35 -0
  149. package/dist/es/components/explorer-tools/explorer-tools.mjs +585 -0
  150. package/dist/es/components/explorer-tools/explorer-tools.vue.d.ts +43 -0
  151. package/dist/es/components/explorer-tools/index.css +60 -0
  152. package/dist/es/components/explorer-tools/index.d.ts +4 -0
  153. package/dist/es/components/explorer-tools/index.mjs +6 -0
  154. package/dist/es/components/explorer-tree/explorer-tree.d.ts +22 -0
  155. package/dist/es/components/explorer-tree/explorer-tree.mjs +174 -0
  156. package/dist/es/components/explorer-tree/explorer-tree.vue.d.ts +2055 -0
  157. package/dist/es/components/explorer-tree/index.css +55 -0
  158. package/dist/es/components/explorer-tree/index.d.ts +4 -0
  159. package/dist/es/components/explorer-tree/index.mjs +6 -0
  160. package/dist/es/components/icon/icon2.mjs +2 -2
  161. package/dist/es/components/icon-picker/components/collections.vue.d.ts +242 -196
  162. package/dist/es/components/icon-picker/icon-picker.mjs +38 -921
  163. package/dist/es/components/icon-picker/index.css +31 -29
  164. package/dist/es/components/iconify-icon/iconify-icon.mjs +2 -2
  165. package/dist/es/components/image/image.mjs +5 -5
  166. package/dist/es/components/image/image.vue.d.ts +7 -7
  167. package/dist/es/components/input/index.css +4 -5
  168. package/dist/es/components/input/input.mjs +7 -7
  169. package/dist/es/components/input/input.vue.d.ts +3 -3
  170. package/dist/es/components/input-number/input-number.mjs +5 -5
  171. package/dist/es/components/pca-picker/components/c.vue.d.ts +3 -3
  172. package/dist/es/components/pca-picker/index.css +4 -4
  173. package/dist/es/components/pca-picker/pca-picker.mjs +21 -209
  174. package/dist/es/components/pca-picker/pca-picker.vue.d.ts +10 -10
  175. package/dist/es/components/screenfull/screenfull.mjs +4 -4
  176. package/dist/es/components/scrollbar/index.css +6 -5
  177. package/dist/es/components/scrollbar/scrollbar.d.ts +2 -0
  178. package/dist/es/components/scrollbar/scrollbar.mjs +17 -12
  179. package/dist/es/components/scrollbar/scrollbar.vue.d.ts +156 -134
  180. package/dist/es/components/select/select.mjs +7 -7
  181. package/dist/es/components/single-player/index.css +11 -11
  182. package/dist/es/components/single-player/single-player.mjs +20 -19
  183. package/dist/es/components/splitter/index.d.ts +4 -0
  184. package/dist/es/components/splitter/index.mjs +6 -0
  185. package/dist/es/components/splitter/splitter.d.ts +4 -0
  186. package/dist/es/components/splitter/splitter.mjs +28 -0
  187. package/dist/es/components/{dual-pane/dual-pane.vue.d.ts → splitter/splitter.vue.d.ts} +3 -5
  188. package/dist/es/components/splitter-panel/index.css +5 -0
  189. package/dist/es/components/splitter-panel/index.d.ts +4 -0
  190. package/dist/es/components/splitter-panel/index.mjs +6 -0
  191. package/dist/es/components/splitter-panel/splitter-panel.d.ts +3 -0
  192. package/dist/es/components/splitter-panel/splitter-panel.mjs +49 -0
  193. package/dist/es/components/splitter-panel/splitter-panel.vue.d.ts +20 -0
  194. package/dist/es/components/svg-icon/svg-icon.mjs +2 -2
  195. package/dist/es/components/switch/switch.mjs +2 -2
  196. package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +2 -2
  197. package/dist/es/components/tags/tags.mjs +12 -11
  198. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +4 -4
  199. package/dist/es/components/text-ellipsis/text-ellipsis.vue.d.ts +1 -1
  200. package/dist/es/components/thousand-input/thousand-input.mjs +3 -3
  201. package/dist/es/components/thousand-input/thousand-input.vue.d.ts +8 -8
  202. package/dist/es/components/tinymce/index.css +1 -1
  203. package/dist/es/components/tinymce/tinymce.d.ts +1 -0
  204. package/dist/es/components/tinymce/tinymce.mjs +20 -11
  205. package/dist/es/components/tinymce/tinymce.vue.d.ts +1 -0
  206. package/dist/es/components/tree-picker/popover-cascader.css +1 -1
  207. package/dist/es/components/tree-picker/tree-picker.mjs +11 -10
  208. package/dist/es/components/tree-picker/tree-picker.vue.d.ts +10 -10
  209. package/dist/es/components/upload-file/upload-file.mjs +2 -2
  210. package/dist/es/index.d.ts +14 -1
  211. package/dist/es/index.mjs +69 -39
  212. package/dist/es/use/usePersistentModel/index.d.ts +4 -0
  213. package/dist/es/use/usePersistentModel/index.mjs +19 -0
  214. package/dist/global.d.ts +14 -1
  215. package/dist/index.css +450 -123
  216. package/package.json +4 -1
  217. package/dist/es/chunk/DVNTpOBR.mjs +0 -4
  218. package/dist/es/components/dual-pane/dual-pane.d.ts +0 -8
  219. package/dist/es/components/dual-pane/index.css +0 -8
  220. package/dist/es/components/dual-pane/index.d.ts +0 -4
  221. package/dist/es/components/dual-pane/index.mjs +0 -6
@@ -0,0 +1,1215 @@
1
+ import './index.css'
2
+ import { b as buildProps, d as definePropType, u as useNamespace, i as isString, h as hasOwn, a as debugWarn } from '../../chunk/By7FMB3I.mjs';
3
+ import '../../chunk/BfjuZmry.mjs';
4
+ /* empty css */
5
+ import { E as ElInput } from '../../chunk/CKZGL4_3.mjs';
6
+ import { getCurrentInstance, shallowRef, computed, ref, onMounted, watch, defineComponent, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, normalizeStyle, inject, watchEffect, Fragment, renderList, reactive, nextTick, provide, createBlock, createCommentVNode, createVNode, renderSlot, onBeforeMount, useTemplateRef, withCtx, isRef } from 'vue';
7
+ import { C as Component$1 } from '../iconify-icon/iconify-icon.mjs';
8
+ import { isClient, useDark, useStorage } from '@vueuse/core';
9
+ import { t as throttle } from '../../chunk/CNEMJL35.mjs';
10
+ import { E as ElPopover } from '../../chunk/DQK0ezHm.mjs';
11
+ import { g as getClientXY } from '../../chunk/DxxbB5jY.mjs';
12
+ import { a as addUnit } from '../../chunk/CQz3lhyS.mjs';
13
+ import { g as getEventCode, E as EVENT_CODE } from '../../chunk/BTpNRPQW.mjs';
14
+ import { _ as _export_sfc, w as withInstall } from '../../chunk/dN0VcQc2.mjs';
15
+ import { u as useLocale } from '../../chunk/CJ0afvkJ.mjs';
16
+ import { U as UPDATE_MODEL_EVENT } from '../../chunk/Ct6q2FXg.mjs';
17
+ import { i as isNil } from '../../chunk/DViraU6I.mjs';
18
+ import { T as TinyColor } from '../../chunk/D9Lr0Bzb.mjs';
19
+ import { u as useFormItem, a as useFormDisabled } from '../../chunk/BvNFaD5d.mjs';
20
+ import { _ as _export_sfc$1 } from '../../chunk/pcqpp-6-.mjs';
21
+
22
+ const alphaSliderProps = buildProps({
23
+ color: {
24
+ type: definePropType(Object),
25
+ required: true
26
+ },
27
+ vertical: Boolean,
28
+ disabled: Boolean
29
+ });
30
+ const hueSliderProps = alphaSliderProps;
31
+
32
+ let isDragging = false;
33
+ function draggable(element, options) {
34
+ if (!isClient)
35
+ return;
36
+ const moveFn = function(event) {
37
+ var _a;
38
+ (_a = options.drag) == null ? void 0 : _a.call(options, event);
39
+ };
40
+ const upFn = function(event) {
41
+ var _a;
42
+ document.removeEventListener("mousemove", moveFn);
43
+ document.removeEventListener("mouseup", upFn);
44
+ document.removeEventListener("touchmove", moveFn);
45
+ document.removeEventListener("touchend", upFn);
46
+ document.onselectstart = null;
47
+ document.ondragstart = null;
48
+ isDragging = false;
49
+ (_a = options.end) == null ? void 0 : _a.call(options, event);
50
+ };
51
+ const downFn = function(event) {
52
+ var _a;
53
+ if (isDragging)
54
+ return;
55
+ document.onselectstart = () => false;
56
+ document.ondragstart = () => false;
57
+ document.addEventListener("mousemove", moveFn);
58
+ document.addEventListener("mouseup", upFn);
59
+ document.addEventListener("touchmove", moveFn);
60
+ document.addEventListener("touchend", upFn);
61
+ isDragging = true;
62
+ (_a = options.start) == null ? void 0 : _a.call(options, event);
63
+ };
64
+ element.addEventListener("mousedown", downFn);
65
+ element.addEventListener("touchstart", downFn, { passive: false });
66
+ }
67
+
68
+ const useSlider = (props, { key, minValue, maxValue }) => {
69
+ const instance = getCurrentInstance();
70
+ const thumb = shallowRef();
71
+ const bar = shallowRef();
72
+ const currentValue = computed(() => props.color.get(key));
73
+ function handleClick(event) {
74
+ var _a;
75
+ if (props.disabled)
76
+ return;
77
+ const target = event.target;
78
+ if (target !== thumb.value) {
79
+ handleDrag(event);
80
+ }
81
+ (_a = thumb.value) == null ? void 0 : _a.focus();
82
+ }
83
+ function handleDrag(event) {
84
+ if (!bar.value || !thumb.value || props.disabled)
85
+ return;
86
+ const el = instance.vnode.el;
87
+ const rect = el.getBoundingClientRect();
88
+ const { clientX, clientY } = getClientXY(event);
89
+ let value;
90
+ if (!props.vertical) {
91
+ let left = clientX - rect.left;
92
+ left = Math.max(thumb.value.offsetWidth / 2, left);
93
+ left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
94
+ value = Math.round(
95
+ (left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * maxValue
96
+ );
97
+ } else {
98
+ let top = clientY - rect.top;
99
+ top = Math.max(thumb.value.offsetHeight / 2, top);
100
+ top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
101
+ value = Math.round(
102
+ (top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * maxValue
103
+ );
104
+ }
105
+ props.color.set(key, value);
106
+ }
107
+ function handleKeydown(event) {
108
+ if (props.disabled)
109
+ return;
110
+ const { shiftKey } = event;
111
+ const code = getEventCode(event);
112
+ const step = shiftKey ? 10 : 1;
113
+ const reverse = key === "hue" ? -1 : 1;
114
+ let isPreventDefault = true;
115
+ switch (code) {
116
+ case EVENT_CODE.left:
117
+ case EVENT_CODE.down:
118
+ incrementPosition(-step * reverse);
119
+ break;
120
+ case EVENT_CODE.right:
121
+ case EVENT_CODE.up:
122
+ incrementPosition(step * reverse);
123
+ break;
124
+ case EVENT_CODE.home:
125
+ props.color.set(key, key === "hue" ? maxValue : minValue);
126
+ break;
127
+ case EVENT_CODE.end:
128
+ props.color.set(key, key === "hue" ? minValue : maxValue);
129
+ break;
130
+ case EVENT_CODE.pageDown:
131
+ incrementPosition(-4 * reverse);
132
+ break;
133
+ case EVENT_CODE.pageUp:
134
+ incrementPosition(4 * reverse);
135
+ break;
136
+ default:
137
+ isPreventDefault = false;
138
+ break;
139
+ }
140
+ isPreventDefault && event.preventDefault();
141
+ }
142
+ function incrementPosition(step) {
143
+ let next = currentValue.value + step;
144
+ next = next < minValue ? minValue : next > maxValue ? maxValue : next;
145
+ props.color.set(key, next);
146
+ }
147
+ return {
148
+ thumb,
149
+ bar,
150
+ currentValue,
151
+ handleDrag,
152
+ handleClick,
153
+ handleKeydown
154
+ };
155
+ };
156
+ const useSliderDOM = (props, {
157
+ namespace,
158
+ maxValue,
159
+ bar,
160
+ thumb,
161
+ currentValue,
162
+ handleDrag,
163
+ getBackground
164
+ }) => {
165
+ const instance = getCurrentInstance();
166
+ const ns = useNamespace(namespace);
167
+ const thumbLeft = ref(0);
168
+ const thumbTop = ref(0);
169
+ const background = ref();
170
+ function getThumbLeft() {
171
+ if (!thumb.value)
172
+ return 0;
173
+ if (props.vertical)
174
+ return 0;
175
+ const el = instance.vnode.el;
176
+ const value = currentValue.value;
177
+ if (!el)
178
+ return 0;
179
+ return Math.round(
180
+ value * (el.offsetWidth - thumb.value.offsetWidth / 2) / maxValue
181
+ );
182
+ }
183
+ function getThumbTop() {
184
+ if (!thumb.value)
185
+ return 0;
186
+ const el = instance.vnode.el;
187
+ if (!props.vertical)
188
+ return 0;
189
+ const value = currentValue.value;
190
+ if (!el)
191
+ return 0;
192
+ return Math.round(
193
+ value * (el.offsetHeight - thumb.value.offsetHeight / 2) / maxValue
194
+ );
195
+ }
196
+ function update() {
197
+ thumbLeft.value = getThumbLeft();
198
+ thumbTop.value = getThumbTop();
199
+ background.value = getBackground == null ? void 0 : getBackground();
200
+ }
201
+ onMounted(() => {
202
+ if (!bar.value || !thumb.value)
203
+ return;
204
+ const dragConfig = {
205
+ drag: (event) => {
206
+ handleDrag(event);
207
+ },
208
+ end: (event) => {
209
+ handleDrag(event);
210
+ }
211
+ };
212
+ draggable(bar.value, dragConfig);
213
+ draggable(thumb.value, dragConfig);
214
+ update();
215
+ });
216
+ watch(currentValue, () => update());
217
+ watch(
218
+ () => props.color.value,
219
+ () => update()
220
+ );
221
+ const rootKls = computed(() => [
222
+ ns.b(),
223
+ ns.is("vertical", props.vertical),
224
+ ns.is("disabled", props.disabled)
225
+ ]);
226
+ const barKls = computed(() => ns.e("bar"));
227
+ const thumbKls = computed(() => ns.e("thumb"));
228
+ const barStyle = computed(() => ({ background: background.value }));
229
+ const thumbStyle = computed(() => ({
230
+ left: addUnit(thumbLeft.value),
231
+ top: addUnit(thumbTop.value)
232
+ }));
233
+ return {
234
+ rootKls,
235
+ barKls,
236
+ barStyle,
237
+ thumbKls,
238
+ thumbStyle,
239
+ thumbLeft,
240
+ thumbTop,
241
+ update
242
+ };
243
+ };
244
+
245
+ const _hoisted_1$3 = ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "tabindex", "aria-disabled"];
246
+ const minValue$1 = 0;
247
+ const maxValue$1 = 100;
248
+ const _sfc_main$5 = defineComponent({
249
+ ...{
250
+ name: "ElColorAlphaSlider"
251
+ },
252
+ __name: "alpha-slider",
253
+ props: alphaSliderProps,
254
+ setup(__props, { expose: __expose }) {
255
+ const props = __props;
256
+ const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "alpha", minValue: minValue$1, maxValue: maxValue$1 });
257
+ const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useSliderDOM(props, {
258
+ namespace: "color-alpha-slider",
259
+ maxValue: maxValue$1,
260
+ currentValue,
261
+ bar,
262
+ thumb,
263
+ handleDrag,
264
+ getBackground
265
+ });
266
+ const { t } = useLocale();
267
+ const ariaLabel = computed(() => t("el.colorpicker.alphaLabel"));
268
+ const ariaValuetext = computed(() => {
269
+ return t("el.colorpicker.alphaDescription", {
270
+ alpha: currentValue.value,
271
+ color: props.color.value
272
+ });
273
+ });
274
+ function getBackground() {
275
+ if (props.color && props.color.value) {
276
+ const { r, g, b } = props.color.toRgb();
277
+ return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
278
+ }
279
+ return "";
280
+ }
281
+ __expose({
282
+ update,
283
+ bar,
284
+ thumb
285
+ });
286
+ return (_ctx, _cache) => {
287
+ return openBlock(), createElementBlock(
288
+ "div",
289
+ {
290
+ class: normalizeClass(unref(rootKls))
291
+ },
292
+ [
293
+ createElementVNode(
294
+ "div",
295
+ {
296
+ ref_key: "bar",
297
+ ref: bar,
298
+ class: normalizeClass(unref(barKls)),
299
+ style: normalizeStyle(unref(barStyle)),
300
+ onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
301
+ },
302
+ null,
303
+ 6
304
+ ),
305
+ createElementVNode("div", {
306
+ ref_key: "thumb",
307
+ ref: thumb,
308
+ class: normalizeClass(unref(thumbKls)),
309
+ style: normalizeStyle(unref(thumbStyle)),
310
+ "aria-label": ariaLabel.value,
311
+ "aria-valuenow": unref(currentValue),
312
+ "aria-valuetext": ariaValuetext.value,
313
+ "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
314
+ "aria-valuemin": minValue$1,
315
+ "aria-valuemax": maxValue$1,
316
+ role: "slider",
317
+ tabindex: _ctx.disabled ? void 0 : 0,
318
+ "aria-disabled": _ctx.disabled,
319
+ onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
320
+ }, null, 46, _hoisted_1$3)
321
+ ],
322
+ 2
323
+ );
324
+ };
325
+ }
326
+ });
327
+ var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/alpha-slider.vue"]]);
328
+
329
+ const _hoisted_1$2 = ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "tabindex", "aria-disabled"];
330
+ const minValue = 0;
331
+ const maxValue = 360;
332
+ const _sfc_main$4 = defineComponent({
333
+ ...{
334
+ name: "ElColorHueSlider"
335
+ },
336
+ __name: "hue-slider",
337
+ props: hueSliderProps,
338
+ setup(__props, { expose: __expose }) {
339
+ const props = __props;
340
+ const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "hue", minValue, maxValue });
341
+ const { rootKls, barKls, thumbKls, thumbStyle, thumbTop, update } = useSliderDOM(props, {
342
+ namespace: "color-hue-slider",
343
+ maxValue,
344
+ currentValue,
345
+ bar,
346
+ thumb,
347
+ handleDrag
348
+ });
349
+ const { t } = useLocale();
350
+ const ariaLabel = computed(() => t("el.colorpicker.hueLabel"));
351
+ const ariaValuetext = computed(() => {
352
+ return t("el.colorpicker.hueDescription", {
353
+ hue: currentValue.value,
354
+ color: props.color.value
355
+ });
356
+ });
357
+ __expose({
358
+ bar,
359
+ thumb,
360
+ thumbTop,
361
+ update
362
+ });
363
+ return (_ctx, _cache) => {
364
+ return openBlock(), createElementBlock(
365
+ "div",
366
+ {
367
+ class: normalizeClass(unref(rootKls))
368
+ },
369
+ [
370
+ createElementVNode(
371
+ "div",
372
+ {
373
+ ref_key: "bar",
374
+ ref: bar,
375
+ class: normalizeClass(unref(barKls)),
376
+ onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
377
+ },
378
+ null,
379
+ 2
380
+ ),
381
+ createElementVNode("div", {
382
+ ref_key: "thumb",
383
+ ref: thumb,
384
+ class: normalizeClass(unref(thumbKls)),
385
+ style: normalizeStyle(unref(thumbStyle)),
386
+ "aria-label": ariaLabel.value,
387
+ "aria-valuenow": unref(currentValue),
388
+ "aria-valuetext": ariaValuetext.value,
389
+ "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
390
+ "aria-valuemin": minValue,
391
+ "aria-valuemax": maxValue,
392
+ role: "slider",
393
+ tabindex: _ctx.disabled ? void 0 : 0,
394
+ "aria-disabled": _ctx.disabled,
395
+ onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
396
+ }, null, 46, _hoisted_1$2)
397
+ ],
398
+ 2
399
+ );
400
+ };
401
+ }
402
+ });
403
+ var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/hue-slider.vue"]]);
404
+
405
+ const predefineProps = buildProps({
406
+ colors: {
407
+ type: definePropType(Array),
408
+ required: true
409
+ },
410
+ color: {
411
+ type: definePropType(Object),
412
+ required: true
413
+ },
414
+ enableAlpha: {
415
+ type: Boolean,
416
+ required: true
417
+ },
418
+ disabled: Boolean
419
+ });
420
+
421
+ const colorPickerPanelProps = buildProps({
422
+ modelValue: {
423
+ type: definePropType(String),
424
+ default: void 0
425
+ },
426
+ border: {
427
+ type: Boolean,
428
+ default: true
429
+ },
430
+ showAlpha: Boolean,
431
+ colorFormat: String,
432
+ disabled: Boolean,
433
+ predefine: {
434
+ type: definePropType(Array)
435
+ },
436
+ validateEvent: {
437
+ type: Boolean,
438
+ default: true
439
+ }
440
+ });
441
+ const colorPickerPanelEmits = {
442
+ [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val)
443
+ };
444
+ const ROOT_COMMON_COLOR_INJECTION_KEY = Symbol("colorCommonPickerKey");
445
+ const colorPickerPanelContextKey = Symbol("colorPickerPanelContextKey");
446
+
447
+ class Color {
448
+ constructor(options = {}) {
449
+ this._hue = 0;
450
+ this._saturation = 100;
451
+ this._value = 100;
452
+ this._alpha = 100;
453
+ this._tiny = new TinyColor();
454
+ this._isValid = false;
455
+ this.enableAlpha = false;
456
+ this.format = "";
457
+ this.value = "";
458
+ for (const option in options) {
459
+ if (hasOwn(options, option)) {
460
+ this[option] = options[option];
461
+ }
462
+ }
463
+ if (options.value) {
464
+ this.fromString(options.value);
465
+ } else {
466
+ this.doOnChange();
467
+ }
468
+ }
469
+ set(prop, value) {
470
+ if (arguments.length === 1 && typeof prop === "object") {
471
+ for (const p in prop) {
472
+ if (hasOwn(prop, p)) {
473
+ this.set(p, prop[p]);
474
+ }
475
+ }
476
+ return;
477
+ }
478
+ this[`_${prop}`] = value;
479
+ this._isValid = true;
480
+ this.doOnChange();
481
+ }
482
+ get(prop) {
483
+ if (["hue", "saturation", "value", "alpha"].includes(prop)) {
484
+ return Math.round(this[`_${prop}`]);
485
+ }
486
+ return this[`_${prop}`];
487
+ }
488
+ toRgb() {
489
+ return this._isValid ? this._tiny.toRgb() : { r: 255, g: 255, b: 255, a: 0 };
490
+ }
491
+ fromString(value) {
492
+ const color = new TinyColor(value);
493
+ this._isValid = color.isValid;
494
+ if (color.isValid) {
495
+ const { h, s, v, a } = color.toHsv();
496
+ this._hue = h;
497
+ this._saturation = s * 100;
498
+ this._value = v * 100;
499
+ this._alpha = a * 100;
500
+ } else {
501
+ this._hue = 0;
502
+ this._saturation = 100;
503
+ this._value = 100;
504
+ this._alpha = 100;
505
+ }
506
+ this.doOnChange();
507
+ }
508
+ clear() {
509
+ this._isValid = false;
510
+ this.value = "";
511
+ this._hue = 0;
512
+ this._saturation = 100;
513
+ this._value = 100;
514
+ this._alpha = 100;
515
+ }
516
+ compare(color) {
517
+ const compareColor = new TinyColor({
518
+ h: color._hue,
519
+ s: color._saturation / 100,
520
+ v: color._value / 100,
521
+ a: color._alpha / 100
522
+ });
523
+ return this._tiny.equals(compareColor);
524
+ }
525
+ doOnChange() {
526
+ const { _hue, _saturation, _value, _alpha, format, enableAlpha } = this;
527
+ let _format = format || (enableAlpha ? "rgb" : "hex");
528
+ if (format === "hex" && enableAlpha) {
529
+ _format = "hex8";
530
+ }
531
+ this._tiny = new TinyColor({
532
+ h: _hue,
533
+ s: _saturation / 100,
534
+ v: _value / 100,
535
+ a: _alpha / 100
536
+ });
537
+ this.value = this._isValid ? this._tiny.toString(_format) : "";
538
+ }
539
+ }
540
+
541
+ const usePredefine = (props) => {
542
+ const { currentColor } = inject(colorPickerPanelContextKey);
543
+ const rgbaColors = ref(parseColors(props.colors, props.color));
544
+ watch(
545
+ () => currentColor.value,
546
+ (val) => {
547
+ const color = new Color({
548
+ value: val,
549
+ enableAlpha: props.enableAlpha
550
+ });
551
+ rgbaColors.value.forEach((item) => {
552
+ item.selected = color.compare(item);
553
+ });
554
+ }
555
+ );
556
+ watchEffect(() => {
557
+ rgbaColors.value = parseColors(props.colors, props.color);
558
+ });
559
+ function handleSelect(index) {
560
+ props.color.fromString(props.colors[index]);
561
+ }
562
+ function parseColors(colors, color) {
563
+ return colors.map((value) => {
564
+ const c = new Color({
565
+ value,
566
+ enableAlpha: props.enableAlpha
567
+ });
568
+ c.selected = c.compare(color);
569
+ return c;
570
+ });
571
+ }
572
+ return {
573
+ rgbaColors,
574
+ handleSelect
575
+ };
576
+ };
577
+ const usePredefineDOM = (props) => {
578
+ const ns = useNamespace("color-predefine");
579
+ const rootKls = computed(() => [ns.b(), ns.is("disabled", props.disabled)]);
580
+ const colorsKls = computed(() => ns.e("colors"));
581
+ function colorSelectorKls(item) {
582
+ return [
583
+ ns.e("color-selector"),
584
+ ns.is("alpha", item.get("alpha") < 100),
585
+ { selected: item.selected }
586
+ ];
587
+ }
588
+ return {
589
+ rootKls,
590
+ colorsKls,
591
+ colorSelectorKls
592
+ };
593
+ };
594
+
595
+ const _hoisted_1$1 = ["disabled", "aria-label", "onClick"];
596
+ const _sfc_main$3 = defineComponent({
597
+ ...{
598
+ name: "ElColorPredefine"
599
+ },
600
+ __name: "predefine",
601
+ props: predefineProps,
602
+ setup(__props) {
603
+ const props = __props;
604
+ const { rgbaColors, handleSelect } = usePredefine(props);
605
+ const { rootKls, colorsKls, colorSelectorKls } = usePredefineDOM(props);
606
+ const { t } = useLocale();
607
+ const ariaLabel = (value) => {
608
+ return t("el.colorpicker.predefineDescription", { value });
609
+ };
610
+ return (_ctx, _cache) => {
611
+ return openBlock(), createElementBlock(
612
+ "div",
613
+ {
614
+ class: normalizeClass(unref(rootKls))
615
+ },
616
+ [
617
+ createElementVNode(
618
+ "div",
619
+ {
620
+ class: normalizeClass(unref(colorsKls))
621
+ },
622
+ [
623
+ (openBlock(true), createElementBlock(
624
+ Fragment,
625
+ null,
626
+ renderList(unref(rgbaColors), (item, index) => {
627
+ return openBlock(), createElementBlock("button", {
628
+ key: _ctx.colors[index],
629
+ type: "button",
630
+ disabled: _ctx.disabled,
631
+ "aria-label": ariaLabel(item.value),
632
+ class: normalizeClass(unref(colorSelectorKls)(item)),
633
+ onClick: ($event) => unref(handleSelect)(index)
634
+ }, [
635
+ createElementVNode(
636
+ "div",
637
+ {
638
+ style: normalizeStyle({ backgroundColor: item.value })
639
+ },
640
+ null,
641
+ 4
642
+ )
643
+ ], 10, _hoisted_1$1);
644
+ }),
645
+ 128
646
+ ))
647
+ ],
648
+ 2
649
+ )
650
+ ],
651
+ 2
652
+ );
653
+ };
654
+ }
655
+ });
656
+ var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/predefine.vue"]]);
657
+
658
+ const svPanelProps = buildProps({
659
+ color: {
660
+ type: definePropType(Object),
661
+ required: true
662
+ },
663
+ disabled: Boolean
664
+ });
665
+
666
+ const useSvPanel = (props) => {
667
+ const instance = getCurrentInstance();
668
+ const cursorRef = ref();
669
+ const cursorTop = ref(0);
670
+ const cursorLeft = ref(0);
671
+ const background = ref("hsl(0, 100%, 50%)");
672
+ const saturation = computed(() => props.color.get("saturation"));
673
+ const brightness = computed(() => props.color.get("value"));
674
+ const hue = computed(() => props.color.get("hue"));
675
+ function handleClick(event) {
676
+ var _a;
677
+ if (props.disabled)
678
+ return;
679
+ const target = event.target;
680
+ if (target !== cursorRef.value) {
681
+ handleDrag(event);
682
+ }
683
+ (_a = cursorRef.value) == null ? void 0 : _a.focus({ preventScroll: true });
684
+ }
685
+ function handleDrag(event) {
686
+ if (props.disabled)
687
+ return;
688
+ const el = instance.vnode.el;
689
+ const rect = el.getBoundingClientRect();
690
+ const { clientX, clientY } = getClientXY(event);
691
+ let left = clientX - rect.left;
692
+ let top = clientY - rect.top;
693
+ left = Math.max(0, left);
694
+ left = Math.min(left, rect.width);
695
+ top = Math.max(0, top);
696
+ top = Math.min(top, rect.height);
697
+ cursorLeft.value = left;
698
+ cursorTop.value = top;
699
+ props.color.set({
700
+ saturation: left / rect.width * 100,
701
+ value: 100 - top / rect.height * 100
702
+ });
703
+ }
704
+ function handleKeydown(event) {
705
+ if (props.disabled)
706
+ return;
707
+ const { shiftKey } = event;
708
+ const code = getEventCode(event);
709
+ const step = shiftKey ? 10 : 1;
710
+ let isPreventDefault = true;
711
+ switch (code) {
712
+ case EVENT_CODE.left:
713
+ incrementSaturation(-step);
714
+ break;
715
+ case EVENT_CODE.right:
716
+ incrementSaturation(step);
717
+ break;
718
+ case EVENT_CODE.up:
719
+ incrementBrightness(step);
720
+ break;
721
+ case EVENT_CODE.down:
722
+ incrementBrightness(-step);
723
+ break;
724
+ default:
725
+ isPreventDefault = false;
726
+ break;
727
+ }
728
+ isPreventDefault && event.preventDefault();
729
+ }
730
+ function incrementSaturation(step) {
731
+ let next = saturation.value + step;
732
+ next = next < 0 ? 0 : next > 100 ? 100 : next;
733
+ props.color.set("saturation", next);
734
+ }
735
+ function incrementBrightness(step) {
736
+ let next = brightness.value + step;
737
+ next = next < 0 ? 0 : next > 100 ? 100 : next;
738
+ props.color.set("value", next);
739
+ }
740
+ return {
741
+ cursorRef,
742
+ cursorTop,
743
+ cursorLeft,
744
+ background,
745
+ saturation,
746
+ brightness,
747
+ hue,
748
+ handleClick,
749
+ handleDrag,
750
+ handleKeydown
751
+ };
752
+ };
753
+ const useSvPanelDOM = (props, {
754
+ cursorTop,
755
+ cursorLeft,
756
+ background,
757
+ handleDrag
758
+ }) => {
759
+ const instance = getCurrentInstance();
760
+ const ns = useNamespace("color-svpanel");
761
+ function update() {
762
+ const saturation = props.color.get("saturation");
763
+ const brightness = props.color.get("value");
764
+ const el = instance.vnode.el;
765
+ const { clientWidth: width, clientHeight: height } = el;
766
+ cursorLeft.value = saturation * width / 100;
767
+ cursorTop.value = (100 - brightness) * height / 100;
768
+ background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
769
+ }
770
+ onMounted(() => {
771
+ draggable(instance.vnode.el, {
772
+ drag: (event) => {
773
+ handleDrag(event);
774
+ },
775
+ end: (event) => {
776
+ handleDrag(event);
777
+ }
778
+ });
779
+ update();
780
+ });
781
+ watch(
782
+ [
783
+ () => props.color.get("hue"),
784
+ () => props.color.get("value"),
785
+ () => props.color.value
786
+ ],
787
+ () => update()
788
+ );
789
+ const rootKls = computed(() => ns.b());
790
+ const cursorKls = computed(() => ns.e("cursor"));
791
+ const rootStyle = computed(() => ({
792
+ backgroundColor: background.value
793
+ }));
794
+ const cursorStyle = computed(() => ({
795
+ top: addUnit(cursorTop.value),
796
+ left: addUnit(cursorLeft.value)
797
+ }));
798
+ return {
799
+ rootKls,
800
+ cursorKls,
801
+ rootStyle,
802
+ cursorStyle,
803
+ update
804
+ };
805
+ };
806
+
807
+ const _hoisted_1 = ["tabindex", "aria-disabled", "aria-label", "aria-valuenow", "aria-valuetext"];
808
+ const _sfc_main$2 = defineComponent({
809
+ ...{
810
+ name: "ElSvPanel"
811
+ },
812
+ __name: "sv-panel",
813
+ props: svPanelProps,
814
+ setup(__props, { expose: __expose }) {
815
+ const props = __props;
816
+ const {
817
+ cursorRef,
818
+ cursorTop,
819
+ cursorLeft,
820
+ background,
821
+ saturation,
822
+ brightness,
823
+ handleClick,
824
+ handleDrag,
825
+ handleKeydown
826
+ } = useSvPanel(props);
827
+ const { rootKls, cursorKls, rootStyle, cursorStyle, update } = useSvPanelDOM(
828
+ props,
829
+ {
830
+ cursorTop,
831
+ cursorLeft,
832
+ background,
833
+ handleDrag
834
+ }
835
+ );
836
+ const { t } = useLocale();
837
+ const ariaLabel = computed(() => t("el.colorpicker.svLabel"));
838
+ const ariaValuetext = computed(() => {
839
+ return t("el.colorpicker.svDescription", {
840
+ saturation: saturation.value,
841
+ brightness: brightness.value,
842
+ color: props.color.value
843
+ });
844
+ });
845
+ __expose({
846
+ update
847
+ });
848
+ return (_ctx, _cache) => {
849
+ return openBlock(), createElementBlock(
850
+ "div",
851
+ {
852
+ class: normalizeClass(unref(rootKls)),
853
+ style: normalizeStyle(unref(rootStyle)),
854
+ onClick: _cache[1] || (_cache[1] = (...args) => unref(handleClick) && unref(handleClick)(...args))
855
+ },
856
+ [
857
+ createElementVNode("div", {
858
+ ref_key: "cursorRef",
859
+ ref: cursorRef,
860
+ class: normalizeClass(unref(cursorKls)),
861
+ style: normalizeStyle(unref(cursorStyle)),
862
+ tabindex: _ctx.disabled ? void 0 : 0,
863
+ "aria-disabled": _ctx.disabled,
864
+ role: "slider",
865
+ "aria-valuemin": "0,0",
866
+ "aria-valuemax": "100,100",
867
+ "aria-label": ariaLabel.value,
868
+ "aria-valuenow": `${unref(saturation)},${unref(brightness)}`,
869
+ "aria-valuetext": ariaValuetext.value,
870
+ onKeydown: _cache[0] || (_cache[0] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
871
+ }, null, 46, _hoisted_1)
872
+ ],
873
+ 6
874
+ );
875
+ };
876
+ }
877
+ });
878
+ var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/sv-panel.vue"]]);
879
+
880
+ const useCommonColor = (props, emit) => {
881
+ const color = reactive(
882
+ new Color({
883
+ enableAlpha: props.showAlpha,
884
+ format: props.colorFormat || "",
885
+ value: props.modelValue
886
+ })
887
+ );
888
+ watch(
889
+ () => [props.colorFormat, props.showAlpha],
890
+ () => {
891
+ color.enableAlpha = props.showAlpha;
892
+ color.format = props.colorFormat || color.format;
893
+ color.doOnChange();
894
+ emit(UPDATE_MODEL_EVENT, color.value);
895
+ }
896
+ );
897
+ return {
898
+ color
899
+ };
900
+ };
901
+
902
+ const _sfc_main$1 = defineComponent({
903
+ ...{
904
+ name: "ElColorPickerPanel"
905
+ },
906
+ __name: "color-picker-panel",
907
+ props: colorPickerPanelProps,
908
+ emits: colorPickerPanelEmits,
909
+ setup(__props, { expose: __expose, emit: __emit }) {
910
+ const props = __props;
911
+ const emit = __emit;
912
+ const ns = useNamespace("color-picker-panel");
913
+ const { formItem } = useFormItem();
914
+ const disabled = useFormDisabled();
915
+ const hueRef = ref();
916
+ const svRef = ref();
917
+ const alphaRef = ref();
918
+ const inputRef = ref();
919
+ const customInput = ref("");
920
+ const { color } = inject(
921
+ ROOT_COMMON_COLOR_INJECTION_KEY,
922
+ () => useCommonColor(props, emit),
923
+ true
924
+ );
925
+ function handleConfirm() {
926
+ color.fromString(customInput.value);
927
+ if (color.value !== customInput.value) {
928
+ customInput.value = color.value;
929
+ }
930
+ }
931
+ function handleFocusout() {
932
+ var _a;
933
+ if (props.validateEvent) {
934
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
935
+ }
936
+ }
937
+ function update() {
938
+ var _a, _b, _c;
939
+ (_a = hueRef.value) == null ? void 0 : _a.update();
940
+ (_b = svRef.value) == null ? void 0 : _b.update();
941
+ (_c = alphaRef.value) == null ? void 0 : _c.update();
942
+ }
943
+ onMounted(() => {
944
+ if (props.modelValue) {
945
+ customInput.value = color.value;
946
+ }
947
+ nextTick(update);
948
+ });
949
+ watch(
950
+ () => props.modelValue,
951
+ (newVal) => {
952
+ if (newVal !== color.value) {
953
+ newVal ? color.fromString(newVal) : color.clear();
954
+ }
955
+ }
956
+ );
957
+ watch(
958
+ () => color.value,
959
+ (val) => {
960
+ emit(UPDATE_MODEL_EVENT, val);
961
+ customInput.value = val;
962
+ if (props.validateEvent) {
963
+ formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
964
+ }
965
+ }
966
+ );
967
+ provide(colorPickerPanelContextKey, {
968
+ currentColor: computed(() => color.value)
969
+ });
970
+ __expose({
971
+ color,
972
+ inputRef,
973
+ update
974
+ });
975
+ return (_ctx, _cache) => {
976
+ return openBlock(), createElementBlock(
977
+ "div",
978
+ {
979
+ class: normalizeClass([unref(ns).b(), unref(ns).is("disabled", unref(disabled)), unref(ns).is("border", _ctx.border)]),
980
+ onFocusout: handleFocusout
981
+ },
982
+ [
983
+ createElementVNode(
984
+ "div",
985
+ {
986
+ class: normalizeClass(unref(ns).e("wrapper"))
987
+ },
988
+ [
989
+ createVNode(HueSlider, {
990
+ ref_key: "hueRef",
991
+ ref: hueRef,
992
+ class: "hue-slider",
993
+ color: unref(color),
994
+ vertical: "",
995
+ disabled: unref(disabled)
996
+ }, null, 8, ["color", "disabled"]),
997
+ createVNode(SvPanel, {
998
+ ref_key: "svRef",
999
+ ref: svRef,
1000
+ color: unref(color),
1001
+ disabled: unref(disabled)
1002
+ }, null, 8, ["color", "disabled"])
1003
+ ],
1004
+ 2
1005
+ ),
1006
+ _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
1007
+ key: 0,
1008
+ ref_key: "alphaRef",
1009
+ ref: alphaRef,
1010
+ color: unref(color),
1011
+ disabled: unref(disabled)
1012
+ }, null, 8, ["color", "disabled"])) : createCommentVNode("v-if", true),
1013
+ _ctx.predefine ? (openBlock(), createBlock(Predefine, {
1014
+ key: 1,
1015
+ ref: "predefine",
1016
+ "enable-alpha": _ctx.showAlpha,
1017
+ color: unref(color),
1018
+ colors: _ctx.predefine,
1019
+ disabled: unref(disabled)
1020
+ }, null, 8, ["enable-alpha", "color", "colors", "disabled"])) : createCommentVNode("v-if", true),
1021
+ createElementVNode(
1022
+ "div",
1023
+ {
1024
+ class: normalizeClass(unref(ns).e("footer"))
1025
+ },
1026
+ [
1027
+ createVNode(unref(ElInput), {
1028
+ ref_key: "inputRef",
1029
+ ref: inputRef,
1030
+ modelValue: customInput.value,
1031
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
1032
+ "validate-event": false,
1033
+ size: "small",
1034
+ disabled: unref(disabled),
1035
+ onChange: handleConfirm
1036
+ }, null, 8, ["modelValue", "disabled"]),
1037
+ renderSlot(_ctx.$slots, "footer")
1038
+ ],
1039
+ 2
1040
+ )
1041
+ ],
1042
+ 34
1043
+ );
1044
+ };
1045
+ }
1046
+ });
1047
+ var ColorPickerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/color-picker-panel.vue"]]);
1048
+
1049
+ const ElColorPickerPanel = withInstall(ColorPickerPanel);
1050
+
1051
+ var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return "string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return (r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return {r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return {r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return {h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return {r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return {h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return {h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e;},c=function(r){return {h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u;},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return {h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return [e,t[n][1]]}return [null,void 0]},x=function(r){return "string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},M=function(r,t){var n=c(r);return {h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return (299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return {h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i;},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u;},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u;},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r;},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r;},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return "number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t;},r.prototype.hue=function(r){var t=c(this.rgba);return "number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)};
1052
+
1053
+ const PRESET_COLORS = [
1054
+ "#409EFF",
1055
+ // Element Blue
1056
+ "#8B5CF6",
1057
+ // 紫罗兰
1058
+ "#EC4899",
1059
+ // 樱花粉
1060
+ "#EAB308",
1061
+ // 柠檬黄
1062
+ "#0EA5E9",
1063
+ // 天蓝色
1064
+ "#22C55E",
1065
+ // 浅绿色
1066
+ "#52525B",
1067
+ // 锌色灰
1068
+ "#14B8A6",
1069
+ // 深绿色(青)
1070
+ "#1D4ED8",
1071
+ // 深蓝色
1072
+ "#F97316",
1073
+ // 橙黄色
1074
+ "#E11D48",
1075
+ // 玫瑰红
1076
+ "#262626",
1077
+ // 中性色(近黑)
1078
+ "#475569",
1079
+ // 石板灰
1080
+ "#6B7280"
1081
+ // 中灰色
1082
+ ];
1083
+ const CSS_VARS = {
1084
+ "primary": "--el-color-primary",
1085
+ "light-3": "--el-color-primary-light-3",
1086
+ "light-5": "--el-color-primary-light-5",
1087
+ "light-7": "--el-color-primary-light-7",
1088
+ "light-8": "--el-color-primary-light-8",
1089
+ "light-9": "--el-color-primary-light-9",
1090
+ "dark-2": "--el-color-primary-dark-2"
1091
+ };
1092
+ function mix(baseColor, mixColor, weight) {
1093
+ const base = w(baseColor).toRgb();
1094
+ const blend = w(mixColor).toRgb();
1095
+ const p = weight / 100;
1096
+ return w({
1097
+ r: Math.round(base.r * (1 - p) + blend.r * p),
1098
+ g: Math.round(base.g * (1 - p) + blend.g * p),
1099
+ b: Math.round(base.b * (1 - p) + blend.b * p)
1100
+ }).toHex();
1101
+ }
1102
+ function generateLightTheme(primary) {
1103
+ return {
1104
+ primary,
1105
+ "light-3": mix(primary, "#ffffff", 30),
1106
+ "light-5": mix(primary, "#ffffff", 50),
1107
+ "light-7": mix(primary, "#ffffff", 70),
1108
+ "light-8": mix(primary, "#ffffff", 80),
1109
+ "light-9": mix(primary, "#ffffff", 90),
1110
+ // 很浅的背景色
1111
+ "dark-2": mix(primary, "#000000", 20)
1112
+ };
1113
+ }
1114
+ function generateDarkTheme(primary) {
1115
+ return {
1116
+ primary,
1117
+ "light-3": mix(primary, "#141414", 30),
1118
+ // 变暗
1119
+ "light-5": mix(primary, "#141414", 50),
1120
+ "light-7": mix(primary, "#141414", 70),
1121
+ "light-8": mix(primary, "#141414", 80),
1122
+ "light-9": mix(primary, "#141414", 90),
1123
+ // 深色调背景
1124
+ "dark-2": mix(primary, "#ffffff", 20)
1125
+ // active 状态反而变亮
1126
+ };
1127
+ }
1128
+ function applyTheme(color, isDark) {
1129
+ const colors = isDark ? generateDarkTheme(color) : generateLightTheme(color);
1130
+ const root = document.documentElement.style;
1131
+ Object.keys(CSS_VARS).forEach((key) => root.setProperty(CSS_VARS[key], colors[key]));
1132
+ }
1133
+ function useTheme(storageKey, darkStorageKey) {
1134
+ const isDark = useDark({ storageKey: darkStorageKey });
1135
+ const themeColor = useStorage(storageKey, PRESET_COLORS[0]);
1136
+ const setTheme = (color) => {
1137
+ if (!color) {
1138
+ return;
1139
+ }
1140
+ applyTheme(color, isDark.value);
1141
+ };
1142
+ onBeforeMount(() => setTheme(themeColor.value));
1143
+ watch(isDark, (dark) => applyTheme(themeColor.value, dark));
1144
+ return { themeColor, setTheme };
1145
+ }
1146
+
1147
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1148
+ __name: "color-switcher",
1149
+ props: {
1150
+ darkStorageKey: { default: "vc-dark" },
1151
+ storageKey: { default: "vc-primary-color" },
1152
+ size: { default: 28 }
1153
+ },
1154
+ emits: ["change"],
1155
+ setup(__props, { emit: __emit }) {
1156
+ const props = __props;
1157
+ const emits = __emit;
1158
+ const colorPickerRef = useTemplateRef("colorPickerRef");
1159
+ const { themeColor, setTheme } = useTheme(props.storageKey, props.darkStorageKey);
1160
+ const throttleSetTheme = throttle((val) => {
1161
+ setTheme(val);
1162
+ emits("change", val);
1163
+ }, 1e3);
1164
+ watch(themeColor, (val) => throttleSetTheme(val));
1165
+ return (_ctx, _cache) => {
1166
+ const _component_el_color_picker_panel = ElColorPickerPanel;
1167
+ const _component_el_popover = ElPopover;
1168
+ return openBlock(), createBlock(_component_el_popover, {
1169
+ placement: "bottom",
1170
+ trigger: "click",
1171
+ width: "auto",
1172
+ onShow: _cache[1] || (_cache[1] = ($event) => unref(colorPickerRef)?.update())
1173
+ }, {
1174
+ reference: withCtx(() => [
1175
+ createElementVNode("i", {
1176
+ class: normalizeClass(_ctx.$style["color-switcher"])
1177
+ }, [
1178
+ createVNode(Component$1, {
1179
+ name: "carbon:color-palette",
1180
+ size: __props.size
1181
+ }, null, 8, ["size"])
1182
+ ], 2)
1183
+ ]),
1184
+ default: withCtx(() => [
1185
+ createVNode(_component_el_color_picker_panel, {
1186
+ ref_key: "colorPickerRef",
1187
+ ref: colorPickerRef,
1188
+ modelValue: unref(themeColor),
1189
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(themeColor) ? themeColor.value = $event : null),
1190
+ predefine: [...unref(PRESET_COLORS)],
1191
+ border: false,
1192
+ "show-alpha": ""
1193
+ }, null, 8, ["modelValue", "predefine"])
1194
+ ]),
1195
+ _: 1
1196
+ });
1197
+ };
1198
+ }
1199
+ });
1200
+
1201
+ /* unplugin-vue-components disabled */const style0 = {
1202
+ "color-switcher": "_color-switcher_1n96n_1"
1203
+ };
1204
+
1205
+ const cssModules = {
1206
+ "$style": style0
1207
+ };
1208
+ const Component = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__cssModules", cssModules]]);
1209
+
1210
+ const __vite_glob_0_6 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1211
+ __proto__: null,
1212
+ default: Component
1213
+ }, Symbol.toStringTag, { value: 'Module' }));
1214
+
1215
+ export { Component as C, __vite_glob_0_6 as _ };