Skip to content

Commit

Permalink
Remove box padding from legend types
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacco van den Berg committed Jun 24, 2024
1 parent 4ee6c9e commit 0889cbf
Showing 1 changed file with 48 additions and 53 deletions.
101 changes: 48 additions & 53 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/* eslint-disable @typescript-eslint/ban-types */
import {DeepPartial, DistributiveArray, UnionToIntersection} from './utils.js';
import { DeepPartial, DistributiveArray, UnionToIntersection } from './utils.js';

import {TimeUnit} from '../core/core.adapters.js';
import { TimeUnit } from '../core/core.adapters.js';
import PointElement from '../elements/element.point.js';
import {EasingFunction} from '../helpers/helpers.easing.js';
import {AnimationEvent} from './animation.js';
import {AnyObject, EmptyObject} from './basic.js';
import {Color} from './color.js';
import { EasingFunction } from '../helpers/helpers.easing.js';
import { AnimationEvent } from './animation.js';
import { AnyObject, EmptyObject } from './basic.js';
import { Color } from './color.js';
import Element from '../core/core.element.js';
import {ChartArea, Padding, Point} from './geometric.js';
import {LayoutItem, LayoutPosition} from './layout.js';
import {ColorsPluginOptions} from '../plugins/plugin.colors.js';

export {EasingFunction} from '../helpers/helpers.easing.js';
export {default as ArcElement, ArcProps} from '../elements/element.arc.js';
export {default as PointElement, PointProps} from '../elements/element.point.js';
export {Animation, Animations, Animator, AnimationEvent} from './animation.js';
export {Color} from './color.js';
export {ChartArea, Point} from './geometric.js';
export {LayoutItem, LayoutPosition} from './layout.js';
import { ChartArea, Padding, Point } from './geometric.js';
import { LayoutItem, LayoutPosition } from './layout.js';
import { ColorsPluginOptions } from '../plugins/plugin.colors.js';

export { EasingFunction } from '../helpers/helpers.easing.js';
export { default as ArcElement, ArcProps } from '../elements/element.arc.js';
export { default as PointElement, PointProps } from '../elements/element.point.js';
export { Animation, Animations, Animator, AnimationEvent } from './animation.js';
export { Color } from './color.js';
export { ChartArea, Point } from './geometric.js';
export { LayoutItem, LayoutPosition } from './layout.js';

