Commit graph

946 commits

Author SHA1 Message Date
Jessica Janiuk
de3a0c5cf3 fix(core): Fix animate.enter class removal when composing classes (#62981)
In the case when composing animation classes with `animate.enter` on the
element itself and also with host bindings, the removal would only
have context for one of the classes added: the last one added. This
allows for tracking of the classes added by `animate.enter` via a
WeakMap so we know the exact classes added and which to remove.

Also shores up the tests to make sure we are fully testing animate.enter.

PR Close #62981
2025-08-05 10:06:28 +02:00
Jessica Janiuk
6597ac0af7 fix(core): fix support for space separated strings in leave animations (#62979)
Space separated strings, e.g. `class-1 class-2`, should work with both enter and leave animations. `animate.leave` lost that functionality in a refactor. Tests are now added to catch this.

fixes: #62964

PR Close #62979
2025-08-04 12:24:11 +02:00
Jessica Janiuk
857675fedb refactor(core): this delays removal of stylesheets when the element registry is present (#62943)
When animate.leave is used, stylesheet pruning causes issues. Stylesheets with the appropriate animations get pruned before the animations can run. This will delay the removal in the case that the registry is present.

fixes: #62942

PR Close #62943
2025-08-01 12:54:22 +00:00
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Jessica Janiuk
898244a03a refactor(core): add configurable behavior for animations to testbed (#62764)
This adds a test module configuration to define whether animations should be enabled or disabled in test. By default, they are disabled.

PR Close #62764
2025-07-29 09:49:35 +00:00
Joey Perrott
32c00ab416 build: standardize usage of js_binary (#62860)
Remove usages of nodejs_binary and use a commonly defined js_binary macro

PR Close #62860
2025-07-29 06:43:44 +02:00
Kristiyan Kostadinov
7767aa640c fix(compiler): allow more characters in square-bracketed attribute names (#62742)
Currently the HTML parser will stop parsing as soon as it hits an end character in the name of an attribute (e.g. `/` or `>`). This ends up being problematic with some third-party packages like Tailwind which uses a wider range of characters for its class names. While the characters are fine when inside the `class` attribute, our current parser behavior prevents users from setting those classes conditionally through `[class.]` bindings.

These changes adjust the parser to handle such cases.

Fixes #61671.

PR Close #62742
2025-07-23 11:06:47 -04:00
Jessica Janiuk
882522c1ad refactor(compiler): Tree shake Element Registry (#62682)
This creates a feature to detect usages of animate.leave and only enables the element removal registry when necessary

PR Close #62682
2025-07-23 09:37:16 -04:00
Jessica Janiuk
6b1f4b9e8b feat(core): add enter and leave animation instructions (#62682)
This adds the instructions to support enter and leave animations on nodes.

PR Close #62682
2025-07-23 09:37:16 -04:00
Leon Senft
4138aca91f feat(core): render ARIA property bindings as attributes (#62630)
Allow binding to ARIA attributes using property binding syntax _without_
the `attr.` prefix. For example, `[aria-label]="expr"` is now valid, and
equivalent to `[ariaLabel]="expr"`. Both examples bind to either a
matching input or the `aria-label` HTML attribute, rather than the
`ariaLabel` DOM property.

Binding ARIA properties as attributes will ensure they are rendered
correctly on the server, where the emulated DOM may not correctly
reflect ARIA properties as attributes.

Reuse the DOM schema registry from the compiler to map property names in
type check blocks.

PR Close #62630
2025-07-22 06:59:00 -04:00
Joey Perrott
8bf97d1370 build: remove all usages of the interop_deps attr for ts_project and ng_project (#62732)
Remove all of the usages of interop_deps as attributes in the repo

PR Close #62732
2025-07-21 13:03:09 -04:00
aparziale
780774f948 fix(core): InputBinding marks component a dirty. (#62613)
This fix ensures that CD runs on OnPush component when an input binding is set.

PR Close #62613
2025-07-14 15:46:29 -07:00
Andrew Kushnir
96014b5f85 refactor(core): include DI path into cyclic dependency error message (#50902)
This commit updates the logic to better handle a situation when there is a cyclic DI dependency detected. Previously, the error message used to contain the name of the token that triggered the problem. With this change, the DI resolution path would also be included, so that it's easier to find and resolve the cycle.

PR Close #50902
2025-07-10 10:35:12 -07:00
Kristiyan Kostadinov
8fbe558cbc perf(core): move property remapping for dom properties to compiler (#62421)
Since we know that DOM properties won't go to an inputs, we can move the remapping logic to the compiler, saving us some processing on the client.

PR Close #62421
2025-07-02 14:28:12 +00:00
Joey Perrott
b84859073b build: migrate to use web test runner rules (#62292)
Migrate karma tests throughout the repo to use the new web test runner based rule instead

PR Close #62292
2025-06-26 17:19:10 +00:00
Kristiyan Kostadinov
0dcf230d52 feat(compiler): add support for new binary assignment operators (#62064)
Updates the remainder of the compiler to handle the new assignment operators and sets up more tests, including for the runtime.

PR Close #62064
2025-06-23 14:23:29 +02:00
Joey Perrott
3a0cfd544d build: migrate to using new jasmine_test (#62086)
Use the new jasmine_test based on rules_js instead of jasmine_node_test from rules_nodejs

PR Close #62086
2025-06-18 08:27:26 +02:00
Paul Gschwendtner
a137746110 build: migrate packages/core/test to new jasmine_test rule (#61902)
Migrates `packages/core/test` to the new `jasmine_test` rule. As part of
this, we are also removing an unnecessary/unused test fixture.

PR Close #61902
2025-06-12 10:00:09 +02:00
Joey Perrott
9354efc86a build: remove unnecessary zone.js dep from various build targets (#61901)
Remove unnecessary zone.js dep from various build targets

PR Close #61901
2025-06-05 09:12:27 -07:00
kristilw
3aa933acb7 fix(core): components marked for traversal resets reactive context (#61663)
when marked for traversal the reactive context has to be set to null to avoid inheriting the reactive context of the parent component

PR Closes #61662

PR Close #61663
2025-06-05 14:49:01 +02:00
kristilw
ee6388d2a0 refactor(core): update tests to use standalone (#61663)
update tests to use standalone components for easier test setup

PR Close #61663
2025-06-05 14:49:01 +02:00
AleksanderBodurri
9a8f4f14aa fix(core): properly handle the case where getSignalGraph is called on a componentless NodeInjector (#60772)
Previously this would throw an error on the assertLView when we try to discover the templateLView.

Now this properly returns null for the template consumer and continues discovering other effects on the injector.

PR Close #60772
2025-06-04 12:16:47 -04:00
AleksanderBodurri
3a9a70de08 refactor(compiler-cli): implement transform to determine debugName from signal functions (#57348)
Implements a compiler transform that attempts to statically analyze variable names and apply them to usages of signal functions like signal, computed, effect, etc.

PR Close #57348
2025-06-03 20:34:12 -04:00
Matthieu Riegler
fe03aa09ad Revert "fix(core): call DestroyRef on destroy callback if view is destroyed (#58008)" (#61625)
This reverts commit 5f7f04634f.

PR Close #61625
2025-05-27 15:21:20 -07:00
arturovt
9a9511ace8 refactor(platform-browser): replace isPlatformServer with ngServerMode (#59496)
In this commit, we switch from using the `isPlatformServer` runtime call to the `ngServerMode`.

Note: constructors haven't been touched in order to prevent any breaking changes for the public API.

PR Close #59496
2025-05-26 11:14:27 +00:00
Kristiyan Kostadinov
289ae50c56 refactor(core): replace propertyInterpolateX with property (#61639)
Replaces the `propertyInterpolateX` instructions with calls to `property` and the `interpolate` helper. This allows us to drop the dedicated interpolation instructions and simplify the runtime for future work.

PR Close #61639
2025-05-26 09:21:23 +00:00
Kristiyan Kostadinov
32ae421526 refactor(compiler): replace attribute interpolation instructions (#61557)
Replaces the attribute interpolation instructions with `attribute` plus the new `interpolateX` instruction. This allows to reduce our overall instruction footprint.

PR Close #61557
2025-05-21 15:13:47 +00:00
Matthieu Riegler
dba912dd07 refactor(platform-browser): replace platform-browser-dynamic with platform-browser (#61498)
The former isn't needed anymore and is now deprecated.

PR Close #61498
2025-05-21 14:01:49 +00:00
Paul Gschwendtner
082cc5579d build: migrate all ng_module in packages/core/test (#61472)
Migrates all `ng_module` to `ng_project` in `packages/core/test/`.

PR Close #61472
2025-05-20 10:00:43 +00:00
Paul Gschwendtner
8ead19fe00 build: migrate all ts_library in packages/core/test (#61472)
This commit migrates all `ts_library` in `package/core/test` to
`ts_project`, and fixes deep module, or relative imports inside.

PR Close #61472
2025-05-20 10:00:43 +00:00
Pawel Kozlowski
d9d9e42c23 fix(core): handle different DI token types in Chrome DevTools integration (#61333)
This small refactor makes the DI events reporting code more resiliant
with respect to finding names for different token types.

PR Close #61333
2025-05-15 10:15:32 -07:00
Kristiyan Kostadinov
f6bb6cc09a build: set up runtime tests for selectorless (#61307)
Sets up the tests for the selectorless runtime so that we can easily start writing them when we get to it. The tests need to be AoT compiled so they're defined as a separate target from the other `acceptance` tests.

PR Close #61307
2025-05-14 11:06:22 +02:00
Matthieu Riegler
3eeea56ba0 refactor(core): remove compileComponents invocations (#61032)
Those weren't necessary.

PR Close #61032
2025-05-09 10:27:14 -07:00
Paul Gschwendtner
54e785683a build: prepare for compiler-cli to be using ts_project (#61181)
Prepare the compiler-cli package for being ready for migration
to `ts_project`.

PR Close #61181
2025-05-09 15:59:46 +00:00
Kristiyan Kostadinov
583b9a7be5 fix(core): missing useExisting providers throwing for optional calls (#61137)
Fixes that the runtime was throwing a DI error when attempting to inject a missing `useExisting` provider, despite the call being optional.

The problem was that when the provider has `useExisting`, we do a second `inject` call under the hood which didn't include the inject flags from the original call.

Fixes #61121.

PR Close #61137
2025-05-06 09:12:38 -07:00
Pawel Kozlowski
d8fbb909ce feat(core): rename afterRender to afterEveryRender and stabilize (#60999)
This change renames the afterRender to afterEveryRender and marks the
renamed API as stable.

BREAKING CHANGE: afterRender was renamed to afterEveryRender.

PR Close #60999
2025-04-28 12:33:55 -07:00
Andrew Scott
e711f99d81 feat(core): move provideExperimentalCheckNoChangesForDebug to provideCheckNoChangesConfig (#60906)
This commit makes several changes changes to the
`provideExperimentalCheckNoChangesForDebug` API:

* Rename it
* Promote to dev preview
* Apply the exhaustive behavior to _all_ checkNoChanges runs
* Remove `useNgZoneOnStable` option. This wasn't found to be generally
  more useful than `interval`

fixes #45612

BREAKING CHANGE: `provideExperimentalCheckNoChangesForDebug` has several
breaking changes:
* It is renamed to `provideCheckNoChangesConfig`
* The behavior applies to _all_ checkNoChanges runs
* The `useNgZoneOnStable` option is removed. This wasn't found to be generally
  more useful than `interval`

PR Close #60906
2025-04-24 13:04:27 -07:00
Andrew Kushnir
c2987d8402 refactor(core): stop producing ng-reflect attributes by default (#60973)
BREAKING CHANGE:

This commit deprecates `ng-reflect-*` attributes and updates the runtime to stop producing them by default. Please refactor application and test code to avoid relying on `ng-reflect-*` attributes.

To enable a more seamless upgrade to v20, we've added the `provideNgReflectAttributes()` function (can be imported from the `@angular/core` package), which enables the mode in which Angular would be producing those attribites (in dev mode only). You can add the `provideNgReflectAttributes()` function to the list of providers within the bootstrap call.

PR Close #60973
2025-04-24 10:07:35 -07:00
Andrew Scott
953c4b2580 feat(core): Move zoneless change detection to dev preview (#60748)
This commit moves zoneless from experimental to developer preview.

* Update tag on provider API
* Remove "experimental" from provider name
* Move documentation from "experimental features" to "Best practives ->
  Performance" (at least temporarily until there is a better place)

BREAKING CHANGE: `provideExperimentalZonelessChangeDetection` is
renamed to `provideZonelessChangeDetection` as it is now "Developer
Preview" rather than "Experimental".

PR Close #60748
2025-04-23 11:47:56 +02:00
Matthieu Riegler
1b8e7ab9fe feat(compiler): support the in keyword in Binary expression (#58432)
This commit adds the support for the `in` keyword as a relational operator, with the same precedence as the other relational operators (<,>, <=, >=)

BREAKING CHANGE: 'in' in an expression now refers to the operator

PR Close #58432
2025-04-22 21:44:12 +02:00
Matthieu Riegler
36ae560765 refactor(core): remove the phase prop from AfterRenderOptions (#60641)
The `AfterRenderPhase` enum now becomes private, it isn't exported anymore.

PR Close #60641
2025-04-09 15:39:47 -07:00
Matthieu Riegler
0b69b61929 fix(core): Flush animations when no component has been checked (#58089)
When Angular runs application synchronization automatically, animations
are now guaranteed to be flushed, regardless of whether change detection
was run on any components attached to `ApplicationRef`. This most
frequently affects animations related to component removal where the DOM
element for the component would previously not be removed due to
animations not being flushed

BREAKING CHANGE: Animations are guaranteed to be flushed when Angular
runs automatic change detection or manual calls to `ApplicationRef.tick`.
Prior to this change, animations would not be flushed in some situations
if change detection did not run on any views attached to the
application. This change can affect tests which may rely on the old
behavior, often by making assertions on DOM elements that should have
been removed but weren't because DOM removal is delayed until animations
are flushed.

fixes #58075

PR Close #58089
2025-04-09 11:12:54 -07:00
Pawel Kozlowski
2b4fd9b273 refactor(core): allow multiple DI profilers (#60562) (#60562)
This commit changes the DI profiler infrastructure to
allow multiple profilers running at the same time.

PR Close #60562

PR Close #60562
2025-04-09 09:16:40 -07:00
Andrew Scott
b8d9f95faa Revert "refactor(core): allow multiple DI profilers (#60562)" (#60793)
This reverts commit 56cc5fdb57.

CI tests are consistently timing out after this commit

PR Close #60793
2025-04-08 14:04:16 -07:00
Pawel Kozlowski
56cc5fdb57 refactor(core): allow multiple DI profilers (#60562)
This commit changes the DI profiler infrastructure to
allow multiple profilers running at the same time.

PR Close #60562
2025-04-08 08:56:30 -07:00
arturovt
1c7b356625 fix(core): release hasPendingTasks observers (#59723)
In this commit, we unsubscribe the `hasPendingTasks` subject to remove all active observers and enable granular garbage collection, as users may forget to unsubscribe manually when subscribing to `isStable`.

PR Close #59723
2025-04-02 18:26:06 +00:00
arturovt
5f7f04634f fix(core): call DestroyRef on destroy callback if view is destroyed (#58008)
In this commit, we introduce the ability to check whether `lView` has already been
destroyed in `NodeInjectorDestroyRef`. If the `lView` is already destroyed, we call
the on-destroy callback immediately, without trying to register it to be called later.
This ensures that any necessary cleanup is handled gracefully and provides better
reliability in managing resources.

One of the use cases is `takeUntilDestroyed`, which aims to replace `takeUntil` in existing
applications. While `takeUntil` can be safely called once the view is destroyed—resulting
in no errors and finalizing the subscription depending on whether a subject or replay
subject is used—replacing it with `takeUntilDestroyed` introduces a breaking change, as
it throws an error if the `lView` is destroyed.

Related issue: #54527

PR Close #58008
2025-04-02 15:24:48 +00:00
Andrew Kushnir
84ba1ad878 refactor(core): drop unused ngDevMode metrics (#60686)
This commit updates the code to drop unused `ngDevMode` metrics and removes some related (and now unused) utility functions.

PR Close #60686
2025-04-02 14:17:10 +00:00
Andrew Scott
7b819be83f fix(core): Ensure errors in listeners report to the application error handler (#60251)
Practically speaking, this change ensures that Angular is able to make
decisions about what to do when an uncaught error happens.

For tests, this will mean that, by default, the error either causes the
`fixture.whenStable` promise to reject if there is one or rethrow the
error. This ensures tests do not accidentally ignore errors. Opting out
of this can be done with the `rethrowApplicationErrors: false` option in
`TestBed`.

For SSR, there may be additional behaviors in the future that we want to
add, such as redirecting to an error page or responding with a 500
status code.

BREAKING CHANGE: Uncaught errors in listeners which were previously only reported to
`ErrorHandler` are now also reported to Angular's internal error
handling machinery. For tests, this means that the error will be
rethrown by default rather than only logging the error. Developers
should fix these errors, catch them in the test if the test is
intentionally covering an error case, or use `rethrowApplicationErrors:
false` in `configureTestingModule` as a last resort.

PR Close #60251
2025-04-01 17:03:08 +00:00
Jessica Janiuk
d15fda3e03 Revert "refactor(core): allow multiple DI profilers (#60562)" (#60611)
This reverts commit b21c6e5ac5.

PR Close #60611
2025-03-28 17:25:43 +00:00