@koi-br/ocr-web-sdk 1.0.48 → 1.0.49

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.js CHANGED
@@ -12,4 +12,4 @@
12
12
  }
13
13
  })();
14
14
 
15
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-BPOvXxGT.js");exports.DocxPreview=e._sfc_main;exports.FilePreview=e.FilePreview;exports.ImagePreview=e.ImagePreview;exports.OfdPreview=e.OfdPreview;exports.PdfPreview=e.PdfPreview;exports.SyncScrollManager=e.SyncScrollManager;exports.TifPreview=e.TifPreview;exports.XlsxPreview=e.XLSXPreview;exports.default=e.FilePreview;exports.loadTiffLibrary=e.loadTiffLibrary;exports.useSyncScroll=e.useSyncScroll;
15
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-Ckidl9JZ.js");exports.ConnectionLineManager=e.ConnectionLineManager;exports.DocxPreview=e._sfc_main;exports.FilePreview=e.FilePreview;exports.ImagePreview=e.ImagePreview;exports.OfdPreview=e.OfdPreview;exports.PdfPreview=e.PdfPreview;exports.SyncScrollManager=e.SyncScrollManager;exports.TifPreview=e.TifPreview;exports.XlsxPreview=e.XLSXPreview;exports.default=e.FilePreview;exports.loadTiffLibrary=e.loadTiffLibrary;exports.useConnectionLine=e.useConnectionLine;exports.useSyncScroll=e.useSyncScroll;
package/dist/index.esm.js CHANGED
@@ -12,17 +12,19 @@
12
12
  }
13
13
  })();
14
14
 
15
- import { _ as r, F as s, I as i, O as l, P, S as f, T as v, X as w, F as o, l as c, u as S } from "./index-CUF5xedC.mjs";
15
+ import { C as s, _ as i, F as r, I as n, O as o, P as l, S as P, T as c, X as f, F as v, l as w, b as S, u as d } from "./index-CtN6JtmF.mjs";
16
16
  export {
17
- r as DocxPreview,
18
- s as FilePreview,
19
- i as ImagePreview,
20
- l as OfdPreview,
21
- P as PdfPreview,
22
- f as SyncScrollManager,
23
- v as TifPreview,
24
- w as XlsxPreview,
25
- o as default,
26
- c as loadTiffLibrary,
27
- S as useSyncScroll
17
+ s as ConnectionLineManager,
18
+ i as DocxPreview,
19
+ r as FilePreview,
20
+ n as ImagePreview,
21
+ o as OfdPreview,
22
+ l as PdfPreview,
23
+ P as SyncScrollManager,
24
+ c as TifPreview,
25
+ f as XlsxPreview,
26
+ v as default,
27
+ w as loadTiffLibrary,
28
+ S as useConnectionLine,
29
+ d as useSyncScroll
28
30
  };
@@ -0,0 +1,105 @@
1
+ /**
2
+ * 编辑器定位信息
3
+ */
4
+ export interface EditorPosition {
5
+ editorId: string;
6
+ pageNum: number;
7
+ bbox: [number, number, number, number];
8
+ element?: HTMLElement;
9
+ container?: HTMLElement;
10
+ showConnectionLine?: boolean;
11
+ strokeColor?: string;
12
+ strokeWidth?: number;
13
+ }
14
+ /**
15
+ * 连接线配置
16
+ */
17
+ export interface ConnectionLineConfig {
18
+ enabled?: boolean;
19
+ strokeColor?: string;
20
+ strokeWidth?: number;
21
+ strokeDasharray?: string;
22
+ zIndex?: number;
23
+ enableAnimation?: boolean;
24
+ animationDuration?: number;
25
+ cornerRadius?: number;
26
+ }
27
+ /**
28
+ * 连接线管理器
29
+ */
30
+ export declare class ConnectionLineManager {
31
+ private editors;
32
+ private svgElement;
33
+ private container;
34
+ private config;
35
+ private updateTimer;
36
+ private resizeObserver;
37
+ constructor(config?: ConnectionLineConfig);
38
+ /**
39
+ * 设置容器(连接线将绘制在这个容器内)
40
+ */
41
+ setContainer(container: HTMLElement): void;
42
+ /**
43
+ * 创建 SVG 元素用于绘制连接线
44
+ */
45
+ private createSVG;
46
+ /**
47
+ * 注册编辑器位置
48
+ */
49
+ registerPosition(position: EditorPosition): void;
50
+ /**
51
+ * 移除编辑器位置
52
+ */
53
+ removePosition(editorId: string): void;
54
+ /**
55
+ * 清除所有位置
56
+ */
57
+ clear(): void;
58
+ /**
59
+ * 获取元素在视口中的实际位置(考虑滚动和变换)
60
+ * @param element 文本块元素
61
+ * @param targetElement 目标元素(用于计算从哪个边缘开始)
62
+ * @returns 文本块边缘的位置
63
+ */
64
+ private getElementViewportPosition;
65
+ /**
66
+ * 根据 bbox 和容器计算在视口中的位置
67
+ */
68
+ private getBboxViewportPosition;
69
+ /**
70
+ * 更新连接线
71
+ */
72
+ private updateLine;
73
+ /**
74
+ * 绘制连接线
75
+ */
76
+ private drawLine;
77
+ /**
78
+ * 创建带两个转折点的路径(Z形,两个折点都是直角)
79
+ * @param x1 起点x坐标
80
+ * @param y1 起点y坐标
81
+ * @param x2 终点x坐标
82
+ * @param y2 终点y坐标
83
+ * @returns SVG path 字符串
84
+ */
85
+ private createTurnPath;
86
+ /**
87
+ * 更新配置
88
+ */
89
+ updateConfig(config: Partial<ConnectionLineConfig>): void;
90
+ /**
91
+ * 销毁
92
+ */
93
+ destroy(): void;
94
+ }
95
+ /**
96
+ * Vue Composable: 使用连接线
97
+ */
98
+ export declare function useConnectionLine(config?: ConnectionLineConfig): {
99
+ manager: ConnectionLineManager;
100
+ setContainer: (container: HTMLElement) => void;
101
+ registerPosition: (position: EditorPosition) => void;
102
+ removePosition: (editorId: string) => void;
103
+ clear: () => void;
104
+ updateConfig: (newConfig: Partial<ConnectionLineConfig>) => void;
105
+ };
@@ -11,4 +11,5 @@ export { FilePreview };
11
11
  export { PdfPreview, ImagePreview, XlsxPreview, DocxPreview, OfdPreview, TifPreview, };
12
12
  export { loadTiffLibrary };
13
13
  export { useSyncScroll, SyncScrollManager, type SyncScrollConfig, type ScrollInfo, } from './composables/useSyncScroll';
14
+ export { useConnectionLine, ConnectionLineManager, type ConnectionLineConfig, type EditorPosition, } from './composables/useConnectionLine';
14
15
  export default FilePreview;
@@ -1,4 +1,4 @@
1
- import { g as getAugmentedNamespace, a as getDefaultExportFromCjs } from "./index-CUF5xedC.mjs";
1
+ import { g as getAugmentedNamespace, a as getDefaultExportFromCjs } from "./index-CtN6JtmF.mjs";
2
2
  function _mergeNamespaces(U, W) {
3
3
  for (var Z = 0; Z < W.length; Z++) {
4
4
  const s0 = W[Z];