From 40cab1bf6641d25ffaa3597442a978ac80f235eb Mon Sep 17 00:00:00 2001 From: Steven Marks Date: Fri, 29 May 2020 14:18:26 +0000 Subject: [PATCH] :star: :bug: :memo: v1.8.5 --- dist/atomic-calendar-revive.js | 4 +-- docs/options/calendar-mode-options.md | 26 ++++++++++++--- docs/options/entity-options.md | 6 ++++ docs/options/event-mode-options.md | 33 +++++++++++++++++++ docs/options/event-options.md | 13 -------- docs/options/main-options.md | 13 ++++++++ docs/options/theme-options.md | 47 --------------------------- package.json | 2 +- src/app.js | 35 +++++++++++--------- tracker.json | 2 +- 10 files changed, 98 insertions(+), 83 deletions(-) create mode 100644 docs/options/event-mode-options.md delete mode 100644 docs/options/event-options.md delete mode 100644 docs/options/theme-options.md diff --git a/dist/atomic-calendar-revive.js b/dist/atomic-calendar-revive.js index fca1205e..a183ab34 100644 --- a/dist/atomic-calendar-revive.js +++ b/dist/atomic-calendar-revive.js @@ -1,4 +1,4 @@ -function _templateObject45() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t", "\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t
\n\t\t\t"]); return _templateObject45 = function () { return data }, data } function _templateObject44() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t\t ", " "]); return _templateObject44 = function () { return data }, data } function _templateObject43() { const data = _taggedTemplateLiteral([""]); return _templateObject43 = function () { return data }, data } function _templateObject42() { const data = _taggedTemplateLiteral([""]); return _templateObject42 = function () { return data }, data } function _templateObject41() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t", "\n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t", " ", " ", "\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t", "\n\t\t\t\t\t"]); return _templateObject41 = function () { return data }, data } function _templateObject40() { const data = _taggedTemplateLiteral([""]); return _templateObject40 = function () { return data }, data } function _templateObject39() { const data = _taggedTemplateLiteral([""]); return _templateObject39 = function () { return data }, data } function _templateObject38() { const data = _taggedTemplateLiteral([""]); return _templateObject38 = function () { return data }, data } function _templateObject37() { const data = _taggedTemplateLiteral(["\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t", " ", "\n\t\t\t\t\n\t\t\t\t\n\t\t\t
"]); return _templateObject37 = function () { return data }, data } function _templateObject36() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t", " - ", " ", "\n\t\t\t\t\t
"]); return _templateObject36 = function () { return data }, data } function _templateObject35() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t", " ", "\n\t\t\t\t\t\t\n\t\t\t\t\t
"]); return _templateObject35 = function () { return data }, data } function _templateObject34() { const data = _taggedTemplateLiteral([" "]); return _templateObject34 = function () { return data }, data } function _templateObject33() { const data = _taggedTemplateLiteral(["", ""]); return _templateObject33 = function () { return data }, data } function _templateObject32() { const data = _taggedTemplateLiteral(["", "
"]); return _templateObject32 = function () { return data }, data } function _templateObject31() { const data = _taggedTemplateLiteral(["\n\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\n\n\t\t\t\t\t"]); return _templateObject31 = function () { return data }, data } function _templateObject30() { const data = _taggedTemplateLiteral(["
", "
"]); return _templateObject30 = function () { return data }, data } function _templateObject29() { const data = _taggedTemplateLiteral(["
", "
"]); return _templateObject29 = function () { return data }, data } function _templateObject28() { const data = _taggedTemplateLiteral(["

"]); return _templateObject28 = function () { return data }, data } function _templateObject27() { const data = _taggedTemplateLiteral(["
 ", "
"]); return _templateObject27 = function () { return data }, data } function _templateObject26() { const data = _taggedTemplateLiteral(["

"]); return _templateObject26 = function () { return data }, data } function _templateObject25() { const data = _taggedTemplateLiteral([""]); return _templateObject25 = function () { return data }, data } function _templateObject24() { const data = _taggedTemplateLiteral(["\n\t\t\t \n\t\t"]); return _templateObject24 = function () { return data }, data } function _templateObject23() { const data = _taggedTemplateLiteral([""]); return _templateObject23 = function () { return data }, data } function _templateObject22() { const data = _taggedTemplateLiteral(["\n\t\t\t
 ", "
\n\t\t"]); return _templateObject22 = function () { return data }, data } function _templateObject21() { const data = _taggedTemplateLiteral(["\n\t\t
 ", "
\n\t\t"]); return _templateObject21 = function () { return data }, data } function _templateObject20() { const data = _taggedTemplateLiteral(["\n\t\t\t\t
", " - ", "
"]); return _templateObject20 = function () { return data }, data } function _templateObject19() { const data = _taggedTemplateLiteral(["
", ", ", " ", "
"]); return _templateObject19 = function () { return data }, data } function _templateObject18() { const data = _taggedTemplateLiteral(["
", " ", "
"]); return _templateObject18 = function () { return data }, data } function _templateObject17() { const data = _taggedTemplateLiteral(["
", " ", "
"]); return _templateObject17 = function () { return data }, data } function _templateObject16() { const data = _taggedTemplateLiteral(["
", ", ", " ", "
"]); return _templateObject16 = function () { return data }, data } function _templateObject15() { const data = _taggedTemplateLiteral(["
", "
"]); return _templateObject15 = function () { return data }, data } function _templateObject14() { const data = _taggedTemplateLiteral(["
 
"]); return _templateObject14 = function () { return data }, data } function _templateObject13() { const data = _taggedTemplateLiteral(["\n\t\t", "\n\t\t"]); return _templateObject13 = function () { return data }, data } function _templateObject12() { const data = _taggedTemplateLiteral(["\n\t\t", "\n\t\t"]); return _templateObject12 = function () { return data }, data } function _templateObject11() { const data = _taggedTemplateLiteral(["\n\t\t\n\t\t
", "
\n\t\t"]); return _templateObject11 = function () { return data }, data } function _templateObject10() { const data = _taggedTemplateLiteral(["\n\t\t
", "
\n\t\t"]); return _templateObject10 = function () { return data }, data } function _templateObject9() { const data = _taggedTemplateLiteral(["\n\t\t\n\t\t"]); return _templateObject9 = function () { return data }, data } function _templateObject8() { const data = _taggedTemplateLiteral(["", ""]); return _templateObject8 = function () { return data }, data } function _templateObject7() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
\n\t\t\t\t\t", "\n\t\t\t\t\t
\n\t\t\t\t\t"]); return _templateObject7 = function () { return data }, data } function _templateObject6() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
"]); return _templateObject6 = function () { return data }, data } function _templateObject5() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t\t
\n\t\t\t\t\t\t", "\n\t\t\t\t\t\t
\n\t\t\t\t\t\t"]); return _templateObject5 = function () { return data }, data } function _templateObject4() { const data = _taggedTemplateLiteral(["\n\t\t\t
\n\t\t\t\t", "\n\n\t\t\t\t", "\n\t\t\t\t", "\n\t\t\t
\n\t\t\t"]); return _templateObject4 = function () { return data }, data } function _templateObject3() { const data = _taggedTemplateLiteral(["\n\n\t ", "\n\n\t\t\n\t\t", "\n\n\t\t
\n\t\t\t", "\n\t\t
\n\t
"]); return _templateObject3 = function () { return data }, data } function _templateObject2() { const data = _taggedTemplateLiteral([" "]); return _templateObject2 = function () { return data }, data } function _templateObject() { const data = _taggedTemplateLiteral([""]); return _templateObject = function () { return data }, data } function _taggedTemplateLiteral(strings, raw) { return raw || (raw = strings.slice(0)), Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })) }/** +function _templateObject45() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t", "\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t
\n\t\t\t"]); return _templateObject45 = function () { return data }, data } function _templateObject44() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t\t ", " "]); return _templateObject44 = function () { return data }, data } function _templateObject43() { const data = _taggedTemplateLiteral([""]); return _templateObject43 = function () { return data }, data } function _templateObject42() { const data = _taggedTemplateLiteral([""]); return _templateObject42 = function () { return data }, data } function _templateObject41() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t", "\n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t", " ", " ", "\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t", "\n\t\t\t\t\t"]); return _templateObject41 = function () { return data }, data } function _templateObject40() { const data = _taggedTemplateLiteral([""]); return _templateObject40 = function () { return data }, data } function _templateObject39() { const data = _taggedTemplateLiteral([""]); return _templateObject39 = function () { return data }, data } function _templateObject38() { const data = _taggedTemplateLiteral([""]); return _templateObject38 = function () { return data }, data } function _templateObject37() { const data = _taggedTemplateLiteral(["\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t", " ", "\n\t\t\t\t\n\t\t\t\t\n\t\t\t
"]); return _templateObject37 = function () { return data }, data } function _templateObject36() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t", " - ", " ", "\n\t\t\t\t\t
"]); return _templateObject36 = function () { return data }, data } function _templateObject35() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t", " ", "\n\t\t\t\t\t\t\n\t\t\t\t\t
"]); return _templateObject35 = function () { return data }, data } function _templateObject34() { const data = _taggedTemplateLiteral([" "]); return _templateObject34 = function () { return data }, data } function _templateObject33() { const data = _taggedTemplateLiteral(["", ""]); return _templateObject33 = function () { return data }, data } function _templateObject32() { const data = _taggedTemplateLiteral(["", "
"]); return _templateObject32 = function () { return data }, data } function _templateObject31() { const data = _taggedTemplateLiteral(["\n\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t
", "
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t", "\n\t\t\t\t\t\t\n\n\t\t\t\t\t"]); return _templateObject31 = function () { return data }, data } function _templateObject30() { const data = _taggedTemplateLiteral(["
", "
"]); return _templateObject30 = function () { return data }, data } function _templateObject29() { const data = _taggedTemplateLiteral(["
", "
"]); return _templateObject29 = function () { return data }, data } function _templateObject28() { const data = _taggedTemplateLiteral(["

"]); return _templateObject28 = function () { return data }, data } function _templateObject27() { const data = _taggedTemplateLiteral(["
 ", "
"]); return _templateObject27 = function () { return data }, data } function _templateObject26() { const data = _taggedTemplateLiteral(["

"]); return _templateObject26 = function () { return data }, data } function _templateObject25() { const data = _taggedTemplateLiteral([""]); return _templateObject25 = function () { return data }, data } function _templateObject24() { const data = _taggedTemplateLiteral(["\n\t\t\t \n\t\t"]); return _templateObject24 = function () { return data }, data } function _templateObject23() { const data = _taggedTemplateLiteral([""]); return _templateObject23 = function () { return data }, data } function _templateObject22() { const data = _taggedTemplateLiteral(["\n\t\t\t
 ", "
\n\t\t"]); return _templateObject22 = function () { return data }, data } function _templateObject21() { const data = _taggedTemplateLiteral(["\n\t\t
 ", "
