ember-source 2.7.0.beta.2 → 2.7.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90c21da72b97a73931be4e54c767065212ecdc48
4
- data.tar.gz: 2728cf5afffd1abb96ab09c42cd32fb9d379078d
3
+ metadata.gz: a594c8e9c67550132a13c32311604b3a218f308c
4
+ data.tar.gz: cf31eba641a4bb747db8e94ee843f61114e233a1
5
5
  SHA512:
6
- metadata.gz: afbaf14740b760d8db29367a709a72aad50f980e0ae5ea82a60d6c00a524d6cd9ab84ce53d6ad3c5b334b241f9e2c2d52bd9ca09e8a39982e29ddc915a4029ec
7
- data.tar.gz: f4ee38ad6f0248a594b5b5a59f8a052e0b011ba5d98034ee1ee4e77986c17cb87e367eb45894acae4b54e1eb08ac25643af0d8f4fec15c07ef003364b609b0f8
6
+ metadata.gz: f3a9c579776bf514d9f2cf08f04b458d247be9519f0b589d5c3346b5ef33062bba753d76ca52f8858086cd6f7d71e50492f4b9f5da885fa2a303c2fdd569b793
7
+ data.tar.gz: 4faa2a66d654c9011855ec0574fdf4a13a8125083eb3e14ce55ad796ac9a591fb6a5e5cc0524e369aaced90a07608f4787ebe3bb5e0c26f9f2799131a62b1f8d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.7.0-beta.2
1
+ 2.7.0-beta.3
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 2.7.0-beta.2
9
+ * @version 2.7.0-beta.3
10
10
  */
11
11
 
12
12
  var enifed, requireModule, require, Ember;
