@delta-comic/model 3.0.0-next.4 → 3.0.0-next.6
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/dist/index.d.mts +147 -158
- package/dist/index.mjs +20 -41
- package/package.json +2 -2
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
package/dist/index.d.mts
CHANGED
|
@@ -151,38 +151,37 @@ type FormSingleConfigure = FormString | FormNumber | FormRadio | FormCheckbox |
|
|
|
151
151
|
type FormSingleResult<T extends FormSingleConfigure> = FormDefaultValue[T['type']];
|
|
152
152
|
type FormConfigure = { [x in string]: FormSingleConfigure };
|
|
153
153
|
type FormResult<T extends FormConfigure> = { [K in keyof T]: FormSingleResult<T[K]> };
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
algorithm: DownloadChecksumAlgorithm;
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region lib/model/download.d.ts
|
|
156
|
+
type UniDownloadChecksumAlgorithm = 'sha256' | 'md5';
|
|
157
|
+
interface UniDownloadChecksum {
|
|
158
|
+
algorithm: UniDownloadChecksumAlgorithm;
|
|
160
159
|
value: string;
|
|
161
160
|
}
|
|
162
161
|
/** A JSON-safe HTTP header value. Sensitive values should be passed by reference. */
|
|
163
|
-
type
|
|
162
|
+
type UniDownloadHttpHeaderValue = {
|
|
164
163
|
type: 'value';
|
|
165
164
|
value: string;
|
|
166
165
|
} | {
|
|
167
166
|
type: 'secretRef';
|
|
168
167
|
secretRef: string;
|
|
169
168
|
};
|
|
170
|
-
interface
|
|
169
|
+
interface UniDownloadHttpMirror {
|
|
171
170
|
url: string;
|
|
172
171
|
/** Larger values are tried first. Mirrors with the same priority keep their declared order. */
|
|
173
172
|
priority?: number;
|
|
174
|
-
headers?: Record<string,
|
|
173
|
+
headers?: Record<string, UniDownloadHttpHeaderValue>;
|
|
175
174
|
}
|
|
176
|
-
interface
|
|
175
|
+
interface UniDownloadHttpSource {
|
|
177
176
|
type: 'http';
|
|
178
|
-
mirrors:
|
|
177
|
+
mirrors: UniDownloadHttpMirror[];
|
|
179
178
|
etag?: string;
|
|
180
179
|
lastModified?: string;
|
|
181
180
|
expectedSize?: number;
|
|
182
181
|
/** Unix timestamp in milliseconds after which the source should be refreshed. */
|
|
183
182
|
expiresAt?: number;
|
|
184
183
|
}
|
|
185
|
-
type
|
|
184
|
+
type UniDownloadTorrentInput = {
|
|
186
185
|
type: 'magnet';
|
|
187
186
|
uri: string;
|
|
188
187
|
} | {
|
|
@@ -192,7 +191,7 @@ type TorrentInput = {
|
|
|
192
191
|
type: 'bytes';
|
|
193
192
|
base64: string;
|
|
194
193
|
};
|
|
195
|
-
type
|
|
194
|
+
type UniDownloadTorrentSeedPolicy = {
|
|
196
195
|
mode: 'none';
|
|
197
196
|
} | {
|
|
198
197
|
mode: 'ratio';
|
|
@@ -205,32 +204,32 @@ type TorrentSeedPolicy = {
|
|
|
205
204
|
ratio: number;
|
|
206
205
|
durationSeconds: number;
|
|
207
206
|
};
|
|
208
|
-
interface
|
|
207
|
+
interface UniDownloadTorrentSource {
|
|
209
208
|
type: 'torrent';
|
|
210
|
-
input:
|
|
209
|
+
input: UniDownloadTorrentInput;
|
|
211
210
|
/** Zero-based file indexes in torrent metadata. Omit to download every file. */
|
|
212
211
|
onlyFiles?: number[];
|
|
213
|
-
seedPolicy?:
|
|
212
|
+
seedPolicy?: UniDownloadTorrentSeedPolicy;
|
|
214
213
|
}
|
|
215
|
-
type
|
|
214
|
+
type UniDownloadSource = UniDownloadHttpSource | UniDownloadTorrentSource;
|
|
216
215
|
/** A JSON-serializable file entry produced by a content plugin. */
|
|
217
|
-
interface
|
|
216
|
+
interface UniDownloadAsset {
|
|
218
217
|
/** Stable within the containing plan and across retries. */
|
|
219
218
|
key: string;
|
|
220
219
|
/** Relative to the destination selected by the host application. */
|
|
221
220
|
relativePath: string;
|
|
222
221
|
size?: number;
|
|
223
|
-
checksum?:
|
|
224
|
-
source:
|
|
222
|
+
checksum?: UniDownloadChecksum;
|
|
223
|
+
source: UniDownloadSource;
|
|
225
224
|
}
|
|
226
225
|
/** A JSON-serializable group of files that should be enqueued together. */
|
|
227
|
-
interface
|
|
226
|
+
interface UniDownloadPlan {
|
|
228
227
|
/** Stable for the content represented by this plan. */
|
|
229
228
|
key: string;
|
|
230
229
|
title: string;
|
|
231
|
-
assets:
|
|
230
|
+
assets: UniDownloadAsset[];
|
|
232
231
|
}
|
|
233
|
-
type
|
|
232
|
+
type UniContentDownloadSelection = {
|
|
234
233
|
type: 'currentEpisode';
|
|
235
234
|
} | {
|
|
236
235
|
type: 'episodes';
|
|
@@ -238,17 +237,17 @@ type ContentDownloadSelection = {
|
|
|
238
237
|
} | {
|
|
239
238
|
type: 'allEpisodes';
|
|
240
239
|
};
|
|
241
|
-
interface
|
|
242
|
-
page:
|
|
243
|
-
selection:
|
|
240
|
+
interface UniDownloadResolveInput {
|
|
241
|
+
page: UniContentPage;
|
|
242
|
+
selection: UniContentDownloadSelection;
|
|
244
243
|
}
|
|
245
|
-
type
|
|
246
|
-
interface
|
|
247
|
-
page:
|
|
244
|
+
type UniDownloadRefreshSourceReason = 'expired' | 'unauthorized' | 'forbidden';
|
|
245
|
+
interface UniDownloadRefreshSourceInput {
|
|
246
|
+
page: UniContentPage;
|
|
248
247
|
planKey: string;
|
|
249
248
|
assetKey: string;
|
|
250
|
-
source:
|
|
251
|
-
reason:
|
|
249
|
+
source: UniDownloadSource;
|
|
250
|
+
reason: UniDownloadRefreshSourceReason;
|
|
252
251
|
}
|
|
253
252
|
/**
|
|
254
253
|
* Resolves plugin-specific content into a portable download plan.
|
|
@@ -256,18 +255,18 @@ interface RefreshSourceInput {
|
|
|
256
255
|
* Providers are runtime objects and are not serialized. Their returned plans and sources must be
|
|
257
256
|
* JSON-serializable so the native downloader can persist and resume them without a live WebView.
|
|
258
257
|
*/
|
|
259
|
-
interface
|
|
260
|
-
resolve(input:
|
|
261
|
-
refreshSource?(input:
|
|
258
|
+
interface UniContentDownloadProvider {
|
|
259
|
+
resolve(input: UniDownloadResolveInput, signal: AbortSignal): Promise<UniDownloadPlan>;
|
|
260
|
+
refreshSource?(input: UniDownloadRefreshSourceInput, signal: AbortSignal): Promise<UniDownloadSource>;
|
|
262
261
|
}
|
|
263
262
|
/**
|
|
264
263
|
* Legacy imperative download controller.
|
|
265
264
|
*
|
|
266
|
-
* @deprecated Register a {@link
|
|
265
|
+
* @deprecated Register a {@link UniContentDownloadProvider} for the content type and let the native
|
|
267
266
|
* downloader own task state, persistence, and lifecycle controls. This class remains unchanged so
|
|
268
267
|
* existing plugins can migrate without an immediate breaking change.
|
|
269
268
|
*/
|
|
270
|
-
declare abstract class
|
|
269
|
+
declare abstract class UniDownloader implements Metadatable {
|
|
271
270
|
abstract id: string;
|
|
272
271
|
abstract name: string;
|
|
273
272
|
abstract $$plugin: string;
|
|
@@ -276,85 +275,82 @@ declare abstract class Downloader implements Metadatable {
|
|
|
276
275
|
abstract resume: () => void;
|
|
277
276
|
abstract pause: () => void;
|
|
278
277
|
}
|
|
279
|
-
/** @deprecated Use {@link
|
|
280
|
-
type
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
interface RawEp extends Metadatable {
|
|
278
|
+
/** @deprecated Use {@link UniContentDownloadProvider}. */
|
|
279
|
+
type UniLegacyDownloader = UniDownloader;
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region lib/model/ep.d.ts
|
|
282
|
+
interface UniEpRaw extends Metadatable {
|
|
285
283
|
name: string;
|
|
286
284
|
id: string;
|
|
287
285
|
}
|
|
288
|
-
declare class
|
|
286
|
+
declare class UniEp extends Struct<UniEpRaw> implements UniEpRaw {
|
|
289
287
|
name: string;
|
|
290
288
|
id: string;
|
|
291
289
|
$$plugin: string;
|
|
292
290
|
$$meta?: Metadata;
|
|
293
|
-
constructor(v:
|
|
294
|
-
}
|
|
295
|
-
declare namespace content_d_exports {
|
|
296
|
-
export { ContentPage, ContentPageLike, ContentType, ContentType_, LayoutComponent, ViewComponent };
|
|
291
|
+
constructor(v: UniEpRaw);
|
|
297
292
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
type
|
|
301
|
-
type
|
|
302
|
-
|
|
303
|
-
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region lib/model/content.d.ts
|
|
295
|
+
type UniContentPageLike = new (preload: UniItem | undefined, id: string, ep: string) => UniContentPage;
|
|
296
|
+
type UniContentType_ = SourcedKeyType<typeof UniContentPage.contentPages>;
|
|
297
|
+
type UniContentType = Exclude<UniContentType_, string>;
|
|
298
|
+
type UniContentViewComponent = Component<{
|
|
299
|
+
page: UniContentPage;
|
|
300
|
+
union?: UniItem;
|
|
304
301
|
}>;
|
|
305
|
-
type
|
|
306
|
-
page:
|
|
302
|
+
type UniContentLayoutComponent = Component<{
|
|
303
|
+
page: UniContentPage;
|
|
307
304
|
}, any, any, any, any, any, {
|
|
308
305
|
view(args: {
|
|
309
|
-
item?:
|
|
306
|
+
item?: UniItem;
|
|
310
307
|
}): any;
|
|
311
308
|
}>;
|
|
312
|
-
declare abstract class
|
|
313
|
-
preload:
|
|
309
|
+
declare abstract class UniContentPage {
|
|
310
|
+
preload: UniItem | undefined;
|
|
314
311
|
id: string;
|
|
315
312
|
ep: string;
|
|
316
|
-
static layouts: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string],
|
|
317
|
-
static contentPages: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string],
|
|
318
|
-
static downloadProviders: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string],
|
|
319
|
-
constructor(preload:
|
|
313
|
+
static layouts: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string], UniContentLayoutComponent>>;
|
|
314
|
+
static contentPages: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string], UniContentPageLike>>;
|
|
315
|
+
static downloadProviders: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string], UniContentDownloadProvider>>;
|
|
316
|
+
constructor(preload: UniItem | undefined, id: string, ep: string);
|
|
320
317
|
abstract plugin: string;
|
|
321
|
-
abstract contentType:
|
|
318
|
+
abstract contentType: UniContentType;
|
|
322
319
|
abstract fetchShortId(signal?: AbortSignal): Promise<string>;
|
|
323
|
-
abstract fetchDetail(signal?: AbortSignal): Promise<
|
|
324
|
-
abstract fetchRecommends: StreamQuery<
|
|
325
|
-
abstract fetchComments: StreamQuery<
|
|
326
|
-
abstract fetchEps: StreamQuery<
|
|
327
|
-
abstract ViewComponent:
|
|
328
|
-
}
|
|
329
|
-
declare namespace resource_d_exports {
|
|
330
|
-
export { ProcessInstance, ProcessStep, ProcessStep_, RawResource, Resource, ResourceType };
|
|
320
|
+
abstract fetchDetail(signal?: AbortSignal): Promise<UniItem>;
|
|
321
|
+
abstract fetchRecommends: StreamQuery<UniItem>;
|
|
322
|
+
abstract fetchComments: StreamQuery<UniComment>;
|
|
323
|
+
abstract fetchEps: StreamQuery<UniEp>;
|
|
324
|
+
abstract ViewComponent: UniContentViewComponent;
|
|
331
325
|
}
|
|
332
|
-
|
|
333
|
-
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region lib/model/resource.d.ts
|
|
328
|
+
type UniResourceProcessInstance = (nowPath: string, resource: UniResource) => Promise<[path: string, exit: boolean]>;
|
|
329
|
+
interface UniResourceProcessStep {
|
|
334
330
|
referenceName: string;
|
|
335
331
|
ignoreExit?: boolean;
|
|
336
332
|
}
|
|
337
|
-
type
|
|
338
|
-
interface
|
|
333
|
+
type UniResourceProcessStep_ = UniResourceProcessStep | string;
|
|
334
|
+
interface UniResourceType {
|
|
339
335
|
type: string;
|
|
340
336
|
urls: string[];
|
|
341
337
|
test: (url: string, signal: AbortSignal) => PromiseLike<void>;
|
|
342
338
|
}
|
|
343
|
-
interface
|
|
339
|
+
interface UniResourceRaw extends Metadatable {
|
|
344
340
|
pathname: string;
|
|
345
341
|
type: string;
|
|
346
|
-
processSteps?:
|
|
342
|
+
processSteps?: UniResourceProcessStep_[];
|
|
347
343
|
}
|
|
348
|
-
declare class
|
|
349
|
-
static processInstances: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, referenceName: string],
|
|
350
|
-
static fork: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, type: string],
|
|
344
|
+
declare class UniResource extends Struct<UniResourceRaw> implements UniResourceRaw {
|
|
345
|
+
static processInstances: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, referenceName: string], UniResourceProcessInstance>>;
|
|
346
|
+
static fork: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, type: string], UniResourceType>>;
|
|
351
347
|
static precedenceFork: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, type: string], string>>;
|
|
352
|
-
static is(value: unknown): value is
|
|
353
|
-
static create(v:
|
|
354
|
-
protected constructor(v:
|
|
348
|
+
static is(value: unknown): value is UniResource;
|
|
349
|
+
static create(v: UniResourceRaw): UniResource;
|
|
350
|
+
protected constructor(v: UniResourceRaw);
|
|
355
351
|
type: string;
|
|
356
352
|
pathname: string;
|
|
357
|
-
processSteps:
|
|
353
|
+
processSteps: UniResourceProcessStep[];
|
|
358
354
|
$$meta?: Metadata;
|
|
359
355
|
$$plugin: string;
|
|
360
356
|
getUrl(): Promise<string>;
|
|
@@ -362,30 +358,28 @@ declare class Resource extends Struct<RawResource> implements RawResource {
|
|
|
362
358
|
getThisFork(): string;
|
|
363
359
|
localChangeFork(): boolean;
|
|
364
360
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
interface RawImage extends Metadatable {
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region lib/model/image.d.ts
|
|
363
|
+
interface UniImageRaw extends Metadatable {
|
|
369
364
|
path: string;
|
|
370
365
|
forkNamespace: string;
|
|
371
|
-
processSteps?:
|
|
366
|
+
processSteps?: UniResourceProcessStep_[];
|
|
372
367
|
}
|
|
373
|
-
declare class
|
|
374
|
-
static is(value: unknown): value is
|
|
375
|
-
static create(v:
|
|
376
|
-
protected constructor(v:
|
|
377
|
-
get aspect(): Partial<
|
|
378
|
-
set aspect(v: Partial<
|
|
368
|
+
declare class UniImage extends UniResource {
|
|
369
|
+
static is(value: unknown): value is UniImage;
|
|
370
|
+
static create(v: UniResourceRaw | UniImageRaw, aspect?: UniImageAspect): UniImage;
|
|
371
|
+
protected constructor(v: UniResourceRaw | UniImageRaw, aspect?: UniImageAspect);
|
|
372
|
+
get aspect(): Partial<UniImageAspect> | undefined;
|
|
373
|
+
set aspect(v: Partial<UniImageAspect> | undefined);
|
|
379
374
|
}
|
|
380
|
-
interface
|
|
375
|
+
interface UniImageAspect {
|
|
381
376
|
width: number;
|
|
382
377
|
height: number;
|
|
383
378
|
}
|
|
384
|
-
type
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
interface Category extends Metadatable {
|
|
379
|
+
type UniImage_ = string | UniImage;
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region lib/model/item.d.ts
|
|
382
|
+
interface UniItemCategory extends Metadatable {
|
|
389
383
|
name: string;
|
|
390
384
|
group: string;
|
|
391
385
|
search: {
|
|
@@ -394,9 +388,9 @@ interface Category extends Metadatable {
|
|
|
394
388
|
sort: string;
|
|
395
389
|
};
|
|
396
390
|
}
|
|
397
|
-
interface
|
|
391
|
+
interface UniItemAuthor extends Metadatable {
|
|
398
392
|
label: string;
|
|
399
|
-
icon:
|
|
393
|
+
icon: UniResourceRaw | UniImageRaw | string;
|
|
400
394
|
description: string;
|
|
401
395
|
/**
|
|
402
396
|
* 为空则不可订阅
|
|
@@ -405,29 +399,29 @@ interface Author extends Metadatable {
|
|
|
405
399
|
subscribe?: string;
|
|
406
400
|
actions?: string[];
|
|
407
401
|
}
|
|
408
|
-
interface
|
|
409
|
-
cover:
|
|
402
|
+
interface UniItemRaw extends Metadatable {
|
|
403
|
+
cover: UniResourceRaw | UniImageRaw;
|
|
410
404
|
title: string;
|
|
411
405
|
id: string;
|
|
412
406
|
/** @alias tags */
|
|
413
|
-
categories:
|
|
414
|
-
author:
|
|
407
|
+
categories: UniItemCategory[];
|
|
408
|
+
author: UniItemAuthor[];
|
|
415
409
|
viewNumber?: number;
|
|
416
410
|
likeNumber?: number;
|
|
417
411
|
commentNumber?: number;
|
|
418
412
|
isLiked?: boolean;
|
|
419
413
|
updateTime?: number;
|
|
420
414
|
customIsAI?: boolean;
|
|
421
|
-
contentType:
|
|
415
|
+
contentType: UniContentType_;
|
|
422
416
|
length: string;
|
|
423
417
|
epLength: string;
|
|
424
|
-
description?:
|
|
425
|
-
thisEp:
|
|
418
|
+
description?: UniItemDescription;
|
|
419
|
+
thisEp: UniEpRaw;
|
|
426
420
|
commentSendable: boolean;
|
|
427
421
|
customIsSafe?: boolean;
|
|
428
422
|
}
|
|
429
|
-
type
|
|
430
|
-
item:
|
|
423
|
+
type UniItemCardComponent = Component<{
|
|
424
|
+
item: UniItem;
|
|
431
425
|
freeHeight?: boolean;
|
|
432
426
|
disabled?: boolean;
|
|
433
427
|
type?: 'default' | 'big' | 'small';
|
|
@@ -440,77 +434,75 @@ type ItemCardComponent = Component<{
|
|
|
440
434
|
smallTopInfo(): void;
|
|
441
435
|
cover(): void;
|
|
442
436
|
}>;
|
|
443
|
-
type
|
|
444
|
-
type
|
|
437
|
+
type UniItemTranslator = (raw: UniItemRaw) => UniItem;
|
|
438
|
+
type UniItemDescription = string | {
|
|
445
439
|
type: 'html';
|
|
446
440
|
content: string;
|
|
447
441
|
} | {
|
|
448
442
|
type: 'text';
|
|
449
443
|
content: string;
|
|
450
444
|
};
|
|
451
|
-
declare abstract class
|
|
452
|
-
static itemTranslator: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string],
|
|
453
|
-
static create(raw:
|
|
445
|
+
declare abstract class UniItem extends Struct<UniItemRaw> implements UniItemRaw {
|
|
446
|
+
static itemTranslator: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string], UniItemTranslator>>;
|
|
447
|
+
static create(raw: UniItemRaw): UniItem;
|
|
454
448
|
static authorIcon: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string], Component>>;
|
|
455
|
-
static itemCards: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string],
|
|
449
|
+
static itemCards: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string], UniItemCardComponent>>;
|
|
456
450
|
abstract like(): Promise<any>;
|
|
457
451
|
abstract report(): Promise<any>;
|
|
458
452
|
abstract sendComment(text: string): Promise<any>;
|
|
459
|
-
static is(value: unknown): value is
|
|
460
|
-
cover:
|
|
461
|
-
get $cover():
|
|
453
|
+
static is(value: unknown): value is UniItem;
|
|
454
|
+
cover: UniResourceRaw | UniImageRaw;
|
|
455
|
+
get $cover(): UniImage;
|
|
462
456
|
title: string;
|
|
463
457
|
id: string;
|
|
464
|
-
categories:
|
|
465
|
-
author:
|
|
458
|
+
categories: UniItemCategory[];
|
|
459
|
+
author: UniItemAuthor[];
|
|
466
460
|
viewNumber?: number;
|
|
467
461
|
likeNumber?: number;
|
|
468
462
|
commentNumber?: number;
|
|
469
463
|
isLiked?: boolean;
|
|
470
|
-
description?:
|
|
464
|
+
description?: UniItemDescription;
|
|
471
465
|
updateTime?: number;
|
|
472
|
-
contentType:
|
|
466
|
+
contentType: UniContentType;
|
|
473
467
|
length: string;
|
|
474
468
|
epLength: string;
|
|
475
469
|
$$plugin: string;
|
|
476
470
|
$$meta: Metadata | undefined;
|
|
477
|
-
thisEp:
|
|
471
|
+
thisEp: UniEpRaw;
|
|
478
472
|
customIsSafe?: boolean;
|
|
479
|
-
get $thisEp():
|
|
480
|
-
constructor(v:
|
|
473
|
+
get $thisEp(): UniEp;
|
|
474
|
+
constructor(v: UniItemRaw);
|
|
481
475
|
commentSendable: boolean;
|
|
482
476
|
customIsAI?: boolean;
|
|
483
477
|
get $isAi(): boolean;
|
|
484
478
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
avatar?: RawResource;
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region lib/model/user.d.ts
|
|
481
|
+
interface UniUserRaw extends Metadatable {
|
|
482
|
+
avatar?: UniResourceRaw;
|
|
490
483
|
name: string;
|
|
491
484
|
id: string;
|
|
492
485
|
}
|
|
493
|
-
declare abstract class
|
|
494
|
-
static userBase: import("vue").ShallowReactive<Map<string,
|
|
486
|
+
declare abstract class UniUser {
|
|
487
|
+
static userBase: import("vue").ShallowReactive<Map<string, UniUser>>;
|
|
495
488
|
static userEditorBase: import("vue").ShallowReactive<Map<string, Component>>;
|
|
496
|
-
static userCards: import("vue").ShallowReactive<Map<string,
|
|
497
|
-
constructor(v:
|
|
498
|
-
avatar?:
|
|
489
|
+
static userCards: import("vue").ShallowReactive<Map<string, UniUserCardComponent>>;
|
|
490
|
+
constructor(v: UniUserRaw);
|
|
491
|
+
avatar?: UniImage;
|
|
499
492
|
name: string;
|
|
500
493
|
id: string;
|
|
501
494
|
$$plugin: string;
|
|
502
495
|
$$meta?: Metadata;
|
|
503
496
|
abstract customUser: object;
|
|
504
497
|
}
|
|
505
|
-
type
|
|
506
|
-
user:
|
|
498
|
+
type UniUserCardComponent = Component<{
|
|
499
|
+
user: UniUser;
|
|
507
500
|
isSmall?: boolean;
|
|
508
501
|
}>;
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
sender: User;
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region lib/model/comment.d.ts
|
|
504
|
+
interface UniCommentRaw extends Metadatable {
|
|
505
|
+
sender: UniUser;
|
|
514
506
|
content: {
|
|
515
507
|
type: 'string' | 'html';
|
|
516
508
|
text: string;
|
|
@@ -523,15 +515,15 @@ interface RawComment extends Metadatable {
|
|
|
523
515
|
reported: boolean;
|
|
524
516
|
isTop: boolean;
|
|
525
517
|
}
|
|
526
|
-
type
|
|
527
|
-
comment:
|
|
528
|
-
item:
|
|
529
|
-
parentComment?:
|
|
518
|
+
type UniCommentRow = Component<{
|
|
519
|
+
comment: UniComment;
|
|
520
|
+
item: UniItem;
|
|
521
|
+
parentComment?: UniComment;
|
|
530
522
|
}>;
|
|
531
|
-
declare abstract class
|
|
532
|
-
static commentRow: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string],
|
|
533
|
-
constructor(v:
|
|
534
|
-
abstract sender:
|
|
523
|
+
declare abstract class UniComment extends Struct<UniCommentRaw> implements UniCommentRaw {
|
|
524
|
+
static commentRow: import("vue").ShallowReactive<SourcedKeyMap<[plugin: string, name: string], UniCommentRow>>;
|
|
525
|
+
constructor(v: UniCommentRaw);
|
|
526
|
+
abstract sender: UniUser;
|
|
535
527
|
content: {
|
|
536
528
|
type: 'string' | 'html';
|
|
537
529
|
text: string;
|
|
@@ -548,10 +540,7 @@ declare abstract class Comment extends Struct<RawComment> implements RawComment
|
|
|
548
540
|
abstract like(signal?: AbortSignal): PromiseLike<boolean>;
|
|
549
541
|
abstract report(signal?: AbortSignal): PromiseLike<any>;
|
|
550
542
|
abstract sendComment(text: string, signal?: AbortSignal): PromiseLike<any>;
|
|
551
|
-
abstract fetchChildren: StreamQuery<
|
|
552
|
-
}
|
|
553
|
-
declare namespace index_d_exports {
|
|
554
|
-
export { comment_d_exports as comment, content_d_exports as content, download_d_exports as download, ep_d_exports as ep, image_d_exports as image, item_d_exports as item, resource_d_exports as resource, user_d_exports as user };
|
|
543
|
+
abstract fetchChildren: StreamQuery<UniComment>;
|
|
555
544
|
}
|
|
556
545
|
//#endregion
|
|
557
|
-
export { Base, FormCheckbox, FormConfigure, FormDate, FormDateRange, FormDefaultValue, FormNumber, FormPairs, FormRadio, FormResult, FormSingleConfigure, FormSingleResult, FormString, FormSwitch, Metadata, Metadatable, PageKey, SourcedKeyMap, SourcedKeyType, SourcedValue, StreamQuery, Struct,
|
|
546
|
+
export { Base, FormCheckbox, FormConfigure, FormDate, FormDateRange, FormDefaultValue, FormNumber, FormPairs, FormRadio, FormResult, FormSingleConfigure, FormSingleResult, FormString, FormSwitch, Metadata, Metadatable, PageKey, SourcedKeyMap, SourcedKeyType, SourcedValue, StreamQuery, Struct, UniComment, UniCommentRaw, UniCommentRow, UniContentDownloadProvider, UniContentDownloadSelection, UniContentLayoutComponent, UniContentPage, UniContentPageLike, UniContentType, UniContentType_, UniContentViewComponent, UniDownloadAsset, UniDownloadChecksum, UniDownloadChecksumAlgorithm, UniDownloadHttpHeaderValue, UniDownloadHttpMirror, UniDownloadHttpSource, UniDownloadPlan, UniDownloadRefreshSourceInput, UniDownloadRefreshSourceReason, UniDownloadResolveInput, UniDownloadSource, UniDownloadTorrentInput, UniDownloadTorrentSeedPolicy, UniDownloadTorrentSource, UniDownloader, UniEp, UniEpRaw, UniImage, UniImageAspect, UniImageRaw, UniImage_, UniItem, UniItemAuthor, UniItemCardComponent, UniItemCategory, UniItemDescription, UniItemRaw, UniItemTranslator, UniLegacyDownloader, UniResource, UniResourceProcessInstance, UniResourceProcessStep, UniResourceProcessStep_, UniResourceRaw, UniResourceType, UniUser, UniUserCardComponent, UniUserRaw };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
1
|
import { isString } from "es-toolkit";
|
|
3
2
|
import { shallowReactive } from "vue";
|
|
4
3
|
import { logger } from "@delta-comic/logger";
|
|
@@ -125,8 +124,7 @@ var StreamQuery = class {
|
|
|
125
124
|
};
|
|
126
125
|
//#endregion
|
|
127
126
|
//#region lib/model/comment.ts
|
|
128
|
-
var
|
|
129
|
-
var Comment = class extends Struct {
|
|
127
|
+
var UniComment = class extends Struct {
|
|
130
128
|
static commentRow = SourcedKeyMap.createReactive();
|
|
131
129
|
constructor(v) {
|
|
132
130
|
super(v);
|
|
@@ -154,8 +152,7 @@ var Comment = class extends Struct {
|
|
|
154
152
|
};
|
|
155
153
|
//#endregion
|
|
156
154
|
//#region lib/model/ep.ts
|
|
157
|
-
var
|
|
158
|
-
var Ep = class extends Struct {
|
|
155
|
+
var UniEp = class extends Struct {
|
|
159
156
|
name;
|
|
160
157
|
id;
|
|
161
158
|
$$plugin;
|
|
@@ -170,9 +167,8 @@ var Ep = class extends Struct {
|
|
|
170
167
|
};
|
|
171
168
|
//#endregion
|
|
172
169
|
//#region lib/model/resource.ts
|
|
173
|
-
var resource_exports = /* @__PURE__ */ __exportAll({ Resource: () => Resource });
|
|
174
170
|
const resourceLogger = logger.scoped("model:resource");
|
|
175
|
-
var
|
|
171
|
+
var UniResource = class UniResource extends Struct {
|
|
176
172
|
static processInstances = SourcedKeyMap.createReactive();
|
|
177
173
|
static fork = SourcedKeyMap.createReactive();
|
|
178
174
|
static precedenceFork = SourcedKeyMap.createReactive();
|
|
@@ -201,7 +197,7 @@ var Resource = class Resource extends Struct {
|
|
|
201
197
|
async getUrl() {
|
|
202
198
|
let resultPath = this.pathname;
|
|
203
199
|
for (const option of this.processSteps) {
|
|
204
|
-
const instance =
|
|
200
|
+
const instance = UniResource.processInstances.get([this.$$plugin, option.referenceName]);
|
|
205
201
|
if (!instance) {
|
|
206
202
|
resourceLogger.warn("resource process not found", {
|
|
207
203
|
plugin: this.$$plugin,
|
|
@@ -219,15 +215,15 @@ var Resource = class Resource extends Struct {
|
|
|
219
215
|
}
|
|
220
216
|
omittedForks = shallowReactive(/* @__PURE__ */ new Set());
|
|
221
217
|
getThisFork() {
|
|
222
|
-
const all = new Set(
|
|
218
|
+
const all = new Set(UniResource.fork.get([this.$$plugin, this.type])?.urls ?? []);
|
|
223
219
|
let fork;
|
|
224
|
-
if (isEmpty(this.omittedForks)) fork =
|
|
220
|
+
if (isEmpty(this.omittedForks)) fork = UniResource.precedenceFork.get([this.$$plugin, this.type]);
|
|
225
221
|
else fork = Array.from(all.difference(this.omittedForks).values())[0];
|
|
226
|
-
if (!fork) throw new Error(`[
|
|
222
|
+
if (!fork) throw new Error(`[UniResource.getThisFork] fork not found, type: [${this.$$plugin}, ${this.type}]`);
|
|
227
223
|
return fork;
|
|
228
224
|
}
|
|
229
225
|
localChangeFork() {
|
|
230
|
-
const all = new Set(
|
|
226
|
+
const all = new Set(UniResource.fork.get([this.$$plugin, this.type])?.urls ?? []);
|
|
231
227
|
this.omittedForks.add(this.getThisFork());
|
|
232
228
|
const isChangedFail = isEmpty(all.difference(this.omittedForks));
|
|
233
229
|
if (isChangedFail) this.omittedForks.clear();
|
|
@@ -236,8 +232,7 @@ var Resource = class Resource extends Struct {
|
|
|
236
232
|
};
|
|
237
233
|
//#endregion
|
|
238
234
|
//#region lib/model/image.ts
|
|
239
|
-
var
|
|
240
|
-
var Image = class extends Resource {
|
|
235
|
+
var UniImage = class extends UniResource {
|
|
241
236
|
static is(value) {
|
|
242
237
|
return value instanceof this;
|
|
243
238
|
}
|
|
@@ -270,12 +265,11 @@ var Image = class extends Resource {
|
|
|
270
265
|
};
|
|
271
266
|
//#endregion
|
|
272
267
|
//#region lib/model/item.ts
|
|
273
|
-
var
|
|
274
|
-
var Item = class extends Struct {
|
|
268
|
+
var UniItem = class extends Struct {
|
|
275
269
|
static itemTranslator = SourcedKeyMap.createReactive();
|
|
276
270
|
static create(raw) {
|
|
277
271
|
const translator = this.itemTranslator.get(raw.contentType);
|
|
278
|
-
if (!translator) throw new Error(`can not found itemTranslator contentType:"${
|
|
272
|
+
if (!translator) throw new Error(`can not found itemTranslator contentType:"${UniContentPage.contentPages.key.toString(raw.contentType)}"`);
|
|
279
273
|
return translator(raw);
|
|
280
274
|
}
|
|
281
275
|
static authorIcon = SourcedKeyMap.createReactive();
|
|
@@ -285,7 +279,7 @@ var Item = class extends Struct {
|
|
|
285
279
|
}
|
|
286
280
|
cover;
|
|
287
281
|
get $cover() {
|
|
288
|
-
return
|
|
282
|
+
return UniImage.create(this.cover);
|
|
289
283
|
}
|
|
290
284
|
title;
|
|
291
285
|
id;
|
|
@@ -305,7 +299,7 @@ var Item = class extends Struct {
|
|
|
305
299
|
thisEp;
|
|
306
300
|
customIsSafe;
|
|
307
301
|
get $thisEp() {
|
|
308
|
-
return new
|
|
302
|
+
return new UniEp(this.thisEp);
|
|
309
303
|
}
|
|
310
304
|
constructor(v) {
|
|
311
305
|
super(v);
|
|
@@ -323,7 +317,7 @@ var Item = class extends Struct {
|
|
|
323
317
|
this.commentNumber = v.commentNumber;
|
|
324
318
|
this.isLiked = v.isLiked;
|
|
325
319
|
this.customIsAI = v.customIsAI;
|
|
326
|
-
this.contentType =
|
|
320
|
+
this.contentType = UniContentPage.contentPages.key.toJSON(v.contentType);
|
|
327
321
|
this.length = v.length;
|
|
328
322
|
this.epLength = v.epLength;
|
|
329
323
|
this.description = v.description;
|
|
@@ -339,8 +333,7 @@ var Item = class extends Struct {
|
|
|
339
333
|
};
|
|
340
334
|
//#endregion
|
|
341
335
|
//#region lib/model/content.ts
|
|
342
|
-
var
|
|
343
|
-
var ContentPage = class {
|
|
336
|
+
var UniContentPage = class {
|
|
344
337
|
preload;
|
|
345
338
|
id;
|
|
346
339
|
ep;
|
|
@@ -355,24 +348,22 @@ var ContentPage = class {
|
|
|
355
348
|
};
|
|
356
349
|
//#endregion
|
|
357
350
|
//#region lib/model/download.ts
|
|
358
|
-
var download_exports = /* @__PURE__ */ __exportAll({ Downloader: () => Downloader });
|
|
359
351
|
/**
|
|
360
352
|
* Legacy imperative download controller.
|
|
361
353
|
*
|
|
362
|
-
* @deprecated Register a {@link
|
|
354
|
+
* @deprecated Register a {@link UniContentDownloadProvider} for the content type and let the native
|
|
363
355
|
* downloader own task state, persistence, and lifecycle controls. This class remains unchanged so
|
|
364
356
|
* existing plugins can migrate without an immediate breaking change.
|
|
365
357
|
*/
|
|
366
|
-
var
|
|
358
|
+
var UniDownloader = class {};
|
|
367
359
|
//#endregion
|
|
368
360
|
//#region lib/model/user.ts
|
|
369
|
-
var
|
|
370
|
-
var User = class {
|
|
361
|
+
var UniUser = class {
|
|
371
362
|
static userBase = shallowReactive(/* @__PURE__ */ new Map());
|
|
372
363
|
static userEditorBase = shallowReactive(/* @__PURE__ */ new Map());
|
|
373
364
|
static userCards = shallowReactive(/* @__PURE__ */ new Map());
|
|
374
365
|
constructor(v) {
|
|
375
|
-
if (v.avatar) this.avatar =
|
|
366
|
+
if (v.avatar) this.avatar = UniImage.create(v.avatar);
|
|
376
367
|
this.name = v.name;
|
|
377
368
|
this.id = v.id;
|
|
378
369
|
this.$$plugin = v.$$plugin;
|
|
@@ -385,16 +376,4 @@ var User = class {
|
|
|
385
376
|
$$meta;
|
|
386
377
|
};
|
|
387
378
|
//#endregion
|
|
388
|
-
|
|
389
|
-
var model_exports = /* @__PURE__ */ __exportAll({
|
|
390
|
-
comment: () => comment_exports,
|
|
391
|
-
content: () => content_exports,
|
|
392
|
-
download: () => download_exports,
|
|
393
|
-
ep: () => ep_exports,
|
|
394
|
-
image: () => image_exports,
|
|
395
|
-
item: () => item_exports,
|
|
396
|
-
resource: () => resource_exports,
|
|
397
|
-
user: () => user_exports
|
|
398
|
-
});
|
|
399
|
-
//#endregion
|
|
400
|
-
export { SourcedKeyMap, SourcedValue, StreamQuery, Struct, model_exports as uni };
|
|
379
|
+
export { SourcedKeyMap, SourcedValue, StreamQuery, Struct, UniComment, UniContentPage, UniDownloader, UniEp, UniImage, UniItem, UniResource, UniUser };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delta-comic/model",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.6",
|
|
4
4
|
"description": "空阙虱楼",
|
|
5
5
|
"homepage": "https://github.com/delta-comic/delta-comic",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"es-toolkit": "^1.47.0",
|
|
33
|
-
"@delta-comic/logger": "3.0.0-next.
|
|
33
|
+
"@delta-comic/logger": "3.0.0-next.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all, no_symbols) => {
|
|
4
|
-
let target = {};
|
|
5
|
-
for (var name in all) __defProp(target, name, {
|
|
6
|
-
get: all[name],
|
|
7
|
-
enumerable: true
|
|
8
|
-
});
|
|
9
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
-
return target;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
export { __exportAll as t };
|