vkedit 4.0.1 → 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.
@@ -1,4 +1,4 @@
1
- import { c as Da, _ as Va, g as il } from "./index-Dpse_csX.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;
@@ -0,0 +1,73 @@
1
+ import { GraphicPlugin } from '../../types/graphic-plugin';
2
+ import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
3
+ import { EditorHost } from '../../core';
4
+ export interface BarcodeOptions extends BaseGraphicElementOptions {
5
+ x?: number;
6
+ y?: number;
7
+ content?: string;
8
+ format?: string;
9
+ foreground?: string;
10
+ background?: string;
11
+ marginMM?: number;
12
+ displayValue: boolean;
13
+ fontSizeMM: number;
14
+ }
15
+ export declare class BarcodeElement extends BaseGraphicElement {
16
+ type: string;
17
+ content: string;
18
+ format: string;
19
+ foreground: string;
20
+ background: string;
21
+ displayValue: boolean;
22
+ fontSizeMM: number;
23
+ marginMM: number;
24
+ barcodeHeightMM: number;
25
+ barcodeWidthMM: number;
26
+ constructor(host: EditorHost, options?: Partial<BarcodeOptions>);
27
+ get fontSize(): number;
28
+ get margin(): number;
29
+ get barcodeHeight(): number;
30
+ get barcodeWidth(): number;
31
+ getTransformAttr(event: any): {
32
+ oldAttrs: any;
33
+ newAttrs: any;
34
+ };
35
+ deserialize(data: any): void;
36
+ serialize(): {
37
+ content: string;
38
+ format: string;
39
+ foreground: string;
40
+ background: string;
41
+ displayValue: boolean;
42
+ fontSizeMM: number;
43
+ marginMM: number;
44
+ barcodeHeightMM: number;
45
+ barcodeWidthMM: number;
46
+ id: string;
47
+ type: string;
48
+ xmm: number;
49
+ ymm: number;
50
+ wmm: number;
51
+ hmm: number;
52
+ rotation: number;
53
+ scaleX: number;
54
+ scaleY: number;
55
+ visible: boolean;
56
+ locked: boolean;
57
+ draggable: boolean;
58
+ resizable: boolean;
59
+ zIndex: number;
60
+ displayName: string | null;
61
+ };
62
+ renderBarcode(): Promise<HTMLCanvasElement>;
63
+ }
64
+ export declare class BarcodePlugin extends GraphicPlugin<BarcodeElement> {
65
+ name: string;
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
+ 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>;
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,8 +1,6 @@
1
- import { EditorHost } from '../../core';
1
+ import { ShapeProps } from '../../types/shape-props';
2
2
  import { LineElement } from './line';
3
- export interface Props {
4
- host: EditorHost;
5
- element: LineElement;
3
+ export interface Props extends ShapeProps<LineElement> {
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;
@@ -0,0 +1,71 @@
1
+ import { GraphicPlugin } from '../../types/graphic-plugin';
2
+ import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
3
+ import { EditorHost } from '../../core';
4
+ export interface LineOptions extends BaseGraphicElementOptions {
5
+ stroke?: string;
6
+ xmm?: number;
7
+ ymm?: number;
8
+ }
9
+ export declare class LineElement extends BaseGraphicElement {
10
+ type: string;
11
+ stroke: string;
12
+ private static readonly MIN_HIT_SCREEN_PX;
13
+ constructor(host: EditorHost, options?: Partial<LineOptions>);
14
+ get hitHeight(): number;
15
+ get groupConfig(): {
16
+ [key: string]: any;
17
+ id: string;
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ rotation: number;
23
+ scaleX: number;
24
+ scaleY: number;
25
+ visible: boolean;
26
+ draggable: boolean;
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
+ };
42
+ deserialize(data: any): void;
43
+ serialize(): {
44
+ stroke: string;
45
+ id: string;
46
+ type: string;
47
+ xmm: number;
48
+ ymm: number;
49
+ wmm: number;
50
+ hmm: number;
51
+ rotation: number;
52
+ scaleX: number;
53
+ scaleY: number;
54
+ visible: boolean;
55
+ locked: boolean;
56
+ draggable: boolean;
57
+ resizable: boolean;
58
+ zIndex: number;
59
+ displayName: string | null;
60
+ };
61
+ }
62
+ export declare class LinePlugin extends GraphicPlugin<LineElement> {
63
+ name: string;
64
+ version: string;
65
+ graphicType: string;
66
+ graphicElement: typeof LineElement;
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>;
68
+ iconComponent: import('vue').Component;
69
+ typeDisplayName: string;
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>;
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;
@@ -0,0 +1,72 @@
1
+ import { GraphicPlugin } from '../../types/graphic-plugin';
2
+ import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
3
+ import { EditorHost } from '../../core';
4
+ export interface QrcodeOptions extends BaseGraphicElementOptions {
5
+ x?: number;
6
+ y?: number;
7
+ content?: string;
8
+ foreground?: string;
9
+ background?: string;
10
+ marginMM?: number;
11
+ }
12
+ export declare class QrcodeElement extends BaseGraphicElement {
13
+ type: string;
14
+ content: string;
15
+ foreground: string;
16
+ background: string;
17
+ marginMM: number;
18
+ constructor(host: EditorHost, options?: Partial<QrcodeOptions>);
19
+ deserialize(data: any): void;
20
+ serialize(): {
21
+ content: string;
22
+ foreground: string;
23
+ background: string;
24
+ marginMM: number;
25
+ id: string;
26
+ type: string;
27
+ xmm: number;
28
+ ymm: number;
29
+ wmm: number;
30
+ hmm: number;
31
+ rotation: number;
32
+ scaleX: number;
33
+ scaleY: number;
34
+ visible: boolean;
35
+ locked: boolean;
36
+ draggable: boolean;
37
+ resizable: boolean;
38
+ zIndex: number;
39
+ displayName: string | null;
40
+ };
41
+ get config(): {
42
+ [key: string]: any;
43
+ id: string;
44
+ x: number;
45
+ y: number;
46
+ width: number;
47
+ height: number;
48
+ rotation: number;
49
+ scaleX: number;
50
+ scaleY: number;
51
+ visible: boolean;
52
+ draggable: boolean;
53
+ };
54
+ get margin(): number;
55
+ renderQrcode(): Promise<HTMLCanvasElement>;
56
+ getBoundingBox(): {
57
+ x: number;
58
+ y: number;
59
+ width: number;
60
+ height: number;
61
+ };
62
+ }
63
+ export declare class QrcodePlugin extends GraphicPlugin<QrcodeElement> {
64
+ name: string;
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
+ 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>;
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;
@@ -0,0 +1,66 @@
1
+ import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
2
+ import { EditorHost } from '../../core';
3
+ import { GraphicPlugin } from '../../types/graphic-plugin';
4
+ export interface RectOptions extends BaseGraphicElementOptions {
5
+ x?: number;
6
+ y?: number;
7
+ fill?: string;
8
+ stroke?: string;
9
+ strokeWidthMM?: number;
10
+ xmm?: number;
11
+ ymm?: number;
12
+ }
13
+ export declare class RectElement extends BaseGraphicElement {
14
+ type: string;
15
+ fill: string;
16
+ stroke: string;
17
+ strokeWidthMM: number;
18
+ constructor(host: EditorHost, options?: Partial<RectOptions>);
19
+ get strokeWidth(): number;
20
+ get config(): {
21
+ fill: string;
22
+ stroke: string;
23
+ strokeWidth: number;
24
+ id: string;
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ rotation: number;
30
+ scaleX: number;
31
+ scaleY: number;
32
+ visible: boolean;
33
+ draggable: boolean;
34
+ };
35
+ deserialize(data: any): void;
36
+ serialize(): {
37
+ fill: string;
38
+ stroke: string;
39
+ strokeWidthMM: number;
40
+ id: string;
41
+ type: string;
42
+ xmm: number;
43
+ ymm: number;
44
+ wmm: number;
45
+ hmm: number;
46
+ rotation: number;
47
+ scaleX: number;
48
+ scaleY: number;
49
+ visible: boolean;
50
+ locked: boolean;
51
+ draggable: boolean;
52
+ resizable: boolean;
53
+ zIndex: number;
54
+ displayName: string | null;
55
+ };
56
+ }
57
+ export declare class RectPlugin extends GraphicPlugin<RectElement> {
58
+ name: string;
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
+ 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>;
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;
@@ -0,0 +1,79 @@
1
+ import { BaseGraphicElement, BaseGraphicElementOptions } from '../../types/base-graphic-element';
2
+ import { GraphicPlugin } from '../../types/graphic-plugin';
3
+ import { EditorHost } from '../../core';
4
+ export interface TextOptions extends BaseGraphicElementOptions {
5
+ x?: number;
6
+ y?: number;
7
+ text?: string;
8
+ fontSize?: number;
9
+ align?: 'left' | 'center' | 'right' | 'justify';
10
+ verticalAlign?: 'top' | 'middle' | 'bottom';
11
+ fontStyle?: 'normal' | 'italic' | 'bold' | '500' | 'italic bold';
12
+ fill?: string;
13
+ xmm?: number;
14
+ ymm?: number;
15
+ }
16
+ export declare class TextElement extends BaseGraphicElement {
17
+ type: string;
18
+ text: string;
19
+ fontSize: number;
20
+ align: 'left' | 'center' | 'right' | 'justify';
21
+ verticalAlign: 'top' | 'middle' | 'bottom';
22
+ fontStyle: 'normal' | 'italic' | 'bold' | '500' | 'italic bold';
23
+ fill: string;
24
+ constructor(host: EditorHost, options?: Partial<TextOptions>);
25
+ get config(): {
26
+ text: string;
27
+ fontSize: number;
28
+ align: "left" | "right" | "center" | "justify";
29
+ verticalAlign: "top" | "bottom" | "middle";
30
+ fontStyle: "bold" | "normal" | "italic" | "500" | "italic bold";
31
+ fill: string;
32
+ id: string;
33
+ x: number;
34
+ y: number;
35
+ width: number;
36
+ height: number;
37
+ rotation: number;
38
+ scaleX: number;
39
+ scaleY: number;
40
+ visible: boolean;
41
+ draggable: boolean;
42
+ };
43
+ deserialize(data: any): void;
44
+ serialize(): {
45
+ text: string;
46
+ fontSize: number;
47
+ align: "left" | "right" | "center" | "justify";
48
+ verticalAlign: "top" | "bottom" | "middle";
49
+ fontStyle: "bold" | "normal" | "italic" | "500" | "italic bold";
50
+ fill: string;
51
+ id: string;
52
+ type: string;
53
+ xmm: number;
54
+ ymm: number;
55
+ wmm: number;
56
+ hmm: number;
57
+ rotation: number;
58
+ scaleX: number;
59
+ scaleY: number;
60
+ visible: boolean;
61
+ locked: boolean;
62
+ draggable: boolean;
63
+ resizable: boolean;
64
+ zIndex: number;
65
+ displayName: string | null;
66
+ };
67
+ }
68
+ export declare class TextPlugin extends GraphicPlugin<TextElement> {
69
+ name: string;
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
+ 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
+ protected onInstall(): void;
78
+ protected onUninstall(): void;
79
+ }
@@ -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;