Commit graph

3333 commits

Author SHA1 Message Date
Alan Agius
4ed8781301
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.
2025-11-11 12:50:16 -08:00
Kristiyan Kostadinov
8277906455 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.
2025-11-11 10:04:29 -08:00
arturovt
7f95f02d05 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.
2025-11-10 07:48:39 -08:00
Jessica Janiuk
e703433b4b Revert "feat(core): resource composition via snapshots"
This reverts commit 2a6fdda601.
2025-11-07 07:42:18 -08:00
Alex Rickabaugh
2a6fdda601 feat(core): resource composition via snapshots
* Define `ResourceSnapshot<T>` as a type union of possible states for a
`Resource<T>`.
* Add `Resource.snapshot()` to convert a `Resource` to a signal of its
  snapshot.
* Add `resourceFromSnapshots` to convert a reactive snapshot back into a
  `Resource`.

By converting resources from/to `Signal<ResourceSnapshot>`s, full
composition of resources is now possible on top of signal composition APIs
like `computed` and `linkedSignal`.

For example, a common feature request is to have a `Resource` which retains
its value when its reactive source (params) changes. This can now be built
as a utility, leveraging `linkedSignal`'s previous value capability:

```ts
function withPreviousValue<T>(input: Resource<T>): Resource<T> {
  const derived = linkedSignal({
    source: input.snapshot,
    computation: (snap, previous) => {
      if (snap.status === 'loading' && previous?.value) {
        // When the input resource enters loading state, we keep the value
        // from its previous state, if any.
        return {status: 'loading', value: previous.value.value};
      }

      // Otherwise we simply forward the state of the input resource.
      return snap;
    },
  });

  return resourceFromSnapshots(derived);
}

// In application code:

userId = input.required<number>();
user = withPreviousValue(httpResource(() => `/user/{this.userId()}`));
// if `userId()` switches, `user.value()` will keep the old value until
// the new one is ready!
```
2025-11-06 14:59:39 -08:00
tsc036
cf47ce2db9
refactor(core): move profile_types.ts to primtives
move profile_types.ts so the types can be used in Wiz code
2025-11-06 14:22:33 -08:00
SkyZeroZx
5343001835 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
2025-11-06 12:00:46 -08:00
arturovt
9f76fb61df refactor(forms): tree-shake ngControlStatusHost and ngGroupStatusHost
This commit removes `ngGroupStatusHost` variable because it's a side-effect, ending up preserving `ngControlStatusHost` and `ngGroupStatusHost`.
2025-11-06 10:57:45 -08:00
Alan Agius
26fed34e0e
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:03:05 -08:00
Angular Robot
8315504d60 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-06 07:47:07 -08:00
Kristiyan Kostadinov
4b68bddd62 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.
2025-11-05 17:35:43 +00:00
Jessica Janiuk
373d263834 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
2025-11-05 17:04:11 +00:00
Angular Robot
5c5353d1e5 build: update cross-repo angular dependencies (#64795)
See associated pull request for more information.

PR Close #64795
2025-10-30 19:22:04 +00:00
Andrew Scott
c84d372778 feat(router): Support wildcard params with segments trailing (#64737)
this adds support for both leading and trailing segments before/after wildcard
route. Exposig the segments in a new _splat param would require a
breaking change to the return value of the matchers.

fixes https://github.com/angular/angular/issues/60821

PR Close #64737
2025-10-30 15:44:16 +00:00
Angular Robot
b0c9c63784 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-10-29 21:02:34 +00:00
Matthieu Riegler
76adbbcd0a refactor(core): expose isWritableSignal to the publicApi
This is alongside the already exisiting isSignal()

fixes #64763
2025-10-29 20:31:41 +00:00
Andrew Scott
5a93eeb6c0 Revert "feat(router): Support wildcard params with segments trailing"
This reverts commit 0a0cc27aea.
Causes internal failures with route matching. Should investigate and add
tests to prevent future regressions.
2025-10-28 18:35:27 +01:00
Matthieu Riegler
8e50cdb930 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`
2025-10-28 15:58:56 +01:00
Andrew Scott
a253739ac8
refactor(core): Remove zone toggles for test and standalone
The migration is complete internally. All that remains is bootstrapModule
2025-10-28 15:57:58 +01:00
Andrew Scott
0a0cc27aea feat(router): Support wildcard params with segments trailing
this adds support for both leading and trailing segments before/after wildcard
route. Exposig the segments in a new _splat param would require a
breaking change to the return value of the matchers.

fixes https://github.com/angular/angular/issues/60821
2025-10-28 10:23:58 +01:00
Matt Lewis
59e648913c 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.
2025-10-27 19:42:18 +01:00
Miles Malerba
55e1647e52 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
13d8ccc41b build: update cross-repo angular dependencies (#64622)
See associated pull request for more information.

PR Close #64622
2025-10-23 18:24:58 +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
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
Andrew Scott
f6a73f1913 fix(router): Respect custom UrlSerializer handling of query parameters (#64449)
Previously, query parameters passed to `router.createUrlTree` were simply converted to strings. This meant that any custom serialization logic in a custom `UrlSerializer` was not applied. This could lead to inconsistencies between navigations triggered from the URL bar (which are parsed by the serializer) and navigations triggered programmatically.

This change ensures that query parameters are normalized using the provided `UrlSerializer`. The values are serialized and then parsed to ensure they are in the same format as if they had come from a URL. This allows custom serializers to handle complex objects in query parameters consistently.

Fixes https://github.com/angular/angular/issues/47307

PR Close #64449
2025-10-20 18:42:56 +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
Jessica Janiuk
c60ab336c9 Revert "fix(router): Respect custom UrlSerializer handling of query parameters (#64449)" (#64511)
This reverts commit 46ae034c70.

PR Close #64511
2025-10-18 00:19:40 +00:00
Andrew Scott
46ae034c70 fix(router): Respect custom UrlSerializer handling of query parameters (#64449)
Previously, query parameters passed to `router.createUrlTree` were simply converted to strings. This meant that any custom serialization logic in a custom `UrlSerializer` was not applied. This could lead to inconsistencies between navigations triggered from the URL bar (which are parsed by the serializer) and navigations triggered programmatically.

This change ensures that query parameters are normalized using the provided `UrlSerializer`. The values are serialized and then parsed to ensure they are in the same format as if they had come from a URL. This allows custom serializers to handle complex objects in query parameters consistently.

Fixes https://github.com/angular/angular/issues/47307

PR Close #64449
2025-10-17 17:30:46 +00:00
Jessica Janiuk
c241038111 fix(core): update symbols (#64481)
the DeferComponent symbols got added twice.

PR Close #64481
2025-10-16 21:31:53 +00:00
Matthieu Riegler
b7c47d8fad refactor(devtools): Create a separate type of signals for after effect phases. (#64315)
With this change, we ensure afterRenderEffect phases nodes appear more like "effects" than regular signal node.

PR Close #64315
2025-10-16 18:47:13 +00:00
Jessica Janiuk
aab73671e4 fix(core): update animation scheduling (#64441)
In some rare cases, it seems the animation queue disappears despite being afterEveryRender. This updates the animation scheduler to be afterNextRender instead and only schedules it when we need to.

fixes: #64423

PR Close #64441
2025-10-16 17:35:49 +00:00
Angular Robot
a7ba2f5e65 build: update cross-repo angular dependencies (#64452)
See associated pull request for more information.

PR Close #64452
2025-10-15 22:42:54 +00:00
Jessica Janiuk
0ed6c93960 fix(core): fixes regression in animate.leave function bindings (#64413)
When adding and removing items in a `@for` loop, the `animate.leave` event binding instruction was not updated to use the same logic as the class function when the animation queue was added. We were not returning the correct signature for the `animate.leave` function, which caused the animation to not trigger correctly. This updates the event binding instruction to use the same logic as the class function when adding the animation to the queue.

fixes: #64336

PR Close #64413
2025-10-14 13:46:38 -07:00
Andrew Scott
2a7a5de53f feat(core): Allow passing application providers in bootstrapModule options (#64354)
This commit adds `applicationProviders` to the `bootstrapModule` options
object. This allows specifying additional providers at the location of
bootstrap, which makes default providers much easier to accomplish.

Using this, we can refine the approach taken for downgrade_module to use
this more direct API rather than the additional provider variable dance.

PR Close #64354
2025-10-13 15:10:10 -07:00
Andrew Scott
693b81fa3d refactor(core): fix ZoneJS-by-default providers for async downgradeModule (#64354)
This fixes the code to retain ZoneJS by default in the providers for
downgradeModule when the `bootstrapModule` is used. Prior to this
change, the async `bootstrapModule`/`compileNgModuleFactory` could be
called multiple times through `downgradeModule` before
`bootstrapModuleFactory` got called and used the zone providers.

Note: marked refactor since this only applies to the -next release and
we shouldn't have this change in the changelog as a fix.

PR Close #64354
2025-10-13 15:10:10 -07:00
Joey Perrott
eb80c3075f build: update symbol extractor tests to stabalize the order of the symbols listed (#64389)
Update to ensure that the symbols in the list of extracted symbols is consistent even when multiple bundle files are extracted from.

PR Close #64389
2025-10-13 11:12:54 -07:00
Andrew Scott
2c85d2802f refactor(router): update route config loading to use async/await (#64322)
This simplifies code by using async/await instead of rxjs in the config
loading internals. While loadChildren/loadComponent could _technically_
return a synchronous value, the expectation is that this would be used
for dynamic imports, which are necessarily async.

PR Close #64322
2025-10-13 09:58:10 -07:00
Miles Malerba
2fdd4da2a8 refactor(forms): rename the control directive to the field directive (#64300)
Renames the control directive and the input that users set to bind a
field to a UI control.

Previously users would do:

```
<input [control]="someField">
```

Now users will do:

```
<input [filed]="someField">
```

PR Close #64300
2025-10-13 08:59:13 -07:00
Kristiyan Kostadinov
f28355a80b refactor(compiler): expose member decorator identifiers (#63957)
Adds the member decorators to the map of exposed compiler symbols.

PR Close #63957
2025-10-09 14:02:16 -04:00
Angular Robot
8cd1b43d42 build: update cross-repo angular dependencies (#64282)
See associated pull request for more information.

PR Close #64282
2025-10-09 06:39:05 -07:00
Kristiyan Kostadinov
ad2376435b feat(core): support IntersectionObserver options in viewport triggers (#64130)
Adds support for customizing the `IntersectionObserver` options for the `on viewport`, `prefetch on viewport` and `hydrate on viewport` triggers.

Note that the options need to be a static object literal, e.g. `@defer (on viewport(trigger, {rootMargin: '123px'})`.

Fixes #52799.

PR Close #64130
2025-10-09 05:32:21 -07:00
Alan Agius
858e37cf83 build: update cross-repo angular dependencies (#64255)
See associated pull request for more information.

Closes #64212 as a pr takeover

PR Close #64255
2025-10-07 20:15:46 -04:00
Jessica Janiuk
e279f30199 fix(core): prevent early exit from leave animations when multiple transitions are present (#64225)
Our code ensuring host binding composition for animations was causing the early exit and removal of
elements when multiple transitions were present on the same element. This commit fixes the issue by
ensuring that we properly keep track of all the promise resolvers on the LView and then only
call them once we've properly waited for the longest animation to finish.

fixes: #64209

PR Close #64225
2025-10-06 15:34:26 -04:00
Jessica Janiuk
a52a2afb6e refactor(core): fix animations host binding tests (#64225)
These tests were not properly validating against the host binding changes due to the fact that the styles were on the wrong components in some of the host binding cases.

PR Close #64225
2025-10-06 15:34:26 -04:00
Leon Senft
42e1062bc5 refactor(core): add specialized instruction for [control] bindings (#63773)
* Emit a `ɵɵcontrol` instruction in place of `ɵɵproperty` for property
  bindings named "control". This instruction cannot be chained, but is
  otherwise functionally equivalent.

* Upcoming changes will use the `ɵɵcontrol` instruction to bind a signal
  form field to a UI control (be it a native element or custom directive).

PR Close #63773
2025-10-04 13:21:55 -07:00
Andrew Scott
5e61e8d3c3 fix(router): Fix memory leak through Navigation.abort and canDeactivate guards (#64141)
This commit updates the internal transition to handle context retention
through the abort function. This retention chain included the
previousNavigation and setting this to a noop function resolves the
issue.

fixes #63983

PR Close #64141
2025-10-02 17:31:42 +00:00
Jessica Janiuk
dd7c4cd9d1 fix(core): Fixes animations in conjunction with content projection (#63776)
Content Projected nodes are not destroyed and recreated, like every other
situation. Enter and Leave animations were ephemeral and are
expected to run once, and then be cleared. This means that for content projection
cases, the animations would only ever work the first time they were shown / hid.

In order to resolve this, we move to an animation queue that re-runs the animation
functions stored in the LView. In most cases, this animation will run once on creation.
For content projection, the enter and leave animations will fire more than once. Animations
are stored on the LView, but indexed and scheduled by whichever RNode needs to be animated.
So we only run animations for an affected RNode, rather than potentially all in the LView.

This also moves the queue to afterRender, which is safer than right after template
execution in refreshView.

fixes: #63418
fixes: #64065
fixes: #63901

PR Close #63776
2025-10-02 16:56:00 +00:00
kirjs
d892aabf6e Revert "fix(core): Fixes animations in conjunction with content projection (#63776)" (#64189)
This reverts commit 1cb16fddb5.

PR Close #64189
2025-10-01 22:42:40 +00:00
Jessica Janiuk
1cb16fddb5 fix(core): Fixes animations in conjunction with content projection (#63776)
Content Projected nodes are not destroyed and recreated, like every other
situation. Enter and Leave animations were ephemeral and are
expected to run once, and then be cleared. This means that for content projection
cases, the animations would only ever work the first time they were shown / hid.

In order to resolve this, we move to an animation queue that re-runs the animation
functions stored in the LView. In most cases, this animation will run once on creation.
For content projection, the enter and leave animations will fire more than once. Animations
are stored on the LView, but indexed and scheduled by whichever RNode needs to be animated.
So we only run animations for an affected RNode, rather than potentially all in the LView.

This also moves the queue to afterRender, which is safer than right after template
execution in refreshView.

fixes: #63418
fixes: #64065
fixes: #63901

PR Close #63776
2025-10-01 09:07:38 -04:00