@visactor/vchart 1.11.3-alpha.0 → 1.11.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.es.js CHANGED
@@ -16852,6 +16852,7 @@ class Glyph extends Graphic {
16852
16852
  var _a;
16853
16853
  if (!states.length) return void this.clearStates(hasAnimation);
16854
16854
  if (!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) !== states.length || states.some((stateName, index) => this.currentStates[index] !== stateName))) return;
16855
+ this.stopStateAnimates();
16855
16856
  const stateAttrs = {},
16856
16857
  subAttrs = this.subGraphic.map(() => ({}));
16857
16858
  states.forEach(stateName => {
@@ -16865,9 +16866,9 @@ class Glyph extends Graphic {
16865
16866
  }), this.updateNormalAttrs(stateAttrs), this.currentStates = states, this.applyStateAttrs(stateAttrs, states, hasAnimation);
16866
16867
  }
16867
16868
  clearStates(hasAnimation) {
16868
- this.hasState() && this.normalAttrs && (this.subGraphic.forEach(graphic => {
16869
+ this.stopStateAnimates(), this.hasState() && this.normalAttrs ? (this.currentStates = [], this.subGraphic.forEach(graphic => {
16869
16870
  graphic.applyStateAttrs(graphic.normalAttrs, this.currentStates, hasAnimation, !0), graphic.normalAttrs = null;
16870
- }), this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0), this.normalAttrs = null, this.currentStates = []);
16871
+ }), this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
16871
16872
  }
16872
16873
  clone() {
16873
16874
  const glyph = new Glyph(Object.assign({}, this.attribute));
@@ -18382,7 +18383,7 @@ let DefaultGraphicService = class {
18382
18383
  onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
18383
18384
  beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
18384
18385
  afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"])
18385
- }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this._rectBoundsContribitions = [new DefaultOuterBorderBoundsContribution()], this._symbolBoundsContribitions = [new DefaultSymbolOuterBorderBoundsContribution()], this._circleBoundsContribitions = [new DefaultOuterBorderBoundsContribution()], this._arcBoundsContribitions = [new DefaultOuterBorderBoundsContribution()], this._pathBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
18386
+ }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this._rectBoundsContribitions = [new DefaultOuterBorderBoundsContribution()], this._symbolBoundsContribitions = [new DefaultSymbolOuterBorderBoundsContribution()], this._imageBoundsContribitions = [new DefaultOuterBorderBoundsContribution()], this._circleBoundsContribitions = [new DefaultOuterBorderBoundsContribution()], this._arcBoundsContribitions = [new DefaultOuterBorderBoundsContribution()], this._pathBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
18386
18387
  }
18387
18388
  onAttributeUpdate(graphic) {
18388
18389
  this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
@@ -18783,7 +18784,9 @@ let DefaultGraphicService = class {
18783
18784
  }
18784
18785
  const tb1 = this.tempAABBBounds1,
18785
18786
  tb2 = this.tempAABBBounds2;
18786
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, graphic), aabbBounds;
18787
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this._imageBoundsContribitions.length && this._imageBoundsContribitions.forEach(c => {
18788
+ c.updateBounds(attribute, imageTheme, tb1, graphic), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
18789
+ }), this.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, graphic), aabbBounds;
18787
18790
  }
