mce 0.13.13 → 0.13.14

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.
@@ -2,6 +2,7 @@ declare const _default: {
2
2
  cancel: string;
3
3
  constrainToAxis: string;
4
4
  loading: string;
5
+ drawing: string;
5
6
  selecting: string;
6
7
  selectObject: string;
7
8
  commitChanges: string;
@@ -9,6 +10,19 @@ declare const _default: {
9
10
  goBackSelectedArea: string;
10
11
  selectArea: string;
11
12
  dragSelected: string;
13
+ move: string;
14
+ hand: string;
15
+ frame: string;
16
+ text: string;
17
+ doubleClickEditText: string;
18
+ rectangle: string;
19
+ line: string;
20
+ arrow: string;
21
+ ellipse: string;
22
+ polygon: string;
23
+ star: string;
24
+ image: string;
25
+ pencil: string;
12
26
  file: string;
13
27
  new: string;
14
28
  open: string;
@@ -51,6 +65,7 @@ declare const _default: {
51
65
  'panels:layers': string;
52
66
  'panels:timeline': string;
53
67
  'panels:statusbar': string;
68
+ toolbelt: string;
54
69
  msaa: string;
55
70
  pixelate: string;
56
71
  layers: string;
@@ -2,6 +2,7 @@ declare const _default: {
2
2
  cancel: string;
3
3
  constrainToAxis: string;
4
4
  loading: string;
5
+ drawing: string;
5
6
  exporting: string;
6
7
  selecting: string;
7
8
  selectObject: string;
@@ -10,6 +11,19 @@ declare const _default: {
10
11
  goBackSelectedArea: string;
11
12
  selectArea: string;
12
13
  dragSelected: string;
14
+ move: string;
15
+ hand: string;
16
+ frame: string;
17
+ text: string;
18
+ doubleClickEditText: string;
19
+ rectangle: string;
20
+ line: string;
21
+ arrow: string;
22
+ ellipse: string;
23
+ polygon: string;
24
+ star: string;
25
+ image: string;
26
+ pencil: string;
13
27
  file: string;
14
28
  new: string;
15
29
  open: string;
@@ -52,6 +66,7 @@ declare const _default: {
52
66
  'panels:layers': string;
53
67
  'panels:statusbar': string;
54
68
  'panels:timeline': string;
69
+ toolbelt: string;
55
70
  msaa: string;
56
71
  pixelate: string;
57
72
  layers: string;
@@ -23,8 +23,6 @@ declare global {
23
23
  pixelGrid: boolean;
24
24
  pixelate: boolean;
25
25
  camera: boolean;
26
- timeline: boolean;
27
- statusbar: boolean;
28
26
  frameOutline: boolean;
29
27
  frameGap: number;
30
28
  typographyStrategy: TypographyStrategy;
@@ -39,8 +39,6 @@ declare global {
39
39
  textSelection: Ref<IndexCharacter[] | undefined>;
40
40
  hoverElement: Ref<Element2D | undefined>;
41
41
  state: Ref<State | undefined>;
42
- setState: (state: State, context?: StateContext) => void;
43
- stateContext: Ref<StateContext | undefined>;
44
42
  getGlobalPointer: () => Vector2Data;
45
43
  parseAnchor: (anchor: Anchor, isRtl?: boolean) => ParsedAnchor;
46
44
  isNode: (value: any) => value is Node;
@@ -52,9 +50,6 @@ declare global {
52
50
  isLock: (node: Node) => boolean;
53
51
  setLock: (node: Node, lock: boolean) => void;
54
52
  }
55
- interface Events {
56
- setState: [state: State];
57
- }
58
53
  }
59
54
  }
60
55
  declare const _default: import("..").Mixin;
@@ -0,0 +1,25 @@
1
+ import type { Vector2Data } from 'modern-canvas';
2
+ import type { Reactive, Ref } from 'vue';
3
+ declare global {
4
+ namespace Mce {
5
+ interface DrawingTools {
6
+ }
7
+ type DrawingToolHandle = (position: Vector2Data) => {
8
+ move?: (position: Vector2Data) => void;
9
+ end?: (position: Vector2Data) => void;
10
+ } | void;
11
+ interface DrawingTool {
12
+ name: string;
13
+ handle?: DrawingToolHandle;
14
+ }
15
+ interface Editor {
16
+ drawingTools: Reactive<Map<string, Mce.DrawingTool>>;
17
+ registerDrawingTool: (tool: Mce.DrawingTool | Mce.DrawingTool[]) => void;
18
+ unregisterDrawingTool: (tool: string) => void;
19
+ activeDrawingTool: Ref<Mce.DrawingTool>;
20
+ setActiveDrawingTool: (tool: string | keyof DrawingTools | undefined) => void;
21
+ }
22
+ }
23
+ }
24
+ declare const _default: import("..").Mixin;
25
+ export default _default;
package/dist/plugin.d.ts CHANGED
@@ -25,6 +25,7 @@ export interface PluginObject {
25
25
  hotkeys?: Mce.Hotkey[];
26
26
  loaders?: Mce.Loader[];
27
27
  exporters?: Mce.Exporter[];
28
+ drawingTools?: Mce.DrawingTool[];
28
29
  components?: PluginComponent[];
29
30
  setup?: () => void | Promise<void>;
30
31
  }
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface Commands {
4
+ cancel: () => void;
5
+ }
6
+ }
7
+ }
8
+ declare const _default: import("..").Plugin;
9
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface Commands {
4
+ setActiveDrawingTool: (tool: string | keyof DrawingTools | undefined) => void;
5
+ }
6
+ }
7
+ }
8
+ declare const _default: import("../plugin").Plugin;
9
+ export default _default;
@@ -5,13 +5,15 @@ declare global {
5
5
  }
6
6
  interface Commands {
7
7
  insertImage: (url: string, options?: InsertImageOptions) => Promise<Element2D>;
8
- drawImage: () => void;
9
8
  }
10
9
  interface Exporters {
11
10
  png: Promise<Blob>;
12
11
  jpeg: Promise<Blob>;
13
12
  webp: Promise<Blob>;
14
13
  }
14
+ interface DrawingTools {
15
+ image: [];
16
+ }
15
17
  }
16
18
  }
