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
@@ -1,334 +1,420 @@
1
1
  <template>
2
- <view
3
- v-if="open"
4
- :style="customStyle"
5
- :class="['dev-tool-window', `dev-tool-window-${theme}`]"
6
- @touchmove="onTouchMove"
7
- @wheel="onWheel"
8
- >
9
- <view class="dev-tool-window-bg"></view>
10
-
11
- <!--
12
- 你能想象,没有这条注释会报错???
13
- 我甚至都不知道错在哪里???
14
- 凸(艹皿艹 )
15
- 总有一些莫名其妙的错误
16
- Uncaught TypeError: Cannot read property 'children' of null at uni-app-view.umd.js:7
17
- Uncaught TypeError: Cannot read property '$' of undefined at uni-app-view.umd.js:7
18
- -->
19
-
20
- <Tabs
21
- v-model="activeTab"
22
- :items="tabItems"
23
- :scroll-left="tabScrollLeft"
24
- @close="onCloseWindow"
25
- @scroll="debounceScrollTabs"
26
- @change="onChangeTabs"
27
- />
28
-
29
- <swiper
30
- class="dev-tool-window-container"
31
- :current="activeTab"
32
- @change="onChangeSwiper"
33
- >
34
- <!-- <swiper-item>
35
- <InstanceDetail v-if="activeTab == 0" :contentHeight="contentHeight" />
36
- </swiper-item> -->
37
- <swiper-item>
38
- <ConsoleList
39
- v-if="swiperShow(tabIndex.Console)"
40
- :currentConsoleType="currentConsoleType"
41
- :consoleList="consoleList"
42
- :sourceFileServers="sourceFileServers"
43
- :mode="mode"
44
- :useDevSource="useDevSource"
45
- :zIndex="zIndex + 1"
46
- :contentHeight="contentHeight"
47
- v-model="searchConsole"
48
- @choose="onConsoleChoose"
49
- @search="onSearchConsole"
50
- @run="onRunJS"
51
- @openCode="onOpenCode"
52
- @openJson="onOpenJson"
53
- />
54
- </swiper-item>
55
- <swiper-item>
56
- <NetworkList
57
- v-if="swiperShow(tabIndex.Network)"
58
- v-model="searchNetwork"
59
- :mode="mode"
60
- :zIndex="zIndex + 1"
61
- :networkList="networkList"
62
- :useDevSource="useDevSource"
63
- :currentNetworkType="currentNetworkType"
64
- :currentNetworkSort="currentNetworkSort"
65
- :contentHeight="contentHeight"
66
- @choose="onNetworkChoose"
67
- @search="onSearchNetwork"
68
- @sort="onSortNetwork"
69
- @openCode="onOpenCode"
70
- @openSend="onOpenNetworkSend"
71
- @openDetail="onOpenNetworkDetail"
72
- @openIntercept="onOpenNetworkIntercept"
73
- />
74
- </swiper-item>
75
- <swiper-item>
76
- <UploadList
77
- v-if="swiperShow(tabIndex.Upload)"
78
- :currentUploadType="currentUploadType"
79
- :uploadList="uploadList"
80
- :zIndex="zIndex + 1"
81
- :mode="mode"
82
- :useDevSource="useDevSource"
83
- :contentHeight="contentHeight"
84
- v-model="searchUpload"
85
- @choose="onUploadChoose"
86
- @search="onSearchUpload"
87
- @openDetail="onOpenUploadDetail"
88
- @openCode="onOpenCode"
89
- />
90
- </swiper-item>
91
- <swiper-item>
92
- <WebSocket
93
- v-if="swiperShow(tabIndex.WebSocket)"
94
- :wsList="wsList"
95
- :currentWebSocketType="currentWebSocketType"
96
- :zIndex="zIndex + 1"
97
- :contentHeight="contentHeight"
98
- v-model="searchWs"
99
- @choose="onWebSocketChoose"
100
- @search="onSearchWs"
101
- @openDetail="onOpenWebSocketDetail"
102
- @openCode="onOpenCode"
103
- />
104
- </swiper-item>
105
- <swiper-item>
106
- <RouteList
107
- v-if="swiperShow(tabIndex.Route)"
108
- :routeList="routeList"
109
- :contentHeight="contentHeight"
110
- v-model="searchRoute"
111
- @search="onSearchRoute"
112
- @routeRefresh="onRouteRefresh"
113
- />
114
- </swiper-item>
115
- <swiper-item>
116
- <ElEvent
117
- v-if="swiperShow(tabIndex.ElEvent)"
118
- :elEventList="elEventList"
119
- :zIndex="zIndex + 1"
120
- :contentHeight="contentHeight"
121
- @clear="onElEventClear"
122
- @openJson="onOpenJson"
123
- />
124
- </swiper-item>
125
- <swiper-item>
126
- <UniEvent
127
- v-if="swiperShow(tabIndex.UniEvent)"
128
- :mode="mode"
129
- :uniEventList="uniEventList"
130
- :eventCount="eventCount"
131
- :zIndex="zIndex + 1"
132
- :useDevSource="useDevSource"
133
- :sourceFileServers="sourceFileServers"
134
- :contentHeight="contentHeight"
135
- @clear="onUniEventClear"
136
- @openCode="onOpenCode"
137
- />
138
- </swiper-item>
139
- <swiper-item>
140
- <CaptureScreen
141
- v-if="swiperShow(tabIndex.CaptureScreen)"
142
- :screenList="screenList"
143
- @clear="onCaptureScreenClear"
144
- />
145
- </swiper-item>
146
- <swiper-item>
147
- <ScanCodeList
148
- v-if="swiperShow(tabIndex.ScanCode)"
149
- :mode="mode"
150
- :useDevSource="useDevSource"
151
- :scanCodeList="scanCodeList"
152
- :contentHeight="contentHeight"
153
- @clear="onScanCodeListClear"
154
- @openCode="onOpenCode"
155
- @openJson="onOpenJson"
156
- />
157
- </swiper-item>
158
- <swiper-item>
159
- <NFCList
160
- v-if="swiperShow(tabIndex.NFC)"
161
- :mode="mode"
162
- :useDevSource="useDevSource"
163
- :nfcList="nfcList"
164
- :contentHeight="contentHeight"
165
- @clear="onNfcClear"
166
- @openCode="onOpenCode"
167
- @openJson="onOpenJson"
168
- @openTool="onOpenNfcTool"
169
- />
170
- </swiper-item>
171
- <swiper-item>
172
- <StorageList
173
- v-if="swiperShow(tabIndex.Storage)"
174
- v-model:storage-list="storageList"
175
- v-model="searchStorage"
176
- :theme="theme"
177
- @choose="onStorageChoose"
178
- @remove="onStorageRemove"
179
- @change="onChangeStorage"
180
- @search="onSearchStorage"
181
- />
182
- </swiper-item>
183
- <swiper-item>
184
- <VuexList
185
- v-if="swiperShow(tabIndex.Vuex)"
186
- v-model:vuexList="vuexList"
187
- :theme="theme"
188
- :contentHeight="contentHeight"
189
- @change="onChangeVuex"
190
- />
191
- </swiper-item>
192
- <swiper-item>
193
- <PiniaList
194
- v-if="swiperShow(tabIndex.Pinia)"
195
- v-model:pinia-list="piniaList"
196
- :theme="theme"
197
- :contentHeight="contentHeight"
198
- @diff-value="onChangePinia"
199
- />
200
- </swiper-item>
201
- <swiper-item>
202
- <SettingList
203
- v-if="swiperShow(tabIndex.Setting)"
204
- :devToolVisible="devToolVisible"
205
- :sizeFormat="sizeFormat"
206
- :theme="theme"
207
- :buildInfo="buildInfo"
208
- :cacheInterceptConfig="cacheInterceptConfig"
209
- :netWorkStatus="netWorkStatus"
210
- @showDevButton="onShowDevButton"
211
- @restartDevTool="onRestartDevTool"
212
- @restartApp="onRestartApp"
213
- @exportLog="onExportLog"
214
- @screenshot="onScreenshot"
215
- @clearCache="onClearCache"
216
- @destroyDevTool="onDestroyDevTool"
217
- @changeTheme="onChangeTheme"
218
- @changeCacheInterceptConfig="onChangeCacheInterceptConfig"
219
- @openJson="onOpenJson"
220
- />
221
- </swiper-item>
222
- </swiper>
223
-
224
- <!-- 源码查看 -->
225
- <SourceCode
226
- v-if="openCode"
227
- :url="stack"
228
- :mode="mode"
2
+ <AppTransition
3
+ :show="open"
4
+ name="reveal"
5
+ :duration="300"
6
+ :zIndex="zIndex"
7
+ :origin="origin"
8
+ :animated="useTransition"
9
+ @after-enter="onAfterEnter"
10
+ @after-leave="onAfterLeave">
11
+ <DraggableContainer
12
+ ref="draggableRef"
13
+ :x="windowX"
14
+ :y="windowY"
15
+ :width="windowWidth"
16
+ :height="windowHeight"
229
17
  :zIndex="zIndex"
