Commit Graph

21493 Commits

Author SHA1 Message Date
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
Alex Rickabaugh 2cd1c6c2bd Revert "build: simplify generation of closure locale file (#42230)" (#42583)
This reverts commit 8f24d71142.

PR Close #42583
2021-06-16 09:49:37 -07:00
Alex Rickabaugh d6cca3cf9d Revert "build: generate alias locale data for closure locale (#42230)" (#42583)
This reverts commit 044e0229bd.

PR Close #42583
2021-06-16 09:49:37 -07:00
Daniel Trevino b52e93543f docs: add Daniel Trevino to contributors file (#42573)
PR Close #42573
2021-06-15 12:53:09 -07:00
Kristiyan Kostadinov a66dd8834c build: remove unnecessary polyfills from tests (#42567)
Removes the polyfills for `MutationObserver` and `setPrototypeOf` from our testing setup, because none of the browsers that we support require them. It also removes a bit of code and one external dependency.

PR Close #42567
2021-06-14 14:14:41 -07:00
Andrew Scott 4001e9d808 fix(language-service): 'go to defininition' for objects defined in template (#42559)
Previously, the "go to definition" action did no account for the
possibility that something may actually be defined in a template. This
change updates the logic in the definition builder to convert any
results that are locations in template typecheck files to their
corresponding locations in the template.

PR Close #42559
2021-06-14 14:13:48 -07:00
Andrew Scott 228beeabd1 fix(language-service): Use last child end span for parent without close tag (#42554)
Unclosed element tags are not assigned an `endSourceSpan` by the parser.
As a result, the visitor which determines the target node at a position
for the language service was unable to determine that a given position
was inside an unclosed parent. This happens because we update the
`endSourceSpan` of template/element nodes to be the end tag (and there
is not one for unclosed tags). Consequently, the visitor then cannot
match a position to any child node location.

This change updates the visitor logic to check if there are any
`children` of a template/element node and updates the end span to be the
end span of the last child. This allows our `isWithin` logic to identify
that a child position is within the unclosed parent.

Addresses one of the issues found during investigation of https://github.com/angular/vscode-ng-language-service/issues/1399

PR Close #42554
2021-06-14 14:10:46 -07:00
Andrew Scott 8c1e0e6ad0 fix(compiler): always match close tag to the nearest open element (#42554)
This commit updates the parser logic to continue to try to match an end
tag to an unclosed open tag on the stack. Previously, it would only
push an error to the list and stop looking at unclosed elements.

For example, the invalid HTML of `<li><div></li>`, has an unclosed
element stack of [`li`, `div`] when it encounters the close `li` tag.
We compare against the previously unclosed tag `div` and see that this is
unexpected. Instead of simply giving up here, we continue to move up the
unclosed tags until we find a match (if there is one).

PR Close #42554
2021-06-14 14:10:46 -07:00
Paul Gschwendtner 044e0229bd build: generate alias locale data for closure locale (#42230)
Within Google, closure compiler is used for dealing with translations.
We generate a closure-compatible locale file that allows for
registration within Angular, so that Closure i18n works well together
with Angular applications. Closure compiler does not limit its
locales to BCP47-canonical locale identifiers. This commit updates
the generation logic so that we also support deprecated (but aliased)
locale identifiers, or other aliases which are likely used within
Closure. We use CLDR's alias supplemental data for this. It instructs
us to alias `iw` to `he` for example. `iw` is still supported in Closure.

Note that we do not manually extract all locales supported in Closure;
instead we only support the CLDR canonical locales (as done before) +
common aliases that CLDR provides data for. We are not aware of other
locale aliases within Closure that wouldn't be part of the CLDR aliases.
If there would be, then Angular/Closure would fail accordingly.

PR Close #42230
2021-06-14 09:59:46 -07:00
Paul Gschwendtner 8f24d71142 build: simplify generation of closure locale file (#42230)
In the past, the closure file has been generated so that all individual
locale files were imported individually. This resulted in a huge
slow-down in g3 due to the large amount of imports.

With 90bd984ff7 this changed so that we
inline the locale data for the g3 closure locale file. Also the file
only contained data for locales being supported by Closure. For this a
list of locales has been extracted from Closure Compiler, as well as a
list of locale aliases.

This logic is prone to CLDR version updates, and also broke as part of
the Gulp -> Bazel migration where this logic has been slightly modified
but caused issues in G3. e.g. a locale `zh-Hant` was requested in g3,
but the locale data had the name of the alias locale that provided the
data at index zero (which represents the locale name). Note that the
locale names at index zero always could differentiate from the requested
`goog.LOCALE` due to the aliasing logic. This just didn't come up before.

We simplify this logic by generating a `goog.LOCALE` case for all
locales CLDR provides data for. We don't need to bother about aliasing
because with the refactorings to the CLDR generation tool, all locales
are built (which also captures the aliases), and we can generate the locale
file on the fly (which has not been done before).

PR Close #42230
2021-06-14 09:59:46 -07:00
Paul Gschwendtner d4c880b467 build: add documentation for `generate-locales-tool` (#42230)
The CLDR extraction tool has been reworked to run as part of Bazel.
This adds a initial readme explaining what the tool generates. It's
far from a detailed description but it can serve as foundation for more
detailed explanations.

PR Close #42230
2021-06-14 09:59:46 -07:00
Paul Gschwendtner c42041b419 build: build locale files for legacy saucelabs job (#42230)
Given that the locale files are now generated through
Bazel, the files are no longer checked-in and the
legacy TSC compilation fails due to imports resolving
to non-existent files. We fix this for the legacy
saucelabs job by copying the generated TS files into
the sources (which is acceptable for the isolated CI job)

PR Close #42230
2021-06-14 09:59:46 -07:00
Paul Gschwendtner 4957da82d3 build: wire up new CLDR generation tool within Bazel (#42230)
Introduces a few Starlark macros for running the new Bazel
CLDR generation tool. Wires up the new tool so that locales
are generated properly. Also updates the existing
`closure-locale` file to match the new output generated by the Bazel tool.

This commit also re-adds a few locale files that aren't
generated by CLDR 37, but have been accidentally left in
the repository as the Gulp script never removed old locales
from previous CLDR versions. This problem is solved with the
Bazel generation of locale files, but for now we re-add these
old CLDR 33 locale files to not break developers relying on these
(even though the locale data indicies are incorrect; but there might
be users accessing the data directly)

PR Close #42230
2021-06-14 09:59:46 -07:00
Paul Gschwendtner 1eaeb23c75 build: convert CLDR locale extraction from Gulp to Bazel tool (#42230)
Converts the CLDR locale extraction script to a Bazel tool.
This allows us to generate locale files within Bazel, so that
locales don't need to live as sources within the repo. Also
it allows us to get rid of the legacy Gulp tooling.

The migration of the Gulp script to a Bazel tool involved the
following things:

  1. Basic conversion of the `extract.js` script to TypeScript.
     This mostly was about adding explicit types. e.g. adding `locale:
     string` or `localeData: CldrStatic`.

  2. Split-up into separate files. Instead of keeping the large
     `extract.js` file, the tool has been split into separate files.
     The logic remains the same, just that code is more readable and
     maintainable.

  3. Introduction of a new `index.ts` file that is the entry-point
     for the Bazel tool. Previously the Gulp tool just generated
     all locale files, the default locale and base currency files
     at once. The new entry-point accepts a mode to be passed as
     first process argument. based on that argument, either locales
     are generated into a specified directory, or the default locale,
     base currencies or closure file is generated.

     This allows us to generate files with a Bazel genrule where
     we simply run the tool and specify the outputs. Note: It's
     necessary to have multiple modes because files live in separate
     locations. e.g. the default locale in `@angular/core`, but the
     rest in `@angular/common`.

  4. Removal of the `cldr-data-downloader` and custom CLDR resolution
     logic. Within Bazel we cannot run a downloader using network.

     We switch this to something more Bazel idiomatic with better
     caching. For this a new repository rule is introduced that
     downloads the CLDR JSON repository and extracts it. Within
     that rule we determine the supported locales so that they
     can be used to pre-declare outputs (for the locales) within
     Bazel analysis phase. This allows us to add the generated locale
     files to a `ts_library` (which we want to have for better testing,
     and consistent JS transpilation).

     Note that the removal of `cldr-data-downloader` also requires us to
     add logic for detecting locales without data. The CLDR data
     downloader overwrote the `availableLocales.json` file with a file
     that only lists locales that CLDR provides data for. We use the
     official `availableLocales` file CLDR provides, but filter out
     locales for which no data is available. This is needed until we
     update to CLDR 39 where data is available for all such locales
     listed in `availableLocales.json`.

PR Close #42230
2021-06-14 09:59:46 -07:00
Paul Gschwendtner 5822771946 refactor: remove checked-in locale files (#42230)
This is a pre-refactor commit allowing us to move
the CLDR locale generation to Bazel where files would
no longer be checked-in, except for the `closure-locale`
file that is synced into Google3.

PR Close #42230
2021-06-14 09:59:46 -07:00
Ankit Choudhary e7c69b8551 docs: Grammatical error (#42571)
Updated a minor grammatical error.
PR Close #42571
2021-06-14 09:59:14 -07:00
Dylan Hunn 7180ec9e7c fix(forms): changes to status not always being emitted to statusChanges observable for async validators. (#42553)
When a FormControl, FormArray, or FormGroup is first constructed, if an async validator is attached, the `statusChanges` observable should receive a message when the validator complete (i.e. pending -> valid/invalid). If the validator was provided as part of the constructor options, it was not fired at construction time, which is fixed in this PR.

Fixes #35309.

PR Close #42553
2021-06-14 09:57:57 -07:00
George Kalpakas 56a0582d79 fix(docs-infra): correctly serve `index.html` with a query string (#42547)
Previously, due to a bug in Firebase hosting, requests to
`/index.html?<query>` would lead to an infinite redirect and eventually
a failure. This affected, for example, cache-busting requests from the
ServiceWorker, which look like: `/index.html?ngsw-cache-bust=...`
For more details see
https://github.com/angular/angular/issues/42518#issuecomment-858545483

This commit temporarily works around the bug by explicitly redirecting
`/index.html?<query>` to `/?<query>`.

Fixes #42518

PR Close #42547
2021-06-14 09:57:30 -07:00
George Kalpakas 828fde6e0d feat(docs-infra): implement popup to inform about the use of cookies (#42259)
This commit adds a popup to angular.io to inform the user about the use
of cookies. Once the user confirms having read the info, the popup will
not be shown on subsequent visits.

This commit is partly based on angular/material.angular.io#988.

Fixes #42209

PR Close #42259
2021-06-14 09:54:08 -07:00
George Kalpakas 1a6a79b63a refactor(docs-infra): provide `local-/sessionStorage` via DI (#42259)
Previously, we had the same logic in a couple of places to safely access
the `Window`'s `local-/sessionStorage` and provide a no-op fallback if
necessary. Soon, we will need the same logic for the cookies popup
(see #42209).

This commit reduces code duplication by providing
`local-/sessionStorage` as injectables and sharing the logic for
accessing them safely. This also makes it easier to mock the storage in
tests without having to mess with the actual `Window` object.

NOTE:
This commit actually decreases the payload size in the `main` bundle by
40B.

PR Close #42259
2021-06-14 09:54:08 -07:00
George Kalpakas a7d1e65a51 test(docs-infra): fix warnings in `ThemeToggleComponent` unit tests. (#42259)
due to unknown `<mat-icon>` element

This commit fixes some warnings in the unit tests of the
`ThemeToggleComponent`, which were caused by the following:

- The `<mat-icon>` element used in `ToggleThemeComponent`'s template was
  not declared in tests.
- The `dark-theme.css` and `light-theme.css` files requested by
  `ToggleThemeComponent` were not available.

PR Close #42259
2021-06-14 09:54:08 -07:00
George Kalpakas edf3e5a9cf build(docs-infra): align code with new CLI v12 apps (#42259)
This commit aligns the angular.io config files more closely to how a
newly generated CLI v12 app would look like. This helps validate the
setup and makes it easier to apply new chages in the future (by
preventing the angular.io layout from deviating too much from the
default new app layout).

PR Close #42259
2021-06-14 09:54:08 -07:00
Andrew Scott 5161084917 docs: remove section on tables from docs style guide (#42330)
The approach for tables is more of an ad-hoc determination based on the
complexity of what's in them. If/when we enable formatting of markdown
files, that will also make the markdown format of tables easier to read
and more consistent.

fixes #23978

PR Close #42330
2021-06-11 11:47:03 -07:00
Mladen Jakovljević 0c13e2bf97 build(packaging): remove rehype (#42557)
`rehype` dependency is now moved to the `dgeni-package`, thus it can be removed from the main dependencies list

PR Close #42557
2021-06-11 08:00:49 -07:00