mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(packages): add poster placeholder blur-up pattern (#1632)
This commit is contained in:
@@ -8,7 +8,24 @@ import { MediaUIElement } from '../media-ui-element';
|
||||
export class PosterElement extends MediaUIElement<PosterCore> {
|
||||
static readonly tagName = 'media-poster';
|
||||
|
||||
static get observedAttributes(): string[] {
|
||||
// biome-ignore lint/complexity/noThisInStatic: intentional use of super
|
||||
return [...super.observedAttributes, 'placeholdersrc'];
|
||||
}
|
||||
|
||||
protected readonly core = new PosterCore();
|
||||
protected readonly stateAttrMap = PosterDataAttrs;
|
||||
protected readonly mediaState = new PlayerController(this, playerContext, selectPlayback);
|
||||
|
||||
override attributeChangedCallback(attr: string, oldValue: string | null, newValue: string | null): void {
|
||||
super.attributeChangedCallback(attr, oldValue, newValue);
|
||||
|
||||
if (attr === 'placeholdersrc') {
|
||||
if (newValue) {
|
||||
this.style.setProperty('--media-poster-placeholder', `url(${newValue})`);
|
||||
} else {
|
||||
this.style.removeProperty('--media-poster-placeholder');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user