@visactor/vseed 0.0.9 → 0.0.11

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.
Files changed (38) hide show
  1. package/dist/builder/builder/builder.d.ts +1035 -36
  2. package/dist/index.cjs +923 -66
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +905 -63
  5. package/dist/index.js.map +1 -1
  6. package/dist/pipeline/advanced/pipes/annotation/annotation.d.ts +2 -0
  7. package/dist/pipeline/advanced/pipes/annotation/index.d.ts +1 -0
  8. package/dist/pipeline/advanced/pipes/index.d.ts +1 -0
  9. package/dist/pipeline/spec/pipes/annotation/annotationArea.d.ts +2 -0
  10. package/dist/pipeline/spec/pipes/annotation/annotationAreaBand.d.ts +2 -0
  11. package/dist/pipeline/spec/pipes/annotation/annotationHorizontalLine.d.ts +2 -0
  12. package/dist/pipeline/spec/pipes/annotation/annotationPoint.d.ts +2 -0
  13. package/dist/pipeline/spec/pipes/annotation/annotationVerticalLine.d.ts +2 -0
  14. package/dist/pipeline/spec/pipes/annotation/index.d.ts +5 -0
  15. package/dist/pipeline/spec/pipes/annotation/utils.d.ts +2 -0
  16. package/dist/pipeline/spec/pipes/index.d.ts +1 -0
  17. package/dist/types/advancedVSeed.d.ts +886 -12
  18. package/dist/types/builder/builder.d.ts +3 -0
  19. package/dist/types/chartType/area/area.d.ts +21 -1
  20. package/dist/types/chartType/areaPercent/areaPercent.d.ts +21 -1
  21. package/dist/types/chartType/bar/bar.d.ts +21 -1
  22. package/dist/types/chartType/barParallel/barParallel.d.ts +21 -1
  23. package/dist/types/chartType/barPercent/barPercent.d.ts +21 -1
  24. package/dist/types/chartType/column/column.d.ts +21 -1
  25. package/dist/types/chartType/columnParallel/columnParallel.d.ts +21 -1
  26. package/dist/types/chartType/columnPercent/columnPercent.d.ts +21 -1
  27. package/dist/types/chartType/line/line.d.ts +21 -1
  28. package/dist/types/dataSelector/selector.d.ts +60 -6
  29. package/dist/types/properties/annotation/annotation.d.ts +824 -0
  30. package/dist/types/properties/annotation/annotationArea.d.ts +248 -0
  31. package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +253 -0
  32. package/dist/types/properties/annotation/annotationPoint.d.ts +199 -0
  33. package/dist/types/properties/annotation/annotationVerticalLine.d.ts +253 -0
  34. package/dist/types/properties/annotation/index.d.ts +5 -0
  35. package/dist/types/properties/index.d.ts +1 -0
  36. package/dist/types/properties/markStyle/barStyle.d.ts +65 -13
  37. package/dist/types/properties/markStyle/markStyle.d.ts +64 -12
  38. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { clone as external_remeda_clone, mergeDeep as external_remeda_mergeDeep, omit, pick as external_remeda_pick, unique } from "remeda";
1
+ import { clone as external_remeda_clone, isArray, isNumber, isString, mergeDeep as external_remeda_mergeDeep, omit, pick as external_remeda_pick, unique } from "remeda";
2
2
  import { z } from "zod";
3
3
  const initAdvancedVSeed = (advancedVSeed, context)=>{
4
4
  const { vseed } = context;
@@ -639,6 +639,19 @@ const markStyle_markStyle = (advancedVSeed, context)=>{
639
639
  markStyle
640
640
  };
641
641
  };
