Commit Graph

21510 Commits

Author SHA1 Message Date
Sam Severance c44ab4f6da fix(router): fix `serializeQueryParams` logic (#42481)
corrects a bug that resulted in query params such as
`[queryParams]={a: 1, b:[]}` being serialized as 'a=1&'
instead of 'a=1'

resolves #42445

PR Close #42481
2021-06-08 10:43:00 -07:00
Andrew Scott 171428ec98 docs: add selector documentation for `ViewChildren`, `ContentChildren`, and `ContentChild` (#42366)
These notes are copied from `ViewChild`. In addition, `ContentChildren` and `ViewChildren`
can specify multiple string selectors by separating each selector by a
comma.

fixes #21734

PR Close #42366
2021-06-08 10:42:21 -07:00
MrJithil 4cf442c879 docs: add links to examples for ComponentFactoryResolver (#42496)
Fixes #21705

PR Close #42496
2021-06-08 10:41:33 -07:00
Pete Bacon Darwin 645cad5614 docs(core): describe interactions between view-encapsulated components (#42397)
This commit adds information to the view encapsulation guide that
describes the styling interactions between components that use differing
view encapsulation modes.

Closes #40715

PR Close #42397
2021-06-08 10:39:52 -07:00
MarsiBarsi d10c38a8f8 docs: add Roman Sedov to contributors page (#42515)
PR Close #42515
2021-06-08 10:37:51 -07:00
iRealNirmal 751f68dcf8 docs: updated collaborators and add angular dev's link (#42516)
Existing trusted collaborators link is not working and now link is updated to one of angular.io page also it was missing angular dev's link so added it.

Closes #42513.

PR Close #42516
2021-06-08 10:37:16 -07:00
Jessica Janiuk 66f49c2497 Revert "refactor: remove checked-in locale files" (#42521)
This reverts commit 3a83ec8020f96c293fdc316854e199281d329111.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk e3b709314f Revert "build: convert CLDR locale extraction from Gulp to Bazel tool" (#42521)
This reverts commit b9759522260cd57392e44fe63c5b17a9f102c101.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk cb59bdfebd Revert "build: wire up new CLDR generation tool within Bazel" (#42521)
This reverts commit 40bf84c89decea1de08e43936c9886a391b02173.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk dc25efbb5b Revert "build: build locale files for legacy saucelabs job" (#42521)
This reverts commit 018654fe672a8ab7a954ae6541706957926ac0f4.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk cc55fd6e11 Revert "build: add documentation for `generate-locales-tool`" (#42521)
This reverts commit 12d84d041a2b27bec77f18d7e433b01f105ac784.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk fa4b0b31c0 Revert "build: simplify generation of closure locale file" (#42521)
This reverts commit 5fca35de0de8da24b8a046616404e74ecb4547b4.

PR Close #42521
2021-06-08 10:06:24 -07:00
Teri Glover f1d58efdb1 docs: Edits to remove jargon in Reference Observables, Dependency Injection (#42185)
PR Close #42185
2021-06-07 18:24:48 -07:00
Paul Gschwendtner b762820485 build: simplify generation of closure locale file (#42230)
In the past, the closure file has been generated so that all individual
locale files were imported individually. This resulted in a huge
slow-down in g3 due to the large amount of imports.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

PR Close #42230
2021-06-07 15:34:38 -07:00
Andrew Scott a493ea9bcb fix(language-service): fix autocomplete info display for some cases (#42472)
Before this commit, attribute completion display parts were retrieved
but not assigned. In addition, the switch case was non-exhaustive
because it did not include `StructuralDirectiveAttribute`.

PR Close #42472
2021-06-07 12:25:53 -07:00
George Kalpakas f85a120b7b docs(router): fix code-example headers (#42507)
Previously, the code-examples headers used in the
"Creating custom route matches" tutorial contained the name of the
example directory (`routing-with-urlmatcher`). This was confusing,
because the user was previously instructed to create an app named
`angular-custom-route-match` and switch to that directory.

This commit fixes it by removing the root directory name from the
headers, thus leaving the path of the file relative to the current
working directory. This also aligns with code-examples in other guides.

PR Close #42507
2021-06-07 11:58:20 -07:00
Paul Gschwendtner 38c592ea0a build: remove unused no-strict tsconfig file (#42506)
In the past, when we enabled `--strict` in the repository, we added
another tsconfig for code not being migrated to be `--strict`
compatible. This was done for the deprecated http and webworker
packages. Since these are now removed, we can rmeove the logic.

PR Close #42506
2021-06-07 10:47:47 -07:00
JoostK 64c8027538 docs: clarify how type-only imports can be used to avoid NG3003 (#42491)
Since #42453, type-only imports are not considered for cyclic imports.
This commit adds a note to the NG3003 error documentation to mention
using type-only imports to avoid the error.

PR Close #42491
2021-06-07 10:47:13 -07:00
Andrew Kushnir f4c55e464a docs: provide more info on the `NO_ERRORS_SCHEMA` schema (#42327)
The `NO_ERRORS_SCHEMA` schema can be used to ignore errors related to unknown elements or properties, but since it suppresses these errors it may also hide real problems in a template. This commit updates the `NO_ERRORS_SCHEMA` docs to mention that.

Closes #39454.

PR Close #42327
2021-06-07 10:46:34 -07:00
Kristiyan Kostadinov afd68e5674 feat(compiler): emit diagnostic for shadow dom components with an invalid selector (#42245)
This is based on a discussion we had a few weeks ago. Currently if a component uses `ViewEncapsulation.ShadowDom` and its selector doesn't meet the requirements for a custom element tag name, a vague error will be thrown at runtime saying something like "Element does not support attachShadowRoot".

These changes add a new diagnostic to the compiler that validates the component selector and gives a better error message during compilation.

PR Close #42245
2021-06-07 10:44:57 -07:00
Pete Bacon Darwin cc904b5226 docs(core): clarify deprecation of `entryComponents` (#42248)
These may still be needed in View Engine libraries.

Closes #39958

PR Close #42248
2021-06-07 10:02:01 -07:00
Alex Inkin b061e5b2d7 fix(docs-infra): fix search results font color (#42488)
Use the same white constant for no results message
PR Close #42488
2021-06-07 09:38:06 -07:00
Gourav102 5d70f09032 docs: Corrected spelling (#42493)
Corrected spelling of 'Properties'.
PR Close #42493
2021-06-07 09:36:18 -07:00
Gourav102 cd22c7a1f5 docs: Updated the code snippet path (#42494)
PR Close #42494
2021-06-07 09:32:57 -07:00
Igor Minar 30059173f4 docs: add node.js version info into the universal guide (#42375)
Previously we didn't document what versions were supported. Since universal requires node.js I'm adding version
information into the guide as a informative callout.

Fixes #39436

PR Close #42375
2021-06-04 15:21:21 -07:00
Joey Perrott 4fc24addcb build: suppress errors in git hooks (#42484)
When errors occur in git hooks, we can safely supress them as they are validated on CI.

This is primarily coming up as an issue related to needing to reinstall node_modules

PR Close #42484
2021-06-04 13:34:01 -07:00
Teri Glover a5b5136843 docs: Edits to remove jargon in Reference NgModules (#42182)
PR Close #42182
2021-06-04 13:32:56 -07:00
Paul Gschwendtner 2d0ff0a5d3 ci: add lint error for files with missing trailing new-line (#42478)
For quite a while it is an unspoken convention to add a trailing
new-line files within the Angular repository. This was never enforced
automatically, but has been frequently raised in pull requests through
manual review. This commit sets up a lint rule so that this is
"officially" enforced and doesn't require manual review.

PR Close #42478
2021-06-04 13:31:03 -07:00
Paul Gschwendtner 71e14a71f5 test: update compiler-cli compliance goldens due to TS 4.3 emit format regression (#42022)
Updates the compiler-cli compliance goldens. The golden updates are
required due to a regression in TypeScript 4.3 that causes the emitter
to not incorrectly preserve lines when emitting a node list.

This can be reverted once https://github.com/microsoft/TypeScript/pull/44070
is available.

PR Close #42022
2021-06-04 11:17:09 -07:00
Paul Gschwendtner 25f763cff8 feat(core): support TypeScript 4.3 (#42022)
Switches the repository to TypeScript 4.3 and the latest
version of tslib. This involves updating the peer dependency
ranges on `typescript` for the compiler CLI and for the Bazel
package. Tests for new TypeScript features have been added to
ensure compatibility with Angular's ngtsc compiler.

PR Close #42022
2021-06-04 11:17:09 -07:00
Renovate Bot 69296254da build: update dependency google-closure-compiler to v20210601 (#42475)
PR Close #42475
2021-06-04 10:34:58 -07:00
Jessica Janiuk 00b1444d12 Revert "feat(forms): add `ng-submitted` class to forms that have been submitted." (#42474)
This reverts commit f024d7556081f8913f21761bb8e6aab8d08be110.

PR Close #42474
2021-06-03 17:42:02 -07:00
Joey Perrott ae858c0504 ci: extend default timeout of karma tests for legacy saucelab tests (#42473)
After testing, it seems that the flakyness we are experiencing in our legacy
saucelabs job is caused by timeouts which happen due to the karma server being
unable to serve all of the files needed for the tests fast enough while concurrent
tests are being run.

PR Close #42473
2021-06-03 16:06:00 -07:00
Paul Gschwendtner 1684b70b88 test(dev-infra): always use same virtual git client instance in publish tests (#42468)
With the recent refactorings to `GitClient`, where singletons
are created and can be retrieved through a static method, the
test has been updated to also install spies for the static methods
of `GitClient`. This commit updates the spy installation so that
the same mock git client is used that is also passed manually to
the release actions. Having two separate instances of the mock
git client could result in false-positive test results.

PR Close #42468
2021-06-03 14:34:33 -07:00
Paul Gschwendtner 67f65a9d25 refactor(dev-infra): improve type-safety of git client utility (#42468)
Currently the `GitClient` accepts a generic parameter for determining
whether the `githubToken` should be set or not. This worked fine so far
in terms of distinguishing between an authenticated and
non-authenticated git client instance, but if we intend to conditionally
show methods only for authenticated instances, the generic parameter
is not suitable.

This commit splits up the `GitClient` into two classes. One for
the base logic without any authorization, and a second class that
extends the base logic with authentication logic. i.e. the
`AuthenticatedGitClient`. This allows us to have specific methods only
for the authenticated instance. e.g.

  * `hasOauthScopes` has been moved to only exist for authenticated
    instances.
  * the GraphQL functionality within `gitClient.github` is not
    accessible for non-authenticated instances. GraphQL API requires
    authentication as per Github.

The initial motiviation for this was that we want to throw if
`hasOAuthScopes` is called without the Octokit instance having
a token configured. This should help avoiding issues as within
3b434ed94d
that prevented the caretaker process momentarily.

Additionally, the Git client has moved from `index.ts` to
`git-client.ts` for better discoverability in the codebase.

PR Close #42468
2021-06-03 14:34:33 -07:00
David Shevitz aea56048f6 docs: update host and viewproviders section with correct logical tree representation (#42403)
Fixes #38741

PR Close #42403
2021-06-03 14:33:44 -07:00
George Kalpakas 268e0040e7 build(docs-infra): disable critical CSS inlining (#42435)
Previously, the critical CSS inlining optimization (which is turned on
by default in CLI v12+) was causing a Flash Of Unstyled Content (FOUC).
This was caused by the combination of the following facts:
- The way CSS inlining is implemented in the CLI makes loading the full
  styles asynchronous and non-render-blocking (so the app can bootstrap
  before the styles are fully downloaded).
- Angular.io does not employ the [app shell][1] pattern in order to
  render pages at build time, resulting in very minimal CSS rules being
  recognized as critical (for the purpose of inlining).

This commit fixes the FOUC by disabling the critical CSS inlining, while
we consider a better way to approach this (in order to be able to rip
the benefits of inlining without the FOUC).

[1]: https://angular.io/guide/app-shell

Fixes #42365

PR Close #42435
2021-06-03 14:32:06 -07:00
Kristiyan Kostadinov ba084857ea feat(compiler): support safe keyed read expressions (#41911)
Currently we support safe property (`a?.b`) and method (`a?.b()`) accesses, but we don't handle safe keyed reads (`a?.[0]`) which is inconsistent. These changes expand the compiler in order to support safe key read expressions as well.

PR Close #41911
2021-06-03 13:22:41 -07:00
Dylan Hunn 47270d9e63 feat(forms): add `ng-submitted` class to forms that have been submitted. (#42132)
As previously discussed in pull/31070 and issues/30486, this would be useful because it is often desirable to apply styles to fields that are both `ng-invalid` and `ng-pristine` after the first attempt at form submission, but Angular does not provide any simple way to do this (although evidently Angularjs did). This will now be possible with a descendant selector such as `.ng-submitted .ng-invalid`.

In this implementation, the directive that sets control status classes on forms and formGroups has its set of statuses widened to include `ng-submitted`. Then, in the event that `is('submitted')` is invoked, the `submitted` property of the control container is returned iff it exists. This is preferred over checking whether the container is a `Form` or `FormGroup` directly to avoid reflecting on those classes.

Closes #30486.

PR Close #42132
2021-06-03 13:21:29 -07:00
Paul Gschwendtner fa84d19e97 refactor(dev-infra): always use en-US locale for printing date in merge tool (#42470)
In the dev-infra merge tool, a test fails locally if it runs on
a system with a different system locale. We can either make the
test more flexible, or update the merge tool to always print the date
in `en-US` format. The latter is more reasonable given our console
messages being in english anyway.

PR Close #42470
2021-06-03 13:19:03 -07:00
cindygk c8e4783d14 docs: offboard misko and annie from contributors page (#42467)
PR Close #42467
2021-06-03 13:17:45 -07:00
JoostK 69e57827e2 refactor(compiler-cli): remove unused return type transform (#41996)
With the removal of the `ModuleWithProviders` transform in the parent commit,
the underlying dts transform can also be removed as it is not used elsewhere.

PR Close #41996
2021-06-03 11:38:58 -07:00
JoostK ce8720910d refactor(compiler-cli): remove `ModuleWithProviders` generic type transform (#41996)
The `ModuleWithProviders` type has required a generic type since Angular 10,
so it is no longer necessary for the compiler to transform usages of the
`ModuleWithProviders` type without the generic type, as that should have
been reported as a compile error. This commit removes the detection logic
from ngtsc.

PR Close #41996
2021-06-03 11:38:58 -07:00
iRealNirmal 751cd83ae3 fix(forms): the `min` and `max` validators should work correctly with `0` as a value (#42412)
Prior to this change the `min` and `max` validator directives would not
set the `min` and `max` attributes on the host element. The problem was
caused by the truthy check in host binding expression that was
calculated as `false` when `0` is used as a value. This commit updates
the logic to leverage nullish coalescing operator in these host binding
expressions, so `0` is treated as a valid value, thus the `min` and
`max` attributes are set correctly.

Partially closes #42267

PR Close #42412
2021-06-03 11:34:46 -07:00
JoostK 85c7f7691e fix(common): infer correct type when `trackBy` is used in `ngFor` (#41995)
When a `trackBy` function is used that accepts a supertype of the iterated
array's type, the loop variable would undesirably be inferred as the supertype
instead of the array's item type. This commit adds an inferred type parameter
to `TrackByFunction` to allow an extra degree of freedom, enabling the
loop value to be inferred as the most narrow type.

Fixes #40125

PR Close #41995
2021-06-03 11:33:26 -07:00