Commit graph

2101 commits

Author SHA1 Message Date
Danny Koppenhagen
c3e82fb2d5 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
2025-11-11 14:08:58 -08:00
Matthew Beck
24cfd5a0ed 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
2025-11-11 14:03:32 -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
Matthieu Riegler
21ca49cf62 refactor(core): rename ExperimentalIsolatedShadowDom to IsolatedShadowDom
This API is still experimental
2025-11-11 08:46:06 -08:00
Matthew Beck
4b871b139b 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
2025-11-10 07:51:16 -08:00
Matthew Beck
680c3c7bff fix(compiler): support commas in :host() argument
This change adds support for commas in :host() arguments (e.g.
`:host(:not(.foo, .bar))` as well as in nested parens when the argument
is applied without parens (e.g. `:host:not(:has(.foo, .bar))`).
Previously these selectors would receive an extra `[nghost]` attr, e.g.
`[nghost]:not(.foo, [nghost].bar)`.

I didn't file a bug for this one, but it's also blocking on an internal
LSC. Like the other CSS changes, I'll run a TGP to confirm this isn't
breaking.
2025-11-07 10:43:32 -08:00
Matthew Berry
444143758e fix(compiler): support one additional level of nesting in :host()
Previously we supported one level of nested parentheses inside of a
`:host()` selector, e.g. `:host(:not(p))`. This caused a breakage in g3
when I migrated a selector from `:host:not(:has(p))` to
`:host(:not(:has(p)))`. This change adds support for just one more level
of nesting.

It'd be nice to move everything to a real CSS parser (or even update it
to count parentheses like I did with :host-context()), but I wasn't able
to get that to work in ~20 minutes and I'm focusing on other things at
the moment.

This change punts the problem until somebody tries to use just one more
level of nesting in a selector.

