@visactor/vseed 0.5.1 → 0.5.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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.d.ts +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/radar.d.ts +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.d.ts +1 -60
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js +2 -44
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.d.ts +65 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.js +56 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js +18 -39
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.d.ts +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js +50 -0
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js.map +1 -0
- package/dist/esm/theme/tokenTheme.d.ts +2 -0
- package/dist/esm/theme/tokenTheme.js +2 -0
- package/dist/esm/theme/tokenTheme.js.map +1 -1
- package/dist/umd/index.js +86 -50
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ const barLoop = (config, ignoreFirstNormal, chartType, spec)=>{
|
|
|
39
39
|
if (loopEffect === VScreenAnimationType.highLight && loop) {
|
|
40
40
|
const groupDuration = 0.7;
|
|
41
41
|
const stopDuration = 0.85;
|
|
42
|
-
loopDuration = groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration;
|
|
42
|
+
loopDuration = loop.duration ?? groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration;
|
|
43
43
|
result.push(...groupHighLightBar(startTime, loop, loopDuration, interval, atmosphereDuration, isHorizontalBar(chartType), spec));
|
|
44
44
|
} else if (loop) result.push({
|
|
45
45
|
...getLoopResult(loopEffect, chartType, spec),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/animation/bar.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/animation/bar.ts"],"sourcesContent":["import { StreamLight } from '@visactor/vchart'\nimport type { BarLikeAppearConfig, BarLikeLoopConfig, BarLikeUpdateConfig } from './types'\nimport { VScreenAnimationType } from './types'\nimport { allowAnimation, getPrimaryEffect, toMs } from './utils'\nimport {\n fadeInBar,\n getGroupCountFromSpec,\n getLoopResult,\n groupHighLightBar,\n growBar,\n isHorizontalBar,\n moveInBar,\n moveOutBar,\n transform2VChartColor,\n} from './utils/bar'\n\n/**\n * 柱图/条形图 入场动画\n * 动画类型:\n * 1. growth: 生长动画\n * 效果:横向柱使用宽度增长, 纵向柱使用高度增长。\n * 编排逻辑:仅作用于 bar mark, 使用 appear 的 easing 和 duration。\n * 2. load: 加载动画\n * 效果:使用逐个淡入, 让柱子按图元顺序出现。\n * 编排逻辑:仅作用于 bar mark, 使用 appear 的 easing 和 duration。\n * 3. 其他: 默认入场动画\n * 效果:不指定额外动画 type, 交给 VChart 默认入场补间。\n * 编排逻辑:仅保留 easing 和 duration。\n */\nexport const barAppear = (config: BarLikeAppearConfig | undefined, chartType: string) => {\n if (!allowAnimation(config)) return false\n const effect = getPrimaryEffect(config)\n const configByType =\n effect === VScreenAnimationType.growth\n ? growBar(chartType)\n : effect === VScreenAnimationType.load\n ? fadeInBar()\n : {}\n return { bar: { ...configByType, easing: config?.ease, duration: toMs(config?.duration ?? 1) } }\n}\n\n/**\n * 柱图/条形图 更新动画\n * 动画类型:\n * 1. moveIn: 移入动画\n * 效果:update 阶段沿柱图方向从画布外移入。\n * 编排逻辑:复用移入方向, 但不再补随机 dataKey, 只作用于 bar mark。\n * 2. 其他: 默认更新动画\n * 效果:使用 VChart 默认更新补间。\n * 编排逻辑:只保留 easing 和 duration, 不影响轴、标签等其他组件。\n */\nexport const barUpdate = (config: BarLikeUpdateConfig | undefined, chartType: string, spec?: any) => {\n if (!allowAnimation(config)) return false\n const effect = getPrimaryEffect(config)\n const configByType = effect === VScreenAnimationType.moveIn ? moveInBar(chartType, spec, true) : {}\n return { bar: { ...configByType, easing: config?.ease, duration: toMs(config?.duration ?? 1) } }\n}\n\n/**\n * 柱图/条形图 循环动画\n * 动画类型:\n * 1. highLight: 分组高亮动画\n * 效果:按类目分组依次切换高亮填充和描边。\n * 编排逻辑:startTime = appear 存在 ? interval : 0, loopDuration = groupDuration * groupCount + stopDuration, 一轮结束后等待 interval。\n * 2. growth/moveIn/load: mark 循环动画\n * 效果:复用对应的柱图 mark 动画。\n * 编排逻辑:先执行 loopDuration, 再等待 interval + atmosphereDuration 后重复。\n * 3. atmosphere: 流光氛围动画\n * 效果:使用 StreamLight 在柱子上形成流光。\n * 编排逻辑:延迟 loopDuration 后启动, 持续 atmosphereDuration, 一轮结束后等待 interval。\n */\nexport const barLoop = (\n config: BarLikeLoopConfig | undefined,\n ignoreFirstNormal: boolean,\n chartType: string,\n spec?: any,\n) => {\n if (!config?.enable) return false\n const interval = config.interval ?? 0\n const startTime = ignoreFirstNormal ? toMs(interval) : 0\n const loop = config.loop\n const atmosphere = config.atmosphere\n const loopEffect = getPrimaryEffect(loop)\n const result: any[] = []\n let loopDuration = loopEffect === VScreenAnimationType.none ? 0 : 1\n const atmosphereDuration = loopEffect === VScreenAnimationType.none ? 2 : 1\n\n if (loopEffect === VScreenAnimationType.highLight && loop) {\n const groupDuration = 0.7\n const stopDuration = 0.85\n loopDuration = groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration\n result.push(\n ...groupHighLightBar(\n startTime,\n loop,\n loopDuration,\n interval,\n atmosphereDuration,\n isHorizontalBar(chartType),\n spec,\n ),\n )\n } else if (loop) {\n result.push({\n ...getLoopResult(loopEffect, chartType, spec),\n startTime,\n easing: loop.ease,\n duration: toMs(loopDuration),\n delayAfter: toMs(interval + atmosphereDuration),\n loop: true,\n controlOptions: { immediatelyApply: false },\n })\n }\n\n if (atmosphere?.ease || atmosphere?.color) {\n result.push({\n loop: true,\n startTime,\n delay: toMs(loopDuration),\n delayAfter: toMs(interval),\n duration: toMs(atmosphereDuration),\n easing: atmosphere.ease,\n custom: StreamLight,\n customParameters: {\n isHorizontal: isHorizontalBar(chartType),\n attribute: {\n fill: transform2VChartColor(atmosphere.color),\n blur: 0,\n shadowColor: 'rgba(0,0,0,0)',\n },\n },\n })\n }\n\n return result.length > 0 ? { bar: result } : false\n}\n\n/**\n * 柱图/条形图 离场动画\n * 动画类型:\n * 1. moveIn: 反向移出动画\n * 效果:沿柱图进入方向反向移出画布。\n * 编排逻辑:只有 update 效果为 moveIn 时才补充 moveOut。\n * 2. 其他: 默认离场动画\n * 效果:不配置自定义 exit。\n * 编排逻辑:返回空配置, 由 VChart 默认行为处理。\n */\nexport const barExit = (config: BarLikeUpdateConfig | undefined, chartType: string) => {\n if (!allowAnimation(config)) return false\n if (getPrimaryEffect(config) !== VScreenAnimationType.moveIn) return {}\n return { bar: { ...moveOutBar(chartType), duration: 1000 } }\n}\n"],"names":["barAppear","config","chartType","allowAnimation","effect","getPrimaryEffect","configByType","VScreenAnimationType","growBar","fadeInBar","toMs","barUpdate","spec","moveInBar","barLoop","ignoreFirstNormal","interval","startTime","loop","atmosphere","loopEffect","result","loopDuration","atmosphereDuration","groupDuration","stopDuration","getGroupCountFromSpec","groupHighLightBar","isHorizontalBar","getLoopResult","StreamLight","transform2VChartColor","barExit","moveOutBar"],"mappings":";;;;AA6BO,MAAMA,YAAY,CAACC,QAAyCC;IACjE,IAAI,CAACC,eAAeF,SAAS,OAAO;IACpC,MAAMG,SAASC,iBAAiBJ;IAChC,MAAMK,eACJF,WAAWG,qBAAqB,MAAM,GAClCC,QAAQN,aACRE,WAAWG,qBAAqB,IAAI,GAClCE,cACA,CAAC;IACT,OAAO;QAAE,KAAK;YAAE,GAAGH,YAAY;YAAE,QAAQL,QAAQ;YAAM,UAAUS,KAAKT,QAAQ,YAAY;QAAG;IAAE;AACjG;AAYO,MAAMU,YAAY,CAACV,QAAyCC,WAAmBU;IACpF,IAAI,CAACT,eAAeF,SAAS,OAAO;IACpC,MAAMG,SAASC,iBAAiBJ;IAChC,MAAMK,eAAeF,WAAWG,qBAAqB,MAAM,GAAGM,UAAUX,WAAWU,MAAM,QAAQ,CAAC;IAClG,OAAO;QAAE,KAAK;YAAE,GAAGN,YAAY;YAAE,QAAQL,QAAQ;YAAM,UAAUS,KAAKT,QAAQ,YAAY;QAAG;IAAE;AACjG;AAeO,MAAMa,UAAU,CACrBb,QACAc,mBACAb,WACAU;IAEA,IAAI,CAACX,QAAQ,QAAQ,OAAO;IAC5B,MAAMe,WAAWf,OAAO,QAAQ,IAAI;IACpC,MAAMgB,YAAYF,oBAAoBL,KAAKM,YAAY;IACvD,MAAME,OAAOjB,OAAO,IAAI;IACxB,MAAMkB,aAAalB,OAAO,UAAU;IACpC,MAAMmB,aAAaf,iBAAiBa;IACpC,MAAMG,SAAgB,EAAE;IACxB,IAAIC,eAAeF,eAAeb,qBAAqB,IAAI,GAAG,IAAI;IAClE,MAAMgB,qBAAqBH,eAAeb,qBAAqB,IAAI,GAAG,IAAI;IAE1E,IAAIa,eAAeb,qBAAqB,SAAS,IAAIW,MAAM;QACzD,MAAMM,gBAAgB;QACtB,MAAMC,eAAe;QACrBH,
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/bar.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/animation/bar.ts"],"sourcesContent":["import { StreamLight } from '@visactor/vchart'\nimport type { BarLikeAppearConfig, BarLikeLoopConfig, BarLikeUpdateConfig } from './types'\nimport { VScreenAnimationType } from './types'\nimport { allowAnimation, getPrimaryEffect, toMs } from './utils'\nimport {\n fadeInBar,\n getGroupCountFromSpec,\n getLoopResult,\n groupHighLightBar,\n growBar,\n isHorizontalBar,\n moveInBar,\n moveOutBar,\n transform2VChartColor,\n} from './utils/bar'\n\n/**\n * 柱图/条形图 入场动画\n * 动画类型:\n * 1. growth: 生长动画\n * 效果:横向柱使用宽度增长, 纵向柱使用高度增长。\n * 编排逻辑:仅作用于 bar mark, 使用 appear 的 easing 和 duration。\n * 2. load: 加载动画\n * 效果:使用逐个淡入, 让柱子按图元顺序出现。\n * 编排逻辑:仅作用于 bar mark, 使用 appear 的 easing 和 duration。\n * 3. 其他: 默认入场动画\n * 效果:不指定额外动画 type, 交给 VChart 默认入场补间。\n * 编排逻辑:仅保留 easing 和 duration。\n */\nexport const barAppear = (config: BarLikeAppearConfig | undefined, chartType: string) => {\n if (!allowAnimation(config)) return false\n const effect = getPrimaryEffect(config)\n const configByType =\n effect === VScreenAnimationType.growth\n ? growBar(chartType)\n : effect === VScreenAnimationType.load\n ? fadeInBar()\n : {}\n return { bar: { ...configByType, easing: config?.ease, duration: toMs(config?.duration ?? 1) } }\n}\n\n/**\n * 柱图/条形图 更新动画\n * 动画类型:\n * 1. moveIn: 移入动画\n * 效果:update 阶段沿柱图方向从画布外移入。\n * 编排逻辑:复用移入方向, 但不再补随机 dataKey, 只作用于 bar mark。\n * 2. 其他: 默认更新动画\n * 效果:使用 VChart 默认更新补间。\n * 编排逻辑:只保留 easing 和 duration, 不影响轴、标签等其他组件。\n */\nexport const barUpdate = (config: BarLikeUpdateConfig | undefined, chartType: string, spec?: any) => {\n if (!allowAnimation(config)) return false\n const effect = getPrimaryEffect(config)\n const configByType = effect === VScreenAnimationType.moveIn ? moveInBar(chartType, spec, true) : {}\n return { bar: { ...configByType, easing: config?.ease, duration: toMs(config?.duration ?? 1) } }\n}\n\n/**\n * 柱图/条形图 循环动画\n * 动画类型:\n * 1. highLight: 分组高亮动画\n * 效果:按类目分组依次切换高亮填充和描边。\n * 编排逻辑:startTime = appear 存在 ? interval : 0, loopDuration = groupDuration * groupCount + stopDuration, 一轮结束后等待 interval。\n * 2. growth/moveIn/load: mark 循环动画\n * 效果:复用对应的柱图 mark 动画。\n * 编排逻辑:先执行 loopDuration, 再等待 interval + atmosphereDuration 后重复。\n * 3. atmosphere: 流光氛围动画\n * 效果:使用 StreamLight 在柱子上形成流光。\n * 编排逻辑:延迟 loopDuration 后启动, 持续 atmosphereDuration, 一轮结束后等待 interval。\n */\nexport const barLoop = (\n config: BarLikeLoopConfig | undefined,\n ignoreFirstNormal: boolean,\n chartType: string,\n spec?: any,\n) => {\n if (!config?.enable) return false\n const interval = config.interval ?? 0\n const startTime = ignoreFirstNormal ? toMs(interval) : 0\n const loop = config.loop\n const atmosphere = config.atmosphere\n const loopEffect = getPrimaryEffect(loop)\n const result: any[] = []\n let loopDuration = loopEffect === VScreenAnimationType.none ? 0 : 1\n const atmosphereDuration = loopEffect === VScreenAnimationType.none ? 2 : 1\n\n if (loopEffect === VScreenAnimationType.highLight && loop) {\n const groupDuration = 0.7\n const stopDuration = 0.85\n loopDuration = loop.duration ?? groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration\n result.push(\n ...groupHighLightBar(\n startTime,\n loop,\n loopDuration,\n interval,\n atmosphereDuration,\n isHorizontalBar(chartType),\n spec,\n ),\n )\n } else if (loop) {\n result.push({\n ...getLoopResult(loopEffect, chartType, spec),\n startTime,\n easing: loop.ease,\n duration: toMs(loopDuration),\n delayAfter: toMs(interval + atmosphereDuration),\n loop: true,\n controlOptions: { immediatelyApply: false },\n })\n }\n\n if (atmosphere?.ease || atmosphere?.color) {\n result.push({\n loop: true,\n startTime,\n delay: toMs(loopDuration),\n delayAfter: toMs(interval),\n duration: toMs(atmosphereDuration),\n easing: atmosphere.ease,\n custom: StreamLight,\n customParameters: {\n isHorizontal: isHorizontalBar(chartType),\n attribute: {\n fill: transform2VChartColor(atmosphere.color),\n blur: 0,\n shadowColor: 'rgba(0,0,0,0)',\n },\n },\n })\n }\n\n return result.length > 0 ? { bar: result } : false\n}\n\n/**\n * 柱图/条形图 离场动画\n * 动画类型:\n * 1. moveIn: 反向移出动画\n * 效果:沿柱图进入方向反向移出画布。\n * 编排逻辑:只有 update 效果为 moveIn 时才补充 moveOut。\n * 2. 其他: 默认离场动画\n * 效果:不配置自定义 exit。\n * 编排逻辑:返回空配置, 由 VChart 默认行为处理。\n */\nexport const barExit = (config: BarLikeUpdateConfig | undefined, chartType: string) => {\n if (!allowAnimation(config)) return false\n if (getPrimaryEffect(config) !== VScreenAnimationType.moveIn) return {}\n return { bar: { ...moveOutBar(chartType), duration: 1000 } }\n}\n"],"names":["barAppear","config","chartType","allowAnimation","effect","getPrimaryEffect","configByType","VScreenAnimationType","growBar","fadeInBar","toMs","barUpdate","spec","moveInBar","barLoop","ignoreFirstNormal","interval","startTime","loop","atmosphere","loopEffect","result","loopDuration","atmosphereDuration","groupDuration","stopDuration","getGroupCountFromSpec","groupHighLightBar","isHorizontalBar","getLoopResult","StreamLight","transform2VChartColor","barExit","moveOutBar"],"mappings":";;;;AA6BO,MAAMA,YAAY,CAACC,QAAyCC;IACjE,IAAI,CAACC,eAAeF,SAAS,OAAO;IACpC,MAAMG,SAASC,iBAAiBJ;IAChC,MAAMK,eACJF,WAAWG,qBAAqB,MAAM,GAClCC,QAAQN,aACRE,WAAWG,qBAAqB,IAAI,GAClCE,cACA,CAAC;IACT,OAAO;QAAE,KAAK;YAAE,GAAGH,YAAY;YAAE,QAAQL,QAAQ;YAAM,UAAUS,KAAKT,QAAQ,YAAY;QAAG;IAAE;AACjG;AAYO,MAAMU,YAAY,CAACV,QAAyCC,WAAmBU;IACpF,IAAI,CAACT,eAAeF,SAAS,OAAO;IACpC,MAAMG,SAASC,iBAAiBJ;IAChC,MAAMK,eAAeF,WAAWG,qBAAqB,MAAM,GAAGM,UAAUX,WAAWU,MAAM,QAAQ,CAAC;IAClG,OAAO;QAAE,KAAK;YAAE,GAAGN,YAAY;YAAE,QAAQL,QAAQ;YAAM,UAAUS,KAAKT,QAAQ,YAAY;QAAG;IAAE;AACjG;AAeO,MAAMa,UAAU,CACrBb,QACAc,mBACAb,WACAU;IAEA,IAAI,CAACX,QAAQ,QAAQ,OAAO;IAC5B,MAAMe,WAAWf,OAAO,QAAQ,IAAI;IACpC,MAAMgB,YAAYF,oBAAoBL,KAAKM,YAAY;IACvD,MAAME,OAAOjB,OAAO,IAAI;IACxB,MAAMkB,aAAalB,OAAO,UAAU;IACpC,MAAMmB,aAAaf,iBAAiBa;IACpC,MAAMG,SAAgB,EAAE;IACxB,IAAIC,eAAeF,eAAeb,qBAAqB,IAAI,GAAG,IAAI;IAClE,MAAMgB,qBAAqBH,eAAeb,qBAAqB,IAAI,GAAG,IAAI;IAE1E,IAAIa,eAAeb,qBAAqB,SAAS,IAAIW,MAAM;QACzD,MAAMM,gBAAgB;QACtB,MAAMC,eAAe;QACrBH,eAAeJ,KAAK,QAAQ,IAAIM,gBAAgBE,sBAAsBd,MAAM,UAAU,GAAGa;QACzFJ,OAAO,IAAI,IACNM,kBACDV,WACAC,MACAI,cACAN,UACAO,oBACAK,gBAAgB1B,YAChBU;IAGN,OAAO,IAAIM,MACTG,OAAO,IAAI,CAAC;QACV,GAAGQ,cAAcT,YAAYlB,WAAWU,KAAK;QAC7CK;QACA,QAAQC,KAAK,IAAI;QACjB,UAAUR,KAAKY;QACf,YAAYZ,KAAKM,WAAWO;QAC5B,MAAM;QACN,gBAAgB;YAAE,kBAAkB;QAAM;IAC5C;IAGF,IAAIJ,YAAY,QAAQA,YAAY,OAClCE,OAAO,IAAI,CAAC;QACV,MAAM;QACNJ;QACA,OAAOP,KAAKY;QACZ,YAAYZ,KAAKM;QACjB,UAAUN,KAAKa;QACf,QAAQJ,WAAW,IAAI;QACvB,QAAQW;QACR,kBAAkB;YAChB,cAAcF,gBAAgB1B;YAC9B,WAAW;gBACT,MAAM6B,sBAAsBZ,WAAW,KAAK;gBAC5C,MAAM;gBACN,aAAa;YACf;QACF;IACF;IAGF,OAAOE,OAAO,MAAM,GAAG,IAAI;QAAE,KAAKA;IAAO,IAAI;AAC/C;AAYO,MAAMW,UAAU,CAAC/B,QAAyCC;IAC/D,IAAI,CAACC,eAAeF,SAAS,OAAO;IACpC,IAAII,iBAAiBJ,YAAYM,qBAAqB,MAAM,EAAE,OAAO,CAAC;IACtE,OAAO;QAAE,KAAK;YAAE,GAAG0B,WAAW/B,UAAU;YAAE,UAAU;QAAK;IAAE;AAC7D"}
|
|
@@ -142,6 +142,7 @@ export declare const lineOrAreaLoop: (config: LineAreaLoopConfig | undefined, ig
|
|
|
142
142
|
})[];
|
|
143
143
|
point: ({
|
|
144
144
|
channel?: undefined;
|
|
145
|
+
custom?: undefined;
|
|
145
146
|
loop: boolean;
|
|
146
147
|
startTime: number;
|
|
147
148
|
delayAfter: number;
|
|
@@ -161,6 +162,7 @@ export declare const lineOrAreaLoop: (config: LineAreaLoopConfig | undefined, ig
|
|
|
161
162
|
strokeOpacity?: undefined;
|
|
162
163
|
outerBorder?: undefined;
|
|
163
164
|
};
|
|
165
|
+
custom?: undefined;
|
|
164
166
|
loop: boolean;
|
|
165
167
|
startTime: number;
|
|
166
168
|
delayAfter: number;
|
|
@@ -180,6 +182,7 @@ export declare const lineOrAreaLoop: (config: LineAreaLoopConfig | undefined, ig
|
|
|
180
182
|
scaleY?: undefined;
|
|
181
183
|
outerBorder?: undefined;
|
|
182
184
|
};
|
|
185
|
+
custom?: undefined;
|
|
183
186
|
loop: boolean;
|
|
184
187
|
startTime: number;
|
|
185
188
|
delayAfter: number;
|
|
@@ -203,6 +206,7 @@ export declare const lineOrAreaLoop: (config: LineAreaLoopConfig | undefined, ig
|
|
|
203
206
|
fillOpacity?: undefined;
|
|
204
207
|
strokeOpacity?: undefined;
|
|
205
208
|
};
|
|
209
|
+
custom: (ratio: number, from: any, to: any, out: any, graphic: any) => void;
|
|
206
210
|
loop: boolean;
|
|
207
211
|
startTime: number;
|
|
208
212
|
delayAfter: number;
|
|
@@ -30,6 +30,7 @@ export declare const radarLoop: (config: RadarLoopConfig | undefined, ignoreFirs
|
|
|
30
30
|
immediatelyApply: boolean;
|
|
31
31
|
};
|
|
32
32
|
channel?: undefined;
|
|
33
|
+
custom?: undefined;
|
|
33
34
|
loop: boolean;
|
|
34
35
|
startTime: number;
|
|
35
36
|
delayAfter: number;
|
|
@@ -52,6 +53,7 @@ export declare const radarLoop: (config: RadarLoopConfig | undefined, ignoreFirs
|
|
|
52
53
|
strokeOpacity?: undefined;
|
|
53
54
|
outerBorder?: undefined;
|
|
54
55
|
};
|
|
56
|
+
custom?: undefined;
|
|
55
57
|
loop: boolean;
|
|
56
58
|
startTime: number;
|
|
57
59
|
delayAfter: number;
|
|
@@ -74,6 +76,7 @@ export declare const radarLoop: (config: RadarLoopConfig | undefined, ignoreFirs
|
|
|
74
76
|
scaleY?: undefined;
|
|
75
77
|
outerBorder?: undefined;
|
|
76
78
|
};
|
|
79
|
+
custom?: undefined;
|
|
77
80
|
loop: boolean;
|
|
78
81
|
startTime: number;
|
|
79
82
|
delayAfter: number;
|
|
@@ -100,6 +103,7 @@ export declare const radarLoop: (config: RadarLoopConfig | undefined, ignoreFirs
|
|
|
100
103
|
fillOpacity?: undefined;
|
|
101
104
|
strokeOpacity?: undefined;
|
|
102
105
|
};
|
|
106
|
+
custom: (ratio: number, from: any, to: any, out: any, graphic: any) => void;
|
|
103
107
|
loop: boolean;
|
|
104
108
|
startTime: number;
|
|
105
109
|
delayAfter: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AnimationEffect, type AnimationEffectConfig } from '../types';
|
|
2
|
+
export { atmospherePoint, getFinalAttribute } from './pointAtmosphere';
|
|
2
3
|
export declare const EFFECT_NONE: "none";
|
|
3
4
|
/**
|
|
4
5
|
* @description 将秒转换为 VChart 动画使用的毫秒。
|
|
@@ -24,63 +25,3 @@ export declare const allowAnimation: (config?: AnimationEffectConfig) => boolean
|
|
|
24
25
|
* @returns 是否允许执行折线/面积动画。
|
|
25
26
|
*/
|
|
26
27
|
export declare const allowLineOrAreaAnimation: (config?: AnimationEffectConfig) => boolean;
|
|
27
|
-
/**
|
|
28
|
-
* @description 获取图元最终属性,优先读取动画后的 finalAttribute。
|
|
29
|
-
* @param mark VChart 图元对象。
|
|
30
|
-
* @returns 图元最终属性。
|
|
31
|
-
*/
|
|
32
|
-
export declare const getFinalAttribute: (mark: any) => Record<string, any>;
|
|
33
|
-
/**
|
|
34
|
-
* @description 生成点图元氛围动画配置,复用于折线、面积、散点和雷达图。
|
|
35
|
-
* @param effect 氛围动画效果。
|
|
36
|
-
* @returns 点图元氛围动画配置。
|
|
37
|
-
*/
|
|
38
|
-
export declare const atmospherePoint: (effect?: AnimationEffect) => {
|
|
39
|
-
channel?: undefined;
|
|
40
|
-
} | {
|
|
41
|
-
channel: {
|
|
42
|
-
scaleX: {
|
|
43
|
-
from: number;
|
|
44
|
-
to: number;
|
|
45
|
-
};
|
|
46
|
-
scaleY: {
|
|
47
|
-
from: number;
|
|
48
|
-
to: number;
|
|
49
|
-
};
|
|
50
|
-
fillOpacity?: undefined;
|
|
51
|
-
strokeOpacity?: undefined;
|
|
52
|
-
outerBorder?: undefined;
|
|
53
|
-
};
|
|
54
|
-
} | {
|
|
55
|
-
channel: {
|
|
56
|
-
fillOpacity: {
|
|
57
|
-
from: number;
|
|
58
|
-
to: number;
|
|
59
|
-
};
|
|
60
|
-
strokeOpacity: {
|
|
61
|
-
from: number;
|
|
62
|
-
to: number;
|
|
63
|
-
};
|
|
64
|
-
scaleX?: undefined;
|
|
65
|
-
scaleY?: undefined;
|
|
66
|
-
outerBorder?: undefined;
|
|
67
|
-
};
|
|
68
|
-
} | {
|
|
69
|
-
channel: {
|
|
70
|
-
outerBorder: {
|
|
71
|
-
from: {
|
|
72
|
-
distance: number;
|
|
73
|
-
strokeOpacity: number;
|
|
74
|
-
};
|
|
75
|
-
to: (...args: any[]) => {
|
|
76
|
-
distance: number;
|
|
77
|
-
strokeOpacity: number;
|
|
78
|
-
stroke: any;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
scaleX?: undefined;
|
|
82
|
-
scaleY?: undefined;
|
|
83
|
-
fillOpacity?: undefined;
|
|
84
|
-
strokeOpacity?: undefined;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
@@ -12,49 +12,7 @@ const allowLineOrAreaAnimation = (config)=>{
|
|
|
12
12
|
const effect = effects[effects.length - 1] ?? EFFECT_NONE;
|
|
13
13
|
return effect !== EFFECT_NONE;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (effect === EFFECT_NONE) return {};
|
|
18
|
-
if ('breath' === effect) return {
|
|
19
|
-
channel: {
|
|
20
|
-
scaleX: {
|
|
21
|
-
from: 0.8,
|
|
22
|
-
to: 1.2
|
|
23
|
-
},
|
|
24
|
-
scaleY: {
|
|
25
|
-
from: 0.8,
|
|
26
|
-
to: 1.2
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
if ('reveal' === effect) return {
|
|
31
|
-
channel: {
|
|
32
|
-
fillOpacity: {
|
|
33
|
-
from: 0.6,
|
|
34
|
-
to: 1
|
|
35
|
-
},
|
|
36
|
-
strokeOpacity: {
|
|
37
|
-
from: 0.6,
|
|
38
|
-
to: 1
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
return {
|
|
43
|
-
channel: {
|
|
44
|
-
outerBorder: {
|
|
45
|
-
from: {
|
|
46
|
-
distance: 0,
|
|
47
|
-
strokeOpacity: 1
|
|
48
|
-
},
|
|
49
|
-
to: (...args)=>({
|
|
50
|
-
distance: 16,
|
|
51
|
-
strokeOpacity: 1e-8,
|
|
52
|
-
stroke: args[1]?.attribute?.fill
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export { EFFECT_NONE, allowAnimation, allowLineOrAreaAnimation, atmospherePoint, getFinalAttribute, getPrimaryEffect, toMs };
|
|
15
|
+
export { atmospherePoint, getFinalAttribute } from "./pointAtmosphere.js";
|
|
16
|
+
export { EFFECT_NONE, allowAnimation, allowLineOrAreaAnimation, getPrimaryEffect, toMs };
|
|
59
17
|
|
|
60
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/index.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/index.ts"],"sourcesContent":["import { VScreenAnimationType, type AnimationEffect, type AnimationEffectConfig } from '../types'\n\nexport const EFFECT_NONE = VScreenAnimationType.none\n\n/**\n * @description 将秒转换为 VChart 动画使用的毫秒。\n * @param seconds 秒数。\n * @returns 毫秒数。\n */\nexport const toMs = (seconds?: number): number => (seconds ?? 0) * 1000\n\n/**\n * @description 获取配置中的首个动画效果;未配置时返回 none。\n * @param config 动画效果配置。\n * @returns 首个动画效果。\n */\nexport const getPrimaryEffect = (config?: AnimationEffectConfig): AnimationEffect => config?.effects?.[0] ?? EFFECT_NONE\n\n/**\n * @description 判断通用动画配置是否开启且首个效果不是 none。\n * @param config 动画效果配置。\n * @returns 是否允许执行动画。\n */\nexport const allowAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n return getPrimaryEffect(config) !== EFFECT_NONE\n}\n\n/**\n * @description 判断折线/面积动画是否开启;这类图表以最后一个效果作为有效性判断。\n * @param config 动画效果配置。\n * @returns 是否允许执行折线/面积动画。\n */\nexport const allowLineOrAreaAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n const effects = config.effects ?? []\n const effect = effects[effects.length - 1] ?? EFFECT_NONE\n return effect !== EFFECT_NONE\n}\n
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/index.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/index.ts"],"sourcesContent":["import { VScreenAnimationType, type AnimationEffect, type AnimationEffectConfig } from '../types'\nexport { atmospherePoint, getFinalAttribute } from './pointAtmosphere'\n\nexport const EFFECT_NONE = VScreenAnimationType.none\n\n/**\n * @description 将秒转换为 VChart 动画使用的毫秒。\n * @param seconds 秒数。\n * @returns 毫秒数。\n */\nexport const toMs = (seconds?: number): number => (seconds ?? 0) * 1000\n\n/**\n * @description 获取配置中的首个动画效果;未配置时返回 none。\n * @param config 动画效果配置。\n * @returns 首个动画效果。\n */\nexport const getPrimaryEffect = (config?: AnimationEffectConfig): AnimationEffect => config?.effects?.[0] ?? EFFECT_NONE\n\n/**\n * @description 判断通用动画配置是否开启且首个效果不是 none。\n * @param config 动画效果配置。\n * @returns 是否允许执行动画。\n */\nexport const allowAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n return getPrimaryEffect(config) !== EFFECT_NONE\n}\n\n/**\n * @description 判断折线/面积动画是否开启;这类图表以最后一个效果作为有效性判断。\n * @param config 动画效果配置。\n * @returns 是否允许执行折线/面积动画。\n */\nexport const allowLineOrAreaAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n const effects = config.effects ?? []\n const effect = effects[effects.length - 1] ?? EFFECT_NONE\n return effect !== EFFECT_NONE\n}\n"],"names":["EFFECT_NONE","VScreenAnimationType","toMs","seconds","getPrimaryEffect","config","allowAnimation","allowLineOrAreaAnimation","effects","effect"],"mappings":";AAGO,MAAMA,cAAcC,qBAAqB,IAAI;AAO7C,MAAMC,OAAO,CAACC,UAA8BA,AAAAA,CAAAA,WAAW,KAAK;AAO5D,MAAMC,mBAAmB,CAACC,SAAoDA,QAAQ,SAAS,CAAC,EAAE,IAAIL;AAOtG,MAAMM,iBAAiB,CAACD;IAC7B,IAAI,CAACA,QAAQ,QACX,OAAO;IAET,OAAOD,iBAAiBC,YAAYL;AACtC;AAOO,MAAMO,2BAA2B,CAACF;IACvC,IAAI,CAACA,QAAQ,QACX,OAAO;IAET,MAAMG,UAAUH,OAAO,OAAO,IAAI,EAAE;IACpC,MAAMI,SAASD,OAAO,CAACA,QAAQ,MAAM,GAAG,EAAE,IAAIR;IAC9C,OAAOS,WAAWT;AACpB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type AnimationEffect } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @description 获取图元最终属性,优先读取动画后的 finalAttribute。
|
|
4
|
+
* @param mark VChart 图元对象。
|
|
5
|
+
* @returns 图元最终属性。
|
|
6
|
+
*/
|
|
7
|
+
export declare const getFinalAttribute: (mark: any) => Record<string, any>;
|
|
8
|
+
/**
|
|
9
|
+
* @description 生成点图元氛围动画配置,复用于折线、面积、散点和雷达图。
|
|
10
|
+
* @param effect 氛围动画效果。
|
|
11
|
+
* @returns 点图元氛围动画配置。
|
|
12
|
+
*/
|
|
13
|
+
export declare const atmospherePoint: (effect?: AnimationEffect) => {
|
|
14
|
+
channel?: undefined;
|
|
15
|
+
custom?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
channel: {
|
|
18
|
+
scaleX: {
|
|
19
|
+
from: number;
|
|
20
|
+
to: number;
|
|
21
|
+
};
|
|
22
|
+
scaleY: {
|
|
23
|
+
from: number;
|
|
24
|
+
to: number;
|
|
25
|
+
};
|
|
26
|
+
fillOpacity?: undefined;
|
|
27
|
+
strokeOpacity?: undefined;
|
|
28
|
+
outerBorder?: undefined;
|
|
29
|
+
};
|
|
30
|
+
custom?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
channel: {
|
|
33
|
+
fillOpacity: {
|
|
34
|
+
from: number;
|
|
35
|
+
to: number;
|
|
36
|
+
};
|
|
37
|
+
strokeOpacity: {
|
|
38
|
+
from: number;
|
|
39
|
+
to: number;
|
|
40
|
+
};
|
|
41
|
+
scaleX?: undefined;
|
|
42
|
+
scaleY?: undefined;
|
|
43
|
+
outerBorder?: undefined;
|
|
44
|
+
};
|
|
45
|
+
custom?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
channel: {
|
|
48
|
+
outerBorder: {
|
|
49
|
+
from: {
|
|
50
|
+
distance: number;
|
|
51
|
+
strokeOpacity: number;
|
|
52
|
+
};
|
|
53
|
+
to: (...args: any[]) => {
|
|
54
|
+
distance: number;
|
|
55
|
+
strokeOpacity: number;
|
|
56
|
+
stroke: any;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
scaleX?: undefined;
|
|
60
|
+
scaleY?: undefined;
|
|
61
|
+
fillOpacity?: undefined;
|
|
62
|
+
strokeOpacity?: undefined;
|
|
63
|
+
};
|
|
64
|
+
custom: (ratio: number, from: any, to: any, out: any, graphic: any) => void;
|
|
65
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { VScreenAnimationType } from "../types.js";
|
|
2
|
+
const EFFECT_NONE = VScreenAnimationType.none;
|
|
3
|
+
const getFinalAttribute = (mark)=>mark?.finalAttribute ?? mark?.attribute ?? {};
|
|
4
|
+
const atmospherePoint = (effect)=>{
|
|
5
|
+
if (effect === EFFECT_NONE) return {};
|
|
6
|
+
if ('breath' === effect) return {
|
|
7
|
+
channel: {
|
|
8
|
+
scaleX: {
|
|
9
|
+
from: 0.8,
|
|
10
|
+
to: 2
|
|
11
|
+
},
|
|
12
|
+
scaleY: {
|
|
13
|
+
from: 0.8,
|
|
14
|
+
to: 2
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
if ('reveal' === effect) return {
|
|
19
|
+
channel: {
|
|
20
|
+
fillOpacity: {
|
|
21
|
+
from: 0.6,
|
|
22
|
+
to: 1
|
|
23
|
+
},
|
|
24
|
+
strokeOpacity: {
|
|
25
|
+
from: 0.6,
|
|
26
|
+
to: 1
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
channel: {
|
|
32
|
+
outerBorder: {
|
|
33
|
+
from: {
|
|
34
|
+
distance: 0,
|
|
35
|
+
strokeOpacity: 1
|
|
36
|
+
},
|
|
37
|
+
to: (...args)=>({
|
|
38
|
+
distance: 16,
|
|
39
|
+
strokeOpacity: 1e-8,
|
|
40
|
+
stroke: args[1]?.attribute?.fill
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
custom: (ratio, from, to, out, graphic)=>{
|
|
45
|
+
graphic.attribute.strokeOpacity = ratio * (to.strokeOpacity - from.strokeOpacity) + from.strokeOpacity;
|
|
46
|
+
graphic.attribute.outerBorder = {
|
|
47
|
+
distance: ratio * (to.outerBorder.distance - from.outerBorder.distance) + from.outerBorder.distance,
|
|
48
|
+
strokeOpacity: ratio * (to.outerBorder.strokeOpacity - from.outerBorder.strokeOpacity) + from.outerBorder.strokeOpacity,
|
|
49
|
+
stroke: to.outerBorder.stroke
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export { atmospherePoint, getFinalAttribute };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=pointAtmosphere.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.ts"],"sourcesContent":["import { VScreenAnimationType, type AnimationEffect } from '../types'\n\nconst EFFECT_NONE = VScreenAnimationType.none\n\n/**\n * @description 获取图元最终属性,优先读取动画后的 finalAttribute。\n * @param mark VChart 图元对象。\n * @returns 图元最终属性。\n */\nexport const getFinalAttribute = (mark: any): Record<string, any> => {\n return mark?.finalAttribute ?? mark?.attribute ?? {}\n}\n\n/**\n * @description 生成点图元氛围动画配置,复用于折线、面积、散点和雷达图。\n * @param effect 氛围动画效果。\n * @returns 点图元氛围动画配置。\n */\nexport const atmospherePoint = (effect?: AnimationEffect) => {\n if (effect === EFFECT_NONE) {\n return {}\n }\n if (effect === 'breath') {\n return {\n channel: {\n scaleX: {\n from: 0.8,\n to: 2,\n },\n scaleY: {\n from: 0.8,\n to: 2,\n },\n },\n }\n }\n if (effect === 'reveal') {\n return {\n channel: {\n fillOpacity: { from: 0.6, to: 1 },\n strokeOpacity: { from: 0.6, to: 1 },\n },\n }\n }\n return {\n channel: {\n outerBorder: {\n from: { distance: 0, strokeOpacity: 1 },\n // 波纹描边沿用图元填充色,避免自定义配色下出现突兀色值。\n to: (...args: any[]) => ({\n distance: 16,\n strokeOpacity: 1e-8,\n stroke: args[1]?.attribute?.fill,\n }),\n },\n },\n custom: (ratio: number, from: any, to: any, out: any, graphic: any) => {\n graphic.attribute.strokeOpacity = ratio * (to.strokeOpacity - from.strokeOpacity) + from.strokeOpacity\n graphic.attribute.outerBorder = {\n distance: ratio * (to.outerBorder.distance - from.outerBorder.distance) + from.outerBorder.distance,\n strokeOpacity:\n ratio * (to.outerBorder.strokeOpacity - from.outerBorder.strokeOpacity) + from.outerBorder.strokeOpacity,\n stroke: to.outerBorder.stroke,\n }\n },\n }\n}\n"],"names":["EFFECT_NONE","VScreenAnimationType","getFinalAttribute","mark","atmospherePoint","effect","args","ratio","from","to","out","graphic"],"mappings":";AAEA,MAAMA,cAAcC,qBAAqB,IAAI;AAOtC,MAAMC,oBAAoB,CAACC,OACzBA,MAAM,kBAAkBA,MAAM,aAAa,CAAC;AAQ9C,MAAMC,kBAAkB,CAACC;IAC9B,IAAIA,WAAWL,aACb,OAAO,CAAC;IAEV,IAAIK,AAAW,aAAXA,QACF,OAAO;QACL,SAAS;YACP,QAAQ;gBACN,MAAM;gBACN,IAAI;YACN;YACA,QAAQ;gBACN,MAAM;gBACN,IAAI;YACN;QACF;IACF;IAEF,IAAIA,AAAW,aAAXA,QACF,OAAO;QACL,SAAS;YACP,aAAa;gBAAE,MAAM;gBAAK,IAAI;YAAE;YAChC,eAAe;gBAAE,MAAM;gBAAK,IAAI;YAAE;QACpC;IACF;IAEF,OAAO;QACL,SAAS;YACP,aAAa;gBACX,MAAM;oBAAE,UAAU;oBAAG,eAAe;gBAAE;gBAEtC,IAAI,CAAC,GAAGC,OAAiB;wBACvB,UAAU;wBACV,eAAe;wBACf,QAAQA,IAAI,CAAC,EAAE,EAAE,WAAW;oBAC9B;YACF;QACF;QACA,QAAQ,CAACC,OAAeC,MAAWC,IAASC,KAAUC;YACpDA,QAAQ,SAAS,CAAC,aAAa,GAAGJ,QAASE,CAAAA,GAAG,aAAa,GAAGD,KAAK,aAAY,IAAKA,KAAK,aAAa;YACtGG,QAAQ,SAAS,CAAC,WAAW,GAAG;gBAC9B,UAAUJ,QAASE,CAAAA,GAAG,WAAW,CAAC,QAAQ,GAAGD,KAAK,WAAW,CAAC,QAAO,IAAKA,KAAK,WAAW,CAAC,QAAQ;gBACnG,eACED,QAASE,CAAAA,GAAG,WAAW,CAAC,aAAa,GAAGD,KAAK,WAAW,CAAC,aAAY,IAAKA,KAAK,WAAW,CAAC,aAAa;gBAC1G,QAAQC,GAAG,WAAW,CAAC,MAAM;YAC/B;QACF;IACF;AACF"}
|
|
@@ -1,49 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
topLeft,
|
|
9
|
-
topRight
|
|
10
|
-
];
|
|
11
|
-
};
|
|
12
|
-
const mergeStackCornerRadius = (cornerRadius)=>{
|
|
13
|
-
if (!Array.isArray(cornerRadius)) return cornerRadius;
|
|
14
|
-
const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius;
|
|
15
|
-
return [
|
|
16
|
-
Math.max(topLeft, bottomRight),
|
|
17
|
-
Math.max(topRight, bottomLeft),
|
|
18
|
-
Math.max(bottomRight, topLeft),
|
|
19
|
-
Math.max(bottomLeft, topRight)
|
|
20
|
-
];
|
|
21
|
-
};
|
|
22
|
-
const getStackRangeCornerRadius = (cornerRadius, datum)=>{
|
|
23
|
-
const stackStart = datum?.['__VCHART_STACK_START'];
|
|
24
|
-
const stackEnd = datum?.['__VCHART_STACK_END'];
|
|
25
|
-
if ('number' != typeof stackStart || 'number' != typeof stackEnd) return;
|
|
26
|
-
const hasPositivePart = stackStart > 0 || stackEnd > 0;
|
|
27
|
-
const hasNegativePart = stackStart < 0 || stackEnd < 0;
|
|
28
|
-
if (hasPositivePart && hasNegativePart) return mergeStackCornerRadius(cornerRadius);
|
|
29
|
-
if (hasPositivePart) return cornerRadius;
|
|
30
|
-
if (hasNegativePart) return reverseStackCornerRadius(cornerRadius);
|
|
31
|
-
return 0;
|
|
32
|
-
};
|
|
1
|
+
import { createStackCornerRadius, hasMoveInAnimation } from "./stackCornerRadiusUtils.js";
|
|
2
|
+
const hasBarMoveInAnimation = (spec)=>[
|
|
3
|
+
spec.animationAppear,
|
|
4
|
+
spec.animationNormal,
|
|
5
|
+
spec.animationEnter,
|
|
6
|
+
spec.animationUpdate
|
|
7
|
+
].some(hasMoveInAnimation);
|
|
33
8
|
const stackCornerRadius_stackCornerRadius = (spec, context)=>{
|
|
34
9
|
const { advancedVSeed, vseed } = context;
|
|
35
10
|
const { chartType } = vseed;
|
|
36
11
|
const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius;
|
|
37
12
|
if ('dualAxis' === chartType && 'bar' !== spec.type) return spec;
|
|
13
|
+
const stackCornerRadiusCallback = createStackCornerRadius(stackCornerRadius);
|
|
14
|
+
if (!hasBarMoveInAnimation(spec)) return {
|
|
15
|
+
...spec,
|
|
16
|
+
stackCornerRadius: stackCornerRadiusCallback
|
|
17
|
+
};
|
|
38
18
|
return {
|
|
39
19
|
...spec,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return 0;
|
|
20
|
+
bar: {
|
|
21
|
+
...spec.bar,
|
|
22
|
+
style: {
|
|
23
|
+
...spec.bar?.style,
|
|
24
|
+
cornerRadius: stackCornerRadiusCallback
|
|
25
|
+
}
|
|
47
26
|
}
|
|
48
27
|
};
|
|
49
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/stack/stackCornerRadius.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/stack/stackCornerRadius.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe, StackCornerRadius } from 'src/types'\nimport { createStackCornerRadius, hasMoveInAnimation } from './stackCornerRadiusUtils'\n\nconst hasBarMoveInAnimation = (spec: IBarChartSpec): boolean => {\n return [spec.animationAppear, spec.animationNormal, spec.animationEnter, spec.animationUpdate].some(\n hasMoveInAnimation,\n )\n}\n\nexport const stackCornerRadius: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const stackCornerRadius = advancedVSeed.config?.[chartType as 'column']?.stackCornerRadius as StackCornerRadius\n\n if (chartType === 'dualAxis' && (spec as any).type !== 'bar') {\n return spec\n }\n\n const stackCornerRadiusCallback = createStackCornerRadius(stackCornerRadius)\n\n if (!hasBarMoveInAnimation(spec as IBarChartSpec)) {\n return { ...spec, stackCornerRadius: stackCornerRadiusCallback } as IBarChartSpec\n }\n\n // VChart implements stackCornerRadius with a final-position clipPath, which clips moveIn.\n return {\n ...spec,\n bar: {\n ...(spec as IBarChartSpec).bar,\n style: {\n ...(spec as IBarChartSpec).bar?.style,\n cornerRadius: stackCornerRadiusCallback,\n },\n },\n } as IBarChartSpec\n}\n"],"names":["hasBarMoveInAnimation","spec","hasMoveInAnimation","stackCornerRadius","context","advancedVSeed","vseed","chartType","stackCornerRadiusCallback","createStackCornerRadius"],"mappings":";AAIA,MAAMA,wBAAwB,CAACC,OACtB;QAACA,KAAK,eAAe;QAAEA,KAAK,eAAe;QAAEA,KAAK,cAAc;QAAEA,KAAK,eAAe;KAAC,CAAC,IAAI,CACjGC;AAIG,MAAMC,sCAAoC,CAACF,MAAMG;IACtD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,SAAS,EAAE,GAAGD;IACtB,MAAMH,oBAAoBE,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAEzE,IAAIA,AAAc,eAAdA,aAA6BN,AAAsB,UAAtBA,KAAa,IAAI,EAChD,OAAOA;IAGT,MAAMO,4BAA4BC,wBAAwBN;IAE1D,IAAI,CAACH,sBAAsBC,OACzB,OAAO;QAAE,GAAGA,IAAI;QAAE,mBAAmBO;IAA0B;IAIjE,OAAO;QACL,GAAGP,IAAI;QACP,KAAK;YACH,GAAIA,KAAuB,GAAG;YAC9B,OAAO;gBACL,GAAIA,KAAuB,GAAG,EAAE,KAAK;gBACrC,cAAcO;YAChB;QACF;IACF;AACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Datum, StackCornerRadius } from '../../../../../types';
|
|
2
|
+
export type StackCornerRadiusCallback = (_: unknown, datum: Datum) => StackCornerRadius | 0;
|
|
3
|
+
export declare const createStackCornerRadius: (cornerRadius: StackCornerRadius) => StackCornerRadiusCallback;
|
|
4
|
+
export declare const hasMoveInAnimation: (animation: unknown) => boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FoldMeasureId } from "../../../../../dataReshape/constant.js";
|
|
2
|
+
const reverseStackCornerRadius = (cornerRadius)=>{
|
|
3
|
+
if (!Array.isArray(cornerRadius)) return cornerRadius;
|
|
4
|
+
const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius;
|
|
5
|
+
return [
|
|
6
|
+
bottomRight,
|
|
7
|
+
bottomLeft,
|
|
8
|
+
topLeft,
|
|
9
|
+
topRight
|
|
10
|
+
];
|
|
11
|
+
};
|
|
12
|
+
const mergeStackCornerRadius = (cornerRadius)=>{
|
|
13
|
+
if (!Array.isArray(cornerRadius)) return cornerRadius;
|
|
14
|
+
const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius;
|
|
15
|
+
return [
|
|
16
|
+
Math.max(topLeft, bottomRight),
|
|
17
|
+
Math.max(topRight, bottomLeft),
|
|
18
|
+
Math.max(bottomRight, topLeft),
|
|
19
|
+
Math.max(bottomLeft, topRight)
|
|
20
|
+
];
|
|
21
|
+
};
|
|
22
|
+
const getStackRangeCornerRadius = (cornerRadius, datum)=>{
|
|
23
|
+
const stackStart = datum?.['__VCHART_STACK_START'];
|
|
24
|
+
const stackEnd = datum?.['__VCHART_STACK_END'];
|
|
25
|
+
if ('number' != typeof stackStart || 'number' != typeof stackEnd) return;
|
|
26
|
+
const hasPositivePart = stackStart > 0 || stackEnd > 0;
|
|
27
|
+
const hasNegativePart = stackStart < 0 || stackEnd < 0;
|
|
28
|
+
if (hasPositivePart && hasNegativePart) return mergeStackCornerRadius(cornerRadius);
|
|
29
|
+
if (hasPositivePart) return cornerRadius;
|
|
30
|
+
if (hasNegativePart) return reverseStackCornerRadius(cornerRadius);
|
|
31
|
+
return 0;
|
|
32
|
+
};
|
|
33
|
+
const createStackCornerRadius = (cornerRadius)=>(_, datum)=>{
|
|
34
|
+
const stackRangeCornerRadius = getStackRangeCornerRadius(cornerRadius, datum);
|
|
35
|
+
if (void 0 !== stackRangeCornerRadius) return stackRangeCornerRadius;
|
|
36
|
+
const value = datum?.[datum?.[FoldMeasureId]];
|
|
37
|
+
if (value > 0) return cornerRadius;
|
|
38
|
+
if (value < 0) return reverseStackCornerRadius(cornerRadius);
|
|
39
|
+
return 0;
|
|
40
|
+
};
|
|
41
|
+
const hasMoveInAnimation = (animation)=>{
|
|
42
|
+
if (!animation) return false;
|
|
43
|
+
if (Array.isArray(animation)) return animation.some(hasMoveInAnimation);
|
|
44
|
+
if ('object' != typeof animation) return false;
|
|
45
|
+
const animationRecord = animation;
|
|
46
|
+
return 'moveIn' === animationRecord.type || Object.values(animationRecord).some(hasMoveInAnimation);
|
|
47
|
+
};
|
|
48
|
+
export { createStackCornerRadius, hasMoveInAnimation };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=stackCornerRadiusUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.ts"],"sourcesContent":["import { FoldMeasureId } from 'src/dataReshape/constant'\nimport type { Datum, StackCornerRadius } from 'src/types'\n\nexport type StackCornerRadiusCallback = (_: unknown, datum: Datum) => StackCornerRadius | 0\n\nconst reverseStackCornerRadius = (cornerRadius: StackCornerRadius): StackCornerRadius => {\n if (!Array.isArray(cornerRadius)) {\n return cornerRadius\n }\n\n const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius\n\n return [bottomRight, bottomLeft, topLeft, topRight]\n}\n\nconst mergeStackCornerRadius = (cornerRadius: StackCornerRadius): StackCornerRadius => {\n if (!Array.isArray(cornerRadius)) {\n return cornerRadius\n }\n\n const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius\n\n return [\n Math.max(topLeft, bottomRight),\n Math.max(topRight, bottomLeft),\n Math.max(bottomRight, topLeft),\n Math.max(bottomLeft, topRight),\n ]\n}\n\nconst getStackRangeCornerRadius = (\n cornerRadius: StackCornerRadius,\n datum: Datum,\n): StackCornerRadius | 0 | undefined => {\n const stackStart = datum?.['__VCHART_STACK_START']\n const stackEnd = datum?.['__VCHART_STACK_END']\n\n if (typeof stackStart !== 'number' || typeof stackEnd !== 'number') {\n return undefined\n }\n\n const hasPositivePart = stackStart > 0 || stackEnd > 0\n const hasNegativePart = stackStart < 0 || stackEnd < 0\n\n if (hasPositivePart && hasNegativePart) {\n return mergeStackCornerRadius(cornerRadius)\n }\n\n if (hasPositivePart) {\n return cornerRadius\n }\n\n if (hasNegativePart) {\n return reverseStackCornerRadius(cornerRadius)\n }\n\n return 0\n}\n\nexport const createStackCornerRadius = (cornerRadius: StackCornerRadius): StackCornerRadiusCallback => {\n return (_: unknown, datum: Datum) => {\n const stackRangeCornerRadius = getStackRangeCornerRadius(cornerRadius, datum)\n\n if (stackRangeCornerRadius !== undefined) {\n return stackRangeCornerRadius\n }\n\n const value = datum?.[datum?.[FoldMeasureId]]\n\n if (value > 0) {\n return cornerRadius\n }\n\n if (value < 0) {\n return reverseStackCornerRadius(cornerRadius)\n }\n\n return 0\n }\n}\n\nexport const hasMoveInAnimation = (animation: unknown): boolean => {\n if (!animation) {\n return false\n }\n\n if (Array.isArray(animation)) {\n return animation.some(hasMoveInAnimation)\n }\n\n if (typeof animation !== 'object') {\n return false\n }\n\n const animationRecord = animation as Record<string, unknown>\n\n return animationRecord.type === 'moveIn' || Object.values(animationRecord).some(hasMoveInAnimation)\n}\n"],"names":["reverseStackCornerRadius","cornerRadius","Array","topLeft","topRight","bottomRight","bottomLeft","mergeStackCornerRadius","Math","getStackRangeCornerRadius","datum","stackStart","stackEnd","hasPositivePart","hasNegativePart","createStackCornerRadius","_","stackRangeCornerRadius","undefined","value","FoldMeasureId","hasMoveInAnimation","animation","animationRecord","Object"],"mappings":";AAKA,MAAMA,2BAA2B,CAACC;IAChC,IAAI,CAACC,MAAM,OAAO,CAACD,eACjB,OAAOA;IAGT,MAAM,CAACE,UAAU,CAAC,EAAEC,WAAW,CAAC,EAAEC,cAAc,CAAC,EAAEC,aAAa,CAAC,CAAC,GAAGL;IAErE,OAAO;QAACI;QAAaC;QAAYH;QAASC;KAAS;AACrD;AAEA,MAAMG,yBAAyB,CAACN;IAC9B,IAAI,CAACC,MAAM,OAAO,CAACD,eACjB,OAAOA;IAGT,MAAM,CAACE,UAAU,CAAC,EAAEC,WAAW,CAAC,EAAEC,cAAc,CAAC,EAAEC,aAAa,CAAC,CAAC,GAAGL;IAErE,OAAO;QACLO,KAAK,GAAG,CAACL,SAASE;QAClBG,KAAK,GAAG,CAACJ,UAAUE;QACnBE,KAAK,GAAG,CAACH,aAAaF;QACtBK,KAAK,GAAG,CAACF,YAAYF;KACtB;AACH;AAEA,MAAMK,4BAA4B,CAChCR,cACAS;IAEA,MAAMC,aAAaD,OAAO,CAAC,uBAAuB;IAClD,MAAME,WAAWF,OAAO,CAAC,qBAAqB;IAE9C,IAAI,AAAsB,YAAtB,OAAOC,cAA2B,AAAoB,YAApB,OAAOC,UAC3C;IAGF,MAAMC,kBAAkBF,aAAa,KAAKC,WAAW;IACrD,MAAME,kBAAkBH,aAAa,KAAKC,WAAW;IAErD,IAAIC,mBAAmBC,iBACrB,OAAOP,uBAAuBN;IAGhC,IAAIY,iBACF,OAAOZ;IAGT,IAAIa,iBACF,OAAOd,yBAAyBC;IAGlC,OAAO;AACT;AAEO,MAAMc,0BAA0B,CAACd,eAC/B,CAACe,GAAYN;QAClB,MAAMO,yBAAyBR,0BAA0BR,cAAcS;QAEvE,IAAIO,AAA2BC,WAA3BD,wBACF,OAAOA;QAGT,MAAME,QAAQT,OAAO,CAACA,OAAO,CAACU,cAAc,CAAC;QAE7C,IAAID,QAAQ,GACV,OAAOlB;QAGT,IAAIkB,QAAQ,GACV,OAAOnB,yBAAyBC;QAGlC,OAAO;IACT;AAGK,MAAMoB,qBAAqB,CAACC;IACjC,IAAI,CAACA,WACH,OAAO;IAGT,IAAIpB,MAAM,OAAO,CAACoB,YAChB,OAAOA,UAAU,IAAI,CAACD;IAGxB,IAAI,AAAqB,YAArB,OAAOC,WACT,OAAO;IAGT,MAAMC,kBAAkBD;IAExB,OAAOC,AAAyB,aAAzBA,gBAAgB,IAAI,IAAiBC,OAAO,MAAM,CAACD,iBAAiB,IAAI,CAACF;AAClF"}
|
|
@@ -50,6 +50,8 @@ export type TokenThemeDefinition = {
|
|
|
50
50
|
annotationTextColor?: string;
|
|
51
51
|
annotationTextBackgroundColor?: string;
|
|
52
52
|
annotationTextBackgroundOpacity?: number;
|
|
53
|
+
annotationAreaColor?: string;
|
|
54
|
+
annotationAreaColorOpacity?: number;
|
|
53
55
|
};
|
|
54
56
|
export type TokenThemeRegistry = Record<string, TokenThemeDefinition>;
|
|
55
57
|
export type RegisterTokenThemeOptions = {
|