Commit Graph

217 Commits

Author SHA1 Message Date
Misko Hevery 551d9a1688 chore(LifecycleEvent): change to PascalCase / rename
BREAKING CHANGE

Closes #3863

- LifecycleEvent.onInit => LifecycleEvent.OnInit
- LifecycleEvent.onDestroy => LifecycleEvent.OnDestroy
- LifecycleEvent.onChange => LifecycleEvent.OnChanges
- LifecycleEvent.onCheck => LifecycleEvent.DoCheck
- LifecycleEvent.onAllChangesDone => LifecycleEvent.AfterContentChecked
- OnCheck.onCheck() => DoCheck.doCheck()
- OnChange.onChange() => OnChanges.onChanges()
- OnAllChangesDone.onAllChangesDone() => AfterContentChecked.afterContentChecked

Closes #3851
2015-08-27 22:32:21 -07:00
Misko Hevery 69926dd002 refactor(change_detection): introduce enum ChangeDetectionStrategy
BREAKING CHANGE

Closes #2497

- change detection strategy type changes from string to ChangeDetectionStrategy
- CHECK_ONCE => ChangeDetectionStrategy.CheckOnce
- CHECKED => ChangeDetectionStrategy.Checked
- CHECK_ALWAYS => ChangeDetectionStrategy.CheckAlways
- DETACHED => ChangeDetectionStrategy.Detached
- ON_PUSH => ChangeDetectionStrategy.OnPush
- DEFAULT => ChangeDetectionStrategy.Default
- ON_PUSH_OBSERVE => ChangeDetectionStrategy.OnPushObserve
2015-08-27 21:41:46 -07:00
Jeff Cross 8ed22ce6e7 chore: update all import paths 2015-08-25 15:33:23 -07:00
Marc Laval c2279dd651 fix(build): make e2e tests faster
Closes #3822
2015-08-25 17:04:46 +00:00
Pawel Kozlowski c4044102d6 test(ViewMetadata): use ViewMetadata consistently in tests
Closes #3746
2015-08-23 10:47:23 +00:00
vsavkin a9ce454b21 fix(change_detection): fixed reflect properties as attributes
Closes #3761
2015-08-21 19:08:32 +00:00
vsavkin d2d0715568 feat(change_detection): do not reparse AST when using generated detectors 2015-08-21 05:16:31 +00:00
Misko Hevery b986c54079 chore: remove int in favor for number
Closes #3511
2015-08-21 05:10:31 +00:00
Misko Hevery ea6673947c refactor: rename annotations to metadata
BREAKING CHANGE (maybe)

Well as long as our customers use public API this should not be a
breaking change, but we have changed import structure as well as
internal names, so it could be breaking.

import:
  angular2/annotations => angular2/metadata

Classes:
  *Annotations => *Metadata
  renderer.DirectiveMetadata => renderer.RendererDirectiveMetadata
  renderer.ElementBinder => renderer.RendererElementBinder
  impl.Directive => impl.DirectiveMetadata
  impl.Component => impl.ComponentMetadata
  impl.View => impl.ViewMetadata

Closes #3660
2015-08-17 21:23:25 +00:00
vsavkin 4845583dcf refactor(change_detector): made change detection responsible for processing events
Closes #3666
2015-08-17 15:39:00 +00:00
Caitlin Potter b6ee20846b fix(benchmarks): remove reference to String.prototype.contains()
https://github.com/tc39/tc39-notes/blob/master/es6/2014-11/nov-18.md#51--44-arrayprototypecontains-and-stringprototypecontains

removed String.prototype.contains() from standard, and is not
implemented in most runtimes (SpiderMonkey still being an exception).

Closes #3570
2015-08-12 23:16:57 +00:00
vsavkin 5b5d31fa9a feat(pipe): added the Pipe decorator and the pipe property to View
BREAKING CHANGE:
    Instead of configuring pipes via a Pipes object, now you can configure them by providing the pipes property to the View decorator.

    @Pipe({
      name: 'double'
    })
    class DoublePipe {
      transform(value, args) { return value * 2; }
    }

    @View({
      template: '{{ 10 | double}}'
      pipes: [DoublePipe]
    })
    class CustomComponent {}

Closes #3572
2015-08-12 00:38:40 +00:00
Alex Eagle 643c71740e chore(build): enable type-checking for TypeScript ES6 emit.
This requires delicate handling of type definitions which collide, because
we use TypeScript-provided lib.d.ts for --target=es5 and lib.es6.d.ts for
--target=es6.
We need to include our polyfill typings only in the --target=es5 case,
and the usages have to be consistent with lib.es6.d.ts.
Also starting with this change we now typecheck additional modules,
so this fixes a bunch of wrong typings which were never checked before.

Fixes #3178
2015-08-06 16:57:52 -07:00
Misko Hevery 39b0286d6b fix: remove unused imports 2015-07-31 20:40:33 +00:00
Tobias Bosch dd06a871b7 fix(render): allow to configure when templates are serialized to strings
Introduces the injectable `TemplateCloner` that can be configured via the new token `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN`.

