@agilehub/agile-editor 1.5.0 → 1.6.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.
@@ -4,10 +4,12 @@ import type defaultOptions from '../options/config';
4
4
  import AgileEditor from './index.vue';
5
5
  import AgileMenuButton from './menus/button.vue';
6
6
  import AgileDialog from './modal.vue';
7
+ import AgilePreviewToolbar from './preview-toolbar/index.vue';
7
8
  import AgileTooltip from './tooltip.vue';
8
9
  /** 安装插件时可覆盖的默认编辑器配置;组件 props 优先于此处配置。 */
9
10
  export type AgileEditorOptions = Partial<typeof defaultOptions>;
10
- export type { FormattingOptions, FormattingTemplate, FormattingStyle, FormattingTableRule, FormattingImageRule, FormattingNodeRule, FormattingNodeAdapter, FormattingAdapterResult, FormattingJSONValue } from '../utils/document-formatting';
11
+ export type { FormattingOptions, FormattingTemplate, FormattingStyle, FormattingTableRule, FormattingImageRule, FormattingNodeRule, FormattingNodeAdapter, FormattingAdapterResult, FormattingJSONValue, } from '../utils/document-formatting';
12
+ export type { PreviewAnnotation, PreviewAnnotationSnapshot, PreviewAnnotationTool, PreviewAnnotationsSaveHandler, PreviewDrawingState, PreviewDrawTool, PreviewPageSettings, PreviewPoint, PreviewStrokeStyle, } from './preview-toolbar/types';
11
13
  declare const useAgileEditor: {
12
14
  /**
13
15
  * 注册编辑器组件并向组件树提供全局默认配置。
@@ -18,4 +20,4 @@ declare const useAgileEditor: {
18
20
  */
19
21
  install: (app: App, options?: AgileEditorOptions) => void;
20
22
  };
21
- export { AgileEditor as default, AgileDialog, AgileEditor, AgileMenuButton, AgileTooltip, useAgileEditor, };
23
+ export { AgileEditor as default, AgileDialog, AgileEditor, AgileMenuButton, AgilePreviewToolbar, AgileTooltip, useAgileEditor, };
@@ -1151,6 +1151,45 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
1151
1151
  preview: {
1152
1152
  title: string;
1153
1153
  disable: string;
1154
+ drawing: {
1155
+ title: string;
1156
+ hiddenTitle: string;
1157
+ tools: {
1158
+ title: string;
1159
+ rectangle: string;
1160
+ line: string;
1161
+ path: string;
1162
+ };
1163
+ color: {
1164
+ title: string;
1165
+ custom: string;
1166
+ };
1167
+ width: {
1168
+ title: string;
1169
+ thin: string;
1170
+ default: string;
1171
+ thick: string;
1172
+ extraThick: string;
1173
+ };
1174
+ strokeStyles: {
1175
+ title: string;
1176
+ solid: string;
1177
+ dashed: string;
1178
+ wavy: string;
1179
+ };
1180
+ select: string;
1181
+ deleteSelected: string;
1182
+ undo: string;
1183
+ save: string;
1184
+ saving: string;
1185
+ saved: string;
1186
+ hideAnnotations: string;
1187
+ showAnnotations: string;
1188
+ restorePage: string;
1189
+ clearAll: string;
1190
+ confirmClear: string;
1191
+ count: string;
1192
+ };
1154
1193
  countdown: {
1155
1194
  title: string;
1156
1195
  select: string;
@@ -1175,6 +1214,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
1175
1214
  remaining: string;
1176
1215
  };
1177
1216
  laserPointer: string;
1217
+ hideToolbar: string;
1178
1218
  };
