@visactor/vrender 1.1.7 → 1.1.8-alpha.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.
package/dist/index.js CHANGED
@@ -2728,7 +2728,7 @@
2728
2728
  constructor() {
2729
2729
  super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
2730
2730
  }
2731
- onParentSharedStateTreeChanged(_stage, _layer) {}
2731
+ onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
2732
2732
  forEachChildren(cb, reverse = !1) {
2733
2733
  if (reverse) {
2734
2734
  let child = this._lastChild,
@@ -8499,14 +8499,17 @@
8499
8499
  }
8500
8500
  return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
8501
8501
  }
8502
- syncSharedStateScopeBindingFromTree(markDirty = !0) {
8502
+ syncSharedStateScopeBinding(nextScope, markDirty = !0) {
8503
8503
  var _a;
8504
- const nextScope = this.resolveBoundSharedStateScope();
8505
8504
  return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.syncSharedStateActiveRegistrations(), markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(), !0);
8506
8505
  }
8507
- syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
8506
+ syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
8507
+ const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
8508
+ return this.syncSharedStateScopeBinding(nextScope, markDirty);
8509
+ }
8510
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
8508
8511
  var _a, _b;
8509
- return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty);
8512
+ return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty, inheritedSharedStateScope);
8510
8513
  }
8511
8514
  syncSharedStateActiveRegistrations() {
8512
8515
  var _a;
@@ -8514,6 +8517,7 @@
8514
8517
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
8515
8518
  scope.subtreeActiveDescendants.delete(this);
8516
8519
  }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
8520
+ if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
8517
8521
  const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
8518
8522
  null == previousScopes || previousScopes.forEach(scope => {
8519
8523
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
@@ -8521,6 +8525,15 @@
8521
8525
  scope.subtreeActiveDescendants.add(this);
8522
8526
  }), this.registeredActiveScopes = nextScopes;
8523
8527
  }
8528
+ isSharedStateScopeChainRegistered(previousScopes) {
8529
+ let scope = this.boundSharedStateScope,
8530
+ scopeCount = 0;
8531
+ for (; scope;) {
8532
+ if (!previousScopes.has(scope)) return !1;
8533
+ scopeCount += 1, scope = scope.parentScope;
8534
+ }
8535
+ return scopeCount === previousScopes.size;
8536
+ }
8524
8537
  clearSharedStateActiveRegistrations() {
8525
8538
  const previousScopes = this.registeredActiveScopes;
8526
8539
  previousScopes && (previousScopes.forEach(scope => {
@@ -8530,8 +8543,8 @@
8530
8543
  markSharedStateDirty() {
8531
8544
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
8532
8545
  }
8533
- onParentSharedStateTreeChanged(stage, layer) {
8534
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
8546
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
8547
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
8535
8548
  }
8536
8549
  refreshSharedStateBeforeRender() {
8537
8550
  var _a;
@@ -9181,6 +9194,10 @@
9181
9194
  var _a;
9182
9195
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
9183
9196
  }
9197
+ setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
9198
+ var _a;
9199
+ this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions, this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1), this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
9200
+ }
9184
9201
  getStateResolveBaseAttrs() {
9185
9202
  var _a;
9186
9203
  return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
@@ -9544,12 +9561,12 @@
9544
9561
  this._globalTransMatrix.translate(scrollX, scrollY);
9545
9562
  }
9546
9563
  }
9547
- setStage(stage, layer) {
9564
+ setStage(stage, layer, inheritedSharedStateScope) {
9548
9565
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9549
9566
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
9550
9567
  previousStage = this.stage;
9551
9568
  if (this.stage !== stage || this.layer !== layer) {
9552
- if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
9569
+ if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
9553
9570
  const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
9554
9571
  nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
9555
9572
  detachedStageAnimates = [];
@@ -9566,7 +9583,7 @@
9566
9583
  }
9567
9584
  return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_h = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _h || _h.call(graphicService, this, stage));
9568
9585
  }
9569
- ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0);
9586
+ ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope);
9570
9587
  }
