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.
Files changed (97) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -21
  3. package/README.en.md +38 -36
  4. package/README.md +32 -28
  5. package/dist/commands/change-layer-order-command.d.ts +1 -0
  6. package/dist/commands/index.d.ts +1 -0
  7. package/dist/commands/reorder-elements-command.d.ts +19 -0
  8. package/dist/components/BaseElementPropertyPanel.vue.d.ts +28 -1
  9. package/dist/components/TextProperty.vue.d.ts +2 -0
  10. package/dist/components/ui/VkButton.vue.d.ts +2 -2
  11. package/dist/components/ui/VkColorPicker.vue.d.ts +26 -0
  12. package/dist/components/ui/VkTextarea.vue.d.ts +20 -0
  13. package/dist/components/ui/index.d.ts +2 -1
  14. package/dist/core/ContentLayer.vue.d.ts +0 -2
  15. package/dist/core/Editor.vue.d.ts +1 -0
  16. package/dist/{plugins/rect/Tool.vue.d.ts → core/GraphicToolRenderer.vue.d.ts} +6 -1
  17. package/dist/core/HelpGuide.vue.d.ts +3 -1
  18. package/dist/{plugins/table/CellsBorder.vue.d.ts → core/TransformOverlay.vue.d.ts} +2 -2
  19. package/dist/core/editor-host.d.ts +2 -11
  20. package/dist/favicon.ico +0 -0
  21. package/dist/favicon.svg +8 -0
  22. package/dist/hooks/index.d.ts +1 -0
  23. package/dist/hooks/use-content-layer.d.ts +6 -6
  24. package/dist/hooks/use-host-state.d.ts +1 -0
  25. package/dist/hooks/use-ruler-layer.d.ts +24 -0
  26. package/dist/hooks/use-selection-layer.d.ts +2 -3
  27. package/dist/hooks/use-stage-event.d.ts +1 -0
  28. package/dist/hooks/use-transform-overlay.d.ts +108 -0
  29. package/dist/index-CSKpw1uX.js +25597 -0
  30. package/dist/{index.es-CEBX1sXY.js → index.es-Dswe047Z.js} +1 -1
  31. package/dist/plugins/barcode/Shape.vue.d.ts +1 -1
  32. package/dist/plugins/barcode/barcode.d.ts +12 -13
  33. package/dist/plugins/barcode/index.d.ts +0 -1
  34. package/dist/plugins/export/export.d.ts +1 -2
  35. package/dist/plugins/graphic-registry/graphic-registry.d.ts +43 -0
  36. package/dist/plugins/graphic-registry/index.d.ts +1 -0
  37. package/dist/plugins/import/import.d.ts +1 -2
  38. package/dist/plugins/index.d.ts +2 -6
  39. package/dist/plugins/keydown.d.ts +6 -0
  40. package/dist/plugins/{table/ContextMenu.vue.d.ts → layer-manager/LayerPanel.vue.d.ts} +5 -4
  41. package/dist/plugins/layer-manager/index.d.ts +2 -0
  42. package/dist/plugins/layer-manager/layer-manager.d.ts +16 -0
  43. package/dist/plugins/line/Shape.vue.d.ts +1 -1
  44. package/dist/plugins/line/index.d.ts +0 -1
  45. package/dist/plugins/line/line.d.ts +12 -13
  46. package/dist/plugins/qrcode/Shape.vue.d.ts +1 -1
  47. package/dist/plugins/qrcode/index.d.ts +0 -1
  48. package/dist/plugins/qrcode/qrcode.d.ts +12 -13
  49. package/dist/plugins/rect/Shape.vue.d.ts +1 -1
  50. package/dist/plugins/rect/index.d.ts +0 -1
  51. package/dist/plugins/rect/rect.d.ts +11 -13
  52. package/dist/plugins/selection.d.ts +5 -1
  53. package/dist/plugins/text/Shape.vue.d.ts +1 -1
  54. package/dist/plugins/text/index.d.ts +0 -1
  55. package/dist/plugins/text/text.d.ts +16 -13
  56. package/dist/types/base-graphic-element.d.ts +10 -3
  57. package/dist/types/base.d.ts +5 -18
  58. package/dist/types/event-data.d.ts +17 -0
  59. package/dist/types/event-map.d.ts +8 -1
  60. package/dist/types/graphic-plugin.d.ts +27 -0
  61. package/dist/types/index.d.ts +1 -3
  62. package/dist/utils/color.d.ts +40 -0
  63. package/dist/utils/css-var.d.ts +14 -0
  64. package/dist/utils/index.d.ts +4 -0
  65. package/dist/utils/readability.d.ts +22 -0
  66. package/dist/utils/theme.d.ts +2 -0
  67. package/dist/utils/transform-geometry.d.ts +62 -0
  68. package/dist/utils/transform-overlay.d.ts +62 -0
  69. package/dist/vkedit.css +1 -1
  70. package/dist/vkedit.es.js +81 -96
  71. package/package.json +5 -5
  72. package/dist/components/ui/VkIcon.vue.d.ts +0 -8
  73. package/dist/index-Bisex1w7.js +0 -72850
  74. package/dist/plugins/barcode/Tool.vue.d.ts +0 -6
  75. package/dist/plugins/chart/PropertyPanel.vue.d.ts +0 -9
  76. package/dist/plugins/chart/Shape.vue.d.ts +0 -23
  77. package/dist/plugins/chart/Tool.vue.d.ts +0 -6
  78. package/dist/plugins/chart/chart.d.ts +0 -38
  79. package/dist/plugins/chart/index.d.ts +0 -4
  80. package/dist/plugins/element-manager.d.ts +0 -24
  81. package/dist/plugins/graphic-manager/graphic-manager.d.ts +0 -31
  82. package/dist/plugins/graphic-manager/index.d.ts +0 -1
  83. package/dist/plugins/graphic-tool-manager.d.ts +0 -16
  84. package/dist/plugins/line/Tool.vue.d.ts +0 -7
  85. package/dist/plugins/property-panel-manager/index.d.ts +0 -1
  86. package/dist/plugins/property-panel-manager/property-panel-manager.d.ts +0 -32
  87. package/dist/plugins/qrcode/Tool.vue.d.ts +0 -6
  88. package/dist/plugins/table/PropertyPanel.vue.d.ts +0 -9
  89. package/dist/plugins/table/Shape.vue.d.ts +0 -26
  90. package/dist/plugins/table/Tool.vue.d.ts +0 -7
  91. package/dist/plugins/table/cell.d.ts +0 -61
  92. package/dist/plugins/table/index.d.ts +0 -6
  93. package/dist/plugins/table/table.d.ts +0 -92
  94. package/dist/plugins/text/Tool.vue.d.ts +0 -6
  95. package/dist/types/base-graphic-type.d.ts +0 -9
  96. package/dist/types/element-type-map.d.ts +0 -12
  97. package/dist/types/plugin-map.d.ts +0 -12
