vite-uni-dev-tool 0.0.48 → 1.0.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 (292) hide show
  1. package/README.md +20 -0
  2. package/dist/const.cjs +1 -0
  3. package/dist/const.d.ts +78 -161
  4. package/dist/const.d.ts.map +1 -1
  5. package/dist/const.js +1 -47
  6. package/dist/core-shared.d.ts +44 -0
  7. package/dist/core-shared.d.ts.map +1 -0
  8. package/dist/core-shared.js +1 -0
  9. package/dist/core.d.ts +2 -40
  10. package/dist/core.d.ts.map +1 -1
  11. package/dist/core.js +4 -159
  12. package/dist/i18n/index.cjs +1 -0
  13. package/dist/i18n/index.d.ts +9 -0
  14. package/dist/i18n/index.d.ts.map +1 -0
  15. package/dist/i18n/index.js +1 -0
  16. package/dist/i18n/instance.cjs +1 -0
  17. package/dist/i18n/instance.d.ts +15 -0
  18. package/dist/i18n/instance.d.ts.map +1 -0
  19. package/dist/i18n/instance.js +1 -0
  20. package/dist/i18n/locales/en.cjs +1 -0
  21. package/dist/i18n/locales/en.d.ts +470 -0
  22. package/dist/i18n/locales/en.d.ts.map +1 -0
  23. package/dist/i18n/locales/en.js +1 -0
  24. package/dist/i18n/locales/zh-Hans.cjs +1 -0
  25. package/dist/i18n/locales/zh-Hans.d.ts +476 -0
  26. package/dist/i18n/locales/zh-Hans.d.ts.map +1 -0
  27. package/dist/i18n/locales/zh-Hans.js +1 -0
  28. package/dist/index.cjs +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/modules/devConsole/index.cjs +4 -0
  32. package/dist/{devConsole → modules/devConsole}/index.d.ts +1 -1
  33. package/dist/modules/devConsole/index.d.ts.map +1 -0
  34. package/dist/modules/devConsole/index.js +4 -0
  35. package/dist/modules/devEvent/index.cjs +5 -0
  36. package/dist/modules/devEvent/index.d.ts +115 -0
  37. package/dist/modules/devEvent/index.d.ts.map +1 -0
  38. package/dist/modules/devEvent/index.js +5 -0
  39. package/dist/modules/devIntercept/index.cjs +13 -0
  40. package/dist/modules/devIntercept/index.d.ts +71 -0
  41. package/dist/modules/devIntercept/index.d.ts.map +1 -0
  42. package/dist/modules/devIntercept/index.js +13 -0
  43. package/dist/modules/devStore/index.cjs +1 -0
  44. package/dist/modules/devStore/index.d.ts +159 -0
  45. package/dist/modules/devStore/index.d.ts.map +1 -0
  46. package/dist/modules/devStore/index.js +1 -0
  47. package/dist/modules/devToolInfo/index.cjs +1 -0
  48. package/dist/modules/devToolInfo/index.d.ts +27 -0
  49. package/dist/modules/devToolInfo/index.d.ts.map +1 -0
  50. package/dist/modules/devToolInfo/index.js +1 -0
  51. package/dist/plugins/uniDevTool/transform/transformApp.cjs +44 -0
  52. package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -1
  53. package/dist/plugins/uniDevTool/transform/transformApp.js +17 -17
  54. package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -0
  55. package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -1
  56. package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
  57. package/dist/plugins/uniDevTool/transform/transformVue.cjs +41 -0
  58. package/dist/plugins/uniDevTool/transform/transformVue.d.ts +1 -2
  59. package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
  60. package/dist/plugins/uniDevTool/transform/transformVue.js +32 -19
  61. package/dist/plugins/uniDevTool/uniDevTool.cjs +5 -0
  62. package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -11
  63. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  64. package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
  65. package/dist/plugins/uniGlobalComponents/uniGlobalComponents.cjs +19 -0
  66. package/dist/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +1 -1
  67. package/dist/plugins/uniGlobalComponents/uniGlobalComponents.js +11 -19
  68. package/dist/plugins/uniParseStock/index.d.ts +10 -0
  69. package/dist/plugins/uniParseStock/index.d.ts.map +1 -0
  70. package/dist/plugins/utils/index.cjs +2 -0
  71. package/dist/plugins/utils/index.d.ts +1 -3
  72. package/dist/plugins/utils/index.d.ts.map +1 -1
  73. package/dist/plugins/utils/index.js +2 -2
  74. package/dist/shims-uni.d.ts +140 -0
  75. package/dist/type.d.ts +174 -16
  76. package/dist/type.d.ts.map +1 -1
  77. package/dist/utils/array.cjs +1 -0
  78. package/dist/utils/array.d.ts.map +1 -1
  79. package/dist/utils/array.js +1 -12
  80. package/dist/utils/date.cjs +1 -0
  81. package/dist/utils/date.d.ts.map +1 -1
  82. package/dist/utils/date.js +1 -59
  83. package/dist/utils/file.cjs +1 -0
  84. package/dist/utils/file.d.ts.map +1 -1
  85. package/dist/utils/file.js +1 -85
  86. package/dist/utils/function.cjs +1 -0
  87. package/dist/utils/function.d.ts +13 -0
  88. package/dist/utils/function.d.ts.map +1 -1
  89. package/dist/utils/function.js +1 -68
  90. package/dist/utils/index.cjs +1 -0
  91. package/dist/utils/index.d.ts.map +1 -1
  92. package/dist/utils/index.js +1 -63
  93. package/dist/utils/ip.cjs +1 -0
  94. package/dist/utils/ip.d.ts +1 -1
  95. package/dist/utils/ip.d.ts.map +1 -1
  96. package/dist/utils/ip.js +1 -45
  97. package/dist/utils/language.cjs +1 -0
  98. package/dist/utils/language.d.ts +2 -1
  99. package/dist/utils/language.d.ts.map +1 -1
  100. package/dist/utils/language.js +1 -63
  101. package/dist/utils/object.cjs +1 -0
  102. package/dist/utils/object.d.ts +4 -5
  103. package/dist/utils/object.d.ts.map +1 -1
  104. package/dist/utils/object.js +1 -136
  105. package/dist/utils/openLink.cjs +1 -0
  106. package/dist/utils/openLink.d.ts.map +1 -1
  107. package/dist/utils/openLink.js +1 -28
  108. package/dist/utils/page.cjs +1 -0
  109. package/dist/utils/page.d.ts.map +1 -1
  110. package/dist/utils/page.js +1 -7
  111. package/dist/utils/platform.cjs +1 -0
  112. package/dist/utils/platform.d.ts.map +1 -1
  113. package/dist/utils/platform.js +1 -17
  114. package/dist/utils/string.cjs +1 -0
  115. package/dist/utils/string.d.ts.map +1 -1
  116. package/dist/utils/string.js +1 -114
  117. package/dist/utils/utils.cjs +1 -0
  118. package/dist/utils/utils.d.ts +1 -1
  119. package/dist/utils/utils.d.ts.map +1 -1
  120. package/dist/utils/utils.js +1 -126
  121. package/dist/v3/AppTransition/index.vue +170 -0
  122. package/dist/v3/AutoSizer/index.vue +4 -5
  123. package/dist/v3/AutoSizer/index1.vue +4 -6
  124. package/dist/v3/AutoSizer/utils.ts +1 -1
  125. package/dist/v3/CaptureScreen/index.vue +19 -8
  126. package/dist/v3/CircularButton/index.vue +64 -13
  127. package/dist/v3/ConsoleList/ConsoleItem.vue +56 -5
  128. package/dist/v3/ConsoleList/RunJSInput.vue +10 -6
  129. package/dist/v3/ConsoleList/index.vue +51 -35
  130. package/dist/v3/CustomSwiper/CustomSwiperItem.vue +49 -0
  131. package/dist/v3/CustomSwiper/index.vue +104 -0
  132. package/dist/v3/DevTool/fps-collector.render.ts +148 -0
  133. package/dist/v3/DevTool/index.vue +209 -102
  134. package/dist/v3/DevToolButton/index.vue +40 -59
  135. package/dist/v3/DevToolTitle/index.vue +4 -1
  136. package/dist/v3/DevToolWindow/DevToolOverlay.vue +182 -0
  137. package/dist/v3/DevToolWindow/const.ts +47 -69
  138. package/dist/v3/DevToolWindow/hooks/dataUtils.ts +48 -0
  139. package/dist/v3/DevToolWindow/hooks/useDevToolData.ts +338 -0
  140. package/dist/v3/DevToolWindow/hooks/useDevToolHandlers.ts +549 -0
  141. package/dist/v3/DevToolWindow/hooks/useDevToolOverlay.ts +184 -0
  142. package/dist/v3/DevToolWindow/index.css +89 -0
  143. package/dist/v3/DevToolWindow/index.vue +800 -1450
  144. package/dist/v3/DraggableContainer/index.vue +456 -0
  145. package/dist/v3/ElEvent/ElEventItem.vue +4 -3
  146. package/dist/v3/ElEvent/index.vue +26 -9
  147. package/dist/v3/Empty/index.vue +1 -0
  148. package/dist/v3/FilterInput/index.vue +8 -22
  149. package/dist/v3/FilterSelect/index.vue +37 -24
  150. package/dist/v3/Instance/components/InstanceTreeNode.vue +265 -0
  151. package/dist/v3/Instance/flatten.ts +226 -0
  152. package/dist/v3/Instance/index.vue +94 -0
  153. package/dist/v3/Instance/registry.ts +49 -0
  154. package/dist/v3/Instance/transformTree.ts +375 -0
  155. package/dist/v3/Instance/transformTreeCtx.ts +268 -0
  156. package/dist/v3/{InstanceTree → Instance}/typing.d.ts +15 -2
  157. package/dist/v3/InstanceDetail/index.vue +433 -44
  158. package/dist/v3/JsonDetail/index.vue +12 -8
  159. package/dist/v3/JsonPretty/components/Brackets/index.vue +1 -0
  160. package/dist/v3/JsonPretty/components/Carets/index.vue +2 -1
  161. package/dist/v3/JsonPretty/components/CheckController/index.vue +26 -15
  162. package/dist/v3/JsonPretty/components/TreeNode/index.vue +42 -20
  163. package/dist/v3/JsonPretty/index.vue +60 -37
  164. package/dist/v3/JsonPretty/utils/index.ts +41 -44
  165. package/dist/v3/MovableContainer/index.vue +89 -0
  166. package/dist/v3/NFCList/NFCItem.vue +14 -14
  167. package/dist/v3/NFCList/NFCTool.vue +99 -81
  168. package/dist/v3/NFCList/index.vue +14 -10
  169. package/dist/v3/NetworkList/InterceptConfig.vue +154 -364
  170. package/dist/v3/NetworkList/InterceptItem.vue +14 -6
  171. package/dist/v3/NetworkList/NetworkDetail.vue +34 -29
  172. package/dist/v3/NetworkList/NetworkIntercept.vue +11 -8
  173. package/dist/v3/NetworkList/NetworkItem.vue +27 -11
  174. package/dist/v3/NetworkList/NetworkSend.vue +132 -290
  175. package/dist/v3/NetworkList/hooks/useNetworkForm.ts +86 -0
  176. package/dist/v3/NetworkList/index.vue +32 -24
  177. package/dist/v3/NetworkList/utils.ts +101 -0
  178. package/dist/v3/Performance/index.vue +495 -0
  179. package/dist/v3/Performance/modules/PerformanceMetrics.vue +153 -0
  180. package/dist/v3/Performance/modules/PerformanceWidget.vue +249 -0
  181. package/dist/v3/Performance/modules/usePerformanceChart.ts +460 -0
  182. package/dist/v3/Performance/modules/usePerformanceData.ts +258 -0
  183. package/dist/v3/Pick/index.vue +322 -0
  184. package/dist/v3/PiniaList/index.vue +38 -17
  185. package/dist/v3/RouteList/index.vue +32 -15
  186. package/dist/v3/RunJS/index.vue +30 -10
  187. package/dist/v3/ScanCodeList/ScanCodeItem.vue +2 -9
  188. package/dist/v3/ScanCodeList/index.vue +12 -9
  189. package/dist/v3/SettingButton/index.vue +45 -0
  190. package/dist/v3/SettingList/index.css +120 -0
  191. package/dist/v3/SettingList/index.vue +96 -537
  192. package/dist/v3/SettingList/modules/SettingDevTool.vue +208 -0
  193. package/dist/v3/SettingList/modules/SettingInfo.vue +119 -0
  194. package/dist/v3/SettingList/modules/SettingLanguage.vue +74 -0
  195. package/dist/v3/SettingList/modules/SettingLog.vue +230 -0
  196. package/dist/v3/SettingList/modules/SettingNetwork.vue +120 -0
  197. package/dist/v3/SettingList/modules/SettingTheme.vue +312 -0
  198. package/dist/v3/SourceCode/Line.vue +15 -2
  199. package/dist/v3/SourceCode/index.vue +25 -24
  200. package/dist/v3/SourceCode/parseCode.ts +114 -56
  201. package/dist/v3/StorageList/index.vue +33 -33
  202. package/dist/v3/Tabs/index.vue +31 -28
  203. package/dist/v3/Tag/index.vue +39 -20
  204. package/dist/v3/TransferList/TransferDetail.vue +268 -0
  205. package/dist/v3/TransferList/TransferItem.vue +125 -0
  206. package/dist/v3/TransferList/index.vue +181 -0
  207. package/dist/v3/UniEvent/UniEventItem.vue +1 -0
  208. package/dist/v3/UniEvent/index.vue +28 -29
  209. package/dist/v3/{VirtualListPro → VirtualList}/AutoSize.vue +1 -1
  210. package/dist/v3/VirtualList/index.vue +382 -82
  211. package/dist/v3/VuexList/index.vue +38 -17
  212. package/dist/v3/WebSocket/WebSocketDetail.vue +142 -80
  213. package/dist/v3/WebSocket/WebSocketItem.vue +10 -4
  214. package/dist/v3/WebSocket/index.vue +44 -30
  215. package/dist/v3/hooks/useNFC/index.ts +6 -6
  216. package/dist/v3/hooks/useNFC/typing.d.ts +2 -2
  217. package/dist/v3/hooks/useNFC/useNFCAndroid.ts +215 -626
  218. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +54 -85
  219. package/dist/v3/hooks/useNFC/utils.ts +3 -3
  220. package/dist/v3/hooks/useRequest/index.ts +2 -2
  221. package/dist/v3/hooks/useScanCode/index.ts +10 -8
  222. package/dist/v3/styles/theme.css +290 -0
  223. package/dist/v3/styles/theme.ts +12 -0
  224. package/package.json +25 -5
  225. package/dist/devConsole/index.d.ts.map +0 -1
  226. package/dist/devConsole/index.js +0 -273
  227. package/dist/devEvent/index.d.ts +0 -328
  228. package/dist/devEvent/index.d.ts.map +0 -1
  229. package/dist/devEvent/index.js +0 -697
  230. package/dist/devEventBus/index.d.ts +0 -42
  231. package/dist/devEventBus/index.d.ts.map +0 -1
  232. package/dist/devEventBus/index.js +0 -70
  233. package/dist/devIntercept/index.d.ts +0 -281
  234. package/dist/devIntercept/index.d.ts.map +0 -1
  235. package/dist/devIntercept/index.js +0 -949
  236. package/dist/devRunJS/index.d.ts +0 -67
  237. package/dist/devRunJS/index.d.ts.map +0 -1
  238. package/dist/devStore/index.d.ts +0 -199
  239. package/dist/devStore/index.d.ts.map +0 -1
  240. package/dist/devStore/index.js +0 -562
  241. package/dist/devToolInfo/index.d.ts +0 -17
  242. package/dist/devToolInfo/index.d.ts.map +0 -1
  243. package/dist/devToolInfo/index.js +0 -15
  244. package/dist/v3/AutoSizer/utils.d.ts +0 -5
  245. package/dist/v3/AutoSizer/utils.d.ts.map +0 -1
  246. package/dist/v3/ConsoleList/staticTips.d.ts +0 -13
  247. package/dist/v3/ConsoleList/staticTips.d.ts.map +0 -1
  248. package/dist/v3/DevToolWindow/const.d.ts +0 -46
  249. package/dist/v3/DevToolWindow/const.d.ts.map +0 -1
  250. package/dist/v3/InstanceTree/components/InstanceTreeNode.vue +0 -81
  251. package/dist/v3/InstanceTree/flatten.d.ts +0 -10
  252. package/dist/v3/InstanceTree/flatten.d.ts.map +0 -1
  253. package/dist/v3/InstanceTree/flatten.ts +0 -75
  254. package/dist/v3/InstanceTree/index.vue +0 -51
  255. package/dist/v3/InstanceTree/transformTree.d.ts +0 -17
  256. package/dist/v3/InstanceTree/transformTree.d.ts.map +0 -1
  257. package/dist/v3/InstanceTree/transformTree.ts +0 -237
  258. package/dist/v3/JsonPretty/hooks/useClipboard.d.ts +0 -4
  259. package/dist/v3/JsonPretty/hooks/useClipboard.d.ts.map +0 -1
  260. package/dist/v3/JsonPretty/hooks/useError.d.ts +0 -8
  261. package/dist/v3/JsonPretty/hooks/useError.d.ts.map +0 -1
  262. package/dist/v3/JsonPretty/type.d.ts +0 -94
  263. package/dist/v3/JsonPretty/type.d.ts.map +0 -1
  264. package/dist/v3/JsonPretty/utils/index.d.ts +0 -10
  265. package/dist/v3/JsonPretty/utils/index.d.ts.map +0 -1
  266. package/dist/v3/NFCList/const.d.ts +0 -13
  267. package/dist/v3/NFCList/const.d.ts.map +0 -1
  268. package/dist/v3/NetworkList/const.d.ts +0 -5
  269. package/dist/v3/NetworkList/const.d.ts.map +0 -1
  270. package/dist/v3/SourceCode/parseCode.d.ts +0 -27
  271. package/dist/v3/SourceCode/parseCode.d.ts.map +0 -1
  272. package/dist/v3/UploadList/UploadDetail.vue +0 -255
  273. package/dist/v3/UploadList/UploadItem.vue +0 -122
  274. package/dist/v3/UploadList/index.vue +0 -125
  275. package/dist/v3/VirtualListPro/index.vue +0 -229
  276. package/dist/v3/hooks/useContainerStyle.d.ts +0 -15
  277. package/dist/v3/hooks/useContainerStyle.d.ts.map +0 -1
  278. package/dist/v3/hooks/useNFC/index.d.ts +0 -5
  279. package/dist/v3/hooks/useNFC/index.d.ts.map +0 -1
  280. package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts +0 -2
  281. package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts.map +0 -1
  282. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts +0 -2
  283. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts.map +0 -1
  284. package/dist/v3/hooks/useNFC/utils.d.ts +0 -95
  285. package/dist/v3/hooks/useNFC/utils.d.ts.map +0 -1
  286. package/dist/v3/hooks/useRequest/index.d.ts +0 -126
  287. package/dist/v3/hooks/useRequest/index.d.ts.map +0 -1
  288. package/dist/v3/hooks/useRequest/utils.d.ts +0 -35
  289. package/dist/v3/hooks/useRequest/utils.d.ts.map +0 -1
  290. package/dist/v3/hooks/useScanCode/index.d.ts +0 -36
  291. package/dist/v3/hooks/useScanCode/index.d.ts.map +0 -1
  292. /package/dist/v3/{VirtualListPro → VirtualList}/readme.md +0 -0
