@visactor/vchart-extension 2.1.3-alpha.4 → 2.1.3

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/build/index.js CHANGED
@@ -7351,12 +7351,12 @@
7351
7351
  cursor: 1,
7352
7352
  html: 1
7353
7353
  };
7354
- class Graphic extends Node {
7354
+ class GraphicImpl extends Node {
7355
7355
  static mixin(source) {
7356
7356
  const keys = Object.keys(source);
7357
7357
  for (let i = 0; i < keys.length; ++i) {
7358
7358
  const propertyName = keys[i];
7359
- Object.defineProperty(Graphic.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
7359
+ Object.defineProperty(this.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
7360
7360
  }
7361
7361
  }
7362
7362
  get AABBBounds() {
@@ -8595,13 +8595,26 @@
8595
8595
  return null;
8596
8596
  }
8597
8597
  }
8598
+ GraphicImpl.userSymbolMap = {};
8599
+ const GRAPHIC_CLASS_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-class");
8600
+ function createGraphicClassState() {
8601
+ return {
8602
+ Graphic: GraphicImpl
8603
+ };
8604
+ }
8605
+ function getGraphicClassState() {
8606
+ var _a;
8607
+ const globalScope = globalThis;
8608
+ return null !== (_a = globalScope[GRAPHIC_CLASS_SYMBOL]) && void 0 !== _a || (globalScope[GRAPHIC_CLASS_SYMBOL] = createGraphicClassState()), globalScope[GRAPHIC_CLASS_SYMBOL];
8609
+ }
8610
+ const Graphic = getGraphicClassState().Graphic;
8598
8611
  function backgroundNotImage(image) {
8599
8612
  return "string" == typeof image ? !(image.startsWith("<svg") || vutils.isValidUrl(image) || image.includes("/") || vutils.isBase64(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
8600
8613
  }
8601
8614
  function isExternalTexture(texture) {
8602
8615
  return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || vutils.isValidUrl(texture) || texture.includes("/") || vutils.isBase64(texture)) : vutils.isObject(texture));
8603
8616
  }
8604
- Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
8617
+ Graphic.mixin(EventTarget);
8605
8618
 
8606
8619
  const defaultThemeObj = {
8607
8620
  arc: DefaultArcAttribute,
@@ -10300,7 +10313,7 @@
10300
10313
  }
10301
10314
 
10302
10315
  var _a;
10303
- const factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.1"),
10316
+ const factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.3"),
10304
10317
  globalFactoryRegistry = globalThis;
10305
10318
  const factoryRegistry = null !== (_a = globalFactoryRegistry[factoryRegistryKey]) && void 0 !== _a ? _a : globalFactoryRegistry[factoryRegistryKey] = {
10306
10319
  charts: {},
@@ -10330,6 +10343,7 @@
10330
10343
  interactionTriggers: {},
10331
10344
  composedEventMap: {},
10332
10345
  tooltipProcessors: {},
10346
+ runtimePluginInstallers: {},
10333
10347
  formatter: void 0
10334
10348
  };
10335
10349
 
@@ -10509,7 +10523,9 @@
10509
10523
  }, Factory.createTooltipProcessor = (type, tooltip) => {
10510
10524
  const Cror = Factory._tooltipProcessors[type];
10511
10525
  return Cror ? new Cror(tooltip) : null;
10512
- };
10526
+ }, Factory._runtimePluginInstallers = factoryRegistry.runtimePluginInstallers, Factory.registerRuntimePluginInstaller = (type, installer) => {
10527
+ Factory._runtimePluginInstallers[type] = installer;
10528
+ }, Factory.getRuntimePluginInstaller = type => Factory._runtimePluginInstallers[type];
10513
10529
 
10514
10530
  const registerChartPlugin = plugin => {
10515
10531
  Factory.registerChartPlugin(plugin.type, plugin);
@@ -21806,41 +21822,46 @@
21806
21822
  getStatedGraphics(trigger) {
21807
21823
  return this._stateGraphicsByTrigger.get(trigger);
21808
21824
  }
21825
+ _getMarkById(trigger) {
21826
+ const markById = new Map();
21827
+ return trigger.getMarks().forEach(mark => {
21828
+ mark && markById.set(mark.id, mark);
21829
+ }), markById;
21830
+ }
21831
+ _hasAnimationByGraphicState(graphic, markById) {
21832
+ var _a, _b, _c;
21833
+ const mark = null !== (_b = null === (_a = graphic.parent) || void 0 === _a ? void 0 : _a.mark) && void 0 !== _b ? _b : markById.get(graphic.context.markId);
21834
+ return !!(null === (_c = null == mark ? void 0 : mark.hasAnimationByState) || void 0 === _c ? void 0 : _c.call(mark, "state"));
21835
+ }
21809
21836
  updateStates(trigger, newStatedGraphics, prevStatedGraphics, state, reverseState) {
21810
- return this._disableTriggerEvent ? [] : newStatedGraphics && newStatedGraphics.length ? (state && reverseState ? prevStatedGraphics && prevStatedGraphics.length ? (this.toggleReverseStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, reverseState), this.toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state)) : this.addBothStateOfGraphics(trigger, newStatedGraphics, state, reverseState) : state && (prevStatedGraphics && prevStatedGraphics.length ? this.toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state) : this.addStateOfGraphics(trigger, newStatedGraphics, state)), newStatedGraphics) : [];
21837
+ return this._disableTriggerEvent ? [] : newStatedGraphics && newStatedGraphics.length ? (state && reverseState ? prevStatedGraphics && prevStatedGraphics.length ? (this.toggleReverseStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, reverseState), this.toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state)) : this.addBothStateOfGraphics(trigger, newStatedGraphics, state, reverseState) : state && (prevStatedGraphics && prevStatedGraphics.length ? this.toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state) : this.addStateOfGraphics(trigger, newStatedGraphics, state)), newStatedGraphics) : (prevStatedGraphics && prevStatedGraphics.length && this.clearAllStatesOfTrigger(trigger, state, reverseState), []);
21811
21838
  }
