@visactor/vseed 0.5.2 → 0.5.4
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/annotation/annotationDifferenceLine.js +12 -8
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js.map +1 -1
- package/dist/esm/theme/tokenTheme.d.ts +6 -0
- package/dist/esm/theme/tokenTheme.js +11 -5
- package/dist/esm/theme/tokenTheme.js.map +1 -1
- package/dist/esm/types/properties/config/annotation/annotation.d.ts +16 -0
- package/dist/esm/types/properties/config/annotation/zAnnotation.d.ts +8 -0
- package/dist/esm/types/properties/config/annotation/zAnnotation.js +4 -0
- package/dist/esm/types/properties/config/annotation/zAnnotation.js.map +1 -1
- package/dist/esm/types/properties/config/area.d.ts +8 -0
- package/dist/esm/types/properties/config/bar.d.ts +12 -0
- package/dist/esm/types/properties/config/boxplot.d.ts +4 -0
- package/dist/esm/types/properties/config/column.d.ts +12 -0
- package/dist/esm/types/properties/config/config.d.ts +76 -0
- package/dist/esm/types/properties/config/dualAxis.d.ts +4 -0
- package/dist/esm/types/properties/config/histogram.d.ts +4 -0
- package/dist/esm/types/properties/config/line.d.ts +4 -0
- package/dist/esm/types/properties/config/race.d.ts +24 -0
- package/dist/esm/types/properties/config/scatter.d.ts +4 -0
- package/dist/esm/types/properties/theme/customTheme.d.ts +152 -0
- package/dist/umd/index.js +27 -13
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -1
|
@@ -217,6 +217,10 @@ const annotationDifferenceLine_annotationDifferenceLine = (spec, context)=>{
|
|
|
217
217
|
const configuredLineDash = lineStyle ? getAnnotationLineDash(lineStyle) : theme?.lineDash ?? (themeLineStyle ? getAnnotationLineDash(themeLineStyle) : void 0);
|
|
218
218
|
const textColor = annotationDifferenceLine.textColor ?? theme?.textColor ?? DEFAULT_TEXT_COLOR;
|
|
219
219
|
const textBackgroundColor = annotationDifferenceLine.textBackgroundColor ?? theme?.textBackgroundColor ?? DEFAULT_TEXT_BACKGROUND_COLOR;
|
|
220
|
+
const textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? lineColor;
|
|
221
|
+
const textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? DEFAULT_CORNER_RADIUS;
|
|
222
|
+
const textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1;
|
|
223
|
+
const textBackgroundPadding = theme?.textBackgroundPadding ?? DEFAULT_LABEL_PADDING;
|
|
220
224
|
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
221
225
|
const textFontSize = annotationDifferenceLine.textFontSize ?? theme?.textFontSize ?? DEFAULT_TEXT_FONT_SIZE;
|
|
222
226
|
const differenceType = annotationDifferenceLine.differenceType ?? 'absolute';
|
|
@@ -250,14 +254,14 @@ const annotationDifferenceLine_annotationDifferenceLine = (spec, context)=>{
|
|
|
250
254
|
},
|
|
251
255
|
labelBackground: {
|
|
252
256
|
visible: true,
|
|
253
|
-
padding:
|
|
257
|
+
padding: textBackgroundPadding,
|
|
254
258
|
style: {
|
|
255
259
|
opacity: textBackgroundOpacity ?? 0.95,
|
|
256
260
|
fill: textBackgroundColor,
|
|
257
261
|
fillOpacity: 1,
|
|
258
|
-
stroke:
|
|
259
|
-
lineWidth:
|
|
260
|
-
cornerRadius:
|
|
262
|
+
stroke: textBackgroundBorderColor,
|
|
263
|
+
lineWidth: textBackgroundBorderWidth,
|
|
264
|
+
cornerRadius: textBackgroundBorderRadius
|
|
261
265
|
}
|
|
262
266
|
}
|
|
263
267
|
} : {
|
|
@@ -271,14 +275,14 @@ const annotationDifferenceLine_annotationDifferenceLine = (spec, context)=>{
|
|
|
271
275
|
},
|
|
272
276
|
labelBackground: {
|
|
273
277
|
visible: true,
|
|
274
|
-
padding:
|
|
278
|
+
padding: textBackgroundPadding,
|
|
275
279
|
style: {
|
|
276
280
|
opacity: textBackgroundOpacity ?? 0.95,
|
|
277
281
|
fill: textBackgroundColor,
|
|
278
282
|
fillOpacity: 1,
|
|
279
|
-
stroke:
|
|
280
|
-
lineWidth:
|
|
281
|
-
cornerRadius:
|
|
283
|
+
stroke: textBackgroundBorderColor,
|
|
284
|
+
lineWidth: textBackgroundBorderWidth,
|
|
285
|
+
cornerRadius: textBackgroundBorderRadius
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.ts"],"sourcesContent":["import type { IAreaChartSpec, IBarChartSpec, ICartesianSeries, ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { AnnotationDifferenceLine, Measure, RegionPadding, VChartSpecPipe } from 'src/types'\nimport { createFormatter, findAllMeasures, autoFormatter } from '../../../../utils'\nimport {\n isDimensionSelector,\n isFieldSelector,\n isMeasureSelector,\n isPartialDatumSelector,\n} from '../../../../../dataSelector'\nimport { isEmpty } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { getAnnotationLineDash } from './utils'\nimport {\n buildDifferenceCoordinateDatum,\n buildDifferenceText,\n getDifferenceLineStackResolveMode,\n getRuntimeDifferenceValue,\n inferDifferenceConnectDirection,\n type ResolvedDifferenceAnchor,\n usesDifferenceLineElementStackEnd,\n resolveDifferenceAnchor,\n} from './annotationDifferenceLineCommon'\n\nconst DEFAULT_LINE_COLOR = '#BCC1CB'\nconst DEFAULT_TEXT_COLOR = '#ffffff'\nconst DEFAULT_TEXT_BACKGROUND_COLOR = '#BCC1CB'\nconst DEFAULT_TEXT_FONT_SIZE = 12\nconst DEFAULT_LINE_WIDTH = 1\nconst DEFAULT_CORNER_RADIUS = 3\nconst DEFAULT_LABEL_PADDING = 4\nconst DEFAULT_END_SYMBOL_SIZE = 6\nconst DEFAULT_END_SYMBOL_REF_X = -4\nconst DEFAULT_GUTTER_BASE_OFFSET = 20\nconst DEFAULT_GUTTER_RIGHT_PADDING = 44\nconst DEFAULT_GUTTER_TOP_PADDING = 36\nconst DEFAULT_BRACKET_LINE_DASH: [number, number] = [2, 2]\nconst DEFAULT_PERCENT_DIFFERENCE_FORMAT = {\n type: 'percent' as const,\n fractionDigits: 2,\n}\n\ntype RegionPaddingObject = Required<Exclude<RegionPadding, number>>\ntype DifferenceConnectDirection = 'top' | 'right' | 'bottom' | 'left'\n\nconst shouldInferDifferenceConnectDirection = (chartType: string) =>\n chartType === 'column' || chartType === 'bar' || chartType === 'columnParallel' || chartType === 'barParallel'\n\nconst getDifferenceLinePath = (index: number, total: number) =>\n total === 1 ? 'annotationDifferenceLine' : `annotationDifferenceLine[${index}]`\n\nconst toArray = <T>(value: T | T[] | undefined | null): T[] => {\n if (Array.isArray(value)) {\n return value\n }\n\n return value === undefined || value === null ? [] : [value]\n}\n\nconst normalizeRegionPadding = (padding?: RegionPadding): RegionPaddingObject => {\n if (typeof padding === 'number') {\n return {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding,\n }\n }\n\n return {\n top: padding?.top ?? 0,\n right: padding?.right ?? 0,\n bottom: padding?.bottom ?? 0,\n left: padding?.left ?? 0,\n }\n}\n\nconst mergeDifferenceLineRegionPadding = (\n spec: IBarChartSpec | ILineChartSpec | IAreaChartSpec,\n paddingPatch: Partial<RegionPaddingObject>,\n) => {\n const region = (spec as { region?: Array<Record<string, unknown>> }).region\n\n if (!Array.isArray(region) || region.length === 0) {\n return spec\n }\n\n const mergedPadding = normalizeRegionPadding(region[0].padding as RegionPadding | undefined)\n\n if (paddingPatch.top !== undefined) {\n mergedPadding.top = Math.max(mergedPadding.top, paddingPatch.top)\n }\n\n if (paddingPatch.right !== undefined) {\n mergedPadding.right = Math.max(mergedPadding.right, paddingPatch.right)\n }\n\n if (paddingPatch.bottom !== undefined) {\n mergedPadding.bottom = Math.max(mergedPadding.bottom, paddingPatch.bottom)\n }\n\n if (paddingPatch.left !== undefined) {\n mergedPadding.left = Math.max(mergedPadding.left, paddingPatch.left)\n }\n\n return {\n ...spec,\n region: [\n {\n ...region[0],\n padding: mergedPadding,\n },\n ...region.slice(1),\n ],\n }\n}\n\nconst buildFixedGutterExpandDistance = (connectDirection: DifferenceConnectDirection) => {\n return (_markerData: unknown, context: any) => {\n const region = context?.region\n const coordinatePoints = Array.isArray(context?.coordinatePoints) ? context.coordinatePoints : []\n\n if (!region || coordinatePoints.length === 0) {\n return 0\n }\n\n const { x: regionStartX, y: regionStartY } = region.getLayoutStartPoint()\n const { width, height } = region.getLayoutRect()\n\n if (connectDirection === 'top') {\n const targetY = regionStartY - DEFAULT_GUTTER_BASE_OFFSET\n const minY = Math.min(...coordinatePoints.map((point: { y: number }) => point.y))\n\n return Math.max(0, minY - targetY)\n }\n\n if (connectDirection === 'bottom') {\n const targetY = regionStartY + height + DEFAULT_GUTTER_BASE_OFFSET\n const maxY = Math.max(...coordinatePoints.map((point: { y: number }) => point.y))\n\n return Math.max(0, targetY - maxY)\n }\n\n if (connectDirection === 'left') {\n const targetX = regionStartX - DEFAULT_GUTTER_BASE_OFFSET\n const minX = Math.min(...coordinatePoints.map((point: { x: number }) => point.x))\n\n return Math.max(0, minX - targetX)\n }\n\n const targetX = regionStartX + width + DEFAULT_GUTTER_BASE_OFFSET\n const maxX = Math.max(...coordinatePoints.map((point: { x: number }) => point.x))\n\n return Math.max(0, targetX - maxX)\n }\n}\n\nconst getDifferenceLinePaddingPatch = (connectDirection: DifferenceConnectDirection): Partial<RegionPaddingObject> => {\n if (connectDirection === 'top') {\n return { top: DEFAULT_GUTTER_TOP_PADDING }\n }\n\n if (connectDirection === 'bottom') {\n return { bottom: DEFAULT_GUTTER_TOP_PADDING }\n }\n\n if (connectDirection === 'left') {\n return { left: DEFAULT_GUTTER_RIGHT_PADDING }\n }\n\n return { right: DEFAULT_GUTTER_RIGHT_PADDING }\n}\n\nconst getAxisFormatter = (spec: IBarChartSpec | ILineChartSpec | IAreaChartSpec) => {\n const valueAxisOrient = spec.direction === 'horizontal' ? 'bottom' : 'left'\n const formatMethod = spec.axes?.find((axis) => axis.orient === valueAxisOrient)?.label?.formatMethod\n\n return typeof formatMethod === 'function'\n ? (value: number) => String(formatMethod(value as never) ?? value)\n : undefined\n}\n\nconst getExplicitMeasureFormat = (measure?: Measure) => {\n if (measure?.numFormat && !isEmpty(measure.numFormat)) {\n return measure.numFormat\n }\n\n if (measure?.format && !isEmpty(measure.format)) {\n return measure.format\n }\n\n return undefined\n}\n\nconst inferMeasureIdFromDatum = (anchor: ResolvedDifferenceAnchor, measureIds: string[]) => {\n const candidateValues = [anchor.matchedDatum, anchor.coordinateDatum]\n\n for (const datum of candidateValues) {\n if (!datum) {\n continue\n }\n\n const candidates = measureIds.filter((measureId) => Number(datum[measureId]) === anchor.value)\n\n if (candidates.length === 1) {\n return candidates[0]\n }\n }\n\n return undefined\n}\n\nconst inferMeasureIdFromSelector = (\n selectorValue: AnnotationDifferenceLine['start']['selector'],\n measureIdSet: Set<string>,\n) => {\n const matchedMeasureIds = new Set<string>()\n\n for (const currentSelector of toArray(selectorValue)) {\n if (isMeasureSelector(currentSelector)) {\n if (measureIdSet.has(currentSelector.field)) {\n matchedMeasureIds.add(currentSelector.field)\n }\n continue\n }\n\n if (isFieldSelector(currentSelector) || isDimensionSelector(currentSelector)) {\n continue\n }\n\n if (isPartialDatumSelector(currentSelector)) {\n Object.keys(currentSelector).forEach((field) => {\n if (measureIdSet.has(field)) {\n matchedMeasureIds.add(field)\n }\n })\n }\n }\n\n return matchedMeasureIds.size === 1 ? Array.from(matchedMeasureIds)[0] : undefined\n}\n\nconst resolveDifferenceMeasureId = (\n anchor: ResolvedDifferenceAnchor,\n selectorValue: AnnotationDifferenceLine['start']['selector'],\n measureIds: string[],\n) => {\n if (anchor.mode !== 'element') {\n return undefined\n }\n\n if (measureIds.length === 1) {\n return measureIds[0]\n }\n\n const measureIdSet = new Set(measureIds)\n return inferMeasureIdFromSelector(selectorValue, measureIdSet) ?? inferMeasureIdFromDatum(anchor, measureIds)\n}\n\nconst assertDifferenceLineConfig: (value: unknown, path: string) => asserts value is AnnotationDifferenceLine = (\n value,\n path,\n) => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`${path} must be an object`)\n }\n\n const start = (value as Record<string, unknown>).start\n if (typeof start !== 'object' || start === null || Array.isArray(start)) {\n throw new Error(`${path}.start is required`)\n }\n if ((start as Record<string, unknown>).selector == null) {\n throw new Error(`${path}.start.selector is required`)\n }\n\n const end = (value as Record<string, unknown>).end\n if (typeof end !== 'object' || end === null || Array.isArray(end)) {\n throw new Error(`${path}.end is required`)\n }\n if ((end as Record<string, unknown>).selector == null) {\n throw new Error(`${path}.end.selector is required`)\n }\n}\n\nexport const annotationDifferenceLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const annotationDifferenceLine = advancedVSeed.annotation?.annotationDifferenceLine\n\n if (!annotationDifferenceLine) {\n return spec\n }\n\n const theme = advancedVSeed.config?.[vseed.chartType as 'column']?.annotation?.annotationDifferenceLine\n const annotationDifferenceLineList = Array.isArray(annotationDifferenceLine)\n ? annotationDifferenceLine\n : [annotationDifferenceLine]\n const dataset = advancedVSeed.dataset.flat()\n const chartSpec = spec as IBarChartSpec | ILineChartSpec | IAreaChartSpec\n const stackResolveMode = getDifferenceLineStackResolveMode(vseed, advancedVSeed)\n const useElementStackEnd = usesDifferenceLineElementStackEnd(vseed, advancedVSeed)\n const isBracketChart = vseed.chartType === 'line' || vseed.chartType === 'area'\n const measures = findAllMeasures(advancedVSeed.measures)\n const measureIds = measures.map((measure) => measure.id)\n const axisFormatter = getAxisFormatter(chartSpec)\n const percentFormatter = createFormatter(DEFAULT_PERCENT_DIFFERENCE_FORMAT)\n const isHorizontalChart = chartSpec.direction === 'horizontal'\n\n const paddingPatch = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }\n\n const markLine = annotationDifferenceLineList.flatMap((annotationDifferenceLine, index) => {\n try {\n assertDifferenceLineConfig(\n annotationDifferenceLine,\n getDifferenceLinePath(index, annotationDifferenceLineList.length),\n )\n\n const start = resolveDifferenceAnchor({\n dataset,\n selectorLabel: 'start',\n selectorValue: annotationDifferenceLine.start.selector,\n spec: chartSpec,\n stackResolveMode,\n allowSelectorFallback: !useElementStackEnd,\n })\n const end = resolveDifferenceAnchor({\n dataset,\n selectorLabel: 'end',\n selectorValue: annotationDifferenceLine.end.selector,\n spec: chartSpec,\n stackResolveMode,\n allowSelectorFallback: !useElementStackEnd,\n })\n\n if (!start || !end) {\n return []\n }\n\n if (start.mode !== end.mode) {\n return []\n }\n\n const usesRuntimeStackEnd =\n useElementStackEnd ||\n ((vseed.chartType === 'column' || vseed.chartType === 'bar') &&\n start.mode === 'element' &&\n stackResolveMode === 'auto')\n const useBracketStyle =\n isBracketChart ||\n ((vseed.chartType === 'column' || vseed.chartType === 'bar') &&\n start.mode === 'element' &&\n stackResolveMode === 'auto')\n const connectDirection: DifferenceConnectDirection = shouldInferDifferenceConnectDirection(vseed.chartType)\n ? inferDifferenceConnectDirection(vseed, [start.value, end.value])\n : isHorizontalChart\n ? 'top'\n : 'right'\n const expandDistance = buildFixedGutterExpandDistance(connectDirection)\n const currentPaddingPatch = getDifferenceLinePaddingPatch(connectDirection)\n\n paddingPatch.top = Math.max(paddingPatch.top, currentPaddingPatch.top ?? 0)\n paddingPatch.right = Math.max(paddingPatch.right, currentPaddingPatch.right ?? 0)\n paddingPatch.bottom = Math.max(paddingPatch.bottom, currentPaddingPatch.bottom ?? 0)\n paddingPatch.left = Math.max(paddingPatch.left, currentPaddingPatch.left ?? 0)\n\n const lineColor = annotationDifferenceLine.lineColor ?? theme?.lineColor ?? DEFAULT_LINE_COLOR\n const lineStyle = annotationDifferenceLine.lineStyle\n const themeLineStyle = theme?.lineStyle\n const configuredLineDash = lineStyle\n ? getAnnotationLineDash(lineStyle)\n : (theme?.lineDash ?? (themeLineStyle ? getAnnotationLineDash(themeLineStyle) : undefined))\n const textColor = annotationDifferenceLine.textColor ?? theme?.textColor ?? DEFAULT_TEXT_COLOR\n const textBackgroundColor =\n annotationDifferenceLine.textBackgroundColor ?? theme?.textBackgroundColor ?? DEFAULT_TEXT_BACKGROUND_COLOR\n const textBackgroundOpacity = theme?.textBackgroundOpacity\n const textFontSize = annotationDifferenceLine.textFontSize ?? theme?.textFontSize ?? DEFAULT_TEXT_FONT_SIZE\n const differenceType = annotationDifferenceLine.differenceType ?? 'absolute'\n const startMeasureId = resolveDifferenceMeasureId(start, annotationDifferenceLine.start.selector, measureIds)\n const endMeasureId = resolveDifferenceMeasureId(end, annotationDifferenceLine.end.selector, measureIds)\n const sameMeasure = startMeasureId !== undefined && startMeasureId === endMeasureId\n const explicitMeasureFormat = sameMeasure\n ? getExplicitMeasureFormat(measures.find((measure) => measure.id === startMeasureId))\n : undefined\n const differenceFormatter =\n differenceType === 'percent'\n ? percentFormatter\n : explicitMeasureFormat\n ? createFormatter(explicitMeasureFormat)\n : (axisFormatter ?? autoFormatter)\n\n const label = usesRuntimeStackEnd\n ? {\n visible: true,\n position: 'middle',\n refY: 0,\n formatMethod: (_markData: any[], seriesData: any[]) => {\n try {\n return buildDifferenceText(\n getRuntimeDifferenceValue({\n anchor: start,\n seriesData,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n getRuntimeDifferenceValue({\n anchor: end,\n seriesData,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n differenceType,\n differenceFormatter,\n )\n } catch {\n return ''\n }\n },\n style: {\n fill: textColor,\n fontSize: textFontSize,\n },\n labelBackground: {\n visible: true,\n padding: DEFAULT_LABEL_PADDING,\n style: {\n opacity: textBackgroundOpacity ?? 0.95,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: lineColor,\n lineWidth: 1,\n cornerRadius: DEFAULT_CORNER_RADIUS,\n },\n },\n }\n : {\n visible: true,\n position: 'middle',\n refY: 0,\n text: buildDifferenceText(start.value, end.value, differenceType, differenceFormatter),\n style: {\n fill: textColor,\n fontSize: textFontSize,\n },\n labelBackground: {\n visible: true,\n padding: DEFAULT_LABEL_PADDING,\n style: {\n opacity: textBackgroundOpacity ?? 0.95,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: lineColor,\n lineWidth: 1,\n cornerRadius: DEFAULT_CORNER_RADIUS,\n },\n },\n }\n\n return [\n {\n type: 'type-step',\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n connectDirection,\n expandDistance,\n coordinates: (seriesData: any[], relativeSeries: ICartesianSeries) => {\n try {\n return [\n buildDifferenceCoordinateDatum({\n anchor: start,\n seriesData,\n relativeSeries,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n buildDifferenceCoordinateDatum({\n anchor: end,\n seriesData,\n relativeSeries,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n ]\n } catch {\n return []\n }\n },\n line: useBracketStyle\n ? {\n multiSegment: true,\n mainSegmentIndex: 1,\n style: [\n {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH,\n },\n {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n ...(configuredLineDash ? { lineDash: configuredLineDash } : {}),\n },\n {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH,\n },\n ],\n }\n : {\n style: {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineDash: configuredLineDash ?? [0],\n cornerRadius: DEFAULT_CORNER_RADIUS,\n },\n },\n label,\n startSymbol: {\n visible: false,\n },\n endSymbol: {\n visible: true,\n size: DEFAULT_END_SYMBOL_SIZE,\n refX: DEFAULT_END_SYMBOL_REF_X,\n style: {\n fill: lineColor,\n },\n },\n } as IMarkLineSpec,\n ]\n } catch {\n return []\n }\n })\n\n const specMarkLine = (chartSpec.markLine as IMarkLineSpec[]) || []\n const nextSpec = {\n ...spec,\n markLine: [...specMarkLine, ...markLine],\n }\n\n if (markLine.length === 0) {\n return nextSpec\n }\n\n return mergeDifferenceLineRegionPadding(nextSpec as IBarChartSpec | ILineChartSpec | IAreaChartSpec, paddingPatch)\n}\n"],"names":["DEFAULT_LINE_COLOR","DEFAULT_TEXT_COLOR","DEFAULT_TEXT_BACKGROUND_COLOR","DEFAULT_TEXT_FONT_SIZE","DEFAULT_LINE_WIDTH","DEFAULT_CORNER_RADIUS","DEFAULT_LABEL_PADDING","DEFAULT_END_SYMBOL_SIZE","DEFAULT_END_SYMBOL_REF_X","DEFAULT_GUTTER_BASE_OFFSET","DEFAULT_GUTTER_RIGHT_PADDING","DEFAULT_GUTTER_TOP_PADDING","DEFAULT_BRACKET_LINE_DASH","DEFAULT_PERCENT_DIFFERENCE_FORMAT","shouldInferDifferenceConnectDirection","chartType","getDifferenceLinePath","index","total","toArray","value","Array","normalizeRegionPadding","padding","mergeDifferenceLineRegionPadding","spec","paddingPatch","region","mergedPadding","undefined","Math","buildFixedGutterExpandDistance","connectDirection","_markerData","context","coordinatePoints","regionStartX","regionStartY","width","height","targetY","minY","point","maxY","targetX","minX","maxX","getDifferenceLinePaddingPatch","getAxisFormatter","valueAxisOrient","formatMethod","axis","String","getExplicitMeasureFormat","measure","isEmpty","inferMeasureIdFromDatum","anchor","measureIds","candidateValues","datum","candidates","measureId","Number","inferMeasureIdFromSelector","selectorValue","measureIdSet","matchedMeasureIds","Set","currentSelector","isMeasureSelector","isFieldSelector","isDimensionSelector","isPartialDatumSelector","Object","field","resolveDifferenceMeasureId","assertDifferenceLineConfig","path","Error","start","end","annotationDifferenceLine","advancedVSeed","vseed","theme","annotationDifferenceLineList","dataset","chartSpec","stackResolveMode","getDifferenceLineStackResolveMode","useElementStackEnd","usesDifferenceLineElementStackEnd","isBracketChart","measures","findAllMeasures","axisFormatter","percentFormatter","createFormatter","isHorizontalChart","markLine","resolveDifferenceAnchor","usesRuntimeStackEnd","useBracketStyle","inferDifferenceConnectDirection","expandDistance","currentPaddingPatch","lineColor","lineStyle","themeLineStyle","configuredLineDash","getAnnotationLineDash","textColor","textBackgroundColor","textBackgroundOpacity","textFontSize","differenceType","startMeasureId","endMeasureId","sameMeasure","explicitMeasureFormat","differenceFormatter","autoFormatter","label","_markData","seriesData","buildDifferenceText","getRuntimeDifferenceValue","ANNOTATION_Z_INDEX","relativeSeries","buildDifferenceCoordinateDatum","specMarkLine","nextSpec"],"mappings":";;;;;;AAuBA,MAAMA,qBAAqB;AAC3B,MAAMC,qBAAqB;AAC3B,MAAMC,gCAAgC;AACtC,MAAMC,yBAAyB;AAC/B,MAAMC,qBAAqB;AAC3B,MAAMC,wBAAwB;AAC9B,MAAMC,wBAAwB;AAC9B,MAAMC,0BAA0B;AAChC,MAAMC,2BAA2B;AACjC,MAAMC,6BAA6B;AACnC,MAAMC,+BAA+B;AACrC,MAAMC,6BAA6B;AACnC,MAAMC,4BAA8C;IAAC;IAAG;CAAE;AAC1D,MAAMC,oCAAoC;IACxC,MAAM;IACN,gBAAgB;AAClB;AAKA,MAAMC,wCAAwC,CAACC,YAC7CA,AAAc,aAAdA,aAA0BA,AAAc,UAAdA,aAAuBA,AAAc,qBAAdA,aAAkCA,AAAc,kBAAdA;AAErF,MAAMC,wBAAwB,CAACC,OAAeC,QAC5CA,AAAU,MAAVA,QAAc,6BAA6B,CAAC,yBAAyB,EAAED,MAAM,CAAC,CAAC;AAEjF,MAAME,UAAU,CAAIC;IAClB,IAAIC,MAAM,OAAO,CAACD,QAChB,OAAOA;IAGT,OAAOA,QAAAA,QAAwC,EAAE,GAAG;QAACA;KAAM;AAC7D;AAEA,MAAME,yBAAyB,CAACC;IAC9B,IAAI,AAAmB,YAAnB,OAAOA,SACT,OAAO;QACL,KAAKA;QACL,OAAOA;QACP,QAAQA;QACR,MAAMA;IACR;IAGF,OAAO;QACL,KAAKA,SAAS,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/B;SAAS;IAC1C;IAEA,IAAIA,AAAoB,MAApBA,SAAS,MAAM,EACjB,OAAOgC;IAGT,OAAO5G,iCAAiC4G,UAA6D1G;AACvG"}
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.ts"],"sourcesContent":["import type { IAreaChartSpec, IBarChartSpec, ICartesianSeries, ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { AnnotationDifferenceLine, Measure, RegionPadding, VChartSpecPipe } from 'src/types'\nimport { createFormatter, findAllMeasures, autoFormatter } from '../../../../utils'\nimport {\n isDimensionSelector,\n isFieldSelector,\n isMeasureSelector,\n isPartialDatumSelector,\n} from '../../../../../dataSelector'\nimport { isEmpty } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { getAnnotationLineDash } from './utils'\nimport {\n buildDifferenceCoordinateDatum,\n buildDifferenceText,\n getDifferenceLineStackResolveMode,\n getRuntimeDifferenceValue,\n inferDifferenceConnectDirection,\n type ResolvedDifferenceAnchor,\n usesDifferenceLineElementStackEnd,\n resolveDifferenceAnchor,\n} from './annotationDifferenceLineCommon'\n\nconst DEFAULT_LINE_COLOR = '#BCC1CB'\nconst DEFAULT_TEXT_COLOR = '#ffffff'\nconst DEFAULT_TEXT_BACKGROUND_COLOR = '#BCC1CB'\nconst DEFAULT_TEXT_FONT_SIZE = 12\nconst DEFAULT_LINE_WIDTH = 1\nconst DEFAULT_CORNER_RADIUS = 3\nconst DEFAULT_LABEL_PADDING = 4\nconst DEFAULT_END_SYMBOL_SIZE = 6\nconst DEFAULT_END_SYMBOL_REF_X = -4\nconst DEFAULT_GUTTER_BASE_OFFSET = 20\nconst DEFAULT_GUTTER_RIGHT_PADDING = 44\nconst DEFAULT_GUTTER_TOP_PADDING = 36\nconst DEFAULT_BRACKET_LINE_DASH: [number, number] = [2, 2]\nconst DEFAULT_PERCENT_DIFFERENCE_FORMAT = {\n type: 'percent' as const,\n fractionDigits: 2,\n}\n\ntype RegionPaddingObject = Required<Exclude<RegionPadding, number>>\ntype DifferenceConnectDirection = 'top' | 'right' | 'bottom' | 'left'\n\nconst shouldInferDifferenceConnectDirection = (chartType: string) =>\n chartType === 'column' || chartType === 'bar' || chartType === 'columnParallel' || chartType === 'barParallel'\n\nconst getDifferenceLinePath = (index: number, total: number) =>\n total === 1 ? 'annotationDifferenceLine' : `annotationDifferenceLine[${index}]`\n\nconst toArray = <T>(value: T | T[] | undefined | null): T[] => {\n if (Array.isArray(value)) {\n return value\n }\n\n return value === undefined || value === null ? [] : [value]\n}\n\nconst normalizeRegionPadding = (padding?: RegionPadding): RegionPaddingObject => {\n if (typeof padding === 'number') {\n return {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding,\n }\n }\n\n return {\n top: padding?.top ?? 0,\n right: padding?.right ?? 0,\n bottom: padding?.bottom ?? 0,\n left: padding?.left ?? 0,\n }\n}\n\nconst mergeDifferenceLineRegionPadding = (\n spec: IBarChartSpec | ILineChartSpec | IAreaChartSpec,\n paddingPatch: Partial<RegionPaddingObject>,\n) => {\n const region = (spec as { region?: Array<Record<string, unknown>> }).region\n\n if (!Array.isArray(region) || region.length === 0) {\n return spec\n }\n\n const mergedPadding = normalizeRegionPadding(region[0].padding as RegionPadding | undefined)\n\n if (paddingPatch.top !== undefined) {\n mergedPadding.top = Math.max(mergedPadding.top, paddingPatch.top)\n }\n\n if (paddingPatch.right !== undefined) {\n mergedPadding.right = Math.max(mergedPadding.right, paddingPatch.right)\n }\n\n if (paddingPatch.bottom !== undefined) {\n mergedPadding.bottom = Math.max(mergedPadding.bottom, paddingPatch.bottom)\n }\n\n if (paddingPatch.left !== undefined) {\n mergedPadding.left = Math.max(mergedPadding.left, paddingPatch.left)\n }\n\n return {\n ...spec,\n region: [\n {\n ...region[0],\n padding: mergedPadding,\n },\n ...region.slice(1),\n ],\n }\n}\n\nconst buildFixedGutterExpandDistance = (connectDirection: DifferenceConnectDirection) => {\n return (_markerData: unknown, context: any) => {\n const region = context?.region\n const coordinatePoints = Array.isArray(context?.coordinatePoints) ? context.coordinatePoints : []\n\n if (!region || coordinatePoints.length === 0) {\n return 0\n }\n\n const { x: regionStartX, y: regionStartY } = region.getLayoutStartPoint()\n const { width, height } = region.getLayoutRect()\n\n if (connectDirection === 'top') {\n const targetY = regionStartY - DEFAULT_GUTTER_BASE_OFFSET\n const minY = Math.min(...coordinatePoints.map((point: { y: number }) => point.y))\n\n return Math.max(0, minY - targetY)\n }\n\n if (connectDirection === 'bottom') {\n const targetY = regionStartY + height + DEFAULT_GUTTER_BASE_OFFSET\n const maxY = Math.max(...coordinatePoints.map((point: { y: number }) => point.y))\n\n return Math.max(0, targetY - maxY)\n }\n\n if (connectDirection === 'left') {\n const targetX = regionStartX - DEFAULT_GUTTER_BASE_OFFSET\n const minX = Math.min(...coordinatePoints.map((point: { x: number }) => point.x))\n\n return Math.max(0, minX - targetX)\n }\n\n const targetX = regionStartX + width + DEFAULT_GUTTER_BASE_OFFSET\n const maxX = Math.max(...coordinatePoints.map((point: { x: number }) => point.x))\n\n return Math.max(0, targetX - maxX)\n }\n}\n\nconst getDifferenceLinePaddingPatch = (connectDirection: DifferenceConnectDirection): Partial<RegionPaddingObject> => {\n if (connectDirection === 'top') {\n return { top: DEFAULT_GUTTER_TOP_PADDING }\n }\n\n if (connectDirection === 'bottom') {\n return { bottom: DEFAULT_GUTTER_TOP_PADDING }\n }\n\n if (connectDirection === 'left') {\n return { left: DEFAULT_GUTTER_RIGHT_PADDING }\n }\n\n return { right: DEFAULT_GUTTER_RIGHT_PADDING }\n}\n\nconst getAxisFormatter = (spec: IBarChartSpec | ILineChartSpec | IAreaChartSpec) => {\n const valueAxisOrient = spec.direction === 'horizontal' ? 'bottom' : 'left'\n const formatMethod = spec.axes?.find((axis) => axis.orient === valueAxisOrient)?.label?.formatMethod\n\n return typeof formatMethod === 'function'\n ? (value: number) => String(formatMethod(value as never) ?? value)\n : undefined\n}\n\nconst getExplicitMeasureFormat = (measure?: Measure) => {\n if (measure?.numFormat && !isEmpty(measure.numFormat)) {\n return measure.numFormat\n }\n\n if (measure?.format && !isEmpty(measure.format)) {\n return measure.format\n }\n\n return undefined\n}\n\nconst inferMeasureIdFromDatum = (anchor: ResolvedDifferenceAnchor, measureIds: string[]) => {\n const candidateValues = [anchor.matchedDatum, anchor.coordinateDatum]\n\n for (const datum of candidateValues) {\n if (!datum) {\n continue\n }\n\n const candidates = measureIds.filter((measureId) => Number(datum[measureId]) === anchor.value)\n\n if (candidates.length === 1) {\n return candidates[0]\n }\n }\n\n return undefined\n}\n\nconst inferMeasureIdFromSelector = (\n selectorValue: AnnotationDifferenceLine['start']['selector'],\n measureIdSet: Set<string>,\n) => {\n const matchedMeasureIds = new Set<string>()\n\n for (const currentSelector of toArray(selectorValue)) {\n if (isMeasureSelector(currentSelector)) {\n if (measureIdSet.has(currentSelector.field)) {\n matchedMeasureIds.add(currentSelector.field)\n }\n continue\n }\n\n if (isFieldSelector(currentSelector) || isDimensionSelector(currentSelector)) {\n continue\n }\n\n if (isPartialDatumSelector(currentSelector)) {\n Object.keys(currentSelector).forEach((field) => {\n if (measureIdSet.has(field)) {\n matchedMeasureIds.add(field)\n }\n })\n }\n }\n\n return matchedMeasureIds.size === 1 ? Array.from(matchedMeasureIds)[0] : undefined\n}\n\nconst resolveDifferenceMeasureId = (\n anchor: ResolvedDifferenceAnchor,\n selectorValue: AnnotationDifferenceLine['start']['selector'],\n measureIds: string[],\n) => {\n if (anchor.mode !== 'element') {\n return undefined\n }\n\n if (measureIds.length === 1) {\n return measureIds[0]\n }\n\n const measureIdSet = new Set(measureIds)\n return inferMeasureIdFromSelector(selectorValue, measureIdSet) ?? inferMeasureIdFromDatum(anchor, measureIds)\n}\n\nconst assertDifferenceLineConfig: (value: unknown, path: string) => asserts value is AnnotationDifferenceLine = (\n value,\n path,\n) => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`${path} must be an object`)\n }\n\n const start = (value as Record<string, unknown>).start\n if (typeof start !== 'object' || start === null || Array.isArray(start)) {\n throw new Error(`${path}.start is required`)\n }\n if ((start as Record<string, unknown>).selector == null) {\n throw new Error(`${path}.start.selector is required`)\n }\n\n const end = (value as Record<string, unknown>).end\n if (typeof end !== 'object' || end === null || Array.isArray(end)) {\n throw new Error(`${path}.end is required`)\n }\n if ((end as Record<string, unknown>).selector == null) {\n throw new Error(`${path}.end.selector is required`)\n }\n}\n\nexport const annotationDifferenceLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const annotationDifferenceLine = advancedVSeed.annotation?.annotationDifferenceLine\n\n if (!annotationDifferenceLine) {\n return spec\n }\n\n const theme = advancedVSeed.config?.[vseed.chartType as 'column']?.annotation?.annotationDifferenceLine\n const annotationDifferenceLineList = Array.isArray(annotationDifferenceLine)\n ? annotationDifferenceLine\n : [annotationDifferenceLine]\n const dataset = advancedVSeed.dataset.flat()\n const chartSpec = spec as IBarChartSpec | ILineChartSpec | IAreaChartSpec\n const stackResolveMode = getDifferenceLineStackResolveMode(vseed, advancedVSeed)\n const useElementStackEnd = usesDifferenceLineElementStackEnd(vseed, advancedVSeed)\n const isBracketChart = vseed.chartType === 'line' || vseed.chartType === 'area'\n const measures = findAllMeasures(advancedVSeed.measures)\n const measureIds = measures.map((measure) => measure.id)\n const axisFormatter = getAxisFormatter(chartSpec)\n const percentFormatter = createFormatter(DEFAULT_PERCENT_DIFFERENCE_FORMAT)\n const isHorizontalChart = chartSpec.direction === 'horizontal'\n\n const paddingPatch = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }\n\n const markLine = annotationDifferenceLineList.flatMap((annotationDifferenceLine, index) => {\n try {\n assertDifferenceLineConfig(\n annotationDifferenceLine,\n getDifferenceLinePath(index, annotationDifferenceLineList.length),\n )\n\n const start = resolveDifferenceAnchor({\n dataset,\n selectorLabel: 'start',\n selectorValue: annotationDifferenceLine.start.selector,\n spec: chartSpec,\n stackResolveMode,\n allowSelectorFallback: !useElementStackEnd,\n })\n const end = resolveDifferenceAnchor({\n dataset,\n selectorLabel: 'end',\n selectorValue: annotationDifferenceLine.end.selector,\n spec: chartSpec,\n stackResolveMode,\n allowSelectorFallback: !useElementStackEnd,\n })\n\n if (!start || !end) {\n return []\n }\n\n if (start.mode !== end.mode) {\n return []\n }\n\n const usesRuntimeStackEnd =\n useElementStackEnd ||\n ((vseed.chartType === 'column' || vseed.chartType === 'bar') &&\n start.mode === 'element' &&\n stackResolveMode === 'auto')\n const useBracketStyle =\n isBracketChart ||\n ((vseed.chartType === 'column' || vseed.chartType === 'bar') &&\n start.mode === 'element' &&\n stackResolveMode === 'auto')\n const connectDirection: DifferenceConnectDirection = shouldInferDifferenceConnectDirection(vseed.chartType)\n ? inferDifferenceConnectDirection(vseed, [start.value, end.value])\n : isHorizontalChart\n ? 'top'\n : 'right'\n const expandDistance = buildFixedGutterExpandDistance(connectDirection)\n const currentPaddingPatch = getDifferenceLinePaddingPatch(connectDirection)\n\n paddingPatch.top = Math.max(paddingPatch.top, currentPaddingPatch.top ?? 0)\n paddingPatch.right = Math.max(paddingPatch.right, currentPaddingPatch.right ?? 0)\n paddingPatch.bottom = Math.max(paddingPatch.bottom, currentPaddingPatch.bottom ?? 0)\n paddingPatch.left = Math.max(paddingPatch.left, currentPaddingPatch.left ?? 0)\n\n const lineColor = annotationDifferenceLine.lineColor ?? theme?.lineColor ?? DEFAULT_LINE_COLOR\n const lineStyle = annotationDifferenceLine.lineStyle\n const themeLineStyle = theme?.lineStyle\n const configuredLineDash = lineStyle\n ? getAnnotationLineDash(lineStyle)\n : (theme?.lineDash ?? (themeLineStyle ? getAnnotationLineDash(themeLineStyle) : undefined))\n const textColor = annotationDifferenceLine.textColor ?? theme?.textColor ?? DEFAULT_TEXT_COLOR\n const textBackgroundColor =\n annotationDifferenceLine.textBackgroundColor ?? theme?.textBackgroundColor ?? DEFAULT_TEXT_BACKGROUND_COLOR\n const textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? lineColor\n const textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? DEFAULT_CORNER_RADIUS\n const textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1\n const textBackgroundPadding = theme?.textBackgroundPadding ?? DEFAULT_LABEL_PADDING\n const textBackgroundOpacity = theme?.textBackgroundOpacity\n const textFontSize = annotationDifferenceLine.textFontSize ?? theme?.textFontSize ?? DEFAULT_TEXT_FONT_SIZE\n const differenceType = annotationDifferenceLine.differenceType ?? 'absolute'\n const startMeasureId = resolveDifferenceMeasureId(start, annotationDifferenceLine.start.selector, measureIds)\n const endMeasureId = resolveDifferenceMeasureId(end, annotationDifferenceLine.end.selector, measureIds)\n const sameMeasure = startMeasureId !== undefined && startMeasureId === endMeasureId\n const explicitMeasureFormat = sameMeasure\n ? getExplicitMeasureFormat(measures.find((measure) => measure.id === startMeasureId))\n : undefined\n const differenceFormatter =\n differenceType === 'percent'\n ? percentFormatter\n : explicitMeasureFormat\n ? createFormatter(explicitMeasureFormat)\n : (axisFormatter ?? autoFormatter)\n\n const label = usesRuntimeStackEnd\n ? {\n visible: true,\n position: 'middle',\n refY: 0,\n formatMethod: (_markData: any[], seriesData: any[]) => {\n try {\n return buildDifferenceText(\n getRuntimeDifferenceValue({\n anchor: start,\n seriesData,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n getRuntimeDifferenceValue({\n anchor: end,\n seriesData,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n differenceType,\n differenceFormatter,\n )\n } catch {\n return ''\n }\n },\n style: {\n fill: textColor,\n fontSize: textFontSize,\n },\n labelBackground: {\n visible: true,\n padding: textBackgroundPadding,\n style: {\n opacity: textBackgroundOpacity ?? 0.95,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n cornerRadius: textBackgroundBorderRadius,\n },\n },\n }\n : {\n visible: true,\n position: 'middle',\n refY: 0,\n text: buildDifferenceText(start.value, end.value, differenceType, differenceFormatter),\n style: {\n fill: textColor,\n fontSize: textFontSize,\n },\n labelBackground: {\n visible: true,\n padding: textBackgroundPadding,\n style: {\n opacity: textBackgroundOpacity ?? 0.95,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n cornerRadius: textBackgroundBorderRadius,\n },\n },\n }\n\n return [\n {\n type: 'type-step',\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n connectDirection,\n expandDistance,\n coordinates: (seriesData: any[], relativeSeries: ICartesianSeries) => {\n try {\n return [\n buildDifferenceCoordinateDatum({\n anchor: start,\n seriesData,\n relativeSeries,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n buildDifferenceCoordinateDatum({\n anchor: end,\n seriesData,\n relativeSeries,\n useElementStackEnd: usesRuntimeStackEnd,\n }),\n ]\n } catch {\n return []\n }\n },\n line: useBracketStyle\n ? {\n multiSegment: true,\n mainSegmentIndex: 1,\n style: [\n {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH,\n },\n {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n ...(configuredLineDash ? { lineDash: configuredLineDash } : {}),\n },\n {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH,\n },\n ],\n }\n : {\n style: {\n visible: true,\n stroke: lineColor,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineDash: configuredLineDash ?? [0],\n cornerRadius: DEFAULT_CORNER_RADIUS,\n },\n },\n label,\n startSymbol: {\n visible: false,\n },\n endSymbol: {\n visible: true,\n size: DEFAULT_END_SYMBOL_SIZE,\n refX: DEFAULT_END_SYMBOL_REF_X,\n style: {\n fill: lineColor,\n },\n },\n } as IMarkLineSpec,\n ]\n } catch {\n return []\n }\n })\n\n const specMarkLine = (chartSpec.markLine as IMarkLineSpec[]) || []\n const nextSpec = {\n ...spec,\n markLine: [...specMarkLine, ...markLine],\n }\n\n if (markLine.length === 0) {\n return nextSpec\n }\n\n return mergeDifferenceLineRegionPadding(nextSpec as IBarChartSpec | ILineChartSpec | IAreaChartSpec, paddingPatch)\n}\n"],"names":["DEFAULT_LINE_COLOR","DEFAULT_TEXT_COLOR","DEFAULT_TEXT_BACKGROUND_COLOR","DEFAULT_TEXT_FONT_SIZE","DEFAULT_LINE_WIDTH","DEFAULT_CORNER_RADIUS","DEFAULT_LABEL_PADDING","DEFAULT_END_SYMBOL_SIZE","DEFAULT_END_SYMBOL_REF_X","DEFAULT_GUTTER_BASE_OFFSET","DEFAULT_GUTTER_RIGHT_PADDING","DEFAULT_GUTTER_TOP_PADDING","DEFAULT_BRACKET_LINE_DASH","DEFAULT_PERCENT_DIFFERENCE_FORMAT","shouldInferDifferenceConnectDirection","chartType","getDifferenceLinePath","index","total","toArray","value","Array","normalizeRegionPadding","padding","mergeDifferenceLineRegionPadding","spec","paddingPatch","region","mergedPadding","undefined","Math","buildFixedGutterExpandDistance","connectDirection","_markerData","context","coordinatePoints","regionStartX","regionStartY","width","height","targetY","minY","point","maxY","targetX","minX","maxX","getDifferenceLinePaddingPatch","getAxisFormatter","valueAxisOrient","formatMethod","axis","String","getExplicitMeasureFormat","measure","isEmpty","inferMeasureIdFromDatum","anchor","measureIds","candidateValues","datum","candidates","measureId","Number","inferMeasureIdFromSelector","selectorValue","measureIdSet","matchedMeasureIds","Set","currentSelector","isMeasureSelector","isFieldSelector","isDimensionSelector","isPartialDatumSelector","Object","field","resolveDifferenceMeasureId","assertDifferenceLineConfig","path","Error","start","end","annotationDifferenceLine","advancedVSeed","vseed","theme","annotationDifferenceLineList","dataset","chartSpec","stackResolveMode","getDifferenceLineStackResolveMode","useElementStackEnd","usesDifferenceLineElementStackEnd","isBracketChart","measures","findAllMeasures","axisFormatter","percentFormatter","createFormatter","isHorizontalChart","markLine","resolveDifferenceAnchor","usesRuntimeStackEnd","useBracketStyle","inferDifferenceConnectDirection","expandDistance","currentPaddingPatch","lineColor","lineStyle","themeLineStyle","configuredLineDash","getAnnotationLineDash","textColor","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","textBackgroundOpacity","textFontSize","differenceType","startMeasureId","endMeasureId","sameMeasure","explicitMeasureFormat","differenceFormatter","autoFormatter","label","_markData","seriesData","buildDifferenceText","getRuntimeDifferenceValue","ANNOTATION_Z_INDEX","relativeSeries","buildDifferenceCoordinateDatum","specMarkLine","nextSpec"],"mappings":";;;;;;AAuBA,MAAMA,qBAAqB;AAC3B,MAAMC,qBAAqB;AAC3B,MAAMC,gCAAgC;AACtC,MAAMC,yBAAyB;AAC/B,MAAMC,qBAAqB;AAC3B,MAAMC,wBAAwB;AAC9B,MAAMC,wBAAwB;AAC9B,MAAMC,0BAA0B;AAChC,MAAMC,2BAA2B;AACjC,MAAMC,6BAA6B;AACnC,MAAMC,+BAA+B;AACrC,MAAMC,6BAA6B;AACnC,MAAMC,4BAA8C;IAAC;IAAG;CAAE;AAC1D,MAAMC,oCAAoC;IACxC,MAAM;IACN,gBAAgB;AAClB;AAKA,MAAMC,wCAAwC,CAACC,YAC7CA,AAAc,aAAdA,aAA0BA,AAAc,UAAdA,aAAuBA,AAAc,qBAAdA,aAAkCA,AAAc,kBAAdA;AAErF,MAAMC,wBAAwB,CAACC,OAAeC,QAC5CA,AAAU,MAAVA,QAAc,6BAA6B,CAAC,yBAAyB,EAAED,MAAM,CAAC,CAAC;AAEjF,MAAME,UAAU,CAAIC;IAClB,IAAIC,MAAM,OAAO,CAACD,QAChB,OAAOA;IAGT,OAAOA,QAAAA,QAAwC,EAAE,GAAG;QAACA;KAAM;AAC7D;AAEA,MAAME,yBAAyB,CAACC;IAC9B,IAAI,AAAmB,YAAnB,OAAOA,SACT,OA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wBACT,SAAS;wBACT,MAAMxH;wBACN,MAAMC;wBACN,OAAO;4BACL,MAAMmG;wBACR;oBACF;gBACF;aACD;QACH,EAAE,OAAM;YACN,OAAO,EAAE;QACX;IACF;IAEA,MAAM4B,eAAgB/C,UAAU,QAAQ,IAAwB,EAAE;IAClE,MAAMgD,WAAW;QACf,GAAG/G,IAAI;QACP,UAAU;eAAI8G;eAAiBnC;SAAS;IAC1C;IAEA,IAAIA,AAAoB,MAApBA,SAAS,MAAM,EACjB,OAAOoC;IAGT,OAAOhH,iCAAiCgH,UAA6D9G;AACvG"}
|
|
@@ -49,7 +49,13 @@ export type TokenThemeDefinition = {
|
|
|
49
49
|
annotationLineDash?: number[];
|
|
50
50
|
annotationTextColor?: string;
|
|
51
51
|
annotationTextBackgroundColor?: string;
|
|
52
|
+
annotationTextBackgroundBorderRadius?: number;
|
|
53
|
+
annotationTextBackgroundBorderColor?: string;
|
|
54
|
+
annotationTextBackgroundBorderWidth?: number;
|
|
55
|
+
annotationTextBackgroundPadding?: number;
|
|
52
56
|
annotationTextBackgroundOpacity?: number;
|
|
57
|
+
annotationAreaColor?: string;
|
|
58
|
+
annotationAreaColorOpacity?: number;
|
|
53
59
|
};
|
|
54
60
|
export type TokenThemeRegistry = Record<string, TokenThemeDefinition>;
|
|
55
61
|
export type RegisterTokenThemeOptions = {
|
|
@@ -155,13 +155,19 @@ const getAnnotationLinePatch = (tokens)=>({
|
|
|
155
155
|
lineDash: tokens.annotationLineDash,
|
|
156
156
|
textColor: tokens.annotationTextColor,
|
|
157
157
|
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
158
|
-
textBackgroundBorderColor: tokens.annotationTextBackgroundColor,
|
|
158
|
+
textBackgroundBorderColor: tokens.annotationTextBackgroundBorderColor ?? tokens.annotationTextBackgroundColor,
|
|
159
|
+
textBackgroundBorderRadius: tokens.annotationTextBackgroundBorderRadius,
|
|
160
|
+
textBackgroundBorderWidth: tokens.annotationTextBackgroundBorderWidth,
|
|
161
|
+
textBackgroundPadding: tokens.annotationTextBackgroundPadding,
|
|
159
162
|
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
160
163
|
});
|
|
161
164
|
const getAnnotationTextPatch = (tokens)=>({
|
|
162
165
|
textColor: tokens.annotationTextColor,
|
|
163
166
|
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
164
|
-
textBackgroundBorderColor: tokens.annotationTextBackgroundColor,
|
|
167
|
+
textBackgroundBorderColor: tokens.annotationTextBackgroundBorderColor ?? tokens.annotationTextBackgroundColor,
|
|
168
|
+
textBackgroundBorderRadius: tokens.annotationTextBackgroundBorderRadius,
|
|
169
|
+
textBackgroundBorderWidth: tokens.annotationTextBackgroundBorderWidth,
|
|
170
|
+
textBackgroundPadding: tokens.annotationTextBackgroundPadding,
|
|
165
171
|
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
166
172
|
});
|
|
167
173
|
const getAnnotationPatch = (tokens)=>{
|
|
@@ -185,12 +191,12 @@ const getAnnotationPatch = (tokens)=>{
|
|
|
185
191
|
lineColor: tokens.annotationLineColor,
|
|
186
192
|
lineStyle: tokens.annotationLineStyle,
|
|
187
193
|
lineDash: tokens.annotationLineDash,
|
|
188
|
-
|
|
189
|
-
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
190
|
-
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
194
|
+
...annotationTextPatch
|
|
191
195
|
},
|
|
192
196
|
annotationArea: {
|
|
193
197
|
textFontSize: tokens.labelFontSize,
|
|
198
|
+
areaColor: tokens.annotationAreaColor,
|
|
199
|
+
areaColorOpacity: tokens.annotationAreaColorOpacity,
|
|
194
200
|
...annotationTextPatch
|
|
195
201
|
}
|
|
196
202
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme/tokenTheme.js","sources":["../../../src/theme/tokenTheme.ts"],"sourcesContent":["import tinycolor from 'tinycolor2'\nimport type { Config, CustomThemeConfig } from 'src/types'\nimport { registerAll } from '../builder/register/all'\nimport { registerCustomTheme } from '../builder/register/theme'\nimport { darkTheme } from './dark'\nimport { lightTheme } from './light'\n\nexport type TokenThemeBase = 'light' | 'dark'\n\nexport type TokenThemeDefinition = {\n baseTheme: TokenThemeBase\n fontFamily?: string\n tableHeaderFontSize?: number\n tableBodyFontSize?: number\n labelFontSize?: number\n tooltipFontSize?: number\n axisFontSize?: number\n legendFontSize?: number\n playerFontSize?: number\n colorScheme: [string, string, ...string[]]\n linearColorScheme: [string, string]\n textPrimary: string\n textSecondary: string\n borderColor: string\n surfaceColor?: string\n surfaceBackgroundColor?: string\n accentColor?: string\n positiveColor?: string\n negativeColor?: string\n tooltipBackgroundColor: string\n tooltipBorderColor?: string\n axisLabelColor?: string\n axisTitleColor?: string\n axisGridColor?: string\n axisLineColor?: string\n labelColor?: string\n labelStroke?: string\n legendLabelColor?: string\n legendPagerIconColor?: string\n legendPagerIconDisableColor?: string\n playerRailColor?: string\n playerSliderHandleColor?: string\n playerSliderHandleBorderColor?: string\n tableBorderColor?: string\n tableBodyFontColor?: string\n tableHeaderFontColor?: string\n tableHeaderBackgroundColor?: string\n tableHoverBodyBackgroundColor?: string\n tableHoverBodyInlineBackgroundColor?: string\n tableHoverHeaderBackgroundColor?: string\n tableHoverHeaderInlineBackgroundColor?: string\n tableSelectedBorderColor?: string\n tableSelectedBackgroundColor?: string\n annotationLineColor?: string\n annotationLineStyle?: 'solid' | 'dashed' | 'dotted'\n annotationLineDash?: number[]\n annotationTextColor?: string\n annotationTextBackgroundColor?: string\n annotationTextBackgroundOpacity?: number\n}\n\nexport type TokenThemeRegistry = Record<string, TokenThemeDefinition>\n\nexport type RegisterTokenThemeOptions = {\n ensureRegisterAll?: boolean\n}\n\ntype ThemeConfigMap = NonNullable<CustomThemeConfig['config']>\ntype ThemeConfigKey = keyof ThemeConfigMap\n\nconst raceChartTypes: ThemeConfigKey[] = ['raceBar', 'raceColumn', 'raceScatter', 'raceLine', 'racePie', 'raceDonut']\n\nlet hasEnsuredRegisterAll = false\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nconst mergeThemeNode = <T>(base: T, patch: Partial<T>): T => {\n if (!isRecord(base) || !isRecord(patch)) {\n return patch as T\n }\n\n const result: Record<string, unknown> = { ...base }\n for (const [key, patchValue] of Object.entries(patch)) {\n if (patchValue === undefined) {\n continue\n }\n\n const currentValue = result[key]\n if (Array.isArray(patchValue)) {\n result[key] = [...patchValue]\n continue\n }\n\n if (isRecord(currentValue) && isRecord(patchValue)) {\n result[key] = mergeThemeNode(currentValue, patchValue)\n continue\n }\n\n result[key] = patchValue\n }\n\n return result as T\n}\n\nconst withAlpha = (color: string, alpha: number) => tinycolor(color).setAlpha(alpha).toRgbString()\n\nconst ensureRegisterAll = (options?: RegisterTokenThemeOptions) => {\n if (options?.ensureRegisterAll === false || hasEnsuredRegisterAll) {\n return\n }\n\n registerAll()\n hasEnsuredRegisterAll = true\n}\n\nconst getAccentColor = (tokens: TokenThemeDefinition) => tokens.accentColor || tokens.colorScheme[0]\n\nconst getAxisPatch = (tokens: TokenThemeDefinition) => ({\n label: {\n labelColor: tokens.axisLabelColor || tokens.textSecondary,\n labelFontSize: tokens.axisFontSize,\n },\n title: {\n titleColor: tokens.axisTitleColor || tokens.textSecondary,\n titleFontSize: tokens.axisFontSize,\n },\n grid: {\n gridColor: tokens.axisGridColor || tokens.borderColor,\n },\n tick: {\n tickColor: tokens.axisLineColor || tokens.borderColor,\n },\n line: {\n lineColor: tokens.axisLineColor || tokens.borderColor,\n },\n})\n\nconst getPivotGridPatch = (tokens: TokenThemeDefinition) => ({\n borderColor: tokens.tableBorderColor || tokens.borderColor,\n bodyFontSize: tokens.tableBodyFontSize,\n bodyFontColor: tokens.tableBodyFontColor || tokens.textPrimary,\n headerFontSize: tokens.tableHeaderFontSize,\n headerFontColor: tokens.tableHeaderFontColor || tokens.textPrimary,\n headerBackgroundColor: tokens.tableHeaderBackgroundColor || tokens.surfaceColor || 'transparent',\n hoverHeaderBackgroundColor: tokens.tableHoverHeaderBackgroundColor || withAlpha(getAccentColor(tokens), 0.18),\n hoverHeaderInlineBackgroundColor:\n tokens.tableHoverHeaderInlineBackgroundColor || withAlpha(getAccentColor(tokens), 0.08),\n titleFontColor: tokens.textPrimary,\n titleFontSize: tokens.tableHeaderFontSize,\n chartGridColor: tokens.axisGridColor || tokens.borderColor,\n axisLabelColor: tokens.axisLabelColor || tokens.textSecondary,\n axisLabelFontSize: tokens.axisFontSize,\n})\n\nconst getPlayerPatch = (tokens: TokenThemeDefinition) => {\n const accentColor = getAccentColor(tokens)\n\n return {\n fontFamily: tokens.fontFamily,\n fontSize: tokens.playerFontSize,\n railColor: tokens.playerRailColor || tokens.borderColor,\n trackColor: accentColor,\n sliderHandleColor: tokens.playerSliderHandleColor || tokens.surfaceColor || '#ffffff',\n sliderHandleBorderColor: tokens.playerSliderHandleBorderColor || accentColor,\n startButtonColor: accentColor,\n pauseButtonColor: accentColor,\n backwardButtonColor: accentColor,\n forwardButtonColor: accentColor,\n }\n}\n\nconst getTablePatch = (tokens: TokenThemeDefinition) => {\n const accentColor = getAccentColor(tokens)\n\n return {\n borderColor: tokens.tableBorderColor || tokens.borderColor,\n bodyFontSize: tokens.tableBodyFontSize,\n bodyFontFamily: tokens.fontFamily,\n bodyFontColor: tokens.tableBodyFontColor || tokens.textPrimary,\n headerFontSize: tokens.tableHeaderFontSize,\n headerFontFamily: tokens.fontFamily,\n headerFontColor: tokens.tableHeaderFontColor || tokens.textPrimary,\n headerBackgroundColor: tokens.tableHeaderBackgroundColor || tokens.surfaceColor || 'transparent',\n hoverBodyBackgroundColor: tokens.tableHoverBodyBackgroundColor || withAlpha(accentColor, 0.18),\n hoverBodyInlineBackgroundColor: tokens.tableHoverBodyInlineBackgroundColor || withAlpha(accentColor, 0.08),\n hoverHeaderBackgroundColor: tokens.tableHoverHeaderBackgroundColor || withAlpha(accentColor, 0.18),\n hoverHeaderInlineBackgroundColor: tokens.tableHoverHeaderInlineBackgroundColor || withAlpha(accentColor, 0.08),\n selectedBorderColor: tokens.tableSelectedBorderColor || accentColor,\n selectedBackgroundColor: tokens.tableSelectedBackgroundColor || withAlpha(accentColor, 0.12),\n backgroundColor: tokens.surfaceBackgroundColor || 'transparent',\n barAxisColor: tokens.axisLineColor || tokens.borderColor,\n backgroundColorScale: {\n minColor: tokens.linearColorScheme[0],\n maxColor: tokens.linearColorScheme[1],\n },\n }\n}\n\nconst getChartPatch = (tokens: TokenThemeDefinition) => ({\n backgroundColor: 'transparent',\n fontFamily: tokens.fontFamily,\n color: {\n colorScheme: [...tokens.colorScheme],\n linearColorScheme: [...tokens.linearColorScheme],\n positiveColor: tokens.positiveColor,\n negativeColor: tokens.negativeColor,\n },\n label: {\n labelFontSize: tokens.labelFontSize,\n labelColor: tokens.labelColor || tokens.textPrimary,\n labelStroke: tokens.labelStroke,\n },\n legend: {\n labelColor: tokens.legendLabelColor || tokens.textSecondary,\n labelFontSize: tokens.legendFontSize,\n pagerIconColor: tokens.legendPagerIconColor || tokens.textSecondary,\n pagerIconDisableColor: tokens.legendPagerIconDisableColor || tokens.borderColor,\n },\n tooltip: {\n backgroundColor: tokens.tooltipBackgroundColor,\n borderColor: tokens.tooltipBorderColor || tokens.borderColor,\n fontSize: tokens.tooltipFontSize,\n keyColor: tokens.textSecondary,\n valueColor: tokens.textPrimary,\n titleColor: tokens.textPrimary,\n },\n})\n\nconst getAnnotationLinePatch = (tokens: TokenThemeDefinition) => ({\n lineColor: tokens.annotationLineColor,\n lineStyle: tokens.annotationLineStyle,\n lineDash: tokens.annotationLineDash,\n textColor: tokens.annotationTextColor,\n textBackgroundColor: tokens.annotationTextBackgroundColor,\n textBackgroundBorderColor: tokens.annotationTextBackgroundColor,\n textBackgroundOpacity: tokens.annotationTextBackgroundOpacity,\n})\n\nconst getAnnotationTextPatch = (tokens: TokenThemeDefinition) => ({\n textColor: tokens.annotationTextColor,\n textBackgroundColor: tokens.annotationTextBackgroundColor,\n textBackgroundBorderColor: tokens.annotationTextBackgroundColor,\n textBackgroundOpacity: tokens.annotationTextBackgroundOpacity,\n})\n\nconst getAnnotationPatch = (tokens: TokenThemeDefinition) => {\n const annotationLinePatch = getAnnotationLinePatch(tokens)\n const annotationTextPatch = getAnnotationTextPatch(tokens)\n\n return {\n annotationPoint: {\n textFontSize: tokens.labelFontSize,\n ...annotationTextPatch,\n },\n annotationHorizontalLine: {\n textFontSize: tokens.labelFontSize,\n ...annotationLinePatch,\n },\n annotationVerticalLine: {\n textFontSize: tokens.labelFontSize,\n ...annotationLinePatch,\n },\n annotationDifferenceLine: {\n textFontSize: tokens.labelFontSize,\n lineColor: tokens.annotationLineColor,\n lineStyle: tokens.annotationLineStyle,\n lineDash: tokens.annotationLineDash,\n textColor: tokens.annotationTextColor,\n textBackgroundColor: tokens.annotationTextBackgroundColor,\n textBackgroundOpacity: tokens.annotationTextBackgroundOpacity,\n },\n annotationArea: {\n textFontSize: tokens.labelFontSize,\n ...annotationTextPatch,\n },\n }\n}\n\nconst getRegressionLinePatch = (tokens: TokenThemeDefinition) => ({\n kdeRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n ecdfRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n linearRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n lowessRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n polynomialRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n logisticRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n})\n\nconst withAxesAndExtras = (\n chartType: ThemeConfigKey,\n chartConfig: NonNullable<ThemeConfigMap[ThemeConfigKey]>,\n tokens: TokenThemeDefinition,\n) => {\n let nextChartConfig = mergeThemeNode(chartConfig, getChartPatch(tokens))\n const chartRecord = nextChartConfig as Record<string, unknown>\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'xAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { xAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'yAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { yAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'primaryYAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { primaryYAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'secondaryYAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { secondaryYAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'pivotGrid')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { pivotGrid: getPivotGridPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'annotation')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { annotation: getAnnotationPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'regressionLine')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { regressionLine: getRegressionLinePatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (raceChartTypes.includes(chartType) && Object.prototype.hasOwnProperty.call(chartRecord, 'player')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { player: getPlayerPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n return nextChartConfig\n}\n\nexport const createTokenThemeConfig = (tokens: TokenThemeDefinition): CustomThemeConfig => {\n const baseTheme = tokens.baseTheme === 'dark' ? darkTheme() : lightTheme()\n const baseConfig = (baseTheme.config || {}) as ThemeConfigMap\n const nextConfig = {} as ThemeConfigMap\n\n for (const chartType of Object.keys(baseConfig) as ThemeConfigKey[]) {\n const chartConfig = baseConfig[chartType]\n if (!chartConfig) {\n continue\n }\n\n if (chartType === 'table' || chartType === 'pivotTable') {\n nextConfig[chartType] = mergeThemeNode(chartConfig, getTablePatch(tokens)) as ThemeConfigMap[ThemeConfigKey]\n continue\n }\n\n nextConfig[chartType] = withAxesAndExtras(chartType, chartConfig, tokens) as ThemeConfigMap[ThemeConfigKey]\n }\n\n return {\n config: nextConfig as Config,\n }\n}\n\nexport const registerTokenTheme = (\n themeName: string,\n tokens: TokenThemeDefinition,\n options?: RegisterTokenThemeOptions,\n) => {\n ensureRegisterAll(options)\n registerCustomTheme(themeName, createTokenThemeConfig(tokens))\n}\n\nexport const registerTokenThemes = (themes: TokenThemeRegistry, options?: RegisterTokenThemeOptions) => {\n ensureRegisterAll(options)\n\n for (const [themeName, tokens] of Object.entries(themes)) {\n registerCustomTheme(themeName, createTokenThemeConfig(tokens))\n }\n}\n"],"names":["raceChartTypes","hasEnsuredRegisterAll","isRecord","value","Array","mergeThemeNode","base","patch","result","key","patchValue","Object","undefined","currentValue","withAlpha","color","alpha","tinycolor","ensureRegisterAll","options","registerAll","getAccentColor","tokens","getAxisPatch","getPivotGridPatch","getPlayerPatch","accentColor","getTablePatch","getChartPatch","getAnnotationLinePatch","getAnnotationTextPatch","getAnnotationPatch","annotationLinePatch","annotationTextPatch","getRegressionLinePatch","withAxesAndExtras","chartType","chartConfig","nextChartConfig","chartRecord","createTokenThemeConfig","baseTheme","darkTheme","lightTheme","baseConfig","nextConfig","registerTokenTheme","themeName","registerCustomTheme","registerTokenThemes","themes"],"mappings":";;;;;AAsEA,MAAMA,iBAAmC;IAAC;IAAW;IAAc;IAAe;IAAY;IAAW;CAAY;AAErH,IAAIC,wBAAwB;AAE5B,MAAMC,WAAW,CAACC,QACT,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,CAACC,MAAM,OAAO,CAACD;AAGvE,MAAME,iBAAiB,CAAIC,MAASC;IAClC,IAAI,CAACL,SAASI,SAAS,CAAC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AOgB;AACT;AAEO,MAAME,yBAAyB,CAAClB;IACrC,MAAMmB,YAAYnB,AAAqB,WAArBA,OAAO,SAAS,GAAcoB,cAAcC;IAC9D,MAAMC,aAAcH,UAAU,MAAM,IAAI,CAAC;IACzC,MAAMI,aAAa,CAAC;IAEpB,KAAK,MAAMT,aAAazB,OAAO,IAAI,CAACiC,YAAiC;QACnE,MAAMP,cAAcO,UAAU,CAACR,UAAU;QACzC,IAAKC;YAIL,IAAID,AAAc,YAAdA,aAAyBA,AAAc,iBAAdA,WAA4B;gBACvDS,UAAU,CAACT,UAAU,GAAG/B,eAAegC,aAAaV,cAAcL;gBAClE;YACF;YAEAuB,UAAU,CAACT,UAAU,GAAGD,kBAAkBC,WAAWC,aAAaf;;IACpE;IAEA,OAAO;QACL,QAAQuB;IACV;AACF;AAEO,MAAMC,qBAAqB,CAChCC,WACAzB,QACAH;IAEAD,kBAAkBC;IAClB6B,oBAAoBD,WAAWP,uBAAuBlB;AACxD;AAEO,MAAM2B,sBAAsB,CAACC,QAA4B/B;IAC9DD,kBAAkBC;IAElB,KAAK,MAAM,CAAC4B,WAAWzB,OAAO,IAAIX,OAAO,OAAO,CAACuC,QAC/CF,oBAAoBD,WAAWP,uBAAuBlB;AAE1D"}
|
|
1
|
+
{"version":3,"file":"theme/tokenTheme.js","sources":["../../../src/theme/tokenTheme.ts"],"sourcesContent":["import tinycolor from 'tinycolor2'\nimport type { Config, CustomThemeConfig } from 'src/types'\nimport { registerAll } from '../builder/register/all'\nimport { registerCustomTheme } from '../builder/register/theme'\nimport { darkTheme } from './dark'\nimport { lightTheme } from './light'\n\nexport type TokenThemeBase = 'light' | 'dark'\n\nexport type TokenThemeDefinition = {\n baseTheme: TokenThemeBase\n fontFamily?: string\n tableHeaderFontSize?: number\n tableBodyFontSize?: number\n labelFontSize?: number\n tooltipFontSize?: number\n axisFontSize?: number\n legendFontSize?: number\n playerFontSize?: number\n colorScheme: [string, string, ...string[]]\n linearColorScheme: [string, string]\n textPrimary: string\n textSecondary: string\n borderColor: string\n surfaceColor?: string\n surfaceBackgroundColor?: string\n accentColor?: string\n positiveColor?: string\n negativeColor?: string\n tooltipBackgroundColor: string\n tooltipBorderColor?: string\n axisLabelColor?: string\n axisTitleColor?: string\n axisGridColor?: string\n axisLineColor?: string\n labelColor?: string\n labelStroke?: string\n legendLabelColor?: string\n legendPagerIconColor?: string\n legendPagerIconDisableColor?: string\n playerRailColor?: string\n playerSliderHandleColor?: string\n playerSliderHandleBorderColor?: string\n tableBorderColor?: string\n tableBodyFontColor?: string\n tableHeaderFontColor?: string\n tableHeaderBackgroundColor?: string\n tableHoverBodyBackgroundColor?: string\n tableHoverBodyInlineBackgroundColor?: string\n tableHoverHeaderBackgroundColor?: string\n tableHoverHeaderInlineBackgroundColor?: string\n tableSelectedBorderColor?: string\n tableSelectedBackgroundColor?: string\n annotationLineColor?: string\n annotationLineStyle?: 'solid' | 'dashed' | 'dotted'\n annotationLineDash?: number[]\n annotationTextColor?: string\n annotationTextBackgroundColor?: string\n annotationTextBackgroundBorderRadius?: number\n annotationTextBackgroundBorderColor?: string\n annotationTextBackgroundBorderWidth?: number\n annotationTextBackgroundPadding?: number\n annotationTextBackgroundOpacity?: number\n annotationAreaColor?: string\n annotationAreaColorOpacity?: number\n}\n\nexport type TokenThemeRegistry = Record<string, TokenThemeDefinition>\n\nexport type RegisterTokenThemeOptions = {\n ensureRegisterAll?: boolean\n}\n\ntype ThemeConfigMap = NonNullable<CustomThemeConfig['config']>\ntype ThemeConfigKey = keyof ThemeConfigMap\n\nconst raceChartTypes: ThemeConfigKey[] = ['raceBar', 'raceColumn', 'raceScatter', 'raceLine', 'racePie', 'raceDonut']\n\nlet hasEnsuredRegisterAll = false\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nconst mergeThemeNode = <T>(base: T, patch: Partial<T>): T => {\n if (!isRecord(base) || !isRecord(patch)) {\n return patch as T\n }\n\n const result: Record<string, unknown> = { ...base }\n for (const [key, patchValue] of Object.entries(patch)) {\n if (patchValue === undefined) {\n continue\n }\n\n const currentValue = result[key]\n if (Array.isArray(patchValue)) {\n result[key] = [...patchValue]\n continue\n }\n\n if (isRecord(currentValue) && isRecord(patchValue)) {\n result[key] = mergeThemeNode(currentValue, patchValue)\n continue\n }\n\n result[key] = patchValue\n }\n\n return result as T\n}\n\nconst withAlpha = (color: string, alpha: number) => tinycolor(color).setAlpha(alpha).toRgbString()\n\nconst ensureRegisterAll = (options?: RegisterTokenThemeOptions) => {\n if (options?.ensureRegisterAll === false || hasEnsuredRegisterAll) {\n return\n }\n\n registerAll()\n hasEnsuredRegisterAll = true\n}\n\nconst getAccentColor = (tokens: TokenThemeDefinition) => tokens.accentColor || tokens.colorScheme[0]\n\nconst getAxisPatch = (tokens: TokenThemeDefinition) => ({\n label: {\n labelColor: tokens.axisLabelColor || tokens.textSecondary,\n labelFontSize: tokens.axisFontSize,\n },\n title: {\n titleColor: tokens.axisTitleColor || tokens.textSecondary,\n titleFontSize: tokens.axisFontSize,\n },\n grid: {\n gridColor: tokens.axisGridColor || tokens.borderColor,\n },\n tick: {\n tickColor: tokens.axisLineColor || tokens.borderColor,\n },\n line: {\n lineColor: tokens.axisLineColor || tokens.borderColor,\n },\n})\n\nconst getPivotGridPatch = (tokens: TokenThemeDefinition) => ({\n borderColor: tokens.tableBorderColor || tokens.borderColor,\n bodyFontSize: tokens.tableBodyFontSize,\n bodyFontColor: tokens.tableBodyFontColor || tokens.textPrimary,\n headerFontSize: tokens.tableHeaderFontSize,\n headerFontColor: tokens.tableHeaderFontColor || tokens.textPrimary,\n headerBackgroundColor: tokens.tableHeaderBackgroundColor || tokens.surfaceColor || 'transparent',\n hoverHeaderBackgroundColor: tokens.tableHoverHeaderBackgroundColor || withAlpha(getAccentColor(tokens), 0.18),\n hoverHeaderInlineBackgroundColor:\n tokens.tableHoverHeaderInlineBackgroundColor || withAlpha(getAccentColor(tokens), 0.08),\n titleFontColor: tokens.textPrimary,\n titleFontSize: tokens.tableHeaderFontSize,\n chartGridColor: tokens.axisGridColor || tokens.borderColor,\n axisLabelColor: tokens.axisLabelColor || tokens.textSecondary,\n axisLabelFontSize: tokens.axisFontSize,\n})\n\nconst getPlayerPatch = (tokens: TokenThemeDefinition) => {\n const accentColor = getAccentColor(tokens)\n\n return {\n fontFamily: tokens.fontFamily,\n fontSize: tokens.playerFontSize,\n railColor: tokens.playerRailColor || tokens.borderColor,\n trackColor: accentColor,\n sliderHandleColor: tokens.playerSliderHandleColor || tokens.surfaceColor || '#ffffff',\n sliderHandleBorderColor: tokens.playerSliderHandleBorderColor || accentColor,\n startButtonColor: accentColor,\n pauseButtonColor: accentColor,\n backwardButtonColor: accentColor,\n forwardButtonColor: accentColor,\n }\n}\n\nconst getTablePatch = (tokens: TokenThemeDefinition) => {\n const accentColor = getAccentColor(tokens)\n\n return {\n borderColor: tokens.tableBorderColor || tokens.borderColor,\n bodyFontSize: tokens.tableBodyFontSize,\n bodyFontFamily: tokens.fontFamily,\n bodyFontColor: tokens.tableBodyFontColor || tokens.textPrimary,\n headerFontSize: tokens.tableHeaderFontSize,\n headerFontFamily: tokens.fontFamily,\n headerFontColor: tokens.tableHeaderFontColor || tokens.textPrimary,\n headerBackgroundColor: tokens.tableHeaderBackgroundColor || tokens.surfaceColor || 'transparent',\n hoverBodyBackgroundColor: tokens.tableHoverBodyBackgroundColor || withAlpha(accentColor, 0.18),\n hoverBodyInlineBackgroundColor: tokens.tableHoverBodyInlineBackgroundColor || withAlpha(accentColor, 0.08),\n hoverHeaderBackgroundColor: tokens.tableHoverHeaderBackgroundColor || withAlpha(accentColor, 0.18),\n hoverHeaderInlineBackgroundColor: tokens.tableHoverHeaderInlineBackgroundColor || withAlpha(accentColor, 0.08),\n selectedBorderColor: tokens.tableSelectedBorderColor || accentColor,\n selectedBackgroundColor: tokens.tableSelectedBackgroundColor || withAlpha(accentColor, 0.12),\n backgroundColor: tokens.surfaceBackgroundColor || 'transparent',\n barAxisColor: tokens.axisLineColor || tokens.borderColor,\n backgroundColorScale: {\n minColor: tokens.linearColorScheme[0],\n maxColor: tokens.linearColorScheme[1],\n },\n }\n}\n\nconst getChartPatch = (tokens: TokenThemeDefinition) => ({\n backgroundColor: 'transparent',\n fontFamily: tokens.fontFamily,\n color: {\n colorScheme: [...tokens.colorScheme],\n linearColorScheme: [...tokens.linearColorScheme],\n positiveColor: tokens.positiveColor,\n negativeColor: tokens.negativeColor,\n },\n label: {\n labelFontSize: tokens.labelFontSize,\n labelColor: tokens.labelColor || tokens.textPrimary,\n labelStroke: tokens.labelStroke,\n },\n legend: {\n labelColor: tokens.legendLabelColor || tokens.textSecondary,\n labelFontSize: tokens.legendFontSize,\n pagerIconColor: tokens.legendPagerIconColor || tokens.textSecondary,\n pagerIconDisableColor: tokens.legendPagerIconDisableColor || tokens.borderColor,\n },\n tooltip: {\n backgroundColor: tokens.tooltipBackgroundColor,\n borderColor: tokens.tooltipBorderColor || tokens.borderColor,\n fontSize: tokens.tooltipFontSize,\n keyColor: tokens.textSecondary,\n valueColor: tokens.textPrimary,\n titleColor: tokens.textPrimary,\n },\n})\n\nconst getAnnotationLinePatch = (tokens: TokenThemeDefinition) => ({\n lineColor: tokens.annotationLineColor,\n lineStyle: tokens.annotationLineStyle,\n lineDash: tokens.annotationLineDash,\n textColor: tokens.annotationTextColor,\n textBackgroundColor: tokens.annotationTextBackgroundColor,\n textBackgroundBorderColor: tokens.annotationTextBackgroundBorderColor ?? tokens.annotationTextBackgroundColor,\n textBackgroundBorderRadius: tokens.annotationTextBackgroundBorderRadius,\n textBackgroundBorderWidth: tokens.annotationTextBackgroundBorderWidth,\n textBackgroundPadding: tokens.annotationTextBackgroundPadding,\n textBackgroundOpacity: tokens.annotationTextBackgroundOpacity,\n})\n\nconst getAnnotationTextPatch = (tokens: TokenThemeDefinition) => ({\n textColor: tokens.annotationTextColor,\n textBackgroundColor: tokens.annotationTextBackgroundColor,\n textBackgroundBorderColor: tokens.annotationTextBackgroundBorderColor ?? tokens.annotationTextBackgroundColor,\n textBackgroundBorderRadius: tokens.annotationTextBackgroundBorderRadius,\n textBackgroundBorderWidth: tokens.annotationTextBackgroundBorderWidth,\n textBackgroundPadding: tokens.annotationTextBackgroundPadding,\n textBackgroundOpacity: tokens.annotationTextBackgroundOpacity,\n})\n\nconst getAnnotationPatch = (tokens: TokenThemeDefinition) => {\n const annotationLinePatch = getAnnotationLinePatch(tokens)\n const annotationTextPatch = getAnnotationTextPatch(tokens)\n\n return {\n annotationPoint: {\n textFontSize: tokens.labelFontSize,\n ...annotationTextPatch,\n },\n annotationHorizontalLine: {\n textFontSize: tokens.labelFontSize,\n ...annotationLinePatch,\n },\n annotationVerticalLine: {\n textFontSize: tokens.labelFontSize,\n ...annotationLinePatch,\n },\n annotationDifferenceLine: {\n textFontSize: tokens.labelFontSize,\n lineColor: tokens.annotationLineColor,\n lineStyle: tokens.annotationLineStyle,\n lineDash: tokens.annotationLineDash,\n ...annotationTextPatch,\n },\n annotationArea: {\n textFontSize: tokens.labelFontSize,\n areaColor: tokens.annotationAreaColor,\n areaColorOpacity: tokens.annotationAreaColorOpacity,\n ...annotationTextPatch,\n },\n }\n}\n\nconst getRegressionLinePatch = (tokens: TokenThemeDefinition) => ({\n kdeRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n ecdfRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n linearRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n lowessRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n polynomialRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n logisticRegressionLine: {\n textFontSize: tokens.labelFontSize,\n },\n})\n\nconst withAxesAndExtras = (\n chartType: ThemeConfigKey,\n chartConfig: NonNullable<ThemeConfigMap[ThemeConfigKey]>,\n tokens: TokenThemeDefinition,\n) => {\n let nextChartConfig = mergeThemeNode(chartConfig, getChartPatch(tokens))\n const chartRecord = nextChartConfig as Record<string, unknown>\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'xAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { xAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'yAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { yAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'primaryYAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { primaryYAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'secondaryYAxis')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { secondaryYAxis: getAxisPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'pivotGrid')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { pivotGrid: getPivotGridPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'annotation')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { annotation: getAnnotationPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (Object.prototype.hasOwnProperty.call(chartRecord, 'regressionLine')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { regressionLine: getRegressionLinePatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n if (raceChartTypes.includes(chartType) && Object.prototype.hasOwnProperty.call(chartRecord, 'player')) {\n nextChartConfig = mergeThemeNode(nextChartConfig, { player: getPlayerPatch(tokens) } as Partial<\n typeof nextChartConfig\n >)\n }\n\n return nextChartConfig\n}\n\nexport const createTokenThemeConfig = (tokens: TokenThemeDefinition): CustomThemeConfig => {\n const baseTheme = tokens.baseTheme === 'dark' ? darkTheme() : lightTheme()\n const baseConfig = (baseTheme.config || {}) as ThemeConfigMap\n const nextConfig = {} as ThemeConfigMap\n\n for (const chartType of Object.keys(baseConfig) as ThemeConfigKey[]) {\n const chartConfig = baseConfig[chartType]\n if (!chartConfig) {\n continue\n }\n\n if (chartType === 'table' || chartType === 'pivotTable') {\n nextConfig[chartType] = mergeThemeNode(chartConfig, getTablePatch(tokens)) as ThemeConfigMap[ThemeConfigKey]\n continue\n }\n\n nextConfig[chartType] = withAxesAndExtras(chartType, chartConfig, tokens) as ThemeConfigMap[ThemeConfigKey]\n }\n\n return {\n config: nextConfig as Config,\n }\n}\n\nexport const registerTokenTheme = (\n themeName: string,\n tokens: TokenThemeDefinition,\n options?: RegisterTokenThemeOptions,\n) => {\n ensureRegisterAll(options)\n registerCustomTheme(themeName, createTokenThemeConfig(tokens))\n}\n\nexport const registerTokenThemes = (themes: TokenThemeRegistry, options?: RegisterTokenThemeOptions) => {\n ensureRegisterAll(options)\n\n for (const [themeName, tokens] of Object.entries(themes)) {\n registerCustomTheme(themeName, createTokenThemeConfig(tokens))\n }\n}\n"],"names":["raceChartTypes","hasEnsuredRegisterAll","isRecord","value","Array","mergeThemeNode","base","patch","result","key","patchValue","Object","undefined","currentValue","withAlpha","color","alpha","tinycolor","ensureRegisterAll","options","registerAll","getAccentColor","tokens","getAxisPatch","getPivotGridPatch","getPlayerPatch","accentColor","getTablePatch","getChartPatch","getAnnotationLinePatch","getAnnotationTextPatch","getAnnotationPatch","annotationLinePatch","annotationTextPatch","getRegressionLinePatch","withAxesAndExtras","chartType","chartConfig","nextChartConfig","chartRecord","createTokenThemeConfig","baseTheme","darkTheme","lightTheme","baseConfig","nextConfig","registerTokenTheme","themeName","registerCustomTheme","registerTokenThemes","themes"],"mappings":";;;;;AA4EA,MAAMA,iBAAmC;IAAC;IAAW;IAAc;IAAe;IAAY;IAAW;CAAY;AAErH,IAAIC,wBAAwB;AAE5B,MAAMC,WAAW,CAACC,QACT,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,CAACC,MA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AK7F,IAAIX,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC4B,aAAa,mBACpDD,kBAAkBjC,eAAeiC,iBAAiB;QAAE,gBAAgBJ,uBAAuBZ;IAAQ;IAKrG,IAAItB,eAAe,QAAQ,CAACoC,cAAczB,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC4B,aAAa,WAC1FD,kBAAkBjC,eAAeiC,iBAAiB;QAAE,QAAQb,eAAeH;IAAQ;IAKrF,OAAOgB;AACT;AAEO,MAAME,yBAAyB,CAAClB;IACrC,MAAMmB,YAAYnB,AAAqB,WAArBA,OAAO,SAAS,GAAcoB,cAAcC;IAC9D,MAAMC,aAAcH,UAAU,MAAM,IAAI,CAAC;IACzC,MAAMI,aAAa,CAAC;IAEpB,KAAK,MAAMT,aAAazB,OAAO,IAAI,CAACiC,YAAiC;QACnE,MAAMP,cAAcO,UAAU,CAACR,UAAU;QACzC,IAAKC;YAIL,IAAID,AAAc,YAAdA,aAAyBA,AAAc,iBAAdA,WAA4B;gBACvDS,UAAU,CAACT,UAAU,GAAG/B,eAAegC,aAAaV,cAAcL;gBAClE;YACF;YAEAuB,UAAU,CAACT,UAAU,GAAGD,kBAAkBC,WAAWC,aAAaf;;IACpE;IAEA,OAAO;QACL,QAAQuB;IACV;AACF;AAEO,MAAMC,qBAAqB,CAChCC,WACAzB,QACAH;IAEAD,kBAAkBC;IAClB6B,oBAAoBD,WAAWP,uBAAuBlB;AACxD;AAEO,MAAM2B,sBAAsB,CAACC,QAA4B/B;IAC9DD,kBAAkBC;IAElB,KAAK,MAAM,CAAC4B,WAAWzB,OAAO,IAAIX,OAAO,OAAO,CAACuC,QAC/CF,oBAAoBD,WAAWP,uBAAuBlB;AAE1D"}
|
|
@@ -94,6 +94,22 @@ export type AnnotationAreaConfig = Pick<AnnotationArea, 'areaBorderColor' | 'are
|
|
|
94
94
|
textBackgroundOpacity?: number | null;
|
|
95
95
|
};
|
|
96
96
|
export type AnnotationDifferenceLineConfig = Pick<AnnotationDifferenceLine, 'lineColor' | 'lineStyle' | 'textBackgroundColor' | 'textColor' | 'textFontSize'> & {
|
|
97
|
+
/**
|
|
98
|
+
* 文本背景边框颜色
|
|
99
|
+
*/
|
|
100
|
+
textBackgroundBorderColor?: string | null;
|
|
101
|
+
/**
|
|
102
|
+
* 文本背景边框圆角
|
|
103
|
+
*/
|
|
104
|
+
textBackgroundBorderRadius?: number | null;
|
|
105
|
+
/**
|
|
106
|
+
* 文本背景边框宽度
|
|
107
|
+
*/
|
|
108
|
+
textBackgroundBorderWidth?: number | null;
|
|
109
|
+
/**
|
|
110
|
+
* 文本背景内边距
|
|
111
|
+
*/
|
|
112
|
+
textBackgroundPadding?: number | null;
|
|
97
113
|
/**
|
|
98
114
|
* 线条虚线配置
|
|
99
115
|
*/
|
|
@@ -183,6 +183,10 @@ export declare const zAnnotationDifferenceLineConfig: z.ZodObject<{
|
|
|
183
183
|
dashed: "dashed";
|
|
184
184
|
dotted: "dotted";
|
|
185
185
|
}>>>>;
|
|
186
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
187
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
188
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
189
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
186
190
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
187
191
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
188
192
|
}, z.core.$strip>;
|
|
@@ -371,6 +375,10 @@ export declare const zAnnotationConfig: z.ZodObject<{
|
|
|
371
375
|
dashed: "dashed";
|
|
372
376
|
dotted: "dotted";
|
|
373
377
|
}>>>>;
|
|
378
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
379
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
380
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
381
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
374
382
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
375
383
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
376
384
|
}, z.core.$strip>>>;
|
|
@@ -62,6 +62,10 @@ const zAnnotationDifferenceLineConfig = zAnnotationDifferenceLine.pick({
|
|
|
62
62
|
textFontSize: true,
|
|
63
63
|
textBackgroundColor: true
|
|
64
64
|
}).extend({
|
|
65
|
+
textBackgroundBorderColor: z.string().nullish(),
|
|
66
|
+
textBackgroundBorderRadius: z.number().nullish(),
|
|
67
|
+
textBackgroundBorderWidth: z.number().nullish(),
|
|
68
|
+
textBackgroundPadding: z.number().nullish(),
|
|
65
69
|
lineDash: z.array(z.number()).nullish(),
|
|
66
70
|
textBackgroundOpacity: z.number().nullish()
|
|
67
71
|
}).partial();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types/properties/config/annotation/zAnnotation.js","sources":["../../../../../../src/types/properties/config/annotation/zAnnotation.ts"],"sourcesContent":["import { z } from 'zod'\nimport { zAnnotationPoint } from '../../annotation/zAnnotationPoint'\nimport { zAnnotationDifferenceLine } from '../../annotation/zAnnotationDifferenceLine'\nimport { zAnnotationHorizontalLine } from '../../annotation/zAnnotationHorizontalLine'\nimport { zAnnotationArea } from '../../annotation/zAnnotationArea'\n\nexport const zAnnotationPointConfig = zAnnotationPoint\n .omit({ selector: true, measureId: true, text: true })\n .partial()\n .extend({\n textBackgroundOpacity: z.number().nullish(),\n })\n\n// Use pick to explicitly list fields we want to expose in config variants.\nexport const zAnnotationHorizontalLineConfig = zAnnotationHorizontalLine\n .pick({\n // only pick fields that exist on the runtime schema\n lineColor: true,\n lineWidth: true,\n lineVisible: true,\n lineStyle: true,\n\n textBackgroundVisible: true,\n textColor: true,\n textFontSize: true,\n textFontWeight: true,\n textBackgroundColor: true,\n textBackgroundBorderColor: true,\n textBackgroundBorderWidth: true,\n textBackgroundBorderRadius: true,\n textBackgroundPadding: true,\n })\n // extend with additional config-only fields that runtime schema doesn't include\n .extend({\n lineDash: z.array(z.number()).nullish(),\n textBackgroundOpacity: z.number().nullish(),\n\n endSymbolVisible: z.boolean().nullish(),\n endSymbolType: z.string().nullish(),\n endSymbolSize: z.number().nullish(),\n\n startSymbolVisible: z.boolean().nullish(),\n startSymbolType: z.string().nullish(),\n startSymbolSize: z.number().nullish(),\n })\n .partial()\n\nexport const zAnnotationVerticalLineConfig = zAnnotationHorizontalLineConfig.clone()\n\nexport const zAnnotationAreaConfig = zAnnotationArea\n .pick({\n textColor: true,\n textFontSize: true,\n textFontWeight: true,\n\n textBackgroundVisible: true,\n textBackgroundColor: true,\n textBackgroundBorderColor: true,\n textBackgroundBorderWidth: true,\n textBackgroundBorderRadius: true,\n textBackgroundPadding: true,\n\n areaColor: true,\n areaColorOpacity: true,\n areaBorderColor: true,\n areaBorderWidth: true,\n areaBorderRadius: true,\n areaLineDash: true,\n\n outerPadding: true,\n })\n .extend({\n textBackgroundOpacity: z.number().nullish(),\n })\n .partial()\n\nexport const zAnnotationDifferenceLineConfig = zAnnotationDifferenceLine\n .pick({\n lineColor: true,\n lineStyle: true,\n textColor: true,\n textFontSize: true,\n textBackgroundColor: true,\n })\n .extend({\n lineDash: z.array(z.number()).nullish(),\n textBackgroundOpacity: z.number().nullish(),\n })\n .partial()\n\nexport const zAnnotationConfig = z.object({\n annotationPoint: zAnnotationPointConfig.nullish(),\n annotationHorizontalLine: zAnnotationHorizontalLineConfig.nullish(),\n annotationVerticalLine: zAnnotationVerticalLineConfig.nullish(),\n annotationArea: zAnnotationAreaConfig.nullish(),\n annotationDifferenceLine: zAnnotationDifferenceLineConfig.nullish(),\n})\n"],"names":["zAnnotationPointConfig","zAnnotationPoint","z","zAnnotationHorizontalLineConfig","zAnnotationHorizontalLine","zAnnotationVerticalLineConfig","zAnnotationAreaConfig","zAnnotationArea","zAnnotationDifferenceLineConfig","zAnnotationDifferenceLine","zAnnotationConfig"],"mappings":";;;;;AAMO,MAAMA,yBAAyBC,iBAAAA,IAC/B,CAAC;IAAE,UAAU;IAAM,WAAW;IAAM,MAAM;AAAK,GACnD,OAAO,GACP,MAAM,CAAC;IACN,uBAAuBC,EAAE,MAAM,GAAG,OAAO;AAC3C;AAGK,MAAMC,kCAAkCC,0BAAAA,IACxC,CAAC;IAEJ,WAAW;IACX,WAAW;IACX,aAAa;IACb,WAAW;IAEX,uBAAuB;IACvB,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,qBAAqB;IACrB,2BAA2B;IAC3B,2BAA2B;IAC3B,4BAA4B;IAC5B,uBAAuB;AACzB,GAEC,MAAM,CAAC;IACN,UAAUF,EAAE,KAAK,CAACA,EAAE,MAAM,IAAI,OAAO;IACrC,uBAAuBA,EAAE,MAAM,GAAG,OAAO;IAEzC,kBAAkBA,EAAE,OAAO,GAAG,OAAO;IACrC,eAAeA,EAAE,MAAM,GAAG,OAAO;IACjC,eAAeA,EAAE,MAAM,GAAG,OAAO;IAEjC,oBAAoBA,EAAE,OAAO,GAAG,OAAO;IACvC,iBAAiBA,EAAE,MAAM,GAAG,OAAO;IACnC,iBAAiBA,EAAE,MAAM,GAAG,OAAO;AACrC,GACC,OAAO;AAEH,MAAMG,gCAAgCF,gCAAgC,KAAK;AAE3E,MAAMG,wBAAwBC,gBAAAA,IAC9B,CAAC;IACJ,WAAW;IACX,cAAc;IACd,gBAAgB;IAEhB,uBAAuB;IACvB,qBAAqB;IACrB,2BAA2B;IAC3B,2BAA2B;IAC3B,4BAA4B;IAC5B,uBAAuB;IAEvB,WAAW;IACX,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,cAAc;IAEd,cAAc;AAChB,GACC,MAAM,CAAC;IACN,uBAAuBL,EAAE,MAAM,GAAG,OAAO;AAC3C,GACC,OAAO;AAEH,MAAMM,kCAAkCC,0BAAAA,IACxC,CAAC;IACJ,WAAW;IACX,WAAW;IACX,WAAW;IACX,cAAc;IACd,qBAAqB;AACvB,GACC,MAAM,CAAC;IACN,
|
|
1
|
+
{"version":3,"file":"types/properties/config/annotation/zAnnotation.js","sources":["../../../../../../src/types/properties/config/annotation/zAnnotation.ts"],"sourcesContent":["import { z } from 'zod'\nimport { zAnnotationPoint } from '../../annotation/zAnnotationPoint'\nimport { zAnnotationDifferenceLine } from '../../annotation/zAnnotationDifferenceLine'\nimport { zAnnotationHorizontalLine } from '../../annotation/zAnnotationHorizontalLine'\nimport { zAnnotationArea } from '../../annotation/zAnnotationArea'\n\nexport const zAnnotationPointConfig = zAnnotationPoint\n .omit({ selector: true, measureId: true, text: true })\n .partial()\n .extend({\n textBackgroundOpacity: z.number().nullish(),\n })\n\n// Use pick to explicitly list fields we want to expose in config variants.\nexport const zAnnotationHorizontalLineConfig = zAnnotationHorizontalLine\n .pick({\n // only pick fields that exist on the runtime schema\n lineColor: true,\n lineWidth: true,\n lineVisible: true,\n lineStyle: true,\n\n textBackgroundVisible: true,\n textColor: true,\n textFontSize: true,\n textFontWeight: true,\n textBackgroundColor: true,\n textBackgroundBorderColor: true,\n textBackgroundBorderWidth: true,\n textBackgroundBorderRadius: true,\n textBackgroundPadding: true,\n })\n // extend with additional config-only fields that runtime schema doesn't include\n .extend({\n lineDash: z.array(z.number()).nullish(),\n textBackgroundOpacity: z.number().nullish(),\n\n endSymbolVisible: z.boolean().nullish(),\n endSymbolType: z.string().nullish(),\n endSymbolSize: z.number().nullish(),\n\n startSymbolVisible: z.boolean().nullish(),\n startSymbolType: z.string().nullish(),\n startSymbolSize: z.number().nullish(),\n })\n .partial()\n\nexport const zAnnotationVerticalLineConfig = zAnnotationHorizontalLineConfig.clone()\n\nexport const zAnnotationAreaConfig = zAnnotationArea\n .pick({\n textColor: true,\n textFontSize: true,\n textFontWeight: true,\n\n textBackgroundVisible: true,\n textBackgroundColor: true,\n textBackgroundBorderColor: true,\n textBackgroundBorderWidth: true,\n textBackgroundBorderRadius: true,\n textBackgroundPadding: true,\n\n areaColor: true,\n areaColorOpacity: true,\n areaBorderColor: true,\n areaBorderWidth: true,\n areaBorderRadius: true,\n areaLineDash: true,\n\n outerPadding: true,\n })\n .extend({\n textBackgroundOpacity: z.number().nullish(),\n })\n .partial()\n\nexport const zAnnotationDifferenceLineConfig = zAnnotationDifferenceLine\n .pick({\n lineColor: true,\n lineStyle: true,\n textColor: true,\n textFontSize: true,\n textBackgroundColor: true,\n })\n .extend({\n textBackgroundBorderColor: z.string().nullish(),\n textBackgroundBorderRadius: z.number().nullish(),\n textBackgroundBorderWidth: z.number().nullish(),\n textBackgroundPadding: z.number().nullish(),\n lineDash: z.array(z.number()).nullish(),\n textBackgroundOpacity: z.number().nullish(),\n })\n .partial()\n\nexport const zAnnotationConfig = z.object({\n annotationPoint: zAnnotationPointConfig.nullish(),\n annotationHorizontalLine: zAnnotationHorizontalLineConfig.nullish(),\n annotationVerticalLine: zAnnotationVerticalLineConfig.nullish(),\n annotationArea: zAnnotationAreaConfig.nullish(),\n annotationDifferenceLine: zAnnotationDifferenceLineConfig.nullish(),\n})\n"],"names":["zAnnotationPointConfig","zAnnotationPoint","z","zAnnotationHorizontalLineConfig","zAnnotationHorizontalLine","zAnnotationVerticalLineConfig","zAnnotationAreaConfig","zAnnotationArea","zAnnotationDifferenceLineConfig","zAnnotationDifferenceLine","zAnnotationConfig"],"mappings":";;;;;AAMO,MAAMA,yBAAyBC,iBAAAA,IAC/B,CAAC;IAAE,UAAU;IAAM,WAAW;IAAM,MAAM;AAAK,GAC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,GAAG,OAAO;IAC9C,2BAA2BA,EAAE,MAAM,GAAG,OAAO;IAC7C,uBAAuBA,EAAE,MAAM,GAAG,OAAO;IACzC,UAAUA,EAAE,KAAK,CAACA,EAAE,MAAM,IAAI,OAAO;IACrC,uBAAuBA,EAAE,MAAM,GAAG,OAAO;AAC3C,GACC,OAAO;AAEH,MAAMQ,oBAAoBR,EAAE,MAAM,CAAC;IACxC,iBAAiBF,uBAAuB,OAAO;IAC/C,0BAA0BG,gCAAgC,OAAO;IACjE,wBAAwBE,8BAA8B,OAAO;IAC7D,gBAAgBC,sBAAsB,OAAO;IAC7C,0BAA0BE,gCAAgC,OAAO;AACnE"}
|
|
@@ -617,6 +617,10 @@ export declare const zAreaConfig: z.ZodObject<{
|
|
|
617
617
|
dashed: "dashed";
|
|
618
618
|
dotted: "dotted";
|
|
619
619
|
}>>>>;
|
|
620
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
621
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
622
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
623
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
620
624
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
621
625
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
622
626
|
}, z.core.$strip>>>;
|
|
@@ -1298,6 +1302,10 @@ export declare const zAreaPercentConfig: z.ZodObject<{
|
|
|
1298
1302
|
dashed: "dashed";
|
|
1299
1303
|
dotted: "dotted";
|
|
1300
1304
|
}>>>>;
|
|
1305
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1306
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1307
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1308
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1301
1309
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
1302
1310
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1303
1311
|
}, z.core.$strip>>>;
|
|
@@ -617,6 +617,10 @@ export declare const zBarConfig: z.ZodObject<{
|
|
|
617
617
|
dashed: "dashed";
|
|
618
618
|
dotted: "dotted";
|
|
619
619
|
}>>>>;
|
|
620
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
621
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
622
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
623
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
620
624
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
621
625
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
622
626
|
}, z.core.$strip>>>;
|
|
@@ -1298,6 +1302,10 @@ export declare const zBarParallelConfig: z.ZodObject<{
|
|
|
1298
1302
|
dashed: "dashed";
|
|
1299
1303
|
dotted: "dotted";
|
|
1300
1304
|
}>>>>;
|
|
1305
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1306
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1307
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1308
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1301
1309
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
1302
1310
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1303
1311
|
}, z.core.$strip>>>;
|
|
@@ -1979,6 +1987,10 @@ export declare const zBarPercentConfig: z.ZodObject<{
|
|
|
1979
1987
|
dashed: "dashed";
|
|
1980
1988
|
dotted: "dotted";
|
|
1981
1989
|
}>>>>;
|
|
1990
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1991
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1992
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1993
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1982
1994
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
1983
1995
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1984
1996
|
}, z.core.$strip>>>;
|
|
@@ -610,6 +610,10 @@ export declare const zBoxplotConfig: z.ZodObject<{
|
|
|
610
610
|
dashed: "dashed";
|
|
611
611
|
dotted: "dotted";
|
|
612
612
|
}>>>>;
|
|
613
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
614
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
615
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
616
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
613
617
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
614
618
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
615
619
|
}, z.core.$strip>>>;
|
|
@@ -619,6 +619,10 @@ export declare const zColumnParallelConfig: z.ZodObject<{
|
|
|
619
619
|
dashed: "dashed";
|
|
620
620
|
dotted: "dotted";
|
|
621
621
|
}>>>>;
|
|
622
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
623
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
624
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
625
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
622
626
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
623
627
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
624
628
|
}, z.core.$strip>>>;
|
|
@@ -1302,6 +1306,10 @@ export declare const zColumnConfig: z.ZodObject<{
|
|
|
1302
1306
|
dashed: "dashed";
|
|
1303
1307
|
dotted: "dotted";
|
|
1304
1308
|
}>>>>;
|
|
1309
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1310
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1311
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1312
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1305
1313
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
1306
1314
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
1307
1315
|
}, z.core.$strip>>>;
|
|
@@ -2159,6 +2167,10 @@ export declare const zColumnPercentConfig: z.ZodObject<{
|
|
|
2159
2167
|
dashed: "dashed";
|
|
2160
2168
|
dotted: "dotted";
|
|
2161
2169
|
}>>>>;
|
|
2170
|
+
textBackgroundBorderColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2171
|
+
textBackgroundBorderRadius: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
2172
|
+
textBackgroundBorderWidth: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
2173
|
+
textBackgroundPadding: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
2162
2174
|
lineDash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>>;
|
|
2163
2175
|
textBackgroundOpacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
2164
2176
|
}, z.core.$strip>>>;
|