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.
- package/README.md +46 -0
- package/dist/const.cjs +1 -1
- package/dist/const.d.ts +12 -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 +81 -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 +82 -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 +19 -0
- 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 +1 -1
- package/dist/plugins/uniDevTool/transform/transformMain.js +1 -1
- package/dist/type.d.ts +47 -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 +109 -109
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/ConsoleItem.vue +225 -224
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/RunJSInput.vue +247 -249
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/index.vue +171 -160
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/staticTips.ts +1145 -1145
- package/dist/v3/{DevToolButton → DevTool/components/DevToolButton}/index.vue +7 -4
- package/dist/v3/{DevToolTitle → DevTool/components/DevToolTitle}/index.vue +24 -24
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/DevToolOverlay.vue +197 -182
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/const.ts +28 -5
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/dataUtils.ts +48 -48
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolData.ts +387 -338
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolHandlers.ts +629 -549
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolOverlay.ts +197 -184
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.vue +67 -16
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/ElEventItem.vue +105 -105
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/index.vue +106 -109
- package/dist/v3/{Instance → DevTool/components/Instance}/components/InstanceTreeNode.vue +265 -265
- package/dist/v3/{Instance → DevTool/components/Instance}/flatten.ts +226 -226
- package/dist/v3/{Instance → DevTool/components/Instance}/index.vue +94 -94
- package/dist/v3/{Instance → DevTool/components/Instance}/registry.ts +49 -49
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTree.ts +375 -375
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTreeCtx.ts +268 -268
- package/dist/v3/{Instance → DevTool/components/Instance}/typing.d.ts +43 -43
- package/dist/v3/{InstanceDetail → DevTool/components/InstanceDetail}/index.vue +485 -485
- package/dist/v3/{JsonDetail → DevTool/components/JsonDetail}/index.vue +70 -70
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCItem.vue +112 -113
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCTool.vue +454 -478
- package/dist/v3/{NFCList → DevTool/components/NFCList}/const.ts +56 -56
- package/dist/v3/{NFCList → DevTool/components/NFCList}/index.vue +94 -98
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptConfig.vue +624 -608
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptItem.vue +140 -140
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkDetail.vue +287 -296
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkIntercept.vue +88 -93
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkItem.vue +163 -167
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkSend.vue +589 -556
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/const.ts +4 -4
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/hooks/useNetworkForm.ts +86 -86
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/index.vue +160 -160
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/utils.ts +101 -101
- package/dist/v3/{Performance → DevTool/components/Performance}/index.vue +498 -495
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceMetrics.vue +153 -153
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceWidget.vue +12 -9
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceChart.ts +460 -460
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceData.ts +258 -258
- package/dist/v3/{PiniaList → DevTool/components/PiniaList}/index.vue +93 -94
- package/dist/v3/{RouteList → DevTool/components/RouteList}/index.vue +21 -24
- package/dist/v3/{RunJS → DevTool/components/RunJS}/index.vue +148 -148
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/ScanCodeItem.vue +97 -98
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/index.vue +100 -104
- package/dist/v3/{SettingButton → DevTool/components/SettingButton}/index.vue +45 -45
- package/dist/v3/{SettingList → DevTool/components/SettingList}/index.vue +218 -150
- package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -0
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingDevTool.vue +212 -208
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingInfo.vue +157 -119
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLanguage.vue +74 -74
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLog.vue +230 -230
- 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/{SettingList → DevTool/components/SettingList}/typing.d.ts +2 -2
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/Line.vue +127 -116
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/index.vue +8 -8
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/parseCode.ts +609 -701
- package/dist/v3/{StorageList → DevTool/components/StorageList}/index.vue +174 -174
- package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferDetail.vue +268 -268
- 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 +84 -84
- 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 -5
- package/dist/v3/{AppTransition → components/AppTransition}/index.vue +176 -170
- package/dist/v3/{AutoSizer → components/AutoSizer}/index.vue +192 -192
- package/dist/v3/{AutoSizer → components/AutoSizer}/index1.vue +184 -184
- package/dist/v3/{AutoSizer → components/AutoSizer}/utils.ts +49 -49
- package/dist/v3/components/Barrage/BarrageItem.vue +137 -0
- package/dist/v3/components/Barrage/index.vue +202 -0
- package/dist/v3/{CircularButton → components/CircularButton}/index.vue +84 -84
- package/dist/v3/{CustomSwiper → components/CustomSwiper}/CustomSwiperItem.vue +49 -49
- package/dist/v3/{CustomSwiper → components/CustomSwiper}/index.vue +104 -104
- package/dist/v3/{DraggableContainer → components/DraggableContainer}/index.vue +1 -1
- package/dist/v3/{Empty → components/Empty}/index.vue +29 -29
- package/dist/v3/{FilterInput → components/FilterInput}/index.vue +1 -1
- package/dist/v3/{FilterSelect → components/FilterSelect}/index.vue +179 -179
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/Brackets/index.vue +27 -27
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/Carets/index.vue +59 -59
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/CheckController/index.vue +136 -136
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/TreeNode/index.vue +387 -381
- package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useClipboard.ts +21 -21
- package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useError.ts +21 -21
- package/dist/v3/{JsonPretty → components/JsonPretty}/index.vue +16 -13
- package/dist/v3/{JsonPretty → components/JsonPretty}/type.ts +127 -126
- package/dist/v3/{JsonPretty → components/JsonPretty}/utils/index.ts +169 -169
- package/dist/v3/{MovableContainer → components/MovableContainer}/index.vue +1 -1
- package/dist/v3/{Pick → components/Pick}/index.vue +322 -322
- package/dist/v3/{Tabs → components/Tabs}/index.vue +30 -4
- package/dist/v3/{Tag → components/Tag}/index.vue +113 -113
- package/dist/v3/{VirtualList → components/VirtualList}/AutoSize.vue +40 -40
- package/dist/v3/{VirtualList → components/VirtualList}/index.vue +416 -412
- package/dist/v3/hooks/useBluetooth/index.ts +561 -0
- package/dist/v3/hooks/useContainerStyle.ts +153 -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 -573
- package/dist/v3/hooks/useRequest/utils.ts +267 -267
- package/dist/v3/hooks/useScanCode/index.ts +206 -206
- 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/dist/v3/styles/theme.ts +12 -12
- package/package.json +59 -64
- package/dist/plugins/uniParseStock/index.d.ts +0 -10
- package/dist/plugins/uniParseStock/index.d.ts.map +0 -1
- /package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.css +0 -0
- /package/dist/v3/{SettingList → DevTool/components/SettingList}/index.css +0 -0
- /package/dist/v3/{Empty → components/Empty}/empty.png +0 -0
- /package/dist/v3/{VirtualList → components/VirtualList}/readme.md +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { ref, onUnmounted, type Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WebSocket 连接状态枚举
|
|
5
|
+
*/
|
|
6
|
+
export enum ReadyState {
|
|
7
|
+
Connecting = 0, // 连接中
|
|
8
|
+
Open = 1, // 已连接
|
|
9
|
+
Closing = 2, // 关闭中
|
|
10
|
+
Closed = 3, // 已关闭
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* useWebsocket 配置参数
|
|
15
|
+
*/
|
|
16
|
+
export interface Options {
|
|
17
|
+
/** 重连尝试次数限制,默认为 3 */
|
|
18
|
+
reconnectLimit?: number;
|
|
19
|
+
/** 重连时间间隔 (ms),默认为 3000 */
|
|
20
|
+
reconnectInterval?: number;
|
|
21
|
+
/** 是否开启心跳检查,默认为 false */
|
|
22
|
+
heartbeat?: boolean;
|
|
23
|
+
/** 心跳检查间隔 (ms),默认为 30000 */
|
|
24
|
+
heartbeatInterval?: number;
|
|
25
|
+
/** 心跳发送的内容,默认为 'ping' */
|
|
26
|
+
heartbeatMessage?: string | ArrayBuffer;
|
|
27
|
+
/** 是否手动控制连接,为 true 时需手动调用 connect(),默认为 false */
|
|
28
|
+
manual?: boolean;
|
|
29
|
+
/** 连接开启时的回调 */
|
|
30
|
+
onOpen?: (
|
|
31
|
+
instance: UniApp.SocketTask,
|
|
32
|
+
res: UniApp.OnSocketOpenCallbackResult,
|
|
33
|
+
) => void;
|
|
34
|
+
/** 连接关闭时的回调 */
|
|
35
|
+
onClose?: (event: UniApp.OnSocketCloseOptions) => void;
|
|
36
|
+
/** 收到消息时的回调 */
|
|
37
|
+
onMessage?: (message: UniApp.OnSocketMessageCallbackResult) => void;
|
|
38
|
+
/** 连接发生错误时的回调 */
|
|
39
|
+
onError?: (event: UniApp.GeneralCallbackResult) => void;
|
|
40
|
+
/** WebSocket 子协议 */
|
|
41
|
+
protocols?: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* useWebsocket 返回结果
|
|
46
|
+
*/
|
|
47
|
+
export interface Result {
|
|
48
|
+
/** 最近收到的一条消息 */
|
|
49
|
+
latestMessage: Ref<UniApp.OnSocketMessageCallbackResult | undefined>;
|
|
50
|
+
/** 当前连接状态 */
|
|
51
|
+
readyState: Ref<ReadyState>;
|
|
52
|
+
/** 手动连接方法 */
|
|
53
|
+
connect: () => void;
|
|
54
|
+
/** 手动断开方法 */
|
|
55
|
+
disconnect: () => void;
|
|
56
|
+
/** 发送消息方法 */
|
|
57
|
+
sendMessage: (data: string | ArrayBuffer) => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 封装 uni.connectSocket 的 hook,参考 ahooks useWebSocket
|
|
62
|
+
*
|
|
63
|
+
* @param url WebSocket 地址
|
|
64
|
+
* @param options 配置项
|
|
65
|
+
*/
|
|
66
|
+
const useWebsocket = (url: string, options: Options = {}): Result => {
|
|
67
|
+
const {
|
|
68
|
+
reconnectLimit = 3,
|
|
69
|
+
reconnectInterval = 3000,
|
|
70
|
+
heartbeat = false,
|
|
71
|
+
heartbeatInterval = 30000,
|
|
72
|
+
heartbeatMessage = 'ping',
|
|
73
|
+
manual = false,
|
|
74
|
+
onOpen,
|
|
75
|
+
onClose,
|
|
76
|
+
onMessage,
|
|
77
|
+
onError,
|
|
78
|
+
protocols,
|
|
79
|
+
} = options;
|
|
80
|
+
|
|
81
|
+
// 状态定义
|
|
82
|
+
const readyState = ref<ReadyState>(ReadyState.Closed);
|
|
83
|
+
const latestMessage = ref<UniApp.OnSocketMessageCallbackResult>();
|
|
84
|
+
const socketTask = ref<UniApp.SocketTask | null>(null);
|
|
85
|
+
|
|
86
|
+
// 内部辅助变量
|
|
87
|
+
let reconnectCount = 0;
|
|
88
|
+
let reconnectTimer: any = null;
|
|
89
|
+
let heartbeatTimer: any = null;
|
|
90
|
+
let isManualClose = false;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 清除心跳定时器
|
|
94
|
+
*/
|
|
95
|
+
const clearHeartbeat = () => {
|
|
96
|
+
if (heartbeatTimer) {
|
|
97
|
+
clearInterval(heartbeatTimer);
|
|
98
|
+
heartbeatTimer = null;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 开始心跳
|
|
104
|
+
*/
|
|
105
|
+
const startHeartbeat = () => {
|
|
106
|
+
if (!heartbeat) return;
|
|
107
|
+
clearHeartbeat();
|
|
108
|
+
heartbeatTimer = setInterval(() => {
|
|
109
|
+
if (readyState.value === ReadyState.Open && socketTask.value) {
|
|
110
|
+
// console.log('[useWebsocket] Heartbeat Ping');
|
|
111
|
+
socketTask.value.send({
|
|
112
|
+
data: heartbeatMessage,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, heartbeatInterval);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 执行连接逻辑
|
|
120
|
+
*/
|
|
121
|
+
const connect = () => {
|
|
122
|
+
// 如果有正在等待的重连,先清除
|
|
123
|
+
if (reconnectTimer) {
|
|
124
|
+
clearTimeout(reconnectTimer);
|
|
125
|
+
reconnectTimer = null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 清理旧的心跳
|
|
129
|
+
clearHeartbeat();
|
|
130
|
+
|
|
131
|
+
// 如果当前已有任务,先尝试关闭
|
|
132
|
+
if (socketTask.value) {
|
|
133
|
+
socketTask.value.close({});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
readyState.value = ReadyState.Connecting;
|
|
137
|
+
isManualClose = false;
|
|
138
|
+
|
|
139
|
+
// 创建 Uni Socket 任务
|
|
140
|
+
const task = uni.connectSocket({
|
|
141
|
+
url,
|
|
142
|
+
protocols,
|
|
143
|
+
complete: () => {},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
socketTask.value = task;
|
|
147
|
+
|
|
148
|
+
// 监听开启事件
|
|
149
|
+
task.onOpen((res) => {
|
|
150
|
+
readyState.value = ReadyState.Open;
|
|
151
|
+
reconnectCount = 0; // 重连计数归零
|
|
152
|
+
startHeartbeat(); // 开始心跳
|
|
153
|
+
onOpen?.(task, res);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// 监听消息事件
|
|
157
|
+
task.onMessage((res) => {
|
|
158
|
+
latestMessage.value = res;
|
|
159
|
+
onMessage?.(res);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// 监听错误事件
|
|
163
|
+
task.onError((res) => {
|
|
164
|
+
readyState.value = ReadyState.Closed;
|
|
165
|
+
clearHeartbeat();
|
|
166
|
+
onError?.(res);
|
|
167
|
+
|
|
168
|
+
// 只有非手动关闭才会尝试重连
|
|
169
|
+
if (!isManualClose) {
|
|
170
|
+
reconnect();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// 监听关闭事件
|
|
175
|
+
task.onClose((res) => {
|
|
176
|
+
readyState.value = ReadyState.Closed;
|
|
177
|
+
clearHeartbeat();
|
|
178
|
+
onClose?.(res);
|
|
179
|
+
|
|
180
|
+
// 如果非用户手动关闭,尝试重连
|
|
181
|
+
if (!isManualClose) {
|
|
182
|
+
reconnect();
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 重连逻辑
|
|
189
|
+
*/
|
|
190
|
+
const reconnect = () => {
|
|
191
|
+
if (reconnectCount < reconnectLimit && !isManualClose) {
|
|
192
|
+
reconnectTimer = setTimeout(() => {
|
|
193
|
+
reconnectCount++;
|
|
194
|
+
connect();
|
|
195
|
+
}, reconnectInterval);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* 断开连接
|
|
201
|
+
*/
|
|
202
|
+
const disconnect = () => {
|
|
203
|
+
isManualClose = true;
|
|
204
|
+
reconnectCount = reconnectLimit; // 标记停止重连循环
|
|
205
|
+
clearHeartbeat();
|
|
206
|
+
if (reconnectTimer) {
|
|
207
|
+
clearTimeout(reconnectTimer);
|
|
208
|
+
reconnectTimer = null;
|
|
209
|
+
}
|
|
210
|
+
if (socketTask.value) {
|
|
211
|
+
socketTask.value.close({});
|
|
212
|
+
socketTask.value = null;
|
|
213
|
+
}
|
|
214
|
+
readyState.value = ReadyState.Closed;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 发送消息
|
|
219
|
+
* @param data 字符串或二进制数据
|
|
220
|
+
*/
|
|
221
|
+
const sendMessage = (data: string | ArrayBuffer) => {
|
|
222
|
+
if (readyState.value === ReadyState.Open && socketTask.value) {
|
|
223
|
+
socketTask.value.send({
|
|
224
|
+
data,
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
console.error(
|
|
228
|
+
'[useWebsocket] WebSocket is not open. Current state:',
|
|
229
|
+
readyState.value,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// 默认自动开始连接
|
|
235
|
+
if (!manual) {
|
|
236
|
+
connect();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 组件卸载时自动清理
|
|
240
|
+
onUnmounted(() => {
|
|
241
|
+
disconnect();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
latestMessage,
|
|
246
|
+
readyState,
|
|
247
|
+
connect,
|
|
248
|
+
disconnect,
|
|
249
|
+
sendMessage,
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export default useWebsocket;
|
package/dist/v3/styles/theme.css
CHANGED
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
.dev-tool {
|
|
4
4
|
/* Generic Colors */
|
|
5
5
|
--dev-tool-main-color: #9254de;
|
|
6
|
+
--dev-tool-main-color-rgb: 146, 84, 222;
|
|
6
7
|
--dev-tool-warn-color: #ffa940;
|
|
7
8
|
--dev-tool-error-color: #ff4d4f;
|
|
8
9
|
--dev-tool-success-color: #bae637;
|
|
9
|
-
|
|
10
|
+
|
|
10
11
|
/* Shared Base Tokens */
|
|
11
12
|
--dev-tool-text-color-placeholder: #8c8c8c;
|
|
12
13
|
|
|
13
14
|
-webkit-tap-highlight-color: transparent;
|
|
14
|
-
transition:
|
|
15
|
+
transition:
|
|
16
|
+
color 0.3s,
|
|
17
|
+
background-color 0.3s,
|
|
18
|
+
border-color 0.3s,
|
|
19
|
+
box-shadow 0.3s;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
/* Light Theme */
|
|
@@ -20,6 +25,7 @@
|
|
|
20
25
|
--dev-tool-bg2-color: rgb(252 252 252 / 95%);
|
|
21
26
|
--dev-tool-bg3-color: #fff;
|
|
22
27
|
--dev-tool-text-color: #1f1f1f;
|
|
28
|
+
--dev-tool-text-color-secondary: #595959;
|
|
23
29
|
--dev-tool-border-color: #f0f0f0;
|
|
24
30
|
--dev-tool-info-color: #8c8c8c;
|
|
25
31
|
--dev-tool-log-color: #f5f5f5;
|
|
@@ -50,11 +56,12 @@
|
|
|
50
56
|
--dev-tool-bg2-color: #1a1a1a;
|
|
51
57
|
--dev-tool-bg3-color: #242424;
|
|
52
58
|
--dev-tool-text-color: rgb(255 255 255 / 85%);
|
|
59
|
+
--dev-tool-text-color-secondary: rgb(255 255 255 / 45%);
|
|
53
60
|
--dev-tool-border-color: #333;
|
|
54
61
|
--dev-tool-info-color: #8c8c8c;
|
|
55
62
|
--dev-tool-log-color: #202020;
|
|
56
63
|
--dev-tool-nil-color: #bfbfbf;
|
|
57
|
-
|
|
64
|
+
|
|
58
65
|
/* Syntax Highlighting */
|
|
59
66
|
--dev-tool-number-color: #40a9ff;
|
|
60
67
|
--dev-tool-boolean-color: #40a9ff;
|
|
@@ -69,7 +76,7 @@
|
|
|
69
76
|
--dev-tool-function-color: #40a9ff;
|
|
70
77
|
--dev-tool-attribute-color: #ff7eb6;
|
|
71
78
|
--dev-tool-operator-color: #5cdbd3;
|
|
72
|
-
|
|
79
|
+
|
|
73
80
|
/* Status Backgrounds */
|
|
74
81
|
--dev-tool-warn-bg-color: rgb(255 169 64 / 20%);
|
|
75
82
|
--dev-tool-error-bg-color: rgb(255 77 79 / 20%);
|
|
@@ -198,7 +205,7 @@
|
|
|
198
205
|
--dev-tool-log-color: #0f172a;
|
|
199
206
|
--dev-tool-nil-color: #64748b;
|
|
200
207
|
--dev-tool-main-color: #82aaff;
|
|
201
|
-
|
|
208
|
+
|
|
202
209
|
/* Syntax Highlighting */
|
|
203
210
|
--dev-tool-number-color: #7dd3fc;
|
|
204
211
|
--dev-tool-boolean-color: #7dd3fc;
|
|
@@ -213,7 +220,7 @@
|
|
|
213
220
|
--dev-tool-function-color: #82aaff;
|
|
214
221
|
--dev-tool-attribute-color: #c792ea;
|
|
215
222
|
--dev-tool-operator-color: #2dd4bf;
|
|
216
|
-
|
|
223
|
+
|
|
217
224
|
/* Status Backgrounds */
|
|
218
225
|
--dev-tool-warn-bg-color: rgb(251 191 36 / 15%);
|
|
219
226
|
--dev-tool-error-bg-color: rgb(244 63 94 / 15%);
|
|
@@ -232,7 +239,7 @@
|
|
|
232
239
|
--dev-tool-log-color: #0a1b35;
|
|
233
240
|
--dev-tool-nil-color: #38bdf8;
|
|
234
241
|
--dev-tool-main-color: #38bdf8;
|
|
235
|
-
|
|
242
|
+
|
|
236
243
|
/* Syntax Highlighting (Ocean Blue) */
|
|
237
244
|
--dev-tool-number-color: #7dd3fc;
|
|
238
245
|
--dev-tool-boolean-color: #7dd3fc;
|
|
@@ -247,7 +254,7 @@
|
|
|
247
254
|
--dev-tool-function-color: #38bdf8;
|
|
248
255
|
--dev-tool-attribute-color: #c084fc;
|
|
249
256
|
--dev-tool-operator-color: #2dd4bf;
|
|
250
|
-
|
|
257
|
+
|
|
251
258
|
/* Status Backgrounds */
|
|
252
259
|
--dev-tool-warn-bg-color: rgb(245 158 11 / 15%);
|
|
253
260
|
--dev-tool-error-bg-color: rgb(244 63 94 / 15%);
|
|
@@ -266,7 +273,7 @@
|
|
|
266
273
|
--dev-tool-log-color: #fff7ed;
|
|
267
274
|
--dev-tool-nil-color: #c2410c;
|
|
268
275
|
--dev-tool-main-color: #ef5350;
|
|
269
|
-
|
|
276
|
+
|
|
270
277
|
/* Syntax Highlighting */
|
|
271
278
|
--dev-tool-number-color: #ffab91;
|
|
272
279
|
--dev-tool-boolean-color: #ffab91;
|
|
@@ -281,7 +288,7 @@
|
|
|
281
288
|
--dev-tool-function-color: #ef5350;
|
|
282
289
|
--dev-tool-attribute-color: #be123c;
|
|
283
290
|
--dev-tool-operator-color: #c2410c;
|
|
284
|
-
|
|
291
|
+
|
|
285
292
|
/* Warm Status Backgrounds */
|
|
286
293
|
--dev-tool-warn-bg-color: #fff7ed;
|
|
287
294
|
--dev-tool-error-bg-color: #fef2f2;
|
package/dist/v3/styles/theme.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export const THEME_MAIN_COLORS: Record<string, string> = {
|
|
2
|
-
light: '#9254de',
|
|
3
|
-
dark: '#9254de',
|
|
4
|
-
eye: '#6c71c4',
|
|
5
|
-
midnight: '#38bdf8',
|
|
6
|
-
gulf: '#2dd4bf',
|
|
7
|
-
lava: '#f97316',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const getThemeMainColor = (theme: string = 'light') => {
|
|
11
|
-
return THEME_MAIN_COLORS[theme] || THEME_MAIN_COLORS.light;
|
|
12
|
-
};
|
|
1
|
+
export const THEME_MAIN_COLORS: Record<string, string> = {
|
|
2
|
+
light: '#9254de',
|
|
3
|
+
dark: '#9254de',
|
|
4
|
+
eye: '#6c71c4',
|
|
5
|
+
midnight: '#38bdf8',
|
|
6
|
+
gulf: '#2dd4bf',
|
|
7
|
+
lava: '#f97316',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const getThemeMainColor = (theme: string = 'light') => {
|
|
11
|
+
return THEME_MAIN_COLORS[theme] || THEME_MAIN_COLORS.light;
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,64 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vite-uni-dev-tool",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "vite-uni-dev-tool, debug, uni-app, 一处编写,到处调试",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"vite",
|
|
7
|
-
"debugger",
|
|
8
|
-
"dev-tool",
|
|
9
|
-
"vite-uni-dev-tool",
|
|
10
|
-
"uni-app",
|
|
11
|
-
"调试",
|
|
12
|
-
"插件",
|
|
13
|
-
"一处编写,到处调试"
|
|
14
|
-
],
|
|
15
|
-
"repositories": [
|
|
16
|
-
{
|
|
17
|
-
"type": "gitee",
|
|
18
|
-
"url": "https://gitee.com/cloud_l/vite-uni-dev-tool.git"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"type": "module",
|
|
23
|
-
"main": "dist/index.cjs",
|
|
24
|
-
"module": "dist/index.js",
|
|
25
|
-
"types": "dist/index.d.ts",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./dist/index.d.ts",
|
|
29
|
-
"import": "./dist/index.js",
|
|
30
|
-
"require": "./dist/index.cjs"
|
|
31
|
-
},
|
|
32
|
-
"./core": {
|
|
33
|
-
"types": "./dist/core.d.ts",
|
|
34
|
-
"import": "./dist/core.js"
|
|
35
|
-
},
|
|
36
|
-
"./dist/*": "./dist/*",
|
|
37
|
-
"./shims-uni.d.ts": "./dist/shims-uni.d.ts"
|
|
38
|
-
},
|
|
39
|
-
"files": [
|
|
40
|
-
"./dist/",
|
|
41
|
-
"README.md"
|
|
42
|
-
],
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "vite build",
|
|
45
|
-
"build:lib": "vite build"
|
|
46
|
-
},
|
|
47
|
-
"peerDependencies": {
|
|
48
|
-
"
|
|
49
|
-
"@dcloudio/uni-
|
|
50
|
-
"@dcloudio/uni-h5": ">=3.0.0-4020920240930001",
|
|
51
|
-
"
|
|
52
|
-
},
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
],
|
|
61
|
-
"publishConfig": {
|
|
62
|
-
"access": "public"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "vite-uni-dev-tool",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "vite-uni-dev-tool, debug, uni-app, 一处编写,到处调试",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"vite",
|
|
7
|
+
"debugger",
|
|
8
|
+
"dev-tool",
|
|
9
|
+
"vite-uni-dev-tool",
|
|
10
|
+
"uni-app",
|
|
11
|
+
"调试",
|
|
12
|
+
"插件",
|
|
13
|
+
"一处编写,到处调试"
|
|
14
|
+
],
|
|
15
|
+
"repositories": [
|
|
16
|
+
{
|
|
17
|
+
"type": "gitee",
|
|
18
|
+
"url": "https://gitee.com/cloud_l/vite-uni-dev-tool.git"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "dist/index.cjs",
|
|
24
|
+
"module": "dist/index.js",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
|
+
},
|
|
32
|
+
"./core": {
|
|
33
|
+
"types": "./dist/core.d.ts",
|
|
34
|
+
"import": "./dist/core.js"
|
|
35
|
+
},
|
|
36
|
+
"./dist/*": "./dist/*",
|
|
37
|
+
"./shims-uni.d.ts": "./dist/shims-uni.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"./dist/",
|
|
41
|
+
"README.md"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "vite build",
|
|
45
|
+
"build:lib": "vite build"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@dcloudio/uni-app": ">=3.0.0-4020920240930001",
|
|
49
|
+
"@dcloudio/uni-components": "3.0.0-4020920240930001",
|
|
50
|
+
"@dcloudio/uni-h5": ">=3.0.0-4020920240930001",
|
|
51
|
+
"vue": ">=3.4.21"
|
|
52
|
+
},
|
|
53
|
+
"authors": [
|
|
54
|
+
"1264174856@qq.com"
|
|
55
|
+
],
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/uniParseStock/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAcnC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,MAAM,CAoL9C"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|