@@ -0,0 +1,456 @@
1
+ <template>
2
+ <view
3
+ class="draggable-container"
4
+ :style="containerStyle"
5
+ @touchstart="onTouchStart"
6
+ @touchmove.stop="onTouchMove"
7
+ @touchend="onTouchEnd"
8
+ @mousedown="onMouseDown">
9
+ <slot></slot>
10
+
11
+ <!-- 缩放句柄 -->
12
+ <view
13
+ v-if="resizable && !isFullScreen"
14
+ class="resize-handle"
15
+ :style="{ zIndex }"
16
+ @touchstart.stop="onResizeStart"
17
+ @touchmove.stop="onResizeMove"
18
+ @touchend.stop="onResizeEnd"
19
+ @mousedown.stop.prevent="onResizeMouseDown"></view>
20
+ </view>
21
+ </template>
22
+ <script lang="ts">
23
+ export default {
24
+ options: {
25
+ virtualHost: true, // 开启虚拟节点,使组件标签不渲染,属性直接透传
26
+ },
27
+ };
28
+ </script>
29
+
30
+ <script setup lang="ts">
31
+ /**
32
+ * DraggableContainer - 可拖拽且可缩放容器组件
33
+ * 适用于 DevTool 窗口化及悬浮窗展示
34
+ */
35
+ import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
36
+ import { debounce } from '../../utils';
37
+
38
+ const props = withDefaults(
39
+ defineProps<{
40
+ x?: number;
41
+ y?: number;
42
+ width?: number | string;
43
+ height?: number | string;
44
+ zIndex?: number;
45
+ customStyle?: Record<string, any>;
46
+ boundaryPadding?: number;
47
+ // 是否启用缩放
48
+ resizable?: boolean;
49
+ minWidth?: number;
50
+ minHeight?: number;
51
+ // 拖拽句柄的选择器(只允许在该元素上触发拖拽)
52
+ handle?: string;
53
+ // 是否全屏状态
54
+ isFullScreen?: boolean;
55
+ maxWidth?: number;
56
+ }>(),
57
+ {
58
+ x: 0,
59
+ y: 0,
60
+ width: 375,
61
+ height: 300,
62
+ zIndex: 1000,
63
+ boundaryPadding: 0,
64
+ resizable: false,
65
+ minWidth: 200,
66
+ minHeight: 150,
67
+ isFullScreen: false,
68
+ },
69
+ );
70
+
71
+ const emit = defineEmits<{
72
+ (e: 'update:x', val: number): void;
73
+ (e: 'update:y', val: number): void;
74
+ (e: 'update:width', val: number): void;
75
+ (e: 'update:height', val: number): void;
76
+ (
77
+ e: 'change',
78
+ detail: { x: number; y: number; width: number; height: number },
79
+ ): void;
80
+ }>();
81
+
82
+ // 定义插槽类型,解决外部使用的类型报错
83
+ defineSlots<{
84
+ default(): any;
85
+ }>();
86
+
87
+ // 当前位置和尺寸
88
+ const localX = ref(props.x);
89
+ const localY = ref(props.y);
90
+ const localWidth = ref(typeof props.width === 'number' ? props.width : 375);
91
+ const localHeight = ref(typeof props.height === 'number' ? props.height : 300);
92
+
93
+ // 拖拽/缩放状态
94
+ let isDragging = false;
95
+ let isResizing = false;
96
+ let startX = 0;
97
+ let startY = 0;
98
+ let startPosX = 0;
99
+ let startPosY = 0;
100
+ let startWidth = 0;
101
+ let startHeight = 0;
102
+
103
+ let screenWidth = 375;
104
+ let screenHeight = 667;
105
+
106
+ onMounted(() => {
107
+ const sysInfo = uni.getSystemInfoSync();
108
+ screenWidth = sysInfo.windowWidth || 375;
109
+ screenHeight = sysInfo.windowHeight || 667;
110
+
111
+ if (typeof window !== 'undefined') {
112
+ window.addEventListener('mousemove', onGlobalMouseMove);
113
+ window.addEventListener('mouseup', onGlobalMouseUp);
114
+ window.addEventListener('resize', onWindowResize);
115
+ }
116
+ });
117
+
118
+ function onWindowResize() {
119
+ const sysInfo = uni.getSystemInfoSync();
120
+ const oldScreenWidth = screenWidth;
121
+ const oldScreenHeight = screenHeight;
122
+
123
+ screenWidth = sysInfo.windowWidth || 375;
124
+ screenHeight = sysInfo.windowHeight || 667;
125
+
126
+ // 如果宽度变窄导致溢出,或者窗口宽度发生改变,重新居中
127
+ if (oldScreenWidth !== screenWidth || oldScreenHeight !== screenHeight) {
128
+ if (
129
+ props.maxWidth &&
130
+ localWidth.value > screenWidth * (props.maxWidth / 100)
131
+ ) {
132
+ localWidth.value = Math.floor(screenWidth * (props.maxWidth / 100));
133
+ }
134
+
135
+ // 居中逻辑
136
+ localX.value = Math.max(0, (screenWidth - localWidth.value) / 2);
137
+ localY.value = Math.max(0, (screenHeight - localHeight.value) / 2);
138
+
139
+ emit('update:x', localX.value);
140
+ emit('update:y', localY.value);
141
+ emit('update:width', localWidth.value);
142
+ emitChange();
143
+ }
144
+ }
145
+
146
+ onUnmounted(() => {
147
+ if (typeof window !== 'undefined') {
148
+ window.removeEventListener('mousemove', onGlobalMouseMove);
149
+ window.removeEventListener('mouseup', onGlobalMouseUp);
150
+ window.removeEventListener('resize', onWindowResize);
151
+ }
152
+ });
153
+
154
+ watch(
155
+ [() => props.x, () => props.y, () => props.width, () => props.height],
156
+ ([nx, ny, nw, nh]) => {
157
+ if (!isDragging && !isResizing) {
158
+ if (nx !== undefined) localX.value = nx;
159
+ if (ny !== undefined) localY.value = ny;
160
+ if (typeof nw === 'number') localWidth.value = nw;
161
+ if (typeof nh === 'number') localHeight.value = nh;
162
+ }
163
+ },
164
+ );
165
+
166
+ const containerStyle = computed(() => {
167
+ if (props.isFullScreen) {
168
+ return {
169
+ ...props.customStyle,
170
+ position: 'fixed' as const,
171
+ left: 0,
172
+ top: 0,
173
+ width: '100vw',
174
+ height: '100vh',
175
+ zIndex: props.zIndex,
176
+ };
177
+ }
178
+ const finalWidth = localWidth.value;
179
+ const maxWidthVal = props.maxWidth ? `${props.maxWidth}%` : 'none';
180
+
181
+ return {
182
+ ...props.customStyle,
183
+ position: 'fixed' as const,
184
+ left: `${localX.value}px`,
185
+ top: `${localY.value}px`,
186
+ width: typeof finalWidth === 'number' ? `${finalWidth}px` : finalWidth,
187
+ maxWidth: maxWidthVal,
188
+ height:
189
+ typeof localHeight.value === 'number'
190
+ ? `${localHeight.value}px`
191
+ : localHeight.value,
192
+ zIndex: props.zIndex,
193
+ touchAction: 'none',
194
+ };
195
+ });
196
+
197
+ function clampPosition(x: number, y: number, w: number, h: number) {
198
+ const padding = props.boundaryPadding;
199
+ // 计算实际视觉宽度(受 maxWidth 限制)
200
+ const actualWidth =
201
+ props.maxWidth && typeof w === 'number'
202
+ ? Math.min(w, screenWidth * (props.maxWidth / 100))
203
+ : w;
204
+
205
+ const maxX = Math.max(0, screenWidth - actualWidth - padding);
206
+ const maxY = Math.max(0, screenHeight - h - padding);
207
+ return {
208
+ x: Math.max(padding, Math.min(maxX, x)),
209
+ y: Math.max(padding, Math.min(maxY, y)),
210
+ };
211
+ }
212
+
213
+ // 拖拽逻辑
214
+ function onTouchStart(e: TouchEvent) {
215
+ if (props.isFullScreen || e.touches.length !== 1) return;
216
+
217
+ // 检查是否在句柄上触发
218
+ if (props.handle && !isTargetOnHandle(e.target)) return;
219
+
220
+ startDrag(e.touches[0].clientX, e.touches[0].clientY);
221
+ }
222
+
223
+ function onMouseDown(e: MouseEvent) {
224
+ if (props.isFullScreen) return;
225
+
226
+ // 检查是否在句柄上触发
227
+ if (props.handle && !isTargetOnHandle(e.target)) return;
228
+
229
+ startDrag(e.clientX, e.clientY);
230
+ }
231
+
232
+ function isTargetOnHandle(target: any): boolean {
233
+ if (!props.handle) return true;
234
+
235
+ // 1. 优先通过 dataset 判断(UniApp/小程序跨端最可靠方案)
236
+ if (
237
+ target &&
238
+ target.dataset &&
239
+ (target.dataset.dragHandle || target.dataset.handle)
240
+ ) {
241
+ return true;
242
+ }
243
+
244
+ // 2. 备选:通过选择器判断(主要支持 H5)
245
+ let curr = target;
246
+ const handleClass = props.handle.startsWith('.')
247
+ ? props.handle.slice(1)
248
+ : props.handle;
249
+
250
+ while (curr) {
251
+ if (
252
+ curr.className &&
253
+ typeof curr.className === 'string' &&
254
+ curr.className.includes(handleClass)
255
+ ) {
256
+ return true;
257
+ }
258
+ // 检查 dataset
259
+ if (curr.dataset && (curr.dataset.dragHandle || curr.dataset.handle)) {
260
+ return true;
261
+ }
262
+
263
+ // 向上遍历父节点
264
+ curr = curr.parentNode || curr.parentElement;
265
+ if (
266
+ curr === null ||
267
+ curr === undefined ||
268
+ (curr.className &&
269
+ typeof curr.className === 'string' &&
270
+ curr.className.includes('draggable-container'))
271
+ )
272
+ break;
273
+ }
274
+ return false;
275
+ }
276
+
277
+ function startDrag(clientX: number, clientY: number) {
278
+ startX = clientX;
279
+ startY = clientY;
280
+ startPosX = localX.value;
281
+ startPosY = localY.value;
282
+ isDragging = true;
283
+ }
284
+
285
+ function onTouchMove(e: TouchEvent) {
286
+ if (isDragging && !isResizing) {
287
+ const touch = e.touches[0];
288
+ updatePosition(touch.clientX, touch.clientY);
289
+ }
290
+ }
291
+
292
+ function onGlobalMouseMove(e: MouseEvent) {
293
+ if (isDragging && !isResizing) {
294
+ updatePosition(e.clientX, e.clientY);
295
+ } else if (isResizing) {
296
+ updateSize(e.clientX, e.clientY);
297
+ }
298
+ }
299
+
300
+ function updatePosition(clientX: number, clientY: number) {
301
+ const dx = clientX - startX;
302
+ const dy = clientY - startY;
303
+ const { x, y } = clampPosition(
304
+ startPosX + dx,
305
+ startPosY + dy,
306
+ localWidth.value,
307
+ localHeight.value,
308
+ );
309
+ localX.value = x;
310
+ localY.value = y;
311
+ }
312
+
313
+ function onTouchEnd() {
314
+ endDrag();
315
+ }
316
+
317
+ function onGlobalMouseUp() {
318
+ if (isDragging) endDrag();
319
+ if (isResizing) endResize();
320
+ }
321
+
322
+ function endDrag() {
323
+ isDragging = false;
324
+ emit('update:x', localX.value);
325
+ emit('update:y', localY.value);
326
+ emitChange();
327
+ }
328
+
329
+ // 缩放逻辑
330
+ function onResizeStart(e: TouchEvent) {
331
+ const touch = e.touches[0];
332
+ initResize(touch.clientX, touch.clientY);
333
+ }
334
+
335
+ function onResizeMouseDown(e: MouseEvent) {
336
+ initResize(e.clientX, e.clientY);
337
+ }
338
+
339
+ function initResize(clientX: number, clientY: number) {
340
+ isResizing = true;
341
+ isDragging = false;
342
+ startX = clientX;
343
+ startY = clientY;
344
+ startWidth = localWidth.value;
345
+ startHeight = localHeight.value;
346
+ }
347
+
348
+ function onResizeMove(e: TouchEvent) {
349
+ if (isResizing) {
350
+ const touch = e.touches[0];
351
+ updateSize(touch.clientX, touch.clientY);
352
+ }
353
+ }
354
+
355
+ function updateSize(clientX: number, clientY: number) {
356
+ const dx = clientX - startX;
357
+ const dy = clientY - startY;
358
+ localWidth.value = Math.max(props.minWidth, startWidth + dx);
359
+ localHeight.value = Math.max(props.minHeight, startHeight + dy);
360
+
361
+ // 边缘及最大宽度修正
362
+ if (props.maxWidth) {
363
+ const absoluteMaxWidth = screenWidth * (props.maxWidth / 100);
364
+ if (localWidth.value > absoluteMaxWidth) {
365
+ localWidth.value = absoluteMaxWidth;
366
+ }
367
+ }
368
+
369
+ if (localX.value + localWidth.value > screenWidth) {
370
+ localWidth.value = screenWidth - localX.value;
371
+ }
372
+ if (localY.value + localHeight.value > screenHeight) {
373
+ localHeight.value = screenHeight - localY.value;
374
+ }
375
+ }
376
+
377
+ function onResizeEnd() {
378
+ endResize();
379
+ }
380
+
381
+ function endResize() {
382
+ isResizing = false;
383
+ emit('update:width', localWidth.value);
384
+ emit('update:height', localHeight.value);
385
+ emitChange();
386
+ }
387
+
388
+ /**
389
+ * 手动初始化拖拽(通过 scoped slot 暴露给子组件使用)
390
+ * @param e 触摸或鼠标事件
391
+ */
392
+ function initDrag(e: TouchEvent | MouseEvent) {
393
+ if (props.isFullScreen) return;
394
+
395
+ let clientX = 0;
396
+ let clientY = 0;
397
+
398
+ if ('touches' in e && e.touches.length > 0) {
399
+ clientX = e.touches[0].clientX;
400
+ clientY = e.touches[0].clientY;
401
+ } else if ('clientX' in e) {
402
+ clientX = (e as MouseEvent).clientX;
403
+ clientY = (e as MouseEvent).clientY;
404
+ }
405
+
406
+ startDrag(clientX, clientY);
407
+ }
408
+
409
+ // 暴露方法给父组件
410
+ defineExpose({
411
+ startDrag,
412
+ initDrag,
413
+ });
414
+
415
+ const emitChange = debounce(() => {
416
+ emit('change', {
417
+ x: localX.value,
418
+ y: localY.value,
419
+ width: localWidth.value,
420
+ height: localHeight.value,
421
+ });
422
+ }, 300);
423
+ </script>
424
+
425
+ <style scoped>
426
+ .draggable-container {
427
+ touch-action: none;
428
+ overflow: hidden;
429
+ background-color: var(--dev-tool-bg3-color);
430
+ box-shadow: 0 4px 16px rgb(0 0 0 / 15%);
431
+ display: flex;
432
+ flex-direction: column;
433
+ pointer-events: auto; /* 确保容器及其子项能够接收事件 */
434
+ }
435
+
436
+ .resize-handle {
437
+ position: absolute;
438
+ right: 0;
439
+ bottom: 0;
440
+ width: 32px; /* 增加热区面积 */
441
+ height: 32px;
442
+ cursor: nwse-resize;
443
+ background: linear-gradient(
444
+ 135deg,
445
+ transparent 60%,
446
+ var(--dev-tool-main-color) 60%
447
+ );
448
+ opacity: 0.6;
449
+ pointer-events: auto; /* 显式开启事件响应 */
450
+ border-radius: 12px;
451
+ }
452
+
453
+ .resize-handle:active {
454
+ opacity: 1;
455
+ }
456
+ </style>
@@ -35,10 +35,9 @@
35
35
  <view
