vkedit 3.2.6 → 4.0.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/CHANGELOG.md +51 -0
- package/LICENSE +21 -21
- package/README.en.md +38 -36
- package/README.md +32 -28
- package/dist/commands/change-layer-order-command.d.ts +1 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/reorder-elements-command.d.ts +19 -0
- package/dist/components/BaseElementPropertyPanel.vue.d.ts +28 -1
- package/dist/components/TextProperty.vue.d.ts +2 -0
- package/dist/components/ui/VkButton.vue.d.ts +2 -2
- package/dist/components/ui/VkColorPicker.vue.d.ts +26 -0
- package/dist/components/ui/VkTextarea.vue.d.ts +20 -0
- package/dist/components/ui/index.d.ts +2 -1
- package/dist/core/ContentLayer.vue.d.ts +0 -2
- package/dist/core/Editor.vue.d.ts +1 -0
- package/dist/{plugins/rect/Tool.vue.d.ts → core/GraphicToolRenderer.vue.d.ts} +6 -1
- package/dist/core/HelpGuide.vue.d.ts +3 -1
- package/dist/{plugins/table/CellsBorder.vue.d.ts → core/TransformOverlay.vue.d.ts} +2 -2
- package/dist/core/editor-host.d.ts +2 -11
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +8 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-content-layer.d.ts +6 -6
- package/dist/hooks/use-host-state.d.ts +1 -0
- package/dist/hooks/use-ruler-layer.d.ts +24 -0
- package/dist/hooks/use-selection-layer.d.ts +2 -3
- package/dist/hooks/use-stage-event.d.ts +1 -0
- package/dist/hooks/use-transform-overlay.d.ts +108 -0
- package/dist/index-CSKpw1uX.js +25597 -0
- package/dist/{index.es-CEBX1sXY.js → index.es-Dswe047Z.js} +1 -1
- package/dist/plugins/barcode/Shape.vue.d.ts +1 -1
- package/dist/plugins/barcode/barcode.d.ts +12 -13
- package/dist/plugins/barcode/index.d.ts +0 -1
- package/dist/plugins/export/export.d.ts +1 -2
- package/dist/plugins/graphic-registry/graphic-registry.d.ts +43 -0
- package/dist/plugins/graphic-registry/index.d.ts +1 -0
- package/dist/plugins/import/import.d.ts +1 -2
- package/dist/plugins/index.d.ts +2 -6
- package/dist/plugins/keydown.d.ts +6 -0
- package/dist/plugins/{table/ContextMenu.vue.d.ts → layer-manager/LayerPanel.vue.d.ts} +5 -4
- package/dist/plugins/layer-manager/index.d.ts +2 -0
- package/dist/plugins/layer-manager/layer-manager.d.ts +16 -0
- package/dist/plugins/line/Shape.vue.d.ts +1 -1
- package/dist/plugins/line/index.d.ts +0 -1
- package/dist/plugins/line/line.d.ts +12 -13
- package/dist/plugins/qrcode/Shape.vue.d.ts +1 -1
- package/dist/plugins/qrcode/index.d.ts +0 -1
- package/dist/plugins/qrcode/qrcode.d.ts +12 -13
- package/dist/plugins/rect/Shape.vue.d.ts +1 -1
- package/dist/plugins/rect/index.d.ts +0 -1
- package/dist/plugins/rect/rect.d.ts +11 -13
- package/dist/plugins/selection.d.ts +5 -1
- package/dist/plugins/text/Shape.vue.d.ts +1 -1
- package/dist/plugins/text/index.d.ts +0 -1
- package/dist/plugins/text/text.d.ts +16 -13
- package/dist/types/base-graphic-element.d.ts +10 -3
- package/dist/types/base.d.ts +5 -18
- package/dist/types/event-data.d.ts +17 -0
- package/dist/types/event-map.d.ts +8 -1
- package/dist/types/graphic-plugin.d.ts +27 -0
- package/dist/types/index.d.ts +1 -3
- package/dist/utils/color.d.ts +40 -0
- package/dist/utils/css-var.d.ts +14 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/readability.d.ts +22 -0
- package/dist/utils/theme.d.ts +2 -0
- package/dist/utils/transform-geometry.d.ts +62 -0
- package/dist/utils/transform-overlay.d.ts +62 -0
- package/dist/vkedit.css +1 -1
- package/dist/vkedit.es.js +81 -96
- package/package.json +5 -5
- package/dist/components/ui/VkIcon.vue.d.ts +0 -8
- package/dist/index-Bisex1w7.js +0 -72850
- package/dist/plugins/barcode/Tool.vue.d.ts +0 -6
- package/dist/plugins/chart/PropertyPanel.vue.d.ts +0 -9
- package/dist/plugins/chart/Shape.vue.d.ts +0 -23
- package/dist/plugins/chart/Tool.vue.d.ts +0 -6
- package/dist/plugins/chart/chart.d.ts +0 -38
- package/dist/plugins/chart/index.d.ts +0 -4
- package/dist/plugins/element-manager.d.ts +0 -24
- package/dist/plugins/graphic-manager/graphic-manager.d.ts +0 -31
- package/dist/plugins/graphic-manager/index.d.ts +0 -1
- package/dist/plugins/graphic-tool-manager.d.ts +0 -16
- package/dist/plugins/line/Tool.vue.d.ts +0 -7
- package/dist/plugins/property-panel-manager/index.d.ts +0 -1
- package/dist/plugins/property-panel-manager/property-panel-manager.d.ts +0 -32
- package/dist/plugins/qrcode/Tool.vue.d.ts +0 -6
- package/dist/plugins/table/PropertyPanel.vue.d.ts +0 -9
- package/dist/plugins/table/Shape.vue.d.ts +0 -26
- package/dist/plugins/table/Tool.vue.d.ts +0 -7
- package/dist/plugins/table/cell.d.ts +0 -61
- package/dist/plugins/table/index.d.ts +0 -6
- package/dist/plugins/table/table.d.ts +0 -92
- package/dist/plugins/text/Tool.vue.d.ts +0 -6
- package/dist/types/base-graphic-type.d.ts +0 -9
- package/dist/types/element-type-map.d.ts +0 -12
- package/dist/types/plugin-map.d.ts +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
|
|
2
2
|
import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
|
|
3
3
|
import { EditorHost } from '../../core';
|
|
4
4
|
export interface BarcodeOptions extends BaseGraphicElementOptions {
|
|
@@ -55,22 +55,21 @@ export declare class BarcodeElement extends BaseGraphicElement {
|
|
|
55
55
|
visible: boolean;
|
|
56
56
|
locked: boolean;
|
|
57
57
|
draggable: boolean;
|
|
58
|
-
|
|
58
|
+
resizable: boolean;
|
|
59
|
+
zIndex: number;
|
|
60
|
+
displayName: string | null;
|
|
59
61
|
};
|
|
60
62
|
renderBarcode(): Promise<HTMLCanvasElement>;
|
|
61
63
|
}
|
|
62
|
-
export declare class BarcodePlugin extends
|
|
64
|
+
export declare class BarcodePlugin extends GraphicPlugin<BarcodeElement> {
|
|
63
65
|
name: string;
|
|
64
66
|
version: string;
|
|
67
|
+
graphicType: string;
|
|
68
|
+
graphicElement: typeof BarcodeElement;
|
|
69
|
+
shapeComponent: import('vue').DefineComponent<import('./Shape.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./Shape.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
70
|
+
iconComponent: import('vue').Component;
|
|
71
|
+
typeDisplayName: string;
|
|
72
|
+
propertyPanels: PropertyPanelRegistration[];
|
|
65
73
|
protected onInstall(): void;
|
|
66
|
-
|
|
67
|
-
declare module '../../types' {
|
|
68
|
-
interface ElementTypeMap {
|
|
69
|
-
barcode: BarcodeElement;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
declare module '../../types' {
|
|
73
|
-
interface PluginMap {
|
|
74
|
-
'barcode-plugin': BarcodePlugin;
|
|
75
|
-
}
|
|
74
|
+
protected onUninstall(): void;
|
|
76
75
|
}
|
|
@@ -7,7 +7,6 @@ export declare class ExportPlugin extends BasePlugin {
|
|
|
7
7
|
pixelRatio: number;
|
|
8
8
|
constructor(host: EditorHost, pixelRatio?: number);
|
|
9
9
|
protected onInstall(): void;
|
|
10
|
-
handleExportExcel(): void;
|
|
11
10
|
handleExportImage(): void;
|
|
12
11
|
handleExportJSON(): void;
|
|
13
12
|
handleExportPdf(): void;
|
|
@@ -30,7 +29,7 @@ declare module '../../types' {
|
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
export interface ExportEventData extends BaseEventData {
|
|
33
|
-
format: 'png' | 'jpeg' | 'pdf' | 'json' |
|
|
32
|
+
format: 'png' | 'jpeg' | 'pdf' | 'json' | string;
|
|
34
33
|
error?: any;
|
|
35
34
|
prevent?: () => void;
|
|
36
35
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BasePlugin } from '../../types/base-plugin';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
import { IGraphicElement } from '../../types';
|
|
4
|
+
export interface ToolDescriptor {
|
|
5
|
+
type: string;
|
|
6
|
+
iconComponent: Component;
|
|
7
|
+
typeDisplayName: string;
|
|
8
|
+
createElement: () => IGraphicElement;
|
|
9
|
+
}
|
|
10
|
+
export declare class GraphicRegistryPlugin extends BasePlugin {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
elements: Map<string, IGraphicElement>;
|
|
14
|
+
private graphics;
|
|
15
|
+
private tools;
|
|
16
|
+
private propertyPanels;
|
|
17
|
+
protected onInstall(): void;
|
|
18
|
+
protected onUninstall(): void;
|
|
19
|
+
getElementComponent(type: string): Component;
|
|
20
|
+
getTypeMeta(type: string): {
|
|
21
|
+
iconComponent?: Component;
|
|
22
|
+
typeDisplayName?: string;
|
|
23
|
+
} | undefined;
|
|
24
|
+
getToolList(): ToolDescriptor[];
|
|
25
|
+
getToolComponent(type: string): Component;
|
|
26
|
+
getPanelsBySelection(selection: IGraphicElement[]): Component[];
|
|
27
|
+
private getPanelsByType;
|
|
28
|
+
private getPanelsByMultipleSelect;
|
|
29
|
+
private findCommonElements;
|
|
30
|
+
getCanvasPanels(): Component[];
|
|
31
|
+
addElement(element: IGraphicElement): void;
|
|
32
|
+
removeElement(elementId: string): void;
|
|
33
|
+
getElement<T extends IGraphicElement = IGraphicElement>(elementId: string): T;
|
|
34
|
+
getAllElements<T extends IGraphicElement = IGraphicElement>(): T[];
|
|
35
|
+
createElement(type: string): IGraphicElement;
|
|
36
|
+
getOrderedElements(order?: 'ascending' | 'descending'): IGraphicElement[];
|
|
37
|
+
normalizeZIndices(): void;
|
|
38
|
+
}
|
|
39
|
+
declare module '../../types' {
|
|
40
|
+
interface PluginMap {
|
|
41
|
+
'graphic-registry-plugin': GraphicRegistryPlugin;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './graphic-registry';
|
|
@@ -12,7 +12,6 @@ export declare class ImportPlugin extends BasePlugin {
|
|
|
12
12
|
};
|
|
13
13
|
handleImportJSON(): void;
|
|
14
14
|
importJSON(data: string): void;
|
|
15
|
-
importExcel(): void;
|
|
16
15
|
}
|
|
17
16
|
declare module '../../types' {
|
|
18
17
|
interface PluginMap {
|
|
@@ -20,7 +19,7 @@ declare module '../../types' {
|
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
export interface ImportEventData extends BaseEventData {
|
|
23
|
-
format: 'json' |
|
|
22
|
+
format: 'json' | string;
|
|
24
23
|
error?: any;
|
|
25
24
|
}
|
|
26
25
|
declare module '../../types' {
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
export * from './align';
|
|
2
2
|
export * from './barcode';
|
|
3
3
|
export * from './clipboard';
|
|
4
|
-
export * from './chart';
|
|
5
4
|
export * from './context-menu-manager';
|
|
6
|
-
export * from './element-manager';
|
|
7
5
|
export * from './export';
|
|
8
|
-
export * from './graphic-
|
|
9
|
-
export * from './graphic-tool-manager';
|
|
6
|
+
export * from './graphic-registry';
|
|
10
7
|
export * from './import';
|
|
11
8
|
export * from './keydown';
|
|
9
|
+
export * from './layer-manager';
|
|
12
10
|
export * from './line';
|
|
13
11
|
export * from './preview';
|
|
14
|
-
export * from './property-panel-manager';
|
|
15
12
|
export * from './qrcode';
|
|
16
13
|
export * from './rect';
|
|
17
14
|
export * from './selection';
|
|
18
15
|
export * from './snap';
|
|
19
|
-
export * from './table';
|
|
20
16
|
export * from './text';
|
|
21
17
|
export * from './toolbar-manager';
|
|
@@ -14,6 +14,12 @@ export declare class KeyDownPlugin extends BasePlugin {
|
|
|
14
14
|
private getStep;
|
|
15
15
|
private moveSelection;
|
|
16
16
|
private isInputFocused;
|
|
17
|
+
/**
|
|
18
|
+
* 判断当前焦点是否落在画布舞台容器内(由 StageView 在 onMounted 写入 host.stageState.wrapperEl)。
|
|
19
|
+
* 用于 Ctrl+Z / Ctrl+Y / Delete 等影响画布历史/选中元素的快捷键守卫:
|
|
20
|
+
* 焦点不在画布时应让位给输入框/浏览器原生行为。
|
|
21
|
+
*/
|
|
22
|
+
private isCanvasFocused;
|
|
17
23
|
private copySelection;
|
|
18
24
|
private pasteFromClipboard;
|
|
19
25
|
private deleteSelectionElement;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { EditorHost } from '../../core';
|
|
2
|
-
import { TableElement } from './table';
|
|
3
2
|
type __VLS_Props = {
|
|
4
3
|
host: EditorHost;
|
|
5
|
-
element: TableElement;
|
|
6
|
-
selection: TableElement[];
|
|
7
4
|
};
|
|
8
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
6
|
+
panelRef: HTMLDivElement;
|
|
7
|
+
listRef: HTMLDivElement;
|
|
8
|
+
renameInputEl: HTMLInputElement;
|
|
9
|
+
}, HTMLDivElement>;
|
|
9
10
|
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BasePlugin } from '../../types/base-plugin';
|
|
2
|
+
import { IGraphicElement } from '../../types';
|
|
3
|
+
export declare class LayerManagerPlugin extends BasePlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
protected onInstall(): void;
|
|
7
|
+
protected onUninstall(): void;
|
|
8
|
+
getElementDisplayName(element: IGraphicElement): string;
|
|
9
|
+
moveLayer(elementId: string, direction: 'up' | 'down' | 'top' | 'bottom'): void;
|
|
10
|
+
reorder(newOrder: string[]): void;
|
|
11
|
+
}
|
|
12
|
+
declare module '../../types' {
|
|
13
|
+
interface PluginMap {
|
|
14
|
+
'layer-manager-plugin': LayerManagerPlugin;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LineElement } from './line';
|
|
2
|
-
interface Props {
|
|
2
|
+
export interface Props {
|
|
3
3
|
element: LineElement;
|
|
4
4
|
}
|
|
5
5
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
|
|
2
2
|
import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
|
|
3
3
|
import { EditorHost } from '../../core';
|
|
4
4
|
export interface LineOptions extends BaseGraphicElementOptions {
|
|
@@ -41,21 +41,20 @@ export declare class LineElement extends BaseGraphicElement {
|
|
|
41
41
|
visible: boolean;
|
|
42
42
|
locked: boolean;
|
|
43
43
|
draggable: boolean;
|
|
44
|
-
|
|
44
|
+
resizable: boolean;
|
|
45
|
+
zIndex: number;
|
|
46
|
+
displayName: string | null;
|
|
45
47
|
};
|
|
46
48
|
}
|
|
47
|
-
export declare class LinePlugin extends
|
|
49
|
+
export declare class LinePlugin extends GraphicPlugin<LineElement> {
|
|
48
50
|
name: string;
|
|
49
51
|
version: string;
|
|
52
|
+
graphicType: string;
|
|
53
|
+
graphicElement: typeof LineElement;
|
|
54
|
+
shapeComponent: import('vue').DefineComponent<import('./Shape.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./Shape.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
55
|
+
iconComponent: import('vue').Component;
|
|
56
|
+
typeDisplayName: string;
|
|
57
|
+
propertyPanels: PropertyPanelRegistration[];
|
|
50
58
|
protected onInstall(): void;
|
|
51
|
-
|
|
52
|
-
declare module '../../types' {
|
|
53
|
-
interface ElementTypeMap {
|
|
54
|
-
line: LineElement;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
declare module '../../types' {
|
|
58
|
-
interface PluginMap {
|
|
59
|
-
'line-plugin': LinePlugin;
|
|
60
|
-
}
|
|
59
|
+
protected onUninstall(): void;
|
|
61
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
|
|
2
2
|
import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
|
|
3
3
|
import { EditorHost } from '../../core';
|
|
4
4
|
export interface QrcodeOptions extends BaseGraphicElementOptions {
|
|
@@ -34,7 +34,9 @@ export declare class QrcodeElement extends BaseGraphicElement {
|
|
|
34
34
|
visible: boolean;
|
|
35
35
|
locked: boolean;
|
|
36
36
|
draggable: boolean;
|
|
37
|
-
|
|
37
|
+
resizable: boolean;
|
|
38
|
+
zIndex: number;
|
|
39
|
+
displayName: string | null;
|
|
38
40
|
};
|
|
39
41
|
get config(): {
|
|
40
42
|
[key: string]: any;
|
|
@@ -58,18 +60,15 @@ export declare class QrcodeElement extends BaseGraphicElement {
|
|
|
58
60
|
height: number;
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
|
-
export declare class QrcodePlugin extends
|
|
63
|
+
export declare class QrcodePlugin extends GraphicPlugin<QrcodeElement> {
|
|
62
64
|
name: string;
|
|
63
65
|
version: string;
|
|
66
|
+
graphicType: string;
|
|
67
|
+
graphicElement: typeof QrcodeElement;
|
|
68
|
+
shapeComponent: import('vue').DefineComponent<import('./Shape.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./Shape.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
69
|
+
iconComponent: import('vue').Component;
|
|
70
|
+
typeDisplayName: string;
|
|
71
|
+
propertyPanels: PropertyPanelRegistration[];
|
|
64
72
|
protected onInstall(): void;
|
|
65
|
-
|
|
66
|
-
declare module '../../types' {
|
|
67
|
-
interface ElementTypeMap {
|
|
68
|
-
qr: QrcodeElement;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
declare module '../../types' {
|
|
72
|
-
interface PluginMap {
|
|
73
|
-
'qr-plugin': QrcodePlugin;
|
|
74
|
-
}
|
|
73
|
+
protected onUninstall(): void;
|
|
75
74
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RectElement } from './rect';
|
|
2
|
-
interface Props {
|
|
2
|
+
export interface Props {
|
|
3
3
|
element: RectElement;
|
|
4
4
|
}
|
|
5
5
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BasePlugin } from '../../types/base-plugin';
|
|
2
1
|
import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
|
|
3
2
|
import { EditorHost } from '../../core';
|
|
3
|
+
import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
|
|
4
4
|
export interface RectOptions extends BaseGraphicElementOptions {
|
|
5
5
|
x?: number;
|
|
6
6
|
y?: number;
|
|
@@ -49,21 +49,19 @@ export declare class RectElement extends BaseGraphicElement {
|
|
|
49
49
|
visible: boolean;
|
|
50
50
|
locked: boolean;
|
|
51
51
|
draggable: boolean;
|
|
52
|
-
|
|
52
|
+
resizable: boolean;
|
|
53
|
+
zIndex: number;
|
|
54
|
+
displayName: string | null;
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
|
-
export declare class RectPlugin extends
|
|
57
|
+
export declare class RectPlugin extends GraphicPlugin<RectElement> {
|
|
56
58
|
name: string;
|
|
57
59
|
version: string;
|
|
60
|
+
graphicType: string;
|
|
61
|
+
graphicElement: typeof RectElement;
|
|
62
|
+
shapeComponent: import('vue').DefineComponent<import('./Shape.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./Shape.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
63
|
+
iconComponent: import('vue').Component;
|
|
64
|
+
typeDisplayName: string;
|
|
65
|
+
propertyPanels: PropertyPanelRegistration[];
|
|
58
66
|
protected onInstall(): void;
|
|
59
67
|
}
|
|
60
|
-
declare module '../../types' {
|
|
61
|
-
interface ElementTypeMap {
|
|
62
|
-
rect: RectElement;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
declare module '../../types' {
|
|
66
|
-
interface PluginMap {
|
|
67
|
-
'rect-plugin': RectPlugin;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -13,9 +13,13 @@ export declare class SelectionPlugin extends BasePlugin {
|
|
|
13
13
|
protected onInstall(): void;
|
|
14
14
|
protected onUninstall(): void;
|
|
15
15
|
private handleMouseDown;
|
|
16
|
-
private isClickOnTransformer;
|
|
17
16
|
private handleMouseMove;
|
|
18
17
|
private handleMouseUp;
|
|
18
|
+
/**
|
|
19
|
+
* 清理框选 / 按下草稿状态(鼠标移出画布或异常事件触发时使用)。
|
|
20
|
+
* 不会触发 selection:changed,也不访问 event.evt / event.point。
|
|
21
|
+
*/
|
|
22
|
+
private endSelectionDraft;
|
|
19
23
|
private isModifierPressed;
|
|
20
24
|
private isDragged;
|
|
21
25
|
private emitSelectionChanged;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextElement } from './text';
|
|
2
|
-
interface Props {
|
|
2
|
+
export interface Props {
|
|
3
3
|
element: TextElement;
|
|
4
4
|
}
|
|
5
5
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BasePlugin } from '../../types/base-plugin';
|
|
2
1
|
import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
|
|
2
|
+
import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
|
|
3
3
|
import { EditorHost } from '../../core';
|
|
4
4
|
export interface TextOptions extends BaseGraphicElementOptions {
|
|
5
5
|
x?: number;
|
|
@@ -9,6 +9,7 @@ export interface TextOptions extends BaseGraphicElementOptions {
|
|
|
9
9
|
align?: 'left' | 'center' | 'right' | 'justify';
|
|
10
10
|
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
11
11
|
fontStyle?: 'normal' | 'italic' | 'bold' | '500' | 'italic bold';
|
|
12
|
+
fill?: string;
|
|
12
13
|
xmm?: number;
|
|
13
14
|
ymm?: number;
|
|
14
15
|
}
|
|
@@ -19,6 +20,7 @@ export declare class TextElement extends BaseGraphicElement {
|
|
|
19
20
|
align: 'left' | 'center' | 'right' | 'justify';
|
|
20
21
|
verticalAlign: 'top' | 'middle' | 'bottom';
|
|
21
22
|
fontStyle: 'normal' | 'italic' | 'bold' | '500' | 'italic bold';
|
|
23
|
+
fill: string;
|
|
22
24
|
constructor(host: EditorHost, options?: Partial<TextOptions>);
|
|
23
25
|
get config(): {
|
|
24
26
|
text: string;
|
|
@@ -26,6 +28,7 @@ export declare class TextElement extends BaseGraphicElement {
|
|
|
26
28
|
align: "left" | "right" | "center" | "justify";
|
|
27
29
|
verticalAlign: "top" | "bottom" | "middle";
|
|
28
30
|
fontStyle: "bold" | "normal" | "italic" | "500" | "italic bold";
|
|
31
|
+
fill: string;
|
|
29
32
|
id: string;
|
|
30
33
|
x: number;
|
|
31
34
|
y: number;
|
|
@@ -44,6 +47,7 @@ export declare class TextElement extends BaseGraphicElement {
|
|
|
44
47
|
align: "left" | "right" | "center" | "justify";
|
|
45
48
|
verticalAlign: "top" | "bottom" | "middle";
|
|
46
49
|
fontStyle: "bold" | "normal" | "italic" | "500" | "italic bold";
|
|
50
|
+
fill: string;
|
|
47
51
|
id: string;
|
|
48
52
|
type: string;
|
|
49
53
|
xmm: number;
|
|
@@ -56,21 +60,20 @@ export declare class TextElement extends BaseGraphicElement {
|
|
|
56
60
|
visible: boolean;
|
|
57
61
|
locked: boolean;
|
|
58
62
|
draggable: boolean;
|
|
59
|
-
|
|
63
|
+
resizable: boolean;
|
|
64
|
+
zIndex: number;
|
|
65
|
+
displayName: string | null;
|
|
60
66
|
};
|
|
61
67
|
}
|
|
62
|
-
export declare class TextPlugin extends
|
|
68
|
+
export declare class TextPlugin extends GraphicPlugin<TextElement> {
|
|
63
69
|
name: string;
|
|
64
70
|
version: string;
|
|
71
|
+
graphicType: string;
|
|
72
|
+
graphicElement: typeof TextElement;
|
|
73
|
+
shapeComponent: import('vue').DefineComponent<import('./Shape.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./Shape.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
74
|
+
iconComponent: import('vue').Component;
|
|
75
|
+
typeDisplayName: string;
|
|
76
|
+
propertyPanels: PropertyPanelRegistration[];
|
|
65
77
|
protected onInstall(): void;
|
|
66
|
-
|
|
67
|
-
declare module '../../types' {
|
|
68
|
-
interface ElementTypeMap {
|
|
69
|
-
text: TextElement;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
declare module '../../types' {
|
|
73
|
-
interface PluginMap {
|
|
74
|
-
'text-plugin': TextPlugin;
|
|
75
|
-
}
|
|
78
|
+
protected onUninstall(): void;
|
|
76
79
|
}
|
|
@@ -13,7 +13,9 @@ export interface BaseGraphicElementOptions {
|
|
|
13
13
|
visible?: boolean;
|
|
14
14
|
locked?: boolean;
|
|
15
15
|
draggable?: boolean;
|
|
16
|
-
|
|
16
|
+
resizable?: boolean;
|
|
17
|
+
zIndex?: number;
|
|
18
|
+
displayName?: string | null;
|
|
17
19
|
}
|
|
18
20
|
export declare abstract class BaseGraphicElement implements IGraphicElement {
|
|
19
21
|
get x(): number;
|
|
@@ -37,8 +39,11 @@ export declare abstract class BaseGraphicElement implements IGraphicElement {
|
|
|
37
39
|
visible: boolean;
|
|
38
40
|
locked: boolean;
|
|
39
41
|
draggable: boolean;
|
|
40
|
-
|
|
42
|
+
resizable: boolean;
|
|
43
|
+
zIndex: number;
|
|
41
44
|
resizeAnchors: string[] | null;
|
|
45
|
+
/** 元素自定义显示名称。空字符串/null 时回退到 layer-manager.getElementDisplayName 的自动命名逻辑。 */
|
|
46
|
+
displayName: string | null;
|
|
42
47
|
constructor(host: EditorHost, options?: Partial<BaseGraphicElementOptions>);
|
|
43
48
|
updateProperty(host: EditorHost, property: string, oldValue: any, newValue: any): void;
|
|
44
49
|
clone(): IGraphicElement;
|
|
@@ -62,7 +67,9 @@ export declare abstract class BaseGraphicElement implements IGraphicElement {
|
|
|
62
67
|
visible: boolean;
|
|
63
68
|
locked: boolean;
|
|
64
69
|
draggable: boolean;
|
|
65
|
-
|
|
70
|
+
resizable: boolean;
|
|
71
|
+
zIndex: number;
|
|
72
|
+
displayName: string | null;
|
|
66
73
|
[key: string]: any;
|
|
67
74
|
};
|
|
68
75
|
getTransformAttr(event: any): {
|
package/dist/types/base.d.ts
CHANGED
|
@@ -14,11 +14,6 @@ export interface BoundingBox {
|
|
|
14
14
|
width: number;
|
|
15
15
|
height: number;
|
|
16
16
|
}
|
|
17
|
-
export interface IGraphicComponent {
|
|
18
|
-
component: any;
|
|
19
|
-
props?: any;
|
|
20
|
-
events?: any;
|
|
21
|
-
}
|
|
22
17
|
export interface IGraphicElement {
|
|
23
18
|
id: string;
|
|
24
19
|
type: string;
|
|
@@ -32,7 +27,10 @@ export interface IGraphicElement {
|
|
|
32
27
|
visible: boolean;
|
|
33
28
|
locked: boolean;
|
|
34
29
|
draggable: boolean;
|
|
35
|
-
|
|
30
|
+
resizable: boolean;
|
|
31
|
+
zIndex: number;
|
|
32
|
+
/** 元素自定义显示名称。空字符串/null 时回退到 layer-manager.getElementDisplayName 的自动命名逻辑。 */
|
|
33
|
+
displayName?: string | null;
|
|
36
34
|
resizeAnchors?: string[] | null;
|
|
37
35
|
getBoundingBox(): BoundingBox;
|
|
38
36
|
clone(): IGraphicElement;
|
|
@@ -51,24 +49,13 @@ export interface IEditorPlugin {
|
|
|
51
49
|
uninstall(): void;
|
|
52
50
|
activate?(): void;
|
|
53
51
|
deactivate?(): void;
|
|
54
|
-
registerGraphicTypes?(): IGraphicType[];
|
|
55
|
-
getTools?(): IPluginTool[];
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
}
|
|
58
|
-
export interface IPluginTool {
|
|
59
52
|
[key: string]: any;
|
|
60
53
|
}
|
|
61
|
-
export interface IGraphicType {
|
|
62
|
-
type: string;
|
|
63
|
-
render(): Component;
|
|
64
|
-
renderTool(): Component;
|
|
65
|
-
renderPropertyPanel(): Component;
|
|
66
|
-
createElement(x: number, y: number): IGraphicElement;
|
|
67
|
-
}
|
|
68
54
|
export interface IEditorState {
|
|
69
55
|
zoom: number;
|
|
70
56
|
currentTool: string;
|
|
71
57
|
snapToGrid: boolean;
|
|
58
|
+
snapRotation: boolean;
|
|
72
59
|
showGrid: boolean;
|
|
73
60
|
width: number;
|
|
74
61
|
height: number;
|
|
@@ -79,6 +79,7 @@ export interface DistributeEventData extends BaseEventData {
|
|
|
79
79
|
export interface LayerOrderEventData extends BaseEventData {
|
|
80
80
|
elementId: string;
|
|
81
81
|
direction: 'up' | 'down' | 'top' | 'bottom';
|
|
82
|
+
newOrder?: string[];
|
|
82
83
|
}
|
|
83
84
|
export interface BaseStageEventData extends BaseEventData {
|
|
84
85
|
point: Point2D;
|
|
@@ -106,6 +107,22 @@ export interface ElementDragEventData extends BaseEventData {
|
|
|
106
107
|
target: any;
|
|
107
108
|
evt: MouseEvent | undefined;
|
|
108
109
|
}
|
|
110
|
+
export interface GraphicEventData extends BaseEventData {
|
|
111
|
+
type: string;
|
|
112
|
+
render: () => Component;
|
|
113
|
+
iconComponent?: Component;
|
|
114
|
+
typeDisplayName?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface GraphicToolEventData extends BaseEventData {
|
|
117
|
+
type: string;
|
|
118
|
+
render: () => Component;
|
|
119
|
+
}
|
|
120
|
+
export interface PropertyPanelEventData extends BaseEventData {
|
|
121
|
+
graphicTypes: string[];
|
|
122
|
+
render: () => Component;
|
|
123
|
+
isCanvas: boolean;
|
|
124
|
+
isPublic: boolean;
|
|
125
|
+
}
|
|
109
126
|
/**
|
|
110
127
|
* 事件工具函数
|
|
111
128
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseEventData, ElementDragEventData, ElementEventData, SelectionEventData, TransformEventData, ToolEventData, PluginEventData, CommandEventData, HistoryEventData, ViewEventData, CreationEventData, ErrorEventData, PerformanceEventData, AlignEventData, DistributeEventData, LayerOrderEventData, ElementUpdateEventData, StageDblClickEventData, StageMouseEventData, StageKeyboardEventData, ElementRegisteredEventData, StatusEventData } from './event-data';
|
|
1
|
+
import { BaseEventData, ElementDragEventData, ElementEventData, SelectionEventData, TransformEventData, ToolEventData, PluginEventData, CommandEventData, HistoryEventData, ViewEventData, CreationEventData, ErrorEventData, PerformanceEventData, AlignEventData, DistributeEventData, LayerOrderEventData, ElementUpdateEventData, StageDblClickEventData, StageMouseEventData, StageKeyboardEventData, ElementRegisteredEventData, StatusEventData, GraphicEventData, GraphicToolEventData, PropertyPanelEventData } from './event-data';
|
|
2
2
|
/**
|
|
3
3
|
* 编辑器事件映射接口
|
|
4
4
|
* @description 定义编辑器中所有可能的事件及其对应的负载类型。
|
|
@@ -98,9 +98,15 @@ export interface EventMap {
|
|
|
98
98
|
'plugin:deactivated': (payload: PluginEventData) => void;
|
|
99
99
|
'plugin:loaded': (payload: PluginEventData) => void;
|
|
100
100
|
'plugin:error': (payload: ErrorEventData) => void;
|
|
101
|
+
'graphic:registered': (payload: GraphicEventData) => void;
|
|
102
|
+
'graphic:unregistered': (payload: GraphicEventData) => void;
|
|
103
|
+
'graphic-tool:registered': (payload: GraphicToolEventData) => void;
|
|
104
|
+
'graphic-tool:unregistered': (payload: GraphicToolEventData) => void;
|
|
101
105
|
'create-strategy:registered': (payload: BaseEventData) => void;
|
|
102
106
|
'create-strategy:unregistered': (payload: BaseEventData) => void;
|
|
103
107
|
'create-strategy:needs-register': (payload: BaseEventData) => void;
|
|
108
|
+
'property-panel:registered': (payload: PropertyPanelEventData) => void;
|
|
109
|
+
'property-panel:unregistered': (payload: PropertyPanelEventData) => void;
|
|
104
110
|
'property:value-change': (payload: BaseEventData) => void;
|
|
105
111
|
'property:batch-update-start': (payload: BaseEventData) => void;
|
|
106
112
|
'property:batch-update-end': (payload: BaseEventData) => void;
|
|
@@ -109,6 +115,7 @@ export interface EventMap {
|
|
|
109
115
|
'elements:group': (payload: BaseEventData) => void;
|
|
110
116
|
'elements:ungroup': (payload: BaseEventData) => void;
|
|
111
117
|
'elements:layer': (payload: LayerOrderEventData) => void;
|
|
118
|
+
'elements:reorder': (payload: LayerOrderEventData) => void;
|
|
112
119
|
'shortcut:triggered': (payload: BaseEventData) => void;
|
|
113
120
|
'shortcut:registered': (payload: BaseEventData) => void;
|
|
114
121
|
'shortcut:conflict': (payload: BaseEventData) => void;
|