Commit Graph

81 Commits

Author SHA1 Message Date
Alex Rickabaugh 36d6e6076e feat(ivy): support template type check narrowing for *ngFor and *ngIf (#26203)
This commit adds an ngTemplateGuard_ngIf static method to the NgIf
directive and an ngTemplateContextGuard static method to NgFor. The
function of these two static methods is to enable type narrowing
within generated type checking code for consumers of the directives.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh 79466baef8 fix(ivy): remove metadata from *Def and introduce *DefWithMeta types (#26203)
Previously in Ivy, metadata for directives/components/modules/etc was
carried in .d.ts files inside type information encoded on the
DirectiveDef, ComponentDef, NgModuleDef, etc types of Ivy definition
fields. This works well, but has the side effect of complicating Ivy's
runtime code as these extra generic type parameters had to be specified
as <any> throughout the codebase. *DefInternal types were introduced
previously to mitigate this issue, but that's the wrong way to solve
the problem.

This commit returns *Def types to their original form, with no metadata
attached. Instead, new *DefWithMeta types are introduced that alias the
plain definition types and add extra generic parameters. This way the
only code that needs to deal with the extra metadata parameters is the
compiler code that reads and writes them - the existence of this metadata
is transparent to the runtime, as it should be.

PR Close #26203
2018-10-04 10:11:17 -07:00
Matias Niemelä c51331689f refactor(ivy): rename stylingProp => styleProp (#26149)
PR Close #26149
2018-10-01 09:35:22 -07:00
Igor Minar 9993c72335 feat: add support for TypeScript 3.1 (#26151)
PR Close #26151
2018-09-28 09:34:51 -07:00
Kara Erickson 15a2b8f622 fix(ivy): wrapper fns arent necessary anymore (#26108)
PR Close #26108
2018-09-26 00:03:16 -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
Adam Plumer 3fb0da2de5 feat(platform-server): update domino to v2.1.0 (#25564)
PR Close #25564
2018-09-19 16:07:36 -07:00
George Kalpakas 18f129f536 build: upgrade Chromium and ChromeDriver to latest versions (#25602)
PR Close #25602
2018-08-24 11:48:40 -04:00
Kara Erickson d5b70e0c66 fix(ivy): create LViewData from blueprint (#25587)
PR Close #25587
2018-08-22 15:58:42 -04: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 4708cb91ef refactor(ivy): remove reserveSlots instruction (#25533)
PR Close #25533
2018-08-17 14:32:55 -07:00
Pawel Kozlowski 31f0f5b3c3 feat(ivy): add support for local refs on ng-template (#25482)
PR Close #25482
2018-08-17 09:58:07 -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
Pawel Kozlowski 9117fa199c test(ivy): activate local references canonical spec (#25462)
PR Close #25462
2018-08-14 12:01:55 -07:00
Miško Hevery 6e2a1877ab refactor(core): remove withBody from public testing API (#25171)
PR Close #25171
2018-07-31 15:09:32 -07:00
Olivier Combe 22731a7588 refactor(ivy): split i18nInterpolation into 8 functions (#24805)
PR Close #24805
2018-07-24 16:41:05 -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
Matias Niemelä ba3eb8b654 feat(ivy): properly apply class="", [class], [class.foo] and [attr.class] bindings (#24822)
PR Close #24822
2018-07-17 16:33:25 -04:00
Pawel Kozlowski 0399c6972a refactor(ivy): remove content query creation from directive factories (#24811)
PR Close #24811
2018-07-12 16:32:33 -04:00
Kara Erickson 3a19f70d1c refactor(ivy): replace pNextOrParent with TNode props (#24752)
PR Close #24752
2018-07-10 11:12:27 -07:00
Matias Niemelä 3980640d53 feat(ivy): properly apply style="", [style], [style.foo] and [attr.style] bindings (#24602)
PR Close #24602
2018-07-06 13:51:00 -07:00
Ben Lesh 9803cb011e feat(ivy): Add InheritanceDefinitionFeature to support directive inheritance (#24570)
- Adds InheritanceDefinitionFeature to ivy
- Ensures that lifecycle hooks are inherited from super classes whether they are defined as directives or not
- Directives cannot inherit from Components
- Components can inherit from Directives or Components
- Ensures that Inputs, Outputs, and Host Bindings are inherited
- Ensures that super class Features are run

PR Close #24570
2018-06-29 06:42:40 -07:00
Rado Kirov c95437f15d build(bazel): Turning on strictPropertyInitialization for Angular. (#24572)
All errors for existing fields have been detected and suppressed with a
`!` assertion.

Issue/24571 is tracking proper clean up of those instances.

One-line change required in ivy/compilation.ts, because it appears that
the new syntax causes tsickle emitted node to no longer track their
original sourceFiles.

PR Close #24572
2018-06-25 07:57:13 -07:00
Olivier Combe 84272e2227 feat(ivy): runtime i18n (#24037)
PR Close #24037
2018-06-21 13:13:30 -07:00
Pawel Kozlowski 3e1a3b2e32 fix(ivy): support queries for views inserted in lifecycle hooks (#24587)
Closes #23707

PR Close #24587
2018-06-20 16:51:14 -07:00
Alex Rickabaugh 27bc7dcb43 feat(ivy): ngtsc compiles @Component, @Directive, @NgModule (#24427)
This change supports compilation of components, directives, and modules
within ngtsc. Support is not complete, but is enough to compile and test
//packages/core/test/bundling/todo in full AOT mode. Code size benefits
are not yet achieved as //packages/core itself does not get compiled, and
some decorators (e.g. @Input) are not stripped, leading to unwanted code
being retained by the tree-shaker. This will be improved in future commits.

PR Close #24427
2018-06-14 14:36:45 -07:00
Alex Rickabaugh 0f7e4fae20 style(ivy): defeat clang format issue (#24479)
clang-format (on mac) has taken a disliking to this particular line, and
rewrites one of the ɵ characters to an invalid Unicode sequence.

PR Close #24479
2018-06-14 14:15:58 -07:00
Ben Lesh 82c5313740 feat(ivy): namespaced attributes added to output instructions (#24386)
NOTE: This does NOT add parsing of namespaced attributes

- Adds AttributeMarker for namespaced attributes
- Adds test for namespaced attributes
- Updates AttributeMarker enum to use CamelCase, and not UPPER_CASE names

PR Close #24386
2018-06-13 13:28:16 -07:00
Ben Lesh 8dd99ac550 refactor(ivy): add element instruction, reducing output size (#24379)
- Adds an element instruction
- Reduces size of compiled output slightly

PR Close #24379
2018-06-11 14:02:48 -04:00
Victor Berchet 3128b26e5c Revert "feat(ivy): add element instruction (#23899)"
This reverts commit b415010222.
2018-06-06 13:38:19 -07:00
Victor Berchet d96ae123b2 Revert "feat(ivy): SVG now handled by ivy compiler (#23899)"
This reverts commit 1007d1ad27.
2018-06-06 13:38:10 -07:00
Victor Berchet 7e73287676 Revert "feat(ivy): added new namespace and element instructions to JIT environment (#23899)"
This reverts commit acf270d724.
2018-06-06 13:38:00 -07:00
Ben Lesh acf270d724 feat(ivy): added new namespace and element instructions to JIT environment (#23899)
PR Close #23899
2018-06-06 10:22:28 -07:00
Ben Lesh 1007d1ad27 feat(ivy): SVG now handled by ivy compiler (#23899)
PR Close #23899
2018-06-06 10:22:28 -07:00
Ben Lesh b415010222 feat(ivy): add element instruction (#23899)
Adds a simplified element instruction that can be used if an element
has no children.

PR Close #23899
2018-06-06 10:22:27 -07:00
Victor Berchet 4f36340de7 feat(ivy): add support for short-circuiting (#24039)
Short-circuitable expressions (using ternary & binary operators) could not use
the regular binding mechanism as it relies on the bindings being checked every
single time - the index is incremented as part of checking the bindings.

Then for pure function kind of bindings we use a different mechanism with a
fixed index. As such short circuiting a binding check does not mess with the
expected binding index.

Note that all pure function bindings are handled the same wether or not they
actually are short-circuitable. This allows to keep the compiler and compiled
code simple - and there is no runtime perf cost anyway.

PR Close #24039
2018-05-25 13:46:50 -04:00
swseverance fe3679a356 style: remove empty comments (#23404)
PR Close #23404
2018-05-10 15:48:13 -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
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 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
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
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
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
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