36
36
  class="el-event-item-position"
37
37
  v-for="(point, index) in eventItem.touches"
38
- :key="index"
39
- >
38
+ :key="index">
40
39
  <view>cx:{{ point.clientX }}</view>
41
- <view>cy:{{ point.clientX }}</view>
40
+ <view>cy:{{ point.clientY }}</view>
42
41
  <view>px:{{ point.pageX }}</view>
43
42
  <view>py:{{ point.pageY }}</view>
44
43
  </view>
@@ -84,6 +83,7 @@ function onOpenJSon() {
84
83
  text-align: right;
85
84
  word-break: break-all;
86
85
  }
86
+
87
87
  .link {
88
88
  cursor: pointer;
89
89
  text-decoration: underline;
@@ -98,6 +98,7 @@ function onOpenJSon() {
98
98
  align-items: center;
99
99
  min-height: 24px;
100
100
  }
101
+
101
102
  .el-event-item-position > view {
102
103
  width: 25%;
103
104
  }
@@ -1,18 +1,19 @@
1
1
  <template>
2
2
  <view class="el-event-content">
3
- <DevToolTitle customStyle="padding: 0 16px">
4
- 事件触发列表
3
+ <view class="el-event-control">
4
+ <DevToolTitle> {{ t('elEvent.title') }} </DevToolTitle>
5
+
5
6
  <Tag
6
7
  mode="clear"
7
8
  style="margin-left: auto"
8
9
  customStyle="margin-left: auto"
9
10
  @click="emit('clear')"
10
11
  >
11
- 清空
12
+ {{ t('common.clear') }}
12
13
  </Tag>
13
- </DevToolTitle>
14
+ </view>
14
15
 
15
- <VirtualListPro
16
+ <VirtualList
16
17
  v-if="elEventList && elEventList?.length > 0"
17
18
  class="el-event-list"
18
19
  :pageSize="20"
@@ -32,7 +33,7 @@
32
33
  <ElEventItem :eventItem="item" @openJson="emit('openJson', $event)" />
33
34
  </AutoSize>
34
35
  </template>
35
- </VirtualListPro>
36
+ </VirtualList>
36
37
 
37
38
  <Empty v-else />
38
39
  </view>
@@ -42,11 +43,14 @@ import DevToolTitle from '../DevToolTitle/index.vue';
42
43
  import ElEventItem from './ElEventItem.vue';
43
44
  import Tag from '../Tag/index.vue';
44
45
  import Empty from '../Empty/index.vue';
45
- import VirtualListPro from '../VirtualListPro/index.vue';
46
- import AutoSize from '../VirtualListPro/AutoSize.vue';
46
+ import VirtualList from '../VirtualList/index.vue';
47
+ import AutoSize from '../VirtualList/AutoSize.vue';
47
48
  import type { DevTool } from '../../type';
49
+ import { useI18n } from '../../i18n';
50
+
51
+ const { t } = useI18n();
48
52
 
49
- const props = defineProps<{
53
+ const _props = defineProps<{
50
54
  elEventList?: DevTool.ElEventItem[];
51
55
  eventCount?: DevTool.EventCount;
52
56
  useDevSource?: boolean;
@@ -77,16 +81,29 @@ const emit = defineEmits<{
77
81
  box-sizing: border-box;
78
82
  gap: 12px;
79
83
  }
84
+
80
85
  .el-event-statistics-item {
81
86
  display: flex;
82
87
  align-items: center;
83
88
  width: 25%;
84
89
  }
90
+
85
91
  .el-event-statistics-item-name {
86
92
  margin-right: 8px;
87
93
  }
94
+
88
95
  .el-event-list {
89
96
  height: calc(100% - 32px * 2);
90
97
  overflow: auto;
91
98
  }
99
+
100
+ .el-event-control {
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: space-between;
104
+ padding: 0 16px;
105
+ height: 32px;
106
+ box-sizing: border-box;
107
+ border-bottom: 1px solid var(--dev-tool-border-color);
108
+ }
92
109
  </style>
@@ -16,6 +16,7 @@ defineProps<{ text?: string }>();
16
16
  align-items: center;
17
17
  margin: 0 auto;
18
18
  }
19
+
19
20
  .dev-tool-empty-image {
20
21
  margin-top: 50px;
21
22
  width: 50px;
@@ -1,20 +1,20 @@
1
1
  <template>
2
- <view class="filter-input-wrapper">
2
+ <view class="filter-input-wrapper" :style="customStyle">
3
3
  <input
4
4
  :class="`filter-input`"
5
5
  :value="modelValue"
6
6
  :placeholder="placeholder || '请输入'"
7
- @confirm="debounceInput"
8
- />
9
- <view class="filter-input-clear" @click="onClear"> × </view>
7
+ @input="debounceInput"
8
+ @confirm="debounceInput" />
9
+ <view class="filter-input-clear" v-if="modelValue" @click="onClear">×</view>
10
10
  </view>
11
11
  </template>
12
12
  <script lang="ts" setup>
13
13
  import { debounce } from '../../utils';
14
- import { ref, onMounted } from 'vue';
15
- const props = defineProps<{
14
+ defineProps<{
16
15
  placeholder?: string;
17
16
  modelValue?: string;
17
+ customStyle?: string | Record<string, any>;
18
18
  }>();
19
19
  const emit = defineEmits<{
20
20
  (e: 'update:modelValue', value: string): void;
@@ -22,8 +22,6 @@ const emit = defineEmits<{
22
22
  (e: 'openSearch', value: boolean): void;
23
23
  }>();
24
24
 
25
- const isActive = ref(false);
26
-
27
25
  function onInput(e: any) {
28
26
  const value = e.detail.value;
29
27
  emit('update:modelValue', value);
@@ -35,29 +33,17 @@ function onClear() {
35
33
  emit('search', '');
36
34
  }
37
35
 
38
- function openSearch(open: boolean) {
39
- isActive.value = open;
40
- emit('openSearch', open);
41
- if (!open && props.modelValue) {
42
- emit('update:modelValue', '');
43
- emit('search', '');
44
- }
45
- }
46
-
47
36
  const debounceInput = debounce(onInput, 500);
48
37
  </script>
49
38
  <style scoped>
50
39
  .filter-input-wrapper {
51
- flex: 1;
52
40
  display: flex;
53
41
  align-items: center;
54
42
  padding: 0 8px;
55
43
  width: 100%;
56
44
  height: 24px;
57
-
58
45
  border-radius: 4px;
59
46
  border: 1px solid var(--dev-tool-border-color);
60
-
61
47
  background-color: var(--dev-tool-bg-color);
62
48
  transition: background-color 0.3s;
63
49
  box-sizing: border-box;
@@ -67,11 +53,11 @@ const debounceInput = debounce(onInput, 500);
67
53
  flex: 1;
68
54
  box-shadow: none;
69
55
  box-sizing: border-box;
70
- border-radius: 5;
56
+ font: unset;
57
+ border-radius: 5px;
71
58
  font-family: inherit;
72
59
  color: var(--dev-tool-text-color);
73
60
  font-weight: 400;
74
- font: unset;
75
61
  height: 24px;
76
62
  transition: color 0.3s;
77
63
  }