vite-uni-dev-tool 1.0.0 → 1.2.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 (170) hide show
  1. package/README.md +54 -0
  2. package/dist/const.cjs +1 -1
  3. package/dist/const.d.ts +13 -0
  4. package/dist/const.d.ts.map +1 -1
  5. package/dist/const.js +1 -1
  6. package/dist/core-shared.d.ts +1 -1
  7. package/dist/core-shared.d.ts.map +1 -1
  8. package/dist/core-shared.js +1 -1
  9. package/dist/core.d.ts +10 -3
  10. package/dist/core.d.ts.map +1 -1
  11. package/dist/core.js +2 -2
  12. package/dist/i18n/locales/en.cjs +1 -1
  13. package/dist/i18n/locales/en.d.ts +86 -0
  14. package/dist/i18n/locales/en.d.ts.map +1 -1
  15. package/dist/i18n/locales/en.js +1 -1
  16. package/dist/i18n/locales/zh-Hans.cjs +1 -1
  17. package/dist/i18n/locales/zh-Hans.d.ts +87 -1
  18. package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
  19. package/dist/i18n/locales/zh-Hans.js +1 -1
  20. package/dist/modules/devConsole/index.cjs +1 -1
  21. package/dist/modules/devConsole/index.js +3 -3
  22. package/dist/modules/devEvent/index.cjs +3 -3
  23. package/dist/modules/devEvent/index.d.ts +1 -0
  24. package/dist/modules/devEvent/index.d.ts.map +1 -1
  25. package/dist/modules/devEvent/index.js +3 -3
  26. package/dist/modules/devIntercept/index.cjs +14 -13
  27. package/dist/modules/devIntercept/index.d.ts +20 -1
  28. package/dist/modules/devIntercept/index.d.ts.map +1 -1
  29. package/dist/modules/devIntercept/index.js +14 -13
  30. package/dist/modules/devStore/index.cjs +1 -1
  31. package/dist/modules/devStore/index.d.ts +21 -0
  32. package/dist/modules/devStore/index.d.ts.map +1 -1
  33. package/dist/modules/devStore/index.js +1 -1
  34. package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -3
  35. package/dist/plugins/uniDevTool/transform/transformMain.d.ts +2 -1
  36. package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -1
  37. package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
  38. package/dist/plugins/uniDevTool/transform/transformVue.cjs +31 -25
  39. package/dist/plugins/uniDevTool/transform/transformVue.d.ts +2 -1
  40. package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
  41. package/dist/plugins/uniDevTool/transform/transformVue.js +30 -24
  42. package/dist/plugins/uniDevTool/uniDevTool.cjs +3 -3
  43. package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -1
  44. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  45. package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
  46. package/dist/type.d.ts +50 -2
  47. package/dist/type.d.ts.map +1 -1
  48. package/dist/utils/language.cjs +1 -1
  49. package/dist/utils/language.d.ts.map +1 -1
  50. package/dist/utils/language.js +1 -1
  51. package/dist/utils/object.cjs +1 -1
  52. package/dist/utils/object.d.ts.map +1 -1
  53. package/dist/utils/object.js +1 -1
  54. package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -0
  55. package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -0
  56. package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -0
  57. package/dist/v3/{CaptureScreen → DevTool/components/CaptureScreen}/index.vue +4 -4
  58. package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/ConsoleItem.vue +22 -16
  59. package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/RunJSInput.vue +4 -6
  60. package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/index.vue +21 -10
  61. package/dist/v3/{DevToolButton → DevTool/components/DevToolButton}/index.vue +7 -4
  62. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/DevToolOverlay.vue +17 -2
  63. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/const.ts +28 -5
  64. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/dataUtils.ts +1 -1
  65. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolData.ts +55 -6
  66. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolHandlers.ts +85 -5
  67. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolOverlay.ts +25 -8
  68. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.vue +67 -16
  69. package/dist/v3/{ElEvent → DevTool/components/ElEvent}/ElEventItem.vue +3 -3
  70. package/dist/v3/{ElEvent → DevTool/components/ElEvent}/index.vue +10 -13
  71. package/dist/v3/{Instance → DevTool/components/Instance}/index.vue +1 -1
  72. package/dist/v3/{Instance → DevTool/components/Instance}/transformTree.ts +1 -1
  73. package/dist/v3/{Instance → DevTool/components/Instance}/transformTreeCtx.ts +1 -1
  74. package/dist/v3/{InstanceDetail → DevTool/components/InstanceDetail}/index.vue +4 -4
  75. package/dist/v3/{JsonDetail → DevTool/components/JsonDetail}/index.vue +4 -4
  76. package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCItem.vue +4 -5
  77. package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCTool.vue +33 -57
  78. package/dist/v3/{NFCList → DevTool/components/NFCList}/index.vue +12 -16
  79. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptConfig.vue +20 -4
  80. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptItem.vue +3 -3
  81. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkDetail.vue +18 -27
  82. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkIntercept.vue +11 -16
  83. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkItem.vue +10 -14
  84. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkSend.vue +67 -34
  85. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/index.vue +8 -8
  86. package/dist/v3/{Performance → DevTool/components/Performance}/index.vue +7 -4
  87. package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceWidget.vue +12 -9
  88. package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceChart.ts +1 -1
  89. package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceData.ts +2 -2
  90. package/dist/v3/{PiniaList → DevTool/components/PiniaList}/index.vue +5 -6
  91. package/dist/v3/{RouteList → DevTool/components/RouteList}/index.vue +21 -24
  92. package/dist/v3/{RunJS → DevTool/components/RunJS}/index.vue +3 -3
  93. package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/ScanCodeItem.vue +3 -4
  94. package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/index.vue +12 -16
  95. package/dist/v3/{SettingList → DevTool/components/SettingList}/index.vue +68 -0
  96. package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -0
  97. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingDevTool.vue +8 -4
  98. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingInfo.vue +47 -9
  99. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLanguage.vue +2 -2
  100. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLog.vue +2 -2
  101. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingNetwork.vue +3 -3
  102. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingTheme.vue +37 -7
  103. package/dist/v3/{SourceCode → DevTool/components/SourceCode}/Line.vue +22 -11
  104. package/dist/v3/{SourceCode → DevTool/components/SourceCode}/index.vue +8 -8
  105. package/dist/v3/{SourceCode → DevTool/components/SourceCode}/parseCode.ts +136 -228
  106. package/dist/v3/{StorageList → DevTool/components/StorageList}/index.vue +7 -7
  107. package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferDetail.vue +6 -6
  108. package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferItem.vue +4 -4
  109. package/dist/v3/{TransferList → DevTool/components/TransferList}/index.vue +8 -8
  110. package/dist/v3/{UniEvent → DevTool/components/UniEvent}/UniEventItem.vue +6 -7
  111. package/dist/v3/{UniEvent → DevTool/components/UniEvent}/index.vue +6 -6
  112. package/dist/v3/{VuexList → DevTool/components/VuexList}/index.vue +3 -3
  113. package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketDetail.vue +8 -8
  114. package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketItem.vue +4 -4
  115. package/dist/v3/{WebSocket → DevTool/components/WebSocket}/index.vue +8 -8
  116. package/dist/v3/DevTool/index.vue +179 -4
  117. package/dist/v3/{AppTransition → components/AppTransition}/index.vue +6 -0
  118. package/dist/v3/components/Barrage/BarrageItem.vue +137 -0
  119. package/dist/v3/components/Barrage/index.vue +202 -0
  120. package/dist/v3/components/DevErrorBoundary/index.vue +380 -0
  121. package/dist/v3/{DraggableContainer → components/DraggableContainer}/index.vue +1 -1
  122. package/dist/v3/{FilterInput → components/FilterInput}/index.vue +1 -1
  123. package/dist/v3/{JsonPretty → components/JsonPretty}/components/CheckController/index.vue +1 -1
  124. package/dist/v3/{JsonPretty → components/JsonPretty}/components/TreeNode/index.vue +11 -5
  125. package/dist/v3/{JsonPretty → components/JsonPretty}/index.vue +16 -13
  126. package/dist/v3/{JsonPretty → components/JsonPretty}/type.ts +1 -0
  127. package/dist/v3/{JsonPretty → components/JsonPretty}/utils/index.ts +1 -1
  128. package/dist/v3/{MovableContainer → components/MovableContainer}/index.vue +9 -5
  129. package/dist/v3/{Pick → components/Pick}/index.vue +1 -1
  130. package/dist/v3/{Tabs → components/Tabs}/index.vue +30 -4
  131. package/dist/v3/{VirtualList → components/VirtualList}/AutoSize.vue +1 -1
  132. package/dist/v3/{VirtualList → components/VirtualList}/index.vue +4 -0
  133. package/dist/v3/hooks/useBluetooth/index.ts +561 -0
  134. package/dist/v3/hooks/useRequest/index.ts +33 -20
  135. package/dist/v3/hooks/useWebsocket/README.md +79 -0
  136. package/dist/v3/hooks/useWebsocket/index.ts +253 -0
  137. package/dist/v3/styles/theme.css +17 -10
  138. package/package.json +67 -64
  139. package/dist/plugins/uniParseStock/index.d.ts +0 -10
  140. package/dist/plugins/uniParseStock/index.d.ts.map +0 -1
  141. /package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/staticTips.ts +0 -0
  142. /package/dist/v3/{DevToolTitle → DevTool/components/DevToolTitle}/index.vue +0 -0
  143. /package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.css +0 -0
  144. /package/dist/v3/{Instance → DevTool/components/Instance}/components/InstanceTreeNode.vue +0 -0
  145. /package/dist/v3/{Instance → DevTool/components/Instance}/flatten.ts +0 -0
  146. /package/dist/v3/{Instance → DevTool/components/Instance}/registry.ts +0 -0
  147. /package/dist/v3/{Instance → DevTool/components/Instance}/typing.d.ts +0 -0
  148. /package/dist/v3/{NFCList → DevTool/components/NFCList}/const.ts +0 -0
  149. /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/const.ts +0 -0
  150. /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/hooks/useNetworkForm.ts +0 -0
  151. /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/utils.ts +0 -0
  152. /package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceMetrics.vue +0 -0
  153. /package/dist/v3/{SettingButton → DevTool/components/SettingButton}/index.vue +0 -0
  154. /package/dist/v3/{SettingList → DevTool/components/SettingList}/index.css +0 -0
  155. /package/dist/v3/{SettingList → DevTool/components/SettingList}/typing.d.ts +0 -0
  156. /package/dist/v3/{AutoSizer → components/AutoSizer}/index.vue +0 -0
  157. /package/dist/v3/{AutoSizer → components/AutoSizer}/index1.vue +0 -0
  158. /package/dist/v3/{AutoSizer → components/AutoSizer}/utils.ts +0 -0
  159. /package/dist/v3/{CircularButton → components/CircularButton}/index.vue +0 -0
  160. /package/dist/v3/{CustomSwiper → components/CustomSwiper}/CustomSwiperItem.vue +0 -0
  161. /package/dist/v3/{CustomSwiper → components/CustomSwiper}/index.vue +0 -0
  162. /package/dist/v3/{Empty → components/Empty}/empty.png +0 -0
  163. /package/dist/v3/{Empty → components/Empty}/index.vue +0 -0
  164. /package/dist/v3/{FilterSelect → components/FilterSelect}/index.vue +0 -0
  165. /package/dist/v3/{JsonPretty → components/JsonPretty}/components/Brackets/index.vue +0 -0
  166. /package/dist/v3/{JsonPretty → components/JsonPretty}/components/Carets/index.vue +0 -0
  167. /package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useClipboard.ts +0 -0
  168. /package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useError.ts +0 -0
  169. /package/dist/v3/{Tag → components/Tag}/index.vue +0 -0
  170. /package/dist/v3/{VirtualList → components/VirtualList}/readme.md +0 -0
