From 791fd102c6596c813109c52911d6f142996f91ab Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Mon, 6 Feb 2023 10:51:35 -0500 Subject: [PATCH] Bump @fullcalendar to version 6.1.1 (#14947) --- .github/dependabot.yml | 4 - package.json | 11 ++- src/panels/calendar/ha-full-calendar.ts | 11 --- .../config/helpers/forms/ha-schedule-form.ts | 7 -- src/panels/lovelace/cards/hui-tile-card.ts | 72 ++++++++-------- .../hui-weather-forecast-card-editor.ts | 4 +- yarn.lock | 83 ++++++++----------- 7 files changed, 78 insertions(+), 114 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 79c8f5c7c4..99dc4f65c3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -19,7 +19,3 @@ updates: - dependency-name: "*rollup*" - dependency-name: "@rollup/*" - dependency-name: "serve" - # Wait for fullcalendar v6+ to fix shadow DOM issue - - dependency-name: "@fullcalendar/*" - versions: - - ">=6" diff --git a/package.json b/package.json index a066053a41..58bdc87e83 100644 --- a/package.json +++ b/package.json @@ -38,12 +38,11 @@ "@formatjs/intl-numberformat": "^8.3.3", "@formatjs/intl-pluralrules": "^5.1.8", "@formatjs/intl-relativetimeformat": "^11.1.8", - "@fullcalendar/common": "^5.11.4", - "@fullcalendar/core": "^5.11.4", - "@fullcalendar/daygrid": "^5.11.4", - "@fullcalendar/interaction": "^5.11.4", - "@fullcalendar/list": "^5.11.4", - "@fullcalendar/timegrid": "^5.11.4", + "@fullcalendar/core": "^6.1.1", + "@fullcalendar/daygrid": "^6.1.1", + "@fullcalendar/interaction": "^6.1.1", + "@fullcalendar/list": "^6.1.1", + "@fullcalendar/timegrid": "^6.1.1", "@lezer/highlight": "^1.1.3", "@lit-labs/motion": "^1.0.3", "@lit-labs/virtualizer": "^1.0.1", diff --git a/src/panels/calendar/ha-full-calendar.ts b/src/panels/calendar/ha-full-calendar.ts index 9e4f3ad5e0..bad1abd75d 100644 --- a/src/panels/calendar/ha-full-calendar.ts +++ b/src/panels/calendar/ha-full-calendar.ts @@ -1,15 +1,9 @@ -// @ts-ignore -import fullcalendarStyle from "@fullcalendar/common/main.css"; import type { CalendarOptions } from "@fullcalendar/core"; import { Calendar } from "@fullcalendar/core"; import allLocales from "@fullcalendar/core/locales-all"; import dayGridPlugin from "@fullcalendar/daygrid"; -// @ts-ignore -import daygridStyle from "@fullcalendar/daygrid/main.css"; import interactionPlugin from "@fullcalendar/interaction"; import listPlugin from "@fullcalendar/list"; -// @ts-ignore -import listStyle from "@fullcalendar/list/main.css"; import "@material/mwc-button"; import { mdiPlus, @@ -25,7 +19,6 @@ import { LitElement, PropertyValues, TemplateResult, - unsafeCSS, } from "lit"; import { property, state } from "lit/decorators"; import memoize from "memoize-one"; @@ -406,10 +399,6 @@ export class HAFullCalendar extends LitElement { return [ haStyle, css` - ${unsafeCSS(fullcalendarStyle)} - ${unsafeCSS(daygridStyle)} - ${unsafeCSS(listStyle)} - :host { display: flex; flex-direction: column; diff --git a/src/panels/config/helpers/forms/ha-schedule-form.ts b/src/panels/config/helpers/forms/ha-schedule-form.ts index 960965d2c1..24a29809df 100644 --- a/src/panels/config/helpers/forms/ha-schedule-form.ts +++ b/src/panels/config/helpers/forms/ha-schedule-form.ts @@ -1,11 +1,7 @@ -// @ts-ignore -import fullcalendarStyle from "@fullcalendar/common/main.css"; import { Calendar, CalendarOptions } from "@fullcalendar/core"; import allLocales from "@fullcalendar/core/locales-all"; import interactionPlugin from "@fullcalendar/interaction"; import timeGridPlugin from "@fullcalendar/timegrid"; -// @ts-ignore -import timegridStyle from "@fullcalendar/timegrid/main.css"; import { addDays, isSameDay, isSameWeek, nextDay } from "date-fns"; import { css, @@ -14,7 +10,6 @@ import { LitElement, PropertyValues, TemplateResult, - unsafeCSS, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { firstWeekdayIndex } from "../../../../common/datetime/first_weekday"; @@ -409,8 +404,6 @@ class HaScheduleForm extends LitElement { return [ haStyle, css` - ${unsafeCSS(fullcalendarStyle)} - ${unsafeCSS(timegridStyle)} .form { color: var(--primary-text-color); } diff --git a/src/panels/lovelace/cards/hui-tile-card.ts b/src/panels/lovelace/cards/hui-tile-card.ts index 97a7256b14..6422257036 100644 --- a/src/panels/lovelace/cards/hui-tile-card.ts +++ b/src/panels/lovelace/cards/hui-tile-card.ts @@ -1,4 +1,3 @@ -import { memoize } from "@fullcalendar/common"; import { Ripple } from "@material/mwc-ripple"; import { RippleHandlers } from "@material/mwc-ripple/ripple-handlers"; import { mdiExclamationThick, mdiHelp } from "@mdi/js"; @@ -13,6 +12,7 @@ import { } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; +import memoizeOne from "memoize-one"; import { computeCssColor } from "../../../common/color/compute-color"; import { hsv2rgb, rgb2hex, rgb2hsv } from "../../../common/color/convert-color"; import { DOMAINS_TOGGLE } from "../../../common/const"; @@ -139,42 +139,44 @@ export class HuiTileCard extends LitElement implements LovelaceCard { return imageUrl; } - private _computeStateColor = memoize((entity: HassEntity, color?: string) => { - // Use custom color if active - if (color) { - return stateActive(entity) ? computeCssColor(color) : undefined; - } - - // Use default color for person/device_tracker because color is on the badge - if ( - computeDomain(entity.entity_id) === "person" || - computeDomain(entity.entity_id) === "device_tracker" - ) { - return undefined; - } - - // Use light color if the light support rgb - if ( - computeDomain(entity.entity_id) === "light" && - entity.attributes.rgb_color - ) { - const hsvColor = rgb2hsv(entity.attributes.rgb_color); - - // Modify the real rgb color for better contrast - if (hsvColor[1] < 0.4) { - // Special case for very light color (e.g: white) - if (hsvColor[1] < 0.1) { - hsvColor[2] = 225; - } else { - hsvColor[1] = 0.4; - } + private _computeStateColor = memoizeOne( + (entity: HassEntity, color?: string) => { + // Use custom color if active + if (color) { + return stateActive(entity) ? computeCssColor(color) : undefined; } - return rgb2hex(hsv2rgb(hsvColor)); - } - // Fallback to state color - return stateColorCss(entity); - }); + // Use default color for person/device_tracker because color is on the badge + if ( + computeDomain(entity.entity_id) === "person" || + computeDomain(entity.entity_id) === "device_tracker" + ) { + return undefined; + } + + // Use light color if the light support rgb + if ( + computeDomain(entity.entity_id) === "light" && + entity.attributes.rgb_color + ) { + const hsvColor = rgb2hsv(entity.attributes.rgb_color); + + // Modify the real rgb color for better contrast + if (hsvColor[1] < 0.4) { + // Special case for very light color (e.g: white) + if (hsvColor[1] < 0.1) { + hsvColor[2] = 225; + } else { + hsvColor[1] = 0.4; + } + } + return rgb2hex(hsv2rgb(hsvColor)); + } + + // Fallback to state color + return stateColorCss(entity); + } + ); private _computeStateDisplay(stateObj: HassEntity): TemplateResult | string { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts index cc040c84d1..9ed5b09774 100644 --- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts @@ -1,6 +1,6 @@ -import { memoize } from "@fullcalendar/common"; import { html, LitElement, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; +import memoizeOne from "memoize-one"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; import { entityId } from "../../../../common/structs/is-entity-id"; @@ -66,7 +66,7 @@ export class HuiWeatherForecastCardEditor return undefined; } - private _schema = memoize( + private _schema = memoizeOne( (entity: string, localize: LocalizeFunc, hasForecast?: boolean) => [ { diff --git a/yarn.lock b/yarn.lock index 47097845d5..b63e4332d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1585,64 +1585,50 @@ __metadata: languageName: node linkType: hard -"@fullcalendar/common@npm:^5.11.4, @fullcalendar/common@npm:~5.11.4": - version: 5.11.4 - resolution: "@fullcalendar/common@npm:5.11.4" +"@fullcalendar/core@npm:^6.1.1": + version: 6.1.1 + resolution: "@fullcalendar/core@npm:6.1.1" dependencies: - tslib: ^2.1.0 - checksum: 8fc0e05539ba83d310eb5a7163dcd10582d83465393cccb525022b20c954e29e6361b289a2d2eec1ae5b5d950700333739b81cb5e81bc8cb72f682484ca697af - languageName: node - linkType: hard - -"@fullcalendar/core@npm:^5.11.4": - version: 5.11.4 - resolution: "@fullcalendar/core@npm:5.11.4" - dependencies: - "@fullcalendar/common": ~5.11.4 preact: ^10.0.5 - tslib: ^2.1.0 - checksum: 11652a58dc4a7af2b9c552ca71e4215c56d574f7d639deab0a6604afa0a67c7bfef445d5a6e364b6bc6b0ffb333ba9e7730e184d480e0113dce90c470d988d17 + checksum: 4fc30de34c1c03196f7a80904d4e8f307c66afe52a65e7a257137f1a639c29efc69d15a58d381a2481753b51f4bc101fb00584606cfb006226a01843efa743c5 languageName: node linkType: hard -"@fullcalendar/daygrid@npm:^5.11.4, @fullcalendar/daygrid@npm:~5.11.4": - version: 5.11.4 - resolution: "@fullcalendar/daygrid@npm:5.11.4" - dependencies: - "@fullcalendar/common": ~5.11.4 - tslib: ^2.1.0 - checksum: a25d83cfe5b3ac3feeb49af47701c54e858d30b0b53871df2a83aa7edbcc7d49f435d59fdbf3d6e18b5699caced8133e9c4b1c919caca2c8717bd92f57c08ab4 +"@fullcalendar/daygrid@npm:^6.1.1, @fullcalendar/daygrid@npm:~6.1.1": + version: 6.1.1 + resolution: "@fullcalendar/daygrid@npm:6.1.1" + peerDependencies: + "@fullcalendar/core": ~6.1.1 + checksum: ffc3431af31e3858218c962ad761019967e8bccd9d83ea4897bd2db86b0d06fd4dfd4c529f25791ac38ef403295c8a23a0c0e7bb6420c6067890a64350a4305f languageName: node linkType: hard -"@fullcalendar/interaction@npm:^5.11.4": - version: 5.11.4 - resolution: "@fullcalendar/interaction@npm:5.11.4" - dependencies: - "@fullcalendar/common": ~5.11.4 - tslib: ^2.1.0 - checksum: 88231b925498b947f5af98fcabf564f7d72ecde6660696e5aec7aa5c4aca7988deab74c9486a30e0e461cdd31913c560bb016f54a61641d13359488e845e053f +"@fullcalendar/interaction@npm:^6.1.1": + version: 6.1.1 + resolution: "@fullcalendar/interaction@npm:6.1.1" + peerDependencies: + "@fullcalendar/core": ~6.1.1 + checksum: 8319e06999792e16af16d39fb3437080b427c2f9688a2b3a90f0cd8228e925603389f7390c7558cb651b9099bf3cd88a2e05d8b1e4836723f098a8c4d2a95c69 languageName: node linkType: hard -"@fullcalendar/list@npm:^5.11.4": - version: 5.11.4 - resolution: "@fullcalendar/list@npm:5.11.4" - dependencies: - "@fullcalendar/common": ~5.11.4 - tslib: ^2.1.0 - checksum: e2cec5e89c57836a9ca4db57fbe67e16f78d91191df39ac0b5d0f18c1fdac9763f04647ae42e5f2d31ffa3cd245423d3aec449ed6c84fafc0195e62079a4eedc +"@fullcalendar/list@npm:^6.1.1": + version: 6.1.1 + resolution: "@fullcalendar/list@npm:6.1.1" + peerDependencies: + "@fullcalendar/core": ~6.1.1 + checksum: da2443812b9a477a5fdc2b647bbe8ca4a86e92c3bd000229b5e50b38b3cdee467dc69743ebd58035abee663de5ced392850ac2fa567b0d0487e324b836a0b863 languageName: node linkType: hard -"@fullcalendar/timegrid@npm:^5.11.4": - version: 5.11.4 - resolution: "@fullcalendar/timegrid@npm:5.11.4" +"@fullcalendar/timegrid@npm:^6.1.1": + version: 6.1.1 + resolution: "@fullcalendar/timegrid@npm:6.1.1" dependencies: - "@fullcalendar/common": ~5.11.4 - "@fullcalendar/daygrid": ~5.11.4 - tslib: ^2.1.0 - checksum: 3a2fccac65198c5fffa53286fcbb2556b6e3885cfc6f7978b7ee21c57cbc2a58617e6c54eff977f5234163cef3281e50548327a06cf253acc43c6881bed00f2c + "@fullcalendar/daygrid": ~6.1.1 + peerDependencies: + "@fullcalendar/core": ~6.1.1 + checksum: 38796e93ac4e1ea69be4a315105aa6fcc9e8b21564c10f7e0be2fb59756d8115cdbecb8ab8a69f221c27d13da5c06efc1c6c44ed8aabf54e98a69660b466d985 languageName: node linkType: hard @@ -9382,12 +9368,11 @@ fsevents@^1.2.7: "@formatjs/intl-numberformat": ^8.3.3 "@formatjs/intl-pluralrules": ^5.1.8 "@formatjs/intl-relativetimeformat": ^11.1.8 - "@fullcalendar/common": ^5.11.4 - "@fullcalendar/core": ^5.11.4 - "@fullcalendar/daygrid": ^5.11.4 - "@fullcalendar/interaction": ^5.11.4 - "@fullcalendar/list": ^5.11.4 - "@fullcalendar/timegrid": ^5.11.4 + "@fullcalendar/core": ^6.1.1 + "@fullcalendar/daygrid": ^6.1.1 + "@fullcalendar/interaction": ^6.1.1 + "@fullcalendar/list": ^6.1.1 + "@fullcalendar/timegrid": ^6.1.1 "@koa/cors": ^4.0.0 "@lezer/highlight": ^1.1.3 "@lit-labs/motion": ^1.0.3