Commit Graph

20425 Commits

Author SHA1 Message Date
arturovt c49b28013a fix(animations): cleanup DOM elements when the root view is removed (#41059)
Currently, when importing `BrowserAnimationsModule`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

BREAKING CHANGE:
DOM elements are now correctly removed when the root view is removed.
If you are using SSR and use the app's HTML for rendering, you will need
to ensure that you save the HTML to a variable before destorying the
app.
It is also possible that tests could be accidentally relying on the old behavior by
trying to find an element that was not removed in a previous test. If
this is the case, the failing tests should be updated to ensure they
have proper setup code which initializes elements they rely on.

PR Close #41059
2021-03-22 12:58:11 -07:00
Matthias Kunnen b5551609fe fix(router): fragment can be null (#37336)
ActivatedRoute.fragment was typed as Observable<string> but could emit
both null and undefined due to incorrect non-null assertion. These
non-null assertions have been removed and fragment has been retyped to
string | null.

BREAKING CHANGE:
Strict null checks will report on fragment potentially being null.
Migration path: add null check.

Fixes #23894, fixes #34197.

PR Close #37336
2021-03-22 10:02:39 -07:00
Pete Bacon Darwin e7b1d434c8 refactor(compiler): use `ɵɵInjectorDeclaration` rather than `ɵɵInjectorDef` in compiled output (#41119)
The `ɵɵInjectorDef` interface is internal and should not be published publicly
as part of libraries. This commit updates the compiler to render an opaque
type, `ɵɵInjectorDeclaration`, for this instead, which appears in the typings
for compiled libraries.

PR Close #41119
2021-03-22 08:57:18 -07:00
Pete Bacon Darwin 4dc27a7eaa refactor(core): rename `ɵɵFactoryDef` to `ɵɵFactoryDeclaration` (#41119)
Th `ɵɵFactoryDef` type will appear in published libraries, via their typings
files, to describe what type dependencies a DI factory has. The parameters
on this type are used by tooling such as the Language Service to understand
the DI dependencies of the class being created by the factory.

This commit moves the type to the `public_definitions.ts` file alongside
the other types that have a similar role, and it renames it to `ɵɵFactoryDeclaration`
to align it with the other declaration types such as `ɵɵDirectiveDeclaration`
and so on.

PR Close #41119
2021-03-22 08:57:18 -07:00
Pete Bacon Darwin 88683702e5 refactor(core): rename `...WithMeta` types to `...Declaration` and alias to `unknown` (#41119)
These types are only used in the generated typings files to provide
information to the Angular compiler in order that it can compile code
in downstream libraries and applications.

This commit aliases these types to `unknown` to avoid exposing the
previous alias types such as `ɵɵDirectiveDef`, which are internal to
the compiler.

PR Close #41119
2021-03-22 08:57:18 -07:00
Pete Bacon Darwin f2f0eaf37c docs(core): fix typos in interface docs (#41119)
The terminology use in the comments did not match the actual
types being referred to.

PR Close #41119
2021-03-22 08:57:18 -07:00
cindygk efe02d8b04 docs: update contributors.json (#41284)
PR Close #41284
2021-03-22 08:56:47 -07:00
Pete Bacon Darwin 5bc0a472bd refactor(docs-infra): remove image size exclusion list (#41292)
In #41253 the size of contributor images was limited, but
some images were already too large. So an exclusion list
was added. These images have now been reduced, so
the exclusion list is no longer needed.

The files were reduced by a combination of running them through the
https://tinyjpg.com/ online service and manually setting their size to
168px wide or tall using the MacOS Image Preview app.

PR Close #41292
2021-03-22 08:55:53 -07:00
Pete Bacon Darwin 2548921a19 docs: reduce the file size of contributor images (#41292)
Fixes #41287

PR Close #41292
2021-03-22 08:55:53 -07:00
MariosRadis ed5bfe8173 docs: simplify deleteHero method in tutorial (#41303)
Fixes #41233

PR Close #41303
2021-03-22 08:54:53 -07:00
Joey Perrott 5eb7f3491f fix(dev-infra): remove commit message wizard and builder (#41280)
Removing commit message builder and wizard as they are unused and
unneeded.

PR Close #41280
2021-03-19 12:41:09 -07:00
Alan Agius e8cae22d66 feat(dev-infra): validate breaking changes commit messages (#41274)
With this change we valid breaking changes descriptions as per our contribution guidelines

See: 88fbc06677/CONTRIBUTING.md (commit-message-footer)

PR Close #41274
2021-03-19 12:39:19 -07:00
Yvonne Allen b012a56615 docs: specify date format for reviewed tag (#41269)
Specify a date format for the reviewed tag and provided an example.

PR Close #41269
2021-03-19 12:38:50 -07:00
Pete Bacon Darwin aa039a13f0 fix(compiler): correctly process multiple rules containing `:host` selectors (#41261)
When there was more than one rule in a single style string, only the first
rule was having its `:host` selector processed correctly. Now subsequent
rules will also be processed accurately.

Fixes #41237

PR Close #41261
2021-03-19 12:38:15 -07:00
Andrew Kushnir 3a55698402 fix(core): remove obsolete check for [class] and [className] presence (#41254)
Previously presence of both [class] and [className] bindings on an element was treated as compiler error (implemented in 6f203c9575). Later, the situation was improved to actually allow both bindings to co-exist (see a153b61098), however the compiler check was not removed completely. The only situation where the error is thrown at this moment is when static (but with interpolation) and bound `class` attributes are present on an element, for ex.:

```
<div class="{{ one }}" [class]="'two'"></div>
```

In the current situation the error is acually misleading (as it refers to `[className]`).

This commit removes the mentioned compiler check as obsolete and makes the `class` and `style` attribute processing logically the same (the last occurrence is used to compute the value).

PR Close #41254
2021-03-19 12:37:45 -07:00
Andrew Kushnir 2ccb579e06 feat(docs-infra): add profile picture size check (#41253)
This commit updates the logic that validates contributors.json data and introduces a new check that verifies that profile images don't exceed specified limit.

PR Close #41253
2021-03-19 12:37:21 -07:00
Pete Bacon Darwin fbdb19c263 docs(localize): expose documentation for the `@angular/localize` package (#40317)
PR Close #40317
2021-03-19 12:36:10 -07:00
George Kalpakas 655507012b build(docs-infra): upgrade cli command docs sources to b6effecae (#41259)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](5f5448301...b6effecae):

**Modified**
- help/extract-i18n.json

PR Close #41259
2021-03-18 10:02:54 -07:00
Samuel R ac9a250fc4 docs: update link to schematics schema (#41258)
PREVIOUSLY:
The https://angular.io/guide/schematics#configuring-cli-schematics page has a link to "app" schematic specifically and to a version 7.

NOW:
The https://angular.io/guide/schematics#configuring-cli-schematics page links to the latest version of schematics (all of them, not just the "app" schematic) to let the reader snoop around a bit.
PR Close #41258
2021-03-18 10:02:25 -07:00
Manuele Dones ac9c4289e0 docs: replace deprecated karma-coverage-istanbul-reporter (#41246)
'karma-coverage-istanbul-reporter' usage has been deprecated since version 11.
Please install 'karma-coverage' and update 'karma.conf.js.' For more info, see https://github.com/karma-runner/karma-coverage/blob/master/README.md

PR Close #41246
2021-03-18 10:01:57 -07:00
George Kalpakas e23994191c docs: make `HeroService#gerHero()` in `toh-pt5` compatible with TS strict mode (#41234)
Fixes #41207

PR Close #41234
2021-03-18 10:00:52 -07:00
George Kalpakas 6d47b05b5b docs: align `toh-pt5` code with `toh-pt4` (#41234)
This commit aligns the code of `HeroService` `getHeroes()` and
`getHero()` methods in `toh-pt5` with that of `toh-pt4`. I.e. it applies
the changes from #40419 to `toh-pt5`.

PR Close #41234
2021-03-18 10:00:52 -07:00
Preston Lamb 81d2aabcbb docs: add preston lamb to GDE resources (#41204)
PR Close #41204
2021-03-18 09:58:07 -07:00
Zach Arend 09aefd2904 fix(compiler-cli): add `useInlining` option to type check config (#41043)
This commit fixes the behavior when creating a type constructor for a directive when the following
conditions are met.
1. The directive has bound generic parameters.
2. Inlining is not available. (This happens for language service compiles).

Previously, we would throw an error saying 'Inlining is not supported in this environment.' The
compiler would stop type checking, and the developer could lose out on getting errors after the
compiler gives up.

This commit adds a useInlineTypeConstructors to the type check config. When set to false, we use
`any` type for bound generic parameters to avoid crashing. When set to true, we inline the type
constructor when inlining is required.

Addresses #40963

PR Close #41043
2021-03-18 09:52:47 -07:00
Zach Arend c267c680d8 refactor(compiler-cli): don't use FakeEnvironment for tcb tests (#41043)
For the tests in //packages/compiler-cli/src/ngtsc/typecheck, this
commits uses a `TypeCheckFile` for the environment, rather than a
`FakeEnvironment`. Using a real environment gives us more flexibility
with testing.

PR Close #41043
2021-03-18 09:52:47 -07:00
Jessica Janiuk 02e8901d9e
release: cut the v12.0.0-next.5 release (#41249) 2021-03-17 11:41:56 -07:00
Jessica Janiuk 239dab6185
docs: update changelog for the v11.2.6 release (#41248) 2021-03-17 11:32:26 -07:00
Kristiyan Kostadinov fa048948be feat(core): drop support for TypeScript 4.0 and 4.1 (#41158)
Drops support for TypeScript 4.0 and 4.1 across the repo.
The typings check for 4.1 was kept in order to ensure that we don't break g3.

PR Close #41158
2021-03-17 09:10:25 -07:00
Kristiyan Kostadinov 59ef40988e feat(core): support TypeScript 4.2 (#41158)
Updates the repo to TypeScript 4.2 and tslib 2.1.0.

PR Close #41158
2021-03-17 09:10:25 -07:00
JoostK eb74a96935 refactor(compiler-cli): separate used components from used directives in partial declaration (#41104)
The partial declaration of a component includes the list of directives
that are used in its template, including some metadata of the directive
which can be used during actual compilation of the component. Used
components are currently part of this list, as components are also
directives. This commit splits the used components into a dedicate
property in the partial declaration, which allows for template
compilation to optimize the generated code for components.

PR Close #41104
2021-03-17 09:09:29 -07:00
Alan Agius 98de4cb1bf docs: add deprecation note next to IE 11 in browser-support page (#41147)
Add a deprecation note, that IE 11 will be deprecated in version 12.

See angular/angular-cli#20225 and https://techcommunity.microsoft.com/t5/microsoft-365-blog/microsoft-365-apps-say-farewell-to-internet-explorer-11-and/ba-p/1591666

PR Close #41147
2021-03-17 09:07:37 -07:00
George Kalpakas 6bc22a7557 build(docs-infra): upgrade cli command docs sources to 5f5448301 (#41239)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](46538eea1...5f5448301):

**Modified**
- help/build.json
- help/lint.json

PR Close #41239
2021-03-17 09:06:37 -07:00
Alan Agius 95aa0cf04c docs: update assets configuration to include `followSymlinks` option (#41238)
The `followSymlinks` is not listed in the assets configuration section.

PR Close #41238
2021-03-17 09:04:15 -07:00
Teri Glover 0f0f34fb8a docs: minor update to what is Angular topic (#41123)
PR Close #41123
2021-03-17 09:01:35 -07:00
Gérôme Grignon 7d5b60e409 docs: remove unused attribute (#41211)
Fixes #41210

PR Close #41211
2021-03-16 14:48:52 -07:00
JoostK 66e9970691 feat(ngcc): support `__read` helper as used by TypeScript 4.2 (#41201)
This commit complements the support for the `__spreadArray` helper that
was added in microsoft/TypeScript#41523. The prior helpers `__spread`
and `__spreadArrays` used the `__read` helper internally, but the helper
is now emitted as an argument to `__spreadArray` so ngcc now needs to
support evaluating it statically. The real implementation of `__read`
reads an iterable into an array, but for ngcc's static evaluation
support it is sufficient to only deal with arrays as is. Additionally,
the optional `n` parameter is not supported as that is only emitted for
array destructuring syntax, which ngcc does not have to support.

PR Close #41201
2021-03-16 11:06:31 -07:00
JoostK 7b1214eca2 feat(ngcc): support `__spreadArray` helper as used by TypeScript 4.2 (#41201)
In TypeScript 4.2 the `__spread` and `__spreadArrays` helpers were both
replaced by the new helper function `__spreadArray` in
microsoft/TypeScript#41523. These helpers may be used in downleveled
JavaScript bundles that ngcc has to process, so ngcc has the ability to
statically detect these helpers and provide evaluation logic for them.
Because Angular is adopting support for TypeScript 4.2 it becomes
possible for libraries to be compiled by TypeScript 4.2 and thus ngcc
has to add support for the `__spreadArray` helper. The deprecated
`__spread` and `__spreadArrays` helpers are not affected by this change.

Closes #40394

PR Close #41201
2021-03-16 11:06:31 -07:00
George Kalpakas 6bdad5ef6c build(docs-infra): upgrade cli command docs sources to 46538eea1 (#41227)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](edc1d0bc7...46538eea1):

**Modified**
- help/generate.json
- help/new.json

PR Close #41227
2021-03-16 11:04:21 -07:00
Andrew Kushnir 6e942adc67 ci: remove Stephen from PullApprove config (#41224)
This commit updates PullApprove config and removes Stephen from the list of reviewers.

PR Close #41224
2021-03-16 11:00:33 -07:00
Andrew Kushnir e88a9c6350 perf(forms): make `RadioControlRegistry` class tree-shakable (#41126)
This commit makes the `RadioControlRegistry` class tree-shakable by adding the `providedIn` property to its
`@Injectable` decorator. Now if the radio buttons are not used in the app (thus no `RadioControlValueAccessor`
directive is initialized), the `RadioControlRegistry` should not be included into application's prod bundle.

PR Close #41126
2021-03-16 09:35:14 -07:00
Andrew Kushnir b93fb79839 perf(forms): make `FormBuilder` class tree-shakable (#41126)
This commit makes the `FormBuilder` class tree-shakable by adding the `providedIn` property to its `@Injectable`
decorator. Now if the `FormBuilder` class is not referenced in application's code, it should not be included into
its production bundle.

PR Close #41126
2021-03-16 09:35:14 -07:00
JoostK 0093b3b19f fix(ngcc): do not compile JavaScript sources if typings-only processing is repeated (#41209)
The recently introduced typings-only mode in ngcc would incorrectly
write compiled JavaScript files if typings-only mode was requested, in
case the typings of the entry-point had already been processed in a
prior run of ngcc. The corresponding format property for which the
JavaScript files were written were not marked as processed, though, as
the typings-only mode excluded the format property itself from being
marked as processed. Consequently, subsequent runs of ngcc would not
consider the entry-point to have been processed and recompile the
JavaScript bundle once more, resulting in duplicate ngcc imports.

Fixes #41198

PR Close #41209
2021-03-16 09:33:53 -07:00
Alan Agius 7d6db009e9 docs: update docs to reflect production mode by default (#41173)
In CLI version 12, we introduced the concept of production builds by default.

With this change we update the documentation to reflect the changes.

More information about the change can be found https://github.com/angular/angular-cli/pull/20128

PR Close #41173
2021-03-16 09:32:44 -07:00
Pete Bacon Darwin 1a9f526315 docs(core): fix typo in developer docs (#41080)
PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin ef09922c61 docs(compiler): fix typos in partial compilation comments (#41080)
PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 5565810bd6 refactor(compiler-cli): implement `ɵɵngDeclareNgModule` and `ɵɵngDeclareInjector` (#41080)
This commit changes the partial compilation so that it outputs declaration
calls rather than definition calls for NgModules and Injectors.

The JIT compiler and the linker are updated to be able to handle these
new declarations.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 8a33842cca refactor(compiler): consolidate `R3CompiledExpression` (#41080)
There were a number of almost identical interfaces used in
the same way throughout the Render3 compiler code.
This commit changes the compiler to use the same interface
throughout.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 90301f42a9 refactor(compiler): remove unused code (#41080)
These functions are not used so can be removed.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin be9d059efc refactor(compiler): move `type` in shared `R3PartialDeclaration` interface (#41080)
All interfaces that extend `R3PartialDeclaration` require a `type`
property so it makes sense to put it in the base interface.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 12c925a000 refactor(compiler): consolidate `wrapReference()` (#41080)
This function is declared in multiple places. The instances inside
`compiler` are slightly different to those in `compiler-cli`. So this
commit consolidates them into two reusable functions.

PR Close #41080
2021-03-15 13:26:51 -07:00