18
+ :resizable="true"
19
+ :isFullScreen="isFullScreen"
20
+ :maxWidth="100"
21
+ handle=".drag-handle"
22
+ @update:x="onUpdateWindowX"
23
+ @update:y="onUpdateWindowY"
24
+ @update:width="onUpdateWindowWidth"
25
+ @update:height="onUpdateWindowHeight"
26
+ @change="onWindowChange">
27
+ <view
28
+ :style="dynamicWindowStyle"
29
+ :class="[
30
+ 'dev-tool-window',
31
+ isFullScreen ? 'is-full-screen' : 'is-window',
32
+ ]">
33
+ <view class="dev-tool-window-bg"></view>
34
+
35
+ <view
36
+ class="window-header drag-handle"
37
+ data-drag-handle="1"
38
+ @touchstart="onInitDrag"
39
+ @mousedown="onInitDrag">
40
+ <view
41
+ class="drag-indicator"
42
+ v-if="!isFullScreen"
43
+ data-drag-handle="1"></view>
44
+
45
+ <!--
46
+ 你能想象,没有这条注释会报错???
47
+ 我甚至都不知道错在哪里???
48
+ 凸(艹皿艹 )
49
+ 总有一些莫名其妙的错误
50
+ Uncaught TypeError: Cannot read property 'children' of null at uni-app-view.umd.js:7
51
+ Uncaught TypeError: Cannot read property '$' of undefined at uni-app-view.umd.js:7
52
+ -->
53
+
54
+ <Tabs
55
+ data-drag-handle="1"
56
+ :model-value="activeTab"
57
+ :items="tabItems"
58
+ :scroll-left="tabScrollLeft"
59
+ @close="onCloseWindow"
60
+ @scroll="debounceScrollTabs"
61
+ @change="onChangeTabs">
62
+ <template #extra>
63
+ <CircularButton
64
+ :text="isFullScreen ? '❐' : '⛶'"
65
+ @click="toggleFullScreen" />
66
+ </template>
67
+ </Tabs>
68
+ </view>
69
+
70
+ <CustomSwiper
71
+ v-if="isReady"
72
+ :model-value="activeTab"
73
+ :item-count="tabItems.length"
74
+ class="dev-tool-window-container"
75
+ @change="onChangeTabs">
76
+ <!-- Console -->
77
+ <CustomSwiperItem
78
+ v-if="isTabVisible('Console')"
79
+ :key="tabIndex.Console"
80
+ style="width: 100%; height: 100%">
81
+ <ConsoleList
82
+ v-if="swiperShow(tabIndex.Console)"
83
+ :contentHeight="dynamicContentHeight"
84
+ :currentConsoleType="currentConsoleType"
85
+ :consoleList="consoleList"
86
+ :sourceFileServers="sourceFileServers"
87
+ :mode="mode"
88
+ :useDevSource="useDevSource"
89
+ :zIndex="zIndex + 1"
90
+ :model-value="searchConsole"
91
+ @choose="onConsoleChoose"
92
+ @search="onSearchConsole"
93
+ @run="onRunJS"
94
+ @openCode="overlay.handlers.onOpenCode"
95
+ @openJson="overlay.handlers.onOpenJson"
96
+ @update:model-value="onUpdateSearchConsole" />
97
+ </CustomSwiperItem>
98
+
99
+ <!-- Network -->
100
+ <CustomSwiperItem
101
+ v-if="isTabVisible('Network')"
102
+ :key="tabIndex.Network"
103
+ style="width: 100%; height: 100%">
104
+ <NetworkList
105
+ v-if="swiperShow(tabIndex.Network)"
106
+ :contentHeight="dynamicContentHeight"
107
+ :model-value="searchNetwork"
108
+ :mode="mode"
109
+ :zIndex="zIndex + 1"
110
+ :networkList="networkList"
111
+ :useDevSource="useDevSource"
112
+ :currentNetworkType="currentNetworkType"
113
+ :currentNetworkSort="currentNetworkSort"
114
+ @search="onSearchNetwork"
115
+ @choose="onNetworkChoose"
116
+ @sort="onSortNetwork"
117
+ @openCode="overlay.handlers.onOpenCode"
118
+ @openSend="overlay.handlers.onOpenNetworkSend"
119
+ @openDetail="overlay.handlers.onOpenNetworkDetail"
120
+ @openIntercept="overlay.handlers.onOpenNetworkIntercept"
121
+ @update:model-value="onUpdateSearchNetwork" />
122
+ </CustomSwiperItem>
123
+
124
+ <!-- Transfer -->
125
+ <CustomSwiperItem
126
+ v-if="isTabVisible('Transfer')"
127
+ :key="tabIndex.Transfer"
128
+ style="width: 100%; height: 100%">
129
+ <TransferList
130
+ v-if="swiperShow(tabIndex.Transfer)"
131
+ :contentHeight="dynamicContentHeight"
132
+ :currentType="currentTransferType"
133
+ :currentCategory="currentTransferCategory"
134
+ :list="transferList"
135
+ :type="'upload'"
136
+ :zIndex="zIndex + 1"
137
+ :mode="mode"
138
+ :useDevSource="useDevSource"
139
+ :model-value="searchTransfer"
140
+ @choose="onTransferChoose"
141
+ @chooseCategory="handlers.onTransferCategoryChoose"
142
+ @search="onSearchTransfer"
143
+ @openDetail="overlay.handlers.onOpenTransferDetail"
144
+ @openCode="overlay.handlers.onOpenCode"
145
+ @update:model-value="onUpdateSearchTransfer" />
146
+ </CustomSwiperItem>
147
+
148
+ <!-- WebSocket -->
149
+ <CustomSwiperItem
150
+ v-if="isTabVisible('WebSocket')"
151
+ :key="tabIndex.WebSocket"
152
+ style="width: 100%; height: 100%">
153
+ <WebSocket
154
+ v-if="swiperShow(tabIndex.WebSocket)"
155
+ :contentHeight="dynamicContentHeight"
156
+ :wsList="wsList"
157
+ :currentWebSocketType="currentWebSocketType"
158
+ :zIndex="zIndex + 1"
159
+ :model-value="searchWs"
160
+ @search="onSearchWs"
161
+ @choose="onWebSocketChoose"
162
+ @openDetail="
163
+ overlay.handlers.onOpenWebSocketDetail($event, currentWebSocket)
164
+ "
165
+ @openCode="overlay.handlers.onOpenCode"
166
+ @update:model-value="onUpdateSearchWs" />
167
+ </CustomSwiperItem>
168
+
169
+ <!-- Route -->
170
+ <CustomSwiperItem
171
+ v-if="isTabVisible('Route')"
172
+ :key="tabIndex.Route"
173
+ style="width: 100%; height: 100%">
174
+ <RouteList
175
+ v-if="swiperShow(tabIndex.Route)"
176
+ :contentHeight="dynamicContentHeight"
177
+ :routeList="routeList"
178
+ :model-value="searchRoute"
179
+ @search="onSearchRoute"
180
+ @routeRefresh="onRouteRefresh"
181
+ @update:model-value="onUpdateSearchRoute" />
182
+ </CustomSwiperItem>
183
+
184
+ <!-- Instance -->
185
+ <CustomSwiperItem
186
+ v-if="isTabVisible('Instance')"
187
+ :key="tabIndex.Instance"
188
+ style="width: 100%; height: 100%">
189
+ <InstanceDetail
190
+ v-if="swiperShow(tabIndex.Instance)"
191
+ :contentHeight="dynamicContentHeight"
192
+ :theme="theme"
193
+ @openCode="overlay.handlers.onOpenCode"
194
+ @openJson="overlay.handlers.onOpenJson" />
195
+ </CustomSwiperItem>
196
+
197
+ <!-- ElEvent -->
198
+ <CustomSwiperItem
199
+ v-if="isTabVisible('ElEvent')"
200
+ :key="tabIndex.ElEvent"
201
+ style="width: 100%; height: 100%">
202
+ <ElEvent
203
+ v-if="swiperShow(tabIndex.ElEvent)"
204
+ :contentHeight="dynamicContentHeight"
205
+ :elEventList="elEventList"
206
+ :zIndex="zIndex + 1"
207
+ @clear="onElEventClear"
208
+ @openJson="overlay.handlers.onOpenJson" />
209
+ </CustomSwiperItem>
210
+
211
+ <!-- UniEvent -->
212
+ <CustomSwiperItem
213
+ v-if="isTabVisible('UniEvent')"
214
+ :key="tabIndex.UniEvent"
215
+ style="width: 100%; height: 100%">
216
+ <UniEvent
217
+ v-if="swiperShow(tabIndex.UniEvent)"
218
+ :contentHeight="dynamicContentHeight"
219
+ :mode="mode"
220
+ :uniEventList="uniEventList"
221
+ :eventCount="eventCount"
222
+ :zIndex="zIndex + 1"
223
+ :useDevSource="useDevSource"
224
+ :sourceFileServers="sourceFileServers"
225
+ @clear="onUniEventClear"
226
+ @openCode="overlay.handlers.onOpenCode" />
227
+ </CustomSwiperItem>
228
+
229
+ <!-- Performance -->
230
+ <CustomSwiperItem
231
+ v-if="isTabVisible('Performance')"
232
+ :key="tabIndex.Performance"
233
+ style="width: 100%; height: 100%">
234
+ <Performance
235
+ v-if="swiperShow(tabIndex.Performance)"
236
+ :contentHeight="dynamicContentHeight"
237
+ :theme="theme"
238
+ :mode="'tab'" />
239
+ </CustomSwiperItem>
240
+
241
+ <!-- CaptureScreen -->
242
+ <CustomSwiperItem
243
+ v-if="isTabVisible('CaptureScreen')"
244
+ :key="tabIndex.CaptureScreen"
245
+ style="width: 100%; height: 100%">
246
+ <CaptureScreen
247
+ v-if="swiperShow(tabIndex.CaptureScreen)"
248
+ :screenList="screenList"
249
+ @clear="onCaptureScreenClear" />
250
+ </CustomSwiperItem>
251
+
252
+ <!-- ScanCode -->
253
+ <CustomSwiperItem
254
+ v-if="isTabVisible('ScanCode')"
255
+ :key="tabIndex.ScanCode"
256
+ style="width: 100%; height: 100%">
257
+ <ScanCodeList
258
+ v-if="swiperShow(tabIndex.ScanCode)"
259
+ :contentHeight="dynamicContentHeight"
260
+ :mode="mode"
261
+ :useDevSource="useDevSource"
262
+ :scanCodeList="scanCodeList"
263
+ @clear="onScanCodeListClear"
264
+ @openCode="overlay.handlers.onOpenCode"
265
+ @openJson="overlay.handlers.onOpenJson" />
266
+ </CustomSwiperItem>
267
+
268
+ <!-- NFC -->
269
+ <CustomSwiperItem
270
+ v-if="isTabVisible('NFC')"
271
+ :key="tabIndex.NFC"
272
+ style="width: 100%; height: 100%">
273
+ <NFCList
274
+ v-if="swiperShow(tabIndex.NFC)"
275
+ :contentHeight="dynamicContentHeight"
276
+ :mode="mode"
277
+ :useDevSource="useDevSource"
278
+ :nfcList="nfcList"
279
+ @clear="onNfcClear"
280
+ @openCode="overlay.handlers.onOpenCode"
281
+ @openJson="overlay.handlers.onOpenJson"
282
+ @openTool="overlay.handlers.onOpenNfcTool" />
283
+ </CustomSwiperItem>
284
+
285
+ <!-- Storage -->
286
+ <CustomSwiperItem
287
+ v-if="isTabVisible('Storage')"
288
+ :key="tabIndex.Storage"
289
+ style="width: 100%; height: 100%">
290
+ <StorageList
291
+ v-if="swiperShow(tabIndex.Storage)"
292
+ :theme="theme"
293
+ :storageList="storageList"
294
+ :model-value="searchStorage"
295
+ @choose="onStorageChoose"
296
+ @remove="onStorageRemove"
297
+ @change="onChangeStorage"
298
+ @search="onSearchStorage"
299
+ @update:storageList="onUpdateStorageList"
300
+ @update:model-value="onUpdateSearchStorage" />
301
+ </CustomSwiperItem>
302
+
303
+ <!-- Vuex -->
304
+ <CustomSwiperItem
305
+ v-if="isTabVisible('Vuex')"
306
+ :key="tabIndex.Vuex"
307
+ style="width: 100%; height: 100%">
308
+ <VuexList
309
+ v-if="swiperShow(tabIndex.Vuex)"
310
+ :contentHeight="dynamicContentHeight"
311
+ :theme="theme"
312
+ :vuexList="vuexList"
313
+ @change="onChangeVuex"
314
+ @update:vuexList="onUpdateVuexList" />
315
+ </CustomSwiperItem>
316
+
317
+ <!-- Pinia -->
318
+ <CustomSwiperItem
319
+ v-if="isTabVisible('Pinia')"
320
+ :key="tabIndex.Pinia"
321
+ style="width: 100%; height: 100%">
322
+ <PiniaList
323
+ v-if="swiperShow(tabIndex.Pinia)"
324
+ :contentHeight="dynamicContentHeight"
325
+ :theme="theme"
326
+ :piniaList="piniaList"
327
+ @diff-value="onChangePinia"
328
+ @update:piniaList="onUpdatePiniaList" />
329
+ </CustomSwiperItem>
330
+
331
+ <!-- Setting -->
332
+ <CustomSwiperItem
333
+ v-if="isTabVisible('Setting')"
334
+ :key="tabIndex.Setting"
335
+ style="width: 100%; height: 100%">
336
+ <SettingList
337
+ v-if="swiperShow(tabIndex.Setting)"
338
+ :contentHeight="dynamicContentHeight"
339
+ :theme="theme"
340
+ :devToolVisible="devToolVisible"
341
+ :performanceVisible="performanceVisible"
342
+ :performanceShowFps="performanceShowFps"
343
+ :performanceShowCpu="performanceShowCpu"
344
+ :sizeFormat="sizeFormat"
345
+ :buildInfo="buildInfo"
346
+ :cache-intercept-config="cacheInterceptConfig"
347
+ :cache-network-log="cacheNetworkLog"
348
+ :cache-console-log="cacheConsoleLog"
349
+ :use-transition="useTransition"
350
+ :base-font-size="baseFontSize"
351
+ :tag-font-size="tagFontSize"
352
+ :tips-font-size="tipsFontSize"
353
+ :font-family="fontFamily"
354
+ :font-weight="fontWeight"
355
+ :net-work-status="netWorkStatus"
356
+ @showDevButton="onShowDevButton"
357
+ @showPerformance="onChangePerformance"
358
+ @restartDevTool="onRestartDevTool"
359
+ @restartApp="onRestartApp"
360
+ @exportLog="onExportLog"
361
+ @screenshot="onScreenshot"
362
+ @clearCache="onClearCache"
363
+ @destroyDevTool="onDestroyDevTool"
364
+ @change-theme="onChangeTheme"
365
+ @change-cache-intercept-config="onChangeCacheInterceptConfig"
366
+ @change-cache-network-log="onChangeCacheNetworkLog"
367
+ @change-cache-console-log="onChangeCacheConsoleLog"
368
+ @change-use-transition="onChangeUseTransition"
369
+ @changeFont="onChangeFontSize"
370
+ @onChangePerformanceShowFps="onChangePerformanceShowFps"
371
+ @onChangePerformanceShowCpu="onChangePerformanceShowCpu"
372
+ @openJson="overlay.handlers.onOpenJson" />
373
+ </CustomSwiperItem>
374
+ </CustomSwiper>
375
+ </view>
376
+ </DraggableContainer>
377
+ <DevToolOverlay
378
+ v-if="isReady"
379
+ :overlayState="overlay.state"
380
+ :overlayHandlers="overlay.handlers"
381
+ :mode="mode"
382
+ :zIndex="zIndex + 10"
230
383
  :sourceFileServers="sourceFileServers"
