book-index-ui 0.7.2 → 0.7.5

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.ts CHANGED
@@ -112,6 +112,8 @@ export declare interface BidUrlProviderProps {
112
112
  /** Book 详情 */
113
113
  export declare interface BookDetailData extends BaseDetailData {
114
114
  type: 'book';
115
+ /** 刊刻年代(结构化)。优先于从题名现推的结果 */
116
+ dating?: DatingInfo;
115
117
  work_id?: string;
116
118
  contained_in?: ContainedInEntry[];
117
119
  location_history?: LocationInfo[];
@@ -378,11 +380,7 @@ export declare interface BookPageProps {
378
380
  }
379
381
 
380
382
  export declare function Breadcrumb({ items }: {
381
- items: {
382
- label: string;
383
- onClick?: () => void;
384
- href?: string;
385
- }[];
383
+ items: CrumbItem[];
386
384
  }): JSX.Element;
387
385
 
388
386
  export declare interface BucketedResources {
@@ -864,6 +862,18 @@ export declare interface CreateEntityParams {
864
862
  inheritData?: Record<string, unknown>;
865
863
  }
866
864
 
865
+ export declare interface CrumbItem {
866
+ label: string;
867
+ onClick?: () => void;
868
+ href?: string;
869
+ /**
870
+ * 内部条目 ID。给了就用 useBidUrl 生成真实 href,
871
+ * 于是 Ctrl+点击开新标签、右键复制链接都能用——
872
+ * 只挂 onClick 而 href="#" 的话这些浏览器原生操作全废。
873
+ */
874
+ id?: string;
875
+ }
876
+
867
877
  /** 空值占位「—」 */
868
878
  export declare function Dash(): JSX.Element;
869
879
 
@@ -872,11 +882,85 @@ export declare function DataTable({ children }: {
872
882
  children: default_2.ReactNode;
873
883
  }): JSX.Element;
874
884
 
885
+ /**
886
+ * 刊刻年代(结构化)。
887
+ *
888
+ * 方案见 overview/项目进展/古籍索引网站/整体设计/2026-09-刊刻年代方案.md。
889
+ *
890
+ * 背景:97.5% 的版本没有任何年代欄位,页面上的「刊刻年代」此前是
891
+ * **每次渲染都从题名现推**——无法人工订正,也留不下「这是著录还是猜的」
892
+ * 的痕迹。这个字段把推断结果落盘,并区分可信度。
893
+ */
894
+ export declare interface DatingInfo {
895
+ /** 朝代(归一后:漢/三國/晉/南北朝/隋/唐/五代/宋/遼/西夏/金/元/明/清/民國/日本/朝鮮/高麗/越南/琉球) */
896
+ era?: string;
897
+ /** 年号,如「乾隆」「慶元」 */
898
+ reign?: string;
899
+ /** 年号第几年 */
900
+ reign_year?: number;
901
+ /** 折算后的公元年,供排序 */
902
+ year?: number;
903
+ /** 只知「某某間」时给区间,与 year 二选一 */
904
+ year_range?: [number, number];
905
+ /** attested 著录 | inferred 推断 | uncertain 存疑 */
906
+ certainty?: 'attested' | 'inferred' | 'uncertain';
907
+ /** edition 题名推断 | catalog 书目著录 | colophon 牌记序跋 | manual 人工订正 */
908
+ source?: 'edition' | 'catalog' | 'colophon' | 'manual';
909
+ /** 判定依据,一句话 */
910
+ basis?: string;
911
+ /** 底本:本版所依据的更早的本子 */
912
+ based_on?: {
913
+ era?: string;
914
+ reign?: string;
915
+ year?: number;
916
+ /** 影印 | 翻刻 | 傳鈔 | 配補 | 據刊 */
917
+ relation?: string;
918
+ certainty?: 'attested' | 'inferred' | 'uncertain';
919
+ };
920
+ /** 后修:本版之后被谁修过版(「元大德刻明修本」的「明修」) */
921
+ later_repair?: {
922
+ era?: string;
923
+ };
924
+ }
925
+
875
926
  export declare const decodeId: typeof base36Decode;
876
927
 
877
928
  /** Decode an ID string and extract its components. Supports both base36 and legacy base58. */
878
929
  export declare function decodeIdString(encoded: string): IdComponents;
879
930
 
931
+ /**
932
+ * 派生关系。全库 1,251 部(6.0%)的题名同时提到两个年代。
933
+ *
934
+ * 方向很要紧,两类要分开:
935
+ * · 「清覆刊武英殿本」——主体是**清**本,武英殿是它翻刻的**底本**
936
+ * · 「元大德刻明修本」——主体是**元**本,明代只是后来**修版**
937
+ * 用同一套逻辑解析会把主次搞反,故 REPAIR_PATTERNS 单列。
938
+ */
939
+ export declare type DerivationRelation = '影印' | '翻刻' | '傳鈔' | '配補' | '據刊';
940
+
941
+ export declare function deriveDating(book: EraInferable): DerivedDating | undefined;
942
+
943
+ export declare interface DerivedDating {
944
+ era: string;
945
+ reign: string;
946
+ year?: number;
947
+ yearRange?: YearRange;
948
+ certainty: 'attested' | 'inferred' | 'uncertain';
949
+ source: 'catalog' | 'edition';
950
+ basis: string;
951
+ /** 底本(本版所依据的更早的本子) */
952
+ basedOn?: {
953
+ era: string;
954
+ reign: string;
955
+ year?: number;
956
+ relation: DerivationRelation;
957
+ };
958
+ /** 后修:本版之后被谁修过版 */
959
+ laterRepair?: {
960
+ era: string;
961
+ };
962
+ }
963
+
880
964
  export declare interface DerivedEra {
881
965
  /** 朝代名(繁体),如「宋」「清」「日本」;推不出时为空串 */
882
966
  era: string;
@@ -912,6 +996,17 @@ export declare function deriveEra(book: EraInferable): DerivedEra;
912
996
  */
913
997
  export declare function deriveYear(book: EraInferable): number | undefined;
914
998
 
999
+ /**
1000
+ * 「某某間」的年代區間。
1001
+ *
1002
+ * 「明隆萬間」= 隆慶元年(1567) 至 萬曆末(1620):取题名里首尾两个年号的起讫。
1003
+ * 「清康雍間」= 康熙元年(1662) 至 雍正末(1735)。
1004
+ * 全库约 60 部这种写法,此前一律推不出年份。
1005
+ *
1006
+ * 区间只用于排序(取下界)与展示,不当确切年份 —— 故与 deriveYear 分开。
1007
+ */
1008
+ export declare function deriveYearRange(book: EraInferable): YearRange | undefined;
1009
+
915
1010
  /** 描述信息 */
916
1011
  export declare interface DescriptionInfo {
917
1012
  text: string;
@@ -942,6 +1037,15 @@ export declare function DetailHeader({ title, subtitle, aside, secondLine }: {
942
1037
  /** IndexDetailData (结构化) → IndexEditorData (扁平化) */
943
1038
  export declare function detailToEditor(data: IndexDetailData): IndexEditorData;
944
1039
 
1040
+ /**
1041
+ * 作者署名里的 role 显示值。
1042
+ *
1043
+ * 数据里有 16 条 `authors[].role` 写成英文 "author"(录入工具的占位值
1044
+ * 没被替换掉),直接渲染就是「紀昀等編 author」这种中英夹杂。
1045
+ * 这类无信息量的占位值不显示;真正的中文职任(撰/編/總纂官…)原样保留。
1046
+ */
1047
+ export declare function displayAuthorRole(role?: string): string;
1048
+
945
1049
  /** 下载进度信息 */
946
1050
  export declare interface DownloadProgress {
947
1051
  status: DownloadStatus;
@@ -1092,12 +1196,19 @@ export declare interface EraInferable {
1092
1196
  edition?: string;
1093
1197
  lineage?: BookDetailData['lineage'];
1094
1198
  publication_info?: BookDetailData['publication_info'];
1199
+ /**
1200
+ * 结构化年代(方案 §3)。给了就直接用,不再从题名现推。
1201
+ *
1202
+ * 这是「优先读 dating、读不到才回退」的入口——旧数据、draft 仓
1203
+ * 未迁移的条目都还没有这个字段,回退保证它们不会坏。
1204
+ */
1205
+ dating?: DatingInfo;
1095
1206
  }
1096
1207
 
1097
1208
  export declare function eraRank(era: string): number;
1098
1209
 
1099
1210
  /** 推断出的朝代及其可信来源 */
1100
- export declare type EraSource = 'lineage' | 'publication' | 'edition' | 'none';
1211
+ export declare type EraSource = 'lineage' | 'publication' | 'edition' | 'catalog' | 'none';
1101
1212
 
1102
1213
  /**
1103
1214
  * 可展开行(书目收录 / 考证):+/- 方块 + 主行 + 展开内容。
@@ -2159,6 +2270,8 @@ export declare interface LocaleMessages {
2159
2270
  attachedTexts: string;
2160
2271
  appendix: string;
2161
2272
  containedIn: string;
2273
+ /** 作品被丛编收录(与 belongsToWork 区分:后者指向上级作品) */
2274
+ collectedIn: string;
2162
2275
  belongsToWork: string;
2163
2276
  locationHistory: string;
2164
2277
  historyOverview: string;
@@ -2622,7 +2735,7 @@ export declare interface RelatedEntity {
2622
2735
  export declare interface RelatedGroup {
2623
2736
  key: string;
2624
2737
  /** i18n key,UI 侧翻译 */
2625
- labelKey: 'belongsToWork' | 'containedWorks' | 'derivativeWorks' | 'studies' | 'relatedWorks';
2738
+ labelKey: 'belongsToWork' | 'collectedIn' | 'containedWorks' | 'derivativeWorks' | 'studies' | 'relatedWorks';
2626
2739
  items: RelatedWorkRef[];
2627
2740
  }
2628
2741
 
@@ -2949,6 +3062,12 @@ declare interface SmartBidInputProps {
2949
3062
  /** Auto-detect base58 or base36 and decode. */
2950
3063
  export declare function smartDecode(s: string): bigint;
2951
3064
 
3065
+ /**
3066
+ * 排序用年份:有确切纪年就用,否则退到朝代起始年。
3067
+ * 返回 undefined 表示连朝代都推不出来(「鈔本」「稿本」这类)。
3068
+ */
3069
+ export declare function sortYear(book: EraInferable): number | undefined;
3070
+
2952
3071
  export declare const SourceEditor: default_2.FC<SourceEditorProps>;
2953
3072
 
2954
3073
  declare interface SourceEditorProps {
@@ -3264,6 +3383,12 @@ export declare interface VersionRow {
3264
3383
  holders: ResourceEntry[];
3265
3384
  /** current_location.name —— 没有 physical 资源时的回退 */
3266
3385
  locationName?: string;
3386
+ /**
3387
+ * 排序用年份:确切纪年优先,否则退到朝代起始年。
3388
+ * 与 `year` 的区别是它对「宋建安黃善夫家塾刻本」这种只知朝代的
3389
+ * 也给得出值,不至于被扔到清末刻本后面。
3390
+ */
3391
+ sortYear?: number;
3267
3392
  /** 是否重点版本(在 version_graph 核心集内) */
3268
3393
  important: boolean;
3269
3394
  /** 所属分组 id(version_graph.node_groups) */
@@ -3407,4 +3532,15 @@ export declare interface WorkPageProps {
3407
3532
  lineageAction?: default_2.ReactNode;
3408
3533
  }
3409
3534
 
3535
+ /**
3536
+ * 「某某間」→ 年代區間。
3537
+ *
3538
+ * 「明隆萬間」= 隆慶元年(1567) 至 萬曆末(1620):取首尾两个年号的起讫。
3539
+ * 全库约 60 部这种写法。区间只用于排序(取下界)与展示,不当确切年份。
3540
+ */
3541
+ export declare interface YearRange {
3542
+ from: number;
3543
+ to: number;
3544
+ }
3545
+
3410
3546
  export { }