@@ -0,0 +1,167 @@
1
+ <template>
2
+ <view class="bluetooth-content">
3
+ <view class="bluetooth-control">
4
+ <DevToolTitle>{{ t('bluetooth.title') }}</DevToolTitle>
5
+
6
+ <view class="control-btns">
7
+ <Tag v-if="!isSearching" mode="clear" @click="startSearch">
8
+ {{ t('bluetooth.startSearch') }}
9
+ </Tag>
10
+ <Tag v-else mode="clear" @click="stopSearch">
11
+ {{ t('bluetooth.stopSearch') }}
12
+ </Tag>
13
+ <Tag mode="clear" @click="clear">{{ t('common.clear') }}</Tag>
14
+ </view>
15
+ </view>
16
+
17
+ <VirtualList
18
+ v-if="devices && devices.length > 0"
19
+ class="bluetooth-list"
20
+ :pageSize="20"
21
+ :height="contentHeight - 32 - 32"
22
+ :data="devices">
23
+ <template #default="{ list, start, itemsHeight, onSizeChange }">
24
+ <AutoSize
25
+ v-for="(item, index) in list"
26
+ :key="start + index"
27
+ :index="start + index"
28
+ :id="`dev-bluetooth-${start + index}`"
29
+ :itemsHeight="itemsHeight"
30
+ :onSizeChange="onSizeChange">
31
+ <BluetoothItem
32
+ :bluetoothItem="item"
33
+ @pair="handlePair"
34
+ @connect="handleConnect"
35
+ @disconnect="handleDisconnect"
36
+ @tool="handleTool" />
37
+ </AutoSize>
38
+ </template>
39
+ </VirtualList>
40
+
41
+ <Empty v-else />
42
+ </view>
43
+ </template>
44
+
45
+ <script lang="ts" setup>
46
+ import type { DevTool } from '../../../../type';
47
+ import DevToolTitle from '../DevToolTitle/index.vue';
48
+ import BluetoothItem from './BluetoothItem.vue';
49
+ import Tag from '../../../components/Tag/index.vue';
50
+ import Empty from '../../../components/Empty/index.vue';
51
+ import VirtualList from '../../../components/VirtualList/index.vue';
52
+ import AutoSize from '../../../components/VirtualList/AutoSize.vue';
53
+ import useBluetooth from '../../../hooks/useBluetooth';
54
+ import { useI18n } from '../../../../i18n';
55
+
56
+ const { t } = useI18n();
57
+
58
+ const emits = defineEmits<{
59
+ (e: 'openTool', device: DevTool.BluetoothItem): void;
60
+ }>();
61
+
62
+ defineProps<{
63
+ contentHeight: number;
64
+ }>();
65
+
66
+ const {
67
+ devices,
68
+ isSearching,
69
+ startBluetoothDevicesDiscovery,
70
+ stopBluetoothDevicesDiscovery,
71
+ connectDevice,
72
+ disconnectDevice,
73
+ pairDevice,
74
+ } = useBluetooth();
75
+
76
+ const startSearch = () => {
77
+ startBluetoothDevicesDiscovery();
78
+ };
79
+
80
+ const stopSearch = () => {
81
+ stopBluetoothDevicesDiscovery();
82
+ };
83
+
84
+ const clear = () => {
85
+ devices.value = [];
86
+ };
87
+
88
+ const handlePair = async (deviceId: string) => {
89
+ try {
90
+ uni.showLoading({ title: t('bluetooth.requestPairing') });
91
+ await pairDevice(deviceId);
92
+ uni.showToast({ title: t('bluetooth.pairRequestSent'), icon: 'success' });
93
+ } catch (error: unknown) {
94
+ const err = error as { message?: string };
95
+ uni.showToast({
96
+ title: err.message || t('bluetooth.pairRequestFail'),
97
+ icon: 'none',
98
+ });
99
+ } finally {
100
+ uni.hideLoading();
101
+ }
102
+ };
103
+
104
+ const handleConnect = async (deviceId: string) => {
105
+ try {
106
+ uni.showLoading({ title: t('bluetooth.connecting') });
107
+ await connectDevice(deviceId);
108
+ uni.showToast({ title: t('bluetooth.connectSuccess'), icon: 'success' });
109
+ } catch (error: unknown) {
110
+ const err = error as { message?: string };
111
+ uni.showToast({
112
+ title: err.message || t('bluetooth.connectFail'),
113
+ icon: 'none',
114
+ });
115
+ } finally {
116
+ uni.hideLoading();
117
+ }
118
+ };
119
+
120
+ const handleDisconnect = async (deviceId: string) => {
121
+ try {
122
+ uni.showLoading({ title: t('bluetooth.disconnecting') });
123
+ await disconnectDevice(deviceId);
124
+ uni.showToast({ title: t('bluetooth.disconnectSuccess'), icon: 'success' });
125
+ } catch (error: unknown) {
126
+ const err = error as { message?: string };
127
+ uni.showToast({
128
+ title: err.message || t('bluetooth.disconnectFail'),
129
+ icon: 'none',
130
+ });
131
+ } finally {
132
+ uni.hideLoading();
133
+ }
134
+ };
135
+
136
+ const handleTool = (device: DevTool.BluetoothItem) => {
137
+ emits('openTool', device);
138
+ };
139
+ </script>
140
+
141
+ <style scoped>
142
+ .bluetooth-content {
143
+ height: 100%;
144
+ overflow: auto;
145
+ font-size: var(--dev-tool-base-font-size);
146
+ }
147
+
148
+ .bluetooth-control {
149
+ display: flex;
150
+ align-items: center;
151
+ justify-content: space-between;
152
+ padding: 0 16px;
153
+ height: 32px;
154
+ border-bottom: 1px solid var(--dev-tool-border-color);
155
+ box-sizing: border-box;
156
+ }
157
+
158
+ .control-btns {
159
+ display: flex;
160
+ gap: 8px;
161
+ }
162
+
163
+ .bluetooth-list {
164
+ height: calc(100% - 32px);
165
+ overflow: auto;
166
+ }
167
+ </style>
@@ -50,10 +50,10 @@
50
50
  </template>