\n\t\t"]); return _templateObject21 = function () { return data }, data } function _templateObject20() { const data = _taggedTemplateLiteral(["\n\t\t\t\t
", " - ", "
"]); return _templateObject20 = function () { return data }, data } function _templateObject19() { const data = _taggedTemplateLiteral(["
", ", ", " ", "
"]); return _templateObject19 = function () { return data }, data } function _templateObject18() { const data = _taggedTemplateLiteral(["
", " ", "
"]); return _templateObject18 = function () { return data }, data } function _templateObject17() { const data = _taggedTemplateLiteral(["
", " ", "
"]); return _templateObject17 = function () { return data }, data } function _templateObject16() { const data = _taggedTemplateLiteral(["
", ", ", " ", "
"]); return _templateObject16 = function () { return data }, data } function _templateObject15() { const data = _taggedTemplateLiteral(["
", "
"]); return _templateObject15 = function () { return data }, data } function _templateObject14() { const data = _taggedTemplateLiteral(["
 
"]); return _templateObject14 = function () { return data }, data } function _templateObject13() { const data = _taggedTemplateLiteral(["\n\t\t", "\n\t\t"]); return _templateObject13 = function () { return data }, data } function _templateObject12() { const data = _taggedTemplateLiteral(["\n\t\t", "\n\t\t"]); return _templateObject12 = function () { return data }, data } function _templateObject11() { const data = _taggedTemplateLiteral(["\n\t\t\n\t\t
", "
\n\t\t"]); return _templateObject11 = function () { return data }, data } function _templateObject10() { const data = _taggedTemplateLiteral(["\n\t\t
", "
\n\t\t"]); return _templateObject10 = function () { return data }, data } function _templateObject9() { const data = _taggedTemplateLiteral(["\n\t\t\n\t\t"]); return _templateObject9 = function () { return data }, data } function _templateObject8() { const data = _taggedTemplateLiteral(["", ""]); return _templateObject8 = function () { return data }, data } function _templateObject7() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
\n\t\t\t\t\t", "\n\t\t\t\t\t
\n\t\t\t\t\t"]); return _templateObject7 = function () { return data }, data } function _templateObject6() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t
"]); return _templateObject6 = function () { return data }, data } function _templateObject5() { const data = _taggedTemplateLiteral(["\n\t\t\t\t\t\t
\n\t\t\t\t\t\t", "\n\t\t\t\t\t\t
\n\t\t\t\t\t\t"]); return _templateObject5 = function () { return data }, data } function _templateObject4() { const data = _taggedTemplateLiteral(["\n\t\t\t
\n\t\t\t\t", "\n\n\t\t\t\t", "\n\t\t\t\t", "\n\t\t\t
\n\t\t\t"]); return _templateObject4 = function () { return data }, data } function _templateObject3() { const data = _taggedTemplateLiteral(["\n\n\t ", "\n\n\t\t\n\t\t", "\n\n\t\t
\n\t\t\t", "\n\t\t
\n\t
"]); return _templateObject3 = function () { return data }, data } function _templateObject2() { const data = _taggedTemplateLiteral([" "]); return _templateObject2 = function () { return data }, data } function _templateObject() { const data = _taggedTemplateLiteral([""]); return _templateObject = function () { return data }, data } function _taggedTemplateLiteral(strings, raw) { return raw || (raw = strings.slice(0)), Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })) }/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at @@ -270,4 +270,4 @@ found at http://polymer.github.io/PATENTS.txt e.defineLocale("zh-mo", { months: "\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u56DB\u6708_\u4E94\u6708_\u516D\u6708_\u4E03\u6708_\u516B\u6708_\u4E5D\u6708_\u5341\u6708_\u5341\u4E00\u6708_\u5341\u4E8C\u6708".split("_"), monthsShort: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"), weekdays: "\u661F\u671F\u65E5_\u661F\u671F\u4E00_\u661F\u671F\u4E8C_\u661F\u671F\u4E09_\u661F\u671F\u56DB_\u661F\u671F\u4E94_\u661F\u671F\u516D".split("_"), weekdaysShort: "\u9031\u65E5_\u9031\u4E00_\u9031\u4E8C_\u9031\u4E09_\u9031\u56DB_\u9031\u4E94_\u9031\u516D".split("_"), weekdaysMin: "\u65E5_\u4E00_\u4E8C_\u4E09_\u56DB_\u4E94_\u516D".split("_"), longDateFormat: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "YYYY\u5E74M\u6708D\u65E5", LLL: "YYYY\u5E74M\u6708D\u65E5 HH:mm", LLLL: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm", l: "D/M/YYYY", ll: "YYYY\u5E74M\u6708D\u65E5", lll: "YYYY\u5E74M\u6708D\u65E5 HH:mm", llll: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm" }, meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, meridiemHour: function (e, t) { return 12 === e && (e = 0), "\u51CC\u6668" === t || "\u65E9\u4E0A" === t || "\u4E0A\u5348" === t ? e : "\u4E2D\u5348" === t ? 11 <= e ? e : e + 12 : "\u4E0B\u5348" === t || "\u665A\u4E0A" === t ? e + 12 : void 0 }, meridiem: function (e, t) { var s = 100 * e + t; return 600 > s ? "\u51CC\u6668" : 900 > s ? "\u65E9\u4E0A" : 1130 > s ? "\u4E0A\u5348" : 1230 > s ? "\u4E2D\u5348" : 1800 > s ? "\u4E0B\u5348" : "\u665A\u4E0A" }, calendar: { sameDay: "[\u4ECA\u5929] LT", nextDay: "[\u660E\u5929] LT", nextWeek: "[\u4E0B]dddd LT", lastDay: "[\u6628\u5929] LT", lastWeek: "[\u4E0A]dddd LT", sameElse: "L" }, dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, ordinal: function (e, t) { return "d" === t || "D" === t || "DDD" === t ? e + "\u65E5" : "M" === t ? e + "\u6708" : "w" === t || "W" === t ? e + "\u9031" : e }, relativeTime: { future: "%s\u5167", past: "%s\u524D", s: "\u5E7E\u79D2", ss: "%d \u79D2", m: "1 \u5206\u9418", mm: "%d \u5206\u9418", h: "1 \u5C0F\u6642", hh: "%d \u5C0F\u6642", d: "1 \u5929", dd: "%d \u5929", M: "1 \u500B\u6708", MM: "%d \u500B\u6708", y: "1 \u5E74", yy: "%d \u5E74" } }),//! moment.js locale configuration e.defineLocale("zh-tw", { months: "\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u56DB\u6708_\u4E94\u6708_\u516D\u6708_\u4E03\u6708_\u516B\u6708_\u4E5D\u6708_\u5341\u6708_\u5341\u4E00\u6708_\u5341\u4E8C\u6708".split("_"), monthsShort: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"), weekdays: "\u661F\u671F\u65E5_\u661F\u671F\u4E00_\u661F\u671F\u4E8C_\u661F\u671F\u4E09_\u661F\u671F\u56DB_\u661F\u671F\u4E94_\u661F\u671F\u516D".split("_"), weekdaysShort: "\u9031\u65E5_\u9031\u4E00_\u9031\u4E8C_\u9031\u4E09_\u9031\u56DB_\u9031\u4E94_\u9031\u516D".split("_"), weekdaysMin: "\u65E5_\u4E00_\u4E8C_\u4E09_\u56DB_\u4E94_\u516D".split("_"), longDateFormat: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY\u5E74M\u6708D\u65E5", LLL: "YYYY\u5E74M\u6708D\u65E5 HH:mm", LLLL: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm", l: "YYYY/M/D", ll: "YYYY\u5E74M\u6708D\u65E5", lll: "YYYY\u5E74M\u6708D\u65E5 HH:mm", llll: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm" }, meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, meridiemHour: function (e, t) { return 12 === e && (e = 0), "\u51CC\u6668" === t || "\u65E9\u4E0A" === t || "\u4E0A\u5348" === t ? e : "\u4E2D\u5348" === t ? 11 <= e ? e : e + 12 : "\u4E0B\u5348" === t || "\u665A\u4E0A" === t ? e + 12 : void 0 }, meridiem: function (e, t) { var s = 100 * e + t; return 600 > s ? "\u51CC\u6668" : 900 > s ? "\u65E9\u4E0A" : 1130 > s ? "\u4E0A\u5348" : 1230 > s ? "\u4E2D\u5348" : 1800 > s ? "\u4E0B\u5348" : "\u665A\u4E0A" }, calendar: { sameDay: "[\u4ECA\u5929] LT", nextDay: "[\u660E\u5929] LT", nextWeek: "[\u4E0B]dddd LT", lastDay: "[\u6628\u5929] LT", lastWeek: "[\u4E0A]dddd LT", sameElse: "L" }, dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, ordinal: function (e, t) { return "d" === t || "D" === t || "DDD" === t ? e + "\u65E5" : "M" === t ? e + "\u6708" : "w" === t || "W" === t ? e + "\u9031" : e }, relativeTime: { future: "%s\u5F8C", past: "%s\u524D", s: "\u5E7E\u79D2", ss: "%d \u79D2", m: "1 \u5206\u9418", mm: "%d \u5206\u9418", h: "1 \u5C0F\u6642", hh: "%d \u5C0F\u6642", d: "1 \u5929", dd: "%d \u5929", M: "1 \u500B\u6708", MM: "%d \u500B\u6708", y: "1 \u5E74", yy: "%d \u5E74" } }), e.locale("en") })(K) -}); const Q = "1.8.1"; customElements.define("atomic-calendar-revive", class extends B { constructor() { super(), this.lastCalendarUpdateTime, this.lastEventsUpdateTime, this.lastHTMLUpdateTime, this.events, this.content = W(_templateObject()), this.shouldUpdateHtml = !0, this.errorMessage = "", this.modeToggle = 0, this.selectedMonth = K(), this.refreshCalEvents = null, this.monthToGet = K().format("MM"), this.month = [], this.showLoader = !1, this.eventSummary = W(_templateObject2()), this.firstrun = !0, this.language = "" } static get properties() { return { hass: {}, _config: {}, content: {}, selectedMonth: {} } } static async getConfigElement() { return await import("./atomic-calendar-revive-editor.js"), document.createElement("atomic-calendar-revive-editor") } static getStubConfig() { return { name: "Calendar Card", enableModeChange: !0 } } updated() { } render() { this.firstrun && console.info("%c atomic-calendar-revive %c Version: ".concat(Q, " "), "color: white; background: #484848; font-weight: 700;", "color: white; background: #cc5500; font-weight: 700;"), this.language = "" == this._config.language ? this.hass.language.toLowerCase() : this._config.language; let e = K.localeData(this.language).longDateFormat("LT"); return "12h" == this._config.hoursFormat ? e = "h:mm A" : "24h" == this._config.hoursFormat ? e = "H:mm" : "default" != this._config.hoursFormat && (e = this._config.hoursFormat), K.updateLocale(this.language, { week: { dow: this._config.firstDayOfWeek }, longDateFormat: { LT: e } }), this.firstrun = !1, this.isUpdating || 1 != this.modeToggle || (!this.lastEventsUpdateTime || 15 < K().diff(this.lastEventsUpdateTime, "minutes")) && (async () => { this.showLoader = !0, this.isUpdating = !0; try { this.events = await this.getEvents() } catch (e) { console.log(e), this.errorMessage = "The calendar can't be loaded from Home Assistant component", this.showLoader = !1 } this.lastEventsUpdateTime = K(), this.updateEventsHTML(this.events), this.isUpdating = !1, this.showLoader = !1 })(), 1 == this.modeToggle ? this.updateEventsHTML(this.events) : this.updateCalendarHTML(this.events), W(_templateObject3(), this.setStyle(), this._config.name || this._config.showDate || this.showLoader && this._config.showLoader ? W(_templateObject4(), this._config.name ? W(_templateObject5(), () => this.handleToggle(), this._config.name) : "", this.showLoader && this._config.showLoader ? W(_templateObject6()) : "", this._config.showDate ? W(_templateObject7(), this.getDate()) : "") : "", this.content) } firstTimeConfig() { } handleToggle() { this._config.enableModeChange && (this.modeToggle = 1 == this.modeToggle ? 2 : 1, this.requestUpdate()) } getDate() { const e = K().format(this._config.dateFormat); return W(_templateObject8(), e) } setConfig(e) { if (!(e = JSON.parse(JSON.stringify(e))).entities) throw new Error("Please define atomic-calendar-revive card entity"); this._config = { fullDayEventText: "All day", untilText: "Until", language: "", showColors: !0, maxDaysToShow: 7, maxEventCount: 0, showLoader: !0, showLocation: !0, showMonth: !1, showWeekDay: !1, fullTextTime: !0, showCurrentEventLine: !1, showDate: !1, dateFormat: "LL", hoursFormat: "default", startDaysAhead: 0, showLastCalendarWeek: !1, showCalNameInEvent: !1, sortByStartTime: !1, disableEventLink: !1, disableLocationLink: !1, linkTarget: "_blank", nameColor: "var(--primary-text-color)", dateColor: "var(--primary-text-color)", dateSize: 90, descColor: "var(--primary-text-color)", descSize: 80, showNoEventsForToday: !1, noEventsForTodayText: "No events for today", noEventsForNextDaysText: "No events in the next days", timeColor: "var(--primary-color)", timeSize: 90, showHours: !0, eventTitleColor: "var(--primary-text-color)", eventTitleSize: 100, locationIconColor: "rgb(--primary-text-color)", locationLinkColor: "var(--primary-text-color)", locationTextSize: 90, hideFinishedEvents: !1, dimFinishedEvents: !0, finishedEventOpacity: .6, finishedEventFilter: "grayscale(100%)", dayWrapperLineColor: "var(--primary-text-color)", eventBarColor: "var(--primary-color)", eventCalNameColor: "var(--primary-text-color)", eventCalNameSize: 90, showProgressBar: !0, showFullDayProgress: !1, progressBarColor: "var(--primary-color)", enableModeChange: !1, defaultMode: 1, calGridColor: "rgba(86, 86, 86, .35)", calDayColor: "var(--primary-text-color)", calWeekDayColor: "var(--primary-text-color)", calDateColor: "var(--primary-text-color)", defaultCalColor: "var(--primary-text-color)", calEventBackgroundColor: "rgba(86, 100, 86, .35)", calEventBackgroundFilter: null, calActiveEventBackgroundColor: "rgba(86, 128, 86, .35)", calActiveEventBackgroundFilter: null, calEventSatColor: "rgba(255, 255, 255, .05)", calEventSunColor: "rgba(255, 255, 255, .15)", calEventHolidayColor: "red", calEventHolidayFilter: null, calEventIcon1: "mdi:gift", calEventIcon1Color: "var(--primary-text-color)", calEventIcon1Filter: null, calEventIcon2: "mdi:home", calEventIcon2Color: "var(--primary-text-color)", calEventIcon2Filter: null, calEventIcon3: "mdi:star", calEventIcon3Color: "var(--primary-text-color)", calEventIcon3Filter: null, calEventTime: !1, firstDayOfWeek: 1, blacklist: null, whitelist: null, ...e }, this.modeToggle = this._config.defaultMode, "string" == typeof this._config.entities && (this._config.entities = [{ entity: e.entities }]), this._config.entities.forEach((e, t) => { "string" == typeof e && (this._config.entities[t] = { entity: e }) }) } setStyle() { return W(_templateObject9(), this._config.nameColor, this._config.eventBarColor, this._config.eventCalNameColor, this._config.eventCalNameSize, this._config.progressBarColor, this._config.progressBarColor, this._config.calGridColor, this._config.calDateColor) } shouldUpdate(e) { return function (e, t) { if (t.has("_config")) return !0; const a = t.get("hass"); return !a || a.states[e._config.entity] !== e.hass.states[e._config.entity] }(this, e) } getCardSize() { return this._config.entities.length + 1 } _toggle(e) { this.hass.callService("homeassistant", "toggle", { entity_id: e.entity_id }) } getTitleHTML(e) { const t = this._config.showCalNameInEvent ? e.eventClass.organizer.displayName + ": " + e.title : e.title, a = this._config.showColors && void 0 !== e._config.eventTitleColor ? e._config.eventTitleColor : this._config.eventTitleColor; return this._config.disableEventLink || null === e.link ? W(_templateObject10(), this._config.titleSize, a, t) : W(_templateObject11(), e.link, this._config.linkTarget, this._config.titleSize, a, t) } getCalTitleHTML(e) { const t = this._config.showColors && void 0 !== e._config.titleColor ? e._config.titleColor : this._config.eventTitleColor; return this._config.disableCalEventLink || null === e.htmlLink ? W(_templateObject12(), e.summary) : W(_templateObject13(), e.htmlLink, t, this._config.linkTarget, e.summary) } getHoursHTML(e) { const t = K(); return e.isEmpty ? W(_templateObject14()) : e.isFullOneDayEvent || e.isFullMoreDaysEvent && K(e.endTime).isSame(t, "day") ? W(_templateObject15(), this._config.fullDayEventText) : e.isFullMoreDaysEvent || e.isFullMoreDaysEvent && (K(e.startTime).isBefore(t, "day") || K(e.endTime).isAfter(t, "day")) ? W(_templateObject16(), this._config.fullDayEventText, this._config.untilText.toLowerCase(), this.getCurrDayAndMonth(K(e.endTime))) : K(e.startTime).isBefore(t, "day") && K(e.endTime).isAfter(t, "day") ? W(_templateObject17(), this._config.untilText, this.getCurrDayAndMonth(K(e.endTime))) : K(e.startTime).isBefore(t, "day") && K(e.endTime).isSame(t, "day") ? W(_templateObject18(), this._config.untilText, e.endTime.format("LT")) : !K(e.startTime).isBefore(t, "day") && K(e.endTime).isAfter(e.startTime, "day") ? W(_templateObject19(), e.startTime.format("LT"), this._config.untilText.toLowerCase(), this.getCurrDayAndMonth(K(e.endTime))) : W(_templateObject20(), e.startTime.format("LT"), e.endTime.format("LT")) } getLocationHTML(e) { return e.location && this._config.showLocation ? this._config.disableLocationLink ? W(_templateObject21(), this._config.locationIconColor, e.address) : W(_templateObject22(), e.location, this._config.linkTarget, this._config.locationLinkColor, this._config.locationTextSize, this._config.locationIconColor, e.address) : W(_templateObject23()) } getCalLocationHTML(e) { return e.location && this._config.showLocation && !this._config.disableCalLocationLink ? W(_templateObject24(), e.location, this._config.linkTarget, this._config.locationLinkColor, this._config.locationTextSize, this._config.locationIconColor) : W(_templateObject25()) } updateEventsHTML(e) { var t; if (!e) this.content = W(_templateObject33(), this.errorMessage); else if (0 != e.length) { if (K(e[0][0]).isSame(K(), "day") && 1 < e[0].length) for (var a = 1; a < e[0].length;)e[0][a].isEventFinished && !e[0][a - 1].isEventFinished ? ([e[0][a], e[0][a - 1]] = [e[0][a - 1], e[0][a]], 1 < a && a--) : a++; if (this._config.showNoEventsForToday && K(e[0][0].startTime).isAfter(K(), "day") && 0 < e[0].length) { var s = { eventClass: "", config: "", start: { dateTime: K().endOf("day") }, end: { dateTime: K().endOf("day") }, summary: this._config.noEventsForTodayText, isFinished: !1, htmlLink: "https://calendar.google.com/calendar/r/day?sf=true" }, n = new ee(s, ""); n.isEmpty = !0; var r = []; r[0] = n, e.unshift(r) } t = e.map((e, t) => e.map((e, a, s) => { const n = 0 == a && 0 < t ? "daywrap" : "", r = 0 == t && K(e.startTime).isAfter(K()) && (0 == a || !K(s[a - 1].startTime).isAfter(K())), i = this._config.showCurrentEventLine && r ? W(_templateObject26(), this._config.eventBarColor) : "", d = e._config.eventCalName ? W(_templateObject27(), e._config.eventCalName) : ""; var o = ""; if (0 == t && (e.isEventRunning && this._config.showFullDayProgress && e.isFullDayEvent || e.isEventRunning && !e.isFullDayEvent && this._config.showProgressBar)) { let t = e.endTime.diff(e.startTime, "minutes"), a = K().diff(e.startTime, "minutes"), s = Math.floor(100 * a / t); o = W(_templateObject28(), s, s) } var _ = e.isEventFinished && this._config.dimFinishedEvents ? "opacity: " + this._config.finishedEventOpacity + "; filter: " + this._config.finishedEventFilter + ";" : ""; const l = this._config.showHours ? W(_templateObject29(), this._config.timeColor, this._config.timeSize, this.getHoursHTML(e)) : "", m = this._config.showDescription ? W(_templateObject30(), this._config.descColor, this._config.descSize, e.description) : "", u = a == s.length - 1 ? "padding-bottom: 8px;" : ""; return W(_templateObject31(), n, this._config.dayWrapperLineColor, this._config.dateColor, this._config.dateSize, 0 === a && this._config.showMonth ? e.startTimeToShow.format("MMM") : "", 0 === a ? e.startTimeToShow.format("DD") : "", 0 === a && this._config.showWeekDay ? e.startTimeToShow.format("ddd") : "", _, u, i, this.getTitleHTML(e), l, this.getLocationHTML(e), d, m, o) })), this.content = W(_templateObject32(), t) } else this.content = this._config.noEventsForNextDaysText } getCurrDayAndMonth(e) { return e.format("LL").replace(e.format("YYYY"), "").replace(/\s\s+/g, " ").trim().replace(/[??]\./, "").replace(/de$/, "").replace(/b\.$/, "").trim().replace(/,$/g, "") } checkFilter(e, t) { return !(void 0 === t || "" == t) && t.split(",").some(t => !!RegExp("(?:^|\\s)" + t.trim(), "i").test(e)) } async getEvents() { let e = -K().utcOffset(), t = K().add(this._config.startDaysAhead, "days").startOf("day").add(e, "minutes").format("YYYY-MM-DDTHH:mm:ss"), a = K().add(this._config.maxDaysToShow + this._config.startDaysAhead, "days").endOf("day").add(e, "minutes").format("YYYY-MM-DDTHH:mm:ss"), s = []; this._config.entities.map(e => { s.push(["calendars/".concat(e.entity, "?start=").concat(t, "Z&end=").concat(a, "Z")]) }); try { return await Promise.all(s.map(e => this.hass.callApi("get", e[0]))).then(e => { let t = [], a = 0; e.map((e, s) => { e.map(e => { let n = void 0 === this._config.entities[s].blacklist ? "" : this._config.entities[s].blacklist, r = void 0 === this._config.entities[s].whitelist ? "" : this._config.entities[s].whitelist, i = new ee(e, this._config.entities[s]); !(0 === this._config.maxEventCount || a < this._config.maxEventCount) || "" != n && this.checkFilter(e.summary, n) || "" != r && !this.checkFilter(e.summary, r) || (0 !== this._config.maxDaysToShow || !i.isEventRunning) && this._config.hideFinishedEvents && i.isEventFinished || (t.push(i), a++) }) }), this._config.sortByStartTime && t.sort(function (e, t) { return K(e.startTime).diff(K(t.startTime)) }); const s = [].concat.apply([], t).reduce(function (e, t) { return e[t.daysToSort] = e[t.daysToSort] || [], e[t.daysToSort].push(t), e }, {}), n = Object.keys(s).map(function (e) { return s[e] }); return this.showLoader = !1, n }) } catch (e) { throw this.showLoader = !1, e } } getCalendarEvents(e, t, a, s) { this.refreshCalEvents = !1; let n = new Date().getTimezoneOffset(), r = K(e).startOf("day").add(n, "minutes").format("YYYY-MM-DDTHH:mm:ss"), i = K(t).endOf("day").add(n, "minutes").format("YYYY-MM-DDTHH:mm:ss"), d = []; this._config.entities.map(e => { void 0 !== e.type && d.push(["calendars/".concat(e.entity, "?start=").concat(r, "Z&end=").concat(i, "Z"), e.type, void 0 === e.blacklist ? "" : e.blacklist, void 0 === e.whitelist ? "" : e.whitelist, void 0 === e.color ? this._config.defaultCalColor : e.color]) }), Promise.all(d.map(e => this.hass.callApi("get", e[0]))).then(e => { a == this.monthToGet && e.map((e, t) => (this.month.map(a => { const s = d[t][1], n = d[t][0], r = void 0 === d[t][2] ? "" : d[t][2], i = (void 0 !== d[t][3] && d[t][3], void 0 === d[t][4] ? this._config.defaultCalColor : d[t][4]); e.filter(e => { const t = e.start.dateTime ? K(e.start.dateTime) : K(e.start.date).startOf("day"), n = e.end.dateTime ? K(e.end.dateTime) : K(e.end.date).subtract(1, "days").endOf("day"); if (!K(t).isAfter(a.date, "day") && !K(n).isBefore(a.date, "day") && s && !this.checkFilter(e.summary, r)) return e }).map(e => (e.isFullDayEvent = !(e.start.dateTime || e.end.dateTime), e._config = { color: i, titleColor: this._config.eventTitleColor }, a.allEvents.push(e))), e.map(e => { const t = e.start.dateTime ? K(e.start.dateTime) : K(e.start.date).startOf("day"), i = e.end.dateTime ? K(e.end.dateTime) : K(e.end.date).subtract(1, "days").endOf("day"); if (!K(t).isAfter(a.date, "day") && !K(i).isBefore(a.date, "day") && s && !this.checkFilter(e.summary, r)) try { this.checkFilter("icon1", s) && (this._config.calEventIcon1Filter && !this.checkFilter(e.summary, this._config.calEventIcon1Filter) || a.icon1.push(e.summary)), this.checkFilter("icon2", s) && (this._config.calEventIcon2Filter && !this.checkFilter(e.summary, this._config.calEventIcon2Filter) || a.icon2.push(e.summary)), this.checkFilter("icon3", s) && (this._config.calEventIcon3Filter && !this.checkFilter(e.summary, this._config.calEventIcon3Filter) || a.icon3.push(e.summary)), this.checkFilter("holiday", s) && a.holiday.push(e.summary) } catch (e) { console.log("error: ", e, n) } }) }), s)), a == this.monthToGet && (this.showLoader = !1), this.refreshCalEvents = !1, this.requestUpdate() }).catch(e => { this.refreshCalEvents = !1, console.log("error: ", e), this.showLoader = !1 }) } buildCalendar(e) { const t = K(e).startOf("month"), a = t.day(); this.month = []; let s = 0; s = 0 <= a - this._config.firstDayOfWeek ? 0 : 7; for (var n = this._config.firstDayOfWeek - a - s; n < 42 - a + this._config.firstDayOfWeek - s; n++)this.month.push(new X(K(t).add(n, "days"), n)) } handleMonthChange(e) { this.selectedMonth = K(this.selectedMonth).add(e, "months"), this.monthToGet = this.selectedMonth.format("M"), this.eventSummary = W(_templateObject34()), this.refreshCalEvents = !0 } handleEventSummary(e) { [","].concat.apply([], [e.holiday, e.daybackground, e.icon1, e.icon2, e.icon3]), this.clickedDate = e.date, e._allEvents.sort(function (e, t) { const a = e.start.dateTime ? K(e.start.dateTime) : K(e.start.date).startOf("day"), s = t.start.dateTime ? K(t.start.dateTime) : K(t.start.date).startOf("day"); return K(a).diff(K(s)) }), this.eventSummary = e._allEvents.map(e => { const s = this._config.showColors && void 0 !== e._config.titleColor ? e._config.titleColor : this._config.eventTitleColor, n = this._config.showColors && void 0 !== e._config.color ? e._config.color : this._config.defaultCalColor; if (e.isFullDayEvent) return W(_templateObject35(), n, this.getCalTitleHTML(e), this.getCalLocationHTML(e)); { const t = this._config.showHours ? K(e.start.dateTime).format("LT") : ""; return W(_templateObject36(), n, s, t, this.getCalTitleHTML(e), this.getCalLocationHTML(e)) } }), this.requestUpdate() } getCalendarHeaderHTML() { return W(_templateObject37(), () => this.handleMonthChange(-1), K(this.selectedMonth).format("YYYY"), K(this.selectedMonth).format("MM"), this._config.calDateColor, this._config.linkTarget, K(this.selectedMonth).locale(this.language).format("MMMM"), K(this.selectedMonth).format("YYYY"), () => this.handleMonthChange(1)) } getCalendarDaysHTML(e) { var t = !0; return this._config.showLastCalendarWeek || K(e[35].date).isSame(this.selectedMonth, "month") || (t = !1), e.map((e, a) => { const s = K(e.date).isSame(K(this.selectedMonth), "month") ? "" : "opacity: .35;", n = K(e.date).isSame(K(), "day") ? "background-color: ".concat(this._config.calEventBackgroundColor, ";") : "", r = e.holiday && 0 < e.holiday.length ? "color: ".concat(this._config.calEventHolidayColor, ";") : "", i = 6 == K(e.date).isoWeekday() ? "background-color: ".concat(this._config.calEventSatColor, ";") : "", d = 7 == K(e.date).isoWeekday() ? "background-color: ".concat(this._config.calEventSunColor, ";") : "", o = K(e.date).isSame(K(this.clickedDate), "day") ? "background-color: ".concat(this._config.calActiveEventBackgroundColor, ";") : "", _ = e.icon1 && 0 < e.icon1.length ? W(_templateObject38(), this._config.calEventIcon1Color, this._config.calEventIcon1) : "", l = e.icon2 && 0 < e.icon2.length ? W(_templateObject39(), this._config.calEventIcon2Color, this._config.calEventIcon2) : "", m = e.icon3 && 0 < e.icon3.length ? W(_templateObject40(), this._config.calEventIcon3Color, this._config.calEventIcon3) : ""; if (35 > a || t) return W(_templateObject41(), 0 == a % 7 ? W(_templateObject42()) : "", () => this.handleEventSummary(e), this._config.calDayColor, s, n, r, i, d, o, e.dayNumber.replace(/^0|[^/]0./, ""), _, l, m, a && 0 == a % 6 ? W(_templateObject43()) : "") }) } updateCalendarHTML() { (0 == this.month.length || this.refreshCalEvents || 120 < K().diff(this.lastCalendarUpdateTime, "minutes")) && (this.lastCalendarUpdateTime = K(), this.showLoader = !0, this.buildCalendar(this.selectedMonth), this.getCalendarEvents(this.month[0].date, this.month[41].date, this.monthToGet, this.month), this.showLoader = !1); const e = this.month, t = K.weekdaysMin(!0).map(e => W(_templateObject44(), this._config.calWeekDayColor, e)); this.content = W(_templateObject45(), this.getCalendarHeaderHTML(), this._config.eventTitleColor, t, this.getCalendarDaysHTML(e), this.eventSummary) } }); class X { constructor(e, t) { this.calendarDay = e, this._lp = t, this.ymd = K(e).format("YYYY-MM-DD"), this._holiday = [], this._icon1 = [], this._icon2 = [], this._icon3 = [], this._allEvents = [], this._daybackground = [] } get date() { return K(this.calendarDay) } get dayNumber() { return K(this.calendarDay).format("DD") } get monthNumber() { return K(this.calendarDay).month() } set holiday(e) { this._holiday = e } get holiday() { return this._holiday } set icon1(e) { this._icon1 = e } get icon1() { return this._icon1 } set icon2(e) { this._icon2 = e } get icon2() { return this._icon2 } set allEvents(e) { this._allEvents = e } get allEvents() { return this._allEvents } set icon3(e) { this._icon3 = e } get icon3() { return this._icon3 } set daybackground(e) { this._daybackground = e } get daybackground() { return this._daybackground } } class ee { constructor(e, t) { this.eventClass = e, this._config = t, this._startTime = this.eventClass.start.dateTime ? K(this.eventClass.start.dateTime) : K(this.eventClass.start.date).startOf("day"), this._endTime = this.eventClass.end.dateTime ? K(this.eventClass.end.dateTime) : K(this.eventClass.end.date).subtract(1, "days").endOf("day"), this.isFinished = !1, this.isEmpty = !1 } get titleColor() { return this._config.eventTitleColor ? this._config.eventTitleColor : "var(--primary-text-color)" } get title() { return this.eventClass.summary } get description() { return this.eventClass.description } get startTime() { return this._startTime } get startTimeToShow() { var e = this.eventClass.start.dateTime ? K(this.eventClass.start.dateTime) : K(this.eventClass.start.date).startOf("day"); return K(e).isBefore(K().startOf("day")) ? K().startOf("day") : e } get endTime() { return this._endTime } get isFullDayEvent() { return !this.eventClass.start.dateTime && !this.eventClass.end.dateTime } get isFullOneDayEvent() { return !!(!this.eventClass.start.dateTime && !this.eventClass.end.dateTime && K(this.eventClass.start.date).isSame(K(this.eventClass.end.date).subtract(1, "days"), "day") || K(this.eventClass.start.dateTime).isSame(K(this.eventClass.start.dateTime).startOf("day")) && K(this.eventClass.end.dateTime).isSame(K(this.eventClass.end.dateTime).startOf("day")) && K(this.eventClass.start.dateTime).isSame(K(this.eventClass.end.dateTime).subtract(1, "days"), "day")) } get isFullMoreDaysEvent() { return !((this.eventClass.start.dateTime || this.eventClass.end.dateTime || K(this.eventClass.start.date).isSame(K(this.eventClass.end.date).subtract(1, "days"), "day")) && !(K(this.eventClass.start.dateTime).isSame(K(this.eventClass.start.dateTime).startOf("day")) && K(this.eventClass.end.dateTime).isSame(K(this.eventClass.end.dateTime).startOf("day")) && K(this.eventClass.end.dateTime).isAfter(K(this.eventClass.start.dateTime).subtract(1, "days"), "day"))) } get daysToSort() { return K(this.startTimeToShow).format("YYYYMMDD") } get isEventRunning() { return K(this.startTime).isBefore(K()) && K(this.endTime).isAfter(K()) } get isEventFinished() { return K(this.endTime).isBefore(K()) } get location() { return this.eventClass.location ? this.eventClass.location.split(" ").join("+") : "" } get address() { return this.eventClass.location ? this.eventClass.location.split(",")[0] : "" } get link() { return this.eventClass.htmlLink } } window.customCards = window.customCards || [], window.customCards.push({ type: "atomic-calendar-revive", name: "Atomic Calendar Revive", preview: !1, description: "An advanced calendar card for Home Assistant with Lovelace." }); +}); const Q = "1.8.5"; customElements.define("atomic-calendar-revive", class extends B { constructor() { super(), this.lastCalendarUpdateTime, this.lastEventsUpdateTime, this.lastHTMLUpdateTime, this.events, this.content = W(_templateObject()), this.shouldUpdateHtml = !0, this.errorMessage = "", this.modeToggle = 0, this.selectedMonth = K(), this.refreshCalEvents = null, this.monthToGet = K().format("MM"), this.month = [], this.showLoader = !1, this.eventSummary = W(_templateObject2()), this.firstrun = !0, this.language = "" } static get properties() { return { hass: {}, _config: {}, content: {}, selectedMonth: {} } } static async getConfigElement() { return await import("./atomic-calendar-revive-editor.js"), document.createElement("atomic-calendar-revive-editor") } static getStubConfig() { return { name: "Calendar Card", enableModeChange: !0 } } updated() { } render() { this.firstrun && console.info("%c atomic-calendar-revive %c Version: ".concat(Q, " "), "color: white; background: #484848; font-weight: 700;", "color: white; background: #cc5500; font-weight: 700;"), this.language = "" == this._config.language ? this.hass.language.toLowerCase() : this._config.language; let e = K.localeData(this.language).longDateFormat("LT"); return "12h" == this._config.hoursFormat ? e = "h:mm A" : "24h" == this._config.hoursFormat ? e = "H:mm" : "default" != this._config.hoursFormat && (e = this._config.hoursFormat), K.updateLocale(this.language, { week: { dow: this._config.firstDayOfWeek }, longDateFormat: { LT: e } }), this.firstrun = !1, this.isUpdating || 1 != this.modeToggle || (!this.lastEventsUpdateTime || 15 < K().diff(this.lastEventsUpdateTime, "minutes")) && (async () => { this.showLoader = !0, this.isUpdating = !0; try { this.events = await this.getEvents() } catch (e) { console.log(e), this.errorMessage = "The calendar can't be loaded from Home Assistant component", this.showLoader = !1 } this.lastEventsUpdateTime = K(), this.updateEventsHTML(this.events), this.isUpdating = !1, this.showLoader = !1 })(), 1 == this.modeToggle ? this.updateEventsHTML(this.events) : this.updateCalendarHTML(this.events), W(_templateObject3(), this.setStyle(), this._config.name || this._config.showDate || this.showLoader && this._config.showLoader ? W(_templateObject4(), this._config.name ? W(_templateObject5(), () => this.handleToggle(), this._config.name) : "", this.showLoader && this._config.showLoader ? W(_templateObject6()) : "", this._config.showDate ? W(_templateObject7(), this.getDate()) : "") : "", this.content) } firstTimeConfig() { } handleToggle() { this._config.enableModeChange && (this.modeToggle = 1 == this.modeToggle ? 2 : 1, this.requestUpdate()) } getDate() { const e = K().format(this._config.dateFormat); return W(_templateObject8(), e) } setConfig(e) { if (!(e = JSON.parse(JSON.stringify(e))).entities) throw new Error("Please define atomic-calendar-revive card entity"); this._config = { fullDayEventText: "All day", untilText: "Until", language: "", maxDaysToShow: 7, maxEventCount: 0, showLoader: !0, showLocation: !0, showMonth: !1, showWeekDay: !1, fullTextTime: !0, showCurrentEventLine: !1, showDate: !1, dateFormat: "LL", hoursFormat: "default", startDaysAhead: 0, showLastCalendarWeek: !1, showCalNameInEvent: !1, sortByStartTime: !1, disableEventLink: !1, disableLocationLink: !1, linkTarget: "_blank", nameColor: "var(--primary-text-color)", dateColor: "var(--primary-text-color)", dateSize: 90, descColor: "var(--primary-text-color)", descSize: 80, showNoEventsForToday: !1, noEventsForTodayText: "No events for today", noEventsForNextDaysText: "No events in the next days", timeColor: "var(--primary-color)", timeSize: 90, showHours: !0, eventTitleColor: "var(--primary-text-color)", eventTitleSize: 100, locationIconColor: "rgb(--primary-text-color)", locationLinkColor: "var(--primary-text-color)", locationTextSize: 90, hideFinishedEvents: !1, dimFinishedEvents: !0, finishedEventOpacity: .6, finishedEventFilter: "grayscale(100%)", dayWrapperLineColor: "var(--primary-text-color)", eventBarColor: "var(--primary-color)", eventCalNameColor: "var(--primary-text-color)", eventCalNameSize: 90, showProgressBar: !0, showFullDayProgress: !1, progressBarColor: "var(--primary-color)", enableModeChange: !1, defaultMode: 1, calGridColor: "rgba(86, 86, 86, .35)", calDayColor: "var(--primary-text-color)", calWeekDayColor: "var(--primary-text-color)", calDateColor: "var(--primary-text-color)", defaultCalColor: "var(--primary-text-color)", calEventBackgroundColor: "rgba(86, 100, 86, .35)", calEventBackgroundFilter: null, calActiveEventBackgroundColor: "rgba(86, 128, 86, .35)", calActiveEventBackgroundFilter: null, calEventSatColor: "rgba(255, 255, 255, .05)", calEventSunColor: "rgba(255, 255, 255, .15)", calEventHolidayColor: "red", calEventHolidayFilter: null, calEventIcon1: "mdi:gift", calEventIcon1Color: "var(--primary-text-color)", calEventIcon1Filter: null, calEventIcon2: "mdi:home", calEventIcon2Color: "var(--primary-text-color)", calEventIcon2Filter: null, calEventIcon3: "mdi:star", calEventIcon3Color: "var(--primary-text-color)", calEventIcon3Filter: null, calEventTime: !1, firstDayOfWeek: 1, blacklist: null, whitelist: null, ...e }, this.modeToggle = this._config.defaultMode, "string" == typeof this._config.entities && (this._config.entities = [{ entity: e.entities }]), this._config.entities.forEach((e, t) => { "string" == typeof e && (this._config.entities[t] = { entity: e }) }) } setStyle() { return W(_templateObject9(), this._config.nameColor, this._config.eventTitleSize, this._config.locationIconColor, this._config.locationLinkColor, this._config.locationTextSize, this._config.eventBarColor, this._config.eventCalNameColor, this._config.eventCalNameSize, this._config.progressBarColor, this._config.progressBarColor, this._config.calGridColor, this._config.calDateColor) } shouldUpdate(e) { return function (e, t) { if (t.has("_config")) return !0; const a = t.get("hass"); return !a || a.states[e._config.entity] !== e.hass.states[e._config.entity] }(this, e) } getCardSize() { return this._config.entities.length + 1 } _toggle(e) { this.hass.callService("homeassistant", "toggle", { entity_id: e.entity_id }) } getTitleHTML(e) { const t = this._config.showCalNameInEvent ? e.eventClass.organizer.displayName + ": " + e.title : e.title, a = void 0 === e._config.eventTitleColor ? this._config.eventTitleColor : e._config.eventTitleColor; return this._config.disableEventLink || null === e.link ? W(_templateObject10(), a, t) : W(_templateObject11(), e.link, this._config.linkTarget, a, t) } getCalTitleHTML(e) { const t = void 0 === e._config.titleColor ? this._config.eventTitleColor : e._config.titleColor; return this._config.disableCalEventLink || null === e.htmlLink ? W(_templateObject12(), e.summary) : W(_templateObject13(), e.htmlLink, t, this._config.linkTarget, e.summary) } getHoursHTML(e) { const t = K(); return e.isEmpty ? W(_templateObject14()) : e.isFullOneDayEvent || e.isFullMoreDaysEvent && K(e.endTime).isSame(t, "day") ? W(_templateObject15(), this._config.fullDayEventText) : e.isFullMoreDaysEvent || e.isFullMoreDaysEvent && (K(e.startTime).isBefore(t, "day") || K(e.endTime).isAfter(t, "day")) ? W(_templateObject16(), this._config.fullDayEventText, this._config.untilText.toLowerCase(), this.getCurrDayAndMonth(K(e.endTime))) : K(e.startTime).isBefore(t, "day") && K(e.endTime).isAfter(t, "day") ? W(_templateObject17(), this._config.untilText, this.getCurrDayAndMonth(K(e.endTime))) : K(e.startTime).isBefore(t, "day") && K(e.endTime).isSame(t, "day") ? W(_templateObject18(), this._config.untilText, e.endTime.format("LT")) : !K(e.startTime).isBefore(t, "day") && K(e.endTime).isAfter(e.startTime, "day") ? W(_templateObject19(), e.startTime.format("LT"), this._config.untilText.toLowerCase(), this.getCurrDayAndMonth(K(e.endTime))) : W(_templateObject20(), e.startTime.format("LT"), e.endTime.format("LT")) } getLocationHTML(e) { return e.location && this._config.showLocation ? this._config.disableLocationLink ? W(_templateObject21(), e.address) : W(_templateObject22(), e.location, this._config.linkTarget, e.address) : W(_templateObject23()) } getCalLocationHTML(e) { return e.location && this._config.showLocation && !this._config.disableCalLocationLink ? W(_templateObject24(), e.location, this._config.linkTarget) : W(_templateObject25()) } updateEventsHTML(e) { var t; if (!e) this.content = W(_templateObject33(), this.errorMessage); else if (0 != e.length) { if (K(e[0][0]).isSame(K(), "day") && 1 < e[0].length) for (var a = 1; a < e[0].length;)e[0][a].isEventFinished && !e[0][a - 1].isEventFinished ? ([e[0][a], e[0][a - 1]] = [e[0][a - 1], e[0][a]], 1 < a && a--) : a++; if (this._config.showNoEventsForToday && K(e[0][0].startTime).isAfter(K(), "day") && 0 < e[0].length) { var s = { eventClass: "", config: "", start: { dateTime: K().endOf("day") }, end: { dateTime: K().endOf("day") }, summary: this._config.noEventsForTodayText, isFinished: !1, htmlLink: "https://calendar.google.com/calendar/r/day?sf=true" }, n = new ee(s, ""); n.isEmpty = !0; var r = []; r[0] = n, e.unshift(r) } t = e.map((e, t) => e.map((e, a, s) => { const n = 0 == a && 0 < t ? "daywrap" : "", r = 0 == t && K(e.startTime).isAfter(K()) && (0 == a || !K(s[a - 1].startTime).isAfter(K())), i = this._config.showCurrentEventLine && r ? W(_templateObject26(), this._config.eventBarColor) : "", d = e._config.eventCalName ? W(_templateObject27(), e._config.eventCalName) : ""; var o = ""; if (0 == t && (e.isEventRunning && this._config.showFullDayProgress && e.isFullDayEvent || e.isEventRunning && !e.isFullDayEvent && this._config.showProgressBar)) { let t = e.endTime.diff(e.startTime, "minutes"), a = K().diff(e.startTime, "minutes"), s = Math.floor(100 * a / t); o = W(_templateObject28(), s, s) } var _ = e.isEventFinished && this._config.dimFinishedEvents ? "opacity: " + this._config.finishedEventOpacity + "; filter: " + this._config.finishedEventFilter + ";" : ""; const l = this._config.showHours ? W(_templateObject29(), this._config.timeColor, this._config.timeSize, this.getHoursHTML(e)) : "", m = this._config.showDescription ? W(_templateObject30(), this._config.descColor, this._config.descSize, e.description) : "", u = a == s.length - 1 ? "padding-bottom: 8px;" : ""; return W(_templateObject31(), n, this._config.dayWrapperLineColor, this._config.dateColor, this._config.dateSize, 0 === a && this._config.showMonth ? e.startTimeToShow.format("MMM") : "", 0 === a ? e.startTimeToShow.format("DD") : "", 0 === a && this._config.showWeekDay ? e.startTimeToShow.format("ddd") : "", _, u, i, this.getTitleHTML(e), l, this.getLocationHTML(e), d, m, o) })), this.content = W(_templateObject32(), t) } else this.content = this._config.noEventsForNextDaysText } getCurrDayAndMonth(e) { return e.format("LL").replace(e.format("YYYY"), "").replace(/\s\s+/g, " ").trim().replace(/[??]\./, "").replace(/de$/, "").replace(/b\.$/, "").trim().replace(/,$/g, "") } checkFilter(e, t) { return !(void 0 === t || "" == t) && t.split(",").some(t => !!RegExp("(?:^|\\s)" + t.trim(), "i").test(e)) } async getEvents() { let e = -K().utcOffset(), t = K().add(this._config.startDaysAhead, "days").startOf("day").add(e, "minutes").format("YYYY-MM-DDTHH:mm:ss"), a = K().add(this._config.maxDaysToShow + this._config.startDaysAhead, "days").endOf("day").add(e, "minutes").format("YYYY-MM-DDTHH:mm:ss"), s = []; this._config.entities.map(e => { s.push(["calendars/".concat(e.entity, "?start=").concat(t, "Z&end=").concat(a, "Z")]) }); try { return await Promise.all(s.map(e => this.hass.callApi("get", e[0]))).then(e => { let t = [], a = 0; e.map((e, s) => { e.map(e => { let n = void 0 === this._config.entities[s].blacklist ? "" : this._config.entities[s].blacklist, r = void 0 === this._config.entities[s].whitelist ? "" : this._config.entities[s].whitelist, i = new ee(e, this._config.entities[s]); !(0 === this._config.maxEventCount || a < this._config.maxEventCount) || "" != n && this.checkFilter(e.summary, n) || "" != r && !this.checkFilter(e.summary, r) || (0 !== this._config.maxDaysToShow || !i.isEventRunning) && this._config.hideFinishedEvents && i.isEventFinished || (t.push(i), a++) }) }), this._config.sortByStartTime && t.sort(function (e, t) { return K(e.startTime).diff(K(t.startTime)) }); const s = [].concat.apply([], t).reduce(function (e, t) { return e[t.daysToSort] = e[t.daysToSort] || [], e[t.daysToSort].push(t), e }, {}), n = Object.keys(s).map(function (e) { return s[e] }); return this.showLoader = !1, n }) } catch (e) { throw this.showLoader = !1, e } } getCalendarEvents(e, t, a, s) { this.refreshCalEvents = !1; let n = new Date().getTimezoneOffset(), r = K(e).startOf("day").add(n, "minutes").format("YYYY-MM-DDTHH:mm:ss"), i = K(t).endOf("day").add(n, "minutes").format("YYYY-MM-DDTHH:mm:ss"), d = []; this._config.entities.map(e => { void 0 !== e.type && d.push(["calendars/".concat(e.entity, "?start=").concat(r, "Z&end=").concat(i, "Z"), e.type, void 0 === e.blacklist ? "" : e.blacklist, void 0 === e.whitelist ? "" : e.whitelist, void 0 === e.color ? this._config.defaultCalColor : e.color]) }), Promise.all(d.map(e => this.hass.callApi("get", e[0]))).then(e => { a == this.monthToGet && e.map((e, t) => (this.month.map(a => { const s = d[t][1], n = d[t][0], r = void 0 === d[t][2] ? "" : d[t][2], i = (void 0 !== d[t][3] && d[t][3], void 0 === d[t][4] ? this._config.defaultCalColor : d[t][4]); e.filter(e => { const t = e.start.dateTime ? K(e.start.dateTime) : K(e.start.date).startOf("day"), n = e.end.dateTime ? K(e.end.dateTime) : K(e.end.date).subtract(1, "days").endOf("day"); if (!K(t).isAfter(a.date, "day") && !K(n).isBefore(a.date, "day") && s && !this.checkFilter(e.summary, r)) return e }).map(e => (e.isFullDayEvent = !(e.start.dateTime || e.end.dateTime), e.isEventFinished = !K(this.endTime).isBefore(K()), e._config = { color: i, titleColor: this._config.eventTitleColor }, a.allEvents.push(e))), e.map(e => { const t = e.start.dateTime ? K(e.start.dateTime) : K(e.start.date).startOf("day"), i = e.end.dateTime ? K(e.end.dateTime) : K(e.end.date).subtract(1, "days").endOf("day"); if (!K(t).isAfter(a.date, "day") && !K(i).isBefore(a.date, "day") && s && !this.checkFilter(e.summary, r)) try { this.checkFilter("icon1", s) && (this._config.calEventIcon1Filter && !this.checkFilter(e.summary, this._config.calEventIcon1Filter) || a.icon1.push(e.summary)), this.checkFilter("icon2", s) && (this._config.calEventIcon2Filter && !this.checkFilter(e.summary, this._config.calEventIcon2Filter) || a.icon2.push(e.summary)), this.checkFilter("icon3", s) && (this._config.calEventIcon3Filter && !this.checkFilter(e.summary, this._config.calEventIcon3Filter) || a.icon3.push(e.summary)), this.checkFilter("holiday", s) && a.holiday.push(e.summary) } catch (e) { console.log("error: ", e, n) } }) }), s)), a == this.monthToGet && (this.showLoader = !1), this.refreshCalEvents = !1, this.requestUpdate() }).catch(e => { this.refreshCalEvents = !1, console.log("error: ", e), this.showLoader = !1 }) } buildCalendar(e) { const t = K(e).startOf("month"), a = t.day(); this.month = []; let s = 0; s = 0 <= a - this._config.firstDayOfWeek ? 0 : 7; for (var n = this._config.firstDayOfWeek - a - s; n < 42 - a + this._config.firstDayOfWeek - s; n++)this.month.push(new X(K(t).add(n, "days"), n)) } handleMonthChange(e) { this.selectedMonth = K(this.selectedMonth).add(e, "months"), this.monthToGet = this.selectedMonth.format("M"), this.eventSummary = W(_templateObject34()), this.refreshCalEvents = !0 } handleEventSummary(e) { [","].concat.apply([], [e.holiday, e.daybackground, e.icon1, e.icon2, e.icon3]), this.clickedDate = e.date, e._allEvents.sort(function (e, t) { const a = e.start.dateTime ? K(e.start.dateTime) : K(e.start.date).startOf("day"), s = t.start.dateTime ? K(t.start.dateTime) : K(t.start.date).startOf("day"); return K(a).diff(K(s)) }), this.eventSummary = e._allEvents.map(e => { const s = void 0 === e._config.titleColor ? this._config.eventTitleColor : e._config.titleColor, n = void 0 === e._config.color ? this._config.defaultCalColor : e._config.color; var r = e.isEventFinished && this._config.dimFinishedEvents ? "opacity: " + this._config.finishedEventOpacity + "; filter: " + this._config.finishedEventFilter + ";" : ""; if (e.isFullDayEvent) return W(_templateObject35(), n, r, this.getCalTitleHTML(e), this.getCalLocationHTML(e)); { const t = this._config.showHours ? K(e.start.dateTime).format("LT") : ""; return W(_templateObject36(), r, n, s, t, this.getCalTitleHTML(e), this.getCalLocationHTML(e)) } }), this.requestUpdate() } getCalendarHeaderHTML() { return W(_templateObject37(), () => this.handleMonthChange(-1), K(this.selectedMonth).format("YYYY"), K(this.selectedMonth).format("MM"), this._config.calDateColor, this._config.linkTarget, K(this.selectedMonth).locale(this.language).format("MMMM"), K(this.selectedMonth).format("YYYY"), () => this.handleMonthChange(1)) } getCalendarDaysHTML(e) { var t = !0; return this._config.showLastCalendarWeek || K(e[35].date).isSame(this.selectedMonth, "month") || (t = !1), e.map((e, a) => { const s = K(e.date).isSame(K(this.selectedMonth), "month") ? "" : "opacity: .35;", n = K(e.date).isSame(K(), "day") ? "background-color: ".concat(this._config.calEventBackgroundColor, ";") : "", r = e.holiday && 0 < e.holiday.length ? "color: ".concat(this._config.calEventHolidayColor, ";") : "", i = 6 == K(e.date).isoWeekday() ? "background-color: ".concat(this._config.calEventSatColor, ";") : "", d = 7 == K(e.date).isoWeekday() ? "background-color: ".concat(this._config.calEventSunColor, ";") : "", o = K(e.date).isSame(K(this.clickedDate), "day") ? "background-color: ".concat(this._config.calActiveEventBackgroundColor, ";") : "", _ = e.icon1 && 0 < e.icon1.length ? W(_templateObject38(), this._config.calEventIcon1Color, this._config.calEventIcon1) : "", l = e.icon2 && 0 < e.icon2.length ? W(_templateObject39(), this._config.calEventIcon2Color, this._config.calEventIcon2) : "", m = e.icon3 && 0 < e.icon3.length ? W(_templateObject40(), this._config.calEventIcon3Color, this._config.calEventIcon3) : ""; if (35 > a || t) return W(_templateObject41(), 0 == a % 7 ? W(_templateObject42()) : "", () => this.handleEventSummary(e), this._config.calDayColor, s, n, r, i, d, o, e.dayNumber.replace(/^0|[^/]0./, ""), _, l, m, a && 0 == a % 6 ? W(_templateObject43()) : "") }) } updateCalendarHTML() { (0 == this.month.length || this.refreshCalEvents || 120 < K().diff(this.lastCalendarUpdateTime, "minutes")) && (this.lastCalendarUpdateTime = K(), this.showLoader = !0, this.buildCalendar(this.selectedMonth), this.getCalendarEvents(this.month[0].date, this.month[41].date, this.monthToGet, this.month), this.showLoader = !1); const e = this.month, t = K.weekdaysMin(!0).map(e => W(_templateObject44(), this._config.calWeekDayColor, e)); this.content = W(_templateObject45(), this.getCalendarHeaderHTML(), this._config.eventTitleColor, t, this.getCalendarDaysHTML(e), this.eventSummary) } }); class X { constructor(e, t) { this.calendarDay = e, this._lp = t, this.ymd = K(e).format("YYYY-MM-DD"), this._holiday = [], this._icon1 = [], this._icon2 = [], this._icon3 = [], this._allEvents = [], this._daybackground = [] } get date() { return K(this.calendarDay) } get dayNumber() { return K(this.calendarDay).format("DD") } get monthNumber() { return K(this.calendarDay).month() } set holiday(e) { this._holiday = e } get holiday() { return this._holiday } set icon1(e) { this._icon1 = e } get icon1() { return this._icon1 } set icon2(e) { this._icon2 = e } get icon2() { return this._icon2 } set allEvents(e) { this._allEvents = e } get allEvents() { return this._allEvents } set icon3(e) { this._icon3 = e } get icon3() { return this._icon3 } set daybackground(e) { this._daybackground = e } get daybackground() { return this._daybackground } } class ee { constructor(e, t) { this.eventClass = e, this._config = t, this._startTime = this.eventClass.start.dateTime ? K(this.eventClass.start.dateTime) : K(this.eventClass.start.date).startOf("day"), this._endTime = this.eventClass.end.dateTime ? K(this.eventClass.end.dateTime) : K(this.eventClass.end.date).subtract(1, "days").endOf("day"), this.isFinished = !1, this.isEmpty = !1 } get titleColor() { return this._config.eventTitleColor ? this._config.eventTitleColor : "var(--primary-text-color)" } get title() { return this.eventClass.summary } get description() { return this.eventClass.description } get startTime() { return this._startTime } get startTimeToShow() { var e = this.eventClass.start.dateTime ? K(this.eventClass.start.dateTime) : K(this.eventClass.start.date).startOf("day"); return K(e).isBefore(K().startOf("day")) ? K().startOf("day") : e } get endTime() { return this._endTime } get isFullDayEvent() { return !this.eventClass.start.dateTime && !this.eventClass.end.dateTime } get isFullOneDayEvent() { return !!(!this.eventClass.start.dateTime && !this.eventClass.end.dateTime && K(this.eventClass.start.date).isSame(K(this.eventClass.end.date).subtract(1, "days"), "day") || K(this.eventClass.start.dateTime).isSame(K(this.eventClass.start.dateTime).startOf("day")) && K(this.eventClass.end.dateTime).isSame(K(this.eventClass.end.dateTime).startOf("day")) && K(this.eventClass.start.dateTime).isSame(K(this.eventClass.end.dateTime).subtract(1, "days"), "day")) } get isFullMoreDaysEvent() { return !((this.eventClass.start.dateTime || this.eventClass.end.dateTime || K(this.eventClass.start.date).isSame(K(this.eventClass.end.date).subtract(1, "days"), "day")) && !(K(this.eventClass.start.dateTime).isSame(K(this.eventClass.start.dateTime).startOf("day")) && K(this.eventClass.end.dateTime).isSame(K(this.eventClass.end.dateTime).startOf("day")) && K(this.eventClass.end.dateTime).isAfter(K(this.eventClass.start.dateTime).subtract(1, "days"), "day"))) } get daysToSort() { return K(this.startTimeToShow).format("YYYYMMDD") } get isEventRunning() { return K(this.startTime).isBefore(K()) && K(this.endTime).isAfter(K()) } get isEventFinished() { return K(this.endTime).isBefore(K()) } get location() { return this.eventClass.location ? this.eventClass.location.split(" ").join("+") : "" } get address() { return this.eventClass.location ? this.eventClass.location.split(",")[0] : "" } get link() { return this.eventClass.htmlLink } } window.customCards = window.customCards || [], window.customCards.push({ type: "atomic-calendar-revive", name: "Atomic Calendar Revive", preview: !1, description: "An advanced calendar card for Home Assistant with Lovelace." }); diff --git a/docs/options/calendar-mode-options.md b/docs/options/calendar-mode-options.md index 7fd8fd12..6e5a8a71 100644 --- a/docs/options/calendar-mode-options.md +++ b/docs/options/calendar-mode-options.md @@ -5,22 +5,40 @@ parent: Configuration Options nav_order: 4 --- +## Config Options + | Name | Type | Since | Description | | ---------------------- | :-----: | :----: | ----------------------------------------------------------------------------------------------------- | | enableModeChange | boolean | v0.7.0 | `false` Set true to enable mode change (Calendar/Events) must have "name" set to toggle | | defaultMode | integer | v0.7.0 | `1` Set `1` to make Events default mode, set `2` to make Calendar mode default | | firstDayOfWeek | integer | v0.7.0 | `1` First day of week, default 1 for Monday | -| calEventHolidayColor | string | v0.7.0 | `red` Color of day for `type: holiday` calendar | | calEventIcon1 | string | v0.7.0 | `mdi:gift` Icon for `type: icon1` calendar | -| calEventIcon1Color | string | v0.7.0 | `primary color` Color of icon for `type: icon1` calendar | | calEventIcon1Filter | string | v0.7.0 | `null` List of comma separated keywords | | calEventIcon2 | string | v0.7.0 | `mdi:home` Icon for `type: icon2` calendar | -| calEventIcon2Color | string | v0.7.0 | `primary color` Color of icon for `type: icon2` calendar | | calEventIcon2Filter | string | v0.7.0 | `null` List of comma separated keywords | | calEventIcon3 | string | v0.7.0 | `mdi:star` Icon for `type: icon3` calendar | -| calEventIcon3Color | string | v0.7.0 | `primary color` Color of icon for `type: icon3` calendar | | calEventIcon3Filter | string | v0.7.0 | `null` List of comma separated keywords | | showLastCalendarWeek | boolean | v0.7.5 | `false` If true it will always show 6 lines. If false, the 6th line won't be displayed if not needed. | | calEventTime | bool | v1.5.0 | `false` If true the time will be shown on the event summary for the selected day | | disableCalEventLink | bool | v1.5.0 | `false` If true the link will be disabled on the event summary for the selected day | | disableCalLocationLink | bool | v1.5.0 | `false` If true the link will be disabled on the event location icon for the selected day | + +## Color Options + +If you don't set colors, default theme colors will be used. If you use automatic night/day modes, don't use manual color settings. + +| Name | Type | Since | Description | +| ----------------------------- | :----: | :----: | -------------------------------------------------------------------------------- | +| calEventHolidayColor | string | v0.7.0 | `red` Color of day for `type: holiday` calendar | +| calEventIcon1Color | string | v0.7.0 | `primary color` Color of icon for `type: icon1` calendar | +| calEventIcon2Color | string | v0.7.0 | `primary color` Color of icon for `type: icon2` calendar | +| calEventIcon3Color | string | v0.7.0 | `primary color` Color of icon for `type: icon3` calendar | +| calGridColor | string | v1.3.0 | `rgba(86, 86, 86, .35)` color of calendar grid border | +| calEventBackgroundColor | string | v1.3.0 | `rgba(86, 100, 86, .35)` background color of todays calendar date | +| calEventSatColor | string | v1.3.0 | `rgba(86, 86, 86, .05)` Sets Saturday to a different color | +| calEventSunColor | string | v1.3.0 | `rgba(255, 255, 255, .15)` Sets Sunday to a different color | +| calActiveEventBackgroundColor | string | v1.4.0 | `rgba(86, 128, 86, .35)` Sets selected day to different color | +| defaultCalColor | string | v1.5.0 | `primary text color` Sets the default calendar color if not set under the entity | +| calDayColor | string | v1.6.0 | `primary text color` Sets the calendar day number color | +| calWeekDayColor | string | v1.6.0 | `primary text color` Sets the weekday title color in calendar mode | +| calDateColor | string | v1.6.0 | `primary text color` Sets the date selector color in calendar mode | diff --git a/docs/options/entity-options.md b/docs/options/entity-options.md index 007ea6da..e39eba0b 100644 --- a/docs/options/entity-options.md +++ b/docs/options/entity-options.md @@ -11,3 +11,9 @@ nav_order: 2 | blacklist | string | v0.7.9 | `null` List of comma separated blacklisted keywords. Events containing any of them will not be shown. | | whitelist | string | v1.1.0 | `null` List of comma separated whitelisted keywords. Only events containing any of them will be shown. | | eventCalName | string | v1.2.0 | `null` Add a calendar name to be shown with event. | + +## Color Options + +| Name | Type | Since | Description | +| ----- | :----: | :----: | ----------------------------------- | +| color | string | v1.5.0 | `defaultCalColor` Color of calendar | diff --git a/docs/options/event-mode-options.md b/docs/options/event-mode-options.md new file mode 100644 index 00000000..61dbd1da --- /dev/null +++ b/docs/options/event-mode-options.md @@ -0,0 +1,33 @@ +--- +layout: default +title: Event Mode Options +parent: Configuration Options +nav_order: 3 +--- + +## Config Options + +| Name | Type | Since | Description | +| -------------------- | :-----: | :----: | --------------------------------------------------------------------------------------------------- | +| showCurrentEventLine | boolean | v0.3.0 | `false` Show line before next event. Don't enable when showProgressBar is true - will look bad | +| showProgressBar | boolean | v0.5.5 | `true` Show event progress with moving icon. Don't enable when showCurrentEventLine - will look bad | + +## Color Options + +If you don't set colors, default theme colors will be used. If you use automatic night/day modes, don't use manual color settings. + +| Name | Type | Since | Description | +| ------------------- | :-----: | :----: | ----------------------------------------------------------------- | +| eventBarColor | string | v0.3.0 | `default color` Color of line showing next event | +| dateColor | string | v0.3.0 | `primary text color` Color of date (left side) | +| dateSize | integer | v0.3.0 | `90` Date text size (percent of default font) | +| timeColor | string | v0.3.0 | `primary color` Color of time (under the event title) | +| timeSize | integer | v0.3.0 | `90` Time text size (percent of default font) | +| eventTitleColor | string | v0.3.0 | `primary text color` Color of event title | +| eventTitleSize | integer | v0.3.0 | `100` Event title text size (percent of default font) | +| dayWrapperLineColor | string | v0.3.0 | `primary text color` Color of line - days separate | +| progressBarColor | string | v0.5.5 | `default color` Color of progress bar | +| descColor | string | v0.8.4 | `primary text color` Description of date (left side) | +| descSize | integer | v0.8.4 | `80` Description text size (percent of default font) | +| eventCalNameColor | string | v1.2.0 | `primary text color` color of `eventCalName` if set | +| eventCalNameSize | integer | v1.2.0 | `90` text size of `eventCalName` if set (percent of default font) | diff --git a/docs/options/event-options.md b/docs/options/event-options.md deleted file mode 100644 index 052c6597..00000000 --- a/docs/options/event-options.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -layout: default -title: Event Options -parent: Configuration Options -nav_order: 3 ---- - -| Name | Type | Since | Description | -| -------------------- | :-----: | :----: | --------------------------------------------------------------------------------------------------- | -| showCurrentEventLine | boolean | v0.3.0 | `false` Show line before next event. Don't enable when showProgressBar is true - will look bad | -| eventBarColor | string | v0.3.0 | `default color` Color of line showing next event | -| showProgressBar | boolean | v0.5.5 | `true` Show event progress with moving icon. Don't enable when showCurrentEventLine - will look bad | -| progressBarColor | string | v0.5.5 | `default color` Color of progress bar | diff --git a/docs/options/main-options.md b/docs/options/main-options.md index 6bcafc60..a026adb8 100644 --- a/docs/options/main-options.md +++ b/docs/options/main-options.md @@ -28,4 +28,17 @@ nav_order: 1 | showCalNameInEvent | string | optional | ? | `false` Shows the event calendar name | | showFullDayProgress | string | optional | v1.7.0 | `false` Enables the progress bar for full day events | +# Color Options + +| Name | Type | Since | Description | +| -------------------- | :-----: | :----: | :---------------------------------------------------------------------------------: | +| locationLinkColor | string | v0.3.0 | `primary text color` Color of location link (right side) | +| locationTextSize | integer | v0.3.0 | `90` Location text size (percent of default font) | +| locationIconColor | string | v0.3.0 | `primary text color` Color of location icon | +| hideFinishedEvents | boolean | v0.9.0 | `false` Don't display finished events | +| dimFinishedEvents | boolean | v0.3.0 | `true` Apply filters to finished events (configured below) | +| finishedEventOpacity | float | v0.3.0 | `0.6` Opacity level of finished events | +| finishedEventFilter | string | v0.3.0 | `grayscale(100%)` additional css filter to of finished events (default - greyscale) | +| nameColor | string | v1.6.0 | `primary text color` Sets the card name color | + [googlecalcomp]: https://www.home-assistant.io/components/calendar.google/ diff --git a/docs/options/theme-options.md b/docs/options/theme-options.md deleted file mode 100644 index 55bb4b54..00000000 --- a/docs/options/theme-options.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: default -title: Theme Options -parent: Configuration Options -nav_order: 6 ---- - -If you don't set colors, default theme colors will be used. If you use automatic night/day modes, don't use manual color settings. - -| Name | Type | Since | Description | -| ----------------------------- | :-----: | :----: | ----------------------------------------------------------------------------------- | -| dateColor | string | v0.3.0 | `primary text color` Color of date (left side) | -| dateSize | integer | v0.3.0 | `90` Date text size (percent of default font) | -| timeColor | string | v0.3.0 | `primary color` Color of time (under the event title) | -| timeSize | integer | v0.3.0 | `90` Time text size (percent of default font) | -| eventTitleColor | string | v0.3.0 | `primary text color` Color of event title | -| eventTitleSize | integer | v0.3.0 | `100` Event title text size (percent of default font) | -| locationLinkColor | string | v0.3.0 | `primary text color` Color of location link (right side) | -| locationTextSize | integer | v0.3.0 | `90` Location text size (percent of default font) | -| locationIconColor | string | v0.3.0 | `primary text color` Color of location icon | -| hideFinishedEvents | boolean | v0.9.0 | `false` Don't display finished events | -| dimFinishedEvents | boolean | v0.3.0 | `true` Apply filters to finished events (configured below) | -| finishedEventOpacity | float | v0.3.0 | `0.6` Opacity level of finished events | -| finishedEventOpacity | string | v0.3.0 | `grayscale(100%)` additional css filter to of finished events (default - greyscale) | -| dayWrapperLineColor | string | v0.3.0 | `primary text color` Color of line - days separate | -| descColor | string | v0.8.4 | `primary text color` Description of date (left side) | -| descSize | integer | v0.8.4 | `80` Description text size (percent of default font) | -| eventCalNameColor | string | v1.2.0 | `primary text color` color of `eventCalName` if set | -| eventCalNameSize | integer | v1.2.0 | `90` text size of `eventCalName` if set (percent of default font) | -| calGridColor | string | v1.3.0 | `rgba(86, 86, 86, .35)` color of calendar grid border | -| calEventBackgroundColor | string | v1.3.0 | `rgba(86, 100, 86, .35)` background color of todays calendar date | -| calEventSatColor | string | v1.3.0 | `rgba(86, 86, 86, .05)` Sets Saturday to a different color | -| calEventSunColor | string | v1.3.0 | `rgba(255, 255, 255, .15)` Sets Sunday to a different color | -| calActiveEventBackgroundColor | string | v1.4.0 | `rgba(86, 128, 86, .35)` Sets selected day to different color | -| defaultCalColor | string | v1.5.0 | `primary text color` Sets the default calendar color if not set under the entity | -| calDayColor | string | v1.6.0 | `primary text color` Sets the calendar day number color | -| nameColor | string | v1.6.0 | `primary text color` Sets the card name color | -| calWeekDayColor | string | v1.6.0 | `primary text color` Sets the weekday title color in calendar mode | -| calDateColor | string | v1.6.0 | `primary text color` Sets the date selector color in calendar mode | - -## Entity Specific - -These settings should be set under the entity - -| Name | Type | Since | Description | -| ----- | :----: | :----: | ----------------------------------- | -| color | string | v1.5.0 | `defaultCalColor` Color of calendar | diff --git a/package.json b/package.json index 5c50b9ba..664a34b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "atomic-calendar-revive", - "version": "1.8.1", + "version": "1.8.5", "description": "Calendar Card for Home Assistant", "main": "atomic-calendar-revive.js", "scripts": { diff --git a/src/app.js b/src/app.js index a049fb66..60aa6ac1 100644 --- a/src/app.js +++ b/src/app.js @@ -144,7 +144,7 @@ class AtomicCalendarRevive extends LitElement { : "" } -
+
${this.content}
` @@ -178,7 +178,6 @@ class AtomicCalendarRevive extends LitElement { language: '', // main settings - showColors: true, // show calendar title colors, if set in config (each calendar separately) maxDaysToShow: 7, // maximum days to show (if zero, show only currently running events) maxEventCount: 0, // maximum number of events to show (if zero, unlimited) showLoader: true, // show animation when loading events from Google calendar @@ -392,10 +391,12 @@ class AtomicCalendarRevive extends LitElement { } .event-title { + font-size: ${this._config.eventTitleSize}%; } .event-location-icon { --mdc-icon-size: 15px; + color: ${this._config.locationIconColor}; height: 15px; width: 15px; margin-top: -2px; @@ -403,6 +404,8 @@ class AtomicCalendarRevive extends LitElement { .location-link { text-decoration: none; + color: ${this._config.locationLinkColor}; + font-size: ${this._config.locationTextSize}%; } .event-circle { @@ -573,17 +576,17 @@ class AtomicCalendarRevive extends LitElement { */ getTitleHTML(event) { const titletext = (this._config.showCalNameInEvent) ? event.eventClass.organizer.displayName + ": " + event.title : event.title - const titleColor = (this._config.showColors && typeof event._config.eventTitleColor != 'undefined') ? event._config.eventTitleColor : this._config.eventTitleColor + const titleColor = (typeof event._config.eventTitleColor != 'undefined') ? event._config.eventTitleColor : this._config.eventTitleColor if (this._config.disableEventLink || (event.link === null)) return html` -
${titletext}
+
${titletext}
` else return html` -
${titletext}
+
${titletext}
` } getCalTitleHTML(event) { - const titleColor = (this._config.showColors && typeof event._config.titleColor != 'undefined') ? event._config.titleColor : this._config.eventTitleColor + const titleColor = (typeof event._config.titleColor != 'undefined') ? event._config.titleColor : this._config.eventTitleColor //const titleColor = 'yellow' if (this._config.disableCalEventLink || (event.htmlLink === null)) return html` ${event.summary} @@ -633,17 +636,17 @@ class AtomicCalendarRevive extends LitElement { if (!event.location || !this._config.showLocation) return html`` else if (this._config.disableLocationLink) return html` -
 ${event.address}
+
 ${event.address}
` else return html` -
 ${event.address}
+
 ${event.address}
` } getCalLocationHTML(event) { if (!event.location || !this._config.showLocation || this._config.disableCalLocationLink) return html`` else return html` -   +   ` } @@ -894,6 +897,7 @@ class AtomicCalendarRevive extends LitElement { }) var filteredEvents = filteredEvents.map((event) => { (!event.start.dateTime && !event.end.dateTime) ? event['isFullDayEvent'] = true : event['isFullDayEvent'] = false + moment(this.endTime).isBefore(moment()) ? event['isEventFinished'] = false : event['isEventFinished'] = true event['_config'] = { "color": calendarColor, "titleColor": this._config.eventTitleColor } return m['allEvents'].push(event) }) @@ -980,21 +984,22 @@ class AtomicCalendarRevive extends LitElement { return moment(leftStartTime).diff(moment(rightStartTime)) }) this.eventSummary = day._allEvents.map((event, i, arr) => { - const titleColor = (this._config.showColors && typeof event._config.titleColor != 'undefined') ? event._config.titleColor : this._config.eventTitleColor - const calColor = (this._config.showColors && typeof event._config.color != 'undefined') ? event._config.color : this._config.defaultCalColor + const titleColor = (typeof event._config.titleColor != 'undefined') ? event._config.titleColor : this._config.eventTitleColor + const calColor = (typeof event._config.color != 'undefined') ? event._config.color : this._config.defaultCalColor + var finishedEventsStyle = (event.isEventFinished && this._config.dimFinishedEvents) ? `opacity: ` + this._config.finishedEventOpacity + `; filter: ` + this._config.finishedEventFilter + `;` : `` if (event.isFullDayEvent) { return html` -
-