book-index-ui 0.62.2 → 0.63.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/dist/index.cjs +118 -80
- package/dist/index.d.ts +68 -3
- package/dist/index.js +8175 -7795
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ export declare function adaptCharCord(charRaw: unknown, cordRaw?: unknown, normR
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function adaptEntityJson(raw: unknown): EntitySpan[];
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* `NNN.fig.json`(guji-fig v0.1,spec/09)→ 图 id → 图。格式不对的项丢弃,整份不是对象得到空表,不抛错。
|
|
18
|
+
* `file` 只认 `fig/` 下的相对路径(不许 `..`、不许协议或开头的 `/`);`alt` 缺失时退回「图形符号」。
|
|
19
|
+
*/
|
|
20
|
+
export declare function adaptFig(raw: unknown): Map<string, GujiFigure>;
|
|
21
|
+
|
|
16
22
|
/** 同 {@link adaptNormDetailed},只要 map */
|
|
17
23
|
export declare function adaptNorm(raw: unknown): Map<string, string>;
|
|
18
24
|
|
|
@@ -934,6 +940,8 @@ export declare interface CharGeometry {
|
|
|
934
940
|
zi?: string;
|
|
935
941
|
/** 规范层(norm.json):人审过的通行字,恰好一个字;缺省=该位没有逐位规范(overview#525) */
|
|
936
942
|
norm?: string;
|
|
943
|
+
/** 图片格(char v0.3 `fig`,spec/02 §4.7):值是同章 fig.json 里的图 id;`char` 是 `□` */
|
|
944
|
+
fig?: string;
|
|
937
945
|
}
|
|
938
946
|
|
|
939
947
|
/** 复选框(「只看有影印」) */
|
|
@@ -1193,7 +1201,11 @@ export declare interface CollectionTable {
|
|
|
1193
1201
|
export declare interface ColumnGeometry {
|
|
1194
1202
|
col: number;
|
|
1195
1203
|
/** 列类别与版式字段(spec/02 §4.3):空列 `blank`、抬头格数、行首空格数;缺省=正文列、0、0 */
|
|
1196
|
-
kind?: 'body' | 'banxin' | 'blank';
|
|
1204
|
+
kind?: 'body' | 'banxin' | 'blank' | 'figure';
|
|
1205
|
+
/** 图列(`kind: 'figure'`,插图块):占几列、图 id、cord 里的框 `[x0,y0,x1,y1]` */
|
|
1206
|
+
span?: number;
|
|
1207
|
+
fig?: string;
|
|
1208
|
+
figBox?: [number, number, number, number];
|
|
1197
1209
|
raised?: number;
|
|
1198
1210
|
lead_blank?: number;
|
|
1199
1211
|
warped_w: number;
|
|
@@ -2251,6 +2263,16 @@ export declare interface EntitySpan {
|
|
|
2251
2263
|
targetId?: string;
|
|
2252
2264
|
/** 条目规范名(卡片标题的后备) */
|
|
2253
2265
|
canonicalName?: string;
|
|
2266
|
+
/**
|
|
2267
|
+
* 合称(`target.status = "matched_multi"`,book-text#244):一个区间对应两个以上条目(正嘉、二程、六朝)。
|
|
2268
|
+
* 有它时 `targetId` 一定为空——整个区间不是单一链接,悬停/点按出一张列出各条目的卡片。
|
|
2269
|
+
* `part` 是该条目对应区间里的哪段字(可选,按字拆不开的合称不写)。
|
|
2270
|
+
*/
|
|
2271
|
+
targets?: Array<{
|
|
2272
|
+
id: string;
|
|
2273
|
+
canonicalName?: string;
|
|
2274
|
+
part?: string;
|
|
2275
|
+
}>;
|
|
2254
2276
|
/** 置信度 0–1(顶层 `confidence`;缺失时回退用 `target.confidence`) */
|
|
2255
2277
|
confidence?: number;
|
|
2256
2278
|
/** `target.confidence`(0–1):对已匹配目标的把握 */
|
|
@@ -2797,8 +2819,21 @@ export declare const GUJI_MARKDOWN_FIELD = "guji_markdown";
|
|
|
2797
2819
|
/** index.json 顶层 `table_notation` 的取值 */
|
|
2798
2820
|
export declare const GUJI_TABLE_NOTATION = "guji-table-v1";
|
|
2799
2821
|
|
|
2800
|
-
/** 列类别(spec/02 §4.3):`blank` 空列(无字)、`banxin`
|
|
2801
|
-
declare type GujiColumnKind = 'body' | 'banxin' | 'blank';
|
|
2822
|
+
/** 列类别(spec/02 §4.3、§4.7):`blank` 空列(无字)、`banxin` 版心列、`figure` 图列(插图块,无字);缺省正文列 */
|
|
2823
|
+
declare type GujiColumnKind = 'body' | 'banxin' | 'blank' | 'figure';
|
|
2824
|
+
|
|
2825
|
+
/** 同章 fig.json(spec/09)里的一张图,阅读器要用的部分 */
|
|
2826
|
+
export declare interface GujiFigure {
|
|
2827
|
+
id: string;
|
|
2828
|
+
kind: 'inline' | 'block';
|
|
2829
|
+
/** 说明文字:悬停、读屏、复制都用它 */
|
|
2830
|
+
alt: string;
|
|
2831
|
+
/** 相对版本目录的图片文件,如 `fig/005/f148-2-14.png` */
|
|
2832
|
+
file: string;
|
|
2833
|
+
mime: string;
|
|
2834
|
+
width: number;
|
|
2835
|
+
height: number;
|
|
2836
|
+
}
|
|
2802
2837
|
|
|
2803
2838
|
/**
|
|
2804
2839
|
* guji-markdown 0.2.0 行内新写法解析(GM2 道,2026-09-27)。
|
|
@@ -2903,6 +2938,8 @@ export declare interface GujiPageChar {
|
|
|
2903
2938
|
zi?: string;
|
|
2904
2939
|
/** 规范层(norm.json):人审过的「异体→通行字」,恰好一个字、且与 `char` 不同;缺省=该位没有逐位规范(overview#525) */
|
|
2905
2940
|
norm?: string;
|
|
2941
|
+
/** 图片格(char v0.3 `fig`,spec/02 §4.7):本格是图不是字,值是同章 fig.json 里的图 id;`char` 仍是 `□`。连续同 id 的格是同一张图 */
|
|
2942
|
+
fig?: string;
|
|
2906
2943
|
}
|
|
2907
2944
|
|
|
2908
2945
|
export declare interface GujiPageInfo {
|
|
@@ -2925,6 +2962,10 @@ export declare interface GujiPageInfo {
|
|
|
2925
2962
|
kind?: GujiColumnKind;
|
|
2926
2963
|
raised?: number;
|
|
2927
2964
|
lead_blank?: number;
|
|
2965
|
+
/** 图列(`kind: 'figure'`,插图块):占几列、指向的图 id、cord `marks.figure` 的框 `[x0,y0,x1,y1]`(有 cord 且对得上才带) */
|
|
2966
|
+
span?: number;
|
|
2967
|
+
fig?: string;
|
|
2968
|
+
figBox?: [number, number, number, number];
|
|
2928
2969
|
}[];
|
|
2929
2970
|
}
|
|
2930
2971
|
|
|
@@ -3020,6 +3061,19 @@ export declare interface GujiTextViewerProps {
|
|
|
3020
3061
|
bookTitleStyle?: BookTitleStyle;
|
|
3021
3062
|
/** 书名是否标注:false=波浪线与书名号都不标(隐去《》〈〉;书名实体也应由宿主筛掉) */
|
|
3022
3063
|
showWorks?: boolean;
|
|
3064
|
+
/**
|
|
3065
|
+
* 本章的图(`adaptFig(fig.json)` 的结果,spec/09):图片格 `fig` 与图列按图 id 查说明与文件。不传=所有图都取不到,显示 `〔图:…〕` 标签。
|
|
3066
|
+
* 宿主要传稳定引用(useMemo),每页是 memo 组件,身份一变整卷重渲染。
|
|
3067
|
+
*/
|
|
3068
|
+
figures?: ReadonlyMap<string, GujiFigure>;
|
|
3069
|
+
/** 图片文件地址:入参是 fig.json 里的 `file`(相对版本目录),出参是可直接放进 <img src> 的 URL。不传=取不到图 */
|
|
3070
|
+
figUrl?: (file: string) => string;
|
|
3071
|
+
/** 点击插图块(宿主据此把书影栏翻到该页、标出原框);`box` 是 cord `marks.figure` 的框 `[x0,y0,x1,y1]`,没有 cord 时缺省 */
|
|
3072
|
+
onFigureBlockClick?: (info: {
|
|
3073
|
+
page: number;
|
|
3074
|
+
fig: string;
|
|
3075
|
+
box?: [number, number, number, number];
|
|
3076
|
+
}) => void;
|
|
3023
3077
|
}
|
|
3024
3078
|
|
|
3025
3079
|
export declare const GujiWarpCanvas: default_2.FC<GujiWarpCanvasProps>;
|
|
@@ -3032,6 +3086,10 @@ export declare interface GujiWarpCanvasProps {
|
|
|
3032
3086
|
preserveMargins?: boolean;
|
|
3033
3087
|
onCharClick?: (charId: string) => void;
|
|
3034
3088
|
onCharHover?: (charId: string | null) => void;
|
|
3089
|
+
/** 当前选中的插图块(图 id,点正文里的插图块选中):实线加重显示 */
|
|
3090
|
+
selectedFigBlock?: string | null;
|
|
3091
|
+
/** 点书影栏上的插图块虚线框 */
|
|
3092
|
+
onFigBlockClick?: (figId: string) => void;
|
|
3035
3093
|
/** 外层 CSS 缩放倍数(如 ZoomPanBox 的放大倍数):放大时画布后备跟着加密,不糊;缺省 1 */
|
|
3036
3094
|
renderScale?: number;
|
|
3037
3095
|
}
|
|
@@ -4643,6 +4701,8 @@ declare const NAMESPACES: {
|
|
|
4643
4701
|
textSource: string;
|
|
4644
4702
|
originalSource: string;
|
|
4645
4703
|
charGuess: string;
|
|
4704
|
+
figLabel: string;
|
|
4705
|
+
figPlain: string;
|
|
4646
4706
|
lacunaGuess: string;
|
|
4647
4707
|
upstream: string;
|
|
4648
4708
|
chapterFailed: string;
|
|
@@ -5055,6 +5115,11 @@ export declare interface PageWarpData {
|
|
|
5055
5115
|
total_warped_w: number;
|
|
5056
5116
|
columns: ColumnGeometry[];
|
|
5057
5117
|
banxin?: BanxinData;
|
|
5118
|
+
/** 本页的插图块(图列,char v0.3):书影栏画虚线框。`box` 是 cord `marks.figure` 的框 `[x0,y0,x1,y1]`,canvas 像素 */
|
|
5119
|
+
figBlocks?: {
|
|
5120
|
+
id: string;
|
|
5121
|
+
box: [number, number, number, number];
|
|
5122
|
+
}[];
|
|
5058
5123
|
/** 本章声明了规范层(norm_file,哪怕是空表)=自校文本,「原字」档可选;缺省=外来文本,原字档置灰(overview#540) */
|
|
5059
5124
|
hasNorm?: boolean;
|
|
5060
5125
|
}
|