Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

feat(relative uris): Allow relative URIs for templateUrls and cssUrls #1238

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
354b5c5
chore(test-bed): add fromInjector constructor to TestBed
rkirov Jul 28, 2014
052b3cf
chore(intl): support newer version of "intl"
alan-knight Jul 2, 2014
3817b6e
fix(benchmark): Remove obsolete DI call
jbdeboer Jul 29, 2014
40e2d9b
refactor(element_binder): Remove bindAttrName
jbdeboer Jul 29, 2014
e3f17f5
chore(examples): Add a PolymerJS paper component using attribute mapp…
jbdeboer Jul 25, 2014
bbb2244
feat(element binder): Bind to Web Component properties
jbdeboer Jul 25, 2014
3948fd6
chore(example): Add paper-checkbox to the paper demo
jbdeboer Jul 30, 2014
ce1aae3
chore(karma): Restrict the numbers of files watched for faster startup
jbdeboer Jul 30, 2014
0f1226e
chore(example): In the Paper example, make the checkbox less confusing
jbdeboer Jul 30, 2014
3468273
perf(dccd): Drop useless checks
vicb Jul 23, 2014
9aba6fb
refactor(dccd): Drop the insertBefore arg from DuplicateMap.put()
vicb Jun 9, 2014
dc2c480
refactor: code cleanup
vicb Jul 31, 2014
781b277
feat(element binder): Two way binding for Web Components
jbdeboer Jul 30, 2014
307c537
chore(presubmit): Do not use the g3v1x task for presubmit
jbdeboer Jul 31, 2014
45144a1
chore(release): v0.13.0
vsavkin Jul 25, 2014
9ae97d3
fix(web components): Support Polymer quirks
jbdeboer Jul 31, 2014
4c85430
doc(change): Add the "Highlights" section to the latest releases
vicb Aug 1, 2014
a46a51e
chore(scripts): fail on pipe failures
chirayuk Jul 31, 2014
4553d4b
doc(WebPlatform): improve the inline doc
vicb Aug 2, 2014
37ceace
refactor(WebPlatform): remove an unused property
vicb Aug 3, 2014
d88eecb
chore: update pubspec.lock
matsko Aug 5, 2014
a4ff2d1
Revert "chore: update pubspec.lock"
chirayuk Aug 5, 2014
53dbb58
feat(urls): support relative CSS / template URLs in components
Jul 16, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ node_js:
- '0.11'
env:
matrix:
- JOB=unit-stable
CHANNEL=stable
TESTS=vm
BROWSERS=DartiumWithWebPlatform
- JOB=unit-g3stable
CHANNEL=stable
TESTS=vm
BROWSERS=DartiumWithWebPlatform
USE_G3=YES
- JOB=unit-stable
CHANNEL=stable
TESTS=vm
BROWSERS=DartiumWithWebPlatform
- JOB=unit-dev
CHANNEL=dev
TESTS=vm
Expand Down
329 changes: 328 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion benchmark/web/tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class NgFreeTreeClass implements ShadowRootAware {

// Main function runs the benchmark.
main() {
setupModuleTypeReflector();
var cleanup, createDom;

var module = new Module()
Expand Down
24 changes: 24 additions & 0 deletions example/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "paper-example",
"version": "0.0.1",
"homepage": "https://github.com/angular/angular.dart",
"authors": [
"James deBoer <[email protected]>"
],
"description": "Paper with AngularDart",
"main": "web/index.html",
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.3.4",
"paper-elements": "Polymer/paper-elements#~0.3.4",
"core-elements": "Polymer/core-elements#~0.3.4"
}
}
16 changes: 12 additions & 4 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ packages:
analyzer:
description: analyzer
source: hosted
version: "0.13.6"
version: "0.18.0"
angular:
description:
path: ".."
Expand All @@ -26,23 +26,23 @@ packages:
code_transformers:
description: code_transformers
source: hosted
version: "0.1.3"
version: "0.1.6"
collection:
description: collection
source: hosted
version: "0.9.2"
di:
description: di
source: hosted
version: "1.1.0"
version: "2.0.1"
html5lib:
description: html5lib
source: hosted
version: "0.10.0"
intl:
description: intl
source: hosted
version: "0.9.9"
version: "0.8.10+4"
logging:
description: logging
source: hosted
Expand All @@ -51,6 +51,10 @@ packages:
description: matcher
source: hosted
version: "0.10.0"
meta:
description: meta
source: hosted
version: "0.8.8"
mock:
description: mock
source: hosted
Expand All @@ -75,6 +79,10 @@ packages:
description: stack_trace
source: hosted
version: "0.9.3+1"
typed_mock:
description: typed_mock
source: hosted
version: "0.0.4"
unittest:
description: unittest
source: hosted
Expand Down
1 change: 1 addition & 0 deletions example/web/bower_components
1 change: 1 addition & 0 deletions example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<li><a href="hello_world.html">hello_world.html</a></li>
<li><a href="todo.html">todo.html</a></li>
<li><a href="shadow_dom_components.html">shadow_dom_components.html</a></li>
<li><a href="paper.html">paper.html</a></li>
</ul>
</body>
</html>
13 changes: 13 additions & 0 deletions example/web/paper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';


