feat: Modernize the visual card editor. (#2586)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import type { PTZAction } from '../../config/schema/actions/custom/ptz';
|
||||
import type {
|
||||
KeyboardShortcuts,
|
||||
PTZKeyboardShortcutName,
|
||||
import {
|
||||
PTZ_KEYBOARD_SHORTCUTS,
|
||||
type KeyboardShortcuts,
|
||||
type PTZKeyboardShortcutName,
|
||||
} from '../../config/schema/view';
|
||||
import { createPTZMultiAction } from '../../utils/action';
|
||||
import type { CardConfigLoaderAPI, TaggedAutomation } from '../types';
|
||||
@@ -38,7 +39,6 @@ const ptzKeyboardShortcutToPTZAction = (
|
||||
case 'ptz_zoom_out':
|
||||
return 'zoom_out';
|
||||
}
|
||||
/* istanbul ignore next: No (current) way to reach this code -- @preserve */
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -52,14 +52,9 @@ const convertKeyboardShortcutsToAutomations = (
|
||||
|
||||
const automations: TaggedAutomation[] = [];
|
||||
|
||||
for (const name of [
|
||||
'ptz_down',
|
||||
'ptz_left',
|
||||
'ptz_right',
|
||||
'ptz_up',
|
||||
'ptz_zoom_in',
|
||||
'ptz_zoom_out',
|
||||
] as const) {
|
||||
// `ptz_home` has no start/stop action, so it maps to a null action here and
|
||||
// is handled separately below.
|
||||
for (const name of PTZ_KEYBOARD_SHORTCUTS) {
|
||||
const shortcut = shortcuts[name];
|
||||
const ptzAction = ptzKeyboardShortcutToPTZAction(name);
|
||||
if (!shortcut || !ptzAction) {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import type { CameraConfig } from '../config/schema/cameras';
|
||||
import type { AdvancedCameraCardConfig } from '../config/schema/types';
|
||||
import {
|
||||
MEDIA_PLAYER_SUPPORT_BROWSE_MEDIA,
|
||||
MEDIA_PLAYER_SUPPORT_STOP,
|
||||
MEDIA_PLAYER_SUPPORT_TURN_OFF,
|
||||
} from '../const';
|
||||
import type { Entity } from '../ha/registry/entity/types';
|
||||
import { supportsFeature } from '../ha/supports-feature';
|
||||
import { errorToConsole } from '../utils/basic';
|
||||
@@ -12,6 +7,12 @@ import type { ViewMedia } from '../view/item';
|
||||
import { ViewItemClassifier } from '../view/item-classifier';
|
||||
import type { CardMediaPlayerAPI } from './types';
|
||||
|
||||
// Media player support bitmask flags. Taken from:
|
||||
// https://github.com/home-assistant/frontend/blob/a759767d794f02527d127802831e68d3caf0cb7a/src/data/media-player.ts#L82
|
||||
export const MEDIA_PLAYER_SUPPORT_TURN_OFF = 256;
|
||||
export const MEDIA_PLAYER_SUPPORT_STOP = 4096;
|
||||
export const MEDIA_PLAYER_SUPPORT_BROWSE_MEDIA = 131072;
|
||||
|
||||
export class MediaPlayerManager {
|
||||
private _mediaPlayers: string[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user