Commit Graph

242 Commits

Author SHA1 Message Date
Kara Erickson 053b43d308 fix(ivy): update new host binding test with instruction change (#27605)
The pure functions in host bindings change was merged after the change in
host binding instructions, so it had a new test that wasn't yet updated
with the new generated code. This commit updates the new test.

PR Close #27605
2018-12-11 12:09:40 -08:00
Kara Erickson 452668b581 fix(ivy): host bindings should work if input has same name (#27589)
Previously in Ivy, host bindings did not work if they shared a public name
with an Input because they used the `elementProperty` instruction as is.
This instruction was originally built for inside component templates, so it
would either set a directive input OR a native property. This is the
correct behavior for inside a template, but for host bindings, we always
want the native properties to be set regardless of the presence of an Input.

This change adds an extra argument to `elementProperty` so we can tell it to
ignore directive inputs and only set native properties (if it is in the
context of a host binding).

PR Close #27589
2018-12-11 11:27:08 -08:00
Andrew Kushnir ceb14deb60 fix(ivy): proper slot allocation for pure functions in `hostBindings` function (#27587)
Prior to this update, we always returned the number of host vars defined in @Component definition as a value for `allocatePureFunctionsSlot` callback in ValueConverter. As a result, pure function arguments were not accounted for, thus leasing to incorrect slot offsets in `pureFunction` calls. Now we update and return total # of host vars, so the offsets are defined correctly.

PR Close #27587
2018-12-11 11:26:04 -08:00
Andrew Kushnir dcb44e6dea fix(ivy): generate proper event listener names for animation events (FW-800) (#27525)
Prior to this change, animation event names were treated as a regular event names, stripping `@` symbol and event phase. As a result, event listeners were not invoked during animations. Now animation event name is formatted as needed and the necessary callbacks are invoked.

PR Close #27525
2018-12-07 09:25:18 -08:00
Andrew Kushnir cad67148b1 fix(ivy): "select" attribute on <ng-content> should not be case-sensitive (FW-789) (#27500)
While generating attributes for `projection` instruction, we checked whether attribute name is equal to 'select' in lower case. However in other cases we treat 'select' attribute name as case-insensitive. This PR makes 'select' attribute consistently case-insensitive.

PR Close #27500
2018-12-06 13:40:15 -08:00
Andrew Kushnir c71d7b5633 fix(ivy): setting up animation properties correctly (FW-643) (#27496)
Prior to this change, animation properties were defined as element attributes, which caused errors at runtime. Now all animation-related attributes are defined as element properties.

Also as a part of this update, we start to account for bindings used in animations, which was previously missing.

PR Close #27496
2018-12-06 13:38:40 -08:00
Kara Erickson 160cace336 test(ivy): fix query compliance spec (#27501)
PR Close #27501
2018-12-06 09:26:57 -08:00
Andrew Kushnir a3ee08968e fix(ivy): compiler compliance tests actualized (#27473)
PR #27404 introduced additional test case to make sure we generate `elementStyling` instructions with proper set of arguments (first argument was missing in some cases). It looks like that PR was created before we updated host vars count calculation and the `allocHostVars` becomes unnecessary in the test cases introduced in PR #27404. This commit actualizes this test to get rid of unnecessary `allocHostVars` instruction.

PR Close #27473
2018-12-04 21:07:59 -08:00
Andrew Kushnir e31992c112 fix(ivy): missing first argument in `elementStyling` instruction inside `hostBindings` section (#27404)
The logic that generates first argument for the `elementStyling` instruction was missing the check that directive expression is specified. As a result, in some cases first argument was not added, thus making function invocation incorrect. Now the presence of directive expression is taken into account and the `null` expression is generated as needed.

PR Close #27404
2018-12-04 19:58:46 -08:00
Andrew Kushnir f0b0d64453 fix(ivy): adding `projectDef` instructions to all templates where <ng-content> is present (FW-745) (#27384)
Prior to this change `projectDef` instructions were placed to root templates only, thus the necessary information (selectors) in nested templates was missing. This update adds the logic to insert `projectDef` instructions to all templates where <ng-content> is present.

PR Close #27384
2018-12-04 19:58:13 -08:00
Andrew Kushnir 8e644d99fc fix(ivy): taking "interpolation" config option into account (FW-723) (#27363)
PR Close #27363
2018-12-04 14:04:14 -08:00
Andrew Kushnir 8eb102ab10 fix(ivy): avoid counting style/class bindings in component/directive `hostBindings` (#27388)
PR Close #27388
2018-12-03 14:37:30 -08:00
Andrew Kushnir 01fd0cd878 fix(ivy): proper accounting of bound vars in i18nExp fns (FW-747) (#27338)
The problem was caused by missing `allocateBindingSlots` that led to incorrect # of vars defined for components and as a result, causing errors at runtime. Now all `bind` operation are accounted for and the number of `vars` is correct.

PR Close #27338
2018-11-30 14:04:55 -08:00
Andrew Kushnir 973ebdc0ea fix(ivy): avoid creating self-closing i18n instructions in case we have styling instructions (#27330)
The problem was caused by the self-closing i18n instruction that was generated in case we have styling instructions defined for a component. As a result, that caused problems at runtime. This update adds extra check to avoid creating self-closing i18n instructions (create i18nStart and i18nEnd instructions instead) when styling instructions are present.

PR Close #27330
2018-11-30 14:04:00 -08:00
Andrew Kushnir a088b8c203 feat(ivy): introduce "allocHostVars" instruction as a replacement for "hostVars" field (FW-692) (#27299)
PR Close #27299
2018-11-30 14:03:12 -08:00
Andrew Kushnir aedc343003 feat(ivy): updated translation const names (that include message ids) (#27185)
PR Close #27185
2018-11-30 10:00:54 -08:00
Marc Laval c2f30542e7 fix(ivy): should support components without selector (#27169)
PR Close #27169
2018-11-27 10:17:35 -08:00
Andrew Kushnir dc300c5c41 feat(ivy): render flags support in host bindings function (FW-649) (#27204)
PR Close #27204
2018-11-21 15:33:47 -08:00
Olivier Combe 01917733a1 fix(ivy): set encapsulation to `None` when there is no style (#27175)
PR Close #27175
2018-11-20 10:43:51 -08:00
Matias Niemelä 20ea5b5634 refactor(ivy): ensure directive host bindings use the styling algorithm (#27145)
PR Close #27145
2018-11-17 10:12:47 -08:00
Misko Hevery 4222b63639 Revert "refactor(ivy): ensure directive host bindings use the styling algorithm (#27134)"
This reverts commit b5dbf5154e.
2018-11-16 17:55:41 -08:00
Matias Niemelä b5dbf5154e refactor(ivy): ensure directive host bindings use the styling algorithm (#27134)
PR Close #27134
2018-11-16 16:10:45 -08:00
Andrew Kushnir 92e80af875 feat(ivy): ICU support for Ivy (#26794)
PR Close #26794
2018-11-16 16:09:30 -08:00
Olivier Combe 91bffa9c53 fix(ivy): set encapsulation metadata (#27115)
PR Close #27115
2018-11-16 12:22:11 -08:00
JoostK 60800da6c1 fix(ivy): export elementContainerStart/End instructions (#27053)
PR Close #27053
2018-11-16 12:19:18 -08:00
Olivier Combe e22a302cad feat(ivy): support for i18n & ICU expressions (#27101)
PR Close #27101
2018-11-14 16:22:01 -08:00
Miško Hevery f8f1168fa6 Revert "feat(ivy): support for i18n & ICU expressions (#26275)"
This reverts commit a63fd2d0f5.
2018-11-14 10:23:21 -08:00
Olivier Combe a63fd2d0f5 feat(ivy): support for i18n & ICU expressions (#26275)
PR Close #26275
2018-11-13 14:50:30 -08:00
Matias Niemelä 095b6e8113 refactor(ivy): abstract all styling-related compiler logic into a shared class (#27043)
PR Close #27043
2018-11-12 15:32:48 -08:00
Kara Erickson 1810cdf2c3 fix(ivy): compiler should generate restoreView() for local refs in listeners (#27034)
PR Close #27034
2018-11-12 12:50:58 -08:00
Kara Erickson 9e26216c40 fix(ivy): compiler should generate bindings to host attrs properly (#26973)
PR Close #26973
2018-11-07 11:09:31 -08:00
Paul Gschwendtner 8fc4ae51fb build: use bazel version from node modules (#26691)
* No longer depends on a custom CircleCI docker image that comes with Bazel pre-installed. Since Bazel is now available through NPM, we should be able to use the version from `@bazel/bazel` in order to enforce a consistent environment on CI and locally.
* This also reduces the amount of packages that need to be published (ngcontainer is removed)

PR Close #26691
2018-10-30 16:19:13 -04:00
Matias Niemelä 95993e1dd5 fix(ivy): ensure pipes indices are referenced in styling bindings (#26755)
PR Close #26755
2018-10-26 18:40:23 -04:00
Kara Erickson 19fcfc3d00 fix(compiler): generate inputs with aliases properly (#26774)
PR Close #26774
2018-10-26 17:23:45 -04:00
Matias Niemelä 8171a2ab94 fix(ivy): ensure pipe declarations are populated lazily when a forward ref is detected (#26765)
PR Close #26765
2018-10-26 15:57:10 -04:00
Marc Laval b0476f308b feat(ivy): support providers and viewProviders (#25803)
PR Close #25803
2018-10-25 12:58:40 -04:00
Matias Niemelä f6c2db818e fix(ivy): ensure styling pipes are allocated before used in bindings (#26593)
PR Close #26593
2018-10-24 18:42:59 -04:00
Igor Minar ee0b857172 build: rename the ivy compile mode 'local' to 'aot' (#26686)
PR Close #26686
2018-10-23 14:14:49 -07:00
Igor Minar 4237c34c78 test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471)
We are close enough to blacklist a few test targets, rather than whitelist targets to run...

Because bazel rules can be composed of other rules that don't inherit tags automatically,
I had to explicitly mark all of our ts_library and ng_module targes with "ivy-local" and
"ivy-jit" tags so that we can create a query that excludes all fixme- tagged targets even
if those targets are composed of other targets that don't inherit this tag.

This is the updated overview of ivy related bazel tags:

- ivy-only: target that builds or runs only under ivy
- fixme-ivy-jit: target that doesn't yet build or run under ivy with --compile=jit
- fixme-ivy-local: target that doesn't yet build or run under ivy with --compile=local
- no-ivy-jit: target that is not intended to build or run under ivy with --compile=jit
- no-ivy-local: target that is not intended to build or run under ivy with --compile=local

PR Close #26471
2018-10-23 08:57:42 -07:00
Greg Magolan 1f3331f5e6 build(bazel): use fine-grained npm deps (#26111) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Andrew Kushnir 8a3fd58cad feat(ivy): i18n compiler support for i18nStart and i18nEnd instructions (#26442)
PR Close #26442
2018-10-17 11:03:52 -07:00
Andrew Kushnir 8024857d4c feat(ivy): i18n compiler support for element attributes (#26442)
PR Close #26442
2018-10-17 11:03:52 -07:00
Matias Niemelä 9e5d440a0b refactor(ivy): handle animation metadata normalization in the compiler (#26481)
PR Close #26481
2018-10-16 20:31:04 -07:00
Pawel Kozlowski 45732e5b91 fix(ivy): fix reference to pipeBind instruction with 2 args (#26451)
PR Close #26451
2018-10-15 10:14:25 -07:00
Pawel Kozlowski 4b494f23f5 fix(ivy): fix generated code for style bindings with units (#26397)
PR Close #26397
2018-10-11 14:11:15 -07:00
Andrew Kushnir 39f42bad1c feat(ivy): i18n compiler support for element attributes (#26280)
PR Close #26280
2018-10-11 13:00:19 -07:00
Andrew Kushnir d5e9405d4f fix(ivy): local refs in View and Content Queries should be pulled out into consts in generated code (#26240)
PR Close #26240
2018-10-09 17:20:36 -07:00
Kara Erickson 7ea5161d4d refactor(ivy): merge directives into LViewData (#26316)
PR Close #26316
2018-10-09 16:46:00 -07:00
Alex Rickabaugh 456f23f76a fix(ivy): reflect animations field directly into the output definition (#26322)
The 'animations' field of @Component metadata should be copied directly
into the ngComponentDef for that component and should not pass through
static resolution.

Previously the animations array was statically resolved and then the
values were translated back when generating ngComponentDef.

PR Close #26322
2018-10-09 16:45:31 -07:00
Andrew Kushnir aaaa34021c fix(ivy): sanitize tag name while generating listener function name (#26237)
PR Close #26237
2018-10-03 15:29:49 -07:00
Andrew Kushnir cb59d87489 feat(ivy): compiler support to generate QUERY_READ_FROM_NODE calls (#26171)
PR Close #26171
2018-10-03 12:28:23 -07:00
Matias Niemelä c51331689f refactor(ivy): rename stylingProp => styleProp (#26149)
PR Close #26149
2018-10-01 09:35:22 -07:00
Matias Niemelä 7cf5807100 fix(ivy): ensure [style] and [class] bindings are placed in the same instruction (#26126)
PR Close #26126
2018-09-27 15:32:40 -07:00
Misko Hevery 632b19d5c2 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir add1198b88 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir bc1f2d6411 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir d7326d81ba fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir c683f74225 feat(ivy): fixed typo in test case description 2018-09-27 11:52:07 -07:00
Andrew Kushnir b286abeabe feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Kara Erickson 6a62ed2245 fix(ivy): objects like ElementRef should not use a special injection fn (#26064)
PR Close #26064
2018-09-25 12:51:29 -07:00
Greg Magolan b99d7ed5bf build(bazel): update to rules_typescript 0.17.0 & rules_nodejs 0.13.4 (#25920)
PR Close #25920
2018-09-18 13:05:38 -07:00
cexbrayat 21009b06a1 fix(ivy): use proper sanitizer names (#25817)
Fixes #25816

PR Close #25817
2018-09-11 16:22:38 -07:00
Matias Niemelä e3633888ed feat(ivy): support animation @triggers in templates (#25849)
PR Close #25849
2018-09-10 13:59:27 -07:00
Matias Niemelä d2dfd48be0 feat(ivy): patch animations into metadata (#25828)
PR Close #25828
2018-09-07 13:46:06 -07:00
Pawel Kozlowski 6def18a95e fix(ivy): support directive outputs on ng-template (#25717)
Compiler part of #25698
Fixes #25697

PR Close #25717
2018-08-31 13:37:16 -07:00
Kara Erickson b424b3187e fix(compiler): add hostVars and support pure functions in host bindings (#25626)
PR Close #25626
2018-08-31 09:42:58 -07:00
Pawel Kozlowski 6a0f78fabf fix(ivy): match directives on bindings and element outputs (#25614)
Closes #23560

PR Close #25614
2018-08-27 18:17:25 -04:00
Matias Niemelä a37bcc3bfe feat(ivy): bridge component styles into the component renderer (#25255)
PR Close #25255
2018-08-23 16:51:15 -04:00
Kara Erickson 27e2039630 fix(compiler): update compiler to generate new slot allocations (#25607)
PR Close #25607
2018-08-22 21:08:39 -04:00
Marc Laval 6176974832 test(compiler-cli): fix failing test after bad merge (#25599)
PR Close #25599
2018-08-21 11:30:42 -07:00
Pawel Kozlowski 11e2d9da1a feat(ivy): add support to template local refs in the compiler (#25576)
Fixes #23316

PR Close #25576
2018-08-20 16:24:56 -07:00
Kara Erickson 21a14407f6 refactor(ivy): generate vars in component defs (#25562)
PR Close #25562
2018-08-20 11:08:10 -07:00
Kara Erickson f2aa9c6a7f refactor(ivy): use generated consts value to set binding index (#25533)
PR Close #25533
2018-08-17 14:32:55 -07:00
Kara Erickson 6482f6f0fe refactor(ivy): separate container into 2 instructions (#25509)
PR Close #25509
2018-08-16 13:47:14 -07:00
Miško Hevery 9ee6702fa9 refactor(ivy): remove short instruction names as they provide no value (#25493)
PR Close #25493
2018-08-16 11:04:34 -07:00
Ben Lesh a0a29fdd27 feat(ivy): Add AOT handling for bare classes with Input and Output decorators (#25367)
PR Close #25367
2018-08-14 16:36:18 -07:00
Kara Erickson 4a4d6fb0e6 test(ivy): compiler compliance tests should support ? (#25435)
PR Close #25435
2018-08-10 17:12:18 -07:00
Pawel Kozlowski 2d759927d4 feat(ivy): add support for ng-container in the compiler (#25383)
PR Close #25383
2018-08-09 13:13:04 -07:00
Alex Rickabaugh 2befc65777 fix(ivy): ngtsc should pay attention to declaration order (#25392)
When generating the 'directives:' property of ngComponentDef, ngtsc
needs to be conscious of declaration order. If a directive being
written into the array is declarated after the component currently
being compiled, then the entire directives array needs to be wrapped
in a closure.

This commit fixes ngtsc to pay attention to such ordering issues
within directives arrays.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 5be186035f feat(ivy): enable inheritance of factory functions in definitions (#25392)
This commit creates an API for factory functions which allows them
to be inherited from one another. To do so, it differentiates between
the factory function as a wrapper for a constructor and the factory
function in ngInjectableDefs which is determined by a default
provider.

The new form is:

factory: (t?) => new (t || SomeType)(inject(Dep1), inject(Dep2))

The 't' parameter allows for constructor inheritance. A subclass with
no declared constructor inherits its constructor from the superclass.
With the 't' parameter, a subclass can call the superclass' factory
function and use it to create an instance of the subclass.

For @Injectables with configured providers, the factory function is
of the form:

factory: (t?) => t ? constructorInject(t) : provider();

where constructorInject(t) creates an instance of 't' using the
naturally declared constructor of the type, and where provider()
creates an instance of the base type using the special declared
provider on @Injectable.

PR Close #25392
2018-08-09 09:58:13 -07:00
Victor Berchet 795e1e8a38 test(ivy): improve error message for the compiler compliance test (#25291)
before:

```
Expected to find features 'import * as i0 from "@angular/core";
import { Directive, Input } from '@angular/core';

```

after:

```
Failed to find "template" after "...Component_Factory() { return new
MyComponent(); }," in:
'import * as i0 from "@angular/core";
import { Directive, Input } from '@angular/core';```

```

PR Close #25291
2018-08-05 15:31:19 -07:00
Victor Berchet 1e7ca22078 refactor(ivy): make all directives public by default (#25291)
To match the View Engine behavior.

We should make this configurable so that the node injector is tree shaken when
directives do not need to be published.

PR Close #25291
2018-08-05 15:31:19 -07:00
Kara Erickson 79a9c71422 test(ivy): remove unnecessary common import (#25297)
PR Close #25297
2018-08-03 14:34:02 -07:00
Alex Rickabaugh eb999300d9 test(ivy): run compiler compliance tests without rebuilding core,common (#25248)
Previously the compiler compliance tests ran and built test code with
real dependencies on @angular/core and @angular/common. This meant that
any changes to the compiler would result in long rebuild processes
for tests to rerun.

This change removes those dependencies and causes test code to be built
against the fake_core stub of @angular/core that the ngtsc tests use.
This change also removes the dependency on @angular/common entirely, as
locality means it's possible to reference *ngIf without needing to link
to an implementation.

PR Close #25248
2018-08-03 13:08:51 -07:00
Victor Berchet 728d98d3a9 fix(ivy): add bound proerties name to template (#25272)
Before this change bound properties would not be used when matching directives
at runtime.

That is `<ng-template [ngIf]=cond>...</ng-template>` would not trigger the
`ngIf` directive.

PR Close #25272
2018-08-02 22:59:04 -07:00
Kara Erickson c8a4fb1faf fix(ivy): walk declaration views in listener (#25228)
PR Close #25228
2018-07-31 16:35:20 -07:00
Kara Erickson 2ef777b0b2 fix(ivy): convert context code into a tree-shakable instruction (#24943)
PR Close #24943
2018-07-30 15:54:11 -07:00
Kara Erickson fe14f180a6 fix(compiler): update compiler to flatten nested template fns (#24943)
PR Close #24943
2018-07-30 15:54:11 -07:00
Pawel Kozlowski 1e28495c89 fix(ivy): update compiler with latest runtime for view queries (#25061)
PR Close #25061
2018-07-25 10:39:30 -07:00
Matias Niemelä 169e9dd2c8 feat(ivy): bridge compile instructions to include sanitization helpers (#24938)
PR Close #24938
2018-07-23 08:49:52 -07:00
Pawel Kozlowski 13f3157823 fix(ivy): update content query compilation to latest runtime (#24957)
PR Close #24957
2018-07-23 08:45:50 -07:00
Alex Rickabaugh 9fd70c9715 refactor(ivy): run the compiler compliance tests against ngtsc (#24862)
This commit moves the compiler compliance tests into compiler-cli,
and uses ngtsc to run them instead of the custom compilation
pipeline used before. Testing against ngtsc allows for validation
of the real compiler output.

This commit also fixes a few small issues that prevented the tests
from passing.

PR Close #24862
2018-07-20 11:48:36 -07:00