From 70ecf9cc8c39f74f17ff95411d4228950f9ed105 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:08:02 +0000 Subject: [PATCH 1/3] [BUMP] Update dependency ember-template-lint to v6 (dossier racine) --- package-lock.json | 102 +++++++++++++++++++++++++++++----------------- package.json | 2 +- 2 files changed, 66 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index f0bbd6ff6..3e05e8a3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,7 +69,7 @@ "ember-sinon": "^5.0.0", "ember-source": "^4.0.1", "ember-source-channel-url": "^3.0.0", - "ember-template-lint": "^5.0.0", + "ember-template-lint": "^6.0.0", "ember-template-lint-plugin-prettier": "^5.0.0", "ember-try": "^3.0.0-beta", "eslint": "^8.28.0", @@ -17778,9 +17778,9 @@ } }, "node_modules/date-fns": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", "dev": true, "license": "MIT", "dependencies": { @@ -17790,8 +17790,8 @@ "node": ">=0.11" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/date-fns" + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" } }, "node_modules/debug": { @@ -26201,24 +26201,23 @@ } }, "node_modules/ember-template-lint": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/ember-template-lint/-/ember-template-lint-5.13.0.tgz", - "integrity": "sha512-AYxz9S9fVZfHPmTsymc7NwsD7FVmDUZyfC+KYpxDlK0wic7JSQx2FNQNqQSBFRLOuzn7VQ0/+1pX6DGqKDGswg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ember-template-lint/-/ember-template-lint-6.0.0.tgz", + "integrity": "sha512-TWWt/qCd4KoQ50T3We5nCoKcsrAT8Ip79Kmm9eyWjjyL+LAbRFu0z+GxcmW7MR+QCNW/1LQs3kwEdtIcaHEGiA==", "dev": true, - "license": "MIT", "dependencies": { "@lint-todo/utils": "^13.1.1", "aria-query": "^5.3.0", "chalk": "^5.3.0", - "ci-info": "^3.8.0", - "date-fns": "^2.30.0", + "ci-info": "^4.0.0", + "date-fns": "^3.6.0", "ember-template-imports": "^3.4.2", "ember-template-recast": "^6.1.4", "eslint-formatter-kakoune": "^1.0.0", - "find-up": "^6.3.0", - "fuse.js": "^6.5.3", + "find-up": "^7.0.0", + "fuse.js": "^7.0.0", "get-stdin": "^9.0.0", - "globby": "^13.2.2", + "globby": "^14.0.1", "is-glob": "^4.0.3", "language-tags": "^1.0.8", "micromatch": "^4.0.5", @@ -26230,7 +26229,7 @@ "ember-template-lint": "bin/ember-template-lint.js" }, "engines": { - "node": "^14.18.0 || ^16.0.0 || >= 18.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/ember-template-lint-plugin-prettier": { @@ -26280,6 +26279,21 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/ember-template-lint/node_modules/ci-info": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", + "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, "node_modules/ember-template-lint/node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -26296,17 +26310,18 @@ } }, "node_modules/ember-template-lint/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", + "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", "dev": true, "license": "MIT", "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" + "locate-path": "^7.2.0", + "path-exists": "^5.0.0", + "unicorn-magic": "^0.1.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -29445,9 +29460,9 @@ } }, "node_modules/fuse.js": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.6.2.tgz", - "integrity": "sha512-cJaJkxCCxC8qIIcPBF9yGxY0W/tVZS3uEISDxhYIdtk8OL93pe+6Zj7LjCqVV4dzbqcriOZ+kQ/NE4RXZHsIGA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.0.0.tgz", + "integrity": "sha512-14F4hBIxqKvD4Zz/XjDc3y94mNZN6pRv3U13Udo0lNLCWRBUsrMv2xwcF/y/Z5sV6+FQW+/ow68cHpm4sunt8Q==", "dev": true, "license": "Apache-2.0", "engines": { @@ -29785,29 +29800,30 @@ "license": "MIT" }, "node_modules/globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", + "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", "dev": true, "license": "MIT", "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.2", "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" + "path-type": "^5.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.1.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globby/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "node_modules/globby/node_modules/path-type": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", + "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true, "license": "MIT", "engines": { @@ -29817,6 +29833,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globby/node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globjoin": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz", diff --git a/package.json b/package.json index 6c95cc113..53a0a46cc 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "ember-sinon": "^5.0.0", "ember-source": "^4.0.1", "ember-source-channel-url": "^3.0.0", - "ember-template-lint": "^5.0.0", + "ember-template-lint": "^6.0.0", "ember-template-lint-plugin-prettier": "^5.0.0", "ember-try": "^3.0.0-beta", "eslint": "^8.28.0", From fcd0aac2a81daece336d32c728bd97a502fafdcc Mon Sep 17 00:00:00 2001 From: Xavier Carron <33637571+xav-car@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:56:32 +0200 Subject: [PATCH 2/3] remove usage of did insert / update --- addon/common/add-dynamic-style-tag.js | 8 --- .../pix-filterable-and-searchable-select.hbs | 1 - .../pix-filterable-and-searchable-select.js | 50 +++++++++------- addon/components/pix-pagination.hbs | 2 +- addon/components/pix-pagination.js | 9 --- addon/components/pix-select.hbs | 2 - addon/components/pix-select.js | 58 ++++++++----------- app/services/element-helper.js | 32 ++++++++++ ...x-filterable-and-searchable-select-test.js | 10 ++-- .../integration/components/pix-select-test.js | 6 +- 10 files changed, 93 insertions(+), 85 deletions(-) delete mode 100644 addon/common/add-dynamic-style-tag.js create mode 100644 app/services/element-helper.js diff --git a/addon/common/add-dynamic-style-tag.js b/addon/common/add-dynamic-style-tag.js deleted file mode 100644 index 700dc42f6..000000000 --- a/addon/common/add-dynamic-style-tag.js +++ /dev/null @@ -1,8 +0,0 @@ -export function createClass(name, rules) { - var style = document.createElement('style'); - style.type = 'text/css'; - document.getElementsByTagName('head')[0].appendChild(style); - - if (!(style.sheet || {}).insertRule) (style.styleSheet || style.sheet).addRule(name, rules); - else style.sheet.insertRule(name + '{' + rules + '}', 0); -} diff --git a/addon/components/pix-filterable-and-searchable-select.hbs b/addon/components/pix-filterable-and-searchable-select.hbs index b1d33cebb..c96021b42 100644 --- a/addon/components/pix-filterable-and-searchable-select.hbs +++ b/addon/components/pix-filterable-and-searchable-select.hbs @@ -28,7 +28,6 @@ <:default as |option|>{{option.label}} { + const baseFontRemRatio = Number( + getComputedStyle(document.querySelector('html')).fontSize.match(/\d+(\.\d+)?/)[0], + ); + + const multiSelectWidth = document + .getElementById(this.pixMultiSelectId) + .getBoundingClientRect().width; + + const selectWidth = Math.ceil(multiSelectWidth / baseFontRemRatio); + + const className = `sizing-select-${this.pixSelectId}`; + this.elementHelper.createClass(`.${className}`, `width: calc(100% - ${selectWidth}rem);`); + + const element = document.getElementById(`container-${this.pixSelectId}`); + + element.className = element.className + ' ' + className; + }); + } @action selectCategories(categories) { @@ -47,22 +71,4 @@ export default class PixFilterableAndSearchableSelect extends Component { return selectableOptions; } - - @action - setSelectWidth(element) { - const baseFontRemRatio = Number( - getComputedStyle(document.querySelector('html')).fontSize.match(/\d+(\.\d+)?/)[0], - ); - - const multiSelectWidth = document - .getElementById(this.pixMultiSelectId) - .getBoundingClientRect().width; - - const selectWidth = Math.ceil(multiSelectWidth / baseFontRemRatio); - - const className = `sizing-select-${this.pixSelectId}`; - createClass(`.${className}`, `width: calc(100% - ${selectWidth}rem);`); - - element.className = element.className + ' ' + className; - } } diff --git a/addon/components/pix-pagination.hbs b/addon/components/pix-pagination.hbs index 13283b711..7813f1788 100644 --- a/addon/components/pix-pagination.hbs +++ b/addon/components/pix-pagination.hbs @@ -1,4 +1,4 @@ -