Commit Graph

20342 Commits

Author SHA1 Message Date
atscott a58f066647 docs: copy release notes from 11.2.2 (#40953)
PR Close #40953
2021-02-22 15:18:03 -08:00
Andrew Scott f31a6015a0 perf(language-service): short-circuit LS operations (#40946)
When certain information is requested from the Angular Language Service, we
know that there will be no additional Angular information if the requested
position is not in an inline template, template url, or style url. To avoid
unnecessary compiler compilations, we short circuit and return `undefined`
before asking the compiler for any type of answer which would trigger a
partial compilation, at the very least.

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

PR Close #40946
2021-02-22 13:19:09 -08:00
Daniel Díaz b84f719747 docs: update year (#40925)
PR Close #40925
2021-02-22 12:37:40 -08:00
JiaLiPassion dc9fd1aaef fix(core): NgZone coaleascing options should trigger onStable correctly (#40540)
fix https://github.com/angular/components/issues/21674

When setting `ngZoneRunCoalescing` to true, `onStable` is not emitted correctly.
the reason is before this commit, the code looks like this:

```
// application code call `ngZone.run()`
ngzone.run(() => {}); // step 1

// inside NgZone, in the OnInvoke hook, NgZone try to delay the checkStable()

function delayChangeDetectionForEvents(zone: NgZonePrivate) {
  if (zone.lastRequestAnimationFrameId !== -1) { // step 9
    return;
  }
  zone.lastRequestAnimationFrameId = zone.nativeRequestAnimationFrame.call(global, () => { // step 2
    if (!zone.fakeTopEventTask) {
      zone.fakeTopEventTask = Zone.root.scheduleEventTask('fakeTopEventTask', () => {
        zone.lastRequestAnimationFrameId = -1; // step 3
        updateMicroTaskStatus(zone); // step 4
        checkStable(zone); // step 6
      }, undefined, () => {}, () => {});
    }
    zone.fakeTopEventTask.invoke();
  });
  updatemicroTaskStatus(zone);
}

function updateMicroTaskStatus(zone: NgZonePrivate, ignoreCheckRAFId = false) {
  if (zone._hasPendingMicrotasks ||
      ((zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) &&
       zone.lastRequestAnimationFrameId !== -1)) { // step 5
    zone.hasPendingMicrotasks = true;
  } else {
    zone.hasPendingMicrotasks = false;
  }
}

function checkStable(zone: NgZonePrivate) {
  if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) { // step 7
    try {
      zone._nesting++;
      zone.onMicrotaskEmpty.emit(null);
    ...
}

// application ref subscribe onMicroTaskEmpty
ngzone.onMicroTaskEmpty.subscribe(() => {
  ngzone.run(() => { // step 8
    tick();
  });
});

```

and the process is:
1. step 1: application call ngZone.run()
2. step 2: NgZone delay the checkStable() call in a requestAnimationFrame, and also set
zone.lastRequestAnimationFrameId
3. step 3: Inside the requestAnimationFrame callback, reset zone.lastRequestAnimationFrameId first
4. step 4: update microTask status
5, step 5: if zone.lastRequestAnimationFrameId is -1, that means no microTask pending.
6. step 6: checkStable and trigger onMicrotaskEmpty emitter.
7. step 7: ApplicationRef subscribed onMicrotaskEmpty, so it will call another `ngZone.run()` to process
tick()
8. step 8: And this new `ngZone.run()` will try to check `zone.lastRequestAnimationFrameId` in `step 9`
when trying to delay the checkStable(), and since the zone.lastRequestAnimationFrameId is already reset
to -1 in step 3, so this ngZone.run() will run into step 2 again.
9. and become a infinite loop..., so onStable is never emit

in this commit, there is a new flag `zone.isCheckStableRunning` added to
prevent re-entry when `shouldCoaleascing` flag is enabled.

PR Close #40540
2021-02-22 10:01:31 -08:00
Jon Jaques d28197db15 refactor(zone.js): update Object.create params to match web platform (#34287)
This commit updates `Object.create` argument names used in Zone.js to match web platform.

PR Close #34287
2021-02-22 08:47:39 -08:00
Andrew Kushnir 995adb2297 test(core): refactor ApplicationInitStatus tests to avoid TestBed side-effects (#33222)
Currently TestBed (both ViewEngine and Ivy) invoke `ApplicationInitStatus.runInitializers` as a part of the
bootstrap process to mimic real bootstrap steps. This is problematic for the `ApplicationInitStatus` class
tests since the `runInitializers` call performed by TestBed interfere with actual tests.

This commit updates ApplicationInitStatus tests to interact with the class directly instead of relying on TestBed
APIs to retrieve the class though DI.

PR Close #33222
2021-02-22 08:41:49 -08:00
vthinkxie ca17ac523c feat(core): support APP_INITIALIZER work with observable (#33222)
This commit adds support for Observables that now can be used as a part of APP_INITIALIZER. Previously, only
Primises were supported.

Closes #15088.

PR Close #33222
2021-02-22 08:41:49 -08:00
Alex Rickabaugh 53c65f468f test(language-service): update compiler_spec to use the new testing env (#40679)
This commit updates compiler_spec.ts in the Ivy LS suite to utilize the new
testing environment which was introduced in the previous commit. Eventually
all specs should be converted, but converting one right now helps ensure
that the new testing env is working properly and able to support real tests.

PR Close #40679
2021-02-22 08:40:41 -08:00
Alex Rickabaugh c9879deded test(language-service): introduce new, more configurable testing env (#40679)
The Ivy Language Service codebase testing suite contains a few testing
utilities which allow for assertions of Language Service operations against
an in-memory project. However, this existing utility lacks the flexibility
to test more complex scenarios, such as those involving multiple TS projects
with dependencies between them.

This commit introduces a new 'testing' package for the Ivy LS which attempts
to more faithfully represent the possible states of an IDE, and allows for
testing of more advanced scenarios. The new utility borrows from the prior
version and is geared towards more ergonomic testing. Only basic
functionality is present in this initial implementation, but this will grow
over time.

PR Close #40679
2021-02-22 08:40:41 -08:00
Andrew Kushnir d1d1dadb41 refactor(core): use RuntimeError to throw provider not found error (#40901)
This PR performs a small refactoring to use `RuntimeError` class and corresponding error code (by calling
`throwProviderNotFoundError` which formats the message) to make it more consistent with other places where
similar errors are thrown.

PR Close #40901
2021-02-19 14:38:18 -08:00
Jefiozie f340a5b9f2 fix(http): ignore question mark when params are parsed (#40610)
This commit adds a fix where params will ignore questions marks when
parsed.

Fixes #28722

PR Close #40610
2021-02-19 12:11:39 -08:00
Benjamin Kindle 3b7d2ca179 fix(animations): error when setting position before starting animation (#28255)
it is now possible to set the position when the animation has not ever been started.

PR Close #28255
2021-02-19 12:09:02 -08:00
George Kalpakas 09e1e1935a refactor(docs-infra): convert Sass mixin from camelCase to kebab-case to follow Sass conventions (#40881)
This commit converts the last remaining camelCased Sass mixin
(`deployTheme`) to kebab-case (`deploy-theme`) to follow the Sass
conventions.

Discussed in
https://github.com/angular/angular/pull/40881#discussion_r577961617.

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 4b3e6b5a00 refactor(docs-infra): create mixin for styling marketing pages (#40881)
Previously, in order to apply some styles to marketing (i.e. non-docs)
pages, we listed the various `.page-*` classes that corresponded to docs
pages. This meant that adding/removing a marketing page required updates
in several places, which is error-prone.

This commit avoids this by using a Sass mixin for applying styles to
marketing pages.

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas c5231ce1da refactor(docs-infra): remove duplicate or unused CSS styles (#40881)
This commit removes some CSS styles that have no effect (i.e. are
duplicates or overridden by other rules).

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 717590a732 fix(docs-infra): fix top margin of "Press kit" page on small screens (#40881)
Previously, the "Press kit" page had a larger top margin on smaller
screens, that seemed unnecessary.

This commit removes the extra top margin.

Before: ![presskit top section margin before][1]
After: ![presskit top section margin after][2]

[1]: https://user-images.githubusercontent.com/8604205/107988545-efb27080-6fd8-11eb-91d6-79651f2dffaf.png
[2]: https://user-images.githubusercontent.com/8604205/107988547-f04b0700-6fd8-11eb-9c4b-d444b39a34fe.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas c704162800 fix(docs-infra): use consistent padding in marketing pages (#40881)
This commit makes the padding of the "Events", "Features" and
"Press kit" pages consistent with that of other marketing pages.

Before: ![presskit padding before][1]
After: ![presskit padding after][2]

[1]: https://user-images.githubusercontent.com/8604205/107986067-f8547800-6fd3-11eb-9164-51793e431d05.png
[2]: https://user-images.githubusercontent.com/8604205/107986064-f7234b00-6fd3-11eb-9050-ed7ec04e7443.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 09d36369b0 fix(docs-infra): make top-nav consistent across all marketing pages (#40881)
Previously, some of the marketing pages had different styles for the
top-nav than others (even if they had the same layout and
blue-background header). More specifically, the top-nav had a box-shadow
and it was absolutely positioned on some marketing pages, while it had
no box-shadow and was statically positioned on others.

This commit makes the appearance of marketing pages wrt the top-nav
consistent across all marketing pages by changing the styles for the
remaining pages:
- Contributors (`/about`)
- Contribute (`/contribute`)
- Press kit (`/presskit`)

Before: ![contribute topnav shadow before][1]
After: ![contribute topnav shadow after][2]

[1]: https://user-images.githubusercontent.com/8604205/107984898-a6aaee00-6fd1-11eb-8bf3-79393c8983ff.png
[2]: https://user-images.githubusercontent.com/8604205/107984900-a7438480-6fd1-11eb-8d9b-a643d69ab692.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas b509a7dc42 fix(docs-infra): make the "Contributors" page header similar to other marketing pages (#40881)
Before (wide screen): ![contributors (wide screen) before][1]
Before (narrow screen): ![contributors (narrow screen) before][2]
After (wide screen): ![contributors (wide screen) after][3]
After (narrow screen): ![contributors (narrow screen) after][4]

[1]: https://user-images.githubusercontent.com/8604205/107983880-634f8000-6fcf-11eb-8ad9-5a5df65d3d5e.png
[2]: https://user-images.githubusercontent.com/8604205/107983893-6a768e00-6fcf-11eb-9ccd-158ec491404f.png
[3]: https://user-images.githubusercontent.com/8604205/107983903-6f3b4200-6fcf-11eb-94e1-182893b7a715.png
[4]: https://user-images.githubusercontent.com/8604205/107983895-6ba7bb00-6fcf-11eb-9ff5-59d221ba906d.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas b0c8c4d696 fix(docs-infra): add spacing between past and future events sections (#40881)
This commit adds some more spacing between the past and future events
sections on the "Events" page.

Before: ![events spacing before][1]
After: ![events spacing after][2]

[1]: https://user-images.githubusercontent.com/8604205/107989711-82eca580-6fdb-11eb-837e-1255d439d51a.png
[2]: https://user-images.githubusercontent.com/8604205/107989708-81bb7880-6fdb-11eb-8cf4-4653254e1c37.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 71ccb545c6 refactor(docs-infra): create mixin for styling docs pages (#40881)
Previously, in order to apply some styles to docs (i.e. non-marketing)
pages, we listed the various `.folder-*` classes that corresponded to
docs pages. This meant that adding/removing a docs area required updates
in several places, which is error-prone.

This commit avoids this by using a Sass mixin for applying styles to
docs pages.

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 44e1f956d0 fix(docs-infra): ensure the main font is applied to inputs (#40881)
It turns out that `<input>` and `<button>` elements do not inherit the
`font-family` style from `<body>` by default, but rather use a
user-agent defined style. This means that their font-family might be
different than the one used in the rest of the page.

This commit fixes it by ensuring `<input>` (and other) elements inherit
their `font-family` style from their parent element.

Before: ![inputs font before][1]
After: ![inputs font after][2]

(The difference in font is subtle, but it's there.)

[1]: https://user-images.githubusercontent.com/8604205/107853245-76bae980-6e1d-11eb-8318-e5f6e13876cc.png
[2]: https://user-images.githubusercontent.com/8604205/107853246-77538000-6e1d-11eb-86f2-e3e7e41158f5.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 7bcef26852 refactor(docs-infra): remove unnecessary `font-family` styles (#40881)
This commit removes some unnecessary styles setting `font-family` to
`$main-font`. These styles are redundant, because the targeted elements
already inherit this style from `<body>`.

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 90a61618c7 refactor(docs-infra): remove unused CSS for the version selector (#40881)
This commit removes some CSS rules targeting `.doc-version select` in
the sidenav. These rules do not match any elements any more, since now
we use a custom `<aio-select>` component (instead of the `<select>`
element).

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 64efe38d66 fix(docs-infra): merge `docs` with `guide` and `start` with `tutorial` in search-results (#40881)
Previously, the `docs.md` guide was appearing under "OTHER" in search
results and the results for the `/start*` tutorial pages were appearing
under "START".

This commit changes this so that `docs.md` appears under "GUIDES" and
`/start*` appear under "TUTORIALS", since that is where they belong
conceptually.

It also changes the header of the guides search-area from "GUIDE" to
"GUIDES" and that of tutorials from "TUTORIAL" to "TUTORIALS".

Before: ![search-results areas before][1]
After: ![search-results areas after][2]

[1]: https://user-images.githubusercontent.com/8604205/107811568-0ce80480-6d77-11eb-8652-e7a947c36e63.png
[2]: https://user-images.githubusercontent.com/8604205/107811569-0eb1c800-6d77-11eb-9a69-0000a3703c8a.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 4fac4a8880 fix(docs-infra): show the "Errors List" page under "ERRORS" in search results (#40881)
Previously, the "Errors List" page was appearing under the "OTHER"
section in search results.

This commit fixes this to make it appear under the "ERRORS" section.

Before: ![search-results before][1]
After: ![search-results after][2]

[1]: https://user-images.githubusercontent.com/8604205/107691151-c1b8ed80-6cb3-11eb-8079-fcace685f0ec.png
[2]: https://user-images.githubusercontent.com/8604205/107691145-bfef2a00-6cb3-11eb-8523-b2747fa40469.png

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas fb58a2bd54 fix(docs-infra): use relative URLs for internal links on error pages (#40881)
Previously, some of the links on the error pages had URLs prefixed with
`https://angular.io/`. This caused them to be treated as external URLs,
which had the following downsides:
- Links would always point to `angular.io` instead of the same version
  as the error page (e.g. `next.angular.io` or `v11.angular.io`).
- Dgeni would not be able to check that the URLs are valid (i.e. point
  to existing pages).
- An external link icon would incorrectly be shown next to the links on
  `angular.io`.

This commit fixes the links to use relative URLs.

PR Close #40881
2021-02-19 09:14:59 -08:00
George Kalpakas 51c7d32c09 fix(docs-infra): show external link icons for external links on error pages (#40881)
This commit adds error pages to the list of docs pages that have an
external link icon next to links to external URLs.

PR Close #40881
2021-02-19 09:14:59 -08:00
Andrew Scott a82fddf1ce feat(router): Allow for custom router outlet implementations (#40827)
This PR formalizes, documents, and makes public the router outlet contract.

The set of `RouterOutlet` methods used by the `Router` has not changed
in over 4 years, since the introduction of route reuse strategies.

Creation of custom router outlets is already possible and is used by the
Ionic framework
(https://github.com/ionic-team/ionic-framework/blob/master/angular/src/directives/navigation/ion-router-outlet.ts).
There is a small "hack" that is needed to make this work, which is that
outlets must register with `ChildrenOutletContexts`, but it currently
only accepts our `RouterOutlet`.

By exposing the interface the `Router` uses to activate and deactivate
routes through outlets, we allow for developers to more easily and safely
extend the `Router` and have fine-tuned control over navigation and component
activation that fits project requirements.

PR Close #40827
2021-02-19 09:13:17 -08:00
Kapunahele Wong d0b6270990 docs: edit Component lifecycle title (#40894)
PR Close #40894
2021-02-19 09:10:37 -08:00
David Shevitz b4301c3d88 docs: add missing '@usageNotes' tag to documentation (#40909)
PR Close #40909
2021-02-19 09:09:43 -08:00
arturovt 228b5f73b1 fix(platform-browser): ensure that Hammer loader is called only once (#40911)
Currently, the function that is provided through `HAMMER_LOADER` is called the
same number of times as the `HammerGesturesPlugin.addEventListener` method is called
(until the Hammer is loaded).

This commit adds a class property in which the loader call is saved, thereby
preventing multiple calls to the loader function.

PR Close #25995

PR Close #40911
2021-02-19 09:08:34 -08:00
Amadou Sall aed2782c4a docs: the token should be associated with LibHeaderComponent (#40922)
PR Close #40922
2021-02-19 09:07:00 -08:00
Kapunahele Wong 30d5e25a28 docs: edit attribute-directives.md, move best practice to styleguide (#39849)
PR Close #39849
2021-02-19 08:14:54 -08:00
Chellappan 542ba1fc00 refactor(compiler): add process title to Angular node binaries (#40648)
Set the process title for @angular/compiler-cli,@angular/localize packages

Resolves #40634

PR Close #40648
2021-02-17 17:06:27 -08:00
DerekRTP 65baac6055 docs: update attribute-binding.md to correctly describe [attr.binding] rules (#40878)
PR Close #40878
2021-02-17 17:05:17 -08:00
Dmitrij Kuba 2375b85fe0 docs: remove mention of unused `Intl` polyfill (#40883)
Since `Intl` API was dropped to use to improve browser support,
it is no longer needed as a polyfill to test Angular.

PR Close #40883
2021-02-17 17:04:15 -08:00
Dmitrij Kuba e7dfd7a188 refactor(platform-browser): remove `Intl` references (#40883)
Since `Intl` API was dropped to use to improve browser support,
would be nice to remove the references of it.

PR Close #40883
2021-02-17 17:04:15 -08:00
Pete Bacon Darwin f57cd19e0c refactor(localize): avoid computing source-maps in extraction unnecessarily (#40891)
Previously we were calling `updateSourceLocations()` as part of
`extractMessages()` for every file that was passed in, regardless of
whether any `$localize` tagged strings were to be found in the file.

This was very wasteful because it is non-trivial to compute the flattened
source-map for files if it is not needed.

PR Close #40891
2021-02-17 17:02:57 -08:00
Joey Perrott bafab6de79 build: update dependencies to enable strict_visibility for bazel yarn_install (#40895)
Beginning with rules_nodejs@3.0.0, strict visibility defaults to true.  This means
that we are no longer, in bazel dependencies, able to depend on a package which was
transitively depended on from another dependency we do have in our package.json

PR Close #40895
2021-02-17 17:01:26 -08:00
David Shevitz 1de999b89d docs: fix minor grammar mistakes in What is Angular topic (#40892)
PR Close #40892
2021-02-17 13:23:49 -08:00
Kristiyan Kostadinov cdf1ea1951 refactor(compiler): retrieve variables from context inside nested template listener (#40833)
This is a pre-requisite for #40360. Given the following template which has a listener
that references a variable from a parent template (`name`):

```
<ng-template let-name="name">
  <button (click)="hello(name)"></button>
</ng-template>
```

We generate code that looks that looks like. Note how we access `name` through `ctx`:

```js
function template(rf, ctx) {
  if (rf & 1) {
    const r0 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "button", 2);
    ɵɵlistener("click", function() {
      ɵɵrestoreView(r0);
      const name_r0 = ctx.name; // Note the `ctx.name` access here.
      const ctx_r1 = ɵɵnextContext();
      return ctx_r1.log(name_r0);
    });
    ɵɵelementEnd();
  }
}
```

This works fine at the moment, because the template context object can't be changed after creation.
The changes in #40360 allow for the object to be changed, which means that the `ctx` reference
inside the listener will be out of date, because it was bound during creation mode.

This PR aims to address the issue by accessing the context inside listeners through the saved
view reference. With the new code, the generated code from above will look as follows:

```js
function template(rf, ctx) {
  if (rf & 1) {
    const r0 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "button", 2);
    ɵɵlistener("click", function() {
      const restoredCtx = ɵɵrestoreView(r0);
      const name_r0 = restoredCtx.name;
      const ctx_r1 = ɵɵnextContext();
      return ctx_r1.log(name_r0);
    });
    ɵɵelementEnd();
  }
}
```

PR Close #40833
2021-02-17 11:45:46 -08:00
arturovt b7a2d0da20 perf(core): use `ngDevMode` to tree-shake warning (#40876)
This commit adds `ngDevMode` guard to show the warning only
in dev mode (similar to how things work in other parts of Ivy runtime code).
The `ngDevMode` flag helps to tree-shake the warning from production builds
(in dev mode everything will work as it works right now) to decrease production bundle size.

PR Close #40876
2021-02-17 11:41:28 -08:00
David Shevitz 8658cd59b2 docs: add what is angular topic (#40811)
PR Close #40811
2021-02-17 11:13:21 -08:00
Joey Perrott b31098d5e9
release: cut the v12.0.0-next.1 release (#40889) 2021-02-17 11:47:41 -07:00
Joey Perrott a9936c22ba
docs: release notes for the v11.2.1 release (#40888) 2021-02-17 11:37:38 -07:00
Daniel 9b26f462d0 docs: fix grammar in angular-compiler-options file (#40879)
PR Close #40879
2021-02-17 06:56:38 -08:00
Amadou Sall 0807d13201 docs: remove the extra backtick character (#40873)
PR Close #40873
2021-02-17 06:56:03 -08:00
abarghoud 13d82ce248 docs(core): add documentation for HostListener (#40720)
add return value documentations for HostListener callbacks

Closes #40708

PR Close #40720
2021-02-17 06:55:29 -08:00
Pete Bacon Darwin 322951af49 refactor(compiler-cli): error on cyclic imports in partial compilation (#40782)
Our approach for handling cyclic imports results in code that is
not easy to tree-shake, so it is not suitable for publishing in a
library.

When compiling in partial compilation mode, we are targeting
such library publication, so we now create a fatal diagnostic
error instead of trying to handle the cyclic import situation.

Closes #40678

PR Close #40782
2021-02-17 06:53:38 -08:00