Commit Graph

128 Commits

Author SHA1 Message Date
vsavkin 5e6317fecc feat(change_detection): request a change detection check when an event happens
Closes #3679
2015-08-17 19:08:03 +00:00
vsavkin 823fa4689e refactor(change_detection): generate handleEvent only when necessary 2015-08-17 19:08:03 +00:00
vsavkin 4845583dcf refactor(change_detector): made change detection responsible for processing events
Closes #3666
2015-08-17 15:39:00 +00:00
Misko Hevery b7837389d7 refactor: Remove isDart from public API
BREAKING CHANGE:

- `IS_DARTIUM` no longer exported
2015-08-13 21:18:31 +00:00
vsavkin 839edaa15b feat(pipes): changed PipeTransform to make onDestroy optional
BREAKING CHANGE:

Before:
  Angular called onDestroy on all pipes.

After:
  Angular calls onDestroy only on pipes that have the onDestroy method.
2015-08-13 01:39:21 +00:00
vsavkin 5b5d31fa9a feat(pipe): added the Pipe decorator and the pipe property to View
BREAKING CHANGE:
    Instead of configuring pipes via a Pipes object, now you can configure them by providing the pipes property to the View decorator.

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

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

Closes #3572
2015-08-12 00:38:40 +00:00
vsavkin 2dcf714d2b refactor(pipes): use Injector instead of pipe factories for pipe instantiation
BREAKING CHANGE
    - Pipe factories have been removed.
    - PIpe names to pipe implementations are 1-to-1  instead of 1-to-*

 Before:
     class DateFormatter {
         transform(date, args){}
     }

     class DateFormatterFactory {
       supporst(obj) { return true; }
       create(cdRef) { return new DateFormatter(); }
     }
     new Pipes({date: [new DateFormatterFactory()]})

After
    class DateFormatter {
      transform(date, args){}
    }
    new Pipes({date: DateFormatter})
2015-08-07 10:02:11 -07:00
vsavkin 106a28b8dc feat(refactor): replaced ObservablePipe and PromisePipe with AsyncPipe 2015-08-07 02:10:32 +00:00
Alex Eagle b4a062983b fix(dart): @proxy is a value, not a factory
Previously I added parens everywhere to make this @proxy() because our typing indicated
it was a function that returned a decorator, but this breaks dart. Instead, the typing needs
to be changed.

Fixes #3494
2015-08-06 10:02:49 -07:00
vsavkin 392de4af67 feat(pipes): replaces iterable and key value diffing pipes with services
BREAKING CHANGE:
    Directives that previously injected Pipes to get iterableDiff or keyvalueDiff, now should inject IterableDiffers and KeyValueDiffers.
2015-08-04 10:39:55 -07:00
Pawel Kozlowski 4422819754 fix(parser): detect empty expression in strings to interpolate
Fixes #3412

Closes #3451
2015-08-04 08:44:14 +02:00
Alex Eagle 3c58878b19 chore(build): Upgrade to TypeScript@1.5.3
This change also makes us compliant with 1.6.0-dev compiler,
so we can do some experiments with apps that use 1.6 features
and compile against Angular.

We should probably add a travis build for 1.6 so we stay compatible
with both versions.
2015-07-31 20:01:27 +00:00
vsavkin c1ee943533 perf(change_detection): do not check intermediate results 2015-07-29 21:58:29 +00:00
vsavkin 8543c347a8 feat(core): provide an error context when an exception happens in an error handler 2015-07-28 14:22:15 -07:00
vsavkin 71bb4b3ee5 feat(change_detection): generate checkNoChanges only in dev mode 2015-07-27 15:50:19 -07:00
Misko Hevery c83a3f3372 chore(docs): added more docs for core.ts 2015-07-25 03:20:12 +00:00
vsavkin c2bbda02a1 feat(change_detection): provide error context for change detection errors 2015-07-24 15:45:26 -07:00
vsavkin e744409cb9 feat(exception_handler): print originalException and originalStack for all exceptions 2015-07-24 15:45:26 -07:00
Pawel Kozlowski 0a8b3816f7 style(lexer): idiomatic TypeScript
Closes #3228
2015-07-24 15:40:32 -07:00
Pawel Kozlowski 345fa521dd fix(change_detection): convert interpolated null values to empty strings
Fixes #3007

Closes #3271
2015-07-24 18:05:06 +02:00
Alex Eagle de18da2a0d feat(build): require parameter types
Fixes #2833
2015-07-21 06:20:13 -07:00
vsavkin 4c8ea12903 feat(pipes): changed .append to .extend
BREAKING CHANGE:
    Pipes.append has been renamed into Pipes.extend.
    Pipes.extend prepends pipe factories instead of appending them.
2015-07-20 15:36:42 -07:00
Tim Blasi f1e8176995 fix(change_detect): Handle '$' in change detector strings
In Dart, '$' indicates the beginning of an interpolation.
- Escapes '$' in strings when generating change detector classes.
- Adds a unit test to cover this case.
2015-07-16 13:01:53 -07:00
Martin Probst 3bf8c18c56 chore: run clang-format on code base.
This fixes several minor indentation issues (instanceof precendence,
type declaration specificity, template string length calculation).

