Commit Graph

646 Commits

Author SHA1 Message Date
Victor Berchet 9757347e71 feat(ivy): add an IVY local the compiler which avoids analyzeModule (#23441)
closes #23289

Based on a spike by @chukjaz

PR Close #23441
2018-04-19 16:32:09 -07:00
Victor Berchet 84f024309a refactor(ivy): misc cleanup (#23441)
PR Close #23441
2018-04-19 16:32:09 -07:00
Victor Berchet 1d1e75ee2b Revert "fix(compiler): Pretty print object instead of [Object object] (#22689)" (#23442)
This reverts commit 8555a3a3cd.

Reverted because of https://github.com/angular/angular/issues/23440

PR Close #23442
2018-04-19 14:51:58 -07:00
Matias Niemelä acf6781ccc test(core): add a symbols test for renderer2 code (#23436)
PR Close #23436
2018-04-18 14:49:29 -07:00
Kara Erickson 5a1ddee88c refactor(ivy): speed up bound text nodes (#23386)
PR Close #23386
2018-04-17 13:49:19 -07:00
Misko Hevery b64a276d4b refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371) (#23383)
Ivy definition looks something like this:

```
class MyService {
  static ngInjectableDef = defineInjectable({
    …
  });
}
```

Here the argument to `defineInjectable` is well known public contract which needs
to be honored in backward compatible way between versions. The type of the
return value of `defineInjectable` on the other hand is private and can change
shape drastically between versions without effecting backwards compatibility of
libraries publish to NPM. To our users it is effectively an opaque token.
For this reson why declare the return value of `defineInjectable` as `never`.

PR Close #23383
2018-04-14 20:40:14 -07:00
Igor Minar 674c3def31 revert: refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371)
This reverts commit 2c09b707ce.
2018-04-13 23:02:29 -07:00
Misko Hevery 33630dd3ed fix(ivy): workaround for tsickle bug (#23379)
The issue is with tsickle type inference and the bug should be assigned to them.

The offending code is:
```
function cacheMatchingDirectivesForNode(
    tNode: TNode, tView: TView, localRefs: string[] | null): void {
  const exportsMap = localRefs ? {'': -1} : null;     // <<<<< ===== OFFENDING LINE
  const matches = tView.currentMatches = findDirectiveMatches(tNode);
  if (matches) {
    for (let i = 0; i < matches.length; i += 2) {
      const def = matches[i] as DirectiveDef<any>;
      const valueIndex = i + 1;
      resolveDirective(def, valueIndex, matches, tView);
      saveNameToExportMap(matches[valueIndex] as number, def, exportsMap);
    }
  }
  if (exportsMap) cacheMatchingLocalNames(tNode, localRefs, exportsMap);
}

```

because it generates invalid js closure code:
```
function cacheMatchingDirectivesForNode(tNode, tView, localRefs) {
    const /** @type {(null|{: number})} */ exportsMap = localRefs ? { '': -1 } : null;      // <<<<< ===== OFFENDING LINE
    const /** @type {(null|!Array<?>)} */ matches = tView.currentMatches = findDirectiveMatches(tNode);
    if (matches) {
        for (let /** @type {number} */ i = 0; i < matches.length; i += 2) {
            const /** @type {!tsickle_forward_declare_11.DirectiveDef<?>} */ def = /** @type {!tsickle_forward_declare_11.DirectiveDef<?>} */ (matches[i]);
            const /** @type {number} */ valueIndex = i + 1;
            resolveDirective(def, valueIndex, matches, tView);
            saveNameToExportMap(/** @type {number} */ (matches[valueIndex]), def, exportsMap);
        }
    }
    if (exportsMap)
        cacheMatchingLocalNames(tNode, localRefs, exportsMap);
}
```

The workaround is to declare the type explicitly such as:

```
const exportsMap: ({[key:string]:number}|null) = localRefs ? {'': -1} : null;
```

which than generates valid closure code:

```
const /** @type {(null|!Object<string,number>)} */ exportsMap = localRefs ? { '': -1 } : null;
```

PR Close #23379
2018-04-13 21:29:39 -07:00
Miško Hevery 2c09b707ce refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371)
Ivy definition looks something like this:

```
class MyService {
  static ngInjectableDef = defineInjectable({
    …
  });
}
```

Here the argument to `defineInjectable` is well known public contract which needs
to be honored in backward compatible way between versions. The type of the
return value of `defineInjectable` on the other hand is private and can change
shape drastically between versions without effecting backwards compatibility of
libraries publish to NPM. To our users it is effectively an `OpaqueToken`.

By prefixing the type with `ɵ` we are communicating the the outside world that
the value is not public API and is subject to change without backward compatibility.

PR Close #23371
2018-04-13 16:20:25 -07:00
Misko Hevery f4017ce5e3 fix(ivy): Update Todo app to take advantage of optional injector (#23345)
PR Close #23345
2018-04-13 14:29:52 -07:00
Misko Hevery 4384a92271 docs(ivy): Clean up incorrect comments (#23345)
PR Close #23345
2018-04-13 14:29:52 -07:00
Misko Hevery da31db757b feat(ivy): support injection even if no injector present (#23345)
- Remove default injection value from `inject` / `directiveInject` since
  it is not possible to set using annotations.
- Module `Injector` is stored on `LView` instead of `LInjector` data
  structure because it can change only at `LView` level. (More efficient)
- Add `ngInjectableDef` to `IterableDiffers` so that existing tests can
  pass as well as enable `IterableDiffers` to be injectable without
  `Injector`

PR Close #23345
2018-04-13 14:29:52 -07:00
Misko Hevery 6f213a74f2 feat(ivy): support generation of flags for directive injection (#23345)
This change changes:
- compiler uses `directiveInject` instead of `inject` for `Directive`s
- unifies the flags in `di` as well as `render3`
- changes the signature of `directiveInject` to match `inject` In prep for #23330
- compiler now generates flags for injection.

Compiler portion of #23342
Prep for #23330

PR Close #23345
2018-04-13 14:29:52 -07:00
Marc Laval e7ef02722d fix(ivy): local directives and pipes should be applied to TemplateRef (#23312)
PR Close #23312
2018-04-13 13:31:19 -07:00
Victor Berchet d5e7f60f04 refactor(ivy): misc (#23351)
PR Close #23351
2018-04-13 13:19:17 -07:00
Rafael 639d52fe71 refactor: ensure all 'TODO's are consistent (#23252)
PR Close #23252
2018-04-13 13:11:01 -07:00
Marc Laval 2bb783824e fix(ivy): support ViewContainerRef on nodes projected into an embedded view (#23333)
PR Close #23333
2018-04-13 00:20:32 -07:00
Joey Perrott b551f844e4 feat(platform-browser): add token marking which the type of animation module nearest in the injector tree (#23075)
PR Close #23075
2018-04-12 23:17:38 -07:00
Igor Minar 1fc72e53f5 build(core): update zone.js peer dep to ~0.8.26 2018-04-12 00:19:08 -07:00
Kara Erickson 0d516f1658 fix(ivy): update compiler to generate separate creation mode and update mode blocks (#23292)
PR Close #23292
2018-04-11 15:30:39 -07:00
Kara Erickson de3ca56769 fix(ivy): support separate creation mode and update mode execution in runtime (#23292)
PR Close #23292
2018-04-11 15:30:39 -07:00
Pete Bacon Darwin 4b96a58c5a docs: remove all deprecated `@stable` jsdoc tags (#23210)
These are no longer needed as stable docs are computed as those that
do not have `@experimental` or `@deprecated` tags.

PR Close #23210
2018-04-10 21:49:32 -07:00
Marc Laval c973830d9a refactor(ivy): clean projection support (#23287)
PR Close #23287
2018-04-10 13:16:01 -07:00
Miško Hevery f1db789450 test(ivy): update todo app to http://todomvc.com (#23168)
PR Close #23168
2018-04-10 13:14:20 -07:00
Miško Hevery 50030f650b docs(ivy): update STATUS.md with outstanding work (#23168)
PR Close #23168
2018-04-10 13:14:20 -07:00
Miško Hevery 3fb4e190a8 fix(ivy): correctly bind to component context (#23168)
When compiling templates the compiler would often bind to
closest context rather than the component context.

The only time one should be binding to the cont component is
in explicit cases where the inner template declares local variable.

PR Close #23168
2018-04-10 13:14:20 -07:00
Miško Hevery 4f7fac0e03 test(ivy): cleanup todo test app (#23168)
PR Close #23168
2018-04-10 13:14:20 -07:00
Miško Hevery 9a2479d423 fix(ivy): named listener method for easier debugging. (#23168)
PR Close #23168
2018-04-10 13:14:20 -07:00
Miško Hevery 720031b5f6 docs(ivy): update outstanding work for todo (#23168)
PR Close #23168
2018-04-10 13:14:20 -07:00
Marc Laval bb3f0e5ed2 feat(ivy): support projection of ViewContainerRef (#23272)
PR Close #23272
2018-04-09 16:07:42 -07:00
paulmojicatech 60e8392722 docs(core): update directives documentation (#23255)
fix(release): wrong input names in bank-account component

Directive example has errors #22382

PR Close #23255
2018-04-09 15:19:10 -07:00
Marc Laval f4c56f4931 feat(ivy): implement some of the ViewContainerRef API (#23189)
PR Close #23189
2018-04-09 15:17:19 -07:00
Kara Erickson 628303d2cb fix(ivy): instantiate dirs in correct order (#23178)
PR Close #23178
2018-04-05 14:50:00 -07:00
Pawel Kozlowski d80e9304c6 fix(ivy): properly find RNode (#23193)
As we no longer create native (RNode) comment nodes for containers,
we need to execute logic for finding a next sibiling node with RNode
when inserting a view.

The mentioned logic need to be updated for the case of dynamically
created containers (LContainerNode). Indeed, we need to be able to
descend into dynamically inserted views while looking for a RNode.
To achieve this we need to have a pointer from a host LNode to a
dynamically created LContainerNode).

PR Close #23193
2018-04-05 14:47:50 -07:00
Pawel Kozlowski fc813f67f4 fix(ivy): fix issue with refreshing embedded views (#23164)
PR Close #23164
2018-04-05 10:14:02 -07:00
Victor Berchet 524e5d8ae7 refactor(ivy): adjust types (#23167)
PR Close #23167
2018-04-05 10:09:54 -07:00
Pete Bacon Darwin 8ea15b4f12 docs(core): remove unnecessary `{@link Injector}` jsdoc tag (#23185)
Inline code blocks are automatically linked, if possible, to their API
page.

PR Close #23185
2018-04-05 09:26:24 -07:00
Pete Bacon Darwin 7dc150c1e8 docs(core): migrate `@whatItDoes` tags to the description (#23185)
We get the overview for the doc by splitting off the first
paragraph.

PR Close #23185
2018-04-05 09:26:24 -07:00
Pete Bacon Darwin 5bb14a68d2 docs(core): migrate deprecated `@howToUse` tags (#23185)
These have now become `@usageNotes` but later they might be
moved into a section of the description.

PR Close #23185
2018-04-05 09:26:24 -07:00
Pawel Kozlowski 32a41bc738 test(ivy): fixes in the TodoMVC example (#23161)
- properly display initial checked state
- properly remove a todo

Please note that the 'archive' option still doesn't
work correctly as listening to component outputs doesn't
seem to work (onArchive() is never called).

PR Close #23161
2018-04-04 10:26:18 -07:00
Victor Berchet 5c8340aae0 refactor(ivy): misc refactoring (#23154)
PR Close #23154
2018-04-04 09:04:41 -07:00
JiaLi.Passion c560423b52 build: upgrade zone.js (#23108)
PR Close #23108
2018-04-04 08:24:02 -07:00
Victor Berchet 412b85ba89 docs: add a link to "Impact of polymorphism [...]" to the perf notes (#23151)
PR Close #23151
2018-04-04 08:22:28 -07:00
Aslan Vatsaev cae48df25b docs: Update PERF_NOTES.md (#23050)
PR Close #23050
2018-04-04 08:21:16 -07:00
Alex Rickabaugh fab6b39c3d fix(core): inject() should always work in an NgModule injection scope (#23148)
Currently the context for inject() is only set when the token is seen
for the first time. This has two issues:

* It should always be set when injecting from that injector, because
  a constructor may wish to call inject() directly.
* If an NgModuleFactory is .create()'d twice, and an ngInjectableDef
  token is requested from each of them, the second time will fail.
  This is because the first injection adds the provider definition
  and calls the factory, and the provider definitions are shared.
  The second injector will see the provider definition and call the
  factory to create an instance, but without setting the correct
  context for inject().

Fixes angular/material2#10586.

PR Close #23148
2018-04-03 10:59:36 -07:00
Alex Eagle 580f05bd9c build: flatten esm5 sources before rollup (#23131)
this is needed to update to latest rules_nodejs due to breaking change in
https://github.com/bazelbuild/rules_nodejs/pull/172
It has the side-effect of correctly marking rxjs packages as side-effect-free

PR Close #23131
2018-04-03 10:47:29 -07:00
Igor Minar 92724b396b build: update to rxjs@6.0.0-rc.0 (#23106)
PR Close #23106
2018-04-03 10:00:24 -07:00
Pawel Kozlowski fa2c9a81dd feat(ivy): ViewContainerRef basic scenarios support (#23021)
PR Close #23021
2018-04-03 09:35:14 -07:00
Miško Hevery 55c9fb298f test(ivy): create todo app in ivy (#22921)
PR Close #22921
2018-04-02 15:49:48 -07:00
Miško Hevery 60065935be refactor(ivy): align compiler with runtime (#22921)
Remove `containerRefreshStart` and `containerRefreshEnd` instruction
from the output.

Generate directives as a list in `componentDef` rather than inline into
instructions. This is consistent in making selector resolution runtime
so that translation of templates can follow locality.

PR Close #22921
2018-04-02 15:49:48 -07:00
Miško Hevery 4290ea4bb9 ci: update to latest rulse_nodejs (#22921)
PR Close #22921
2018-04-02 15:49:48 -07:00
Miško Hevery e7f1af3c54 refactor(ivy): cleanup necessary domino files (#22921)
PR Close #22921
2018-04-02 15:49:48 -07:00
Kara Erickson 85d3b591b6 refactor(ivy): generate pipe names instead of defs (#23104)
PR Close #23104
2018-04-02 09:42:44 -07:00
Kara Erickson 6e5fb99304 refactor(ivy): flatten css selectors (#23074)
PR Close #23074
2018-03-30 15:27:50 -07:00
Alex Eagle 15278784fc release(bazel): change publish-next script to publish bazel artifacts (#23097)
PR Close #23097
2018-03-30 14:03:05 -07:00
Igor Minar 22cb2c9441 build: add missing dependencies on @rxjs//operators needed for rxjs@6.0.0-beta.4 (#23084)
PR Close #23084
2018-03-30 13:07:03 -07:00
Igor Minar 3603a10ea2 build: update to zone.js@0.8.20 (#23084)
PR Close #23084
2018-03-30 13:07:03 -07:00
Igor Minar 6f7d14064c build: update to rxjs@6.0.0-beta.4 (#23084)
PR Close #23084
2018-03-30 13:07:03 -07:00
Kara Erickson e2e80ec61c refactor(ivy): remove pipe references from the template (#23032)
PR Close #23032
2018-03-28 09:17:27 -07:00
Kara Erickson 5a86f7144f fix(ivy): store local variables in data instead of calling loadDirective (#23029)
PR Close #23029
2018-03-28 09:17:05 -07:00
Alex Rickabaugh 884bf0ef09 fix: consistently rewrite Injector to INJECTOR (#23008)
In Ivy mode we rewrite references to Injector to INJECTOR in ngInjectableDef, to fix tree-shaking.

This changes the rewrite to happen always, even in non-Ivy mode, and makes Angular understand
INJECTOR across the board at runtime.

PR Close #23008
2018-03-28 09:14:32 -07:00
Olivier Combe d28ce50067 test(ivy): make sure `goog.getMsg()` is defined before being used (#22998)
PR Close #22998
2018-03-27 17:07:50 -04:00
Veres Lajos de90314304 style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975)
PR Close #22975
2018-03-27 14:51:53 -04:00
Kara Erickson f739f756ce test(ivy): fix flaky tests (#23010)
PR Close #23010
2018-03-27 14:48:50 -04:00
Kara Erickson 910a16a1ff refactor(ivy): remove directive references from template (#22986)
PR Close #22986
2018-03-26 22:33:23 -04:00
Alex Rickabaugh 6f0191744c fix(core): don't override ngInjectableDef in the decorator if present on the type (#22943)
Previously, @Injectable() would generate an ngInjectableDef on the type it was
decorating, even if that type already had a compiled ngInjectableDef, overwriting
the compiled version.

PR Close #22943
2018-03-23 16:13:06 -04:00
Misko Hevery b9cbe83104 docs(ivy): update STATUS.md with compiler work breakdown (#22874)
PR Close #22874
2018-03-23 15:04:55 -04:00
Kara Erickson 49396ca2ae refactor(ivy): move directives into separate array (#22918)
PR Close #22918
2018-03-22 21:23:02 -04:00
Kara Erickson e44f69c387 refactor(ivy): move dir flags to tnode (#22901)
PR Close #22901
2018-03-22 19:19:40 -04:00
Olivier Combe 99711b12f9 test(core): hello world i18n demo (#22654)
PR Close #22654
2018-03-22 19:01:51 -04:00
Matias Niemelä d77bb460b0 revert: docs(ivy): update STATUS.md with compiler work breakdown (#22874)
This reverts commit b524e4b142.
2018-03-22 18:09:45 -04:00
Miško Hevery c84817970e fix(ivy): remove custom tsconfig from render3 (#22913)
PR Close #22913
2018-03-22 18:02:48 -04:00
Misko Hevery b524e4b142 docs(ivy): update STATUS.md with compiler work breakdown (#22874)
PR Close #22874
2018-03-22 18:01:38 -04:00
Miško Hevery 17fb9832f4 fix(ivy): fix type error in newer version of TS (#22897)
Newer version of TS is stricter about types and flags counter-variant
types in some  situations. This change inlines the DirectiveDefArgs
into the arguments which:
1) removes the inheritance which caused the issue and
2) Makes it more friendly to IDEs since they will not report comments.

Closes #22877
Closes #22843

PR Close #22897
2018-03-20 15:49:45 -07:00
Igor Minar 3cc5c2e4d0 build: update to rxjs@6.0.0-beta.0 (#22887)
PR Close #22887
2018-03-20 15:26:49 -07:00
Igor Minar 7d095b96cd fix: correct several esm2015 entry-points in package.jsons (#22892)
PR Close #22892
2018-03-20 13:30:08 -07:00
Alex Eagle 689f351092 build: expose flatModuleOutFile option on ng_module (#22814)
This lets projects like Material change ng_package "bundle index" files to non-conflicting paths

Currently packages like @angular/core ship with the generated metadata
in a path like 'core.js' which overwrites one of the inputs.

Angular material puts the generated file in a path like 'index.js'

Either way these files generated by ng_module rules have the potential
to collide with inputs given by the user, which results in an error.

Instead, give users the freedom to choose a different non-conflicting name.

Also this refactors the ng_package rule, removing the redundant
secondary_entry_points attribute.

Instead, we assume that any ng_module in the deps with a module_name
attribute is a secondary entry point.

PR Close #22814
2018-03-20 13:28:57 -07:00
Igor Minar b43f8bc7d3 feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573)
PR Close #22573
2018-03-19 21:51:51 -07:00
Misko Hevery fc50c77bd3 test(ivy): switch HelloWorld to ivy compiler (#22788)
PR Close #22788
2018-03-19 16:00:38 -07:00
Kara Erickson 1a0cb21538 refactor(ivy): remove unnecessary binding from hello world (#22848)
PR Close #22848
2018-03-19 16:29:45 -05:00
Igor Minar 0bede54b2d style: fix formatting issues on the master branch (#22854)
PR Close #22854
2018-03-18 14:03:26 -07:00
Kara Erickson e27cfd6236 refactor(ivy): split up directiveCreate for tree shaking (#22838)
PR Close #22838
2018-03-18 11:56:35 -07:00
Kara Erickson 1612985e48 refactor(ivy): allow tick and deps to be tree-shaken (#22838)
PR Close #22838
2018-03-18 11:47:44 -07:00
Kara Erickson 4f21d373b7 refactor(ivy): move hostBindings calls out of template (#22833)
PR Close #22833
2018-03-18 11:41:39 -07:00
Igor Minar ce63dc6f95 feat: update the package output of build.sh to APF v6 (#22808)
PR Close #22808
2018-03-18 09:33:51 -07:00
Miško Hevery f258ec67bf docs(ivy): update status of ivy (#22834)
PR Close #22834
2018-03-16 22:20:21 -07:00
Alex Rickabaugh 6ef9f2278f feat(ivy): @NgModule -> ngInjectorDef compilation (#22458)
This adds compilation of @NgModule providers and imports into
ngInjectorDef statements in generated code. All @NgModule annotations
will be compiled and the @NgModule decorators removed from the
resultant js output.

All @Injectables will also be compiled in Ivy mode, and the decorator
removed.

PR Close #22458
2018-03-16 12:57:11 -07:00
Chuck Jazdzewski cedc04c320 docs(ivy): document project status (#22751)
Moves the status reporting from the issue #21706 to a file that
can be updated as changes are being made. This addresses one of the
comments on the issue and allows better tracking of updates to this
status and changes made.

PR Close #22751
2018-03-16 11:27:15 -07:00
Kara Erickson bafdad9083 fix(ivy): cache local names and support multiple locals with same value (#22807)
PR Close #22807
2018-03-16 11:26:38 -07:00
Kara Erickson 9220521149 test(ivy): correct export tests and add query test (#22807)
PR Close #22807
2018-03-16 11:26:38 -07:00
Alex Eagle f9247e4b2e build: enable importHelpers in tsconfig (#22812)
This is the primary tsconfig file used for Bazel builds.
Previously, we enabled this option only for releases.

PR Close #22812
2018-03-15 21:16:03 -07:00
Igor Minar 44de10e2db feat: mark angular packages as side-effect free (#22785)
This flag is picked up by webpack v4 and used for more agressive optimizations.

Our code is already side-effect free, because that's what we needed for build-optimizer to work.

PR Close #22785
2018-03-15 14:52:40 -07:00
Victor Berchet 0ebd577db4 refactor(compiler): Drop support for the deprecated `<template>`. Use `<ng-template>` instead (#22783)
BREAKING CHANGE:

The `<template>` tag was deprecated in Angular v4 to avoid collisions (i.e. when
using Web Components).

This commit removes support for `<template>`. `<ng-template>` should be used
instead.

BEFORE:

    <!-- html template -->
    <template>some template content</template>

    # tsconfig.json
    {
      # ...
      "angularCompilerOptions": {
        # ...
        # This option is no more supported and will have no effect
        "enableLegacyTemplate": [true|false]
      }
    }

AFTER:

    <!-- html template -->
    <ng-template>some template content</ng-template>

PR Close #22783
2018-03-15 14:52:22 -07:00
Kara Erickson 4e6ac185e5 refactor(ivy): double size of DI bloom filter (#22775)
PR Close #22775
2018-03-15 14:49:39 -07:00
Kara Erickson e55bf8fa79 refactor(ivy): access component def through tData (#22771)
PR Close #22771
2018-03-15 14:49:23 -07:00
Alex Eagle 88b3198c80 feat(bazel): change ng_package rule to APF v6 (#22782)
Angular Package Format v6 stops bundling files in the esm5 and esm2015
directories, now that Webpack 4 can tree-shake per-file.

Adds some missing files like package.json to make packages closer to
what we publish today.

Refactor ng_package to be a type of npm_package and re-use the packaging
action from that rule.

PR Close #22782
2018-03-15 11:38:31 -07:00
Adam Plumer cd2ebd22fd fix(platform-server): add styles to elements correctly (#22527)
* Partially reverts #22263 due to lack of total spec compliance
  on the server
* Maintains the camel-case styles fix

PR Close #22527
2018-03-14 14:12:31 -07:00
Miško Hevery 112431db69 test(ivy): add canonical compiler spec for class/style (#22719)
Adds a stub for `elementStyle` and `elementClass` instruction
with a canonical spec for the compiler. The spec shows the the
compiler should be using `elementStyle` and `elementClass` instruction
in place of `[class]` and `[style]` bindings respectively.
PR Close #22719
2018-03-14 12:59:52 -07:00
Miško Hevery a0a01f1e1e refactor(ivy): rename class/style to make space for new instruction (#22719)
Rename:
- `elementClass` (short: `k`) => `elementClassNamed` (short: `kn`)
- `elementStyle` (short: `s`) => `elementStyleNamed` (short: `sn`)

Currently `[class.name]` is `elementClass(0, ‘name’, value)`. We would
like to introduce new binding `[class]` which needs a new instruction
ideally `elementClass(0, value)`. Doing the rename creates space
to create such an instruction in subsequent change.

PR Close #22719
2018-03-14 12:59:52 -07:00
Miško Hevery ae19d071bb test(ivy): add ComponentFixture for cleaner tests. (#22719)
PR Close #22719
2018-03-14 12:59:52 -07:00
Matias Niemelä f5a98f41fe fix(core): remove core animation import symbols (#22692)
This patch removes the deprecated support for animation
symbol imports from @angular/core.

BREAKING CHANGE: it is no longer possible to import
animation-related functions from @angular/core. All
animation symbols must now be imported from @angular/animations.

PR Close #22692
2018-03-14 12:23:51 -07:00
Pawel Kozlowski c09bd67aee fix(ivy): fix views manipulation logic (#22656)
This commit fixes a bug that would result in views insert / remove
even if a view needed only refresh operation.

The crux of the bug was that we were looking for a view to update
only in the LContainer.nextIndex position. This is incorrect as a
view with a given block id could be present later in the views
array (this happens if we about to remove a view in the middle of
the views array).

The code in this fix searches for a view to update in the views array and
can remove views in the middle of the views collection. Previously we
would remove views at the end of the collection only.

PR Close #22656
2018-03-14 12:07:15 -07:00
Michael Giambalvo 37fedd001c feat(core): add task tracking to Testability (#16863)
Allow passing an optional timeout to Testability's whenStable(). If
specified, if Angular is not stable before the timeout is hit, the
done callback will be invoked with a list of pending macrotasks.

Also, allows an optional update callback, which will be invoked whenever
the set of pending macrotasks changes. If this callback returns true,
the timeout will be cancelled and the done callback will not be invoked.

If the optional parameters are not passed, whenStable() will work
as it did before, whether or not the task tracking zone spec is
available.

This change also migrates the Testability unit tests off the deprecated
AsyncTestCompleter.

PR Close #16863
2018-03-14 08:48:48 -07:00
Kara Erickson b1365d1fa8 refactor(ivy): remove directiveRefresh instruction (#22745)
PR Close #22745
2018-03-13 23:29:21 -07:00
Miško Hevery 51027d73cc fix(ivy): Update rollup rule to prevent inlining symbols in debug. (#22747)
The new rollup rule disables inlining symbols in debug mode. This makes 
it look as if there would be more symbols but in reality these are the
symbols which are no longer being inlined.
PR Close #22747
2018-03-13 19:58:30 -07:00
Kara Erickson bd9d4df735 refactor(ivy): remove inputsPropertyName (#22716)
Closes #22591

PR Close #22716
2018-03-13 13:26:15 -07:00
Matias Niemelä 58b94e6f5e feat(animations): expose `element` and `params` within transition matchers (#22693)
PR Close #22693
2018-03-13 09:42:24 -07:00
Alex Rickabaugh db56836425 feat: tree-shakeable providers API updates (#22655)
Rename @Injectable({scope -> providedIn}).

Instead of {providedIn: APP_ROOT_SCOPE}, accept {providedIn: 'root'}.
Also, {providedIn: null} implies the injectable should not be added
to any scope.

PR Close #22655
2018-03-13 09:28:05 -07:00
Marc Laval f95730b8e2 fix(ivy): elements properties should not be stringified (#22683)
PR Close #22683
2018-03-12 13:16:05 -07:00
Chuck Jazdzewski 8449eb8d62 build: upgrade to TypeScript 2.7 (#22669)
Fixes: #21571

PR Close #22669
2018-03-12 09:27:23 -07:00
Kara Erickson aa7dba244b feat(ivy): support checkNoChanges (#22710)
PR Close #22710
2018-03-11 22:16:38 -07:00
Kara Erickson fa451bcd19 feat(ivy): support markForCheck (#22690)
PR Close #22690
2018-03-09 20:29:05 -08:00
Kara Erickson b26a90567c feat(ivy): support attaching and detaching views from change detection (#22670)
PR Close #22670
2018-03-08 23:44:33 -08:00
Kara Erickson 5412e10bcd docs(core): replace ancient live demos (#22665)
PR Close #22665
2018-03-08 16:43:14 -08:00
Igor Minar 489fec1299 feat: update tslib to 1.9.0 (#22667)
BREAKING CHANGE: after this change, npm and yarn will issue incompatible peerDependencies warning

We don't expect this to actually break an application, but the application/library package.json
will need to be updated to provide tslib 1.9.0 or higher.

PR Close #22667
2018-03-08 16:42:34 -08:00
Misko Hevery 2fee5cc095 test(ivy): add injection canonical specs (#22595)
PR Close #22595
2018-03-08 12:09:39 -08:00
Kara Erickson f13f4db9dc refactor(ivy): fix rebase error (#22661)
PR Close #22661
2018-03-08 11:37:42 -08:00
Kara Erickson 4c089c1d93 feat(ivy): support ChangeDetectorRef.detectChanges (#22614)
PR Close #22614
2018-03-07 21:08:25 -08:00
Kara Erickson d485346d3c fix(ivy): lifecycle hooks should be queued for root component (#22614)
PR Close #22614
2018-03-07 21:08:25 -08:00
Marc Laval f64ee15487 feat(ivy): implement pipes (#22254)
PR Close #22254
2018-03-07 20:58:48 -08:00
Marc Laval 5d4fa7f0c8 test(ivy): add canonical examples of bindings on elements (#22403)
PR Close #22403
2018-03-07 20:55:49 -08:00
Miško Hevery 6d1367d297 feat(ivy): provide sanitization methods which can be tree shaken (#22540)
By providing a top level sanitization methods (rather than service) the
compiler can generate calls into the methods only when needed. This makes
the methods tree shakable.

PR Close #22540
2018-03-07 18:24:07 -08:00
Miško Hevery 538f1d980f refactor(core): move sanitization into core (#22540)
This is in preparation of having Ivy have sanitization inline.

PR Close #22540
2018-03-07 18:24:06 -08:00
Miško Hevery 363dfa5437 test(ivy): Back patch example (#22235)
PR Close #22235
2018-03-06 15:02:02 -08:00
Pawel Kozlowski 2c75acc5b3 feat(ivy): add support for the ngProjectAs attribute (#22498)
PR Close #22498
2018-03-06 06:55:51 -08:00
Kara Erickson 2c2b62f45f fix(ivy): preventDefault when listener returns false (#22529)
Closes #22495

PR Close #22529
2018-03-05 12:15:17 -08:00
Misko Hevery 51ca643c27 test(ivy): add injectAttribute spec (#22510)
PR Close #22510
2018-03-05 10:10:32 -08:00
Misko Hevery 69d359bb51 refactor(ivy): break compiler canonical test into smaller files (#22510)
PR Close #22510
2018-03-05 10:10:32 -08:00
Hans Larsen 288851c41e release: add ng update package group metadata to angular (#22482)
"ng update" supports having multiple packages as part of a group which should be updated together, meaning that e.g. calling "ng update @angular/core" would be equivalent to updating all packages of the group (that are part of the package.json already).

In order to support the grouping feature, the package.json of the version the user is updating to needs to include an "ng-update" key that points to this metadata.

The entire specification for the update workflow can be found here: 2e8b12a4ef/docs/specifications/update.md

PR Close #22482
2018-02-28 14:57:53 -08:00
Kara Erickson 9eaf1bbe67 feat(ivy): support injecting ChangeDetectorRef (#22469)
PR Close #22469
2018-02-28 13:35:48 -08:00
Alex Eagle b6c941053e feat(bazel): ng_package adds package.json props (#22499)
We now add the 'main', 'module', 'es2015', and 'typings' properties,
pointing to where the packaging tool lays them out.

Fixes #22416

PR Close #22499
2018-02-28 13:29:56 -08:00
Alex Rickabaugh f8749bfb70 fix(core): export inject() from @angular/core (#22389)
inject() supports the ngInjectableDef-based configuration of the injector
(otherwise known as tree-shakeable services). It was missing from the
exported API of @angular/core, this PR adds it.

The test added here is correct in theory, but may pass accidentally due
to the decorator side-effect replacing the inject() call at runtime. An
upcoming compiler PR will strip reified decorators from the output
entirely.

Fixes #22388

PR Close #22389
2018-02-28 10:44:37 -08:00
Kara Erickson 8c358844dd feat(ivy): support OnPush change detection (#22417)
PR Close #22417
2018-02-28 10:42:11 -08:00
Kara Erickson e454c5a98e refactor(ivy): store creationMode in LView.flags (#22417)
PR Close #22417
2018-02-28 10:42:11 -08:00
Adam Plumer 40ba009e25 fix(platform-server): generate correct stylings for camel case names (#22263)
* Add correct mapping from camel case to kebab case for CSS style
names
* Remove internal CSS methods in favor of native Domino APIs

Fixes #19235

PR Close #22263
2018-02-26 17:46:21 -08:00
Alex Eagle b43b164a61 feat(bazel): add an ng_package rule (#22221)
This produces a directory following the Angular Package layout spec.

Includes integration test coverage by making a minimal ng_package in integration/bazel.
Unit tests verify the content of the @angular/core and @angular/common packages.

This doesn't totally match our current output, but is good enough to unblock some
early adopters.

It re-uses logic from the rollup_bundle rule in rules_nodejs. It should also
eventually have the .pack and .publish secondary targets like npm_package rule.

PR Close #22221
2018-02-23 11:19:04 -08:00
Marc Laval aad431642a refactor(ivy): rename componentRefresh to directiveRefresh (#22395)
PR Close #22395
2018-02-23 09:42:08 -08:00
Marc Laval 7effb0016c fix(ivy): ngOnChanges to receive SimpleChanges with non minified property names as keys (#22352)
PR Close #22352
2018-02-22 17:48:52 -08:00
Matias Niemelä b2f366b3b7 fix(animations): only use the WA-polyfill alongside AnimationBuilder (#22143)
This patch removes the need to include the Web Animations API Polyfill
(web-animations-js) as a dependency. Angular will now fallback to using
CSS Keyframes in the event that `element.animate` is no longer supported
by the browser.

In the event that an application does use `AnimationBuilder` then the
web-animations-js polyfill is required to enable programmatic,
position-based access to an animation.

Closes #17496

PR Close #22143
2018-02-22 16:07:53 -08:00
Marc Laval b3ffeaa22b fix(ivy): OnDestroy hook should not be called twice for a directive on an element (#22350)
PR Close #22350
2018-02-22 13:35:17 -08:00
Trotyl b7544cccc6
feat(core): support metadata reflection for native class types (#22356)
closes #21731

PR Close #22356
2018-02-22 13:22:03 -08:00
Marc Laval 894b098eb3 test(ivy): add missing tests on directive lifecycle hooks (#22368)
PR Close #22368
2018-02-22 11:21:15 -08:00
Victor Berchet 90e9c59e23 Revert "feat(core): support metadata reflection for native class types (#22356)"
This reverts commit 5c89d6bffa.
2018-02-22 10:26:06 -08:00
Trotyl 5c89d6bffa feat(core): support metadata reflection for native class types (#22356)
closes #21731

PR Close #22356
2018-02-21 16:09:27 -08:00
Trotyl a7ebf5aadd fix(core): properly handle function without prototype in reflector (#22284)
closes #19978

PR Close #22284
2018-02-21 14:52:04 -08:00
Marc Laval ee60bb5b36 fix(ivy): pureFunction8 should update the right bindings (#22313)
PR Close #22313
2018-02-20 11:36:50 -08:00
Victor Berchet a8b5465e24 fix(ivy): update master with renamings (#22268)
PR Close #22268
2018-02-18 18:48:41 -08:00
Victor Berchet 9ce495b3d8 refactor(ivy): simplify interpolation instructions (#22268)
PR Close #22268
2018-02-18 18:48:41 -08:00
Victor Berchet d40263447d refactor(ivy): move get functions next to their underlying variable (#22268)
PR Close #22268
2018-02-18 18:48:41 -08:00
Victor Berchet 31c5c1060a docs(ivy): update the API docs instructions to add details about removing attributes (#22268)
PR Close #22268
2018-02-18 18:48:41 -08:00