Results of running ts-prune.
This commit is contained in:
@@ -165,7 +165,7 @@ const getActionHandler = (): ActionHandler => {
|
||||
return actionhandler as ActionHandler;
|
||||
};
|
||||
|
||||
export const actionHandlerBind = (
|
||||
const actionHandlerBind = (
|
||||
element: ActionHandlerElement,
|
||||
options?: FrigateCardActionHandlerOptions,
|
||||
): void => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import isEqual from 'lodash-es/isEqual';
|
||||
import orderBy from 'lodash-es/orderBy';
|
||||
import sortedUniqBy from 'lodash-es/sortedUniqBy';
|
||||
import { RecordingSegment } from '../types';
|
||||
import { DateRange, MemoryRangeSet } from './range';
|
||||
import { DataQuery, QueryResults } from './types';
|
||||
import { DataQuery, QueryResults, RecordingSegment } from './types';
|
||||
|
||||
interface RequestCacheItem<Request, Response> {
|
||||
request: Request;
|
||||
@@ -17,7 +16,7 @@ interface CameraManagerCache<Request, Response> {
|
||||
set(request: Request, response: Response, expiry?: Date): void;
|
||||
}
|
||||
|
||||
export class MemoryRequestCache<Request, Response>
|
||||
class MemoryRequestCache<Request, Response>
|
||||
implements CameraManagerCache<Request, Response>
|
||||
{
|
||||
protected _data: RequestCacheItem<Request, Response>[] = [];
|
||||
@@ -62,7 +61,7 @@ export class MemoryRequestCache<Request, Response>
|
||||
|
||||
export class RequestCache extends MemoryRequestCache<DataQuery, QueryResults> {}
|
||||
|
||||
export class MemoryRangedCache<Data> {
|
||||
class MemoryRangedCache<Data> {
|
||||
protected _ranges: MemoryRangeSet = new MemoryRangeSet();
|
||||
protected _data: Data[] = [];
|
||||
protected _timeFunc: (data: Data) => number;
|
||||
|
||||
@@ -5,7 +5,7 @@ const dayStringToDate = (arg: unknown): Date | unknown => {
|
||||
return typeof arg === 'string' ? dayToDate(arg) : arg;
|
||||
};
|
||||
|
||||
export const eventSchema = z.object({
|
||||
const eventSchema = z.object({
|
||||
camera: z.string(),
|
||||
end_time: z.number().nullable(),
|
||||
false_positive: z.boolean().nullable(),
|
||||
|
||||
@@ -37,7 +37,7 @@ import sum from 'lodash-es/sum';
|
||||
import add from 'date-fns/add';
|
||||
import { log } from '../utils/debug.js';
|
||||
|
||||
export class QueryClassifier {
|
||||
class QueryClassifier {
|
||||
public static isEventQuery(query: DataQuery | PartialDataQuery): query is EventQuery {
|
||||
return query.type === QueryType.Event;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export class QueryClassifier {
|
||||
}
|
||||
}
|
||||
|
||||
export class QueryResultClassifier {
|
||||
class QueryResultClassifier {
|
||||
public static isEventQueryResult(
|
||||
queryResults: QueryResults,
|
||||
): queryResults is EventQueryResults {
|
||||
|
||||
@@ -26,12 +26,12 @@ export interface DataQuery {
|
||||
}
|
||||
export type PartialDataQuery = Partial<DataQuery>;
|
||||
|
||||
export interface TimeBasedDataQuery {
|
||||
interface TimeBasedDataQuery {
|
||||
start: Date;
|
||||
end: Date;
|
||||
}
|
||||
|
||||
export interface LimitedDataQuery {
|
||||
interface LimitedDataQuery {
|
||||
limit: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class ConditionStateRequestEvent extends Event {
|
||||
public conditionState?: ConditionState;
|
||||
}
|
||||
|
||||
export function evaluateCondition(
|
||||
function evaluateCondition(
|
||||
condition?: Readonly<FrigateCardCondition>,
|
||||
state?: Readonly<ConditionState>,
|
||||
): boolean {
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ type InitializedType = 'initialized' | 'initializing';
|
||||
* Main FrigateCard class.
|
||||
*/
|
||||
@customElement('frigate-card')
|
||||
export class FrigateCard extends LitElement {
|
||||
class FrigateCard extends LitElement {
|
||||
@state()
|
||||
protected _hass?: ExtendedHomeAssistant;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ const defaultOptions: OptionsType = {
|
||||
breakpoints: {},
|
||||
};
|
||||
|
||||
export type AutoMediaOptionsType = Partial<OptionsType>
|
||||
type AutoMediaOptionsType = Partial<OptionsType>
|
||||
|
||||
export type AutoMediaType = CreatePluginType<
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CreatePluginType } from 'embla-carousel/components/Plugins';
|
||||
import EmblaCarousel, { EmblaCarouselType, EmblaEventType } from 'embla-carousel';
|
||||
import { LazyUnloadCondition } from '../../types';
|
||||
|
||||
export type OptionsType = CreateOptionsType<{
|
||||
type OptionsType = CreateOptionsType<{
|
||||
// Number of slides to lazyload left/right of selected (0 == only selected
|
||||
// slide).
|
||||
lazyLoadCount?: number;
|
||||
@@ -13,15 +13,15 @@ export type OptionsType = CreateOptionsType<{
|
||||
lazyUnloadCallback?: (index: number, slide: HTMLElement) => void;
|
||||
}>;
|
||||
|
||||
export const defaultOptions: OptionsType = {
|
||||
const defaultOptions: OptionsType = {
|
||||
active: true,
|
||||
breakpoints: {},
|
||||
lazyLoadCount: 0,
|
||||
};
|
||||
|
||||
export type LazyloadOptionsType = Partial<OptionsType>;
|
||||
type LazyloadOptionsType = Partial<OptionsType>;
|
||||
|
||||
export type LazyloadType = CreatePluginType<
|
||||
type LazyloadType = CreatePluginType<
|
||||
{
|
||||
hasLazyloaded(index: number): boolean;
|
||||
},
|
||||
|
||||
@@ -28,12 +28,12 @@ const getEmptyImageSrc = (width: number, height: number) =>
|
||||
`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}"%3E%3C/svg%3E`;
|
||||
export const IMG_EMPTY = getEmptyImageSrc(16, 9);
|
||||
|
||||
export interface CarouselMediaLoadedInfo {
|
||||
interface CarouselMediaLoadedInfo {
|
||||
slide: number;
|
||||
mediaLoadedInfo: MediaLoadedInfo;
|
||||
}
|
||||
|
||||
export interface CarouselMediaUnloadedInfo {
|
||||
interface CarouselMediaUnloadedInfo {
|
||||
slide: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ export type MediaFilterControls = {
|
||||
};
|
||||
|
||||
@customElement('frigate-card-media-filter-core')
|
||||
export class FrigateCardMediaFilterCore extends LitElement {
|
||||
class FrigateCardMediaFilterCore extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public hass?: ExtendedHomeAssistant;
|
||||
|
||||
|
||||
+2
-2
@@ -117,7 +117,7 @@ export const isConfigUpgradeable = function (obj: RawFrigateCardConfig): boolean
|
||||
* @param obj Configuration object.
|
||||
* @returns `true` if the configuration was modified.
|
||||
*/
|
||||
export const trimConfig = function (obj: RawFrigateCardConfig): boolean {
|
||||
const trimConfig = function (obj: RawFrigateCardConfig): boolean {
|
||||
const keys = Object.keys(obj);
|
||||
let modified = false;
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
@@ -221,7 +221,7 @@ const deleteProperty = function (_value: unknown): number | null | undefined {
|
||||
* @param transform An optional transform for the value.
|
||||
* @returns `true` if the configuration was modified.
|
||||
*/
|
||||
export const moveConfigValue = (
|
||||
const moveConfigValue = (
|
||||
obj: RawFrigateCardConfig,
|
||||
oldPath: string,
|
||||
newPath: string,
|
||||
|
||||
+7
-8
@@ -35,7 +35,7 @@ export const CONF_CAMERAS_ARRAY_TRIGGERS_ENTITIES =
|
||||
|
||||
export const CONF_ELEMENTS = 'elements' as const;
|
||||
|
||||
export const CONF_VIEW = 'view' as const;
|
||||
const CONF_VIEW = 'view' as const;
|
||||
export const CONF_VIEW_CAMERA_SELECT = `${CONF_VIEW}.camera_select` as const;
|
||||
export const CONF_VIEW_DARK_MODE = `${CONF_VIEW}.dark_mode` as const;
|
||||
export const CONF_VIEW_DEFAULT = `${CONF_VIEW}.default` as const;
|
||||
@@ -53,7 +53,7 @@ export const CONF_VIEW_SCAN_UNTRIGGER_RESET =
|
||||
export const CONF_VIEW_SCAN_UNTRIGGER_SECONDS =
|
||||
`${CONF_VIEW_SCAN}.untrigger_seconds` as const;
|
||||
|
||||
export const CONF_EVENT_GALLERY = 'event_gallery' as const;
|
||||
const CONF_EVENT_GALLERY = 'event_gallery' as const;
|
||||
export const CONF_EVENT_GALLERY_CONTROLS_FILTER_MODE =
|
||||
`${CONF_EVENT_GALLERY}.controls.filter.mode` as const;
|
||||
export const CONF_EVENT_GALLERY_CONTROLS_THUMBNAILS_SHOW_DETAILS =
|
||||
@@ -111,7 +111,7 @@ export const CONF_MEDIA_VIEWER_LAYOUT_POSITION_X =
|
||||
export const CONF_MEDIA_VIEWER_LAYOUT_POSITION_Y =
|
||||
`${CONF_MEDIA_VIEWER}.layout.position.y` as const;
|
||||
|
||||
export const CONF_LIVE = 'live' as const;
|
||||
const CONF_LIVE = 'live' as const;
|
||||
export const CONF_LIVE_AUTO_PLAY = `${CONF_LIVE}.auto_play` as const;
|
||||
export const CONF_LIVE_AUTO_PAUSE = `${CONF_LIVE}.auto_pause` as const;
|
||||
export const CONF_LIVE_AUTO_MUTE = `${CONF_LIVE}.auto_mute` as const;
|
||||
@@ -151,7 +151,6 @@ export const CONF_LIVE_LAYOUT_FIT = `${CONF_LIVE}.layout.fit` as const;
|
||||
export const CONF_LIVE_LAYOUT_POSITION_X = `${CONF_LIVE}.layout.position.x` as const;
|
||||
export const CONF_LIVE_LAYOUT_POSITION_Y = `${CONF_LIVE}.layout.position.y` as const;
|
||||
export const CONF_LIVE_DRAGGABLE = `${CONF_LIVE}.draggable` as const;
|
||||
export const CONF_LIVE_JSMPEG = `${CONF_LIVE}.jsmpeg` as const;
|
||||
export const CONF_LIVE_LAZY_LOAD = `${CONF_LIVE}.lazy_load` as const;
|
||||
export const CONF_LIVE_LAZY_UNLOAD = `${CONF_LIVE}.lazy_unload` as const;
|
||||
export const CONF_LIVE_PRELOAD = `${CONF_LIVE}.preload` as const;
|
||||
@@ -160,7 +159,7 @@ export const CONF_LIVE_SHOW_IMAGE_DURING_LOAD =
|
||||
`${CONF_LIVE}.show_image_during_load` as const;
|
||||
export const CONF_LIVE_WEBRTC_CARD = `${CONF_LIVE}.webrtc_card` as const;
|
||||
|
||||
export const CONF_IMAGE = 'image' as const;
|
||||
const CONF_IMAGE = 'image' as const;
|
||||
export const CONF_IMAGE_LAYOUT_FIT = `${CONF_IMAGE}.layout.fit` as const;
|
||||
export const CONF_IMAGE_LAYOUT_POSITION_X = `${CONF_IMAGE}.layout.position.x` as const;
|
||||
export const CONF_IMAGE_LAYOUT_POSITION_Y = `${CONF_IMAGE}.layout.position.y` as const;
|
||||
@@ -168,7 +167,7 @@ export const CONF_IMAGE_MODE = `${CONF_IMAGE}.mode` as const;
|
||||
export const CONF_IMAGE_REFRESH_SECONDS = `${CONF_IMAGE}.refresh_seconds` as const;
|
||||
export const CONF_IMAGE_URL = `${CONF_IMAGE}.url` as const;
|
||||
|
||||
export const CONF_TIMELINE = 'timeline' as const;
|
||||
const CONF_TIMELINE = 'timeline' as const;
|
||||
export const CONF_TIMELINE_WINDOW_SECONDS = `${CONF_TIMELINE}.window_seconds` as const;
|
||||
export const CONF_TIMELINE_CLUSTERING_THRESHOLD =
|
||||
`${CONF_TIMELINE}.clustering_threshold` as const;
|
||||
@@ -205,14 +204,14 @@ export const CONF_MENU_BUTTONS_MEDIA_PLAYER =
|
||||
export const CONF_MENU_BUTTONS_SNAPSHOTS = `${CONF_MENU}.buttons.snapshots` as const;
|
||||
export const CONF_MENU_BUTTONS_TIMELINE = `${CONF_MENU}.buttons.timeline` as const;
|
||||
|
||||
export const CONF_DIMENSIONS = 'dimensions' as const;
|
||||
const CONF_DIMENSIONS = 'dimensions' as const;
|
||||
export const CONF_DIMENSIONS_ASPECT_RATIO = `${CONF_DIMENSIONS}.aspect_ratio` as const;
|
||||
export const CONF_DIMENSIONS_ASPECT_RATIO_MODE =
|
||||
`${CONF_DIMENSIONS}.aspect_ratio_mode` as const;
|
||||
|
||||
export const CONF_OVERRIDES = 'overrides' as const;
|
||||
|
||||
export const CONF_PERFORMANCE = 'performance' as const;
|
||||
const CONF_PERFORMANCE = 'performance' as const;
|
||||
export const CONF_PERFORMANCE_FEATURES_ANIMATED_PROGRESS_INDICATOR = `${CONF_PERFORMANCE}.features.animated_progress_indicator`;
|
||||
export const CONF_PERFORMANCE_PROFILE = `${CONF_PERFORMANCE}.profile`;
|
||||
export const CONF_PERFORMANCE_STYLE_BOX_SHADOW = `${CONF_PERFORMANCE}.style.box_shadow`;
|
||||
|
||||
+8
-70
@@ -64,7 +64,7 @@ const FRIGATE_MENU_STYLES = [
|
||||
const FRIGATE_MENU_POSITIONS = ['left', 'right', 'top', 'bottom'] as const;
|
||||
const FRIGATE_MENU_ALIGNMENTS = FRIGATE_MENU_POSITIONS;
|
||||
|
||||
export const FRIGATE_MENU_PRIORITY_DEFAULT = 50;
|
||||
const FRIGATE_MENU_PRIORITY_DEFAULT = 50;
|
||||
export const FRIGATE_MENU_PRIORITY_MAX = 100;
|
||||
|
||||
const LIVE_PROVIDERS = ['auto', 'image', 'ha', 'frigate-jsmpeg', 'webrtc-card'] as const;
|
||||
@@ -131,7 +131,7 @@ const actionBaseSchema = z.object({
|
||||
// HA accepts either a boolean or a ConfirmationRestrictionConfig object.
|
||||
// `custom-card-helpers` currently only supports the latter. For maximum
|
||||
// compatibility, this card supports what HA supports.
|
||||
export interface ExtendedConfirmationRestrictionConfig {
|
||||
interface ExtendedConfirmationRestrictionConfig {
|
||||
confirmation?: boolean | ConfirmationRestrictionConfig;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ const customSchema = z
|
||||
/**
|
||||
* Camera configuration section
|
||||
*/
|
||||
export const cameraConfigDefault = {
|
||||
const cameraConfigDefault = {
|
||||
live_provider: 'auto' as const,
|
||||
frigate: {
|
||||
client_id: 'frigate' as const,
|
||||
@@ -460,12 +460,12 @@ const menuBaseSchema = z.object({
|
||||
icon: z.string().optional(),
|
||||
});
|
||||
|
||||
export const menuIconSchema = menuBaseSchema.merge(iconSchema).extend({
|
||||
const menuIconSchema = menuBaseSchema.merge(iconSchema).extend({
|
||||
type: z.literal('custom:frigate-card-menu-icon'),
|
||||
});
|
||||
export type MenuIcon = z.infer<typeof menuIconSchema>;
|
||||
|
||||
export const menuStateIconSchema = menuBaseSchema
|
||||
const menuStateIconSchema = menuBaseSchema
|
||||
.merge(stateIconSchema)
|
||||
.extend({
|
||||
type: z.literal('custom:frigate-card-menu-state-icon'),
|
||||
@@ -573,7 +573,6 @@ const pictureElementSchema = z.union([
|
||||
conditionalSchema,
|
||||
customSchema,
|
||||
]);
|
||||
export type PictureElement = z.infer<typeof pictureElementSchema>;
|
||||
|
||||
const pictureElementsSchema = pictureElementSchema.array().optional();
|
||||
export type PictureElements = z.infer<typeof pictureElementsSchema>;
|
||||
@@ -643,7 +642,7 @@ const viewConfigSchema = z
|
||||
* Image view configuration section.
|
||||
*/
|
||||
|
||||
export const IMAGE_MODES = ['screensaver', 'camera', 'url'] as const;
|
||||
const IMAGE_MODES = ['screensaver', 'camera', 'url'] as const;
|
||||
const imageConfigDefault = {
|
||||
mode: 'url' as const,
|
||||
refresh_seconds: 0,
|
||||
@@ -701,8 +700,6 @@ const timelineCoreConfigDefault = {
|
||||
};
|
||||
|
||||
const timelineMediaSchema = z.enum(['all', 'clips', 'snapshots']);
|
||||
export type TimelineMedia = z.infer<typeof timelineMediaSchema>;
|
||||
|
||||
const timelineCoreConfigSchema = z.object({
|
||||
clustering_threshold: z
|
||||
.number()
|
||||
@@ -1011,9 +1008,6 @@ const viewerNextPreviousControlConfigSchema = nextPreviousControlConfigSchema.ex
|
||||
viewerConfigDefault.controls.next_previous.size,
|
||||
),
|
||||
});
|
||||
export type ViewerNextPreviousControlConfig = z.infer<
|
||||
typeof viewerNextPreviousControlConfigSchema
|
||||
>;
|
||||
|
||||
const viewerConfigSchema = z
|
||||
.object({
|
||||
@@ -1228,7 +1222,7 @@ const debugConfigSchema = z
|
||||
logging: z.boolean().default(debugConfigDefault.logging),
|
||||
})
|
||||
.default(debugConfigDefault);
|
||||
export type DebugConfig = z.infer<typeof debugConfigSchema>;
|
||||
type DebugConfig = z.infer<typeof debugConfigSchema>;
|
||||
|
||||
export interface CardWideConfig {
|
||||
performance?: PerformanceConfig;
|
||||
@@ -1294,40 +1288,6 @@ export interface ExtendedHomeAssistant extends HomeAssistant {
|
||||
};
|
||||
}
|
||||
|
||||
export interface BrowseMediaQueryParameters {
|
||||
// ========================================
|
||||
// Parameters used to construct media query
|
||||
// ========================================
|
||||
mediaType?: 'clips' | 'snapshots';
|
||||
clientId: string;
|
||||
cameraName: string;
|
||||
label?: string;
|
||||
zone?: string;
|
||||
before?: number;
|
||||
after?: number;
|
||||
unlimited?: boolean;
|
||||
|
||||
// ========================================
|
||||
// Parameters used to differentiate results
|
||||
// ========================================
|
||||
// Optional title to be used for separating results when merging multiple
|
||||
// sets of results. See `mergeFrigateBrowseMediaSources()` .
|
||||
title?: string;
|
||||
|
||||
// Optional camera-id to which this query is associated. May be used to map
|
||||
// results to a particular camera within the card.
|
||||
cameraID?: string;
|
||||
}
|
||||
|
||||
export interface BrowseRecordingQueryParameters {
|
||||
clientId: string;
|
||||
cameraName: string;
|
||||
year: number;
|
||||
month: number;
|
||||
day: number;
|
||||
hour: number;
|
||||
}
|
||||
|
||||
export interface MediaLoadedInfo {
|
||||
width: number;
|
||||
height: number;
|
||||
@@ -1380,28 +1340,6 @@ export interface CardHelpers {
|
||||
* Home Assistant API types.
|
||||
*/
|
||||
|
||||
export const MEDIA_CLASS_PLAYLIST = 'playlist' as const;
|
||||
export const MEDIA_CLASS_VIDEO = 'video' as const;
|
||||
export const MEDIA_TYPE_PLAYLIST = 'playlist' as const;
|
||||
export const MEDIA_TYPE_IMAGE = 'image' as const;
|
||||
export const MEDIA_TYPE_VIDEO = 'video' as const;
|
||||
|
||||
// Recursive type, cannot use type interference:
|
||||
// See: https://github.com/colinhacks/zod#recursive-types
|
||||
//
|
||||
// Server side data-type defined here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/media_player/browse_media.py#L46
|
||||
export interface BrowseMediaSource {
|
||||
title: string;
|
||||
media_class: string;
|
||||
media_content_type: string;
|
||||
media_content_id: string;
|
||||
can_play: boolean;
|
||||
can_expand: boolean;
|
||||
children_media_class?: string | null;
|
||||
thumbnail: string | null;
|
||||
children?: BrowseMediaSource[] | null;
|
||||
}
|
||||
|
||||
// Server side data-type defined here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/media_source/models.py
|
||||
export const resolvedMediaSchema = z.object({
|
||||
url: z.string(),
|
||||
@@ -1414,7 +1352,7 @@ export const signedPathSchema = z.object({
|
||||
});
|
||||
export type SignedPath = z.infer<typeof signedPathSchema>;
|
||||
|
||||
export const entitySchema = z.object({
|
||||
const entitySchema = z.object({
|
||||
config_entry_id: z.string().nullable(),
|
||||
disabled_by: z.string().nullable(),
|
||||
entity_id: z.string(),
|
||||
|
||||
@@ -10,6 +10,7 @@ export const log = (cardWideConfig?: CardWideConfig, ...args: unknown[]) => {
|
||||
* For debug purposes only.
|
||||
* @param seconds
|
||||
*/
|
||||
// ts-prune-ignore-next
|
||||
export const sleep = async (seconds: number) => {
|
||||
await new Promise((r) => setTimeout(r, seconds * 1000));
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ const deviceSchema = z.object({
|
||||
config_entries: z.string().array(),
|
||||
manufacturer: z.string().nullable(),
|
||||
})
|
||||
export const deviceListSchema = deviceSchema.array();
|
||||
const deviceListSchema = deviceSchema.array();
|
||||
export type DeviceList = z.infer<typeof deviceListSchema>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -205,7 +205,7 @@ function computeStyle(state: HassEntity): StyleInfo {
|
||||
* @param stateObj The HassEntity object from `hass.states`.
|
||||
* @returns A string state, e.g. 'on'.
|
||||
*/
|
||||
export const computeActiveState = (stateObj: HassEntity): string => {
|
||||
const computeActiveState = (stateObj: HassEntity): string => {
|
||||
const domain = stateObj.entity_id.split('.')[0];
|
||||
let state = stateObj.state;
|
||||
|
||||
|
||||
@@ -4,11 +4,7 @@ import {
|
||||
HassEntityBase
|
||||
} from 'home-assistant-js-websocket';
|
||||
|
||||
export const UPDATE_SUPPORT_INSTALL = 1;
|
||||
export const UPDATE_SUPPORT_SPECIFIC_VERSION = 2;
|
||||
export const UPDATE_SUPPORT_PROGRESS = 4;
|
||||
export const UPDATE_SUPPORT_BACKUP = 8;
|
||||
export const UPDATE_SUPPORT_RELEASE_NOTES = 16;
|
||||
const UPDATE_SUPPORT_PROGRESS = 4;
|
||||
|
||||
interface UpdateEntityAttributes extends HassEntityAttributeBase {
|
||||
auto_update: boolean | null;
|
||||
@@ -28,7 +24,7 @@ export interface UpdateEntity extends HassEntityBase {
|
||||
export const supportsFeature = (stateObj: HassEntity, feature: number): boolean =>
|
||||
((stateObj.attributes.supported_features ?? 0) & feature) !== 0;
|
||||
|
||||
export const updateUsesProgress = (entity: UpdateEntity): boolean =>
|
||||
const updateUsesProgress = (entity: UpdateEntity): boolean =>
|
||||
supportsFeature(entity, UPDATE_SUPPORT_PROGRESS) &&
|
||||
typeof entity.attributes.in_progress === 'number';
|
||||
|
||||
|
||||
@@ -21,22 +21,3 @@ export const alarmPanelIcon = (state?: string) => {
|
||||
return 'mdi:shield';
|
||||
}
|
||||
};
|
||||
|
||||
export const alarmPanelIconAction = (state?: string) => {
|
||||
switch (state) {
|
||||
case 'armed_away':
|
||||
return 'mdi:shield-lock-outline';
|
||||
case 'armed_vacation':
|
||||
return 'mdi:shield-airplane-outline';
|
||||
case 'armed_home':
|
||||
return 'mdi:shield-home-outline';
|
||||
case 'armed_night':
|
||||
return 'mdi:shield-moon-outline';
|
||||
case 'armed_custom_bypass':
|
||||
return 'mdi:shield-half-full';
|
||||
case 'disarmed':
|
||||
return 'mdi:shield-off-outline';
|
||||
default:
|
||||
return 'mdi:shield-outline';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -87,27 +87,3 @@ export const coverIcon = (state?: string, entity?: HassEntity): string => {
|
||||
return 'mdi:window-open';
|
||||
}
|
||||
};
|
||||
|
||||
export const computeOpenIcon = (stateObj: HassEntity): string => {
|
||||
switch (stateObj.attributes.device_class) {
|
||||
case 'awning':
|
||||
case 'curtain':
|
||||
case 'door':
|
||||
case 'gate':
|
||||
return 'mdi:arrow-expand-horizontal';
|
||||
default:
|
||||
return 'mdi:arrow-up';
|
||||
}
|
||||
};
|
||||
|
||||
export const computeCloseIcon = (stateObj: HassEntity): string => {
|
||||
switch (stateObj.attributes.device_class) {
|
||||
case 'awning':
|
||||
case 'curtain':
|
||||
case 'door':
|
||||
case 'gate':
|
||||
return 'mdi:arrow-collapse-horizontal';
|
||||
default:
|
||||
return 'mdi:arrow-down';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ const batteryStateIcon = (
|
||||
return batteryIcon(battery, batteryCharging);
|
||||
};
|
||||
|
||||
export const batteryIcon = (
|
||||
const batteryIcon = (
|
||||
batteryState: number | string,
|
||||
batteryCharging?: boolean,
|
||||
) => {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// to give a cleaner UI appearance, see:
|
||||
// https://github.com/dermotduffy/frigate-hass-card/issues/856
|
||||
export const MEDIA_LOAD_CONTROLS_HIDE_SECONDS = 2;
|
||||
export const MEDIA_SEEK_CONTROLS_HIDE_SECONDS = 1;
|
||||
const MEDIA_SEEK_CONTROLS_HIDE_SECONDS = 1;
|
||||
|
||||
/**
|
||||
* Temporarily hide media controls.
|
||||
|
||||
@@ -8,7 +8,7 @@ import { HomeAssistant } from 'custom-card-helpers';
|
||||
* @param thumbnailURL The thumbnail URL.
|
||||
* @returns A base64 encoded data URL for the thumbnail.
|
||||
*/
|
||||
export const fetchThumbnail = async (
|
||||
const fetchThumbnail = async (
|
||||
hass: HomeAssistant,
|
||||
thumbnailURL: string,
|
||||
): Promise<string | null> => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { EventQuery, MediaQuery, RecordingQuery } from '../camera-manager/types.
|
||||
|
||||
export type MediaQueries = EventMediaQueries | RecordingMediaQueries;
|
||||
|
||||
export class MediaQueriesBase<T extends MediaQuery> {
|
||||
class MediaQueriesBase<T extends MediaQuery> {
|
||||
protected _queries: T[] | null = null;
|
||||
|
||||
public constructor(queries?: T[]) {
|
||||
|
||||
+2
-4
@@ -1,5 +1,3 @@
|
||||
// Minor / later:
|
||||
// - TODO: ts-prune https://camchenry.com/blog/deleting-dead-code-in-typescript
|
||||
// Gallery:
|
||||
// - TODO: Filter panel expands from right can occasionally 'stick' open.
|
||||
|
||||
@@ -14,7 +12,7 @@ import { dispatchFrigateCardEvent } from '../utils/basic.js';
|
||||
import { MediaQueries } from './media-queries';
|
||||
import { MediaQueriesResults } from './media-queries-results';
|
||||
|
||||
export interface ViewEvolveParameters {
|
||||
interface ViewEvolveParameters {
|
||||
view?: FrigateCardView;
|
||||
camera?: string;
|
||||
query?: MediaQueries | null;
|
||||
@@ -22,7 +20,7 @@ export interface ViewEvolveParameters {
|
||||
context?: ViewContext | null;
|
||||
}
|
||||
|
||||
export interface ViewParameters extends ViewEvolveParameters {
|
||||
interface ViewParameters extends ViewEvolveParameters {
|
||||
view: FrigateCardView;
|
||||
camera: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user