@delta-comic/model 0.0.5 → 1.3.1
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 +141 -461
- package/dist/index.js.map +1 -1
- package/dist/lib/model/comment.d.ts +4 -6
- package/dist/lib/model/content.d.ts +17 -23
- package/dist/lib/model/download.d.ts +3 -1
- package/dist/lib/model/ep.d.ts +5 -7
- package/dist/lib/model/image.d.ts +4 -6
- package/dist/lib/model/item.d.ts +11 -15
- package/dist/lib/model/resource.d.ts +3 -5
- package/dist/lib/model/user.d.ts +6 -4
- package/dist/lib/struct/index.d.ts +1 -3
- package/dist/lib/struct/meta.d.ts +12 -0
- package/dist/lib/struct/store.d.ts +6 -5
- 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/struct/promise.d.ts +0 -49
- package/dist/lib/struct/stream.d.ts +0 -83
package/dist/lib/model/item.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { default as dayjs } from 'dayjs';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
|
-
import {
|
|
4
|
-
import { SourcedKeyMap, Struct, MetaData } from '../struct';
|
|
3
|
+
import { SourcedKeyMap, Struct, Metadatable } from '../struct';
|
|
5
4
|
import { ContentType, ContentType_ } from './content';
|
|
6
5
|
import { Ep, RawEp } from './ep';
|
|
6
|
+
import { RawResource } from './resource';
|
|
7
7
|
import * as image from './image';
|
|
8
|
-
export interface Category {
|
|
8
|
+
export interface Category extends Metadatable {
|
|
9
9
|
name: string;
|
|
10
10
|
group: string;
|
|
11
11
|
search: {
|
|
@@ -14,7 +14,7 @@ export interface Category {
|
|
|
14
14
|
sort: string;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
export interface Author {
|
|
17
|
+
export interface Author extends Metadatable {
|
|
18
18
|
label: string;
|
|
19
19
|
icon: RawResource | image.RawImage | string;
|
|
20
20
|
description: string;
|
|
@@ -23,10 +23,8 @@ export interface Author {
|
|
|
23
23
|
* 否则传入的为`defineConfig`中定义的`subscribe.type`
|
|
24
24
|
*/ subscribe?: string;
|
|
25
25
|
actions?: string[];
|
|
26
|
-
$$meta?: MetaData;
|
|
27
|
-
$$plugin: string;
|
|
28
26
|
}
|
|
29
|
-
export interface RawItem {
|
|
27
|
+
export interface RawItem extends Metadatable {
|
|
30
28
|
cover: RawResource | image.RawImage;
|
|
31
29
|
title: string;
|
|
32
30
|
id: string;
|
|
@@ -42,14 +40,12 @@ export interface RawItem {
|
|
|
42
40
|
contentType: ContentType_;
|
|
43
41
|
length: string;
|
|
44
42
|
epLength: string;
|
|
45
|
-
$$plugin: string;
|
|
46
|
-
$$meta: MetaData;
|
|
47
43
|
description?: Description;
|
|
48
44
|
thisEp: RawEp;
|
|
49
45
|
commentSendable: boolean;
|
|
50
46
|
customIsSafe?: boolean;
|
|
51
47
|
}
|
|
52
|
-
export type
|
|
48
|
+
export type ItemCardComponent = Component<{
|
|
53
49
|
item: Item;
|
|
54
50
|
freeHeight?: boolean;
|
|
55
51
|
disabled?: boolean;
|
|
@@ -75,10 +71,10 @@ export declare abstract class Item extends Struct<RawItem> implements RawItem {
|
|
|
75
71
|
static itemTranslator: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], ItemTranslator>>;
|
|
76
72
|
static create(raw: RawItem): Item;
|
|
77
73
|
static authorIcon: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], Component>>;
|
|
78
|
-
static
|
|
79
|
-
abstract like(
|
|
80
|
-
abstract report(
|
|
81
|
-
abstract sendComment(text: string
|
|
74
|
+
static itemCards: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], ItemCardComponent>>;
|
|
75
|
+
abstract like(): Promise<any>;
|
|
76
|
+
abstract report(): Promise<any>;
|
|
77
|
+
abstract sendComment(text: string): Promise<any>;
|
|
82
78
|
static is(value: unknown): value is Item;
|
|
83
79
|
cover: RawResource | image.RawImage;
|
|
84
80
|
get $cover(): image.Image;
|
|
@@ -97,7 +93,7 @@ export declare abstract class Item extends Struct<RawItem> implements RawItem {
|
|
|
97
93
|
length: string;
|
|
98
94
|
epLength: string;
|
|
99
95
|
$$plugin: string;
|
|
100
|
-
$$meta:
|
|
96
|
+
$$meta: import('..').Metadata | undefined;
|
|
101
97
|
thisEp: RawEp;
|
|
102
98
|
customIsSafe?: boolean;
|
|
103
99
|
get $thisEp(): Ep;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SourcedKeyMap, Struct,
|
|
1
|
+
import { SourcedKeyMap, Struct, Metadata, Metadatable } from '../struct';
|
|
2
2
|
export type ProcessInstance = (nowPath: string, resource: Resource) => Promise<[path: string, exit: boolean]>;
|
|
3
3
|
export interface ProcessStep {
|
|
4
4
|
referenceName: string;
|
|
@@ -10,9 +10,7 @@ export interface ResourceType {
|
|
|
10
10
|
urls: string[];
|
|
11
11
|
test: (url: string, signal: AbortSignal) => PromiseLike<void>;
|
|
12
12
|
}
|
|
13
|
-
export interface RawResource {
|
|
14
|
-
$$plugin: string;
|
|
15
|
-
$$meta?: MetaData;
|
|
13
|
+
export interface RawResource extends Metadatable {
|
|
16
14
|
pathname: string;
|
|
17
15
|
type: string;
|
|
18
16
|
processSteps?: ProcessStep_[];
|
|
@@ -27,7 +25,7 @@ export declare class Resource extends Struct<RawResource> implements RawResource
|
|
|
27
25
|
type: string;
|
|
28
26
|
pathname: string;
|
|
29
27
|
processSteps: ProcessStep[];
|
|
30
|
-
$$meta?:
|
|
28
|
+
$$meta?: Metadata;
|
|
31
29
|
$$plugin: string;
|
|
32
30
|
getUrl(): Promise<string>;
|
|
33
31
|
omittedForks: import('vue').ShallowReactive<Set<string>>;
|
package/dist/lib/model/user.d.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { Metadata, Metadatable } from '../struct';
|
|
3
3
|
import { Image } from './image';
|
|
4
|
-
|
|
4
|
+
import { RawResource } from './resource';
|
|
5
|
+
export interface RawUser extends Metadatable {
|
|
5
6
|
avatar?: RawResource;
|
|
6
7
|
name: string;
|
|
7
8
|
id: string;
|
|
8
|
-
$$plugin: string;
|
|
9
9
|
}
|
|
10
10
|
export declare abstract class User {
|
|
11
11
|
static userBase: import('vue').ShallowReactive<Map<string, User>>;
|
|
12
12
|
static userEditorBase: import('vue').ShallowReactive<Map<string, Component>>;
|
|
13
|
+
static userCards: import('vue').ShallowReactive<Map<string, UserCardComponent>>;
|
|
13
14
|
constructor(v: RawUser);
|
|
14
15
|
avatar?: Image;
|
|
15
16
|
name: string;
|
|
16
17
|
id: string;
|
|
17
18
|
$$plugin: string;
|
|
19
|
+
$$meta?: Metadata;
|
|
18
20
|
abstract customUser: object;
|
|
19
21
|
}
|
|
20
|
-
export type
|
|
22
|
+
export type UserCardComponent = Component<{
|
|
21
23
|
user: User;
|
|
22
24
|
isSmall?: boolean;
|
|
23
25
|
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Metadatable {
|
|
2
|
+
$$meta?: Metadata;
|
|
3
|
+
$$plugin: string;
|
|
4
|
+
}
|
|
5
|
+
export type Metadata = Record<string | number, any>;
|
|
6
|
+
export type PageKey = string | number;
|
|
7
|
+
export interface StreamQuery<TParameters extends any[], TItem> {
|
|
8
|
+
(...args: [...TParameters, page: PageKey, signal?: AbortSignal]): Promise<TItem[] & {
|
|
9
|
+
nextPage?: PageKey;
|
|
10
|
+
}>;
|
|
11
|
+
initialPageParam: PageKey;
|
|
12
|
+
}
|
|
@@ -9,14 +9,14 @@ export declare class SourcedValue<T extends [string, string]> {
|
|
|
9
9
|
stringify(value: T): string;
|
|
10
10
|
constructor(separator?: string);
|
|
11
11
|
}
|
|
12
|
-
export type SourcedKeyType<T extends SourcedKeyMap<[string, string], any> | SourcedValue<any>> = T extends SourcedKeyMap<[string, string], any> ? Parameters<T['get']>[0] : Parameters<T['toJSON']>[0];
|
|
13
12
|
/**
|
|
14
13
|
* 相比较于普通的Map,这个元素的key操作可以是`TKey | string`
|
|
15
|
-
* _但内部保存仍使用`SourcedValue.toString`作为key_
|
|
14
|
+
* _但内部保存仍使用`SourcedValue.key.toString`作为key_
|
|
16
15
|
*/
|
|
17
|
-
export declare class SourcedKeyMap<TKey extends [string, string], TValue>
|
|
18
|
-
static
|
|
19
|
-
|
|
16
|
+
export declare class SourcedKeyMap<TKey extends [string, string], TValue> implements Map<string, TValue> {
|
|
17
|
+
static createReactive<TKey extends [string, string], TValue>(separator?: string): import('vue').ShallowReactive<SourcedKeyMap<TKey, TValue>>;
|
|
18
|
+
constructor(separator?: string);
|
|
19
|
+
key: SourcedValue<TKey>;
|
|
20
20
|
private store;
|
|
21
21
|
get size(): number;
|
|
22
22
|
[Symbol.toStringTag]: string;
|
|
@@ -31,3 +31,4 @@ export declare class SourcedKeyMap<TKey extends [string, string], TValue> extend
|
|
|
31
31
|
values(): MapIterator<TValue>;
|
|
32
32
|
[Symbol.iterator](): MapIterator<[string, TValue]>;
|
|
33
33
|
}
|
|
34
|
+
export type SourcedKeyType<T extends SourcedKeyMap<[string, string], any> | SourcedValue<[string, string]>> = T extends SourcedKeyMap<infer K, any> ? K | string : T extends SourcedValue<infer K> ? K | string : never;
|
package/dist/pack.tgz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delta-comic/model",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "空阙虱楼",
|
|
5
|
-
"homepage": "https://github.com/delta-comic/delta-comic
|
|
5
|
+
"homepage": "https://github.com/delta-comic/delta-comic",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "wenxig",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/delta-comic/delta-comic
|
|
13
|
+
"url": "https://github.com/delta-comic/delta-comic.git"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/lib/index.d.ts",
|
|
25
|
-
"import": "./dist/index.js"
|
|
26
|
-
"require": "./dist/index.cjs"
|
|
25
|
+
"import": "./dist/index.js"
|
|
27
26
|
}
|
|
28
27
|
},
|
|
29
28
|
"publishConfig": {
|
|
@@ -31,13 +30,17 @@
|
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"@vueuse/core": "^14.2.1",
|
|
34
|
-
"dayjs": "^1.11.
|
|
33
|
+
"dayjs": "^1.11.20",
|
|
35
34
|
"mitt": "^3.0.1"
|
|
36
35
|
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
38
|
+
"vite-plus": "latest"
|
|
39
|
+
},
|
|
37
40
|
"peerDependencies": {
|
|
38
41
|
"vue": "^3.5",
|
|
39
|
-
"@delta-comic/request": "
|
|
40
|
-
"@delta-comic/utils": "
|
|
42
|
+
"@delta-comic/request": "1.3.1",
|
|
43
|
+
"@delta-comic/utils": "1.3.1"
|
|
41
44
|
},
|
|
42
45
|
"release": {
|
|
43
46
|
"tagFormat": "model-${version}"
|
|
@@ -46,13 +49,7 @@
|
|
|
46
49
|
"tarball": "./dist/pack.tgz"
|
|
47
50
|
},
|
|
48
51
|
"readme": "./README.md",
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"vite": "8.0.0-beta.16"
|
|
51
|
-
},
|
|
52
52
|
"scripts": {
|
|
53
|
-
"build": "
|
|
54
|
-
"version:major": "pnpm version major --no-git-tag-version || true",
|
|
55
|
-
"version:minor": "pnpm version minor --no-git-tag-version || true",
|
|
56
|
-
"version:patch": "pnpm version patch --no-git-tag-version || true"
|
|
53
|
+
"build": "vp build && pnpm pack --out ./dist/pack.tgz"
|
|
57
54
|
}
|
|
58
55
|
}
|
package/dist/index.umd.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@delta-comic/utils`),require(`vue`),require(`axios`)):typeof define==`function`&&define.amd?define([`exports`,`@delta-comic/utils`,`vue`,`axios`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.DcModel={},e.window.$$lib$$.DcUtils,e.window.$$lib$$.Vue,e.window.$$lib$$.Axios))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),d=(e,t)=>{let n={};for(var r in e)a(n,r,{get:e[r],enumerable:!0});return t||a(n,Symbol.toStringTag,{value:`Module`}),n},f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e},p=(e,t,n)=>(n=e==null?{}:i(c(e)),f(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e));function m(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function h(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}function g(e){return e instanceof Error}function _(e){return Number.isSafeInteger(e)&&e>=0}function v(e){return typeof e==`string`}function y(e){return e!=null&&typeof e!=`function`&&_(e.length)}function b(e){return typeof e==`object`&&!!e&&h(e)===`[object Arguments]`}function x(e){return typeof e==`string`||e instanceof String}function S(e){let t=e?.constructor;return e===(typeof t==`function`?t.prototype:Object.prototype)}function C(e){return m(e)}function w(e){if(e==null)return!0;if(y(e))return typeof e.splice!=`function`&&typeof e!=`string`&&(typeof Buffer>`u`||!Buffer.isBuffer(e))&&!C(e)&&!b(e)?!1:e.length===0;if(typeof e==`object`){if(e instanceof Map||e instanceof Set)return e.size===0;let t=Object.keys(e);return S(e)?t.filter(e=>e!==`constructor`).length===0:t.length===0}return!0}function T(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var E=class e{[Symbol.toStringTag]=`PromiseContent`;static _this;static{this._this=(0,t.useGlobalVar)(this,`data/PromiseContent`)}static isPromiseContent(e){return e instanceof this._this}static fromPromise(e,t=e=>e){return(0,n.markRaw)(new this._this(e,t))}constructor(e,t=e=>e){this.promise=e,this.processor=t,this.loadPromise(e)}async loadPromise(e){this.data.value=void 0,this.isLoading.value=!0,this.isError.value=!1,this.errorCause.value=void 0,this.isEmpty.value=!0;try{let t=await e;this.data.value=this.processor(t),this.isLoading.value=!1,this.isError.value=!1,this.isEmpty.value=w(t),this.emitter.emit(`success`,this.data.value)}catch(e){this.data.value=void 0,this.isError.value=!0,this.errorCause.value=g(e)?e:Error(String(e)),console.error(`Non-throw Error [PromiseContent]`,e),this.emitter.emit(`error`,e)}this.emitter.emit(`finial`,void 0)}emitter=T();onError(e){return this.emitter.on(`error`,e),()=>this.emitter.off(`error`,e)}onSuccess(e){return this.emitter.on(`success`,e),()=>this.emitter.off(`success`,e)}onFinal(e){return this.emitter.on(`finial`,e),()=>this.emitter.off(`finial`,e)}setProcessor(t){return e.fromPromise(this.promise,t)}catch(e){return this.promise.catch(e)}then(e,t){return this.promise.then(e,t)}finally(e){return this.promise.finally(e)}data=(0,n.shallowRef)();isLoading=(0,n.shallowRef)(!0);isError=(0,n.shallowRef)(!1);errorCause=(0,n.shallowRef)();isEmpty=(0,n.shallowRef)(!0);static fromAsyncFunction(e){return(...t)=>this.fromPromise(e(...t))}static resolve(e){let t=this.fromPromise(Promise.resolve(e));return t.isLoading.value=!1,t}static withResolvers(e=!1){let t=Promise.withResolvers(),n=new this._this(t.promise);return n.isLoading.value=e,{content:n,reject:e=>{t.reject(e)},resolve:e=>{t.resolve(e)},reset(e=!1){t=Promise.withResolvers(),n.loadPromise(t.promise),n.isLoading.value=e}}}},D=class{toJSON(e){return v(e)?this.parse(e):e}parse(e){let t=e.split(this.separator);return[t[0],t.slice(1).join(this.separator)]}toString(e){return v(e)?e:this.stringify(e)}stringify(e){return e.join(this.separator)}constructor(e=`:`){this.separator=e}},O=class extends D{static create(e=`:`){return(0,n.shallowReactive)(new this(e))}constructor(e=`:`){super(e)}store=(0,n.shallowReactive)(new Map);get size(){return this.store.size}[Symbol.toStringTag]=`SourcedKeyMap`;clear(){this.store.clear()}delete(e){return this.store.delete(this.toString(e))}forEach(e,t){this.store.forEach((n,r)=>{e.call(t,n,r,this)})}get(e){return this.store.get(this.toString(e))}has(e){return this.store.has(this.toString(e))}set(e,t){return this.store.set(this.toString(e),t),this}entries(){return this.store.entries()}keys(){return this.store.keys()}values(){return this.store.values()}[Symbol.iterator](){return this.entries()}};function k(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var A=class{_controller=new AbortController;mitt=k();get signal(){return this._controller.signal}abort(e){this._controller.abort(e),this._controller=new AbortController,this.mitt.emit(`abort`)}onAbort(e){return this.mitt.on(`abort`,e),()=>this.mitt.off(`abort`,e)}onAbortOnce(e){let t=async()=>{await e(),this.mitt.off(`abort`,t)};this.mitt.on(`abort`,t)}};Error,typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function j(e,t=!1,n=`Timeout`){return new Promise((r,i)=>{t?setTimeout(()=>i(n),e):setTimeout(r,e)})}function M(e,t=!1){function r(r,{flush:i=`sync`,deep:a=!1,timeout:o,throwOnTimeout:s}={}){let c=null,l=[new Promise(o=>{c=(0,n.watch)(e,e=>{r(e)!==t&&(c?c():(0,n.nextTick)(()=>c?.()),o(e))},{flush:i,deep:a,immediate:!0})})];return o!=null&&l.push(j(o,s).then(()=>(0,n.toValue)(e)).finally(()=>c?.())),Promise.race(l)}function i(i,a){if(!(0,n.isRef)(i))return r(e=>e===i,a);let{flush:o=`sync`,deep:s=!1,timeout:c,throwOnTimeout:l}=a??{},u=null,d=[new Promise(r=>{u=(0,n.watch)([e,i],([e,i])=>{t!==(e===i)&&(u?u():(0,n.nextTick)(()=>u?.()),r(e))},{flush:o,deep:s,immediate:!0})})];return c!=null&&d.push(j(c,l).then(()=>(0,n.toValue)(e)).finally(()=>(u?.(),(0,n.toValue)(e)))),Promise.race(d)}function a(e){return r(e=>!!e,e)}function o(e){return i(null,e)}function s(e){return i(void 0,e)}function c(e){return r(Number.isNaN,e)}function l(e,t){return r(t=>{let r=Array.from(t);return r.includes(e)||r.includes((0,n.toValue)(e))},t)}function u(e){return d(1,e)}function d(e=1,t){let n=-1;return r(()=>(n+=1,n>=e),t)}return Array.isArray((0,n.toValue)(e))?{toMatch:r,toContains:l,changed:u,changedTimes:d,get not(){return M(e,!t)}}:{toMatch:r,toBe:i,toBeTruthy:a,toBeNull:o,toBeNaN:c,toBeUndefined:s,changed:u,changedTimes:d,get not(){return M(e,!t)}}}function N(e){return M(e)}var P=new Map,F=class{constructor(e){this.generator=e.bind(this)(this.abortController.signal,this),P.set(this,e)}static _this;static{this._this=(0,t.useGlobalVar)(this,`data/Stream`)}static isStream(e){return e instanceof this._this}static create(e){return(0,n.markRaw)(new this._this(e))}abortController=new A;generator;_setupData=[];setupData(e){return this._setupData.push(...e),this.data.value.unshift(...e),this}async next(e=!1){try{if(e||(await N(this.isRequesting).toBe(!1),this.isRequesting.value=!0),this._isDone)return e||(this.isRequesting.value=!1),{done:!0,value:void 0};e&&console.log(`igRequesting next`);let{value:t,done:n}=await this.generator.next(this);return this.isDone.value=n??!1,e||(this.isRequesting.value=!1),n?{done:!0,value:void 0}:(this.data.value.push(...t),{value:t,done:n})}catch(t){throw e||(this.isRequesting.value=!1),this.error.value=t,t}}async return(){return await this.generator.return?.()??{value:void 0,done:!0}}async throw(e){return await this.generator.throw?.(e)??{value:void 0,done:!0}}toReadableStream(){let e=this;return new ReadableStream({async pull(t){let{value:n,done:r}=await e.next();r?t.close():t.enqueue(n)}})}reset(){this.generator=P.get(this).bind(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}async retry(){return this.page.value--,this.next()}async nextToDone(){isNaN(this._pages)&&await this.next(!0);let e=[];for(let t=this._page+1;t<=this._pages;t++)e.push(this.next(!0));return await Promise.all(e),this._data}stop(){this.abortController.abort(),this.isRequesting.value=!1}[Symbol.asyncIterator](){return this}error=(0,n.shallowRef)();data=(0,n.ref)([]);get _data(){return this.data.value}page=(0,n.shallowRef)(0);get _page(){return this.page.value}pages=(0,n.shallowRef)(NaN);get _pages(){return this.pages.value}total=(0,n.shallowRef)(NaN);get _total(){return this.total.value}pageSize=(0,n.shallowRef)(NaN);get _pageSize(){return this.pageSize.value}length=(0,n.computed)(()=>this.data.value.length);get _length(){return this.data.value.length}isRequesting=(0,n.shallowRef)(!1);get _isRequesting(){return this.isRequesting.value}isDone=(0,n.shallowRef)(!1);get _isDone(){return this.isDone.value}isNoData=(0,n.computed)(()=>this.isDone.value&&this.isEmpty.value);get _isNoData(){return this.isNoData.value}isEmpty=(0,n.computed)(()=>this.length.value===0);get _isEmpty(){return this.isEmpty.value}};let I=e=>{let{resolve:t,promise:n}=Promise.withResolvers();return e(t),n};var L=class e{toJSON(){return JSON.parse(JSON.stringify(this.$$raw))}constructor(e){this.$$raw=e}static toRaw(t){return t instanceof e?t.toJSON():t}},R=u(((e,t)=>{(function(n,r){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()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),z=d({Comment:()=>V}),B=p(R(),1),V=class extends L{static commentRow=O.create();constructor(e){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}content;time;get $time(){return(0,B.default)(this.time)}id;childrenCount;likeCount;isTop;isLiked;reported;$$plugin;$$meta},H=d({Ep:()=>U}),U=class extends L{name;index;$$plugin;$$meta;constructor(e){super(e),this.name=e.name,this.index=e.index,this.$$plugin=e.$$plugin,this.$$meta=e.$$meta}},W=d({Resource:()=>G}),G=class e extends L{static processInstances=(0,t.useGlobalVar)(O.create(),`uni/resource/processInstances`);static fork=(0,t.useGlobalVar)(O.create(),`uni/resource/fork`);static precedenceFork=(0,t.useGlobalVar)(O.create(),`uni/resource/precedenceFork`);static is(e){return e instanceof this}static create(e){return new this(e)}constructor(e){super(e),this.$$plugin=e.$$plugin,this.$$meta=e.$$meta,this.pathname=e.pathname,this.type=e.type,this.processSteps=(e.processSteps??[]).map(e=>x(e)?{referenceName:e,ignoreExit:!1}:e)}type;pathname;processSteps;$$meta;$$plugin;async getUrl(){let t=this.pathname;for(let n of this.processSteps){let r=e.processInstances.get([this.$$plugin,n.referenceName]);if(!r){console.warn(`[Resource.getUrl] process not found, fullname: [${this.$$plugin}, ${n.referenceName}]`);continue}let i=await r(t,this);if(t=i[0],!(n.ignoreExit||!i[1]))break}return URL.canParse(t)?t:`${this.getThisFork()}/${t}`}omittedForks=(0,n.shallowReactive)(new Set);getThisFork(){let t=new Set(e.fork.get([this.$$plugin,this.type])?.urls??[]),n;if(n=w(this.omittedForks)?e.precedenceFork.get([this.$$plugin,this.type]):Array.from(t.difference(this.omittedForks).values())[0],!n)throw Error(`[Resource.getThisFork] fork not found, type: [${this.$$plugin}, ${this.type}]`);return n}localChangeFork(){let t=new Set(e.fork.get([this.$$plugin,this.type])?.urls??[]);this.omittedForks.add(this.getThisFork());let n=w(t.difference(this.omittedForks));return n&&this.omittedForks.clear(),n}},K=d({Image:()=>q}),q=class extends G{static is(e){return e instanceof this}static create(e,t){return new this(e,t)}constructor(e,t){`forkNamespace`in e?super({$$plugin:e.$$plugin,$$meta:{...e.$$meta,...t},pathname:e.path,type:e.forkNamespace,processSteps:e.processSteps}):super(e)}get aspect(){return this.$$meta}set aspect(e){this.$$meta??={},this.$$meta.width=e.width,this.$$meta.height=e.height}},J=d({Item:()=>Y}),Y=class extends L{static itemTranslator=O.create();static create(e){let t=this.itemTranslator.get(e.contentType);if(!t)throw Error(`can not found itemTranslator contentType:"${Z.contentPage.toString(e.contentType)}"`);return t(e)}static authorIcon=O.create();static itemCard=(0,t.useGlobalVar)(O.create(),`uni/item/itemCard`);static is(e){return e instanceof this}cover;get $cover(){return q.create(this.cover)}title;id;categories;author;viewNumber;likeNumber;commentNumber;isLiked;description;updateTime;get $updateTime(){return(0,B.default)(this.updateTime)}contentType;length;epLength;$$plugin;$$meta;thisEp;customIsSafe;get $thisEp(){return new U(this.thisEp)}constructor(e){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=Z.contentPage.toJSON(e.contentType),this.length=e.length,this.epLength=e.epLength,this.description=e.description,this.commentSendable=e.commentSendable,this.customIsSafe=e.customIsSafe}commentSendable;customIsAI;get $isAi(){let e=e=>/(^|[\((\[\s【])ai[】\))\]\s]?/gi.test(e);return this.customIsAI||e(this.title)||this.author.some(t=>e(`${t.label}\u1145${t.description}`))}},X=d({ContentPage:()=>Z}),Z=class{static viewLayout=(0,t.useGlobalVar)(O.create(),`uni/contentPage/viewLayout`);static contentPage=(0,t.useGlobalVar)(O.create(),`uni/contentPage/contentPage`);constructor(e,t,n){this.id=t,this.ep=n,this.preload.value=e}pid=E.withResolvers();preload=(0,n.shallowRef)(void 0);detail=E.withResolvers();union=(0,n.computed)(()=>this.detail.content.data.value??this.preload.value);recommends=E.withResolvers();eps=E.withResolvers()},Q=d({Downloader:()=>$}),$=class{},ee=d({User:()=>te}),te=class{static userBase=(0,n.shallowReactive)(new Map);static userEditorBase=(0,n.shallowReactive)(new Map);constructor(e){e.avatar&&(this.avatar=q.create(e.avatar)),this.name=e.name,this.id=e.id,this.$$plugin=e.$$plugin}avatar;name;id;$$plugin},ne=d({comment:()=>z,content:()=>X,download:()=>Q,ep:()=>H,image:()=>K,item:()=>J,resource:()=>W,user:()=>ee});e.PromiseContent=E,e.SourcedKeyMap=O,e.SourcedValue=D,e.Stream=F,e.Struct=L,e.callbackToPromise=I,Object.defineProperty(e,`uni`,{enumerable:!0,get:function(){return ne}})});
|
|
2
|
-
//# sourceMappingURL=index.umd.cjs.map
|