vite-uni-dev-tool 1.0.0 → 1.1.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.
- package/README.md +46 -0
- package/dist/const.cjs +1 -1
- package/dist/const.d.ts +12 -0
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +1 -1
- package/dist/core-shared.d.ts +1 -1
- package/dist/core-shared.d.ts.map +1 -1
- package/dist/core-shared.js +1 -1
- package/dist/core.d.ts +10 -3
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +2 -2
- package/dist/i18n/locales/en.cjs +1 -1
- package/dist/i18n/locales/en.d.ts +81 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/zh-Hans.cjs +1 -1
- package/dist/i18n/locales/zh-Hans.d.ts +82 -1
- package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
- package/dist/i18n/locales/zh-Hans.js +1 -1
- package/dist/modules/devConsole/index.cjs +1 -1
- package/dist/modules/devConsole/index.js +3 -3
- package/dist/modules/devEvent/index.cjs +3 -3
- package/dist/modules/devEvent/index.d.ts +1 -0
- package/dist/modules/devEvent/index.d.ts.map +1 -1
- package/dist/modules/devEvent/index.js +3 -3
- package/dist/modules/devIntercept/index.cjs +14 -13
- package/dist/modules/devIntercept/index.d.ts +19 -0
- package/dist/modules/devIntercept/index.d.ts.map +1 -1
- package/dist/modules/devIntercept/index.js +14 -13
- package/dist/modules/devStore/index.cjs +1 -1
- package/dist/modules/devStore/index.d.ts +21 -0
- package/dist/modules/devStore/index.d.ts.map +1 -1
- package/dist/modules/devStore/index.js +1 -1
- package/dist/plugins/uniDevTool/transform/transformMain.cjs +1 -1
- package/dist/plugins/uniDevTool/transform/transformMain.js +1 -1
- package/dist/type.d.ts +47 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/utils/language.cjs +1 -1
- package/dist/utils/language.d.ts.map +1 -1
- package/dist/utils/language.js +1 -1
- package/dist/utils/object.cjs +1 -1
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +1 -1
- package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -0
- package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -0
- package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -0
- package/dist/v3/{CaptureScreen → DevTool/components/CaptureScreen}/index.vue +109 -109
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/ConsoleItem.vue +225 -224
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/RunJSInput.vue +247 -249
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/index.vue +171 -160
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/staticTips.ts +1145 -1145
- package/dist/v3/{DevToolButton → DevTool/components/DevToolButton}/index.vue +7 -4
- package/dist/v3/{DevToolTitle → DevTool/components/DevToolTitle}/index.vue +24 -24
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/DevToolOverlay.vue +197 -182
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/const.ts +28 -5
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/dataUtils.ts +48 -48
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolData.ts +387 -338
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolHandlers.ts +629 -549
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolOverlay.ts +197 -184
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.vue +67 -16
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/ElEventItem.vue +105 -105
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/index.vue +106 -109
- package/dist/v3/{Instance → DevTool/components/Instance}/components/InstanceTreeNode.vue +265 -265
- package/dist/v3/{Instance → DevTool/components/Instance}/flatten.ts +226 -226
- package/dist/v3/{Instance → DevTool/components/Instance}/index.vue +94 -94
- package/dist/v3/{Instance → DevTool/components/Instance}/registry.ts +49 -49
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTree.ts +375 -375
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTreeCtx.ts +268 -268
- package/dist/v3/{Instance → DevTool/components/Instance}/typing.d.ts +43 -43
- package/dist/v3/{InstanceDetail → DevTool/components/InstanceDetail}/index.vue +485 -485
- package/dist/v3/{JsonDetail → DevTool/components/JsonDetail}/index.vue +70 -70
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCItem.vue +112 -113
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCTool.vue +454 -478
- package/dist/v3/{NFCList → DevTool/components/NFCList}/const.ts +56 -56
- package/dist/v3/{NFCList → DevTool/components/NFCList}/index.vue +94 -98
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptConfig.vue +624 -608
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptItem.vue +140 -140
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkDetail.vue +287 -296
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkIntercept.vue +88 -93
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkItem.vue +163 -167
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkSend.vue +589 -556
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/const.ts +4 -4
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/hooks/useNetworkForm.ts +86 -86
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/index.vue +160 -160
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/utils.ts +101 -101
- package/dist/v3/{Performance → DevTool/components/Performance}/index.vue +498 -495
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceMetrics.vue +153 -153
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceWidget.vue +12 -9
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceChart.ts +460 -460
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceData.ts +258 -258
- package/dist/v3/{PiniaList → DevTool/components/PiniaList}/index.vue +93 -94
- package/dist/v3/{RouteList → DevTool/components/RouteList}/index.vue +21 -24
- package/dist/v3/{RunJS → DevTool/components/RunJS}/index.vue +148 -148
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/ScanCodeItem.vue +97 -98
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/index.vue +100 -104
- package/dist/v3/{SettingButton → DevTool/components/SettingButton}/index.vue +45 -45
- package/dist/v3/{SettingList → DevTool/components/SettingList}/index.vue +218 -150
- package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -0
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingDevTool.vue +212 -208
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingInfo.vue +157 -119
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLanguage.vue +74 -74
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLog.vue +230 -230
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingNetwork.vue +3 -3
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingTheme.vue +37 -7
- package/dist/v3/{SettingList → DevTool/components/SettingList}/typing.d.ts +2 -2
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/Line.vue +127 -116
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/index.vue +8 -8
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/parseCode.ts +609 -701
- package/dist/v3/{StorageList → DevTool/components/StorageList}/index.vue +174 -174
- package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferDetail.vue +268 -268
- package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferItem.vue +4 -4
- package/dist/v3/{TransferList → DevTool/components/TransferList}/index.vue +8 -8
- package/dist/v3/{UniEvent → DevTool/components/UniEvent}/UniEventItem.vue +6 -7
- package/dist/v3/{UniEvent → DevTool/components/UniEvent}/index.vue +6 -6
- package/dist/v3/{VuexList → DevTool/components/VuexList}/index.vue +84 -84
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketDetail.vue +8 -8
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketItem.vue +4 -4
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/index.vue +8 -8
- package/dist/v3/DevTool/index.vue +179 -5
- package/dist/v3/{AppTransition → components/AppTransition}/index.vue +176 -170
- package/dist/v3/{AutoSizer → components/AutoSizer}/index.vue +192 -192
- package/dist/v3/{AutoSizer → components/AutoSizer}/index1.vue +184 -184
- package/dist/v3/{AutoSizer → components/AutoSizer}/utils.ts +49 -49
- package/dist/v3/components/Barrage/BarrageItem.vue +137 -0
- package/dist/v3/components/Barrage/index.vue +202 -0
- package/dist/v3/{CircularButton → components/CircularButton}/index.vue +84 -84
- package/dist/v3/{CustomSwiper → components/CustomSwiper}/CustomSwiperItem.vue +49 -49
- package/dist/v3/{CustomSwiper → components/CustomSwiper}/index.vue +104 -104
- package/dist/v3/{DraggableContainer → components/DraggableContainer}/index.vue +1 -1
- package/dist/v3/{Empty → components/Empty}/index.vue +29 -29
- package/dist/v3/{FilterInput → components/FilterInput}/index.vue +1 -1
- package/dist/v3/{FilterSelect → components/FilterSelect}/index.vue +179 -179
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/Brackets/index.vue +27 -27
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/Carets/index.vue +59 -59
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/CheckController/index.vue +136 -136
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/TreeNode/index.vue +387 -381
- package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useClipboard.ts +21 -21
- package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useError.ts +21 -21
- package/dist/v3/{JsonPretty → components/JsonPretty}/index.vue +16 -13
- package/dist/v3/{JsonPretty → components/JsonPretty}/type.ts +127 -126
- package/dist/v3/{JsonPretty → components/JsonPretty}/utils/index.ts +169 -169
- package/dist/v3/{MovableContainer → components/MovableContainer}/index.vue +1 -1
- package/dist/v3/{Pick → components/Pick}/index.vue +322 -322
- package/dist/v3/{Tabs → components/Tabs}/index.vue +30 -4
- package/dist/v3/{Tag → components/Tag}/index.vue +113 -113
- package/dist/v3/{VirtualList → components/VirtualList}/AutoSize.vue +40 -40
- package/dist/v3/{VirtualList → components/VirtualList}/index.vue +416 -412
- package/dist/v3/hooks/useBluetooth/index.ts +561 -0
- package/dist/v3/hooks/useContainerStyle.ts +153 -153
- package/dist/v3/hooks/useNFC/index.ts +107 -107
- package/dist/v3/hooks/useNFC/typing.d.ts +396 -396
- package/dist/v3/hooks/useNFC/useNFCAndroid.ts +966 -966
- package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +812 -812
- package/dist/v3/hooks/useNFC/utils.ts +754 -754
- package/dist/v3/hooks/useRequest/index.ts +586 -573
- package/dist/v3/hooks/useRequest/utils.ts +267 -267
- package/dist/v3/hooks/useScanCode/index.ts +206 -206
- package/dist/v3/hooks/useWebsocket/README.md +79 -0
- package/dist/v3/hooks/useWebsocket/index.ts +253 -0
- package/dist/v3/styles/theme.css +17 -10
- package/dist/v3/styles/theme.ts +12 -12
- package/package.json +59 -64
- package/dist/plugins/uniParseStock/index.d.ts +0 -10
- package/dist/plugins/uniParseStock/index.d.ts.map +0 -1
- /package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.css +0 -0
- /package/dist/v3/{SettingList → DevTool/components/SettingList}/index.css +0 -0
- /package/dist/v3/{Empty → components/Empty}/empty.png +0 -0
- /package/dist/v3/{VirtualList → components/VirtualList}/readme.md +0 -0
package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolHandlers.ts
RENAMED
|
@@ -1,549 +1,629 @@
|
|
|
1
|
-
import { debounce } from '
|
|
2
|
-
import { setDevToolInfo } from '
|
|
3
|
-
import type { DevTool } from '
|
|
4
|
-
import { CMD_TYPE, MSG_TYPE, DEV_CORE_MESSAGE } from '
|
|
5
|
-
import { hightLight } from '
|
|
6
|
-
|
|
7
|
-
export function useDevToolHandlers(props: any, emits: any, state: any) {
|
|
8
|
-
const {
|
|
9
|
-
activeTab,
|
|
10
|
-
currentConsoleType,
|
|
11
|
-
currentNetworkType,
|
|
12
|
-
currentWebSocketType,
|
|
13
|
-
currentTransferType,
|
|
14
|
-
currentTransferCategory,
|
|
15
|
-
tabScrollLeft,
|
|
16
|
-
cacheInterceptConfig,
|
|
17
|
-
useTransition,
|
|
18
|
-
baseFontSize,
|
|
19
|
-
tagFontSize,
|
|
20
|
-
tipsFontSize,
|
|
21
|
-
fontFamily,
|
|
22
|
-
fontWeight,
|
|
23
|
-
cacheNetworkLog,
|
|
24
|
-
cacheConsoleLog,
|
|
25
|
-
interceptNetworkList,
|
|
26
|
-
consoleList,
|
|
27
|
-
networkList,
|
|
28
|
-
transferList,
|
|
29
|
-
wsList,
|
|
30
|
-
storageList,
|
|
31
|
-
elEventList,
|
|
32
|
-
uniEventList,
|
|
33
|
-
eventCount,
|
|
34
|
-
screenList,
|
|
35
|
-
scanCodeList,
|
|
36
|
-
nfcList,
|
|
37
|
-
routeList,
|
|
38
|
-
backup,
|
|
39
|
-
searchConsole,
|
|
40
|
-
theme,
|
|
41
|
-
currentNetworkSort,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
consoleList
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
item
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
networkList
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
filterTransferList();
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
wsList
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
.filter((item: any) =>
|
|
251
|
-
|
|
252
|
-
return
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
basicSendMessage({ type: CMD_TYPE.
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
basicSendMessage({ type: CMD_TYPE.
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
function
|
|
344
|
-
basicSendMessage({ type: CMD_TYPE.
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
function
|
|
348
|
-
basicSendMessage({ type: CMD_TYPE.
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function
|
|
352
|
-
basicSendMessage({ type: CMD_TYPE.
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
function
|
|
356
|
-
basicSendMessage({ type:
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function
|
|
360
|
-
basicSendMessage({ type:
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
function
|
|
364
|
-
basicSendMessage({ type: CMD_TYPE.
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
function
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
basicSendMessage({ type: CMD_TYPE.
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
1
|
+
import { debounce } from '../../../../../utils/index';
|
|
2
|
+
import { setDevToolInfo } from '../../../../../modules/devToolInfo';
|
|
3
|
+
import type { DevTool } from '../../../../../type';
|
|
4
|
+
import { CMD_TYPE, MSG_TYPE, DEV_CORE_MESSAGE } from '../../../../../const';
|
|
5
|
+
import { hightLight } from '../../../../../utils/index';
|
|
6
|
+
|
|
7
|
+
export function useDevToolHandlers(props: any, emits: any, state: any) {
|
|
8
|
+
const {
|
|
9
|
+
activeTab,
|
|
10
|
+
currentConsoleType,
|
|
11
|
+
currentNetworkType,
|
|
12
|
+
currentWebSocketType,
|
|
13
|
+
currentTransferType,
|
|
14
|
+
currentTransferCategory,
|
|
15
|
+
tabScrollLeft,
|
|
16
|
+
cacheInterceptConfig,
|
|
17
|
+
useTransition,
|
|
18
|
+
baseFontSize,
|
|
19
|
+
tagFontSize,
|
|
20
|
+
tipsFontSize,
|
|
21
|
+
fontFamily,
|
|
22
|
+
fontWeight,
|
|
23
|
+
cacheNetworkLog,
|
|
24
|
+
cacheConsoleLog,
|
|
25
|
+
interceptNetworkList,
|
|
26
|
+
consoleList,
|
|
27
|
+
networkList,
|
|
28
|
+
transferList,
|
|
29
|
+
wsList,
|
|
30
|
+
storageList,
|
|
31
|
+
elEventList,
|
|
32
|
+
uniEventList,
|
|
33
|
+
eventCount,
|
|
34
|
+
screenList,
|
|
35
|
+
scanCodeList,
|
|
36
|
+
nfcList,
|
|
37
|
+
routeList,
|
|
38
|
+
backup,
|
|
39
|
+
searchConsole,
|
|
40
|
+
theme,
|
|
41
|
+
currentNetworkSort,
|
|
42
|
+
barrageVisible,
|
|
43
|
+
barrageShowWhenOpen,
|
|
44
|
+
} = state;
|
|
45
|
+
|
|
46
|
+
/** 发送消息给核心模块 */
|
|
47
|
+
function basicSendMessage(message: {
|
|
48
|
+
type: string;
|
|
49
|
+
data: Record<string, any>;
|
|
50
|
+
}) {
|
|
51
|
+
emits('sendMessage', message);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function setWindowInfo() {
|
|
55
|
+
setDevToolInfo({
|
|
56
|
+
activeTab: activeTab.value,
|
|
57
|
+
currentConsoleType: currentConsoleType.value,
|
|
58
|
+
currentNetworkType: currentNetworkType.value,
|
|
59
|
+
currentWebSocketType: currentWebSocketType.value,
|
|
60
|
+
theme: theme.value,
|
|
61
|
+
tabScrollLeft: tabScrollLeft.value,
|
|
62
|
+
cacheInterceptConfig: cacheInterceptConfig.value,
|
|
63
|
+
cacheNetworkLog: cacheNetworkLog.value,
|
|
64
|
+
cacheConsoleLog: cacheConsoleLog.value,
|
|
65
|
+
useTransition: useTransition.value,
|
|
66
|
+
baseFontSize: baseFontSize.value,
|
|
67
|
+
tagFontSize: tagFontSize.value,
|
|
68
|
+
tipsFontSize: tipsFontSize.value,
|
|
69
|
+
fontFamily: fontFamily.value,
|
|
70
|
+
fontWeight: fontWeight.value,
|
|
71
|
+
interceptNetworkList: interceptNetworkList.value,
|
|
72
|
+
performanceShowFps: state.performanceShowFps.value,
|
|
73
|
+
performanceShowCpu: state.performanceShowCpu.value,
|
|
74
|
+
barrageVisible: barrageVisible.value,
|
|
75
|
+
barrageShowWhenOpen: barrageShowWhenOpen.value,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const debounceSetWindowInfo = debounce(setWindowInfo, 200);
|
|
80
|
+
|
|
81
|
+
function onCloseWindow() {
|
|
82
|
+
emits('close');
|
|
83
|
+
setWindowInfo();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function onChangeTabs(index: number) {
|
|
87
|
+
activeTab.value = index;
|
|
88
|
+
setWindowInfo();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function onScrollTabs(e: any) {
|
|
92
|
+
tabScrollLeft.value = e.detail.scrollLeft;
|
|
93
|
+
debounceSetWindowInfo();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const debounceScrollTabs = debounce(onScrollTabs, 200);
|
|
97
|
+
|
|
98
|
+
function onConsoleChoose(type: string) {
|
|
99
|
+
if (type === 'clear') {
|
|
100
|
+
consoleList.value = [];
|
|
101
|
+
backup.consoleList = [];
|
|
102
|
+
basicSendMessage({ type: CMD_TYPE.CONSOLE_CLEAR, data: {} });
|
|
103
|
+
} else if (type === 'all') {
|
|
104
|
+
currentConsoleType.value = type;
|
|
105
|
+
consoleList.value = backup.consoleList;
|
|
106
|
+
} else {
|
|
107
|
+
currentConsoleType.value = type;
|
|
108
|
+
consoleList.value = backup.consoleList.filter(
|
|
109
|
+
(item: any) => item.type === type,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
setWindowInfo();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function onRunJS(code: string) {
|
|
116
|
+
basicSendMessage({ type: CMD_TYPE.RUN_JS, data: { code } });
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function onSearchConsole(value: string) {
|
|
120
|
+
consoleList.value = backup.consoleList
|
|
121
|
+
.filter((item: any) => {
|
|
122
|
+
return (
|
|
123
|
+
item.args.some(
|
|
124
|
+
(arg: any) => arg.type === 'string' && arg.value.includes(value),
|
|
125
|
+
) ||
|
|
126
|
+
item.position.includes(value) ||
|
|
127
|
+
item?.stack?.includes(value)
|
|
128
|
+
);
|
|
129
|
+
})
|
|
130
|
+
?.map((item: any) => {
|
|
131
|
+
return {
|
|
132
|
+
...item,
|
|
133
|
+
position: hightLight(item.position, searchConsole.value),
|
|
134
|
+
stack: hightLight(item.stack, searchConsole.value),
|
|
135
|
+
args: item.args.map((arg: any) => {
|
|
136
|
+
if (arg.type === 'string') {
|
|
137
|
+
return { type: 'string', value: hightLight(arg.value, value) };
|
|
138
|
+
}
|
|
139
|
+
return arg;
|
|
140
|
+
}),
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function onNetworkChoose(type: string) {
|
|
146
|
+
if (type === 'clear') {
|
|
147
|
+
networkList.value = [];
|
|
148
|
+
backup.networkList = [];
|
|
149
|
+
basicSendMessage({ type: CMD_TYPE.NETWORK_CLEAR, data: {} });
|
|
150
|
+
} else if (type === 'all') {
|
|
151
|
+
currentNetworkType.value = type;
|
|
152
|
+
networkList.value = backup.networkList;
|
|
153
|
+
} else if (type === 'error') {
|
|
154
|
+
currentNetworkType.value = type;
|
|
155
|
+
networkList.value = backup.networkList.filter((item: any) => {
|
|
156
|
+
return item.status === 'error' || /[4,5]\d{2,}/.test(item.status + '');
|
|
157
|
+
});
|
|
158
|
+
} else {
|
|
159
|
+
currentNetworkType.value = type;
|
|
160
|
+
networkList.value = backup.networkList.filter(
|
|
161
|
+
(item: any) => item.method === type,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
setWindowInfo();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function onSearchNetwork(value: string) {
|
|
168
|
+
networkList.value = backup.networkList
|
|
169
|
+
.filter((item: any) => {
|
|
170
|
+
if (currentNetworkType.value === 'all') return item;
|
|
171
|
+
return item.method === currentNetworkType.value;
|
|
172
|
+
})
|
|
173
|
+
?.filter((item: any) => item?.url?.includes(value))
|
|
174
|
+
?.map((item: any) => {
|
|
175
|
+
return { ...item, url: hightLight(item.url, value) };
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function onSortNetwork(sort: -1 | 1) {
|
|
180
|
+
currentNetworkSort.value = sort;
|
|
181
|
+
const list = networkList.value.sort((a: any, b: any) => {
|
|
182
|
+
return sort === 1 ? b.startTime - a.startTime : a.startTime - b.startTime;
|
|
183
|
+
});
|
|
184
|
+
networkList.value = [...list];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function filterTransferList() {
|
|
188
|
+
transferList.value = backup.transferList.filter((item: any) => {
|
|
189
|
+
const typeMatch =
|
|
190
|
+
currentTransferCategory.value === 'all' ||
|
|
191
|
+
item.type === currentTransferCategory.value;
|
|
192
|
+
let statusMatch =
|
|
193
|
+
currentTransferType.value === 'all' ||
|
|
194
|
+
item.status === currentTransferType.value;
|
|
195
|
+
|
|
196
|
+
if (currentTransferType.value === 'pending') {
|
|
197
|
+
statusMatch = ['pending', 'uploading', 'downloading'].includes(
|
|
198
|
+
item.status,
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return typeMatch && statusMatch;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function onTransferChoose(type: string) {
|
|
207
|
+
if (type === 'clear') {
|
|
208
|
+
transferList.value = [];
|
|
209
|
+
backup.transferList = [];
|
|
210
|
+
basicSendMessage({ type: CMD_TYPE.TRANSFER_CLEAR, data: {} });
|
|
211
|
+
} else {
|
|
212
|
+
currentTransferType.value = type;
|
|
213
|
+
filterTransferList();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function onTransferCategoryChoose(category: string) {
|
|
218
|
+
currentTransferCategory.value = category;
|
|
219
|
+
filterTransferList();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function onSearchTransfer(value: string) {
|
|
223
|
+
filterTransferList(); // Reset list based on filters first
|
|
224
|
+
transferList.value = transferList.value
|
|
225
|
+
.filter((item: any) => item.url?.includes(value))
|
|
226
|
+
?.map((item: any) => {
|
|
227
|
+
return { ...item, url: hightLight(item.url, value) };
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function onWebSocketChoose(type: string) {
|
|
232
|
+
if (type === 'clear') {
|
|
233
|
+
wsList.value = [];
|
|
234
|
+
backup.wsList = [];
|
|
235
|
+
basicSendMessage({ type: CMD_TYPE.WS_CLEAR, data: {} });
|
|
236
|
+
} else if (type === 'all') {
|
|
237
|
+
currentWebSocketType.value = type;
|
|
238
|
+
wsList.value = backup.wsList;
|
|
239
|
+
} else {
|
|
240
|
+
currentWebSocketType.value = type;
|
|
241
|
+
wsList.value = backup.wsList.filter(
|
|
242
|
+
(item: any) => item.readyState === type,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
setWindowInfo();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function onSearchWs(value: string) {
|
|
249
|
+
wsList.value = backup.wsList
|
|
250
|
+
.filter((item: any) => {
|
|
251
|
+
if (currentWebSocketType.value === 'all') return item;
|
|
252
|
+
return item.readyState === currentWebSocketType.value;
|
|
253
|
+
})
|
|
254
|
+
.filter((item: any) => item.url.includes(value))
|
|
255
|
+
?.map((item: any) => {
|
|
256
|
+
return { ...item, url: hightLight(item.url, value) };
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function onStorageChoose(type: string) {
|
|
261
|
+
if (type === 'clear') {
|
|
262
|
+
backup.storageList = [];
|
|
263
|
+
storageList.value = [];
|
|
264
|
+
basicSendMessage({ type: CMD_TYPE.STORAGE_CLEAR, data: {} });
|
|
265
|
+
} else if (type === 'refresh') {
|
|
266
|
+
basicSendMessage({ type: CMD_TYPE.STORAGE_REFRESH, data: {} });
|
|
267
|
+
} else if (type === 'add') {
|
|
268
|
+
const key = '_new_' + Date.now();
|
|
269
|
+
const newItem = { key, _oldKey: key, value: JSON.stringify('') };
|
|
270
|
+
backup.storageList.unshift(newItem);
|
|
271
|
+
storageList.value.unshift(newItem);
|
|
272
|
+
basicSendMessage({
|
|
273
|
+
type: CMD_TYPE.STORAGE_ADD,
|
|
274
|
+
data: { key, value: newItem.value },
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function onStorageRemove(key: string) {
|
|
280
|
+
backup.storageList = backup.storageList.filter(
|
|
281
|
+
(item: any) => item.key !== key,
|
|
282
|
+
);
|
|
283
|
+
storageList.value = backup.storageList;
|
|
284
|
+
basicSendMessage({ type: CMD_TYPE.STORAGE_REMOVE, data: { key } });
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function onChangeStorage(data: DevTool.StorageItem) {
|
|
288
|
+
basicSendMessage({ type: CMD_TYPE.STORAGE_UPDATE, data });
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function onSearchStorage(value: string) {
|
|
292
|
+
storageList.value = backup.storageList
|
|
293
|
+
.filter((item: any) => item._oldKey.includes(value))
|
|
294
|
+
?.map((item: any) => {
|
|
295
|
+
return { ...item, _oldKey: hightLight(item._oldKey, value) };
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function onElEventClear() {
|
|
300
|
+
elEventList.value = [];
|
|
301
|
+
basicSendMessage({ type: CMD_TYPE.EL_EVENT_CLEAR, data: {} });
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function onUniEventClear() {
|
|
305
|
+
uniEventList.value = [];
|
|
306
|
+
eventCount.value = { on: 0, once: 0, emit: 0, off: 0 };
|
|
307
|
+
basicSendMessage({ type: CMD_TYPE.UNI_EVENT_CLEAR, data: {} });
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function onCaptureScreenClear() {
|
|
311
|
+
screenList.value = [];
|
|
312
|
+
basicSendMessage({ type: CMD_TYPE.SCREEN_CLEAR, data: {} });
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function onScanCodeListClear() {
|
|
316
|
+
scanCodeList.value = [];
|
|
317
|
+
basicSendMessage({ type: CMD_TYPE.SCAN_CODE_CLEAR, data: {} });
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function onNfcClear() {
|
|
321
|
+
nfcList.value = [];
|
|
322
|
+
basicSendMessage({ type: CMD_TYPE.NFC_CLEAR, data: {} });
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function onRouteRefresh() {
|
|
326
|
+
basicSendMessage({ type: CMD_TYPE.ROUTE_REFRESH, data: {} });
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function onSearchRoute(value: string) {
|
|
330
|
+
routeList.value = backup.routeList
|
|
331
|
+
?.filter(
|
|
332
|
+
(item: any) => item.path.includes(value) || item.name?.includes(value),
|
|
333
|
+
)
|
|
334
|
+
?.map((item: any) => {
|
|
335
|
+
return {
|
|
336
|
+
...item,
|
|
337
|
+
name: hightLight(item.name, value),
|
|
338
|
+
path: hightLight(item.path, value),
|
|
339
|
+
};
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function onShowDevButton(show: boolean) {
|
|
344
|
+
basicSendMessage({ type: CMD_TYPE.BUTTON_TOGGLE, data: { show } });
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function onRestartDevTool() {
|
|
348
|
+
basicSendMessage({ type: CMD_TYPE.RESTART_DEBUGGER, data: {} });
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function onRestartApp() {
|
|
352
|
+
basicSendMessage({ type: CMD_TYPE.RESTART_APP, data: {} });
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function onExportLog(exports: any) {
|
|
356
|
+
basicSendMessage({ type: CMD_TYPE.EXPORT_LOG, data: { ...exports } });
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function onScreenshot() {
|
|
360
|
+
basicSendMessage({ type: 'dev-tool-hide-screenshot', data: {} });
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function onClearCache() {
|
|
364
|
+
basicSendMessage({ type: CMD_TYPE.CACHE_CLEAR, data: {} });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function onDestroyDevTool() {
|
|
368
|
+
basicSendMessage({ type: CMD_TYPE.DESTROY, data: {} });
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function onChangeTheme(t: string) {
|
|
372
|
+
theme.value = t;
|
|
373
|
+
setDevToolInfo({ theme: t });
|
|
374
|
+
emits('changeTheme', t);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function onChangeCacheInterceptConfig(value: boolean) {
|
|
378
|
+
setDevToolInfo({
|
|
379
|
+
cacheInterceptConfig: value,
|
|
380
|
+
interceptNetworkList: value ? interceptNetworkList.value : [],
|
|
381
|
+
});
|
|
382
|
+
basicSendMessage({
|
|
383
|
+
type: CMD_TYPE.SET_CACHE_INTERCEPT,
|
|
384
|
+
data: { cacheInterceptConfig: value },
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function onChangeCacheNetworkLog(value: boolean) {
|
|
389
|
+
setDevToolInfo({
|
|
390
|
+
cacheNetworkLog: value,
|
|
391
|
+
});
|
|
392
|
+
cacheNetworkLog.value = value;
|
|
393
|
+
basicSendMessage({
|
|
394
|
+
type: CMD_TYPE.SET_CACHE_NETWORK_LOG,
|
|
395
|
+
data: { cacheNetworkLog: value },
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function onChangeCacheConsoleLog(value: boolean) {
|
|
400
|
+
setDevToolInfo({
|
|
401
|
+
cacheConsoleLog: value,
|
|
402
|
+
});
|
|
403
|
+
cacheConsoleLog.value = value;
|
|
404
|
+
basicSendMessage({
|
|
405
|
+
type: CMD_TYPE.SET_CACHE_CONSOLE_LOG,
|
|
406
|
+
data: { cacheConsoleLog: value },
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function onChangeUseTransition(value: boolean) {
|
|
411
|
+
useTransition.value = value;
|
|
412
|
+
setDevToolInfo({
|
|
413
|
+
useTransition: value,
|
|
414
|
+
});
|
|
415
|
+
basicSendMessage({
|
|
416
|
+
type: CMD_TYPE.SET_TRANSITION,
|
|
417
|
+
data: { useTransition: value },
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function onChangeFontSize(data: {
|
|
422
|
+
baseFontSize: number;
|
|
423
|
+
tagFontSize: number;
|
|
424
|
+
tipsFontSize: number;
|
|
425
|
+
fontFamily: string;
|
|
426
|
+
fontWeight: string;
|
|
427
|
+
}) {
|
|
428
|
+
baseFontSize.value = data.baseFontSize;
|
|
429
|
+
tagFontSize.value = data.tagFontSize;
|
|
430
|
+
tipsFontSize.value = data.tipsFontSize;
|
|
431
|
+
fontFamily.value = data.fontFamily;
|
|
432
|
+
fontWeight.value = data.fontWeight;
|
|
433
|
+
setDevToolInfo(data);
|
|
434
|
+
basicSendMessage({
|
|
435
|
+
type: CMD_TYPE.SET_FONT,
|
|
436
|
+
data,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function onChangePerformance(show: boolean) {
|
|
441
|
+
state.performanceVisible.value = show;
|
|
442
|
+
setDevToolInfo({
|
|
443
|
+
performanceVisible: show,
|
|
444
|
+
});
|
|
445
|
+
uni.$emit(DEV_CORE_MESSAGE, { type: MSG_TYPE.PERF_VISIBLE, data: show });
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function onChangePerformanceShowFps(show: boolean) {
|
|
449
|
+
state.performanceShowFps.value = show;
|
|
450
|
+
setDevToolInfo({
|
|
451
|
+
performanceShowFps: show,
|
|
452
|
+
});
|
|
453
|
+
uni.$emit('DEV_CHANGE_PERFORMANCE_SHOW_FPS', show);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function onChangePerformanceShowCpu(show: boolean) {
|
|
457
|
+
state.performanceShowCpu.value = show;
|
|
458
|
+
setDevToolInfo({
|
|
459
|
+
performanceShowCpu: show,
|
|
460
|
+
});
|
|
461
|
+
uni.$emit('DEV_CHANGE_PERFORMANCE_SHOW_CPU', show);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function onChangeBarrage(show: boolean) {
|
|
465
|
+
state.barrageVisible.value = show;
|
|
466
|
+
setDevToolInfo({
|
|
467
|
+
barrageVisible: show,
|
|
468
|
+
});
|
|
469
|
+
basicSendMessage({ type: CMD_TYPE.BARRAGE_TOGGLE, data: { show } });
|
|
470
|
+
uni.$emit(DEV_CORE_MESSAGE, { type: MSG_TYPE.BARRAGE_VISIBLE, data: show });
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function onChangeVuex(value: any) {
|
|
474
|
+
basicSendMessage({ type: CMD_TYPE.VUEX_CHANGE, data: value });
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function onChangePinia(value: any) {
|
|
478
|
+
basicSendMessage({ type: CMD_TYPE.PINIA_CHANGE, data: value });
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function onClearWebSocketMessage(ws: DevTool.WS) {
|
|
482
|
+
basicSendMessage({ type: CMD_TYPE.WS_CLEAR_MESSAGE, data: ws });
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function onSendWebSocket(data: { url: string; message: any }) {
|
|
486
|
+
basicSendMessage({ type: CMD_TYPE.WS_SEND, data });
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function onConfirmInterceptConfig(ni: DevTool.NetworkItem) {
|
|
490
|
+
const index = interceptNetworkList.value.findIndex((item: any) => {
|
|
491
|
+
const key = `${item.method?.toUpperCase()}|${item.url?.split('?')[0]}`;
|
|
492
|
+
const niKey = `${ni.method?.toUpperCase()}|${ni.url?.split('?')[0]}`;
|
|
493
|
+
return key === niKey;
|
|
494
|
+
});
|
|
495
|
+
const list = [...interceptNetworkList.value];
|
|
496
|
+
if (index > -1) {
|
|
497
|
+
list[index] = ni;
|
|
498
|
+
} else {
|
|
499
|
+
list.unshift(ni);
|
|
500
|
+
}
|
|
501
|
+
setDevToolInfo({
|
|
502
|
+
cacheInterceptConfig: cacheInterceptConfig.value,
|
|
503
|
+
interceptNetworkList: cacheInterceptConfig.value ? list : [],
|
|
504
|
+
});
|
|
505
|
+
basicSendMessage({ type: CMD_TYPE.INTERCEPT_UPDATE, data: [ni] });
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function onRemoveInterceptConfig(ni: DevTool.NetworkItem) {
|
|
509
|
+
basicSendMessage({ type: CMD_TYPE.INTERCEPT_UPDATE, data: ni });
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function onChangeBarrageMaxTracks(val: number) {
|
|
513
|
+
state.barrageMaxTracks.value = val;
|
|
514
|
+
basicSendMessage({
|
|
515
|
+
type: CMD_TYPE.BARRAGE_MAX_TRACKS,
|
|
516
|
+
data: { value: val },
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function onChangeBarrageTrackHeight(val: number) {
|
|
521
|
+
state.barrageTrackHeight.value = val;
|
|
522
|
+
basicSendMessage({
|
|
523
|
+
type: CMD_TYPE.BARRAGE_TRACK_HEIGHT,
|
|
524
|
+
data: { value: val },
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function onChangeBarrageStartTop(val: number) {
|
|
529
|
+
state.barrageStartTop.value = val;
|
|
530
|
+
basicSendMessage({
|
|
531
|
+
type: CMD_TYPE.BARRAGE_START_TOP,
|
|
532
|
+
data: { value: val },
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function onChangeBarrageDuration(val: number) {
|
|
537
|
+
state.barrageDuration.value = val;
|
|
538
|
+
basicSendMessage({
|
|
539
|
+
type: CMD_TYPE.BARRAGE_DURATION,
|
|
540
|
+
data: { value: val },
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function onChangeBarrageMaxLength(val: number) {
|
|
545
|
+
state.barrageMaxLength.value = val;
|
|
546
|
+
basicSendMessage({
|
|
547
|
+
type: CMD_TYPE.BARRAGE_MAX_LENGTH,
|
|
548
|
+
data: { value: val },
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function onChangeBarrageTypes(val: string[]) {
|
|
553
|
+
state.barrageTypes.value = val;
|
|
554
|
+
basicSendMessage({
|
|
555
|
+
type: CMD_TYPE.BARRAGE_TYPES,
|
|
556
|
+
data: { value: val },
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function onChangeBarrageShowWhenOpen(val: boolean) {
|
|
561
|
+
state.barrageShowWhenOpen.value = val;
|
|
562
|
+
setDevToolInfo({
|
|
563
|
+
barrageShowWhenOpen: val,
|
|
564
|
+
});
|
|
565
|
+
basicSendMessage({
|
|
566
|
+
type: CMD_TYPE.SET_BARRAGE_SHOW_WHEN_OPEN,
|
|
567
|
+
data: { value: val },
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return {
|
|
572
|
+
onCloseWindow,
|
|
573
|
+
onChangeTabs,
|
|
574
|
+
debounceScrollTabs,
|
|
575
|
+
onConsoleChoose,
|
|
576
|
+
onRunJS,
|
|
577
|
+
onSearchConsole,
|
|
578
|
+
onNetworkChoose,
|
|
579
|
+
onSearchNetwork,
|
|
580
|
+
onSortNetwork,
|
|
581
|
+
onTransferChoose,
|
|
582
|
+
onTransferCategoryChoose,
|
|
583
|
+
onSearchTransfer,
|
|
584
|
+
onWebSocketChoose,
|
|
585
|
+
onSearchWs,
|
|
586
|
+
onStorageChoose,
|
|
587
|
+
onStorageRemove,
|
|
588
|
+
onChangeStorage,
|
|
589
|
+
onSearchStorage,
|
|
590
|
+
onElEventClear,
|
|
591
|
+
onUniEventClear,
|
|
592
|
+
onCaptureScreenClear,
|
|
593
|
+
onScanCodeListClear,
|
|
594
|
+
onNfcClear,
|
|
595
|
+
onRouteRefresh,
|
|
596
|
+
onSearchRoute,
|
|
597
|
+
onShowDevButton,
|
|
598
|
+
onRestartDevTool,
|
|
599
|
+
onRestartApp,
|
|
600
|
+
onExportLog,
|
|
601
|
+
onScreenshot,
|
|
602
|
+
onClearCache,
|
|
603
|
+
onDestroyDevTool,
|
|
604
|
+
onChangeTheme,
|
|
605
|
+
onChangeCacheInterceptConfig,
|
|
606
|
+
onChangeCacheNetworkLog,
|
|
607
|
+
onChangeCacheConsoleLog,
|
|
608
|
+
onChangeUseTransition,
|
|
609
|
+
onChangeFontSize,
|
|
610
|
+
onChangeVuex,
|
|
611
|
+
onChangePinia,
|
|
612
|
+
onClearWebSocketMessage,
|
|
613
|
+
onSendWebSocket,
|
|
614
|
+
onConfirmInterceptConfig,
|
|
615
|
+
onRemoveInterceptConfig,
|
|
616
|
+
onChangePerformance,
|
|
617
|
+
onChangePerformanceShowFps,
|
|
618
|
+
onChangePerformanceShowCpu,
|
|
619
|
+
onChangeBarrage,
|
|
620
|
+
onChangeBarrageMaxTracks,
|
|
621
|
+
onChangeBarrageTrackHeight,
|
|
622
|
+
onChangeBarrageStartTop,
|
|
623
|
+
onChangeBarrageDuration,
|
|
624
|
+
onChangeBarrageMaxLength,
|
|
625
|
+
onChangeBarrageTypes,
|
|
626
|
+
onChangeBarrageShowWhenOpen,
|
|
627
|
+
basicSendMessage,
|
|
628
|
+
};
|
|
629
|
+
}
|