diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 786e29e46c2..52f42ced7bb 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -2317,18 +2317,17 @@ export interface ExtendedPlugin< } export interface ScriptableTooltipContext { - chart: Chart; - tooltip: TooltipModel; - tooltipItems: TooltipItem[]; + chart: UnionToIntersection>; + tooltip: UnionToIntersection>; + tooltipItems: UnionToIntersection[]>; } -export type ScriptableTooltip = T | (TType extends ChartType ? { [TT in TType]: ((ctx: ScriptableTooltipContext) => T) }[TType] : ((ctx: TType) => T)); export interface TooltipOptions extends CoreInteractionOptions { /** * Are on-canvas tooltips enabled? * @default true */ - enabled: ScriptableTooltip; + enabled: Scriptable>; /** * See custom tooltip section. */ @@ -2336,13 +2335,13 @@ export interface TooltipOptions extends CoreInteraction /** * The mode for positioning the tooltip */ - position: ScriptableTooltip<'average' | 'nearest', TType> + position: Scriptable<'average' | 'nearest', ScriptableTooltipContext> /** * Override the tooltip alignment calculations */ - xAlign: ScriptableTooltip; - yAlign: ScriptableTooltip; + xAlign: Scriptable>; + yAlign: Scriptable>; /** * Sort tooltip items. @@ -2355,142 +2354,142 @@ export interface TooltipOptions extends CoreInteraction * Background color of the tooltip. * @default 'rgba(0, 0, 0, 0.8)' */ - backgroundColor: ScriptableTooltip; + backgroundColor: Scriptable>; /** * Color of title * @default '#fff' */ - titleColor: ScriptableTooltip; + titleColor: Scriptable>; /** * See Fonts * @default {style: 'bold'} */ - titleFont: ScriptableTooltip; + titleFont: Scriptable>; /** * Spacing to add to top and bottom of each title line. * @default 2 */ - titleSpacing: ScriptableTooltip; + titleSpacing: Scriptable>; /** * Margin to add on bottom of title section. * @default 6 */ - titleMarginBottom: ScriptableTooltip; + titleMarginBottom: Scriptable>; /** * Horizontal alignment of the title text lines. * @default 'left' */ - titleAlign: ScriptableTooltip; + titleAlign: Scriptable>; /** * Spacing to add to top and bottom of each tooltip item. * @default 2 */ - bodySpacing: ScriptableTooltip; + bodySpacing: Scriptable>; /** * Color of body * @default '#fff' */ - bodyColor: ScriptableTooltip; + bodyColor: Scriptable>; /** * See Fonts. * @default {} */ - bodyFont: ScriptableTooltip; + bodyFont: Scriptable>; /** * Horizontal alignment of the body text lines. * @default 'left' */ - bodyAlign: ScriptableTooltip; + bodyAlign: Scriptable>; /** * Spacing to add to top and bottom of each footer line. * @default 2 */ - footerSpacing: ScriptableTooltip; + footerSpacing: Scriptable>; /** * Margin to add before drawing the footer. * @default 6 */ - footerMarginTop: ScriptableTooltip; + footerMarginTop: Scriptable>; /** * Color of footer * @default '#fff' */ - footerColor: ScriptableTooltip; + footerColor: Scriptable>; /** * See Fonts * @default {style: 'bold'} */ - footerFont: ScriptableTooltip; + footerFont: Scriptable>; /** * Horizontal alignment of the footer text lines. * @default 'left' */ - footerAlign: ScriptableTooltip; + footerAlign: Scriptable>; /** * Padding to add to the tooltip * @default 6 */ - padding: ScriptableTooltip; + padding: Scriptable>; /** * Extra distance to move the end of the tooltip arrow away from the tooltip point. * @default 2 */ - caretPadding: ScriptableTooltip; + caretPadding: Scriptable>; /** * Size, in px, of the tooltip arrow. * @default 5 */ - caretSize: ScriptableTooltip; + caretSize: Scriptable>; /** * Radius of tooltip corner curves. * @default 6 */ - cornerRadius: ScriptableTooltip; + cornerRadius: Scriptable>; /** * Color to draw behind the colored boxes when multiple items are in the tooltip. * @default '#fff' */ - multiKeyBackground: ScriptableTooltip; + multiKeyBackground: Scriptable>; /** * If true, color boxes are shown in the tooltip. * @default true */ - displayColors: ScriptableTooltip; + displayColors: Scriptable>; /** * Width of the color box if displayColors is true. * @default bodyFont.size */ - boxWidth: ScriptableTooltip; + boxWidth: Scriptable>; /** * Height of the color box if displayColors is true. * @default bodyFont.size */ - boxHeight: ScriptableTooltip; + boxHeight: Scriptable>; /** * Use the corresponding point style (from dataset options) instead of color boxes, ex: star, triangle etc. (size is based on the minimum value between boxWidth and boxHeight) * @default false */ - usePointStyle: ScriptableTooltip; + usePointStyle: Scriptable>; /** * Color of the border. * @default 'rgba(0, 0, 0, 0)' */ - borderColor: ScriptableTooltip; + borderColor: Scriptable>; /** * Size of the border. * @default 0 */ - borderWidth: ScriptableTooltip; + borderWidth: Scriptable>; /** * true for rendering the legends from right to left. */ - rtl: ScriptableTooltip; + rtl: Scriptable>; /** * This will force the text direction 'rtl' or 'ltr on the canvas for rendering the tooltips, regardless of the css specified on the canvas * @default canvas's default */ - textDirection: ScriptableTooltip; + textDirection: Scriptable>; animation: AnimationSpec; animations: AnimationsSpec;