main() {
var injector = applicationFactory()
.run();
var scope = injector.get(Scope);
scope.context['text'] = "Hello future";
scope.context['max'] = 20;
scope.context['curValue'] = 12;
scope.apply();
}
59 changes: 59 additions & 0 deletions example/web/paper.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"
content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">

<!-- 1. Load platform.js for polyfill support. -->
<script src="bower_components/platform/platform.js"></script>

<!-- 2. Use an HTML Import to bring in the element. -->
<link rel="import"
href="bower_components/paper-progress/paper-progress.html">
<link rel="import"
href="bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import"
href="bower_components/paper-slider/paper-slider.html">
<script type="application/dart" src="paper.dart"></script>
<script src="packages/browser/dart.js"></script>
<style>
div { padding: 0.25em; }
paper-slider { width: 40em; }
</style>
</head>
<body>
<h1>Polymer components inside a AngularDart app</h1>
<h2>Property binding: paper-progress</h2>
<p>This is a simple component that doesn't generate events; the only things that is required is property binding</p>
<p>The max ({{max}}) and value ({{curValue}}) properties are bound through bind-* semantics</p>

<p>Text from Angular: <b>{{text}}</b></p>

<div>
<paper-progress bind-max=max bind-value=curValue></paper-progress>
</div>

<p>
<label>
Change the value through an ng-model bound input box:
<input type="text" ng-model="curValue">
</label>
</p>

<h2>Events: paper-checkbox</h2>
<p>The checkbox will generate an event every time the value is changed</p>
<p>AngularDart can listen to these events through the on-* syntax</p>

<div>
<paper-checkbox on-change="curValue = curValue == 5 ? 2 : curValue == 2 ? 10 : 5"></paper-checkbox>
</div>
<p>Every the value changes, the curValue ({{curValue}}) scope variable will update</p>

<h2>Two-way binding: paper-slider</h2>
<p>The slide is bound to the curValue scope variable ({{curValue}})</p>

