Commit Graph

118 Commits

Author SHA1 Message Date
Andrew Scott 25ab4647c5 Revert "fix(animations): process shorthand `margin` and `padding` styles correctly (#35701)" (#35847)
This reverts commit 35c9f0dc2f, breaks
internal tests

PR Close #35847
2020-03-04 18:22:09 +00:00
Matias Niemelä 35c9f0dc2f fix(animations): process shorthand `margin` and `padding` styles correctly (#35701)
Prior to this patch, the `margin` and `padding` properties were not
detected properly by Firefox due to them being shorthand properties.
This patch ensures that both `margin` and `padding` are converted
read as `top right bottom left` in the event that the shorthand
property detection fails for auto-styling in Angular animations.

Fix #35463 (FW-1886)

PR Close #35701
2020-03-02 08:17:38 -08:00
ajitsinghkaler 01ab168774 feat(docs-infra): add useful links if landed on 404 page and no search results found (#34978)
Added additional links which can help user find the things they are
looking for when there are no search results (when searching or on a 404
page).

Note:
This commit increases the main bundle's payload size due to the extra
content of the `aio-search-results` component.

Fixes #31532

PR Close #34978
2020-02-27 11:01:59 -08:00
George Kalpakas aec463c606 ci(docs-infra): increase AIO ViewEngine payload size limit (#34978)
In #35702, the payload size limit for Ivy builds was bumped to account
for small incremental increases in recent PRs. The ViewEngine size has
also increased similarly (~500B), but it was not updated in #35702,
because its total increase was just below the 500B error threshold (by
6B).

This commit bumps the ViewEngine size limit too.

Note: Any investigation for the Ivy size increase (as a follow-up
to #35702) will most likely also apply to ViewEngine, since the size was
increased by the same amount.

PR Close #34978
2020-02-27 11:01:59 -08:00
Andrew Kushnir 91934ebb5c ci: increase AIO payload size limit (#35702)
This commit updates AIO payload size limit that is triggering a problem after merging 0bc35a71e2. That commit added some payload size, but all checks were "green" for the original PR (#34574), so it looks like it's an accumulated payload size increase from multiple changes. The goal of this commit is to bring the master branch back to "green" state.

PR Close #35702
2020-02-26 16:31:55 -08:00
Andrew Kushnir d0d36a5ebf ci: increase AIO payload size limit (#35538)
This commit updates AIO payload size limit that is triggering a problem after merging f95b8ce07e. That commit added some payload size, but all checks were "green" for the PR (https://github.com/angular/angular/pull/34481) after rebase that happened a couple hours before the merge, so this is an accumulated payload size increase from multiple changes. The goal of this commit is to bring the master and patch branches back to "green" state.

PR Close #35538
2020-02-19 09:07:20 -08:00
Pawel Kozlowski 3f4e02b8c7 fix(ivy): queries should match elements inside ng-container with the descendants: false option (#35384)
Before this change content queries with the `descendants: false` option, as implemented in ivy,
would not descendinto `<ng-container>` elements. This behaviour was different from the way the
View Engine worked. This change alligns ngIvy and VE behaviours when it comes to queries and the
`<ng-container>` elements and fixes a common bugs where a query target was placed inside the
`<ng-container>` element with a * directive on it.

Before:

```html
<needs-target>
  <ng-container *ngIf="condition">
    <div #target>...</div>  <!-- this node would NOT match -->
  </ng-container>
</needs-target>
```

After:

```html
<needs-target>
  <ng-container *ngIf="condition">
    <div #target>...</div>  <!-- this node WILL match -->
  </ng-container>
</needs-target>
```

Fixes #34768

PR Close #35384
2020-02-18 17:17:46 -08:00
Pete Bacon Darwin e09abc5b5a ci(docs-infra): update payload limits (#35379)
The update to Angular 9.0.0 appears to have lowered the main.js
file slightly, while the current master build of Angular appears
to have gone up slightly.

PR Close #35379
2020-02-13 10:07:56 -08:00
Misko Hevery ee8b8f52aa feat(ivy): Change static priority resolution to be same level as directive it belongs to (#34938)
This change changes the priority order of static styling.

Current priority:
```
(least priority)
- Static
  - Component
  - Directives
  - Template
- Dynamic Binding
  - Component
    - Map/Interpolation
    - Property
  - Directives
    - Map/Interpolation
    - Property
  - Template
    - Map/Interpolation
    - Property
(highest priority)
```

The issue with the above priority is this use case:

```
<div style="color: red;" directive-which-sets-color-blue>
```
In the above case the directive will win and the resulting color will be `blue`. However a small change of adding interpolation to the example like so. (Style interpolation is coming in https://github.com/angular/angular/pull/34202)
```
<div style="color: red; width: {{exp}}px" directive-which-sets-color-blue>
```
Changes the priority from static binding to interpolated binding which means now the resulting color is `red`. It is very surprising that adding an unrelated interpolation and style can change the `color` which was not changed. To fix that we need to make sure that the static values are associated with priority of the source (directive or template) where they were declared. The new resulting priority is:

```
(least priority)
- Component
  - Static
  - Map/Interpolation
  - Property
- Directives
  - Static
  - Map/Interpolation
  - Property
- Template
  - Static
  - Map/Interpolation
  - Property
(highest priority)
```

PR Close #34938
2020-01-29 15:41:47 -08:00
Igor Minar a3de110b52 build(docs-infra): update aio to @angular/cli@9.0.0-rc.11 (#35043)
PR Close #35043
2020-01-29 14:12:15 -08:00
George Kalpakas 669df70da5 fix(ivy): ensure `DebugNode`/`DebugElement` are tree-shakeable in Ivy (#35003)
There are different `DebugNode`/`DebugElement` implementations (and
associated helper functions) for ViewEngine and Ivy. Additionally, these
classes/functions, which are defined inside the `core` package, are
imported by the `platform-browser` package.

Previously, this code was not tree-shaken as expected in Ivy. #30130
partially addressed the issue, but only for the case where `core` and
`platform-browser` end up in the same closure after webpack's scope
hoisting. In cases where this is not the case, our webpack/terser based
tooling is not capable of tree-shaking it.

This commit fixes the problem, by ensuring that the code retained in Ivy
mode (due to the cross-package import) does not unnecessarily reference
`DebugNode`/`DebugElement`, allowing the code to be tree-shaken away.
This results in a 7.6KB reduction in the size of the main angular.io
bundle.

Jira issue: [FW-1802](https://angular-team.atlassian.net/browse/FW-1802)

PR Close #35003
2020-01-28 15:57:57 -08:00
George Kalpakas c8eb164f01 ci(docs-infra): update payload size limits (#35003)
PR Close #35003
2020-01-28 15:57:57 -08:00
Igor Minar 724ce8c22b build(docs-infra): update to @angular/material 9.0.0-rc.8 (#34966)
This update increases the main bundle by ~0.6KB

payload size snapshot:

456581 Jan 24 22:07 dist/main-es2015.38c39f92eab2fcc8c835.js
541321 Jan 24 22:06 dist/main-es5.38c39f92eab2fcc8c835.js
 52487 Jan 24 22:05 dist/polyfills-es2015.b374ef3555a700a97add.js
146193 Jan 24 22:05 dist/polyfills-es5.c7dc569e6c646e42fade.js
  2987 Jan 24 22:05 dist/runtime-es2015.29be4028399ae41ba25e.js
  2981 Jan 24 22:05 dist/runtime-es5.29be4028399ae41ba25e.js

PR Close #34966
2020-01-27 09:24:48 -08:00
Igor Minar 2f36f17fc0 build(docs-infra): update fw to 9.0.0-rc.11 (#34966)
payload size snapshot:
455991 Jan 24 21:55 dist/main-es2015.2bcbba5871038ad608cd.js
540529 Jan 24 21:55 dist/main-es5.2bcbba5871038ad608cd.js
 52487 Jan 24 21:53 dist/polyfills-es2015.b374ef3555a700a97add.js
146193 Jan 24 21:53 dist/polyfills-es5.c7dc569e6c646e42fade.js
  2987 Jan 24 21:53 dist/runtime-es2015.3f56366a23f559d1feff.js
  2981 Jan 24 21:53 dist/runtime-es5.3f56366a23f559d1feff.js

PR Close #34966
2020-01-27 09:24:48 -08:00
Miško Hevery 9bd9590767 refactor(ivy): change styling to use programmatic API on updates (#34804)
Previously we would write to class/style as strings `element.className` and `element.style.cssText`. Turns out that approach is good for initial render but not good for updates. Updates using this approach are problematic because we have to check to see if there was an out of bound write to style and than perform reconciliation. This also requires the browser to bring up CSS parser which is expensive.

Another problem with old approach is that we had to queue the DOM writes and flush them twice. Once on element advance instruction and once in `hostBindings`. The double flushing is expensive but it also means that a directive can observe that styles are not yet written (they are written after directive executes.)

The new approach uses `element.classList.add/remove` and `element.style.setProperty/removeProperty` API for updates only (it continues to use `element.className` and `element.style.cssText` for initial render as it is cheaper.) The other change is that the styling changes are applied immediately (no queueing). This means that it is the instruction which computes priority. In some circumstances it may result in intermediate writes which are than overwritten with new value. (This should be rare)

Overall this change deletes most of the previous code and replaces it with new simplified implement. The simplification results in code savings.

PR Close #34804
2020-01-24 12:23:19 -08:00
Miško Hevery 5aabe93abe refactor(ivy): Switch styling to new reconcile algorithm (#34616)
NOTE: This change must be reverted with previous deletes so that it code remains in build-able state.

This change deletes old styling code and replaces it with a simplified styling algorithm.

The mental model for the new algorithm is:
- Create a linked list of styling bindings in the order of priority. All styling bindings ere executed in compiled order and than a linked list of bindings is created in priority order.
- Flush the style bindings at the end of `advance()` instruction. This implies that there are two flush events. One at the end of template `advance` instruction in the template. Second one at the end of `hostBindings` `advance` instruction when processing host bindings (if any).
- Each binding instructions effectively updates the string to represent the string at that location. Because most of the bindings are additive, this is a cheap strategy in most cases. In rare cases the strategy requires removing tokens from the styling up to this point. (We expect that to be rare case)S Because, the bindings are presorted in the order of priority, it is safe to resume the processing of the concatenated string from the last change binding.

PR Close #34616
2020-01-24 12:23:00 -08:00
Miško Hevery 2961bf06c6 refactor(ivy): move `hostVars`/`hostAttrs` from instruction to `DirectiveDef` (#34683)
This change moves information from instructions to declarative position:
- `ɵɵallocHostVars(vars)` => `DirectiveDef.hostVars`
- `ɵɵelementHostAttrs(attrs)` => `DirectiveDef.hostAttrs`

When merging directives it is necessary to know about `hostVars` and `hostAttrs`. Before this change the information was stored in the `hostBindings` function. This was problematic, because in order to get to the information the `hostBindings` would have to be executed. In order for `hostBindings` to be executed the directives would have to be instantiated. This means that the directive instantiation would happen before we had knowledge about the `hostAttrs` and as a result the directive could observe in the constructor that not all of the `hostAttrs` have been applied. This further complicates the runtime as we have to apply `hostAttrs` in parts over many invocations.

`ɵɵallocHostVars` was unnecessarily complicated because it would have to update the `LView` (and Blueprint) while existing directives are already executing. By moving it out of `hostBindings` function we can access it statically and we can create correct `LView` (and Blueprint) in a single pass.

This change only changes how the instructions are generated, but does not change the runtime much. (We cheat by emulating the old behavior by calling `ɵɵallocHostVars` and `ɵɵelementHostAttrs`) Subsequent change will refactor the runtime to take advantage of the static information.

PR Close #34683
2020-01-24 12:22:10 -08:00
Andrew Kushnir 92c411f86d docs: update payload size limits for angular.io application (#34913)
This commit increases payload size limits for angular.io application that triggered an error after merging another commit (00f13cc074). The goal of this commit is to bring master back to a "green" state and separate investigation is required to identify the root cause for size increase.

PR Close #34913
2020-01-22 15:01:01 -08:00
Kara Erickson 67eac733d2 refactor(ivy): do not generate providedIn: null (#34116)
We should only generate the `providedIn` property in injectable
defs if it has a non-null value. `null` does not communicate
any information to the runtime that isn't communicated already
by the absence of the property.

This should give us some modest code size savings.

PR Close #34116
2019-12-03 10:14:52 -08:00
Kara Erickson 755d2d572f refactor(ivy): remove unnecessary fac wrapper (#34076)
For injectables, we currently generate a factory function in the
injectable def (prov) that delegates to the factory function in
the factory def (fac). It looks something like this:

```
factory: function(t) { return Svc.fac(t); }
```

The extra wrapper function is unnecessary since the args for
the factory functions are the same. This commit changes the
compiler to generate this instead:

```
factory: Svc.fac
```

Because we are generating less code for each injectable, we
should see some modest code size savings. AIO's main bundle
is about 1 KB smaller.

PR Close #34076
2019-12-02 11:35:24 -08:00
Pete Bacon Darwin 2fb9b7ff1b fix(ngcc): do not output duplicate ɵprov properties (#34085)
Previously, the Angular AOT compiler would always add a
`ɵprov` to injectables. But in ngcc this resulted in duplicate `ɵprov`
properties since published libraries already have this property.

Now in ngtsc, trying to add a duplicate `ɵprov` property is an error,
while in ngcc the additional property is silently not added.

// FW-1750

PR Close #34085
2019-11-27 12:46:37 -08:00
Kara Erickson d752e26eb2 ci: tighten size threshold to 1% or 500 bytes (#33969)
The size diff threshold of 1% has proven to be too lenient for us
to catch size regressions in AIO. Since the AIO main bundle is
between 400-500 KB, a size regression must be between 4-5 KB before
it will cause the tests to fail. As a result, we may merge many
changes with smaller regressions of a few KB before the size test
eventually lets us know that the number has increased. The hope is
that lowering the threshold will help us catch the smaller
regressions during code review and prevent the size tests failing at
a random later time when someone catches the size "hot potato".

PR Close #33969
2019-11-22 16:51:41 -05:00
Filipe Silva 891708cfc9 build: update to Angular CLI 9.0.0-rc.3 (#33955)
Followup to https://github.com/angular/angular/pull/33337

PR Close #33955
2019-11-21 09:17:18 -08:00
Alex Rickabaugh 08a4f10ee7 fix(ivy): move setClassMetadata calls into a pure iife (#33337)
This commit transforms the setClassMetadata calls generated by ngtsc from:

```typescript
/*@__PURE__*/ setClassMetadata(...);
```

to:

```typescript
/*@__PURE__*/ (function() {
  setClassMetadata(...);
})();
```

Without the IIFE, terser won't remove these function calls because the
function calls have arguments that themselves are function calls or other
impure expressions. In order to make the whole block be DCE-ed by terser,
we wrap it into IIFE and mark the IIFE as pure.

It should be noted that this change doesn't have any impact on CLI* with
build-optimizer, which removes the whole setClassMetadata block within
the webpack loader, so terser or webpack itself don't get to see it at
all. This is done to prevent cross-chunk retention issues caused by
webpack's internal module registry.

* actually we do expect a short-term size regression while
https://github.com/angular/angular-cli/pull/16228
is merged and released in the next rc of the CLI. But long term this
change does nothing to CLI + build-optimizer configuration and is done
primarly to correct the seemingly correct but non-function PURE annotation
that builds not using build-optimizer could rely on.

PR Close #33337
2019-11-20 12:55:58 -08:00
George Kalpakas b197e90206 build(docs-infra): update @angular/* to 9.0.0-rc.1 (#33547)
PR Close #33547
2019-11-11 09:38:04 -08:00
George Kalpakas 976bdf1087 build(docs-infra): update @angular/* to 9.0.0-rc.0 (#33547)
PR Close #33547
2019-11-11 09:38:04 -08:00
George Kalpakas 0260b8c795 build(docs-infra): update `aio` payload size (#33547)
PR Close #33547
2019-11-11 09:38:04 -08:00
George Kalpakas f013515307 test(docs-infra): disable es5 size tracking in aio tests (#33346)
PR Close #33346
2019-10-23 09:13:46 -07:00
George Kalpakas 6bc016f3fa build(docs-infra): update @angular/* to 9.0.0-next.10 (#33099)
Also, remove work-around for template type-checking issue that was fixed
in #31371.

Fixes #33051

PR Close #33099
2019-10-15 16:48:29 +00:00
George Kalpakas 9abc1f9156 build(docs-infra): update @angular/cli to 9.0.0-next.8 (#32980)
The payload size increase in the ES5 bundles is (at least partially)
expected, due to fixing some down-leveling corner cases.

Related CLI issue: angular/angular-cli#15673

PR Close #32980
2019-10-10 13:56:14 -07:00
George Kalpakas 4283e1f784 build(docs-infra): update @angular/material to 9.0.0-next.0 (#32980)
Upgrading to @angular/material 9.0.0-next.0 increases the bundle size
slightly (~1.3KB). This is a natural expectation of library
fixes/improvements.

PR Close #32980
2019-10-10 13:56:14 -07:00
George Kalpakas 4541b9b565 build(docs-infra): update payload sizes (#32980)
There seems to be a ~3KB regression for IVy introduced in 4e35e348a.

PR Close #32980
2019-10-10 13:56:14 -07:00
George Kalpakas ad753d3fa7 build(docs-infra): pin terser to 4.3.2 to avoid optimization bug (#32923)
This commit pins terser to version 4.3.2 (instead of 4.3.4 which it is
currently resolved to) to avoid this bug: terser/terser#470

See https://github.com/angular/angular/pull/32923#issuecomment-537370090
for more details.

PR Close #32923
2019-10-04 08:27:21 -07:00
George Kalpakas 7c9219f029 build(docs-infra): upgrade @angular/cli to 9.0.0-next.6 (#32923)
PR Close #32923
2019-10-04 08:27:21 -07:00
George Kalpakas eb72cecc42 build(docs-infra): turn on Ivy (#32923)
The angular.io project uses Angular and CLI v9, which by default turns
on Ivy mode. However, since ec4381dd4, we explicitly opt out of Ivy.

This commit removes the `enabledIvy: false` configuration, thus allowing
the default behavior of having Ivy on.

NOTE:
This commit only changes the angular.io projects. The docs examples need
to be updated separately (first to Angular and CLI v9 and then to Ivy).

PR Close #32923
2019-10-04 08:27:21 -07:00
George Kalpakas bc886a64a7 build(docs-infra): update current payload sizes (#32923)
PR Close #32923
2019-10-04 08:27:21 -07:00
Igor Minar ecd7554051 build(docs-infra): update to cli@9.0.0-next (#32679)
PR Close #32679
2019-09-27 11:34:53 -07:00
Matias Niemelä 4f41473048 refactor(ivy): remove styling state storage and introduce direct style writing (#32591)
This patch is a final major refactor in styling Angular.

This PR includes three main fixes:

All temporary state taht is persisted between template style/class application
and style/class application in host bindings is now removed.
Removes the styling() and stylingApply() instructions.
Introduces a "direct apply" mode that is used apply prop-based
style/class in the event that there are no map-based bindings as
well as property collisions.

PR Close #32259

PR Close #32591
2019-09-16 14:12:48 -07:00
Matias Niemelä 53dbff66d7 revert: refactor(ivy): remove styling state storage and introduce direct style writing (#32259)
This reverts commit 15aeab1620.
2019-09-11 15:24:10 -07:00
Matias Niemelä 15aeab1620 refactor(ivy): remove styling state storage and introduce direct style writing (#32259) (#32596)
This patch is a final major refactor in styling Angular.

This PR includes three main fixes:

All temporary state taht is persisted between template style/class application
and style/class application in host bindings is now removed.
Removes the styling() and stylingApply() instructions.
Introduces a "direct apply" mode that is used apply prop-based
style/class in the event that there are no map-based bindings as
well as property collisions.

PR Close #32259

PR Close #32596
2019-09-11 16:27:10 -04:00
Matias Niemelä c84c27f7f4 revert: refactor(ivy): remove styling state storage and introduce direct style writing (#32259) 2019-09-10 18:08:05 -04:00
Matias Niemelä 3b37469735 refactor(ivy): remove styling state storage and introduce direct style writing (#32259)
This patch is a final major refactor in styling Angular.

This PR includes three main fixes:

All temporary state taht is persisted between template style/class application
and style/class application in host bindings is now removed.
Removes the styling() and stylingApply() instructions.
Introduces a "direct apply" mode that is used apply prop-based
style/class in the event that there are no map-based bindings as
well as property collisions.

PR Close #32259
2019-09-10 15:54:58 -04:00
Carlos Ortiz García 9166baf709 refactor(core): Migrate TestBed.get to TestBed.inject (#32382)
This is cleanup/followup for PR #32200

PR Close #32382
2019-09-09 19:10:54 -04:00
Kara Erickson 89434e09c2 refactor(core): move Meta methods that only have one version from DomAdapter (#32408)
PR Close #32408
2019-09-03 11:59:39 -07:00
Kara Erickson f3e4cb491e refactor(core): remove testing-only event utilities from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:30 -07:00
Kara Erickson cf4b944865 refactor(core): remove misc dom utils from DomAdapters (#32278)
PR Close #32278
2019-08-26 10:39:09 -07:00
Kara Erickson 24127a2492 refactor(core): remove misc, completely unused functions from DomAdapter (#32278)
PR Close #32278
2019-08-26 10:39:09 -07:00
JiaLiPassion ee486233e9 build(zone.js): update zone.js to 0.10.2 (#31975)
Bundle size changed in both zone.js(legacy) and zone-evergreen.js

- zone.js(legacy) package increased a little because the following feature and fixes.
1. #31699, handle MSPointer events PR
2. https://github.com/angular/zone.js/pull/1219 to add __zone_symbol__ customization support

- zone-evergreen.js package decreased because
1. the MSPointer PR only for legacy
2. the Object.defineProperty patch is moved to legacy #31660

PR Close #31975
2019-08-16 09:56:41 -07:00
Alex Rickabaugh f2d47c96c4 fix(ivy): ngcc emits static fields before extra statements (#31933)
This commit changes the emit order of ngcc when a class has multiple static
fields being assigned. Previously, ngcc would emit each static field
followed immediately by any extra statements specified for that field. This
causes issues with downstream tooling such as build optimizer, which expects
all of the static fields for a class to be grouped together. ngtsc already
groups static fields and additional statements. This commit changes ngcc's
ordering to match.

PR Close #31933
2019-08-01 10:45:36 -07:00
Pawel Kozlowski 185b3dd08e build(docs-infra): update main bundle size (#31839)
PR #31839 contains perf and code cleanup changes that add 48 bytes to the
main bundle size. Perf gains and code clarity justify this increase.

Unfortunately the size verification job is rejecting this PR as it reports
size gains from a fixed size and not relative increase of size from a particular PR.

It was decided during the internal team discussion to bump up size limits to
correctly reflect current state of the master and increase from this PR.

PR Close #31839
2019-07-30 13:01:33 -07:00