@visactor/vrender 1.0.10 → 1.0.11-alpha.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.
package/dist/index.js CHANGED
@@ -619,28 +619,59 @@
619
619
  }
620
620
  addEventListener(type, listener, options) {
621
621
  if (!listener) return;
622
+ const capture = this._resolveCapture(options),
623
+ once = this._resolveOnce(options),
624
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
625
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
626
+ if (wrappedMap.has(capture)) return;
622
627
  const wrappedListener = event => {
623
628
  const transformedEvent = this._eventListenerTransformer(event);
624
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
629
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
625
630
  };
626
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
631
+ wrappedMap.set(capture, {
632
+ wrappedListener: wrappedListener,
633
+ options: options
634
+ }), this._nativeAddEventListener(type, wrappedListener, options);
627
635
  }
628
636
  removeEventListener(type, listener, options) {
629
- var _a;
637
+ var _a, _b;
630
638
  if (!listener) return;
631
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
632
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
639
+ const capture = this._resolveCapture(options),
640
+ wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
641
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
633
642
  }
634
643
  dispatchEvent(event) {
635
644
  return this._nativeDispatchEvent(event);
636
645
  }
637
646
  clearAllEventListeners() {
638
- this._listenerMap.forEach((listenersMap, type) => {
639
- listenersMap.forEach((wrappedListener, originalListener) => {
640
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
647
+ this._listenerMap.forEach((listenerMap, type) => {
648
+ listenerMap.forEach(wrappedMap => {
649
+ wrappedMap.forEach((wrappedRecord, capture) => {
650
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
651
+ });
641
652
  });
642
653
  }), this._listenerMap.clear();
643
654
  }
655
+ _resolveCapture(options) {
656
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
657
+ }
658
+ _resolveOnce(options) {
659
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
660
+ }
661
+ _getOrCreateListenerTypeMap(type) {
662
+ let listenerTypeMap = this._listenerMap.get(type);
663
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
664
+ }
665
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
666
+ let wrappedMap = listenerTypeMap.get(listener);
667
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
668
+ }
669
+ _deleteListenerRecord(type, listener, capture) {
670
+ const listenerTypeMap = this._listenerMap.get(type);
671
+ if (!listenerTypeMap) return;
672
+ const wrappedMap = listenerTypeMap.get(listener);
673
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
674
+ }
644
675
  _nativeAddEventListener(type, listener, options) {
645
676
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
646
677
  }
@@ -4377,7 +4408,8 @@
4377
4408
  y1: 0,
4378
4409
  strokeBoundsBuffer: 0,
4379
4410
  cornerRadius: 0,
4380
- cornerType: "round"
4411
+ cornerType: "round",
4412
+ drawStrokeWhenZeroWH: !1
4381
4413
  });
4382
4414
  const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4383
4415
  width: 0,
@@ -4386,7 +4418,8 @@
4386
4418
  y1: 0,
4387
4419
  cornerRadius: 0,
4388
4420
  length: 0,
4389
- cornerType: "round"
4421
+ cornerType: "round",
4422
+ drawStrokeWhenZeroWH: !1
4390
4423
  });
4391
4424
  const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4392
4425
  symbolType: "circle",
@@ -6854,7 +6887,9 @@
6854
6887
  var _a;
6855
6888
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
6856
6889
  const constructor = event.constructor;
6857
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
6890
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
6891
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
6892
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
6858
6893
  }
6859
6894
  notifyListeners(e, type) {
6860
6895
  const listeners = e.currentTarget._events[type];
@@ -9205,7 +9240,7 @@
9205
9240
  });
9206
9241
  }
9207
9242
  setAttributes(params, forceUpdateTag = !1, context) {
9208
- (params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
9243
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9209
9244
  }
9210
9245
  _setAttributes(params, forceUpdateTag = !1, context) {
9211
9246
  const keys = Object.keys(params);
@@ -9606,7 +9641,7 @@
9606
9641
  });
9607
9642
  }
9608
9643
  release() {
9609
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
9644
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
9610
9645
  }
9611
9646
  _emitCustomEvent(type, context) {
9612
9647
  var _a, _b;
@@ -10030,8 +10065,8 @@
10030
10065
  function strokeVisible(opacity, strokeOpacity) {
10031
10066
  return opacity * strokeOpacity > 0;
10032
10067
  }
10033
- function rectStrokeVisible(opacity, strokeOpacity, width, height) {
10034
- return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10068
+ function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
10069
+ return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10035
10070
  }
10036
10071
  function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
10037
10072
  const x10 = x1 - x0,
@@ -15112,7 +15147,8 @@
15112
15147
  y1: y1,
15113
15148
  x: originX = rectAttribute.x,
15114
15149
  y: originY = rectAttribute.y,
15115
- fillStrokeOrder = rectAttribute.fillStrokeOrder
15150
+ fillStrokeOrder = rectAttribute.fillStrokeOrder,
15151
+ drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
15116
15152
  } = rect.attribute;
