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,25 +1,34 @@
1
1
  <template>
2
2
  <view class="vuex-content">
3
- <JsonPretty
4
- editable
5
- showLength
6
- virtual
7
- v-if="showJson"
8
- :data="vuexList"
9
- :theme="theme"
10
- :height="contentHeight - 32 - 32"
11
- :nodeSelectable="() => false"
12
- :pathCollapsible="() => false"
13
- @update:data="onUpdateData"
14
- @nodeClick="onNodeClick"
15
- />
16
- <Empty v-else />
3
+ <view class="vuex-control">
4
+ <DevToolTitle>{{ t('vuex.title') }}</DevToolTitle>
5
+ </view>
6
+ <view class="vuex-json-wrapper">
7
+ <JsonPretty
8
+ editable
9
+ showLength
10
+ virtual
11
+ v-if="showJson"
12
+ :data="vuexList"
13
+ :theme="theme"
14
+ :height="contentHeight - 32 - 32"
15
+ :nodeSelectable="() => false"
16
+ :pathCollapsible="() => false"
17
+ @update:data="onUpdateData"
18
+ @nodeClick="onNodeClick"
19
+ />
20
+ <Empty v-else />
21
+ </view>
17
22
  </view>
18
23
  </template>
19
24
  <script lang="ts" setup>
20
25
  import { computed } from 'vue';
21
26
  import JsonPretty from '../JsonPretty/index.vue';
22
27
  import Empty from '../Empty/index.vue';
28
+ import DevToolTitle from '../DevToolTitle/index.vue';
29
+ import { useI18n } from '../../i18n';
30
+
31
+ const { t } = useI18n();
23
32
  const props = defineProps<{
24
33
  vuexList: Record<string, any>;
25
34
  theme?: string;
@@ -36,7 +45,7 @@ const showJson = computed(() => {
36
45
  return false;
37
46
  }
38
47
  return true;
39
- } catch (error) {
48
+ } catch (_error) {
40
49
  return false;
41
50
  }
42
51
  });
