Commit graph

35247 commits

Author SHA1 Message Date
Alan Agius
a55a96a5fb build: allow any version of @angular/* packages for peer dependencies
This change configures pnpm to allow any version of  `@angular/*` packages to satisfy peer dependencies. This is necessary because `@angular/*` packages are managed within this monorepo, and this rule prevents issues with peer dependency resolution when different versions might be present during development or testing.

(cherry picked from commit 46099910c0)
2025-11-12 09:36:01 -08:00
Andrew Kushnir
909588e57f release: cut the v21.0.0-rc.2 release 2025-11-12 08:39:31 -08:00
Danny Koppenhagen
c05cf4145b refactor(core): render additional WAI-ARIA 1.3 property bindings as attributes
Support additional ARIA properties from Accessible Rich Internet Applications (WAI-ARIA) version 1.3.

| attribute | property |
|-----------|----------|
| `aria-activedescendant`           | `ariaActiveDescendantElement` |
| `aria-colindextext`           | `ariaColIndexText` |
| `aria-controls`           | `ariaControlsElements ` |
| `aria-describeyby`           | `ariaDescribedByElements ` |
| `aria-description`           | `ariaDescription` |
| `aria-details`           | `ariaDetailsElements ` |
| `aria-errormessage`           | `ariaErrorMessageElements ` |
| `aria-flowto`           | `ariaFlowToElements ` |
| `aria-labelledby`           | `ariaLabelledByElements ` |
| `aria-owns`           | `ariaOwnsElements ` |
| `aria-rowindextext`           | `ariaRowIndexText ` |

closes #64847

(cherry picked from commit c3e82fb2d5)
2025-11-11 14:09:02 -08:00
Matthew Beck
814b2713f5 fix(compiler): support complex selectors in :nth-child()
:nth-child() (and its siblings) support complex expressions, e.g.
`:nth-child(2n of :is(.foo, .bar))`. Previously we'd choke because of
the `:is()`. Now, we reuse the `_parenSuffix` subexpression to match
nested parentheses the same way we do for :host() and :host-context().
Note that we only support 3 levels of nesting, so a selector like
`:nth-child(n of :is(:has(:not(.foo))))` will still break.

I'll say yet again that we really should add a proper parser so we stop
getting bug reports like this :)

Fixes #64913

(cherry picked from commit 24cfd5a0ed)
2025-11-11 14:03:37 -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
Andrew Scott
e5b0a9739c Revert "feat(service-worker): notify clients about version failures (#62718)"
This reverts commit 6d011687ec.

issue #63500 reproduces at head on the main branch in the dev app.
Reverting this change along resolves it.

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

(cherry picked from commit 4af408afcb)
2025-11-11 12:48:49 -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
Leon Senft
33ed7d116b refactor(forms): do not infer accumulated metadata type from initial value
This removes the need to specify type arguments for
`reducedMetadataKey()` when the value returned from the `getIntial`
callback is a subtype of the accumulated type.

(cherry picked from commit 8866934334)
2025-11-11 12:00:12 -08:00
Angular Robot
fc3a28e647 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-11 11:51:32 -08:00
Angular Robot
baf33d01c1 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-11 10:21:35 -08:00
Doug Parker
c9f977833e fix(core): skip Angular formatting when formatting signals recursively
The flag `skipFormatting` got renamed to `ngSkipFormatting` during review of https://github.com/angular/angular/pull/64000, but a couple usages got missed, causing some unfortunate UI recursion.

(cherry picked from commit 490435bf76)
2025-11-11 10:14:33 -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
Angular Robot
91dbb4b4c1 build: lock file maintenance
See associated pull request for more information.
2025-11-11 08:48:21 -08:00
SkyZeroZx
8765b66f5a docs: add reference to Built-in Pipes in multiple pipe files
(cherry picked from commit d999667b57)
2025-11-11 08:47:12 -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
RobinReinecke
557213e211 docs: correct mermaid code block formatting
(cherry picked from commit 07703875b5)
2025-11-11 08:33:32 -08:00
SkyZeroZx
c72efd67de docs: improve discoverability in service worker documentation
(cherry picked from commit dde18c2303)
2025-11-11 08:32:19 -08:00
cexbrayat
eea81c2733 docs: remove error mentions in signal forms docs
`error` no longer exists and is called `validate`

(cherry picked from commit 800b01f5a1)
2025-11-11 08:30:13 -08:00
Devin Chasanoff
2019940ddc docs: add links to SDUI example and livestream
(cherry picked from commit 5af33724a4)
2025-11-10 14:16:23 -08:00
arturovt
ab98e71c41 fix(common): remove placeholder image listeners once view is removed
Prior to this commit, attempting to resolve a `ChangeDetectorRef` after views or app have been destroyed would result in an error. In this commit, we clean up listeners once the view is destroyed, before the placeholder loads or fails to load.

(cherry picked from commit feb86e3fde)
2025-11-10 12:05:24 -08:00
Shuaib Hasan Akib
e5a19cb736 refactor(router): add ngDevMode guards to InjectionToken names and cleanup imports
Wraps InjectionToken names with `typeof ngDevMode !== 'undefined' && ngDevMode`
checks to enable tree-shaking of descriptive token names in production builds.
This ensures debug-only strings are removed from production bundles, reducing size.

Also removes unused imports found during refactor.

(cherry picked from commit b0b834d7f1)
2025-11-10 12:04:35 -08:00
arturovt
8ab084754b refactor(core): mark VERSION as @__PURE__ for better tree-shaking
Annotate the `new Version(...)` call with `/* @__PURE__ */` to signal to optimizers that the constructor is side-effect free.

Without this hint, bundlers such as Terser or ESBuild may conservatively retain the `VERSION` instantiation even when unused. With the annotation, the constant can be tree-shaken away in production builds if not referenced, reducing bundle size.

(cherry picked from commit d3f67f6ca8)
2025-11-10 12:04:09 -08:00
Alan Agius
5f1436779c docs: use markdown code fences in service worker docs
Replaces the <docs-code> component with standard markdown code fences in the service worker documentation. This improves the readability and maintainability of the documentation.

(cherry picked from commit d42f9ce3a9)
2025-11-10 12:03:36 -08:00
Angular Robot
63418fb938 docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2025-11-10 10:35:02 -08:00
SkyZeroZx
650af71026 refactor(http): migrate XSRF classes to use inject() function
Remove constructor injection in favor of inject() calls

(cherry picked from commit 55be477979)
2025-11-10 09:49:14 -08:00
arturovt
9db114f4ff refactor(router): replace Optional with inject() flags
Replace `@Optional() link: RouterLink` constructor parameter with
`link = inject(RouterLink, {optional: true})` to enable tree-shaking
of the `Optional` decorator and its factory scaffolding.

Bundle size reduction: `Optional` is a runtime value created by
`makeParamDecorator()`. Even in production builds, ESBuild and other
bundlers must keep their factory code because it is referenced via
`Optional`. With `inject()`, this class is no longer referenced,
allowing it and the `makeParamDecorator` scaffolding to be tree-shaken
when unused elsewhere.

Note: This updates the constructor signature but should not be
considered a breaking change. Angular's official guidance is that
directives, components, and pipes should be instantiated by the
framework, not by user code. Directly calling `new RouterLinkActive(...)`
is an unsupported pattern that goes against Angular's design principles.

(cherry picked from commit 7724a9460d)
2025-11-10 09:48:36 -08:00
Angular Robot
afa2ac2801 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-10 08:24:22 -08:00
Shuaib Hasan Akib
5092a89e96 docs: add shell language to CLI installation examples
Added `language="shell"` to installation command examples to display
the shell prompt `$` icon consistently across npm, pnpm, yarn, and bun
code blocks.

(cherry picked from commit 27d54654e3)
2025-11-10 08:01:34 -08:00
Shuaib Hasan Akib
af0ed124c4 docs(docs-infra): simplify file headers in <docs-code> blocks
Removed redundant "src/app/" prefix from file headers (e.g.,
"src/app/open-close.component.ts" → "open-close.component.ts")
to make code examples cleaner and more focused.

(cherry picked from commit e0a4bdd72b)
2025-11-10 08:00:38 -08:00
Shuaib Hasan Akib
55360994af docs(docs-infra): removed unused import and use self-closing syntax for component
(cherry picked from commit 8c6619a531)
2025-11-10 08:00:11 -08:00
SkyZeroZx
511200265b docs: improve discoverability of forms
(cherry picked from commit e3fc57e8fc)
2025-11-10 07:57:48 -08:00
jnizet
0e13ae5dfc fix(docs-infra): avoid double slash in sitemap urls
Previously, the URLs in the  generated sitemap contained double slashes between the host and the path. It's not the case anymore.

fix #65022

(cherry picked from commit afe5fc0399)
2025-11-10 07:53:44 -08:00
SkyZeroZx
50a9ca0bb1 docs: correct import path and self-closing tag in ng-content example
(cherry picked from commit 6a2f4a88de)
2025-11-10 07:52:51 -08:00
Matthew Beck
b69763c728 test(compiler): add test for :host:has(> .foo)
I took a quick look at my recent changes to see if I had inadvertently
fixed this bug, but I couldn't seem to reproduce it even before my
changes. Seems like it's working, though.

Closes #58436

(cherry picked from commit 4b871b139b)
2025-11-10 07:51:21 -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
hawkgs
6c025fa709 refactor(devtools): update inspect icon
Use a custom version of Material `pin_end` icon that doesn't have a dot.

(cherry picked from commit 402f396b76)
2025-11-10 07:47:18 -08:00
Ben Hong
1876c7c48c docs: add draft for aria autocomplete component guide 2025-11-10 07:46:48 -08:00
Danny Koppenhagen
590244a8f9 docs(core): add a11y considerations related to @defer()
closes #53466

(cherry picked from commit d2b854b37e)
2025-11-07 15:27:15 -08:00
Andrew Scott
647e640603 refactor(core): Extract NavigateEvent cancel steps based on recent spec update
This updates the cancel/abort steps of fake navigation to match the
current spec.

Relevant commit seems to be
* b0b40cca16

(cherry picked from commit 8bccd8671c)
2025-11-07 12:54:18 -08:00
Andrew Scott
916ff6a340 refactor(core): Update commit steps of PlatformNavigation fake to match spec updates
Brings commit steps in line with recent spec updates

* a3809244c0
* bd347bdfeb

(cherry picked from commit 7a5ac69144)
2025-11-07 12:54:17 -08:00
Angular Robot
6db214899a docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2025-11-07 12:52:12 -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
Kristiyan Kostadinov
c81620f2c1 refactor(compiler-cli): update set of required inputs
Updates the required inputs that can be ignored for form controls.

(cherry picked from commit 877678345a)
2025-11-07 11:57:53 -08:00
Kristiyan Kostadinov
cc25f96f02 test(forms): fix type checking errors in signal form tests
Fixes some type checking errors in the signal forms tests that accumulated while there wasn't any type checking.

(cherry picked from commit 10915f2f5f)
2025-11-07 11:57:53 -08:00
Kristiyan Kostadinov
71ab11ccf0 fix(compiler-cli): make field detection logic more robust
Currently the logic for detecting `Field` directives only works if it's imported from `@angular/forms/signals` which doesn't cover our own tests.

These changes make the check more robust.

(cherry picked from commit 0b6b78ca74)
2025-11-07 11:57:53 -08:00
Kristiyan Kostadinov
5b55200edf fix(compiler-cli): allow value to be set on radio fields
Updates the logic that checks for unsupported bindigns to allow `value` to be set on `radio` controls.

(cherry picked from commit a61e01d51f)
2025-11-07 11:57:53 -08:00
Kristiyan Kostadinov
bd322ca410 fix(compiler-cli): do not flag custom control required inputs as missing when field is present
Adds some logic that won't report the `value` or `checked` inputs as missing when the `Field` directive is present since it will bind to the inputs implicitly.

(cherry picked from commit 165634264e)
2025-11-07 11:57:53 -08:00
Kristiyan Kostadinov
01290ab275 fix(compiler-cli): use any when checking field interface conformance
Switches to checking against `FormValueControl<any>` instead of `FormValueControl<unknown>` when checking whether custom controls conform to the interface.

Fixes #64946.

(cherry picked from commit 4d0778529f)
2025-11-07 11:57:53 -08:00