mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Standardize type declaration indentation with tabs (#8263)
This commit is contained in:
parent
a22288dc2d
commit
4f7179a626
12
types/geometric.d.ts
vendored
12
types/geometric.d.ts
vendored
@ -1,11 +1,11 @@
|
||||
export interface ChartArea {
|
||||
top: number;
|
||||
left: number;
|
||||
right: number;
|
||||
bottom: number;
|
||||
top: number;
|
||||
left: number;
|
||||
right: number;
|
||||
bottom: number;
|
||||
}
|
||||
|
||||
export interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
122
types/helpers/helpers.canvas.d.ts
vendored
122
types/helpers/helpers.canvas.d.ts
vendored
@ -10,10 +10,10 @@ export function clipArea(ctx: CanvasRenderingContext2D, area: ChartArea): void;
|
||||
export function unclipArea(ctx: CanvasRenderingContext2D): void;
|
||||
|
||||
export interface DrawPointOptions {
|
||||
pointStyle: PointStyle;
|
||||
rotation?: number;
|
||||
radius: number;
|
||||
borderWidth: number;
|
||||
pointStyle: PointStyle;
|
||||
rotation?: number;
|
||||
radius: number;
|
||||
borderWidth: number;
|
||||
}
|
||||
|
||||
export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptions, x: number, y: number): void;
|
||||
@ -26,74 +26,74 @@ export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptio
|
||||
export function toFontString(font: { size: number; family: string; style?: string; weight?: string }): string | null;
|
||||
|
||||
export interface RenderTextOpts {
|
||||
/**
|
||||
* The fill color of the text. If unset, the existing
|
||||
* fillStyle property of the canvas is unchanged.
|
||||
*/
|
||||
color?: Color;
|
||||
/**
|
||||
* The fill color of the text. If unset, the existing
|
||||
* fillStyle property of the canvas is unchanged.
|
||||
*/
|
||||
color?: Color;
|
||||
|
||||
/**
|
||||
* The width of the strikethrough / underline
|
||||
* @default 2
|
||||
*/
|
||||
decorationWidth?: number;
|
||||
/**
|
||||
* The width of the strikethrough / underline
|
||||
* @default 2
|
||||
*/
|
||||
decorationWidth?: number;
|
||||
|
||||
/**
|
||||
* The max width of the text in pixels
|
||||
*/
|
||||
maxWidth?: number;
|
||||
/**
|
||||
* The max width of the text in pixels
|
||||
*/
|
||||
maxWidth?: number;
|
||||
|
||||
/**
|
||||
* A rotation to be applied to the canvas
|
||||
* This is applied after the translation is applied
|
||||
*/
|
||||
rotation?: number;
|
||||
/**
|
||||
* A rotation to be applied to the canvas
|
||||
* This is applied after the translation is applied
|
||||
*/
|
||||
rotation?: number;
|
||||
|
||||
/**
|
||||
* Apply a strikethrough effect to the text
|
||||
*/
|
||||
strikethrough?: boolean;
|
||||
/**
|
||||
* Apply a strikethrough effect to the text
|
||||
*/
|
||||
strikethrough?: boolean;
|
||||
|
||||
/**
|
||||
* The color of the text stroke. If unset, the existing
|
||||
* strokeStyle property of the context is unchanged
|
||||
*/
|
||||
strokeColor?: Color;
|
||||
/**
|
||||
* The color of the text stroke. If unset, the existing
|
||||
* strokeStyle property of the context is unchanged
|
||||
*/
|
||||
strokeColor?: Color;
|
||||
|
||||
/**
|
||||
* The text stroke width. If unset, the existing
|
||||
* lineWidth property of the context is unchanged
|
||||
*/
|
||||
strokeWidth?: number;
|
||||
/**
|
||||
* The text stroke width. If unset, the existing
|
||||
* lineWidth property of the context is unchanged
|
||||
*/
|
||||
strokeWidth?: number;
|
||||
|
||||
/**
|
||||
* The text alignment to use. If unset, the existing
|
||||
* textAlign property of the context is unchanged
|
||||
*/
|
||||
textAlign: CanvasTextAlign;
|
||||
/**
|
||||
* The text alignment to use. If unset, the existing
|
||||
* textAlign property of the context is unchanged
|
||||
*/
|
||||
textAlign: CanvasTextAlign;
|
||||
|
||||
/**
|
||||
* The text baseline to use. If unset, the existing
|
||||
* textBaseline property of the context is unchanged
|
||||
*/
|
||||
textBaseline: CanvasTextBaseline;
|
||||
/**
|
||||
* The text baseline to use. If unset, the existing
|
||||
* textBaseline property of the context is unchanged
|
||||
*/
|
||||
textBaseline: CanvasTextBaseline;
|
||||
|
||||
/**
|
||||
* If specified, a translation to apply to the context
|
||||
*/
|
||||
translation?: [number, number];
|
||||
/**
|
||||
* If specified, a translation to apply to the context
|
||||
*/
|
||||
translation?: [number, number];
|
||||
|
||||
/**
|
||||
* Underline the text
|
||||
*/
|
||||
underline?: boolean;
|
||||
/**
|
||||
* Underline the text
|
||||
*/
|
||||
underline?: boolean;
|
||||
}
|
||||
|
||||
export function renderText(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
text: string | string[],
|
||||
x: number,
|
||||
y: number,
|
||||
font: CanvasFontSpec,
|
||||
opts?: RenderTextOpts
|
||||
ctx: CanvasRenderingContext2D,
|
||||
text: string | string[],
|
||||
x: number,
|
||||
y: number,
|
||||
font: CanvasFontSpec,
|
||||
opts?: RenderTextOpts
|
||||
): void;
|
||||
|
10
types/helpers/helpers.collection.d.ts
vendored
10
types/helpers/helpers.collection.d.ts
vendored
@ -1,9 +1,9 @@
|
||||
export interface ArrayListener<T> {
|
||||
_onDataPush?(...item: T[]): void;
|
||||
_onDataPop?(): void;
|
||||
_onDataShift?(): void;
|
||||
_onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
|
||||
_onDataUnshift?(...item: T[]): void;
|
||||
_onDataPush?(...item: T[]): void;
|
||||
_onDataPop?(): void;
|
||||
_onDataShift?(): void;
|
||||
_onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
|
||||
_onDataUnshift?(...item: T[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
44
types/helpers/helpers.color.d.ts
vendored
44
types/helpers/helpers.color.d.ts
vendored
@ -2,30 +2,30 @@ export function color(value: CanvasGradient): CanvasGradient;
|
||||
export function color(value: CanvasPattern): CanvasPattern;
|
||||
|
||||
export interface ColorModel {
|
||||
rgbString(): string;
|
||||
hexString(): string;
|
||||
hslString(): string;
|
||||
rgb: { r: number; g: number; b: number; a: number };
|
||||
valid: boolean;
|
||||
mix(color: ColorModel, weight: number): this;
|
||||
clone(): ColorModel;
|
||||
alpha(a: number): ColorModel;
|
||||
clearer(ration: number): ColorModel;
|
||||
greyscale(): ColorModel;
|
||||
opaquer(ratio: number): ColorModel;
|
||||
negate(): ColorModel;
|
||||
lighten(ratio: number): ColorModel;
|
||||
darken(ratio: number): ColorModel;
|
||||
saturate(ratio: number): ColorModel;
|
||||
desaturate(ratio: number): ColorModel;
|
||||
rotate(deg: number): this;
|
||||
rgbString(): string;
|
||||
hexString(): string;
|
||||
hslString(): string;
|
||||
rgb: { r: number; g: number; b: number; a: number };
|
||||
valid: boolean;
|
||||
mix(color: ColorModel, weight: number): this;
|
||||
clone(): ColorModel;
|
||||
alpha(a: number): ColorModel;
|
||||
clearer(ration: number): ColorModel;
|
||||
greyscale(): ColorModel;
|
||||
opaquer(ratio: number): ColorModel;
|
||||
negate(): ColorModel;
|
||||
lighten(ratio: number): ColorModel;
|
||||
darken(ratio: number): ColorModel;
|
||||
saturate(ratio: number): ColorModel;
|
||||
desaturate(ratio: number): ColorModel;
|
||||
rotate(deg: number): this;
|
||||
}
|
||||
export function color(
|
||||
value:
|
||||
| string
|
||||
| { r: number; g: number; b: number; a: number }
|
||||
| [number, number, number]
|
||||
| [number, number, number, number]
|
||||
value:
|
||||
| string
|
||||
| { r: number; g: number; b: number; a: number }
|
||||
| [number, number, number]
|
||||
| [number, number, number, number]
|
||||
): ColorModel;
|
||||
|
||||
export function getHoverColor(value: CanvasGradient): CanvasGradient;
|
||||
|
36
types/helpers/helpers.core.d.ts
vendored
36
types/helpers/helpers.core.d.ts
vendored
@ -32,7 +32,7 @@ export function isArray<T = any>(value: any): value is ArrayLike<T>;
|
||||
export function isObject(value: any): value is object;
|
||||
/**
|
||||
* Returns true if `value` is a finite number, else returns false
|
||||
* @param {*} value - The value to test.
|
||||
* @param {*} value - The value to test.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isFinite(value: any): value is number;
|
||||
@ -52,9 +52,9 @@ export function valueOrDefault<T>(value: T | undefined, defaultValue: T): T;
|
||||
* @returns {*}
|
||||
*/
|
||||
export function callback<T extends (this: TA, ...args: any[]) => R, TA, R>(
|
||||
fn: T | undefined,
|
||||
args: any[],
|
||||
thisArg?: TA
|
||||
fn: T | undefined,
|
||||
args: any[],
|
||||
thisArg?: TA
|
||||
): R | undefined;
|
||||
|
||||
/**
|
||||
@ -62,30 +62,30 @@ export function callback<T extends (this: TA, ...args: any[]) => R, TA, R>(
|
||||
* is unknown or in none intensive code (not called often and small loopable). Else
|
||||
* it's preferable to use a regular for() loop and save extra function calls.
|
||||
* @param loopable - The object or array to be iterated.
|
||||
* @param fn - The function to call for each item.
|
||||
* @param fn - The function to call for each item.
|
||||
* @param [thisArg] - The value of `this` provided for the call to `fn`.
|
||||
* @param [reverse] - If true, iterates backward on the loopable.
|
||||
*/
|
||||
export function each<T, TA>(
|
||||
loopable: T[],
|
||||
fn: (this: TA, v: T, i: number) => void,
|
||||
thisArg?: TA,
|
||||
reverse?: boolean
|
||||
loopable: T[],
|
||||
fn: (this: TA, v: T, i: number) => void,
|
||||
thisArg?: TA,
|
||||
reverse?: boolean
|
||||
): void;
|
||||
/**
|
||||
* Note(SB) for performance sake, this method should only be used when loopable type
|
||||
* is unknown or in none intensive code (not called often and small loopable). Else
|
||||
* it's preferable to use a regular for() loop and save extra function calls.
|
||||
* @param loopable - The object or array to be iterated.
|
||||
* @param fn - The function to call for each item.
|
||||
* @param fn - The function to call for each item.
|
||||
* @param [thisArg] - The value of `this` provided for the call to `fn`.
|
||||
* @param [reverse] - If true, iterates backward on the loopable.
|
||||
*/
|
||||
export function each<T, TA>(
|
||||
loopable: { [key: string]: T },
|
||||
fn: (this: TA, v: T, k: string) => void,
|
||||
thisArg?: TA,
|
||||
reverse?: boolean
|
||||
loopable: { [key: string]: T },
|
||||
fn: (this: TA, v: T, k: string) => void,
|
||||
thisArg?: TA,
|
||||
reverse?: boolean
|
||||
): void;
|
||||
|
||||
/**
|
||||
@ -95,7 +95,7 @@ export function each<T, TA>(
|
||||
export function clone<T>(source: T): T;
|
||||
|
||||
export interface MergeOptions {
|
||||
merger?: (key: string, target: any, source: any, options: any) => any;
|
||||
merger?: (key: string, target: any, source: any, options: any) => any;
|
||||
}
|
||||
/**
|
||||
* Recursively deep copies `source` properties into `target` with the given `options`.
|
||||
@ -112,9 +112,9 @@ export function merge<T, S1>(target: T, source: [S1], options?: MergeOptions): T
|
||||
export function merge<T, S1, S2>(target: T, source: [S1, S2], options?: MergeOptions): T & S1 & S2;
|
||||
export function merge<T, S1, S2, S3>(target: T, source: [S1, S2, S3], options?: MergeOptions): T & S1 & S2 & S3;
|
||||
export function merge<T, S1, S2, S3, S4>(
|
||||
target: T,
|
||||
source: [S1, S2, S3, S4],
|
||||
options?: MergeOptions
|
||||
target: T,
|
||||
source: [S1, S2, S3, S4],
|
||||
options?: MergeOptions
|
||||
): T & S1 & S2 & S3 & S4;
|
||||
export function merge<T>(target: T, source: any[], options?: MergeOptions): any;
|
||||
|
||||
|
26
types/helpers/helpers.curve.d.ts
vendored
26
types/helpers/helpers.curve.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
export interface SplinePoint {
|
||||
x: number;
|
||||
y: number;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -8,21 +8,21 @@ export interface SplinePoint {
|
||||
* http://scaledinnovation.com/analytics/splines/aboutSplines.html
|
||||
*/
|
||||
export function splineCurve(
|
||||
firstPoint: SplinePoint & { skip?: boolean },
|
||||
middlePoint: SplinePoint,
|
||||
afterPoint: SplinePoint,
|
||||
t: number
|
||||
firstPoint: SplinePoint & { skip?: boolean },
|
||||
middlePoint: SplinePoint,
|
||||
afterPoint: SplinePoint,
|
||||
t: number
|
||||
): {
|
||||
previous: SplinePoint;
|
||||
next: SplinePoint;
|
||||
previous: SplinePoint;
|
||||
next: SplinePoint;
|
||||
};
|
||||
|
||||
export interface MonotoneSplinePoint extends SplinePoint {
|
||||
skip: boolean;
|
||||
controlPointPreviousX?: number;
|
||||
controlPointPreviousY?: number;
|
||||
controlPointNextX?: number;
|
||||
controlPointNextY?: number;
|
||||
skip: boolean;
|
||||
controlPointPreviousX?: number;
|
||||
controlPointPreviousY?: number;
|
||||
controlPointNextX?: number;
|
||||
controlPointNextY?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
20
types/helpers/helpers.dom.d.ts
vendored
20
types/helpers/helpers.dom.d.ts
vendored
@ -1,16 +1,16 @@
|
||||
export function getMaximumSize(node: HTMLElement, width?: number, height?: number, aspectRatio?: number): { width: number, height: number };
|
||||
export function getRelativePosition(
|
||||
evt: MouseEvent,
|
||||
chart: { readonly canvas: HTMLCanvasElement }
|
||||
evt: MouseEvent,
|
||||
chart: { readonly canvas: HTMLCanvasElement }
|
||||
): { x: number; y: number };
|
||||
export function getStyle(el: HTMLElement, property: string): string;
|
||||
export function retinaScale(
|
||||
chart: {
|
||||
currentDevicePixelRatio: number;
|
||||
readonly canvas: HTMLCanvasElement;
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
readonly ctx: CanvasRenderingContext2D;
|
||||
},
|
||||
forceRatio: number
|
||||
chart: {
|
||||
currentDevicePixelRatio: number;
|
||||
readonly canvas: HTMLCanvasElement;
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
readonly ctx: CanvasRenderingContext2D;
|
||||
},
|
||||
forceRatio: number
|
||||
): void;
|
||||
|
4
types/helpers/helpers.math.d.ts
vendored
4
types/helpers/helpers.math.d.ts
vendored
@ -9,8 +9,8 @@ export function toDegrees(radians: number): number;
|
||||
* Gets the angle from vertical upright to the point about a centre.
|
||||
*/
|
||||
export function getAngleFromPoint(
|
||||
centrePoint: { x: number; y: number },
|
||||
anglePoint: { x: number; y: number }
|
||||
centrePoint: { x: number; y: number },
|
||||
anglePoint: { x: number; y: number }
|
||||
): { angle: number; distance: number };
|
||||
|
||||
export function distanceBetweenPoints(pt1: { x: number; y: number }, pt2: { x: number; y: number }): number;
|
||||
|
12
types/helpers/helpers.options.d.ts
vendored
12
types/helpers/helpers.options.d.ts
vendored
@ -1,7 +1,7 @@
|
||||
import { FontSpec } from '../index.esm';
|
||||
|
||||
export interface CanvasFontSpec extends FontSpec {
|
||||
string: string;
|
||||
string: string;
|
||||
}
|
||||
/**
|
||||
* Parses font options and returns the font object.
|
||||
@ -28,7 +28,7 @@ export function toLineHeight(value: string, size: number): number;
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export function toPadding(
|
||||
value?: number | { top?: number; left?: number; right?: number; bottom?: number }
|
||||
value?: number | { top?: number; left?: number; right?: number; bottom?: number }
|
||||
): { top: number; left: number; right: number; bottom: number; width: number; height: number };
|
||||
|
||||
/**
|
||||
@ -43,8 +43,8 @@ export function toPadding(
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export function resolve<T, C>(
|
||||
inputs: undefined | T | ((c: C) => T) | readonly T[],
|
||||
context?: C,
|
||||
index?: number,
|
||||
info?: { cacheable?: boolean }
|
||||
inputs: undefined | T | ((c: C) => T) | readonly T[],
|
||||
context?: C,
|
||||
index?: number,
|
||||
info?: { cacheable?: boolean }
|
||||
): T | undefined;
|
||||
|
10
types/helpers/helpers.rtl.d.ts
vendored
10
types/helpers/helpers.rtl.d.ts
vendored
@ -1,9 +1,9 @@
|
||||
export interface RTLAdapter {
|
||||
x(x: number): number;
|
||||
setWidth(w: number): void;
|
||||
textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';
|
||||
xPlus(x: number, value: number): number;
|
||||
leftForLtr(x: number, itemWidth: number): number;
|
||||
x(x: number): number;
|
||||
setWidth(w: number): void;
|
||||
textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';
|
||||
xPlus(x: number, value: number): number;
|
||||
leftForLtr(x: number, itemWidth: number): number;
|
||||
}
|
||||
export function getRtlAdapter(rtl: boolean, rectX: number, width: number): RTLAdapter;
|
||||
|
||||
|
3406
types/index.esm.d.ts
vendored
3406
types/index.esm.d.ts
vendored
File diff suppressed because it is too large
Load Diff
26
types/layout.d.ts
vendored
26
types/layout.d.ts
vendored
@ -14,9 +14,9 @@ export interface LayoutItem {
|
||||
/**
|
||||
* if true, and the item is horizontal, then push vertical boxes down
|
||||
*/
|
||||
fullWidth: boolean;
|
||||
/**
|
||||
* Width of item. Must be valid after update()
|
||||
fullWidth: boolean;
|
||||
/**
|
||||
* Width of item. Must be valid after update()
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
@ -36,22 +36,22 @@ export interface LayoutItem {
|
||||
*/
|
||||
right: number;
|
||||
/**
|
||||
* Bottom edge of the item. Set by layout system and cannot be used in update
|
||||
* Bottom edge of the item. Set by layout system and cannot be used in update
|
||||
*/
|
||||
bottom: number;
|
||||
bottom: number;
|
||||
|
||||
/**
|
||||
* Called before the layout process starts
|
||||
*/
|
||||
beforeLayout?(): void;
|
||||
/**
|
||||
/**
|
||||
* Called before the layout process starts
|
||||
*/
|
||||
beforeLayout?(): void;
|
||||
/**
|
||||
* Draws the element
|
||||
*/
|
||||
draw(ChartArea): void;
|
||||
/**
|
||||
draw(ChartArea): void;
|
||||
/**
|
||||
* Returns an object with padding on the edges
|
||||
*/
|
||||
getPadding?(): ChartArea;
|
||||
getPadding?(): ChartArea;
|
||||
/**
|
||||
* returns true if the layout item is horizontal (ie. top or bottom)
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user