9571
9588
  detachStageForRelease() {
9572
9589
  var _a, _b, _c;
@@ -12147,8 +12164,8 @@
12147
12164
  clone() {
12148
12165
  return new RichText(Object.assign({}, this.attribute));
12149
12166
  }
12150
- setStage(stage, layer) {
12151
- super.setStage(stage, layer);
12167
+ setStage(stage, layer, inheritedSharedStateScope) {
12168
+ super.setStage(stage, layer, inheritedSharedStateScope);
12152
12169
  this.getFrameCache().icons.forEach(icon => {
12153
12170
  icon.setStage(stage, layer);
12154
12171
  });
@@ -12852,13 +12869,13 @@
12852
12869
  child.setStage(null, null);
12853
12870
  }), this.addUpdateBoundTag();
12854
12871
  }
12855
- setStage(stage, layer) {
12872
+ setStage(stage, layer, inheritedSharedStateScope) {
12856
12873
  var _a, _b, _c, _d, _e, _f;
12857
12874
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
12858
12875
  needsSharedStateTreeSync = this.hasSharedStateDefinitions() || this.sharedStateScope || (null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty;
12859
- if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged();
12876
+ if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
12860
12877
  const layerChanged = this.layer !== layer;
12861
- layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
12878
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
12862
12879
  }
12863
12880
  addUpdatePositionTag() {
12864
12881
  super.addUpdatePositionTag(), this.forEachChildren(g => {
@@ -12917,17 +12934,26 @@
12917
12934
  hasSharedStateDefinitions() {
12918
12935
  return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
12919
12936
  }
12920
- notifyChildrenSharedStateTreeChanged() {
12937
+ resolveChildSharedStateScope(inheritedSharedStateScope) {
12938
+ var _a;
12939
+ return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
12940
+ }
12941
+ notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
12942
+ const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
12921
12943
  this.forEachChildren(item => {
12922
- this.syncChildSharedStateTreeBinding(item);
12944
+ this.setStageToChild(item, childSharedStateScope);
12923
12945
  });
12924
12946
  }
12925
- syncChildSharedStateTreeBinding(child) {
12926
- child.onParentSharedStateTreeChanged(this.stage, this.layer);
12947
+ setStageToChild(child, inheritedSharedStateScope) {
12948
+ const graphic = child;
12949
+ "function" != typeof graphic.setStage || child.onParentSharedStateTreeChanged !== Graphic.prototype.onParentSharedStateTreeChanged && child.onParentSharedStateTreeChanged !== Group.prototype.onParentSharedStateTreeChanged || graphic.stage === this.stage && graphic.layer === this.layer ? child.onParentSharedStateTreeChanged(this.stage, this.layer, inheritedSharedStateScope) : graphic.setStage(this.stage, this.layer, inheritedSharedStateScope);
12950
+ }
12951
+ syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
12952
+ void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
12927
12953
  }
12928
- onParentSharedStateTreeChanged(stage, layer) {
12954
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
12929
12955
  var _a;
12930
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)), this.notifyChildrenSharedStateTreeChanged()) : this.setStage(stage, layer);
12956
+ this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length), inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : this.setStage(stage, layer, inheritedSharedStateScope);
12931
12957
  }
12932
12958
  }
12933
12959
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -26804,14 +26830,18 @@
26804
26830
  }
26805
26831
  }