<div>
<paper-slider min="0" bind-max="max" bind-value="curValue" pin="true"></paper-slider>
</div>
</body>
</html>
6 changes: 5 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ module.exports = function(config) {
files: [
'packages/web_components/platform.js',
'packages/web_components/dart_support.js',
'test/core_dom/web_components_support.js',
'test/*.dart',
'test/**/*_spec.dart',
'test/config/init_guinness.dart',
{pattern: '**/*.dart', watched: true, included: false, served: true},
{pattern: 'packages/**/*.dart', watched: true, included: false, served: true},
{pattern: 'test/**/*.dart', watched: true, included: false, served: true},
{pattern: 'bin/**/*.dart', watched: true, included: false, served: true},
{pattern: 'lib/**/*.dart', watched: true, included: false, served: true},
'packages/browser/dart.js'
],

Expand Down
3 changes: 3 additions & 0 deletions lib/application_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import 'package:angular/change_detection/change_detection.dart';
import 'package:angular/change_detection/dirty_checking_change_detector_dynamic.dart';
import 'package:angular/core/registry_dynamic.dart';
import 'package:angular/core/parser/parser_dynamic.dart';
import 'package:angular/core_dom/type_to_uri_mapper.dart';
import 'package:angular/core_dom/type_to_uri_mapper_dynamic.dart';
import 'dart:html';

/**
Expand Down Expand Up @@ -59,6 +61,7 @@ import 'dart:mirrors' show MirrorsUsed;
class _DynamicApplication extends Application {
_DynamicApplication() {
ngModule
..bind(TypeToUriMapper, toImplementation: DynamicTypeToUriMapper)
..bind(MetadataExtractor, toImplementation: DynamicMetadataExtractor)
..bind(FieldGetterFactory, toImplementation: DynamicFieldGetterFactory)
..bind(ClosureMap, toImplementation: DynamicClosureMap);
Expand Down
11 changes: 8 additions & 3 deletions lib/application_factory_static.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import 'package:angular/core/registry.dart';
import 'package:angular/core/parser/parser.dart';
import 'package:angular/core/parser/parser_static.dart';
import 'package:angular/core/parser/dynamic_parser.dart';
import 'package:angular/core_dom/type_to_uri_mapper.dart';
import 'package:angular/core/registry_static.dart';
import 'package:angular/change_detection/change_detection.dart';
import 'package:angular/change_detection/dirty_checking_change_detector_static.dart';
Expand All @@ -48,8 +49,10 @@ class _StaticApplication extends Application {
Map<Type, Object> metadata,
Map<String, FieldGetter> fieldGetters,
Map<String, FieldSetter> fieldSetters,
Map<String, Symbol> symbols) {
Map<String, Symbol> symbols,
TypeToUriMapper uriMapper) {
ngModule
..bind(TypeToUriMapper, toValue: uriMapper)
..bind(MetadataExtractor, toValue: new StaticMetadataExtractor(metadata))
..bind(FieldGetterFactory, toValue: new StaticFieldGetterFactory(fieldGetters))
..bind(ClosureMap, toValue: new StaticClosureMap(fieldGetters, fieldSetters, symbols));
Expand Down Expand Up @@ -87,6 +90,8 @@ Application staticApplicationFactory(
Map<Type, Object> metadata,
Map<String, FieldGetter> fieldGetters,
Map<String, FieldSetter> fieldSetters,
Map<String, Symbol> symbols) {
return new _StaticApplication(metadata, fieldGetters, fieldSetters, symbols);
Map<String, Symbol> symbols,
TypeToUriMapper uriMapper) {
return new _StaticApplication(metadata, fieldGetters, fieldSetters,
symbols, uriMapper);
}
45 changes: 14 additions & 31 deletions lib/change_detection/dirty_checking_change_detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {

DirtyCheckingRecord _recordAdd(DirtyCheckingRecord record) {
DirtyCheckingRecord previous = _recordTail;
DirtyCheckingRecord next = previous == null ? null : previous._nextRecord;
DirtyCheckingRecord next = previous._nextRecord;

record._nextRecord = next;
record._prevRecord = previous;

if (previous != null) previous._nextRecord = record;
previous._nextRecord = record;
if (next != null) next._prevRecord = record;

_recordTail = record;
Expand All @@ -194,7 +194,8 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {
DirtyCheckingRecord previous = record._prevRecord;
DirtyCheckingRecord next = record._nextRecord;

if (record == _recordHead && record == _recordTail) {
if (_recordHead == _recordTail) {
assert(record == _recordHead);
// we are the last one, must leave marker behind.
_recordHead = _recordTail = _marker;
_marker._nextRecord = next;
Expand Down Expand Up @@ -1302,40 +1303,22 @@ class _DuplicateItemRecordList {
ItemRecord _head, _tail;

/**
* Add the [record] before the [insertBefore] in the list of duplicates or at the end of the list
* when no [insertBefore] is specified.
* Append the [record] to the list of duplicates.
*
* Note: by design all records in the list of duplicates hold the save value in [record.item].
*/
void add(ItemRecord record, ItemRecord insertBefore) {
assert(insertBefore == null || insertBefore.item == record.item);
void add(ItemRecord record) {
if (_head == null) {
/// pushing the first [ItemRecord] to the list
assert(insertBefore == null);
_head = _tail = record;
record._nextDup = null;
record._prevDup = null;
} else {
// adding a duplicate [ItemRecord] to the list
assert(record.item == _head.item ||
record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
if (insertBefore == null) {
_tail._nextDup = record;
record._prevDup = _tail;
record._nextDup = null;
_tail = record;
} else {
var prev = insertBefore._prevDup;
var next = insertBefore;
record._prevDup = prev;
record._nextDup = next;
if (prev == null) {
_head = record;
} else {
prev._nextDup = record;
}
next._prevDup = record;
}
_tail._nextDup = record;
record._prevDup = _tail;
record._nextDup = null;
_tail = record;
}
}

Expand Down Expand Up @@ -1389,16 +1372,16 @@ class _DuplicateItemRecordList {
* The list of duplicates is implemented by [_DuplicateItemRecordList].
*/
class DuplicateMap {
static final nanKey = const Object();
static final _nanKey = const Object();
final map = new HashMap<dynamic, _DuplicateItemRecordList>();

void put(ItemRecord record, [ItemRecord insertBefore = null]) {
void put(ItemRecord record) {
var key = _getKey(record.item);
_DuplicateItemRecordList duplicates = map[key];
if (duplicates == null) {
duplicates = map[key] = new _DuplicateItemRecordList();
}
duplicates.add(record, insertBefore);
duplicates.add(record);
}

/**
Expand Down Expand Up @@ -1435,7 +1418,7 @@ class DuplicateMap {
}

/// Required to handle num.NAN as a Map value
dynamic _getKey(value) => value is num && value.isNaN ? nanKey : value;
dynamic _getKey(value) => value is num && value.isNaN ? _nanKey : value;

String toString() => "DuplicateMap($map)";
}
Expand Down
6 changes: 3 additions & 3 deletions lib/core/annotation_src.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ typedef void DirectiveBinderFn(DirectiveBinder module);

RegExp _ATTR_NAME = new RegExp(r'\[([^\]]+)\]$');

Directive cloneWithNewMap(Directive annotation, map)
=> annotation._cloneWithNewMap(map);
Directive cloneWithNewMap(Directive annotation, map) => annotation._cloneWithNewMap(map);

String mappingSpec(DirectiveAnnotation annotation) => annotation._mappingSpec;

Expand Down Expand Up @@ -219,7 +218,8 @@ abstract class Directive {
this.exportExpressionAttrs: const []
});

toString() => selector;
String toString() => selector;

Directive _cloneWithNewMap(newMap);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/core/formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FormatterMap {
});
}

call(String name) => _injector.get(this[name]);
Function call(String name) => _injector.get(this[name]);

Type operator[](String name) {
Type formatterType = _map[name];
Expand Down
3 changes: 1 addition & 2 deletions lib/core/interpolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class Interpolate implements Function {
// formatter
expParts.add(_wrapInQuotes(template.substring(index, startIdx)));
}
expParts.add('(' + template.substring(startIdx + startLen, endIdx) +
'|stringify)');
expParts.add('(' + template.substring(startIdx + startLen, endIdx) + '|stringify)');

index = endIdx + endLen;
hasInterpolation = true;
Expand Down
Loading