@@ -2485,7 +2485,7 @@ enifed("ember/features", ["exports"], function (exports) {
2485
2485
  enifed("ember/version", ["exports"], function (exports) {
2486
2486
  "use strict";
2487
2487
 
2488
- exports.default = "2.7.0-beta.2";
2488
+ exports.default = "2.7.0-beta.3";
2489
2489
  });
2490
2490
  enifed('ember-console/index', ['exports', 'ember-environment'], function (exports, _emberEnvironment) {
2491
2491
  'use strict';
@@ -11525,7 +11525,7 @@ enifed('ember-runtime/computed/computed_macros', ['exports', 'ember-metal/debug'
11525
11525
 
11526
11526
  You may pass in more than two properties and even use
11527
11527
  property brace expansion. The computed property will
11528
- returns the first falsy value or last truthy value
11528
+ return the first falsy value or last truthy value
11529
11529
  just like JavaScript's `||` operator.
11530
11530
 
11531
11531
  Example
@@ -11567,7 +11567,7 @@ enifed('ember-runtime/computed/computed_macros', ['exports', 'ember-metal/debug'
11567
11567
 
11568
11568
  You may pass in more than two properties and even use
11569
11569
  property brace expansion. The computed property will
11570
- returns the first truthy value or last falsy value just
11570
+ return the first truthy value or last falsy value just
11571
11571
  like JavaScript's `||` operator.
11572
11572
 
11573
11573
  Example
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 2.7.0-beta.2
9
+ * @version 2.7.0-beta.3
10
10
  */
11
11
 
12
12
  var enifed, requireModule, require, Ember;
@@ -1161,7 +1161,7 @@ enifed("ember/features", ["exports"], function (exports) {
1161
1161
  enifed("ember/version", ["exports"], function (exports) {
1162
1162
  "use strict";
1163
1163
 
1164
- exports.default = "2.7.0-beta.2";
1164
+ exports.default = "2.7.0-beta.3";
1165
1165
  });
1166
1166
  enifed('ember-console/index', ['exports', 'ember-environment'], function (exports, _emberEnvironment) {
1167
1167
  'use strict';
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 2.7.0-beta.2
9
+ * @version 2.7.0-beta.3
10
10
  */
11
11
 
12
12
  var enifed, requireModule, require, Ember;
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 2.7.0-beta.2
9
+ * @version 2.7.0-beta.3
10
10
  */
11
11
 
12
12
  var enifed, requireModule, require, Ember;
@@ -3751,7 +3751,7 @@ enifed('ember/index', ['exports', 'ember-metal', 'ember-runtime', 'ember-views',
3751
3751
  enifed("ember/version", ["exports"], function (exports) {
3752
3752
  "use strict";
3753
3753
 
3754
- exports.default = "2.7.0-beta.2";
3754
+ exports.default = "2.7.0-beta.3";
3755
3755
  });
3756
3756
  enifed('ember-application/index', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-runtime/system/lazy_load', 'ember-application/system/resolver', 'ember-application/system/application', 'ember-application/system/application-instance', 'ember-application/system/engine', 'ember-application/system/engine-instance'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberRuntimeSystemLazy_load, _emberApplicationSystemResolver, _emberApplicationSystemApplication, _emberApplicationSystemApplicationInstance, _emberApplicationSystemEngine, _emberApplicationSystemEngineInstance) {
3757
3757
  'use strict';
@@ -9609,11 +9609,16 @@ enifed('ember-htmlbars/helper', ['exports', 'ember-runtime/system/object'], func
9609
9609
 
9610
9610
  ```js
9611
9611
  // app/helpers/format-currency.js
9612
- export default Ember.Helper.helper(function(params, hash) {
9613
- let cents = params[0];
9612
+ export function formatCurrency([cents], hash) {
9614
9613
  let currency = hash.currency;
9615
9614
  return `${currency}${cents * 0.01}`;
9616
9615
  });
9616
+
9617
+ export default Ember.Helper.helper(formatCurrency);
9618
+
9619
+ // tests/myhelper.js
9620
+ import { formatCurrency } from ..../helpers/myhelper
9621
+ // add some tests
9617
9622
  ```
9618
9623
 
9619
9624
  @static
@@ -31755,7 +31760,7 @@ enifed('ember-runtime/computed/computed_macros', ['exports', 'ember-metal/debug'
31755
31760
 
31756
31761
  You may pass in more than two properties and even use
31757
31762
  property brace expansion. The computed property will
31758
- returns the first falsy value or last truthy value
31763
+ return the first falsy value or last truthy value
31759
31764
  just like JavaScript's `||` operator.
31760
31765
 
31761
31766
  Example
@@ -31797,7 +31802,7 @@ enifed('ember-runtime/computed/computed_macros', ['exports', 'ember-metal/debug'
31797
31802
 
31798
31803
  You may pass in more than two properties and even use
31799
31804
  property brace expansion. The computed property will
31800
- returns the first truthy value or last falsy value just
31805
+ return the first truthy value or last falsy value just
31801
31806
  like JavaScript's `||` operator.
31802
31807
 
31803
31808
  Example
@@ -49077,9 +49082,100 @@ enifed("route-recognizer/dsl", ["exports"], function (exports) {
49077
49082
  }, this);
49078
49083
  };
49079
49084
  });
49080
- enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (exports, _routeRecognizerDsl) {
49085
+ enifed('route-recognizer/normalizer', ['exports'], function (exports) {
49086
+ // Match percent-encoded values (e.g. %3a, %3A, %25)
49081
49087
  'use strict';
49082
49088
 
49089
+ var PERCENT_ENCODED_VALUES = /%[a-fA-F0-9]{2}/g;
49090
+
49091
+ function toUpper(str) {
49092
+ return str.toUpperCase();
49093
+ }
49094
+
49095
+ // Turn percent-encoded values to upper case ("%3a" -> "%3A")
49096
+ function percentEncodedValuesToUpper(string) {
49097
+ return string.replace(PERCENT_ENCODED_VALUES, toUpper);
49098
+ }
49099
+
49100
+ // Normalizes percent-encoded values to upper-case and decodes percent-encoded
49101
+ // values that are not reserved (like unicode characters).
49102
+ // Safe to call multiple times on the same path.
49103
+ function normalizePath(path) {
49104
+ return path.split('/').map(normalizeSegment).join('/');
49105
+ }
49106
+
49107
+ function percentEncode(char) {
49108
+ return '%' + charToHex(char);
49109
+ }
49110
+
49111
+ function charToHex(char) {
49112
+ return char.charCodeAt(0).toString(16).toUpperCase();
49113
+ }
49114
+
49115
+ // Decodes percent-encoded values in the string except those
49116
+ // characters in `reservedHex`, where `reservedHex` is an array of 2-character
49117
+ // percent-encodings
49118
+ function decodeURIComponentExcept(string, reservedHex) {
49119
+ if (string.indexOf('%') === -1) {
49120
+ // If there is no percent char, there is no decoding that needs to
49121
+ // be done and we exit early
49122
+ return string;
49123
+ }
49124
+ string = percentEncodedValuesToUpper(string);
49125
+
49126
+ var result = '';
49127
+ var buffer = '';
49128
+ var idx = 0;
49129
+ while (idx < string.length) {
49130
+ var pIdx = string.indexOf('%', idx);
49131
+
49132
+ if (pIdx === -1) {
49133
+ // no percent char
49134
+ buffer += string.slice(idx);
49135
+ break;
49136
+ } else {
49137
+ // found percent char
49138
+ buffer += string.slice(idx, pIdx);
49139
+ idx = pIdx + 3;
49140
+
49141
+ var hex = string.slice(pIdx + 1, pIdx + 3);
49142
+ var encoded = '%' + hex;
49143
+
49144
+ if (reservedHex.indexOf(hex) === -1) {
49145
+ // encoded is not in reserved set, add to buffer
49146
+ buffer += encoded;
49147
+ } else {
49148
+ result += decodeURIComponent(buffer);
49149
+ buffer = '';
49150
+ result += encoded;
49151
+ }
49152
+ }
49153
+ }
49154
+ result += decodeURIComponent(buffer);
49155
+ return result;
49156
+ }
49157
+
49158
+ // Leave these characters in encoded state in segments
49159
+ var reservedSegmentChars = ['%', '/'];
49160
+ var reservedHex = reservedSegmentChars.map(charToHex);
49161
+
49162
+ function normalizeSegment(segment) {
49163
+ return decodeURIComponentExcept(segment, reservedHex);
49164
+ }
49165
+
49166
+ var Normalizer = {
49167
+ normalizeSegment: normalizeSegment,
49168
+ normalizePath: normalizePath
49169
+ };
49170
+
49171
+ exports.default = Normalizer;
49172
+ });
49173
+ enifed('route-recognizer', ['exports', 'route-recognizer/dsl', 'route-recognizer/normalizer'], function (exports, _routeRecognizerDsl, _routeRecognizerNormalizer) {
49174
+ 'use strict';
49175
+
49176
+ var normalizePath = _routeRecognizerNormalizer.default.normalizePath;
49177
+ var normalizeSegment = _routeRecognizerNormalizer.default.normalizeSegment;
49178
+
49083
49179
  var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
49084
49180
 
49085
49181
  var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
@@ -49106,7 +49202,7 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49106
49202
  // * `repeat`: true if the character specification can repeat
49107
49203
 
49108
49204
  function StaticSegment(string) {
49109
- this.string = string;
49205
+ this.string = normalizeSegment(string);
49110
49206
  }
49111
49207
  StaticSegment.prototype = {
49112
49208
  eachChar: function (currentState) {
@@ -49131,7 +49227,7 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49131
49227
  };
49132
49228
 
49133
49229
  function DynamicSegment(name) {
49134
- this.name = name;
49230
+ this.name = normalizeSegment(name);
49135
49231
  }
49136
49232
  DynamicSegment.prototype = {
49137
49233
  eachChar: function (currentState) {
@@ -49143,7 +49239,11 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49143
49239
  },
49144
49240
 
49145
49241
  generate: function (params) {
49146
- return params[this.name];
49242
+ if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS) {
49243
+ return encodeURIComponent(params[this.name]);
49244
+ } else {
49245
+ return params[this.name];
49246
+ }
49147
49247
  }
49148
49248
  };
49149
49249
 
@@ -49177,7 +49277,10 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49177
49277
  }
49178
49278
  };
49179
49279
 
49180
- function parse(route, names, specificity) {
49280
+ // The `names` will be populated with the paramter name for each dynamic/star
49281
+ // segment. `shouldDecodes` will be populated with a boolean for each dyanamic/star
49282
+ // segment, indicating whether it should be decoded during recognition.
49283
+ function parse(route, names, specificity, shouldDecodes) {
49181
49284
  // normalize route as not starting with a "/". Recognition will
49182
49285
  // also normalize.
49183
49286
  if (route.charAt(0) === "/") {
@@ -49191,7 +49294,7 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49191
49294
  // appear in. This system mirrors how the magnitude of numbers written as strings
49192
49295
  // works.
49193
49296
  // Consider a number written as: "abc". An example would be "200". Any other number written
49194
- // "xyz" will be smaller than "abc" so long as `a > z`. For instance, "199" is smaller
49297
+ // "xyz" will be smaller than "abc" so long as `a > x`. For instance, "199" is smaller
49195
49298
  // then "200", even though "y" and "z" (which are both 9) are larger than "0" (the value
49196
49299
  // of (`b` and `c`). This is because the leading symbol, "2", is larger than the other
49197
49300
  // leading symbol, "1".
@@ -49215,11 +49318,13 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49215
49318
  if (match = segment.match(/^:([^\/]+)$/)) {
49216
49319
  results[i] = new DynamicSegment(match[1]);
49217
49320
  names.push(match[1]);
49321
+ shouldDecodes.push(true);
49218
49322
  specificity.val += '3';
49219
49323
  } else if (match = segment.match(/^\*([^\/]+)$/)) {
49220
49324
  results[i] = new StarSegment(match[1]);
49221
- specificity.val += '1';
49222
49325
  names.push(match[1]);
49326
+ shouldDecodes.push(false);
49327
+ specificity.val += '1';
49223
49328
  } else if (segment === "") {
49224
49329
  results[i] = new EpsilonSegment();
49225
49330
  specificity.val += '2';
@@ -49309,13 +49414,11 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49309
49414
 
49310
49415
  // Find a list of child states matching the next character
49311
49416
  match: function (ch) {
49312
- // DEBUG "Processing `" + ch + "`:"
49313
49417
  var nextStates = this.nextStates,
49314
49418
  child,
49315
49419
  charSpec,
49316
49420
  chars;
49317
49421
 
49318
- // DEBUG " " + debugState(this)
49319
49422
  var returned = [];
49320
49423
 
49321
49424
  for (var i = 0; i < nextStates.length; i++) {
@@ -49336,34 +49439,8 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49336
49439
 
49337
49440
  return returned;
49338
49441
  }
49339
-
49340
- /** IF DEBUG
49341
- , debug: function() {
49342
- var charSpec = this.charSpec,
49343
- debug = "[",
49344
- chars = charSpec.validChars || charSpec.invalidChars;
49345
- if (charSpec.invalidChars) { debug += "^"; }
49346
- debug += chars;
49347
- debug += "]";
49348
- if (charSpec.repeat) { debug += "+"; }
49349
- return debug;
49350
- }
49351
- END IF **/
49352
49442
  };
49353
49443
 
49354
- /** IF DEBUG
49355
- function debug(log) {
49356
- console.log(log);
49357
- }
49358
-
49359
- function debugState(state) {
49360
- return state.nextStates.map(function(n) {
49361
- if (n.nextStates.length === 0) { return "( " + n.debug() + " [accepting] )"; }
49362
- return "( " + n.debug() + " <then> " + n.nextStates.map(function(s) { return s.debug() }).join(" or ") + " )";
49363
- }).join(", ")
49364
- }
49365
- END IF **/
49366
-
49367
49444
  // Sort the routes by specificity
49368
49445
  function sortSolutions(states) {
49369
49446
  return states.sort(function (a, b) {
@@ -49400,10 +49477,10 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49400
49477
  queryParams: null
49401
49478
  });
49402
49479
 
49403
- function findHandler(state, path, queryParams) {
49480
+ function findHandler(state, originalPath, queryParams) {
49404
49481
  var handlers = state.handlers,
49405
49482
  regex = state.regex;
49406
- var captures = path.match(regex),
49483
+ var captures = originalPath.match(regex),
49407
49484
  currentCapture = 1;
49408
49485
  var result = new RecognizeResults(queryParams);
49409
49486
 
@@ -49412,10 +49489,24 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49412
49489
  for (var i = 0; i < handlers.length; i++) {
49413
49490
  var handler = handlers[i],
49414
49491
  names = handler.names,
49492
+ shouldDecodes = handler.shouldDecodes,
49415
49493
  params = {};
49494
+ var name, shouldDecode, capture;
49416
49495
 
49417
49496
  for (var j = 0; j < names.length; j++) {
49418
- params[names[j]] = captures[currentCapture++];
49497
+ name = names[j];
49498
+ shouldDecode = shouldDecodes[j];
49499
+ capture = captures[currentCapture++];
49500
+
49501
+ if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS) {
49502
+ if (shouldDecode) {
49503
+ params[name] = decodeURIComponent(capture);
49504
+ } else {
49505
+ params[name] = capture;
49506
+ }
49507
+ } else {
49508
+ params[name] = capture;
49509
+ }
49419
49510
  }
49420
49511
 
49421
49512
  result[i] = { handler: handler.handler, params: params, isDynamic: !!names.length };
@@ -49456,9 +49547,10 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49456
49547
 
49457
49548
  for (var i = 0; i < routes.length; i++) {
49458
49549
  var route = routes[i],
49459
- names = [];
49550
+ names = [],
49551
+ shouldDecodes = [];
49460
49552
 
49461
- var segments = parse(route.path, names, specificity);
49553
+ var segments = parse(route.path, names, specificity, shouldDecodes);
49462
49554
 
49463
49555
  allSegments = allSegments.concat(segments);
49464
49556
 
@@ -49479,7 +49571,7 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49479
49571
  currentState = segment.eachChar(currentState);
49480
49572
  regex += segment.regex();
49481
49573
  }
49482
- var handler = { handler: route.handler, names: names };
49574
+ var handler = { handler: route.handler, names: names, shouldDecodes: shouldDecodes };
49483
49575
  handlers[i] = handler;
49484
49576
  }
49485
49577
 
@@ -49623,8 +49715,14 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49623
49715
  l,
49624
49716
  queryStart,
49625
49717
  queryParams = {},
49718
+ hashStart,
49626
49719
  isSlashDropped = false;
49627
49720
 
49721
+ hashStart = path.indexOf('#');
49722
+ if (hashStart !== -1) {
49723
+ path = path.substr(0, hashStart);
49724
+ }
49725
+
49628
49726
  queryStart = path.indexOf('?');
49629
49727
  if (queryStart !== -1) {
49630
49728
  var queryString = path.substr(queryStart + 1, path.length);
@@ -49632,17 +49730,22 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49632
49730
  queryParams = this.parseQueryString(queryString);
49633
49731
  }
49634
49732
 
49635
- path = decodeURI(path);
49636
-
49637
- // DEBUG GROUP path
49638
-
49639
49733
  if (path.charAt(0) !== "/") {
49640
49734
  path = "/" + path;
49641
49735
  }
49736
+ var originalPath = path;
49737
+
49738
+ if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS) {
49739
+ path = normalizePath(path);
49740
+ } else {
49741
+ path = decodeURI(path);
49742
+ originalPath = decodeURI(originalPath);
49743
+ }
49642
49744
 
49643
49745
  pathLen = path.length;
49644
49746
  if (pathLen > 1 && path.charAt(pathLen - 1) === "/") {
49645
49747
  path = path.substr(0, pathLen - 1);
49748
+ originalPath = originalPath.substr(0, pathLen - 1);
49646
49749
  isSlashDropped = true;
49647
49750
  }
49648
49751
 
@@ -49653,8 +49756,6 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49653
49756
  }
49654
49757
  }
49655
49758
 
49656
- // END DEBUG GROUP
49657
-
49658
49759
  var solutions = [];
49659
49760
  for (i = 0; i < states.length; i++) {
49660
49761
  if (states[i].handlers) {
@@ -49670,16 +49771,22 @@ enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (export
49670
49771
  // if a trailing slash was dropped and a star segment is the last segment
49671
49772
  // specified, put the trailing slash back
49672
49773
  if (isSlashDropped && state.regex.source.slice(-5) === "(.+)$") {
49673
- path = path + "/";
49774
+ originalPath = originalPath + "/";
49674
49775
  }
49675
- return findHandler(state, path, queryParams);
49776
+ return findHandler(state, originalPath, queryParams);
49676
49777
  }
49677
49778
  }
49678
49779
  };
49679
49780
 
49680
49781
  RouteRecognizer.prototype.map = _routeRecognizerDsl.default;
49681
49782
 
49682
- RouteRecognizer.VERSION = '0.1.9';
49783
+ RouteRecognizer.VERSION = '0.2.0';
49784
+
49785
+ // Set to false to opt-out of encoding and decoding path segments.
49786
+ // See https://github.com/tildeio/route-recognizer/pull/55
49787
+ RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS = true;
49788
+
49789
+ RouteRecognizer.Normalizer = _routeRecognizerNormalizer.default;
49683
49790
 
49684
49791
  exports.default = RouteRecognizer;
49685
49792
  });