@@ -54,10 +63,22 @@ function onNodeClick(node: any) {
54
63
  </script>
55
64
  <style scoped>
56
65
  .vuex-content {
57
- padding: 16px;
58
66
  font-size: var(--dev-tool-base-font-size);
59
67
  height: 100%;
60
68
  box-sizing: border-box;
61
- overflow: auto;
69
+ overflow: hidden;
70
+ }
71
+
72
+ .vuex-control {
73
+ display: flex;
74
+ align-items: center;
75
+ padding: 0 16px;
76
+ height: 32px;
77
+ border-bottom: 1px solid var(--dev-tool-border-color);
78
+ box-sizing: border-box;
79
+ }
80
+
81
+ .vuex-json-wrapper {
82
+ padding: 0 16px;
62
83
  }
63
84
  </style>
@@ -1,45 +1,48 @@
1
1
  <template>
2
2
  <view class="web-socket-list-container" :style="customStyle">
3
3
  <view class="web-socket-detail-control">
4
- <DevToolTitle customStyle="margin-right: 16px"> 套接字详情 </DevToolTitle>
4
+ <DevToolTitle customStyle="margin-right: 16px">
5
+ {{ t('websocket.detailTitle') }}
6
+ </DevToolTitle>
5
7
  <Tag
6
8
  mode="info"
7
- v-for="item in selectItems"
9
+ v-for="item in translatedSelectItems"
8
10
  :active="item.value === currentSelect"
9
11
  :key="item.value"
10
12
  customStyle="margin-right: 16px"
11
- @click="onSelect(item)"
12
- >
13
+ @click="onSelect(item)">
13
14
  {{ item.label }}
14
15
  </Tag>
15
16
  <CircularButton
16
17
  style="margin-left: auto"
17
18
  customStyle="margin-left: auto"
18
19
  text="×"
19
- @click="onClose"
20
- />
20
+ @click="onClose" />
21
21
  </view>
22
22
 
23
23
  <view class="web-socket-data" v-if="currentSelect === 'base'">
24
- <DevToolTitle> 常规 </DevToolTitle>
24
+ <DevToolTitle>{{ t('network.general') }}</DevToolTitle>
25
25
  <view class="web-socket-detail-item">
26
- <view>请求地址:</view>
26
+ <view class="web-socket-detail-item-key">
27
+ {{ t('network.requestUrl') }}:
28
+ </view>
27
29
  <view>{{ ws?.url }}</view>
28
30
  </view>
29
31
 
30
32
  <view class="web-socket-detail-item">
31
- <view>请求方法:</view>
33
+ <view class="web-socket-detail-item-key">
34
+ {{ t('network.method') }}:
35
+ </view>
32
36
  <Tag mode="info">{{ ws?.method }}</Tag>
33
37
  </view>
34
38
 
35
- <DevToolTitle>请求头</DevToolTitle>
39
+ <DevToolTitle>{{ t('network.requestHeaders') }}</DevToolTitle>
36
40
  <template v-if="ws?.headers && ws.headers?.length > 0">
37
41
  <view
38
42
  class="web-socket-detail-item"
39
43
  v-for="item in ws.headers"
40
- :key="item.key"
41
- >
42
- <view class="web-socket-detail-item-key">{{ item.key }}: </view>
44
+ :key="item.key">
45
+ <view class="web-socket-detail-item-key">{{ item.key }}:</view>
43
46
  {{ item.value }}
44
47
  </view>
45
48
  </template>
@@ -47,87 +50,125 @@
47
50
  </view>
48
51
  <template v-if="currentSelect === 'message'">
49
52
  <view class="web-socket-detail-control">
50
- <DevToolTitle>消息列表</DevToolTitle>
53
+ <DevToolTitle>{{ t('websocket.messageList') }}</DevToolTitle>
51
54
  <Tag
52
55
  mode="clear"
53
56
  style="margin-left: auto"
54
57
  customStyle="margin-left: auto"
55
- @click="emit('clear', ws!)"
56
- >
57
- 清除
58
+ @click="emit('clear', ws!)">
59
+ {{ t('common.clear') }}
58
60
  </Tag>
59
61
  </view>
60
62
 
61
63
  <view class="web-socket-data-list">
62
- <template v-if="ws?.message && ws.message.length > 0">
63
- <view
64
- v-for="item in ws.message"
65
- :key="item.time"
66
- :class="`web-socket-data-item web-socket-data-item-${item.status}`"
67
- @click="onClick(item)"
68
- >
69
- <view class="web-socket-data-time">
70
- {{ item.type === 'send' ? '↑' : '↓' }}
71
- {{ formatDate(item.time, 'HH:mm:ss') }}
72
- </view>
73
- <view
74
- :class="[
75
- 'web-socket-data-content',
76
- `web-socket-data-${item.valueType}`,
77
- ]"
78
- @click.stop="onClickValue(item)"
79
- >
80
- {{ item.shortValue || item.value }}
81
- </view>
82
- </view>
83
- </template>
84
- <Empty v-else text="暂无消息" />
64
+ <VirtualList
65
+ v-if="ws?.message && ws.message.length > 0"
66
+ :data="ws.message"
67
+ :itemHeight="32"
68
+ :dataChangeScrollToTop="false"
69
+ :showBackTop="false"
70
+ :scrollIntoView="scrollIntoView"
71
+ :scrollWithAnimation="true">
72
+ <template #default="{ list, onSizeChange, itemsHeight, start }">
73
+ <AutoSize
74
+ v-for="(msg, index) in list as DevTool.Message[]"
75
+ :key="msg.time"
76
+ :index="index + start"
77
+ :itemsHeight="itemsHeight"
78
+ :onSizeChange="onSizeChange">
79
+ <view
80
+ :id="`ws-msg-${index + start}`"
81
+ :class="`web-socket-data-item web-socket-data-item-${msg.status}`"
82
+ @click="onClick(msg)">
83
+ <view class="web-socket-data-time">
84
+ {{ msg.type === 'send' ? '↑' : '↓' }}
85
+ {{ formatDate(msg.time, 'HH:mm:ss') }}
86
+ </view>
87
+ <view
88
+ :class="[
89
+ 'web-socket-data-content',
90
+ `web-socket-data-${msg.valueType}`,
91
+ ]"
92
+ @click.stop="onClickValue(msg)">
93
+ {{ msg.shortValue || msg.value }}
94
+ </view>
95
+ </view>
96
+ </AutoSize>
97
+ </template>
98
+ </VirtualList>
99
+ <Empty v-else :text="t('websocket.noMessage')" />
85
100
  </view>
