mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
fix(types): [PKG-FACTORY-01] preserve published factory compatibility
This commit is contained in:
1 parent
1117107032
commit
c4c7491e16
35 files changed
+670
-229
No files matched your search
@@ -1,4 +1,2 @@
|
||||
// eslint-disable-next-line ts/no-require-imports -- Preserve the CommonJS export-assignment namespace.
|
||||
import artplayerProxyCanvas = require('./artplayer-proxy-canvas.js')
|
||||
|
||||
export = artplayerProxyCanvas
|
||||
export { default } from './artplayer-proxy-canvas.js'
|
||||
export type { Callable, Factory, MediaCanvas, Option, Result, RuntimeFactory } from './artplayer-proxy-canvas.js'
|
||||
@@ -1,2 +1,5 @@
|
||||
export { default } from './artplayer-proxy-canvas.js'
|
||||
export type { Callable, Factory, MediaCanvas, Option, Result } from './artplayer-proxy-canvas.js'
|
||||
import type { Factory } from './artplayer-proxy-canvas.js'
|
||||
|
||||
declare const artplayerProxyCanvas: Factory
|
||||
export default artplayerProxyCanvas
|
||||
export type { Callable, Factory, MediaCanvas, Option, Result, RuntimeFactory } from './artplayer-proxy-canvas.js'
|
||||
@@ -1,27 +1,22 @@
|
||||
/* eslint-disable ts/no-redeclare -- Callable and public type namespace intentionally merge. */
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
declare namespace artplayerProxyCanvas {
|
||||
/** Runs after drawing and bitmap release, before the draw event. */
|
||||
type Option = (ctx: CanvasRenderingContext2D, video: HTMLVideoElement) => void
|
||||
/** Runs after drawing and bitmap release, before the draw event. */
|
||||
export type Option = (ctx: CanvasRenderingContext2D, video: HTMLVideoElement) => void
|
||||
|
||||
/** Preserve the exact published return type and its assignability. */
|
||||
type Result = HTMLCanvasElement
|
||||
/** Preserve the exact published 1.1.0 return type and its assignability. */
|
||||
export type Result = HTMLCanvasElement
|
||||
|
||||
/** Opt-in view of supported enumerable media members; native Canvas members win. */
|
||||
type MediaCanvas = HTMLCanvasElement & Pick<HTMLVideoElement, Exclude<keyof HTMLVideoElement, keyof HTMLCanvasElement>>
|
||||
export type Factory = (option?: Option) => (art: Artplayer) => Result
|
||||
export type Callable = Factory
|
||||
|
||||
interface Callable {
|
||||
/** Keep Parameters extraction optional, as published in 1.1.0. */
|
||||
(option?: Option): (art: Artplayer) => Result
|
||||
}
|
||||
/** Explicit view of forwarded media members; native Canvas members win. */
|
||||
export type MediaCanvas = HTMLCanvasElement & Pick<HTMLVideoElement, Exclude<keyof HTMLVideoElement, keyof HTMLCanvasElement>>
|
||||
|
||||
interface Factory extends Callable {
|
||||
/** Same factory, for historical require(package).default calls. */
|
||||
readonly default: Factory
|
||||
}
|
||||
/** Opt-in runtime identity; the historical root factory has no required properties. */
|
||||
export interface RuntimeFactory extends Factory {
|
||||
readonly default: RuntimeFactory
|
||||
}
|
||||
|
||||
declare const artplayerProxyCanvas: artplayerProxyCanvas.Factory
|
||||
export = artplayerProxyCanvas
|
||||
export as namespace artplayerProxyCanvas
|
||||
declare const artplayerProxyCanvas: (option?: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerProxyCanvas
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { RuntimeFactory } from './artplayer-proxy-canvas.js'
|
||||
|
||||
declare const artplayerProxyCanvas: RuntimeFactory
|
||||
// eslint-disable-next-line ts/no-redeclare -- Ambient merge exposes types on the CommonJS factory.
|
||||
declare namespace artplayerProxyCanvas {
|
||||
type Option = import('./artplayer-proxy-canvas.js').Option
|
||||
type Result = import('./artplayer-proxy-canvas.js').Result
|
||||
type Factory = import('./artplayer-proxy-canvas.js').Factory
|
||||
type MediaCanvas = import('./artplayer-proxy-canvas.js').MediaCanvas
|
||||
type RuntimeFactory = import('./artplayer-proxy-canvas.js').RuntimeFactory
|
||||
}
|
||||
export = artplayerProxyCanvas
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { RuntimeFactory } from './artplayer-proxy-canvas.js'
|
||||
|
||||
declare const artplayerProxyCanvas: RuntimeFactory
|
||||
export default artplayerProxyCanvas
|
||||
export type { Factory, MediaCanvas, Option, Result, RuntimeFactory } from './artplayer-proxy-canvas.js'
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { RuntimeFactory } from './artplayer-proxy-canvas.js'
|
||||
|
||||
declare const artplayerProxyCanvas: RuntimeFactory
|
||||
// eslint-disable-next-line ts/no-redeclare -- Ambient merge exposes types on the CommonJS factory.
|
||||
declare namespace artplayerProxyCanvas {
|
||||
type Option = import('./artplayer-proxy-canvas.js').Option
|
||||
type Result = import('./artplayer-proxy-canvas.js').Result
|
||||
type Factory = import('./artplayer-proxy-canvas.js').Factory
|
||||
type MediaCanvas = import('./artplayer-proxy-canvas.js').MediaCanvas
|
||||
type RuntimeFactory = import('./artplayer-proxy-canvas.js').RuntimeFactory
|
||||
}
|
||||
export = artplayerProxyCanvas
|
||||
Reference in new issue
Block a user