vite-uni-dev-tool 1.1.0 → 1.2.1
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 +21 -1
- package/dist/const.cjs +1 -1
- package/dist/const.d.ts +2 -1
- package/dist/const.js +1 -1
- package/dist/core-shared.d.ts +2 -3
- package/dist/core.d.ts +8 -8
- package/dist/core.js +2 -2
- package/dist/i18n/index.d.ts +0 -1
- package/dist/i18n/instance.d.ts +0 -1
- package/dist/i18n/locales/en.cjs +1 -1
- package/dist/i18n/locales/en.d.ts +6 -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 +6 -1
- package/dist/i18n/locales/zh-Hans.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/modules/devConsole/index.cjs +4 -4
- package/dist/modules/devConsole/index.d.ts +6 -107
- package/dist/modules/devConsole/index.js +4 -4
- package/dist/modules/devEvent/index.cjs +3 -3
- package/dist/modules/devEvent/index.d.ts +2 -3
- package/dist/modules/devEvent/index.js +3 -3
- package/dist/modules/devIntercept/index.cjs +14 -14
- package/dist/modules/devIntercept/index.d.ts +34 -6
- package/dist/modules/devIntercept/index.js +14 -14
- package/dist/modules/devStore/index.cjs +1 -1
- package/dist/modules/devStore/index.d.ts +48 -40
- package/dist/modules/devStore/index.js +1 -1
- package/dist/modules/devToolInfo/index.cjs +1 -1
- package/dist/modules/devToolInfo/index.d.ts +6 -25
- package/dist/modules/devToolInfo/index.js +1 -1
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts +0 -1
- package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -3
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts +2 -2
- package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
- package/dist/plugins/uniDevTool/transform/transformVue.cjs +31 -25
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +2 -2
- package/dist/plugins/uniDevTool/transform/transformVue.js +30 -24
- package/dist/plugins/uniDevTool/uniDevTool.cjs +3 -3
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -2
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.d.ts +0 -1
- package/dist/plugins/utils/index.d.ts +0 -1
- package/dist/shims-uni.d.ts +26 -22
- package/dist/type.d.ts +47 -43
- package/dist/utils/array.d.ts +0 -1
- package/dist/utils/date.d.ts +0 -1
- package/dist/utils/file.d.ts +0 -1
- package/dist/utils/function.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/ip.d.ts +0 -1
- package/dist/utils/language.d.ts +14 -15
- package/dist/utils/object.cjs +1 -1
- package/dist/utils/object.d.ts +7 -8
- package/dist/utils/object.js +1 -1
- package/dist/utils/openLink.d.ts +0 -1
- package/dist/utils/page.d.ts +0 -1
- package/dist/utils/platform.d.ts +0 -1
- package/dist/utils/string.d.ts +0 -1
- package/dist/utils/utils.d.ts +0 -1
- package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -199
- package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -730
- package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -167
- package/dist/v3/DevTool/components/CaptureScreen/index.vue +109 -109
- package/dist/v3/DevTool/components/ConsoleList/ConsoleItem.vue +230 -225
- package/dist/v3/DevTool/components/ConsoleList/RunJSInput.vue +247 -247
- package/dist/v3/DevTool/components/ConsoleList/index.vue +171 -171
- package/dist/v3/DevTool/components/ConsoleList/staticTips.ts +1145 -1145
- package/dist/v3/DevTool/components/DevToolButton/index.vue +42 -6
- package/dist/v3/DevTool/components/DevToolTitle/index.vue +24 -24
- package/dist/v3/DevTool/components/DevToolWindow/DevToolOverlay.vue +197 -197
- package/dist/v3/DevTool/components/DevToolWindow/hooks/dataUtils.ts +48 -48
- package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolData.ts +411 -387
- package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolHandlers.ts +644 -629
- package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolOverlay.ts +201 -197
- package/dist/v3/DevTool/components/DevToolWindow/index.vue +27 -64
- package/dist/v3/DevTool/components/ElEvent/ElEventItem.vue +105 -105
- package/dist/v3/DevTool/components/ElEvent/index.vue +106 -106
- package/dist/v3/DevTool/components/Instance/components/InstanceTreeNode.vue +265 -265
- package/dist/v3/DevTool/components/Instance/flatten.ts +226 -226
- package/dist/v3/DevTool/components/Instance/index.vue +94 -94
- package/dist/v3/DevTool/components/Instance/registry.ts +49 -49
- package/dist/v3/DevTool/components/Instance/transformTree.ts +393 -375
- package/dist/v3/DevTool/components/Instance/transformTreeCtx.ts +268 -268
- package/dist/v3/DevTool/components/Instance/typing.d.ts +43 -43
- package/dist/v3/DevTool/components/InstanceDetail/index.vue +485 -485
- package/dist/v3/DevTool/components/JsonDetail/index.vue +70 -70
- package/dist/v3/DevTool/components/NFCList/NFCItem.vue +112 -112
- package/dist/v3/DevTool/components/NFCList/NFCTool.vue +454 -454
- package/dist/v3/DevTool/components/NFCList/const.ts +56 -56
- package/dist/v3/DevTool/components/NFCList/index.vue +94 -94
- package/dist/v3/DevTool/components/NetworkList/InterceptConfig.vue +624 -624
- package/dist/v3/DevTool/components/NetworkList/InterceptItem.vue +140 -140
- package/dist/v3/DevTool/components/NetworkList/NetworkDetail.vue +287 -287
- package/dist/v3/DevTool/components/NetworkList/NetworkIntercept.vue +88 -88
- package/dist/v3/DevTool/components/NetworkList/NetworkItem.vue +163 -163
- package/dist/v3/DevTool/components/NetworkList/NetworkSend.vue +589 -589
- package/dist/v3/DevTool/components/NetworkList/const.ts +4 -4
- package/dist/v3/DevTool/components/NetworkList/hooks/useNetworkForm.ts +86 -86
- package/dist/v3/DevTool/components/NetworkList/index.vue +160 -160
- package/dist/v3/DevTool/components/NetworkList/utils.ts +101 -101
- package/dist/v3/DevTool/components/Performance/index.vue +498 -498
- package/dist/v3/DevTool/components/Performance/modules/PerformanceMetrics.vue +153 -153
- package/dist/v3/DevTool/components/Performance/modules/usePerformanceChart.ts +460 -460
- package/dist/v3/DevTool/components/Performance/modules/usePerformanceData.ts +258 -258
- package/dist/v3/DevTool/components/PiniaList/index.vue +93 -93
- package/dist/v3/DevTool/components/RunJS/index.vue +148 -148
- package/dist/v3/DevTool/components/ScanCodeList/ScanCodeItem.vue +97 -97
- package/dist/v3/DevTool/components/ScanCodeList/index.vue +100 -100
- package/dist/v3/DevTool/components/SettingButton/index.vue +45 -45
- package/dist/v3/DevTool/components/SettingList/index.vue +226 -218
- package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +320 -304
- package/dist/v3/DevTool/components/SettingList/modules/SettingDevTool.vue +212 -212
- package/dist/v3/DevTool/components/SettingList/modules/SettingInfo.vue +157 -157
- package/dist/v3/DevTool/components/SettingList/modules/SettingLanguage.vue +74 -74
- package/dist/v3/DevTool/components/SettingList/modules/SettingLog.vue +230 -230
- package/dist/v3/DevTool/components/SettingList/typing.d.ts +2 -2
- package/dist/v3/DevTool/components/SourceCode/Line.vue +127 -127
- package/dist/v3/DevTool/components/SourceCode/parseCode.ts +609 -609
- package/dist/v3/DevTool/components/StorageList/index.vue +174 -174
- package/dist/v3/DevTool/components/TransferList/TransferDetail.vue +268 -268
- package/dist/v3/DevTool/components/VuexList/index.vue +84 -84
- package/dist/v3/DevTool/index.vue +85 -138
- package/dist/v3/components/AppTransition/index.vue +156 -176
- package/dist/v3/components/AutoSizer/index.vue +192 -192
- package/dist/v3/components/AutoSizer/index1.vue +184 -184
- package/dist/v3/components/AutoSizer/utils.ts +49 -49
- package/dist/v3/components/Barrage/BarrageItem.vue +194 -137
- package/dist/v3/components/Barrage/index.vue +205 -202
- package/dist/v3/components/CircularButton/index.vue +84 -84
- package/dist/v3/components/CustomSwiper/CustomSwiperItem.vue +49 -49
- package/dist/v3/components/CustomSwiper/index.vue +104 -104
- package/dist/v3/components/DevErrorBoundary/index.vue +388 -0
- package/dist/v3/components/DraggableContainer/index.vue +186 -73
- package/dist/v3/components/Empty/index.vue +29 -29
- package/dist/v3/components/FilterSelect/index.vue +179 -179
- package/dist/v3/components/JsonPretty/components/Brackets/index.vue +27 -27
- package/dist/v3/components/JsonPretty/components/Carets/index.vue +59 -59
- package/dist/v3/components/JsonPretty/components/CheckController/index.vue +136 -136
- package/dist/v3/components/JsonPretty/components/TreeNode/index.vue +387 -387
- package/dist/v3/components/JsonPretty/hooks/useClipboard.ts +21 -21
- package/dist/v3/components/JsonPretty/hooks/useError.ts +21 -21
- package/dist/v3/components/JsonPretty/type.ts +127 -127
- package/dist/v3/components/JsonPretty/utils/index.ts +169 -169
- package/dist/v3/components/MovableContainer/index.vue +10 -4
- package/dist/v3/components/Pick/index.vue +321 -322
- package/dist/v3/components/Tag/index.vue +113 -113
- package/dist/v3/components/VirtualList/AutoSize.vue +40 -40
- package/dist/v3/components/VirtualList/index.vue +416 -416
- package/dist/v3/hooks/useBluetooth/index.ts +561 -561
- package/dist/v3/hooks/useContainerStyle.ts +95 -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 -586
- package/dist/v3/hooks/useRequest/utils.ts +267 -267
- package/dist/v3/hooks/useScanCode/index.ts +206 -206
- package/dist/v3/hooks/useWebsocket/index.ts +253 -253
- package/dist/v3/styles/theme.ts +12 -12
- package/package.json +70 -59
- package/dist/const.d.ts.map +0 -1
- package/dist/core-shared.d.ts.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/instance.d.ts.map +0 -1
- package/dist/i18n/locales/en.d.ts.map +0 -1
- package/dist/i18n/locales/zh-Hans.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/modules/devConsole/index.d.ts.map +0 -1
- package/dist/modules/devEvent/index.d.ts.map +0 -1
- package/dist/modules/devIntercept/index.d.ts.map +0 -1
- package/dist/modules/devStore/index.d.ts.map +0 -1
- package/dist/modules/devToolInfo/index.d.ts.map +0 -1
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +0 -1
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +0 -1
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +0 -1
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +0 -1
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +0 -1
- package/dist/plugins/utils/index.d.ts.map +0 -1
- package/dist/type.d.ts.map +0 -1
- package/dist/utils/array.d.ts.map +0 -1
- package/dist/utils/date.d.ts.map +0 -1
- package/dist/utils/file.d.ts.map +0 -1
- package/dist/utils/function.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/ip.d.ts.map +0 -1
- package/dist/utils/language.d.ts.map +0 -1
- package/dist/utils/object.d.ts.map +0 -1
- package/dist/utils/openLink.d.ts.map +0 -1
- package/dist/utils/page.d.ts.map +0 -1
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/utils.d.ts.map +0 -1
|
@@ -1,197 +1,201 @@
|
|
|
1
|
-
import { ref, reactive, shallowRef, nextTick } from 'vue';
|
|
2
|
-
import type { DevTool } from '../../../../../type';
|
|
3
|
-
import { isMockWX, isAndroid } from '../../../../../utils/index';
|
|
4
|
-
import { emptyNetwork } from '../const';
|
|
5
|
-
|
|
6
|
-
export function useDevToolOverlay(props: any) {
|
|
7
|
-
const openCode = ref(false);
|
|
8
|
-
const stack = ref('');
|
|
9
|
-
const showNetworkSend = ref(false);
|
|
10
|
-
const showNetworkDetail = ref(false);
|
|
11
|
-
const showNetworkIntercept = ref(false);
|
|
12
|
-
const showInterceptConfig = ref(false);
|
|
13
|
-
const showJsonDetail = ref(false);
|
|
14
|
-
const jsonData = shallowRef<
|
|
15
|
-
{ title?: string; data: Record<string, any> } | undefined
|
|
16
|
-
>();
|
|
17
|
-
const showNfcTool = ref(false);
|
|
18
|
-
const showTransferDetail = ref(false);
|
|
19
|
-
const showWebSocketDetail = ref(false);
|
|
20
|
-
const showBluetoothTool = ref(false);
|
|
21
|
-
const bluetoothDevice = shallowRef<DevTool.BluetoothItem | null>(null);
|
|
22
|
-
|
|
23
|
-
const network = reactive<DevTool.NetworkItem>({ ...emptyNetwork });
|
|
24
|
-
const transfer = reactive<DevTool.TransferItem>({
|
|
25
|
-
index: 0,
|
|
26
|
-
status: '',
|
|
27
|
-
type: 'upload',
|
|
28
|
-
});
|
|
29
|
-
const webSocket = reactive<DevTool.WS>({ url: '', message: [] });
|
|
30
|
-
|
|
31
|
-
function onCloseCode() {
|
|
32
|
-
openCode.value = false;
|
|
33
|
-
stack.value = '';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function onOpenCode(value?: string) {
|
|
37
|
-
if (!value) return;
|
|
38
|
-
stack.value = value;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
function
|
|
70
|
-
showJsonDetail.value =
|
|
71
|
-
jsonData.value =
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
1
|
+
import { ref, reactive, shallowRef, nextTick } from 'vue';
|
|
2
|
+
import type { DevTool } from '../../../../../type';
|
|
3
|
+
import { isMockWX, isAndroid } from '../../../../../utils/index';
|
|
4
|
+
import { emptyNetwork } from '../const';
|
|
5
|
+
|
|
6
|
+
export function useDevToolOverlay(props: any) {
|
|
7
|
+
const openCode = ref(false);
|
|
8
|
+
const stack = ref('');
|
|
9
|
+
const showNetworkSend = ref(false);
|
|
10
|
+
const showNetworkDetail = ref(false);
|
|
11
|
+
const showNetworkIntercept = ref(false);
|
|
12
|
+
const showInterceptConfig = ref(false);
|
|
13
|
+
const showJsonDetail = ref(false);
|
|
14
|
+
const jsonData = shallowRef<
|
|
15
|
+
{ title?: string; data: Record<string, any> } | undefined
|
|
16
|
+
>();
|
|
17
|
+
const showNfcTool = ref(false);
|
|
18
|
+
const showTransferDetail = ref(false);
|
|
19
|
+
const showWebSocketDetail = ref(false);
|
|
20
|
+
const showBluetoothTool = ref(false);
|
|
21
|
+
const bluetoothDevice = shallowRef<DevTool.BluetoothItem | null>(null);
|
|
22
|
+
|
|
23
|
+
const network = reactive<DevTool.NetworkItem>({ ...emptyNetwork });
|
|
24
|
+
const transfer = reactive<DevTool.TransferItem>({
|
|
25
|
+
index: 0,
|
|
26
|
+
status: '',
|
|
27
|
+
type: 'upload',
|
|
28
|
+
});
|
|
29
|
+
const webSocket = reactive<DevTool.WS>({ url: '', message: [] });
|
|
30
|
+
|
|
31
|
+
function onCloseCode() {
|
|
32
|
+
openCode.value = false;
|
|
33
|
+
stack.value = '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function onOpenCode(value?: string) {
|
|
37
|
+
if (!value) return;
|
|
38
|
+
stack.value = value;
|
|
39
|
+
|
|
40
|
+
// 微信小程序下的虚拟路径,只能在小程序真机调试下打开
|
|
41
|
+
if (isMockWX(value)) {
|
|
42
|
+
uni.showToast({
|
|
43
|
+
icon: 'none',
|
|
44
|
+
title: '[DevTool] 请在小程序真机调试模式下查看源码',
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const isDev = props.mode === 'development';
|
|
50
|
+
const isUseDevSource = props.useDevSource;
|
|
51
|
+
|
|
52
|
+
// 非开发环境且未显式开启 useDevSource,不打开源码面板
|
|
53
|
+
if (!isDev && !isUseDevSource) return;
|
|
54
|
+
|
|
55
|
+
if (isAndroid()) {
|
|
56
|
+
if (props.sourceFileServers && props.sourceFileServers?.length > 0) {
|
|
57
|
+
openCode.value = true;
|
|
58
|
+
} else {
|
|
59
|
+
uni.showToast({
|
|
60
|
+
icon: 'none',
|
|
61
|
+
title: '[DevTool] sourceFileServers 配置异常',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
openCode.value = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function onOpenJson(data?: { title?: string; data: Record<string, any> }) {
|
|
70
|
+
showJsonDetail.value = true;
|
|
71
|
+
jsonData.value = data;
|
|
72
|
+
}
|
|
73
|
+
function onCloseJson() {
|
|
74
|
+
showJsonDetail.value = false;
|
|
75
|
+
jsonData.value = undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function onOpenNfcTool() {
|
|
79
|
+
showNfcTool.value = true;
|
|
80
|
+
}
|
|
81
|
+
function onCloseNfcTool() {
|
|
82
|
+
showNfcTool.value = false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function onOpenBluetoothTool(device: DevTool.BluetoothItem) {
|
|
86
|
+
bluetoothDevice.value = device;
|
|
87
|
+
showBluetoothTool.value = true;
|
|
88
|
+
}
|
|
89
|
+
function onCloseBluetoothTool() {
|
|
90
|
+
showBluetoothTool.value = false;
|
|
91
|
+
bluetoothDevice.value = null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function onOpenNetworkDetail(ni?: DevTool.NetworkItem) {
|
|
95
|
+
Object.assign(network, emptyNetwork);
|
|
96
|
+
Object.assign(network, ni);
|
|
97
|
+
showNetworkDetail.value = true;
|
|
98
|
+
}
|
|
99
|
+
function onCloseNetworkDetail() {
|
|
100
|
+
showNetworkDetail.value = false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function onOpenNetworkSend(ni?: DevTool.NetworkItem) {
|
|
104
|
+
Object.assign(network, emptyNetwork);
|
|
105
|
+
Object.assign(network, ni);
|
|
106
|
+
showNetworkSend.value = true;
|
|
107
|
+
}
|
|
108
|
+
function onCloseNetworkSend() {
|
|
109
|
+
showNetworkSend.value = false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function onOpenNetworkIntercept() {
|
|
113
|
+
showNetworkIntercept.value = true;
|
|
114
|
+
}
|
|
115
|
+
function onCloseNetworkIntercept() {
|
|
116
|
+
showNetworkIntercept.value = false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function onOpenInterceptConfig(ni?: DevTool.NetworkItem) {
|
|
120
|
+
Object.assign(network, emptyNetwork);
|
|
121
|
+
if (ni) Object.assign(network, ni);
|
|
122
|
+
showInterceptConfig.value = true;
|
|
123
|
+
}
|
|
124
|
+
function onCloseInterceptConfig() {
|
|
125
|
+
showInterceptConfig.value = false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function onOpenTransferDetail(item?: DevTool.TransferItem) {
|
|
129
|
+
if ((item as any).formData) {
|
|
130
|
+
delete (transfer as any).formData;
|
|
131
|
+
}
|
|
132
|
+
if ((item as any).filePath) {
|
|
133
|
+
delete (transfer as any).filePath;
|
|
134
|
+
}
|
|
135
|
+
Object.assign(transfer, item);
|
|
136
|
+
showTransferDetail.value = true;
|
|
137
|
+
}
|
|
138
|
+
function onCloseTransferDetail() {
|
|
139
|
+
showTransferDetail.value = false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function onOpenWebSocketDetail(ws?: DevTool.WS, currentWebSocket?: any) {
|
|
143
|
+
Object.assign(webSocket, ws);
|
|
144
|
+
nextTick(() => {
|
|
145
|
+
// 兼容直接传入对象或传入 Ref 的情况
|
|
146
|
+
if (
|
|
147
|
+
currentWebSocket === undefined ||
|
|
148
|
+
currentWebSocket?.value ||
|
|
149
|
+
currentWebSocket
|
|
150
|
+
) {
|
|
151
|
+
showWebSocketDetail.value = true;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function onCloseWebSocketDetail() {
|
|
156
|
+
showWebSocketDetail.value = false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
state: reactive({
|
|
161
|
+
openCode,
|
|
162
|
+
stack,
|
|
163
|
+
showNetworkSend,
|
|
164
|
+
showNetworkDetail,
|
|
165
|
+
showNetworkIntercept,
|
|
166
|
+
showInterceptConfig,
|
|
167
|
+
showJsonDetail,
|
|
168
|
+
jsonData,
|
|
169
|
+
showNfcTool,
|
|
170
|
+
showTransferDetail,
|
|
171
|
+
showWebSocketDetail,
|
|
172
|
+
showBluetoothTool,
|
|
173
|
+
bluetoothDevice,
|
|
174
|
+
}),
|
|
175
|
+
network,
|
|
176
|
+
transfer,
|
|
177
|
+
webSocket,
|
|
178
|
+
handlers: {
|
|
179
|
+
onCloseCode,
|
|
180
|
+
onOpenCode,
|
|
181
|
+
onOpenJson,
|
|
182
|
+
onCloseJson,
|
|
183
|
+
onOpenNfcTool,
|
|
184
|
+
onCloseNfcTool,
|
|
185
|
+
onOpenNetworkDetail,
|
|
186
|
+
onCloseNetworkDetail,
|
|
187
|
+
onOpenNetworkSend,
|
|
188
|
+
onCloseNetworkSend,
|
|
189
|
+
onOpenNetworkIntercept,
|
|
190
|
+
onCloseNetworkIntercept,
|
|
191
|
+
onOpenInterceptConfig,
|
|
192
|
+
onCloseInterceptConfig,
|
|
193
|
+
onOpenTransferDetail,
|
|
194
|
+
onCloseTransferDetail,
|
|
195
|
+
onOpenWebSocketDetail,
|
|
196
|
+
onCloseWebSocketDetail,
|
|
197
|
+
onOpenBluetoothTool,
|
|
198
|
+
onCloseBluetoothTool,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
:resizable="true"
|
|
19
19
|
:isFullScreen="isFullScreen"
|
|
20
20
|
:maxWidth="100"
|
|
21
|
-
|
|
21
|
+
:safeTop="0"
|
|
22
|
+
:safeBottom="0"
|
|
23
|
+
:theme="theme"
|
|
22
24
|
@update:x="onUpdateWindowX"
|
|
23
25
|
@update:y="onUpdateWindowY"
|
|
24
26
|
@update:width="onUpdateWindowWidth"
|
|
@@ -31,41 +33,20 @@
|
|
|
31
33
|
isFullScreen ? 'is-full-screen' : 'is-window',
|
|
32
34
|
]">
|
|
33
35
|
<view class="dev-tool-window-bg"></view>
|
|
34
|
-
|
|
35
|
-
<view
|
|
36
|
-
class="window-header drag-handle"
|
|
36
|
+
<Tabs
|
|
37
37
|
data-drag-handle="1"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Uncaught TypeError: Cannot read property 'children' of null at uni-app-view.umd.js:7
|
|
51
|
-
Uncaught TypeError: Cannot read property '$' of undefined at uni-app-view.umd.js:7
|
|
52
|
-
-->
|
|
53
|
-
|
|
54
|
-
<Tabs
|
|
55
|
-
data-drag-handle="1"
|
|
56
|
-
:model-value="activeTab"
|
|
57
|
-
:items="tabItems"
|
|
58
|
-
:scroll-left="tabScrollLeft"
|
|
59
|
-
@close="onCloseWindow"
|
|
60
|
-
@scroll="debounceScrollTabs"
|
|
61
|
-
@change="onChangeTabs">
|
|
62
|
-
<template #extra>
|
|
63
|
-
<CircularButton
|
|
64
|
-
:text="isFullScreen ? '❐' : '⛶'"
|
|
65
|
-
@click="toggleFullScreen" />
|
|
66
|
-
</template>
|
|
67
|
-
</Tabs>
|
|
68
|
-
</view>
|
|
38
|
+
:model-value="activeTab"
|
|
39
|
+
:items="tabItems"
|
|
40
|
+
:scroll-left="tabScrollLeft"
|
|
41
|
+
@close="onCloseWindow"
|
|
42
|
+
@scroll="debounceScrollTabs"
|
|
43
|
+
@change="onChangeTabs">
|
|
44
|
+
<template #extra>
|
|
45
|
+
<CircularButton
|
|
46
|
+
:text="isFullScreen ? '❐' : '⛶'"
|
|
47
|
+
@click="toggleFullScreen" />
|
|
48
|
+
</template>
|
|
49
|
+
</Tabs>
|
|
69
50
|
|
|
70
51
|
<CustomSwiper
|
|
71
52
|
v-if="isReady"
|
|
@@ -358,6 +339,7 @@
|
|
|
358
339
|
:barrage-start-top="barrageStartTop"
|
|
359
340
|
:barrage-duration="barrageDuration"
|
|
360
341
|
:barrage-max-length="barrageMaxLength"
|
|
342
|
+
:barrage-allow-drag="barrageAllowDrag"
|
|
361
343
|
:barrage-types="barrageTypes"
|
|
362
344
|
:barrage-show-when-open="barrageShowWhenOpen"
|
|
363
345
|
:sizeFormat="sizeFormat"
|
|
@@ -390,6 +372,7 @@
|
|
|
390
372
|
@change-barrage-start-top="onChangeBarrageStartTop"
|
|
391
373
|
@change-barrage-duration="onChangeBarrageDuration"
|
|
392
374
|
@change-barrage-max-length="onChangeBarrageMaxLength"
|
|
375
|
+
@change-barrage-allow-drag="onChangeBarrageAllowDrag"
|
|
393
376
|
@change-barrage-types="onChangeBarrageTypes"
|
|
394
377
|
@change-barrage-show-when-open="onChangeBarrageShowWhenOpen"
|
|
395
378
|
@change-use-transition="onChangeUseTransition"
|
|
@@ -490,7 +473,7 @@ const props = withDefaults(
|
|
|
490
473
|
useDevSource?: boolean;
|
|
491
474
|
zIndex?: number;
|
|
492
475
|
contentHeight: number;
|
|
493
|
-
customStyle?: Record<string,
|
|
476
|
+
customStyle?: Record<string, string | number>;
|
|
494
477
|
origin?: { x: number; y: number };
|
|
495
478
|
}>(),
|
|
496
479
|
{
|
|
@@ -500,7 +483,10 @@ const props = withDefaults(
|
|
|
500
483
|
|
|
501
484
|
const emits = defineEmits<{
|
|
502
485
|
(e: 'close'): void;
|
|
503
|
-
(
|
|
486
|
+
(
|
|
487
|
+
e: 'sendMessage',
|
|
488
|
+
data: { type: string; data: Record<string, unknown> },
|
|
489
|
+
): void;
|
|
504
490
|
(e: 'changeTheme', theme: string): void;
|
|
505
491
|
}>();
|
|
506
492
|
|
|
@@ -569,6 +555,7 @@ const {
|
|
|
569
555
|
barrageStartTop,
|
|
570
556
|
barrageDuration,
|
|
571
557
|
barrageMaxLength,
|
|
558
|
+
barrageAllowDrag,
|
|
572
559
|
barrageTypes,
|
|
573
560
|
barrageShowWhenOpen,
|
|
574
561
|
isFullScreen,
|
|
@@ -578,15 +565,6 @@ const {
|
|
|
578
565
|
windowHeight,
|
|
579
566
|
} = data;
|
|
580
567
|
|
|
581
|
-
const draggableRef = ref();
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* 初始化拖拽
|
|
585
|
-
*/
|
|
586
|
-
function onInitDrag(e: MouseEvent | TouchEvent) {
|
|
587
|
-
draggableRef.value?.initDrag(e);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
568
|
function toggleFullScreen() {
|
|
591
569
|
isFullScreen.value = !isFullScreen.value;
|
|
592
570
|
saveSettings();
|
|
@@ -685,6 +663,7 @@ const {
|
|
|
685
663
|
onChangeBarrageStartTop,
|
|
686
664
|
onChangeBarrageDuration,
|
|
687
665
|
onChangeBarrageMaxLength,
|
|
666
|
+
onChangeBarrageAllowDrag,
|
|
688
667
|
onChangeBarrageTypes,
|
|
689
668
|
onChangeBarrageShowWhenOpen,
|
|
690
669
|
basicSendMessage,
|
|
@@ -770,14 +749,14 @@ function onUpdateStorageList(val: DevTool.StorageItem[]) {
|
|
|
770
749
|
/**
|
|
771
750
|
* 更新 Vuex 数据
|
|
772
751
|
*/
|
|
773
|
-
function onUpdateVuexList(val: Record<string,
|
|
752
|
+
function onUpdateVuexList(val: Record<string, unknown>) {
|
|
774
753
|
vuexList.value = val;
|
|
775
754
|
}
|
|
776
755
|
|
|
777
756
|
/**
|
|
778
757
|
* 更新 Pinia 数据
|
|
779
758
|
*/
|
|
780
|
-
function onUpdatePiniaList(val: Record<string,
|
|
759
|
+
function onUpdatePiniaList(val: Record<string, unknown>) {
|
|
781
760
|
piniaList.value = val;
|
|
782
761
|
}
|
|
783
762
|
|
|
@@ -942,25 +921,9 @@ onTabItemTap((option) => {
|
|
|
942
921
|
height: 100%;
|
|
943
922
|
color: var(--dev-tool-text-color);
|
|
944
923
|
box-sizing: border-box;
|
|
945
|
-
transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
|
|
946
924
|
pointer-events: auto;
|
|
947
925
|
}
|
|
948
926
|
|
|
949
|
-
.is-window {
|
|
950
|
-
border-radius: 12px;
|
|
951
|
-
overflow: hidden;
|
|
952
|
-
box-shadow: 0 8px 24px rgb(0 0 0 / 20%);
|
|
953
|
-
border: 1px solid var(--dev-tool-border-color);
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
.is-window .dev-tool-window-bg {
|
|
957
|
-
border-radius: 12px;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
.is-full-screen {
|
|
961
|
-
border-radius: 0;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
927
|
.window-header {
|
|
965
928
|
width: 100%;
|
|
966
929
|
cursor: move;
|