import type { AgGradientColor, AgImageFill, AgPatternColor } from '../series/cartesian/commonOptions'; import type { AgChartAllThemeParams } from './themeParamsOptions'; export type WithThemeParams = ExtendLiteralLeaves; export type Operation = CacheOperation | ChartOperation | ColorOperation | FontOperation | LocationOperation | LogicOperation | NumericOperation | TransformOperation; type Leaf = Operation | T; type AnyLeaf = Leaf; type ExcludeLeaves = string | symbol | number | boolean | undefined | AgGradientColor | AgPatternColor | AgImageFill; /** * Modify a type T by extending it's leaves with the type V, excluding any leaf that extends E. * * @param T type to extend * @param V value to union with the leaves * @param E leaf types to exclude and keep their original type */ type ExtendLiteralLeaves = { [P in keyof T]: NonNullable extends Array ? U extends E ? Array | Array | V : ExtendLiteralLeavesInner : ExtendLiteralLeavesInner; }; type ExtendLiteralLeavesInner = NonNullable extends Array ? Array> | V : T[P] extends E ? T[P] | V : ExtendLiteralLeaves | V; type ThemeParam = keyof AgChartAllThemeParams; type PaletteParam = 'type' | 'fills' | 'fillsFallback' | 'fill' | 'fillFallback' | 'strokes' | 'stroke' | 'gradients' | 'gradient' | 'sequentialColors' | 'divergingColors' | 'hierarchyColors' | 'secondSequentialColors' | 'secondDivergingColors' | 'secondHierarchyColors' | 'range2' | 'up.fill' | 'up.stroke' | 'down.fill' | 'down.stroke' | 'altUp.fill' | 'altUp.stroke' | 'altDown.fill' | 'altDown.stroke' | 'neutral.fill' | 'neutral.stroke'; type CacheOperation = { $cacheMax: Leaf; }; type ChartOperation = { $hasSeriesType: Leaf; } | { $isChartType: Leaf; } | { $isPackageType: Leaf<'community' | 'enterprise'>; } | { $isSeriesType: Leaf; }; type ColorOperation = { $foregroundBackgroundMix: Leaf; } | { $foregroundOpacity: Leaf; } | { $interpolate: [AnyLeaf, Leaf]; } | { $isGradient: AnyLeaf; } | { $isImage: AnyLeaf; } | { $isPattern: AnyLeaf; } | { $mix: [Leaf, Leaf, Leaf]; }; type FontOperation = { $rem: Leaf | [Leaf, Leaf]; }; type LocationOperation = { $circular: Leaf; } | { $isUserOption: [Leaf, AnyLeaf, AnyLeaf]; } | { $mapPalette: PaletteParam; } | { $palette: PaletteParam; } | { $path: Leaf | [Leaf, AnyLeaf] | [Leaf, AnyLeaf, AnyLeaf]; } | { $pathString: Leaf; } | { $ref: ThemeParam; }; type LogicOperation = { $if: [AnyLeaf, AnyLeaf | object, AnyLeaf | object]; } | { $or: AnyLeaf[]; } | { $and: AnyLeaf[]; } | { $eq: AnyLeaf[]; } | { $not: AnyLeaf; } | { $some: [AnyLeaf | object, AnyLeaf]; } | { $every: [AnyLeaf | object, AnyLeaf]; } | { $switch: (AnyLeaf | object)[]; } | { $greaterThan: [Leaf, Leaf]; } | { $lessThan: [Leaf, Leaf]; }; type NumericOperation = { $even: Leaf; }; type TransformOperation = { $apply: Leaf | [Leaf, Leaf]; } | { $applySwitch: any[]; } | { $applyCycle: any[]; } | { $findFirstSiblingNotOperation: AnyLeaf; } | { $map: [AnyLeaf | object, AnyLeaf]; } | { $merge: Leaf[]; } | { $omit: [Leaf, Leaf]; } | { $size: AnyLeaf; } | { $shallow: Leaf>; } | { $shallowSimple: Leaf>; } | { $value: '$1' | '$index'; }; export {};