refactor(danmuku): [PKG-DANMUKU-06] migrate runtime and preserve public types

This commit is contained in:
Harvey Zhao committed 2026-09-13 22:06:00 +08:00
1 parent abc8008da7
commit 24b883d862
64 files changed
+14020 -633

No files matched your search

@@ -0,0 +1,30 @@
import style from './style.less?inline'
if (typeof document !== 'undefined') {
const id = 'artplayer-plugin-danmuku'
const pending = Symbol.for('artplayer-plugin-danmuku.pending-style')
const styleDocument = document as Document & { [key: symbol]: HTMLElement | undefined }
let $style = document.getElementById(id) || styleDocument[pending]
if (!$style) {
$style = document.createElement('style')
$style.id = id
if (document.readyState === 'loading') {
styleDocument[pending] = $style
const ready = () => {
document.removeEventListener('DOMContentLoaded', ready)
if (styleDocument[pending] === $style)
delete styleDocument[pending]
const existing = document.getElementById(id)
if (existing)
existing.textContent = $style!.textContent
else
(document.head || document.documentElement).appendChild($style!)
}
document.addEventListener('DOMContentLoaded', ready, { once: true })
}
else {
(document.head || document.documentElement).appendChild($style!)
}
}
$style.textContent = style
}