refactor: Convert protected methods to private (#2358)
This commit is contained in:
@@ -29,10 +29,10 @@ const interactionEventSchema = z.object({
|
||||
});
|
||||
|
||||
export class ActionsManager implements ActionsExecutor {
|
||||
protected _api: CardActionsManagerAPI;
|
||||
protected _actionsInFlight: ActionSet[] = [];
|
||||
protected _actionContext: ActionContext = {};
|
||||
protected _templateRenderer: TemplateRenderer | null;
|
||||
private _api: CardActionsManagerAPI;
|
||||
private _actionsInFlight: ActionSet[] = [];
|
||||
private _actionContext: ActionContext = {};
|
||||
private _templateRenderer: TemplateRenderer | null;
|
||||
|
||||
constructor(api: CardActionsManagerAPI, templateRenderer?: TemplateRenderer) {
|
||||
this._api = api;
|
||||
|
||||
@@ -29,9 +29,9 @@ declare module 'action' {
|
||||
}
|
||||
|
||||
export class PTZDigitalAction extends AdvancedCameraCardAction<PTZDigitialActionConfig> {
|
||||
protected _timer = new Timer();
|
||||
private _timer = new Timer();
|
||||
|
||||
protected async _stepChange(api: CardActionsAPI, targetID: string): Promise<void> {
|
||||
private async _stepChange(api: CardActionsAPI, targetID: string): Promise<void> {
|
||||
api.getViewManager().setViewWithMergedContext(
|
||||
generateViewContextForZoom(targetID, {
|
||||
requested: this._convertActionToZoomSettings(
|
||||
@@ -80,9 +80,7 @@ export class PTZDigitalAction extends AdvancedCameraCardAction<PTZDigitialAction
|
||||
}
|
||||
}
|
||||
|
||||
protected _convertActionToZoomSettings(
|
||||
base?: PartialZoomSettings,
|
||||
): PartialZoomSettings {
|
||||
private _convertActionToZoomSettings(base?: PartialZoomSettings): PartialZoomSettings {
|
||||
if (!this._action.absolute && !this._action.ptz_action) {
|
||||
// If neither an absolute position nor an action are specified, the request
|
||||
// is assumed to be to return to default.
|
||||
|
||||
@@ -33,7 +33,7 @@ export class PTZMultiAction extends AdvancedCameraCardAction<PTZMultiActionConfi
|
||||
).execute(api);
|
||||
}
|
||||
|
||||
protected _toPTZAction(targetID: string): PTZAction {
|
||||
private _toPTZAction(targetID: string): PTZAction {
|
||||
return new PTZAction(
|
||||
this._context,
|
||||
createPTZAction({
|
||||
@@ -47,7 +47,7 @@ export class PTZMultiAction extends AdvancedCameraCardAction<PTZMultiActionConfi
|
||||
);
|
||||
}
|
||||
|
||||
protected _toPTZDigitalAction(targetID: string): PTZDigitalAction {
|
||||
private _toPTZDigitalAction(targetID: string): PTZDigitalAction {
|
||||
return new PTZDigitalAction(
|
||||
this._context,
|
||||
createPTZDigitalAction({
|
||||
|
||||
@@ -22,8 +22,8 @@ declare module 'action' {
|
||||
}
|
||||
|
||||
export class PTZAction extends AdvancedCameraCardAction<PTZActionConfig> {
|
||||
protected _timer = new Timer();
|
||||
protected _stopped = false;
|
||||
private _timer = new Timer();
|
||||
private _stopped = false;
|
||||
|
||||
public async stop(): Promise<void> {
|
||||
this._stopped = true;
|
||||
|
||||
@@ -9,10 +9,10 @@ import { ActionFactory } from '../factory';
|
||||
import { Action } from '../types';
|
||||
|
||||
export class ActionSet implements Action {
|
||||
protected _context: ActionContext;
|
||||
protected _actions: Action[] = [];
|
||||
protected _factory = new ActionFactory();
|
||||
protected _stopped = false;
|
||||
private _context: ActionContext;
|
||||
private _actions: Action[] = [];
|
||||
private _factory = new ActionFactory();
|
||||
private _stopped = false;
|
||||
|
||||
constructor(
|
||||
context: ActionContext,
|
||||
|
||||
@@ -7,13 +7,13 @@ import { CardAutomationsAPI, TaggedAutomation } from './types.js';
|
||||
const MAX_NESTED_AUTOMATION_EXECUTIONS = 10;
|
||||
|
||||
export class AutomationsManager {
|
||||
protected _api: CardAutomationsAPI;
|
||||
private _api: CardAutomationsAPI;
|
||||
|
||||
protected _automations = new Map<TaggedAutomation, ConditionsManager>();
|
||||
private _automations = new Map<TaggedAutomation, ConditionsManager>();
|
||||
|
||||
// A counter to avoid infinite loops, increases every time actions are run,
|
||||
// decreases every time actions are complete.
|
||||
protected _nestedAutomationExecutions = 0;
|
||||
private _nestedAutomationExecutions = 0;
|
||||
|
||||
constructor(api: CardAutomationsAPI) {
|
||||
this._api = api;
|
||||
@@ -41,7 +41,7 @@ export class AutomationsManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _execute(automation: Automation, result: ConditionsEvaluationResult): void {
|
||||
private _execute(automation: Automation, result: ConditionsEvaluationResult): void {
|
||||
if (
|
||||
!this._api.getHASSManager().hasHASS() ||
|
||||
// Never execute automations if the card hasn't finished initializing, as
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ViewItemClassifier } from '../view/item-classifier';
|
||||
import { CardCameraURLAPI } from './types';
|
||||
|
||||
export class CameraURLManager {
|
||||
protected _api: CardCameraURLAPI;
|
||||
private _api: CardCameraURLAPI;
|
||||
|
||||
constructor(api: CardCameraURLAPI) {
|
||||
this._api = api;
|
||||
|
||||
@@ -19,11 +19,11 @@ export type CardHTMLElement = LitElement &
|
||||
CardMediaReviewEventTarget;
|
||||
|
||||
export class CardElementManager {
|
||||
protected _api: CardElementAPI;
|
||||
private _api: CardElementAPI;
|
||||
|
||||
protected _element: CardHTMLElement;
|
||||
protected _scrollCallback: ScrollCallback;
|
||||
protected _menuToggleCallback: MenuToggleCallback;
|
||||
private _element: CardHTMLElement;
|
||||
private _scrollCallback: ScrollCallback;
|
||||
private _menuToggleCallback: MenuToggleCallback;
|
||||
|
||||
constructor(
|
||||
api: CardElementAPI,
|
||||
@@ -220,7 +220,7 @@ export class CardElementManager {
|
||||
);
|
||||
}
|
||||
|
||||
protected _handleMediaReviewed = (ev: CustomEvent<ViewItem>): void => {
|
||||
private _handleMediaReviewed = (ev: CustomEvent<ViewItem>): void => {
|
||||
// If the selected media item has a change of review status, update the card
|
||||
// (e.g. for the menu).
|
||||
if (
|
||||
|
||||
@@ -18,19 +18,17 @@ import { setKeyboardShortcutsFromConfig } from './load-keyboard-shortcuts.js';
|
||||
import { OverridesManager } from './overrides-manager.js';
|
||||
|
||||
export class ConfigManager {
|
||||
protected _api: CardConfigAPI;
|
||||
private _api: CardConfigAPI;
|
||||
|
||||
// The main base configuration object. For most usecases use getConfig() to
|
||||
// get the correct configuration (which will return overrides as appropriate).
|
||||
// This variable must be called `_config` or `config` to be compatible with
|
||||
// card-mod.
|
||||
protected _config: AdvancedCameraCardConfig | null = null;
|
||||
protected _overriddenConfig: AdvancedCameraCardConfig | null = null;
|
||||
protected _rawConfig: RawAdvancedCameraCardConfig | null = null;
|
||||
protected _cardWideConfig: CardWideConfig | null = null;
|
||||
protected _overridesManager = new OverridesManager(() =>
|
||||
this._processOverrideConfig(),
|
||||
);
|
||||
private _config: AdvancedCameraCardConfig | null = null;
|
||||
private _overriddenConfig: AdvancedCameraCardConfig | null = null;
|
||||
private _rawConfig: RawAdvancedCameraCardConfig | null = null;
|
||||
private _cardWideConfig: CardWideConfig | null = null;
|
||||
private _overridesManager = new OverridesManager(() => this._processOverrideConfig());
|
||||
|
||||
constructor(api: CardConfigAPI) {
|
||||
this._api = api;
|
||||
@@ -123,7 +121,7 @@ export class ConfigManager {
|
||||
this._api.getCardElementManager().update();
|
||||
}
|
||||
|
||||
protected _processOverrideConfig(): void {
|
||||
private _processOverrideConfig(): void {
|
||||
const overriddenConfig = this._getOverriddenConfig();
|
||||
|
||||
// Save on Lit re-rendering costs by only updating the configuration if it
|
||||
@@ -168,7 +166,7 @@ export class ConfigManager {
|
||||
/* async */ this._initializeBackgroundAndUpdate(previousConfig);
|
||||
}
|
||||
|
||||
protected _getOverriddenConfig(): AdvancedCameraCardConfig | null {
|
||||
private _getOverriddenConfig(): AdvancedCameraCardConfig | null {
|
||||
/* istanbul ignore if: No (current) way to reach this code -- @preserve */
|
||||
if (!this._config) {
|
||||
return null;
|
||||
@@ -186,7 +184,7 @@ export class ConfigManager {
|
||||
* Initialize config dependent items in the background. For items that the
|
||||
* card hard requires, use InitializationManager instead.
|
||||
*/
|
||||
protected async _initializeBackgroundAndUpdate(
|
||||
private async _initializeBackgroundAndUpdate(
|
||||
previousConfig: AdvancedCameraCardConfig | null,
|
||||
): Promise<void> {
|
||||
await this._api.getDefaultManager().initializeIfNecessary(previousConfig);
|
||||
|
||||
@@ -94,41 +94,41 @@ export class CardController
|
||||
CardViewAPI,
|
||||
ReactiveController
|
||||
{
|
||||
protected _conditionStateManager = new ConditionStateManager();
|
||||
protected _effectsManager = new EffectsManager();
|
||||
private _conditionStateManager = new ConditionStateManager();
|
||||
private _effectsManager = new EffectsManager();
|
||||
|
||||
// These properties may be used in the construction of 'managers' (and should
|
||||
// be created first).
|
||||
protected _deviceRegistryManager = new DeviceRegistryManager(new DeviceCache());
|
||||
protected _entityRegistryManager = new EntityRegistryManagerLive(new EntityCache());
|
||||
protected _resolvedMediaCache = new ResolvedMediaCache();
|
||||
private _deviceRegistryManager = new DeviceRegistryManager(new DeviceCache());
|
||||
private _entityRegistryManager = new EntityRegistryManagerLive(new EntityCache());
|
||||
private _resolvedMediaCache = new ResolvedMediaCache();
|
||||
|
||||
protected _actionsManager = new ActionsManager(this, new TemplateRenderer());
|
||||
protected _automationsManager = new AutomationsManager(this);
|
||||
protected _cameraManager = new CameraManager(this);
|
||||
protected _cameraURLManager = new CameraURLManager(this);
|
||||
protected _cardElementManager: CardElementManager;
|
||||
protected _configManager = new ConfigManager(this);
|
||||
protected _defaultManager = new DefaultManager(this);
|
||||
protected _expandManager = new ExpandManager(this);
|
||||
protected _foldersManager = new FoldersManager(this);
|
||||
protected _fullscreenManager = new FullscreenManager(this);
|
||||
protected _hassManager = new HASSManager(this);
|
||||
protected _initializationManager = new InitializationManager(this);
|
||||
protected _interactionManager = new InteractionManager(this);
|
||||
protected _keyboardStateManager = new KeyboardStateManager(this);
|
||||
protected _mediaLoadedInfoManager = new MediaLoadedInfoManager(this);
|
||||
private _actionsManager = new ActionsManager(this, new TemplateRenderer());
|
||||
private _automationsManager = new AutomationsManager(this);
|
||||
private _cameraManager = new CameraManager(this);
|
||||
private _cameraURLManager = new CameraURLManager(this);
|
||||
private _cardElementManager: CardElementManager;
|
||||
private _configManager = new ConfigManager(this);
|
||||
private _defaultManager = new DefaultManager(this);
|
||||
private _expandManager = new ExpandManager(this);
|
||||
private _foldersManager = new FoldersManager(this);
|
||||
private _fullscreenManager = new FullscreenManager(this);
|
||||
private _hassManager = new HASSManager(this);
|
||||
private _initializationManager = new InitializationManager(this);
|
||||
private _interactionManager = new InteractionManager(this);
|
||||
private _keyboardStateManager = new KeyboardStateManager(this);
|
||||
private _mediaLoadedInfoManager = new MediaLoadedInfoManager(this);
|
||||
|
||||
protected _mediaPlayerManager = new MediaPlayerManager(this);
|
||||
protected _messageManager = new MessageManager(this);
|
||||
protected _microphoneManager = new MicrophoneManager(this);
|
||||
protected _overlayMessageManager = new OverlayMessageManager(this);
|
||||
protected _queryStringManager = new QueryStringManager(this);
|
||||
protected _statusBarItemManager = new StatusBarItemManager(this);
|
||||
protected _styleManager = new StyleManager(this);
|
||||
protected _triggersManager = new TriggersManager(this);
|
||||
protected _viewManager = new ViewManager(this);
|
||||
protected _viewItemManager = new ViewItemManager(this);
|
||||
private _mediaPlayerManager = new MediaPlayerManager(this);
|
||||
private _messageManager = new MessageManager(this);
|
||||
private _microphoneManager = new MicrophoneManager(this);
|
||||
private _overlayMessageManager = new OverlayMessageManager(this);
|
||||
private _queryStringManager = new QueryStringManager(this);
|
||||
private _statusBarItemManager = new StatusBarItemManager(this);
|
||||
private _styleManager = new StyleManager(this);
|
||||
private _triggersManager = new TriggersManager(this);
|
||||
private _viewManager = new ViewManager(this);
|
||||
private _viewItemManager = new ViewItemManager(this);
|
||||
|
||||
constructor(
|
||||
host: CardHTMLElement,
|
||||
|
||||
@@ -9,8 +9,8 @@ import { CardDefaultManagerAPI } from './types';
|
||||
* Manages automated resetting to the default view.
|
||||
*/
|
||||
export class DefaultManager {
|
||||
protected _timer = new Timer();
|
||||
protected _api: CardDefaultManagerAPI;
|
||||
private _timer = new Timer();
|
||||
private _api: CardDefaultManagerAPI;
|
||||
|
||||
constructor(api: CardDefaultManagerAPI) {
|
||||
this._api = api;
|
||||
@@ -75,17 +75,17 @@ export class DefaultManager {
|
||||
this._api.getAutomationsManager().deleteAutomations(this);
|
||||
}
|
||||
|
||||
protected _stateChangeHandler = (): void => {
|
||||
private _stateChangeHandler = (): void => {
|
||||
this._setToDefaultIfAllowed();
|
||||
};
|
||||
|
||||
protected _setToDefaultIfAllowed(): void {
|
||||
private _setToDefaultIfAllowed(): void {
|
||||
if (this._isAutomatedUpdateAllowed()) {
|
||||
this._api.getViewManager().setViewDefault();
|
||||
}
|
||||
}
|
||||
|
||||
protected _isAutomatedUpdateAllowed(): boolean {
|
||||
private _isAutomatedUpdateAllowed(): boolean {
|
||||
const interactionMode = this._api.getConfigManager().getConfig()?.view
|
||||
.default_reset.interaction_mode;
|
||||
return (
|
||||
|
||||
@@ -47,7 +47,7 @@ export class EffectsManager implements EffectsManagerInterface {
|
||||
// effects can be started).
|
||||
private _pendingEffects: Map<EffectName, EffectOptions | undefined> = new Map();
|
||||
private _activeEffects: Map<EffectName, EffectComponent | null> = new Map();
|
||||
protected _container: EffectsContainer | null = null;
|
||||
private _container: EffectsContainer | null = null;
|
||||
|
||||
constructor(importer: EffectModuleImporter = defaultImportEffectModule) {
|
||||
this._importer = importer;
|
||||
|
||||
@@ -2,8 +2,8 @@ import { setOrRemoveAttribute } from '../utils/basic';
|
||||
import { CardExpandAPI } from './types';
|
||||
|
||||
export class ExpandManager {
|
||||
protected _expanded = false;
|
||||
protected _api: CardExpandAPI;
|
||||
private _expanded = false;
|
||||
private _api: CardExpandAPI;
|
||||
|
||||
constructor(api: CardExpandAPI) {
|
||||
this._api = api;
|
||||
@@ -37,7 +37,7 @@ export class ExpandManager {
|
||||
this._api.getCardElementManager().update();
|
||||
}
|
||||
|
||||
protected _setConditionState(): void {
|
||||
private _setConditionState(): void {
|
||||
this._api.getConditionStateManager()?.setState({
|
||||
expand: this._expanded,
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ import { regexpExtract } from '../../../utils/regexp-extract';
|
||||
import { REGEXP_GROUP_VALUE_KEY } from './types';
|
||||
|
||||
export class MetadataGenerator {
|
||||
protected _anyDateParser: typeof parser | null = null;
|
||||
private _anyDateParser: typeof parser | null = null;
|
||||
|
||||
public async prepare(parsers?: Parser[]): Promise<void> {
|
||||
if (this._anyDateParser) {
|
||||
|
||||
@@ -4,8 +4,8 @@ import { FullscreenProviderFactory } from './factory';
|
||||
import { FullscreenProvider } from './types';
|
||||
|
||||
export class FullscreenManager {
|
||||
protected _api: CardFullscreenAPI;
|
||||
protected _provider: FullscreenProvider | null;
|
||||
private _api: CardFullscreenAPI;
|
||||
private _provider: FullscreenProvider | null;
|
||||
|
||||
constructor(api: CardFullscreenAPI, provider?: FullscreenProvider) {
|
||||
this._api = api;
|
||||
@@ -48,7 +48,7 @@ export class FullscreenManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _fullscreenHandler = (): void => {
|
||||
private _fullscreenHandler = (): void => {
|
||||
this._api.getExpandManager().setExpanded(false);
|
||||
|
||||
this._setConditionState();
|
||||
@@ -59,7 +59,7 @@ export class FullscreenManager {
|
||||
this._api.getCardElementManager().update();
|
||||
};
|
||||
|
||||
protected _setConditionState(): void {
|
||||
private _setConditionState(): void {
|
||||
this._api.getConditionStateManager()?.setState({
|
||||
fullscreen: this.isInFullscreen(),
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ export class WebkitFullScreenProvider
|
||||
extends FullscreenProviderBase
|
||||
implements FullscreenProvider
|
||||
{
|
||||
protected _playTimer = new Timer();
|
||||
private _playTimer = new Timer();
|
||||
|
||||
public connect(): void {
|
||||
this._api.getConditionStateManager().addListener(this._stateChangeHandler);
|
||||
@@ -25,7 +25,7 @@ export class WebkitFullScreenProvider
|
||||
this._api.getConditionStateManager().removeListener(this._stateChangeHandler);
|
||||
}
|
||||
|
||||
protected _stateChangeHandler = (change: ConditionStateChange): void => {
|
||||
private _stateChangeHandler = (change: ConditionStateChange): void => {
|
||||
if (
|
||||
change.old.mediaLoadedInfo?.mediaPlayerController?.getFullscreenElement() !==
|
||||
change.new.mediaLoadedInfo?.mediaPlayerController?.getFullscreenElement()
|
||||
@@ -42,7 +42,7 @@ export class WebkitFullScreenProvider
|
||||
}
|
||||
};
|
||||
|
||||
protected _getVideoElement():
|
||||
private _getVideoElement():
|
||||
| (HTMLVideoElement & Partial<WebkitHTMLVideoElement>)
|
||||
| null {
|
||||
const element = this._api
|
||||
@@ -74,7 +74,7 @@ export class WebkitFullScreenProvider
|
||||
}
|
||||
}
|
||||
|
||||
protected _endHandler = (): void => {
|
||||
private _endHandler = (): void => {
|
||||
this._handler();
|
||||
|
||||
// Webkit on iPhone stops the video when exiting fullscreen (why!). This
|
||||
|
||||
@@ -5,9 +5,9 @@ import { CardHASSAPI } from '../types';
|
||||
import { StateWatcher, StateWatcherSubscriptionInterface } from './state-watcher';
|
||||
|
||||
export class HASSManager {
|
||||
protected _hass: HomeAssistant | null = null;
|
||||
protected _api: CardHASSAPI;
|
||||
protected _stateWatcher: StateWatcher = new StateWatcher();
|
||||
private _hass: HomeAssistant | null = null;
|
||||
private _api: CardHASSAPI;
|
||||
private _stateWatcher: StateWatcher = new StateWatcher();
|
||||
|
||||
constructor(api: CardHASSAPI) {
|
||||
this._api = api;
|
||||
|
||||
@@ -9,7 +9,7 @@ export interface StateWatcherSubscriptionInterface {
|
||||
}
|
||||
|
||||
export class StateWatcher implements StateWatcherSubscriptionInterface {
|
||||
protected _watcherCallbacks = new Map<StateWatcherCallback, string[]>();
|
||||
private _watcherCallbacks = new Map<StateWatcherCallback, string[]>();
|
||||
|
||||
public setHASS(oldHass: HomeAssistant | null, hass: HomeAssistant): void {
|
||||
if (!oldHass) {
|
||||
|
||||
@@ -27,15 +27,15 @@ export enum InitializationAspect {
|
||||
// =========================================================================
|
||||
|
||||
export class InitializationManager {
|
||||
protected _api: CardInitializerAPI;
|
||||
private _api: CardInitializerAPI;
|
||||
|
||||
// A concurrency limit is placed to ensure that on card load multiple async
|
||||
// contexts do not attempt to initialize the card at the same time. This is
|
||||
// not strictly necessary, just more efficient, as long as the "Rules for
|
||||
// initialization" (above) are followed.
|
||||
protected _initializationQueue = new PQueue({ concurrency: 1 });
|
||||
protected _initializer: Initializer;
|
||||
protected _everInitialized = false;
|
||||
private _initializationQueue = new PQueue({ concurrency: 1 });
|
||||
private _initializer: Initializer;
|
||||
private _everInitialized = false;
|
||||
|
||||
constructor(api: CardInitializerAPI, initializer?: Initializer) {
|
||||
this._api = api;
|
||||
@@ -76,7 +76,7 @@ export class InitializationManager {
|
||||
await this._initializationQueue.add(() => this._initializeMandatory());
|
||||
}
|
||||
|
||||
protected async _initializeMandatory(): Promise<void> {
|
||||
private async _initializeMandatory(): Promise<void> {
|
||||
const hass = this._api.getHASSManager().getHASS();
|
||||
if (!hass || this.isInitializedMandatory()) {
|
||||
return;
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Timer } from '../utils/timer';
|
||||
import { CardInteractionAPI } from './types';
|
||||
|
||||
export class InteractionManager {
|
||||
protected _timer = new Timer();
|
||||
protected _api: CardInteractionAPI;
|
||||
protected _interacted = false;
|
||||
private _timer = new Timer();
|
||||
private _api: CardInteractionAPI;
|
||||
private _interacted = false;
|
||||
|
||||
constructor(api: CardInteractionAPI) {
|
||||
this._api = api;
|
||||
@@ -26,7 +26,7 @@ export class InteractionManager {
|
||||
return this._interacted;
|
||||
}
|
||||
|
||||
protected _setInteraction(val: boolean): void {
|
||||
private _setInteraction(val: boolean): void {
|
||||
this._interacted = val;
|
||||
setOrRemoveAttribute(
|
||||
this._api.getCardElementManager().getElement(),
|
||||
@@ -36,7 +36,7 @@ export class InteractionManager {
|
||||
this._api.getConditionStateManager().setState({ interaction: val });
|
||||
}
|
||||
|
||||
protected _reportInteraction(): void {
|
||||
private _reportInteraction(): void {
|
||||
this._timer.stop();
|
||||
this._setInteraction(true);
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import { CardKeyboardStateAPI, KeysState } from './types';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
export class KeyboardStateManager {
|
||||
protected _api: CardKeyboardStateAPI;
|
||||
protected _state: KeysState = {};
|
||||
private _api: CardKeyboardStateAPI;
|
||||
private _state: KeysState = {};
|
||||
|
||||
constructor(api: CardKeyboardStateAPI) {
|
||||
this._api = api;
|
||||
@@ -23,7 +23,7 @@ export class KeyboardStateManager {
|
||||
element.removeEventListener('blur', this._handleBlur);
|
||||
}
|
||||
|
||||
protected _handleKeydown = (ev: KeyboardEvent): void => {
|
||||
private _handleKeydown = (ev: KeyboardEvent): void => {
|
||||
const keyObj = {
|
||||
state: 'down' as const,
|
||||
ctrl: ev.ctrlKey,
|
||||
@@ -38,14 +38,14 @@ export class KeyboardStateManager {
|
||||
}
|
||||
};
|
||||
|
||||
protected _handleKeyup = (ev: KeyboardEvent): void => {
|
||||
private _handleKeyup = (ev: KeyboardEvent): void => {
|
||||
if (ev.key in this._state && this._state[ev.key].state === 'down') {
|
||||
this._state[ev.key].state = 'up';
|
||||
this._processStateChange();
|
||||
}
|
||||
};
|
||||
|
||||
protected _handleBlur = (): void => {
|
||||
private _handleBlur = (): void => {
|
||||
if (Object.keys(this._state).length) {
|
||||
// State is emptied if the element loses focus.
|
||||
this._state = {};
|
||||
@@ -53,7 +53,7 @@ export class KeyboardStateManager {
|
||||
}
|
||||
};
|
||||
|
||||
protected _processStateChange(): void {
|
||||
private _processStateChange(): void {
|
||||
this._api.getConditionStateManager().setState({ keys: this._state });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { isValidMediaLoadedInfo } from '../utils/media-info';
|
||||
import { CardMediaLoadedAPI } from './types';
|
||||
|
||||
export class MediaLoadedInfoManager {
|
||||
protected _api: CardMediaLoadedAPI;
|
||||
protected _current: MediaLoadedInfo | null = null;
|
||||
protected _lastKnown: MediaLoadedInfo | null = null;
|
||||
private _api: CardMediaLoadedAPI;
|
||||
private _current: MediaLoadedInfo | null = null;
|
||||
private _lastKnown: MediaLoadedInfo | null = null;
|
||||
|
||||
constructor(api: CardMediaLoadedAPI) {
|
||||
this._api = api;
|
||||
|
||||
@@ -14,9 +14,9 @@ import { ViewItemClassifier } from '../view/item-classifier';
|
||||
import { CardMediaPlayerAPI } from './types';
|
||||
|
||||
export class MediaPlayerManager {
|
||||
protected _mediaPlayers: string[] = [];
|
||||
private _mediaPlayers: string[] = [];
|
||||
|
||||
protected _api: CardMediaPlayerAPI;
|
||||
private _api: CardMediaPlayerAPI;
|
||||
|
||||
constructor(api: CardMediaPlayerAPI) {
|
||||
this._api = api;
|
||||
@@ -128,7 +128,7 @@ export class MediaPlayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected async _playLiveStandard(
|
||||
private async _playLiveStandard(
|
||||
mediaPlayer: string,
|
||||
cameraID: string,
|
||||
cameraConfig: CameraConfig,
|
||||
@@ -155,7 +155,7 @@ export class MediaPlayerManager {
|
||||
});
|
||||
}
|
||||
|
||||
protected async _playLiveDashboard(
|
||||
private async _playLiveDashboard(
|
||||
mediaPlayer: string,
|
||||
cameraConfig: CameraConfig,
|
||||
): Promise<void> {
|
||||
|
||||
@@ -14,8 +14,8 @@ const MESSAGE_TYPE_PRIORITIES: MessagePriority = {
|
||||
};
|
||||
|
||||
export class MessageManager {
|
||||
protected _message: Message | null = null;
|
||||
protected _api: CardMessageAPI;
|
||||
private _message: Message | null = null;
|
||||
private _api: CardMessageAPI;
|
||||
|
||||
constructor(api: CardMessageAPI) {
|
||||
this._api = api;
|
||||
|
||||
@@ -3,11 +3,11 @@ import { Timer } from '../utils/timer';
|
||||
import { CardMicrophoneAPI, MicrophoneState } from './types';
|
||||
|
||||
export class MicrophoneManager {
|
||||
protected _api: CardMicrophoneAPI;
|
||||
protected _stream?: MediaStream | null;
|
||||
protected _timer = new Timer();
|
||||
private _api: CardMicrophoneAPI;
|
||||
private _stream?: MediaStream | null;
|
||||
private _timer = new Timer();
|
||||
|
||||
protected _state: MicrophoneState = {
|
||||
private _state: MicrophoneState = {
|
||||
connected: false,
|
||||
muted: true,
|
||||
forbidden: false,
|
||||
@@ -16,7 +16,7 @@ export class MicrophoneManager {
|
||||
// We keep desired mute state separate from the overall state so that
|
||||
// mute/unmute can be expressed before the stream is even created -- and when
|
||||
// it's created it will have the right mute status.
|
||||
protected _desireMute = true;
|
||||
private _desireMute = true;
|
||||
|
||||
constructor(api: CardMicrophoneAPI) {
|
||||
this._api = api;
|
||||
@@ -115,7 +115,7 @@ export class MicrophoneManager {
|
||||
return !this._stream || this._stream.getTracks().every((track) => !track.enabled);
|
||||
}
|
||||
|
||||
protected _setDesiredMuteOnStream(): void {
|
||||
private _setDesiredMuteOnStream(): void {
|
||||
this._stream?.getTracks().forEach((track) => {
|
||||
track.enabled = !this._desireMute;
|
||||
});
|
||||
@@ -123,7 +123,7 @@ export class MicrophoneManager {
|
||||
this._startDisconnectTimer();
|
||||
}
|
||||
|
||||
protected _startDisconnectTimer(): void {
|
||||
private _startDisconnectTimer(): void {
|
||||
const microphoneConfig = this._api.getConfigManager().getConfig()?.live.microphone;
|
||||
|
||||
if (microphoneConfig?.always_connected) {
|
||||
@@ -139,7 +139,7 @@ export class MicrophoneManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _setState(): void {
|
||||
private _setState(): void {
|
||||
this._state = {
|
||||
stream: this._stream,
|
||||
connected: this.isConnected(),
|
||||
|
||||
@@ -2,8 +2,8 @@ import { OverlayMessage } from '../types';
|
||||
import { CardOverlayMessageAPI } from './types';
|
||||
|
||||
export class OverlayMessageManager {
|
||||
protected _message: OverlayMessage | null = null;
|
||||
protected _api: CardOverlayMessageAPI;
|
||||
private _message: OverlayMessage | null = null;
|
||||
private _api: CardOverlayMessageAPI;
|
||||
|
||||
constructor(api: CardOverlayMessageAPI) {
|
||||
this._api = api;
|
||||
|
||||
@@ -18,8 +18,8 @@ interface QueryStringViewIntent {
|
||||
}
|
||||
|
||||
export class QueryStringManager {
|
||||
protected _api: CardQueryStringAPI;
|
||||
protected _shouldRun = true;
|
||||
private _api: CardQueryStringAPI;
|
||||
private _shouldRun = true;
|
||||
|
||||
constructor(api: CardQueryStringAPI) {
|
||||
this._api = api;
|
||||
@@ -42,7 +42,7 @@ export class QueryStringManager {
|
||||
}
|
||||
};
|
||||
|
||||
protected async _executeViewRelated(intent: QueryStringViewIntent): Promise<void> {
|
||||
private async _executeViewRelated(intent: QueryStringViewIntent): Promise<void> {
|
||||
if (intent.view) {
|
||||
if (intent.view.default) {
|
||||
await this._api.getViewManager().setViewDefaultWithNewQuery({
|
||||
@@ -67,13 +67,13 @@ export class QueryStringManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected async _executeNonViewRelated(intent: QueryStringViewIntent): Promise<void> {
|
||||
private async _executeNonViewRelated(intent: QueryStringViewIntent): Promise<void> {
|
||||
if (intent.other) {
|
||||
await this._api.getActionsManager().executeActions({ actions: intent.other });
|
||||
}
|
||||
}
|
||||
|
||||
protected _calculateIntent(): QueryStringViewIntent {
|
||||
private _calculateIntent(): QueryStringViewIntent {
|
||||
const result: QueryStringViewIntent = {};
|
||||
for (const action of this._getActions()) {
|
||||
if (this._isViewAction(action)) {
|
||||
@@ -93,7 +93,7 @@ export class QueryStringManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected _getActions(): AdvancedCameraCardCustomActionConfig[] {
|
||||
private _getActions(): AdvancedCameraCardCustomActionConfig[] {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const actions: AdvancedCameraCardCustomActionConfig[] = [];
|
||||
const configuredCardID = this._api.getConfigManager().getConfig()?.card_id;
|
||||
@@ -158,7 +158,7 @@ export class QueryStringManager {
|
||||
return actions;
|
||||
}
|
||||
|
||||
protected _isViewAction = (
|
||||
private _isViewAction = (
|
||||
action: AdvancedCameraCardCustomActionConfig,
|
||||
): action is ViewActionConfig => {
|
||||
switch (action.advanced_camera_card_action) {
|
||||
|
||||
@@ -9,14 +9,14 @@ import { CardStatusBarAPI } from './types';
|
||||
const RESOLUTION_TOLERANCE_PCT = 0.01;
|
||||
|
||||
export class StatusBarItemManager {
|
||||
protected _api: CardStatusBarAPI;
|
||||
private _api: CardStatusBarAPI;
|
||||
|
||||
constructor(api: CardStatusBarAPI) {
|
||||
this._api = api;
|
||||
}
|
||||
|
||||
protected _items: StatusBarItem[] = [];
|
||||
protected _dynamicItems: StatusBarItem[] = [];
|
||||
private _items: StatusBarItem[] = [];
|
||||
private _dynamicItems: StatusBarItem[] = [];
|
||||
|
||||
public addDynamicStatusBarItem(item: StatusBarItem): void {
|
||||
if (!this._dynamicItems.includes(item)) {
|
||||
@@ -128,7 +128,7 @@ export class StatusBarItemManager {
|
||||
];
|
||||
}
|
||||
|
||||
protected _matchesWidthHeight(
|
||||
private _matchesWidthHeight(
|
||||
mediaLoadedInfo: MediaLoadedInfo | null,
|
||||
width: number,
|
||||
height: number,
|
||||
@@ -153,7 +153,7 @@ export class StatusBarItemManager {
|
||||
);
|
||||
}
|
||||
|
||||
protected _calculateResolution(mediaLoadedInfo: MediaLoadedInfo): string {
|
||||
private _calculateResolution(mediaLoadedInfo: MediaLoadedInfo): string {
|
||||
// Ordered roughly by a guess at most common towards the top.
|
||||
if (this._matchesWidthHeight(mediaLoadedInfo, 1920, 1080)) {
|
||||
return '1080p';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { View } from '../view/view';
|
||||
import { CardStyleAPI } from './types';
|
||||
|
||||
export class StyleManager {
|
||||
protected _api: CardStyleAPI;
|
||||
private _api: CardStyleAPI;
|
||||
|
||||
constructor(api: CardStyleAPI) {
|
||||
this._api = api;
|
||||
@@ -73,13 +73,13 @@ export class StyleManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _getThemeNames(themeConfig: ThemeConfig): ThemeName[] | null {
|
||||
private _getThemeNames(themeConfig: ThemeConfig): ThemeName[] | null {
|
||||
return themeConfig.themes.length
|
||||
? themeConfig.themes
|
||||
: configDefaults.view.theme.themes;
|
||||
}
|
||||
|
||||
protected _setDimmable(): void {
|
||||
private _setDimmable(): void {
|
||||
const config = this._api.getConfigManager().getConfig();
|
||||
setOrRemoveAttribute(
|
||||
this._api.getCardElementManager().getElement(),
|
||||
@@ -88,7 +88,7 @@ export class StyleManager {
|
||||
);
|
||||
}
|
||||
|
||||
protected _setMinMaxHeight(): void {
|
||||
private _setMinMaxHeight(): void {
|
||||
const config = this._api.getConfigManager().getConfig();
|
||||
if (config) {
|
||||
const card = this._api.getCardElementManager().getElement();
|
||||
@@ -96,7 +96,7 @@ export class StyleManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _setPerformance(): void {
|
||||
private _setPerformance(): void {
|
||||
const STYLE_DISABLE_MAP = {
|
||||
box_shadow: {
|
||||
cssKey: '--advanced-camera-card-box-shadow-override',
|
||||
@@ -122,7 +122,7 @@ export class StyleManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _isAspectRatioEnforced(
|
||||
private _isAspectRatioEnforced(
|
||||
config: AdvancedCameraCardConfig,
|
||||
view?: View | null,
|
||||
): boolean {
|
||||
|
||||
@@ -39,7 +39,7 @@ export class TemplateRenderer {
|
||||
);
|
||||
};
|
||||
|
||||
protected _generateTemplateContext(
|
||||
private _generateTemplateContext(
|
||||
options?: TemplateRenderOptions,
|
||||
): TemplateContext | undefined {
|
||||
if (
|
||||
@@ -64,7 +64,7 @@ export class TemplateRenderer {
|
||||
};
|
||||
}
|
||||
|
||||
protected _renderTemplateRecursively(
|
||||
private _renderTemplateRecursively(
|
||||
hass: HomeAssistant,
|
||||
data: unknown,
|
||||
templateContext?: TemplateContext,
|
||||
|
||||
@@ -27,10 +27,10 @@ interface CameraTriggerState {
|
||||
}
|
||||
|
||||
export class TriggersManager {
|
||||
protected _api: CardTriggersAPI;
|
||||
protected _states: Map<string, CameraTriggerState> = new Map();
|
||||
private _api: CardTriggersAPI;
|
||||
private _states: Map<string, CameraTriggerState> = new Map();
|
||||
|
||||
protected _throttledTriggerAction = throttle(this._triggerAction.bind(this), 1000, {
|
||||
private _throttledTriggerAction = throttle(this._triggerAction.bind(this), 1000, {
|
||||
trailing: true,
|
||||
});
|
||||
|
||||
@@ -149,7 +149,7 @@ export class TriggersManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected async _handleEndEvent(ev: CameraEvent): Promise<boolean> {
|
||||
private async _handleEndEvent(ev: CameraEvent): Promise<boolean> {
|
||||
this._deleteIgnoredEventID(ev.cameraID, ev.id);
|
||||
|
||||
const state = this._states.get(ev.cameraID);
|
||||
@@ -160,14 +160,14 @@ export class TriggersManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected _isIgnoredUpdateEvent(ev: CameraEvent): boolean {
|
||||
private _isIgnoredUpdateEvent(ev: CameraEvent): boolean {
|
||||
return (
|
||||
(ev.type === 'update' || ev.type === 'genai') &&
|
||||
this._hasIgnoredEventID(ev.cameraID, ev.id)
|
||||
);
|
||||
}
|
||||
|
||||
protected _hasAllowableInteractionStateForAction(): boolean {
|
||||
private _hasAllowableInteractionStateForAction(): boolean {
|
||||
const triggersConfig = this._api.getConfigManager().getConfig()?.view.triggers;
|
||||
const hasInteraction = this._api.getInteractionManager().hasInteraction();
|
||||
|
||||
@@ -179,7 +179,7 @@ export class TriggersManager {
|
||||
);
|
||||
}
|
||||
|
||||
protected async _triggerAction(ev: CameraEvent): Promise<void> {
|
||||
private async _triggerAction(ev: CameraEvent): Promise<void> {
|
||||
const config = this._api.getConfigManager().getConfig();
|
||||
const triggerAction = config?.view?.triggers.actions.trigger;
|
||||
const defaultView = config?.view?.default;
|
||||
@@ -248,14 +248,14 @@ export class TriggersManager {
|
||||
this._api.getCardElementManager().update();
|
||||
}
|
||||
|
||||
protected _setConditionStateIfNecessary(): void {
|
||||
private _setConditionStateIfNecessary(): void {
|
||||
const triggeredCameraIDs = this.getTriggeredCameraIDs();
|
||||
this._api.getConditionStateManager().setState({
|
||||
triggered: triggeredCameraIDs.size ? triggeredCameraIDs : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
protected async _executeUntriggerAction(): Promise<boolean> {
|
||||
private async _executeUntriggerAction(): Promise<boolean> {
|
||||
const action = this._api.getConfigManager().getConfig()?.view?.triggers
|
||||
.actions.untrigger;
|
||||
|
||||
@@ -269,7 +269,7 @@ export class TriggersManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected async _untriggerAction(cameraID: string): Promise<void> {
|
||||
private async _untriggerAction(cameraID: string): Promise<void> {
|
||||
this._deleteUntriggerDelayTimer(cameraID);
|
||||
this._deleteForceUntriggerTimer(cameraID);
|
||||
|
||||
@@ -282,7 +282,7 @@ export class TriggersManager {
|
||||
this._api.getCardElementManager().update();
|
||||
}
|
||||
|
||||
protected async _startUntrigger(cameraID: string): Promise<void> {
|
||||
private async _startUntrigger(cameraID: string): Promise<void> {
|
||||
this._deleteUntriggerDelayTimer(cameraID);
|
||||
this._deleteForceUntriggerTimer(cameraID);
|
||||
|
||||
@@ -304,7 +304,7 @@ export class TriggersManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _startForceUntriggerTimerIfNecessary(
|
||||
private _startForceUntriggerTimerIfNecessary(
|
||||
cameraID: string,
|
||||
forceUntriggerSeconds: number,
|
||||
): void {
|
||||
@@ -324,7 +324,7 @@ export class TriggersManager {
|
||||
});
|
||||
}
|
||||
|
||||
protected async _forceUntrigger(
|
||||
private async _forceUntrigger(
|
||||
state: CameraTriggerState,
|
||||
cameraID: string,
|
||||
): Promise<void> {
|
||||
@@ -334,12 +334,12 @@ export class TriggersManager {
|
||||
await this._startUntrigger(cameraID);
|
||||
}
|
||||
|
||||
protected _addIgnoredEventID(cameraID: string, eventID: string): void {
|
||||
private _addIgnoredEventID(cameraID: string, eventID: string): void {
|
||||
const state = this._getOrCreateState(cameraID);
|
||||
state.ignoredSources.add(eventID);
|
||||
}
|
||||
|
||||
protected _deleteIgnoredEventID(cameraID: string, eventID: string): void {
|
||||
private _deleteIgnoredEventID(cameraID: string, eventID: string): void {
|
||||
const state = this._states.get(cameraID);
|
||||
if (!state) {
|
||||
return;
|
||||
@@ -349,11 +349,11 @@ export class TriggersManager {
|
||||
this._deleteStateIfIdle(cameraID);
|
||||
}
|
||||
|
||||
protected _hasIgnoredEventID(cameraID: string, eventID: string): boolean {
|
||||
private _hasIgnoredEventID(cameraID: string, eventID: string): boolean {
|
||||
return !!this._states.get(cameraID)?.ignoredSources.has(eventID);
|
||||
}
|
||||
|
||||
protected _getOrCreateState(cameraID: string): CameraTriggerState {
|
||||
private _getOrCreateState(cameraID: string): CameraTriggerState {
|
||||
let state = this._states.get(cameraID);
|
||||
if (!state) {
|
||||
state = {
|
||||
@@ -366,7 +366,7 @@ export class TriggersManager {
|
||||
return state;
|
||||
}
|
||||
|
||||
protected _deleteStateIfIdle(cameraID: string): void {
|
||||
private _deleteStateIfIdle(cameraID: string): void {
|
||||
const state = this._states.get(cameraID);
|
||||
if (
|
||||
state &&
|
||||
@@ -379,7 +379,7 @@ export class TriggersManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _deleteUntriggerDelayTimer(cameraID: string): void {
|
||||
private _deleteUntriggerDelayTimer(cameraID: string): void {
|
||||
const state = this._states.get(cameraID);
|
||||
if (state?.untriggerDelayTimer) {
|
||||
state.untriggerDelayTimer.stop();
|
||||
@@ -387,7 +387,7 @@ export class TriggersManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _deleteForceUntriggerTimer(cameraID: string): void {
|
||||
private _deleteForceUntriggerTimer(cameraID: string): void {
|
||||
const state = this._states.get(cameraID);
|
||||
if (state?.untriggerForceTimer) {
|
||||
state.untriggerForceTimer.stop();
|
||||
@@ -395,7 +395,7 @@ export class TriggersManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected _isStateTriggered(state: CameraTriggerState): boolean {
|
||||
private _isStateTriggered(state: CameraTriggerState): boolean {
|
||||
return !!(state.sources.size || state.untriggerDelayTimer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ interface ResolvedViewTarget {
|
||||
}
|
||||
|
||||
export class ViewFactory {
|
||||
protected _api: CardViewAPI;
|
||||
private _api: CardViewAPI;
|
||||
|
||||
constructor(api: CardViewAPI) {
|
||||
this._api = api;
|
||||
@@ -43,7 +43,7 @@ export class ViewFactory {
|
||||
});
|
||||
}
|
||||
|
||||
protected _getDefaultViewName = (
|
||||
private _getDefaultViewName = (
|
||||
config: AdvancedCameraCardConfig,
|
||||
): AdvancedCameraCardView =>
|
||||
resolveViewName(
|
||||
@@ -52,7 +52,7 @@ export class ViewFactory {
|
||||
this._api.getFoldersManager(),
|
||||
);
|
||||
|
||||
protected _getDefaultCameraID(
|
||||
private _getDefaultCameraID(
|
||||
config: AdvancedCameraCardConfig,
|
||||
viewName: AdvancedCameraCardView,
|
||||
options?: ViewFactoryOptions,
|
||||
@@ -114,7 +114,7 @@ export class ViewFactory {
|
||||
return view;
|
||||
}
|
||||
|
||||
protected _resolveViewName(
|
||||
private _resolveViewName(
|
||||
config: AdvancedCameraCardConfig,
|
||||
options?: ViewFactoryOptions,
|
||||
): AdvancedCameraCardView {
|
||||
@@ -128,7 +128,7 @@ export class ViewFactory {
|
||||
return options?.baseView?.view ?? this._getDefaultViewName(config);
|
||||
}
|
||||
|
||||
protected _resolveCameraID(
|
||||
private _resolveCameraID(
|
||||
viewName: AdvancedCameraCardView,
|
||||
options?: ViewFactoryOptions,
|
||||
): string | null {
|
||||
@@ -148,7 +148,7 @@ export class ViewFactory {
|
||||
return viewCameraIDs?.keys().next().value ?? null;
|
||||
}
|
||||
|
||||
protected _ensureViewCompatibility(
|
||||
private _ensureViewCompatibility(
|
||||
viewName: AdvancedCameraCardView,
|
||||
cameraID: string | null,
|
||||
config: AdvancedCameraCardConfig,
|
||||
@@ -173,7 +173,7 @@ export class ViewFactory {
|
||||
return { viewName, cameraID };
|
||||
}
|
||||
|
||||
protected _handleNoCameraForView(
|
||||
private _handleNoCameraForView(
|
||||
viewName: AdvancedCameraCardView,
|
||||
config: AdvancedCameraCardConfig,
|
||||
options?: ViewFactoryOptions,
|
||||
@@ -195,7 +195,7 @@ export class ViewFactory {
|
||||
});
|
||||
}
|
||||
|
||||
protected _handleUnsupportedView(
|
||||
private _handleUnsupportedView(
|
||||
viewName: AdvancedCameraCardView,
|
||||
cameraID: string,
|
||||
config: AdvancedCameraCardConfig,
|
||||
@@ -229,7 +229,7 @@ export class ViewFactory {
|
||||
});
|
||||
}
|
||||
|
||||
protected _resolveDisplayMode(
|
||||
private _resolveDisplayMode(
|
||||
viewName: AdvancedCameraCardView,
|
||||
config: AdvancedCameraCardConfig,
|
||||
options?: ViewFactoryOptions,
|
||||
@@ -247,7 +247,7 @@ export class ViewFactory {
|
||||
);
|
||||
}
|
||||
|
||||
protected _getConfiguredDisplayMode(
|
||||
private _getConfiguredDisplayMode(
|
||||
viewName: AdvancedCameraCardView,
|
||||
config: AdvancedCameraCardConfig,
|
||||
): ViewDisplayMode | null {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class MergeContextViewModifier implements ViewModifier {
|
||||
protected _context?: ViewContext | null;
|
||||
private _context?: ViewContext | null;
|
||||
|
||||
constructor(context?: ViewContext | null) {
|
||||
this._context = context;
|
||||
|
||||
@@ -3,8 +3,8 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class RemoveContextPropertyViewModifier implements ViewModifier {
|
||||
protected _key: keyof ViewContext;
|
||||
protected _property: PropertyKey;
|
||||
private _key: keyof ViewContext;
|
||||
private _property: PropertyKey;
|
||||
|
||||
constructor(key: keyof ViewContext, property: PropertyKey) {
|
||||
this._key = key;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class RemoveContextViewModifier implements ViewModifier {
|
||||
protected _keys: (keyof ViewContext)[];
|
||||
private _keys: (keyof ViewContext)[];
|
||||
|
||||
constructor(keys: (keyof ViewContext)[]) {
|
||||
this._keys = keys;
|
||||
|
||||
@@ -4,8 +4,8 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class SetQueryViewModifier implements ViewModifier {
|
||||
protected _query?: UnifiedQuery | null;
|
||||
protected _queryResults?: QueryResults | null;
|
||||
private _query?: UnifiedQuery | null;
|
||||
private _queryResults?: QueryResults | null;
|
||||
|
||||
constructor(options?: {
|
||||
query?: UnifiedQuery | null;
|
||||
|
||||
@@ -8,7 +8,7 @@ interface SubstreamOnViewModifierAPI {
|
||||
}
|
||||
|
||||
export class SubstreamOnViewModifier implements ViewModifier {
|
||||
protected _api: SubstreamOnViewModifierAPI;
|
||||
private _api: SubstreamOnViewModifierAPI;
|
||||
|
||||
constructor(api: SubstreamOnViewModifierAPI) {
|
||||
this._api = api;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class SubstreamSelectViewModifier implements ViewModifier {
|
||||
protected _substreamID: string;
|
||||
private _substreamID: string;
|
||||
|
||||
constructor(substreamID: string) {
|
||||
this._substreamID = substreamID;
|
||||
|
||||
@@ -16,15 +16,15 @@ import {
|
||||
import { ViewQueryExecutor } from './view-query-executor';
|
||||
|
||||
export class ViewManager implements ViewManagerInterface {
|
||||
protected _view: View | null = null;
|
||||
protected _viewFactory: ViewFactory;
|
||||
protected _viewQueryExecutor: ViewQueryExecutor;
|
||||
protected _api: CardViewAPI;
|
||||
protected _epoch: ViewManagerEpoch = this._createEpoch();
|
||||
private _view: View | null = null;
|
||||
private _viewFactory: ViewFactory;
|
||||
private _viewQueryExecutor: ViewQueryExecutor;
|
||||
private _api: CardViewAPI;
|
||||
private _epoch: ViewManagerEpoch = this._createEpoch();
|
||||
|
||||
// Used to mark as a view as "loading" with a given index. Each subsequent
|
||||
// async update will use a higher index.
|
||||
protected _loadingIndex = 1;
|
||||
private _loadingIndex = 1;
|
||||
|
||||
constructor(
|
||||
api: CardViewAPI,
|
||||
@@ -41,7 +41,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
public getEpoch(): ViewManagerEpoch {
|
||||
return this._epoch;
|
||||
}
|
||||
protected _createEpoch(oldView?: View | null): ViewManagerEpoch {
|
||||
private _createEpoch(oldView?: View | null): ViewManagerEpoch {
|
||||
return {
|
||||
manager: this,
|
||||
...(oldView && { oldView }),
|
||||
@@ -97,7 +97,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
options,
|
||||
);
|
||||
|
||||
protected _setViewGeneric(
|
||||
private _setViewGeneric(
|
||||
viewFactoryFunc: (options?: ViewFactoryOptions) => View | null,
|
||||
options?: ViewFactoryOptions,
|
||||
): void {
|
||||
@@ -119,14 +119,14 @@ export class ViewManager implements ViewManagerInterface {
|
||||
}
|
||||
}
|
||||
|
||||
protected _markViewLoadingQuery(view: View, index: number): View {
|
||||
private _markViewLoadingQuery(view: View, index: number): View {
|
||||
return view.mergeInContext({ loading: { query: index } });
|
||||
}
|
||||
protected _markViewAsNotLoadingQuery(view: View): View {
|
||||
private _markViewAsNotLoadingQuery(view: View): View {
|
||||
return view.removeContextProperty('loading', 'query');
|
||||
}
|
||||
|
||||
protected _isAllowedToSetView(): boolean {
|
||||
private _isAllowedToSetView(): boolean {
|
||||
// It is possible to have a race condition where the view is being set at
|
||||
// the same time as the cameras being initialized. Test case: Open
|
||||
// folder-based media in the media viewer carousel, then attempt to edit the
|
||||
@@ -139,7 +139,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
.isInitialized(InitializationAspect.CAMERAS);
|
||||
}
|
||||
|
||||
protected async _setViewThenModifyAsync(
|
||||
private async _setViewThenModifyAsync(
|
||||
viewFactoryFunc: (options?: ViewFactoryOptions) => View | null,
|
||||
viewModifiersFunc: (
|
||||
view: View,
|
||||
@@ -229,7 +229,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
this._setView(newView);
|
||||
}
|
||||
|
||||
protected _shouldAdoptQueryAndResults(newView: View): boolean {
|
||||
private _shouldAdoptQueryAndResults(newView: View): boolean {
|
||||
// If the user is currently using the viewer, and then switches to the
|
||||
// gallery we make an attempt to keep the query/queryResults the same so
|
||||
// the gallery can be used to click back and forth to the viewer, and the
|
||||
@@ -292,7 +292,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
return true;
|
||||
};
|
||||
|
||||
protected _setView(view: Readonly<View> | null): void {
|
||||
private _setView(view: Readonly<View> | null): void {
|
||||
const oldView = this._view;
|
||||
|
||||
log(
|
||||
|
||||
Reference in New Issue
Block a user