Update artplayer.d.ts

This commit is contained in:
Harvey committed 2021-12-09 14:14:18 +08:00
1 parent 709b84a94e
commit 98c22208f3
4 files changed
+142 -88

No files matched your search

+70 -43
View File
@@ -1,7 +1,7 @@
export = Artplayer; export = Artplayer;
export as namespace Artplayer; export as namespace Artplayer;
interface Selector { type Selector = {
/** /**
* Whether the default is selected * Whether the default is selected
*/ */
@@ -11,9 +11,9 @@ interface Selector {
* Html string of selector * Html string of selector
*/ */
html: string; html: string;
} };
interface ComponentOption { type ComponentOption = {
/** /**
* Html string or html element of component * Html string or html element of component
*/ */
@@ -68,16 +68,16 @@ interface ComponentOption {
* When selector item click, use in controls * When selector item click, use in controls
*/ */
onSelect?(selector: Selector, element: HTMLElement): void; onSelect?(selector: Selector, element: HTMLElement): void;
} };
interface Component { type Component = {
/** /**
* Component ID * Component self-increasing id
*/ */
readonly id: number; readonly id: number;
/** /**
* Component name * Component parent name
*/ */
readonly name: string | void; readonly name: string | void;
@@ -102,17 +102,17 @@ interface Component {
set toggle(state: boolean); set toggle(state: boolean);
/** /**
* Dynamic adding component * Dynamic add a component
*/ */
add(option: ComponentOption): HTMLElement; add(option: ComponentOption): HTMLElement;
} };
type PluginFunction = (art: Artplayer) => any; type PluginFunction = (art: Artplayer) => any;
type WhitelistFunction = (ua: string) => Boolean; type WhitelistFunction = (ua: string) => Boolean;
type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any; type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any;
type EventCallback = (event: Event) => any; type EventCallback = (event: Event) => any;
interface SubtitleOption { type SubtitleOption = {
/** /**
* The subtitle url * The subtitle url
*/ */
@@ -121,25 +121,25 @@ interface SubtitleOption {
/** /**
* The subtitle type * The subtitle type
*/ */
type: 'vtt' | 'srt' | 'ass'; type?: 'vtt' | 'srt' | 'ass';
/** /**
* The subtitle style object * The subtitle style object
*/ */
style: CSSStyleDeclaration; style?: CSSStyleDeclaration;
/** /**
* The subtitle encoding, default utf-8 * The subtitle encoding, default utf-8
*/ */
encoding: string; encoding?: string;
/** /**
* Whether bilingual subtitle * Whether bilingual subtitle
*/ */
bilingual: boolean; bilingual?: boolean;
} };
interface Option { type Option = {
/** /**
* The container mounted by the player * The container mounted by the player
*/ */
@@ -404,28 +404,28 @@ interface Option {
* Custom default icons * Custom default icons
*/ */
icons?: { icons?: {
loading: HTMLElement | string; loading?: HTMLElement | string;
state: HTMLElement | string; state?: HTMLElement | string;
play: HTMLElement | string; play?: HTMLElement | string;
pause: HTMLElement | string; pause?: HTMLElement | string;
volume: HTMLElement | string; volume?: HTMLElement | string;
volumeClose: HTMLElement | string; volumeClose?: HTMLElement | string;
subtitle: HTMLElement | string; subtitle?: HTMLElement | string;
screenshot: HTMLElement | string; screenshot?: HTMLElement | string;
setting: HTMLElement | string; setting?: HTMLElement | string;
fullscreen: HTMLElement | string; fullscreen?: HTMLElement | string;
fullscreenWeb: HTMLElement | string; fullscreenWeb?: HTMLElement | string;
pip: HTMLElement | string; pip?: HTMLElement | string;
indicator: HTMLElement | string; indicator?: HTMLElement | string;
}; };
/** /**
* Custom video type function * Custom video type function
*/ */
customType?: { customType?: {
[propName: string]: CustomType; [key: string]: CustomType;
}; };
} };
type AspectRatio = 'default' | '4:3' | '16:9' | void; type AspectRatio = 'default' | '4:3' | '16:9' | void;
type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void; type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void;
@@ -498,8 +498,23 @@ declare class Artplayer extends Player {
static version: string; static version: string;
static env: string; static env: string;
static build: string; static build: string;
static config: object; static config: {
static utils: object; propertys: {
[key: string]: string[];
};
methods: {
[key: string]: string[];
};
events: {
[key: string]: string[];
};
prototypes: {
[key: string]: string[];
};
};
static utils: {
[key: string]: string | Function;
};
static scheme: object; static scheme: object;
static Emitter: Function; static Emitter: Function;
static validator: Function; static validator: Function;
@@ -520,7 +535,12 @@ declare class Artplayer extends Player {
emit(name: string): void; emit(name: string): void;
off(name: string, callback?: Function): void; off(name: string, callback?: Function): void;
query(selector: string): HTMLElement; query(selector: string): HTMLElement;
proxy(target: HTMLElement, name: string, callback: EventCallback, option?: object): Function; proxy(
target: HTMLElement,
name: string,
callback: EventCallback,
option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean,
): Function;
destroy(removeHtml?: boolean): void; destroy(removeHtml?: boolean): void;
readonly template: { readonly template: {
@@ -556,7 +576,12 @@ declare class Artplayer extends Player {
}; };
readonly events: { readonly events: {
proxy(target: HTMLElement, name: string, callback: EventCallback, option?: object): Function; proxy(
target: HTMLElement,
name: string,
callback: EventCallback,
option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean,
): Function;
hover(target: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): Function; hover(target: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): Function;
loadImg(target: HTMLImageElement | string): Promise<HTMLImageElement>; loadImg(target: HTMLImageElement | string): Promise<HTMLImageElement>;
}; };
@@ -600,7 +625,9 @@ declare class Artplayer extends Player {
}; };
readonly i18n: { readonly i18n: {
readonly languages: object; readonly languages: {
[key: string]: object;
};
get(key: string): string; get(key: string): string;
update(language: object): void; update(language: object): void;
}; };
@@ -623,17 +650,17 @@ declare class Artplayer extends Player {
readonly player: Player; readonly player: Player;
readonly layers: Component;
readonly controls: Component;
readonly contextmenu: Component;
readonly info: Component; readonly info: Component;
readonly loading: Component; readonly loading: Component;
readonly mask: Component; readonly mask: Component;
readonly setting: Component; readonly layers: Record<string, HTMLElement> & Component;
readonly controls: Record<string, HTMLElement> & Component;
readonly contextmenu: Record<string, HTMLElement> & Component;
readonly setting: Record<string, HTMLElement> & Component;
} }
+1 -1
View File
@@ -4856,7 +4856,7 @@
}, { }, {
key: "build", key: "build",
get: function get() { get: function get() {
return '1639016118156'; return '1639026518703';
} }
}, { }, {
key: "config", key: "config",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "artplayer", "name": "artplayer",
"version": "4.0.4", "version": "4.0.5",
"expose": "Artplayer", "expose": "Artplayer",
"description": "ArtPlayer.js is a modern and full featured HTML5 video player", "description": "ArtPlayer.js is a modern and full featured HTML5 video player",
"main": "dist/artplayer.js", "main": "dist/artplayer.js",
+70 -43
View File
@@ -1,7 +1,7 @@
export = Artplayer; export = Artplayer;
export as namespace Artplayer; export as namespace Artplayer;
interface Selector { type Selector = {
/** /**
* Whether the default is selected * Whether the default is selected
*/ */
@@ -11,9 +11,9 @@ interface Selector {
* Html string of selector * Html string of selector
*/ */
html: string; html: string;
} };
interface ComponentOption { type ComponentOption = {
/** /**
* Html string or html element of component * Html string or html element of component
*/ */
@@ -68,16 +68,16 @@ interface ComponentOption {
* When selector item click, use in controls * When selector item click, use in controls
*/ */
onSelect?(selector: Selector, element: HTMLElement): void; onSelect?(selector: Selector, element: HTMLElement): void;
} };
interface Component { type Component = {
/** /**
* Component ID * Component self-increasing id
*/ */
readonly id: number; readonly id: number;
/** /**
* Component name * Component parent name
*/ */
readonly name: string | void; readonly name: string | void;
@@ -102,17 +102,17 @@ interface Component {
set toggle(state: boolean); set toggle(state: boolean);
/** /**
* Dynamic adding component * Dynamic add a component
*/ */
add(option: ComponentOption): HTMLElement; add(option: ComponentOption): HTMLElement;
} };
type PluginFunction = (art: Artplayer) => any; type PluginFunction = (art: Artplayer) => any;
type WhitelistFunction = (ua: string) => Boolean; type WhitelistFunction = (ua: string) => Boolean;
type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any; type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any;
type EventCallback = (event: Event) => any; type EventCallback = (event: Event) => any;
interface SubtitleOption { type SubtitleOption = {
/** /**
* The subtitle url * The subtitle url
*/ */
@@ -121,25 +121,25 @@ interface SubtitleOption {
/** /**
* The subtitle type * The subtitle type
*/ */
type: 'vtt' | 'srt' | 'ass'; type?: 'vtt' | 'srt' | 'ass';
/** /**
* The subtitle style object * The subtitle style object
*/ */
style: CSSStyleDeclaration; style?: CSSStyleDeclaration;
/** /**
* The subtitle encoding, default utf-8 * The subtitle encoding, default utf-8
*/ */
encoding: string; encoding?: string;
/** /**
* Whether bilingual subtitle * Whether bilingual subtitle
*/ */
bilingual: boolean; bilingual?: boolean;
} };
interface Option { type Option = {
/** /**
* The container mounted by the player * The container mounted by the player
*/ */
@@ -404,28 +404,28 @@ interface Option {
* Custom default icons * Custom default icons
*/ */
icons?: { icons?: {
loading: HTMLElement | string; loading?: HTMLElement | string;
state: HTMLElement | string; state?: HTMLElement | string;
play: HTMLElement | string; play?: HTMLElement | string;
pause: HTMLElement | string; pause?: HTMLElement | string;
volume: HTMLElement | string; volume?: HTMLElement | string;
volumeClose: HTMLElement | string; volumeClose?: HTMLElement | string;
subtitle: HTMLElement | string; subtitle?: HTMLElement | string;
screenshot: HTMLElement | string; screenshot?: HTMLElement | string;
setting: HTMLElement | string; setting?: HTMLElement | string;
fullscreen: HTMLElement | string; fullscreen?: HTMLElement | string;
fullscreenWeb: HTMLElement | string; fullscreenWeb?: HTMLElement | string;
pip: HTMLElement | string; pip?: HTMLElement | string;
indicator: HTMLElement | string; indicator?: HTMLElement | string;
}; };
/** /**
* Custom video type function * Custom video type function
*/ */
customType?: { customType?: {
[propName: string]: CustomType; [key: string]: CustomType;
}; };
} };
type AspectRatio = 'default' | '4:3' | '16:9' | void; type AspectRatio = 'default' | '4:3' | '16:9' | void;
type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void; type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void;
@@ -498,8 +498,23 @@ declare class Artplayer extends Player {
static version: string; static version: string;
static env: string; static env: string;
static build: string; static build: string;
static config: object; static config: {
static utils: object; propertys: {
[key: string]: string[];
};
methods: {
[key: string]: string[];
};
events: {
[key: string]: string[];
};
prototypes: {
[key: string]: string[];
};
};
static utils: {
[key: string]: string | Function;
};
static scheme: object; static scheme: object;
static Emitter: Function; static Emitter: Function;
static validator: Function; static validator: Function;
@@ -520,7 +535,12 @@ declare class Artplayer extends Player {
emit(name: string): void; emit(name: string): void;
off(name: string, callback?: Function): void; off(name: string, callback?: Function): void;
query(selector: string): HTMLElement; query(selector: string): HTMLElement;
proxy(target: HTMLElement, name: string, callback: EventCallback, option?: object): Function; proxy(
target: HTMLElement,
name: string,
callback: EventCallback,
option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean,
): Function;
destroy(removeHtml?: boolean): void; destroy(removeHtml?: boolean): void;
readonly template: { readonly template: {
@@ -556,7 +576,12 @@ declare class Artplayer extends Player {
}; };
readonly events: { readonly events: {
proxy(target: HTMLElement, name: string, callback: EventCallback, option?: object): Function; proxy(
target: HTMLElement,
name: string,
callback: EventCallback,
option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean,
): Function;
hover(target: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): Function; hover(target: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): Function;
loadImg(target: HTMLImageElement | string): Promise<HTMLImageElement>; loadImg(target: HTMLImageElement | string): Promise<HTMLImageElement>;
}; };
@@ -600,7 +625,9 @@ declare class Artplayer extends Player {
}; };
readonly i18n: { readonly i18n: {
readonly languages: object; readonly languages: {
[key: string]: object;
};
get(key: string): string; get(key: string): string;
update(language: object): void; update(language: object): void;
}; };
@@ -623,17 +650,17 @@ declare class Artplayer extends Player {
readonly player: Player; readonly player: Player;
readonly layers: Component;
readonly controls: Component;
readonly contextmenu: Component;
readonly info: Component; readonly info: Component;
readonly loading: Component; readonly loading: Component;
readonly mask: Component; readonly mask: Component;
readonly setting: Component; readonly layers: Record<string, HTMLElement> & Component;
readonly controls: Record<string, HTMLElement> & Component;
readonly contextmenu: Record<string, HTMLElement> & Component;
readonly setting: Record<string, HTMLElement> & Component;
} }