Commit graph

29561 commits

Author SHA1 Message Date
Dylan Hunn
ac34c42188 refactor(compiler): Add template pipeline goldens for some tests with const attributes (#52479)
`TemplateDefinitionBuilder` is somewhat unreliable about extracting constant attributes (e.g. `[attr.foo]="'one'"`). It never extracts const non-string expressions, and usually, but not always, extracts const string expressions. Template pipeline consistently extracts const strings, and we add new goldens for a couple such cases.

PR Close #52479
2023-11-06 11:42:58 -08:00
Dylan Hunn
02c6a1192a refactor(compiler): Support defer triggers with no arguments in template pipeline (#52479)
Some defer triggers, such as `hover`, expect a local reference as an argument. For example, `@defer (on hover(target))` waits until the user hovers over the target.

However, these defer conditions also have a nullary form, in which the trigger is implicitly the first element in the placeholder block. We now support that case in template pipeline.

PR Close #52479
2023-11-06 11:42:58 -08:00
Dylan Hunn
2715eecc9c refactor(compiler): Support deferWhen instructions in template pipeline (#52479)
We already supported `defer on` conditions, which become instructions in the create mode block.

Now, we also support `defer when` conditions, where are very similar, with the notable difference that they go in the update block (because a user-supplied condition must be re-evaluated on each update.)

PR Close #52479
2023-11-06 11:42:58 -08:00
Andrew Scott
a8071ffcbd refactor(core): Remove change detection flag used in g3 (#52530)
This has now been cleaned up internally and is no longer needed

PR Close #52530
2023-11-06 11:42:15 -08:00
twerske
651c34735d docs: add angular.dev (#52536)
PR Close #52536
2023-11-06 11:15:02 -08:00
Emma Twersky
8bbec83dfd docs: add angular.dev banner (#52535)
PR Close #52535
2023-11-06 11:04:10 -08:00
Miles Malerba
89cfadd196 refactor(compiler): Add more comments for i18n template pipeline phases (#52503)
Adds some additional comments about the i18n termplate pipeline phases
to more clearly document how they work.

PR Close #52503
2023-11-06 09:49:47 -08:00
Miles Malerba
0c6a911919 refactor(compiler): Add support for ICUs as part of another i18n message (#52503)
Previously we supported ICUs where the ICU itself represetned the entire
translated message. This change allows ICUs to act as a sub-message
inside other translated messages.

PR Close #52503
2023-11-06 09:49:47 -08:00
Miles Malerba
09039beb1e refactor(compiler): Introduce i18n context objects (#52503)
Previously we assumed that all i18n messages that are eventually
extracted into the consts array would be generated based on an i18n
block. However, it is also possible to have messages generated directly
from ICUs. This change introduces an i18n context op, so that we can
consistently extract i18n messages from the context op in all cases.

PR Close #52503
2023-11-06 09:49:47 -08:00
Jessica Janiuk
0207801953 fix(migrations): Fixes a bug in the ngFor pre-v5 alias translation (#52531)
The logic that transformed the value to get the alias name was incorrect.

fixes: #52522

PR Close #52531
2023-11-06 09:47:36 -08:00
Jessica Janiuk
f2fbe869f0 fix(migrations): Update regex to better match ng-templates (#52529)
This addresses an edge case where an ng-template name matches an opening element name, preventing the template from being removed.

fixes #52523

PR Close #52529
2023-11-06 09:05:55 -08:00
Kristiyan Kostadinov
9cfd35a594 fix(compiler): ng-template directive invoke twice at the root of control flow (#52515)
Discovered this while validating #52414 against Angular Material. We were projecting `<ng-template>` nodes at the root of `@if` and `@for` with the `ng-template` tag name which enables directive matching and applies the directive to the control flow node.

These changes fix the issue by never passing along the `ng-template` tag name.

PR Close #52515
2023-11-06 09:03:45 -08:00
Kristiyan Kostadinov
cc4dc52703 fix(migrations): account for separator characters inside strings (#52525)
Fixes that the control flow migrations wasn't accounting for separator characters used inside string literals.

PR Close #52525
2023-11-06 09:00:23 -08:00
Kristiyan Kostadinov
44341ca25d fix(migrations): handle comma-separated syntax in ngFor (#52525)
This is something that came up when running the script against the Components repo. The `ngFor` syntax can be delimited either by semicolons or by commas, but the migration only accounted for commas.

PR Close #52525
2023-11-06 09:00:23 -08:00
AleksanderBodurri
63777d20d9 test(devtools): fix transformInjectorResolutionPathsIntoTree tests (#52489)
Previously transformInjectorResolutionPathsIntoTree returned an array, now it returns a tree node so we update the test cases to reflect that.

PR Close #52489
2023-11-03 17:37:55 -07:00
AleksanderBodurri
f4b915b77b feat(devtools): implement zoom and pan in injector graph visualizer (#52489)
Previously only the trackpad could be used to navigate this view.

Now we can zoom and pan around using our mouse wheel and scroll.

Additionally, this commit fixes many issues related to the visualization of the injector graph visualization, allowing it to be more compact without impacting legibility and minimizing edge collisions in larger graphs.

PR Close #52489
2023-11-03 17:37:55 -07:00
AleksanderBodurri
1f18c7464f perf(devtools): optimize injector graph discovery (#52489)
Our algorithm for discovering the injector graph of an application involves calculating resolution paths for each angular node on a page, and then using those paths to construct the underlying tree.

Along the we way we perform many expensive computations that are candidates for optimization through caching. This commit implements this caching, resulting in a substantial increase in performance for large applications.

PR Close #52489
2023-11-03 17:37:55 -07:00
AleksanderBodurri
ef12570e29 feat(devtools): squash multi providers into 1 and allow them to be logged to the console (#52489)
Implements a feature allowing users to visualize multiproviders as one row in the providers table.

Also enables the user to log to console any provider in the table. This log includes information about the provider selected, the injector it was configured in, and also calls `Injector.get(Token)` to determine the value the provider evaluates to in it's injector.

PR Close #52489
2023-11-03 17:37:55 -07:00
AleksanderBodurri
0bd0309088 refactor(devtools): stop inspector from changing tab to components (#52489)
Previously this was the only page that used the inspector, so we automatically changed the tab out of convenience.

Now, the injector tree tab also does uses the inspector for some functionality, so we disable this behaviour.

PR Close #52489
2023-11-03 17:37:55 -07:00
Alan Agius
1a33a2ca11 release: cut the zone.js-0.14.2 release (#52508)
PR Close #52508
2023-11-03 10:54:12 -07:00
Alan Agius
6033504388 docs: update ssr docs to add information about CommonEngine (#52506)
This commit add contructor information about `CommonEngine`

PR Close #52506
2023-11-03 09:50:13 -07:00
AleksanderBodurri
3d73b0cbfb fix(core): use TNode instead of LView for mapping injector providers (#52436)
Previously, LViews were used here to be consistent with other debug APIs. Using LViews for tracking injector providers does not work because providers only get configured once per TNode type.

Now we use the TNode as the key to track element injector providers, allowing the injector for each item rendered in a list (`ngFor` or `@for`) to be targeted with debug APIs for inspecting providers

PR Close #52436
2023-11-03 09:36:00 -07:00
JiaLiPassion
435dd32912 fix(zone.js): disable wrapping unhandled promise error by default (#52492)
Before this commit, zone.js wraps the uncaught promise rejection error
to a new Error object includes more information such as Zone stack
traces. This feature is provided from the very beginning of Zone.js,
but this feature becomes very annoying and make the user difficult to
debug.

So this commit disable this wrapping behavior by default, and user can
enable this feature back by setting
`DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION` to `false`.

PR Close #52492
2023-11-03 09:33:20 -07:00
Kristiyan Kostadinov
1da4a2407e fix(migrations): handle ngIf else condition with no whitespaces (#52504)
Fixes that the control flow migration wasn't migrating an `*ngIf` with an `else` condition that doesn't have spaces before the `else`.

Fixes #52502.

PR Close #52504
2023-11-03 09:32:47 -07:00
Aanchal Agarwal
25600375a3 docs: omit repetitions (#52413)
PR Close #52413
2023-11-03 07:46:54 -07:00
Angular Robot
5ab5be74f9 build: update dependency multimatch to v7 (#52426)
See associated pull request for more information.

PR Close #52426
2023-11-03 07:45:30 -07:00
Alan Agius
d4bd3f198b build: configure tslint to ban performance.mark usages (#52505)
While `performance.mark` is available on all supported browsers and node.js version this API is not available in JSDOM which is used by Jest and Cloudflare worker.

PR Close #52505
2023-11-03 07:43:36 -07:00
Alan Agius
93d32a9acb fix(core): guard usages of performance.mark (#52505)
While `performance.mark` is available on all supported browsers and node.js version this API is not available in JSDOM which is used by Jest and Cloudflare worker.

This commit, updates the usage to a safer variant.

PR Close #52505
2023-11-03 07:43:36 -07:00
Alex Rickabaugh
1f528f1e8d refactor(core): mark effect as developer preview again (#52490)
Re-add the `@developerPreview` flags to `effect()`. While we don't expect
the `effect` API itself to change, we may change how other FW APIs interact
with `effect`s. Also, add a missing export for one of those effect APIs.

PR Close #52490
2023-11-02 15:29:44 -07:00
Alex Rickabaugh
181dc7ea21 docs: release notes for the v17.0.0-rc.2 release 2023-11-02 15:07:07 -07:00
Alex Rickabaugh
57cad0e10d docs: release notes for the v16.2.12 release 2023-11-02 14:44:58 -07:00
Andrew Scott
83a3b85c35 refactor(core): Do not refresh view if producers did not actually change (#52476)
Producers represent values which can deliver change notifications.
When a producer value is changed, a change notification is propagated through the graph,
notifying live consumers which depend on the producer of the potential update.
Note here that this is a _potential_ update.

A producer may not have actually "changed" based on its equality function. With
this commit, before refreshing a view that is only marked for refresh
because its consumer is dirty, we poll producers for change to see if
they really have. If not, we can skip the refresh. The example test in this commit
shows that a `computed` which depends on a `signal` that is updated but
produces a value that is the same as before will _not_ cause the
component's template to refresh.

fixes #51797

PR Close #52476
2023-11-02 13:23:49 -07:00
Andrew Scott
164cfc0acf refactor(core): Update LView consumer to use only 1 consumer for a component (#52476)
This commit updates the reactive consumer used for `LView`s to be shared
between a component and its embedded views. This allows us to use the
consumer flag directly for a dirty indicator rather than needing to
find a component view for updating its flags.

In the future, this will also allow us to effectively poll producers to see if
they really changed before refreshing a view.

PR Close #52476
2023-11-02 13:23:49 -07:00
Andrew Scott
58d74a29f8 refactor(core): Remove warning about signal set during template execution (#52476)
The significance of the combination of #51854 and #52302 went mostly
unnoticed. The first removed a unidirectional data flow constraint for
transplanted views and the second updated the signal implementation to
share transplanted view logic. The result is that we automatically get behavior
that (mostly) removes `ExpressionChangedAfterItWasCheckedError` when signals are
used to drive application state to DOM synchronization.

fixes #50320

PR Close #52476
2023-11-02 13:23:49 -07:00
Charles Lyding
f615f4f90d docs: additional application builder SSR conversion information (#52485)
This change updates the new build system migration guide with additional
information regarding the steps needed to convert an existing SSR project
to use the new integrated SSR capabilities.

PR Close #52485
2023-11-02 11:06:21 -07:00
arturovt
9dbc5d7b0e refactor(core): do not run CDs when setting up image perf warnings (#52482)
This commit wraps the `load` event listener with `runOutsideAngular` to avoid
running unnecessary change detections on asynchronous tasks spawned within the
scope of the `ImagePerformanceWarning` functionality. This was previously causing
extra change detection cycles in development mode and interfering with debugging.

PR Close #52482
2023-11-02 11:03:42 -07:00
Jeremy Elbourn
51f84d9ba8 refactor(compiler): escape decorators in API JsDoc extraction (#52481)
TypeScript JsDoc parsing, by default, treats occurences of Angular decorators (e.g. `@Component`) in JsDoc comments as JsDoc tags. This commit escapes these decorator strings by copying the raw JS doc onto a dummy symbol in a new SourceFile to make TypeScript re-parse the comment.

PR Close #52481
2023-11-02 11:03:08 -07:00
Jeremy Elbourn
64db486edc build: add rules for generating block/element API data (#52480)
Adds build rules for "artificially" generating `DocEntry` collections for block and element APIs. The two rules are very similar, but _just_ different enough that it's worth having two separate implementations.

PR Close #52480
2023-11-02 11:02:08 -07:00
Jeremy Elbourn
a3abe1671c build: add target to generate api manifest (#52472)
This adds a target to generate a manifest of all public api symbols. The majority of inputs are generated from the extraction rules, but API entries that don't have a TypeScript source symbol (elements and blocks) are defined in hand-written json collections.

PR Close #52472
2023-11-02 11:00:59 -07:00
Pawel Kozlowski
91ee2697c0 refactor(core): short-circuits invocations of signals equality (#52465)
This change skips signal equality calls on set / update when the
two values (current and the new one) are referentially identical.
The assumption is that equality function implementation should
never return false for 2 values that are the same (according to
the Object.is logic).

PR Close #52465
2023-11-02 10:59:59 -07:00
Dylan Hunn
184d8246cb refactor(compiler): Delete some unused imports in template pipeline (#52464)
Remove a variety of unused imports.

PR Close #52464
2023-11-02 10:58:48 -07:00
Dylan Hunn
95644569e9 refactor(compiler): Rename slot -> handle in slot consumers (#52464)
This name is a bit more precise, and avoids the `foo.slot.slot` "stuttering access" on consumers.

PR Close #52464
2023-11-02 10:58:47 -07:00
Dylan Hunn
6347e0ebf4 refactor(compiler): Move an enum to enums.ts for Template Pipeline (#52464)
This enum belongs in the main enums file.

PR Close #52464
2023-11-02 10:58:47 -07:00
Dylan Hunn
3cd86f4cfc refactor(compiler): Delete an unused OpKind in template pipeline. (#52464)
`DeferSecondaryBlock` is no longer used.

PR Close #52464
2023-11-02 10:58:47 -07:00
Dylan Hunn
df40843dc0 refactor(compiler): Replace cpl with job in template pipeline (#52464)
Eliminate all the remaining `cpl` names, and use `job` instead, which is the predominant convention.

Also, replace `.views.values()` with `.unit` in a few places, and perform the corresponding rename.

PR Close #52464
2023-11-02 10:58:47 -07:00
Dylan Hunn
84ceb74f6c refactor(compiler): Rename and comment template pipeline phases (#52464)
In this cleanup commit:
1. Add explanatory comments to all phases that were previously missing them.
2. Rename all phases, to eliminate the "phase" prefix, and directly describe their functions.

PR Close #52464
2023-11-02 10:58:47 -07:00
Angular Robot
8f045c1f45 build: update peter-evans/create-or-update-comment digest to 23ff157 (#52279)
See associated pull request for more information.

PR Close #52279
2023-11-02 10:43:16 -07:00
Angular Robot
0045f02ed3 build: update actions/checkout digest to b4ffde6 (#52252)
See associated pull request for more information.

PR Close #52252
2023-11-02 10:32:11 -07:00
arturovt
a02a745a4a fix(animations): remove finish listener once player is destroyed (#51136)
This commit removes the `finish` listener from the Animation object once
the animation is finished, effectively resolving a memory leak. Previously,
the `finish` listener captured `this`, which prevented `this` from being garbage collected.

PR Close #51136
2023-11-02 10:29:38 -07:00
Alex Rickabaugh
664099b50e refactor(core): add a flag for whether we skip logic in checkNoChanges (#52488)
This can be used to patch different behavior in g3.

PR Close #52488
2023-11-01 21:43:21 -07:00