51
51
  <script lang="ts" setup>
52
52
  import DevToolTitle from '../DevToolTitle/index.vue';
53
- import type { DevTool } from '../../type';
54
- import Empty from '../Empty/index.vue';
55
- import Tag from '../Tag/index.vue';
56
- import { useI18n } from '../../i18n';
53
+ import type { DevTool } from '../../../../type';
54
+ import Empty from '../../../components/Empty/index.vue';
55
+ import Tag from '../../../components/Tag/index.vue';
56
+ import { useI18n } from '../../../../i18n';
57
57
 
58
58
  const { t } = useI18n();
59
59
 
@@ -6,19 +6,20 @@
6
6
  v-for="(item, index) in consoleItem.args"
7
7
  :key="index"
8
8
  :class="`console-arg console-arg-${item.type}`"
9
- @click="onClickArg(item)"
10
- >
9
+ @click="onClickArg(item)">
11
10
  <template v-if="item.type === 'image'">
12
11
  <image
13
12
  :src="item.value"
14
13
  :title="item.value"
15
14
  mode="aspectFit"
16
- class="console-arg-image"
17
- />
18
- <view v-html="item.shortValue || item.value"></view>
15
+ class="console-arg-image" />
16
+ <view
17
+ v-html="item._valueHtml || item.shortValue || item.value"></view>
19
18
  </template>
