@gkd-kit/inspect 0.0.1701678184497 → 0.0.1701762114130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/404.html +4 -4
  2. package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-f4d28c47.js +10 -0
  3. package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-f4d28c47.js.map +1 -0
  4. package/dist/assets/DevicePage-1ca1a7a5.js +4 -0
  5. package/dist/assets/DevicePage-1ca1a7a5.js.map +1 -0
  6. package/dist/assets/HomePage-fb6363af.js +10 -0
  7. package/dist/assets/HomePage-fb6363af.js.map +1 -0
  8. package/dist/assets/ImportPage-d0a52d21.js +2 -0
  9. package/dist/assets/ImportPage-d0a52d21.js.map +1 -0
  10. package/dist/assets/SnapshotPage-dc32bf1e.js +241 -0
  11. package/dist/assets/SnapshotPage-dc32bf1e.js.map +1 -0
  12. package/dist/assets/_404Page-44f14f69.js +2 -0
  13. package/dist/assets/_404Page-44f14f69.js.map +1 -0
  14. package/dist/assets/import-27273a86.js +2 -0
  15. package/dist/assets/import-27273a86.js.map +1 -0
  16. package/dist/assets/index-6fbc76b7.css +1 -0
  17. package/dist/assets/index-9a74ec84.js +554 -0
  18. package/dist/assets/index-9a74ec84.js.map +1 -0
  19. package/dist/assets/index-af9eb709.js +17 -0
  20. package/dist/assets/index-af9eb709.js.map +1 -0
  21. package/dist/assets/jszip.min-14bc980b.js +13 -0
  22. package/dist/assets/jszip.min-14bc980b.js.map +1 -0
  23. package/dist/assets/node-7c87a44a.js +731 -0
  24. package/dist/assets/node-7c87a44a.js.map +1 -0
  25. package/dist/assets/polyfills-e3dd7d1e.js +1 -0
  26. package/dist/assets/storage-25ae3853.js +330 -0
  27. package/dist/assets/storage-25ae3853.js.map +1 -0
  28. package/dist/assets/table-318c850e.js +958 -0
  29. package/dist/assets/table-318c850e.js.map +1 -0
  30. package/dist/index.html +4 -4
  31. package/package.json +1 -1
  32. package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-bda27d9e.js +0 -1388
  33. package/dist/assets/DevicePage-fee3235d.js +0 -457
  34. package/dist/assets/HomePage-5632f622.js +0 -400
  35. package/dist/assets/ImportPage-21674b0a.js +0 -87
  36. package/dist/assets/SnapshotPage-3157f92e.js +0 -3629
  37. package/dist/assets/SnapshotPage-3c2cecee.css +0 -8
  38. package/dist/assets/_404Page-09910a83.js +0 -32
  39. package/dist/assets/_404Page-1bb368b2.css +0 -9
  40. package/dist/assets/import-1c0da893.js +0 -288
  41. package/dist/assets/index-235f5a3e.js +0 -21365
  42. package/dist/assets/index-2bb4cdf2.js +0 -9780
  43. package/dist/assets/index-50ce64aa.css +0 -360
  44. package/dist/assets/jszip.min-9f22f6d7.js +0 -2651
  45. package/dist/assets/node-c1756ecf.js +0 -7817
  46. package/dist/assets/polyfills-bdd638aa.js +0 -11381
  47. package/dist/assets/storage-00dd3e29.js +0 -4479
  48. package/dist/assets/table-ad72f278.js +0 -8763
