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.
Files changed (168) hide show
  1. package/README.md +46 -0
  2. package/dist/const.cjs +1 -1
  3. package/dist/const.d.ts +12 -0
  4. package/dist/const.d.ts.map +1 -1
  5. package/dist/const.js +1 -1
  6. package/dist/core-shared.d.ts +1 -1
  7. package/dist/core-shared.d.ts.map +1 -1
  8. package/dist/core-shared.js +1 -1
  9. package/dist/core.d.ts +10 -3
  10. package/dist/core.d.ts.map +1 -1
  11. package/dist/core.js +2 -2
  12. package/dist/i18n/locales/en.cjs +1 -1
  13. package/dist/i18n/locales/en.d.ts +81 -0
  14. package/dist/i18n/locales/en.d.ts.map +1 -1
  15. package/dist/i18n/locales/en.js +1 -1
  16. package/dist/i18n/locales/zh-Hans.cjs +1 -1
  17. package/dist/i18n/locales/zh-Hans.d.ts +82 -1
  18. package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
  19. package/dist/i18n/locales/zh-Hans.js +1 -1
  20. package/dist/modules/devConsole/index.cjs +1 -1
  21. package/dist/modules/devConsole/index.js +3 -3
  22. package/dist/modules/devEvent/index.cjs +3 -3
  23. package/dist/modules/devEvent/index.d.ts +1 -0
  24. package/dist/modules/devEvent/index.d.ts.map +1 -1
  25. package/dist/modules/devEvent/index.js +3 -3
  26. package/dist/modules/devIntercept/index.cjs +14 -13
  27. package/dist/modules/devIntercept/index.d.ts +19 -0
  28. package/dist/modules/devIntercept/index.d.ts.map +1 -1
  29. package/dist/modules/devIntercept/index.js +14 -13
  30. package/dist/modules/devStore/index.cjs +1 -1
  31. package/dist/modules/devStore/index.d.ts +21 -0
  32. package/dist/modules/devStore/index.d.ts.map +1 -1
  33. package/dist/modules/devStore/index.js +1 -1
  34. package/dist/plugins/uniDevTool/transform/transformMain.cjs +1 -1
  35. package/dist/plugins/uniDevTool/transform/transformMain.js +1 -1
  36. package/dist/type.d.ts +47 -2
  37. package/dist/type.d.ts.map +1 -1
  38. package/dist/utils/language.cjs +1 -1
  39. package/dist/utils/language.d.ts.map +1 -1
  40. package/dist/utils/language.js +1 -1
  41. package/dist/utils/object.cjs +1 -1
  42. package/dist/utils/object.d.ts.map +1 -1
  43. package/dist/utils/object.js +1 -1
  44. package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -0
  45. package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -0
  46. package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -0
  47. package/dist/v3/{CaptureScreen → DevTool/components/CaptureScreen}/index.vue +109 -109
  48. package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/ConsoleItem.vue +225 -224
  49. package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/RunJSInput.vue +247 -249
  50. package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/index.vue +171 -160
  51. package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/staticTips.ts +1145 -1145
  52. package/dist/v3/{DevToolButton → DevTool/components/DevToolButton}/index.vue +7 -4
  53. package/dist/v3/{DevToolTitle → DevTool/components/DevToolTitle}/index.vue +24 -24
  54. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/DevToolOverlay.vue +197 -182
  55. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/const.ts +28 -5
  56. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/dataUtils.ts +48 -48
  57. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolData.ts +387 -338
  58. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolHandlers.ts +629 -549
  59. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolOverlay.ts +197 -184
  60. package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.vue +67 -16
  61. package/dist/v3/{ElEvent → DevTool/components/ElEvent}/ElEventItem.vue +105 -105
  62. package/dist/v3/{ElEvent → DevTool/components/ElEvent}/index.vue +106 -109
  63. package/dist/v3/{Instance → DevTool/components/Instance}/components/InstanceTreeNode.vue +265 -265
  64. package/dist/v3/{Instance → DevTool/components/Instance}/flatten.ts +226 -226
  65. package/dist/v3/{Instance → DevTool/components/Instance}/index.vue +94 -94
  66. package/dist/v3/{Instance → DevTool/components/Instance}/registry.ts +49 -49
  67. package/dist/v3/{Instance → DevTool/components/Instance}/transformTree.ts +375 -375
  68. package/dist/v3/{Instance → DevTool/components/Instance}/transformTreeCtx.ts +268 -268
  69. package/dist/v3/{Instance → DevTool/components/Instance}/typing.d.ts +43 -43
  70. package/dist/v3/{InstanceDetail → DevTool/components/InstanceDetail}/index.vue +485 -485
  71. package/dist/v3/{JsonDetail → DevTool/components/JsonDetail}/index.vue +70 -70
  72. package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCItem.vue +112 -113
  73. package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCTool.vue +454 -478
  74. package/dist/v3/{NFCList → DevTool/components/NFCList}/const.ts +56 -56
  75. package/dist/v3/{NFCList → DevTool/components/NFCList}/index.vue +94 -98
  76. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptConfig.vue +624 -608
  77. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptItem.vue +140 -140
  78. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkDetail.vue +287 -296
  79. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkIntercept.vue +88 -93
  80. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkItem.vue +163 -167
  81. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkSend.vue +589 -556
  82. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/const.ts +4 -4
  83. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/hooks/useNetworkForm.ts +86 -86
  84. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/index.vue +160 -160
  85. package/dist/v3/{NetworkList → DevTool/components/NetworkList}/utils.ts +101 -101
  86. package/dist/v3/{Performance → DevTool/components/Performance}/index.vue +498 -495
  87. package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceMetrics.vue +153 -153
  88. package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceWidget.vue +12 -9
  89. package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceChart.ts +460 -460
  90. package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceData.ts +258 -258
  91. package/dist/v3/{PiniaList → DevTool/components/PiniaList}/index.vue +93 -94
  92. package/dist/v3/{RouteList → DevTool/components/RouteList}/index.vue +21 -24
  93. package/dist/v3/{RunJS → DevTool/components/RunJS}/index.vue +148 -148
  94. package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/ScanCodeItem.vue +97 -98
  95. package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/index.vue +100 -104
  96. package/dist/v3/{SettingButton → DevTool/components/SettingButton}/index.vue +45 -45
  97. package/dist/v3/{SettingList → DevTool/components/SettingList}/index.vue +218 -150
  98. package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -0
  99. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingDevTool.vue +212 -208
  100. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingInfo.vue +157 -119
  101. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLanguage.vue +74 -74
  102. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLog.vue +230 -230
  103. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingNetwork.vue +3 -3
  104. package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingTheme.vue +37 -7
  105. package/dist/v3/{SettingList → DevTool/components/SettingList}/typing.d.ts +2 -2
  106. package/dist/v3/{SourceCode → DevTool/components/SourceCode}/Line.vue +127 -116
  107. package/dist/v3/{SourceCode → DevTool/components/SourceCode}/index.vue +8 -8
  108. package/dist/v3/{SourceCode → DevTool/components/SourceCode}/parseCode.ts +609 -701
  109. package/dist/v3/{StorageList → DevTool/components/StorageList}/index.vue +174 -174
  110. package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferDetail.vue +268 -268
  111. package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferItem.vue +4 -4
  112. package/dist/v3/{TransferList → DevTool/components/TransferList}/index.vue +8 -8
  113. package/dist/v3/{UniEvent → DevTool/components/UniEvent}/UniEventItem.vue +6 -7
  114. package/dist/v3/{UniEvent → DevTool/components/UniEvent}/index.vue +6 -6
  115. package/dist/v3/{VuexList → DevTool/components/VuexList}/index.vue +84 -84
  116. package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketDetail.vue +8 -8
  117. package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketItem.vue +4 -4
  118. package/dist/v3/{WebSocket → DevTool/components/WebSocket}/index.vue +8 -8
  119. package/dist/v3/DevTool/index.vue +179 -5
  120. package/dist/v3/{AppTransition → components/AppTransition}/index.vue +176 -170
  121. package/dist/v3/{AutoSizer → components/AutoSizer}/index.vue +192 -192
  122. package/dist/v3/{AutoSizer → components/AutoSizer}/index1.vue +184 -184
  123. package/dist/v3/{AutoSizer → components/AutoSizer}/utils.ts +49 -49
  124. package/dist/v3/components/Barrage/BarrageItem.vue +137 -0
  125. package/dist/v3/components/Barrage/index.vue +202 -0
  126. package/dist/v3/{CircularButton → components/CircularButton}/index.vue +84 -84
  127. package/dist/v3/{CustomSwiper → components/CustomSwiper}/CustomSwiperItem.vue +49 -49
  128. package/dist/v3/{CustomSwiper → components/CustomSwiper}/index.vue +104 -104
  129. package/dist/v3/{DraggableContainer → components/DraggableContainer}/index.vue +1 -1
  130. package/dist/v3/{Empty → components/Empty}/index.vue +29 -29
  131. package/dist/v3/{FilterInput → components/FilterInput}/index.vue +1 -1
  132. package/dist/v3/{FilterSelect → components/FilterSelect}/index.vue +179 -179
  133. package/dist/v3/{JsonPretty → components/JsonPretty}/components/Brackets/index.vue +27 -27
  134. package/dist/v3/{JsonPretty → components/JsonPretty}/components/Carets/index.vue +59 -59
  135. package/dist/v3/{JsonPretty → components/JsonPretty}/components/CheckController/index.vue +136 -136
  136. package/dist/v3/{JsonPretty → components/JsonPretty}/components/TreeNode/index.vue +387 -381
  137. package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useClipboard.ts +21 -21
  138. package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useError.ts +21 -21
  139. package/dist/v3/{JsonPretty → components/JsonPretty}/index.vue +16 -13
  140. package/dist/v3/{JsonPretty → components/JsonPretty}/type.ts +127 -126
  141. package/dist/v3/{JsonPretty → components/JsonPretty}/utils/index.ts +169 -169
  142. package/dist/v3/{MovableContainer → components/MovableContainer}/index.vue +1 -1
  143. package/dist/v3/{Pick → components/Pick}/index.vue +322 -322
  144. package/dist/v3/{Tabs → components/Tabs}/index.vue +30 -4
  145. package/dist/v3/{Tag → components/Tag}/index.vue +113 -113
  146. package/dist/v3/{VirtualList → components/VirtualList}/AutoSize.vue +40 -40
  147. package/dist/v3/{VirtualList → components/VirtualList}/index.vue +416 -412
  148. package/dist/v3/hooks/useBluetooth/index.ts +561 -0
  149. package/dist/v3/hooks/useContainerStyle.ts +153 -153
  150. package/dist/v3/hooks/useNFC/index.ts +107 -107
  151. package/dist/v3/hooks/useNFC/typing.d.ts +396 -396
  152. package/dist/v3/hooks/useNFC/useNFCAndroid.ts +966 -966
  153. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +812 -812
  154. package/dist/v3/hooks/useNFC/utils.ts +754 -754
  155. package/dist/v3/hooks/useRequest/index.ts +586 -573
  156. package/dist/v3/hooks/useRequest/utils.ts +267 -267
  157. package/dist/v3/hooks/useScanCode/index.ts +206 -206
  158. package/dist/v3/hooks/useWebsocket/README.md +79 -0
  159. package/dist/v3/hooks/useWebsocket/index.ts +253 -0
  160. package/dist/v3/styles/theme.css +17 -10
  161. package/dist/v3/styles/theme.ts +12 -12
  162. package/package.json +59 -64
  163. package/dist/plugins/uniParseStock/index.d.ts +0 -10
  164. package/dist/plugins/uniParseStock/index.d.ts.map +0 -1
  165. /package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.css +0 -0
  166. /package/dist/v3/{SettingList → DevTool/components/SettingList}/index.css +0 -0
  167. /package/dist/v3/{Empty → components/Empty}/empty.png +0 -0
  168. /package/dist/v3/{VirtualList → components/VirtualList}/readme.md +0 -0