17
19
  declare const _default: import("..").Plugin;
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface DrawingTools {
4
+ pencil: [];
5
+ }
6
+ }
7
+ }
8
+ declare const _default: import("..").Plugin;
9
+ export default _default;
@@ -0,0 +1,27 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface DrawingTools {
4
+ rectangle: [];
5
+ line: [];
6
+ arrow: [];
7
+ ellipse: [];
8
+ polygon: [];
9
+ star: [];
10
+ }
11
+ }
12
+ }
13
+ interface Point {
14
+ x: number;
15
+ y: number;
16
+ }
17
+ type ArrowType = 'none' | 'open' | 'filled';
18
+ interface ArrowOptions {
19
+ size?: number;
20
+ angle?: number;
21
+ startMarker?: ArrowType;
22
+ endMarker?: ArrowType;
23
+ roundValues?: boolean;
24
+ }
25
+ export declare function getArrowPath(p1: Point, p2: Point, options?: ArrowOptions): string;
26
+ declare const _default: import("..").Plugin;
27
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface Commands {
4
+ setState: (val: State) => void;
5
+ }
6
+ }
7
+ }
8
+ declare const _default: import("..").Plugin;
9
+ export default _default;
@@ -1,5 +1,8 @@
1
1
  declare global {
2
2
  namespace Mce {
3
+ interface Config {
4
+ statusbar: boolean;
5
+ }
3
6
  interface Panels {
4
7
  statusbar: [];
5
8
  }
@@ -1,12 +1,15 @@
1
1
  import type { Element2D } from 'modern-canvas';
2
2
  declare global {
3
3
  namespace Mce {
4
- interface InsertTextOptions extends AddElementOptions {
4
+ interface addTextElementOptions extends AddElementOptions {
5
+ content?: string;
5
6
  style?: Record<string, any>;
6
7
  }
7
8
  interface Commands {
8
- insertText: (content?: string, options?: InsertTextOptions) => Element2D;
9
- drawText: (content?: string, options?: InsertTextOptions) => void;
9
+ addTextElement: (options?: addTextElementOptions) => Element2D;
10
+ }
11
+ interface DrawingTools {
12
+ text: [options?: addTextElementOptions];
10
13
  }
11
14
  }
12
15
  }
@@ -1,5 +1,8 @@
1
1
  declare global {
2
2
  namespace Mce {
3
+ interface Config {
4
+ timeline: boolean;
5
+ }
3
6
  interface Panels {
4
7
  timeline: [];
5
8
  }
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface Config {
4
+ toolbelt: boolean;
5
+ }
6
+ }
7
+ }
8
+ declare const _default: import("../plugin").Plugin;
9
+ export default _default;
@@ -1,3 +1,4 @@
1
+ import type { Vector2Data } from 'modern-canvas'
1
2
  import 'modern-canvas'
2
3
 
3
4
  declare module 'modern-canvas' {
@@ -28,6 +29,7 @@ declare global {
28
29
 
29
30
  type State
30
31
  = | 'loading'
32
+ | 'hand'
31
33
  | 'drawing'
32
34
  | 'selecting'
33
35
  | 'transforming'
@@ -37,7 +39,12 @@ declare global {
37
39
  | 'shapeReplacing'
38
40
  | undefined
39
41
 
40
- type StateContext = Record<string, any>
42
+ interface DrawingContext {
43
+ tip?: string
44
+ start?: (position: Vector2Data) => void
45
+ move?: (position: Vector2Data) => void
46
+ end?: (position: Vector2Data) => void
47
+ }
41
48
  }
42
49
  }
43
50
 
@@ -21,14 +21,17 @@ import './mixins/4.0.text'
21
21
  import './mixins/4.2.element'
22
22
  import './mixins/4.3.frame'
23
23
  import './mixins/4.4.doc'
24
+ import './mixins/drawingTool'
24
25
  import './mixins/scroll'
25
26
  import './mixins/snapshot'
26
27
  import './mixins/zoom'
28
+ import './plugins/cancel'
27
29
  import './plugins/clipboard'
28
30
  import './plugins/copyAs'
29
31
  import './plugins/delete'
32
+ import './plugins/drawingTool'
30
33
  import './plugins/flip'
31
- import './plugins/frames'
34
+ import './plugins/frame'
32
35
  import './plugins/gif'
33
36
  import './plugins/group'
34
37
  import './plugins/history'
@@ -47,14 +50,18 @@ import './plugins/move'
47
50
  import './plugins/new'
48
51
  import './plugins/open'
49
52
  import './plugins/panels'
53
+ import './plugins/pen'
50
54
  import './plugins/ruler'
51
55
  import './plugins/saveAs'
52
56
  import './plugins/scroll'
53
57
  import './plugins/select'
58
+ import './plugins/shape'
54
59
  import './plugins/smartGuides'
60
+ import './plugins/state'
55
61
  import './plugins/statusbar'
56
62
  import './plugins/text'
57
63
  import './plugins/timeline'
64
+ import './plugins/toolbelt'
58
65
  import './plugins/ui'
59
66
  import './plugins/url'
60
67
  import './plugins/view'
@@ -1,3 +1,4 @@
1
- import type { NormalizedElement } from 'modern-idoc';
2
- export declare function createTextElement(content: string, style?: Record<string, any>): NormalizedElement;
3
- export declare function createImageElement(image: string): Promise<NormalizedElement>;
1
+ import type { Element, Fill, Outline } from 'modern-idoc';
2
+ export declare function createShapeElement(shape?: Element['shape'], fill?: Fill, outline?: Outline): Element;
3
+ export declare function createTextElement(content: string, style?: Record<string, any>): Element;
4
+ export declare function createImageElement(image: string): Promise<Element>;
@@ -11,3 +11,7 @@ export declare function convertToUnit(str: string | number | null | undefined, u
11
11
  export declare function templateRef(): TemplateRef;
12
12
  export declare function findChildrenWithProvide(key: InjectionKey<any> | symbol, vnode?: VNodeChild): ComponentInternalInstance[];
13
13
  export declare function isInputEvent(event?: Event): boolean;
14
+ export declare function toKebabCase(str?: string): string;
15
+ export declare namespace toKebabCase {
16
+ var cache: Map<string, string>;
17
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.13.13",
4
+ "version": "0.13.14",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "diff": "^8.0.2",
62
62
  "file-saver": "^2.0.5",
63
63
  "lodash-es": "^4.17.21",
64
- "modern-canvas": "^0.13.3",
64
+ "modern-canvas": "^0.13.4",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.5",
67
67
  "modern-text": "^1.10.4",
@@ -91,7 +91,7 @@
91
91
  "devDependencies": {
92
92
  "@types/file-saver": "^2.0.7",
93
93
  "@types/lodash-es": "^4.17.12",
94
- "@vitejs/plugin-vue": "^6.0.1",
94
+ "@vitejs/plugin-vue": "^6.0.2",
95
95
  "jiti": "^2.6.1",
96
96
  "modern-gif": "^2.0.4",
97
97
  "sass-embedded": "^1.93.3"
File without changes