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