Also replaces `document.adoptNode` with `document.importNode` as otherwise
custom elements are not triggered in chrome 43.

Closes #3418
Closes #3433
2015-07-31 12:04:32 -07:00
Tim Blasi 9e7363f686 refactor(benchmarks): Remove unnecessary style setter
Remove `style` setter that is no longer used / necessary.

Closes #3375
2015-07-31 00:29:02 +00:00
Tim Blasi 192cf9ddf5 refactor(change_detect): Move common fields to AbstractChangeDetector
Move fields common to Dynamic, Jit, and Pregen change detectors into the
`AbstractChangeDetector` superclass to save on codegen size and reduce
code duplication.

Update to #3248, closes #3243
2015-07-29 10:46:49 -07:00
Pawel Kozlowski d894aa9101 feat(compiler): introduce schema for elements
Closes #3353
2015-07-29 19:40:46 +02:00
Tobias Bosch 16e3d7e96e refactor(shadow_dom): remove `ShadowDomStrategy` in favor of `@View(encapsulation)`
BREAKING CHANGES:
- `ShadowDomStrategy` was removed. To specify the encapsulation of a component use `@View(encapsulation: ViewEncapsulation.NONE | ViewEncapsulation.EMULATED | ViewEncapsulation.NATIVE)`
- The default encapsulation strategy is now `ViewEncapsulation.EMULATED` if a component contains styles and `ViewEncapsulation.NONE` if it does not. Before this was always `NONE`.
- `ViewLoader` now returns the template as a string and the styles as a separate array
2015-07-28 22:33:11 -07:00
Tim Blasi 2c9951273a style(dart): Run dartfmt v0.1.8+2 on all pure Dart code
Update formatting for all pure Dart code in the repo.
2015-07-28 12:44:03 -07:00
vsavkin 71bb4b3ee5 feat(change_detection): generate checkNoChanges only in dev mode 2015-07-27 15:50:19 -07:00
Misko Hevery a2bb81c406 Revert "fix(url_resolver): in Dart make package urls relative to AppRootUrl"
This reverts commit 469afda53e.
2015-07-27 14:15:02 -07:00
Misko Hevery c83a3f3372 chore(docs): added more docs for core.ts 2015-07-25 03:20:12 +00:00
yjbanov 469afda53e fix(url_resolver): in Dart make package urls relative to AppRootUrl 2015-07-24 16:37:01 -07:00
Jason Teplitz 771c0170d9 feat(web-workers) Add WebWorker Renderer
Allows angular apps to be rendered from the webworker!
Closes #3052, #3053, and #3097
2015-07-23 18:29:10 -07:00
yjbanov 3531bb7118 feat(bootstrap): remove the need for explicit reflection setup in bootstrap code
BREAKING CHANGES:

Dart applications and TypeScript applications meant to transpile to Dart must now
import `package:angular2/bootstrap.dart` instead of `package:angular2/angular2.dart`
in their bootstrap code. `package:angular2/angular2.dart` no longer export the
bootstrap function. The transformer rewrites imports of `bootstrap.dart` and calls
to `bootstrap` to `bootstrap_static.dart` and `bootstrapStatic` respectively.
2015-07-22 17:02:32 -07:00
Tobias Bosch 854b5b7da8 feat(benchmark): add static_tree benchmark
Static binary component tree of depth 10, i.e. 1024 components.

Current numbers for `pureScriptTime` are:

JavaScript:

Baseline: 27.10+-9%
Ng2: 26.84+-8%
Ng1: 55.30+-14%

Dart:

Baseline: 30.13+-4%
Ng2: 45.94+-3%
Ng1: 128.88+-10%

I.e. in JS we are same speed as baseline right now!

