yui-image-editor 1.0.3 → 1.0.4

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.
@@ -115,3 +115,16 @@ export declare const zhLocale: {
115
115
  'Lock Aspect Ratio': string;
116
116
  };
117
117
  export declare const customTheme: {};
118
+ /**
119
+ * 深度合并两个对象:source 字段覆盖 target 字段,嵌套对象递归合并
120
+ * @param target 目标对象(默认配置)
121
+ * @param source 源对象(传入的配置)
122
+ * @returns 合并后的新对象(不修改原对象)
123
+ */
124
+ /**
125
+ * 修复泛型约束:去掉 Record 限制,改用任意对象
126
+ * @param target 默认配置(EditorConfig)
127
+ * @param source 传入的配置(Partial<EditorConfig>)
128
+ * @returns 合并后的配置
129
+ */
130
+ export declare const deepMerge: <T extends object>(target: T, source: Partial<T>) => T;
@@ -12,31 +12,23 @@ export type { TuiEditorTypes, YuiImageEditorProps };
12
12
  declare const _default: {
13
13
  install: (app: App) => void;
14
14
  YuiImageEditor: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
15
- initialImageUrl: {
16
- type: StringConstructor;
17
- default: string;
18
- };
19
- width: {
20
- type: (StringConstructor | NumberConstructor)[];
21
- default: string;
22
- };
23
- height: {
24
- type: (StringConstructor | NumberConstructor)[];
25
- default: number;
26
- };
27
- defaultA4Size: {
28
- type: BooleanConstructor;
29
- default: boolean;
15
+ editorConfig: {
16
+ type: import('vue').PropType<TuiEditorTypes.EditorConfig>;
17
+ default: () => {};
30
18
  };
31
19
  }>, {
32
20
  showStatus: (message: string, type?: "success" | "error" | "info") => void;
33
21
  updateCanvasSize: () => void;
34
- addTitle: () => Promise<void>;
22
+ addTitle: (title?: string) => Promise<void>;
35
23
  addTimestamp: () => Promise<void>;
36
- addFigureLabel: () => Promise<void>;
24
+ addFigureLabel: (title?: string) => Promise<void>;
37
25
  addComparisonBox: () => Promise<void>;
38
26
  addCalibrationTarget: () => Promise<void>;
39
27
  getCoreEditor: () => TuiEditorTypes.TuiImageEditor | null;
28
+ loadImageFromURL: (imageUrl: string, imageName?: string) => Promise<{
29
+ success: boolean;
30
+ message: string;
31
+ }>;
40
32
  destroy: () => void;
41
33
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
42
34
  init: (editor: TuiEditorTypes.TuiImageEditor) => any;
@@ -46,21 +38,9 @@ declare const _default: {
46
38
  height: number;
47
39
  }) => any;
48
40
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
49
- initialImageUrl: {
50
- type: StringConstructor;
51
- default: string;
52
- };
53
- width: {
54
- type: (StringConstructor | NumberConstructor)[];
55
- default: string;
56
- };
57
- height: {
58
- type: (StringConstructor | NumberConstructor)[];
59
- default: number;
60
- };
61
- defaultA4Size: {
62
- type: BooleanConstructor;
63
- default: boolean;
41
+ editorConfig: {
42
+ type: import('vue').PropType<TuiEditorTypes.EditorConfig>;
43
+ default: () => {};
64
44
  };
65
45
  }>> & Readonly<{
66
46
  onInit?: ((editor: TuiEditorTypes.TuiImageEditor) => any) | undefined;
@@ -70,10 +50,7 @@ declare const _default: {
70
50
  height: number;
71
51
  }) => any) | undefined;