231
384
  :contentHeight="contentHeight"
232
385
  :customStyle="customStyle"
233
- @close="onCloseCode"
234
- />
235
-
236
- <!-- 发起请求 -->
237
- <NetworkSend
238
- v-if="showNetworkSend"
239
- :zIndex="zIndex"
240
- :network="network"
386
+ :network="overlay.network"
387
+ :overlay="overlay"
388
+ :currentWebSocket="currentWebSocket"
241
389
  :interceptNetworkList="interceptNetworkList"
242
- :customStyle="customStyle"
243
- @close="onCloseNetworkSend"
244
- @openDetail="onOpenNetworkDetail"
245
- />
246
-
247
- <!-- 拦截请求 -->
248
- <NetworkIntercept
249
- v-if="showNetworkIntercept"
250
- :zIndex="zIndex"
251
- :network="network"
252
- :interceptNetworkList="interceptNetworkList"
253
- :contentHeight="contentHeight"
254
- :customStyle="customStyle"
255
- @close="onCloseNetworkIntercept"
256
- @remove="onRemoveInterceptConfig"
257
- @openConfig="onOpenInterceptConfig"
258
- />
259
-
260
- <!-- 拦截配置 -->
261
- <InterceptConfig
262
- v-if="showInterceptConfig"
263
- :zIndex="zIndex"
264
- :network="network"
265
- :customStyle="customStyle"
266
- @close="onCloseInterceptConfig"
267
- @confirm="onConfirmInterceptConfig"
268
- />
269
-
270
- <!-- 请求详情 -->
271
- <NetworkDetail
272
- v-if="showNetworkDetail"
273
- :zIndex="zIndex"
274
- :network="network"
275
- :contentHeight="contentHeight"
276
- :customStyle="customStyle"
277
- @close="onCloseNetworkDetail"
278
- />
279
-
280
- <!-- 上传详情 -->
281
- <UploadDetail
282
- v-if="showUploadDetail"
283
- :upload="upload"
284
- :zIndex="zIndex"
285
- :contentHeight="contentHeight"
286
- :customStyle="customStyle"
287
- @close="onCloseUploadDetail"
288
- />
289
- <!-- WebSocket详情 -->
290
- <WebSocketDetail
291
- v-if="showWebSocketDetail"
292
- :ws="currentWebSocket"
293
- :zIndex="zIndex"
294
- :contentHeight="contentHeight"
295
- :customStyle="customStyle"
296
- @close="onCloseWebSocketDetail"
297
- @clear="onClearWebSocketMessage"
298
- @openJson="onOpenJson"
299
- />
300
-
301
- <!-- Json详情 -->
302
- <JsonDetail
303
- v-if="showJsonDetail"
304
- :data="jsonData"
305
- :contentHeight="contentHeight"
306
- :customStyle="customStyle"
307
- @close="onCloseJson"
308
- />
309
-
310
- <!-- NFC 工具 -->
311
- <NFCTool
312
- v-if="showNfcTool"
313
- :contentHeight="contentHeight"
314
- :customStyle="customStyle"
315
- @close="onCloseNfcTool"
316
- />
317
- </view>
390
+ :onRemoveInterceptConfig="onRemoveInterceptConfig"
391
+ :onConfirmInterceptConfig="onConfirmInterceptConfig"
392
+ :onClearWebSocketMessage="onClearWebSocketMessage"
393
+ :onSendWebSocket="onSendWebSocket"
394
+ :onOpenJson="overlay.handlers.onOpenJson"
395
+ :useTransition="useTransition"
396
+ :theme="theme" />
397
+ </AppTransition>
318
398
  </template>
319
399
 
400
+ <script lang="ts">
401
+ export default {
402
+ __devTool: true,
403
+ };
404
+ </script>
405
+
320
406
  <script setup lang="ts">
321
407
  import { onShow, onTabItemTap } from '@dcloudio/uni-app';
322
408
  import {
323
- ref,
324
- shallowRef,
325
409
  onMounted,
326
- reactive,
327
410
  computed,
328
411
  nextTick,
329
412
  onBeforeMount,
330
413
  onUnmounted,
414
+ ref,
415
+ watch,
331
416
  } from 'vue';
417
+ import AppTransition from '../AppTransition/index.vue';
332
418
  import Tabs from '../Tabs/index.vue';
333
419
  import ConsoleList from '../ConsoleList/index.vue';
334
420
  import NetworkList from '../NetworkList/index.vue';
@@ -337,168 +423,32 @@ import RouteList from '../RouteList/index.vue';
337
423
  import SettingList from '../SettingList/index.vue';
338
424
  import VuexList from '../VuexList/index.vue';
339
425
  import PiniaList from '../PiniaList/index.vue';
426
+ import Performance from '../Performance/index.vue';
340
427
  import WebSocket from '../WebSocket/index.vue';
341
- import UploadList from '../UploadList/index.vue';
428
+ import TransferList from '../TransferList/index.vue';
342
429
  import ElEvent from '../ElEvent/index.vue';
343
430
  import UniEvent from '../UniEvent/index.vue';
344
-
345
431
  import CaptureScreen from '../CaptureScreen/index.vue';
346
- import SourceCode from '../SourceCode/index.vue';
347
432
  import ScanCodeList from '../ScanCodeList/index.vue';
348
433
  import NFCList from '../NFCList/index.vue';
349
- import NFCTool from '../NFCList/NFCTool.vue';
350
-
351
- import NetworkSend from '../NetworkList/NetworkSend.vue';
352
- import NetworkDetail from '../NetworkList/NetworkDetail.vue';
353
- import NetworkIntercept from '../NetworkList/NetworkIntercept.vue';
354
- import InterceptConfig from '../NetworkList/InterceptConfig.vue';
355
-
356
- import UploadDetail from '../UploadList/UploadDetail.vue';
357
- import WebSocketDetail from '../WebSocket/WebSocketDetail.vue';
358
- import JsonDetail from '../JsonDetail/index.vue';
359
-
360
- // import InstanceDetail from '../InstanceDetail/index.vue';
361
-
362
- import {
363
- DEV_BUTTON_SHOW_OR_HIDE,
364
- DEV_CONSOLE_CLEAR,
365
- DEV_DESTROY,
366
- DEV_EXPORT_LOG,
367
- DEV_LOG_CACHE_CLEAR,
368
- DEV_NETWORK_CLEAR,
369
- DEV_PINIA_CHANGE,
370
- DEV_RESTART_APP,
371
- DEV_RESTART_DEBUGGER,
372
- DEV_ROUTE_REFRESH,
373
- DEV_STORAGE_ADD,
374
- DEV_STORAGE_CLEAR,
375
- DEV_STORAGE_REFRESH,
376
- DEV_STORAGE_REMOVE,
377
- DEV_STORAGE_UPDATE,
378
- DEV_UPLOAD_CLEAR,
379
- DEV_VUEX_CHANGE,
380
- DEV_WEBSOCKET_CLEAR,
381
- DEV_APP_MESSAGE,
382
- DEV_UNI_EVENT_CLEAR,
383
- DEV_RUN_JS,
384
- DEV_CAPTURE_SCREEN_CLEAR,
385
- DEV_INTERCEPT_NETWORK_UPDATE,
386
- DEV_INTERCEPT_NETWORK_REMOVE,
387
- DEV_CHANGE_CACHE_INTERCEPT_CONFIG,
388
- DEV_WEBSOCKET_CLEAR_MESSAGE,
389
- DEV_BOTTOM_TAB_CHANGE,
390
- DEV_EL_EVENT_CLEAR,
391
- DEV_SCAN_CODE_CLEAR,
392
- DEV_NFC_CLEAR,
393
- } from '../../const';
394
- import {
395
- debounce,
396
- getCurrentPagePath,
397
- hightLight,
398
- isAndroid,
399
- isMockWX,
400
- } from '../../utils/index';
434
+ import InstanceDetail from '../InstanceDetail/index.vue';
435
+ import DevToolOverlay from './DevToolOverlay.vue';
436
+ import CustomSwiper from '../CustomSwiper/index.vue';
437
+ import CustomSwiperItem from '../CustomSwiper/CustomSwiperItem.vue';
438
+ import DraggableContainer from '../DraggableContainer/index.vue';
439
+ import CircularButton from '../CircularButton/index.vue';
440
+ import { useI18n } from '../../i18n';
441
+
442
+ import { DEV_CORE_MESSAGE, MSG_TYPE, CMD_TYPE } from '../../const';
443
+ import { getCurrentPagePath } from '../../utils/index';
401
444
  import type { DevTool } from '../../type';
