@silver-formily/element-plus 2.1.0 → 2.3.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 (177) hide show
  1. package/LICENSE +21 -21
  2. package/README.en-US.md +32 -32
  3. package/README.md +32 -32
  4. package/esm/__builtins__/configs/index.mjs.map +1 -1
  5. package/esm/__builtins__/index.mjs +19 -23
  6. package/esm/__builtins__/index.mjs.map +1 -1
  7. package/esm/__builtins__/shared/index.d.ts +0 -1
  8. package/esm/__builtins__/shared/index.mjs +17 -21
  9. package/esm/__builtins__/shared/index.mjs.map +1 -1
  10. package/esm/__builtins__/shared/loading.mjs +5 -5
  11. package/esm/__builtins__/shared/loading.mjs.map +1 -1
  12. package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
  13. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  14. package/esm/__builtins__/shared/use-enter-submit.d.ts +9 -0
  15. package/esm/__builtins__/shared/use-enter-submit.mjs +25 -0
  16. package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -0
  17. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  18. package/esm/array-base/index.mjs +18 -21
  19. package/esm/array-base/index.mjs.map +1 -1
  20. package/esm/array-base/symbols.mjs.map +1 -1
  21. package/esm/array-base/utils.mjs +29 -33
  22. package/esm/array-base/utils.mjs.map +1 -1
  23. package/esm/array-cards/index.mjs +29 -31
  24. package/esm/array-cards/index.mjs.map +1 -1
  25. package/esm/array-collapse/index.mjs +35 -36
  26. package/esm/array-collapse/index.mjs.map +1 -1
  27. package/esm/array-collapse/utils.mjs +2 -8
  28. package/esm/array-collapse/utils.mjs.map +1 -1
  29. package/esm/array-items/index.mjs +30 -33
  30. package/esm/array-items/index.mjs.map +1 -1
  31. package/esm/array-list-tabs/index.mjs +27 -28
  32. package/esm/array-list-tabs/index.mjs.map +1 -1
  33. package/esm/array-list-tabs/utils.mjs +5 -11
  34. package/esm/array-list-tabs/utils.mjs.map +1 -1
  35. package/esm/array-table/index.mjs +52 -53
  36. package/esm/array-table/index.mjs.map +1 -1
  37. package/esm/array-table/utils.mjs +12 -18
  38. package/esm/array-table/utils.mjs.map +1 -1
  39. package/esm/array-tabs/index.mjs +17 -19
  40. package/esm/array-tabs/index.mjs.map +1 -1
  41. package/esm/autocomplete/autocomplete.d.ts +1222 -0
  42. package/esm/autocomplete/index.d.ts +639 -0
  43. package/esm/autocomplete/index.mjs +110 -0
  44. package/esm/autocomplete/index.mjs.map +1 -0
  45. package/esm/cascader/index.mjs +17 -20
  46. package/esm/cascader/index.mjs.map +1 -1
  47. package/esm/checkbox/index.d.ts +42 -42
  48. package/esm/checkbox/index.mjs +16 -19
  49. package/esm/checkbox/index.mjs.map +1 -1
  50. package/esm/color-picker/index.d.ts +210 -0
  51. package/esm/color-picker/index.mjs +14 -0
  52. package/esm/color-picker/index.mjs.map +1 -0
  53. package/esm/color-picker-panel/index.d.ts +129 -0
  54. package/esm/color-picker-panel/index.mjs +22 -0
  55. package/esm/color-picker-panel/index.mjs.map +1 -0
  56. package/esm/date-picker/index.mjs +11 -35
  57. package/esm/date-picker/index.mjs.map +1 -1
  58. package/esm/date-picker/utils.d.ts +4 -0
  59. package/esm/date-picker/utils.mjs +27 -0
  60. package/esm/date-picker/utils.mjs.map +1 -0
  61. package/esm/date-picker-panel/index.d.ts +143 -0
  62. package/esm/date-picker-panel/index.mjs +27 -0
  63. package/esm/date-picker-panel/index.mjs.map +1 -0
  64. package/esm/editable/index.mjs +48 -50
  65. package/esm/editable/index.mjs.map +1 -1
  66. package/esm/env.d.mjs +2 -0
  67. package/esm/env.d.mjs.map +1 -0
  68. package/esm/form/form.mjs +6 -6
  69. package/esm/form/form.mjs.map +1 -1
  70. package/esm/form-button-group/form-button-group.d.ts +1 -1
  71. package/esm/form-button-group/index.d.ts +3 -3
  72. package/esm/form-button-group/index.mjs +23 -26
  73. package/esm/form-button-group/index.mjs.map +1 -1
  74. package/esm/form-button-group/utils.mjs +2 -8
  75. package/esm/form-button-group/utils.mjs.map +1 -1
  76. package/esm/form-collapse/index.mjs +18 -20
  77. package/esm/form-collapse/index.mjs.map +1 -1
  78. package/esm/form-collapse/utils.mjs.map +1 -1
  79. package/esm/form-dialog/dialog-content.d.ts +789 -3
  80. package/esm/form-dialog/index.mjs +98 -87
  81. package/esm/form-dialog/index.mjs.map +1 -1
  82. package/esm/form-dialog/types.d.ts +1 -0
  83. package/esm/form-drawer/drawer-content.d.ts +919 -3
  84. package/esm/form-drawer/index.mjs +92 -82
  85. package/esm/form-drawer/index.mjs.map +1 -1
  86. package/esm/form-drawer/types.d.ts +1 -0
  87. package/esm/form-grid/hooks.mjs.map +1 -1
  88. package/esm/form-grid/index.mjs +20 -23
  89. package/esm/form-grid/index.mjs.map +1 -1
  90. package/esm/form-item/index.mjs +59 -57
  91. package/esm/form-item/index.mjs.map +1 -1
  92. package/esm/form-item/utils.mjs.map +1 -1
  93. package/esm/form-layout/form-layout.mjs +14 -18
  94. package/esm/form-layout/form-layout.mjs.map +1 -1
  95. package/esm/form-layout/utils.mjs +19 -24
  96. package/esm/form-layout/utils.mjs.map +1 -1
  97. package/esm/form-step/index.mjs +24 -26
  98. package/esm/form-step/index.mjs.map +1 -1
  99. package/esm/form-step/utils.mjs.map +1 -1
  100. package/esm/form-tab/hooks.mjs.map +1 -1
  101. package/esm/form-tab/index.mjs +19 -20
  102. package/esm/form-tab/index.mjs.map +1 -1
  103. package/esm/form-tab/utils.mjs.map +1 -1
  104. package/esm/index.d.ts +9 -0
  105. package/esm/index.mjs +90 -72
  106. package/esm/index.mjs.map +1 -1
  107. package/esm/input/index.mjs +20 -23
  108. package/esm/input/index.mjs.map +1 -1
  109. package/esm/input-number/index.d.ts +21 -21
  110. package/esm/input-number/index.mjs +7 -9
  111. package/esm/input-number/index.mjs.map +1 -1
  112. package/esm/input-tag/index.d.ts +32 -0
  113. package/esm/input-tag/index.mjs +46 -0
  114. package/esm/input-tag/index.mjs.map +1 -0
  115. package/esm/input-tag/input-tag.d.ts +32 -0
  116. package/esm/mention/index.d.ts +50 -0
  117. package/esm/mention/index.mjs +93 -0
  118. package/esm/mention/index.mjs.map +1 -0
  119. package/esm/mention/mention.d.ts +51 -0
  120. package/esm/pagination/components/jumper.mjs.map +1 -1
  121. package/esm/pagination/components/next.mjs.map +1 -1
  122. package/esm/pagination/components/pager.mjs.map +1 -1
  123. package/esm/pagination/components/prev.mjs.map +1 -1
  124. package/esm/pagination/components/total.mjs.map +1 -1
  125. package/esm/pagination/pagination.mjs.map +1 -1
  126. package/esm/password/index.mjs.map +1 -1
  127. package/esm/preview-text/color-picker.d.ts +5 -0
  128. package/esm/preview-text/index.d.ts +10 -0
  129. package/esm/preview-text/index.mjs +175 -119
  130. package/esm/preview-text/index.mjs.map +1 -1
  131. package/esm/preview-text/rate.d.ts +5 -0
  132. package/esm/preview-text/utils.d.ts +5 -5
  133. package/esm/preview-text/utils.mjs.map +1 -1
  134. package/esm/radio/index.d.ts +36 -36
  135. package/esm/radio/index.mjs +25 -28
  136. package/esm/radio/index.mjs.map +1 -1
  137. package/esm/rate/index.d.ts +187 -0
  138. package/esm/rate/index.mjs +14 -0
  139. package/esm/rate/index.mjs.map +1 -0
  140. package/esm/reset/index.mjs.map +1 -1
  141. package/esm/segmented/index.d.ts +26 -0
  142. package/esm/segmented/index.mjs +37 -0
  143. package/esm/segmented/index.mjs.map +1 -0
  144. package/esm/segmented/segmented.d.ts +25 -0
  145. package/esm/select/index.mjs +16 -19
  146. package/esm/select/index.mjs.map +1 -1
  147. package/esm/select-table/index.mjs +12 -15
  148. package/esm/select-table/index.mjs.map +1 -1
  149. package/esm/shared/overlay-elements.d.ts +6 -0
  150. package/esm/shared/overlay-elements.mjs +16 -0
  151. package/esm/shared/overlay-elements.mjs.map +1 -0
  152. package/esm/slider/index.d.ts +177 -0
  153. package/esm/slider/index.mjs +14 -0
  154. package/esm/slider/index.mjs.map +1 -0
  155. package/esm/styles/preview-text/index.css +1 -1
  156. package/esm/submit/index.mjs.map +1 -1
  157. package/esm/switch/index.d.ts +12 -12
  158. package/esm/switch/index.mjs.map +1 -1
  159. package/esm/time-picker/index.mjs +6 -8
  160. package/esm/time-picker/index.mjs.map +1 -1
  161. package/esm/time-select/index.mjs +6 -8
  162. package/esm/time-select/index.mjs.map +1 -1
  163. package/esm/transfer/index.mjs.map +1 -1
  164. package/esm/tree/index.mjs +28 -31
  165. package/esm/tree/index.mjs.map +1 -1
  166. package/esm/tree/utils.mjs.map +1 -1
  167. package/esm/tree-select/index.mjs +17 -20
  168. package/esm/tree-select/index.mjs.map +1 -1
  169. package/esm/upload/index.d.ts +1 -1
  170. package/esm/upload/index.mjs +7 -9
  171. package/esm/upload/index.mjs.map +1 -1
  172. package/esm/upload/upload.d.ts +2 -2
  173. package/esm/vendor/sizes.mjs.map +1 -1
  174. package/package.json +115 -113
  175. package/esm/__builtins__/shared/hooks.d.ts +0 -7
  176. package/esm/__builtins__/shared/hooks.mjs +0 -59
  177. package/esm/__builtins__/shared/hooks.mjs.map +0 -1