86
101
 
87
- <!-- <textarea
88
- :value="sendText"
89
- class="web-socket-textarea"
90
- placeholder="请输入消息"
91
- placeholderStyle="font-size: 12px"
92
- @change="onChangeText"
93
- />
94
- <button class="web-socket-send-button" size="mini">发送</button> -->
102
+ <view class="web-socket-send-container">
103
+ <textarea
104
+ class="web-socket-textarea"
105
+ :value="sendText"
106
+ @input="onInputText"
107
+ :placeholder="t('websocket.sendPlaceholder')" />
108
+ <SettingButton customStyle="margin-top: 12px" @click="onSendMessage">
109
+ {{ t('websocket.send') }}
110
+ </SettingButton>
111
+ </view>
95
112
  </template>
96
113
  </view>
97
114
  </template>
98
115
  <script setup lang="ts">
99
- import { ref } from 'vue';
116
+ import { ref, computed, watch } from 'vue';
100
117
  import Tag from '../Tag/index.vue';
101
118
  import CircularButton from '../CircularButton/index.vue';
102
119
  import DevToolTitle from '../DevToolTitle/index.vue';
103
120
  import Empty from '../Empty/index.vue';
104
121
  import { formatDate } from '../../utils/index';
105
122
  import type { DevTool } from '../../type';
123
+ import { useI18n } from '../../i18n';
124
+ import SettingButton from '../SettingButton/index.vue';
125
+ import VirtualList from '../VirtualList/index.vue';
126
+ import AutoSize from '../VirtualList/AutoSize.vue';
127
+
128
+ const { t } = useI18n();
106
129
 
