hys-ui 0.2.0 → 0.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 (261) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +68 -59
  3. package/dist/components/HysAlert/HysAlert.vue.js +5 -54
  4. package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
  5. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
  6. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +146 -2
  7. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
  8. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
  9. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
  10. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
  11. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
  12. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
  13. package/dist/components/HysButton/HysButton.vue.js +2 -2
  14. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  15. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  16. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  17. package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
  18. package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
  19. package/dist/components/HysCascader/HysCascader.vue.js +2 -2
  20. package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
  21. package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
  22. package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
  23. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  24. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
  25. package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
  26. package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
  27. package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
  28. package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
  29. package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
  30. package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
  31. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  32. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
  33. package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
  34. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
  35. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
  36. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
  37. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  38. package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
  39. package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
  40. package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
  41. package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
  42. package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
  43. package/dist/components/HysGantt/HysGantt.vue.js +1 -1
  44. package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
  45. package/dist/components/HysMention/HysMention.vue.js +1 -1
  46. package/dist/components/HysMention/HysMention2.vue.js +1092 -142
  47. package/dist/components/HysModal/HysModal.vue.js +2 -2
  48. package/dist/components/HysModal/HysModal2.vue.js +491 -85
  49. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  50. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  51. package/dist/components/HysPopover/HysPopover.vue.js +5 -91
  52. package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
  53. package/dist/components/HysProgress/HysProgress.vue.js +2 -2
  54. package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
  55. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  56. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  57. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  58. package/dist/components/HysSelect/HysSelect2.vue.js +755 -590
  59. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  60. package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
  61. package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
  62. package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
  63. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  64. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  65. package/dist/components/HysTable/HysTable.vue.js +2 -2
  66. package/dist/components/HysTable/HysTable2.vue.js +1416 -1127
  67. package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
  68. package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
  69. package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
  70. package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
  71. package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
  72. package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
  73. package/dist/components/HysTour/HysTour.vue.js +291 -63
  74. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  75. package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
  76. package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
  77. package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
  78. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
  79. package/dist/components/HysTree/HysTree.vue.js +2 -2
  80. package/dist/components/HysTree/HysTree2.vue.js +195 -184
  81. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
  82. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
  83. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  84. package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
  85. package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
  86. package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
  87. package/dist/composables/buttonGroup.js +12 -0
  88. package/dist/composables/color.js +97 -0
  89. package/dist/composables/dataGrid.js +68 -0
  90. package/dist/composables/drawer.js +17 -0
  91. package/dist/composables/feedback.js +14 -0
  92. package/dist/composables/floatingPosition.js +18 -0
  93. package/dist/composables/mentionDocument.js +79 -0
  94. package/dist/composables/mentionEditor.js +58 -0
  95. package/dist/composables/menu.js +96 -0
  96. package/dist/composables/modal.js +14 -0
  97. package/dist/composables/overlayManager.js +48 -18
  98. package/dist/composables/progress.js +94 -0
  99. package/dist/composables/selectOptions.js +44 -38
  100. package/dist/composables/splitPaneSizes.js +58 -0
  101. package/dist/composables/table.js +128 -105
  102. package/dist/composables/tagInput.js +16 -0
  103. package/dist/composables/timeline.js +19 -0
  104. package/dist/composables/transfer.js +19 -17
  105. package/dist/composables/upload.js +55 -0
  106. package/dist/composables/uploadRequest.js +58 -0
  107. package/dist/composables/useAlert.js +124 -0
  108. package/dist/composables/useColorPicker.js +402 -0
  109. package/dist/composables/useContextMenu.js +514 -0
  110. package/dist/composables/useDataGridRemote.js +67 -0
  111. package/dist/composables/useDialog.js +86 -43
  112. package/dist/composables/useDrawerPush.js +33 -0
  113. package/dist/composables/useDrawerResize.js +221 -0
  114. package/dist/composables/useFloating.js +118 -80
  115. package/dist/composables/useHysModal.js +185 -0
  116. package/dist/composables/useMentionCaret.js +81 -0
  117. package/dist/composables/useMentionList.js +81 -0
  118. package/dist/composables/useMentionModel.js +90 -0
  119. package/dist/composables/useMentionOptions.js +421 -0
  120. package/dist/composables/useModal.js +295 -0
  121. package/dist/composables/useModalInteraction.js +394 -0
  122. package/dist/composables/usePopupSurface.js +458 -0
  123. package/dist/composables/useSplitPaneDrag.js +52 -0
  124. package/dist/composables/useSplitPaneStorage.js +38 -0
  125. package/dist/composables/useTable.js +344 -312
  126. package/dist/composables/useTableSticky.js +79 -0
  127. package/dist/composables/useTagInput.js +313 -0
  128. package/dist/composables/useTourLayout.js +129 -0
  129. package/dist/composables/useTransferMotion.js +185 -0
  130. package/dist/composables/useUpload.js +472 -0
  131. package/dist/composables/useUploadModel.js +65 -0
  132. package/dist/composables/useUploadRequests.js +266 -0
  133. package/dist/composables/useVirtualTableLayout.js +277 -0
  134. package/dist/composables/virtualTable.js +43 -0
  135. package/dist/config.js +11 -11
  136. package/dist/index.js +175 -153
  137. package/dist/internal/MultiSplitPane.vue.js +305 -0
  138. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  139. package/dist/internal/PopupReference.js +39 -0
  140. package/dist/internal/PopupSurfacePanel.vue.js +7 -0
  141. package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
  142. package/dist/motion/PopupMotion.js +105 -0
  143. package/dist/motion/popup.js +10 -0
  144. package/dist/style.css +1 -1
  145. package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
  146. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +61 -7
  147. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
  148. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
  149. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
  150. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
  151. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  152. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  153. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
  154. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
  155. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  156. package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
  157. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
  158. package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
  159. package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
  160. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
  161. package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
  162. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
  163. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +3 -3
  164. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
  165. package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
  166. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
  167. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
  168. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -39
  169. package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
  170. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  171. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  172. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
  173. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
  174. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  175. package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
  176. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +45 -7
  177. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +19 -5
  178. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
  179. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
  180. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  181. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  182. package/dist/types/components/HysTable/HysTable.vue.d.ts +1742 -5
  183. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
  184. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
  185. package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
  186. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
  187. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -8
  188. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
  189. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
  190. package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
  191. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
  192. package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
  193. package/dist/types/composables/autocomplete.d.ts +3 -0
  194. package/dist/types/composables/avatar.d.ts +3 -0
  195. package/dist/types/composables/buttonGroup.d.ts +9 -0
  196. package/dist/types/composables/cascader.d.ts +3 -0
  197. package/dist/types/composables/color.d.ts +97 -0
  198. package/dist/types/composables/dataGrid.d.ts +100 -0
  199. package/dist/types/composables/datePicker.d.ts +3 -0
  200. package/dist/types/composables/drawer.d.ts +102 -0
  201. package/dist/types/composables/feedback.d.ts +98 -0
  202. package/dist/types/composables/floatingPosition.d.ts +14 -0
  203. package/dist/types/composables/formContext.d.ts +2 -0
  204. package/dist/types/composables/mention.d.ts +284 -0
  205. package/dist/types/composables/mentionDocument.d.ts +15 -0
  206. package/dist/types/composables/mentionEditor.d.ts +7 -0
  207. package/dist/types/composables/menu.d.ts +183 -0
  208. package/dist/types/composables/modal.d.ts +185 -0
  209. package/dist/types/composables/overlayManager.d.ts +7 -3
  210. package/dist/types/composables/popupSurface.d.ts +83 -0
  211. package/dist/types/composables/progress.d.ts +92 -0
  212. package/dist/types/composables/selectOptions.d.ts +7 -0
  213. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  214. package/dist/types/composables/table.d.ts +119 -6
  215. package/dist/types/composables/tagInput.d.ts +96 -0
  216. package/dist/types/composables/timeline.d.ts +82 -0
  217. package/dist/types/composables/tour.d.ts +68 -0
  218. package/dist/types/composables/transfer.d.ts +7 -0
  219. package/dist/types/composables/tree.d.ts +3 -0
  220. package/dist/types/composables/treeSelect.d.ts +3 -0
  221. package/dist/types/composables/upload.d.ts +202 -0
  222. package/dist/types/composables/uploadRequest.d.ts +3 -0
  223. package/dist/types/composables/useAlert.d.ts +21 -0
  224. package/dist/types/composables/useCascader.d.ts +1 -1
  225. package/dist/types/composables/useColorPicker.d.ts +101 -0
  226. package/dist/types/composables/useContextMenu.d.ts +81 -0
  227. package/dist/types/composables/useDataGridRemote.d.ts +15 -0
  228. package/dist/types/composables/useDialog.d.ts +16 -3
  229. package/dist/types/composables/useDrawerPush.d.ts +6 -0
  230. package/dist/types/composables/useDrawerResize.d.ts +27 -0
  231. package/dist/types/composables/useFloating.d.ts +22 -3
  232. package/dist/types/composables/useHysModal.d.ts +44 -0
  233. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  234. package/dist/types/composables/useMentionList.d.ts +23 -0
  235. package/dist/types/composables/useMentionModel.d.ts +14 -0
  236. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  237. package/dist/types/composables/useModal.d.ts +62 -0
  238. package/dist/types/composables/useModalInteraction.d.ts +27 -0
  239. package/dist/types/composables/usePopupSurface.d.ts +3341 -0
  240. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  241. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  242. package/dist/types/composables/useTable.d.ts +7 -3
  243. package/dist/types/composables/useTableSticky.d.ts +22 -0
  244. package/dist/types/composables/useTagInput.d.ts +66 -0
  245. package/dist/types/composables/useTourLayout.d.ts +33 -0
  246. package/dist/types/composables/useTransferMotion.d.ts +36 -0
  247. package/dist/types/composables/useUpload.d.ts +94 -0
  248. package/dist/types/composables/useUploadModel.d.ts +14 -0
  249. package/dist/types/composables/useUploadRequests.d.ts +38 -0
  250. package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
  251. package/dist/types/composables/virtualTable.d.ts +126 -0
  252. package/dist/types/config.d.ts +1 -0
  253. package/dist/types/index.d.ts +53 -3
  254. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  255. package/dist/types/internal/PopupReference.d.ts +18 -0
  256. package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
  257. package/dist/types/motion/PopupMotion.d.ts +59 -0
  258. package/dist/types/motion/popup.d.ts +12 -0
  259. package/package.json +3 -2
  260. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  261. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -0,0 +1,65 @@
