Commit graph

3359 commits

Author SHA1 Message Date
Kristiyan Kostadinov
f901cc9eb3 perf(compiler): chain query creation instructions
We always emit the query creation instructions in a group which makes them good candidates for chaining.

(cherry picked from commit ae1c0dc490)
2025-12-09 09:24:41 -08:00
Matthieu Riegler
10bdae9098 build: enable angular formatting on all html files
This should also be safe on any html file that isn't an angular template

(cherry picked from commit 9d1d742f1b)
2025-12-08 10:19:50 -08:00
Joey Perrott
c3bd22d10d
build: update cross-repo angular dependencies
See associated pull request for more information.
2025-12-04 11:26:14 -08:00
Leon Senft
609699ae17 perf(core): tree shake unused dynamic [field] binding instructions (#65599)
Move the instructions used to dynamically bind a `Field` directive to a
form control onto the `Field` itself. This way the instructions are only
retained if the app uses the `Field` directive.

PR Close #65599
2025-12-03 15:10:50 +01:00
Leon Senft
a5dbd4b382 fix(forms): support dynamic [field] bindings (#65599)
Support binding a `Field` directive to a component created dynamically
with `createComponent()`.

Fix #64632

PR Close #65599
2025-12-03 15:10:49 +01:00
Kristiyan Kostadinov
4bb085311e fix(core): unable to inject viewProviders when host directive with providers is present
When registering providers, the DI system assumes that `viewProviders` are registered before plain `providers`. This was reinforced by components always being first in the array of directive matches, only one component being allowed per node and the fact that only components can have `viewProviders`.

This breaks down if there are host directives with `providers` on the component, because they'll execute earlier, throwing off the order of operations.

These changes fix the issue by separating out the resolvers for `viewProviders` and plain `providers` and explicitly running the component's `viewProviders` resolver before any others. This also has the benefit of not attempting to resolve `viewProviders` for directives which are guaranteed not to have them.

Fixes #65724.

(cherry picked from commit 886cf6c452)
2025-12-03 15:09:53 +01:00
Andrew Scott
c2a8934d12 Revert "refactor(router): compress synchronous end to router navigation to single operator"
This reverts commit 71362733cf.
2025-12-02 19:13:07 +01:00
Andrew Scott
71362733cf refactor(router): compress synchronous end to router navigation to single operator
The end of the Router navigation is a block of synchronous logic that
can be compressed into a single operator rather than splitting it across
several, making it harder to step through. The only benefit from the
split is automatic unsubscribe/cancellation, which we can replicate
with an additional 'shouldContinue' check before proceeding.

(cherry picked from commit b7d21e209a)
2025-12-02 16:44:06 +01:00
Jessica Janiuk
8c3304c766 fix(core): run animation queue in environment injector context
In the case that a component injector is destroyed before the animation
queue runs, the animation queue would fail to run because it was using a
destroyed injector. This commit changes the animation queue to run in the
context of the EnvironmentInjector, which is not destroyed until the app
is destroyed.

fixes: #65628
(cherry picked from commit d8ab83ca82)
2025-12-02 15:05:21 +01:00
Angular Robot
706d7620e8 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-12-01 19:36:18 +01:00
Alan Agius
78fd159b78 fix(compiler): prevent XSS via SVG animation attributeName and MathML/SVG URLs
This commit implements a security fix to prevent XSS vulnerabilities where SVG animation elements (`<animate>`, `<set>`, etc.) could be used to modify the `href` or `xlink:href` attributes of other elements to `javascript:` URLs.

(cherry picked from commit 1c6b0704fb)
2025-12-01 10:27:00 +01:00
Leon Senft
0ae14cb746 test(core): test bundling of dynamic component creation and bindings
Add test coverage for bundling dynamic component creation API like
`createComponent()` and `inputBinding()`. This will be used to test that
Signal Forms related features for #64632 can be tree-shaken when unused.

(cherry picked from commit add8c41e5b)
2025-11-26 11:57:18 -05:00
Alan Agius
908b5a41a3 refactor: replace getDocument() with inject(DOCUMENT)
This replaces `getDocument()` with `inject(DOCUMENT)` across hydration and transfer state logic.

(cherry picked from commit 400fc82c43)
2025-11-25 13:05:01 -05:00
Alan Agius
49ad7c6508 fix(core): use injected DOCUMENT for CSP_NONCE
This ensures that the right document is used and that `CSP_NONCE` can be used in `provideAppInitializer` and `provideEnvironmentInitializer`.

Closes #65624

(cherry picked from commit 3b1fa8235b)
2025-11-25 11:39:23 -05:00
Kristiyan Kostadinov
70507b8c1c fix(core): debug data causing memory leak for root effects
We track all effects that are created for debugging purposes in the `resolverToEffects` map. This ends up leaking memory for effects registered on long-living resolvers (e.g. on the root injector), because they stay in the array, even if the effect itself has been destroyed.

These changes add a callback to clean up the references.

Fixes #65265.

(cherry picked from commit ca6ab6c914)
2025-11-24 15:26:12 -05:00
Leon Senft
4845a33018 refactor(forms): support custom control directives
Support binding `[field]` to directives that implement
`FormValueControl` or `FormCheckboxControl`.

The `[field]` binds to whichever directive (or component) matches first in the
event there are multiple implementations. We are considering whether to make
this an error state, which could be reported during type checking.

Closes #63910, Closes #64992

(cherry picked from commit f97a1d4856)
2025-11-24 13:48:20 -05:00
Kristiyan Kostadinov
290513f5b6 test: remove unnecessary test calls
Removes calls to `TestBed.configureTestingModule` since they aren't necessary.

(cherry picked from commit 26e2092dd1)
2025-11-24 10:18:21 -05:00
JoostK
d7484f0519 refactor(core): let the profiler handle asymmetric events leniently
Although the prior commit has made more profiler events guaranteed symmetric
through the use of finally-blocks, there continue to be some situations
that could potentially result in asymmetric events, e.g. application
bootstrap doesn't guarantee symmetric events. This commit makes the profiler
lenient to these situations by unrolling the stack past the asymmetric event
data, eventually reaching the expected start event.

(cherry picked from commit 913cde8ab4)
2025-11-20 12:30:02 -05:00
JoostK
a55482fca3 fix(core): notify profiler events in case of errors
Profiler events are expected to be symmetric, yet in the case of errors this symmetry may break
if events aren't always kept in sync with their corresponding start event. This commit moves
various end events to be run from a finally-block, allowing them to notify the profiler even
when an error has occurred.

Fixes #62947

(cherry picked from commit 3760045e3e)
2025-11-20 12:30:02 -05:00
tsc036
2bf0c52775 refactor(core): export profile event as enum and move profile_types.ts and framework to shared devtools folder
move framework enum and profile_types to a shared folder so it can be used by wiz

(cherry picked from commit 34e1fe235f)
2025-11-19 23:22:53 +00:00
Angular Robot
e0026c870a build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-19 15:08:39 -08:00
Kristiyan Kostadinov
cc1ec09931 perf(core): avoid repeat searches for field directive
The `getControlDirective` is called multiple times, both at init and during each update run. Under the hood it performs a linear search for the `Field` directive.

We can speed this up by finding its index once and reusing it since the array of directive matches is static.

(cherry picked from commit 5e6d8573f4)
2025-11-19 22:28:59 +00:00
Angular Robot
77fc03ffb6 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-18 15:29:10 -08:00
Angular Robot
1b43bfbbab build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-17 16:35:53 -08:00
Jessica Janiuk
127cadd3fc Revert "refactor(core): let the profiler handle asymmetric events leniently"
This reverts commit da9911f2b4.

(cherry picked from commit 88dfd96ec9)
2025-11-17 18:10:41 +00:00
Jessica Janiuk
e430d69603 Revert "fix(core): notify profiler events in case of errors"
This reverts commit af1ba52587.

(cherry picked from commit adc2a57be0)
2025-11-17 18:10:41 +00:00
JoostK
780e37241f refactor(core): let the profiler handle asymmetric events leniently
Although the prior commit has made more profiler events guaranteed symmetric
through the use of finally-blocks, there continue to be some situations
that could potentially result in asymmetric events, e.g. application
bootstrap doesn't guarantee symmetric events. This commit makes the profiler
lenient to these situations by unrolling the stack past the asymmetric event
data, eventually reaching the expected start event.

(cherry picked from commit da9911f2b4)
2025-11-17 17:40:10 +00:00
JoostK
7ada2519f1 fix(core): notify profiler events in case of errors
Profiler events are expected to be symmetric, yet in the case of errors this symmetry may break
if events aren't always kept in sync with their corresponding start event. This commit moves
various end events to be run from a finally-block, allowing them to notify the profiler even
when an error has occurred.

Fixes #62947

(cherry picked from commit af1ba52587)
2025-11-17 17:40:10 +00:00
Angular Robot
74b95dec3b build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-14 15:35:56 -08:00
Angular Robot
84bf0d26bf build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-14 08:33:42 -08:00
Kristiyan Kostadinov
afda85f24c refactor(core): remove unused type
Removes the `ExtractFromControlValue` type since it won't be necessary anymore.

(cherry picked from commit 14152f69b9)
2025-11-12 21:13:51 +00:00
Angular Robot
eb9034d4a8 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-12 11:56:11 -08:00
Alan Agius
7811d95b89 refactor(core): improve resource loading with async/await
Refactor  to use async/await for clearer asynchronous operations and enhanced error handling.
Simplify resource caching and streamline the resolution of component templates and styles.
Update  in the router to align with the new async resource resolution.

(cherry picked from commit 4ed8781301)
2025-11-11 12:50:19 -08:00
Kristiyan Kostadinov
20319fea85 refactor(compiler): remove unused code
The `fullInheritane` flag from the metadata and the `CopyDefinitionFeature` that it controls appear to no longer be used since `fullInheritance` is always false. The feature appears to have been there to support ngcc which was removed some time ago.

(cherry picked from commit 8277906455)
2025-11-11 10:04:32 -08:00
arturovt
a8b123c18d refactor(core): tree-shake REF_EXTRACTOR_REGEXP (and dependencies)
`new RegExp()` with computed strings can't be analyzed statically. The bundler can't prove the template string evaluation has no side effects; as thus this expression is considered a side-effect.

(cherry picked from commit 7f95f02d05)
2025-11-10 07:48:42 -08:00
tsc036
e69ada4ceb refactor(core): move profile_types.ts to primtives
move profile_types.ts so the types can be used in Wiz code

(cherry picked from commit cf47ce2db9)
2025-11-06 22:22:38 +00:00
SkyZeroZx
593f902f24 refactor(platform-browser): remove unused Platform ID dependency from DomRendererFactory2
Eliminates the unnecessary injection and usage of Platform ID in the renderer factory logic, along with related test scaffolding cleanup

(cherry picked from commit 5343001835)
2025-11-06 20:00:50 +00:00
arturovt
e90f9e418c refactor(forms): tree-shake ngControlStatusHost and ngGroupStatusHost
This commit removes `ngGroupStatusHost` variable because it's a side-effect, ending up preserving `ngControlStatusHost` and `ngGroupStatusHost`.

(cherry picked from commit 9f76fb61df)
2025-11-06 18:57:48 +00:00
Alan Agius
3bed9f0f16
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:07:13 -08:00
Angular Robot
f0ffd9bebd build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-05 15:26:25 -08:00
Kristiyan Kostadinov
6df098f76c refactor(core): add utility type for extracting the value of a custom control
Adds the `ɵExtractFormControlValue` type that we can use during template type checking to extract the type of a custom control.

(cherry picked from commit 4b68bddd62)
2025-11-05 09:35:50 -08:00
Jessica Janiuk
a453d603c0 fix(core): skip leave animations on view swaps
We accounted for skipping leave animations during moves, but not swaps.
This accounts for the swap cases and updates how we deal with swaps and
moves. Now we always queue animations and then essentially dequeue them
if we attach them back in the same render pass.

fixes: #64818
fixes: #64730
(cherry picked from commit 373d263834)
2025-11-05 09:04:21 -08:00
Angular Robot
c721de112c build: update cross-repo angular dependencies (#64781)
See associated pull request for more information.

PR Close #64781
2025-10-30 17:47:12 +00:00
Matthieu Riegler
20b4b2c43c refactor(core): expose isWritableSignal to the publicApi
This is alongside the already exisiting isSignal()

fixes #64763

(cherry picked from commit 76adbbcd0a)
2025-10-29 13:31:53 -07:00
Matthieu Riegler
4f21ea72cb refactor(compiler-cli): Remove deep imports of compiler-cli in angular/core
migration schematics will pull from `compiler-cli/private/migrations`
core tests will pull from `compiler-cli/private/testing`

(cherry picked from commit 8e50cdb930)
2025-10-28 15:58:59 +01:00
Andrew Scott
d303cde96d refactor(core): Remove zone toggles for test and standalone
The migration is complete internally. All that remains is bootstrapModule

(cherry picked from commit a253739ac8)
2025-10-28 15:58:02 +01:00
Matt Lewis
54ad2304e3 fix(core): Clear lView from IcuIteratorState when stack is empty to prevent memory leak
If a component template contains an icu expression it is being retained until the next change detection cycle for that template. This results in a net retention of only ever a single copy of the given lView but that creates an opportunity for compounding leaks.

Change the icu i18n_icu_container_visitor to free the IcuIteratorState retained lView when the stack is empty so that garbage collection can occur when the view is discarded.

(cherry picked from commit 59e648913c)
2025-10-27 19:42:22 +01:00
Miles Malerba
aa389a691b fix(core): ensure @for iteration over field is reactive (#64113)
When working with a proxy object such as signal forms' `Field`,
accessing the `lenght` or `Symbol.iterator` may trgger a reactive read.
This change ensures that `@for` properly captrues this before clearing
the active consumer.

PR Close #64113
2025-10-24 09:29:29 +02:00
Angular Robot
4ce1ffc65c build: update cross-repo angular dependencies (#64623)
See associated pull request for more information.

PR Close #64623
2025-10-23 18:23:56 +02:00
Jessica Janiuk
81bd671906 fix(core): prevent duplicate nodes from being retained with fast animate.leave` calls (#64592)
We were clearing duplicate nodes when `animate.enter` fired fast, but not when solely `animate.leave` is fired and rapid toggles occur. This ensures that the `cancelLeavingNodes` function is called in all cases instead of just enter animations.

fixes: #64581

PR Close #64592
2025-10-22 19:07:34 +00:00