15117
15153
  let {
15118
15154
  width: width,
@@ -15120,7 +15156,7 @@
15120
15156
  } = rect.attribute;
15121
15157
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
15122
15158
  const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
15123
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
15159
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
15124
15160
  doFill = runFill(fill, background),
15125
15161
  doStroke = runStroke(stroke, lineWidth);
15126
15162
  if (!rect.valid || !visible) return;
@@ -17204,13 +17240,13 @@
17204
17240
  this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
17205
17241
  } else this._skipRender = 1;
17206
17242
  }, this.beforeRender = stage => {
17207
- this._beforeRender && this._beforeRender(stage);
17243
+ this._beforeRenderList.forEach(cb => cb(stage));
17208
17244
  }, this.afterClearScreen = drawParams => {
17209
17245
  this._afterClearScreen && this._afterClearScreen(drawParams);
17210
17246
  }, this.afterClearRect = drawParams => {
17211
17247
  this._afterClearRect && this._afterClearRect(drawParams);
17212
17248
  }, this.afterRender = stage => {
17213
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
17249
+ this.renderCount++, this._afterRenderList.forEach(cb => cb(stage)), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
17214
17250
  }, this.afterTickCb = () => {
17215
17251
  this.tickedBeforeRender = !0, "rendering" !== this.state && this.renderNextFrame();
17216
17252
  }, this.params = params, this.theme = new Theme(), this.hooks = {
@@ -17218,7 +17254,7 @@
17218
17254
  afterRender: new SyncHook(["stage"]),
17219
17255
  afterClearScreen: new SyncHook(["stage"]),
17220
17256
  afterClearRect: new SyncHook(["stage"])
17221
- }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.graphicService = container.get(GraphicService), this.pluginService.active(this, params), this.window.create({
17257
+ }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.graphicService = container.get(GraphicService), this.pluginService.active(this, params), this._beforeRenderList = [], this._afterRenderList = [], this.window.create({
17222
17258
  width: params.width,
17223
17259
  height: params.height,
17224
17260
  viewBox: params.viewBox,
@@ -17229,7 +17265,7 @@
17229
17265
  canvas: params.canvas
17230
17266
  }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
17231
17267
  main: !0
17232
- })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
17268
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), params.beforeRender && this._beforeRenderList.push(params.beforeRender), params.afterRender && this._afterRenderList.push(params.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
17233
17269
  tickRenderMode: "effect"
17234
17270
  }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
17235
17271
  background: this._background
@@ -17344,10 +17380,16 @@
17344
17380
  options.enableView3dTransform && this.enableView3dTransform();
17345
17381
  }
17346
17382
  setBeforeRender(cb) {
17347
- this._beforeRender = cb;
17383
+ this._beforeRenderList.push(cb);
17384
+ }
17385
+ removeBeforeRender(cb) {
17386
+ this._beforeRenderList = this._beforeRenderList.filter(c => c !== cb);
17348
17387
  }
17349
17388
  setAfterRender(cb) {
17350
- this._afterRender = cb;
17389
+ this._afterRenderList.push(cb);
17390
+ }
17391
+ removeAfterRender(cb) {
17392
+ this._afterRenderList = this._afterRenderList.filter(c => c !== cb);
17351
17393
  }
17352
17394
  afterNextRender(cb) {
17353
17395
  this._afterNextRenderCbs || (this._afterNextRenderCbs = []), this._afterNextRenderCbs.push(cb);
@@ -18820,7 +18862,7 @@
18820
18862
  });
18821
18863
  }, this.container = null != container ? container : document.body;
18822
18864
  const textAreaDom = document.createElement("textarea");
18823
- textAreaDom.autocomplete = "off", textAreaDom.innerText = "", this.applyStyle(textAreaDom), this.container.append(textAreaDom), this.textAreaDom = textAreaDom, this.isComposing = !1, this.composingConfigIdx = -1, this.onInputCbList = [], this.onChangeCbList = [], this.onFocusInList = [], this.onFocusOutList = [];
18865
+ textAreaDom.autocomplete = "off", textAreaDom.spellcheck = !1, textAreaDom.innerText = "", this.applyStyle(textAreaDom), this.container.append(textAreaDom), this.textAreaDom = textAreaDom, this.isComposing = !1, this.composingConfigIdx = -1, this.onInputCbList = [], this.onChangeCbList = [], this.onFocusInList = [], this.onFocusOutList = [];
18824
18866
  }
