Commit Graph

21316 Commits

Author SHA1 Message Date
Kristiyan Kostadinov 699a8b43cb test(compiler-cli): add additional safe keyed read tests (#42421)
This commit adds some tests that were mistakenly omitted from the original
change for safe keyed reads/writes.

PR Close #42421
2021-06-21 23:40:47 +00:00
Németh Tamás 6b2a475532 docs: add new i18n formats to i18n guide (#42597)
PR Close #42597
2021-06-21 18:48:19 +00:00
JoostK a9dd7e21a2 refactor(compiler-cli): enable relative imports in the type parameter emitter (#42492)
Previously, the template type checker would only opt-in to inline type
constructors if it could import all type references from absolute module
specifiers. This limitation was put into place in an abundance of
caution as there was a safe, but less performant, fallback available.

The language service is not capable of using this fallback, which now
means that the limitation of absolute module specifiers limits the
language service's ability to use accurate types for component/directive
classes that have generic type parameters.

This commit loosens the restriction such that type references are now
eligible for emit as long as they are exported.

PR Close #42492
2021-06-21 18:34:05 +00:00
JoostK 729eea5716 fix(compiler-cli): transform type references in generic type parameter default (#42492)
When a component/directive has a generic type parameter, the template
type checker attempts to translate the type parameter such that the
type parameters can be replicated in the type constructor that is
emitted into the typecheck file.

Type parameters with a default clause would incorrectly be emitted into
the typecheck file using the original `ts.TypeNode` for the default
clause, such that `ts.TypeReferenceNode`s within the default clause
would likely be invalid (i.e. referencing a type for which no import is
present in the typecheck file). This did not result in user-facing
type-check errors as errors reported in type constructors are not
translated into template positions Regardless, this commit ensures that
`ts.TypeReferenceNode`s within defaults are properly translated into the
typecheck file.

PR Close #42492
2021-06-21 18:34:05 +00:00
JoostK 16aaa23d4e refactor(compiler-cli): use TypeScript transform to emit type parameters (#42492)
The template type checker is capable of recreating generic type bounds
in a different context, rewriting type references along the way (if
possible). This was previously done using a visitor that only supported
a limited set of types, resulting in the inability to emit all sorts of
types (even if they don't contain type references at all).

The inability to emit generic type bounds was not critical when the type
parameter emitting logic was introduced, as the compiler also has a
fallback strategy of creating inline type constructors. However, this
fallback is not available to the language service, resulting in
inaccurate types when components/directives use a complex generic type.

To mitigate this problem, the specialized visitor has been replaced with
a generalized TypeScript transform, where only type references get
special treatment. This allows for more complex types to be emitted,
such as union and intersection types, object literal types and tuple
types.

PR Close #42492
2021-06-21 18:34:05 +00:00
Kristiyan Kostadinov f52df99fe3 fix(compiler): generate view restoration for keyed write inside template listener (#42603)
If an implcit receiver is accessed in a listener inside of an `ng-template`, we generate some extra code in order to ensure that we're assigning to the correct object. The problem is that the logic wasn't covering keyed writes which caused it to write to the wrong object and throw an assertion error at runtime.

These changes expand the logic to cover keyed writes.

Fixes #41267.

PR Close #42603
2021-06-21 18:30:37 +00:00
Joey Perrott 8793d1a046 ci: update pullapprove config (#42613)
Update the fallback group in pullapprove to define a reviewer for the group,
in preparation for the upcoming change to how pullapprove billing works. The
new billing will work on a seats based approach rather than flat usage.

PR Close #42613
2021-06-21 17:36:56 +00:00
Alex Rickabaugh e83d7cb2d3 refactor(compiler-cli): support xi18n in ngtsc (#42485)
xi18n is the operation of extracting i18n messages from templates in the
compilation. Previously, only View Engine was able to perform xi18n. This
commit implements xi18n in the Ivy compiler, and a copy of the View Engine
test for Ivy verifies that the results are identical.

PR Close #42485
2021-06-21 16:50:28 +00:00
Alex Rickabaugh 4538bd6c96 refactor(compiler-cli): extract xi18n utility functions to a separate file (#42485)
This commit moves some xi18n-related functions in the View Engine
ng.Program into a new file. This is necessary in order to depend on them
from the Ivy ng.Program while avoiding a cycle.

PR Close #42485
2021-06-21 16:50:28 +00:00
Paul Gschwendtner d77f560403 build: update to typescript 4.3.4 (#42600)
Updates to TypeScript 4.3.4 which contains a fix for a printer
regression that caused unexpected JavaScript output with our
compiler transforms.

See: https://github.com/microsoft/TypeScript/pull/44070.
Updates to TypeScript 4.3.4 which contains a fix for a printer

PR Close #42600
2021-06-21 16:42:49 +00:00
Paul Gschwendtner b8eb24e0fb Revert "test: update compiler-cli compliance goldens due to TS 4.3 emit format regression (#42022)" (#42600)
This reverts commit 71e14a71f5.

PR Close #42600
2021-06-21 16:42:48 +00:00
George Kalpakas 44291889ee docs(docs-infra): document how to configure redirects (#42452)
PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas d07e736f17 build(docs-infra): auto-generate SW `navigationUrls` from Firebase config (#42452)
Previously, redirects had to be configured in both the Firebase config
(`firebase.json`) and the ServiceWorker config (`ngsw-config.json`).
This made it challenging to correctly configure redirects, since one had
to understand the different formats of the two configs, and was also
prone to getting out-of-sync configs.

This commit simplifies the process of adding redirects by removing the
need to update the ServiceWorker config (`ngsw-config.json`) and keep it
in sync with the Firebase config (`firebase.json`). Instead the
ServiceWorker `navigationUrls` are automatically generated from the list
of redirects in the Firebase config.

NOTE:
Currently, the automatic generation only supports the limited set of
patterns that are necessary to translate the existing redirects. It can
be made more sophisticated in the future, should the need arise.

PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas 982521f284 build(docs-infra): align `navigationUrls` in `ngsw-config.json` with Firebase redirects (#42452)
The ServiceWorker `navigationUrls` globs defined in `ngsw-config.json`
are supposed to exclude any URLs that are redirected on the server (as
configured in `firebase.json`). However, the list of redirected
URLs/globs in `firebase.json` and `ngsw-config.json` have gotten out of
sync.

This commit updates the globs in `ngsw-config.json` to match the ones in
`firebase.json`.

This is in preparation of automatically generating the ServiceWorker
`navigationUrls` based on `firebase.json`.

PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas fe3c79fe40 build(docs-infra): alphabetically sort all `navigationUrls` in `ngsw-config.json` (#42452)
This commit sorts all `navigationUrls` in `ngsw-config.json`
alphabetically.

This is in preparation of automatically generating the ServiceWorker
`navigationUrls` based on `firebase.json`.

PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas 932f246454 build(docs-infra): allow a trailing `/` in more `navigationUrls` globs in `ngsw-config.json` (#42452)
Previously, we were not consistent in allowing a trailing `/` in
`navigationUrls` globs in `ngsw-config.json`. And when we did, we used
two globs: one with and one without the trailing `/`.

This commit updates all appropriate `navigationUrls` globs to allow a
trailing `/`. It also merges the two glob patterns (the one with and the
one without the `/`) into one.

This is in preparation of automatically generating the ServiceWorker
`navigationUrls` based on `firebase.json`.

PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas 4635d4f957 build(docs-infra): remove redundant `navigationUrls` globs from `ngsw-config.json` (#42452)
This commit removes some `navigationUrls` globs from `ngsw-config.json`
that have no effect. More specifically:
- It removes globs of the form `!/**/xyz.html`, since these are already
  covered by the more generic `!/**/*.*` glob.
- It removes `!/api/**/NgFor`, since it does not have a corresponding
  redirect rule in `firebase.json`.

This is in preparation of automatically generating the ServiceWorker
`navigationUrls` based on `firebase.json`.

PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas 36fb5744db build(docs-infra): add missing redirect rule for `api/http` in `firebase.json` (#42452)
Previously, only sub-paths, such as `api/http/foo`, were redirected to
`guide/deprecations#http`.

This commit ensures that also `api/http` itself (which used to point to
the `http` module's API page) is redirected as well.

PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas c397b59855 test(docs-infra): ensure all redirect rules are tested (#42452)
This commit adds a test assertion to verify that all redirect rules
defined in `firebase.json` are tested, i.e. that each rule is applied to
at least one testcase from `URLS_TO_REDIRECT.txt`.

This will ensure that any redirect rules added in the future will be
tested.

PR Close #42452
2021-06-18 17:32:57 +00:00
George Kalpakas c66423ab2a test(docs-infra): unnest unnecessarily nested test suite (#42452)
Previously, the `destinations` test suite in
`testFirebaseRedirection.spec.ts` was nested under the
`with legacy URLs` test suite. However, the two suites are unrelated and
there is no reason to have them nested.

This commit moves the `destinations` test suite to be beside (instead of
inside) the `with legacy URLs` one.

PR Close #42452
2021-06-18 17:32:57 +00:00
George Kalpakas e0338189b3 test(docs-infra): add testcases for all redirect rules (#42452)
This commit adds testcases in `URLS_TO_REDIRECT.txt` for all redirect
rules defined in `firebase.json`. This ensures that all rules are tested
and work as expected.

PR Close #42452
2021-06-18 17:32:57 +00:00
George Kalpakas 0c105c38da fix(docs-infra): make `NotificationComponent` elements non-focusable when hidden (#42584)
Previously, the `NotificationComponent` would be hidden by reducing its
height to `0`. This allowed for a smoother hide animation when closing
the notification, but left the component's interactive elements
focusable via keyboard navigation. This was confusing for users, because
the focused elements would not be visible on the page.

This commit fixes the issue be also setting the `display` CSS property
to `none` when the `NotificationComponent` is hidden, thus ensuring that
its contents are not focusable via keyboard navigation.
(This does not affect the hide animation, since the `display` style is
not animatable and is only applied at the end of the animation.)

PR Close #42584
2021-06-18 17:32:26 +00:00
George Kalpakas 29302e3baa fix(docs-infra): remove redundant `MatIcon` element (#42584)
Previously, we included a dummy `MatIcon` element in `AppComponent` in
order to ensure that the `Material Icons` font would be requested (and
thus cached by the ServiceWorker) on every navigation. However, #41129
introduced the `ThemeToggleComponent`, which will be present on all
pages (since it is located in the top-menu) and relies on the
`Material Icons` font. Therefore, the work-around for loading the
`Material Icons` font is no longer necessary.

This commit removes the now redundant `MatIcon` from `AppComponent`.

PR Close #42584
2021-06-18 17:32:26 +00:00
George Kalpakas fd8f9ab4e8 fix(docs-infra): convert external links to `MatIconButton`s (#42584)
This commit changes the anchor elements used for external links to
`MatIconButton`s. While the appearance remains the same (with the
exception of hover/focus styles), this better aligns the styling of
external link icons with other nearby icon buttons (i.e. the theme
toggle) and alows as to simplify the CSS for external links (since much
of their styling is handled by Angular Material).

PR Close #42584
2021-06-18 17:32:26 +00:00
George Kalpakas 0f6ebe1ab5 refactor(docs-infra): remove redundant CSS rule (#42584)
Since we now use SVG for external link icons, there are no `<img>`
elements inside the anchor elements. So, the CSS rule does not match any
element and can be removed.

PR Close #42584
2021-06-18 17:32:26 +00:00
George Kalpakas 12644486f4 ci: start tracking CSS payload sizes for angular.io (#42584)
Previously, we only tracked the sizes of the eagerly loaded JS bundles.
However, the CSS styles (which also have a non-negligible size) must
also be downloaded and parsed by the browser, thus affecting the initial
rendering time.

This commit starts tracking the CSS styles payload sizes.
(Originally discussed in
https://github.com/angular/angular/pull/42584#discussion_r653787961)

PR Close #42584
2021-06-18 17:32:26 +00:00
Pete Bacon Darwin 983c540191 docs: fix pipe params (#42593)
The addition of overloads to some of the number pipes caused
the documentation to lose the parameter descriptions.

This change fixes that by moving the JSDOC block in from of the
primary method signature, rather than the first overload.

Fixes #42590

PR Close #42593
2021-06-17 23:03:08 +00:00
Pete Bacon Darwin b037df28fd Revert "fix(docs-infra): do not redirect disambiguated URLs" (#42414)
This reverts commit 61ad68a586135a4d7b2b920fda0cb4238c6422fe, since there
are no longer any disambiguated paths that need special handling.

PR Close #42414
2021-06-17 18:14:53 +00:00
Pete Bacon Darwin 15fca6ca94 build(docs-infra): remove `disambiguator` doc-type (#42414)
Now that we disambiguate files by encoding the outputPath, there is
no need for the `disambiguator` doc-type.

PR Close #42414
2021-06-17 18:14:53 +00:00
Pete Bacon Darwin b0592c1be6 build(docs-infra): use case-insensitive encoding for content files (#42414)
To avoid having content files that have the same file path on case-insensitive
file-systems, we now encode the paths to remove uppercase characters.

PR Close #42414
2021-06-17 18:14:53 +00:00
Kristiyan Kostadinov 07c1ddc487 fix(router): error if module is destroyed before location is initialized (#42560)
This is something I ran into while working on a fix for the `TestBed` module teardown behavior for #18831. In the `RouterInitializer.appInitializer` we have a callback to the `LOCATION_INITIALIZED` which has to do some DI lookups. The problem is that if the module is destroyed before the location promise resolves, the `Injector.get` calls will fail. This is unlikely to happen in a real app, but it'll show up in unit tests once the test module teardown behavior is fixed.

PR Close #42560
2021-06-17 18:11:53 +00:00
Renovate Bot 166e98a594 build: update all non-major dependencies (#42544)
PR Close #42544
2021-06-17 18:09:31 +00:00
Renovate Bot 0af9b89b86 build: update angular to v12.0.5 (#42588)
PR Close #42588
2021-06-17 18:08:55 +00:00
Kristiyan Kostadinov 873229f24b feat(core): add opt-in test module teardown configuration (#42566)
We currently have two long-standing issues related to how `TestBed` tests are torn down:
1. The dynamically-created test module isn't going to be destroyed, preventing the `ngOnDestroy` hooks on providers from running and keeping the component `style` nodes in the DOM.
2. The test root elements aren't going to be removed from the DOM. Instead, they will be removed whenever another test component is created.

By themselves, these issues are easy to resolve, but given how long they've been around, there are a lot of unit tests out there that depend on the broken behavior.

These changes address the issues by introducing APIs that allow users to opt into the correct test teardown behavior either at the application level via `TestBed.initTestEnvironment` or the test suite level via `TestBed.configureTestingModule`.

At the moment, the new teardown behavior is opt-in, but the idea is that we'll eventually make it opt-out before removing the configuration altogether.

Fixes #18831.

PR Close #42566
2021-06-17 18:03:47 +00:00
Alex Rickabaugh f8e17c83e9 release: cut the v12.1.0-next.6 release (#42587)
PR Close #42587
2021-06-16 16:45:23 -07:00
Alex Rickabaugh 0e33521705 Revert "release: bump the next branch to v12.2.0-next.0"
This reverts commit 7961e2fc52.

This is not actually how we configure new minor releases.
2021-06-16 16:31:32 -07:00
Alex Rickabaugh 7961e2fc52 release: bump the next branch to v12.2.0-next.0 2021-06-16 16:12:20 -07:00
Alex Rickabaugh 5c25595647 docs: release notes for the v12.0.5 release (#42586)
PR Close #42586
2021-06-16 16:01:36 -07:00
dario-piotrowicz eb04684ed3 fix(docs-infra): make anchor in list item inherit line-height (#42572)
in order to have a consistent line-height between list items containing
text and list items containing links the anchors should inherit the list
item's line-height

PR Close #42572
2021-06-16 14:03:32 -07:00
dario-piotrowicz 7b85a4d457 fix(docs-infra): add horizontal margins to nav menu (#42561)
add a 2px left and right margin to the aio-nav-menu to make
sure that the items outline doesn't get cropped

PR Close #42561
2021-06-16 14:02:53 -07:00
dario-piotrowicz 40612d1932 fix(docs-infra): fix width of sidenav icons (#42561)
make sure that the width of the sidenav chervon icon is 2.4rem
(this needs to be done using the flex property and not the
width one as that can change in flex containers)

also center chevron icon inside mat-icon container in order to maintain
the correct icon positioning at any font-size

PR Close #42561
2021-06-16 14:02:53 -07:00
dario-piotrowicz 91e307b59d fix(docs-infra): prevent vertical nav item overflowing (#42561)
prevent the overflowing unwanted effect that happens during
a nav item opening and closing (during the chevron rotation)

PR Close #42561
2021-06-16 14:02:53 -07:00
Dario Piotrowicz 3b81528ddd fix(docs-infra): improve card layout for different browser font sizes (#42533)
Remove the fixed height set on the card elements present in angular.io,
allowing the cards to have a dynamic height derived from their content
and thus removing overflow issues related to the browser's font-size,
make other minor css related adjustments to allow the card to look good
on the different browser's font-size settings

PR Close #42533
2021-06-16 14:02:24 -07:00
Marius Bethge f3a79878af docs(forms): correct sample code for FormArray.reset (#42477)
Remove unexpected this, correct output comment for arr.value and correct parameter type for FormArray.get().

PR Close #42477
2021-06-16 14:01:55 -07:00
Pete Bacon Darwin 62aca30286 feat(docs-infra): add support for "special elements" (#41299)
This commit adds support for generating pages that document
special Angular elements, such as `ng-content` and `ng-template`,
which have special behavior in Angular but are not directives nor
components.

Resolves #41273

PR Close #41299
2021-06-16 14:01:16 -07:00
Alex Rickabaugh 2d1347b2ce Revert "refactor: remove checked-in locale files (#42230)" (#42583)
This reverts commit 5822771946.

PR Close #42583
2021-06-16 09:49:38 -07:00
Alex Rickabaugh ec6dc78f1d Revert "build: convert CLDR locale extraction from Gulp to Bazel tool (#42230)" (#42583)
This reverts commit 1eaeb23c75.

PR Close #42583
2021-06-16 09:49:37 -07:00
Alex Rickabaugh 877cde8897 Revert "build: wire up new CLDR generation tool within Bazel (#42230)" (#42583)
This reverts commit 4957da82d3.

PR Close #42583
2021-06-16 09:49:37 -07:00
Alex Rickabaugh bf0e82cde6 Revert "build: build locale files for legacy saucelabs job (#42230)" (#42583)
This reverts commit c42041b419.

PR Close #42583
2021-06-16 09:49:37 -07:00
Alex Rickabaugh 76484f95c3 Revert "build: add documentation for `generate-locales-tool` (#42230)" (#42583)
This reverts commit d4c880b467.

PR Close #42583
2021-06-16 09:49:37 -07:00