mce 0.2.7 → 0.11.0

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.
@@ -28,6 +28,9 @@ declare const _default: {
28
28
  redo: string;
29
29
  cut: string;
30
30
  copy: string;
31
+ copyAs: string;
32
+ 'copyAs:svg': string;
33
+ 'copyAs:json': string;
31
34
  paste: string;
32
35
  duplicate: string;
33
36
  delete: string;
@@ -1,9 +1,9 @@
1
1
  import type { Cursor, Node, Vector2Data } from 'modern-canvas';
2
2
  import type { ComputedRef, Ref } from 'vue';
3
- import type { Doc, Workspace } from '../models';
4
3
  import type { AxisAlignedBoundingBox } from '../types';
5
4
  import { Camera2D, DrawboardEffect, Engine, Timeline } from 'modern-canvas';
6
5
  import { Fonts } from 'modern-font';
6
+ import { Doc } from '../models';
7
7
  declare global {
8
8
  namespace Mce {
9
9
  interface Editor {
@@ -16,9 +16,8 @@ declare global {
16
16
  drawboardDom: Ref<HTMLElement | undefined>;
17
17
  drawboardAabb: Ref<AxisAlignedBoundingBox>;
18
18
  drawboardPointer: Ref<Vector2Data | undefined>;
19
- workspace: Ref<Workspace | undefined>;
20
- root: ComputedRef<Node | undefined>;
21
- doc: Ref<Doc | undefined>;
19
+ doc: Ref<Doc>;
20
+ root: ComputedRef<Node>;
22
21
  state: Ref<State | undefined>;
23
22
  setState: (state: State, context?: StateContext) => void;
24
23
  stateContext: Ref<StateContext | undefined>;
@@ -11,6 +11,8 @@ declare global {
11
11
  type ExporterHandle = (options: ExportOptions) => any | Promise<any>;
12
12
  interface Exporter {
13
13
  name: string;
14
+ copyAs?: boolean | ((exported: any) => string);
15
+ saveAs?: boolean | ((exported: any) => Blob);
14
16
  handle: ExporterHandle;
15
17
  }
16
18
  interface Editor {
@@ -41,7 +41,6 @@ export declare class Doc extends Model {
41
41
  protected _debug(..._args: any[]): void;
42
42
  protected _onChildrenChange(event: Y.YMapEvent<Y.Map<unknown>>, transaction: Y.Transaction): void;
43
43
  reset(): this;
44
- init(): void;
45
44
  protected _addElement(element: Element, options?: AddElementOptions): Node;
46
45
  addElement(element: Element, options?: AddElementOptions): Node;
47
46
  addElements(elements: Element[], options?: AddElementOptions): Node[];
@@ -1,3 +1,2 @@
1
1
  export * from './Doc';
2
2
  export * from './Model';
3
- export * from './Workspace';
@@ -8,7 +8,7 @@ declare global {
8
8
  duplicate: [event: KeyboardEvent];
9
9
  }
10
10
  interface Commands {
11
- copy: () => Promise<void>;
11
+ copy: (data?: any) => Promise<void>;
12
12
  cut: () => Promise<void>;
13
13
  paste: () => Promise<void>;
14
14
  duplicate: () => Promise<void>;
@@ -0,0 +1,11 @@
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;
@@ -27,6 +27,7 @@ import './mixins/4.4.doc'
27
27
  import './mixins/snapshot'
28
28
  import './plugins/auxiliary'
29
29
  import './plugins/clipboard'
30
+ import './plugins/copyAs'
30
31
  import './plugins/delete'
31
32
  import './plugins/flip'
32
33
  import './plugins/frame'
@@ -40,11 +41,8 @@ import './plugins/layerPosition'
40
41
  import './plugins/lock'
41
42
  import './plugins/menu'
42
43
  import './plugins/move'
43
- import './plugins/mp4'
44
44
  import './plugins/new'
45
45
  import './plugins/open'
46
- import './plugins/pdf'
47
- import './plugins/pptx'
48
46
  import './plugins/saveAs'
49
47
  import './plugins/select'
50
48
  import './plugins/text'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.2.7",
4
+ "version": "0.11.0",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -61,18 +61,15 @@
61
61
  "diff": "^8.0.2",
62
62
  "file-saver": "^2.0.5",
63
63
  "lodash-es": "^4.17.21",
64
- "modern-canvas": "^0.12.20",
64
+ "modern-canvas": "^0.12.21",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.5",
67
- "modern-text": "^1.10.2",
67
+ "modern-text": "^1.10.3",
68
68
  "yjs": "^13.6.27"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "lottie-web": "^5",
72
72
  "modern-gif": "^2",
73
- "modern-mp4": "^0",
74
- "modern-openxml": "^1",
75
- "modern-pdf": "^1",
76
73
  "typescript": ">=4.7",
77
74
  "vue": "^3.5.0",
78
75
  "yoga-layout": "^3"
@@ -84,15 +81,6 @@
84
81
  "modern-gif": {
85
82
  "optional": true
86
83
  },
87
- "modern-mp4": {
88
- "optional": true
89
- },
90
- "modern-openxml": {
91
- "optional": true
92
- },
93
- "modern-pdf": {
94
- "optional": true
95
- },
96
84
  "typescript": {
97
85
  "optional": true
98
86
  },
@@ -106,10 +94,7 @@
106
94
  "@vitejs/plugin-vue": "^6.0.1",
107
95
  "jiti": "^2.6.1",
108
96
  "modern-gif": "^2.0.4",
109
- "modern-mp4": "^0.2.0",
110
- "modern-openxml": "^1.9.0",
111
- "modern-pdf": "^1.3.2",
112
- "sass-embedded": "^1.93.2"
97
+ "sass-embedded": "^1.93.3"
113
98
  },
114
99
  "scripts": {
115
100
  "build:code": "vite build",
@@ -1,17 +0,0 @@
1
- import type { Doc } from './Doc';
2
- import { Model } from './Model';
3
- export interface WorkspaceProps {
4
- name: string;
5
- type: 'local' | 'cloud';
6
- createdAt: number;
7
- updatedAt: number;
8
- }
9
- export declare class Workspace extends Model {
10
- readonly docs: Map<string, Doc>;
11
- name: string;
12
- type: 'local' | 'cloud';
13
- createdAt: string;
14
- updatedAt: string;
15
- set(source?: Partial<WorkspaceProps>): this;
16
- addDoc(doc: Doc): Doc;
17
- }
@@ -1,9 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface Exporters {
4
- mp4: Blob;
5
- }
6
- }
7
- }
8
- declare const _default: import("..").Plugin;
9
- export default _default;
@@ -1,9 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface Exporters {
4
- pdf: Blob;
5
- }
6
- }
7
- }
8
- declare const _default: import("..").Plugin;
9
- export default _default;
@@ -1,9 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface Exporters {
4
- pptx: Blob;
5
- }
6
- }
7
- }
8
- declare const _default: import("..").Plugin;
9
- export default _default;