Commit Graph

4807 Commits

Author SHA1 Message Date
George Kalpakas e2aa7652e5 fix(docs-infra): fix keyword color in CLI pages code blocks (#42889)
Previously, names of CLI commands that also happened to be keywords were
shown in black color in the code block demonstrating the command's
usage. This worked fine when in light mode (where the code block
background is white) but not in the recently introduced dark mode (where
the code block background is dark gray).

This commit fixes this by ensuring the `.kwd` token color is inherited
from its parent (which has an appropriate color for the current theme).
Previously, the `.kwd` token was reset to its initial value (which is
`black` regardless of the theme).

**Before:** ![CLI pages keyword before][1]
**After:** ![cli-pages-keyword after][2]

[1]: https://user-images.githubusercontent.com/8604205/126073803-af317f0c-d04f-4c3a-9a83-e92541d7dd5a.png
[2]: https://user-images.githubusercontent.com/8604205/126073806-1d57e3ed-90b1-4735-ae2a-d0a39862bb95.png

PR Close #42889
2021-07-20 11:56:33 -07:00
dario-piotrowicz ca7d4c3403 refactor(docs-infra): migrate aio from tslint to eslint (#42820)
migrate aio to eslint as tslint has been deprecated, the migration is restricted to the aio app and
its e2e tests and does not include the other tools, for such reason both tslint and codelyzer have not
been removed (to be done in a next PR)

some minor tweaks needed to be applied to the code so that it would adhere to the new ESLinting behaviour

most TSLint rules have been substituted with their ESLint equivalent, with some exceptions:
  * [whitespace] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [import-spacing] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [ban] replaced with [no-restricted-syntax] as there is no (official/included) ESLint equivalent

some rules have minor different behaviours compared to their TSLint counterparts:
  * @typescript-eslint/naming-convention:
    - typescript-eslint does not enforce uppercase for const only.
  * @typescript-eslint/no-unused-expressions:
    - The TSLint optional config "allow-new" is the default ESLint behavior and will no longer be ignored.
  * arrow-body-style:
    - ESLint will throw an error if the function body is multiline yet has a one-line return on it.
  * eqeqeq:
    - Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.
  * no-console:
    - Custom console methods, if they exist, will no longer be allowed.
  * no-invalid-this:
    - Functions in methods will no longer be ignored.
  * no-underscore-dangle:
    - Leading and trailing underscores (_) on identifiers will now be ignored.
  * prefer-arrow/prefer-arrow-functions:
    - ESLint does not support allowing standalone function declarations.
    - ESLint does not support allowing named functions defined with the function keyword.
  * space-before-function-paren:
    - Option "constructor" is not supported by ESLint.
    - Option "method" is not supported by ESLint.

additional notes:
  * the current typescript version used by the aio app is 4.3.5, which is not supported by typescript-eslint (the supported
    versions are >=3.3.1 and <4.3.0). this causes a warning message to appear during linting, this issue should
    likely/hopefully disappear in the future as typescript-eslint catches up
  * The new "no-console" rule is not completely equivalent to what we had prior the migration, this is because TSLint's "no-console"
    rule let you specify the methods you did not want to allow, whilst ESLint's "no-console" lets you specify the methods that you do
    want to allow, so and in order not to have a very long list of methods in the ESLint rule it's been decided for the time being
    to simply only allow the "log", "warn" and "error" methods
  * 4 dependencies have been added as they have been considered necessary (see: https://github.com/angular/angular/pull/42820#discussion_r669978232)

extra:
  * the migration has been performed by following: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslin
  * more on typescript-eslint at: https://github.com/typescript-eslint/typescript-eslint

PR Close #42820
2021-07-20 11:55:28 -07:00
dario-piotrowicz 52dc65dd1b build(docs-infra): improve @usageNotes message (#42888)
improve the @usageNotes message by adding the word "is"
(outcome: "Further information is available in...", compared to
"Further information available in...")

PR Close #42888
2021-07-19 17:37:56 -07:00
George Kalpakas 722eb5dd45 fix(docs-infra): prevent main content from overlapping with ToC (#42884)
Previously, if there was more content than what would horizontally fit
in the main content area, it would overflow to the right and overlap
with the Table of Contents (ToC).
This was accidentally introduced in #42787.

This commit fixes it by ensuring that the main content area will not
overlap with ToC and the necessary space for the ToC will be reserved
using `margin` (instead of `padding`, which contributes to the element's
size).

Fixes #42867

PR Close #42884
2021-07-19 17:35:35 -07:00
George Kalpakas e7c770709b fix(docs-infra): correctly handle reported errors (#42883)
Error-handling in AIO happens mainly in two places:
1. For errors happening inside the app we have a custom `ErrorHandler`
   implementation, `ReportingErrorHandler`. `ReportingErrorHandler`
   passes errors to the default `ErrorHandler` (for them to be logged to
   the console) and also forwards them to `window.onerror()`.
2. Errors happening outside the app and errors forwarded by
   `ReportingErrorHandler` are handled by `window.onerror()`, which in
   turn reports them to Google analytics.

Previously, we were making some assumptions (which turned out to be
incorrect based on the info captured in Google analytics - see #28106):
- `ReportingErrorHandler` assumed that the errors passed to its
  `handleError()` method would be either strings or `Error` instances.
  _Apparently, other values (such as `null` or `undefined`) may also be
  passed._
- `window.onerror()` assumed that if an `Error` instance was passed in,
  it would always have a stacktrace (i.e. its `stack` property would be
  defined).
  _This is not necessarily true, although it is not clear (based on the
  logs) whether reported errors of this type are caused by `Error`
  instance with no stacktrace or by non-string error objects which are
  incorrectly treated as `Error` instances.

This commit ensures that all types of error arguments can be handled
correctly, including `Error` instances with no stacktrace and other
types of objects or primitives.

NOTE:
PR #42881 is related as it fixes handling `null` and `undefined`
arguments in the default `ErrorHandler`.

Fixes #28106

PR Close #42883
2021-07-19 17:35:02 -07:00
George Kalpakas 3da71467e9 build(docs-infra): upgrade Lighthouse to version 8.1.0 (#42846)
This commit upgrades `lighthouse` to the latest version (8.1.0) to take
advantage of latest fixes/improvements and ensure the min scores are
still met with the latest audit changes.

PR Close #42846
2021-07-16 10:02:21 -07:00
David Shevitz 4e97514465 docs: remove references to future in topic (#42841)
Fixes #25704

PR Close #42841
2021-07-15 13:23:28 -07:00
Renovate Bot 670300e9ab build: lock file maintenance (#42824)
PR Close #42824
2021-07-15 13:22:37 -07:00
dario-piotrowicz ea936720a6 docs(docs-infra): remove unnecessary "Podcast" from happy-angular podcast's title (#42756)
PR Close #42756
2021-07-15 13:22:03 -07:00
dario-piotrowicz c5561287fd docs(docs-infra): add the angular show to the podcast resources (#42756)
PR Close #42756
2021-07-15 13:22:03 -07:00
dario-piotrowicz c11bcb7383 docs(docs-infra): podcast keys cleanup in resources.json (#42756)
PR Close #42756
2021-07-15 13:22:03 -07:00
dario-piotrowicz ca1fde928a docs(docs-infra): remove deep dive from podcast resources (#42756)
PR Close #42756
2021-07-15 13:22:03 -07:00
Krzysztof Kotowicz 437759ba47 revert: docs: remove references to Trusted Types due to incompatibility with Webpack 5 (#42796)
Re-add reference to Trusted Types since the issue #41754 is resolved in 12.1.1.

This reverts commit 7254fbc2baa1455e3b24400597342843df3017f2.

PR Close #42796
2021-07-14 11:14:08 -07:00
Alan Agius 48c1c81780 docs: remove End-to-end test files structure (#42844)
Since version 12, the Angular CLI no longer generates end-to-end tests.

PR Close #42844
2021-07-14 11:12:42 -07:00
David Shevitz 64bb7cd704 docs: update incorrect bullet text (#42839)
Fixes #42286

PR Close #42839
2021-07-14 11:11:56 -07:00
David Shevitz 970d7f7c6f docs: update routing-overview topic with link to custom route matches tutorial (#42837)
PR Close #42837
2021-07-13 14:07:15 -07:00
Pete Bacon Darwin a524af15a5 docs: move start tutorial alert for clarity (#42764)
The alert was placed in the middle of a set of steps, which
was causing some confusion. This has been moved to the
above the steps in the section and slightly reworded to
make it clearer.

Fixes #42752

PR Close #42764
2021-07-12 13:20:13 -07:00
dario-piotrowicz ef15b979cf docs(core): edit and add docs for ng-template (#42704)
PR Close #42704
2021-07-12 09:39:29 -07:00
George Kalpakas 5356796250 fix(docs-infra): fix margin of social icon on small screens (#42790)
This commit fixes the margin of the social icons on small screens. This
mainly affects screens between 420px and 480px, where only one social
icon is show (due to limited space) but not necessarily the first one
(in DOM order).

**Before:** ![social icon before][1]
**After:** ![social icon after][2]

[1]: https://user-images.githubusercontent.com/8604205/124788616-2f5f0200-df52-11eb-9ec2-9e46b90cd286.png
[2]: https://user-images.githubusercontent.com/8604205/124788623-2ff79880-df52-11eb-90ec-31b04973de68.png

PR Close #42790
2021-07-09 10:15:27 -07:00
Bastian 50b6aae029 docs: fix http example to show actual message in console (#42773)
Previously, the error message in the console would print `[object Object]`
and not the actual error message. With this change, the error message is
printed in the console.

PR Close #42773
2021-07-09 10:14:35 -07:00
Renovate Bot 9ec241926e build: update all non-major dependencies (#42739)
PR Close #42739
2021-07-09 10:13:37 -07:00
Renovate Bot dfe9e1d077 build: lock file maintenance (#42770)
PR Close #42770
2021-07-08 14:53:17 -07:00
George Kalpakas 95ba5b4edb fix(docs-infra): ensure the sidenav backdrop covers the floating ToC (#42787)
Previously, on narrow pages where the sidenav was in `over` mode, the
sidenav's backdrop only covered the main docs content but not the
floating Table of Contents (ToC) on the right. This was inconsistent and
confusing to the user, because they could interact with the ToC and
scroll to different area of the main content while the sidenav and
backdrop were still covering the content.

This commit fixes it by ensuring the sidenav backdrop covers both the
main content and the floating ToC (when present).

Fixes #42778

PR Close #42787
2021-07-07 13:40:00 -07:00
George Kalpakas 8b95816fc4 fix(docs-infra): log more SW debug info (#42776)
This commit expands the info printed to the console to help diagnose
ServiceWorker issues to include the [internal debug info][1] retrieved
from `/ngsw/state`. This will provide more useful data, such as the
activated SW's version, state, clients, recent operations and any recent
errors.

NOTE:
This temporarily increases the payload size. Removing this code and
reclaiming the payload size is being tracked in #41117.

[1]: https://angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information

PR Close #42776
2021-07-07 13:37:05 -07:00
George Kalpakas ed57e2415d refactor(docs-infra): replace deprecated Sass `/` division with `math.div()` (#42776)
This commit replaces the deprecated `/` operators used for division in
Sass files with the [recommended][1] `math.div()` function to get rid of
build warnings ([example][2]).

[1]: https://sass-lang.com/documentation/breaking-changes/slash-div
[2]: https://circleci.com/gh/angular/angular/1017640

PR Close #42776
2021-07-07 13:37:05 -07:00
George Kalpakas 0ca196d784 test(docs-infra): prevent warning due to missing expectation (#42776)
Fix a unit test warning due to Jasmine not realizing that
`httpMock.expectOne()` is an expectation.

[Example][1]:

> WARN: 'Spec 'DocumentService currentDocument should encode the request
> path to be case-insensitive' has no expectations.'

[1]: https://circleci.com/gh/angular/angular/1017640

PR Close #42776
2021-07-07 13:37:05 -07:00
George Kalpakas 40389940f9 build(docs-infra): update @angular/* to 12.1.1 (#42776)
Update `@angular/*` packages to latest 12.1.x versions (mainly to take
advantage of recent ServiceWorker improvements, such as #42607
and #42622).

PR Close #42776
2021-07-07 13:37:05 -07:00
dario-piotrowicz 24ac37891c fix(docs-infra): slightly improve top-menu responsiveness (#42753)
make sure that the top-menu links don't get overlapped by
the search input, regardless on the browser's font-size and
the window's width

make also sure that the header's logo does not overlap the search
input on narrow windows, again regardless on the browser's font-size

PR Close #42753
2021-07-07 13:36:38 -07:00
Ryan Andersen e064f177a7 docs: add missing import to `CartService` tutorial instructions (#42701)
PR Close #42701
2021-07-07 09:54:55 -07:00
Theoklitos Bampouris 0c0c32d539 docs: change misspelled function (#42742)
Change the router.navigateUrl() to the correct function router.navigate() according to code example.
PR Close #42742
2021-07-07 09:54:23 -07:00
George Kalpakas 19bcdfb028 fix(docs-infra): correctly configure top-menu nav-item in the sidenav (#42747)
Previously, the condition for showing the top-menu nav-menu in the
sidenav was the same as that for switching the sidenav mode from docked
(`mode: side`) to floating (`mode: over`). Therefore, the `isWide` input
of the corresponding `NavMenuComponent` could be hard-coded to `false`
(since the component would only be shown when the sidenav was in
floating mode).

In 61f6ed2fdfe58679cfada861624c759f1572a430, these two desicions were
decoupled, which would result in the top-menu nav-item being shown in
the sidenav while the sidenav is in docked mode (and thus the `isWide`
input should be set to `true`).

This commit fixes it by setting the `isWide` input based on the value of
the `dockSideNav` property, as happens for the rest of the nav-menus.

PR Close #42747
2021-07-02 09:23:05 -07:00
George Kalpakas 5aecf265f3 refactor(docs-infra): simplify condition for determining sidenav mode (#42747)
Previously, the `AppComponent#showTopMenu` property was taken into
account when determining the `MatSidenav#mode` value. However, this was
redundant, because in the only case in which the use of `showTopMenu`
would make a difference (i.e. when `dockSideNav` was true and
`isSideNavDoc` was false) the sidenav would be closed and the hamburger
menu button would not be visible (thus there would be no way to open it
manually).

This commit simplifies the condition for determining the sidenav mode by
removing `showTopMenu` from the expression.

PR Close #42747
2021-07-02 09:23:05 -07:00
dario-piotrowicz bfa1b5d9eb fix(docs-infra): move dots inside Usage Notes anchor tag (#42725)
in the html generated aio docs the dots of "Usage Notes..."
should be part of the anchor tag, same as it is for "See More..."

PR Close #42725
2021-07-01 09:34:04 -07:00
mgechev 0e20b05f7d docs: add last updated date to roadmap (#42615)
PR Close #42615
2021-06-30 11:41:57 -07:00
pavlenko f3965ff834 docs: setting context value inside an interceptor (#42699)
Usage of `get`/`set` methods should be done on a context object instead of a `HttpRequest` instance.

PR Close #42699
2021-06-30 09:13:46 -07:00
George Kalpakas 02742552f3 refactor(docs-infra): make angular.io and docs examples compatible with RxJS v7 (#42660)
This commit applies the necessary changes to make angular.io and (most)
docs examples compatible with both RxJS v6 and v7. It also adds new
steps to relevant CI jobs to test angular.io and docs examples against
RxJS v7 as well (to catch potential regressions).

NOTE:
Some of the docs examples are not compatible with RxJS v7 and are
therefore excluded from the tests. The SystemJS-based ngUpgrade
examples in particular are excluded, since they require a different
SystemJS configs to run against RxJS v6 and v7 and the extra complexity
of managing that is not worth it for the 4 affected examples.

PR Close #42660
2021-06-29 10:29:58 -07:00
George Kalpakas 188a73852e test(docs-infra): allow excluding certain docs examples from tests (#42660)
This commit adds support for excluding certain docs examples from the
command used to run tests. This is useful to run extra tests on CI that
might not be compatible with all examples (for example, run tests with
different versions of a dependency).

In a subsequent commit, this will be used to run tests against RxJS v7
as a quick way to catch potential regressions.

PR Close #42660
2021-06-29 10:29:58 -07:00
George Looshch 2c490d5c6c docs: remove duplicate link to `guide/inputs-outputs.md` (#42654)
When you click on `Understanding Angular > Components > Sharing data between
child and parent directives and components` in navigation sidebar, another
item gets selected: `Understanding Angular > Templates > Inputs and Outputs`
Both of them are linked to the same guide but the view cannot handle
situations when several entries point to the same guide.

This commit fixes that by removing the second entry.

Fixes #42652

PR Close #42654
2021-06-29 09:27:47 -07:00
Alan Agius b54e8aee37 docs: update fonts optimization options description (#42642)
In version 12.1, we included font inlining for Adobe fonts, see: https://github.com/angular/angular-cli/pull/21189

PR Close #42642
2021-06-28 11:28:01 -07:00
Lars Gyrup Brink Nielsen c93df7dc6d docs: correct literal string example (#42623)
Change literal string example `pi` to `'pi'`.

PR Close #42623
2021-06-28 10:05:09 -07:00
codebriefcase 1142b51462 fix(docs-infra): styling fix on error pages (#42627)
Add Center Aligment for heading texts and additional styles on 404 (not found) related pages

PR Close #42627
2021-06-28 09:50:24 -07:00
George Kalpakas 2a260dc249 docs: update Roadmap section header from "Done" to "Completed" (#42620)
"Completed" just sounds better (to me).

PR Close #42620
2021-06-28 09:33:18 -07:00
George Kalpakas 70def3d3ed fix(docs-infra): fix styling of `<summary>` elements on dark theme (#42620)
Previously, the color of `<summary>` elements was hard-coded to `black`.
This did not work well on the dark theme, where the background color of
the page is also very dark.

This commit fixes it by removing the explicit color style, thus letting
`<summary>` elements inherit the color of their container.

Closes #42616

PR Close #42620
2021-06-28 09:33:18 -07:00
George Kalpakas e5b4b83778 fix(docs-infra): improve styling of completed Roadmap projects (#42620)
This commit improves the styling of the "Completed projects" section of
the Roadmap by (a) making it consistent with the rest of the Roadmap
sections and (b) making it more similar with `<details>` elements on
other pages.

**Before:**
  _Collapsed:_ ![completed projects collapsed (before)][1]
  _Expanded:_ ![completed projects expanded (before)][2]
**After:**
  _Collapsed:_ ![completed projects collapsed (after)][3]
  _Expanded:_ ![completed projects expanded (after)][4]

[1]: https://user-images.githubusercontent.com/8604205/122917101-50c2ca00-d366-11eb-8348-01efd69cedf2.png
[2]: https://user-images.githubusercontent.com/8604205/122917109-515b6080-d366-11eb-9f18-c794fcea8dd1.png
[3]: https://user-images.githubusercontent.com/8604205/122917115-528c8d80-d366-11eb-947a-2d7da3950069.png
[4]: https://user-images.githubusercontent.com/8604205/122917117-53252400-d366-11eb-93e7-9384a7431c0d.png

PR Close #42620
2021-06-28 09:33:17 -07:00
George Kalpakas fd78678284 refactor(docs-infra): make `<details>` styles more re-usable (#42620)
This commit makes the styling for `<details>` elements (including
expand/collapse actions in their `<summary>`) more re-usable.

PR Close #42620
2021-06-28 09:33:17 -07:00
George Kalpakas 09ec62a357 refactor(docs-infra): merge duplicate `code.scss` files (#42620)
PR #41129 reorganized the SCSS files of the angular.io app moving most
of them in sub-directories. Due to incorrectly resolved merge conflicts
for PRs targeting the SCSS files around that time, we ended up with
duplicate style files for `<code>` elements:
- `styles/2-modules/_code.scss`
- `styles/2-modules/code/_code.scss` +
  `styles/2-modules/code/_code-theme.scss`

This commit gets rid of the extra file (`styles/2-modules/_code.scss`)
and ports any changes from it to the correct files inside the `code/`
sub-directory.

PR Close #42620
2021-06-28 09:33:17 -07:00
marvinbeckert 45d24d28a6 docs: remove default linting tool in workspace guide (#42655)
PR Close #42655
2021-06-25 09:55:53 -07:00
George Kalpakas 2203217c40 build(docs-infra): disambiguate doc paths for global APIs (#42648)
In #41788, the `disambiguateDocsPathsProcessor` was introduced to fix
an issue with case-insensitively equal paths. This processor may alter
the output paths of some docs. Due to its nature, the
`disambiguateDocPathsProcessor` must be the last processor in the
pipeline that updates a doc's output path. However, the
`updateGlobalApiPathProcess` (which also alters the output paths of some
docs) was not configured to run before `disambiguateDocPathsProcessor`.
As a result, the changes made by `disambiguateDocPathsProcessor` were
overridden by `updateGlobalApiPathProcess`, resulting in the app's
failing to load such global API docs pages. An example of such an API
page is: https://angular.io/api/core/global/ngApplyChanges

This commit fixes it by ensuring that the `updateGlobalApiPathProcess`
is explicitly run before the `disambiguateDocPathsProcessor`, so that
the former does not override the changes made by the latter.

PR Close #42648
2021-06-24 12:28:21 -07:00
Dale Harris 637ac00fd5 docs: Fix reference to SwUpdate.isEnabled boolean (#42634)
SwUpdate has an `isEnabled` boolean rather than an `isEnabled()` method. Removed parentheses for accuracy.
PR Close #42634
2021-06-24 12:27:38 -07:00
George Kalpakas 53fe557da7 feat(service-worker): include ServiceWorker version in debug info (#42622)
This commit includes the ServiceWorker version in the debug info shown
at `/ngsw/state` to make it easier to know what version of the
ServiceWorker script is controlling the page.

PR Close #42622
2021-06-24 09:55:32 -07:00