26806
26832
  measureText(text, method = application.global.measureTextMethod) {
26807
- this.setTransform(1, 0, 0, 1, 0, 0, !0, application.global.devicePixelRatio);
26808
- return {
26809
- width: super.measureText(text, method).width,
26810
- fontBoundingBoxDescent: void 0,
26811
- fontBoundingBoxAscent: void 0,
26812
- actualBoundingBoxAscent: void 0,
26813
- actualBoundingBoxDescent: void 0
26814
- };
26833
+ const dpr = this.dpr || 1;
26834
+ this.setTransform(1, 0, 0, 1, 0, 0, !0, dpr);
26835
+ const metrics = super.measureText(text, method);
26836
+ return 1 === dpr || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent ? metrics : Object.assign(Object.assign({}, metrics), {
26837
+ width: metrics.width,
26838
+ actualBoundingBoxLeft: metrics.actualBoundingBoxLeft,
26839
+ actualBoundingBoxRight: metrics.actualBoundingBoxRight,
26840
+ actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
26841
+ actualBoundingBoxDescent: metrics.actualBoundingBoxDescent,
26842
+ fontBoundingBoxAscent: metrics.fontBoundingBoxAscent / dpr,
26843
+ fontBoundingBoxDescent: metrics.fontBoundingBoxDescent / dpr
26844
+ });
26815
26845
  }
26816
26846
  createPattern(image, repetition) {
26817
26847
  return null;
@@ -50207,7 +50237,7 @@
50207
50237
  loadDiscreteLegendComponent();
50208
50238
  class DiscreteLegend extends LegendBase {
50209
50239
  constructor(attributes, options) {
50210
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._onHover = e => {
50240
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._stateDefinitionsCache = new WeakMap(), this._onHover = e => {
50211
50241
  const target = e.target;
50212
50242
  if (target && target.name && target.name.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
50213
50243
  const legendItem = target.delegate;
@@ -50255,7 +50285,7 @@
50255
50285
  };
50256
50286
  }
50257
50287
  render() {
50258
- super.render(), this._lastActiveItem = null;
50288
+ this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
50259
50289
  }
50260
50290
  setSelected(selectedData) {
50261
50291
  var _a;
@@ -50435,7 +50465,7 @@
50435
50465
  }), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
50436
50466
  x: 0,
50437
50467
  y: 0
50438
- }, backgroundStyle.style)), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
50468
+ }, backgroundStyle.style)), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state, backgroundStyle.reuseStateDefinitions)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
50439
50469
  const innerGroup = graphicCreator.group({
50440
50470
  x: 0,
50441
50471
  y: 0,
@@ -50458,7 +50488,7 @@
50458
50488
  Object.keys(shapeStyle.state || {}).forEach(key => {
50459
50489
  const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
50460
50490
  shape.fill && isNil$1(shapeStyle.state[key].fill) && color && (shapeStyle.state[key].fill = color), shape.stroke && isNil$1(shapeStyle.state[key].stroke) && color && (shapeStyle.state[key].stroke = color);
50461
- }), this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(itemShape);
50491
+ }), this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state, !1), itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(itemShape);
50462
50492
  }
50463
50493
  let focusSpace = 0;
50464
50494
  if (focus) {
@@ -50485,7 +50515,7 @@
50485
50515
  _originText: labelAttr.formatMethod ? label : void 0
50486
50516
  }),
50487
50517
  labelShape = createTextGraphicByType(labelAttributes);
50488
- this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(labelShape);
50518
+ this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state, labelStyle.reuseStateDefinitions), labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(labelShape);
50489
50519
  const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
50490
50520
  if (isValid$1(value)) {
50491
50521
  const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -50501,7 +50531,7 @@
50501
50531
  _originText: valueAttr.formatMethod ? value : void 0
50502
50532
  }),
50503
50533
  valueShape = createTextGraphicByType(valueAttributes);
50504
- if (this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), this._itemWidthByUser) {
50534
+ if (this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state, valueStyle.reuseStateDefinitions), valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), this._itemWidthByUser) {
50505
50535
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
50506
50536
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
50507
50537
  textAlign: "right",
@@ -50931,8 +50961,17 @@
50931
50961
  item.hasState(exports.LegendStateValue.selected) && selectedData.push(item.data);
50932
50962
  }), selectedData;
50933
50963
  }