@@ -1,8 +0,0 @@
1
-
2
- .smooth-1s {
3
- transition:
4
- bottom 1s,
5
- top 1s,
6
- right 1s,
7
- left 1s;
8
- }
@@ -1,32 +0,0 @@
1
- import { d as defineComponent, an as useRoute, f as createElementBlock, u as unref, l as toDisplayString, h as createBaseVNode, am as withModifiers, o as openBlock } from "./index-235f5a3e.js";
2
- const _hoisted_1 = { class: "_404Page" };
3
- const _hoisted_2 = { key: 0 };
4
- const _hoisted_3 = { key: 1 };
5
- const _sfc_main = /* @__PURE__ */ defineComponent({
6
- __name: "_404Page",
7
- setup(__props) {
8
- const route = useRoute();
9
- const { fullPath } = route.redirectedFrom ?? {};
10
- return (_ctx, _cache) => {
11
- return openBlock(), createElementBlock("div", _hoisted_1, [
12
- unref(fullPath) ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(`访问的地址 ` + unref(fullPath) + ` 不存在`), 1)) : (openBlock(), createElementBlock("div", _hoisted_3, "欢迎来到404页面")),
13
- createBaseVNode("a", {
14
- href: "/",
15
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.$router.replace({ path: `/` }), ["prevent"]))
16
- }, " 回到首页 ")
17
- ]);
18
- };
19
- }
20
- });
21
- const _404Page_vue_vue_type_style_index_0_scoped_e1ecd3ed_lang = "";
22
- const _export_sfc = (sfc, props) => {
23
- const target = sfc.__vccOpts || sfc;
24
- for (const [key, val] of props) {
25
- target[key] = val;
26
- }
27
- return target;
28
- };
29
- const _404Page = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e1ecd3ed"]]);
30
- export {
31
- _404Page as default
32
- };
@@ -1,9 +0,0 @@
1
-
2
- ._404Page[data-v-e1ecd3ed] {
3
- display: flex;
4
- flex-direction: column;
5
- align-items: center;
6
- width: 100vw;
7
- padding-top: 50px;
8
- gap: 20px;
9
- }
@@ -1,288 +0,0 @@
1
- import { j as jszip_minExports } from "./jszip.min-9f22f6d7.js";
2
- import { p as pLimit, u as urlStorage, a as snapshotStorage, l as enhanceFetch, m as message, t as setSnapshot } from "./storage-00dd3e29.js";
3
- const e = (() => {
4
- if ("undefined" == typeof self)
5
- return false;
6
- if ("top" in self && self !== top)
7
- try {
8
- top.window.document._ = 0;
9
- } catch (e2) {
10
- return false;
11
- }
12
- return "showOpenFilePicker" in self;
13
- })(), t = e ? Promise.resolve().then(function() {
14
- return l;
15
- }) : Promise.resolve().then(function() {
16
- return v;
17
- });
18
- async function n(...e2) {
19
- return (await t).default(...e2);
20
- }
21
- e ? Promise.resolve().then(function() {
22
- return y;
23
- }) : Promise.resolve().then(function() {
24
- return b;
25
- });
26
- e ? Promise.resolve().then(function() {
27
- return m;
28
- }) : Promise.resolve().then(function() {
29
- return k;
30
- });
31
- const s = async (e2) => {
32
- const t2 = await e2.getFile();
33
- return t2.handle = e2, t2;
34
- };
35
- var c = async (e2 = [{}]) => {
36
- Array.isArray(e2) || (e2 = [e2]);
37
- const t2 = [];
38
- e2.forEach((e3, n3) => {
39
- t2[n3] = { description: e3.description || "Files", accept: {} }, e3.mimeTypes ? e3.mimeTypes.map((r2) => {
40
- t2[n3].accept[r2] = e3.extensions || [];
41
- }) : t2[n3].accept["*/*"] = e3.extensions || [];
42
- });
43
- const n2 = await window.showOpenFilePicker({ id: e2[0].id, startIn: e2[0].startIn, types: t2, multiple: e2[0].multiple || false, excludeAcceptAllOption: e2[0].excludeAcceptAllOption || false }), r = await Promise.all(n2.map(s));
44
- return e2[0].multiple ? r : r[0];
45
- }, l = { __proto__: null, default: c };
46
- function u(e2) {
47
- function t2(e3) {
48
- if (Object(e3) !== e3)
49
- return Promise.reject(new TypeError(e3 + " is not an object."));
50
- var t3 = e3.done;
51
- return Promise.resolve(e3.value).then(function(e4) {
52
- return { value: e4, done: t3 };
53
- });
54
- }
55
- return u = function(e3) {
56
- this.s = e3, this.n = e3.next;
57
- }, u.prototype = { s: null, n: null, next: function() {
58
- return t2(this.n.apply(this.s, arguments));
59
- }, return: function(e3) {
60
- var n2 = this.s.return;
61
- return void 0 === n2 ? Promise.resolve({ value: e3, done: true }) : t2(n2.apply(this.s, arguments));
62
- }, throw: function(e3) {
63
- var n2 = this.s.return;
64
- return void 0 === n2 ? Promise.reject(e3) : t2(n2.apply(this.s, arguments));
65
- } }, new u(e2);
66
- }
67
- const p = async (e2, t2, n2 = e2.name, r) => {
68
- const i = [], a = [];
69
- var o, s2 = false, c2 = false;
70
- try {
71
- for (var l2, d2 = function(e3) {
72
- var t3, n3, r2, i2 = 2;
73
- for ("undefined" != typeof Symbol && (n3 = Symbol.asyncIterator, r2 = Symbol.iterator); i2--; ) {
74
- if (n3 && null != (t3 = e3[n3]))
75
- return t3.call(e3);
76
- if (r2 && null != (t3 = e3[r2]))
77
- return new u(t3.call(e3));
78
- n3 = "@@asyncIterator", r2 = "@@iterator";
79
- }
80
- throw new TypeError("Object is not async iterable");
81
- }(e2.values()); s2 = !(l2 = await d2.next()).done; s2 = false) {
82
- const o2 = l2.value, s3 = `${n2}/${o2.name}`;
83
- "file" === o2.kind ? a.push(o2.getFile().then((t3) => (t3.directoryHandle = e2, t3.handle = o2, Object.defineProperty(t3, "webkitRelativePath", { configurable: true, enumerable: true, get: () => s3 })))) : "directory" !== o2.kind || !t2 || r && r(o2) || i.push(p(o2, t2, s3, r));
84
- }
85
- } catch (e3) {
86
- c2 = true, o = e3;
87
- } finally {
88
- try {
89
- s2 && null != d2.return && await d2.return();
90
- } finally {
91
- if (c2)
92
- throw o;
93
- }
94
- }
95
- return [...(await Promise.all(i)).flat(), ...await Promise.all(a)];
96
- };
97
- var d = async (e2 = {}) => {
98
- e2.recursive = e2.recursive || false, e2.mode = e2.mode || "read";
99
- const t2 = await window.showDirectoryPicker({ id: e2.id, startIn: e2.startIn, mode: e2.mode });
100
- return (await (await t2.values()).next()).done ? [t2] : p(t2, e2.recursive, void 0, e2.skipDirectory);
101
- }, y = { __proto__: null, default: d }, f = async (e2, t2 = [{}], n2 = null, r = false, i = null) => {
102
- Array.isArray(t2) || (t2 = [t2]), t2[0].fileName = t2[0].fileName || "Untitled";
103
- const a = [];
104
- let o = null;
105
- if (e2 instanceof Blob && e2.type ? o = e2.type : e2.headers && e2.headers.get("content-type") && (o = e2.headers.get("content-type")), t2.forEach((e3, t3) => {
106
- a[t3] = { description: e3.description || "Files", accept: {} }, e3.mimeTypes ? (0 === t3 && o && e3.mimeTypes.push(o), e3.mimeTypes.map((n3) => {
107
- a[t3].accept[n3] = e3.extensions || [];
108
- })) : o ? a[t3].accept[o] = e3.extensions || [] : a[t3].accept["*/*"] = e3.extensions || [];
109
- }), n2)
110
- try {
111
- await n2.getFile();
112
- } catch (e3) {
113
- if (n2 = null, r)
114
- throw e3;
115
- }
116
- const s2 = n2 || await window.showSaveFilePicker({ suggestedName: t2[0].fileName, id: t2[0].id, startIn: t2[0].startIn, types: a, excludeAcceptAllOption: t2[0].excludeAcceptAllOption || false });
117
- !n2 && i && i(s2);
118
- const c2 = await s2.createWritable();
119
- if ("stream" in e2) {
120
- const t3 = e2.stream();
121
- return await t3.pipeTo(c2), s2;
122
- }
123
- return "body" in e2 ? (await e2.body.pipeTo(c2), s2) : (await c2.write(await e2), await c2.close(), s2);
124
- }, m = { __proto__: null, default: f }, w = async (e2 = [{}]) => (Array.isArray(e2) || (e2 = [e2]), new Promise((t2, n2) => {
125
- const r = document.createElement("input");
126
- r.type = "file";
127
- const i = [...e2.map((e3) => e3.mimeTypes || []), ...e2.map((e3) => e3.extensions || [])].join();
128
- r.multiple = e2[0].multiple || false, r.accept = i || "", r.style.display = "none", document.body.append(r);
129
- const a = (e3) => {
130
- "function" == typeof o && o(), t2(e3);
131
- }, o = e2[0].legacySetup && e2[0].legacySetup(a, () => o(n2), r), s2 = () => {
132
- window.removeEventListener("focus", s2), r.remove();
133
- };
134
- r.addEventListener("click", () => {
135
- window.addEventListener("focus", s2);
136
- }), r.addEventListener("change", () => {
137
- window.removeEventListener("focus", s2), r.remove(), a(r.multiple ? Array.from(r.files) : r.files[0]);
138
- }), "showPicker" in HTMLInputElement.prototype ? r.showPicker() : r.click();
139
- })), v = { __proto__: null, default: w }, h = async (e2 = [{}]) => (Array.isArray(e2) || (e2 = [e2]), e2[0].recursive = e2[0].recursive || false, new Promise((t2, n2) => {
140
- const r = document.createElement("input");
141
- r.type = "file", r.webkitdirectory = true;
142
- const i = (e3) => {
143
- "function" == typeof a && a(), t2(e3);
144
- }, a = e2[0].legacySetup && e2[0].legacySetup(i, () => a(n2), r);
145
- r.addEventListener("change", () => {
146
- let t3 = Array.from(r.files);
147
- e2[0].recursive ? e2[0].recursive && e2[0].skipDirectory && (t3 = t3.filter((t4) => t4.webkitRelativePath.split("/").every((t5) => !e2[0].skipDirectory({ name: t5, kind: "directory" })))) : t3 = t3.filter((e3) => 2 === e3.webkitRelativePath.split("/").length), i(t3);
148
- }), "showPicker" in HTMLInputElement.prototype ? r.showPicker() : r.click();
149
- })), b = { __proto__: null, default: h }, P = async (e2, t2 = {}) => {
150
- Array.isArray(t2) && (t2 = t2[0]);
151
- const n2 = document.createElement("a");
152
- let r = e2;
153
- "body" in e2 && (r = await async function(e3, t3) {
154
- const n3 = e3.getReader(), r2 = new ReadableStream({ start: (e4) => async function t4() {
155
- return n3.read().then(({ done: n4, value: r3 }) => {
156
- if (!n4)
157
- return e4.enqueue(r3), t4();
158
- e4.close();
159
- });
160
- }() }), i2 = new Response(r2), a2 = await i2.blob();
161
- return n3.releaseLock(), new Blob([a2], { type: t3 });
162
- }(e2.body, e2.headers.get("content-type"))), n2.download = t2.fileName || "Untitled", n2.href = URL.createObjectURL(await r);
163
- const i = () => {
164
- "function" == typeof a && a();
165
- }, a = t2.legacySetup && t2.legacySetup(i, () => a(), n2);
166
- return n2.addEventListener("click", () => {
167
- setTimeout(() => URL.revokeObjectURL(n2.href), 3e4), i();
168
- }), n2.click(), null;
169
- }, k = { __proto__: null, default: P };
170
- const eqU8 = (a, b2) => {
171
- return a.length == b2.length && a.every((v2, i) => v2 == b2[i]);
172
- };
173
- const startWith = (a, b2) => {
174
- return eqU8(new Uint8Array(a.slice(0, b2.length)), b2);
175
- };
176
- const zipHeader = new Uint8Array([80, 75, 3, 4]);
177
- const isZipBf = (bf) => startWith(bf, zipHeader);
178
- const parseZip = async (zip) => {
179
- const snapshotFile = zip.filter((s2) => s2.endsWith(`.json`))[0];
180
- const screenshotFile = zip.filter((s2) => s2.endsWith(`.png`))[0];
181
- if (!snapshotFile || !screenshotFile) {
182
- return false;
183
- }
184
- const snapshot = JSON.parse(await snapshotFile.async("string"));
185
- const screenshotBf = await screenshotFile.async("arraybuffer");
186
- await setSnapshot(snapshot, screenshotBf);
187
- return true;
188
- };
189
- const importFromLocal = async () => {
190
- const files = await n({
191
- multiple: true,
192
- mimeTypes: [`application/zip`]
193
- });
194
- const zipfiles = files.filter((f2) => f2.name.endsWith(`.zip`));
195
- if (zipfiles.length == 0) {
196
- message.warning(`没有发现可导入文件`);
197
- return;
198
- }
199
- let importNum = 0;
200
- if (zipfiles.length > 0) {
201
- await Promise.any(
202
- zipfiles.map(async (file) => {
203
- const zip = await jszip_minExports.loadAsync(file);
204
- if (await parseZip(zip)) {
205
- importNum++;
206
- }
207
- const subZips = zip.filter((s2) => s2.endsWith(".zip"));
208
- if (subZips.length > 0) {
209
- await Promise.any(
210
- subZips.map(async (subZip) => {
211
- const subFile = await jszip_minExports.loadAsync(subZip.async("blob"));
212
- if (await parseZip(subFile)) {
213
- importNum++;
214
- }
215
- })
216
- );
217
- }
218
- })
219
- );
220
- }
221
- if (importNum > 0) {
222
- message.success(`导入${importNum}条记录`);
223
- } else {
224
- message.warning(`没有发现可导入记录`);
225
- }
226
- };
227
- const importFromNetwork = async (urls = []) => {
228
- if (typeof urls == "string") {
229
- urls = [urls];
230
- }
231
- if (urls.length == 0) {
232
- return;
233
- }
234
- urls = [...new Set(urls)];
235
- const limit = pLimit(2);
236
- let importNum = 0;
237
- const result = await Promise.allSettled(
238
- urls.map((url) => {
239
- return limit(async () => {
240
- const snapshotId = urlStorage[url];
241
- if (snapshotId) {
242
- const snapshot2 = await snapshotStorage.getItem(snapshotId);
243
- if (snapshot2) {
244
- importNum++;
245
- return snapshot2;
246
- }
247
- }
248
- const resp = await enhanceFetch(url, void 0, { proxy: true }).catch(
249
- (e2) => {
250
- message.error(`网络异常: ${new URL(url).host}/${e2.message || ""}`);
251
- console.warn([`download failed`, url, e2]);
252
- throw e2;
253
- }
254
- );
255
- const bf = await resp.arrayBuffer();
256
- let snapshot;
257
- let screenshotBf;
258
- if (isZipBf(bf)) {
259
- const zip = await jszip_minExports.loadAsync(bf);
260
- const [snapshotFile] = zip.filter((p2) => p2.endsWith(`.json`));
261
- const [screenshotFile] = zip.filter((p2) => p2.endsWith(`.png`));
262
- if (!snapshotFile || !screenshotFile) {
263
- return;
264
- }
265
- screenshotBf = await screenshotFile.async("arraybuffer");
266
- snapshot = JSON.parse(await snapshotFile.async("string"));
267
- } else {
268
- throw new Error(`file must be png or zip`);
269
- }
270
- await setSnapshot(snapshot, screenshotBf);
271
- importNum++;
272
- return snapshot;
273
- });
274
- })
275
- );
276
- if (importNum == 0) {
277
- message.warning(`没有发现可导入记录`);
278
- } else if (importNum == urls.length) {
279
- message.success(`导入${importNum}条快照`);
280
- } else if (importNum < urls.length) {
281
- message.success(`导入${importNum}条快照,失败${urls.length - importNum}`);
282
- }
283
- return result;
284
- };
285
- export {
286
- importFromNetwork as a,
287
- importFromLocal as i
288
- };