18825
18867
  onInput(cb) {
18826
18868
  this.onInputCbList.push(cb);
@@ -18835,7 +18877,7 @@
18835
18877
  this.onFocusOutList.push(cb);
18836
18878
  }
18837
18879
  applyStyle(textAreaDom) {
18838
- textAreaDom.setAttribute("style", "width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;"), textAreaDom.addEventListener("input", this.handleInput), textAreaDom.addEventListener("compositionstart", this.handleCompositionStart), textAreaDom.addEventListener("compositionend", this.handleCompositionEnd), textAreaDom.addEventListener("focusin", this.handleFocusIn), textAreaDom.addEventListener("focusout", this.handleFocusOut), application.global.addEventListener("keydown", this.handleKeyDown);
18880
+ textAreaDom.setAttribute("style", "width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"), textAreaDom.addEventListener("input", this.handleInput), textAreaDom.addEventListener("compositionstart", this.handleCompositionStart), textAreaDom.addEventListener("compositionend", this.handleCompositionEnd), textAreaDom.addEventListener("focusin", this.handleFocusIn), textAreaDom.addEventListener("focusout", this.handleFocusOut), application.global.addEventListener("keydown", this.handleKeyDown);
18839
18881
  }
18840
18882
  parseCompositionStr(configIdx) {
18841
18883
  var _a;
@@ -20086,7 +20128,7 @@
20086
20128
  super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
20087
20129
  }
20088
20130
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
20089
- var _a;
20131
+ var _a, _b;
20090
20132
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect,
20091
20133
  {
20092
20134
  fill = rectAttribute.fill,
@@ -20099,16 +20141,17 @@
20099
20141
  fillOpacity = rectAttribute.fillOpacity,
20100
20142
  lineWidth = rectAttribute.lineWidth,
20101
20143
  strokeOpacity = rectAttribute.strokeOpacity,
20102
- visible = rectAttribute.visible
20144
+ visible = rectAttribute.visible,
20145
+ drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
20103
20146
  } = rect.attribute;
20104
20147
  let {
20105
20148
  width: width,
20106
20149
  height: height
20107
20150
  } = rect.attribute;
20108
20151
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
20109
- const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
20152
+ const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
20110
20153
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
20111
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
20154
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
20112
20155
  doFill = runFill(fill),
20113
20156
  doStroke = runStroke(stroke, lineWidth);
20114
20157
  if (!rect.valid || !visible) return;
@@ -30485,6 +30528,7 @@
30485
30528
  return this.getEndProps();
30486
30529
  }
30487
30530
  stop() {}
30531
+ release() {}
30488
30532
  }
