Skip to content

Commit

Permalink
Rename the library from custom-attributes to custom-more-info (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
elchininet authored Dec 21, 2023
1 parent 423347f commit 87598ae
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: |
custom-attributes.js
custom-more-info.js
body: |
${{ steps.build_changelog.outputs.changelog }}
2 changes: 1 addition & 1 deletion custom-attributes.js → custom-more-info.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Custom-Attributes",
"name": "Custom-More-Info",
"homeassistant": "2023.0.0",
"render_readme": true
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "custom-attributes",
"name": "custom-more-info",
"version": "1.0.0",
"description": "Custom attributes for Home Assistant",
"main": "custom-attributes.js",
"repository": "git@github.com:Mariusthvdb/custom-attributes.git",
"description": "Custom more-info for Home Assistant",
"main": "custom-more-info.js",
"repository": "git@github.com/Mariusthvdb/custom-more-info.git",
"author": "Mariusthvdb",
"license": "GPL-3.0",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export default {
}
})
],
input: 'src/custom-attributes.ts',
input: 'src/custom-more-info.ts',
output: {
file: './custom-attributes.js',
file: './custom-more-info.js',
format: 'iife'
}
};
6 changes: 3 additions & 3 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const NAME = 'Custom-attributes';
export const DESCRIPTION = 'Custom attributes for Home Assistant';
export const URL = 'https://github.com/Mariusthvdb/custom-attributes';
export const NAME = 'Custom-more-info';
export const DESCRIPTION = 'Custom more-info for Home Assistant';
export const URL = 'https://github.com/Mariusthvdb/custom-more-info';

export enum SELECTOR {
HUI_VIEW = 'hui-view',
Expand Down
10 changes: 5 additions & 5 deletions src/custom-attributes.ts → src/custom-more-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from 'home-assistant-query-selector';
import {
Lovelace,
CustomAttributesConfig,
CustomMoreInfoConfig,
Attributes,
Filters
} from '@types';
Expand All @@ -26,7 +26,7 @@ console.info(
'color: white; font-weight: bold; background: steelblue'
);

class CustomAttributes {
class CustomMoreInfo {

constructor() {
this._selector = new HAQuerySelector();
Expand All @@ -44,7 +44,7 @@ class CustomAttributes {
protected storeConfig(detail: OnLovelacePanelLoadDetail): void {
detail.HA_PANEL_LOVELACE.element
.then((lovelacePanel: Lovelace) => {
const config = lovelacePanel?.lovelace?.config?.custom_attributes;
const config = lovelacePanel?.lovelace?.config?.custom_more_info;
if (config) {
this._config = config;
this._debug('the config has been loaded, printing the config...');
Expand Down Expand Up @@ -253,13 +253,13 @@ class CustomAttributes {
}

private _selector: HAQuerySelector;
private _config: CustomAttributesConfig;
private _config: CustomMoreInfoConfig;
private _filters: Record<string, Filters>;

}

// Ensure the DOM is fully loaded before running the script
Promise.resolve(customElements.whenDefined(SELECTOR.HUI_VIEW))
.then(() => {
window.customAttributes = new CustomAttributes();
window.customMoreInfo = new CustomMoreInfo();
});
8 changes: 4 additions & 4 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface CustomAttributesClass {
export interface CustomMoreInfoClass {
}

export interface StateObject {
Expand Down Expand Up @@ -26,7 +26,7 @@ export interface Filters {
unfilter_attributes: string[];
}

export interface CustomAttributesConfig {
export interface CustomMoreInfoConfig {
debug?: boolean;
filter_all?: boolean;
unfilter_all?: boolean;
Expand All @@ -37,13 +37,13 @@ export interface CustomAttributesConfig {
export interface Lovelace extends HTMLElement {
lovelace: {
config: {
custom_attributes?: CustomAttributesConfig;
custom_more_info?: CustomMoreInfoConfig;
};
};
}

declare global {
interface Window {
customAttributes: CustomAttributesClass;
customMoreInfo: CustomMoreInfoClass;
}
}

0 comments on commit 87598ae

Please sign in to comment.