@@ -1,4 +1,4 @@
1
- import { c as Da, _ as Va, g as il } from "./index-Bisex1w7.js";
1
+ import { c as Da, _ as Va, g as il } from "./index-CSKpw1uX.js";
2
2
  var fn = {}, cn = {}, cr, vn;
3
3
  function Q() {
4
4
  if (vn) return cr;
@@ -1,6 +1,6 @@
1
1
  import { BarcodeElement } from './barcode';
2
2
  import { EditorHost } from '../../core';
3
- interface Props {
3
+ export interface Props {
4
4
  host: EditorHost;
5
5
  element: BarcodeElement;
6
6
  }
@@ -1,4 +1,4 @@
1
- import { BasePlugin } from '../../types/base-plugin';
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
- transferable: boolean;
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 BasePlugin {
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
  }
@@ -1,4 +1,3 @@
1
1
  export { default as BarcodePropertyPanel } from './PropertyPanel.vue';
2
2
  export { default as BarcodeShape } from './Shape.vue';
3
- export { default as BarcodeTool } from './Tool.vue';
4
3
  export * from './barcode';
@@ -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' | 'excel' | string;
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' | 'excel' | string;
22
+ format: 'json' | string;
24
23
  error?: any;
25
24
  }
26
25
  declare module '../../types' {
@@ -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-manager';
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, {}, any>;
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,2 @@
1
+ export { LayerManagerPlugin } from './layer-manager';
2
+ export { default as LayerPanel } from './LayerPanel.vue';
@@ -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,3 @@
1
1
  export { default as LinePropertyPanel } from './PropertyPanel.vue';
2
2
  export { default as LineShape } from './Shape.vue';
3
- export { default as LineTool } from './Tool.vue';
4
3
  export * from './line';
@@ -1,4 +1,4 @@
1
- import { BasePlugin } from '../../types/base-plugin';
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
- transferable: boolean;
44
+ resizable: boolean;
45
+ zIndex: number;
46
+ displayName: string | null;
45
47
  };
46
48
  }
47
- export declare class LinePlugin extends BasePlugin {
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,6 +1,6 @@
1
1
  import { QrcodeElement } from './qrcode';
2
2
  import { EditorHost } from '../../core';
3
- interface Props {
3
+ export interface Props {
4
4
  host: EditorHost;
5
5
  element: QrcodeElement;
6
6
  }
@@ -1,4 +1,3 @@
1
1
  export { default as QrPropertyPanel } from './PropertyPanel.vue';
2
2
  export { default as QrShape } from './Shape.vue';
3
- export { default as QrTool } from './Tool.vue';
4
3
  export * from './qrcode';
@@ -1,4 +1,4 @@
1
- import { BasePlugin } from '../../types/base-plugin';
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
- transferable: boolean;
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 BasePlugin {
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,4 +1,3 @@
1
1
  export { default as RectPropertyPanel } from './PropertyPanel.vue';
2
2
  export { default as RectShape } from './Shape.vue';
3
- export { default as RectTool } from './Tool.vue';
4
3
  export * from './rect';
@@ -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
- transferable: boolean;
52
+ resizable: boolean;
53
+ zIndex: number;
54
+ displayName: string | null;
53
55
  };
54
56
  }
55
- export declare class RectPlugin extends BasePlugin {
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,4 @@
1
1
  export { default as TextPropertyPanel } from './PropertyPanel.vue';
2
2
  export { default as TextShape } from './Shape.vue';
3
- export { default as TextTool } from './Tool.vue';
4
3
  export { default as TextContextMenu } from './TextContextMenu.vue';
5
4
  export * from './text';
@@ -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
- transferable: boolean;
63
+ resizable: boolean;
64
+ zIndex: number;
65
+ displayName: string | null;
60
66
  };
61
67
  }
62
- export declare class TextPlugin extends BasePlugin {
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
- transferable?: boolean;
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
- transferable: boolean;
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
- transferable: boolean;
70
+ resizable: boolean;
71
+ zIndex: number;
72
+ displayName: string | null;
66
73
  [key: string]: any;
67
74
  };
68
75
  getTransformAttr(event: any): {
@@ -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
- transferable: boolean;
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;