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,84 +1,84 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="vuex-content">
|
|
3
|
-
<view class="vuex-control">
|
|
4
|
-
<DevToolTitle>{{ t('vuex.title') }}</DevToolTitle>
|
|
5
|
-
</view>
|
|
6
|
-
<view class="vuex-json-wrapper">
|
|
7
|
-
<JsonPretty
|
|
8
|
-
editable
|
|
9
|
-
showLength
|
|
10
|
-
virtual
|
|
11
|
-
v-if="showJson"
|
|
12
|
-
:data="vuexList"
|
|
13
|
-
:theme="theme"
|
|
14
|
-
:height="contentHeight - 32 - 32"
|
|
15
|
-
:nodeSelectable="() => false"
|
|
16
|
-
:pathCollapsible="() => false"
|
|
17
|
-
@update:data="onUpdateData"
|
|
18
|
-
@nodeClick="onNodeClick"
|
|
19
|
-
/>
|
|
20
|
-
<Empty v-else />
|
|
21
|
-
</view>
|
|
22
|
-
</view>
|
|
23
|
-
</template>
|
|
24
|
-
<script lang="ts" setup>
|
|
25
|
-
import { computed } from 'vue';
|
|
26
|
-
import JsonPretty from '../../../components/JsonPretty/index.vue';
|
|
27
|
-
import Empty from '../../../components/Empty/index.vue';
|
|
28
|
-
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
29
|
-
import { useI18n } from '../../../../i18n';
|
|
30
|
-
|
|
31
|
-
const { t } = useI18n();
|
|
32
|
-
const props = defineProps<{
|
|
33
|
-
vuexList: Record<string, any>;
|
|
34
|
-
theme?: string;
|
|
35
|
-
contentHeight: number;
|
|
36
|
-
}>();
|
|
37
|
-
const emit = defineEmits<{
|
|
38
|
-
(e: 'update:vuexList', data: Record<string, any>): void;
|
|
39
|
-
(e: 'change', value: any): void;
|
|
40
|
-
}>();
|
|
41
|
-
const showJson = computed(() => {
|
|
42
|
-
try {
|
|
43
|
-
const str = JSON.stringify(props.vuexList);
|
|
44
|
-
if (typeof props.vuexList === 'object' && (str === '' || str === '{}')) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
} catch (_error) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
let currentSelect: any;
|
|
54
|
-
function onUpdateData(data: Record<string, any>) {
|
|
55
|
-
const firstKey = currentSelect?.path?.split('.')?.slice(1)?.[0];
|
|
56
|
-
emit('change', {
|
|
57
|
-
[firstKey]: data[firstKey],
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function onNodeClick(node: any) {
|
|
61
|
-
currentSelect = node;
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
<style scoped>
|
|
65
|
-
.vuex-content {
|
|
66
|
-
font-size: var(--dev-tool-base-font-size);
|
|
67
|
-
height: 100%;
|
|
68
|
-
box-sizing: border-box;
|
|
69
|
-
overflow: hidden;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.vuex-control {
|
|
73
|
-
display: flex;
|
|
74
|
-
align-items: center;
|
|
75
|
-
padding: 0 16px;
|
|
76
|
-
height: 32px;
|
|
77
|
-
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
78
|
-
box-sizing: border-box;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.vuex-json-wrapper {
|
|
82
|
-
padding: 0 16px;
|
|
83
|
-
}
|
|
84
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="vuex-content">
|
|
3
|
+
<view class="vuex-control">
|
|
4
|
+
<DevToolTitle>{{ t('vuex.title') }}</DevToolTitle>
|
|
5
|
+
</view>
|
|
6
|
+
<view class="vuex-json-wrapper">
|
|
7
|
+
<JsonPretty
|
|
8
|
+
editable
|
|
9
|
+
showLength
|
|
10
|
+
virtual
|
|
11
|
+
v-if="showJson"
|
|
12
|
+
:data="vuexList"
|
|
13
|
+
:theme="theme"
|
|
14
|
+
:height="contentHeight - 32 - 32"
|
|
15
|
+
:nodeSelectable="() => false"
|
|
16
|
+
:pathCollapsible="() => false"
|
|
17
|
+
@update:data="onUpdateData"
|
|
18
|
+
@nodeClick="onNodeClick"
|
|
19
|
+
/>
|
|
20
|
+
<Empty v-else />
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
</template>
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { computed } from 'vue';
|
|
26
|
+
import JsonPretty from '../../../components/JsonPretty/index.vue';
|
|
27
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
28
|
+
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
29
|
+
import { useI18n } from '../../../../i18n';
|
|
30
|
+
|
|
31
|
+
const { t } = useI18n();
|
|
32
|
+
const props = defineProps<{
|
|
33
|
+
vuexList: Record<string, any>;
|
|
34
|
+
theme?: string;
|
|
35
|
+
contentHeight: number;
|
|
36
|
+
}>();
|
|
37
|
+
const emit = defineEmits<{
|
|
38
|
+
(e: 'update:vuexList', data: Record<string, any>): void;
|
|
39
|
+
(e: 'change', value: any): void;
|
|
40
|
+
}>();
|
|
41
|
+
const showJson = computed(() => {
|
|
42
|
+
try {
|
|
43
|
+
const str = JSON.stringify(props.vuexList);
|
|
44
|
+
if (typeof props.vuexList === 'object' && (str === '' || str === '{}')) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
} catch (_error) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
let currentSelect: any;
|
|
54
|
+
function onUpdateData(data: Record<string, any>) {
|
|
55
|
+
const firstKey = currentSelect?.path?.split('.')?.slice(1)?.[0];
|
|
56
|
+
emit('change', {
|
|
57
|
+
[firstKey]: data[firstKey],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function onNodeClick(node: any) {
|
|
61
|
+
currentSelect = node;
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
<style scoped>
|
|
65
|
+
.vuex-content {
|
|
66
|
+
font-size: var(--dev-tool-base-font-size);
|
|
67
|
+
height: 100%;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.vuex-control {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
padding: 0 16px;
|
|
76
|
+
height: 32px;
|
|
77
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.vuex-json-wrapper {
|
|
82
|
+
padding: 0 16px;
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view data-dev-tool :class="`dev-tool dev-tool-${theme}`">
|
|
3
|
+
<!-- are you ok ? -->
|
|
3
4
|
<DevToolButton
|
|
4
|
-
v-if="devToolButtonVisible"
|
|
5
5
|
:zIndex="zIndex"
|
|
6
6
|
:customStyle="customStyle"
|
|
7
7
|
:contentHeight="contentHeight"
|
|
8
8
|
:devToolVersion="devToolVersion"
|
|
9
|
+
:devToolButtonVisible="devToolButtonVisible"
|
|
9
10
|
@click="onDevToolButtonClick" />
|
|
10
11
|
|
|
11
12
|
<DevToolWindow
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
<!-- Barrage -->
|
|
42
43
|
<Barrage
|
|
43
44
|
ref="barrageRef"
|
|
45
|
+
:allowDrag="windowData.barrageAllowDrag"
|
|
44
46
|
:zIndex="zIndex + 100"
|
|
45
47
|
:maxTracks="windowData.barrageMaxTracks"
|
|
46
48
|
:trackHeight="windowData.barrageTrackHeight"
|
|
@@ -231,146 +233,91 @@ function onSendMessage(param: { type: string; data: Record<string, any> }) {
|
|
|
231
233
|
sendCommand(param.type, param.data);
|
|
232
234
|
}
|
|
233
235
|
|
|
234
|
-
|
|
235
|
-
if (data) {
|
|
236
|
-
// 采用合并策略而不是直接替换,防止丢失部分本地状态
|
|
237
|
-
windowData.value = { ...windowData.value, ...data };
|
|
238
|
-
|
|
239
|
-
if (data.devToolVersion !== undefined)
|
|
240
|
-
devToolVersion.value = data.devToolVersion;
|
|
241
|
-
|
|
242
|
-
if (data.sourceFileServers !== undefined)
|
|
243
|
-
sourceFileServers.value = data.sourceFileServers;
|
|
244
|
-
|
|
245
|
-
if (data.mode !== undefined) mode.value = data.mode;
|
|
246
|
-
|
|
247
|
-
if (data.useDevSource !== undefined) useDevSource.value = data.useDevSource;
|
|
248
|
-
|
|
249
|
-
if (data.zIndex !== undefined) zIndex.value = data.zIndex;
|
|
250
|
-
|
|
251
|
-
if (data.baseFontSize !== undefined) baseFontSize.value = data.baseFontSize;
|
|
252
|
-
|
|
253
|
-
if (data.tagFontSize !== undefined) tagFontSize.value = data.tagFontSize;
|
|
254
|
-
if (data.tipsFontSize !== undefined) tipsFontSize.value = data.tipsFontSize;
|
|
255
|
-
if (data.fontFamily !== undefined) fontFamily.value = data.fontFamily;
|
|
256
|
-
if (data.fontWeight !== undefined) fontWeight.value = data.fontWeight;
|
|
257
|
-
if (data.performanceVisible !== undefined)
|
|
258
|
-
performanceVisible.value = data.performanceVisible;
|
|
259
|
-
|
|
260
|
-
// 弹幕配置
|
|
261
|
-
if (data.barrageVisible !== undefined)
|
|
262
|
-
windowData.value.barrageVisible = data.barrageVisible;
|
|
263
|
-
if (data.barrageShowWhenOpen !== undefined)
|
|
264
|
-
windowData.value.barrageShowWhenOpen = data.barrageShowWhenOpen;
|
|
265
|
-
if (data.barrageMaxTracks !== undefined)
|
|
266
|
-
windowData.value.barrageMaxTracks = data.barrageMaxTracks;
|
|
267
|
-
if (data.barrageTrackHeight !== undefined)
|
|
268
|
-
windowData.value.barrageTrackHeight = data.barrageTrackHeight;
|
|
269
|
-
if (data.barrageStartTop !== undefined)
|
|
270
|
-
windowData.value.barrageStartTop = data.barrageStartTop;
|
|
271
|
-
if (data.barrageDuration !== undefined)
|
|
272
|
-
windowData.value.barrageDuration = data.barrageDuration;
|
|
273
|
-
if (data.barrageMaxLength !== undefined)
|
|
274
|
-
windowData.value.barrageMaxLength = data.barrageMaxLength;
|
|
275
|
-
|
|
276
|
-
if (data.barrageTypes !== undefined) {
|
|
277
|
-
if (Array.isArray(data.barrageTypes)) {
|
|
278
|
-
windowData.value.barrageTypes = data.barrageTypes;
|
|
279
|
-
} else {
|
|
280
|
-
console.warn(
|
|
281
|
-
'[DevTool] Received invalid barrageTypes in windowData:',
|
|
282
|
-
data.barrageTypes,
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
function onChangeTheme(t: string) {
|
|
236
|
+
const onChangeTheme = (t: string) => {
|
|
290
237
|
theme.value = t;
|
|
291
|
-
}
|
|
238
|
+
};
|
|
292
239
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
240
|
+
const onDevOptionSend = (data: DevTool.WindowData) => {
|
|
241
|
+
if (!data) return;
|
|
242
|
+
windowData.value = { ...windowData.value, ...data };
|
|
243
|
+
|
|
244
|
+
if (data.devToolVersion !== undefined)
|
|
245
|
+
devToolVersion.value = data.devToolVersion;
|
|
246
|
+
if (data.sourceFileServers !== undefined)
|
|
247
|
+
sourceFileServers.value = data.sourceFileServers;
|
|
248
|
+
if (data.mode !== undefined) mode.value = data.mode;
|
|
249
|
+
if (data.useDevSource !== undefined) useDevSource.value = data.useDevSource;
|
|
250
|
+
if (data.zIndex !== undefined) zIndex.value = data.zIndex;
|
|
251
|
+
if (data.baseFontSize !== undefined) baseFontSize.value = data.baseFontSize;
|
|
252
|
+
if (data.tagFontSize !== undefined) tagFontSize.value = data.tagFontSize;
|
|
253
|
+
if (data.tipsFontSize !== undefined) tipsFontSize.value = data.tipsFontSize;
|
|
254
|
+
if (data.fontFamily !== undefined) fontFamily.value = data.fontFamily;
|
|
255
|
+
if (data.fontWeight !== undefined) fontWeight.value = data.fontWeight;
|
|
256
|
+
if (data.performanceVisible !== undefined)
|
|
257
|
+
performanceVisible.value = data.performanceVisible;
|
|
258
|
+
|
|
259
|
+
const barrageKeys: (keyof DevTool.WindowData)[] = [
|
|
260
|
+
'barrageVisible',
|
|
261
|
+
'barrageShowWhenOpen',
|
|
262
|
+
'barrageMaxTracks',
|
|
263
|
+
'barrageTrackHeight',
|
|
264
|
+
'barrageStartTop',
|
|
265
|
+
'barrageDuration',
|
|
266
|
+
'barrageMaxLength',
|
|
267
|
+
'barrageTypes',
|
|
268
|
+
];
|
|
269
|
+
barrageKeys.forEach((k) => {
|
|
270
|
+
if (data[k] !== undefined) (windowData.value as any)[k] = data[k];
|
|
271
|
+
});
|
|
272
|
+
};
|
|
307
273
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
typeof
|
|
344
|
-
?
|
|
345
|
-
:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
} else if (item.type === 'websocket') {
|
|
356
|
-
barrageRef.value.add(`WS: ${item.data}`, 'info');
|
|
357
|
-
} else {
|
|
358
|
-
const args = item.args || [];
|
|
359
|
-
const text = args
|
|
360
|
-
.map((arg: any) =>
|
|
361
|
-
typeof arg?.value === 'string'
|
|
362
|
-
? arg.value
|
|
363
|
-
: JSON.stringify(arg?.value ?? ''),
|
|
364
|
-
)
|
|
365
|
-
.join(' ');
|
|
366
|
-
barrageRef.value.add(text, item.type || 'log');
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
break;
|
|
371
|
-
// ... 其他消息处理
|
|
372
|
-
}
|
|
373
|
-
}
|
|
274
|
+
const handleCoreMessage = (msg: any) => {
|
|
275
|
+
const { type, data } = typeof msg === 'string' ? JSON.parse(msg) : msg;
|
|
276
|
+
|
|
277
|
+
const handlers: Record<string, () => void> = {
|
|
278
|
+
[MSG_TYPE.BUTTON_VISIBLE]: () => onShowDevToolButton(data),
|
|
279
|
+
[MSG_TYPE.WINDOW_VISIBLE]: () => onShowDevToolWindow(data),
|
|
280
|
+
[MSG_TYPE.PERF_VISIBLE]: () => (performanceVisible.value = data),
|
|
281
|
+
[MSG_TYPE.DATA_UPDATE]: () => onDevOptionSend(data),
|
|
282
|
+
[MSG_TYPE.OPTION_UPDATE]: () => onDevOptionSend(data),
|
|
283
|
+
[MSG_TYPE.BARRAGE_VISIBLE]: () => (windowData.value.barrageVisible = data),
|
|
284
|
+
[MSG_TYPE.BARRAGE_SHOW_WHEN_OPEN]: () =>
|
|
285
|
+
(windowData.value.barrageShowWhenOpen = data),
|
|
286
|
+
[MSG_TYPE.BARRAGE_ADD]: () => {
|
|
287
|
+
if (!barrageFinalVisible.value || !barrageRef.value) return;
|
|
288
|
+
(data.items || []).forEach((item: any) => {
|
|
289
|
+
if (!windowData.value.barrageTypes?.includes(item.type || 'log'))
|
|
290
|
+
return;
|
|
291
|
+
if (item.type === 'network') {
|
|
292
|
+
if (item.status === 'pending') return;
|
|
293
|
+
const ok =
|
|
294
|
+
typeof item.status === 'number'
|
|
295
|
+
? item.status < 300
|
|
296
|
+
: !/ERR/.test(item.status);
|
|
297
|
+
if (!ok)
|
|
298
|
+
barrageRef.value.add(
|
|
299
|
+
`[${item.method || 'GET'}] ${item.status} - ${item.url}`,
|
|
300
|
+
'network',
|
|
301
|
+
);
|
|
302
|
+
} else if (item.type === 'transfer') {
|
|
303
|
+
barrageRef.value.add(`Transfer Failed: ${item.url}`, 'error');
|
|
304
|
+
} else if (item.type === 'websocket') {
|
|
305
|
+
barrageRef.value.add(`WS: ${item.data}`, 'info');
|
|
306
|
+
} else {
|
|
307
|
+
const text = (item.args || [])
|
|
308
|
+
.map((a: any) =>
|
|
309
|
+
typeof a?.value === 'string'
|
|
310
|
+
? a.value
|
|
311
|
+
: JSON.stringify(a?.value ?? ''),
|
|
312
|
+
)
|
|
313
|
+
.join(' ');
|
|
314
|
+
barrageRef.value.add(text, item.type || 'log');
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
handlers[type]?.();
|
|
320
|
+
};
|
|
374
321
|
|
|
375
322
|
onBeforeMount(() => {
|
|
376
323
|
const devToolInfo = getDevToolInfo();
|