107
- defineProps<{
130
+ const props = defineProps<{
108
131
  ws?: DevTool.WS;
109
132
  zIndex?: number;
110
133
  customStyle?: Record<string, any>;
111
134
  }>();
135
+
112
136
  const emit = defineEmits<{
113
137
  (e: 'close'): void;
114
138
  (e: 'clear', value: DevTool.WS): void;
139
+ (e: 'send', data: { url: string; message: any }): void;
115
140
  (e: 'openJson', value: { title?: string; data: Record<string, any> }): void;
116
141
  }>();
117
142
 
118
- const selectItems = [
143
+ const translatedSelectItems = computed(() => [
119
144
  {
120
- label: 'base',
145
+ label: t('common.base'),
121
146
  value: 'base',
122
147
  },
123
148
  {
124
- label: 'message',
149
+ label: t('common.message'),
125
150
  value: 'message',
126
151
  },
127
- ];
128
- const currentSelect = ref('base');
152
+ ]);
153
+ const currentSelect = ref<string>('base');
154
+
155
+ const sendText = ref<string>('');
129
156
 
130
- const sendText = ref('');
157
+ const scrollIntoView = ref<string>('');
158
+
159
+ watch(
160
+ () => props.ws?.message?.length,
161
+ (newLen) => {
162
+ const len = newLen || 0;
163
+ if (len > 0) {
164
+ // 延迟一点确保渲染完成
165
+ setTimeout(() => {
166
+ scrollIntoView.value = `ws-msg-${len - 1}`;
167
+ }, 100);
168
+ }
169
+ },
170
+ { immediate: true },
171
+ );
131
172
 
132
173
  function onSelect(item: { label: string; value: string }) {
133
174
  currentSelect.value = item.value;
@@ -136,39 +177,50 @@ function onClose() {
136
177
  emit('close');
137
178
  }
138
179
 
139
- function onClick(item: {
140
- status: 'success' | 'error';
141
- value: string;
142
- time: number;
143
- }) {
180
+ function onClick(item: DevTool.Message) {
144
181
  uni.setClipboardData({
145
- data: JSON.stringify(item),
182
+ data: JSON.stringify(item.value), // 只拷贝 value 可能更符合直觉,或者拷贝整个 item
146
183
  success() {
147
184
  uni.showToast({
148
- title: '复制成功',
185
+ title: t('common.copySuccess'),
149
186
  icon: 'none',
150
187
  });
151
188
  },
152
189
  fail() {
153
190
  uni.showToast({
154
- title: '复制失败',
191
+ title: t('common.copyFail'),
155
192
  icon: 'none',
156
193
  });
157
194
  },
158
195
  });
159
196
  }
160
197
 
161
- function onChangeText(e: any) {
162
- sendText.value = e.detail.value;
163
- console.log(' sendText.value: ', sendText.value);
164
- }
165
-
166
198
  function onClickValue(message: DevTool.Message) {
167
199
  emit('openJson', {
168
- title: '消息详情',
200
+ title: t('websocket.messageDetail'),
169
201
  data: message.value,
170
202
  });
171
203
  }
204
+
205
+ function onInputText(e: any) {
206
+ sendText.value = e.detail.value;
207
+ }
208
+
209
+ function onSendMessage() {
210
+ if (!sendText.value) return;
211
+ let message: any = sendText.value;
212
+ try {
213
+ const parsed = JSON.parse(sendText.value);
214
+ if (typeof parsed === 'object' && parsed !== null) {
215
+ message = parsed;
216
+ }
217
+ } catch (_e) {
218
+ //
219
+ }
220
+
221
+ emit('send', { url: props.ws?.url || '', message });
222
+ sendText.value = '';
223
+ }
172
224
  </script>
173
225
  <style>
174
226
  .web-socket-list-container {
@@ -179,18 +231,20 @@ function onClickValue(message: DevTool.Message) {
179
231
  top: 0;
180
232
  left: 0;
181
233
  padding: 0 16px;
234
+
182
235
  /* #ifdef H5 || APP-PLUS */
183
236
  padding: 50px 16px;
237
+
184
238
  /* #endif */
185
239
 
186
240
  background-color: var(--dev-tool-bg3-color);
187
-
188
241
  box-sizing: border-box;
189
242
  }
190
243
 
191
244
  .web-socket-detail-control {
192
245
  display: flex;
193
246
  align-items: center;
247
+
194
248
  /* margin-bottom: 4px; */
195
249
  height: 32px;
196
250
  border-bottom: 1px solid transparent;
@@ -213,7 +267,6 @@ function onClickValue(message: DevTool.Message) {
213
267
  align-items: center;
214
268
  min-height: 28px;
215
269
  word-break: break-all;
216
- font-size: 12px;
217
270
  }
218
271
 
219
272
  .web-socket-detail-item-key {
@@ -226,7 +279,6 @@ function onClickValue(message: DevTool.Message) {
226
279
  display: flex;
227
280
  align-items: center;
228
281
  min-height: 28px;
229
-
230
282
  white-space: wrap;
231
283
  word-break: break-all;
232
284
  }
@@ -235,20 +287,23 @@ function onClickValue(message: DevTool.Message) {
235
287
  display: flex;
236
288
  align-items: center;
237
289
  min-height: 28px;
238
- font-size: 12px;
239
290
  }
291
+
240
292
  .web-socket-data-item-error {
241
- background-color: var(--dev-tool-error-bg-color);
293
+ border-left: 2px solid var(--dev-tool-error-color);
242
294
  }
295
+
243
296
  .web-socket-data-item-success {
244
- background-color: var(--dev-tool-success-bg-color);
297
+ border-left: 2px solid var(--dev-tool-success-color);
245
298
  }
299
+
246
300
  .web-socket-data-time {
247
301
  /* margin-right: 16px; */
248
302
  padding: 0 6px;
249
303
  flex-shrink: 0;
250
304
  color: var(--dev-tool-info-color);
251
305
  }
306
+
252
307
  .web-socket-data-content {
253
308
  padding: 6px;
254
309
  flex: 1;
@@ -264,19 +319,26 @@ function onClickValue(message: DevTool.Message) {
264
319
  }
265
320
 
266
321
  .web-socket-data-list {
267
- /* height: calc(100% - 32px - 32px - 130px); */
268
- height: calc(100% - 32px - 32px);
269
- overflow: auto;
322
+ height: calc(100% - 32px - 32px - 140px);
323
+ overflow: hidden;
324
+ }
325
+
326
+ .web-socket-send-container {
327
+ height: 140px;
328
+ padding-top: 10px;
329
+ box-sizing: border-box;
270
330
  }
271
331
 
272
332
  .web-socket-textarea {
273
333
  padding: 6px;
274
334
  height: 80px;
275
335
  width: 100%;
276
- font-size: 12px;
277
336
  border: 1px solid var(--dev-tool-border-color);
278
337
  box-sizing: border-box;
338
+ font-size: var(--dev-tool-base-font-size);
339
+ color: var(--dev-tool-text-color);
279
340
  }
341
+
280
342
  .web-socket-send-button {
281
343
  margin-top: 12px;
282
344
  width: 100%;
@@ -1,25 +1,25 @@
1
1
  <template>
2
+ <!-- eslint-disable vue/no-v-html, vue/no-v-text-v-html-on-component -->
2
3
  <view class="websocket-item">
3
4
  <view class="websocket-url-row" @click="emit('openDetail', ws)">
4
5
  <Tag mode="info" v-if="ws.readyState === 'connection'">connection</Tag>
5
6
  <Tag mode="success" v-if="ws.readyState === 'open'">open</Tag>
6
7
  <Tag
7
8
  mode="warn"
8
- v-if="ws.readyState === 'closing' || ws.readyState === 'closed'"
9
- >
9
+ v-if="ws.readyState === 'closing' || ws.readyState === 'closed'">
10
10
  close
11
11
  </Tag>
12
12
 
13
13
  <Tag mode="error" v-if="ws.readyState === 'error'">error</Tag>
14
14
 
15
- <view class="websocket-url" v-html="ws.url" />
15
+ <view class="websocket-url" v-html="ws._highlightUrl || ws.url" />
16
16
  </view>
17
17
  <view class="websocket-info">
18
18
  <view class="websocket-info-last">
19
19
  {{
20
20
  (ws?.message?.[ws.message.length - 1]?.shortValue ||
21
21
  ws?.message?.[ws.message.length - 1]?.value) ??
22
- '暂无消息'
22
+ t('websocket.noMessage')
23
23
  }}
24
24
  </view>
25
25
 
@@ -40,6 +40,9 @@
40
40
  import Tag from '../Tag/index.vue';
41
41
  import { formatDate } from '../../utils';
42
42
  import type { DevTool } from '../../type';
43
+ import { useI18n } from '../../i18n';
44
+
45
+ const { t } = useI18n();
43
46
 
44
47
  defineProps<{ ws: DevTool.WS; zIndex?: number }>();
45
48
 
@@ -52,6 +55,7 @@ const emit = defineEmits<{ (e: 'openDetail', value: DevTool.WS): void }>();
52
55
  border-bottom: 1px solid var(--dev-tool-border-color);
53
56
  font-size: var(--dev-tool-base-font-size);
54
57
  }
58
+
55
59
  .websocket-url-row {
56
60
  display: flex;
57
61
  align-items: center;
@@ -71,9 +75,11 @@ const emit = defineEmits<{ (e: 'openDetail', value: DevTool.WS): void }>();
71
75
  flex-shrink: 0;
72
76
  margin-left: auto;
73
77
  }
78
+
74
79
  .websocket-detail-active {
75
80
  transform: rotate(135deg);
76
81
  }
82
+
77
83
  .websocket-info {
78
84
  display: flex;
79
85
  align-items: center;
@@ -1,73 +1,78 @@
1
1
  <template>
2
2
  <view class="websocket-content">
3
3
  <view class="websocket-control">
4
+ <DevToolTitle>{{ t('websocket.title') }}</DevToolTitle>
4
5
  <FilterInput
5
- :modelValue="modelValue"
6
- placeholder="查询url"
7
- @search="emit('search', $event)"
8
- @update:modelValue="emit('update:modelValue', $event)"
9
- />
10
- <Tag
11
- v-for="item in webSocketFilter"
12
- :mode="item.mode"
13
- :key="item.value"
14
- :active="item.value === currentWebSocketType"
15
- @click="onChoose(item.value)"
16
- >
17
- {{ item.label }}
6
+ v-model="modelValue"
7
+ :placeholder="t('websocket.searchUrl')"
8
+ @search="emit('search', $event)" />
9
+ <Pick
10
+ v-model="currentWebSocketType"
11
+ :options="filterOptions"
12
+ :readonly="true"
13
+ :placeholder="t('common.selectStatus')"
14
+ customStyle="width: 100px; flex: none;"
15
+ @change="onFilterChange" />
16
+ <Tag mode="clear" @click="onChoose('clear')">
17
+ {{ t('common.clear') }}
18
18
  </Tag>
19
19
  </view>
20
20
 
21
- <VirtualListPro
21
+ <VirtualList
22
22
  :data="wsList"
23
23
  :pageSize="10"
24
24
  :height="contentHeight - 32 - 32"
25
- className="websocket-list"
26
- >
25
+ className="websocket-list">
27
26
  <template v-slot="{ list, start, itemsHeight, onSizeChange }">
28
27
  <AutoSize
29
28
  v-for="(item, index) in list"
30
29
  :index="start + index"
31
30
  :key="start + index"
32
31
  :itemsHeight="itemsHeight"
33
- :onSizeChange="onSizeChange"
34
- >
32
+ :onSizeChange="onSizeChange">
35
33
  <WebSocketItem
36
34
  :ws="item"
37
35
  :zIndex="zIndex"
38
- @openDetail="emit('openDetail', $event)"
39
- />
36
+ @openDetail="emit('openDetail', $event)" />
40
37
  </AutoSize>
41
38
  <Empty v-if="!wsList || wsList.length === 0" />
42
39
  </template>
43
- </VirtualListPro>
40
+ </VirtualList>
44
41
  </view>
45
42
  </template>
46
43
  <script lang="ts" setup>
44
+ import { computed } from 'vue';
47
45
  import WebSocketItem from './WebSocketItem.vue';
48
46
  import Tag from '../Tag/index.vue';
49
47
  import Empty from '../Empty/index.vue';
50
48
  import FilterInput from '../FilterInput/index.vue';
49
+ import Pick from '../Pick/index.vue'; // Changed from FilterSelect to Pick
51
50
  import type { DevTool } from '../../type';
52
- import VirtualListPro from '../VirtualListPro/index.vue';
53
- import AutoSize from '../VirtualListPro/AutoSize.vue';
51
+ import VirtualList from '../VirtualList/index.vue';
52
+ import AutoSize from '../VirtualList/AutoSize.vue';
53
+ import DevToolTitle from '../DevToolTitle/index.vue';
54
+ import { useI18n } from '../../i18n';
55
+
56
+ const { t } = useI18n();
54
57
 
55
58
  defineProps<{
56
59
  wsList: DevTool.WS[];
57
- currentWebSocketType: string;
58
- modelValue: string;
59
60
  zIndex?: number;
60
61
  contentHeight: number;
61
62
  }>();
62
63
  const emit = defineEmits<{
63
64
  (e: 'choose', type: string): void;
64
- (e: 'update:modelValue', value: string): void;
65
65
  (e: 'search', value: string): void;
66
66
  (e: 'openDetail', value: DevTool.WS): void;
67
67
  }>();
68
- const webSocketFilter = [
68
+
69
+ const modelValue = defineModel<string>('modelValue', { required: true });
70
+ const currentWebSocketType = defineModel<string>('currentWebSocketType', {
71
+ required: true,
72
+ });
73
+ const webSocketFilter = computed(() => [
69
74
  {
70
- label: '全部',
75
+ label: t('common.all'),
71
76
  value: 'all',
72
77
  mode: 'all',
73
78
  },
@@ -92,15 +97,23 @@ const webSocketFilter = [
92
97
  mode: 'error',
93
98
  },
94
99
  {
95
- label: '清除',
100
+ label: t('common.clear'),
96
101
  value: 'clear',
97
102
  mode: 'clear',
98
103
  },
99
- ];
104
+ ]);
100
105
 
101
106
  function onChoose(type: string) {
102
107
  emit('choose', type);
103
108
  }
109
+
110
+ const filterOptions = computed(() => {
111
+ return webSocketFilter.value.filter((item) => item.value !== 'clear');
112
+ });
113
+
114
+ function onFilterChange(item: { label: string; value: any }) {
115
+ emit('choose', item.value);
116
+ }
104
117
  </script>
105
118
  <style scoped>
106
119
  .websocket-content {
@@ -118,6 +131,7 @@ function onChoose(type: string) {
118
131
  border-bottom: 1px solid var(--dev-tool-border-color);
119
132
  box-sizing: border-box;
120
133
  }
134
+
121
135
  .websocket-list {
122
136
  height: calc(100% - 32px);
123
137
  overflow: auto;