Commit Graph

14922 Commits

Author SHA1 Message Date
cexbrayat 3c2d95aea8 refactor(forms): normalize experimental version tags in signals api
Also replaces v21.3 with v22.0, as v21.3 should not exist.
2026-03-11 11:40:06 -07:00
JoostK b401c18674 fix(core): include signal debug names in their toString() representation
The `toString()` implementations in the primitives package intended to include
the debug name, yet the debug name was evaluated during construction before it
could ever have been assigned. This commit fixes that.

The Angular wrappers override the `toString()` representation to evaluate signals
ad-hoc instead of showing their internal state, and this commit aligns their
behavior to include the debug name in `toString` as well.
2026-03-11 11:28:35 -07:00
SkyZeroZx 0837d25a70 refactor(common): Removes unused generic type parameters from KeyValueDiffers
Remove unused generic type parameters from KeyValueDiffers methods
2026-03-11 10:49:11 -07:00
Matthieu Riegler 4842f5a3b7 refactor(core): remove old resource params
G3 has been cleaned up we can drop those.
2026-03-11 10:44:12 -07:00
SkyZeroZx 66e72efef4 refactor(compiler-cli): simplifies IncrementalCompilation.fresh
Removes the `ts.Program` argument from the `IncrementalCompilation.fresh` method.
2026-03-11 09:41:02 -07:00
Ibrahim Hussien 903d51e855 docs: combine multiple documentation improvements into one PR 2026-03-11 09:29:45 -07:00
Leon Senft 57ba621c81 test(forms): read only context prevents writing to field value
Test that the read only context prevents writing to a field value:

* In validation rules
* In a provided configuration
2026-03-10 15:07:42 -07:00
Leon Senft 3e7ce0dafc fix(forms): restrict SignalFormsConfig to a readonly API
Introduce `FormFieldBinding` to represent a binding between a field and
a UI control through a `FormField` directive. This interface is used to
restrict `SignalFormsConfig` and `formFieldBindings` to a readonly API.

Fix #65779.
2026-03-10 15:07:42 -07:00
Leon Senft a1a6c5282e refactor(forms): restrict reactive logic to a readonly API
Reactive logic in forms is not intended to mutate state, but this was
poorly communicated by the permissive and highly mutable field context
provided to all logic functions. This change splits all of the
state-related API into writable and readonly interfaces.

* Top-level functions that produce a `FieldTree` (e.g. `form()`) expose
  writable signals (e.g. `value: WritableSignal<T>`) and mutating
  methods (e.g. `markAsDirty()`).

* Reactive logic expose readonly signals (e.g. `value: Signal<T>`) and
  omit mutating methods.
2026-03-10 15:07:42 -07:00
Matthieu Riegler a675950e44 refactor(core): interface cleanup
Should be fine to land this time.
2026-03-10 12:44:32 -07:00
Andrew Scott dbbc38ad14 refactor(compiler-cli): Export hybrid analysis from bin
This is necessary to actually use the exported symbols. Verified by building locally
2026-03-10 11:41:50 -07:00
Kristiyan Kostadinov 8630319f74 fix(core): sanitize translated attribute bindings with interpolations
Fixes that we weren't sanitizing attribute bindings with interpolations if they're marked for translation, for example: `<a href="{{evilLink}}" i18n-href></a>`.

Also adds a bit more test coverage for our sanitization.
2026-03-10 11:13:49 -07:00
Kristiyan Kostadinov 1866bf5d61 refactor(compiler-cli): remove more unused code
Cleans up some more usages of TS factory APIs and some unused functions.
2026-03-10 10:57:30 -07:00
Jon Snow 196933863b docs(core): clarify provideZoneChangeDetection usage in v21+
Clarify that provideZoneChangeDetection() is used to opt applications into NgZone/ZoneJS-based change detection and to configure NgZone options such as eventCoalescing.

Fixes #67498
2026-03-10 10:21:07 -07:00
Andrew Scott ba1508886d refactor(compiler-cli): Export hybrid_analysis symbols
Export symbols from hybrid_analysis from entrypoint
2026-03-10 10:18:36 -07:00
Kristiyan Kostadinov f9ede9ec98 fix(core): ensure definitions compile
Includes the following changes to make sure the definitions for injectable compiler:
1. The types for the `factory` function now include the `parent` parameter.
2. `ɵɵFactoryDeclaration` is now defined as a function. We need this since the provider definition gets passed into the inejctable definition by reference.
3. `ɵɵdefineInjectable`, `ɵɵdefineNgModule` and `ɵɵdefinePipe` now return the typed definition, rather than `unknown`. This aligns with what we do for components and directives.
2026-03-10 09:58:18 -07:00
SkyZeroZx 6073493c5b docs: Adds @see links and update defer reference 2026-03-09 16:59:39 -07:00
Andrew Scott 6bd2e7f703 refactor(compiler-cli): Export more things needed by external TCB generation
There are more things needed by external TCB generation tools
2026-03-09 16:58:48 -07:00
Sonu Kapoor 71b8159b37 test(forms): cover transformedValue without FormField context
Adds a test verifying that `transformedValue` exposes parse errors via
the returned signal's `parseErrors()` property when no FormField
context is present.