export interface ScriptableContext<TType extends ChartType> {
active: boolean;
Expand Down Expand Up @@ -156,7 +156,7 @@ export interface BarControllerChartOptions {
export type BarController = DatasetController
export declare const BarController: ChartComponent & {
prototype: BarController;
new (chart: Chart, datasetIndex: number): BarController;
new(chart: Chart, datasetIndex: number): BarController;
};

export interface BubbleControllerDatasetOptions
Expand All @@ -183,7 +183,7 @@ export interface BubbleDataPoint extends Point {
export type BubbleController = DatasetController
export declare const BubbleController: ChartComponent & {
prototype: BubbleController;
new (chart: Chart, datasetIndex: number): BubbleController;
new(chart: Chart, datasetIndex: number): BubbleController;
};

export interface LineControllerDatasetOptions
Expand Down Expand Up @@ -229,7 +229,7 @@ export interface LineControllerChartOptions {
export type LineController = DatasetController
export declare const LineController: ChartComponent & {
prototype: LineController;
new (chart: Chart, datasetIndex: number): LineController;
new(chart: Chart, datasetIndex: number): LineController;
};

export type ScatterControllerDatasetOptions = LineControllerDatasetOptions;
Expand All @@ -241,7 +241,7 @@ export type ScatterControllerChartOptions = LineControllerChartOptions;
export type ScatterController = LineController
export declare const ScatterController: ChartComponent & {
prototype: ScatterController;
new (chart: Chart, datasetIndex: number): ScatterController;
new(chart: Chart, datasetIndex: number): ScatterController;
};

export interface DoughnutControllerDatasetOptions
Expand Down Expand Up @@ -349,7 +349,7 @@ export interface DoughnutController extends DatasetController {

export declare const DoughnutController: ChartComponent & {
prototype: DoughnutController;
new (chart: Chart, datasetIndex: number): DoughnutController;
new(chart: Chart, datasetIndex: number): DoughnutController;
};

export interface DoughnutMetaExtensions {
Expand All @@ -366,7 +366,7 @@ export type PieMetaExtensions = DoughnutMetaExtensions;
export type PieController = DoughnutController
export declare const PieController: ChartComponent & {
prototype: PieController;
new (chart: Chart, datasetIndex: number): PieController;
new(chart: Chart, datasetIndex: number): PieController;
};

export interface PolarAreaControllerDatasetOptions extends DoughnutControllerDatasetOptions {
Expand Down Expand Up @@ -394,7 +394,7 @@ export interface PolarAreaController extends DoughnutController {
}
export declare const PolarAreaController: ChartComponent & {
prototype: PolarAreaController;
new (chart: Chart, datasetIndex: number): PolarAreaController;
new(chart: Chart, datasetIndex: number): PolarAreaController;
};

export interface RadarControllerDatasetOptions
Expand Down Expand Up @@ -427,7 +427,7 @@ export type RadarControllerChartOptions = LineControllerChartOptions;
export type RadarController = DatasetController
export declare const RadarController: ChartComponent & {
prototype: RadarController;
new (chart: Chart, datasetIndex: number): RadarController;
new(chart: Chart, datasetIndex: number): RadarController;
};
interface ChartMetaCommon<TElement extends Element = Element, TDatasetElement extends Element = Element> {
type: string;
Expand Down Expand Up @@ -469,7 +469,7 @@ export type ChartMeta<
TElement extends Element = Element,
TDatasetElement extends Element = Element,
> = DeepPartial<
{ [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType]
{ [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType]
> & ChartMetaCommon<TElement, TDatasetElement>;

export interface ActiveDataPoint {
Expand Down Expand Up @@ -1372,7 +1372,7 @@ export interface Scale<O extends CoreScaleOptions = CoreScaleOptions> extends El
isFullSize(): boolean;
}
export declare class Scale {
constructor(cfg: {id: string, type: string, ctx: CanvasRenderingContext2D, chart: Chart});
constructor(cfg: { id: string, type: string, ctx: CanvasRenderingContext2D, chart: Chart });
}

export interface ScriptableScaleContext {
Expand Down Expand Up @@ -1930,13 +1930,13 @@ export interface LineOptions extends CommonElementOptions {
spanGaps: boolean | number;

segment: {
backgroundColor: Scriptable<Color|undefined, ScriptableLineSegmentContext>,
borderColor: Scriptable<Color|undefined, ScriptableLineSegmentContext>,
borderCapStyle: Scriptable<CanvasLineCap|undefined, ScriptableLineSegmentContext>;
borderDash: Scriptable<number[]|undefined, ScriptableLineSegmentContext>;
borderDashOffset: Scriptable<number|undefined, ScriptableLineSegmentContext>;
borderJoinStyle: Scriptable<CanvasLineJoin|undefined, ScriptableLineSegmentContext>;
borderWidth: Scriptable<number|undefined, ScriptableLineSegmentContext>;
backgroundColor: Scriptable<Color | undefined, ScriptableLineSegmentContext>,
borderColor: Scriptable<Color | undefined, ScriptableLineSegmentContext>,
borderCapStyle: Scriptable<CanvasLineCap | undefined, ScriptableLineSegmentContext>;
borderDash: Scriptable<number[] | undefined, ScriptableLineSegmentContext>;
borderDashOffset: Scriptable<number | undefined, ScriptableLineSegmentContext>;
borderJoinStyle: Scriptable<CanvasLineJoin | undefined, ScriptableLineSegmentContext>;
borderWidth: Scriptable<number | undefined, ScriptableLineSegmentContext>;
};
}

Expand All @@ -1962,7 +1962,7 @@ export interface LineElement<T extends LineProps = LineProps, O extends LineOpti

export declare const LineElement: ChartComponent & {
prototype: LineElement;
new (cfg: AnyObject): LineElement;
new(cfg: AnyObject): LineElement;
};

export type PointStyle =
Expand Down Expand Up @@ -2119,11 +2119,11 @@ export interface BarHoverOptions extends CommonHoverOptions {
export interface BarElement<
T extends BarProps = BarProps,
O extends BarOptions = BarOptions
> extends Element<T, O>, VisualElement {}
> extends Element<T, O>, VisualElement { }

export declare const BarElement: ChartComponent & {
prototype: BarElement;
new (cfg: AnyObject): BarElement;
new(cfg: AnyObject): BarElement;
};

export interface ElementOptionsByType<TType extends ChartType> {
Expand Down Expand Up @@ -2194,8 +2194,8 @@ export declare class BasePlatform {
updateConfig(config: ChartConfiguration | ChartConfigurationCustomTypesPerDataset): void;
}

export declare class BasicPlatform extends BasePlatform {}
export declare class DomPlatform extends BasePlatform {}
export declare class BasicPlatform extends BasePlatform { }
export declare class DomPlatform extends BasePlatform { }

export declare const Decimation: Plugin;

Expand Down Expand Up @@ -2405,11 +2405,6 @@ export interface LegendOptions<TType extends ChartType> {
* @default fontSize
*/
boxHeight: number;
/**
* Padding between the color box and the text
* @default 1
*/
boxPadding: number;
/**
* Color of label
* @see Defaults.color
Expand Down Expand Up @@ -3728,7 +3723,7 @@ export type ChartType = keyof ChartTypeRegistry;

export type ScaleOptionsByType<TScale extends ScaleType = ScaleType> =
{ [key in ScaleType]: { type: key } & ScaleTypeRegistry[key]['options'] }[TScale]
;
;

// Convenience alias for creating and manipulating scale options in user code
export type ScaleOptions<TScale extends ScaleType = ScaleType> = DeepPartial<ScaleOptionsByType<TScale>>;
Expand All @@ -3746,12 +3741,12 @@ export type ScaleChartOptions<TType extends ChartType = ChartType> = {
};

export type ChartOptions<TType extends ChartType = ChartType> = DeepPartial<
CoreChartOptions<TType> &
ElementChartOptions<TType> &
PluginChartOptions<TType> &
DatasetChartOptions<TType> &
ScaleChartOptions<TType> &
ChartTypeRegistry[TType]['chartOptions']
CoreChartOptions<TType> &
ElementChartOptions<TType> &
PluginChartOptions<TType> &
DatasetChartOptions<TType> &
ScaleChartOptions<TType> &
ChartTypeRegistry[TType]['chartOptions']
>;

export type DefaultDataPoint<TType extends ChartType> = DistributiveArray<ChartTypeRegistry[TType]['defaultDataPoint']>;
Expand All @@ -3772,14 +3767,14 @@ export type ChartDataset<
TType extends ChartType = ChartType,
TData = DefaultDataPoint<TType>
> = DeepPartial<
{ [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
{ [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
> & ChartDatasetProperties<TType, TData>;

export type ChartDatasetCustomTypesPerDataset<
TType extends ChartType = ChartType,
TData = DefaultDataPoint<TType>
> = DeepPartial<
{ [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
{ [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
> & ChartDatasetPropertiesCustomTypesPerDataset<TType, TData>;

/**
Expand Down

0 comments on commit 0889cbf

Please sign in to comment.