@hamster-note/reader 0.2.0-beta.1 → 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/README.md +20 -2
- package/dist/components/IntermediateDocumentViewer/IntermediateDocumentTextPageContent.d.ts +47 -0
- package/dist/components/IntermediateDocumentViewer/IntermediateDocumentTextPageContent.d.ts.map +1 -0
- package/dist/components/IntermediateDocumentViewer/IntermediateDocumentTextViewer.d.ts +59 -0
- package/dist/components/IntermediateDocumentViewer/IntermediateDocumentTextViewer.d.ts.map +1 -0
- package/dist/components/IntermediateDocumentViewer/IntermediateDocumentViewer.d.ts +30 -5
- package/dist/components/IntermediateDocumentViewer/IntermediateDocumentViewer.d.ts.map +1 -1
- package/dist/components/IntermediateDocumentViewer/index.d.ts +3 -1
- package/dist/components/IntermediateDocumentViewer/index.d.ts.map +1 -1
- package/dist/components/IntermediateDocumentViewer/rangeJumpHelpers.d.ts +34 -0
- package/dist/components/IntermediateDocumentViewer/rangeJumpHelpers.d.ts.map +1 -1
- package/dist/components/IntermediateDocumentViewer/selectionAdapter.d.ts +4 -1
- package/dist/components/IntermediateDocumentViewer/selectionAdapter.d.ts.map +1 -1
- package/dist/components/IntermediateDocumentViewer/useLazyPageQueue.d.ts +6 -2
- package/dist/components/IntermediateDocumentViewer/useLazyPageQueue.d.ts.map +1 -1
- package/dist/components/Page.d.ts +20 -0
- package/dist/components/Page.d.ts.map +1 -0
- package/dist/components/Reader.d.ts +33 -64
- package/dist/components/Reader.d.ts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4144 -2183
- package/dist/style.css +168 -4
- package/dist/types/selection.d.ts +30 -2
- package/dist/types/selection.d.ts.map +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -107,6 +107,12 @@ Enable OCR for visible pages with the `ocr` prop, and listen for text selection
|
|
|
107
107
|
/>
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
+
### Text render mode
|
|
111
|
+
|
|
112
|
+
`Reader` uses `renderMode='layout'` by default. Set `renderMode='text'` to render a text-only reading view that mounts and loads only the virtual pages currently visible in the scroll viewport.
|
|
113
|
+
|
|
114
|
+
Text mode renders document text as normal flow content. It does not render page images, intermediate images, or OCR output, and it does not convert existing layout-mode highlight geometry into text-flow highlight geometry.
|
|
115
|
+
|
|
110
116
|
## Text Selection (@hamster-note/selection)
|
|
111
117
|
|
|
112
118
|
`Reader` integrates [`@hamster-note/selection`](https://www.npmjs.com/package/@hamster-note/selection) to provide rich text-selection features, highlighted ranges, popovers, and programmatic control on top of the native browser `Selection` API.
|
|
@@ -207,6 +213,18 @@ import type {
|
|
|
207
213
|
} from '@hamster-note/reader'
|
|
208
214
|
```
|
|
209
215
|
|
|
216
|
+
### Touch pan mode
|
|
217
|
+
|
|
218
|
+
`Reader` uses single-finger document panning by default:
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
<Reader document={document} touchPanMode='single-finger' />
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Set `touchPanMode='two-finger'` when the host app needs one-finger touch gestures for something else. In this mode, one finger no longer moves the document, while two-finger pinch zoom and pinch movement keep the same behavior as the default layout reader.
|
|
225
|
+
|
|
226
|
+
This prop applies to layout mode only. `renderMode='text'` does not mount `VirtualPaper`, so touch pan mode has no effect there.
|
|
227
|
+
|
|
210
228
|
### CSS
|
|
211
229
|
|
|
212
230
|
`@hamster-note/reader/style.css` already bundles the Selection library CSS (`.hsn-selection-*` classes). No additional import is needed.
|
|
@@ -262,6 +280,6 @@ selectionRef.current?.scrollToRange('highlight-1')
|
|
|
262
280
|
|
|
263
281
|
## 发版规则
|
|
264
282
|
|
|
265
|
-
- Push `
|
|
266
|
-
- Push `
|
|
283
|
+
- Push a `vX.Y.Z` tag for stable releases.
|
|
284
|
+
- Push a `vX.Y.Z-<prerelease>` tag for pre-releases (e.g. `v1.0.0-beta`, `v1.0.0-dev`).
|
|
267
285
|
- Publish tag selection follows the package version suffix: no suffix -> `latest`, `-dev` -> `dev`, `-beta` -> `beta`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IntermediateText } from '@hamster-note/types';
|
|
2
|
+
import type { IntermediateDocumentSetTextRef } from './IntermediateDocumentPageContent';
|
|
3
|
+
/**
|
|
4
|
+
* `intermediate-document` 文本渲染模式(`renderMode="text"`)单页内容渲染器。
|
|
5
|
+
*
|
|
6
|
+
* 与 layout 模式的 {@link IntermediateDocumentPageContent} 相对,文本模式以
|
|
7
|
+
* 普通文档流(document flow)绘制 `IntermediateText` 条目,不做任何绝对定位、
|
|
8
|
+
* 不渲染基础底图 / IntermediateImage / OCR span。每页内容容器自带 `padding: 5px`。
|
|
9
|
+
*
|
|
10
|
+
* 关键约束(与 layout 模式保持一致):
|
|
11
|
+
* - 绝不使用 `dangerouslySetInnerHTML`;所有文本均为 React 文本节点。
|
|
12
|
+
* - 纯空白 `content` 跳过渲染(镜像 layout 模式 `isRenderableText` 行为)。
|
|
13
|
+
* - 文本 span 沿用 `.hamster-reader__intermediate-text` + `data-text-id` +
|
|
14
|
+
* `data-page-number`,保证选择 / 测试行为一致。
|
|
15
|
+
* - `text.isEOL` 为真时在该 span 后追加 `<br />`,实现换行。
|
|
16
|
+
* - 条目按传入顺序渲染。
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* 文本模式单页内容组件 props。
|
|
20
|
+
*/
|
|
21
|
+
export type IntermediateDocumentTextPageContentProps = {
|
|
22
|
+
/** 当前页码(用于 data-page-number 与文本 ref 注册) */
|
|
23
|
+
pageNumber: number;
|
|
24
|
+
/** 已加载的文本内容列表(由 useLazyPageQueue text 模式过滤后传入) */
|
|
25
|
+
texts: IntermediateText[];
|
|
26
|
+
/** 文本 span ref 注册回调(与 layout 模式同型);可选 */
|
|
27
|
+
setTextRef?: IntermediateDocumentSetTextRef;
|
|
28
|
+
/**
|
|
29
|
+
* 渲染计时回调(预留);与 layout 模式 onRenderTiming 语义不同,
|
|
30
|
+
* 此处接收页码与已挂载的页面 DOM 元素,供未来 Profiler 集成使用。
|
|
31
|
+
*/
|
|
32
|
+
onRenderTiming?: (pageNumber: number, element: Element) => void;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 文本模式单页内容渲染组件。
|
|
36
|
+
*
|
|
37
|
+
* 将 `texts` 数组按顺序映射为文档流 `<span>` 节点。每个 span:
|
|
38
|
+
* - class: `hamster-reader__intermediate-text hamster-reader__intermediate-text--flow`
|
|
39
|
+
* - 属性: `data-text-id`、`data-page-number`
|
|
40
|
+
* - ref: 若 `setTextRef` 提供,则注册到选择追踪层
|
|
41
|
+
*
|
|
42
|
+
* 当 `text.isEOL` 为真时,在该 span 之后追加 `<br />`。
|
|
43
|
+
*/
|
|
44
|
+
declare function IntermediateDocumentTextPageContentComponent({ pageNumber, texts, setTextRef }: IntermediateDocumentTextPageContentProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare const IntermediateDocumentTextPageContent: import("react").MemoExoticComponent<typeof IntermediateDocumentTextPageContentComponent>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=IntermediateDocumentTextPageContent.d.ts.map
|
package/dist/components/IntermediateDocumentViewer/IntermediateDocumentTextPageContent.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntermediateDocumentTextPageContent.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/IntermediateDocumentTextPageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAG3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAA;AAEvF;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAA;IAClB,kDAAkD;IAClD,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,yCAAyC;IACzC,UAAU,CAAC,EAAE,8BAA8B,CAAA;IAC3C;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAChE,CAAA;AAYD;;;;;;;;;GASG;AACH,iBAAS,4CAA4C,CAAC,EACpD,UAAU,EACV,KAAK,EACL,UAAU,EACX,EAAE,wCAAwC,2CAiC1C;AAED,eAAO,MAAM,mCAAmC,0FAE/C,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { IntermediateDocument, IntermediateDocumentSerialized, IntermediateText } from '@hamster-note/types';
|
|
2
|
+
import { type ReaderSelectedTextSegment } from '../selection/selectionPayloadSerializer';
|
|
3
|
+
import type { ReaderPageRange, ReaderTextSelectionDetail } from './IntermediateDocumentViewer';
|
|
4
|
+
import type { IntermediateDocumentRenderTimingCallback } from './renderTiming';
|
|
5
|
+
/**
|
|
6
|
+
* 文本渲染模式下 `IntermediateDocumentTextViewer` 的 props。
|
|
7
|
+
*
|
|
8
|
+
* 与 {@link IntermediateDocumentViewerProps} 相比,文本模式只接受以下子集:
|
|
9
|
+
* - 文档输入:`document` / `serializedDocument` / `className`
|
|
10
|
+
* - 页面范围与懒加载队列:`pageRange`、`initialLoadedPages`、
|
|
11
|
+
* `pageLoadConcurrency`、`pageLoadEnterDelayMs`、`pageUnloadDelayMs`、
|
|
12
|
+
* `maxLoadedPages`
|
|
13
|
+
* - 旧版文本选择回调:`onTextSelectionChange`、`onTextSelectionEnd`、
|
|
14
|
+
* `onSelectText`
|
|
15
|
+
* - 渲染计时回调:`onIntermediateDocumentRenderTiming`
|
|
16
|
+
*
|
|
17
|
+
* 文本模式不经过 `VirtualPaper`,因此不接受任何缩放、交互模式、
|
|
18
|
+
* linked-range selection 或 overlay 相关 props。
|
|
19
|
+
*/
|
|
20
|
+
export type IntermediateDocumentTextViewerProps = {
|
|
21
|
+
document?: IntermediateDocument | IntermediateDocumentSerialized | null;
|
|
22
|
+
/** 已序列化的中间文档;与 `document` 二选一,文本模式同样支持。 */
|
|
23
|
+
serializedDocument?: IntermediateDocumentSerialized | null;
|
|
24
|
+
className?: string;
|
|
25
|
+
pageRange?: ReaderPageRange;
|
|
26
|
+
/** 初始立即加载的页数,默认 `1`。 */
|
|
27
|
+
initialLoadedPages?: number;
|
|
28
|
+
/** 并发加载页数上限,默认 `3`。 */
|
|
29
|
+
pageLoadConcurrency?: number;
|
|
30
|
+
/** 页面进入可加载窗口后、发起加载前的延迟(毫秒),默认 `500`。 */
|
|
31
|
+
pageLoadEnterDelayMs?: number;
|
|
32
|
+
/** 页面离开可加载窗口后、卸载内容的延迟(毫秒),默认 `5000`。 */
|
|
33
|
+
pageUnloadDelayMs?: number;
|
|
34
|
+
/** 最大并发已加载页数,超出后触发懒淘汰。 */
|
|
35
|
+
maxLoadedPages?: number;
|
|
36
|
+
onTextSelectionChange?: (text: IntermediateText, detail: ReaderTextSelectionDetail) => void;
|
|
37
|
+
onTextSelectionEnd?: (text: IntermediateText, detail: ReaderTextSelectionDetail) => void;
|
|
38
|
+
onSelectText?: (selection: Selection, segments: ReaderSelectedTextSegment[], extractedText: string) => void;
|
|
39
|
+
/** intermediate-document 渲染阶段计时回调。 */
|
|
40
|
+
onIntermediateDocumentRenderTiming?: IntermediateDocumentRenderTimingCallback;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* `intermediate-document` 文本渲染模式的查看器。
|
|
44
|
+
*
|
|
45
|
+
* 文本模式使用 `@tanstack/react-virtual` 的原生滚动虚拟化,只渲染当前
|
|
46
|
+
* 可见视口内的页面 DOM(`overscan: 0`)。与 layout 模式(`VirtualPaper` +
|
|
47
|
+
* 全量外壳)不同,文本模式:
|
|
48
|
+
* - 不挂载 `VirtualPaper`,也不渲染 `.virtual-paper-wrapper`;
|
|
49
|
+
* - 不为每个页码渲染占位 DOM,仅渲染虚拟范围命中页;
|
|
50
|
+
* - 解析文档与过滤页码时复用 layout 模式的 {@link getRuntimeDocument} /
|
|
51
|
+
* {@link getVisiblePageNumbers} 纯函数,避免逻辑分叉。
|
|
52
|
+
*
|
|
53
|
+
* 当前页面内容由 {@link IntermediateDocumentTextPageContent} 渲染,以普通文档流
|
|
54
|
+
* 绘制 `IntermediateText` 条目(含 `isEOL` 换行),不渲染图片 / OCR / 底图。
|
|
55
|
+
*
|
|
56
|
+
* @param props 文本模式 props(见 {@link IntermediateDocumentTextViewerProps})
|
|
57
|
+
*/
|
|
58
|
+
export declare function IntermediateDocumentTextViewer(props: IntermediateDocumentTextViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
//# sourceMappingURL=IntermediateDocumentTextViewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntermediateDocumentTextViewer.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/IntermediateDocumentTextViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACpB,8BAA8B,EAC9B,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,yCAAyC,CAAA;AAEhD,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EAC1B,MAAM,8BAA8B,CAAA;AAOrC,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,gBAAgB,CAAA;AAqC9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,CAAC,EAAE,oBAAoB,GAAG,8BAA8B,GAAG,IAAI,CAAA;IACvE,2CAA2C;IAC3C,kBAAkB,CAAC,EAAE,8BAA8B,GAAG,IAAI,CAAA;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,eAAe,CAAA;IAC3B,wBAAwB;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,uBAAuB;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,wCAAwC;IACxC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,qBAAqB,CAAC,EAAE,CACtB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,yBAAyB,KAC9B,IAAI,CAAA;IACT,kBAAkB,CAAC,EAAE,CACnB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,yBAAyB,KAC9B,IAAI,CAAA;IACT,YAAY,CAAC,EAAE,CACb,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,yBAAyB,EAAE,EACrC,aAAa,EAAE,MAAM,KAClB,IAAI,CAAA;IACT,sCAAsC;IACtC,kCAAkC,CAAC,EAAE,wCAAwC,CAAA;CAC9E,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,mCAAmC,2CAye3C"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IntermediateDocument, type IntermediateDocumentSerialized, type IntermediateText } from '@hamster-note/types';
|
|
2
|
-
import { type IntermediateDocumentRenderTimingCallback } from './renderTiming';
|
|
1
|
+
import { IntermediateDocument, type IntermediateContent, type IntermediateDocumentSerialized, type IntermediateImage, type IntermediateText } from '@hamster-note/types';
|
|
3
2
|
import React from 'react';
|
|
3
|
+
import type { ReaderLinkedSelectionData, ReaderMousePosition, ReaderSelectionOverlayRectType, ReaderSelectionRange, ReaderSelectionRectangle, ReaderSelectionRef, ReaderSelectionTool } from '../../types/selection';
|
|
4
4
|
import { type ReaderSelectedTextSegment } from '../selection/selectionPayloadSerializer';
|
|
5
|
-
import
|
|
5
|
+
import { type IntermediateDocumentRenderTimingCallback } from './renderTiming';
|
|
6
6
|
export { getNearestTextElementForPoint, getPageElementByPageNumber, getPageElementForPoint, resolveCaret } from '../selection/caretResolver';
|
|
7
7
|
export { composeSelection, createOrderedRange } from '../selection/selectionComposer';
|
|
8
8
|
export { buildSelectionPayload, getClosestTextElement, type ReaderSelectedTextSegment, type ReaderSelectionPayload, textElementRecords } from '../selection/selectionPayloadSerializer';
|
|
@@ -217,6 +217,8 @@ export type ReaderSavedSelection = {
|
|
|
217
217
|
export declare const isNonSpaceBlankText: (content: string) => boolean;
|
|
218
218
|
/** 交互模式:'default' 为默认触摸/鼠标模式,'stylus' 为手写笔优化模式 */
|
|
219
219
|
export type ReaderInteractionMode = 'default' | 'stylus';
|
|
220
|
+
/** Touch/mouse pan mode for document scrolling through VirtualPaper. Default is single-finger pan. */
|
|
221
|
+
export type ReaderTouchPanMode = 'single-finger' | 'two-finger';
|
|
220
222
|
export type IntermediateDocumentViewerProps = {
|
|
221
223
|
document?: IntermediateDocument | IntermediateDocumentSerialized | null;
|
|
222
224
|
serializedDocument?: IntermediateDocumentSerialized | null;
|
|
@@ -280,6 +282,8 @@ export type IntermediateDocumentViewerProps = {
|
|
|
280
282
|
maxLoadedPages?: number;
|
|
281
283
|
/** 交互模式,影响手势处理行为 */
|
|
282
284
|
interactionMode?: ReaderInteractionMode;
|
|
285
|
+
/** 触摸文档平移模式:'single-finger' 为单指平移(默认),'two-finger' 为双指平移,避免与手写笔/选择操作冲突 */
|
|
286
|
+
touchPanMode?: ReaderTouchPanMode;
|
|
283
287
|
/** 受控的已高亮 range 列表;传入时组件不内部 mutation,缺失则用内部 state 从 defaultRanges 初始化 */
|
|
284
288
|
ranges?: ReaderSelectionRange[];
|
|
285
289
|
/** 非受控模式下 ranges 的初始值,默认空数组 */
|
|
@@ -314,10 +318,22 @@ export type IntermediateDocumentViewerProps = {
|
|
|
314
318
|
highlightPopover?: React.ReactNode;
|
|
315
319
|
/** 是否在选区结束时自动触发高亮,默认为 false */
|
|
316
320
|
autoHighlight?: boolean;
|
|
317
|
-
/** Selection 组件的命令式 ref,暴露 highlight()/clear() 方法 */
|
|
321
|
+
/** Selection 组件的命令式 ref,暴露 highlight()/clear()/confirm()/confirmRect() 方法 */
|
|
318
322
|
selectionRef?: React.Ref<ReaderSelectionRef>;
|
|
319
323
|
/** 选区 Overlay 矩形坐标类型;默认 'percent' */
|
|
320
324
|
overlayRectType?: ReaderSelectionOverlayRectType;
|
|
325
|
+
/** 当前选择工具模式;默认 'text',传 'rect' 启用矩形框选 */
|
|
326
|
+
tool?: ReaderSelectionTool;
|
|
327
|
+
/** 当前已存在的矩形框选列表(受控) */
|
|
328
|
+
rects?: ReaderSelectionRectangle[];
|
|
329
|
+
/** 当前被选中的矩形框选 ID(受控属性);null 表示未选中任何矩形 */
|
|
330
|
+
selectedRectId?: string | null;
|
|
331
|
+
/** 当用户确认一个新矩形框选时触发 */
|
|
332
|
+
onCreateRect?: (rect: ReaderSelectionRectangle) => void;
|
|
333
|
+
/** 当用户选中/取消选中某个矩形框选时触发 */
|
|
334
|
+
onSelectRect?: (id: string | null) => void;
|
|
335
|
+
/** 当用户拖动矩形手柄调整后触发 */
|
|
336
|
+
onUpdateRect?: (rect: ReaderSelectionRectangle) => void;
|
|
321
337
|
/**
|
|
322
338
|
* 初始立即加载的页数。省略时默认 `1`。
|
|
323
339
|
*/
|
|
@@ -336,7 +352,15 @@ export type IntermediateDocumentViewerProps = {
|
|
|
336
352
|
pageUnloadDelayMs?: number;
|
|
337
353
|
/** intermediate-document 渲染阶段计时回调 */
|
|
338
354
|
onIntermediateDocumentRenderTiming?: IntermediateDocumentRenderTimingCallback;
|
|
355
|
+
/** VirtualPaper 水平留白边距,单位 px */
|
|
356
|
+
containMarginX?: number;
|
|
357
|
+
/** VirtualPaper 垂直留白边距,单位 px */
|
|
358
|
+
containMarginY?: number;
|
|
339
359
|
};
|
|
360
|
+
export declare const getVisiblePageNumbers: (allPageNumbers: number[], pageRange: ReaderPageRange | undefined) => number[];
|
|
361
|
+
export declare const getRuntimeDocument: (inputDocument: IntermediateDocument | IntermediateDocumentSerialized | null | undefined) => IntermediateDocument | null;
|
|
362
|
+
export declare const isIntermediateText: (content: IntermediateContent) => content is IntermediateText;
|
|
363
|
+
export declare const isIntermediateImage: (content: IntermediateContent) => content is IntermediateImage;
|
|
340
364
|
/**
|
|
341
365
|
* Merge overlapping or adjacent rectangles on the same line.
|
|
342
366
|
* Uses a tolerance of 2px to handle minor gaps between text spans.
|
|
@@ -352,5 +376,6 @@ export declare const mergeSelectionRects: (rects: Array<{
|
|
|
352
376
|
width: number;
|
|
353
377
|
height: number;
|
|
354
378
|
}>;
|
|
355
|
-
export declare
|
|
379
|
+
export declare const getPageContentEntries: (page: unknown) => Promise<IntermediateContent[]>;
|
|
380
|
+
export declare function IntermediateDocumentViewer({ document, serializedDocument, className, overscan, pageRange, ocr, onOcrError, onTextSelectionChange, onTextSelectionEnd, onSelectText, scale, defaultScale, onScaleChange, minScale, maxScale, maxLoadedPages, interactionMode, touchPanMode, ranges, defaultRanges, selectedRangeId, defaultSelectedRangeId, onSelect, onLinkedDataChange, onLinkedSelect, onLinkedUpdateRange, onLinkedSelectRange, onSelectRange, onUpdateRange, onSelectionStart: onSelectionStartProp, onSelectionEnd: onSelectionEndProp, onHighlight, highlightColor, selectionColor, selectionPopover, highlightPopover, autoHighlight, selectionRef, overlayRectType, tool, rects, selectedRectId, onCreateRect, onSelectRect, onUpdateRect, initialLoadedPages, pageLoadConcurrency, pageLoadEnterDelayMs, pageUnloadDelayMs, onIntermediateDocumentRenderTiming, containMarginX, containMarginY }: IntermediateDocumentViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
356
381
|
//# sourceMappingURL=IntermediateDocumentViewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntermediateDocumentViewer.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/IntermediateDocumentViewer.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,oBAAoB,
|
|
1
|
+
{"version":3,"file":"IntermediateDocumentViewer.d.ts","sourceRoot":"","sources":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,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,eAA2B,EAC3B,YAAY,EACZ,MAAM,EACN,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,WAAW,EACX,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,eAA2B,EAC3B,IAAI,EACJ,KAAK,EACL,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAsB,EACtB,mBAAuB,EACvB,oBAA0B,EAC1B,iBAAwB,EACxB,kCAAkC,EAClC,cAAc,EACd,cAAc,EACf,EAAE,+BAA+B,2CA2gEjC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { IntermediateDocumentViewer, isNonSpaceBlankText, mergeSelectionRects, type IntermediateDocumentViewerProps, type ReaderInteractionMode, type ReaderPageRange, type ReaderSavedSelection, type ReaderSavedSelectionAnchor, type ReaderSavedSelectionComment, type ReaderSavedSelectionEditDetail, type ReaderSavedSelectionRestoreResult, type ReaderSavedSelectionRestoreStatus, type ReaderSavedSelectionSegment, type ReaderSavedSelectionVisualPage, type ReaderSelectionOverlayRect, type ReaderTextSelectionDetail } from './IntermediateDocumentViewer';
|
|
1
|
+
export { IntermediateDocumentViewer, isNonSpaceBlankText, mergeSelectionRects, type IntermediateDocumentViewerProps, type ReaderInteractionMode, type ReaderPageRange, type ReaderTouchPanMode, type ReaderSavedSelection, type ReaderSavedSelectionAnchor, type ReaderSavedSelectionComment, type ReaderSavedSelectionEditDetail, type ReaderSavedSelectionRestoreResult, type ReaderSavedSelectionRestoreStatus, type ReaderSavedSelectionSegment, type ReaderSavedSelectionVisualPage, type ReaderSelectionOverlayRect, type ReaderTextSelectionDetail } from './IntermediateDocumentViewer';
|
|
2
|
+
export { IntermediateDocumentTextViewer, type IntermediateDocumentTextViewerProps } from './IntermediateDocumentTextViewer';
|
|
3
|
+
export { IntermediateDocumentTextPageContent, type IntermediateDocumentTextPageContentProps } from './IntermediateDocumentTextPageContent';
|
|
2
4
|
export { getNearestTextElementForPoint, getPageElementByPageNumber, getPageElementForPoint, resolveCaret } from '../selection/caretResolver';
|
|
3
5
|
export { composeSelection, createOrderedRange } from '../selection/selectionComposer';
|
|
4
6
|
export { buildSelectionPayload, getClosestTextElement, textElementRecords, type ReaderSelectedTextSegment, type ReaderSelectionPayload } from '../selection/selectionPayloadSerializer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,+BAA+B,EACpC,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC/B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACtB,YAAY,EACb,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC5B,MAAM,yCAAyC,CAAA;AAChD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,sCAAsC,EACtC,KAAK,6CAA6C,EAClD,KAAK,gCAAgC,EACrC,KAAK,wCAAwC,EAC7C,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC3C,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,+BAA+B,EACpC,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC/B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,8BAA8B,EAC9B,KAAK,mCAAmC,EACzC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,mCAAmC,EACnC,KAAK,wCAAwC,EAC9C,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACtB,YAAY,EACb,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC5B,MAAM,yCAAyC,CAAA;AAChD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,sCAAsC,EACtC,KAAK,6CAA6C,EAClD,KAAK,gCAAgC,EACrC,KAAK,wCAAwC,EAC7C,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC3C,MAAM,gBAAgB,CAAA"}
|
|
@@ -127,5 +127,39 @@ export type ComputeTransformParams = {
|
|
|
127
127
|
* Returns `null` when inputs are invalid (zero, negative, non-finite).
|
|
128
128
|
*/
|
|
129
129
|
export declare function computeTransform(params: ComputeTransformParams): VirtualPaperTransform | null;
|
|
130
|
+
export type ComputeTransformForOffsetParams = {
|
|
131
|
+
/** Viewport width in CSS pixels (the VirtualPaper wrapper element). */
|
|
132
|
+
readonly viewportWidth: number;
|
|
133
|
+
/** Viewport height in CSS pixels. */
|
|
134
|
+
readonly viewportHeight: number;
|
|
135
|
+
/** Content element total width in CSS pixels (pre-scale). */
|
|
136
|
+
readonly contentWidth: number;
|
|
137
|
+
/** Content element total height in CSS pixels (pre-scale). */
|
|
138
|
+
readonly contentHeight: number;
|
|
139
|
+
/** Content-space X scroll offset (0 = left edge). */
|
|
140
|
+
readonly offsetX: number;
|
|
141
|
+
/** Content-space Y scroll offset (0 = top edge). */
|
|
142
|
+
readonly offsetY: number;
|
|
143
|
+
/** Scale to apply. */
|
|
144
|
+
readonly scale: number;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Compute a VirtualPaper transform that places content-space `(offsetX,
|
|
148
|
+
* offsetY)` at the viewport top-left, clamped to VirtualPaper contain
|
|
149
|
+
* semantics.
|
|
150
|
+
*
|
|
151
|
+
* Math:
|
|
152
|
+
* screen = content * scale + translate
|
|
153
|
+
* To align content point (offsetX, offsetY) with viewport top-left:
|
|
154
|
+
* translate = -(offsetX, offsetY) * scale
|
|
155
|
+
*
|
|
156
|
+
* Contain clamping per axis:
|
|
157
|
+
* - If scaledContentSize ≤ viewportSize → center the content.
|
|
158
|
+
* - Otherwise → clamp so content edges stay visible:
|
|
159
|
+
* translate ∈ [viewportSize - scaledContentSize, 0]
|
|
160
|
+
*
|
|
161
|
+
* Returns `null` when inputs are invalid (zero, negative, non-finite).
|
|
162
|
+
*/
|
|
163
|
+
export declare function computeTransformForOffset(params: ComputeTransformForOffsetParams): VirtualPaperTransform | null;
|
|
130
164
|
export {};
|
|
131
165
|
//# sourceMappingURL=rangeJumpHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rangeJumpHelpers.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/rangeJumpHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,uBAAuB,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAID,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ/D;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,oBAAoB,EAAE,EACvC,OAAO,EAAE,MAAM,GACd,oBAAoB,GAAG,IAAI,CAE7B;AAID,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAA;IAClC,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,oBAAoB,GAC1B,YAAY,GAAG,IAAI,CAoBrB;AAID;;;;;;;;;GASG;AACH,wBAA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AAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,+CAA+C;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,sBAAsB,GAC7B,qBAAqB,GAAG,IAAI,CA4C9B;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,uEAAuE;IACvE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,+BAA+B,GACtC,qBAAqB,GAAG,IAAI,CA2C9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LinkedSelectionData, LinkedSelectionRange } from '@hamster-note/selection';
|
|
2
|
-
import type { ReaderLinkedSelectionData, ReaderSelectionOverlayRectType, ReaderSelectionRange } from '../../types/selection';
|
|
2
|
+
import type { ReaderLinkedSelectionData, ReaderSelectionOverlayRectType, ReaderSelectionRectangle, ReaderSelectionRange } from '../../types/selection';
|
|
3
3
|
export type RuntimeLinkedSelectionTransient = {
|
|
4
4
|
selectionOrder?: LinkedSelectionData['selectionOrder'];
|
|
5
5
|
draggingRange?: LinkedSelectionData['draggingRange'];
|
|
@@ -19,7 +19,10 @@ export declare function mapPublicRangesToRuntime(ranges: readonly ReaderSelectio
|
|
|
19
19
|
export declare function mapRuntimeRangesToPublic(ranges: readonly LinkedSelectionRange[], scopeId: string): ReaderSelectionRange[];
|
|
20
20
|
export declare function mapRuntimeLinkedDataToPublic(data: LinkedSelectionData, scopeId: string): ReaderLinkedSelectionData;
|
|
21
21
|
export declare function buildRuntimeLinkedSelectionData({ scopeId, ranges, selectedRangeId, pageNumbers, overlayRectType, transient }: RuntimeLinkedSelectionDataInput): LinkedSelectionData;
|
|
22
|
+
export declare function mapPublicRectanglesToRuntime(rects: readonly ReaderSelectionRectangle[] | undefined, scopeId: string): ReaderSelectionRectangle[] | undefined;
|
|
23
|
+
export declare function mapRuntimeRectangleToPublic(rect: ReaderSelectionRectangle, scopeId: string): ReaderSelectionRectangle;
|
|
22
24
|
export declare function extractRuntimeLinkedTransient(data: LinkedSelectionData): RuntimeLinkedSelectionTransient;
|
|
23
25
|
export declare function areRuntimeLinkedTransientsEqual(left: RuntimeLinkedSelectionTransient, right: RuntimeLinkedSelectionTransient): boolean;
|
|
24
26
|
export declare function mapRuntimeRangeToPublic(range: LinkedSelectionRange, scopeId: string): ReaderSelectionRange | null;
|
|
27
|
+
export declare function mapRuntimeSelectionIdToPublic(selectionId: string, scopeId: string): string | null;
|
|
25
28
|
//# sourceMappingURL=selectionAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionAdapter.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/selectionAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,y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,+BAA+B,GAAG,mBAAmB,CAcvD;AAqBD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,mBAAmB,GACxB,+BAA+B,CAoBjC;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,+BAA+B,EACrC,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAOT;AA2ED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,MAAM,GACd,oBAAoB,GAAG,IAAI,CA6B7B"}
|
|
1
|
+
{"version":3,"file":"selectionAdapter.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/selectionAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,yBAAyB,EACzB,8BAA8B,EAC9B,wBAAwB,EACxB,oBAAoB,EAErB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,MAAM,+BAA+B,GAAG;IAC5C,cAAc,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;IACtD,aAAa,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAA;IACpD,aAAa,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAA;IACpD,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;CACjD,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAA;IAChD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,eAAe,EAAE,8BAA8B,CAAA;IACxD,QAAQ,CAAC,SAAS,EAAE,+BAA+B,CAAA;CACpD,CAAA;AAED,wBAAgB,s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ll: () => void;
|
|
49
49
|
}
|
|
50
|
+
type LazyPageQueueMode = 'layout' | 'text';
|
|
50
51
|
/**
|
|
51
52
|
* intermediate-document 默认模式的懒加载页面队列 hook。
|
|
52
53
|
*
|
|
@@ -61,13 +62,16 @@ export interface LazyPageQueueApi {
|
|
|
61
62
|
* → 用 `isIntermediateText`/`isIntermediateImage` 过滤 → 调用 callbacks 更新状态。
|
|
62
63
|
*/
|
|
63
64
|
export declare function useLazyPageQueue(configRef: React.MutableRefObject<LazyPageQueueConfig>, runtimeDocument: IntermediateDocument | null, options: {
|
|
65
|
+
mode?: LazyPageQueueMode;
|
|
64
66
|
activeDocumentRef: React.MutableRefObject<IntermediateDocument | null>;
|
|
65
67
|
isMountedRef: React.MutableRefObject<boolean>;
|
|
66
68
|
loadingPagesRef: React.MutableRefObject<Set<number>>;
|
|
67
|
-
getBaseImageFromPage
|
|
69
|
+
getBaseImageFromPage?: (page: unknown, scale?: number) => Promise<string | undefined>;
|
|
68
70
|
getPageContentEntries: (page: unknown) => Promise<IntermediateContent[]>;
|
|
69
71
|
isIntermediateText: (content: IntermediateContent) => content is IntermediateText;
|
|
70
|
-
isIntermediateImage
|
|
72
|
+
isIntermediateImage?: (content: IntermediateContent) => content is IntermediateImage;
|
|
71
73
|
callbacks: LazyPageQueueCallbacks;
|
|
74
|
+
effectiveScaleRef: React.MutableRefObject<number>;
|
|
72
75
|
}): LazyPageQueueApi;
|
|
76
|
+
export {};
|
|
73
77
|
//# sourceMappingURL=useLazyPageQueue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLazyPageQueue.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/useLazyPageQueue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAE5B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,sBAA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":"useLazyPageQueue.d.ts","sourceRoot":"","sources":["../../../src/components/IntermediateDocumentViewer/useLazyPageQueue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAE5B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,wBAAwB;IACxB,mBAAmB,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,CAAA;IAC5B,qCAAqC;IACrC,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,4BAA4B;IAC5B,YAAY,EAAE,CAAC,MAAM,EAAE;QACrB,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;QAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAA;QACzB,MAAM,EAAE,iBAAiB,EAAE,CAAA;KAC5B,KAAK,IAAI,CAAA;IACV,kCAAkC;IAClC,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,kCAAkC;IAClC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAA;CAC9C;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACpD,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB;AAED,KAAK,iBAAiB,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE1C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,EACtD,eAAe,EAAE,oBAAoB,GAAG,IAAI,EAC5C,OAAO,EAAE;IACP,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACxB,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAA;IACtE,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAC7C,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAIpD,oBAAoB,CAAC,EAAE,CACrB,IAAI,EAAE,OAAO,EACb,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAChC,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACxE,kBAAkB,EAAE,CAClB,OAAO,EAAE,mBAAmB,KACzB,OAAO,IAAI,gBAAgB,CAAA;IAChC,mBAAmB,CAAC,EAAE,CACpB,OAAO,EAAE,mBAAmB,KACzB,OAAO,IAAI,iBAAiB,CAAA;IACjC,SAAS,EAAE,sBAAsB,CAAA;IAEjC,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAClD,GACA,gBAAgB,CA6TlB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type DrawingTool, type DrawingValue } from '@hamster-note/painting';
|
|
2
|
+
import { type SelectionRange, type SelectionRect } from '@hamster-note/selection';
|
|
3
|
+
import type { IntermediatePageSerialized } from '@hamster-note/types';
|
|
4
|
+
export type ReaderPageTool = 'text-selection' | 'rect-selection' | 'drawing';
|
|
5
|
+
export type ReaderPagePaintingMap = Record<string, DrawingValue>;
|
|
6
|
+
export type ReaderPageTextSelectionMap = Record<string, readonly SelectionRange[]>;
|
|
7
|
+
export type ReaderPageRectSelectionMap = Record<string, readonly SelectionRect[]>;
|
|
8
|
+
export type PageProps = {
|
|
9
|
+
page: IntermediatePageSerialized;
|
|
10
|
+
selectedTool?: ReaderPageTool;
|
|
11
|
+
paintingValue?: DrawingValue;
|
|
12
|
+
paintingTool?: DrawingTool;
|
|
13
|
+
textSelections?: readonly SelectionRange[];
|
|
14
|
+
rectSelections?: readonly SelectionRect[];
|
|
15
|
+
onPaintingChange?: (nextValue: DrawingValue) => void;
|
|
16
|
+
onTextSelectionsChange?: (nextSelections: readonly SelectionRange[]) => void;
|
|
17
|
+
onRectSelectionsChange?: (nextSelections: readonly SelectionRect[]) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare function Page({ page, selectedTool, paintingValue, paintingTool, textSelections, rectSelections, onPaintingChange, onTextSelectionsChange, onRectSelectionsChange }: PageProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=Page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../src/components/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAGnB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACV,0BAA0B,EAE3B,MAAM,qBAAqB,CAAA;AAG5B,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,SAAS,CAAA;AAE5E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;AAEhE,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAC7C,MAAM,EACN,SAAS,cAAc,EAAE,CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAC7C,MAAM,EACN,SAAS,aAAa,EAAE,CACzB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,0BAA0B,CAAA;IAChC,YAAY,CAAC,EAAE,cAAc,CAAA;IAC7B,aAAa,CAAC,EAAE,YAAY,CAAA;IAC5B,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,cAAc,CAAC,EAAE,SAAS,cAAc,EAAE,CAAA;IAC1C,cAAc,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IACzC,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,IAAI,CAAA;IACpD,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,SAAS,cAAc,EAAE,KAAK,IAAI,CAAA;IAC5E,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,SAAS,aAAa,EAAE,KAAK,IAAI,CAAA;CAC5E,CAAA;AAuPD,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,YAA+B,EAC/B,aAAa,EACb,YAAoB,EACpB,cAAsC,EACtC,cAAsC,EACtC,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACvB,EAAE,SAAS,2CAsJX"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { DrawingTool, DrawingValue } from '@hamster-note/painting';
|
|
2
|
+
import type { SelectionRange, SelectionRect } from '@hamster-note/selection';
|
|
1
3
|
import type { IntermediateDocument, IntermediateDocumentSerialized, IntermediateText } from '@hamster-note/types';
|
|
2
|
-
import
|
|
4
|
+
import { type ReactNode, type Ref } from 'react';
|
|
5
|
+
import type { ReaderLinkedSelectionData, ReaderMousePosition, ReaderSelectionOverlayRectType, ReaderSelectionRange, ReaderSelectionRectangle, ReaderSelectionRef, ReaderSelectionTool } from '../types/selection';
|
|
6
|
+
import type { ReaderInteractionMode, ReaderPageRange, ReaderSelectedTextSegment, ReaderTextSelectionDetail, ReaderTouchPanMode } from './IntermediateDocumentViewer';
|
|
3
7
|
import type { IntermediateDocumentRenderTimingCallback } from './IntermediateDocumentViewer/renderTiming';
|
|
4
|
-
import
|
|
8
|
+
import { type ReaderPagePaintingMap, type ReaderPageRectSelectionMap, type ReaderPageTextSelectionMap, type ReaderPageTool } from './Page';
|
|
9
|
+
export type ReaderRenderMode = 'layout' | 'text';
|
|
5
10
|
export type ReaderProps = {
|
|
6
11
|
document?: IntermediateDocument | IntermediateDocumentSerialized | null;
|
|
7
12
|
className?: string;
|
|
@@ -15,31 +20,14 @@ export type ReaderProps = {
|
|
|
15
20
|
onOcrError?: (error: unknown, detail: {
|
|
16
21
|
pageNumber: number;
|
|
17
22
|
}) => void;
|
|
23
|
+
renderMode?: ReaderRenderMode;
|
|
18
24
|
onTextSelectionChange?: (text: IntermediateText, detail: ReaderTextSelectionDetail) => void;
|
|
19
25
|
onTextSelectionEnd?: (text: IntermediateText, detail: ReaderTextSelectionDetail) => void;
|
|
20
26
|
onSelectText?: (selection: Selection, segments: ReaderSelectedTextSegment[], extractedText: string) => void;
|
|
21
|
-
/** 交互模式,透传给 IntermediateDocumentViewer */
|
|
22
27
|
interactionMode?: ReaderInteractionMode;
|
|
23
|
-
|
|
24
|
-
* Controlled zoom scale. When provided, Reader never mutates zoom internally;
|
|
25
|
-
* wheel/pinch gestures only report the next clamped value through
|
|
26
|
-
* `onScaleChange`, and the caller must pass a new `scale` back to update the
|
|
27
|
-
* view. Invalid/non-positive values are ignored in favor of the safe default
|
|
28
|
-
* scale of `1`, clamped to the active bounds.
|
|
29
|
-
*/
|
|
28
|
+
touchPanMode?: ReaderTouchPanMode;
|
|
30
29
|
scale?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Initial zoom scale for uncontrolled mode. This value is read once on mount,
|
|
33
|
-
* defaults to `1`, and is clamped to `minScale`/`maxScale`; later
|
|
34
|
-
* `defaultScale` changes do not reset user zoom.
|
|
35
|
-
*/
|
|
36
30
|
defaultScale?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Called after a wheel or pinch gesture requests a real scale change. The
|
|
39
|
-
* first argument is the clamped next scale; `detail.source` identifies the
|
|
40
|
-
* gesture and `detail.focalPoint`, when present, is the viewport point that
|
|
41
|
-
* should remain visually anchored.
|
|
42
|
-
*/
|
|
43
31
|
onScaleChange?: (scale: number, detail: {
|
|
44
32
|
source: 'wheel' | 'pinch';
|
|
45
33
|
focalPoint?: {
|
|
@@ -47,76 +35,57 @@ export type ReaderProps = {
|
|
|
47
35
|
y: number;
|
|
48
36
|
};
|
|
49
37
|
}) => void;
|
|
50
|
-
/**
|
|
51
|
-
* Minimum allowed zoom scale. Defaults to `0.25`; invalid or non-positive
|
|
52
|
-
* values fall back to that default. If `minScale` exceeds `maxScale`, the
|
|
53
|
-
* effective maximum is raised to the minimum so the range remains safe.
|
|
54
|
-
*/
|
|
55
38
|
minScale?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Maximum allowed zoom scale. Defaults to `4`; invalid or non-positive values
|
|
58
|
-
* fall back to that default before the range is normalized.
|
|
59
|
-
*/
|
|
60
39
|
maxScale?: number;
|
|
61
|
-
/**
|
|
62
|
-
* Maximum number of concurrently loaded pages before lazy eviction. The
|
|
63
|
-
* default is `max(5, overscanPages * 2 + 5)`. Only `Infinity` disables
|
|
64
|
-
* eviction entirely; `0`, negative, `NaN`, or other invalid values fall back
|
|
65
|
-
* to the default cap. Finite values are floored by the pages that must remain
|
|
66
|
-
* protected (visible pages, overscan, in-flight work, selections, active
|
|
67
|
-
* drags, and saved-selection anchors), so the runtime may keep more pages than
|
|
68
|
-
*/
|
|
69
40
|
maxLoadedPages?: number;
|
|
70
|
-
/** 受控的已高亮 range 列表 */
|
|
71
41
|
ranges?: ReaderSelectionRange[];
|
|
72
|
-
/** 非受控模式下 ranges 的初始值 */
|
|
73
42
|
defaultRanges?: ReaderSelectionRange[];
|
|
74
|
-
/** 受控的当前选中 range ID */
|
|
75
43
|
selectedRangeId?: string | null;
|
|
76
|
-
/** 非受控模式下 selectedRangeId 的初始值 */
|
|
77
44
|
defaultSelectedRangeId?: string | null;
|
|
78
|
-
/** 用户确认高亮时触发 */
|
|
79
45
|
onSelect?: (range: ReaderSelectionRange) => void;
|
|
80
46
|
onLinkedDataChange?: (next: ReaderLinkedSelectionData) => void;
|
|
81
47
|
onLinkedSelect?: (range: ReaderSelectionRange) => void;
|
|
82
48
|
onLinkedUpdateRange?: (range: ReaderSelectionRange) => void;
|
|
83
49
|
onLinkedSelectRange?: (id: string | null) => void;
|
|
84
|
-
/** 用户点击或取消选中某个已高亮 range 时触发 */
|
|
85
50
|
onSelectRange?: (id: string | null) => void;
|
|
86
|
-
/** 用户拖动已高亮 range 的首尾手柄调整范围时触发 */
|
|
87
51
|
onUpdateRange?: (range: ReaderSelectionRange) => void;
|
|
88
|
-
/** 用户开始选择时触发(容器内 mousedown) */
|
|
89
52
|
onSelectionStart?: (mousePos: ReaderMousePosition, selection: Selection) => void;
|
|
90
|
-
/** 用户结束选择时触发(容器内 mouseup);注意 touch 选择可能不触发 */
|
|
91
53
|
onSelectionEnd?: (mousePos: ReaderMousePosition, selection: Selection) => void;
|
|
92
|
-
/** 执行高亮操作时额外触发(在 onSelect 之后) */
|
|
93
54
|
onHighlight?: (range: ReaderSelectionRange) => void;
|
|
94
|
-
/** 已确认高亮的 Overlay 颜色 */
|
|
95
55
|
highlightColor?: string;
|
|
96
|
-
/** 正在选择中的临时 Overlay 颜色 */
|
|
97
56
|
selectionColor?: string;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/** 被高亮的片段上方弹出的 Popover 内容,未提供时 fallback 到 selectionPopover */
|
|
101
|
-
highlightPopover?: React.ReactNode;
|
|
102
|
-
/** 是否在选区结束时自动触发高亮,默认为 false */
|
|
57
|
+
selectionPopover?: ReactNode;
|
|
58
|
+
highlightPopover?: ReactNode;
|
|
103
59
|
autoHighlight?: boolean;
|
|
104
|
-
|
|
105
|
-
selectionRef?: React.Ref<ReaderSelectionRef>;
|
|
106
|
-
/** 选区 Overlay 矩形坐标类型;默认 'percent' */
|
|
60
|
+
selectionRef?: Ref<ReaderSelectionRef>;
|
|
107
61
|
overlayRectType?: ReaderSelectionOverlayRectType;
|
|
108
|
-
|
|
62
|
+
tool?: ReaderSelectionTool;
|
|
63
|
+
rects?: ReaderSelectionRectangle[];
|
|
64
|
+
selectedRectId?: string | null;
|
|
65
|
+
onCreateRect?: (rect: ReaderSelectionRectangle) => void;
|
|
66
|
+
onSelectRect?: (id: string | null) => void;
|
|
67
|
+
onUpdateRect?: (rect: ReaderSelectionRectangle) => void;
|
|
109
68
|
initialLoadedPages?: number;
|
|
110
|
-
/** 并发加载页数上限,转发给 viewer,默认 3 */
|
|
111
69
|
pageLoadConcurrency?: number;
|
|
112
|
-
/** 进入可加载窗口后发起加载前的延迟(毫秒),转发给 viewer,默认 500 */
|
|
113
70
|
pageLoadEnterDelayMs?: number;
|
|
114
|
-
/** 离开可加载窗口后卸载内容的延迟(毫秒),转发给 viewer,默认 5000 */
|
|
115
71
|
pageUnloadDelayMs?: number;
|
|
116
|
-
/** intermediate-document 渲染阶段计时回调,转发给 IntermediateDocumentViewer */
|
|
117
72
|
onIntermediateDocumentRenderTiming?: IntermediateDocumentRenderTimingCallback;
|
|
73
|
+
containMarginX?: number;
|
|
74
|
+
containMarginY?: number;
|
|
75
|
+
selectedTool?: ReaderPageTool;
|
|
76
|
+
paintingTool?: DrawingTool;
|
|
77
|
+
pagePaintings?: ReaderPagePaintingMap;
|
|
78
|
+
defaultPagePaintings?: ReaderPagePaintingMap;
|
|
79
|
+
pageTextSelections?: ReaderPageTextSelectionMap;
|
|
80
|
+
defaultPageTextSelections?: ReaderPageTextSelectionMap;
|
|
81
|
+
pageRectSelections?: ReaderPageRectSelectionMap;
|
|
82
|
+
defaultPageRectSelections?: ReaderPageRectSelectionMap;
|
|
83
|
+
onPagePaintingChange?: (pageId: string, nextValue: DrawingValue, nextPaintings: ReaderPagePaintingMap) => void;
|
|
84
|
+
onPagePaintingsChange?: (nextPaintings: ReaderPagePaintingMap) => void;
|
|
85
|
+
onPageTextSelectionsChange?: (pageId: string, nextSelections: readonly SelectionRange[], nextPageSelections: ReaderPageTextSelectionMap) => void;
|
|
86
|
+
onPageRectSelectionsChange?: (pageId: string, nextSelections: readonly SelectionRect[], nextPageSelections: ReaderPageRectSelectionMap) => void;
|
|
118
87
|
};
|
|
119
88
|
export declare const SUPPORTED_UPLOAD_ACCEPT = ".pdf,application/pdf,.txt,text/plain,.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.md,.markdown,text/markdown,text/x-markdown";
|
|
120
89
|
export declare const SUPPORTED_UPLOAD_COPY = "PDF, TXT, DOCX, and Markdown";
|
|
121
|
-
export declare function Reader({ document, className, emptyText, onFileUpload, overscanPages, pageRange, ocr, onOcrError, onTextSelectionChange, onTextSelectionEnd, onSelectText, scale, defaultScale, onScaleChange, minScale, maxScale, maxLoadedPages, interactionMode, ranges, defaultRanges, selectedRangeId, defaultSelectedRangeId, onSelect, onLinkedDataChange, onLinkedSelect, onLinkedUpdateRange, onLinkedSelectRange, onSelectRange, onUpdateRange, onSelectionStart, onSelectionEnd, onHighlight, highlightColor, selectionColor, selectionPopover, highlightPopover, autoHighlight, selectionRef, overlayRectType, initialLoadedPages, pageLoadConcurrency, pageLoadEnterDelayMs, pageUnloadDelayMs, onIntermediateDocumentRenderTiming }: ReaderProps): import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
export declare function Reader({ document, className, emptyText, onFileUpload, overscanPages, pageRange, ocr, onOcrError, renderMode, onTextSelectionChange, onTextSelectionEnd, onSelectText, scale, defaultScale, onScaleChange, minScale, maxScale, maxLoadedPages, interactionMode, touchPanMode, ranges, defaultRanges, selectedRangeId, defaultSelectedRangeId, onSelect, onLinkedDataChange, onLinkedSelect, onLinkedUpdateRange, onLinkedSelectRange, onSelectRange, onUpdateRange, onSelectionStart, onSelectionEnd, onHighlight, highlightColor, selectionColor, selectionPopover, highlightPopover, autoHighlight, selectionRef, overlayRectType, tool, rects, selectedRectId, onCreateRect, onSelectRect, onUpdateRect, initialLoadedPages, pageLoadConcurrency, pageLoadEnterDelayMs, pageUnloadDelayMs, onIntermediateDocumentRenderTiming, containMarginX, containMarginY, selectedTool, paintingTool, pagePaintings, defaultPagePaintings, pageTextSelections, defaultPageTextSelections, pageRectSelections, defaultPageRectSelections, onPagePaintingChange, onPagePaintingsChange, onPageTextSelectionsChange, onPageRectSelectionsChange }: ReaderProps): import("react/jsx-runtime").JSX.Element;
|
|
122
91
|
//# sourceMappingURL=Reader.d.ts.map
|