DEV: Resolve and unsilence `ember.built-in-components` deprecation (#20716)

- Install `@ember/legacy-built-in-components` and update our import statements to use it
- Remove our custom attributeBinding extensions of `TextField` and `TextArea`. Modern ember 'angle bracket syntax' allows us to apply html attributes to a component's element without needing attributeBindings
This commit is contained in:
David Taylor 2023-03-17 11:55:29 +00:00 committed by GitHub
parent 5e5024d3e7
commit 1161c980f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 34 additions and 31 deletions

View File

@ -1,4 +1,4 @@
import TextArea from "@ember/component/text-area";
import { TextArea } from "@ember/legacy-built-in-components";
export default TextArea.extend({
attributeBindings: ["aria-label"],

View File

@ -1,5 +1,5 @@
import { observes, on } from "discourse-common/utils/decorators";
import TextArea from "@ember/component/text-area";
import { TextArea } from "@ember/legacy-built-in-components";
import autosize from "discourse/lib/autosize";
import { schedule } from "@ember/runloop";

View File

@ -1,7 +1,7 @@
import { cancel, next } from "@ember/runloop";
import { isLTR, isRTL, siteDir } from "discourse/lib/text-direction";
import I18n from "I18n";
import TextField from "@ember/component/text-field";
import { TextField } from "@ember/legacy-built-in-components";
import discourseComputed from "discourse-common/utils/decorators";
import discourseDebounce from "discourse-common/lib/debounce";

View File

@ -1,22 +0,0 @@
import TextField from "@ember/component/text-field";
import TextArea from "@ember/component/text-area";
let initializedOnce = false;
export default {
name: "ember-input-component-extensions",
initialize() {
if (initializedOnce) {
return;
}
TextField.reopen({
attributeBindings: ["aria-describedby", "aria-invalid"],
});
TextArea.reopen({
attributeBindings: ["aria-describedby", "aria-invalid"],
});
initializedOnce = true;
},
};

View File

@ -94,8 +94,8 @@
@value={{this.accountName}}
@id="new-account-name"
@class={{value-entered this.accountName}}
@aria-describedby="fullname-validation"
@aria-invalid={{this.nameValidation.failed}}
aria-describedby="fullname-validation"
aria-invalid={{this.nameValidation.failed}}
/>
<label class="alt-placeholder" for="new-account-name">
{{i18n "user.name.title"}}
@ -134,8 +134,8 @@
id="new-account-password"
@autocomplete="current-password"
@capsLockOn={{this.capsLockOn}}
@aria-describedby="password-validation"
@aria-invalid={{this.passwordValidation.failed}}
aria-describedby="password-validation"
aria-invalid={{this.passwordValidation.failed}}
/>
<label class="alt-placeholder" for="new-account-password">
{{i18n "user.password.title"}}

View File

@ -3,8 +3,6 @@ globalThis.deprecationWorkflow.config = {
// We're using RAISE_ON_DEPRECATION in environment.js instead of
// `throwOnUnhandled` here since it is easier to toggle.
workflow: [
{ handler: "silence", matchId: "ember.built-in-components.reopen" },
{ handler: "silence", matchId: "ember.built-in-components.import" },
{ handler: "silence", matchId: "implicit-injections" },
{ handler: "silence", matchId: "route-render-template" },
{ handler: "silence", matchId: "routing.transition-methods" },

View File

@ -23,6 +23,7 @@
"@discourse/virtual-dom": "^2.1.2-0",
"@ember-compat/tracked-built-ins": "^0.9.1",
"@ember/jquery": "^2.0.0",
"@ember/legacy-built-in-components": "^0.4.2",
"@ember/optional-features": "^2.0.0",
"@ember/render-modifiers": "^2.0.5",
"@ember/test-helpers": "^2.9.3",

View File

@ -1088,6 +1088,16 @@
jquery "^3.5.0"
resolve "^1.15.1"
"@ember/legacy-built-in-components@^0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@ember/legacy-built-in-components/-/legacy-built-in-components-0.4.2.tgz#79a97d66153ff17909759b368b2a117bc9e168e5"
integrity sha512-rJulbyVQIVe1zEDQDqAQHechHy44DsS2qxO24+NmU/AYxwPFSzWC/OZNCDFSfLU+Y5BVd/00qjxF0pu7Nk+TNA==
dependencies:
"@embroider/macros" "^1.0.0"
ember-cli-babel "^7.26.6"
ember-cli-htmlbars "^5.7.1"
ember-cli-typescript "^4.1.0"
"@ember/optional-features@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@ember/optional-features/-/optional-features-2.0.0.tgz#c809abd5a27d5b0ef3c6de3941334ab6153313f0"
@ -3999,6 +4009,22 @@ ember-cli-typescript@^2.0.2:
stagehand "^1.0.0"
walk-sync "^1.0.0"
ember-cli-typescript@^4.1.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/ember-cli-typescript/-/ember-cli-typescript-4.2.1.tgz#54d08fc90318cc986f3ea562f93ce58a6cc4c24d"
integrity sha512-0iKTZ+/wH6UB/VTWKvGuXlmwiE8HSIGcxHamwNhEC5x1mN3z8RfvsFZdQWYUzIWFN2Tek0gmepGRPTwWdBYl/A==
dependencies:
ansi-to-html "^0.6.15"
broccoli-stew "^3.0.0"
debug "^4.0.0"
execa "^4.0.0"
fs-extra "^9.0.1"
resolve "^1.5.0"
rsvp "^4.8.1"
semver "^7.3.2"
stagehand "^1.0.0"
walk-sync "^2.2.0"
ember-cli-typescript@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/ember-cli-typescript/-/ember-cli-typescript-5.1.0.tgz#460eb848564e29d64f2b36b2a75bbe98172b72a4"