Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Updated to v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevgenium committed Aug 22, 2021
1 parent d336219 commit a9f795f
Show file tree
Hide file tree
Showing 8 changed files with 757 additions and 563 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 10,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules/
/dist/
package-lock.json
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "weather-chart-card",
"version": "1.0.0",
"description": "Weather card with charts for Home Assistant Lovelace UI",
"keywords": [
"home-assistant",
"homeassistant",
"hass",
"automation",
"lovelace",
"custom-cards"
],
"module": "src/main.js",
"repository": "git@github.com:Yevgenium/lovelace-weather-card-chart.git",
"author": "Yevgeniy Prokopenko",
"license": "MIT",
"dependencies": {
"chart.js": "^3.5.1",
"chartjs-plugin-datalabels": "^2.0.0"
},
"devDependencies": {
"eslint": "^5.16.0",
"acorn": "^8.4.1",
"rollup": "^2.33.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.1.0"
},
"scripts": {
"start": "rollup -c rollup.config.dev.js --watch",
"build": "npm run lint && npm run rollup",
"lint": "eslint src/* --ext .js",
"rollup": "rollup -c"
}
}
28 changes: 28 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import resolve from 'rollup-plugin-node-resolve';
import serve from 'rollup-plugin-serve';

const dev = process.env.ROLLUP_WATCH;

const serveopts = {
contentBase: ['./dist'],
host: '0.0.0.0',
port: 5000,
allowCrossOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
};

export default {
input: 'src/main.js',
output: {
file: 'dist/weather-chart-card-bundle.js',
format: 'umd',
name: 'WeatherChartCard',
sourcemap: dev ? true : false,
},
plugins: [
resolve(),
dev && serve(serveopts),
],
};
52 changes: 52 additions & 0 deletions src/const.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const cardinalDirectionsIcon = [
'arrow-down', 'arrow-bottom-left', 'arrow-left',
'arrow-top-left', 'arrow-up', 'arrow-top-right',
'arrow-right', 'arrow-bottom-right', 'arrow-down'
];

const weatherIcons = {
'clear-night': 'hass:weather-night',
'cloudy': 'hass:weather-cloudy',
'fog': 'hass:weather-fog',
'hail': 'hass:weather-hail',
'lightning': 'hass:weather-lightning',
'lightning-rainy': 'hass:weather-lightning-rainy',
'partlycloudy': 'hass:weather-partly-cloudy',
'pouring': 'hass:weather-pouring',
'rainy': 'hass:weather-rainy',
'snowy': 'hass:weather-snowy',
'snowy-rainy': 'hass:weather-snowy-rainy',
'sunny': 'hass:weather-sunny',
'windy': 'hass:weather-windy',
'windy-variant': 'hass:weather-windy-variant'
};

const weatherIconsDay = {
'clear-night': 'clear-night',
'cloudy': 'cloudy',
'fog': 'fog',
'hail': 'hail',
'lightning': 'lightning',
'lightning-rainy': 'lightning-rain',
'partlycloudy': 'partlycloudy-day',
'pouring': 'pouring',
'rainy': 'rain',
'snowy': 'snow',
'snowy-rainy': 'sleet',
'sunny': 'clear-day',
'windy': 'wind',
'windy-variant': 'wind',
};

const weatherIconsNight = {
...weatherIconsDay,
'sunny': 'clear-night',
'partlycloudy': 'partlycloudy-night',
};

export {
cardinalDirectionsIcon,
weatherIcons,
weatherIconsDay,
weatherIconsNight
};
56 changes: 56 additions & 0 deletions src/locale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const locale = {
en: {
tempHi: 'Temperature',
tempLo: 'Temperature night',
precip: 'Precipitations',
uPress: 'hPa',
uSpeed: 'm/s',
uPrecip: ['mm', 'in'],
cardinalDirections: [
'N', 'N-NE', 'NE', 'E-NE', 'E', 'E-SE', 'SE', 'S-SE',
'S', 'S-SW', 'SW', 'W-SW', 'W', 'W-NW', 'NW', 'N-NW', 'N'
],
'clear-night': 'Clear, night',
'cloudy': 'Cloudy',
'fog': 'Fog',
'hail': 'Hail',
'lightning': 'Lightning',
'lightning-rainy': 'Lightning, rainy',
'partlycloudy': 'Partly cloudy',
'pouring': 'Pouring',
'rainy': 'Rainy',
'snowy': 'Snowy',
'snowy-rainy': 'Snowy, rainy',
'sunny': 'Sunny',
'windy': 'Windy',
'windy-variant': 'Windy'
},
ru: {
tempHi: 'Температура',
tempLo: 'Температура ночью',
precip: 'Осадки',
uPress: 'гПа',
uSpeed: 'м/с',
uPrecip: ['мм', 'дюйма'],
cardinalDirections: [
'С', 'С-СВ', 'СВ', 'В-СВ', 'В', 'В-ЮВ', 'ЮВ', 'Ю-ЮВ',
'Ю', 'Ю-ЮЗ', 'ЮЗ', 'З-ЮЗ', 'З', 'З-СЗ', 'СЗ', 'С-СЗ', 'С'
],
'clear-night': 'Ясно',
'cloudy': 'Облачно',
'fog': 'Туман',
'hail': 'Град',
'lightning': 'Гроза',
'lightning-rainy': 'Дождь с грозой',
'partlycloudy': 'Переменная облачность',
'pouring': 'Ливень',
'rainy': 'Дождь',
'snowy': 'Снег',
'snowy-rainy': 'Снег с дождем',
'sunny': 'Ясно',
'windy': 'Ветрено',
'windy-variant': 'Ветрено'
}
};

export default locale;
Loading

0 comments on commit a9f795f

Please sign in to comment.