Compare commits

...

893 Commits

Author SHA1 Message Date
d53c898499 chore(release): releases alpha.26 2015-06-03 17:36:12 -07:00
552985e305 fix(types): parametrize QueryList. 2015-06-03 17:08:55 -07:00
20e874d3c6 chore(deps): bumps up deps on tsd and ts2dart. 2015-06-03 15:53:03 -07:00
471a1b6d12 fix: format a file that slipped in. 2015-06-03 15:50:45 -07:00
f999d5a156 chore: move to clang-format 1.0.17.
clang-format 1.0.17 substantially improves formatting for fat arrow functions
and array literal detection. It also fixes a number of minor formatting issues.
2015-06-03 15:27:27 -07:00
f74d7727ca fix(build): remove nonexistant dart format task from gulpfile 2015-06-03 15:03:29 -07:00
3baf815d76 feat(forms): added support for status classes 2015-06-03 14:43:46 -07:00
96cadcc29e refactor(forms): handle dirty/pristine explicitly 2015-06-03 14:43:46 -07:00
31b6687894 fix(build): make dart formatter errors more readable
Truncates the output to just the interesting parts
2015-06-03 14:42:24 -07:00
381d4cb30a fix(gulp): prevent duplicate error messages
Closes #2021
2015-06-03 14:42:24 -07:00
5030ffb01c feat(view): introduce free embedded views
Free embedded views are view instances that are created
logically in the same was as views of a ViewContainer,
but their dom nodes are not attached.

BREAKING CHANGE:

- `Renderer.detachFreeHostView` was renamed to
  `Renderer.detachFreeView`
- `DomRenderer.getHostElement()` was generalized into
  `DomRenderer.getRootNodes()`
2015-06-03 14:42:00 -07:00
9ce0870f6c chore(process): document triage process for angular 2 2015-06-03 13:04:52 -07:00
246151b2f9 test(dart/transform): More change detector unit tests
Port some change detector unit tests which formerly ran only on dynamic
& JIT change detection to run for pre-generated Dart change detectors as
well.
2015-06-03 10:37:34 -07:00
83f1856d6a feat(dart/transform): Add support for the safe navigation operator
Adds support for ?. to pregenerated Dart Change Detectors.

Closes #791
2015-06-03 10:37:34 -07:00
c280fe816c fix(benchpress): support nested intervals
Chrome sometimes reports nested `FunctionCall` intervals in the timeline,
which should be ignored for measuring the `script` metric.

Might solve #2116
2015-06-03 10:28:27 -07:00
b071b66b45 fix(tests): disable mobile emulation so benchmarks run on current chrome
Workaround for #2309
2015-06-03 10:28:27 -07:00
fde65c7e88 refactor(angular2/view): Ts'ify view.js
Translates angular2/view to TypeScript.
2015-06-03 09:52:37 -07:00
bae6b91e7d refactor(angular2/angular2_sfx): Allows no-module integration of Angular2
Translates angular2/angular2_sfx to TypeScript in order to allow Angular2 integration without modules.
2015-06-03 09:52:37 -07:00
2b714df64e refactor(test/mock): Ts'ify angular2/test/mock
Translates the last test directory -- angular2/test/mock -- to TypeScript.
2015-06-03 09:52:37 -07:00
c7572ac1f9 feat(fakeAsync): flush the microtasks before returning
fixes #2269
2015-06-03 06:48:08 +02:00
ec3a78289f feat(forms): added touched and untouched to Control 2015-06-02 17:32:41 -07:00
f303f0c17a chore(docs): remove private members from angular2.d.ts 2015-06-02 17:15:49 -07:00
f543834be9 feat(forms): renamed control, control-group into ng-control and ng-control-group 2015-06-02 16:24:08 -07:00
6bef1c4169 feat(forms): changed the selector of TemplatdrivenFormDirective to match <form> 2015-06-02 16:24:08 -07:00
652ed0cf6d feat(form): implemented an imperative way of updating the view by updating the value of a control 2015-06-02 16:24:07 -07:00
559f54e92b feat(forms): added ng-model 2015-06-02 16:24:07 -07:00
17e1d7f117 fix(dartdocs): Hide duplicate exports from guinness.
Duplicate exports were breaking dartdoc builds.

Closes https://github.com/angular/angular/issues/2072.
2015-06-02 16:01:46 -07:00
5fa54a92bc chore(benchpress): add ff extension test to ci
Closes #2229
2015-06-02 15:36:02 -07:00
ba7956f521 fix(render): only look for content tags in views that might have them.
Largetable benchmark with `interpolationAttr` and 200 rows / 20 columns:
Time for destroy/create pair dropped from about 1260ms to about 150ms.

Related to #2298, but does not really fix it as we are still slow
if people are using `<content>`.

Closes #2297
2015-06-02 15:31:07 -07:00
c2fa4b7191 docs(chore): missing reformats to make clang-format 1.0.15 2015-06-02 15:30:04 -07:00
d32f58926d docs(ng-if): fix some missed occurrences of if, for, switch in docs 2015-06-02 15:30:04 -07:00
6a0fe93ba9 chore(docs): fix another link broken by clang-format 2015-06-02 15:30:03 -07:00
1fae8d6377 chore(doc-gen): add template for const docTypes 2015-06-02 15:30:03 -07:00
dc060e8b64 docs(clang): format updates 2015-06-02 15:30:03 -07:00
b746e0c9f0 docs(docgen): tell dgeni to use ts files and fix some bad links 2015-06-02 15:30:03 -07:00
e67b7e87b2 chore(docs): Improve whitespace and semicolons in angular2.d.ts 2015-06-02 15:29:07 -07:00
0a0b84a07d fix(docs): generate d.ts file only for angular2/angular2. 2015-06-02 15:14:45 -07:00
927b4d01a9 chore(travis): update firefox to 38.0 in travis CI
Closes #2295
2015-06-02 14:45:04 -07:00
5035a42287 refactor(examples/e2e_test): Ts'ifying examples/e2_test
Translate AtScript in examples/e2e_test to TypeScript.

Closes #2294
2015-06-02 14:14:46 -07:00
40150379ae fix(Tools): Moves files out of dart2js/**/web.
Fixes bug that only allowed src and packages to be moved out of dart2js/**/web. Globs all files in dart2js/**/web and moves them one directory up.
2015-06-02 13:11:31 -07:00
1d24e2cf23 fix(Global && src/facade && Protractor): Allows List to be imported.
Allows the List type to be imported from 'angular2/src/facade/collection'
2015-06-02 13:11:31 -07:00
9e36539052 fix(src/reflection && src/test_lib): Fixes bugs that caused benchmarks to fail.
Adjusts src/test_lib files to adhere to common TS module practices. Fixes bug with all files that causes benchmarks to fail.
2015-06-02 13:11:30 -07:00
0602f68ae3 refactor (angular2/test_lib): ts'ifying last of test_lib
Translates last .es6 files in angular2/src/test_lib to TypeScript.
2015-06-02 13:11:30 -07:00
2b60d1bae1 refactor (benchmarks/): Ts'ifying benchmarks/
Translating AtScript in benchmarks/ to TypeScript.
2015-06-02 13:11:30 -07:00
0b43e3cf32 refactor(lang_spec): Add missing ;s and clang-format 2015-06-02 21:09:38 +02:00
c9d636aa11 chore(dartanalyzer): Show source for analyzer errors
When showing analyzer feedback, display the source line that caused the
feedback to be generated.

Closes #1192
2015-06-02 12:06:33 -07:00
be88cc7697 chore(build): watch logger should honor ignoreInitial option
It was confusing because the test.unit.dart task does ignore the initial, and
the logger was hardcoded to always ignore the first task, leading to the appearance
that a run was happening twice for no reason.

Also, fixed the "fake ignoreInitial" handling to not rely on a fake event, which
is not necessary.

Closes #2101
2015-06-02 14:07:36 -04:00
ba07f39347 refactor(router): convert to typescript
Fixes #2001
2015-06-02 11:06:44 -07:00
4c8e11a577 fix(ShadowCss): keyframes tests failing in Safari
Closes #2283
2015-06-02 19:23:06 +02:00
3d6c44e2a7 test(KeyEvents): workaround a bug in chrome driver
closes #2253

see https://code.google.com/p/chromedriver/issues/detail?id=553
2015-06-02 14:37:57 +02:00
c60091b949 refactor(Compiler): improve the error message on component load error
by adding the fetched url.

relates to #1460
2015-06-02 12:59:50 +02:00
a504fa835e chore(doc-gen): improve github links to point to the correct tagged URL
Closes #1994
2015-06-02 10:56:23 +01:00
8811337622 refactor(ElementInjector): add interfaces for strategies 2015-06-02 10:09:39 +02:00
921fb9f2ce refactor(Injector): use TS iodioms 2015-06-02 09:53:11 +02:00
e93b5a1d5b refactor(Injector): add an interface for strategies 2015-06-02 09:53:11 +02:00
db7a1f19ba feat(render/dom_renderer): DocumentToken use OpaqueToken
BREAKING CHANGE:

No longer a `const` string. Now a const OpaqueToken
2015-06-01 16:24:36 -07:00
ef27919f7f feat(core/compiler): AppViewPool use OpaqueToken
BREAKING CHANGE:

No longer a `const` string. Now a const OpaqueToken
2015-06-01 16:24:36 -07:00
c571b2693e feat(OpaqueToken): now a const constructor
BREAKING CHANGE:

now a `const` constructor
2015-06-01 16:24:36 -07:00
8bcfb2d465 chore(dart/change_detect): Fix test.unit.dart gulp target
Include Change Detector generation in the `test.unit.dart` gulp task to
fix the change detection unit tests.

Closes #2236
2015-06-01 16:15:53 -07:00
93f464a145 feat(change_detection.ts): export PipeFactory
Closes #2245
2015-06-01 16:14:02 -07:00
95b7896d9b chore: cache Dart .pub-cache directory
Closes #2255
2015-06-01 16:10:07 -07:00
ad26bed0ed chore(shrinkwrap): add shrinkwrap for firefox-profile/jpm
and update package.json for benchpress

closes #2264
2015-06-01 16:04:38 -07:00
62a95823e0 fix(selector): support multiple :not clauses
Fixes #2243
2015-06-01 14:24:19 -07:00
c8d83dba7d chore(tsconfig.json): fix invalid json 2015-06-01 18:56:14 +02:00
22f5925202 fix(facade): Make PromiseWrapper#all semantics equivalent
The semantics between ES6 `Promise#all` and Dart's `Future#wait` are
different for values that are not `Promise`/`Future`s. In ES6,
non-`Promise` values are immediately completed to their current value.
In Dart, non-`Future` values cause an error.

Updated Dart's `PromiseWrapper#all` implementation to conform to the ES6
spec.
2015-06-01 07:26:46 -07:00
cd52d8a3be fix(forms): disabled form tests on cjs until fakeAsync is fixed 2015-05-30 11:56:38 -07:00
a9d6fd9afa feat(forms): implemented template-driven forms 2015-05-30 11:56:00 -07:00
5c53cf6486 fix(fake_async): fixed fakeAsync to throw instead of crashing on cjs 2015-05-30 11:55:17 -07:00
74882c6c38 feat(test): added not.toBeNull 2015-05-30 11:54:10 -07:00
c8947d77bf chore(material): move dialog to TypeScript. 2015-05-29 17:19:44 -07:00
4f3acdb004 docs(shrinkwrap): correct directory path 2015-05-29 17:04:05 -07:00
6404dd8293 refactor (angular2/src/dom): tsifying angular2/src/dom
translates parse5_adapter.cjs to typescript

Closes #2230
2015-05-29 17:01:05 -07:00
f19970a481 feat(transformers): added support for lifecycle events 2015-05-29 16:40:34 -07:00
6f0631c978 build(gulp): remove unnecessary stream merging in build.tools
Also remove the reporter config which is wrong and has no effect.

Closes #2209
2015-05-29 16:11:43 -07:00
e5d06e479a feat(broccoli): add incremental dartfmt plugin
Closes #2211
2015-05-29 18:55:37 -04:00
d523613329 test(di): added a test verifying hierarchical injection 2015-05-29 15:52:46 -07:00
cfcae6b293 Update CONTRIBUTING.md 2015-05-29 15:32:31 -07:00
000a8e25a2 fix(dart/transform): Fix DirectiveMetadata read tests 2015-05-29 14:56:42 -07:00
8a3b0b366f feat(dart/transform): Generate ChangeDetector classes
Use the `ProtoViewDto` created by the render `Compiler` to create a
`ChangeDetectorDefinition`.

From there, generate a subclass of `AbstractChangeDetector` for each
`ChangeDetectorDefinition`.

Run some basic unit tests for the dynamic and JIT change detectors on
pre-generated change detectors.
2015-05-29 14:48:53 -07:00
383f0a1f30 fix(benchpress): add index to root of module
This is necessary when using require('benchpress') in node.
2015-05-29 14:38:29 -07:00
e323c07ab9 refactor(benchpress): convert src and test to typescript
Fixes #2007
2015-05-29 14:02:58 -07:00
f9908cd436 feat(test): add element probe
Usage: bootstrap the app with the special binding
`ELEMENT_PROBE_CONFIG` from `angular2/debug`.
This will provide a global method `ngProbe(element)` that
will expose a `DebugElement` with directive instances, ... on it.

During tests that use Angular's test injector, the probe is
enabled by default. The `DebugElement ` can be retrieved via the
function `inspectDomElement` of `angular2/debug`. Note
that the `TestComponentBuilder` already returns `DebugElement `s.

Closes #1992
2015-05-29 12:44:21 -07:00
24bc4b66d0 fix(render): don’t store a document fragment as bound element
When a template contains bound text nodes as root nodes,
we used to store the document fragment that we got from
cloning `template.content`. However, this fragment will be
empty as soon as the view gets attached. Now we store
`null` instead of the document fragment in this case.

Also groups the 3 cases in `_createView` so they are easier to
understand.
2015-05-29 11:33:23 -07:00
2351896cc0 fix(dom): allow to correctly clone document fragments 2015-05-29 11:33:23 -07:00
307011a96c fix(dom): querySelectorAll should only query child nodes 2015-05-29 11:33:22 -07:00
6f3368ef16 feat(dom): add setData() method. 2015-05-29 11:33:22 -07:00
cdf791f0c5 feat(facade): add read/write access to global variables 2015-05-29 11:33:22 -07:00
75578f41e7 feat(view): add AppViewListener interface
Basic functionality how element probe is hooked into
the system.
2015-05-29 11:33:22 -07:00
ffb219fb91 style(dart): Format Dart source with dart_style 0.1.8 2015-05-29 10:42:47 -07:00
eb2784eb81 refactor(core.js): export NgZone
Export NgZone so it can be used in applications where large data streams should be processed outside of Angular.
2015-05-29 17:58:32 +02:00
28ee0612cb feat(router.js): export router injectables
Exporting: `RootRouter`, `RouteRegistry`, `BrowserLocation`,
`Location`,  and `Pipeline`.
2015-05-29 17:56:00 +02:00
a80921b45d fix(binding): unbalanced curly brackets in documentation 2015-05-29 17:54:51 +02:00
0db88f34b8 refactor(annotations): stricter types 2015-05-29 11:44:45 +02:00
35f0ee510a refactor(transformer): updates in properties syntax 2015-05-29 11:44:44 +02:00
d7df853bde feat(Directive): convert properties to an array
fixes #2013

BREAKING CHANGE:

Before

    @Directive(properties: {
      'sameName': 'sameName',
      'directiveProp': 'elProp | pipe'
    })

After

    @Directive(properties: [
      'sameName',
      'directiveProp: elProp | pipe'
    ])
2015-05-29 11:44:43 +02:00
0387221da8 fix(ast): fix the size of a list in _evalListCache 2015-05-29 08:07:43 +02:00
c39c8ebcd0 feat(change_detection): added onInit and onCheck hooks 2015-05-28 16:46:22 -07:00
5d2af54730 feat(dart/transform): Improve constant evaluation
Use `package:analyzer`'s `ConstantEvaluator` to read from the AST.
This cleanly builds values for us from adjacent strings, interpolations,
etc.
2015-05-28 15:18:22 -07:00
a9be2ebf1b feat: add support for the safe navigation (aka Elvis) operator
fixes #791
2015-05-28 23:03:30 +02:00
ec2d8cc2c8 feat(binding): throw on binding to a blank alias
fixes #2068
2015-05-28 22:37:29 +02:00
05d66bba3f fix(test): clang formatting errors 2015-05-28 13:30:45 -07:00
b14417498a build(broccoli): reorder tree-differ specs 2015-05-28 11:44:37 -07:00
05becf8431 style(build): reorder imports 2015-05-28 11:44:37 -07:00
160c38b5ca build(broccoli): improve error messaging from TreeDiffer 2015-05-28 11:44:37 -07:00
9b0fa0dedc build(broccoli): TreeDiffer should log associated plugin name rather than inputPath
Usually we don't care what we are diffing, but why we are diffing it. With this change we see what is causing build slowdown
due to diffing.
2015-05-28 11:44:37 -07:00
533c64d4ea build(gulp): remove obsolete watch.js.dev build task 2015-05-28 11:44:37 -07:00
c1157d62a8 build(broccoli): update broccoli.d.ts docs 2015-05-28 11:44:37 -07:00
7b1e9286d8 build(broccoli): add tree-stabilizer plugin to deal with unstable trees
Previously we assumed that all input and ouput paths for broccoli trees are immutable, that turned out to be
incorrect.

By adding a tree stabilizer plugin in front of each diffing plugin, we ensure that the input trees
are stable. The stabilization is done via symlinks which is super cheap on platforms that support
symlinks. On Windows we currently copy the whole input directory, which is far from ideal. We should
investagate if using move operation on Windows is ok in the future to improve performance.

Closes #2051
2015-05-28 11:44:36 -07:00
01fb8e6635 fix: fix clang errors 2015-05-28 11:08:26 -07:00
9d90128463 refactor(ChangeDetection): convert change detection tests to typescript 2015-05-28 10:01:30 -07:00
34cfc9f474 feat(di): added optional self parameter to Parent, Ancestor, and Unbounded 2015-05-28 09:53:06 -07:00
ebe1e73b1a refactor (test/test_lib): Ts'ifying test/test_lib
Translates AtScript files in test/test_lib to TypeScript.

Closes #2183
2015-05-28 09:50:59 -07:00
8ce0a67c81 refactor (test/services): Ts'ifying test/services
Translates AtScript files in test/services to TypeScript

Closes #2193
2015-05-28 09:48:38 -07:00
c065fb1422 feat(dart/transform): Remove unnecessary .ng_deps.dart files
Removes `.ng_deps.dart` files which

1. Do not register any `@Injectable` classes
2. Do not call `initReflector` on any other `.ng_deps.dart` files.

Closes #1929
2015-05-28 07:51:10 -07:00
cda35101df fix(facade): Fix bug in TS indexOf
startIndex defaults to -1, which in Chrome results in returning -1
regardless of the other parameters.

Added regression tests.
2015-05-28 06:56:24 -07:00
c32dbad747 feat(tests): add TestComponentBuilder
Adds a TestComponentBuilder for use in component level tests.
For usage examples, see test_component_builder_spec

Closes #1812
2015-05-27 17:15:13 -07:00
30b6542fc8 feat(core): added support for detecting lifecycle events based on interfaces 2015-05-27 16:23:42 -07:00
2b6a653050 feat(core): added missing interfaces for onDestroy and onAllChangesDone lifecycle events 2015-05-27 15:50:08 -07:00
34d75e8918 feat(reflector): added a method to get type's interfaces 2015-05-27 15:50:08 -07:00
2c25055828 chore: reformat the code base using the clang-format 1.0.15. 2015-05-27 15:28:22 -07:00
96f629d441 chore: upgrade clang-format to 1.0.15. 2015-05-27 15:28:22 -07:00
a2770c8a52 refactor(change_detect): Flatten Js change detector template
Update the `ChangeDetectionJITGenerator` for clarity and similarity with
the upcoming Dart generated `ChangeDetector` classes.
2015-05-27 11:50:25 -07:00
4a3fd5e855 fix(di): allow @Inject(…) to work in dart2js and dynamic reflection
Note: We can’t write a unit test for this as our unit tests
are running in Dartium, where the error does not occur.
However, we previously had a failure in our e2e tests
in `hello_world/index_dynamic.html`
when removing the TODOs in `application.ts`.

Closes #2185
2015-05-27 10:33:30 -07:00
608017776e fix(package.json): add reflect-metadata to package.json
Fixes #2170
2015-05-27 10:32:38 -07:00
0c7f05f56a fix(injectable): add missing @Injectables annotations
Closes #2173
2015-05-27 10:31:20 -07:00
c6335c128e feat(test_lib): add method to compare stringified DOM element
Closes #2106
2015-05-27 16:19:39 +02:00
fb42d5908e fix(test): solve CSS discrepancies across browsers
Closes #2177
2015-05-27 14:54:00 +02:00
8609543ad0 refactor (test/facade): Ts'ify test/facade
Translate AtScript in test/facade to TypeScript
2015-05-27 08:10:11 +02:00
f83f1ee0ce fix(example): unused event 2015-05-27 08:09:55 +02:00
1db6870a81 docs(ng_for.ts): For => NgFor 2015-05-27 08:09:42 +02:00
c19c69f336 refactor(forms): remove self closing wrap <label>s
html5 doesn't have self closing tags
breaks `stringifyElement` from
https://github.com/angular/angular/pull/2106

also an error with submit form and wrap with <label>s
2015-05-27 08:09:26 +02:00
b390f441a1 feat(benchpress): Add extension for ff metrics reporting
Closes #1976
2015-05-26 17:30:41 -07:00
79f564be46 refactor(core): ts’ify tests 2015-05-26 17:01:31 -07:00
23d59df81a feat(test_lib): add containsRegex 2015-05-26 17:01:31 -07:00
ef3e12e803 refactor (test/directives): ts'ify test/directives
Translate all of the AtScript code in .../test/directives to TypeScript.

Closes #2167
2015-05-26 16:51:38 -07:00
5fe88d63ef chore: support the latest release of Dart logging package 2015-05-26 13:51:54 -07:00
0f3a8f369a chore(material): migrate most components to TypeScript. 2015-05-26 13:35:44 -07:00
26d5d17ebe style: fix clang-format glitches 2015-05-26 21:00:44 +02:00
bb7ffce7eb test(ShadowCss): add tests for keyframe rules 2015-05-26 19:42:17 +02:00
551586ced0 feat(RegExpWrapper): implement a test method 2015-05-26 19:42:17 +02:00
1dc8ba6920 refactor(render): ts’ify tests 2015-05-26 09:38:26 -07:00
d773b6a00a fixed(spy): support SpyObject in Typescript as well
- allow `@IMPLEMENTS` as a decorator
- implement empty `noSuchMethod`
2015-05-26 09:25:16 -07:00
f6cd26b0a6 docs(docgen): fixed a typo that was breaking dgeni 2015-05-22 21:47:34 -07:00
5a52c0b71d docs(di): fix missing export for dgeni docgen 2015-05-22 21:47:34 -07:00
662da0d728 feat(render): re-export render and export DirectiveResolver
Closes #2026
2015-05-22 17:38:00 -07:00
df59e969cf chore(di): moved tests to typescript 2015-05-22 17:32:21 -07:00
d27e5512c0 chore(reflection): tsfy tests 2015-05-22 17:03:40 -07:00
d48fae3566 fix(core): resurrect OnChange interface 2015-05-22 16:48:00 -07:00
3525c9c074 chore(forms): moved tests/forms to typescript 2015-05-22 14:44:57 -07:00
05774f6c8a fix(build): also run ts tests in node. 2015-05-22 13:19:58 -07:00
16447ce75c chore(build): improve messaging when using clang-format 2015-05-22 10:10:22 -07:00
15f1eb28a2 fix(deps): Update clang-format to 1.0.14. 2015-05-22 09:39:15 -07:00
e50f537667 build(gulp): turn off dartfmt logs by default
Closes #2105
2015-05-22 12:18:42 -04:00
ed8364741b refactor(form example): TSify 2015-05-22 17:45:57 +02:00
6c1cb089b5 refactor(examples): ts’ify
relates to #2008
2015-05-22 16:48:29 +02:00
4b98ed114e fix(collection): iterator on Map keys is not supported (Safari)
Closes #2096
2015-05-22 15:41:01 +02:00
d308e55e12 fix(collection): new Map(iterable) is not supported (Safari) 2015-05-22 15:40:44 +02:00
10bc7e948c feat(key_event): alias esc to escape
fixes #2010
2015-05-22 15:39:21 +02:00
9988471fb8 test(fakeAsync): renable a test blocked on jasmine 2.3.3 2015-05-22 15:36:12 +02:00
05fa9bc9fb feat(router): add the router bundle to the bundle task. 2015-05-22 15:31:09 +02:00
57b88ec2d6 fix(collection): new Set(iterable) is not supported (IE11, Safari)
Closes #2063
2015-05-22 15:16:49 +02:00
b1c9bf14b2 feat(ElementInjector): support an arbitrary number of bindings
fixes #1853
2015-05-22 13:42:53 +02:00
588fbfd848 fix(test): use a not expandable CSS rule in ShadowCSS spec (Firefox)
Closes #2061
2015-05-22 13:32:24 +02:00
b2a24e021f fix(browser_adapter): HTMLStyleElement.innerText does not trigger creation of CSS rules (Firefox) 2015-05-22 13:32:07 +02:00
661a04798e fix(test): adds longer timers for NgZone and PromisePipe tests (IE11)
Closes #2055
2015-05-22 13:30:49 +02:00
665ccafd73 fix(browser_adapter): event creation fails (IE11, Firefox) 2015-05-22 13:30:48 +02:00
f35dbb99b5 fix(browser_adapter): element.getBoundingClientRect fails when element not in DOM (IE11) 2015-05-22 13:30:47 +02:00
a393f84fa4 fix(browser_adapter): element.matches only available with prefix (IE11) 2015-05-22 13:30:47 +02:00
92c2c33a84 fix(browser_adapter): assigning null to document.title sets the title to "null" (IE11, Firefox) 2015-05-22 13:30:46 +02:00
9802debf71 fix(test): native shadow DOM is required (IE11, Firefox) 2015-05-22 13:30:45 +02:00
2287938f5a fix(router): event.defaultPrevented is not reliable (IE11) 2015-05-22 13:30:44 +02:00
5103f080e9 fix(test): function.name is not available (IE11) 2015-05-22 13:30:44 +02:00
1f20ef9787 feat(router.js): export routerDirectives 2015-05-22 12:45:26 +02:00
1ad6558229 fix(examples): update form example to use NgIf 2015-05-22 12:32:13 +02:00
d61a0dfa22 test(ObservablePipe): onDestroy shouldn't throw 2015-05-22 12:31:46 +02:00
ac510b67cc chore(docs): update npm-shrinkwrap.readme.md instructions
Closes #2043
2015-05-22 00:13:20 -07:00
5ed091e260 build(gulp): fix test.unit.dart
- format code for the first run
- don't run tests if first build fails

Closes #1647
2015-05-21 23:50:56 -07:00
cc2c8f6b00 refactor(test): ts’if compiler integration tests. 2015-05-21 17:53:53 -07:00
c28952c707 chore(release): bump version to alpha.25 2015-05-21 17:37:45 -07:00
30c3e5a84e fix(forms): changed forms to create only one value accessor instead of always creating DefaultValueAccessor 2015-05-21 17:31:25 -07:00
2ff3873881 chore(transformers): remove bindProperty hack 2015-05-21 16:58:32 -07:00
aec51d616b refactor(ts'ify): ts’ify mocks, directives and test_lib
Also cleans up global types.
2015-05-21 15:33:37 -07:00
c5996529c3 chore(expressions): add explicit test for map vs property access 2015-05-21 14:41:26 -07:00
00c3693daa feat(forms): migrated forms to typescript 2015-05-21 13:55:15 -07:00
fed86fc8ac feat(injector): support forwardRef in toAlias 2015-05-21 09:52:43 -07:00
705ee46f31 fix(di): changed host and view injector to respect visibility 2015-05-21 09:17:56 -07:00
f210c41c1f feat(di): changed toFactory to support dependency annotations 2015-05-21 08:34:48 -07:00
863eb3c559 chore(testing): update karma-jasmine and jasmine
Jasmine to jasmine-core 2.3.4.
Update tools tests using minijasminenode to directly use jasmine.

See #1860
2015-05-20 21:34:56 -07:00
b6b52e62b2 fix(element_injector): fixed element injector to inject view dependencies into its components 2015-05-20 17:48:04 -07:00
dd9b08cce8 chore(testing): update protractor to version 2.1.0 2015-05-20 17:28:23 -07:00
e61d82b9be refactor(core): ts’ify core 2015-05-20 16:30:41 -07:00
aabc898f3b chore: fix race condition during build. 2015-05-20 16:21:38 -07:00
bdeac30a96 chore: bump ts2dart to 0.5.6 2015-05-20 16:07:27 -07:00
4afd2b4138 feat(PromisePipe): remove ref onDestroy 2015-05-20 14:00:57 -07:00
dee4ecbb3f build(gulp): fix typo in the npm version warning message 2015-05-20 11:32:46 -07:00
4210b0e66a build(broccoli-typescript): refactor output removal
this is just to make the code a bit more easier to follow
2015-05-20 11:30:45 -07:00
2d6c44b54a build(broccoli-typescript): do full rebuild after we recover from incremental failures
this is to ensure that we are not reporting success if unchanged files still contain errors.
2015-05-20 11:30:44 -07:00
c45283216f fix(router): router link should navigate to non-base Url.
While still displaying full base + custom part of url in the href.
2015-05-20 11:01:09 -07:00
826af401a9 fix(test_lib): fixes nested beforeEach. 2015-05-20 11:01:09 -07:00
28c2b8f432 fix(element_injector): fixed element injector to resolve dependencies of regular services 2015-05-20 10:56:33 -07:00
c9ab8e4be8 fix(browser): template elements should have content imported instead of the element itself. 2015-05-20 10:31:12 -07:00
1054f6a9ab build(gulp): watcher should not trigger more than once during init
Closes #2037
2015-05-20 09:33:29 -07:00
f6eeb9aa66 chore(doc-gen): dgenerate the type definition file for angular2
Closes #2017
Closes #1966
2015-05-20 12:23:59 +01:00
91ccc9af98 fix(XHRImpl): fix errors, add a spec
fixes #1715
2015-05-20 08:31:50 +02:00
ec90fcd290 build(test): remove unecessary require in karma.conf 2015-05-20 08:28:38 +02:00
a664f5a6de fix: don't call onAllChangesDone on checkNoChanges 2015-05-20 08:27:48 +02:00
7643d979c7 docs(annotations): fixes 2015-05-20 08:23:35 +02:00
d18463dcdc build(gulp): exec karma run in a new process to avoid duplicate output
This is not an ideal solution, but I couldn't find another way to supress the output from the runner.

Closes #1813
2015-05-19 23:15:53 -07:00
f9f917bfa4 build(gulp): fix cleanup.builder task
- wait for the cleanup to finish (it's async) before exiting on ctrl+c
- wait for the cleanup to finish (it's async) onBeforeExit
- remove tmp directory during onBeforeExit to cleanup past leaks

Closes #1919
2015-05-19 23:15:53 -07:00
e89bf01c2b build(gulp): don't throw exceptions on exit when angularBuilder was not initialized 2015-05-19 23:15:53 -07:00
d04a515eb0 build(gulp): refactor existing cleanup tasks
the current complexity is unjustified necessary
2015-05-19 23:15:53 -07:00
0ae89ac096 feat(CD): add support for === and !==
relates to #1500
2015-05-20 07:50:43 +02:00
6ec5d5daaf refactor(async): extract timer related functions into a TimerWrapper 2015-05-20 07:47:46 +02:00
62b1a08f06 refactor(reflection): improved error message 2015-05-19 21:17:52 -07:00
c54f5e0ba2 build(broccoli-typescript): do a global emit during the first run
reduces the time spent in TSC for the initial build to 1 sec (down from 23sec).
2015-05-19 17:41:50 -07:00
37a8f1037e build(broccoli-typescript): add missing semicolon 2015-05-19 17:41:50 -07:00
4ba81bf3eb build(node_tree): fix broken test.unit.cjs task which breaks on rebuild 2015-05-19 17:40:50 -07:00
c204835969 style(nodeTree): fix formatting
the formatting was messed up due to https://github.com/angular/clang-format/issues/7.

I replaced the fat arrow function with regular function expression to resolve the formatting issue
2015-05-19 17:39:57 -07:00
ac28ac324d fix(gulp): continue watching when tasks throw
Closes #1915
2015-05-19 16:15:34 -07:00
8aa3fcfb63 chore(build): don’t include export var __esModule = true in every file
But do it during the build process for cjs.
Right now we only need this when we transpile from ts
directly to es5. This is only the case in our
cis build, as for our browser build we only transpile
from ts to es6 via ts and then use traceur to do
the rest.
2015-05-19 15:12:59 -07:00
1beadb8607 refactor(render): ts’ify render api 2015-05-19 15:12:59 -07:00
bd8724e652 chore(build): bump ts2dart version to 0.5.5 2015-05-19 15:12:58 -07:00
73d15edef5 chore(build): add tsconfig.json to modules/angular2
This allows to use `tsc` directly on Angular2, e.g.
```
./node_modules/.bin/tsc -w -p modules/angular2/
```
2015-05-19 15:12:58 -07:00
adaa157317 chore(packaging): bump version to 2.0.0-alpha.24 2015-05-19 14:47:59 -07:00
791caf0037 fix(router): use appRootComponentToken to get root route configs
Closes #1947
2015-05-19 14:36:45 -07:00
8ab773538b fix(errors): require passing stack traces explicitly in ng2 own code 2015-05-19 12:48:00 -07:00
5c88f662cd chore(deps): bump ts2dart version 2015-05-19 10:43:18 -07:00
cd7aef2139 chore(doc-gen): fix up tests to work on linux 2015-05-19 14:38:11 +01:00
50c6efa187 chore(doc-gen): fix paths for links to modules and exports 2015-05-19 14:38:10 +01:00
302c5d5005 chore(doc-gen): paths now start with a slash 2015-05-19 14:38:10 +01:00
b6b9ede425 chore(doc-gen): include interfaces in the possible exports from a module 2015-05-19 14:38:10 +01:00
118f0520a2 chore(doc-gen): get CompilerHost to return the SourceFiles with the correct fileName
Now that we are not changing the working directory, we needed to update how
getSourceFiles works to ensure that it worked relative to the baseDir.
2015-05-19 14:38:10 +01:00
ba80bd43ad chore(doc-gen): fix text mock code 2015-05-19 14:38:10 +01:00
ed6298c33f chore(doc-gen): speed up class member sorting 2015-05-19 14:38:10 +01:00
db5486a347 chore(doc-gen): use actual TypeScript SymbolFlags enum rather than magic number 2015-05-19 14:38:10 +01:00
b9b58f7ed9 chore(doc-gen): speed up class member sorting 2015-05-19 14:38:10 +01:00
33f5aafd6c chore(doc-gen): formatting 2015-05-19 14:38:09 +01:00
4b34ef9036 chore(doc-gen): remove unused signature 2015-05-19 14:38:09 +01:00
8c409e9251 chore(doc-gen): improve error handling for missing declaration params 2015-05-19 14:38:09 +01:00
398e70ad39 chore(doc-gen): allow class member sorting to be configured 2015-05-19 14:38:09 +01:00
9407c12923 chore(doc-gen): clarify and improve matching of exports to ignore
Previously this was a bit cryptic as we just had a `hideSpecialExports` flag.
Now it ignores exports that match an array of regexes, with the default case
being those exports called `___esModule`.
2015-05-19 14:38:09 +01:00
a4693ef679 squash-me: remove unnecessary (and very naughty) chdir() call 2015-05-19 14:38:09 +01:00
9d5f760597 chore(doc-gen): chore(doc-gen): add TypeScript parsing 2015-05-19 14:38:09 +01:00
8bebcfb844 chore(doc-gen): relax link matching 2015-05-19 14:38:09 +01:00
8a0eb08745 chore(doc-gen): relax link matching 2015-05-19 14:38:08 +01:00
1dce4699de chore(doc-gen): relax link matching 2015-05-19 14:38:08 +01:00
7bff919782 chore(doc-gen): add TypeScript parsing 2015-05-19 14:38:08 +01:00
c6dc78183d chore(doc-gen): relax link matching 2015-05-19 14:38:08 +01:00
9a72f19b97 chore(doc-gen): add TypeScript parsing 2015-05-19 14:38:08 +01:00
25a952755e chore(doc-gen): remove Traceur bits 2015-05-19 14:38:08 +01:00
b2da2978ee chore(doc-gen): move inline link matching to dgeni-package 2015-05-19 14:38:07 +01:00
8b9400ad92 docs(di/injector): remove invalid tab chars
These tabs were breaking the jade syntax generation
2015-05-19 14:38:07 +01:00
3571450b42 docs(directives.js): remove invalid asterisk
This character was breaking the doc-gen
2015-05-19 14:38:07 +01:00
72bb5bdd5a chore(doc-gen): fix path to modules on angular.io 2015-05-19 14:38:07 +01:00
04a9eb8820 fix(build): npm shrinkwrap to pick up changed SHA1.
ts2dart's node-source-map-support dependency was updated to match the main
line patch, but this changed the SHA in the existing repo, breaking Angular's
shrink wrapped dependency.

This update changes the dependency back to an existing SHA.
2015-05-19 11:17:13 +02:00
0f002a5b18 feat(fakeAsync): allow simulating the passage of time 2015-05-19 06:51:15 +02:00
b066b8d15a feat(di): added hostInjector and viewInjector to the Directive annotation 2015-05-18 18:30:53 -07:00
7b511462af refactor(core): renamed injectables into appInjector
BREAKING CHANGES

Before:

@Component({injectables: [Type]} class MyCmp{}

After:

@Component({appInjector: [Type]} class MyCmp{}
2015-05-18 18:30:52 -07:00
3a53f67911 feat(di): removed publishAs
BREAKING CHANGES

Removes the publishAs property from the Component annotation.
2015-05-18 18:30:52 -07:00
155b1e2b35 feat(pipe): reexported pipes to genereate docs 2015-05-18 18:24:26 -07:00
aad5795408 fix(tree-differ): treat symlinks to deleted paths as removals
Previously, tree-differ would not correctly handle symlinks to deleted files, resulting in
an ENOENT errno being tossed by libuv.

This change fixes this to ensure that symlinks are safely handled, performantly.

Closes #1961
2015-05-18 20:36:29 -04:00
83b97c485b refactor(router): use DynamicComponentLoader instead of ViewContainer 2015-05-18 15:57:08 -07:00
5db89071d4 fix(router): improve route matching priorities 2015-05-18 15:57:08 -07:00
c29ab86d85 refactor(router): improve control flow of descendant route activation 2015-05-18 15:57:08 -07:00
6b02cb9b44 test(router): rename helpers in test 2015-05-18 15:57:08 -07:00
88c607da03 chore: update README with badges 2015-05-18 15:29:08 -07:00
f9fd4926ef docs(pipes): fix @View
we all copy/pasta ObservablePipe which had the typo

Closes #1958
2015-05-18 14:34:37 -07:00
986038242a feat(change_detection): json pipe
Closes #1957
2015-05-18 14:34:37 -07:00
8e84f8a1c4 chore: don't throw if paramTypes is undefined.
Closes #1955
2015-05-18 14:34:37 -07:00
edfbc25768 style(change detect): Fix typo unitialized => uninitialized
Closes #1928
2015-05-18 14:34:37 -07:00
05a1c6c183 perf(compiler): Avoid unnecessary List concats
Update `BindingRecordsCreator#getBindingRecords` and `ProtoRecordBuilder#addAst`
to avoid unnecessary calls to `ListWrapper.concat`.

Closes #1905
2015-05-18 14:34:36 -07:00
534cbb4bf5 refactor(benchmarks): Update compile benchmarks
Update the compile benchmark to allow the Dart transformer to properly
generate the getters, setters, & methods needed.

This also improves the method of duplicating the source templates,
further decreasing runtime from ~5s to ~2s.
2015-05-18 14:34:36 -07:00
d9ceb42bfe chore(gulp): log message when tasks triggered by watch
Closes #1882

Closes #1893
2015-05-18 14:34:36 -07:00
8d6943227d chore(material): add e2e smoke tests for a few more components.
Closes #1884
2015-05-18 14:34:36 -07:00
3011cd86bd feat(compiler): special-case class attribute in hostAttributes
Closes #1774

Closes #1841
2015-05-18 14:34:36 -07:00
cfba38b462 chore: Visual Studio Code project settings for excluding directories 2015-05-18 14:34:36 -07:00
11e4385173 feat(forms): improved error messages
Closes #1839
2015-05-18 14:34:36 -07:00
ad29b12cde doc(NgFor): fix inline doc 2015-05-18 23:12:41 +02:00
842459aa46 doc: fix & sync with latest updates 2015-05-18 23:11:45 +02:00
b033416a45 doc(DI): fix inline doc in binding.ts
fixes #1894
2015-05-18 23:10:41 +02:00
7310b09a1a doc(UrlResolver): inline doc
fixes #1732
2015-05-18 23:09:35 +02:00
bb2eda2d15 feat(element_injector): allow @Optional for ProtoViewRef 2015-05-18 12:48:33 -07:00
0114cd97b6 refactor(RouteRegistry): optimize recognize() 2015-05-18 19:32:33 +02:00
fc13cdab3a refactor(router): add types 2015-05-18 19:32:33 +02:00
3644036693 refactor(proto_view_factory): Move getChangeDetectorDefinitions out of ProtoViewFactory
Move `getChangeDetectorDefinitions` out of `ProtoViewFactory` since it
does not depend on any state in that object.
2015-05-18 08:45:59 -07:00
c397297eef chore(build): fix build.js and test.unit.cjs on Windows
Closes #1873
2015-05-16 22:44:11 +02:00
1eea2b254e feat: allow for forward references in injection
It is possible for a class defined first to be referencing a class defined later,
and as a result at the time of the definition it is not possible to access the later's
class reference. This allows to refer to the later defined class through
a closure.Closes #1891
2015-05-15 21:12:57 -07:00
0e04467b8a docs(bench press): Added link to Chromedriver bug for reference
Closes #1923
2015-05-15 16:51:18 -07:00
9fbb3adbe2 build(travis): bump npm version to 0.9.1
this is to remove the warning in logs and align the ci with our local environment
2015-05-15 16:18:01 -07:00
b6f29b4448 feat(errors): preserve stack traces of user exceptions in Dart 2015-05-15 15:03:31 -07:00
421d8916a6 refactor(view_manager): split inPlace views into root and free host views.
BREAKING CHANGE:
`AppViewManager.createInPlaceHostView` is replaced by
`AppViewManager.createRootHostView` (for bootstrap) and
`AppViewManager.createFreeHostView` (for imperative components).

The later creates new host elements that are not attached anywhere.
To attach them, use `DomRenderer.getHostElement(hostviewRef)`
to get the host element.

Closes #1920
2015-05-15 13:24:53 -07:00
a38a0d6f87 Merge pull request #1909 from angular/view-ref-return-types
Update view_ref.js
2015-05-15 12:32:22 -07:00
7a4a635399 feat(change_detection): uppercase and lowercase pipes
because the world needs more uppercase madness

[✔] clang-format
[✔] tests
2015-05-15 19:46:52 +02:00
557d54b3de feat(facade): toUpperCase and toLowerCase 2015-05-15 19:46:52 +02:00
c47902a471 refactor(reflector): improve types 2015-05-15 19:26:06 +02:00
25cd6e4321 fix(Compiler): add an error when a directive is null or undefined
fixes #1908
2015-05-15 19:26:06 +02:00
6ad5fa0d9d Update view_ref.js
Add return types.
2015-05-14 12:36:16 -07:00
666336be1a build(trees): remove unused imports 2015-05-14 10:01:37 -07:00
77bf90dff1 build(gulp): don't print stack from jasmine handler failures in ci mode
jasmine already logs all the test failures so that stack is redundant.
2015-05-14 10:01:07 -07:00
8ad0205948 docs(promise_pipe.ts): correct "async" pipe
the syntax is now combined with `|async` rather than separate `|promise`
2015-05-14 17:25:46 +02:00
7ff17db113 docs(CONTRIBUTING.md) : fix grammatical error in refactor description
Grammar:
- Consistency using "neither" with "nor"
2015-05-14 17:25:06 +02:00
1d11fdecdc docs(annotations): correct List for directives for Component
@Component takes a List of directives

https://github.com/angular/angular/blob/master/modules/angular2/src/core
/annotations_impl/annotations.js#L867
2015-05-14 08:13:54 -07:00
b1ef30aa20 test(watch): add some test coverage for watch build plugin
Closes #1890
2015-05-14 04:44:38 -04:00
28659efa69 chore(traceur-jasmine): accept multiple specfile globs 2015-05-14 02:48:37 -04:00
6c59894a29 chore(package.json): add rewire devDependency 2015-05-14 02:48:37 -04:00
47b8b48ee7 build(gulp): log test errors but suppress error handling within gulp while in watch mode
if any tasks executed by gulp results in an error, gulp will try hard to show errors. these are usually irelevant in the
watch mode. this is why it's ok to supress them except when running in the ci test mode, in which case failing tasks and logging
exceptions is helpful.

Closes #1881
2015-05-13 22:25:15 -07:00
3969009fe7 build(brocolli): convert brocolli-ts2dart to use TreeDiffer
Closes #1720
Closes #1733
2015-05-13 21:04:51 -04:00
ecb068019b refactor(proto_view_factory): expose data for generating change detectors
Also consolidates metadata handling in `ElementInjector`

BREAKING CHANGE:
- renames `DirectiveMetadataReader` into `DirectiveResolver`
  and removes `src/core/compiler/directive_metadata`.

Fixes #1712
Fixes #1713
2015-05-13 17:11:59 -07:00
5114411749 perf(dart): Improve Dart ListWrapper#concat
Improve implementation of `ListWrapper#concat` to take advantage of our
knowledge of input list sizes.
2015-05-13 16:30:50 -07:00
08f21dbf51 feat(change_detection): implemented change detection that can be configured with pregenerated change detectors 2015-05-13 16:23:22 -07:00
d8c7c274e4 refactor(change_detector): extracted ChangeDetectorDefinition 2015-05-13 16:23:22 -07:00
fadabf79e3 chore(package.json): update run-sequence to v1.1.0
v1.1.0 includes a patch to prevent manipulating arguments passed as arrays
2015-05-13 19:21:35 -04:00
23cec1e8e2 build(gulp): use chokidar alone instead of gulp-watch
Closes #1759
2015-05-13 19:21:35 -04:00
c36ea0221e chore(package.json): uninstall gulp-watch, install chokidar@^1.0.1 2015-05-13 19:21:35 -04:00
685a6507b6 feat(compiler): added support for [()] syntax 2015-05-13 16:08:59 -07:00
846354473d chore(cleanup): Remove some unused files. 2015-05-13 13:56:54 -07:00
390cfb793b fix(router): generate links for router-link with baseHref 2015-05-13 12:22:45 -07:00
17392f663f fix(router): sort possible routes by cost 2015-05-13 11:57:57 -07:00
8b6fa1cf19 doc: fix inline docs 2015-05-13 11:56:51 +02:00
909233f724 fix(ng1 benchmarks): revert *ng-if to ng-if 2015-05-13 11:56:50 +02:00
0e82970a29 fix(examples): prefix directives with Ng 2015-05-13 11:56:50 +02:00
cdbb2473bb fix(benchmark): change If for NgIf 2015-05-13 11:56:50 +02:00
c20060d259 fix(directives): fix import path 2015-05-13 11:56:50 +02:00
38926f7123 fix(benchmark): fixes ng-if ng-for renaming for templates. 2015-05-13 11:56:50 +02:00
0efd89ae5d docs(npm-shrinkwrap.readme.md): add info about from property changes
Closes #1834
2015-05-13 01:02:20 -07:00
718d2ae2ee build(gulp): run beforeExit hook only once
this prevents inifinite loops when cleanup task registers an additional task, that triggers a new beforeExit event

Fixes #1833
2015-05-13 00:57:13 -07:00
af9dcad8e3 fix(facade): MapWrapper.createFromPairs
Closes #1640
2015-05-12 16:10:00 -07:00
772b529a8e build(gulp): bump the required node version to 0.12.2
We ran across fatal issues with npm shrinkwrap on node 0.10.x which don't go away even with npm 2.9.x.

Upgrading node to 0.12 fixed the shrinkwrap issues. Since now we run node 0.12 on ci as well, there
is no reason for anyone to use node 0.10 during development.
2015-05-12 16:05:48 -07:00
111fa60a93 chore: rename for to ng-for
Closes #1598
Closes #1295
Closes #1827

Closes #1827
2015-05-12 15:32:44 -07:00
e9f236b70f chore: rename switch to ng-switch 2015-05-12 15:32:44 -07:00
78d3f62b6a chore: rename non-bindable to ng-non-bindable 2015-05-12 15:32:44 -07:00
d310a9c0b4 chore: rename if to ng-if 2015-05-12 15:32:44 -07:00
7dc524ed58 chore(publishing): fix pubspec authors field 2015-05-12 15:06:00 -07:00
032f8b7840 fix(test): fixed a test 2015-05-12 14:40:20 -07:00
4f2b9a4c28 chore: fail travis on failed ‘test.unit.cjs/ci’ 2015-05-12 14:11:12 -07:00
1ac7bb3bb8 chore(packaging): bump version to 2.0.0-alpha.23 2015-05-12 13:48:54 -07:00
f302f70330 chore: convert dom module to typescript 2015-05-12 12:59:53 -07:00
555dd93ed9 chore: change gulp test.unit.js to use dots reporter 2015-05-12 12:59:53 -07:00
96b0a1c75e refactor(PromisePipe): use lexical this inside of transform 2015-05-12 12:40:13 -07:00
c8a0ed40bd refactor(NgZone): use zone.js v0.5 from npm 2015-05-12 21:07:25 +02:00
e11c20541a refactor(VmTurnZone): renamed to NgZone
BREAKING CHANGE:

VmTurnZone has been renamed to NgZone.

- The public API has not chnanged,
- The "outer" zone is now named "mount" zone (private to NgZone).
2015-05-12 21:03:24 +02:00
c75e216871 refactor(VmTurnZone): outer zone = root zone 2015-05-12 21:03:24 +02:00
fd1d60f03b refactor(VmTurnZone): use the browser microtask queue for JS 2015-05-12 21:03:24 +02:00
e8a6c95e2a feat(VmTurnZone): Rework the implementation to minimize change detection runs
Before this PR there were only 2 zones: root zone = outer zone > inner
zone.
This PR creates the outer zone as a fork of the root zone: root > outer
> inner.

By doing this it is possible to detected microtasks scheduling in the
outer zone and run the change detection less often (no more than one
time per VM turn).

The PR also introduce a Promise monkey patch for the JS implementation.
It makes Promises aware of microtasks and again allow running the change
detection only once per turn.
2015-05-12 21:03:24 +02:00
358a6750ed feat(di): support type literals in DI 2015-05-12 10:57:53 -07:00
4320859e1b chore(dart): Copy css resources in build
Include css resources in the files copied to the dist/dart directory.
This fixes 404s occuring when testing the todo/ app.
2015-05-12 10:02:00 -07:00
98e7a38e50 chore: use SDK dartfmt 2015-05-12 09:56:38 -07:00
229e770a1d refactor(forms): rename FormDirectives to formDirectives
BREAKING CHANGE:

A collection of all the form directives is exported
under `formDirectives`
while those were previously available
under `FormDirectives`.

Closes #1804
2015-05-12 18:44:25 +02:00
5036086fb3 fix(forms): export directives as const in Dart
Fixes #1283
2015-05-12 18:44:25 +02:00
97d24563f4 feat(dart/transform): Inline templateUrl values
Modify DirectiveProcessor to inline `templateUrl` values to avoid making
additional browser requests.

Closes #1035
2015-05-12 09:08:56 -07:00
655ed851f0 refactor(facade/lang): remove unneded semicolons
Those were previously enforced incorrectly by clang-format

Closes #1816
2015-05-12 08:50:44 +02:00
f8f79dc76c chore(package.json): update gulp-clang-format 2015-05-12 08:50:44 +02:00
a574154108 fix(router): add baseUrl to relative paths, but not absolute.
Closes #1783
2015-05-11 18:55:24 -07:00
7f976381d5 fix(view): fixed ProtoViewFactory to get all property bindings 2015-05-11 17:38:34 -07:00
ac80df0959 fix(router): reuse common parent components 2015-05-11 15:49:40 -07:00
aff85b5037 feat(facade): add equals method to StringMapWrapper 2015-05-11 15:49:40 -07:00
5691063ba0 refactor(ChangeDetection): rename AsyncPipe to ObservablePipe
The async pipe in templates will now delegate to both Observable pipe or Promise pipe,
whichever first says it can support the input. Therefore, it's beneficial to disambiguate
the name of the AsyncPipe/AsyncPipeFactory constructors to reflect that these actually
support only Observables.
2015-05-11 14:25:27 -07:00
7498758584 feat(PromisePipe): add pipe for promises 2015-05-11 14:23:46 -07:00
92d6aa1f32 fix(gulpfile): fixed test.unit.dart to format dart code before running test 2015-05-11 13:28:20 -07:00
3256ff1c73 feat(gulpfuile): added watch.js.dev 2015-05-11 13:28:19 -07:00
f9c1de46b3 feat(compiler): added support for host actions 2015-05-11 13:28:19 -07:00
a9ce0f7afb cleanup(di): use typescript initialization idioms 2015-05-11 12:34:22 -07:00
1a4ab2c57a build(gulp): remove the check-format step from test.unit.js task 2015-05-11 12:08:27 -07:00
77d1fc149a fix(router): router-link works without params
Router-link attaches a listener to prevent default behavior and
navigate.

Closes: 1689
2015-05-11 11:58:38 -07:00
c2a42d5d2b fix(location): dartium does not like pushState with null.
According to
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history
the value of the title parameter is irrelevant anyways.
2015-05-11 11:48:45 -07:00
01d5c29513 fix(transformer): remove classDefParser in favor of hardcoded strings to speed up build 2015-05-11 10:45:02 -07:00
7844e3a275 chore: dartfmt Dart code in the repo 2015-05-11 09:50:33 -07:00
a5638a940c feat(directives): export collection of core directives
Closes #1524
2015-05-11 16:47:45 +02:00
4665726f48 feat(lang): support const expressions in TS/JS and Dart
Closes #1796
2015-05-11 12:11:24 +02:00
e8ad0d1776 chore(package.json): update ts2dart to 0.5.2 2015-05-10 18:44:51 +02:00
28022f472d docs(DEVELOPER.md): Update Dart SDK Version
Minimal Version set to 1.10.0-dev.1.10

Closes #1771
2015-05-10 12:08:48 +02:00
4f3433b5bd feat(view): allow to transplant a view into a ViewContainer at another place.
Closes #1492.
2015-05-08 21:35:01 -07:00
2185e7cee9 feat(di): expose parent injector 2015-05-08 17:11:27 -07:00
c82cc47767 build(gulp): watch and incrementally compile files for server.js.dev task
Closes #1770
2015-05-08 16:42:40 -07:00
66f5e30d7c chore(dart): use --trust-type-annotations and --trust-primitives 2015-05-08 16:13:53 -07:00
1a0da11e55 feat(di): components can self-publish via publishAs 2015-05-08 16:13:00 -07:00
abc8878547 feat(dart/transform): Reuse readDirectiveMetadata in plugin
Share code for parsing `DirectiveMetadata` values between the
transformer and the analyzer plugin.
2015-05-08 14:34:16 -07:00
75e9d3f634 chore(ci): bump node version to 0.12
See #1396

Closes #1408
2015-05-08 13:58:03 -07:00
248caefb7e docs(npm-shrinkwrap.readme.md): update npm update instructions 2015-05-08 13:57:50 -07:00
853d1de6ec fix(router): strip base href from URLs when navigating 2015-05-08 13:51:43 -07:00
84dc6ae76b fix(test_lib): spy funcs should match null arguments 2015-05-08 13:51:43 -07:00
05219a54cd feat(dom): add getBaseHref method 2015-05-08 13:51:42 -07:00
4b62a722f0 feat(change_detection.js): export null pipes
rather then having developers creating their own null pipes

Closes #1624
2015-05-08 13:50:17 -07:00
61b69c63ed docs(modules_dart): add README.md
Closes #1628
2015-05-08 13:45:26 -07:00
09b39bf77a docs(core): fix Formatters -> Pipes
long overdue update

Closes #1629
2015-05-08 13:45:13 -07:00
42f6baeaec Fix documentation for toFactory and toAsyncFactory
The bound String classes should have a dependency on Number, not String.

Closes #1654
2015-05-08 13:40:12 -07:00
8ef183b593 feat(material): add early version of md-grid-list.
Closes #1683
2015-05-08 13:29:24 -07:00
2cb066215a Add correct type to TestBed.createView
Closes #1727
2015-05-08 13:17:42 -07:00
200e190f70 fix(dart/transform): Handle hostAttributes in DirectiveMetadata
Handle `hostAttributes` in the transformer.
`hostAttributes` was introduced in 51839ca677

Closes #1742
2015-05-08 11:19:11 -07:00
44f829dbc6 feat(dart/transform): Use the render Compiler and the DirectiveParser
Update the `TemplateCompile` step to use the full render `Compiler`.

Provide `DirectiveMetadata` for `ViewDefinition` objects and use it to
run the `DirectiveParser` step of the render compile pipeline.
2015-05-08 11:18:40 -07:00
401c9efad7 chore(build): update shrinkwrap docs
Closes #1748
2015-05-08 11:18:00 -07:00
900bf8e483 Update DEVELOPER.md
Closes #1755
2015-05-08 11:17:44 -07:00
271ced8ac4 Update DEVELOPER.md
add some info about clang-format
2015-05-08 11:17:43 -07:00
c5bd3f0773 Update README.md
Don't tell people to build angular from source themselves. Our examples are not well-constructed for users to try them out.

Closes #1756
2015-05-08 11:17:29 -07:00
ad23921814 feat(material): early version of md-input
Closes #1753
2015-05-08 11:16:18 -07:00
31cbec0857 build(gulp): check node and npm version and log a warning if incompatible
Closes #1758
2015-05-08 11:04:10 -07:00
d717529e9a fix(change_detection): updated dynamic change detector not to mutate when throwing
Closes #1762
2015-05-08 10:46:08 -07:00
c68fa27444 refactor(render): remove recursion from renderer
The goal is to make implementing a renderer straight forward.

BREAKING_CHANGE:

- Renderer interface was redone / simplified.
- `DirectDomRenderer` was replaced by `DomRenderer`.
- `DirectDomRenderer.setImperativeComponentRootNodes` is replaced
  by the following 2 steps:
    1. `ViewManager.getComponentView(elementRef) -> ViewRef`
    2. `DomRenderer.setComponentViewRootNodes(viewRef, rootNodes)`
- all `@View` annotations need to have a template, but the template
  may be empty. Previously views that had a `renderer` property did
  not have to have a `template`.
- `dynamicComponentLoader.loadIntoNewLocation` does no more allow
  to pass an element, but requires a css selector.
  Special syntax: `:document` can be used as prefix to search globally
  on the document instead of in the provided parent view.

Part of #1675
2015-05-08 09:37:41 -07:00
d2507ac760 Add full example to FormBuilder docs 2015-05-08 16:35:25 +02:00
4ce0d5e024 fix(dart): Remove unused imports.
These imports cause dart analyze errors once ts2dart removes the
IMPLEMENTS import.
2015-05-08 15:24:37 +02:00
5d9e573b3e docs(annotations): differentiate between component definitions and component instances
Closes #1661
2015-05-08 14:50:33 +02:00
51839ca677 feat(compiler): allow setting attributes on a host element
Closes #1402
2015-05-08 14:22:07 +02:00
7225416661 chore(npm): bump angular version in the shrinkwrap after today's release 2015-05-07 22:27:36 -07:00
5e4fa5cf07 build(gulp): use gulp-watch instead of gulp.watch for watching files
gulp-watch uses chokidar which uses fsevents which is much better than fs polling or relying on fs.watch.

fsevents use only one FD per watch invocation as opposed to one FD per watched directory and any subdirectory.

this should improve the situation with EMFILE errors (caused by lack of available file descriptors)

----

I also tried the following:

gulp-sane: requires watchman installation via brew so I didn't want to request that everyone goes throught that yet
gulp-chokidar: didn't work, seems to be obsolete
2015-05-07 22:27:36 -07:00
fa28b28d0a build(typescript): Migrated change detection to typescript 2015-05-07 17:18:04 -07:00
f0ef72d6cc chore(release): releases alpha.22 2015-05-07 16:04:06 -07:00
a58c9f83bd fix(brocolli): escape special regexp characters when building regexps
Special regexp tokens were allowed unchanged previously, which incorrectly broke
the include/exclude behaviour. Now, they're escaped first.

Closes #1721
Closes #1752
2015-05-07 19:01:12 -04:00
624a33f7f8 chore(package.json): bump zone to 0.4.4 2015-05-07 15:58:28 -07:00
20a033e4c9 chore(material): add simple e2e smoke tests for components. 2015-05-07 15:13:30 -07:00
93c331d103 fix(decorators.es6): export Directive decorator
Closes #1688
2015-05-07 15:12:22 -07:00
51c477925a fix(formatter): point to the newest clang-format
The prior version allowed for an older clang-format binary which has bugs
2015-05-07 14:33:24 -07:00
1daa8aa3a1 chore(shrinkwrap): update dependencies to latest
Also, our package.json was out-of-sync with npm-shrinkwrap.json; see https://github.com/angular/angular/issues/1737
This includes a fix for the shrinkwrapping of ts2dart; see https://github.com/angular/ts2dart/issues/138
2015-05-07 14:29:43 -07:00
62bf777ef1 fix(docs): fix broken docs test after addition of .ts extension to dgeni
regex.
2015-05-07 14:05:57 -07:00
aaf3edd131 build(brocolli): move filename filtering into DiffingPluginWrapper
Closes #1719
2015-05-07 17:00:35 -04:00
6bba289a3c fix(build): build the broccoli tools with correct typescript version.
By default, gulp-typescript currently depends on typescript 1.4, which doesn't work for us.
For example, it doesn't allow `let` when emitting ES5, along with lots of other errors.
It so happens that npm sometimes makes this work, as seen by the warning
```npm WARN unmet dependency /Users/alexeagle/Projects/angular/node_modules/gulp-typescript requires typescript@'1.4.1' but will load
npm WARN unmet dependency /Users/alexeagle/Projects/angular/node_modules/typescript,
npm WARN unmet dependency which is version 1.5.0```
but when we update our node_modules in a certain way, we lose this setup and it breaks.

We should be explicit about using a different version of typescript than gulp-typescript depends on.
2015-05-07 13:37:40 -07:00
b0c735f72c fix(decorators): incorrect annotation to decorator adapter 2015-05-07 12:30:18 -07:00
0e2047f9ca chore(benchmarks): add transform benchmark runner and clean up benchmark output 2015-05-07 10:36:04 -07:00
e30ad2ec2c chore(doc-gen): include TypeScript files in the doc generation 2015-05-07 10:26:23 +01:00
c509057f65 chore(doc-gen): log comments as silly() rather than info() 2015-05-07 10:25:41 +01:00
e138add584 chore(doc-gen): provide aliases for jade-data docs 2015-05-07 10:25:02 +01:00
49777648b3 fix(decorators): fixed decorators 2015-05-06 21:08:55 -07:00
cb87fa0970 chore(build): migrated di to TypeScript 2015-05-06 19:00:56 -07:00
649e276610 chore: support last dev build of Dart at 1.10.0-dev.1.10
Can revert once 1.11 is available
2015-05-06 18:21:46 -07:00
5ef11774c2 chore: update pubspec files
Allow latest analyzer version
Add an upper constraint to the Dart SDK
2015-05-06 17:55:03 -07:00
75db2c5241 chore: add more types to a number of top-level properties and methods 2015-05-06 17:53:44 -07:00
c8ebd11d63 feat(dart/transform): Generate DirectiveMetadata for exports
For all files that export another library, include `DirectiveMetadata`
for the exported library in that file's associated `ng_meta.json` file.
2015-05-06 17:17:04 -07:00
6651aa1e1d chore(build): update to TypeScript @head
We need to pick up some bugfixes for decorator emit. This still has our patch to make Error a class.
2015-05-06 16:34:24 -07:00
3f28d08778 build bug fix 2015-05-06 15:53:58 -07:00
ab28676d02 more comments 2015-05-06 15:36:02 -07:00
577a80371f fixed build process by adding comment 2015-05-06 15:27:25 -07:00
01fdb4afc6 chore(build): remove karma preprocessors
Custom karma preprocessors are no longer being used after 1676 and 1597
2015-05-06 14:06:40 -07:00
be7504d451 fix(decorators): fixes decorator reflection.
The bug appears when there are only type annotations without parameter
annotations.
2015-05-06 13:44:44 -07:00
169e4e862d refactor(dart/transform): Use render Compiler concepts
Update `TemplateCompiler` transform step to use abstractions used by the
render `Compiler`. For example, template code is now loaded via an
instance of `TemplateLoader` and external resources are fetched via an
instance of `XHR`.
2015-05-06 12:51:49 -07:00
abc3de7efe refactor(render): rename RenderView and RenderProtoView
Part of #1675
Closes #1705
2015-05-06 11:46:52 -07:00
0b1bb172c9 feat(dart/analysis): Build DirectiveMetadata for LibrarySpecificUnit
initial commit for the dart analyzer task
2015-05-06 11:00:44 -07:00
0856516ae9 refactor(renderer): separate compiler from renderer
Part of #1675
Closes #1702
2015-05-06 10:50:15 -07:00
705d3aacff build(gulp): fix concurrency and caching issues in test.unit.js and test.unit.dart tasks
previously there was a chance of race conditions that could sporadically fail the build.

additionally runing a task via gulp.start or runSequence always reruns its dependencies, which meant that we were blowing away
the build.tools build and rebuilding everything from scratch even during the interactive/watch mode. This meant that the build
pipeline cache was destroyed on every change and we never got the benefit of incremental compilation
2015-05-06 08:46:03 -07:00
1d0078415f build(broccoli): refactor typescript plugin to be incremental via DiffingBroccoliPlugin 2015-05-06 07:45:46 -07:00
9d1df21d91 build(gulp): do no rebuild tools during test.unit.cjs
This introduces private !build.js.cjs task that is to be executed only from other public tasks.
2015-05-06 07:45:46 -07:00
3f36a3c119 build(broccoli): traceur plugin should react only to .js/.es6/.cjs file removal 2015-05-06 07:45:46 -07:00
8c15ccecd1 build(broccoli): add DiffingBroccoliPlugin and refactor existing plugins to use it
tree-differ:
 - export both TreeDiffer and DiffResult  interface

 diffing-broccoli-plugin:
 - factory class for wrapping DiffingBroccoliPlugins and turning them into BroccoliTrees

 broccoli-dest-copy:
 - refactor into DiffingBroccoliPlugin

 broccoli-traceur:
 - refactor into DiffingBroccoliPlugin
2015-05-06 07:45:45 -07:00
e966869744 build(broccoli.d.ts): add tree.description signature 2015-05-06 07:45:45 -07:00
6b017fb388 build(gulp): create private build.tools task and use it instead of magic variable
This way when gulp prints out that it's running build/clean.tools it really means
that it's cleaning up the build directory.
2015-05-06 07:45:45 -07:00
bb6f59e423 chore(build): make karma watch broccoli output for dart unit tests
Previously, karma used a custom preprocessor. Instead, have karma
run built dart from the `dist` folder and use gulp and broccoli
to watch for changes.
2015-05-05 19:24:20 -07:00
c9cec60007 fix(router): fix for leading slash in dart
Using string1 === string2 translates to identical(string1, string2) in
dart, which is incorrect as it is possilbe for dart strings to have
different reference.
2015-05-05 15:19:06 -07:00
f356d03362 feat(dom): add location and history as DOM-like APIs.
Instead of global access methods.
2015-05-05 14:50:53 -07:00
0520ca68b4 feat(dart/transform): Add DirectiveMetadataExtractor transform step
Add a step that reads `DirectiveMetadata` object off annotated classes
into `.ng_meta.dart` files. These will be used by the `TemplateCompiler`
step as inputs to the Angular 2 render compiler.

Update one test to avoid unsupported functionality, format others.
2015-05-05 12:07:50 -07:00
8e1d53b5e9 feat(router): adds the router to the self-executing bundle.
Due to limitation of system build, the router cannot have its own sfx
bundle.

Fixes an issue with RouteConfig decorator by moving it into its own
file.
2015-05-05 10:55:23 -07:00
f5b56c627b refactor: add types to top-level fields in change_detection
Also introduced an abstract PipeFactory base class
2015-05-05 10:21:56 -07:00
740d85cad8 chore(build): change TS Error type to a class.
This will be in the next upstream release.
2015-05-05 09:03:56 -07:00
33bba094d2 chore(build): fix package.json warning
Nit: the contributors field is defined as an array, see
https://docs.npmjs.com/files/package.json#people-fields-author-contributors
2015-05-05 09:02:57 -07:00
f88c4b77ca feat(material): add prototype dialog component w/ demo. 2015-05-04 16:43:15 -07:00
75da6e4c4a feat(router): export decorator version of RouteConfig 2015-05-04 15:44:16 -07:00
1864f60afb feat(benchmarks): Add basic dart transformer benchmarks.
Adds simple benchmarks for various transformation phases, as well as hello_world.
Does not integrate these into any benchmark frameworks yet.
2015-05-04 14:03:58 -07:00
457c15cd6c feat(decorators): adds decorator versions of DI annotations.
In 'angular2/di' the symbol:
- Inject is a decorator
- InjectAnnotation is an annotation

Internally one an get a hold of annotations without *Annotations appened
(to make ts2dart work without workarounds) by importing from
'angular2/src/di/annotations_impl' instead of 'angular2/di'. This is
needed only for users that transpile through TS and through ts2dart.
2015-05-04 13:35:09 -07:00
28feac9411 refactor(router): rename "alias" to "as" 2015-05-03 20:37:00 -07:00
9153331303 feat(router): route redirects 2015-05-03 20:37:00 -07:00
9d5c33f9dd feat(router): sibling outlets 2015-05-03 20:26:47 -07:00
2713b7877b fix(router): navigate on popstate event 2015-05-03 20:26:22 -07:00
2f0fef8ee1 chore(router): add router bundle to gulpfile 2015-05-01 16:43:19 -07:00
259f872cea fix(router): throw if config does not contain required fields 2015-05-01 16:41:25 -07:00
68ed8f1b6b refactor(router): rename LocationMock to LocationSpy 2015-05-01 16:41:25 -07:00
ef7014fe19 feat(router): export routerInjectables 2015-05-01 16:41:25 -07:00
46ad3552c7 fix(router): infer top-level routing from app component
Closes #1600
2015-05-01 16:41:25 -07:00
4965226f3f fix(router): use lists for RouteConfig annotations 2015-05-01 15:55:53 -07:00
ea546f5069 feat(router): add location service 2015-05-01 15:55:53 -07:00
cf32213079 fix(bundle): update the bundle config to point to rx.js 2015-05-01 15:01:18 -07:00
ce6a2ba836 refactor(view): moved the logic from ProtoView to ProtoViewFactory 2015-05-01 13:35:17 -07:00
0f4a089c32 chore(packaging): switch to conventional changelog 2015-05-01 13:10:14 -07:00
3c77855b39 chore(build): Remove .es6 files which shadow .ts files.
This removes .es6 files which are pure duplicates of a
.ts file in the same folder.
Next we need to remove .js files as well, and remove karma preprocessors for dart.
2015-05-01 09:51:03 -07:00
c1579222bd fix(view): changed view manager to hydrate change detector after creating directives 2015-04-30 22:01:55 -07:00
f863ea0db5 feat(decorators): adds support for parameter decorators.
Paramater decorators expect to be called as currently implemented by TS.
2015-04-30 18:42:40 -07:00
e4342743c0 feat(benchmark): added an implementation of the tree benchmark in React 2015-04-30 18:12:21 -07:00
9e8d31d532 fix(compiler): clone templates before compiling them
This is needed as the compiler changes templates during compilation
and we are caching templates in the `TemplateLoader`.

Closes #1058
2015-04-30 16:40:57 -07:00
f75a50c1dd refactor(compiler): rename decorator directives into directive
BREAKING CHANGE:
Previously, `Directive` was the abstract base class of several directives.
Now, `Directive` is the former `Decorator`, and `Component` inherits from it.
2015-04-30 13:38:40 -07:00
c671706518 refactor(benchpress): report forced gc metric separately 2015-04-30 12:15:30 -07:00
ead21c91a4 fix(exception_handler): log errors via console.error
This is e.g. needed as we use this to test for errors
in our examples.
2015-04-30 11:45:34 -07:00
87dcd5eb6f fix(decorators): updates missing benchmark and fixes typo. 2015-04-30 10:22:30 -07:00
8faf6364dc refactor(core): remove DynamicComponent
BREAKING CHANGE:
A dynamic component is just a component that has no @View annotation…
2015-04-30 09:17:25 -07:00
b71fe311fc chore(build): update clang-format to 1.0.10
Closes #1593
2015-04-30 15:54:08 +02:00
bb50fc131b chore(build): update TypeScript version to unreleased beta
Also fixup the typings which were broken by changes in typescript's lib.d.ts.
Second attempt to merge this, now that bugfix for tsd is in.
2015-04-29 17:03:02 -07:00
3aac2fefd7 refactor(compiler): remove Viewport directives, use Decorator instead
BREAKING_CHANGE:
- The special type of `Viewport` directives is removed
  in favor of a more general `Decorator` directive
- `ViewContainerRef` now no more has a default `ProtoViewRef`
  but requires an explicit one when creating views.

Closes #1536
2015-04-29 15:59:55 -07:00
fb67e37339 feat(decorators): adds decorators to be used by TS and Babel transpiled apps. 2015-04-29 15:13:25 -07:00
648c514c28 feat(dart/transform): Add directiveMetadata{To,From}Map
Add utility methods to convert `render.dom.DirectiveMetadata` to and
from maps. This will allow saving and restoring `DirectiveMetadata` in
the Angular 2 Transformer.

We discussed adding this as a member on `DirectiveMetadata`. Since this
is not necessary for anything except the Transformer, we decided to put
it into a separate file to avoid shipping it with the Angular 2 core
code.
2015-04-29 14:22:08 -07:00
511e832ee2 chore(build): Karma watches broccoli output.
This is a prerequisite for switching to TypeScript. We need to remove the Traceur preprocessor
from Karma, so we have the build specified in a single place (broccoli tree def'n).
2015-04-29 14:15:45 -07:00
09f8d8f7ba refactor(core): introduce ViewRef and ProtoViewRef
BREAKING CHANGES:
- `NgElement` merged into `ElementRef`
- `Compiler.compile…` returns `ProtoViewRef`
- `ViewContainer` uses `ProtoViewRef`s and `ViewRef`s.
- `ViewRef`/`ProtoViewRef` in renderer were renamed to
  `RenderViewRef`/`RenderProtoViewRef`.

Related to #1477
Closes #1592
2015-04-29 14:03:38 -07:00
1205f54d01 fix(build): use correct tsd command to get typings at requested versions 2015-04-29 11:43:28 -07:00
b5032fd374 fix(build): revert typescript upgrade which broke the build.
This reverts commit a7a9463624.
This reverts commit 59824e40e8.
2015-04-29 10:49:54 -07:00
a7a9463624 fix(build): refer to newest version of hammerjs typings 2015-04-29 10:13:30 -07:00
59824e40e8 chore(build): update TypeScript version to unreleased beta
Also fixup the typings which were broken by changes in typescript's lib.d.ts
2015-04-29 10:09:32 -07:00
a51a5c2968 chore(build): run forms tests in Node
Closes #1565
2015-04-29 13:58:07 +02:00
e3c11045bf fix(compiler): changed the compiler to set up event listeners and host properties on host view elements
Closes #1584
2015-04-29 05:27:45 +00:00
414e58edb5 chore(publishing): put malformed commit messages to "other"; do not output empty sections
Closes #1557
2015-04-29 04:10:12 +00:00
3bb3bff1f2 chore(packaging): copy changelog.js from angularjs 2015-04-29 04:10:12 +00:00
d2d4e7d783 refactor(parser): remove unused variables
Closes #1553
2015-04-29 04:08:42 +00:00
ee1b574baf fix(di): improve error messages for invalid bindings
Fixes #1515

Closes #1573
2015-04-28 23:42:36 +00:00
c0f3778dda docs(For): fix example to use for-of syntax
Closes #1572
2015-04-28 23:42:24 +00:00
d4925b61ff fix(change_detector): ensure that locals are only used when implicit receiver
closes #1542
2015-04-28 23:40:22 +00:00
5b104936ae chore(build): Add a tsconfig.json file, simply to allow Atom editor's Typescript plugin to
work without dropping tsconfig.json files and generated .js files in the
source directory.

Closes #1538
2015-04-28 23:39:39 +00:00
14988d4415 docs(core): updating some errors in 01_templates
Signed-off-by: Josh Kurz <jkurz25@gmail.com>

Closes #1529
2015-04-28 23:39:20 +00:00
cd953ceb48 docs(core): update core directives document
Signed-off-by: Josh Kurz <jkurz25@gmail.com>
2015-04-28 23:39:20 +00:00
726fecbfb6 feat(dart/transform): Turn on transform for examples/todo
- Tag services with `@Injectable()`
- Update `pubspec.yaml` to transform examples/todo.

Closes #1527
2015-04-28 23:38:08 +00:00
818bb9b697 test: changed test bed to run change detection twice to make sure there are no changes second time
Closes #1517
2015-04-28 23:37:09 +00:00
e4586249fa refactor(change_detection): removed NO_CHANGED and replaced it with WrappedValue 2015-04-28 23:37:09 +00:00
4c1e978536 cleanup(build): remove traceur-based Dart transpiler 2015-04-28 16:25:10 -07:00
3d62546314 fix(compiler): only sets viewDefinition absUrl if the view has either a template or templateUrl
fixes #1326
closes #1327
2015-04-28 15:40:07 -07:00
b9eab463f7 chore(): fix host properties for MD components. 2015-04-28 10:48:03 -07:00
dff4795e49 docs(README): update for linguistic consistency
Closes #1537
2015-04-28 19:06:02 +02:00
ab74e1ed4e docs(CHANGELOG.md): fix correct links to angular2
Closes #1577
2015-04-28 19:03:09 +02:00
902984cc10 chore(doc-gen): only generate angular.io module and _data docs for public modules 2015-04-28 14:54:47 +01:00
ce431f279e chore(doc-gen): don't show private class members in jade templates
Closes #1366
2015-04-28 14:47:38 +01:00
7fb2f2069c docs(Injector): remove unwanted tab characters in the examples
These mess up the jade templates that use tabs for structuring the output.
2015-04-28 14:31:35 +01:00
c269bd5d3c chore(doc-gen): generate docs for angular.io
You can generate docs for comsumption by the angular.io website by running:

```bash
gulp docs/angular.io
```

The generated docs can be found in `dist/angular.io`
2015-04-28 14:31:34 +01:00
b72eb0783b chore(packaging): bump version to 2.0.0-alpha.21; add changelog 2015-04-27 22:15:48 -07:00
a801da6f7c fix(ViewManager): dehydrate views recursively over ViewContainers
Closes #1560
2015-04-27 17:39:20 -07:00
6fcd3709cf fix(render): return views when destroyed in ViewContainer
Closes #1316
2015-04-27 17:39:09 -07:00
1b2754dacd feat(router): add initial implementation 2015-04-27 17:15:58 -07:00
e617ca6323 feat(facade): add isType method 2015-04-27 17:15:58 -07:00
15376a6d24 feat(dart/transform): Dedup getters, setters, & methods
Dedup the getters, setters, and methods generated by the transformer
when compiling a template.

Run `dartformat` over the transform code.
2015-04-27 17:04:31 -07:00
867705bd2c chore: put everything in the _analyze.dart file
6x faster dart analyze
2015-04-27 16:13:20 -07:00
6ab19dd095 docs(change_detection): document JitChangeDetection and DynamicChangeDetection
closes #1446
2015-04-27 15:34:40 -07:00
99fdb9ac41 fix(dart/transform): Use var instead of bool in generated files
If a source file hides `bool` (explicitly or implicitly via `show`), a
generated file using `bool` may not resolve.

Closes #1455
2015-04-27 14:23:24 -07:00
2827ca1559 build(broccoli): add a tree-differ workaround to browser trees 2015-04-27 10:50:59 -07:00
8ea03d0380 build(gulp): fix incremental compilation by reusing angularBuilder across watch re-reruns 2015-04-27 10:47:52 -07:00
d1ec2e18cd build(gulp): add test.unit.tools to test.js task 2015-04-27 10:47:52 -07:00
aa58e4bba5 build(gulp): add build/clean.tools task prevent test.unit.tools/ci from building
on our CI server we currently split each build into the building phase and testing phase, this change aligns test.unit.tools/ci
with the rest of ci test taskswq
2015-04-27 10:47:52 -07:00
0a97f0b645 build(js.cjs): re-enable tests that now pass in cjs
previously these tests were failing but now they pass on master
2015-04-27 10:47:52 -07:00
8a5cf896d0 build(gulp): remove obsolete config 2015-04-27 10:47:51 -07:00
22c79df98d build(gulp): remove gulp-jasmine, run tests in a new process instead
otherwise we see occasional failures due to require.cache and other global state collisions
2015-04-27 10:47:51 -07:00
a52798543a build(gulp): rename tasks build.broccoli.tools => build.tools + test.unit.broccoli => test.unit.tools 2015-04-27 10:47:51 -07:00
1cbdb9cd17 refactor(build): introduce AngularBuilder facade and clean up many things 2015-04-27 10:47:51 -07:00
4c9b8ebb0c build(gulp): remove obsolete gulp transformer 2015-04-27 10:47:51 -07:00
6aea629cd3 build(gulp): use strict mode for gulpfile
- a variable `public` was renamed since it is a reserved keyword in the strict mode
2015-04-27 10:47:51 -07:00
649fd5a7a9 chore(build): exclude tree-differ.ts from format-checking due to a bug in clang-format
see https://github.com/angular/clang-format/issues/4
2015-04-27 10:47:50 -07:00
40c4eb7240 build(gulp): refactor test.unit.broccoli to use task dependencies and not die when a compilation error occurs
With this change we also stop gulp task queue when an error in build.broccoli.tools occurs, that way we
don't bother testing when transpilation fails.
2015-04-27 10:47:50 -07:00
cd05ed8de9 docs(npm-shrinkwrap.readme.md): update instructions 2015-04-27 10:47:50 -07:00
42e7fc5252 build(broccoli): add source-maps to our broccoli tools 2015-04-27 10:47:50 -07:00
7740fc071c build(broccoli): convert traceur and broccoli-dest-copy plugins to use tree-differ
Also adding symlink-or-copy to our npm dependencies since our plugins now use it.
2015-04-27 10:47:50 -07:00
bdf6af9bd6 build(broccoli): add custom broccoli.d.ts file 2015-04-27 10:47:50 -07:00
2f83efaac8 build(broccoli): add tree-differ for diffing broccoli trees 2015-04-27 10:47:49 -07:00
32c5ab956c build(broccoli): add testing infrastructure for our build plugins
components:
- gulp test.unit.broccoli task
- mock-fs for mocking our FS in unit tests
- jasmine d.ts file for type checking

jasmine lib is provided by minijasmine2 so we don't need to include it explicitly
2015-04-27 10:47:49 -07:00
b111ca9471 chore(build): add tsd.cached.json to our .gitignore 2015-04-27 10:47:49 -07:00
725f909ff8 chore(build): refactor test.unit.cjs to use the broccoli pipeline
This change solves several problems:
- the broccoli pipeline is used to compile the node/cjs tree upon any change to the modules/ directory
- jasmine tests run in a new process removing the need to clean up environment after each test
- since we transpile only those test files that are actually needed for node/cjs build, we transpile less and don't need to filter out tests
2015-04-27 10:47:49 -07:00
427f0d021c perf(benchmarks): benchmark that measure cost of dynamic components 2015-04-27 10:16:53 -07:00
9fc9d53566 perf(benchmarks): benchmark measuring cost of decorators (fixes #1479) 2015-04-27 10:16:52 -07:00
6dece68bb8 refactor(core): rename ViewContainer to ViewContainerRef
This also renames InternalAppViewContainer into AppViewContainer

Related to #1477
Closes #1554
2015-04-27 10:12:21 -07:00
0676fef61f docs(directives): CSS selectors are used for directives
Closes #1544
2015-04-27 15:32:26 +02:00
1d52cfba13 chore(query_list.js): fix minor typos
Typos fixed

Closes #1549
2015-04-27 15:30:17 +02:00
bfa381b35a refactor(view): introduce AppViewManager to consolidate logic
AppViewManager is the single entry point to changing the view hierarchy.
It is split between the manager itself which does coordination and
helper methods, so both are easily testable in isolation.

Also, ViewContainer is now only a pure reference to a bound element
with the previous functionality but does not contain the list of views
any more.

Part of #1477
2015-04-24 20:26:18 -07:00
f78406392b fix(test_lib): support multi matches with deep equality for function calls 2015-04-24 17:53:41 -07:00
623edcd2d8 Copy a second package to TypeScript. 2015-04-24 15:49:04 -07:00
b5e350b18c cleanup(forms): do not export AbstractControl
Closes #1299
2015-04-24 13:57:03 -07:00
87cf434929 chore(sources): intro modules_dart; move analyzer code there
We have Dart code in `angular2` module that ought to be in its own
package. Examples include Dart analysis plugins, and potentially the
transformers (although transformers cannot be moved out just yet).
However, this code is Dart-only and it doesn’t make sense to use JS
directory layout for it. This commit introduces a sub-directory called
`modules_dart`. All modules in this directory are pure Dart packages
using standard pub directory layout. The code in these packages never
gets transpiled. It is directly copied to `dist` unmodified, except an
adjustment in relative paths in `pubspec.yaml` files.
2015-04-24 13:29:18 -07:00
4bab25b366 feat: alllow specifying directives as bindings
Related to #709
Closes #1498
2015-04-24 11:02:17 -07:00
6896305e34 fix: export ShadowDom strategies
Fixes #1510
Closes #1511
2015-04-24 08:41:37 +02:00
8ccafb0524 feat(view): reimplemented property setters using change detection 2015-04-23 11:55:27 -07:00
8a92a1f13e fix(angular2): export QueryList in angular2/core
Closes #1502
2015-04-23 11:04:30 -07:00
d0059b5d75 refactor(PipeRegistry): improve error messages
Closes #1504
2015-04-23 11:04:30 -07:00
fa8e059f28 refacor(lexer): remove unused ~/ operator
Closes #1509
2015-04-23 11:04:30 -07:00
8e18d6c6cf docs(annotations): fix casing in view annotation
- Fix the casing to match key name exposed for `templateUrl` in `View`
  annotation

Closes #1495
2015-04-23 11:04:30 -07:00
afe0e45453 feat(parser): support === and !== operators
Closes #1496

Closes #1500
2015-04-23 20:01:31 +02:00
2e3e41ba64 fix(ListWrapper): follow JS semantics 2015-04-23 09:46:09 +02:00
d74dd1126b cleanup(di): removed dead code 2015-04-22 14:48:53 -07:00
0ff99081bd DEVELOPER.md copyedit
Closes #1275
2015-04-21 17:10:15 -07:00
6f4b6783c0 docs(02_directives): TemplateConfig -> @View
for #1224

Closes #1325
2015-04-21 16:31:25 -07:00
b1bc792b56 BUG FIX: without specification, certain versions of bower install ./app/bower_components...
Closes #1409
2015-04-21 16:31:20 -07:00
d4b8a86509 Updating DEVELOPER.md with nits and grammar fixes.
These are mostly trivial, but I thought I'd fix them while reading through the doc.

Closes #1438
2015-04-21 16:31:16 -07:00
642e7e5c46 fix(benchpress): only print the CV when it is meaningful
When the mean is 0, the coefficient of variation is calculated to be
NaN, which is not meaningful, so instead of printing "+-NaN%", just
don't print the CV at all.

Closes #908

Closes #1444
2015-04-21 16:31:12 -07:00
4650d25a53 chore(package.json): upgrade zone.js to v0.4.3
Closes #1457
2015-04-21 16:30:40 -07:00
7551a28f1a chore: show dart2js package warnings for angular2, benchmarks, examples
Closes #1468
2015-04-21 16:22:49 -07:00
e51a48fe4c Fixed example for EventEmitter
I didn't get a full trace back for my evidence I got from making this example work. EventEmitter was instantiated and assigned to wrong property. Also the mapping should be done using the component property name as it will be obtained via accessor and exposed on the directive (as far as I understood).
2015-04-21 16:22:10 -07:00
22c6c09daf chore(build): run event tests in Node
Closes #1476
2015-04-21 16:21:39 -07:00
e70a2f21dd fix(dom): remove methods is allowed on text nodes as well
Fixes #1473
Closes #1478
2015-04-21 11:56:11 -07:00
97e6fb6835 fix(benchmarks): wait for end of benchmarks 2015-04-21 11:25:07 -07:00
14a7b9f794 fix(jsserve): serve empty favicon to prevent errors in benchmarks
Background: our benchmarks check whether there were errors
in the browser log after they executed.
2015-04-21 11:25:07 -07:00
fa1ec48549 chore(example): fix TODO example on dart
Reflection for Dart was not set up properly for the TODO example,
so it was failing when served on dartium via
gulp serve/examples.dart
2015-04-21 10:17:26 -07:00
f7f06c5ad4 chore: add more type annotations 2015-04-21 08:49:05 -07:00
e23004df52 fix(di): capture original exception in InvalidBindingError
Fixes #1406

Closes #1459
2015-04-21 10:59:44 +02:00
fe70c2647a chore(packaging): bump version to 2.0.0-alpha.20 2015-04-20 17:53:29 -07:00
ada1e642c5 feat(view): add imperative views 2015-04-20 17:18:44 -07:00
817c79ca77 refactor(testability): rename function to get testability
Previously, getting testability was `window.angular2.getTestability`
This was because the plan was to export the API to the window as
angular2. However, the decision was changed to make this just `angular`
in 3177576ad6

To decouple testability from the rest of the Angular API, just make it
one function, `window.getAngularTestability`.
2015-04-20 15:13:09 -07:00
a97a2266d3 feat(change_detection): added async pipe 2015-04-20 14:50:23 -07:00
8b3c808cb0 cleanup: remove an unused type 2015-04-20 14:24:16 -07:00
2d929e73ec cleanup(change_detection): moved pipes-related tests to the pipes dir 2015-04-20 14:24:15 -07:00
681d06386d feat(view): implemented loading component next to existing location 2015-04-20 13:41:10 -07:00
77b31ab42f feat(dart/transform): Add debug transform parameters
Add two transform parameters to aid in debugging the transformer
- `mirror_mode`, with values {`debug`, `none`, and `verbose`}
- `init_reflector`, with values {`true`, `false`}

`mirror_mode`:
- `debug`: Allow reflective access, but log a message if it is used
- `none`: Remove reflective access, `throw` if it is used. Default value
- `verbose`: Allow reflective access, log a stack trace if it is used

`init_reflector`: Whether to generate calls to our generated
`initReflector` code.

These will be useful to reveal areas where the transformer is not generating
appropriate code and to quickly see where reflective accesses occur.

When the pub mode is `transform_dynamic`, we run in MirrorMode.debug
with `init_reflector = false`. This is used for testing purposes.
2015-04-20 12:32:04 -07:00
5b4eb0c6d7 style(dart/transform): Format Dart files in reflection
Run the formatter on some Dart-specific reflection files.
2015-04-20 12:32:04 -07:00
5c25248582 docs(x-ref links): Change links to use dgeni syntax
Closes #1440
2015-04-20 18:45:04 +00:00
64ad74acbe fix(shadowdom): remove unused nodes on redistribute
Previously, light dom nodes that were not used by any content tag
were not removed from a view on redistribute. This lead
to a bug when reusing a view from the view pool, as it
still contained stale reprojected nodes.

Fixes #1416
2015-04-20 11:36:39 -07:00
02997f473a fix(viewFactory): allow empty view cache 2015-04-20 11:36:39 -07:00
abda569b55 docs(dart/transform): Link to the Transform wiki page
Add a link to the Dart Transform wiki page to DEVELOPER.md
2015-04-20 10:14:24 -07:00
447018b54b docs: change primordial injector to platform injector 2015-04-20 16:45:23 +00:00
0a200aff70 chore(doc-gen): fix atScript file reader test
Closes #1458
2015-04-20 17:43:46 +02:00
883e1c1541 feat(events): support preventdefault
Fixes #1039
Closes #1397
2015-04-20 15:20:52 +02:00
aabe83cf63 chore(build): run application tests in Node
Closes #1423
2015-04-20 14:45:18 +02:00
fbd6851860 chore(doc-gen): add ids to members to allow direct linking
You can now write a link to a member of a class by appending the member name
to the class name joined by a hash sign:

```
{@link ControlGroupDirective#addDirective `addDirective`}
```

By default the link will contain the text of the class rather than the member
so you must add it as an inline code text snippet in the link tag.

Closes #1432
2015-04-18 22:06:49 +01:00
d6dae0cc85 Tweak .gitignore file to ignore also packages symlinks. 2015-04-18 12:13:10 -07:00
376d508934 chore(doc-gen): read .es6 files as well as .js when generating docs
Closes #1429
2015-04-18 08:35:38 +01:00
a00cb1de50 feat(Compiler): Make Compiler.buildRenderDirective() static. 2015-04-17 21:57:25 -07:00
56f3429cc9 fix(view): chagned view factory to keep AstWithSource 2015-04-17 17:40:43 -07:00
4943c0f887 fix(view): fixed hydrator to pass the right element index when attaching an event listener 2015-04-17 17:27:12 -07:00
00e2d70f05 refactor(dart/transform): Remove index_static from hello_world
index_static.js & index_static.html are unnecessary in Js and are now
essentially generated via the Dart transformer. The angular
transformer is specified in examples/pubspec.yaml; use pub build to
create a transformed application that does not use dart:mirrors.

Create index_dynamic.js & index_dynamic.html, which are used to test
that the app runs equally well with mirrors and without.

Closes #495
2015-04-17 16:11:48 -07:00
e52d71060f chore(analysis): fix analyzer warning in index_static 2015-04-17 14:01:42 -07:00
01869f9fa8 chore(format): format a TS file 2015-04-17 13:56:13 -07:00
526c51d1a6 fix(facades): fix splice semantics; add test 2015-04-17 13:52:03 -07:00
2b4d30d931 chore(analysis): analyze everything in lib folders recursively; fix existing warnings 2015-04-17 13:52:02 -07:00
3dc4df2ffa chore(analysis): analyze web folders; fix existing warnings 2015-04-17 13:52:02 -07:00
f830cfca12 refactor(view): provide ViewContainers dynamically on any element 2015-04-17 12:35:59 -07:00
eac5c88893 fix(view): fixed hydrator to export the dom element instead of ng element 2015-04-17 12:32:33 -07:00
abfe175c9e doc(VmTurnZone): inline doc
Closes #1427
2015-04-17 18:19:59 +00:00
0fc66daef6 fix(core): typo ComponetRef -> ComponentRef
Closes #1426
2015-04-17 18:19:58 +00:00
5a095bb257 refactor(di): rename ProviderError to BindingError
Closes #1428
2015-04-17 20:17:51 +02:00
de31aca7a7 docs(di): Edits to DI.
Closes #1420
2015-04-17 17:49:12 +00:00
97220dd2ba docs(life_cycle): mark registerWith as @private 2015-04-17 16:25:13 +01:00
e1b0bab9a6 chore(doc-gen): ignore members marked with @private 2015-04-17 16:24:07 +01:00
66a2f9b23a docs(angular2/annotations): convert [...] links to use {@link ...} style inline tags
This is an example of how to link to other code components using the `link`
inline tag.
2015-04-17 14:02:03 +01:00
a8533b2133 chore(doc-gen): add link inline tags
This commit enables links to other docs, such as classes and modules,
via the `{@link CodeIdentifier}` style inline tag.

Dgeni identifies what you are linking to by comparing the identifier to the
aliases for each doc. If no alias matches the identifier then the dgeni
run exits with a missing doc in link error. If more than one alias matches
the identifier then dgeni exits with an ambiguous link error.

In the future we could build in some heuristics for choosing a preferred
doc when the link is ambiguous, such as choosing a public doc over a
non-public doc; and choosing a code component that is in the same module as
the doc where the link is found.

Currently there are two aliases for each API component: its name and its
identier. For example, if the `Directive` class is exported from
`angular2/annotations`, so its aliases are 'Directive' and
`angular2/annotations.Directive`.

There is an issue in the non-public doc generation, which means that it
does not yet have `{@link}` tags implemented. This is that when we re-export
a code component, it gets cloned into another module. This means that a
simple reference to the code component's name will always produce an
ambiguous link. This can be fixed with a heuristic as described above.
Meanwhile you can avoid this by always using the full id of the code
component if it is being re-exported.

Closes #1371
Closes #1421
2015-04-17 14:02:03 +01:00
87ac100c66 docs: add DI to public docs 2015-04-17 03:56:17 +00:00
487c4d23c1 chore: enable chrome browser tests on c9.io 2015-04-17 03:44:32 +00:00
8906cdbab8 chore(build): trigger npm postinstall when npm install is skipped
we temporarily need this because some of our dependencies are being installed via npm postinstall
2015-04-16 16:58:28 -07:00
88963b438f chore(travis): pin npm used to v2.7.4
Since we are currently stuck on node 0.10 (see #1396), this will at least help us avoid
some of the npm bugs present in older version that comes with 0.10.
2015-04-16 16:58:28 -07:00
4fd4a1d15c chore(travis): turn on travis cache for npm dependencies 2015-04-16 16:58:28 -07:00
371c8b8a1c chore(travis): add npm/install-dependencies.sh step in preparation for caching 2015-04-16 16:58:28 -07:00
eb87f5f851 chore(npm): add shrinkwrap to our project 2015-04-16 16:58:28 -07:00
27d227283c chore(npm): remove duplicate fs-extra dependency 2015-04-16 16:58:28 -07:00
ea9d24be31 chore(npm): move tsd update to post install and add tsd version to devDependencies 2015-04-16 16:58:27 -07:00
5408abca68 refactor(change_detection): removed global change detection objects so it is possible to override pipe registry 2015-04-16 15:57:45 -07:00
233cb0f96a feat(view): changed event emitters to be observables 2015-04-16 14:44:14 -07:00
8b28e99373 fix(benchpress): explicitly require navigation to finish before continuing 2015-04-16 14:04:41 -07:00
923d90bce8 refactor(views): clean up creating views in place and extract view_hydrator
Major changes:
- `compiler.compileRoot(el, type)`
  -> `compiler.compileInHost(type) + viewHydrator.hydrateHostViewInPlace(el, view)`
- move all `hydrate`/`dehydrate` methods out of `View` and `ViewContainer` into
  a standalone class `view_hydrator` as private methods and provide new public
  methods dedicated to the individual use cases.

Note: This PR does not change the current functionality, only moves it
into different places.

See design discussion in #1351, in preparation for imperative views.
2015-04-16 11:58:01 -07:00
97fc248e00 cleanup(di): changed an error message to be more descriptive 2015-04-16 11:06:20 -07:00
7bd682bb27 feat(parser): changed parser to parse pipes in the middle of a binding 2015-04-16 10:39:03 -07:00
e927342e58 Read only a single DirectiveMetadata (will be squashed) 2015-04-16 09:11:03 -07:00
ae84eb7462 refactor(dart/transform): Correct Dart analyzer warnings 2015-04-16 09:11:03 -07:00
f89bb8eaf3 Address code review comments 2015-04-16 09:11:03 -07:00
0d0b3a35da test(dart/transform): Add unit tests for DirectiveMetadataReader 2015-04-16 09:11:03 -07:00
cf7bef58b0 feat(dart/transform): Add the DirectiveMetadataReader
Add a class that parses and reads Directive metadata to prepare for
running the Render compiler in the Dart transformer.
2015-04-16 09:11:02 -07:00
c65fd31e86 feat(dart/transform): Detect annotations which extend Injectable or Template.
Create a method that recursively walks imports from an entry point and
determines where classes are registered.

Use this information to determine if a particular annotation implements or
extends Injectable or Template.
2015-04-16 07:17:24 -07:00
6600ac7031 chore: Fix missing analysis for lib and web directories
Pending issue to fix analyzer items in web: https://github.com/angular/angular/issues/1392
2015-04-15 20:58:29 -07:00
957384ceeb fix: Fix issues found by Dart analyzer 2015-04-15 20:58:29 -07:00
d3e391d176 chore(build): run render tests in Node
Closes #1358
2015-04-15 19:51:11 -07:00
0658d5602e chore(doc-gen): ignore exports marked as @private
Closes #1363
2015-04-15 19:50:01 -07:00
458213d055 docs(DEVELOPER.md): mention building JS or Dart selectively
Closes #1375
2015-04-15 19:48:38 -07:00
cd1295a823 Update 01_templates.md
Closes #1373
2015-04-15 19:48:34 -07:00
5d302c504e Update 02_directives.md
Closes #1374
2015-04-15 19:48:31 -07:00
68faddbf5c feat(change_detection): updated handling ON_PUSH detectors so they get notified when their bindings change 2015-04-15 16:21:21 -07:00
dc9c614da2 chore: break out warnings vs hints in build/analyze.dart
give a better report of errors
2015-04-15 15:46:16 -07:00
8c1adabe1c refactor(change_detection): renamed BindingPropagationConfig to ChangeDetectorRef 2015-04-15 12:58:58 -07:00
213dabdceb fix(view): remove dynamic components when the parent view is dehydrated
Also adds a bunch of unit tests for affected parts.

Fixes #1201
2015-04-15 12:53:21 -07:00
6ecaa9aebb feat(change detection): add removeShadowDomChild 2015-04-15 12:53:21 -07:00
cb2e646332 fix(tests): create default spys for all methods on a class 2015-04-15 12:53:20 -07:00
fef1dee7aa fix(dart/transform): Ensure consistent ordering of generated imports
- Linked imports are generated in a consistent order.
- Linked imports are generated immediately after their associated files.
2015-04-15 12:09:51 -07:00
e14543498c fix(build): remove import of gulp-traceur which pulls in a different version of traceur
This lead to build fails.
2015-04-15 11:17:42 -07:00
c25478380c docs(benchpress): add details about normalized mobile environment. 2015-04-15 10:12:13 -07:00
e819e97f9a docs: expose more API to public, document QueryList 2015-04-15 05:10:26 +00:00
f149ae79c6 feat(material): first ng2 material design components 2015-04-14 16:15:35 -07:00
ffe13078e5 feat(bundle): add script to push bundles to code.angularjs.org
Copied over from angular js 1.x.
2015-04-14 14:50:53 -07:00
f0d0fe0801 refactor(change_detection): cleaned up change_detection.js 2015-04-14 14:34:57 -07:00
d630d5baa5 docs(change_detection): document LifeCycle 2015-04-14 14:16:14 -07:00
7cac7c5157 refactor(dart/transform): Correct Dart analyzer warnings
- Fix numerous Dart analyzer warnings we had been ignoring.
- Delete unused `in_progress` dir
2015-04-14 13:41:22 -07:00
aba61f22a6 chore(build): Remove even more obsolete build config values. 2015-04-14 13:38:41 -07:00
8475c63a6a misc(docs): Edits and additions for Forms and Change Detection 2015-04-14 13:34:29 -07:00
2d09f84182 fix(build): Fail the build for certain TS errors. 2015-04-14 11:54:36 -07:00
ef6e0d8eb8 chore(build): remove obsolete html.js, copy.js, srcFolderInsertion. 2015-04-14 11:54:36 -07:00
db97d73c3b feat(build): Move HTML copying into the broccoli task.
This includes all tasks to construct a Dart tree, except for formatting, and
reverse engineers/refactors the various copy tools for added more sanity.
2015-04-14 11:54:31 -07:00
0e3d0fbec6 docs(change_detection): don't annotate exports that are already in public modules
Since `DynamicChangeDetection` and `JitChangeDetection` classes are alreadt in the
public module, they do not need to be annotated with a `@exportAs` tag

Closes #1353
2015-04-14 13:22:41 +01:00
896a1564ef chore(doc-gen): only clone docs that are actually being re-exported to a new module
Closes #1353
2015-04-14 13:20:49 +01:00
8b97cf1479 cleanup(view): changed ComponentRef to contain ElementRef instead of extending it 2015-04-13 19:30:00 -07:00
b5c9f9ed9b cleanup(element_injector): added a missing test 2015-04-13 19:30:00 -07:00
bda120d862 chore(pub): run build/pubspec.dart before build/analyzer.dart 2015-04-13 18:34:34 -07:00
3177576ad6 feat(bundle): adds a self-executing dev bundle (SFX). 2015-04-13 18:05:53 -07:00
896a0457f8 refactor(build): Better encapsulate the broccoli builder. 2015-04-13 17:28:00 -07:00
caf8e2723d chore(build): remove obsolte gulp tasks 2015-04-13 16:52:08 -07:00
0107543a33 chore(build): move build/transformCJSTests task to broccoli 2015-04-13 16:52:08 -07:00
7d29636087 chore(packaging): bump version to 2.0.0-alpha.19 2015-04-13 16:15:12 -07:00
70433e6b73 chore(build): use a Filter plugin to write the dest folder.
This lets broccoli keep the dest folder up-to-date in 'watch' mode,
so we should be able to use that for Karma.
2015-04-13 15:51:33 -07:00
3667854a8f refactor(di): move all binding resolution logic into injector.js 2015-04-13 15:06:44 -07:00
c5c1c9e38e feat(docs): more docs on binding resolution 2015-04-13 15:06:44 -07:00
308823b6ea perf(view): use pre-resolved bindings for child injector init
Creating a child injector from pre-resolved bindings (if any) is an
order of magnitude faster.
2015-04-13 15:06:44 -07:00
c05bad381c perf(benchmark): measure Injector init from resolved bindings 2015-04-13 15:06:44 -07:00
4a961f4ecb feat(di): provide two ways to create an injector, resolved and unresolved
Add two factory static functions to Injector: resolveAndCreate and
fromResolvedBindings.

We want to avoid resolution and flattening every time we create a new
injector. This commit allows the user to cache resolved bindings and
reuse them.
2015-04-13 15:06:43 -07:00
6c8398df9b fix(di): refactor bindings to support Dart annotations 2015-04-13 15:06:43 -07:00
ff6e7754ae chore(build): gulp test.unit.cjs broken the second run
Fixes #1311

Closes #1333
2015-04-13 21:44:54 +00:00
28ba179e31 feat: intiial commit for angular 2 dart analysis
Initial commit for analysis support to Angular 2 Dart
2015-04-13 13:50:29 -07:00
b96e560c8d feat(events): add support for global events
Fixes #1098
Closes #1255
2015-04-13 22:35:36 +02:00
7c95cea3a8 chore(bundle): avoid imports in "global" format
If an "empty" file (like angular2/template.js) is imported
it is auto-detected as the one using "global" format by the
system builder. This is incorrect as the entire angular2 build
output is in the ES6 format.

Removing empty import till it has some content.

Closes #1329
2015-04-13 21:24:56 +02:00
34501aaae6 chore(build): move more broccoli support inside the TypeScript boundary 2015-04-13 12:24:28 -07:00
dbfc4c1c16 chore(build): inline Traceur options just like we do everywhere 2015-04-13 11:37:18 -07:00
301863b105 chore(build): transpile only e2e test code into cjs 2015-04-13 11:31:14 -07:00
ef8dc40492 chore(build): correct comment 2015-04-13 11:31:14 -07:00
6dbd4d969b chore(build): create es5build.js only for files that will become es6 npm packages 2015-04-13 11:31:14 -07:00
3dd0ac1f0a chore(build): move dart broccoli tree to make-broccoli-tree 2015-04-13 11:20:59 -07:00
5b42272365 docs(DEVELOPER.md): add bower install info
Closes #1310
2015-04-13 20:15:29 +02:00
1f6c6dbf2f chore(build): refactor broccoli trees to generate them in order to reduce duplication 2015-04-13 10:07:31 -07:00
0012caa4d5 perf(benchmarks): measure cost of Injector init with a variety of bindings 2015-04-13 10:02:13 -07:00
8499cf84c3 fix(shadow_dom): redistribute light dom when a dynamic component is attached.
Fixes #1077
Closes #1315
2015-04-13 09:23:52 -07:00
daf0f472b3 feat(build): enforce formatting of some files.
Our style guide includes formatting conventions. Instead of wasting time in reviewing PRs discussing things like indenting, and to avoid later deltas to fix bad formatting in earlier commits, we want to enforce these in the build.
The intent in this change is to fail the build as quickly as possible in travis, so those sending a PR immediately know they should run clang-format and update their commit. When running locally, we want users to know about formatting, but they may not want to act on it immediately, until they are done working. For this reason, it is only a warning outside of the continuous build.
This is done by having a check-format task which should run on most local builds, and an enforce-format task only run by travis.
2015-04-11 18:39:28 -07:00
a3decad4c2 feat(build): Use broccoli for ts2dart transpilation. 2015-04-11 16:26:44 -07:00
7b790a3369 chore(build): fix check-format 2015-04-11 12:40:05 -07:00
e18920884e chore(DEVELOPER.md): Update Dart SDK Version
Package angular requires SDK version >=1.9.0 <2.0.0

Closes #1318
2015-04-11 12:06:50 +02:00
6f8fef4f13 feat(bootstrap): changed bootstrap to return ComponentRef 2015-04-10 18:14:59 -07:00
e295940833 cleanup(docs): Edited API docs 2015-04-10 18:02:10 -07:00
2ed7622239 chore(build): compile the .ts broccoli tools.
This avoids having to check in the compiled .js files.
2015-04-10 17:29:32 -07:00
6ce085a21a feat(benchmark): make view cache a parameter to the tree benchmark 2015-04-10 16:57:46 -07:00
e34146fc14 fix(view_factory): fix caching of views
Previous implementation had bugs, and did not cache per ProtoView.
2015-04-10 16:57:45 -07:00
4e2316c742 feat(build): Add rudimentary TS typings for broccoli. 2015-04-10 16:37:24 -07:00
785900f722 DEVELOPER.md copyedit 2015-04-10 23:34:06 +00:00
5ce5a87abe style: add more type info to Dart BrowserAdapter 2015-04-10 23:34:06 +00:00
afe5465862 add return types for indexOf and lastIndexOf
closes #1277
2015-04-10 23:34:05 +00:00
678d541da7 refactor(compiler): add control.ignoreCurrentElement() to skip the current element
relates to #808
2015-04-10 23:34:05 +00:00
f0477e164a chore(build): add typescript to the cjs build.
Refactor the file extension logic in traceur plugin to simplify
2015-04-10 15:22:03 -07:00
b5002fb46b docs(test_lib/test_injector): fix invalid jsdoc type
chore(doc-gen): capture docs for modules from comments

Closes #1258

docs(*): add module description jsdoc tags
docs(*): add @public tag to public modules
chore(doc-gen): fix overview-dump template
The template was referencing an invalid property
chore(doc-gen): use `@exportedAs` and `@public` rather than `@publicModule`

This commit refactors how we describe components that are re-exported in another
module. For example the "public" modules like `angular/angular` and `angular/annotations`
are public but they only re-export components from "private" modules.

Previously, you must apply the `@publicModule` tag to a component that was to be
re-exported. Applying this tag caused the destination module to become public.

Now, you specify that a module is public by applying the `@public` tag and then
you can "re-export" components to other modules by applying the `@exportedAs`
giving the name of the module from which the component will be re-exported.
tag. This tag can be used multiple times on a single component, allowing the
component to be exported on multiple modules.

docs(*): rename `@publicModule` to `@exportedAs`

The `@publicModule` dgeni tag has been replaced by the `@exportedAs`
dgeni tag on components that are to be re-exported on another module.

Closes #1290
2015-04-10 22:00:41 +00:00
82127571b5 feat(dart/transform): Use the Dart transformer for benchmarks
Remove explicit generation of reflection information in benchmark code
and generate it with the transformer.
2015-04-10 14:01:55 -07:00
f6e9d1f857 feat(dart/transform): Fix handling of Dart keywords
Use `package:analyzer`'s list of Dart keywords to ensure we are properly
reporting usages of Dart keywords as runtime errors.
2015-04-10 13:43:11 -07:00
2cab7c79c3 feat(dart/transform): Allow multiple transformer entry points
- Allow the user to specify multiple entry points to an app.
- Allow the Angular 2 transformer to run without explicit entry points to
generate necessary setters & getters on built-in directives like `For`
and `If`.

Closes #1246
2015-04-10 13:41:26 -07:00
bba849909c fix(dart/transform): Gracefully handle log calls before init
- Lazily create and use a logger that prints instead of `throw`ing.
- Use this logger in unit tests.
2015-04-10 13:41:26 -07:00
cac74c73e1 feat(dart/transform): Add stub implementations to Html5LibAdapter
Stub out some methods used in the `CompilerPipeline`.
2015-04-10 13:41:26 -07:00
f375dbd013 feat(dart/transform): Mark Compiler as Injectable
Necessary to allow runtime access via the `Injector`
2015-04-10 13:41:26 -07:00
ea58ef85fc chore(build): move the js.prod build over to broccoli 2015-04-10 13:11:58 -07:00
bf7933714a chore(rename): rename View and Template concepts for #1244 2015-04-10 12:00:37 -07:00
564477b8a0 chore(build): migrate build.js.cjs to broccoli.
This doesn't do the typescript part of the build yet. Also there is a bit
of hackiness left to resolve in a follow-up change.
2015-04-10 11:39:48 -07:00
7e2c04e805 feat: add class directive to a list of directives
Closes #1292
2015-04-10 18:33:51 +02:00
8fa1539bac feat(keyEvents): support for <div (keyup.enter)="callback()">
This commit adds a plugin for the event manager, to allow a key name to
be appended to the event name (for keyup and keydown events), so that
the callback is only called for that key.

Here are some examples:
 (keydown.shift.enter)
 (keyup.space)
 (keydown.control.shift.a)
 (keyup.f1)

Key names mostly follow the DOM Level 3 event key values:
http://www.w3.org/TR/DOM-Level-3-Events-key/#key-value-tables

There are some limitations to be worked on (cf details
in https://github.com/angular/angular/pull/1136) but for now, this
implementation is reliable for the following keys (by "reliable" I mean
compatible with Chrome and Firefox and not depending on the keyboard
layout):
- alt, control, shift, meta (those keys can be combined with other keys)
- tab, enter, backspace, pause, scrolllock, capslock, numlock
- insert, delete, home, end, pageup, pagedown
- arrowup, arrowdown, arrowleft, arrowright
- latin letters (a-z), function keys (f1-f12)
- numbers on the numeric keypad (but those keys are not correctly simulated
by Chromedriver)

There is a sample to play with in examples/src/key_events/.

close #523
close #1136
2015-04-10 13:29:27 +02:00
f45281a10a feat(view): generalized loading of dynamic components 2015-04-09 22:15:42 -07:00
e9f70293ac feat(query): adds initial implementation of the query api.
Queries allow a directive to inject a live list of directives of a given
type from its LightDom. The injected list is Iterable (in JS and Dart).
It will be Observable when Observables are support in JS, for now it
maintains a simple list of onChange callbacks API.

To support queries, element injectors now maintain a list of
child injectors in the correct DOM order (dynamically updated by
viewports).

For performance reasons we allow only 3 active queries in an injector
subtree. The feature adds no overhead to the application when not
used. Queries walk the injector tree only during dynamic view
addition/removal as triggered by viewport directives.

Syncs changes between viewContainer on the render and logic sides.

Closes #792
2015-04-09 19:07:19 -07:00
61cb99ea42 refactor(change_detection): removed directive and binding mementos 2015-04-09 18:56:19 -07:00
5408a9a72d cleanup(change_detection): removed dead code 2015-04-09 18:56:19 -07:00
22c1a0d030 fix(benchmarks): Stop working around a Traceur bug. 2015-04-09 18:03:27 -07:00
8c3007e4b5 fix(build): Remove unused done function arguments.
gulp only requires receiving a done argument if a task is not returning
a stream. Doing both is unnecessary and confusing.
2015-04-09 18:03:27 -07:00
838aa2aaa9 fix(ts2dart): Adjust to new ts2dart API. 2015-04-09 18:03:27 -07:00
3285ffba16 fix(traceur): Fix a couple of unsupported or incorrect tests. 2015-04-09 18:03:27 -07:00
17e8857efc feat(dart): Use ts2dart for transpilation in Karma Dart. 2015-04-09 18:03:27 -07:00
226cbc7db3 feat(dart): Use ts2dart for transpilation.
This switches all transpilation over from using Traceur to using ts2dart, based
on the TypeScript tool chain. Transpilation is a bit slow due to issues with
the gulp integration, but that should be easily fixable once we move to
broccoli.
2015-04-09 18:03:27 -07:00
cc7c7b3321 fix(build): Don't include rtts in the dart build.
The module name actually does not include a trailing slash, so the
folder would show up and be included in the dart pubbuild.
2015-04-09 18:03:26 -07:00
70cea03b4b fix(build): Only return directories from subDirs() 2015-04-09 18:03:26 -07:00
a027912891 cleanup(change_detection): fixed ChangeDetector interface 2015-04-09 17:30:04 -07:00
3bdf669ddf cleanup(change_detection): removed dead code 2015-04-09 17:30:04 -07:00
b94b04c074 chore(build): Migrate remaining tasks under build.js.dev to broccoli. 2015-04-09 14:09:38 -07:00
cfc5dd830c perf(build): use patched broccoli-funnel version
see: https://github.com/broccolijs/broccoli-funnel/pull/22
2015-04-09 12:48:51 -07:00
a3097aaf05 chore(build): Migrate build.js.dev fully to broccoli.
The previous change did the ES6 transpile, now we add ES5.
The sourcemaps are broken, but were also broken previously. We'll address that separately.
2015-04-09 11:00:47 -07:00
69c3bff086 feat(change_detection): updated change detection to update directive directly, without the dispatcher 2015-04-08 22:14:50 -07:00
50098767fc refactor(render): use render layer fully
Introduces angular2/src/core/compiler/ViewFactory which
extracts ProtoView.instantiate and replaces ViewPool.

Note: This is a work in progress commit to unblock other commits.
There will be follow ups to add unit tests, remove TODOs, …
2015-04-08 20:51:31 -07:00
de581ea8b3 chore(build): Move broccoli support to own module.
Add support for multiple pipelines in different Brocfile's.
2015-04-08 10:41:42 -07:00
9f8a9c6fc7 chore(doc-gen): ensure all public exports are rendered in public_docs
Closes #1222
2015-04-08 18:58:44 +02:00
ad083ed28f fix(repo): .gitignore the broccoli tmp dir 2015-04-08 09:57:24 -07:00
105ba30ce9 chore(doc-gen): improve method signature formatting
Re-use the preformatting from the source code to layout method signatures
more cleanly.
2015-04-08 17:11:34 +02:00
ee8bf0b3c0 chore(doc-gen): HTML escape method signatures
Closes #1249
Closes #1257
2015-04-08 17:11:34 +02:00
41262f4265 feat(Ruler): introduce Ruler service
Closes #1089

Closes #1253
2015-04-08 11:04:42 +02:00
c349eb4fa4 fix(bundles): remove work-around rx.js module detection.
Updates rx to the newest version, because a fix is needed.

Closes #1245
2015-04-08 11:01:01 +02:00
ca958464c4 refactor(render): create and store render ProtoViewRef in every app ProtoView
Needed to change Renderer.mergeChildComponentProtoViews to not create
new ProtoViews to be able to deal with cyclic references.

This commit is part of using the new render layer in Angular.
2015-04-07 20:27:25 -07:00
d6003ee0ab chore(build): Add traceur transpiler for broccoli.
This exactly reproduces the output tree from one of the gulp tasks, which is now removed.
Next step is to migrate another sibling task to broccoli.
2015-04-07 16:38:02 -07:00
bc248e9a15 fix(build) use relative path in file property inside sourcemap 2015-04-07 12:53:06 -07:00
42c0171b40 chore(dart/transform): Create targets for serving transformed Dart code
- Allow pub (build|serve) to specify mode
- Update pubbuild.js & pubserve.js to allow the caller to provide a `mode` value.
- Update settings to allow the di benchmark to be transformed to run statically.
2015-04-07 10:57:01 -07:00
1a99090b45 chore(doc-gen): don't show Members heading if no members
Closes #1248
2015-04-07 09:23:19 +02:00
b7eea4f577 docs(directives): add # to for directive microsyntax example 2015-04-07 08:44:32 +02:00
9c62b5867e benchmark(change_detection): added a new set of benchmarks measuring updating properties 2015-04-06 18:13:20 -07:00
2560af731a refactor(dart): use Map instead of HashMap
Closes #1202
2015-04-06 17:16:54 +00:00
86211eb5f0 doc(directives): add inline documentation
Closes #1240
2015-04-06 17:11:23 +00:00
a3387b7f48 fix(di): allow injecting static attrs without type annotations
Closes #1226
2015-04-06 12:33:37 +02:00
94a48e8640 test(VmTurnZone): provide a stub VmTurnZone for CJS tests 2015-04-06 10:30:17 +02:00
d8aeb40b49 reafactor(XHR): rename XHRMock to MockXHR for consistency 2015-04-06 10:30:16 +02:00
52c55d0ee8 test: convert to using TestBed 2015-04-06 10:30:16 +02:00
438c2b31e4 test(TestBed): initial implementation 2015-04-06 10:30:16 +02:00
57e308dd46 test(MockTemplateResolver): allow directive overriding 2015-04-06 10:07:50 +02:00
c922b5a112 docs(annotations): fix some typos, align docs with code
Closes #1227
2015-04-04 12:23:01 +02:00
d552303cd5 docs(02_directives.md): foreach -> for
Closes #1235
2015-04-04 10:32:53 +02:00
1d4d18d9db refactor(render): user render compiler 2015-04-03 23:41:00 -07:00
069bbf3ed0 docs(02_directives.md): Fixes variable name for visibility in Components example 2015-04-03 14:18:15 -07:00
a4a2d4e56d chore: allow latest stack_track package 2015-04-03 14:18:14 -07:00
d77f409093 chore: analyzer fixes for Dart transformer 2015-04-03 14:18:14 -07:00
25c709c58e fix(angular2): export PrivateComponent{Loader,Location} in angular2/core 2015-04-03 14:18:14 -07:00
bc909d1d0f refactor(dart/transform): Minor renames
Rename `setupReflection` => `initReflector`
Rename `TemplateComplier` => `TemplateCompiler`

Closes #1180
2015-04-03 13:16:24 -07:00
a6736ff9f2 perf(change detection): Assign this.locals in change detector ctor
Set `this.locals = null;` in the ctor of generated change detector
classes to prevent the class "shape" from changing on `hydrate`.
2015-04-03 12:23:47 -07:00
894a0f0ee5 chore(ts): duplicate the .es6 files in the facade directory to TypeScript.
Adds a gulp task which builds the .ts files (in the cjs build only).
The new files have extension .ts since they are now valid typescript.
Unfortunately until Typescript can emit System.require, we have to keep the old .es6 version
so traceur works inside the Karma preprocessor. This should be fixed soon.
2015-04-03 09:35:06 -07:00
abea92af59 refactor(change_detection): call onChange from the change detector 2015-04-02 21:22:42 -07:00
bcbed2812d feat(bundle): work-around rx.all.js bundle issue.
Adds long-stack-trace-zone into the dev build. Turn off source maps
until proper concatination of them is added.
2015-04-02 19:54:07 -07:00
c0b04ca0bc feat(gulp): adds System.register bundle task. 2015-04-02 19:54:06 -07:00
86dc3e5b07 docs: create public API surface
Closes #1181
2015-04-02 23:23:39 +00:00
c1aa65239e refactor(render): move services to render folder
property_setter_factory
selector
style_inliner
style_url_resolver
shadow_css
2015-04-02 14:40:49 -07:00
be5ccf6957 refactor(render): delete copies files so we add them via moves 2015-04-02 14:24:55 -07:00
09067ebdc5 fix(build): Require gulp-ts2dart at least at 1.0.6.
This fixes the build by pulling in a later version that correctly ignores the .es6 files.
2015-04-02 13:13:47 -07:00
08697e71fa chore(package.json): update madge to v0.5.0
Closes #1211
2015-04-02 22:08:04 +02:00
90d9a1df3f fix(IE11): first fixes
Closes #1179
2015-04-02 22:06:21 +02:00
a96c149793 chore(gulp): Stop copying .cjs files to the dist folder
They're already transpiled by the build/transpile.js.cjs task
2015-04-02 20:51:16 +02:00
1037cef22e refactor(render): misc minor fixes 2015-04-02 20:50:05 +02:00
09948f4403 feat(dart/transform): Add a di transformer
Add a transformer for `di` which generates `.ng_deps.dart` files for all
`.dart` files it is run on. These `.ng_deps.dart` files register
metadata for any `@Injectable` classes.

Fix unit tests for changes introduced by the di transformer.

When using `pub (build|serve) --mode=ngstatic`, we will also generate
getters and setters, parse templates, and remove import of `dart:mirrors`
in the Angular transform. Because this is still relatively immature, we
use the mode to keep it opt-in for now.

Closes #700
2015-04-02 11:06:33 -07:00
788461b7e2 feat(di): Mark objects @Injectable
Allow `PrivateComponentLoader`, `Testability`, and `TestabilityRegistry` to be injected.
2015-04-02 11:02:26 -07:00
4f56628566 refactor(render): move services to right location
core/compiler/events -> render/dom/events
core/compiler/url_resolver -> services/url_resolver
core/compiler/xhr/* -> services/*
2015-04-02 10:35:27 -07:00
bcbf1ccc68 refactor(render): remove duplicate files to prepare for move
Remove first so Github shows the files as being moved instead of copied and deleted.
2015-04-02 10:35:27 -07:00
ae30d7ba40 fix(di): allow injecting event emitter fns without specifying type annotation
Fixes #965

Closes #1155
2015-04-02 19:07:49 +02:00
9adf41ca2d fix(build) Add a .tsdrc file for github rate limiting.
See https://github.com/DefinitelyTyped/tsd#tsdrc
2015-04-02 10:05:37 -07:00
1d79d534d9 test(selector): add tests with multiple attributes
Fixes #1025
Closes #1117
2015-04-02 18:06:44 +02:00
60e4197026 feat(tooling): Add a .clang-format for automated JavaScript formatting. 2015-04-02 08:44:34 -07:00
2fabca77b9 test(Travis): use test.dart for Dart tests 2015-04-02 13:12:59 +02:00
47542b0cb0 fix(build): don’t read out chrome perflogs during e2e tests
We do this as we are seeing flakes in Chrome with ECONNREFUSED.

Also reuses the same browser window.

Also reenables the infinite scroll benchmark

Closes #1137
2015-04-01 17:09:26 -07:00
6c60c3e547 feat(render): add initial implementation of render layer 2015-04-01 16:50:22 -07:00
814d389b6e chore(gulp): add typescript transpilation tasks 2015-04-01 15:01:27 -07:00
e81e5fb2b9 feat(testability): add an initial scaffold for the testability api
Make each application component register itself onto the testability
API and exports the API onto the window object.
2015-04-01 13:54:06 -07:00
f68cdf3878 chore(ts): introduce some TypeScript type declarations.
This uses tsd to fetch the typings from another git repo. I've forked the DefinitelyTyped repo because some typings we use are not available upstream.
We should probably fork it in the Angular org, so everyone on the team has commit access to our DefinitelyTyped fork.
2015-04-01 12:01:45 -07:00
91e0e9e1dd chore(ts): Patch traceur's type module only when targetting es6 output. 2015-04-01 10:39:06 -07:00
59c1299168 fix(tests): add missing ;s 2015-04-01 15:30:46 +02:00
27c6afbeb4 chore(doc-gen): add temporary dump of all API docs
Remove unwanted < character
2015-04-01 10:24:33 +01:00
514ba54282 feat(change_detection): added changeDetection to Component 2015-03-31 20:54:44 -07:00
a11f683e7b chore(ts): Don't mask the Regexp builtin.
Doing so makes it impossible to compile with TypeScript, since it conflicts with the shape of the Regexp global var defined in the standard lib.
2015-03-31 19:20:21 -07:00
b65b145122 refactor(view): refactored DirectiveMemento to expose properties in a consistent way 2015-03-31 18:26:58 -07:00
982bb8b01d fix(forms): fixed a directive selector 2015-03-31 17:45:38 -07:00
eb7b7581ca fix(build): Actually code in the subset of JS that Traceur-Dart supports. 2015-03-31 16:08:49 -07:00
adab6c0728 chore(doc-gen): add temporary dump of all API docs
Accessible at `angular/dist/public_docs/overview-dump.html`
2015-03-31 22:12:41 +01:00
609201e109 chore(doc-gen): add method signatures to members and functions
Closes https://github.com/angular/dgeni/issues/124
2015-03-31 22:12:41 +01:00
54a4e4a67c fix(dart): The Traceur dart transpiler doesn't support shorthand syntax. 2015-03-31 13:17:56 -07:00
aca4604879 feat(CSSClass): support binding to classList
Closes #876
2015-03-31 21:53:24 +02:00
48811cd805 doc(lifecycle): minor fixes 2015-03-31 21:12:37 +02:00
136f64f4ac fix(dart): don't instantiate abstract directive.
Directive is an abstract class, so it should not
be instantiated directly in tests.
2015-03-31 11:38:59 -07:00
123ee8e06f feat(dom): add replaceChild to DOM adapter 2015-03-31 09:54:41 -07:00
a55efbd8b8 feat(perf): add Angular2 implementation of largetable benchmark from AngularJS 1.x 2015-03-31 09:54:41 -07:00
7bf9525353 fix(benchmark_util): remove strict equality check from getStringParameter
Transpiled dart code was using identical() method to compare, which checks reference
equality, even for strings.
2015-03-31 09:54:41 -07:00
3915e1b242 docs(annotations): Added new text 2015-03-30 17:19:58 -07:00
ed5975d3e5 test(dart/transform): Add unit tests for url-linked templates
Test expression and method generation from url-linked templates.
2015-03-30 14:49:31 -07:00
1a788e6b0d feat(dart/transform): Parse url values in Templates
When a `Template` annotation declares a `url` value, parse it to
generate `getter`s, `setter`s, and `method`s which will it needs to
access reflectively.
2015-03-30 14:49:31 -07:00
d822793229 fix(test): add a test for @PropertySetter on a class with a dash
Closes #1113
Fixes #1099
2015-03-28 16:17:43 +01:00
b46d0bc48c docs(annotations): fix typo, align docs with code
Closes #1045
2015-03-28 15:39:50 +01:00
65320126c2 docs(directives): fix HTML in an example
Closes #1115
2015-03-28 15:37:11 +01:00
c63b3164bd fix(build): add package.json again to the copy files for js 2015-03-27 17:34:26 -07:00
dbffa88dc2 chore(release): bump version to 2.0.0-alpha.18
For docs
2015-03-27 17:16:22 -07:00
8c5d9d372f fix(build): publish docs as well and correct bench press docs 2015-03-27 16:47:52 -07:00
50f8892c6b chore(release): bump version
Somehow the version bump from alpha.16 was not submitted to master…
2015-03-27 16:21:41 -07:00
3bfbfa8ae0 chore(release): bump version 2015-03-27 16:18:36 -07:00
8598c87ef4 docs(bench press): add initial docs 2015-03-27 16:16:35 -07:00
33bfc4c24a feat(bench press): replace microIterations with microMetrics 2015-03-27 16:16:35 -07:00
3afb744e77 chore(ci): reorganize e2e/perf test running
Now, running protractor configs by default only runs e2e tests. If
the --benchmark flag is added, it runs only the perf tests, and always
restarts the browser in between tests. If the --dryrun test is added,
the perf tests are run only once.

This should make it easier to run perf tests versus example e2e tests,
and help stabilize the travis build because perf tests always
run with a clean browser.
2015-03-27 13:29:21 -07:00
e92918bbfe feat(change_detector): split light dom and shadow dom children 2015-03-27 13:26:37 -07:00
723e8fde93 feat(change_detection): added a directive lifecycle hook that is called after children are checked 2015-03-27 13:26:36 -07:00
507f7ea70a chore(package.json): upgrade zone.js to v0.4.2
Closes #1142
2015-03-27 16:24:07 -04:00
6b985d56a5 cleanup(forms): added missing type annotations
Closes #1054
2015-03-27 11:30:39 -07:00
c8385ad998 refactor(cd): remove dead code 2015-03-27 16:59:23 +01:00
9d21a6f40d chore(package.json): upgrade traceur to v0.0.87
Fix in source-map test to follow through the sourcemap chain.
2015-03-26 18:37:03 -07:00
d304f41197 docs(core): improved docs on directive lifecycle 2015-03-26 18:18:25 -07:00
8d85b839b6 feat(change_detection): pass binding propagation config to pipe registry 2015-03-26 16:57:04 -07:00
dd235f38a3 fix(build): try to eliminate build flakes by running dartstyle:format sequentially 2015-03-26 16:23:09 -07:00
5306b6dd0c fix(change_detection): expose values when detecting changes in key-value pairs
Fixes #1118

Closes #1123
2015-03-26 21:18:14 +01:00
b09624024b example(forms): added a example of using forms 2015-03-26 11:36:14 -07:00
edc3709451 fix(ElementBinderBuilder): properly bind CSS classes with "-" in their names
Fixes #1057

Closes #1059
2015-03-26 19:25:31 +01:00
e706f3477b Remove invalid super() call
Unless I'm missing something?
2015-03-26 11:10:39 -07:00
6298cb3999 chore(ci): upgrade to new version of protractor and selenium-webdriver
Protractor 2.0.0
selenium-webdriver 2.45.1
2015-03-26 10:00:46 -07:00
878fce6482 fix(ts): ts doesn't like ";;" 2015-03-26 17:32:48 +01:00
b02bd65871 feat(forms): made forms works with single controls 2015-03-26 07:48:17 -07:00
ee36aaf163 fix(tests): fixed a broken test 2015-03-26 07:46:26 -07:00
ff84506bd5 feat(forms): added support for arrays of controls 2015-03-26 07:43:25 -07:00
0ae33b7e3c refactor(compiler): factorize common util code dash <-> camel
Closes #1114
Fixes #1097
2015-03-26 15:22:35 +01:00
b1dc6239ef feat(core): @Attribute annotation
Closes #1091
Fixes #622
2015-03-26 10:51:44 +01:00
3ce0f1146f chore(dgeni): set log level to 'warning' 2015-03-26 09:31:36 +01:00
3ec837bfdb test(di): Add a test for sync binding + resolved async dependency 2015-03-26 08:38:29 +01:00
18ff2be9bb feat(ts2dart): include srcFolderInsertion in ts2dart step. 2015-03-25 21:31:40 -07:00
c0d296334c feature(ts2dart): ts2dart runs on all .js files.
Update the experimental ts2dart task to also read the .es6 files, which are the next step.
2015-03-25 17:14:06 -07:00
9a0a2e319c chore(ts2dart) remove extra semi
This breaks our ts2dart transpilation.
2015-03-25 17:06:47 -07:00
a0d86ac2bb chore(ts2dart): ts2dart doesn't support mixed typed/untyped var decl lists. 2015-03-25 16:41:33 -07:00
99045b2f6a refactor: update Dart package dependencies 2015-03-25 15:54:12 -07:00
c34ca36778 chore: build the stable branch of Dart
Now that Dart 1.9 is stable
2015-03-25 21:17:07 +01:00
58dd75a1c8 feat(compiler): Add support for setting attributes to Component host element
Fixes #1008
Fixes #1009
Closes #1052
2015-03-25 17:32:07 +01:00
f995b07876 docs: annotations edits 2015-03-24 23:28:24 +00:00
101a4aa3cf feat(PrivateComponentLoader): Explicit error message when loading a non-component
fixes #1062
2015-03-24 22:11:41 +01:00
65d759316b fix(PrivateComponentLoader): add the loader to the app injector
fixes #1063
2015-03-24 22:10:26 +01:00
19c1773133 feat(forms): added an observable of value changes to Control 2015-03-24 13:45:47 -07:00
9b3b3d325f feat(facade): added support for observables 2015-03-24 13:45:39 -07:00
43f4374944 feature(build): Include ts2dart transpile step in the Angular build.
This only transpiles one package to start with: di/
It ensures that package transpiles without errors, so no one can
introduce non-TypeScript syntax.
Next step is to widen the task inputs to cover additional packages.

See design doc for the migration:
https://docs.google.com/document/d/14RJLhu6uuv7NchFkAb6PKzOOO0L7l3Z507eKWzkEUhQ/edit

A convenience task 'ts2dart' is added for developing ts2dart, and
it runs all of the angular code through the transpiler to collect errors.
2015-03-24 10:34:46 -07:00
81e6d13241 chore: bump up the version to 2.0.0-alpha.15 2015-03-24 07:50:39 -07:00
f8e7a37c0d fix(view): fixed view instantiation to use the component template's change detector when creating BindingPropagationConfig 2015-03-24 07:49:28 -07:00
c686e7ea30 chore(doc-gen): ignore non-jsdoc style comments
Now the visitor will find the last jsdoc style comment (e.g. `/** jsdoc comment */`)
before the current code item, ignoring any inline style comments (e.g. `// inline comment`)
in between.

Closes #1072
2015-03-24 11:25:58 +00:00
7e89af8190 chore(doc-gen): move @publicModule tag-def to base package
This prevents unwanted "unknown tag" warnings when generating the non-public docs.
2015-03-24 10:57:42 +00:00
539e8e2cce chore(doc-gen): add specific template for displaying variable exports
Closes #1071
2015-03-24 10:57:42 +00:00
aab084866c doc(test): add a comment on why tests are disabled 2015-03-24 09:52:41 +01:00
0e61a86763 docs: annotations 2015-03-24 00:42:58 +00:00
1c9938ed98 chore(packaging): bump version to alpha.14 2015-03-23 17:14:55 -07:00
47c1a0f381 feat(forms): added value accessor for input=text 2015-03-23 08:53:27 -07:00
514529b5d9 refactor(formed): changed forms to use event and property setters instead of NgElement 2015-03-23 08:52:54 -07:00
a12dc7d75a refactor(forms): wrapped all validators into the Validator class 2015-03-23 08:50:56 -07:00
41b53e71e1 feat(selector): support , for multiple targets
Fixes #867
Closes #1019
2015-03-23 10:06:33 +01:00
0fb9f3bd6c fix(ElementBinderBuilder): properly bind to web component properties
Fixes #776

Closes #1024
2015-03-22 14:14:36 +01:00
81f3f32217 refactor(DirectiveParser): remove checks for missing directives
Based on the discussion in #776 we can't reliably check if a given
element has a particular property at the compilation time. As such
the existing algorithm detecting "missing" directives can't be used.

We need to see if there is a different / better algorithm or maybe
those checks need to be moved later in the process (runtime). Leaving
integration tests in place (disabled) so we can come back to the
topic after unblocking the situation.

This commit effectivelly reverts 94e203b9df
2015-03-22 14:14:36 +01:00
b35f288794 refactor(dart/transform): Use package:guinness in tests
`guinness` is a Dart port of Jasmine. Since the rest of Angular 2 uses
Jasmine, use it for the transformer too.

Closes #8

Closes #1037

Closes #1000
2015-03-21 15:18:15 -07:00
4e82cc0861 refactor(dart/transform): Test directive_linker as a unit
Formerly, it was tested only as a piece of the transformer pipeline. Add
its own directory and test the linker on its own.
2015-03-21 15:18:15 -07:00
c735644c57 refactor(dart/transform): Minor logging changes
Enable easier testing by providing a null log implementation and a way
to use it.
2015-03-21 15:18:15 -07:00
5d479fa0ae refactor(dart/transform): Remove ngData
Now that we have `Parser`, `ngData` is redundant & unnecessary.
2015-03-21 15:18:15 -07:00
8baedca972 style(dart/transform): Remove src from library directives
Conform to Angular 2 style by removing `src` from library directives.
Completed with:
```
find -name "*.dart" | xargs sed -i -e 's!library\(.*\)src\.\(.*\)!library \1\2!'
```

Closes #1005

Closes #1038
2015-03-21 14:55:11 -07:00
02aa8e7945 feat(compiler): support bindings for any attribute
Closes #1029
2015-03-21 14:55:11 -07:00
ee523efcb4 feat(ShadowCss): Support the new deep combinator syntax >>>
fixes #990

ref http://dev.w3.org/csswg/css-scoping-1/#deep-combinator

Closes #1028
2015-03-21 14:55:11 -07:00
eef5f7e06d README - don't forget to build app before start
Don't forget to build app before start HTTP server

Closes #1014
2015-03-21 14:55:11 -07:00
83402930f2 chore(install+test): single cmd to full install/test & test JS w/o Dart
* `npm install` now does a full install; auxiliary installation steps
have been integrated into the `postinstall` script.
* Updated developer docs `DEVELOPER.md` accordingly; also added
instructions to dev docs for performing full tests (via `npm test`) --
same as those run on Travis.
* Reorg in tests so that JS tests can run without a Dart env.

Partly fixes #945 **under the assumption that when running JS tests
locally, `ChromeCanary` is the desired browser to use**. Note that CI
tests (Travis) still uses `DartiumWithWebPlatform` across the board
(Maybe because ChromeCanary isn't being installed?)

Fixes #1012.

Closes #1010
2015-03-21 14:55:11 -07:00
bd48c927d0 fix(ViewContainer) removeChild called with null parent
In view_container.js, templateElement.parentNode can be null
when two template tags are nested in one another.
Accessing the parent node through view.nodes[0].parentNode fixes
the problem.

closes #997

Closes #999
2015-03-21 14:55:10 -07:00
b61b8d60b7 refactor(forEach): change to for-of with iterable
rename: foreach -> for
rename: array -> iterable
update: DartParseTreeWriter
update: naive_infinite_scroll
update: todo
fix: tests in foreach_spec

Closes #919
2015-03-21 14:19:21 -07:00
f1fca5abb6 (docs) decorator events property
As from what i understand shouldn't the event property rather be events: https://github.com/angular/angular/blob/master/modules/angular2/src/core/annotations/annotations.js#L161

Closes #1018
2015-03-21 18:26:13 +00:00
045ce3c77a Fix which dependency is injected w/ current elem.
Docs for the "Injecting a directive from the current element" indicate that having a dependency of `dependency: Dependency` should cause the current element's dependency to be injected, but then uses the ID value from the parent element in the example.

Closes #1032
2015-03-21 18:14:43 +00:00
f822066e2a docs: annotations 2015-03-21 18:05:12 +00:00
1121 changed files with 88838 additions and 35481 deletions

3
.bowerrc Normal file
View File

@ -0,0 +1,3 @@
{
"directory": "bower_components"
}

3
.clang-format Normal file
View File

@ -0,0 +1,3 @@
Language: JavaScript
BasedOnStyle: Google
ColumnLimit: 100

19
.gitignore vendored
View File

@ -1,11 +1,17 @@
.DS_STORE
# Dont commit the following directories created by pub.
packages
pubspec.lock
.pub
/dist/
packages/
.buildlog
node_modules
bower_components
.pub
.DS_STORE
# Or broccoli working directory
tmp
# Or the files created by dart2js.
*.dart.js
@ -14,6 +20,10 @@ bower_components
*.js.deps
*.js.map
# Or type definitions we mirror from github
**/typings/**/*.d.ts
**/typings/tsd.cached.json
# Include when developing application packages.
pubspec.lock
.c9
@ -23,4 +33,7 @@ pubspec.lock
# Don't check in secret files
*secret.js
# Ignore npm debug log
npm-debug.log
/docs/bower_components/

12
.settings/settings.json Normal file
View File

@ -0,0 +1,12 @@
// Place your settings in this file to overwrite default and user settings.
{
"search.excludeFolders": [
".git",
"node_modules",
"bower_components",
"packages",
"build",
"dist",
"tmp"
]
}

View File

@ -1,32 +1,61 @@
language: node_js
sudo: false
node_js:
- '0.10'
- '0.12'
cache:
directories:
- node_modules
- $HOME/.pub-cache
env:
global:
- KARMA_BROWSERS=DartiumWithWebPlatform
- E2E_BROWSERS=Dartium
- LOGS_DIR=/tmp/angular-build/logs
- ARCH=linux-x64
# Token for tsd to increase github rate limit
# See https://github.com/DefinitelyTyped/tsd#tsdrc
# This does not use http://docs.travis-ci.com/user/environment-variables/#Secure-Variables
# because those are not visible for pull requests, and those should also be reliable.
# This SSO token belongs to github account angular-github-ratelimit-token which has no access
# (password is in Valentine)
- TSDRC='{"token":"ef474500309daea53d5991b3079159a29520a40b"}'
matrix:
- MODE=js DART_CHANNEL=dev
# Dissabled until Dart v1.9 hits stable
# - MODE=dart DART_CHANNEL=stable
- MODE=dart DART_CHANNEL=stable
- MODE=dart DART_CHANNEL=dev
addons:
firefox: "38.0"
before_install:
- echo ${TSDRC} > .tsdrc
- export DISPLAY=:99.0
- export GIT_SHA=$(git rev-parse HEAD)
- ./scripts/ci/init_android.sh
- ./scripts/ci/install_dart.sh ${DART_CHANNEL} ${ARCH}
- sh -e /etc/init.d/xvfb start
- if [[ -e SKIP_TRAVIS_TESTS ]]; then { cat SKIP_TRAVIS_TESTS ; exit 0; } fi
install:
# Update npm
- npm install -g npm@2.9.1
- npm --version
# Check the size of caches
- du -sh ./node_modules || true
# Install npm dependecies and ensure that npm cache is not stale
- tools/npm/install-dependencies.sh
before_script:
- mkdir -p $LOGS_DIR
script:
- ./scripts/ci/build_and_test.sh ${MODE}
after_script:
- ./scripts/ci/print-logs.sh
notifications:
webhooks:
urls:

403
CHANGELOG.md Normal file
View File

@ -0,0 +1,403 @@
<a name"2.0.0-alpha.26"></a>
### 2.0.0-alpha.26 (2015-06-03)
#### Bug Fixes
* format a file that slipped in. ([471a1b6d](https://github.com/angular/angular/commit/471a1b6d))
* fix clang errors ([01fb8e66](https://github.com/angular/angular/commit/01fb8e66))
* **ShadowCss:** keyframes tests failing in Safari ([4c8e11a5](https://github.com/angular/angular/commit/4c8e11a5), closes [#2283](https://github.com/angular/angular/issues/2283))
* **Tools:** Moves files out of dart2js/**/web. ([40150379](https://github.com/angular/angular/commit/40150379))
* **ast:** fix the size of a list in _evalListCache ([0387221d](https://github.com/angular/angular/commit/0387221d))
* **benchpress:**
* support nested intervals ([c280fe81](https://github.com/angular/angular/commit/c280fe81))
* add index to root of module ([383f0a1f](https://github.com/angular/angular/commit/383f0a1f))
* **binding:** unbalanced curly brackets in documentation ([a80921b4](https://github.com/angular/angular/commit/a80921b4))
* **browser_adapter:**
* HTMLStyleElement.innerText does not trigger creation of CSS rules (Firefox) ([b2a24e02](https://github.com/angular/angular/commit/b2a24e02))
* event creation fails (IE11, Firefox) ([665ccafd](https://github.com/angular/angular/commit/665ccafd))
* element.getBoundingClientRect fails when element not in DOM (IE11) ([f35dbb99](https://github.com/angular/angular/commit/f35dbb99))
* element.matches only available with prefix (IE11) ([a393f84f](https://github.com/angular/angular/commit/a393f84f))
* assigning null to document.title sets the title to "null" (IE11, Firefox) ([92c2c33a](https://github.com/angular/angular/commit/92c2c33a))
* **build:**
* remove nonexistant dart format task from gulpfile ([f74d7727](https://github.com/angular/angular/commit/f74d7727))
* make dart formatter errors more readable ([31b66878](https://github.com/angular/angular/commit/31b66878))
* also run ts tests in node. ([05774f6c](https://github.com/angular/angular/commit/05774f6c))
* **collection:**
* iterator on Map keys is not supported (Safari) ([4b98ed11](https://github.com/angular/angular/commit/4b98ed11), closes [#2096](https://github.com/angular/angular/issues/2096))
* new Map(iterable) is not supported (Safari) ([d308e55e](https://github.com/angular/angular/commit/d308e55e))
* new Set(iterable) is not supported (IE11, Safari) ([57b88ec2](https://github.com/angular/angular/commit/57b88ec2), closes [#2063](https://github.com/angular/angular/issues/2063))
* **core:** resurrect OnChange interface ([d48fae35](https://github.com/angular/angular/commit/d48fae35))
* **dartdocs:** Hide duplicate exports from guinness. ([17e1d7f1](https://github.com/angular/angular/commit/17e1d7f1))
* **deps:** Update clang-format to 1.0.14. ([15f1eb28](https://github.com/angular/angular/commit/15f1eb28))
* **di:** allow `@Inject(…)` to work in dart2js and dynamic reflection ([4a3fd5e8](https://github.com/angular/angular/commit/4a3fd5e8), closes [#2185](https://github.com/angular/angular/issues/2185))
* **docs:** generate d.ts file only for angular2/angular2. ([0a0b84a0](https://github.com/angular/angular/commit/0a0b84a0))
* **dom:**
* allow to correctly clone document fragments ([2351896c](https://github.com/angular/angular/commit/2351896c))
* `querySelectorAll` should only query child nodes ([307011a9](https://github.com/angular/angular/commit/307011a9))
* **example:** unused event ([f83f1ee0](https://github.com/angular/angular/commit/f83f1ee0))
* **examples:** update form example to use NgIf ([1ad65582](https://github.com/angular/angular/commit/1ad65582))
* **facade:**
* Make PromiseWrapper#all semantics equivalent ([22f59252](https://github.com/angular/angular/commit/22f59252))
* Fix bug in TS indexOf ([cda35101](https://github.com/angular/angular/commit/cda35101))
* **fake_async:** fixed fakeAsync to throw instead of crashing on cjs ([5c53cf64](https://github.com/angular/angular/commit/5c53cf64))
* **forms:** disabled form tests on cjs until fakeAsync is fixed ([cd52d8a3](https://github.com/angular/angular/commit/cd52d8a3))
* **gulp:** prevent duplicate error messages ([381d4cb3](https://github.com/angular/angular/commit/381d4cb3), closes [#2021](https://github.com/angular/angular/issues/2021))
* **injectable:** add missing @Injectables annotations ([0c7f05f5](https://github.com/angular/angular/commit/0c7f05f5), closes [#2173](https://github.com/angular/angular/issues/2173))
* **package.json:** add `reflect-metadata` to package.json ([60801777](https://github.com/angular/angular/commit/60801777), closes [#2170](https://github.com/angular/angular/issues/2170))
* **render:**
* only look for content tags in views that might have them. ([ba7956f5](https://github.com/angular/angular/commit/ba7956f5), closes [#2297](https://github.com/angular/angular/issues/2297))
* dont store a document fragment as bound element ([24bc4b66](https://github.com/angular/angular/commit/24bc4b66))
* **router:** event.defaultPrevented is not reliable (IE11) ([2287938f](https://github.com/angular/angular/commit/2287938f))
* **selector:** support multiple `:not` clauses ([62a95823](https://github.com/angular/angular/commit/62a95823), closes [#2243](https://github.com/angular/angular/issues/2243))
* **test:**
* clang formatting errors ([05d66bba](https://github.com/angular/angular/commit/05d66bba))
* solve CSS discrepancies across browsers ([fb42d590](https://github.com/angular/angular/commit/fb42d590), closes [#2177](https://github.com/angular/angular/issues/2177))
* use a not expandable CSS rule in ShadowCSS spec (Firefox) ([588fbfd8](https://github.com/angular/angular/commit/588fbfd8), closes [#2061](https://github.com/angular/angular/issues/2061))
* adds longer timers for NgZone and PromisePipe tests (IE11) ([661a0479](https://github.com/angular/angular/commit/661a0479), closes [#2055](https://github.com/angular/angular/issues/2055))
* native shadow DOM is required (IE11, Firefox) ([9802debf](https://github.com/angular/angular/commit/9802debf))
* function.name is not available (IE11) ([5103f080](https://github.com/angular/angular/commit/5103f080))
* **tests:** disable mobile emulation so benchmarks run on current chrome ([b071b66b](https://github.com/angular/angular/commit/b071b66b))
* **types:** parametrize QueryList. ([552985e3](https://github.com/angular/angular/commit/552985e3))
#### Features
* add support for the safe navigation (aka Elvis) operator ([a9be2ebf](https://github.com/angular/angular/commit/a9be2ebf), closes [#791](https://github.com/angular/angular/issues/791))
* **Directive:** convert properties to an array ([d7df853b](https://github.com/angular/angular/commit/d7df853b), closes [#2013](https://github.com/angular/angular/issues/2013))
* **ElementInjector:** support an arbitrary number of bindings ([b1c9bf14](https://github.com/angular/angular/commit/b1c9bf14), closes [#1853](https://github.com/angular/angular/issues/1853))
* **OpaqueToken:** now a const constructor ([c571b269](https://github.com/angular/angular/commit/c571b269))
* **RegExpWrapper:** implement a test method ([551586ce](https://github.com/angular/angular/commit/551586ce))
* **benchpress:** Add extension for ff metrics reporting ([b390f441](https://github.com/angular/angular/commit/b390f441), closes [#1976](https://github.com/angular/angular/issues/1976))
* **binding:** throw on binding to a blank alias ([ec2d8cc2](https://github.com/angular/angular/commit/ec2d8cc2), closes [#2068](https://github.com/angular/angular/issues/2068))
* **broccoli:** add incremental dartfmt plugin ([e5d06e47](https://github.com/angular/angular/commit/e5d06e47), closes [#2211](https://github.com/angular/angular/issues/2211))
* **change_detection:** added onInit and onCheck hooks ([c39c8ebc](https://github.com/angular/angular/commit/c39c8ebc))
* **change_detection.ts:** export PipeFactory ([93f464a1](https://github.com/angular/angular/commit/93f464a1), closes [#2245](https://github.com/angular/angular/issues/2245))
* **core:**
* added support for detecting lifecycle events based on interfaces ([30b6542f](https://github.com/angular/angular/commit/30b6542f))
* added missing interfaces for onDestroy and onAllChangesDone lifecycle events ([2b6a6530](https://github.com/angular/angular/commit/2b6a6530))
* **di:** added optional self parameter to Parent, Ancestor, and Unbounded ([34cfc9f4](https://github.com/angular/angular/commit/34cfc9f4))
* **dom:** add `setData()` method. ([6f3368ef](https://github.com/angular/angular/commit/6f3368ef))
* **facade:** add read/write access to global variables ([cdf791f0](https://github.com/angular/angular/commit/cdf791f0))
* **fakeAsync:** flush the microtasks before returning ([c7572ac1](https://github.com/angular/angular/commit/c7572ac1), closes [#2269](https://github.com/angular/angular/issues/2269))
* **form:** implemented an imperative way of updating the view by updating the value of a co ([652ed0cf](https://github.com/angular/angular/commit/652ed0cf))
* **forms:**
* added support for status classes ([3baf815d](https://github.com/angular/angular/commit/3baf815d))
* added touched and untouched to Control ([ec3a7828](https://github.com/angular/angular/commit/ec3a7828))
* renamed control, control-group into ng-control and ng-control-group ([f543834b](https://github.com/angular/angular/commit/f543834b))
* changed the selector of TemplatdrivenFormDirective to match <form> ([6bef1c41](https://github.com/angular/angular/commit/6bef1c41))
* added ng-model ([559f54e9](https://github.com/angular/angular/commit/559f54e9))
* implemented template-driven forms ([a9d6fd9a](https://github.com/angular/angular/commit/a9d6fd9a))
* **key_event:** alias esc to escape ([10bc7e94](https://github.com/angular/angular/commit/10bc7e94), closes [#2010](https://github.com/angular/angular/issues/2010))
* **reflector:** added a method to get type's interfaces ([34d75e89](https://github.com/angular/angular/commit/34d75e89))
* **render:** re-export render and export `DirectiveResolver` ([662da0d7](https://github.com/angular/angular/commit/662da0d7), closes [#2026](https://github.com/angular/angular/issues/2026))
* **router:** add the router bundle to the bundle task. ([05fa9bc9](https://github.com/angular/angular/commit/05fa9bc9))
* **router.js:**
* export router injectables ([28ee0612](https://github.com/angular/angular/commit/28ee0612))
* export routerDirectives ([1f20ef97](https://github.com/angular/angular/commit/1f20ef97))
* **test:**
* added not.toBeNull ([74882c6c](https://github.com/angular/angular/commit/74882c6c))
* add element probe ([f9908cd4](https://github.com/angular/angular/commit/f9908cd4), closes [#1992](https://github.com/angular/angular/issues/1992))
* **test_lib:**
* add method to compare stringified DOM element ([c6335c12](https://github.com/angular/angular/commit/c6335c12), closes [#2106](https://github.com/angular/angular/issues/2106))
* add `containsRegex` ([23d59df8](https://github.com/angular/angular/commit/23d59df8))
* **tests:** add TestComponentBuilder ([c32dbad7](https://github.com/angular/angular/commit/c32dbad7), closes [#1812](https://github.com/angular/angular/issues/1812))
* **transformers:** added support for lifecycle events ([f19970a4](https://github.com/angular/angular/commit/f19970a4))
* **view:**
* introduce free embedded views ([5030ffb0](https://github.com/angular/angular/commit/5030ffb0))
* add `AppViewListener` interface ([75578f41](https://github.com/angular/angular/commit/75578f41))
#### Breaking Changes
*
- `Renderer.detachFreeHostView` was renamed to
`Renderer.detachFreeView`
- `DomRenderer.getHostElement()` was generalized into
`DomRenderer.getRootNodes()`
([5030ffb0](https://github.com/angular/angular/commit/5030ffb0))
*
now a `const` constructor
([c571b269](https://github.com/angular/angular/commit/c571b269))
*
Before
@Directive(properties: {
'sameName': 'sameName',
'directiveProp': 'elProp | pipe'
})
After
@Directive(properties: [
'sameName',
'directiveProp: elProp | pipe'
])
([d7df853b](https://github.com/angular/angular/commit/d7df853b))
<a name"2.0.0-alpha.25"></a>
### 2.0.0-alpha.25 (2015-05-21)
#### Bug Fixes
* don't call onAllChangesDone on checkNoChanges ([a664f5a6](https://github.com/angular/angular/commit/a664f5a6))
* **XHRImpl:** fix errors, add a spec ([91ccc9af](https://github.com/angular/angular/commit/91ccc9af), closes [#1715](https://github.com/angular/angular/issues/1715))
* **browser:** template elements should have content imported instead of the element itself. ([c9ab8e4b](https://github.com/angular/angular/commit/c9ab8e4b))
* **di:** changed host and view injector to respect visibility ([705ee46f](https://github.com/angular/angular/commit/705ee46f))
* **element_injector:**
* fixed element injector to inject view dependencies into its components ([b6b52e62](https://github.com/angular/angular/commit/b6b52e62))
* fixed element injector to resolve dependencies of regular services ([28c2b8f4](https://github.com/angular/angular/commit/28c2b8f4))
* **forms:** changed forms to create only one value accessor instead of always creating Defau ([30c3e5a8](https://github.com/angular/angular/commit/30c3e5a8))
* **gulp:** continue watching when tasks throw ([ac28ac32](https://github.com/angular/angular/commit/ac28ac32), closes [#1915](https://github.com/angular/angular/issues/1915))
* **router:** router link should navigate to non-base Url. ([c4528321](https://github.com/angular/angular/commit/c4528321))
* **test_lib:** fixes nested beforeEach. ([826af401](https://github.com/angular/angular/commit/826af401))
#### Features
* **CD:** add support for === and !== ([0ae89ac0](https://github.com/angular/angular/commit/0ae89ac0))
* **PromisePipe:** remove ref onDestroy ([4afd2b41](https://github.com/angular/angular/commit/4afd2b41))
* **di:** changed toFactory to support dependency annotations ([f210c41c](https://github.com/angular/angular/commit/f210c41c))
* **forms:** migrated forms to typescript ([00c3693d](https://github.com/angular/angular/commit/00c3693d))
* **injector:** support forwardRef in toAlias ([fed86fc8](https://github.com/angular/angular/commit/fed86fc8))
<a name"2.0.0-alpha.24"></a>
### 2.0.0-alpha.24 (2015-05-19)
#### Bug Fixes
* **Compiler:** add an error when a directive is null or undefined ([25cd6e43](https://github.com/angular/angular/commit/25cd6e43), closes [#1908](https://github.com/angular/angular/issues/1908))
* **benchmark:**
* change If for NgIf ([cdbb2473](https://github.com/angular/angular/commit/cdbb2473))
* fixes ng-if ng-for renaming for templates. ([38926f71](https://github.com/angular/angular/commit/38926f71))
* **build:** npm shrinkwrap to pick up changed SHA1. ([04a9eb88](https://github.com/angular/angular/commit/04a9eb88))
* **directives:** fix import path ([c20060d2](https://github.com/angular/angular/commit/c20060d2))
* **errors:** require passing stack traces explicitly in ng2 own code ([8ab77353](https://github.com/angular/angular/commit/8ab77353))
* **examples:** prefix directives with Ng ([0e82970a](https://github.com/angular/angular/commit/0e82970a))
* **facade:** MapWrapper.createFromPairs ([af9dcad8](https://github.com/angular/angular/commit/af9dcad8), closes [#1640](https://github.com/angular/angular/issues/1640))
* **ng1 benchmarks:** revert *ng-if to ng-if ([909233f7](https://github.com/angular/angular/commit/909233f7))
* **router:**
* use appRootComponentToken to get root route configs ([791caf00](https://github.com/angular/angular/commit/791caf00), closes [#1947](https://github.com/angular/angular/issues/1947))
* improve route matching priorities ([5db89071](https://github.com/angular/angular/commit/5db89071))
* generate links for router-link with baseHref ([390cfb79](https://github.com/angular/angular/commit/390cfb79))
* sort possible routes by cost ([17392f66](https://github.com/angular/angular/commit/17392f66))
* **tree-differ:** treat symlinks to deleted paths as removals ([aad57954](https://github.com/angular/angular/commit/aad57954), closes [#1961](https://github.com/angular/angular/issues/1961))
#### Features
* allow for forward references in injection ([1eea2b25](https://github.com/angular/angular/commit/1eea2b25), closes [#1891](https://github.com/angular/angular/issues/1891))
* **change_detection:**
* json pipe ([98603824](https://github.com/angular/angular/commit/98603824), closes [#1957](https://github.com/angular/angular/issues/1957))
* uppercase and lowercase pipes ([7a4a6353](https://github.com/angular/angular/commit/7a4a6353))
* implemented change detection that can be configured with pregenerated change det ([08f21dbf](https://github.com/angular/angular/commit/08f21dbf))
* **compiler:**
* special-case class attribute in hostAttributes ([3011cd86](https://github.com/angular/angular/commit/3011cd86), closes [#1774](https://github.com/angular/angular/issues/1774), [#1841](https://github.com/angular/angular/issues/1841))
* added support for [()] syntax ([685a6507](https://github.com/angular/angular/commit/685a6507))
* **di:**
* added hostInjector and viewInjector to the Directive annotation ([b066b8d1](https://github.com/angular/angular/commit/b066b8d1))
* removed publishAs ([3a53f679](https://github.com/angular/angular/commit/3a53f679))
* **element_injector:** allow @Optional for ProtoViewRef ([bb2eda2d](https://github.com/angular/angular/commit/bb2eda2d))
* **errors:** preserve stack traces of user exceptions in Dart ([b6f29b44](https://github.com/angular/angular/commit/b6f29b44))
* **facade:** toUpperCase and toLowerCase ([557d54b3](https://github.com/angular/angular/commit/557d54b3))
* **fakeAsync:** allow simulating the passage of time ([0f002a5b](https://github.com/angular/angular/commit/0f002a5b))
* **forms:** improved error messages ([11e43851](https://github.com/angular/angular/commit/11e43851), closes [#1839](https://github.com/angular/angular/issues/1839))
* **pipe:** reexported pipes to genereate docs ([155b1e2b](https://github.com/angular/angular/commit/155b1e2b))
#### Breaking Changes
* `AppViewManager.createInPlaceHostView` is replaced by
`AppViewManager.createRootHostView` (for bootstrap) and
`AppViewManager.createFreeHostView` (for imperative components).
The later creates new host elements that are not attached anywhere.
To attach them, use `DomRenderer.getHostElement(hostviewRef)`
to get the host element.
Closes #1920
([421d8916](https://github.com/angular/angular/commit/421d8916))
* - renames `DirectiveMetadataReader` into `DirectiveResolver`
and removes `src/core/compiler/directive_metadata`.
Fixes #1712
Fixes #1713
([ecb06801](https://github.com/angular/angular/commit/ecb06801))
<a name"2.0.0-alpha.23"></a>
### 2.0.0-alpha.23 (2015-05-12)
#### Bug Fixes
* **change_detection:** updated dynamic change detector not to mutate when throwing ([d717529e](https://github.com/angular/angular/commit/d717529e), closes [#1762](https://github.com/angular/angular/issues/1762))
* **dart:** Remove unused imports. ([4ce0d5e0](https://github.com/angular/angular/commit/4ce0d5e0))
* **forms:** export directives as const in Dart ([5036086f](https://github.com/angular/angular/commit/5036086f), closes [#1283](https://github.com/angular/angular/issues/1283))
* **gulpfile:** fixed test.unit.dart to format dart code before running test ([92d6aa1f](https://github.com/angular/angular/commit/92d6aa1f))
* **location:** dartium does not like pushState with null. ([c2a42d5d](https://github.com/angular/angular/commit/c2a42d5d))
* **router:**
* add baseUrl to relative paths, but not absolute. ([a5741541](https://github.com/angular/angular/commit/a5741541), closes [#1783](https://github.com/angular/angular/issues/1783))
* reuse common parent components ([ac80df09](https://github.com/angular/angular/commit/ac80df09))
* router-link works without params ([77d1fc14](https://github.com/angular/angular/commit/77d1fc14))
* strip base href from URLs when navigating ([853d1de6](https://github.com/angular/angular/commit/853d1de6))
* **test_lib:** spy funcs should match null arguments ([84dc6ae7](https://github.com/angular/angular/commit/84dc6ae7))
* **transformer:** remove classDefParser in favor of hardcoded strings to speed up build ([01d5c295](https://github.com/angular/angular/commit/01d5c295))
* **view:** fixed ProtoViewFactory to get all property bindings ([7f976381](https://github.com/angular/angular/commit/7f976381))
#### Features
* **PromisePipe:** add pipe for promises ([74987585](https://github.com/angular/angular/commit/74987585))
* **VmTurnZone:** Rework the implementation to minimize change detection runs ([e8a6c95e](https://github.com/angular/angular/commit/e8a6c95e))
* **change_detection.js:** export null pipes ([4b62a722](https://github.com/angular/angular/commit/4b62a722), closes [#1624](https://github.com/angular/angular/issues/1624))
* **compiler:**
* added support for host actions ([f9c1de46](https://github.com/angular/angular/commit/f9c1de46))
* allow setting attributes on a host element ([51839ca6](https://github.com/angular/angular/commit/51839ca6), closes [#1402](https://github.com/angular/angular/issues/1402))
* **di:**
* support type literals in DI ([358a6750](https://github.com/angular/angular/commit/358a6750))
* expose parent injector ([2185e7ce](https://github.com/angular/angular/commit/2185e7ce))
* components can self-publish via publishAs ([1a0da11e](https://github.com/angular/angular/commit/1a0da11e))
* **directives:** export collection of core directives ([a5638a94](https://github.com/angular/angular/commit/a5638a94), closes [#1524](https://github.com/angular/angular/issues/1524))
* **dom:** add getBaseHref method ([05219a54](https://github.com/angular/angular/commit/05219a54))
* **facade:** add equals method to StringMapWrapper ([aff85b50](https://github.com/angular/angular/commit/aff85b50))
* **gulpfuile:** added watch.js.dev ([3256ff1c](https://github.com/angular/angular/commit/3256ff1c))
* **lang:** support const expressions in TS/JS and Dart ([4665726f](https://github.com/angular/angular/commit/4665726f), closes [#1796](https://github.com/angular/angular/issues/1796))
* **material:**
* add early version of md-grid-list. ([8ef183b5](https://github.com/angular/angular/commit/8ef183b5), closes [#1683](https://github.com/angular/angular/issues/1683))
* early version of md-input ([ad239218](https://github.com/angular/angular/commit/ad239218), closes [#1753](https://github.com/angular/angular/issues/1753))
* **view:** allow to transplant a view into a ViewContainer at another place. ([4f3433b5](https://github.com/angular/angular/commit/4f3433b5), closes [#1492](https://github.com/angular/angular/issues/1492))
#### Breaking Changes
*
VmTurnZone has been renamed to NgZone.
- The public API has not chnanged,
- The "outer" zone is now named "mount" zone (private to NgZone).
([e11c2054](https://github.com/angular/angular/commit/e11c2054))
*
A collection of all the form directives is exported
under `formDirectives`
while those were previously available
under `FormDirectives`.
Closes #1804
([229e770a](https://github.com/angular/angular/commit/229e770a))
<a name"2.0.0-alpha.22"></a>
### 2.0.0-alpha.22 (2015-05-07)
#### Bug Fixes
* **brocolli:** escape special regexp characters when building regexps ([a58c9f83](https://github.com/angular/angular/commit/a58c9f83), closes [#1721](https://github.com/angular/angular/issues/1721), [#1752](https://github.com/angular/angular/issues/1752))
* **build:**
* build the broccoli tools with correct typescript version. ([6bba289a](https://github.com/angular/angular/commit/6bba289a))
* use correct tsd command to get typings at requested versions ([1205f54d](https://github.com/angular/angular/commit/1205f54d))
* revert typescript upgrade which broke the build. ([b5032fd3](https://github.com/angular/angular/commit/b5032fd3))
* refer to newest version of hammerjs typings ([a7a94636](https://github.com/angular/angular/commit/a7a94636))
* **bundle:** update the bundle config to point to rx.js ([cf322130](https://github.com/angular/angular/commit/cf322130))
* **change_detector:** ensure that locals are only used when implicit receiver ([d4925b61](https://github.com/angular/angular/commit/d4925b61), closes [#1542](https://github.com/angular/angular/issues/1542))
* **compiler:**
* clone templates before compiling them ([9e8d31d5](https://github.com/angular/angular/commit/9e8d31d5), closes [#1058](https://github.com/angular/angular/issues/1058))
* changed the compiler to set up event listeners and host properties on host view ([e3c11045](https://github.com/angular/angular/commit/e3c11045), closes [#1584](https://github.com/angular/angular/issues/1584))
* only sets viewDefinition absUrl if the view has either a template or templateUrl ([3d625463](https://github.com/angular/angular/commit/3d625463), closes [#1326](https://github.com/angular/angular/issues/1326), [#1327](https://github.com/angular/angular/issues/1327))
* **decorators:**
* incorrect annotation to decorator adapter ([b0c735f7](https://github.com/angular/angular/commit/b0c735f7))
* fixed decorators ([49777648](https://github.com/angular/angular/commit/49777648))
* fixes decorator reflection. ([be7504d4](https://github.com/angular/angular/commit/be7504d4))
* updates missing benchmark and fixes typo. ([87dcd5eb](https://github.com/angular/angular/commit/87dcd5eb))
* **decorators.es6:** export Directive decorator ([93c331d1](https://github.com/angular/angular/commit/93c331d1), closes [#1688](https://github.com/angular/angular/issues/1688))
* **di:** improve error messages for invalid bindings ([ee1b574b](https://github.com/angular/angular/commit/ee1b574b), closes [#1515](https://github.com/angular/angular/issues/1515), [#1573](https://github.com/angular/angular/issues/1573))
* **docs:** fix broken docs test after addition of .ts extension to dgeni regex. ([62bf777e](https://github.com/angular/angular/commit/62bf777e))
* **exception_handler:** log errors via `console.error` ([ead21c91](https://github.com/angular/angular/commit/ead21c91))
* **formatter:** point to the newest clang-format ([51c47792](https://github.com/angular/angular/commit/51c47792))
* **router:**
* fix for leading slash in dart ([c9cec600](https://github.com/angular/angular/commit/c9cec600))
* navigate on popstate event ([2713b787](https://github.com/angular/angular/commit/2713b787))
* throw if config does not contain required fields ([259f872c](https://github.com/angular/angular/commit/259f872c))
* infer top-level routing from app component ([46ad3552](https://github.com/angular/angular/commit/46ad3552), closes [#1600](https://github.com/angular/angular/issues/1600))
* use lists for RouteConfig annotations ([4965226f](https://github.com/angular/angular/commit/4965226f))
* **view:** changed view manager to hydrate change detector after creating directives ([c1579222](https://github.com/angular/angular/commit/c1579222))
#### Features
* **benchmark:** added an implementation of the tree benchmark in React ([e4342743](https://github.com/angular/angular/commit/e4342743))
* **benchmarks:** Add basic dart transformer benchmarks. ([1864f60a](https://github.com/angular/angular/commit/1864f60a))
* **decorators:**
* adds decorator versions of DI annotations. ([457c15cd](https://github.com/angular/angular/commit/457c15cd))
* adds support for parameter decorators. ([f863ea0d](https://github.com/angular/angular/commit/f863ea0d))
* adds decorators to be used by TS and Babel transpiled apps. ([fb67e373](https://github.com/angular/angular/commit/fb67e373))
* **dom:** add location and history as DOM-like APIs. ([f356d033](https://github.com/angular/angular/commit/f356d033))
* **material:** add prototype dialog component w/ demo. ([f88c4b77](https://github.com/angular/angular/commit/f88c4b77))
* **router:**
* adds the router to the self-executing bundle. ([8e1d53b5](https://github.com/angular/angular/commit/8e1d53b5))
* export decorator version of RouteConfig ([75da6e4c](https://github.com/angular/angular/commit/75da6e4c))
* route redirects ([91533313](https://github.com/angular/angular/commit/91533313))
* sibling outlets ([9d5c33f9](https://github.com/angular/angular/commit/9d5c33f9))
* export routerInjectables ([ef7014fe](https://github.com/angular/angular/commit/ef7014fe))
* add location service ([ea546f50](https://github.com/angular/angular/commit/ea546f50))
#### Breaking Changes
* Previously, `Directive` was the abstract base class of several directives.
Now, `Directive` is the former `Decorator`, and `Component` inherits from it.
([f75a50c1](https://github.com/angular/angular/commit/f75a50c1))
* A dynamic component is just a component that has no @View annotation…
([8faf6364](https://github.com/angular/angular/commit/8faf6364))
<a name="2.0.0-alpha.21"></a>
# 2.0.0-alpha.21 (2015-04-27)
## Features
- **dart/transform:** Dedup getters, setters, & methods
([15376a6d](https://github.com/angular/angular/commit/15376a6d243740c73cf90f55525d1710cdd156f5))
- **facade:** add isType method
([e617ca63](https://github.com/angular/angular/commit/e617ca6323902bd98c0f1eb990b82f6b8d3c98e3))
- **parser:** support === and !== operators
([afe0e454](https://github.com/angular/angular/commit/afe0e454537f9252f9cf313647e649cfa464f96f),
[#1496](https://github.com/angular/angular/issues/1496), [#1500](https://github.com/angular/angular/issues/1500))
- **router:** add initial implementation
([1b2754da](https://github.com/angular/angular/commit/1b2754dacdd15e8fea429d56cdacb28eae76d2b1))
- **view:** reimplemented property setters using change detection
([8ccafb05](https://github.com/angular/angular/commit/8ccafb0524e3ac4c51af34ef88e0fe27482336a6))
## Performance Improvements
- **benchmarks:**
- benchmark that measure cost of dynamic components
([427f0d02](https://github.com/angular/angular/commit/427f0d021c51ea6923edd07574a4cc74a1ef84e6))
- benchmark measuring cost of decorators (fixes #1479)
([9fc9d535](https://github.com/angular/angular/commit/9fc9d535667c620017367877dbc2a3bc56d358b7))
## Other (malformed commit messages)
- **other:**
- feat: alllow specifying directives as bindings
([4bab25b3](https://github.com/angular/angular/commit/4bab25b3666f4247434ad5cb871906fb063fef51),
[#1498](https://github.com/angular/angular/issues/1498))
- fix: export ShadowDom strategies
([6896305e](https://github.com/angular/angular/commit/6896305e34082c246769829e4258631c1d2363d1),
[#1510](https://github.com/angular/angular/issues/1510), [#1511](https://github.com/angular/angular/issues/1511))

View File

@ -18,7 +18,7 @@ Help us keep Angular open and inclusive. Please read and follow our [Code of Con
## <a name="question"></a> Got a Question or Problem?
If you have questions about how to *use* Angular, please direct them to the [Google Group][angular-group]
discussion list or [StackOverflow][stackoverflow]. We are also available on [Gitter][gitter].
discussion list or [StackOverflow][stackoverflow]. Please note that Angular 2 is still in early developer preview, and the core team's capacity to answer usage questions is limited. We are also available on [Gitter][gitter].
## <a name="issue"></a> Found an Issue?
If you find a bug in the source code or a mistake in the documentation, you can help us by
@ -27,27 +27,16 @@ If you find a bug in the source code or a mistake in the documentation, you can
## <a name="feature"></a> Want a Feature?
You can *request* a new feature by [submitting an issue](#submit-issue) to our [GitHub
Repository][github]. If you would like to *implement* a new feature then consider what kind of
change it is:
Repository][github]. If you would like to *implement* a new feature, please submit an issue with
a proposal for your work first, to be sure that we can use it. Angular 2 is in developer preview
and we are not ready to accept major contributions ahead of the full release.
Please consider what kind of change it is:
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
and help you to craft the change so that it is successfully accepted into the project.
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
## <a name="docs"></a> Want a Doc Fix?
If you want to help improve the docs, then consider what kind of improvement it is:
* For **Major Changes**, it's a good idea to let others know what you're working on to
minimize duplication of effort. Before starting, check out the issue queue for
issues labeled [#docs](https://github.com/angular/angular/labels/%23docs).
Comment on an issue to let others know what you're working on, or [create a new issue](#submit-issue)
if your work doesn't fit within the scope of any of the existing doc issues.
Please build and test the documentation before [submitting the Pull Request](#submit-pr), to be sure
you haven't accidentally introduced any layout or formatting issues. Also ensure that your commit
message is labeled "docs" and follows the [Commit Message Guidelines](#commit) given below.
* For **Small Changes**, there is no need to file an issue first. Simply [submit a Pull Request](#submit-pr).
## <a name="submit"></a> Submission Guidelines
### <a name="submit-issue"></a> Submitting an Issue
@ -60,7 +49,6 @@ chances of your issue being dealt with quickly:
* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
* **Motivation for or Use Case** - explain why this is a bug for you
* **Angular Version(s)** - is it a regression?
* **Browsers and Operating System** - is this a problem with all browsers?
* **Reproduce the Error** - provide a live example (using [Plunker][plunker],
[JSFiddle][jsfiddle] or [Runnable][runnable]) or a unambiguous set of steps.
@ -71,7 +59,7 @@ chances of your issue being dealt with quickly:
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
Before you submit your Pull Request (PR) consider the following guidelines:
* Search [GitHub](https://github.com/angular/angular.dart/pulls) for an open or closed PR
* Search [GitHub](https://github.com/angular/angular/pulls) for an open or closed PR
that relates to your submission. You don't want to duplicate effort.
* Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
We cannot accept code without this.
@ -180,7 +168,7 @@ Must be one of the following:
* **docs**: Documentation only changes
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
semi-colons, etc)
* **refactor**: A code change that neither fixes a bug or adds a feature
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **perf**: A code change that improves performance
* **test**: Adding missing tests
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation

View File

@ -3,56 +3,60 @@
This document describes how to set up your development environment to build and test Angular, both
JS and Dart versions. It also explains the basic mechanics of using `git`, `node`, and `npm`.
See the [contributing guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md)
for how to contribute your own code to
* [Prerequisite Software](#prerequisite-software)
* [Getting the Sources](#getting-the-sources)
* [Environment Variable Setup](#environment-variable-setup)
* [Installing NPM Modules and Dart Packages](#installing-npm-modules-and-dart-packages)
* [Running Tests Locally](#running-tests-locally)
* [Formatting](#formatting)
* [Project Information](#project-information)
* [CI using Travis](#ci-using-travis)
* [Transforming Dart code](#transforming-dart-code)
* [Debugging](#debugging)
1. [Prerequisite Software](#prerequisite-software)
2. [Getting the Sources](#getting-the-sources)
3. [Environment Variable Setup](#environment-variable-setup)
4. [Installing NPM Modules and Dart Packages](#installing-npm-modules-and-dart-packages)
5. [Running Tests Locally](#running-tests-locally)
6. [Project Information](#project-information)
7. [CI using Travis](#ci-using-travis)
8. [Debugging](#debugging)
See the [contribution guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md)
if you'd like to contribute to Angular.
## Prerequisite Software
Before you can build and test Angular, you must install and configure the
following products on your development machine:
* [Dart](https://www.dartlang.org) (version `>=1.9.0-dev.8.0`), specifically the Dart-SDK and
* [Dart](https://www.dartlang.org) (version ` >=1.10.0-dev.1.10 <2.0.0`), specifically the Dart-SDK and
Dartium (a version of [Chromium](http://www.chromium.org) with native support for Dart through
the Dart VM). One of the **simplest** ways to get both is to install the **Dart Editor bundle**,
which includes the editor, SDK and Dartium. See the [Dart tools](https://www.dartlang.org/tools)
download [page for instructions](https://www.dartlang.org/tools/download.html); note that you can
download [page for instructions](https://www.dartlang.org/tools/download.html). You can also
download both **stable** and **dev** channel versions from the [download
archive](https://www.dartlang.org/tools/download-archive).
* [Git](http://git-scm.com) and/or the **Github app** (for [Mac](http://mac.github.com) or
[Windows](http://windows.github.com)): the [Github Guide to Installing
* [Git](http://git-scm.com) and/or the **GitHub app** (for [Mac](http://mac.github.com) or
[Windows](http://windows.github.com)); [GitHub's Guide to Installing
Git](https://help.github.com/articles/set-up-git) is a good source of information.
* [Node.js](http://nodejs.org) which is used to run a development web server, run tests, and
generate distributable files. We also use Node's Package Manager (`npm`). Depending on your
system, you can install Node either from source or as a pre-packaged bundle.
* [Node.js](http://nodejs.org), which is used to run a development web server, run tests, and
generate distributable files. We also use Node's Package Manager, `npm`, which comes with Node.
Depending on your system, you can install Node either from source or as a pre-packaged bundle.
* [Chrome Canary](https://www.google.com/chrome/browser/canary.html), a version of Chrome with
bleeding edge functionality, built especially for developers (and early adopters).
* [Bower](http://bower.io/).
## Getting the Sources
Forking and cloning the Angular repository:
Fork and clone the Angular repository:
1. Login to your Github account or create one by following the instructions given
1. Login to your GitHub account or create one by following the instructions given
[here](https://github.com/signup/free).
2. [Fork](http://help.github.com/forking) the [main Angular
repository](https://github.com/angular/angular).
3. Clone your fork of the Angular repository and define an `upstream` remote pointing back to
the Angular repository that you forked in the first place:
the Angular repository that you forked in the first place.
```shell
# Clone your Github repository:
# Clone your GitHub repository:
git clone git@github.com:<github username>/angular.git
# Go to the Angular directory:
@ -90,32 +94,31 @@ PATH+=":$DART_SDK/bin"
## Installing NPM Modules and Dart Packages
Next, install the modules and packages needed to build Angular and run tests:
Next, install the JavaScript modules and Dart packages needed to build and test Angular:
```shell
# Install Angular project dependencies (package.json)
npm install
# Ensure protractor has the latest webdriver
$(npm bin)/webdriver-manager update
# Install Dart packages
pub get
```
**Optional**: In this document, we make use of project local `npm` package scripts and binaries
(stored under `./node_modules/.bin`) by prefixing these command invocations with `$(npm bin)`; in
particular `gulp` and `protractor` commands. If you prefer, you can drop this path prefix by
globally installing these two packages as follows:
particular `gulp` and `protractor` commands. If you prefer, you can drop this path prefix by either:
*Option 1*: globally installing these two packages as follows:
* `npm install -g gulp` (you might need to prefix this command with `sudo`)
* `npm install -g protractor` (you might need to prefix this command with `sudo`)
Since global installs can become stale, we avoid their use in these instructions.
Since global installs can become stale, and required versions can vary by project, we avoid their
use in these instructions.
*Option 2*: defining a bash alias like `alias nbin='PATH=$(npm bin):$PATH'` as detailed in this
[Stackoverflow answer](http://stackoverflow.com/questions/9679932/how-to-use-package-installed-locally-in-node-modules/15157360#15157360) and used like this: e.g., `nbin gulp build`.
## Build commands
To build Angular and prepare tests run
To build Angular and prepare tests, run:
```shell
$(npm bin)/gulp build
@ -124,42 +127,60 @@ $(npm bin)/gulp build
Notes:
* Results are put in the `dist` folder.
* This will also run `pub get` for the subfolders in `modules` and run `dartanalyzer` for
every file that matches `<module>/src/<module>.dart`, e.g. `di/src/di.dart`
every file that matches `<module>/src/<module>.dart`, e.g. `di/src/di.dart`.
You can selectively build either the JS or Dart versions as follows:
* `$(npm bin)/gulp build.js`
* `$(npm bin)/gulp build.dart`
To clean out the `dist` folder, run:
To clean out the `dist` folder use:
```shell
$(npm bin)/gulp clean
```
## Running Tests Locally
### Basic tests
### Full test suite
1. `$(npm bin)/gulp test.unit.js`: JS tests in a browser; runs in **watch mode** (i.e. karma
watches the test files for changes and re-runs tests when files are updated).
2. `$(npm bin)/gulp test.unit.cjs`: JS tests in NodeJS; runs in **watch mode**
3. `$(npm bin)/gulp test.unit.dart`: Dart tests in Dartium; runs in **watch mode**.
* `npm test`: full test suite for both JS and Dart versions of Angular. These are the same tests
that run on Travis.
If you prefer running tests in "single-run" mode rather than watch mode use
You can selectively run either the JS or Dart versions as follows:
* `$(npm bin)/gulp test.all.js`
* `$(npm bin)/gulp test.all.dart`
### Unit tests
You can run just the unit tests as follows:
* `$(npm bin)/gulp test.unit.js`: JS tests in a browser; runs in **watch mode** (i.e.
watches the test files for changes and re-runs tests when files are updated).
* `$(npm bin)/gulp test.unit.cjs`: JS tests in NodeJS; runs in **watch mode**.
* `$(npm bin)/gulp test.unit.dart`: Dart tests in Dartium; runs in **watch mode**.
If you prefer running tests in "single-run" mode rather than watch mode use:
* `$(npm bin)/gulp test.unit.js/ci`
* `$(npm bin)/gulp test.unit.cjs/ci`
* `$(npm bin)/gulp test.unit.dart/ci`
**Note**: If you want to only run a single test you can alter the test you wish
to run by changing `it` to `iit` or `describe` to `ddescribe`. This will only
run that individual test and make it much easier to debug. `xit` and `xdescribe`
can also be useful to exclude a test and a group of tests respectively.
The task updates the dist folder with transpiled code whenever a source or test file changes, and
Karma is run against the new output.
**Note** for transpiler tests: The karma preprocessor is setup in a way so that after every test
run the transpiler is reloaded. With that it is possible to make changes to the preprocessor and
run the tests without exiting karma (just touch a test file that you would like to run).
**Note**: If you want to only run a single test you can alter the test you wish to run by changing
`it` to `iit` or `describe` to `ddescribe`. This will only run that individual test and make it
much easier to debug. `xit` and `xdescribe` can also be useful to exclude a test and a group of
tests respectively.
### E2e tests
1. `$(npm bin)/gulp build.js.cjs` (builds benchpress and tests into `dist/js/cjs` folder).
2. `$(npm bin)/gulp serve.js.prod serve.js.dart2js` (runs local webserver).
2. `$(npm bin)/gulp serve.js.prod serve.js.dart2js` (runs a local webserver).
3. `$(npm bin)/protractor protractor-js.conf.js`: JS e2e tests.
4. `$(npm bin)/protractor protractor-dart2js.conf.js`: Dart2JS e2e tests.
4. `$(npm bin)/protractor protractor-dart2js.conf.js`: dart2js e2e tests.
Angular specific command line options when running protractor:
- `$(npm bin)/protractor protractor-{js|dart2js}-conf.js --ng-help`
@ -167,13 +188,56 @@ Angular specific command line options when running protractor:
### Performance tests
1. `$(npm bin)/gulp build.js.cjs` (builds benchpress and tests into `dist/js/cjs` folder)
2. `$(npm bin)/gulp serve.js.prod serve.js.dart2js` (runs local webserver)
2. `$(npm bin)/gulp serve.js.prod serve.js.dart2js` (runs a local webserver)
3. `$(npm bin)/protractor protractor-js.conf.js --benchmark`: JS performance tests
4. `$(npm bin)/protractor protractor-dart2js.conf.js --benchmark`: Dart2JS performance tests
4. `$(npm bin)/protractor protractor-dart2js.conf.js --benchmark`: dart2js performance tests
Angular specific command line options when running protractor (e.g. force gc, ...):
`$(npm bin)/protractor protractor-{js|dart2js}-conf.js --ng-help`
## Formatting
We use [clang-format](http://clang.llvm.org/docs/ClangFormat.html) to automatically enforce code style for our TypeScript code.
This allows us to focus our code reviews more on the content, and less on style nit-picking.
It also lets us encode our style guide in the `.clang-format` file in the repository,
allowing many tools and editors to share our settings.
To check the formatting of your code, run
gulp check-format
Note that the continuous build on Travis runs `gulp enforce-format`.
Unlike the `check-format` task, this will actually fail the build if files aren't formatted according to the style guide.
Your life will be easier if you include the formatter in your standard workflow.
Otherwise, you'll likely forget to check the formatting,
and waste time waiting for a build on Travis that fails due to some whitespace difference.
* **git pre-commit hook** is available at
[llvm.org](https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format).
This will automatically format your delta regions when you commit a change.
To install, first patch this file to add `.ts` to the `default_extensions` section.
Then copy the file somewhere in your path, for example, `/usr/local/git/current/bin/git-clang-format`.
Make sure it is executable. Then, in the angular repo, run
```
$ echo -e '#!/bin/sh\nexec git clang-format' > .git/hooks/pre-commit
$ chmod u+x !$
```
* **WebStorm** can run clang-format on the current file.
1. Under Preferences, open Tools > External Tools.
1. Plus icon to Create Tool
1. Fill in the form:
- Name: clang-format
- Description: Format
- Synchronize files after execution: checked
- Open console: not checked
- Show in: Editor menu
- Program: [path to clang-format, try `$ echo $(npm config get prefix)/bin/clang-format`]
- Parameters: `-i -style=file $FilePath$`
- Working directory: `$ProjectFileDir$`
## Project Information
### Folder structure
@ -184,16 +248,20 @@ Angular specific command line options when running protractor (e.g. force gc, ..
### File suffixes
* `*.js`: javascript files that get transpiled to Dart and EcmaScript 5
* `*.es6`: javascript files that get transpiled only to EcmaScript 5
* `*.es5`: javascript files that don't get transpiled
* `*.dart`: dart files that don't get transpiled
* `*.js`: JavaScript files that get transpiled to Dart and EcmaScript 5
* `*.es6`: JavaScript files that get transpiled only to EcmaScript 5
* `*.es5`: JavaScript files that don't get transpiled
* `*.dart`: Dart files that don't get transpiled
## CI using Travis
For instructions on setting up Continuous Integration using Travis, see the instructions given
[here](https://github.com/angular/angular.dart/blob/master/travis.md).
## Transforming Dart code
See the [wiki](//github.com/angular/angular/wiki/Angular-2-Dart-Transformer).
## Debugging
### Debug the transpiler
@ -219,17 +287,18 @@ Notes:
If you need to debug the tests:
- add a `debugger;` statement to the test you want to debug (oe the source code),
- add a `debugger;` statement to the test you want to debug (or the source code),
- execute karma `$(npm bin)/gulp test.js`,
- press the top right "DEBUG" button,
- open the dev tools and press F5,
- the execution halt at the `debugger;` statement
- open the DevTools and press F5,
- the execution halts at the `debugger;` statement
**Note (WebStorm users)**:
You can create a Karma run config from WebStorm.
Then in the "Run" menu, press "Debug 'karma-js.conf.js'", WebStorm will stop in the generated code
on the `debugger;` statement.
You can then step into the code and add watches.
1. Create a Karma run config from WebStorm.
2. Then in the "Run" menu, press "Debug 'karma-js.conf.js'", and WebStorm will stop in the generated
code on the `debugger;` statement.
3. You can then step into the code and add watches.
The `debugger;` statement is needed because WebStorm will stop in a transpiled file. Breakpoints in
the original source files are not supported at the moment.

View File

@ -1,15 +1,25 @@
Angular [![Build Status](https://travis-ci.org/angular/angular.svg?branch=master)](https://travis-ci.org/angular/angular) [![Join the chat at https://gitter.im/angular/angular](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular/angular?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/angular/angular.svg?branch=master)](https://travis-ci.org/angular/angular)
[![Join the chat at https://gitter.im/angular/angular](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular/angular?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Issue Stats](http://issuestats.com/github/angular/angular/badge/pr)](http://issuestats.com/github/angular/angular)
[![Issue Stats](http://issuestats.com/github/angular/angular/badge/issue)](http://issuestats.com/github/angular/angular)
[![npm version](https://badge.fury.io/js/angular2.svg)](http://badge.fury.io/js/angular2)
[![Downloads](http://img.shields.io/npm/dm/angular2.svg)](https://npmjs.org/package/angular2)
Angular
=========
Angular is a development platform for building mobile and desktop web applications. This is the
repository for [Angular 2][ng2], both the JavaScript (JS) and [Dart][dart] versions.
Angular 2 is currently in **Alpha Preview**. We recommend using Angular 1.X for production
Angular 2 is currently in **Developer Preview**. We recommend using Angular 1.X for production
applications:
* [AngularJS][ngJS]: [angular/angular.js](http://github.com/angular/angular.js).
* [AngularDart][ngDart]: [angular/angular.dart](http://github.com/angular/angular.dart).
## Quickstart
[Get started in 5 minutes][quickstart]
## Setup & Install Angular 2
@ -18,35 +28,15 @@ Follow the instructions given on the [Angular download page][download].
## Want to help?
Want to file a bug, or contribute some code or improve documentation? Excellent! Read up on our
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our
guidelines for [contributing][contributing].
## Examples
To see the examples, first build the project as described
[here](http://github.com/angular/angular/blob/master/DEVELOPER.md).
### Hello World Example
This example consists of three basic pieces - a component, a decorator and a
service. They are all constructed via injection. For more information see the
comments in the source `modules/examples/src/hello_world/index.js`.
You can build this example as either JS or Dart app:
* JS:
* `$(npm bin)/gulp serve.js.dev`, and
* open `localhost:8000/examples/src/hello_world/` in Chrome.
* Dart:
* `$(npm bin)/gulp serve/examples.dart`, and
* open `localhost:8080/src/hello_world` in Chrome (for dart2js) or
[Dartium][dartium] (for Dart VM).
[contributing]: http://github.com/angular/angular/blob/master/CONTRIBUTING.md
[dart]: http://www.dartlang.org
[dartium]: http://www.dartlang.org/tools/dartium
[download]: http://angular.io/download
[quickstart]: https://angular.io/docs/js/latest/quickstart.html
[ng2]: http://angular.io
[ngDart]: http://angulardart.org
[ngJS]: http://angularjs.org

168
TRIAGE_AND_LABELS.md Normal file
View File

@ -0,0 +1,168 @@
# Triage Process and Github Labels for Angular 2
This document describes how the Angular team uses labels and milestones to triage issues on github.
# Issues and PRs
## Triaged vs Untriaged Issues
Every triaged issue must have four attributes assigned to it:
* `priority` -- P0 through P4. P0 issues are "drop everything and do this now". P4 are nice to have.
* `component` -- Which area of Angular knowledge this relates to.
* `effort` -- Rough assessment of how much work this issue is. E.g. `effort: hour` means
"probably a few hours of work".
* `type` -- Whether this issue is a bug, feature, or other kind of task.
Untriaged issues are any issues in the queue that don't yet have these four attributes.
You can view a report of untriaged issues here, in our
[Angular Triage Dashboard](http://mhevery.github.io/github_issues/).
Issues should also have a clear action to complete that can be addressed or resolved within the
scope of Angular 2. We'll close issues that don't meet these criteria.
### Assigning Issues to Milestones
Any issue that is being worked on must have:
* An `assignee`: The person doing the work.
* A `Milestone`: When we expect to complete this work.
We aim to only have at most three milestones open at a time:
* Closing Milestone: A milestone with a very small number of issues, about to release.
* Current Milestone: Work that we plan to complete within one week.
* Next Milestone: Work that is > 1 week but current for the team.
The [backlog](https://github.com/angular/angular/issues?q=is%3Aopen+is%3Aissue+no%3Amilestone)
consists of all issues that have been triaged but do not have an assignee or milestone.
## Triaged vs Untriaged PRs
Because of the cumulative pain associated with rebasing PRs, we triage PRs daily, and
closing or reviewing PRs is a top priority ahead of other ongoing work.
Every triaged PR must have a `pr_action` label assigned to it and an assignee:
* `pr_action: cleanup` -- more work is needed from the current assignee.
* `pr_action: discuss` -- discussion is needed, to be led by the current assignee.
* `pr_action: merge` -- OK to merge this as soon as tests are green, `pr_state: LGTM`, and `CLA:
yes` are true. assignee (or anyone else) can merge.
* `pr_action: review` -- work is complete and comment is needed from the assignee.
In addition, PRs can have the following states:
* `pr_state: LGTM` -- PR may have outstanding changes but does not require further review.
* `pr_state: WIP` -- PR is experimental or rapidly changing. Not ready for review or triage.
* `pr_state: blocked` -- PR is blocked on an issue or other PR. Not ready for review or triage.
Note that an LGTM state does not mean a PR is ready to merge: for example, a reviewer might set the
LGTM state but request a minor tweak that doesn't need further review, e.g., a rebase or small
uncontroversial change.
PRs do not need to be assigned to milestones, unless a milestone release should be held for that
PR to land.
Victor (`vsavkin`) and Tobias (`tbosch`) are owners of the PR queue. Here is a list of [current
untriaged PRs](https://github.com/angular/angular/pulls?utf8=%E2%9C%93&q=is%3Aopen+no%3Amilestone+is%3Apr+-label%3A%22pr_action%3A+cleanup%22+-label%3A%22pr_action%3A+merge%22+-label%3A%22pr_action%3A+review%22+-label%3A%22pr_action%3A+discuss%22+-label%3A%22pr_state%3A+blocked%22+-label%3A%22pr_state%3A+WIP%22+).
# Prioritization of Work
What should you be working on?
1. Any PRs that are assigned to you that don't have `pr_state: WIP` or `pr_state: blocked`
1. Any issues that are assigned to you in the lowest-numbered Milestone
1. Any issues that are assigned to you in any Milestone
If there are no issues assigned to you in any Milestone, pick an issue, self-assign it, and add
it to the most appropriate Milestone based on effort.
Here are some suggestions for what to work on next:
* Filter for issues in a component that you are knowledgeable about, and pick something that has a
high priority.
* Filter for any small effort task that has the special `cust: GT` or `cust:Ionic` tags,
and priority > P3.
* Add a new task that's really important, add `component`, `priority`, `effort`, `type` and
assign it to yourself and the most appropriate milestone.
# Labels Used in Triage
## Priority
How urgent is this issue? We use priority to determine what should be worked on in each new
milestone.
* `P0: critical` -- drop everything to work on this
* `P1: urgent` -- resolve quickly in the current milestone. people are blocked
* `P2: required` -- needed for development but not urgent yet. workaround exists, or e.g. new API
* `P3: important` -- must complete before Angular 2 is ready for release
* `P4: nice to have` -- a good idea, but maybe not until after release
## Effort
Rough, non-binding estimate of how much work this issue represents. Please change this assessment
for anything you're working on to better reflect reality.
* `effort: hour` -- straightforward issue that can be resolved in a few hours, e.g. < 1 day of work.
* `effort: day` -- issue that will be a few days of work. Can be completed within a single
milestone.
* `effort: week` -- issue that will likely take more than 1 milestone to complete.
<!-- We don't like these label names as
they're not absolute (what is one developer-hour, really?) but decided it wasn't worth arguing
over terms. -->
## Component
Which area of Angular knowledge is this issue most closely related to? Helpful when deciding what
to work on next.
* `comp: benchpress` -- benchmarks and performance testing &rarr; *tbosch*, *crossj*
* `comp: build/dev-productivity` -- build process, e.g. CLI and related tasks &rarr; *iminar*, *caitp*
* `comp: build/pipeline` -- build pipeline, e.g. ts2dart &rarr; *mprobst*, *alexeagle*
* `comp: core` -- general core Angular issues, not related to a sub-category (see below) &rarr;
*mhevery*
* `comp: core/animations` -- animations framework &rarr; *matsko*
* `comp: core/change_detection` -- change detection &rarr; *vsavkin*
* `comp: core/di` -- dependency injection &rarr; *vicb*, *rkirov*
* `comp: core/directives` -- directives
* `comp: core/forms` -- forms &rarr; *vsavkin*
* `comp: core/pipes` -- pipes
* `comp: core/templating` -- templating
* `comp: core/testbed` -- e2e tests and support for them
* `comp: dart-transformer` -- Dart transforms &rarr; *kegluneq*, *jakemac*
* `comp: data-access` -- &rarr; *jeffbcross*
* `comp: docs` -- API docs and doc generation &rarr; *naomiblack*, *petebacondarwin*
* `comp: material-components` -- Angular Material components built in Angular 2 &rarr; *jelbourn*
* `comp: router` -- Component Router &rarr; *btford*, *igorminar*, *matsko*
* `comp: wrenchjs`
## Type
What kind of problem is this?
* `type RFC / discussion / question`
* `type bug`
* `type chore`
* `type feature`
* `type performance`
* `type refactor`
## Special Labels
### action:design
More active discussion is needed before the issue can be worked on. Typically used for `type:
feature` or `type: RFC/discussion/question`
<!-- TODO: Seems like this it's redundant to also have type:discussion, no? -->
[See all issues that need discussion](https://github.com/angular/angular/labels/action:%20Design)
### cla
Managed by googlebot. Indicates whether a PR has a CLA on file for its author(s). Only issues with
`cla:yes` should be merged into master.
### cust
This is an issue causing user pain for early adopter customers `cust: GT` or `cust: Ionic`.
### WORKS_AS_INTENDED
Only used on closed issues, to indicate to the reporter why we closed it.

View File

@ -0,0 +1,48 @@
var path = require('canonical-path');
var Package = require('dgeni').Package;
var basePackage = require('../public-docs-package');
var PARTIAL_PATH = 'partials';
var MODULES_DOCS_PATH = PARTIAL_PATH + '/api';
module.exports = new Package('angular.io', [basePackage])
.factory(require('./services/renderMarkdown'))
.processor(require('./processors/addJadeDataDocsProcessor'))
// Configure rendering
.config(function(templateFinder, templateEngine) {
templateFinder.templateFolders
.unshift(path.resolve(__dirname, 'templates'));
})
.config(function(writeFilesProcessor) {
writeFilesProcessor.outputFolder = 'dist/angular.io';
})
.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
computePathsProcessor.pathTemplates.push({
docTypes: ['module'],
pathTemplate: '${id}/',
outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.jade'
});
computePathsProcessor.pathTemplates.push({
docTypes: EXPORT_DOC_TYPES,
pathTemplate: '${moduleDoc.id}/${name}-${docType}.html',
outputPathTemplate: MODULES_DOCS_PATH + '/${moduleDoc.id}/${name}-${docType}.jade',
});
computePathsProcessor.pathTemplates.push({
docTypes: ['jade-data'],
pathTemplate: '${originalDoc.id}/_data',
outputPathTemplate: MODULES_DOCS_PATH + '/${path}.json'
});
})
.config(function(getLinkInfo) {
getLinkInfo.relativeLinks = true;
});

View File

@ -0,0 +1,76 @@
var _ = require('lodash');
var path = require('canonical-path');
var titleCase = function(text) {
return text.replace(/(.)(.*)/, function(_, first, rest) {
return first.toUpperCase() + rest;
});
};
/*
* Create _data.json file for Harp pages
*
* http://harpjs.com/docs/development/metadata
*
* This method creates the meta data required for each page
* such as the title, description, etc. This meta data is used
* in the harp static site generator to create the title for headers
* and the navigation used in the API docs
*
*/
module.exports = function addJadeDataDocsProcessor() {
return {
$runAfter: ['adding-extra-docs'],
$runBefore: ['extra-docs-added'],
$process: function(docs) {
var extraDocs = [];
var modules = [];
/*
* Create Data for Modules
*
* Modules must be public and have content
*/
_.forEach(docs, function(doc) {
if (doc.docType === 'module' && doc.public && doc.exports.length) {
modules.push(doc);
// GET DATA FOR INDEX PAGE OF MODULE SECTION
var indexPageInfo = [{
name: 'index',
title: _.map(path.basename(doc.fileInfo.baseName).split('_'), function(part) {
return titleCase(part);
}).join(' '),
intro: doc.description.replace('"', '\"').replace(/\r?\n|\r/g,"")
}];
// GET DATA FOR EACH PAGE (CLASS, VARS, FUNCTIONS)
var modulePageInfo = _.map(doc.exports, function(exportDoc) {
return {
name: exportDoc.name + '-' + exportDoc.docType,
title: exportDoc.name + ' ' + titleCase(exportDoc.docType)
};
});
//COMBINE PAGE DATA
var allPageData = indexPageInfo.concat(modulePageInfo);
// PUSH DATA TO EXTRA DOCS ARRAY
extraDocs.push({
id: doc.id + "-data",
aliases: [doc.id + "-data"],
docType: 'jade-data',
originalDoc: doc,
data: allPageData
});
}
});
return docs.concat(extraDocs);
}
};
};

View File

@ -0,0 +1,50 @@
var marked = require('marked');
var Encoder = require('node-html-encoder').Encoder;
var html2jade = require('html2jade');
var indentString = require('indent-string');
var S = require('string');
// entity type encoder
var encoder = new Encoder('entity');
/**
* @dgService renderMarkdown
* @description
* Render the markdown in the given string as HTML.
*/
module.exports = function renderMarkdown(trimIndentation) {
var renderer = new marked.Renderer();
renderer.code = function(code, lang, escaped) {
var cssClasses = ['prettyprint', 'linenums'];
var trimmedCode = trimIndentation(code);
if(lang) {
if(lang=='html') {
trimmedCode = encoder.htmlEncode(trimmedCode);
}
cssClasses.push(this.options.langPrefix + escape(lang, true));
}
return 'pre(class="' + cssClasses.join(' ') + '")\n' + indentString('code.\n', ' ', 2) + trimmedCode;
};
renderer.heading = function (text, level, raw) {
var headingText = marked.Renderer.prototype.heading.call(renderer, text, level, raw);
var title = 'h2 ' + S(headingText).stripTags().s;
if (level==2) {
title = '.l-main-section\n' + indentString(title, ' ', 2) ;
}
return title;
};
return function(content) {
return marked(content, { renderer: renderer });
};
};

View File

@ -0,0 +1,50 @@
{% include "lib/githubLinks.html" -%}
{% include "lib/paramList.html" -%}
{% extends 'layout/base.template.html' -%}
{% block body %}
p.location-badge.
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
defined in {$ githubViewLink(doc) $}
:markdown
{$ doc.description | indent(2, true) $}
{%- if doc.constructorDoc or doc.members.length -%}
.l-main-section
h2 Members
{%- if doc.constructorDoc %}
.l-sub-section
h3 {$ doc.constructorDoc.name $}
{% if doc.constructorDoc.parameters %}
pre.prettyprint
code.
{$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.parameters) | indent(4, true) | trim $}
{% endif %}
:markdown
{$ doc.constructorDoc.description | indent(6, true) | replace('## Example', '') | replace('# Example', '') $}
{% endif -%}
{%- for member in doc.members %}{% if not member.private %}
.l-sub-section
h3 {$ member.name $}
{% if member.parameters %}
pre.prettyprint
code.
{$ member.name $}{$ paramList(member.parameters) | indent(4, true) | trim $}{$ returnType(doc.returnType) $}
{% endif %}
:markdown
{$ member.description | indent(6, true) | replace('## Example', '') | replace('# Example', '') $}
{% endif %}{% endfor %}
{%- endif -%}
{% endblock %}

View File

@ -0,0 +1,22 @@
{% include "lib/githubLinks.html" -%}
{% include "lib/paramList.html" -%}
{% extends 'layout/base.template.html' -%}
{% block body %}
.l-main-section
h2(class="function export") {$ doc.name $}
{% if doc.parameters %}
pre.prettyprint
code.
{$ doc.name $}{$ paramList(doc.parameters) | indent(4, true) | trim $}{$ returnType(doc.returnType) $}
{% endif %}
p.location-badge.
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
defined in {$ githubViewLink(doc) $}
:markdown
{$ doc.description | indent(4, true) $}
{% endblock %}

View File

@ -0,0 +1,8 @@
{
{%- for item in doc.data %}
"{$ item.name $}" : {
"title" : "{$ item.title $}"{% if item.intro %},
"intro" : "{$ item.intro $}"{% endif %}
}{% if not loop.last %},{% endif %}
{% endfor -%}
}

View File

@ -0,0 +1 @@
{% block body %}{% endblock %}

View File

@ -0,0 +1,12 @@
{% macro paramList(params) -%}
{%- if params -%}
({%- for param in params -%}
{$ param | escape $}{% if not loop.last %}, {% endif %}
{%- endfor %})
{%- endif %}
{%- endmacro -%}
{% macro returnType(returnType) -%}
{%- if returnType %} : {$ returnType | escape $}{% endif -%}
{%- endmacro -%}

View File

@ -0,0 +1,15 @@
{% include "lib/githubLinks.html" -%}
{% extends 'layout/base.template.html' -%}
{% block body -%}
p.location-badge.
defined in {$ githubViewLink(doc) $}
ul
for page, slug in public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]]._data
if slug != 'index'
url = "/docs/" + current.path[1] + "/" + current.path[2] + "/" + current.path[3] + "/" + current.path[4] + "/" + slug + ".html"
li.c8
!= partial("../../../../../_includes/_hover-card", {name: page.title, url: url })
{% endblock %}

View File

@ -0,0 +1,13 @@
{% include "lib/githubLinks.html" -%}
{% extends 'layout/base.template.html' %}
{% block body %}
.l-main-section
h2 {$ doc.name $} <span class="type">variable</span>
p.location-badge.
exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }
defined in {$ githubViewLink(doc) $}
:markdown
{$ doc.description | indent(4, true) $}
{% endblock %}

View File

@ -364,3 +364,16 @@ md-content.demo-source-container > hljs > pre > code.highlight {
padding-left:32px !important;
padding-right:32px !important;
}
.member .name {
white-space: pre-wrap;
word-wrap: break-word;
font-family: monospace;
font-size: 1.17em;
margin: 1em 0;
}
.left-nav {
min-width: 300px;
}

View File

@ -28,7 +28,7 @@
<section layout="row">
<md-content>
<md-content class="left-nav">
<h2>Navigation</h2>
<section ng-repeat="area in nav.areas">
<h3>{{ area.name }}</h3>
@ -47,7 +47,7 @@
<md-content class="md-padding">
<ng-include src="nav.currentPage.partial"></ng-include>
<ng-include autoscroll src="nav.currentPage.partial"></ng-include>
</md-content>
</section>

View File

@ -14,7 +14,6 @@ angular.module('app', ['ngMaterial', 'navigation-modules', 'navigation-guides',
];
this.updateCurrentPage = function(path) {
path = path.replace(/^\//, '');
console.log('path', path);
this.currentPage = null;

View File

@ -1,8 +1,10 @@
require('../../tools/transpiler/index.js').init();
var versionInfo = require('./versionInfo');
var Package = require('dgeni').Package;
var jsdocPackage = require('dgeni-packages/jsdoc');
var nunjucksPackage = require('dgeni-packages/nunjucks');
var linksPackage = require('../links-package');
var path = require('canonical-path');
var PARTIAL_PATH = 'partials';
@ -10,25 +12,21 @@ var MODULES_DOCS_PATH = PARTIAL_PATH + '/modules';
var GUIDES_PATH = PARTIAL_PATH + '/guides';
// Define the dgeni package for generating the docs
module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
module.exports = new Package('angular', [jsdocPackage, nunjucksPackage, linksPackage])
// Register the services and file readers
.factory(require('./services/modules'))
.factory(require('./services/atParser'))
.factory(require('./services/getJSDocComment'))
.factory(require('./services/SourceFile'))
.factory(require('./services/TraceurParser'))
.factory(require('./services/traceurOptions'))
.factory(require('./services/ParseTreeVisitor'))
.factory(require('./services/AttachCommentTreeVisitor'))
.factory(require('./services/ExportTreeVisitor'))
.factory(require('./readers/atScript'))
.factory(require('./services/tsParser'))
.factory(require('./services/tsParser/createCompilerHost'))
.factory(require('./services/tsParser/getFileInfo'))
.factory(require('./services/tsParser/getExportDocType'))
.factory(require('./services/tsParser/getContent'))
.factory(require('./readers/ngdoc'))
.factory('EXPORT_DOC_TYPES', function() {
return [
'class',
'interface',
'function',
'var',
'const'
@ -37,28 +35,58 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
// Register the processors
.processor(require('./processors/generateDocsFromComments'))
.processor(require('./processors/processModuleDocs'))
.processor(require('./processors/processClassDocs'))
.processor(require('./processors/readTypeScriptModules'))
.processor(require('./processors/generateNavigationDoc'))
.processor(require('./processors/extractTitleFromGuides'))
.processor(require('./processors/createOverviewDump'))
.processor(require('./processors/createTypeDefinitionFile'))
// Configure the log service
.config(function(log) {
log.level = 'info';
log.level = 'warn';
})
.config(function(renderDocsProcessor) {
renderDocsProcessor.extraData.versionInfo = versionInfo;
})
// Configure file reading
.config(function(readFilesProcessor, atScriptFileReader, ngdocFileReader) {
readFilesProcessor.fileReaders = [atScriptFileReader, ngdocFileReader];
.config(function(readFilesProcessor, ngdocFileReader, readTypeScriptModules) {
readFilesProcessor.fileReaders = [ngdocFileReader];
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
readFilesProcessor.sourceFiles = [
{ include: 'modules/*/*.js', basePath: 'modules' },
{ include: 'modules/*/src/**/*.js', basePath: 'modules' },
{ include: 'modules/*/docs/**/*.md', basePath: 'modules' },
{ include: 'docs/content/**/*.md', basePath: 'docs/content' }
];
readTypeScriptModules.sourceFiles = [
'*/*.@(js|es6|ts)',
'*/src/**/*.@(js|es6|ts)'
];
readTypeScriptModules.basePath = 'modules';
})
.config(function(parseTagsProcessor, getInjectables) {
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/public'));
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/private'));
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/exportedAs'));
// We actually don't want to parse param docs in this package as we are getting the data out using TS
parseTagsProcessor.tagDefinitions.forEach(function(tagDef) {
if (tagDef.name === 'param') {
tagDef.ignore = true;
}
});
})
// Configure links
.config(function(getLinkInfo) {
getLinkInfo.useFirstAmbiguousLink = true;
})
@ -93,12 +121,6 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
// Configure ids and paths
.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
computeIdsProcessor.idTemplates.push({
docTypes: EXPORT_DOC_TYPES,
idTemplate: '${moduleDoc.id}.${name}',
getAliases: function(doc) { return [doc.id]; }
});
computeIdsProcessor.idTemplates.push({
docTypes: ['member'],
idTemplate: '${classDoc.id}.${name}',
@ -122,7 +144,7 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
computePathsProcessor.pathTemplates.push({
docTypes: ['module'],
pathTemplate: '${id}',
pathTemplate: '/${id}',
outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.html'
});
@ -141,7 +163,7 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
computePathsProcessor.pathTemplates.push({
docTypes: ['guide'],
pathTemplate: '${id}',
pathTemplate: '/${id}',
outputPathTemplate: GUIDES_PATH + '/${id}.html'
});
});
});

View File

@ -0,0 +1 @@
export var x = 100;

View File

@ -0,0 +1,4 @@
export var __esModule = true;
export class OKToExport {}
export function _thisIsPrivate() {}
export var thisIsOK = '!';

View File

@ -0,0 +1,12 @@
export class Test {
firstItem;
constructor() {
this.doStuff();
}
otherMethod() {
}
doStuff() {
}
}

View File

@ -0,0 +1,38 @@
/**
* @module
* @description
* This is the module description
*/
export * from 'importedSrc';
/**
* This is some random other comment
*/
/**
* This is MyClass
*/
export class MyClass {
message: String;
/**
* Create a new MyClass
* @param {String} name The name to say hello to
*/
constructor(name) {
this.message = 'hello ' + name;
}
/**
* Return a greeting message
*/
greet() {
return this.message;
}
}
/**
* An exported function
*/
export var myFn = (val:number) => return val*2;

View File

@ -0,0 +1,24 @@
var _ = require('lodash');
module.exports = function createOverviewDump() {
return {
$runAfter: ['processing-docs'],
$runBefore: ['docs-processed'],
$process: function(docs) {
var overviewDoc = {
id: 'overview-dump',
aliases: ['overview-dump'],
path: 'overview-dump',
outputPath: 'overview-dump.html',
modules: []
};
_.forEach(docs, function(doc) {
if ( doc.docType === 'module' ) {
overviewDoc.modules.push(doc);
}
});
docs.push(overviewDoc);
}
};
};

View File

@ -0,0 +1,26 @@
var _ = require('lodash');
module.exports = function createTypeDefinitionFile() {
return {
$runAfter: ['processing-docs'],
$runBefore: ['docs-processed'],
$process: function(docs) {
var typeDefDoc = {
id: 'type-definition',
aliases: ['type-definition'],
path: 'type-definition',
outputPath: 'angular2.d.ts',
modules: []
};
_.forEach(docs, function(doc) {
// The shape of the public API is determined by what is reexported into
// angular2/angular2.
if (doc.id === 'angular2/angular2') {
typeDefDoc.modules.push(doc);
}
});
docs.push(typeDefDoc);
}
};
};

View File

@ -1,34 +0,0 @@
var _ = require('lodash');
module.exports = function generateDocsFromComments(log) {
return {
$runAfter: ['files-read'],
$runBefore: ['parsing-tags'],
$process: function(docs) {
var commentDocs = [];
docs = _.filter(docs, function(doc) {
if (doc.docType !== 'atScriptFile') {
return true;
} else {
_.forEach(doc.fileInfo.comments, function(comment) {
// we need to check for `/**` at the start of the comment to find all the jsdoc style comments
comment.range.toString().replace(/^\/\*\*([\w\W]*)\*\/$/g, function(match, commentBody) {
// Create a doc from this comment
commentDocs.push({
fileInfo: doc.fileInfo,
startingLine: comment.range.start.line,
endingLine: comment.range.end.line,
content: commentBody,
codeTree: comment.treeAfter,
docType: 'atScriptDoc'
});
});
});
}
});
return docs.concat(commentDocs);
}
};
};

View File

@ -27,13 +27,15 @@ module.exports = function generateNavigationDoc() {
modulesDoc.value.sections.push(moduleNavItem);
_.forEach(doc.exports, function(exportDoc) {
var exportNavItem = {
path: exportDoc.path,
partial: exportDoc.outputPath,
name: exportDoc.name,
type: exportDoc.docType
};
moduleNavItem.pages.push(exportNavItem);
if (!exportDoc.private) {
var exportNavItem = {
path: exportDoc.path,
partial: exportDoc.outputPath,
name: exportDoc.name,
type: exportDoc.docType
};
moduleNavItem.pages.push(exportNavItem);
}
});
}
});

View File

@ -1,47 +0,0 @@
var _ = require('lodash');
module.exports = function processClassDocs(log, getJSDocComment) {
return {
$runAfter: ['processModuleDocs'],
$runBefore: ['parsing-tags', 'generateDocsFromComments'],
ignorePrivateMembers: false,
$process: function(docs) {
var memberDocs = [];
var ignorePrivateMembers = this.ignorePrivateMembers;
_.forEach(docs, function(classDoc) {
if ( classDoc.docType === 'class' ) {
classDoc.members = [];
// Create a new doc for each member of the class
_.forEach(classDoc.elements, function(memberDoc) {
if (ignorePrivateMembers && memberDoc.name.literalToken.value.charAt(0) === '_') return;
classDoc.members.push(memberDoc);
memberDocs.push(memberDoc);
memberDoc.docType = 'member';
memberDoc.classDoc = classDoc;
memberDoc.name = memberDoc.name.literalToken.value;
if (memberDoc.commentBefore ) {
// If this export has a comment, remove it from the list of
// comments collected in the module
var index = classDoc.moduleDoc.comments.indexOf(memberDoc.commentBefore);
if ( index !== -1 ) {
classDoc.moduleDoc.comments.splice(index, 1);
}
_.assign(memberDoc, getJSDocComment(memberDoc.commentBefore));
}
});
}
});
return docs.concat(memberDocs);
}
};
};

View File

@ -1,46 +0,0 @@
var _ = require('lodash');
module.exports = function processModuleDocs(log, ExportTreeVisitor, getJSDocComment) {
return {
$runAfter: ['files-read'],
$runBefore: ['parsing-tags', 'generateDocsFromComments'],
$process: function(docs) {
var exportDocs = [];
_.forEach(docs, function(doc) {
if ( doc.docType === 'module' ) {
log.debug('processing', doc.moduleTree.moduleName);
doc.exports = [];
if ( doc.moduleTree.visit ) {
var visitor = new ExportTreeVisitor();
visitor.visit(doc.moduleTree);
_.forEach(visitor.exports, function(exportDoc) {
doc.exports.push(exportDoc);
exportDocs.push(exportDoc);
exportDoc.moduleDoc = doc;
if (exportDoc.comment) {
// If this export has a comment, remove it from the list of
// comments collected in the module
var index = doc.comments.indexOf(exportDoc.comment);
if ( index !== -1 ) {
doc.comments.splice(index, 1);
}
_.assign(exportDoc, getJSDocComment(exportDoc.comment));
}
});
}
}
});
return docs.concat(exportDocs);
}
};
};

View File

@ -0,0 +1,235 @@
var glob = require('glob');
var path = require('canonical-path');
var _ = require('lodash');
var ts = require('typescript');
module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, modules, getFileInfo, getExportDocType, getContent, log) {
return {
$runAfter: ['files-read'],
$runBefore: ['parsing-tags'],
$validate: {
sourceFiles: {presence: true},
basePath: {presence: true},
hidePrivateMembers: { inclusion: [true, false] },
sortClassMembers: { inclusion: [true, false] },
ignoreExportsMatching: {}
},
// A collection of globs that identify those modules for which we should create docs
sourceFiles: [],
// The base path from which to load the source files
basePath: '.',
// We can ignore members of classes that are private
hidePrivateMembers: true,
// We can sort class members alphabetically
sortClassMembers: true,
// We can provide a collection of strings or regexes to ignore exports whose export names match
ignoreExportsMatching: ['___esModule'],
$process: function(docs) {
// Convert ignoreExportsMatching to an array of regexes
var ignoreExportsMatching = convertToRegexCollection(this.ignoreExportsMatching);
var hidePrivateMembers = this.hidePrivateMembers;
var sortClassMembers = this.sortClassMembers;
var basePath = path.resolve(readFilesProcessor.basePath, this.basePath);
var filesPaths = expandSourceFiles(this.sourceFiles, basePath);
var parseInfo = tsParser.parse(filesPaths, this.basePath);
var moduleSymbols = parseInfo.moduleSymbols;
// Iterate through each of the modules that were parsed and generate a module doc
// as well as docs for each module's exports.
moduleSymbols.forEach(function(moduleSymbol) {
var moduleDoc = createModuleDoc(moduleSymbol, basePath);
// Add this module doc to the module lookup collection and the docs collection
modules[moduleDoc.id] = moduleDoc;
docs.push(moduleDoc);
// Iterate through this module's exports and generate a doc for each
moduleSymbol.exportArray.forEach(function(exportSymbol) {
// Ignore exports starting with an underscore
if (anyMatches(ignoreExportsMatching, exportSymbol.name)) return;
// If the symbol is an Alias then for most things we want the original resolved symbol
var resolvedExport = exportSymbol.resolvedSymbol || exportSymbol;
var exportDoc = createExportDoc(exportSymbol.name, resolvedExport, moduleDoc, basePath, parseInfo.typeChecker);
log.debug('>>>> EXPORT: ' + exportDoc.name + ' (' + exportDoc.docType + ') from ' + moduleDoc.id);
// Generate docs for each of the export's members
if (resolvedExport.flags & ts.SymbolFlags.HasMembers) {
exportDoc.members = [];
for(var memberName in resolvedExport.members) {
log.silly('>>>>>> member: ' + memberName + ' from ' + exportDoc.id + ' in ' + moduleDoc.id);
var memberSymbol = resolvedExport.members[memberName];
var memberDoc = createMemberDoc(memberSymbol, exportDoc, basePath, parseInfo.typeChecker);
// We special case the constructor and sort the other members alphabetically
if (memberSymbol.flags & ts.SymbolFlags.Constructor) {
exportDoc.constructorDoc = memberDoc;
docs.push(memberDoc);
} else if (!hidePrivateMembers || memberSymbol.name.charAt(0) !== '_') {
docs.push(memberDoc);
exportDoc.members.push(memberDoc);
}
}
if (sortClassMembers) {
exportDoc.members.sort(function(a, b) {
if (a.name > b.name) return 1;
if (a.name < b.name) return -1;
return 0;
});
}
}
// Add this export doc to its module doc
moduleDoc.exports.push(exportDoc);
docs.push(exportDoc);
});
});
}
};
function createModuleDoc(moduleSymbol, basePath) {
var id = moduleSymbol.name.replace(/^"|"$/g, '');
var moduleDoc = {
docType: 'module',
id: id,
aliases: [id],
moduleTree: moduleSymbol,
content: getContent(moduleSymbol),
exports: [],
fileInfo: getFileInfo(moduleSymbol, basePath),
location: getLocation(moduleSymbol)
};
return moduleDoc;
}
function createExportDoc(name, exportSymbol, moduleDoc, basePath, typeChecker) {
var exportDoc = {
docType: getExportDocType(exportSymbol),
name: name,
id: name,
aliases: [name],
moduleDoc: moduleDoc,
content: getContent(exportSymbol),
fileInfo: getFileInfo(exportSymbol, basePath),
location: getLocation(exportSymbol)
};
if(exportSymbol.flags & ts.SymbolFlags.Function) {
exportDoc.parameters = getParameters(typeChecker, exportSymbol);
}
if(exportSymbol.flags & ts.SymbolFlags.Value) {
exportDoc.returnType = getReturnType(typeChecker, exportSymbol);
}
return exportDoc;
}
function createMemberDoc(memberSymbol, classDoc, basePath, typeChecker) {
var memberDoc = {
docType: 'member',
classDoc: classDoc,
name: memberSymbol.name,
id: memberSymbol.name,
content: getContent(memberSymbol),
fileInfo: getFileInfo(memberSymbol, basePath),
location: getLocation(memberSymbol)
};
if (memberSymbol.flags & ts.SymbolFlags.Method) {
// NOTE: we use the property name `parameters` here so we don't conflict
// with the `params` property that will be updated by dgeni reading the
// `@param` tags from the docs
memberDoc.parameters = getParameters(typeChecker, memberSymbol);
}
if (memberSymbol.flags & ts.SymbolFlags.Constructor) {
memberDoc.parameters = getParameters(typeChecker, memberSymbol);
memberDoc.name = 'constructor';
}
if(memberSymbol.flags & ts.SymbolFlags.Value) {
memberDoc.returnType = getReturnType(typeChecker, memberSymbol);
}
return memberDoc;
}
function getParameters(typeChecker, symbol) {
var declaration = symbol.valueDeclaration || symbol.declarations[0];
var sourceFile = ts.getSourceFileOfNode(declaration);
if(!declaration.parameters) {
var location = getLocation(symbol);
throw new Error('missing declaration parameters for "' + symbol.name +
'" in ' + sourceFile.fileName +
' at line ' + location.start.line);
}
return declaration.parameters.map(function(parameter) {
return getText(sourceFile, parameter).trim();
});
}
function getReturnType(typeChecker, symbol) {
var declaration = symbol.valueDeclaration || symbol.declarations[0];
var sourceFile = ts.getSourceFileOfNode(declaration);
if (declaration.type) {
return getText(sourceFile, declaration.type).trim();
}
}
function expandSourceFiles(sourceFiles, basePath) {
var filePaths = [];
sourceFiles.forEach(function(sourcePattern) {
filePaths = filePaths.concat(glob.sync(sourcePattern, { cwd: basePath }));
});
return filePaths;
}
function getText(sourceFile, node) {
return sourceFile.text.substring(node.pos, node.end);
}
function getLocation(symbol) {
var node = symbol.valueDeclaration || symbol.declarations[0];
var sourceFile = ts.getSourceFileOfNode(node);
var location = {
start: ts.getLineAndCharacterOfPosition(sourceFile, node.pos),
end: ts.getLineAndCharacterOfPosition(sourceFile, node.end)
};
return location;
}
};
function convertToRegexCollection(items) {
if (!items) return [];
// Must be an array
if (!_.isArray(items)) {
items = [items];
}
// Convert string to exact matching regexes
return items.map(function(item) {
return _.isString(item) ? new RegExp('^' + item + '$') : item;
});
}
function anyMatches(regexes, item) {
for(var i=0; i<regexes.length; ++i) {
if ( item.match(regexes[i]) ) return true;
}
return false;
}

View File

@ -0,0 +1,81 @@
var mockPackage = require('../mocks/mockPackage');
var Dgeni = require('dgeni');
var path = require('canonical-path');
var _ = require('lodash');
describe('readTypeScriptModules', function() {
var dgeni, injector, processor;
beforeEach(function() {
dgeni = new Dgeni([mockPackage()]);
injector = dgeni.configureInjector();
processor = injector.get('readTypeScriptModules');
processor.basePath = path.resolve(__dirname, '../mocks/readTypeScriptModules');
});
describe('ignoreExportsMatching', function() {
it('should ignore exports that match items in the `ignoreExportsMatching` property', function() {
processor.sourceFiles = [ 'ignoreExportsMatching.ts'];
processor.ignoreExportsMatching = [/^_/];
var docs = [];
processor.$process(docs);
var moduleDoc = docs[0];
expect(moduleDoc.docType).toEqual('module');
expect(moduleDoc.exports).toEqual([
jasmine.objectContaining({ name: 'OKToExport' }),
jasmine.objectContaining({ name: 'thisIsOK' })
]);
});
it('should only ignore `___esModule` exports by default', function() {
processor.sourceFiles = [ 'ignoreExportsMatching.ts'];
var docs = [];
processor.$process(docs);
var moduleDoc = docs[0];
expect(moduleDoc.docType).toEqual('module');
expect(getNames(moduleDoc.exports)).toEqual([
'OKToExport',
'_thisIsPrivate',
'thisIsOK'
]);
});
});
describe('ordering of members', function() {
it('should order class members alphabetically (by default)', function() {
processor.sourceFiles = ['orderingOfMembers.ts'];
var docs = [];
processor.$process(docs);
var classDoc = _.find(docs, { docType: 'class' });
expect(classDoc.docType).toEqual('class');
expect(getNames(classDoc.members)).toEqual([
'doStuff',
'firstItem',
'otherMethod'
]);
});
it('should not order class members if not sortClassMembers is false', function() {
processor.sourceFiles = ['orderingOfMembers.ts'];
processor.sortClassMembers = false;
var docs = [];
processor.$process(docs);
var classDoc = _.find(docs, { docType: 'class' });
expect(classDoc.docType).toEqual('class');
expect(getNames(classDoc.members)).toEqual([
'firstItem',
'otherMethod',
'doStuff'
]);
});
});
});
function getNames(collection) {
return collection.map(function(item) { return item.name; });
}

View File

@ -1,32 +0,0 @@
var path = require('canonical-path');
/**
* @dgService atScriptFileReader
* @description
* This file reader will create a simple doc for each
* file including a code AST of the AtScript in the file.
*/
module.exports = function atScriptFileReader(log, atParser, modules) {
var reader = {
name: 'atScriptFileReader',
defaultPattern: /\.js$/,
getDocs: function(fileInfo) {
var moduleDoc = atParser.parseModule(fileInfo);
moduleDoc.docType = 'module';
moduleDoc.id = moduleDoc.moduleTree.moduleName;
moduleDoc.aliases = [moduleDoc.id];
modules[moduleDoc.id] = moduleDoc;
// Readers return a collection of docs read from the file
// but in this read there is only one document (module) to return
return [moduleDoc];
}
};
return reader;
};

View File

@ -1,55 +0,0 @@
var mockPackage = require('../mocks/mockPackage');
var Dgeni = require('dgeni');
describe('atScript file reader', function() {
var dgeni, injector, reader;
var fileContent =
'import {CONST} from "facade/lang";\n' +
'\n' +
'/**\n' +
'* A parameter annotation that creates a synchronous eager dependency.\n' +
'*\n' +
'* class AComponent {\n' +
'* constructor(@Inject("aServiceToken") aService) {}\n' +
'* }\n' +
'*\n' +
'*/\n' +
'export class Inject {\n' +
'token;\n' +
'@CONST()\n' +
'constructor(token) {\n' +
'this.token = token;\n' +
'}\n' +
'}';
beforeEach(function() {
dgeni = new Dgeni([mockPackage()]);
injector = dgeni.configureInjector();
reader = injector.get('atScriptFileReader');
});
it('should provide a default pattern', function() {
expect(reader.defaultPattern).toEqual(/\.js$/);
});
it('should parse the file using the atParser and return a single doc', function() {
var atParser = injector.get('atParser');
spyOn(atParser, 'parseModule').and.callThrough();
var docs = reader.getDocs({
content: fileContent,
relativePath: 'di/src/annotations.js'
});
expect(atParser.parseModule).toHaveBeenCalled();
expect(docs.length).toEqual(1);
expect(docs[0].docType).toEqual('module');
});
});

View File

@ -1,47 +0,0 @@
module.exports = function AttachCommentTreeVisitor(ParseTreeVisitor, log) {
function AttachCommentTreeVisitorImpl() {
ParseTreeVisitor.call(this);
}
AttachCommentTreeVisitorImpl.prototype = {
__proto__: ParseTreeVisitor.prototype,
visit: function(tree, comments) {
this.comments = comments;
this.index = 0;
this.currentComment = this.comments[this.index];
if (this.currentComment) log.silly('comment: ' +
this.currentComment.range.start.line + ' - ' +
this.currentComment.range.end.line + ' : ' +
this.currentComment.range.toString());
ParseTreeVisitor.prototype.visit.call(this, tree);
},
// Really we ought to subclass ParseTreeVisitor but this is fiddly in ES5 so
// it is easier to simply override the prototype's method on the instance
visitAny: function(tree) {
if (tree && tree.location && tree.location.start && this.currentComment &&
this.currentComment.range.end.offset < tree.location.start.offset) {
log.silly('tree: ' + tree.constructor.name + ' - ' + tree.location.start.line);
while (this.currentComment &&
this.currentComment.range.end.offset < tree.location.start.offset) {
log.silly('comment: ' + this.currentComment.range.start.line + ' - ' +
this.currentComment.range.end.line + ' : ' +
this.currentComment.range.toString());
tree.commentBefore = this.currentComment;
this.currentComment.treeAfter = tree;
this.index++;
this.currentComment = this.comments[this.index];
}
}
return ParseTreeVisitor.prototype.visitAny.call(this, tree);
}
};
return AttachCommentTreeVisitorImpl;
};

View File

@ -1,103 +0,0 @@
module.exports = function ExportTreeVisitor(ParseTreeVisitor, log) {
function ExportTreeVisitorImpl() {
ParseTreeVisitor.call(this);
}
ExportTreeVisitorImpl.prototype = {
__proto__: ParseTreeVisitor.prototype,
visitExportDeclaration: function(tree) {
// We are entering an export declaration - create an object to track it
this.currentExport = {
comment: tree.commentBefore,
location: tree.location
};
log.silly('enter', tree.type, tree.commentBefore ? 'has comment' : '');
ParseTreeVisitor.prototype.visitExportDeclaration.call(this, tree);
log.silly('exit', this.currentExport);
if(this.currentExport) {
// We are exiting the export declaration - store the export object
this.exports.push(this.currentExport);
}
this.currentExport = null;
},
visitVariableDeclaration: function(tree) {
if ( this.currentExport ) {
this.updateExport(tree);
this.currentExport.docType = 'var';
this.currentExport.name = tree.lvalue.identifierToken.value;
this.currentExport.variableDeclaration = tree;
}
},
visitFunctionDeclaration: function(tree) {
if ( this.currentExport ) {
this.updateExport(tree);
this.currentExport.name = tree.name.identifierToken.value;
this.currentExport.functionKind = tree.functionKind;
this.currentExport.parameters = tree.parameterList.parameters;
this.currentExport.typeAnnotation = tree.typeAnnotation;
this.currentExport.annotations = tree.annotations;
this.currentExport.docType = 'function';
log.silly(tree.type, tree.commentBefore ? 'has comment' : '');
}
},
visitClassDeclaration: function(tree) {
if ( this.currentExport ) {
this.updateExport(tree);
this.currentExport.name = tree.name.identifierToken.value;
this.currentExport.superClass = tree.superClass;
this.currentExport.annotations = tree.annotations;
this.currentExport.elements = tree.elements;
this.currentExport.docType = 'class';
}
},
visitAsyncFunctionDeclaration: function(tree) {
if ( this.currentExport ) {
this.updateExport(tree);
}
},
visitExportDefault: function(tree) {
if ( this.currentExport ) {
this.updateExport(tree);
this.currentExport.name = 'DEFAULT';
this.currentExport.defaultExport = tree;
// Default exports are either classes, functions or expressions
// So we let the super class continue down...
ParseTreeVisitor.prototype.visitExportDefault.call(this, tree);
}
},
visitNamedExport: function(tree) {
this.currentExport = null;
// if ( this.currentExport ) {
// this.updateExport(tree);
// this.currentExport.namedExport = tree;
// this.currentExport.name = 'NAMED_EXPORT';
// // TODO: work out this bit!!
// // We need to cope with any export specifiers in the named export
// }
},
// TODO - if the export is an expression, find the thing that is being
// exported and use it and its comments for docs
updateExport: function(tree) {
this.currentExport.comment = this.currentExport.comment || tree.commentBefore;
this.currentExport.docType = tree.type;
},
visit: function(tree) {
this.exports = [];
ParseTreeVisitor.prototype.visit.call(this, tree);
}
};
return ExportTreeVisitorImpl;
};

View File

@ -1,6 +0,0 @@
var traceur = require('traceur/src/node/traceur.js');
module.exports = function ParseTreeVisitor() {
console.log(System.map.traceur);
return System.get(System.map.traceur + '/src/syntax/ParseTreeVisitor.js').ParseTreeVisitor;
};

View File

@ -1,5 +0,0 @@
var traceur = require('traceur/src/node/traceur.js');
module.exports = function SourceFile() {
return System.get(System.map.traceur + '/src/syntax/SourceFile.js').SourceFile;
};

View File

@ -1,3 +0,0 @@
module.exports = function TraceurParser() {
return System.get('transpiler/src/parser').Parser;
};

View File

@ -1,74 +0,0 @@
var file2modulename = require('../../../tools/build/file2modulename');
/**
* Wrapper around traceur that can parse the contents of a file
*/
module.exports = function atParser(AttachCommentTreeVisitor, SourceFile, TraceurParser, traceurOptions, log) {
var service = {
/**
* The options to pass to traceur
*/
traceurOptions: {
annotations: true, // parse annotations
types: true, // parse types
memberVariables: true, // parse class fields
commentCallback: true // handle comments
},
/**
* Parse a module AST from the contents of a file.
* @param {Object} fileInfo information about the file to parse
* @return { { moduleTree: Object, comments: Array } } An object containing the parsed module
* AST and an array of all the comments found in the file
*/
parseModule: parseModule
};
return service;
// Parse the contents of the file using traceur
function parseModule(fileInfo) {
var moduleName = file2modulename(fileInfo.relativePath);
var sourceFile = new SourceFile(moduleName, fileInfo.content);
var comments = [];
var moduleTree;
var parser = new TraceurParser(sourceFile);
// Configure the parser
parser.handleComment = function(range) {
comments.push({ range: range });
};
traceurOptions.setFromObject(service.traceurOptions);
try {
// Parse the file as a module, attaching the comments
moduleTree = parser.parseModule();
attachComments(moduleTree, comments);
} catch(ex) {
// HACK: sometime traceur crashes for various reasons including
// Not Yet Implemented (NYI)!
log.error(ex.stack);
moduleTree = {};
}
log.debug(moduleName);
moduleTree.moduleName = moduleName;
// We return the module AST but also a collection of all the comments
// since it can be helpful to iterate through them without having to
// traverse the AST again
return {
moduleTree: moduleTree,
comments: comments
};
}
// attach the comments to their nearest code tree
function attachComments(tree, comments) {
var visitor = new AttachCommentTreeVisitor();
// Visit every node of the tree using our custom method
visitor.visit(tree, comments);
}
};

View File

@ -1,80 +0,0 @@
var mockPackage = require('../mocks/mockPackage');
var Dgeni = require('dgeni');
describe('atParser service', function() {
var dgeni, injector, parser;
var fileContent =
'import {CONST} from "facade/lang";\n' +
'\n' +
'/**\n' +
'* A parameter annotation that creates a synchronous eager dependency.\n' +
'*\n' +
'* class AComponent {\n' +
'* constructor(@Inject("aServiceToken") aService) {}\n' +
'* }\n' +
'*\n' +
'*/\n' +
'export class Inject {\n' +
'token;\n' +
'@CONST()\n' +
'constructor({a,b}:{a:string, b:string}) {\n' +
'this.token = a;\n' +
'}\n' +
'}';
beforeEach(function() {
dgeni = new Dgeni([mockPackage()]);
injector = dgeni.configureInjector();
parser = injector.get('atParser');
});
it('should extract the comments from the file', function() {
var result = parser.parseModule({
content: fileContent,
relativePath: 'di/src/annotations.js'
});
expect(result.comments[0].range.toString()).toEqual(
'/**\n' +
'* A parameter annotation that creates a synchronous eager dependency.\n' +
'*\n' +
'* class AComponent {\n' +
'* constructor(@Inject("aServiceToken") aService) {}\n' +
'* }\n' +
'*\n' +
'*/'
);
});
it('should extract a module AST from the file', function() {
var result = parser.parseModule({
content: fileContent,
relativePath: 'di/src/annotations.js'
});
expect(result.moduleTree.moduleName).toEqual('di/src/annotations');
expect(result.moduleTree.scriptItemList[0].type).toEqual('IMPORT_DECLARATION');
expect(result.moduleTree.scriptItemList[1].type).toEqual('EXPORT_DECLARATION');
});
it('should attach comments to their following AST', function() {
var result = parser.parseModule({
content: fileContent,
relativePath: 'di/src/annotations.js'
});
expect(result.moduleTree.scriptItemList[1].commentBefore.range.toString()).toEqual(
'/**\n' +
'* A parameter annotation that creates a synchronous eager dependency.\n' +
'*\n' +
'* class AComponent {\n' +
'* constructor(@Inject("aServiceToken") aService) {}\n' +
'* }\n' +
'*\n' +
'*/'
);
});
});

View File

@ -1,28 +0,0 @@
var LEADING_STAR = /^[^\S\r\n]*\*[^\S\n\r]?/gm;
/**
* Extact comment info from a comment object
* @param {Object} comment object to process
* @return { {startingLine, endingLine, content, codeTree}= } a comment info object
* or undefined if the comment is not a jsdoc style comment
*/
module.exports = function getJSDocComment() {
return function(comment) {
var commentInfo;
// we need to check for `/**` at the start of the comment to find all the jsdoc style comments
comment.range.toString().replace(/^\/\*\*([\w\W]*)\*\/$/g, function(match, commentBody) {
commentBody = commentBody.replace(LEADING_STAR, '').trim();
commentInfo = {
startingLine: comment.range.start.line,
endingLine: comment.range.end.line,
content: commentBody,
codeTree: comment.treeAfter
};
});
return commentInfo;
};
};

View File

@ -1,67 +0,0 @@
var mockPackage = require('../mocks/mockPackage');
var Dgeni = require('dgeni');
describe('getJSDocComment service', function() {
var dgeni, injector, getJSDocComment;
function createComment(commentString, start, end, codeTree) {
return {
range: {
toString: function() { return commentString; },
start: { line: start },
end: { line: end },
},
treeAfter: codeTree
};
}
beforeEach(function() {
dgeni = new Dgeni([mockPackage()]);
injector = dgeni.configureInjector();
getJSDocComment = injector.get('getJSDocComment');
});
it('should only return an object if the comment starts with /** and ends with */', function() {
var result = getJSDocComment(createComment('/** this is a jsdoc comment */'));
expect(result).toBeDefined();
result = getJSDocComment(createComment('/* this is a normal comment */'));
expect(result).toBeUndefined();
result = getJSDocComment(createComment('this is not a valid comment */'));
expect(result).toBeUndefined();
result = getJSDocComment(createComment('nor is this'));
expect(result).toBeUndefined();
result = getJSDocComment(createComment('/* or even this'));
expect(result).toBeUndefined();
result = getJSDocComment(createComment('/** and this'));
expect(result).toBeUndefined();
});
it('should return a result that contains info about the comment', function() {
var codeTree = {};
var result = getJSDocComment(createComment('/** this is a comment */', 10, 20, codeTree));
expect(result.startingLine).toEqual(10);
expect(result.endingLine).toEqual(20);
expect(result.codeTree).toBe(codeTree);
});
it('should strip off leading stars from each line', function() {
var result = getJSDocComment(createComment(
'/** this is a jsdoc comment */\n' +
' *\n' +
' * some content\n' +
' */'
));
expect(result.content).toEqual(
'this is a jsdoc comment */\n' +
'\n' +
'some content'
);
});
});

View File

@ -1,3 +0,0 @@
module.exports = function traceurOptions() {
return System.get(System.map.traceur + '/src/Options.js').options;
};

View File

@ -0,0 +1,74 @@
var ts = require('typescript');
var path = require('canonical-path');
module.exports = function tsParser(createCompilerHost, log) {
return {
// These are the extension that we should consider when trying to load a module
// During migration from Traceur, there is a mix of `.ts`, `.es6` and `.js` (atScript)
// files in the project and the TypeScript compiler only looks for `.ts` files when trying
// to load imports.
extensions: ['.ts', '.js', '.es6'],
// The options for the TS compiler
options: {
allowNonTsExtensions: true,
charset: 'utf8'
},
parse: function(fileNames, baseDir) {
// "Compile" a program from the given module filenames, to get hold of a
// typeChecker that can be used to interrogate the modules, exports and so on.
var host = createCompilerHost(this.options, baseDir, this.extensions);
var program = ts.createProgram(fileNames, this.options, host);
var typeChecker = program.getTypeChecker();
// Create an array of module symbols for each file we were given
var moduleSymbols = [];
fileNames.forEach(function(fileName) {
var sourceFile = program.getSourceFile(fileName);
if (!sourceFile) {
throw new Error('Invalid source file: ' + fileName);
} else if (!sourceFile.symbol) {
// Some files contain only a comment and no actual module code
log.warn('No module code found in ' + fileName);
} else {
moduleSymbols.push(sourceFile.symbol);
}
});
moduleSymbols.forEach(function(tsModule) {
// The type checker has a nice helper function that returns an array of Symbols
// representing the exports for a given module
tsModule.exportArray = typeChecker.getExportsOfModule(tsModule);
// Although 'star' imports (e.g. `export * from 'some/module';) get resolved automatically
// by the compiler/binder, it seems that explicit imports (e.g. `export {SomeClass} from 'some/module'`)
// do not so we have to do a little work.
tsModule.exportArray.forEach(function(moduleExport) {
if (moduleExport.flags & ts.SymbolFlags.Alias) {
// To maintain the alias information (particularly the alias name)
// we just attach the original "resolved" symbol to the alias symbol
moduleExport.resolvedSymbol = typeChecker.getAliasedSymbol(moduleExport);
}
});
});
moduleSymbols.typeChecker = typeChecker;
return {
moduleSymbols: moduleSymbols,
typeChecker: typeChecker,
program: program,
host: host
};
}
};
};

View File

@ -0,0 +1,21 @@
var mockPackage = require('../mocks/mockPackage');
var Dgeni = require('dgeni');
var path = require('canonical-path');
describe('tsParser', function() {
var dgeni, injector, parser;
beforeEach(function() {
dgeni = new Dgeni([mockPackage()]);
injector = dgeni.configureInjector();
parser = injector.get('tsParser');
});
it("should parse a TS file", function() {
var parseInfo = parser.parse(['testSrc.ts'], path.resolve(__dirname, '../mocks/'));
var tsModules = parseInfo.moduleSymbols;
expect(tsModules.length).toEqual(1);
expect(tsModules[0].exportArray.length).toEqual(3);
expect(tsModules[0].exportArray.map(function(i) { return i.name; })).toEqual(['MyClass', 'myFn', 'x']);
});
});

View File

@ -0,0 +1,62 @@
var ts = require('typescript');
var fs = require('fs');
var path = require('canonical-path');
// We need to provide our own version of CompilerHost because we want to set the
// base directory and specify what extensions to consider when trying to load a source
// file
module.exports = function createCompilerHost(log) {
return function createCompilerHost(options, baseDir, extensions) {
return {
getSourceFile: function(fileName, languageVersion, onError) {
var text, resolvedPath, resolvedPathWithExt;
// Strip off the extension and resolve relative to the baseDir
baseFilePath = fileName.replace(/\.[^.]+$/, '');
resolvedPath = path.resolve(baseDir, baseFilePath);
// Iterate through each possible extension and return the first source file that is actually found
for(var i=0; i<extensions.length; i++) {
// Try reading the content from files using each of the given extensions
try {
resolvedPathWithExt = resolvedPath + extensions[i];
log.silly('getSourceFile:', resolvedPathWithExt);
text = fs.readFileSync(resolvedPathWithExt, { encoding: options.charset });
log.debug('found source file:', fileName, resolvedPathWithExt);
return ts.createSourceFile(baseFilePath + extensions[i], text, languageVersion);
}
catch(e) {
// Try again if the file simply did not exist, otherwise report the error as a warning
if(e.code !== 'ENOENT') {
if (onError) onError(e.message);
log.warn('Error reading ' + resolvedPathWithExt + ' : ' + e.message);
}
}
}
},
getDefaultLibFileName: function(options) {
return path.resolve(path.dirname(ts.sys.getExecutingFilePath()), ts.getDefaultLibFileName(options));
},
writeFile: function(fileName, data, writeByteOrderMark, onError) {
// no-op
},
getCurrentDirectory: function() {
return baseDir;
},
useCaseSensitiveFileNames: function() {
return ts.sys.useCaseSensitiveFileNames;
},
getCanonicalFileName: function(fileName) {
// if underlying system can distinguish between two files whose names differs only in cases then file name already in canonical form.
// otherwise use toLowerCase as a canonical form.
return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
},
getNewLine: function() {
return ts.sys.newLine;
}
};
};
};

View File

@ -0,0 +1,80 @@
var mockPackage = require('../../mocks/mockPackage');
var Dgeni = require('dgeni');
var path = require('canonical-path');
var ts = require('typescript');
describe('createCompilerHost', function() {
var dgeni, injector, options, host, baseDir, extensions;
beforeEach(function() {
dgeni = new Dgeni([mockPackage()]);
injector = dgeni.configureInjector();
var createCompilerHost = injector.get('createCompilerHost');
options = { charset: 'utf8' };
baseDir = path.resolve(__dirname, '../../mocks/');
extensions = ['.ts', '.js'];
host = createCompilerHost(options, baseDir, extensions);
});
describe('getSourceFile', function() {
it('should return a SourceFile object for a given path, with fileName relative to baseDir', function() {
var sourceFile = host.getSourceFile('testSrc.ts');
expect(sourceFile.fileName).toEqual('testSrc.ts');
expect(sourceFile.pos).toEqual(0);
expect(sourceFile.text).toEqual(jasmine.any(String));
});
it('should try each of the configured extensions and update the filename to the correct extension', function() {
var sourceFile = host.getSourceFile('testSrc.js');
expect(sourceFile.fileName).toEqual('testSrc.ts');
sourceFile = host.getSourceFile('mockPackage.ts');
expect(sourceFile.fileName).toEqual('mockPackage.js');
});
});
describe('getDefaultLibFileName', function() {
it('should return a path to the default library', function() {
expect(host.getDefaultLibFileName(options)).toContain('typescript/bin/lib.d.ts');
});
});
describe('writeFile', function() {
it('should do nothing', function() {
host.writeFile();
});
});
describe('getCurrentDirectory', function() {
it('should return the baseDir', function() {
expect(host.getCurrentDirectory()).toEqual(baseDir);
});
});
describe('useCaseSensitiveFileNames', function() {
it('should return true if the OS is case sensitive', function() {
expect(host.useCaseSensitiveFileNames()).toBe(ts.sys.useCaseSensitiveFileNames);
});
});
describe('getCanonicalFileName', function() {
it('should lower case the filename', function() {
var expectedFilePath = host.useCaseSensitiveFileNames() ? 'SomeFile.ts' : 'somefile.ts';
expect(host.getCanonicalFileName('SomeFile.ts')).toEqual(expectedFilePath);
});
});
describe('getNewLine', function() {
it('should return the newline character for the OS', function() {
expect(host.getNewLine()).toEqual(require('os').EOL);
});
});
});

View File

@ -0,0 +1,49 @@
var ts = require('typescript');
var LEADING_STAR = /^[^\S\r\n]*\*[^\S\n\r]?/gm;
module.exports = function getContent() {
return function(symbol) {
var content = "";
if (!symbol.declarations) return content;
symbol.declarations.forEach(function(declaration) {
// If this is left side of dotted module declaration, there is no doc comment associated with this declaration
if (declaration.kind === ts.SyntaxKind.ModuleDeclaration && declaration.body.kind === ts.SyntaxKind.ModuleDeclaration) {
return content;
}
// If this is dotted module name, get the doc comments from the parent
while (declaration.kind === ts.SyntaxKind.ModuleDeclaration && declaration.parent.kind === ts.SyntaxKind.ModuleDeclaration) {
declaration = declaration.parent;
}
// If this is a variable declaration then we get the doc comments from the grand parent
if (declaration.kind === ts.SyntaxKind.VariableDeclaration) {
declaration = declaration.parent.parent;
}
// Get the source file of this declaration
var sourceFile = ts.getSourceFileOfNode(declaration);
var commentRanges = ts.getJsDocComments(declaration, sourceFile);
if (commentRanges) {
commentRanges.forEach(function(commentRange) {
content += sourceFile.text
.substring(commentRange.pos+ '/**'.length, commentRange.end - '*/'.length)
.replace(LEADING_STAR, '')
.trim();
if (commentRange.hasTrailingNewLine) {
content += '\n';
}
});
}
content += '\n';
});
return content;
};
};

View File

@ -0,0 +1,46 @@
var ts = require('typescript');
module.exports = function getExportDocType() {
return function(symbol) {
if(symbol.flags & ts.SymbolFlags.FunctionScopedVariable) {
return 'var';
}
if(symbol.flags & ts.SymbolFlags.BlockScopedVariable) {
return getBlockScopedVariableDocType(symbol);
}
if(symbol.flags & ts.SymbolFlags.Function) {
return 'function';
}
if(symbol.flags & ts.SymbolFlags.Class) {
return 'class';
}
if(symbol.flags & ts.SymbolFlags.Interface) {
return 'interface';
}
if(symbol.flags & ts.SymbolFlags.ConstEnum) {
return 'enum';
}
if(symbol.flags & ts.SymbolFlags.RegularEnum) {
return 'enum';
}
if(symbol.flags & ts.SymbolFlags.Property) {
return 'module-property';
}
log.warn('Unknown symbol type', symbol.name, symbol.flags, symbol.target);
return 'unknown';
}
function getBlockScopedVariableDocType(symbol) {
var node = symbol.valueDeclaration;
while(node) {
if ( node.flags & 0x2000 /* const */) {
return 'const';
}
node = node.parent;
}
return 'let';
}
};

View File

@ -0,0 +1,20 @@
var path = require('canonical-path');
var ts = require('typescript');
module.exports = function getFileInfo(log) {
return function (symbol, basePath) {
var fileName = ts.getSourceFileOfNode(symbol.declarations[0]).fileName;
var file = path.resolve(basePath, fileName);
var fileInfo = {
filePath: file,
baseName: path.basename(file, path.extname(file)),
extension: path.extname(file).replace(/^\./, ''),
basePath: basePath,
relativePath: fileName,
projectRelativePath: fileName
};
return fileInfo;
};
};

View File

@ -0,0 +1,4 @@
module.exports = {
name: 'exportedAs',
multi: true
};

View File

@ -0,0 +1,4 @@
module.exports = {
name: 'private',
transforms: function(doc, tag) { return true; }
};

View File

@ -0,0 +1,4 @@
module.exports = {
name: 'public',
transforms: function(doc, tag) { return true; }
};

View File

@ -1,14 +1,35 @@
{% extends 'layout/base.template.html' %}
{% include "lib/paramList.html" -%}
{% include "lib/githubLinks.html" -%}
{% extends 'layout/base.template.html' -%}
{% block body %}
<h1>{$ doc.name $} <span class="type">class</span></h1>
<p class="module">exported from <a href="/{$ doc.moduleDoc.path $}">{$ doc.moduleDoc.id $}</a></p>
<h1 class="class export">{$ doc.name $} <span class="type">{$ doc.docType $}</span></h1>
<p class="module">exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }<br/>
defined in {$ githubViewLink(doc) $}
</p>
<p>{$ doc.description | marked $}</p>
{%- if doc.constructorDoc or doc.members.length -%}
<h2>Members</h2>
{% for member in doc.members %}
<h3>{$ member.name $}</h3>
<p>{$ member.description | marked $}</p>
{% endfor %}
{%- if doc.constructorDoc %}
<section class="member constructor">
<h1 id="constructor" class="name">{$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.params) $}</h1>
{% marked %}
{$ doc.constructorDoc.description $}
{% endmarked %}
</section>
{% endif -%}
{%- for member in doc.members %}{% if not member.private %}
<section class="member">
<h1 id="{$ member.name $}" class="name">{$ member.name $}{$ paramList(member.params) $}</h1>
{% marked %}
{$ member.description $}
{% endmarked %}
</section>
{% endif %}{% endfor %}
{%- endif -%}
{% endblock %}

View File

@ -0,0 +1 @@
{% extends 'var.template.html' -%}

View File

@ -0,0 +1,11 @@
{% include "lib/paramList.html" -%}
{% include "lib/githubLinks.html" -%}
{% extends 'layout/base.template.html' -%}
{% block body %}
<h1 class="function export">{$ doc.name $}{$ paramList(doc.parameters) $}</h1>
<p class="module">exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }<br/>
defined in {$ githubViewLink(doc) $}</p>
<p>{$ doc.description | marked $}</p>
{% endblock %}

View File

@ -0,0 +1 @@
{% extends 'class.template.html' -%}

View File

@ -0,0 +1,3 @@
{% macro githubViewLink(doc) -%}
<a href="https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and 'master' or versionInfo.currentVersion.raw $}/modules/{$ doc.fileInfo.relativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $}">
{%- endmacro -%}

View File

@ -0,0 +1,7 @@
{% macro paramList(params) -%}
{%- if params -%}<span class="params">(
{%- for param in params -%}
<span class="param">{$ param | escape $}{% if not loop.last %}, {% endif %}</span>
{%- endfor %})</span>
{%- endif %}
{%- endmacro -%}

View File

@ -1,15 +1,18 @@
{% include "lib/githubLinks.html" -%}
{% extends 'layout/base.template.html' %}
{% block body %}
<h1 class="id">{$ doc.id $} <span class="type">module</span></h1>
<p>defined in {$ githubViewLink(doc) $}</p>
<p>{$ doc.description | marked $}</p>
{% if doc.exports.length %}
<h2>Exports</h2>
<ul>
{%- for exportDoc in doc.exports %}
<li><a href="/{$ exportDoc.path $}">{$ exportDoc.name $} {$ exportDoc.docType $}</a></li>
{% if not exportDoc.private -%}
<li><a href="{$ exportDoc.path $}"><strong>{$ exportDoc.name $}</strong> {$ exportDoc.docType $}</a></li>
{%- endif %}
{%- endfor %}
</ul>
{% endif %}

View File

@ -0,0 +1,43 @@
{% include "lib/paramList.html" -%}
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
h2 {
padding-left: 20px;
}
h3 {
padding-left: 50px;
}
h4 {
padding-left: 60px;
}
</style>
</head>
<body>
<h1>Modules</h1>
{% for module in doc.modules %}
<h2>{$ module.id $}
{%- if module.public %} (public){% endif %}</h2>
{% for export in module.exports %}
<h3>{$ export.name $}</h3>
{%- if export.constructorDoc %}
<h4>{$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.params) $}</h4>
{% endif -%}
{%- for member in export.members %}
<h4>{$ member.name $}{$ paramList(member.params) $}</h4>
{% endfor %}
{% endfor %}
{% endfor %}
</body>
</html>

View File

@ -0,0 +1,46 @@
{%- macro commentBlock(doc, level) -%}
{%- if doc.content | trim %}
{% if level > 1 %}{$ '/**' | indent(level-1, true) | replace(r/\n$/, "") $}{% else %}/**{% endif %}
{$ doc.content | trim | replace(r/^/gm, "* ") | indent(level, true) | replace(r/\n$/, "") $}
{$ '*/' | indent(level, true) | replace(r/\n$/, "") $}{% endif -%}
{%- endmacro -%}
// Type definitions for Angular v2.0.0-alpha.22
// Project: http://angular.io/
// Definitions by: angular team <https://github.com/angular/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// ***********************************************************
// This file is generated by the Angular build process.
// Please do not create manual edits or send pull requests
// modifying this file.
// ***********************************************************
{% for module in doc.modules %}
{$ commentBlock(module, 1) $}
declare module "{$ module.id $}" {
{%- for export in module.exports -%}
{%- if export.content -%}
{$ commentBlock(export, 3) $}
{%- endif %}
{$ export.docType $} {$ export.name $}
{%- if export.docType == 'class' or export.docType == 'interface' %} {
{%- for member in export.members -%}
{$ commentBlock(member, 5) $}
{$ member.name $}
{%- if member.parameters %}({% for param in member.parameters %}{$ param $}{% if not loop.last %}, {% endif %}{% endfor %}){%- endif %}
{%- if member.returnType %}: {$ member.returnType $}{% endif -%}
;
{%- endfor %}
}
{%- else -%}
{% if export.parameters %}({% for param in export.parameters %}{$ param $}{% if not loop.last %}, {% endif %}{% endfor %}){%- endif %}
{%- if export.returnType %} : {$ export.returnType $} {% endif -%}
;
{%- endif %}
{% endfor %}
}
{% endfor %}

View File

@ -0,0 +1,10 @@
{% include "lib/githubLinks.html" -%}
{% extends 'layout/base.template.html' %}
{% block body %}
<h1>{$ doc.name $} <span class="type">variable</span></h1>
<p class="module">exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }<br/>
defined in {$ githubViewLink(doc) $}</p>
<p>{$ doc.description | marked $}</p>
{% endblock %}

View File

@ -0,0 +1,181 @@
'use strict';
var fs = require('fs');
var path = require('path');
var shell = require('shelljs');
var semver = require('semver');
var _ = require('lodash');
var currentPackage, previousVersions, gitRepoInfo;
/**
* Load information about this project from the package.json
* @return {Object} The package information
*/
var getPackage = function() {
// Search up the folder hierarchy for the first package.json
var packageFolder = path.resolve('.');
while (!fs.existsSync(path.join(packageFolder, 'package.json'))) {
var parent = path.dirname(packageFolder);
if (parent === packageFolder) { break; }
packageFolder = parent;
}
return JSON.parse(fs.readFileSync(path.join(packageFolder,'package.json'), 'UTF-8'));
};
/**
* Parse the github URL for useful information
* @return {Object} An object containing the github owner and repository name
*/
var getGitRepoInfo = function() {
var GITURL_REGEX = /^https:\/\/github.com\/([^\/]+)\/(.+).git$/;
var match = GITURL_REGEX.exec(currentPackage.repository.url);
var git = {
owner: match[1],
repo: match[2]
};
return git;
};
/**
* Extract the code name from the tagged commit's message - it should contain the text of the form:
* "codename(some-code-name)"
* @param {String} tagName Name of the tag to look in for the codename
* @return {String} The codename if found, otherwise null/undefined
*/
var getCodeName = function(tagName) {
var gitCatOutput = shell.exec('git cat-file -p ' + tagName, {silent:true}).output;
var tagMessage = gitCatOutput.match(/^.*codename.*$/mg)[0];
var codeName = tagMessage && tagMessage.match(/codename\((.*)\)/)[1];
if (!codeName) {
throw new Error("Could not extract release code name. The message of tag " + tagName +
" must match '*codename(some release name)*'");
}
return codeName;
};
/**
* Compute a build segment for the version, from the Jenkins build number and current commit SHA
* @return {String} The build segment of the version
*/
function getBuild() {
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
return 'sha.' + hash;
}
/**
* If the current commit is tagged as a version get that version
* @return {SemVer} The version or null
*/
var getTaggedVersion = function() {
var gitTagResult = shell.exec('git describe --exact-match', {silent:true});
if (gitTagResult.code === 0) {
var tag = gitTagResult.output.trim();
var version = semver.parse(tag);
if (version && semver.satisfies(version, currentPackage.version)) {
version.codeName = getCodeName(tag);
version.full = version.version;
version.branch = 'v' + currentPackage.branchPattern.replace('*', 'x');
return version;
}
}
return null;
};
/**
* Get a collection of all the previous versions sorted by semantic version
* @return {Array.<SemVer>} The collection of previous versions
*/
var getPreviousVersions = function() {
// always use the remote tags as the local clone might
// not contain all commits when cloned with git clone --depth=...
// Needed e.g. for Travis
var repo_url = currentPackage.repository.url;
var tagResults = shell.exec('git ls-remote --tags ' + repo_url,
{silent: true});
if (tagResults.code === 0) {
return _(tagResults.output.match(/v[0-9].*[0-9]$/mg))
.map(function(tag) {
var version = semver.parse(tag);
return version;
})
.filter()
.map(function(version) {
// angular.js didn't follow semantic version until 1.20rc1
if ((version.major === 1 && version.minor === 0 && version.prerelease.length > 0) || (version.major === 1 && version.minor === 2 && version.prerelease[0] === 'rc1')) {
version.version = [version.major, version.minor, version.patch].join('.') + version.prerelease.join('');
version.raw = 'v' + version.version;
}
version.docsUrl = 'http://code.angularjs.org/' + version.version + '/docs';
// Versions before 1.0.2 had a different docs folder name
if (version.major < 1 || (version.major === 1 && version.minor === 0 && version.patch < 2)) {
version.docsUrl += '-' + version.version;
version.isOldDocsUrl = true;
}
return version;
})
.sort(semver.compare)
.value();
} else {
return [];
}
};
/**
* Get the unstable snapshot version
* @return {SemVer} The snapshot version
*/
var getSnapshotVersion = function() {
var version = _(previousVersions)
.filter(function(tag) {
return semver.satisfies(tag, currentPackage.version);
})
.last();
if (!version) {
// a snapshot version before the first tag on the branch
version = semver(currentPackage.branchPattern.replace('*','0-alpha.1'));
}
// We need to clone to ensure that we are not modifying another version
version = semver(version.raw);
var jenkinsBuild = process.env.TRAVIS_BUILD_NUMBER || process.env.BUILD_NUMBER;
if (!version.prerelease || !version.prerelease.length) {
// last release was a non beta release. Increment the patch level to
// indicate the next release that we will be doing.
// E.g. last release was 1.3.0, then the snapshot will be
// 1.3.1-build.1, which is lesser than 1.3.1 accorind the semver!
// If the last release was a beta release we don't update the
// beta number by purpose, as otherwise the semver comparison
// does not work any more when the next beta is released.
// E.g. don't generate 1.3.0-beta.2.build.1
// as this is bigger than 1.3.0-beta.2 according to semver
version.patch++;
}
version.prerelease = jenkinsBuild ? ['build', jenkinsBuild] : ['local'];
version.build = getBuild();
version.codeName = 'snapshot';
version.isSnapshot = true;
version.format();
version.full = version.version + '+' + version.build;
version.branch = 'master';
return version;
};
exports.currentPackage = currentPackage = getPackage();
exports.gitRepoInfo = gitRepoInfo = getGitRepoInfo();
exports.previousVersions = previousVersions = getPreviousVersions();
exports.currentVersion = getTaggedVersion() || getSnapshotVersion();

View File

@ -0,0 +1,12 @@
var Package = require('dgeni').Package;
module.exports = new Package('links', [])
.factory(require('./inline-tag-defs/link'))
.factory(require('dgeni-packages/ngdoc/services/getAliases'))
.factory(require('dgeni-packages/ngdoc/services/getDocFromAlias'))
.factory(require('./services/getLinkInfo'))
.config(function(inlineTagProcessor, linkInlineTagDef) {
inlineTagProcessor.inlineTagDefinitions.push(linkInlineTagDef);
});

View File

@ -0,0 +1,33 @@
var INLINE_LINK = /(\S+)(?:\s+([\s\S]+))?/;
/**
* @dgService linkInlineTagDef
* @description
* Process inline link tags (of the form {@link some/uri Some Title}), replacing them with HTML anchors
* @kind function
* @param {Object} url The url to match
* @param {Function} docs error message
* @return {String} The html link information
*
* @property {boolean} relativeLinks Whether we expect the links to be relative to the originating doc
*/
module.exports = function linkInlineTagDef(getLinkInfo, createDocMessage, log) {
return {
name: 'link',
description: 'Process inline link tags (of the form {@link some/uri Some Title}), replacing them with HTML anchors',
handler: function(doc, tagName, tagDescription) {
// Parse out the uri and title
return tagDescription.replace(INLINE_LINK, function(match, uri, title) {
var linkInfo = getLinkInfo(uri, title, doc);
if ( !linkInfo.valid ) {
log.warn(createDocMessage(linkInfo.error, doc));
}
return "<a href='" + linkInfo.url + "'>" + linkInfo.title + "</a>";
});
}
};
};

View File

@ -0,0 +1,72 @@
var _ = require('lodash');
var path = require('canonical-path');
/**
* @dgService getLinkInfo
* @description
* Get link information to a document that matches the given url
* @kind function
* @param {String} url The url to match
* @param {String} title An optional title to return in the link information
* @return {Object} The link information
*
* @property {boolean} relativeLinks Whether we expect the links to be relative to the originating doc
*/
module.exports = function getLinkInfo(getDocFromAlias, encodeCodeBlock, log) {
return function getLinkInfoImpl(url, title, currentDoc) {
var linkInfo = {
url: url,
type: 'url',
valid: true,
title: title || url
};
if ( !url ) {
throw new Error('Invalid url');
}
var docs = getDocFromAlias(url, currentDoc);
if ( !getLinkInfoImpl.useFirstAmbiguousLink && docs.length > 1 ) {
linkInfo.valid = false;
linkInfo.errorType = 'ambiguous';
linkInfo.error = 'Ambiguous link: "' + url + '".\n' +
docs.reduce(function(msg, doc) { return msg + '\n "' + doc.id + '" ('+ doc.docType + ') : (' + doc.path + ' / ' + doc.fileInfo.relativePath + ')'; }, 'Matching docs: ');
} else if ( docs.length >= 1 ) {
linkInfo.url = docs[0].path;
linkInfo.title = title || encodeCodeBlock(docs[0].name, true);
linkInfo.type = 'doc';
if ( getLinkInfoImpl.relativeLinks && currentDoc && currentDoc.path ) {
var currentFolder = path.dirname(currentDoc.path);
var docFolder = path.dirname(linkInfo.url);
var relativeFolder = path.relative(path.join('/', currentFolder), path.join('/', docFolder));
linkInfo.url = path.join(relativeFolder, path.basename(linkInfo.url));
log.debug(currentDoc.path, docs[0].path, linkInfo.url);
}
} else if ( url.indexOf('#') > 0 ) {
var pathAndHash = url.split('#');
linkInfo = getLinkInfoImpl(pathAndHash[0], title, currentDoc);
linkInfo.url = linkInfo.url + '#' + pathAndHash[1];
return linkInfo;
} else if ( url.indexOf('/') === -1 && url.indexOf('#') !== 0 ) {
linkInfo.valid = false;
linkInfo.errorType = 'missing';
linkInfo.error = 'Invalid link (does not match any doc): "' + url + '"';
} else {
linkInfo.title = title || (( url.indexOf('#') === 0 ) ? url.substring(1) : path.basename(url, '.html'));
}
return linkInfo;
};
};

View File

@ -1,18 +1,25 @@
var Package = require('dgeni').Package;
var basePackage = require('../dgeni-package');
module.exports = new Package('angular-public', [basePackage])
.processor(require('./processors/filterPublicDocs'))
.config(function(parseTagsProcessor) {
parseTagsProcessor.tagDefinitions.push({ name: 'publicModule' });
.config(function(readTypeScriptModules) {
readTypeScriptModules.sourceFiles = [
'angular2/annotations.ts',
'angular2/change_detection.ts',
'angular2/core.ts',
'angular2/di.ts',
'angular2/directives.ts',
'angular2/forms.ts',
'angular2/router.js',
'angular2/test.ts',
'angular2/pipes.ts'
];
readTypeScriptModules.hidePrivateMembers = true;
})
.config(function(processClassDocs, filterPublicDocs, EXPORT_DOC_TYPES) {
processClassDocs.ignorePrivateMembers = true;
filterPublicDocs.docTypes = EXPORT_DOC_TYPES;
.config(function(getLinkInfo) {
getLinkInfo.useFirstAmbiguousLink = false;
})
// Configure file writing

View File

@ -1,51 +0,0 @@
var _ = require('lodash');
module.exports = function filterPublicDocs(modules) {
return {
$runAfter: ['tags-parsed'],
$runBefore: ['computing-ids'],
docTypes: [],
$validate: {
docTypes: { presence: true }
},
$process: function(docs) {
docTypes = this.docTypes;
docs = _.filter(docs, function(doc) {
if (docTypes.indexOf(doc.docType) === -1) return true;
if (!doc.publicModule) return false;
updateModule(doc);
return true;
});
docs = _.filter(docs, function(doc) {
return doc.docType !== 'module' || doc.isPublic;
});
return docs;
}
};
function updateModule(classDoc) {
var originalModule = classDoc.moduleDoc;
var publicModule = modules[classDoc.publicModule];
if (!publicModule) {
throw new Error('Missing module definition: "' + classDoc.publicModule + '"\n' +
'Referenced in class: "' + classDoc.moduleDoc.id + '/' + classDoc.name + '"');
}
publicModule.isPublic = true;
_.remove(classDoc.moduleDoc.exports, function(doc) { return doc === classDoc; });
classDoc.moduleDoc = publicModule;
publicModule.exports.push(classDoc);
}
};

File diff suppressed because it is too large Load Diff

View File

@ -1,81 +1,51 @@
// Karma configuration
// Generated on Thu Sep 25 2014 11:52:02 GMT-0700 (PDT)
var file2moduleName = require('./tools/build/file2modulename');
module.exports = function(config) {
config.set({
frameworks: ['dart-unittest'],
files: [
// Init and configure guiness.
{pattern: 'test-init.dart', included: true},
// Unit test files needs to be included.
// Karma-dart generates `__adapter_unittest.dart` that imports these files.
{pattern: 'modules/*/test/**/*_spec.js', included: true},
{pattern: 'tools/transpiler/spec/**/*_spec.js', included: true},
{pattern: 'dist/dart/**/*_spec.dart', included: true, watched: false},
// These files are not included, they are imported by the unit tests above.
{pattern: 'modules/**', included: false},
{pattern: 'tools/transpiler/spec/**/*', included: false},
// Karma-dart via the dart-unittest framework generates
// `__adapter_unittest.dart` that imports these files.
{pattern: 'dist/dart/**', included: false, watched: false},
// Dependencies, installed with `pub install`.
{pattern: 'packages/**/*.dart', included: false, watched: false},
// Init and configure guiness.
{pattern: 'test-main.dart', included: true}
{pattern: 'test-main.dart', included: true},
{pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false},
],
exclude: [
'dist/dart/**/packages/**',
],
karmaDartImports: {
guinness: 'package:guinness/guinness_html.dart'
},
// TODO(vojta): Remove the localhost:9877 from urls, once the proxy fix is merged:
// https://github.com/karma-runner/karma/pull/1207
//
// Map packages to the correct urls where Karma serves them.
proxies: {
// Dependencies installed with `pub install`.
'/packages/unittest': 'http://localhost:9877/base/packages/unittest',
'/packages/guinness': 'http://localhost:9877/base/packages/guinness',
'/packages/matcher': 'http://localhost:9877/base/packages/matcher',
'/packages/stack_trace': 'http://localhost:9877/base/packages/stack_trace',
'/packages/collection': 'http://localhost:9877/base/packages/collection',
'/packages/path': 'http://localhost:9877/base/packages/path',
'/packages/unittest': '/base/packages/unittest',
'/packages/guinness': '/base/packages/guinness',
'/packages/matcher': '/base/packages/matcher',
'/packages/stack_trace': '/base/packages/stack_trace',
'/packages/collection': '/base/packages/collection',
'/packages/path': '/base/packages/path',
// Local dependencies, transpiled from the source.
'/packages/angular': 'http://localhost:9877/base/modules/angular',
'/packages/benchpress': 'http://localhost:9877/base/modules/benchpress',
'/packages/core': 'http://localhost:9877/base/modules/core',
'/packages/change_detection': 'http://localhost:9877/base/modules/change_detection',
'/packages/reflection': 'http://localhost:9877/base/modules/reflection',
'/packages/di': 'http://localhost:9877/base/modules/di',
'/packages/directives': 'http://localhost:9877/base/modules/directives',
'/packages/facade': 'http://localhost:9877/base/modules/facade',
'/packages/forms': 'http://localhost:9877/base/modules/forms',
'/packages/test_lib': 'http://localhost:9877/base/modules/test_lib',
'/packages/mock': 'http://localhost:9877/base/modules/mock',
},
preprocessors: {
'modules/**/*.js': ['traceur'],
'tools/**/*.js': ['traceur']
},
traceurPreprocessor: {
options: {
outputLanguage: 'dart',
sourceMaps: true,
script: false,
modules: 'register',
memberVariables: true,
types: true,
// typeAssertions: true,
// typeAssertionModule: 'assert',
annotations: true
},
resolveModuleName: file2moduleName,
transformPath: function(fileName) {
return fileName.replace('.js', '.dart');
}
'/packages/angular2': '/base/dist/dart/angular2/lib',
'/packages/angular2_material': '/base/dist/dart/angular2_material/lib',
'/packages/benchpress': '/base/dist/dart/benchpress/lib',
'/packages/examples': '/base/dist/dart/examples/lib'
},
customLaunchers: {
@ -87,7 +57,4 @@ module.exports = function(config) {
port: 9877
});
config.plugins.push(require('./tools/transpiler/karma-traceur-preprocessor'));
};

View File

@ -1,7 +1,5 @@
// Karma configuration
// Generated on Thu Sep 25 2014 11:52:02 GMT-0700 (PDT)
var file2moduleName = require('./tools/build/file2modulename');
module.exports = function(config) {
config.set({
@ -10,59 +8,40 @@ module.exports = function(config) {
files: [
// Sources and specs.
// Loaded through the es6-module-loader, in `test-main.js`.
{pattern: 'modules/**', included: false},
{pattern: 'tools/transpiler/spec/**', included: false},
{pattern: 'dist/js/dev/es5/**', included: false, watched: false},
// zone-microtask must be included first as it contains a Promise monkey patch
'node_modules/zone.js/dist/zone-microtask.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/traceur/bin/traceur-runtime.js',
'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js',
// Including systemjs because it defines `__eval`, which produces correct stack traces.
'node_modules/systemjs/dist/system.src.js',
'node_modules/systemjs/lib/extension-register.js',
'node_modules/zone.js/zone.js',
'node_modules/zone.js/long-stack-trace-zone.js',
'node_modules/systemjs/lib/extension-cjs.js',
'node_modules/rx/dist/rx.js',
'node_modules/reflect-metadata/Reflect.js',
'tools/build/file2modulename.js',
'test-main.js'
'test-main.js',
{pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false},
'modules/angular2/src/test_lib/shims_for_IE.es6'
],
exclude: [
'modules/**/e2e_test/**'
'dist/js/dev/es5/**/e2e_test/**',
],
preprocessors: {
'modules/**/*.js': ['traceur'],
'modules/**/*.es6': ['traceur'],
'tools/transpiler/spec/**/*.js': ['traceur'],
'tools/transpiler/spec/**/*.es6': ['traceur'],
},
traceurPreprocessor: {
options: {
outputLanguage: 'es5',
sourceMaps: true,
script: false,
memberVariables: true,
modules: 'instantiate',
types: true,
typeAssertions: true,
typeAssertionModule: 'rtts_assert/rtts_assert',
annotations: true
},
resolveModuleName: file2moduleName,
transformPath: function(fileName) {
return fileName.replace(/\.es6$/, '.js');
}
},
customLaunchers: {
DartiumWithWebPlatform: {
base: 'Dartium',
flags: ['--enable-experimental-web-platform-features'] }
flags: ['--enable-experimental-web-platform-features'] },
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox'] }
},
browsers: ['ChromeCanary'],
port: 9876
});
config.plugins.push(require('./tools/transpiler/karma-traceur-preprocessor'));
};

View File

@ -1 +0,0 @@
karma-js.conf.js

View File

@ -1,8 +0,0 @@
/**
* Define public API for Angular here.
*/
export * from './change_detection';
export * from './core';
export * from './annotations';
export * from './directives';
export * from './forms';

View File

@ -0,0 +1,9 @@
export * from './change_detection';
export * from './core';
export * from './annotations';
export * from './directives';
export * from './forms';
export * from './di';
export {Observable, EventEmitter} from 'angular2/src/facade/async';
export * from 'angular2/src/render/api';
export {DomRenderer, DOCUMENT_TOKEN} from 'angular2/src/render/dom/dom_renderer';

View File

@ -0,0 +1,3 @@
library angular2.sfx;
// empty as we don't have a version for Dart

View File

@ -0,0 +1,30 @@
import * as ng from './angular2';
// the router should have its own SFX bundle
// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2',
// is not support by system builder.
import * as router from './router';
var angular: AngularOne = <any>ng;
(<AngularWindow>window).angular = angular;
var _prevAngular = (<AngularWindow>window).angular;
angular.router = router;
/**
* Calling noConflict will restore window.angular to its pre-angular loading state
* and return the angular module object.
*/
angular.noConflict = function() {
(<AngularWindow>window).angular = _prevAngular;
return angular;
};
interface AngularOne {
router: any;
noConflict(): any;
}
interface AngularWindow extends Window {
angular: any;
}

View File

@ -1,4 +0,0 @@
/**
* Define public API for Angular here.
*/
export * from './src/core/annotations/annotations';

View File

@ -0,0 +1,14 @@
/**
* @module
* @public
* @description
*
* Annotations provide the additional information that Angular requires in order to run your
* application. This module
* contains {@link Component}, {@link Directive}, and {@link View} annotations, as well as
* {@link Parent} and {@link Ancestor} annotations that are
* used by Angular to resolve dependencies.
*
*/
export * from './src/core/annotations/annotations';
export * from './src/core/annotations/decorators';

View File

@ -1,72 +0,0 @@
export {AST} from './src/change_detection/parser/ast';
export {Lexer} from './src/change_detection/parser/lexer';
export {Parser} from './src/change_detection/parser/parser';
export {Locals}
from './src/change_detection/parser/locals';
export {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError}
from './src/change_detection/exceptions';
export {ChangeRecord, ChangeDispatcher, ChangeDetector,
CHECK_ONCE, CHECK_ALWAYS, DETACHED, CHECKED} from './src/change_detection/interfaces';
export {ProtoChangeDetector, DynamicProtoChangeDetector, JitProtoChangeDetector, BindingRecord}
from './src/change_detection/proto_change_detector';
export {DynamicChangeDetector}
from './src/change_detection/dynamic_change_detector';
export * from './src/change_detection/pipes/pipe_registry';
export {uninitialized} from './src/change_detection/change_detection_util';
export * from './src/change_detection/pipes/pipe';
import {ProtoChangeDetector, DynamicProtoChangeDetector, JitProtoChangeDetector}
from './src/change_detection/proto_change_detector';
import {PipeRegistry} from './src/change_detection/pipes/pipe_registry';
import {ArrayChangesFactory} from './src/change_detection/pipes/array_changes';
import {KeyValueChangesFactory} from './src/change_detection/pipes/keyvalue_changes';
import {NullPipeFactory} from './src/change_detection/pipes/null_pipe';
export class ChangeDetection {
createProtoChangeDetector(name:string):ProtoChangeDetector{
// TODO: this should be abstract, once supported in AtScript
return null;
}
}
export var defaultPipes = {
"iterableDiff" : [
new ArrayChangesFactory(),
new NullPipeFactory()
],
"keyValDiff" : [
new KeyValueChangesFactory(),
new NullPipeFactory()
]
};
export class DynamicChangeDetection extends ChangeDetection {
registry:PipeRegistry;
constructor(registry:PipeRegistry) {
super();
this.registry = registry;
}
createProtoChangeDetector(name:string):ProtoChangeDetector{
return new DynamicProtoChangeDetector(this.registry);
}
}
export class JitChangeDetection extends ChangeDetection {
registry:PipeRegistry;
constructor(registry:PipeRegistry) {
super();
this.registry = registry;
}
createProtoChangeDetector(name:string):ProtoChangeDetector{
return new JitProtoChangeDetector(this.registry);
}
}
var _registry = new PipeRegistry(defaultPipes);
export var dynamicChangeDetection = new DynamicChangeDetection(_registry);
export var jitChangeDetection = new JitChangeDetection(_registry);

View File

@ -0,0 +1,59 @@
/**
* @module
* @public
* @description
* Change detection enables data binding in Angular.
*/
export {
ASTWithSource,
AST,
AstTransformer,
AccessMember,
LiteralArray,
ImplicitReceiver
} from './src/change_detection/parser/ast';
export {Lexer} from './src/change_detection/parser/lexer';
export {Parser} from './src/change_detection/parser/parser';
export {Locals} from './src/change_detection/parser/locals';
export {
ExpressionChangedAfterItHasBeenChecked,
ChangeDetectionError
} from './src/change_detection/exceptions';
export {
ProtoChangeDetector,
ChangeDispatcher,
ChangeDetector,
ChangeDetection,
ChangeDetectorDefinition
} from './src/change_detection/interfaces';
export {
CHECK_ONCE,
CHECK_ALWAYS,
DETACHED,
CHECKED,
ON_PUSH,
DEFAULT
} from './src/change_detection/constants';
export {
DynamicProtoChangeDetector,
JitProtoChangeDetector
} from './src/change_detection/proto_change_detector';
export {BindingRecord} from './src/change_detection/binding_record';
export {DirectiveIndex, DirectiveRecord} from './src/change_detection/directive_record';
export {DynamicChangeDetector} from './src/change_detection/dynamic_change_detector';
export {ChangeDetectorRef} from './src/change_detection/change_detector_ref';
export {PipeRegistry} from './src/change_detection/pipes/pipe_registry';
export {uninitialized} from './src/change_detection/change_detection_util';
export {WrappedValue, Pipe, PipeFactory} from './src/change_detection/pipes/pipe';
export {NullPipe, NullPipeFactory} from './src/change_detection/pipes/null_pipe';
export {
defaultPipes,
DynamicChangeDetection,
JitChangeDetection,
PreGeneratedChangeDetection,
preGeneratedProtoDetectors,
defaultPipeRegistry
} from './src/change_detection/change_detection';

View File

@ -1,13 +0,0 @@
export * from './src/core/annotations/visibility';
export * from './src/core/compiler/interfaces';
export * from './src/core/annotations/template';
export * from './src/core/application';
export * from './src/core/compiler/compiler';
export * from './src/core/compiler/template_loader';
export * from './src/core/compiler/view';
export * from './src/core/compiler/view_container';
export * from './src/core/compiler/binding_propagation_config';
export * from './src/core/dom/element';

22
modules/angular2/core.ts Normal file
View File

@ -0,0 +1,22 @@
/**
* @module
* @public
* @description
* Define angular core API here.
*/
export * from './src/core/annotations/visibility';
export * from './src/core/annotations/view';
export * from './src/core/application';
export * from './src/core/application_tokens';
export * from './src/core/annotations/di';
export * from './src/core/compiler/compiler';
export * from './src/core/compiler/interfaces';
export * from './src/core/compiler/query_list';
export * from './src/core/compiler/directive_resolver';
export * from './src/core/compiler/dynamic_component_loader';
export {ViewRef, ProtoViewRef} from './src/core/compiler/view_ref';
export {ViewContainerRef} from './src/core/compiler/view_container_ref';
export {ElementRef} from './src/core/compiler/element_ref';
export {NgZone} from './src/core/zone/ng_zone';

View File

@ -0,0 +1,2 @@
export * from './src/debug/debug_element';
export {inspectDomElement, ELEMENT_PROBE_CONFIG} from './src/debug/debug_element_view_listener';

View File

@ -1,7 +0,0 @@
export {Inject, InjectPromise, InjectLazy, Injectable, Optional, DependencyAnnotation} from './src/di/annotations';
export {Injector} from './src/di/injector';
export {Binding, Dependency, bind} from './src/di/binding';
export {Key, KeyRegistry} from './src/di/key';
export {KeyMetadataError, NoProviderError, ProviderError, AsyncBindingError, CyclicDependencyError,
InstantiationError, InvalidBindingError, NoAnnotationError} from './src/di/exceptions';
export {OpaqueToken} from './src/di/opaque_token';

23
modules/angular2/di.ts Normal file
View File

@ -0,0 +1,23 @@
/**
* @module
* @public
* @description
* The `di` module provides dependency injection container services.
*/
export * from './src/di/annotations';
export * from './src/di/decorators';
export * from './src/di/forward_ref';
export {resolveBindings, Injector} from './src/di/injector';
export {Binding, BindingBuilder, ResolvedBinding, Dependency, bind} from './src/di/binding';
export {Key, KeyRegistry, TypeLiteral} from './src/di/key';
export {
NoBindingError,
AbstractBindingError,
AsyncBindingError,
CyclicDependencyError,
InstantiationError,
InvalidBindingError,
NoAnnotationError
} from './src/di/exceptions';
export {OpaqueToken} from './src/di/opaque_token';

View File

@ -0,0 +1,6 @@
/**
* @module
* @public
* @description
* Annotations which control how the dependencies are resolved by the {@link Injector}.
*/

View File

@ -0,0 +1,6 @@
/**
* @module
* @public
* @description
* Errors thrown by the {@link Injector}.
*/

View File

@ -1,4 +0,0 @@
export * from './src/directives/foreach';
export * from './src/directives/if';
export * from './src/directives/non_bindable';
export * from './src/directives/switch';

View File

@ -0,0 +1,63 @@
/**
* @module
* @public
* @description
* Common directives shipped with Angular.
*/
import {CONST_EXPR, Type} from './src/facade/lang';
import {NgFor} from './src/directives/ng_for';
import {NgIf} from './src/directives/ng_if';
import {NgNonBindable} from './src/directives/ng_non_bindable';
import {NgSwitch, NgSwitchWhen, NgSwitchDefault} from './src/directives/ng_switch';
export * from './src/directives/class';
export * from './src/directives/ng_for';
export * from './src/directives/ng_if';
export * from './src/directives/ng_non_bindable';
export * from './src/directives/ng_switch';
/**
* A collection of the Angular core directives that are likely to be used in each and every Angular
* application.
*
* This collection can be used to quickly enumerate all the built-in directives in the `@View`
* annotation. For example,
* instead of writing:
*
* ```
* import {If, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/angular2';
* import {OtherDirective} from 'myDirectives';
*
* @Component({
* selector: 'my-component'
* })
* @View({
* templateUrl: 'myComponent.html',
* directives: [If, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, OtherDirective]
* })
* export class MyComponent {
* ...
* }
* ```
* one could enumerate all the core directives at once:
*
* ```
* import {coreDirectives} from 'angular2/angular2';
* import {OtherDirective} from 'myDirectives';
*
* @Component({
* selector: 'my-component'
* })
* @View({
* templateUrl: 'myComponent.html',
* directives: [coreDirectives, OtherDirective]
* })
* export class MyComponent {
* ...
* }
* ```
*
*/
export const coreDirectives: List<Type> =
CONST_EXPR([NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]);

View File

@ -5,7 +5,7 @@ projected to DOM as well as which DOM events should invoke which methods on the
syntax which is core to Angular and allows for data-binding, event-binding, template-instantiation.
The design of the template syntax has these properties:
* All data-binding expressions are easily identifiable. (i.e. there is never an ambiguity whether the value should be
interpreted as string literal or as an expression.)
@ -187,7 +187,7 @@ Example:
<pre>
```
<ul>
<li template="foreach: #item in items">
<li template="for: #item of items">
{{item}}
</li>
</ul>
@ -201,8 +201,8 @@ Example:
<pre>
```
<ul>
<template def-foreach:"item"
bind-foreach-in="items">
<template def-for:"item"
bind-for-in="items">
<li>
{{item}}
</li>
@ -221,8 +221,8 @@ Example:
<pre>
```
<template #foreach="item"
[foreach-in]="items">
<template #for="item"
[for-in]="items">
_some_content_to_repeat_
</template>
```
@ -234,8 +234,8 @@ Example:
Example:
<pre>
```
<template def-foreach="item"
bind-foreach-in="items">
<template def-for="item"
bind-for-in="items">
_some_content_to_repeat_
</template>
```
@ -282,7 +282,7 @@ Key points:
* The binding is to the element property not the element attribute.
* To prevent custom element from accidentally reading the literal `expression` on the title element, the attribute name
is escaped. In our case the `title` is escaped to `[title]` through the addition of square brackets `[]`.
* A binding value (in this case `user.firstName` will always be an expression, never a string literal)
* A binding value (in this case `user.firstName` will always be an expression, never a string literal).
NOTE: Unlike Angular v1, Angular v2 binds to properties of elements rather than attributes of elements. This is
done to better support custom elements, and to allow binding for values other than strings.
@ -372,8 +372,8 @@ Where:
inserted. The template can be defined implicitly with `template` attribute, which turns the current element into
a template, or explicitly with `<template>` element. Explicit declaration is longer, but it allows for having
templates which have more than one root DOM node.
* `viewport` is required for templates. The Viewport directive is responsible for deciding when
and in which order should child views be inserted into this location. An Viewport directive usually has one or
* `viewport` is required for templates. The directive is responsible for deciding when
and in which order should child views be inserted into this location. Such a directive usually has one or
more bindings and can be represented as either `viewport-directive-bindings` or
`viewport-directive-microsyntax` on `template` element or attribute. See template microsyntax for more details.
@ -382,48 +382,46 @@ Example of conditionally included template:
```
Hello {{user}}!
<div template="if: isAdministrator">
<div template="ng-if: isAdministrator">
...administrator menu here...
</div>
```
In the above example the `if` Viewport determines whether the child view (an instance of the child template) should be
inserted into the root view. The `if` makes this decision based on if the `isAdministrator` binding is true.
In the above example the `ng-if` directive determines whether the child view (an instance of the child template) should be
inserted into the root view. The `ng-if` makes this decision based on if the `isAdministrator` binding is true.
The above example is in the short form, for better clarity let's rewrite it in the canonical form, which is functionally
identical.
```
Hello {{user}}!
<template [if]="isAdministrator">
<template [ng-if]="isAdministrator">
<div>
...administrator menu here...
</div>
</template>
```
NOTE: Only Viewport directives can be placed on the template element. (Decorators and Components are not allowed.)
### Template Microsyntax
Often times it is necessary to encode a lot of different bindings into a template to control how the instantiation
of the templates occurs. One such example is `foreach`.
of the templates occurs. One such example is `ng-for`.
```
<form #foo=form>
</form>
<ul>
<template foreach #person [in]="people" #i="index">
<template [ng-for] #person [ng-for-of]="people" #i="index">
<li>{{i}}. {{person}}<li>
</template>
</ul>
```
Where:
* `foreach` triggers the foreach directive.
* `[in]="people"` binds an iterable object to the `foreach` controller.
* `#person` exports the implicit `foreach` item.
* `[ng-for]` triggers the for directive.
* `#person` exports the implicit `ng-for` item.
* `[ng-for-of]="people"` binds an iterable object to the `ng-for` controller.
* `#i=index` exports item index as `i`.
The above example is explicit but quite wordy. For this reason in most situations a short hand version of the
@ -431,7 +429,7 @@ syntax is preferable.
```
<ul>
<li template="foreach; #person; in=people; #i=index;">{{i}}. {{person}}<li>
<li template="ng-for; #person; of=people; #i=index;">{{i}}. {{person}}<li>
</ul>
```
@ -441,19 +439,28 @@ which allows us to further shorten the text.
```
<ul>
<li template="foreach #person in people #i=index">{{i}}. {{person}}<li>
<li template="ng-for #person of people #i=index">{{i}}. {{person}}<li>
</ul>
```
We can also optionally use `var` instead of `#` and add `:` to `foreach` which creates the following recommended
microsyntax for `foreach`.
We can also optionally use `var` instead of `#` and add `:` to `for` which creates the following recommended
microsyntax for `ng-for`.
```
<ul>
<li template="foreach: var person in people; var i=index">{{i}}. {{person}}<li>
<li template="ng-for: var person of people; var i=index">{{i}}. {{person}}<li>
</ul>
```
Finally, we can move the `ng-for` keyword to the left hand side and prefix it with `*` as so:
```
<ul>
<li *ng-for="var person of people; var i=index">{{i}}. {{person}}<li>
</ul>
```
The format is intentionally defined freely, so that developers of directives can build an expressive microsyntax for
their directives. The following code describes a more formal definition.
@ -480,7 +487,7 @@ Where
NOTE: the `template` attribute must be present to make it clear to the user that a sub-template is being created. This
goes along the philosophy that the developer should be able to reason about the template without understanding the
goes along with the philosophy that the developer should be able to reason about the template without understanding the
semantics of the instantiator directive.
@ -503,13 +510,14 @@ Binding events allows wiring events from DOM (or other components) to the Angula
Where:
* `some-element` Any element which can generate DOM events (or has an angular directive which generates the event).
* `some-event` (escaped with `()` or `bind-`) is the name of the event `some-event`. In this case the
* `some-event` (escaped with `()` or `on-`) is the name of the event `some-event`. In this case the
dash-case is converted into camel-case `someEvent`.
* `statement` is a valid statement (as defined in section below).
If the execution of the statement returns `false`, then `preventDefault`is applied on the DOM event.
By default, angular only listens to the element on the event, and ignores events which bubble. To listen to bubbled
events (as in the case of clicking on any child) use the bubble option (`(^event)` or `on-bubble-event`) as shown
bellow.
events (as in the case of clicking on any child) use the bubble option (`(event)` or `on-bubble-event`) as shown
below.
<table>
<tr>
@ -561,7 +569,7 @@ Angular are:
<div title="{{expression}}">{{expression}}</div>
<div [title]="expression">...</div>
<div bind-title="expression">...</div>
<div template="if: expression">...</div>
<div template="ng-if: expression">...</div>
```
Expressions are simplified version of expression in the language in which you are writing your application. (i.e.

View File

@ -6,17 +6,12 @@ Directives are the cornerstone of an Angular application. We use Directives to b
Angular applications do not have a main method. Instead they have a root Component. Dependency Injection then assembles the directives into a working Angular application.
There are three different kinds of directives (described in more detail in later sections).
1. *Decorators*: can be placed on any DOM element and can be combined with other directives.
2. *Components*: Components have an encapsulated view and can configure injectors.
3. *Viewport*: is responsible for adding or removing child views in a parent view. (i.e. foreach, if)
Directives with an encapsulated view and an optional injector are called *Components*.
## CSS Selectors
Decorators are instantiated whenever the decorator CSS selector matches the DOM structure.
Directives are instantiated whenever the CSS selector matches the DOM structure.
Angular supports these CSS selector constructs:
* Element name: `name`
@ -26,15 +21,16 @@ Angular supports these CSS selector constructs:
* Class: `.class`
* AND operation: `name[attribute]`
* OR operation: `name,.class`
* NOT operation: `:not(.class)`
Angular does not support these (and any CSS selector which crosses element boundaries):
* Descendant: `body div`
* Direct descendant: `body > div`
* Direct descendant: `body > div`
* Adjacent: `div + table`
* Sibling: `div ~ table`
* Wildcard: `*`
* ID: `#id`
* Pseudo selectors: `:pseudo`
* Pseudo selectors: `:pseudo` other than `:not`
@ -50,36 +46,36 @@ These CSS selectors will match:
CSS Selectors can be combined:
* `input[type=text]`: Triggers on element name `input` which is of `type` `text`.
* `input[type=text], textarea`: triggers on element name `input` which is of `type` `text` or element name `textarea`
* `input[type=text], textarea`: triggers on element name `input` which is of `type` `text` or element name `textarea`.
## Decorators
## Directives
The simplest kind of directive is a decorator. Directives are usefull for encapsulating behavior.
* Multiple decorators can be placed on a single element.
* Decorators do not introduce new evaluation context.
* Decorators are registered through the `@Decorator` meta-data annotation.
* Directives do not introduce new evaluation context.
* Directives are registered through the `@Directive` meta-data annotation.
Here is a trivial example of a tooltip decorator. The directive will log a tooltip into the console on every time mouse enters a region:
```
@Decorator({
selector: '[tooltip]', // CSS Selector which triggers the decorator
bind: { // List which properties need to be bound
text: 'tooltip' // - DOM element tooltip property should be
}, // mapped to the directive text property.
event: { // List which events need to be mapped.
mouseover: 'show' // - Invoke the show() method every time
} // the mouseover event is fired.
})
class Form { // Directive controller class, instantiated
// when CSS matches.
text:string; // text property on the Decorator Controller.
show(event) { // Show method which implements the show action.
console.log(this.text);
@Directive({
selector: '[tooltip]', | CSS Selector which triggers the decorator
properties: [ | List which properties need to be bound
'text: tooltip' | - DOM element tooltip property should be
], | mapped to the directive text property.
hostListeners: { | List which events need to be mapped.
mouseover: 'show' | - Invoke the show() method every time
} | the mouseover event is fired.
}) |
class Form { | Directive controller class, instantiated
| when CSS matches.
text:string; | text property on the Directive Controller.
|
show(event) { | Show method which implements the show action.
console.log(this.text); |
}
}
```
@ -112,23 +108,23 @@ Example of a component:
```
@Component({ | Component annotation
selector: 'pane', | CSS selector on <pane> element
bind: { | List which property need to be bound
'title': 'title', | - title mapped to component title
'open': 'open' | - open attribute mapped to component's open property
}, |
properties: [ | List which property need to be bound
'title', | - title mapped to component title
'open' | - open attribute mapped to component's open property
], |
}) |
@Template({ | Template annotation
url: 'pane.html' | - URL of template HTML
@View({ | View annotation
templateUrl: 'pane.html' | - URL of template HTML
}) |
class Pane { | Component controller class
title:string; | - title property
title:string; | - title property
open:boolean;
constructor() {
this.title = '';
this.open = true;
}
// Public API
toggle() => this.open = !this.open;
open() => this.open = true;
@ -140,7 +136,7 @@ class Pane { | Component controller class
```
<div class="outer">
<h1>{{title}}</h1>
<div class="inner" [hidden]="!visible">
<div class="inner" [hidden]="!open">
<content></content>
</div>
</div>
@ -163,39 +159,39 @@ Example of usage:
## Viewport
## Directives that use a ViewContainer
Viewport is a directive which can control instantiation of child views which are then inserted into the DOM. (Examples are `if` and `foreach`.)
Directives that use a ViewContainer can control instantiation of child views which are then inserted into the DOM. (Examples are `ng-if` and `ng-for`.)
* Viewports can only be placed on `<template>` elements (or the short hand version which uses `<element template>` attribute.)
* Only one viewport can be present per DOM template element.
* The viewport is created over the `template` element. This is known as the `ViewContainer`.
* Viewport can insert child views into the `ViewContainer`. The child views show up as siblings of the `Viewport` in the DOM.
* Every `template` element creates a `ProtoView` which can be used to create Views via the ViewContainer.
* The child views show up as siblings of the directive in the DOM.
>> TODO(misko): Relationship with Injection
>> TODO(misko): Instantiator can not be injected into child Views
```
@Viewport({
@Directive({
selector: '[if]',
bind: {
'condition': 'if'
}
properties: [
'condition: if'
]
})
export class If {
viewContainer: ViewContainer;
viewContainer: ViewContainerRef;
protoViewRef: ProtoViewRef;
view: View;
constructor(viewContainer: ViewContainer) {
constructor(viewContainer: ViewContainerRef, protoViewRef: ProtoViewRef) {
this.viewContainer = viewContainer;
this.protoViewRef = protoViewRef;
this.view = null;
}
set condition(value) {
if (value) {
if (this.view === null) {
this.view = this.viewContainer.create();
this.view = this.viewContainer.create(protoViewRef);
}
} else {
if (this.view !== null) {
@ -213,37 +209,37 @@ Dependency Injection (DI) is a key aspect of directives. DI allows directives to
When Angular directives are instantiated, the directive can ask for other related directives to be injected into it. By assembling the directives in different order and subtypes the application behavior can be controlled. A good mental model is that the DOM structure controls the directive instantiation graph.
Directive instantiation is triggered by the directive CSS selector matching the DOM structure. The directive in its constructor can ask for other directives or application services. When asking for directives the dependency is locating by following the DOM hierarchy and if not found using the application level injector.
Directive instantiation is triggered by the directive CSS selector matching the DOM structure. In a directive's constructor, it can ask for other directives or application services. When asking for directives, the dependency is attempted to be located by its DOM hierarchy first, then if not found, by using the application level injector.
To better understand the kinds of injections which are supported in Angular we have broken them down into use case examples.
### Injecting Services
Service injection is the most straight forward kind of injection which Angular supports. It involves a component configuring the `services` and then letting the directive ask for the configured service.
Service injection is the most straight forward kind of injection which Angular supports. It involves a component configuring the `appInjector` and then letting the directive ask for the configured service.
This example illustrates how to inject `MyService` into `House` directive.
```
class MyService {} | Assume a service which needs to be injected
class MyService {} | Assume a service which needs to be injected
| into a directive.
|
@Component({ | Assume a top level application component which
@Component({ | Assume a top level application component which
selector: 'my-app', | configures the services to be injected.
services: [MyService] |
appInjector: [MyService] |
}) |
@Template({ | Assume we have a template that needs to be
url: 'my_app.html', | configured with directives to be injected.
directives: [House] |
@View({ | Assume we have a template that needs to be
templateUrl: 'my_app.html', | configured with directives to be injected.
directives: [House] |
}) |
class MyApp {} |
|
@Decorator({ | This is the directive into which we would like
@Directive({ | This is the directive into which we would like
selector: '[house]' | to inject the MyService.
}) |
class House { |
constructor(myService:MyService) { | Notice that in the constructor we can simply
constructor(myService:MyService) { | Notice that in the constructor we can simply
} | ask for MyService.
} |
@ -252,7 +248,7 @@ class House { |
Assume the following DOM structure for `my_app.html`:
```
<div house> | The house attribute triggers the creation of the House directive.
<div house> | The house attribute triggers the creation of the House directive.
</div> | This is equivalent to:
| new House(injector.get(MyService));
```
@ -260,58 +256,58 @@ Assume the following DOM structure for `my_app.html`:
### Injecting other Directives
Injecting other directives into directives follows a similar mechanism as injecting services, but with added constraint of visibility governed by DOM structure.
Injecting other directives into directives follows a similar mechanism as injecting services into directives, but with added constraint of visibility governed by DOM structure.
There are five kinds of visibilities:
* (no annotation): Inject dependant directives only if they are on the current element.
* (no annotation): Inject dependant directives only if they are on the current element.
* `@ancestor`: Inject a directive if it is at any element above the current element.
* `@parent`: Inject a directive which is direct parent of the current element.
* `@parent`: Inject a directive which is a direct parent of the current element.
* `@child`: Inject a list of direct children which match a given type. (Used with `Query`)
* `@descendant`: Inject a list of any children which match a given type. (Used with `Query`)
NOTE: if the injection constraint can not be satisfied by the current visibility constraint, then it is forward to the normal injector which may provide a default value for the directive or it may throw an error.
NOTE: if the injection constraint can not be satisfied by the current visibility constraint, then it is forwarded to the normal injector which either provides a default value for the directive or throws an error.
Here is an example of the kinds of injections which can be achieved:
```
@Component({ |
selector: 'my-app', |
template: new TemplateConfig({ |
url: 'my_app.html', |
directives: [Form, FieldSet, |
Field, Primary] |
}) |
selector: 'my-app' |
}) |
@View({ |
templateUrl: 'my_app.html', |
directives: [Form, FieldSet, |
Field, Primary] |
}) |
class MyApp {} |
|
@Decorator({ selector: 'form' }) |
@Directive({ selector: 'form' }) |
class Form { |
constructor( |
@descendant sets:Query<FieldSet> |
) { |
} |
) { |
} |
} |
|
@Decorator({ selector: 'fieldset' }) |
@Directive({ selector: 'fieldset' }) |
class FieldSet { |
constructor( |
@child sets:Query<Field> |
) { ... } |
) { ... } |
} |
|
@Decorator({ selector: 'field' }) |
@Directive({ selector: 'field' }) |
class Field { |
constructor( |
@ancestor field:Form, |
@parent field:FieldSet, |
) { ... } |
) { ... } |
} |
|
@Decorator({ selector: '[primary]'}) |
@Directive({ selector: '[primary]'}) |
class Primary { |
constructor(field:Field ) { ... } |
constructor(field:Field ) { ... } |
} |
```
@ -322,17 +318,74 @@ Assume the following DOM structure for `my_app.html`:
<fieldset> |
<field primary></field> |
<field></field> |
</div> |
</fieldset> |
</form> |
</fieldset> |
</div> |
</form> |
```
#### Shadow DOM effects on Directive DI
### Shadow DOM effects on Dependency Injection
Shadow DOM provides an encapsulation for components, so as a general rule it does not allow directive injections to cross the shadow DOM boundaries. To remedy this, declaritively specify the required component as an injectable.
Shadow DOM provides an encapsulation for components, so as a general rule it does not allow directive injections to cross the shadow DOM boundaries.
```
@Component({
selector: '[kid]',
appInjector: []
})
@View({
templateUrl: 'kid.html',
directives: []
})
class Kid {
constructor(
@Parent() dad:Dad,
@Optional() grandpa:Grandpa
) {
this.name = 'Billy';
this.dad = dad.name;
this.grandpa = grandpa.name;
}
}
@Component({
selector: '[dad]',
appInjector: [Grandpa]
})
@View({
templateUrl: 'dad.html',
directives: [Kid]
})
class Dad {
constructor(@Parent() dad:Grandpa) {
this.name = 'Joe Jr';
this.dad = dad.name;
}
}
@Component({
selector: '[grandpa]',
appInjector: []
})
@View({
templateUrl: 'grandpa.html',
directives: [Dad]
})
class Grandpa {
constructor() {
this.name = 'Joe';
}
}
```
Assume the following DOM structure for `grandpa.html`: The Dad has access to the Grandpa.
```
Name: {{name}}: <br> Children: <div dad></div>
```
Assume the following DOM structure for `dad.html`: Here the rendered Kid will also have access to Grandpa.
```
Name: {{name}}: <br> Dad: {{dad}} <br> Children: <div kid></div>
```
## Further Reading

View File

@ -1,15 +0,0 @@
# Formatters
Formatters can be appended on the end of the expressions to translate the value to a different format. Typically used
to control the stringification of numbers, dates, and other data, but can also be used for ordering, mapping, and
reducing arrays. Formatters can be chained.
NOTE: Formatters are known as filters in Angular v1.
Formatters syntax is:
```
// TODO: provide syntax of formatter here
```

View File

@ -0,0 +1,27 @@
# Pipes
Pipes can be appended on the end of the expressions to translate the value to a different format. Typically used
to control the stringification of numbers, dates, and other data, but can also be used for ordering, mapping, and
reducing arrays. Pipes can be chained.
NOTE: Pipes are known as filters in Angular v1.
Pipes syntax is:
```
<div class="movie-copy">
<p>
{{ model.getValue('copy') | async | uppercase }}
</p>
<ul>
<li>
<b>Starring</b>: {{ model.getValue('starring') | async }}
</li>
<li>
<b>Genres</b>: {{ model.getValue('genres') | async }}
</li>
<ul>
</div>
```

View File

@ -2,24 +2,24 @@
## Overview
This document explains the concept of a View.
A View is a core primitive used by angular to render the DOM tree.
A ViewPort is location in a View which can accept child Views.
Every ViewPort has an associated ViewContainer than can contain any number of child Views.
This document explains the concept of a View.
A View is a core primitive used by angular to render the DOM tree.
A ViewContainer is location in a View which can accept child Views.
Every ViewContainer has an associated ViewContainerRef than can contain any number of child Views.
Views form a tree structure which mimics the DOM tree.
* View is a core rendering construct. A running application is just a collection of Views which are
nested in a tree like structure. The View tree is a simplified version of the DOM tree. A View can
have a single DOM Element or large DOM structures. The key is that the DOM tree in the View can
* View is a core rendering construct. A running application is just a collection of Views which are
nested in a tree like structure. The View tree is a simplified version of the DOM tree. A View can
have a single DOM Element or large DOM structures. The key is that the DOM tree in the View can
not undergo structural changes (only property changes).
* Views represent a running instance of a DOM Template. This implies that while elements in a View
can change properties, they can not change structurally. (Structural changes such as, adding or
* Views represent a running instance of a DOM View. This implies that while elements in a View
can change properties, they can not change structurally. (Structural changes such as, adding or
removing elements requires adding or removing child Views into ViewContainers).
* View can have zero or more ViewPorts. A ViewPort is a marker in the DOM which allows
* View can have zero or more ViewContainers. A ViewContainer is a marker in the DOM which allows
the insertion of child Views.
* Views are created from a ProtoView. A ProtoView is a compiled DOM Template which is efficient at
* Views are created from a ProtoView. A ProtoView is a compiled DOM View which is efficient at
creating Views.
* View contains a context object. The context represents the object instance against which all
* View contains a context object. The context represents the object instance against which all
expressions are evaluated.
* View contains a ChangeDetector for looking for detecting changes to the model.
* View contains ElementInjector for creating Directives.
@ -40,7 +40,7 @@ class Greeter {
}
```
And assume following HTML Template:
And assume following HTML View:
```
<div>
@ -51,9 +51,9 @@ And assume following HTML Template:
</div>
```
The above template is compiled by the Compiler to create a ProtoView. The ProtoView is then used to
create an instance of the View. The instantiation process involves cloning the above template and
locating all of the elements which contain bindings and finally instantiating the Directives
The above template is compiled by the Compiler to create a ProtoView. The ProtoView is then used to
create an instance of the View. The instantiation process involves cloning the above template and
locating all of the elements which contain bindings and finally instantiating the Directives
associated with the template. (See compilation for more details.)
```
@ -81,20 +81,20 @@ Note:
* View knows which expressions need to be watched.
* View knows what needs to be updated if the watched expression changes.
* All DOM elements are owned by single instance of the view.
* The structure of the DOM can not change during runtime. To allow structural changes to the DOM we need
* The structure of the DOM can not change during runtime. To allow structural changes to the DOM we need
to understand Composed View.
## Composed View
An important part of an application is to be able to change the DOM structure to render data for the
user. In Angular this is done by inserting child views into the ViewPort.
An important part of an application is to be able to change the DOM structure to render data for the
user. In Angular this is done by inserting child views into the ViewContainer.
Let's start with a Template such as:
Let's start with a View such as:
```
<ul>
<li template="foreach: person in people">{{person}}</li>
<li template="ng-for: #person of people">{{person}}</li>
</ul>
```
@ -108,7 +108,7 @@ and
```
<ul> | protoViewA(someContext)
<template></template> | protoViewA(someContext): new ProtoViewPort(protoViewB)
<template></template> | protoViewA(someContext): protoViewB
</ul> | protoViewA(someContext)
```
@ -119,49 +119,49 @@ The next step is to compose these two ProtoViews into an actual view which is re
```
<ul> | viewA(someContext)
<template></template> | viewA(someContext): new Foreach(new ViewPort(protoViewB))
<template></template> | viewA(someContext): new NgFor(new ViewContainer(protoViewB))
</ul> | viewA(someContext)
```
*Step2:* Instantiate `Foreach` directive which will receive the `ViewContainer`. (The ViewContainer
*Step2:* Instantiate `NgFor` directive which will receive the `ViewContainerRef`. (The ViewContainerRef
has a reference to `protoViewA`).
*Step3:* As the `Foreach` directive unrolls it asks the `ViewContainer` to instantiate `protoViewB` and insert
it after the `ViewPort` anchor. This is repeated for each `person` in `people`. Notice that
*Step3:* As the `NgFor` directive unrolls it asks the `ViewContainerRef` to instantiate `protoViewB` and insert
it after the `ViewContainer` anchor. This is repeated for each `person` in `people`. Notice that
```
<ul> | viewA(someContext)
<template></template> | viewA(someContext): new Foreach(new ViewPort(protoViewB))
<template></template> | viewA(someContext): new NgFor(new ViewContainer(protoViewB))
<li>{{person}}</li> | viewB0(locals0(someContext))
<li>{{person}}</li> | viewB1(locals0(someContext))
</ul> | viewA(someContext)
```
*Step4:* All of the bindings in the child Views are updated. Notice that in the case of `Foreach`
the evaluation context for the `viewB0` and `viewB1` are `locals0` and `locals1` respectively.
Locals allow the introduction of new local variables visible only within the scope of the View, and
*Step4:* All of the bindings in the child Views are updated. Notice that in the case of `NgFor`
the evaluation context for the `viewB0` and `viewB1` are `locals0` and `locals1` respectively.
Locals allow the introduction of new local variables visible only within the scope of the View, and
delegate any unknown references to the parent context.
```
<ul> | viewA
<template></template> | viewA: new Foreach(new ViewPort(protoViewB))
<template></template> | viewA: new NgFor(new ViewContainer(protoViewB))
<li>Alice</li> | viewB0
<li>Bob</li> | viewB1
</ul> | viewA
```
Each View can have zero or more ViewPorts. By inserting and removing child Views to and from the
ViewContainers, the application can mutate the DOM structure to any desirable state. A View may contain
individual nodes or a complex DOM structure. The insertion points for the child Views, known as
ViewContainers, contain a DOM element which acts as an anchor. The anchor is either a `template` or
a `script` element depending on your browser. It is used to identify where the child Views will be
Each View can have zero or more ViewContainers. By inserting and removing child Views to and from the
ViewContainers, the application can mutate the DOM structure to any desirable state. A View may contain
individual nodes or a complex DOM structure. The insertion points for the child Views, known as
ViewContainers, contain a DOM element which acts as an anchor. The anchor is either a `template` or
a `script` element depending on your browser. It is used to identify where the child Views will be
inserted.
## Component Views
A View can also contain Components. Components contain Shadow DOM for encapsulating their internal
rendering state. Unlike ViewPorts which can contain zero or more Views, the Component always contains
A View can also contain Components. Components contain Shadow DOM for encapsulating their internal
rendering state. Unlike ViewContainers which can contain zero or more Views, the Component always contains
exactly one Shadow View.
```
@ -194,7 +194,7 @@ class Greeter {
}
```
And assume the following HTML Template:
And assume the following HTML View:
```
<div> | viewA(greeter)
@ -205,7 +205,7 @@ And assume the following HTML Template:
</div> | viewA(greeter)
```
The above UI is built using a single View, and hence a single context `greeter`. It can be expressed
The above UI is built using a single View, and hence a single context `greeter`. It can be expressed
in this pseudo-code.
```
@ -215,15 +215,15 @@ var greeter = new Greeter();
The View contains two bindings:
1. `greeting`: This is bound to the `greeting` property on the `Greeter` instance.
2. `name.value`: This poses a problem. There is no `name` property on the `Greeter` instance. To solve
2. `name.value`: This poses a problem. There is no `name` property on the `Greeter` instance. To solve
this we wrap the `Greeter` instance in the `Local` instance like so:
```
var greeter = new Locals(new Greeter(), {name: ref_to_input_element })
```
By wrapping the `Greeter` instance into the `Locals` we allow the view to introduce variables which
are in addition to the `Greeter` instance. During the resolution of the expressions we first check
By wrapping the `Greeter` instance into the `Locals` we allow the view to introduce variables which
are in addition to the `Greeter` instance. During the resolution of the expressions we first check
the locals, and then the `Greeter` instance.
@ -233,14 +233,14 @@ the locals, and then the `Greeter` instance.
Views transition through a particular set of states:
1. View is created from the ProtoView.
2. View can be attached to an existing ViewContainer.
3. Upon attaching View to the ViewContainer the View needs to be hydrated. The hydration process
2. View can be attached to an existing ViewContainerRef.
3. Upon attaching View to the ViewContainerRef the View needs to be hydrated. The hydration process
involves instantiating all of the Directives associated with the current View.
4. At this point the view is ready and renderable. Multiple changes can be delivered to the
4. At this point the view is ready and renderable. Multiple changes can be delivered to the
Directives from the ChangeDetection.
5. At some point the View can be removed. At this point all of the directives are destroyed during
5. At some point the View can be removed. At this point all of the directives are destroyed during
the dehydration process and the view becomes inactive.
6. The View has to wait until it is detached from the DOM. The delay in detaching could be caused
6. The View has to wait until it is detached from the DOM. The delay in detaching could be caused
because an animation is animating the view away.
7. After the View is detached from the DOM it is ready to be reused. The view reuse allows the
7. After the View is detached from the DOM it is ready to be reused. The view reuse allows the
application to be faster in subsequent renderings.

Some files were not shown because too many files have changed in this diff Show More