refactor: Convert protected methods to private (#2358)
This commit is contained in:
@@ -48,12 +48,12 @@ export class AdvancedCameraCardCarousel extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public selected = 0;
|
||||
|
||||
protected _refParent: Ref<HTMLSlotElement> = createRef();
|
||||
protected _refRoot: Ref<HTMLElement> = createRef();
|
||||
protected _carousel: CarouselController | null = null;
|
||||
private _refParent: Ref<HTMLSlotElement> = createRef();
|
||||
private _refRoot: Ref<HTMLElement> = createRef();
|
||||
private _carousel: CarouselController | null = null;
|
||||
|
||||
// Track slide count to distinguish user-navigation from content changes.
|
||||
protected _previousSlideCount: number | null = null;
|
||||
private _previousSlideCount: number | null = null;
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
@@ -16,7 +16,7 @@ export class AdvancedCameraCardDatePicker extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public icon?: string;
|
||||
|
||||
protected _refInput: Ref<HTMLInputElement> = createRef();
|
||||
private _refInput: Ref<HTMLInputElement> = createRef();
|
||||
|
||||
get value(): Date | null {
|
||||
return this._refInput.value?.value ? new Date(this._refInput.value.value) : null;
|
||||
|
||||
@@ -20,7 +20,7 @@ export class AdvancedCameraCardDiagnostics extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public rawConfig?: RawAdvancedCameraCardConfig;
|
||||
|
||||
protected async _renderDiagnostics(): Promise<TemplateResult> {
|
||||
private async _renderDiagnostics(): Promise<TemplateResult> {
|
||||
const diagnostics = await getDiagnostics(
|
||||
this.hass,
|
||||
this.deviceRegistryManager,
|
||||
|
||||
@@ -42,12 +42,12 @@ export class AdvancedCameraCardDrawer extends LitElement {
|
||||
@property({ type: Boolean, reflect: true, attribute: true })
|
||||
public empty = true;
|
||||
|
||||
protected _refDrawer: Ref<HTMLElement & { open: boolean }> = createRef();
|
||||
protected _refSlot: Ref<HTMLSlotElement> = createRef();
|
||||
private _refDrawer: Ref<HTMLElement & { open: boolean }> = createRef();
|
||||
private _refSlot: Ref<HTMLSlotElement> = createRef();
|
||||
|
||||
protected _resizeObserver = new ResizeObserver(() => this._hideDrawerIfNecessary());
|
||||
private _resizeObserver = new ResizeObserver(() => this._hideDrawerIfNecessary());
|
||||
|
||||
protected readonly _isHoverableDevice = isHoverableDevice();
|
||||
private readonly _isHoverableDevice = isHoverableDevice();
|
||||
|
||||
/**
|
||||
* Called on the first update.
|
||||
@@ -64,7 +64,7 @@ export class AdvancedCameraCardDrawer extends LitElement {
|
||||
this._refDrawer.value?.shadowRoot?.appendChild(style);
|
||||
}
|
||||
|
||||
protected _slotChanged(): void {
|
||||
private _slotChanged(): void {
|
||||
const children = this._refSlot.value
|
||||
? getChildrenFromElement(this._refSlot.value)
|
||||
: [];
|
||||
@@ -77,7 +77,7 @@ export class AdvancedCameraCardDrawer extends LitElement {
|
||||
this._hideDrawerIfNecessary();
|
||||
}
|
||||
|
||||
protected _hideDrawerIfNecessary(): void {
|
||||
private _hideDrawerIfNecessary(): void {
|
||||
if (!this._refDrawer.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ export class AdvancedCameraCardElementsCore extends LitElement {
|
||||
* Create the root node for our picture elements.
|
||||
* @returns The newly created root.
|
||||
*/
|
||||
protected _createRoot(): HuiConditionalElement {
|
||||
private _createRoot(): HuiConditionalElement {
|
||||
const elementConstructor = customElements.get('hui-conditional-element');
|
||||
if (!elementConstructor || !this.hass) {
|
||||
throw new Error(localize('error.could_not_render_elements'));
|
||||
@@ -201,7 +201,7 @@ export class AdvancedCameraCardElements extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public conditionStateManager?: ConditionStateManager;
|
||||
|
||||
protected _addHandler(
|
||||
private _addHandler(
|
||||
target: EventTarget,
|
||||
eventName: string,
|
||||
handler: (ev: Event) => void,
|
||||
@@ -211,7 +211,7 @@ export class AdvancedCameraCardElements extends LitElement {
|
||||
target.addEventListener(eventName, handler);
|
||||
}
|
||||
|
||||
protected _menuRemoveHandler = (ev: Event): void => {
|
||||
private _menuRemoveHandler = (ev: Event): void => {
|
||||
// Re-dispatch event from this element (instead of the disconnected one, as
|
||||
// there is no parent of the disconnected element).
|
||||
fireAdvancedCameraCardEvent<MenuItem>(
|
||||
@@ -221,7 +221,7 @@ export class AdvancedCameraCardElements extends LitElement {
|
||||
);
|
||||
};
|
||||
|
||||
protected _statusBarRemoveHandler = (ev: Event): void => {
|
||||
private _statusBarRemoveHandler = (ev: Event): void => {
|
||||
// Re-dispatch event from this element (instead of the disconnected one, as
|
||||
// there is no parent of the disconnected element).
|
||||
fireAdvancedCameraCardEvent<StatusBarItem>(
|
||||
@@ -231,7 +231,7 @@ export class AdvancedCameraCardElements extends LitElement {
|
||||
);
|
||||
};
|
||||
|
||||
protected _menuAddHandler = (ev: Event): void => {
|
||||
private _menuAddHandler = (ev: Event): void => {
|
||||
ev = ev as CustomEvent<MenuItem>;
|
||||
const path = ev.composedPath();
|
||||
if (!path.length) {
|
||||
@@ -244,7 +244,7 @@ export class AdvancedCameraCardElements extends LitElement {
|
||||
);
|
||||
};
|
||||
|
||||
protected _statusBarAddHandler = (ev: Event): void => {
|
||||
private _statusBarAddHandler = (ev: Event): void => {
|
||||
ev = ev as CustomEvent<MenuItem>;
|
||||
const path = ev.composedPath();
|
||||
if (!path.length) {
|
||||
@@ -299,8 +299,8 @@ export class AdvancedCameraCardElements extends LitElement {
|
||||
*/
|
||||
@customElement('advanced-camera-card-conditional')
|
||||
export class AdvancedCameraCardElementsConditional extends LitElement {
|
||||
protected _config?: AdvancedCameraCardConditional;
|
||||
protected _conditionManager: ConditionsManager | null = null;
|
||||
private _config?: AdvancedCameraCardConditional;
|
||||
private _conditionManager: ConditionsManager | null = null;
|
||||
|
||||
// A note on hass as an update mechanism:
|
||||
//
|
||||
@@ -344,7 +344,7 @@ export class AdvancedCameraCardElementsConditional extends LitElement {
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
|
||||
protected _createConditionManager(): void {
|
||||
private _createConditionManager(): void {
|
||||
const conditionStateManager = getConditionStateManagerViaEvent(this);
|
||||
if (!this._config || !conditionStateManager) {
|
||||
return;
|
||||
|
||||
@@ -74,9 +74,9 @@ export class AdvancedCameraCardGallery extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public conditionStateManager?: ConditionStateManagerReadonlyInterface;
|
||||
|
||||
protected _controller = new GalleryController(this);
|
||||
protected _upFolderItem: ViewFolder | null = null;
|
||||
protected _builder: UnifiedQueryBuilder | null = null;
|
||||
private _controller = new GalleryController(this);
|
||||
private _upFolderItem: ViewFolder | null = null;
|
||||
private _builder: UnifiedQueryBuilder | null = null;
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues): void {
|
||||
if (
|
||||
@@ -98,14 +98,14 @@ export class AdvancedCameraCardGallery extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _getLimit(): number {
|
||||
private _getLimit(): number {
|
||||
return (
|
||||
this.cardWideConfig?.performance?.features?.media_chunk_size ??
|
||||
MEDIA_CHUNK_SIZE_DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
protected _getFolderNavigationParameters(): FolderNavigationParamaters | null {
|
||||
private _getFolderNavigationParameters(): FolderNavigationParamaters | null {
|
||||
return this._builder && this.viewManagerEpoch
|
||||
? {
|
||||
builder: this._builder,
|
||||
@@ -115,7 +115,7 @@ export class AdvancedCameraCardGallery extends LitElement {
|
||||
: null;
|
||||
}
|
||||
|
||||
protected _renderUpFolder(): TemplateResult | void {
|
||||
private _renderUpFolder(): TemplateResult | void {
|
||||
if (!this._upFolderItem) {
|
||||
return;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ export class AdvancedCameraCardGallery extends LitElement {
|
||||
</advanced-camera-card-thumbnail>`;
|
||||
}
|
||||
|
||||
protected _renderThumbnails(): TemplateResult | void {
|
||||
private _renderThumbnails(): TemplateResult | void {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
const selected = view?.queryResults?.getSelectedResult();
|
||||
|
||||
@@ -255,7 +255,7 @@ export class AdvancedCameraCardGallery extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected async _extendGallery(
|
||||
private async _extendGallery(
|
||||
ev: CustomEvent<GalleryExtendEvent>,
|
||||
direction: 'earlier' | 'later',
|
||||
useCache = true,
|
||||
|
||||
@@ -23,8 +23,8 @@ export class AdvancedCameraCardImagePlayer extends LitElement implements MediaPl
|
||||
@property()
|
||||
public technology?: MediaTechnology;
|
||||
|
||||
protected _refImage: Ref<MediaPlayerElement<HTMLImageElement>> = createRef();
|
||||
protected _mediaPlayerController = new ImageMediaPlayerController(
|
||||
private _refImage: Ref<MediaPlayerElement<HTMLImageElement>> = createRef();
|
||||
private _mediaPlayerController = new ImageMediaPlayerController(
|
||||
this,
|
||||
() => this._refImage.value ?? null,
|
||||
);
|
||||
|
||||
@@ -89,16 +89,16 @@ export class AdvancedCameraCardImageUpdatingPlayer
|
||||
public imageConfig?: ImageBaseConfig;
|
||||
|
||||
@state()
|
||||
protected _message: Message | null = null;
|
||||
private _message: Message | null = null;
|
||||
|
||||
protected _refImage: Ref<HTMLImageElement> = createRef();
|
||||
private _refImage: Ref<HTMLImageElement> = createRef();
|
||||
|
||||
protected _cachedValueController?: CachedValueController<string>;
|
||||
protected _boundVisibilityHandler = this._visibilityHandler.bind(this);
|
||||
private _cachedValueController?: CachedValueController<string>;
|
||||
private _boundVisibilityHandler = this._visibilityHandler.bind(this);
|
||||
|
||||
protected _mediaLoadedInfo: MediaLoadedInfo | null = null;
|
||||
private _mediaLoadedInfo: MediaLoadedInfo | null = null;
|
||||
|
||||
protected _mediaPlayerController = new UpdatingImageMediaPlayerController(
|
||||
private _mediaPlayerController = new UpdatingImageMediaPlayerController(
|
||||
this,
|
||||
() => this._refImage.value ?? null,
|
||||
() => this._cachedValueController ?? null,
|
||||
@@ -195,7 +195,7 @@ export class AdvancedCameraCardImageUpdatingPlayer
|
||||
* @param entity The entity.
|
||||
* @returns The state or null if not acceptable.
|
||||
*/
|
||||
protected _getAcceptableState(entity: string | null): HassEntity | null {
|
||||
private _getAcceptableState(entity: string | null): HassEntity | null {
|
||||
const state = (entity ? this.hass?.states[entity] : null) ?? null;
|
||||
|
||||
return !!this.hass &&
|
||||
@@ -228,7 +228,7 @@ export class AdvancedCameraCardImageUpdatingPlayer
|
||||
/**
|
||||
* Handle document visibility changes.
|
||||
*/
|
||||
protected _visibilityHandler(): void {
|
||||
private _visibilityHandler(): void {
|
||||
if (!this._refImage.value) {
|
||||
return;
|
||||
}
|
||||
@@ -258,12 +258,12 @@ export class AdvancedCameraCardImageUpdatingPlayer
|
||||
* @param url An input URL (may be relative to document origin)
|
||||
* @returns A new URL as a string (absolute, will not be browser cached).
|
||||
*/
|
||||
protected _buildImageURL(url: URL): string {
|
||||
private _buildImageURL(url: URL): string {
|
||||
url.searchParams.append('_t', String(Date.now()));
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
protected _addQueryParametersToURL(url: URL, parameters?: string): URL {
|
||||
private _addQueryParametersToURL(url: URL, parameters?: string): URL {
|
||||
if (parameters) {
|
||||
const searchParams = new URLSearchParams(parameters);
|
||||
for (const [key, value] of searchParams.entries()) {
|
||||
@@ -273,7 +273,7 @@ export class AdvancedCameraCardImageUpdatingPlayer
|
||||
return url;
|
||||
}
|
||||
|
||||
protected _getRelevantEntityForMode(mode: Exclude<ImageMode, 'auto'>): string | null {
|
||||
private _getRelevantEntityForMode(mode: Exclude<ImageMode, 'auto'>): string | null {
|
||||
return mode === 'camera'
|
||||
? getCameraEntityFromConfig(this.cameraConfig)
|
||||
: mode === 'entity'
|
||||
@@ -281,7 +281,7 @@ export class AdvancedCameraCardImageUpdatingPlayer
|
||||
: null;
|
||||
}
|
||||
|
||||
protected _getImageSource(): string {
|
||||
private _getImageSource(): string {
|
||||
const mode = resolveImageMode({
|
||||
imageConfig: this.imageConfig,
|
||||
cameraConfig: this.cameraConfig,
|
||||
@@ -317,7 +317,7 @@ export class AdvancedCameraCardImageUpdatingPlayer
|
||||
/**
|
||||
* Force the img element to a safe image.
|
||||
*/
|
||||
protected _forceSafeImage(stockOnly?: boolean): void {
|
||||
private _forceSafeImage(stockOnly?: boolean): void {
|
||||
if (this._refImage.value) {
|
||||
this._refImage.value.src =
|
||||
!stockOnly && this.imageConfig?.url ? this.imageConfig.url : defaultImage;
|
||||
|
||||
@@ -36,14 +36,14 @@ export class AdvancedCameraCardImage extends LitElement implements MediaPlayer {
|
||||
@property({ attribute: false })
|
||||
public imageConfig?: ImageViewConfig;
|
||||
|
||||
protected _refImage: Ref<MediaPlayerElement> = createRef();
|
||||
private _refImage: Ref<MediaPlayerElement> = createRef();
|
||||
|
||||
public async getMediaPlayerController(): Promise<MediaPlayerController | null> {
|
||||
await this.updateComplete;
|
||||
return (await this._refImage.value?.getMediaPlayerController()) ?? null;
|
||||
}
|
||||
|
||||
protected _renderContainer(template: TemplateResult): TemplateResult {
|
||||
private _renderContainer(template: TemplateResult): TemplateResult {
|
||||
const zoomTarget = IMAGE_VIEW_ZOOM_TARGET_SENTINEL;
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
const mode = resolveImageMode({
|
||||
|
||||
@@ -21,7 +21,7 @@ export class AdvancedCameraCardKeyAssigner extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public value?: KeyboardShortcut | null;
|
||||
|
||||
protected _controller = new KeyAssignerController(this);
|
||||
private _controller = new KeyAssignerController(this);
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues): void {
|
||||
if (changedProps.has('value')) {
|
||||
|
||||
@@ -71,15 +71,15 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
public viewFilterCameraID?: string;
|
||||
|
||||
// Index between camera name and slide number.
|
||||
protected _cameraToSlide: Record<string, number> = {};
|
||||
protected _refPTZControl: Ref<AdvancedCameraCardPTZ> = createRef();
|
||||
protected _refCarousel: Ref<HTMLElement> = createRef();
|
||||
private _cameraToSlide: Record<string, number> = {};
|
||||
private _refPTZControl: Ref<AdvancedCameraCardPTZ> = createRef();
|
||||
private _refCarousel: Ref<HTMLElement> = createRef();
|
||||
|
||||
protected _mediaActionsController = new MediaActionsController();
|
||||
protected _mediaHeightController = new MediaHeightController(this, '.embla__slide');
|
||||
private _mediaActionsController = new MediaActionsController();
|
||||
private _mediaHeightController = new MediaHeightController(this, '.embla__slide');
|
||||
|
||||
@state()
|
||||
protected _mediaHasLoaded = false;
|
||||
private _mediaHasLoaded = false;
|
||||
|
||||
public connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
@@ -96,11 +96,11 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
|
||||
protected _getTransitionEffect(): TransitionEffect {
|
||||
private _getTransitionEffect(): TransitionEffect {
|
||||
return this.liveConfig?.transition_effect ?? configDefaults.live.transition_effect;
|
||||
}
|
||||
|
||||
protected _getSelectedCameraIndex(): number {
|
||||
private _getSelectedCameraIndex(): number {
|
||||
if (this.viewFilterCameraID) {
|
||||
// If the carousel is limited to a single cameraID, the first (only)
|
||||
// element is always the selected one.
|
||||
@@ -140,7 +140,7 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _getPlugins(): EmblaCarouselPlugins {
|
||||
private _getPlugins(): EmblaCarouselPlugins {
|
||||
return [AutoMediaLoadedInfo()];
|
||||
}
|
||||
|
||||
@@ -151,12 +151,12 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
* should load simultaneously.
|
||||
* @returns
|
||||
*/
|
||||
protected _getLazyLoadCount(): number | null {
|
||||
private _getLazyLoadCount(): number | null {
|
||||
// Defaults to fully-lazy loading.
|
||||
return this.liveConfig?.lazy_load === false ? null : 0;
|
||||
}
|
||||
|
||||
protected _getSlides(): [TemplateResult[], Record<string, number>] {
|
||||
private _getSlides(): [TemplateResult[], Record<string, number>] {
|
||||
if (!this.cameraManager) {
|
||||
return [[], {}];
|
||||
}
|
||||
@@ -179,14 +179,14 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
return [slides, cameraToSlide];
|
||||
}
|
||||
|
||||
protected _setViewHandler(ev: CustomEvent<CarouselSelected>): void {
|
||||
private _setViewHandler(ev: CustomEvent<CarouselSelected>): void {
|
||||
const cameraIDs = this.cameraManager?.getStore().getCameraIDsWithCapability('live');
|
||||
if (cameraIDs?.size && ev.detail.index !== this._getSelectedCameraIndex()) {
|
||||
this._setViewCameraID([...cameraIDs][ev.detail.index]);
|
||||
}
|
||||
}
|
||||
|
||||
protected _setViewCameraID(cameraID?: string | null): void {
|
||||
private _setViewCameraID(cameraID?: string | null): void {
|
||||
if (cameraID) {
|
||||
this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({
|
||||
params: {
|
||||
@@ -196,7 +196,7 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _renderLive(cameraID: string): TemplateResult | void {
|
||||
private _renderLive(cameraID: string): TemplateResult | void {
|
||||
const camera = this.cameraManager?.getStore().getCamera(cameraID);
|
||||
if (!this.liveConfig || !this.hass || !this.cameraManager || !camera) {
|
||||
return;
|
||||
@@ -233,11 +233,11 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected _getSubstreamCameraID(cameraID: string, view?: View | null): string {
|
||||
private _getSubstreamCameraID(cameraID: string, view?: View | null): string {
|
||||
return view?.context?.live?.overrides?.get(cameraID) ?? cameraID;
|
||||
}
|
||||
|
||||
protected _getCameraNeighbors(): CameraNeighbors | null {
|
||||
private _getCameraNeighbors(): CameraNeighbors | null {
|
||||
const cameraIDs = this.cameraManager
|
||||
? [...this.cameraManager?.getStore().getCameraIDsWithCapability('live')]
|
||||
: [];
|
||||
@@ -279,7 +279,7 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
};
|
||||
}
|
||||
|
||||
protected _renderNextPrevious(
|
||||
private _renderNextPrevious(
|
||||
side: 'left' | 'right',
|
||||
neighbors: CameraNeighbors | null,
|
||||
): TemplateResult {
|
||||
@@ -370,7 +370,7 @@ export class AdvancedCameraCardLiveCarousel extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected _setMediaTarget(): void {
|
||||
private _setMediaTarget(): void {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
const selectedCameraIndex = this._getSelectedCameraIndex();
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export class AdvancedCameraCardLiveGrid extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public triggeredCameraIDs?: Set<string>;
|
||||
|
||||
protected _renderCarousel(cameraID?: string): TemplateResult {
|
||||
private _renderCarousel(cameraID?: string): TemplateResult {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
const triggeredCameraID = cameraID ?? view?.camera;
|
||||
|
||||
@@ -69,7 +69,7 @@ export class AdvancedCameraCardLiveGrid extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected _gridSelectCamera(cameraID: string): void {
|
||||
private _gridSelectCamera(cameraID: string): void {
|
||||
this.viewManagerEpoch?.manager.setViewByParameters({
|
||||
params: {
|
||||
camera: cameraID,
|
||||
@@ -77,7 +77,7 @@ export class AdvancedCameraCardLiveGrid extends LitElement {
|
||||
});
|
||||
}
|
||||
|
||||
protected _needsGrid(): boolean {
|
||||
private _needsGrid(): boolean {
|
||||
const cameraIDs = this.cameraManager?.getStore().getCameraIDsWithCapability('live');
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
return (
|
||||
|
||||
@@ -33,7 +33,7 @@ export class AdvancedCameraCardLive extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public triggeredCameraIDs?: Set<string>;
|
||||
|
||||
protected _controller = new LiveController(this);
|
||||
private _controller = new LiveController(this);
|
||||
|
||||
protected render(): TemplateResult | void {
|
||||
if (!this.hass || !this.cameraManager) {
|
||||
|
||||
@@ -62,17 +62,17 @@ export class AdvancedCameraCardLiveProvider extends LitElement implements MediaP
|
||||
public zoomSettings?: PartialZoomSettings | null;
|
||||
|
||||
@state()
|
||||
protected _isVideoMediaLoaded = false;
|
||||
private _isVideoMediaLoaded = false;
|
||||
|
||||
@state()
|
||||
protected _hasProviderError = false;
|
||||
private _hasProviderError = false;
|
||||
|
||||
@state()
|
||||
protected _showStreamTroubleshooting = false;
|
||||
private _showStreamTroubleshooting = false;
|
||||
|
||||
protected _refProvider: Ref<MediaPlayerElement> = createRef();
|
||||
private _refProvider: Ref<MediaPlayerElement> = createRef();
|
||||
|
||||
protected _lazyLoadController: LazyLoadController = new LazyLoadController(this);
|
||||
private _lazyLoadController: LazyLoadController = new LazyLoadController(this);
|
||||
|
||||
// A note on dynamic imports:
|
||||
//
|
||||
@@ -84,7 +84,7 @@ export class AdvancedCameraCardLiveProvider extends LitElement implements MediaP
|
||||
// Test case: A card with a non-live view, but live pre-loaded, attempts to
|
||||
// call mute() when the <advanced-camera-card-live> element first renders in
|
||||
// the background. These calls fail without waiting for loading here.
|
||||
protected _importPromises: Promise<unknown>[] = [];
|
||||
private _importPromises: Promise<unknown>[] = [];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -106,7 +106,7 @@ export class AdvancedCameraCardLiveProvider extends LitElement implements MediaP
|
||||
* whilst loading.
|
||||
* @returns`true` if an image should be shown.
|
||||
*/
|
||||
protected _shouldShowImageDuringLoading(): boolean {
|
||||
private _shouldShowImageDuringLoading(): boolean {
|
||||
return (
|
||||
!this._isVideoMediaLoaded &&
|
||||
!!this.camera?.getConfig()?.camera_entity &&
|
||||
@@ -123,12 +123,12 @@ export class AdvancedCameraCardLiveProvider extends LitElement implements MediaP
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
|
||||
protected _videoMediaShowHandler(): void {
|
||||
private _videoMediaShowHandler(): void {
|
||||
this._isVideoMediaLoaded = true;
|
||||
this._showStreamTroubleshooting = false;
|
||||
}
|
||||
|
||||
protected _providerErrorHandler(): void {
|
||||
private _providerErrorHandler(): void {
|
||||
this._hasProviderError = true;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ export class AdvancedCameraCardLiveProvider extends LitElement implements MediaP
|
||||
return result;
|
||||
}
|
||||
|
||||
protected _renderContainer(template: TemplateResult): TemplateResult {
|
||||
private _renderContainer(template: TemplateResult): TemplateResult {
|
||||
const config = this.camera?.getConfig();
|
||||
const intermediateTemplate = html` <advanced-camera-card-media-dimensions-container
|
||||
.dimensionsConfig=${config?.dimensions}
|
||||
|
||||
@@ -53,11 +53,11 @@ export class AdvancedCameraCardGo2RTC extends LitElement implements MediaPlayer
|
||||
public controls = false;
|
||||
|
||||
@state()
|
||||
protected _message: Message | null = null;
|
||||
private _message: Message | null = null;
|
||||
|
||||
protected _player?: VideoRTC;
|
||||
private _player?: VideoRTC;
|
||||
|
||||
protected _mediaPlayerController = new VideoMediaPlayerController(
|
||||
private _mediaPlayerController = new VideoMediaPlayerController(
|
||||
this,
|
||||
() => this._player?.video ?? null,
|
||||
() => this.controls,
|
||||
@@ -81,7 +81,7 @@ export class AdvancedCameraCardGo2RTC extends LitElement implements MediaPlayer
|
||||
this.requestUpdate();
|
||||
}
|
||||
|
||||
protected _handleError(message: Message, e?: Error): void {
|
||||
private _handleError(message: Message, e?: Error): void {
|
||||
if (e) {
|
||||
errorToConsole(e as Error);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ export class AdvancedCameraCardGo2RTC extends LitElement implements MediaPlayer
|
||||
return;
|
||||
}
|
||||
|
||||
protected async _getPlayerSource(): Promise<string | null> {
|
||||
private async _getPlayerSource(): Promise<string | null> {
|
||||
const cameraConfig = this.camera?.getConfig();
|
||||
const proxyConfig = this.camera?.getProxyConfig();
|
||||
if (!this.hass || !cameraConfig) {
|
||||
@@ -155,7 +155,7 @@ export class AdvancedCameraCardGo2RTC extends LitElement implements MediaPlayer
|
||||
return result;
|
||||
}
|
||||
|
||||
protected async _createPlayer(): Promise<void> {
|
||||
private async _createPlayer(): Promise<void> {
|
||||
const src = await this._getPlayerSource();
|
||||
if (!src) {
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,7 @@ export class AdvancedCameraCardLiveHA extends LitElement implements MediaPlayer
|
||||
@property({ attribute: true, type: Boolean })
|
||||
public controls = false;
|
||||
|
||||
protected _playerRef: Ref<MediaPlayerElement> = createRef();
|
||||
private _playerRef: Ref<MediaPlayerElement> = createRef();
|
||||
|
||||
public async getMediaPlayerController(): Promise<MediaPlayerController | null> {
|
||||
await this.updateComplete;
|
||||
|
||||
@@ -19,7 +19,7 @@ export class AdvancedCameraCardLiveImage extends LitElement implements MediaPlay
|
||||
@property({ attribute: false })
|
||||
public cameraConfig?: CameraConfig;
|
||||
|
||||
protected _refImage: Ref<MediaPlayerElement> = createRef();
|
||||
private _refImage: Ref<MediaPlayerElement> = createRef();
|
||||
|
||||
public async getMediaPlayerController(): Promise<MediaPlayerController | null> {
|
||||
await this.updateComplete;
|
||||
|
||||
@@ -39,7 +39,7 @@ const JSMPEG_URL_SIGN_REFRESH_THRESHOLD_SECONDS = 1 * 60 * 60;
|
||||
|
||||
@customElement('advanced-camera-card-live-jsmpeg')
|
||||
export class AdvancedCameraCardLiveJSMPEG extends LitElement implements MediaPlayer {
|
||||
protected hass?: HomeAssistant;
|
||||
private hass?: HomeAssistant;
|
||||
|
||||
@property({ attribute: false })
|
||||
public cameraConfig?: CameraConfig;
|
||||
@@ -51,13 +51,13 @@ export class AdvancedCameraCardLiveJSMPEG extends LitElement implements MediaPla
|
||||
public cardWideConfig?: CardWideConfig;
|
||||
|
||||
@state()
|
||||
protected _message: Message | null = null;
|
||||
private _message: Message | null = null;
|
||||
|
||||
protected _jsmpegCanvasElement?: HTMLCanvasElement;
|
||||
protected _jsmpegVideoPlayer?: JSMpeg.VideoElement;
|
||||
protected _refreshPlayerTimer = new Timer();
|
||||
private _jsmpegCanvasElement?: HTMLCanvasElement;
|
||||
private _jsmpegVideoPlayer?: JSMpeg.VideoElement;
|
||||
private _refreshPlayerTimer = new Timer();
|
||||
|
||||
protected _mediaPlayerController = new JSMPEGMediaPlayerController(
|
||||
private _mediaPlayerController = new JSMPEGMediaPlayerController(
|
||||
this,
|
||||
() => this._jsmpegVideoPlayer ?? null,
|
||||
() => this._jsmpegCanvasElement ?? null,
|
||||
@@ -75,7 +75,7 @@ export class AdvancedCameraCardLiveJSMPEG extends LitElement implements MediaPla
|
||||
}
|
||||
}
|
||||
|
||||
protected async _createJSMPEGPlayer(url: string): Promise<JSMpeg.VideoElement> {
|
||||
private async _createJSMPEGPlayer(url: string): Promise<JSMpeg.VideoElement> {
|
||||
this._jsmpegVideoPlayer = await new Promise<JSMpeg.VideoElement>((resolve) => {
|
||||
let videoDecoded = false;
|
||||
const player = new JSMpeg.VideoElement(
|
||||
@@ -132,7 +132,7 @@ export class AdvancedCameraCardLiveJSMPEG extends LitElement implements MediaPla
|
||||
}
|
||||
}
|
||||
|
||||
protected _resetPlayer(): void {
|
||||
private _resetPlayer(): void {
|
||||
this._message = null;
|
||||
this._refreshPlayerTimer.stop();
|
||||
if (this._jsmpegVideoPlayer) {
|
||||
@@ -164,7 +164,7 @@ export class AdvancedCameraCardLiveJSMPEG extends LitElement implements MediaPla
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
|
||||
protected async _refreshPlayer(): Promise<void> {
|
||||
private async _refreshPlayer(): Promise<void> {
|
||||
if (!this.hass) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,11 +59,11 @@ export class AdvancedCameraCardLiveWebRTCCard extends LitElement implements Medi
|
||||
public controls = false;
|
||||
|
||||
@state()
|
||||
protected _message: Message | null = null;
|
||||
private _message: Message | null = null;
|
||||
|
||||
protected hass?: HomeAssistant;
|
||||
private hass?: HomeAssistant;
|
||||
|
||||
protected _mediaPlayerController = new VideoMediaPlayerController(
|
||||
private _mediaPlayerController = new VideoMediaPlayerController(
|
||||
this,
|
||||
() => this._getVideo(),
|
||||
() => this.controls,
|
||||
@@ -74,7 +74,7 @@ export class AdvancedCameraCardLiveWebRTCCard extends LitElement implements Medi
|
||||
}
|
||||
|
||||
// A task to await the load of the WebRTC component.
|
||||
protected _webrtcTask = new Task(this, this._getWebRTCCardElement, () => [1]);
|
||||
private _webrtcTask = new Task(this, this._getWebRTCCardElement, () => [1]);
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
@@ -97,7 +97,7 @@ export class AdvancedCameraCardLiveWebRTCCard extends LitElement implements Medi
|
||||
}
|
||||
}
|
||||
|
||||
protected _getVideoRTC(): VideoRTC | null {
|
||||
private _getVideoRTC(): VideoRTC | null {
|
||||
return (this.renderRoot?.querySelector('#webrtc') ?? null) as VideoRTC | null;
|
||||
}
|
||||
|
||||
@@ -105,13 +105,11 @@ export class AdvancedCameraCardLiveWebRTCCard extends LitElement implements Medi
|
||||
* Get the underlying video player.
|
||||
* @returns The player or `null` if not found.
|
||||
*/
|
||||
protected _getVideo(): HTMLVideoElement | null {
|
||||
private _getVideo(): HTMLVideoElement | null {
|
||||
return this._getVideoRTC()?.video ?? null;
|
||||
}
|
||||
|
||||
protected async _getWebRTCCardElement(): Promise<
|
||||
CustomElementConstructor | undefined
|
||||
> {
|
||||
private async _getWebRTCCardElement(): Promise<CustomElementConstructor | undefined> {
|
||||
await customElements.whenDefined('webrtc-camera');
|
||||
return customElements.get('webrtc-camera');
|
||||
}
|
||||
@@ -119,7 +117,7 @@ export class AdvancedCameraCardLiveWebRTCCard extends LitElement implements Medi
|
||||
/**
|
||||
* Create the WebRTC element. May throw.
|
||||
*/
|
||||
protected _createWebRTC(): HTMLElement | null {
|
||||
private _createWebRTC(): HTMLElement | null {
|
||||
const webrtcElement = this._webrtcTask.value;
|
||||
if (webrtcElement && this.hass && this.cameraConfig) {
|
||||
const webrtc = new webrtcElement() as HTMLElement & {
|
||||
|
||||
@@ -17,10 +17,10 @@ export class AdvancedCameraCardMediaDimensionsContainer extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public dimensionsConfig?: CameraDimensionsConfig;
|
||||
|
||||
protected _controller = new MediaDimensionsContainerController(this);
|
||||
private _controller = new MediaDimensionsContainerController(this);
|
||||
|
||||
protected _refInnerContainer: Ref<HTMLElement> = createRef();
|
||||
protected _refOuterContainer: Ref<HTMLElement> = createRef();
|
||||
private _refInnerContainer: Ref<HTMLElement> = createRef();
|
||||
private _refOuterContainer: Ref<HTMLElement> = createRef();
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues): void {
|
||||
if (changedProps.has('dimensionsConfig')) {
|
||||
|
||||
@@ -48,19 +48,19 @@ class AdvancedCameraCardMediaFilter extends ScopedRegistryHost(LitElement) {
|
||||
'advanced-camera-card-date-picker': AdvancedCameraCardDatePicker,
|
||||
};
|
||||
|
||||
protected _mediaFilterController = new MediaFilterController(this);
|
||||
private _mediaFilterController = new MediaFilterController(this);
|
||||
|
||||
protected _refMediaType: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refCamera: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refWhen: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refWhenFrom: Ref<AdvancedCameraCardDatePicker> = createRef();
|
||||
protected _refWhenTo: Ref<AdvancedCameraCardDatePicker> = createRef();
|
||||
protected _refWhat: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refWhere: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refFavorite: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refReviewed: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refSeverity: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
protected _refTags: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refMediaType: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refCamera: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refWhen: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refWhenFrom: Ref<AdvancedCameraCardDatePicker> = createRef();
|
||||
private _refWhenTo: Ref<AdvancedCameraCardDatePicker> = createRef();
|
||||
private _refWhat: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refWhere: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refFavorite: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refReviewed: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refSeverity: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
private _refTags: Ref<AdvancedCameraCardSelect> = createRef();
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues): void {
|
||||
if (changedProps.has('viewManagerEpoch')) {
|
||||
|
||||
@@ -20,8 +20,8 @@ export class AdvancedCameraCardMediaGrid extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public displayConfig?: ViewDisplayConfig;
|
||||
|
||||
protected _controller: MediaGridController | null = null;
|
||||
protected _refSlot: Ref<HTMLSlotElement> = createRef();
|
||||
private _controller: MediaGridController | null = null;
|
||||
private _refSlot: Ref<HTMLSlotElement> = createRef();
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
@@ -16,7 +16,7 @@ import './submenu/submenu-button';
|
||||
|
||||
@customElement('advanced-camera-card-menu')
|
||||
export class AdvancedCameraCardMenu extends LitElement {
|
||||
protected _controller = new MenuController(this);
|
||||
private _controller = new MenuController(this);
|
||||
|
||||
@property({ attribute: false })
|
||||
public entityRegistryManager?: EntityRegistryManager;
|
||||
@@ -40,7 +40,7 @@ export class AdvancedCameraCardMenu extends LitElement {
|
||||
this._controller.toggleExpanded();
|
||||
}
|
||||
|
||||
protected _renderButton(button: MenuItem): TemplateResult | void {
|
||||
private _renderButton(button: MenuItem): TemplateResult | void {
|
||||
if (!this.hass) {
|
||||
return;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ export class AdvancedCameraCardMenu extends LitElement {
|
||||
* specificity, so the most specific theme variable will match, followed by
|
||||
* the next most specific, etc.
|
||||
*/
|
||||
protected _renderPerInstanceStyle(): TemplateResult | void {
|
||||
private _renderPerInstanceStyle(): TemplateResult | void {
|
||||
const config = this._controller.getMenuConfig();
|
||||
if (!config) {
|
||||
return;
|
||||
|
||||
@@ -27,7 +27,7 @@ export class AdvancedCameraCardNextPreviousControl extends LitElement {
|
||||
public hass?: HomeAssistant;
|
||||
|
||||
@state()
|
||||
protected _controlConfig?: NextPreviousControlConfig;
|
||||
private _controlConfig?: NextPreviousControlConfig;
|
||||
|
||||
@property({ attribute: false })
|
||||
public thumbnail?: string;
|
||||
@@ -41,7 +41,7 @@ export class AdvancedCameraCardNextPreviousControl extends LitElement {
|
||||
// Label that is used for ARIA support and as tooltip.
|
||||
@property() label = '';
|
||||
|
||||
protected _embedThumbnailTask = createFetchThumbnailTask(
|
||||
private _embedThumbnailTask = createFetchThumbnailTask(
|
||||
this,
|
||||
() => this.hass,
|
||||
() => this.thumbnail,
|
||||
|
||||
@@ -12,7 +12,7 @@ export class AdvancedCameraCardOverlayMessage extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public message: OverlayMessage | null = null;
|
||||
|
||||
protected _refMessage: Ref<HTMLElement> = createRef();
|
||||
private _refMessage: Ref<HTMLElement> = createRef();
|
||||
|
||||
public connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
@@ -64,7 +64,7 @@ export class AdvancedCameraCardOverlayMessage extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected _renderControl(control: OverlayMessageControl): TemplateResult {
|
||||
private _renderControl(control: OverlayMessageControl): TemplateResult {
|
||||
const emphasisClass = control.emphasis ? `emphasis-${control.emphasis}` : '';
|
||||
return html`
|
||||
<div
|
||||
@@ -81,7 +81,7 @@ export class AdvancedCameraCardOverlayMessage extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected async _handleControlClick(control: OverlayMessageControl): Promise<void> {
|
||||
private async _handleControlClick(control: OverlayMessageControl): Promise<void> {
|
||||
const result = await control.callback();
|
||||
if (result === null) {
|
||||
// null = close the message
|
||||
@@ -92,7 +92,7 @@ export class AdvancedCameraCardOverlayMessage extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _renderDetail(detail: MetadataField, isHeading = false): TemplateResult {
|
||||
private _renderDetail(detail: MetadataField, isHeading = false): TemplateResult {
|
||||
const classes = {
|
||||
detail: true,
|
||||
heading: isHeading,
|
||||
@@ -111,23 +111,23 @@ export class AdvancedCameraCardOverlayMessage extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected _dismiss = (): void => {
|
||||
private _dismiss = (): void => {
|
||||
this._refMessage.value?.classList.add('exiting');
|
||||
};
|
||||
|
||||
protected _handleAnimationEnd = (ev: AnimationEvent): void => {
|
||||
private _handleAnimationEnd = (ev: AnimationEvent): void => {
|
||||
if (ev.animationName === 'slideDown') {
|
||||
dispatchDismissOverlayMessageEvent(this);
|
||||
}
|
||||
};
|
||||
|
||||
protected _handleOutsideInteraction = (ev: Event): void => {
|
||||
private _handleOutsideInteraction = (ev: Event): void => {
|
||||
if (!ev.composedPath().includes(this)) {
|
||||
this._dismiss();
|
||||
}
|
||||
};
|
||||
|
||||
protected _handleKeyDown = (ev: KeyboardEvent): void => {
|
||||
private _handleKeyDown = (ev: KeyboardEvent): void => {
|
||||
if (ev.key === 'Escape') {
|
||||
this._dismiss();
|
||||
ev.stopPropagation();
|
||||
|
||||
@@ -40,8 +40,8 @@ export class AdvancedCameraCardPTZ extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public forceVisibility?: boolean;
|
||||
|
||||
protected _controller = new PTZController(this);
|
||||
protected _actions: PTZControllerActions | null = null;
|
||||
private _controller = new PTZController(this);
|
||||
private _actions: PTZControllerActions | null = null;
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues): void {
|
||||
if (changedProps.has('config')) {
|
||||
|
||||
@@ -49,8 +49,8 @@ export class AdvancedCameraCardSelect extends ScopedRegistryHost(LitElement) {
|
||||
@property({ attribute: true, type: Boolean })
|
||||
public clearable?: boolean = false;
|
||||
|
||||
protected _previouslyReportedValue?: SelectValues;
|
||||
protected _refSelect: Ref<SelectElement> = createRef();
|
||||
private _previouslyReportedValue?: SelectValues;
|
||||
private _refSelect: Ref<SelectElement> = createRef();
|
||||
|
||||
static elementDefinitions = {
|
||||
...grSelectElements,
|
||||
@@ -61,7 +61,7 @@ export class AdvancedCameraCardSelect extends ScopedRegistryHost(LitElement) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
protected _valueChangedHandler(_ev: CustomEvent<{ value: unknown }>): void {
|
||||
private _valueChangedHandler(_ev: CustomEvent<{ value: unknown }>): void {
|
||||
const value: SelectValues | undefined = this._refSelect.value?.value;
|
||||
// The underlying gr-select element is very sensitive and occasionally fires
|
||||
// the change event even if the value has not actually changed. Prevent that
|
||||
|
||||
@@ -18,7 +18,7 @@ import './icon.js';
|
||||
|
||||
@customElement('advanced-camera-card-status-bar')
|
||||
export class AdvancedCameraCardStatusBar extends LitElement {
|
||||
protected _controller = new StatusBarController(this);
|
||||
private _controller = new StatusBarController(this);
|
||||
|
||||
@property({ attribute: false })
|
||||
public items?: StatusBarItem[];
|
||||
@@ -44,7 +44,7 @@ export class AdvancedCameraCardStatusBar extends LitElement {
|
||||
* specificity, so the most specific theme variable will match, followed by
|
||||
* the next most specific, etc.
|
||||
*/
|
||||
protected _renderPerInstanceStyle(): TemplateResult | void {
|
||||
private _renderPerInstanceStyle(): TemplateResult | void {
|
||||
const config = this._controller.getConfig();
|
||||
if (!config) {
|
||||
return;
|
||||
|
||||
@@ -20,7 +20,7 @@ export class AdvancedCameraCardSubmenu extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public items?: SubmenuItem[];
|
||||
|
||||
protected _renderItem(item: SubmenuItem): TemplateResult | void {
|
||||
private _renderItem(item: SubmenuItem): TemplateResult | void {
|
||||
if (!this.hass) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ export class AdvancedCameraCardSubmenuSelectButton extends LitElement {
|
||||
public entityRegistryManager?: EntityRegistryManager;
|
||||
|
||||
@state()
|
||||
protected _optionTitles?: Record<string, string>;
|
||||
private _optionTitles?: Record<string, string>;
|
||||
|
||||
protected _generatedSubmenuItems?: MenuSubmenuItem[];
|
||||
protected _generatedIcon?: Icon;
|
||||
private _generatedSubmenuItems?: MenuSubmenuItem[];
|
||||
private _generatedIcon?: Icon;
|
||||
|
||||
protected shouldUpdate(changedProps: PropertyValues): boolean {
|
||||
// No need to update the submenu unless the select entity has changed.
|
||||
@@ -50,7 +50,7 @@ export class AdvancedCameraCardSubmenuSelectButton extends LitElement {
|
||||
);
|
||||
}
|
||||
|
||||
protected async _refreshOptionTitles(): Promise<void> {
|
||||
private async _refreshOptionTitles(): Promise<void> {
|
||||
if (!this.hass || !this.submenuSelect) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ export class AdvancedCameraCardSurroundBasic extends LitElement {
|
||||
right?: DrawerIcons;
|
||||
};
|
||||
|
||||
protected _refDrawerLeft: Ref<AdvancedCameraCardDrawer> = createRef();
|
||||
protected _refDrawerRight: Ref<AdvancedCameraCardDrawer> = createRef();
|
||||
protected _boundDrawerHandler = this._drawerHandler.bind(this);
|
||||
private _refDrawerLeft: Ref<AdvancedCameraCardDrawer> = createRef();
|
||||
private _refDrawerRight: Ref<AdvancedCameraCardDrawer> = createRef();
|
||||
private _boundDrawerHandler = this._drawerHandler.bind(this);
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
@@ -41,7 +41,7 @@ export class AdvancedCameraCardSurroundBasic extends LitElement {
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
|
||||
protected _drawerHandler(ev: Event) {
|
||||
private _drawerHandler(ev: Event) {
|
||||
const drawer = (ev as CustomEvent<AdvancedCameraCardDrawerOpen>).detail.drawer;
|
||||
const open = ev.type.endsWith(':open');
|
||||
if (drawer === 'left' && this._refDrawerLeft.value) {
|
||||
|
||||
@@ -54,7 +54,7 @@ export class AdvancedCameraCardSurround extends LitElement {
|
||||
/**
|
||||
* Determine if a drawer is being used.
|
||||
*/
|
||||
protected _hasDrawer(): boolean {
|
||||
private _hasDrawer(): boolean {
|
||||
return (
|
||||
!!this.thumbnailConfig && ['left', 'right'].includes(this.thumbnailConfig.mode)
|
||||
);
|
||||
|
||||
@@ -65,17 +65,17 @@ export class AdvancedCameraCardThumbnailCarousel extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public fadeThumbnails = false;
|
||||
|
||||
protected _thumbnails: TemplateResult[] = [];
|
||||
protected _builder: UnifiedQueryBuilder | null = null;
|
||||
private _thumbnails: TemplateResult[] = [];
|
||||
private _builder: UnifiedQueryBuilder | null = null;
|
||||
|
||||
protected _getLimit(): number {
|
||||
private _getLimit(): number {
|
||||
return (
|
||||
this.cardWideConfig?.performance?.features?.media_chunk_size ??
|
||||
MEDIA_CHUNK_SIZE_DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
protected _getFolderNavOptions(): FolderNavigationParamaters | undefined {
|
||||
private _getFolderNavOptions(): FolderNavigationParamaters | undefined {
|
||||
return this._builder && this.viewManagerEpoch
|
||||
? {
|
||||
builder: this._builder,
|
||||
@@ -127,13 +127,13 @@ export class AdvancedCameraCardThumbnailCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _getSelectedSlide(): number | null {
|
||||
private _getSelectedSlide(): number | null {
|
||||
return (
|
||||
this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex() ?? null
|
||||
);
|
||||
}
|
||||
|
||||
protected _handleMediaClick(item: ViewMedia): void {
|
||||
private _handleMediaClick(item: ViewMedia): void {
|
||||
fireAdvancedCameraCardEvent<ThumbnailMediaSelect>(
|
||||
this,
|
||||
'thumbnails-carousel:media-select',
|
||||
@@ -147,7 +147,7 @@ export class AdvancedCameraCardThumbnailCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _renderThumbnail(
|
||||
private _renderThumbnail(
|
||||
item: ViewItem,
|
||||
selected: boolean,
|
||||
clickCallback: (item: ViewItem, ev: Event) => void,
|
||||
@@ -183,7 +183,7 @@ export class AdvancedCameraCardThumbnailCarousel extends LitElement {
|
||||
</advanced-camera-card-thumbnail>`;
|
||||
}
|
||||
|
||||
protected _renderThumbnails(): TemplateResult[] {
|
||||
private _renderThumbnails(): TemplateResult[] {
|
||||
const upFolderItem = getUpFolderItem(
|
||||
this.viewManagerEpoch?.manager.getView()?.query,
|
||||
);
|
||||
@@ -221,7 +221,7 @@ export class AdvancedCameraCardThumbnailCarousel extends LitElement {
|
||||
return thumbnails;
|
||||
}
|
||||
|
||||
protected _getDirection(): CarouselDirection | null {
|
||||
private _getDirection(): CarouselDirection | null {
|
||||
if (this.config?.mode === 'left' || this.config?.mode === 'right') {
|
||||
return 'vertical';
|
||||
} else if (this.config?.mode === 'above' || this.config?.mode === 'below') {
|
||||
|
||||
@@ -25,10 +25,10 @@ export class AdvancedCameraCardThumbnailFeatureThumbnail extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public hass?: HomeAssistant;
|
||||
|
||||
protected _embedThumbnailTask?: Task<FetchThumbnailTaskArgs, string | null>;
|
||||
private _embedThumbnailTask?: Task<FetchThumbnailTaskArgs, string | null>;
|
||||
|
||||
// Only load thumbnails on view in case there is a very large number of them.
|
||||
protected _intersectionObserver = new IntersectionObserver(
|
||||
private _intersectionObserver = new IntersectionObserver(
|
||||
this._intersectionHandler.bind(this),
|
||||
);
|
||||
|
||||
@@ -57,7 +57,7 @@ export class AdvancedCameraCardThumbnailFeatureThumbnail extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _intersectionHandler(entries: IntersectionObserverEntry[]): void {
|
||||
private _intersectionHandler(entries: IntersectionObserverEntry[]): void {
|
||||
if (
|
||||
this._embedThumbnailTask?.status === TaskStatus.INITIAL &&
|
||||
entries.some((entry) => entry.isIntersecting)
|
||||
|
||||
@@ -137,9 +137,9 @@ export class AdvancedCameraCardTimelineCore extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public itemClickAction?: TimelineItemClickAction;
|
||||
|
||||
protected _refDatePicker: Ref<AdvancedCameraCardDatePicker> = createRef();
|
||||
protected _refTimeline: Ref<HTMLElement> = createRef();
|
||||
protected _controller: TimelineController = new TimelineController(this);
|
||||
private _refDatePicker: Ref<AdvancedCameraCardDatePicker> = createRef();
|
||||
private _refTimeline: Ref<HTMLElement> = createRef();
|
||||
private _controller: TimelineController = new TimelineController(this);
|
||||
|
||||
protected render(): TemplateResult | void {
|
||||
if (!this.hass || !this.timelineConfig) {
|
||||
|
||||
@@ -25,8 +25,8 @@ export class AdvancedCameraCardVideoPlayer extends LitElement implements MediaPl
|
||||
@property({ type: Boolean })
|
||||
public controls = false;
|
||||
|
||||
protected _refVideo: Ref<MediaPlayerElement<HTMLVideoElement>> = createRef();
|
||||
protected _mediaPlayerController = new VideoMediaPlayerController(
|
||||
private _refVideo: Ref<MediaPlayerElement<HTMLVideoElement>> = createRef();
|
||||
private _mediaPlayerController = new VideoMediaPlayerController(
|
||||
this,
|
||||
() => this._refVideo.value ?? null,
|
||||
() => this.controls,
|
||||
|
||||
@@ -81,13 +81,13 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
public showControls = true;
|
||||
|
||||
@state()
|
||||
protected _selected: number | null = null;
|
||||
private _selected: number | null = null;
|
||||
|
||||
protected _media: ViewMedia[] | null = null;
|
||||
protected _mediaActionsController = new MediaActionsController();
|
||||
protected _mediaHeightController = new MediaHeightController(this, '.embla__slide');
|
||||
protected _loadedMediaPlayerController: MediaPlayerController | null = null;
|
||||
protected _refCarousel: Ref<HTMLElement> = createRef();
|
||||
private _media: ViewMedia[] | null = null;
|
||||
private _mediaActionsController = new MediaActionsController();
|
||||
private _mediaHeightController = new MediaHeightController(this, '.embla__slide');
|
||||
private _loadedMediaPlayerController: MediaPlayerController | null = null;
|
||||
private _refCarousel: Ref<HTMLElement> = createRef();
|
||||
|
||||
public connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
@@ -108,7 +108,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
* Get the transition effect to use.
|
||||
* @returns An TransitionEffect object.
|
||||
*/
|
||||
protected _getTransitionEffect(): TransitionEffect {
|
||||
private _getTransitionEffect(): TransitionEffect {
|
||||
return (
|
||||
this.viewerConfig?.transition_effect ??
|
||||
configDefaults.media_viewer.transition_effect
|
||||
@@ -119,7 +119,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
* Get the Embla plugins to use.
|
||||
* @returns A list of EmblaOptionsTypes.
|
||||
*/
|
||||
protected _getPlugins(): EmblaCarouselPlugins {
|
||||
private _getPlugins(): EmblaCarouselPlugins {
|
||||
return [AutoMediaLoadedInfo()];
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
* @returns A BrowseMediaNeighbors with indices and objects of true media
|
||||
* neighbors.
|
||||
*/
|
||||
protected _getMediaNeighbors(): MediaNeighbors | null {
|
||||
private _getMediaNeighbors(): MediaNeighbors | null {
|
||||
const mediaCount = this._media?.length ?? 0;
|
||||
if (!this._media || this._selected === null) {
|
||||
return null;
|
||||
@@ -152,7 +152,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
};
|
||||
}
|
||||
|
||||
protected _setViewSelectedIndex(index: number): void {
|
||||
private _setViewSelectedIndex(index: number): void {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
|
||||
if (!this._media || !view) {
|
||||
@@ -194,7 +194,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
* Get slides to include in the render.
|
||||
* @returns The slides to include in the render.
|
||||
*/
|
||||
protected _getSlides(): TemplateResult[] {
|
||||
private _getSlides(): TemplateResult[] {
|
||||
if (!this._media) {
|
||||
return [];
|
||||
}
|
||||
@@ -273,7 +273,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _renderNextPrevious(
|
||||
private _renderNextPrevious(
|
||||
side: 'left' | 'right',
|
||||
neighbors?: MediaNeighbors | null,
|
||||
): TemplateResult {
|
||||
@@ -402,7 +402,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _setMediaTarget(): void {
|
||||
private _setMediaTarget(): void {
|
||||
if (!this._media?.length || this._selected === null) {
|
||||
this._mediaActionsController.unsetTarget();
|
||||
} else {
|
||||
@@ -421,7 +421,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
/**
|
||||
* Fire a media show event when a slide is selected.
|
||||
*/
|
||||
protected async _seekHandler(): Promise<void> {
|
||||
private async _seekHandler(): Promise<void> {
|
||||
if (
|
||||
!this.hass ||
|
||||
!this._media ||
|
||||
@@ -458,7 +458,7 @@ export class AdvancedCameraCardViewerCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _renderMediaItem(media: ViewMedia): TemplateResult | null {
|
||||
private _renderMediaItem(media: ViewMedia): TemplateResult | null {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
if (!this.hass || !view || !this.viewerConfig) {
|
||||
return null;
|
||||
|
||||
@@ -43,7 +43,7 @@ export class AdvancedCameraCardViewerGrid extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public viewItemManager?: ViewItemManager;
|
||||
|
||||
protected _renderCarousel(filterCamera?: string): TemplateResult {
|
||||
private _renderCarousel(filterCamera?: string): TemplateResult {
|
||||
const selectedCameraID = this.viewManagerEpoch?.manager.getView()?.camera;
|
||||
|
||||
// Get the camera's grid width factor from its dimensions config.
|
||||
@@ -76,7 +76,7 @@ export class AdvancedCameraCardViewerGrid extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _needsGrid(): boolean {
|
||||
private _needsGrid(): boolean {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
const cameraIDs = view?.queryResults?.getCameraIDs();
|
||||
return (
|
||||
@@ -86,7 +86,7 @@ export class AdvancedCameraCardViewerGrid extends LitElement {
|
||||
);
|
||||
}
|
||||
|
||||
protected _gridSelectCamera(cameraID: string): void {
|
||||
private _gridSelectCamera(cameraID: string): void {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
this.viewManagerEpoch?.manager.setViewByParameters({
|
||||
params: {
|
||||
|
||||
@@ -59,12 +59,12 @@ export class AdvancedCameraCardViewerProvider extends LitElement implements Medi
|
||||
@property({ attribute: false })
|
||||
public cardWideConfig?: CardWideConfig;
|
||||
|
||||
protected _refProvider: Ref<MediaPlayerElement> = createRef();
|
||||
protected _refContainer: Ref<HTMLElement> = createRef();
|
||||
protected _lazyLoadController: LazyLoadController = new LazyLoadController(this);
|
||||
private _refProvider: Ref<MediaPlayerElement> = createRef();
|
||||
private _refContainer: Ref<HTMLElement> = createRef();
|
||||
private _lazyLoadController: LazyLoadController = new LazyLoadController(this);
|
||||
|
||||
@state()
|
||||
protected _url: string | null = null;
|
||||
private _url: string | null = null;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -76,7 +76,7 @@ export class AdvancedCameraCardViewerProvider extends LitElement implements Medi
|
||||
return (await this._refProvider.value?.getMediaPlayerController()) ?? null;
|
||||
}
|
||||
|
||||
protected async _switchToRelatedClipView(): Promise<void> {
|
||||
private async _switchToRelatedClipView(): Promise<void> {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
if (
|
||||
!this.hass ||
|
||||
@@ -108,7 +108,7 @@ export class AdvancedCameraCardViewerProvider extends LitElement implements Medi
|
||||
});
|
||||
}
|
||||
|
||||
protected async _setURL(): Promise<void> {
|
||||
private async _setURL(): Promise<void> {
|
||||
const mediaContentID = this.media?.getContentID();
|
||||
if (
|
||||
!this.media ||
|
||||
@@ -202,7 +202,7 @@ export class AdvancedCameraCardViewerProvider extends LitElement implements Medi
|
||||
: null;
|
||||
}
|
||||
|
||||
protected _renderContainer(template: TemplateResult): TemplateResult {
|
||||
private _renderContainer(template: TemplateResult): TemplateResult {
|
||||
if (!this.media) {
|
||||
return template;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export class AdvancedCameraCardViews extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected _shouldLivePreload(): boolean {
|
||||
private _shouldLivePreload(): boolean {
|
||||
const view = this.viewManagerEpoch?.manager.getView();
|
||||
return (
|
||||
// Special case: Never preload for diagnostics -- we want that to be as
|
||||
|
||||
@@ -13,7 +13,7 @@ import { PartialZoomSettings } from '../components-lib/zoom/types.js';
|
||||
|
||||
@customElement('advanced-camera-card-zoomer')
|
||||
export class AdvancedCameraCardZoomer extends LitElement {
|
||||
protected _zoom: ZoomController | null = null;
|
||||
private _zoom: ZoomController | null = null;
|
||||
|
||||
@property({ attribute: false })
|
||||
public defaultSettings?: PartialZoomSettings;
|
||||
@@ -22,10 +22,10 @@ export class AdvancedCameraCardZoomer extends LitElement {
|
||||
public settings?: PartialZoomSettings | null;
|
||||
|
||||
@state()
|
||||
protected _zoomed = false;
|
||||
private _zoomed = false;
|
||||
|
||||
protected _zoomHandler = () => (this._zoomed = true);
|
||||
protected _unzoomHandler = () => (this._zoomed = false);
|
||||
private _zoomHandler = () => (this._zoomed = true);
|
||||
private _unzoomHandler = () => (this._zoomed = false);
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
Reference in New Issue
Block a user