Commit graph

27970 commits

Author SHA1 Message Date
Andrew Kushnir
baaaa6daf6 refactor(core): add on immediate support for defer blocks (#51630)
This commit adds a logic to handle `on immediate` conditions both as a main condition, as well as a prefetching condition (i.e. `prefetch on immediate`).

PR Close #51630
2023-09-25 09:17:55 -07:00
Kristiyan Kostadinov
16f5fc40a4 feat(core): support deferred viewport triggers (#51874)
Adds support for `on viewport` and `prefetch on viewport` triggers which will load the deferred content when the element comes into the view.

PR Close #51874
2023-09-25 09:17:03 -07:00
Kristiyan Kostadinov
687b96186c feat(core): support deferred hover triggers (#51874)
Adds support for `on hover` and `prefetch on hover` triggers. Some code had to be moved around so it could be reused from the `on interaction` triggers.

PR Close #51874
2023-09-25 09:17:03 -07:00
Kristiyan Kostadinov
3cbb2a8ecf feat(core): implement deferred block interaction triggers (#51830)
Adds the implementation for the `on interaction` and `prefetch on interaction` triggers.

PR Close #51830
2023-09-22 12:17:54 -07:00
Kristiyan Kostadinov
00e6013661 refactor(compiler): implement final instruction generation for interaction triggers (#51830)
Updates the logic that generates the instructions for the `on interaction` and `prefetch on interaction` triggers to their final shape. Now the instructions take two arguments:
1. `triggerIndex` - index at which to find the trigger in the view where it will be rendered.
2. `walkUpTimes` - tells the runtime how many views up it needs to go to find the trigger element. If the argument is omitted, it means that the trigger is in the same view as the deferred block. A positive number means that the runtime needs to go up X amount of times to find the trigger. A negative number means that the trigger is inside the root view of the placeholder block. Negative numbers are capped at -1 since the placeholder is always in the same position at runtime.

PR Close #51830
2023-09-22 12:17:54 -07:00
Kristiyan Kostadinov
7cce28ae9c refactor(compiler): extract deferred block trigger information (#51830)
Reworks the compiler to use the API introduced in #51816 to match triggers to the element nodes they point to. This will be used to generate the new instructions for `on interaction` and `prefetch on interaction`.

PR Close #51830
2023-09-22 12:17:54 -07:00
Matthieu Riegler
0598613950 refactor(animations): deprecation of AnimationDriver.NOOP (#51843)
The `NoopAnimationDriver` as static property of `AnimationDriver` prevents it from being removed by tree shaking. This commit deprecates it and exposes the `NoopAnimationDriver` on the public API to replace its usage.

DEPRECATED:
The `AnimationDriver.NOOP` symbol is deprecated, use `NoopAnimationDriver` instead.

PR Close #51843
2023-09-22 12:15:45 -07:00
Matthieu Riegler
e5d327d049 refactor(animations): Use the Writable type when overwriting readonly properties. (#49754)
The `Writable` type is usefull when we want overwrite readonly properties and we still want to maintain code navigation/reference. It should be use instead of  type assertions.

PR Close #49754
2023-09-22 10:02:14 -07:00
Matthieu Riegler
2df83e2253 refactor(platform-server): Use the Writable type when overwriting readonly properties. (#49754)
The `Writable` type is usefull when we want overwrite readonly properties and we still want to maintain code navigation/reference. It should be use instead of `any` type assertions for example.

PR Close #49754
2023-09-22 10:02:13 -07:00
Matthieu Riegler
f53857ef6a refactor(router): Use the Writable type when overwriting readonly properties. (#49754)
The `Writable` type is usefull when we want overwrite readonly properties and we still want to maintain code navigation/reference. It should be use instead of `any` type assertions for example.

PR Close #49754
2023-09-22 10:02:13 -07:00
Matthieu Riegler
6610c4fb10 refactor(core): Use the Writable type when overwriting readonly properties. (#49754)
The `Writable` type is usefull when we want overwrite readonly properties and we still want to maintain code navigation/reference. It should be use instead of `any` type assertions for example.

PR Close #49754
2023-09-22 10:02:13 -07:00
Matthieu Riegler
e9b9fd4579 refactor(forms): Use the Writable type when overwriting readonly properties. (#49754)
The `Writable` type is usefull when we want overwrite readonly properties and we still want to maintain code navigation/reference. It should be use instead of `any` type assertions for example.

PR Close #49754
2023-09-22 10:02:13 -07:00
Matthieu Riegler
ca416b57a8 refactor(core): Private export of the Writable type (#49754)
The `Writable` type is usefull when we want overwrite readonly properties and we still want to maintain code navigation/reference. It should be use instead of `any` type assertion for example.

PR Close #49754
2023-09-22 10:02:13 -07:00
Andrew Kushnir
4599642a87 docs: annotate ComponentFixture.getDeferBlocks as a developer preview API (#51855)
PR Close #51855
2023-09-22 09:52:13 -07:00
Paul Gschwendtner
cb545807bc fix(bazel): allow setting _enabledBlockTypes angular compiler option (#51862)
We control most flags via Starlark and therefore limit configuration
options via `tsconfig` to a minimum. We do not intend to support the
enabled block types option via Starlark, so this commit allows for
the option to be picked up.

(This is useful for benchmarking the new control flow blocks).

PR Close #51862
2023-09-22 09:51:25 -07:00
Enea Jahollari
ee6c915c82 feat(devtools): added instances count and total time in bar chart (#50866)
In Devtools bar chart we can see the total time for all the directive instances in one change detection run.

This PR changes the bar chart to display the total count and time for all directive instances instead of showing the time for each directive instance separately in one change detection run.

PR Close #50866
2023-09-22 09:50:52 -07:00
Payam Valadkhan
077534ef0f refactor(core): enabled using deps tracker in JIT compilation (#51415)
This change simply flip the flag which enables using the deps tracker in JIT compilation (the logic is already implemented in a previous PR). Some tests which depend on the old JIT implementation (e.g., patching the scope info into the type) are modified accordingly.

PR Close #51415
2023-09-22 09:49:33 -07:00
Payam Valadkhan
654d6ce2fa refactor(core): remove class type check when clearing cache in deps tracker (#51415)
Using verification helpers such as `isComponent` may trigger JIT compilation. Now in some tests such compilation is made purposely to fail, and so in such cases any reference to the `depsTracker.clearScopeCacheFor` method will cause the exception to be thrown earlier than expected which results in teh test failure. Such scenario is the case in the next commit when we enable using the deps tracker in the jit compilation. Note that such failure is only for the framework tests and is a very edge case. The tests in downstream apps will not lead to such scenario of failure at all.

PR Close #51415
2023-09-22 09:49:33 -07:00
Angular Robot
013aec850c build: update cross-repo angular dependencies (#51783)
See associated pull request for more information.

PR Close #51783
2023-09-22 09:48:59 -07:00
Alan Agius
3c0577f991 perf(platform-browser): disable styles of removed components instead of removing (#51808)
This commit changes the behaviour of `REMOVE_STYLES_ON_COMPONENT_DESTROY`.

Now, `style` nodes are disabled instead of removed from DOM. This causes the same runtime behaviour but avoids recomputations when the stylesheet is re-added when the component is re-created. https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/css/css_style_sheet.h;l=266;drc=31fb07c05718d671d96c227855bfe97af9e3fb20

NB: This changes is being done following some performance bottlenecks observed in Phanteon and their own recommendations.

Context:
http://chat/room/AAAAxKxTk40/jaP6Lj6fhmQ/jaP6Lj6fhmQ
https://crbug.com/1444522
http://b/289992821

PR Close #51808
2023-09-22 09:48:35 -07:00
Andrew Scott
86e91463af feat(router): Add option to skip the first view transition (#51825)
This commit adds an option to the view transition feature to skip the first transition.
This option is not available in RouterModule.forRoot.

resolves #51815

PR Close #51825
2023-09-22 09:48:09 -07:00
Andrew Scott
3c6258c85b fix(router): Remove deprecated setupTestingRouter function (#51826)
The `setupTestingRouter` function is a factory function for creating a
new instance of the `Router`. This function is effectively a no-op.
Developers should use `RouterModule.forRoot` or `provideRouter` in tests
instead.

BREAKING CHANGE: The `setupTestingRouter` function has been removed. Use
`RouterModule.forRoot` or `provideRouter` to setup the `Router` for
tests instead.

PR Close #51826
2023-09-22 09:47:44 -07:00
Pawel Kozlowski
dcf18dc74c fix(core): allow toSignal calls in reactive context (#51831)
This PR moves the Observable subscription of toSignal outside of the
reactive context. As the result the toSignal calls are allowed in the
computed, effect and all other reactive consumers.

This is based on the reasoning that we already allow signals creation
in a reactive context. Plus a similar change was done to the async pipe
in the https://github.com/angular/angular/pull/50522

Fixes #51027

PR Close #51831
2023-09-22 09:47:19 -07:00
Andrew Kushnir
917203d991 refactor(core): cleanup prefetch triggers when resource loading starts (#51856)
This commit adds the necessary mechanisms to perform cleanup of prefetch triggers when resource loading starts. Previously, this logic was missing, which resulted in retaining those triggers.

PR Close #51856
2023-09-22 09:46:52 -07:00
Pawel Kozlowski
0a4f18a419 release: cut the v17.0.0-next.5 release 2023-09-20 20:04:30 +02:00
Pawel Kozlowski
bc296a17e5 docs: release notes for the v16.2.6 release 2023-09-20 19:55:57 +02:00
Jeremy Elbourn
34495b3533 feat(compiler): extract docs via exports (#51828)
So far this docs extraction has pulls API info from all exported symbols in the program. This commit changes to extracting only symbols that are exported via a specified entry-point. This commit also exports the docs entities through the compiler-cli `index.ts`.

PR Close #51828
2023-09-20 18:34:55 +02:00
Andrew Scott
2c09d51449 refactor(router): Refactor loadChildren callback execution and privately export for SSR (#51818)
This commit refactors the loadChildren callback execution of the router config loader
into a function that can be used with SSR for the purposes of route extraction.

PR Close #51818
2023-09-20 18:34:13 +02:00
Payam Valadkhan
e3532291c7 refactor(core): print the errors related to computing component dependencies to the console in local compilation mode (#51824)
Certain tools in g3 which dynamically bootstrap a component (e.g., custom routers) simply swallow the exception coming from bootstrapping the component and show an empty outlet. Such cases are very difficult to debug as the dev has no clue why the component was not rendered. As bad as this pattern is, fixing all such tools for a better error handling is beyond the scope of our effort. Instead, in this change we print the error messages coming from calculating component dependencies (part of component rendering) to the console for a better visibility into the error. This change only affects local compilation where the component dependencies are calculated in runtime. This change can potentially shed light into many failures of local compilation in g3.

PR Close #51824
2023-09-20 12:25:40 +02:00
Payam Valadkhan
b44533ba39 refactor(core): include injector info for standalone components in local compilation mode (#51819)
Standalone component need to include the imported NgModules as part of their dependencies in order to be able to use the injection tokens coming from these NgModules. To do so, in this change the imported NgModules are included in the standalone component compilation scope.

PR Close #51819
2023-09-20 12:24:54 +02:00
Payam Valadkhan
5b66330329 fix(compiler-cli): allow non-array imports for standalone component in local compilation mode (#51819)
Currently the compiler in local mode assumes that the standalone component imports are array expressions. This is not always true as they can be const variables as well. This change allow non-array expressions for standalone component imports field and passes that expression to the downstream tools such as deps tracker to compute the component's deps in runtime.

PR Close #51819
2023-09-20 12:24:54 +02:00
Payam Valadkhan
19c3dc18d3 fix(compiler-cli): fix NgModule injector def in local compilation mode when imports/exports are non-array expressions (#51819)
Current implementation assumes that NgModule imports/exports fields are always arrays and thus it concats them for the injector definition. But this is not always the case and imports/exports could be non-arrays such as const variable. Such pattern happens in g3 and so must be addressed.

PR Close #51819
2023-09-20 12:24:54 +02:00
Kristiyan Kostadinov
14d89d79ba refactor(compiler): implement template type checking for tracking expressions (#51690)
Adds support for template type checking of the `track` expression of a `for` loop block. Tracking expressions are treated as any other expression for type checking, however we have some special validation that doesn't allow them to access template variables and local references.

PR Close #51690
2023-09-20 11:26:05 +02:00
Kristiyan Kostadinov
aaa597393d refactor(compiler): implement template type checking for loop blocks (#51690)
Adds support for template type checking inside `for` blocks. It is implemented by generating a JS `for...of` statement inside the TCB. The various loop variables (e.g. `$index`) are implemented by declaring a local number variable.

PR Close #51690
2023-09-20 11:26:05 +02:00
Kristiyan Kostadinov
d42e02333a refactor(compiler): implement template type checking for if blocks (#51690)
Adds support for template type checking inside `if` blocks. It is implemented by generating a JS `if` statement inside the TCB which allows us to do type narrowing of the expression. The `as` parameter is implemented by declaring a variable inside the `if` statement.

PR Close #51690
2023-09-20 11:26:05 +02:00
Kristiyan Kostadinov
29ced9b066 refactor(compiler): implement template type checking for switch blocks (#51690)
Adds support for template type checking inside `switch` blocks. It is implemented by generating a JS `switch` statement inside the TCB which allows us to do type narrowing of the expression.

PR Close #51690
2023-09-20 11:26:05 +02:00
Alan Agius
0ee0f780e4 build: update dependency jasmine to v5 (#51820)
The patch is to fix upstream bug in `@bazel/jasmine`. See: bazelbuild/rules_nodejs#3691

PR Close #51820
2023-09-19 18:40:16 +02:00
Joey Perrott
ba64e9c247 docs: update to latest version of material (#51785)
Update to the latest version of material

PR Close #51785
2023-09-19 18:39:10 +02:00
David LJ
1e6c05512b docs: remove ref to no longer existing test.ts (#51462)
The file was removed in Angular 15.0.0 https://github.com/angular/angular-cli/releases/tag/15.0.0
56a1e8f9f5

Thanks to @atscott and @JeanMeche for the wording suggestion

PR Close #51462
2023-09-19 18:37:37 +02:00
Andrew Scott
ad61bf6184 refactor(router): Remove internal state tracking for browserUrlTree (#48065)
The browserUrlTree is only used to support the onSameUrlNavigation: 'ignore' logic. We can achieve this functionality without having this state tracked inside the Router. Instead, we can re-examine what ignore means: We don't want to rerun the matching logic, guards, or resolvers when we already know that nothing is changing.
Outside of the "navigated", there are two things that constitute a "change":

1. The browser URL might change. Because of skipLocationChange, the browser URL might not always match the internal state of the Router (we can navigate to a path but skip updating the browser URL). If we're navigating to a place that would change the browser URL, we should process the navigation. Theoretically, all we need to really do is update the browser URL instead of processing the whole navigation w/ guards, redirects, and resolvers. But this doesn't matter that much because the default value for runGuardsAndResolvers will skip all of this anyways.
2. The internal state of the Router might change. That is, we're navigating to a new path and may or may not be updating the updating the browser URL.

If either of the above are true, we process the navigation. If both are false, we aren't changing anything so we can safely ignore the navigation request (as long as onSameUrlNavigation === 'ignore').

Why is this change important?

* Simplification of Router internals. The Router has a lot of special case handling and one-offs to handle a limited set of scenarios. Removing these when possible makes the code easier to follow

PR Close #48065
2023-09-19 16:50:56 +02:00
Angular Robot
396e064f80 build: update dependency jasmine-core to v5 (#51794)
See associated pull request for more information.

PR Close #51794
2023-09-19 12:23:09 +02:00
Angular Robot
20cdb7730e build: update dependency puppeteer-core to v21 (#51802)
See associated pull request for more information.

PR Close #51802
2023-09-19 12:21:55 +02:00
Angular Robot
8a2dc0f2e0 build: update actions/checkout action to v4 (#51793)
See associated pull request for more information.

PR Close #51793
2023-09-19 12:19:19 +02:00
Angular Robot
e5a0116575 build: update scorecard action dependencies (#51817)
See associated pull request for more information.

PR Close #51817
2023-09-19 12:18:24 +02:00
Andrew Scott
c03baed854 fix(router): use DOCUMENT token instead of document directly in view transitions (#51814)
document is not available in SSR so using it directly will lead to an error.

PR Close #51814
2023-09-19 12:17:08 +02:00
Kristiyan Kostadinov
d538908933 refactor(compiler): add utility to resolve the deferred block trigger element (#51816)
Adds a utility to the `BoundTarget` that helps with resolving which element a deferred block is pointing to. We need a separate method for this, because deferred blocks have some special logic for where the trigger can be located.

PR Close #51816
2023-09-19 12:16:00 +02:00
Kristiyan Kostadinov
8c10ba1a38 refactor(compiler): update binder to account for new semantics (#51816)
When the `TargetBinder` was written, the only embedded-view-based nodes were templates, but now we have `{#if}`, `{#switch}` and `{#defer}` which have similar semantics. These changes rework the binder to account for the new nodes.

PR Close #51816
2023-09-19 12:16:00 +02:00
Kristiyan Kostadinov
988e6c3fab refactor(compiler): require a reference in interaction and hover triggers (#51816)
Updates the parsing for `interaction` and `hover` triggers to require a reference to an element.

PR Close #51816
2023-09-19 12:16:00 +02:00
Dylan Hunn
8438e3e982 refactor(compiler): Clean up a few messy content projection details (#51544)
Pull out exclusion of `select` attributes on content nodes into a phase, and clean up a couple other details of content projection.

PR Close #51544
2023-09-19 12:05:47 +02:00
Dylan Hunn
8b0340626e refactor(compiler): Enable some additional passing tests for template pipeline (#51544)
A couple more tests pertaining to animations became passing at some point recently, as well as a few form other assorted areas.

PR Close #51544
2023-09-19 12:05:47 +02:00