@tmagic/stage 1.5.0-beta.1 → 1.5.0-beta.10

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.
package/src/StageCore.ts CHANGED
@@ -47,9 +47,9 @@ import type {
47
47
  */
48
48
  export default class StageCore extends EventEmitter {
49
49
  public container?: HTMLDivElement;
50
- public renderer: StageRender;
51
- public mask: StageMask;
52
- public actionManager: ActionManager;
50
+ public renderer: StageRender | null = null;
51
+ public mask: StageMask | null = null;
52
+ public actionManager: ActionManager | null = null;
53
53
 
54
54
  private pageResizeObserver: ResizeObserver | null = null;
55
55
  private autoScrollIntoView: boolean | undefined;
@@ -87,17 +87,18 @@ export default class StageCore extends EventEmitter {
87
87
  * @param id 选中的id
88
88
  */
89
89
  public async select(id: Id, event?: MouseEvent): Promise<void> {
90
- const el = this.renderer.getTargetElement(id);
91
- if (el === this.actionManager.getSelectedEl()) return;
90
+ const el = this.renderer?.getTargetElement(id) || null;
91
+ if (el === this.actionManager?.getSelectedEl()) return;
92
92
 
93
- await this.renderer.select([id]);
93
+ await this.renderer?.select([id]);
94
94
 
95
- el && this.mask.setLayout(el);
96
-
97
- this.actionManager.select(el, event);
95
+ if (el) {
96
+ this.mask?.setLayout(el);
97
+ }
98
+ this.actionManager?.select(el, event);
98
99
 
99
100
  if (el && (this.autoScrollIntoView || el.dataset.autoScrollIntoView)) {
100
- this.mask.observerIntersection(el);
101
+ this.mask?.observerIntersection(el);
101
102
  }
102
103
  }
103
104
 
@@ -106,20 +107,20 @@ export default class StageCore extends EventEmitter {
106
107
  * @param ids 选中元素的id列表
107
108
  */
108
109
  public async multiSelect(ids: Id[]): Promise<void> {
109
- const els = ids.map((id) => this.renderer.getTargetElement(id)).filter((el) => Boolean(el));
110
+ const els = ids.map((id) => this.renderer?.getTargetElement(id)).filter((el) => Boolean(el));
110
111
  if (els.length === 0) return;
111
112
 
112
113
  const lastEl = els[els.length - 1];
113
114
  // 是否减少了组件选择
114
- const isReduceSelect = els.length < this.actionManager.getSelectedElList().length;
115
- await this.renderer.select(ids);
115
+ const isReduceSelect = els.length < this.actionManager!.getSelectedElList().length;
116
+ await this.renderer?.select(ids);
116
117
 
117
- lastEl && this.mask.setLayout(lastEl);
118
+ lastEl && this.mask?.setLayout(lastEl);
118
119
 
119
- this.actionManager.multiSelect(ids);
120
+ this.actionManager?.multiSelect(ids);
120
121
 
121
122
  if (lastEl && (this.autoScrollIntoView || lastEl.dataset.autoScrollIntoView) && !isReduceSelect) {
122
- this.mask.observerIntersection(lastEl);
123
+ this.mask?.observerIntersection(lastEl);
123
124
  }
124
125
  }
125
126
 
@@ -128,11 +129,11 @@ export default class StageCore extends EventEmitter {
128
129
  * @param el 要高亮的元素
129
130
  */
130
131
  public highlight(id: Id): void {
131
- this.actionManager.highlight(id);
132
+ this.actionManager?.highlight(id);
132
133
  }
133
134
 
134
135
  public clearHighlight(): void {
135
- this.actionManager.clearHighlight();
136
+ this.actionManager?.clearHighlight();
136
137
  }
137
138
 
138
139
  /**
@@ -142,13 +143,13 @@ export default class StageCore extends EventEmitter {
142
143
  public async update(data: UpdateData): Promise<void> {
143
144
  const { config } = data;
144
145
 
145
- await this.renderer.update(data);
146
+ await this.renderer?.update(data);
146
147
  // 通过setTimeout等画布中组件完成渲染更新
147
148
  setTimeout(() => {
148
- const el = this.renderer.getTargetElement(`${config.id}`);
149
- if (el && this.actionManager.isSelectedEl(el)) {
149
+ const el = this.renderer?.getTargetElement(`${config.id}`);
150
+ if (el && this.actionManager?.isSelectedEl(el)) {
150
151
  // 更新了组件的布局,需要重新设置mask是否可以滚动
151
- this.mask.setLayout(el);
152
+ this.mask?.setLayout(el);
152
153
  // 组件有更新,需要set
153
154
  this.actionManager.setSelectedEl(el);
154
155
  this.actionManager.updateMoveable(el);
@@ -161,7 +162,7 @@ export default class StageCore extends EventEmitter {
161
162
  * @param data 组件信息数据
162
163
  */
163
164
  public async add(data: UpdateData): Promise<void> {
164
- return await this.renderer.add(data);
165
+ return await this.renderer?.add(data);
165
166
  }
166
167
 
167
168
  /**
@@ -169,11 +170,11 @@ export default class StageCore extends EventEmitter {
169
170
  * @param data 组件信息数据
170
171
  */
171
172
  public async remove(data: RemoveData): Promise<void> {
172
- return await this.renderer.remove(data);
173
+ return await this.renderer?.remove(data);
173
174
  }
174
175
 
175
176
  public setZoom(zoom: number = DEFAULT_ZOOM): void {
176
- this.renderer.setZoom(zoom);
177
+ this.renderer?.setZoom(zoom);
177
178
  }
178
179
 
179
180
  /**
@@ -184,8 +185,8 @@ export default class StageCore extends EventEmitter {
184
185
  this.container = el;
185
186
  const { mask, renderer } = this;
186
187
 
187
- await renderer.mount(el);
188
- mask.mount(el);
188
+ await renderer?.mount(el);
189
+ mask?.mount(el);
189
190
 
190
191
  this.emit('mounted');
191
192
  }
@@ -194,8 +195,8 @@ export default class StageCore extends EventEmitter {
194
195
  * 清空所有参考线
195
196
  */
196
197
  public clearGuides() {
197
- this.mask.clearGuides();
198
- this.actionManager.clearGuides();
198
+ this.mask?.clearGuides();
199
+ this.actionManager?.clearGuides();
199
200
  }
200
201
 
201
202
  /**
@@ -216,23 +217,23 @@ export default class StageCore extends EventEmitter {
216
217
  * @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
217
218
  */
218
219
  public delayedMarkContainer(event: MouseEvent, excludeElList: Element[] = []): NodeJS.Timeout | undefined {
219
- return this.actionManager.delayedMarkContainer(event, excludeElList);
220
+ return this.actionManager?.delayedMarkContainer(event, excludeElList);
220
221
  }
221
222
 
222
223
  public getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined {
223
- return this.actionManager.getMoveableOption(key);
224
+ return this.actionManager?.getMoveableOption(key);
224
225
  }
225
226
 
226
227
  public getDragStatus() {
227
- return this.actionManager.getDragStatus();
228
+ return this.actionManager?.getDragStatus();
228
229
  }
229
230
 
230
231
  public disableMultiSelect() {
231
- this.actionManager.disableMultiSelect();
232
+ this.actionManager?.disableMultiSelect();
232
233
  }
233
234
 
234
235
  public enableMultiSelect() {
235
- this.actionManager.enableMultiSelect();
236
+ this.actionManager?.enableMultiSelect();
236
237
  }
237
238
 
238
239
  /**
@@ -241,14 +242,18 @@ export default class StageCore extends EventEmitter {
241
242
  public destroy(): void {
242
243
  const { mask, renderer, actionManager, pageResizeObserver } = this;
243
244
 
244
- renderer.destroy();
245
- mask.destroy();
246
- actionManager.destroy();
245
+ renderer?.destroy();
246
+ mask?.destroy();
247
+ actionManager?.destroy();
247
248
  pageResizeObserver?.disconnect();
248
249
 
249
250
  this.removeAllListeners();
250
251
 
251
252
  this.container = undefined;
253
+ this.renderer = null;
254
+ this.mask = null;
255
+ this.actionManager = null;
256
+ this.pageResizeObserver = null;
252
257
  }
253
258
 
254
259
  public on<Name extends keyof CoreEvents, Param extends CoreEvents[Name]>(
@@ -272,8 +277,8 @@ export default class StageCore extends EventEmitter {
272
277
 
273
278
  if (typeof ResizeObserver !== 'undefined') {
274
279
  this.pageResizeObserver = new ResizeObserver((entries) => {
275
- this.mask.pageResize(entries);
276
- this.actionManager.updateMoveable();
280
+ this.mask?.pageResize(entries);
281
+ this.actionManager?.updateMoveable();
277
282
  });
278
283
 
279
284
  this.pageResizeObserver.observe(page);
@@ -286,26 +291,26 @@ export default class StageCore extends EventEmitter {
286
291
  containerHighlightDuration: config.containerHighlightDuration,
287
292
  containerHighlightType: config.containerHighlightType,
288
293
  moveableOptions: config.moveableOptions,
289
- container: this.mask.content,
294
+ container: this.mask!.content,
290
295
  disabledDragStart: config.disabledDragStart,
291
296
  disabledMultiSelect: config.disabledMultiSelect,
292
297
  canSelect: config.canSelect,
293
298
  isContainer: config.isContainer,
294
299
  updateDragEl: config.updateDragEl,
295
300
  getRootContainer: () => this.container,
296
- getRenderDocument: () => this.renderer.getDocument(),
297
- getTargetElement: (id: Id) => this.renderer.getTargetElement(id),
298
- getElementsFromPoint: (point: Point) => this.renderer.getElementsFromPoint(point),
301
+ getRenderDocument: () => this.renderer!.getDocument(),
302
+ getTargetElement: (id: Id) => this.renderer!.getTargetElement(id),
303
+ getElementsFromPoint: (point: Point) => this.renderer!.getElementsFromPoint(point),
299
304
  };
300
305
 
301
306
  return actionManagerConfig;
302
307
  }
303
308
 
304
309
  private initRenderEvent(): void {
305
- this.renderer.on('runtime-ready', (runtime: Runtime) => {
310
+ this.renderer?.on('runtime-ready', (runtime: Runtime) => {
306
311
  this.emit('runtime-ready', runtime);
307
312
  });
308
- this.renderer.on('page-el-update', (el: HTMLElement) => {
313
+ this.renderer?.on('page-el-update', (el: HTMLElement) => {
309
314
  this.mask?.observe(el);
310
315
  this.observePageResize(el);
311
316
 
@@ -314,8 +319,8 @@ export default class StageCore extends EventEmitter {
314
319
  }
315
320
 
316
321
  private initMaskEvent(): void {
317
- this.mask.on('change-guides', (data: GuidesEventData) => {
318
- this.actionManager.setGuidelines(data.type, data.guides);
322
+ this.mask?.on('change-guides', (data: GuidesEventData) => {
323
+ this.actionManager?.setGuidelines(data.type, data.guides);
319
324
  this.emit('change-guides', data);
320
325
  });
321
326
  }
@@ -336,7 +341,7 @@ export default class StageCore extends EventEmitter {
336
341
  */
337
342
  private initActionManagerEvent(): void {
338
343
  this.actionManager
339
- .on('before-select', (el: HTMLElement, event?: MouseEvent) => {
344
+ ?.on('before-select', (el: HTMLElement, event?: MouseEvent) => {
340
345
  const id = getIdFromEl()(el);
341
346
  id && this.select(id, event);
342
347
  })
@@ -359,7 +364,7 @@ export default class StageCore extends EventEmitter {
359
364
  */
360
365
  private initDrEvent(): void {
361
366
  this.actionManager
362
- .on('update', (data: UpdateEventData) => {
367
+ ?.on('update', (data: UpdateEventData) => {
363
368
  this.emit('update', data);
364
369
  })
365
370
  .on('sort', (data: SortEventData) => {
@@ -379,11 +384,11 @@ export default class StageCore extends EventEmitter {
379
384
  private initMulDrEvent(): void {
380
385
  this.actionManager
381
386
  // 多选切换到单选
382
- .on('change-to-select', (id: Id, e: MouseEvent) => {
387
+ ?.on('change-to-select', (id: Id, e: MouseEvent) => {
383
388
  this.select(id);
384
389
  // 先保证画布内完成渲染,再通知外部更新
385
390
  setTimeout(() => {
386
- const el = this.renderer.getTargetElement(id);
391
+ const el = this.renderer?.getTargetElement(id);
387
392
  el && this.emit('select', el, e);
388
393
  });
389
394
  })
@@ -396,7 +401,7 @@ export default class StageCore extends EventEmitter {
396
401
  * 初始化Highlight类通过ActionManager抛出来的事件监听
397
402
  */
398
403
  private initHighlightEvent(): void {
399
- this.actionManager.on('highlight', (highlightEl: HTMLElement) => {
404
+ this.actionManager?.on('highlight', (highlightEl: HTMLElement) => {
400
405
  this.emit('highlight', highlightEl);
401
406
  });
402
407
  }
@@ -406,7 +411,7 @@ export default class StageCore extends EventEmitter {
406
411
  */
407
412
  private initMouseEvent(): void {
408
413
  this.actionManager
409
- .on('mousemove', (event: MouseEvent) => {
414
+ ?.on('mousemove', (event: MouseEvent) => {
410
415
  this.emit('mousemove', event);
411
416
  })
412
417
  .on('mouseleave', (event: MouseEvent) => {
@@ -22,7 +22,7 @@ import Moveable, { MoveableOptions } from 'moveable';
22
22
  import { getIdFromEl } from '@tmagic/utils';
23
23
 
24
24
  import { Mode, StageDragStatus } from './const';
25
- import DragResizeHelper from './DragResizeHelper';
25
+ import type DragResizeHelper from './DragResizeHelper';
26
26
  import MoveableOptionsManager from './MoveableOptionsManager';
27
27
  import type {
28
28
  DelayedMarkContainer,
@@ -125,6 +125,7 @@ export default class StageDragResize extends MoveableOptionsManager {
125
125
  * 销毁实例
126
126
  */
127
127
  public destroy(): void {
128
+ this.target = null;
128
129
  this.moveable?.destroy();
129
130
  this.dragResizeHelper.destroy();
130
131
  this.dragStatus = StageDragStatus.END;
@@ -81,6 +81,7 @@ export default class StageHighlight extends EventEmitter {
81
81
  * 销毁实例
82
82
  */
83
83
  public destroy(): void {
84
+ this.target = undefined;
84
85
  this.moveable?.destroy();
85
86
  this.targetShadow?.destroy();
86
87
  this.moveable = undefined;
@@ -155,6 +155,19 @@ export default class StageRender extends EventEmitter {
155
155
  return getElById()(this.getDocument(), id);
156
156
  }
157
157
 
158
+ public postTmagicRuntimeReady() {
159
+ this.contentWindow = this.iframe?.contentWindow as RuntimeWindow;
160
+
161
+ this.contentWindow.magic = this.getMagicApi();
162
+
163
+ this.contentWindow.postMessage(
164
+ {
165
+ tmagicRuntimeReady: true,
166
+ },
167
+ '*',
168
+ );
169
+ }
170
+
158
171
  /**
159
172
  * 销毁实例
160
173
  */
@@ -236,17 +249,4 @@ export default class StageRender extends EventEmitter {
236
249
 
237
250
  injectStyle(this.contentWindow.document, style);
238
251
  };
239
-
240
- private postTmagicRuntimeReady() {
241
- this.contentWindow = this.iframe?.contentWindow as RuntimeWindow;
242
-
243
- this.contentWindow.magic = this.getMagicApi();
244
-
245
- this.contentWindow.postMessage(
246
- {
247
- tmagicRuntimeReady: true,
248
- },
249
- '*',
250
- );
251
- }
252
252
  }
package/src/index.ts CHANGED
@@ -18,12 +18,16 @@
18
18
 
19
19
  import StageCore from './StageCore';
20
20
 
21
- export type { MoveableOptions, OnDragStart } from 'moveable';
21
+ export * from 'moveable';
22
22
  export type { GuidesOptions } from '@scena/guides';
23
+
23
24
  export { default as StageRender } from './StageRender';
24
25
  export { default as StageMask } from './StageMask';
25
26
  export { default as StageDragResize } from './StageDragResize';
26
27
  export * from './types';
27
28
  export * from './const';
28
29
  export * from './util';
30
+ export * from './MoveableActionsAble';
31
+ export { default as MoveableActionsAble } from './MoveableActionsAble';
32
+
29
33
  export default StageCore;
package/src/util.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- import { removeClassName } from '@tmagic/utils';
18
+ import { getIdFromEl, removeClassName } from '@tmagic/utils';
19
19
 
20
20
  import { GHOST_EL_ID_PREFIX, Mode, SELECTED_CLASS, ZIndex } from './const';
21
21
  import type { Offset, SortEventData, TargetElement } from './types';
@@ -88,13 +88,13 @@ export const getAbsolutePosition = (el: HTMLElement, { top, left }: Offset) => {
88
88
  return { left, top };
89
89
  };
90
90
 
91
- export const isAbsolute = (style: CSSStyleDeclaration): boolean => style.position === 'absolute';
91
+ export const isAbsolute = (style: { position?: string }): boolean => style.position === 'absolute';
92
92
 
93
- export const isRelative = (style: CSSStyleDeclaration): boolean => style.position === 'relative';
93
+ export const isRelative = (style: { position?: string }): boolean => style.position === 'relative';
94
94
 
95
- export const isStatic = (style: CSSStyleDeclaration): boolean => style.position === 'static';
95
+ export const isStatic = (style: { position?: string }): boolean => style.position === 'static';
96
96
 
97
- export const isFixed = (style: CSSStyleDeclaration): boolean => style.position === 'fixed';
97
+ export const isFixed = (style: { position?: string }): boolean => style.position === 'fixed';
98
98
 
99
99
  export const isFixedParent = (el: Element) => {
100
100
  let fixed = false;
@@ -170,7 +170,7 @@ export const down = (deltaTop: number, target: TargetElement): SortEventData =>
170
170
  let swapIndex = 0;
171
171
  let addUpH = target.clientHeight;
172
172
  const brothers = Array.from(target.parentNode?.children || []).filter(
173
- (node) => !node.id.startsWith(GHOST_EL_ID_PREFIX),
173
+ (child) => !getIdFromEl()(child as HTMLElement)?.startsWith(GHOST_EL_ID_PREFIX),
174
174
  );
175
175
  const index = brothers.indexOf(target);
176
176
  // 往下移动
@@ -189,9 +189,12 @@ export const down = (deltaTop: number, target: TargetElement): SortEventData =>
189
189
  addUpH += ele.clientHeight / 2;
190
190
  swapIndex = i;
191
191
  }
192
+
193
+ const src = getIdFromEl()(target) || '';
194
+
192
195
  return {
193
- src: target.id,
194
- dist: downEls.length && swapIndex > -1 ? downEls[swapIndex].id : target.id,
196
+ src,
197
+ dist: downEls.length && swapIndex > -1 ? getIdFromEl()(downEls[swapIndex]) || '' : src,
195
198
  };
196
199
  };
197
200
 
@@ -204,7 +207,7 @@ export const down = (deltaTop: number, target: TargetElement): SortEventData =>
204
207
  */
205
208
  export const up = (deltaTop: number, target: TargetElement): SortEventData => {
206
209
  const brothers = Array.from(target.parentNode?.children || []).filter(
207
- (node) => !node.id.startsWith(GHOST_EL_ID_PREFIX),
210
+ (child) => !getIdFromEl()(child as HTMLElement)?.startsWith(GHOST_EL_ID_PREFIX),
208
211
  );
209
212
  const index = brothers.indexOf(target);
210
213
  // 往上移动
@@ -225,9 +228,12 @@ export const up = (deltaTop: number, target: TargetElement): SortEventData => {
225
228
 
226
229
  swapIndex = i;
227
230
  }
231
+
232
+ const src = getIdFromEl()(target) || '';
233
+
228
234
  return {
229
- src: target.id,
230
- dist: upEls.length && swapIndex > -1 ? upEls[swapIndex].id : target.id,
235
+ src,
236
+ dist: upEls.length && swapIndex > -1 ? getIdFromEl()(upEls[swapIndex]) || '' : src,
231
237
  };
232
238
  };
233
239
 
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
2
- import { OnResizeStart, OnResize, OnDragStart, OnDrag, OnRotateStart, OnRotate, OnScaleStart, OnScale, OnResizeGroupStart, OnResizeGroup, OnDragGroupStart, OnDragGroup, MoveableOptions } from 'moveable';
3
- export { MoveableOptions, OnDragStart } from 'moveable';
2
+ import { OnResizeStart, OnResize, OnDragStart, OnDrag, OnRotateStart, OnRotate, OnScaleStart, OnScale, OnResizeGroupStart, OnResizeGroup, OnDragGroupStart, OnDragGroup, MoveableOptions, Renderer, MoveableManagerInterface } from 'moveable';
3
+ export * from 'moveable';
4
4
  import { Id, MApp, MNode, MContainer } from '@tmagic/schema';
5
5
  import Guides, { GuidesOptions } from '@scena/guides';
6
6
  export { GuidesOptions } from '@scena/guides';
@@ -406,7 +406,7 @@ interface MultiDrEvents {
406
406
  */
407
407
  declare class ActionManager extends EventEmitter {
408
408
  private dr;
409
- private multiDr?;
409
+ private multiDr;
410
410
  private highlightLayer;
411
411
  /** 单选、多选、高亮的容器(蒙层的content) */
412
412
  private container;
@@ -502,7 +502,7 @@ declare class ActionManager extends EventEmitter {
502
502
  * @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
503
503
  */
504
504
  delayedMarkContainer(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
505
- getDragStatus(): StageDragStatus;
505
+ getDragStatus(): StageDragStatus | undefined;
506
506
  destroy(): void;
507
507
  on<Name extends keyof ActionManagerEvents, Param extends ActionManagerEvents[Name]>(eventName: Name, listener: (...args: Param) => void): this;
508
508
  emit<Name extends keyof ActionManagerEvents, Param extends ActionManagerEvents[Name]>(eventName: Name, ...args: Param): boolean;
@@ -698,6 +698,7 @@ declare class StageRender extends EventEmitter$1 {
698
698
  */
699
699
  getElementsFromPoint(point: Point): HTMLElement[];
700
700
  getTargetElement(id: Id): HTMLElement | null;
701
+ postTmagicRuntimeReady(): void;
701
702
  /**
702
703
  * 销毁实例
703
704
  */
@@ -712,7 +713,6 @@ declare class StageRender extends EventEmitter$1 {
712
713
  */
713
714
  private flagSelectedEl;
714
715
  private iframeLoadHandler;
715
- private postTmagicRuntimeReady;
716
716
  }
717
717
 
718
718
  /**
@@ -720,9 +720,9 @@ declare class StageRender extends EventEmitter$1 {
720
720
  */
721
721
  declare class StageCore extends EventEmitter$1 {
722
722
  container?: HTMLDivElement;
723
- renderer: StageRender;
724
- mask: StageMask;
725
- actionManager: ActionManager;
723
+ renderer: StageRender | null;
724
+ mask: StageMask | null;
725
+ actionManager: ActionManager | null;
726
726
  private pageResizeObserver;
727
727
  private autoScrollIntoView;
728
728
  private customizedRender?;
@@ -781,7 +781,7 @@ declare class StageCore extends EventEmitter$1 {
781
781
  */
782
782
  delayedMarkContainer(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
783
783
  getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined;
784
- getDragStatus(): StageDragStatus;
784
+ getDragStatus(): StageDragStatus | undefined;
785
785
  disableMultiSelect(): void;
786
786
  enableMultiSelect(): void;
787
787
  /**
@@ -959,10 +959,18 @@ declare const getAbsolutePosition: (el: HTMLElement, { top, left }: Offset) => {
959
959
  left: number;
960
960
  top: number;
961
961
  };
962
- declare const isAbsolute: (style: CSSStyleDeclaration) => boolean;
963
- declare const isRelative: (style: CSSStyleDeclaration) => boolean;
964
- declare const isStatic: (style: CSSStyleDeclaration) => boolean;
965
- declare const isFixed: (style: CSSStyleDeclaration) => boolean;
962
+ declare const isAbsolute: (style: {
963
+ position?: string;
964
+ }) => boolean;
965
+ declare const isRelative: (style: {
966
+ position?: string;
967
+ }) => boolean;
968
+ declare const isStatic: (style: {
969
+ position?: string;
970
+ }) => boolean;
971
+ declare const isFixed: (style: {
972
+ position?: string;
973
+ }) => boolean;
966
974
  declare const isFixedParent: (el: Element) => boolean;
967
975
  declare const getMode: (el: Element) => Mode;
968
976
  declare const getScrollParent: (element: HTMLElement, includeHidden?: boolean) => HTMLElement | null;
@@ -994,4 +1002,20 @@ declare const getBorderWidth: (el: Element) => {
994
1002
  borderBottomWidth: number;
995
1003
  };
996
1004
 
997
- export { AbleActionEventType, type ActionManagerConfig, type ActionManagerEvents, CONTAINER_HIGHLIGHT_CLASS_NAME, type CanSelect, ContainerHighlightType, type CoreEvents, type CustomizeMoveableOptions, type CustomizeMoveableOptionsCallbackConfig, type CustomizeRender, DEFAULT_ZOOM, DRAG_EL_ID_PREFIX, type DelayedMarkContainer, type DrEvents, type DragResizeHelperConfig, GHOST_EL_ID_PREFIX, type GetElementsFromPoint, type GetRenderDocument, type GetRootContainer, type GetTargetElement, type GuidesEventData, GuidesType, HIGHLIGHT_EL_ID_PREFIX, type IsContainer, type Magic, type MarkContainerEnd, type MaskEvents, Mode, MouseButton, type MoveableOptionsManagerConfig, type MultiDrEvents, type Offset, PAGE_CLASS, type Point, type Rect, type RemoveData, type RemoveEventData, type RenderEvents, RenderType, type RuleOptions, type Runtime, type RuntimeWindow, SELECTED_CLASS, SelectStatus, type SortEventData, type StageCoreConfig, StageDragResize, type StageDragResizeConfig, StageDragStatus, type StageHighlightConfig, StageMask, type StageMaskConfig, type StageMultiDragResizeConfig, StageRender, type StageRenderConfig, type TargetElement, type TargetShadowConfig, type UpdateData, type UpdateDragEl, type UpdateEventData, ZIndex, addSelectedClassName, StageCore as default, down, getAbsolutePosition, getBorderWidth, getMarginValue, getMode, getOffset, getScrollParent, getTargetElStyle, isAbsolute, isFixed, isFixedParent, isMoveableButton, isRelative, isStatic, removeSelectedClassName, up };
1005
+ interface AbleCustomizedButton {
1006
+ props: {
1007
+ className?: string;
1008
+ onClick?(e: MouseEvent): void;
1009
+ [key: string]: any;
1010
+ };
1011
+ children: ReturnType<Renderer['createElement']>[];
1012
+ }
1013
+ declare const _default: (handler: (type: AbleActionEventType) => void, customizedButton?: ((react: Renderer) => AbleCustomizedButton)[]) => {
1014
+ name: string;
1015
+ props: never[];
1016
+ always: boolean;
1017
+ events: never[];
1018
+ render(moveable: MoveableManagerInterface<any, any>, React: Renderer): any;
1019
+ };
1020
+
1021
+ export { AbleActionEventType, type AbleCustomizedButton, type ActionManagerConfig, type ActionManagerEvents, CONTAINER_HIGHLIGHT_CLASS_NAME, type CanSelect, ContainerHighlightType, type CoreEvents, type CustomizeMoveableOptions, type CustomizeMoveableOptionsCallbackConfig, type CustomizeRender, DEFAULT_ZOOM, DRAG_EL_ID_PREFIX, type DelayedMarkContainer, type DrEvents, type DragResizeHelperConfig, GHOST_EL_ID_PREFIX, type GetElementsFromPoint, type GetRenderDocument, type GetRootContainer, type GetTargetElement, type GuidesEventData, GuidesType, HIGHLIGHT_EL_ID_PREFIX, type IsContainer, type Magic, type MarkContainerEnd, type MaskEvents, Mode, MouseButton, _default as MoveableActionsAble, type MoveableOptionsManagerConfig, type MultiDrEvents, type Offset, PAGE_CLASS, type Point, type Rect, type RemoveData, type RemoveEventData, type RenderEvents, RenderType, type RuleOptions, type Runtime, type RuntimeWindow, SELECTED_CLASS, SelectStatus, type SortEventData, type StageCoreConfig, StageDragResize, type StageDragResizeConfig, StageDragStatus, type StageHighlightConfig, StageMask, type StageMaskConfig, type StageMultiDragResizeConfig, StageRender, type StageRenderConfig, type TargetElement, type TargetShadowConfig, type UpdateData, type UpdateDragEl, type UpdateEventData, ZIndex, addSelectedClassName, StageCore as default, down, getAbsolutePosition, getBorderWidth, getMarginValue, getMode, getOffset, getScrollParent, getTargetElStyle, isAbsolute, isFixed, isFixedParent, isMoveableButton, isRelative, isStatic, removeSelectedClassName, up };