@visactor/vseed 0.5.1 → 0.5.2

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/umd/index.js CHANGED
@@ -5799,48 +5799,6 @@ self.R = R;
5799
5799
  const effect = effects[effects.length - 1] ?? EFFECT_NONE;
5800
5800
  return effect !== EFFECT_NONE;
5801
5801
  };
5802
- const atmospherePoint = (effect)=>{
5803
- if (effect === EFFECT_NONE) return {};
5804
- if ('breath' === effect) return {
5805
- channel: {
5806
- scaleX: {
5807
- from: 0.8,
5808
- to: 1.2
5809
- },
5810
- scaleY: {
5811
- from: 0.8,
5812
- to: 1.2
5813
- }
5814
- }
5815
- };
5816
- if ('reveal' === effect) return {
5817
- channel: {
5818
- fillOpacity: {
5819
- from: 0.6,
5820
- to: 1
5821
- },
5822
- strokeOpacity: {
5823
- from: 0.6,
5824
- to: 1
5825
- }
5826
- }
5827
- };
5828
- return {
5829
- channel: {
5830
- outerBorder: {
5831
- from: {
5832
- distance: 0,
5833
- strokeOpacity: 1
5834
- },
5835
- to: (...args)=>({
5836
- distance: 16,
5837
- strokeOpacity: 1e-8,
5838
- stroke: args[1]?.attribute?.fill
5839
- })
5840
- }
5841
- }
5842
- };
5843
- };
5844
5802
  class Generator {
5845
5803
  static GenAutoIncrementId() {
5846
5804
  return Generator.auto_increment_id++;
@@ -9068,7 +9026,7 @@ self.R = R;
9068
9026
  if (loopEffect === VScreenAnimationType.highLight && loop) {
9069
9027
  const groupDuration = 0.7;
9070
9028
  const stopDuration = 0.85;
9071
- loopDuration = groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration;
9029
+ loopDuration = loop.duration ?? groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration;
9072
9030
  result.push(...groupHighLightBar(startTime, loop, loopDuration, interval, atmosphereDuration, barMotion_isHorizontalBar(chartType), spec));
9073
9031
  } else if (loop) result.push({
9074
9032
  ...getLoopResult(loopEffect, chartType, spec),
@@ -9112,6 +9070,57 @@ self.R = R;
9112
9070
  }
9113
9071
  };
9114
9072
  };
9073
+ const pointAtmosphere_EFFECT_NONE = VScreenAnimationType.none;
9074
+ const atmospherePoint = (effect)=>{
9075
+ if (effect === pointAtmosphere_EFFECT_NONE) return {};
9076
+ if ('breath' === effect) return {
9077
+ channel: {
9078
+ scaleX: {
9079
+ from: 0.8,
9080
+ to: 2
9081
+ },
9082
+ scaleY: {
9083
+ from: 0.8,
9084
+ to: 2
9085
+ }
9086
+ }
9087
+ };
9088
+ if ('reveal' === effect) return {
9089
+ channel: {
9090
+ fillOpacity: {
9091
+ from: 0.6,
9092
+ to: 1
9093
+ },
9094
+ strokeOpacity: {
9095
+ from: 0.6,
9096
+ to: 1
9097
+ }
9098
+ }
9099
+ };
9100
+ return {
9101
+ channel: {
9102
+ outerBorder: {
9103
+ from: {
9104
+ distance: 0,
9105
+ strokeOpacity: 1
9106
+ },
9107
+ to: (...args)=>({
9108
+ distance: 16,
9109
+ strokeOpacity: 1e-8,
9110
+ stroke: args[1]?.attribute?.fill
9111
+ })
9112
+ }
9113
+ },
9114
+ custom: (ratio, from, to, out, graphic)=>{
9115
+ graphic.attribute.strokeOpacity = ratio * (to.strokeOpacity - from.strokeOpacity) + from.strokeOpacity;
9116
+ graphic.attribute.outerBorder = {
9117
+ distance: ratio * (to.outerBorder.distance - from.outerBorder.distance) + from.outerBorder.distance,
9118
+ strokeOpacity: ratio * (to.outerBorder.strokeOpacity - from.outerBorder.strokeOpacity) + from.outerBorder.strokeOpacity,
9119
+ stroke: to.outerBorder.stroke
9120
+ };
9121
+ }
9122
+ };
9123
+ };
9115
9124
  const growthTopLine = ()=>({
9116
9125
  type: 'growPointsYIn',
9117
9126
  options: {
@@ -13536,20 +13545,45 @@ self.R = R;
13536
13545
  if (hasNegativePart) return reverseStackCornerRadius(cornerRadius);
13537
13546
  return 0;
13538
13547
  };
13548
+ const createStackCornerRadius = (cornerRadius)=>(_, datum)=>{
13549
+ const stackRangeCornerRadius = getStackRangeCornerRadius(cornerRadius, datum);
13550
+ if (void 0 !== stackRangeCornerRadius) return stackRangeCornerRadius;
13551
+ const value = datum?.[datum?.[FoldMeasureId]];
13552
+ if (value > 0) return cornerRadius;
13553
+ if (value < 0) return reverseStackCornerRadius(cornerRadius);
13554
+ return 0;
13555
+ };
13556
+ const hasMoveInAnimation = (animation)=>{
13557
+ if (!animation) return false;
13558
+ if (Array.isArray(animation)) return animation.some(hasMoveInAnimation);
13559
+ if ('object' != typeof animation) return false;
13560
+ const animationRecord = animation;
13561
+ return 'moveIn' === animationRecord.type || Object.values(animationRecord).some(hasMoveInAnimation);
13562
+ };
13563
+ const hasBarMoveInAnimation = (spec)=>[
13564
+ spec.animationAppear,
13565
+ spec.animationNormal,
13566
+ spec.animationEnter,
13567
+ spec.animationUpdate
13568
+ ].some(hasMoveInAnimation);
13539
13569
  const stackCornerRadius_stackCornerRadius = (spec, context)=>{
13540
13570
  const { advancedVSeed, vseed } = context;
13541
13571
  const { chartType } = vseed;
13542
13572
  const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius;
13543
13573
  if ('dualAxis' === chartType && 'bar' !== spec.type) return spec;
13574
+ const stackCornerRadiusCallback = createStackCornerRadius(stackCornerRadius);
13575
+ if (!hasBarMoveInAnimation(spec)) return {
13576
+ ...spec,
13577
+ stackCornerRadius: stackCornerRadiusCallback
13578
+ };
13544
13579
  return {
13545
13580
  ...spec,
13546
- stackCornerRadius: (_, datum)=>{
13547
- const stackRangeCornerRadius = getStackRangeCornerRadius(stackCornerRadius, datum);
13548
- if (void 0 !== stackRangeCornerRadius) return stackRangeCornerRadius;
13549
- const value = datum?.[datum?.[FoldMeasureId]];
13550
- if (value > 0) return stackCornerRadius;
13551
- if (value < 0) return reverseStackCornerRadius(stackCornerRadius);
13552
- return 0;
13581
+ bar: {
13582
+ ...spec.bar,
13583
+ style: {
13584
+ ...spec.bar?.style,
13585
+ cornerRadius: stackCornerRadiusCallback
13586
+ }
13553
13587
  }
13554
13588
  };
13555
13589
  };