mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
35 lines
972 B
TypeScript
35 lines
972 B
TypeScript
import { ReactiveElement } from '@videojs/element';
|
|
import { namedNodeMapToObject } from '@videojs/utils/dom';
|
|
import { safeDefine } from '../safe-define';
|
|
|
|
function getTemplateHTML(_attrs: Record<string, string>) {
|
|
return /*html*/ `
|
|
<media-container>
|
|
<slot></slot>
|
|
</media-container>
|
|
`;
|
|
}
|
|
|
|
export class BackgroundVideoSkinElement extends ReactiveElement {
|
|
static readonly tagName = 'background-video-skin';
|
|
static shadowRootOptions = { mode: 'open' as ShadowRootMode };
|
|
static getTemplateHTML = getTemplateHTML;
|
|
|
|
constructor() {
|
|
super();
|
|
|
|
if (!this.shadowRoot) {
|
|
this.attachShadow((this.constructor as typeof BackgroundVideoSkinElement).shadowRootOptions);
|
|
this.shadowRoot!.innerHTML = getTemplateHTML(namedNodeMapToObject(this.attributes));
|
|
}
|
|
}
|
|
}
|
|
|
|
safeDefine(BackgroundVideoSkinElement);
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
[BackgroundVideoSkinElement.tagName]: BackgroundVideoSkinElement;
|
|
}
|
|
}
|