@angular/router 5.2.7 → 5.2.11

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v5.2.7
2
+ * @license Angular v5.2.11
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v5.2.7
2
+ * @license Angular v5.2.11
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/esm5/router.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v5.2.7
2
+ * @license Angular v5.2.11
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1225,7 +1225,7 @@ var DefaultUrlSerializer = /** @class */ (function () {
1225
1225
  function (tree) {
1226
1226
  var /** @type {?} */ segment = "/" + serializeSegment(tree.root, true);
1227
1227
  var /** @type {?} */ query = serializeQueryParams(tree.queryParams);
1228
- var /** @type {?} */ fragment = typeof tree.fragment === "string" ? "#" + encodeURI((/** @type {?} */ ((tree.fragment)))) : '';
1228
+ var /** @type {?} */ fragment = typeof tree.fragment === "string" ? "#" + encodeUriFragment((/** @type {?} */ ((tree.fragment)))) : '';
1229
1229
  return "" + segment + query + fragment;
1230
1230
  };
1231
1231
  return DefaultUrlSerializer;
@@ -1270,25 +1270,53 @@ function serializeSegment(segment, root) {
1270
1270
  }
1271
1271
  }
1272
1272
  /**
1273
- * This method is intended for encoding *key* or *value* parts of query component. We need a custom
1274
- * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
1275
- * encoded per http://tools.ietf.org/html/rfc3986:
1276
- * query = *( pchar / "/" / "?" )
1277
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "\@"
1278
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
1279
- * pct-encoded = "%" HEXDIG HEXDIG
1280
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
1281
- * / "*" / "+" / "," / ";" / "="
1273
+ * Encodes a URI string with the default encoding. This function will only ever be called from
1274
+ * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need
1275
+ * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't
1276
+ * have to be encoded per https://url.spec.whatwg.org.
1282
1277
  * @param {?} s
1283
1278
  * @return {?}
1284
1279
  */
1285
- function encode(s) {
1280
+ function encodeUriString(s) {
1286
1281
  return encodeURIComponent(s)
1287
1282
  .replace(/%40/g, '@')
1288
1283
  .replace(/%3A/gi, ':')
1289
1284
  .replace(/%24/g, '$')
1290
- .replace(/%2C/gi, ',')
1291
- .replace(/%3B/gi, ';');
1285
+ .replace(/%2C/gi, ',');
1286
+ }
1287
+ /**
1288
+ * This function should be used to encode both keys and values in a query string key/value. In
1289
+ * the following URL, you need to call encodeUriQuery on "k" and "v":
1290
+ *
1291
+ * http://www.site.org/html;mk=mv?k=v#f
1292
+ * @param {?} s
1293
+ * @return {?}
1294
+ */
1295
+ function encodeUriQuery(s) {
1296
+ return encodeUriString(s).replace(/%3B/gi, ';');
1297
+ }
1298
+ /**
1299
+ * This function should be used to encode a URL fragment. In the following URL, you need to call
1300
+ * encodeUriFragment on "f":
1301
+ *
1302
+ * http://www.site.org/html;mk=mv?k=v#f
1303
+ * @param {?} s
1304
+ * @return {?}
1305
+ */
1306
+ function encodeUriFragment(s) {
1307
+ return encodeURI(s);
1308
+ }
1309
+ /**
1310
+ * This function should be run on any URI segment as well as the key and value in a key/value
1311
+ * pair for matrix params. In the following URL, you need to call encodeUriSegment on "html",
1312
+ * "mk", and "mv":
1313
+ *
1314
+ * http://www.site.org/html;mk=mv?k=v#f
1315
+ * @param {?} s
1316
+ * @return {?}
1317
+ */
1318
+ function encodeUriSegment(s) {
1319
+ return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&');
1292
1320
  }
1293
1321
  /**
1294
1322
  * @param {?} s
@@ -1297,19 +1325,28 @@ function encode(s) {
1297
1325
  function decode(s) {
1298
1326
  return decodeURIComponent(s);
1299
1327
  }
1328
+ /**
1329
+ * @param {?} s
1330
+ * @return {?}
1331
+ */
1332
+ function decodeQuery(s) {
1333
+ return decode(s.replace(/\+/g, '%20'));
1334
+ }
1300
1335
  /**
1301
1336
  * @param {?} path
1302
1337
  * @return {?}
1303
1338
  */
1304
1339
  function serializePath(path) {
1305
- return "" + encode(path.path) + serializeParams(path.parameters);
1340
+ return "" + encodeUriSegment(path.path) + serializeMatrixParams(path.parameters);
1306
1341
  }
1307
1342
  /**
1308
1343
  * @param {?} params
1309
1344
  * @return {?}
1310
1345
  */
1311
- function serializeParams(params) {
1312
- return Object.keys(params).map(function (key) { return ";" + encode(key) + "=" + encode(params[key]); }).join('');
1346
+ function serializeMatrixParams(params) {
1347
+ return Object.keys(params)
1348
+ .map(function (key) { return ";" + encodeUriSegment(key) + "=" + encodeUriSegment(params[key]); })
1349
+ .join('');
1313
1350
  }
1314
1351
  /**
1315
1352
  * @param {?} params
@@ -1318,8 +1355,9 @@ function serializeParams(params) {
1318
1355
  function serializeQueryParams(params) {
1319
1356
  var /** @type {?} */ strParams = Object.keys(params).map(function (name) {
1320
1357
  var /** @type {?} */ value = params[name];
1321
- return Array.isArray(value) ? value.map(function (v) { return encode(name) + "=" + encode(v); }).join('&') :
1322
- encode(name) + "=" + encode(value);
1358
+ return Array.isArray(value) ?
1359
+ value.map(function (v) { return encodeUriQuery(name) + "=" + encodeUriQuery(v); }).join('&') :
1360
+ encodeUriQuery(name) + "=" + encodeUriQuery(value);
1323
1361
  });
1324
1362
  return strParams.length ? "?" + strParams.join("&") : '';
1325
1363
  }
@@ -1391,7 +1429,7 @@ var UrlParser = /** @class */ (function () {
1391
1429
  * @return {?}
1392
1430
  */
1393
1431
  function () {
1394
- return this.consumeOptional('#') ? decodeURI(this.remaining) : null;
1432
+ return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;
1395
1433
  };
1396
1434
  /**
1397
1435
  * @return {?}
@@ -1499,8 +1537,8 @@ var UrlParser = /** @class */ (function () {
1499
1537
  this.capture(value);
1500
1538
  }
1501
1539
  }
1502
- var /** @type {?} */ decodedKey = decode(key);
1503
- var /** @type {?} */ decodedVal = decode(value);
1540
+ var /** @type {?} */ decodedKey = decodeQuery(key);
1541
+ var /** @type {?} */ decodedVal = decodeQuery(value);
1504
1542
  if (params.hasOwnProperty(decodedKey)) {
1505
1543
  // Append to existing values
1506
1544
  var /** @type {?} */ currentVal = params[decodedKey];
@@ -2355,6 +2393,9 @@ function getOutlet(route) {
2355
2393
  * Use of this source code is governed by an MIT-style license that can be
2356
2394
  * found in the LICENSE file at https://angular.io/license
2357
2395
  */
2396
+ /**
2397
+ * @template T
2398
+ */
2358
2399
  var Tree = /** @class */ (function () {
2359
2400
  function Tree(root) {
2360
2401
  this._root = root;
@@ -2490,6 +2531,9 @@ function findPath(value, node) {
2490
2531
  }
2491
2532
  return [];
2492
2533
  }
2534
+ /**
2535
+ * @template T
2536
+ */
2493
2537
  var TreeNode = /** @class */ (function () {
2494
2538
  function TreeNode(value, children) {
2495
2539
  this.value = value;
@@ -7445,7 +7489,7 @@ function provideRouterInitializer() {
7445
7489
  /**
7446
7490
  * \@stable
7447
7491
  */
7448
- var VERSION = new Version('5.2.7');
7492
+ var VERSION = new Version('5.2.11');
7449
7493
 
7450
7494
  /**
7451
7495
  * @fileoverview added by tsickle