rails-angularjs2 2.0.0.pre.alpha.31 → 2.0.0.pre.alpha.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails-angularjs2/version.rb +1 -1
- data/vendor/assets/javascripts/angular2.dev.js +3437 -2792
- data/vendor/assets/javascripts/angular2.js +3437 -2792
- data/vendor/assets/javascripts/angular2.min.js +24 -20
- data/vendor/assets/javascripts/angular2.sfx.dev.js +3847 -3116
- data/vendor/assets/javascripts/router.dev.js +214 -128
- data/vendor/assets/javascripts/router.dev.js.map +1 -1
- data/vendor/assets/javascripts/test_lib.dev.js +135 -149
- data/vendor/assets/javascripts/test_lib.dev.js.map +1 -1
- metadata +2 -2
@@ -213,6 +213,84 @@ System.register("angular2/src/router/url", ["angular2/src/facade/lang"], functio
|
|
213
213
|
};
|
214
214
|
});
|
215
215
|
|
216
|
+
System.register("angular2/src/router/route_config_impl", ["angular2/src/facade/lang"], function($__export) {
|
217
|
+
"use strict";
|
218
|
+
var __moduleName = "angular2/src/router/route_config_impl";
|
219
|
+
var __decorate,
|
220
|
+
__metadata,
|
221
|
+
CONST,
|
222
|
+
RouteConfig,
|
223
|
+
Route,
|
224
|
+
AsyncRoute,
|
225
|
+
Redirect;
|
226
|
+
return {
|
227
|
+
setters: [function($__m) {
|
228
|
+
CONST = $__m.CONST;
|
229
|
+
}],
|
230
|
+
execute: function() {
|
231
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
232
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
233
|
+
return Reflect.decorate(decorators, target, key, desc);
|
234
|
+
switch (arguments.length) {
|
235
|
+
case 2:
|
236
|
+
return decorators.reduceRight(function(o, d) {
|
237
|
+
return (d && d(o)) || o;
|
238
|
+
}, target);
|
239
|
+
case 3:
|
240
|
+
return decorators.reduceRight(function(o, d) {
|
241
|
+
return (d && d(target, key)), void 0;
|
242
|
+
}, void 0);
|
243
|
+
case 4:
|
244
|
+
return decorators.reduceRight(function(o, d) {
|
245
|
+
return (d && d(target, key, o)) || o;
|
246
|
+
}, desc);
|
247
|
+
}
|
248
|
+
};
|
249
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
250
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
251
|
+
return Reflect.metadata(k, v);
|
252
|
+
};
|
253
|
+
RouteConfig = (($traceurRuntime.createClass)(function(configs) {
|
254
|
+
this.configs = configs;
|
255
|
+
}, {}, {}));
|
256
|
+
$__export("RouteConfig", RouteConfig);
|
257
|
+
$__export("RouteConfig", RouteConfig = __decorate([CONST(), __metadata('design:paramtypes', [Object])], RouteConfig));
|
258
|
+
Route = (($traceurRuntime.createClass)(function($__2) {
|
259
|
+
var $__3 = $__2,
|
260
|
+
path = $__3.path,
|
261
|
+
component = $__3.component,
|
262
|
+
as = $__3.as;
|
263
|
+
this.path = path;
|
264
|
+
this.component = component;
|
265
|
+
this.as = as;
|
266
|
+
}, {}, {}));
|
267
|
+
$__export("Route", Route);
|
268
|
+
$__export("Route", Route = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Route));
|
269
|
+
AsyncRoute = (($traceurRuntime.createClass)(function($__2) {
|
270
|
+
var $__3 = $__2,
|
271
|
+
path = $__3.path,
|
272
|
+
loader = $__3.loader,
|
273
|
+
as = $__3.as;
|
274
|
+
this.path = path;
|
275
|
+
this.loader = loader;
|
276
|
+
this.as = as;
|
277
|
+
}, {}, {}));
|
278
|
+
$__export("AsyncRoute", AsyncRoute);
|
279
|
+
$__export("AsyncRoute", AsyncRoute = __decorate([CONST(), __metadata('design:paramtypes', [Object])], AsyncRoute));
|
280
|
+
Redirect = (($traceurRuntime.createClass)(function($__2) {
|
281
|
+
var $__3 = $__2,
|
282
|
+
path = $__3.path,
|
283
|
+
redirectTo = $__3.redirectTo;
|
284
|
+
this.as = null;
|
285
|
+
this.path = path;
|
286
|
+
this.redirectTo = redirectTo;
|
287
|
+
}, {}, {}));
|
288
|
+
$__export("Redirect", Redirect);
|
289
|
+
$__export("Redirect", Redirect = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Redirect));
|
290
|
+
}
|
291
|
+
};
|
292
|
+
});
|
293
|
+
|
216
294
|
System.register("angular2/src/router/async_route_handler", ["angular2/src/facade/lang"], function($__export) {
|
217
295
|
"use strict";
|
218
296
|
var __moduleName = "angular2/src/router/async_route_handler";
|
@@ -269,45 +347,24 @@ System.register("angular2/src/router/sync_route_handler", ["angular2/src/facade/
|
|
269
347
|
};
|
270
348
|
});
|
271
349
|
|
272
|
-
System.register("angular2/src/router/
|
350
|
+
System.register("angular2/src/router/route_config_decorator", ["angular2/src/router/route_config_impl", "angular2/src/util/decorators"], function($__export) {
|
273
351
|
"use strict";
|
274
|
-
var __moduleName = "angular2/src/router/
|
275
|
-
var
|
276
|
-
|
277
|
-
CONST,
|
352
|
+
var __moduleName = "angular2/src/router/route_config_decorator";
|
353
|
+
var RouteConfigAnnotation,
|
354
|
+
makeDecorator,
|
278
355
|
RouteConfig;
|
279
356
|
return {
|
280
357
|
setters: [function($__m) {
|
281
|
-
|
358
|
+
RouteConfigAnnotation = $__m.RouteConfig;
|
359
|
+
$__export("Route", $__m.Route);
|
360
|
+
$__export("Redirect", $__m.Redirect);
|
361
|
+
$__export("AsyncRoute", $__m.AsyncRoute);
|
362
|
+
}, function($__m) {
|
363
|
+
makeDecorator = $__m.makeDecorator;
|
282
364
|
}],
|
283
365
|
execute: function() {
|
284
|
-
|
285
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
286
|
-
return Reflect.decorate(decorators, target, key, desc);
|
287
|
-
switch (arguments.length) {
|
288
|
-
case 2:
|
289
|
-
return decorators.reduceRight(function(o, d) {
|
290
|
-
return (d && d(o)) || o;
|
291
|
-
}, target);
|
292
|
-
case 3:
|
293
|
-
return decorators.reduceRight(function(o, d) {
|
294
|
-
return (d && d(target, key)), void 0;
|
295
|
-
}, void 0);
|
296
|
-
case 4:
|
297
|
-
return decorators.reduceRight(function(o, d) {
|
298
|
-
return (d && d(target, key, o)) || o;
|
299
|
-
}, desc);
|
300
|
-
}
|
301
|
-
};
|
302
|
-
__metadata = (this && this.__metadata) || function(k, v) {
|
303
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
304
|
-
return Reflect.metadata(k, v);
|
305
|
-
};
|
306
|
-
RouteConfig = (($traceurRuntime.createClass)(function(configs) {
|
307
|
-
this.configs = configs;
|
308
|
-
}, {}, {}));
|
366
|
+
RouteConfig = makeDecorator(RouteConfigAnnotation);
|
309
367
|
$__export("RouteConfig", RouteConfig);
|
310
|
-
$__export("RouteConfig", RouteConfig = __decorate([CONST(), __metadata('design:paramtypes', [Object])], RouteConfig));
|
311
368
|
}
|
312
369
|
};
|
313
370
|
});
|
@@ -521,25 +578,6 @@ System.register("angular2/src/router/pipeline", ["angular2/src/facade/async", "a
|
|
521
578
|
};
|
522
579
|
});
|
523
580
|
|
524
|
-
System.register("angular2/src/router/route_config_decorator", ["angular2/src/router/route_config_impl", "angular2/src/util/decorators"], function($__export) {
|
525
|
-
"use strict";
|
526
|
-
var __moduleName = "angular2/src/router/route_config_decorator";
|
527
|
-
var RouteConfigAnnotation,
|
528
|
-
makeDecorator,
|
529
|
-
RouteConfig;
|
530
|
-
return {
|
531
|
-
setters: [function($__m) {
|
532
|
-
RouteConfigAnnotation = $__m.RouteConfig;
|
533
|
-
}, function($__m) {
|
534
|
-
makeDecorator = $__m.makeDecorator;
|
535
|
-
}],
|
536
|
-
execute: function() {
|
537
|
-
RouteConfig = makeDecorator(RouteConfigAnnotation);
|
538
|
-
$__export("RouteConfig", RouteConfig);
|
539
|
-
}
|
540
|
-
};
|
541
|
-
});
|
542
|
-
|
543
581
|
System.register("angular2/src/router/location", ["angular2/src/router/location_strategy", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/di"], function($__export) {
|
544
582
|
"use strict";
|
545
583
|
var __moduleName = "angular2/src/router/location";
|
@@ -551,6 +589,8 @@ System.register("angular2/src/router/location", ["angular2/src/router/location_s
|
|
551
589
|
CONST_EXPR,
|
552
590
|
EventEmitter,
|
553
591
|
ObservableWrapper,
|
592
|
+
BaseException,
|
593
|
+
isBlank,
|
554
594
|
OpaqueToken,
|
555
595
|
Injectable,
|
556
596
|
Optional,
|
@@ -575,6 +615,8 @@ System.register("angular2/src/router/location", ["angular2/src/router/location_s
|
|
575
615
|
}, function($__m) {
|
576
616
|
isPresent = $__m.isPresent;
|
577
617
|
CONST_EXPR = $__m.CONST_EXPR;
|
618
|
+
BaseException = $__m.BaseException;
|
619
|
+
isBlank = $__m.isBlank;
|
578
620
|
}, function($__m) {
|
579
621
|
EventEmitter = $__m.EventEmitter;
|
580
622
|
ObservableWrapper = $__m.ObservableWrapper;
|
@@ -618,7 +660,11 @@ System.register("angular2/src/router/location", ["angular2/src/router/location_s
|
|
618
660
|
var $__0 = this;
|
619
661
|
this._platformStrategy = _platformStrategy;
|
620
662
|
this._subject = new EventEmitter();
|
621
|
-
|
663
|
+
var browserBaseHref = isPresent(href) ? href : this._platformStrategy.getBaseHref();
|
664
|
+
if (isBlank(browserBaseHref)) {
|
665
|
+
throw new BaseException("No base href set. Either provide a binding to \"appBaseHrefToken\" or add a base element.");
|
666
|
+
}
|
667
|
+
this._baseHref = stripTrailingSlash(stripIndexHtml(browserBaseHref));
|
622
668
|
this._platformStrategy.onPopState((function(_) {
|
623
669
|
return $__0._onPopState(_);
|
624
670
|
}));
|
@@ -694,6 +740,7 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
694
740
|
StarSegment,
|
695
741
|
paramMatcher,
|
696
742
|
wildcardMatcher,
|
743
|
+
RESERVED_CHARS,
|
697
744
|
PathRecognizer;
|
698
745
|
function normalizeString(obj) {
|
699
746
|
if (isBlank(obj)) {
|
@@ -750,6 +797,15 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
750
797
|
function splitBySlash(url) {
|
751
798
|
return url.split('/');
|
752
799
|
}
|
800
|
+
function assertPath(path) {
|
801
|
+
if (StringWrapper.contains(path, '#')) {
|
802
|
+
throw new BaseException(("Path \"" + path + "\" should not include \"#\". Use \"HashLocationStrategy\" instead."));
|
803
|
+
}
|
804
|
+
var illegalCharacter = RegExpWrapper.firstMatch(RESERVED_CHARS, path);
|
805
|
+
if (isPresent(illegalCharacter)) {
|
806
|
+
throw new BaseException(("Path \"" + path + "\" contains \"" + illegalCharacter[0] + "\" which is not allowed in a route config."));
|
807
|
+
}
|
808
|
+
}
|
753
809
|
return {
|
754
810
|
setters: [function($__m) {
|
755
811
|
RegExpWrapper = $__m.RegExpWrapper;
|
@@ -861,12 +917,14 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
861
917
|
}());
|
862
918
|
paramMatcher = /^:([^\/]+)$/g;
|
863
919
|
wildcardMatcher = /^\*([^\/]+)$/g;
|
920
|
+
RESERVED_CHARS = RegExpWrapper.create('//|\\(|\\)|;|\\?|=');
|
864
921
|
PathRecognizer = (function() {
|
865
922
|
function PathRecognizer(path, handler) {
|
866
923
|
var $__0 = this;
|
867
924
|
this.path = path;
|
868
925
|
this.handler = handler;
|
869
926
|
this.terminal = true;
|
927
|
+
assertPath(path);
|
870
928
|
var parsed = parsePathString(path);
|
871
929
|
var specificity = parsed['specificity'];
|
872
930
|
var segments = parsed['segments'];
|
@@ -950,6 +1008,63 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
950
1008
|
};
|
951
1009
|
});
|
952
1010
|
|
1011
|
+
System.register("angular2/src/router/route_config_nomalizer", ["angular2/src/router/route_config_decorator", "angular2/src/facade/lang"], function($__export) {
|
1012
|
+
"use strict";
|
1013
|
+
var __moduleName = "angular2/src/router/route_config_nomalizer";
|
1014
|
+
var AsyncRoute,
|
1015
|
+
Route,
|
1016
|
+
Redirect,
|
1017
|
+
BaseException;
|
1018
|
+
function normalizeRouteConfig(config) {
|
1019
|
+
if (config instanceof Route || config instanceof Redirect || config instanceof AsyncRoute) {
|
1020
|
+
return config;
|
1021
|
+
}
|
1022
|
+
if ((!config.component) == (!config.redirectTo)) {
|
1023
|
+
throw new BaseException("Route config should contain exactly one 'component', or 'redirectTo' property");
|
1024
|
+
}
|
1025
|
+
if (config.component) {
|
1026
|
+
if (typeof config.component == 'object') {
|
1027
|
+
var componentDefinitionObject = config.component;
|
1028
|
+
if (componentDefinitionObject.type == 'constructor') {
|
1029
|
+
return new Route({
|
1030
|
+
path: config.path,
|
1031
|
+
component: componentDefinitionObject.constructor,
|
1032
|
+
as: config.as
|
1033
|
+
});
|
1034
|
+
} else if (componentDefinitionObject.type == 'loader') {
|
1035
|
+
return new AsyncRoute({
|
1036
|
+
path: config.path,
|
1037
|
+
loader: componentDefinitionObject.loader,
|
1038
|
+
as: config.as
|
1039
|
+
});
|
1040
|
+
} else {
|
1041
|
+
throw new BaseException(("Invalid component type '" + componentDefinitionObject.type + "'. Valid types are \"constructor\" and \"loader\"."));
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
return new Route(config);
|
1045
|
+
}
|
1046
|
+
if (config.redirectTo) {
|
1047
|
+
return new Redirect({
|
1048
|
+
path: config.path,
|
1049
|
+
redirectTo: config.redirectTo
|
1050
|
+
});
|
1051
|
+
}
|
1052
|
+
return config;
|
1053
|
+
}
|
1054
|
+
$__export("normalizeRouteConfig", normalizeRouteConfig);
|
1055
|
+
return {
|
1056
|
+
setters: [function($__m) {
|
1057
|
+
AsyncRoute = $__m.AsyncRoute;
|
1058
|
+
Route = $__m.Route;
|
1059
|
+
Redirect = $__m.Redirect;
|
1060
|
+
}, function($__m) {
|
1061
|
+
BaseException = $__m.BaseException;
|
1062
|
+
}],
|
1063
|
+
execute: function() {
|
1064
|
+
}
|
1065
|
+
};
|
1066
|
+
});
|
1067
|
+
|
953
1068
|
System.register("angular2/src/router/route_lifecycle_reflector", ["angular2/src/facade/lang", "angular2/src/router/lifecycle_annotations_impl", "angular2/src/reflection/reflection"], function($__export) {
|
954
1069
|
"use strict";
|
955
1070
|
var __moduleName = "angular2/src/router/route_lifecycle_reflector";
|
@@ -1053,7 +1168,7 @@ System.register("angular2/src/router/router_link", ["angular2/src/core/annotatio
|
|
1053
1168
|
};
|
1054
1169
|
});
|
1055
1170
|
|
1056
|
-
System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/path_recognizer", "angular2/src/router/async_route_handler", "angular2/src/router/sync_route_handler"], function($__export) {
|
1171
|
+
System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/path_recognizer", "angular2/src/router/route_config_impl", "angular2/src/router/async_route_handler", "angular2/src/router/sync_route_handler"], function($__export) {
|
1057
1172
|
"use strict";
|
1058
1173
|
var __moduleName = "angular2/src/router/route_recognizer";
|
1059
1174
|
var RegExpWrapper,
|
@@ -1065,6 +1180,9 @@ System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/la
|
|
1065
1180
|
Map,
|
1066
1181
|
MapWrapper,
|
1067
1182
|
PathRecognizer,
|
1183
|
+
Route,
|
1184
|
+
AsyncRoute,
|
1185
|
+
Redirect,
|
1068
1186
|
AsyncRouteHandler,
|
1069
1187
|
SyncRouteHandler,
|
1070
1188
|
RouteRecognizer,
|
@@ -1100,6 +1218,10 @@ System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/la
|
|
1100
1218
|
MapWrapper = $__m.MapWrapper;
|
1101
1219
|
}, function($__m) {
|
1102
1220
|
PathRecognizer = $__m.PathRecognizer;
|
1221
|
+
}, function($__m) {
|
1222
|
+
Route = $__m.Route;
|
1223
|
+
AsyncRoute = $__m.AsyncRoute;
|
1224
|
+
Redirect = $__m.Redirect;
|
1103
1225
|
}, function($__m) {
|
1104
1226
|
AsyncRouteHandler = $__m.AsyncRouteHandler;
|
1105
1227
|
}, function($__m) {
|
@@ -1113,24 +1235,26 @@ System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/la
|
|
1113
1235
|
this.matchers = new Map();
|
1114
1236
|
}
|
1115
1237
|
return ($traceurRuntime.createClass)(RouteRecognizer, {
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1238
|
+
config: function(config) {
|
1239
|
+
var handler;
|
1240
|
+
if (config instanceof Redirect) {
|
1241
|
+
var path = config.path == '/' ? '' : config.path;
|
1242
|
+
this.redirects.set(path, config.redirectTo);
|
1243
|
+
return true;
|
1244
|
+
} else if (config instanceof Route) {
|
1245
|
+
handler = new SyncRouteHandler(config.component);
|
1246
|
+
} else if (config instanceof AsyncRoute) {
|
1247
|
+
handler = new AsyncRouteHandler(config.loader);
|
1119
1248
|
}
|
1120
|
-
|
1121
|
-
},
|
1122
|
-
addConfig: function(path, handlerObj) {
|
1123
|
-
var alias = arguments[2] !== (void 0) ? arguments[2] : null;
|
1124
|
-
var handler = configObjToHandler(handlerObj['component']);
|
1125
|
-
var recognizer = new PathRecognizer(path, handler);
|
1249
|
+
var recognizer = new PathRecognizer(config.path, handler);
|
1126
1250
|
MapWrapper.forEach(this.matchers, (function(matcher, _) {
|
1127
1251
|
if (recognizer.regex.toString() == matcher.regex.toString()) {
|
1128
|
-
throw new BaseException(("Configuration '" + path + "' conflicts with existing route '" + matcher.path + "'"));
|
1252
|
+
throw new BaseException(("Configuration '" + config.path + "' conflicts with existing route '" + matcher.path + "'"));
|
1129
1253
|
}
|
1130
1254
|
}));
|
1131
1255
|
this.matchers.set(recognizer.regex, recognizer);
|
1132
|
-
if (isPresent(
|
1133
|
-
this.names.set(
|
1256
|
+
if (isPresent(config.as)) {
|
1257
|
+
this.names.set(config.as, recognizer);
|
1134
1258
|
}
|
1135
1259
|
return recognizer.terminal;
|
1136
1260
|
},
|
@@ -1205,7 +1329,6 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
1205
1329
|
isString,
|
1206
1330
|
StringWrapper,
|
1207
1331
|
isPresent,
|
1208
|
-
isArray,
|
1209
1332
|
BaseException,
|
1210
1333
|
getCanActivateHook,
|
1211
1334
|
_resolveToTrue,
|
@@ -1254,7 +1377,6 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
1254
1377
|
isString = $__m.isString;
|
1255
1378
|
StringWrapper = $__m.StringWrapper;
|
1256
1379
|
isPresent = $__m.isPresent;
|
1257
|
-
isArray = $__m.isArray;
|
1258
1380
|
BaseException = $__m.BaseException;
|
1259
1381
|
}, function($__m) {
|
1260
1382
|
getCanActivateHook = $__m.getCanActivateHook;
|
@@ -1285,15 +1407,11 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
1285
1407
|
}
|
1286
1408
|
return _resolveToTrue;
|
1287
1409
|
},
|
1288
|
-
config: function(
|
1410
|
+
config: function(definitions) {
|
1289
1411
|
var $__0 = this;
|
1290
|
-
|
1291
|
-
config.
|
1292
|
-
|
1293
|
-
}));
|
1294
|
-
} else {
|
1295
|
-
this.registry.config(this.hostComponent, config);
|
1296
|
-
}
|
1412
|
+
definitions.forEach((function(routeDefinition) {
|
1413
|
+
$__0.registry.config($__0.hostComponent, routeDefinition);
|
1414
|
+
}));
|
1297
1415
|
return this.renavigate();
|
1298
1416
|
},
|
1299
1417
|
navigate: function(url) {
|
@@ -1472,7 +1590,7 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
1472
1590
|
};
|
1473
1591
|
});
|
1474
1592
|
|
1475
|
-
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", "angular2/di"], function($__export) {
|
1593
|
+
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", "angular2/di", "angular2/src/router/route_config_nomalizer"], function($__export) {
|
1476
1594
|
"use strict";
|
1477
1595
|
var __moduleName = "angular2/src/router/route_registry";
|
1478
1596
|
var __decorate,
|
@@ -1481,7 +1599,6 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1481
1599
|
Instruction,
|
1482
1600
|
ListWrapper,
|
1483
1601
|
Map,
|
1484
|
-
StringMapWrapper,
|
1485
1602
|
PromiseWrapper,
|
1486
1603
|
isPresent,
|
1487
1604
|
isBlank,
|
@@ -1489,45 +1606,13 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1489
1606
|
isString,
|
1490
1607
|
isStringMap,
|
1491
1608
|
BaseException,
|
1609
|
+
getTypeNameForDebugging,
|
1492
1610
|
RouteConfig,
|
1611
|
+
Route,
|
1493
1612
|
reflector,
|
1494
1613
|
Injectable,
|
1495
|
-
|
1496
|
-
|
1497
|
-
VALID_COMPONENT_TYPES;
|
1498
|
-
function assertValidConfig(config) {
|
1499
|
-
if (!StringMapWrapper.contains(config, 'path')) {
|
1500
|
-
throw new BaseException("Route config should contain a \"path\" property");
|
1501
|
-
}
|
1502
|
-
var targets = 0;
|
1503
|
-
ListWrapper.forEach(ALLOWED_TARGETS, (function(target) {
|
1504
|
-
if (StringMapWrapper.contains(config, target)) {
|
1505
|
-
targets += 1;
|
1506
|
-
}
|
1507
|
-
}));
|
1508
|
-
if (targets != 1) {
|
1509
|
-
throw new BaseException("Route config should contain exactly one 'component', or 'redirectTo' property");
|
1510
|
-
}
|
1511
|
-
}
|
1512
|
-
function normalizeComponentDeclaration(config) {
|
1513
|
-
if (isType(config)) {
|
1514
|
-
return {
|
1515
|
-
'constructor': config,
|
1516
|
-
'type': 'constructor'
|
1517
|
-
};
|
1518
|
-
} else if (isStringMap(config)) {
|
1519
|
-
if (isBlank(config['type'])) {
|
1520
|
-
throw new BaseException("Component declaration when provided as a map should include a 'type' property");
|
1521
|
-
}
|
1522
|
-
var componentType = config['type'];
|
1523
|
-
if (!ListWrapper.contains(VALID_COMPONENT_TYPES, componentType)) {
|
1524
|
-
throw new BaseException(("Invalid component type '" + componentType + "'"));
|
1525
|
-
}
|
1526
|
-
return config;
|
1527
|
-
} else {
|
1528
|
-
throw new BaseException("Component declaration should be either a Map or a Type");
|
1529
|
-
}
|
1530
|
-
}
|
1614
|
+
normalizeRouteConfig,
|
1615
|
+
RouteRegistry;
|
1531
1616
|
function mostSpecific(instructions) {
|
1532
1617
|
var mostSpecificSolution = instructions[0];
|
1533
1618
|
for (var solutionIndex = 1; solutionIndex < instructions.length; solutionIndex++) {
|
@@ -1560,7 +1645,6 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1560
1645
|
}, function($__m) {
|
1561
1646
|
ListWrapper = $__m.ListWrapper;
|
1562
1647
|
Map = $__m.Map;
|
1563
|
-
StringMapWrapper = $__m.StringMapWrapper;
|
1564
1648
|
}, function($__m) {
|
1565
1649
|
PromiseWrapper = $__m.PromiseWrapper;
|
1566
1650
|
}, function($__m) {
|
@@ -1570,12 +1654,16 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1570
1654
|
isString = $__m.isString;
|
1571
1655
|
isStringMap = $__m.isStringMap;
|
1572
1656
|
BaseException = $__m.BaseException;
|
1657
|
+
getTypeNameForDebugging = $__m.getTypeNameForDebugging;
|
1573
1658
|
}, function($__m) {
|
1574
1659
|
RouteConfig = $__m.RouteConfig;
|
1660
|
+
Route = $__m.Route;
|
1575
1661
|
}, function($__m) {
|
1576
1662
|
reflector = $__m.reflector;
|
1577
1663
|
}, function($__m) {
|
1578
1664
|
Injectable = $__m.Injectable;
|
1665
|
+
}, function($__m) {
|
1666
|
+
normalizeRouteConfig = $__m.normalizeRouteConfig;
|
1579
1667
|
}],
|
1580
1668
|
execute: function() {
|
1581
1669
|
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
@@ -1604,24 +1692,18 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1604
1692
|
this._rules = new Map();
|
1605
1693
|
}, {
|
1606
1694
|
config: function(parentComponent, config) {
|
1607
|
-
|
1695
|
+
config = normalizeRouteConfig(config);
|
1608
1696
|
var recognizer = this._rules.get(parentComponent);
|
1609
1697
|
if (isBlank(recognizer)) {
|
1610
1698
|
recognizer = new RouteRecognizer();
|
1611
1699
|
this._rules.set(parentComponent, recognizer);
|
1612
1700
|
}
|
1613
|
-
|
1614
|
-
|
1615
|
-
return ;
|
1616
|
-
}
|
1617
|
-
config = StringMapWrapper.merge(config, {'component': normalizeComponentDeclaration(config['component'])});
|
1618
|
-
var component = config['component'];
|
1619
|
-
var terminal = recognizer.addConfig(config['path'], config, config['as']);
|
1620
|
-
if (component['type'] == 'constructor') {
|
1701
|
+
var terminal = recognizer.config(config);
|
1702
|
+
if (config instanceof Route) {
|
1621
1703
|
if (terminal) {
|
1622
|
-
assertTerminalComponent(component
|
1704
|
+
assertTerminalComponent(config.component, config.path);
|
1623
1705
|
} else {
|
1624
|
-
this.configFromComponent(component
|
1706
|
+
this.configFromComponent(config.component);
|
1625
1707
|
}
|
1626
1708
|
}
|
1627
1709
|
},
|
@@ -1692,6 +1774,9 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1692
1774
|
var componentCursor = parentComponent;
|
1693
1775
|
for (var i = 0; i < linkParams.length; i += 1) {
|
1694
1776
|
var segment = linkParams[i];
|
1777
|
+
if (isBlank(componentCursor)) {
|
1778
|
+
throw new BaseException(("Could not find route named \"" + segment + "\"."));
|
1779
|
+
}
|
1695
1780
|
if (!isString(segment)) {
|
1696
1781
|
throw new BaseException(("Unexpected segment \"" + segment + "\" in link DSL. Expected a string."));
|
1697
1782
|
} else if (segment == '' || segment == '.' || segment == '..') {
|
@@ -1707,9 +1792,12 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1707
1792
|
}
|
1708
1793
|
var componentRecognizer = this._rules.get(componentCursor);
|
1709
1794
|
if (isBlank(componentRecognizer)) {
|
1710
|
-
throw new BaseException(("
|
1795
|
+
throw new BaseException(("Component \"" + getTypeNameForDebugging(componentCursor) + "\" has no route config."));
|
1711
1796
|
}
|
1712
1797
|
var response = componentRecognizer.generate(segment, params);
|
1798
|
+
if (isBlank(response)) {
|
1799
|
+
throw new BaseException(("Component \"" + getTypeNameForDebugging(componentCursor) + "\" has no route named \"" + segment + "\"."));
|
1800
|
+
}
|
1713
1801
|
url += response['url'];
|
1714
1802
|
componentCursor = response['nextComponent'];
|
1715
1803
|
}
|
@@ -1718,8 +1806,6 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1718
1806
|
}, {}));
|
1719
1807
|
$__export("RouteRegistry", RouteRegistry);
|
1720
1808
|
$__export("RouteRegistry", RouteRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [])], RouteRegistry));
|
1721
|
-
ALLOWED_TARGETS = ['component', 'redirectTo'];
|
1722
|
-
VALID_COMPONENT_TYPES = ['constructor', 'loader'];
|
1723
1809
|
}
|
1724
1810
|
};
|
1725
1811
|
});
|