mce 0.18.3 → 0.18.5

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.
@@ -69,6 +69,9 @@ declare const _default: {
69
69
  selectPreviousSibling: string;
70
70
  selectNextSibling: string;
71
71
  view: string;
72
+ mode: string;
73
+ 'mode:canvas': string;
74
+ 'mode:workflow': string;
72
75
  checkerboard: string;
73
76
  pixelGrid: string;
74
77
  ruler: string;
@@ -78,6 +81,14 @@ declare const _default: {
78
81
  'checkerboard:dot': string;
79
82
  panels: string;
80
83
  timeline: string;
84
+ play: string;
85
+ pause: string;
86
+ togglePlay: string;
87
+ seekStart: string;
88
+ seekEnd: string;
89
+ stepBackward: string;
90
+ stepForward: string;
91
+ collapse: string;
81
92
  statusbar: string;
82
93
  creator: string;
83
94
  memoryManager: string;
@@ -69,6 +69,9 @@ declare const _default: {
69
69
  selectPreviousSibling: string;
70
70
  selectNextSibling: string;
71
71
  view: string;
72
+ mode: string;
73
+ 'mode:canvas': string;
74
+ 'mode:workflow': string;
72
75
  checkerboard: string;
73
76
  pixelGrid: string;
74
77
  ruler: string;
@@ -79,6 +82,14 @@ declare const _default: {
79
82
  panels: string;
80
83
  statusbar: string;
81
84
  timeline: string;
85
+ play: string;
86
+ pause: string;
87
+ togglePlay: string;
88
+ seekStart: string;
89
+ seekEnd: string;
90
+ stepBackward: string;
91
+ stepForward: string;
92
+ collapse: string;
82
93
  creator: string;
83
94
  memoryManager: string;
84
95
  toolbelt: string;
@@ -11,7 +11,7 @@ declare global {
11
11
  setConfig: (path: keyof Config | string, value: any) => void;
12
12
  getConfigRef: <T = any>(path: string) => WritableComputedRef<T>;
13
13
  registerConfig: <T>(path: keyof Config | string, declaration?: ConfigDeclaration<T>) => WritableComputedRef<T>;
14
- importConfig: () => Promise<void>;
14
+ importConfig: () => Promise<Mce.Config | undefined>;
15
15
  exportConfig: () => Blob;
16
16
  saveAsConfig: (filename?: string) => void;
17
17
  }
@@ -27,6 +27,7 @@ declare global {
27
27
  fonts: Fonts;
28
28
  assets: Assets;
29
29
  renderEngine: Ref<Engine>;
30
+ runExclusiveRender: <T>(fn: () => Promise<T> | T) => Promise<T>;
30
31
  timeline: Ref<Timeline>;
31
32
  camera: Ref<Camera2D>;
32
33
  drawboardEffect: Ref<DrawboardEffect>;
@@ -45,6 +46,7 @@ declare global {
45
46
  textSelection: Ref<IndexCharacter[] | undefined>;
46
47
  hoverElement: Ref<Element2D | undefined>;
47
48
  state: Ref<State | undefined>;
49
+ mode: Ref<Mode>;
48
50
  getGlobalPointer: () => Vector2Like;
49
51
  parseAnchor: (anchor: Anchor, isRtl?: boolean) => ParsedAnchor;
50
52
  isNode: (value: any) => value is Node;
@@ -8,7 +8,7 @@ declare global {
8
8
  points?: Vector2Like[];
9
9
  }
10
10
  interface Snapper {
11
- get: () => SnapperData;
11
+ getLines: () => SnapperData;
12
12
  }
13
13
  interface Editor {
14
14
  snappers: Reactive<Map<string, Snapper>>;
@@ -0,0 +1,19 @@
1
+ import type { ActiveStrategy, DoubleclickStrategy, HoverStrategy, ResizeStrategy } from '../composables/strategy';
2
+ declare global {
3
+ namespace Mce {
4
+ interface Editor {
5
+ activeStrategy: ActiveStrategy;
6
+ doubleclickStrategy: DoubleclickStrategy;
7
+ hoverStrategy: HoverStrategy;
8
+ resizeStrategy?: ResizeStrategy;
9
+ }
10
+ interface Options {
11
+ activeStrategy?: ActiveStrategy;
12
+ doubleclickStrategy?: DoubleclickStrategy;
13
+ hoverStrategy?: HoverStrategy;
14
+ resizeStrategy?: ResizeStrategy;
15
+ }
16
+ }
17
+ }
18
+ declare const _default: import("..").Mixin;
19
+ export default _default;
@@ -10,18 +10,5 @@ declare global {
10
10
  }
11
11
  }
12
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
13
  declare const _default: import("..").Plugin;
27
14
  export default _default;
@@ -1,3 +1,4 @@
1
+ import type { Ref } from 'vue';
1
2
  declare global {
2
3
  namespace Mce {
3
4
  interface UIConfig {
@@ -6,6 +7,27 @@ declare global {
6
7
  interface TimelineConfig {
7
8
  visible: boolean;
8
9
  }
10
+ interface Editor {
11
+ paused: Ref<boolean>;
12
+ fps: Ref<number>;
13
+ recomputeTimelineEndTime: () => Promise<void>;
14
+ }
15
+ interface Commands {
16
+ play: () => void;
17
+ pause: () => void;
18
+ togglePlay: () => void;
19
+ seekStart: () => void;
20
+ seekEnd: () => void;
21
+ stepBackward: () => void;
22
+ stepForward: () => void;
23
+ }
24
+ interface Hotkeys {
25
+ togglePlay: [event: KeyboardEvent];
26
+ seekStart: [event: KeyboardEvent];
27
+ seekEnd: [event: KeyboardEvent];
28
+ stepBackward: [event: KeyboardEvent];
29
+ stepForward: [event: KeyboardEvent];
30
+ }
9
31
  }
10
32
  }
11
33
  declare const _default: import("../plugin").Plugin;
@@ -14,9 +14,9 @@ declare global {
14
14
  toggleUi: (name: Ui) => void;
15
15
  isPanelVisible: (name: string) => boolean;
16
16
  setPanelVisible: (name: string, visible: boolean | 'toggle') => void;
17
- hidePanel: (name: string, visible: boolean | 'toggle') => void;
18
- showPanel: (name: string, visible: boolean | 'toggle') => void;
19
- togglePanel: (name: string, visible: boolean | 'toggle') => void;
17
+ hidePanel: (name: string) => void;
18
+ showPanel: (name: string) => void;
19
+ togglePanel: (name: string) => void;
20
20
  pointerDown: (e: PointerInputEvent, options?: PointerDownOptions) => void;
21
21
  }
22
22
  }
@@ -0,0 +1,23 @@
1
+ import type { Element2D } from 'modern-canvas';
2
+ declare global {
3
+ namespace Mce {
4
+ interface WorkflowNodeTemplate {
5
+ /** Layer-panel name (and header label). */
6
+ label?: string;
7
+ /** Bold first line shown inside the node. */
8
+ title?: string;
9
+ /** Gray hint paragraphs under the title. */
10
+ body?: string[];
11
+ }
12
+ interface Options {
13
+ /** Override/extend the workflow node content templates, keyed by node type. */
14
+ workflowNodes?: Record<string, WorkflowNodeTemplate>;
15
+ }
16
+ interface Commands {
17
+ addWorkflowNode: (type: string, position?: AddElementPosition) => Element2D;
18
+ addWorkflowConnection: (startId: string, startIdx: number, endId: string, endIdx: number) => Element2D;
19
+ }
20
+ }
21
+ }
22
+ declare const _default: import("../plugin").Plugin;
23
+ export default _default;
@@ -31,6 +31,11 @@ declare global {
31
31
  //
32
32
  }
33
33
 
34
+ // Persistent editor mode, orthogonal to the transient `State`. 'canvas' is
35
+ // the free-form editing experience; 'workflow' turns the canvas into a
36
+ // node-graph editor (directional connections, port handles).
37
+ type Mode = 'canvas' | 'workflow'
38
+
34
39
  type State
35
40
  = | 'loading'
36
41
  | 'hand'
@@ -40,6 +45,7 @@ declare global {
40
45
  | 'transforming'
41
46
  | 'typing'
42
47
  | 'cropping'
48
+ | 'pathEditing'
43
49
  | 'imageReplacing'
44
50
  | 'shapeReplacing'
45
51
  | 'painting'
@@ -22,6 +22,7 @@ import './mixins/http'
22
22
  import './mixins/loader'
23
23
  import './mixins/snapper'
24
24
  import './mixins/snapshot'
25
+ import './mixins/strategy'
25
26
  import './mixins/tool'
26
27
  import './plugins/arrange'
27
28
  import './plugins/autoNest'
@@ -60,6 +61,7 @@ import './plugins/transform'
60
61
  import './plugins/typography'
61
62
  import './plugins/url'
62
63
  import './plugins/view'
64
+ import './plugins/workflow'
63
65
  import './plugins/zoom'
64
66
 
65
67
  export {}
@@ -0,0 +1,14 @@
1
+ interface Point {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export type ArrowMarker = 'none' | 'open' | 'filled';
6
+ export interface ArrowPathOptions {
7
+ size?: number;
8
+ angle?: number;
9
+ startMarker?: ArrowMarker;
10
+ endMarker?: ArrowMarker;
11
+ roundValues?: boolean;
12
+ }
13
+ export declare function getArrowPath(p1: Point, p2: Point, options?: ArrowPathOptions): string;
14
+ export {};
@@ -1,4 +1,47 @@
1
- import type { Element, Fill, Outline } from 'modern-idoc';
1
+ import type { Element, Fill, Outline, ShapeConnectionPoint } from 'modern-idoc';
2
2
  export declare function createShapeElement(shape?: Element['shape'], fill?: Fill, outline?: Outline): Element;
3
3
  export declare function createTextElement(content: string, style?: Record<string, any>): Element;
4
4
  export declare function createImageElement(image: string): Promise<Element>;
5
+ export interface CreateCardElementOptions {
6
+ /** Body text below the title. Omitted if empty. */
7
+ body?: string;
8
+ width?: number;
9
+ height?: number;
10
+ fill?: Fill;
11
+ outline?: Outline;
12
+ borderRadius?: number;
13
+ /** Inset of the title/body from the card edges. */
14
+ padding?: number;
15
+ titleStyle?: Record<string, any>;
16
+ bodyStyle?: Record<string, any>;
17
+ }
18
+ /**
19
+ * A rounded panel with a bold title and optional body, composed as child text
20
+ * elements (so each line keeps its own styling and can be edited in place).
21
+ */
22
+ export declare function createCardElement(title: string, options?: CreateCardElementOptions): Element;
23
+ export interface CreateFlowNodeElementOptions {
24
+ width?: number;
25
+ height?: number;
26
+ fill?: Fill;
27
+ outline?: Outline;
28
+ borderRadius?: number;
29
+ textStyle?: Record<string, any>;
30
+ /** Override the default right/left/bottom/top connector anchors. */
31
+ connectionPoints?: ShapeConnectionPoint[];
32
+ }
33
+ /**
34
+ * A labelled rounded box that exposes connection points, so connectors can
35
+ * attach and route to it. Pairs with the `connection` element.
36
+ */
37
+ export declare function createFlowNodeElement(label?: string, options?: CreateFlowNodeElementOptions): Element;
38
+ export interface CreateStickyElementOptions {
39
+ width?: number;
40
+ height?: number;
41
+ fill?: Fill;
42
+ color?: string;
43
+ fontSize?: number;
44
+ padding?: number;
45
+ }
46
+ /** A solid colored note with top-aligned text, e.g. for whiteboard annotations. */
47
+ export declare function createStickyElement(content: string, options?: CreateStickyElementOptions): Element;
@@ -1,3 +1,4 @@
1
+ export * from './arrow';
1
2
  export * from './box';
2
3
  export * from './console';
3
4
  export * from './constants';
@@ -0,0 +1,9 @@
1
+ import type { Element2D } from 'modern-canvas';
2
+ import type { ShapeConnectionPoint } from 'modern-idoc';
3
+ export interface WorkflowPort extends ShapeConnectionPoint {
4
+ kind: 'input' | 'output';
5
+ }
6
+ export declare const INPUT_PORT: WorkflowPort;
7
+ export declare const OUTPUT_PORT: WorkflowPort;
8
+ export declare function getWorkflowPorts(el: Element2D): WorkflowPort[];
9
+ export declare function toConnectionPoints(ports: WorkflowPort[]): ShapeConnectionPoint[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.18.3",
4
+ "version": "0.18.5",
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",
@@ -60,10 +60,10 @@
60
60
  "@vueuse/core": "^14.3.0",
61
61
  "diff": "^9.0.0",
62
62
  "lodash-es": "^4.18.1",
63
- "modern-canvas": "^0.18.1",
64
- "modern-font": "^0.5.0",
65
- "modern-idoc": "^0.11.4",
66
- "modern-text": "^1.11.1",
63
+ "modern-canvas": "^0.19.1",
64
+ "modern-font": "^0.6.0",
65
+ "modern-idoc": "^0.11.5",
66
+ "modern-text": "^2.0.3",
67
67
  "y-protocols": "^1.0.7",
68
68
  "yjs": "^13.6.30"
69
69
  },
@@ -88,7 +88,7 @@
88
88
  "@types/lodash-es": "^4.17.12",
89
89
  "@vitejs/plugin-vue": "^6.0.7",
90
90
  "jiti": "^2.7.0",
91
- "sass-embedded": "^1.99.0",
91
+ "sass-embedded": "^1.100.0",
92
92
  "typedoc": "^0.28.19",
93
93
  "typedoc-plugin-markdown": "^4.11.0"
94
94
  },