Commit Graph

35263 Commits

Author SHA1 Message Date
Angular Robot 050c475b51 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-10 08:23:57 -08:00
Andrew Scott 2db8f2ee75 refactor(router): Add handling of abort event on signal of NavigateEvent
This adds handling of the abort event on the signal of the
`NavigateEvent`, allowing us to cancel the Router's ongoing navigation
transition when its related navigation was aborted.
2025-11-10 08:02:43 -08:00
Shuaib Hasan Akib 27d54654e3 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.
2025-11-10 08:01:29 -08:00
Shuaib Hasan Akib e0a4bdd72b 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.
2025-11-10 08:00:33 -08:00
Shuaib Hasan Akib 8c6619a531 docs(docs-infra): removed unused import and use self-closing syntax for component 2025-11-10 08:00:06 -08:00
SkyZeroZx e3fc57e8fc docs: improve discoverability of forms 2025-11-10 07:57:43 -08:00
Angular Robot 47f6f71fc4 build: update dependency marked to v17
See associated pull request for more information.
2025-11-10 07:54:08 -08:00
jnizet afe5fc0399 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
2025-11-10 07:53:40 -08:00
SkyZeroZx 6a2f4a88de docs: correct import path and self-closing tag in ng-content example 2025-11-10 07:52:46 -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
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
Leon Senft 44cd18c183 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.
2025-11-10 07:47:58 -08:00
hawkgs 2d7a72314d fix(devtools): message bus URI conflict between dev and prod apps
\#64806 drops the `href` part of `SamePageMessageBus` URIs. This creates a conflict, which breaks the directive explorer, between the prod Devtools (i.e. the extension) and the dev Devtools app due to the backend URIs using the same string for both prod and dev.
2025-11-10 07:47:37 -08:00
hawkgs 402f396b76 refactor(devtools): update inspect icon
Use a custom version of Material `pin_end` icon that doesn't have a dot.
2025-11-10 07:47:14 -08:00
Danny Koppenhagen d2b854b37e docs(core): add a11y considerations related to @defer()
closes #53466
2025-11-07 15:27:10 -08:00
Andrew Scott 1651908004 refactor(router): Add handler to NavigationInterceptOptions
This adds a handler to the `NavigationInterceptOptions` when we are
intercepting a `NavigateEvent`. This means that the scroll and focus
restoration will be delayed until the handler promise resolves. It also
means that we can provide better indication of an ongoing navigation
event.
2025-11-07 13:32:49 -08:00
Andrew Scott 8bccd8671c 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
* https://github.com/whatwg/html/commit/b0b40cca16f5d04b7fdca5a1bdca32cc6f824689
2025-11-07 12:54:14 -08:00
Andrew Scott 7a5ac69144 refactor(core): Update commit steps of PlatformNavigation fake to match spec updates
Brings commit steps in line with recent spec updates