Fixes #64830
2025-11-06 10:53:42 -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
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
Leon Senft
41be02da2f 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.
2025-11-05 00:11:22 +00:00
Kristiyan Kostadinov
b9e2ccdda8 refactor(common): remove unused import (#64699)
Cleans up unused code to improve readability and maintainability.

PR Close #64699
2025-10-30 19:27:33 +00:00
Matthieu Riegler
cfba831966 refactor(compiler): desambiguate and export RegularExpressionLiteralExpr
This allows all symbols used by `ExpressionVisitor` to be accessible.
2025-10-29 20:45:14 +00:00
Matthew Beck
b478e91068 fix(compiler): support arbitrary nesting in :host-context()
Previously we supported one level of nested pseudo-element selectors
inside :host-context(), e.g. :host-context(:is(.foo, .bar)). This was
based on a regex-based approach. We could support deeper levels of
nesting by updating the regex, but using a regex approach prohibits us
from supporting arbitrary nesting.

Rather than just adding one more level to the existing expression, I've
added a new generator function which splits selectors on commas in a
parenthesis-aware way. This allows us to support arbitrary nesting.

It's likely we'll want to reuse this in other places where we're not as
careful today. We'll probably do this on a request-based basis, though.

Fixes #59176
2025-10-27 13:40:47 +01:00
SkyZeroZx
9a7529dd66 fix(compiler): correctly compile long numeric HTML entities (#64297)
Fixes an issue where long numeric HTML entities (e.g. 🛈) were incorrectly compiled due to the use of 4-digit

PR Close #64297
2025-10-17 18:23:44 +00:00
Matthieu Riegler
62cda789a8 refactor(compiler): Improve pipe in track expression error (#64321)
Throw a parse error for a better context awareness.

fixes #64316

PR Close #64321
2025-10-13 08:59:56 -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
Kristiyan Kostadinov
ddeef60db2 refactor(compiler): support viewport trigger options in pipeline (#64130)
Updates the template pipeline to support options for the `viewport` triggers.

PR Close #64130
2025-10-09 05:32:20 -07:00
Kristiyan Kostadinov
f3207000fd refactor(compiler): parse options parameter on viewport triggers (#64130)
Updates the template parser and AST to capture a second object literal parameter on `viewport` triggers.

PR Close #64130
2025-10-09 05:32:20 -07:00
Kristiyan Kostadinov
64336715cd refactor(compiler): track span information about defer trigger parameters (#64130)
Currently we produce the string value of a defer `on` trigger by concatenating the string values of all of its tokens. This ends up ignoring whitespaces which in turn throws off source spans.

These changes switch to producing the string by taking the text between the start and end tokens, as well as tracking the start index.

PR Close #64130
2025-10-09 05:32:20 -07:00
Matthew Berry
4fce3cad5e test(compiler): fix a @keyframes style encapsulation test (#64036)
I've updated the test to assert what I believe it was trying to assert
before. Without this change, the CSS is invalid so it's unclear what
behavior we're demonstrating.

PR Close #64036
2025-10-09 05:16:18 -07:00
Alan Agius
7eee93da1a build: remove empty globs (#64270)
Remove globs that do not match any files.

PR Close #64270
2025-10-07 20:28:11 -04:00
Leon Senft
effccffde0 refactor(core): add framework support for binding form controls (#63773)
Move most of the implementation of the `Control` directive into core
framework instructions. This allows field state changes to be propagated
to their corresponding UI controls directly during execution of a
template update block, instead of relying on `effect()`s to synchronize
each change later during the update (and too late in the case of
required inputs).

* Define a private API in `@angular/core` for signal forms to implement:
  * `ɵControl` for the `Control` directive.
  * `ɵFieldState` for the control's associated `FieldState`.
* Emit specialized instructions when compiling a `[control]` binding:
  * `ɵɵcontrolCreate` sets up the `ɵControl` directive if present,
    determines whether it's bound to a native control element or a
    custom control component, and adds the appropriate event listeners
    to notify the `ɵFieldState` of UI changes.
  * `ɵɵcontrol` propagates changes from `ɵFieldState` properties to their
    corresponding UI control properties (in additional to binding the `control`
    property itself).

PR Close #63773
2025-10-04 13:21:55 -07: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
Kristiyan Kostadinov
159be56709 fix(compiler): recover template literals with broken expressions (#64150)
Fixes two issues that were preventing template literals from being recovered properly if one of the interpolated expressions is broken:
1. We weren't updating the expected brace counter when an interpolation starts which in turn was throwing off the recovery logic in `skip`.
2. When producing tokens for template literals, we were treating the closing brace as an operator whereas other places treat it as a character. Even after fixing the first issue, this was preventing the recovery logic from working correctly.

Fixes #63940.

PR Close #64150
2025-09-30 16:01:50 -04:00
Matthieu Riegler
04462ed67f refactor(compiler): Remove the interpolation config (#64071)
After #63474, we don't need that anymore.

PR Close #64071
2025-09-29 15:29:46 -04:00
Jessica Janiuk
221d5687ae Revert "refactor(compiler): Remove the interpolation config (#64071)" (#64110)
This reverts commit 768a09d3c3.

PR Close #64110
2025-09-26 15:16:53 -04:00
Matthieu Riegler
bd48349b76 refactor(compiler): throw on attribute bindings for ng-container (#64072)
They are never valid on ng-container.
fixes #53760

PR Close #64072
2025-09-26 13:53:00 -04:00
Matthieu Riegler
768a09d3c3 refactor(compiler): Remove the interpolation config (#64071)
After #63474, we don't need that anymore.

PR Close #64071
2025-09-26 12:36:50 -04: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
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
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
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
Kristiyan Kostadinov
2971a001c6 refactor(compiler): add output AST node for regular expressions (#63887)
Adds the `RegularExpressionLiteral` node to the output AST.

PR Close #63887
2025-09-18 15:08:56 +00:00
Kristiyan Kostadinov
539717f58a feat(core): support regular expressions in templates (#63887)
Updates the template syntax to support inline regular expressions.

PR Close #63887
2025-09-18 15:08:56 +00:00
Kristiyan Kostadinov
c1559ece52 refactor(compiler): tokenize regular expression literals (#63887)
Updates the expression lexer to produce tokens for regular expression literals.

PR Close #63887
2025-09-18 15:08:56 +00:00
Andrew Kushnir
a53ef1d69a Revert "refactor(compiler): tokenize regular expression literals (#63857)" (#63883)
This reverts commit 8a69c0629b.

PR Close #63883
2025-09-17 19:36:17 +00:00
Andrew Kushnir
ae55578b92 Revert "feat(core): support regular expressions in templates (#63857)" (#63883)
This reverts commit 328a2bf719.

PR Close #63883
2025-09-17 19:36:17 +00:00
Andrew Kushnir
c7e0c8b06a Revert "refactor(compiler): add output AST node for regular expressions (#63857)" (#63883)
This reverts commit a1288f8d66.

PR Close #63883
2025-09-17 19:36:17 +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
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
Kristiyan Kostadinov
a1288f8d66 refactor(compiler): add output AST node for regular expressions (#63857)
Adds the `RegularExpressionLiteral` node to the output AST.

PR Close #63857
2025-09-17 16:06:51 +00:00
Kristiyan Kostadinov
328a2bf719 feat(core): support regular expressions in templates (#63857)
Updates the template syntax to support inline regular expressions.

PR Close #63857
2025-09-17 16:06:51 +00:00
Kristiyan Kostadinov
8a69c0629b refactor(compiler): tokenize regular expression literals (#63857)
Updates the expression lexer to produce tokens for regular expression literals.

PR Close #63857
2025-09-17 16:06:50 +00:00
Matthieu Riegler
803dc8e44c fix(compiler): Add support for aria-invalid (#63748)
The `aria-invalid` attribute was supported but the `ariaInvalid` property was unknown by the schema.

fixes #63744

PR Close #63748
2025-09-15 18:41:16 +00:00
Jessica Janiuk
4924108630 refactor(core): dispatch enter and leave animations at the right times (#63450)
This updates the enter and leave logic to use the stored LView data to dispatch the enter and leave animations at the right points in the lifecycle. This should fix issues with signals not being available yet, parallel animations, and also eliminate the need for the element registry.

fixes: #63391
fixes: #63388
fixes: #63369

PR Close #63450
2025-09-10 22:24:00 +00:00
Jessica Janiuk
0a82138d4b fix(compiler): fixes regression with event parsing and animate prefix (#63470)
The new animations was not correctly looking for the `.` when parsing bindings. This resulted in arbitrary event bindings creating animate.leave instruction calls.

fixes: #63466

PR Close #63470
2025-08-29 11:53:30 +00:00
Jessica Janiuk
a0388409e3 fix(compiler): fixes animations on elements with structural directives (#63390)
The animate instructions were getting applied to the container comment nodes as well as the element nodes. This prevents that on the compiler level.

fixes: #63371

PR Close #63390
2025-08-26 09:47:07 -07:00
Joey Perrott
2fcafb65c5 build: rename defaults2.bzl to defaults.bzl (#63383)
Use defaults.bzl for the common macros

PR Close #63383
2025-08-25 15:45:01 -07:00
Matthieu Riegler
827c3c15f4 fix(compiler): Keep paraenthesis in Nullish + Boolean expression. (#63292)
Ts 5.9 introduced a regression coming from 5.8 when parenthesis aren't generated for expressions like (`(a ?? b) && c`).
This fix works around this explicitly specifying that we want to keep those parenthesis that we're aware of in this specific case;

This change can be reverted if the root issue (https://github.com/microsoft/TypeScript/issues/61369) is fixed. (but let's keep the tests in any case for the coverage)

fixes #63287

PR Close #63292
2025-08-21 12:15:52 +02:00