This ensures that:
- parse errors are still observable without DI-based field propagation
- the model is not updated when `parse` omits `value`
- valid input clears parse errors and updates the model

This test protects the documented contract that DI-based error
propagation is expected for FormValueControl usage, while standalone
usage relies on explicit consumption of `parseErrors()`.
2026-03-09 16:41:48 -07:00
Miles Malerba b918beda32 feat(core): allow debouncing signals
Adds a utility `debounced` to create a debounced version of a signal,
represented as a `Resource`. The resource's value contained the
debounced value of the signal, while its status (`resolved`, `loading`,
or `error`) indicates if the value is settled, if there is a value
currently pending debounce, or if the source signal threw an error.
2026-03-09 13:21:52 -07:00
Kristiyan Kostadinov 82b758e934 refactor(compiler-cli): replace typescript usage in type reference emits
Replaces our usage of TypeScript APIs in several places that emit references to type nodes. Also deletes some unused code.
2026-03-09 11:22:53 -07:00
Matthieu Riegler 0afe3c00ae refactor(core): remove private export of getDebugNode
This is a public api
2026-03-09 11:21:19 -07:00
Andrew Scott e97f5139ec refactor(core): update componentDeclaration to include isSignal
This is in DirectiveDeclaration and in the golden files with ComponentDeclaration
so I assume it was an accidental omission.
2026-03-09 11:17:38 -07:00
Andrew Scott 4f5c075d92 refactor(compiler-cli): export classpropertymapping from private
ClassPropertyMapping is used by the tcb_adapter so would be needed by external
TCB generation tools
2026-03-06 12:12:45 -08:00
kbrilla cc64def294 test(language-service): add inlay hint regression and integration coverage
test(language-service): add inlay hint regression and integration coverage
2026-03-06 10:18:28 -08:00
kbrilla 5a6d88626b feat(language-service): add angular template inlay hints support
Add Angular template inlay hints end-to-end across language-service and VS Code extension server/client wiring, including inlay-specific configuration mapping, request guards, and refresh behavior.
2026-03-06 10:18:28 -08:00
Kristiyan Kostadinov c19066c741 refactor(core): add tracing for component creation
Adds tracing support for component creations.
2026-03-06 09:48:23 -08:00
Kristiyan Kostadinov e433ba9a80 refactor(core): track the tracing service in the LView environment
Adds the `TracingService` to the `LView[ENVIRONMENT]` so we don't have to inject it everywhere.
2026-03-06 09:48:23 -08:00
Andrew Scott ac8418d728 refactor(compiler-cli): export TCB types and methods
exports methods and types required for TCB generation. This would allow external
tools to generate TCBs using their own analysis pipelines, separate from the
compiler-cli implementations.
2026-03-05 14:35:47 -08:00
SkyZeroZx 7b27d4ff11 refactor(core): remove redundant providedIn: 'root' from IDLE_SERVICE
Remove the `providedIn: 'root'` configuration from the `IDLE_SERVICE` token
since it is redundant and does not change the default injection behavior
2026-03-05 14:31:15 -08:00
SkyZeroZx 9705ec0386 docs: add docs for IdleService and customization for the @defer idle trigger 2026-03-05 14:31:15 -08:00
Andrew Scott 8217ef9b24 refactor(compiler-cli): abstract type check block metadata to be AST-free
This commit refactors the template type checking metadata interfaces to use detached, serializable metadata rather than retaining direct references to ts.Node or ts.Declaration instances.

A new tcb_adapter translates traditional TypeScript AST-bound metadata into these decoupled structures. This abstraction lays the groundwork for supporting native preprocessors (such as Rust or ts-go) which serialize metadata over JSON rather than passing live TypeScript objects.

Key changes:
- Introduced TcbDirectiveMetadata, TcbComponentMetadata, TcbReferenceMetadata, and TcbPipeMetadata to replace TypeCheckableDirectiveMeta where appropriate.
- Substituted deep TS compilation AST references with string module names and source spans to preserve out-of-band diagnostic capabilities.
- Detached generic typeParameters and transformType properties into synthesized, standalone TS mappings.
- Updated generateTypeCheckBlock and corresponding Operations to consume the new metadata.
2026-03-05 13:31:36 -08:00
Matthieu Riegler 36936872c9 refactor(core): remove createNgModuleRef
`createNgModuleRef` was aliased to `createNgModule`

BREAKING CHANGE: `createNgModuleRef` was removed, use `createNgModule` instead
2026-03-05 12:02:27 -08:00
Angular Robot 9fe820d335 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-03-05 11:43:25 -08:00
Leon Senft c767d678cf feat(forms): add 'blur' option to debounce rule
Expands the `debounce` rule configuration to accept `'blur'`. When this option
is provided, the rule will delay model synchronization until the field loses
focus (is touched). This introduces a debouncer that defers resolution
until the framework automatically aborts pending debounces upon touch events.
2026-03-05 09:55:14 -08:00
Kristiyan Kostadinov f01901d766 fix(migrations): avoid generating invalid code in ChangeDetectionStrategy.Eager migration
Currently the migration that add `ChangeDetectionStrategy.Eager` to components tries to add the properties as last in the object literal. This can be tricky, because TS doesn't reflect the commas in the AST so we need have to do brittle string lookups to know where to insert it.

