@agilehub/agile-editor 1.4.1 → 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.
Files changed (38) hide show
  1. package/README.md +367 -225
  2. package/dist/agile-editor.css +1 -1
  3. package/dist/agile-editor.js +10054 -7692
  4. package/dist/types/components/editor/index.vue.d.ts +2 -2
  5. package/dist/types/components/index.d.ts +4 -2
  6. package/dist/types/components/index.vue.d.ts +186 -12
  7. package/dist/types/components/menus/toolbar/tools/bubble-note.vue.d.ts +22 -1
  8. package/dist/types/components/preview-toolbar/annotation-shape.vue.d.ts +58 -0
  9. package/dist/types/components/preview-toolbar/drawing-layer.vue.d.ts +91 -0
  10. package/dist/types/components/preview-toolbar/geometry.d.ts +56 -0
  11. package/dist/types/components/preview-toolbar/index.vue.d.ts +200 -0
  12. package/dist/types/components/preview-toolbar/types.d.ts +48 -0
  13. package/dist/types/components/statusbar/countdown.vue.d.ts +19 -7
  14. package/dist/types/components/toolbar/classic.vue.d.ts +13 -13
  15. package/dist/types/components/toolbar/ribbon.vue.d.ts +7 -7
  16. package/dist/types/composables/i18n.d.ts +186 -12
  17. package/dist/types/extensions/bubble-note.d.ts +3 -0
  18. package/dist/types/extensions/element-style.d.ts +0 -1
  19. package/dist/types/extensions/footnotes/utils.d.ts +1 -0
  20. package/dist/types/i18n.d.ts +186 -12
  21. package/dist/types/options/config/dicts.d.ts +8 -0
  22. package/dist/types/options/config/index.d.ts +10 -1
  23. package/dist/types/utils/bubble-note-icon.d.ts +19 -0
  24. package/dist/types/utils/docx-json.d.ts +4 -1
  25. package/dist/types/utils/html-element-id.d.ts +9 -0
  26. package/dist/types/utils/html-id.d.ts +1 -0
  27. package/dist/types/utils/iframe.d.ts +5 -0
  28. package/dist/types/utils/style-target.d.ts +49 -0
  29. package/docs/README.md +40 -40
  30. package/docs/api.md +155 -155
  31. package/docs/architecture.md +133 -133
  32. package/docs/configuration.md +233 -233
  33. package/docs/custom-components.md +427 -277
  34. package/docs/development.md +85 -85
  35. package/docs/faq.md +98 -98
  36. package/docs/features.md +181 -181
  37. package/docs/menu-extension.md +276 -276
  38. package/package.json +12 -10
@@ -1,9 +1,9 @@
1
- declare var __VLS_18: {
1
+ declare var __VLS_23: {
2
2
  nodeType: any;
3
3
  nodeAttrs: any;
4
4
  };
5
5
  type __VLS_Slots = {} & {
6
- bubble_menu?: (props: typeof __VLS_18) => any;
6
+ bubble_menu?: (props: typeof __VLS_23) => any;
7
7
  };
8
8
  declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
9
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -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, };
@@ -439,6 +439,8 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
439
439
  placeholder: string;
440
440
  };
441
441
  footnote: string;
442
+ insertFootnote: string;
443
+ deleteFootnote: string;
442
444
  prompt: {
443
445
  text: string;
444
446
  title: string;
@@ -779,6 +781,9 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
779
781
  "bubble-note": {
780
782
  title: string;
781
783
  note: string;
784
+ "note-title": string;
785
+ "note-title-color": string;
786
+ "note-title-placeholder": string;
782
787
  annotation: string;
783
788
  "line-color": string;
784
789
  "line-type": string;
@@ -790,6 +795,23 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
790
795
  wavy: string;
791
796
  };
792
797
  placeholder: string;
798
+ "selection-required-error": string;
799
+ "non-text-content-error": string;
800
+ "cross-paragraph-error": string;
801
+ "max-length-error": string;
802
+ "already-exists-error": string;
803
+ "reference-link": string;
804
+ "reference-link-placeholder": string;
805
+ "invalid-reference-link": string;
806
+ "reference-icon": string;
807
+ "reference-icon-builtin": string;
808
+ "reference-icon-upload": string;
809
+ "reference-icon-placeholder": string;
810
+ "reference-icon-invalid": string;
811
+ "reference-icon-upload-failed": string;
812
+ edit: string;
813
+ delete: string;
814
+ "open-reference": string;
793
815
  cancel: string;
794
816
  confirm: string;
795
817
  };
@@ -1079,10 +1101,6 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
1079
1101
  hide: string;
1080
1102
  empty: string;
1081
1103
  };
1082
- spellcheck: {
1083
- enable: string;
1084
- disable: string;
1085
- };
1086
1104
  shortcut: {
1087
1105
  title: string;
1088
1106
  text: string;
@@ -1133,6 +1151,45 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
1133
1151
  preview: {
1134
1152
  title: string;
1135
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
+ };
1136
1193
  countdown: {
1137
1194
  title: string;
1138
1195
  select: string;
@@ -1157,6 +1214,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
1157
1214
  remaining: string;
1158
1215
  };
1159
1216
  laserPointer: string;
1217
+ hideToolbar: string;
1160
1218
  };
1161
1219
  fullscreen: {
1162
1220
  title: string;
@@ -1641,6 +1699,8 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
1641
1699
  placeholder: string;
1642
1700
  };