50934
- _appendDataToShape(shape, name, data, delegateShape, states = {}) {
50935
- shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge({}, DEFAULT_STATES, states);
50964
+ _appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
50965
+ if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge({}, DEFAULT_STATES, states));
50966
+ const source = null != states ? states : DEFAULT_STATES,
50967
+ cached = this._stateDefinitionsCache.get(source);
50968
+ if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
50969
+ const definitions = states ? merge({}, DEFAULT_STATES, states) : DEFAULT_STATES,
50970
+ entry = {
50971
+ definitions: definitions,
50972
+ compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
50973
+ };
50974
+ this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
50936
50975
  }
50937
50976
  _dispatchLegendEvent(eventName, legendItem, event) {
50938
50977
  const currentSelectedItems = this._getSelectedLegends();
@@ -50949,12 +50988,17 @@
50949
50988
  }
50950
50989
  _handleStyle(config, item, isSelected, index, items) {
50951
50990
  const newConfig = {};
50952
- return config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state && (newConfig.state = {}, Object.keys(config.state).forEach(key => {
50953
- config.state[key] && (isFunction$1(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
50954
- })), newConfig;
50991
+ if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
50992
+ const stateKeys = Object.keys(config.state),
50993
+ hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
50994
+ newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
50995
+ config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
50996
+ })) : newConfig.state = config.state;
50997
+ }
50998
+ return newConfig;
50955
50999
  }
50956
51000
  release() {
50957
- super.release(), this.removeAllEventListeners();
51001
+ this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
50958
51002
  }
50959
51003
  }
50960
51004
  DiscreteLegend.defaultAttributes = {
@@ -55784,6 +55828,28 @@
55784
55828
  return app;
55785
55829
  }
55786
55830
 
55831
+ function isSharedAppOptions(options) {
55832
+ return 'context' in options || 'env' in options || 'envParams' in options || 'key' in options;
55833
+ }
55834
+ function resolveSharedAppOptions(optionsOrEnvParams, env) {
55835
+ var _a;
55836
+ if (env !== undefined) {
55837
+ return {
55838
+ env,
55839
+ envParams: optionsOrEnvParams
55840
+ };
55841
+ }
55842
+ if (optionsOrEnvParams === undefined) {
55843
+ return { env: 'browser' };
55844
+ }
55845
+ if (isSharedAppOptions(optionsOrEnvParams)) {
55846
+ return Object.assign(Object.assign({}, optionsOrEnvParams), { env: (_a = optionsOrEnvParams.env) !== null && _a !== void 0 ? _a : 'browser' });
55847
+ }
55848
+ return {
55849
+ env: 'browser',
55850
+ envParams: optionsOrEnvParams
55851
+ };
55852
+ }
55787
55853
  function createAppForSharedEnv(options) {
55788
55854
  const { env } = options;
55789
55855
  const entryOptions = Object.assign({}, options);
@@ -55812,7 +55878,8 @@
55812
55878
  }
55813
55879
  return createHarmonyVRenderApp(entryOptions);
55814
55880
  }
55815
- function acquireSharedVRenderApp(options) {
55881
+ function acquireSharedVRenderApp(optionsOrEnvParams, env) {
55882
+ const options = resolveSharedAppOptions(optionsOrEnvParams, env);
55816
55883
  return acquireSharedApp(options.env, options, createAppForSharedEnv, options.env);
55817
55884
  }
55818
55885
  function getSharedVRenderApp(env, key = DEFAULT_SHARED_APP_KEY) {
@@ -55836,7 +55903,7 @@
55836
55903
  return resolveLegacyApp().createStage(params);
55837
55904
  }
55838
55905
 
55839
- const version = "1.1.7";
55906
+ const version = "1.1.8-alpha.1";
55840
55907
 
55841
55908
  exports.AComponentAnimate = AComponentAnimate;
55842
55909
  exports.ACustomAnimate = ACustomAnimate;