refactor(core): CORE-18 type builtins and own prompt lifetimes

This commit is contained in:
Harvey Zhao committed 2026-09-11 12:31:01 +08:00
1 parent a842058136
commit 98a1800032
55 files changed
+26511 -650

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
import type { AutoPlaybackHost } from '../../packages/artplayer/src/plugins/autoPlayback'
import autoPlayback from '../../packages/artplayer/src/plugins/autoPlayback'
declare const host: AutoPlaybackHost
const plugin = autoPlayback(host)
const times: Record<string, number> = plugin.times
const remaining: Record<string, number> = plugin.delete('example')
const cleared: void = plugin.clear()
// @ts-expect-error Record deletion takes the persisted string key.
plugin.delete({ id: 'example' })
// @ts-expect-error Playback times contain numbers, not text.
const invalid: Record<string, string> = plugin.times
// @ts-expect-error The plugin needs both recording and prompt resources.
autoPlayback({ storage: host.storage })
export { cleared, invalid, remaining, times }
+15
View File
@@ -0,0 +1,15 @@
import type { LockHost } from '../../packages/artplayer/src/plugins/lock'
import type { MiniProgressHost } from '../../packages/artplayer/src/plugins/miniProgressBar'
import lock from '../../packages/artplayer/src/plugins/lock'
import miniProgressBar from '../../packages/artplayer/src/plugins/miniProgressBar'
declare const host: LockHost & MiniProgressHost
const plugin = lock(host)
plugin.state = true
const state: boolean = plugin.state
const mini: { name: string } = miniProgressBar(host)
// @ts-expect-error Lock state takes a boolean.
plugin.state = 'locked'
// @ts-expect-error The miniature progress plugin has no public state accessor.
miniProgressBar(host).state = true
export { mini, state }
+12
View File
@@ -0,0 +1,12 @@
import type { FastForwardHost } from '../../packages/artplayer/src/plugins/fastForward'
import fastForward from '../../packages/artplayer/src/plugins/fastForward'
declare const host: FastForwardHost
const plugin = fastForward(host)
const visible: boolean = plugin.state
const name: string = plugin.name
// @ts-expect-error Fast-forward state is read-only.
plugin.state = true
// @ts-expect-error A playing flag does not provide the plugin's media/event host.
fastForward({ playing: true })
export { name, visible }
+22
View File
@@ -0,0 +1,22 @@
import type Notice from '../../packages/artplayer/src/notice'
import type Artplayer from '../../packages/artplayer/types/artplayer'
declare const notice: Notice
declare const art: Artplayer
const visible: boolean = notice.show
notice.show = 'message'
notice.show = new Error('message')
notice.show = false
notice.show = ''
const timer: number | null = notice.timer
const destroyed: void = notice.destroy()
// @ts-expect-error The runtime getter returns visibility, not message text.
const text: string = notice.show
// @ts-expect-error True is not a declared message input.
notice.show = true
// @ts-expect-error Arbitrary objects are not declared message inputs.
notice.show = {}
// Preserve old legal consumers until CORE-21 coordinates an explicit precise view.
const legacy: string | Error | false = art.notice.show
art.notice.show = false
export { destroyed, legacy, text, timer, visible }
+20
View File
@@ -0,0 +1,20 @@
import type { InfoHost } from '../../packages/artplayer/src/info/poll'
import type { LoadingHost } from '../../packages/artplayer/src/loading'
import type { MaskHost } from '../../packages/artplayer/src/mask'
import Info from '../../packages/artplayer/src/info'
import Loading from '../../packages/artplayer/src/loading'
import Mask from '../../packages/artplayer/src/mask'
declare const host: InfoHost & LoadingHost & MaskHost
const info = new Info(host)
const initialized: void = info.init()
const loading = new Loading(host)
const mask = new Mask(host)
loading.show = true
mask.show = false
const visible: boolean = info.show
// @ts-expect-error A polling host needs its media and panel resources.
const invalid = new Info({ constructor: { INFO_LOOP_TIME: 1 } })
// @ts-expect-error Component visibility is boolean.
loading.show = 'visible'
export { initialized, invalid, visible }