vkedit 2.8.6 → 3.2.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.
Files changed (126) hide show
  1. package/README.en.md +385 -1193
  2. package/README.md +383 -1190
  3. package/dist/commands/distribute-elements-command.d.ts +13 -0
  4. package/dist/commands/index.d.ts +1 -0
  5. package/dist/components/ContextMenuDelete.vue.d.ts +1 -1
  6. package/dist/components/ui/{select/SelectTrigger.vue.d.ts → VkButton.vue.d.ts} +13 -7
  7. package/dist/components/ui/VkDropdown.vue.d.ts +22 -0
  8. package/dist/components/ui/VkIcon.vue.d.ts +8 -0
  9. package/dist/components/ui/{textarea/Textarea.vue.d.ts → VkInput.vue.d.ts} +6 -4
  10. package/dist/components/ui/VkInputMM.vue.d.ts +17 -0
  11. package/dist/components/ui/VkInputNumber.vue.d.ts +16 -0
  12. package/dist/components/ui/{input-mm/InputMM.vue.d.ts → VkInputNumberMM.vue.d.ts} +8 -6
  13. package/dist/components/ui/{number-field/NumberFieldContent.vue.d.ts → VkLabel.vue.d.ts} +3 -3
  14. package/dist/components/ui/{dropdown-menu/DropdownMenuRadioItem.vue.d.ts → VkSelect.vue.d.ts} +7 -7
  15. package/dist/components/ui/VkSwitch.vue.d.ts +14 -0
  16. package/dist/components/ui/{toggle/Toggle.vue.d.ts → VkToggle.vue.d.ts} +9 -12
  17. package/dist/components/ui/index.d.ts +11 -14
  18. package/dist/core/Editor.vue.d.ts +1 -7
  19. package/dist/{components/ui/button-group/ButtonGroupText.vue.d.ts → core/GraphicToolPanel.vue.d.ts} +14 -12
  20. package/dist/core/HelpGuide.vue.d.ts +2 -0
  21. package/dist/core/PropertyPanel.vue.d.ts +1 -0
  22. package/dist/core/{ScrollbarLayer.vue.d.ts → StatusBar.vue.d.ts} +1 -3
  23. package/dist/core/Toolbar.vue.d.ts +4 -6
  24. package/dist/core/editor-host.d.ts +12 -0
  25. package/dist/hooks/index.d.ts +0 -1
  26. package/dist/hooks/use-bg-layer.d.ts +6 -0
  27. package/dist/hooks/use-content-layer.d.ts +4 -0
  28. package/dist/hooks/use-ruler-layer.d.ts +6 -1
  29. package/dist/hooks/use-stage-event.d.ts +6 -1
  30. package/dist/hooks/use-stage.d.ts +11 -7
  31. package/dist/hooks/use-zoom.d.ts +20 -1
  32. package/dist/{index-CjPgwxVC.js → index-xKPujfCD.js} +25499 -35356
  33. package/dist/index.d.ts +0 -1
  34. package/dist/{index.es-DekiblxN.js → index.es-CBeYPr_x.js} +1 -1
  35. package/dist/lib/utils.d.ts +1 -2
  36. package/dist/plugins/barcode/Tool.vue.d.ts +2 -1
  37. package/dist/plugins/barcode/barcode.d.ts +4 -0
  38. package/dist/plugins/chart/Tool.vue.d.ts +2 -1
  39. package/dist/plugins/clipboard/clipboard.d.ts +33 -0
  40. package/dist/plugins/clipboard/index.d.ts +1 -0
  41. package/dist/plugins/index.d.ts +2 -0
  42. package/dist/plugins/keydown.d.ts +11 -1
  43. package/dist/plugins/line/Tool.vue.d.ts +2 -1
  44. package/dist/plugins/line/line.d.ts +1 -2
  45. package/dist/plugins/preview/PreviewButton.vue.d.ts +1 -1
  46. package/dist/plugins/qrcode/Tool.vue.d.ts +2 -1
  47. package/dist/plugins/rect/Tool.vue.d.ts +2 -1
  48. package/dist/plugins/rect/rect.d.ts +1 -2
  49. package/dist/plugins/selection.d.ts +5 -0
  50. package/dist/{components/ui/number-field/NumberFieldInput.vue.d.ts → plugins/snap/SnapToggle.vue.d.ts} +4 -3
  51. package/dist/plugins/snap/index.d.ts +2 -0
  52. package/dist/plugins/snap/snap.d.ts +24 -0
  53. package/dist/plugins/table/Tool.vue.d.ts +2 -1
  54. package/dist/plugins/table/table.d.ts +1 -2
  55. package/dist/plugins/text/TextContextMenu.vue.d.ts +1 -1
  56. package/dist/plugins/text/Tool.vue.d.ts +2 -1
  57. package/dist/plugins/text/text.d.ts +1 -0
  58. package/dist/plugins/toolbar-manager.d.ts +3 -1
  59. package/dist/types/base-graphic-element.d.ts +3 -0
  60. package/dist/types/base.d.ts +14 -0
  61. package/dist/types/event-data.d.ts +16 -0
  62. package/dist/types/event-map.d.ts +6 -3
  63. package/dist/utils/geometry.d.ts +38 -0
  64. package/dist/utils/index.d.ts +1 -0
  65. package/dist/vkedit.css +1 -1
  66. package/dist/vkedit.es.js +97 -107
  67. package/package.json +11 -20
  68. package/dist/components/ui/button/Button.vue.d.ts +0 -27
  69. package/dist/components/ui/button/index.d.ts +0 -7
  70. package/dist/components/ui/button-group/ButtonGroup.vue.d.ts +0 -23
  71. package/dist/components/ui/button-group/ButtonGroupSeparator.vue.d.ts +0 -9
  72. package/dist/components/ui/button-group/index.d.ts +0 -8
  73. package/dist/components/ui/dropdown-menu/DropdownMenu.vue.d.ts +0 -22
  74. package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +0 -28
  75. package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +0 -36
  76. package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +0 -18
  77. package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +0 -26
  78. package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +0 -23
  79. package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +0 -22
  80. package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +0 -7
  81. package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +0 -21
  82. package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +0 -22
  83. package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +0 -38
  84. package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +0 -23
  85. package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +0 -18
  86. package/dist/components/ui/dropdown-menu/index.d.ts +0 -15
  87. package/dist/components/ui/input/Input.vue.d.ts +0 -12
  88. package/dist/components/ui/input/index.d.ts +0 -1
  89. package/dist/components/ui/input-mm/InputNumberMM.vue.d.ts +0 -14
  90. package/dist/components/ui/input-mm/index.d.ts +0 -2
  91. package/dist/components/ui/input-number/VkInputNumber.vue.d.ts +0 -9
  92. package/dist/components/ui/input-number/index.d.ts +0 -1
  93. package/dist/components/ui/label/Label.vue.d.ts +0 -22
  94. package/dist/components/ui/label/index.d.ts +0 -1
  95. package/dist/components/ui/number-field/NumberField.vue.d.ts +0 -26
  96. package/dist/components/ui/number-field/NumberFieldDecrement.vue.d.ts +0 -22
  97. package/dist/components/ui/number-field/NumberFieldIncrement.vue.d.ts +0 -22
  98. package/dist/components/ui/number-field/index.d.ts +0 -5
  99. package/dist/components/ui/scroll-area/ScrollArea.vue.d.ts +0 -22
  100. package/dist/components/ui/scroll-area/ScrollBar.vue.d.ts +0 -9
  101. package/dist/components/ui/scroll-area/index.d.ts +0 -2
  102. package/dist/components/ui/select/Select.vue.d.ts +0 -25
  103. package/dist/components/ui/select/SelectContent.vue.d.ts +0 -32
  104. package/dist/components/ui/select/SelectGroup.vue.d.ts +0 -18
  105. package/dist/components/ui/select/SelectItem.vue.d.ts +0 -22
  106. package/dist/components/ui/select/SelectItemText.vue.d.ts +0 -18
  107. package/dist/components/ui/select/SelectLabel.vue.d.ts +0 -22
  108. package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +0 -22
  109. package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +0 -22
  110. package/dist/components/ui/select/SelectSeparator.vue.d.ts +0 -7
  111. package/dist/components/ui/select/SelectValue.vue.d.ts +0 -18
  112. package/dist/components/ui/select/index.d.ts +0 -11
  113. package/dist/components/ui/separator/Separator.vue.d.ts +0 -10
  114. package/dist/components/ui/separator/index.d.ts +0 -1
  115. package/dist/components/ui/slider/Slider.vue.d.ts +0 -13
  116. package/dist/components/ui/slider/index.d.ts +0 -1
  117. package/dist/components/ui/switch/Switch.vue.d.ts +0 -26
  118. package/dist/components/ui/switch/index.d.ts +0 -1
  119. package/dist/components/ui/textarea/index.d.ts +0 -1
  120. package/dist/components/ui/toggle/index.d.ts +0 -7
  121. package/dist/core/Toolbox.vue.d.ts +0 -23
  122. package/dist/hooks/use-scrollbar-layer.d.ts +0 -47
  123. package/dist/stores/index.d.ts +0 -1
  124. package/dist/stores/use-stage-store.d.ts +0 -40
  125. package/dist/styles/index.css +0 -144
  126. /package/dist/core/{Zoom.vue.d.ts → GuideLayer.vue.d.ts} +0 -0
