brew-js-react 0.2.4 → 0.2.5

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.
@@ -244,8 +244,10 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
244
244
  any = _lib$util.any,
245
245
  single = _lib$util.single,
246
246
  kv = _lib$util.kv,
247
+ fill = _lib$util.fill,
247
248
  pick = _lib$util.pick,
248
249
  exclude = _lib$util.exclude,
250
+ mapObject = _lib$util.mapObject,
249
251
  mapGet = _lib$util.mapGet,
250
252
  mapRemove = _lib$util.mapRemove,
251
253
  arrRemove = _lib$util.arrRemove,
@@ -262,6 +264,7 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
262
264
  setImmediateOnce = _lib$util.setImmediateOnce,
263
265
  throwNotFunction = _lib$util.throwNotFunction,
264
266
  errorWithCode = _lib$util.errorWithCode,
267
+ isErrorWithCode = _lib$util.isErrorWithCode,
265
268
  util_keys = _lib$util.keys,
266
269
  values = _lib$util.values,
267
270
  util_hasOwnProperty = _lib$util.hasOwnProperty,
@@ -514,6 +517,19 @@ var animateIn = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_bre
514
517
 
515
518
  ;// CONCATENATED MODULE: ./src/include/brew-js/anim.js
516
519
 
520
+ ;// CONCATENATED MODULE: ./tmp/brew-js/util/path.js
521
+
522
+ var setBaseUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.setBaseUrl,
523
+ combinePath = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.combinePath,
524
+ normalizePath = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.normalizePath,
525
+ removeQueryAndHash = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.removeQueryAndHash,
526
+ withBaseUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.withBaseUrl,
527
+ toAbsoluteUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.toAbsoluteUrl,
528
+ toRelativeUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.toRelativeUrl,
529
+ isSubPathOf = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.isSubPathOf;
530
+
531
+ ;// CONCATENATED MODULE: ./src/include/brew-js/util/path.js
532
+
517
533
  ;// CONCATENATED MODULE: ./src/view.js
518
534
 
519
535
 
@@ -523,6 +539,7 @@ var animateIn = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_bre
523
539
 
524
540
 
525
541
 
542
+
526
543
  var view_root = zeta_dom_dom.root;
527
544
  var routeMap = new Map();
528
545
  var usedParams = {};
@@ -636,7 +653,7 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
636
653
  // when some views are not included in the list of allowed views
637
654
  var targetPath = linkTo(matched, getCurrentParams(matched, true));
638
655
 
639
- if (targetPath !== app_app.path) {
656
+ if (targetPath !== removeQueryAndHash(app_app.path)) {
640
657
  app_app.navigate(targetPath, true);
641
658
  }
642
659
  }
@@ -789,7 +806,8 @@ function getCurrentStates() {
789
806
  return states[history.state] || (states[history.state] = {});
790
807
  }
791
808
 