642
+ const annotation_annotation = (advancedVSeed, context)=>{
643
+ const { vseed } = context;
644
+ const annotation = external_remeda_pick(vseed, [
645
+ 'annotationPoint',
646
+ 'annotationHorizontalLine',
647
+ 'annotationVerticalLine',
648
+ 'annotationArea'
649
+ ]);
650
+ return {
651
+ ...advancedVSeed,
652
+ annotation
653
+ };
654
+ };
642
655
  const lineAdvancedPipeline = [
643
656
  initAdvancedVSeed,
644
657
  autoMeasures,
@@ -651,7 +664,8 @@ const lineAdvancedPipeline = [
651
664
  encodingXY,
652
665
  vchartBaseConfig,
653
666
  lineConfig,
654
- vchartTheme
667
+ vchartTheme,
668
+ annotation_annotation
655
669
  ];
656
670
  const barAdvancedPipeline = [
657
671
  initAdvancedVSeed,
@@ -666,7 +680,8 @@ const barAdvancedPipeline = [
666
680
  barConfig,
667
681
  vchartBaseConfig,
668
682
  vchartTheme,
669
- markStyle_markStyle
683
+ markStyle_markStyle,
684
+ annotation_annotation
670
685
  ];
671
686
  const barParallelAdvancedPipeline = [
672
687
  initAdvancedVSeed,
@@ -681,7 +696,8 @@ const barParallelAdvancedPipeline = [
681
696
  barParallelConfig,
682
697
  vchartBaseConfig,
683
698
  vchartTheme,
684
- markStyle_markStyle
699
+ markStyle_markStyle,
700
+ annotation_annotation
685
701
  ];
686
702
  const barPercentAdvancedPipeline = [
687
703
  initAdvancedVSeed,
@@ -696,7 +712,8 @@ const barPercentAdvancedPipeline = [
696
712
  barPercentConfig,
697
713
  vchartBaseConfig,
698
714
  vchartTheme,
699
- markStyle_markStyle
715
+ markStyle_markStyle,
716
+ annotation_annotation
700
717
  ];
701
718
  const columnAdvancedPipeline = [
702
719
  initAdvancedVSeed,
@@ -711,7 +728,8 @@ const columnAdvancedPipeline = [
711
728
  columnConfig,
712
729
  vchartBaseConfig,
713
730
  vchartTheme,
714
- markStyle_markStyle
731
+ markStyle_markStyle,
732
+ annotation_annotation
715
733
  ];
716
734
  const columnParallelAdvancedPipeline = [
717
735
  initAdvancedVSeed,
@@ -726,7 +744,8 @@ const columnParallelAdvancedPipeline = [
726
744
  columnParallelConfig,
727
745
  vchartBaseConfig,
728
746
  vchartTheme,
729
- markStyle_markStyle
747
+ markStyle_markStyle,
748
+ annotation_annotation
730
749
  ];
731
750
  const columnPercentAdvancedPipeline = [
732
751
  initAdvancedVSeed,
@@ -741,7 +760,8 @@ const columnPercentAdvancedPipeline = [
741
760
  columnPercentConfig,
742
761
  vchartBaseConfig,
743
762
  vchartTheme,
744
- markStyle_markStyle
763
+ markStyle_markStyle,
764
+ annotation_annotation
745
765
  ];
746
766
  const areaAdvancedPipeline = [
747
767
  initAdvancedVSeed,
@@ -755,7 +775,8 @@ const areaAdvancedPipeline = [
755
775
  encodingXY,
756
776
  areaConfig,
757
777
  vchartBaseConfig,
758
- vchartTheme
778
+ vchartTheme,
779
+ annotation_annotation
759
780
  ];
760
781
  const areaPercentAdvancedPipeline = [
761
782
  initAdvancedVSeed,
@@ -769,7 +790,8 @@ const areaPercentAdvancedPipeline = [
769
790
  encodingXY,
770
791
  areaPercentConfig,
771
792
  vchartBaseConfig,
772
- vchartTheme
793
+ vchartTheme,
794
+ annotation_annotation
773
795
  ];
774
796
  const pieAdvancedPipeline = [
775
797
  initAdvancedVSeed,
@@ -783,7 +805,8 @@ const pieAdvancedPipeline = [
783
805
  encodingPolar,
784
806
  pieConfig,
785
807
  vchartBaseConfig,
786
- vchartTheme
808
+ vchartTheme,
809
+ annotation_annotation
787
810
  ];
788
811
  const dataset_dataset = (spec, context)=>{
789
812
  const { advancedVSeed } = context;
@@ -1812,11 +1835,13 @@ const selector_selector = (datum, selector)=>{
1812
1835
  for (const selector of selectors)if (isValueSelector(selector)) {
1813
1836
  if (Object.values(datum).find((v)=>v === selector)) return true;
1814
1837
  } else if (isMeasureSelector(selector)) {
1838
+ const op = selector.operator || selector.op;
1815
1839
  const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
1816
1840
  selector.value
1817
1841
  ];
1818
- switch(selector.operator){
1842
+ switch(op){
1819
1843
  case '=':
1844
+ case '==':
1820
1845
  if (datum[selector.field] === selectorValueArr[0]) return true;
1821
1846
  break;
1822
1847
  case '!=':
@@ -1841,11 +1866,20 @@ const selector_selector = (datum, selector)=>{
1841
1866
  break;
1842
1867
  }
1843
1868
  } else if (isDimensionSelector(selector)) {
1869
+ const op = selector.operator || selector.op;
1844
1870
  const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
1845
1871
  selector.value
1846
1872
  ];
1847
- if ('in' === selector.operator && selectorValueArr.includes(datum[selector.field])) return true;
1848
- if ('not in' === selector.operator && !selectorValueArr.includes(datum[selector.field])) return true;
1873
+ switch(op){
1874
+ case 'in':
1875
+ if (selectorValueArr.includes(datum[selector.field])) return true;
1876
+ break;
1877
+ case 'not in':
1878
+ if (!selectorValueArr.includes(datum[selector.field])) return true;
1879
+ break;
1880
+ default:
1881
+ break;
1882
+ }
1849
1883
  } else if (isPartialDatumSelector(selector)) {
1850
1884
  if (Object.keys(selector).every((key)=>datum[key] === selector[key])) return true;
1851
1885
  }
@@ -1853,19 +1887,32 @@ const selector_selector = (datum, selector)=>{
1853
1887
  };
1854
1888
  const isValueSelector = (selector)=>'string' == typeof selector || 'number' == typeof selector;
1855
1889
  const isPartialDatumSelector = (selector)=>'object' == typeof selector && null !== selector;
1856
- const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
1890
+ const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
1857
1891
  '=',
1892
+ '==',
1858
1893
  '!=',
1859
1894
  '>',
1860
1895
  '<',
1861
1896
  '>=',
1862
1897
  '<=',
1863
1898
  'between'
1864
- ].includes(selector.operator);
1865
- const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
1899
+ ].includes(selector.operator) || [
1900
+ '=',
1901
+ '==',
1902
+ '!=',
1903
+ '>',
1904
+ '<',
1905
+ '>=',
1906
+ '<=',
1907
+ 'between'
1908
+ ].includes(selector.op));
1909
+ const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
1910
+ 'in',
1911
+ 'not in'
1912
+ ].includes(selector.operator) || [
1866
1913
  'in',
1867
1914
  'not in'
1868
- ].includes(selector.operator);
1915
+ ].includes(selector.op));
1869
1916
  const barStyle_barStyle = (spec, context)=>{
1870
1917
  const { advancedVSeed } = context;
1871
1918
  const { markStyle, encoding } = advancedVSeed;
@@ -1879,23 +1926,23 @@ const barStyle_barStyle = (spec, context)=>{
1879
1926
  ...result,
1880
1927
  bar: {
1881
1928
  style: {
1882
- fill: (datum, context)=>{
1929
+ fill: barColor ? (datum, context)=>{
1883
1930
  if (selector_selector(datum, barSelector)) return barColor;
1884
1931
  return context.seriesColor(datum[encoding[0]?.group?.[0]]);
1885
- },
1886
- fillOpacity: (datum)=>{
1932
+ } : void 0,
1933
+ fillOpacity: barColorOpacity ? (datum)=>{
1887
1934
  if (selector_selector(datum, barSelector)) return barColorOpacity;
1888
1935
  return 1;
1889
- },
1890
- stroke: (datum, context)=>{
1936
+ } : void 0,
1937
+ stroke: barBorderColor ? (datum, context)=>{
1891
1938
  if (selector_selector(datum, barSelector)) return barBorderColor;
1892
1939
  return context.seriesColor(datum[encoding[0]?.group?.[0]]);
1893
- },
1894
- lineWidth: (datum)=>{
1940
+ } : void 0,
1941
+ lineWidth: barBorderWidth ? (datum)=>{
1895
1942
  if (selector_selector(datum, barSelector)) return barBorderWidth;
1896
1943
  return 0;
1897
- },
1898
- lineDash: (datum)=>{
1944
+ } : void 0,
1945
+ lineDash: barBorderStyle ? (datum)=>{
1899
1946
  if (selector_selector(datum, barSelector)) {
1900
1947
  if ('solid' === barBorderStyle) ;
1901
1948
  else if ('dashed' === barBorderStyle) return [
@@ -1911,15 +1958,518 @@ const barStyle_barStyle = (spec, context)=>{
1911
1958
  0,
1912
1959
  0
1913
1960
  ];
1914
- },
1915
- cornerRadius: (datum)=>{
1961
+ } : void 0,
1962
+ cornerRadius: barRadius ? (datum)=>{
1916
1963
  if (selector_selector(datum, barSelector)) return barRadius;
1917
1964
  return 0;
1918
- }
1965
+ } : void 0
1919
1966
  }
1920
1967
  }
1921
1968
  };
1922
1969
  };
1970
+ const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
1971
+ if ('string' == typeof value) return obj[key] === value;
1972
+ if ('number' == typeof value) return obj[key] === value;
1973
+ return true;
1974
+ });
1975
+ const annotationPoint_annotationPoint = (spec, context)=>{
1976
+ const { advancedVSeed } = context;
1977
+ const { annotation } = advancedVSeed;
1978
+ if (!annotation || !annotation.annotationPoint) return spec;
1979
+ const { annotationPoint } = annotation;
1980
+ const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
1981
+ annotationPoint
1982
+ ];
1983
+ const markPoint = annotationPointList.flatMap((annotationPoint)=>{
1984
+ const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
1985
+ const dataset = advancedVSeed.dataset.flat();
1986
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
1987
+ return selectedData.map((datum)=>({
1988
+ regionRelative: true,
1989
+ position: (data, context)=>{
1990
+ const targetDatum = data.find((item)=>isSubset(datum, item));
1991
+ if (targetDatum) {
1992
+ const { x, y } = context.dataToPosition(targetDatum);
1993
+ const xBandWidth = context.scaleX?.bandwidth?.();
1994
+ const yBandWidth = context.scaleY?.bandwidth?.();
1995
+ if (xBandWidth) return {
1996
+ x: x,
1997
+ y: y
1998
+ };
1999
+ if (yBandWidth) return {
2000
+ x,
2001
+ y: y
2002
+ };
2003
+ }
2004
+ },
2005
+ itemLine: {
2006
+ visible: false
2007
+ },
2008
+ itemContent: {
2009
+ offsetY,
2010
+ offsetX,
2011
+ text: {
2012
+ visible: true,
2013
+ text: text,
2014
+ style: {
2015
+ textAlign: textAlign,
2016
+ textBaseline: textBaseline,
2017
+ fill: textColor,
2018
+ fontSize: textFontSize,
2019
+ fontWeight: textFontWeight
2020
+ },
2021
+ labelBackground: {
2022
+ visible: backgroundVisible,
2023
+ padding: backgroundPadding,
2024
+ style: {
2025
+ cornerRadius: backgroundBorderRadius ?? 4,
2026
+ fill: backgroundColor,
2027
+ stroke: backgroundBorderColor,
2028
+ strokeWidth: backgroundBorderWidth
2029
+ }
2030
+ }
2031
+ }
2032
+ }
2033
+ }));
2034
+ });
2035
+ return {
2036
+ ...spec,
2037
+ markPoint
2038
+ };
2039
+ };
2040
+ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2041
+ const { advancedVSeed } = context;
2042
+ const { annotation, encoding } = advancedVSeed;
2043
+ if (!annotation || !annotation.annotationVerticalLine) return spec;
2044
+ const { annotationVerticalLine } = annotation;
2045
+ const annotationVerticalLineList = Array.isArray(annotationVerticalLine) ? annotationVerticalLine : [
2046
+ annotationVerticalLine
2047
+ ];
2048
+ const positionMap = {
2049
+ outsideStart: 'start',
2050
+ outsideEnd: 'end',
2051
+ outsideMiddle: 'middle',
2052
+ insideStart: 'insideStartTop',
2053
+ insideMiddle: 'insideMiddleTop',
2054
+ insideEnd: 'insideEndTop'
2055
+ };
2056
+ const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2057
+ const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1 } = annotationVerticalLine;
2058
+ const dataset = advancedVSeed.dataset.flat();
2059
+ const generateOneMarkLine = (x)=>({
2060
+ x: x,
2061
+ line: {
2062
+ visible: lineVisible,
2063
+ style: {
2064
+ offsetX,
2065
+ offsetY,
2066
+ stroke: lineColor,
2067
+ lineStyle: lineStyle,
2068
+ lineWidth: lineWidth,
2069
+ lineDash: 'dashed' === lineStyle ? [
2070
+ 5,
2071
+ 2
2072
+ ] : 'dotted' === lineStyle ? [
2073
+ 2,
2074
+ 5
2075
+ ] : [
2076
+ 0
2077
+ ]
2078
+ }
2079
+ },
2080
+ label: {
2081
+ text: text,
2082
+ position: positionMap[textPosition],
2083
+ style: {
2084
+ offsetX,
2085
+ offsetY,
2086
+ visible: true,
2087
+ textAlign: textAlign,
2088
+ textBaseline: textBaseline,
2089
+ fill: textColor,
2090
+ fontSize: textFontSize,
2091
+ fontWeight: textFontWeight
2092
+ },
2093
+ labelBackground: {
2094
+ visible: backgroundVisible,
2095
+ padding: backgroundPadding,
2096
+ style: {
2097
+ offsetX,
2098
+ offsetY,
2099
+ cornerRadius: backgroundBorderRadius ?? 4,
2100
+ fill: backgroundColor,
2101
+ stroke: backgroundBorderColor,
2102
+ strokeWidth: backgroundBorderWidth
2103
+ }
2104
+ }
2105
+ },
2106
+ endSymbol: {
2107
+ visible: true,
2108
+ style: {
2109
+ fill: lineColor
2110
+ }
2111
+ }
2112
+ });
2113
+ if (!selectorPoint && isArray(xValue) || isString(xValue) || isNumber(xValue)) {
2114
+ const xValueArr = Array.isArray(xValue) ? xValue : [
2115
+ xValue
2116
+ ];
2117
+ return xValueArr.map(generateOneMarkLine);
2118
+ }
2119
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2120
+ return selectedData.map((datum)=>{
2121
+ const x = encoding[0]?.x?.[0];
2122
+ if (!x) return {};
2123
+ return generateOneMarkLine(datum[x]);
2124
+ });
2125
+ });
2126
+ const specMarkLine = spec.markLine || [];
2127
+ const newMarkLine = [
2128
+ ...specMarkLine,
2129
+ ...markLine || []
2130
+ ];
2131
+ return {
2132
+ ...spec,
2133
+ markLine: newMarkLine
2134
+ };
2135
+ };
2136
+ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2137
+ const { advancedVSeed } = context;
2138
+ const { annotation, encoding } = advancedVSeed;
2139
+ if (!annotation || !annotation.annotationHorizontalLine) return spec;
2140
+ const { annotationHorizontalLine } = annotation;
2141
+ const annotationVerticalLineList = Array.isArray(annotationHorizontalLine) ? annotationHorizontalLine : [
2142
+ annotationHorizontalLine
2143
+ ];
2144
+ const positionMap = {
2145
+ outsideStart: 'start',
2146
+ outsideEnd: 'end',
2147
+ outsideMiddle: 'middle',
2148
+ insideStart: 'insideStartTop',
2149
+ insideMiddle: 'insideMiddleTop',
2150
+ insideEnd: 'insideEndTop'
2151
+ };
2152
+ const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2153
+ const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'bottom', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1 } = annotationVerticalLine;
2154
+ const dataset = advancedVSeed.dataset.flat();
2155
+ const generateOneMarkLine = (y)=>({
2156
+ y,
2157
+ line: {
2158
+ visible: lineVisible,
2159
+ style: {
2160
+ offsetX,
2161
+ offsetY,
2162
+ stroke: lineColor,
2163
+ lineStyle: lineStyle,
2164
+ lineWidth: lineWidth,
2165
+ lineDash: 'dashed' === lineStyle ? [
2166
+ 5,
2167
+ 2
2168
+ ] : 'dotted' === lineStyle ? [
2169
+ 2,
2170
+ 5
2171
+ ] : [
2172
+ 0
2173
+ ]
2174
+ }
2175
+ },
2176
+ label: {
2177
+ text: text,
2178
+ position: positionMap[textPosition],
2179
+ style: {
2180
+ offsetX,
2181
+ offsetY,
2182
+ visible: true,
2183
+ textAlign: textAlign,
2184
+ textBaseline: textBaseline,
2185
+ fill: textColor,
2186
+ fontSize: textFontSize,
2187
+ fontWeight: textFontWeight
2188
+ },
2189
+ labelBackground: {
2190
+ visible: backgroundVisible,
2191
+ padding: backgroundPadding,
2192
+ style: {
2193
+ offsetX,
2194
+ offsetY,
2195
+ cornerRadius: backgroundBorderRadius ?? 4,
2196
+ fill: backgroundColor,
2197
+ stroke: backgroundBorderColor,
2198
+ strokeWidth: backgroundBorderWidth
2199
+ }
2200
+ }
2201
+ },
2202
+ endSymbol: {
2203
+ visible: true,
2204
+ style: {
2205
+ fill: lineColor
2206
+ }
2207
+ }
2208
+ });
2209
+ if (!selectorPoint && isArray(yValue) || isString(yValue) || isNumber(yValue)) {
2210
+ const yValueArr = Array.isArray(yValue) ? yValue : [
2211
+ yValue
2212
+ ];
2213
+ return yValueArr.map(generateOneMarkLine);
2214
+ }
2215
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2216
+ return selectedData.map((datum)=>{
2217
+ const y = encoding[0]?.y?.[0];
2218
+ if (!y) return {};
2219
+ return generateOneMarkLine(datum[y]);
2220
+ });
2221
+ });
2222
+ const specMarkLine = spec.markLine || [];
2223
+ const newMarkLine = [
2224
+ ...specMarkLine,
2225
+ ...markLine || []
2226
+ ];
2227
+ return {
2228
+ ...spec,
2229
+ markLine: newMarkLine
2230
+ };
2231
+ };
2232
+ const annotationArea_annotationArea = (spec, context)=>{
2233
+ const { advancedVSeed } = context;
2234
+ const { annotation } = advancedVSeed;
2235
+ if (!annotation || !annotation.annotationArea) return spec;
2236
+ const { annotationArea } = annotation;
2237
+ const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
2238
+ annotationArea
2239
+ ];
2240
+ const positionMap = {
2241
+ top: 'insideTop',
2242
+ topRight: 'insideTopRight',
2243
+ topLeft: 'insideTopLeft',
2244
+ bottom: 'insideBottom',
2245
+ bottomLeft: 'insideBottomLeft',
2246
+ bottomRight: 'insideBottomRight',
2247
+ left: 'insideLeft',
2248
+ right: 'insideRight'
2249
+ };
2250
+ const markArea = annotationAreaList.flatMap((annotationArea)=>{
2251
+ const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 4, backgroundVisible = true, outerPadding = 8, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth } = annotationArea;
2252
+ const dataset = advancedVSeed.dataset.flat();
2253
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2254
+ return {
2255
+ regionRelative: true,
2256
+ positions: (data, context)=>{
2257
+ console.log('debug selectedData', selectedData);
2258
+ const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
2259
+ const xyList = positionData.map((datum)=>context.dataToPosition(datum));
2260
+ const xScale = context.scaleX;
2261
+ const yScale = context.scaleY;
2262
+ const xBandWidth = xScale?.bandwidth?.();
2263
+ const yBandWidth = yScale?.bandwidth?.();
2264
+ if (xBandWidth) {
2265
+ const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
2266
+ const maxX = Math.max(...xyList.map((item)=>item.x)) + outerPadding;
2267
+ const minY = Math.min(...yScale.range());
2268
+ const maxY = Math.max(...yScale.range());
2269
+ return [
2270
+ {
2271
+ x: minX,
2272
+ y: minY
2273
+ },
2274
+ {
2275
+ x: maxX,
2276
+ y: minY
2277
+ },
2278
+ {
2279
+ x: maxX,
2280
+ y: maxY
2281
+ },
2282
+ {
2283
+ x: minX,
2284
+ y: maxY
2285
+ }
2286
+ ];
2287
+ }
2288
+ if (yBandWidth) {
2289
+ const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
2290
+ const maxY = Math.max(...xyList.map((item)=>item.y)) + outerPadding;
2291
+ const minX = Math.min(...xScale.range());
2292
+ const maxX = Math.max(...xScale.range());
2293
+ return [
2294
+ {
2295
+ x: minX,
2296
+ y: minY
2297
+ },
2298
+ {
2299
+ x: maxX,
2300
+ y: minY
2301
+ },
2302
+ {
2303
+ x: maxX,
2304
+ y: maxY
2305
+ },
2306
+ {
2307
+ x: minX,
2308
+ y: maxY
2309
+ }
2310
+ ];
2311
+ }
2312
+ return [];
2313
+ },
2314
+ label: {
2315
+ position: positionMap[textPosition],
2316
+ visible: true,
2317
+ text: text,
2318
+ style: {
2319
+ textAlign: textAlign,
2320
+ textBaseline: textBaseline,
2321
+ fill: textColor,
2322
+ fontSize: textFontSize,
2323
+ fontWeight: textFontWeight
2324
+ },
2325
+ labelBackground: {
2326
+ visible: backgroundVisible,
2327
+ padding: backgroundPadding,
2328
+ style: {
2329
+ cornerRadius: backgroundBorderRadius ?? 4,
2330
+ fill: backgroundColor,
2331
+ stroke: backgroundBorderColor,
2332
+ strokeWidth: backgroundBorderWidth
2333
+ }
2334
+ }
2335
+ },
2336
+ area: {
2337
+ style: {
2338
+ visible: true,
2339
+ fill: areaColor,
2340
+ fillOpacity: areaColorOpacity,
2341
+ stroke: areaBorderColor,
2342
+ strokeWidth: areaBorderWidth,
2343
+ cornerRadius: areaBorderRadius
2344
+ }
2345
+ }
2346
+ };
2347
+ });
2348
+ return {
2349
+ ...spec,
2350
+ markArea: markArea
2351
+ };
2352
+ };
2353
+ const annotationAreaBand = (spec, context)=>{
2354
+ const { advancedVSeed } = context;
2355
+ const { annotation } = advancedVSeed;
2356
+ if (!annotation || !annotation.annotationArea) return spec;
2357
+ const { annotationArea } = annotation;
2358
+ const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
2359
+ annotationArea
2360
+ ];
2361
+ const positionMap = {
2362
+ top: 'insideTop',
2363
+ topRight: 'insideTopRight',
2364
+ topLeft: 'insideTopLeft',
2365
+ bottom: 'insideBottom',
2366
+ bottomLeft: 'insideBottomLeft',
2367
+ bottomRight: 'insideBottomRight',
2368
+ left: 'insideLeft',
2369
+ right: 'insideRight'
2370
+ };
2371
+ const markArea = annotationAreaList.flatMap((annotationArea)=>{
2372
+ const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 4, backgroundVisible = true, outerPadding = 8, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth } = annotationArea;
2373
+ const dataset = advancedVSeed.dataset.flat();
2374
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2375
+ return {
2376
+ regionRelative: true,
2377
+ positions: (data, context)=>{
2378
+ const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
2379
+ const xyList = positionData.map((datum)=>context.dataToPosition(datum));
2380
+ const xScale = context.scaleX;
2381
+ const yScale = context.scaleY;
2382
+ const xBandWidth = xScale?.bandwidth?.();
2383
+ const yBandWidth = yScale?.bandwidth?.();
2384
+ if (xBandWidth) {
2385
+ const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
2386
+ const maxX = Math.max(...xyList.map((item)=>item.x)) + xBandWidth + outerPadding;
2387
+ const minY = Math.min(...yScale.range());
2388
+ const maxY = Math.max(...yScale.range());
2389
+ return [
2390
+ {
2391
+ x: minX,
2392
+ y: minY
2393
+ },
2394
+ {
2395
+ x: maxX,
2396
+ y: minY
2397
+ },
2398
+ {
2399
+ x: maxX,
2400
+ y: maxY
2401
+ },
2402
+ {
2403
+ x: minX,
2404
+ y: maxY
2405
+ }
2406
+ ];
2407
+ }
2408
+ if (yBandWidth) {
2409
+ const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
2410
+ const maxY = Math.max(...xyList.map((item)=>item.y)) + yBandWidth + outerPadding;
2411
+ const minX = Math.min(...xScale.range());
2412
+ const maxX = Math.max(...xScale.range());
2413
+ return [
2414
+ {
2415
+ x: minX,
2416
+ y: minY
2417
+ },
2418
+ {
2419
+ x: maxX,
2420
+ y: minY
2421
+ },
2422
+ {
2423
+ x: maxX,
2424
+ y: maxY
2425
+ },
2426
+ {
2427
+ x: minX,
2428
+ y: maxY
2429
+ }
2430
+ ];
2431
+ }
2432
+ return [];
2433
+ },
2434
+ label: {
2435
+ position: positionMap[textPosition],
2436
+ visible: true,
2437
+ text: text,
2438
+ style: {
2439
+ textAlign: textAlign,
2440
+ textBaseline: textBaseline,
2441
+ fill: textColor,
2442
+ fontSize: textFontSize,
2443
+ fontWeight: textFontWeight
2444
+ },
2445
+ labelBackground: {
2446
+ visible: backgroundVisible,
2447
+ padding: backgroundPadding,
2448
+ style: {
2449
+ cornerRadius: backgroundBorderRadius ?? 4,
2450
+ fill: backgroundColor,
2451
+ stroke: backgroundBorderColor,
2452
+ strokeWidth: backgroundBorderWidth
2453
+ }
2454
+ }
2455
+ },
2456
+ area: {
2457
+ style: {
2458
+ visible: true,
2459
+ fill: areaColor,
2460
+ fillOpacity: areaColorOpacity,
2461
+ stroke: areaBorderColor,
2462
+ strokeWidth: areaBorderWidth,
2463
+ cornerRadius: areaBorderRadius
2464
+ }
2465
+ }
2466
+ };
2467
+ });
2468
+ return {
2469
+ ...spec,
2470
+ markArea: markArea
2471
+ };
2472
+ };
1923
2473
  const line_line = [
1924
2474
  initLine,
1925
2475
  color_color,
@@ -1929,7 +2479,11 @@ const line_line = [
1929
2479
  yLinear,
1930
2480
  label_label,
1931
2481
  tooltip_tooltip,
1932
- discreteLegend
2482
+ discreteLegend,
2483
+ annotationPoint_annotationPoint,
2484
+ annotationVerticalLine_annotationVerticalLine,
2485
+ annotationHorizontalLine_annotationHorizontalLine,
2486
+ annotationArea_annotationArea
1933
2487
  ];
1934
2488
  const pivotLine = [
1935
2489
  initPivot,
@@ -1944,7 +2498,11 @@ const pivotLine = [
1944
2498
  xBand,
1945
2499
  yLinear,
1946
2500
  label_label,
1947
- tooltip_tooltip
2501
+ tooltip_tooltip,
2502
+ annotationPoint_annotationPoint,
2503
+ annotationVerticalLine_annotationVerticalLine,
2504
+ annotationHorizontalLine_annotationHorizontalLine,
2505
+ annotationArea_annotationArea
1948
2506
  ]),
1949
2507
  pivotRowDimensions,
1950
2508
  pivotColumnDimensions,
@@ -1964,7 +2522,11 @@ const column = [
1964
2522
  label_label,
1965
2523
  tooltip_tooltip,
1966
2524
  discreteLegend,
1967
- barStyle_barStyle
2525
+ barStyle_barStyle,
2526
+ annotationPoint_annotationPoint,
2527
+ annotationVerticalLine_annotationVerticalLine,
2528
+ annotationHorizontalLine_annotationHorizontalLine,
2529
+ annotationAreaBand
1968
2530
  ];
1969
2531
  const pivotColumn = [
1970
2532
  initPivot,
@@ -1981,7 +2543,11 @@ const pivotColumn = [
1981
2543
  yLinear,
1982
2544
  label_label,
1983
2545
  tooltip_tooltip,
1984
- barStyle_barStyle
2546
+ barStyle_barStyle,
2547
+ annotationPoint_annotationPoint,
2548
+ annotationVerticalLine_annotationVerticalLine,
2549
+ annotationHorizontalLine_annotationHorizontalLine,
2550
+ annotationAreaBand
1985
2551
  ]),
1986
2552
  pivotRowDimensions,
1987
2553
  pivotColumnDimensions,
@@ -2000,7 +2566,11 @@ const columnParallel = [
2000
2566
  label_label,
2001
2567
  tooltip_tooltip,
2002
2568
  discreteLegend,
2003
- barStyle_barStyle
2569
+ barStyle_barStyle,
2570
+ annotationPoint_annotationPoint,
2571
+ annotationVerticalLine_annotationVerticalLine,
2572
+ annotationHorizontalLine_annotationHorizontalLine,
2573
+ annotationAreaBand
2004
2574
  ];
2005
2575
  const pivotColumnParallel = [
2006
2576
  initPivot,
@@ -2016,7 +2586,11 @@ const pivotColumnParallel = [
2016
2586
  yLinear,
2017
2587
  label_label,
2018
2588
  tooltip_tooltip,
2019
- barStyle_barStyle
2589
+ barStyle_barStyle,
2590
+ annotationPoint_annotationPoint,
2591
+ annotationVerticalLine_annotationVerticalLine,
2592
+ annotationHorizontalLine_annotationHorizontalLine,
2593
+ annotationAreaBand
2020
2594
  ]),
2021
2595
  pivotRowDimensions,
2022
2596
  pivotColumnDimensions,
@@ -2037,7 +2611,11 @@ const columnPercent = [
2037
2611
  label_label,
2038
2612
  tooltip_tooltip,
2039
2613
  discreteLegend,
2040
- barStyle_barStyle
2614
+ barStyle_barStyle,
2615
+ annotationPoint_annotationPoint,
2616
+ annotationVerticalLine_annotationVerticalLine,
2617
+ annotationHorizontalLine_annotationHorizontalLine,
2618
+ annotationAreaBand
2041
2619
  ];
2042
2620
  const pivotColumnPercent = [
2043
2621
  initPivot,
@@ -2055,7 +2633,11 @@ const pivotColumnPercent = [
2055
2633
  yLinear,
2056
2634
  label_label,
2057
2635
  tooltip_tooltip,
2058
- barStyle_barStyle
2636
+ barStyle_barStyle,
2637
+ annotationPoint_annotationPoint,
2638
+ annotationVerticalLine_annotationVerticalLine,
2639
+ annotationHorizontalLine_annotationHorizontalLine,
2640
+ annotationAreaBand
2059
2641
  ]),
2060
2642
  pivotRowDimensions,
2061
2643
  pivotColumnDimensions,
@@ -2074,7 +2656,11 @@ const bar = [
2074
2656
  label_label,
2075
2657
  tooltip_tooltip,
2076
2658
  discreteLegend,
2077
- barStyle_barStyle
2659
+ barStyle_barStyle,
2660
+ annotationPoint_annotationPoint,
2661
+ annotationVerticalLine_annotationVerticalLine,
2662
+ annotationHorizontalLine_annotationHorizontalLine,
2663
+ annotationAreaBand
2078
2664
  ];
2079
2665
  const pivotBar = [
2080
2666
  initPivot,
@@ -2090,7 +2676,11 @@ const pivotBar = [
2090
2676
  label_label,
2091
2677
  label_label,
2092
2678
  tooltip_tooltip,
2093
- barStyle_barStyle
2679
+ barStyle_barStyle,
2680
+ annotationPoint_annotationPoint,
2681
+ annotationVerticalLine_annotationVerticalLine,
2682
+ annotationHorizontalLine_annotationHorizontalLine,
2683
+ annotationAreaBand
2094
2684
  ]),
2095
2685
  pivotRowDimensions,
2096
2686
  pivotColumnDimensions,
@@ -2109,7 +2699,11 @@ const barParallel = [
2109
2699
  label_label,
2110
2700
  tooltip_tooltip,
2111
2701
  discreteLegend,
2112
- barStyle_barStyle
2702
+ barStyle_barStyle,
2703
+ annotationPoint_annotationPoint,
2704
+ annotationVerticalLine_annotationVerticalLine,
2705
+ annotationHorizontalLine_annotationHorizontalLine,
2706
+ annotationAreaBand
2113
2707
  ];
2114
2708
  const pivotBarParallel = [
2115
2709
  initPivot,
@@ -2125,7 +2719,11 @@ const pivotBarParallel = [
2125
2719
  xLinear,
2126
2720
  label_label,
2127
2721
  tooltip_tooltip,
2128
- barStyle_barStyle
2722
+ barStyle_barStyle,
2723
+ annotationPoint_annotationPoint,
2724
+ annotationVerticalLine_annotationVerticalLine,
2725
+ annotationHorizontalLine_annotationHorizontalLine,
2726
+ annotationAreaBand
2129
2727
  ]),
2130
2728
  pivotRowDimensions,
2131
2729
  pivotColumnDimensions,
@@ -2145,7 +2743,11 @@ const barPercent = [
2145
2743
  label_label,
2146
2744
  tooltip_tooltip,
2147
2745
  discreteLegend,
2148
- barStyle_barStyle
2746
+ barStyle_barStyle,
2747
+ annotationPoint_annotationPoint,
2748
+ annotationVerticalLine_annotationVerticalLine,
2749
+ annotationHorizontalLine_annotationHorizontalLine,
2750
+ annotationAreaBand
2149
2751
  ];
2150
2752
  const pivotBarPercent = [
2151
2753
  initPivot,
@@ -2162,7 +2764,11 @@ const pivotBarPercent = [
2162
2764
  xLinear,
2163
2765
  label_label,
2164
2766
  tooltip_tooltip,
2165
- barStyle_barStyle
2767
+ barStyle_barStyle,
2768
+ annotationPoint_annotationPoint,
2769
+ annotationVerticalLine_annotationVerticalLine,
2770
+ annotationHorizontalLine_annotationHorizontalLine,
2771
+ annotationAreaBand
2166
2772
  ]),
2167
2773
  pivotRowDimensions,
2168
2774
  pivotColumnDimensions,
@@ -2181,7 +2787,11 @@ const area_area = [
2181
2787
  yLinear,
2182
2788
  label_label,
2183
2789
  tooltip_tooltip,
2184
- discreteLegend
2790
+ discreteLegend,
2791
+ annotationPoint_annotationPoint,
2792
+ annotationVerticalLine_annotationVerticalLine,
2793
+ annotationHorizontalLine_annotationHorizontalLine,
2794
+ annotationArea_annotationArea
2185
2795
  ];
2186
2796
  const pivotArea = [
2187
2797
  initPivot,
@@ -2197,7 +2807,11 @@ const pivotArea = [
2197
2807
  xBand,
2198
2808
  yLinear,
2199
2809
  label_label,
2200
- tooltip_tooltip
2810
+ tooltip_tooltip,
2811
+ annotationPoint_annotationPoint,
2812
+ annotationVerticalLine_annotationVerticalLine,
2813
+ annotationHorizontalLine_annotationHorizontalLine,
2814
+ annotationArea_annotationArea
2201
2815
  ]),
2202
2816
  pivotRowDimensions,
2203
2817
  pivotColumnDimensions,
@@ -2217,7 +2831,11 @@ const areaPercent = [
2217
2831
  yLinear,
2218
2832
  label_label,
2219
2833
  tooltip_tooltip,
2220
- discreteLegend
2834
+ discreteLegend,
2835
+ annotationPoint_annotationPoint,
2836
+ annotationVerticalLine_annotationVerticalLine,
2837
+ annotationHorizontalLine_annotationHorizontalLine,
2838
+ annotationArea_annotationArea
2221
2839
  ];
2222
2840
  const pivotAreaPercent = [
2223
2841
  initPivot,
@@ -2234,7 +2852,11 @@ const pivotAreaPercent = [
2234
2852
  xBand,
2235
2853
  yLinear,
2236
2854
  label_label,
2237
- tooltip_tooltip
2855
+ tooltip_tooltip,
2856
+ annotationPoint_annotationPoint,
2857
+ annotationVerticalLine_annotationVerticalLine,
2858
+ annotationHorizontalLine_annotationHorizontalLine,
2859
+ annotationArea_annotationArea
2238
2860
  ]),
2239
2861
  pivotRowDimensions,
2240
2862
  pivotColumnDimensions,
@@ -2250,7 +2872,11 @@ const pie = [
2250
2872
  dataset_dataset,
2251
2873
  label_label,
2252
2874
  tooltip_tooltip,
2253
- discreteLegend
2875
+ discreteLegend,
2876
+ annotationPoint_annotationPoint,
2877
+ annotationVerticalLine_annotationVerticalLine,
2878
+ annotationHorizontalLine_annotationHorizontalLine,
2879
+ annotationArea_annotationArea
2254
2880
  ];
2255
2881
  const pivotPie = [
2256
2882
  initPivot,
@@ -2263,7 +2889,11 @@ const pivotPie = [
2263
2889
  background_backgroundColor,
2264
2890
  datasetPivotPlaceholder,
2265
2891
  label_label,
2266
- tooltip_tooltip
2892
+ tooltip_tooltip,
2893
+ annotationPoint_annotationPoint,
2894
+ annotationVerticalLine_annotationVerticalLine,
2895
+ annotationHorizontalLine_annotationHorizontalLine,
2896
+ annotationArea_annotationArea
2267
2897
  ]),
2268
2898
  pivotRowDimensions,
2269
2899
  pivotColumnDimensions,
@@ -2305,17 +2935,17 @@ const buildSpec = (builder, advancedVSeed)=>{
2305
2935
  }
2306
2936
  };