72
52
  }>, {
73
- width: string | number;
74
- height: string | number;
75
- initialImageUrl: string;
76
- defaultA4Size: boolean;
53
+ editorConfig: TuiEditorTypes.EditorConfig;
77
54
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
78
55
  editorContainer: HTMLDivElement;
79
56
  editorRef: HTMLDivElement;
@@ -1,3 +1,30 @@
1
+ /**
2
+ * 编辑器配置接口
3
+ */
4
+ export interface EditorConfig {
5
+ includeUI?: {
6
+ loadImage?: {
7
+ path?: string;
8
+ name?: string;
9
+ };
10
+ initMenu?: string;
11
+ menuBarPosition?: 'left' | 'top' | 'right' | 'bottom';
12
+ locale?: any;
13
+ theme?: any;
14
+ uiSize?: {
15
+ width?: string | number;
16
+ height?: string | number;
17
+ };
18
+ };
19
+ selectionStyle?: {
20
+ cornerSize?: number;
21
+ rotatingPointOffset?: number;
22
+ };
23
+ usageStatistics?: boolean;
24
+ cssMaxHeight?: number | string;
25
+ cssMaxWidth?: number | string;
26
+ [key: string]: unknown;
27
+ }
1
28
  /**
2
29
  * tui-image-editor 核心接口定义
3
30
  * 根据实际使用的方法进行扩展
@@ -16,6 +43,8 @@ export interface TuiImageEditor {
16
43
  addText(text: string, options: TextOptions): Promise<ObjectProps>;
17
44
  addShape(type: string, options: ShapeOptions): Promise<ObjectProps>;
18
45
  addImageObject(url: string, options?: ImageObjectOptions): Promise<ObjectProps>;
46
+ loadImageFromFile: (imgFile: File, imageName?: string) => Promise<void>;
47
+ loadImageFromURL: (url: string, imageName?: string) => Promise<void>;
19
48
  resetZoom(): void;
20
49
  resize(dimensions: {
21
50
  width: number;
@@ -81,30 +110,6 @@ export interface ImageObjectOptions {
81
110
  height: number;
82
111
  [key: string]: any;
83
112
  }
84
- /**
85
- * 编辑器配置接口
86
- */
87
- export interface EditorConfig {
88
- includeUI?: {
89
- loadImage?: {
90
- path: string;
91
- name: string;
92
- };
93
- theme?: any;
94
- initMenu?: string;
95
- menuBarPosition?: 'top' | 'bottom' | 'left' | 'right';
96
- menu?: string[];
97
- locale?: any;
98
- };
99
- cssMaxWidth?: number;
100
- cssMaxHeight?: number;
101
- selectionStyle?: {
102
- cornerSize?: number;
103
- rotatingPointOffset?: number;
104
- };
105
- usageStatistics?: boolean;
106
- [key: string]: any;
107
- }
108
113
  /**
109
114
  * 坐标点接口
110
115
  */
@@ -1,2 +1,78 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
1
+ import { EditorConfig, TuiImageEditor } from '../types';
2
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
3
+ yuiImageEditor: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
4
+ editorConfig: {
5
+ type: import('vue').PropType<EditorConfig>;
6
+ default: () => {};
7
+ };
8
+ }>> & Readonly<{
9
+ onInit?: ((editor: TuiImageEditor) => any) | undefined;
10
+ onStatusChange?: ((status: import('../components/ImageEditor/editor.types').EditorOperationStatus | null) => any) | undefined;
11
+ onCanvasSizeChange?: ((size: {
12
+ width: number;
13
+ height: number;
14
+ }) => any) | undefined;
15
+ }>, {
16
+ showStatus: (message: string, type?: "success" | "error" | "info") => void;
17
+ updateCanvasSize: () => void;
18
+ addTitle: (title?: string) => Promise<void>;
19
+ addTimestamp: () => Promise<void>;
20
+ addFigureLabel: (title?: string) => Promise<void>;
21
+ addComparisonBox: () => Promise<void>;
22
+ addCalibrationTarget: () => Promise<void>;
23
+ getCoreEditor: () => TuiImageEditor | null;
24
+ loadImageFromURL: (imageUrl: string, imageName?: string) => Promise<{
25
+ success: boolean;
26
+ message: string;
27
+ }>;
28
+ destroy: () => void;
29
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ init: (editor: TuiImageEditor) => any;
31
+ statusChange: (status: import('../components/ImageEditor/editor.types').EditorOperationStatus | null) => any;
32
+ canvasSizeChange: (size: {
33
+ width: number;
34
+ height: number;
35
+ }) => any;
36
+ }, import('vue').PublicProps, {
37
+ editorConfig: EditorConfig;
38
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
39
+ editorContainer: HTMLDivElement;
40
+ editorRef: HTMLDivElement;
41
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
42
+ P: {};
43
+ B: {};
44
+ D: {};
45
+ C: {};
46
+ M: {};
47
+ Defaults: {};
48
+ }, Readonly<import('vue').ExtractPropTypes<{
49
+ editorConfig: {
50
+ type: import('vue').PropType<EditorConfig>;
51
+ default: () => {};
52
+ };
53
+ }>> & Readonly<{
54
+ onInit?: ((editor: TuiImageEditor) => any) | undefined;
55
+ onStatusChange?: ((status: import('../components/ImageEditor/editor.types').EditorOperationStatus | null) => any) | undefined;
56
+ onCanvasSizeChange?: ((size: {
57
+ width: number;
58
+ height: number;
59
+ }) => any) | undefined;
60
+ }>, {
61
+ showStatus: (message: string, type?: "success" | "error" | "info") => void;
62
+ updateCanvasSize: () => void;
63
+ addTitle: (title?: string) => Promise<void>;
64
+ addTimestamp: () => Promise<void>;
65
+ addFigureLabel: (title?: string) => Promise<void>;
66
+ addComparisonBox: () => Promise<void>;
67
+ addCalibrationTarget: () => Promise<void>;
68
+ getCoreEditor: () => TuiImageEditor | null;
69
+ loadImageFromURL: (imageUrl: string, imageName?: string) => Promise<{
70
+ success: boolean;
71
+ message: string;
72
+ }>;
73
+ destroy: () => void;
74
+ }, {}, {}, {}, {
75
+ editorConfig: EditorConfig;
76
+ }> | null;
77
+ }, HTMLDivElement>;
2
78
  export default _default;