21812
21839
  toggleReverseStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, reverseState) {
21813
- const markIdByState = trigger.getMarkIdByState();
21840
+ const markIdByState = trigger.getMarkIdByState(),
21841
+ markById = this._getMarkById(trigger);
21814
21842
  prevStatedGraphics.forEach(g => {
21815
- var _a;
21816
21843
  if (reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId)) {
21817
- const m = null === (_a = g.parent) || void 0 === _a ? void 0 : _a.mark,
21818
- hasAnimation = m.hasAnimationByState && m.hasAnimationByState("state");
21844
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
21819
21845
  addGraphicState(g, reverseState, !0, hasAnimation);
21820
21846
  }
21821
21847
  }), newStatedGraphics.forEach(g => {
21822
- var _a;
21823
21848
  if (reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId)) {
21824
- const m = null === (_a = g.parent) || void 0 === _a ? void 0 : _a.mark,
21825
- hasAnimation = m.hasAnimationByState && m.hasAnimationByState("state");
21849
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
21826
21850
  removeGraphicState(g, reverseState, hasAnimation);
21827
21851
  }
21828
21852
  });
21829
21853
  }
21830
21854
  toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state) {
21831
- const markIdByState = trigger.getMarkIdByState();
21855
+ const markIdByState = trigger.getMarkIdByState(),
21856
+ markById = this._getMarkById(trigger);
21832
21857
  prevStatedGraphics.forEach(g => {
21833
- var _a;
21834
21858
  if (state && markIdByState[state] && markIdByState[state].includes(g.context.markId)) {
21835
- const m = null === (_a = g.parent) || void 0 === _a ? void 0 : _a.mark,
21836
- hasAnimation = m.hasAnimationByState && m.hasAnimationByState("state");
21859
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
21837
21860
  removeGraphicState(g, state, hasAnimation);
21838
21861
  }
21839
21862
  }), newStatedGraphics.forEach(g => {
21840
- var _a;
21841
21863
  if (state && markIdByState[state] && markIdByState[state].includes(g.context.markId)) {
21842
- const m = null === (_a = g.parent) || void 0 === _a ? void 0 : _a.mark,
21843
- hasAnimation = m.hasAnimationByState && m.hasAnimationByState("state");
21864
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
21844
21865
  addGraphicState(g, state, !0, hasAnimation);
21845
21866
  }
21846
21867
  });
@@ -24574,7 +24595,7 @@
24574
24595
  const marks = this.getMarksWithoutRoot();
24575
24596
  marks.forEach(mark => {
24576
24597
  mark.clearBeforeReInit(), this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
24577
- }), this.initMarkStyle(), marks.forEach(mark => {
24598
+ }), this.initMarkStyle(), this.initMarkState(), marks.forEach(mark => {
24578
24599
  mark.commit(!1);
24579
24600
  }), this._updateExtensionMarkSpec(), this._updateSpecData(), this._tooltipHelper && this._tooltipHelper.updateTooltipSpec();
24580
24601
  isAnimationEnabledForSeries(this) && this.initAnimation();