1179
1219
  fullscreen: {
1180
1220
  title: string;
@@ -2376,6 +2416,45 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
2376
2416
  preview: {
2377
2417
  title: string;
2378
2418
  disable: string;
2419
+ drawing: {
2420
+ title: string;
2421
+ hiddenTitle: string;
2422
+ tools: {
2423
+ title: string;
2424
+ rectangle: string;
2425
+ line: string;
2426
+ path: string;
2427
+ };
2428
+ color: {
2429
+ title: string;
2430
+ custom: string;
2431
+ };
2432
+ width: {
2433
+ title: string;
2434
+ thin: string;
2435
+ default: string;
2436
+ thick: string;
2437
+ extraThick: string;
2438
+ };
2439
+ strokeStyles: {
2440
+ title: string;
2441
+ solid: string;
2442
+ dashed: string;
2443
+ wavy: string;
2444
+ };
2445
+ select: string;
2446
+ deleteSelected: string;
2447
+ undo: string;
2448
+ save: string;
2449
+ saving: string;
2450
+ saved: string;
2451
+ hideAnnotations: string;
2452
+ showAnnotations: string;
2453
+ restorePage: string;
2454
+ clearAll: string;
2455
+ confirmClear: string;
2456
+ count: string;
2457
+ };
2379
2458
  countdown: {
2380
2459
  title: string;
2381
2460
  select: string;
@@ -2400,6 +2479,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
2400
2479
  remaining: string;
2401
2480
  };
2402
2481
  laserPointer: string;
2482
+ hideToolbar: string;
2403
2483
  };
2404
2484
  fullscreen: {
2405
2485
  title: string;
@@ -3588,6 +3668,45 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
3588
3668
  preview: {
3589
3669
  title: string;
3590
3670
  disable: string;
3671
+ drawing: {
3672
+ title: string;
3673
+ hiddenTitle: string;
3674
+ tools: {
3675
+ title: string;
3676
+ rectangle: string;
3677
+ line: string;
3678
+ path: string;
3679
+ };
3680
+ color: {
3681
+ title: string;
3682
+ custom: string;
3683
+ };
3684
+ width: {
3685
+ title: string;
3686
+ thin: string;
3687
+ default: string;
3688
+ thick: string;
3689
+ extraThick: string;
3690
+ };
3691
+ strokeStyles: {
3692
+ title: string;
3693
+ solid: string;
3694
+ dashed: string;
3695
+ wavy: string;
3696
+ };
3697
+ select: string;
3698
+ deleteSelected: string;
3699
+ undo: string;
3700
+ save: string;
3701
+ saving: string;
3702
+ saved: string;
3703
+ hideAnnotations: string;
3704
+ showAnnotations: string;
3705
+ restorePage: string;
3706
+ clearAll: string;
3707
+ confirmClear: string;
3708
+ count: string;
3709
+ };
3591
3710
  countdown: {
3592
3711
  title: string;
3593
3712
  select: string;
@@ -3612,6 +3731,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
3612
3731
  remaining: string;
3613
3732
  };
3614
3733
  laserPointer: string;
3734
+ hideToolbar: string;
3615
3735
  };
3616
3736
  fullscreen: {
3617
3737
  title: string;
@@ -0,0 +1,58 @@
1
+ import type { PreviewAnnotation } from './types';
2
+ declare const __VLS_export: import("vue").DefineComponent<globalThis.ExtractPropTypes<{
3
+ annotation: {
4
+ type: () => PreviewAnnotation;
5
+ required: true;
6
+ };
7
+ canvasWidth: {
8
+ type: NumberConstructor;
9
+ required: true;
10
+ };
11
+ canvasHeight: {
12
+ type: NumberConstructor;
13
+ required: true;
14
+ };
15
+ hit: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ selected: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
23
+ hitStrokeWidth: {
24
+ type: NumberConstructor;
25
+ default: number;
26
+ };
27
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
28
+ annotation: {
29
+ type: () => PreviewAnnotation;
30
+ required: true;
31
+ };
32
+ canvasWidth: {
33
+ type: NumberConstructor;
34
+ required: true;
35
+ };
36
+ canvasHeight: {
37
+ type: NumberConstructor;
38
+ required: true;
39
+ };
40
+ hit: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ selected: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ hitStrokeWidth: {
49
+ type: NumberConstructor;
50
+ default: number;
51
+ };
52
+ }>> & Readonly<{}>, {
53
+ hit: boolean;
54
+ selected: boolean;
55
+ hitStrokeWidth: number;
56
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
57
+ declare const _default: typeof __VLS_export;
58
+ export default _default;
@@ -0,0 +1,91 @@
1
+ import type { PreviewAnnotation, PreviewDrawingState, PreviewDrawTool, PreviewStrokeStyle } from './types';
2
+ declare const __VLS_export: import("vue").DefineComponent<globalThis.ExtractPropTypes<{
3
+ target: {
4
+ type: () => HTMLElement;
5
+ required: true;
6
+ };
7
+ tool: {
8
+ type: () => PreviewDrawTool | null;
9
+ default: any;
10
+ };
11
+ strokeStyle: {
12
+ type: () => PreviewStrokeStyle;
13
+ default: string;
14
+ };
15
+ zoomLevel: {
16
+ type: NumberConstructor;
17
+ default: number;
18
+ };
19
+ color: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ strokeWidth: {
24
+ type: NumberConstructor;
25
+ default: number;
26
+ };
27
+ showAnnotations: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ }>, {
32
+ getAnnotations: () => PreviewAnnotation[];
33
+ setAnnotations: (items: PreviewAnnotation[]) => void;
34
+ undo: () => boolean;
35
+ deleteSelected: () => boolean;
36
+ clearAll: () => boolean;
37
+ cancelInteraction: () => boolean;
38
+ clearSelection: () => void;
39
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
40
+ "selection-change": (annotationId: string) => any;
41
+ "state-change": (state: PreviewDrawingState) => any;
42
+ "annotation-add": (annotation: PreviewAnnotation) => any;
43
+ "annotation-delete": (annotationId: string) => any;
44
+ "annotations-clear": () => any;
45
+ "annotations-change": (annotations: PreviewAnnotation[]) => any;
46
+ }, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
47
+ target: {
48
+ type: () => HTMLElement;
49
+ required: true;
50
+ };
51
+ tool: {
52
+ type: () => PreviewDrawTool | null;
53
+ default: any;
54
+ };
55
+ strokeStyle: {
56
+ type: () => PreviewStrokeStyle;
57
+ default: string;
58
+ };
59
+ zoomLevel: {
60
+ type: NumberConstructor;
61
+ default: number;
62
+ };
63
+ color: {
64
+ type: StringConstructor;
65
+ default: string;
66
+ };
67
+ strokeWidth: {
68
+ type: NumberConstructor;
69
+ default: number;
70
+ };
71
+ showAnnotations: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
75
+ }>> & Readonly<{
76
+ "onSelection-change"?: (annotationId: string) => any;
77
+ "onState-change"?: (state: PreviewDrawingState) => any;
78
+ "onAnnotation-add"?: (annotation: PreviewAnnotation) => any;
79
+ "onAnnotation-delete"?: (annotationId: string) => any;
80
+ "onAnnotations-clear"?: () => any;
81
+ "onAnnotations-change"?: (annotations: PreviewAnnotation[]) => any;
82
+ }>, {
83
+ color: string;
84
+ showAnnotations: boolean;
85
+ zoomLevel: number;
86
+ tool: PreviewDrawTool;
87
+ strokeStyle: PreviewStrokeStyle;
88
+ strokeWidth: number;
89
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
90
+ declare const _default: typeof __VLS_export;
91
+ export default _default;
@@ -0,0 +1,56 @@
1
+ import type { PreviewAnnotation, PreviewPoint } from './types';
2
+ /** 将数值限制在指定范围内,用于约束归一化坐标和线宽。 */
3
+ export declare const clamp: (value: number, min: number, max: number) => number;
4
+ /** 计算两个二维点之间的欧氏距离。 */
5
+ export declare const distance: (a: PreviewPoint, b: PreviewPoint) => number;
6
+ /**
7
+ * 根据一次拖拽开始时的面板位置和指针位移计算新位置。
8
+ * 每次按下都传入新的起始位置,避免连续拖拽复用上一次的坐标状态。
9
+ */
10
+ export declare function getBoundedPanelPosition(panelStart: PreviewPoint, pointerDelta: PreviewPoint, panelSize: PreviewPoint, viewportSize: PreviewPoint, viewportPadding?: number): {
11
+ x: number;
12
+ y: number;
13
+ };
14
+ /**
15
+ * 检测最新轨迹片段是否回到起始轨迹附近。
16
+ * 同时支持“端点靠近起点”和“末端与起始线段重合”两种闭合方式。
17
+ */
18
+ export declare function isPathClosing(points: PreviewPoint[], closeRadius: number, minimumDistance: number): boolean;
19
+ /**
20
+ * 使用 Ramer-Douglas-Peucker 算法压缩自由轨迹点。
21
+ * 降低点数可以显著减少 SVG 更新和后续持久化成本。
22
+ */
23
+ export declare function simplifyPath(points: PreviewPoint[], tolerance: number): PreviewPoint[];
24
+ export declare const toCanvasPoints: (points: PreviewPoint[], width: number, height: number) => {
25
+ x: number;
26
+ y: number;
27
+ }[];
28
+ /** 将点集合转换为 SVG 折线路径,闭合轨迹末尾追加 Z 指令。 */
29
+ export declare function toPolylinePath(points: PreviewPoint[], closed?: boolean): string;
30
+ /**
31
+ * 将直线转换为围绕原线段上下偏移的正弦波路径。
32
+ * 首尾振幅固定为零,便于矩形四条边在转角处准确衔接。
33
+ */
34
+ export declare function toWavySegment(start: PreviewPoint, end: PreviewPoint, amplitude?: number, wavelength?: number): PreviewPoint[];
35
+ export declare function getRectangle(start: PreviewPoint, end: PreviewPoint): {
36
+ x: number;
37
+ y: number;
38
+ width: number;
39
+ height: number;
40
+ };
41
+ /**
42
+ * 将四条边分别转换为波浪线并拼成闭合矩形。
43
+ * 每条边首尾振幅为零,因此转角处不会出现超出矩形范围的重叠。
44
+ */
45
+ export declare function toWavyRectanglePath(start: PreviewPoint, end: PreviewPoint, amplitude?: number, wavelength?: number): string;
46
+ export declare function toWavyLinePath(start: PreviewPoint, end: PreviewPoint, amplitude?: number, wavelength?: number): string;
47
+ /**
48
+ * 计算标注的外接矩形,用于选择态边框。
49
+ * 矩形标注只需要首尾两个点,自由轨迹需要遍历全部采样点。
50
+ */
51
+ export declare function getAnnotationBounds(annotation: PreviewAnnotation): {
52
+ x: number;
53
+ y: number;
54
+ width: number;
55
+ height: number;
56
+ };
@@ -0,0 +1,200 @@
1
+ import type { PropType } from 'vue';
2
+ import type { PreviewAnnotation, PreviewAnnotationSnapshot, PreviewAnnotationsSaveHandler, PreviewDrawTool, PreviewPageSettings, PreviewStrokeStyle } from './types';
3
+ type PreviewToolbarAttach = string | ((triggerNode?: HTMLElement) => HTMLElement | Element | Document);
4
+ type PreviewDrawingTarget = string | HTMLElement;
5
+ declare const __VLS_export: import("vue").DefineComponent<globalThis.ExtractPropTypes<{
6
+ layout: {
7
+ type: PropType<"page" | "web">;
8
+ default: string;
9
+ };
10
+ zoomLevel: {
11
+ type: NumberConstructor;
12
+ default: number;
13
+ };
14
+ minZoom: {
15
+ type: NumberConstructor;
16
+ default: number;
17
+ };
18
+ maxZoom: {
19
+ type: NumberConstructor;
20
+ default: number;
21
+ };
22
+ autoWidth: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ laserPointer: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ floating: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ visible: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ attach: {
39
+ type: PropType<PreviewToolbarAttach>;
40
+ default: any;
41
+ };
42
+ drawingTarget: {
43
+ type: PropType<PreviewDrawingTarget>;
44
+ default: any;
45
+ };
46
+ drawingColor: {
47
+ type: StringConstructor;
48
+ default: string;
49
+ };
50
+ drawingWidth: {
51
+ type: NumberConstructor;
52
+ default: number;
53
+ };
54
+ pageSettings: {
55
+ type: PropType<PreviewPageSettings>;
56
+ default: any;
57
+ };
58
+ onAnnotationsSave: {
59
+ type: PropType<PreviewAnnotationsSaveHandler>;
60
+ default: any;
61
+ };
62
+ }>, {
63
+ getAnnotations: () => {
64
+ points: {
65
+ x: number;
66
+ y: number;
67
+ }[];
68
+ id: string;
69
+ tool: import("./types").PreviewAnnotationTool;
70
+ closed: boolean;
71
+ strokeStyle: PreviewStrokeStyle;
72
+ color: string;
73
+ strokeWidth: number;
74
+ }[];
75
+ serializeAnnotations: () => string;
76
+ setAnnotations: (items: PreviewAnnotation[]) => void;
77
+ restoreAnnotations: (value: PreviewAnnotationSnapshot | string) => boolean;
78
+ clearAnnotations: () => boolean;
79
+ saveAnnotations: () => Promise<boolean>;
80
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
81
+ hide: () => any;
82
+ "selection-change": (annotationId: string) => any;
83
+ "countdown-change": (value: string) => any;
84
+ "annotation-add": (annotation: PreviewAnnotation) => any;
85
+ "annotation-delete": (annotationId: string) => any;
86
+ "annotations-clear": () => any;
87
+ "annotations-change": (annotations: PreviewAnnotation[]) => any;
88
+ "zoom-in": () => any;
89
+ "zoom-out": () => any;
90
+ "auto-width": () => any;
91
+ "update:laserPointer": (value: boolean) => any;
92
+ "laser-pointer-change": (value: boolean) => any;
93
+ "countdown-exit": () => any;
94
+ "draw-tool-change": (tool: PreviewDrawTool) => any;
95
+ "stroke-style-change": (style: PreviewStrokeStyle) => any;
96
+ "drawing-color-change": (color: string) => any;
97
+ "drawing-width-change": (width: number) => any;
98
+ "annotations-undo": () => any;
99
+ "save-annotations": (snapshot: PreviewAnnotationSnapshot) => any;
100
+ "restore-annotation-page": (settings: PreviewPageSettings) => any;
101
+ "drawing-ready": () => any;
102
+ "annotations-visibility-change": (visible: boolean) => any;
103
+ }, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
104
+ layout: {
105
+ type: PropType<"page" | "web">;
106
+ default: string;
107
+ };
108
+ zoomLevel: {
109
+ type: NumberConstructor;
110
+ default: number;
111
+ };
112
+ minZoom: {
113
+ type: NumberConstructor;
114
+ default: number;
115
+ };
116
+ maxZoom: {
117
+ type: NumberConstructor;
118
+ default: number;
119
+ };
120
+ autoWidth: {
121
+ type: BooleanConstructor;
122
+ default: boolean;
123
+ };
124
+ laserPointer: {
125
+ type: BooleanConstructor;
126
+ default: boolean;
127
+ };
128
+ floating: {
129
+ type: BooleanConstructor;
130
+ default: boolean;
131
+ };
132
+ visible: {
133
+ type: BooleanConstructor;
134
+ default: boolean;
135
+ };
136
+ attach: {
137
+ type: PropType<PreviewToolbarAttach>;
138
+ default: any;
139
+ };
140
+ drawingTarget: {
141
+ type: PropType<PreviewDrawingTarget>;
142
+ default: any;
143
+ };
144
+ drawingColor: {
145
+ type: StringConstructor;
146
+ default: string;
147
+ };
148
+ drawingWidth: {
149
+ type: NumberConstructor;
150
+ default: number;
151
+ };
152
+ pageSettings: {
153
+ type: PropType<PreviewPageSettings>;
154
+ default: any;
155
+ };
156
+ onAnnotationsSave: {
157
+ type: PropType<PreviewAnnotationsSaveHandler>;
158
+ default: any;
159
+ };
160
+ }>> & Readonly<{
161
+ onHide?: () => any;
162
+ "onSelection-change"?: (annotationId: string) => any;
163
+ "onCountdown-change"?: (value: string) => any;
164
+ "onAnnotation-add"?: (annotation: PreviewAnnotation) => any;
165
+ "onAnnotation-delete"?: (annotationId: string) => any;
166
+ "onAnnotations-clear"?: () => any;
167
+ "onAnnotations-change"?: (annotations: PreviewAnnotation[]) => any;
168
+ "onZoom-in"?: () => any;
169
+ "onZoom-out"?: () => any;
170
+ "onAuto-width"?: () => any;
171
+ "onUpdate:laserPointer"?: (value: boolean) => any;
172
+ "onLaser-pointer-change"?: (value: boolean) => any;
173
+ "onCountdown-exit"?: () => any;
174
+ "onDraw-tool-change"?: (tool: PreviewDrawTool) => any;
175
+ "onStroke-style-change"?: (style: PreviewStrokeStyle) => any;
176
+ "onDrawing-color-change"?: (color: string) => any;
177
+ "onDrawing-width-change"?: (width: number) => any;
178
+ "onAnnotations-undo"?: () => any;
179
+ "onSave-annotations"?: (snapshot: PreviewAnnotationSnapshot) => any;
180
+ "onRestore-annotation-page"?: (settings: PreviewPageSettings) => any;
181
+ "onDrawing-ready"?: () => any;
182
+ "onAnnotations-visibility-change"?: (visible: boolean) => any;
183
+ }>, {
184
+ layout: "page" | "web";
185
+ autoWidth: boolean;
186
+ laserPointer: boolean;
187
+ visible: boolean;
188
+ zoomLevel: number;
189
+ attach: PreviewToolbarAttach;
190
+ minZoom: number;
191
+ maxZoom: number;
192
+ floating: boolean;
193
+ drawingTarget: PreviewDrawingTarget;
194
+ drawingColor: string;
195
+ drawingWidth: number;
196
+ pageSettings: PreviewPageSettings;
197
+ onAnnotationsSave: PreviewAnnotationsSaveHandler;
198
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
199
+ declare const _default: typeof __VLS_export;
200
+ export default _default;
@@ -0,0 +1,48 @@
1
+ /** 预览工具栏当前交互工具。select 只用于选择已有标注。 */
2
+ export type PreviewDrawTool = 'select' | 'rectangle' | 'line' | 'path';
3
+ /** 会实际生成标注图形的工具。 */
4
+ export type PreviewAnnotationTool = Exclude<PreviewDrawTool, 'select'>;
5
+ /** 矩形和直线支持的 SVG 描边样式。 */
6
+ export type PreviewStrokeStyle = 'solid' | 'dashed' | 'wavy';
7
+ /** 相对文档页面左上角的归一化坐标,取值范围为 0–1。 */
8
+ export interface PreviewPoint {
9
+ x: number;
10
+ y: number;
11
+ }
12
+ /** 保存标注时的页面宽度和四边边距,单位均为 px。 */
13
+ export interface PreviewPageSettings {
14
+ width: number;
15
+ margin: {
16
+ left: number;
17
+ right: number;
18
+ top: number;
19
+ bottom: number;
20
+ };
21
+ }
22
+ /**
23
+ * 单条标注的持久化结构。
24
+ * 该对象只依赖归一化坐标,不保存屏幕位置,因此可跨滚动、缩放和窗口尺寸恢复。
25
+ */
26
+ export interface PreviewAnnotation {
27
+ id: string;
28
+ tool: PreviewAnnotationTool;
29
+ points: PreviewPoint[];
30
+ closed: boolean;
31
+ strokeStyle: PreviewStrokeStyle;
32
+ color: string;
33
+ strokeWidth: number;
34
+ }
35
+ /** 绘制层向工具栏回传的运行时状态。 */
36
+ export interface PreviewDrawingState {
37
+ annotations: PreviewAnnotation[];
38
+ canUndo: boolean;
39
+ selectedId: string | null;
40
+ }
41
+ /** 保存到业务系统的版本化快照,后续结构升级可通过 version 做迁移。 */
42
+ export interface PreviewAnnotationSnapshot {
43
+ version: 1;
44
+ page?: PreviewPageSettings;
45
+ annotations: PreviewAnnotation[];
46
+ }
47
+ /** 保存按钮和业务回调共用的快照处理器。 */
48
+ export type PreviewAnnotationsSaveHandler = (snapshot: PreviewAnnotationSnapshot) => void | Promise<void>;
@@ -1,27 +1,39 @@
1
- declare var __VLS_7: {};
1
+ import type { PropType } from "vue";
2
+ type CountdownAttach = string | ((triggerNode?: HTMLElement) => HTMLElement | Element | Document);
3
+ declare var __VLS_9: {};
2
4
  type __VLS_Slots = {} & {
3
- default?: (props: typeof __VLS_7) => any;
5
+ default?: (props: typeof __VLS_9) => any;
4
6
  };
5
7
  declare const __VLS_base: import("vue").DefineComponent<globalThis.ExtractPropTypes<{
6
8
  visible: {
7
9
  type: BooleanConstructor;
8
- require: boolean;
10
+ required: true;
11
+ };
12
+ attach: {
13
+ type: PropType<CountdownAttach>;
14
+ default: any;
9
15
  };
10
16
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
17
  close: (...args: any[]) => void;
12
18
  "countdown-change": (...args: any[]) => void;
13
- "exit-preivew": (...args: any[]) => void;
19
+ "exit-preview": (...args: any[]) => void;
20
+ "visible-change": (...args: any[]) => void;
14
21
  }, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
15
22
  visible: {
16
23
  type: BooleanConstructor;
17
- require: boolean;
24
+ required: true;
25
+ };
26
+ attach: {
27
+ type: PropType<CountdownAttach>;
28
+ default: any;
18
29
  };
19
30
  }>> & Readonly<{
20
31
  onClose?: (...args: any[]) => any;
21
32
  "onCountdown-change"?: (...args: any[]) => any;
22
- "onExit-preivew"?: (...args: any[]) => any;
33
+ "onExit-preview"?: (...args: any[]) => any;
34
+ "onVisible-change"?: (...args: any[]) => any;
23
35
  }>, {
24
- visible: boolean;
36
+ attach: CountdownAttach;
25
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
38
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
27
39
  declare const _default: typeof __VLS_export;