Commit graph

36863 commits

Author SHA1 Message Date
Jeremy Elbourn
7b95747733 docs: update essentials guide to include signals (#58603)
This change updates the _Essentials_ topic with the following changes:
* Change the "Managing dynamic data" topic to "Reactivity with signals",
  largely replacing the existing content to focus specifically on
  signals.
* Replace the "to-do" examples with examples for building a
  `UserProfile` component. I made this change because the todo-item
  component had an accessibility problem: it was a list item component
  that rendered an `li` into its own template. This meant that the
  component's host element was in between the `ul` and the `li`, which
  is invalid. The "right" way to do this would have been to use a
  component with an attribute selector, but this isn't something that
  fits into the _Essentials_ guide.
* Reorder some of the concepts in the components topic
* Combine "Rendering dynamic templates", "Conditionals and loops", and
  "Handling user interaction" into one topic, "Dynamic interfaces with
  templates". Having these as separate topics meant that there was more
  preamble/scaffolding around these relatively straightforward ideas.
* Renamed the "Sharing logic" topic to "Modular design with dependency
  injection". Aside from this, I have made no meaningful changes to the
  DI topic; I may come back for another edit pass here, but this is not
  necesary for v19.
* Add a link to the in-depth guide for each essentials topic.
* Add a new introduction to the _Essentials_ overview that explains what
  this guide is and what it's trying to accomplish.

PR Close #58603
2024-11-14 14:51:19 +00:00
Julio Massano Santos
6674130e80 docs: adds interceptor testing (#57568)
PR Close #57568
2024-11-14 14:50:41 +00:00
Angular Robot
190b4d7763 build: update cross-repo angular dependencies (#58641)
See associated pull request for more information.

PR Close #58641
2024-11-13 20:45:11 +00:00
Jeremy Elbourn
84c543a241 docs: update NgModule overview for standalone default (#58606)
This is the first commit towards updating the NgModule guide to reflect
the fact that v19+ is standalone by default. This PR focuses on:
* Updating the overview to give an actual overview of the most
  important/common uses of `NgModule`
* Add callouts recommending standalone APIs over `NgModule`
* Remove several stale docs that no longer make sense in v19+

This guide (directory) needs additional follow up work; I plan to
address the remaining content in follow-up changes.

PR Close #58606
2024-11-13 20:04:24 +00:00
Angular Robot
4f7ad3a8e6 build: update io_bazel_rules_sass digest to b442a44 (#58617)
See associated pull request for more information.

PR Close #58617
2024-11-13 18:49:20 +00:00
Angular Robot
ee320ee68a build: update cross-repo angular dependencies (#58639)
See associated pull request for more information.

PR Close #58639
2024-11-13 18:37:47 +00:00
Charles Lyding
9b309c129a refactor(language-service): suppress inline TCB required diagnostic for syncs (#58619)
The NG8900 diagnostic is a non-actionable error code that does not affect
the build result of a component.

PR Close #58619
2024-11-13 18:36:08 +00:00
Kristiyan Kostadinov
89256e6868 fix(migrations): replace removed NgModules in tests with their exports (#58627)
In #57684 the standalone migration was changed so that it replaces any leftover modules with their `exports`, in an attempt to preserve more working code. These changes expand that logic to also cover tests since it's somewhat common internally to only import a component's module without having any references to the component.

Note that tests are a bit of a special case, because we don't have access to the template type checker, so instead we copy over all of the `exports` of that module.

PR Close #58627
2024-11-13 18:04:31 +00:00
Kristiyan Kostadinov
731e3ea883 refactor(compiler-cli): broaden type of getPotentialImportsFor (#58627)
Currently the `getPotentialImportsFor` only accepts a `ClassDeclaration` as the context for generating an import, but that's not necessary because it doesn't require any class-specific information. These changes expand it to any `Node` so that it can be used when generating imports in testing declarations.

PR Close #58627
2024-11-13 18:04:31 +00:00
cexbrayat
579f613a58 fix(migrations): include the output migration in the defaults of the signal migration (#58635)
Running `ng g @angular/core:signals` prompts for the question on which migration to run and offers 3 options (inputs, outputs, queries).
Running with `--defaults` skips the prompts, but only runs 2 of them.
This fixes it by including the `outputs` migration in the default ones.

PR Close #58635
2024-11-13 18:03:58 +00:00
Angular Robot
28be388e6c build: update cross-repo angular dependencies (#58634)
See associated pull request for more information.

PR Close #58634
2024-11-13 18:03:09 +00:00
Jeremy Elbourn
8f558b6e98 docs: update components guide for default standalone (#58605)
This change updates the components guide to reflect the fact that
standalone is now the default.

PR Close #58605
2024-11-13 15:40:21 +00:00
Jeremy Elbourn
3a6f44bd52 docs: show component signal APIs as the standard approach (#58572)
This change updates the docs to show the signal-based APIs for inputs
and queries as the primary way to do things (and also the `output`
function).

Specifically, this means:
* Component guide
   * Show `input` and `model` as the main approach, moving `@Input` lower on the same page
   * Show signal-based queries as the main approach, moving the
     decorator-based queries lower on the same page
   * Show `output` as the main approach, moving `@Output` lower on the
     same page
   * Delete the separate topic for the `output` function
* Signals guide
   * Delete the topics for input, model, and queries, as they are not in
     the components guide.
   * Move all rxjs-interop content to a new guide under "Extended
     ecosystem"

I plan to further update the "Essentials" guide and the "Signals" guide
in follow-up PRs.

PR Close #58572
2024-11-13 15:39:50 +00:00
Jessica Janiuk
f3d9316275 refactor(core): moves incremental hydration codebase to better locations (#58616)
This eliminates the extra incremental.ts codepath and moves its functions to appropriate locations.

PR Close #58616
2024-11-12 22:25:27 +00:00
Joey Perrott
9fced64146 ci: remove circleci as we no longer rely on it (#58615)
Remove CircleCI artifacts and configuration

PR Close #58615
2024-11-12 18:39:25 +00:00
Kristiyan Kostadinov
c421ffdbfb fix(compiler): control flow nodes with root at the end projected incorrectly (#58607)
Fixes an edge case where a control flow node that has non-projectable nodes followed by an element node at the end would cause the entire control flow node to be project. For example if we have a projection target of `Main: <ng-content/> Slot: <ng-content select="[foo]"/>`, inserting a node of `@if (true) {Hello <span foo>world</span>}` would project the entire `Hello world` into the `[foo]` slot.

In the process of working on the issue, I also found that `@let` declarations at the root of the control flow node would prevent content projection as well.

PR Close #58607
2024-11-12 18:05:00 +00:00
Jessica Janiuk
f2bda8e3fc fix(core): prevent errors on contract cleanup (#58614)
If contract cleanup is called more than once, the assertion that the container manager will be present results in exceptions.

PR Close #58614
2024-11-12 17:25:50 +00:00
arturovt
4df352b77e fix(core): clean up event contract once hydration is done (#58174)
In this commit, we clean up the event contract once hydration is complete, which removes event
listeners registered through the container manager. If we do not clean up the contract, the listeners
will remain on the `document.body`. When incremental hydration is enabled, we cannot clean up the event
contract immediately; instead, we schedule its cleanup when the app is destroyed. This is because the
event contract is required for deferred blocks, of which we are unaware, that need to be hydrated.

PR Close #58174
2024-11-12 15:05:45 +00:00
Jessica Janiuk
e3343620b5 test(core): add incremental hydration tests (#58601)
This adds some additional tests for incremental hydration around registry and contract cleanup.

PR Close #58601
2024-11-12 14:49:06 +00:00
ashish
ee010d1dfb docs(docs-infra): Fixed grammatical error (#58611)
PR Close #58611
2024-11-12 14:48:10 +00:00
Angular Robot
511fe57fef build: update github/codeql-action action to v3.27.2 (#58604)
See associated pull request for more information.

PR Close #58604
2024-11-12 14:47:17 +00:00
Kristiyan Kostadinov
7e5f705213 refactor(migrations): handle fake async catalyst (#58608)
Fixes that the standalone migration wasn't handling the `fake_async` path for Catalyst.

PR Close #58608
2024-11-12 14:45:40 +00:00
Matthieu Riegler
8bf9156f93 docs: fix link in 6-property-binding tutorial (#58594)
fixes #58588

PR Close #58594
2024-11-12 14:44:58 +00:00
Jessica Janiuk
42c99763f5 refactor(core): reorganize defer codebase (#58598)
This moves all the helpers out of the instructions file, keeping the instructions limited to the actual instruction set. This adds files for defer block rendering functions and triggering functions, respectively.

PR Close #58598
2024-11-11 19:11:02 +00:00
Angular Robot
3b34073228 build: update cross-repo angular dependencies (#58597)
See associated pull request for more information.

PR Close #58597
2024-11-11 19:02:07 +00:00
Sheik Althaf
ff734fd3ef refactor(devtools): use reactive APIs for queries and linkedSignal (#58464)
migrated the viewChild to signal api and used linkedSignal in place of effect and little code refactoring

PR Close #58464
2024-11-11 19:01:18 +00:00
Joey Perrott
869df8e11c docs: remove "getting started" from headers on API ref page (#58595)
Remove the "Getting Started" text from the headers as it is unnecessary and confusing

PR Close #58595
2024-11-11 17:53:20 +00:00
Angular Robot
33e62c423c build: update cross-repo angular dependencies (#58593)
See associated pull request for more information.

PR Close #58593
2024-11-11 17:24:46 +00:00
Angular Robot
dc3a68bf67 build: update dependency marked to v15 (#58573)
See associated pull request for more information.

PR Close #58573
2024-11-11 17:11:27 +00:00
Matthieu Riegler
750432337b ci: re-enable adev tests (#58574)
Previously we disabled the tests to land some breaking changes.
We can now update the dependencies and re-enable the tests.

PR Close #58574
2024-11-11 16:52:09 +00:00
Kristiyan Kostadinov
086cb2c40e fix(compiler-cli): report individual diagnostics for unused imports (#58589)
Initially the unused imports check was implemented so that it reports one diagnostic per component with the individual unused imports being highlighted through the `relatedInformation`. This works fine when reporting errors to the command line, but vscode appears to only show `relatedInformation` when the user hovers over a diagnostic which is a sub-par experience.

These changes switch to reporting a diagnostic for each unused import instead.

PR Close #58589
2024-11-11 15:31:00 +00:00
Paul Gschwendtner
5ac0538870 refactor(migrations): improve temporary variable generation in signal migrations (#58581)
This commit improves the temporary variable generation in signal
migrations, whenever references are "shared" inside property
declarations.

PR Close #58581
2024-11-11 15:29:20 +00:00
Paul Gschwendtner
4fe080f04d refactor(migrations): improve control flow analysis for loops in signal migration (#58581)
Currently whenever we would come across a code snippet like this, where
`maxCellsPerRow` is an input, the control flow analysis would fall apart
because the first occurence of the node points to a control flow node
that is offset-wise "after" the first occurence. This commit makes the
logic more robust.

PR Close #58581
2024-11-11 15:29:20 +00:00
Jessica Janiuk
e1c5d839b3 Revert "ci: re-enable adev tests (#58574)" (#58592)
This reverts commit 7263917793.

PR Close #58592
2024-11-11 15:28:37 +00:00
Matthieu Riegler
7263917793 ci: re-enable adev tests (#58574)
Previously we disabled the tests to land some breaking changes.
We can now update the dependencies and re-enable the tests.

PR Close #58574
2024-11-11 14:50:59 +00:00
Charles Lyding
4327aa8c86 docs: add define option and prebundling info for application builder (#58569)
The application builder documentation now contains information about the
`define` option and its usage as well as development server prebundling.

PR Close #58569
2024-11-11 14:36:41 +00:00
Sheik Althaf
53341a3b8f refactor(docs-infra): use reactive APIs in shared components (#58425)
Migrated the input, output and queries to reactive APIs for better support of zoneless.

PR Close #58425
2024-11-11 14:36:05 +00:00
Jessica Janiuk
47224fb3c1 refactor(core): clean up incremental code base (#58553)
This re-organizes the code to be a bit cleaner with no more need for the onTriggerFn function.

PR Close #58553
2024-11-11 14:35:36 +00:00
Jessica Janiuk
277afc2333 refactor(core): Ensure registry and map are empty on view destroy (#58553)
This cleans up the memory usage of the defer block registry and jsactionmap when a view is destroyed that contains a defer block that is not yet hydrated.

PR Close #58553
2024-11-11 14:35:36 +00:00
Alan Agius
bc5aa3ceda docs: update hybrid rendering docs to remove RenderMode.AppShell (#58564)
More context in https://github.com/angular/angular-cli/pull/28818

PR Close #58564
2024-11-08 18:56:36 +00:00
Angular Robot
e847c9f009 build: update cross-repo angular dependencies (#58571)
See associated pull request for more information.

PR Close #58571
2024-11-08 18:54:26 +00:00
Anner Visser
ff11551060 docs: Fix menu label for ng cache clean, clear -> clean (#58560)
PR Close #58560
2024-11-08 17:28:02 +00:00
Paul Gschwendtner
55fde8dbac refactor(migrations): support running existing migrations with plain TS programs (#58541)
Previously we always ran Tsurge migrations with an Angular program, even
if it's a plain `ts_library` target. This has changed now, so we also
need to properly handle the case where a `ts_library` is analyzed, but
no Angular program is available.

PR Close #58541
2024-11-08 17:22:06 +00:00
Paul Gschwendtner
1a0cee543e refactor(migrations): conditionally create plain TS programs for Tsurge analyzers (#58541)
Tsurge can run against the full Google3 depot, and will often also deal
with plain `ts_library` targets. Those shouldn't be constructed with the
Angular compiler as this could cause out of memory breakages etc. The
targets are simply not "proven" to be compatible with the Angular
compiler; so we shouldn't use them when not necessary.

PR Close #58541
2024-11-08 17:22:06 +00:00
Angular Robot
70036fabd8 build: update cross-repo angular dependencies (#58550)
See associated pull request for more information.

PR Close #58550
2024-11-08 17:18:16 +00:00
Charles Lyding
98b39377b9 docs: add initial new feature info for application builder (#58547)
Adds information about loader option, loader import
attributes, and import/export condition features.

PR Close #58547
2024-11-08 17:17:36 +00:00
Teun Willems
4cc10cfb1f docs: remove foreach from testing.md as it's not a JS function (#58565)
Foreach was present in the documentation even though it's not valid Javascript

PR Close #58565
2024-11-08 17:16:42 +00:00
Alan Agius
c2a9b75045 fix(docs-infra): retain function keyword in API definitions (#58561)
**Before:**
```ts
animate(
  timings: string | number,
  styles?: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null
): AnimationAnimateMetadata;
```

**Now:**
```ts
function animate(
  timings: string | number,
  styles?: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null
): AnimationAnimateMetadata;
```

PR Close #58561
2024-11-08 17:16:04 +00:00
Alan Agius
d271c4422a fix(compiler-cli): correct extraction of generics from type aliases (#58548)
**Before:**
```ts
type HttpEvent = | HttpSentEvent
  | HttpHeaderResponse
  | HttpResponse<T>
  | HttpProgressEvent
  | HttpUserEvent<T>
```

**After:**
```ts
type HttpEvent<T> = | HttpSentEvent
  | HttpHeaderResponse
  | HttpResponse<T>
  | HttpProgressEvent
  | HttpUserEvent<T>
```

PR Close #58548
2024-11-08 17:15:06 +00:00
Alan Agius
c95aca1f17 docs(docs-infra): update default generic values and add constraints for type parameters in functions (#58548)
Before
```typescript
createNodeRequestHandler(
  handler: T
): T;
```

```typescript
class NgIf<T> {
  @Input() set ngIf(value: T);
  @Input() set ngIfThen(value: TemplateRef<NgIfContext<T>> | null);
  @Input() set ngIfElse(value: TemplateRef<NgIfContext<T>> | null);
  static ngTemplateGuard_ngIf: "binding";
  static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): boolean;
}
```

Now
```typescript
createNodeRequestHandler<T extends NodeRequestHandlerFunction>(
  handler: T
): T;
```

```typescript
class NgIf<T = unknown> {
  @Input() set ngIf(value: T);
  @Input() set ngIfThen(value: TemplateRef<NgIfContext<T>> | null);
  @Input() set ngIfElse(value: TemplateRef<NgIfContext<T>> | null);
  static ngTemplateGuard_ngIf: "binding";
  static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): boolean;
}
```

PR Close #58548
2024-11-08 17:15:06 +00:00