792
- function ViewState(value) {
809
+ function ViewState(key, value) {
810
+ this.key = key;
793
811
  this.value = value;
794
812
  }
795
813
 
@@ -871,20 +889,21 @@ function ViewStateContainer(props) {
871
889
  return {
872
890
  getState: function getState(uniqueId, key) {
873
891
  var cur = getCurrentStates();
874
- var state = cache[uniqueId] || (cache[uniqueId] = new ViewState(cur[key] && cur[key].value));
892
+ var state = cache[uniqueId] || (cache[uniqueId] = new ViewState(key, cur[key] && cur[key].value));
875
893
 
876
894
  if (container.active) {
877
895
  var stateId = state.stateId;
878
896
 
879
- if (stateId && stateId !== history.state) {
897
+ if (stateId && (stateId !== history.state || key !== state.key)) {
880
898
  var newValue = cur[key] && cur[key].value;
881
899
  emitter.emit('popstate', state, {
882
900
  newValue: newValue
883
901
  }); // detach value in previous history state from current one
884
902
 
885
- var previous = new ViewState(state.value);
886
- states[stateId][key] = previous;
903
+ var previous = new ViewState(state.key, state.value);
904
+ states[stateId][previous.key] = previous;
887
905
  state.value = newValue;
906
+ state.key = key;
888
907
  }
889
908
 
890
909
  state.stateId = history.state;
@@ -1093,6 +1112,7 @@ function StatefulMixin() {
1093
1112
  Mixin.call(this);
1094
1113
 
1095
1114
  _(this, {
1115
+ elements: new WeakSet(),
1096
1116
  states: {},
1097
1117
  prefix: '',
1098
1118
  counter: 0
@@ -1125,8 +1145,9 @@ definePrototype(StatefulMixin, Mixin, {
1125
1145
  var self = this;
1126
1146
  var state = self.state;
1127
1147
  return function (current) {
1128
- if (current && current !== state.element) {
1129
- state.element = current;
1148
+ state.element = current;
1149
+
1150
+ if (current && setAdd(_(self).elements, current)) {
1130
1151
  self.initElement(current, state);
1131
1152
  }
1132
1153
  };
@@ -1148,11 +1169,10 @@ definePrototype(StatefulMixin, Mixin, {
1148
1169
  var self = this;
1149
1170
  var clone = inherit(Object.getPrototypeOf(self), self);
1150
1171
 
1151
- _(clone, {
1152
- states: _(self).states,
1172
+ _(clone, extend({}, _(self), {
1153
1173
  prefix: randomId() + '.',
1154
1174
  counter: 0
1155
- });
1175
+ }));
1156
1176
 
1157
1177
  return clone;
1158
1178
  },
@@ -1339,18 +1359,6 @@ definePrototype(ErrorHandlerMixin, StatefulMixin, {
1339
1359
  });
1340
1360
  }
1341
1361
  });
1342
- ;// CONCATENATED MODULE: ./tmp/brew-js/var.js
1343
-
1344
- var getVarScope = undefined.getVarScope,
1345
- setVar = undefined.setVar,
1346
- declareVar = undefined.declareVar,
1347
- resetVar = undefined.resetVar,
1348
- getVar = undefined.getVar,
1349
- evaluate = undefined.evaluate,
1350
- evalAttr = undefined.evalAttr;
1351
-
1352
- ;// CONCATENATED MODULE: ./src/include/brew-js/var.js
1353
-
1354
1362
  ;// CONCATENATED MODULE: ./src/mixins/FlyoutToggleMixin.js
1355
1363
 
1356
1364
 
@@ -1379,9 +1387,8 @@ definePrototype(FlyoutToggleMixin, ClassNameMixin, {
1379
1387
 
1380
1388
 
1381
1389
 
1382
-
1383
1390
  var FlyoutMixinSuper = ClassNameMixin.prototype;
1384
- var varname = '__flyout' + randomId();
1391
+ var valueMap = new WeakMap();
1385
1392
  var flyoutMixinCounter = 0;
1386
1393
  function FlyoutMixin() {
1387
1394
  var self = this;
@@ -1422,7 +1429,9 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
1422
1429
  });
1423
1430
  },
1424
1431
  open: function open(value) {
1425
- return openFlyout(this.elements()[0], kv(varname, value));
1432
+ var element = this.elements()[0];
1433
+ valueMap.set(element, value);
1434
+ return openFlyout(element);
1426
1435
  },
1427
1436
  close: function close(value) {
1428
1437
  return closeFlyout(this.elements()[0], value);
@@ -1431,7 +1440,7 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
1431
1440
  var element = this.elements()[0];
1432
1441
  return this.onToggleState(function (opened) {
1433
1442
  if (opened) {
1434
- return callback(getVar(element, varname));
1443
+ return callback(valueMap.get(element));
1435
1444
  }
1436
1445
  });
1437
1446
  },
@@ -1447,7 +1456,6 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
1447
1456
 
1448
1457
  if (!element.id) {
1449
1458
  element.id = 'flyout-' + ++flyoutMixinCounter;
1450
- declareVar(element, varname, undefined);
1451
1459
  }
1452
1460
 
1453
1461
  app_app.on(element, {