Commit graph

28035 commits

Author SHA1 Message Date
Kristiyan Kostadinov
9acd2ac98b fix(compiler): enable block syntax in the linker (#51979)
Adds some logic to enable parsing of block syntax in the linker. Note that the syntax is only enabled on code compiled with Angular v17 or later.

PR Close #51979
2023-10-03 11:48:13 -07:00
Alan Agius
e9c3790b4e docs: update to latest version of material (#51996)
Update to the latest version of material

PR Close #51996
2023-10-03 08:07:48 -07:00
Angular Robot
068b38a05d build: update cross-repo angular dependencies (#51996)
See associated pull request for more information.

(cherry picked from commit e169b2da2e)

PR Close #51996
2023-10-03 08:07:48 -07:00
Dylan Hunn
32cfbb4306 refactor(compiler): Emit pure functions as arrow functions (#51961)
We were previously emitting pure functions as `function foo(args) {return bar;}`, but `TemplateDefinitionBuilder` uses arrow functions instead (`const foo = (args) => bar`). By matching this behavior, we can enable many additional tests.

PR Close #51961
2023-10-02 16:58:03 -07:00
Dylan Hunn
489ec15e1d refactor(compiler): Fix pipeBinding variable offsets in template pipeline (#51961)
This is a deceptively simple fix for a deep issue. Consider the following template:

```
<button [title]="myTitle" [id]="(auth().identity() | async)" [tabindex]="1">
```

`TemplateDefinitionBuilder` allocates the following variable (binding) slots:

v[0] = [title] binding
v[1] = [id] binding
v[2] = [tabindex] binding
v[3] = pipe binding
v[4] = pipe binding

As you can see, all three top-level property bindings were assigned variable indices. Then, variables for nested expressions were assigned.

Before this change, Template Pipeline would choose the following order:

v[0] = [title] binding
v[1] = [id] binding
v[2] = pipe binding
v[3] = pipe binding
v[4] = [tabindex] binding

With this order, nested expressions have their variables counted and assigned before subsequent top-level property bindings. This results in different variable indices for `pipeBinding` expressions that are not inside the final property binding.

However, this is not just different -- it's actually incorrect! Consider a case like the following:

```
<button [p1]="c ? (a | pipe) : 3" [p2]="b | pipe">
```

These pipe bindings are executed *conditionally*. This means that, because we don't count and assign all the "fixed" variable slots first, i.e. those belonging to the property bindings, their indices might end up incorrect, depending on whether or not a pipeBinding happened as part of the update block.

With this change, we count all variables on top-level ops first, and then descend into all expressions.

PR Close #51961
2023-10-02 16:58:03 -07:00
Kristiyan Kostadinov
5419af6192 build: fix compilation error due to conflict (#51981)
Fixes a compilation error that happened, because a couple of related PRs landed at the same time.

PR Close #51981
2023-10-02 10:55:46 -07:00
Kristiyan Kostadinov
4f69d620d9 fix(core): deferred blocks not removing content immediately when animations are enabled (#51971)
Fixes an issue where if animations are enabled, deferred blocks don't remove their placeholder blocks immediately from the DOM. The problem is that we register the event handlers in `afterRender` which runs outside the zone, but the logic that removes the DOM nodes during animations is tied to change detection.

These changes resolve the issue by binding the listeners inside the zone. This was the intention from the beginning, I just forgot that `afterRender` runs outside the zone.

Fixes #51970.

PR Close #51971
2023-10-02 09:12:48 -07:00
Joey Perrott
31edf79096 ci: add slack messages for failed aio deployments (#51956)
Send message to to slack when aio fails to deploy

PR Close #51956
2023-10-02 08:37:42 -07:00
Andrew Kushnir
367b075d15 test(core): enable previously failing @defer tests (#51965)
This commit re-enables previously flaky tests. The original issue was resolved by mocking `requestIdleCallback` in tests.

PR Close #51965
2023-10-02 08:35:51 -07:00
Andrew Kushnir
e368d81896 refactor(core): invoke @defer (on idle) callback in NgZone (#51975)
Currently, there is no change detection scheduled after triggering `on idle` condition, since `requestIdleCallback` is not patched by Zone.js. This commit invokes the callback in NgZone, so that the code that is invoked within the callback can use zones and a new change detection round is scheduled as needed.

Fixes #51973.

PR Close #51975
2023-10-02 08:35:07 -07:00
Jonathan Sharpe
c4d77fde12 docs: fix link to refer to RxJS pipes (#51851)
PR Close #51851
2023-09-29 15:24:31 -07:00
Angular Robot
aa4069d5dc docs: update Angular CLI help [main] (#51959)
Updated Angular CLI help contents.

PR Close #51959
2023-09-29 15:22:58 -07:00
AleksanderBodurri
a54713c831 feat(core): implement ɵgetInjectorMetadata debug API (#51900)
This API allows for inspection of a given injector to determine it's type (Element, Environment, Null) as well as it's "source".

- For Environment injectors the source is the source of the injector; `injector.source`.
- For Element injectors the name is the DOM Element that created the injector.
- For the Null Injector this is the string `"Null Injector"`.

PR Close #51900
2023-09-29 15:22:34 -07:00
Andrew Kushnir
6b6a44c473 refactor(core): add hydration support for built-in for (#51920)
This commit adds hydration support for repeaters (for loops) and empty blocks. The logic looks up a dehydrated view and use this information for hydration. Otherwise, DOM elements for a view are created from scratch.

PR Close #51920
2023-09-29 15:21:21 -07:00
Dylan Hunn
408d3b44c7 refactor(compiler): Implement if aliases in template pipeline (#51931)
An `if` block can specify an alias for its main expression. We now support these in the template pipeline:
- We generate a temporary variable for the original expression
- We pass the temporary to the `conditional` instruction's context argument
- We provide the alias's name in the ambient context variables map

The context variables map now also accepts a name whose lookup value on the context object is empty. This will be interpreted as a read of the entire context object.

PR Close #51931
2023-09-29 14:05:30 -07:00
Dylan Hunn
aa0ac8a74c refactor(compiler): Move conditional branch logic into an expression. (#51931)
This is a pure refactor: we previously crammed a lot of data into a complicated array on the conditional op. Now, we use a new conditional branch expression to store that information.

PR Close #51931
2023-09-29 14:05:30 -07:00
Dylan Hunn
56d25add17 refactor(compiler): Add support for basic if/else blocks. (#51931)
This entails adding a bit of extra logic to the existing conditional ingestion and corresponding phase, because `if` blocks lack a test expression.

Additionally, enable a couple more `switch` tests by resolving a curious issue --  we now consume a variable for conditionals.

PR Close #51931
2023-09-29 14:05:30 -07:00
Miles Malerba
8d09e9e013 test: Update golden partial file (#51876)
Updates the golden partial file to account for the newly added test

PR Close #51876
2023-09-29 10:54:01 -07:00
Miles Malerba
859b6c298f refactor(compiler): Additional fixes for pipes in i18n (#51876)
Adds a new test to verify pipe behavior in i18n blocks, and makes
serveral fixes to allow the test to pass.

PR Close #51876
2023-09-29 10:53:59 -07:00
Miles Malerba
705439aaad refactor(compiler): Enable some more passing i18n tests (#51876)
Enables a handful of additional i18n tests that pass with the changes
made so far.

PR Close #51876
2023-09-29 10:53:58 -07:00
Miles Malerba
8f1feb6036 refactor(compiler): Fix a bug in OpList.replaceWithMany (#51876)
Fix a bug where replaceWithMany was incorrectly setting the previous
item

PR Close #51876
2023-09-29 10:53:57 -07:00
Miles Malerba
4590138639 refactor(compiler): Refactor handling of pipes in i18n blocks (#51876)
Rather than rely on the empty element collapsing phase to run first, add
logic to the empty element phase to ignore pipes when deciding whether
to collapse an element.

PR Close #51876
2023-09-29 10:53:55 -07:00
Miles Malerba
70e57b64ef refactor(compiler): Use a real map for i18n params (#51876)
Use an actual JS `Map` rather than an object to represent the i18n
params.

PR Close #51876
2023-09-29 10:53:54 -07:00
Miles Malerba
d1ce75ad91 refactor(compiler): Only pass relevant i18n data to IR (#51876)
Refactors the i18n handling to only pass the relevant information from
the i18n AST through to the IR, instead of passing the entire
I18nMetadata.

PR Close #51876
2023-09-29 10:53:53 -07:00
Miles Malerba
5409b3f8d4 refactor(compiler): Fill in i18n expression placeholders (#51876)
Fills in the correct values for expression placeholders in the i18n
messages.

PR Close #51876
2023-09-29 10:53:51 -07:00
Miles Malerba
c45a544ab4 refactor(compiler): Add support for applying i18n expressions (#51876)
Adds support for the i18nApply operation to apply i18n expressions.

PR Close #51876
2023-09-29 10:53:50 -07:00
Miles Malerba
1c44d8e06f refactor(compiler): Generate correct advance instructions for i18n (#51876)
Matches the behavior of `TemplateDefinitionBuilder`, advancing to the
last element in the i18n block before evaluating i18n expressions.

PR Close #51876
2023-09-29 10:53:49 -07:00
Miles Malerba
e79fc02a2a refactor(compiler): Allow collapsing i18n start/end ops that contain a pipe (#51876)
Moves the empty element phase earlier, to before pipe creation. This
ensures that adjacent i18nStart/i18nEnd ops will be collapsed into a
isingle i18n op, rather than remaining uncollapsed if a pipe is inserted
between them.

PR Close #51876
2023-09-29 10:53:47 -07:00
Miles Malerba
5ba9093c45 refactor(compiler): Add support for i18n expressions (#51876)
Adds support for i18n expressions in i18n messages, and allows i18n
messages on templates.

Co-authored-by: Alex Rickabaugh <alxhub@users.noreply.github.com>
Co-authored-by: Dylan Hunn <dylhunn@users.noreply.github.com>

PR Close #51876
2023-09-29 10:53:46 -07:00
Joey Perrott
47e841c834 ci: move permissions for google-internal-tests into job definition (#51847)
Move permissions into the job definition for security improvement.

PR Close #51847
2023-09-29 10:51:19 -07:00
Matthieu Riegler
81e7f5be03 test(animations): update the integration test (#50738)
Let's have the same test app for async and eagerly loaded animations.

PR Close #50738
2023-09-29 10:49:41 -07:00
Matthieu Riegler
2c2ccf76e2 refactor(animations): Add integration test for animations/async. (#50738)
This integration test aims to cover that we do not break the code splitting of the animation module when we use `provideAnimationsAsync()`.

PR Close #50738
2023-09-29 10:49:40 -07:00
Matthieu Riegler
e753278faa feat(animations): Add the possibility of lazy loading animations code. (#50738)
`provideLazyLoadedAnimations()` returns providers which allow the lazy loading of the animation module.

Lazy loading of the animation code can shave off up to 16KB gzipped of the main bundle.

PR Close #50738
2023-09-29 10:49:39 -07:00
Dylan Hunn
e1728a2a39 release: cut the v17.0.0-next.6 release 2023-09-27 14:00:03 -07:00
Dylan Hunn
423709634e docs: release notes for the v16.2.7 release 2023-09-27 13:31:26 -07:00
Angular Robot
f3c5b2ea3a build: update actions/checkout digest to 8ade135 (#51873)
See associated pull request for more information.

PR Close #51873
2023-09-27 13:07:29 -07:00
Kristiyan Kostadinov
e2e3d69a27 feat(core): support deferred triggers with implicit triggers (#51922)
Adds support for defining `viewport`, `interaction` and `hover` triggers with no parameters. If the framework encounters such a case, it resolves the trigger to the root element of the `@placeholder` block. Triggers with no parameters have the following restrictions:
1. They have to be placed on an `@defer` block that has an `@placeholder`.
2. The `@placeholder` can only have one root node.
3. The root placeholder node has to be an element.

PR Close #51922
2023-09-27 12:59:34 -07:00
Kristiyan Kostadinov
23bfa10ac8 fix(compiler): add diagnostic for inaccessible deferred trigger (#51922)
If a trigger element can't be accessed from the defer block, we don't generate any instructions for it. These changes add a diagnostic that will surface the error to users.

PR Close #51922
2023-09-27 12:59:34 -07:00
Alan Agius
8413b64a6b refactor(core): add whenStable private API (#51807)
Prior to this change `this.isStable.pipe(first((isStable) => isStable)).toPromise()` had to be done in multiple places across the framework and the Angular CLI see https://github.com/angular/angular-cli/pull/25856#discussion_r1328158846. In the majority of cases an Observable based `isStable` API is not needed. This also removes the need for RXJS operator imports.

PR Close #51807
2023-09-27 10:31:56 -07:00
Andrew Kushnir
7a731c9536 refactor(core): add hydration support for built-in if and switch (#51915)
This commit updates the `if` and `switch` logic to support hydration. The logic attempts to find dehydrated views in containers while processing `if` and `switch` instructions. If a dehydrated is found, its used to further match elements. Otherwise, DOM elements for a view are created from scratch.

PR Close #51915
2023-09-27 10:29:07 -07:00
Andrew Kushnir
f483aed86a refactor(core): populate dehydrated views in template instruction (#51915)
Previously, dehydrated views lookup was triggered only when ViewContainerRef was injected. The new control flow logic uses lower level APIs, thus having the code only in the ViewContainerRef is not sufficient.

This commit adds the logic to invoke the process of dehydrated views lookup from the `template` instruction, thus enabling it for new control flow instructions as well.

PR Close #51915
2023-09-27 10:29:07 -07:00
Angular Robot
acfea3cbe3 build: update scorecard action dependencies (#51899)
See associated pull request for more information.

PR Close #51899
2023-09-27 09:24:19 -07:00
Miles Malerba
c52995d9f1 refactor(compiler): Output i18n message parameter maps in sorted order (#51911)
Changes `TemplateDefinitionBuilder` to output i18n message parameters in
sorted order to make it easier for the template pipeline to generate
identical output. This does not result in any functional change, but
will make it much easier to shared output golden files with the template
pipeline.

PR Close #51911
2023-09-27 09:23:49 -07:00
Angular Robot
69ec3493bb docs: update Angular CLI help [main] (#51916)
Updated Angular CLI help contents.

PR Close #51916
2023-09-27 09:23:19 -07:00
Andrew Kushnir
a39010f6ce refactor(core): avoid an empty array allocation during hydration (#51917)
This commit updates hydration runtime code to avoid creating an empty array when we can avoid it. Instead, we just check whether the field is `null` directly (without using nullish coalescing).

PR Close #51917
2023-09-27 09:22:48 -07:00
Jeevan Mahesha
9b40b64b68 docs: updated the server configuration for apache2 (#51921)
PR Close #51921
2023-09-27 09:22:12 -07:00
Jithil P Ponnan
4d5d902779 docs: minor update to modify the Bazel extension url (#51925)
PR Close #51925
2023-09-27 09:21:33 -07:00
Alan Agius
ba0effd494 refactor(migrations): rename migration to remove version prefix (#51926)
The version prefix in the migration name is redundant.

PR Close #51926
2023-09-27 09:20:00 -07:00
Alan Agius
e66c18ffa0 refactor(migrations): remove unused version 16 migrations (#51926)
When updating to version 17, version 16 migrations cannot be executed thus making them redundant to have in the package.

PR Close #51926
2023-09-27 09:20:00 -07:00
Kristiyan Kostadinov
c7127b98b5 feat(core): add schematic to escape block syntax characters (#51905)
#51891 introduces a new syntax that assigns a new meaning to the `@` and `}` in Angular templates. This is problematic for existing apps which may have the characters in their templates already, because it can lead to syntax errors.

These changes add an `ng update` schematic that will replace any usages of the special characters with their HTML entities.

PR Close #51905
2023-09-26 15:23:49 -07:00