vite-uni-dev-tool 1.0.0 → 1.2.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 +54 -0
- package/dist/const.cjs +1 -1
- package/dist/const.d.ts +13 -0
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +1 -1
- package/dist/core-shared.d.ts +1 -1
- package/dist/core-shared.d.ts.map +1 -1
- package/dist/core-shared.js +1 -1
- package/dist/core.d.ts +10 -3
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +2 -2
- package/dist/i18n/locales/en.cjs +1 -1
- package/dist/i18n/locales/en.d.ts +86 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/zh-Hans.cjs +1 -1
- package/dist/i18n/locales/zh-Hans.d.ts +87 -1
- package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
- package/dist/i18n/locales/zh-Hans.js +1 -1
- package/dist/modules/devConsole/index.cjs +1 -1
- package/dist/modules/devConsole/index.js +3 -3
- package/dist/modules/devEvent/index.cjs +3 -3
- package/dist/modules/devEvent/index.d.ts +1 -0
- package/dist/modules/devEvent/index.d.ts.map +1 -1
- package/dist/modules/devEvent/index.js +3 -3
- package/dist/modules/devIntercept/index.cjs +14 -13
- package/dist/modules/devIntercept/index.d.ts +20 -1
- package/dist/modules/devIntercept/index.d.ts.map +1 -1
- package/dist/modules/devIntercept/index.js +14 -13
- package/dist/modules/devStore/index.cjs +1 -1
- package/dist/modules/devStore/index.d.ts +21 -0
- package/dist/modules/devStore/index.d.ts.map +1 -1
- package/dist/modules/devStore/index.js +1 -1
- package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -3
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts +2 -1
- 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 +31 -25
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +2 -1
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
- 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 -1
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
- package/dist/type.d.ts +50 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/utils/language.cjs +1 -1
- package/dist/utils/language.d.ts.map +1 -1
- package/dist/utils/language.js +1 -1
- package/dist/utils/object.cjs +1 -1
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +1 -1
- package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -0
- package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -0
- package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -0
- package/dist/v3/{CaptureScreen → DevTool/components/CaptureScreen}/index.vue +4 -4
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/ConsoleItem.vue +22 -16
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/RunJSInput.vue +4 -6
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/index.vue +21 -10
- package/dist/v3/{DevToolButton → DevTool/components/DevToolButton}/index.vue +7 -4
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/DevToolOverlay.vue +17 -2
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/const.ts +28 -5
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/dataUtils.ts +1 -1
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolData.ts +55 -6
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolHandlers.ts +85 -5
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolOverlay.ts +25 -8
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.vue +67 -16
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/ElEventItem.vue +3 -3
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/index.vue +10 -13
- package/dist/v3/{Instance → DevTool/components/Instance}/index.vue +1 -1
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTree.ts +1 -1
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTreeCtx.ts +1 -1
- package/dist/v3/{InstanceDetail → DevTool/components/InstanceDetail}/index.vue +4 -4
- package/dist/v3/{JsonDetail → DevTool/components/JsonDetail}/index.vue +4 -4
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCItem.vue +4 -5
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCTool.vue +33 -57
- package/dist/v3/{NFCList → DevTool/components/NFCList}/index.vue +12 -16
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptConfig.vue +20 -4
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptItem.vue +3 -3
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkDetail.vue +18 -27
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkIntercept.vue +11 -16
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkItem.vue +10 -14
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkSend.vue +67 -34
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/index.vue +8 -8
- package/dist/v3/{Performance → DevTool/components/Performance}/index.vue +7 -4
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceWidget.vue +12 -9
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceChart.ts +1 -1
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceData.ts +2 -2
- package/dist/v3/{PiniaList → DevTool/components/PiniaList}/index.vue +5 -6
- package/dist/v3/{RouteList → DevTool/components/RouteList}/index.vue +21 -24
- package/dist/v3/{RunJS → DevTool/components/RunJS}/index.vue +3 -3
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/ScanCodeItem.vue +3 -4
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/index.vue +12 -16
- package/dist/v3/{SettingList → DevTool/components/SettingList}/index.vue +68 -0
- package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -0
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingDevTool.vue +8 -4
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingInfo.vue +47 -9
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLanguage.vue +2 -2
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLog.vue +2 -2
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingNetwork.vue +3 -3
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingTheme.vue +37 -7
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/Line.vue +22 -11
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/index.vue +8 -8
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/parseCode.ts +136 -228
- package/dist/v3/{StorageList → DevTool/components/StorageList}/index.vue +7 -7
- package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferDetail.vue +6 -6
- package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferItem.vue +4 -4
- package/dist/v3/{TransferList → DevTool/components/TransferList}/index.vue +8 -8
- package/dist/v3/{UniEvent → DevTool/components/UniEvent}/UniEventItem.vue +6 -7
- package/dist/v3/{UniEvent → DevTool/components/UniEvent}/index.vue +6 -6
- package/dist/v3/{VuexList → DevTool/components/VuexList}/index.vue +3 -3
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketDetail.vue +8 -8
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketItem.vue +4 -4
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/index.vue +8 -8
- package/dist/v3/DevTool/index.vue +179 -4
- package/dist/v3/{AppTransition → components/AppTransition}/index.vue +6 -0
- package/dist/v3/components/Barrage/BarrageItem.vue +137 -0
- package/dist/v3/components/Barrage/index.vue +202 -0
- package/dist/v3/components/DevErrorBoundary/index.vue +380 -0
- package/dist/v3/{DraggableContainer → components/DraggableContainer}/index.vue +1 -1
- package/dist/v3/{FilterInput → components/FilterInput}/index.vue +1 -1
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/CheckController/index.vue +1 -1
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/TreeNode/index.vue +11 -5
- package/dist/v3/{JsonPretty → components/JsonPretty}/index.vue +16 -13
- package/dist/v3/{JsonPretty → components/JsonPretty}/type.ts +1 -0
- package/dist/v3/{JsonPretty → components/JsonPretty}/utils/index.ts +1 -1
- package/dist/v3/{MovableContainer → components/MovableContainer}/index.vue +9 -5
- package/dist/v3/{Pick → components/Pick}/index.vue +1 -1
- package/dist/v3/{Tabs → components/Tabs}/index.vue +30 -4
- package/dist/v3/{VirtualList → components/VirtualList}/AutoSize.vue +1 -1
- package/dist/v3/{VirtualList → components/VirtualList}/index.vue +4 -0
- package/dist/v3/hooks/useBluetooth/index.ts +561 -0
- package/dist/v3/hooks/useRequest/index.ts +33 -20
- package/dist/v3/hooks/useWebsocket/README.md +79 -0
- package/dist/v3/hooks/useWebsocket/index.ts +253 -0
- package/dist/v3/styles/theme.css +17 -10
- package/package.json +67 -64
- package/dist/plugins/uniParseStock/index.d.ts +0 -10
- package/dist/plugins/uniParseStock/index.d.ts.map +0 -1
- /package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/staticTips.ts +0 -0
- /package/dist/v3/{DevToolTitle → DevTool/components/DevToolTitle}/index.vue +0 -0
- /package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.css +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/components/InstanceTreeNode.vue +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/flatten.ts +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/registry.ts +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/typing.d.ts +0 -0
- /package/dist/v3/{NFCList → DevTool/components/NFCList}/const.ts +0 -0
- /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/const.ts +0 -0
- /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/hooks/useNetworkForm.ts +0 -0
- /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/utils.ts +0 -0
- /package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceMetrics.vue +0 -0
- /package/dist/v3/{SettingButton → DevTool/components/SettingButton}/index.vue +0 -0
- /package/dist/v3/{SettingList → DevTool/components/SettingList}/index.css +0 -0
- /package/dist/v3/{SettingList → DevTool/components/SettingList}/typing.d.ts +0 -0
- /package/dist/v3/{AutoSizer → components/AutoSizer}/index.vue +0 -0
- /package/dist/v3/{AutoSizer → components/AutoSizer}/index1.vue +0 -0
- /package/dist/v3/{AutoSizer → components/AutoSizer}/utils.ts +0 -0
- /package/dist/v3/{CircularButton → components/CircularButton}/index.vue +0 -0
- /package/dist/v3/{CustomSwiper → components/CustomSwiper}/CustomSwiperItem.vue +0 -0
- /package/dist/v3/{CustomSwiper → components/CustomSwiper}/index.vue +0 -0
- /package/dist/v3/{Empty → components/Empty}/empty.png +0 -0
- /package/dist/v3/{Empty → components/Empty}/index.vue +0 -0
- /package/dist/v3/{FilterSelect → components/FilterSelect}/index.vue +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/components/Brackets/index.vue +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/components/Carets/index.vue +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useClipboard.ts +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useError.ts +0 -0
- /package/dist/v3/{Tag → components/Tag}/index.vue +0 -0
- /package/dist/v3/{VirtualList → components/VirtualList}/readme.md +0 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<slot v-if="!hasError"></slot>
|
|
3
|
+
<view v-else class="dev-error-boundary">
|
|
4
|
+
<view class="dev-error-card">
|
|
5
|
+
<view class="dev-error-header">
|
|
6
|
+
<view class="dev-error-icon-wrapper">
|
|
7
|
+
<view class="dev-error-icon">!</view>
|
|
8
|
+
<view class="dev-error-icon-pulse"></view>
|
|
9
|
+
</view>
|
|
10
|
+
<view class="dev-error-title-box">
|
|
11
|
+
<text class="dev-error-title">{{ t('errorBoundary.title') }}</text>
|
|
12
|
+
<text class="dev-error-subtitle">Runtime Exception Isolated</text>
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
|
|
16
|
+
<view class="dev-error-body">
|
|
17
|
+
<view class="dev-error-msg-container">
|
|
18
|
+
<view class="dev-error-msg-header">
|
|
19
|
+
<text class="dev-error-msg-label">StackTrace</text>
|
|
20
|
+
<view class="dev-error-copy" @tap="copyError">
|
|
21
|
+
<text class="dev-error-copy-text">Copy</text>
|
|
22
|
+
</view>
|
|
23
|
+
</view>
|
|
24
|
+
<scroll-view scroll-y class="dev-error-msg-box">
|
|
25
|
+
<text class="dev-error-msg">{{ errorMessage }}</text>
|
|
26
|
+
</scroll-view>
|
|
27
|
+
</view>
|
|
28
|
+
<view class="dev-error-tips-box">
|
|
29
|
+
<view class="dev-error-tips-dot"></view>
|
|
30
|
+
<text class="dev-error-tips">{{ t('errorBoundary.tips') }}</text>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
|
|
34
|
+
<view class="dev-error-footer">
|
|
35
|
+
<view class="dev-error-btn-retry" @tap="retry">
|
|
36
|
+
<text class="dev-error-btn-text">{{ t('errorBoundary.retry') }}</text>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
40
|
+
|
|
41
|
+
<!-- Subtle background decoration -->
|
|
42
|
+
<view class="dev-error-bg-circle-1"></view>
|
|
43
|
+
<view class="dev-error-bg-circle-2"></view>
|
|
44
|
+
</view>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { ref, onErrorCaptured, onMounted, onUnmounted, nextTick } from 'vue';
|
|
49
|
+
import { i18n } from '../../../i18n/instance';
|
|
50
|
+
import { DEV_ERROR_BOUNDARY_TRIGGER } from '../../../const';
|
|
51
|
+
import { getCurrentPagePath } from '../../../utils';
|
|
52
|
+
|
|
53
|
+
const t = (key: string) => i18n.t(key);
|
|
54
|
+
|
|
55
|
+
const hasError = ref(false);
|
|
56
|
+
const errorMessage = ref('');
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 处理错误的核心逻辑
|
|
60
|
+
*/
|
|
61
|
+
const handleError = (err: any, info?: string) => {
|
|
62
|
+
if (hasError.value) return; // 状态锁,防止重复处理
|
|
63
|
+
|
|
64
|
+
console.log('[DevTool] Boundary Handling Error:', err?.message || err);
|
|
65
|
+
hasError.value = true;
|
|
66
|
+
errorMessage.value =
|
|
67
|
+
err?.stack || err?.message || err?.toString() || 'Unknown Error';
|
|
68
|
+
|
|
69
|
+
// 手动打印到控制台
|
|
70
|
+
console.error(`[ErrorBoundary]`, err);
|
|
71
|
+
if (info) console.warn(`[ErrorBoundary] Info: ${info}`);
|
|
72
|
+
|
|
73
|
+
// 强制下一帧显示
|
|
74
|
+
nextTick(() => {
|
|
75
|
+
hasError.value = true;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
// #ifndef H5
|
|
81
|
+
// 在非 H5 环境(小程序、APP),由于 onErrorCaptured 可能失效,启用全局监听作为核心捕获方案
|
|
82
|
+
const mountedPath = getCurrentPagePath();
|
|
83
|
+
uni.$on(DEV_ERROR_BOUNDARY_TRIGGER, (data: any) => {
|
|
84
|
+
const currentPath = getCurrentPagePath();
|
|
85
|
+
if (currentPath === mountedPath && !hasError.value) {
|
|
86
|
+
handleError(data.err, data.info);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
// #endif
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
onUnmounted(() => {
|
|
93
|
+
// #ifndef H5
|
|
94
|
+
uni.$off(DEV_ERROR_BOUNDARY_TRIGGER);
|
|
95
|
+
// #endif
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
onErrorCaptured((err: any, _instance: any, info: string) => {
|
|
99
|
+
// 在 H5 环境,onErrorCaptured 通常能可靠工作
|
|
100
|
+
// 在其它环境,它可能与全局拦截器同时生效,handleError 内部已有 hasError 锁定
|
|
101
|
+
handleError(err, info);
|
|
102
|
+
// 阻止错误继续向上冒泡,防止触发全局拦截器产生的二次 emit
|
|
103
|
+
return false;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const retry = () => {
|
|
107
|
+
hasError.value = false;
|
|
108
|
+
errorMessage.value = '';
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const copyError = () => {
|
|
112
|
+
uni.setClipboardData({
|
|
113
|
+
data: errorMessage.value,
|
|
114
|
+
success: () => {
|
|
115
|
+
uni.showToast({
|
|
116
|
+
title: 'Copied to clipboard',
|
|
117
|
+
icon: 'none',
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
defineExpose({
|
|
124
|
+
retry,
|
|
125
|
+
});
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<style scoped>
|
|
129
|
+
.dev-error-boundary {
|
|
130
|
+
position: fixed;
|
|
131
|
+
inset: 0;
|
|
132
|
+
z-index: 995;
|
|
133
|
+
width: 100vw;
|
|
134
|
+
height: 100vh;
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
padding: 80rpx 40rpx;
|
|
140
|
+
background-color: #f6f8fa;
|
|
141
|
+
box-sizing: border-box;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Background elements for premium feel */
|
|
146
|
+
.dev-error-bg-circle-1 {
|
|
147
|
+
position: absolute;
|
|
148
|
+
width: 400rpx;
|
|
149
|
+
height: 400rpx;
|
|
150
|
+
border-radius: 50%;
|
|
151
|
+
background: radial-gradient(circle, rgb(255 77 79 / 5%) 0%, transparent 70%);
|
|
152
|
+
top: -100rpx;
|
|
153
|
+
right: -100rpx;
|
|
154
|
+
z-index: 1;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.dev-error-bg-circle-2 {
|
|
158
|
+
position: absolute;
|
|
159
|
+
width: 300rpx;
|
|
160
|
+
height: 300rpx;
|
|
161
|
+
border-radius: 50%;
|
|
162
|
+
background: radial-gradient(circle, rgb(24 144 255 / 5%) 0%, transparent 70%);
|
|
163
|
+
bottom: -50rpx;
|
|
164
|
+
left: -50rpx;
|
|
165
|
+
z-index: 1;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.dev-error-card {
|
|
169
|
+
background-color: rgb(255 255 255 / 95%);
|
|
170
|
+
backdrop-filter: blur(10px);
|
|
171
|
+
border-radius: 32rpx;
|
|
172
|
+
box-shadow:
|
|
173
|
+
0 10rpx 30rpx rgb(0 0 0 / 4%),
|
|
174
|
+
0 30rpx 100rpx rgb(0 0 0 / 8%);
|
|
175
|
+
width: 100%;
|
|
176
|
+
max-width: 680rpx;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
border: 1rpx solid rgb(255 255 255 / 80%);
|
|
179
|
+
animation: dev-premium-entrance 0.6s cubic-bezier(0.16, 1, 0.3, 1);
|
|
180
|
+
z-index: 2;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@keyframes dev-premium-entrance {
|
|
184
|
+
from {
|
|
185
|
+
opacity: 0;
|
|
186
|
+
transform: scale(0.95) translateY(40rpx);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
to {
|
|
190
|
+
opacity: 1;
|
|
191
|
+
transform: scale(1) translateY(0);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.dev-error-header {
|
|
196
|
+
display: flex;
|
|
197
|
+
align-items: center;
|
|
198
|
+
padding: 40rpx;
|
|
199
|
+
background: linear-gradient(135deg, #fff7f6 0%, #fff 100%);
|
|
200
|
+
border-bottom: 2rpx solid #f0f0f0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.dev-error-icon-wrapper {
|
|
204
|
+
position: relative;
|
|
205
|
+
width: 64rpx;
|
|
206
|
+
height: 64rpx;
|
|
207
|
+
background: linear-gradient(135deg, #ff7875 0%, #ff4d4f 100%);
|
|
208
|
+
border-radius: 20rpx;
|
|
209
|
+
display: flex;
|
|
210
|
+
align-items: center;
|
|
211
|
+
justify-content: center;
|
|
212
|
+
margin-right: 28rpx;
|
|
213
|
+
flex-shrink: 0;
|
|
214
|
+
box-shadow: 0 8rpx 20rpx rgb(255 77 79 / 25%);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.dev-error-icon {
|
|
218
|
+
color: #fff;
|
|
219
|
+
font-size: 36rpx;
|
|
220
|
+
font-weight: 900;
|
|
221
|
+
z-index: 3;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.dev-error-icon-pulse {
|
|
225
|
+
position: absolute;
|
|
226
|
+
width: 100%;
|
|
227
|
+
height: 100%;
|
|
228
|
+
background-color: #ff4d4f;
|
|
229
|
+
border-radius: 20rpx;
|
|
230
|
+
opacity: 0.4;
|
|
231
|
+
animation: dev-icon-pulse 2s infinite;
|
|
232
|
+
z-index: 2;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@keyframes dev-icon-pulse {
|
|
236
|
+
0% {
|
|
237
|
+
transform: scale(1);
|
|
238
|
+
opacity: 0.4;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
70% {
|
|
242
|
+
transform: scale(1.4);
|
|
243
|
+
opacity: 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
100% {
|
|
247
|
+
transform: scale(1);
|
|
248
|
+
opacity: 0;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.dev-error-title-box {
|
|
253
|
+
display: flex;
|
|
254
|
+
flex-direction: column;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.dev-error-title {
|
|
258
|
+
font-size: 34rpx;
|
|
259
|
+
font-weight: 700;
|
|
260
|
+
color: #1a1a1a;
|
|
261
|
+
letter-spacing: -0.5rpx;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.dev-error-subtitle {
|
|
265
|
+
font-size: 20rpx;
|
|
266
|
+
color: #ff4d4f;
|
|
267
|
+
text-transform: uppercase;
|
|
268
|
+
font-weight: 600;
|
|
269
|
+
letter-spacing: 1rpx;
|
|
270
|
+
margin-top: 4rpx;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.dev-error-body {
|
|
274
|
+
padding: 40rpx;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.dev-error-msg-container {
|
|
278
|
+
border-radius: 20rpx;
|
|
279
|
+
background-color: #141414;
|
|
280
|
+
overflow: hidden;
|
|
281
|
+
margin-bottom: 30rpx;
|
|
282
|
+
box-shadow: inset 0 2rpx 10rpx rgb(0 0 0 / 20%);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.dev-error-msg-header {
|
|
286
|
+
display: flex;
|
|
287
|
+
justify-content: space-between;
|
|
288
|
+
align-items: center;
|
|
289
|
+
padding: 16rpx 24rpx;
|
|
290
|
+
background-color: #1a1a1a;
|
|
291
|
+
border-bottom: 1rpx solid #2a2a2a;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.dev-error-msg-label {
|
|
295
|
+
color: #8c8c8c;
|
|
296
|
+
font-size: 20rpx;
|
|
297
|
+
font-weight: 600;
|
|
298
|
+
text-transform: uppercase;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.dev-error-copy {
|
|
302
|
+
padding: 4rpx 16rpx;
|
|
303
|
+
background-color: #333;
|
|
304
|
+
border-radius: 8rpx;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.dev-error-copy:active {
|
|
308
|
+
background-color: #444;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.dev-error-copy-text {
|
|
312
|
+
color: #d9d9d9;
|
|
313
|
+
font-size: 20rpx;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.dev-error-msg-box {
|
|
317
|
+
padding: 24rpx;
|
|
318
|
+
max-height: 360rpx;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.dev-error-msg {
|
|
322
|
+
font-size: 22rpx;
|
|
323
|
+
color: #ff7875;
|
|
324
|
+
font-family:
|
|
325
|
+
'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
|
|
326
|
+
word-break: break-all;
|
|
327
|
+
line-height: 1.6;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.dev-error-tips-box {
|
|
331
|
+
display: flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
background-color: #fffaf0;
|
|
334
|
+
padding: 20rpx 24rpx;
|
|
335
|
+
border-radius: 12rpx;
|
|
336
|
+
border: 1rpx solid #ffe58f;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.dev-error-tips-dot {
|
|
340
|
+
width: 10rpx;
|
|
341
|
+
height: 10rpx;
|
|
342
|
+
background-color: #faad14;
|
|
343
|
+
border-radius: 50%;
|
|
344
|
+
margin-right: 16rpx;
|
|
345
|
+
flex-shrink: 0;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.dev-error-tips {
|
|
349
|
+
font-size: 24rpx;
|
|
350
|
+
color: #856404;
|
|
351
|
+
line-height: 1.4;
|
|
352
|
+
flex: 1;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.dev-error-footer {
|
|
356
|
+
padding: 0 40rpx 50rpx;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.dev-error-btn-retry {
|
|
360
|
+
background: linear-gradient(135deg, #40a9ff 0%, #1890ff 100%);
|
|
361
|
+
height: 88rpx;
|
|
362
|
+
border-radius: 44rpx;
|
|
363
|
+
display: flex;
|
|
364
|
+
align-items: center;
|
|
365
|
+
justify-content: center;
|
|
366
|
+
box-shadow: 0 8rpx 24rpx rgb(24 144 255 / 30%);
|
|
367
|
+
transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.dev-error-btn-retry:active {
|
|
371
|
+
transform: scale(0.95);
|
|
372
|
+
box-shadow: 0 4rpx 12rpx rgb(24 144 255 / 20%);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.dev-error-btn-text {
|
|
376
|
+
color: #fff;
|
|
377
|
+
font-size: 30rpx;
|
|
378
|
+
font-weight: 600;
|
|
379
|
+
}
|
|
380
|
+
</style>
|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
33
33
|
* 适用于 DevTool 窗口化及悬浮窗展示
|
|
34
34
|
*/
|
|
35
35
|
import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
|
|
36
|
-
import { debounce } from '
|
|
36
|
+
import { debounce } from '../../../utils';
|
|
37
37
|
|
|
38
38
|
const props = withDefaults(
|
|
39
39
|
defineProps<{
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</template>
|
|
31
31
|
<script lang="ts" setup>
|
|
32
32
|
import { computed } from 'vue';
|
|
33
|
-
import { getThemeMainColor } from '
|
|
33
|
+
import { getThemeMainColor } from '../../../../styles/theme';
|
|
34
34
|
const props = defineProps<{
|
|
35
35
|
theme?: string;
|
|
36
36
|
checked: boolean;
|
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
@click="handleNodeClick"
|
|
12
12
|
@mouseover="handleNodeMouseover"
|
|
13
13
|
:style="customStyle">
|
|
14
|
-
<view
|
|
14
|
+
<view
|
|
15
|
+
v-if="showLineNumber"
|
|
16
|
+
class="json-pretty-node-index"
|
|
17
|
+
:style="{
|
|
18
|
+
width: `${Number(node.total?.toString().length || 1) * 8 + 10}px`,
|
|
19
|
+
}">
|
|
15
20
|
{{ node.id + 1 }}
|
|
16
21
|
</view>
|
|
17
22
|
|
|
@@ -98,7 +103,7 @@ import Carets from '../Carets/index.vue';
|
|
|
98
103
|
import { getDataType, isFunction, stringToAutoType } from '../../utils';
|
|
99
104
|
|
|
100
105
|
import type { NodeDataType, TreeNodeProps } from '../../type';
|
|
101
|
-
import { getValueByPath } from '
|
|
106
|
+
import { getValueByPath } from '../../../../../utils';
|
|
102
107
|
|
|
103
108
|
const props = withDefaults(defineProps<TreeNodeProps>(), {
|
|
104
109
|
rootPath: 'root',
|
|
@@ -313,9 +318,10 @@ const handleCopy = () => {
|
|
|
313
318
|
}
|
|
314
319
|
|
|
315
320
|
.json-pretty-node-index {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
margin-right:
|
|
321
|
+
flex-shrink: 0;
|
|
322
|
+
text-align: right;
|
|
323
|
+
margin-right: 12px;
|
|
324
|
+
color: var(--json-pretty-comment-color);
|
|
319
325
|
user-select: none;
|
|
320
326
|
}
|
|
321
327
|
|
|
@@ -3,18 +3,10 @@
|
|
|
3
3
|
:class="{
|
|
4
4
|
'json-pretty-tree': true,
|
|
5
5
|
'is-virtual': virtual,
|
|
6
|
+
'show-line-number': showLineNumber,
|
|
6
7
|
dark: theme === 'dark',
|
|
7
8
|
}"
|
|
8
|
-
:style="
|
|
9
|
-
showLineNumber
|
|
10
|
-
? {
|
|
11
|
-
paddingLeft: `${
|
|
12
|
-
Number(originFlatData.length.toString().length) * 12
|
|
13
|
-
}px`,
|
|
14
|
-
...style,
|
|
15
|
-
}
|
|
16
|
-
: style
|
|
17
|
-
">
|
|
9
|
+
:style="style">
|
|
18
10
|
<Empty v-if="isEmpty" />
|
|
19
11
|
<VirtualList
|
|
20
12
|
v-else-if="autoVirtual"
|
|
@@ -132,7 +124,7 @@ import AutoSize from '../VirtualList/AutoSize.vue';
|
|
|
132
124
|
import { emitError, jsonFlatten, cloneDeep, isFunction } from './utils';
|
|
133
125
|
|
|
134
126
|
import type { NodeDataType, Tree } from './type';
|
|
135
|
-
import { setValueByPath } from '
|
|
127
|
+
import { setValueByPath } from '../../../utils';
|
|
136
128
|
import Empty from '../Empty/index.vue';
|
|
137
129
|
|
|
138
130
|
// 定义 emits 类型
|
|
@@ -174,10 +166,16 @@ const props = withDefaults(defineProps<Tree>(), {
|
|
|
174
166
|
});
|
|
175
167
|
const emits = defineEmits<Emits>();
|
|
176
168
|
|
|
177
|
-
const originFlatData = computed(() =>
|
|
169
|
+
const originFlatData = computed(() => {
|
|
170
|
+
const result = jsonFlatten(props.data, props.rootPath);
|
|
171
|
+
const total = result.length;
|
|
172
|
+
return result.map((item) => ({ ...item, total }));
|
|
173
|
+
});
|
|
178
174
|
|
|
179
175
|
const pageSize = computed(() => {
|
|
180
|
-
|
|
176
|
+
const h = typeof props.height === 'number' ? props.height : 400;
|
|
177
|
+
const ih = typeof props.itemHeight === 'number' ? props.itemHeight : 20;
|
|
178
|
+
return Math.ceil(h / ih) + 5;
|
|
181
179
|
});
|
|
182
180
|
|
|
183
181
|
// 初始化折叠路径
|
|
@@ -505,6 +503,11 @@ onUnmounted(() => {
|
|
|
505
503
|
overflow: auto;
|
|
506
504
|
position: relative;
|
|
507
505
|
width: 100%;
|
|
506
|
+
box-sizing: border-box;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.json-pretty-tree.show-line-number {
|
|
510
|
+
padding-left: 10px;
|
|
508
511
|
}
|
|
509
512
|
|
|
510
513
|
.json-pretty-tree.is-virtual {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
|
-
import { debounce } from '
|
|
16
|
+
import { debounce } from '../../../utils';
|
|
17
17
|
import { ref, computed, watch } from 'vue';
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(
|
|
@@ -51,12 +51,16 @@ watch([() => props.x, () => props.y], ([newX, newY]) => {
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
const areaStyle = computed(() => {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const style = (props.customStyle || {}) as any;
|
|
55
|
+
const { paddingBottom, paddingTop, ...rest } = style;
|
|
56
|
+
|
|
57
|
+
const top = parseInt(paddingTop) || 0;
|
|
58
|
+
const bottom = parseInt(paddingBottom) || 0;
|
|
59
|
+
|
|
56
60
|
return {
|
|
57
61
|
...rest,
|
|
58
|
-
top:
|
|
59
|
-
height: props.contentHeight + 'px',
|
|
62
|
+
top: top + 'px',
|
|
63
|
+
height: props.contentHeight + bottom + 'px',
|
|
60
64
|
position: 'fixed' as const,
|
|
61
65
|
left: 0,
|
|
62
66
|
width: '100vw',
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
:class="`tabs-item ${idx === modelValue ? 'tabs-item-active' : ''} `"
|
|
17
17
|
:id="`tabs-item-${idx}`"
|
|
18
18
|
@click="onChangeTabs(idx)">
|
|
19
|
-
|
|
19
|
+
<view class="tabs-item-content">
|
|
20
|
+
<text v-if="item.icon" class="tabs-item-icon">{{ item.icon }}</text>
|
|
21
|
+
<text>{{ item.label }}</text>
|
|
22
|
+
</view>
|
|
20
23
|
</view>
|
|
21
24
|
</scroll-view>
|
|
22
25
|
<view class="tabs-extra">
|
|
@@ -31,7 +34,13 @@ import { computed, ref, onMounted } from 'vue';
|
|
|
31
34
|
import CircularButton from '../CircularButton/index.vue';
|
|
32
35
|
|
|
33
36
|
defineProps<{
|
|
34
|
-
items: {
|
|
37
|
+
items: {
|
|
38
|
+
label: string;
|
|
39
|
+
key: string;
|
|
40
|
+
value: any;
|
|
41
|
+
index: number;
|
|
42
|
+
icon?: string;
|
|
43
|
+
}[];
|
|
35
44
|
scrollLeft?: number;
|
|
36
45
|
}>();
|
|
37
46
|
|
|
@@ -104,18 +113,35 @@ function onScroll(e: any) {
|
|
|
104
113
|
|
|
105
114
|
.tabs-item {
|
|
106
115
|
display: inline-block;
|
|
107
|
-
padding: 0
|
|
116
|
+
padding: 0 12px;
|
|
108
117
|
height: 32px;
|
|
109
118
|
line-height: 32px;
|
|
110
|
-
border-bottom:
|
|
119
|
+
border-bottom: 2px solid transparent;
|
|
111
120
|
box-sizing: border-box;
|
|
112
121
|
transition: all 0.3s;
|
|
113
122
|
cursor: pointer;
|
|
123
|
+
color: var(--dev-tool-text-color-secondary);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.tabs-item-content {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: 4px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.tabs-item-icon {
|
|
133
|
+
font-size: 14px;
|
|
134
|
+
opacity: 0.8;
|
|
114
135
|
}
|
|
115
136
|
|
|
116
137
|
.tabs-item-active {
|
|
117
138
|
color: var(--dev-tool-main-color);
|
|
118
139
|
border-color: var(--dev-tool-main-color);
|
|
140
|
+
background: rgb(var(--dev-tool-main-color-rgb), 0.05);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.tabs-item-active .tabs-item-icon {
|
|
144
|
+
opacity: 1;
|
|
119
145
|
}
|
|
120
146
|
|
|
121
147
|
.tabs-extra {
|