feat(packages): add poster placeholder blur-up pattern (#1632)

This commit is contained in:
Ronald Urbina
2026-06-18 12:05:41 -03:00
committed by GitHub
parent b32b80e55b
commit 07428519a5
24 changed files with 417 additions and 35 deletions
@@ -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');
}
}
}
}