Some background: We had a recent change in the compiler that merges components into their parents already during compilation (#2529). This made Ng2 2x faster in this benchmark (before the Ng2 JS time was 49.59+-14%ms).

Closes #3196
2015-07-22 10:58:50 -07:00
Kevin Moore 1386977a34 chore: cleanup to pubspec.yaml files
Depend on the released version of Dart 1.10
Sort dependencies per convention
2015-07-17 12:34:06 -07:00
Alfonso Presa cd532b00d4 test(e2e): fix error setting style property of DOM element
Fixes the following error in e2e tests: "Cannot set property style of
\#<HTMLElement> which has only a getter".

Closes #2874
2015-07-15 11:37:25 +02:00
Caitlin Potter e1e7912ab2 chore(benchmarks): use `isSupported()` rather than `!isJsObject()`
Seems more accurate, and would allow `isJsObject()` to handle typical
`{}`-literals in dart, which could be useful

Closes #2995
2015-07-14 16:46:25 -07:00
vsavkin 4656c6f5cf tools: added experimentalDecorators flag to tsconfig 2015-07-08 10:46:03 -07:00
vsavkin f0e962c55e feat(di): removed app injector
BREAKING CHANGE:

THe appInjector property has been removed. Instead use viewInjector or hostInjector.
2015-07-01 13:33:43 -07:00
vsavkin 22d3943831 refactor(di): unified di injector and core injector
BREAKING CHANGES:

* InjectAsync and InjectLazy have been removed
* toAsyncFactory has been removed
2015-06-26 15:59:18 -07:00
Victor Berchet b15474c6f2 refactor(TemplateResolver): rename to ViewResolver 2015-06-24 18:40:04 +02:00
Victor Berchet 356c927d12 refactor(TemplateLoader): rename to ViewLoader 2015-06-24 18:40:04 +02:00
Victor Berchet 3ea655918e refactor(Compiler): inline styles before compiling the template 2015-06-24 18:40:03 +02:00
Victor Berchet 06aaa0c50e refactor(UrlResolver): extract app url resolution into AppRootUrl
fixes #1732
2015-06-24 18:40:03 +02:00
Julie Ralph d8929c1d73 fix(benchmarks): add waits for naive scrolling benchmark to ensure loading
Also, simplify selectors.

Closes #1706.
2015-06-22 12:39:59 -07:00
Pawel Kozlowski d7b9345b6d feat(compiler): detect dangling property bindings
BREAKING CHANGE: compiler will throw on binding to non-existing properties.

Till now it was possible to have a binding to a non-existing property,
ex.: `<div [foo]="exp">`. From now on this is compilation error - any
property binding needs to have at least one associated property:
eaither on an HTML element or on any directive associated with a
given element (directives' properites need to be declared using the
`properties` field in the `@Directive` / `@Component` annotation).

Closes #2598
2015-06-20 08:06:07 +02:00
Victor Berchet 1c4d233fe7 fix(ShadowDomStrategy): always inline import rules
fixes #1694
2015-06-19 18:50:30 -07:00
Martin Probst 920982c4e8 chore: update files to match clang-format 1.0.21. 2015-06-19 15:00:32 -07:00
vsavkin f80f97253c refactor(change_detection): made ChangeDetector and ProtoChangeDetector interfaces
List of changes:

- Makes ChangeDetector and ProtoChangeDetector interfaces
- Assigns a unique id to every detector
2015-06-18 17:41:22 -07:00
Martin Probst be7ac9fd41 feat: remove MapWrapper.create()/get()/set().
Better dart2js code, better Angular code.
2015-06-18 14:55:12 -07:00
vsavkin b0e2ebda70 feat(query): added support for querying by var bindings 2015-06-17 16:36:55 -07:00
Martin Probst c7e48350d3 chore: kill ListWrapper.create() and .push().
These wrappers are not natively understood by
ts2dart. Removing them will improve Dart2JS
compilation due to fewer megamorphic calls to List
functions.

It also makes Angular code more succinct and
improves type safety in Angular due to better type
inference of the Array component type.

This change exposed several bugs in Angular.
2015-06-17 16:21:55 -07:00
Tobias Bosch 5dee8e26cc fix(views): remove dynamic component views, free host views, free embedded views
Closes #2472
Closes #2339

BREAKING CHANGE
- `Compiler.compile` has been removed, the only way to compile
  components dynamically is via `Compiler.compileInHost`
- `DynamicComponentLoader.loadIntoExistingLocation` has changed:
  * renamed into `loadIntoLocation`
  * will always create the host element as well
  * requires an element with a variable inside of the host component view
    next to which it will load new component.
- `DynamicComponentLoader.loadNextToExistingLocation` was renamed into
  `DynamicComponentLoader.loadNextToLocation`
- `DynamicComponentLoader.loadIntoNewLocation` is removed
  * use `DynamicComponentLoader.loadNextToLocation` instead
    and then move the view nodes
    manually around via `DomRenderer.getRootNodes()`
- `AppViewManager.{create,destroy}Free{Host,Embedded}View` was removed
  * use `AppViewManager.createViewInContainer` and then move the view nodes
    manually around via `DomRenderer.getRootNodes()`
- `Renderer.detachFreeView` was removed. Use `DomRenderer.getRootNodes()`
  to get the root nodes of a view and detach them manually.
2015-06-17 11:33:51 -07:00
vsavkin 5bfcca2d5b feat(query): notify on changes 2015-06-15 11:10:21 -07:00
Tim Blasi 8e3bf3907a feat(dart/transform): Use the best available Change Detectors
Enable pregenerated (for Dart) and JIT (for Js) change detectors when
possible. Previously we would always use `DynamicChangeDetector`s, but
these cause megamorphic calls and are therefore much slower.

Closes #502
2015-06-12 16:04:09 -07:00
Tobias Bosch d07ed581a9 refactor(benchmark): add view cache param to largetable benchmarks 2015-06-11 14:45:43 -07:00
Tim Blasi b6e95bb96e feat(change detect): Throw on attempts to use dehydrated detector
- Modify change detectors to `throw` when attempting to detect changes
  on a dehydrated detector.
- Modify `DynamicChagneDetector` to use `null` for the `context` of a
  dehydrated detector.
2015-06-08 16:10:41 -07:00