402
- import { devToolEventBus } from '../../core';
403
- import { getDevToolInfo, setDevToolInfo } from '../../devToolInfo';
404
- import { tabItems, emptyNetwork, tabIndex } from './const';
405
-
406
- const backup: {
407
- consoleList: DevTool.ConsoleItem[];
408
- networkList: DevTool.NetworkItem[];
409
- storageList: DevTool.StorageItem[];
410
- wsList: DevTool.WS[];
411
- uploadList: DevTool.UploadItem[];
412
- routeList: DevTool.Page[];
413
- uniEventList: DevTool.UniEventItem[];
414
- runJSList: DevTool.RunJSItem[];
415
- } = {
416
- consoleList: [],
417
- networkList: [],
418
- storageList: [],
419
- wsList: [],
420
- uploadList: [],
421
- routeList: [],
422
- uniEventList: [],
423
- runJSList: [],
424
- };
425
- const consoleList = shallowRef<DevTool.ConsoleItem[]>([]);
426
- const networkList = shallowRef<DevTool.NetworkItem[]>([]);
427
- const uploadList = shallowRef<DevTool.UploadItem[]>([]);
428
- const storageList = shallowRef<DevTool.StorageItem[]>([]);
429
- const routeList = shallowRef<DevTool.Page[]>([]);
430
- const wsList = shallowRef<DevTool.WS[]>([]);
431
- const vuexList = shallowRef<Record<string, any>>({});
432
- const piniaList = shallowRef<Record<string, any>>({});
433
-
434
- const elEventList = shallowRef<DevTool.ElEventItem[]>([]);
435
- const uniEventList = shallowRef<DevTool.UniEventItem[]>([]);
436
- const eventCount = shallowRef<DevTool.EventCount>();
437
- const screenList = shallowRef<DevTool.ScreenItem[]>([]);
438
- const interceptNetworkList = shallowRef<DevTool.NetworkItem[]>([]);
439
- const scanCodeList = shallowRef<DevTool.ScanCodeItem[]>([]);
440
- const nfcList = shallowRef<DevTool.NFCItem[]>([]);
441
-
442
- const netWorkStatus = ref<{
443
- isConnected?: boolean;
444
- networkType?: string;
445
- }>({});
446
- const sizeFormat = shallowRef('');
447
-
448
- const devToolVisible = shallowRef(true);
449
-
450
- const activeTab = shallowRef(1);
451
- const tabScrollLeft = shallowRef(0);
452
- const currentConsoleType = shallowRef('all');
453
- const currentNetworkType = shallowRef('all');
454
- const currentNetworkSort = shallowRef<1 | -1>(1);
455
- const currentUploadType = shallowRef('all');
456
- const currentWebSocketType = shallowRef('all');
457
-
458
- const searchConsole = shallowRef('');
459
- const searchNetwork = shallowRef('');
460
- const searchUpload = shallowRef('');
461
- const searchWs = shallowRef('');
462
- const searchRoute = shallowRef('');
463
- const searchStorage = shallowRef('');
464
- const theme = shallowRef('light');
465
- const openCode = shallowRef(false);
466
- const stack = shallowRef('');
467
-
468
- const network = reactive<DevTool.NetworkItem>({ ...emptyNetwork });
469
-
470
- const showNetworkSend = shallowRef(false);
471
- const showNetworkDetail = shallowRef(false);
472
- const showNetworkIntercept = shallowRef(false);
473
- const showInterceptConfig = shallowRef(false);
474
- const cacheInterceptConfig = shallowRef(true);
475
-
476
- const showJsonDetail = shallowRef(false);
477
- const jsonData = shallowRef({});
478
- const showNfcTool = shallowRef(false);
479
-
480
- const upload = reactive<DevTool.UploadItem>({
481
- index: 0,
482
- status: '',
483
- });
484
- const showUploadDetail = shallowRef(false);
485
-
486
- const webSocket = reactive<DevTool.WS>({
487
- url: '',
488
- message: [],
489
- });
490
-
491
- const currentWebSocket = computed(() => {
492
- return wsList.value.find((item) => item.url === webSocket.url);
493
- });
494
-
495
- const showWebSocketDetail = shallowRef(false);
445
+ import { getDevToolInfo, setDevToolInfo } from '../../modules/devToolInfo';
446
+ import { getTabItems, tabIndex } from './const';
496
447
 
497
- const buildInfo = reactive({
498
- devToolVersion: '0.0.0',
499
- devToolBuildTime: '',
500
- devToolGit: '',
501
- });
448
+ // 引入 Hooks
449
+ import { useDevToolData } from './hooks/useDevToolData';
450
+ import { useDevToolHandlers } from './hooks/useDevToolHandlers';
451
+ import { useDevToolOverlay } from './hooks/useDevToolOverlay';
502
452
 