18788
18791
  combindShadowAABBBounds(bounds, graphic) {
18789
18792
  if (graphic && graphic.shadowRoot) {
@@ -19714,70 +19717,6 @@ function createRectPath(path, x, y, width, height, rectCornerRadius) {
19714
19717
  return path.closePath(), path;
19715
19718
  }
19716
19719
 
19717
- class DefaultImageBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
19718
- constructor() {
19719
- super(...arguments), this.time = BaseRenderContributionTime.beforeFillStroke;
19720
- }
19721
- drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
19722
- const {
19723
- background: background,
19724
- backgroundMode = graphicAttribute.backgroundMode,
19725
- backgroundFit = graphicAttribute.backgroundFit
19726
- } = graphic.attribute;
19727
- if (background) if (graphic.backgroundImg) {
19728
- const res = graphic.resources.get(background);
19729
- if ("success" !== res.state || !res.data) return;
19730
- if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
19731
- const groupAttribute = getTheme$1(graphic.parent).group,
19732
- {
19733
- scrollX = groupAttribute.scrollX,
19734
- scrollY = groupAttribute.scrollY
19735
- } = graphic.parent.attribute;
19736
- context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.translate(scrollX, scrollY);
19737
- }
19738
- const b = graphic.AABBBounds;
19739
- this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
19740
- } else if (isObject$2(background)) {
19741
- const {
19742
- stroke: stroke,
19743
- fill: fill,
19744
- lineWidth = 1,
19745
- cornerRadius = 0,
19746
- expandX = 0,
19747
- expandY = 0
19748
- } = background;
19749
- if (!stroke && !fill) return;
19750
- context.beginPath();
19751
- const {
19752
- x: x,
19753
- y: y,
19754
- width: width,
19755
- height: height
19756
- } = getActualPosition(graphic);
19757
- cornerRadius ? createRectPath(context, x - expandX, y - expandY, width + 2 * expandX, height + 2 * expandY, cornerRadius) : context.rect(x - expandX, y - expandY, width + 2 * expandX, height + 2 * expandY), context.globalAlpha = 1, fill && (context.fillStyle = fill, context.fill()), stroke && lineWidth > 0 && (context.lineWidth = lineWidth, context.strokeStyle = stroke, context.stroke());
19758
- } else {
19759
- context.beginPath();
19760
- const b = graphic.AABBBounds;
19761
- context.rect(x, y, b.width(), b.height()), context.fillStyle = background, context.globalAlpha = 1, context.fill();
19762
- }
19763
- }
19764
- }
19765
- function getActualPosition(graphic) {
19766
- const boundsPadding = parsePadding(graphic.attribute.boundsPadding),
19767
- bounds = graphic.AABBBounds;
19768
- let x = bounds.x1,
19769
- y = bounds.y1,
19770
- width = bounds.width(),
19771
- height = bounds.height();
19772
- return isNumber$1(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
19773
- x: x,
19774
- y: y,
19775
- width: width,
19776
- height: height
19777
- };
19778
- }
19779
- const defaultImageBackgroundRenderContribution = new DefaultImageBackgroundRenderContribution();
19780
-
19781
19720
  var __decorate$1w = undefined && undefined.__decorate || function (decorators, target, key, desc) {
19782
19721
  var d,
19783
19722
  c = arguments.length,
@@ -19884,6 +19823,79 @@ const defaultRectRenderContribution = new DefaultRectRenderContribution();
19884
19823
  const defaultRectTextureRenderContribution = defaultBaseTextureRenderContribution;
19885
19824
  const defaultRectBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
19886
19825
 
19826
+ class DefaultImageBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
19827
+ constructor() {
19828
+ super(...arguments), this.time = BaseRenderContributionTime.beforeFillStroke;
19829
+ }
19830
+ drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
19831
+ const {
19832
+ background: background,
19833
+ backgroundMode = graphicAttribute.backgroundMode,
19834
+ backgroundFit = graphicAttribute.backgroundFit
19835
+ } = graphic.attribute;
19836
+ if (background) if (graphic.backgroundImg) {
19837
+ const res = graphic.resources.get(background);
19838
+ if ("success" !== res.state || !res.data) return;
19839
+ if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
19840
+ const groupAttribute = getTheme$1(graphic.parent).group,
19841
+ {
19842
+ scrollX = groupAttribute.scrollX,
19843
+ scrollY = groupAttribute.scrollY
19844
+ } = graphic.parent.attribute;
19845
+ context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.translate(scrollX, scrollY);
19846
+ }
19847
+ const b = graphic.AABBBounds;
19848
+ this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
19849
+ } else if (isObject$2(background)) {
19850
+ const {
19851
+ stroke: stroke,
19852
+ fill: fill,
19853
+ lineWidth = 1,
19854
+ cornerRadius = 0,
19855
+ expandX = 0,
19856
+ expandY = 0
19857
+ } = background;
19858
+ if (!stroke && !fill) return;
19859
+ context.beginPath();
19860
+ const {
19861
+ x: x,
19862
+ y: y,
19863
+ width: width,
19864
+ height: height
19865
+ } = getActualPosition(graphic);
19866
+ cornerRadius ? createRectPath(context, x - expandX, y - expandY, width + 2 * expandX, height + 2 * expandY, cornerRadius) : context.rect(x - expandX, y - expandY, width + 2 * expandX, height + 2 * expandY), context.globalAlpha = 1, fill && (context.fillStyle = fill, context.fill()), stroke && lineWidth > 0 && (context.lineWidth = lineWidth, context.strokeStyle = stroke, context.stroke());
19867
+ } else {
19868
+ context.beginPath();
19869
+ const b = graphic.AABBBounds;
19870
+ context.rect(x, y, b.width(), b.height()), context.fillStyle = background, context.globalAlpha = 1, context.fill();
19871
+ }
19872
+ }
19873
+ }
19874
+ function getActualPosition(graphic) {
19875
+ const boundsPadding = parsePadding(graphic.attribute.boundsPadding),
19876
+ bounds = graphic.AABBBounds;
19877
+ let x = bounds.x1,
19878
+ y = bounds.y1,
19879
+ width = bounds.width(),
19880
+ height = bounds.height();
19881
+ return isNumber$1(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
19882
+ x: x,
19883
+ y: y,
19884
+ width: width,
19885
+ height: height
19886
+ };
19887
+ }
19888
+ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
19889
+ constructor() {
19890
+ super(...arguments), this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
19891
+ }
19892
+ drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
19893
+ return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
19894
+ }
19895
+ }
19896
+ const defaultImageRenderContribution = new DefaultImageRenderContribution();
19897
+ const defaultImageBackgroundRenderContribution = new DefaultImageBackgroundRenderContribution();
19898
+
19887
19899
  class DefaultSymbolRenderContribution {
19888
19900
  constructor() {
19889
19901
  this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -21453,15 +21465,17 @@ var __decorate$1m = undefined && undefined.__decorate || function (decorators, t
21453
21465
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
21454
21466
  let DefaultCanvasImageRender = class extends BaseRender {
21455
21467
  constructor(imageRenderContribitions) {
21456
- super(), this.imageRenderContribitions = imageRenderContribitions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageBackgroundRenderContribution], this.init(imageRenderContribitions);
21468
+ super(), this.imageRenderContribitions = imageRenderContribitions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(imageRenderContribitions);
21457
21469
  }
21458
- drawShape(image, context, x, y, drawContext, params, fillCb) {
21470
+ drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
21459
21471
  const imageAttribute = getTheme$1(image).image,
21460
21472
  {
21461
21473
  width = imageAttribute.width,
21462
21474
  height = imageAttribute.height,
21463
21475
  repeatX = imageAttribute.repeatX,
21464
21476
  repeatY = imageAttribute.repeatY,
21477
+ x: originX = imageAttribute.x,
21478
+ y: originY = imageAttribute.y,
21465
21479
  cornerRadius = imageAttribute.cornerRadius,
21466
21480
  image: url
21467
21481
  } = image.attribute,
@@ -21486,7 +21500,7 @@ let DefaultCanvasImageRender = class extends BaseRender {
21486
21500
  } else context.drawImage(res.data, x, y, width, height);
21487
21501
  needRestore && context.restore();
21488
21502
  }
21489
- this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
21503
+ doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke())), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
21490
21504
  }
