From c7eb41631822bab144029d760490842a6b8b1320 Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Sat, 29 Jan 2022 13:47:29 +0100 Subject: [PATCH 1/2] Change repeating alingment to single type for easy of maint --- types/index.esm.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index a42d4fe4b69..2b405ff91a7 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -1655,6 +1655,7 @@ export interface FontSpec { } export type TextAlign = 'left' | 'center' | 'right'; +export type AlignStartCenterEnd = 'start' | 'center' | 'end'; export interface VisualElement { draw(ctx: CanvasRenderingContext2D, area?: ChartArea): void; @@ -2231,7 +2232,7 @@ export interface LegendOptions { * Alignment of the legend. * @default 'center' */ - align: 'start' | 'center' | 'end'; + align: AlignStartCenterEnd; /** * Maximum height of the legend, in pixels */ @@ -2367,7 +2368,7 @@ export interface TitleOptions { * Alignment of the title. * @default 'center' */ - align: 'start' | 'center' | 'end'; + align: AlignStartCenterEnd; /** * Is the title shown? * @default false @@ -2993,7 +2994,7 @@ export interface CartesianScaleOptions extends CoreScaleOptions { /** If true, displays the axis title. */ display: boolean; /** Alignment of the axis title. */ - align: 'start' | 'center' | 'end'; + align: AlignStartCenterEnd; /** The text for the title, e.g. "# of People" or "Response Choices". */ text: string | string[]; /** Color of the axis label. */ @@ -3027,7 +3028,7 @@ export interface CartesianScaleOptions extends CoreScaleOptions { * The label alignment * @default 'center' */ - align: 'start' | 'center' | 'end'; + align: AlignStartCenterEnd; /** * If true, automatically calculates how many labels can be shown and hides labels accordingly. Labels will be rotated up to maxRotation before skipping any. Turn autoSkip off to show all labels no matter what. * @default true From 1cd8d745c43a23ba37e4d23e9a52e8c06ed4cc8c Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Sat, 29 Jan 2022 13:48:44 +0100 Subject: [PATCH 2/2] improved naming --- types/index.esm.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 2b405ff91a7..241de62a110 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -1655,7 +1655,7 @@ export interface FontSpec { } export type TextAlign = 'left' | 'center' | 'right'; -export type AlignStartCenterEnd = 'start' | 'center' | 'end'; +export type Align = 'start' | 'center' | 'end'; export interface VisualElement { draw(ctx: CanvasRenderingContext2D, area?: ChartArea): void; @@ -2232,7 +2232,7 @@ export interface LegendOptions { * Alignment of the legend. * @default 'center' */ - align: AlignStartCenterEnd; + align: Align; /** * Maximum height of the legend, in pixels */ @@ -2368,7 +2368,7 @@ export interface TitleOptions { * Alignment of the title. * @default 'center' */ - align: AlignStartCenterEnd; + align: Align; /** * Is the title shown? * @default false @@ -2994,7 +2994,7 @@ export interface CartesianScaleOptions extends CoreScaleOptions { /** If true, displays the axis title. */ display: boolean; /** Alignment of the axis title. */ - align: AlignStartCenterEnd; + align: Align; /** The text for the title, e.g. "# of People" or "Response Choices". */ text: string | string[]; /** Color of the axis label. */ @@ -3028,7 +3028,7 @@ export interface CartesianScaleOptions extends CoreScaleOptions { * The label alignment * @default 'center' */ - align: AlignStartCenterEnd; + align: Align; /** * If true, automatically calculates how many labels can be shown and hides labels accordingly. Labels will be rotated up to maxRotation before skipping any. Turn autoSkip off to show all labels no matter what. * @default true