These changes switch to inserting the property before the last pre-existing property which should be a bit more robust.
2026-03-05 09:34:03 -08:00
Doug Parker dc4cf649b6 fix(compiler-cli): ignore generated ngDevMode signal branch for code coverage
The Angular compiler unconditionally adds a debug name transform for signals
which generates a conditional on `ngDevMode` (e.g., `ngDevMode ? { debugName: "xyz" } : []`).
During testing, `ngDevMode` is true, so the true branch executes but the
false branch is never executed. Consequently, coverage tools report the
false branch as an untested line/branch, preventing 100% test coverage.

This commit adds a synthetic `/* istanbul ignore next */` comment to the
generated false branch so that Istanbul ignores it. We only include the
istanbul comment (instead of additionally including c8) to focus on the
established standard for Angular CLI/Karma coverage while maintaining
compatibility with modern Vitest setups, since @vitest/coverage-v8 now
natively respects the fallback istanbul comment.

Fixes #64583
2026-03-04 14:42:53 -08:00
Andrew Scott 72a17afaf3 fix(compiler): prevent mutation of children array in RecursiveVisitor
RecursiveVisitor.visitIfBlockBranch was permanently mutating the children array by pushing the expressionAlias into it. This change clones the array before pushing to avoid this side effect.
2026-03-04 14:41:32 -08:00
Jessica Janiuk fda08b7a89 refactor(core): account for shadow roots in animations
This adds a util function to get the proper target, properly accounting for shadow roots.
2026-03-04 10:16:40 -08:00
Jessica Janiuk 5338b5912c Revert "refactor(http): Improves base64 encoding/decoding with feature detection (#67002)"
This reverts commit aafeb1d2bd.
2026-03-04 09:19:10 -08:00
Jessica Janiuk 7eb33713b9 Revert "fix(http): correctly cache blob responses in transfer cache (#67002)"
This reverts commit 1f057afaac.
2026-03-04 09:19:10 -08:00
Jessica Janiuk 9e64147b73 fix(core): prevent child animation elements from being orphaned
When routing between two different routes, child animations were not finishing, causing elements to be left behind in the dom. The fix ensures the proper fallback is handled to avoid automatically cancelled custom events. This ensures the animation-fallback cancelling the animation actually completes, and ensures the element is removed.

fixes: #67400
2026-03-04 08:21:37 -08:00
Kristiyan Kostadinov 2c87f21abe fix(compiler-cli): always parenthesize object literals in TCB
This is a follow-up to #67381 which introduced a subtle bug where depending on the type checking configuration, we may put an object literal directly in the TCB body which the TS compiler ends up interpreting as a block. These changes resolve the issue by always wrapping the literal in parentheses.
2026-03-04 08:00:00 -08:00
SkyZeroZx c6f98c723c feat(language-service): Add support for idle timeout in defer blocks
Extends language service parsing and validation to support `@defer on idle(300)`
2026-03-04 07:57:30 -08:00
SkyZeroZx 98eb24cea0 feat(core): Support optional timeout for idle deferred triggers
Allows specifying a timeout parameter for idle-based deferred triggers, enabling more granular control over when deferred actions are executed.

Closes angular#67187
2026-03-04 07:57:30 -08:00
SkyZeroZx 17d3ea44e2 feat(core): add IdleRequestOptions support to IdleService
IdleService now accepts IdleRequestOptions,
enabling configuration of requestIdleCallback behavior in compatible environments.
2026-03-04 07:57:30 -08:00
SkyZeroZx 1f057afaac fix(http): correctly cache blob responses in transfer cache (#67002)
Previously, Blob values were passed to `Uint8Array` this resulted in silently producing an empty array (length = 0) without throwing an error, leading to empty cached data

PR Close #67002
2026-03-04 15:56:59 +00:00
SkyZeroZx aafeb1d2bd refactor(http): Improves base64 encoding/decoding with feature detection (#67002)
Use feature detection for `Uint8Array.prototype.toBase64` and
`Uint8Array.fromBase64`, falling back to the existing implementation
when native support is not available

PR Close #67002
2026-03-04 15:56:59 +00:00
Krueger01 0e9d58ef09 refactor(compiler-cli): update old angular.io references to angular.dev
Update comment references from the old site angular.io to the new site
angular.dev.
2026-03-03 14:22:20 -08:00
Andrew Scott 778b748694 refactor(router): Permit deferring commit of traversal navigations
This updates the state manager to allow intercepting and deferring commits of traversal navigations.
The issues that were encountered in the past appear to be resolved in Chrome.
The behavior of redirect is still undefined in this case, so there is an added TODO.
2026-03-03 14:09:11 -08:00