brew-js-react 0.1.7 → 0.1.10

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,16 +1,24 @@
1
1
  (function webpackUniversalModuleDefinition(root, factory) {
2
2
  if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"));
3
+ module.exports = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"), require("jQuery"));
4
4
  else if(typeof define === 'function' && define.amd)
5
- define("brew-js-react", ["brew-js", "react", "react-dom", "zeta-dom", "zeta-dom-react", "waterpipe"], factory);
5
+ define("brew-js-react", ["brew-js", "react", "react-dom", "zeta-dom", "zeta-dom-react", "waterpipe", "jQuery"], factory);
6
6
  else if(typeof exports === 'object')
7
- exports["brew-js-react"] = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"));
7
+ exports["brew-js-react"] = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"), require("jQuery"));
8
8
  else
9
- root["brew-js-react"] = factory(root["brew"], root["React"], root["ReactDOM"], root["zeta"], root["zeta-dom-react"], root["waterpipe"]);
10
- })(self, function(__WEBPACK_EXTERNAL_MODULE__80__, __WEBPACK_EXTERNAL_MODULE__359__, __WEBPACK_EXTERNAL_MODULE__318__, __WEBPACK_EXTERNAL_MODULE__654__, __WEBPACK_EXTERNAL_MODULE__103__, __WEBPACK_EXTERNAL_MODULE__28__) {
9
+ root["brew-js-react"] = factory(root["brew"], root["React"], root["ReactDOM"], root["zeta"], root["zeta-dom-react"], root["waterpipe"], root["jQuery"]);
10
+ })(self, function(__WEBPACK_EXTERNAL_MODULE__80__, __WEBPACK_EXTERNAL_MODULE__359__, __WEBPACK_EXTERNAL_MODULE__318__, __WEBPACK_EXTERNAL_MODULE__654__, __WEBPACK_EXTERNAL_MODULE__103__, __WEBPACK_EXTERNAL_MODULE__28__, __WEBPACK_EXTERNAL_MODULE__145__) {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
+ /***/ 145:
15
+ /***/ ((module) => {
16
+
17
+ "use strict";
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__145__;
19
+
20
+ /***/ }),
21
+
14
22
  /***/ 28:
15
23
  /***/ ((module) => {
16
24
 
@@ -59,6 +67,19 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__654__;
59
67
 
60
68
  /***/ }),
61
69
 
70
+ /***/ 346:
71
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
72
+
73
+ /// <reference types="jq-scrollable" />
74
+ // @ts-nocheck
75
+
76
+ /** @type {JQueryStatic} */
77
+ var jQuery = window.jQuery || __webpack_require__(145);
78
+
79
+ module.exports = jQuery;
80
+
81
+ /***/ }),
82
+
62
83
  /***/ 43:
63
84
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
64
85
 
