Commit graph

29561 commits

Author SHA1 Message Date
Joey Perrott
84ad5d9aa3 ci: remove publish_package_as_artifacts job from circleci (#51660)
Remove the job as it is no longer used.

PR Close #51660
2023-09-05 18:06:49 +00:00
Joey Perrott
e804075740 build: update @angular/ng-dev (#51658)
Update version of @angular/ng-dev

PR Close #51658
2023-09-05 17:40:32 +00:00
Andrew Scott
b2aff43621 fix(router): Remove urlHandlingStrategy from public Router properties (#51631)
This commit removes the `urlHandlingStrategy` from the public Router's API

BREAKING CHANGE:
`urlHandlingStrategy` has been removed from the Router public API.
This should instead be configured through the provideRouter or RouterModule.forRoot APIs.

PR Close #51631
2023-09-05 17:09:13 +00:00
Matthieu Riegler
3c0c53d4df docs: remove mention of the string based lazy loading (#51651)
String based lazy loading has been deprecated in v8 and remove in v13. We can safely remove it from the docs.

PR Close #51651
2023-09-05 16:53:29 +00:00
Kristiyan Kostadinov
7fa17d00f6 test(compiler): fix failing tests (#51656)
Fixes some tests that started failing, because a couple of connected PRs landed at the same time.

PR Close #51656
2023-09-05 15:02:52 +00:00
Kristiyan Kostadinov
05a16b973d refactor(compiler): add support for advanced tracking expressions (#51618)
These changes build on top of #51514 to add support for advanced expressions inside the `track` parameter of `for` loop blocks. There are two different outputs that the compiler can generate:

1. If the tracking function only references the item or `$index`, the compiler generates a pure arrow function as a constant references in the `repeaterCreate` instruction.
2. If the tracking function has references to properties outside of the `for` loop block, the compiler will rewrite those references to go through `this` and generate a function declaration. The runtime will `bind` the declaration to the current component instance so that the rewritten `this` references are resolved correctly.

Advanced tracking expression come with the following limitations to ensure the best possible performance:
1. They can only reference the item, `$index` and properties directly on the component instance. This means that there'll be an error when accessing this like local template variables and references. While we could get this to work, we would have to traverse the context tree at runtime which will degrade the performance of the loop, because it's a linear time operation that is performed on each comparison. Furthermore, allowing local references would require us re-evaluate the list when any one of them has changed.
2. Pipes aren't allowed inside the tracking function.
3. Object literals and pipes used inside the tracking expression will be recreated on each invocation.

PR Close #51618
2023-09-05 14:19:18 +00:00
Kristiyan Kostadinov
b51ab59836 refactor(compiler): allow constants pool to track shared functions (#51618)
Expands the constant pool to be able to reuse function declarations that have identical bodies.

PR Close #51618
2023-09-05 14:19:18 +00:00
Kristiyan Kostadinov
f36cdd6d1a refactor(core): add instruction to reference component instance (#51618)
Adds an instruction that allows us to access the containing component instance directly instead of having to traverse the context tree. This will be necessary for the tracking function of `for` loop blocks.

PR Close #51618
2023-09-05 14:19:18 +00:00
Kristiyan Kostadinov
6ecafa3305 refactor(compiler): computed for loop variables exposed on the wrong scope (#51618)
Fixes that the computed for loop variables (e.g. $first and $last) were exposed on the parent scope instead of the for loop scope.

PR Close #51618
2023-09-05 14:19:18 +00:00
Kristiyan Kostadinov
75ab0bdf45 refactor(compiler): type check deferred when and prefetch when triggers (#51570)
Adds type checking support to the deferred `when` and `prefetch when` triggers.

PR Close #51570
2023-09-05 14:18:44 +00:00
Kristiyan Kostadinov
0c8917b348 refactor(compiler): type check contents of control flow blocks (#51570)
Adds type checking for the contents of `if`, `switch` and `for` blocks.

**Note:** this is just an initial implementation to get some basic type checking working and to figure out the testing setup. We'll need special TCB structures for this syntax so that we can support type narrowing.

PR Close #51570
2023-09-05 14:18:44 +00:00
Kristiyan Kostadinov
98d98f2c94 refactor(compiler): incorrect validation of switch blocks when preserveWhitespaces is enabled (#51570)
When `preserveWhitespaces` is enabled, `switch` blocks can end up with content inside their main block due to the indentation that is usually used for the nested cases. This was tripping up the validation that doesn't allow content inside the main block of `switch`.

These changes update the validation to ignore empty text nodes.

PR Close #51570
2023-09-05 14:18:44 +00:00
Kristiyan Kostadinov
1ce9f0aff3 refactor(compiler): type check the contents of defer blocks (#51570)
Fixes that the contents of `defer` blocks weren't being type checked.

PR Close #51570
2023-09-05 14:18:44 +00:00
Connie Leung
80de2500b2 docs: add Connie Leung to GDE contributors list (#51476)
PR Close #51476
2023-09-05 14:16:35 +00:00
Angular Robot
690c8325cd build: lock file maintenance (#51628)
See associated pull request for more information.

PR Close #51628
2023-09-01 20:44:06 +00:00
Andrew Kushnir
1aff106a87 refactor(core): adjust defer block behavior on the server (#51530)
This commit updates the runtime implementation of defer blocks to avoid their triggering on the server. This behavior was described in the RFC (https://github.com/angular/angular/discussions/50716, see "Server Side Rendering Behavior" section): only a placeholder is rendered on the server at this moment. This commit also updates the logic to make sure that the placeholder content is hydrated after SSR.

PR Close #51530
2023-09-01 19:15:16 +00:00
Andrew Scott
40bb45f329 fix(core): Respect OnPush change detection strategy for dynamically created components (#51356)
This commit fixes a bug in the change detection algorithm that would
ignore the `OnPush`/dirty flag of a component's host when it is created
dynamically. That is, `OnPush` components that were not marked dirty but
were created as embedded views would have their host bindings and `ngDoCheck`
function always run even if they were not dirty.

BREAKING CHANGE: `OnPush` components that are created dynamically now
only have their host bindings refreshed and `ngDoCheck run` during change
detection if they are dirty.
Previously, a bug in the change detection would result in the `OnPush`
configuration of dynamically created components to be ignored when
executing host bindings and the `ngDoCheck` function. This is
rarely encountered but can happen if code has a handle on the
`ComponentRef` instance and updates values read in the `OnPush`
component template without then calling either `markForCheck` or
`detectChanges` on that component's `ChangeDetectorRef`.

PR Close #51356
2023-09-01 17:28:27 +00:00
eddiebee
b37ba05804 docs: update the sentence to express its meaning (#51622)
PR Close #51622
2023-09-01 17:09:28 +00:00
hiepxanh
5a323265cb docs: fix missing information in createComponent (#51493)
PR Close #51493
2023-09-01 16:15:12 +00:00
hiepxanh
6e94e6d7ea docs: add viewContainerRef example (#51573)
PR Close #51573
2023-09-01 16:14:40 +00:00
Andrew Scott
4555290d54 refactor(router): Add a state manager to manage router URL state (#48481)
This commit refactors the router internals to track state inside a separate
`StateManager`. This helps open the door to managing the state in
different, swappable providers. The current interface needed by the
Router is: `currentUrlTree`, `rawUrlTree`, `browserUrlTree`,
`routerState`, and `handleNavigationEvent` (other properties are because
some router properties are writeable when they shouldn't be). This is
a suprisingly small interface and can hopefully be made smaller in the
future (i.e. removing 1 or more of the 3 tracked of `UrlTree`s).

PR Close #48481
2023-09-01 16:12:35 +00:00
Joey Perrott
0907f396d5 build: migrate to node 18 (#51609)
Migrate to use node version 18

PR Close #51609
2023-09-01 15:12:43 +00:00
Shuaib hasan akib
fe1a50c63f docs(docs-infra): mixin generated same multiple css (#51528)
PR Close #51528
2023-09-01 15:12:05 +00:00
Keith Li
dc4b4aa57e feat(devtools): Display getters and setters in devtools property viewer (#49695)
Display the function representations of get/set properties in the property viewer just like the existing UI for function properties

PR Close #49695
2023-09-01 14:41:04 +00:00
Alex Rickabaugh
201ab9d247 refactor(core): switch signals to a refcounting algorithm (#51226)
This commit switches the signals library from a bidirectional symmetric
dependency graph using weak references, to a bidirectional _asymmetric_
graph which uses strong references. This is made possible with a reference
counting algorithm which only tracks producer -> consumer references for
effect-like "live" consumers, preventing memory leaks.

The new algorithm should be simpler and faster than the previous
implementation as weak references are fairly slow to create and traverse.
A tradeoff is that non-live consumers must now poll their producers when
read, as they cannot rely on dirty notifications.

As part of this refactoring, the `ReactiveNode` class is replaced with an
interface instead, and methods are moved to standalone functions. This is
paired with instantiating individual signals/computeds via `Object.create`
against a prototype node which contains static or initial values. This
technique, in conjunction with the rest, greatly improves the performance
of node creation.

PR Close #51226
2023-09-01 14:18:41 +00:00
Pawel Kozlowski
b9ba6e6a16 refactor(core): remove duplicated access to TView (#51610)
Tiny refactoring to remove repeated field access to LView.

PR Close #51610
2023-09-01 14:18:06 +00:00
Angular Robot
bb47f81063 build: update dependency gulp-conventional-changelog to v4 (#51607)
See associated pull request for more information.

PR Close #51607
2023-09-01 14:16:23 +00:00
Ben Hong
3658e25f2e docs: migrate toh-pt0 to standalone (#51575)
PR Close #51575
2023-08-31 21:43:19 +00:00
Matthieu Riegler
05e4dbb859 refactor(core): Use intersections on branded types. (#49702)
An Intersection on a branded type allows us to remove some unecessary type assertions.

PR Close #49702
2023-08-31 20:22:12 +00:00
Shuaib hasan akib
3c28506f8e docs(docs-infra): for accessibility and responsive, iframe should be in video container, contain some space horizontally, and title (#51475)
PR Close #51475
2023-08-31 19:22:10 +00:00
Gerald Monaco
0839885a50 refactor(core): make AfterRenderEventManager tree-shakable (#51541)
In preparation for adding support for phases to after*Render, which will increase the implementation size, this commit splits out the optional logic so that it can be tree-shaken and dynamically loaded.

PR Close #51541
2023-08-31 18:56:23 +00:00
Matthieu Riegler
a1bad49703 refactor(animations): cleanup ahead of animation lazy loading (#51249)
There are no functional changes.

PR Close #51249
2023-08-31 18:35:48 +00:00
Angular Robot
240b7cd9c2 build: update dependency archiver to v6 (#51605)
See associated pull request for more information.

PR Close #51605
2023-08-31 17:32:08 +00:00
AleksanderBodurri
78afe889fd refactor(devtools): migrate material legacy components to mdc (#51590)
Removes all legacy angular material imports and moves devtools over to mdc.

PR Close #51590
2023-08-31 17:31:42 +00:00
Matthieu Riegler
525acbb165 docs: remove NG6999 error page. (#51588)
`NGMODULE_VE_DEPENDENCY_ON_IVY_LIB` was a ViewEngine related error. This commit removes the doc page but keeps a redirection for older versions still throwing this error.

PR Close #51588
2023-08-31 17:30:57 +00:00
Joey Perrott
8a3479b9e4 fix(docs-infra): fix incomplete escaping (#51604)
Correct incomplete escaping

PR Close #51604
2023-08-31 17:15:29 +00:00
Ward Bell
acd59ad037 docs: Migrate Observables guides & code examples to standalone (#51516)
None of the guide pages mentions ngModules. Only `observables-in-angular` needed conversion to Standalone.

However, some of the guide pages reflect old versions of RxJS, including signatures that are no longer valid. These have been corrected.

More significantly, *the existing guide is pretty bad at explaining RxJS and its usage*. It was written (by me I think) in the very early days of Angular and Angular RxJS instruction. I've taught numerous "RxJS in Angular" classes since and learned from that experience what does and does not work with students.

There was neither the time nor the charter to completely overhaul this guide. But this commit attempts to remove what flops with students and to bring the teaching closer to what seems more effectively. I hope reviewers agree that my revisions are an improvement.

**Revised Overview**

The overview doc, `observables.md`, had a few errors (ex: `next` is NOT REQUIRED) and deprecated patterns (you now must pass the Observer object to `subscribe`).

More importantly, it was wildly overcomplicated and scary, especially when it got into multi-casting.

Moved the multi-casting section to  "RxJS Library" and rewrote it (with working example) for simplicity and context.

I made other changes in an effort to make this an overview that is  more comprehensive and more clear. I paid particular attention to the "Basic usage and terms" section.

Finally, I relocated the "Naming conventions for observables" section here from `rx-library`. This is the section that describes the dollar-sign convention. It made more sense for it to be here.

**Revised "RxJS Library" page and code**

*RxJS no longer supports chaining* and hasn't for a very long time. Removed note in `rx-library.md` that suggested you could use operator chaining.

The RxJS `pipe` discussion in the "Operators" section was just weird. Almost no one calls the `pipe` function. We certainly should *start* there. We should start with how people actually use operators - by adding them to the argument list of the `Observable.pipe()` method.

I kept the original `pipe` function example but subordinated it in a "callout". Most readers will (and should) ignore it.

`Subject` is a *critically important RxJS mechanism for creating custom observables*. It was completely missing from the list of observable creators on this guide page. So I added it to the "Observable creation functions" section of the guide and wrote an accompanying `MessageService` code sample (see the new `rx-library/app/` folder).

The `MessageService` is a pretty common pattern in Angular apps - far more common than creating an observable from a counter or an event, two of the creation patterns currently on this page.

This new section also afforded an opportunity to show how RxJS helps with building loosely coupled applications. We will soon be talking about Signals. Many will wonder whether and when they should still use RxJS.

At least a partial answer is that RxJS is really good at progressively combining and enhancing streams of data as they cross component boundaries. Of course you can pass signals around; but they are not as rich in transformers as RxJS. This is where RxJS shines.

**Revised "Comparing observables"**

The Promises section in `comparing-observables.md` had many errors and misleading remarks.

The comparison of error handling was especially egregious; the code example for that was nonsense.

The "Chain" sub-section was really about transforming values. It also failed to demonstrate chaining promise `.then`s.

Reworked these sub-sections and improved the code samples to match.

PR Close #51516
2023-08-31 17:00:46 +00:00
Andrew Scott
92f478ea7d docs: update router reference to use standalone (#51560)
this commit updates the router reference to use standalone features.

PR Close #51560
2023-08-31 16:59:15 +00:00
Andrew Scott
f464e39364 fix(router): Ensure title observable gets latest values (#51561)
The data `Observable` is not updated unless there have been changes to
the object. The current diffing does not look at `symbol` keys of the
object but the `title` property is stored as a private `symbol`. This
commit updates the object diffing to include symbols.

fixes #51401

PR Close #51561
2023-08-31 16:42:44 +00:00
Ben Hong
e4d2018f46 docs: migrate user-input code example to standalone (#51466)
PR Close #51466
2023-08-31 16:37:00 +00:00
Ben Hong
b710ab63b4 docs: migrate two-way-binding to standalone (#51574)
PR Close #51574
2023-08-31 16:36:29 +00:00
Joey Perrott
cfcd2e3aeb refactor(docs-infra): correct incomplete string replacement (#51585)
Find all usages of `\n` and replace them instead of just the first.

PR Close #51585
2023-08-31 16:35:51 +00:00
Angular Robot
c439a40db2 build: update dependency google-closure-compiler to v20230802 (#51265)
See associated pull request for more information.

PR Close #51265
2023-08-31 16:34:49 +00:00
Angular Robot
2b518bb899 build: update actions/checkout digest to f43a0e5 (#51576)
See associated pull request for more information.

PR Close #51576
2023-08-31 16:34:23 +00:00
Joey Perrott
544c778b98 ci: fix permissions issue in zonejs ci test (#51600)
Correct permissions issue in zonejs folders

PR Close #51600
2023-08-31 16:26:16 +00:00
Paul Gschwendtner
eab92167e5 build: enable video recording for saucelabs bazel tests (#51533)
We temporarily enable video recording for Saucelabs bazel tests. We are
seeing some flakiness here, and before we can replace the legacy job,
we should understand why the browsers sometimes disconnect.

PR Close #51533
2023-08-30 19:44:45 +00:00
Paul Gschwendtner
8a22c60ec0 build: improve debug logging of saucelabs daemon (#51533)
We should print more specific details about a browser being used
for tests. This will help us debug timeout/flakiness easier.

PR Close #51533
2023-08-30 19:44:45 +00:00
Paul Gschwendtner
a671020f0b build: increase idle timeout for saucelabs daemon (#51533)
Saucelabs seemingly has increased the maximum idle timeout. So we
leverage that to improve stability of our tests. Useful when e.g.
the heartbeat webdriver commands are for some reasons delayed.

PR Close #51533
2023-08-30 19:44:45 +00:00
Joey Perrott
2c11b83487 ci: migrate zonejs tests to gha (#51352)
Migreate zonejs tests from CircleCI to Github Actions

PR Close #51352
2023-08-30 19:42:55 +00:00
Joey Perrott
e6235accb1 docs: remove unreachable/incorrect contributor links (#51350)
PR Close #51350
2023-08-30 19:41:53 +00:00