vite-uni-dev-tool 0.0.19 → 0.0.20
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 +4 -0
- package/dist/devEvent/index.d.ts +2 -2
- package/dist/devEvent/index.d.ts.map +1 -1
- package/dist/devEvent/index.js +5 -5
- package/dist/devIntercept/index.d.ts.map +1 -1
- package/dist/devIntercept/index.js +224 -211
- package/dist/devStore/index.d.ts +3 -3
- package/dist/devStore/index.d.ts.map +1 -1
- package/dist/devStore/index.js +13 -13
- package/dist/v2/VirtualListPro/index.vue +8 -4
- package/dist/v3/SettingList/index.vue +1 -1
- package/dist/v3/SourceCode/index.vue +90 -58
- package/dist/v3/VirtualListPro/index.vue +48 -6
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/devEvent/index.d.ts
CHANGED
|
@@ -207,13 +207,13 @@ export declare class DevEvent {
|
|
|
207
207
|
* @param {string} key
|
|
208
208
|
* @memberof DevEvent
|
|
209
209
|
*/
|
|
210
|
-
removeStorage(key: string): void;
|
|
210
|
+
removeStorage(key: string, local?: boolean): void;
|
|
211
211
|
/**
|
|
212
212
|
* 清除缓存
|
|
213
213
|
*
|
|
214
214
|
* @memberof DevEvent
|
|
215
215
|
*/
|
|
216
|
-
clearStorage(): void;
|
|
216
|
+
clearStorage(local?: boolean): void;
|
|
217
217
|
/**
|
|
218
218
|
* 重置 storage 函数
|
|
219
219
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devEvent/index.ts"],"names":[],"mappings":";AAkCA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAavC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAW;IAExB,O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,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM;IAK/D;;;;;OAKG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIvC;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU;IAI7D;;;;OAIG;IACH,oBAAoB;IAIpB,eAAe,CAAC,KAAK,EAAE,MAAM;IAI7B,eAAe;IAIf,cAAc,CAAC,KAAK,EAAE,MAAM;IAI5B,cAAc;IAId,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAIrC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAItC,aAAa,CAAC,UAAU,EAAE,GAAG;IAI7B,iBAAiB;IAIjB,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa;IAI/C,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE;IAIjD,aAAa;IAIb,aAAa;IAOb,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAehC;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM;IAmDrB;;;;;OAKG;IACH,uBAAuB,CAAC,IAAI,EAAE,OAAO,CAAC,iBAAiB,EAAE;IAKzD;;;;OAIG;IACH,sBAAsB;CAGvB"}
|
package/dist/devEvent/index.js
CHANGED
|
@@ -142,7 +142,7 @@ class Y {
|
|
|
142
142
|
h,
|
|
143
143
|
(e) => {
|
|
144
144
|
var t;
|
|
145
|
-
e.type === u ? this.store.clearConsoleList() : e.type === c ? this.store.clearNetworkList() : e.type === D ? this.store.clearWsList() : e.type === v ? this.store.clearUploadList() : e.type === E ? this.store.clearStorageList() : e.type === g ? (this.store.refreshStore(), this.postMessage()) : e.type === T ? (this.store.removeStorage(e.data.key + ""), this.postMessage()) : e.type === _ ? (this.store.addStorage(e.data), this.postMessage()) : e.type === S ? (this.store.updateStore(e.data), this.postMessage()) : e.type === d ? ((t = e.data) == null ? void 0 : t.type) === "nav" ? this.switchTo(e.data.path ?? "") : this.navigateTo(e.data.path ?? "") : e.type === f ? (e.data.show ? this.showDevToolButton() : this.hideDevToolButton(), this.postMessage()) : e.type === y ? this.restartDevTool() : e.type === m ? this.restartApp() : e.type === L ? this.exportLog(e.data) : e.type === R ? (this.store.updateVuexStore(e.data), this.postMessage()) : e.type === I ? (this.store.updatePiniaStore(e.data), this.postMessage()) : e.type === V ? this.store.clearDevCache() : e.type === C ? this.destroyDevTool() : e.type === A ? this.openDevToolWindow() : e.type === O ? this.closeDevToolWindow() : e.type === M ? this.refreshRouteList() : e.type === w ? this.sendDevToolOption() : e.type === U ? this.uniEventClear() : e.type === P ? this.devRunJS(e.data.code) : e.type === x && this.store.clearCaptureScreenList();
|
|
145
|
+
e.type === u ? this.store.clearConsoleList() : e.type === c ? this.store.clearNetworkList() : e.type === D ? this.store.clearWsList() : e.type === v ? this.store.clearUploadList() : e.type === E ? this.store.clearStorageList(!0) : e.type === g ? (this.store.refreshStore(), this.postMessage()) : e.type === T ? (this.store.removeStorage(e.data.key + "", !0), this.postMessage()) : e.type === _ ? (this.store.addStorage(e.data, !0), this.postMessage()) : e.type === S ? (this.store.updateStore(e.data), this.postMessage()) : e.type === d ? ((t = e.data) == null ? void 0 : t.type) === "nav" ? this.switchTo(e.data.path ?? "") : this.navigateTo(e.data.path ?? "") : e.type === f ? (e.data.show ? this.showDevToolButton() : this.hideDevToolButton(), this.postMessage()) : e.type === y ? this.restartDevTool() : e.type === m ? this.restartApp() : e.type === L ? this.exportLog(e.data) : e.type === R ? (this.store.updateVuexStore(e.data), this.postMessage()) : e.type === I ? (this.store.updatePiniaStore(e.data), this.postMessage()) : e.type === V ? this.store.clearDevCache() : e.type === C ? this.destroyDevTool() : e.type === A ? this.openDevToolWindow() : e.type === O ? this.closeDevToolWindow() : e.type === M ? this.refreshRouteList() : e.type === w ? this.sendDevToolOption() : e.type === U ? this.uniEventClear() : e.type === P ? this.devRunJS(e.data.code) : e.type === x && this.store.clearCaptureScreenList();
|
|
146
146
|
}
|
|
147
147
|
);
|
|
148
148
|
}
|
|
@@ -273,16 +273,16 @@ class Y {
|
|
|
273
273
|
* @param {string} key
|
|
274
274
|
* @memberof DevEvent
|
|
275
275
|
*/
|
|
276
|
-
removeStorage(e) {
|
|
277
|
-
this.store.removeStorage(e), this.postMessage();
|
|
276
|
+
removeStorage(e, t) {
|
|
277
|
+
this.store.removeStorage(e, t), this.postMessage();
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
280
|
* 清除缓存
|
|
281
281
|
*
|
|
282
282
|
* @memberof DevEvent
|
|
283
283
|
*/
|
|
284
|
-
clearStorage() {
|
|
285
|
-
this.store.clearStorageList();
|
|
284
|
+
clearStorage(e) {
|
|
285
|
+
this.store.clearStorageList(e);
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* 重置 storage 函数
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devIntercept/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AASvC;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAW;IAExB,SAAS,UAAS;IAElB,QAAQ,gBAAa;IACrB,UAAU,gBAAa;IACvB,UAAU,gBAAa;IACvB,SAAS,gBAAa;gBAEV,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAKhD,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAqBzC;;;;OAIG;IACH,mBAAmB;IA8BnB;;;;OAIG;IACH,YAAY,CAAC,WAAW,EAAE,GAAG;IA+B7B;;;;OAIG;IACH,iBAAiB;IA0BjB;;;;;OAKG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAuB9B,OAAO,EAAE,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AAG;IAgBhC;;;;OAIG;IACH,mBAAmB;IAyFnB,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa;IAqBpD,iBAAiB;IAQjB;;;;OAIG;IACH,sBAAsB;CAYvB"}
|
|
@@ -2,10 +2,10 @@ import { backup as v } from "../core.js";
|
|
|
2
2
|
import "../utils/index.js";
|
|
3
3
|
import { transformValueToView as E } from "../utils/language.js";
|
|
4
4
|
import { getCurrentPagePath as f } from "../utils/page.js";
|
|
5
|
-
import { getCurrentDate as
|
|
5
|
+
import { getCurrentDate as p } from "../utils/date.js";
|
|
6
6
|
import { parseValue as C } from "../utils/object.js";
|
|
7
|
-
import { escapeHTML as
|
|
8
|
-
class
|
|
7
|
+
import { escapeHTML as P } from "../utils/string.js";
|
|
8
|
+
class I {
|
|
9
9
|
constructor(e) {
|
|
10
10
|
this.initPinia = !1, this.cache$on = /* @__PURE__ */ new Map(), this.cache$once = /* @__PURE__ */ new Map(), this.cache$emit = /* @__PURE__ */ new Map(), this.cache$off = /* @__PURE__ */ new Map(), this.event = e.event, this.init(e);
|
|
11
11
|
}
|
|
@@ -21,16 +21,16 @@ class V {
|
|
|
21
21
|
if (!uni.__log__)
|
|
22
22
|
return;
|
|
23
23
|
const e = this;
|
|
24
|
-
uni.__log__ = function(
|
|
25
|
-
const
|
|
26
|
-
v.__log__(
|
|
24
|
+
uni.__log__ = function(r, t, ...n) {
|
|
25
|
+
const s = f();
|
|
26
|
+
v.__log__(r, t, ...n), e.event.updateConsoleList([
|
|
27
27
|
{
|
|
28
|
-
type:
|
|
29
|
-
position:
|
|
30
|
-
time:
|
|
31
|
-
args:
|
|
32
|
-
type: E(
|
|
33
|
-
value: C(
|
|
28
|
+
type: r,
|
|
29
|
+
position: s,
|
|
30
|
+
time: p(),
|
|
31
|
+
args: n.map((c) => ({
|
|
32
|
+
type: E(c),
|
|
33
|
+
value: C(c)
|
|
34
34
|
})),
|
|
35
35
|
stack: t
|
|
36
36
|
}
|
|
@@ -45,13 +45,13 @@ class V {
|
|
|
45
45
|
interceptVue(e) {
|
|
46
46
|
if (!e)
|
|
47
47
|
return;
|
|
48
|
-
const
|
|
49
|
-
this.event.getDevToolDestroy() || this.interceptErrorVue(
|
|
50
|
-
}, t = (
|
|
51
|
-
this.event.getDevToolDestroy() || this.interceptWarnVue(
|
|
52
|
-
` +
|
|
48
|
+
const r = (n, s, c) => {
|
|
49
|
+
this.event.getDevToolDestroy() || this.interceptErrorVue(n);
|
|
50
|
+
}, t = (n, s, c) => {
|
|
51
|
+
this.event.getDevToolDestroy() || this.interceptWarnVue(n + `
|
|
52
|
+
` + c);
|
|
53
53
|
};
|
|
54
|
-
e.appContext ? (e.appContext.config.errorHandler =
|
|
54
|
+
e.appContext ? (e.appContext.config.errorHandler = r, e.appContext.config.warnHandler = t) : (e.config.errorHandler = r, e.config.warnHandler = t);
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* app 中捕获全局错误
|
|
@@ -60,22 +60,22 @@ class V {
|
|
|
60
60
|
*/
|
|
61
61
|
interceptAppError() {
|
|
62
62
|
uni.onError((e) => {
|
|
63
|
-
var
|
|
63
|
+
var n, s;
|
|
64
64
|
if (this.event.getDevToolDestroy())
|
|
65
65
|
return;
|
|
66
|
-
const
|
|
67
|
-
`)) == null ? void 0 :
|
|
66
|
+
const r = e.toString(), t = ((s = (n = e == null ? void 0 : e.stack) == null ? void 0 : n.split(`
|
|
67
|
+
`)) == null ? void 0 : s[1]) ?? "";
|
|
68
68
|
this.event.updateConsoleList([
|
|
69
69
|
{
|
|
70
70
|
type: "error",
|
|
71
71
|
args: [
|
|
72
72
|
{
|
|
73
73
|
type: "string",
|
|
74
|
-
value:
|
|
74
|
+
value: r
|
|
75
75
|
}
|
|
76
76
|
],
|
|
77
77
|
position: f(),
|
|
78
|
-
time:
|
|
78
|
+
time: p(),
|
|
79
79
|
stack: t
|
|
80
80
|
}
|
|
81
81
|
]);
|
|
@@ -88,9 +88,9 @@ class V {
|
|
|
88
88
|
* @memberof DevIntercept
|
|
89
89
|
*/
|
|
90
90
|
interceptErrorVue(e) {
|
|
91
|
-
var
|
|
92
|
-
const
|
|
93
|
-
`), t =
|
|
91
|
+
var n;
|
|
92
|
+
const r = (n = e == null ? void 0 : e.stack) == null ? void 0 : n.split(`
|
|
93
|
+
`), t = r == null ? void 0 : r[1];
|
|
94
94
|
console.error(e), this.event.updateConsoleList([
|
|
95
95
|
{
|
|
96
96
|
type: "error",
|
|
@@ -101,7 +101,7 @@ class V {
|
|
|
101
101
|
}
|
|
102
102
|
],
|
|
103
103
|
position: f(),
|
|
104
|
-
time:
|
|
104
|
+
time: p(),
|
|
105
105
|
stack: t
|
|
106
106
|
}
|
|
107
107
|
]);
|
|
@@ -114,15 +114,15 @@ class V {
|
|
|
114
114
|
* @memberof DevIntercept
|
|
115
115
|
*/
|
|
116
116
|
interceptWarnVue(e) {
|
|
117
|
-
var
|
|
117
|
+
var c, i, l, o;
|
|
118
118
|
if (this.preWarn === e)
|
|
119
119
|
return;
|
|
120
120
|
this.preWarn = e;
|
|
121
|
-
const
|
|
122
|
-
`),
|
|
121
|
+
const r = f(), t = (i = (c = new Error()) == null ? void 0 : c.stack) == null ? void 0 : i.split(`
|
|
122
|
+
`), n = (l = t == null ? void 0 : t.slice(2)) == null ? void 0 : l[0];
|
|
123
123
|
console.warn(e);
|
|
124
|
-
const
|
|
125
|
-
`)) == null ? void 0 :
|
|
124
|
+
const s = (o = e.split(`
|
|
125
|
+
`)) == null ? void 0 : o.map((m) => P(m)).join(`
|
|
126
126
|
`);
|
|
127
127
|
this.event.updateConsoleList([
|
|
128
128
|
{
|
|
@@ -130,12 +130,12 @@ class V {
|
|
|
130
130
|
args: [
|
|
131
131
|
{
|
|
132
132
|
type: "string",
|
|
133
|
-
value:
|
|
133
|
+
value: s
|
|
134
134
|
}
|
|
135
135
|
],
|
|
136
|
-
position:
|
|
137
|
-
time:
|
|
138
|
-
stack:
|
|
136
|
+
position: r,
|
|
137
|
+
time: p(),
|
|
138
|
+
stack: n
|
|
139
139
|
}
|
|
140
140
|
]);
|
|
141
141
|
}
|
|
@@ -159,13 +159,13 @@ class V {
|
|
|
159
159
|
interceptSwitchTab() {
|
|
160
160
|
const e = this;
|
|
161
161
|
uni.addInterceptor("switchTab", {
|
|
162
|
-
invoke(
|
|
163
|
-
const t =
|
|
164
|
-
|
|
165
|
-
var
|
|
166
|
-
t && t(
|
|
167
|
-
const
|
|
168
|
-
e.event.updateCurrentPagePath(
|
|
162
|
+
invoke(r) {
|
|
163
|
+
const t = r.complete;
|
|
164
|
+
r.complete = function(n) {
|
|
165
|
+
var c, i, l;
|
|
166
|
+
t && t(n);
|
|
167
|
+
const s = ((l = (i = (c = r.url) == null ? void 0 : c.slice(1)) == null ? void 0 : i.split("?")) == null ? void 0 : l[0]) || "/";
|
|
168
|
+
e.event.updateCurrentPagePath(s);
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
});
|
|
@@ -178,13 +178,13 @@ class V {
|
|
|
178
178
|
interceptNavigateTo() {
|
|
179
179
|
const e = this;
|
|
180
180
|
uni.addInterceptor("navigateTo", {
|
|
181
|
-
invoke(
|
|
182
|
-
const t =
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
t && t(
|
|
186
|
-
const
|
|
187
|
-
e.event.updateCurrentPagePath(
|
|
181
|
+
invoke(r) {
|
|
182
|
+
const t = r.complete;
|
|
183
|
+
r.complete = function(n) {
|
|
184
|
+
var c, i, l;
|
|
185
|
+
t && t(n);
|
|
186
|
+
const s = ((l = (i = (c = r.url) == null ? void 0 : c.slice(1)) == null ? void 0 : i.split("?")) == null ? void 0 : l[0]) || "/";
|
|
187
|
+
e.event.updateCurrentPagePath(s);
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
});
|
|
@@ -197,46 +197,46 @@ class V {
|
|
|
197
197
|
interceptRequest() {
|
|
198
198
|
const e = this;
|
|
199
199
|
uni.addInterceptor("request", {
|
|
200
|
-
invoke(
|
|
201
|
-
var u,
|
|
202
|
-
const t = e.event.getRequestIndex(),
|
|
203
|
-
`),
|
|
204
|
-
index:
|
|
205
|
-
stack:
|
|
206
|
-
url:
|
|
207
|
-
name:
|
|
200
|
+
invoke(r) {
|
|
201
|
+
var u, S, k;
|
|
202
|
+
const t = e.event.getRequestIndex(), n = e.event.setRequestIndex(t + 1), s = r.url, c = (u = s == null ? void 0 : s.split("?")) == null ? void 0 : u[0], i = c == null ? void 0 : c.lastIndexOf("/"), l = (c == null ? void 0 : c.slice(i + 1)) ?? "", o = (k = (S = new Error()) == null ? void 0 : S.stack) == null ? void 0 : k.split(`
|
|
203
|
+
`), m = o == null ? void 0 : o[5], a = {
|
|
204
|
+
index: n,
|
|
205
|
+
stack: m,
|
|
206
|
+
url: r.url,
|
|
207
|
+
name: l,
|
|
208
208
|
startTime: Date.now(),
|
|
209
209
|
endTime: 0,
|
|
210
210
|
time: "-",
|
|
211
211
|
headers: {
|
|
212
|
-
requestHeader: Object.entries(
|
|
213
|
-
([
|
|
214
|
-
key:
|
|
215
|
-
value:
|
|
212
|
+
requestHeader: Object.entries(r.header ?? {}).map(
|
|
213
|
+
([h, g]) => ({
|
|
214
|
+
key: h,
|
|
215
|
+
value: g
|
|
216
216
|
})
|
|
217
217
|
),
|
|
218
218
|
responseHeader: []
|
|
219
219
|
},
|
|
220
|
-
method:
|
|
220
|
+
method: r.method || "GET",
|
|
221
221
|
status: "pending",
|
|
222
|
-
payload:
|
|
222
|
+
payload: r != null && r.data ? JSON.stringify(r.data) : "",
|
|
223
223
|
response: "",
|
|
224
224
|
size: ""
|
|
225
225
|
};
|
|
226
|
-
e.event.updateNetworkList([
|
|
227
|
-
let d =
|
|
228
|
-
|
|
229
|
-
var
|
|
230
|
-
d && d(
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
const y = ((
|
|
234
|
-
|
|
235
|
-
|
|
226
|
+
e.event.updateNetworkList([a]);
|
|
227
|
+
let d = r.complete;
|
|
228
|
+
r.complete = function(h) {
|
|
229
|
+
var T, w;
|
|
230
|
+
d && d(h), a.status = h.statusCode ?? "error", a.endTime = Date.now();
|
|
231
|
+
const g = Date.now() - a.startTime;
|
|
232
|
+
a.time = g < 1e3 ? g + "ms" : g / 1e3 + "s";
|
|
233
|
+
const y = ((T = h == null ? void 0 : h.header) == null ? void 0 : T["Content-Length"]) || ((w = h == null ? void 0 : h.header) == null ? void 0 : w["content-length"]) || 0;
|
|
234
|
+
a.size = y > 1024 ? (y / 1024).toFixed(2) + "k" : y + "b", a.response = h, a.headers.responseHeader = Object.entries(
|
|
235
|
+
h.header ?? {}
|
|
236
236
|
).map(([L, D]) => ({
|
|
237
237
|
key: L,
|
|
238
238
|
value: D
|
|
239
|
-
})), e.event.updateNetworkList([
|
|
239
|
+
})), e.event.updateNetworkList([a], n);
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
});
|
|
@@ -247,27 +247,27 @@ class V {
|
|
|
247
247
|
* @memberof DevIntercept
|
|
248
248
|
*/
|
|
249
249
|
interceptSocket() {
|
|
250
|
-
const e = this,
|
|
251
|
-
const
|
|
252
|
-
([
|
|
253
|
-
),
|
|
250
|
+
const e = this, r = function(t) {
|
|
251
|
+
const n = t.url, s = Object.entries(t.header ?? {}).map(
|
|
252
|
+
([a, d]) => ({ key: a, value: d })
|
|
253
|
+
), c = (t.method ?? "GET").toLowerCase(), i = t.protocols ?? [];
|
|
254
254
|
e.event.updateWsList({
|
|
255
|
-
url:
|
|
256
|
-
headers:
|
|
257
|
-
method:
|
|
258
|
-
protocols:
|
|
255
|
+
url: n,
|
|
256
|
+
headers: s,
|
|
257
|
+
method: c,
|
|
258
|
+
protocols: i,
|
|
259
259
|
readyState: "connection",
|
|
260
260
|
message: []
|
|
261
261
|
});
|
|
262
|
-
const
|
|
262
|
+
const l = v.connectSocket({
|
|
263
263
|
...t,
|
|
264
|
-
success: (
|
|
264
|
+
success: (a) => {
|
|
265
265
|
var d;
|
|
266
|
-
(d = t.success) == null || d.call(t,
|
|
267
|
-
url:
|
|
266
|
+
(d = t.success) == null || d.call(t, a), e.event.updateWsList({
|
|
267
|
+
url: n,
|
|
268
268
|
readyState: "open",
|
|
269
|
-
headers:
|
|
270
|
-
protocols:
|
|
269
|
+
headers: s,
|
|
270
|
+
protocols: i,
|
|
271
271
|
message: [
|
|
272
272
|
{
|
|
273
273
|
data: "连接成功",
|
|
@@ -277,13 +277,13 @@ class V {
|
|
|
277
277
|
]
|
|
278
278
|
});
|
|
279
279
|
},
|
|
280
|
-
fail: (
|
|
280
|
+
fail: (a) => {
|
|
281
281
|
var d;
|
|
282
|
-
(d = t.fail) == null || d.call(t,
|
|
283
|
-
url:
|
|
282
|
+
(d = t.fail) == null || d.call(t, a), e.event.updateWsList({
|
|
283
|
+
url: n,
|
|
284
284
|
readyState: "error",
|
|
285
|
-
headers:
|
|
286
|
-
protocols:
|
|
285
|
+
headers: s,
|
|
286
|
+
protocols: i,
|
|
287
287
|
message: [
|
|
288
288
|
{
|
|
289
289
|
data: "连接失败",
|
|
@@ -293,21 +293,21 @@ class V {
|
|
|
293
293
|
]
|
|
294
294
|
});
|
|
295
295
|
},
|
|
296
|
-
complete: (
|
|
296
|
+
complete: (a) => {
|
|
297
297
|
var d;
|
|
298
|
-
(d = t == null ? void 0 : t.complete) == null || d.call(t,
|
|
298
|
+
(d = t == null ? void 0 : t.complete) == null || d.call(t, a);
|
|
299
299
|
}
|
|
300
|
-
}),
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
data:
|
|
300
|
+
}), o = l.send;
|
|
301
|
+
l.send = (a) => {
|
|
302
|
+
o.call(l, {
|
|
303
|
+
data: a.data,
|
|
304
304
|
fail: (d) => {
|
|
305
305
|
var u;
|
|
306
|
-
(u =
|
|
307
|
-
url:
|
|
306
|
+
(u = a == null ? void 0 : a.fail) == null || u.call(a, d), e.event.updateWsList({
|
|
307
|
+
url: n,
|
|
308
308
|
readyState: "error",
|
|
309
|
-
headers:
|
|
310
|
-
protocols:
|
|
309
|
+
headers: s,
|
|
310
|
+
protocols: i,
|
|
311
311
|
message: [
|
|
312
312
|
{
|
|
313
313
|
data: JSON.stringify(d),
|
|
@@ -318,78 +318,78 @@ class V {
|
|
|
318
318
|
});
|
|
319
319
|
},
|
|
320
320
|
success: (d) => {
|
|
321
|
-
var u,
|
|
322
|
-
(u =
|
|
321
|
+
var u, S;
|
|
322
|
+
(u = a == null ? void 0 : a.success) == null || u.call(a, d), e.event.updateWsList({
|
|
323
323
|
readyState: "open",
|
|
324
|
-
url:
|
|
325
|
-
headers:
|
|
326
|
-
protocols:
|
|
324
|
+
url: n,
|
|
325
|
+
headers: s,
|
|
326
|
+
protocols: i,
|
|
327
327
|
message: [
|
|
328
328
|
{
|
|
329
329
|
type: "success",
|
|
330
330
|
time: Date.now(),
|
|
331
|
-
data: (
|
|
331
|
+
data: (S = a.data) == null ? void 0 : S.toString()
|
|
332
332
|
}
|
|
333
333
|
]
|
|
334
334
|
});
|
|
335
335
|
},
|
|
336
336
|
complete: (d) => {
|
|
337
337
|
var u;
|
|
338
|
-
(u =
|
|
338
|
+
(u = a == null ? void 0 : a.complete) == null || u.call(a, d);
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
341
|
};
|
|
342
|
-
const
|
|
343
|
-
return
|
|
342
|
+
const m = l.close;
|
|
343
|
+
return l.close = (a) => {
|
|
344
344
|
e.event.updateWsList({
|
|
345
|
-
url:
|
|
345
|
+
url: n,
|
|
346
346
|
readyState: "closing",
|
|
347
|
-
headers:
|
|
348
|
-
protocols:
|
|
347
|
+
headers: s,
|
|
348
|
+
protocols: i,
|
|
349
349
|
message: []
|
|
350
|
-
}),
|
|
351
|
-
...
|
|
350
|
+
}), m.call(l, {
|
|
351
|
+
...a,
|
|
352
352
|
fail: (d) => {
|
|
353
353
|
var u;
|
|
354
|
-
(u =
|
|
355
|
-
url:
|
|
356
|
-
headers:
|
|
354
|
+
(u = a == null ? void 0 : a.fail) == null || u.call(a, d), e.event.updateWsList({
|
|
355
|
+
url: n,
|
|
356
|
+
headers: s,
|
|
357
357
|
readyState: "open",
|
|
358
|
-
protocols:
|
|
358
|
+
protocols: i,
|
|
359
359
|
message: []
|
|
360
360
|
});
|
|
361
361
|
},
|
|
362
362
|
success: (d) => {
|
|
363
363
|
var u;
|
|
364
|
-
(u =
|
|
365
|
-
url:
|
|
366
|
-
headers:
|
|
364
|
+
(u = a == null ? void 0 : a.success) == null || u.call(a, d), e.event.updateWsList({
|
|
365
|
+
url: n,
|
|
366
|
+
headers: s,
|
|
367
367
|
readyState: "closed",
|
|
368
|
-
protocols:
|
|
368
|
+
protocols: i,
|
|
369
369
|
message: []
|
|
370
370
|
});
|
|
371
371
|
},
|
|
372
372
|
complete: (d) => {
|
|
373
373
|
var u;
|
|
374
|
-
(u =
|
|
374
|
+
(u = a == null ? void 0 : a.complete) == null || u.call(a, d);
|
|
375
375
|
}
|
|
376
376
|
});
|
|
377
|
-
},
|
|
377
|
+
}, l.onMessage((a) => {
|
|
378
378
|
e.event.updateWsList({
|
|
379
|
-
url:
|
|
380
|
-
headers:
|
|
381
|
-
protocols:
|
|
379
|
+
url: n,
|
|
380
|
+
headers: s,
|
|
381
|
+
protocols: i,
|
|
382
382
|
message: [
|
|
383
383
|
{
|
|
384
384
|
type: "success",
|
|
385
385
|
time: Date.now(),
|
|
386
|
-
data: JSON.parse(
|
|
386
|
+
data: JSON.parse(a.data)
|
|
387
387
|
}
|
|
388
388
|
]
|
|
389
389
|
});
|
|
390
|
-
}),
|
|
390
|
+
}), l;
|
|
391
391
|
};
|
|
392
|
-
uni.connectSocket =
|
|
392
|
+
uni.connectSocket = r;
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
395
395
|
* 拦截 uni.setStorageSync 和 uni.setStorage
|
|
@@ -397,30 +397,32 @@ class V {
|
|
|
397
397
|
* @memberof DevIntercept
|
|
398
398
|
*/
|
|
399
399
|
interceptSetStorage() {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
_oldKey: e.toString(),
|
|
405
|
-
value: s
|
|
406
|
-
}
|
|
407
|
-
]);
|
|
408
|
-
}, uni.setStorage = (e) => {
|
|
409
|
-
var s;
|
|
410
|
-
v.setStorage({
|
|
411
|
-
...e,
|
|
412
|
-
key: (s = e.key) == null ? void 0 : s.toString()
|
|
413
|
-
}).then(() => {
|
|
414
|
-
var t, i;
|
|
415
|
-
this.event.updateStoreList([
|
|
400
|
+
const e = this;
|
|
401
|
+
Object.defineProperty(uni, "setStorageSync", {
|
|
402
|
+
value: function(r, t) {
|
|
403
|
+
v.setStorageSync(r.toString(), t), e.event.updateStoreList([
|
|
416
404
|
{
|
|
417
|
-
key:
|
|
418
|
-
_oldKey:
|
|
419
|
-
value:
|
|
405
|
+
key: r.toString(),
|
|
406
|
+
_oldKey: r.toString(),
|
|
407
|
+
value: t
|
|
420
408
|
}
|
|
421
409
|
]);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
410
|
+
}
|
|
411
|
+
}), uni.addInterceptor("setStorage", {
|
|
412
|
+
invoke(r) {
|
|
413
|
+
const t = r.complete;
|
|
414
|
+
r.complete = function(n) {
|
|
415
|
+
var s, c;
|
|
416
|
+
t && t(n), e.event.updateStoreList([
|
|
417
|
+
{
|
|
418
|
+
key: (s = r.key) == null ? void 0 : s.toString(),
|
|
419
|
+
_oldKey: (c = r.key) == null ? void 0 : c.toString(),
|
|
420
|
+
value: r.data
|
|
421
|
+
}
|
|
422
|
+
]);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
});
|
|
424
426
|
}
|
|
425
427
|
/**
|
|
426
428
|
* 拦截 uni.clearStorageSync 和 uni.clearStorage
|
|
@@ -428,11 +430,16 @@ class V {
|
|
|
428
430
|
* @memberof DevIntercept
|
|
429
431
|
*/
|
|
430
432
|
interceptClearStorage() {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
433
|
+
const e = this;
|
|
434
|
+
Object.defineProperty(uni, "clearStorage", {
|
|
435
|
+
value: function() {
|
|
436
|
+
v.clearStorage(), e.event.clearStorage();
|
|
437
|
+
}
|
|
438
|
+
}), uni.addInterceptor("clearStorage", {
|
|
439
|
+
invoke() {
|
|
440
|
+
e.event.clearStorage();
|
|
441
|
+
}
|
|
442
|
+
});
|
|
436
443
|
}
|
|
437
444
|
/**
|
|
438
445
|
* 拦截 uni.removeStorageSync 和 uni.removeStorage
|
|
@@ -440,25 +447,31 @@ class V {
|
|
|
440
447
|
* @memberof DevIntercept
|
|
441
448
|
*/
|
|
442
449
|
interceptRemoveStorage() {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
+
const e = this;
|
|
451
|
+
Object.defineProperty(uni, "removeStorageSync", {
|
|
452
|
+
value: function(r) {
|
|
453
|
+
v.removeStorageSync(r), e.event.removeStorage(r);
|
|
454
|
+
}
|
|
455
|
+
}), uni.addInterceptor("removeStorage", {
|
|
456
|
+
invoke(r) {
|
|
457
|
+
const t = r.complete;
|
|
458
|
+
r.complete = function(n) {
|
|
459
|
+
t && t(n), e.event.removeStorage(r.key);
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
});
|
|
450
463
|
}
|
|
451
464
|
/** 拦截vuex */
|
|
452
465
|
interceptVuexStorage(e) {
|
|
453
|
-
var
|
|
454
|
-
this.event.setVuexList(e.state), (
|
|
455
|
-
this.event.setVuexList(
|
|
466
|
+
var r;
|
|
467
|
+
this.event.setVuexList(e.state), (r = e == null ? void 0 : e.subscribe) == null || r.call(e, (t, n) => {
|
|
468
|
+
this.event.setVuexList(n);
|
|
456
469
|
});
|
|
457
470
|
}
|
|
458
471
|
/** 拦截pinia */
|
|
459
472
|
interceptPiniaStore(e) {
|
|
460
|
-
var
|
|
461
|
-
return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (
|
|
473
|
+
var r;
|
|
474
|
+
return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (r = e == null ? void 0 : e.store) == null || r.$subscribe(() => {
|
|
462
475
|
this.event.setPiniaList({
|
|
463
476
|
[e.store.$id]: e.store.$state
|
|
464
477
|
});
|
|
@@ -470,19 +483,19 @@ class V {
|
|
|
470
483
|
* @memberof DevIntercept
|
|
471
484
|
*/
|
|
472
485
|
interceptUploadFile() {
|
|
473
|
-
const e = this,
|
|
474
|
-
const
|
|
486
|
+
const e = this, r = (t) => {
|
|
487
|
+
const n = e.event.getUploadIndex(), s = e.event.setUploadIndex(n + 1);
|
|
475
488
|
e.event.updateUploadList(
|
|
476
489
|
[
|
|
477
490
|
{
|
|
478
|
-
index:
|
|
491
|
+
index: s,
|
|
479
492
|
name: t.name,
|
|
480
493
|
url: t.url,
|
|
481
494
|
filePath: t.filePath,
|
|
482
495
|
fileType: t.fileType,
|
|
483
496
|
headers: {
|
|
484
497
|
requestHeader: Object.entries(t.header || {}).map(
|
|
485
|
-
([
|
|
498
|
+
([i, l]) => ({ key: i, value: l })
|
|
486
499
|
),
|
|
487
500
|
responseHeader: []
|
|
488
501
|
},
|
|
@@ -494,70 +507,70 @@ class V {
|
|
|
494
507
|
startTime: Date.now()
|
|
495
508
|
}
|
|
496
509
|
],
|
|
497
|
-
|
|
510
|
+
s
|
|
498
511
|
);
|
|
499
|
-
const
|
|
512
|
+
const c = v.uploadFile({
|
|
500
513
|
...t,
|
|
501
|
-
success: (
|
|
502
|
-
var
|
|
503
|
-
(
|
|
514
|
+
success: (i) => {
|
|
515
|
+
var l;
|
|
516
|
+
(l = t == null ? void 0 : t.success) == null || l.call(t, i), e.event.updateUploadList(
|
|
504
517
|
[
|
|
505
518
|
{
|
|
506
|
-
index:
|
|
519
|
+
index: s,
|
|
507
520
|
status: "success",
|
|
508
521
|
endTime: Date.now(),
|
|
509
522
|
response: {
|
|
510
|
-
...
|
|
511
|
-
data: JSON.parse(
|
|
523
|
+
...i,
|
|
524
|
+
data: JSON.parse(i.data)
|
|
512
525
|
}
|
|
513
526
|
}
|
|
514
527
|
],
|
|
515
|
-
|
|
516
|
-
), e.event.removeUploadTask(
|
|
528
|
+
s
|
|
529
|
+
), e.event.removeUploadTask(s);
|
|
517
530
|
},
|
|
518
|
-
fail: (
|
|
519
|
-
var
|
|
520
|
-
(
|
|
531
|
+
fail: (i) => {
|
|
532
|
+
var l;
|
|
533
|
+
(l = t == null ? void 0 : t.fail) == null || l.call(t, i), e.event.updateUploadList(
|
|
521
534
|
[
|
|
522
535
|
{
|
|
523
|
-
index:
|
|
536
|
+
index: s,
|
|
524
537
|
status: "error",
|
|
525
|
-
response:
|
|
538
|
+
response: i,
|
|
526
539
|
endTime: Date.now()
|
|
527
540
|
}
|
|
528
541
|
],
|
|
529
|
-
|
|
530
|
-
), e.event.removeUploadTask(
|
|
542
|
+
s
|
|
543
|
+
), e.event.removeUploadTask(s);
|
|
531
544
|
}
|
|
532
545
|
});
|
|
533
|
-
return
|
|
546
|
+
return c.onProgressUpdate((i) => {
|
|
534
547
|
e.event.updateUploadList(
|
|
535
548
|
[
|
|
536
549
|
{
|
|
537
|
-
index:
|
|
538
|
-
progress:
|
|
539
|
-
totalBytesSent:
|
|
540
|
-
totalBytesExpectedToSend:
|
|
550
|
+
index: s,
|
|
551
|
+
progress: i.progress,
|
|
552
|
+
totalBytesSent: i.totalBytesSent,
|
|
553
|
+
totalBytesExpectedToSend: i.totalBytesExpectedToSend,
|
|
541
554
|
status: "uploading"
|
|
542
555
|
}
|
|
543
556
|
],
|
|
544
|
-
|
|
557
|
+
s
|
|
545
558
|
);
|
|
546
|
-
}), e.event.addUploadTask(
|
|
559
|
+
}), e.event.addUploadTask(s, c), c;
|
|
547
560
|
};
|
|
548
|
-
uni.uploadFile =
|
|
561
|
+
uni.uploadFile = r.bind(uni);
|
|
549
562
|
}
|
|
550
563
|
interceptUniEventFactory(e) {
|
|
551
|
-
const
|
|
552
|
-
uni[`$${e}`] = (t,
|
|
553
|
-
var
|
|
554
|
-
const
|
|
555
|
-
`),
|
|
556
|
-
(
|
|
564
|
+
const r = `$${e}`;
|
|
565
|
+
uni[`$${e}`] = (t, n) => {
|
|
566
|
+
var i, l, o, m;
|
|
567
|
+
const s = (l = (i = new Error()) == null ? void 0 : i.stack) == null ? void 0 : l.split(`
|
|
568
|
+
`), c = s == null ? void 0 : s[2];
|
|
569
|
+
(m = (o = v) == null ? void 0 : o[r]) == null || m.call(o, t, n), this.event.updateUniEventList([
|
|
557
570
|
{
|
|
558
571
|
eventName: t,
|
|
559
|
-
timer:
|
|
560
|
-
stack:
|
|
572
|
+
timer: p(),
|
|
573
|
+
stack: c,
|
|
561
574
|
type: e
|
|
562
575
|
}
|
|
563
576
|
]), this.event.updateUniEventCount(e);
|
|
@@ -576,12 +589,12 @@ class V {
|
|
|
576
589
|
this.event.getDevToolDestroy() || this.event.updateCaptureScreenList([
|
|
577
590
|
{
|
|
578
591
|
position: f(),
|
|
579
|
-
timer:
|
|
592
|
+
timer: p()
|
|
580
593
|
}
|
|
581
594
|
]);
|
|
582
595
|
});
|
|
583
596
|
}
|
|
584
597
|
}
|
|
585
598
|
export {
|
|
586
|
-
|
|
599
|
+
I as DevIntercept
|
|
587
600
|
};
|
package/dist/devStore/index.d.ts
CHANGED
|
@@ -134,13 +134,13 @@ export declare class DevStore {
|
|
|
134
134
|
clearWsList(): void;
|
|
135
135
|
updateWsList(item: DevTool.WS): DevTool.WS[] | undefined;
|
|
136
136
|
clearWsMessage(url: string): void;
|
|
137
|
-
clearStorageList(): DevTool.StorageItem[];
|
|
137
|
+
clearStorageList(local?: boolean): DevTool.StorageItem[];
|
|
138
138
|
setStorageList(items: DevTool.StorageItem[]): DevTool.StorageItem[] | undefined;
|
|
139
|
-
removeStorage(key: string): DevTool.StorageItem[];
|
|
139
|
+
removeStorage(key: string, local?: boolean): DevTool.StorageItem[];
|
|
140
140
|
addStorage(data: {
|
|
141
141
|
key: string;
|
|
142
142
|
value: any;
|
|
143
|
-
}): DevTool.StorageItem[] | undefined;
|
|
143
|
+
}, local?: boolean): DevTool.StorageItem[] | undefined;
|
|
144
144
|
refreshStore(): DevTool.StorageItem[];
|
|
145
145
|
updateStoreList(addItems: DevTool.StorageItem[]): DevTool.StorageItem[] | undefined;
|
|
146
146
|
setRouteList(pages: DevTool.Page[], currentPath?: string): DevTool.Page[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devStore/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAgBvC,cAAc;AACd,qBAAa,QAAQ;IACnB,WAAW;IACX,OAAO,CAAC,KAAK,CAsBX;IAEF,WAAW;IACX,OAAO,CAAC,cAAc,CAAqC;IAC3D,YAAY;IACZ,OAAO,CAAC,aAAa,CAAQ;IAC7B,YAAY;IACZ,OAAO,CAAC,cAAc,CAAQ;IAC9B,YAAY;IACZ,OAAO,CAAC,cAAc,CAAQ;IAC9B,cAAc;IACd,OAAO,CAAC,aAAa,CAAQ;IAC7B,cAAc;IACd,OAAO,CAAC,gBAAgB,CAAQ;IAChC,YAAY;IACZ,OAAO,CAAC,oBAAoB,CAAQ;IAEpC,YAAY;IACZ,YAAY,SAAwB;IAEpC,OAAO,CAAC,SAAS,CAAM;IAEvB,OAAO,CAAC,UAAU,CAAM;IAExB,OAAO,CAAC,aAAa,CAAiD;IAEtE,OAAO,CAAC,YAAY,CAAM;IAE1B,OAAO,CAAC,WAAW,CAAM;IAEzB,aAAa;IACb,OAAO,CAAC,cAAc,CAAS;IAE/B,WAAW;IACX,OAAO,CAAC,cAAc,CAAS;IAE/B,6BAA6B;IAC7B,4BAA4B,UAAS;IAErC,OAAO,CAAC,MAAM,CAAQ;;IAUtB,iBAAiB,CAAC,OAAO,EAAE,OAAO;IAQlC,iBAAiB;IAIjB,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAA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MjB,kBAAkB;IASlB;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS;IAOrC;;;;;OAKG;IACH,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa;IAY/C,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,EAAE;IAYhD,aAAa;IAUb,uBAAuB,CAAC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE;IActE,sBAAsB;CAGvB"}
|
package/dist/devStore/index.js
CHANGED
|
@@ -219,25 +219,25 @@ class V {
|
|
|
219
219
|
const e = ((o = (s = this.state) == null ? void 0 : s.wsList) == null ? void 0 : o.findIndex((a) => a.url === t)) ?? -1;
|
|
220
220
|
e !== -1 && (i = this.state.wsList) != null && i[e] && (this.state.wsList[e].message = []);
|
|
221
221
|
}
|
|
222
|
-
clearStorageList() {
|
|
223
|
-
return this.state.storageList = [], uni.clearStorage(), this.state.storageList;
|
|
222
|
+
clearStorageList(t) {
|
|
223
|
+
return this.state.storageList = [], t && uni.clearStorage(), this.state.storageList;
|
|
224
224
|
}
|
|
225
225
|
setStorageList(t) {
|
|
226
226
|
if (this.getDevToolVisible())
|
|
227
227
|
return this.state.storageList = t, this.state.storageList;
|
|
228
228
|
}
|
|
229
|
-
removeStorage(t) {
|
|
230
|
-
var
|
|
231
|
-
return this.state.storageList = ((
|
|
229
|
+
removeStorage(t, e) {
|
|
230
|
+
var s;
|
|
231
|
+
return this.state.storageList = ((s = this.state.storageList) == null ? void 0 : s.filter((o) => o.key !== t)) ?? [], e && uni.removeStorageSync(t), this.state.storageList;
|
|
232
232
|
}
|
|
233
|
-
addStorage(t) {
|
|
234
|
-
var
|
|
235
|
-
const { key:
|
|
236
|
-
return (
|
|
237
|
-
key:
|
|
238
|
-
_oldKey:
|
|
239
|
-
value:
|
|
240
|
-
}), uni.setStorageSync(
|
|
233
|
+
addStorage(t, e) {
|
|
234
|
+
var i;
|
|
235
|
+
const { key: s, value: o } = t;
|
|
236
|
+
return (i = this.state.storageList) == null || i.unshift({
|
|
237
|
+
key: s,
|
|
238
|
+
_oldKey: s,
|
|
239
|
+
value: o
|
|
240
|
+
}), e && uni.setStorageSync(s, o), this.state.storageList;
|
|
241
241
|
}
|
|
242
242
|
refreshStore() {
|
|
243
243
|
const { keys: t } = uni.getStorageInfoSync();
|
|
@@ -140,14 +140,14 @@ export default {
|
|
|
140
140
|
|
|
141
141
|
// 向上滚动时加载前面的数据
|
|
142
142
|
if (
|
|
143
|
-
this.current >
|
|
143
|
+
this.current > 0 &&
|
|
144
144
|
this.currentHeight > 0 &&
|
|
145
145
|
scrollTop - this.preLodeHeight < this.currentHeight
|
|
146
146
|
) {
|
|
147
147
|
this.start = this.current * this.pageSize;
|
|
148
148
|
this.current--;
|
|
149
149
|
|
|
150
|
-
this.updateVisitableData(
|
|
150
|
+
this.updateVisitableData();
|
|
151
151
|
this.updateCurrentHeight();
|
|
152
152
|
}
|
|
153
153
|
},
|
|
@@ -159,7 +159,7 @@ export default {
|
|
|
159
159
|
|
|
160
160
|
this.updateCurrentHeight();
|
|
161
161
|
this.$nextTick(() => {
|
|
162
|
-
this.updateVisitableData(
|
|
162
|
+
this.updateVisitableData();
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
},
|
|
@@ -183,8 +183,12 @@ export default {
|
|
|
183
183
|
},
|
|
184
184
|
// 更新总高度(累加已加载项的高度)
|
|
185
185
|
updateCurrentHeight() {
|
|
186
|
+
const pageSize = this.pageSize;
|
|
187
|
+
const current = this.current;
|
|
188
|
+
const currentSub1 = current - 1 < 0 ? 0 : current - 1;
|
|
189
|
+
|
|
186
190
|
const total = this.itemsHeight
|
|
187
|
-
.slice(0,
|
|
191
|
+
.slice(0, currentSub1 * pageSize)
|
|
188
192
|
.reduce((acc, height) => acc + (height || 0), 0);
|
|
189
193
|
this.currentHeight = total;
|
|
190
194
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="setting-content">
|
|
3
3
|
<view class="setting-item">
|
|
4
|
-
<DevToolTitle>DevTool(v0.0.
|
|
4
|
+
<DevToolTitle>DevTool(v0.0.20-vue3)</DevToolTitle>
|
|
5
5
|
<view class="setting-item-content">
|
|
6
6
|
<view class="setting-row">
|
|
7
7
|
<view>显示调试按钮:</view>
|
|
@@ -9,36 +9,49 @@
|
|
|
9
9
|
<CircularButton style="margin-left: auto" text="×" @click="onClose" />
|
|
10
10
|
</view>
|
|
11
11
|
<view class="dev-tool-code-title">{{ fileName }}</view>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
:
|
|
18
|
-
:
|
|
12
|
+
|
|
13
|
+
<VirtualListPro
|
|
14
|
+
v-if="codes.length > 0"
|
|
15
|
+
scrollX
|
|
16
|
+
:pageSize="pageSize"
|
|
17
|
+
:height="height"
|
|
18
|
+
:data="codes"
|
|
19
|
+
:scrollWithAnimation="true"
|
|
20
|
+
:defaultCurrent="defaultCurrent"
|
|
21
|
+
:scrollIntoView="scrollIntoView"
|
|
19
22
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
<template #default="{ list, current, start }">
|
|
24
|
+
<AutoSize
|
|
25
|
+
v-for="(code, index) in list"
|
|
26
|
+
:key="start + index"
|
|
27
|
+
:index="start + index"
|
|
28
|
+
>
|
|
29
|
+
<view
|
|
30
|
+
:id="`dev-code-${start + index}`"
|
|
31
|
+
:class="`dev-tool-code-item ${start + index === activeRowCol.row ? 'dev-tool-code-item-active' : ''}`"
|
|
32
|
+
>
|
|
33
|
+
<view class="dev-tool-code-item-index">
|
|
34
|
+
{{ start + index + 1 }}
|
|
35
|
+
</view>
|
|
36
|
+
|
|
37
|
+
<view class="dev-tool-code-item-content">
|
|
38
|
+
{{ code }}
|
|
39
|
+
</view>
|
|
40
|
+
</view>
|
|
41
|
+
</AutoSize>
|
|
42
|
+
</template>
|
|
43
|
+
</VirtualListPro>
|
|
44
|
+
<Empty v-if="!codes || codes.length === 0" />
|
|
34
45
|
</view>
|
|
35
46
|
</template>
|
|
36
47
|
<script lang="ts" setup>
|
|
37
|
-
import { computed, ref,
|
|
48
|
+
import { computed, ref, onMounted } from 'vue';
|
|
38
49
|
import FilterInput from '../FilterInput/index.vue';
|
|
39
50
|
import CircularButton from '../CircularButton/index.vue';
|
|
51
|
+
import VirtualListPro from '../VirtualListPro/index.vue';
|
|
40
52
|
import Empty from '../Empty/index.vue';
|
|
41
|
-
import
|
|
53
|
+
import AutoSize from '../VirtualListPro/AutoSize.vue';
|
|
54
|
+
import { hightLight, isAndroid, parseStock } from '../../utils';
|
|
42
55
|
|
|
43
56
|
const props = defineProps<{
|
|
44
57
|
url: string;
|
|
@@ -50,7 +63,7 @@ const props = defineProps<{
|
|
|
50
63
|
const emit = defineEmits<{ (e: 'close'): void }>();
|
|
51
64
|
|
|
52
65
|
const modelValue = ref('');
|
|
53
|
-
const
|
|
66
|
+
const height = ref(0);
|
|
54
67
|
const fileName = computed(() => {
|
|
55
68
|
const name =
|
|
56
69
|
props?.url?.split('/')?.pop()?.replace(/\)|\(/, '') ?? '文件名称未知';
|
|
@@ -58,16 +71,13 @@ const fileName = computed(() => {
|
|
|
58
71
|
});
|
|
59
72
|
|
|
60
73
|
const activeRowCol = ref({ row: -1, col: -1, activeRow: -1 });
|
|
74
|
+
const scrollIntoView = ref('');
|
|
61
75
|
|
|
62
76
|
let backupCodes: string[] = [];
|
|
63
77
|
|
|
64
78
|
const codes = ref<string[]>([]);
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const start = computed(() => {
|
|
69
|
-
return activeRowCol.value.row - 20 > 0 ? activeRowCol.value.row - 20 : 0;
|
|
70
|
-
});
|
|
79
|
+
const defaultCurrent = ref(1);
|
|
80
|
+
const pageSize = 25;
|
|
71
81
|
|
|
72
82
|
function onClose() {
|
|
73
83
|
emit('close');
|
|
@@ -79,6 +89,35 @@ function onSearch(value: string) {
|
|
|
79
89
|
});
|
|
80
90
|
}
|
|
81
91
|
|
|
92
|
+
let timer: number;
|
|
93
|
+
function startCounter({
|
|
94
|
+
start,
|
|
95
|
+
target,
|
|
96
|
+
duration,
|
|
97
|
+
onExecute,
|
|
98
|
+
onSuccess,
|
|
99
|
+
}: {
|
|
100
|
+
start: number;
|
|
101
|
+
target: number;
|
|
102
|
+
duration: number;
|
|
103
|
+
onExecute: (current: number) => void;
|
|
104
|
+
onSuccess: () => void;
|
|
105
|
+
}) {
|
|
106
|
+
if (timer) return;
|
|
107
|
+
|
|
108
|
+
let s = start;
|
|
109
|
+
timer = setInterval(() => {
|
|
110
|
+
if (s >= target) {
|
|
111
|
+
clearInterval(timer);
|
|
112
|
+
console.log('停止');
|
|
113
|
+
onSuccess();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
s++;
|
|
117
|
+
onExecute(s);
|
|
118
|
+
}, duration);
|
|
119
|
+
}
|
|
120
|
+
|
|
82
121
|
let index = 0;
|
|
83
122
|
function getCode(url: string, i: number = 0) {
|
|
84
123
|
let allUrl = url;
|
|
@@ -100,34 +139,23 @@ function getCode(url: string, i: number = 0) {
|
|
|
100
139
|
url: allUrl,
|
|
101
140
|
success: (res) => {
|
|
102
141
|
if (typeof res.data === 'string') {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
//
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
? backupCodes.length
|
|
121
|
-
: activeRowCol.value.row + 20;
|
|
122
|
-
|
|
123
|
-
// backupCodes.slice(start, end);
|
|
124
|
-
|
|
125
|
-
codes.value = backupCodes.slice(start, end);
|
|
126
|
-
|
|
127
|
-
activeRowCol.value.activeRow = activeRowCol.value.row - start;
|
|
128
|
-
|
|
129
|
-
nextTick(() => {
|
|
130
|
-
scrollIntoView.value = `dev-tool-code-item-${activeRowCol.value.activeRow}`;
|
|
142
|
+
codes.value = res.data?.split('\n') ?? [];
|
|
143
|
+
|
|
144
|
+
// 缓慢显示
|
|
145
|
+
const row = activeRowCol.value.row;
|
|
146
|
+
// defaultCurrent.value = Math.ceil(activeRowCol.value.row / pageSize);
|
|
147
|
+
const targetCurrent = Math.ceil(row / pageSize);
|
|
148
|
+
|
|
149
|
+
startCounter({
|
|
150
|
+
start: 1,
|
|
151
|
+
target: targetCurrent,
|
|
152
|
+
duration: 500,
|
|
153
|
+
onExecute(current) {
|
|
154
|
+
scrollIntoView.value = `dev-code-${current * pageSize - 1}`;
|
|
155
|
+
},
|
|
156
|
+
onSuccess() {
|
|
157
|
+
// scrollIntoView.value = `dev-code-${row}`;
|
|
158
|
+
},
|
|
131
159
|
});
|
|
132
160
|
}
|
|
133
161
|
},
|
|
@@ -155,6 +183,10 @@ function getSourceCodeDev(url: string) {
|
|
|
155
183
|
}
|
|
156
184
|
|
|
157
185
|
onMounted(() => {
|
|
186
|
+
const { windowHeight } = uni.getWindowInfo();
|
|
187
|
+
|
|
188
|
+
height.value = windowHeight - 32 - 32 - 32;
|
|
189
|
+
|
|
158
190
|
let url = props?.url;
|
|
159
191
|
|
|
160
192
|
const { path, col, row } = parseStock(props?.url ?? '');
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
:style="style"
|
|
7
7
|
:scroll-into-view="innerScrollIntoView"
|
|
8
8
|
scroll-y
|
|
9
|
+
:scrollX="scrollX"
|
|
9
10
|
@scroll="onScroll"
|
|
10
11
|
@scrolltolower="onScrollToLower"
|
|
11
12
|
>
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
</template>
|
|
35
36
|
<script lang="ts" setup>
|
|
36
37
|
import { nextTick } from 'vue';
|
|
37
|
-
import { uniqueId } from '../../utils';
|
|
38
|
+
import { debounce, uniqueId } from '../../utils';
|
|
38
39
|
import { reactive, watch, onBeforeMount, provide, computed, ref } from 'vue';
|
|
39
40
|
|
|
40
41
|
const props = withDefaults(
|
|
@@ -59,11 +60,15 @@ const props = withDefaults(
|
|
|
59
60
|
scrollWithAnimation?: boolean;
|
|
60
61
|
/** 返回顶部 */
|
|
61
62
|
showBackTop?: boolean;
|
|
63
|
+
/** 默认当前页 */
|
|
64
|
+
defaultCurrent?: number;
|
|
65
|
+
scrollX?: boolean;
|
|
62
66
|
}>(),
|
|
63
67
|
{
|
|
64
68
|
height: 400,
|
|
65
69
|
pageSize: 10,
|
|
66
70
|
preLodeHeight: 50,
|
|
71
|
+
defaultCurrent: 1,
|
|
67
72
|
},
|
|
68
73
|
);
|
|
69
74
|
|
|
@@ -76,7 +81,7 @@ const state = reactive<{
|
|
|
76
81
|
scrollTop: number;
|
|
77
82
|
}>({
|
|
78
83
|
height: 0,
|
|
79
|
-
current:
|
|
84
|
+
current: 1,
|
|
80
85
|
visitableData: [],
|
|
81
86
|
currentHeight: 0,
|
|
82
87
|
scrollTop: 0,
|
|
@@ -106,14 +111,47 @@ const innerScrollIntoView = computed(() => {
|
|
|
106
111
|
|
|
107
112
|
onBeforeMount(() => {
|
|
108
113
|
// 初始渲染数据
|
|
109
|
-
state.visitableData = props.data.slice(
|
|
114
|
+
state.visitableData = props.data.slice(
|
|
115
|
+
(props.defaultCurrent - 1) * props.pageSize,
|
|
116
|
+
props.pageSize * 2,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
state.currentHeight = itemsHeight
|
|
120
|
+
.slice(0, (props.defaultCurrent - 1) * props.pageSize)
|
|
121
|
+
?.reduce((acc, cur) => acc + cur, 0);
|
|
110
122
|
});
|
|
111
123
|
|
|
112
124
|
// 数据更新时重置
|
|
113
125
|
watch(
|
|
114
|
-
() => [props.data, props.pageSize],
|
|
126
|
+
() => [props.data, props.pageSize, props.defaultCurrent],
|
|
115
127
|
() => {
|
|
116
|
-
state.visitableData = props.data.slice(
|
|
128
|
+
// state.visitableData = props.data.slice(
|
|
129
|
+
// (props.defaultCurrent - 1) * props.pageSize,
|
|
130
|
+
// props.pageSize * 2,
|
|
131
|
+
// );
|
|
132
|
+
|
|
133
|
+
// console.log(' state.visitableData: ', state.visitableData);
|
|
134
|
+
|
|
135
|
+
// state.currentHeight = itemsHeight
|
|
136
|
+
// .slice(0, (props.defaultCurrent - 1) * props.pageSize)
|
|
137
|
+
// ?.reduce((acc, cur) => acc + cur, 0);
|
|
138
|
+
|
|
139
|
+
const { pageSize, data, defaultCurrent } = props;
|
|
140
|
+
|
|
141
|
+
// 计算新的起始和结束索引
|
|
142
|
+
|
|
143
|
+
const currentSub1 = defaultCurrent - 1 < 0 ? 0 : defaultCurrent - 1;
|
|
144
|
+
const currentAdd1 = defaultCurrent + 1;
|
|
145
|
+
|
|
146
|
+
const startIndex = currentSub1 * pageSize;
|
|
147
|
+
const endIndex = Math.min(currentAdd1 * pageSize, data.length);
|
|
148
|
+
|
|
149
|
+
// 更新可见数据
|
|
150
|
+
state.visitableData = data.slice(startIndex, endIndex);
|
|
151
|
+
|
|
152
|
+
state.currentHeight = itemsHeight
|
|
153
|
+
.slice(0, currentSub1 * pageSize)
|
|
154
|
+
?.reduce((acc, cur) => acc + cur, 0);
|
|
117
155
|
},
|
|
118
156
|
);
|
|
119
157
|
|
|
@@ -136,8 +174,12 @@ function updateVisitableData() {
|
|
|
136
174
|
|
|
137
175
|
/** 计算合并的高度 */
|
|
138
176
|
function updateCurrentHeight() {
|
|
177
|
+
const { pageSize } = props;
|
|
178
|
+
const { current } = state;
|
|
179
|
+
const currentSub1 = current - 1 < 0 ? 0 : current - 1;
|
|
180
|
+
|
|
139
181
|
const total = itemsHeight
|
|
140
|
-
.slice(0,
|
|
182
|
+
.slice(0, currentSub1 * pageSize)
|
|
141
183
|
?.reduce((acc, cur) => acc + cur, 0);
|
|
142
184
|
|
|
143
185
|
state.currentHeight = total;
|