vkedit 4.0.0 → 4.0.2

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 (47) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +21 -21
  3. package/README.md +9 -0
  4. package/THIRD_PARTY_LICENSES.md +64 -0
  5. package/dist/commands/add-element-command.d.ts +0 -2
  6. package/dist/commands/base-command.d.ts +1 -0
  7. package/dist/commands/change-layer-order-command.d.ts +1 -0
  8. package/dist/commands/index.d.ts +1 -0
  9. package/dist/commands/reorder-elements-command.d.ts +1 -0
  10. package/dist/commands/transform-element-command.d.ts +1 -0
  11. package/dist/commands/update-canvas-property-command.d.ts +23 -0
  12. package/dist/core/RotateAngleLabel.vue.d.ts +9 -0
  13. package/dist/core/editor-host.d.ts +2 -0
  14. package/dist/favicon.svg +21 -8
  15. package/dist/hooks/index.d.ts +1 -0
  16. package/dist/hooks/use-canvas-property-command.d.ts +5 -0
  17. package/dist/hooks/use-content-layer.d.ts +0 -3
  18. package/dist/{index-CSKpw1uX.js → index-BlZP6Kl3.js} +9450 -9312
  19. package/dist/{index.es-Dswe047Z.js → index.es-BsTzN-5u.js} +1 -1
  20. package/dist/plugins/barcode/PropertyPanel.vue.d.ts +1 -1
  21. package/dist/plugins/barcode/Shape.vue.d.ts +2 -4
  22. package/dist/plugins/barcode/barcode.d.ts +2 -4
  23. package/dist/plugins/line/PropertyPanel.vue.d.ts +1 -1
  24. package/dist/plugins/line/Shape.vue.d.ts +2 -2
  25. package/dist/plugins/line/line.d.ts +20 -9
  26. package/dist/plugins/qrcode/PropertyPanel.vue.d.ts +1 -1
  27. package/dist/plugins/qrcode/Shape.vue.d.ts +2 -4
  28. package/dist/plugins/qrcode/qrcode.d.ts +2 -4
  29. package/dist/plugins/rect/PropertyPanel.vue.d.ts +1 -1
  30. package/dist/plugins/rect/Shape.vue.d.ts +2 -2
  31. package/dist/plugins/rect/rect.d.ts +2 -3
  32. package/dist/plugins/snap/snap.d.ts +10 -1
  33. package/dist/plugins/text/PropertyPanel.vue.d.ts +1 -1
  34. package/dist/plugins/text/Shape.vue.d.ts +2 -2
  35. package/dist/plugins/text/text.d.ts +2 -2
  36. package/dist/types/base.d.ts +1 -0
  37. package/dist/types/event-data.d.ts +21 -0
  38. package/dist/types/event-map.d.ts +7 -7
  39. package/dist/types/graphic-plugin.d.ts +26 -0
  40. package/dist/types/index.d.ts +1 -0
  41. package/dist/types/shape-props.d.ts +6 -0
  42. package/dist/utils/geometry.d.ts +13 -0
  43. package/dist/utils/transform-geometry.d.ts +1 -1
  44. package/dist/vkedit.css +1 -1
  45. package/dist/vkedit.es.js +41 -39
  46. package/package.json +9 -4
  47. package/dist/favicon.ico +0 -0
@@ -1,4 +1,4 @@
1
- import { c as Da, _ as Va, g as il } from "./index-CSKpw1uX.js";
1
+ import { c as Da, _ as Va, g as il } from "./index-BlZP6Kl3.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 { EditorHost } from '../../core';
2
2
  import { BarcodeElement } from './barcode';
