delta-comic-core 0.1.3 → 0.2.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.
@@ -169,7 +169,7 @@ export interface PluginConfigImage {
169
169
  * value: process function
170
170
  * 与`Image.setProcess(name, key, value)`等价
171
171
  */
172
- process?: Record<string, ProcessInstance['func']>;
172
+ process?: Record<string, ProcessInstance>;
173
173
  }
174
174
  export type PluginConfigContent = Record<string, {
175
175
  /**
@@ -1,4 +1,4 @@
1
- import { Struct, MetaData, RStream } from '../utils/data';
1
+ import { SourcedKeyMap, Struct, MetaData, RStream } from '../utils/data';
2
2
  import { Component } from 'vue';
3
3
  import { uni } from '.';
4
4
  import { default as dayjs } from 'dayjs';
@@ -25,9 +25,7 @@ export type CommentRow = Component<{
25
25
  parentComment?: Comment;
26
26
  }>;
27
27
  export declare abstract class Comment extends Struct<RawComment> implements RawComment {
28
- private static commentRow;
29
- static setCommentRow(ct_: uni.content.ContentType_, component: CommentRow): string;
30
- static getCommentRow(ct_: uni.content.ContentType_): uni.comment.CommentRow | undefined;
28
+ static commentRow: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], uni.comment.CommentRow>>;
31
29
  constructor(v: RawComment);
32
30
  abstract sender: User;
33
31
  content: {
@@ -1,5 +1,5 @@
1
1
  import { Component, StyleValue } from 'vue';
2
- import { RStream } from '../utils/data';
2
+ import { SourcedKeyMap, RStream, SourcedKeyType } from '../utils/data';
3
3
  import { uni } from '.';
4
4
  import { AudioSrc, MediaSrc, TextTrackInit } from 'vidstack';
5
5
  import { PluginConfigSearchCategory, PluginConfigSearchHotPageLevelboard, PluginConfigSearchHotPageMainList, PluginConfigSearchHotPageTopButton, PluginConfigSearchTabbar } from '../plugin/define';
@@ -11,32 +11,19 @@ export type ContentPageLike = new (preload: PreloadValue, id: string, ep: string
11
11
  export declare abstract class ContentPage<T extends object = any> {
12
12
  id: string;
13
13
  ep: string;
14
- private static viewLayout;
15
- static setViewLayout(ct_: ContentType_, component: ViewLayoutComp): string;
16
- static getViewLayout(ct_: ContentType_): uni.content.ViewLayoutComp | undefined;
14
+ static viewLayout: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], uni.content.ViewLayoutComp>>;
17
15
  static tabbar: import('vue').ShallowReactive<Map<string, PluginConfigSearchTabbar[]>>;
18
- static setTabbar(plugin: string, ...tabbar: PluginConfigSearchTabbar[]): void;
19
- static getTabbar(plugin: string): PluginConfigSearchTabbar[];
16
+ static addTabbar(plugin: string, ...tabbar: PluginConfigSearchTabbar[]): void;
20
17
  static categories: import('vue').ShallowReactive<Map<string, PluginConfigSearchCategory[]>>;
21
- static setCategories(plugin: string, ...categories: PluginConfigSearchCategory[]): void;
22
- static getCategories(plugin: string): PluginConfigSearchCategory[];
23
- private static itemCard;
24
- static setItemCard(ct_: ContentType_, component: ItemCardComp): string;
25
- static getItemCard(ct_: ContentType_): uni.content.ItemCardComp | undefined;
26
- private static contentPage;
27
- static setContentPage(contentType: ContentType_, page: ContentPageLike): void;
28
- static getContentPage(contentType: ContentType_): uni.content.ContentPageLike;
29
- static toContentType(ct: ContentType_): ContentType;
30
- static toContentTypeString(ct: ContentType_): string;
18
+ static addCategories(plugin: string, ...categories: PluginConfigSearchCategory[]): void;
19
+ static itemCard: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], uni.content.ItemCardComp>>;
20
+ static contentPage: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], uni.content.ContentPageLike>>;
31
21
  static levelboard: import('vue').ShallowReactive<Map<string, PluginConfigSearchHotPageLevelboard[]>>;
32
- static setLevelboard(plugin: string, cfg: PluginConfigSearchHotPageLevelboard): string;
33
- static getLevelboard(plugin: string): PluginConfigSearchHotPageLevelboard[] | undefined;
22
+ static addLevelboard(plugin: string, cfg: PluginConfigSearchHotPageLevelboard): string;
34
23
  static topButton: import('vue').ShallowReactive<Map<string, PluginConfigSearchHotPageTopButton[]>>;
35
- static setTopButton(plugin: string, cfg: PluginConfigSearchHotPageTopButton): string;
36
- static getTopButton(plugin: string): PluginConfigSearchHotPageTopButton[] | undefined;
24
+ static addTopButton(plugin: string, cfg: PluginConfigSearchHotPageTopButton): string;
37
25
  static mainLists: import('vue').ShallowReactive<Map<string, PluginConfigSearchHotPageMainList[]>>;
38
- static setMainList(plugin: string, cfg: PluginConfigSearchHotPageMainList): string;
39
- static getMainList(plugin: string): PluginConfigSearchHotPageMainList[] | undefined;
26
+ static addMainList(plugin: string, cfg: PluginConfigSearchHotPageMainList): string;
40
27
  constructor(preload: PreloadValue, id: string, ep: string);
41
28
  abstract contentType: ContentType;
42
29
  pid: import('../utils/data').PromiseWithResolvers<string>;
@@ -53,20 +40,12 @@ export declare abstract class ContentPage<T extends object = any> {
53
40
  abstract exportOffline(): Promise<T>;
54
41
  abstract ViewComp: ViewComp;
55
42
  }
43
+ export type ContentType_ = SourcedKeyType<typeof ContentPage.contentPage>;
44
+ export type ContentType = Exclude<ContentType_, string>;
56
45
  export type ViewComp = Component<{
57
46
  page: ContentPage;
58
47
  isFullScreen: boolean;
59
48
  }>;
60
- export interface ContentType {
61
- plugin: string;
62
- name: string;
63
- }
64
- /**
65
- * @example "bika:comic"
66
- * "91video:video"
67
- * "jm:comic"
68
- */
69
- export type ContentType_ = ContentType | string;
70
49
  export type ViewLayoutComp = Component<{
71
50
  page: ContentPage;
72
51
  }>;
@@ -1,10 +1,5 @@
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: boolean]>;
7
- }
1
+ import { SourcedKeyMap, Struct, MetaData } from '../utils/data';
2
+ export type ProcessInstance = (nowPath: string, img: Image) => Promise<[path: string, exit: boolean]>;
8
3
  export interface ProcessStep {
9
4
  referenceName: string;
10
5
  ignoreExit?: boolean;
@@ -22,11 +17,9 @@ export declare class Image extends Struct<RawImage> implements RawImage {
22
17
  width: number;
23
18
  height: number;
24
19
  } | undefined;
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;
20
+ static processInstances: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, referenceName: string], ProcessInstance>>;
21
+ static fork: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, namespace: string], string[]>>;
22
+ static activeFork: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, namespace: string], string>>;
30
23
  static is(value: unknown): value is Image;