1643
1701
  footnote: string;
1702
+ insertFootnote: string;
1703
+ deleteFootnote: string;
1644
1704
  prompt: {
1645
1705
  text: string;
1646
1706
  title: string;
@@ -1996,6 +2056,9 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
1996
2056
  "bubble-note": {
1997
2057
  title: string;
1998
2058
  note: string;
2059
+ "note-title": string;
2060
+ "note-title-color": string;
2061
+ "note-title-placeholder": string;
1999
2062
  annotation: string;
2000
2063
  "line-color": string;
2001
2064
  "line-type": string;
@@ -2007,6 +2070,23 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
2007
2070
  wavy: string;
2008
2071
  };
2009
2072
  placeholder: string;
2073
+ "selection-required-error": string;
2074
+ "non-text-content-error": string;
2075
+ "cross-paragraph-error": string;
2076
+ "max-length-error": string;
2077
+ "already-exists-error": string;
2078
+ "reference-link": string;
2079
+ "reference-link-placeholder": string;
2080
+ "invalid-reference-link": string;
2081
+ "reference-icon": string;
2082
+ "reference-icon-builtin": string;
2083
+ "reference-icon-upload": string;
2084
+ "reference-icon-placeholder": string;
2085
+ "reference-icon-invalid": string;
2086
+ "reference-icon-upload-failed": string;
2087
+ edit: string;
2088
+ delete: string;
2089
+ "open-reference": string;
2010
2090
  cancel: string;
2011
2091
  confirm: string;
2012
2092
  };
@@ -2286,10 +2366,6 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
2286
2366
  hide: string;
2287
2367
  empty: string;
2288
2368
  };
2289
- spellcheck: {
2290
- enable: string;
2291
- disable: string;
2292
- };
2293
2369
  shortcut: {
2294
2370
  title: string;
2295
2371
  text: string;
@@ -2340,6 +2416,45 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
2340
2416
  preview: {
2341
2417
  title: string;
2342
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
+ };
2343
2458
  countdown: {
2344
2459
  title: string;
2345
2460
  select: string;
@@ -2364,6 +2479,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
2364
2479
  remaining: string;
2365
2480
  };
2366
2481
  laserPointer: string;
2482
+ hideToolbar: string;
2367
2483
  };
2368
2484
  fullscreen: {
2369
2485
  title: string;
@@ -2835,6 +2951,8 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
2835
2951
  placeholder: string;
2836
2952
  };
2837
2953
  footnote: string;
2954
+ insertFootnote: string;
2955
+ deleteFootnote: string;
2838
2956
  prompt: {
2839
2957
  text: string;
2840
2958
  title: string;
@@ -3190,6 +3308,9 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
3190
3308
  "bubble-note": {
3191
3309
  title: string;
3192
3310
  note: string;
3311
+ "note-title": string;
3312
+ "note-title-color": string;
3313
+ "note-title-placeholder": string;
3193
3314
  annotation: string;
3194
3315
  "line-color": string;
3195
3316
  "line-type": string;
@@ -3201,6 +3322,23 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
3201
3322
  wavy: string;
3202
3323
  };
3203
3324
  placeholder: string;
3325
+ "selection-required-error": string;
3326
+ "non-text-content-error": string;
3327
+ "cross-paragraph-error": string;
3328
+ "max-length-error": string;
3329
+ "already-exists-error": string;
3330
+ "reference-link": string;
3331
+ "reference-link-placeholder": string;
3332
+ "invalid-reference-link": string;
3333
+ "reference-icon": string;
3334
+ "reference-icon-builtin": string;
3335
+ "reference-icon-upload": string;
3336
+ "reference-icon-placeholder": string;
3337
+ "reference-icon-invalid": string;
3338
+ "reference-icon-upload-failed": string;
3339
+ edit: string;
3340
+ delete: string;
3341
+ "open-reference": string;
3204
3342
  cancel: string;
3205
3343
  confirm: string;
3206
3344
  };
@@ -3480,10 +3618,6 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
3480
3618
  hide: string;
3481
3619
  empty: string;
3482
3620
  };
3483
- spellcheck: {
3484
- enable: string;
3485
- disable: string;
3486
- };
3487
3621
  shortcut: {
3488
3622
  title: string;
3489
3623
  text: string;
@@ -3534,6 +3668,45 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
3534
3668
  preview: {
3535
3669
  title: string;
3536
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
+ };
3537
3710
  countdown: {
3538
3711
  title: string;
3539
3712
  select: string;
@@ -3558,6 +3731,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
3558
3731
  remaining: string;
3559
3732
  };
3560
3733
  laserPointer: string;
3734
+ hideToolbar: string;
3561
3735
  };
3562
3736
  fullscreen: {
3563
3737
  title: string;
@@ -1,3 +1,24 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const __VLS_export: import("vue").DefineComponent<globalThis.ExtractPropTypes<{
2
+ dialogOnly: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ triggerOnly: {
7
+ type: BooleanConstructor;
8
+ default: boolean;
9
+ };
10
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
11
+ dialogOnly: {
12
+ type: BooleanConstructor;
13
+ default: boolean;
14
+ };
15
+ triggerOnly: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ }>> & Readonly<{}>, {
20
+ dialogOnly: boolean;
21
+ triggerOnly: boolean;
22
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
23
  declare const _default: typeof __VLS_export;
3
24
  export default _default;
@@ -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
+ };