@delta-comic/model 0.0.4 → 1.3.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/LICENSE +1 -1
- package/dist/index.js +139 -498
- package/dist/index.js.map +1 -1
- package/dist/pack.tgz +0 -0
- package/package.json +12 -15
- package/dist/index.umd.cjs +0 -2
- package/dist/index.umd.cjs.map +0 -1
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/model/comment.d.ts +0 -49
- package/dist/lib/model/content.d.ts +0 -37
- package/dist/lib/model/download.d.ts +0 -8
- package/dist/lib/model/ep.d.ts +0 -14
- package/dist/lib/model/image.d.ts +0 -21
- package/dist/lib/model/index.d.ts +0 -8
- package/dist/lib/model/item.d.ts +0 -108
- package/dist/lib/model/resource.d.ts +0 -36
- package/dist/lib/model/user.d.ts +0 -23
- package/dist/lib/struct/index.d.ts +0 -5
- package/dist/lib/struct/promise.d.ts +0 -49
- package/dist/lib/struct/store.d.ts +0 -33
- package/dist/lib/struct/stream.d.ts +0 -80
- package/dist/lib/struct/struct.d.ts +0 -12
package/dist/index.js
CHANGED
|
@@ -1,178 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
var
|
|
1
|
+
import { shallowReactive as e } from "vue";
|
|
2
|
+
import { useGlobalVar as t } from "@delta-comic/utils";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var n = Object.create, r = Object.defineProperty, i = Object.getOwnPropertyDescriptor, a = Object.getOwnPropertyNames, o = Object.getPrototypeOf, s = Object.prototype.hasOwnProperty, c = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), l = (e, t) => {
|
|
5
5
|
let n = {};
|
|
6
|
-
for (var
|
|
7
|
-
get: e[
|
|
6
|
+
for (var i in e) r(n, i, {
|
|
7
|
+
get: e[i],
|
|
8
8
|
enumerable: !0
|
|
9
9
|
});
|
|
10
|
-
return t ||
|
|
11
|
-
},
|
|
12
|
-
if (t && typeof t == "object" || typeof t == "function") for (var
|
|
13
|
-
get: ((e) => t[e]).bind(null,
|
|
14
|
-
enumerable: !(
|
|
10
|
+
return t || r(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
11
|
+
}, u = (e, t, n, o) => {
|
|
12
|
+
if (t && typeof t == "object" || typeof t == "function") for (var c = a(t), l = 0, u = c.length, d; l < u; l++) d = c[l], !s.call(e, d) && d !== n && r(e, d, {
|
|
13
|
+
get: ((e) => t[e]).bind(null, d),
|
|
14
|
+
enumerable: !(o = i(t, d)) || o.enumerable
|
|
15
15
|
});
|
|
16
16
|
return e;
|
|
17
|
-
},
|
|
17
|
+
}, d = (e, t, i) => (i = e == null ? {} : n(o(e)), u(t || !e || !e.__esModule ? r(i, "default", {
|
|
18
18
|
value: e,
|
|
19
19
|
enumerable: !0
|
|
20
|
-
}) :
|
|
21
|
-
|
|
20
|
+
}) : i, e));
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
|
|
23
|
+
function f(e) {
|
|
22
24
|
return ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
23
25
|
}
|
|
24
|
-
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
|
|
28
|
+
function p(e) {
|
|
25
29
|
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function C(e) {
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isLength.mjs
|
|
33
|
+
function m(e) {
|
|
31
34
|
return Number.isSafeInteger(e) && e >= 0;
|
|
32
35
|
}
|
|
33
|
-
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isString.mjs
|
|
38
|
+
function h(e) {
|
|
34
39
|
return typeof e == "string";
|
|
35
40
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function E(e) {
|
|
40
|
-
return typeof e == "object" && !!e && x(e) === "[object Arguments]";
|
|
41
|
-
}
|
|
42
|
-
function D(e) {
|
|
43
|
-
return typeof e == "string" || e instanceof String;
|
|
44
|
-
}
|
|
45
|
-
function O(e) {
|
|
46
|
-
let t = e?.constructor;
|
|
47
|
-
return e === (typeof t == "function" ? t.prototype : Object.prototype);
|
|
48
|
-
}
|
|
49
|
-
function ee(e) {
|
|
50
|
-
return b(e);
|
|
51
|
-
}
|
|
52
|
-
function k(e) {
|
|
53
|
-
if (e == null) return !0;
|
|
54
|
-
if (T(e)) return typeof e.splice != "function" && typeof e != "string" && (typeof Buffer > "u" || !Buffer.isBuffer(e)) && !ee(e) && !E(e) ? !1 : e.length === 0;
|
|
55
|
-
if (typeof e == "object") {
|
|
56
|
-
if (e instanceof Map || e instanceof Set) return e.size === 0;
|
|
57
|
-
let t = Object.keys(e);
|
|
58
|
-
return O(e) ? t.filter((e) => e !== "constructor").length === 0 : t.length === 0;
|
|
59
|
-
}
|
|
60
|
-
return !0;
|
|
61
|
-
}
|
|
62
|
-
function A(e) {
|
|
63
|
-
return {
|
|
64
|
-
all: e ||= /* @__PURE__ */ new Map(),
|
|
65
|
-
on: function(t, n) {
|
|
66
|
-
var r = e.get(t);
|
|
67
|
-
r ? r.push(n) : e.set(t, [n]);
|
|
68
|
-
},
|
|
69
|
-
off: function(t, n) {
|
|
70
|
-
var r = e.get(t);
|
|
71
|
-
r && (n ? r.splice(r.indexOf(n) >>> 0, 1) : e.set(t, []));
|
|
72
|
-
},
|
|
73
|
-
emit: function(t, n) {
|
|
74
|
-
var r = e.get(t);
|
|
75
|
-
r && r.slice().map(function(e) {
|
|
76
|
-
e(n);
|
|
77
|
-
}), (r = e.get("*")) && r.slice().map(function(e) {
|
|
78
|
-
e(t, n);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 扩展内容的`Promise`,可视为普通`Promise`使用
|
|
85
|
-
*/
|
|
86
|
-
var j = class t {
|
|
87
|
-
[Symbol.toStringTag] = "PromiseContent";
|
|
88
|
-
static _this;
|
|
89
|
-
static {
|
|
90
|
-
this._this = e(this, "data/PromiseContent");
|
|
91
|
-
}
|
|
92
|
-
static isPromiseContent(e) {
|
|
93
|
-
return e instanceof this._this;
|
|
94
|
-
}
|
|
95
|
-
static fromPromise(e, t = (e) => e) {
|
|
96
|
-
return r(new this._this(e, t));
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 使用`PromiseContent.fromPromise`或`PromiseContent.fromAsyncFunction`代替`new PromiseContent`
|
|
100
|
-
*/
|
|
101
|
-
constructor(e, t = (e) => e) {
|
|
102
|
-
this.promise = e, this.processor = t, this.loadPromise(e);
|
|
103
|
-
}
|
|
104
|
-
async loadPromise(e) {
|
|
105
|
-
this.data.value = void 0, this.isLoading.value = !0, this.isError.value = !1, this.errorCause.value = void 0, this.isEmpty.value = !0;
|
|
106
|
-
try {
|
|
107
|
-
let t = await e;
|
|
108
|
-
this.data.value = this.processor(t), this.isLoading.value = !1, this.isError.value = !1, this.isEmpty.value = k(t), this.emitter.emit("success", this.data.value);
|
|
109
|
-
} catch (e) {
|
|
110
|
-
this.data.value = void 0, this.isError.value = !0, this.errorCause.value = S(e) ? e : Error(String(e)), console.error("Non-throw Error [PromiseContent]", e), this.emitter.emit("error", e);
|
|
111
|
-
}
|
|
112
|
-
this.emitter.emit("finial", void 0);
|
|
113
|
-
}
|
|
114
|
-
emitter = A();
|
|
115
|
-
onError(e) {
|
|
116
|
-
return this.emitter.on("error", e), () => this.emitter.off("error", e);
|
|
117
|
-
}
|
|
118
|
-
onSuccess(e) {
|
|
119
|
-
return this.emitter.on("success", e), () => this.emitter.off("success", e);
|
|
120
|
-
}
|
|
121
|
-
onFinal(e) {
|
|
122
|
-
return this.emitter.on("finial", e), () => this.emitter.off("finial", e);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* 对`this.data.value`做出处理,多次调用仅最后一次生效
|
|
126
|
-
*/
|
|
127
|
-
setProcessor(e) {
|
|
128
|
-
return t.fromPromise(this.promise, e);
|
|
129
|
-
}
|
|
130
|
-
catch(e) {
|
|
131
|
-
return this.promise.catch(e);
|
|
132
|
-
}
|
|
133
|
-
then(e, t) {
|
|
134
|
-
return this.promise.then(e, t);
|
|
135
|
-
}
|
|
136
|
-
finally(e) {
|
|
137
|
-
return this.promise.finally(e);
|
|
138
|
-
}
|
|
139
|
-
data = s();
|
|
140
|
-
isLoading = s(!0);
|
|
141
|
-
isError = s(!1);
|
|
142
|
-
errorCause = s();
|
|
143
|
-
isEmpty = s(!0);
|
|
144
|
-
static fromAsyncFunction(e) {
|
|
145
|
-
return (...t) => this.fromPromise(e(...t));
|
|
146
|
-
}
|
|
147
|
-
static resolve(e) {
|
|
148
|
-
let t = this.fromPromise(Promise.resolve(e));
|
|
149
|
-
return t.isLoading.value = !1, t;
|
|
150
|
-
}
|
|
151
|
-
static withResolvers(e = !1) {
|
|
152
|
-
let t = Promise.withResolvers(), n = new this._this(t.promise);
|
|
153
|
-
return n.isLoading.value = e, {
|
|
154
|
-
content: n,
|
|
155
|
-
reject: (e) => {
|
|
156
|
-
t.reject(e);
|
|
157
|
-
},
|
|
158
|
-
resolve: (e) => {
|
|
159
|
-
t.resolve(e);
|
|
160
|
-
},
|
|
161
|
-
reset(e = !1) {
|
|
162
|
-
t = Promise.withResolvers(), n.loadPromise(t.promise), n.isLoading.value = e;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
}, M = class {
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region lib/struct/store.ts
|
|
43
|
+
var g = class {
|
|
167
44
|
toJSON(e) {
|
|
168
|
-
return
|
|
45
|
+
return h(e) ? this.parse(e) : e;
|
|
169
46
|
}
|
|
170
47
|
parse(e) {
|
|
171
48
|
let t = e.split(this.separator);
|
|
172
49
|
return [t[0], t.slice(1).join(this.separator)];
|
|
173
50
|
}
|
|
174
51
|
toString(e) {
|
|
175
|
-
return
|
|
52
|
+
return h(e) ? e : this.stringify(e);
|
|
176
53
|
}
|
|
177
54
|
stringify(e) {
|
|
178
55
|
return e.join(this.separator);
|
|
@@ -180,14 +57,15 @@ var j = class t {
|
|
|
180
57
|
constructor(e = ":") {
|
|
181
58
|
this.separator = e;
|
|
182
59
|
}
|
|
183
|
-
},
|
|
184
|
-
static
|
|
185
|
-
return
|
|
60
|
+
}, _ = class {
|
|
61
|
+
static createReactive(t = ":") {
|
|
62
|
+
return e(new this(t));
|
|
186
63
|
}
|
|
187
64
|
constructor(e = ":") {
|
|
188
|
-
|
|
65
|
+
this.key = new g(e);
|
|
189
66
|
}
|
|
190
|
-
|
|
67
|
+
key;
|
|
68
|
+
store = e(/* @__PURE__ */ new Map());
|
|
191
69
|
get size() {
|
|
192
70
|
return this.store.size;
|
|
193
71
|
}
|
|
@@ -196,7 +74,7 @@ var j = class t {
|
|
|
196
74
|
this.store.clear();
|
|
197
75
|
}
|
|
198
76
|
delete(e) {
|
|
199
|
-
return this.store.delete(this.toString(e));
|
|
77
|
+
return this.store.delete(this.key.toString(e));
|
|
200
78
|
}
|
|
201
79
|
forEach(e, t) {
|
|
202
80
|
this.store.forEach((n, r) => {
|
|
@@ -204,13 +82,13 @@ var j = class t {
|
|
|
204
82
|
});
|
|
205
83
|
}
|
|
206
84
|
get(e) {
|
|
207
|
-
return this.store.get(this.toString(e));
|
|
85
|
+
return this.store.get(this.key.toString(e));
|
|
208
86
|
}
|
|
209
87
|
has(e) {
|
|
210
|
-
return this.store.has(this.toString(e));
|
|
88
|
+
return this.store.has(this.key.toString(e));
|
|
211
89
|
}
|
|
212
90
|
set(e, t) {
|
|
213
|
-
return this.store.set(this.toString(e), t), this;
|
|
91
|
+
return this.store.set(this.key.toString(e), t), this;
|
|
214
92
|
}
|
|
215
93
|
entries() {
|
|
216
94
|
return this.store.entries();
|
|
@@ -224,290 +102,17 @@ var j = class t {
|
|
|
224
102
|
[Symbol.iterator]() {
|
|
225
103
|
return this.entries();
|
|
226
104
|
}
|
|
227
|
-
}
|
|
228
|
-
function P(e) {
|
|
229
|
-
return {
|
|
230
|
-
all: e ||= /* @__PURE__ */ new Map(),
|
|
231
|
-
on: function(t, n) {
|
|
232
|
-
var r = e.get(t);
|
|
233
|
-
r ? r.push(n) : e.set(t, [n]);
|
|
234
|
-
},
|
|
235
|
-
off: function(t, n) {
|
|
236
|
-
var r = e.get(t);
|
|
237
|
-
r && (n ? r.splice(r.indexOf(n) >>> 0, 1) : e.set(t, []));
|
|
238
|
-
},
|
|
239
|
-
emit: function(t, n) {
|
|
240
|
-
var r = e.get(t);
|
|
241
|
-
r && r.slice().map(function(e) {
|
|
242
|
-
e(n);
|
|
243
|
-
}), (r = e.get("*")) && r.slice().map(function(e) {
|
|
244
|
-
e(t, n);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
var F = class {
|
|
250
|
-
_controller = new AbortController();
|
|
251
|
-
mitt = P();
|
|
252
|
-
get signal() {
|
|
253
|
-
return this._controller.signal;
|
|
254
|
-
}
|
|
255
|
-
abort(e) {
|
|
256
|
-
this._controller.abort(e), this._controller = new AbortController(), this.mitt.emit("abort");
|
|
257
|
-
}
|
|
258
|
-
onAbort(e) {
|
|
259
|
-
return this.mitt.on("abort", e), () => this.mitt.off("abort", e);
|
|
260
|
-
}
|
|
261
|
-
onAbortOnce(e) {
|
|
262
|
-
let t = async () => {
|
|
263
|
-
await e(), this.mitt.off("abort", t);
|
|
264
|
-
};
|
|
265
|
-
this.mitt.on("abort", t);
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
Error, typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
269
|
-
function I(e, t = !1, n = "Timeout") {
|
|
270
|
-
return new Promise((r, i) => {
|
|
271
|
-
t ? setTimeout(() => i(n), e) : setTimeout(r, e);
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
function L(e, t = !1) {
|
|
275
|
-
function r(n, { flush: r = "sync", deep: a = !1, timeout: o, throwOnTimeout: s } = {}) {
|
|
276
|
-
let u = null, d = [new Promise((o) => {
|
|
277
|
-
u = l(e, (e) => {
|
|
278
|
-
n(e) !== t && (u ? u() : i(() => u?.()), o(e));
|
|
279
|
-
}, {
|
|
280
|
-
flush: r,
|
|
281
|
-
deep: a,
|
|
282
|
-
immediate: !0
|
|
283
|
-
});
|
|
284
|
-
})];
|
|
285
|
-
return o != null && d.push(I(o, s).then(() => c(e)).finally(() => u?.())), Promise.race(d);
|
|
286
|
-
}
|
|
287
|
-
function a(a, o) {
|
|
288
|
-
if (!n(a)) return r((e) => e === a, o);
|
|
289
|
-
let { flush: s = "sync", deep: u = !1, timeout: d, throwOnTimeout: f } = o ?? {}, p = null, m = [new Promise((n) => {
|
|
290
|
-
p = l([e, a], ([e, r]) => {
|
|
291
|
-
t !== (e === r) && (p ? p() : i(() => p?.()), n(e));
|
|
292
|
-
}, {
|
|
293
|
-
flush: s,
|
|
294
|
-
deep: u,
|
|
295
|
-
immediate: !0
|
|
296
|
-
});
|
|
297
|
-
})];
|
|
298
|
-
return d != null && m.push(I(d, f).then(() => c(e)).finally(() => (p?.(), c(e)))), Promise.race(m);
|
|
299
|
-
}
|
|
300
|
-
function o(e) {
|
|
301
|
-
return r((e) => !!e, e);
|
|
302
|
-
}
|
|
303
|
-
function s(e) {
|
|
304
|
-
return a(null, e);
|
|
305
|
-
}
|
|
306
|
-
function u(e) {
|
|
307
|
-
return a(void 0, e);
|
|
308
|
-
}
|
|
309
|
-
function d(e) {
|
|
310
|
-
return r(Number.isNaN, e);
|
|
311
|
-
}
|
|
312
|
-
function f(e, t) {
|
|
313
|
-
return r((t) => {
|
|
314
|
-
let n = Array.from(t);
|
|
315
|
-
return n.includes(e) || n.includes(c(e));
|
|
316
|
-
}, t);
|
|
317
|
-
}
|
|
318
|
-
function p(e) {
|
|
319
|
-
return m(1, e);
|
|
320
|
-
}
|
|
321
|
-
function m(e = 1, t) {
|
|
322
|
-
let n = -1;
|
|
323
|
-
return r(() => (n += 1, n >= e), t);
|
|
324
|
-
}
|
|
325
|
-
return Array.isArray(c(e)) ? {
|
|
326
|
-
toMatch: r,
|
|
327
|
-
toContains: f,
|
|
328
|
-
changed: p,
|
|
329
|
-
changedTimes: m,
|
|
330
|
-
get not() {
|
|
331
|
-
return L(e, !t);
|
|
332
|
-
}
|
|
333
|
-
} : {
|
|
334
|
-
toMatch: r,
|
|
335
|
-
toBe: a,
|
|
336
|
-
toBeTruthy: o,
|
|
337
|
-
toBeNull: s,
|
|
338
|
-
toBeNaN: d,
|
|
339
|
-
toBeUndefined: u,
|
|
340
|
-
changed: p,
|
|
341
|
-
changedTimes: m,
|
|
342
|
-
get not() {
|
|
343
|
-
return L(e, !t);
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
function R(e) {
|
|
348
|
-
return L(e);
|
|
349
|
-
}
|
|
350
|
-
var z = /* @__PURE__ */ new Map(), B = class {
|
|
351
|
-
/**
|
|
352
|
-
* 使用`Stream.create`代替`new Stream`
|
|
353
|
-
*/
|
|
354
|
-
constructor(e) {
|
|
355
|
-
this.generator = e(this.abortController.signal, this), z.set(this, e);
|
|
356
|
-
}
|
|
357
|
-
static _this;
|
|
358
|
-
static {
|
|
359
|
-
this._this = e(this, "data/Stream");
|
|
360
|
-
}
|
|
361
|
-
static isStream(e) {
|
|
362
|
-
return e instanceof this._this;
|
|
363
|
-
}
|
|
364
|
-
static create(e) {
|
|
365
|
-
return r(new this._this(e));
|
|
366
|
-
}
|
|
367
|
-
abortController = new F();
|
|
368
|
-
generator;
|
|
369
|
-
_setupData = [];
|
|
370
|
-
/** 初始存在的数据(置顶) */
|
|
371
|
-
setupData(e) {
|
|
372
|
-
return this._setupData.push(...e), this.data.value.unshift(...e), this;
|
|
373
|
-
}
|
|
374
|
-
async next(e = !1) {
|
|
375
|
-
try {
|
|
376
|
-
if (e || (await R(this.isRequesting).toBe(!1), this.isRequesting.value = !0), this._isDone) return e || (this.isRequesting.value = !1), {
|
|
377
|
-
done: !0,
|
|
378
|
-
value: void 0
|
|
379
|
-
};
|
|
380
|
-
e && console.log("igRequesting next");
|
|
381
|
-
let { value: t, done: n } = await this.generator.next(this);
|
|
382
|
-
return this.isDone.value = n ?? !1, e || (this.isRequesting.value = !1), n ? {
|
|
383
|
-
done: !0,
|
|
384
|
-
value: void 0
|
|
385
|
-
} : (this.data.value.push(...t), {
|
|
386
|
-
value: t,
|
|
387
|
-
done: n
|
|
388
|
-
});
|
|
389
|
-
} catch (t) {
|
|
390
|
-
throw e || (this.isRequesting.value = !1), this.error.value = t, t;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
async return() {
|
|
394
|
-
return await this.generator.return?.() ?? {
|
|
395
|
-
value: void 0,
|
|
396
|
-
done: !0
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
async throw(e) {
|
|
400
|
-
return await this.generator.throw?.(e) ?? {
|
|
401
|
-
value: void 0,
|
|
402
|
-
done: !0
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
/** 重置 */
|
|
406
|
-
reset() {
|
|
407
|
-
this.generator = z.get(this)(this.abortController.signal, this), this.total.value = NaN, this.page.value = 0, this.pageSize.value = NaN, this.data.value = this._setupData, this.isDone.value = !1, this.isRequesting.value = !1, this.error.value = void 0;
|
|
408
|
-
}
|
|
409
|
-
/** 重试 */
|
|
410
|
-
async retry() {
|
|
411
|
-
return this.page.value--, this.next();
|
|
412
|
-
}
|
|
413
|
-
/** 一次性全部加载 */
|
|
414
|
-
async nextToDone() {
|
|
415
|
-
isNaN(this._pages) && await this.next(!0);
|
|
416
|
-
let e = [];
|
|
417
|
-
for (let t = this._page + 1; t <= this._pages; t++) e.push(this.next(!0));
|
|
418
|
-
return await Promise.all(e), this._data;
|
|
419
|
-
}
|
|
420
|
-
/** 停止正在进行的请求 */
|
|
421
|
-
stop() {
|
|
422
|
-
this.abortController.abort(), this.isRequesting.value = !1;
|
|
423
|
-
}
|
|
424
|
-
[Symbol.asyncIterator]() {
|
|
425
|
-
return this;
|
|
426
|
-
}
|
|
427
|
-
/** 错误(如果有) */
|
|
428
|
-
error = s();
|
|
429
|
-
/** 数据 */
|
|
430
|
-
data = a([]);
|
|
431
|
-
/** 数据 */
|
|
432
|
-
get _data() {
|
|
433
|
-
return this.data.value;
|
|
434
|
-
}
|
|
435
|
-
/** 当前页 */
|
|
436
|
-
page = s(0);
|
|
437
|
-
/** 当前页 */
|
|
438
|
-
get _page() {
|
|
439
|
-
return this.page.value;
|
|
440
|
-
}
|
|
441
|
-
/** 总页数 */
|
|
442
|
-
pages = s(NaN);
|
|
443
|
-
/** 总页数 */
|
|
444
|
-
get _pages() {
|
|
445
|
-
return this.pages.value;
|
|
446
|
-
}
|
|
447
|
-
/** 总条目数 */
|
|
448
|
-
total = s(NaN);
|
|
449
|
-
/** 总条目数 */
|
|
450
|
-
get _total() {
|
|
451
|
-
return this.total.value;
|
|
452
|
-
}
|
|
453
|
-
/** 单页条目数 */
|
|
454
|
-
pageSize = s(NaN);
|
|
455
|
-
/** 单页条目数 */
|
|
456
|
-
get _pageSize() {
|
|
457
|
-
return this.pageSize.value;
|
|
458
|
-
}
|
|
459
|
-
/** 数据当前总数 */
|
|
460
|
-
length = t(() => this.data.value.length);
|
|
461
|
-
/** 数据当前总数 */
|
|
462
|
-
get _length() {
|
|
463
|
-
return this.data.value.length;
|
|
464
|
-
}
|
|
465
|
-
/** 是否正在网络请求 */
|
|
466
|
-
isRequesting = s(!1);
|
|
467
|
-
/** 是否正在网络请求 */
|
|
468
|
-
get _isRequesting() {
|
|
469
|
-
return this.isRequesting.value;
|
|
470
|
-
}
|
|
471
|
-
/** 是否全部获取完成 */
|
|
472
|
-
isDone = s(!1);
|
|
473
|
-
/** 是否全部获取完成 */
|
|
474
|
-
get _isDone() {
|
|
475
|
-
return this.isDone.value;
|
|
476
|
-
}
|
|
477
|
-
/** 是否无结果 */
|
|
478
|
-
isNoData = t(() => this.isDone.value && this.isEmpty.value);
|
|
479
|
-
/** 是否无结果 */
|
|
480
|
-
get _isNoData() {
|
|
481
|
-
return this.isNoData.value;
|
|
482
|
-
}
|
|
483
|
-
/** 是否当前为空 */
|
|
484
|
-
isEmpty = t(() => this.length.value === 0);
|
|
485
|
-
/** 是否当前为空 */
|
|
486
|
-
get _isEmpty() {
|
|
487
|
-
return this.isEmpty.value;
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
const V = (e) => {
|
|
491
|
-
let { resolve: t, promise: n } = Promise.withResolvers();
|
|
492
|
-
return e(t), n;
|
|
493
|
-
};
|
|
494
|
-
/**
|
|
495
|
-
* 可以结构化的数据,调用`toJSON`获取纯粹的json(没有get/set或method)
|
|
496
|
-
*/
|
|
497
|
-
var H = class e {
|
|
105
|
+
}, v = class e {
|
|
498
106
|
toJSON() {
|
|
499
107
|
return JSON.parse(JSON.stringify(this.$$raw));
|
|
500
108
|
}
|
|
501
|
-
/**
|
|
502
|
-
* @param $$raw 一个纯粹json对象,不可以是高级对象
|
|
503
|
-
*/
|
|
504
109
|
constructor(e) {
|
|
505
110
|
this.$$raw = e;
|
|
506
111
|
}
|
|
507
112
|
static toRaw(t) {
|
|
508
113
|
return t instanceof e ? t.toJSON() : t;
|
|
509
114
|
}
|
|
510
|
-
},
|
|
115
|
+
}, y = /* @__PURE__ */ c(((e, t) => {
|
|
511
116
|
(function(n, r) {
|
|
512
117
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
|
|
513
118
|
})(e, (function() {
|
|
@@ -801,15 +406,15 @@ var H = class e {
|
|
|
801
406
|
return w(1e3 * e);
|
|
802
407
|
}, w.en = b[y], w.Ls = b, w.p = {}, w;
|
|
803
408
|
}));
|
|
804
|
-
})),
|
|
805
|
-
static commentRow =
|
|
409
|
+
})), b = /* @__PURE__ */ l({ Comment: () => S }), x = /* @__PURE__ */ d(y(), 1), S = class extends v {
|
|
410
|
+
static commentRow = _.createReactive();
|
|
806
411
|
constructor(e) {
|
|
807
412
|
super(e), this.content = e.content, this.time = e.time, this.id = e.id, this.childrenCount = e.childrenCount, this.likeCount = e.likeCount, this.isLiked = e.isLiked, this.reported = e.reported, this.$$plugin = e.$$plugin, this.$$meta = e.$$meta, this.isTop = e.isTop;
|
|
808
413
|
}
|
|
809
414
|
content;
|
|
810
415
|
time;
|
|
811
416
|
get $time() {
|
|
812
|
-
return (0,
|
|
417
|
+
return (0, x.default)(this.time);
|
|
813
418
|
}
|
|
814
419
|
id;
|
|
815
420
|
childrenCount;
|
|
@@ -819,18 +424,59 @@ var H = class e {
|
|
|
819
424
|
reported;
|
|
820
425
|
$$plugin;
|
|
821
426
|
$$meta;
|
|
822
|
-
},
|
|
427
|
+
}, C = /* @__PURE__ */ l({ Ep: () => w }), w = class extends v {
|
|
823
428
|
name;
|
|
824
|
-
|
|
429
|
+
id;
|
|
825
430
|
$$plugin;
|
|
826
431
|
$$meta;
|
|
827
432
|
constructor(e) {
|
|
828
|
-
super(e), this.name = e.name, this.
|
|
433
|
+
super(e), this.name = e.name, this.id = e.id, this.$$plugin = e.$$plugin, this.$$meta = e.$$meta;
|
|
829
434
|
}
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
435
|
+
};
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
|
|
438
|
+
function T(e) {
|
|
439
|
+
return e != null && typeof e != "function" && m(e.length);
|
|
440
|
+
}
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs
|
|
443
|
+
function E(e) {
|
|
444
|
+
return typeof e == "object" && !!e && p(e) === "[object Arguments]";
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isString.mjs
|
|
448
|
+
function D(e) {
|
|
449
|
+
return typeof e == "string" || e instanceof String;
|
|
450
|
+
}
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs
|
|
453
|
+
function O(e) {
|
|
454
|
+
let t = e?.constructor;
|
|
455
|
+
return e === (typeof t == "function" ? t.prototype : Object.prototype);
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs
|
|
459
|
+
function k(e) {
|
|
460
|
+
return f(e);
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs
|
|
464
|
+
function A(e) {
|
|
465
|
+
if (e == null) return !0;
|
|
466
|
+
if (T(e)) return typeof e.splice != "function" && typeof e != "string" && (typeof Buffer > "u" || !Buffer.isBuffer(e)) && !k(e) && !E(e) ? !1 : e.length === 0;
|
|
467
|
+
if (typeof e == "object") {
|
|
468
|
+
if (e instanceof Map || e instanceof Set) return e.size === 0;
|
|
469
|
+
let t = Object.keys(e);
|
|
470
|
+
return O(e) ? t.filter((e) => e !== "constructor").length === 0 : t.length === 0;
|
|
471
|
+
}
|
|
472
|
+
return !0;
|
|
473
|
+
}
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region lib/model/resource.ts
|
|
476
|
+
var j = /* @__PURE__ */ l({ Resource: () => M }), M = class n extends v {
|
|
477
|
+
static processInstances = t(_.createReactive(), "uni/resource/processInstances");
|
|
478
|
+
static fork = t(_.createReactive(), "uni/resource/fork");
|
|
479
|
+
static precedenceFork = t(_.createReactive(), "uni/resource/precedenceFork");
|
|
834
480
|
static is(e) {
|
|
835
481
|
return e instanceof this;
|
|
836
482
|
}
|
|
@@ -850,32 +496,30 @@ var H = class e {
|
|
|
850
496
|
$$plugin;
|
|
851
497
|
async getUrl() {
|
|
852
498
|
let e = this.pathname;
|
|
853
|
-
for (let
|
|
854
|
-
let r =
|
|
499
|
+
for (let t of this.processSteps) {
|
|
500
|
+
let r = n.processInstances.get([this.$$plugin, t.referenceName]);
|
|
855
501
|
if (!r) {
|
|
856
|
-
console.warn(`[Resource.getUrl] process not found, fullname: [${this.$$plugin}, ${
|
|
502
|
+
console.warn(`[Resource.getUrl] process not found, fullname: [${this.$$plugin}, ${t.referenceName}]`);
|
|
857
503
|
continue;
|
|
858
504
|
}
|
|
859
505
|
let i = await r(e, this);
|
|
860
|
-
if (e = i[0], !(
|
|
506
|
+
if (e = i[0], !(t.ignoreExit || !i[1])) break;
|
|
861
507
|
}
|
|
862
508
|
return URL.canParse(e) ? e : `${this.getThisFork()}/${e}`;
|
|
863
509
|
}
|
|
864
|
-
omittedForks =
|
|
510
|
+
omittedForks = e(/* @__PURE__ */ new Set());
|
|
865
511
|
getThisFork() {
|
|
866
|
-
let e = new Set(
|
|
867
|
-
if (this.omittedForks
|
|
868
|
-
|
|
869
|
-
if (!n) throw Error(`[Resource.getThisFork] fork not found, type: [${this.$$plugin}, ${this.type}]`);
|
|
870
|
-
return n;
|
|
512
|
+
let e = new Set(n.fork.get([this.$$plugin, this.type])?.urls ?? []), t;
|
|
513
|
+
if (t = A(this.omittedForks) ? n.precedenceFork.get([this.$$plugin, this.type]) : Array.from(e.difference(this.omittedForks).values())[0], !t) throw Error(`[Resource.getThisFork] fork not found, type: [${this.$$plugin}, ${this.type}]`);
|
|
514
|
+
return t;
|
|
871
515
|
}
|
|
872
516
|
localChangeFork() {
|
|
873
|
-
let e = new Set(
|
|
517
|
+
let e = new Set(n.fork.get([this.$$plugin, this.type])?.urls ?? []);
|
|
874
518
|
this.omittedForks.add(this.getThisFork());
|
|
875
|
-
let
|
|
876
|
-
return
|
|
519
|
+
let t = A(e.difference(this.omittedForks));
|
|
520
|
+
return t && this.omittedForks.clear(), t;
|
|
877
521
|
}
|
|
878
|
-
},
|
|
522
|
+
}, N = /* @__PURE__ */ l({ Image: () => P }), P = class extends M {
|
|
879
523
|
static is(e) {
|
|
880
524
|
return e instanceof this;
|
|
881
525
|
}
|
|
@@ -887,7 +531,7 @@ var H = class e {
|
|
|
887
531
|
$$plugin: e.$$plugin,
|
|
888
532
|
$$meta: {
|
|
889
533
|
...e.$$meta,
|
|
890
|
-
|
|
534
|
+
aspect: t
|
|
891
535
|
},
|
|
892
536
|
pathname: e.path,
|
|
893
537
|
type: e.forkNamespace,
|
|
@@ -895,26 +539,26 @@ var H = class e {
|
|
|
895
539
|
}) : super(e);
|
|
896
540
|
}
|
|
897
541
|
get aspect() {
|
|
898
|
-
return this.$$meta;
|
|
542
|
+
return this.$$meta.aspect;
|
|
899
543
|
}
|
|
900
544
|
set aspect(e) {
|
|
901
|
-
this.$$meta ??= {}, this.$$meta.width = e.width, this.$$meta.height = e.height;
|
|
545
|
+
e && (this.$$meta ??= {}, this.$$meta.aspect ??= {}, this.$$meta.aspect.width = e.width, this.$$meta.aspect.height = e.height);
|
|
902
546
|
}
|
|
903
|
-
},
|
|
904
|
-
static itemTranslator =
|
|
547
|
+
}, F = /* @__PURE__ */ l({ Item: () => I }), I = class extends v {
|
|
548
|
+
static itemTranslator = _.createReactive();
|
|
905
549
|
static create(e) {
|
|
906
550
|
let t = this.itemTranslator.get(e.contentType);
|
|
907
|
-
if (!t) throw Error(`can not found itemTranslator contentType:"${
|
|
551
|
+
if (!t) throw Error(`can not found itemTranslator contentType:"${R.contentPages.key.toString(e.contentType)}"`);
|
|
908
552
|
return t(e);
|
|
909
553
|
}
|
|
910
|
-
static authorIcon =
|
|
911
|
-
static
|
|
554
|
+
static authorIcon = _.createReactive();
|
|
555
|
+
static itemCards = t(_.createReactive(), "uni/item/itemCards");
|
|
912
556
|
static is(e) {
|
|
913
557
|
return e instanceof this;
|
|
914
558
|
}
|
|
915
559
|
cover;
|
|
916
560
|
get $cover() {
|
|
917
|
-
return
|
|
561
|
+
return P.create(this.cover);
|
|
918
562
|
}
|
|
919
563
|
title;
|
|
920
564
|
id;
|
|
@@ -927,7 +571,7 @@ var H = class e {
|
|
|
927
571
|
description;
|
|
928
572
|
updateTime;
|
|
929
573
|
get $updateTime() {
|
|
930
|
-
return (0,
|
|
574
|
+
return (0, x.default)(this.updateTime);
|
|
931
575
|
}
|
|
932
576
|
contentType;
|
|
933
577
|
length;
|
|
@@ -937,10 +581,10 @@ var H = class e {
|
|
|
937
581
|
thisEp;
|
|
938
582
|
customIsSafe;
|
|
939
583
|
get $thisEp() {
|
|
940
|
-
return new
|
|
584
|
+
return new w(this.thisEp);
|
|
941
585
|
}
|
|
942
586
|
constructor(e) {
|
|
943
|
-
super(e), this.$$plugin = e.$$plugin, this.$$meta = e.$$meta, this.thisEp = e.thisEp, this.updateTime = e.updateTime, this.cover = e.cover, this.title = e.title, this.id = e.id, this.categories = e.categories, this.author = e.author, this.viewNumber = e.viewNumber, this.likeNumber = e.likeNumber, this.commentNumber = e.commentNumber, this.isLiked = e.isLiked, this.customIsAI = e.customIsAI, this.contentType =
|
|
587
|
+
super(e), this.$$plugin = e.$$plugin, this.$$meta = e.$$meta, this.thisEp = e.thisEp, this.updateTime = e.updateTime, this.cover = e.cover, this.title = e.title, this.id = e.id, this.categories = e.categories, this.author = e.author, this.viewNumber = e.viewNumber, this.likeNumber = e.likeNumber, this.commentNumber = e.commentNumber, this.isLiked = e.isLiked, this.customIsAI = e.customIsAI, this.contentType = R.contentPages.key.toJSON(e.contentType), this.length = e.length, this.epLength = e.epLength, this.description = e.description, this.commentSendable = e.commentSendable, this.customIsSafe = e.customIsSafe;
|
|
944
588
|
}
|
|
945
589
|
commentSendable;
|
|
946
590
|
customIsAI;
|
|
@@ -948,38 +592,35 @@ var H = class e {
|
|
|
948
592
|
let e = (e) => /(^|[\((\[\s【])ai[】\))\]\s]?/gi.test(e);
|
|
949
593
|
return this.customIsAI || e(this.title) || this.author.some((t) => e(`${t.label}\u1145${t.description}`));
|
|
950
594
|
}
|
|
951
|
-
},
|
|
952
|
-
static
|
|
953
|
-
static
|
|
595
|
+
}, L = /* @__PURE__ */ l({ ContentPage: () => R }), R = class {
|
|
596
|
+
static layouts = t(_.createReactive(), "uni/contentPage/layouts");
|
|
597
|
+
static contentPages = t(_.createReactive(), "uni/contentPage/contentPages");
|
|
954
598
|
constructor(e, t, n) {
|
|
955
|
-
this.
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
recommends = j.withResolvers();
|
|
962
|
-
eps = j.withResolvers();
|
|
963
|
-
}, ie = /* @__PURE__ */ _({ Downloader: () => ae }), ae = class {}, oe = /* @__PURE__ */ _({ User: () => se }), se = class {
|
|
964
|
-
static userBase = o(/* @__PURE__ */ new Map());
|
|
965
|
-
static userEditorBase = o(/* @__PURE__ */ new Map());
|
|
599
|
+
this.preload = e, this.id = t, this.ep = n;
|
|
600
|
+
}
|
|
601
|
+
}, z = /* @__PURE__ */ l({ Downloader: () => B }), B = class {}, V = /* @__PURE__ */ l({ User: () => H }), H = class {
|
|
602
|
+
static userBase = e(/* @__PURE__ */ new Map());
|
|
603
|
+
static userEditorBase = e(/* @__PURE__ */ new Map());
|
|
604
|
+
static userCards = e(/* @__PURE__ */ new Map());
|
|
966
605
|
constructor(e) {
|
|
967
|
-
e.avatar && (this.avatar =
|
|
606
|
+
e.avatar && (this.avatar = P.create(e.avatar)), this.name = e.name, this.id = e.id, this.$$plugin = e.$$plugin, this.$$meta = e.$$meta;
|
|
968
607
|
}
|
|
969
608
|
avatar;
|
|
970
609
|
name;
|
|
971
610
|
id;
|
|
972
611
|
$$plugin;
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
612
|
+
$$meta;
|
|
613
|
+
}, U = /* @__PURE__ */ l({
|
|
614
|
+
comment: () => b,
|
|
615
|
+
content: () => L,
|
|
616
|
+
download: () => z,
|
|
617
|
+
ep: () => C,
|
|
618
|
+
image: () => N,
|
|
619
|
+
item: () => F,
|
|
620
|
+
resource: () => j,
|
|
621
|
+
user: () => V
|
|
982
622
|
});
|
|
983
|
-
|
|
623
|
+
//#endregion
|
|
624
|
+
export { _ as SourcedKeyMap, g as SourcedValue, v as Struct, U as uni };
|
|
984
625
|
|
|
985
626
|
//# sourceMappingURL=index.js.map
|