Commit graph

30400 commits

Author SHA1 Message Date
Matthieu Riegler
dd506c1802 docs: add mention of preconnect links (#56503)
Text is copied from AIO.

fixes #56502

PR Close #56503
2024-06-20 08:54:50 -07:00
Charles Lyding
c12f318f72 build: remove unused root dependencies (#56499)
With the removal of AIO, several dependencies are now unused and can be removed.

PR Close #56499
2024-06-20 08:54:11 -07:00
Andrew Kushnir
e20c6df65e refactor(core): use performance API for Event Replay (#56509)
This commit adds a standard performance marker that can be viewed in Chrome dev tools and other tooling.
See more info at https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark

PR Close #56509
2024-06-20 08:53:18 -07:00
Andrew Kushnir
bf6df6f186 fix(core): do not activate event replay when no events are registered (#56509)
This commit adds extra checks to handle a situation when an application has no events configured, but the Event Replay feature was enabled. This situation can happen when some routes in an application are mostly static, when other routes are more interactive.

Resolves #56423.

PR Close #56509
2024-06-20 08:53:18 -07:00
cexbrayat
86bcfd3e49 fix(core): improve docs on afterRender hooks (#56522)
This commit fixes a typo in the `AfterRenderPhase` deprecation warning and improves the documentation of the options parameter of the afterRender hooks (which are now all named `options` instead of being called `opts` in some functions and `options` in others).

PR Close #56522
2024-06-20 08:51:35 -07:00
cexbrayat
03a2acd2a3 fix(core): properly remove imports in the afterRender phase migration (#56524)
Before this commit, the migration was removing the `AfterRenderPhase` enum from the imports but not the comma, resulting in invalid code:

ts
```
import { , Directive, afterRender } from '@angular/core';
```

This commit fixes this by using `updateNamedImports` and `replaceNode` instead of `removeNode`.

After:

ts
```
import { Directive, afterRender } from '@angular/core';
```

PR Close #56524
2024-06-20 08:50:28 -07:00
arturovt
39df5fa9d2 refactor(core): missing space in zoneless warning (#56491)
There's currently a missing space in the zoneless warning, showing words together.

PR Close #56491
2024-06-20 08:49:39 -07:00
Kristiyan Kostadinov
64990a50ed refactor(compiler): integrate let declarations into the template pipeline (#56299)
These changes integrate let declarations into the template pipeline. This involves a few operations:
* Producing a `declareLet` instruction call at creation time to initialize the declaration.
* Producing a `storeLet` instruction call in the place of the let declaration, including the necessary `advance` calls beforehand.
* For let declarations used within their declaration view, moving the `const` to be placed right after the `storeLet` call to ensure the their value has been computed.
* For let declarations that are _only_ used in their declaration view, removing the `storeLet` call and inlining the expression into the constant statement.

PR Close #56299
2024-06-20 08:48:52 -07:00
Joey Perrott
0bd55a684f refactor(docs-infra): complete removal of aio directory (#56496)
Finish removal of aio directory as it is no longer used or relied upon.

PR Close #56496
2024-06-18 12:26:00 -07:00
Joey Perrott
bb72c26b52 refactor(docs-infra): remove reliance on aio example macro (#56496)
Remove usage of aio example macro in adev

PR Close #56496
2024-06-18 12:25:59 -07:00
Joey Perrott
7208d05a38 refactor(docs-infra): move windows-chromium-path to adev (#56496)
Move windows-chromium-path help from aio to adev

PR Close #56496
2024-06-18 12:25:59 -07:00
Andrew Scott
00bde8b1c2 fix(forms): Make NgControlStatus host bindings OnPush compatible (#55720)
This commit makes the host bindings of `NgControlStatus[Group]`
compatible with `OnPush` components. Note that this intentionally _does not_
expose any new APIs in the forms module. The goal is only to remove
unpreventable `ExpressionChangedAfterItHasBeenCheckedError` in the forms
code that developers do not have control over.

PR Close #55720
2024-06-18 11:35:34 -07:00
Matthieu Riegler
775f451682 docs: add ng generate directive page (#56417)
fixes #56296

PR Close #56417
2024-06-18 09:31:26 -07:00
Angular Robot
b592fb59c1 build: update scorecard action dependencies (#56485)
See associated pull request for more information.

PR Close #56485
2024-06-18 09:30:45 -07:00
Angular Robot
4b8d90806a build: update actions/checkout action to v4.1.7 (#56484)
See associated pull request for more information.

PR Close #56484
2024-06-18 09:28:57 -07:00
Angular Robot
18d64c5b64 build: update io_bazel_rules_sass digest to b222c61 (#56483)
See associated pull request for more information.

PR Close #56483
2024-06-18 09:28:19 -07:00
Andrew Scott
f8654bd3f6 fix(docs-infra): reference page restores scroll position or goes top when no anchor (#56478)
This contains follow-up fixes to 2a2439712a.
This commit updates scrolling on references page to scroll to the top
when there is no anchor in the URL. The behavior after the above commit would
be that the position doesn't change from whatever the previous page was
(potentially scrolled to the bottom). In addition, this restores the
previous scroll position when traversing through browser history rather
than always scrolling to the fragment.

PR Close #56478
2024-06-18 09:26:56 -07:00
ivanwonder
67b2c336bc fix(language-service): import the default exported component correctly (#56432)
When importing a component exported by default, the `default` can't be
used as the component name.

For example:

This is the export declarations:

```ts
export default class TestComponent {}
```

Previously, the output generated by LS looked like this:

```ts
import { default } from "./test.component";
```

Now the output looks like this:

```ts
import TestComponent from "./test.component";
```

Fixes #48689

PR Close #56432
2024-06-17 12:48:48 -07:00
Viktor T
d203c499a3 docs(docs-infra): Remove redundant API link (#56480)
As there is no longer a page for the localize API the URL pointing to this page is removed

PR Close #56480
2024-06-17 12:48:12 -07:00
Andrew Kushnir
89ec195fd2 refactor(core): handle incomplete DOCUMENT instances during cleanup in tests (#56422)
`DOCUMENT` instances retrieved from DI may not contain a necessary function to complete the cleanup. In tests that don't interact with DOM, the `DOCUMENT` might be mocked and some functions might be missing. For such tests, DOM cleanup is not required and we can skip DOM cleanup logic if there are missing functions. For tests that use DOM, TestBed would behave the same as before and rely on more complete `DOCUMENT` instances.

PR Close #56422
2024-06-17 09:05:52 -07:00
Andrew Kushnir
088e6c73bf refactor(core): avoid exposing OutletInjector in injector resolution path (#56394)
Router's `OutletInjector` required a special handling in cases when `@defer` is used, see https://github.com/angular/angular/pull/55374 for additional info. As a result, the `ChainedInjector` that represents an `OutletInjector` instance is currently exposed via `getInjectorResolutionPath` function. This creates a problem, because other debug APIs used by DevTools can not interact with `ChainedInjector`s. This commit updates the logic around `getInjectorResolutionPath` utility to avoid exposing `OutletInjector`in the resolution path.

Resolves #56331.

PR Close #56394
2024-06-17 09:05:11 -07:00
Andrew Scott
f346448871 docs(router): Remove deprecation on Router guard interfaces (#56408)
Many developers find these interfaces useful for various reasons. Beyond
that, the deprecation of the interfaces has incorrectly implied that
existing class-based guard implementations need to be migrated to
functions. Class injectables are _not_ deprecated and choosing to
implement a guard's state and logic as a class that is injectable in the
functions run inside the injection context is valid.

resolves #50234

PR Close #56408
2024-06-17 09:03:01 -07:00
Paul Gschwendtner
4bc99f0bdf refactor(core): ModelSignal should extend InputSignal (#56452)
This allows for helpers like the following to work intuitively for all
types of "input fields". It also establishes the intended mental
philosophy that a model is both an input and an output.

```ts
/** Unwraps all signal input properties. */
export type UnwrapSignalInputs<T> = {
  [K in keyof T]: T[K] extends InputSignalWithTransform<any, infer WriteT>
    ? WriteT
    : T[K];
};
```

PR Close #56452
2024-06-17 08:59:58 -07:00
Alex Rickabaugh
5df3e78c99 feat(core): add equality function to rxjs-interop toSignal (#56447)
`toSignal` predates the decision to allow a more flexible equality check in
signals, and thus doesn't support a custom equality function. This commit
adds the ability to pass a custom value equality function. As a side effect,
it now adds the default equality check where it wasn't used before.

Fixes #55573

PR Close #56447
2024-06-17 08:59:21 -07:00
Daniel Kimmich
08038e8573 docs: update security guide link to adev (#56469)
PR Close #56469
2024-06-17 08:54:08 -07:00
Arek
278c4a1fcb docs: fix outdated links from docs to contributing-docs folder in markdown documents (#56462)
PR Close #56462
2024-06-17 08:53:17 -07:00
Sasidharan SD
5a45d2b6b1 docs: fix location strategy link (#56475)
PR Close #56475
2024-06-17 08:48:23 -07:00
Andrew Scott
2a2439712a fix(docs-infra): Various scroll fixes for a.dev (#56464)
* Create custom scroller to manage scroll behavior more directly. There
  are two many special and weird behaviors in the site to use the
  built-in scrolling.
* Update scrolling to wait for application stability. This waits a bit
  longer than the current `Scroll` event, which happens in
  `afterNextRender` after the `NavigationEnd`. fixes #56446
* Disable scrolling on the API references page. It just never worked
  well with all the custom scroll locations
* Update card clicks on API references page to change the fragment of
  the URL (this allows docs viewers to link directly to an item). Also update
  API reference page to listen to fragment changes and use that as the
  scroll trigger rather than the click. This takes care of the initial
  scroll when the page loads as well.

fixes #56446

PR Close #56464
2024-06-17 08:46:49 -07:00
Angular Robot
4cd5fb592b build: update actions/checkout digest to 692973e (#56438)
See associated pull request for more information.

PR Close #56438
2024-06-17 08:46:06 -07:00
Joey Perrott
ee8ecfaef0 ci: begin checking licenses of upstream dependencies to ensure they are approved (#56460)
Begin checking upstream dependency licenses.

PR Close #56460
2024-06-14 13:49:23 -07:00
Charles Lyding
e0ee049bc3 ci: use bazel downloaded saucelabs connect binary (#56456)
The saucelabs connect tunnel utility is now downloaded via bazel as needed.
For the directly invoked case the utility is downloaded via the local shell script.
Previously it was part of the root `package.json` and downloaded whenever
a package install was executed. The utility archive was also not an actual
package which incidentally worked with npm but does not work with newer versions
of yarn.

PR Close #56456
2024-06-14 13:48:37 -07:00
Aristeidis Bampakos
d64ee6cc9d docs: fix broken link in ng-container API reference (#56445)
Closes #56444
PR Close #56445
2024-06-14 10:05:42 -07:00
Matthieu Riegler
ce8853e5af docs(core): remove the doc link for NG0952 (#56441)
We don't have any docs yet for that error, so I'm removing the minus sign which indicate that there is a dedicated error doc.

Fixes #56424

PR Close #56441
2024-06-14 10:05:00 -07:00
Andrew Scott
1d3a7529b4 feat(router): Set a different browser URL from the one for route matching (#53318)
This feature adds a property to the `NavigationBehaviorOptions` that
allows developers to define a different path for the browser's address
bar than the one used to match routes. This is useful for redirects
where you want to keep the browser bar the same as the original
attempted navigation but redirect to a different page, such as a 404 or
error page.

fixes #17004

PR Close #53318
2024-06-13 13:59:45 -07:00
Andrew Kushnir
fca5764564 Revert "refactor(core): Use ActionResolver in Dispatcher. (#56369)" (#56440)
This reverts commit 4ebd2853fa.

PR Close #56440
2024-06-13 12:17:35 -07:00
JoostK
0b867e83b6 fix(compiler-cli): insert constant statements after the first group of imports (#56431)
The linker inserts the constant statements that are needed to support compiled templates
after the import statements of an ESM file, but it failed to account for import statements
that are not at the top of the file. This is typically seen in FESM files where multiple
individual ESMs have been concatenated into a single ESM file, with imports in various places.
The linker would then find the very last import statement to insert the constant statements
after, but this may result in TDZ errors for component templates that have been emitted
earlier in the file.

This commit updates the Babel linker plugin to insert constant statements after the last
import of the first import group, therefore avoiding the TDZ error.

Fixes #56403

PR Close #56431
2024-06-13 10:15:00 -07:00
Paul Gschwendtner
126d33a34d refactor(compiler-cli): allow generating same import specifier in different files (#56406)
The import manager ensures generation of unique identifiers when
inserting imports. This is done by inspecting existing identifiers
within the original source file, while also checking if a similar
identifier was generated at an earlier time. This is correct behavior.

We can improve the detection so that the same identifier can be
generated in different files. This is beneficial for schematic/migration
use-cases where we wouldn't want to generate import aliases in multiple
files just because we generated an import to e.g. `input` previously.

E.g. it's fine to generate

```ts
// a.ts
import {input} from '@angular/core';

// b.ts
import {input} from `@angular/core';

// instead of `input as input_1`.

```

PR Close #56406
2024-06-13 10:14:09 -07:00
Paul Gschwendtner
5162a32de8 refactor(compiler): expose shorthand object metadata in expression AST (#56405)
Whenever we parse object property assignment shorthands in expression
ASTs, the AST will have no information about whether the property read
for the `LiteralMap` is built based on the shorthand or not.

Exposing this information in the AST is useful for migrations as those
might need to decompose the shorthand into its longer form to e.g.
invoke a signal read.

PR Close #56405
2024-06-13 10:12:52 -07:00
Paul Gschwendtner
352e0782ec feat(core): expose signal input metadata in ComponentMirror (#56402)
This commit starts exposing `isSignal` for inputs in the
`ComponentMirror`. We initially had this as a draft when rolling out
signal inputs, but there were no good use-cases, so we skipped it.

Now, inside G3, for the testing infrastructure and rolling out
advancements for signal inputs, having this information is necessary and
allows identifying signal inputs without "accessing fields" on the class
that may cause side-effects (like triggering setters).

PR Close #56402
2024-06-13 10:12:06 -07:00
Viktor T
c698668a52 docs: language-service - Fix quick info URLs (#56416)
- Made the links more specific
- Removed the AIO notation

PR Close #56416
2024-06-13 09:23:44 -07:00
Jens Kuehlers
d5ecd2c4cc docs: add v18.x and v19. release dates (#56429)
Add planned approximate v18 minor and v19 major
release dates.

PR Close #56429
2024-06-13 09:22:15 -07:00
Pawel Kozlowski
ef2ad1b2ef refactor: add select scenario to the js-web-frameworks benchmark (#56362)
Add the row selection scenario to the existing benchmark so we can
automate perf measurements during experiments.

PR Close #56362
2024-06-13 08:59:18 -07:00
Pawel Kozlowski
485c3d929d refactor: run js-web-frameworks with noop zone (#56362)
Align setup of this benchmark with
https://github.com/krausest/js-framework-benchmark/tree/master/frameworks/keyed/angular-cf-nozone
by running without zone.js using noop zone.

PR Close #56362
2024-06-13 08:59:17 -07:00
Jessica Janiuk
b2c44c76dc ci: bump github action commit message labels hash (#56435)
This updates to the latest git hash for the github action for commit messages.

PR Close #56435
2024-06-13 08:55:28 -07:00
Tom Wilkinson
4ebd2853fa refactor(core): Use ActionResolver in Dispatcher. (#56369)
`EventContract` usages in Angular now use `false` for
`useActionResolver`. Tests have been updated, with functionality that
depends on `ActionResolver` moving to dispatcher_test.ts.

PR Close #56369
2024-06-13 08:50:45 -07:00
Alex Rickabaugh
a114ebad7e release: cut the v18.1.0-next.2 release 2024-06-12 16:26:51 -07:00
Alex Rickabaugh
38b84007b6 docs: release notes for the v18.0.3 release 2024-06-12 16:20:47 -07:00
Sasidharan SD
f4b86bd9d5 docs: fix configure routes link (#56415)
PR Close #56415
2024-06-12 13:36:27 -07:00
Angular Robot
9e670ceea3 build: update io_bazel_rules_sass digest to 221f949 (#56393)
See associated pull request for more information.

PR Close #56393
2024-06-12 13:35:32 -07:00
Angular Robot
5cc9e8075a build: update babel dependencies to v7.24.7 (#56373)
See associated pull request for more information.

PR Close #56373
2024-06-12 13:11:12 -07:00