1
+ import { shallowRef as A, computed as p, nextTick as D, toRaw as F } from "vue";
2
+ const P = (n, u) => Object.is(F(n), F(u));
3
+ function L(n) {
4
+ const u = /* @__PURE__ */ new Set();
5
+ return n.filter(
6
+ (t) => t && typeof t.uid == "string" && t.uid && typeof t.name == "string" && !u.has(t.uid) && !!u.add(t.uid)
7
+ );
8
+ }
9
+ function G(n, u, t) {
10
+ const x = () => L(n.defaultFileList ?? n.defaultValue ?? []).map(
11
+ (c) => ({ ...c })
12
+ ), f = A(x()), b = p(() => n.fileList ?? n.modelValue), r = p(() => b.value !== void 0), d = p(() => L(b.value ?? f.value));
13
+ let i = 0, k = Promise.resolve();
14
+ async function S(c, l, a = {}) {
15
+ const h = i, g = async () => {
16
+ var O, R, z;
17
+ if (h !== i || !a.allowInactive && !t() || ((O = a.guard) == null ? void 0 : O.call(a)) === !1)
18
+ return !1;
19
+ const m = d.value, j = c(m);
20
+ if (!j) return !1;
21
+ const s = L(j), C = new Map(m.map((e) => [e.uid, e])), q = new Map(s.map((e) => [e.uid, e])), I = m.filter((e) => !q.has(e.uid)), w = s.map((e) => ({
22
+ file: e,
23
+ keys: Object.keys(e).filter(
24
+ (o) => !C.has(e.uid) || !P(C.get(e.uid)[o], e[o])
25
+ )
26
+ })).filter((e) => e.keys.length);
27
+ if (!a.force && !I.length && !w.length || (r.value || (f.value = s), u("update:fileList", s), u("update:modelValue", s), r.value && await D(), h !== i || !a.allowInactive && !t() || ((R = a.guard) == null ? void 0 : R.call(a)) === !1))
28
+ return !1;
29
+ const y = d.value, v = new Map(y.map((e) => [e.uid, e]));
30
+ return I.some((e) => v.has(e.uid)) || w.some(
31
+ ({ file: e, keys: o }) => !v.has(e.uid) || o.some(
32
+ (B) => !P(v.get(e.uid)[B], e[B])
33
+ )
34
+ ) ? !1 : ((z = a.accepted) == null || z.call(a), u("change", [...y]), u("fileChange", {
35
+ type: l,
36
+ files: [...y],
37
+ changed: w.map((e) => v.get(e.file.uid)).filter(Boolean)
38
+ }), !0);
39
+ };
40
+ if (!r.value) return g();
41
+ const V = k.then(g, g);
42
+ return k = V.catch(() => {
43
+ }), V;
44
+ }
45
+ function M() {
46
+ i++;
47
+ }
48
+ function T() {
49
+ M(), r.value || (f.value = x());
50
+ }
51
+ function U(c) {
52
+ const l = d.value.map(
53
+ (a) => c.has(a.uid) && a.status === "uploading" ? { ...a, status: "ready", percentage: 0 } : a
54
+ );
55
+ l.every((a, h) => a === d.value[h]) || (r.value || (f.value = l), u("update:fileList", l), u("update:modelValue", l), r.value || (u("change", [...l]), u("fileChange", {
56
+ type: "abort",
57
+ files: l,
58
+ changed: l.filter((a) => c.has(a.uid))
59
+ })));
60
+ }
61
+ return { files: d, controlled: r, commit: S, cancel: M, resetLocal: T, interrupt: U };
62
+ }
63
+ export {
64
+ G as useUploadModel
65
+ };
@@ -0,0 +1,266 @@
1
+ import { shallowRef as C, computed as p, watch as E } from "vue";
2
+ import { uploadStatus as b, uploadFailure as N } from "./upload.js";
3
+ import { uploadRequest as D } from "./uploadRequest.js";
4
+ function J(t) {
5
+ const { props: c } = t, s = C([]), l = C(/* @__PURE__ */ new Map()), y = p(() => !!(c.action || c.customRequest)), S = p(
6
+ () => Number.isFinite(c.concurrency) ? Math.max(1, Math.min(20, Math.floor(c.concurrency))) : 2
7
+ ), v = p(
8
+ () => new Map(t.files.value.map((e) => [e.uid, e]))
9
+ );
10
+ let g = 0, q = !1;
11
+ const h = /* @__PURE__ */ new Map();
12
+ function f(e) {
13
+ var r;
14
+ return t.live() && t.available.value && !e.controller.signal.aborted && l.value.get(e.uid) === e && ((r = v.value.get(e.uid)) == null ? void 0 : r.raw) === e.raw;
15
+ }
16
+ function P(e) {
17
+ h.delete(e), !h.size && g && (cancelAnimationFrame(g), g = 0);
18
+ }
19
+ function O(e, r) {
20
+ if (!f(e) || e.phase !== "running" || !Number.isFinite(r))
21
+ return;
22
+ const n = Math.max(e.percentage, Math.min(100, Math.max(0, r)));
23
+ n !== e.percentage && (e.percentage = n, h.set(e.uid, Math.round(n * 10) / 10), !g && (g = requestAnimationFrame(() => {
24
+ g = 0;
25
+ const a = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
26
+ for (const [i, d] of h) {
27
+ const o = l.value.get(i);
28
+ o && f(o) && o.phase === "running" && (a.set(i, { percentage: d }), u.set(i, o));
29
+ }
30
+ h.clear(), a.size && t.patch(
31
+ a,
32
+ "progress",
33
+ (i) => i ? !!u.get(i) && f(u.get(i)) && u.get(i).phase === "running" : [...u.values()].some(
34
+ (d) => f(d) && d.phase === "running"
35
+ )
36
+ ).then(() => {
37
+ for (const [i, d] of u)
38
+ if (f(d) && d.phase === "running") {
39
+ const o = v.value.get(i);
40
+ o && t.emit("progress", a.get(i).percentage, {
41
+ ...o,
42
+ ...a.get(i)
43
+ });
44
+ }
45
+ });
46
+ })));
47
+ }
48
+ function x(e) {
49
+ if (l.value.get(e.uid) !== e) return;
50
+ const r = new Map(l.value);
51
+ r.delete(e.uid), l.value = r, M();
52
+ }
53
+ function m(e, r, n) {
54
+ !f(e) || e.phase === "finishing" || (e.phase = "finishing", P(e.uid), (async () => {
55
+ const a = r === void 0 ? void 0 : N(r), u = a ? { status: "error", error: a } : { status: "success", percentage: 100, response: n, error: void 0 };
56
+ if (await t.patch(
57
+ /* @__PURE__ */ new Map([[e.uid, u]]),
58
+ a ? "error" : "success",
59
+ () => f(e)
60
+ ), !f(e)) return;
61
+ const i = { ...v.value.get(e.uid), ...u };
62
+ a ? (t.emit("uploadError", a, i), t.emit("error", a.message)) : t.emit("success", n, i), x(e);
63
+ })().catch((a) => {
64
+ f(e) && (t.emit("error", N(a).message), x(e));
65
+ }));
66
+ }
67
+ function j(e, r) {
68
+ var n, a;
69
+ if (typeof r == "function") e.stop = r;
70
+ else if (r && typeof r.then == "function")
71
+ Promise.resolve(r).then(
72
+ (u) => m(e, void 0, u),
73
+ (u) => m(e, u)
74
+ );
75
+ else if (r) {
76
+ const u = r;
77
+ e.stop = (n = u.abort) == null ? void 0 : n.bind(u), u.promise && u.promise.then(
78
+ (i) => m(e, void 0, i),
79
+ (i) => m(e, i)
80
+ );
81
+ }
82
+ e.controller.signal.aborted && ((a = e.stop) == null || a.call(e));
83
+ }
84
+ async function K(e) {
85
+ try {
86
+ let r = v.value.get(e.uid);
87
+ if (!r || !f(e)) return;
88
+ const n = await t.prepare(r, e.controller.signal);
89
+ if (!f(e)) return;
90
+ if (!n) {
91
+ x(e);
92
+ return;
93
+ }
94
+ const a = await t.patch(
95
+ /* @__PURE__ */ new Map([
96
+ [
97
+ e.uid,
98
+ {
99
+ status: "uploading",
100
+ percentage: 0,
101
+ error: void 0,
102
+ response: void 0
103
+ }
104
+ ]
105
+ ]),
106
+ "start",
107
+ () => f(e)
108
+ );
109
+ if (!f(e)) return;
110
+ if (!a) {
111
+ F(e.uid, "rejected", !1);
112
+ return;
113
+ }
114
+ if (r = v.value.get(e.uid), e.phase = "running", t.emit("start", r), !f(e)) return;
115
+ const u = {
116
+ signal: e.controller.signal,
117
+ files: t.files.value
118
+ }, [i, d, o] = await Promise.all([
119
+ typeof c.action == "function" ? c.action(r, u) : c.action ?? "",
120
+ typeof c.data == "function" ? c.data(r, u) : c.data ?? {},
121
+ typeof c.headers == "function" ? c.headers(r, u) : c.headers ?? {}
122
+ ]);
123
+ if (!f(e)) return;
124
+ const A = {
125
+ ...u,
126
+ file: v.value.get(e.uid),
127
+ body: n,
128
+ action: i,
129
+ method: c.method ?? "POST",
130
+ name: c.name ?? "file",
131
+ headers: o,
132
+ data: d,
133
+ withCredentials: !!c.withCredentials,
134
+ timeout: Number.isFinite(c.timeout) ? Math.max(0, c.timeout) : 0,
135
+ onProgress: (w) => O(e, w),
136
+ onSuccess: (w) => m(e, void 0, w),
137
+ onError: (w) => m(e, w)
138
+ };
139
+ if (!c.customRequest && !i)
140
+ throw Object.assign(new Error("请配置有效的上传地址"), {
141
+ kind: "configuration"
142
+ });
143
+ j(
144
+ e,
145
+ c.customRequest ? c.customRequest(A) : D(A)
146
+ );
147
+ } catch (r) {
148
+ m(e, r);
149
+ }
150
+ }
151
+ function M() {
152
+ q || (q = !0, queueMicrotask(() => {
153
+ if (q = !1, !(!t.live() || !t.available.value || !y.value))
154
+ for (; l.value.size < S.value && s.value.length; ) {
155
+ const e = s.value[0];
156
+ s.value = s.value.slice(1);
157
+ const r = v.value.get(e);
158
+ if (!(r != null && r.raw) || l.value.has(e)) continue;
159
+ const n = {
160
+ uid: e,
161
+ raw: r.raw,
162
+ controller: new AbortController(),
163
+ phase: "preparing",
164
+ percentage: 0
165
+ };
166
+ l.value = new Map(l.value).set(e, n), K(n);
167
+ }
168
+ }));
169
+ }
170
+ async function z(e) {
171
+ if (!t.live() || !t.available.value || !y.value)
172
+ return 0;
173
+ const r = t.files.value.filter(
174
+ (n) => (e === void 0 || n.uid === e) && n.raw && ["ready", "error"].includes(b(n)) && !l.value.has(n.uid) && !s.value.includes(n.uid)
175
+ );
176
+ for (const n of r)
177
+ b(n) === "error" && t.forget(n.uid);
178
+ return s.value = [...s.value, ...r.map((n) => n.uid)], M(), r.length;
179
+ }
180
+ function F(e, r, n = !0) {
181
+ var d;
182
+ const a = l.value.get(e), u = s.value.includes(e);
183
+ if (!a && !u) return !1;
184
+ if (s.value = s.value.filter((o) => o !== e), P(e), a) {
185
+ const o = new Map(l.value);
186
+ o.delete(e), l.value = o, a.controller.abort();
187
+ try {
188
+ (d = a.stop) == null || d.call(a);
189
+ } catch {
190
+ }
191
+ }
192
+ const i = v.value.get(e);
193
+ return n && i && (t.patch(
194
+ /* @__PURE__ */ new Map([
195
+ [
196
+ e,
197
+ { status: "ready", percentage: 0, error: void 0 }
198
+ ]
199
+ ]),
200
+ "abort",
201
+ () => {
202
+ var o;
203
+ return t.live() && ((o = v.value.get(e)) == null ? void 0 : o.raw) === i.raw;
204
+ }
205
+ ), t.emit("abort", i, r)), M(), !0;
206
+ }
207
+ function R(e, r = "user", n = !0) {
208
+ const a = e === void 0 ? /* @__PURE__ */ new Set([...s.value, ...l.value.keys()]) : /* @__PURE__ */ new Set([e]);
209
+ let u = 0;
210
+ for (const i of a) F(i, r, n) && u++;
211
+ return u;
212
+ }
213
+ async function T(e) {
214
+ const r = v.value.get(e);
215
+ return !(r != null && r.raw) || !t.available.value || !t.live() || (R(e, "retry", !1), t.forget(e), !(b(r) === "ready" && !r.percentage && !r.error && r.response === void 0 || await t.patch(
216
+ /* @__PURE__ */ new Map([
217
+ [
218
+ e,
219
+ {
220
+ status: "ready",
221
+ percentage: 0,
222
+ error: void 0,
223
+ response: void 0
224
+ }
225
+ ]
226
+ ]),
227
+ "retry"
228
+ ))) ? !1 : await z(e) > 0;
229
+ }
230
+ function U() {
231
+ for (const [e, r] of l.value) {
232
+ const n = v.value.get(e);
233
+ (!n || n.raw !== r.raw || r.phase === "running" && ["success", "error"].includes(b(n))) && F(e, "model", !1);
234
+ }
235
+ s.value = s.value.filter((e) => {
236
+ var r;
237
+ return !!((r = v.value.get(e)) != null && r.raw);
238
+ });
239
+ }
240
+ E(
241
+ () => t.files.value.map((e) => [e.uid, e.raw, e.status]),
242
+ U,
243
+ { flush: "sync" }
244
+ ), E([t.available, S, y], () => {
245
+ t.available.value && M();
246
+ });
247
+ function B() {
248
+ R(void 0, "cleanup", !1), g && cancelAnimationFrame(g), g = 0, h.clear();
249
+ }
250
+ return {
251
+ configured: y,
252
+ queue: s,
253
+ tasks: l,
254
+ uploading: p(() => l.value.size),
255
+ queued: p(() => s.value.length),
256
+ activeKeys: p(() => new Set(l.value.keys())),
257
+ queuedKeys: p(() => new Set(s.value)),
258
+ submit: z,
259
+ retry: T,
260
+ abort: R,
261
+ cleanup: B
262
+ };
263
+ }
264
+ export {
265
+ J as useUploadRequests
266
+ };
@@ -0,0 +1,277 @@
1
+ import { ref as E, computed as s, onMounted as ge, onActivated as we, nextTick as xe, onDeactivated as ye, onBeforeUnmount as Me, watch as X } from "vue";
2
+ import { virtualFinite as f, virtualAligned as ue } from "./virtualTable.js";
3
+ const fe = (l, y) => ({ token: l, width: y, index: -1, offset: 0, gap: !0 });
4
+ function Le(l, y, se, U) {
5
+ const M = E(), c = E(!0), b = s(
6
+ () => f(l.rowHeight, 42, 1, 1e4)
7
+ ), Y = s(
8
+ () => l.showHeader ? f(l.headerHeight, 42, 24, 200) : 0
9
+ ), F = s(
10
+ () => {
11
+ var e;
12
+ return Y.value + (((e = l.fixedRows) == null ? void 0 : e.length) ?? 0) * b.value;
13
+ }
14
+ ), Z = E(0), V = E(0), v = E(0), x = E(0), q = s(
15
+ () => Math.max(
16
+ 1,
17
+ V.value ? V.value - F.value : f(l.height, 280, 1)
18
+ )
19
+ ), S = s(
20
+ () => Z.value || f(l.width, 600, 1)
21
+ ), ce = s(() => ({
22
+ height: typeof l.height == "string" ? "calc(" + l.height + " + " + F.value + "px)" : f(l.height, 280, 1) + F.value + "px"
23
+ })), he = s(() => ({
24
+ width: typeof l.width == "number" ? f(l.width, 600, 1) + "px" : l.width
25
+ })), L = s(() => {
26
+ const e = /* @__PURE__ */ new Set(), a = [], n = [], i = [], h = l.columns.filter(
27
+ (t) => !t.hidden && typeof t.key == "string" && !e.has(t.key) && !!e.add(t.key)
28
+ ), m = [
29
+ ...h.filter((t) => t.fixed === !0 || t.fixed === "left"),
30
+ ...h.filter((t) => !t.fixed),
31
+ ...h.filter((t) => t.fixed === "right")
32
+ ], w = m.map((t) => {
33
+ const o = f(t.minWidth, 1, 1, 1e4);
34
+ return { min: o, max: f(t.maxWidth, 1e4, o, 1e4) };
35
+ }), d = m.map(
36
+ (t, o) => f(t.width, 160, w[o].min, w[o].max)
37
+ ), r = l.selectable ? f(l.selectionWidth, 44, 32, 150) : 0;
38
+ let T = l.fit ? S.value - d.reduce((t, o) => t + o, r) : 0;
39
+ if (T > 0) {
40
+ const t = m.flatMap(
41
+ (o, u) => o.fixed ? [] : [{ index: u, capacity: w[u].max - d[u] }]
42
+ ).sort((o, u) => o.capacity - u.capacity);
43
+ t.forEach(({ index: o, capacity: u }, g) => {
44
+ const C = Math.min(
45
+ u,
46
+ T / (t.length - g)
47
+ );
48
+ d[o] += C, T -= C;
49
+ });
50
+ }
51
+ let k = r;
52
+ r && a.push({
53
+ token: "selection",
54
+ index: -1,
55
+ width: r,
56
+ offset: 0,
57
+ left: 0,
58
+ selection: !0
59
+ }), m.forEach((t, o) => {
60
+ const u = d[o], g = {
61
+ token: "column:" + t.key,
62
+ column: t,
63
+ index: o,
64
+ width: u,
65
+ offset: k
66
+ };
67
+ t.fixed === "right" ? i.push(g) : t.fixed ? (g.left = k, a.push(g)) : n.push(g), k += u;
68
+ });
69
+ let H = 0;
70
+ for (let t = i.length - 1; t >= 0; t--)
71
+ i[t].right = H, H += i[t].width;
72
+ return {
73
+ left: a,
74
+ center: n,
75
+ right: i,
76
+ total: k,
77
+ leftWidth: a.reduce((t, o) => t + o.width, 0),
78
+ rightWidth: H
79
+ };
80
+ }), _ = s(() => [
81
+ ...L.value.left,
82
+ ...L.value.center,
83
+ ...L.value.right
84
+ ]), $ = s(
85
+ () => new Map(
86
+ _.value.flatMap(
87
+ (e) => e.column ? [[e.column.key, e]] : []
88
+ )
89
+ )
90
+ ), ee = s(
91
+ () => Math.max(L.value.total, S.value)
92
+ ), te = s((e) => {
93
+ var o;
94
+ const { left: a, center: n, right: i, total: h, leftWidth: m, rightWidth: w } = L.value;
95
+ let d = 0, r = n.length;
96
+ if (l.virtualColumns) {
97
+ const u = x.value + m, g = x.value + S.value - w, C = Math.floor(f(l.columnOverscan, 1, 0, 20));
98
+ let O = 0, Q = n.length;
99
+ for (; O < Q; ) {
100
+ const N = O + Q >>> 1;
101
+ n[N].offset + n[N].width <= u ? O = N + 1 : Q = N;
102
+ }
103
+ for (d = Math.max(0, O - C), r = O; r < n.length && n[r].offset < g; ) r++;
104
+ r = Math.min(n.length, r + C);
105
+ }
106
+ const T = d ? (((o = n[d]) == null ? void 0 : o.offset) ?? h - w) - m : 0, k = r < n.length ? h - w - n[r].offset : 0, H = ee.value - h, t = [
107
+ ...a,
108
+ ...T > 0 ? [fe("gap:before", T)] : [],
109
+ ...n.slice(d, r),
110
+ ...k + H > 0 ? [fe("gap:after", k + H)] : [],
111
+ ...i
112
+ ];
113
+ return (e == null ? void 0 : e.length) === t.length && t.every(
114
+ (u, g) => u === e[g] || u.gap && e[g].token === u.token && e[g].width === u.width
115
+ ) ? e : t;
116
+ }), le = s((e) => {
117
+ const a = y(), n = Math.floor(f(l.overscan, 5, 0, 100)), i = Math.min(
118
+ Math.max(0, a - 1),
119
+ Math.floor(v.value / b.value)
120
+ ), h = Math.min(
121
+ a - 1,
122
+ Math.ceil((v.value + q.value) / b.value) - 1
123
+ ), m = Math.max(0, i - n), w = Math.min(a - 1, h + n), d = te.value.flatMap(
124
+ (r) => r.column ? [r.column.key] : []
125
+ );
126
+ return e && m === e.start && w === e.end && i === e.visibleStart && h === e.visibleEnd && d.length === e.columnKeys.length && d.every((r, T) => r === e.columnKeys[T]) ? e : { start: m, end: w, visibleStart: i, visibleEnd: h, columnKeys: d };
127
+ }), A = s(
128
+ () => Math.max(0, y() * b.value - q.value)
129
+ ), j = s(() => Math.max(0, L.value.total - S.value));
130
+ let R = 0, z = 0, W, G = !1, p = 0, B = 0, ne = 0, ae = 0, I = "";
131
+ function ie() {
132
+ if (!c.value) return;
133
+ const e = v.value, a = x.value;
134
+ v.value = f(p, 0, 0, A.value), x.value = f(B, 0, 0, j.value), (e !== v.value || a !== x.value) && U.scroll({
135
+ scrollTop: v.value,
136
+ scrollLeft: x.value,
137
+ direction: e !== v.value ? v.value > e ? "down" : "up" : x.value > a ? "right" : "left"
138
+ });
139
+ }
140
+ function de() {
141
+ const e = M.value;
142
+ !c.value || !e || (p = e.scrollTop, B = e.scrollLeft, R || (R = requestAnimationFrame(() => {
143
+ R = 0, ie();
144
+ })));
145
+ }
146
+ function K(e) {
147
+ const a = M.value;
148
+ if (!c.value || !a) return;
149
+ const n = f(e.top, a.scrollTop, 0, A.value), i = f(e.left, a.scrollLeft, 0, j.value);
150
+ if (e.behavior === "smooth" && a.scrollTo) {
151
+ a.scrollTo({ top: n, left: i, behavior: "smooth" });
152
+ return;
153
+ }
154
+ a.scrollTop !== n && (a.scrollTop = n), a.scrollLeft !== i && (a.scrollLeft = i), p = n, B = i, ie();
155
+ }
156
+ function ve(e, a = "nearest") {
157
+ var i;
158
+ if (!y() || !Number.isFinite(e)) return;
159
+ const n = Math.min(y() - 1, Math.max(0, Math.floor(e))) * b.value;
160
+ K({
161
+ top: ue(
162
+ n,
163
+ b.value,
164
+ ((i = M.value) == null ? void 0 : i.scrollTop) ?? v.value,
165
+ q.value,
166
+ a
167
+ )
168
+ });
169
+ }
170
+ function me(e, a = "nearest") {
171
+ var i;
172
+ if (!c.value) return !1;
173
+ const n = $.value.get(e);
174
+ if (!n) return !1;
175
+ if (n.left === void 0 && n.right === void 0) {
176
+ const { leftWidth: h, rightWidth: m } = L.value;
177
+ K({
178
+ left: ue(
179
+ n.offset - h,
180
+ n.width,
181
+ ((i = M.value) == null ? void 0 : i.scrollLeft) ?? x.value,
182
+ Math.max(1, S.value - h - m),
183
+ a
184
+ )
185
+ });
186
+ }
187
+ return !0;
188
+ }
189
+ function J() {
190
+ const e = M.value;
191
+ !c.value || !e || (e.clientWidth && (Z.value = e.clientWidth), e.clientHeight && (V.value = e.clientHeight), K({ top: e.scrollTop, left: e.scrollLeft }));
192
+ }
193
+ function D() {
194
+ c.value && !z && (z = requestAnimationFrame(() => {
195
+ z = 0, J();
196
+ }));
197
+ }
198
+ function oe() {
199
+ G || !c.value || !M.value || (G = !0, typeof ResizeObserver < "u" ? (W = new ResizeObserver(D), W.observe(M.value)) : window.addEventListener("resize", D), J());
200
+ }
201
+ function re() {
202
+ W == null || W.disconnect(), W = void 0, G = !1, window.removeEventListener("resize", D), cancelAnimationFrame(R), cancelAnimationFrame(z), R = z = 0;
203
+ }
204
+ function P() {
205
+ const e = y();
206
+ if (!c.value || !e || l.loading) return;
207
+ const a = Math.max(0, A.value - v.value);
208
+ if (a > f(l.endReachedThreshold, 42, 0, 1e4)) {
209
+ I = "";
210
+ return;
211
+ }
212
+ const n = e + ":" + se();
213
+ n !== I && (I = n, U.end({ distance: a, total: e }));
214
+ }
215
+ return ge(() => {
216
+ oe(), P();
217
+ }), we(() => {
218
+ const e = !c.value;
219
+ c.value = !0, oe(), e && xe(() => {
220
+ K({ top: ne, left: ae }), P();
221
+ });
222
+ }), ye(() => {
223
+ ne = p, ae = B, c.value = !1, re();
224
+ }), Me(() => {
225
+ c.value = !1, re();
226
+ }), X([A, j, F, () => l.height], D, {
227
+ flush: "post"
228
+ }), X(
229
+ le,
230
+ (e) => {
231
+ c.value && U.range({ ...e, columnKeys: [...e.columnKeys] });
232
+ },
233
+ { flush: "post", immediate: !0 }
234
+ ), X(
235
+ [
236
+ v,
237
+ A,
238
+ y,
239
+ () => l.loading,
240
+ () => l.endReachedThreshold
241
+ ],
242
+ P,
243
+ { flush: "post" }
244
+ ), {
245
+ viewport: M,
246
+ live: c,
247
+ rowHeight: b,
248
+ headerHeight: Y,
249
+ topHeight: F,
250
+ bodyHeight: q,
251
+ rootStyle: he,
252
+ viewportStyle: ce,
253
+ columns: _,
254
+ columnMap: $,
255
+ renderColumns: te,
256
+ contentWidth: ee,
257
+ scrollTop: v,
258
+ scrollLeft: x,
259
+ range: le,
260
+ scrollTo: K,
261
+ scrollToRow: ve,
262
+ scrollToColumn: me,
263
+ onScroll: de,
264
+ remeasure: J
265
+ };
266
+ }
267
+ function ke(l) {
268
+ return {
269
+ width: l.width + "px",
270
+ flex: "0 0 " + l.width + "px",
271
+ ...l.left !== void 0 ? { position: "sticky", left: l.left + "px" } : l.right !== void 0 ? { position: "sticky", right: l.right + "px" } : {}
272
+ };
273
+ }
274
+ export {
275
+ Le as useVirtualTableLayout,
276
+ ke as virtualColumnStyle
277
+ };
@@ -0,0 +1,43 @@
1
+ const y = (t, e, r = 0, n = 1e7) => Math.max(
2
+ r,
3
+ Math.min(
4
+ n,
5
+ typeof t == "number" && Number.isFinite(t) ? t : e
6
+ )
7
+ ), o = (t) => typeof t == "string" || typeof t == "number" && Number.isFinite(t), c = (t) => typeof t + ":" + String(t);
8
+ function a(t, e, r) {
9
+ if (e.valueGetter) return e.valueGetter(t, r);
10
+ const n = e.dataIndex ?? e.key;
11
+ return typeof n == "string" && Object.prototype.hasOwnProperty.call(t, n) ? t[n] : (typeof n == "string" ? n.split(".") : n).reduce(
12
+ (i, u) => i !== null && typeof i == "object" ? i[u] : void 0,
13
+ t
14
+ );
15
+ }
16
+ function b(t, e) {
17
+ const r = t.map(
18
+ (i, u) => typeof e == "function" ? e(i, u) : i[e || "id"]
19
+ ), n = /* @__PURE__ */ new Map();
20
+ for (const i of r)
21
+ o(i) && n.set(i, (n.get(i) ?? 0) + 1);
22
+ return t.map((i, u) => {
23
+ const f = r[u], p = o(f) && n.get(f) === 1;
24
+ return {
25
+ row: i,
26
+ key: p ? f : u,
27
+ token: p ? c(f) : "fallback:" + u,
28
+ sourceIndex: u,
29
+ valid: p
30
+ };
31
+ });
32
+ }
33
+ function d(t, e, r, n, i) {
34
+ return i === "center" ? t - (n - e) / 2 : i === "end" ? t + e - n : i === "nearest" ? e > n && t <= r && t + e >= r + n ? r : t < r ? t : t + e > r + n ? e > n ? t : t + e - n : r : t;
35
+ }
36
+ export {
37
+ d as virtualAligned,
38
+ b as virtualEntries,
39
+ y as virtualFinite,
40
+ o as virtualKey,
41
+ c as virtualToken,
42
+ a as virtualValue
43
+ };
package/dist/config.js CHANGED
@@ -1,16 +1,16 @@
1
- import { computed as a, toValue as s, provide as m, getCurrentInstance as i, inject as f } from "vue";
2
- const u = Symbol("hys-ui-config"), r = /* @__PURE__ */ new WeakMap();
3
- function h(t) {
4
- const e = c(), n = { theme: t.theme ?? e.theme, motion: t.motion ?? e.motion };
5
- m(u, n);
6
- const o = i();
1
+ import { computed as a, toValue as s, getCurrentInstance as u, inject as m, provide as l } from "vue";
2
+ const i = Symbol("hys-ui-config"), r = /* @__PURE__ */ new WeakMap();
3
+ function p(t) {
4
+ const e = c(), n = { theme: t.theme ?? e.theme, motion: t.motion ?? e.motion, buttonAutoInsertSpace: t.buttonAutoInsertSpace ?? e.buttonAutoInsertSpace };
5
+ l(i, n);
6
+ const o = u();
7
7
  o && r.set(o, n);
8
8
  }
9
9
  function c() {
10
- const t = i();
11
- return t && r.get(t) || f(u, {});
10
+ const t = u();
11
+ return t && r.get(t) || m(i, {});
12
12
  }
13
- function d() {
13
+ function h() {
14
14
  const t = c();
15
15
  return a(() => {
16
16
  const e = s(t.theme), n = s(t.motion);
@@ -18,7 +18,7 @@ function d() {
18
18
  });
19
19
  }
20
20
  export {
21
- h as provideHysConfig,
21
+ p as provideHysConfig,
22
22
  c as useHysConfig,
23
- d as useHysRootAttrs
23
+ h as useHysRootAttrs
24
24
  };