book-index-ui 0.2.0 → 0.2.3
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.cjs +2 -2
- package/dist/index.d.ts +80 -4
- package/dist/index.js +2814 -2187
- package/dist/storage-entry-BGrOtGe_.cjs +1 -0
- package/dist/{storage-entry-bVWfXQLG.js → storage-entry-BRPlAOY2.js} +374 -296
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.ts +66 -4
- package/dist/storage.js +1 -1
- package/package.json +2 -1
- package/dist/storage-entry-DawKmokc.cjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,10 @@ export declare interface BaseDetailData {
|
|
|
50
50
|
publication_info?: PublicationInfo;
|
|
51
51
|
current_location?: LocationInfo;
|
|
52
52
|
juan_count?: JuanCount;
|
|
53
|
+
/** 多維計量(卷、回、集等),適合通俗小說等 */
|
|
54
|
+
measures?: Measure[];
|
|
55
|
+
/** UI 直接展示的計量文本,應與 measures 一致 */
|
|
56
|
+
measure_info?: string;
|
|
53
57
|
page_count?: PageCount;
|
|
54
58
|
resources?: ResourceEntry[];
|
|
55
59
|
}
|
|
@@ -69,6 +73,15 @@ export declare class BidLink {
|
|
|
69
73
|
static isBidLink(url: string): boolean;
|
|
70
74
|
}
|
|
71
75
|
|
|
76
|
+
export declare type BidUrlBuilder = (id: string) => string;
|
|
77
|
+
|
|
78
|
+
export declare function BidUrlProvider({ buildUrl, children }: BidUrlProviderProps): JSX.Element;
|
|
79
|
+
|
|
80
|
+
export declare interface BidUrlProviderProps {
|
|
81
|
+
buildUrl: BidUrlBuilder;
|
|
82
|
+
children: default_2.ReactNode;
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
/** Book 详情 */
|
|
73
86
|
export declare interface BookDetailData extends BaseDetailData {
|
|
74
87
|
type: 'book';
|
|
@@ -314,12 +327,33 @@ export declare const CollatedEdition: default_2.FC<CollatedEditionProps>;
|
|
|
314
327
|
|
|
315
328
|
/** 整理本索引(卷列表) */
|
|
316
329
|
export declare interface CollatedEditionIndex {
|
|
330
|
+
/** 整理本类型:catalog(目录志书)| kaozhen(考证) */
|
|
331
|
+
type?: 'catalog' | 'kaozhen';
|
|
317
332
|
work_id: string;
|
|
318
|
-
total_juan
|
|
319
|
-
juan_files
|
|
333
|
+
total_juan?: number;
|
|
334
|
+
juan_files?: string[];
|
|
320
335
|
juan_groups?: JuanGroup[];
|
|
321
336
|
/** 参考文献 */
|
|
322
337
|
references?: CollatedReference[];
|
|
338
|
+
/** kaozhen: 考证对象(如"漢書藝文志") */
|
|
339
|
+
target_source?: string;
|
|
340
|
+
target_source_id?: string;
|
|
341
|
+
/** kaozhen: 文本来源说明 */
|
|
342
|
+
text_source?: string;
|
|
343
|
+
/** 文本质量等级 */
|
|
344
|
+
text_quality?: {
|
|
345
|
+
grade: TextQualityGrade;
|
|
346
|
+
/** 文字来源说明 */
|
|
347
|
+
source_note?: string;
|
|
348
|
+
};
|
|
349
|
+
/** 文件列表(替代 juan_files 的详细版) */
|
|
350
|
+
files?: Array<{
|
|
351
|
+
filename: string;
|
|
352
|
+
title: string;
|
|
353
|
+
source_juan?: string;
|
|
354
|
+
sections?: number;
|
|
355
|
+
status?: string;
|
|
356
|
+
}>;
|
|
323
357
|
}
|
|
324
358
|
|
|
325
359
|
export declare interface CollatedEditionProps {
|
|
@@ -362,8 +396,8 @@ declare interface CollatedReference {
|
|
|
362
396
|
/** 整理本中的一个 section */
|
|
363
397
|
export declare interface CollatedSection {
|
|
364
398
|
title: string;
|
|
365
|
-
level
|
|
366
|
-
type:
|
|
399
|
+
level?: number;
|
|
400
|
+
type: string;
|
|
367
401
|
content?: string;
|
|
368
402
|
edition?: string | null;
|
|
369
403
|
text_status?: string | null;
|
|
@@ -379,7 +413,14 @@ export declare interface CollatedSection {
|
|
|
379
413
|
author_type?: string | null;
|
|
380
414
|
note?: string | null;
|
|
381
415
|
tag?: string | null;
|
|
416
|
+
/** catalog 类型:单个关联作品 ID */
|
|
382
417
|
work_id?: string | null;
|
|
418
|
+
/** kaozhen 类型:关联的作品 ID 列表 */
|
|
419
|
+
work_ids?: string[];
|
|
420
|
+
/** kaozhen 类型:原文标题行 */
|
|
421
|
+
header_line?: string;
|
|
422
|
+
/** AI 生成的备注 */
|
|
423
|
+
ai_note?: string;
|
|
383
424
|
}
|
|
384
425
|
|
|
385
426
|
export declare const CollectionCatalog: default_2.FC<CollectionCatalogProps>;
|
|
@@ -709,6 +750,16 @@ export declare class GithubStorage implements IndexStorage {
|
|
|
709
750
|
}>;
|
|
710
751
|
deleteItem(): Promise<void>;
|
|
711
752
|
generateId(): Promise<string>;
|
|
753
|
+
/** 通过已知路径获取 item JSON */
|
|
754
|
+
private fetchItemByPath;
|
|
755
|
+
/**
|
|
756
|
+
* 通过 ID 推导路径查找文件(不依赖 index)。
|
|
757
|
+
* 文件路径格式: {Type}/{c1}/{c2}/{c3}/{id}-{title}.json
|
|
758
|
+
* 从 ID 可解析出 type 和 status(决定 repo),用 GitHub Contents API 列出目录找到匹配文件。
|
|
759
|
+
*/
|
|
760
|
+
private findItemById;
|
|
761
|
+
/** 从 item 元数据构建 IndexEntry */
|
|
762
|
+
private buildEntryFromItem;
|
|
712
763
|
/** 通过相对路径获取文件(自动尝试 GitHub raw + CDN fallback) */
|
|
713
764
|
private fetchFile;
|
|
714
765
|
/** 获取条目对应的 repo 和目录信息 */
|
|
@@ -959,6 +1010,8 @@ export declare interface IndexEntry {
|
|
|
959
1010
|
has_image?: boolean;
|
|
960
1011
|
/** 是否有整理本 */
|
|
961
1012
|
has_collated?: boolean;
|
|
1013
|
+
/** 作品子类型:poem / article / book(默认) */
|
|
1014
|
+
subtype?: string;
|
|
962
1015
|
}
|
|
963
1016
|
|
|
964
1017
|
/** index.json 结构 */
|
|
@@ -984,6 +1037,8 @@ export declare interface IndexFileEntry {
|
|
|
984
1037
|
attached_texts?: string[];
|
|
985
1038
|
edition?: string;
|
|
986
1039
|
juan_count?: number;
|
|
1040
|
+
/** UI 展示用計量文本,優先於 juan_count 單獨顯示 */
|
|
1041
|
+
measure_info?: string;
|
|
987
1042
|
has_text?: boolean;
|
|
988
1043
|
has_image?: boolean;
|
|
989
1044
|
}
|
|
@@ -1066,6 +1121,8 @@ export declare interface IndexStorage {
|
|
|
1066
1121
|
hasText: number;
|
|
1067
1122
|
hasImage: number;
|
|
1068
1123
|
}>;
|
|
1124
|
+
/** 获取 Work subtype 细分统计 */
|
|
1125
|
+
getSubtypeStats?(): Promise<Record<string, number>>;
|
|
1069
1126
|
}
|
|
1070
1127
|
|
|
1071
1128
|
/** 索引类型 */
|
|
@@ -1286,6 +1343,9 @@ export declare interface LocaleMessages {
|
|
|
1286
1343
|
recentBrowse: string;
|
|
1287
1344
|
history: string;
|
|
1288
1345
|
clearAll: string;
|
|
1346
|
+
clearRecent: string;
|
|
1347
|
+
itemNotFound: string;
|
|
1348
|
+
removeFromRecent: string;
|
|
1289
1349
|
searchTitle: string;
|
|
1290
1350
|
searchSubtitle: string;
|
|
1291
1351
|
searchBookName: string;
|
|
@@ -1439,6 +1499,8 @@ export declare interface LocaleToggleProps {
|
|
|
1439
1499
|
export declare class LocalStorage implements IndexStorage {
|
|
1440
1500
|
private storage;
|
|
1441
1501
|
private idGen;
|
|
1502
|
+
private fs;
|
|
1503
|
+
private workspaceRoot;
|
|
1442
1504
|
private recentEntities;
|
|
1443
1505
|
constructor(config: LocalStorageConfig);
|
|
1444
1506
|
loadEntries(type: IndexType, options: LoadOptions): Promise<PageResult<IndexEntry>>;
|
|
@@ -1463,6 +1525,7 @@ export declare class LocalStorage implements IndexStorage {
|
|
|
1463
1525
|
getRecentEntities(): Promise<EntityOption[]>;
|
|
1464
1526
|
addRecentEntity(entity: EntityOption): Promise<void>;
|
|
1465
1527
|
getCollectionCatalog(collectionId: string): Promise<VolumeBookMapping | null>;
|
|
1528
|
+
getRecommended(): Promise<RecommendedData | null>;
|
|
1466
1529
|
/** 获取资源目录路径(不创建) */
|
|
1467
1530
|
getAssetDir(idStr: string): string;
|
|
1468
1531
|
/** 初始化资源目录,返回路径 */
|
|
@@ -1498,6 +1561,14 @@ export declare interface LocationInfo {
|
|
|
1498
1561
|
description?: string;
|
|
1499
1562
|
}
|
|
1500
1563
|
|
|
1564
|
+
/** 單個計量單位(卷、回、集、篇、則 等) */
|
|
1565
|
+
declare interface Measure {
|
|
1566
|
+
unit: string;
|
|
1567
|
+
number: number;
|
|
1568
|
+
/** 計量相關備註,如 "每集五回" */
|
|
1569
|
+
note?: string;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1501
1572
|
export declare class MigrationError extends BookIndexError {
|
|
1502
1573
|
constructor(message?: string);
|
|
1503
1574
|
}
|
|
@@ -1788,6 +1859,11 @@ export declare interface SyncConfig {
|
|
|
1788
1859
|
|
|
1789
1860
|
declare type TabKey = 'recommend' | 'catalog' | 'site' | 'feedback';
|
|
1790
1861
|
|
|
1862
|
+
/** 整理本文本质量等级 */
|
|
1863
|
+
declare type TextQualityGrade = 'published' | 'fine' | 'rough' | 'ocr';
|
|
1864
|
+
|
|
1865
|
+
export declare function useBidUrl(): BidUrlBuilder;
|
|
1866
|
+
|
|
1791
1867
|
/**
|
|
1792
1868
|
* 古籍内容繁简转换 hook
|
|
1793
1869
|
* 繁体模式下原样返回,简体模式下通过 opencc-js 转换
|