refactor(packages): clean up UI component types and data flow (#479)

This commit is contained in:
rahim
2026-02-09 20:15:26 +11:00
committed by GitHub
parent fef26c8421
commit 5f5ffb9f0a
32 changed files with 681 additions and 732 deletions
@@ -1,5 +1,5 @@
import type { PropertyValues } from '@lit/reactive-element';
import { MuteButtonCore, MuteButtonDataAttributes } from '@videojs/core';
import { MuteButtonCore, MuteButtonDataAttrs } from '@videojs/core';
import {
applyElementProps,
applyStateDataAttrs,
@@ -40,7 +40,7 @@ export class MuteButtonElement extends MediaElement {
applyElementProps(this, buttonProps, this.#disconnect.signal);
if (!this.#state.value) {
if (__DEV__ && !this.#state.value) {
logMissingFeature(MuteButtonElement.tagName, 'volume');
}
}
@@ -59,13 +59,12 @@ export class MuteButtonElement extends MediaElement {
protected override update(changed: PropertyValues): void {
super.update(changed);
const state = this.#state.value;
const media = this.#state.value;
if (!state) {
return;
}
if (!media) return;
const state = this.#core.getState(media);
applyElementProps(this, this.#core.getAttrs(state));
applyStateDataAttrs(this, this.#core.getState(state), MuteButtonDataAttributes);
applyStateDataAttrs(this, state, MuteButtonDataAttrs);
}
}