* https://github.com/whatwg/html/commit/a3809244c003103243e769855aa4c5792b8937e3
* https://github.com/whatwg/html/commit/bd347bdfebc558f4009109c101bf7fb495400031
2025-11-07 12:54:14 -08:00
Angular Robot a002fb5242 docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2025-11-07 12:52:35 -08:00
Leon Senft 850f0d6b3d 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.
2025-11-07 11:58:17 -08:00
Kristiyan Kostadinov 877678345a refactor(compiler-cli): update set of required inputs
Updates the required inputs that can be ignored for form controls.
2025-11-07 11:57:50 -08:00
Kristiyan Kostadinov 10915f2f5f 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.
2025-11-07 11:57:50 -08:00
Kristiyan Kostadinov 0b6b78ca74 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.
2025-11-07 11:57:50 -08:00
Kristiyan Kostadinov a61e01d51f 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.
2025-11-07 11:57:50 -08:00
Kristiyan Kostadinov 165634264e 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.
2025-11-07 11:57:50 -08:00
Kristiyan Kostadinov 4d0778529f 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.
2025-11-07 11:57:50 -08:00
Andrew Scott 4405725943 fix(language-service): address potential memory leak during project creation
This addresses a potential memory leak in plugin-factory.ts.
The require call inside the create function reloads the entire language
service module for every new project, which is inefficient and could be a cause of the memory leak during branch
switching. This ensures the module is loaded only once and the same
instance is shared across all projects.
2025-11-07 11:57:22 -08:00
Alan Agius 033ea75b88 build: update rules_angular to latest
Update `rules_angular` to latest.
2025-11-07 11:43:24 -08:00
Alan Agius 0f55443d9b refactor: exclude tsconfig.json from VSIX package contents (#64991)
The  file is no longer included in the VSCode extension package.
This change updates the golden file and the  file to reflect this exclusion.

PR Close #64991
2025-11-07 11:36:31 -08:00
Alan Agius 74a38f00a0 test: add golden file test for VSCode extension package contents (#64991)
This commit introduces a golden file test to verify the contents of the VSCode extension package.
The test ensures that the list of files included in the extension package remains consistent.

A new Bazel rule  is added to generate the list of files, and  is used to compare it against the golden file. A helper script  is also added to facilitate the generation of the golden file.

PR Close #64991
2025-11-07 11:36:31 -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
Shuaib Hasan Akib a2cd36777a docs(docs-infra): use self-closing syntax for component examples
Replaced multiple component tags such as `<example></example>` with
self-closing syntax (`<example />`) across documentation examples.
This improves readability and aligns with the current Angular
style conventions.
2025-11-07 10:24:36 -08:00
Charles Lyding e3143036ba docs: remove invalid service dependency guide section
The current section `Services with dependencies` within the testing services
guide is non-functional and has been removed. The example service is using
`inject` but the test code is using constructor-based injection. The further
sections discuss the use of TestBed to adjust providers which better handles
these cases.
2025-11-07 10:23:47 -08:00
SkyZeroZx dff803514e docs(docs-infra): refactor update to use host property and refactor isWindows 2025-11-07 10:13:23 -08:00
Doug Parker 9432919a8b refactor: enable dev-app sourcemaps in prod and include vendor sourcemaps
This makes it easier to debug in production by including sourcemaps unconditionally. It also processes vendor sourcemaps (which includes Angular FW in this setup) and should improve debuggability of FW code by including sourcemap coverage.
2025-11-07 10:12:58 -08:00
Doug Parker 2150e383d9 refactor: add production devserver to dev-app
This should make it easier to test production bundling and optimizations.
2025-11-07 10:12:58 -08:00
Alon Mishne b481fee049 docs: Update MCP docs to include all current stable and experimental tools 2025-11-07 10:12:30 -08:00
Charles Lyding 2a2397acc4 docs: Update testing guides for Vitest and Karma
This commit updates the testing documentation to reflect the introduction of Vitest as the default test runner, while ensuring Karma testing instructions are still available.

Key changes include:
- Adding a new guide for "Testing with Karma" (`guide/testing/karma.md`).
- Updating the "Code Coverage" guide (`guide/testing/code-coverage.md`) to use `angular.json` for coverage enforcement and referencing Vitest documentation.
- Modifying the "Testing Overview" guide (`guide/testing/overview.md`) to introduce Vitest as the default, update `ng test` output examples, and link to the new Karma guide.
- Updating navigation data to include the new Karma testing guide.
2025-11-07 10:10:26 -08:00
Andrew Scott c91d8203a2 fix(language-server): fix directory renaming on Windows
Hopefully addresses issues on Windows where fs.watch on a directory
locks that directory.

fixes https://github.com/angular/vscode-ng-language-service/issues/1398
2025-11-07 10:09:57 -08:00
Miles Malerba 0efb3f6d1f refactor(forms): nicer type errors
By intersecting with `object` instead of `unknown` in the primitive and
`FormControl` cases, we get TypeScript to show nicer type errors that
mention `FieldTree<...>` insetad of `() => FieldState<...>`
2025-11-07 07:45:05 -08:00
SkyZeroZx c74367c5de refactor(devtools): replace HostListener with host metadata for keydown handling
Uses host metadata instead of the HostListener decorator for keydown events
2025-11-07 07:44:42 -08:00
khanhkhanhlele a625f6bb20 docs: Fix typos in some files 2025-11-07 07:44:03 -08:00
Angular Robot 3cde920ecf build: update all non-major dependencies
See associated pull request for more information.
2025-11-07 07:43:44 -08:00
Jessica Janiuk e703433b4b Revert "feat(core): resource composition via snapshots"
This reverts commit 2a6fdda601.
2025-11-07 07:42:18 -08:00
Angular Robot ff3013c014 build: update cross-repo angular dependencies
See associated pull request for more information.
2025-11-06 15:28:11 -08:00
Andrew Scott 85d9abb019 refactor(router): Intercept navigate events (unless it's a rollback)
This adds further integration with the browser Navigation API by intercepting the navigation events.
2025-11-06 15:00:08 -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
Miles Malerba faccf03ee0 refactor(forms): allow FieldTree of recursive type
Adjusts our typings to work better with recursive types and avoid
infinite recursion in the type system.
2025-11-06 13:43:43 -08:00
Miles Malerba 2fd8dc9195 refactor(forms): expose pathKeys as part of the API
Currently we maintain the pathKeys internally, but do not expose them
through the `FieldContext`, this PR updates the `FieldContext` to expose
this property.
2025-11-06 13:43:13 -08:00