Commit graph

1059 commits

Author SHA1 Message Date
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
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
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
Matthieu Riegler
3171d01452 fix(compiler): fix detection of directive deps in JIT (#62666)
This fix also matches the implementation to the jsdoc for `hasDirectiveDependencies` "Whether any of the component's dependencies are directives"

fixes #62573

PR Close #62666
2025-07-17 14:20:31 -04:00
Kristiyan Kostadinov
6dc29b3bf7 refactor(core): expose function to assert type of variables (#62648)
Adds the `ɵassertType` function that will be used during type checking to assert the type of a value.

PR Close #62648
2025-07-16 12:40:25 +02:00
Shuaib Hasan Akib
664ed95a4f refactor(core): update NG0303 error message (#62363)
This adds mention of the `input()` signal function
to the error message.

PR Close #62363
2025-06-30 08:15:11 +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
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
dfbdbbe882 refactor: use zone.js from npm instead of packages/zone.js throughout repo (#61977)
Use zone.js from npm isntead of from the repo going forward

PR Close #61977
2025-06-10 12:02:03 -07: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
Andrew Scott
971981e1df fix(core): TestBed.tick should ensure test components are synchronized (#61382)
This ensures that `TestBed.tick` updates any components created with
`TestBed.createComponent`, regardless of whether autoDetectChanges is
on.

PR Close #61382
2025-05-21 15:02:52 +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
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
Pawel Kozlowski
0859a99e89 refactor(core): replace TestBed.flushEffects with tick (#60959)
Instead of stabilizing the TestBed.flushEffects() API we intend to
replace it with the tick() method (equivalent of ApplicationRef.tick().
The reasoning here is that we prefer tests running the entire
synchronization process (as in production apps) instead of invoking
parts of the synchronization process in a way that would naver happen
in a running application.

PR Close #60959
2025-04-23 09:54:30 +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
6c2fbad8a2 refactor(core): Improve NG0600 error message. (#60418)
This commit adds the mention of templates as illegal context to write signals.

fixes #60143

PR Close #60418
2025-04-22 16:35:38 +02: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
Alex Rickabaugh
a611b234d7 fix(core): run root effects in creation order (#60534)
Previously, the order in which root effects were executed was
non-deterministic and relied on the order in which signal graph dirty
notifications were propagated. With this commit, root effects are always run
in creation order.

PR Close #60534
2025-04-02 18:24:40 +00:00
Enea Jahollari
5db7e4cabb refactor(core): improve the messaging on effect manualCleanup option (#60426)
We always needs to pass an injector to an effect if it's used outside the injection context, even when manualCleanup option is true.

PR Close #60426
2025-04-01 14:07:03 +00:00
Alex Rickabaugh
43cbc58254 fix(core): remove forceRoot flag for effects (#60535)
This flag is effectively unused in Angular code that we've seen, and is only
serving to complicate the mental model of effects. It could be reintroduced
if needed.

PR Close #60535
2025-03-31 18:08:07 +00:00
Kristiyan Kostadinov
9c106f4401 refactor(core): introduce domProperty instruction (#60608)
Renames the `hostProperty` instruction to `domProperty` since it's not really host-specific and we can use it for other DOM-specific operations in the future.

PR Close #60608
2025-03-31 13:15:19 +00:00
Matthieu Riegler
217f6d96ba refactor(core): run effect cleanup as untracked (#60421)
A effect cleanup should not be considered reactive.

fixes #57757

PR Close #60421
2025-03-26 20:35:45 -07:00
Andrew Kushnir
ae047c59c0 refactor(core): convert scripts within packages/core/test to relative imports (#60227)
This commit updates scripts within `packages/core/test` to relative imports as a prep work to the
upcoming infra updates.

PR Close #60227
2025-03-25 10:58:00 -07:00
Kristiyan Kostadinov
5e209cb560 feat(core): remove TestBed.get (#60414)
`TestBed.get` isn't type safe and has been deprecated for several years now. These changes remove it from the public API and a follow-up change will add an automated migration to `TestBed.inject`.

BREAKING CHANGE:
* `TestBed.get` has been removed. Use `TestBed.inject` instead.

PR Close #60414
2025-03-19 15:52:26 +01:00
Kristiyan Kostadinov
611baaf069 feat(core): remove InjectFlags from public API (#60318)
Removes the deprecated `InjectFlags` symbol from the `@angular/core` public API, as well as all the places that accept it. The previous commit includes an automated migration to switch over to the new way of passing in flags.

BREAKING CHANGE:
* `InjectFlags` has been removed.
* `inject` no longer accepts `InjectFlags`.
* `Injector.get` no longer accepts `InjectFlags`.
* `EnvironmentInjector.get` no longer accepts `InjectFlags`.
* `TestBed.get` no longer accepts `InjectFlags`.
* `TestBed.inject` no longer accepts `InjectFlags`.

PR Close #60318
2025-03-11 11:33:09 -07:00
Andrew Scott
338818ce89 fix(core): Surface errors from ApplicationRef.tick to callsite (#60102)
This commit ensures that errors during `ApplicationRef.tick` are
surfaced to the callsite rather than being caught and reported to the
`ErrorHandler`.

The current catch and report approach was originally
added in e263e19a2a
with the goal of preventing automatic change detection crashes due to
the error happening in the subscription. However, this results in hiding
a public API that can hide errors. Callers cannot assume that the tick
was successful and perform follow-up work.

This change now surfaces errors and adds the error handling directly to
the callsites.

BREAKING CHANGE: `ApplicationRef.tick` will no longer catch and report
errors to the appplication `ErrorHandler`. Errors will instead be thrown out of
the method and will allow callers to determine how to handle these
errors, such as aborting follow-up work or reporting the error and
continuing.

PR Close #60102
2025-03-10 08:17:14 -07:00
Andrew Scott
02cb7e061a refactor(core): remove microtask effect (#60234)
This has been removed internally and was never exposed externally (it was a breaking change)

PR Close #60234
2025-03-06 12:48:55 -08:00
Pawel Kozlowski
39b324de67 refactor(core): drop render-related perf counters (#60200)
It looks like we are not getting enough value from having
those counters. This is an exploratory PR to see if thsoe
could be removed.

PR Close #60200
2025-03-06 10:33:54 -08:00
iteriani
ac94604ef2 refactor(core): Remove the optional flag from Injector and all casts. (#60154)
Note that this does NOT use the retrieve method yet. I believe we need to move the logic for notFoundValue into the inject implementation.

PR Close #60154
2025-03-05 13:43:59 -08:00
Kristiyan Kostadinov
22d13bfba7 refactor(core): track match index of directives (#60075)
If we want to target an input write to a directive, we have to know the index at which its instance is stored. Technically we can already find this by looking through `TView.data`, but that'll require a linear lookup for each write which can get slow.

These changes introduce the new `TNode.directiveToIndex` map which allows us to quickly find the index of a directive based on its definition, as well as any host directives that its might've brought in.

PR Close #60075
2025-02-25 10:58:50 -05:00
Kristiyan Kostadinov
4853129a7d test(core): clean up explicit standalone flags from tests (#60062)
Now that standalone is the default, we don't need to specify it in tests anymore.

PR Close #60062
2025-02-24 11:27:44 -05:00
Kristiyan Kostadinov
9f44b41053 refactor(core): separate host directive inputs from selector-matched ones (#60036)
Currently `TNode.inputs`/`TNode.outputs` store all of the available bindings on that node, no matter if they came from a directive that the user applied directly or from a host directive. This has a couple of drawbacks:
1. We need to store more information that necessary. For example, the only reason we have strings in the arrays is to facilitate host directive aliasing.
2. It doesn't allow us to distinguish which host directives belong to which selector-matched directives.

These changes are a step towards resolving both issues by storing the host directive binding information in separate data structures.

PR Close #60036
2025-02-21 14:07:34 -05:00
Kristiyan Kostadinov
db530856a8 refactor(compiler): remove input transforms feature (#59980)
An earlier refactor made the `InputTransformsFeature` a no-op so these changes remove the code that was generating it.

PR Close #59980
2025-02-18 19:27:59 +00:00
Kristiyan Kostadinov
86086604f4 refactor(core): remove inputTransforms from definition (#59980)
Removes the `inputTransform` from the directive definition since this information is already available on the `inputs`.

PR Close #59980
2025-02-18 19:27:59 +00:00
Kristiyan Kostadinov
b8ad4c2117 refactor(core): simplify how inputs are stored in the directive definition (#59980)
Currently the values in `DirectiveDef.inputs` are either strings or arrays, depending if there are flags. This makes it a bit hard to work with, because each time it's read, the consumer needs to account for both cases.

These changes rework it so the values are always an arrays.

PR Close #59980
2025-02-18 19:27:59 +00:00
Pawel Kozlowski
c076b57986 refactor(core): move LContainer manipulation logic to its own file (#59856)
All the view in a container logic is in the
packages/core/src/render3/view/container.ts file
plus some other associated refactorings.

PR Close #59856
2025-02-18 15:41:42 +00:00
Kristiyan Kostadinov
146ab9a76e feat(core): support TypeScript 5.8 (#59830)
Updates the repo to support TypeScript 5.8 which is currently in beta.

PR Close #59830
2025-02-03 14:00:41 -08:00
Pawel Kozlowski
9af14b25d1 refactor(core): simplify attributes extraction logic for ComponentRef (#59678)
Make extractAttrsAndClassesFromSelector to return TAttributes directly to
simplify the overall logic and remove unecessary code.

PR Close #59678
2025-01-27 13:15:21 +01:00
Pawel Kozlowski
76c4a77af7 refactor(core): move TNode manipulation logic to its own file (#59601)
Move TNode manipulation logic to its own file and update existing refereces.

PR Close #59601
2025-01-21 10:48:44 -08:00
Matthieu Riegler
5c0d68804e fix(core): Ensure that a destroyed effect never run. (#59415)
Prior to this change, a scheduled root effect, even if destroyed instantly, would still run at least once.

This commit fixes this.

fixes #59410

PR Close #59415
2025-01-08 16:40:44 +00:00
Kristiyan Kostadinov
57f3550219 feat(core): add utility for resolving defer block information to ng global (#59184)
Adds the `getDeferBlocks` function to the global `ng` namespace which returns information about all `@defer` blocks inside of a DOM node. This information can be useful either directly in the browser console or to implement future functionality in the dev tools.

PR Close #59184
2024-12-16 10:26:43 -08:00
Kristiyan Kostadinov
d010e11b73 feat(core): add event listener options to renderer (#59092)
Updates the `Renderer2.listen` signature to accept event options, as well as all adjacent types to it.

PR Close #59092
2024-12-10 13:39:47 -08:00
hawkgs
0513fbc9fc docs: set syntax highlighting of code examples MD code blocks (#59026)
Set the syntax highlighting based on the code examples' language.

PR Close #59026
2024-12-04 17:30:28 +01:00
AleksanderBodurri
ec386e7f12 feat(core): introduce debugName optional arg to framework signal functions (#57073)
Angular DevTools is working on developing signal debugging support. This commit is a step in the direction of making available debug information to the framework that will allow Angular DevTools to provide users with more accurate information regarding the usage of signals in their applications.

Follow up PRs that will use this arg will:
- Develop a typescript transform that will detect usages of signal functions and attempt to add a debugName without the user needing to specify one directly
- Develop debug APIs for discovering signal graphs within Angular applications (using debugName as a way to label nodes on the graph)

PR Close #57073
2024-10-22 11:26:37 -07:00
Alex Rickabaugh
7f0b49d8c4 refactor(core): update effect error handling (#57952)
Previously, effect() would handle errors differently depending on the effect
type. Root effects had a try/catch that would execute them independently and
report errors to `ErrorHandler`, while component effects would "crash" CD.

This commit switches all effects to use the same error handling (errors
always reach the CD error handler).

An additional unrelated refactoring is thrown in which removes the
`pendingTask` machinery from root effects, since they make `ApplicationRef`
dirty and thus trigger the scheduler.

PR Close #57952
2024-10-15 13:02:10 -07:00
Matthieu Riegler
a34090bc71 refactor(compiler): dynamic default for the partial compiler. (#58169)
Use `semver` in the partial compiler to decide on a default value

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

PR Close #58169
2024-10-15 16:05:14 +00:00
Matthieu Riegler
09df589e31 refactor(core): Migrate all packages with the explicit-standalone-flag schematic. (#58160)
All components, directives and pipes will now use standalone as default.
Non-standalone decorators have now `standalone: false`.

PR Close #58160
2024-10-14 14:58:57 +00:00