@visactor/vseed 0.1.24 → 0.1.25

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.
@@ -1,10 +1,9 @@
1
1
  import { selector } from "../../../../../dataSelector/index.js";
2
- import { groupBy, isEmpty, isNullish } from "remeda";
2
+ import { isEmpty, isNullish } from "remeda";
3
3
  import { getCurveTension, getCurveType } from "./curve/index.js";
4
4
  const lineStyle_lineStyle = (spec, context)=>{
5
5
  const { advancedVSeed } = context;
6
- const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
7
- const { unfoldInfo } = datasetReshapeInfo[0];
6
+ const { markStyle } = advancedVSeed;
8
7
  const { lineStyle } = markStyle;
9
8
  const result = {
10
9
  ...spec,
@@ -16,8 +15,6 @@ const lineStyle_lineStyle = (spec, context)=>{
16
15
  const lineStyles = Array.isArray(lineStyle) ? lineStyle : [
17
16
  lineStyle
18
17
  ];
19
- const colorId = unfoldInfo.encodingColorId;
20
- const lineGroups = groupBy(dataset, (d)=>d[colorId ?? '']);
21
18
  const customMap = lineStyles.reduce((result, style, index)=>{
22
19
  const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
23
20
  const dashSegment = 2 * lineWidth;
@@ -38,8 +35,8 @@ const lineStyle_lineStyle = (spec, context)=>{
38
35
  ...result,
39
36
  [`custom${index + 1}`]: {
40
37
  level: index + 1,
41
- filter: (datum)=>{
42
- const lineData = lineGroups[datum[colorId ?? '']];
38
+ filter: (_, node)=>{
39
+ const lineData = node.renderNode.context.data;
43
40
  for (const d of lineData)if (selector(d, style.selector)) return true;
44
41
  return false;
45
42
  },
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/lineStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/lineStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, LineStyle, SpecPipe } from 'src/types'\nimport { groupBy, isEmpty, isNullish } from 'remeda'\nimport { getCurveTension, getCurveType } from './curve'\n\nexport const lineStyle: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed\n const { unfoldInfo } = datasetReshapeInfo[0]\n const { lineStyle } = markStyle\n const result = {\n ...spec,\n line: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(lineStyle) || isEmpty(lineStyle)) {\n return result\n }\n\n const lineStyles = (Array.isArray(lineStyle) ? lineStyle : [lineStyle]) as LineStyle[]\n\n const colorId = unfoldInfo.encodingColorId\n const lineGroups = groupBy(dataset, (d) => d[colorId ?? ''] as string)\n\n const customMap = lineStyles.reduce<object>((result, style, index) => {\n const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style\n\n const dashSegment = lineWidth * 2\n const dashGap = lineWidth\n\n const lineDash =\n lineStyle === 'dashed' ? [dashSegment, dashSegment] : lineStyle === 'dotted' ? [dashGap / 2, dashGap * 2] : [0, 0]\n\n const curveType = getCurveType(context.vseed, lineSmooth)\n const curveTension = getCurveTension(context.vseed, lineSmooth)\n\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n const lineData = lineGroups[datum[colorId ?? ''] as string]\n for (const d of lineData) {\n if (selector(d, style.selector)) {\n return true\n }\n }\n return false\n },\n style: {\n visible: lineVisible,\n curveType: curveType,\n curveTension: curveTension,\n strokeOpacity: lineColorOpacity,\n stroke: lineColor,\n lineWidth: lineWidth,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n return {\n ...result,\n line: {\n ...result.line,\n state: {\n ...customMap,\n },\n },\n }\n}\n"],"names":["lineStyle","spec","context","advancedVSeed","markStyle","datasetReshapeInfo","dataset","unfoldInfo","result","isNullish","isEmpty","lineStyles","Array","colorId","lineGroups","groupBy","d","customMap","style","index","lineColor","lineColorOpacity","lineSmooth","lineWidth","lineVisible","dashSegment","dashGap","lineDash","curveType","getCurveType","curveTension","getCurveTension","datum","lineData","selector"],"mappings":";;;AAMO,MAAMA,sBAAsB,CAACC,MAAMC;IACxC,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAEC,kBAAkB,EAAEC,OAAO,EAAE,GAAGH;IACnD,MAAM,EAAEI,UAAU,EAAE,GAAGF,kBAAkB,CAAC,EAAE;IAC5C,MAAM,EAAEL,SAAS,EAAE,GAAGI;IACtB,MAAMI,SAAS;QACb,GAAGP,IAAI;QACP,MAAM;YACJ,OAAO,CAAC;QACV;IACF;IAEA,IAAIQ,UAAUT,cAAcU,QAAQV,YAClC,OAAOQ;IAGT,MAAMG,aAAcC,MAAM,OAAO,CAACZ,aAAaA,YAAY;QAACA;KAAU;IAEtE,MAAMa,UAAUN,WAAW,eAAe;IAC1C,MAAMO,aAAaC,QAAQT,SAAS,CAACU,IAAMA,CAAC,CAACH,WAAW,GAAG;IAE3D,MAAMI,YAAYN,WAAW,MAAM,CAAS,CAACH,QAAQU,OAAOC;QAC1D,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,EAAEtB,SAAS,EAAEuB,YAAY,CAAC,EAAEC,cAAc,IAAI,EAAE,GAAGN;QAElG,MAAMO,cAAcF,AAAY,IAAZA;QACpB,MAAMG,UAAUH;QAEhB,MAAMI,WACJ3B,AAAc,aAAdA,YAAyB;YAACyB;YAAaA;SAAY,GAAGzB,AAAc,aAAdA,YAAyB;YAAC0B,UAAU;YAAa,IAAVA;SAAY,GAAG;YAAC;YAAG;SAAE;QAEpH,MAAME,YAAYC,aAAa3B,QAAQ,KAAK,EAAEoB;QAC9C,MAAMQ,eAAeC,gBAAgB7B,QAAQ,KAAK,EAAEoB;QAEpD,OAAO;YACL,GAAGd,MAAM;YACT,CAAC,CAAC,MAAM,EAAEW,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CAACa;oBACP,MAAMC,WAAWnB,UAAU,CAACkB,KAAK,CAACnB,WAAW,GAAG,CAAW;oBAC3D,KAAK,MAAMG,KAAKiB,SACd,IAAIC,SAASlB,GAAGE,MAAM,QAAQ,GAC5B,OAAO;oBAGX,OAAO;gBACT;gBACA,OAAO;oBACL,SAASM;oBACT,WAAWI;oBACX,cAAcE;oBACd,eAAeT;oBACf,QAAQD;oBACR,WAAWG;oBACX,UAAUI;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJ,OAAO;QACL,GAAGnB,MAAM;QACT,MAAM;YACJ,GAAGA,OAAO,IAAI;YACd,OAAO;gBACL,GAAGS,SAAS;YACd;QACF;IACF;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/lineStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/lineStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, LineStyle, SpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { getCurveTension, getCurveType } from './curve'\n\nexport const lineStyle: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle } = advancedVSeed\n const { lineStyle } = markStyle\n const result = {\n ...spec,\n line: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(lineStyle) || isEmpty(lineStyle)) {\n return result\n }\n\n const lineStyles = (Array.isArray(lineStyle) ? lineStyle : [lineStyle]) as LineStyle[]\n\n const customMap = lineStyles.reduce<object>((result, style, index) => {\n const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style\n\n const dashSegment = lineWidth * 2\n const dashGap = lineWidth\n\n const lineDash =\n lineStyle === 'dashed' ? [dashSegment, dashSegment] : lineStyle === 'dotted' ? [dashGap / 2, dashGap * 2] : [0, 0]\n\n const curveType = getCurveType(context.vseed, lineSmooth)\n const curveTension = getCurveTension(context.vseed, lineSmooth)\n\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (\n _: Datum,\n node: {\n renderNode: {\n context: {\n data: Datum[]\n }\n }\n },\n ) => {\n const lineData = node.renderNode.context.data\n for (const d of lineData) {\n if (selector(d, style.selector)) {\n return true\n }\n }\n return false\n },\n style: {\n visible: lineVisible,\n curveType: curveType,\n curveTension: curveTension,\n strokeOpacity: lineColorOpacity,\n stroke: lineColor,\n lineWidth: lineWidth,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n return {\n ...result,\n line: {\n ...result.line,\n state: {\n ...customMap,\n },\n },\n }\n}\n"],"names":["lineStyle","spec","context","advancedVSeed","markStyle","result","isNullish","isEmpty","lineStyles","Array","customMap","style","index","lineColor","lineColorOpacity","lineSmooth","lineWidth","lineVisible","dashSegment","dashGap","lineDash","curveType","getCurveType","curveTension","getCurveTension","_","node","lineData","d","selector"],"mappings":";;;AAMO,MAAMA,sBAAsB,CAACC,MAAMC;IACxC,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEH,SAAS,EAAE,GAAGI;IACtB,MAAMC,SAAS;QACb,GAAGJ,IAAI;QACP,MAAM;YACJ,OAAO,CAAC;QACV;IACF;IAEA,IAAIK,UAAUN,cAAcO,QAAQP,YAClC,OAAOK;IAGT,MAAMG,aAAcC,MAAM,OAAO,CAACT,aAAaA,YAAY;QAACA;KAAU;IAEtE,MAAMU,YAAYF,WAAW,MAAM,CAAS,CAACH,QAAQM,OAAOC;QAC1D,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,EAAEf,SAAS,EAAEgB,YAAY,CAAC,EAAEC,cAAc,IAAI,EAAE,GAAGN;QAElG,MAAMO,cAAcF,AAAY,IAAZA;QACpB,MAAMG,UAAUH;QAEhB,MAAMI,WACJpB,AAAc,aAAdA,YAAyB;YAACkB;YAAaA;SAAY,GAAGlB,AAAc,aAAdA,YAAyB;YAACmB,UAAU;YAAa,IAAVA;SAAY,GAAG;YAAC;YAAG;SAAE;QAEpH,MAAME,YAAYC,aAAapB,QAAQ,KAAK,EAAEa;QAC9C,MAAMQ,eAAeC,gBAAgBtB,QAAQ,KAAK,EAAEa;QAEpD,OAAO;YACL,GAAGV,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CACNa,GACAC;oBAQA,MAAMC,WAAWD,KAAK,UAAU,CAAC,OAAO,CAAC,IAAI;oBAC7C,KAAK,MAAME,KAAKD,SACd,IAAIE,SAASD,GAAGjB,MAAM,QAAQ,GAC5B,OAAO;oBAGX,OAAO;gBACT;gBACA,OAAO;oBACL,SAASM;oBACT,WAAWI;oBACX,cAAcE;oBACd,eAAeT;oBACf,QAAQD;oBACR,WAAWG;oBACX,UAAUI;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJ,OAAO;QACL,GAAGf,MAAM;QACT,MAAM;YACJ,GAAGA,OAAO,IAAI;YACd,OAAO;gBACL,GAAGK,SAAS;YACd;QACF;IACF;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { isNumber } from "remeda";
2
2
  import { intl } from "../../../i18n/index.js";
3
3
  const createNumFormatter = (format, locale = intl.getLocale())=>{
4
- const { type = 'number', ratio = 1, symbol = '', thousandSeparator = true, prefix = '', suffix = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
4
+ const { type = 'number', ratio = 1, thousandSeparator = true, prefix = '', suffix = '', symbol = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
5
5
  const numFormatterOptions = {
6
6
  style: 'decimal',
7
7
  notation: 'scientific' === type ? 'scientific' : 'standard',
@@ -41,7 +41,8 @@ const createNumFormatter = (format, locale = intl.getLocale())=>{
41
41
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
42
42
  numStr = parts.join('.');
43
43
  }
44
- return `${prefix}${numStr}${typeSymbol}${symbol}${suffix}`;
44
+ const validSymbol = symbol ?? '';
45
+ return `${prefix}${numStr}${typeSymbol}${validSymbol}${suffix}`;
45
46
  };
46
47
  };
47
48
  const autoNumFormatter = (value, locale = intl.getLocale())=>{
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/utils/format/createNumFormatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/utils/format/createNumFormatter.ts"],"sourcesContent":["import { isNumber } from 'remeda'\nimport { intl } from '../../../i18n'\nimport type { Formatter, Locale, NumFormat } from 'src/types'\n\nexport const createNumFormatter = (format?: Partial<NumFormat>, locale: Locale = intl.getLocale()): Formatter => {\n const {\n type = 'number',\n ratio = 1,\n symbol = '',\n thousandSeparator = true,\n prefix = '',\n suffix = '',\n\n fractionDigits = 2,\n significantDigits,\n roundingMode = 'halfExpand',\n roundingPriority = 'auto',\n } = format || {}\n\n const numFormatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n notation: type === 'scientific' ? 'scientific' : 'standard',\n // @ts-expect-error roundingMode is not in NumberFormatOptions\n roundingMode,\n roundingPriority,\n }\n\n if (isNumber(fractionDigits)) {\n if (fractionDigits >= 0) {\n numFormatterOptions.minimumFractionDigits = fractionDigits\n numFormatterOptions.maximumFractionDigits = fractionDigits\n }\n }\n if (isNumber(significantDigits) && significantDigits > 0) {\n if (significantDigits > 0) {\n numFormatterOptions.minimumSignificantDigits = significantDigits\n numFormatterOptions.maximumSignificantDigits = significantDigits\n }\n }\n\n const numFormatter = new Intl.NumberFormat(locale, { ...numFormatterOptions, useGrouping: thousandSeparator })\n\n return (value?: number | string) => {\n let num = Number(value)\n let typeSymbol = ''\n if (Number.isNaN(num)) {\n return String(value)\n }\n\n // apply ratio for percent/permille\n if (type === 'percent') {\n num *= 100\n typeSymbol = '%'\n } else if (type === 'permille') {\n num *= 1000\n typeSymbol = '‰'\n } else if (type === 'number') {\n num = num / (ratio || 1)\n }\n\n // format value\n let numStr = numFormatter.format(num)\n\n // add thousand separator\n if (thousandSeparator) {\n const parts = numStr.split('.')\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n numStr = parts.join('.')\n }\n\n // add symbol, typeSymbol, prefix and suffix\n return `${prefix}${numStr}${typeSymbol}${symbol}${suffix}`\n }\n}\n\nexport const autoNumFormatter = (value?: number | string, locale: Locale = intl.getLocale()): string => {\n if (value === undefined || value === null) return String(value)\n const num = Number(value)\n if (Number.isNaN(num)) return String(value)\n\n const numFormatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n notation: 'compact',\n useGrouping: true,\n }\n numFormatterOptions.minimumFractionDigits = 0\n numFormatterOptions.maximumFractionDigits = 2\n\n const numFormatter = new Intl.NumberFormat(locale, { ...numFormatterOptions })\n\n return numFormatter.format(Number(value))\n}\n"],"names":["createNumFormatter","format","locale","intl","type","ratio","symbol","thousandSeparator","prefix","suffix","fractionDigits","significantDigits","roundingMode","roundingPriority","numFormatterOptions","isNumber","numFormatter","Intl","value","num","Number","typeSymbol","String","numStr","parts","autoNumFormatter"],"mappings":";;AAIO,MAAMA,qBAAqB,CAACC,QAA6BC,SAAiBC,KAAK,SAAS,EAAE;IAC/F,MAAM,EACJC,OAAO,QAAQ,EACfC,QAAQ,CAAC,EACTC,SAAS,EAAE,EACXC,oBAAoB,IAAI,EACxBC,SAAS,EAAE,EACXC,SAAS,EAAE,EAEXC,iBAAiB,CAAC,EAClBC,iBAAiB,EACjBC,eAAe,YAAY,EAC3BC,mBAAmB,MAAM,EAC1B,GAAGZ,UAAU,CAAC;IAEf,MAAMa,sBAAgD;QACpD,OAAO;QACP,UAAUV,AAAS,iBAATA,OAAwB,eAAe;QAEjDQ;QACAC;IACF;IAEA,IAAIE,SAASL,iBACX;QAAA,IAAIA,kBAAkB,GAAG;YACvBI,oBAAoB,qBAAqB,GAAGJ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AGY,mBAAmB;IAAC;IAE5E,OAAOE,aAAa,MAAM,CAACI,OAAOF;AACpC"}
1
+ {"version":3,"file":"pipeline/utils/format/createNumFormatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/utils/format/createNumFormatter.ts"],"sourcesContent":["import { isNumber } from 'remeda'\nimport { intl } from '../../../i18n'\nimport type { Formatter, Locale, NumFormat } from 'src/types'\n\nexport const createNumFormatter = (format?: Partial<NumFormat>, locale: Locale = intl.getLocale()): Formatter => {\n const {\n type = 'number',\n ratio = 1,\n thousandSeparator = true,\n prefix = '',\n suffix = '',\n symbol = '',\n fractionDigits = 2,\n significantDigits,\n roundingMode = 'halfExpand',\n roundingPriority = 'auto',\n } = format || {}\n\n const numFormatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n notation: type === 'scientific' ? 'scientific' : 'standard',\n // @ts-expect-error roundingMode is not in NumberFormatOptions\n roundingMode,\n roundingPriority,\n }\n\n if (isNumber(fractionDigits)) {\n if (fractionDigits >= 0) {\n numFormatterOptions.minimumFractionDigits = fractionDigits\n numFormatterOptions.maximumFractionDigits = fractionDigits\n }\n }\n if (isNumber(significantDigits) && significantDigits > 0) {\n if (significantDigits > 0) {\n numFormatterOptions.minimumSignificantDigits = significantDigits\n numFormatterOptions.maximumSignificantDigits = significantDigits\n }\n }\n\n const numFormatter = new Intl.NumberFormat(locale, { ...numFormatterOptions, useGrouping: thousandSeparator })\n\n return (value?: number | string) => {\n let num = Number(value)\n let typeSymbol = ''\n if (Number.isNaN(num)) {\n return String(value)\n }\n\n // apply ratio for percent/permille\n if (type === 'percent') {\n num *= 100\n typeSymbol = '%'\n } else if (type === 'permille') {\n num *= 1000\n typeSymbol = '‰'\n } else if (type === 'number') {\n num = num / (ratio || 1)\n }\n\n // format value\n let numStr = numFormatter.format(num)\n\n // add thousand separator\n if (thousandSeparator) {\n const parts = numStr.split('.')\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n numStr = parts.join('.')\n }\n\n const validSymbol = symbol ?? ''\n\n // add symbol, typeSymbol, prefix and suffix\n return `${prefix}${numStr}${typeSymbol}${validSymbol}${suffix}`\n }\n}\n\nexport const autoNumFormatter = (value?: number | string, locale: Locale = intl.getLocale()): string => {\n if (value === undefined || value === null) return String(value)\n const num = Number(value)\n if (Number.isNaN(num)) return String(value)\n\n const numFormatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n notation: 'compact',\n useGrouping: true,\n }\n numFormatterOptions.minimumFractionDigits = 0\n numFormatterOptions.maximumFractionDigits = 2\n\n const numFormatter = new Intl.NumberFormat(locale, { ...numFormatterOptions })\n\n return numFormatter.format(Number(value))\n}\n"],"names":["createNumFormatter","format","locale","intl","type","ratio","thousandSeparator","prefix","suffix","symbol","fractionDigits","significantDigits","roundingMode","roundingPriority","numFormatterOptions","isNumber","numFormatter","Intl","value","num","Number","typeSymbol","String","numStr","parts","validSymbol","autoNumFormatter"],"mappings":";;AAIO,MAAMA,qBAAqB,CAACC,QAA6BC,SAAiBC,KAAK,SAAS,EAAE;IAC/F,MAAM,EACJC,OAAO,QAAQ,EACfC,QAAQ,CAAC,EACTC,oBAAoB,IAAI,EACxBC,SAAS,EAAE,EACXC,SAAS,EAAE,EACXC,SAAS,EAAE,EACXC,iBAAiB,CAAC,EAClBC,iBAAiB,EACjBC,eAAe,YAAY,EAC3BC,mBAAmB,MAAM,EAC1B,GAAGZ,UAAU,CAAC;IAEf,MAAMa,sBAAgD;QACpD,OAAO;QACP,UAAUV,AAAS,iBAATA,OAAwB,eAAe;QAEjDQ;QACAC;IACF;IAEA,IAAIE,SAASL,iBACX;QAAA,IAAIA,kBAAkB,GAAG;YACvBI,oBAAoB,qBAAqB,GAAGJ;YAC5CI,oBAAoB,qBAAqB,GAAGJ;QAC9C;IAAA;IAEF,IAAIK,SAASJ,sBAAsBA,oBAAoB,GACrD;QAAA,IAAIA,oBAAoB,GAAG;YACzBG,oBAAoB,wBAAwB,GAAGH;YAC/CG,oBAAoB,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050
  const createNumFormatter = (format, locale = intl.getLocale())=>{
1051
- const { type = 'number', ratio = 1, symbol = '', thousandSeparator = true, prefix = '', suffix = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
1051
+ const { type = 'number', ratio = 1, thousandSeparator = true, prefix = '', suffix = '', symbol = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
1052
1052
  const numFormatterOptions = {
1053
1053
  style: 'decimal',
1054
1054
  notation: 'scientific' === type ? 'scientific' : 'standard',
@@ -1088,7 +1088,8 @@
1088
1088
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
1089
1089
  numStr = parts.join('.');
1090
1090
  }
1091
- return `${prefix}${numStr}${typeSymbol}${symbol}${suffix}`;
1091
+ const validSymbol = symbol ?? '';
1092
+ return `${prefix}${numStr}${typeSymbol}${validSymbol}${suffix}`;
1092
1093
  };
1093
1094
  };
1094
1095
  const autoNumFormatter = (value, locale = intl.getLocale())=>{
@@ -3271,22 +3272,6 @@
3271
3272
  }
3272
3273
  return result;
3273
3274
  };
3274
- function chunk_HVPVHFDT_i(...e) {
3275
- return chunk_WIMGWYZL_u(chunk_HVPVHFDT_p, e);
3276
- }
3277
- var chunk_HVPVHFDT_p = (e, d)=>{
3278
- let r = Object.create(null);
3279
- for(let n = 0; n < e.length; n++){
3280
- let t = e[n], y = d(t, n, e);
3281
- if (void 0 !== y) {
3282
- let o = r[y];
3283
- void 0 === o ? r[y] = [
3284
- t
3285
- ] : o.push(t);
3286
- }
3287
- }
3288
- return Object.setPrototypeOf(r, Object.prototype), r;
3289
- };
3290
3275
  const getCurveType = (vseed, lineSmooth = false)=>{
3291
3276
  if (!lineSmooth) return 'linear';
3292
3277
  return isRadar(vseed) ? 'catmullRomClosed' : 'monotone';
@@ -3297,8 +3282,7 @@
3297
3282
  };
3298
3283
  const lineStyle_lineStyle = (spec, context)=>{
3299
3284
  const { advancedVSeed } = context;
3300
- const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
3301
- const { unfoldInfo } = datasetReshapeInfo[0];
3285
+ const { markStyle } = advancedVSeed;
3302
3286
  const { lineStyle } = markStyle;
3303
3287
  const result = {
3304
3288
  ...spec,
@@ -3310,8 +3294,6 @@
3310
3294
  const lineStyles = Array.isArray(lineStyle) ? lineStyle : [
3311
3295
  lineStyle
3312
3296
  ];
3313
- const colorId = unfoldInfo.encodingColorId;
3314
- const lineGroups = chunk_HVPVHFDT_i(dataset, (d)=>d[colorId ?? '']);
3315
3297
  const customMap = lineStyles.reduce((result, style, index)=>{
3316
3298
  const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
3317
3299
  const dashSegment = 2 * lineWidth;
@@ -3332,8 +3314,8 @@
3332
3314
  ...result,
3333
3315
  [`custom${index + 1}`]: {
3334
3316
  level: index + 1,
3335
- filter: (datum)=>{
3336
- const lineData = lineGroups[datum[colorId ?? '']];
3317
+ filter: (_, node)=>{
3318
+ const lineData = node.renderNode.context.data;
3337
3319
  for (const d of lineData)if (selector_selector(d, style.selector)) return true;
3338
3320
  return false;
3339
3321
  },
@@ -5905,6 +5887,22 @@
5905
5887
  }
5906
5888
  return result;
5907
5889
  };
5890
+ function chunk_HVPVHFDT_i(...e) {
5891
+ return chunk_WIMGWYZL_u(chunk_HVPVHFDT_p, e);
5892
+ }
5893
+ var chunk_HVPVHFDT_p = (e, d)=>{
5894
+ let r = Object.create(null);
5895
+ for(let n = 0; n < e.length; n++){
5896
+ let t = e[n], y = d(t, n, e);
5897
+ if (void 0 !== y) {
5898
+ let o = r[y];
5899
+ void 0 === o ? r[y] = [
5900
+ t
5901
+ ] : o.push(t);
5902
+ }
5903
+ }
5904
+ return Object.setPrototypeOf(r, Object.prototype), r;
5905
+ };
5908
5906
  const areaStyle_areaStyle = (spec, context)=>{
5909
5907
  const { advancedVSeed } = context;
5910
5908
  const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;