mce 0.17.0 → 0.17.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.
@@ -35,8 +35,8 @@ declare const _default: {
35
35
  pen: string;
36
36
  pencil: string;
37
37
  file: string;
38
- new: string;
39
- open: string;
38
+ newDoc: string;
39
+ openDoc: string;
40
40
  import: string;
41
41
  export: string;
42
42
  'saveAs:png': string;
@@ -35,8 +35,8 @@ declare const _default: {
35
35
  pen: string;
36
36
  pencil: string;
37
37
  file: string;
38
- new: string;
39
- open: string;
38
+ newDoc: string;
39
+ openDoc: string;
40
40
  import: string;
41
41
  export: string;
42
42
  'saveAs:png': string;
@@ -14,16 +14,16 @@ export interface Doc {
14
14
  emit: <K extends keyof DocEvents & string>(event: K, ...args: DocEvents[K]) => this;
15
15
  }
16
16
  export declare class Doc extends Node {
17
- protected readonly _local: boolean;
18
17
  _yDoc: YDoc;
19
18
  protected _source: any;
20
- constructor(source?: Mce.DocumentSource, _local?: boolean);
19
+ constructor(source?: Mce.DocumentSource);
21
20
  transact: <T>(fn: () => T, should?: boolean) => T;
22
21
  undo: () => void;
23
22
  redo: () => void;
24
23
  stopCapturing: () => void;
25
24
  clearHistory: () => void;
26
25
  set: (source: Document) => this;
27
- load: () => Promise<void>;
26
+ loadIndexeddb: () => Promise<void>;
27
+ init: () => this;
28
28
  destroy: () => void;
29
29
  }
@@ -12,15 +12,29 @@ declare global {
12
12
  inEditorIs: 'Doc';
13
13
  };
14
14
  }
15
- type DocumentSource = InternalDocument | Element[] | string;
15
+ type DocumentSource = Doc | InternalDocument | Element[] | string;
16
+ interface Editor {
17
+ getDoc: () => JsonData;
18
+ setDoc: (doc: DocumentSource) => Doc;
19
+ loadDoc: (source: any) => Promise<Doc>;
20
+ clearDoc: () => void;
21
+ newDoc: () => void;
22
+ openDoc: () => Promise<void>;
23
+ }
16
24
  interface Commands {
17
25
  getDoc: () => JsonData;
18
- setDoc: (doc: DocumentSource) => Promise<Doc>;
26
+ setDoc: (doc: DocumentSource) => Doc;
19
27
  loadDoc: (source: any) => Promise<Doc>;
20
28
  clearDoc: () => void;
29
+ newDoc: () => void;
30
+ openDoc: () => Promise<void>;
31
+ }
32
+ interface Hotkeys {
33
+ newDoc: [event: KeyboardEvent];
34
+ openDoc: [event: KeyboardEvent];
21
35
  }
22
36
  interface Events {
23
- setDoc: [root: Doc, oldRoot: Doc];
37
+ setDoc: [doc: Doc, oldDoc: Doc];
24
38
  docLoading: [source: any];
25
39
  docLoaded: [source: any, root: Doc | Error];
26
40
  clearDoc: [];
@@ -3,10 +3,13 @@ declare global {
3
3
  namespace Mce {
4
4
  type CopySource = string | Blob | Blob[] | Record<string, any>[];
5
5
  type PasteSource = DataTransfer | ClipboardItem[];
6
+ interface CopyAsOptions extends ExportOptions {
7
+ }
6
8
  interface Commands {
7
9
  cancel: () => void;
8
10
  delete: () => void;
9
11
  copy: (source?: CopySource) => Promise<void>;
12
+ copyAs: (type: keyof Exporters, options?: CopyAsOptions) => Promise<void>;
10
13
  cut: () => Promise<void>;
11
14
  paste: (source?: PasteSource) => Promise<void>;
12
15
  duplicate: () => void;
@@ -9,29 +9,26 @@ import './mixins/0.context'
9
9
  import './mixins/0.font'
10
10
  import './mixins/0.locale'
11
11
  import './mixins/1.frame'
12
- import './mixins/1.hotkey'
13
12
  import './mixins/1.screen'
14
13
  import './mixins/1.timeline'
15
14
  import './mixins/1.upload'
16
15
  import './mixins/2.box'
17
- import './mixins/2.export'
18
- import './mixins/2.load'
19
- import './mixins/3.view'
20
16
  import './mixins/4.0.node'
21
17
  import './mixins/4.2.frame'
22
18
  import './mixins/4.3.element'
19
+ import './mixins/exporter'
20
+ import './mixins/hotkey'
23
21
  import './mixins/http'
24
- import './mixins/snap'
22
+ import './mixins/loader'
23
+ import './mixins/snapper'
25
24
  import './mixins/snapshot'
26
25
  import './mixins/tool'
27
26
  import './plugins/arrange'
28
27
  import './plugins/autoNest'
29
- import './plugins/copyAs'
30
28
  import './plugins/doc'
31
29
  import './plugins/edit'
32
30
  import './plugins/formatPaint'
33
31
  import './plugins/frame'
34
- import './plugins/gif'
35
32
  import './plugins/history'
36
33
  import './plugins/hover'
37
34
  import './plugins/html'
@@ -42,9 +39,7 @@ import './plugins/layers'
42
39
  import './plugins/madeWith'
43
40
  import './plugins/memory'
44
41
  import './plugins/menu'
45
- import './plugins/new'
46
42
  import './plugins/node'
47
- import './plugins/open'
48
43
  import './plugins/pen'
49
44
  import './plugins/ruler'
50
45
  import './plugins/saveAs'
@@ -6,4 +6,3 @@ export * from './dnd';
6
6
  export * from './helper';
7
7
  export * from './image';
8
8
  export * from './propsFactory';
9
- export * from './random';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.17.0",
4
+ "version": "0.17.2",
5
5
  "description": "A headless infinite canvas editor framework built on WebGL rendering, supports exporting to image, video, and PPT. Only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "diff": "^8.0.3",
62
62
  "file-saver": "^2.0.5",
63
63
  "lodash-es": "^4.17.23",
64
- "modern-canvas": "^0.15.5",
64
+ "modern-canvas": "^0.15.6",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.21",
67
67
  "modern-text": "^1.10.15",
@@ -69,7 +69,6 @@
69
69
  },
70
70
  "peerDependencies": {
71
71
  "lottie-web": "^5",
72
- "modern-gif": "^2",
73
72
  "typescript": ">=4.7",
74
73
  "vue": "^3.5.0",
75
74
  "yoga-layout": "^3"
@@ -78,9 +77,6 @@
78
77
  "lottie-web": {
79
78
  "optional": true
80
79
  },
81
- "modern-gif": {
82
- "optional": true
83
- },
84
80
  "typescript": {
85
81
  "optional": true
86
82
  },
@@ -93,7 +89,6 @@
93
89
  "@types/lodash-es": "^4.17.12",
94
90
  "@vitejs/plugin-vue": "^6.0.4",
95
91
  "jiti": "^2.6.1",
96
- "modern-gif": "^2.0.4",
97
92
  "sass-embedded": "^1.97.3",
98
93
  "typedoc": "^0.28.17",
99
94
  "typedoc-plugin-markdown": "^4.10.0"
@@ -1,9 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface Editor {
4
- bindRenderCanvas: (canvas: HTMLCanvasElement, setEventTarget?: HTMLElement) => () => void;
5
- }
6
- }
7
- }
8
- declare const _default: import("..").Mixin;
9
- export default _default;
@@ -1,11 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface CopyAsOptions extends ExportOptions {
4
- }
5
- interface Commands {
6
- copyAs: (type: keyof Exporters, options?: CopyAsOptions) => Promise<void>;
7
- }
8
- }
9
- }
10
- declare const _default: import("..").Plugin;
11
- export default _default;
@@ -1,12 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface Options {
4
- gifWorkerUrl?: string;
5
- }
6
- interface Exporters {
7
- gif: Promise<Blob>;
8
- }
9
- }
10
- }
11
- declare const _default: import("..").Plugin;
12
- export default _default;
@@ -1,12 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface Commands {
4
- new: () => void;
5
- }
6
- interface Hotkeys {
7
- new: [event: KeyboardEvent];
8
- }
9
- }
10
- }
11
- declare const _default: import("..").Plugin;
12
- export default _default;
@@ -1,12 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface Commands {
4
- open: () => Promise<void>;
5
- }
6
- interface Hotkeys {
7
- open: [event: KeyboardEvent];
8
- }
9
- }
10
- }
11
- declare const _default: import("..").Plugin;
12
- export default _default;
@@ -1,3 +0,0 @@
1
- export declare const getRandomValues: <T extends ArrayBufferView>(array: T) => T;
2
- export declare const uint32: () => number;
3
- export declare function uuidv4(): string;
File without changes
File without changes
File without changes
File without changes