2307
2937
  const build = (builder)=>{
2308
- console.log('debug vseed', builder.vseed);
2309
2938
  const advancedVSeed = builder.buildAdvanced();
2310
- console.log('debug advancedVSeed', advancedVSeed);
2939
+ builder.advancedVSeed = advancedVSeed;
2311
2940
  if (!advancedVSeed) throw new Error('advancedVSeed is null');
2312
2941
  const spec = builder.buildSpec(advancedVSeed);
2313
- console.log('debug spec', spec);
2942
+ builder.spec = spec;
2314
2943
  return spec;
2315
2944
  };
2316
2945
  class Builder {
2317
2946
  _vseed;
2318
2947
  _advancedVSeed = null;
2948
+ _spec = null;
2319
2949
  constructor(vseed){
2320
2950
  this._vseed = vseed;
2321
2951
  }
@@ -2338,6 +2968,12 @@ class Builder {
2338
2968
  set advancedVSeed(value) {
2339
2969
  this._advancedVSeed = value;
2340
2970
  }
2971
+ get spec() {
2972
+ return this._spec;
2973
+ }
2974
+ set spec(value) {
2975
+ this._spec = value;
2976
+ }
2341
2977
  static _advancedPipelineMap = {};
2342
2978
  static _specPipelineMap = {};
2343
2979
  static _themeMap = {};
@@ -3084,7 +3720,26 @@ const zSelector = z.union([
3084
3720
  z.number(),
3085
3721
  z.object({
3086
3722
  field: z.string(),
3087
- operator: z.string(),
3723
+ operator: z["enum"]([
3724
+ '=',
3725
+ '==',
3726
+ '!=',
3727
+ '>',
3728
+ '<',
3729
+ '>=',
3730
+ '<=',
3731
+ 'between'
3732
+ ]).optional(),
3733
+ op: z["enum"]([
3734
+ '=',
3735
+ '==',
3736
+ '!=',
3737
+ '>',
3738
+ '<',
3739
+ '>=',
3740
+ '<=',
3741
+ 'between'
3742
+ ]).optional(),
3088
3743
  value: z.union([
3089
3744
  z.string(),
3090
3745
  z.number(),
@@ -3096,7 +3751,14 @@ const zSelector = z.union([
3096
3751
  }),
3097
3752
  z.object({
3098
3753
  field: z.string(),
3099
- operator: z.string(),
3754
+ operator: z["enum"]([
3755
+ 'in',
3756
+ 'not in'
3757
+ ]).optional(),
3758
+ op: z["enum"]([
3759
+ 'in',
3760
+ 'not in'
3761
+ ]).optional(),
3100
3762
  value: z.union([
3101
3763
  z.string(),
3102
3764
  z.number(),
@@ -3112,24 +3774,204 @@ const zBarStyle = z.object({
3112
3774
  selector: z.union([
3113
3775
  zSelector,
3114
3776
  zSelectors
3115
- ]),
3116
- barColor: z.string(),
3117
- barColorOpacity: z.number(),
3118
- barBorderColor: z.string(),
3119
- barBorderWidth: z.number(),
3777
+ ]).optional(),
3778
+ barColor: z.string().optional(),
3779
+ barColorOpacity: z.number().optional(),
3780
+ barBorderColor: z.string().optional(),
3781
+ barBorderWidth: z.number().optional(),
3120
3782
  barBorderStyle: z.union([
3121
3783
  z.literal('solid'),
3122
3784
  z.literal('dashed'),
3123
3785
  z.literal('dotted')
3124
- ]),
3786
+ ]).optional(),
3125
3787
  barRadius: z.union([
3126
3788
  z.number(),
3127
3789
  z.array(z.number())
3128
- ])
3790
+ ]).optional()
3129
3791
  });
3130
3792
  const zMarkStyle = z.object({
3131
3793
  barStyle: zBarStyle.optional()
3132
3794
  });
3133
- export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zAxis, zBackgroundColor, zBarStyle, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMarkStyle, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
3795
+ const zAnnotationPoint = z.object({
3796
+ selector: z.union([
3797
+ zSelector,
3798
+ zSelectors
3799
+ ]),
3800
+ text: z.string().or(z.array(z.string())).optional(),
3801
+ textColor: z.string().default('#ffffff').optional(),
3802
+ textFontSize: z.number().default(12).optional(),
3803
+ textFontWeight: z.number().default(400).optional(),
3804
+ textAlign: z["enum"]([
3805
+ 'left',
3806
+ 'right',
3807
+ 'center'
3808
+ ]).default('center').optional(),
3809
+ textBaseline: z["enum"]([
3810
+ 'top',
3811
+ 'middle',
3812
+ 'bottom'
3813
+ ]).default('middle').optional(),
3814
+ backgroundVisible: z.boolean().default(true).optional(),
3815
+ backgroundColor: z.string().default('#212121').optional(),
3816
+ backgroundBorderColor: z.string().optional(),
3817
+ backgroundBorderWidth: z.number().default(1).optional(),
3818
+ backgroundBorderRadius: z.number().default(4).optional(),
3819
+ backgroundPadding: z.number().optional(),
3820
+ offsetY: z.number().default(0).optional(),
3821
+ offsetX: z.number().default(0).optional()
3822
+ });
3823
+ const zAnnotationVerticalLine = z.object({
3824
+ selector: z.union([
3825
+ zSelector,
3826
+ zSelectors
3827
+ ]).optional(),
3828
+ xValue: z.union([
3829
+ z.number(),
3830
+ z.string(),
3831
+ z.array(z.union([
3832
+ z.number(),
3833
+ z.string()
3834
+ ]))
3835
+ ]).optional(),
3836
+ text: z.string().or(z.array(z.string())).optional(),
3837
+ textPosition: z["enum"]([
3838
+ 'outsideStart',
3839
+ 'outsideEnd',
3840
+ 'outsideMiddle',
3841
+ 'insideStart',
3842
+ 'insideMiddle',
3843
+ 'insideEnd'
3844
+ ]).default('insideEnd').optional(),
3845
+ textColor: z.string().default('#ffffff').optional(),
3846
+ textFontSize: z.number().default(12).optional(),
3847
+ textFontWeight: z.number().default(400).optional(),
3848
+ textAlign: z["enum"]([
3849
+ 'left',
3850
+ 'right',
3851
+ 'center'
3852
+ ]).default('right').optional(),
3853
+ textBaseline: z["enum"]([
3854
+ 'top',
3855
+ 'middle',
3856
+ 'bottom'
3857
+ ]).default('top').optional(),
3858
+ lineVisible: z.boolean().optional(),
3859
+ lineColor: z.string().optional(),
3860
+ lineWidth: z.number().optional(),
3861
+ lineStyle: z.union([
3862
+ z.literal('solid'),
3863
+ z.literal('dashed'),
3864
+ z.literal('dotted')
3865
+ ]).optional(),
3866
+ backgroundVisible: z.boolean().default(true).optional(),
3867
+ backgroundColor: z.string().default('#212121').optional(),
3868
+ backgroundBorderColor: z.string().optional(),
3869
+ backgroundBorderWidth: z.number().default(1).optional(),
3870
+ backgroundBorderRadius: z.number().default(4).optional(),
3871
+ backgroundPadding: z.number().optional(),
3872
+ offsetY: z.number().default(0).optional(),
3873
+ offsetX: z.number().default(0).optional()
3874
+ });
3875
+ const zAnnotationHorizontalLine = z.object({
3876
+ selector: z.union([
3877
+ zSelector,
3878
+ zSelectors
3879
+ ]).optional(),
3880
+ yValue: z.union([
3881
+ z.number(),
3882
+ z.string(),
3883
+ z.array(z.union([
3884
+ z.number(),
3885
+ z.string()
3886
+ ]))
3887
+ ]).optional(),
3888
+ text: z.string().or(z.array(z.string())).optional(),
3889
+ textPosition: z["enum"]([
3890
+ 'outsideStart',
3891
+ 'outsideEnd',
3892
+ 'outsideMiddle',
3893
+ 'insideStart',
3894
+ 'insideMiddle',
3895
+ 'insideEnd'
3896
+ ]).default('insideMiddle').optional(),
3897
+ textColor: z.string().default('#ffffff').optional(),
3898
+ textFontSize: z.number().default(12).optional(),
3899
+ textFontWeight: z.number().default(400).optional(),
3900
+ textAlign: z["enum"]([
3901
+ 'left',
3902
+ 'right',
3903
+ 'center'
3904
+ ]).default('center').optional(),
3905
+ textBaseline: z["enum"]([
3906
+ 'top',
3907
+ 'middle',
3908
+ 'bottom'
3909
+ ]).default('bottom').optional(),
3910
+ lineVisible: z.boolean().optional(),
3911
+ lineColor: z.string().optional(),
3912
+ lineWidth: z.number().optional(),
3913
+ lineStyle: z.union([
3914
+ z.literal('solid'),
3915
+ z.literal('dashed'),
3916
+ z.literal('dotted')
3917
+ ]).optional(),
3918
+ backgroundVisible: z.boolean().default(true).optional(),
3919
+ backgroundColor: z.string().default('#212121').optional(),
3920
+ backgroundBorderColor: z.string().optional(),
3921
+ backgroundBorderWidth: z.number().default(1).optional(),
3922
+ backgroundBorderRadius: z.number().default(4).optional(),
3923
+ backgroundPadding: z.number().optional(),
3924
+ offsetY: z.number().default(0).optional(),
3925
+ offsetX: z.number().default(0).optional()
3926
+ });
3927
+ const zAnnotationArea = z.object({
3928
+ selector: z.union([
3929
+ zSelector,
3930
+ zSelectors
3931
+ ]),
3932
+ textPosition: z["enum"]([
3933
+ 'top',
3934
+ 'topRight',
3935
+ 'topLeft',
3936
+ 'bottom',
3937
+ 'bottomLeft',
3938
+ 'bottomRight',
3939
+ 'left',
3940
+ 'right'
3941
+ ]).default('top').optional(),
3942
+ text: z.string().or(z.array(z.string())).optional(),
3943
+ textColor: z.string().default('#ffffff').optional(),
3944
+ textFontSize: z.number().default(12).optional(),
3945
+ textFontWeight: z.number().default(400).optional(),
3946
+ textAlign: z["enum"]([
3947
+ 'left',
3948
+ 'right',
3949
+ 'center'
3950
+ ]).default('center').optional(),
3951
+ textBaseline: z["enum"]([
3952
+ 'top',
3953
+ 'middle',
3954
+ 'bottom'
3955
+ ]).default('middle').optional(),
3956
+ backgroundVisible: z.boolean().default(true).optional(),
3957
+ backgroundColor: z.string().default('#212121').optional(),
3958
+ backgroundBorderColor: z.string().optional(),
3959
+ backgroundBorderWidth: z.number().default(1).optional(),
3960
+ backgroundBorderRadius: z.number().default(4).optional(),
3961
+ backgroundPadding: z.number().optional(),
3962
+ areaColor: z.string().default('red').optional(),
3963
+ areaColorOpacity: z.number().default(0.5).optional(),
3964
+ areaBorderColor: z.number().optional(),
3965
+ areaBorderWidth: z.number().default(2).optional(),
3966
+ areaBorderRadius: z.number().default(4).optional(),
3967
+ outerPadding: z.number().optional()
3968
+ });
3969
+ const zAnnotation = z.object({
3970
+ annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional(),
3971
+ annotationVerticalLine: zAnnotationVerticalLine.or(z.array(zAnnotationVerticalLine)).optional(),
3972
+ annotationHorizontalLine: zAnnotationHorizontalLine.or(z.array(zAnnotationHorizontalLine)).optional(),
3973
+ annotationArea: zAnnotationArea.or(z.array(zAnnotationArea)).optional()
3974
+ });
3975
+ export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zAxis, zBackgroundColor, zBarStyle, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMarkStyle, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
3134
3976
 
3135
3977
  //# sourceMappingURL=index.js.map