rails-angularjs2 2.0.0.pre.alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +22 -0
- data/README.md +23 -0
- data/lib/rails-angularjs2.rb +9 -0
- data/lib/rails-angularjs2/engine.rb +4 -0
- data/lib/rails-angularjs2/sprockets.rb +3 -0
- data/lib/rails-angularjs2/version.rb +3 -0
- data/vendor/assets/javascripts/angular2.dev.js +28427 -0
- data/vendor/assets/javascripts/angular2.js +28319 -0
- data/vendor/assets/javascripts/angular2.min.js +21 -0
- data/vendor/assets/javascripts/angular2.sfx.dev.js +33745 -0
- data/vendor/assets/javascripts/mock.dev.js +337 -0
- data/vendor/assets/javascripts/mock.dev.js.map +1 -0
- data/vendor/assets/javascripts/router.dev.js +1471 -0
- data/vendor/assets/javascripts/router.dev.js.map +1 -0
- metadata +99 -0
@@ -0,0 +1,337 @@
|
|
1
|
+
"format register";
|
2
|
+
System.register("angular2/src/router/location_strategy", ["angular2/src/facade/lang"], function($__export) {
|
3
|
+
"use strict";
|
4
|
+
var __moduleName = "angular2/src/router/location_strategy";
|
5
|
+
var BaseException,
|
6
|
+
LocationStrategy;
|
7
|
+
function _abstract() {
|
8
|
+
return new BaseException('This method is abstract');
|
9
|
+
}
|
10
|
+
return {
|
11
|
+
setters: [function($__m) {
|
12
|
+
BaseException = $__m.BaseException;
|
13
|
+
}],
|
14
|
+
execute: function() {
|
15
|
+
LocationStrategy = (function() {
|
16
|
+
function LocationStrategy() {}
|
17
|
+
return ($traceurRuntime.createClass)(LocationStrategy, {
|
18
|
+
path: function() {
|
19
|
+
throw _abstract();
|
20
|
+
},
|
21
|
+
pushState: function(ctx, title, url) {
|
22
|
+
throw _abstract();
|
23
|
+
},
|
24
|
+
forward: function() {
|
25
|
+
throw _abstract();
|
26
|
+
},
|
27
|
+
back: function() {
|
28
|
+
throw _abstract();
|
29
|
+
},
|
30
|
+
onPopState: function(fn) {
|
31
|
+
throw _abstract();
|
32
|
+
},
|
33
|
+
getBaseHref: function() {
|
34
|
+
throw _abstract();
|
35
|
+
}
|
36
|
+
}, {});
|
37
|
+
}());
|
38
|
+
$__export("LocationStrategy", LocationStrategy);
|
39
|
+
}
|
40
|
+
};
|
41
|
+
});
|
42
|
+
|
43
|
+
System.register("angular2/src/render/xhr_mock", ["angular2/src/render/xhr", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/async"], function($__export) {
|
44
|
+
"use strict";
|
45
|
+
var __moduleName = "angular2/src/render/xhr_mock";
|
46
|
+
var XHR,
|
47
|
+
ListWrapper,
|
48
|
+
Map,
|
49
|
+
isBlank,
|
50
|
+
normalizeBlank,
|
51
|
+
BaseException,
|
52
|
+
PromiseWrapper,
|
53
|
+
MockXHR,
|
54
|
+
_PendingRequest,
|
55
|
+
_Expectation;
|
56
|
+
return {
|
57
|
+
setters: [function($__m) {
|
58
|
+
XHR = $__m.XHR;
|
59
|
+
}, function($__m) {
|
60
|
+
ListWrapper = $__m.ListWrapper;
|
61
|
+
Map = $__m.Map;
|
62
|
+
}, function($__m) {
|
63
|
+
isBlank = $__m.isBlank;
|
64
|
+
normalizeBlank = $__m.normalizeBlank;
|
65
|
+
BaseException = $__m.BaseException;
|
66
|
+
}, function($__m) {
|
67
|
+
PromiseWrapper = $__m.PromiseWrapper;
|
68
|
+
}],
|
69
|
+
execute: function() {
|
70
|
+
MockXHR = (function($__super) {
|
71
|
+
function MockXHR() {
|
72
|
+
$traceurRuntime.superConstructor(MockXHR).call(this);
|
73
|
+
this._expectations = [];
|
74
|
+
this._definitions = new Map();
|
75
|
+
this._requests = [];
|
76
|
+
}
|
77
|
+
return ($traceurRuntime.createClass)(MockXHR, {
|
78
|
+
get: function(url) {
|
79
|
+
var request = new _PendingRequest(url);
|
80
|
+
this._requests.push(request);
|
81
|
+
return request.getPromise();
|
82
|
+
},
|
83
|
+
expect: function(url, response) {
|
84
|
+
var expectation = new _Expectation(url, response);
|
85
|
+
this._expectations.push(expectation);
|
86
|
+
},
|
87
|
+
when: function(url, response) {
|
88
|
+
this._definitions.set(url, response);
|
89
|
+
},
|
90
|
+
flush: function() {
|
91
|
+
if (this._requests.length === 0) {
|
92
|
+
throw new BaseException('No pending requests to flush');
|
93
|
+
}
|
94
|
+
do {
|
95
|
+
var request = ListWrapper.removeAt(this._requests, 0);
|
96
|
+
this._processRequest(request);
|
97
|
+
} while (this._requests.length > 0);
|
98
|
+
this.verifyNoOustandingExpectations();
|
99
|
+
},
|
100
|
+
verifyNoOustandingExpectations: function() {
|
101
|
+
if (this._expectations.length === 0)
|
102
|
+
return ;
|
103
|
+
var urls = [];
|
104
|
+
for (var i = 0; i < this._expectations.length; i++) {
|
105
|
+
var expectation = this._expectations[i];
|
106
|
+
urls.push(expectation.url);
|
107
|
+
}
|
108
|
+
throw new BaseException(("Unsatisfied requests: " + ListWrapper.join(urls, ', ')));
|
109
|
+
},
|
110
|
+
_processRequest: function(request) {
|
111
|
+
var url = request.url;
|
112
|
+
if (this._expectations.length > 0) {
|
113
|
+
var expectation = this._expectations[0];
|
114
|
+
if (expectation.url == url) {
|
115
|
+
ListWrapper.remove(this._expectations, expectation);
|
116
|
+
request.complete(expectation.response);
|
117
|
+
return ;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
if (this._definitions.has(url)) {
|
121
|
+
var response = this._definitions.get(url);
|
122
|
+
request.complete(normalizeBlank(response));
|
123
|
+
return ;
|
124
|
+
}
|
125
|
+
throw new BaseException(("Unexpected request " + url));
|
126
|
+
}
|
127
|
+
}, {}, $__super);
|
128
|
+
}(XHR));
|
129
|
+
$__export("MockXHR", MockXHR);
|
130
|
+
_PendingRequest = (function() {
|
131
|
+
function _PendingRequest(url) {
|
132
|
+
this.url = url;
|
133
|
+
this.completer = PromiseWrapper.completer();
|
134
|
+
}
|
135
|
+
return ($traceurRuntime.createClass)(_PendingRequest, {
|
136
|
+
complete: function(response) {
|
137
|
+
if (isBlank(response)) {
|
138
|
+
this.completer.reject(("Failed to load " + this.url), null);
|
139
|
+
} else {
|
140
|
+
this.completer.resolve(response);
|
141
|
+
}
|
142
|
+
},
|
143
|
+
getPromise: function() {
|
144
|
+
return this.completer.promise;
|
145
|
+
}
|
146
|
+
}, {});
|
147
|
+
}());
|
148
|
+
_Expectation = (function() {
|
149
|
+
function _Expectation(url, response) {
|
150
|
+
this.url = url;
|
151
|
+
this.response = response;
|
152
|
+
}
|
153
|
+
return ($traceurRuntime.createClass)(_Expectation, {}, {});
|
154
|
+
}());
|
155
|
+
}
|
156
|
+
};
|
157
|
+
});
|
158
|
+
|
159
|
+
System.register("angular2/src/mock/mock_location_strategy", ["angular2/src/facade/async", "angular2/src/router/location_strategy"], function($__export) {
|
160
|
+
"use strict";
|
161
|
+
var __moduleName = "angular2/src/mock/mock_location_strategy";
|
162
|
+
var EventEmitter,
|
163
|
+
ObservableWrapper,
|
164
|
+
LocationStrategy,
|
165
|
+
MockLocationStrategy;
|
166
|
+
return {
|
167
|
+
setters: [function($__m) {
|
168
|
+
EventEmitter = $__m.EventEmitter;
|
169
|
+
ObservableWrapper = $__m.ObservableWrapper;
|
170
|
+
}, function($__m) {
|
171
|
+
LocationStrategy = $__m.LocationStrategy;
|
172
|
+
}],
|
173
|
+
execute: function() {
|
174
|
+
MockLocationStrategy = (function($__super) {
|
175
|
+
function MockLocationStrategy() {
|
176
|
+
$traceurRuntime.superConstructor(MockLocationStrategy).call(this);
|
177
|
+
this.internalBaseHref = '/';
|
178
|
+
this.internalPath = '/';
|
179
|
+
this.internalTitle = '';
|
180
|
+
this.urlChanges = [];
|
181
|
+
this._subject = new EventEmitter();
|
182
|
+
}
|
183
|
+
return ($traceurRuntime.createClass)(MockLocationStrategy, {
|
184
|
+
simulatePopState: function(url) {
|
185
|
+
this.internalPath = url;
|
186
|
+
ObservableWrapper.callNext(this._subject, null);
|
187
|
+
},
|
188
|
+
path: function() {
|
189
|
+
return this.internalPath;
|
190
|
+
},
|
191
|
+
simulateUrlPop: function(pathname) {
|
192
|
+
ObservableWrapper.callNext(this._subject, {'url': pathname});
|
193
|
+
},
|
194
|
+
pushState: function(ctx, title, url) {
|
195
|
+
this.internalTitle = title;
|
196
|
+
this.internalPath = url;
|
197
|
+
this.urlChanges.push(url);
|
198
|
+
},
|
199
|
+
onPopState: function(fn) {
|
200
|
+
ObservableWrapper.subscribe(this._subject, fn);
|
201
|
+
},
|
202
|
+
getBaseHref: function() {
|
203
|
+
return this.internalBaseHref;
|
204
|
+
}
|
205
|
+
}, {}, $__super);
|
206
|
+
}(LocationStrategy));
|
207
|
+
$__export("MockLocationStrategy", MockLocationStrategy);
|
208
|
+
}
|
209
|
+
};
|
210
|
+
});
|
211
|
+
|
212
|
+
System.register("angular2/src/mock/view_resolver_mock", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/annotations_impl/view", "angular2/src/core/compiler/view_resolver"], function($__export) {
|
213
|
+
"use strict";
|
214
|
+
var __moduleName = "angular2/src/mock/view_resolver_mock";
|
215
|
+
var Map,
|
216
|
+
MapWrapper,
|
217
|
+
ListWrapper,
|
218
|
+
isPresent,
|
219
|
+
BaseException,
|
220
|
+
stringify,
|
221
|
+
isBlank,
|
222
|
+
View,
|
223
|
+
ViewResolver,
|
224
|
+
MockViewResolver;
|
225
|
+
return {
|
226
|
+
setters: [function($__m) {
|
227
|
+
Map = $__m.Map;
|
228
|
+
MapWrapper = $__m.MapWrapper;
|
229
|
+
ListWrapper = $__m.ListWrapper;
|
230
|
+
}, function($__m) {
|
231
|
+
isPresent = $__m.isPresent;
|
232
|
+
BaseException = $__m.BaseException;
|
233
|
+
stringify = $__m.stringify;
|
234
|
+
isBlank = $__m.isBlank;
|
235
|
+
}, function($__m) {
|
236
|
+
View = $__m.View;
|
237
|
+
}, function($__m) {
|
238
|
+
ViewResolver = $__m.ViewResolver;
|
239
|
+
}],
|
240
|
+
execute: function() {
|
241
|
+
MockViewResolver = (function($__super) {
|
242
|
+
function MockViewResolver() {
|
243
|
+
$traceurRuntime.superConstructor(MockViewResolver).call(this);
|
244
|
+
this._views = new Map();
|
245
|
+
this._inlineTemplates = new Map();
|
246
|
+
this._viewCache = new Map();
|
247
|
+
this._directiveOverrides = new Map();
|
248
|
+
}
|
249
|
+
return ($traceurRuntime.createClass)(MockViewResolver, {
|
250
|
+
setView: function(component, view) {
|
251
|
+
this._checkOverrideable(component);
|
252
|
+
this._views.set(component, view);
|
253
|
+
},
|
254
|
+
setInlineTemplate: function(component, template) {
|
255
|
+
this._checkOverrideable(component);
|
256
|
+
this._inlineTemplates.set(component, template);
|
257
|
+
},
|
258
|
+
overrideViewDirective: function(component, from, to) {
|
259
|
+
this._checkOverrideable(component);
|
260
|
+
var overrides = this._directiveOverrides.get(component);
|
261
|
+
if (isBlank(overrides)) {
|
262
|
+
overrides = new Map();
|
263
|
+
this._directiveOverrides.set(component, overrides);
|
264
|
+
}
|
265
|
+
overrides.set(from, to);
|
266
|
+
},
|
267
|
+
resolve: function(component) {
|
268
|
+
var view = this._viewCache.get(component);
|
269
|
+
if (isPresent(view))
|
270
|
+
return view;
|
271
|
+
view = this._views.get(component);
|
272
|
+
if (isBlank(view)) {
|
273
|
+
view = $traceurRuntime.superGet(this, MockViewResolver.prototype, "resolve").call(this, component);
|
274
|
+
}
|
275
|
+
var directives = view.directives;
|
276
|
+
var overrides = this._directiveOverrides.get(component);
|
277
|
+
if (isPresent(overrides) && isPresent(directives)) {
|
278
|
+
directives = ListWrapper.clone(view.directives);
|
279
|
+
MapWrapper.forEach(overrides, (function(to, from) {
|
280
|
+
var srcIndex = directives.indexOf(from);
|
281
|
+
if (srcIndex == -1) {
|
282
|
+
throw new BaseException(("Overriden directive " + stringify(from) + " not found in the template of " + stringify(component)));
|
283
|
+
}
|
284
|
+
directives[srcIndex] = to;
|
285
|
+
}));
|
286
|
+
view = new View({
|
287
|
+
template: view.template,
|
288
|
+
templateUrl: view.templateUrl,
|
289
|
+
directives: directives
|
290
|
+
});
|
291
|
+
}
|
292
|
+
var inlineTemplate = this._inlineTemplates.get(component);
|
293
|
+
if (isPresent(inlineTemplate)) {
|
294
|
+
view = new View({
|
295
|
+
template: inlineTemplate,
|
296
|
+
templateUrl: null,
|
297
|
+
directives: view.directives
|
298
|
+
});
|
299
|
+
}
|
300
|
+
this._viewCache.set(component, view);
|
301
|
+
return view;
|
302
|
+
},
|
303
|
+
_checkOverrideable: function(component) {
|
304
|
+
var cached = this._viewCache.get(component);
|
305
|
+
if (isPresent(cached)) {
|
306
|
+
throw new BaseException(("The component " + stringify(component) + " has already been compiled, its configuration can not be changed"));
|
307
|
+
}
|
308
|
+
}
|
309
|
+
}, {}, $__super);
|
310
|
+
}(ViewResolver));
|
311
|
+
$__export("MockViewResolver", MockViewResolver);
|
312
|
+
}
|
313
|
+
};
|
314
|
+
});
|
315
|
+
|
316
|
+
System.register("angular2/mock", ["angular2/src/mock/mock_location_strategy", "angular2/src/router/location_strategy", "angular2/src/mock/view_resolver_mock", "angular2/src/render/xhr_mock"], function($__export) {
|
317
|
+
"use strict";
|
318
|
+
var __moduleName = "angular2/mock";
|
319
|
+
var $__exportNames = {undefined: true};
|
320
|
+
return {
|
321
|
+
setters: [function($__m) {
|
322
|
+
Object.keys($__m).forEach(function(p) {
|
323
|
+
if (!$__exportNames[p])
|
324
|
+
$__export(p, $__m[p]);
|
325
|
+
});
|
326
|
+
}, function($__m) {
|
327
|
+
$__export("LocationStrategy", $__m.LocationStrategy);
|
328
|
+
}, function($__m) {
|
329
|
+
$__export("MockViewResolver", $__m.MockViewResolver);
|
330
|
+
}, function($__m) {
|
331
|
+
$__export("MockXHR", $__m.MockXHR);
|
332
|
+
}],
|
333
|
+
execute: function() {}
|
334
|
+
};
|
335
|
+
});
|
336
|
+
|
337
|
+
//# sourceMappingURL=mock.dev.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../js/dev/es6/angular2/src/router/location_strategy.js","../js/dev/es6/angular2/src/render/xhr_mock.js","../js/dev/es6/angular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AW,kBAAoB,CAAC;AAC1B,AAAI,IAAA,CAAA,cAAa,oBAAoB,CAAC;AADhD,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,oBAAoB,KAAG,kBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,oBAAoB,KAAG,kBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,WAAoB,KAAG,SAAmB,CAAC;IAE5C,CADuB;AACzB,UAAM,eAAmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AACmB","file":"dist/bundle/mock.dev.js"}
|
@@ -0,0 +1,1471 @@
|
|
1
|
+
"format register";
|
2
|
+
System.register("angular2/src/router/instruction", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
|
3
|
+
"use strict";
|
4
|
+
var __moduleName = "angular2/src/router/instruction";
|
5
|
+
var StringMapWrapper,
|
6
|
+
isPresent,
|
7
|
+
normalizeBlank,
|
8
|
+
RouteParams,
|
9
|
+
Instruction;
|
10
|
+
function shouldReuseComponent(instr1, instr2) {
|
11
|
+
return instr1.component == instr2.component && StringMapWrapper.equals(instr1.params, instr2.params);
|
12
|
+
}
|
13
|
+
return {
|
14
|
+
setters: [function($__m) {
|
15
|
+
StringMapWrapper = $__m.StringMapWrapper;
|
16
|
+
}, function($__m) {
|
17
|
+
isPresent = $__m.isPresent;
|
18
|
+
normalizeBlank = $__m.normalizeBlank;
|
19
|
+
}],
|
20
|
+
execute: function() {
|
21
|
+
RouteParams = (function() {
|
22
|
+
function RouteParams(params) {
|
23
|
+
this.params = params;
|
24
|
+
}
|
25
|
+
return ($traceurRuntime.createClass)(RouteParams, {get: function(param) {
|
26
|
+
return normalizeBlank(StringMapWrapper.get(this.params, param));
|
27
|
+
}}, {});
|
28
|
+
}());
|
29
|
+
$__export("RouteParams", RouteParams);
|
30
|
+
Instruction = (function() {
|
31
|
+
function Instruction() {
|
32
|
+
var $__1 = arguments[0] !== (void 0) ? arguments[0] : {},
|
33
|
+
params = $__1.params,
|
34
|
+
component = $__1.component,
|
35
|
+
child = $__1.child,
|
36
|
+
matchedUrl = $__1.matchedUrl,
|
37
|
+
parentSpecificity = $__1.parentSpecificity;
|
38
|
+
this.reuse = false;
|
39
|
+
this.capturedUrl = matchedUrl;
|
40
|
+
this.accumulatedUrl = matchedUrl;
|
41
|
+
this.specificity = parentSpecificity;
|
42
|
+
if (isPresent(child)) {
|
43
|
+
this.child = child;
|
44
|
+
this.specificity += child.specificity;
|
45
|
+
var childUrl = child.accumulatedUrl;
|
46
|
+
if (isPresent(childUrl)) {
|
47
|
+
this.accumulatedUrl += childUrl;
|
48
|
+
}
|
49
|
+
} else {
|
50
|
+
this.child = null;
|
51
|
+
}
|
52
|
+
this.component = component;
|
53
|
+
this.params = params;
|
54
|
+
}
|
55
|
+
return ($traceurRuntime.createClass)(Instruction, {
|
56
|
+
hasChild: function() {
|
57
|
+
return isPresent(this.child);
|
58
|
+
},
|
59
|
+
reuseComponentsFrom: function(oldInstruction) {
|
60
|
+
var nextInstruction = this;
|
61
|
+
while (nextInstruction.reuse = shouldReuseComponent(nextInstruction, oldInstruction) && isPresent(oldInstruction = oldInstruction.child) && isPresent(nextInstruction = nextInstruction.child))
|
62
|
+
;
|
63
|
+
}
|
64
|
+
}, {});
|
65
|
+
}());
|
66
|
+
$__export("Instruction", Instruction);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
});
|
70
|
+
|
71
|
+
System.register("angular2/src/router/location_strategy", ["angular2/src/facade/lang"], function($__export) {
|
72
|
+
"use strict";
|
73
|
+
var __moduleName = "angular2/src/router/location_strategy";
|
74
|
+
var BaseException,
|
75
|
+
LocationStrategy;
|
76
|
+
function _abstract() {
|
77
|
+
return new BaseException('This method is abstract');
|
78
|
+
}
|
79
|
+
return {
|
80
|
+
setters: [function($__m) {
|
81
|
+
BaseException = $__m.BaseException;
|
82
|
+
}],
|
83
|
+
execute: function() {
|
84
|
+
LocationStrategy = (function() {
|
85
|
+
function LocationStrategy() {}
|
86
|
+
return ($traceurRuntime.createClass)(LocationStrategy, {
|
87
|
+
path: function() {
|
88
|
+
throw _abstract();
|
89
|
+
},
|
90
|
+
pushState: function(ctx, title, url) {
|
91
|
+
throw _abstract();
|
92
|
+
},
|
93
|
+
forward: function() {
|
94
|
+
throw _abstract();
|
95
|
+
},
|
96
|
+
back: function() {
|
97
|
+
throw _abstract();
|
98
|
+
},
|
99
|
+
onPopState: function(fn) {
|
100
|
+
throw _abstract();
|
101
|
+
},
|
102
|
+
getBaseHref: function() {
|
103
|
+
throw _abstract();
|
104
|
+
}
|
105
|
+
}, {});
|
106
|
+
}());
|
107
|
+
$__export("LocationStrategy", LocationStrategy);
|
108
|
+
}
|
109
|
+
};
|
110
|
+
});
|
111
|
+
|
112
|
+
System.register("angular2/src/router/url", ["angular2/src/facade/lang"], function($__export) {
|
113
|
+
"use strict";
|
114
|
+
var __moduleName = "angular2/src/router/url";
|
115
|
+
var RegExpWrapper,
|
116
|
+
StringWrapper,
|
117
|
+
specialCharacters,
|
118
|
+
escapeRe;
|
119
|
+
function escapeRegex(string) {
|
120
|
+
return StringWrapper.replaceAllMapped(string, escapeRe, (function(match) {
|
121
|
+
return "\\" + match;
|
122
|
+
}));
|
123
|
+
}
|
124
|
+
$__export("escapeRegex", escapeRegex);
|
125
|
+
return {
|
126
|
+
setters: [function($__m) {
|
127
|
+
RegExpWrapper = $__m.RegExpWrapper;
|
128
|
+
StringWrapper = $__m.StringWrapper;
|
129
|
+
}],
|
130
|
+
execute: function() {
|
131
|
+
specialCharacters = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
|
132
|
+
escapeRe = RegExpWrapper.create('(\\' + specialCharacters.join('|\\') + ')', 'g');
|
133
|
+
}
|
134
|
+
};
|
135
|
+
});
|
136
|
+
|
137
|
+
System.register("angular2/src/router/route_config_impl", ["angular2/src/facade/lang"], function($__export) {
|
138
|
+
"use strict";
|
139
|
+
var __moduleName = "angular2/src/router/route_config_impl";
|
140
|
+
var __decorate,
|
141
|
+
__metadata,
|
142
|
+
CONST,
|
143
|
+
RouteConfig;
|
144
|
+
return {
|
145
|
+
setters: [function($__m) {
|
146
|
+
CONST = $__m.CONST;
|
147
|
+
}],
|
148
|
+
execute: function() {
|
149
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
150
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
151
|
+
return Reflect.decorate(decorators, target, key, desc);
|
152
|
+
switch (arguments.length) {
|
153
|
+
case 2:
|
154
|
+
return decorators.reduceRight(function(o, d) {
|
155
|
+
return (d && d(o)) || o;
|
156
|
+
}, target);
|
157
|
+
case 3:
|
158
|
+
return decorators.reduceRight(function(o, d) {
|
159
|
+
return (d && d(target, key)), void 0;
|
160
|
+
}, void 0);
|
161
|
+
case 4:
|
162
|
+
return decorators.reduceRight(function(o, d) {
|
163
|
+
return (d && d(target, key, o)) || o;
|
164
|
+
}, desc);
|
165
|
+
}
|
166
|
+
};
|
167
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
168
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
169
|
+
return Reflect.metadata(k, v);
|
170
|
+
};
|
171
|
+
RouteConfig = (($traceurRuntime.createClass)(function(configs) {
|
172
|
+
this.configs = configs;
|
173
|
+
}, {}, {}));
|
174
|
+
$__export("RouteConfig", RouteConfig);
|
175
|
+
$__export("RouteConfig", RouteConfig = __decorate([CONST(), __metadata('design:paramtypes', [Object])], RouteConfig));
|
176
|
+
}
|
177
|
+
};
|
178
|
+
});
|
179
|
+
|
180
|
+
System.register("angular2/src/router/hash_location_strategy", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/router/location_strategy"], function($__export) {
|
181
|
+
"use strict";
|
182
|
+
var __moduleName = "angular2/src/router/hash_location_strategy";
|
183
|
+
var __decorate,
|
184
|
+
__metadata,
|
185
|
+
DOM,
|
186
|
+
Injectable,
|
187
|
+
LocationStrategy,
|
188
|
+
HashLocationStrategy;
|
189
|
+
return {
|
190
|
+
setters: [function($__m) {
|
191
|
+
DOM = $__m.DOM;
|
192
|
+
}, function($__m) {
|
193
|
+
Injectable = $__m.Injectable;
|
194
|
+
}, function($__m) {
|
195
|
+
LocationStrategy = $__m.LocationStrategy;
|
196
|
+
}],
|
197
|
+
execute: function() {
|
198
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
199
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
200
|
+
return Reflect.decorate(decorators, target, key, desc);
|
201
|
+
switch (arguments.length) {
|
202
|
+
case 2:
|
203
|
+
return decorators.reduceRight(function(o, d) {
|
204
|
+
return (d && d(o)) || o;
|
205
|
+
}, target);
|
206
|
+
case 3:
|
207
|
+
return decorators.reduceRight(function(o, d) {
|
208
|
+
return (d && d(target, key)), void 0;
|
209
|
+
}, void 0);
|
210
|
+
case 4:
|
211
|
+
return decorators.reduceRight(function(o, d) {
|
212
|
+
return (d && d(target, key, o)) || o;
|
213
|
+
}, desc);
|
214
|
+
}
|
215
|
+
};
|
216
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
217
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
218
|
+
return Reflect.metadata(k, v);
|
219
|
+
};
|
220
|
+
HashLocationStrategy = (function($__super) {
|
221
|
+
function $__0() {
|
222
|
+
$traceurRuntime.superConstructor($__0).call(this);
|
223
|
+
this._location = DOM.getLocation();
|
224
|
+
this._history = DOM.getHistory();
|
225
|
+
}
|
226
|
+
return ($traceurRuntime.createClass)($__0, {
|
227
|
+
onPopState: function(fn) {
|
228
|
+
DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false);
|
229
|
+
},
|
230
|
+
getBaseHref: function() {
|
231
|
+
return '';
|
232
|
+
},
|
233
|
+
path: function() {
|
234
|
+
return this._location.hash;
|
235
|
+
},
|
236
|
+
pushState: function(state, title, url) {
|
237
|
+
this._history.pushState(state, title, '#' + url);
|
238
|
+
},
|
239
|
+
forward: function() {
|
240
|
+
this._history.forward();
|
241
|
+
},
|
242
|
+
back: function() {
|
243
|
+
this._history.back();
|
244
|
+
}
|
245
|
+
}, {}, $__super);
|
246
|
+
}(LocationStrategy));
|
247
|
+
$__export("HashLocationStrategy", HashLocationStrategy);
|
248
|
+
$__export("HashLocationStrategy", HashLocationStrategy = __decorate([Injectable(), __metadata('design:paramtypes', [])], HashLocationStrategy));
|
249
|
+
}
|
250
|
+
};
|
251
|
+
});
|
252
|
+
|
253
|
+
System.register("angular2/src/router/html5_location_strategy", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/router/location_strategy"], function($__export) {
|
254
|
+
"use strict";
|
255
|
+
var __moduleName = "angular2/src/router/html5_location_strategy";
|
256
|
+
var __decorate,
|
257
|
+
__metadata,
|
258
|
+
DOM,
|
259
|
+
Injectable,
|
260
|
+
LocationStrategy,
|
261
|
+
HTML5LocationStrategy;
|
262
|
+
return {
|
263
|
+
setters: [function($__m) {
|
264
|
+
DOM = $__m.DOM;
|
265
|
+
}, function($__m) {
|
266
|
+
Injectable = $__m.Injectable;
|
267
|
+
}, function($__m) {
|
268
|
+
LocationStrategy = $__m.LocationStrategy;
|
269
|
+
}],
|
270
|
+
execute: function() {
|
271
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
272
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
273
|
+
return Reflect.decorate(decorators, target, key, desc);
|
274
|
+
switch (arguments.length) {
|
275
|
+
case 2:
|
276
|
+
return decorators.reduceRight(function(o, d) {
|
277
|
+
return (d && d(o)) || o;
|
278
|
+
}, target);
|
279
|
+
case 3:
|
280
|
+
return decorators.reduceRight(function(o, d) {
|
281
|
+
return (d && d(target, key)), void 0;
|
282
|
+
}, void 0);
|
283
|
+
case 4:
|
284
|
+
return decorators.reduceRight(function(o, d) {
|
285
|
+
return (d && d(target, key, o)) || o;
|
286
|
+
}, desc);
|
287
|
+
}
|
288
|
+
};
|
289
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
290
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
291
|
+
return Reflect.metadata(k, v);
|
292
|
+
};
|
293
|
+
HTML5LocationStrategy = (function($__super) {
|
294
|
+
function $__0() {
|
295
|
+
$traceurRuntime.superConstructor($__0).call(this);
|
296
|
+
this._location = DOM.getLocation();
|
297
|
+
this._history = DOM.getHistory();
|
298
|
+
this._baseHref = DOM.getBaseHref();
|
299
|
+
}
|
300
|
+
return ($traceurRuntime.createClass)($__0, {
|
301
|
+
onPopState: function(fn) {
|
302
|
+
DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false);
|
303
|
+
},
|
304
|
+
getBaseHref: function() {
|
305
|
+
return this._baseHref;
|
306
|
+
},
|
307
|
+
path: function() {
|
308
|
+
return this._location.pathname;
|
309
|
+
},
|
310
|
+
pushState: function(state, title, url) {
|
311
|
+
this._history.pushState(state, title, url);
|
312
|
+
},
|
313
|
+
forward: function() {
|
314
|
+
this._history.forward();
|
315
|
+
},
|
316
|
+
back: function() {
|
317
|
+
this._history.back();
|
318
|
+
}
|
319
|
+
}, {}, $__super);
|
320
|
+
}(LocationStrategy));
|
321
|
+
$__export("HTML5LocationStrategy", HTML5LocationStrategy);
|
322
|
+
$__export("HTML5LocationStrategy", HTML5LocationStrategy = __decorate([Injectable(), __metadata('design:paramtypes', [])], HTML5LocationStrategy));
|
323
|
+
}
|
324
|
+
};
|
325
|
+
});
|
326
|
+
|
327
|
+
System.register("angular2/src/router/pipeline", ["angular2/src/facade/async"], function($__export) {
|
328
|
+
"use strict";
|
329
|
+
var __moduleName = "angular2/src/router/pipeline";
|
330
|
+
var PromiseWrapper,
|
331
|
+
Pipeline;
|
332
|
+
return {
|
333
|
+
setters: [function($__m) {
|
334
|
+
PromiseWrapper = $__m.PromiseWrapper;
|
335
|
+
}],
|
336
|
+
execute: function() {
|
337
|
+
Pipeline = (function() {
|
338
|
+
function Pipeline() {
|
339
|
+
this.steps = [(function(instruction) {
|
340
|
+
return instruction.router.activateOutlets(instruction);
|
341
|
+
})];
|
342
|
+
}
|
343
|
+
return ($traceurRuntime.createClass)(Pipeline, {process: function(instruction) {
|
344
|
+
var steps = this.steps,
|
345
|
+
currentStep = 0;
|
346
|
+
function processOne() {
|
347
|
+
var result = arguments[0] !== (void 0) ? arguments[0] : true;
|
348
|
+
if (currentStep >= steps.length) {
|
349
|
+
return PromiseWrapper.resolve(result);
|
350
|
+
}
|
351
|
+
var step = steps[currentStep];
|
352
|
+
currentStep += 1;
|
353
|
+
return PromiseWrapper.resolve(step(instruction)).then(processOne);
|
354
|
+
}
|
355
|
+
return processOne();
|
356
|
+
}}, {});
|
357
|
+
}());
|
358
|
+
$__export("Pipeline", Pipeline);
|
359
|
+
}
|
360
|
+
};
|
361
|
+
});
|
362
|
+
|
363
|
+
System.register("angular2/src/router/route_config_decorator", ["angular2/src/router/route_config_impl", "angular2/src/util/decorators"], function($__export) {
|
364
|
+
"use strict";
|
365
|
+
var __moduleName = "angular2/src/router/route_config_decorator";
|
366
|
+
var RouteConfigAnnotation,
|
367
|
+
makeDecorator,
|
368
|
+
RouteConfig;
|
369
|
+
return {
|
370
|
+
setters: [function($__m) {
|
371
|
+
RouteConfigAnnotation = $__m.RouteConfig;
|
372
|
+
}, function($__m) {
|
373
|
+
makeDecorator = $__m.makeDecorator;
|
374
|
+
}],
|
375
|
+
execute: function() {
|
376
|
+
RouteConfig = makeDecorator(RouteConfigAnnotation);
|
377
|
+
$__export("RouteConfig", RouteConfig);
|
378
|
+
}
|
379
|
+
};
|
380
|
+
});
|
381
|
+
|
382
|
+
System.register("angular2/src/router/location", ["angular2/src/router/location_strategy", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/di"], function($__export) {
|
383
|
+
"use strict";
|
384
|
+
var __moduleName = "angular2/src/router/location";
|
385
|
+
var __decorate,
|
386
|
+
__metadata,
|
387
|
+
__param,
|
388
|
+
LocationStrategy,
|
389
|
+
isPresent,
|
390
|
+
CONST_EXPR,
|
391
|
+
EventEmitter,
|
392
|
+
ObservableWrapper,
|
393
|
+
OpaqueToken,
|
394
|
+
Injectable,
|
395
|
+
Optional,
|
396
|
+
Inject,
|
397
|
+
appBaseHrefToken,
|
398
|
+
Location;
|
399
|
+
function stripIndexHtml(url) {
|
400
|
+
if (/\/index.html$/g.test(url)) {
|
401
|
+
return url.substring(0, url.length - 11);
|
402
|
+
}
|
403
|
+
return url;
|
404
|
+
}
|
405
|
+
function stripTrailingSlash(url) {
|
406
|
+
if (/\/$/g.test(url)) {
|
407
|
+
url = url.substring(0, url.length - 1);
|
408
|
+
}
|
409
|
+
return url;
|
410
|
+
}
|
411
|
+
return {
|
412
|
+
setters: [function($__m) {
|
413
|
+
LocationStrategy = $__m.LocationStrategy;
|
414
|
+
}, function($__m) {
|
415
|
+
isPresent = $__m.isPresent;
|
416
|
+
CONST_EXPR = $__m.CONST_EXPR;
|
417
|
+
}, function($__m) {
|
418
|
+
EventEmitter = $__m.EventEmitter;
|
419
|
+
ObservableWrapper = $__m.ObservableWrapper;
|
420
|
+
}, function($__m) {
|
421
|
+
OpaqueToken = $__m.OpaqueToken;
|
422
|
+
Injectable = $__m.Injectable;
|
423
|
+
Optional = $__m.Optional;
|
424
|
+
Inject = $__m.Inject;
|
425
|
+
}],
|
426
|
+
execute: function() {
|
427
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
428
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
429
|
+
return Reflect.decorate(decorators, target, key, desc);
|
430
|
+
switch (arguments.length) {
|
431
|
+
case 2:
|
432
|
+
return decorators.reduceRight(function(o, d) {
|
433
|
+
return (d && d(o)) || o;
|
434
|
+
}, target);
|
435
|
+
case 3:
|
436
|
+
return decorators.reduceRight(function(o, d) {
|
437
|
+
return (d && d(target, key)), void 0;
|
438
|
+
}, void 0);
|
439
|
+
case 4:
|
440
|
+
return decorators.reduceRight(function(o, d) {
|
441
|
+
return (d && d(target, key, o)) || o;
|
442
|
+
}, desc);
|
443
|
+
}
|
444
|
+
};
|
445
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
446
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
447
|
+
return Reflect.metadata(k, v);
|
448
|
+
};
|
449
|
+
__param = (this && this.__param) || function(paramIndex, decorator) {
|
450
|
+
return function(target, key) {
|
451
|
+
decorator(target, key, paramIndex);
|
452
|
+
};
|
453
|
+
};
|
454
|
+
appBaseHrefToken = CONST_EXPR(new OpaqueToken('locationHrefToken'));
|
455
|
+
$__export("appBaseHrefToken", appBaseHrefToken);
|
456
|
+
Location = (($traceurRuntime.createClass)(function(_platformStrategy, href) {
|
457
|
+
var $__0 = this;
|
458
|
+
this._platformStrategy = _platformStrategy;
|
459
|
+
this._subject = new EventEmitter();
|
460
|
+
this._baseHref = stripTrailingSlash(stripIndexHtml(isPresent(href) ? href : this._platformStrategy.getBaseHref()));
|
461
|
+
this._platformStrategy.onPopState((function(_) {
|
462
|
+
return $__0._onPopState(_);
|
463
|
+
}));
|
464
|
+
}, {
|
465
|
+
_onPopState: function(_) {
|
466
|
+
ObservableWrapper.callNext(this._subject, {'url': this.path()});
|
467
|
+
},
|
468
|
+
path: function() {
|
469
|
+
return this.normalize(this._platformStrategy.path());
|
470
|
+
},
|
471
|
+
normalize: function(url) {
|
472
|
+
return stripTrailingSlash(this._stripBaseHref(stripIndexHtml(url)));
|
473
|
+
},
|
474
|
+
normalizeAbsolutely: function(url) {
|
475
|
+
if (!url.startsWith('/')) {
|
476
|
+
url = '/' + url;
|
477
|
+
}
|
478
|
+
return stripTrailingSlash(this._addBaseHref(url));
|
479
|
+
},
|
480
|
+
_stripBaseHref: function(url) {
|
481
|
+
if (this._baseHref.length > 0 && url.startsWith(this._baseHref)) {
|
482
|
+
return url.substring(this._baseHref.length);
|
483
|
+
}
|
484
|
+
return url;
|
485
|
+
},
|
486
|
+
_addBaseHref: function(url) {
|
487
|
+
if (!url.startsWith(this._baseHref)) {
|
488
|
+
return this._baseHref + url;
|
489
|
+
}
|
490
|
+
return url;
|
491
|
+
},
|
492
|
+
go: function(url) {
|
493
|
+
var finalUrl = this.normalizeAbsolutely(url);
|
494
|
+
this._platformStrategy.pushState(null, '', finalUrl);
|
495
|
+
},
|
496
|
+
forward: function() {
|
497
|
+
this._platformStrategy.forward();
|
498
|
+
},
|
499
|
+
back: function() {
|
500
|
+
this._platformStrategy.back();
|
501
|
+
},
|
502
|
+
subscribe: function(onNext) {
|
503
|
+
var onThrow = arguments[1] !== (void 0) ? arguments[1] : null;
|
504
|
+
var onReturn = arguments[2] !== (void 0) ? arguments[2] : null;
|
505
|
+
ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
|
506
|
+
}
|
507
|
+
}, {}));
|
508
|
+
$__export("Location", Location);
|
509
|
+
$__export("Location", Location = __decorate([Injectable(), __param(1, Optional()), __param(1, Inject(appBaseHrefToken)), __metadata('design:paramtypes', [LocationStrategy, String])], Location));
|
510
|
+
}
|
511
|
+
};
|
512
|
+
});
|
513
|
+
|
514
|
+
System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/url"], function($__export) {
|
515
|
+
"use strict";
|
516
|
+
var __moduleName = "angular2/src/router/path_recognizer";
|
517
|
+
var __decorate,
|
518
|
+
__metadata,
|
519
|
+
RegExpWrapper,
|
520
|
+
StringWrapper,
|
521
|
+
isPresent,
|
522
|
+
BaseException,
|
523
|
+
normalizeBlank,
|
524
|
+
StringMapWrapper,
|
525
|
+
ListWrapper,
|
526
|
+
IMPLEMENTS,
|
527
|
+
escapeRegex,
|
528
|
+
Segment,
|
529
|
+
ContinuationSegment,
|
530
|
+
StaticSegment,
|
531
|
+
DynamicSegment,
|
532
|
+
StarSegment,
|
533
|
+
paramMatcher,
|
534
|
+
wildcardMatcher,
|
535
|
+
PathRecognizer;
|
536
|
+
function parsePathString(route) {
|
537
|
+
if (StringWrapper.startsWith(route, "/")) {
|
538
|
+
route = StringWrapper.substring(route, 1);
|
539
|
+
}
|
540
|
+
var segments = splitBySlash(route);
|
541
|
+
var results = [];
|
542
|
+
var specificity = 0;
|
543
|
+
if (segments.length > 98) {
|
544
|
+
throw new BaseException(("'" + route + "' has more than the maximum supported number of segments."));
|
545
|
+
}
|
546
|
+
var limit = segments.length - 1;
|
547
|
+
for (var i = 0; i <= limit; i++) {
|
548
|
+
var segment = segments[i],
|
549
|
+
match = void 0;
|
550
|
+
if (isPresent(match = RegExpWrapper.firstMatch(paramMatcher, segment))) {
|
551
|
+
results.push(new DynamicSegment(match[1]));
|
552
|
+
specificity += (100 - i);
|
553
|
+
} else if (isPresent(match = RegExpWrapper.firstMatch(wildcardMatcher, segment))) {
|
554
|
+
results.push(new StarSegment(match[1]));
|
555
|
+
} else if (segment == '...') {
|
556
|
+
if (i < limit) {
|
557
|
+
throw new BaseException(("Unexpected \"...\" before the end of the path for \"" + route + "\"."));
|
558
|
+
}
|
559
|
+
results.push(new ContinuationSegment());
|
560
|
+
} else if (segment.length > 0) {
|
561
|
+
results.push(new StaticSegment(segment));
|
562
|
+
specificity += 100 * (100 - i);
|
563
|
+
}
|
564
|
+
}
|
565
|
+
return {
|
566
|
+
segments: results,
|
567
|
+
specificity: specificity
|
568
|
+
};
|
569
|
+
}
|
570
|
+
function splitBySlash(url) {
|
571
|
+
return url.split('/');
|
572
|
+
}
|
573
|
+
return {
|
574
|
+
setters: [function($__m) {
|
575
|
+
RegExpWrapper = $__m.RegExpWrapper;
|
576
|
+
StringWrapper = $__m.StringWrapper;
|
577
|
+
isPresent = $__m.isPresent;
|
578
|
+
BaseException = $__m.BaseException;
|
579
|
+
normalizeBlank = $__m.normalizeBlank;
|
580
|
+
IMPLEMENTS = $__m.IMPLEMENTS;
|
581
|
+
}, function($__m) {
|
582
|
+
StringMapWrapper = $__m.StringMapWrapper;
|
583
|
+
ListWrapper = $__m.ListWrapper;
|
584
|
+
}, function($__m) {
|
585
|
+
escapeRegex = $__m.escapeRegex;
|
586
|
+
}],
|
587
|
+
execute: function() {
|
588
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
589
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
590
|
+
return Reflect.decorate(decorators, target, key, desc);
|
591
|
+
switch (arguments.length) {
|
592
|
+
case 2:
|
593
|
+
return decorators.reduceRight(function(o, d) {
|
594
|
+
return (d && d(o)) || o;
|
595
|
+
}, target);
|
596
|
+
case 3:
|
597
|
+
return decorators.reduceRight(function(o, d) {
|
598
|
+
return (d && d(target, key)), void 0;
|
599
|
+
}, void 0);
|
600
|
+
case 4:
|
601
|
+
return decorators.reduceRight(function(o, d) {
|
602
|
+
return (d && d(target, key, o)) || o;
|
603
|
+
}, desc);
|
604
|
+
}
|
605
|
+
};
|
606
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
607
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
608
|
+
return Reflect.metadata(k, v);
|
609
|
+
};
|
610
|
+
Segment = (function() {
|
611
|
+
function Segment() {}
|
612
|
+
return ($traceurRuntime.createClass)(Segment, {}, {});
|
613
|
+
}());
|
614
|
+
$__export("Segment", Segment);
|
615
|
+
ContinuationSegment = (function($__super) {
|
616
|
+
function ContinuationSegment() {
|
617
|
+
$traceurRuntime.superConstructor(ContinuationSegment).apply(this, arguments);
|
618
|
+
}
|
619
|
+
return ($traceurRuntime.createClass)(ContinuationSegment, {generate: function(params) {
|
620
|
+
return '';
|
621
|
+
}}, {}, $__super);
|
622
|
+
}(Segment));
|
623
|
+
$__export("ContinuationSegment", ContinuationSegment);
|
624
|
+
StaticSegment = (function($__super) {
|
625
|
+
function StaticSegment(string) {
|
626
|
+
$traceurRuntime.superConstructor(StaticSegment).call(this);
|
627
|
+
this.string = string;
|
628
|
+
this.name = '';
|
629
|
+
this.regex = escapeRegex(string);
|
630
|
+
}
|
631
|
+
return ($traceurRuntime.createClass)(StaticSegment, {generate: function(params) {
|
632
|
+
return this.string;
|
633
|
+
}}, {}, $__super);
|
634
|
+
}(Segment));
|
635
|
+
DynamicSegment = (($traceurRuntime.createClass)(function(name) {
|
636
|
+
this.name = name;
|
637
|
+
this.regex = "([^/]+)";
|
638
|
+
}, {generate: function(params) {
|
639
|
+
if (!StringMapWrapper.contains(params, this.name)) {
|
640
|
+
throw new BaseException(("Route generator for '" + this.name + "' was not included in parameters passed."));
|
641
|
+
}
|
642
|
+
return normalizeBlank(StringMapWrapper.get(params, this.name));
|
643
|
+
}}, {}));
|
644
|
+
DynamicSegment = __decorate([IMPLEMENTS(Segment), __metadata('design:paramtypes', [String])], DynamicSegment);
|
645
|
+
StarSegment = (function() {
|
646
|
+
function StarSegment(name) {
|
647
|
+
this.name = name;
|
648
|
+
this.regex = "(.+)";
|
649
|
+
}
|
650
|
+
return ($traceurRuntime.createClass)(StarSegment, {generate: function(params) {
|
651
|
+
return normalizeBlank(StringMapWrapper.get(params, this.name));
|
652
|
+
}}, {});
|
653
|
+
}());
|
654
|
+
paramMatcher = RegExpWrapper.create("^:([^\/]+)$");
|
655
|
+
wildcardMatcher = RegExpWrapper.create("^\\*([^\/]+)$");
|
656
|
+
PathRecognizer = (function() {
|
657
|
+
function PathRecognizer(path, handler) {
|
658
|
+
var $__0 = this;
|
659
|
+
this.path = path;
|
660
|
+
this.handler = handler;
|
661
|
+
this.terminal = true;
|
662
|
+
this.segments = [];
|
663
|
+
var parsed = parsePathString(path);
|
664
|
+
var specificity = parsed['specificity'];
|
665
|
+
var segments = parsed['segments'];
|
666
|
+
var regexString = '^';
|
667
|
+
ListWrapper.forEach(segments, (function(segment) {
|
668
|
+
if (segment instanceof ContinuationSegment) {
|
669
|
+
$__0.terminal = false;
|
670
|
+
} else {
|
671
|
+
regexString += '/' + segment.regex;
|
672
|
+
}
|
673
|
+
}));
|
674
|
+
if (this.terminal) {
|
675
|
+
regexString += '$';
|
676
|
+
}
|
677
|
+
this.regex = RegExpWrapper.create(regexString);
|
678
|
+
this.segments = segments;
|
679
|
+
this.specificity = specificity;
|
680
|
+
}
|
681
|
+
return ($traceurRuntime.createClass)(PathRecognizer, {
|
682
|
+
parseParams: function(url) {
|
683
|
+
var params = StringMapWrapper.create();
|
684
|
+
var urlPart = url;
|
685
|
+
for (var i = 0; i < this.segments.length; i++) {
|
686
|
+
var segment = this.segments[i];
|
687
|
+
if (segment instanceof ContinuationSegment) {
|
688
|
+
continue;
|
689
|
+
}
|
690
|
+
var match = RegExpWrapper.firstMatch(RegExpWrapper.create('/' + segment.regex), urlPart);
|
691
|
+
urlPart = StringWrapper.substring(urlPart, match[0].length);
|
692
|
+
if (segment.name.length > 0) {
|
693
|
+
StringMapWrapper.set(params, segment.name, match[1]);
|
694
|
+
}
|
695
|
+
}
|
696
|
+
return params;
|
697
|
+
},
|
698
|
+
generate: function(params) {
|
699
|
+
return ListWrapper.join(ListWrapper.map(this.segments, (function(segment) {
|
700
|
+
return '/' + segment.generate(params);
|
701
|
+
})), '');
|
702
|
+
}
|
703
|
+
}, {});
|
704
|
+
}());
|
705
|
+
$__export("PathRecognizer", PathRecognizer);
|
706
|
+
}
|
707
|
+
};
|
708
|
+
});
|
709
|
+
|
710
|
+
System.register("angular2/src/router/router", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
|
711
|
+
"use strict";
|
712
|
+
var __moduleName = "angular2/src/router/router";
|
713
|
+
var PromiseWrapper,
|
714
|
+
EventEmitter,
|
715
|
+
ObservableWrapper,
|
716
|
+
List,
|
717
|
+
isBlank,
|
718
|
+
isPresent,
|
719
|
+
Router,
|
720
|
+
RootRouter,
|
721
|
+
ChildRouter;
|
722
|
+
return {
|
723
|
+
setters: [function($__m) {
|
724
|
+
PromiseWrapper = $__m.PromiseWrapper;
|
725
|
+
EventEmitter = $__m.EventEmitter;
|
726
|
+
ObservableWrapper = $__m.ObservableWrapper;
|
727
|
+
}, function($__m) {
|
728
|
+
List = $__m.List;
|
729
|
+
}, function($__m) {
|
730
|
+
isBlank = $__m.isBlank;
|
731
|
+
isPresent = $__m.isPresent;
|
732
|
+
}],
|
733
|
+
execute: function() {
|
734
|
+
Router = (function() {
|
735
|
+
function Router(_registry, _pipeline, parent, hostComponent) {
|
736
|
+
this._registry = _registry;
|
737
|
+
this._pipeline = _pipeline;
|
738
|
+
this.parent = parent;
|
739
|
+
this.hostComponent = hostComponent;
|
740
|
+
this.navigating = false;
|
741
|
+
this.previousUrl = null;
|
742
|
+
this._outlet = null;
|
743
|
+
this._subject = new EventEmitter();
|
744
|
+
this._currentInstruction = null;
|
745
|
+
this._currentNavigation = PromiseWrapper.resolve(true);
|
746
|
+
}
|
747
|
+
return ($traceurRuntime.createClass)(Router, {
|
748
|
+
childRouter: function(hostComponent) {
|
749
|
+
return new ChildRouter(this, hostComponent);
|
750
|
+
},
|
751
|
+
registerOutlet: function(outlet) {
|
752
|
+
this._outlet = outlet;
|
753
|
+
if (isPresent(this._currentInstruction)) {
|
754
|
+
return outlet.activate(this._currentInstruction);
|
755
|
+
}
|
756
|
+
return PromiseWrapper.resolve(true);
|
757
|
+
},
|
758
|
+
config: function(config) {
|
759
|
+
var $__0 = this;
|
760
|
+
if (config instanceof List) {
|
761
|
+
config.forEach((function(configObject) {
|
762
|
+
$__0._registry.config($__0.hostComponent, configObject);
|
763
|
+
}));
|
764
|
+
} else {
|
765
|
+
this._registry.config(this.hostComponent, config);
|
766
|
+
}
|
767
|
+
return this.renavigate();
|
768
|
+
},
|
769
|
+
navigate: function(url) {
|
770
|
+
var $__0 = this;
|
771
|
+
if (this.navigating) {
|
772
|
+
return this._currentNavigation;
|
773
|
+
}
|
774
|
+
this.lastNavigationAttempt = url;
|
775
|
+
return this._currentNavigation = this.recognize(url).then((function(matchedInstruction) {
|
776
|
+
if (isBlank(matchedInstruction)) {
|
777
|
+
return PromiseWrapper.resolve(false);
|
778
|
+
}
|
779
|
+
if (isPresent($__0._currentInstruction)) {
|
780
|
+
matchedInstruction.reuseComponentsFrom($__0._currentInstruction);
|
781
|
+
}
|
782
|
+
$__0._startNavigating();
|
783
|
+
var result = $__0.commit(matchedInstruction).then((function(_) {
|
784
|
+
$__0._finishNavigating();
|
785
|
+
ObservableWrapper.callNext($__0._subject, matchedInstruction.accumulatedUrl);
|
786
|
+
}));
|
787
|
+
return PromiseWrapper.catchError(result, (function(err) {
|
788
|
+
$__0._finishNavigating();
|
789
|
+
throw err;
|
790
|
+
}));
|
791
|
+
}));
|
792
|
+
},
|
793
|
+
_startNavigating: function() {
|
794
|
+
this.navigating = true;
|
795
|
+
},
|
796
|
+
_finishNavigating: function() {
|
797
|
+
this.navigating = false;
|
798
|
+
},
|
799
|
+
subscribe: function(onNext) {
|
800
|
+
ObservableWrapper.subscribe(this._subject, onNext);
|
801
|
+
},
|
802
|
+
commit: function(instruction) {
|
803
|
+
this._currentInstruction = instruction;
|
804
|
+
if (isPresent(this._outlet)) {
|
805
|
+
return this._outlet.activate(instruction);
|
806
|
+
}
|
807
|
+
return PromiseWrapper.resolve(true);
|
808
|
+
},
|
809
|
+
deactivate: function() {
|
810
|
+
if (isPresent(this._outlet)) {
|
811
|
+
return this._outlet.deactivate();
|
812
|
+
}
|
813
|
+
return PromiseWrapper.resolve(true);
|
814
|
+
},
|
815
|
+
recognize: function(url) {
|
816
|
+
return this._registry.recognize(url, this.hostComponent);
|
817
|
+
},
|
818
|
+
renavigate: function() {
|
819
|
+
var destination = isBlank(this.previousUrl) ? this.lastNavigationAttempt : this.previousUrl;
|
820
|
+
if (isBlank(destination)) {
|
821
|
+
return this._currentNavigation;
|
822
|
+
}
|
823
|
+
return this.navigate(destination);
|
824
|
+
},
|
825
|
+
generate: function(name, params) {
|
826
|
+
return this._registry.generate(name, params, this.hostComponent);
|
827
|
+
}
|
828
|
+
}, {});
|
829
|
+
}());
|
830
|
+
$__export("Router", Router);
|
831
|
+
RootRouter = (function($__super) {
|
832
|
+
function RootRouter(registry, pipeline, location, hostComponent) {
|
833
|
+
var $__0;
|
834
|
+
$traceurRuntime.superConstructor(RootRouter).call(this, registry, pipeline, null, hostComponent);
|
835
|
+
this._location = location;
|
836
|
+
this._location.subscribe(($__0 = this, function(change) {
|
837
|
+
return $__0.navigate(change['url']);
|
838
|
+
}));
|
839
|
+
this._registry.configFromComponent(hostComponent);
|
840
|
+
this.navigate(location.path());
|
841
|
+
}
|
842
|
+
return ($traceurRuntime.createClass)(RootRouter, {commit: function(instruction) {
|
843
|
+
var $__0 = this;
|
844
|
+
return $traceurRuntime.superGet(this, RootRouter.prototype, "commit").call(this, instruction).then((function(_) {
|
845
|
+
$__0._location.go(instruction.accumulatedUrl);
|
846
|
+
}));
|
847
|
+
}}, {}, $__super);
|
848
|
+
}(Router));
|
849
|
+
$__export("RootRouter", RootRouter);
|
850
|
+
ChildRouter = (function($__super) {
|
851
|
+
function ChildRouter(parent, hostComponent) {
|
852
|
+
$traceurRuntime.superConstructor(ChildRouter).call(this, parent._registry, parent._pipeline, parent, hostComponent);
|
853
|
+
this.parent = parent;
|
854
|
+
}
|
855
|
+
return ($traceurRuntime.createClass)(ChildRouter, {}, {}, $__super);
|
856
|
+
}(Router));
|
857
|
+
}
|
858
|
+
};
|
859
|
+
});
|
860
|
+
|
861
|
+
System.register("angular2/src/router/router_link", ["angular2/src/core/annotations/annotations", "angular2/src/core/annotations/decorators", "angular2/core", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/router/router", "angular2/src/router/location", "angular2/src/render/api"], function($__export) {
|
862
|
+
"use strict";
|
863
|
+
var __moduleName = "angular2/src/router/router_link";
|
864
|
+
var __decorate,
|
865
|
+
__metadata,
|
866
|
+
onAllChangesDone,
|
867
|
+
Directive,
|
868
|
+
ElementRef,
|
869
|
+
StringMapWrapper,
|
870
|
+
isPresent,
|
871
|
+
Router,
|
872
|
+
Location,
|
873
|
+
Renderer,
|
874
|
+
RouterLink;
|
875
|
+
return {
|
876
|
+
setters: [function($__m) {
|
877
|
+
onAllChangesDone = $__m.onAllChangesDone;
|
878
|
+
}, function($__m) {
|
879
|
+
Directive = $__m.Directive;
|
880
|
+
}, function($__m) {
|
881
|
+
ElementRef = $__m.ElementRef;
|
882
|
+
}, function($__m) {
|
883
|
+
StringMapWrapper = $__m.StringMapWrapper;
|
884
|
+
}, function($__m) {
|
885
|
+
isPresent = $__m.isPresent;
|
886
|
+
}, function($__m) {
|
887
|
+
Router = $__m.Router;
|
888
|
+
}, function($__m) {
|
889
|
+
Location = $__m.Location;
|
890
|
+
}, function($__m) {
|
891
|
+
Renderer = $__m.Renderer;
|
892
|
+
}],
|
893
|
+
execute: function() {
|
894
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
895
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
896
|
+
return Reflect.decorate(decorators, target, key, desc);
|
897
|
+
switch (arguments.length) {
|
898
|
+
case 2:
|
899
|
+
return decorators.reduceRight(function(o, d) {
|
900
|
+
return (d && d(o)) || o;
|
901
|
+
}, target);
|
902
|
+
case 3:
|
903
|
+
return decorators.reduceRight(function(o, d) {
|
904
|
+
return (d && d(target, key)), void 0;
|
905
|
+
}, void 0);
|
906
|
+
case 4:
|
907
|
+
return decorators.reduceRight(function(o, d) {
|
908
|
+
return (d && d(target, key, o)) || o;
|
909
|
+
}, desc);
|
910
|
+
}
|
911
|
+
};
|
912
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
913
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
914
|
+
return Reflect.metadata(k, v);
|
915
|
+
};
|
916
|
+
RouterLink = (($traceurRuntime.createClass)(function(_elementRef, _router, _location, _renderer) {
|
917
|
+
this._elementRef = _elementRef;
|
918
|
+
this._router = _router;
|
919
|
+
this._location = _location;
|
920
|
+
this._renderer = _renderer;
|
921
|
+
this._params = StringMapWrapper.create();
|
922
|
+
}, {
|
923
|
+
set route(changes) {
|
924
|
+
this._route = changes;
|
925
|
+
},
|
926
|
+
set params(changes) {
|
927
|
+
this._params = changes;
|
928
|
+
},
|
929
|
+
onClick: function() {
|
930
|
+
this._router.navigate(this._navigationHref);
|
931
|
+
return false;
|
932
|
+
},
|
933
|
+
onAllChangesDone: function() {
|
934
|
+
if (isPresent(this._route) && isPresent(this._params)) {
|
935
|
+
this._navigationHref = this._router.generate(this._route, this._params);
|
936
|
+
this._visibleHref = this._location.normalizeAbsolutely(this._navigationHref);
|
937
|
+
this._renderer.setElementAttribute(this._elementRef, 'href', this._visibleHref);
|
938
|
+
}
|
939
|
+
}
|
940
|
+
}, {}));
|
941
|
+
$__export("RouterLink", RouterLink);
|
942
|
+
$__export("RouterLink", RouterLink = __decorate([Directive({
|
943
|
+
selector: '[router-link]',
|
944
|
+
properties: ['route: routerLink', 'params: routerParams'],
|
945
|
+
lifecycle: [onAllChangesDone],
|
946
|
+
host: {'(^click)': 'onClick()'}
|
947
|
+
}), __metadata('design:paramtypes', [ElementRef, Router, Location, Renderer])], RouterLink));
|
948
|
+
}
|
949
|
+
};
|
950
|
+
});
|
951
|
+
|
952
|
+
System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/path_recognizer"], function($__export) {
|
953
|
+
"use strict";
|
954
|
+
var __moduleName = "angular2/src/router/route_recognizer";
|
955
|
+
var RegExpWrapper,
|
956
|
+
StringWrapper,
|
957
|
+
isPresent,
|
958
|
+
BaseException,
|
959
|
+
Map,
|
960
|
+
MapWrapper,
|
961
|
+
PathRecognizer,
|
962
|
+
RouteRecognizer,
|
963
|
+
RouteMatch;
|
964
|
+
return {
|
965
|
+
setters: [function($__m) {
|
966
|
+
RegExpWrapper = $__m.RegExpWrapper;
|
967
|
+
StringWrapper = $__m.StringWrapper;
|
968
|
+
isPresent = $__m.isPresent;
|
969
|
+
BaseException = $__m.BaseException;
|
970
|
+
}, function($__m) {
|
971
|
+
Map = $__m.Map;
|
972
|
+
MapWrapper = $__m.MapWrapper;
|
973
|
+
}, function($__m) {
|
974
|
+
PathRecognizer = $__m.PathRecognizer;
|
975
|
+
}],
|
976
|
+
execute: function() {
|
977
|
+
RouteRecognizer = (function() {
|
978
|
+
function RouteRecognizer() {
|
979
|
+
this.names = new Map();
|
980
|
+
this.matchers = new Map();
|
981
|
+
this.redirects = new Map();
|
982
|
+
}
|
983
|
+
return ($traceurRuntime.createClass)(RouteRecognizer, {
|
984
|
+
addRedirect: function(path, target) {
|
985
|
+
if (path == '/') {
|
986
|
+
path = '';
|
987
|
+
}
|
988
|
+
this.redirects.set(path, target);
|
989
|
+
},
|
990
|
+
addConfig: function(path, handler) {
|
991
|
+
var alias = arguments[2] !== (void 0) ? arguments[2] : null;
|
992
|
+
var recognizer = new PathRecognizer(path, handler);
|
993
|
+
MapWrapper.forEach(this.matchers, (function(matcher, _) {
|
994
|
+
if (recognizer.regex.toString() == matcher.regex.toString()) {
|
995
|
+
throw new BaseException(("Configuration '" + path + "' conflicts with existing route '" + matcher.path + "'"));
|
996
|
+
}
|
997
|
+
}));
|
998
|
+
this.matchers.set(recognizer.regex, recognizer);
|
999
|
+
if (isPresent(alias)) {
|
1000
|
+
this.names.set(alias, recognizer);
|
1001
|
+
}
|
1002
|
+
return recognizer.terminal;
|
1003
|
+
},
|
1004
|
+
recognize: function(url) {
|
1005
|
+
var solutions = [];
|
1006
|
+
if (url.length > 0 && url[url.length - 1] == '/') {
|
1007
|
+
url = url.substring(0, url.length - 1);
|
1008
|
+
}
|
1009
|
+
MapWrapper.forEach(this.redirects, (function(target, path) {
|
1010
|
+
if (path == '/' || path == '') {
|
1011
|
+
if (path == url) {
|
1012
|
+
url = target;
|
1013
|
+
}
|
1014
|
+
} else if (StringWrapper.startsWith(url, path)) {
|
1015
|
+
url = target + StringWrapper.substring(url, path.length);
|
1016
|
+
}
|
1017
|
+
}));
|
1018
|
+
MapWrapper.forEach(this.matchers, (function(pathRecognizer, regex) {
|
1019
|
+
var match;
|
1020
|
+
if (isPresent(match = RegExpWrapper.firstMatch(regex, url))) {
|
1021
|
+
var matchedUrl = '/';
|
1022
|
+
var unmatchedUrl = '';
|
1023
|
+
if (url != '/') {
|
1024
|
+
matchedUrl = match[0];
|
1025
|
+
unmatchedUrl = StringWrapper.substring(url, match[0].length);
|
1026
|
+
}
|
1027
|
+
solutions.push(new RouteMatch({
|
1028
|
+
specificity: pathRecognizer.specificity,
|
1029
|
+
handler: pathRecognizer.handler,
|
1030
|
+
params: pathRecognizer.parseParams(url),
|
1031
|
+
matchedUrl: matchedUrl,
|
1032
|
+
unmatchedUrl: unmatchedUrl
|
1033
|
+
}));
|
1034
|
+
}
|
1035
|
+
}));
|
1036
|
+
return solutions;
|
1037
|
+
},
|
1038
|
+
hasRoute: function(name) {
|
1039
|
+
return this.names.has(name);
|
1040
|
+
},
|
1041
|
+
generate: function(name, params) {
|
1042
|
+
var pathRecognizer = this.names.get(name);
|
1043
|
+
return isPresent(pathRecognizer) ? pathRecognizer.generate(params) : null;
|
1044
|
+
}
|
1045
|
+
}, {});
|
1046
|
+
}());
|
1047
|
+
$__export("RouteRecognizer", RouteRecognizer);
|
1048
|
+
RouteMatch = (function() {
|
1049
|
+
function RouteMatch() {
|
1050
|
+
var $__1 = arguments[0] !== (void 0) ? arguments[0] : {},
|
1051
|
+
specificity = $__1.specificity,
|
1052
|
+
handler = $__1.handler,
|
1053
|
+
params = $__1.params,
|
1054
|
+
matchedUrl = $__1.matchedUrl,
|
1055
|
+
unmatchedUrl = $__1.unmatchedUrl;
|
1056
|
+
this.specificity = specificity;
|
1057
|
+
this.handler = handler;
|
1058
|
+
this.params = params;
|
1059
|
+
this.matchedUrl = matchedUrl;
|
1060
|
+
this.unmatchedUrl = unmatchedUrl;
|
1061
|
+
}
|
1062
|
+
return ($traceurRuntime.createClass)(RouteMatch, {}, {});
|
1063
|
+
}());
|
1064
|
+
$__export("RouteMatch", RouteMatch);
|
1065
|
+
}
|
1066
|
+
};
|
1067
|
+
});
|
1068
|
+
|
1069
|
+
System.register("angular2/src/router/route_registry", ["angular2/src/router/route_recognizer", "angular2/src/router/instruction", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/router/route_config_impl", "angular2/src/reflection/reflection"], function($__export) {
|
1070
|
+
"use strict";
|
1071
|
+
var __moduleName = "angular2/src/router/route_registry";
|
1072
|
+
var RouteRecognizer,
|
1073
|
+
Instruction,
|
1074
|
+
ListWrapper,
|
1075
|
+
Map,
|
1076
|
+
StringMapWrapper,
|
1077
|
+
PromiseWrapper,
|
1078
|
+
isPresent,
|
1079
|
+
isBlank,
|
1080
|
+
isType,
|
1081
|
+
isStringMap,
|
1082
|
+
BaseException,
|
1083
|
+
RouteConfig,
|
1084
|
+
reflector,
|
1085
|
+
RouteRegistry,
|
1086
|
+
ALLOWED_TARGETS,
|
1087
|
+
VALID_COMPONENT_TYPES;
|
1088
|
+
function assertValidConfig(config) {
|
1089
|
+
if (!StringMapWrapper.contains(config, 'path')) {
|
1090
|
+
throw new BaseException("Route config should contain a \"path\" property");
|
1091
|
+
}
|
1092
|
+
var targets = 0;
|
1093
|
+
ListWrapper.forEach(ALLOWED_TARGETS, (function(target) {
|
1094
|
+
if (StringMapWrapper.contains(config, target)) {
|
1095
|
+
targets += 1;
|
1096
|
+
}
|
1097
|
+
}));
|
1098
|
+
if (targets != 1) {
|
1099
|
+
throw new BaseException("Route config should contain exactly one 'component', or 'redirectTo' property");
|
1100
|
+
}
|
1101
|
+
}
|
1102
|
+
function normalizeComponentDeclaration(config) {
|
1103
|
+
if (isType(config)) {
|
1104
|
+
return {
|
1105
|
+
'constructor': config,
|
1106
|
+
'type': 'constructor'
|
1107
|
+
};
|
1108
|
+
} else if (isStringMap(config)) {
|
1109
|
+
if (isBlank(config['type'])) {
|
1110
|
+
throw new BaseException("Component declaration when provided as a map should include a 'type' property");
|
1111
|
+
}
|
1112
|
+
var componentType = config['type'];
|
1113
|
+
if (!ListWrapper.contains(VALID_COMPONENT_TYPES, componentType)) {
|
1114
|
+
throw new BaseException(("Invalid component type '" + componentType + "'"));
|
1115
|
+
}
|
1116
|
+
return config;
|
1117
|
+
} else {
|
1118
|
+
throw new BaseException("Component declaration should be either a Map or a Type");
|
1119
|
+
}
|
1120
|
+
}
|
1121
|
+
function componentHandlerToComponentType(handler) {
|
1122
|
+
var componentDeclaration = handler['component'],
|
1123
|
+
type = componentDeclaration['type'];
|
1124
|
+
if (type == 'constructor') {
|
1125
|
+
return PromiseWrapper.resolve(componentDeclaration['constructor']);
|
1126
|
+
} else if (type == 'loader') {
|
1127
|
+
var resolverFunction = componentDeclaration['loader'];
|
1128
|
+
return resolverFunction();
|
1129
|
+
} else {
|
1130
|
+
throw new BaseException(("Cannot extract the component type from a '" + type + "' component"));
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
function mostSpecific(instructions) {
|
1134
|
+
var mostSpecificSolution = instructions[0];
|
1135
|
+
for (var solutionIndex = 1; solutionIndex < instructions.length; solutionIndex++) {
|
1136
|
+
var solution = instructions[solutionIndex];
|
1137
|
+
if (solution.specificity > mostSpecificSolution.specificity) {
|
1138
|
+
mostSpecificSolution = solution;
|
1139
|
+
}
|
1140
|
+
}
|
1141
|
+
return mostSpecificSolution;
|
1142
|
+
}
|
1143
|
+
function assertTerminalComponent(component, path) {
|
1144
|
+
if (!isType(component)) {
|
1145
|
+
return ;
|
1146
|
+
}
|
1147
|
+
var annotations = reflector.annotations(component);
|
1148
|
+
if (isPresent(annotations)) {
|
1149
|
+
for (var i = 0; i < annotations.length; i++) {
|
1150
|
+
var annotation = annotations[i];
|
1151
|
+
if (annotation instanceof RouteConfig) {
|
1152
|
+
throw new BaseException(("Child routes are not allowed for \"" + path + "\". Use \"...\" on the parent's route path."));
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
}
|
1157
|
+
return {
|
1158
|
+
setters: [function($__m) {
|
1159
|
+
RouteRecognizer = $__m.RouteRecognizer;
|
1160
|
+
}, function($__m) {
|
1161
|
+
Instruction = $__m.Instruction;
|
1162
|
+
}, function($__m) {
|
1163
|
+
ListWrapper = $__m.ListWrapper;
|
1164
|
+
Map = $__m.Map;
|
1165
|
+
StringMapWrapper = $__m.StringMapWrapper;
|
1166
|
+
}, function($__m) {
|
1167
|
+
PromiseWrapper = $__m.PromiseWrapper;
|
1168
|
+
}, function($__m) {
|
1169
|
+
isPresent = $__m.isPresent;
|
1170
|
+
isBlank = $__m.isBlank;
|
1171
|
+
isType = $__m.isType;
|
1172
|
+
isStringMap = $__m.isStringMap;
|
1173
|
+
BaseException = $__m.BaseException;
|
1174
|
+
}, function($__m) {
|
1175
|
+
RouteConfig = $__m.RouteConfig;
|
1176
|
+
}, function($__m) {
|
1177
|
+
reflector = $__m.reflector;
|
1178
|
+
}],
|
1179
|
+
execute: function() {
|
1180
|
+
RouteRegistry = (function() {
|
1181
|
+
function RouteRegistry() {
|
1182
|
+
this._rules = new Map();
|
1183
|
+
}
|
1184
|
+
return ($traceurRuntime.createClass)(RouteRegistry, {
|
1185
|
+
config: function(parentComponent, config) {
|
1186
|
+
assertValidConfig(config);
|
1187
|
+
var recognizer = this._rules.get(parentComponent);
|
1188
|
+
if (isBlank(recognizer)) {
|
1189
|
+
recognizer = new RouteRecognizer();
|
1190
|
+
this._rules.set(parentComponent, recognizer);
|
1191
|
+
}
|
1192
|
+
if (StringMapWrapper.contains(config, 'redirectTo')) {
|
1193
|
+
recognizer.addRedirect(config['path'], config['redirectTo']);
|
1194
|
+
return ;
|
1195
|
+
}
|
1196
|
+
config = StringMapWrapper.merge(config, {'component': normalizeComponentDeclaration(config['component'])});
|
1197
|
+
var component = config['component'];
|
1198
|
+
var terminal = recognizer.addConfig(config['path'], config, config['as']);
|
1199
|
+
if (component['type'] == 'constructor') {
|
1200
|
+
if (terminal) {
|
1201
|
+
assertTerminalComponent(component['constructor'], config['path']);
|
1202
|
+
} else {
|
1203
|
+
this.configFromComponent(component['constructor']);
|
1204
|
+
}
|
1205
|
+
}
|
1206
|
+
},
|
1207
|
+
configFromComponent: function(component) {
|
1208
|
+
var $__0 = this;
|
1209
|
+
if (!isType(component)) {
|
1210
|
+
return ;
|
1211
|
+
}
|
1212
|
+
if (this._rules.has(component)) {
|
1213
|
+
return ;
|
1214
|
+
}
|
1215
|
+
var annotations = reflector.annotations(component);
|
1216
|
+
if (isPresent(annotations)) {
|
1217
|
+
for (var i = 0; i < annotations.length; i++) {
|
1218
|
+
var annotation = annotations[i];
|
1219
|
+
if (annotation instanceof RouteConfig) {
|
1220
|
+
ListWrapper.forEach(annotation.configs, (function(config) {
|
1221
|
+
return $__0.config(component, config);
|
1222
|
+
}));
|
1223
|
+
}
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
},
|
1227
|
+
recognize: function(url, parentComponent) {
|
1228
|
+
var $__0 = this;
|
1229
|
+
var componentRecognizer = this._rules.get(parentComponent);
|
1230
|
+
if (isBlank(componentRecognizer)) {
|
1231
|
+
return PromiseWrapper.resolve(null);
|
1232
|
+
}
|
1233
|
+
var possibleMatches = componentRecognizer.recognize(url);
|
1234
|
+
var matchPromises = ListWrapper.map(possibleMatches, (function(candidate) {
|
1235
|
+
return $__0._completeRouteMatch(candidate);
|
1236
|
+
}));
|
1237
|
+
return PromiseWrapper.all(matchPromises).then((function(solutions) {
|
1238
|
+
var fullSolutions = ListWrapper.filter(solutions, (function(solution) {
|
1239
|
+
return isPresent(solution);
|
1240
|
+
}));
|
1241
|
+
if (fullSolutions.length > 0) {
|
1242
|
+
return mostSpecific(fullSolutions);
|
1243
|
+
}
|
1244
|
+
return null;
|
1245
|
+
}));
|
1246
|
+
},
|
1247
|
+
_completeRouteMatch: function(candidate) {
|
1248
|
+
var $__0 = this;
|
1249
|
+
return componentHandlerToComponentType(candidate.handler).then((function(componentType) {
|
1250
|
+
$__0.configFromComponent(componentType);
|
1251
|
+
if (candidate.unmatchedUrl.length == 0) {
|
1252
|
+
return new Instruction({
|
1253
|
+
component: componentType,
|
1254
|
+
params: candidate.params,
|
1255
|
+
matchedUrl: candidate.matchedUrl,
|
1256
|
+
parentSpecificity: candidate.specificity
|
1257
|
+
});
|
1258
|
+
}
|
1259
|
+
return $__0.recognize(candidate.unmatchedUrl, componentType).then((function(childInstruction) {
|
1260
|
+
if (isBlank(childInstruction)) {
|
1261
|
+
return null;
|
1262
|
+
}
|
1263
|
+
return new Instruction({
|
1264
|
+
component: componentType,
|
1265
|
+
child: childInstruction,
|
1266
|
+
params: candidate.params,
|
1267
|
+
matchedUrl: candidate.matchedUrl,
|
1268
|
+
parentSpecificity: candidate.specificity
|
1269
|
+
});
|
1270
|
+
}));
|
1271
|
+
}));
|
1272
|
+
},
|
1273
|
+
generate: function(name, params, hostComponent) {
|
1274
|
+
var componentRecognizer = this._rules.get(hostComponent);
|
1275
|
+
return isPresent(componentRecognizer) ? componentRecognizer.generate(name, params) : null;
|
1276
|
+
}
|
1277
|
+
}, {});
|
1278
|
+
}());
|
1279
|
+
$__export("RouteRegistry", RouteRegistry);
|
1280
|
+
ALLOWED_TARGETS = ['component', 'redirectTo'];
|
1281
|
+
VALID_COMPONENT_TYPES = ['constructor', 'loader'];
|
1282
|
+
}
|
1283
|
+
};
|
1284
|
+
});
|
1285
|
+
|
1286
|
+
System.register("angular2/src/router/router_outlet", ["angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/core/annotations/decorators", "angular2/core", "angular2/di", "angular2/src/router/router", "angular2/src/router/instruction"], function($__export) {
|
1287
|
+
"use strict";
|
1288
|
+
var __moduleName = "angular2/src/router/router_outlet";
|
1289
|
+
var __decorate,
|
1290
|
+
__metadata,
|
1291
|
+
__param,
|
1292
|
+
PromiseWrapper,
|
1293
|
+
isPresent,
|
1294
|
+
Directive,
|
1295
|
+
Attribute,
|
1296
|
+
DynamicComponentLoader,
|
1297
|
+
ElementRef,
|
1298
|
+
Injector,
|
1299
|
+
bind,
|
1300
|
+
routerMod,
|
1301
|
+
RouteParams,
|
1302
|
+
RouterOutlet;
|
1303
|
+
return {
|
1304
|
+
setters: [function($__m) {
|
1305
|
+
PromiseWrapper = $__m.PromiseWrapper;
|
1306
|
+
}, function($__m) {
|
1307
|
+
isPresent = $__m.isPresent;
|
1308
|
+
}, function($__m) {
|
1309
|
+
Directive = $__m.Directive;
|
1310
|
+
Attribute = $__m.Attribute;
|
1311
|
+
}, function($__m) {
|
1312
|
+
DynamicComponentLoader = $__m.DynamicComponentLoader;
|
1313
|
+
ElementRef = $__m.ElementRef;
|
1314
|
+
}, function($__m) {
|
1315
|
+
Injector = $__m.Injector;
|
1316
|
+
bind = $__m.bind;
|
1317
|
+
}, function($__m) {
|
1318
|
+
routerMod = $__m;
|
1319
|
+
}, function($__m) {
|
1320
|
+
RouteParams = $__m.RouteParams;
|
1321
|
+
}],
|
1322
|
+
execute: function() {
|
1323
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
1324
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
1325
|
+
return Reflect.decorate(decorators, target, key, desc);
|
1326
|
+
switch (arguments.length) {
|
1327
|
+
case 2:
|
1328
|
+
return decorators.reduceRight(function(o, d) {
|
1329
|
+
return (d && d(o)) || o;
|
1330
|
+
}, target);
|
1331
|
+
case 3:
|
1332
|
+
return decorators.reduceRight(function(o, d) {
|
1333
|
+
return (d && d(target, key)), void 0;
|
1334
|
+
}, void 0);
|
1335
|
+
case 4:
|
1336
|
+
return decorators.reduceRight(function(o, d) {
|
1337
|
+
return (d && d(target, key, o)) || o;
|
1338
|
+
}, desc);
|
1339
|
+
}
|
1340
|
+
};
|
1341
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
1342
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
1343
|
+
return Reflect.metadata(k, v);
|
1344
|
+
};
|
1345
|
+
__param = (this && this.__param) || function(paramIndex, decorator) {
|
1346
|
+
return function(target, key) {
|
1347
|
+
decorator(target, key, paramIndex);
|
1348
|
+
};
|
1349
|
+
};
|
1350
|
+
RouterOutlet = (($traceurRuntime.createClass)(function(elementRef, _loader, _parentRouter, _injector, nameAttr) {
|
1351
|
+
this._loader = _loader;
|
1352
|
+
this._parentRouter = _parentRouter;
|
1353
|
+
this._injector = _injector;
|
1354
|
+
this._elementRef = elementRef;
|
1355
|
+
this._childRouter = null;
|
1356
|
+
this._componentRef = null;
|
1357
|
+
this._currentInstruction = null;
|
1358
|
+
this._parentRouter.registerOutlet(this);
|
1359
|
+
}, {
|
1360
|
+
activate: function(instruction) {
|
1361
|
+
var $__0 = this;
|
1362
|
+
if ((instruction == this._currentInstruction || instruction.reuse) && isPresent(this._childRouter)) {
|
1363
|
+
return this._childRouter.commit(instruction.child);
|
1364
|
+
}
|
1365
|
+
this._currentInstruction = instruction;
|
1366
|
+
this._childRouter = this._parentRouter.childRouter(instruction.component);
|
1367
|
+
var outletInjector = this._injector.resolveAndCreateChild([bind(RouteParams).toValue(new RouteParams(instruction.params)), bind(routerMod.Router).toValue(this._childRouter)]);
|
1368
|
+
return this.deactivate().then((function(_) {
|
1369
|
+
return $__0._loader.loadNextToLocation(instruction.component, $__0._elementRef, outletInjector);
|
1370
|
+
})).then((function(componentRef) {
|
1371
|
+
$__0._componentRef = componentRef;
|
1372
|
+
return $__0._childRouter.commit(instruction.child);
|
1373
|
+
}));
|
1374
|
+
},
|
1375
|
+
deactivate: function() {
|
1376
|
+
var $__0 = this;
|
1377
|
+
return (isPresent(this._childRouter) ? this._childRouter.deactivate() : PromiseWrapper.resolve(true)).then((function(_) {
|
1378
|
+
if (isPresent($__0._componentRef)) {
|
1379
|
+
$__0._componentRef.dispose();
|
1380
|
+
$__0._componentRef = null;
|
1381
|
+
}
|
1382
|
+
}));
|
1383
|
+
},
|
1384
|
+
canDeactivate: function(instruction) {
|
1385
|
+
return PromiseWrapper.resolve(true);
|
1386
|
+
}
|
1387
|
+
}, {}));
|
1388
|
+
$__export("RouterOutlet", RouterOutlet);
|
1389
|
+
$__export("RouterOutlet", RouterOutlet = __decorate([Directive({selector: 'router-outlet'}), __param(4, Attribute('name')), __metadata('design:paramtypes', [ElementRef, DynamicComponentLoader, routerMod.Router, Injector, String])], RouterOutlet));
|
1390
|
+
}
|
1391
|
+
};
|
1392
|
+
});
|
1393
|
+
|
1394
|
+
System.register("angular2/router", ["angular2/src/router/router", "angular2/src/router/router_outlet", "angular2/src/router/router_link", "angular2/src/router/instruction", "angular2/src/router/route_registry", "angular2/src/router/location_strategy", "angular2/src/router/hash_location_strategy", "angular2/src/router/html5_location_strategy", "angular2/src/router/location", "angular2/src/router/pipeline", "angular2/src/router/route_config_decorator", "angular2/src/core/application_tokens", "angular2/di", "angular2/src/facade/lang"], function($__export) {
|
1395
|
+
"use strict";
|
1396
|
+
var __moduleName = "angular2/router";
|
1397
|
+
var LocationStrategy,
|
1398
|
+
HTML5LocationStrategy,
|
1399
|
+
Router,
|
1400
|
+
RootRouter,
|
1401
|
+
RouterOutlet,
|
1402
|
+
RouterLink,
|
1403
|
+
RouteRegistry,
|
1404
|
+
Pipeline,
|
1405
|
+
Location,
|
1406
|
+
appComponentTypeToken,
|
1407
|
+
bind,
|
1408
|
+
CONST_EXPR,
|
1409
|
+
routerDirectives,
|
1410
|
+
routerInjectables;
|
1411
|
+
var $__exportNames = {
|
1412
|
+
routerDirectives: true,
|
1413
|
+
routerInjectables: true,
|
1414
|
+
undefined: true
|
1415
|
+
};
|
1416
|
+
return {
|
1417
|
+
setters: [function($__m) {
|
1418
|
+
Router = $__m.Router;
|
1419
|
+
RootRouter = $__m.RootRouter;
|
1420
|
+
$__export("Router", $__m.Router);
|
1421
|
+
$__export("RootRouter", $__m.RootRouter);
|
1422
|
+
}, function($__m) {
|
1423
|
+
RouterOutlet = $__m.RouterOutlet;
|
1424
|
+
$__export("RouterOutlet", $__m.RouterOutlet);
|
1425
|
+
}, function($__m) {
|
1426
|
+
RouterLink = $__m.RouterLink;
|
1427
|
+
$__export("RouterLink", $__m.RouterLink);
|
1428
|
+
}, function($__m) {
|
1429
|
+
$__export("RouteParams", $__m.RouteParams);
|
1430
|
+
}, function($__m) {
|
1431
|
+
RouteRegistry = $__m.RouteRegistry;
|
1432
|
+
$__export("RouteRegistry", $__m.RouteRegistry);
|
1433
|
+
}, function($__m) {
|
1434
|
+
LocationStrategy = $__m.LocationStrategy;
|
1435
|
+
$__export("LocationStrategy", $__m.LocationStrategy);
|
1436
|
+
}, function($__m) {
|
1437
|
+
$__export("HashLocationStrategy", $__m.HashLocationStrategy);
|
1438
|
+
}, function($__m) {
|
1439
|
+
HTML5LocationStrategy = $__m.HTML5LocationStrategy;
|
1440
|
+
$__export("HTML5LocationStrategy", $__m.HTML5LocationStrategy);
|
1441
|
+
}, function($__m) {
|
1442
|
+
Location = $__m.Location;
|
1443
|
+
$__export("Location", $__m.Location);
|
1444
|
+
$__export("appBaseHrefToken", $__m.appBaseHrefToken);
|
1445
|
+
}, function($__m) {
|
1446
|
+
Pipeline = $__m.Pipeline;
|
1447
|
+
$__export("Pipeline", $__m.Pipeline);
|
1448
|
+
}, function($__m) {
|
1449
|
+
Object.keys($__m).forEach(function(p) {
|
1450
|
+
if (!$__exportNames[p])
|
1451
|
+
$__export(p, $__m[p]);
|
1452
|
+
});
|
1453
|
+
}, function($__m) {
|
1454
|
+
appComponentTypeToken = $__m.appComponentTypeToken;
|
1455
|
+
}, function($__m) {
|
1456
|
+
bind = $__m.bind;
|
1457
|
+
}, function($__m) {
|
1458
|
+
CONST_EXPR = $__m.CONST_EXPR;
|
1459
|
+
}],
|
1460
|
+
execute: function() {
|
1461
|
+
routerDirectives = CONST_EXPR([RouterOutlet, RouterLink]);
|
1462
|
+
$__export("routerDirectives", routerDirectives);
|
1463
|
+
routerInjectables = [RouteRegistry, Pipeline, bind(LocationStrategy).toClass(HTML5LocationStrategy), Location, bind(Router).toFactory((function(registry, pipeline, location, appRoot) {
|
1464
|
+
return new RootRouter(registry, pipeline, location, appRoot);
|
1465
|
+
}), [RouteRegistry, Pipeline, Location, appComponentTypeToken])];
|
1466
|
+
$__export("routerInjectables", routerInjectables);
|
1467
|
+
}
|
1468
|
+
};
|
1469
|
+
});
|
1470
|
+
|
1471
|
+
//# sourceMappingURL=router.dev.js.map
|