Compare commits

...

322 Commits

Author SHA1 Message Date
Dylan Hunn ca3b552af2 release: cut the v12.2.9 release (#43749)
PR Close #43749
2021-10-06 15:47:55 -07:00
dario-piotrowicz a0cf71717b fix(docs-infra): convert button-like elements to actual buttons (#43601)
some elements in the aio application are anchors or divs but behave
like buttons, it is semantically (and a11y) more correct to convert
them to actual button elements instead

PR Close #43601
2021-10-06 09:22:05 -07:00
Kristiyan Kostadinov df7fd87084 refactor(language-service): fix typo in method name (#43698)
The `fineRenameLocations` method should be called `findRenameLocations`.

PR Close #43698
2021-10-06 09:21:34 -07:00
Pete Bacon Darwin c9e21d080f build(docs-infra): ensure all overloads are shown in interfaces (#43734)
In the API docs, concrete classes do not list the "implementation" overload on a method, since this is not strictly part of its API.

We recently fixed the rendering of interfaces to display all the overloads, since there is no "implementation" overload.

This commit also fixes the rendering of "pseudo-classes", which are a combination of an interface
and a constant.

Fixes #43001

PR Close #43734
2021-10-06 09:21:09 -07:00
Alan Agius f45c692dd9 ci: change ownership of goldens/public-api/manage.js (#43664)
With this change we change ownership of `goldens/public-api/manage.js` from `public-api` to `dev-infra`. This file is a script to manage public-api golden files and therefore it should fall under the dev-infra umbrella.

PR Close #43664
2021-10-05 13:36:37 -07:00
George Kalpakas c4ecc07838 fix(service-worker): make ngsw.json generation deterministic and correct (#43679)
Previously, all asset-groups from `ngsw-config.json` were processed in
parallel. For each asset-group, we retrieved all files for the current
build, filtered out files that were already matched by other
asset-groups, determined which of the remaining files belonged to the
current asset-group and generated entries for the `ngsw.json` manifest.
This process was susceptible to race conditions when there were files
that would be matched by multiple asset-groups. This made the generation
of the `ngsw.json` manifest non-deterministic and violated the rule that
each file would belong to the first asset-group that matched it (based
on the asset-groups' order of appearance in `ngsw-config.json`), thus
leading to broken ServiceWorker behavior.

This commit fixes it by ensuring that the generation process is
deterministic and that asset-groups are processed in the proper order.

NOTE 1:
The generation process has been broken since the beginning, but we have
only noticed this recently. This is possibly related to the CLI's
switching from a virtual file system host (which has more consistent
timing characteristics) to the Node.js built-in `fs.promises` in
angular/angular-cli@d3bc530c10.

NOTE 2:
This commit also ensures that files in the `ngsw.json` hash-table are in
alphabetic order. Previously, the files were added to the hash-table in
blocks corresponding to each asset-group.
This change is not necessary (i.e. the order of keys in the hash-table
makes no difference in behavior), but it makes it easier to scan for a
file (for example, for debugging purposes).

PR Close #43679
2021-10-05 13:34:31 -07:00
George Kalpakas 307da62cd9 build(docs-infra): ensure ngsw.json generation is correct and deterministic (#43687)
As explained in #43679, currently the generation of the `ngsw.json` SW
manifest is non-deterministic and often incorrect. Until we can update
to an `@angular/service-worker` version that includes the fix from
PR #43679, we temporarily work-around the issue by re-generating the
`ngsw.json` manifest after `ng build` using the `ngsw-config` binary
exposed by `@angular/service-worker`.

NOTE:
This works around the issue, because the [FileSystem][1] class used by
the `ngsw-config` binary happens to be synchronous (unlike the
implementation provided by the Angular CLI), thus avoiding the race
conditions described in #43679.

[1]: https://github.com/angular/angular/blob/c721135e370b34c840756bcfb22c8119b4c8c452/packages/service-worker/cli/filesystem.ts#L15

PR Close #43687
2021-10-05 09:49:15 -07:00
George Kalpakas fb29da27cb build(docs-infra): update Angular Material to version 12.2.8 (#43687)
This commit updates angular.io to the latest stable version of Angular
CDK/Material (v12.2.8).

NOTE:
The payload size changes in styles are not entriely caused by this
commit, since the limits where outdated. The actual size changes caused
by this commit are ~100B per theme:
- `light-theme`: 79217 --> 79320
- `dark-theme`:  79116 --> 79216

PR Close #43687
2021-10-05 09:49:14 -07:00
George Kalpakas 087c37cc5c build(docs-infra): update Angular framework to version 12.2.8 (#43687)
This commit updates angular.io to the latest stable version of the
Angular framework (v12.2.8). Among other benefits, this version also
includes the ServiceWorker fix from #43518, which fixes #28114.

NOTE:
This commit also makes the necessary changes to more closely align
angular.io with new apps created with the latest stable Angular CLI.

Fixes #28114

PR Close #43687
2021-10-05 09:49:14 -07:00
George Kalpakas 04372247b6 refactor(docs-infra): prefix error messages with Angular version info (#43687)
Prefix error messages with the Angular version currently used in the
angular.io app. This applies to both errors logged to the console and
reported to Google Analytics and makes debugging certain errors easier.

PR Close #43687
2021-10-05 09:49:14 -07:00
George Kalpakas 5344dfecfe build(docs-infra): use $schema in ngsw-config.template.json to provide intellisense (#43687)
Add an appropriate `$schema` property in `ngsw-config.template.json` to
allow IDEs to provide intellisense about the various fields of the
config.

PR Close #43687
2021-10-05 09:49:14 -07:00
Wey-Han Liaw 7f6050587d fix(router): unset attachRef when router-outlet is destroyed to avoid mounting a destroyed component (#43697)
Previously, when a router-outlet is conditionally shown with an ngIf, and a sub-route was re-attached
via a custom RouteReuseStrategy, router-outlet would try to mount a destroyed component into the view
if the router-outlet is destroyed and re-initialized.

This commit fixes it by unsetting context.attachRef when router-outlet is destroyed, so when the
router-outlet is being initialized again, it no longer sees an attachRef that it needs to mount to the
view.

Fixes #43696

PR Close #43697
2021-10-05 09:48:41 -07:00
dario-piotrowicz 7bc46a877d fix(docs-infra): amend color of code links inside single anchors (#43586)
when some auto code links fail to happen they can be added manually
with the md ``[`code text`](link)``, these generate anchor elements which
contain a code element, such code element does not get the correct text
color, this commit fixes such issue

PR Close #43586
2021-10-04 16:31:17 -07:00
iRealNirmal dc885ebae4 docs: move angular-compiler-options tsconfig snippets to external file (#43545)
Moving angular-compiler-options docs inline code to external file of tsconfig.json and tsconfig.app.json.

closes #43336

PR Close #43545
2021-10-04 10:55:05 -07:00
ultrasonicsoft 12c1b9fcc5 docs: add balram chavan to GDE resources (#43658)
PR Close #43658
2021-10-04 10:53:59 -07:00
mgechev 04f2fd6d15 docs: add developer survey 2021 (#43670)
PR Close #43670
2021-10-04 10:24:59 -07:00
JoostK b4b441077a fix(core): handle invalid constructor parameters in partial factory declarations (#43619)
This commit fixes an oversight in the JIT compilation of partial factory
declarations, where the literal `'invalid'` was not accounted for
(unlike the AOT linker).

Fixes #43609

PR Close #43619
2021-10-01 12:24:31 -04:00
Daniel Díaz 75f74ded5f docs: fix typo in AOT compiler (#43640)
PR Close #43640
2021-10-01 12:24:01 -04:00
little-pinecone 74f71b483f docs: add button type in form array example (#43666)
add a button type in the example of creating a dynamic form so that the button that adds the alias control does not submit the entire form

PR Close #43666
2021-10-01 12:23:10 -04:00
George Kalpakas f3b2c717e5 docs: update commit message guidelines to reflect current requirements (#43650)
Update the commit message guidelines in `CONTRIBUTING.md` to reflect
recent changes in our dev-infra tooling:
- Remove the mention of the 100 chars/line limit, since that is
  [no longer in effect][1].
- Mention Deprecation sections:
  According to our [Deprecation practices][2], we should document
  deprecations in the Changelog, which our tooling supports via
  [DEPRECATED][3] sections in commit messages. Yet this was not
  mentioned in the commit message guidelines.

[1]: https://github.com/angular/angular/blob/a07cb097e9124738880f7978658a2972d25b892e/.ng-dev/commit-message.ts#L7
[2]: https://angular.io/guide/releases#deprecation-practices
[3]: https://github.com/angular/dev-infra/blob/b51360a7cc39cb3deb5ae1bf0bfb121fe7ee0a4e/ng-dev/commit-message/parse.ts#L77

PR Close #43650
2021-10-01 08:55:02 -07:00
xiaohanxu-nick fa0c57bc21 docs: fix missing step in get started example (#43646)
PR Close #43646
2021-10-01 08:46:02 -07:00
dario-piotrowicz c13f7cd1c3 docs: disable erroneous "browser" code links (#43554)
fix the keyword "browser" present in code segments being incorrectly
generated as a link to "api/animations/browser" by applying the
no-auto-link class

PR Close #43554
2021-10-01 08:36:08 -07:00
dario-piotrowicz 7a6cd8866a docs(animations): improve the aio animations introduction (#42885)
improve slightly the angular.io animation introduction guide, such
improvement are styling, information and clarity related

PR Close #42885
2021-10-01 08:34:20 -07:00
Alex Rickabaugh d6679e2969 release: cut the v12.2.8 release (#43654)
PR Close #43654
2021-09-30 13:02:15 -07:00
Alex Rickabaugh ca6bcb7d66 Revert "fix(language-service): provide dom event completions (#43299)"
This reverts commit c8f8d7d3b1.

This commit breaks in IE11, which is still supported by v12, likely due to
the usage of `Array.from()`.
2021-09-30 10:15:56 -07:00
Andrew Scott ca0f057491 test(router): refactor tests to not use deprecated loadChildren (#43578)
Many of the tests in the router code use the deprecated loadChildren as a string. This
has been deprecated for years and can easily be changed to just a function that
returns the module.

PR Close #43578
2021-09-29 11:14:09 -07:00
Chris e3e424e7ca docs: clarify description of :host and :host-context selectors (#41332)
Fixes #39466

PR Close #41332
2021-09-29 10:00:07 -07:00
Daniel Díaz 7a68cd75f2 docs: fix typo in observables file (#43630)
PR Close #43630
2021-09-29 09:59:39 -07:00
Pete Bacon Darwin 59ad3997bc build(docs-infra): ensure all overloads are shown in interfaces (#43614)
In the API docs, concrete classes do not list the "implementation" overload on a method, since this is not strictly part of its API.
There is already a special case for abstract methods that do not have such an implementation overload.

But we were missing the case where the method was part of an interface. In interfaces none of the methods have implementation overloads.

Fixes #43001

PR Close #43614
2021-09-29 09:58:48 -07:00
dario-piotrowicz 8da56d78d9 docs: amend wrong links to async pipe (#43576)
PR Close #43576
2021-09-29 09:57:59 -07:00
Raj Sekhar c9cbe6e7d8 docs: fix broken link to measure performance (#43628)
* "Chrome DevTools Network Performance page" was pointing to a broken link, that was giving 404 error
* The new link points to the right article where it explains the resource timing & network analysis
PR Close #43628
2021-09-28 14:43:47 -07:00
Bobby Galli cfca3d0a5e docs: fix typos in .vscode/README.md (#43621)
PR Close #43621
2021-09-28 14:28:15 -07:00
wszgrcy c1338bf837 fix(compiler-cli): correctly interpret token arrays in @Injectable deps (#43226)
When specifying the `deps` array in the `@Injectable` decorator to
inject dependencies into the injectable's factory function, it should
be possible to use an array literal to configure how the dependency
should be resolved by the DI system.

For example, the following example is allowed:

```ts
@Injectable({
  providedIn: 'root',
  useFactory: a => new AppService(a),
  deps: [[new Optional(), 'a']],
})
export class AppService {
  constructor(a) {}
}
```

Here, the `'a'` string token should be injected as optional. However,
the AOT compiler incorrectly used the array literal itself as injection
token, resulting in a failure at runtime. Only if the token were to be
provided using `[new Optional(), new Inject('a')]` would it work
correctly.

This commit fixes the issue by using the last non-decorator in the
array literal as the token value, instead of the array literal itself.

Note that this is a loose interpretation of array literals: if a token
is omitted from the array literal then the array literal itself is used
as token, but any decorator such as `new Optional()` would still have
been applied. When there's multiple tokens in the list then only the
last one will be used as actual token, any prior tokens are silently
ignored. This behavior mirrors the JIT interpretation so is kept as is
for now, but may benefit from some stricter checking and better error
reporting in the future.

Fixes #42987

PR Close #43226
2021-09-28 14:15:49 -07:00
Ricardo Chavarria 4cc9c397dc docs: Add Ricardo Chavarria to GDE resources (#43571)
update size image
update preview
docs: replace an avatar with smaller size
Change order


PR Close #43571
2021-09-27 14:25:57 -07:00
JoostK 69299f7d4d fix(ngcc): do not fail for packages which correspond with Object members (#43589)
Prior to this commit ngcc stored its package configuration in JavaScript
objects, which caused the builtin `Object` members to be found as
package configuration. This would subsequently crash as their shape was
not as expected.

This commit moves away from using raw JavaScript objects in favor of a
Map. To code was refactored such that `PartiallyProcessedConfig` is
now a class.

Fixes #43570

PR Close #43589
2021-09-27 14:21:54 -07:00
Adrien Crivelli 9d3c2d517d docs(router): params or queryParams are not advised against (#43562)
According to @atscott:

> We no longer speculate about future deprecations. There are no current plans to remove
> `params` or `queryParams` and there's no benefit to advising against their use.

PR Close #43562
2021-09-27 14:21:11 -07:00
Rafael Santana a8e84f6920 docs: close tags properly (#43610)
PR Close #43610
2021-09-27 10:54:56 -07:00
enisfr dac84dd9e1 docs: links added for each builder schema (#43564)
closes #43542

Signed-off-by: enisfr <enisfurkane@gmail.com>

docs: links pointed to the schema files.

closes angular#43542

docs: tslint removed.

closes angular#43542

docs: typo.

closes angular#43542

PR Close #43564
2021-09-27 10:51:49 -07:00
Andrew Scott c8f8d7d3b1 fix(language-service): provide dom event completions (#43299)
Native DOM events were previously not included in the completions
because the dom schema registry would filter out events completely. This
change updates the registry to include events in the private
element->property map and excludes events from lookups outside of the
new `allKnownEventsOfElement` function.

fixes https://github.com/angular/vscode-ng-language-service/issues/1479

PR Close #43299
2021-09-27 10:45:59 -07:00
Teri Glover 28b7f79a63 docs: Edits to remove jargon (#43000)
PR Close #43000
2021-09-27 10:44:22 -07:00
George Kalpakas cadef4caa8 ci: correctly handle commit message with carriage returns in payload-size.sh (#43569)
Previously, if a commit message contained a carriage return in its
header, the `payload-size.sh` script would fail to upload the payload
size data to Firebase, because the JSON payload would be messed up when
trying to concatenate the commit message headers. See an example
[here][1].

This commit avoids this problem by replacing carriage returns before
concatenating the commit message headers with the JSON payload string.

[1]: https://app.circleci.com/pipelines/github/angular/angular/37437/workflows/d0fa4adf-43bb-464e-a2fd-d87da15226dd

PR Close #43569
2021-09-24 10:56:41 -07:00
George Kalpakas 9a5086e9fe fix(docs-infra): display deprecation notes for properties (#43566)
Previously, deprecation notes for deprecated class/interface properties
were not shown in the API docs. This commit fixes it by ensuring that
deprecation notes are shown for properites (similar to how it works for
methods).

PR Close #43566
2021-09-24 10:56:05 -07:00
George Kalpakas 3cf41354ae fix(service-worker): do not unassign clients from a broken version (#43518)
Previously, when a version was found to be broken, any clients assigned
to that version were unassigned (and either assigned to the latest
version or to none if the latest version was the broken one). A version
could be considered broken for several reasons, but most often it is a
response for a hashed asset that eiher does not exist or contains
different content than the SW expects. See
https://github.com/angular/angular/issues/28114#issuecomment-923122967
for more details.

However, assigning a client to a different version (or the network) in
the middle of a session, turned out to be more risky than keeping it on
the same version. For angular.io, for example, it has led to #28114.

This commit avoids making things worse when identifying a broken version
by keeping existing clients to their assigned version (but ensuring that
no new clients are assigned to the broken version).

NOTE:
Reloading the page generates a new client ID, so it is like a new client
for the SW, even if the tab and URL are the same.

PR Close #43518
2021-09-24 10:54:22 -07:00
George Kalpakas 70b194abe3 test(service-worker): use correct assertion in tests (#43518)
Previously, a ServiceWorker test was using the
`MockServerState#sawRequestFor()` method. This method, however, only
returns a boolean indicating whether a request had been seen, but would
not throw an error in either case.

Since the intention was to assert that a specific request was made, this
commit switches to the correct `MockServerState#assertSawRequestFor()`
method.

PR Close #43518
2021-09-24 10:54:22 -07:00
Virginia Dooley d585c78ab3 docs: reviewed tag added (#43472)
PR Close #43472
2021-09-24 10:51:40 -07:00
Virginia Dooley 62e982d7e0 docs: review tag added (#43469)
PR Close #43469
2021-09-24 10:50:21 -07:00
Joe Martin (Crowdstaffing) 1c7545559d docs: update review date (#43245)
docs: Update review date for last content update.

PR Close #43245
2021-09-23 15:40:36 -07:00
Joe Martin (Crowdstaffing) 406abf2372 docs: add subtopics for internationalization (#43245)
Add subtopics for internationalization guide.

PR Close #43245
2021-09-23 15:40:36 -07:00
Joe Martin (Crowdstaffing) 579b05a43c docs: update content (#43245)
Update content per review.

PR Close #43245
2021-09-23 15:40:36 -07:00
Joe Martin (Crowdstaffing) 035b3f7ddb docs: update punctuation (#43245)
Update punctuation per review.

Co-authored-by: TeriGlover <teriglover@google.com>
PR Close #43245
2021-09-23 15:40:36 -07:00
Joe Martin (Crowdstaffing) 2dfe4ecda5 docs: update content (#43245)
Update content per review.

Co-authored-by: TeriGlover <teriglover@google.com>
PR Close #43245
2021-09-23 15:40:36 -07:00
Joe Martin (Crowdstaffing) 38ba02cbdc docs: update link (#43245)
Update link per review.

PR Close #43245
2021-09-23 15:40:36 -07:00
Joe Martin (Crowdstaffing) 3609f90899 docs: update content (#43245)
Update content per review.

PR Close #43245
2021-09-23 15:40:36 -07:00
Joe Martin (Crowdstaffing) 73a5b9e8ed docs: update punctuation (#43245)
Update punctuation per review.

Co-authored-by: TeriGlover <teriglover@google.com>
PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) 719f2b11a8 docs: update grammar (#43245)
Update grammar per review.

Co-authored-by: TeriGlover <teriglover@google.com>
PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) ee98c134c0 docs: update content (#43245)
Update content per review.

PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) 5922763786 docs: update spelling (#43245)
Update spelling per review.

Co-authored-by: TeriGlover <teriglover@google.com>
PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) c3f8ee35b8 docs: add new internationalization links (#43245)
Update link for subtopics of internationalization guide.

PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) 0cf60a8f72 docs: add new internationalization links (#43245)
Update link for subtopics of internationalization guide. Clean up markdown.

PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) ffe4b90c36 docs: add subtopics for internationalization to PR (#43245)
Add subtopics for internationalization guide to PR.

PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) 6cbb79c421 docs: add redirect for internationalization (#43245)
Add redirect for internationalization guide. Add test for redirect.

PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) a03b8e42d7 docs: add subtopics for internationalization to toc (#43245)
Add subtopics for internationalization guide to toc.

PR Close #43245
2021-09-23 15:40:35 -07:00
Joe Martin (Crowdstaffing) 587091d993 docs: add subtopics for internationalization (#43245)
Add subtopics for internationalization guide.

PR Close #43245
2021-09-23 15:40:35 -07:00
Daniel Díaz 2306a3250f docs(router): fix typo in router event API documentation (#43555)
PR Close #43555
2021-09-23 14:45:28 -07:00
Dario Piotrowicz e9beccb672 docs: fix typo in dynamic forms page (#43543)
resolves #43536
PR Close #43543
2021-09-23 14:43:35 -07:00
Teri Glover 85a0cb3082 docs: Edits to remove jargon (#43023)
PR Close #43023
2021-09-23 14:41:17 -07:00
Teri Glover 54050e5927 docs: Edits to remove jargon (#42965)
PR Close #42965
2021-09-23 14:35:54 -07:00
Teri Glover e9e85919bf docs: Edits to remove jargon (#42950)
PR Close #42950
2021-09-23 14:35:22 -07:00
Teri Glover 9bd6fd62ff docs: Edits to remove jargon (#42904)
PR Close #42904
2021-09-23 14:34:42 -07:00
Teri Glover 6e109c7323 docs: amend links in content-projection guide (#43009) (#42904)
PR Close #43009

PR Close #42904
2021-09-23 14:34:42 -07:00
Teri Glover 1849ed1631 docs: Edits to remove jargon (#42904)
PR Close #42904
2021-09-23 14:34:42 -07:00
Teri Glover 0201593c66 docs: Edits to remove jargon (#42904)
PR Close #42904
2021-09-23 14:34:42 -07:00
Jessica Janiuk dad213e8c7 release: cut the v12.2.7 release (#43537) 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
Pete Bacon Darwin 3d2dc18f57 build(docs-infra): switch JSON examples to use inline docregion comments (#43216)
Now JSON files should be commented using

```
// #docregion
```

rather than

```
/* #docregion */
```

There are currently no JSON files with either kind of comments so this change
has no impact yet.

But when we add some examples with such comments, they will also benefit
from `// ... ` style docplasters to join docregion fragments.

PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin 14f5f58fbf docs: move duplicate custom id snippets to external examples (#43216)
PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin 88f5957c71 docs: move nginx and apache config blocks to external files (#43216)
PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin d25fbc3f22 build(docs-infra): support docregions in .conf files (#43216)
This commit tells the docregion parser how to process files that end in `.conf`.

PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin 6461ef7a67 docs: move plural function example to external file (#43216)
PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin aca61ad1dd docs: move global locale import to external example file (#43216)
PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin 5d36ceb276 docs: move shell snippets to external example files (#43216)
PR Close #43216
2021-09-15 10:46:46 -07:00
Pete Bacon Darwin 35f1d2b91e build(docs-infra): support docregions in .sh example files (#43216)
This commit tells the docregion parser how to process `.sh` files.

PR Close #43216
2021-09-15 10:46:46 -07:00
Andrew Kushnir 9b8f056604 release: cut the v12.2.6 release (#43462) 2021-09-15 10:26:25 -07:00
Joe Martin (Crowdstaffing) 2050b0898b docs: update grammar (#43451)
Update grammar per review.

PR Close #43451
2021-09-14 15:51:31 -07:00
Joe Martin (Crowdstaffing) 5af9404cba docs: update grammar (#43451)
Update grammar per review.

PR Close #43451
2021-09-14 15:51:31 -07:00
Joe Martin (Crowdstaffing) d5c58414ab docs: update link (#43451)
Update link per review.

PR Close #43451
2021-09-14 15:51:31 -07:00
Joe Martin (Crowdstaffing) 69035dd52d docs: update punctuation (#43451)
Update punctuation per review.

PR Close #43451
2021-09-14 15:51:31 -07:00
Joe Martin (Crowdstaffing) 1a3a87057a docs: update grammar (#43451)
Update grammar per review.

PR Close #43451
2021-09-14 15:51:31 -07:00
Joe Martin (Crowdstaffing) 75abf868c0 docs: update spelling (#43451)
Update spelling per review.

PR Close #43451
2021-09-14 15:51:31 -07:00
Joe Martin (Crowdstaffing) f099d9c0ea docs: update capitalization (#43451)
Update capitalization per review.

PR Close #43451
2021-09-14 15:51:31 -07:00
Andrew Scott 24cf4eaa4d refactor(router): Remove TODO and slightly adjust eager browserUrlTree update (#43426)
No test was added for this case because I can't think of a test case to
write that would work.

This change updates the code for a consistent mental model of setting
the `browserUrlTree`. It's only meant to track the `UrlTree` that the
`UrlHandlingStrategy` is set to extract, not the full `rawUrl`. Notice
that everywhere else, the `browserUrlTree` is set to
`urlAfterRedirects`, which is computed based on the extracted URL, _not_
the `rawUrl`.

PR Close #43426
2021-09-14 11:11:43 -07:00
David Shevitz 2f94ac374a docs: add guidelines for localizing angular documentation (#43314)
PR Close #43314
2021-09-14 08:32:51 -07:00
George Kalpakas d2bee44951 perf(docs-infra): reduce unnecessary whitespace in API docs (#43435)
The HTML for the docs pages is generated by Dgeni based on some
[Nunjucks][1] templates.

Previously, these templates were set up in a way that introduced a lot
excess whitespace in the generated HTML, unnecessarily bloating the
corresponding JSON files that need to be downloaded in order to view a
certain docs page. This has been discussed in #28105 and was again
observed while investigating #43285.

This commit refactors some of the templates related to API docs (which
seem to be the most affected ones) to drastically reduce the amount of
excess whitespace. More specifically, the total size of all files in
`generated/docs/api/` was reduced from ~13MB to ~7MB.

Besides the reduced payload size for each API page, this change will
also reduce the amount of memory needed by the ServiceWorker to cache
the API pages that have been visited by a user.

NOTE:
The affected files are not eagerly downloaded when navigating to
angular.io. Instead, each file is downloaded individually, as soon as a
user visits the corresponding API docs page. Therefore, the impact of
this change will be relatively small for most users.

[1]: https://mozilla.github.io/nunjucks/

PR Close #43435
2021-09-14 08:29:51 -07:00
George Kalpakas 7f23958c73 build(docs-infra): update remark-html to 13.0.2 (#43435)
NOTE:
This [version][1] includes a breaking fix ([commit b0b1ba5c5][2]), which
turns sanitization on by default. Since, we don't need sanitization (the
HTML is authored by docs authors and tooling and should be safe), this
commit restores the old behavior by setting the [sanitize][3] option to
`false`.

[1]: https://github.com/remarkjs/remark-html/releases/tag/13.0.2
[2]: https://github.com/remarkjs/remark-html/commit/b0b1ba5c55a58b26bbe1ca3b6def18e95dbbd89e
[3]: https://github.com/remarkjs/remark-html#optionssanitize

PR Close #43435
2021-09-14 08:29:50 -07:00
George Kalpakas e74eac2368 build(docs-infra): update github-slugger to 1.4.0 (#43435)
NOTE:
This [version][1] includes a breaking fix ([commit af59f343d][2]). More
specifically `github-slugger` will no longer trim the text of a heading
before generating an ID and (with whitespace converted to `-`) this
results in different heading IDs:
**Before:** `<h3>  foo bar  </h3>` --> `<h3 id="foo-bar">...`
**After:** `<h3>  foo bar  </h3>` --> `<h3 id="--foo-bar--">...`

The different IDs now break some of our anchor-links, becuase
`github-slugger` is used by [rehype-slug][3], which is in turn used by
our [autolinkHeadings][4] dgeni post-processor.

To avoid the issue with broken anchor links, we update the
`renderMethodDetail()` nunjucks macro to omit excess whitespace in
headings.

[1]: https://github.com/Flet/github-slugger/releases/tag/v1.4.0
[2]: https://github.com/Flet/github-slugger/commit/af59f343dc7fe88a94a79c721fb3225a275a095d
[3]: https://github.com/rehypejs/rehype-slug
[4]: https://github.com/angular/angular/blob/75a3c778b1f7be913f0287423d40fade68ee9adc/aio/tools/transforms/angular-base-package/post-processors/autolink-headings.js#L3

PR Close #43435
2021-09-14 08:29:50 -07:00
Andrew Scott 4034f252c9 fix(router): Allow renavigating to failed URLs (#43424)
There are situations where the Router does not currently clean up failed navigations
correctly. While this is problematic on its own, we can mitigate some of
the damage by processing any URL when we get a navigation request when
the internal router state is out of sync.

Each of the added tests would fail without this change.

fixes #34795

PR Close #43424
2021-09-13 14:48:01 -07:00
Naveed Ahmed a102b27641 fix(service-worker): clear service worker cache in safety worker (#43324)
clear angular service worker cache in safety worker to ensure stale
or broken contents are not served in future requests

Fixes #43163

PR Close #43324
2021-09-13 14:34:33 -07:00
mezhik91 baf8145ee0 docs: add Dmytro Mezhenskyi to GDE resources (#43282)
PR Close #43282
2021-09-13 12:57:00 -07:00
dario-piotrowicz 52c320fda6 docs: remove unnecessary "https://angular.io/" from aio links (#43425)
PR Close #43425
2021-09-13 09:24:07 -07:00
Renovate Bot 176aa999bd build: update dependency karma to v6 (#43422)
Updates the dependency for Karma to v6. This is a patch port PR.

PR Close #43422
2021-09-13 09:23:24 -07:00
Bjarki c8179353ce fix(docs-infra): bump aio size limit (#43406)
Increase the aio size tracking limit as a result of Trusted Types
refactoring.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki 604965bdde build(docs-infra): enable tsec security checker (#43406)
tsec is a TypeScript compiler wrapper for restricting use of
security-sensitive DOM APIs, in particular those that could lead to XSS
or Trusted Types violations. Add it as a linter to aio to prevent future
Trusted Types regressions on angular.io.

Also introduces security_exemptions.json, which lists the known,
security-reviewed tsec security violations. New entries can only be
added to this file after a security review, in particular making sure
that the corresponding code does not cause XSS vulnerabilities or
Trusted Types violations.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki 2f47de82af build(docs-infra): send CSP reports for Trusted Types violations (#43406)
Configure Firebase to serve a CSP header on angular.io that enables
Trusted Types in report-only mode. This causes any Trusted Types
violations that may occur as users browser angular.io to generate a CSP
report that is sent to csp.withgoogle.com, where it is processed by
Google's CSP report collector.

This is a non-breaking change that allows us to evaluate whether
angular.io is fully compatible with Trusted Types, at which point we can
start enforcing Trusted Types.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki d86e1aba0d build(docs-infra): enable Trusted Types enforcement in angular.json (#43406)
Configure angular.json to serve a CSP header that enabled Trusted Types
in enforcement mode, both in e2e tests and when running the local
development server. This should help prevent regressions related to
Trusted Types in the angular.io app.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki e5ee5a26eb fix(docs-infra): pass a TrustedScriptURL to ServiceWorkerModule (#43406)
Fix a Trusted Types violation in ServiceWorkerModule that occurs when
initializing the service worker from a string URL, by passing a
TrustedScriptURL instead.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki 586302ab2b fix(docs-infra): make doc-viewer compatible with Trusted Types (#43406)
Change DocumentContents.contents to a TrustedHTML and update users
accordingly.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki 02c514e670 fix(docs-infra): make custom icon registry compatible with Trusted Types (#43406)
Change SvgIconInfo.svgSource to be a TrustedHTML and update all its
users accordingly. Also introduce the svg template tag function for
building TrustedHTML from constant SVG sources.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki 501cbc59cc fix(docs-infra): make pretty-printer compatible with Trusted Types (#43406)
Change the PrettyPrinter interface to accept a TrustedHTML and patch
prettify.js so that it makes use of that value without modification.
Update all users of the service to produce, and pass in a TrustedHTML.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki ae1387440b fix(docs-infra): fix simple Trusted Types violations (#43406)
Also introduce a dependency on the Trusted Types type definitions and a
Trusted Types polyfill, safevalues. Create a security module for common,
security-reviewed transformations into Trusted Types.

PR Close #43406
2021-09-10 09:24:48 -07:00
Bjarki 93bb2dde3e fix(docs-infra): fix Trusted Types violation in Analytics snippet (#43406)
The Google Analytics snippet loads its runtime by dynamically creating a
script element and assigning a URL to its src attribute. This causes a
Trusted Types violation.

To fix this, create an inline Trusted Types policy called 'aio#analytics'
to bless the script URL, which is a trusted constant.

PR Close #43406
2021-09-10 09:24:48 -07:00
mgechev b4a551c7f4 docs: add ngUpgrade maintenance timeline (#43379)
Add details about the maintenance timeline for ngUpgrade, reflecting
the deprecation of AngularJS.

PR Close #43379
2021-09-10 09:23:12 -07:00
dario-piotrowicz 08528e9f71 docs: amend code related to string-expressions for property binding (#43366)
resolves #43287

PR Close #43366
2021-09-10 09:22:14 -07:00
Aristeidis Bampakos cbf360ddba docs: add Architect Training to resources (#43327)
PR Close #43327
2021-09-09 14:54:00 -07:00
Andrew Scott ea30979187 docs: Add documentation and TODOs for cleanup (#43391)
* Document `currentUrlTree`, `browserUrlTree`, and `rawUrlTree`
* Add a couple `TODO` comments to investigate changes based on understanding

PR Close #43391
2021-09-09 14:53:27 -07:00
Andrew Kushnir 134e4f5f6a Revert "refactor(router): clean up unnecessary flag in restoreHistory function" (#43409)
This reverts commit 061a456e39.

PR Close #43409
2021-09-09 14:23:31 -07:00
Aristeidis Bampakos 8cc93b723c docs: add Angular Projects book in resources (#43130)
PR Close #43130
2021-09-09 11:33:37 -07:00
David Shevitz a0f0dee25b docs: update the reviewed tag for what-is-angular topic (#43213)
PR Close #43213
2021-09-09 11:30:31 -07:00
Amadou Sall 0cc7ef658c docs: remove extraneous word in the Dependency injection in action guide (#43255)
PR Close #43255
2021-09-09 11:27:31 -07:00
Michele Stieven 565b749713 docs: add Michele Stieven to GDE resources (#43233)
PR Close #43233
2021-09-09 11:21:03 -07:00
Andrew Scott 2658219f7a refactor(router): clean up unnecessary flag in restoreHistory function (#43382)
This restores the `finalize` function to directly call
`resetUrlToCurrentUrlTree`, as it was before efb440eb2f.
This allows us to simplify the `restoreHistory` function because it no
longer needs to handle the call from `finalize` where it should not
reset the internal router state.

PR Close #43382
2021-09-09 09:22:06 -07:00
Alan Agius 141fde1632 fix(animations): emit pure annotations to static property initializers (#43344)
Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces.

See the below TypeScript playgrounds

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA
```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = new NullInjector();
console.log(Injector.NULL);

```

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA

```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = ( /* @__PURE__ */new NullInjector());
console.log(Injector.NULL);
```

PR Close #43344
2021-09-09 09:21:25 -07:00
Alan Agius ca510c87c5 fix(core): emit pure annotations to static property initializers (#43344)
Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces.

See the below TypeScript playgrounds

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA
```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = new NullInjector();
console.log(Injector.NULL);

```

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA

```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}a
exports.Injector = Injector;
Injector.NULL = ( /* @__PURE__ */new NullInjector());
console.log(Injector.NULL);
```

PR Close #43344
2021-09-09 09:21:24 -07:00
George Kalpakas 0e14deeb92 docs(bazel): fix outdated redirect URL for /guide/bazel (#43376)
The file we are redirecting `/guide/bazel` to was moved from
`bazel/src/schematics/README.md` to `bazel/docs/BAZEL_SCHEMATICS.md` in
commit 71b8c9ab29.

Update the Firebase configuration to use the new path in the redirect
URL.

PR Close #43376
2021-09-09 09:17:40 -07:00
Andrew Scott e726a63cdd release: cut the v12.2.5 release (#43392) 2021-09-08 09:28:03 -07:00
dario-piotrowicz c02e5e15b6 refactor(common): removed TODO no longer considered necessary (#43378)
The TODO comment suggesting to verify that the target element to
scroll to needs to be an anchor does not longer seems under consideration
so it can be removed

resolves #43348

PR Close #43378
2021-09-07 23:05:32 +00:00
Paul Gschwendtner 01d2f03d3d ci: avoid failures when yarn unlinks bazelisk in windows jobs (#43365)
Windows disallows removal of files which are currently being used.
i.e. have active handles. This currently can result in permission denied
failures on the Windows CI jobs where `yarn bazel` resolves to the local
bazelisk installation that can be unlinked by `yarn_install` repository
fetching as part of the Bazel invocation, resulting in errors like:

```
ERROR: An error occurred during the fetch of repository 'npm':
   yarn_install failed: $ node tools/yarn/check-yarn.js
...
[4/5] Linking dependencies...
info If you think this is a bug, please open a bug report with the information provided in "C:\\users\\circleci\\ng\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
 (warning " > tsickle@0.34.3" has incorrect peer dependency "typescript@~3.3.1".
error An unexpected error occurred: "EPERM: operation not permitted, unlink 'C:\\users\\circleci\\ng\\node_modules\\@bazel\\bazel-win32_x64\\bazel-0.27.0-windows-x86_64.exe'".
Process stalled
Active handles:
  - Socket
  - Socket
  - Socket
)
```

We workarund this in order to improve CI stability in case the node modules are
being invalidated by Bazel, or through Yarns integrity checking.

PR Close #43365
2021-09-07 21:29:58 +00:00
Paul Gschwendtner e5f9d2d046 build: check .ng-dev tool configuration in CI (#43365)
Checks the `.ng-dev` tool configuration in CI, compared
to doing it locally when the caretaker intends to perform
a merge and then realizes the config is broken.

PR Close #43365
2021-09-07 21:29:58 +00:00
Paul Gschwendtner 68a7cc12e4 build: update bazel setup to latest versions (#43365)
Updates the overall Bazel setup to their latest versions:

* rules_nodejs is updated to stable 4.0.0
* rules_sass is updated to the latest version containing a fix
  for the `@bazel/worker` bug we had a workaround for.
* dev-infra-private is updated to avoid duplicated dependencies.
  We should use a version that also relies on stable rules_nodejs v4.

Note: We are not set on how dependencies for the `bazel/` folder
of the dev-infra package are managed, but we removed `@types/`
packages from the transitive dependencies, so we now need to
manually include `@types/uuid` for building the benchmark driver
utilties. We need to revisit this in the future.

PR Close #43365
2021-09-07 21:29:58 +00:00
Charles Barnes 0bfb5b1f00 docs: remove Angular 9 from support table (#43350)
PR Close #43350
2021-09-07 21:29:32 +00:00
dario-piotrowicz 1bc1971d15 docs: fix app-hero-detaill typo (#43349)
PR Close #43349
2021-09-07 21:25:03 +00:00
George Kalpakas 4e11347a25 build: update feature request template to include core package (#43323)
Update the dropdown list to include core in the list of packages.
PR Close #43323
2021-09-07 21:24:15 +00:00
William Sedlacek 3b4f121caf docs(common): correct typos in jsdoc of http client (#43352)
This corrects four typos in the HttpClient JSDoc
capabilites => capabilities
reuested => requested
wuth => with
responmse => response
PR Close #43352
2021-09-07 18:45:16 +00:00
Ikko Ashimine d8f9e6131f refactor: fix typo in postinstall-patches.js (#43362)
refering -> referring
PR Close #43362
2021-09-07 18:44:47 +00:00
Enea Jahollari aa1782cee6 docs: enhance spacings in dynamic component loader section examples (#43241)
PR Close #43241
2021-09-02 16:45:10 +00:00
Enea Jahollari 4e4a198b3f docs: enhance spacings in content projection section examples (#43241)
PR Close #43241
2021-09-02 16:45:10 +00:00
Enea Jahollari 5af952491a docs: enhance spacings in inputs outputs section examples (#43241)
PR Close #43241
2021-09-02 16:45:10 +00:00
Enea Jahollari d7711d0510 docs: enhance spacings in component interaction section examples (#43241)
PR Close #43241
2021-09-02 16:45:10 +00:00
Enea Jahollari f5d0c889ab docs: enhance spacings in component lifecycle section examples (#43241)
PR Close #43241
2021-09-02 16:45:09 +00:00
Enea Jahollari dc46cc4b37 docs: enhance spacings in component overview section examples (#43241)
PR Close #43241
2021-09-02 16:45:09 +00:00
Enea Jahollari 39c50b577e docs: enhance spacings in try it section examples (#43241)
PR Close #43241
2021-09-02 16:45:09 +00:00
Enea Jahollari 8e1c309e52 docs: enhance what is angular section spacing (#43241)
PR Close #43241
2021-09-02 16:45:09 +00:00
Pete Bacon Darwin a6e22c4b8e build(docs-infra): update dgeni-packages to improve checkLinks messages (#43317)
This update should make the list of files with broken links more readable.

Fixes #43214

PR Close #43317
2021-09-02 16:44:47 +00:00
Alan Agius a0bd6e90f9 fix(router): add more context to Unhandled Navigation Error (#43291)
Previously, the error message was not added to `Unhandled Navigation Error`

Before
```
main.js:1 Unhandled Navigation Errors:
```

After
```
main.js:1 Unhandled Navigation Errors: SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL 'http://localhost:4200/' cannot be created in a document with origin 'http://127.0.0.1:8080' and URL 'http://127.0.0.1:8080/'.
```

PR Close #43291
2021-09-01 21:15:00 +00:00
Jessica Janiuk caecd1889b release: cut the v12.2.4 release (#43308) 2021-09-01 13:30:13 -05:00
George Kalpakas d8f637ab43 docs: add step to declare ProductAlertsComponent in tutorial (#43229)
The getting-started tutorial at angular.io/start instructs users to
generate a `ProductAlertsComponent` using the "Angular generator"
feature in [StackBlitz](https://stackblitz.com/). However, unlike the
Angular CLI, generating a component in StackBlitz does not automatically
declare it in `AppModule`, which is a requirement for the component to
be used in the application. This resulted in a compile error when
following the tutorial instructions.

This commit fixes this by adding a step to manually import and declare
the newly generated component in `app.module.ts`.

Fixes #43020
Closes #43212

PR Close #43229
2021-08-30 13:37:46 -07:00
Joey Perrott 46bd8f2495 ci: update pullapprove config to reflect kyliau's departure (#43230)
Update pullapprove configuration to remove kyliau from groups.

PR Close #43230
2021-08-30 08:23:41 -07:00
Joey Perrott d84a4eb90f docs: remove recent departures from contributors page (#43230)
PR Close #43230
2021-08-30 08:23:40 -07:00
Daniel Trevino 692e8ab21e test(compiler-cli): add tests for NullishCoalescingNotNullableCheck (#43232)
Add tests to make sure the nullish coalescing check is generating the
correct diagnostics.

Refs #42966

PR Close #43232
2021-08-26 16:36:33 -07:00
Daniel Trevino 5d64d17a52 refactor(compiler-cli): add NullishCoalescingNotNullableCheck (#43232)
Add a template check that returns diagnostics if the left side of a
nullish coalescing operation is not nullable.

Refs #42966

PR Close #43232
2021-08-26 16:36:33 -07:00
Daniel Trevino 9c6399926a refactor(compiler-cli): use TemplateCheckWithVisitor in InvalidBananaInBoxCheck (#43232)
Modify the existing template check to use the new abstract class. This
makes template checks easier to read and understand.

Refs #42966

PR Close #43232
2021-08-26 16:36:32 -07:00
Daniel Trevino 75fc846745 refactor(compiler-cli): add abstract TemplateCheckWithVisitor class (#43232)
Add an abstract class that has a default implementation of the run
function and visits all nodes. Authors of template checks can extend
this class and override the `visitNode` method to return diagnostics.

Refs #42966

PR Close #43232
2021-08-26 16:36:32 -07:00
Daniel Trevino debe517d4f refactor(compiler-cli): move component out of TemplateContext (#43232)
Move `component` out of the `TemplateContext` so the context can be
reused for multiple components.

Refs #42966

PR Close #43232
2021-08-26 16:36:32 -07:00
Daniel Trevino e29f1d9cf8 refactor(compiler-cli): change checks folder structure (#43232)
Change template checks into `extended/checks` instead of
`extended/src/template_checks`.

Refs #42966

PR Close #43232
2021-08-26 16:36:32 -07:00
Daniel Trevino 553eb2cc9f refactor(compiler-cli): remove whitespace (#43232)
Remove extra whitespace introduced in a previous PR.

PR Close #43232
2021-08-26 16:36:32 -07:00
Joey Perrott 30d959a48a build: update issue template to include core package (#43272)
Update the dropdown list to include core in the list of packages.

PR Close #43272
2021-08-26 19:43:14 +00:00
Andrew Scott fdcb420bd7 docs(router): Fix incorrect name for url match options (#43268)
fixes #43123

PR Close #43268
2021-08-26 10:07:24 -07:00
Kristiyan Kostadinov 524b4d5a1f refactor(forms): make error messages easier to tree shake (#43223)
Currently the error message functions are defined as static methods on a class which means that as soon as one of them is used somewhere, all of them have to be retained. This isn't a problem at the moment, because all of them are behind `ngDevMode` checks, but it's error prone and it's easy to fix.

These changes move them out into functions so that they can be imported individually. It also has the advantage of allowing Webpack to minify the function names.

PR Close #43223
2021-08-26 10:05:36 -07:00
segunb fb64f711f8 docs: Close #View tag to avoid confusion (#43256)
PR Close #43256
2021-08-26 09:44:08 -07:00
nickreid e7e78e6709 refactor(zone.js): Rename class ZoneDelegate to _ZoneDelegate to differentiate it from the ZoneDelgate interface (#43019)
The current naming causes tsickle to emit `/** @implements {ZoneDelegate} */ class ZoneDelegate ...`, which is a cyclic definition error in Closure Compiler. Additionally, the name shadowing is also confusing to humans.

PR Close angular#43019

PR Close #43019
2021-08-25 15:12:01 -07:00
nickreid 8233906be2 fix(compiler-cli): Emit type annotations for synthesized decorator fields (#43021)
Previously, the decorator transformer was annotating the synthesized properties with TS type annotations. However, because it ran after the JSDoc transformer, the TS types were just dropped from the emitted JS. Attempting to move the decorator transformer before the JSDoc transformer causes tsickle crashes because synthetic AST fragments are not attached to a SourceFile node.

PR Close #43021
2021-08-25 15:05:29 -07:00
Alex Rickabaugh b8183614f5 release: cut the v12.2.3 release (#43257)
PR Close #43257
2021-08-25 14:20:31 -07:00
George Kalpakas b46ce7d42f build(docs-infra): upgrade cli command docs sources to 56c5962df (#43239)
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/7c2d76d9e...56c5962df):

**Modified**
- help/lint.json

PR Close #43239
2021-08-25 10:48:04 -07:00
Daniel Trevino 36bf0ae985 test(language-service): add test for extended diagnostics (#43134)
Add a test to make sure extended template diagnostics are being correctly
generated in the language service for non-ts files.

Refs #42966

PR Close #43134
2021-08-25 10:43:02 -07:00
Daniel Trevino 3b317dcf87 refactor(compiler-cli): integrate extended diagnostics with the language service (#43134)
Add the call to get the extended template diagnostics in
the compiler's `getDiagnosticsForComponent`. This makes showing
extended diagnostics in non-ts files posible.

Refs #42966

PR Close #43134
2021-08-25 10:43:02 -07:00
Daniel Trevino 3ad527d86e refactor(compiler-cli): rename ExtendedTemplateChecker get diagnostics fucntion (#43134)
Rename `getExtendedTemplateDiagnosticsForComponent` to
`getDiagnosticsForComponent` since it's implied they are extended
diagnostics.

Refs #42966

PR Close #43134
2021-08-25 10:43:02 -07:00
Daniel Trevino b6ff762e36 refactor(compiler-cli): move getDiagnosticsForComponent to compiler (#43134)
Change the language service to call `getDiagnosticsForComponent` from
the compiler instead of the `TemplateTypeChecker`.

Refs #42966

PR Close #43134
2021-08-25 10:43:02 -07:00
Daniel Trevino e196311e5c refactor(compiler-cli): move ExtendedTemplateChecker to LazyCompilationState (#43134)
Create the `ExtendedTemplateChecker` during `makeCompilation`, that way
it's avaiblable in the whole compiler.

Refs #42966

PR Close #43134
2021-08-25 10:43:01 -07:00
Daniel Trevino 3cf8f66f3a refactor(compiler-cli): use TemplateDiagnostic in extended package (#43134)
Return `TemplateDiagnostic` instead of `ts.Diagnostic` when getting the
extended template diagnostics. This makes the integration with the
language service easier. This also fixes the error code and now uses the
`ngErrorCode` for extended template diagnostics.

Refs #42966

PR Close #43134
2021-08-25 10:43:01 -07:00
dario-piotrowicz d7b6416fcf refactor(common): fix emiting typos (#43221)
fix some of the aio examples which log strings containing "emiting" instead of "emitting"

PR Close #43221
2021-08-23 13:30:29 -07:00
shlasouski fc7f92159d fix(service-worker): NPE if onActionClick is undefined (#43210)
Previously, it leads to fail if notification.data.onActionClick is undefined

PR Close #43210
2021-08-23 13:29:59 -07:00
Daniel Trevino cb8e51f8cf test(language-service): add extended diagnostics test (#43107)
Add a test in the langauge-service to make sure the extended template
diagnostics are being correctly generated.

Refs #42966

PR Close #43107
2021-08-19 11:55:28 -07:00
Daniel Trevino e6b2bedd70 test(compiler-cli): add extended template diagnostics end-to-end tests (#43107)
This commit adds extended template diagnostics end-to-end tests, to make
sure the diagnostics are generated correctly. Template checks are
already tested with unit tests.

Refs #42966

PR Close #43107
2021-08-19 11:55:28 -07:00
Daniel Trevino 58a19a3021 refactor(compiler-cli): add extendedTemplateCheck phase to compiler (#43107)
This commit integrates extended template checks with the compiler, by
adding another phase of diagnostics generation. This integration is
under the `_extendedTemplateDiagnostics` flag.

Refs #42966

PR Close #43107
2021-08-19 11:55:28 -07:00
Daniel Trevino f70d2a2981 refactor(compiler-cli): export ExtendedTemplateCheckerImpl and template checks (#43107)
This commit exports the implementation of `ExtendedTemplateChecker` to
generate extended template diagnostics and all the template checks.

Refs #42966

PR Close #43107
2021-08-19 11:55:28 -07:00
Daniel Trevino 3bbf00fdd4 refactor(compiler-cli): add ExtendedTemplateChecker (#43107)
Change the current way to run template checks to the
`ExtendedTemplateChecker` instead of just the
`getExtendedTemplateDiagnosticsForComponent` function. Refactored the
tests that used the previous function to use the new class.

Refs #42966

PR Close #43107
2021-08-19 11:55:28 -07:00
dario-piotrowicz 19fa033f79 refactor(docs-infra): use tslint in aio's tools-lint script (#43010)
Instead of the deprecated tslint use eslint in the aio's tools-lint
script

PR Close #43010
2021-08-19 11:20:06 -07:00
Erik Slack 513b17043e docs: fix typo (#43190)
Fix typo in description of ngxp and link for angular community meetup

PR Close #43190
2021-08-18 10:52:19 -07:00
Dylan Hunn c501e86fd2 release: cut the v12.2.2 release (#43195) 2021-08-18 10:15:31 -07:00
Kirk Larkin e849e57059 docs: tidy up description of NgComponentOutlet (#43159)
PR Close #43159
2021-08-18 09:17:44 -07:00
Joe Martin (Crowdstaffing) e31ed3d0dc docs: update links and formatting (#43066)
Update links and formatting prior to creating sub-topics.

Update links to reference links for consistency.  Update formatting for code sections.  Updated list alignment for consistent formatting.

PR Close #43066
2021-08-17 20:00:58 -07:00
Pete Bacon Darwin 545972e5e9 docs(upgrade): add @extensible to the UpgradeComponent class (#42807)
This class is designed to be used as a base class. Therefore it should not be
marked as `final` in the API docs.

PR Close #42807
2021-08-17 09:23:09 -07:00
Pete Bacon Darwin 38d51e4926 build(docs-infra): add sealed markers to classes in API pages (#42807)
This change will mark classes as `sealed` unless they have been annotated
with an `@extensible` jsdoc tag.

Fixes #42802

PR Close #42807
2021-08-17 09:23:09 -07:00
Kristiyan Kostadinov 535837e617 perf(platform-browser): avoid intermediate arrays in server transition (#43145)
The server transition initializer looks for some `style` tags and clears them based on their `ng-transition` ID. The way we currently have the logic creates a couple of intermediate arrays just so we can call `forEach` at the end.

These changes use a regular `for` loop with an `if` statement instead. This isn't a _massive_ performance improvement, but the logic does run during app initialization which is performance-sensitive and it's an easy change to make on our end.

PR Close #43145
2021-08-17 09:22:05 -07:00
Charles Lyding bb6555979d fix(animations): add pure annotations to static property initializers (#43064)
Class static properties with initializers that cause code execution (for example, call expressions or new expressions) have the potential to cause side effects at module evaluation. This is similar in effect to module level code. As a result, optimizers can not safely remove a class with such a static property as the potential side effects may have meaningful effects on the state of the application execution. To allow classes with these type of static properties to be optimized and removed if unused, the initializer expressions for the static properties can be annotated as pure. This annotation provides a signal to an optimizer that the expression does not have any potential side effects and is useful in cases where static analysis can not currently prove that there are, in fact, no side effects caused by the initializer.

PR Close #43064
2021-08-16 17:20:21 -07:00
Charles Lyding 738b23347e fix(core): add pure annotations to static property initializers (#43064)
Class static properties with initializers that cause code execution (for example, call expressions or new expressions) have the potential to cause side effects at module evaluation. This is similar in effect to module level code. As a result, optimizers can not safely remove a class with such a static property as the potential side effects may have meaningful effects on the state of the application execution. To allow classes with these type of static properties to be optimized and removed if unused, the initializer expressions for the static properties can be annotated as pure. This annotation provides a signal to an optimizer that the expression does not have any potential side effects and is useful in cases where static analysis can not currently prove that there are, in fact, no side effects caused by the initializer.

PR Close #43064
2021-08-16 17:20:21 -07:00
dario-piotrowicz cd8b1a5087 refactor(compiler-cli): remove unused closureCompilerEnabled from NgtscProgram (#43148)
remove the NgtscProgram's private field closureCompilerEnabled as that
is not being used in the class itself

PR Close #43148
2021-08-16 17:19:54 -07:00
Joey Perrott c9def401f8 ci: update circle cache key (#43175)
Update the prefix used for the circle cache key to use new cache base.

PR Close #43175
2021-08-16 17:19:08 -07:00
Joey Perrott dfd6337bc9 build: add mainBranchName to github configuration (#43175)
Update the ng-dev config for Github to include the main branch name.

PR Close #43175
2021-08-16 17:19:08 -07:00
Joey Perrott fe6a5acd17 build: remove dev-infra directory and migrate to relying on @angular/dev-infra-private-builds (#43175)
Remove the dev-infra directory and complete the migration to using the code generated by the
angular/dev-infra repository.

PR Close #43175
2021-08-16 17:19:08 -07:00
George Kalpakas 768a6698a0 docs(router): use the correct live-example name in routing-overview.md (#43180)
The previously used code (`<live-example stackblitz="router">`) would
try to target the `router.stackblitz.json` file inside the
(non-existent) `routing-overview` example (same as the guide's name).

This commit fixes the code to correctly express the original intention
of targeting the default `stackblitz.json` file of the `router` example
with `<live-example name="router">`.

Fixes #43167

PR Close #43180
2021-08-16 17:18:29 -07:00
Pete Bacon Darwin cd10a4cc13 test(compiler): add a test for parsing multiline expressions in attributes (#43129)
This tests a scenario that was failing in an internal project.

PR Close #43129
2021-08-16 13:07:25 -07:00
Pete Bacon Darwin 1e811df79f test(compiler): check that the parser supports prematurely terminated interpolations (#43129)
Such interpolations turned up during internal testing at Google, so this
commit adds a test to prevent regressions.

PR Close #43129
2021-08-16 13:07:24 -07:00
Pete Bacon Darwin a701c10b77 refactor(compiler): use === rather than == in the ml_parser (#43129)
This is a simple tidy up commit to move to the more specific `===`
comparison operator in the HTML lexer/parser.

PR Close #43129
2021-08-16 13:07:24 -07:00
Pete Bacon Darwin 510931a7ab refactor(compiler): share isQuote() via chars.ts (#43129)
This function is general purpose and by moving it into the
`chars.ts` file along with similar helpers, it can be reused
in the lexer, for instance.

PR Close #43129
2021-08-16 13:07:24 -07:00
Pete Bacon Darwin 92fa1a6cc0 refactor(compiler): remove cyclic dependencies (#43129)
This commit removes 9 cycles in the dependency graph of the compiler code.

PR Close #43129
2021-08-16 13:07:24 -07:00
Pete Bacon Darwin 616133c704 test(compiler-cli): clarify source-map expectations in compliance tests (#43129)
The compliance tests can check source-map segments against expectations
encoded into the expectation files. Previously, the encoding of the expected
segment was only delimited by whitespace, but this made it difficult to identify
segments that started or ended with whitespace.

Now these segment expectations are wrapped in double-quotes which makes
it easier to read and understand the expectation files.

PR Close #43129
2021-08-16 13:07:24 -07:00
Pete Bacon Darwin c792dd739a refactor(ngcc): remove unused import (#43129)
This import is not used in the file, so can be removed.

PR Close #43129
2021-08-16 13:07:24 -07:00
TIffany Davis 83fa3ee581 docs: add tmdavis to contributors (#43135)
PR Close #43135
2021-08-16 10:47:09 -07:00
Renovate Bot 304c85edd0 build: update dependency entities to v3 (#43095)
PR Close #43095
2021-08-16 10:46:28 -07:00
Edoardo Dusi 1e39e11ba0 refactor(common): change encoding function in httpparams for better performances and coding standards (#42998)
HttpParams uses custom encoding function "standardEncoding" to encode query string preserving specific charachters. This refactoring aims to improve performances and code quality of that function by using a RegExp and a Map object instead of a chain of replace functions.

PR Close #42998
2021-08-16 10:44:53 -07:00
Aristeidis Bampakos e0a8ca7eee docs: update Aristeidis bio in GDE list (#43164)
PR Close #43164
2021-08-16 09:39:06 -07:00
Andrew Scott 6449590ec8 fix(router): eagerly update internal state on browser-triggered navigations (#43102)
The management of `browserUrlTree` currently has several problems with
correctly tracking the actual state of the browser.

This change makes the Router eagerly update the `browserUrlTree` when
handling navigations triggered by browser events (i.e., not 'imperative'). This
is because with those types of navigations, the browser URL bar is
_already_ updated. If we do not update the internal tracking of the
`browserUrlTree`, we will be out of sync with the real URL if the
navigation is rejected.

It would be best if we could remove `browserUrlTree` completely, but doing that
would require a lot more investigation and is blocked by #27059 because
the SpyLocation used in tests does not emulate real browser behavior.

fixes #43101

PR Close #43102
2021-08-16 09:33:24 -07:00
ali 1939613f71 docs: add example for template local variable (#43137)
PR Close #43137
2021-08-16 09:24:12 -07:00
dario-piotrowicz 6d6638c1e9 refactor(compiler-cli): remove extra 'diagnostic' from readResource comment (#43147)
remove the extra 'diagnostic' present in the comment for the
ResourceHost's readResource method

PR Close #43147
2021-08-16 09:23:40 -07:00
dario-piotrowicz cda9d16838 refactor(compiler): fix lateron typo in i18n ExtractorHost (#43160)
fix typo put in the ExtractorHosts's resourceNameToFileName comment
in which "later on" is spelled "lateron"

PR Close #43160
2021-08-16 09:23:14 -07:00
Joey Perrott 19fd2f4125 ci: add breaking changes auto labeling action (#43141)
Automatically add/remove `breaking changes` label to PRs as needed based on whether
the PR contains a commit with a breaking change.

PR Close #43141
2021-08-13 14:58:46 -07:00
pichuser 7a67597d01 docs: fix description: "property decorator" (not parameter) (#43068) (#43128)
PR Close #43068

PR Close #43128
2021-08-12 15:36:59 -07:00
Andrew Scott ec0a3007c6 refactor(compiler): Remove compileUndecoratedClasses config file (#43043)
This config file was added to support g3 patches. Now that the patch is removed internally,
we can remove the file completely

PR Close #43043
2021-08-12 15:35:08 -07:00
Theoklitos Bampouris 67ae442edc docs: adjust description to code example (#43127)
Remove promise's then(...) callback from description to match the code example's async/await syntax.
PR Close #43127
2021-08-12 15:32:47 -07:00
Andrew Kushnir 9136dbd65c release: cut the v12.2.1 release (#43117) 2021-08-11 10:13:33 -07:00
Daniel Trevino 4a1d9a78fa refactor(compiler-cli): add test for BananaInBoxCheck (#42984)
Create the test package for extended_template_diagnostics and add a unit
test for the `BananaInBoxCheck`.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Daniel Trevino 0f8ae8bf7f refactor(compiler-cli): add BananaInBoxCheck to the template checks (#42984)
Add the implementation of a Template Check that ensures the correct
use of two-way binding syntax. Generates a warning when
'([foo])="bar"' is found instead of '[(foo)]="bar"'.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Daniel Trevino c42b50cfbe refactor(compiler-cli): visit inputs and outputs for elements and templates (#42984)
This commit adds to the exisiting `RecursiveVisitor` and visits inputs
and outputs for elements and templates.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Daniel Trevino a3bc29bbb2 refactor(compiler-cli): move getSourceCodeForDiagnostic to utils (#42984)
Export `getSourceCodeForDiagnostic` from `ngtsc/testing` to make it
available for other packages. This will help confirm that the source
code is correct in other tests.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Daniel Trevino 387dcc6621 refactor(compiler-cli): move typecheck test utils into its own package (#42984)
This commit moves the test utils used in the typechecking tests into its
own package. This makes them available to be used in the tests of a
different package.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Daniel Trevino 029060f2d6 refactor(compiler-cli): introduce getExtendedTemplateDiagnosticsForComponent function (#42984)
Add function to get extended template diagnostics generated by all the template checks.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Daniel Trevino a53d26847c refactor(compiler-cli): make makeTemplateDiagnostic wrapper error (#42984)
specific

This commit makes the wrapper function `makeTemplateDiagnostic` take an
ErrorCode as a type for the `ts.Diagnostic`s to be generated.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Daniel Trevino 21e2b93046 refactor(compiler-cli): introduce extended package to typecheck with it's API (#42984)
This commit introduces //packages/compiler-cli/src/ngtsc/typecheck/extended
as a container for a new phase of diagnostics generation. The API provides an
interface for new template checks to implement and generate template diagnostics.

Refs #42966

PR Close #42984
2021-08-10 15:55:50 -07:00
Tim Gates 92012ec4fd docs: Fix a few typos (#43051)
There are small typos in:
- aio/content/guide/universal.md
- aio/content/guide/upgrade.md
- aio/content/guide/workspace-config.md
- dev-infra/ng-dev.js
- integration/check-dependencies.js

Fixes:
- Should read `mergeable` rather than `mergable`.
- Should read `upgradeable` rather than `upgradable`.
- Should read `thresholds` rather than `threshholds`.
- Should read `lease` rather than `leage`.
- Should read `ignore` rather than `ingore`.
- Should read `bootstrapping` rather than `bootstraping`.

PR Close #43051
2021-08-10 11:59:29 -07:00
Erik Slack 6ca81a706c docs: add angular community meetup and ngxp to community resources (#43103)
Invite people to get more involved with Angular's community via these

PR Close #43103
2021-08-10 11:56:22 -07:00
Amadou Sall 0baabcb7da docs: remove the mention of Stylus (#43013)
Stylus is not supported anymore by Angular, so it should be removed from the Angular docs

PR Close #43013
2021-08-10 11:55:35 -07:00
Andrew Kushnir dc6cb5a3d4 Revert "build(dev-infra): exlude commit message filter from formatting (#43091)" (#43105)
This reverts commit 7da3570be8.

The reason for the revert is the breakage of the merge tooling (`dev-infra/commit-message-filter.js: No such file or directory`).

PR Close #43105
2021-08-10 11:49:42 -07:00
Vugar_Abdullayev 7da3570be8 build(dev-infra): exlude commit message filter from formatting (#43091)
exlude commit-message-filter.js from clang format and tslint

PR Close #43091
2021-08-10 10:44:35 -07:00
Andrew Kushnir ec192b2b71 refactor(core): replace references to goog.LOCALE with goog.getLocale() (#43089)
It is necessary in order to distinguish 2 different reasons for referencing the compiled-in locale.

1. Some code just needs to pass the locale value on to logic that actually uses it.
2. Other code uses the locale value to select locale-specific user-visible data and behavior.

Code modified by this change is of the first kind and should use `goog.getLocale()` in the future.

Note: there are still references to the `goog.LOCALE` in Angular codebase, but they are of second type.

PR Close #43089
2021-08-10 10:35:26 -07:00
George Kalpakas 55fe2c667d build(docs-infra): upgrade cli command docs sources to 7c2d76d9e (#43094)
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/18b20d67b...7c2d76d9e):

**Modified**
- help/generate.json

PR Close #43094
2021-08-10 10:34:17 -07:00
George Kalpakas 8a3d2aad30 fix(docs-infra): correctly detect chunk load errors (#43088)
It seems that at some point (potentially with the switch to Webpack 5)
Webpack started using the full chunk name (instead of just a numeric
identifier) in `ChunkLoadError` messages. So the error messages changed
from:
```
ChunkLoadError: Loading chunk 2 failed.
```

...to:
```
ChunkLoadError: Loading chunk src_app_something_some_module_ts failed.
```

This commit updates the regex that is used to detect such errors (in
order to print ServiceWorker-related debug info) to correctly recognize
the new error message format.

PR Close #43088
2021-08-09 12:25:42 -07:00
Andrew Scott dd3abdb9d9 fix(router): ensure check for match options is compatible with property renaming (#43086)
After renaming, 'paths' is not in routerLinkOptions since it's been renamed.

PR Close #43086
2021-08-09 10:26:07 -07:00
Jeroen van Warmerdam d93427b806 docs: fix cli link (#43085)
PR Close #43085
2021-08-09 09:41:41 -07:00
George Kalpakas 032e65c895 build(docs-infra): update docs examples to Angular v12.1.3 (#42949)
This commit updates the docs examples to Angular v12.1.3. In addition to
updating the dependencies versions, it also updates the projects'
structure and configs to more closely match what a new v12 CLI app would
look like. See, also, the [diff][1] between a basic v11.2.11 CLI app and
a v12.1.3 one.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/11.2.11..12.1.3

PR Close #42949
2021-08-09 09:41:01 -07:00
George Kalpakas ee05a285f9 docs: fix typo in Compiler Options guide (#42949)
PR Close #42949
2021-08-09 09:41:01 -07:00
Joey Perrott 4371ff9092 fix(dev-infra): search since HEAD on the local branch for version tags when creating stamps (#43065)
Using `HEAD~100` was errantly left in the snapshot stamping logic.

PR Close #43065
2021-08-06 08:54:22 -07:00
Joey Perrott a26b0dcc72 ci: stop publishing snapshots to angular/dev-infra-private-builds (#43059)
We no longer publish to angular/dev-infra-private-builds as the dev-infra
content has been moved to angular/dev-infra.

PR Close #43059
2021-08-05 16:05:03 -07:00
Fabien BERNARD 30c5b9c144 docs: fix interval type in the example (#43042)
`window.setInterval` returns a `number`, let's fix this example.

PR Close #43042
2021-08-05 15:33:14 -07:00
George Kalpakas 673f7a7954 build(docs-infra): upgrade cli command docs sources to 18b20d67b (#43026)
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/a57976b98...18b20d67b):

**Modified**
- help/e2e.json

PR Close #43026
2021-08-04 12:10:46 -07:00
Andrew Scott cdc8c7cad0 release: cut the v12.2.0 release (#43047) 2021-08-04 10:24:49 -07:00
Kristiyan Kostadinov bd7f0d8b70 fix(core): incorrect error reported when trying to re-create view which had an error during creation (#43005)
Currently if a view throws an error during creation mode, we mark it as `incompleteFirstPass` so that we can try to recover later. The recovery is only possible inside component views.

The problem is that when this was introduced, I forgot to flip the `firstCreatePass` when an error is thrown which meant that calling `renderView` on the same component again is allowed. It will eventually hit an assertion which can be confusing for the end user. This issue only manifests itself when rendering views "manually" through `ViewContainerRef` (e.g. using `NgIf`).

These changes flip the `firstCreatePass` back to false on errors so that trying to re-render the same view will throw an error which is consistent to the one that broke the view during creation.

Fixes #41383.

PR Close #43005
2021-08-04 08:58:29 -07:00
atscott 3a9ce61ea4 Revert "refactor(ngcc): remove unused import (#42062)" (#43033)
This reverts commit 42265cca1c.

PR Close #43033
2021-08-03 15:39:00 -07:00
atscott ae98b24eb7 Revert "test(compiler-cli): clarify source-map expectations in compliance tests (#42062)" (#43033)
This reverts commit 29f9888a98.

PR Close #43033
2021-08-03 15:39:00 -07:00
atscott 4997a3f692 Revert "refactor(compiler): remove cyclic dependencies (#42062)" (#43033)
This reverts commit 75855196e3.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott 6a59e6b009 Revert "refactor(compiler): support interpolation tokens when lexing markup (#42062)" (#43033)
This reverts commit c8a46bfdcd.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott 6f80c55dbd Revert "refactor(compiler): share isQuote() via chars.ts (#42062)" (#43033)
This reverts commit 3d3b69ff81.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott 07846e550c Revert "refactor(compiler): support interpolation tokens when lexing attribute values (#42062)" (#43033)
This reverts commit c516e252fc.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott f18131f372 Revert "refactor(compiler): support encoded entity tokens when lexing markup (#42062)" (#43033)
This reverts commit 942b24d5ea.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott f24b94f5d9 Revert "refactor(compiler): expose token parts in Text nodes (#42062)" (#43033)
This reverts commit 8a54896a91.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott 6caafc2062 Revert "test(compiler): check fullStart source-span (#42062)" (#43033)
This reverts commit 973f9b8d19.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott f883aaeb89 Revert "fix(compiler): include leading whitespace in source-spans of i18n messages (#42062)" (#43033)
This reverts commit f08516db09.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott 2215af252c Revert "refactor(compiler): define interfaces for each lexer token (#42062)" (#43033)
This reverts commit 9b3d4f5575.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott db4147b4d2 Revert "test(compiler): check that the parser supports prematurely terminated interpolations (#42062)" (#43033)
This reverts commit 11ebe21d0d.

PR Close #43033
2021-08-03 15:38:59 -07:00
atscott 2dc6efed4e Revert "refactor(compiler): use === rather than == in the ml_parser (#42062)" (#43033)
This reverts commit 28b0c45fde.

PR Close #43033
2021-08-03 15:38:58 -07:00
atscott 1d307bc5bf Revert "test(compiler): add a test for parsing multiline expressions in attributes (#42062)" (#43033)
This reverts commit fe12651580.

PR Close #43033
2021-08-03 15:38:58 -07:00
ivanwonder aace1e71d8 fix(language-service): global autocomplete doesn't work when the user tries to modify the symbol (#42923)
When the user tries to trigger suggestions from an interruption,
the LS should provide the global completions. For example,
`[input]="t¦"`, the `t` can be the `true` or the symbol from
the component context.

PR Close #42923
2021-08-02 17:08:30 -07:00
dario-piotrowicz fbfec946a7 docs: amend links in content-projection guide (#43009)
PR Close #43009
2021-08-02 15:36:52 -07:00
Kristiyan Kostadinov 0e47334db8 refactor(core): update peerDependencies to allow rxjs7 (#42991)
We can't update the framework to rxjs7 until version 13, because it contains breaking changes, but we can allow users to opt into it since all of our code should be compatible.

These changes expand the allowed version range of rxjs and add an integration test to verify that we don't get compilation errors. Note that we also have a test that runs the AIO examples against rxjs 7 already (#42660).

Fixes #41897.

PR Close #42991
2021-08-02 13:55:01 -07:00
Pete Bacon Darwin e4f62c12f5 test(compiler): add a test for parsing multiline expressions in attributes (#42062)
This tests a scenario that was failing in an internal project.

PR Close #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin ea3a14805e refactor(compiler): use === rather than == in the ml_parser (#42062)
This is a simple tidy up commit to move to the more specific `===`
comparison operator in the HTML lexer/parser.

PR Close #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin a96f9c91a2 test(compiler): check that the parser supports prematurely terminated interpolations (#42062)
Such interpolations turned up during internal testing at Google, so this
commit adds a test to prevent regressions.

PR Close #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin a8c0f4f1ba refactor(compiler): define interfaces for each lexer token (#42062)
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 #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin 11ef03b36f fix(compiler): include leading whitespace in source-spans of i18n messages (#42062)
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 #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin 8e798effe4 test(compiler): check fullStart source-span (#42062)
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 #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin 54f73530a8 refactor(compiler): expose token parts in Text nodes (#42062)
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 #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin 61080ea4bc refactor(compiler): support encoded entity tokens when lexing markup (#42062)
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 #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin 4116d5d18f refactor(compiler): support interpolation tokens when lexing attribute values (#42062)
The lexer now splits interpolation tokens out from attribute value tokens.
Previously the attribute value of `<div attr="Hello, {{ name}}">` would be a single
token. Now it will be three tokens:

```
ATTR_VALUE_TEXT: "Hello, "
ATTR_VALUE_INTERPOLATION: "{{", " name", "}}"
ATTR_VALUE_TEXT: ""
```

- ATTR_VALUE_INTERPOLATION tokens have three parts, "start marker",
  "expression" and "end marker".
- ATTR_VALUE_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 #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin 5572278826 refactor(compiler): share isQuote() via chars.ts (#42062)
This function is general purpose and by moving it into the
`chars.ts` file along with similar helpers, it can be reused
in the lexer, for instance.

PR Close #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin b442c4991d refactor(compiler): support interpolation tokens when lexing markup (#42062)
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 #42062
2021-08-02 09:53:18 -07:00
Pete Bacon Darwin 014763e42c refactor(compiler): remove cyclic dependencies (#42062)
This commit removes 9 cycles in the dependency graph of the compiler code.

PR Close #42062
2021-08-02 09:53:17 -07:00
Pete Bacon Darwin 86cfbf8c8a test(compiler-cli): clarify source-map expectations in compliance tests (#42062)
The compliance tests can check source-map segments against expectations
encoded into the expectation files. Previously, the encoding of the expected
segment was only delimited by whitespace, but this made it difficult to identify
segments that started or ended with whitespace.

Now these segment expectations are wrapped in double-quotes which makes
it easier to read and understand the expectation files.

PR Close #42062
2021-08-02 09:53:17 -07:00
Pete Bacon Darwin 3b92b4abd3 refactor(ngcc): remove unused import (#42062)
This import is not used in the file, so can be removed.

PR Close #42062
2021-08-02 09:53:17 -07:00
Alex Rickabaugh dd6e80aac5 refactor(bazel): extract function to patch fileNameToModuleName on host (#42974)
This commit extracts the patching operation that adds `fileNameToModuleName`
to the Angular compiler's `ts.CompilerHost` into a separate function, so
that it can be invoked in other compilation flows besides the one outlined
in `ngc-wrapped`. This is primarily needed for the xi18n operation in g3.

PR Close #42974
2021-07-30 09:29:45 -07:00
Alex Rickabaugh da50b9b5e7 refactor(compiler): remove unnecessary escapes (#42990)
This commit is part of a larger scale change to eliminate unnecessary
escapes in string literals, in advance of enabling stricter checks in
`ts_library` rules in g3.

PR Close #42990
2021-07-30 09:28:46 -07:00
Paul Gschwendtner 86e4b3cdf9 fix(dev-infra): browser archive rule should handle .dmg files (#42992)
We recently reworked our browser archive extraction to happen
at analysis time for better caching. This resulted in us breaking
the extraction of macOS dmg files so that Firefox is currently
not usable for local testing on macOS. We implement a similar special
logic for `.dmg` files to what has been done within the Bazel
webtesting rules.

PR Close #42992
2021-07-30 09:28:08 -07:00
Nichola Alkhouri 3fddcb5364 docs: Fix wrongly provided/Injected AnimalService (#42988)
In the logical tree example which demonstrate the use of `@SkipSelf` and  `@Host`, the provided and injected `AnimalService` are reversed.
PR Close #42988
2021-07-29 15:05:53 -07:00
Joe Martin d5cc87dc88 docs: Add josmar-crwdstffng to contributors list. (#42972)
Add josmar-crwdstffng to list in contributors.json.  Add josephmmartin
image file.

PR Close #42972
2021-07-28 15:56:02 -07:00
Joey Perrott b075721a49 fix(dev-infra): ensure that building environment stamp fails silently (#42985)
Previously when a failure occurred in part of building the environment stamp, the entire
process errored.  This should instead fail silently providing no value for the stamp.

PR Close #42985
2021-07-28 13:00:09 -07:00
Joey Perrott 3346cb6e4e release: cut the v12.2.0-rc.0 release (#42983) 2021-07-28 11:51:31 -07:00
967 changed files with 14848 additions and 36068 deletions
+5 -5
View File
@@ -114,11 +114,11 @@ build:remote --cpu=k8
build:remote --host_cpu=k8
# Toolchain and platform related flags
build:remote --crosstool_top=//dev-infra/bazel/remote-execution/cpp:cc_toolchain_suite
build:remote --extra_toolchains=//dev-infra/bazel/remote-execution/cpp:cc_toolchain
build:remote --extra_execution_platforms=//dev-infra/bazel/remote-execution:platform
build:remote --host_platform=//dev-infra/bazel/remote-execution:platform
build:remote --platforms=//dev-infra/bazel/remote-execution:platform
build:remote --crosstool_top=@npm//@angular/dev-infra-private/bazel/remote-execution/cpp:cc_toolchain_suite
build:remote --extra_toolchains=@npm//@angular/dev-infra-private/bazel/remote-execution/cpp:cc_toolchain
build:remote --extra_execution_platforms=@npm//@angular/dev-infra-private/bazel/remote-execution:platform
build:remote --host_platform=@npm//@angular/dev-infra-private/bazel/remote-execution:platform
build:remote --platforms=@npm//@angular/dev-infra-private/bazel/remote-execution:platform
# Remote instance and caching
build:remote --remote_instance_name=projects/internal-200822/instances/primary_instance
+13 -8
View File
@@ -24,15 +24,15 @@ version: 2.1
# **NOTE 2 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
# **NOTE 3 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_3: &cache_key v4-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
var_3: &cache_key v1-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
# We invalidate the cache if the Bazel version changes because otherwise the `bazelisk` cache
# folder will contain all previously used versions and ultimately cause the cache restoring to
# be slower due to its growing size.
var_4: &cache_key_fallback v4-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}
var_4: &cache_key_fallback v1-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}
# Windows needs its own cache key because binaries in node_modules are different.
var_3_win: &cache_key_win v4-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
var_4_win: &cache_key_win_fallback v4-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}
var_3_win: &cache_key_win v1-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
var_4_win: &cache_key_win_fallback v1-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}
# Cache key for the `components-repo-unit-tests` job. **Note** when updating the SHA in the
# cache keys also update the SHA for the "COMPONENTS_REPO_COMMIT" environment variable.
@@ -213,6 +213,10 @@ commands:
keys:
- *cache_key_win
- *cache_key_win_fallback
# Install @bazel/bazelisk globally and use that for the first run.
# Workaround for https://github.com/bazelbuild/rules_nodejs/issues/894
# NB: the issue was for @bazel/bazel but the same problem applies to @bazel/bazelisk
- run: yarn global add @bazel/bazelisk@$env:BAZELISK_VERSION
# On Windows `~/` is not resolved when using as a CLI value. `../` results in the same path.
- run: yarn install --frozen-lockfile --non-interactive --cache-folder ../.cache/yarn
@@ -291,6 +295,7 @@ jobs:
- run: yarn -s ng-dev pullapprove verify
- run: yarn -s ng-dev ngbot verify
- run: yarn -s ng-dev commit-message validate-range $CI_GIT_BASE_REVISION $CI_GIT_REVISION
- run: yarn -s check-tooling-setup
test:
executor:
@@ -798,11 +803,11 @@ jobs:
- setup_win
- run:
name: Build all windows CI targets
command: yarn bazel build --build_tag_filters=-ivy-only //packages/compiler-cli/...
command: bazel build --build_tag_filters=-ivy-only //packages/compiler-cli/...
no_output_timeout: 15m
- run:
name: Test all windows CI targets
command: yarn bazel test --test_tag_filters="-ivy-only,-browser:chromium-local" //packages/compiler-cli/...
command: bazel test --test_tag_filters="-ivy-only,-browser:chromium-local" //packages/compiler-cli/...
no_output_timeout: 15m
test_ivy_aot_win:
@@ -811,11 +816,11 @@ jobs:
- setup_win
- run:
name: Build all windows CI targets
command: yarn bazel build --config=ivy --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot //packages/compiler-cli/...
command: bazel build --config=ivy --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot //packages/compiler-cli/...
no_output_timeout: 15m
- run:
name: Test all windows CI targets
command: yarn bazel test --config=ivy --test_tag_filters="-no-ivy-aot,-fixme-ivy-aot,-browser:chromium-local" //packages/compiler-cli/... //packages/localize/...
command: bazel test --config=ivy --test_tag_filters="-no-ivy-aot,-fixme-ivy-aot,-browser:chromium-local" //packages/compiler-cli/... //packages/localize/...
no_output_timeout: 15m
# Save dependencies to use on subsequent runs.
- save_cache:
+1
View File
@@ -12,6 +12,7 @@ body:
- common
- compiler-cli
- compiler
- core
- elements
- forms
- language-service
@@ -12,6 +12,7 @@ body:
- common
- compiler-cli
- compiler
- core
- elements
- forms
- language-service
-1
View File
@@ -38,7 +38,6 @@ merge:
- 'modules/benchmarks/**'
- 'modules/system.d.ts'
- 'packages/**'
- 'dev-infra/benchmark/driver-utilities/**'
# list of patterns to ignore for the files changed by the PR
exclude:
- 'packages/*'
+14
View File
@@ -0,0 +1,14 @@
name: DevInfra
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
breaking-changes-label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: angular/dev-infra/github-actions/breaking-changes-label@861dc90572784e714aeaa9dfb20ceebeb57cdb07
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
+1 -2
View File
@@ -106,8 +106,7 @@ Fixes #<issue number>
# │ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
# │ elements|forms|http|language-service|localize|platform-browser|
# │ platform-browser-dynamic|platform-server|router|service-worker|
# │ upgrade|zone.js|packaging|changelog|dev-infra|docs-infra|migrations|
# │ ngcc|ve
# │ upgrade|zone.js|packaging|changelog|docs-infra|migrations|ngcc|ve
# │ https://github.com/angular/angular/blob/master/CONTRIBUTING.md#scope
# │
# └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test
+1 -1
View File
@@ -1,4 +1,4 @@
import {CaretakerConfig} from '../dev-infra/caretaker/config';
import {CaretakerConfig} from '@angular/dev-infra-private/ng-dev/caretaker/config';
/** The configuration for `ng-dev caretaker` commands. */
export const caretaker: CaretakerConfig = {
+1 -1
View File
@@ -1,4 +1,4 @@
import {CommitMessageConfig} from '../dev-infra/commit-message/config';
import {CommitMessageConfig} from '@angular/dev-infra-private/ng-dev/commit-message/config';
/**
* The configuration for `ng-dev commit-message` commands.
+1 -1
View File
@@ -1,4 +1,4 @@
import {FormatConfig} from '../dev-infra/format/config';
import {FormatConfig} from '@angular/dev-infra-private/ng-dev/format/config';
/**
* Configuration for the `ng-dev format` command.
+3 -3
View File
@@ -1,11 +1,11 @@
import {GithubConfig} from '../dev-infra/utils/config';
import {GithubConfig} from '@angular/dev-infra-private/ng-dev/utils/config';
/**
* Github configuration for the `ng-dev` command. This repository is used as
* remote for the merge script and other utilities like `ng-dev pr rebase`.
*/
export const github: GithubConfig = {
owner: 'angular',
name: 'angular'
name: 'angular',
mainBranchName: 'master',
};
+18 -27
View File
@@ -1,33 +1,24 @@
import {DevInfraMergeConfig} from '../dev-infra/pr/merge/config';
import {getDefaultTargetLabelConfiguration} from '../dev-infra/pr/merge/defaults';
import {github} from './github';
import {release} from './release';
import {MergeConfig} from '@angular/dev-infra-private/ng-dev/pr/merge/config';
/**
* Configuration for the merge tool in `ng-dev`. This sets up the labels which
* are respected by the merge script (e.g. the target labels).
*/
export const merge: DevInfraMergeConfig['merge'] = async api => {
return {
githubApiMerge: false,
claSignedLabel: 'cla: yes',
mergeReadyLabel: /^action: merge(-assistance)?/,
caretakerNoteLabel: /^(action: merge-assistance)|(PullApprove: disable)/,
commitMessageFixupLabel: 'commit message fixup',
breakingChangeLabel: 'flag: breaking change',
// We can pick any of the NPM packages as we are in a monorepo where all packages are
// published together with the same version and branching.
labels: await getDefaultTargetLabelConfiguration(api, github, release),
requiredBaseCommits: {
// PRs that target either `master` or the patch branch, need to be rebased
// on top of the latest commit message validation fix.
// These SHAs are the commits that update the required license text in the header.
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
'10.0.x': '27b95ba64a5d99757f4042073fd1860e20e3ed24',
},
// `dev-infra` and `docs-infra` are not affecting the public NPM packages. Similarly,
// the `bazel` package is not considered part of the public API so that features
// can land in patch branches.
targetLabelExemptScopes: ['dev-infra', 'docs-infra', 'bazel']
};
export const merge: MergeConfig = {
githubApiMerge: false,
claSignedLabel: 'cla: yes',
mergeReadyLabel: /^action: merge(-assistance)?/,
caretakerNoteLabel: /^(action: merge-assistance)|(PullApprove: disable)/,
commitMessageFixupLabel: 'commit message fixup',
requiredBaseCommits: {
// PRs that target either `master` or the patch branch, need to be rebased
// on top of the latest commit message validation fix.
// These SHAs are the commits that update the required license text in the header.
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
'10.0.x': '27b95ba64a5d99757f4042073fd1860e20e3ed24',
},
// `dev-infra` and `docs-infra` are not affecting the public NPM packages. Similarly,
// the `bazel` package is not considered part of the public API so that features
// can land in patch branches.
targetLabelExemptScopes: ['dev-infra', 'docs-infra', 'bazel']
};
+2 -2
View File
@@ -1,5 +1,5 @@
import {ReleaseConfig} from '@angular/dev-infra-private/ng-dev/release/config';
import {join} from 'path';
import {ReleaseConfig} from '../dev-infra/release/config';
/** Configuration for the `ng-dev release` command. */
export const release: ReleaseConfig = {
@@ -22,7 +22,7 @@ export const release: ReleaseConfig = {
'@angular/service-worker',
'@angular/upgrade',
],
buildPackages: async (stampForRelease: boolean) => {
buildPackages: async (stampForRelease: boolean|undefined) => {
// The buildTargetPackages function is loaded at runtime as the loading the script causes an
// invocation of bazel.
const {buildTargetPackages} = require(join(__dirname, '../scripts/build/package-builder'));
+10
View File
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"strict": true,
"target": "es2015",
"module": "commonjs",
"noEmit": true,
"skipLibCheck": true,
"types": []
},
}
+20 -8
View File
@@ -190,7 +190,6 @@ groups:
- JiaLiPassion # Jia Li
- JoostK # Joost Koehoorn
- josephperrott # Joey Perrott
- kyliau # Keen Yee Liau
- manughub # Manu Murthy
- mgechev # Minko Gechev
- mmalerba # Miles Malerba
@@ -238,6 +237,7 @@ groups:
contains_any_globs(files.exclude('packages/compiler-cli/ngcc/**'), [
'packages/compiler/**',
'packages/examples/compiler/**',
'aio/content/examples/angular-compiler-options/**',
'packages/compiler-cli/**',
'aio/content/guide/angular-compiler-options.md',
'aio/content/guide/aot-compiler.md',
@@ -543,7 +543,20 @@ groups:
'packages/compiler/src/render3/view/i18n/**',
'packages/compiler-cli/src/extract_i18n.ts',
'packages/localize/**',
'aio/content/guide/i18n.md',
'aio/content/guide/i18n-overview.md',
'aio/content/guide/i18n-common.md',
'aio/content/guide/i18n-common-add-package.md',
'aio/content/guide/i18n-common-locale-id.md',
'aio/content/guide/i18n-common-format-data-locale.md',
'aio/content/guide/i18n-common-prepare.md',
'aio/content/guide/i18n-common-translation-files.md',
'aio/content/guide/i18n-common-merge.md',
'aio/content/guide/i18n-common-deploy.md',
'aio/content/guide/i18n-example.md',
'aio/content/guide/i18n-optional.md',
'aio/content/guide/i18n-optional-manual-source-locale.md',
'aio/content/guide/i18n-optional-import-global-variants.md',
'aio/content/guide/i18n-optional-manage-marked-text.md',
'aio/content/examples/i18n/**'
])
reviewers:
@@ -570,7 +583,6 @@ groups:
users:
- alan-agius4
- alxhub
- kyliau
# =========================================================
# Framework: Router
@@ -763,7 +775,6 @@ groups:
users:
- IgorMinar
- josephperrott
- kyliau
# =========================================================
# Language Service
@@ -781,7 +792,6 @@ groups:
])
reviewers:
users:
- kyliau
- atscott
- zarend
@@ -1021,7 +1031,7 @@ groups:
users:
- alan-agius4
- clydin
- kyliau
- dgp1130
- IgorMinar
reviews:
request: -1 # request reviews from everyone
@@ -1128,6 +1138,8 @@ groups:
'aio/content/guide/docs-style-guide.md',
'aio/content/examples/docs-style-guide/**',
'aio/content/images/guide/docs-style-guide/**',
'aio/content/guide/localized-documentation.md',
'aio/content/guide/localizing-angular.md',
'aio/content/guide/reviewing-content.md',
'aio/content/guide/updating-content-github-ui.md',
'aio/content/guide/updating-search-keywords.md',
@@ -1155,10 +1167,10 @@ groups:
'.ng-dev/**',
'.vscode/**',
'.yarn/**',
'dev-infra/**',
'docs/*.md',
'docs/images/**',
'goldens/*',
'goldens/public-api/manage.js',
'modules/*',
'packages/*',
'packages/examples/test-utils/**',
@@ -1202,7 +1214,7 @@ groups:
- *no-groups-above-this-rejected
- *can-be-global-approved
- >
contains_any_globs(files, [
contains_any_globs(files.exclude("goldens/public-api/manage.js"), [
'goldens/public-api/**',
'docs/NAMING.md',
'aio/content/errors/*.md',
+2 -2
View File
@@ -6,7 +6,7 @@ This folder contains opt-in [Workspace Settings](https://code.visualstudio.com/d
To use the recommended configurations follow the steps below:
- install the recommneded extensions in `.vscode/extensions.json`
- install the recommended extensions in `.vscode/extensions.json`
- copy (or link) `.vscode/recommended-settings.json` to `.vscode/settings.json`
- copy (or link) `.vscode/recommended-launch.json` to `.vscode/launch.json`
- copy (or link) `.vscode/recommended-tasks.json` to `.vscode/tasks.json`
@@ -22,4 +22,4 @@ To see the recommended extensions select "Extensions: Show Recommended Extension
If you wish to add extra configuration items please keep in mind any modifications you make here will be used by many users.
Try to keep these settings/configuations to things that help facilitate the development process and avoid altering the user workflow whenever possible.
Try to keep these settings/configurations to things that help facilitate the development process and avoid altering the user workflow whenever possible.
+187 -1
View File
@@ -1,3 +1,189 @@
<a name="12.2.9"></a>
# 12.2.9 (2021-10-06)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [b4b441077a](https://github.com/angular/angular/commit/b4b441077ad3a2991e7c04beb288bee1945a83bd) | fix | handle invalid constructor parameters in partial factory declarations ([#43619](https://github.com/angular/angular/pull/43619)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [7f6050587d](https://github.com/angular/angular/commit/7f6050587deb4796b6a0cc93445fab9e6b7ff826) | fix | unset attachRef when router-outlet is destroyed to avoid mounting a destroyed component ([#43697](https://github.com/angular/angular/pull/43697)) |
### service-worker
| Commit | Type | Description |
| -- | -- | -- |
| [c4ecc07838](https://github.com/angular/angular/commit/c4ecc07838de5149a360b11de1c8c4ef18b1fe77) | fix | make `ngsw.json` generation deterministic and correct ([#43679](https://github.com/angular/angular/pull/43679)) |
## Special Thanks
Alan Agius, Daniel Díaz, George Kalpakas, JoostK, Kristiyan Kostadinov, Pete Bacon Darwin, Wey-Han Liaw, dario-piotrowicz, iRealNirmal, little-pinecone, mgechev, ultrasonicsoft and xiaohanxu-nick
<!-- CHANGELOG SPLIT MARKER -->
<a name="12.2.8"></a>
# 12.2.8 (2021-09-30)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [c1338bf837](https://github.com/angular/angular/commit/c1338bf837c7fe2bfb10974bd08d1ad013aaebbc) | fix | correctly interpret token arrays in @Injectable `deps` ([#43226](https://github.com/angular/angular/pull/43226)) |
### ngcc
| Commit | Type | Description |
| -- | -- | -- |
| [69299f7d4d](https://github.com/angular/angular/commit/69299f7d4d595141dae7a63e4faa35691a2d8887) | fix | do not fail for packages which correspond with `Object` members ([#43589](https://github.com/angular/angular/pull/43589)) |
### service-worker
| Commit | Type | Description |
| -- | -- | -- |
| [3cf41354ae](https://github.com/angular/angular/commit/3cf41354ae6bf988a9477379e0b28afaa6d7ce5b) | fix | do not unassign clients from a broken version ([#43518](https://github.com/angular/angular/pull/43518)) |
## Special Thanks
Adrien Crivelli, Alex Rickabaugh, Andrew Scott, Bobby Galli, Chris, Daniel Díaz, Dario Piotrowicz, George Kalpakas, Joe Martin (Crowdstaffing), JoostK, Pete Bacon Darwin, Rafael Santana, Raj Sekhar, Ricardo Chavarria, Teri Glover, Virginia Dooley, dario-piotrowicz, enisfr and wszgrcy
<a name="12.2.7"></a>
# 12.2.7 (2021-09-22)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [2bb4bf1468](https://github.com/angular/angular/commit/2bb4bf1468935a49a3d478d0cc13e7eb7fd1b98a) | fix | titlecase pipe incorrectly handling numbers ([#43476](https://github.com/angular/angular/pull/43476)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [9c8a1f8a71](https://github.com/angular/angular/commit/9c8a1f8a71be9b8380afbdc61ee7ee60f24488b4) | fix | include leading whitespace in source-spans of i18n messages ([#43132](https://github.com/angular/angular/pull/43132)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [defb02f11e](https://github.com/angular/angular/commit/defb02f11e2bd75452e8722e1474bb230d189864) | fix | handle directives that refer to a namespaced class in a type parameter bound ([#43511](https://github.com/angular/angular/pull/43511)) |
### platform-browser
| Commit | Type | Description |
| -- | -- | -- |
| [adc7c56ede](https://github.com/angular/angular/commit/adc7c56ede7ad34a90f5ef1b878e261836b25c45) | fix | improve error message for missing animation trigger ([#41356](https://github.com/angular/angular/pull/41356)) |
## Special Thanks
Andrew Scott, Daniel Díaz, George Kalpakas, JoostK, Kristiyan Kostadinov, Mwiku, Pete Bacon Darwin, Teri Glover, Virginia Dooley, Xiaohanxu1996, dario-piotrowicz and kirjs
<a name="12.2.6"></a>
# 12.2.6 (2021-09-15)
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [141fde1632](https://github.com/angular/angular/commit/141fde1632b4834449cfd48dcebfc8b1b7d58e09) | fix | emit pure annotations to static property initializers ([#43344](https://github.com/angular/angular/pull/43344)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [ca510c87c5](https://github.com/angular/angular/commit/ca510c87c5a890c4b22fd364c58667adef90a1e0) | fix | emit pure annotations to static property initializers ([#43344](https://github.com/angular/angular/pull/43344)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [4034f252c9](https://github.com/angular/angular/commit/4034f252c9707dabd01386843f7c278f3d2e4302) | fix | Allow renavigating to failed URLs ([#43424](https://github.com/angular/angular/pull/43424)) |
### service-worker
| Commit | Type | Description |
| -- | -- | -- |
| [a102b27641](https://github.com/angular/angular/commit/a102b27641e3ad00401dd6d2635b9ddcf1151251) | fix | clear service worker cache in safety worker ([#43324](https://github.com/angular/angular/pull/43324)) |
## Special Thanks
Alan Agius, Amadou Sall, Andrew Kushnir, Andrew Scott, Aristeidis Bampakos, Bjarki, David Shevitz, George Kalpakas, Joe Martin (Crowdstaffing), Michele Stieven, Naveed Ahmed, dario-piotrowicz, mezhik91 and mgechev
<a name="12.2.5"></a>
# 12.2.5 (2021-09-08)
### router
| Commit | Description |
| -- | -- |
| [a0bd6e90f9](https://github.com/angular/angular/commit/a0bd6e90f987377320b3b337d8c3a33235658e9a) | fix: add more context to `Unhandled Navigation Error` ([#43291](https://github.com/angular/angular/pull/43291)) |
## Special Thanks:
Alan Agius, Charles Barnes, Enea Jahollari, George Kalpakas, Ikko Ashimine, Paul Gschwendtner, Pete Bacon Darwin, William Sedlacek and dario-piotrowicz
<a name="12.2.4"></a>
# 12.2.4 (2021-09-01)
### compiler-cli
| Commit | Description |
| -- | -- |
| [8233906be2](https://github.com/angular/angular/commit/8233906be25e19da6d8115094616d3e4b5e36fea) | fix: Emit type annotations for synthesized decorator fields ([#43021](https://github.com/angular/angular/pull/43021)) |
## Special Thanks:
Andrew Scott, Daniel Trevino, George Kalpakas, Joey Perrott, Kristiyan Kostadinov, nickreid and segunb
<a name="12.2.3"></a>
# 12.2.3 (2021-08-25)
### service-worker
| Commit | Description |
| -- | -- |
| [fc7f92159d](https://github.com/angular/angular/commit/fc7f92159df16e894d9909cfc8969ed4b7d9924a) | fix: NPE if onActionClick is undefined ([#43210](https://github.com/angular/angular/pull/43210)) |
## Special Thanks:
Daniel Trevino, Erik Slack, George Kalpakas, dario-piotrowicz and shlasouski
<a name="12.2.2"></a>
# 12.2.2 (2021-08-18)
### animations
| Commit | Description |
| -- | -- |
| [bb6555979d](https://github.com/angular/angular/commit/bb6555979dd02e706f7e98022b9c37a4f54db1ba) | fix: add pure annotations to static property initializers ([#43064](https://github.com/angular/angular/pull/43064)) |
### core
| Commit | Description |
| -- | -- |
| [738b23347e](https://github.com/angular/angular/commit/738b23347e5eeadfa0321d1429537837dba5e4c1) | fix: add pure annotations to static property initializers ([#43064](https://github.com/angular/angular/pull/43064)) |
### platform-browser
| Commit | Description |
| -- | -- |
| [535837e617](https://github.com/angular/angular/commit/535837e617a0434f8e7bd9071cc4d8c27fd9f373) | perf: avoid intermediate arrays in server transition ([#43145](https://github.com/angular/angular/pull/43145)) |
### router
| Commit | Description |
| -- | -- |
| [6449590ec8](https://github.com/angular/angular/commit/6449590ec81eff0873af911fb65679b5a77db27b) | fix: eagerly update internal state on browser-triggered navigations ([#43102](https://github.com/angular/angular/pull/43102)) |
## Special Thanks:
Andrew Scott, Aristeidis Bampakos, Charles Lyding, Edoardo Dusi, George Kalpakas, Joe Martin (Crowdstaffing), Joey Perrott, Kirk Larkin, Kristiyan Kostadinov, Pete Bacon Darwin, TIffany Davis, Theoklitos Bampouris, ali, dario-piotrowicz and pichuser
<a name="12.2.1"></a>
# 12.2.1 (2021-08-11)
### router
| Commit | Description |
| -- | -- |
| [dd3abdb9d9](https://github.com/angular/angular/commit/dd3abdb9d9b2c4363fb1f468a05bf449b55f55a5) | fix(router): ensure check for match options is compatible with property renaming ([#43086](https://github.com/angular/angular/pull/43086)) |
## Special Thanks:
Amadou Sall, Andrew Kushnir, Andrew Scott, Daniel Trevino, Erik Slack, Fabien BERNARD, George Kalpakas, Jeroen van Warmerdam, Joey Perrott, Tim Gates and Vugar_Abdullayev
<a name="12.2.0"></a>
# 12.2.0 (2021-08-04)
### core
| Commit | Description |
| -- | -- |
| [bd7f0d8b70](https://github.com/angular/angular/commit/bd7f0d8b70150a7e4e7550f4380a2e731cf2b942) | fix(core): incorrect error reported when trying to re-create view which had an error during creation ([#43005](https://github.com/angular/angular/pull/43005)) |
### language-service
| Commit | Description |
| -- | -- |
| [aace1e71d8](https://github.com/angular/angular/commit/aace1e71d8fb5e1e52fcd86e2a26892d1016c43e) | fix(language-service): global autocomplete doesn't work when the user tries to modify the symbol ([#42923](https://github.com/angular/angular/pull/42923)) |
## Special Thanks:
Alex Rickabaugh, Joe Martin, Joey Perrott, Kristiyan Kostadinov, Nichola Alkhouri, Paul Gschwendtner, Pete Bacon Darwin, atscott, dario-piotrowicz and ivanwonder
<a name="12.2.0-rc.0"></a>
# 12.2.0-rc.0 (2021-07-28)
### compiler-cli
| Commit | Description |
| -- | -- |
| [ed9cfb674f](https://github.com/angular/angular/commit/ed9cfb674f8e52b416ccdaf9aa9c46955b8448f5) | fix(compiler-cli): use correct module resolution context for absolute imports in .d.ts files ([#42879](https://github.com/angular/angular/pull/42879)) |
| [5fb23eccea](https://github.com/angular/angular/commit/5fb23ecceaccf0629308dd50210b65f67d51f024) | perf(compiler-cli): skip analysis in incremental builds for files without Angular behavior ([#42562](https://github.com/angular/angular/pull/42562)) |
### core
| Commit | Description |
| -- | -- |
| [eefe1682e8](https://github.com/angular/angular/commit/eefe1682e8099b73b6e50bb227b5a7f63105c63d) | fix(core): correctly handle `null` or `undefined` in `ErrorHandler#handleError()` ([#42881](https://github.com/angular/angular/pull/42881)) |
### forms
| Commit | Description |
| -- | -- |
| [1d9d02696e](https://github.com/angular/angular/commit/1d9d02696eadbee2c2f719e432efca22f1e494e9) | feat(forms): add hasValidators, addValidators, and removeValidators methods (for both sync and async) ([#42838](https://github.com/angular/angular/pull/42838)) |
| [a502279592](https://github.com/angular/angular/commit/a50227959222f39884aac284544d1626aee5ca64) | feat(forms): allow minLength/maxLength validator to be bound to `null` ([#42565](https://github.com/angular/angular/pull/42565)) |
### language-service
| Commit | Description |
| -- | -- |
| [7c35ca0e00](https://github.com/angular/angular/commit/7c35ca0e0030f2ded12ddca9092e31f510cebeb1) | feat(language-service): support autocomplete string literal union types in templates ([#42729](https://github.com/angular/angular/pull/42729)) |
### router
| Commit | Description |
| -- | -- |
| [0d81b007e4](https://github.com/angular/angular/commit/0d81b007e48a0ac801d2614601fb8180a3517865) | fix(router): add missing outlet events to RouterOutletContract ([#42431](https://github.com/angular/angular/pull/42431)) |
| [dbae00195e](https://github.com/angular/angular/commit/dbae00195e114ac8b967201283962a7e2c0581b4) | feat(router): ability to provide custom route reuse strategy via DI for `RouterTestingModule` ([#42434](https://github.com/angular/angular/pull/42434)) |
## Special Thanks:
Andrew Scott, Daniel Trevino, Dmitrij Kuba, Dylan Hunn, George Kalpakas, Joey Perrott, JoostK, Paul Gschwendtner, Pete Bacon Darwin, Steven Masala, Teri Glover, Vladyslav, Yuvaraj, codebriefcase, iRealNirmal and ivanwonder
<a name="12.1.4"></a>
# 12.1.4 (2021-07-28)
### compiler-cli
@@ -8018,4 +8204,4 @@ Note: 2.1.0-beta.0 release also contains all the changes present in the 2.0.1 re
<a name="2.0.0"></a>
# [2.0.0 proprioception-reinforcement](https://github.com/angular/angular/compare/2.0.0-rc.7...2.0.0) (2016-09-14)
# [2.0.0 proprioception-reinforcement](https://github.com/angular/angular/compare/2.0.0-rc.7...2.0.0) (2016-09-14)
+17 -6
View File
@@ -235,8 +235,6 @@ When the body is present it must be at least 20 characters long and must conform
The `footer` is optional. The [Commit Message Footer](#commit-footer) format describes what the footer is used for and the structure it must have.
Any line of the commit message cannot be longer than 100 characters.
#### <a name="commit-header"></a>Commit Message Header
@@ -248,8 +246,7 @@ Any line of the commit message cannot be longer than 100 characters.
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
│ elements|forms|http|language-service|localize|platform-browser|
│ platform-browser-dynamic|platform-server|router|service-worker|
│ upgrade|zone.js|packaging|changelog|dev-infra|docs-infra|migrations|
│ ngcc|ve
│ upgrade|zone.js|packaging|changelog|docs-infra|migrations|ngcc|ve
│
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
```
@@ -302,7 +299,7 @@ There are currently a few exceptions to the "use package name" rule:
* `changelog`: used for updating the release notes in CHANGELOG.md
* `dev-infra`: used for dev-infra related changes within the directories /scripts, /tools and /dev-infra
* `dev-infra`: used for dev-infra related changes within the directories /scripts and /tools
* `docs-infra`: used for docs-app (angular.io) related changes within the /aio directory of the repo
@@ -334,7 +331,8 @@ You can include a comparison of the previous behavior with the new behavior in o
#### <a name="commit-footer"></a>Commit Message Footer
The footer can contain information about breaking changes and is also the place to reference GitHub issues, Jira tickets, and other PRs that this commit closes or is related to.
The footer can contain information about breaking changes and deprecations and is also the place to reference GitHub issues, Jira tickets, and other PRs that this commit closes or is related to.
For example:
```
BREAKING CHANGE: <breaking change summary>
@@ -345,8 +343,21 @@ BREAKING CHANGE: <breaking change summary>
Fixes #<issue number>
```
or
```
DEPRECATED: <what is deprecated>
<BLANK LINE>
<deprecation description + recommended update path>
<BLANK LINE>
<BLANK LINE>
Closes #<pr number>
```
Breaking Change section should start with the phrase "BREAKING CHANGE: " followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
Similarly, a Deprecation section should start with "DEPRECATED: " followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.
### Revert commits
+3 -3
View File
@@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Fetch rules_nodejs so we can install our npm dependencies
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "4681ca88d512d57196d064d1441549080d8d17d119174a1229d1717a16a4a489",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.0.0-beta.1/rules_nodejs-4.0.0-beta.1.tar.gz"],
sha256 = "8a7c981217239085f78acc9898a1f7ba99af887c1996ceb3b4504655383a2c3c",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.0.0/rules_nodejs-4.0.0.tar.gz"],
)
# Check the rules_nodejs version and download npm dependencies
@@ -44,7 +44,7 @@ load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories"
web_test_repositories()
load("//dev-infra/bazel/browsers:browser_repositories.bzl", "browser_repositories")
load("@npm//@angular/dev-infra-private/bazel/browsers:browser_repositories.bzl", "browser_repositories")
browser_repositories()
+1
View File
@@ -27,6 +27,7 @@
"style": "kebab-case"
}
],
"max-len": ["error" , 120],
"@angular-eslint/directive-selector": [
"error",
{
+5
View File
@@ -138,6 +138,11 @@
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"headers": {
"Content-Security-Policy": "require-trusted-types-for 'script'; trusted-types angular angular#bundler angular#unsafe-bypass aio#analytics google#safe"
}
},
"configurations": {
"next": {
"browserTarget": "site:build:next"
+5
View File
@@ -56,6 +56,7 @@ dist/
!systemjs.config.*.js
!karma-test-shim.*.js
!copy-dist-files.js
!i18n/angular.json
# AngularJS files
!**/*.ajs.js
@@ -98,3 +99,7 @@ upgrade-phonecat-3-final/rollup-config.js
# schematics
!schematics-for-libraries/projects/my-lib/package.json
#angular-compiler-options
!angular-compiler-options/tsconfig.json
!angular-compiler-options/tsconfig.app.json
View File
@@ -0,0 +1,20 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
// Add your e2e tests here
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
@@ -0,0 +1,19 @@
{
"projectType": "cli",
"overrideBoilerplate": [
"tsconfig.json",
"tsconfig.app.json"
],
"tests": [
{
"cmd": "yarn",
"args": [
"e2e",
"--protractor-config=e2e/protractor-puppeteer.conf.js",
"--no-webdriver-update",
"--port={PORT}"
]
}
]
}
@@ -0,0 +1 @@
<h1>Replace the src folder in this {{title}} with yours.</h1>
@@ -0,0 +1,20 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
// Add your unit tests here
});
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'example';
}
@@ -0,0 +1,16 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ponyracer</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
@@ -0,0 +1,12 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
@@ -0,0 +1,18 @@
{
"description": "Angular Compiler Options",
"files": [
"!**/*.d.ts",
"!**/*.js",
"!**/*.[1,2].*",
"!doc-files/**/*",
"!tsconfig.json",
"!tsconfig.app.json"
],
"tags": [
[
"angular",
"compiler",
"options"
]
]
}
@@ -0,0 +1,45 @@
// #docplaster ...
/* To learn more about this file see: https://angular.io/config/tsconfig. */
// #docregion angular-compiler-options-app
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
// #enddocregion angular-compiler-options-app
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts",
"src/**/*-specs.ts",
"src/**/*.avoid.ts",
"src/**/*.0.ts",
"src/**/*.1.ts",
"src/**/*.1b.ts",
"src/**/*.2.ts",
"src/**/*.3.ts",
"src/**/*.4.ts",
"src/**/*.5.ts",
"src/**/*.6.ts",
"src/**/*.7.ts",
"src/**/testing"
],
// #docregion angular-compiler-options-app
"angularCompilerOptions": {
"strictTemplates": true,
"preserveWhitespaces": true,
// #enddocregion angular-compiler-options-app
"sourceMap": true,
"declaration": false
// #docregion angular-compiler-options-app
},
}
// #enddocregion angular-compiler-options-app
@@ -0,0 +1,37 @@
// #docplaster ...
/* To learn more about this file see: https://angular.io/config/tsconfig. */
// #docregion angular-compiler-options
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
// #enddocregion angular-compiler-options
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2018",
"dom"
]
// #docregion angular-compiler-options
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
// #enddocregion angular-compiler-options
"strictInputAccessModifiers": true,
"strictTemplates": true
// #docregion angular-compiler-options
}
}
// #enddocregion angular-compiler-options
@@ -205,8 +205,8 @@ describe('Animation Tests', () => {
const heroesList = filterStagger.getHeroesList();
const total = await heroesList.count();
const formInput = filterStagger.getFormInput();
await formInput.sendKeys('Mag');
const input = filterStagger.getInput();
await input.sendKeys('Mag');
await browser.wait(async () => await heroesList.count() === 2, 2000);
@@ -14,7 +14,7 @@ export function getHeroesList() {
return getComponentContainer().all(by.css('li'));
}
export function getFormInput() {
const formInput = () => by.css('form > input');
return locate(getPage(), formInput());
export function getInput() {
const input = () => by.css('input');
return locate(getPage(), input());
}
@@ -3,7 +3,7 @@ import {
transition, animate, style, query
} from '@angular/animations';
export const transAnimation = animation([
export const transitionAnimation = animation([
style({
height: '{{ height }}',
opacity: '{{ opacity }}',
@@ -23,7 +23,9 @@ import { slideInAnimation } from './animations';
// #enddocregion decorator
slideInAnimation
// #docregion decorator
// #enddocregion toggle-app-animations, define
// animation triggers go here
// #docregion toggle-app-animations, define
]
})
// #enddocregion decorator, define
@@ -34,7 +36,7 @@ export class AppComponent {
// #docregion prepare-router-outlet
prepareRoute(outlet: RouterOutlet) {
return outlet && outlet.activatedRouteData && outlet.activatedRouteData.animation;
return outlet?.activatedRouteData?.animation;
}
// #enddocregion prepare-router-outlet
@@ -31,14 +31,14 @@ import { InsertRemoveComponent } from './insert-remove.component';
{ path: 'open-close', component: OpenClosePageComponent },
{ path: 'status', component: StatusSliderPageComponent },
{ path: 'toggle', component: ToggleAnimationsPageComponent },
{ path: 'heroes', component: HeroListPageComponent, data: {animation: 'FilterPage'} },
{ path: 'heroes', component: HeroListPageComponent,
data: { animation: 'FilterPage' } },
{ path: 'hero-groups', component: HeroListGroupPageComponent },
{ path: 'enter-leave', component: HeroListEnterLeavePageComponent },
{ path: 'auto', component: HeroListAutoCalcPageComponent },
{ path: 'insert-remove', component: InsertRemoveComponent},
{ path: 'home', component: HomeComponent, data: {animation: 'HomePage'} },
{ path: 'about', component: AboutComponent, data: {animation: 'AboutPage'} },
{ path: 'home', component: HomeComponent, data: { animation: 'HomePage' } },
{ path: 'about', component: AboutComponent, data: { animation: 'AboutPage' } },
])
],
// #enddocregion route-animation-data
@@ -36,7 +36,7 @@ import { Hero } from './hero';
width: 120,
transform: 'translateX(0)', opacity: 1
})),
transition('void => *', [
transition(':enter', [
style({ width: 10, transform: 'translateX(50px)', opacity: 0 }),
group([
animate('0.3s 0.1s ease', style({
@@ -48,7 +48,7 @@ import { Hero } from './hero';
}))
])
]),
transition('* => void', [
transition(':leave', [
group([
animate('0.3s ease', style({
transform: 'translateX(50px)',
@@ -1,16 +1,13 @@
<!-- #docplaster -->
<h2>Filter/Stagger</h2>
<form>
<label for="search">Search heroes: </label>
<input type="text"
id="search"
#criteria (input)="updateCriteria(criteria.value)"
placeholder="Search heroes">
</form>
<!-- #docregion filter-animations -->
<ul class="heroes" [@filterAnimation]="heroTotal">
<label for="search">Search heroes: </label>
<input type="text" id="search" #criteria
(input)="updateCriteria(criteria.value)"
placeholder="Search heroes">
<ul class="heroes" [@filterAnimation]="heroesTotal">
<!-- #enddocregion filter-animations -->
<li *ngFor="let hero of heroes" class="hero">
<div class="inner">
@@ -17,10 +17,11 @@ import { Hero } from './hero';
// #enddocregion filter-animations
trigger('pageAnimations', [
transition(':enter', [
query('.hero, form', [
query('.hero', [
style({opacity: 0, transform: 'translateY(-100px)'}),
stagger(-30, [
animate('500ms cubic-bezier(0.35, 0, 0.25, 1)', style({ opacity: 1, transform: 'none' }))
stagger(30, [
animate('500ms cubic-bezier(0.35, 0, 0.25, 1)',
style({ opacity: 1, transform: 'none' }))
])
])
])
@@ -32,7 +33,7 @@ import { Hero } from './hero';
transition(':enter, * => 0, * => -1', []),
transition(':increment', [
query(':enter', [
style({ opacity: 0, width: '0px' }),
style({ opacity: 0, width: 0 }),
stagger(50, [
animate('300ms ease-out', style({ opacity: 1, width: '*' })),
]),
@@ -41,13 +42,12 @@ import { Hero } from './hero';
transition(':decrement', [
query(':leave', [
stagger(50, [
animate('300ms ease-out', style({ opacity: 0, width: '0px' })),
animate('300ms ease-out', style({ opacity: 0, width: 0 })),
]),
])
]),
]),
// #enddocregion increment
// #docregion page-animations
]
})
export class HeroListPageComponent implements OnInit {
@@ -56,8 +56,8 @@ export class HeroListPageComponent implements OnInit {
public animatePage = true;
// #docregion filter-animations
heroTotal = -1;
// #enddocregion filter-animations
heroesTotal = -1;
get heroes() { return this._heroes; }
private _heroes: Hero[] = [];
@@ -71,12 +71,11 @@ export class HeroListPageComponent implements OnInit {
this._heroes = HEROES.filter(hero => hero.name.toLowerCase().includes(criteria.toLowerCase()));
const newTotal = this.heroes.length;
if (this.heroTotal !== newTotal) {
this.heroTotal = newTotal;
if (this.heroesTotal !== newTotal) {
this.heroesTotal = newTotal;
} else if (!criteria) {
this.heroTotal = -1;
this.heroesTotal = -1;
}
}
// #docregion filter-animations
}
// #enddocregion filter-animations
@@ -2,14 +2,14 @@
// #docregion reusable
import { Component } from '@angular/core';
import { transition, trigger, useAnimation } from '@angular/animations';
import { transAnimation } from './animations';
import { transitionAnimation } from './animations';
@Component({
selector: 'app-open-close-reusable',
animations: [
trigger('openClose', [
transition('open => closed', [
useAnimation(transAnimation, {
useAnimation(transitionAnimation, {
params: {
height: 0,
opacity: 1,
@@ -22,7 +22,7 @@ import { trigger, transition, state, animate, style } from '@angular/animations'
state('closed', style({
width: '100px',
opacity: 0.8,
backgroundColor: '#c6ecff'
backgroundColor: 'blue'
})),
transition('* => *', [
animate('1s')
@@ -21,7 +21,7 @@ import { trigger, transition, state, animate, style, AnimationEvent } from '@ang
state('closed', style({
height: '100px',
opacity: 0.8,
backgroundColor: '#c6ecff'
backgroundColor: 'blue'
})),
// #enddocregion state2, trigger-wildcard1
// #docregion transition1
@@ -78,7 +78,7 @@ export class OpenCloseComponent {
// #enddocregion component
// #docregion events1, events
onAnimationEvent( event: AnimationEvent ) {
onAnimationEvent(event: AnimationEvent) {
// #enddocregion events1, events
if (!this.logging) {
return;
@@ -87,16 +87,16 @@ export class OpenCloseComponent {
// openClose is trigger name in this example
console.warn(`Animation Trigger: ${event.triggerName}`);
// phaseName is start or done
// phaseName is "start" or "done"
console.warn(`Phase: ${event.phaseName}`);
// in our example, totalTime is 1000 or 1 second
// in our example, totalTime is 1000 (number of milliseconds in a second)
console.warn(`Total time: ${event.totalTime}`);
// in our example, fromState is either open or closed
// in our example, fromState is either "open" or "closed"
console.warn(`From: ${event.fromState}`);
// in our example, toState either open or closed
// in our example, toState either "open" or "closed"
console.warn(`To: ${event.toState}`);
// the HTML element itself, the button in this case
@@ -13,11 +13,11 @@ import { CountdownTimerComponent } from './countdown-timer.component';
@Component({
selector: 'app-countdown-parent-lv',
template: `
<h3>Countdown to Liftoff (via local variable)</h3>
<button (click)="timer.start()">Start</button>
<button (click)="timer.stop()">Stop</button>
<div class="seconds">{{timer.seconds}}</div>
<app-countdown-timer #timer></app-countdown-timer>
<h3>Countdown to Liftoff (via local variable)</h3>
<button (click)="timer.start()">Start</button>
<button (click)="timer.stop()">Stop</button>
<div class="seconds">{{timer.seconds}}</div>
<app-countdown-timer #timer></app-countdown-timer>
`,
styleUrls: ['../assets/demo.css']
})
@@ -29,11 +29,11 @@ export class CountdownLocalVarParentComponent { }
@Component({
selector: 'app-countdown-parent-vc',
template: `
<h3>Countdown to Liftoff (via ViewChild)</h3>
<button (click)="start()">Start</button>
<button (click)="stop()">Stop</button>
<div class="seconds">{{ seconds() }}</div>
<app-countdown-timer></app-countdown-timer>
<h3>Countdown to Liftoff (via ViewChild)</h3>
<button (click)="start()">Start</button>
<button (click)="stop()">Stop</button>
<div class="seconds">{{ seconds() }}</div>
<app-countdown-timer></app-countdown-timer>
`,
styleUrls: ['../assets/demo.css']
})
@@ -7,7 +7,9 @@ import { HEROES } from './hero';
selector: 'app-hero-parent',
template: `
<h2>{{master}} controls {{heroes.length}} heroes</h2>
<app-hero-child *ngFor="let hero of heroes"
<app-hero-child
*ngFor="let hero of heroes"
[hero]="hero"
[master]="master">
</app-hero-child>
@@ -8,9 +8,12 @@ import { MissionService } from './mission.service';
template: `
<h2>Mission Control</h2>
<button (click)="announce()">Announce mission</button>
<app-astronaut *ngFor="let astronaut of astronauts"
<app-astronaut
*ngFor="let astronaut of astronauts"
[astronaut]="astronaut">
</app-astronaut>
<h3>History</h3>
<ul>
<li *ngFor="let event of history">{{event}}</li>
@@ -4,8 +4,9 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-name-parent',
template: `
<h2>Master controls {{names.length}} names</h2>
<app-name-child *ngFor="let name of names" [name]="name"></app-name-child>
<h2>Master controls {{names.length}} names</h2>
<app-name-child *ngFor="let name of names" [name]="name"></app-name-child>
`
})
export class NameParentComponent {
@@ -6,7 +6,9 @@ import { Component } from '@angular/core';
template: `
<h2>Should mankind colonize the Universe?</h2>
<h3>Agree: {{agreed}}, Disagree: {{disagreed}}</h3>
<app-voter *ngFor="let voter of voters"
<app-voter
*ngFor="let voter of voters"
[name]="voter"
(voted)="onVoted($event)">
</app-voter>
@@ -25,7 +25,7 @@ describe('AppComponent', () => {
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('component-overview app is running!');
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('component-overview app is running!');
});
});
@@ -4,12 +4,12 @@ import { Component } from '@angular/core';
// #docregion templatebacktick
@Component({
selector: 'app-component-overview',
template: `<h1>Hello World!</h1>
<p>This template definition spans
multiple lines.</p>`
template: `
<h1>Hello World!</h1>
<p>This template definition spans multiple lines.</p>
`
})
// #enddocregion templatebacktick
export class ComponentOverviewComponent {
}
@@ -14,26 +14,6 @@ describe('Component Style Tests', () => {
expect(await externalH1.getCssValue('fontWeight')).not.toMatch(/normal|400/);
});
it('allows styling :host element', async () => {
const host = element(by.css('app-hero-details'));
expect(await host.getCssValue('borderWidth')).toEqual('1px');
});
it('supports :host() in function form', async () => {
const host = element(by.css('app-hero-details'));
await host.element(by.buttonText('Activate')).click();
expect(await host.getCssValue('borderWidth')).toEqual('3px');
});
it('allows conditional :host-context() styling', async () => {
const h2 = element(by.css('app-hero-details h2'));
expect(await h2.getCssValue('backgroundColor')).toEqual('rgba(238, 238, 255, 1)'); // #eeeeff
});
it('styles both view and content children with /deep/', async () => {
const viewH3 = element(by.css('app-hero-team h3'));
const contentH3 = element(by.css('app-hero-controls h3'));
@@ -3,22 +3,26 @@
@import './hero-details-box.css';
/* #enddocregion import */
/* #docregion host */
:host {
display: block;
border: 1px solid black;
font-style: italic;
}
/* #enddocregion host */
/* #docregion hostfunction */
:host {
font-style: italic;
}
:host(.active) {
border-width: 3px;
font-weight: bold;
}
/* #enddocregion hostfunction */
/* #docregion hostcontext */
:host-context(.theme-light) h2 {
background-color: #eef;
:host-context(.active) {
font-style: italic;
}
/* #enddocregion hostcontext */
@@ -0,0 +1,16 @@
import { Component } from '@angular/core';
// #docregion
@Component({
selector: 'app-main',
template: `
<h1>It Works!</h1>
<div>
Start editing to see some magic happen :)
</div>
`
})
export class HostSelectorExampleComponent {
}
// #enddocregion
@@ -2,7 +2,7 @@
<!-- #docregion ngif -->
<div *ngIf="expanded" [id]="contentId">
<!-- #docregion ng-container -->
<ng-container [ngTemplateOutlet]="content.templateRef"> </ng-container>
<ng-container [ngTemplateOutlet]="content.templateRef"></ng-container>
<!-- #enddocregion ng-container-->
</div>
<!-- #enddocregion ngif -->
<!-- #enddocregion ngif -->
@@ -3,8 +3,8 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-zippy-basic',
template: `
<h2>Single-slot content projection</h2>
<ng-content></ng-content>
`
<h2>Single-slot content projection</h2>
<ng-content></ng-content>
`
})
export class ZippyBasicComponent {}
@@ -3,11 +3,13 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-zippy-multislot',
template: `
<h2>Multi-slot content projection</h2>
Default:
<ng-content></ng-content>
Question:
<ng-content select="[question]"></ng-content>
`
<h2>Multi-slot content projection</h2>
Default:
<ng-content></ng-content>
Question:
<ng-content select="[question]"></ng-content>
`
})
export class ZippyMultislotComponent {}
@@ -3,11 +3,13 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-zippy-ngprojectas',
template: `
<h2>Content projection with ngProjectAs</h2>
Default:
<ng-content></ng-content>
Question:
<ng-content select="[question]"></ng-content>
`
<h2>Content projection with ngProjectAs</h2>
Default:
<ng-content></ng-content>
Question:
<ng-content select="[question]"></ng-content>
`
})
export class ZippyNgprojectasComponent {}
@@ -9,19 +9,22 @@ import { AdComponent } from './ad.component';
selector: 'app-ad-banner',
// #docregion ad-host
template: `
<div class="ad-banner-example">
<h3>Advertisements</h3>
<ng-template adHost></ng-template>
</div>
`
<div class="ad-banner-example">
<h3>Advertisements</h3>
<ng-template adHost></ng-template>
</div>
`
// #enddocregion ad-host
})
// #docregion class
export class AdBannerComponent implements OnInit, OnDestroy {
@Input() ads: AdItem[] = [];
currentAdIndex = -1;
@ViewChild(AdDirective, {static: true}) adHost!: AdDirective;
interval: any;
interval: number | undefined;
constructor(private componentFactoryResolver: ComponentFactoryResolver) { }
@@ -9,15 +9,22 @@ import { AdItem } from './ad-item';
export class AdService {
getAds() {
return [
new AdItem(HeroProfileComponent, {name: 'Bombasto', bio: 'Brave as they come'}),
new AdItem(HeroProfileComponent, {name: 'Dr IQ', bio: 'Smart as they come'}),
new AdItem(HeroJobAdComponent, {headline: 'Hiring for several positions',
body: 'Submit your resume today!'}),
new AdItem(HeroJobAdComponent, {headline: 'Openings in all departments',
body: 'Apply today'}),
new AdItem(
HeroProfileComponent,
{ name: 'Bombasto', bio: 'Brave as they come' }
),
new AdItem(
HeroProfileComponent,
{ name: 'Dr IQ', bio: 'Smart as they come' }
),
new AdItem(
HeroJobAdComponent,
{ headline: 'Hiring for several positions', body: 'Submit your resume today!' }
),
new AdItem(
HeroJobAdComponent,
{ headline: 'Openings in all departments', body: 'Apply today' }
)
];
}
}
@@ -9,16 +9,19 @@ import { AdService } from './ad.service';
@NgModule({
imports: [ BrowserModule ],
providers: [AdService],
declarations: [ AppComponent,
AdBannerComponent,
HeroJobAdComponent,
HeroProfileComponent,
AdDirective ],
entryComponents: [ HeroJobAdComponent, HeroProfileComponent ],
providers: [ AdService ],
declarations: [
AppComponent,
AdBannerComponent,
HeroJobAdComponent,
HeroProfileComponent,
AdDirective
],
entryComponents: [
HeroJobAdComponent,
HeroProfileComponent
],
bootstrap: [ AppComponent ]
})
export class AppModule {
constructor() {}
}
export class AppModule { }
@@ -7,13 +7,11 @@ import { AdComponent } from './ad.component';
template: `
<div class="job-ad">
<h4>{{data.headline}}</h4>
{{data.body}}
</div>
`
})
export class HeroJobAdComponent implements AdComponent {
@Input() data: any;
}
@@ -1,6 +1,6 @@
{
"tests": [
{"cmd": "yarn", "args": ["test", "--browsers=ChromeHeadless", "--no-watch"]},
{"cmd": "yarn", "args": ["e2e", "--prod", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]}
{"cmd": "yarn", "args": ["e2e", "--configuration=production", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]}
]
}
@@ -25,7 +25,7 @@ describe('AppComponent', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Forms Overview');
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Forms Overview');
}));
});
@@ -5,5 +5,4 @@ import { Component } from '@angular/core';
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
}
export class AppComponent { }
@@ -10,14 +10,17 @@ import { ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { TopBarComponent } from './top-bar/top-bar.component';
import { ProductListComponent } from './product-list/product-list.component';
// #docregion declare-product-alerts
import { ProductAlertsComponent } from './product-alerts/product-alerts.component';
// #enddocregion declare-product-alerts
import { ProductDetailsComponent } from './product-details/product-details.component';
import { CartComponent } from './cart/cart.component';
import { ShippingComponent } from './shipping/shipping.component';
// #docregion product-details-route, http-client-module, shipping-route, cart-route
// #docregion product-details-route, http-client-module, shipping-route, cart-route, declare-product-alerts
@NgModule({
// #enddocregion declare-product-alerts
imports: [
BrowserModule,
// #enddocregion product-details-route, cart-route
@@ -35,18 +38,22 @@ import { ShippingComponent } from './shipping/shipping.component';
// #docregion product-details-route, http-client-module, shipping-route, cart-route
])
],
// #enddocregion product-details-route, cart-route
// #enddocregion cart-route
// #docregion declare-product-alerts
declarations: [
AppComponent,
TopBarComponent,
ProductListComponent,
ProductAlertsComponent,
// #enddocregion declare-product-alerts
ProductDetailsComponent,
// #enddocregion product-details-route
CartComponent,
// #enddocregion http-client-module
ShippingComponent
// #docregion http-client-module
// #docregion declare-product-alerts, http-client-module, product-details-route
],
// #enddocregion declare-product-alerts, product-details-route
bootstrap: [
AppComponent
]
@@ -11,6 +11,7 @@ import { CartService } from '../cart.service';
})
// #docregion inject-cart, items
export class CartComponent {
// #enddocregion inject-cart
items = this.cartService.getItems();
// #docregion inject-cart
@@ -7,6 +7,7 @@ import { CartService } from '../cart.service';
styleUrls: ['./cart.component.css']
})
export class CartComponent implements OnInit {
items;
constructor(
@@ -16,4 +17,5 @@ export class CartComponent implements OnInit {
ngOnInit(): void {
this.items = this.cartService.getItems();
}
}
@@ -13,17 +13,20 @@ import { CartService } from '../cart.service';
})
// #docregion inject-form-builder, checkout-form-group
export class CartComponent {
// #enddocregion inject-form-builder
items = this.cartService.getItems();
checkoutForm = this.formBuilder.group({
name: '',
address: ''
});
// #docregion inject-form-builder
constructor(
private cartService: CartService,
private formBuilder: FormBuilder,
) {}
) {}
// #enddocregion inject-form-builder, checkout-form-group
onSubmit(): void {
@@ -1,8 +1,11 @@
// #docplaster
// #docregion as-generated, imports
/*
// #docregion as-generated
import { Component, OnInit } from '@angular/core';
// #enddocregion as-generated
import { Input } from '@angular/core';
*/
// #docregion imports
import { Component, OnInit, Input } from '@angular/core';
import { Product } from '../products';
// #enddocregion imports
// #docregion as-generated
@@ -14,6 +17,7 @@ import { Product } from '../products';
})
// #docregion input-decorator
export class ProductAlertsComponent implements OnInit {
// #enddocregion as-generated
@Input() product!: Product;
// #docregion as-generated
@@ -1,8 +1,6 @@
// #docplaster
// #docregion imports
import { Component } from '@angular/core';
import { Input } from '@angular/core';
import { Output, EventEmitter } from '@angular/core';
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Product } from '../products';
// #enddocregion imports
@@ -13,6 +11,6 @@ import { Product } from '../products';
})
// #docregion input-output
export class ProductAlertsComponent {
@Input() product: Product|undefined;
@Input() product: Product | undefined;
@Output() notify = new EventEmitter();
}
@@ -13,12 +13,11 @@ import { Product, products } from '../products';
})
// #docregion props-methods, product-prop
export class ProductDetailsComponent implements OnInit {
product: Product|undefined;
product: Product | undefined;
// #enddocregion product-prop
constructor(
private route: ActivatedRoute,
) { }
constructor(private route: ActivatedRoute) { }
// #enddocregion props-methods
// #docregion get-product
@@ -6,8 +6,7 @@
<h3>{{ product.name }}</h3>
<h4>{{ product.price | currency }}</h4>
<p>{{ product.description }}</p>
<!-- #enddocregion details -->
<button (click)="addToCart(product)">Buy</button>
<!-- #docregion details -->
<!-- #docregion details -->
</div>
@@ -14,8 +14,9 @@ import { CartService } from '../cart.service';
})
// #docregion inject-cart-service, add-to-cart
export class ProductDetailsComponent implements OnInit {
// #enddocregion add-to-cart, inject-cart-service
product: Product|undefined;
product: Product | undefined;
// #docregion inject-cart-service
constructor(
@@ -7,6 +7,7 @@ import { products } from '../products';
styleUrls: ['./product-list.component.css']
})
export class ProductListComponent {
products = products;
share() {
@@ -4,7 +4,9 @@
<div *ngFor="let product of products">
<h3>
<a [title]="product.name + ' details'" [routerLink]="['/products', product.id]">
<a
[title]="product.name + ' details'"
[routerLink]="['/products', product.id]">
{{ product.name }}
</a>
</h3>
@@ -9,6 +9,7 @@ import { products } from '../products';
})
// #docregion on-notify
export class ProductListComponent {
products = products;
share() {
@@ -12,14 +12,12 @@ import { CartService } from '../cart.service';
})
// #docregion props
export class ShippingComponent {
shippingCosts = this.cartService.getShippingPrices();
// #enddocregion props
// #docregion inject-cart-service
constructor(private cartService: CartService) {
}
constructor(private cartService: CartService) { }
// #enddocregion inject-cart-service
@@ -1,4 +1,4 @@
<a [routerLink]="['/']">
<a routerLink="/">
<h1>My Store</h1>
</a>
@@ -5,6 +5,4 @@ import { Component } from '@angular/core';
templateUrl: './top-bar.component.html',
styleUrls: ['./top-bar.component.css']
})
export class TopBarComponent {
}
export class TopBarComponent { }
@@ -138,11 +138,11 @@ describe('Http Tests', () => {
});
describe('PackageSearch', () => {
it('can search for npm package and find in cache', async () => {
it('can search for package and find in cache', async () => {
const packageName = 'angular';
await page.searchInput.sendKeys(packageName);
await checkLogForMessage(
'Caching response from "https://npmsearch.com/query?q=angular"');
'Caching response from "/packages/query?name=angular".');
expect(await page.searchListItems.count()).toBeGreaterThan(1, 'angular items');
await page.searchInput.clear();
@@ -152,7 +152,7 @@ describe('Http Tests', () => {
await page.searchInput.clear();
await page.searchInput.sendKeys(packageName);
await checkLogForMessage(
'Found cached response for "https://npmsearch.com/query?q=angular"');
'Found cached response for "/packages/query?name=angular"');
});
});
});
@@ -2,6 +2,6 @@
"projectType": "testing",
"tests": [
{"cmd": "yarn", "args": ["test", "--browsers=ChromeHeadless", "--no-watch"]},
{"cmd": "yarn", "args": ["e2e", "--prod", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]}
{"cmd": "yarn", "args": ["e2e", "--configuration=production", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]}
]
}
@@ -68,11 +68,7 @@ function sendRequest(
req: HttpRequest<any>,
next: HttpHandler,
cache: RequestCache): Observable<HttpEvent<any>> {
// No headers allowed in npm search request
const noHeaderReq = req.clone({ headers: new HttpHeaders() });
return next.handle(noHeaderReq).pipe(
return next.handle(req).pipe(
tap(event => {
// There may be other events besides the response.
if (event instanceof HttpResponse) {
@@ -8,6 +8,11 @@ export class InMemoryDataService implements InMemoryDbService {
{ id: 13, name: 'Bombasto' },
{ id: 14, name: 'Celeritas' },
];
return {heroes};
const query = [
{ name: '@angular/core', version: '20.1.0', description: 'angular core package' },
{ name: '@angular/common', version: '20.1.0', description: 'angular common package' },
{ name: '@angular/material', version: '20.1.5', description: 'angular material package' },
];
return {heroes, query};
}
}
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { catchError } from 'rxjs/operators';
import { HttpErrorHandler, HandleError } from '../http-error-handler.service';
@@ -12,12 +12,12 @@ export interface NpmPackageInfo {
description: string;
}
export const searchUrl = 'https://npmsearch.com/query';
export const searchUrl = '/packages/query';
function createHttpOptions(packageName: string, refresh = false) {
// npm package name search api
// e.g., http://npmsearch.com/query?q=dom'
const params = new HttpParams({ fromObject: { q: packageName } });
// package name search api
// e.g., /packages/query?name=dom'
const params = new HttpParams({ fromObject: { name: packageName } });
const headerMap: Record<string, string> = refresh ? {'x-refresh': 'true'} : {};
const headers = new HttpHeaders(headerMap) ;
return { headers, params };
@@ -39,16 +39,7 @@ export class PackageSearchService {
const options = createHttpOptions(packageName, refresh);
// TODO: Add error handling
return this.http.get(searchUrl, options).pipe(
map((data: any) => {
return data.results.map((entry: any) => ({
name: entry.name[0],
version: entry.version[0],
description: entry.description[0]
} as NpmPackageInfo )
);
}),
return this.http.get<NpmPackageInfo[]>(searchUrl, options).pipe(
catchError(this.handleError('search', []))
);
}
+179
View File
@@ -0,0 +1,179 @@
// #docplaster ...
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
// #docregion locale-config, i18n-baseHref
"projects": {
"angular.io-example": {
// #enddocregion locale-config, i18n-baseHref
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
// #docregion locale-config, i18n-baseHref
"i18n": {
"sourceLocale": "en-US",
"locales": {
"fr": "src/locale/messages.fr.xlf",
// #enddocregion locale-config
"baseHref": ""
// #docregion locale-config
}
},
// #docregion build-production-french
"architect": {
// #enddocregion locale-config, i18n-baseHref
// #docregion build-localize-true, build-single-locale, missing-translation-error
"build": {
// #enddocregion build-single-locale
"builder": "@angular-devkit/build-angular:browser",
"options": {
// #enddocregion build-production-french, missing-translation-error
"localize": true,
// #enddocregion build-localize-true
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": [],
// #docregion missing-translation-error
"i18nMissingTranslation": "error"
// #docregion build-localize-true, build-production-french
},
// #enddocregion build-localize-true, missing-translation-error
// #docregion build-single-locale
"configurations": {
// #enddocregion build-single-locale, build-production-french
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
// #docregion build-single-locale, build-production-french
"fr": {
"localize": [
"fr"
]
}
},
// #enddocregion build-single-locale, build-production-french
"defaultConfiguration": "production"
// #docregion build-single-locale, build-production-french
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
// #enddocregion build-single-locale
"production": {
"browserTarget": "angular.io-example:build:production"
},
// #enddocregion build-production-french
"development": {
"browserTarget": "angular.io-example:build:development"
},
// #docregion build-single-locale, build-production-french
"fr": {
"browserTarget": "angular.io-example:build:fr"
}
},
// #enddocregion build-single-locale, build-production-french
"defaultConfiguration": "development"
// #docregion build-single-locale, build-production-french
},
// #enddocregion build-single-locale, build-production-french
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular.io-example:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular.io-example:serve:fr"
},
"configurations": {
"production": {
"devServerTarget": "angular.io-example:serve:production"
}
}
}
// #docregion locale-config, build-single-locale, build-production-french, i18n-baseHref
}
// #enddocregion build-single-locale, build-production-french
}
},
// #enddocregion i18n-baseHref
"defaultProject": "angular.io-example"
// #docregion i18n-baseHref
}
// #enddocregion locale-config, i18n-baseHref
@@ -0,0 +1,24 @@
# #docregion
<VirtualHost *:80>
ServerName localhost
DocumentRoot /www/data
<Directory "/www/data">
RewriteEngine on
RewriteBase /
RewriteRule ^../index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (..) $1/index.html [L]
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^$ /de/ [R]
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ /en/ [R]
RewriteCond %{HTTP:Accept-Language} !^en [NC]
RewriteCond %{HTTP:Accept-Language} !^de [NC]
RewriteRule ^$ /fr/ [R]
</Directory>
</VirtualHost>
@@ -29,3 +29,9 @@
<!--#docregion i18n-title-->
<img [src]="logo" title="Angular logo">
<!--#enddocregion i18n-title-->
<!--#docregion i18n-duplicate-custom-id-->
<h3 i18n="@@myId">Hello</h3>
<!-- ... -->
<p i18n="@@myId">Good bye</p>
<!--#enddocregion i18n-duplicate-custom-id-->
@@ -1,4 +1,7 @@
// #docregion
// #docregion global-locale
import '@angular/common/locales/global/fr';
// #enddocregion global-locale
// #docregion locale-id
import { LOCALE_ID, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@@ -11,3 +14,4 @@ import { AppComponent } from '../src/app/app.component';
bootstrap: [ AppComponent ]
})
export class AppModule { }
// #enddocregion locale-id
@@ -0,0 +1,35 @@
# #docregion add-localize
ng add @angular/localize
# #enddocregion add-localize
# #docregion extract-i18n-default
ng extract-i18n
# #enddocregion extract-i18n-default
# #docregion extract-i18n-output-path
ng extract-i18n --output-path src/locale
# #enddocregion extract-i18n-output-path
# #docregion extract-i18n-formats
ng extract-i18n --format=xlf
ng extract-i18n --format=xlf2
ng extract-i18n --format=xmb
ng extract-i18n --format=json
ng extract-i18n --format=arb
# #enddocregion extract-i18n-formats
# #docregion extract-i18n-out-file
ng extract-i18n --out-file source.xlf
# #enddocregion extract-i18n-out-file
# #docregion build-localize
ng build --localize
# #enddocregion build-localize
# #docregion serve-french
ng serve --configuration=fr
# #enddocregion serve-french
# #docregion build-production-french
ng build --configuration=production,fr
# #enddocregion build-production-french
@@ -0,0 +1,7 @@
/* tslint:disable */
// #docregion
function plural(n: number): number {
let i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length;
if (i === 1 && v === 0) return 1;
return 5;
}
@@ -67,6 +67,12 @@
</trans-unit>
<!-- #enddocregion translate-nested-2 -->
<!-- #enddocregion translate-nested -->
<!-- #docregion i18n-duplicate-custom-id -->
<trans-unit id="myId" datatype="html">
<source>Hello</source>
<target state="new">Bonjour</target>
</trans-unit>
<!-- #enddocregion i18n-duplicate-custom-id -->
</body>
</file>
</xliff>
@@ -0,0 +1,32 @@
# #docregion
http {
# Browser preferred language detection (does NOT require
# AcceptLanguageModule)
map $http_accept_language $accept_language {
~*^de de;
~*^fr fr;
~*^en en;
}
# ...
}
server {
listen 80;
server_name localhost;
root /www/data;
# Fallback to default language if no preference defined by browser
if ($accept_language ~ "^$") {
set $accept_language "fr";
}
# Redirect "/" to Angular application in the preferred language of the browser
rewrite ^/$ /$accept_language permanent;
# Everything under the Angular application is always redirected to Angular in the
# correct language
location ~ ^/(fr|de|en) {
try_files $uri /$1/index.html?$args;
}
# ...
}
@@ -0,0 +1,3 @@
<h3>Bonjour</h3>
<!-- ... -->
<p>Bonjour</p>
@@ -1,5 +1,8 @@
{
"projectType": "i18n",
"overrideBoilerplate": [
"angular.json"
],
"tests": [
{
"cmd": "yarn",
@@ -1,7 +1,6 @@
<p>Save for later item: {{input1}}</p>
<button (click)="saveIt()"> Save for later</button>
<p>Item for wishlist: {{input2}}</p>
<button (click)="wishForIt()"> Add to wishlist</button>
<p>Item for wishlist: {{input2}}</p>
<button (click)="wishForIt()"> Add to wishlist</button>
@@ -21,12 +21,12 @@ export class AliasingComponent {
saveIt() {
console.warn('Child says: emiting outputEvent1 with', this.input1);
console.warn('Child says: emitting outputEvent1 with', this.input1);
this.outputEvent1.emit(this.input1);
}
wishForIt() {
console.warn('Child says: emiting outputEvent2', this.input2);
console.warn('Child says: emitting outputEvent2', this.input2);
this.outputEvent2.emit(this.input2);
}
@@ -20,7 +20,10 @@
<p>Open the console to see the EventEmitter at work when you click Delete.</p>
<!-- #docregion together -->
<app-input-output [item]="currentItem" (deleteRequest)="crossOffItem($event)"></app-input-output>
<app-input-output
[item]="currentItem"
(deleteRequest)="crossOffItem($event)">
</app-input-output>
<!-- #enddocregion together -->
<hr>
@@ -28,7 +31,10 @@
<h2>Input and Output in the component class metadata</h2>
<p>Open the console to see the EventEmitter at work when you click Buy.</p>
<app-in-the-metadata [clearanceItem]="lastChanceItem" (buyEvent)="buyClearanceItem($event)"></app-in-the-metadata>
<app-in-the-metadata
[clearanceItem]="lastChanceItem"
(buyEvent)="buyClearanceItem($event)">
</app-in-the-metadata>
<hr>
@@ -36,7 +42,12 @@
<h2>Aliasing Inputs and Outputs</h2>
<p>See aliasing.component.ts for aliases and the console for the EventEmitter console logs.</p>
<app-aliasing [saveForLaterItem]="currentItem" (saveForLaterEvent)="saveForLater($event)" [wishListItem]="currentItem" (wishEvent)="addToWishList($event)"></app-aliasing>
<app-aliasing
[saveForLaterItem]="currentItem"
[wishListItem]="currentItem"
(saveForLaterEvent)="saveForLater($event)"
(wishEvent)="addToWishList($event)">
</app-aliasing>
<h2>Wishlist:</h2>
<ul>

Some files were not shown because too many files have changed in this diff Show More