package/dist/index.d.ts CHANGED
@@ -4,5 +4,4 @@ export * from './core';
4
4
  export * from './create-host';
5
5
  export * from './hooks';
6
6
  export * from './plugins';
7
- export * from './stores';
8
7
  export * from './types';
@@ -1,4 +1,4 @@
1
- import { c as Da, _ as Va, g as il } from "./index-CjPgwxVC.js";
1
+ import { c as Da, _ as Va, g as il } from "./index-xKPujfCD.js";
2
2
  var fn = {}, cn = {}, cr, vn;
3
3
  function Q() {
4
4
  if (vn) return cr;
@@ -1,2 +1 @@
1
- import { ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  host: import('../../core').EditorHost;
3
+ collapsed?: boolean;
3
4
  };
4
- 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, {}, HTMLButtonElement>;
5
6
  export default _default;
@@ -28,6 +28,10 @@ export declare class BarcodeElement extends BaseGraphicElement {
28
28
  get margin(): number;
29
29
  get barcodeHeight(): number;
30
30
  get barcodeWidth(): number;
31
+ getTransformAttr(event: any): {
32
+ oldAttrs: any;
33
+ newAttrs: any;
34
+ };
31
35
  deserialize(data: any): void;
32
36
  serialize(): {
33
37
  content: string;
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  host: import('../../core').EditorHost;
3
+ collapsed?: boolean;
3
4
  };
4
- 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, {}, HTMLButtonElement>;
5
6
  export default _default;
@@ -0,0 +1,33 @@
1
+ import { BasePlugin } from '../../types/base-plugin';
2
+ import { IGraphicElement } from '../../types';
3
+ export interface PointMM {
4
+ x: number;
5
+ y: number;
6
+ }
7
+ export declare class ClipboardPlugin extends BasePlugin {
8
+ name: string;
9
+ version: string;
10
+ private state;
11
+ private fallbackOffset;
12
+ private lastMousePointMM;
13
+ private mouseOnCanvas;
14
+ private static readonly FALLBACK_STEP;
15
+ private static readonly SELECT_DELAY;
16
+ protected onInstall(): void;
17
+ protected onUninstall(): void;
18
+ private handleMouseMove;
19
+ private handleMouseEnter;
20
+ private handleMouseLeave;
21
+ copy(elements: IGraphicElement[]): void;
22
+ paste(targetPointMM?: PointMM): string[];
23
+ cloneElementsAt(elements: IGraphicElement[], deltaMM: PointMM): string[];
24
+ clear(): void;
25
+ hasData(): boolean;
26
+ private selectAfterDelay;
27
+ private uuidFallback;
28
+ }
29
+ declare module '../../types' {
30
+ interface PluginMap {
31
+ 'clipboard-plugin': ClipboardPlugin;
32
+ }
33
+ }
@@ -0,0 +1 @@
1
+ export * from './clipboard';
@@ -1,5 +1,6 @@
1
1
  export * from './align';
2
2
  export * from './barcode';
3
+ export * from './clipboard';
3
4
  export * from './chart';
4
5
  export * from './context-menu-manager';
5
6
  export * from './element-manager';
@@ -14,6 +15,7 @@ export * from './property-panel-manager';
14
15
  export * from './qrcode';
15
16
  export * from './rect';
16
17
  export * from './selection';
18
+ export * from './snap';
17
19
  export * from './table';
18
20
  export * from './text';
19
21
  export * from './toolbar-manager';
@@ -2,11 +2,21 @@ import { BasePlugin } from '../types/base-plugin';
2
2
  export declare class KeyDownPlugin extends BasePlugin {
3
3
  name: string;
4
4
  version: string;
5
+ private static readonly MOVE_STEP;
6
+ private static readonly MOVE_STEP_FAST;
5
7
  protected onInstall(): void;
6
8
  protected onUninstall(): void;
7
9
  private handleKeyDown;
10
+ private handleMoveLeft;
11
+ private handleMoveRight;
12
+ private handleMoveUp;
13
+ private handleMoveDown;
14
+ private getStep;
15
+ private moveSelection;
16
+ private isInputFocused;
17
+ private copySelection;
18
+ private pasteFromClipboard;
8
19
  private deleteSelectionElement;
9
- private toLeft;
10
20
  }
11
21
  declare module '../types' {
12
22
  interface PluginMap {
@@ -1,6 +1,7 @@
1
1
  import { EditorHost } from '../../core';
2
2
  type __VLS_Props = {
3
3
  host: EditorHost;
4
+ collapsed?: boolean;
4
5
  };
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, {}, any>;
6
+ 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, {}, HTMLButtonElement>;
6
7
  export default _default;
@@ -1,5 +1,4 @@
1
1
  import { BasePlugin } from '../../types/base-plugin';
2
- import { IGraphicElement } from '../../types';
3
2
  import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
4
3
  import { EditorHost } from '../../core';
5
4
  export interface LineOptions extends BaseGraphicElementOptions {
@@ -27,7 +26,7 @@ export declare class LineElement extends BaseGraphicElement {
27
26
  visible: boolean;
28
27
  draggable: boolean;
29
28
  };
30
- clone(): IGraphicElement;
29
+ deserialize(data: any): void;
31
30
  serialize(): {
32
31
  stroke: string;
33
32
  id: string;
@@ -1,5 +1,5 @@
1
1
  type __VLS_Props = {
2
2
  host: import('../../core').EditorHost;
3
3
  };
4
- 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>;
4
+ 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, {}, HTMLButtonElement>;
5
5
  export default _default;
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  host: import('../../core').EditorHost;
3
+ collapsed?: boolean;
3
4
  };
4
- 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, {}, HTMLButtonElement>;
5
6
  export default _default;
@@ -1,6 +1,7 @@
1
1
  import { EditorHost } from '../../core';
2
2
  type __VLS_Props = {
3
3
  host: EditorHost;
4
+ collapsed?: boolean;
4
5
  };
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, {}, any>;
6
+ 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, {}, HTMLButtonElement>;
6
7
  export default _default;
@@ -1,5 +1,4 @@
1
1
  import { BasePlugin } from '../../types/base-plugin';
2
- import { IGraphicElement } from '../../types';
3
2
  import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
4
3
  import { EditorHost } from '../../core';
5
4
  export interface RectOptions extends BaseGraphicElementOptions {
@@ -33,7 +32,7 @@ export declare class RectElement extends BaseGraphicElement {
33
32
  visible: boolean;
34
33
  draggable: boolean;
35
34
  };
36
- clone(): IGraphicElement;
35
+ deserialize(data: any): void;
37
36
  serialize(): {
38
37
  fill: string;
39
38
  stroke: string;
@@ -8,12 +8,17 @@ export declare class SelectionPlugin extends BasePlugin {
8
8
  selectionEnd: Point2D;
9
9
  private selectionIds;
10
10
  private mouseDownId;
11
+ private static readonly CLICK_THRESHOLD;
11
12
  private elementsPlugin;
12
13
  protected onInstall(): void;
13
14
  protected onUninstall(): void;
14
15
  private handleMouseDown;
16
+ private isClickOnTransformer;
15
17
  private handleMouseMove;
16
18
  private handleMouseUp;
19
+ private isModifierPressed;
20
+ private isDragged;
21
+ private emitSelectionChanged;
17
22
  private getSelectedElements;
18
23
  private handleElementAdded;
19
24
  private handleElementRemoved;
@@ -1,6 +1,7 @@
1
- import { HTMLAttributes } from 'vue';
1
+ import { EditorHost } from '../../core';
2
2
  type __VLS_Props = {
3
- class?: HTMLAttributes["class"];
3
+ host: EditorHost;
4
+ collapsed?: boolean;
4
5
  };
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, {}, any>;
6
+ 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, {}, HTMLButtonElement>;
6
7
  export default _default;
@@ -0,0 +1,2 @@
1
+ export * from './snap';
2
+ export { default as SnapToggle } from './SnapToggle.vue';
@@ -0,0 +1,24 @@
1
+ import { Ref } from 'vue';
2
+ import { BasePlugin } from '../../types/base-plugin';
3
+ import { GuideLine } from '../../utils/geometry';
4
+ export declare class SnapPlugin extends BasePlugin {
5
+ name: string;
6
+ version: string;
7
+ guideLines: Ref<GuideLine[]>;
8
+ private snapEnabledSnapshot;
9
+ private cachedTargetLines;
10
+ private cachedSelectionIds;
11
+ protected onInstall(): void;
12
+ protected onUninstall(): void;
13
+ isSnapEnabled(): boolean;
14
+ toggleSnap(): void;
15
+ private handleDragStart;
16
+ private cacheTargets;
17
+ private handleDragMove;
18
+ private handleDragEnd;
19
+ }
20
+ declare module '../../types' {
21
+ interface PluginMap {
22
+ 'snap-plugin': SnapPlugin;
23
+ }
24
+ }
@@ -1,6 +1,7 @@
1
1
  import { EditorHost } from '../../core';
2
2
  type __VLS_Props = {
3
3
  host: EditorHost;
4
+ collapsed?: boolean;
4
5
  };
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, {}, any>;
6
+ 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, {}, HTMLButtonElement>;
6
7
  export default _default;
@@ -1,5 +1,4 @@
1
1
  import { BasePlugin } from '../../types/base-plugin';
2
- import { IGraphicElement } from '../../types';
3
2
  import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
4
3
  import { EditorHost } from '../../core';
5
4
  export interface TableOptions extends BaseGraphicElementOptions {
@@ -52,7 +51,7 @@ export declare class TableElement extends BaseGraphicElement {
52
51
  removeRow(index?: number): void;
53
52
  addCol(after?: number): void;
54
53
  removeCol(index?: number): void;
55
- clone(): IGraphicElement;
54
+ deserialize(data: any): void;
56
55
  serialize(): {
57
56
  rowsHeight: number[];
58
57
  colsWidth: number[];
@@ -1,5 +1,5 @@
1
1
  type __VLS_Props = {
2
2
  host: import('../../core').EditorHost;
3
3
  };
4
- 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>;
4
+ 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, {}, HTMLButtonElement>;
5
5
  export default _default;
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  host: import('../../core').EditorHost;
3
+ collapsed?: boolean;
3
4
  };
4
- 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, {}, HTMLButtonElement>;
5
6
  export default _default;
@@ -37,6 +37,7 @@ export declare class TextElement extends BaseGraphicElement {
37
37
  visible: boolean;
38
38
  draggable: boolean;
39
39
  };
40
+ deserialize(data: any): void;
40
41
  serialize(): {
41
42
  text: string;
42
43
  fontSize: number;
@@ -1,5 +1,5 @@
1
1
  import { BasePlugin } from '../types/base-plugin';
2
- import { ToolEventData } from '../types';
2
+ import { ToolEventData, ToolGroup } from '../types';
3
3
  export declare class ToolbarManagerPlugin extends BasePlugin {
4
4
  name: string;
5
5
  version: string;
@@ -8,6 +8,8 @@ export declare class ToolbarManagerPlugin extends BasePlugin {
8
8
  protected onUninstall(): void;
9
9
  private handleRegistered;
10
10
  getTools(): ToolEventData[];
11
+ getToolsByGroup(group: ToolGroup): ToolEventData[];
12
+ getGroupedTools(): Record<string, ToolEventData[]>;
11
13
  }
12
14
  declare module '../types' {
13
15
  interface PluginMap {
@@ -1,5 +1,7 @@
1
1
  import { IGraphicElement } from '.';
2
2
  import { EditorHost } from '../core';
3
+ export declare const DEFAULT_ANCHORS: string[];
4
+ export declare const CORNER_ANCHORS: string[];
3
5
  export interface BaseGraphicElementOptions {
4
6
  xmm?: number;
5
7
  ymm?: number;
@@ -36,6 +38,7 @@ export declare abstract class BaseGraphicElement implements IGraphicElement {
36
38
  locked: boolean;
37
39
  draggable: boolean;
38
40
  transferable: boolean;
41
+ resizeAnchors: string[] | null;
39
42
  constructor(host: EditorHost, options?: Partial<BaseGraphicElementOptions>);
40
43
  updateProperty(host: EditorHost, property: string, oldValue: any, newValue: any): void;
41
44
  clone(): IGraphicElement;
@@ -33,6 +33,7 @@ export interface IGraphicElement {
33
33
  locked: boolean;
34
34
  draggable: boolean;
35
35
  transferable: boolean;
36
+ resizeAnchors?: string[] | null;
36
37
  getBoundingBox(): BoundingBox;
37
38
  clone(): IGraphicElement;
38
39
  serialize(): any;
@@ -75,7 +76,20 @@ export interface IEditorState {
75
76
  hmm: number;
76
77
  dpm: number;
77
78
  }
79
+ export interface IStageState {
80
+ viewportWidth: number;
81
+ viewportHeight: number;
82
+ wrapperEl: HTMLElement | null;
83
+ currentCursorMode: CursorMode;
84
+ mouseStageX: number;
85
+ mouseStageY: number;
86
+ spacePressed: boolean;
87
+ isPanning: boolean;
88
+ offsetX: number;
89
+ offsetY: number;
90
+ }
78
91
  export interface IToolbar {
79
92
  name: string;
80
93
  getComponent(): Component;
81
94
  }
95
+ export type CursorMode = 'default' | 'hovering' | 'grab' | 'grabbing' | 'dragging';
@@ -26,9 +26,11 @@ export interface TransformEventData extends ElementEventData {
26
26
  export interface ElementUpdateEventData extends ElementEventData {
27
27
  updatedProperties: string[];
28
28
  }
29
+ export type ToolGroup = 'history' | 'tools' | 'actions';
29
30
  export interface ToolEventData extends BaseEventData {
30
31
  toolName: string;
31
32
  render: () => Component;
33
+ group?: ToolGroup;
32
34
  }
33
35
  export interface PluginEventData extends BaseEventData {
34
36
  plugin: any;
@@ -70,6 +72,10 @@ export interface AlignEventData extends BaseEventData {
70
72
  alignment: 'left' | 'right' | 'top' | 'bottom' | 'centerX' | 'centerY';
71
73
  elementIds: string[];
72
74
  }
75
+ export interface DistributeEventData extends BaseEventData {
76
+ direction: 'horizontal' | 'vertical';
77
+ elementIds: string[];
78
+ }
73
79
  export interface LayerOrderEventData extends BaseEventData {
74
80
  elementId: string;
75
81
  direction: 'up' | 'down' | 'top' | 'bottom';
@@ -84,12 +90,22 @@ export interface BaseStageEventData extends BaseEventData {
84
90
  export interface StageMouseEventData extends BaseStageEventData {
85
91
  evt: MouseEvent;
86
92
  }
93
+ export interface StageDblClickEventData extends StageMouseEventData {
94
+ element: IGraphicElement | null;
95
+ elementId: string | null;
96
+ }
87
97
  export interface StageKeyboardEventData extends BaseEventData {
88
98
  evt: KeyboardEvent;
89
99
  }
90
100
  export interface StatusEventData extends BaseEventData {
91
101
  status: IEditorState;
92
102
  }
103
+ export interface ElementDragEventData extends BaseEventData {
104
+ element: IGraphicElement;
105
+ elementId: string;
106
+ target: any;
107
+ evt: MouseEvent | undefined;
108
+ }
93
109
  /**
94
110
  * 事件工具函数
95
111
  */
@@ -1,4 +1,4 @@
1
- import { BaseEventData, ElementEventData, SelectionEventData, TransformEventData, ToolEventData, PluginEventData, CommandEventData, HistoryEventData, ViewEventData, CreationEventData, ErrorEventData, PerformanceEventData, AlignEventData, LayerOrderEventData, ElementUpdateEventData, 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 } from './event-data';
2
2
  /**
3
3
  * 编辑器事件映射接口
4
4
  * @description 定义编辑器中所有可能的事件及其对应的负载类型。
@@ -32,7 +32,7 @@ export interface EventMap {
32
32
  'stage:mousemove': (payload: StageMouseEventData) => void;
33
33
  'stage:mouseup': (payload: StageMouseEventData) => void;
34
34
  'stage:click': (payload: StageMouseEventData) => void;
35
- 'stage:dblclick': (payload: StageMouseEventData) => void;
35
+ 'stage:dblclick': (payload: StageDblClickEventData) => void;
36
36
  'stage:contextmenu': (payload: StageMouseEventData) => void;
37
37
  'stage:mouseenter': (payload: StageMouseEventData) => void;
38
38
  'stage:mouseleave': (payload: StageMouseEventData) => void;
@@ -64,6 +64,9 @@ export interface EventMap {
64
64
  'element:locked-change': (payload: ElementEventData) => void;
65
65
  'element:visibility-change': (payload: ElementEventData) => void;
66
66
  'element:zindex-change': (payload: ElementEventData) => void;
67
+ 'element:dragstart': (payload: ElementDragEventData) => void;
68
+ 'element:dragmove': (payload: ElementDragEventData) => void;
69
+ 'element:dragend': (payload: ElementDragEventData) => void;
67
70
  'selection:changed': (payload: SelectionEventData) => void;
68
71
  'selection:cleared': (payload: SelectionEventData) => void;
69
72
  'selection:multi-change': (payload: SelectionEventData) => void;
@@ -102,7 +105,7 @@ export interface EventMap {
102
105
  'property:batch-update-start': (payload: BaseEventData) => void;
103
106
  'property:batch-update-end': (payload: BaseEventData) => void;
104
107
  'elements:align': (payload: AlignEventData) => void;
105
- 'elements:distribute': (payload: BaseEventData) => void;
108
+ 'elements:distribute': (payload: DistributeEventData) => void;
106
109
  'elements:group': (payload: BaseEventData) => void;
107
110
  'elements:ungroup': (payload: BaseEventData) => void;
108
111
  'elements:layer': (payload: LayerOrderEventData) => void;
@@ -0,0 +1,38 @@
1
+ export interface AABBInput {
2
+ x: number;
3
+ y: number;
4
+ width: number;
5
+ height: number;
6
+ rotation: number;
7
+ scaleX: number;
8
+ scaleY: number;
9
+ }
10
+ export interface AABB {
11
+ left: number;
12
+ right: number;
13
+ top: number;
14
+ bottom: number;
15
+ centerX: number;
16
+ centerY: number;
17
+ }
18
+ export interface GuideLine {
19
+ axis: 'x' | 'y';
20
+ value: number;
21
+ }
22
+ export interface AABBLineValues {
23
+ xValues: number[];
24
+ yValues: number[];
25
+ }
26
+ export interface SnapMatch {
27
+ snapTo: number;
28
+ source: number;
29
+ delta: number;
30
+ }
31
+ export interface SnapResult {
32
+ x: SnapMatch | null;
33
+ y: SnapMatch | null;
34
+ }
35
+ export declare function getElementAABB(input: AABBInput): AABB;
36
+ export declare function getAABBLineValues(aabb: AABB): AABBLineValues;
37
+ export declare function unionAABB(aabbs: AABB[]): AABB | null;
38
+ export declare function computeSnap(dragged: AABBLineValues, targets: AABBLineValues[], threshold: number): SnapResult;
@@ -0,0 +1 @@
1
+ export * from './geometry';