@veltra/desktop 1.0.7 → 1.0.9

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 (247) hide show
  1. package/dist/components/action/action-group.vue.d.ts +1 -1
  2. package/dist/components/action/action.vue.d.ts +3 -3
  3. package/dist/components/action/style.js +3 -0
  4. package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
  5. package/dist/components/auto-complete/style.js +5 -0
  6. package/dist/components/batch-edit/style.js +9 -0
  7. package/dist/components/breadcrumb/style2.css +0 -6
  8. package/dist/components/button/style.js +1 -0
  9. package/dist/components/cascade/cascade.js +15 -13
  10. package/dist/components/cascade/cascade.js.map +1 -1
  11. package/dist/components/cascade/cascade.vue.d.ts +3 -3
  12. package/dist/components/cascade/node.js.map +1 -1
  13. package/dist/components/cascade/style.js +7 -0
  14. package/dist/components/cascade/use-check.js +3 -2
  15. package/dist/components/cascade/use-check.js.map +1 -1
  16. package/dist/components/cascade/use-select.js +3 -3
  17. package/dist/components/cascade/use-select.js.map +1 -1
  18. package/dist/components/checkbox/style.js +1 -0
  19. package/dist/components/checkbox/style2.css +0 -8
  20. package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
  21. package/dist/components/checkbox-group/style.js +1 -0
  22. package/dist/components/context-menu/style.js +1 -0
  23. package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
  24. package/dist/components/date-picker/date-picker.js +9 -9
  25. package/dist/components/date-picker/date-picker.js.map +1 -1
  26. package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
  27. package/dist/components/date-picker/style.js +3 -0
  28. package/dist/components/date-range-picker/date-range-picker.js +9 -9
  29. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  30. package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
  31. package/dist/components/date-range-picker/style.js +3 -0
  32. package/dist/components/dialog/style.js +2 -0
  33. package/dist/components/drawer/style.js +1 -0
  34. package/dist/components/drawer/style2.css +4 -16
  35. package/dist/components/empty/style.js +1 -0
  36. package/dist/components/expression-editor/style.js +6 -0
  37. package/dist/components/file-picker/file-picker.vue.d.ts +1 -1
  38. package/dist/components/file-picker/helper.js +19 -7
  39. package/dist/components/file-picker/helper.js.map +1 -1
  40. package/dist/components/file-viewer/file-viewer.js +294 -0
  41. package/dist/components/file-viewer/file-viewer.js.map +1 -0
  42. package/dist/components/file-viewer/file-viewer.vue.d.ts +42 -0
  43. package/dist/components/file-viewer/helper.js +185 -0
  44. package/dist/components/file-viewer/helper.js.map +1 -0
  45. package/dist/components/file-viewer/index.d.ts +1 -0
  46. package/dist/components/file-viewer/previewers/docx-previewer.js +76 -0
  47. package/dist/components/file-viewer/previewers/docx-previewer.js.map +1 -0
  48. package/dist/components/file-viewer/previewers/image-previewer.js +64 -0
  49. package/dist/components/file-viewer/previewers/image-previewer.js.map +1 -0
  50. package/dist/components/file-viewer/previewers/pdf-previewer.js +90 -0
  51. package/dist/components/file-viewer/previewers/pdf-previewer.js.map +1 -0
  52. package/dist/components/file-viewer/previewers/sheet-previewer.js +175 -0
  53. package/dist/components/file-viewer/previewers/sheet-previewer.js.map +1 -0
  54. package/dist/components/file-viewer/previewers/text-previewer.js +74 -0
  55. package/dist/components/file-viewer/previewers/text-previewer.js.map +1 -0
  56. package/dist/components/file-viewer/previewers/video-previewer.js +62 -0
  57. package/dist/components/file-viewer/previewers/video-previewer.js.map +1 -0
  58. package/dist/components/file-viewer/style.d.ts +1 -0
  59. package/dist/components/file-viewer/style.js +4 -0
  60. package/dist/components/file-viewer/style2.css +445 -0
  61. package/dist/components/float-button/style.js +1 -0
  62. package/dist/components/form/style.js +2 -0
  63. package/dist/components/form-item/style.js +1 -0
  64. package/dist/components/form-item/style2.css +2 -3
  65. package/dist/components/grid-input/grid-input.vue.d.ts +1 -1
  66. package/dist/components/index.d.ts +12 -9
  67. package/dist/components/input/input.vue.d.ts +2 -2
  68. package/dist/components/input/style.js +1 -0
  69. package/dist/components/layout/style.js +1 -0
  70. package/dist/components/list/style.js +1 -0
  71. package/dist/components/loading/style2.css +16 -20
  72. package/dist/components/menu/style.js +2 -0
  73. package/dist/components/menu/style2.css +0 -78
  74. package/dist/components/multi-select/multi-select-option.js +14 -10
  75. package/dist/components/multi-select/multi-select-option.js.map +1 -1
  76. package/dist/components/multi-select/multi-select.js +16 -19
  77. package/dist/components/multi-select/multi-select.js.map +1 -1
  78. package/dist/components/multi-select/multi-select.vue.d.ts +3 -3
  79. package/dist/components/multi-select/style.js +7 -0
  80. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +4 -4
  81. package/dist/components/multi-tree-select/style.js +7 -0
  82. package/dist/components/notification/notification.vue.d.ts +1 -1
  83. package/dist/components/number-input/number-input.vue.d.ts +2 -2
  84. package/dist/components/number-input/style.js +1 -0
  85. package/dist/components/number-range-input/number-range-input.vue.d.ts +2 -2
  86. package/dist/components/number-range-input/style.js +1 -0
  87. package/dist/components/paginator/style.js +3 -0
  88. package/dist/components/palette/di.js.map +1 -1
  89. package/dist/components/palette/palette-alpha.js +7 -10
  90. package/dist/components/palette/palette-alpha.js.map +1 -1
  91. package/dist/components/palette/palette-hue.js +5 -7
  92. package/dist/components/palette/palette-hue.js.map +1 -1
  93. package/dist/components/palette/palette-sv.js +8 -10
  94. package/dist/components/palette/palette-sv.js.map +1 -1
  95. package/dist/components/palette/palette.js +22 -24
  96. package/dist/components/palette/palette.js.map +1 -1
  97. package/dist/components/palette/style.js +3 -0
  98. package/dist/components/password-input/password-input.vue.d.ts +1 -1
  99. package/dist/components/password-input/style.js +2 -0
  100. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  101. package/dist/components/pop-confirm/style.js +3 -0
  102. package/dist/components/progress-nodes/progress-nodes.vue.d.ts +2 -2
  103. package/dist/components/progress-nodes/style2.css +79 -33
  104. package/dist/components/radio/style2.css +0 -8
  105. package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
  106. package/dist/components/radio-group/style.js +1 -0
  107. package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +2 -2
  108. package/dist/components/select/select.js +14 -12
  109. package/dist/components/select/select.js.map +1 -1
  110. package/dist/components/select/select.vue.d.ts +2 -2
  111. package/dist/components/select/style.js +5 -0
  112. package/dist/components/select/style2.css +0 -20
  113. package/dist/components/slider/slider-thumb.js +10 -13
  114. package/dist/components/slider/slider-thumb.js.map +1 -1
  115. package/dist/components/slider/slider.js +12 -15
  116. package/dist/components/slider/slider.js.map +1 -1
  117. package/dist/components/steps/style.js +2 -0
  118. package/dist/components/steps/style2.css +28 -35
  119. package/dist/components/switch/style2.css +0 -3
  120. package/dist/components/table/di.js.map +1 -1
  121. package/dist/components/table/node/row.d.ts +10 -1
  122. package/dist/components/table/node/row.js +9 -0
  123. package/dist/components/table/node/row.js.map +1 -1
  124. package/dist/components/table/style.js +7 -0
  125. package/dist/components/table/style2.css +0 -41
  126. package/dist/components/table/table-body.js +25 -26
  127. package/dist/components/table/table-body.js.map +1 -1
  128. package/dist/components/table/table-cell.js +16 -9
  129. package/dist/components/table/table-cell.js.map +1 -1
  130. package/dist/components/table/table-row.js +78 -19
  131. package/dist/components/table/table-row.js.map +1 -1
  132. package/dist/components/table/table.js +76 -34
  133. package/dist/components/table/table.js.map +1 -1
  134. package/dist/components/table/use-fixed-columns.js +27 -8
  135. package/dist/components/table/use-fixed-columns.js.map +1 -1
  136. package/dist/components/table/use-rows.js +2 -2
  137. package/dist/components/table/use-rows.js.map +1 -1
  138. package/dist/components/table/use-table.js +25 -3
  139. package/dist/components/table/use-table.js.map +1 -1
  140. package/dist/components/table-editor/style.js +2 -0
  141. package/dist/components/tabs/index.d.ts +3 -1
  142. package/dist/components/tabs/style.js +2 -0
  143. package/dist/components/tabs/style2.css +169 -107
  144. package/dist/components/tabs/tabs-horizontal.js +133 -0
  145. package/dist/components/tabs/tabs-horizontal.js.map +1 -0
  146. package/dist/components/tabs/tabs-horizontal.vue.d.ts +29 -0
  147. package/dist/components/tabs/tabs-vertical.js +89 -0
  148. package/dist/components/tabs/tabs-vertical.js.map +1 -0
  149. package/dist/components/tabs/tabs-vertical.vue.d.ts +28 -0
  150. package/dist/components/tabs/tabs.js +75 -105
  151. package/dist/components/tabs/tabs.js.map +1 -1
  152. package/dist/components/tabs/tabs.vue.d.ts +9 -23
  153. package/dist/components/tabs/use-tabs-bar.js +105 -0
  154. package/dist/components/tabs/use-tabs-bar.js.map +1 -0
  155. package/dist/components/tag/style2.css +0 -6
  156. package/dist/components/textarea/style.js +1 -0
  157. package/dist/components/textarea/textarea.vue.d.ts +2 -2
  158. package/dist/components/theme/style.js +5 -0
  159. package/dist/components/tip/tip.vue.d.ts +2 -2
  160. package/dist/components/tree/style.js +4 -0
  161. package/dist/components/tree/style2.css +45 -23
  162. package/dist/components/tree/tree-node.js +50 -35
  163. package/dist/components/tree/tree-node.js.map +1 -1
  164. package/dist/components/tree/tree.js +27 -20
  165. package/dist/components/tree/tree.js.map +1 -1
  166. package/dist/components/tree/tree.vue.d.ts +1 -1
  167. package/dist/components/tree/use-check.js +52 -14
  168. package/dist/components/tree/use-check.js.map +1 -1
  169. package/dist/components/tree/use-tree-nodes.js +51 -24
  170. package/dist/components/tree/use-tree-nodes.js.map +1 -1
  171. package/dist/components/tree-select/style.js +4 -0
  172. package/dist/components/tree-select/tree-select.vue.d.ts +3 -3
  173. package/dist/components/watermark/watermark.vue.d.ts +1 -1
  174. package/dist/index.d.ts +57 -53
  175. package/dist/index.js +51 -48
  176. package/dist/types/file-viewer.d.ts +71 -0
  177. package/dist/types/index.d.ts +4 -3
  178. package/dist/types/tabs.d.ts +106 -14
  179. package/dist/types/tree.d.ts +6 -1
  180. package/package.json +32 -31
  181. package/src/components/breadcrumb/style.scss +0 -6
  182. package/src/components/cascade/cascade.vue +18 -18
  183. package/src/components/cascade/node.ts +4 -1
  184. package/src/components/cascade/use-check.ts +5 -4
  185. package/src/components/cascade/use-select.ts +4 -5
  186. package/src/components/checkbox/style.scss +0 -4
  187. package/src/components/date-picker/date-picker.vue +10 -9
  188. package/src/components/date-range-picker/date-range-picker.vue +12 -12
  189. package/src/components/drawer/style.scss +18 -11
  190. package/src/components/file-picker/helper.ts +21 -10
  191. package/src/components/file-viewer/file-viewer.vue +311 -0
  192. package/src/components/file-viewer/helper.ts +193 -0
  193. package/src/components/file-viewer/index.ts +1 -0
  194. package/src/components/file-viewer/previewers/docx-previewer.vue +78 -0
  195. package/src/components/file-viewer/previewers/image-previewer.vue +64 -0
  196. package/src/components/file-viewer/previewers/pdf-previewer.vue +90 -0
  197. package/src/components/file-viewer/previewers/sheet-previewer.vue +210 -0
  198. package/src/components/file-viewer/previewers/text-previewer.vue +76 -0
  199. package/src/components/file-viewer/previewers/video-previewer.vue +72 -0
  200. package/src/components/file-viewer/style.scss +504 -0
  201. package/src/components/file-viewer/style.ts +4 -0
  202. package/src/components/form-item/style.scss +2 -3
  203. package/src/components/index.ts +2 -0
  204. package/src/components/loading/style.scss +125 -126
  205. package/src/components/menu/style.scss +0 -31
  206. package/src/components/multi-select/multi-select-option.vue +16 -3
  207. package/src/components/multi-select/multi-select.vue +17 -9
  208. package/src/components/palette/di.ts +5 -3
  209. package/src/components/palette/palette-alpha.vue +7 -10
  210. package/src/components/palette/palette-hue.vue +5 -7
  211. package/src/components/palette/palette-sv.vue +12 -14
  212. package/src/components/palette/palette.vue +19 -21
  213. package/src/components/progress-nodes/style.scss +28 -22
  214. package/src/components/radio/style.scss +0 -4
  215. package/src/components/select/select.vue +21 -19
  216. package/src/components/select/style.scss +0 -12
  217. package/src/components/slider/slider-thumb.vue +11 -14
  218. package/src/components/slider/slider.vue +15 -15
  219. package/src/components/steps/style.scss +10 -10
  220. package/src/components/switch/style.scss +0 -4
  221. package/src/components/table/di.ts +20 -3
  222. package/src/components/table/node/row.ts +10 -1
  223. package/src/components/table/style.scss +0 -26
  224. package/src/components/table/table-body.vue +28 -33
  225. package/src/components/table/table-cell.vue +17 -9
  226. package/src/components/table/table-row.tsx +83 -17
  227. package/src/components/table/table.vue +73 -45
  228. package/src/components/table/use-fixed-columns.ts +46 -12
  229. package/src/components/table/use-rows.ts +14 -3
  230. package/src/components/table/use-table.ts +27 -3
  231. package/src/components/tabs/index.ts +2 -0
  232. package/src/components/tabs/style.scss +217 -134
  233. package/src/components/tabs/tabs-horizontal.vue +125 -0
  234. package/src/components/tabs/tabs-vertical.vue +75 -0
  235. package/src/components/tabs/tabs.vue +56 -127
  236. package/src/components/tabs/use-tabs-bar.ts +119 -0
  237. package/src/components/tag/style.scss +0 -6
  238. package/src/components/tree/style.scss +74 -29
  239. package/src/components/tree/tree-node.vue +10 -4
  240. package/src/components/tree/tree.vue +39 -12
  241. package/src/components/tree/use-check.ts +79 -23
  242. package/src/components/tree/use-tree-nodes.ts +85 -34
  243. package/src/types/file-viewer.ts +69 -0
  244. package/src/types/index.ts +1 -0
  245. package/src/types/tabs.ts +113 -19
  246. package/src/types/tree.ts +6 -1
  247. package/dist/types/index.js +0 -0
