Commit graph

27174 commits

Author SHA1 Message Date
Alex Rickabaugh
6984431dde refactor(compiler): write expressions in the template pipeline (#50118)
This commit adds ingest and transformation support for property writes and
keyed writes to the template pipeline.

PR Close #50118
2023-06-01 08:46:08 -07:00
Alex Rickabaugh
a48c5f72a6 refactor(compiler): support pipes in the template pipeline (#50118)
This commit adds end-to-end support for pipes in the template pipeline. This
support works across multiple steps:

1. Pipes are first ingested as `ir.PipeBindingExpr`s during the ingest step.

2. A "pipe creation" phase inserts operations to instantiate each required
pipe, based on the presence of those `ir.PipeBindingExpr`s.

3. A "variadic pipe" phase transforms pipes with more than 4 arguments into
variadic pipe bindings, which use a literal array argument. This literal
array will be later memoized into a pure function invocation.

4. A special phase (`phaseAlignPipeVariadicVarOffset`) reconciles a
difference in variable slot assignment logic between the template pipeline
and the `TemplateDefinitionBuilder`, to ensure that the pipeline output can
pass the existing tests. This phase should not affect runtime semantics and
can be dropped once matching output is no longer necessary.

5. Reification emits pipe instructions based on the argument count.

PR Close #50118
2023-06-01 08:46:07 -07:00
Alex Rickabaugh
cc51122c52 refactor(compiler): fix insertBefore ownership logic (#50118)
The logic for `insertBefore` in template pipeline operation lists has a bug
when inserting at the end of a list. This commit fixes the safety assertions
to be more accurate.

PR Close #50118
2023-06-01 08:46:07 -07:00
Alex Rickabaugh
803d7dc01d refactor(compiler): convert conditional ast in template pipeline (#50118)
This commit adds support for ternary expressions in the ingest operation of
the template pipeline.

PR Close #50118
2023-06-01 08:46:07 -07:00
Alex Rickabaugh
35227049a1 refactor(compiler): purify literal arrays and maps in template pipeline (#50118)
This commit transforms literal arrays and maps within expressions in the
template pipeline into `ir.PureFunctionExpr` expressions, in order to
memoize the allocation of objects and arrays inside the update pass of
change detection.

PR Close #50118
2023-06-01 08:46:07 -07:00
Alex Rickabaugh
a56726c069 refactor(compiler): transform all expressions in the template pipeline (#50118)
Previously the helper operations for transforming expressions in the
template pipeline would only operate against `ir.Expression`s. This commit
changes them to process `o.Expression`s instead, paving the way to use them
for transformations of native expressions in addition to IR expressions.

PR Close #50118
2023-06-01 08:46:07 -07:00
Alex Rickabaugh
1b37dcda61 refactor(compiler): add pure function support to the template pipeline (#50118)
This commit adds support for generating pure functions in the output
`ConstantPool` based on `ir.PureFunctionExpr`s. Note that nothing yet
generates these pure function forms - in the future they will be used both
in the implementation of the `pipeBindV` instruction as well as literal
arrays and maps in expressions.

PR Close #50118
2023-06-01 08:46:07 -07:00
Alex Rickabaugh
1928cd82d9 refactor(compiler): add ConstantPool to template pipeline compilations (#50118)
This commit adds the `ConstantPool` to `ComponentCompilation`, making it
available to all phases of the template pipeline. Constant extraction is a
common operation in pipeline phases.

PR Close #50118
2023-06-01 08:46:06 -07:00
Alex Rickabaugh
11469b58c3 refactor(compiler): add shared constant concept to ConstantPool (#50118)
This commit adds a "shared constant" concept to the `ConstantPool`. This
is a generalization of the `LiteralFactory` concept the pool previously
supported. For stability's sake, the existing concept isn't modified, but
could be unified in the future.

PR Close #50118
2023-06-01 08:46:06 -07:00
Alex Rickabaugh
93c9e9d456 refactor(compiler): add UsesVarOffset trait to template pipeline (#50118)
This commit introduces a new trait `UsesVarOffset` for expressions which
consume variable slots and thus need an offset into the variable slot space
to locate their slots.

PR Close #50118
2023-06-01 08:46:06 -07:00
Alex Rickabaugh
8dc2029012 refactor(compiler): generalize interpolation calling for v-arg functions (#50118)
The template pipeline implements variadic instruction generation for text
node interpolation using an `InterpolationConfig` concept. This commit
refactors that code to generalize it to work not just with interpolations,
but with all instruction generation for variadic instructions.

PR Close #50118
2023-06-01 08:46:06 -07:00
Alex Rickabaugh
05026a2a24 refactor(compiler): support literal array/maps in the template pipeline (#50118)
This commit adds support to the template pipeline to ingest and process
literal array and map expressions. A future phase may process these literal
expressions and memoize them into pure functions where required.

PR Close #50118
2023-06-01 08:46:06 -07:00
Alan Agius
540e643347 fix(compiler): do not remove comments in component styles (#50346)
Prior to this commit, comments in CSS were being removed. This caused inline sourcemaps to break to the shift in lines.

This caused sourcemaps to break in the ESBuild based builder as this always adds comments at the top of the file with the filename.

Example
```css
 /* src/app/app.component.scss */
* {
  color: red;
  background: transparent;
}
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8uL3NyYy9hcHAvYXBwLmNvbXBvbmVudC5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBOzs7Ozs7Ozs7Q0FBQTtBQVdBO0VBQ0UsVUFBQTtFQUNBLHVCQUFBO0FBREYiLCJzb3VyY2VzQ29udGVudCI6WyIvL01FRElBIFFVRVJZIE1BTkFHRVJcbi8qXG4gIDAgLSA2MDA6IFBob25lXG4gIDYwMCAtIDkwMDogVGFibGV0IHBvcnRyYWl0XG4gIDkwMCAtIDEyMDA6IFRhYmxldCBsYW5kc2NhcGVcbiAgMTIwMCAtIDE4MDA6IE5vcm1hbCBzdHlsZXNcbiAgMTgwMCsgOiBCaWcgRGVza3RvcFxuICAxZW0gPSAxNnB4XG4gIFRoZSBzbWFsbGVyIGRldmljZSBydWxlcyBhbHdheXMgc2hvdWxkIHdyaXRlIGJlbG93IHRoZSBiaWdnZXIgZGV2aWNlIHJ1bGVzXG4gIEZpeGluZyBPcmRlciA9PiBCYXNlICsgVHlwb2dyYXBoeSA+PiBHZW5lcmFsIExheW91dCArIEdyaWQgPj4gUGFnZSBMYXlvdXQgKyBDb21wb25lbnRcbiovXG5cbioge1xuICBjb2xvcjogcmVkO1xuICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDtcbn1cbiJdLCJzb3VyY2VSb290IjoiIn0= */
```

Closes #50308

PR Close #50346
2023-06-01 08:45:11 -07:00
Angular Robot
57d47b34fd build: update dependency eslint-plugin-jsdoc to v46 (#50524)
See associated pull request for more information.

PR Close #50524
2023-06-01 08:44:30 -07:00
Matthieu Riegler
019c2d2f14 docs: selector precisions (#50534)
This commit fixes the layout of the page and adds a precision on what selectors are supported by ng-content

See #50511

PR Close #50534
2023-06-01 08:43:59 -07:00
Dylan Hunn
84b6ef0262 release: cut the v16.1.0-next.3 release 2023-06-01 08:40:56 -07:00
Dylan Hunn
7f85d08450 docs: release notes for the v16.0.4 release 2023-06-01 08:33:18 -07:00
Julian Andres Gomez Gomez
7e468dffce docs: correct Signals documentation (#50518)
Remove "only" word from "Reading without tracking dependencies" effect explanation

PR Close #50518
2023-05-31 12:39:37 -07:00
Alex Rickabaugh
72b4ff4b9e fix(common): untrack subscription and unsubscription in async pipe (#50522)
This commit wraps the actual subscription/unsubscription in the `async`
pipe with `untracked`, to ensure that any signal reads/writes which might
take place in `Observable` side effects are not attributed to the template.

Fixes #50382

PR Close #50522
2023-05-31 12:38:30 -07:00
Arno Chauveau
915abc6f35 docs(router): correct references to guard services (#50514)
PR Close #50514
2023-05-31 12:37:19 -07:00
gdarnell
ac447ede22 refactor(common): fix variable name (#50521)
The PreloadLinkCreator instance was assigned to a variable named preloadLinkChecker, which is confusing because PreloadLinkChecker is also a thing.

PR Close #50521
2023-05-31 12:36:49 -07:00
Angular Robot
7ca301acd5 build: update dependency eslint-plugin-jsdoc to v45 (#50523)
See associated pull request for more information.

PR Close #50523
2023-05-31 12:34:26 -07:00
Jessica Janiuk
7567348c54 Revert "fix(zone.js): enable monkey patching of the queueMicrotask() API in node.js (#50467)" (#50529)
This reverts commit 381cb98226.

PR Close #50529
2023-05-31 09:57:42 -07:00
Jessica Janiuk
069498ca89 build: Fix size tracking test (#50531)
One of our goldens needed to be bumped.

PR Close #50531
2023-05-31 14:43:52 +00:00
Matthieu Riegler
0c441f6d64 refactor(platform-browser): Remove BrowserDetection (#50411)
Our tests should rely on the running browser.

PR Close #50411
2023-05-30 13:06:28 -07:00
Matthieu Riegler
8a30faf08c docs: Adding myself to the collaborators (#50494)
Let's continue building Angular ! =)

PR Close #50494
2023-05-30 13:05:55 -07:00
Paul Gschwendtner
ea00ab86e0 build: remove console output from locale build action (#50426)
Bazel build actions should never print something to the console
on success as this would pollute the overall action output.

PR Close #50426
2023-05-30 13:05:18 -07:00
Paul Gschwendtner
074abad64c build: speed up locale file generation to improve DX (#50426)
Before this commit, building everything to run `@angular/core` tests:
```
INFO: Elapsed time: 76.496s, Critical Path: 72.92s
INFO: 225 processes: 125 internal, 5 linux-sandbox, 2 local, 93 worker.
INFO: Build completed successfully, 225 total actions
```

After:
```
Use --sandbox_debug to see verbose messages from the sandbox
INFO: Elapsed time: 15.952s, Critical Path: 10.75s
INFO: 200 processes: 128 internal, 4 linux-sandbox, 2 local, 66 worker.
```

This being on a specialist Cloudtop.

PR Close #50426
2023-05-30 13:05:18 -07:00
Angular Robot
f5b82b54b6 build: update github/codeql-action action to v2.3.5 (#50508)
See associated pull request for more information.

PR Close #50508
2023-05-30 13:04:42 -07:00
Ady Ngom
5abe0c513b docs: add Ady Ngom to GDE resources (#49759)
[x] The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit
[] Tests for the changes have been added (for bug fixes / features)
[] Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce?

[] Bugfix
[] Feature
[] Code style update (formatting, local variables)
[] Refactoring (no functional changes, no api changes)
[] Build related changes
[] CI related changes
[] Documentation content changes
[x] angular.io application / infrastructure changes
[] Other... Please describe:

[] Yes
[x] No

Based on information provided [here](https://github.com/WebGDEProgram/main/tree/master/Angular)

PR Close #49759
2023-05-30 13:02:22 -07:00
Angular Robot
ad3197e96a build: update all non-major dependencies (#50417)
See associated pull request for more information.

PR Close #50417
2023-05-30 13:01:50 -07:00
Kristiyan Kostadinov
68017d4e75 feat(core): add ability to transform input values (#50420)
According to the HTML specification most attributes are defined as strings, however some can be interpreted as different types like booleans or numbers. [In the HTML standard](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes), boolean attributes are considered `true` if they are present on a DOM node and `false` if they are omitted. Common examples of boolean attributes are `disabled` on interactive elements like `<button>` or `checked` on `<input type="checkbox">`. Another example of an attribute that is defined as a string, but interpreted as a different type is the `value` attribute of `<input type="number">` which logs a warning and ignores the value if it can't be parsed as a number.

Historically, authoring Angular inputs that match the native behavior in a type-safe way has been difficult for developers, because Angular interprets all static attributes as strings. While some recent TypeScript versions made this easier by allowing setters and getters to have different types, supporting this pattern still requires a lot of boilerplate and additional properties to be declared. For example, currently developers have to write something like this to have a `disabled` input that behaves like the native one:

```typescript
import {Directive, Input} from '@angular/core';

@Directive({selector: 'mat-checkbox'})
export class MatCheckbox {
  @Input()
  get disabled() {
    return this._disabled;
  }
  set disabled(value: any) {
    this._disabled = typeof value === 'boolean' ? value : (value != null && value !== 'false');
  }
  private _disabled = false;
}
```

This feature aims to address the issue by introducing a `transform` property on inputs. If an input has a `transform` function, any values set through the template will be passed through the function before being assigned to the directive instance. The example from above can be rewritten to the following:

```typescript
import {Directive, Input, booleanAttribute} from '@angular/core';

@Directive({selector: 'mat-checkbox'})
export class MatCheckbox {
  @Input({transform: booleanAttribute}) disabled: boolean = false;
}
```

These changes also add the `booleanAttribute` and `numberAttribute` utilities to `@angular/core` since they're common enough to be useful for most projects.

Fixes #8968.
Fixes #14761.

PR Close #50420
2023-05-30 13:01:13 -07:00
alkavats1
25b6b9788d docs: improved code quality (#50443)
PR Close #50443
2023-05-30 13:00:39 -07:00
alkavats1
178ece4dfb docs: correcting existing import for the commonHttpTesting (#50473)
PR Close #50473
2023-05-30 12:59:53 -07:00
alkavats1
d856be0314 docs: removed the obsolete frameborder Tag and updated the files with using css (#50480)
PR Close #50480
2023-05-30 12:59:26 -07:00
Matthieu Riegler
1ca6362c06 docs(docs-infra): rimraf requires the globflag. (#50493)
On windows rimraf requires since v4 the glob flag to support wildcards in path.

fixes #49806

PR Close #50493
2023-05-30 12:58:52 -07:00
Alan Agius
0c80349cf6 refactor(http): replace zone.js macrotask creation with InitialRenderPendingTasks (#50425)
This commits refactors the HTTP client to use `InitialRenderPendingTasks` instead of Zone.js macrotask. This is another approach to https://github.com/angular/angular/pull/50406 which was revert due to a failure in G3.

PR Close #50425
2023-05-30 12:58:22 -07:00
Alan Agius
28c68f709c fix(core): update ApplicationRef.isStable to account for rendering pending tasks (#50425)
This commit updates the `ApplicationRef.isStable` API to account for
pending rendering task. This is needed as once a pending rendering task
is done, new macrotask and microtask could be created which previously caused these not
to be intercepted and thus ignored when doing SSR.

PR Close #50425
2023-05-30 12:58:22 -07:00
Alan Agius
381cb98226 fix(zone.js): enable monkey patching of the queueMicrotask() API in node.js (#50467)
Similar to the browser, now we also monkey patch `queueMicrotask` in Node.js. This API was added in Node.js 11.

PR Close #50467
2023-05-30 12:57:45 -07:00
alkavats1
5576b9a5ea docs: removed the unused import and update the obsolete tag of width in table tag (#50474)
PR Close #50474
2023-05-30 09:23:06 -07:00
Asheer Rizvi
019eaf6831 docs: corrected method name for "Tap into the Observable" section (#50479)
At this point in the tutorial we are still talking about the `getHeroes()` method. Corrected the method name to reflect that since the final piece of code within this section is for `getHeroes()`
PR Close #50479
2023-05-30 09:22:36 -07:00
alkavats1
9acc0e32c4 docs: refactored the markup tags (#50481)
PR Close #50481
2023-05-30 09:21:58 -07:00
alkavats1
7d8ebfc949 docs: updated the deprecated tag of width in table tag (#50487)
PR Close #50487
2023-05-30 09:21:27 -07:00
Alan Agius
62e76d4d20 docs: update CLI command to include --preserve-symlinks-main (#50512)
This is needed to instructs the module loader to preserve symbolic links when resolving and caching the main module.

More information about this flag can be found: https://nodejs.org/api/cli.html#--preserve-symlinks-main

Closes: #50515

PR Close #50512
2023-05-30 09:20:53 -07:00
Alan Agius
f414e26521 docs: remove outdated command to run Angular CLI when using ng-dev misc build-and-link (#50512)
Setting `BAZEL_TARGET="1"` is no longer needed as NGCC has been removed.

PR Close #50512
2023-05-30 09:20:53 -07:00
Dylan Hunn
6f5dabe0d2 Revert "fix(http): create macrotask during request handling instead of load start (#50406)" (#50475)
This reverts commit 2cdb4c5911.

PR Close #50475
2023-05-25 16:24:39 -04:00
Matthieu Riegler
bada9199f5 fix(animations): Trigger leave animation when ViewContainerRef is injected (#48705)
Injecting `ViewContainerRef` into a component makes it effectively a container. The leave animation wasn't triggered on containers before this fix.

fixes angular#48667

PR Close #48705
2023-05-25 14:40:34 -04:00
Andrew Kushnir
3a05e4cca1 refactor(platform-server): exclude provideHttpClient() call from provideServerRendering() (#50459)
Previously, we've used to have server-specific logic for HttpClient, so there was a need to re-provide it with the right config. Since v16, that logic was refactored and there is no need to re-provide HttpClient anymore. The code in the `provideServerRendering()` was retained for historical reasons and it makes application configuration more difficult, because it forces developers to copy HttpClient config into server config as well (otherwise it would not be take into account).

This commit removes the `provideHttpClient()` call from the `provideServerRendering()` function. This is **not** a breaking change, since we've also merge browser application config in the `app.config.server.ts`, so if an application is configured to use HttpClient, it will continue to work on both client and server sides.

Resolves #50454.

PR Close #50459
2023-05-25 14:41:34 +00:00
Angular Robot
04553b9016 build: update dependency https-proxy-agent to v7 (#50456)
See associated pull request for more information.

PR Close #50456
2023-05-25 14:40:05 +00:00
Kristiyan Kostadinov
721bc72649 fix(compiler): resolve deprecation warning with TypeScript 5.1 (#50460)
We have a code path that accesses the `originalKeywordKind` property which logs a deprecation warning in version 5.1, but isn't available in some of the earlier versions that we support. These changes add a compatibility layer that goes through the non-deprecated function, if it exists.

PR Close #50460
2023-05-25 14:39:27 +00:00