@@ -148,6 +169,7 @@ __webpack_require__.d(src_namespaceObject, {
148
169
  "Dialog": () => (Dialog),
149
170
  "ErrorHandlerMixin": () => (ErrorHandlerMixin),
150
171
  "FlyoutMixin": () => (FlyoutMixin),
172
+ "FlyoutToggleMixin": () => (FlyoutToggleMixin),
151
173
  "FocusStateMixin": () => (FocusStateMixin),
152
174
  "LoadingStateMixin": () => (LoadingStateMixin),
153
175
  "Mixin": () => (Mixin),
@@ -227,10 +249,14 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
227
249
  combineFn = _lib$util.combineFn,
228
250
  executeOnce = _lib$util.executeOnce,
229
251
  createPrivateStore = _lib$util.createPrivateStore,
252
+ util_setTimeout = _lib$util.setTimeout,
230
253
  setTimeoutOnce = _lib$util.setTimeoutOnce,
254
+ util_setInterval = _lib$util.setInterval,
255
+ setIntervalSafe = _lib$util.setIntervalSafe,
231
256
  util_setImmediate = _lib$util.setImmediate,
232
257
  setImmediateOnce = _lib$util.setImmediateOnce,
233
258
  throwNotFunction = _lib$util.throwNotFunction,
259
+ errorWithCode = _lib$util.errorWithCode,
234
260
  keys = _lib$util.keys,
235
261
  values = _lib$util.values,
236
262
  util_hasOwnProperty = _lib$util.hasOwnProperty,
@@ -271,7 +297,6 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
271
297
  var domUtil_lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_zeta_.util,
272
298
  domReady = domUtil_lib$util.domReady,
273
299
  tagName = domUtil_lib$util.tagName,
274
- domUtil_is = domUtil_lib$util.is,
275
300
  isVisible = domUtil_lib$util.isVisible,
276
301
  matchSelector = domUtil_lib$util.matchSelector,
277
302
  comparePosition = domUtil_lib$util.comparePosition,
@@ -298,11 +323,6 @@ var domUtil_lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_do
298
323
  getContentRect = domUtil_lib$util.getContentRect,
299
324
  scrollBy = domUtil_lib$util.scrollBy,
300
325
  scrollIntoView = domUtil_lib$util.scrollIntoView,
301
- createRange = domUtil_lib$util.createRange,
302
- rangeIntersects = domUtil_lib$util.rangeIntersects,
303
- rangeEquals = domUtil_lib$util.rangeEquals,
304
- rangeCovers = domUtil_lib$util.rangeCovers,
305
- compareRangePosition = domUtil_lib$util.compareRangePosition,
306
326
  makeSelection = domUtil_lib$util.makeSelection,
307
327
  getRect = domUtil_lib$util.getRect,
308
328
  getRects = domUtil_lib$util.getRects,
@@ -332,6 +352,7 @@ var _lib$dom = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_z
332
352
  releaseModal = _lib$dom.releaseModal,
333
353
  retainFocus = _lib$dom.retainFocus,
334
354
  releaseFocus = _lib$dom.releaseFocus,
355
+ iterateFocusPath = _lib$dom.iterateFocusPath,
335
356
  dom_focus = _lib$dom.focus;
336
357
 
337
358
  ;// CONCATENATED MODULE: ./src/include/zeta-dom/dom.js
@@ -918,31 +939,34 @@ definePrototype(ErrorHandlerMixin, StatefulMixin, {
918
939
  });
919
940
  }
920
941
  });
921
- ;// CONCATENATED MODULE: ./src/mixins/FlyoutMixin.js
922
-
942
+ ;// CONCATENATED MODULE: ./src/mixins/FlyoutToggleMixin.js
923
943
 
924
944
 
925
- var FlyoutMixinSuper = ClassNameMixin.prototype;
926
- var flyoutMixinCounter = 0;
927
-
945
+ var FlyoutToggleMixinSuper = ClassNameMixin.prototype;
928
946
  function FlyoutToggleMixin(mixin) {
929
947
  ClassNameMixin.call(this, ['target-opened']);
930
948
  this.flyoutMixin = mixin;
931
949
  }