@@ -20,6 +20,7 @@ $root-name: loading;
20
20
  // line
21
21
  @include m.e(line) {
22
22
  @include m.bem($root-name, loader) {
23
+ $c: no-repeat linear-gradient(#{fn.use-var(text-color, main)} 0 0);
23
24
  width: 40px;
24
25
  aspect-ratio: 1;
25
26
  display: grid;
@@ -28,12 +29,11 @@ $root-name: loading;
28
29
  &::after {
29
30
  content: '';
30
31
  grid-area: 1/1;
31
- --c: no-repeat linear-gradient(#{fn.use-var(text-color, main)} 0 0);
32
32
  background:
33
- var(--c) 0 0,
34
- var(--c) 100% 0,
35
- var(--c) 100% 100%,
36
- var(--c) 0 100%;
33
+ #{$c} 0 0,
34
+ #{$c} 100% 0,
35
+ #{$c} 100% 100%,
36
+ #{$c} 0 100%;
37
37
  animation:
38
38
  line-1 2s infinite linear,
39
39
  line-2 2s infinite linear;
@@ -48,6 +48,7 @@ $root-name: loading;
48
48
  // spinner
49
49
  @include m.e(spinner) {
50
50
  @include m.bem($root-name, loader) {
51
+ $c: no-repeat radial-gradient(farthest-side, #{fn.use-var(text-color, main)} 92%, #0000);
51
52
  width: 50px;
52
53
  aspect-ratio: 1;
53
54
  display: grid;
@@ -57,12 +58,11 @@ $root-name: loading;
57
58
  content: '';
58
59
  grid-area: 1/1;
59
60
 
60
- --c: no-repeat radial-gradient(farthest-side, #{fn.use-var(text-color, main)} 92%, #0000);
61
61
  background:
62
- var(--c) 50% 0,
63
- var(--c) 50% 100%,
64
- var(--c) 100% 50%,
65
- var(--c) 0 50%;
62
+ #{$c} 50% 0,
63
+ #{$c} 50% 100%,
64
+ #{$c} 100% 50%,
65
+ #{$c} 0 50%;
66
66
  background-size: 12px 12px;
67
67
  animation: spinner 1s infinite;
68
68
  }
@@ -78,12 +78,12 @@ $root-name: loading;
78
78
  // dot
79
79
  @include m.e(dot) {
80
80
  @include m.bem($root-name, loader) {
81
+ $c: no-repeat radial-gradient(farthest-side, #{fn.use-var(text-color, main)} 93%, #0000);
81
82
  width: 40px;
82
83
  height: 20px;
83
- --c: no-repeat radial-gradient(farthest-side, #{fn.use-var(text-color, main)} 93%, #0000);
84
84
  background:
85
- var(--c) 0 0,
86
- var(--c) 50% 0;
85
+ #{$c} 0 0,
86
+ #{$c} 50% 0;
87
87
  background-size: 8px 8px;
88
88
  position: relative;
89
89
  clip-path: inset(-200% -100% 0 0);
@@ -117,25 +117,24 @@ $root-name: loading;
117
117
  // classic
118
118
  @include m.e(classic) {
119
119
  @include m.bem($root-name, loader) {
120
- --w: 6ch;
121
120
  font-size: fn.use-var(font-size, title, default);
122
121
  line-height: 1.4em;
123
- letter-spacing: var(--w);
124
- width: var(--w);
122
+ letter-spacing: 6ch;
123
+ width: 6ch;
125
124
  overflow: hidden;
126
125
  white-space: nowrap;
127
126
  color: #0000;
128
127
  text-shadow:
129
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
130
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
131
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
132
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
133
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
134
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
135
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
136
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
137
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
138
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
128
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
129
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
130
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
131
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
132
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
133
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
134
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
135
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
136
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
137
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
139
138
  animation: classic 2s infinite linear;
140
139
 
141
140
  &::before {
@@ -243,133 +242,133 @@ $root-name: loading;
243
242
  @keyframes classic {
244
243
  9.09% {
245
244
  text-shadow:
246
- calc(0 * var(--w)) -10px #{fn.use-var(text-color, main)},
247
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
248
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
249
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
250
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
251
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
252
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
253
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
254
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
255
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
245
+ calc(0 * 6ch) -10px #{fn.use-var(text-color, main)},
246
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
247
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
248
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
249
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
250
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
251
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
252
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
253
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
254
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
256
255
  }
257
256
  18.18% {
258
257
  text-shadow:
259
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
260
- calc(-1 * var(--w)) -10px #{fn.use-var(text-color, main)},
261
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
262
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
263
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
264
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
265
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
266
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
267
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
268
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
258
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
259
+ calc(-1 * 6ch) -10px #{fn.use-var(text-color, main)},
260
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
261
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
262
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
263
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
264
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
265
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
266
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
267
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
269
268
  }
270
269
  27.27% {
271
270
  text-shadow:
272
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
273
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
274
- calc(-2 * var(--w)) -10px #{fn.use-var(text-color, main)},
275
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
276
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
277
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
278
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
279
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
280
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
281
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
271
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
272
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
273
+ calc(-2 * 6ch) -10px #{fn.use-var(text-color, main)},
274
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
275
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
276
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
277
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
278
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
279
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
280
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
282
281
  }
283
282
  36.36% {
284
283
  text-shadow:
285
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
286
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
287
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
288
- calc(-3 * var(--w)) -10px #{fn.use-var(text-color, main)},
289
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
290
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
291
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
292
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
293
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
294
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
284
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
285
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
286
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
287
+ calc(-3 * 6ch) -10px #{fn.use-var(text-color, main)},
288
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
289
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
290
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
291
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
292
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
293
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
295
294
  }
296
295
  45.45% {
297
296
  text-shadow:
298
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
299
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
300
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
301
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
302
- calc(-4 * var(--w)) -10px #{fn.use-var(text-color, main)},
303
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
304
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
305
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
306
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
307
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
297
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
298
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
299
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
300
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
301
+ calc(-4 * 6ch) -10px #{fn.use-var(text-color, main)},
302
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
303
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
304
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
305
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
306
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
308
307
  }
309
308
  54.54% {
310
309
  text-shadow:
311
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
312
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
313
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
314
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
315
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
316
- calc(-5 * var(--w)) -10px #{fn.use-var(text-color, main)};
317
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
318
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
319
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
320
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
310
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
311
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
312
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
313
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
314
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
315
+ calc(-5 * 6ch) -10px #{fn.use-var(text-color, main)};
316
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
317
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
318
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
319
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
321
320
  }
322
321
  63.63% {
323
322
  text-shadow:
324
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
325
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
326
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
327
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
328
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
329
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
330
- // calc(-6 * var(--w)) -10px #{fn.use-var(text-color, main)},
331
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
332
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
333
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
323
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
324
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
325
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
326
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
327
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
328
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
329
+ // calc(-6 * 6ch) -10px #{fn.use-var(text-color, main)},
330
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
331
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
332
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
334
333
  }
335
334
  72.72% {
336
335
  text-shadow:
337
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
338
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
339
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
340
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
341
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
342
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
343
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
344
- // calc(-7 * var(--w)) -10px #{fn.use-var(text-color, main)},
345
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
346
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
336
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
337
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
338
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
339
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
340
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
341
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
342
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
343
+ // calc(-7 * 6ch) -10px #{fn.use-var(text-color, main)},
344
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
345
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
347
346
  }
348
347
  81.81% {
349
348
  text-shadow:
350
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
351
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
352
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
353
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
354
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
355
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
356
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
357
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
358
- // calc(-8 * var(--w)) -10px #{fn.use-var(text-color, main)},
359
- // calc(-9 * var(--w)) 0 #{fn.use-var(text-color, main)};
349
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
350
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
351
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
352
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
353
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
354
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
355
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
356
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
357
+ // calc(-8 * 6ch) -10px #{fn.use-var(text-color, main)},
358
+ // calc(-9 * 6ch) 0 #{fn.use-var(text-color, main)};
360
359
  }
361
360
  90.90% {
362
361
  text-shadow:
363
- calc(0 * var(--w)) 0 #{fn.use-var(text-color, main)},
364
- calc(-1 * var(--w)) 0 #{fn.use-var(text-color, main)},
365
- calc(-2 * var(--w)) 0 #{fn.use-var(text-color, main)},
366
- calc(-3 * var(--w)) 0 #{fn.use-var(text-color, main)},
367
- calc(-4 * var(--w)) 0 #{fn.use-var(text-color, main)},
368
- calc(-5 * var(--w)) 0 #{fn.use-var(text-color, main)};
369
- // calc(-6 * var(--w)) 0 #{fn.use-var(text-color, main)},
370
- // calc(-7 * var(--w)) 0 #{fn.use-var(text-color, main)},
371
- // calc(-8 * var(--w)) 0 #{fn.use-var(text-color, main)},
372
- // calc(-9 * var(--w)) -10px #{fn.use-var(text-color, main)};
362
+ calc(0 * 6ch) 0 #{fn.use-var(text-color, main)},
363
+ calc(-1 * 6ch) 0 #{fn.use-var(text-color, main)},
364
+ calc(-2 * 6ch) 0 #{fn.use-var(text-color, main)},
365
+ calc(-3 * 6ch) 0 #{fn.use-var(text-color, main)},
366
+ calc(-4 * 6ch) 0 #{fn.use-var(text-color, main)},
367
+ calc(-5 * 6ch) 0 #{fn.use-var(text-color, main)};
368
+ // calc(-6 * 6ch) 0 #{fn.use-var(text-color, main)},
369
+ // calc(-7 * 6ch) 0 #{fn.use-var(text-color, main)},
370
+ // calc(-8 * 6ch) 0 #{fn.use-var(text-color, main)},
371
+ // calc(-9 * 6ch) -10px #{fn.use-var(text-color, main)};
373
372
  }
374
373
  }
375
374
 
@@ -7,28 +7,6 @@ $root-name: menu;
7
7
  $collapsed-menu: collapsed-menu;
8
8
 
9
9
  @include m.b($root-name, $collapsed-menu) {
10
- --u-menu-color: #0f172a;
11
- --u-menu-hover-bg: rgba(148, 163, 184, 0.12);
12
- --u-menu-hover-color: #{fn.use-var(text-color, title)};
13
- --u-menu-active-bg: rgba(59, 130, 246, 0.12);
14
- --u-menu-active-color: var(--u-color-primary-dark-1);
15
- --u-menu-height-small: 32px;
16
- --u-menu-height-default: 36px;
17
- --u-menu-height-large: 40px;
18
- --u-menu-bg-color: #{fn.use-var(bg-color, top)};
19
- --u-menu-bg-blur: none;
20
- --u-menu-bg-saturate: none;
21
- --u-menu-bg-image: none;
22
-
23
- @include m.dark() {
24
- --u-menu-color: #{fn.use-var(text-color, main)};
25
- --u-menu-hover-bg: rgba(148, 163, 184, 0.14);
26
- --u-menu-hover-color: #{fn.use-var(text-color, title)};
27
- --u-menu-active-bg: rgba(96, 165, 250, 0.2);
28
- --u-menu-active-color: #{fn.use-var(text-color, white)};
29
- --u-menu-bg-color: #{fn.use-var(bg-color, middle)};
30
- }
31
-
32
10
  user-select: none;
33
11
  color: var(--u-menu-color);
34
12
 
@@ -124,15 +102,6 @@ $collapsed-menu: collapsed-menu;
124
102
  }
125
103
 
126
104
  @include m.b($root-name) {
127
- --u-menu-bg-color: #{fn.use-var(bg-color, top)};
128
- --u-menu-bg-blur: none;
129
- --u-menu-bg-saturate: none;
130
- --u-menu-bg-image: none;
131
-
132
- @include m.dark() {
133
- --u-menu-bg-color: #{fn.use-var(bg-color, middle)};
134
- }
135
-
136
105
  margin: 0;
137
106
  padding: 0;
138
107
  background-color: var(--u-menu-bg-color);
@@ -5,7 +5,7 @@
5
5
  @mousedown="handleMousedown"
6
6
  @mouseup="handleMouseup"
7
7
  @mouseleave="handleMouseleave"
8
- :ref="measureElement"
8
+ :ref="measureRef"
9
9
  >
10
10
  <u-checkbox
11
11
  :class="checkboxClass"
@@ -30,13 +30,26 @@ defineOptions({
30
30
  name: 'MultiSelectOption'
31
31
  })
32
32
 
33
- const { disabled = false, checked } = defineProps<{
33
+ const props = defineProps<{
34
34
  option: Record<string, any>
35
35
  disabled?: boolean
36
36
  checked: boolean
37
- measureElement?: (el: any) => void
37
+ /**
38
+ * 虚拟项索引:对应 `options` 数组中的绝对位置。
39
+ * 非虚拟模式下可省略;虚拟模式下必须传入,否则元素卸载时 Virtualizer 无法及时解绑,
40
+ * 会因为 ResizeObserver 对脱离 DOM 的元素回调 size=0 而污染尺寸缓存。
41
+ */
42
+ index?: number
43
+ measureElement?: (index: number, el: Element | null) => void
38
44
  }>()
39
45
 
46
+ const { disabled = false, checked } = props
47
+
48
+ function measureRef(el: unknown) {
49
+ if (typeof props.index !== 'number' || !props.measureElement) return
50
+ props.measureElement(props.index, el as Element | null)
51
+ }
52
+
40
53
  const emit = defineEmits<{
41
54
  (e: 'check', checked: boolean): void
42
55
  }>()
@@ -74,13 +74,16 @@
74
74
  </div>
75
75
 
76
76
  <!-- 多选列表 -->
77
+ <!--
78
+ 虚拟化启用时内容容器 height 由 useVirtualizer 命令式写入;
79
+ 模板不再绑定 totalSize,避免尺寸变化引起重渲染。
80
+ -->
77
81
  <u-scroll
78
82
  tag="ul"
79
83
  :class="[cls.e('options')]"
80
84
  ref="scrollRef"
81
85
  v-if="options.length"
82
86
  :content-class="[cls.e('options-wrap'), bem.is('virtual', virtualEnabled)]"
83
- :content-style="{ height: virtualEnabled ? withUnit(totalHeight, 'px') : undefined }"
84
87
  >
85
88
  <template v-if="virtualEnabled">
86
89
  <u-multi-select-option
@@ -91,7 +94,7 @@
91
94
  :style="{ transform: `translateY(${offset}px)` }"
92
95
  @check="handleCheck(option, $event)"
93
96
  :checked="checkedSet.has(option)"
94
- :data-index="index"
97
+ :index="index"
95
98
  :measure-element="measureElement"
96
99
  >
97
100
  <slot v-bind="{ option, index }">
@@ -137,9 +140,9 @@
137
140
 
138
141
  <script lang="ts" setup>
139
142
  import { o as chainObj } from '@cat-kit/core'
140
- import { useFormComponent, useFormFallbackProps, useVirtual } from '@veltra/compositions'
143
+ import { useFormComponent, useFormFallbackProps, useVirtualizer } from '@veltra/compositions'
141
144
  import { ArrowDown, Close, Search } from '@veltra/icons/normal'
142
- import { bem, FORM_EMPTY_CONTENT, withUnit } from '@veltra/utils'
145
+ import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
143
146
  import { computed, shallowRef, shallowReactive, watch, provide } from 'vue'
144
147
 
145
148
  import type {
@@ -209,30 +212,35 @@ const allOptions = computed(() => {
209
212
  return [...createdOptions.value, ...rawAllOptions.value]
210
213
  })
211
214
 
212
- const { totalHeight, virtualList, virtualEnabled, measureElement } = useVirtual({
213
- virtualThreshold: 80,
215
+ const virtualEnabled = computed(() => options.value.length > 80)
216
+
217
+ const { virtualizer, items } = useVirtualizer({
214
218
  estimateSize: () => 40,
215
219
  count: computed(() => options.value.length),
216
- scrollEl: computed(() => scrollRef.value?.containerRef ?? null)
220
+ scrollEl: () => scrollRef.value?.containerRef ?? null,
221
+ contentEl: () => (virtualEnabled.value ? (scrollRef.value?.contentRef ?? null) : null)
217
222
  })
218
223
 
219
224
  const virtualOptions = computed(() => {
220
225
  const { valueKey, labelKey } = props
221
226
  const _options = options.value
222
- return virtualList.value.map((v) => {
227
+ return items.value.map((v) => {
223
228
  const option = _options[v.index]!
224
229
  const val = chainObj(option).get(valueKey)
225
230
  return {
226
231
  option,
227
232
  index: v.index,
228
233
  val,
229
- key: v.key,
234
+ key: v.index,
230
235
  offset: v.start,
231
236
  label: chainObj(option).get(labelKey)
232
237
  }
233
238
  })
234
239
  })
235
240
 
241
+ const measureElement: (index: number, el: Element | null) => void = (index, el) =>
242
+ virtualizer.measureElement(index, el)
243
+
236
244
  const filterable = computed(() => {
237
245
  return props.filterable || props.creatable || typeof props.options === 'function'
238
246
  })
@@ -1,4 +1,4 @@
1
- import type { Updater } from '@veltra/compositions'
1
+ import type { UserAction } from '@veltra/compositions'
2
2
  import type { BEM } from '@veltra/utils'
3
3
  import type { InjectionKey, Ref, ComputedRef } from 'vue'
4
4
 
@@ -14,8 +14,10 @@ export const PaletteDIKey: InjectionKey<{
14
14
  RGB: ComputedRef<PaletteRGB>
15
15
  /** 透明度 */
16
16
  alpha: Ref<number>
17
- /** 更新器 */
18
- updater: Updater
17
+ /** 将函数包装为用户动作(阻断 modelValue 回流副作用) */
18
+ userAction: UserAction
19
+ /** 当前是否处于用户动作期间 */
20
+ isUserActive: () => boolean
19
21
  /** 更新色调 */
20
22
  updateHue: (deg: number) => void
21
23
  /** 更新调色盘透明度 */
@@ -16,7 +16,7 @@ defineOptions({
16
16
  name: 'PaletteAlpha'
17
17
  })
18
18
 
19
- const { cls, updateAlpha, hueRGB, alpha, updater } = inject(PaletteDIKey)!
19
+ const { cls, updateAlpha, hueRGB, alpha, userAction, isUserActive } = inject(PaletteDIKey)!
20
20
 
21
21
  const alphaRef = shallowRef<HTMLElement>()
22
22
 
@@ -34,12 +34,10 @@ function getAlphaWidth() {
34
34
  rangeX[1] = alphaWidth
35
35
  }
36
36
 
37
- function updateOffsetX(offsetX: number) {
38
- updater.updateAndLock(() => {
39
- alphaThumbTransformX.value = offsetX
40
- updateAlpha(alphaWidth > 0 ? offsetX / alphaWidth : 0)
41
- })
42
- }
37
+ const updateOffsetX = userAction((offsetX: number) => {
38
+ alphaThumbTransformX.value = offsetX
39
+ updateAlpha(alphaWidth > 0 ? offsetX / alphaWidth : 0)
40
+ })
43
41
 
44
42
  const alphaDragger = useDrag({
45
43
  target: alphaRef,
@@ -73,9 +71,8 @@ onMounted(() => {
73
71
  watch(
74
72
  alpha,
75
73
  (newAlphaValue) => {
76
- updater.update(() => {
77
- alphaThumbTransformX.value = alphaWidth > 0 ? alphaWidth * newAlphaValue : 0
78
- })
74
+ if (isUserActive()) return
75
+ alphaThumbTransformX.value = alphaWidth > 0 ? alphaWidth * newAlphaValue : 0
79
76
  },
80
77
  { flush: 'post' }
81
78
  )
@@ -15,7 +15,7 @@ defineOptions({
15
15
  name: 'PaletteHue'
16
16
  })
17
17
 
18
- const { cls, updateHue, HSV, updater } = inject(PaletteDIKey)!
18
+ const { cls, updateHue, HSV, userAction } = inject(PaletteDIKey)!
19
19
 
20
20
  const hueRef = shallowRef<HTMLElement>()
21
21
 
@@ -33,12 +33,10 @@ function getSliderWidth() {
33
33
  rangeX[1] = sliderWidth
34
34
  }
35
35
 
36
- function updateOffsetX(offsetX: number) {
37
- updater.updateAndLock(() => {
38
- transformX.value = offsetX
39
- updateHue(Math.round((offsetX / sliderWidth) * 360))
40
- })
41
- }
36
+ const updateOffsetX = userAction((offsetX: number) => {
37
+ transformX.value = offsetX
38
+ updateHue(Math.round((offsetX / sliderWidth) * 360))
39
+ })
42
40
 
43
41
  const sliderDragger = useDrag({
44
42
  target: hueRef,
@@ -24,7 +24,7 @@ defineOptions({
24
24
  name: 'PaletteSV'
25
25
  })
26
26
 
27
- const { cls, hueRGB, HSV, updateSV, updater } = inject(PaletteDIKey)!
27
+ const { cls, hueRGB, HSV, updateSV, userAction } = inject(PaletteDIKey)!
28
28
 
29
29
  const svRef = shallowRef<HTMLDivElement>()
30
30
 
@@ -58,21 +58,19 @@ const svThumbStyle = computed(() => {
58
58
  }
59
59
  })
60
60
 
61
- function updateThumb(offsetX: number, offsetY: number) {
62
- updater.updateAndLock(() => {
63
- transform.x = offsetX
64
- transform.y = offsetY
61
+ const updateThumb = userAction((offsetX: number, offsetY: number) => {
62
+ transform.x = offsetX
63
+ transform.y = offsetY
65
64
 
66
- // 根据画布位置计算饱和度和亮度
67
- // 水平方向表示饱和度,从左到右饱和度逐渐增高
68
- // 垂直方向表示亮度,上亮下暗
69
- const s = Math.max(0, Math.min(1, offsetX / canvasSize.width))
70
- const v = Math.max(0, Math.min(1, 1 - offsetY / canvasSize.height))
65
+ // 根据画布位置计算饱和度和亮度
66
+ // 水平方向表示饱和度,从左到右饱和度逐渐增高
67
+ // 垂直方向表示亮度,上亮下暗
68
+ const s = Math.max(0, Math.min(1, offsetX / canvasSize.width))
69
+ const v = Math.max(0, Math.min(1, 1 - offsetY / canvasSize.height))
71
70
 
72
- // 更新饱和度和亮度
73
- updateSV({ s, v })
74
- })
75
- }
71
+ // 更新饱和度和亮度
72
+ updateSV({ s, v })
73
+ })
76
74
 
77
75
  const svDragger = useDrag({
78
76
  target: svRef,