20
19
 
21
- <view v-else v-html="item.shortValue || item.value"></view>
20
+ <view
21
+ v-else
22
+ v-html="item._valueHtml || item.shortValue || item.value"></view>
22
23
  </view>
23
24
  </view>
24
25
  <view class="console-position">
@@ -26,8 +27,7 @@
26
27
  <Tag
27
28
  v-if="consoleItem.mode"
28
29
  mode="log"
29
- style="margin-right: 6px; justify-content: center"
30
- >
30
+ style="margin-right: 6px; justify-content: center">
31
31
  {{ consoleItem.mode }}
32
32
  </Tag>
33
33
  <!-- <Tag :mode="consoleItem.type">
@@ -41,14 +41,15 @@
41
41
  {{ t('common.executionTime') }}: {{ consoleItem?.executionTime }}ms
42
42
  </view>
43
43
  <!-- eslint-disable-next-line vue/no-v-text-v-html-on-component -->
44
- <view class="console-other" v-html="consoleItem.position"></view>
44
+ <view
45
+ class="console-other"
46
+ v-html="consoleItem._positionHtml || consoleItem.position"></view>
45
47
  <!-- eslint-disable-next-line vue/no-v-text-v-html-on-component -->
46
48
  <view
47
49
  v-if="consoleItem.stack"
