9369 Commits

Author SHA1 Message Date
Walid Bouguima 35fc4e11c8 docs(router): canMatch route guard method signature update (#49140)
Very cosmetic, but it might be necessary : 

I updated the ```canAccess``` method second signature name and type in the provided sample. As it stands, it triggers `TS(2345):  Argument of type 'Route' is not assignable to parameter of type 'string'`.
PR Close #49140
2023-02-21 13:23:08 -08:00
cexbrayat 8df5100896 refactor(http): simplify HttpClientModule XSRF configuration (#48957)
The current configuration of `HttpClientModule` explicitely enables the XSRF configuration,
but this XSRF configuration is the one used by default by `provideHttpClient`.

See https://github.com/angular/angular/blob/main/packages/common/http/src/provider.ts#L50-L98

PR Close #48957
2023-02-17 11:17:54 -08:00
Alan Agius 3f1e5897c3 Revert "fix(platform-server): insert transfer state script before other script tags (#48868)" (#49112)
This reverts commit 2fc5b70fce as this change is no longer needed since `type=module` script are deferred by default. Which causes the transfer data to be queried after the browser has finished parsing the DOM.

PR Close #49112
2023-02-17 11:09:22 -08:00
Matthieu Riegler aec2bab090 refactor: remove unnecessary file (#49042)
view had a single export from a file located in the same package, no need to keep it.

PR Close #49042
2023-02-17 11:08:34 -08:00
Andrew Kushnir dea403e43f fix(platform-server): avoid duplicate TransferState info after renderApplication call (#49094)
This commit updates the `renderApplication` function to avoid duplicate serialization of the data from the `TransferState` class. The `renderApplication` function imports providers from the `ServerModule`, which already include the `TransferState` serialization providers, but the same providers were also included inside the `renderApplication` as well, which led to the duplication.

PR Close #49094
2023-02-16 16:00:29 -08:00
Matthieu Riegler 4bc508a8e1 refactor: restore tree shaking for a warning message (#49064)
`getInheritedInjectableDef` logs a depreciation warning that can be tree shaked in prod. Let's do it.

PR Close #49064
2023-02-16 15:55:44 -08:00
Ilyass 6cfe79f0a3 docs(core): typo adding missing comma (#49088)
PR Close #49088
2023-02-16 15:49:09 -08:00
Angular Robot a665823ac6 build: update dependency google-closure-compiler to v20230206 (#49028)
See associated pull request for more information.

PR Close #49028
2023-02-14 16:24:23 +01:00
Paul Gschwendtner 51765fd778 test: update symbol extractor test goldens to reflect terser updates (#49000)
The terser update included various changes, including changes to the
inline optimizations. Constants like for the bloom filter are no longer
inlined multiple times, but instead the constant is preserved and used
with a shortened/mangled name.

Note this also applies to other symbols like `SimpleChanges` too.

This means that such new variables now show up in the symbols goldens.

Concrete examples of inlined & no-longer inlined constants can be
seen in the PR description: https://github.com/angular/angular/pull/49000#issue-1576416106

PR Close #49000
2023-02-13 09:12:50 +01:00
Dylan Hunn 5f2a3edcf2 fix(forms): Make radio buttons respect [attr.disabled] (#48864)
`setDisabledState` is supposed to be called whenever the disabled state of a control changes, including upon control creation. However, a longstanding bug caused the method to not fire when an *enabled* control was attached. This bug was fixed in v15.

This had a side effect: previously, it was possible to instantiate a reactive form control with `[attr.disabled]=true`, even though the the corresponding control was enabled in the model. (Note that the similar-looking property binding version `[disabled]=true` was always rejected, though.) This resulted in a mismatch between the model and the DOM. Now, because `setDisabledState` is always called, the value in the DOM will be immediately overwritten with the "correct" enabled value.

Users should instead disable the control directly in their model. (There are many ways to do this, such as using the `{value: 'foo', disabled: true}` constructor format, or immediately calling `FooControl.disable()` in `ngOnInit`.)

If this incompatibility is too breaking, you may also opt out using `FormsModule.withConfig` or `ReactiveFormsModule.withConfig` at the time you import it, via the `callSetDisabledState` option.

However, there is an exceptional case: radio buttons. Because Reactive Forms models the entire group of radio buttons as a single `FormControl`, there is no way to control the disabled state for individual radios, so they can no longer be configured as disabled.

In this PR, we have special cased radio buttons to ignore their first call to `setDisabledState` when in `callSetDisabledState: 'always'` mode. This preserves the old behavior.

PR Close #48864
2023-02-10 11:25:12 +01:00
PaloMiklo d814de2b49 docs(platform-browser): Sanitize method has more explicit documentation (#48765)
PR Close #48765
2023-02-10 09:28:20 +01:00
Paul Gschwendtner b24cf027d3 build: remove unused webdriver-manager code (#49009)
We no longer need webdriver-manager as everything is tested
using Bazel with the Bazel-managed browsers and chrome/gecko drivers.

The drivers and browser binaries are managed as part of dev-infra's
shared browser/driver configuration in `bazel/browsers`.

PR Close #49009
2023-02-10 08:25:58 +01:00
Matthieu Riegler c6dce66f69 refactor(forms): removing a workaround comment (#48904)
The code is clearer without the reduce, let's just remove the comment.

PR Close #48904
2023-02-06 12:37:48 -08:00
Matthieu Riegler ab85f7b512 refactor(compiler): Remove strictStyling option for ShadowCss (#48824)
`strictStyling` was an option provided by Polymer but it's not needed by Angular. This commit removes the dead code and updates related comments.

PR Close #48824
2023-02-02 13:38:39 -08:00
Payam Valadkhan 21af883970 refactor(compiler-cli): Export the interface PluginCompilerHost for 1p use. (#48874)
Some 1p module which uses the method TscPlugin.wrapHost requires to import this type to make its internal class definitions compatible with this type.

PR Close #48874
2023-02-02 09:44:18 -08:00
Matthieu Riegler d5b2c249a3 fix(router): Handle routerLink directive on svg anchors. (#48857)
On svgs, the tagNames are lowercase even for non-svg related tags like `a`.

fixes #48854

PR Close #48857
2023-02-02 09:38:06 -08:00
Matthieu Riegler 6193cebacd refactor(common): Remove currency pipe depreciation notice about the default currency (#48872)
Currency pipe won't be using the LOCALE_ID to determine the default currency.

fixes #47612

PR Close #48872
2023-02-02 09:30:05 -08:00
Matthieu Riegler d4926f3861 refactor: remove todos on forms tests (#48894)
Removing the todos implied using fakeAsync and passing an async validator as async (3rd parameter).

PR Close #48894
2023-02-02 09:28:39 -08:00
Matthieu Riegler b4d93d16d4 refactor(forms): remove deprecated uses from the unit tests (#48894)
Jasmine has deprecated the `expectationFailOutput` argument and replaced it by the `withContext()` method

Also removing all references to #24571 from the forms unit tests as the non null assertions are fine in the context.

PR Close #48894
2023-02-02 09:28:39 -08:00
Alan Agius 73972c684e fix(platform-server): insert transfer state script before other script tags (#48868)
Previously, the state `script` was always appended as the last item in the `body` tag. This can result in the state not being available when the Angular application is bootstrap.
A workaround for this was to delay the bootstrapping of the application until by using the `DOMContentLoaded` event listener.

```ts
const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);

document.addEventListener('DOMContentLoaded', bootstrap);
```

With this change the above workaround is no longer necessary as the state `script` tag is now added prior of any other `script` which guarantees that the state is present prior of the Angular application is bootstrapped.

PR Close #48868
2023-01-30 16:54:07 -08:00
Dario Piotrowicz d36dfd4b62 fix(animations): fix non-animatable warnings for easing (#48583)
the easing "prop" used to specify the easing function to
apply to animations isn't a valid css property, it is thus
considered not animatable but different values for such
property shouldn't cause non-animatable warnings

resolves #48571

PR Close #48583
2023-01-26 22:03:08 +00:00
Jessica Janiuk 9e86dd231b fix(migrations): Fixed file format issue with lint (#48859)
A file was out of format and throwing lint errors. This fixes it.

PR Close #48859
2023-01-26 16:47:25 +00:00
Kristiyan Kostadinov af31f98b00 fix(migrations): migration host incorrectly reading empty files (#48849)
Fixes that the migration host was doing a basic falsy check if the content was read correctly which meant that a component with an empty template would be considered as having a missing template file.

Fixes #48846.

PR Close #48849
2023-01-26 15:54:14 +00:00
Iván Navarro a334e4efbe fix(common): warn if using ngSrcset without a configured image loader (#48804)
Warn the user in the console in case the `ngSrcset` is present and no
loader is configured. In this case, the default loader is used and
it ignores this attribute.

PR Close #48804
2023-01-25 19:27:01 +00:00
Matthieu Riegler 6e197520dd refactor(upgrade): rewrite the downgrade component adapter (#48715)
To remove the non-null assertions linked to #24571, DowngradeComponentAdapter has been refactored and the public methods have been simplifed.

PR Close #48715
2023-01-25 18:32:05 +00:00
Matthieu Riegler 936beade99 refactor(upgrade): code cleaning on upgrade module (#48715)
This commit removes unused code, non-null assertions linked to #24571 and improves readability

PR Close #48715
2023-01-25 18:32:05 +00:00
Matthieu Riegler 566f2918eb refactor(upgrade): code cleaning on tests (#48715)
This commit removes the null assertions linked to #24571

PR Close #48715
2023-01-25 18:32:05 +00:00
Kristiyan Kostadinov 171b4d4640 fix(compiler): incorrect code when non-null assertion is used after a safe access (#48801)
Fixes that the expression converter was producing code that throws a runtime error if a non-null assertion is used as a part of a safe read, write or call.

Fixes #48742.

PR Close #48801
2023-01-25 18:31:37 +00:00
Matthieu Riegler 6caa51ee6e docs: fix the documentation for BootstrapOptions (#48834)
Inline code was being rendered on aio, this commit fixes this.

PR Close #48834
2023-01-25 18:31:08 +00:00
dario-piotrowicz 552cd3fb5c refactor: remove unnecessary test support check utilities (#47543)
remove the following utilities used in unit tests which check for features
that are supported by all supported browsers:
 - supportsCustomElements
 - supportsWebAnimation
 - supportsRegExUnicodeFlag
 - supportsTemplateElement

also remove the following utilities which check for features that are
not supported (and aren't going to be) by any of the supported browsers:
 - supportsDeprecatedCustomCustomElementsV0
 - supportsDeprecatedShadowDomV0

PR Close #47543
2023-01-24 21:06:09 +00:00
Charles Lyding 067c4ce4fd refactor(localize): bundle message digest algorithm directly in npm package (#48799)
The main entry point for the `@angular/localize` package no longer imports
the `@angular/compiler` package and now has no external dependencies. This
allows the main functionality of the package to be used without requiring
any other Angular packages. Only the message digest algorithm implementation
from the `@angular/compiler` package was being used and this code is now
bundled directly into the final npm package for `@angular/localize`.
The `tooling` secondary entry point still leverages and requires Angular
related packages (`@angular/compiler`/`@angular/compiler-cli`). However,
the tooling functionality is not intended to be used and/or bundled in
a web application.

Closes #48163

PR Close #48799
2023-01-24 18:31:25 +00:00
Matthieu Riegler 98ccb57117 fix(compiler): handle css selectors with space after an escaped character. (#48558)
In Css, selectors with escaped characters require a space after if the following character is a hex character. ie: .\fc ber which matches class="über"
These escaped selectors happen for example when esbuild run with `optimization.minify`

fixes #48524

PR Close #48558
2023-01-24 17:46:34 +00:00
JoostK 145f848a10 fix(compiler-cli): resolve deprecation warning (#48812)
This commit updates one usage of the `ts.factory.createMethodDeclaration` API
to avoid a deprecated function signature, which avoids logging a warning.

PR Close #48812
2023-01-24 16:45:12 +00:00
Matthieu Riegler 7d2a28d746 refactor(service-worker): removing some todos (#48707)
Removing some outdated/unnecessary todos.

PR Close #48707
2023-01-24 16:40:23 +00:00
Paul Gschwendtner 92ab80d44a refactor(bazel): remove unnecessary banner stamping code (#48798)
The `ng_package` rule supports replacing `0.0.0-PLACEHOLDER`
in license files that are inserted as part of rollup. This
requires additional logic to detect stamping, reading the status
files and then replacing the placeholder.

All of this already handled as part of normal package substitutions
and we can replace this unnecessary complexity.

See: https://github.com/bazelbuild/rules_nodejs/blob/da50feb23f911b8b6932d31bbff284fb21b44b6c/internal/pkg_npm/pkg_npm.bzl#L195

PR Close #48798
2023-01-20 18:39:22 +00:00
Payam Valadkhan 60a7214ab2 refactor(bazel): Extract the helper patchNgHostWithFileNameToModuleName to its own file for 1P use (#48739)
Some 1P tools require to use the helper patchNgHostWithFileNameToModuleName, and the present location of this helper leads to circular depedency. So it is required to move this helper into a separate module to facilitate importing.

PR Close #48739
2023-01-19 17:34:57 +00:00
Andrew Scott a6b10f6e59 fix(router): 'createUrlTreeFromSnapshot' with empty paths and named outlets (#48734)
The details of this commit are pretty thoroughly described in the tests
and code comments. In short, it is sometimes ambiguous where to apply commands in
a `SegmentGroup` tree that is created from an `ActivatedRoute` when
dealing with empty paths. This adjusts the strategy to tolerate more
ambiguity while still allowing developers to be explicit.

This is a fix-forward for b/265215141

PR Close #48734
2023-01-18 10:46:44 -08:00
Andrew Scott 080b87559e test(router): update createUrlTree tests to not use mocks (#48734)
The mocks in the tests make them hard to understand and they don't always test real router behavior

PR Close #48734
2023-01-18 10:46:44 -08:00
Angular Robot ec5aae467c build: update all non-major dependencies (#48755)
See associated pull request for more information.

PR Close #48755
2023-01-17 09:16:20 -08:00
Kristiyan Kostadinov 0eec71f806 test: remove usages of deprecated runSchematicAsync function (#48745)
Removes our usages of `runSchematicAsync` since it is deprecated.

PR Close #48745
2023-01-17 09:13:39 -08:00
Pawel Kozlowski 032b2bd689 perf(common): avoid excessive DOM mutation in NgClass (#48433)
This commit represents rewrite of the NgClass directive to address
severe performance problem (excessive DOM mutation). The modified
algorithm removes all the known performance clifs and has number of
desirable properties:
- it is shorter and (arguably) easier to follow;
- drops usage of existing differs thus limiting dependencies on other
part of the code without increasing size of the directive;
- doesn't degrade any other performance metrics.

Fixes #25518

PR Close #48433
2023-01-13 10:38:54 -08:00
Pawel Kozlowski 3f440d979e refactor(common): remove unnecessary curly brackets (#48433)
Remove unnecessary curly brackets in tests.

PR Close #48433
2023-01-13 10:38:54 -08:00
ced 99c55c4345 refactor(router): remove unused parameter in navigation internal function (#48724)
The internal `cancelNavigationTransition` required an unused `router` parameter.

PR Close #48724
2023-01-13 10:37:25 -08:00
Angular Robot 112941d693 build: update dependency @rollup/plugin-commonjs to v24 (#48530)
See associated pull request for more information.

PR Close #48530
2023-01-13 10:35:19 -08:00
Paul Gschwendtner 4e2bf140e8 build: update ng-dev and account for stamping changes (#48732)
* updates ng-dev and build-tooling since the previous SHAs are
no longer existent after the CircleCI incident snapshot build removal.
* accounts for the new stamping variables.

PR Close #48732
2023-01-13 14:37:13 +00:00
Alex Rickabaugh dd54f6bd96 fix(core): makeEnvironmentProviders should accept EnvironmentProviders (#48720)
`makeEnvironmentProviders` constructs the wrapped `EnvironmentProviders`
type, which can only be used in environment injectors (not element
injectors). It makes sense that `makeEnvironmentProviders` should be able
to accept existing `EnvironmentProviders`-wrapped providers, since it will
be providing the same guarantee, but the current types do not allow this.

This commit fixes the typings to allow nesting `EnvironmentProviders` and
adds a test to verify that it will work.

PR Close #48720
2023-01-12 13:48:00 -08:00
Konstantin Kharitonov 68ce4f6ab4 fix(common): Update Location to get a normalized URL valid in case a represented URL starts with the substring equals APP_BASE_HREF (#48489)
```ts
@NgModule({
  imports: [RouterModule.forRoot([{path: '/enigma', component: EnigmaComponent}])],
  providers: [{provide: APP_BASE_HREF, useValue: '/en'}]
})
export class AppModule {}
```

Navigating to `/enigma` will redirect to `/en/igma` not to `/en/enigma` as it expects

Fixes: #45744

PR Close #48489
2023-01-12 11:45:32 -08:00
Matthieu Riegler cc392e532b refactor(forms): replace type any for the providers (#48647)
The providers for the directives in forms can be typed as Provider. Also the export is not required.

PR Close #48647
2023-01-11 15:01:57 -08:00
dario-piotrowicz c1f88824b7 refactor(compiler): refactor the shadow css specs (#48443)
apply different quality of life improvements to the shadow
css unit tests:

- refactor the tests so that they are nicely divided in multiple files
   in a logical manner instead of having most of them all in a single big file

- remove the css normalization logic inconsistently used throughout  the tests, which
  causes tests to be inconsistent and it also introduced unintuitive checks

- provide a shared shim utility function (instead of re-defining it
  multiple times)

- add a `toEqualCss` matcher that can be used in the tests in order to
  match css strings without caring about spacing and indentation

PR Close #48443
2023-01-11 14:55:52 -08:00
Paul Gschwendtner 6a8ea29a04 fix(language-service): expose package.json for vscode extension resolution (#48678)
The VSCode extension looks for `@angular/language-service/package.json`
using `require`. This currently breaks as of the ESM changes because
we introduced the `exports` field but did not expose the `package.json`.

This commit fixes it.

Co-authored-By: Andrew Scott <atscott@google.com>
Co-authored-By: Dylan Hunn <dylhunn@gmail.com>

PR Close #48678
2023-01-10 09:13:55 -08:00