This should also fix some flip-flop situations with template strings.
2015-07-12 18:50:52 +02:00
Jeff Cross 1eebceab27 feat(pipes): add static append method to Pipes
This change allows creation of a new Pipes binding with new pipes appended
to pipes of an inherited Pipes instance.

Closes #2901
2015-07-10 15:42:57 -07:00
Jeff Cross 9a70f84e60 refactor(pipes): rename PipeRegistry to Pipes
BREAKING CHANGE:
    This change renames all instances of PipeRegistry to Pipes.
    As part of this change, the former "defaultPipes" export is
    now a Pipes instance, instead of a map. The map that was previously
    called "defaultPipes" no longer exists, but may be accessed via
    defaultPipes.config.
2015-07-10 15:42:56 -07:00
Jeff Cross 8b3efdf229 chore(pipes): rename pipe_registry.ts -> pipes.ts
This is its own commit so that tools have an easier time of preserving
history of the file, by keeping the diff between pipes.ts and
pipe_registry.ts minimal.

Also moved pipe_registry_spec.ts
2015-07-10 15:42:56 -07:00
Pouria Alimirzaei b716046b97 feat(pipes): add date pipe
Closes #2877
2015-07-09 15:00:14 -07:00
Pouria Alimirzaei 3143d188ae feat(pipes): add number (decimal, percent, currency) pipes 2015-07-09 14:59:57 -07:00
Victor Berchet 447926dc08 refactor(RegExp): use /.../ to create RegExp literal
fixes #2691
2015-07-09 09:14:25 +02:00
vsavkin 4656c6f5cf tools: added experimentalDecorators flag to tsconfig 2015-07-08 10:46:03 -07:00
vsavkin c2efa23e94 fix(change_detection): throw ChangeDetectionError in JIT mode 2015-07-06 18:03:50 -07:00
vsavkin d2774421e8 fix(change_detection): do not coalesce records with different directive indices 2015-07-06 17:59:38 -07:00
Pouria Alimirzaei 0b50258814 feat(pipes): add limitTo pipe 2015-07-01 13:36:01 -07:00
Pouria Alimirzaei 600d53c68e feat(pipes): support arguments in transform function 2015-07-01 13:36:01 -07:00
Jacob MacDonald 73a939e76c fix(change detectors): Fix deduping of protos in transformed dart mode.
In non-transformed mode the funcOrValue check was enough, but once
transformed these all use the same function for getters, so we need
to also check the name.
2015-07-01 12:56:31 -07:00
Tobias Bosch 0a51ccbd68 feat(render): don’t use the reflector for setting properties
BREAKING CHANGES:
- host actions don't take an expression as value any more but only a method name,
  and assumes to get an array via the EventEmitter with the method arguments.
- Renderer.setElementProperty does not take `style.`/... prefixes any more.
  Use the new methods `Renderer.setElementAttribute`, ... instead

Part of #2476
Closes #2637
2015-06-22 18:35:16 -07:00
vsavkin 92ffc465d6 feat(host): limits host properties to renames 2015-06-22 12:10:02 -07:00
vsavkin 20a8f0dbe5 refactor(pipes): removed pipes from properties
BREAKING CHANGE:

This PR remove an ability to use pipes in the properties config. Instead, inject the pipe registry.
2015-06-19 16:56:52 -07:00
Martin Probst 920982c4e8 chore: update files to match clang-format 1.0.21. 2015-06-19 15:00:32 -07:00
vsavkin f80f97253c refactor(change_detection): made ChangeDetector and ProtoChangeDetector interfaces
List of changes:

- Makes ChangeDetector and ProtoChangeDetector interfaces
- Assigns a unique id to every detector
2015-06-18 17:41:22 -07:00
Martin Probst 941362014b feat: remove MapWrapper.clear().
It's the same in Dart and JavaScript.
2015-06-18 14:55:13 -07:00
Martin Probst be7ac9fd41 feat: remove MapWrapper.create()/get()/set().
Better dart2js code, better Angular code.
2015-06-18 14:55:12 -07:00
Yegor Jbanov 5beaf6d735 fix(change detection): preserve memoized results from pure functions 2015-06-17 17:33:37 -07:00
Martin Probst c7e48350d3 chore: kill ListWrapper.create() and .push().
These wrappers are not natively understood by
ts2dart. Removing them will improve Dart2JS
compilation due to fewer megamorphic calls to List
functions.

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

This change exposed several bugs in Angular.
2015-06-17 16:21:55 -07:00
Victor Berchet cdfb635737 refactor(facade): refactor type check function - is*() 2015-06-16 19:27:34 +02:00
vsavkin 5bfcca2d5b feat(query): notify on changes 2015-06-15 11:10:21 -07:00
Victor Berchet 7d32879929 feat(Parser): support if statements in actions
fixes #2022
2015-06-15 18:54:12 +02:00
Tim Blasi 8e3bf3907a feat(dart/transform): Use the best available Change Detectors
Enable pregenerated (for Dart) and JIT (for Js) change detectors when
possible. Previously we would always use `DynamicChangeDetector`s, but
these cause megamorphic calls and are therefore much slower.

Closes #502
2015-06-12 16:04:09 -07:00
Martin Probst f3d741854a fix: add types for ts2dart's façade handling.
... in many, many places.
2015-06-12 15:41:08 -07:00