book-index-ui 0.2.26 → 0.3.0
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 +13 -3
- package/dist/index.d.ts +96 -0
- package/dist/index.js +2767 -2178
- package/dist/{storage-entry-C7sHSk4U.cjs → storage-entry-BeOfavi5.cjs} +1 -1
- package/dist/{storage-entry-Cn1-iEHv.js → storage-entry-Dg4UikVP.js} +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -118,6 +118,55 @@ export declare interface BookDetailData extends BaseDetailData {
|
|
|
118
118
|
lineage?: BookLineage;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
export declare const BookDetailLayout: default_2.FC<BookDetailLayoutProps>;
|
|
122
|
+
|
|
123
|
+
export declare interface BookDetailLayoutProps {
|
|
124
|
+
/** 要展示的条目 ID */
|
|
125
|
+
id: string;
|
|
126
|
+
/** 数据传输层 */
|
|
127
|
+
transport: IndexStorage;
|
|
128
|
+
activeTab: BookDetailTabKey;
|
|
129
|
+
onTabChange: (tab: BookDetailTabKey) => void;
|
|
130
|
+
activeJuan?: string | null;
|
|
131
|
+
onJuanChange?: (juan: string | null) => void;
|
|
132
|
+
lineageMode?: 'list' | 'graph';
|
|
133
|
+
onLineageModeChange?: (mode: 'list' | 'graph') => void;
|
|
134
|
+
lineageCollection?: string;
|
|
135
|
+
onLineageCollectionChange?: (key: string) => void;
|
|
136
|
+
/** 整理本初始页(透传给 extraTabs 的 digital 等) */
|
|
137
|
+
initialPage?: number;
|
|
138
|
+
selectedLineageNodeId?: string;
|
|
139
|
+
onNavigate?: (id: string) => void;
|
|
140
|
+
onBack?: () => void;
|
|
141
|
+
backLabel?: string;
|
|
142
|
+
renderLink?: (id: string, label?: string) => default_2.ReactNode;
|
|
143
|
+
/** 加载 detail 后的额外加工(如注入 digital_assets) */
|
|
144
|
+
enrichDetail?: (entry: IndexEntry, detail: IndexDetailData) => void;
|
|
145
|
+
/** 当前 tab 的源文件链接解析器 */
|
|
146
|
+
getSourceLink?: (ctx: SourceLinkContext) => {
|
|
147
|
+
href: string;
|
|
148
|
+
label: string;
|
|
149
|
+
} | null;
|
|
150
|
+
/** 注入额外 tab(如 kyg 的「数字化」) */
|
|
151
|
+
extraTabs?: ExtraTab[];
|
|
152
|
+
/** 是否显示内置反馈 tab,默认 true。设为 false 时调用方可用 extraTabs 自定义。 */
|
|
153
|
+
showFeedbackTab?: boolean;
|
|
154
|
+
/** 反馈 API 端点(默认 `/api/feedback`) */
|
|
155
|
+
feedbackApiUrl?: string | (() => string);
|
|
156
|
+
/** 整个组件的外层高度(默认 100vh) */
|
|
157
|
+
height?: string;
|
|
158
|
+
/** 桌面侧边栏宽度(默认 144 — 对应 Tailwind w-36) */
|
|
159
|
+
sideNavWidth?: number;
|
|
160
|
+
/** 内容区域最大宽度(默认 1024) */
|
|
161
|
+
contentMaxWidth?: number;
|
|
162
|
+
/** 是否在加载/未找到状态下隐藏整体导航(默认 false:仍显示返回链接) */
|
|
163
|
+
hideNavWhenLoading?: boolean;
|
|
164
|
+
className?: string;
|
|
165
|
+
style?: default_2.CSSProperties;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export declare type BookDetailTabKey = 'basic' | 'collated' | 'lineage' | 'emendated' | 'feedback' | string;
|
|
169
|
+
|
|
121
170
|
/**
|
|
122
171
|
* Exception classes for book-index-manager.
|
|
123
172
|
* Port of Python book_index_manager.exceptions
|
|
@@ -756,6 +805,26 @@ export declare function extractStatus(encoded: string): IndexStatus;
|
|
|
756
805
|
/** Extract type from an ID string */
|
|
757
806
|
export declare function extractType(encoded: string): IndexType;
|
|
758
807
|
|
|
808
|
+
export declare interface ExtraTab {
|
|
809
|
+
/** 唯一 key */
|
|
810
|
+
key: string;
|
|
811
|
+
/** 显示文案 */
|
|
812
|
+
label: string;
|
|
813
|
+
/** 是否在当前 detail 下显示该 tab */
|
|
814
|
+
shouldShow: (detail: IndexDetailData) => boolean;
|
|
815
|
+
/** tab 内容渲染 */
|
|
816
|
+
render: (ctx: ExtraTabContext) => default_2.ReactNode;
|
|
817
|
+
/** 插入位置(默认 before-feedback) */
|
|
818
|
+
position?: 'before-feedback' | 'after-feedback';
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
export declare interface ExtraTabContext {
|
|
822
|
+
detail: IndexDetailData;
|
|
823
|
+
entry: IndexEntry;
|
|
824
|
+
transport: IndexStorage;
|
|
825
|
+
onNavigate?: (id: string) => void;
|
|
826
|
+
}
|
|
827
|
+
|
|
759
828
|
export declare const FeedbackButton: default_2.FC<FeedbackButtonProps>;
|
|
760
829
|
|
|
761
830
|
export declare interface FeedbackButtonProps {
|
|
@@ -807,6 +876,26 @@ export declare interface FeedbackListProps {
|
|
|
807
876
|
loading?: boolean;
|
|
808
877
|
}
|
|
809
878
|
|
|
879
|
+
/**
|
|
880
|
+
* 反馈 tab 内容:列出已有反馈 + 提交新反馈。
|
|
881
|
+
* 与 FeedbackList/FeedbackForm 不同,FeedbackTab 自带数据加载和提交逻辑,
|
|
882
|
+
* 适合直接作为详情页的 tab 内容使用。
|
|
883
|
+
*/
|
|
884
|
+
export declare const FeedbackTab: default_2.FC<FeedbackTabProps>;
|
|
885
|
+
|
|
886
|
+
export declare interface FeedbackTabProps {
|
|
887
|
+
/** 该资源的 ID(用于过滤反馈条目) */
|
|
888
|
+
resourceId: string;
|
|
889
|
+
/**
|
|
890
|
+
* 反馈 API 端点。
|
|
891
|
+
* GET `${apiUrl}?resourceId=...` 返回 `{ success: boolean, items: FeedbackItem[] }`
|
|
892
|
+
* POST `${apiUrl}` body `{ type, content, pageUrl, resourceId }` 返回 2xx
|
|
893
|
+
* 默认 `/api/feedback`。
|
|
894
|
+
* 也支持函数形式:根据当前 hostname 动态决定(如 localhost → 远程,生产 → 同源)。
|
|
895
|
+
*/
|
|
896
|
+
apiUrl?: string | (() => string);
|
|
897
|
+
}
|
|
898
|
+
|
|
810
899
|
export declare type FeedbackType = 'bug' | 'resource';
|
|
811
900
|
|
|
812
901
|
/**
|
|
@@ -2191,6 +2280,13 @@ export declare interface SourceItem {
|
|
|
2191
2280
|
processor_version: string;
|
|
2192
2281
|
}
|
|
2193
2282
|
|
|
2283
|
+
export declare interface SourceLinkContext {
|
|
2284
|
+
activeTab: string;
|
|
2285
|
+
activeJuan: string | null;
|
|
2286
|
+
entry: IndexEntry;
|
|
2287
|
+
detail: IndexDetailData;
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2194
2290
|
export declare class StorageError extends BookIndexError {
|
|
2195
2291
|
constructor(message?: string);
|
|
2196
2292
|
}
|