21491
21505
  draw(image, renderService, drawContext) {
21492
21506
  const {
@@ -23518,7 +23532,9 @@ class OrthoCamera {
23518
23532
  let _isBrowserEnv;
23519
23533
  function initIsBrowserEnv() {
23520
23534
  if (null == _isBrowserEnv) try {
23521
- _isBrowserEnv = globalThis === window, _isBrowserEnv && (_isBrowserEnv = !!document.createElement);
23535
+ const canvas = document.createElement("canvas"),
23536
+ ctx = canvas.getContext("2d");
23537
+ _isBrowserEnv = !!(window && canvas.getBoundingClientRect && requestAnimationFrame && window.devicePixelRatio && ctx && ctx.isPointInPath && ctx.isPointInStroke), _isBrowserEnv && (_isBrowserEnv = !!document.createElement);
23522
23538
  } catch (err) {
23523
23539
  _isBrowserEnv = !1;
23524
23540
  }
@@ -37398,11 +37414,11 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
37398
37414
  start: start,
37399
37415
  end: end
37400
37416
  } = this.state;
37401
- this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end, end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start, start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis), this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1), end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || this.setStateAttr(start, end, !0), realTime && this._dispatchEvent("change", {
37417
+ this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end, end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start, start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis), this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1), end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0), realTime && this._dispatchEvent("change", {
37402
37418
  start: start,
37403
37419
  end: end,
37404
37420
  tag: this._activeTag
37405
- });
37421
+ }));
37406
37422
  }, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap$2[this.attribute.delayType](this._pointerMove, this.attribute.delayTime), this._onHandlerPointerUp = e => {
37407
37423
  e.preventDefault();
37408
37424
  const {
@@ -37415,11 +37431,11 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
37415
37431
  const pos = this.eventPosToStagePos(e);
37416
37432
  this.backgroundDragZoom(this._activeCache.startPos, pos);
37417
37433
  }
37418
- this._activeState = !1, brushSelect && this.renderDragMask(), start === this.state.start && end === this.state.end || this.setStateAttr(this.state.start, this.state.end, !0), this._dispatchEvent("change", {
37434
+ this._activeState = !1, brushSelect && this.renderDragMask(), start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0), this._dispatchEvent("change", {
37419
37435
  start: this.state.start,
37420
37436
  end: this.state.end,
37421
37437
  tag: this._activeTag
37422
- }), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
37438
+ })), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
37423
37439
  capture: !0
