@tmagic/stage 1.3.0-alpha.9 → 1.3.0-beta.1

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,10 +2,8 @@ import { MoveableManagerInterface, Renderer } from 'moveable';
2
2
  import { AbleActionEventType } from './types';
3
3
  declare const _default: (handler: (type: AbleActionEventType) => void) => {
4
4
  name: string;
5
- props: {
6
- selectParent: BooleanConstructor;
7
- };
8
- events: {};
5
+ props: never[];
6
+ events: never[];
9
7
  render(moveable: MoveableManagerInterface<any, any>, React: Renderer): any;
10
8
  };
11
9
  export default _default;
@@ -12,6 +12,7 @@ export default class MoveableOptionsManager extends EventEmitter {
12
12
  mode: Mode;
13
13
  /** 画布容器 */
14
14
  protected container: HTMLElement;
15
+ protected options: MoveableOptions;
15
16
  /** 水平参考线 */
16
17
  private horizontalGuidelines;
17
18
  /** 垂直参考线 */
@@ -23,6 +24,7 @@ export default class MoveableOptionsManager extends EventEmitter {
23
24
  /** 获取整个画布的根元素(在StageCore的mount函数中挂载的container) */
24
25
  private getRootContainer;
25
26
  constructor(config: MoveableOptionsManagerConfig);
27
+ getOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K];
26
28
  /**
27
29
  * 设置水平/垂直参考线
28
30
  * @param type 参考线类型
@@ -1,10 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  import { EventEmitter } from 'events';
4
- import { Id } from '@tmagic/schema';
4
+ import type { MoveableOptions } from 'moveable';
5
+ import type { Id } from '@tmagic/schema';
5
6
  import StageMask from './StageMask';
6
7
  import StageRender from './StageRender';
7
- import { RemoveData, StageCoreConfig, UpdateData } from './types';
8
+ import type { RemoveData, StageCoreConfig, UpdateData } from './types';
8
9
  /**
9
10
  * 负责管理画布,管理renderer、mask、actionManager三个核心类,并负责统一对外通信,包括提供接口和抛事件
10
11
  */
@@ -32,6 +33,7 @@ export default class StageCore extends EventEmitter {
32
33
  * @param el 要高亮的元素
33
34
  */
34
35
  highlight(idOrEl: Id | HTMLElement): void;
36
+ clearHighlight(): void;
35
37
  /**
36
38
  * 更新组件
37
39
  * @param data 更新组件的数据
@@ -69,6 +71,8 @@ export default class StageCore extends EventEmitter {
69
71
  * @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
70
72
  */
71
73
  delayedMarkContainer(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
74
+ getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined;
75
+ getDragStatus(): import("./types").StageDragStatus;
72
76
  /**
73
77
  * 销毁实例
74
78
  */
@@ -100,4 +104,8 @@ export default class StageCore extends EventEmitter {
100
104
  * 初始化Highlight类通过ActionManager抛出来的事件监听
101
105
  */
102
106
  private initHighlightEvent;
107
+ /**
108
+ * 初始化Highlight类通过ActionManager抛出来的事件监听
109
+ */
110
+ private initMouseEvent;
103
111
  }
@@ -1,5 +1,6 @@
1
1
  import MoveableOptionsManager from './MoveableOptionsManager';
2
2
  import type { StageDragResizeConfig } from './types';
3
+ import { StageDragStatus } from './types';
3
4
  /**
4
5
  * 管理单选操作,响应选中操作,初始化moveableOption参数并初始化moveable,处理moveable回调事件对组件进行更新
5
6
  * @extends MoveableOptionsManager
@@ -30,6 +31,7 @@ export default class StageDragResize extends MoveableOptionsManager {
30
31
  */
31
32
  updateMoveable(el?: HTMLElement | undefined): void;
32
33
  clearSelectStatus(): void;
34
+ getDragStatus(): StageDragStatus;
33
35
  /**
34
36
  * 销毁实例
35
37
  */
@@ -7,7 +7,7 @@ export default class StageHighlight extends EventEmitter {
7
7
  container: HTMLElement;
8
8
  target?: HTMLElement;
9
9
  moveable?: Moveable;
10
- targetShadow: TargetShadow;
10
+ targetShadow?: TargetShadow;
11
11
  private getRootContainer;
12
12
  constructor(config: StageHighlightConfig);
13
13
  /**
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import StageCore from './StageCore';
2
- export type { MoveableOptions } from 'moveable';
2
+ export type { MoveableOptions, OnDragStart } from 'moveable';
3
3
  export { default as StageRender } from './StageRender';
4
4
  export { default as StageMask } from './StageMask';
5
5
  export { default as StageDragResize } from './StageDragResize';
package/types/types.d.ts CHANGED
@@ -38,7 +38,6 @@ export interface StageCoreConfig {
38
38
  containerHighlightDuration?: number;
39
39
  containerHighlightType?: ContainerHighlightType;
40
40
  moveableOptions?: CustomizeMoveableOptions;
41
- multiMoveableOptions?: CustomizeMoveableOptions;
42
41
  /** runtime 的HTML地址,可以是一个HTTP地址,如果和编辑器不同域,需要设置跨域,也可以是一个相对或绝对路径 */
43
42
  runtimeUrl?: string;
44
43
  render?: (renderer: StageCore) => Promise<HTMLElement> | HTMLElement;
@@ -52,7 +51,6 @@ export interface ActionManagerConfig {
52
51
  containerHighlightDuration?: number;
53
52
  containerHighlightType?: ContainerHighlightType;
54
53
  moveableOptions?: CustomizeMoveableOptions;
55
- multiMoveableOptions?: CustomizeMoveableOptions;
56
54
  disabledDragStart?: boolean;
57
55
  canSelect?: CanSelect;
58
56
  isContainer: IsContainer;
@@ -68,7 +66,11 @@ export interface MoveableOptionsManagerConfig {
68
66
  getRootContainer: GetRootContainer;
69
67
  }
70
68
  export interface CustomizeMoveableOptionsCallbackConfig {
69
+ targetEl?: HTMLElement;
71
70
  targetElId?: string;
71
+ targetEls?: HTMLElement[];
72
+ targetElIds?: string[];
73
+ isMulti: boolean;
72
74
  }
73
75
  export interface StageRenderConfig {
74
76
  runtimeUrl?: string;
@@ -91,7 +93,7 @@ export interface StageDragResizeConfig {
91
93
  export interface StageMultiDragResizeConfig {
92
94
  container: HTMLElement;
93
95
  dragResizeHelper: DragResizeHelper;
94
- multiMoveableOptions?: CustomizeMoveableOptions;
96
+ moveableOptions?: CustomizeMoveableOptions;
95
97
  getRootContainer: GetRootContainer;
96
98
  getRenderDocument: GetRenderDocument;
97
99
  markContainerEnd: MarkContainerEnd;