21813 Commits

Author SHA1 Message Date
Jessica Janiuk dad213e8c7 release: cut the v12.2.7 release (#43537) 12.2.7 2021-09-22 11:58:36 -07:00
dario-piotrowicz 19c61bf859 docs(service-worker): improve service worker guides (#43508)
improve slightly the angular.io guides related to service workers, by
means of fixes, styling, information and clarity changes

PR Close #43508
2021-09-22 17:48:39 +00:00
George Kalpakas d5881329cd build(docs-infra): upgrade cli command docs sources to eb7fba335 (#43533)
Updating [angular#12.2.x](https://github.com/angular/angular/tree/12.2.x) from
[cli-builds#12.2.x](https://github.com/angular/cli-builds/tree/12.2.x).

##
Relevant changes in
[commit range](https://github.com/angular/cli-builds/compare/56c5962df...eb7fba335):

**Modified**
- help/new.json

PR Close #43533
2021-09-22 16:56:54 +00:00
Daniel Díaz 9b7cdaefe8 docs(http): get rid of not needed space at the end of the sentence (#43528)
PR Close #43528
2021-09-22 16:18:08 +00:00
Xiaohanxu1996 1e03bed706 docs: remove duplicate import from @angular/core (#43530)
PR Close #43530
2021-09-22 16:16:05 +00:00
Andrew Scott c73e000243 test(compiler-cli): rename test files to be more descriptive (#43419)
The test files simply named `spec.ts` are hard to find when searching
for files by name.

PR Close #43419
2021-09-22 16:01:57 +00:00
Andrew Scott 9bd17e8c55 refactor(compiler-cli): Add test to document use-case for invalid pipe argument nullish coallesce (#43419)
Adds a test to the nullish coalescing diagnostic check to serve as
self-documentation on how it works with nullish coalescing on pipes that
are often misconfigured.

This also removes that non null assertion operator, which is incorrect
because there _are_ situations where a symbol cannot be retrieved.

PR Close #43419
2021-09-22 16:01:57 +00:00
George Kalpakas 3cc8c7ee25 fix(docs-infra): add a "skip to content" link for better accessibility (#43460)
Add a link at the top of the page that allows skipping directly to the
main content area. This allows people using assistive technologies to
skip navigation-related parts of the page which are presented before the
main content.

Related resources:
- [www.w3.org](https://www.w3.org/TR/WCAG20-TECHS/G1.html)
- [accessibility.oit.ncsu.edu](https://accessibility.oit.ncsu.edu/it-accessibility-at-nc-state/developers/accessibility-handbook/mouse-and-keyboard-events/skip-to-main-content)
- [css-tricks.com](https://css-tricks.com/how-to-create-a-skip-to-content-link)

---
Example implementations on other websites:

- **[accessibility.oit.ncsu.edu](https://accessibility.oit.ncsu.edu/)**:
  ![accessibility.oit.ncsu.edu](https://user-images.githubusercontent.com/8604205/133285834-db1314e6-ff71-4862-8f80-c8a9f69083d9.png)

- **[smile.amazon.com](https://smile.amazon.com/)**:
  ![smile.amazon.com](https://user-images.githubusercontent.com/8604205/133285854-1163e733-8de3-4244-bc23-5cd5a943001d.png)

- **[chase.com](https://chase.com/)**:
  ![chase.com](https://user-images.githubusercontent.com/8604205/133293396-ade9d95f-56ce-4cdc-8926-b4cd2dc6c3a5.png)

- **[css-tricks.com](https://css-tricks.com/)**:
  ![css-tricks.com](https://user-images.githubusercontent.com/8604205/133285845-702045ee-088a-40f1-bb26-21adebb02505.png)

- **[github.com/angular/angular](https://github.com/angular/angular)**:
  ![github.com/angular/angular](https://user-images.githubusercontent.com/8604205/133921259-9fd759b9-f862-47c3-b069-643912df17a1.png)

- **[news.sky.com](https://news.sky.com/)**:
  ![news.sky.com](https://user-images.githubusercontent.com/8604205/133285863-89946096-5353-4b2b-ab69-eb748bdcfe06.png)

- **[youtube.com](https://youtube.com/)**:
  ![youtube.com](https://user-images.githubusercontent.com/8604205/133921261-a68a12c1-1aea-4ad0-8457-b4eaf8ed3497.png)

---
Angular.io implementation:

- **[angular.io](https://angular.io/)**:
  ![angular.io](https://user-images.githubusercontent.com/8604205/133409634-0054625c-d14b-4ebe-bb4c-142cfc524d98.png)

Fixes #42936

PR Close #43460
2021-09-21 16:12:40 +00:00
George Kalpakas 875bbd3d4e fix(docs-infra): correctly handle in-page anchor links (#43460)
Previously, anchor links that were supposed to point to fragments inside
the current page (e.g. `href="#something"`) would end up navigating to
the homepage (`/`). This was due to them being resolved relative to the
base URL, which is set to `/` (via `<base href="/">`). See also
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base#in-page_anchors.

This commit fixes this issue by handling such links specially in
`LocationService#handleAnchorClick()` and prepending the current path to
the URL.

This will also be useful for implementing a "skip to content" link as
described in #42936.

PR Close #43460
2021-09-21 16:12:40 +00:00
George Kalpakas cea9d04330 fix(docs-infra): focus elements when scrolling to them (if focusable) (#43460)
When using `ScrollService#scrollToElement()` to scroll to a specific
element, also focus the element if it is focusable (i.e. if it has a
`focus()` method).

This will be useful for implementing a "skip to content" link as
described in #42936.

PR Close #43460
2021-09-21 16:12:40 +00:00
George Kalpakas b07642cf57 fix(docs-infra): improve accessibility of contributor cards (#43460)
Improve the accessibility of contributor cards (in `/about`) by making
them easier to navigate via keyboard:

- Show the (otherwise hidden) contributor info links on focus.
- Make the "View bio" link focusable via keyboard (to give a clearer
  indication that users can click to view the bio - although technically
  the click is handled by an ancestor).
- Make the flipped cards focusable via keyboard (so it is possible to
  click them to unflip).

PR Close #43460
2021-09-21 16:12:40 +00:00
George Kalpakas b9900cea7e fix(docs-infra): improve accessibility of button groups (#43460)
Improve the accessibility of button groups (such as those seen in
`/about` and `/resources` to choose between the different categories)
by making them easier to navigate via keyboard:

- Make the individual buttons focusable via keyboard.
  (Previously, they were not focusable - despite being anchor elements,
  because they were lacking an `href` attribute.)

- Give focused buttons a different style.

PR Close #43460
2021-09-21 16:12:40 +00:00
Teri Glover aa8e8db047 docs: Edits to remove jargon (#42928)
PR Close #42928
2021-09-20 22:50:59 +00:00
Teri Glover 8e283cb24c docs: Edits to remove jargon (#42918)
PR Close #42918
2021-09-20 22:50:15 +00:00
Teri Glover 859e53b465 docs: Edits to remove jargon (#42912)
PR Close #42912
2021-09-20 22:49:26 +00:00
Kristiyan Kostadinov 2bb4bf1468 fix(common): titlecase pipe incorrectly handling numbers (#43476)
Fixes that the `titlecase` pipe wasn't picking up numbers which meant that cases like `1st` would be tranformed to `1St`.

Fixes #43459.

PR Close #43476
2021-09-20 21:56:46 +00:00
JoostK defb02f11e fix(compiler-cli): handle directives that refer to a namespaced class in a type parameter bound (#43511)
The template type-checker has to emit type constructors for the
directives that are used in a template, where a type constructor's
declaration has to mirror the type parameter constraints as they were
originally declared. Therefore, the compiler analyzes whether a type
parameter constraint can be recreated, e.g. by generating imports for
any type references. Some type references cannot be recreated, in which
case the compiler has to fall back to a strategy where the type
constructor is created inline in the original source file (which comes
with a performance penalty).

There used to be an issue for type references to namespaced declarations.
The compiler is unable to emit such references such that an inline
type constructor should be used as fallback, but this did not happen.
This caused the attempt to emit the type reference to fail, as the
namespaced declaration cannot be located by the reference emitters.

This commit fixes the issue by using a stricter check to determine if a
type parameter requires an inline type constructor. The TypeScript
reflection host's `isStaticallyExported` logic was expanded to work for
any declaration instead of just classes, as e.g. type declarations can
also be referenced in a type parameter constraint.

Closes #43383

PR Close #43511
2021-09-20 19:56:32 +00:00
Virginia Dooley 2690315b3e docs: reviewed tag added (#43493)
PR Close #43493
2021-09-20 17:09:50 +00:00
Virginia Dooley 41d6f3caee docs: reviewed tag added (#43490)
PR Close #43490
2021-09-20 17:09:21 +00:00
Kristiyan Kostadinov 6ad195909c docs: fix graphic in safari (#43502)
Fixes that the "Loved by millions" graphic doesn't look correctly on Safari.

Note that this fix is somewhat repetitive, but I couldn't find a better one. These are the other things I tried:
* Setting units on the size of `#angular-logo`.
* Setting the size of `#angular-logo` inside the `style` tag.
* Setting the size with inline styles.

Fixes #43498.

PR Close #43502
2021-09-20 17:07:11 +00:00
dario-piotrowicz 020f0d3858 fix(docs-infra): improve aio contributors page responsiveness (#43355)
Improve the aio contributors page responsiveness regarding the browser's
font-size so that the page looks good regarding on font-size settings
(no cropped or cramped content)

PR Close #43355
2021-09-20 16:02:24 +00:00
Virginia Dooley 909c7060f0 docs: reviewed tag added (#43492)
PR Close #43492
2021-09-17 18:46:09 +00:00
Virginia Dooley 96cb91c5eb docs: review tag added (#43471)
PR Close #43471
2021-09-17 18:35:42 +00:00
Teri Glover 326e3796c9 docs: Edits to remove jargon (#42986)
PR Close #42986
2021-09-17 18:35:10 +00:00
Teri Glover 4e30381afd docs: Edits to remove jargon (#43017)
PR Close #43017
2021-09-17 18:10:40 +00:00
Virginia Dooley 4c9346b7be docs: reviewed tag added (#43491)
PR Close #43491
2021-09-17 17:57:56 +00:00
Mwiku 84ec3c3cb6 docs: describe your change... (#43455)
Use the --defaults option when creating the application to make CSS the default styling processor.
PR Close #43455
2021-09-17 17:54:24 +00:00
Teri Glover 5a888f1b30 docs: Edits to remove jargon (#43045)
PR Close #43045
2021-09-17 16:39:19 +00:00
Teri Glover ed235bdce9 docs: Edits to remove jargon (#42999)
PR Close #42999
2021-09-17 16:07:03 +00:00
Virginia Dooley 9231c5d513 docs: reviewed tag added (#43479)
PR Close #43479
2021-09-17 01:32:54 +00:00
Pete Bacon Darwin 05e1adba48 test(compiler): add a test for parsing multiline expressions in attributes (#43132)
This tests a scenario that was failing in an internal project.

PR Close #43132
2021-09-16 18:15:52 +00:00
Pete Bacon Darwin 4cbeee79dd refactor(compiler): define interfaces for each lexer token (#43132)
These token interfaces will make it easier to reason about tokens in the
parser and in specs.

Previously, it was never clear what items could appear in the `parts`
array of a token given a particular `TokenType`. Now, each token interface
declares a labelled tuple for the parts, which helps to document the token
better.

PR Close #43132
2021-09-16 18:15:52 +00:00
Pete Bacon Darwin 9c8a1f8a71 fix(compiler): include leading whitespace in source-spans of i18n messages (#43132)
Previously, the way templates were tokenized meant that we lost information
about the location of interpolations if the template contained encoded HTML
entities. This meant that the mapping back to the source interpolated strings
could be offset incorrectly.

Also, the source-span assigned to an i18n message did not include leading
whitespace. This confused the output source-mappings so that the first text
nodes of the message stopped at the first non-whitespace character.

This commit makes use of the previous refactorings, where more fine grain
information was provided in text tokens, to enable the parser to identify
the location of the interpolations in the original source more accurately.

Fixes #41034

PR Close #43132
2021-09-16 18:15:52 +00:00
Pete Bacon Darwin 6c54a0a8a9 test(compiler): check fullStart source-span (#43132)
The tests were checking that the source-span of parsed HTML nodes were
accurate, but they were not checking the span when it includes the
"leading trivia", which are given by the `fullStart` rather than `start`
location.

PR Close #43132
2021-09-16 18:15:52 +00:00
Pete Bacon Darwin 8ed452bbe1 refactor(compiler): expose token parts in Text nodes (#43132)
When it was tokenized, text content is split into parts that can include
interpolations and encoded entities tokens.

To make this information available to downstream processing, this commit
adds these tokens to the `Text` AST nodes, with suitable processing.

PR Close #43132
2021-09-16 18:15:52 +00:00
Pete Bacon Darwin 50002282a6 refactor(compiler): support encoded entity tokens when lexing markup (#43132)
The lexer now splits encoded entity tokens out from text and attribute value tokens.

Previously encoded entities would be decoded and the decoded value would be
included as part of the text token of the surrounding text. Now the entities
have their own tokens. There are two scenarios: text and attribute values.

Previously the contents of `<div>Hello &amp; goodbye</div>` would be a single
TEXT token. Now it will be three tokens:

```
TEXT: "Hello "
ENCODED_ENTITY: "&", "&amp;"
TEXT: " goodbye"
```

Previously the attribute value in `<div title="Hello &amp; goodbye">` would be
a single text token. Now it will be three tokens:

```
ATTR_VALUE_TEXT: "Hello "
ENCODED_ENTITY: "&", "&amp;"
ATTR_VALUE_TEXT: " goodbye"
```

- ENCODED_ENTITY tokens have two parts: "decoded" and "encoded".
- ENCODED_ENTITY tokens are always preceded and followed by either TEXT tokens
  or ATTR_VALUE_TEXT tokens, depending upon the context, even if they represent
  an empty string.

The HTML parser has been modified to recombine these tokens to allow this
refactoring to have limited effect in this commit. Further refactorings
to use these new tokens will follow in subsequent commits.

PR Close #43132
2021-09-16 18:15:52 +00:00
Pete Bacon Darwin a40297553e refactor(compiler): support interpolation tokens when lexing markup (#43132)
The lexer now splits interpolation tokens out from text tokens.

Previously the contents of `<div>Hello, {{ name}}<div>` would be a single
text token. Now it will be three tokens:

```
TEXT: "Hello, "
INTERPOLATION: "{{", " name", "}}"
TEXT: ""
```

- INTERPOLATION tokens have three parts, "start marker", "expression"
  and "end marker".
- INTERPOLATION tokens are always preceded and followed by TEXT tokens,
  even if they represent an empty string.

The HTML parser has been modified to recombine these tokens to allow this
refactoring to have limited effect in this commit. Further refactorings
to use these new tokens will follow in subsequent commits.

PR Close #43132
2021-09-16 18:15:52 +00:00
George Kalpakas b43f21bb15 refactor(compiler): improve regular expression for stripping comments (#43456)
Previously, the regular expression used by the compiler's ShadowDOM CSS
shim to strip comments from CSS text was susceptible to [catastrophic
backtracking][1], which could lead to exponential (O(2^n)) increase in
complexity/execution time. More specifically, this would be triggered if
the processed text contained an unterminated comment with lots of
leading whitespace (i.e. `/*`, followed by lots of whitespace characters
and no closing `*/`).

Although such input is unlikely in real-world scenarios, this commit
improves the regular expression to not be susceptible to this issue.

[1]: https://www.regular-expressions.info/catastrophic.html

PR Close #43456
2021-09-16 16:50:50 +00:00
Pete Bacon Darwin a50d77c898 docs: remove http example dependency on 3rd party service (#43475)
Previously the `http` example did accessed the npmsearch.com website to demonstrate response caching.
But if this service became unavailable then the example (and its e2e tests) would fail.

This commit changes the example to use the in-memory-web-api for this lookup, which will not be affected by 3rd party outages.

The guide that references this example has been updated to avoid references to the original npm search service.

PR Close #43475
2021-09-16 15:59:05 +00:00
Teri Glover b28ddae8a8 docs: Edits to remove jargon (#43067)
PR Close #43067
2021-09-15 22:53:15 +00:00
Teri Glover c9884b612e docs: Edits to remove jargon (#43052)
PR Close #43052
2021-09-15 22:49:49 +00:00
Virginia Dooley efec149ba7 docs: review tag added (#43466)
PR Close #43466
2021-09-15 21:44:19 +00:00
kirjs adc7c56ede fix(platform-browser): improve error message for missing animation trigger (#41356)
There are two reasons why this error can be called, but only one was covered before.

Fixes #15581

PR Close #41356
2021-09-15 21:09:22 +00:00
Virginia Dooley def6315a76 docs: update reviewed tag (#43452)
PR Close #43452
2021-09-15 10:49:06 -07:00
Andrew Scott afeaf1ea13 test(router): Add tests to document expected behavior (#43450)
This is a patch port of the tests from #43449

PR Close #43450
2021-09-15 10:48:15 -07:00
dario-piotrowicz 10b16d8498 refactor(docs-infra): introduce max-len 120 eslint rule (#43439)
add the max-len rule to the aio eslintrc and fix what code
breaks such rule

PR Close #43439
2021-09-15 10:47:35 -07:00
dario-piotrowicz f08e4dba56 refactor(docs-infra): fix typos in app component (and its tests) (#43439)
fix some minor typos found in the app.component.ts and
app.component.spec.ts files

PR Close #43439
2021-09-15 10:47:35 -07:00
Pete Bacon Darwin ba80ab31f2 docs: move i18n angular.json snippets to external file (#43216)
Note that because `angular.json` is a "boilerplate" file we cannot
just add comments to the one that is actually used in the application.

Instead this commit makes a copy, which is annotated with docregions.
To ensure that this file is not ignored by the example-collector, we had to
update the `.gitignore` to not ignore this file. (This also allows the file to be
easily stored tracked in git).

PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin 5f3abd257b build(docs-infra): support overriding boilerplate files in examples (#43216)
It is now possible to specify file paths in the `"boilerplate-override"`
property of `example-config.json` files to tell the example boilerplate
system to use the file in the example directory rather than overwriting the
example file with that from the boilerplate directory.

PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin d6a3078097 build(docs-infra): indent docplaster markers to the level of the docregion (#43216)
This change makes docplaster markers fit better with the surrounding code
that is being rendered.  Instead of:

```
{
  "a": 100,
// ...
  "b": 200,
// ...
}
```

you can now get

```
{
  "a": 100,
  // ...
  "b": 200,
  // ...
}
```

PR Close #43216
2021-09-15 10:46:46 -07:00