Commit graph

5835 commits

Author SHA1 Message Date
Alan Agius
64e28ccf81 build: update cross-repo angular dependencies (#64073)
See associated pull request for more information.

Closes #64043 as a pr takeover

PR Close #64073
2025-09-25 10:26:19 -04:00
Matthieu Riegler
fffc7cf1c4 refactor(migrations): migrate usages of getTestBed.initTestEnvironment (#63997)
This commit also removes code paths that were only useful for G3.

PR Close #63997
2025-09-24 16:03:40 +00:00
aparziale
b96afb4bfc fix(migrations): handle reused templates in control flow migration (#63996)
The control flow migration was incorrectly removing `ng-template` elements in scenarios where they were referenced by multiple `*ngIf` directives' `else` clauses and also used independently via `ngTemplateOutlet`.

PR Close #63996
2025-09-24 16:01:58 +00:00
Joey Perrott
a9145f3856 Revert "feat(common): update to cldr 47 (#63923)" (#64031)
This reverts commit 8ca3e3a0bc.

PR Close #64031
2025-09-24 15:03:43 +00:00
Joey Perrott
8ca3e3a0bc feat(common): update to cldr 47 (#63923)
Update to CLDR version 47 for localization

PR Close #63923
2025-09-23 19:57:00 +00:00
Avcharov Hryhorii
1279364c3a refactor(core): improve linkedSignal type definitions, add debugName to options (#63346)
Add debugName for having ability to visualize linkedSignal name in devtools signal graph

PR Close #63346
2025-09-23 18:15:49 +00:00
JoostK
50d9d55f49 fix(core): fix narrowing of Resource.hasValue() (#63994)
This commit changes `Resource.hasValue()` and its derived types to improve narrowing
of resources whose generic type either does not include `undefined` (i.e. when a default
value has been provided) or when the generic type is `unknown`. This fixes the undesirable
behavior where `hasValue()` would cause the `else` branch of an `hasValue()` conditional
to have a narrowed type of `never`, given that the `hasValue()`'s type guard covers the
entire type range already (meaning that the type in the else-branch cannot be inhabited
in the type system, yielding the `never` type).

By making the `hasValue()` method only a type guard when the generic type includes `undefined`
these problems are avoided.

Fixes #60766
Fixes #63545
Fixes #63982

PR Close #63994
2025-09-23 14:20:55 +00:00
Milo
5406e1a84b refactor(core): use version>0 instead of hasRun (#62467)
this saves a field for effect and watch nodes

PR Close #62467
2025-09-22 16:51:50 +00:00
Steven Chim
e88f484ccb docs: fix typo in component bindings jsdoc (#63969)
PR Close #63969
2025-09-22 14:33:06 +00:00
Kristiyan Kostadinov
f5b50ec20d refactor: clean up explicit standalone flags from tests (#63963)
Since standalone is the default, we can dropn the `standalone: true` flags from our tests.

PR Close #63963
2025-09-22 14:27:34 +00:00
Matthieu Riegler
c50d659509 refactor(core): protect InjectionToken usage of ngDevMode (#63875)
Since those are top level APIs, `ngDevMode` might not be available at runtime if they're invoked before the variable is set.

fixes #62796

PR Close #63875
2025-09-19 21:27:45 +00:00
Jessica Janiuk
dde5badb71 fix(core): prevent animations renderer from impacting animate.leave (#63921)
This adds an optional flag to the renderer on `removeChild` called `requireSynchronousElementRemoval`, which can tell any downstream renderer that elements need to be removed synchronously. This gets passed down to the legacy animation renderer to ensure that any elements that set this flag aren't impacted by that renderers changes to timing.

fixes: #63893

PR Close #63921
2025-09-19 21:26:18 +00:00
Matthieu Riegler
56cb0931ef refactor(core): drop the usage of PromiseSettledResult<void> (#63955)
`PromiseSettledResult<void>` requires the ES2020 typings. Those might not be provided (or `skipLibCheck` is not enabled).

fixes #63931

PR Close #63955
2025-09-19 20:27:25 +00:00
Jessica Janiuk
5d538b21fd Revert "refactor(compiler): expose member decorator identifiers (#63904)" (#63952)
This reverts commit ef0ff78de2.

PR Close #63952
2025-09-19 18:59:42 +00:00
Alan Agius
b725af9924 docs: add documentation for NG0401 error (#63947)
PR Close #63947
2025-09-19 17:01:20 +00:00
Matthieu Riegler
fec7c288e9 fix(core): Error on invalid APP_ID (#63252)
An invalid APP_ID could be responsible to generating broken CSS selectors. (eg `:` is an example for a character that breaks a selector by being a separator for pseudo-selectors.)
We now throw an error if the provided value is not alphanumerical

PR Close #63252
2025-09-19 15:00:10 +00:00
Leon Senft
f008045ded fix(core): do not rename ARIA property bindings to attributes (#63925)
https://github.com/angular/angular/pull/62630 made it so that all ARIA
property bindings would write to their corresponding attribute instead.
The primary motivation for this change was to ensure that ARIA
attributes were always rendered correctly on the server, where the
emulated DOM may not correctly reflect ARIA properties as attributes.
Furthermore, this change added support for binding to ARIA attributes
using the property binding syntax (e.g. `[aria-label]`).

Unfortunately, https://github.com/angular/angular/pull/62630 relied on
the incorrect assumptions that an ARIA property name could be converted
to its attribute name (without hardcoding the conversion), and that the
value of an ARIA property matched its corresponding attribute. For
example, the `ariaLabelledByElements` property's value is an array of
DOM elements, while the corresponding `aria-labelledby` attribute's
value is a string containing the IDs of the DOM elements.

This partially reverts https://github.com/angular/angular/pull/62630 so
that only property bindings with ARIA attribute names (begin with
`aria-`) are converted to attribute bindings.

* `[ariaLabel]` will revert to binding to the `ariaLabel` property.
* `[aria-label]` will continue binding to the `aria-label` attribute.

Note the only difference between `[aria-label]` and `[attr.aria-label]`
is that the former will attempt to bind to inputs of the same name while
the latter will not.

PR Close #63925
2025-09-19 14:50:39 +00:00
Matthieu Riegler
f1be5ae5dc refactor(core): fix MockRenderer in unit tests. (#63936)
This allows us to drop a test only check in the runtime.

PR Close #63936
2025-09-19 14:50:07 +00:00
Matt Lewis
aeb3e6c6a5 fix(migrations): handle import aliases to the same module name (#63934)
Fixes a bug in the standalone migration where 2 imported modules have the same class name but 1 is imported with an alias and would not be added to the component imports array when migrating

Fixes #63913

PR Close #63934
2025-09-19 14:48:32 +00:00
Kristiyan Kostadinov
ef0ff78de2 refactor(compiler): expose member decorator identifiers (#63904)
Adds the member decorators to the map of exposed compiler symbols.

PR Close #63904
2025-09-18 21:30:15 +00:00
aparziale
307e4eafef refactor(migrations): remove common module if there are no references (#63892)
ngclass-to-class migration removes commonModule if there are no references that use it

PR Close #63892
2025-09-18 20:18:43 +00:00
SkyZeroZx
e426302cca refactor(core): Remove duplicate code getSelectedTNode (#63897)
clean up duplicate functions

PR Close #63897
2025-09-18 16:04:25 +00:00
Kristiyan Kostadinov
bb381b707e refactor(compiler): integrate regular expression literals into pipeline (#63887)
Adds support for regular expression literals in the template pipeline and adds some logic to optimize non-global ones.

PR Close #63887
2025-09-18 15:08:56 +00:00
Angular Robot
5c74339dfc build: update cross-repo angular dependencies (#63902)
See associated pull request for more information.

Closes #63890 as a pr takeover

PR Close #63902
2025-09-18 14:39:51 +00:00
Andrew Kushnir
0a81784de2 Revert "refactor(compiler): integrate regular expression literals into pipeline (#63857)" (#63883)
This reverts commit dd77233cdf.

PR Close #63883
2025-09-17 19:36:17 +00:00
arturovt
dee6ef89c7 refactor(core): tree-shake HOST_TAG_NAME in prod (#63861)
Previously, HOST_TAG_NAME had its __NG_ELEMENT_ID__ set at the top level. This
prevented tree-shaking, since the bundler had to keep the assignment as a
potential side effect even when the token was never used.

This change moves the token creation and __NG_ELEMENT_ID__ assignment into a
@__PURE__ IIFE. If HOST_TAG_NAME is not injected anywhere, the IIFE result is
unused and can be dropped entirely by the optimizer. If it is used, the token
still behaves the same at runtime.

PR Close #63861
2025-09-17 17:40:35 +00:00
Kristiyan Kostadinov
dd77233cdf refactor(compiler): integrate regular expression literals into pipeline (#63857)
Adds support for regular expression literals in the template pipeline and adds some logic to optimize non-global ones.

PR Close #63857
2025-09-17 16:06:51 +00:00
Matthieu Riegler
af33647145 refactor(core): remove usages of Promise.withResolvers (#63856)
Promise.withResolvers is Baseline 2024. Our policy is to support browsers in the scope of Basline widely available.

Fixes #63855

PR Close #63856
2025-09-17 15:21:51 +00:00
Matthieu Riegler
e52338466f refactor(common): trim undefined from locale data. (#63520)
This is an optimization to shave of unecessary data.

fixes #42315

PR Close #63520
2025-09-17 14:57:16 +00:00
Matthieu Riegler
809a4ed8c1 feat(core): Add migration for zoneless by default. (#63042)
This commit adds a migration that updates applications enable Zone change detection when Angular is zoneless by default.

PR Close #63042
2025-09-16 20:48:29 +00:00
Andrew Scott
1352fbdbf2 fix(core): Drop special-case disables automatic change detection scheduling (#63846)
This commit drops special-case handling for old-style "zoneless" that
would disable the internal scheduler when zoneless was not explicitly
enabled but Zone was not defined. This scheduler is now enabled in _all_
applications, providing consistent expectations for developers.

BREAKING CHANGE: Using a combination of `provideZoneChangeDetection`
while also removing ZoneJS polyfills will no longer result in the
internal scheduler being disabled. All Angular applications now
consistenly use the same scheduler, and those with the Zone change detection
provider include additional automatic scheduling behaviors based on
NgZone stabilization.

PR Close #63846
2025-09-16 20:43:17 +00:00
Andrew Scott
d5e00f9591 refactor(core): Make the zoneless-by-default change a flag flip (#63382)
This makes the zoneless-by-default change a flag flip that can be
individually enabled in tests, createApplication, and bootstrapModule
for gradual rollout. In addition, the "require on CD provider" check is
also made individually flippable for gradual rollout.

PR Close #63382
2025-09-16 18:56:54 +00:00
Andrew Scott
45fed3d201 fix(core): Remove Zone-based change provider from internals by default (#63382)
This change removes the internally provided `ZoneJS`-based change
detection scheduler. This makes Angular Zoneless by default and allows
tree-shaking of the Zone change detection providers.

BREAKING CHANGE: Angular no longer provides a change detection scheduler
for ZoneJS-based change detection by default. Add
`provideZoneChangeDetection` to the providers of your
`bootstrapApplication` function or your `AppModule` (if using
`bootstrapModule`). This provider addition will be covered by an
automated migration.

PR Close #63382
2025-09-16 18:56:53 +00:00
Matthieu Riegler
07b4c12984 refactor(core): prevent input migration from introducing a breaking change (#63547)
Non-typed `transform` functions were stripped by the migration prior to this commit (while still logging an error).
This behavior will now only happen with `--best-effort`.

#63541

PR Close #63547
2025-09-16 18:53:50 +00:00
Andrew Scott
6d5c45d13d refactor(core): Remove unused token (#63819)
this removes an unused token from the core package

PR Close #63819
2025-09-16 16:52:53 +00:00
aparziale
4133b08d93 fix(migrations): fix route-lazy-loading migration (#63818)
route-lazy-loading migration now supports routes when exported by default

PR Close #63818
2025-09-16 15:53:47 +00:00
arturovt
b4acc79af6 refactor(core): swap dev/prod error handling order in injector for tree-shaking (#63354)
In production builds, `ngDevMode` is replaced with `false`, so the guard compiles to `return;`. However, bundlers like ESBuild still keep the remaining statements after the return as unreachable code instead of removing them. This leaves behind unnecessary dead code in the output.

Technically, the body is unreachable. But to prove that, the bundler must be 100% certain that:

- `return` cannot be removed by some transform
- there's no later transformation that changes control flow

As thus, it's always conservative.

This also allows dropping `assertDefined`, which was previously
referenced only inside `prependTokenToDependencyPath`. With the
function now fully inlined and dev-only, `assertDefined` is also
eliminated from production builds, further reducing bundle size.

PR Close #63354
2025-09-16 15:53:11 +00:00
Matthieu Riegler
5ce4d9522d docs: update doc to clear up difference between toObservable/ outputToObservable (#63836)
TLDR: only `toObservable` emits synchronously on subscription.

fixes #57224

PR Close #63836
2025-09-16 15:00:54 +00:00
Andrew Scott
d9e597f341 refactor(upgrade): use zone-based change detection by default (#63814)
To avoid the need for specifying `provideZoneChangeDetection` in any/all
modules used with `downgradedModule`, this change adds the zone-based change detection
providers by default. This also adds the zone providers to
`UpgradeModule` by default as well.

PR Close #63814
2025-09-16 14:45:28 +00:00
Andrew Scott
0bb68a8187 refactor(upgrade): downgradeModule uses zone-based change detection by default (#63814)
To avoid the need for specifying `provideZoneChangeDetection` in any/all
modules used with `downgradedModule`, this change adds the zone-based change detection
providers by default.

PR Close #63814
2025-09-16 14:45:28 +00:00
Andrew Scott
412d5af92c refactor(upgrade): downgradeModule uses zone-based change detection by default (#63814)
To avoid the need for specifying `provideZoneChangeDetection` in any/all
modules used with `downgradedModule`, this change adds the zone-based change detection
providers by default.

PR Close #63814
2025-09-16 14:45:28 +00:00
arturovt
7e0cf41563 refactor(core): wrap checkNoChanges body in if (ngDevMode) for better tree-shaking (#63387)
The `checkNoChanges` method previously used an early-return guard:

  if (!ngDevMode) return;
  // dev-only code ...

In production builds, `ngDevMode` is replaced with `false`, so the
guard compiles to `return;`. However, bundlers like ESBuild
still keep the remaining statements after the return as unreachable
code instead of removing them. This leaves behind unnecessary dead
code in the output.

This commit updates the method to instead wrap the full body:

  if (ngDevMode) {
    // dev-only code ...
  }

With this change, the method collapses to an empty function in
production builds:

  checkNoChanges() {}

This ensures that the dev-only logic and its dependencies
(e.g. `checkNoChangesInternal`, `UseExhaustiveCheckNoChanges`) can be
fully tree-shaken, reducing bundle size.

PR Close #63387
2025-09-15 21:11:39 +00:00
aparziale
8dc8914c8a feat(migrations): add migration to convert ngStyle to use style (#63517)
Add migration to convert ngStyle to use style

PR Close #63517
2025-09-15 20:16:16 +00:00
Matthieu Riegler
9a16718b13 refactor(core): remove deprecated interpolation option on Components. (#63474)
This option was deprecated by #55778.

BREAKING CHANGE: The `interpolation` option on Components has been removed. Only the default `{{ ... }}` is now supported.

PR Close #63474
2025-09-15 19:35:03 +00:00
Matthieu Riegler
6dff287bb8 refactor(compiler-cli): Add a diagnostic to detect forbiden invocations of required initializers (#63614)
The diagnostic will raise an error when required initializers (input, model, queries) are invoked the context of property initializers and contructors.

Docs will be provided in a follow-up

fixes #63602

PR Close #63614
2025-09-15 19:34:32 +00:00
Matthieu Riegler
a5e5dbbc16 refactor(core): remove moduleId from Component metadata (#63482)
It was deprecated by #49496 as it had no effect.

BREAKING CHANGE: `moduleId` was removed from `Component` metadata.

PR Close #63482
2025-09-15 18:23:46 +00:00
Jessica Janiuk
62ad4db465 refactor(core): Reorganize and cleanup animations code (#63775)
This is a pure re-organization of the animations code. No functionality changes, but it should be easier to navigate now. Utility classes have been moved to a `utils.ts` file. The related functions in the instructions have been grouped closer together.

PR Close #63775
2025-09-12 21:41:51 +00:00
Jessica Janiuk
a4001c440f fix(core): Prevent leave animations on a move operation (#63745)
When a user has `animate.leave` on a list of items in a `@for`, but are only showing a subset using a computed, removing the second to last item results in a move operation on the last item. There's no native atomic move API in the browser. So this results in the element being detached and attached at its new index. The detaching of the node resulted in leave animations firing.
This fix addresses this by adding a flag in the `LView[ANIMATIONS]` `AnimationLViewData` interface to allow for skipping animations. During list reconciliation, we set this flag so that the animations are skipped over. The flag is flipped back after the move operation is complete.

There is one complication that results from this. The index adjustment of elements in the list happens synchronously while the leave animation is asynchronous. This results in the leaving item getting shifted to the end of the list. This is not ideal but likely can be addressed in a future refactor.

fixes: #63544

PR Close #63745
2025-09-12 15:21:24 +00:00
Andrew Scott
bd54106708 refactor(router): update error checks extending error (#63487)
I forgot about the "setPrototypeOf" fix and had a recency bias for the
NotFoundError in the signal primitives.

PR Close #63487
2025-09-11 16:55:58 +00:00
Rocky Meza
663f48cfc1 refactor(core): Split consumerBefore/AfterComputation (#62549)
This makes it possible to batch effects, where we can "reopen" consumers
during initial render and then finalize them after we are finally done
adding all the effects to a batch:

```
function createBatch() {
  const effect = // ... create effect node
  resetConsumerBeforeComputation(effect);
  return effect;
}

// pseudo-code
function appendEffect(effectBatch, updater) {
  if (value is a signal) {
    const prevConsumer = setActiveConsumer(effectBatch.node);
    const output = value();
    setActiveConsumer(prevConsumer);
    effectBatch.push({ signal, updater });
    return output;
  }
}

function finalizeBatch(effectBatch) {
  if (effectBatch.length > 0) {
    finalizeConsumerAfterComputation(effectBatch.node);
  }
}

const effectBatch = createBatchEffectNode();
appendEffect(signal1, (newValue) => /* something */);
appendEffect(signal2, (newValue) => /* something different */);
finalizeBatch(effectBatch);
```

PR Close #62549
2025-09-11 15:47:33 +00:00