package/package.json CHANGED
@@ -1,113 +1,115 @@
1
- {
2
- "name": "@silver-formily/element-plus",
3
- "type": "module",
4
- "version": "2.1.0",
5
- "description": "Formily 的 Element Plus 封装",
6
- "author": "hezhengxu",
7
- "license": "MIT",
8
- "homepage": "https://element-plus.silver-formily.org/",
9
- "sideEffects": [
10
- "**/*.css"
11
- ],
12
- "main": "esm",
13
- "types": "esm/index.d.ts",
14
- "files": [
15
- "esm"
16
- ],
17
- "scripts": {
18
- "create:style": "tsx build/create-style",
19
- "build": "vite build",
20
- "docs:dev": "vitepress dev docs",
21
- "docs:build": "vitepress build docs",
22
- "docs:preview": "vitepress preview docs",
23
- "test": "vitest --ui",
24
- "coverage": "vitest run --coverage --browser.headless",
25
- "lint": "eslint .",
26
- "lint:fix": "eslint . --fix",
27
- "commit": "czg",
28
- "lint-staged": "lint-staged",
29
- "release": "release-it",
30
- "prepublishOnly": "pnpm run build",
31
- "postinstall": "husky"
32
- },
33
- "peerDependencies": {
34
- "@formily/core": "^2.0.8",
35
- "@formily/grid": "^2.0.8",
36
- "@formily/json-schema": "^2.0.8",
37
- "@formily/reactive": "^2.0.8",
38
- "@formily/shared": "^2.0.8",
39
- "@silver-formily/reactive-vue": "^1",
40
- "@silver-formily/vue": "^2.2.1",
41
- "element-plus": "^2.1.8",
42
- "vue": "^3.3.0"
43
- },
44
- "dependencies": {
45
- "@element-plus/icons-vue": "^2.3.0",
46
- "vue-draggable-plus": "^0.5.0"
47
- },
48
- "devDependencies": {
49
- "@antfu/eslint-config": "^4.19.0",
50
- "@commitlint/cli": "^19.8.1",
51
- "@commitlint/config-conventional": "^19.8.1",
52
- "@eslint/js": "^9.36.0",
53
- "@eslint/markdown": "^6.6.0",
54
- "@iconify-json/ri": "^1.2.5",
55
- "@mdit-vue/shared": "^2.1.4",
56
- "@release-it/conventional-changelog": "^10.0.1",
57
- "@shikijs/langs": "^3.13.0",
58
- "@types/lodash-es": "^4.17.12",
59
- "@types/markdown-it": "^14.1.2",
60
- "@types/markdown-it-container": "^2.0.10",
61
- "@types/node": "^20.19.19",
62
- "@vitejs/plugin-vue": "^6.0.1",
63
- "@vitejs/plugin-vue-jsx": "^5.1.1",
64
- "@vitest/browser": "^3.2.4",
65
- "@vitest/coverage-istanbul": "^3.2.4",
66
- "@vitest/ui": "^3.2.4",
67
- "@vue/shared": "^3.5.22",
68
- "baseline-browser-mapping": "^2.9.11",
69
- "cz-git": "^1.12.0",
70
- "czg": "^1.12.0",
71
- "eslint": "^9.36.0",
72
- "eslint-plugin-unicorn": "^59.0.1",
73
- "eslint-plugin-vue": "^10.5.0",
74
- "execa": "^9.6.0",
75
- "fast-glob": "^3.3.3",
76
- "husky": "^9.1.7",
77
- "lint-staged": "^16.2.3",
78
- "lodash-es": "^4.17.21",
79
- "markdown-it": "^14.1.0",
80
- "markdown-it-container": "^4.0.0",
81
- "normalize.css": "^8.0.1",
82
- "nprogress": "^0.2.0",
83
- "playwright": "^1.55.1",
84
- "release-it": "^19.0.5",
85
- "rimraf": "^6.0.1",
86
- "sass-embedded": "^1.93.2",
87
- "shiki": "^3.13.0",
88
- "tsx": "^4.20.6",
89
- "typescript": "^5.9.3",
90
- "unocss": "^66.5.2",
91
- "unplugin-icons": "^22.4.2",
92
- "unplugin-vue-components": "^28.8.0",
93
- "vite": "^7.0.0",
94
- "vite-plugin-dts": "^4.5.4",
95
- "vite-plugin-lib-inject-css": "^2.2.2",
96
- "vitepress": "2.0.0-alpha.12",
97
- "vitepress-better-demo-plugin": "^0.6.2",
98
- "vitepress-plugin-group-icons": "^1.6.5",
99
- "vitepress-plugin-nprogress": "^0.1.1",
100
- "vitepress-theme-element-plus": "^1.1.4",
101
- "vitest": "^3.2.4",
102
- "vitest-browser-vue": "^0.2.0",
103
- "vue-eslint-parser": "^10.2.0"
104
- },
105
- "config": {
106
- "commitizen": {
107
- "path": "./node_modules/cz-git"
108
- }
109
- },
110
- "lint-staged": {
111
- "*.{vue,js,ts,jsx,tsx,md,json}": "eslint --fix"
112
- }
113
- }
1
+ {
2
+ "name": "@silver-formily/element-plus",
3
+ "type": "module",
4
+ "version": "2.3.0",
5
+ "description": "Formily 的 Element Plus 封装",
6
+ "author": "hezhengxu",
7
+ "license": "MIT",
8
+ "homepage": "https://element-plus.silver-formily.org/",
9
+ "sideEffects": [
10
+ "**/*.css"
11
+ ],
12
+ "main": "esm",
13
+ "types": "esm/index.d.ts",
14
+ "files": [
15
+ "esm"
16
+ ],
17
+ "scripts": {
18
+ "create:style": "tsx build/create-style",
19
+ "build": "vite build",
20
+ "docs:dev": "vitepress dev docs",
21
+ "docs:build": "vitepress build docs",
22
+ "docs:preview": "vitepress preview docs",
23
+ "test": "vitest --ui",
24
+ "coverage": "vitest run --coverage --browser.headless",
25
+ "lint": "eslint .",
26
+ "lint:fix": "eslint . --fix",
27
+ "commit": "czg",
28
+ "lint-staged": "lint-staged",
29
+ "release": "release-it",
30
+ "prepublishOnly": "pnpm run build",
31
+ "postinstall": "husky"
32
+ },
33
+ "peerDependencies": {
34
+ "@formily/core": "^2.0.8",
35
+ "@formily/grid": "^2.0.8",
36
+ "@formily/json-schema": "^2.0.8",
37
+ "@formily/reactive": "^2.0.8",
38
+ "@formily/shared": "^2.0.8",
39
+ "@silver-formily/reactive-vue": "^1",
40
+ "@silver-formily/vue": "^2.2.1",
41
+ "@vueuse/core": "*",
42
+ "element-plus": "^2.1.8",
43
+ "vue": "^3.3.0"
44
+ },
45
+ "dependencies": {
46
+ "@element-plus/icons-vue": "^2.3.0",
47
+ "vue-draggable-plus": "^0.5.0"
48
+ },
49
+ "devDependencies": {
50
+ "@antfu/eslint-config": "^4.19.0",
51
+ "@commitlint/cli": "^19.8.1",
52
+ "@commitlint/config-conventional": "^19.8.1",
53
+ "@eslint/js": "^9.36.0",
54
+ "@eslint/markdown": "^6.6.0",
55
+ "@iconify-json/ri": "^1.2.5",
56
+ "@mdit-vue/shared": "^2.1.4",
57
+ "@release-it/conventional-changelog": "^10.0.1",
58
+ "@shikijs/langs": "^3.13.0",
59
+ "@types/lodash-es": "^4.17.12",
60
+ "@types/markdown-it": "^14.1.2",
61
+ "@types/markdown-it-container": "^2.0.10",
62
+ "@types/node": "^20.19.19",
63
+ "@vitejs/plugin-vue": "^6.0.1",
64
+ "@vitejs/plugin-vue-jsx": "^5.1.1",
65
+ "@vitest/browser": "^3.2.4",
66
+ "@vitest/coverage-istanbul": "^3.2.4",
67
+ "@vitest/ui": "^3.2.4",
68
+ "@vue/shared": "^3.5.22",
69
+ "baseline-browser-mapping": "^2.9.11",
70
+ "cz-git": "^1.12.0",
71
+ "czg": "^1.12.0",
72
+ "eslint": "^9.36.0",
73
+ "eslint-plugin-format": "^1.4.0",
74
+ "eslint-plugin-unicorn": "^59.0.1",
75
+ "eslint-plugin-vue": "^10.5.0",
76
+ "execa": "^9.6.0",
77
+ "fast-glob": "^3.3.3",
78
+ "husky": "^9.1.7",
79
+ "lint-staged": "^16.2.3",
80
+ "lodash-es": "^4.17.21",
81
+ "markdown-it": "^14.1.0",
82
+ "markdown-it-container": "^4.0.0",
83
+ "normalize.css": "^8.0.1",
84
+ "nprogress": "^0.2.0",
85
+ "playwright": "^1.55.1",
86
+ "release-it": "^19.0.5",
87
+ "rimraf": "^6.0.1",
88
+ "sass-embedded": "^1.93.2",
89
+ "shiki": "^3.13.0",
90
+ "tsx": "^4.20.6",
91
+ "typescript": "^5.9.3",
92
+ "unocss": "^66.5.2",
93
+ "unplugin-icons": "^22.4.2",
94
+ "unplugin-vue-components": "^28.8.0",
95
+ "vite": "^7.0.0",
96
+ "vite-plugin-dts": "^4.5.4",
97
+ "vite-plugin-lib-inject-css": "^2.2.2",
98
+ "vitepress": "2.0.0-alpha.12",
99
+ "vitepress-better-demo-plugin": "^0.6.2",
100
+ "vitepress-plugin-group-icons": "^1.6.5",
101
+ "vitepress-plugin-nprogress": "^0.1.1",
102
+ "vitepress-theme-element-plus": "^1.3.1",
103
+ "vitest": "^3.2.4",
104
+ "vitest-browser-vue": "^0.2.0",
105
+ "vue-eslint-parser": "^10.2.0"
106
+ },
107
+ "config": {
108
+ "commitizen": {
109
+ "path": "./node_modules/cz-git"
110
+ }
111
+ },
112
+ "lint-staged": {
113
+ "*.{vue,js,ts,jsx,tsx,md,json}": "eslint --fix"
114
+ }
115
+ }
@@ -1,7 +0,0 @@
1
- import { Ref } from 'vue';
2
- export declare function useDebounceFn<T extends (...args: any[]) => any>(fn: T, delay: number | (() => number)): T;
3
- export declare function useThrottleFn<T extends (...args: any[]) => any>(fn: T, delay: number, trailing?: boolean, leading?: boolean): T;
4
- export declare function useResizeObserver(target: Ref<Element | null> | Element | null, callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void, options?: ResizeObserverOptions): {
5
- isSupported: boolean;
6
- stop: () => void;
7
- };
@@ -1,59 +0,0 @@
1
- import { watch as f, onUnmounted as m } from "vue";
2
- function T(e, o) {
3
- let u = null;
4
- return ((...l) => {
5
- u !== null && clearTimeout(u);
6
- const t = typeof o == "function" ? o() : o;
7
- u = setTimeout(() => {
8
- e(...l), u = null;
9
- }, t);
10
- });
11
- }
12
- function b(e, o, u = !0, l = !0) {
13
- let t = null, n = 0, s = null;
14
- return ((...r) => {
15
- const i = Date.now();
16
- if (n === 0 && l) {
17
- n = i, e(...r);
18
- return;
19
- }
20
- n === 0 && !l && (n = i);
21
- const c = o - (i - n);
22
- s = r, t !== null && clearTimeout(t), c <= 0 && n !== i ? (n = i, e(...r), s = null) : u && (t = setTimeout(() => {
23
- n = Date.now(), s !== null && (e(...s), s = null), t = null;
24
- }, c));
25
- });
26
- }
27
- function p(e, o, u) {
28
- let l = null;
29
- const t = globalThis.window !== void 0 && "ResizeObserver" in globalThis, n = () => {
30
- l && (l.disconnect(), l = null);
31
- }, s = () => {
32
- n();
33
- }, r = () => {
34
- n();
35
- /* istanbul ignore if @preserve */
36
- if (!t)
37
- return;
38
- const i = e && "value" in e ? e.value : e;
39
- i && (l = new ResizeObserver(o), l.observe(i, u));
40
- };
41
- return e && "value" in e ? f(
42
- e,
43
- () => {
44
- r();
45
- },
46
- { immediate: !0, flush: "post" }
47
- ) : r(), m(() => {
48
- n();
49
- }), {
50
- isSupported: t,
51
- stop: s
52
- };
53
- }
54
- export {
55
- T as useDebounceFn,
56
- p as useResizeObserver,
57
- b as useThrottleFn
58
- };
59
- //# sourceMappingURL=hooks.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.mjs","sources":["../../../src/__builtins__/shared/hooks.ts"],"sourcesContent":["import type { Ref } from 'vue'\nimport { onUnmounted, watch } from 'vue'\n\nexport function useDebounceFn<T extends (...args: any[]) => any>(\n fn: T,\n delay: number | (() => number),\n): T {\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n\n return ((...args: Parameters<T>) => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId)\n }\n\n const delayMs = typeof delay === 'function' ? delay() : delay\n\n timeoutId = setTimeout(() => {\n fn(...args)\n timeoutId = null\n }, delayMs)\n }) as T\n}\n\nexport function useThrottleFn<T extends (...args: any[]) => any>(\n fn: T,\n delay: number,\n trailing = true,\n leading = true,\n): T {\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n let lastCallTime = 0\n let lastArgs: Parameters<T> | null = null\n\n return ((...args: Parameters<T>) => {\n const now = Date.now()\n if (lastCallTime === 0 && leading) {\n lastCallTime = now\n fn(...args)\n return\n }\n if (lastCallTime === 0 && !leading) {\n lastCallTime = now\n }\n\n const remainingTime = delay - (now - lastCallTime)\n\n lastArgs = args\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId)\n }\n\n if (remainingTime <= 0 && lastCallTime !== now) {\n lastCallTime = now\n fn(...args)\n lastArgs = null\n }\n else if (trailing) {\n timeoutId = setTimeout(() => {\n lastCallTime = Date.now()\n if (lastArgs !== null) {\n fn(...lastArgs)\n lastArgs = null\n }\n timeoutId = null\n }, remainingTime)\n }\n }) as T\n}\n\nexport function useResizeObserver(\n target: Ref<Element | null> | Element | null,\n callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void,\n options?: ResizeObserverOptions,\n): {\n isSupported: boolean\n stop: () => void\n} {\n let observer: ResizeObserver | null = null\n const isSupported = globalThis.window !== undefined && 'ResizeObserver' in globalThis\n\n const cleanup = () => {\n if (observer) {\n observer.disconnect()\n observer = null\n }\n }\n\n const stop = () => {\n cleanup()\n }\n\n const start = () => {\n cleanup()\n\n /* istanbul ignore if @preserve */\n if (!isSupported) {\n return\n }\n\n const element = (target && 'value' in target ? target.value : target) as Element\n\n if (!element) {\n return\n }\n\n observer = new ResizeObserver(callback)\n observer.observe(element, options)\n }\n\n if (target && 'value' in target) {\n watch(\n target,\n () => {\n start()\n },\n { immediate: true, flush: 'post' },\n )\n }\n else {\n start()\n }\n onUnmounted(() => {\n cleanup()\n })\n\n return {\n isSupported,\n stop,\n }\n}\n"],"names":["useDebounceFn","fn","delay","timeoutId","args","delayMs","useThrottleFn","trailing","leading","lastCallTime","lastArgs","now","remainingTime","useResizeObserver","target","callback","options","observer","isSupported","cleanup","stop","start","element","watch","onUnmounted"],"mappings":";AAGO,SAASA,EACdC,GACAC,GACG;AACH,MAAIC,IAAkD;AAEtD,UAAQ,IAAIC,MAAwB;AAClC,IAAID,MAAc,QAChB,aAAaA,CAAS;AAGxB,UAAME,IAAU,OAAOH,KAAU,aAAaA,MAAUA;AAExD,IAAAC,IAAY,WAAW,MAAM;AAC3B,MAAAF,EAAG,GAAGG,CAAI,GACVD,IAAY;AAAA,IACd,GAAGE,CAAO;AAAA,EACZ;AACF;AAEO,SAASC,EACdL,GACAC,GACAK,IAAW,IACXC,IAAU,IACP;AACH,MAAIL,IAAkD,MAClDM,IAAe,GACfC,IAAiC;AAErC,UAAQ,IAAIN,MAAwB;AAClC,UAAMO,IAAM,KAAK,IAAA;AACjB,QAAIF,MAAiB,KAAKD,GAAS;AACjC,MAAAC,IAAeE,GACfV,EAAG,GAAGG,CAAI;AACV;AAAA,IACF;AACA,IAAIK,MAAiB,KAAK,CAACD,MACzBC,IAAeE;AAGjB,UAAMC,IAAgBV,KAASS,IAAMF;AAErC,IAAAC,IAAWN,GAEPD,MAAc,QAChB,aAAaA,CAAS,GAGpBS,KAAiB,KAAKH,MAAiBE,KACzCF,IAAeE,GACfV,EAAG,GAAGG,CAAI,GACVM,IAAW,QAEJH,MACPJ,IAAY,WAAW,MAAM;AAC3B,MAAAM,IAAe,KAAK,IAAA,GAChBC,MAAa,SACfT,EAAG,GAAGS,CAAQ,GACdA,IAAW,OAEbP,IAAY;AAAA,IACd,GAAGS,CAAa;AAAA,EAEpB;AACF;AAEO,SAASC,EACdC,GACAC,GACAC,GAIA;AACA,MAAIC,IAAkC;AACtC,QAAMC,IAAc,WAAW,WAAW,UAAa,oBAAoB,YAErEC,IAAU,MAAM;AACpB,IAAIF,MACFA,EAAS,WAAA,GACTA,IAAW;AAAA,EAEf,GAEMG,IAAO,MAAM;AACjB,IAAAD,EAAA;AAAA,EACF,GAEME,IAAQ,MAAM;AAClB,IAAAF,EAAA;AAAA,IAAQ;AAGR,QAAI,CAACD;AACH;AAGF,UAAMI,IAAWR,KAAU,WAAWA,IAASA,EAAO,QAAQA;AAE9D,IAAKQ,MAILL,IAAW,IAAI,eAAeF,CAAQ,GACtCE,EAAS,QAAQK,GAASN,CAAO;AAAA,EACnC;AAEA,SAAIF,KAAU,WAAWA,IACvBS;AAAA,IACET;AAAA,IACA,MAAM;AACJ,MAAAO,EAAA;AAAA,IACF;AAAA,IACA,EAAE,WAAW,IAAM,OAAO,OAAA;AAAA,EAAO,IAInCA,EAAA,GAEFG,EAAY,MAAM;AAChB,IAAAL,EAAA;AAAA,EACF,CAAC,GAEM;AAAA,IACL,aAAAD;AAAA,IACA,MAAAE;AAAA,EAAA;AAEJ;"}