37424
37440
  }), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp)), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
37425
37441
  capture: !0
@@ -41509,6 +41525,7 @@ class ColorContinuousLegend extends LegendBase {
41509
41525
  return inverse && (isHorizontal ? (res.x0 = 1, res.x1 = 0) : (res.y0 = 1, res.y1 = 0)), res;
41510
41526
  }
41511
41527
  _updateColor() {
41528
+ var _a;
41512
41529
  const {
41513
41530
  layout = "horizontal",
41514
41531
  colors: colors,
@@ -41518,7 +41535,8 @@ class ColorContinuousLegend extends LegendBase {
41518
41535
  {
41519
41536
  startHandler: startHandler,
41520
41537
  endHandler: endHandler,
41521
- track: track
41538
+ track: track,
41539
+ attribute: attribute
41522
41540
  } = this._slider,
41523
41541
  {
41524
41542
  startValue: startValue,
@@ -41526,9 +41544,15 @@ class ColorContinuousLegend extends LegendBase {
41526
41544
  startPos: startPos,
41527
41545
  endPos: endPos
41528
41546
  } = this._slider.currentValue,
41529
- startHandlerColor = this._colorScale.scale(startValue),
41530
- endHandlerColor = this._colorScale.scale(endValue);
41531
- null == startHandler || startHandler.setAttribute("fill", startHandlerColor), null == endHandler || endHandler.setAttribute("fill", endHandlerColor);
41547
+ handlerColor = null === (_a = attribute.handlerStyle) || void 0 === _a ? void 0 : _a.fill;
41548
+ if (startHandler && !handlerColor) {
41549
+ const startHandlerColor = this._colorScale.scale(startValue);
41550
+ startHandler.setAttribute("fill", startHandlerColor);
41551
+ }
41552
+ if (endHandler && !handlerColor) {
41553
+ const endHandlerColor = this._colorScale.scale(endValue);
41554
+ endHandler.setAttribute("fill", endHandlerColor);
41555
+ }
41532
41556
  const railLen = "horizontal" === layout ? railWidth : railHeight;
41533
41557
  if (Math.abs(startPos - endPos) !== railLen && colors && colors.length > 1) {
41534
41558
  const stops = this._color.stops,
@@ -41573,6 +41597,7 @@ ColorContinuousLegend.defaultAttributes = {
41573
41597
  },
41574
41598
  handlerSize: 10,
41575
41599
  handlerStyle: {
41600
+ fill: null,
41576
41601
  lineWidth: 4,
41577
41602
  stroke: "#fff",
41578
41603
  outerBorder: {
@@ -42665,6 +42690,7 @@ let Brush$1 = class Brush extends AbstractComponent {
42665
42690
  this._outOfInteractiveRange(e) || ((this._activeDrawState || this._activeMoveState) && e.stopPropagation(), this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e));
42666
42691
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
42667
42692
  var _a;
42693
+ if (!this._activeDrawState && !this._activeMoveState) return;
42668
42694
  e.preventDefault();
42669
42695
  const {
42670
42696
  removeOnClick = !0
@@ -44253,12 +44279,12 @@ function parseCollectionMarkAttributes(itemNextAttrs) {
44253
44279
  let Element$1 = class Element {
44254
44280
  constructor(mark) {
44255
44281
  this.data = null, this.states = [], this.diffState = DiffState.enter, this.isReserved = !1, this.runtimeStatesEncoder = null, this.items = [], this.getStateAttrs = (stateName, nextStates) => {
44256
- var _a, _b, _c;
44282
+ var _a, _b, _c, _d;
44257
44283
  const isRuntimeState = !isNil$1(null === (_a = this.runtimeStatesEncoder) || void 0 === _a ? void 0 : _a[stateName]),
44258
- encoder = isRuntimeState ? this.runtimeStatesEncoder[stateName] : null === (_b = this.mark.getSpec().encode) || void 0 === _b ? void 0 : _b[stateName];
44284
+ encoder = isRuntimeState ? Object.assign(Object.assign({}, null === (_b = this.mark.getSpec().encode) || void 0 === _b ? void 0 : _b[stateName]), this.runtimeStatesEncoder[stateName]) : null === (_c = this.mark.getSpec().encode) || void 0 === _c ? void 0 : _c[stateName];
44259
44285
  if (!encoder) return {};
44260
44286
  if (isFunction$1(encoder)) return encoder(this.getDatum(), this, stateName, nextStates);
44261
- if (!isRuntimeState && (null === (_c = this.graphicItem.states) || void 0 === _c ? void 0 : _c[stateName])) return this.graphicItem.states[stateName];
44287
+ if (!isRuntimeState && (null === (_d = this.graphicItem.states) || void 0 === _d ? void 0 : _d[stateName])) return this.graphicItem.states[stateName];
44262
44288
  const stateItems = this.items.map(item => Object.assign({}, item, {
44263
44289
  nextAttrs: {}
44264
44290
  }));
@@ -46054,13 +46080,13 @@ function configureEnvironment(options) {
46054
46080
  class GlyphElement extends Element$1 {
46055
46081
  constructor(mark) {
46056
46082
  super(mark), this.getStateAttrs = (stateName, nextStates) => {
46057
- var _a, _b, _c;
46083
+ var _a, _b, _c, _d;
46058
46084
  const isRuntimeState = !isNil$1(null === (_a = this.runtimeStatesEncoder) || void 0 === _a ? void 0 : _a[stateName]),
46059
- encoder = isRuntimeState ? this.runtimeStatesEncoder[stateName] : null === (_b = this.mark.getSpec().encode) || void 0 === _b ? void 0 : _b[stateName],
46085
+ encoder = isRuntimeState ? Object.assign(Object.assign({}, null === (_b = this.mark.getSpec().encode) || void 0 === _b ? void 0 : _b[stateName]), this.runtimeStatesEncoder[stateName]) : null === (_c = this.mark.getSpec().encode) || void 0 === _c ? void 0 : _c[stateName],
46060
46086
  glyphStateAttributes = {};
46061
46087
  if (!encoder) return glyphStateAttributes;
46062
46088
  if (isFunction$1(encoder)) return glyphStateAttributes.attributes = encoder(this.getDatum(), this, stateName, nextStates), glyphStateAttributes;
46063
- if (!isRuntimeState && (null === (_c = this.graphicItem.glyphStates) || void 0 === _c ? void 0 : _c[stateName])) return this.graphicItem.glyphStates[stateName];
46089
+ if (!isRuntimeState && (null === (_d = this.graphicItem.glyphStates) || void 0 === _d ? void 0 : _d[stateName])) return this.graphicItem.glyphStates[stateName];
46064
46090
  if (encoder) {
46065
46091
  const item = this.items[0],
46066
46092
  targetItems = [Object.assign({}, item, {
@@ -47134,9 +47160,18 @@ class Mark extends GrammarBase {
47134
47160
  this.graphicIndex = markIndex;
47135
47161
  }
47136
47162
  update(spec) {
47137
- this._context = this.spec.context, this.isUpdated = !0, this.renderContext.progressive || (spec.animation && this.animate.updateConfig(spec.animation), this.animate.updateState(spec.animationState)), this.markType !== GrammarMarkType.group ? (isNil$1(spec.zIndex) || this.graphicItem.setAttribute("zIndex", spec.zIndex), isNil$1(spec.clip) || this.graphicItem.setAttribute("clip", spec.clip), isNil$1(spec.clipPath) || this.graphicItem.setAttribute("path", isArray$1(spec.clipPath) ? spec.clipPath : spec.clipPath(this.elements)), this.elementMap.forEach(element => {
47138
- element.updateGraphicItem();
47139
- })) : this.elementMap.forEach(element => {
47163
+ if (this._context = this.spec.context, this.isUpdated = !0, this.renderContext.progressive || (spec.animation && this.animate.updateConfig(spec.animation), this.animate.updateState(spec.animationState)), this.markType !== GrammarMarkType.group) {
47164
+ if (isNil$1(spec.zIndex) || this.graphicItem.setAttribute("zIndex", spec.zIndex), isNil$1(spec.clip) || this.graphicItem.setAttribute("clip", spec.clip), !isNil$1(spec.clipPath)) {
47165
+ const paths = isArray$1(spec.clipPath) ? spec.clipPath : spec.clipPath(this.elements);
47166
+ paths && paths.length ? this.graphicItem.setAttribute("path", paths) : this.graphicItem.setAttributes({
47167
+ path: paths,
47168
+ clip: !1
47169
+ });
47170
+ }
47171
+ this.elementMap.forEach(element => {
47172
+ element.updateGraphicItem();
47173
+ });
47174
+ } else this.elementMap.forEach(element => {
47140
47175
  element.updateGraphicItem();
47141
47176
  });
47142
47177
  }
@@ -47440,7 +47475,11 @@ let GroupMark$1 = class GroupMark extends Mark {
47440
47475
  getChannelsFromConfig(element) {
47441
47476
  const spec = this.spec,
47442
47477
  initAttrs = {};
47443
- return isNil$1(spec.clip) || (initAttrs.clip = spec.clip), isNil$1(spec.zIndex) || (initAttrs.zIndex = spec.zIndex), isNil$1(spec.clipPath) || (initAttrs.path = isFunction$1(spec.clipPath) ? spec.clipPath([element]) : spec.clipPath), isNil$1(spec.interactive) || (initAttrs.pickable = spec.interactive), initAttrs;
47478
+ if (isNil$1(spec.clip) || (initAttrs.clip = spec.clip), isNil$1(spec.zIndex) || (initAttrs.zIndex = spec.zIndex), !isNil$1(spec.clipPath)) {
47479
+ const paths = isFunction$1(spec.clipPath) ? spec.clipPath([element]) : spec.clipPath;
47480
+ paths && paths.length ? initAttrs.path = paths : (initAttrs.path = null, initAttrs.clip = !1);
47481
+ }
47482
+ return isNil$1(spec.interactive) || (initAttrs.pickable = spec.interactive), initAttrs;
47444
47483
  }
47445
47484
  evaluateGroupEncode(elements, groupEncode, parameters) {
47446
47485
  var _a;
@@ -66298,7 +66337,7 @@ const registerCanvasTooltipHandler = () => {
66298
66337
  registerComponentPlugin(CanvasTooltipHandler);
66299
66338
  };
66300
66339
 
66301
- const version = "1.11.3-alpha.0";
66340
+ const version = "1.11.3";
66302
66341
 
66303
66342
  const addVChartProperty = (data, op) => {
66304
66343
  const context = op.beforeCall();
@@ -85942,7 +85981,8 @@ const ascendingNodeBreadth = (a, b) => (null == a ? void 0 : a.y0) - (null == b
85942
85981
  center: center,
85943
85982
  start: left,
85944
85983
  end: right
85945
- };
85984
+ },
85985
+ linkClampe = clamper(0, 1);
85946
85986
  class SankeyLayout {
85947
85987
  constructor(options) {
85948
85988
  this._ascendingSourceBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.source], this._nodeMap[b.source]) || a.index - b.index, this._ascendingTargetBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.target], this._nodeMap[b.target]) || a.index - b.index, this.options = Object.assign({}, SankeyLayout.defaultOptions, options);
@@ -86253,7 +86293,7 @@ class SankeyLayout {
86253
86293
  const isStartGap = "start" === this.options.gapPosition,
86254
86294
  isMiddleGap = !isStartGap && "end" !== this.options.gapPosition,
86255
86295
  getNodeHeight = isNumber$1(this.options.nodeHeight) ? node => this.options.nodeHeight : isFunction$1(this.options.nodeHeight) ? this.options.nodeHeight : forceNodeHeight > 0 ? node => forceNodeHeight : node => Math.max(node.value * ky, minNodeHeight, 0),
86256
- getLinkHeight = isNumber$1(this.options.linkHeight) ? () => this.options.linkHeight : isFunction$1(this.options.linkHeight) ? this.options.linkHeight : (link, sourceNode, sourceNodeHeight) => Math.max(sourceNode.value ? sourceNodeHeight * link.value / sourceNode.value : 0, minLinkHeight, 0);
86296
+ getLinkHeight = isNumber$1(this.options.linkHeight) ? () => this.options.linkHeight : isFunction$1(this.options.linkHeight) ? this.options.linkHeight : (link, sourceNode, sourceNodeHeight) => Math.max(sourceNode.value ? sourceNodeHeight * linkClampe(link.value / sourceNode.value) : 0, minLinkHeight, 0);
86257
86297
  for (let i = 0, columnCount = columns.length; i < columnCount; i++) {
86258
86298
  const nodes = columns[i];
86259
86299
  if (!nodes || !nodes.length) continue;
@@ -86281,7 +86321,7 @@ class SankeyLayout {
86281
86321
  }
86282
86322
  }
86283
86323
  } else if (deltaY < 0 && nodes.length > 1 && (deltaY /= nodes.length - 1, gapY + deltaY > 0)) {
86284
- gapY += deltaY;
86324
+ gapY += deltaY, this._gapY = Math.min(gapY);
86285
86325
  for (let j = 1, len = nodes.length; j < len; ++j) {
86286
86326
  const node = nodes[j];
86287
86327
  node.y0 += deltaY * j, node.y1 += deltaY * j;
@@ -86379,15 +86419,17 @@ class SankeyLayout {
86379
86419
  computeLinkBreadthsNoOverlap(nodes) {
86380
86420
  for (let i = 0, len = nodes.length; i < len; i++) {
86381
86421
  const node = nodes[i];
86382
- let y0 = node.y0;
86422
+ let y0 = node.y0,
86423
+ reachBottom = !1;
86383
86424
  for (let j = 0, linkLen = node.sourceLinks.length; j < linkLen; j++) {
86384
86425
  const link = node.sourceLinks[j];
86385
- link.y0 = y0 + link.thickness / 2, link.x0 = node.x1, y0 += link.thickness;
86426
+ reachBottom || (link.y0 = y0 + link.thickness / 2), link.x0 = node.x1, y0 + link.thickness > node.y1 || reachBottom ? (link.y0 = node.y1 - link.thickness / 2, reachBottom = !0) : y0 += link.thickness;
86386
86427
  }
86387
86428
  let y1 = node.y0;
86429
+ reachBottom = !1;
86388
86430
  for (let j = 0, linkLen = node.targetLinks.length; j < linkLen; j++) {
86389
86431
  const link = node.targetLinks[j];
86390
- link.y1 = y1 + link.thickness / 2, link.x1 = node.x0, y1 += link.thickness;
86432
+ reachBottom || (link.y1 = y1 + link.thickness / 2), link.x1 = node.x0, y1 + link.thickness > node.y1 || reachBottom ? (link.y1 = node.y1 - link.thickness / 2, reachBottom = !0) : y1 += link.thickness;
86391
86433
  }
86392
86434
  }
86393
86435
  }
@@ -92039,14 +92081,24 @@ class SankeyChart extends BaseChart {
92039
92081
  r.getSeries().forEach(s => {
92040
92082
  var _a, _b;
92041
92083
  let activeNodeOrLink = null;
92042
- s.getMarks().forEach(m => {
92084
+ s.getMarksWithoutRoot().forEach(m => {
92085
+ if (m.type === 'text') {
92086
+ return;
92087
+ }
92043
92088
  let pickElement = null;
92044
92089
  const mark = m.getProduct();
92045
92090
  if (!mark) {
92046
92091
  return;
92047
92092
  }
92048
92093
  if (!filter || (isFunction$1(filter) && filter(s, m))) {
92049
- pickElement = mark.elements.find((e) => keys.every(k => { var _a, _b; return activeDatum[k] == ((_b = (_a = e.getDatum()) === null || _a === void 0 ? void 0 : _a.datum) === null || _b === void 0 ? void 0 : _b[k]); }));
92094
+ pickElement = mark.elements.find((e) => keys.every(k => {
92095
+ var _a;
92096
+ let datum = (_a = e.getDatum()) === null || _a === void 0 ? void 0 : _a.datum;
92097
+ if (isArray$1(datum)) {
92098
+ datum = datum[0];
92099
+ }
92100
+ return activeDatum[k] == (datum === null || datum === void 0 ? void 0 : datum[k]);
92101
+ }));
92050
92102
  }
92051
92103
  if (pickElement) {
92052
92104
  hasPick = true;