3
- interface Props {
3
+ export interface Props {
4
4
  host: EditorHost;
5
5
  element: BarcodeElement;
6
6
  selection: BarcodeElement[];
@@ -1,8 +1,6 @@
1
+ import { ShapeProps } from '../../types/shape-props';
1
2
  import { BarcodeElement } from './barcode';
2
- import { EditorHost } from '../../core';
3
- export interface Props {
4
- host: EditorHost;
5
- element: BarcodeElement;
3
+ export interface Props extends ShapeProps<BarcodeElement> {
6
4
  }
7
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>;
8
6
  export default _default;
@@ -1,4 +1,4 @@
1
- import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
1
+ import { GraphicPlugin } 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 {
@@ -69,7 +69,5 @@ export declare class BarcodePlugin extends GraphicPlugin<BarcodeElement> {
69
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
70
  iconComponent: import('vue').Component;
71
71
  typeDisplayName: string;
72
- propertyPanels: PropertyPanelRegistration[];
73
- protected onInstall(): void;
74
- protected onUninstall(): void;
72
+ propertyPanel: import('vue').DefineComponent<import('./PropertyPanel.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./PropertyPanel.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
75
73
  }
@@ -1,6 +1,6 @@
1
1
  import { EditorHost } from '../../core';
2
2
  import { LineElement } from './line';
3
- interface Props {
3
+ export interface Props {
4
4
  host: EditorHost;
5
5
  element: LineElement;
6
6
  selection: LineElement[];
@@ -1,6 +1,6 @@
1
+ import { ShapeProps } from '../../types/shape-props';
1
2
  import { LineElement } from './line';
2
- export interface Props {
3
- element: LineElement;
3
+ export interface Props extends ShapeProps<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>;
6
6
  export default _default;
@@ -1,4 +1,4 @@
1
- import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
1
+ import { GraphicPlugin } 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 {
@@ -9,12 +9,11 @@ export interface LineOptions extends BaseGraphicElementOptions {
9
9
  export declare class LineElement extends BaseGraphicElement {
10
10
  type: string;
11
11
  stroke: string;
12
+ private static readonly MIN_HIT_SCREEN_PX;
12
13
  constructor(host: EditorHost, options?: Partial<LineOptions>);
13
- get config(): {
14
- points: number[];
15
- stroke: string;
16
- strokeWidth: number;
17
- hitStrokeWidth: number;
14
+ get hitHeight(): number;
15
+ get groupConfig(): {
16
+ [key: string]: any;
18
17
  id: string;
19
18
  x: number;
20
19
  y: number;
@@ -26,6 +25,20 @@ export declare class LineElement extends BaseGraphicElement {
26
25
  visible: boolean;
27
26
  draggable: boolean;
28
27
  };
28
+ get visibleRectConfig(): {
29
+ width: number;
30
+ height: number;
31
+ fill: string;
32
+ x: number;
33
+ y: number;
34
+ };
35
+ get hitRectConfig(): {
36
+ width: number;
37
+ height: number;
38
+ x: number;
39
+ y: number;
40
+ fill: string;
41
+ };
29
42
  deserialize(data: any): void;
30
43
  serialize(): {
31
44
  stroke: string;
@@ -54,7 +67,5 @@ export declare class LinePlugin extends GraphicPlugin<LineElement> {
54
67
  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
68
  iconComponent: import('vue').Component;
56
69
  typeDisplayName: string;
57
- propertyPanels: PropertyPanelRegistration[];
58
- protected onInstall(): void;
59
- protected onUninstall(): void;
70
+ propertyPanel: import('vue').DefineComponent<import('./PropertyPanel.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./PropertyPanel.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
60
71
  }
@@ -1,6 +1,6 @@
1
1
  import { EditorHost } from '../../core';
2
2
  import { QrcodeElement } from './qrcode';
3
- interface Props {
3
+ export interface Props {
4
4
  host: EditorHost;
5
5
  element: QrcodeElement;
6
6
  selection: QrcodeElement[];
@@ -1,8 +1,6 @@
1
+ import { ShapeProps } from '../../types/shape-props';
1
2
  import { QrcodeElement } from './qrcode';
2
- import { EditorHost } from '../../core';
3
- export interface Props {
4
- host: EditorHost;
5
- element: QrcodeElement;
3
+ export interface Props extends ShapeProps<QrcodeElement> {
6
4
  }
7
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>;
8
6
  export default _default;
@@ -1,4 +1,4 @@
1
- import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
1
+ import { GraphicPlugin } 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 {
@@ -68,7 +68,5 @@ export declare class QrcodePlugin extends GraphicPlugin<QrcodeElement> {
68
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
69
  iconComponent: import('vue').Component;
70
70
  typeDisplayName: string;
71
- propertyPanels: PropertyPanelRegistration[];
72
- protected onInstall(): void;
73
- protected onUninstall(): void;
71
+ propertyPanel: import('vue').DefineComponent<import('./PropertyPanel.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./PropertyPanel.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
74
72
  }
@@ -1,6 +1,6 @@
1
1
  import { EditorHost } from '../../core';
2
2
  import { RectElement } from './rect';
3
- interface Props {
3
+ export interface Props {
4
4
  host: EditorHost;
5
5
  element: RectElement;
6
6
  selection: RectElement[];
@@ -1,6 +1,6 @@
1
+ import { ShapeProps } from '../../types/shape-props';
1
2
  import { RectElement } from './rect';
2
- export interface Props {
3
- element: RectElement;
3
+ export interface Props extends ShapeProps<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>;
6
6
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
2
2
  import { EditorHost } from '../../core';
3
- import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
3
+ import { GraphicPlugin } from '../../types/graphic-plugin';
4
4
  export interface RectOptions extends BaseGraphicElementOptions {
5
5
  x?: number;
6
6
  y?: number;
@@ -62,6 +62,5 @@ export declare class RectPlugin extends GraphicPlugin<RectElement> {
62
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
63
  iconComponent: import('vue').Component;
64
64
  typeDisplayName: string;
65
- propertyPanels: PropertyPanelRegistration[];
66
- protected onInstall(): void;
65
+ propertyPanel: import('vue').DefineComponent<import('./PropertyPanel.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./PropertyPanel.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
67
66
  }
@@ -1,5 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { BasePlugin } from '../../types/base-plugin';
3
+ import { IGraphicElement } from '../../types';
3
4
  import { GuideLine } from '../../utils/geometry';
4
5
  export declare class SnapPlugin extends BasePlugin {
5
6
  name: string;
@@ -8,13 +9,21 @@ export declare class SnapPlugin extends BasePlugin {
8
9
  private snapEnabledSnapshot;
9
10
  private cachedTargetLines;
10
11
  private cachedSelectionIds;
12
+ private sticky;
11
13
  protected onInstall(): void;
12
14
  protected onUninstall(): void;
13
15
  isSnapEnabled(): boolean;
14
16
  toggleSnap(): void;
17
+ private resetSessionState;
15
18
  private handleDragStart;
16
19
  private cacheTargets;
17
- private handleDragMove;
20
+ resolveDragSnap(elements: IGraphicElement[], intentPositions: Map<string, {
21
+ x: number;
22
+ y: number;
23
+ }>): {
24
+ offsetX: number;
25
+ offsetY: number;
26
+ };
18
27
  private handleDragEnd;
19
28
  }
20
29
  declare module '../../types' {
@@ -1,6 +1,6 @@
1
1
  import { EditorHost } from '../../core';
2
2
  import { TextElement } from './text';
3
- interface Props {
3
+ export interface Props {
4
4
  host: EditorHost;
5
5
  element: TextElement;
6
6
  selection: TextElement[];
@@ -1,6 +1,6 @@
1
+ import { ShapeProps } from '../../types/shape-props';
1
2
  import { TextElement } from './text';
2
- export interface Props {
3
- element: TextElement;
3
+ export interface Props extends ShapeProps<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>;
6
6
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
2
- import { GraphicPlugin, PropertyPanelRegistration } from '../../types/graphic-plugin';
2
+ import { GraphicPlugin } from '../../types/graphic-plugin';
3
3
  import { EditorHost } from '../../core';
4
4
  export interface TextOptions extends BaseGraphicElementOptions {
5
5
  x?: number;
@@ -73,7 +73,7 @@ export declare class TextPlugin extends GraphicPlugin<TextElement> {
73
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
74
  iconComponent: import('vue').Component;
75
75
  typeDisplayName: string;
76
- propertyPanels: PropertyPanelRegistration[];
76
+ propertyPanel: import('vue').DefineComponent<import('./PropertyPanel.vue').Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./PropertyPanel.vue').Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
77
77
  protected onInstall(): void;
78
78
  protected onUninstall(): void;
79
79
  }
@@ -74,6 +74,7 @@ export interface IStageState {
74
74
  isPanning: boolean;
75
75
  offsetX: number;
76
76
  offsetY: number;
77
+ autoFitPending: boolean;
77
78
  }
78
79
  export interface IToolbar {
79
80
  name: string;
@@ -7,6 +7,10 @@ export interface BaseEventData {
7
7
  timestamp?: number;
8
8
  source?: string;
9
9
  }
10
+ export interface EditorLifecyclePayload {
11
+ timestamp: number;
12
+ source: string;
13
+ }
10
14
  export interface ElementEventData extends BaseEventData {
11
15
  element: any;
12
16
  elementId: string;
@@ -18,6 +22,9 @@ export interface ElementRegisteredEventData extends BaseEventData {
18
22
  export interface SelectionEventData extends BaseEventData {
19
23
  selection: Array<IGraphicElement>;
20
24
  }
25
+ export interface SelectionChangedPayload {
26
+ elements: unknown[];
27
+ }
21
28
  export interface TransformEventData extends ElementEventData {
22
29
  oldState: any;
23
30
  newState: any;
@@ -35,6 +42,10 @@ export interface ToolEventData extends BaseEventData {
35
42
  export interface PluginEventData extends BaseEventData {
36
43
  plugin: any;
37
44
  }
45
+ export interface PluginLoadedPayload extends BaseEventData {
46
+ name: string;
47
+ plugin: unknown;
48
+ }
38
49
  export interface CommandEventData extends BaseEventData {
39
50
  command: any;
40
51
  }
@@ -81,6 +92,16 @@ export interface LayerOrderEventData extends BaseEventData {
81
92
  direction: 'up' | 'down' | 'top' | 'bottom';
82
93
  newOrder?: string[];
83
94
  }
95
+ export interface LayerOrderChangedPayload extends BaseEventData {
96
+ elementIds: string[];
97
+ elementId?: string;
98
+ direction?: 'up' | 'down' | 'top' | 'bottom';
99
+ newOrder?: string[];
100
+ }
101
+ export interface LayerVisibilityChangedPayload extends BaseEventData {
102
+ elementId: string;
103
+ visible: boolean;
104
+ }
84
105
  export interface BaseStageEventData extends BaseEventData {
85
106
  point: Point2D;
86
107
  target: any;
@@ -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, GraphicEventData, GraphicToolEventData, PropertyPanelEventData } from './event-data';
1
+ import { BaseEventData, EditorLifecyclePayload, ElementDragEventData, ElementEventData, SelectionEventData, TransformEventData, ToolEventData, PluginEventData, PluginLoadedPayload, CommandEventData, HistoryEventData, ViewEventData, CreationEventData, ErrorEventData, PerformanceEventData, AlignEventData, DistributeEventData, LayerOrderEventData, LayerOrderChangedPayload, LayerVisibilityChangedPayload, ElementUpdateEventData, StageDblClickEventData, StageMouseEventData, StageKeyboardEventData, ElementRegisteredEventData, StatusEventData, GraphicEventData, GraphicToolEventData, PropertyPanelEventData } from './event-data';
2
2
  /**
3
3
  * 编辑器事件映射接口
4
4
  * @description 定义编辑器中所有可能的事件及其对应的负载类型。
@@ -16,9 +16,9 @@ import { BaseEventData, ElementDragEventData, ElementEventData, SelectionEventDa
16
16
  * ```
17
17
  * */
18
18
  export interface EventMap {
19
- 'editor:ready': (payload: BaseEventData) => void;
20
- 'editor:destroy': (payload: BaseEventData) => void;
21
- 'editor:reset': (payload: BaseEventData) => void;
19
+ 'editor:ready': (payload: EditorLifecyclePayload) => void;
20
+ 'editor:destroy': (payload: EditorLifecyclePayload) => void;
21
+ 'editor:reset': (payload: EditorLifecyclePayload) => void;
22
22
  'file:new': (payload: BaseEventData) => void;
23
23
  'file:open': (payload: BaseEventData) => void;
24
24
  'file:save': (payload: BaseEventData) => void;
@@ -83,8 +83,8 @@ export interface EventMap {
83
83
  'view:ruler-visibility-change': (payload: ViewEventData) => void;
84
84
  'layer:added': (payload: BaseEventData) => void;
85
85
  'layer:removed': (payload: BaseEventData) => void;
86
- 'layer:order-changed': (payload: LayerOrderEventData) => void;
87
- 'layer:visibility-change': (payload: BaseEventData) => void;
86
+ 'layer:order-changed': (payload: LayerOrderChangedPayload) => void;
87
+ 'layer:visibility-change': (payload: LayerVisibilityChangedPayload) => void;
88
88
  'layer:locked-change': (payload: BaseEventData) => void;
89
89
  'layer:active-change': (payload: BaseEventData) => void;
90
90
  'command:executed': (payload: CommandEventData) => void;
@@ -96,7 +96,7 @@ export interface EventMap {
96
96
  'plugin:unregistered': (payload: PluginEventData) => void;
97
97
  'plugin:activated': (payload: PluginEventData) => void;
98
98
  'plugin:deactivated': (payload: PluginEventData) => void;
99
- 'plugin:loaded': (payload: PluginEventData) => void;
99
+ 'plugin:loaded': (payload: PluginLoadedPayload) => void;
100
100
  'plugin:error': (payload: ErrorEventData) => void;
101
101
  'graphic:registered': (payload: GraphicEventData) => void;
102
102
  'graphic:unregistered': (payload: GraphicEventData) => void;
@@ -19,6 +19,32 @@ export declare abstract class GraphicPlugin<T extends IGraphicElement> extends B
19
19
  abstract graphicType: string;
20
20
  abstract graphicElement: new (host: EditorHost) => T;
21
21
  abstract shapeComponent: Component;
22
+ /**
23
+ * 当前图形自身的属性面板 Vue 组件。
24
+ *
25
+ * 与 {@link shapeComponent} / {@link iconComponent} 风格一致:
26
+ * 直接以组件引用声明,而非工厂函数。
27
+ *
28
+ * 基类会在 `onActivate` 时自动 emit 等价的 `property-panel:registered` 事件:
29
+ * - `graphicTypes = [this.graphicType]`
30
+ * - `render = () => this.propertyPanel`
31
+ * - `isCanvas = false`
32
+ * - `isPublic = false`
33
+ *
34
+ * 如需注册自身以外的图形类型、注册多个面板、或 `isCanvas = true` / `isPublic = true`,
35
+ * 请改用旧 {@link propertyPanels} 字段或在独立插件的 `onInstall` 手动 emit。
36
+ */
37
+ propertyPanel?: Component;
38
+ /**
39
+ * 属性面板注册列表(旧 API,多面板与逃生通道)。
40
+ *
41
+ * @deprecated 请优先使用单数 {@link propertyPanel} 字段。本字段仅作为
42
+ * 「多面板 / 为其他 graphicType 注册 / `isCanvas = true` / `isPublic = true`」
43
+ * 场景下的逃生通道保留。新插件禁止使用本字段。
44
+ *
45
+ * 基类 `onActivate` 仍按现有逻辑遍历本数组 emit `property-panel:registered`,
46
+ * 因此同一插件同时声明 `propertyPanel` 与 `propertyPanels` 时两者都会被注册。
47
+ */
22
48
  propertyPanels?: PropertyPanelRegistration[];
23
49
  iconComponent?: Component;
24
50
  typeDisplayName?: string;
@@ -5,3 +5,4 @@ export * from './event-data';
5
5
  export * from './event-map';
6
6
  export * from './konva-text';
7
7
  export * from './graphic-plugin';
8
+ export * from './shape-props';
@@ -0,0 +1,6 @@
1
+ import { EditorHost } from '../core';
2
+ import { IGraphicElement } from './base';
3
+ export interface ShapeProps<T extends IGraphicElement = IGraphicElement> {
4
+ element: T;
5
+ host: EditorHost;
6
+ }
@@ -36,3 +36,16 @@ export declare function getElementAABB(input: AABBInput): AABB;
36
36
  export declare function getAABBLineValues(aabb: AABB): AABBLineValues;
37
37
  export declare function unionAABB(aabbs: AABB[]): AABB | null;
38
38
  export declare function computeSnap(dragged: AABBLineValues, targets: AABBLineValues[], threshold: number): SnapResult;
39
+ export type StickyAxis = SnapMatch | null;
40
+ export interface StickyState {
41
+ x: StickyAxis;
42
+ y: StickyAxis;
43
+ }
44
+ export declare function snapResultToOffset(result: SnapResult): {
45
+ offsetX: number;
46
+ offsetY: number;
47
+ };
48
+ export declare function applyStickySnap(intent: AABBLineValues, rawSnap: SnapResult, sticky: StickyState, threshold: number): {
49
+ result: SnapResult;
50
+ nextSticky: StickyState;
51
+ };
@@ -41,7 +41,7 @@ export declare function getElementOBB(input: {
41
41
  scaleX?: number;
42
42
  scaleY?: number;
43
43
  }): OBB;
44
- export declare function getElementOBBFromSource(element: IGraphicElement, node: {
44
+ export declare function getElementOBBFromSource(element: IGraphicElement, _node: {
45
45
  x: () => number;
46
46
  y: () => number;
47
47
  rotation: () => number;