Skip to content

Commit f653054

Browse files
committed
Merge remote-tracking branch 'origin/master' into merge-main
2 parents b39f183 + 7bd8cf5 commit f653054

File tree

268 files changed

+25170
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+25170
-146
lines changed

.stylelintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# compiled output
55
/dist/
66
/public/assets
7+
/public/downloads
78

89
# addons
910
/.node_modules.ember-try/

guides/release/components/template-tag-format.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ import { concat } from '@ember/helper';
174174
import { fn } from '@ember/helper';
175175
import { get } from '@ember/helper';
176176
import { hash } from '@ember/helper';
177+
import { uniqueId } from '@ember/helper';
177178

178179
// Built-in modifiers
179180
import { on } from '@ember/modifier';

guides/release/routing/linking-between-routes.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,34 @@ will be given the `active` CSS class. For example, if you were at the URL
9191
</ul>
9292
```
9393

94+
The CSS class name used for active classes can be customized for a single use of `<LinkTo />` by passing an `@activeClass` argument:
95+
96+
```handlebars {data-filename=app/templates/photos.hbs}
97+
<ul>
98+
{{#each this.photos as |p|}}
99+
<li>
100+
<LinkTo @route="photos.edit" @model={{p}} @activeClass="font-bold">{{p.title}}</LinkTo>
101+
</li>
102+
{{/each}}
103+
</ul>
104+
```
105+
106+
will result in:
107+
108+
```html
109+
<ul>
110+
<li>
111+
<a href="/photos/1">Happy Kittens</a>
112+
</li>
113+
<li>
114+
<a href="/photos/2" class="font-bold">Puppy Running</a>
115+
</li>
116+
<li>
117+
<a href="/photos/3">Mountain Landscape</a>
118+
</li>
119+
</ul>
120+
```
121+
94122
### Multiple Dynamic Segments
95123

96124
Sometimes, you may need to generate links for nested routes which can

guides/release/tutorial/part-1/orientation.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ To verify that your installation was successful, run:
2424

2525
```shell
2626
$ ember --version
27-
ember-cli: 6.0.1
28-
node: 18.20.5
27+
ember-cli: 6.4.0
28+
node: 18.20.8
2929
os: linux x64
3030
```
3131

@@ -38,13 +38,11 @@ We can create a new project using Ember CLI's `new` command. It follows the patt
3838
```shell
3939
$ ember new super-rentals --lang en
4040
installing app
41-
Ember CLI v6.0.1
41+
Ember CLI v6.4.0
4242

4343
Creating a new Ember app in /home/runner/work/super-rentals-tutorial/super-rentals-tutorial/dist/code/super-rentals:
4444
create .editorconfig
4545
create .ember-cli
46-
create .eslintignore
47-
create .eslintrc.js
4846
create .github/workflows/ci.yml
4947
create .prettierignore
5048
create .prettierrc.js
@@ -53,9 +51,11 @@ Creating a new Ember app in /home/runner/work/super-rentals-tutorial/super-renta
5351
create .template-lintrc.js
5452
create .watchmanconfig
5553
create README.md
54+
create /home/runner/work/super-rentals-tutorial/super-rentals-tutorial/dist/code/super-rentals/eslint.config.mjs
5655
create app/app.js
5756
create app/components/.gitkeep
5857
create app/controllers/.gitkeep
58+
create app/deprecation-workflow.js
5959
create app/helpers/.gitkeep
6060
create app/index.html
6161
create app/models/.gitkeep
@@ -123,6 +123,7 @@ super-rentals
123123
│ ├── templates
124124
│ │ └── application.hbs
125125
│ ├── app.js
126+
│ ├── deprecation-workflow.js
126127
│ ├── index.html
127128
│ └── router.js
128129
├── config
@@ -144,8 +145,6 @@ super-rentals
144145
├── .editorconfig
145146
├── .ember-cli
146147
├── .eslintcache
147-
├── .eslintignore
148-
├── .eslintrc.js
149148
├── .gitignore
150149
├── .prettierignore
151150
├── .prettierrc.js
@@ -155,6 +154,7 @@ super-rentals
155154
├── .watchmanconfig
156155
├── README.md
157156
├── ember-cli-build.js
157+
├── eslint.config.mjs
158158
├── package.json
159159
├── package-lock.json
160160
└── testem.js

guides/release/tutorial/part-2/ember-data.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,22 @@ Let's start customizing the things that didn't work for us by default. Specifica
334334
335335
The first thing we want to do is have our builder respect a configurable default host and/or namespace. Adding a namespace prefix happens to be pretty common across Ember apps, so EmberData provides a global config mechanism for host and namespace. Typically you will want to do this either in your store file or app file.
336336
337-
```js { data-filename="app/app.js" data-diff="+5,+6,+7,+8,+9" }
337+
```js { data-filename="app/app.js" data-diff="+6,+7,+8,+9,+10" }
338338
import Application from '@ember/application';
339339
import Resolver from 'ember-resolver';
340340
import loadInitializers from 'ember-load-initializers';
341341
import config from 'super-rentals/config/environment';
342+
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';
342343
import { setBuildURLConfig } from '@ember-data/request-utils';
343344

344345
setBuildURLConfig({
345346
namespace: 'api',
346347
});
347348

349+
if (macroCondition(isDevelopingApp())) {
350+
importSync('./deprecation-workflow');
351+
}
352+
348353
export default class App extends Application {
349354
modulePrefix = config.modulePrefix;
350355
podModulePrefix = config.podModulePrefix;

guides/release/typescript/additional-resources/gotchas.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export default class MyGame extends Component {
8282
Let's imagine a component which just logs the names of its arguments when it is first constructed. First, we must define the [Signature][] and pass it into our component, then we can use the `Args` member in our Signature to set the type of `args` in the constructor:
8383

8484
```typescript {data-filename="app/components/args-display.ts"}
85+
import type Owner from '@ember/owner';
8586
import Component from '@glimmer/component';
8687

8788
const log = console.log.bind(console);
@@ -95,7 +96,7 @@ export interface ArgsDisplaySignature {
9596
}
9697

9798
export default class ArgsDisplay extends Component<ArgsDisplaySignature> {
98-
constructor(owner: unknown, args: ArgsDisplaySignature['Args']) {
99+
constructor(owner: Owner, args: ArgsDisplaySignature['Args']) {
99100
super(owner, args);
100101
Object.keys(args).forEach(log);
101102
}
@@ -104,7 +105,7 @@ export default class ArgsDisplay extends Component<ArgsDisplaySignature> {
104105

105106
Notice that we have to start by calling `super` with `owner` and `args`. This may be a bit different from what you're used to in Ember or other frameworks, but is normal for sub-classes in TypeScript today. If the compiler just accepted any `...arguments`, a lot of potentially _very_ unsafe invocations would go through. So, instead of using `...arguments`, we explicitly pass the _specific_ arguments and make sure their types match up with what the super-class expects.
106107

107-
The types for `owner` here and `args` line up with what the `constructor` for Glimmer components expects. The `owner` is specified as `unknown` because this is a detail we explicitly _don't_ need to know about. The `args` are the `Args` from the Signature we defined.
108+
The types for `owner` here and `args` line up with what the `constructor` for Glimmer components expects. The `owner` is specified as `Owner`, imported from the `@ember/owner` module. The `args` are the `Args` from the Signature we defined.
108109

109110
Additionally, the types of the arguments passed to subclassed methods will _not_ autocomplete as you may expect. This is because in JavaScript, a subclass may legally override a superclass method to accept different arguments. Ember's lifecycle hooks, however, are called by the framework itself, and thus the arguments and return type should always match the superclass. Unfortunately, TypeScript does not and _cannot_ know that, so we have to provide the types directly.
110111

guides/v5.7.0/typescript/application-development/testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module('Integration | Component | Profile', function (hooks) {
7373
};
7474
this.user = user;
7575

76-
await render(hbs`<Profile @user={{this.user}}`);
76+
await render(hbs`<Profile @user={{this.user}} />`);
7777

7878
assert.dom('[data-test-name]').hasText(this.user.displayName);
7979
assert
@@ -142,7 +142,7 @@ module('Integration | Component | Profile', function (hooks) {
142142
avatarUrl: 'https://example.com/star-wars/rey',
143143
};
144144

145-
await render(hbs`<Profile @user={{this.user}}`);
145+
await render(hbs`<Profile @user={{this.user}} />`);
146146

147147
assert.dom('[data-test-name]').hasText(this.user.displayName);
148148
assert

guides/v6.3.0/contributing/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ At the top of the page (for the package, method, or class), you will find the wo
3131

3232
You can open the link to find a comment block. Make a pull request to update the comment block. The API Guides may take a few weeks to update while the future release is finalized.
3333

34-
Here is an example of updating a method. At the top of the section for [`store.createRecord()`](https://api.emberjs.com/ember-data/5.4.0/classes/Store/methods/createRecord?anchor=createRecord), you can find the words "Defined in."
34+
Here is an example of updating a method. At the top of the section for [`store.createRecord()`](https://api.emberjs.com/ember-data/5.3.12/classes/Store/methods/createRecord?anchor=createRecord), you can find the words "Defined in."
3535

3636
Next to the words is, once again, the link to the source code [`ds-model-store.ts`](https://github.com/emberjs/data/blob/master/packages/store/addon/-private/system/ds-model-store.ts).
3737

guides/v6.3.0/in-depth-topics/native-classes-in-depth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ after overriding. This allows the super class method to continue operating as it
720720
normally would.
721721

722722
One common example is when overriding the
723-
[`normalizeResponse()`](https://api.emberjs.com/ember-data/5.4.0/classes/JSONAPISerializer/methods/normalizeResponse?anchor=normalizeResponse)
723+
[`normalizeResponse()`](https://api.emberjs.com/ember-data/5.3.12/classes/JSONAPISerializer/methods/normalizeResponse?anchor=normalizeResponse)
724724
hook in one of EmberData's serializers.
725725

726726
A handy shortcut for this is to use a "spread operator", like `...arguments`:

guides/v6.3.0/models/creating-updating-and-deleting-records.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Creating Records
22

33
You can create records by calling the
4-
[`createRecord()`](https://api.emberjs.com/ember-data/5.4.0/classes/Store/methods/createRecord?anchor=createRecord)
4+
[`createRecord()`](https://api.emberjs.com/ember-data/5.3.12/classes/Store/methods/createRecord?anchor=createRecord)
55
method on the store.
66

77
```javascript
@@ -28,7 +28,7 @@ this.store.findRecord('post', 1).then(function(post) {
2828
## Persisting Records
2929

3030
Records in EmberData are persisted on a per-instance basis.
31-
Call [`save()`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/save?anchor=save)
31+
Call [`save()`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/save?anchor=save)
3232
on any instance of `Model` and it will make a network request.
3333

3434
EmberData takes care of tracking the state of each record for
@@ -60,10 +60,10 @@ store.findRecord('post', 1).then(function(post) {
6060

6161
You can tell if a record has outstanding changes that have not yet been
6262
saved by checking its
63-
[`hasDirtyAttributes`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/properties/hasDirtyAttributes?anchor=hasDirtyAttributes)
63+
[`hasDirtyAttributes`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/properties/hasDirtyAttributes?anchor=hasDirtyAttributes)
6464
property. You can also see which parts of
6565
the record were changed and what the original value was using the
66-
[`changedAttributes()`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/changedAttributes?anchor=changedAttributes)
66+
[`changedAttributes()`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/changedAttributes?anchor=changedAttributes)
6767
method. `changedAttributes` returns an object, whose keys are the changed
6868
properties and values are an array of values `[oldValue, newValue]`.
6969

@@ -75,7 +75,7 @@ person.hasDirtyAttributes; // => true
7575
person.changedAttributes(); // => { isAdmin: [false, true] }
7676
```
7777

78-
At this point, you can either persist your changes via `save()` or you can roll back your changes using [`rollbackAttributes()`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/rollbackAttributes?anchor=rollbackAttributes).
78+
At this point, you can either persist your changes via `save()` or you can roll back your changes using [`rollbackAttributes()`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/rollbackAttributes?anchor=rollbackAttributes).
7979

8080
```javascript
8181
person.hasDirtyAttributes; // => true
@@ -105,7 +105,7 @@ the errors from saving a blog post in your template:
105105

106106
## Promises
107107

108-
[`save()`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/save?anchor=save) returns
108+
[`save()`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/save?anchor=save) returns
109109
a promise, which makes it easy to asynchronously handle success and failure
110110
scenarios. Here's a common pattern:
111111

@@ -126,10 +126,10 @@ try {
126126

127127
## Deleting Records
128128

129-
Deleting records is as straightforward as creating records. Call [`deleteRecord()`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/deleteRecord?anchor=deleteRecord)
129+
Deleting records is as straightforward as creating records. Call [`deleteRecord()`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/deleteRecord?anchor=deleteRecord)
130130
on any instance of `Model`. This flags the record as `isDeleted`. The
131131
deletion can then be persisted using `save()`. Alternatively, you can use
132-
the [`destroyRecord`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/destroyRecord?anchor=destroyRecord) method to delete and persist at the same time.
132+
the [`destroyRecord`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/destroyRecord?anchor=destroyRecord) method to delete and persist at the same time.
133133

134134
```javascript
135135
let post = store.peekRecord('post', 1);

0 commit comments

Comments
 (0)