import { MediaElement } from "./media-element.js";
import { applyStateDataAttrs } from "@videojs/core/dom";

//#region src/ui/context-part-element.ts
/**
* Abstract base for compound-component part elements that consume a parent
* context and apply data attributes from `ctx.state` + `ctx.stateAttrMap`.
*
* Subclasses only need to declare the `consumer` property:
*
* ```ts
* export class SliderTrackElement extends ContextPartElement<SliderState> {
*   static readonly tagName = 'media-slider-track';
*   protected readonly consumer = new ContextConsumer(this, { context: sliderContext, subscribe: true });
* }
* ```
*/
var ContextPartElement = class extends MediaElement {
	update(_changed) {
		super.update(_changed);
		const ctx = this.consumer.value;
		if (ctx) applyStateDataAttrs(this, ctx.state, ctx.stateAttrMap);
	}
};

//#endregion
export { ContextPartElement };
//# sourceMappingURL=context-part-element.js.map