@@ -1,150 +1,218 @@
1
- <template>
2
- <scroll-view
3
- class="setting-content"
4
- scroll-y
5
- :style="{ height: contentHeight - 32 + 'px' }">
6
- <SettingLanguage :theme="theme" @restart-app="onRestartAppWithConfirm" />
7
- <SettingDevTool
8
- :theme="theme"
9
- :dev-tool-visible="devToolVisible"
10
- :size-format="sizeFormat"
11
- :build-info="buildInfo"
12
- @show-dev-button="onShowDevButton"
13
- @restart-dev-tool="onRestartDevTool"
14
- @restart-app="onRestartAppWithConfirm"
15
- @clear-cache="onClearCache"
16
- @destroy-dev-tool="onDestroyDevTool" />
17
- <SettingNetwork
18
- :theme="theme"
19
- :net-work-status="netWorkStatus"
20
- :cache-intercept-config="cacheInterceptConfig"
21
- :cache-network-log="cacheNetworkLog"
22
- @change-cache-intercept-config="onChangeCacheInterceptConfig"
23
- @change-cache-network-log="onChangeCacheNetworkLog" />
24
- <SettingTheme
25
- :theme="theme"
26
- :use-transition="useTransition"
27
- :base-font-size="baseFontSize"
28
- :tag-font-size="tagFontSize"
29
- :tips-font-size="tipsFontSize"
30
- :font-family="fontFamily"
31
- :font-weight="fontWeight"
32
- @change-theme="onChangeTheme"
33
- @change-use-transition="onChangeUseTransition"
34
- @change-font="onChangeFont"
35
- @restart-app="onRestartAppWithConfirm" />
36
- <SettingInfo :theme="theme" @open-json="onOpenJson" />
37
- <SettingLog
38
- :theme="theme"
39
- :cache-console-log="cacheConsoleLog"
40
- @export-log="onExportLog"
41
- @change-cache-console-log="onChangeCacheConsoleLog" />
42
- </scroll-view>
43
- </template>
44
-
45
- <script lang="ts" setup>
46
- import SettingLanguage from './modules/SettingLanguage.vue';
47
- import SettingDevTool from './modules/SettingDevTool.vue';
48
- import SettingNetwork from './modules/SettingNetwork.vue';
49
- import SettingTheme from './modules/SettingTheme.vue';
50
- import SettingInfo from './modules/SettingInfo.vue';
51
- import SettingLog from './modules/SettingLog.vue';
52
-
53
- defineProps<{
54
- theme?: string; // Added theme prop here as per instruction for SettingLanguage
55
- devToolVisible?: boolean;
56
- sizeFormat?: string;
57
- cacheInterceptConfig?: boolean;
58
- cacheNetworkLog?: boolean;
59
- cacheConsoleLog?: boolean;
60
- useTransition?: boolean;
61
- baseFontSize?: number;
62
- tagFontSize?: number;
63
- tipsFontSize?: number;
64
- fontFamily?: string;
65
- fontWeight?: string;
66
- buildInfo?: {
67
- devToolVersion?: string;
68
- devToolBuildTime?: string;
69
- devToolGit?: string;
70
- };
71
- netWorkStatus: {
72
- isConnected?: boolean;
73
- networkType?: string;
74
- ip?: string;
75
- };
76
- contentHeight: number;
77
- }>();
78
-
79
- const emit = defineEmits<{
80
- (e: 'showDevButton', show: boolean): void;
81
- (e: 'restartDevTool'): void;
82
- (e: 'restartApp', confirm?: boolean): void;
83
- (e: 'exportLog', params: any): void;
84
- (e: 'clearCache'): void;
85
- (e: 'destroyDevTool'): void;
86
- (e: 'changeTheme', theme: string): void;
87
- (e: 'change-cache-intercept-config', value: boolean): void;
88
- (e: 'change-cache-network-log', value: boolean): void;
89
- (e: 'change-cache-console-log', value: boolean): void;
90
- (e: 'change-use-transition', value: boolean): void;
91
- (e: 'changeFont', data: any): void;
92
- (e: 'openJson', data: any): void;
93
- }>();
94
-
95
- function onShowDevButton(v: boolean) {
96
- emit('showDevButton', v);
97
- }
98
-
99
- function onRestartDevTool() {
100
- emit('restartDevTool');
101
- }
102
-
103
- function onRestartAppWithConfirm() {
104
- emit('restartApp', true);
105
- }
106
-
107
- function onClearCache() {
108
- emit('clearCache');
109
- }
110
-
111
- function onDestroyDevTool() {
112
- emit('destroyDevTool');
113
- }
114
-
115
- function onChangeCacheInterceptConfig(v: boolean) {
116
- emit('change-cache-intercept-config', v);
117
- }
118
-
119
- function onChangeCacheNetworkLog(v: boolean) {
120
- emit('change-cache-network-log', v);
121
- }
122
-
123
- function onChangeCacheConsoleLog(v: boolean) {
124
- emit('change-cache-console-log', v);
125
- }
126
-
127
- function onChangeTheme(v: string) {
128
- emit('changeTheme', v);
129
- }
130
-
131
- function onChangeUseTransition(v: boolean) {
132
- emit('change-use-transition', v);
133
- }
134
-
135
- function onChangeFont(v: any) {
136
- emit('changeFont', v);
137
- }
138
-
139
- function onOpenJson(v: any) {
140
- emit('openJson', v);
141
- }
142
-
143
- function onExportLog(v: any) {
144
- emit('exportLog', v);
145
- }
146
- </script>
147
-
148
- <style scoped>
149
- @import './index.css';
150
- </style>
1
+ <template>
2
+ <scroll-view
3
+ class="setting-content"
4
+ scroll-y
5
+ :style="{ height: contentHeight - 32 + 'px' }">
6
+ <SettingLanguage :theme="theme" @restart-app="onRestartAppWithConfirm" />
7
+ <SettingDevTool
8
+ :theme="theme"
9
+ :dev-tool-visible="devToolVisible"
10
+ :size-format="sizeFormat"
11
+ :build-info="buildInfo"
12
+ @show-dev-button="onShowDevButton"
13
+ @restart-dev-tool="onRestartDevTool"
14
+ @restart-app="onRestartAppWithConfirm"
15
+ @clear-cache="onClearCache"
16
+ @destroy-dev-tool="onDestroyDevTool" />
17
+ <SettingNetwork
18
+ :theme="theme"
19
+ :net-work-status="netWorkStatus"
20
+ :cache-intercept-config="cacheInterceptConfig"
21
+ :cache-network-log="cacheNetworkLog"
22
+ @change-cache-intercept-config="onChangeCacheInterceptConfig"
23
+ @change-cache-network-log="onChangeCacheNetworkLog" />
24
+ <SettingTheme
25
+ :theme="theme"
26
+ :use-transition="useTransition"
27
+ :base-font-size="baseFontSize"
28
+ :tag-font-size="tagFontSize"
29
+ :tips-font-size="tipsFontSize"
30
+ :font-family="fontFamily"
31
+ :font-weight="fontWeight"
32
+ @change-theme="onChangeTheme"
33
+ @change-use-transition="onChangeUseTransition"
34
+ @change-font="onChangeFont"
35
+ @restart-app="onRestartAppWithConfirm" />
36
+ <SettingInfo :theme="theme" @open-json="onOpenJson" />
37
+ <SettingLog
38
+ :theme="theme"
39
+ :cache-console-log="cacheConsoleLog"
40
+ @export-log="onExportLog"
41
+ @change-cache-console-log="onChangeCacheConsoleLog" />
42
+ <SettingBarrage
43
+ :theme="theme"
44
+ :barrage-visible="barrageVisible"
45
+ :barrage-max-tracks="barrageMaxTracks"
46
+ :barrage-track-height="barrageTrackHeight"
47
+ :barrage-start-top="barrageStartTop"
48
+ :barrage-duration="barrageDuration"
49
+ :barrage-max-length="barrageMaxLength"
50
+ :barrage-types="barrageTypes"
51
+ :barrage-show-when-open="barrageShowWhenOpen"
52
+ :sizeFormat="sizeFormat"
53
+ @change-barrage="onChangeBarrage"
54
+ @change-barrage-max-tracks="onChangeBarrageMaxTracks"
55
+ @change-barrage-track-height="onChangeBarrageTrackHeight"
56
+ @change-barrage-start-top="onChangeBarrageStartTop"
57
+ @change-barrage-duration="onChangeBarrageDuration"
58
+ @change-barrage-max-length="onChangeBarrageMaxLength"
59
+ @change-barrage-types="onChangeBarrageTypes"
60
+ @change-barrage-show-when-open="onChangeBarrageShowWhenOpen" />
61
+ </scroll-view>
62
+ </template>
63
+
64
+ <script lang="ts" setup>
65
+ import SettingLanguage from './modules/SettingLanguage.vue';
66
+ import SettingDevTool from './modules/SettingDevTool.vue';
67
+ import SettingNetwork from './modules/SettingNetwork.vue';
68
+ import SettingTheme from './modules/SettingTheme.vue';
69
+ import SettingInfo from './modules/SettingInfo.vue';
70
+ import SettingLog from './modules/SettingLog.vue';
71
+ import SettingBarrage from './modules/SettingBarrage.vue';
72
+
73
+ defineProps<{
74
+ theme?: string; // Added theme prop here as per instruction for SettingLanguage
75
+ devToolVisible?: boolean;
76
+ sizeFormat?: string;
77
+ cacheInterceptConfig?: boolean;
78
+ cacheNetworkLog?: boolean;
79
+ cacheConsoleLog?: boolean;
80
+ barrageVisible?: boolean;
81
+ useTransition?: boolean;
82
+ baseFontSize?: number;
83
+ tagFontSize?: number;
84
+ tipsFontSize?: number;
85
+ fontFamily?: string;
86
+ fontWeight?: string;
87
+ barrageMaxTracks?: number; // 新增
88
+ barrageTrackHeight?: number; // 新增
89
+ barrageStartTop?: number; // 新增
90
+ barrageDuration?: number; // 时长
91
+ barrageMaxLength?: number; // 长度
92
+ barrageTypes?: string[]; // 类型
93
+ barrageShowWhenOpen?: boolean;
94
+ buildInfo?: {
95
+ devToolVersion?: string;
96
+ devToolBuildTime?: string;
97
+ devToolGit?: string;
98
+ };
99
+ netWorkStatus: {
100
+ isConnected?: boolean;
101
+ networkType?: string;
102
+ ip?: string;
103
+ };
104
+ contentHeight: number;
105
+ }>();
106
+
107
+ const emit = defineEmits<{
108
+ (e: 'showDevButton', show: boolean): void;
109
+ (e: 'restartDevTool'): void;
110
+ (e: 'restartApp', confirm?: boolean): void;
111
+ (e: 'exportLog', params: any): void;
112
+ (e: 'clearCache'): void;
113
+ (e: 'destroyDevTool'): void;
114
+ (e: 'changeTheme', theme: string): void;
115
+ (e: 'change-cache-intercept-config', value: boolean): void;
116
+ (e: 'change-cache-network-log', value: boolean): void;
117
+ (e: 'change-cache-console-log', value: boolean): void;
118
+ (e: 'change-barrage', value: boolean): void;
119
+ (e: 'change-barrage-max-tracks', value: number): void;
120
+ (e: 'change-barrage-track-height', value: number): void;
121
+ (e: 'change-barrage-start-top', value: number): void;
122
+ (e: 'change-barrage-duration', value: number): void;
123
+ (e: 'change-barrage-max-length', value: number): void;
124
+ (e: 'change-barrage-types', value: string[]): void;
125
+ (e: 'change-barrage-show-when-open', value: boolean): void;
126
+ (e: 'change-use-transition', value: boolean): void;
127
+ (e: 'changeFont', data: any): void;
128
+ (e: 'openJson', data: any): void;
129
+ }>();
130
+
131
+ function onShowDevButton(v: boolean) {
132
+ emit('showDevButton', v);
133
+ }
134
+
135
+ function onRestartDevTool() {
136
+ emit('restartDevTool');
137
+ }
138
+
139
+ function onRestartAppWithConfirm() {
140
+ emit('restartApp', true);
141
+ }
142
+
143
+ function onClearCache() {
144
+ emit('clearCache');
145
+ }
146
+
147
+ function onDestroyDevTool() {
148
+ emit('destroyDevTool');
149
+ }
150
+
151
+ function onChangeCacheInterceptConfig(v: boolean) {
152
+ emit('change-cache-intercept-config', v);
153
+ }
154
+
155
+ function onChangeCacheNetworkLog(v: boolean) {
156
+ emit('change-cache-network-log', v);
157
+ }
158
+
159
+ function onChangeCacheConsoleLog(v: boolean) {
160
+ emit('change-cache-console-log', v);
161
+ }
162
+
163
+ function onChangeBarrageDuration(v: number) {
164
+ emit('change-barrage-duration', v);
165
+ }
166
+
167
+ function onChangeBarrageMaxLength(v: number) {
168
+ emit('change-barrage-max-length', v);
169
+ }
170
+
171
+ function onChangeBarrageTypes(v: string[]) {
172
+ emit('change-barrage-types', v);
173
+ }
174
+
175
+ function onChangeBarrageShowWhenOpen(v: boolean) {
176
+ emit('change-barrage-show-when-open', v);
177
+ }
178
+
179
+ function onChangeBarrage(v: boolean) {
180
+ emit('change-barrage', v);
181
+ }
182
+
183
+ function onChangeBarrageMaxTracks(v: number) {
184
+ emit('change-barrage-max-tracks', v);
185
+ }
186
+
187
+ function onChangeBarrageTrackHeight(v: number) {
188
+ emit('change-barrage-track-height', v);
189
+ }
190
+
191
+ function onChangeBarrageStartTop(v: number) {
192
+ emit('change-barrage-start-top', v);
193
+ }
194
+
195
+ function onChangeTheme(v: string) {
196
+ emit('changeTheme', v);
197
+ }
198
+
199
+ function onChangeUseTransition(v: boolean) {
200
+ emit('change-use-transition', v);
201
+ }
202
+
203
+ function onChangeFont(v: any) {
204
+ emit('changeFont', v);
205
+ }
206
+
207
+ function onOpenJson(v: any) {
208
+ emit('openJson', v);
209
+ }
210
+
211
+ function onExportLog(v: any) {
212
+ emit('exportLog', v);
213
+ }
214
+ </script>
215
+
216
+ <style scoped>
217
+ @import './index.css';
218
+ </style>
@@ -0,0 +1,304 @@
1
+ <template>
2
+ <view class="setting-item" :class="theme">
3
+ <DevToolTitle>{{ t('common.barrage') }}</DevToolTitle>
4
+ <view class="setting-item-content">
5
+ <!-- 开启弹幕 -->
6
+ <view class="setting-row">
7
+ <view class="setting-label">{{ t('common.enableBarrage') }}</view>
8
+ <switch
9
+ :checked="barrageVisible"
10
+ @change="onBarrageChange"
11
+ color="var(--dev-tool-main-color)"
12
+ style="transform: scale(0.7)" />
13
+ </view>
14
+
15
+ <!-- 主窗口打开时显示 -->
16
+ <view v-if="barrageVisible" class="setting-row">
17
+ <view class="setting-label">{{ t('common.barrageShowWhenOpen') }}</view>
18
+ <switch
19
+ :checked="barrageShowWhenOpen"
20
+ @change="onBarrageShowWhenOpenChange"
21
+ color="var(--dev-tool-main-color)"
22
+ style="transform: scale(0.7)" />
23
+ </view>
24
+
25
+ <view v-if="barrageVisible" class="barrage-advanced">
26
+ <!-- 轨道数量 -->
27
+ <view class="setting-row-group">
28
+ <view class="setting-row-header">
29
+ <view class="setting-label">
30
+ {{ t('common.barrageMaxTracks') }}
31
+ </view>
32
+ <view class="setting-value">{{ barrageMaxTracks }}</view>
33
+ </view>
34
+ <slider
35
+ class="barrage-slider"
36
+ :value="barrageMaxTracks"
37
+ min="1"
38
+ max="20"
39
+ step="1"
40
+ activeColor="var(--dev-tool-main-color)"
41
+ backgroundColor="var(--dev-tool-border-color)"
42
+ block-size="16"
43
+ @change="onMaxTracksChange" />
44
+ </view>
45
+
46
+ <!-- 轨道高度 -->
47
+ <view class="setting-row-group">
48
+ <view class="setting-row-header">
49
+ <view class="setting-label">
50
+ {{ t('common.barrageTrackHeight') }}
51
+ </view>
52
+ <view class="setting-value">{{ barrageTrackHeight }}px</view>
53
+ </view>
54
+ <slider
55
+ class="barrage-slider"
56
+ :value="barrageTrackHeight"
57
+ min="20"
58
+ max="60"
59
+ step="2"
60
+ activeColor="var(--dev-tool-main-color)"
61
+ backgroundColor="var(--dev-tool-border-color)"
62
+ block-size="16"
63
+ @change="onTrackHeightChange" />
64
+ </view>
65
+
66
+ <!-- 起始高度 -->
67
+ <view class="setting-row-group">
68
+ <view class="setting-row-header">
69
+ <view class="setting-label">{{ t('common.barrageStartTop') }}</view>
70
+ <view class="setting-value">{{ barrageStartTop }}px</view>
71
+ </view>
72
+ <slider
73
+ class="barrage-slider"
74
+ :value="barrageStartTop"
75
+ min="0"
76
+ max="200"
77
+ step="5"
78
+ activeColor="var(--dev-tool-main-color)"
79
+ backgroundColor="var(--dev-tool-border-color)"
80
+ block-size="16"
81
+ @change="onStartTopChange" />
82
+ </view>
83
+
84
+ <!-- 弹幕停留时长 -->
85
+ <view class="setting-row-group">
86
+ <view class="setting-row-header">
87
+ <view class="setting-label">{{ t('common.barrageDuration') }}</view>
88
+ <view class="setting-value">{{ barrageDuration }}s</view>
89
+ </view>
90
+ <slider
91
+ class="barrage-slider"
92
+ :value="barrageDuration"
93
+ min="3"
94
+ max="20"
95
+ step="1"
96
+ activeColor="var(--dev-tool-main-color)"
97
+ backgroundColor="var(--dev-tool-border-color)"
98
+ block-size="16"
99
+ @change="onDurationChange" />
100
+ </view>
101
+
102
+ <!-- 弹幕文字截断长度 -->
103
+ <view class="setting-row-group">
104
+ <view class="setting-row-header">
105
+ <view class="setting-label">
106
+ {{ t('common.barrageMaxLength') }}
107
+ </view>
108
+ <view class="setting-value">{{ barrageMaxLength }}</view>
109
+ </view>
110
+ <slider
111
+ class="barrage-slider"
112
+ :value="barrageMaxLength"
113
+ min="10"
114
+ max="500"
115
+ step="10"
116
+ activeColor="var(--dev-tool-main-color)"
117
+ backgroundColor="var(--dev-tool-border-color)"
118
+ block-size="16"
119
+ @change="onMaxLengthChange" />
120
+ </view>
121
+
122
+ <!-- 显示类型 -->
123
+ <view class="setting-row-group">
124
+ <view class="setting-row-header">
125
+ <view class="setting-label">{{ t('common.barrageTypes') }}</view>
126
+ </view>
127
+ <checkbox-group class="type-checkbox-group" @change="onTypesChange">
128
+ <label
129
+ v-for="item in allTypes"
130
+ :key="item"
131
+ class="type-checkbox-item">
132
+ <checkbox
133
+ :value="item"
134
+ :checked="(barrageTypes || []).includes(item)"
135
+ color="var(--dev-tool-main-color)"
136
+ style="transform: scale(0.8)" />
137
+ <text class="type-checkbox-label">{{ item }}</text>
138
+ </label>
139
+ </checkbox-group>
140
+ </view>
141
+ </view>
142
+ </view>
143
+ </view>
144
+ </template>
145
+
146
+ <script lang="ts" setup>
147
+ import { useI18n } from '../../../../../i18n';
148
+ import DevToolTitle from '../../DevToolTitle/index.vue';
149
+
150
+ const { t } = useI18n();
151
+
152
+ const props = defineProps<{
153
+ theme?: string;
154
+ barrageVisible?: boolean;
155
+ barrageMaxTracks?: number;
156
+ barrageTrackHeight?: number;
157
+ barrageStartTop?: number;
158
+ barrageDuration?: number;
159
+ barrageMaxLength?: number;
160
+ barrageTypes?: string[];
161
+ barrageShowWhenOpen?: boolean;
162
+ }>();
163
+
164
+ const emit = defineEmits<{
165
+ (e: 'change-barrage', value: boolean): void;
166
+ (e: 'change-barrage-max-tracks', value: number): void;
167
+ (e: 'change-barrage-track-height', value: number): void;
168
+ (e: 'change-barrage-start-top', value: number): void;
169
+ (e: 'change-barrage-duration', value: number): void;
170
+ (e: 'change-barrage-max-length', value: number): void;
171
+ (e: 'change-barrage-types', value: string[]): void;
172
+ (e: 'change-barrage-show-when-open', value: boolean): void;
173
+ }>();
174
+
175
+ const allTypes = [
176
+ 'log',
177
+ 'info',
178
+ 'warn',
179
+ 'error',
180
+ 'network',
181
+ 'transfer',
182
+ 'websocket',
183
+ ];
184
+
185
+ function onBarrageChange(e: any) {
186
+ emit('change-barrage', e.detail.value);
187
+ }
188
+
189
+ function onBarrageShowWhenOpenChange(e: any) {
190
+ emit('change-barrage-show-when-open', !!e.detail.value);
191
+ }
192
+
193
+ function onMaxTracksChange(e: any) {
194
+ emit('change-barrage-max-tracks', e.detail.value);
195
+ }
196
+
197
+ function onTrackHeightChange(e: any) {
198
+ emit('change-barrage-track-height', e.detail.value);
199
+ }
200
+
201
+ function onStartTopChange(e: any) {
202
+ emit('change-barrage-start-top', e.detail.value);
203
+ }
204
+
205
+ function onDurationChange(e: any) {
206
+ emit('change-barrage-duration', e.detail.value);
207
+ }
208
+
209
+ function onMaxLengthChange(e: any) {
210
+ emit('change-barrage-max-length', e.detail.value);
211
+ }
212
+
213
+ function onTypesChange(e: any) {
214
+ let values = e.detail.value;
215
+ // 如果全部取消,至少保留一个之前的
216
+ if (
217
+ values.length === 0 &&
218
+ props.barrageTypes &&
219
+ props.barrageTypes.length > 0
220
+ ) {
221
+ // 这里可以根据需求决定是否强制保留,暂时跟随用户操作
222
+ }
223
+ emit('change-barrage-types', values);
224
+ }
225
+ </script>
226
+
227
+ <style scoped>
228
+ .setting-item {
229
+ padding: 12px 16px;
230
+ border-bottom: 1px solid var(--dev-tool-border-color);
231
+ }
232
+
233
+ .setting-item-header {
234
+ margin-bottom: 12px;
235
+ }
236
+
237
+ .setting-item-title {
238
+ font-size: 14px;
239
+ font-weight: bold;
240
+ color: var(--dev-tool-text-color);
241
+ }
242
+
243
+ .barrage-advanced {
244
+ margin-top: 8px;
245
+ padding-top: 8px;
246
+ border-top: 1px dashed var(--dev-tool-border-color);
247
+ }
248
+
249
+ .setting-row {
250
+ display: flex;
251
+ justify-content: space-between;
252
+ align-items: center;
253
+ height: 36px;
254
+ }
255
+
256
+ .setting-row-group {
257
+ margin-top: 12px;
258
+ }
259
+
260
+ .setting-row-header {
261
+ display: flex;
262
+ justify-content: space-between;
263
+ align-items: center;
264
+ margin-bottom: 4px;
265
+ }
266
+
267
+ .setting-label {
268
+ font-size: 12px;
269
+ color: var(--dev-tool-text-color-secondary);
270
+ }
271
+
272
+ .setting-value {
273
+ font-size: 12px;
274
+ font-weight: 500;
275
+ color: var(--dev-tool-main-color);
276
+ background: rgb(0 122 255 / 10%);
277
+ padding: 2px 6px;
278
+ border-radius: 4px;
279
+ }
280
+
281
+ .barrage-slider {
282
+ margin: 0;
283
+ padding: 8px 0;
284
+ }
285
+
286
+ .type-checkbox-group {
287
+ display: flex;
288
+ flex-wrap: wrap;
289
+ gap: 12px;
290
+ margin-top: 8px;
291
+ }
292
+
293
+ .type-checkbox-item {
294
+ display: flex;
295
+ align-items: center;
296
+ margin-right: 4px;
297
+ }
298
+
299
+ .type-checkbox-label {
300
+ font-size: 12px;
301
+ color: var(--dev-tool-text-color);
302
+ margin-left: -4px;
303
+ }
304
+ </style>