Commit graph

3679 commits

Author SHA1 Message Date
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
Matthieu Riegler
035e07e3be refactor(core): promote the custom track profiler to stable.
We didn't get much report on the feature itself so we feel confident about promoting it to stable. In parallel we'll also land #62959 but one is not blocking the other.

fixes #64996

(cherry picked from commit c15836c8c7)
2025-11-17 17:42:35 +00:00
Miles Malerba
6aa4b7ea63 refactor(forms): avoid console warnings when setting NaN
It can be useful for a developer to set `NaN` as the value for a number
input, as a way to say "clear the input". However, directly setting this
value to the `.valueAsNumber` causes a console warning. This PR fixes
the console warning by just doing `.value = ''` when we would otherwise
to `.valueAsNumber = NaN`

(cherry picked from commit f47637426f)
2025-11-17 17:41:32 +00:00
Leon Senft
e682f00e29 refactor(forms): reduce boilerplate needed to define custom controls
An early piece of feedback received regarding custom controls hosted on
native inputs was that they required a lot of boilerplate to bind
`FieldState` properties. Each property required an input to accept the
property, and a host binding to forward it to the native control.

(cherry picked from commit c727df5d38)
2025-11-17 17:41:02 +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
SkyZeroZx
a7dddcca51 docs: Adds links to relevant guides for APIs in core package
(cherry picked from commit 0432e76171)
2025-11-17 16:47:40 +00:00
SkyZeroZx
697f3616b1 docs: add documentation for HostAttributeToken
(cherry picked from commit d70310896c)
2025-11-17 16:47:03 +00:00
Leon Senft
d89e522a1f fix(forms): debounce updates from interop controls
* Apply any debounce rules to updates from interop controls (if configured).
* Add tests to ensure debouncing works for all control types (native, custom,
  and interop).

(cherry picked from commit b1037ec2f0)
2025-11-17 16:37:29 +00:00
SkyZeroZx
02061d4b81 docs: add documentation for DOCUMENT injection token usage in SSR
(cherry picked from commit 846d50ab23)
2025-11-17 16:28:05 +00:00
Kristiyan Kostadinov
67fbd5ff1e fix(core): SSR error in signal forms
Resolves an SSR error, because we weren't checking if `MutationObserver` is available.

(cherry picked from commit 3f80ae74ba)
2025-11-13 17:12:45 +00:00
Matthieu Riegler
0c27954a4d refactor(core): remove resource flag.
This was used to migrate G3 and is no longer necessary.

(cherry picked from commit d1ab73dd87)
2025-11-13 17:12:22 +00: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
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
Leon Senft
a278ee358c feat(forms): add debounce() rule for signal forms
The `debounce()` rule allows developers to control when changes to a
form control are synchronized to the form model.

This feature necessitated some changes to `FieldState`:

  * `controlValue` is a new signal property that represents the current
    value of a form field as it appears in its corresponding control.

  * `value` conceptually remains unchanged; however, its value may lag
    behind that of `controlValue` if a `debounce()` rule is applied.

The `debounce()` rule essentially manages when changes to `controlValue` are
synchronized to `value`. The intent is that an expensive or slow
validation rule can react to the debounced `value`, rather than a more
frequently changing `controlValue`.

Directly updating `value` immediately updates `controlValue`, and cancels any
pending debounced updates.

When multiple `debounce()` rules are applied to the same field, the last
currently active rule is used to debounce an update. These rules are
applied to child fields as well, unless they override them with their
own rule.

(cherry picked from commit d337cfb68f)
2025-11-11 12:00:13 -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
Matthieu Riegler
6213cbf1a8 refactor(core): rename ExperimentalIsolatedShadowDom to IsolatedShadowDom
This API is still experimental

(cherry picked from commit 21ca49cf62)
2025-11-11 08:46:10 -08:00
Matthieu Riegler
5e86299ec4 docs(docs-infra): Add support for experimental enum entries
(cherry picked from commit 16e61f5dd0)
2025-11-11 08:46:09 -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
Leon Senft
2667d8c23d refactor(forms): remove a TODO and simplify update on <select> mutations
Remove an unnecessary TODO comment. The native `<select>` tracks its
`value` by keeping track of the selected `<option>`. Thus if the value
was set *before* the corresponding option is created, the `<select>`
will ignore it, but the framework doesn't know that and will cache the
bound value anyways. Therefore, checking if the value changed since it
was last bound when the mutation that creates the selected `<option>`
occurs would in fact prevent a needed update, leaving the `<select>` and
field values out of sync.

Furthermore, we know the control type is a native `<select>` element, so
we can update its value directly instead of going through
`updateNativeControl()` which would perform a redundant input type
check.

(cherry picked from commit 44cd18c183)
2025-11-10 07:48:01 -08:00
Leon Senft
781a3299f9 perf(forms): only update interop controls when bound field changes
https://github.com/angular/angular/pull/64590 implemented change
detection for field bindings, but only for those bound to native or
custom form controls. This change extends that optimization to apply to
field bindings on interoperable controls built using Reactive Forms as well.

(cherry picked from commit 850f0d6b3d)
2025-11-07 11:58:20 -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
Alan Agius
3bed9f0f16
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:07:13 -08:00
Jessica Janiuk
a3c2fe819a Revert "refactor(common): Removes unused imports to clean up dependencies"
This reverts commit 6d3e0f1a51.
2025-11-06 09:05:05 -08:00
SkyZeroZx
6d3e0f1a51 refactor(common): Removes unused imports to clean up dependencies
Eliminates unnecessary imports to reduce clutter and improve maintainability

