feat: Rename the card to advanced-camera-card (#1873)
Whilst the Frigate support in this card is the best among camera engines, the name incorrectly suggests that Frigate is a requirement. Instead, to broaden the appeal, change to more camera agnostic name. This does not suggest any change in priority, role or support for Frigate. This change is likely to be bug prone, due to the size of the rename -- the code contains 1500+ references to "Frigate" most of which make sense to rename, some which do not, all of which needed human assessment. - Closes #1298 BREAKING CHANGE: References to `frigate-card` in all kinds of configuration need to be updated to `advanced-camera-card`. An automated config upgrade should take care of the majority of usecases (click `Edit -> Upgrade -> Save`), though may not be perfect.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { fireEvent } from '@dermotduffy/custom-card-helpers';
|
||||
import type {
|
||||
ActionHandlerDetail,
|
||||
ActionHandlerOptions,
|
||||
} from '@dermotduffy/custom-card-helpers';
|
||||
import { fireEvent } from '@dermotduffy/custom-card-helpers';
|
||||
import { noChange } from 'lit';
|
||||
import {
|
||||
AttributePart,
|
||||
@@ -18,10 +18,10 @@ interface ActionHandlerInterface extends HTMLElement {
|
||||
bind(element: Element, options): void;
|
||||
}
|
||||
interface ActionHandlerElement extends HTMLElement {
|
||||
actionHandlerOptions?: FrigateCardActionHandlerOptions;
|
||||
actionHandlerOptions?: AdvancedCameraCardActionHandlerOptions;
|
||||
}
|
||||
|
||||
interface FrigateCardActionHandlerOptions extends ActionHandlerOptions {
|
||||
interface AdvancedCameraCardActionHandlerOptions extends ActionHandlerOptions {
|
||||
allowPropagation?: boolean;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class ActionHandler extends HTMLElement implements ActionHandlerInterface {
|
||||
|
||||
public bind(
|
||||
element: ActionHandlerElement,
|
||||
options?: FrigateCardActionHandlerOptions,
|
||||
options?: AdvancedCameraCardActionHandlerOptions,
|
||||
): void {
|
||||
if (element.actionHandlerOptions) {
|
||||
// Reset the options on an existing actionHandler.
|
||||
@@ -160,15 +160,15 @@ class ActionHandler extends HTMLElement implements ActionHandlerInterface {
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('action-handler-frigate-card', ActionHandler);
|
||||
customElements.define('action-handler-advanced-camera-card', ActionHandler);
|
||||
|
||||
const getActionHandler = (): ActionHandler => {
|
||||
const body = document.body;
|
||||
if (body.querySelector('action-handler-frigate-card')) {
|
||||
return body.querySelector('action-handler-frigate-card') as ActionHandler;
|
||||
if (body.querySelector('action-handler-advanced-camera-card')) {
|
||||
return body.querySelector('action-handler-advanced-camera-card') as ActionHandler;
|
||||
}
|
||||
|
||||
const actionhandler = document.createElement('action-handler-frigate-card');
|
||||
const actionhandler = document.createElement('action-handler-advanced-camera-card');
|
||||
body.appendChild(actionhandler);
|
||||
|
||||
return actionhandler as ActionHandler;
|
||||
@@ -176,7 +176,7 @@ const getActionHandler = (): ActionHandler => {
|
||||
|
||||
const actionHandlerBind = (
|
||||
element: ActionHandlerElement,
|
||||
options?: FrigateCardActionHandlerOptions,
|
||||
options?: AdvancedCameraCardActionHandlerOptions,
|
||||
): void => {
|
||||
const actionhandler: ActionHandler = getActionHandler();
|
||||
if (!actionhandler) {
|
||||
@@ -193,7 +193,7 @@ export const actionHandler = directive(
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
|
||||
render(_options?: FrigateCardActionHandlerOptions) {}
|
||||
render(_options?: AdvancedCameraCardActionHandlerOptions) {}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -222,7 +222,7 @@ export interface ActionEventTarget extends EventTarget {
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'action-handler-frigate-card': ActionHandler;
|
||||
'action-handler-advanced-camera-card': ActionHandler;
|
||||
}
|
||||
interface HASSDomEvents {
|
||||
action: ActionHandlerDetail;
|
||||
|
||||
Reference in New Issue
Block a user