delta-comic-core 0.0.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 +21 -0
- package/README.md +30 -0
- package/dist/bundle.css +2 -0
- package/dist/bundle.js +4896 -0
- package/dist/bundle.js.map +1 -0
- package/dist/bundle.umd.cjs +3 -0
- package/dist/bundle.umd.cjs.map +1 -0
- package/dist/components/await.vue.d.ts +26 -0
- package/dist/components/content/unitCard.vue.d.ts +317 -0
- package/dist/components/content.vue.d.ts +43 -0
- package/dist/components/floatPopup.vue.d.ts +39 -0
- package/dist/components/image.vue.d.ts +63 -0
- package/dist/components/list.vue.d.ts +53 -0
- package/dist/components/loading.vue.d.ts +18 -0
- package/dist/components/popup.vue.d.ts +41 -0
- package/dist/components/routerTab.vue.d.ts +34 -0
- package/dist/components/text.vue.d.ts +23 -0
- package/dist/components/toggleIcon.vue.d.ts +42 -0
- package/dist/components/user/previewUser.vue.d.ts +94 -0
- package/dist/components/var.vue.d.ts +23 -0
- package/dist/components/waterfall.vue.d.ts +54 -0
- package/dist/config/index.d.ts +38 -0
- package/dist/index.d.ts +1112 -0
- package/dist/layout/user.d.ts +0 -0
- package/dist/plugin.d.ts +189 -0
- package/dist/stores/temp.d.ts +23 -0
- package/dist/struct/comment.d.ts +55 -0
- package/dist/struct/content.d.ts +70 -0
- package/dist/struct/ep.d.ts +14 -0
- package/dist/struct/image.d.ts +44 -0
- package/dist/struct/index.d.ts +14 -0
- package/dist/struct/item.d.ts +56 -0
- package/dist/struct/user.d.ts +21 -0
- package/dist/symbol.d.ts +3 -0
- package/dist/utils/data.d.ts +123 -0
- package/dist/utils/delay.d.ts +1 -0
- package/dist/utils/eventBus.d.ts +34 -0
- package/dist/utils/image.d.ts +5 -0
- package/dist/utils/layout.d.ts +8 -0
- package/dist/utils/message.d.ts +22 -0
- package/dist/utils/plugin.d.ts +1 -0
- package/dist/utils/request.d.ts +48 -0
- package/dist/utils/translate.d.ts +2 -0
- package/package.json +73 -0
|
File without changes
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { ContentPageLike, ItemCardComp, ViewLayoutComp } from './struct/content';
|
|
2
|
+
import { ProcessInstance } from './struct/image';
|
|
3
|
+
import { CommentRow } from './struct/comment';
|
|
4
|
+
import { UserCardComp } from './struct/user';
|
|
5
|
+
import { RStream } from './utils/data';
|
|
6
|
+
import { Item, RawItem } from './struct/item';
|
|
7
|
+
import { Component } from 'vue';
|
|
8
|
+
export interface PluginConfig {
|
|
9
|
+
name: string;
|
|
10
|
+
content?: PluginConfigContent;
|
|
11
|
+
image?: PluginConfigImage;
|
|
12
|
+
api?: Record<string, PluginConfigApi>;
|
|
13
|
+
user?: PluginConfigUser;
|
|
14
|
+
auth?: PluginConfigAuth;
|
|
15
|
+
otherProgress?: {
|
|
16
|
+
call: (setDescription: (description: string) => void) => PromiseLike<any>;
|
|
17
|
+
name: string;
|
|
18
|
+
}[];
|
|
19
|
+
onBooted?(ins: PluginDefineResult): PromiseLike<void> | void;
|
|
20
|
+
search?: PluginConfigSearch;
|
|
21
|
+
}
|
|
22
|
+
export interface PluginConfigUser {
|
|
23
|
+
edit: Component;
|
|
24
|
+
card: UserCardComp;
|
|
25
|
+
/**
|
|
26
|
+
* 1. download
|
|
27
|
+
* 2. (auto)clear cloud
|
|
28
|
+
* 3. upload
|
|
29
|
+
*/
|
|
30
|
+
syncFavourite?: {
|
|
31
|
+
download: () => PromiseLike<Item[]>;
|
|
32
|
+
upload: (items: RawItem[]) => PromiseLike<any>;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface PluginConfigSearch {
|
|
36
|
+
/**
|
|
37
|
+
* @description
|
|
38
|
+
* key: id
|
|
39
|
+
*/
|
|
40
|
+
methods?: Record<string, PluginConfigSearchMethod>;
|
|
41
|
+
tabbar?: PluginConfigSearchTabbar[];
|
|
42
|
+
categories?: PluginConfigSearchCategory[];
|
|
43
|
+
}
|
|
44
|
+
export interface PluginConfigSearchCategory {
|
|
45
|
+
title: string;
|
|
46
|
+
namespace: string;
|
|
47
|
+
search: {
|
|
48
|
+
methodId: string;
|
|
49
|
+
input: string;
|
|
50
|
+
sort: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface PluginConfigSearchTabbar {
|
|
54
|
+
title: string;
|
|
55
|
+
id: string;
|
|
56
|
+
comp: Component<{
|
|
57
|
+
isActive: boolean;
|
|
58
|
+
tabbar: PluginConfigSearchTabbar;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
export interface PluginConfigSearchMethod {
|
|
62
|
+
name: string;
|
|
63
|
+
sorts: {
|
|
64
|
+
text: string;
|
|
65
|
+
value: string;
|
|
66
|
+
}[];
|
|
67
|
+
defaultSort: string;
|
|
68
|
+
getStream(input: string, sort: string): RStream<Item>;
|
|
69
|
+
getAutoComplete(input: string, signal: AbortSignal): PromiseLike<{
|
|
70
|
+
text: string;
|
|
71
|
+
value: string;
|
|
72
|
+
}[]>;
|
|
73
|
+
}
|
|
74
|
+
export interface PluginConfigApi {
|
|
75
|
+
forks: () => (PromiseLike<string[]> | string[]);
|
|
76
|
+
/**
|
|
77
|
+
* error -> 不可用
|
|
78
|
+
* other -> 可用并比对时间
|
|
79
|
+
*/
|
|
80
|
+
test: (fork: string, signal: AbortSignal) => PromiseLike<void>;
|
|
81
|
+
}
|
|
82
|
+
export interface PluginConfigImage {
|
|
83
|
+
/**
|
|
84
|
+
* @description
|
|
85
|
+
* key: namespace
|
|
86
|
+
* value: url
|
|
87
|
+
* 与`Image.setFork(name, key, value)`等价
|
|
88
|
+
*/
|
|
89
|
+
forks: Record<string, string[]>;
|
|
90
|
+
test: string;
|
|
91
|
+
/**
|
|
92
|
+
* @description
|
|
93
|
+
* key: reference name
|
|
94
|
+
* value: process function
|
|
95
|
+
* 与`Image.setProcess(name, key, value)`等价
|
|
96
|
+
*/
|
|
97
|
+
process?: Record<string, ProcessInstance['func']>;
|
|
98
|
+
}
|
|
99
|
+
export interface PluginConfigContent {
|
|
100
|
+
/**
|
|
101
|
+
* @description
|
|
102
|
+
* key: contentType
|
|
103
|
+
* value: component
|
|
104
|
+
* 与`ContentPage.setItemCard(key, value)`等价
|
|
105
|
+
*/
|
|
106
|
+
itemCard?: Record<string, ItemCardComp>;
|
|
107
|
+
/**
|
|
108
|
+
* @description
|
|
109
|
+
* key: contentType
|
|
110
|
+
* value: component
|
|
111
|
+
* 与`Comment.setCommentRow(key, value)`等价
|
|
112
|
+
*/
|
|
113
|
+
commentRow?: Record<string, CommentRow>;
|
|
114
|
+
/**
|
|
115
|
+
* @description
|
|
116
|
+
* key: contentType
|
|
117
|
+
* value: component
|
|
118
|
+
* 与`ContentPage.setViewLayout(key, value)`等价
|
|
119
|
+
*/
|
|
120
|
+
layout?: Record<string, ViewLayoutComp>;
|
|
121
|
+
/**
|
|
122
|
+
* @description
|
|
123
|
+
* key: name
|
|
124
|
+
* value: ContentPage
|
|
125
|
+
* 与`ContentPage.setContentPage(key, value)`等价
|
|
126
|
+
* _不需要提供viewLayout_
|
|
127
|
+
*/
|
|
128
|
+
contentPage?: Record<string, ContentPageLike>;
|
|
129
|
+
}
|
|
130
|
+
export type PluginConfigAuthFormType = {
|
|
131
|
+
info: string;
|
|
132
|
+
placeholder?: string;
|
|
133
|
+
/**
|
|
134
|
+
* @default true
|
|
135
|
+
*/
|
|
136
|
+
required?: boolean;
|
|
137
|
+
} & ({
|
|
138
|
+
type: 'string';
|
|
139
|
+
patten?: RegExp;
|
|
140
|
+
defaultValue?: string;
|
|
141
|
+
} | {
|
|
142
|
+
type: 'number';
|
|
143
|
+
range?: [number, number];
|
|
144
|
+
float?: boolean;
|
|
145
|
+
defaultValue?: number;
|
|
146
|
+
} | {
|
|
147
|
+
type: 'radio';
|
|
148
|
+
selects: {
|
|
149
|
+
label: string;
|
|
150
|
+
value: string;
|
|
151
|
+
}[];
|
|
152
|
+
comp: 'radio' | 'select';
|
|
153
|
+
defaultValue?: string;
|
|
154
|
+
} | {
|
|
155
|
+
type: 'checkbox';
|
|
156
|
+
selects: {
|
|
157
|
+
label: string;
|
|
158
|
+
value: string;
|
|
159
|
+
}[];
|
|
160
|
+
comp: 'checkbox' | 'multipleSelect';
|
|
161
|
+
defaultValue?: string[];
|
|
162
|
+
} | {
|
|
163
|
+
type: 'switch';
|
|
164
|
+
close?: string;
|
|
165
|
+
open?: string;
|
|
166
|
+
defaultValue?: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
type: 'date';
|
|
169
|
+
defaultValue?: number;
|
|
170
|
+
});
|
|
171
|
+
export type PluginConfigAuthFormResult<T extends PluginConfigAuthFormType> = T['type'] extends 'string' ? string : T['type'] extends 'number' ? number : T['type'] extends 'radio' ? string : T['type'] extends 'checkbox' ? string[] : T['type'] extends 'switch' ? boolean : T['type'] extends 'date' ? number : never;
|
|
172
|
+
export type PluginConfigAuthMethod = {
|
|
173
|
+
form<T extends Record<string, PluginConfigAuthFormType>>(form: T): Promise<{
|
|
174
|
+
[x in keyof T]: PluginConfigAuthFormResult<T[x]>;
|
|
175
|
+
}>;
|
|
176
|
+
/**
|
|
177
|
+
* sandbox: "allow-forms allow-modals allow-orientation-lock allow-popups-to-escape-sandbox allow-pointer-lock"
|
|
178
|
+
*/
|
|
179
|
+
website(url: string): Window;
|
|
180
|
+
};
|
|
181
|
+
export interface PluginConfigAuth {
|
|
182
|
+
signUp: (by: PluginConfigAuthMethod) => PromiseLike<any>;
|
|
183
|
+
logIn: (by: PluginConfigAuthMethod) => PromiseLike<any>;
|
|
184
|
+
passSelect: () => PromiseLike<'signUp' | 'logIn' | false>;
|
|
185
|
+
}
|
|
186
|
+
export declare const definePlugin: (config: PluginConfig | ((safe: boolean) => PluginConfig)) => void;
|
|
187
|
+
export type PluginDefineResult = {
|
|
188
|
+
api?: Record<string, string | undefined | false>;
|
|
189
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Reactive } from 'vue';
|
|
2
|
+
export declare const useTemp: import('pinia').StoreDefinition<"core:temp", Pick<{
|
|
3
|
+
$apply: <T extends object>(id: string, def: () => T) => Reactive<T>;
|
|
4
|
+
$has: (id: string) => boolean;
|
|
5
|
+
$onlyGet: <T extends object>(id: string) => Reactive<T>;
|
|
6
|
+
$applyRaw: <T extends object>(id: string, def: () => T) => T;
|
|
7
|
+
$hasRaw: (id: string) => boolean;
|
|
8
|
+
$onlyGetRaw: <T extends object>(id: string) => Reactive<T>;
|
|
9
|
+
}, never>, Pick<{
|
|
10
|
+
$apply: <T extends object>(id: string, def: () => T) => Reactive<T>;
|
|
11
|
+
$has: (id: string) => boolean;
|
|
12
|
+
$onlyGet: <T extends object>(id: string) => Reactive<T>;
|
|
13
|
+
$applyRaw: <T extends object>(id: string, def: () => T) => T;
|
|
14
|
+
$hasRaw: (id: string) => boolean;
|
|
15
|
+
$onlyGetRaw: <T extends object>(id: string) => Reactive<T>;
|
|
16
|
+
}, never>, Pick<{
|
|
17
|
+
$apply: <T extends object>(id: string, def: () => T) => Reactive<T>;
|
|
18
|
+
$has: (id: string) => boolean;
|
|
19
|
+
$onlyGet: <T extends object>(id: string) => Reactive<T>;
|
|
20
|
+
$applyRaw: <T extends object>(id: string, def: () => T) => T;
|
|
21
|
+
$hasRaw: (id: string) => boolean;
|
|
22
|
+
$onlyGetRaw: <T extends object>(id: string) => Reactive<T>;
|
|
23
|
+
}, "$apply" | "$has" | "$onlyGet" | "$applyRaw" | "$hasRaw" | "$onlyGetRaw">>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Struct, MetaData, RStream } from '../utils/data';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
import { uni } from '.';
|
|
4
|
+
import { default as dayjs } from 'dayjs';
|
|
5
|
+
import { User } from './user';
|
|
6
|
+
export interface RawComment {
|
|
7
|
+
sender: {
|
|
8
|
+
name: string;
|
|
9
|
+
user?: any;
|
|
10
|
+
};
|
|
11
|
+
content: {
|
|
12
|
+
type: 'string' | 'html';
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
time: number;
|
|
16
|
+
id: string;
|
|
17
|
+
childrenCount: number;
|
|
18
|
+
likeCount: number;
|
|
19
|
+
isLiked: boolean;
|
|
20
|
+
reported: boolean;
|
|
21
|
+
$$plugin: string;
|
|
22
|
+
$$meta?: MetaData;
|
|
23
|
+
isTop: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type CommentRow = Component<{
|
|
26
|
+
comment: Comment;
|
|
27
|
+
item: uni.item.Item;
|
|
28
|
+
parentComment?: Comment;
|
|
29
|
+
onClick?: ((c: Comment) => any);
|
|
30
|
+
}>;
|
|
31
|
+
export declare abstract class Comment extends Struct<RawComment> implements RawComment {
|
|
32
|
+
private static commentRow;
|
|
33
|
+
static setCommentRow(ct_: uni.content.ContentType_, component: CommentRow): string;
|
|
34
|
+
static getCommentRow(ct_: uni.content.ContentType_): uni.comment.CommentRow;
|
|
35
|
+
constructor(v: RawComment);
|
|
36
|
+
abstract sender: User;
|
|
37
|
+
content: {
|
|
38
|
+
type: 'string' | 'html';
|
|
39
|
+
text: string;
|
|
40
|
+
};
|
|
41
|
+
time: number;
|
|
42
|
+
$time(): dayjs.Dayjs;
|
|
43
|
+
id: string;
|
|
44
|
+
childrenCount: number;
|
|
45
|
+
likeCount: number;
|
|
46
|
+
isTop: boolean;
|
|
47
|
+
isLiked: boolean;
|
|
48
|
+
reported: boolean;
|
|
49
|
+
$$plugin: string;
|
|
50
|
+
$$meta?: MetaData;
|
|
51
|
+
abstract like(signal?: AbortSignal): PromiseLike<boolean>;
|
|
52
|
+
abstract report(signal?: AbortSignal): PromiseLike<any>;
|
|
53
|
+
abstract sendComment(text: string, signal?: AbortSignal): PromiseLike<any>;
|
|
54
|
+
abstract children: RStream<Comment>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Component, StyleValue } from 'vue';
|
|
2
|
+
import { RStream } from '../utils/data';
|
|
3
|
+
import { uni } from '.';
|
|
4
|
+
import { PluginConfigSearchCategory, PluginConfigSearchTabbar } from '../plugin';
|
|
5
|
+
import * as item from './item';
|
|
6
|
+
import * as ep from './ep';
|
|
7
|
+
import * as comment from './comment';
|
|
8
|
+
export type PreloadValue = item.Item | undefined;
|
|
9
|
+
export type ContentPageLike = new (preload: PreloadValue, id: string, ep: string) => ContentPage;
|
|
10
|
+
export declare abstract class ContentPage<T extends object = any> {
|
|
11
|
+
id: string;
|
|
12
|
+
ep: string;
|
|
13
|
+
private static viewLayout;
|
|
14
|
+
static setViewLayout(ct_: ContentType_, component: ViewLayoutComp): string;
|
|
15
|
+
static getViewLayout(ct_: ContentType_): uni.content.ViewLayoutComp;
|
|
16
|
+
static tabbar: import('vue').ShallowReactive<Map<string, PluginConfigSearchTabbar[]>>;
|
|
17
|
+
static setTabbar(plugin: string, ...tabbar: PluginConfigSearchTabbar[]): void;
|
|
18
|
+
static getTabbar(plugin: string): PluginConfigSearchTabbar[];
|
|
19
|
+
static categories: import('vue').ShallowReactive<Map<string, PluginConfigSearchCategory[]>>;
|
|
20
|
+
static setCategories(plugin: string, ...categories: PluginConfigSearchCategory[]): void;
|
|
21
|
+
static getCategories(plugin: string): PluginConfigSearchCategory[];
|
|
22
|
+
private static itemCard;
|
|
23
|
+
static setItemCard(ct_: ContentType_, component: ItemCardComp): string;
|
|
24
|
+
static getItemCard(ct_: ContentType_): uni.content.ItemCardComp;
|
|
25
|
+
private static contentPage;
|
|
26
|
+
static setContentPage(contentType: ContentType_, page: ContentPageLike): void;
|
|
27
|
+
static getContentPage(contentType: ContentType_): uni.content.ContentPageLike;
|
|
28
|
+
static toContentType(ct: ContentType_): ContentType;
|
|
29
|
+
static toContentTypeString(ct: ContentType_): string;
|
|
30
|
+
constructor(preload: PreloadValue, id: string, ep: string);
|
|
31
|
+
abstract contentType: ContentType;
|
|
32
|
+
pid: import('../utils/data').PromiseWithResolvers<string>;
|
|
33
|
+
preload: import('vue').ShallowRef<item.Item, item.Item>;
|
|
34
|
+
detail: import('../utils/data').PromiseWithResolvers<item.Item>;
|
|
35
|
+
union: import('vue').ComputedRef<item.Item>;
|
|
36
|
+
recommends: import('../utils/data').PromiseWithResolvers<item.Item[]>;
|
|
37
|
+
abstract comments: RStream<comment.Comment>;
|
|
38
|
+
eps: import('../utils/data').PromiseWithResolvers<ep.Ep[]>;
|
|
39
|
+
abstract loadAll(): Promise<any>;
|
|
40
|
+
abstract reloadAll(): Promise<any>;
|
|
41
|
+
abstract plugin: string;
|
|
42
|
+
abstract loadAllOffline(): Promise<T>;
|
|
43
|
+
abstract exportOffline(save: T): Promise<any>;
|
|
44
|
+
abstract ViewComp: ViewComp;
|
|
45
|
+
}
|
|
46
|
+
export type ViewComp = Component<{
|
|
47
|
+
page: ContentPage;
|
|
48
|
+
isFullScreen: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
export interface ContentType {
|
|
51
|
+
plugin: string;
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @example "bika:comic"
|
|
56
|
+
* "91video:video"
|
|
57
|
+
* "jm:comic"
|
|
58
|
+
*/
|
|
59
|
+
export type ContentType_ = ContentType | string;
|
|
60
|
+
export type ViewLayoutComp = Component<{
|
|
61
|
+
page: ContentPage;
|
|
62
|
+
}>;
|
|
63
|
+
export type ItemCardComp = Component<{
|
|
64
|
+
item: uni.item.Item;
|
|
65
|
+
freeHeight?: boolean;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
type?: 'default' | 'big' | 'small';
|
|
68
|
+
class?: any;
|
|
69
|
+
style?: StyleValue;
|
|
70
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Struct, MetaData } from '../utils/data';
|
|
2
|
+
export interface RawEp {
|
|
3
|
+
name: string;
|
|
4
|
+
index: string;
|
|
5
|
+
$$plugin: string;
|
|
6
|
+
$$meta?: MetaData;
|
|
7
|
+
}
|
|
8
|
+
export declare class Ep extends Struct<RawEp> implements RawEp {
|
|
9
|
+
name: string;
|
|
10
|
+
index: string;
|
|
11
|
+
$$plugin: string;
|
|
12
|
+
$$meta?: MetaData;
|
|
13
|
+
constructor(v: RawEp);
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Struct, MetaData } from '../utils/data';
|
|
2
|
+
export interface ProcessInstance {
|
|
3
|
+
fullName: string;
|
|
4
|
+
plugin: string;
|
|
5
|
+
referenceName: string;
|
|
6
|
+
func: (nowPath: string, img: Image) => Promise<[path: string, exit: string]>;
|
|
7
|
+
}
|
|
8
|
+
export interface ProcessStep {
|
|
9
|
+
referenceName: string;
|
|
10
|
+
ignoreExit?: boolean;
|
|
11
|
+
}
|
|
12
|
+
type ProcessStep_ = ProcessStep | string;
|
|
13
|
+
export interface RawImage {
|
|
14
|
+
$$plugin: string;
|
|
15
|
+
$$meta?: MetaData;
|
|
16
|
+
path: string;
|
|
17
|
+
forkNamespace: string;
|
|
18
|
+
processSteps?: ProcessStep_[];
|
|
19
|
+
}
|
|
20
|
+
export declare class Image extends Struct<RawImage> implements RawImage {
|
|
21
|
+
aspect?: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
static processInstances: import('vue').ShallowReactive<Map<string, ProcessInstance>>;
|
|
26
|
+
static setProcess(plugin: string, referenceName: string, func: ProcessInstance['func']): void;
|
|
27
|
+
static fork: import('vue').ShallowReactive<Map<string, string[]>>;
|
|
28
|
+
static activeFork: import('vue').ShallowReactive<Map<string, string>>;
|
|
29
|
+
static setFork(plugin: string, namespace: string, fork: string[]): void;
|
|
30
|
+
static is(value: unknown): value is Image;
|
|
31
|
+
static create(v: RawImage, aspect?: {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}): Image;
|
|
35
|
+
private constructor();
|
|
36
|
+
forkNamespace: string;
|
|
37
|
+
path: string;
|
|
38
|
+
processSteps: ProcessStep[];
|
|
39
|
+
$$meta?: MetaData;
|
|
40
|
+
$$plugin: string;
|
|
41
|
+
getUrl(): Promise<string>;
|
|
42
|
+
}
|
|
43
|
+
export type Image_ = string | Image;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _item from "./item";
|
|
2
|
+
import * as _image from "./image";
|
|
3
|
+
import * as _content from "./content";
|
|
4
|
+
import * as _ep from "./ep";
|
|
5
|
+
import * as _comment from "./comment";
|
|
6
|
+
import * as _user from "./user";
|
|
7
|
+
export declare namespace uni {
|
|
8
|
+
export import user = _user;
|
|
9
|
+
export import comment = _comment;
|
|
10
|
+
export import content = _content;
|
|
11
|
+
export import image = _image;
|
|
12
|
+
export import item = _item;
|
|
13
|
+
export import ep = _ep;
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Struct, MetaData } from '../utils/data';
|
|
2
|
+
import { default as dayjs } from 'dayjs';
|
|
3
|
+
import { ContentType, ContentType_ } from './content';
|
|
4
|
+
import { Ep, RawEp } from './ep';
|
|
5
|
+
import * as image from "./image";
|
|
6
|
+
export interface RawItem {
|
|
7
|
+
cover: image.RawImage;
|
|
8
|
+
title: string;
|
|
9
|
+
id: string;
|
|
10
|
+
categories: string[];
|
|
11
|
+
author: string[];
|
|
12
|
+
viewNumber?: number;
|
|
13
|
+
likeNumber?: number;
|
|
14
|
+
commentNumber?: number;
|
|
15
|
+
isLiked?: boolean;
|
|
16
|
+
updateTime?: number;
|
|
17
|
+
customIsAI?: boolean;
|
|
18
|
+
contentType: ContentType_;
|
|
19
|
+
length: string;
|
|
20
|
+
epLength: string;
|
|
21
|
+
$$plugin: string;
|
|
22
|
+
$$meta: MetaData;
|
|
23
|
+
description?: string;
|
|
24
|
+
thisEp: RawEp;
|
|
25
|
+
commentSendable: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare abstract class Item extends Struct<RawItem> implements RawItem {
|
|
28
|
+
abstract like(signal?: AbortSignal): PromiseLike<boolean>;
|
|
29
|
+
abstract report(signal?: AbortSignal): PromiseLike<any>;
|
|
30
|
+
abstract sendComment(text: string, signal?: AbortSignal): PromiseLike<any>;
|
|
31
|
+
static is(value: unknown): value is Item;
|
|
32
|
+
cover: image.RawImage;
|
|
33
|
+
get $cover(): image.Image;
|
|
34
|
+
title: string;
|
|
35
|
+
id: string;
|
|
36
|
+
categories: string[];
|
|
37
|
+
author: string[];
|
|
38
|
+
viewNumber?: number;
|
|
39
|
+
likeNumber?: number;
|
|
40
|
+
commentNumber?: number;
|
|
41
|
+
isLiked?: boolean;
|
|
42
|
+
description?: string;
|
|
43
|
+
updateTime?: number;
|
|
44
|
+
get $updateTime(): dayjs.Dayjs;
|
|
45
|
+
contentType: ContentType;
|
|
46
|
+
length: string;
|
|
47
|
+
epLength: string;
|
|
48
|
+
$$plugin: string;
|
|
49
|
+
$$meta: any;
|
|
50
|
+
thisEp: RawEp;
|
|
51
|
+
get $thisEp(): Ep;
|
|
52
|
+
constructor(v: RawItem);
|
|
53
|
+
commentSendable: boolean;
|
|
54
|
+
customIsAI?: boolean;
|
|
55
|
+
get $isAi(): boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { uni } from '.';
|
|
2
|
+
import { Image, RawImage } from './image';
|
|
3
|
+
import { Component } from 'vue';
|
|
4
|
+
export interface RawUser {
|
|
5
|
+
avatar?: RawImage;
|
|
6
|
+
name: string;
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class User {
|
|
10
|
+
static userBase: import('vue').ShallowReactive<Map<string, uni.user.User>>;
|
|
11
|
+
static userEditorBase: import('vue').ShallowReactive<Map<string, Component>>;
|
|
12
|
+
constructor(v: RawUser);
|
|
13
|
+
avatar?: Image;
|
|
14
|
+
name: string;
|
|
15
|
+
id: string;
|
|
16
|
+
abstract customUser: object;
|
|
17
|
+
}
|
|
18
|
+
export type UserCardComp = Component<{
|
|
19
|
+
user: uni.user.User;
|
|
20
|
+
isSmall?: boolean;
|
|
21
|
+
}>;
|
package/dist/symbol.d.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Raw, Ref } from 'vue';
|
|
2
|
+
export declare class Struct<TRaw extends object> {
|
|
3
|
+
protected $$raw: TRaw;
|
|
4
|
+
toJSON(): TRaw;
|
|
5
|
+
constructor($$raw: TRaw);
|
|
6
|
+
}
|
|
7
|
+
export type MetaData = Record<string | number, any>;
|
|
8
|
+
/**
|
|
9
|
+
* 扩展内容的`Promise`,可视为普通`Promise`使用
|
|
10
|
+
*/
|
|
11
|
+
export declare class PromiseContent<T, TPF extends any = T> implements PromiseLike<T> {
|
|
12
|
+
private promise;
|
|
13
|
+
private processor;
|
|
14
|
+
private static _this;
|
|
15
|
+
static isPromiseContent(value: unknown): value is PromiseContent<any>;
|
|
16
|
+
static fromPromise<T, TP = T>(promise: Promise<T>, processor?: (val: T) => TP): RPromiseContent<T, TP>;
|
|
17
|
+
/**
|
|
18
|
+
* 使用`PromiseContent.fromPromise`或`PromiseContent.fromAsyncFunction`代替`new PromiseContent`
|
|
19
|
+
*/
|
|
20
|
+
private constructor();
|
|
21
|
+
private loadPromise;
|
|
22
|
+
/**
|
|
23
|
+
* 对`this.data.value`做出处理,多次调用仅最后一次生效
|
|
24
|
+
*/
|
|
25
|
+
setProcessor<TP>(processor: (val: T) => TP): RPromiseContent<T, TP>;
|
|
26
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<T | TResult>;
|
|
27
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
28
|
+
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
|
|
29
|
+
data: import('vue').ShallowRef<TPF, TPF>;
|
|
30
|
+
isLoading: import('vue').ShallowRef<boolean, boolean>;
|
|
31
|
+
isError: import('vue').ShallowRef<boolean, boolean>;
|
|
32
|
+
errorCause: import('vue').ShallowRef<Error, Error>;
|
|
33
|
+
isEmpty: import('vue').ShallowRef<boolean, boolean>;
|
|
34
|
+
static fromAsyncFunction<T extends (...args: any[]) => Promise<any>>(asyncFunction: T): (...args: Parameters<T>) => RPromiseContent<Awaited<ReturnType<T>>>;
|
|
35
|
+
static resolve<T>(data: T): RPromiseContent<Awaited<T>, Awaited<T>>;
|
|
36
|
+
static withResolvers<T>(isLoading?: boolean): PromiseWithResolvers<T>;
|
|
37
|
+
}
|
|
38
|
+
export type PromiseWithResolvers<T> = {
|
|
39
|
+
content: RPromiseContent<T>;
|
|
40
|
+
reject: (reason?: any) => void;
|
|
41
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
42
|
+
reset: (isLoading?: boolean) => void;
|
|
43
|
+
};
|
|
44
|
+
export type RPromiseContent<T, PTF = T> = Raw<PromiseContent<T, PTF>>;
|
|
45
|
+
type RawGenerator<T> = (abortSignal: AbortSignal, that: Stream<T>) => (IterableIterator<T[], void, Stream<T>> | AsyncIterableIterator<T[], void, Stream<T>>);
|
|
46
|
+
/**
|
|
47
|
+
* _(网络)_ 数据流
|
|
48
|
+
*/
|
|
49
|
+
export type RStream<T> = Raw<Stream<T>>;
|
|
50
|
+
/**
|
|
51
|
+
* 可迭代 _(网络)_ 数据流
|
|
52
|
+
*/
|
|
53
|
+
export declare class Stream<T> implements AsyncIterableIterator<T[], void> {
|
|
54
|
+
/**
|
|
55
|
+
* 使用`Stream.create`代替`new Stream`
|
|
56
|
+
*/
|
|
57
|
+
private constructor();
|
|
58
|
+
private static _this;
|
|
59
|
+
static isStream(stream: any): stream is Stream<any>;
|
|
60
|
+
static create<T>(generator: RawGenerator<T>): RStream<T>;
|
|
61
|
+
[x: symbol]: any;
|
|
62
|
+
private abortController;
|
|
63
|
+
private generator;
|
|
64
|
+
private _setupData;
|
|
65
|
+
/** 初始存在的数据(置顶) */
|
|
66
|
+
setupData(data: T[]): this;
|
|
67
|
+
next(igRequesting?: boolean): Promise<IteratorResult<T[], void>>;
|
|
68
|
+
return(): Promise<IteratorResult<T[], void>>;
|
|
69
|
+
throw(e?: any): Promise<IteratorResult<T[], void>>;
|
|
70
|
+
/** 重置 */
|
|
71
|
+
reset(): void;
|
|
72
|
+
/** 重试 */
|
|
73
|
+
retry(): Promise<IteratorResult<T[], void>>;
|
|
74
|
+
/** 一次性全部加载 */
|
|
75
|
+
nextToDone(): Promise<T[]>;
|
|
76
|
+
/** 停止正在进行的请求 */
|
|
77
|
+
stop(): void;
|
|
78
|
+
[Symbol.asyncIterator](): this;
|
|
79
|
+
/** 错误(如果有) */
|
|
80
|
+
error: import('vue').ShallowRef<void | Error, void | Error>;
|
|
81
|
+
/** 数据 */
|
|
82
|
+
data: Ref<T[]>;
|
|
83
|
+
/** 数据 */
|
|
84
|
+
get _data(): T[];
|
|
85
|
+
/** 当前页 */
|
|
86
|
+
page: import('vue').ShallowRef<number, number>;
|
|
87
|
+
/** 当前页 */
|
|
88
|
+
get _page(): number;
|
|
89
|
+
/** 总页数 */
|
|
90
|
+
pages: import('vue').ShallowRef<number, number>;
|
|
91
|
+
/** 总页数 */
|
|
92
|
+
get _pages(): number;
|
|
93
|
+
/** 总条目数 */
|
|
94
|
+
total: import('vue').ShallowRef<number, number>;
|
|
95
|
+
/** 总条目数 */
|
|
96
|
+
get _total(): number;
|
|
97
|
+
/** 单页条目数 */
|
|
98
|
+
pageSize: import('vue').ShallowRef<number, number>;
|
|
99
|
+
/** 单页条目数 */
|
|
100
|
+
get _pageSize(): number;
|
|
101
|
+
/** 数据当前总数 */
|
|
102
|
+
length: import('vue').ComputedRef<number>;
|
|
103
|
+
/** 数据当前总数 */
|
|
104
|
+
get _length(): number;
|
|
105
|
+
/** 是否正在网络请求 */
|
|
106
|
+
isRequesting: import('vue').ShallowRef<boolean, boolean>;
|
|
107
|
+
/** 是否正在网络请求 */
|
|
108
|
+
get _isRequesting(): boolean;
|
|
109
|
+
/** 是否全部获取完成 */
|
|
110
|
+
isDone: import('vue').ShallowRef<boolean, boolean>;
|
|
111
|
+
/** 是否全部获取完成 */
|
|
112
|
+
get _isDone(): boolean;
|
|
113
|
+
/** 是否无结果 */
|
|
114
|
+
isNoData: import('vue').ComputedRef<boolean>;
|
|
115
|
+
/** 是否无结果 */
|
|
116
|
+
get _isNoData(): boolean;
|
|
117
|
+
/** 是否当前为空 */
|
|
118
|
+
isEmpty: import('vue').ComputedRef<boolean>;
|
|
119
|
+
/** 是否当前为空 */
|
|
120
|
+
get _isEmpty(): boolean;
|
|
121
|
+
}
|
|
122
|
+
export declare const callbackToPromise: <T = void>(fn: (resolve: (result: T | PromiseLike<T>) => void) => any) => Promise<T>;
|
|
123
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const delay: (time: number) => Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PluginConfig } from '../plugin';
|
|
2
|
+
import { uni } from '../struct';
|
|
3
|
+
export type EventBus = {
|
|
4
|
+
networkError_unauth: any;
|
|
5
|
+
networkError_response: any;
|
|
6
|
+
networkError_emptyData: any;
|
|
7
|
+
networkError_request: any;
|
|
8
|
+
};
|
|
9
|
+
export declare const eventBus: import('mitt').Emitter<EventBus>;
|
|
10
|
+
export type SharedFunctions = {
|
|
11
|
+
/** 重复调用需缓存(自行实现)(可不缓存) */ getUser(): PromiseLike<object>;
|
|
12
|
+
getRandomProvide(signal: AbortSignal): PromiseLike<uni.item.Item[]>;
|
|
13
|
+
addPlugin(ins: PluginConfig): void;
|
|
14
|
+
addRecent(item: uni.item.Item | uni.item.RawItem): PromiseLike<any>;
|
|
15
|
+
};
|
|
16
|
+
export declare class SharedFunction {
|
|
17
|
+
private static sharedFunctions;
|
|
18
|
+
static define<TKey extends keyof SharedFunctions>(fn: SharedFunctions[TKey], plugin: string, name: TKey): SharedFunctions[TKey];
|
|
19
|
+
static call<TKey extends keyof SharedFunctions>(name: TKey, ...args: Parameters<SharedFunctions[TKey]>): {
|
|
20
|
+
fn: SharedFunctions[keyof SharedFunctions];
|
|
21
|
+
plugin: string;
|
|
22
|
+
result: ReturnType<SharedFunctions[TKey]>;
|
|
23
|
+
}[];
|
|
24
|
+
static callRandom<TKey extends keyof SharedFunctions>(name: TKey, ...args: Parameters<SharedFunctions[TKey]>): {
|
|
25
|
+
fn: SharedFunctions[keyof SharedFunctions];
|
|
26
|
+
plugin: string;
|
|
27
|
+
result: ReturnType<SharedFunctions[TKey]>;
|
|
28
|
+
};
|
|
29
|
+
static callWitch<TKey extends keyof SharedFunctions>(name: TKey, plugin: string, ...args: Parameters<SharedFunctions[TKey]>): {
|
|
30
|
+
fn: SharedFunctions[keyof SharedFunctions];
|
|
31
|
+
plugin: string;
|
|
32
|
+
result: ReturnType<SharedFunctions[TKey]>;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* 对于所有弹出层,使用其确定`z-index`
|
|
5
|
+
* 在组件内使用时,卸载组件 _`(onUnmounted)`_ 会自动清理,否则需要主动调用`return[2]`清理
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare const useZIndex: (show: MaybeRefOrGetter<boolean>) => [index: ComputedRef<number>, isLast: ComputedRef<boolean>, stopUse: () => void];
|