mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
refactor: update export syntax to default for multiple plugins and adjust package.json formatting
This commit is contained in:
1 parent
f3c0a9a77d
commit
9d966bf696
22 files changed
+102
-116
No files matched your search
+1
-1
@@ -26,7 +26,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build:all": "npm run build all && npm run build:i18n && npm run build:ts && npm run build:docs",
|
||||
"lint": "npx eslint packages/*/src --fix",
|
||||
"lint": "npx eslint packages/*/{src,types,package.json} --fix",
|
||||
"build:ts": "node ./scripts/build-ts.js",
|
||||
"build:docs": "node ./scripts/build-docs.js",
|
||||
"build:i18n": "node ./scripts/build-i18n.js",
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAds
|
||||
export as namespace artplayerPluginAds;
|
||||
|
||||
interface Option {
|
||||
/**
|
||||
* 广告源文本,支持视频链接、图片链接、HTML文本
|
||||
@@ -50,3 +47,5 @@ interface Ads {
|
||||
}
|
||||
|
||||
declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads
|
||||
|
||||
export default artplayerPluginAds
|
||||
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAmbilight
|
||||
export as namespace artplayerPluginAmbilight;
|
||||
|
||||
interface Option {
|
||||
blur?: string
|
||||
opacity?: number
|
||||
@@ -18,3 +15,5 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginAmbilight
|
||||
+2
-3
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAutoThumbnail
|
||||
export as namespace artplayerPluginAutoThumbnail;
|
||||
|
||||
interface Option {
|
||||
url?: string
|
||||
width?: number
|
||||
@@ -15,3 +12,5 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginAutoThumbnail
|
||||
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginChapter
|
||||
export as namespace artplayerPluginChapter;
|
||||
|
||||
type Chapters = {
|
||||
start: number
|
||||
end: number
|
||||
@@ -19,3 +16,5 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginChapter
|
||||
+2
-3
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginChromecast
|
||||
export as namespace artplayerPluginChromecast;
|
||||
|
||||
interface Option {
|
||||
url?: string
|
||||
sdk?: string
|
||||
@@ -15,3 +12,5 @@ interface Chromecast {
|
||||
}
|
||||
|
||||
declare const artplayerPluginChromecast: (option: Option) => (art: Artplayer) => Chromecast
|
||||
|
||||
export default artplayerPluginChromecast
|
||||
+2
-3
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginDanmukuMask
|
||||
export as namespace artplayerPluginDanmukuMask;
|
||||
|
||||
interface Option {
|
||||
solutionPath?: string
|
||||
modelSelection?: number
|
||||
@@ -23,3 +20,5 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginDanmukuMask: (option?: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginDanmukuMask
|
||||
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginDanmuku
|
||||
export as namespace artplayerPluginDanmuku;
|
||||
|
||||
type Mode = 0 | 1 | 2
|
||||
type Danmuku = Danmu[] | string | (() => Promise<Danmu[]>) | Promise<Danmu[]>
|
||||
|
||||
@@ -253,3 +250,5 @@ interface Result {
|
||||
}
|
||||
|
||||
declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginDanmuku
|
||||
+2
-3
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginDashControl
|
||||
export as namespace artplayerPluginDashControl;
|
||||
|
||||
interface Config {
|
||||
control?: boolean
|
||||
setting?: boolean
|
||||
@@ -15,3 +12,5 @@ declare const artplayerPluginDashControl: (option: { quality?: Config, audio?: C
|
||||
name: 'artplayerPluginDashControl'
|
||||
update: () => void
|
||||
}
|
||||
|
||||
export default artplayerPluginDashControl
|
||||
+2
-3
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginHlsControl
|
||||
export as namespace artplayerPluginHlsControl;
|
||||
|
||||
interface Config {
|
||||
control?: boolean
|
||||
setting?: boolean
|
||||
@@ -15,3 +12,5 @@ declare const artplayerPluginHlsControl: (option: { quality?: Config, audio?: Co
|
||||
name: 'artplayerPluginHlsControl'
|
||||
update: () => void
|
||||
}
|
||||
|
||||
export default artplayerPluginHlsControl
|
||||
@@ -1,6 +1,3 @@
|
||||
export = ArtplayerPluginIframe
|
||||
export as namespace ArtplayerPluginIframe;
|
||||
|
||||
interface Message {
|
||||
type: string
|
||||
data: any
|
||||
@@ -15,7 +12,7 @@ declare class ArtplayerPluginIframe {
|
||||
static onMessage(event: MessageEvent & { data: Message }): void
|
||||
static inject(): void
|
||||
|
||||
readonly promises: Record<number, { resove: Function, reject: Function }>
|
||||
readonly promises: Record<number, { resove: (...args: any[]) => any, reject: (...args: any[]) => any }>
|
||||
readonly injected: boolean
|
||||
readonly destroyed: boolean
|
||||
readonly $iframe: HTMLIFrameElement
|
||||
@@ -28,3 +25,5 @@ declare class ArtplayerPluginIframe {
|
||||
message(callback: (...args: any[]) => any): void
|
||||
destroy(): void
|
||||
}
|
||||
|
||||
export default ArtplayerPluginIframe
|
||||
@@ -2,9 +2,6 @@ import type SubtitlesOctopus from '@hrgui/libass-wasm-ts'
|
||||
import type Artplayer from 'artplayer'
|
||||
import type { Options } from 'libass-wasm'
|
||||
|
||||
export = artplayerPluginAss
|
||||
export as namespace artplayerPluginAss;
|
||||
|
||||
declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginLibass'
|
||||
libass: SubtitlesOctopus
|
||||
@@ -15,3 +12,5 @@ declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => {
|
||||
hide: () => void
|
||||
destroy: () => void
|
||||
}
|
||||
|
||||
export default artplayerPluginAss
|
||||
Vendored
+2
-3
@@ -1,8 +1,5 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginMultipleSubtitles
|
||||
export as namespace artplayerPluginMultipleSubtitles;
|
||||
|
||||
declare const artplayerPluginMultipleSubtitles: (option: {
|
||||
subtitles: {
|
||||
url?: string
|
||||
@@ -14,3 +11,5 @@ declare const artplayerPluginMultipleSubtitles: (option: {
|
||||
}) => (art: Artplayer) => {
|
||||
name: 'multipleSubtitles'
|
||||
}
|
||||
|
||||
export default artplayerPluginMultipleSubtitles
|
||||
@@ -1,30 +1,30 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.3",
|
||||
"name": "artplayer-plugin-vtt-thumbnail",
|
||||
"description": "vtt thumbnail plugin for ArtPlayer",
|
||||
"main": "dist/artplayer-plugin-vtt-thumbnail.js",
|
||||
"legacy": "dist/artplayer-plugin-vtt-thumbnail.legacy.js",
|
||||
"module": "dist/artplayer-plugin-vtt-thumbnail.esm.js",
|
||||
"types": "types/artplayer-plugin-vtt-thumbnail.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-plugin-vtt-thumbnail.esm.js",
|
||||
"require": "./dist/artplayer-plugin-vtt-thumbnail.js",
|
||||
"default": "./dist/artplayer-plugin-vtt-thumbnail.js"
|
||||
},
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"browserslist": "last 1 Chrome version",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
]
|
||||
"name": "artplayer-plugin-vtt-thumbnail",
|
||||
"version": "1.0.3",
|
||||
"description": "vtt thumbnail plugin for ArtPlayer",
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
],
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-plugin-vtt-thumbnail.esm.js",
|
||||
"require": "./dist/artplayer-plugin-vtt-thumbnail.js",
|
||||
"default": "./dist/artplayer-plugin-vtt-thumbnail.js"
|
||||
},
|
||||
"main": "dist/artplayer-plugin-vtt-thumbnail.js",
|
||||
"legacy": "dist/artplayer-plugin-vtt-thumbnail.legacy.js",
|
||||
"module": "dist/artplayer-plugin-vtt-thumbnail.esm.js",
|
||||
"types": "types/artplayer-plugin-vtt-thumbnail.d.ts",
|
||||
"browserslist": "last 1 Chrome version"
|
||||
}
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginVttThumbnail
|
||||
export as namespace artplayerPluginVttThumbnail;
|
||||
|
||||
declare const artplayerPluginVttThumbnail: (option: { vtt?: string, style?: Partial<CSSStyleDeclaration> }) => (
|
||||
art: Artplayer,
|
||||
) => {
|
||||
name: 'artplayerPluginVttThumbnail'
|
||||
}
|
||||
|
||||
export default artplayerPluginVttThumbnail
|
||||
@@ -1,30 +1,30 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"name": "artplayer-proxy-canvas",
|
||||
"description": "canvas proxy for ArtPlayer",
|
||||
"main": "dist/artplayer-proxy-canvas.js",
|
||||
"legacy": "dist/artplayer-proxy-canvas.legacy.js",
|
||||
"module": "dist/artplayer-proxy-canvas.esm.js",
|
||||
"types": "types/artplayer-proxy-canvas.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-proxy-canvas.esm.js",
|
||||
"require": "./dist/artplayer-proxy-canvas.js",
|
||||
"default": "./dist/artplayer-proxy-canvas.js"
|
||||
},
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"browserslist": "last 1 Chrome version",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
]
|
||||
"name": "artplayer-proxy-canvas",
|
||||
"version": "1.0.0",
|
||||
"description": "canvas proxy for ArtPlayer",
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
],
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-proxy-canvas.esm.js",
|
||||
"require": "./dist/artplayer-proxy-canvas.js",
|
||||
"default": "./dist/artplayer-proxy-canvas.js"
|
||||
},
|
||||
"main": "dist/artplayer-proxy-canvas.js",
|
||||
"legacy": "dist/artplayer-proxy-canvas.legacy.js",
|
||||
"module": "dist/artplayer-proxy-canvas.esm.js",
|
||||
"types": "types/artplayer-proxy-canvas.d.ts",
|
||||
"browserslist": "last 1 Chrome version"
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerProxyCanvas
|
||||
export as namespace artplayerProxyCanvas;
|
||||
|
||||
type Option = (ctx: CanvasRenderingContext2D, video: HTMLVideoElement) => void
|
||||
|
||||
type Result = HTMLCanvasElement
|
||||
|
||||
declare const artplayerProxyCanvas: (option: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerProxyCanvas
|
||||
+6
-9
@@ -4,16 +4,13 @@ import type { Events } from './events'
|
||||
import type { I18n } from './i18n'
|
||||
import type { Icons } from './icons'
|
||||
import type { Option } from './option'
|
||||
import type { Player } from './player'
|
||||
import type { Setting, SettingOption } from './setting'
|
||||
import type { Subtitle } from './subtitle'
|
||||
import type { Template } from './template'
|
||||
import type { Utils } from './utils'
|
||||
import { Player } from './player'
|
||||
|
||||
export = Artplayer
|
||||
export as namespace Artplayer;
|
||||
|
||||
declare class Artplayer extends Player {
|
||||
export default class Artplayer extends Player {
|
||||
constructor(option: Option, readyCallback?: (this: Artplayer, art: Artplayer) => unknown)
|
||||
|
||||
get Config(): Config
|
||||
@@ -36,7 +33,7 @@ declare class Artplayer extends Player {
|
||||
static readonly config: Config
|
||||
static readonly utils: Utils
|
||||
static readonly scheme: Record<keyof Option, any>
|
||||
static readonly Emitter: Function
|
||||
static readonly Emitter: (...args: any[]) => any
|
||||
static readonly validator: <T extends object>(option: T, scheme: object) => T
|
||||
static readonly kindOf: (item: any) => string
|
||||
static readonly html: Artplayer['template']['html']
|
||||
@@ -95,13 +92,13 @@ declare class Artplayer extends Player {
|
||||
on<T extends keyof Events>(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): unknown
|
||||
once<T extends keyof Events>(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): unknown
|
||||
emit<T extends keyof Events>(name: T, ...args: unknown[]): unknown
|
||||
off<T extends keyof Events>(name: T, callback?: Function): unknown
|
||||
off<T extends keyof Events>(name: T, callback?: ((...args: Events[T]) => unknown)): unknown
|
||||
|
||||
query: Artplayer['template']['query']
|
||||
proxy: Artplayer['events']['proxy']
|
||||
video: Artplayer['template']['$video']
|
||||
|
||||
e: Record<keyof Events, { fn: Function, ctx: unknown }[]>
|
||||
e: Record<keyof Events, { fn: (...args: any[]) => any, ctx: unknown }[]>
|
||||
|
||||
destroy(removeHtml?: boolean): void
|
||||
|
||||
@@ -166,7 +163,7 @@ declare class Artplayer extends Player {
|
||||
readonly hotkey: {
|
||||
keys: Record<string, ((event: Event) => any)[]>
|
||||
add: (key: string, callback: (this: Artplayer, event: Event) => any) => Artplayer['hotkey']
|
||||
remove: (key: string, callback: Function) => Artplayer['hotkey']
|
||||
remove: (key: string, callback: (event: Event) => any) => Artplayer['hotkey']
|
||||
}
|
||||
|
||||
readonly mask: Component
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import Artplayer = require('./artplayer')
|
||||
import type Artplayer from './artplayer'
|
||||
|
||||
export interface Selector {
|
||||
/**
|
||||
|
||||
Vendored
+2
-2
@@ -1,3 +1,4 @@
|
||||
import type Artplayer from './artplayer'
|
||||
import type { ComponentOption } from './component'
|
||||
import type { CssVar } from './cssVar'
|
||||
import type { I18n } from './i18n'
|
||||
@@ -5,7 +6,6 @@ import type { Icons } from './icons'
|
||||
import type { Quality } from './quality'
|
||||
import type { Setting } from './setting'
|
||||
import type { Subtitle } from './subtitle'
|
||||
import Artplayer = require('./artplayer')
|
||||
|
||||
export type CustomType = 'flv' | 'm3u8' | 'hls' | 'ts' | 'mpd' | 'torrent' | (string & Record<never, never>)
|
||||
|
||||
@@ -281,7 +281,7 @@ export interface Option {
|
||||
* Other video attribute
|
||||
*/
|
||||
moreVideoAttr?: Partial<{
|
||||
[key in keyof HTMLVideoElement as HTMLVideoElement[key] extends Function ? never : key]: HTMLVideoElement[key];
|
||||
[key in keyof HTMLVideoElement as HTMLVideoElement[key] extends (...args: any[]) => any ? never : key]: HTMLVideoElement[key];
|
||||
}>
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+5
-2
@@ -25,10 +25,8 @@ export declare class Player {
|
||||
set flip(state: Flip)
|
||||
get fullscreen(): boolean
|
||||
set fullscreen(state: boolean)
|
||||
set fullscreenToggle(state: boolean)
|
||||
get fullscreenWeb(): boolean
|
||||
set fullscreenWeb(state: boolean)
|
||||
set fullscreenWebToggle(state: boolean)
|
||||
get loaded(): number
|
||||
get loadedTime(): number
|
||||
get mini(): boolean
|
||||
@@ -47,8 +45,11 @@ export declare class Player {
|
||||
get x(): number
|
||||
get y(): number
|
||||
set seek(time: number)
|
||||
get seek(): number
|
||||
set forward(time: number)
|
||||
get forward(): number
|
||||
set backward(time: number)
|
||||
get backward(): number
|
||||
get url(): string
|
||||
set url(url: string)
|
||||
get volume(): number
|
||||
@@ -62,7 +63,9 @@ export declare class Player {
|
||||
get subtitleOffset(): number
|
||||
set subtitleOffset(time: number)
|
||||
set switch(url: string)
|
||||
get switch(): string
|
||||
set quality(quality: Quality[])
|
||||
get quality(): Quality[]
|
||||
get thumbnails(): Thumbnails
|
||||
set thumbnails(thumbnails: Thumbnails)
|
||||
pause(): void
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import Artplayer = require('./artplayer')
|
||||
import type Artplayer from './artplayer'
|
||||
|
||||
type Props<T> = {
|
||||
html: string
|
||||
@@ -13,7 +13,7 @@ type Props<T> = {
|
||||
$parent: Setting
|
||||
$parents: Setting[]
|
||||
$option: Setting[]
|
||||
$events: Function[]
|
||||
$events: Array<(...args: any[]) => any>
|
||||
$formatted: boolean
|
||||
} & Omit<T, 'html' | 'icon' | 'tooltip'>
|
||||
|
||||
|
||||
Reference in new issue
Block a user