932
-
933
950
  definePrototype(FlyoutToggleMixin, ClassNameMixin, {
934
951
  getCustomAttributes: function getCustomAttributes() {
935
952
  var element = this.flyoutMixin.elements()[0];
936
- return extend({}, FlyoutMixinSuper.getCustomAttributes.call(this), {
953
+ return extend({}, FlyoutToggleMixinSuper.getCustomAttributes.call(this), {
937
954
  'toggle': element && '#' + element.id
938
955
  });
939
956
  },
940
957
  clone: function clone() {
941
- return extend(FlyoutMixinSuper.clone.call(this), {
958
+ return extend(FlyoutToggleMixinSuper.clone.call(this), {
942
959
  flyoutMixin: this.flyoutMixin
943
960
  });
944
961
  }
945
962
  });
963
+ ;// CONCATENATED MODULE: ./src/mixins/FlyoutMixin.js
964
+
965
+
966
+
967
+
968
+ var FlyoutMixinSuper = ClassNameMixin.prototype;
969
+ var flyoutMixinCounter = 0;
946
970
  function FlyoutMixin() {
947
971
  var self = this;
948
972
  ClassNameMixin.call(self, ['open', 'closing', 'tweening-in', 'tweening-out']);
@@ -1090,17 +1114,21 @@ definePrototype(LoadingStateMixin, StatefulMixin, {
1090
1114
  }];
1091
1115
  }
1092
1116
  });
1117
+ // EXTERNAL MODULE: ./src/include/external/jquery.js
1118
+ var jquery = __webpack_require__(346);
1093
1119
  ;// CONCATENATED MODULE: ./src/mixins/ScrollableMixin.js
1094
1120
 
1095
1121
 
1096
1122
 
1097
1123
 
1124
+
1098
1125
  var ScrollableMixinSuper = ClassNameMixin.prototype;
1099
1126
  function ScrollableMixin() {
1100
1127
  var self = this;
1101
1128
  ClassNameMixin.call(self, ['scrollable-x', 'scrollable-x-l', 'scrollable-x-r', 'scrollable-y', 'scrollable-y-d', 'scrollable-y-u']);
1102
1129
  self.target = Mixin.scrollableTarget;
1103
1130
  self.pageIndex = 0;
1131
+ self.scrolling = false;
1104
1132
  }
1105
1133
  definePrototype(ScrollableMixin, ClassNameMixin, {
1106
1134
  withOptions: function withOptions(options) {
@@ -1123,11 +1151,19 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1123
1151
  },
1124
1152
  initElement: function initElement(element, state) {
1125
1153
  var self = this;
1126
- app_app.on(element, 'statechange', function (e) {
1127
- if ('pageIndex' in e.newValues) {
1128
- extend(self, {
1129
- pageIndex: e.newValues.pageIndex
1130
- });
1154
+ app_app.on(element, {
1155
+ statechange: function statechange(e) {
1156
+ if ('pageIndex' in e.newValues) {
1157
+ extend(self, {
1158
+ pageIndex: e.newValues.pageIndex
1159
+ });
1160
+ }
1161
+ },
1162
+ scrollStart: function scrollStart() {
1163
+ self.scrolling = true;
1164
+ },
1165
+ scrollStop: function scrollStop() {
1166
+ self.scrolling = false;
1131
1167
  }
1132
1168
  }, true);
1133
1169
  },
@@ -1137,6 +1173,12 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1137
1173
  return mixin;
1138
1174
  }
1139
1175
  });
1176
+ each('destroy enable disable setOptions refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement', function (i, v) {
1177
+ defineHiddenProperty(ScrollableMixin.prototype, v, function () {
1178
+ var obj = jquery(this.elements());
1179
+ return obj.scrollable.apply(obj, [v].concat(makeArray(arguments)));
1180
+ });
1181
+ });
1140
1182
  ;// CONCATENATED MODULE: ./src/mixin.js
1141
1183
 
1142
1184
 
@@ -1152,6 +1194,7 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1152
1194
 
1153
1195
 
1154
1196
 
1197
+
1155
1198
  function extendSelf(options) {
1156
1199
  extend(this, options);
1157
1200
  }
@@ -1196,12 +1239,22 @@ var animateIn = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_bre
1196
1239
 
1197
1240
 
1198
1241
  var routeMap = new Map();
1242
+ var usedParams = {};
1243
+ var stateId;
1199
1244
 
1200
1245
  function ViewContainer() {
1201
1246
  /** @type {any} */
1202
1247
  var self = this;
1203
1248
  external_commonjs_react_commonjs2_react_amd_react_root_React_.Component.apply(self, arguments);
1204
1249
  self.mounted = false;
1250
+
1251
+ if (!stateId) {
1252
+ stateId = history.state;
1253
+ app_app.on('navigate', function () {
1254
+ stateId = history.state;
1255
+ });
1256
+ }
1257
+
1205
1258
  self.componentWillUnmount = app_app.on('navigate', function () {
1206
1259
  if (self.mounted && self.getViewComponent()) {
1207
1260
  self.forceUpdate();
@@ -1233,8 +1286,8 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
1233
1286
  }
1234
1287
 
1235
1288
  self.currentView = /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(V, {
1236
- key: app_app.route.view,
1237
- rootProps: exclude(self.props, ['views']),
1289
+ key: routeMap.get(V).id,
1290
+ rootProps: self.props.rootProps,
1238
1291
  onComponentLoaded: function onComponentLoaded(element) {
1239
1292
  self.currentElement = element;
1240
1293
  util_setImmediate(function () {
@@ -1247,17 +1300,19 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
1247
1300
  return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(external_commonjs_react_commonjs2_react_amd_react_root_React_.Fragment, null, self.prevView, self.currentView);
1248
1301
  },
1249
1302
  getViewComponent: function getViewComponent() {
1250
- var views = this.props.views;
1251
- return any(views, isViewMatched) || void redirectTo(views[0]);
1303
+ var props = this.props;
1304
+ return any(props.views, isViewMatched) || history.state === stateId && void redirectTo(props.defaultView);
1252
1305
  }
1253
1306
  });
1254
1307
  function isViewMatched(view) {
1255
1308
  var params = routeMap.get(view);
1256
- return !!params && equal(params, pick(app_app.route, keys(params)));
1309
+ return !!params && false === any(params.matchers, function (v, i) {
1310
+ var value = app_app.route[i] || '';
1311
+ return isFunction(v) ? !v(value) : (v || '') !== value;
1312
+ });
1257
1313
  }
1258
1314
  function registerView(factory, routeParams) {
1259
1315
  var Component = function Component(props) {
1260
- var childProps = exclude(props, ['rootProps', 'onComponentLoaded']);
1261
1316
  var Component = (0,external_zeta_dom_react_.useAsync)(factory)[0];
1262
1317
  return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement('div', extend({}, props.rootProps, {
1263
1318
  ref: function ref(element) {
@@ -1265,27 +1320,56 @@ function registerView(factory, routeParams) {
1265
1320
  (props.onComponentLoaded || noop)(element);
1266
1321
  }
1267
1322
  },
1268
- children: Component && /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(Component["default"], childProps)
1323
+ children: Component && /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(Component["default"])
1269
1324
  }));
1270
1325
  };
1271
1326
 
1272
- routeMap.set(Component, routeParams);
1327
+ routeParams = extend({}, routeParams);
1328
+ each(routeParams, function (i, v) {
1329
+ usedParams[i] = true;
1330
+
1331
+ if (v instanceof RegExp) {
1332
+ routeParams[i] = v.test.bind(v);
1333
+ }
1334
+ });
1335
+ routeMap.set(Component, {
1336
+ id: randomId(),
1337
+ matchCount: keys(routeParams).length,
1338
+ matchers: routeParams,
1339
+ params: pick(routeParams, function (v) {
1340
+ return typeof v === 'string';
1341
+ })
1342
+ });
1273
1343
  return Component;
1274
1344
  }
1275
1345
  function renderView() {
1276
1346
  var views = makeArray(arguments);
1277
- var props;
1278
-
1279
- if (views[0] && typeof views[0] !== 'function') {
1280
- props = views.shift();
1281
- }
1282
-
1283
- return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(ViewContainer, extend({}, props, {
1284
- views: views
1285
- }));
1347
+ var rootProps = isFunction(views[0]) ? {} : views.shift();
1348
+ var defaultView = views[0];
1349
+ views.sort(function (a, b) {
1350
+ return (routeMap.get(b) || {}).matchCount - (routeMap.get(a) || {}).matchCount;
1351
+ });
1352
+ return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(ViewContainer, {
1353
+ rootProps: rootProps,
1354
+ views: views,
1355
+ defaultView: defaultView
1356
+ });
1286
1357
  }
1287
1358
  function linkTo(view, params) {
1288
- return app_app.route.getPath(extend({}, app_app.route, params, routeMap.get(view)));
1359
+ var viewParams = (routeMap.get(view) || {}).params;
1360
+ var newParams = {};
1361
+
1362
+ for (var i in app_app.route) {
1363
+ if (viewParams && i in viewParams) {
1364
+ newParams[i] = viewParams[i];
1365
+ } else if (params && i in params) {
1366
+ newParams[i] = params[i];
1367
+ } else if (!usedParams[i]) {
1368
+ newParams[i] = app_app.route[i];
1369
+ }
1370
+ }
1371
+
1372
+ return app_app.route.getPath(newParams);
1289
1373
  }
1290
1374
  function navigateTo(view, params) {
1291
1375
  return app_app.navigate(linkTo(view, params));