(cherry picked from commit ca3ef38143)
2025-11-06 16:35:32 +00:00
Miles Malerba
d1f4c8c18c refactor(forms): improved select support
When we set the `value` on a `<select>` element we're really just
setting the selected `<option>`. It treats the selected option as the
source of truth, rather than the actual value. This means that if
options are added or removed or their value changes, the `<select>` may
wind up with a different `value` than what's in our model.

This PR resolves this issue by adding a `MutationObserver` to the select
that is used to resync its value to the model whenever the options may
have changed.

(cherry picked from commit 194b41199b)
2025-11-06 15:49:09 +00: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
Leon Senft
507b3466ee perf(forms): implement change detection for field control bindings
For each field state property, check if it has changed since the last
time it was checked before writing it the corresponding form control
property.

The `pattern` and `required` properties of the field state now return a
default value rather than `undefined` if not defined by metadata.

(cherry picked from commit 41be02da2f)
2025-11-04 16:11:33 -08:00
SkyZeroZx
36f4c9b299 refactor(core): Removes unused flag for onDestroy
Eliminates an unnecessary configuration flag

(cherry picked from commit 2ad1b5979f)
2025-11-03 20:21:07 -08:00
SkyZeroZx
20fa3841ba refactor(core): remove redundant providedIn: 'root' from injection tokens
Removes unnecessary `providedIn: 'root'` declarations from injection tokens

(cherry picked from commit 64efbc53aa)
2025-11-03 16:31:58 -08:00
Matthieu Riegler
5d75d0ec30 refactor(core): Replace usages of the Function type for animations
`Function` is usually not recommended as its not specific enough.

(cherry picked from commit 79b7ac722a)
2025-11-03 12:05:09 -08:00
Andrew Scott
60cc3cbde4 refactor(core): Move patch toggles inside functions to allow tree shaking
In general, global level const will cause DCE bailouts.

(cherry picked from commit fb569ef614)
2025-10-29 13:57:56 -07: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
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
arielbackenroth
3fbaaa0176 refactor(http): add hooks for propagating traces across XHR callbacks.
Enables propagating a trace across XHR callbacks by providing a hook for
wrapping the callback with a function bound to the send trace context.

(cherry picked from commit 07b8e953f4)
2025-10-28 15:09:00 +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
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
Joey Perrott
a1868c9d13 feat(common): update to cldr 47 (#64032)
Update to CLDR version 47 for localization

PR Close #64032
2025-10-21 23:23:30 +00:00
Leon Senft
fd9af2afaf fix(forms): only propagate schema defined properties from field to control (#64446)
Prior to this change, `FieldState` defined a signal for each built-in
property. This unfortunately meant that the `Field` directive had no way
of knowing which property had actually been defined in the schema, and
would thus attempt to propagate them all to the bound form control. This
meant that the default values of these signals would override the
default or template defined values of these control properties.

Now these properties are `undefined` by default, and only initialized if
defined in the schema. Thus the `Field` directive will not attempt to
bind any properties that aren't explicitly managed by the schema.

PR Close #64446
2025-10-21 17:38:34 +00:00
cexbrayat
9c5e969f51 fix(forms): bind invalid input in custom controls (#64526)
FormUiControl has an `invalid` input signal, but it was not bound by the control instructions.

PR Close #64526
2025-10-21 17:37:58 +00:00
Jessica Janiuk
44127bf53f refactor(core): clarify comments on enter animation queuing (#64550)
This just updates the comments and adds some tests to verify some of the queuing behavior for enter animations.

PR Close #64550
2025-10-21 15:17:13 +00:00
SkyZeroZx
1923e52b12 refactor(core): Removes unused trigger parameter from scheduleDelayedPrefetching (#64517)
Simplifies delayed prefetching calls by eliminating an unnecessary trigger argument

PR Close #64517
2025-10-21 15:16:39 +00:00
SkyZeroZx
a17ce50a21 docs: Add DestroyRef.destroyed and usage in lifecycle guide (#64422)
PR Close #64422
2025-10-21 15:12:49 +00:00
hawkgs
daaad1e6b0 refactor(core): narrow down ReactiveNode.kind type (#64127)
Use a string union type instead of a generic string.

PR Close #64127
2025-10-20 20:15:46 +00:00
Kristiyan Kostadinov
c2d376b85a feat(core): make SimpleChanges generic (#64535)
Currently it's easy to make a mistake when accessing properties on `SimpleChanges`, because the keys aren't typed. These changes add an optional generic to the interface so that users can get a compilation error if they make a typo.

A few things to note:
1. The generic argument is optional and we revert to the old behavior if one isn't passed for backwards compatibility.
2. All of the keys are optional, because they aren't guaranteed to be present for any `ngOnChanges` invocation.
3. We unwrap the values of input signals to match the behavior at runtime.

Fixes #17560.

PR Close #64535
2025-10-20 17:49:39 +00:00
Kristiyan Kostadinov
f1f24b9697 refactor(core): move interfaces around (#64535)
Moves the `SimpleChange` and lifecycle hook interfaces so that they can import other symbols from `core`.

PR Close #64535
2025-10-20 17:49:39 +00:00
Leon Senft
a0f3960270 refactor(forms): prefix framework-private methods on Field with ɵ (#64471)
These methods are only intended to be used internally within framework
instructions. Prefix them with `ɵ` to indicate that they are
framework-private and should not be called from user code.

PR Close #64471
2025-10-20 15:35:42 +00:00