503
453
  const props = withDefaults(
504
454
  defineProps<{
@@ -510,6 +460,7 @@ const props = withDefaults(
510
460
  zIndex?: number;
511
461
  contentHeight: number;
512
462
  customStyle?: Record<string, any>;
463
+ origin?: { x: number; y: number };
513
464
  }>(),
514
465
  {
515
466
  zIndex: 1000,
@@ -519,1054 +470,468 @@ const props = withDefaults(
519
470
  const emits = defineEmits<{
520
471
  (e: 'close'): void;
521
472
  (e: 'sendMessage', data: { type: string; data: Record<string, any> }): void;
473
+ (e: 'changeTheme', theme: string): void;
522
474
  }>();
523
475
 
524
- function swiperShow(index: number) {
525
- const show =
526
- index == activeTab.value - 1 ||
527
- index == activeTab.value ||
528
- index == activeTab.value + 1;
529
- return show;
530
- }
476
+ const { t } = useI18n();
477
+ const hiddenTabs = ref<string[]>([]);
478
+ const tabItems = computed(() =>
479
+ getTabItems(t).filter((item) => !hiddenTabs.value.includes(item.key)),
480
+ );
531
481
 
532
- const calcLineStartAndEnd = (
533
- list: DevTool.NetworkItem[],
534
- ): {
535
- startTime: number;
536
- endTime: number;
537
- } => {
538
- const startTime = Math.min(...list.map((item) => item.startTime));
539
- const endTime = Math.max(...list.map((item) => item?.endTime ?? Date.now()));
540
-
541
- return { startTime, endTime };
542
- };
482
+ // 初始化 Hooks
483
+ const data = useDevToolData(props);
484
+ const handlers = useDevToolHandlers(props, emits, data);
485
+ const overlay = useDevToolOverlay(props);
486
+
487
+ // 解构常用状态
488
+ const {
489
+ activeTab,
490
+ tabScrollLeft,
491
+ theme,
492
+ consoleList,
493
+ networkList,
494
+ transferList,
495
+ storageList,
496
+ routeList,
497
+ wsList,
498
+ vuexList,
499
+ piniaList,
500
+ elEventList,
501
+ uniEventList,
502
+ eventCount,
503
+ screenList,
504
+ interceptNetworkList,
505
+ scanCodeList,
506
+ nfcList,
507
+ netWorkStatus,
508
+ sizeFormat,
509
+ devToolVisible,
510
+ buildInfo,
511
+ cacheInterceptConfig,
512
+ cacheNetworkLog,
513
+ cacheConsoleLog,
514
+ currentConsoleType,
515
+ currentNetworkType,
516
+ currentNetworkSort,
517
+ currentTransferType,
518
+ currentTransferCategory,
519
+ currentWebSocketType,
520
+ searchConsole,
521
+ searchNetwork,
522
+ searchTransfer,
523
+ searchWs,
524
+ searchRoute,
525
+ searchStorage,
526
+ useTransition,
527
+ baseFontSize,
528
+ tagFontSize,
529
+ tipsFontSize,
530
+ fontFamily,
531
+ fontWeight,
532
+ performanceVisible,
533
+ performanceShowFps,
534
+ performanceShowCpu,
535
+ isFullScreen,
536
+ windowX,
537
+ windowY,
538
+ windowWidth,
539
+ windowHeight,
540
+ } = data;
541
+
542
+ const draggableRef = ref();
543
543
 
544
544
  /**
545
- * 计算 时间轴
546
- * @param list
547
- * @param startTime
548
- * @param endTime
545
+ * 初始化拖拽
549
546
  */
550
- const calcNetworkTimeline = (
551
- list: DevTool.NetworkItem[],
552
- startTime: number,
553
- endTime: number,
554
- ): DevTool.NetworkItem[] => {
555
- const total = endTime - startTime;
556
-
557
- return (
558
- list?.map((item) => {
559
- const width =
560
- (
561
- (((item.endTime ?? Date.now()) - item.startTime) / total) *
562
- 100
563
- ).toFixed(2) + '%';
564
-
565
- const left =
566
- (((item.startTime - startTime) / total) * 100).toFixed(2) + '%';
567
-
568
- return {
569
- ...item,
570
- width,
571
- left,
572
- };
573
- }) ?? []
574
- );
575
- };
576
- /**
577
- * 禁止在该方法中 禁用调用已拦截的方法,防止递归调用
578
- * - 禁用 uni.setStorage
579
- * - 禁用 uni.request
580
- * - 禁用 uni.upload
581
- * - 禁用导入的 console
582
- */
583
- const listenPostMessage = (data: DevTool.WindowData) => {
584
- if (!props.open) return;
585
- if (!isActive) return;
586
-
587
- devToolVisible.value = data.devToolVisible ?? false;
588
-
589
- cacheInterceptConfig.value = data.cacheInterceptConfig ?? false;
590
-
591
- if (data.consoleList) {
592
- consoleList.value = [...(data.consoleList ?? [])]
593
- .filter((item) => {
594
- if (currentConsoleType.value === 'all') return item;
595
- if (currentConsoleType.value !== 'clear') {
596
- return item.type === currentConsoleType.value;
597
- }
598
- return item;
599
- })
600
- .filter((item) => {
601
- return (
602
- item.args?.some(
603
- (arg) =>
604
- arg.type === 'string' &&
605
- arg.value?.includes?.(searchConsole.value),
606
- ) ||
607
- item.position.includes(searchConsole.value) ||
608
- item?.stack?.includes(searchConsole.value)
609
- );
610
- })
611
- ?.map((item) => {
612
- return {
613
- ...item,
614
- position: hightLight(item.position, searchConsole.value),
615
- stack: hightLight(item.stack, searchConsole.value),
616
- args: item.args.map((arg) => {
617
- if (arg.type === 'string') {
618
- return {
619
- type: 'string',
620
- value: hightLight(arg.value, searchConsole.value),
621
- };
622
- }
623
- return arg;
624
- }),
625
- };
626
- });
627
-
628
- backup.consoleList = [...data.consoleList];
629
- }
630
-
631
- if (data.networkList) {
632
- const { startTime, endTime } = calcLineStartAndEnd(data.networkList);
633
-
634
- const list = calcNetworkTimeline(data.networkList, startTime, endTime);
635
-
636
- networkList.value = list
637
- .filter((item) => {
638
- if (currentNetworkType.value === 'all') return item;
639
- if (currentNetworkType.value !== 'clear') {
640
- return item.method === currentNetworkType.value;
641
- }
642
- return item;
643
- })
644
- ?.filter((item) => item?.url?.includes(searchNetwork.value))
645
- ?.map((item) => {
646
- return {
647
- ...item,
648
- url: hightLight(item.url, searchNetwork.value),
649
- };
650
- })
651
- ?.sort((a, b) => {
652
- if (currentNetworkSort.value === 1) {
653
- return b.startTime - a.startTime;
654
- } else {
655
- return a.startTime - b.startTime;
656
- }
657
- });
658
-
659
- backup.networkList = [...data.networkList];
660
- }
661
-
662
- if (data.uploadList) {
663
- uploadList.value = [...(data.uploadList ?? [])]
664
- .filter((item) => {
665
- if (currentUploadType.value === 'all') return item;
666
- if (currentUploadType.value !== 'clear') {
667
- return item.status === currentUploadType.value;
668
- }
669
- return item;
670
- })
671
- .filter((item) => {
672
- return item.url?.includes(searchUpload.value);
673
- })
674
- ?.map((item) => {
675
- return {
676
- ...item,
677
- url: hightLight(item.url, searchUpload.value),
678
- };
679
- });
680
- backup.uploadList = [...data.uploadList];
681
- }
682
-
683
- if (data.storageList) {
684
- storageList.value = [...(data.storageList ?? [])]
685
- ?.filter((item) => item._oldKey.includes(searchStorage.value))
686
- ?.map((item) => {
687
- return {
688
- ...item,
689
- _oldKey: hightLight(item._oldKey, searchStorage.value),
690
- };
691
- });
692
- backup.storageList = [...data.storageList];
693
- }
694
-
695
- if (data.wsList) {
696
- wsList.value = [...(data.wsList ?? [])]
697
- .filter((item) => {
698
- if (currentWebSocketType.value === 'all') return item;
699
- return item.readyState === currentWebSocketType.value;
700
- })
701
- .filter((item) => item.url.includes(searchWs.value))
702
- ?.map((item) => {
703
- return {
704
- ...item,
705
- url: hightLight(item.url, searchWs.value),
706
- };
707
- });
708
- backup.wsList = [...data.wsList];
709
- }
710
-
711
- if (data.routeList) {
712
- routeList.value = [...(data.routeList ?? [])]
713
- ?.filter(
714
- (item) =>
715
- item.path.includes(searchRoute.value) ||
716
- item.name?.includes(searchRoute.value),
717
- )
718
- ?.map((item) => {
719
- return {
720
- ...item,
721
- name: hightLight(item.name, searchRoute.value),
722
- path: hightLight(item.path, searchRoute.value),
723
- };
724
- });
725
- backup.routeList = [...data.routeList];
726
- }
727
-
728
- if (data.elEventList) {
729
- elEventList.value = [...data.elEventList];
730
- }
731
-
732
- if (data.uniEventList) {
733
- uniEventList.value = [...data.uniEventList];
734
- }
735
-
736
- if (data.eventCount) {
737
- eventCount.value = { ...data.eventCount };
738
- }
739
-
740
- if (data.vuexList) {
741
- vuexList.value = data.vuexList;
742
- }
743
-
744
- if (data.piniaList) {
745
- piniaList.value = data.piniaList;
746
- }
747
-
748
- if (data.netWorkStatus) {
749
- netWorkStatus.value = data.netWorkStatus;
750
- }
751
-
752
- if (data.sizeFormat) {
753
- sizeFormat.value = data.sizeFormat;
754
- }
755
-
756
- if (data.screenList) {
757
- screenList.value = [...data.screenList];
758
- }
759
-
760
- if (data.interceptNetworkMap) {
761
- interceptNetworkList.value = Array.from(data.interceptNetworkMap.values());
762
- }
763
-
764
- if (data.devToolVersion || data.devToolBuildTime || data.devToolGit) {
765
- Object.assign(buildInfo, {
766
- devToolVersion: data.devToolVersion,
767
- devToolBuildTime: data.devToolBuildTime,
768
- devToolGit: data.devToolGit,
769
- });
770
- }
771
-
772
- if (data.scanCodeList) {
773
- scanCodeList.value = [...data.scanCodeList];
774
- }
775
-
776
- if (data.nfcList) {
777
- nfcList.value = [...data.nfcList];
778
- }
779
- };
780
-
781
- let isActive = false;
782
- onMounted(() => {
783
- const devToolInfo = getDevToolInfo();
784
-
785
- if (devToolInfo) {
786
- currentConsoleType.value = devToolInfo?.currentConsoleType || 'all';
787
- currentNetworkType.value = devToolInfo?.currentNetworkType || 'all';
788
- tabScrollLeft.value = devToolInfo?.tabScrollLeft || 0;
789
- theme.value = devToolInfo?.theme || 'light';
790
-
791
- // 延迟设置,避免页面加载时
792
- // TypeError: Cannot read properties of null (reading 'scrollHeight')
793
- nextTick(() => {
794
- activeTab.value = devToolInfo?.activeTab || 0;
795
- });
796
- }
797
- if (props.data) {
798
- listenPostMessage(props.data);
799
- }
800
-
801
- if (uni.onThemeChange) {
802
- uni.onThemeChange((res) => {
803
- theme.value = res.theme;
804
- });
805
- }
806
- });
807
-
808
- onBeforeMount(() => {
809
- isActive = true;
810
- devToolEventBus?.on(DEV_APP_MESSAGE, listenPostMessage);
811
- });
812
- onUnmounted(() => {
813
- isActive = false;
814
- devToolEventBus?.off(DEV_APP_MESSAGE, listenPostMessage);
815
- });
816
-
817
- onShow(() => {
818
- isActive = true;
819
-
820
- // H5 APP-PLUS 已经被uni.navigateBack 监听,所以这里只有微信用 onShow 模拟
821
- // 微信小程序 onBackPress 不知道为什么不能触发,临时用 onShow 模拟
822
- // #ifdef MP-WEIXIN
823
- const path = getCurrentPagePath();
824
- basicSendMessage({
825
- type: DEV_BOTTOM_TAB_CHANGE,
826
- data: { path },
827
- });
828
- // #endif
829
- });
830
-
831
- // H5 APP-PLUS 已经被uni.switchTab 监听,所以这里只有微信小程序 监听
832
- // 微信小程序,支付宝 小程序 底部tab切换 switchTab 无法监听到,需要实现该事件进行监听
833
-
834
- onTabItemTap((option) => {
835
- isActive &&
836
- basicSendMessage({
837
- type: DEV_BOTTOM_TAB_CHANGE,
838
- data: { path: option.pagePath },
839
- });
840
- });
841
-
842
- // onHide(() => {
843
- // isActive = false;
844
-
845
- // setDevToolInfo({
846
- // devToolWindowVisible: false,
847
- // });
848
- // });
849
-
850
- /** 发送消息给 uniapp */
851
- function basicSendMessage(message: {
852
- type: string;
853
- data: Record<string, any>;
854
- }) {
855
- emits('sendMessage', message);
547
+ function onInitDrag(e: MouseEvent | TouchEvent) {
548
+ draggableRef.value?.initDrag(e);
856
549
  }
857
550
 
858
- function setWindowInfo() {
859
- setDevToolInfo({
860
- activeTab: activeTab.value,
861
- currentConsoleType: currentConsoleType.value,
862
- currentNetworkType: currentNetworkType.value,
863
- currentWebSocketType: currentWebSocketType.value,
864
- tabScrollLeft: tabScrollLeft.value,
865
- cacheInterceptConfig: cacheInterceptConfig.value,
866
- interceptNetworkList: interceptNetworkList.value,
867
- });
551
+ function toggleFullScreen() {
552
+ isFullScreen.value = !isFullScreen.value;
553
+ saveSettings();
868
554
  }
869
555
 
870
- const debounceSetWindowInfo = debounce(setWindowInfo, 200);
871
-
872
- function onCloseWindow() {
873
- emits('close');
874
- setWindowInfo();
875
- }
876
- function onChangeTabs() {
877
- setWindowInfo();
878
- }
879
-
880
- function onChangeSwiper({
881
- detail,
882
- }: {
883
- detail: { current: number; source: any };
556
+ function onWindowChange(detail: {
557
+ x: number;
558
+ y: number;
559
+ width: number;
560
+ height: number;
884
561
  }) {
885
- activeTab.value = detail.current;
886
- setWindowInfo();
887
- }
888
-
889
- function onScrollTabs(e: any) {
890
- tabScrollLeft.value = e.detail.scrollLeft;
891
- debounceSetWindowInfo();
892
- }
893
-
894
- const debounceScrollTabs = debounce(onScrollTabs, 200);
895
-
896
- function onConsoleChoose(
897
- type: 'all' | 'log' | 'info' | 'warn' | 'error' | 'clear',
898
- ) {
899
- if (type === 'clear') {
900
- consoleList.value = [];
901
- backup.consoleList = [];
902
- basicSendMessage({
903
- type: DEV_CONSOLE_CLEAR,
904
- data: {},
905
- });
906
- return;
907
- } else if (type === 'all') {
908
- currentConsoleType.value = type;
909
- consoleList.value = backup.consoleList;
910
- } else {
911
- currentConsoleType.value = type;
912
- consoleList.value = backup.consoleList.filter((item) => item.type === type);
913
- }
914
- setWindowInfo();
562
+ windowX.value = detail.x;
563
+ windowY.value = detail.y;
564
+ windowWidth.value = detail.width;
565
+ windowHeight.value = detail.height;
566
+ saveSettings();
915
567
  }
916
568
 
917
- function onRunJS(code: string) {
918
- basicSendMessage({
919
- type: DEV_RUN_JS,
920
- data: {
921
- code,
569
+ function saveSettings() {
570
+ setDevToolInfo({
571
+ windowSettings: {
572
+ isFullScreen: isFullScreen.value,
573
+ x: windowX.value,
574
+ y: windowY.value,
575
+ width: windowWidth.value,
576
+ height: windowHeight.value,
922
577
  },
923
578
  });
924
579
  }
925
580
 
926
- function onSearchConsole(value: string) {
927
- consoleList.value = backup.consoleList
928
- .filter((item) => {
929
- return (
930
- item.args.some(
931
- (arg) => arg.type === 'string' && arg.value.includes(value),
932
- ) ||
933
- item.position.includes(value) ||
934
- item?.stack?.includes(value)
935
- );
936
- })
937
- ?.map((item) => {
938
- return {
939
- ...item,
940
- position: hightLight(item.position, searchConsole.value),
941
- stack: hightLight(item.stack, searchConsole.value),
942
- args: item.args.map((arg) => {
943
- if (arg.type === 'string') {
944
- return {
945
- type: 'string',
946
- value: hightLight(arg.value, value),
947
- };
948
- }
949
- return arg;
950
- }),
951
- };
952
- });
953
- }
954
-
955
- function onNetworkChoose(type: string) {
956
- if (type === 'clear') {
957
- networkList.value = [];
958
- backup.networkList = [];
959
- basicSendMessage({
960
- type: DEV_NETWORK_CLEAR,
961
- data: {},
962
- });
963
- return;
964
- } else if (type === 'all') {
965
- currentNetworkType.value = type;
966
- networkList.value = backup.networkList;
967
- } else if (type === 'error') {
968
- currentNetworkType.value = type;
969
- networkList.value = backup.networkList.filter((item) => {
970
- return item.status === 'error' || /[4,5]\d{2,}/.test(item.status + '');
971
- });
972
- } else {
973
- currentNetworkType.value = type;
974
- networkList.value = backup.networkList.filter(
975
- (item) => item.method === type,
976
- );
977
- }
581
+ const dynamicContentHeight = computed(() => {
582
+ if (isFullScreen.value) return props.contentHeight;
583
+ return windowHeight.value - 32;
584
+ });
978
585
 
979
- setWindowInfo();
980
- }
586
+ const dynamicWindowStyle = computed(() => {
587
+ if (isFullScreen.value) return props.customStyle;
588
+ return {
589
+ width: '100%',
590
+ height: '100%',
591
+ paddingTop: 0,
592
+ paddingBottom: 0,
593
+ };
594
+ });
981
595
 
982
- function onSearchNetwork(value: string) {
983
- networkList.value = backup.networkList
984
- .filter((item) => {
985
- if (currentNetworkType.value === 'all') return item;
986
- if (currentNetworkType.value !== 'clear') {
987
- return item.method === currentNetworkType.value;
988
- }
989
- return item;
990
- })
991
- ?.filter((item) => item?.url?.includes(value))
992
- ?.map((item) => {
993
- return {
994
- ...item,
995
- url: hightLight(item.url, value),
996
- };
997
- });
998
- }
596
+ const {
597
+ onCloseWindow,
598
+ onChangeTabs,
599
+ debounceScrollTabs,
600
+ onConsoleChoose,
601
+ onRunJS,
602
+ onSearchConsole,
603
+ onNetworkChoose,
604
+ onSearchNetwork,
605
+ onSortNetwork,
606
+ onTransferChoose,
607
+ onSearchTransfer,
608
+ onWebSocketChoose,
609
+ onSearchWs,
610
+ onStorageChoose,
611
+ onStorageRemove,
612
+ onChangeStorage,
613
+ onSearchStorage,
614
+ onElEventClear,
615
+ onUniEventClear,
616
+ onCaptureScreenClear,
617
+ onScanCodeListClear,
618
+ onNfcClear,
619
+ onRouteRefresh,
620
+ onSearchRoute,
621
+ onShowDevButton,
622
+ onRestartDevTool,
623
+ onRestartApp,
624
+ onExportLog,
625
+ onScreenshot,
626
+ onClearCache,
627
+ onDestroyDevTool,
628
+ onChangeTheme,
629
+ onChangeCacheInterceptConfig,
630
+ onChangeCacheNetworkLog,
631
+ onChangeCacheConsoleLog,
632
+ onChangeVuex,
633
+ onChangePinia,
634
+ onClearWebSocketMessage,
635
+ onSendWebSocket,
636
+ onConfirmInterceptConfig,
637
+ onRemoveInterceptConfig,
638
+ onChangeUseTransition,
639
+ onChangeFontSize,
640
+ onChangePerformance,
641
+ onChangePerformanceShowFps,
642
+ onChangePerformanceShowCpu,
643
+ basicSendMessage,
644
+ } = handlers;
999
645
 
1000
646
  /**
1001
- * 排序
1002
- * @param sort -1 降序 1 升序
647
+ * 更新窗口 X 坐标
1003
648
  */
1004
- function onSortNetwork(sort: -1 | 1) {
1005
- currentNetworkSort.value = sort;
1006
-
1007
- const list = networkList.value.sort((a, b) => {
1008
- if (sort === 1) {
1009
- return b.startTime - a.startTime;
1010
- } else {
1011
- return a.startTime - b.startTime;
1012
- }
1013
- });
1014
- networkList.value = [...list];
1015
- }
1016
-
1017
- function onUploadChoose(type: string) {
1018
- if (type === 'clear') {
1019
- uploadList.value = [];
1020
- backup.uploadList = [];
1021
- basicSendMessage({
1022
- type: DEV_UPLOAD_CLEAR,
1023
- data: {},
1024
- });
1025
- return;
1026
- } else if (type === 'all') {
1027
- currentUploadType.value = type;
1028
- uploadList.value = backup.uploadList;
1029
- } else {
1030
- currentUploadType.value = type;
1031
- uploadList.value = backup.uploadList.filter((item) => item.status === type);
1032
- }
1033
- }
1034
-
1035
- function onSearchUpload(value: string) {
1036
- uploadList.value = backup.uploadList
1037
- .filter((item) => {
1038
- if (currentUploadType.value === 'all') return item;
1039
- if (currentUploadType.value !== 'clear') {
1040
- return item.status === currentUploadType.value;
1041
- }
1042
- return item;
1043
- })
1044
- .filter((item) => {
1045
- return item.url?.includes(value);
1046
- })
1047
- ?.map((item) => {
1048
- return {
1049
- ...item,
1050
- url: hightLight(item.url, value),
1051
- };
1052
- });
1053
- }
1054
-
1055
- function onWebSocketChoose(type: string) {
1056
- if (type === 'clear') {
1057
- wsList.value = [];
1058
- backup.wsList = [];
1059
- basicSendMessage({
1060
- type: DEV_WEBSOCKET_CLEAR,
1061
- data: {},
1062
- });
1063
- return;
1064
- } else if (type === 'all') {
1065
- currentWebSocketType.value = type;
1066
- wsList.value = backup.wsList;
1067
- } else {
1068
- currentWebSocketType.value = type;
1069
- wsList.value = backup.wsList.filter((item) => item.readyState === type);
1070
- }
1071
- setWindowInfo();
1072
- }
1073
-
1074
- function onSearchWs(value: string) {
1075
- wsList.value = backup.wsList
1076
- .filter((item) => {
1077
- if (currentWebSocketType.value === 'all') return item;
1078
- return item.readyState === currentWebSocketType.value;
1079
- })
1080
- .filter((item) => item.url.includes(value))
1081
- ?.map((item) => {
1082
- return {
1083
- ...item,
1084
- url: hightLight(item.url, value),
1085
- };
1086
- });
649
+ function onUpdateWindowX(val: number) {
650
+ windowX.value = val;
1087
651
  }
1088
652
 
1089
- function onStorageChoose(type: string) {
1090
- if (type === 'clear') {
1091
- backup.storageList = [];
1092
- storageList.value = [];
1093
- basicSendMessage({
1094
- type: DEV_STORAGE_CLEAR,
1095
- data: {},
1096
- });
1097
- } else if (type === 'refresh') {
1098
- basicSendMessage({
1099
- type: DEV_STORAGE_REFRESH,
1100
- data: {},
1101
- });
1102
- } else if (type === 'add') {
1103
- const key = '_new_' + Date.now();
1104
- const newItem = {
1105
- key,
1106
- _oldKey: key,
1107
- value: JSON.stringify(''),
1108
- };
1109
- backup.storageList.unshift(newItem);
1110
- storageList.value.unshift(newItem);
1111
- basicSendMessage({
1112
- type: DEV_STORAGE_ADD,
1113
- data: {
1114
- key,
1115
- value: JSON.stringify(''),
1116
- },
1117
- });
1118
- }
1119
- }
1120
-
1121
- function onStorageRemove(key: string) {
1122
- backup.storageList = backup.storageList.filter((item) => item.key !== key);
1123
- storageList.value = backup.storageList;
1124
- basicSendMessage({
1125
- type: DEV_STORAGE_REMOVE,
1126
- data: { key },
1127
- });
1128
- }
1129
-
1130
- function onChangeStorage(data: DevTool.StorageItem) {
1131
- basicSendMessage({
1132
- type: DEV_STORAGE_UPDATE,
1133
- data,
1134
- });
1135
- }
1136
-
1137
- function onSearchStorage(value: string) {
1138
- storageList.value = backup.storageList
1139
- .filter((item) => item._oldKey.includes(value))
1140
- ?.map((item) => {
1141
- return {
1142
- ...item,
1143
- _oldKey: hightLight(item._oldKey, value),
1144
- };
1145
- });
1146
- }
1147
-
1148
- function onElEventClear() {
1149
- elEventList.value = [];
1150
- basicSendMessage({
1151
- type: DEV_EL_EVENT_CLEAR,
1152
- data: {},
1153
- });
653
+ /**
654
+ * 更新窗口 Y 坐标
655
+ */
656
+ function onUpdateWindowY(val: number) {
657
+ windowY.value = val;
1154
658
  }
1155
659
 
1156
- function onUniEventClear() {
1157
- uniEventList.value = [];
1158
- eventCount.value = {
1159
- on: 0,
1160
- once: 0,
1161
- emit: 0,
1162
- off: 0,
1163
- };
1164
- basicSendMessage({
1165
- type: DEV_UNI_EVENT_CLEAR,
1166
- data: {},
1167
- });
660
+ /**
661
+ * 更新窗口宽度
662
+ */
663
+ function onUpdateWindowWidth(val: number) {
664
+ windowWidth.value = val;
1168
665
  }
1169
666
 
1170
- function onCaptureScreenClear() {
1171
- screenList.value = [];
1172
- basicSendMessage({
1173
- type: DEV_CAPTURE_SCREEN_CLEAR,
1174
- data: {},
1175
- });
667
+ /**
668
+ * 更新窗口高度
669
+ */
670
+ function onUpdateWindowHeight(val: number) {
671
+ windowHeight.value = val;
1176
672
  }
1177
673
 
1178
- function onScanCodeListClear() {
1179
- scanCodeList.value = [];
1180
- basicSendMessage({
1181
- type: DEV_SCAN_CODE_CLEAR,
1182
- data: {},
1183
- });
674
+ /**
675
+ * 更新控制台搜索关键词
676
+ */
677
+ function onUpdateSearchConsole(val: string) {
678
+ searchConsole.value = val;
1184
679
  }
1185
680
 
1186
- function onNfcClear() {
1187
- scanCodeList.value = [];
1188
- basicSendMessage({
1189
- type: DEV_NFC_CLEAR,
1190
- data: {},
1191
- });
681
+ /**
682
+ * 更新网络请求搜索关键词
683
+ */
684
+ function onUpdateSearchNetwork(val: string) {
685
+ searchNetwork.value = val;
1192
686
  }
1193
687
 
1194
- function onRouteRefresh() {
1195
- basicSendMessage({
1196
- type: DEV_ROUTE_REFRESH,
1197
- data: {},
1198
- });
688
+ /**
689
+ * 更新文件传输搜索关键词
690
+ */
691
+ function onUpdateSearchTransfer(val: string) {
692
+ searchTransfer.value = val;
1199
693
  }
1200
694
 
1201
- function onSearchRoute(value: string) {
1202
- routeList.value = backup.routeList
1203
- ?.filter((item) => item.path.includes(value) || item.name?.includes(value))
1204
- ?.map((item) => {
1205
- return {
1206
- ...item,
1207
- name: hightLight(item.name, searchRoute.value),
1208
- path: hightLight(item.path, searchRoute.value),
1209
- };
1210
- });
695
+ /**
696
+ * 更新 WebSocket 搜索关键词
697
+ */
698
+ function onUpdateSearchWs(val: string) {
699
+ searchWs.value = val;
1211
700
  }
1212
701
 
1213
- function onShowDevButton(show: boolean) {
1214
- basicSendMessage({
1215
- type: DEV_BUTTON_SHOW_OR_HIDE,
1216
- data: {
1217
- show,
1218
- },
1219
- });
702
+ /**
703
+ * 更新路由搜索关键词
704
+ */
705
+ function onUpdateSearchRoute(val: string) {
706
+ searchRoute.value = val;
1220
707
  }
1221
708
 
1222
- function onRestartDevTool() {
1223
- basicSendMessage({
1224
- type: DEV_RESTART_DEBUGGER,
1225
- data: {},
1226
- });
709
+ /**
710
+ * 更新本地存储搜索关键词
711
+ */
712
+ function onUpdateSearchStorage(val: string) {
713
+ searchStorage.value = val;
1227
714
  }
1228
715
 
1229
- function onRestartApp() {
1230
- basicSendMessage({
1231
- type: DEV_RESTART_APP,
1232
- data: {},
1233
- });
716
+ /**
717
+ * 更新本地存储列表
718
+ */
719
+ function onUpdateStorageList(val: DevTool.StorageItem[]) {
720
+ storageList.value = val;
1234
721
  }
1235
722
 
1236
- function onExportLog(exports: {
1237
- exportLog: boolean;
1238
- exportNetwork: boolean;
1239
- exportStorage: boolean;
1240
- }) {
1241
- basicSendMessage({
1242
- type: DEV_EXPORT_LOG,
1243
- data: {
1244
- ...exports,
1245
- },
1246
- });
723
+ /**
724
+ * 更新 Vuex 数据
725
+ */
726
+ function onUpdateVuexList(val: Record<string, any>) {
727
+ vuexList.value = val;
1247
728
  }
1248
729
 
1249
- function onScreenshot() {
1250
- basicSendMessage({
1251
- type: 'dev-tool-hide-screenshot',
1252
- data: {},
1253
- });
730
+ /**
731
+ * 更新 Pinia 数据
732
+ */
733
+ function onUpdatePiniaList(val: Record<string, any>) {
734
+ piniaList.value = val;
1254
735
  }
1255
736
 
1256
- function onClearCache() {
1257
- basicSendMessage({
1258
- type: DEV_LOG_CACHE_CLEAR,
1259
- data: {},
1260
- });
1261
- }
737
+ const currentWebSocket = computed(() => {
738
+ return wsList.value.find((item) => item.url === overlay.webSocket.url);
739
+ });
1262
740
 
1263
- function onDestroyDevTool() {
1264
- basicSendMessage({
1265
- type: DEV_DESTROY,
1266
- data: {},
1267
- });
1268
- }
741
+ // 记录上一个 Tab,用于平滑卸载
742
+ const lastActiveTab = ref(activeTab.value);
743
+ const isReady = ref(props.open);
1269
744
 
1270
- function onChangeTheme(t: string) {
1271
- theme.value = t;
745
+ watch(
746
+ () => props.open,
747
+ (val) => {
748
+ // 如果没有开启过渡动画,直接设置为 ready
749
+ if (val && !useTransition.value) {
750
+ isReady.value = true;
751
+ }
752
+ // 每次窗口打开时重新读取 hiddenTabs 配置
753
+ if (val) {
754
+ const devToolInfo = getDevToolInfo();
755
+ hiddenTabs.value = devToolInfo?.hiddenTabs || [];
756
+ }
757
+ },
758
+ { immediate: true },
759
+ );
1272
760
 
1273
- setDevToolInfo({
1274
- theme: t,
1275
- });
761
+ function onAfterEnter() {
762
+ isReady.value = true;
1276
763
  }
1277
764
 
1278
- function onChangeCacheInterceptConfig(value: boolean) {
1279
- setDevToolInfo({
1280
- cacheInterceptConfig: value,
1281
- interceptNetworkList: value ? interceptNetworkList.value : [],
1282
- });
1283
-
1284
- basicSendMessage({
1285
- type: DEV_CHANGE_CACHE_INTERCEPT_CONFIG,
1286
- data: {
1287
- cacheInterceptConfig: value,
1288
- },
1289
- });
765
+ function onAfterLeave() {
766
+ isReady.value = false;
1290
767
  }
1291
768
 
1292
- function onChangeVuex(value: Record<string, any>) {
1293
- basicSendMessage({
1294
- type: DEV_VUEX_CHANGE,
1295
- data: value,
1296
- });
1297
- }
769
+ watch(activeTab, (val, oldVal) => {
770
+ if (val !== oldVal) {
771
+ lastActiveTab.value = oldVal;
772
+ }
773
+ });
1298
774
 
1299
- function onChangePinia(value: Record<string, any>) {
1300
- basicSendMessage({
1301
- type: DEV_PINIA_CHANGE,
1302
- data: value,
1303
- });
775
+ function isTabVisible(key: string) {
776
+ return !hiddenTabs.value.includes(key);
1304
777
  }
1305
778
 
1306
- function onCloseCode() {
1307
- openCode.value = false;
1308
- stack.value = '';
779
+ function swiperShow(index: number) {
780
+ if (!isReady.value) return false;
781
+ const currentTab = tabItems.value[activeTab.value];
782
+ return currentTab && currentTab.index === index;
1309
783
  }
1310
- function onOpenCode(value?: string) {
1311
- if (!value) return;
1312
784
 
1313
- stack.value = value;
1314
-
1315
- const isWXLink = isMockWX(value ?? '') || props.mode !== 'development';
1316
- const isUseDevSource = !isWXLink && props.useDevSource;
1317
-
1318
- if (isWXLink) {
1319
- uni.showToast({
1320
- icon: 'none',
1321
- title: '[DevTool] 请在小程序真机调试模式下查看源码',
785
+ onMounted(() => {
786
+ const devToolInfo = getDevToolInfo();
787
+ if (devToolInfo) {
788
+ currentConsoleType.value = devToolInfo?.currentConsoleType || 'all';
789
+ currentNetworkType.value = devToolInfo?.currentNetworkType || 'all';
790
+ theme.value = devToolInfo?.theme || 'light';
791
+ cacheInterceptConfig.value =
792
+ devToolInfo?.cacheInterceptConfig !== undefined
793
+ ? devToolInfo.cacheInterceptConfig
794
+ : true;
795
+ cacheNetworkLog.value = devToolInfo?.cacheNetworkLog || false;
796
+ cacheConsoleLog.value = devToolInfo?.cacheConsoleLog || false;
797
+ useTransition.value =
798
+ devToolInfo?.useTransition !== undefined
799
+ ? devToolInfo.useTransition
800
+ : true;
801
+ baseFontSize.value = devToolInfo?.baseFontSize || 12;
802
+ tagFontSize.value = devToolInfo?.tagFontSize || 10;
803
+ tipsFontSize.value = devToolInfo?.tipsFontSize || 10;
804
+ fontFamily.value = devToolInfo?.fontFamily || '';
805
+ fontWeight.value = devToolInfo?.fontWeight || 'normal';
806
+ hiddenTabs.value = devToolInfo?.hiddenTabs || [
807
+ 'Performance',
808
+ 'CaptureScreen',
809
+ 'ScanCode',
810
+ 'NFC',
811
+ 'ElEvent',
812
+ 'UniEvent',
813
+ ];
814
+
815
+ // 延迟恢复滚动位置,确保布局已渲染
816
+ setTimeout(() => {
817
+ tabScrollLeft.value = devToolInfo?.tabScrollLeft || 0;
818
+ nextTick(() => {
819
+ // 确保恢复的索引在当前可见 Tab 的范围内
820
+ const savedTab = devToolInfo?.activeTab || 0;
821
+ activeTab.value = savedTab < tabItems.value.length ? savedTab : 0;
822
+ });
823
+ }, 150);
824
+
825
+ if (devToolInfo.windowSettings) {
826
+ isFullScreen.value = devToolInfo.windowSettings.isFullScreen ?? true;
827
+ windowX.value = devToolInfo.windowSettings.x ?? 10;
828
+ windowY.value = devToolInfo.windowSettings.y ?? 100;
829
+ windowWidth.value = devToolInfo.windowSettings.width ?? 375;
830
+ windowHeight.value = devToolInfo.windowSettings.height ?? 450;
831
+ }
832
+ }
833
+ if (props.data) {
834
+ data.listenPostMessage(props.data);
835
+ }
836
+ if (uni.onThemeChange) {
837
+ uni.onThemeChange((res) => {
838
+ theme.value = res.theme;
1322
839
  });
1323
- return;
1324
840
  }
841
+ });
1325
842
 
1326
- if (!isUseDevSource) {
843
+ /**
844
+ * 处理来自核心模块的消息
845
+ */
846
+ function handleCoreMessage(msg: any) {
847
+ let type, msgData;
848
+ try {
849
+ const payload = typeof msg === 'string' ? JSON.parse(msg) : msg;
850
+ type = payload.type;
851
+ msgData = payload.data;
852
+ } catch (e) {
853
+ console.error('DevToolWindow parse error', e);
1327
854
  return;
1328
855
  }
1329
856
 
1330
- if (isAndroid()) {
1331
- if (props.sourceFileServers && props.sourceFileServers?.length > 0) {
1332
- openCode.value = true;
1333
- } else {
1334
- uni.showToast({
1335
- icon: 'none',
1336
- title: '[DevTool] sourceFileServers 配置异常',
1337
- });
1338
- console?.warn('[DevTool] sourceFileServers 配置异常');
1339
- }
1340
- } else {
1341
- openCode.value = true;
857
+ if (type === MSG_TYPE.DATA_UPDATE) {
858
+ data.listenPostMessage(msgData);
1342
859
  }
1343
860
  }
1344
861
 
1345
- function onCloseJson() {
1346
- showJsonDetail.value = false;
1347
- jsonData.value = {};
1348
- }
1349
- function onOpenJson(data: { title: string; data: Record<string, any> }) {
1350
- showJsonDetail.value = true;
1351
- jsonData.value = data;
1352
- }
1353
-
1354
- function onOpenNfcTool() {
1355
- showNfcTool.value = true;
1356
- }
1357
- function onCloseNfcTool() {
1358
- showNfcTool.value = false;
1359
- }
1360
-
1361
- function onOpenNetworkDetail(ni?: DevTool.NetworkItem) {
1362
- Object.assign(network, emptyNetwork);
1363
- Object.assign(network, ni);
1364
- showNetworkDetail.value = true;
1365
- }
1366
- function onCloseNetworkDetail() {
1367
- showNetworkDetail.value = false;
1368
- }
1369
-
1370
- function onOpenNetworkSend(ni?: DevTool.NetworkItem) {
1371
- Object.assign(network, emptyNetwork);
1372
- Object.assign(network, ni);
1373
- showNetworkSend.value = true;
1374
- }
1375
- function onCloseNetworkSend() {
1376
- showNetworkSend.value = false;
1377
- }
1378
-
1379
- function onOpenNetworkIntercept() {
1380
- showNetworkIntercept.value = true;
1381
- }
1382
- function onCloseNetworkIntercept() {
1383
- showNetworkIntercept.value = false;
1384
- }
1385
-
1386
- function onOpenInterceptConfig(ni?: DevTool.NetworkItem) {
1387
- Object.assign(network, emptyNetwork);
1388
-
1389
- ni && Object.assign(network, ni);
1390
-
1391
- showInterceptConfig.value = true;
1392
- }
1393
-
1394
- function onCloseInterceptConfig() {
1395
- showInterceptConfig.value = false;
1396
- }
1397
-
1398
- function onRemoveInterceptConfig(ni: DevTool.NetworkItem) {
1399
- basicSendMessage({
1400
- type: DEV_INTERCEPT_NETWORK_REMOVE,
1401
- data: ni,
1402
- });
1403
- }
1404
-
1405
- function onConfirmInterceptConfig(ni: DevTool.NetworkItem) {
1406
- const index = interceptNetworkList.value.findIndex((item) => {
1407
- const key = `${item.method?.toUpperCase()}|${item.url?.split('?')[0]}`;
1408
- const niKey = `${ni.method?.toUpperCase()}|${ni.url?.split('?')[0]}`;
1409
- return key === niKey;
1410
- });
1411
- const list = [...interceptNetworkList.value];
862
+ onBeforeMount(() => {
863
+ data.setIsActive(true);
864
+ uni.$on(DEV_CORE_MESSAGE, handleCoreMessage);
865
+ });
1412
866
 
1413
- if (index > -1) {
1414
- list[index] = ni;
1415
- } else {
1416
- list.unshift(ni);
1417
- }
867
+ onUnmounted(() => {
868
+ uni.$off(DEV_CORE_MESSAGE, handleCoreMessage);
869
+ });
1418
870
 
1419
- setDevToolInfo({
1420
- cacheInterceptConfig: cacheInterceptConfig.value,
1421
- interceptNetworkList: cacheInterceptConfig.value ? list : [],
1422
- });
871
+ onShow(() => {
872
+ // #ifdef MP-WEIXIN
1423
873
  basicSendMessage({
1424
- type: DEV_INTERCEPT_NETWORK_UPDATE,
1425
- data: [ni],
1426
- });
1427
- }
1428
-
1429
- function onOpenUploadDetail(up?: DevTool.UploadItem) {
1430
- Object.assign(upload, up);
1431
- showUploadDetail.value = true;
1432
- }
1433
-
1434
- function onCloseUploadDetail() {
1435
- showUploadDetail.value = false;
1436
- }
1437
-
1438
- function onOpenWebSocketDetail(ws?: DevTool.WS) {
1439
- Object.assign(webSocket, ws);
1440
-
1441
- nextTick(() => {
1442
- if (currentWebSocket.value) {
1443
- showWebSocketDetail.value = true;
1444
- } else {
1445
- //
1446
- }
874
+ type: CMD_TYPE.TAB_CHANGE,
875
+ data: { path: getCurrentPagePath() },
1447
876
  });
1448
- }
1449
-
1450
- function onCloseWebSocketDetail() {
1451
- showWebSocketDetail.value = false;
1452
- }
877
+ // #endif
878
+ });
1453
879
 
1454
- function onClearWebSocketMessage(ws: DevTool.WS) {
880
+ onTabItemTap((option) => {
1455
881
  basicSendMessage({
1456
- type: DEV_WEBSOCKET_CLEAR_MESSAGE,
1457
- data: ws,
882
+ type: CMD_TYPE.TAB_CHANGE,
883
+ data: { path: option.pagePath },
1458
884
  });
1459
- }
1460
-
1461
- // 防止滚动穿透
1462
- function onTouchMove(e: TouchEvent) {
1463
- /* #ifdef H5 */
1464
-
1465
- // 为了防止滚动穿透 浏览器抛出错误
1466
- // [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
1467
- // 在需要滑动的容器上加入 @touchmove.stop
1468
- e.preventDefault();
1469
-
1470
- e.stopPropagation();
1471
- /* #endif */
1472
- }
1473
-
1474
- function onWheel(e: WheelEvent) {
1475
- /* #ifdef H5 */
1476
-
1477
- e.preventDefault();
1478
-
1479
- e.stopPropagation();
1480
- /* #endif */
1481
- }
885
+ });
1482
886
  </script>
1483
-
1484
887
  <style scoped>
1485
888
  .dev-tool-window {
1486
- --dev-tool-main-color: #9254de;
1487
-
1488
- --dev-tool-warn-color: #ffa940;
1489
- --dev-tool-warn-bg-color: rgba(247, 214, 114, 0.2);
1490
- --dev-tool-error-color: #ff4d4f;
1491
- --dev-tool-error-bg-color: rgba(251, 183, 185, 0.2);
1492
- --dev-tool-success-color: #bae637;
1493
- --dev-tool-success-bg-color: #fcffe6;
1494
-
1495
- --dev-tool-base-font-size: 12px;
1496
- --dev-tool-tag-font-size: 10px;
1497
- --dev-tool-tips-font-size: 10px;
1498
-
1499
- --dev-tool-text-color-placeholder: #909090;
1500
-
1501
- --dev-tool-active-bg-color: rgba(0, 0, 0, 0.05);
1502
-
1503
- -webkit-tap-highlight-color: transparent;
1504
-
1505
- position: fixed;
1506
- top: 0;
1507
- left: 0;
1508
- z-index: 998;
1509
- /* #ifdef H5 || APP-PLUS */
1510
- /* padding: 50px 0; */
1511
- /* #endif */
1512
-
1513
- width: 100vw;
1514
- height: 100vh;
1515
- font-size: 14px;
889
+ position: relative;
890
+ width: 100%;
891
+ height: 100%;
1516
892
  color: var(--dev-tool-text-color);
1517
893
  box-sizing: border-box;
1518
- transition: color 0.3s;
894
+ transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
895
+ pointer-events: auto;
1519
896
  }
1520
897
 
1521
- .dev-tool-window-light {
1522
- --dev-tool-bg-color: rgba(255, 255, 255, 0.8);
1523
- --dev-tool-bg2-color: rgba(255, 255, 255, 0.95);
1524
- --dev-tool-bg3-color: rgba(255, 255, 255, 0.999);
1525
-
1526
- --dev-tool-text-color: #000;
1527
-
1528
- --dev-tool-border-color: #f0f0f0;
1529
- --dev-tool-info-color: #9c9c9c;
1530
- --dev-tool-log-color: #f9f9f9;
1531
- --dev-tool-nil-color: #020201;
1532
- --dev-tool-number-color: #1d8ce0;
1533
- --dev-tool-boolean-color: #1d8ce0;
1534
- --dev-tool-symbol-color: bisque;
1535
- --dev-tool-active-bg-color: #f0f0f0;
1536
- --dev-tool-time-line-color: #9254de;
1537
-
1538
- --dev-tool-note-color: #9c9c9c;
1539
-
1540
- --dev-tool-keyword-color: #9254de;
1541
- --dev-tool-bracket-color: #9c9c9c;
1542
- --dev-tool-quotation-color: #91e76a;
1543
- --dev-tool-string-color: #91e76a;
1544
- --dev-tool-function-color: #1d8ce0;
1545
- --dev-tool-attribute-color: #ef66ba;
1546
- --dev-tool-operator-color: #50d3eb;
898
+ .is-window {
899
+ border-radius: 12px;
900
+ overflow: hidden;
901
+ box-shadow: 0 8px 24px rgb(0 0 0 / 20%);
902
+ border: 1px solid var(--dev-tool-border-color);
1547
903
  }
1548
- .dev-tool-window-dark {
1549
- --dev-tool-bg-color: rgba(0, 0, 0, 0.8);
1550
- --dev-tool-bg2-color: rgba(43, 43, 43, 0.8);
1551
- --dev-tool-bg3-color: rgba(43, 43, 43, 0.999);
1552
904
 
1553
- --dev-tool-text-color: #fff;
1554
- --dev-tool-border-color: #3d3d3d;
905
+ .is-window .dev-tool-window-bg {
906
+ border-radius: 12px;
907
+ }
1555
908
 
1556
- --dev-tool-log-color: #f9f9f9;
1557
- --dev-tool-active-bg-color: #3d3d3d;
909
+ .is-full-screen {
910
+ border-radius: 0;
911
+ }
1558
912
 
1559
- --dev-tool-time-line-color: #f9f9f9;
913
+ .window-header {
914
+ width: 100%;
915
+ cursor: move;
916
+ display: flex;
917
+ flex-direction: column;
918
+ }
1560
919
 
1561
- --dev-tool-note-color: #9c9c9c;
920
+ .drag-indicator {
921
+ display: flex;
922
+ justify-content: center;
923
+ align-items: center;
924
+ height: 6px;
925
+ padding-top: 4px;
926
+ }
1562
927
 
1563
- --dev-tool-keyword-color: #9254de;
1564
- --dev-tool-bracket-color: #9c9c9c;
1565
- --dev-tool-quotation-color: #91e76a;
1566
- --dev-tool-string-color: #91e76a;
1567
- --dev-tool-function-color: #1d8ce0;
1568
- --dev-tool-attribute-color: #ef66ba;
1569
- --dev-tool-operator-color: #50d3eb;
928
+ .drag-indicator::after {
929
+ content: '';
930
+ width: 32px;
931
+ height: 4px;
932
+ background-color: var(--dev-tool-text-color);
933
+ border-radius: 2px;
934
+ opacity: 0.15;
1570
935
  }
1571
936
 
1572
937
  .dev-tool-window-bg {
@@ -1574,39 +939,24 @@ function onWheel(e: WheelEvent) {
1574
939
  z-index: -1;
1575
940
  top: 0;
1576
941
  left: 0;
1577
- width: 100vw;
1578
- height: 100vh;
1579
- background-color: var(--dev-tool-bg-color);
942
+ width: 100%;
943
+ height: 100%;
944
+ background-color: var(--dev-tool-bg3-color);
1580
945
  backdrop-filter: blur(6px);
1581
- transition: background-color 0.3s;
946
+ transition: all 0.3s;
1582
947
  }
948
+
1583
949
  .dev-tool-window-container {
1584
950
  height: calc(100% - 32px);
1585
- overflow: auto;
951
+ overflow: hidden;
952
+ position: relative;
1586
953
  }
1587
954
 
1588
- /* #ifdef H5 || APP-PLUS */
1589
- .dev-tool-window-container ::-webkit-scrollbar {
1590
- display: none;
1591
- width: 0;
1592
- height: 0;
1593
- background-color: transparent;
1594
- }
1595
-
1596
- .dev-tool-window-container ::-webkit-scrollbar-thumb {
1597
- width: 0;
1598
- height: 0;
1599
- background-color: transparent;
1600
- }
1601
- /* #endif */
1602
-
1603
955
  .dev-tool-window::after {
1604
956
  content: '';
1605
957
  }
958
+
1606
959
  .dev-tool-window ::-webkit-scrollbar {
1607
960
  display: none;
1608
- width: 0;
1609
- height: 0;
1610
- color: transparent;
1611
961
  }
1612
962
  </style>