48
- v-html="consoleItem.stack"
50
+ v-html="consoleItem._stackHtml || consoleItem.stack"
49
51
  :class="`console-other ${isUseDevSource ? 'console-stack' : ''}`"
50
- @click="emit('openCode', consoleItem.stack)"
51
- ></view>
52
+ @click="emit('openCode', consoleItem.stack)"></view>
52
53
  </view>
53
54
  </view>
54
55
  </view>
@@ -56,10 +57,11 @@
56
57
 
57
58
  <script setup lang="ts">
58
59
  import { computed } from 'vue';
59
- import Tag from '../Tag/index.vue';
60
- import type { DevTool } from '../../type';
61
- import { isMockWX, openOutLink } from '../../utils';
62
- import { useI18n } from '../../i18n';
60
+ import Tag from '../../../components/Tag/index.vue';
61
+ import type { DevTool } from '../../../../type';
62
+
63
+ import { useI18n } from '../../../../i18n';
64
+ import { isMockWX, openOutLink } from '../../../../utils';
63
65
 
64
66
  const { t } = useI18n();
65
67
  const props = defineProps<{
@@ -164,6 +166,10 @@ function onClickArg(item: DevTool.Arg) {
164
166
  color: var(--dev-tool-info-color);
165
167
  }
166
168
 
169
+ .console-item-debug {
170
+ color: var(--dev-tool-info-color);
171
+ }
172
+
167
173
  .console-item-log {
168
174
  color: var(--dev-tool-info-color);
169
175
  }
@@ -6,15 +6,13 @@
6
6
  class="run-js-input"
7
7
  :placeholder="t('common.runPlaceholder')"
8
8
  @confirm="debounceConfirm"
9
- @input="onChange"
10
- />
9
+ @input="onChange" />
11
10
  <view class="run-js-tips">
12
11
  <view
13
12
  class="run-js-tips-item"
14
13
  v-for="(item, index) in tips"
15
14
  :key="index"
16
- @click="onChoose(item.name)"
17
- >
15
+ @click="onChoose(item.name)">
18
16
  {{ item.name }}{{ item.description ? ': ' : ' ' }}{{ item.description }}
19
17
  </view>
20
18
  </view>
@@ -29,8 +27,8 @@ import {
29
27
  baseSymbols,
30
28
  type Tip,
31
29
  } from './staticTips';
32
- import { debounce } from '../../utils';
33
- import { useI18n } from '../../i18n';
30
+ import { debounce } from '../../../../utils';
31
+ import { useI18n } from '../../../../i18n';
34
32
 
35
33
  const { t } = useI18n();
36
34
 
@@ -48,22 +48,29 @@
48
48
  </template>
49
49
  <script setup lang="ts">
50
50
  import ConsoleItem from './ConsoleItem.vue';
51
- import Tag from '../Tag/index.vue';
52
- import Empty from '../Empty/index.vue';
53
- import FilterInput from '../FilterInput/index.vue';
54
- import Pick from '../Pick/index.vue';
51
+ import Tag from '../../../components/Tag/index.vue';
52
+ import Empty from '../../../components/Empty/index.vue';
53
+ import FilterInput from '../../../components/FilterInput/index.vue';
54
+ import Pick from '../../../components/Pick/index.vue';
55
55
  import RunJSInput from './RunJSInput.vue';
56
- import type { DevTool } from '../../type';
56
+ import type { DevTool } from '../../../../type';
57
57
  import { nextTick, onMounted, ref, computed } from 'vue';
58
- import { debounce } from '../../utils';
59
- import VirtualList from '../VirtualList/index.vue';
60
- import AutoSize from '../VirtualList/AutoSize.vue';
58
+ import { debounce } from '../../../../utils';
59
+ import VirtualList from '../../../components/VirtualList/index.vue';
60
+ import AutoSize from '../../../components/VirtualList/AutoSize.vue';
61
61
  import DevToolTitle from '../DevToolTitle/index.vue';
62
- import { useI18n } from '../../i18n';
62
+ import { useI18n } from '../../../../i18n';
63
63
 
64
64
  const { t } = useI18n();
65
65
 
66
- type ConsoleType = 'all' | 'log' | 'info' | 'warn' | 'error' | 'clear';
66
+ type ConsoleType =
67
+ | 'all'
68
+ | 'log'
69
+ | 'info'
70
+ | 'debug'
71
+ | 'warn'
72
+ | 'error'
73
+ | 'clear';
67
74
  const props = defineProps<{
68
75
  consoleList: DevTool.ConsoleItem[];
69
76
  sourceFileServers?: string[];
@@ -99,6 +106,10 @@ const consoleFilterItems = computed<
99
106
  label: 'info',
100
107
  value: 'info',
101
108
  },
109
+ {
110
+ label: 'debug',
111
+ value: 'debug',
112
+ },
102
113
  {
103
114
  label: 'log',
104
115
  value: 'log',
@@ -17,8 +17,11 @@
17
17
  <script lang="ts" setup>
18
18
  import { onShow } from '@dcloudio/uni-app';
19
19
  import { ref } from 'vue';
20
- import { getDevToolInfo, setDevToolInfo } from '../../modules/devToolInfo';
21
- import MovableContainer from '../MovableContainer/index.vue';
20
+ import {
21
+ getDevToolInfo,
22
+ setDevToolInfo,
23
+ } from '../../../../modules/devToolInfo';
24
+ import MovableContainer from '../../../components/MovableContainer/index.vue';
22
25
 
23
26
  const x = ref(300);
24
27
  const y = ref(500);
@@ -49,8 +52,8 @@ const onClick = () => {
49
52
 
50
53
  onShow(() => {
51
54
  const { left = 300, top = 500 } = getDevToolInfo();
52
- x.value = left;
53
- y.value = top;
55
+ x.value = Number(left) || 300;
56
+ y.value = Number(top) || 500;
54
57
  });
55
58
  </script>
56
59
  <style scoped>
@@ -144,6 +144,20 @@
144
144
  :customStyle="customStyle"
145
145
  @close="overlayHandlers.onCloseNfcTool" />
146
146
  </AppTransition>
147
+
148
+ <!-- Bluetooth 工具 -->
149
+ <AppTransition
150
+ :show="overlayState?.showBluetoothTool"
151
+ name="slide-left"
152
+ :zIndex="zIndex"
153
+ :animated="useTransition">
154
+ <BluetoothTool
155
+ v-if="overlayState?.showBluetoothTool"
156
+ :device="overlayState?.bluetoothDevice"
157
+ :contentHeight="contentHeight"
158
+ :customStyle="customStyle"
159
+ @back="overlayHandlers.onCloseBluetoothTool" />
160
+ </AppTransition>
147
161
  </template>
148
162
 
149
163
  <script setup lang="ts">
@@ -156,8 +170,9 @@ import TransferDetail from '../TransferList/TransferDetail.vue';
156
170
  import WebSocketDetail from '../WebSocket/WebSocketDetail.vue';
157
171
  import JsonDetail from '../JsonDetail/index.vue';
158
172
  import NFCTool from '../NFCList/NFCTool.vue';
159
- import AppTransition from '../AppTransition/index.vue';
160
- import type { DevTool } from '../../type';
173
+ import BluetoothTool from '../BluetoothList/BluetoothTool.vue';
174
+ import AppTransition from '../../../components/AppTransition/index.vue';
175
+ import type { DevTool } from '../../../../type';
161
176
 
162
177
  defineProps<{
163
178
  overlayState: any;
@@ -12,10 +12,11 @@ export const tabIndex = {
12
12
  CaptureScreen: 9,
13
13
  ScanCode: 10,
14
14
  NFC: 11,
15
- Storage: 12,
16
- Vuex: 13,
17
- Pinia: 14,
18
- Setting: 15,
15
+ Bluetooth: 12,
16
+ Storage: 13,
17
+ Vuex: 14,
18
+ Pinia: 15,
19
+ Setting: 16,
19
20
  };
20
21
 
21
22
  /**
@@ -26,97 +27,119 @@ export const getTabItems = (t: (key: string) => string) => [
26
27
  {
27
28
  key: 'Console',
28
29
  label: t('tabs.console'),
30
+ icon: '💻',
29
31
  value: 'Console',
30
32
  index: tabIndex.Console,
31
33
  },
32
34
  {
33
35
  key: 'Network',
34
36
  label: t('tabs.network'),
37
+ icon: '🌐',
35
38
  value: 'NetWork',
36
39
  index: tabIndex.Network,
37
40
  },
38
41
  {
39
42
  key: 'Transfer',
40
43
  label: t('tabs.transfer'),
44
+ icon: '📤',
41
45
  value: 'Transfer',
42
46
  index: tabIndex.Transfer,
43
47
  },
44
48
  {
45
49
  key: 'WebSocket',
46
50
  label: t('tabs.websocket'),
51
+ icon: '🔌',
47
52
  value: 'WebSocket',
48
53
  index: tabIndex.WebSocket,
49
54
  },
50
55
  {
51
56
  key: 'Route',
52
57
  label: t('tabs.route'),
58
+ icon: '🧭',
53
59
  value: 'Route',
54
60
  index: tabIndex.Route,
55
61
  },
56
62
  {
57
63
  key: 'Instance',
58
64
  label: t('tabs.instance'),
65
+ icon: '🌳',
59
66
  value: 'Instance',
60
67
  index: tabIndex.Instance,
61
68
  },
62
69
  {
63
70
  key: 'ElEvent',
64
71
  label: t('tabs.elEvent'),
72
+ icon: '👆',
65
73
  value: 'ElEvent',
66
74
  index: tabIndex.ElEvent,
67
75
  },
68
76
  {
69
77
  key: 'UniEvent',
70
78
  label: t('tabs.uniEvent'),
79
+ icon: '📻',
71
80
  value: 'UniEvent',
72
81
  index: tabIndex.UniEvent,
73
82
  },
74
83
  {
75
84
  key: 'Performance',
76
85
  label: t('tabs.performance'),
86
+ icon: '🚀',
77
87
  value: 'Performance',
78
88
  index: tabIndex.Performance,
79
89
  },
80
90
  {
81
91
  key: 'CaptureScreen',
82
92
  label: t('tabs.captureScreen'),
93
+ icon: '📸',
83
94
  value: 'CaptureScreen',
84
95
  index: tabIndex.CaptureScreen,
85
96
  },
86
97
  {
87
98
  key: 'ScanCode',
88
99
  label: t('tabs.scanCode'),
100
+ icon: '🔍',
89
101
  value: 'ScanCode',
90
102
  index: tabIndex.ScanCode,
91
103
  },
92
104
  {
93
105
  key: 'NFC',
94
106
  label: t('tabs.nfc'),
107
+ icon: '📳',
95
108
  value: 'NFC',
96
109
  index: tabIndex.NFC,
97
110
  },
111
+ {
112
+ key: 'Bluetooth',
113
+ label: t('tabs.bluetooth'),
114
+ icon: '🔹',
115
+ value: 'Bluetooth',
116
+ index: tabIndex.Bluetooth,
117
+ },
98
118
  {
99
119
  key: 'Storage',
100
120
  label: t('tabs.storage'),
121
+ icon: '📦',
101
122
  value: 'Storage',
102
123
  index: tabIndex.Storage,
103
124
  },
104
125
  {
105
126
  key: 'Vuex',
106
127
  label: t('tabs.vuex'),
128
+ icon: '💚',
107
129
  value: 'Vuex',
108
130
  index: tabIndex.Vuex,
109
131
  },
110
132
  {
111
133
  key: 'Pinia',
112
134
  label: t('tabs.pinia'),
135
+ icon: '🍍',
113
136
  value: 'Pinia',
114
137
  index: tabIndex.Pinia,
115
138
  },
116
-
117
139
  {
118
140
  key: 'Setting',
119
141
  label: t('tabs.setting'),
142
+ icon: '⚙️',
120
143
  value: 'Setting',
121
144
  index: tabIndex.Setting,
122
145
  },
@@ -1,4 +1,4 @@
1
- import type { DevTool } from '../../../type';
1
+ import type { DevTool } from '../../../../../type';
2
2
 
3
3
  export const calcLineStartAndEnd = (
4
4
  list: DevTool.NetworkItem[],
@@ -1,7 +1,7 @@
1
1
  import { shallowRef, reactive, ref } from 'vue';
2
- import type { DevTool } from '../../../type';
2
+ import type { DevTool } from '../../../../../type';
3
3
 
4
- import { hightLight } from '../../../utils/index';
4
+ import { hightLight } from '../../../../../utils/index';
5
5
  import { calcLineStartAndEnd, calcNetworkTimeline } from './dataUtils';
6
6
 
7
7
  export function useDevToolData(props: any) {
@@ -39,6 +39,22 @@ export function useDevToolData(props: any) {
39
39
  const performanceVisible = shallowRef(false);
40
40
  const performanceShowFps = shallowRef(true);
41
41
  const performanceShowCpu = shallowRef(true);
42
+ const barrageVisible = shallowRef(true);
43
+ const barrageShowWhenOpen = shallowRef(false);
44
+ const barrageMaxTracks = shallowRef(10);
45
+ const barrageTrackHeight = shallowRef(36);
46
+ const barrageStartTop = shallowRef(40);
47
+ const barrageDuration = shallowRef(6);
48
+ const barrageMaxLength = shallowRef(100);
49
+ const barrageTypes = shallowRef([
50
+ 'log',
51
+ 'info',
52
+ 'warn',
53
+ 'error',
54
+ 'network',
55
+ 'transfer',
56
+ 'websocket',
57
+ ]);
42
58
 
43
59
  // 窗口管理状态
44
60
  const isFullScreen = ref(true);
@@ -111,6 +127,31 @@ export function useDevToolData(props: any) {
111
127
  performanceShowFps.value = data.performanceShowFps;
112
128
  if (data.performanceShowCpu !== undefined)
113
129
  performanceShowCpu.value = data.performanceShowCpu;
130
+ if (data.barrageVisible !== undefined)
131
+ barrageVisible.value = data.barrageVisible;
132
+ if (data.barrageShowWhenOpen !== undefined)
133
+ barrageShowWhenOpen.value = data.barrageShowWhenOpen;
134
+ if (data.barrageMaxTracks !== undefined)
135
+ barrageMaxTracks.value = data.barrageMaxTracks;
136
+ if (data.barrageTrackHeight !== undefined)
137
+ barrageTrackHeight.value = data.barrageTrackHeight;
138
+ if (data.barrageStartTop !== undefined)
139
+ barrageStartTop.value = data.barrageStartTop;
140
+ if (data.barrageDuration !== undefined)
141
+ barrageDuration.value = data.barrageDuration;
142
+ if (data.barrageMaxLength !== undefined)
143
+ barrageMaxLength.value = data.barrageMaxLength;
144
+ if (data.barrageTypes !== undefined) {
145
+ if (Array.isArray(data.barrageTypes)) {
146
+ barrageTypes.value = data.barrageTypes;
147
+ } else {
148
+ // 如果收到了非数组(如诡异的循环引用字符串),打印个警告并忽略
149
+ console.warn(
150
+ '[DevTool] Received invalid barrageTypes:',
151
+ data.barrageTypes,
152
+ );
153
+ }
154
+ }
114
155
 
115
156
  if (data.consoleList) {
116
157
  consoleList.value = [...(data.consoleList ?? [])]
@@ -135,13 +176,13 @@ export function useDevToolData(props: any) {
135
176
  ?.map((item) => {
136
177
  return {
137
178
  ...item,
138
- position: hightLight(item.position, searchConsole.value),
139
- stack: hightLight(item.stack, searchConsole.value),
179
+ _positionHtml: hightLight(item.position, searchConsole.value),
180
+ _stackHtml: hightLight(item.stack, searchConsole.value),
140
181
  args: item.args.map((arg) => {
141
182
  if (arg.type === 'string') {
142
183
  return {
143
- type: 'string',
144
- value: hightLight(arg.value, searchConsole.value),
184
+ ...arg,
185
+ _valueHtml: hightLight(arg.value, searchConsole.value),
145
186
  };
146
187
  }
147
188
  return arg;
@@ -310,6 +351,14 @@ export function useDevToolData(props: any) {
310
351
  performanceVisible,
311
352
  performanceShowFps,
312
353
  performanceShowCpu,
354
+ barrageVisible,
355
+ barrageShowWhenOpen,
356
+ barrageMaxTracks,
357
+ barrageTrackHeight,
358
+ barrageStartTop,
359
+ barrageDuration,
360
+ barrageMaxLength,
361
+ barrageTypes,
313
362
  backup,
314
363
  buildInfo,
315
364
  currentConsoleType,