31
24
  static create(v: RawImage, aspect?: {
32
25
  width: number;
@@ -1,4 +1,4 @@
1
- import { Struct, MetaData } from '../utils/data';
1
+ import { SourcedKeyMap, Struct, MetaData } from '../utils/data';
2
2
  import { default as dayjs } from 'dayjs';
3
3
  import { ContentType, ContentType_ } from './content';
4
4
  import { Ep, RawEp } from './ep';
@@ -57,11 +57,9 @@ export type Description = string | {
57
57
  content: string;
58
58
  };
59
59
  export declare abstract class Item extends Struct<RawItem> implements RawItem {
60
- static itemTranslator: import('vue').ShallowReactive<Map<string, PluginConfigContentItemTranslator>>;
60
+ static itemTranslator: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], PluginConfigContentItemTranslator>>;
61
61
  static create(raw: RawItem): Item;
62
- static authorIcon: import('vue').ShallowReactive<Map<string, Component>>;
63
- static getAuthorIcon(plugin: string, name: string): Component | undefined;
64
- static setAuthorIcon(plugin: string, name: string, icon: Component): void;
62
+ static authorIcon: import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, name: string], Component>>;
65
63
  abstract like(signal?: AbortSignal): PromiseLike<boolean>;
66
64
  abstract report(signal?: AbortSignal): PromiseLike<any>;
67
65
  abstract sendComment(text: string, signal?: AbortSignal): PromiseLike<any>;
@@ -2,6 +2,7 @@ import { AuthorAction, PluginConfigSubscribe } from '../plugin/define';
2
2
  import { uni } from '.';
3
3
  import { Image, RawImage } from './image';
4
4
  import { Component } from 'vue';
5
+ import { SourcedKeyMap } from '../utils/data';
5
6
  export interface RawUser {
6
7
  avatar?: RawImage;
7
8
  name: string;
@@ -11,12 +12,8 @@ export interface RawUser {
11
12
  export declare abstract class User {
12
13
  static userBase: import('vue').ShallowReactive<Map<string, uni.user.User>>;
13
14
  static userEditorBase: import('vue').ShallowReactive<Map<string, Component>>;
14
- static subscribes: import('vue').ShallowReactive<Map<string, PluginConfigSubscribe>>;
15
- static setSubscribes(plugin: string, type: string, config: PluginConfigSubscribe): void;
16
- static getSubscribes(plugin: string, type: string): PluginConfigSubscribe | undefined;
17
- static authorActions: import('vue').ShallowReactive<Map<string, AuthorAction>>;
18
- static setAuthorActions(plugin: string, type: string, config: AuthorAction): void;
19
- static getAuthorActions(plugin: string, type: string): AuthorAction | undefined;
15
+ static subscribes: import('vue').ShallowReactive<import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, type: string], PluginConfigSubscribe>>>;
16
+ static authorActions: import('vue').ShallowReactive<import('vue').ShallowReactive<SourcedKeyMap<[plugin: string, type: string], AuthorAction>>>;
20
17
  constructor(v: RawUser);
21
18
  avatar?: Image;
22
19
  name: string;
@@ -19,11 +19,14 @@ export declare class SourcedValue<T extends [string, string]> {
19
19
  stringify(value: T): string;
20
20
  constructor(separator?: string);
21
21
  }
22
+ export type SourcedKeyType<T extends SourcedKeyMap<any, any> | SourcedValue<any>> = T extends SourcedKeyMap<any, any> ? Parameters<T['get']>[0] : Parameters<T['toJSON']>[0];
22
23
  /**
23
24
  * 相比较于普通的Map,这个元素的key操作可以是`TKey | string`
24
25
  * _但内部保存仍使用`SourcedValue.toString`作为key_
25
26
  */
26
27
  export declare class SourcedKeyMap<TKey extends [string, string], TValue> extends SourcedValue<TKey> implements Map<string, TValue> {
28
+ static create<TKey extends [string, string], TValue>(separator?: string): import('vue').ShallowReactive<SourcedKeyMap<TKey, TValue>>;
29
+ private constructor();
27
30
  private store;
28
31
  get size(): number;
29
32
  [Symbol.toStringTag]: string;
package/dist/pack.tgz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delta-comic-core",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "我曾亲眼见证神的熟视无睹.",
5
5
  "homepage": "https://github.com/wenxig/delta-comic-core",
6
6
  "repository": {
File without changes