refactor(core): CORE-12 type template resources and verify bundled notices

This commit is contained in:
Harvey Zhao committed 2026-09-11 03:50:33 +08:00
1 parent b8039ad1f1
commit 9eb7c945ca
101 files changed
+7363 -664

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import type { TemplateHost } from '../../packages/artplayer/src/template/types'
import I18n from '../../packages/artplayer/src/i18n'
import Template from '../../packages/artplayer/src/template'
interface Host extends TemplateHost<Host> {
custom: string
}
declare const host: Host
host.option.proxy = function (art) {
const same = this satisfies Host
const label: string = art.custom + same.custom
return document.createElement(label ? 'canvas' : 'video')
}
const template = new Template(host)
const node: HTMLVideoElement | HTMLCanvasElement | null = template.$video
const track: HTMLTrackElement | null = template.query<HTMLTrackElement>('track')
// @ts-expect-error A bare canvas is not a complete native video.
const video: HTMLVideoElement = template.$video
const i18n = new I18n({ option: { lang: 'custom', i18n: { custom: { Feature: 'feature' } } } })
const message: string = i18n.get('Feature')
// @ts-expect-error A message dictionary is not a numeric table.
i18n.update({ custom: { Feature: 42 } })
void [node, track, video, message]