mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51: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 +0,0 @@
|
||||
// eslint-disable-next-line ts/no-require-imports -- Preserve the CommonJS export-assignment namespace.
|
||||
import artplayerPluginAmbilight = require('./artplayer-plugin-ambilight.js')
|
||||
|
||||
export = artplayerPluginAmbilight
|
||||
@@ -1,2 +0,0 @@
|
||||
export { default } from './artplayer-plugin-ambilight.js'
|
||||
export type { Callable, Factory, Option, Result } from './artplayer-plugin-ambilight.js'
|
||||
+31
-36
@@ -1,40 +1,35 @@
|
||||
/* eslint-disable ts/no-redeclare -- Callable and public type namespace intentionally merge. */
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
declare namespace artplayerPluginAmbilight {
|
||||
interface Option {
|
||||
/** CSS blur radius. @default '50px' */
|
||||
blur?: string
|
||||
/** Grid cell opacity. @default 0.5 */
|
||||
opacity?: number
|
||||
/** Maximum sampling frequency in frames per second. @default 10 */
|
||||
frequency?: number
|
||||
/** Historical input retained for compatibility; runtime uses a fixed z-index of 9. */
|
||||
zIndex?: number
|
||||
/** Background color transition duration in seconds. @default 0.3 */
|
||||
duration?: number
|
||||
}
|
||||
|
||||
interface Result {
|
||||
name: 'artplayerPluginAmbilight'
|
||||
/** Start sampling; does nothing after the player is destroyed. */
|
||||
start: () => void
|
||||
/** Stop sampling while retaining the last colors. */
|
||||
stop: () => void
|
||||
}
|
||||
|
||||
interface Callable {
|
||||
(option?: Option): (art: Artplayer) => Result
|
||||
/** Keep Parameters extraction identical to the published 1.1.0 signature. */
|
||||
(option: Option): (art: Artplayer) => Result
|
||||
}
|
||||
|
||||
interface Factory extends Callable {
|
||||
/** Same function, including historical require(package).default calls. */
|
||||
readonly default: Factory
|
||||
}
|
||||
export interface Option {
|
||||
/** CSS blur radius. @default '50px' */
|
||||
blur?: string
|
||||
/** Grid cell opacity. @default 0.5 */
|
||||
opacity?: number
|
||||
/** Maximum sampling frequency in frames per second. @default 10 */
|
||||
frequency?: number
|
||||
/** Historical input retained for compatibility; runtime uses a fixed z-index of 9. */
|
||||
zIndex?: number
|
||||
/** Background color transition duration in seconds. @default 0.3 */
|
||||
duration?: number
|
||||
}
|
||||
|
||||
declare const artplayerPluginAmbilight: artplayerPluginAmbilight.Factory
|
||||
export = artplayerPluginAmbilight
|
||||
export as namespace artplayerPluginAmbilight
|
||||
export interface Result {
|
||||
name: 'artplayerPluginAmbilight'
|
||||
/** Start sampling; does nothing after the player is destroyed. */
|
||||
start: () => void
|
||||
/** Stop sampling while retaining the last colors. */
|
||||
stop: () => void
|
||||
}
|
||||
|
||||
/** Published 1.1.0 factory shape; the options argument remains required. */
|
||||
export type Callable = (option: Option) => (art: Artplayer) => Result
|
||||
export type Factory = Callable
|
||||
|
||||
/** Accurate optional invocation and CommonJS self alias, exposed by /runtime. */
|
||||
export interface RuntimeFactory {
|
||||
(option?: Option): (art: Artplayer) => Result
|
||||
readonly default: RuntimeFactory
|
||||
}
|
||||
|
||||
declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) => Result
|
||||
export default artplayerPluginAmbilight
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { RuntimeFactory } from './artplayer-plugin-ambilight.js'
|
||||
|
||||
declare const artplayerPluginAmbilight: RuntimeFactory
|
||||
// eslint-disable-next-line ts/no-redeclare -- Ambient merge exposes types on the CommonJS factory.
|
||||
declare namespace artplayerPluginAmbilight {
|
||||
type Option = import('./artplayer-plugin-ambilight.js').Option
|
||||
type Result = import('./artplayer-plugin-ambilight.js').Result
|
||||
type RuntimeFactory = import('./artplayer-plugin-ambilight.js').RuntimeFactory
|
||||
}
|
||||
export = artplayerPluginAmbilight
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { RuntimeFactory } from './artplayer-plugin-ambilight.js'
|
||||
|
||||
declare const artplayerPluginAmbilight: RuntimeFactory
|
||||
export default artplayerPluginAmbilight
|
||||
export type { Option, Result, RuntimeFactory } from './artplayer-plugin-ambilight.js'
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { RuntimeFactory } from './artplayer-plugin-ambilight.js'
|
||||
|
||||
declare const artplayerPluginAmbilight: RuntimeFactory
|
||||
// eslint-disable-next-line ts/no-redeclare -- Ambient merge exposes types on the CommonJS factory.
|
||||
declare namespace artplayerPluginAmbilight {
|
||||
type Option = import('./artplayer-plugin-ambilight.js').Option
|
||||
type Result = import('./artplayer-plugin-ambilight.js').Result
|
||||
type RuntimeFactory = import('./artplayer-plugin-ambilight.js').RuntimeFactory
|
||||
}
|
||||
export = artplayerPluginAmbilight
|
||||
Reference in new issue
Block a user