30489
30533
  class WaitStep extends Step {
30490
30534
  constructor(type, props, duration, easing) {
@@ -30702,7 +30746,9 @@
30702
30746
  this.status !== exports.AnimateStatus.END && this.onEnd(), this.status = exports.AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
30703
30747
  }
30704
30748
  release() {
30705
- this.status = exports.AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
30749
+ this.status = exports.AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [], this.forEachStep(step => {
30750
+ step.release();
30751
+ });
30706
30752
  }
30707
30753
  getDuration() {
30708
30754
  return this._duration;
@@ -30776,6 +30822,10 @@
30776
30822
  getLoop() {
30777
30823
  return this._loopCount;
30778
30824
  }
30825
+ forEachStep(cb) {
30826
+ let step = this._firstStep;
30827
+ for (; step;) cb(step), step = step.next;
30828
+ }
30779
30829
  }
30780
30830
 
30781
30831
  const performanceRAF = new PerformanceRAF();
@@ -31060,6 +31110,9 @@
31060
31110
  constructor(target) {
31061
31111
  this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
31062
31112
  }
31113
+ get started() {
31114
+ return this._started;
31115
+ }
31063
31116
  onStart(cb) {
31064
31117
  cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
31065
31118
  cb();
@@ -31200,14 +31253,14 @@
31200
31253
  return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
31201
31254
  }
31202
31255
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
31203
- var _a, _b, _c, _d;
31256
+ var _a, _b, _c, _d, _e, _f;
31204
31257
  if (custom && customType) {
31205
31258
  const customParams = Object.assign({
31206
- width: graphic.stage.width,
31207
- height: graphic.stage.height,
31259
+ width: (null === (_a = graphic.stage) || void 0 === _a ? void 0 : _a.width) || 0,
31260
+ height: (null === (_b = graphic.stage) || void 0 === _b ? void 0 : _b.height) || 0,
31208
31261
  group: this._target.parent
31209
31262
  }, this.resolveValue(customParameters, graphic)),
31210
- objOptions = isFunction$1(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
31263
+ objOptions = isFunction$1(options) ? options.call(null, null !== (_d = customParams && (null === (_c = customParams.data) || void 0 === _c ? void 0 : _c[0])) && void 0 !== _d ? _d : null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, customParams) : options;
31211
31264
  customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
31212
31265
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
31213
31266
  }
@@ -31427,7 +31480,7 @@
31427
31480
  reApplyState(state) {
31428
31481
  var _a;
31429
31482
  const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
31430
- if (stateInfo) {
31483
+ if (stateInfo && stateInfo.executor.started) {
31431
31484
  const stateList = this.stateList.slice();
31432
31485
  stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
31433
31486
  }
@@ -31570,6 +31623,45 @@
31570
31623
  this._animator && this._animator.stop();
31571
31624
  }
31572
31625
  }
31626
+ class AStageAnimate extends ACustomAnimate {
31627
+ constructor(customFrom, customTo, duration, easing, params) {
31628
+ super(customFrom, customTo, duration, easing, params), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0, this._beforeStageRender = () => {
31629
+ if (!this.willCallBeforeStageRender) return;
31630
+ this.willCallBeforeStageRender = !1;
31631
+ const stage = this.target.stage,
31632
+ canvas = stage.window.getContext().canvas.nativeCanvas,
31633
+ outputCanvas = this.beforeStageRender(stage, canvas);
31634
+ outputCanvas && this.renderToStage(stage, outputCanvas);
31635
+ }, this._afterStageRender = () => {
31636
+ if (!this.willCallAfterStageRender) return;
31637
+ this.willCallAfterStageRender = !1;
31638
+ const stage = this.target.stage,
31639
+ canvas = stage.window.getContext().canvas.nativeCanvas,
31640
+ outputCanvas = this.afterStageRender(stage, canvas);
31641
+ outputCanvas && this.renderToStage(stage, outputCanvas);
31642
+ }, this.props = {};
31643
+ }
31644
+ beforeStageRender(stage, canvas) {
31645
+ return !1;
31646
+ }
31647
+ afterStageRender(stage, canvas) {
31648
+ return !1;
31649
+ }
31650
+ onFirstRun() {
31651
+ super.onFirstRun(), this.target.stage.setBeforeRender(this._beforeStageRender), this.target.stage.setAfterRender(this._afterStageRender), this.target.stage.disableDirtyBounds();
31652
+ }
31653
+ stop() {
31654
+ super.stop(), this.target.stage.removeBeforeRender(this._beforeStageRender), this.target.stage.removeAfterRender(this._afterStageRender);
31655
+ }
31656
+ onUpdate(end, ratio, out) {
31657
+ super.onUpdate(end, ratio, out), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0;
31658
+ }
31659
+ renderToStage(stage, canvas) {
31660
+ const stageCanvas = stage.window.getContext().canvas.nativeCanvas,
31661
+ ctx = stageCanvas.getContext("2d");
31662
+ return !!ctx && (ctx.clearRect(0, 0, stageCanvas.width, stageCanvas.height), ctx.drawImage(canvas, 0, 0), stageCanvas);
31663
+ }
31664
+ }
31573
31665
 
31574
31666
  class ComponentAnimator {
31575
31667
  constructor(component) {
@@ -35094,7 +35186,7 @@
35094
35186
  AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
35095
35187
  };
35096
35188
 
35097
- const version = "1.0.10";
35189
+ const version = "1.0.11-alpha.0";
35098
35190
  preLoadAllModule();
35099
35191
  if (isBrowserEnv()) {
35100
35192
  loadBrowserEnv(container);
@@ -35127,12 +35219,15 @@
35127
35219
  registerReactAttributePlugin();
35128
35220
  registerDirectionalLight();
35129
35221
  registerOrthoCamera();
35222
+ registerCustomAnimate();
35223
+ registerAnimate();
35130
35224
 
35131
35225
  exports.AComponentAnimate = AComponentAnimate;
35132
35226
  exports.ACustomAnimate = ACustomAnimate;
35133
35227
  exports.ARC3D_NUMBER_TYPE = ARC3D_NUMBER_TYPE;
35134
35228
  exports.ARC_NUMBER_TYPE = ARC_NUMBER_TYPE;
35135
35229
  exports.AREA_NUMBER_TYPE = AREA_NUMBER_TYPE;
35230
+ exports.AStageAnimate = AStageAnimate;
35136
35231
  exports.Animate = Animate;
35137
35232
  exports.AnimateExecutor = AnimateExecutor;
35138
35233
  exports.AnimateStep = Step;